diff --git a/.azure-pipelines/azure-pipelines-UpgrateVersion.yml b/.azure-pipelines/azure-pipelines-UpgrateVersion.yml index b0b84cf3b1fb..cc6135b045ef 100644 --- a/.azure-pipelines/azure-pipelines-UpgrateVersion.yml +++ b/.azure-pipelines/azure-pipelines-UpgrateVersion.yml @@ -11,32 +11,51 @@ schedules: displayName: Daily Build branches: include: - - 202012 + - 20* + exclude: + - 200* + - 201* + - 202006 always: true +resources: + repositories: + - repository: buildimage + type: github + name: Azure/sonic-buildimage + ref: master + endpoint: build + pool: sonicbld +parameters: +- name: 'jobFilters' + type: object + default: + - vs + - barefoot + - broadcom + - centec + - centec-arm64 + - generic + - marvell-armhf + - mellanox + stages: - stage: Build variables: - CACHE_MODE: none - VERSION_CONTROL_OPTIONS: 'SONIC_VERSION_CONTROL_COMPONENTS=' + - name: CACHE_MODE + value: none + - name: VERSION_CONTROL_OPTIONS + value: 'SONIC_VERSION_CONTROL_COMPONENTS=' + - template: .azure-pipelines/template-variables.yml@buildimage jobs: - template: azure-pipelines-build.yml parameters: - buildOptions: '${{ variables.VERSION_CONTROL_OPTIONS }} SONIC_BUILD_JOBS=$(nproc) ENABLE_IMAGE_SIGNATURE=y' + jobFilters: ${{ parameters.jobFilters }} + buildOptions: '${{ variables.VERSION_CONTROL_OPTIONS }} ENABLE_DOCKER_BASE_PULL=n SONIC_BUILD_JOBS=$(nproc) ENABLE_IMAGE_SIGNATURE=y' preSteps: - - script: | - containers=$(docker container ls | grep "sonic-slave" | awk '{ print $1 }') - if [ ! -z "$containers" ]; then - docker container kill $containers || true - sleep 5 - fi - images=$(docker images 'sonic-slave-*' -a -q) - if [ ! -z "$images" ]; then - docker rmi -f $images - fi - displayName: 'Cleanup sonic slave' + - template: .azure-pipelines/template-clean-sonic-slave.yml@buildimage - stage: UpgradeVersions jobs: - job: UpgradeVersions @@ -60,14 +79,14 @@ stages: default_platform=broadcom artifacts=$(find $(Pipeline.Workspace) -maxdepth 1 -type d -name 'sonic-buildimage.*' | grep -v "sonic-buildimage.${default_platform}") echo "artifacts$artifacts" - cp -r $(Pipeline.Workspace)/sonic-buildimage.${default_platform}/versions target/ + cp -r $(Pipeline.Workspace)/sonic-buildimage.${default_platform}/target/versions target/ make freeze FREEZE_VERSION_OPTIONS=-r find files/build/versions ordered_artifacts=$(echo "$artifacts" | grep -v -E "arm64|armhf" && echo "$artifacts" | grep -E "arm64|armhf") for artifact in $ordered_artifacts do rm -rf target/versions - cp -r $artifact/versions target/ + cp -r $artifact/target/versions target/ OPTIONS="-a -d" [[ "$artifact" == *arm64* || "$artifact" == *armhf* ]] && OPTIONS="-d" make freeze FREEZE_VERSION_OPTIONS="$OPTIONS" diff --git a/.azure-pipelines/azure-pipelines-build.yml b/.azure-pipelines/azure-pipelines-build.yml index 2b90f6bf3cd4..c84c91441806 100644 --- a/.azure-pipelines/azure-pipelines-build.yml +++ b/.azure-pipelines/azure-pipelines-build.yml @@ -50,6 +50,7 @@ jobs: swi_image: yes - name: broadcom + timeoutInMinutes: 1440 variables: dbg_image: yes swi_image: yes @@ -64,7 +65,7 @@ jobs: platform_rpc: centec - name: centec-arm64 - pool: sonicbld_8c + pool: sonicbld-arm64 timeoutInMinutes: 2880 variables: PLATFORM_ARCH: arm64 @@ -78,7 +79,7 @@ jobs: dbg_image: yes - name: marvell-armhf - pool: sonicbld_8c + pool: sonicbld-armhf timeoutInMinutes: 2880 variables: PLATFORM_ARCH: armhf @@ -101,7 +102,8 @@ jobs: set -ex if [ $(GROUP_NAME) == vs ]; then if [ $(dbg_image) == yes ]; then - make $BUILD_OPTIONS INSTALL_DEBUG_TOOLS=y target/sonic-vs.img.gz && mv target/sonic-vs.img.gz target/sonic-vs-dbg.img.gz + make $BUILD_OPTIONS INSTALL_DEBUG_TOOLS=y target/sonic-vs.img.gz + mv target/sonic-vs.img.gz target/sonic-vs-dbg.img.gz fi make $BUILD_OPTIONS target/docker-sonic-vs.gz target/sonic-vs.img.gz target/docker-ptf.gz if [ $(Build.Reason) != 'PullRequest' ];then @@ -111,8 +113,8 @@ jobs: fi else if [ $(dbg_image) == yes ]; then - make $BUILD_OPTIONS INSTALL_DEBUG_TOOLS=y target/sonic-$(GROUP_NAME).bin && \ - mv target/sonic-$(GROUP_NAME).bin target/sonic-$(GROUP_NAME)-dbg.bin + make $BUILD_OPTIONS INSTALL_DEBUG_TOOLS=y target/sonic-$(GROUP_NAME).bin + mv target/sonic-$(GROUP_NAME).bin target/sonic-$(GROUP_NAME)-dbg.bin fi if [ $(swi_image) == yes ]; then make $BUILD_OPTIONS ENABLE_IMAGE_SIGNATURE=y target/sonic-aboot-$(GROUP_NAME).swi @@ -130,3 +132,4 @@ jobs: make $BUILD_OPTIONS target/sonic-$(GROUP_NAME).bin fi displayName: "Build sonic image" + - template: check-dirty-version.yml diff --git a/.azure-pipelines/azure-pipelines-image-template.yml b/.azure-pipelines/azure-pipelines-image-template.yml index 3c437cc56664..7f2874024740 100644 --- a/.azure-pipelines/azure-pipelines-image-template.yml +++ b/.azure-pipelines/azure-pipelines-image-template.yml @@ -26,9 +26,9 @@ jobs: jobVariables: ${{ parameters.jobVariables }} preSteps: - template: cleanup.yml - - ${{ parameters. preSteps }} + - ${{ parameters.preSteps }} - script: | - if [ -n "$(CACHE_MODE)" ] && echo $(PLATFORM_AZP) | grep -E -q "^(vs|broadcom|mellanox)$"; then + if [ -n "$(CACHE_MODE)" ] && echo $(PLATFORM_AZP) | grep -E -q "^(vs|broadcom|mellanox|marvell-armhf)$"; then CACHE_OPTIONS="SONIC_DPKG_CACHE_METHOD=$(CACHE_MODE) SONIC_DPKG_CACHE_SOURCE=/nfs/dpkg_cache/$(PLATFORM_AZP)" BUILD_OPTIONS="$(BUILD_OPTIONS) $CACHE_OPTIONS" echo "##vso[task.setvariable variable=BUILD_OPTIONS]$BUILD_OPTIONS" @@ -36,6 +36,7 @@ jobs: displayName: "Set cache options" - checkout: self submodules: recursive + condition: eq(variables.SKIP_CHECKOUT, '') displayName: 'Checkout code' - script: | BRANCH_NAME=$(Build.SourceBranchName) @@ -49,9 +50,14 @@ jobs: postSteps: - script: cp target -r $(Build.ArtifactStagingDirectory)/ displayName: Copy Artifacts + condition: always() - publish: $(Build.ArtifactStagingDirectory) artifact: 'sonic-buildimage.$(GROUP_NAME)$(GROUP_EXTNAME)' displayName: "Archive sonic image" + - publish: $(Build.ArtifactStagingDirectory) + condition: failed() + artifact: 'sonic-buildimage.$(GROUP_NAME)$(GROUP_EXTNAME)$(System.JobAttempt)' + displayName: "Archive failed sonic image" - ${{ parameters.postSteps }} - template: cleanup.yml jobGroups: ${{ parameters.jobGroups }} diff --git a/.azure-pipelines/azure-pipelines-job-groups.yml b/.azure-pipelines/azure-pipelines-job-groups.yml index 1a4dbb79cc0e..021185ccf520 100644 --- a/.azure-pipelines/azure-pipelines-job-groups.yml +++ b/.azure-pipelines/azure-pipelines-job-groups.yml @@ -19,7 +19,7 @@ parameters: default: '' - name: 'timeoutInMinutes' type: 'number' - default: 720 + default: 900 - name: 'jobFilters' type: object default: '' diff --git a/.azure-pipelines/azure-pipelines-repd-build-variables.yml b/.azure-pipelines/azure-pipelines-repd-build-variables.yml new file mode 100644 index 000000000000..7e831109e2ad --- /dev/null +++ b/.azure-pipelines/azure-pipelines-repd-build-variables.yml @@ -0,0 +1,5 @@ +variables: + ${{ if and(ge(variables['Build.SourceBranchName'], '202012'), le(variables['Build.SourceBranchName'], '299999')) }}: + VERSION_CONTROL_OPTIONS: 'SONIC_VERSION_CONTROL_COMPONENTS=deb,py2,py3,web,git,docker' + ${{ if or(lt(variables['Build.SourceBranchName'], '202012'), gt(variables['Build.SourceBranchName'], '299999')) }}: + VERSION_CONTROL_OPTIONS: '' diff --git a/.azure-pipelines/build-commonlib.yml b/.azure-pipelines/build-commonlib.yml new file mode 100644 index 000000000000..df9bcb25ae70 --- /dev/null +++ b/.azure-pipelines/build-commonlib.yml @@ -0,0 +1,19 @@ +pr: none +trigger: none +schedules: +- cron: "0 0 * * *" + displayName: Daily build + branches: + include: + - master + - 202??? +resources: + repositories: + - repository: buildimage + type: github + name: Azure/sonic-buildimage + ref: master + endpoint: build + +jobs: +- template: .azure-pipelines/template-commonlib.yml@buildimage diff --git a/.azure-pipelines/check-dirty-version.yml b/.azure-pipelines/check-dirty-version.yml new file mode 100644 index 000000000000..5d3909bd280e --- /dev/null +++ b/.azure-pipelines/check-dirty-version.yml @@ -0,0 +1,16 @@ +steps: +- script: | + . functions.sh + SONIC_VERSION=$(sonic_get_version) + echo "SONIC_VERSION=$SONIC_VERSION" + if [[ "$SONIC_VERSION" == *dirty* ]]; then + # Print the detail dirty info + git status --untracked-files=no -s --ignore-submodules + + # Exit with error, if it is a PR build + if [ "$(Build.Reason)" == "PullRequest" ]; then + echo "Build failed for the dirty version: $SONIC_VERSION" 1>&2 + exit 1 + fi + fi + displayName: "Check the dirty version" diff --git a/.azure-pipelines/docker-sonic-slave-arm64.yml b/.azure-pipelines/docker-sonic-slave-arm64.yml new file mode 100644 index 000000000000..2a9af06c3d01 --- /dev/null +++ b/.azure-pipelines/docker-sonic-slave-arm64.yml @@ -0,0 +1,52 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml +# Build and push sonic-slave-[buster|jessie|stretch] images for amd64/armhf/arm64 +resources: + repositories: + - repository: buildimage + type: github + name: Azure/sonic-buildimage + ref: master + endpoint: build + +schedules: +- cron: "0 8 * * *" + branches: + include: + - master + - 202012 + always: true + +trigger: none +pr: + branches: + include: + - master + paths: + include: + - sonic-slave-jessie + - sonic-slave-stretch + - sonic-slave-buster + - sonic-slave-bullseye + - .azure-pipelines + +parameters: +- name: 'dists' + type: object + default: + - bullseye + - buster + - stretch + +stages: +- stage: Build + jobs: + - ${{ each dist in parameters.dists }}: + - ${{ if contains(variables['Build.DefinitionName'], dist) }}: + - template: docker-sonic-slave-template.yml + parameters: + pool: sonicbld-arm64 + arch: arm64 + dist: ${{ dist }} diff --git a/.azure-pipelines/docker-sonic-slave-armhf.yml b/.azure-pipelines/docker-sonic-slave-armhf.yml new file mode 100644 index 000000000000..69e73479f342 --- /dev/null +++ b/.azure-pipelines/docker-sonic-slave-armhf.yml @@ -0,0 +1,52 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml +# Build and push sonic-slave-[buster|jessie|stretch] images for amd64/armhf/arm64 +resources: + repositories: + - repository: buildimage + type: github + name: Azure/sonic-buildimage + ref: master + endpoint: build + +schedules: +- cron: "0 8 * * *" + branches: + include: + - master + - 202012 + always: true + +trigger: none +pr: + branches: + include: + - master + paths: + include: + - sonic-slave-jessie + - sonic-slave-stretch + - sonic-slave-buster + - sonic-slave-bullseye + - .azure-pipelines + +parameters: +- name: 'dists' + type: object + default: + - bullseye + - buster + - stretch + +stages: +- stage: Build + jobs: + - ${{ each dist in parameters.dists }}: + - ${{ if contains(variables['Build.DefinitionName'], dist) }}: + - template: docker-sonic-slave-template.yml + parameters: + pool: sonicbld-armhf + arch: armhf + dist: ${{ dist }} diff --git a/.azure-pipelines/docker-sonic-slave-template.yml b/.azure-pipelines/docker-sonic-slave-template.yml new file mode 100644 index 000000000000..2cf06638a4cc --- /dev/null +++ b/.azure-pipelines/docker-sonic-slave-template.yml @@ -0,0 +1,120 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml +# Build and push sonic-slave-[buster|jessie|stretch] images for amd64/armhf/arm64 +parameters: +- name: arch + type: string + values: + - amd64 + - armhf + - arm64 +- name: dist + type: string + values: + - bullseye + - buster + - stretch + - jessie +- name: registry_url + type: string + default: sonicdev-microsoft.azurecr.io +- name: registry_conn + type: string + default: sonicdev +- name: pool + type: string + default: sonicbld + values: + - sonicbld + - sonicbld-arm64 + - sonicbld-armhf + +jobs: +- job: Build_${{ parameters.dist }}_${{ parameters.arch }} + timeoutInMinutes: 360 + pool: ${{ parameters.pool }} + steps: + - template: cleanup.yml + - ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: + - template: template-clean-sonic-slave.yml + - ${{ else }}: + - template: '/.azure-pipelines/template-clean-sonic-slave.yml@buildimage' + - checkout: self + clean: true + submodules: recursive + - bash: | + set -ex + + SLAVE_DIR=sonic-slave-${{ parameters.dist }} + if [ x${{ parameters.pool }} == x"sonicbld" ]; then + if [ x${{ parameters.arch }} == x"amd64" ]; then + SLAVE_BASE_IMAGE=${SLAVE_DIR} + SLAVE_BASE_IMAGE_UPLOAD=${SLAVE_DIR} + elif [ x${{ parameters.pool }} == x"sonicbld" ]; then + SLAVE_BASE_IMAGE=${SLAVE_DIR}-march-${{ parameters.arch }} + SLAVE_BASE_IMAGE_UPLOAD=${SLAVE_DIR}-march-${{ parameters.arch }} + fi + elif [[ x${{ parameters.pool }} == x"sonicbld-armhf" && x${{ parameters.arch }} == x"armhf" ]]; then + SLAVE_BASE_IMAGE=${SLAVE_DIR} + SLAVE_BASE_IMAGE_UPLOAD=${SLAVE_DIR}-armhf + elif [[ x${{ parameters.pool }} == x"sonicbld-arm64" && x${{ parameters.arch }} == x"arm64" ]]; then + SLAVE_BASE_IMAGE=${SLAVE_DIR} + SLAVE_BASE_IMAGE_UPLOAD=${SLAVE_DIR}-arm64 + else + echo "do not support build ${{ parameters.arch }} on ${{ parameters.pool }}" + exit 1 + fi + + if [ x"$(Build.SourceBranchName)" == x"202012" ]; then + BUILD_OPTIONS = 'SONIC_VERSION_CONTROL_COMPONENTS=deb,py2,py3,web,git,docker' + fi + + tmpfile=$(mktemp) + + echo ${{ parameters.arch }} > .arch + + DOCKER_DATA_ROOT_FOR_MULTIARCH=/data/march/docker BLDENV=${{ parameters.dist }} $(BUILD_OPTIONS) make -f Makefile.work sonic-slave-build | tee $tmpfile + SLAVE_BASE_TAG=$(grep "^Checking sonic-slave-base image:" $tmpfile | awk -F ':' '{print $3}') + SLAVE_TAG=$(grep "^Checking sonic-slave image:" $tmpfile | awk -F ':' '{print $3}') + + mkdir -p target + + docker tag $SLAVE_BASE_IMAGE:$SLAVE_BASE_TAG $REGISTRY_SERVER/$SLAVE_BASE_IMAGE_UPLOAD:latest + docker tag $SLAVE_BASE_IMAGE:$SLAVE_BASE_TAG $REGISTRY_SERVER/$SLAVE_BASE_IMAGE_UPLOAD:$SLAVE_BASE_TAG + if [ "$SLAVE_BASE_IMAGE_UPLOAD" != "$SLAVE_DIR" ]; then + docker tag $SLAVE_BASE_IMAGE:$SLAVE_BASE_TAG $REGISTRY_SERVER/$SLAVE_DIR:latest-${{ parameters.arch }} + docker tag $SLAVE_BASE_IMAGE:$SLAVE_BASE_TAG $REGISTRY_SERVER/$SLAVE_DIR:$SLAVE_BASE_TAG + fi + set +x + echo "##vso[task.setvariable variable=VARIABLE_SLAVE_BASE_IMAGE]$SLAVE_BASE_IMAGE_UPLOAD" + echo "##vso[task.setvariable variable=VARIABLE_SLAVE_BASE_TAG]$SLAVE_BASE_TAG" + env: + REGISTRY_SERVER: ${{ parameters.registry_url }} + displayName: Build sonic-slave-${{ parameters.dist }}-${{ parameters.arch }} + + - task: Docker@2 + condition: ne(variables['Build.Reason'], 'PullRequest') + displayName: Upload image + inputs: + containerRegistry: ${{ parameters.registry_conn }} + repository: $(VARIABLE_SLAVE_BASE_IMAGE) + command: push + ${{ if eq(variables['Build.SourceBranchName'], 'master') }}: + tags: | + $(VARIABLE_SLAVE_BASE_TAG) + latest + ${{ else }}: + tags: | + $(VARIABLE_SLAVE_BASE_TAG) + - ${{ if ne(parameters.arch, 'amd64') }}: + - task: Docker@2 + condition: ne(variables['Build.Reason'], 'PullRequest') + displayName: Upload image ${{ parameters.dist }} + inputs: + containerRegistry: ${{ parameters.registry_conn }} + repository: "sonic-slave-${{ parameters.dist }}" + command: push + tags: | + $(VARIABLE_SLAVE_BASE_TAG) diff --git a/.azure-pipelines/docker-sonic-slave.yml b/.azure-pipelines/docker-sonic-slave.yml index c9121df880b0..3ae3f88f0154 100644 --- a/.azure-pipelines/docker-sonic-slave.yml +++ b/.azure-pipelines/docker-sonic-slave.yml @@ -3,6 +3,13 @@ # Add steps that build, run tests, deploy, and more: # https://aka.ms/yaml # Build and push sonic-slave-[buster|jessie|stretch] images for amd64/armhf/arm64 +resources: + repositories: + - repository: buildimage + type: github + name: Azure/sonic-buildimage + ref: master + endpoint: build schedules: - cron: "0 8 * * *" @@ -23,6 +30,8 @@ pr: - sonic-slave-stretch - sonic-slave-buster - sonic-slave-bullseye + - src/sonic-build-hooks + - .azure-pipelines parameters: - name: 'arches' @@ -45,70 +54,21 @@ parameters: type: string default: sonicdev -variables: -- ${{ if eq(variables['Build.SourceBranchName'], '202012') }}: - - name: BUILD_OPTIONS - value: 'SONIC_VERSION_CONTROL_COMPONENTS=deb,py2,py3,web,git,docker' - stages: - stage: Build jobs: - ${{ each dist in parameters.dists }}: - ${{ if endswith(variables['Build.DefinitionName'], dist) }}: - ${{ each arch in parameters.arches }}: - - job: Build_${{ dist }}_${{ arch }} - timeoutInMinutes: 360 - pool: sonicbld - steps: - - template: cleanup.yml - - checkout: self - clean: true - submodules: recursive - - bash: | - set -ex - - containers=$(docker container ls | grep "sonic-slave" | awk '{ print $1 }') - if [ ! -z "$containers" ]; then - docker container kill $containers || true - sleep 5 - fi - images=$(docker images 'sonic-slave-*' -a -q) - if [ ! -z "$images" ]; then - docker rmi -f $images - fi - - SLAVE_DIR=sonic-slave-${{ dist }} - if [ x${{ arch }} == x"amd64" ]; then - SLAVE_BASE_IMAGE=${SLAVE_DIR} - else - SLAVE_BASE_IMAGE=${SLAVE_DIR}-march-${{ arch }} - fi - - tmpfile=$(mktemp) - - echo ${{ arch }} > .arch - - DOCKER_DATA_ROOT_FOR_MULTIARCH=/data/march/docker BLDENV=${{ dist }} $(BUILD_OPTIONS) make -f Makefile.work sonic-slave-build | tee $tmpfile - SLAVE_BASE_TAG=$(grep "^Checking sonic-slave-base image:" $tmpfile | awk -F ':' '{print $3}') - SLAVE_TAG=$(grep "^Checking sonic-slave image:" $tmpfile | awk -F ':' '{print $3}') - - mkdir -p target - - docker tag $SLAVE_BASE_IMAGE:$SLAVE_BASE_TAG $REGISTRY_SERVER/$SLAVE_BASE_IMAGE:latest - docker tag $SLAVE_BASE_IMAGE:$SLAVE_BASE_TAG $REGISTRY_SERVER/$SLAVE_BASE_IMAGE:$SLAVE_BASE_TAG - set +x - echo "##vso[task.setvariable variable=VARIABLE_SLAVE_BASE_IMAGE]$SLAVE_BASE_IMAGE" - echo "##vso[task.setvariable variable=VARIABLE_SLAVE_BASE_TAG]$SLAVE_BASE_TAG" - env: - REGISTRY_SERVER: ${{ parameters.registry_url }} - displayName: Build sonic-slave-${{ dist }}-${{ arch }} - - - task: Docker@2 - displayName: Upload image - inputs: - containerRegistry: ${{ parameters.registry_conn }} - repository: $(VARIABLE_SLAVE_BASE_IMAGE) - command: push - tags: | - $(VARIABLE_SLAVE_BASE_TAG) - latest + - ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: + - template: docker-sonic-slave-template.yml + parameters: + pool: sonicbld + arch: ${{ arch }} + dist: ${{ dist }} + - ${{ else }}: + - template: '/.azure-pipelines/docker-sonic-slave-template.yml@buildimage' + parameters: + pool: sonicbld + arch: ${{ arch }} + dist: ${{ dist }} diff --git a/.azure-pipelines/official-build-cache.yml b/.azure-pipelines/official-build-cache.yml index b3c9c6c8767d..94fd48ede501 100644 --- a/.azure-pipelines/official-build-cache.yml +++ b/.azure-pipelines/official-build-cache.yml @@ -18,7 +18,9 @@ stages: - stage: Build pool: sonicbld variables: - CACHE_MODE: cache + - name: CACHE_MODE + value: cache + - template: azure-pipelines-repd-build-variables.yml jobs: - template: azure-pipelines-build.yml parameters: @@ -35,3 +37,8 @@ stages: variables: docker_syncd_rpc_image: yes platform_rpc: mlnx + - name: marvell-armhf + pool: sonicbld-armhf + timeoutInMinutes: 1200 + variables: + PLATFORM_ARCH: armhf diff --git a/.azure-pipelines/official-build-cisco-8000.yml b/.azure-pipelines/official-build-cisco-8000.yml new file mode 100644 index 000000000000..61b6b03171e3 --- /dev/null +++ b/.azure-pipelines/official-build-cisco-8000.yml @@ -0,0 +1,94 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml + +schedules: +- cron: "0 8 * * *" + displayName: Daily midnight build + branches: + include: + - master + - 202012 + always: true + +trigger: none +pr: none + +resources: + repositories: + - repository: cisco-8000 + type: github + name: Cisco-8000-sonic/platform-cisco-8000 + endpoint: cisco-connection + +variables: +- group: SONIC-AKV-STROAGE-1 +- name: StorageSASKey + value: $(sonicstorage-SasToken) + +stages: +- stage: Build + pool: sonic + variables: + CACHE_MODE: wcache + SKIP_CHECKOUT: true + TERM: '' + PACKAGE_URL: "https://sonicstorage.blob.core.windows.net/packages" + + jobs: + - template: azure-pipelines-build.yml + parameters: + buildOptions: 'USERNAME=admin SONIC_BUILD_JOBS=$(nproc) ${{ variables.VERSION_CONTROL_OPTIONS }}' + preSteps: + - checkout: self + submodules: recursive + path: s + displayName: 'Checkout code' + - checkout: cisco-8000 + submodules: recursive + path: s/platform/cisco-8000 + displayName: 'Checkout cisco-8000' + - script: | + cisco_ref=$(cat platform/checkout/cisco-8000.ini | grep '^ref=' | cut -d= -f2) + echo "The cisco 8000 release version is $cisco_ref" + echo "##vso[task.setvariable variable=cisco.ref]$cisco_ref" + displayName: 'Export cisco release version' + - task: DownloadGitHubRelease@0 + inputs: + connection: cisco-connection + userRepository: Cisco-8000-sonic/platform-cisco-8000 + defaultVersionType: specificTag + version: $(cisco.ref) + itemPattern: 'artifactory-*.tar.gz' + downloadPath: '$(System.ArtifactsDirectory)' + - script: | + make PLATFORM=cisco-8000 platform/cisco-8000 + tar xfz $(System.ArtifactsDirectory)/artifactory-*.tar.gz -C platform/cisco-8000 + displayName: 'Setup cisco artifacts' + - script: | + set -ex + filename=$(find platform/cisco-8000/artifactory/sonic -name cisco-* -type f | head -n 1) + if [ -z "$filename" ]; then + echo "Cisco sai package not found" 1>&2 + exit 1 + fi + cd $(dirname $filename) + echo "PWD=$(pwd)" + ls -l *.deb + while read -r package; do + # Cisco version format: -sai--- + # The may contain several values in one build, the part is skipped when publishing to storage + # See https://github.com/Cisco-8000-sonic/sdk/blob/master/azure-pipelines.yml + # The $PACKAGE_URL is only accessible for AZP + version=$(echo $package | awk -F_ '{print $(NF-1)}' | cut -d- -f1,2,4,5) + package_url="$PACKAGE_URL/sai/ciscosai/master/$version/$package" + echo "Override package $package from $package_url" + wget "$package_url$StorageSASKey" -O "$package" + done < <(ls *.deb) + env: + StorageSASKey: $(StorageSASKey) + condition: ne(variables['Build.Reason'], 'PullRequest') + displayName: "Override cisco sai packages" + jobGroups: + - name: cisco-8000 diff --git a/.azure-pipelines/official-build-multi-asic.yml b/.azure-pipelines/official-build-multi-asic.yml index d220ecc34747..8fe0be32db10 100644 --- a/.azure-pipelines/official-build-multi-asic.yml +++ b/.azure-pipelines/official-build-multi-asic.yml @@ -18,9 +18,9 @@ stages: - stage: Build pool: sonicbld variables: - CACHE_MODE: wcache - ${{ if eq(variables['Build.SourceBranchName'], '202012') }}: - VERSION_CONTROL_OPTIONS: 'SONIC_VERSION_CONTROL_COMPONENTS=deb,py2,py3,web' + - template: azure-pipelines-repd-build-variables.yml + - name: CACHE_MODE + value: wcache jobs: - template: azure-pipelines-build.yml parameters: diff --git a/.azure-pipelines/official-build.yml b/.azure-pipelines/official-build.yml index 8173753e5aa8..fb986cf67039 100644 --- a/.azure-pipelines/official-build.yml +++ b/.azure-pipelines/official-build.yml @@ -18,16 +18,27 @@ schedules: - 201911 - 201811 +resources: + repositories: + - repository: buildimage + type: github + name: Azure/sonic-buildimage + ref: master + endpoint: build + trigger: none pr: none +variables: +- template: .azure-pipelines/template-variables.yml@buildimage + stages: - stage: Build pool: sonicbld variables: - CACHE_MODE: wcache - ${{ if eq(variables['Build.SourceBranchName'], '202012') }}: - VERSION_CONTROL_OPTIONS: 'SONIC_VERSION_CONTROL_COMPONENTS=deb,py2,py3,web' + - name: CACHE_MODE + value: wcache + - template: azure-pipelines-repd-build-variables.yml jobs: - template: azure-pipelines-build.yml parameters: diff --git a/.azure-pipelines/run-test-template.yml b/.azure-pipelines/run-test-template.yml index d490873d15e1..2ab707287c7c 100644 --- a/.azure-pipelines/run-test-template.yml +++ b/.azure-pipelines/run-test-template.yml @@ -7,6 +7,9 @@ parameters: type: string - name: ptf_name type: string +- name: section + type: string + default: '' - name: image type: string default: sonic-vs.img.gz @@ -43,7 +46,7 @@ steps: - script: | rm -rf $(Build.ArtifactStagingDirectory)/* - docker exec sonic-mgmt bash -c "/data/sonic-mgmt/tests/kvmtest.sh -en -T ${{ parameters.tbtype }} ${{ parameters.tbname }} ${{ parameters.dut }}" + docker exec sonic-mgmt bash -c "/data/sonic-mgmt/tests/kvmtest.sh -en -T ${{ parameters.tbtype }} ${{ parameters.tbname }} ${{ parameters.dut }} ${{ parameters.section }}" displayName: "Run tests" - script: | @@ -75,17 +78,17 @@ steps: condition: succeededOrFailed() - publish: $(Build.ArtifactStagingDirectory)/kvmdump - artifact: sonic-buildimage.kvmtest.${{ parameters.tbtype}}.memdump@$(System.JobAttempt) + artifact: sonic-buildimage.kvmtest.${{ parameters.tbtype}}${{ parameters.section }}.memdump@$(System.JobAttempt) displayName: "Archive sonic kvm memdump" condition: failed() - publish: $(Build.ArtifactStagingDirectory)/logs - artifact: sonic-buildimage.kvmtest.${{ parameters.tbtype }}.log@$(System.JobAttempt) + artifact: sonic-buildimage.kvmtest.${{ parameters.tbtype }}${{ parameters.section }}.log@$(System.JobAttempt) displayName: "Archive sonic kvm logs" condition: succeededOrFailed() - task: PublishTestResults@2 inputs: testResultsFiles: '$(Build.ArtifactStagingDirectory)/logs/**/*.xml' - testRunTitle: kvmtest.${{ parameters.tbtype }} + testRunTitle: kvmtest.${{ parameters.tbtype }}${{ parameters.section }} condition: succeededOrFailed() diff --git a/.azure-pipelines/template-clean-sonic-slave.yml b/.azure-pipelines/template-clean-sonic-slave.yml new file mode 100644 index 000000000000..ddb8c8e48f6a --- /dev/null +++ b/.azure-pipelines/template-clean-sonic-slave.yml @@ -0,0 +1,10 @@ +steps: +- script: | + set -x + containers=$(docker container ls -aq) + [ -n "$containers" ] && docker container rm -f $containers + docker images | grep "^" | awk '{print$3}' | xargs -i docker rmi {} + images=$(docker images 'sonic-slave-*' -a -q) + [ -n "$images" ] && docker rmi -f $images + exit 0 + displayName: 'Cleanup sonic slave' diff --git a/.azure-pipelines/template-commonlib.yml b/.azure-pipelines/template-commonlib.yml new file mode 100644 index 000000000000..0e42cb4e17ac --- /dev/null +++ b/.azure-pipelines/template-commonlib.yml @@ -0,0 +1,34 @@ +jobs: +- job: Build + timeoutInMinutes: 120 + pool: sonicbld + steps: + - checkout: self + clean: true + submodules: recursive + - script: | + set -ex + case $(Build.SourceBranchName) in + 202012 | 202106) + bldenv=buster + ;; + *) + bldenv=bullseye + ;; + esac + BLDENV=$bldenv make -f Makefile.work configure PLATFORM=vs ENABLE_DOCKER_BASE_PULL=y + echo "##vso[task.setvariable variable=bldenv;]$bldenv" + displayName: Make configure + - script: | + set -ex + LIBNL3_VERSION_BASE=$(grep "LIBNL3_VERSION_BASE =" rules/libnl3.mk | awk '{print$3}') + LIBNL3_VERSION=$(grep "LIBNL3_VERSION =" rules/libnl3.mk | awk '{print$3}' | sed -e "s/(//" -e "s/)//" -e "s/\\$//" -e "s/LIBNL3_VERSION_BASE/$LIBNL3_VERSION_BASE/") + BLDENV=$(bldenv) make -f Makefile.work target/debs/$(bldenv)/libnl-3-200_${LIBNL3_VERSION}_amd64.deb ENABLE_DOCKER_BASE_PULL=y + + LIBYANG_VERSION_BASE=$(grep "LIBYANG_VERSION_BASE =" rules/libyang.mk | awk '{print$3}') + LIBYANG_VERSION=$(grep "LIBYANG_VERSION =" rules/libyang.mk | awk '{print$3}' | sed -e "s/\\$//" -e "s/(//" -e "s/)//" -e "s/LIBYANG_VERSION_BASE/$LIBYANG_VERSION_BASE/") + BLDENV=$(bldenv) make -f Makefile.work target/debs/$(bldenv)/libyang_${LIBYANG_VERSION}_amd64.deb + find target -name *.deb | xargs -i cp {} $(Build.ArtifactStagingDirectory) + displayName: Make common lib packages + - publish: $(Build.ArtifactStagingDirectory) + artifact: common-lib diff --git a/.azure-pipelines/template-variables.yml b/.azure-pipelines/template-variables.yml new file mode 100644 index 000000000000..f28768e39efe --- /dev/null +++ b/.azure-pipelines/template-variables.yml @@ -0,0 +1,2 @@ +variables: + DEFAULT_CONTAINER_REGISTRY: 'publicmirror.azurecr.io' diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 8790ea4efd61..6482f6837d16 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -10,7 +10,7 @@ # a pull request. * @lguohan -/device/ @jleveque +/device/ @sujinmkang @prgeor @vdahiya12 # build /rules/ @qiluo-msft @xumia @lguohan @@ -33,3 +33,6 @@ # src /src/initramfs-tools/ @qiluo-msft + +# yang +/src/sonic-yang-models/ @praveen-li @dgsudharsan @rathnasabapathyv @venkatmahalingam @qiluo-msft diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index c93809fc67c5..c02d193fbeb4 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -30,6 +30,7 @@ - [ ] 202006 - [ ] 202012 - [ ] 202106 +- [ ] 202111 #### Description for the changelog +#### Link to config_db schema for YANG module changes + #### A picture of a cute animal (not mandatory but encouraged) diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index f8ae8e7199a2..5f8c0279b7e1 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -13,6 +13,8 @@ on: - reopened branches: - '202012' + - '202[1-9][0-9][0-9]' + - '20[3-9][0-9][0-9][0-9]' paths: - 'files/build/versions/**' diff --git a/.gitignore b/.gitignore index 58d18cf69435..49861324aa1d 100644 --- a/.gitignore +++ b/.gitignore @@ -83,6 +83,13 @@ dockers/**/buildinfo platform/**/buildinfo sonic-slave*/**/buildinfo +# pytest coverage files +.coverage +coverage.xml +test-results.xml +htmlcov/ + # Dev tools .vscode/ .idea/ + diff --git a/.gitmodules b/.gitmodules index 357498ff1c54..b2d76bd66b20 100644 --- a/.gitmodules +++ b/.gitmodules @@ -62,6 +62,9 @@ [submodule "src/redis-dump-load"] path = src/redis-dump-load url = https://github.com/p/redis-dump-load.git +[submodule "src/scapy"] + path = src/scapy + url = https://github.com/secdev/scapy.git [submodule "platform/mellanox/mlnx-sai/SAI-Implementation"] path = platform/mellanox/mlnx-sai/SAI-Implementation url = https://github.com/Mellanox/SAI-Implementation @@ -94,3 +97,12 @@ [submodule "platform/broadcom/sonic-platform-modules-nokia"] path = platform/broadcom/sonic-platform-modules-nokia url = https://github.com/nokia/sonic-platform.git +[submodule "src/linkmgrd"] + path = src/linkmgrd + url = https://github.com/Azure/sonic-linkmgrd.git +[submodule "src/sonic-p4rt/sonic-pins"] + path = src/sonic-p4rt/sonic-pins + url = https://github.com/Azure/sonic-pins.git +[submodule "src/thrift_0_14_1/thrift"] + path = src/thrift_0_14_1/thrift + url = https://github.com/apache/thrift.git diff --git a/Makefile b/Makefile index 3b8792bfb445..ace13582cbef 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ NOJESSIE ?= 1 NOSTRETCH ?= 0 NOBUSTER ?= 0 -NOBULLSEYE ?= 1 +NOBULLSEYE ?= 0 ifeq ($(NOJESSIE),0) BUILD_JESSIE=1 @@ -35,7 +35,7 @@ ifeq ($(NOSTRETCH), 0) EXTRA_DOCKER_TARGETS=$(notdir $@) BLDENV=stretch make -f Makefile.work stretch endif ifeq ($(NOBUSTER), 0) - BLDENV=buster make -f Makefile.work $@ + EXTRA_DOCKER_TARGETS=$(notdir $@) BLDENV=buster make -f Makefile.work buster endif ifeq ($(NOBULLSEYE), 0) BLDENV=bullseye make -f Makefile.work $@ diff --git a/Makefile.cache b/Makefile.cache index 4037222ffc93..2a47c9427eb3 100644 --- a/Makefile.cache +++ b/Makefile.cache @@ -68,13 +68,16 @@ # Run the 'touch cache.skip.common' command in the base directory to exclude the common files from caching SONIC_COMMON_FILES_LIST := $(if $(wildcard cache.skip.common),, .platform slave.mk rules/functions Makefile.cache) SONIC_COMMON_FLAGS_LIST := $(CONFIGURED_PLATFORM) \ + $(CONFIGURED_ARCH) \ + $(BLDENV) \ $(SONIC_DEBUGGING_ON) \ $(SONIC_PROFILING_ON) $(SONIC_ENABLE_SYNCD_RPC) SONIC_COMMON_DPKG_LIST := debian/control debian/changelog debian/rules \ debian/compat debian/install debian/copyright SONIC_COMMON_BASE_FILES_LIST := sonic-slave-jessie/Dockerfile.j2 sonic-slave-jessie/Dockerfile.user.j2 \ sonic-slave-stretch/Dockerfile.j2 sonic-slave-stretch/Dockerfile.user.j2 \ - sonic-slave-buster/Dockerfile.j2 sonic-slave-buster/Dockerfile.user.j2 + sonic-slave-buster/Dockerfile.j2 sonic-slave-buster/Dockerfile.user.j2 \ + sonic-slave-bullseye/Dockerfile.j2 sonic-slave-bullseye/Dockerfile.user.j2 @@ -182,7 +185,10 @@ define GET_MOD_DEP_SHA $(eval $(1)_DEP_FILES_MISSING := $(filter-out $(wildcard $($(1)_DEP_MOD_SHA_FILES)),$($(1)_DEP_MOD_SHA_FILES)) ) $(if $($(1)_DEP_FILES_MISSING), $(warning "[ DPKG ] Dependecy file(s) are not found for $(1) : $($(1)_DEP_FILES_MISSING))) - $(eval $(1)_DEP_MOD_SHA := $(shell git hash-object $($(1)_DEP_MOD_SHA_FILES) \ + # Include package dependencies hash values into package hash calculation + $(eval $(1)_DEP_PKGS_SHA := $(foreach dfile,$(1)_MOD_DEP_PKGS,$(dfile)_DEP_MOD_SHA $(dfile)_MOD_HASH)) + + $(eval $(1)_DEP_MOD_SHA := $(shell bash -c "git hash-object $($(1)_DEP_MOD_SHA_FILES) && echo $($(1)_DEP_PKGS_SHA)" \ | sha1sum | awk '{print substr($$1,0,23);}')) endef diff --git a/Makefile.work b/Makefile.work index 7716baf60b67..8042de7d198b 100644 --- a/Makefile.work +++ b/Makefile.work @@ -10,6 +10,7 @@ # * ENABLE_ZTP: Enables zero touch provisioning. # * SHUTDOWN_BGP_ON_START: Sets admin-down state for all bgp peerings after restart. # * INCLUDE_KUBERNETES: Allows including Kubernetes +# * INCLUDE_MUX: Include MUX feature/services for TOR switch. # * ENABLE_PFCWD_ON_START: Enable PFC Watchdog (PFCWD) on server-facing ports # * by default for TOR switch. # * ENABLE_SYNCD_RPC: Enables rpc-based syncd builds. @@ -39,6 +40,9 @@ # * SONIC_DPKG_CACHE_SOURCE: Debian package cache location when cache enabled for debian packages # * BUILD_LOG_TIMESTAMP: Set timestamp in the build log (simple/none) # * DOCKER_EXTRA_OPTS: Extra command line arguments for dockerd running in slave container. +# * ENABLE_AUTO_TECH_SUPPORT: Enable the configuration for event-driven techsupport & coredump mgmt feature +# * Default: y +# * Values: y,n # ############################################################################### @@ -111,6 +115,10 @@ rules/config.user: include rules/config -include rules/config.user +ifneq ($(DEFAULT_CONTAINER_REGISTRY),) +override DEFAULT_CONTAINER_REGISTRY := $(DEFAULT_CONTAINER_REGISTRY)/ +endif + ifeq ($(ENABLE_DOCKER_BASE_PULL),) override ENABLE_DOCKER_BASE_PULL = n endif @@ -135,9 +143,9 @@ $(shell SONIC_VERSION_CONTROL_COMPONENTS=$(SONIC_VERSION_CONTROL_COMPONENTS) \ scripts/generate_buildinfo_config.sh) # Generate the slave Dockerfile, and prepare build info for it -$(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) MULTIARCH_QEMU_ENVIRON=$(MULTIARCH_QEMU_ENVIRON) DOCKER_EXTRA_OPTS=$(DOCKER_EXTRA_OPTS) j2 $(SLAVE_DIR)/Dockerfile.j2 > $(SLAVE_DIR)/Dockerfile) +$(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) MULTIARCH_QEMU_ENVIRON=$(MULTIARCH_QEMU_ENVIRON) DOCKER_EXTRA_OPTS=$(DOCKER_EXTRA_OPTS) DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) j2 $(SLAVE_DIR)/Dockerfile.j2 > $(SLAVE_DIR)/Dockerfile) $(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) MULTIARCH_QEMU_ENVIRON=$(MULTIARCH_QEMU_ENVIRON) j2 $(SLAVE_DIR)/Dockerfile.user.j2 > $(SLAVE_DIR)/Dockerfile.user) -$(shell BUILD_SLAVE=y scripts/prepare_docker_buildinfo.sh $(SLAVE_BASE_IMAGE) $(SLAVE_DIR)/Dockerfile $(CONFIGURED_ARCH) "" $(BLDENV)) +$(shell BUILD_SLAVE=y DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) scripts/prepare_docker_buildinfo.sh $(SLAVE_BASE_IMAGE) $(SLAVE_DIR)/Dockerfile $(CONFIGURED_ARCH) "" $(BLDENV)) # Add the versions in the tag, if the version change, need to rebuild the slave SLAVE_BASE_TAG = $(shell cat $(SLAVE_DIR)/Dockerfile $(SLAVE_DIR)/buildinfo/versions/versions-* src/sonic-build-hooks/hooks/* | sha1sum | awk '{print substr($$1,0,11);}') @@ -181,8 +189,10 @@ ifneq ($(SONIC_DPKG_CACHE_SOURCE),) endif ifeq ($(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD), y) +ifneq ($(MULTIARCH_QEMU_ENVIRON), y) DOCKER_RUN += -v /var/run/docker.sock:/var/run/docker.sock endif +endif ifeq ($(MULTIARCH_QEMU_ENVIRON), y) ifeq ($(DOCKER_DATA_ROOT_FOR_MULTIARCH),) @@ -193,6 +203,11 @@ endif SONIC_NATIVE_DOCKERD_FOR_MUTLIARCH := dockerd --experimental=true --storage-driver=vfs \ --data-root=$(DOCKER_DATA_ROOT_FOR_MULTIARCH) --exec-root=/var/run/march/docker/ \ -H unix:///var/run/march/docker.sock -p /var/run/march/docker.pid + +ifneq ($(DOCKER_CONFIG_FILE_FOR_MULTIARCH),) + SONIC_NATIVE_DOCKERD_FOR_MUTLIARCH += --config-file=$(DOCKER_CONFIG_FILE_FOR_MULTIARCH) +endif + DOCKER_RUN += -v /var/run/march/docker.sock:/var/run/docker.sock DOCKER_RUN += -v /var/run/march/docker.pid:/var/run/docker.pid DOCKER_RUN += -v /var/run/march/docker:/var/run/docker @@ -202,7 +217,7 @@ endif #Override Native config to prevent docker service SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD=y - DOCKER_MULTIARCH_CHECK := docker inspect --type image multiarch/qemu-user-static:register &> /dev/null || (echo "multiarch docker not found ..."; docker run --rm --privileged multiarch/qemu-user-static:register --reset --credential yes) + DOCKER_MULTIARCH_CHECK := docker run --rm --privileged multiarch/qemu-user-static --reset -p yes --credential yes DOCKER_SERVICE_SAFE_KILLER := (MARCH_PID=`ps -eo pid,cmd | grep "[0-9] dockerd.*march" | awk '{print $$1}'`; echo "Killing march docker $$MARCH_PID"; [ -z "$$MARCH_PID" ] || sudo kill -9 "$$MARCH_PID";) DOCKER_SERVICE_MULTIARCH_CHECK := ($(DOCKER_SERVICE_SAFE_KILLER); sudo rm -fr /var/run/march/; (echo "Starting docker march service..."; sudo $(SONIC_NATIVE_DOCKERD_FOR_MUTLIARCH) &) &>/dev/null ; sleep 2; sudo $(SONIC_USERFACL_DOCKERD_FOR_MUTLIARCH);) @@ -259,6 +274,7 @@ SONIC_BUILD_INSTRUCTION := make \ SONIC_ENABLE_PFCWD_ON_START=$(ENABLE_PFCWD_ON_START) \ SONIC_ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \ SONIC_INSTALL_DEBUG_TOOLS=$(INSTALL_DEBUG_TOOLS) \ + SONIC_SAITHRIFT_V2=$(SAITHRIFT_V2) \ MDEBUG=$(MDEBUG) \ PASSWORD=$(PASSWORD) \ USERNAME=$(USERNAME) \ @@ -274,13 +290,17 @@ SONIC_BUILD_INSTRUCTION := make \ SONIC_INCLUDE_SYSTEM_TELEMETRY=$(INCLUDE_SYSTEM_TELEMETRY) \ INCLUDE_DHCP_RELAY=$(INCLUDE_DHCP_RELAY) \ SONIC_INCLUDE_RESTAPI=$(INCLUDE_RESTAPI) \ + SONIC_INCLUDE_MUX=$(INCLUDE_MUX) \ TELEMETRY_WRITABLE=$(TELEMETRY_WRITABLE) \ EXTRA_DOCKER_TARGETS=$(EXTRA_DOCKER_TARGETS) \ BUILD_LOG_TIMESTAMP=$(BUILD_LOG_TIMESTAMP) \ SONIC_ENABLE_IMAGE_SIGNATURE=$(ENABLE_IMAGE_SIGNATURE) \ + SONIC_DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) \ ENABLE_HOST_SERVICE_ON_START=$(ENABLE_HOST_SERVICE_ON_START) \ SLAVE_DIR=$(SLAVE_DIR) \ + ENABLE_AUTO_TECH_SUPPORT=$(ENABLE_AUTO_TECH_SUPPORT) \ BUILD_MULTIASIC_KVM=$(BUILD_MULTIASIC_KVM) \ + ENABLE_ASAN=$(ENABLE_ASAN) \ $(SONIC_OVERRIDE_BUILD_VARS) .PHONY: sonic-slave-build sonic-slave-bash init reset @@ -325,6 +345,9 @@ sonic-build-hooks: @cp src/sonic-build-hooks/buildinfo/sonic-build-hooks* $(SLAVE_DIR)/buildinfo sonic-slave-base-build : sonic-build-hooks +ifeq ($(MULTIARCH_QEMU_ENVIRON), y) + @$(DOCKER_MULTIARCH_CHECK) +endif @$(OVERLAY_MODULE_CHECK) @echo Checking sonic-slave-base image: $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) @docker inspect --type image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) &> /dev/null || \ diff --git a/ThirdPartyLicenses.txt b/ThirdPartyLicenses.txt index 376506337e79..8941c1be7da9 100644 --- a/ThirdPartyLicenses.txt +++ b/ThirdPartyLicenses.txt @@ -1170,3 +1170,33 @@ Microsoft is offering you a license to use the following components, to the exte * See the License for the specific language governing permissions and * limitations under the License. */ + + 5. src/tacacs/bash/bash_tacplus based on https://github.com/daveolson53/tacplus-auth project using GNU GENERAL PUBLIC LICENSE Version 2 + +/* Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ + * Upstream-Name: tacplus-auth + * Source: https://github.com/daveolson53/tacplus-auth + * + * Files: * + * Copyright: 2016 Cumulus Networks, Inc. All rights reserved., + * 2010 Pawel Krawczyk and Jeroen Nijhof . + * License: GPL-2+ + * + * License: GPL-2+ + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * . + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * . + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * . + * On Debian systems, the full copy of the GPL-2 license can be found in + * /usr/share/common-licenses/GPL-2 + */ \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 53cee38e797a..27836a49b1ab 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -30,26 +30,51 @@ resources: type: github name: Azure/sonic-mgmt endpoint: build + - repository: buildimage + type: github + name: Azure/sonic-buildimage + endpoint: build + ref: master + +variables: +- template: .azure-pipelines/azure-pipelines-repd-build-variables.yml +- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: + - template: .azure-pipelines/template-variables.yml +- ${{ else }}: + - template: .azure-pipelines/template-variables.yml@buildimage +- name: CACHE_MODE + value: rcache stages: -- stage: Build +- stage: BuildVS pool: sonicbld - variables: - CACHE_MODE: rcache - ${{ if eq(variables['Build.SourceBranchName'], '202012') }}: - VERSION_CONTROL_OPTIONS: 'SONIC_VERSION_CONTROL_COMPONENTS=deb,py2,py3,web,git,docker' jobs: - template: .azure-pipelines/azure-pipelines-build.yml parameters: buildOptions: 'USERNAME=admin SONIC_BUILD_JOBS=$(nproc) ${{ variables.VERSION_CONTROL_OPTIONS }}' jobGroups: - name: vs + +- stage: Build + pool: sonicbld + dependsOn: [] + jobs: + - template: .azure-pipelines/azure-pipelines-build.yml + parameters: + buildOptions: 'USERNAME=admin SONIC_BUILD_JOBS=$(nproc) ${{ variables.VERSION_CONTROL_OPTIONS }}' + jobGroups: - name: broadcom variables: swi_image: yes - name: mellanox + - name: marvell-armhf + pool: sonicbld-armhf + timeoutInMinutes: 1200 + variables: + PLATFORM_ARCH: armhf - stage: Test + dependsOn: BuildVS variables: - name: inventory value: veos_vtb @@ -104,10 +129,10 @@ stages: testResultsFiles: '**/tr.xml' testRunTitle: vstest - - job: + - job: t0_part1 pool: sonictest - displayName: "kvmtest-t0" - timeoutInMinutes: 300 + displayName: "kvmtest-t0-part1" + timeoutInMinutes: 360 steps: - template: .azure-pipelines/run-test-template.yml @@ -116,6 +141,43 @@ stages: tbname: vms-kvm-t0 ptf_name: ptf_vms6-1 tbtype: t0 + section: part-1 + + - job: t0_part2 + pool: sonictest + displayName: "kvmtest-t0-part2" + timeoutInMinutes: 360 + + steps: + - template: .azure-pipelines/run-test-template.yml + parameters: + dut: vlab-01 + tbname: vms-kvm-t0 + ptf_name: ptf_vms6-1 + tbtype: t0 + section: part-2 + + - job: + pool: sonictest + displayName: "kvmtest-t0" + timeoutInMinutes: 360 + dependsOn: + - t0_part1 + - t0_part2 + condition: always() + variables: + resultOfPart1: $[ dependencies.t0_part1.result ] + resultOfPart2: $[ dependencies.t0_part2.result ] + + steps: + - script: | + if [ $(resultOfPart1) == "Succeeded" ] && [ $(resultOfPart2) == "Succeeded" ]; then + echo "Both job kvmtest-t0-part1 and kvmtest-t0-part2 are passed." + exit 0 + else + echo "Either job kvmtest-t0-part1 or job kvmtest-t0-part2 failed! Please check the detailed information." + exit 1 + fi - job: pool: sonictest-t1-lag diff --git a/build_debian.sh b/build_debian.sh index 077388d941ff..c509b7097151 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -31,8 +31,8 @@ set -x -e CONFIGURED_ARCH=$([ -f .arch ] && cat .arch || echo amd64) ## docker engine version (with platform) -DOCKER_VERSION=5:18.09.8~3-0~debian-$IMAGE_DISTRO -LINUX_KERNEL_VERSION=4.19.0-12-2 +DOCKER_VERSION=5:20.10.7~3-0~debian-$IMAGE_DISTRO +LINUX_KERNEL_VERSION=5.10.0-8-2 ## Working directory to prepare the file system FILESYSTEM_ROOT=./fsroot @@ -67,6 +67,9 @@ mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR/x86_64-grub touch $FILESYSTEM_ROOT/$PLATFORM_DIR/firsttime +## ensure proc is mounted +sudo mount proc /proc -t proc || true + ## make / as a mountpoint in chroot env, needed by dockerd pushd $FILESYSTEM_ROOT sudo mount --bind . . @@ -190,7 +193,7 @@ if [ -f platform/$CONFIGURED_PLATFORM/modules ]; then fi ## Add mtd and uboot firmware tools package -sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install u-boot-tools mtd-utils device-tree-compiler +sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install u-boot-tools libubootenv-tool mtd-utils device-tree-compiler ## Install docker echo '[INFO] Install docker' @@ -269,6 +272,7 @@ fi ## Note: parted is needed for partprobe in install.sh ## Note: ca-certificates is needed for easy_install ## Note: don't install python-apt by pip, older than Debian repo one +## Note: fdisk and gpg are needed by fwutil sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \ file \ ifmetric \ @@ -281,8 +285,7 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in dbus \ ntpstat \ openssh-server \ - python \ - python-apt \ + python3-apt \ traceroute \ iputils-ping \ net-tools \ @@ -314,13 +317,27 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in ndisc6 \ makedumpfile \ conntrack \ - python-pip \ python3 \ python3-distutils \ python3-pip \ + python-is-python3 \ cron \ + libprotobuf23 \ + libgrpc++1 \ + libgrpc10 \ haveged \ - jq + fdisk \ + gpg \ + jq \ + auditd + +# Have systemd create the auditd log directory +sudo mkdir -p ${FILESYSTEM_ROOT}/etc/systemd/system/auditd.service.d +sudo tee ${FILESYSTEM_ROOT}/etc/systemd/system/auditd.service.d/log-directory.conf >/dev/null < $platforms_asic + + for d in `find -L ./device -maxdepth 2 -mindepth 2 -type d`; do + if [ -f $d/platform_asic ]; then + if [ "$TARGET_MACHINE" = "generic" ] || grep -Fxq "$TARGET_MACHINE" $d/platform_asic; then + echo "${d##*/}" >> "$platforms_asic"; + fi; + fi; + done +} + if [ "$IMAGE_TYPE" = "onie" ]; then echo "Build ONIE installer" mkdir -p `dirname $OUTPUT_ONIE_IMAGE` sudo rm -f $OUTPUT_ONIE_IMAGE + generate_device_list "./installer/$TARGET_PLATFORM/platforms_asic" + generate_onie_installer_image ## Build a raw partition dump image using the ONIE installer that can be @@ -100,10 +121,13 @@ if [ "$IMAGE_TYPE" = "onie" ]; then elif [ "$IMAGE_TYPE" = "raw" ]; then echo "Build RAW image" + tmp_output_onie_image=${OUTPUT_ONIE_IMAGE}.tmp mkdir -p `dirname $OUTPUT_RAW_IMAGE` sudo rm -f $OUTPUT_RAW_IMAGE - generate_onie_installer_image + generate_device_list "./installer/$TARGET_PLATFORM/platforms_asic" + + generate_onie_installer_image "$tmp_output_onie_image" echo "Creating SONiC raw partition : $OUTPUT_RAW_IMAGE of size $RAW_IMAGE_DISK_SIZE MB" fallocate -l "$RAW_IMAGE_DISK_SIZE"M $OUTPUT_RAW_IMAGE @@ -114,8 +138,9 @@ elif [ "$IMAGE_TYPE" = "raw" ]; then ## Generate a partition dump that can be used to 'dd' in-lieu of using the onie-nos-installer ## Run the installer ## The 'build' install mode of the installer is used to generate this dump. - sudo chmod a+x $OUTPUT_ONIE_IMAGE - sudo ./$OUTPUT_ONIE_IMAGE + sudo chmod a+x $tmp_output_onie_image + sudo ./$tmp_output_onie_image + rm $tmp_output_onie_image [ -r $OUTPUT_RAW_IMAGE ] || { echo "Error : $OUTPUT_RAW_IMAGE not generated!" @@ -134,6 +159,8 @@ elif [ "$IMAGE_TYPE" = "raw" ]; then elif [ "$IMAGE_TYPE" = "kvm" ]; then + generate_device_list "./installer/$TARGET_PLATFORM/platforms_asic" + generate_onie_installer_image # Generate single asic KVM image generate_kvm_image @@ -170,6 +197,9 @@ elif [ "$IMAGE_TYPE" = "aboot" ]; then zip -g $ABOOT_BOOT_IMAGE version rm version + generate_device_list ".platforms_asic" + zip -g $OUTPUT_ABOOT_IMAGE .platforms_asic + zip -g $OUTPUT_ABOOT_IMAGE $ABOOT_BOOT_IMAGE rm $ABOOT_BOOT_IMAGE if [ "$SONIC_ENABLE_IMAGE_SIGNATURE" = "y" ]; then diff --git a/check_install.py b/check_install.py index ed0d8018afe7..ecd3a8ee9a3b 100755 --- a/check_install.py +++ b/check_install.py @@ -15,11 +15,6 @@ def main(): args = parser.parse_args() - KEY_UP = '\x1b[A' - KEY_DOWN = '\x1b[B' - KEY_RIGHT = '\x1b[C' - KEY_LEFT = '\x1b[D' - login_prompt = 'sonic login:' passwd_prompt = 'Password:' cmd_prompt = "{}@sonic:~\$ $".format(args.u) @@ -37,22 +32,19 @@ def main(): raise time.sleep(1) - # select ONIE embed + # select default SONiC Image p.expect(grub_selection) - p.sendline(KEY_DOWN) + p.sendline() - # install sonic image + # bootup sonic image while True: - i = p.expect([login_prompt, passwd_prompt, grub_selection, cmd_prompt]) + i = p.expect([login_prompt, passwd_prompt, cmd_prompt]) if i == 0: # send user name p.sendline(args.u) elif i == 1: # send password p.sendline(args.P) - elif i == 2: - # select onie install - p.sendline() else: break diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/Accton-AS4630-54PE/hx5-as4630-48x1G+4x25G+2x100G.bcm b/device/accton/x86_64-accton_as4630_54pe-r0/Accton-AS4630-54PE/hx5-as4630-48x1G+4x25G+2x100G.bcm index 331f6d002647..a5e7903abf24 100755 --- a/device/accton/x86_64-accton_as4630_54pe-r0/Accton-AS4630-54PE/hx5-as4630-48x1G+4x25G+2x100G.bcm +++ b/device/accton/x86_64-accton_as4630_54pe-r0/Accton-AS4630-54PE/hx5-as4630-48x1G+4x25G+2x100G.bcm @@ -1,4 +1,4 @@ -stable_size=71303168 +stable_size=76303168 #polarity/lanemap is using TH2 style. core_clock_frequency=893 diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/installer.conf b/device/accton/x86_64-accton_as4630_54pe-r0/installer.conf index 925a32fc0c3a..735fa7992dbc 100755 --- a/device/accton/x86_64-accton_as4630_54pe-r0/installer.conf +++ b/device/accton/x86_64-accton_as4630_54pe-r0/installer.conf @@ -1,3 +1,4 @@ CONSOLE_PORT=0x3f8 CONSOLE_DEV=0 CONSOLE_SPEED=115200 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="intel_iommu=off modprobe.blacklist=i2c-ismt,i2c_ismt,i2c-i801,i2c_i801" diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/pddf/pd-plugin.json b/device/accton/x86_64-accton_as4630_54pe-r0/pddf/pd-plugin.json new file mode 100644 index 000000000000..0abf66aab7a5 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/pddf/pd-plugin.json @@ -0,0 +1,66 @@ +{ + "XCVR": + { + "xcvr_present": + { + "i2c": + { + "valmap-SFP28": {"1":true, "0":false }, + "valmap-QSFP28": {"1":true, "0":false} + } + } + }, + + "PSU": + { + "psu_present": + { + "i2c": + { + "valmap": { "1":true, "0":false } + } + }, + + "psu_power_good": + { + "i2c": + { + "valmap": { "1": true, "0":false } + } + }, + + "psu_fan_dir": + { + "i2c": + { + "valmap": { "F2B":"EXHAUST", "B2F":"INTAKE" } + } + }, + + "PSU_FAN_MAX_SPEED":"18000" + }, + + "FAN": + { + "direction": + { + "i2c": + { + "valmap": {"1":"EXHAUST", "0":"INTAKE"} + } + }, + + "present": + { + "i2c": + { + "valmap": {"1":true, "0":false} + } + }, + + "duty_cycle_to_pwm": "lambda dc: ((dc*100.0)/625)", + + "pwm_to_duty_cycle": "lambda pwm: ((pwm*625.0)/100)" + } + +} diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/pddf/pddf-device.json b/device/accton/x86_64-accton_as4630_54pe-r0/pddf/pddf-device.json new file mode 100644 index 000000000000..34013b2a84ad --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/pddf/pddf-device.json @@ -0,0 +1,638 @@ +{ + "PLATFORM": + { + "num_psus":2, + "num_fantrays":3, + "num_fans_pertray":1, + "num_ports":54, + "num_temps": 3, + "pddf_dev_types": + { + "description":"AS4630 - Below is the list of supported PDDF device types (chip names) for various components. If any component uses some other driver, we will create the client using 'echo > /new_device' method", + "CPLD": + [ + "i2c_cpld" + ], + "PSU": + [ + "psu_eeprom", + "psu_pmbus" + ], + "FAN": + [ + "fan_ctrl", + "fan_eeprom", + "fan_cpld" + ], + "PORT_MODULE": + [ + "pddf_xcvr" + ] + + }, + "std_kos": + [ + "i2c_dev", + "i2c_mux_pca954x", + "optoe" + ], + "description":"kernel modules are loaded while moving to pdf mode, but they should not be unloaded while moving to nonpddf mode.", + "std_perm_kos": + [ + "i2c-i801", + "i2c-ismt" + ], + + "pddf_kos": + [ + "pddf_client_module", + "pddf_cpld_module", + "pddf_cpld_driver", + "pddf_mux_module", + "pddf_xcvr_module", + "pddf_xcvr_driver_module", + "pddf_psu_driver_module", + "pddf_psu_module", + "pddf_fan_driver_module", + "pddf_fan_module", + "pddf_led_module" + ] + }, + + "SYSTEM": + { + "dev_info": {"device_type":"CPU", "device_name":"ROOT_COMPLEX", "device_parent":null}, + "i2c": + { + "CONTROLLERS": + [ + { "dev_name":"i2c-1", "dev":"SMBUS1" } + ] + } + }, + + "SMBUS1": + { + "dev_info": {"device_type": "SMBUS", "device_name": "SMBUS1", "device_parent": "SYSTEM"}, + "i2c": + { + "topo_info": {"dev_addr": "0x1"}, + "DEVICES": + [ + {"dev": "EEPROM1"}, + {"dev": "MUX1"} + ] + } + }, + + + "EEPROM1": + { + "dev_info": {"device_type": "EEPROM", "device_name": "EEPROM1", "device_parent": "SMBUS1"}, + "i2c": + { + "topo_info": {"parent_bus": "0x1", "dev_addr": "0x57", "dev_type": "24c02"}, + "dev_attr": {"access_mode": "BLOCK"}, + "attr_list": [ + {"attr_name": "eeprom"} + ] + } + }, + + "MUX1": + { + "dev_info": { "device_type":"MUX", "device_name":"MUX1", "device_parent":"SMBUS1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x1", "dev_addr":"0x77", "dev_type":"pca9548"}, + "dev_attr": { "virt_bus":"0x2", "idle_state":"-2"}, + "channel": + [ + { "chn":"0", "dev":"MUX2" }, + { "chn":"1", "dev":"MUX3" }, + { "chn":"1", "dev":"CPLD1" }, + { "chn":"1", "dev":"FAN-CTRL" } + ] + } + }, + + "MUX2": + { + "dev_info": { "device_type":"MUX", "device_name":"MUX2", "device_parent":"MUX1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2", "dev_addr":"0x71", "dev_type":"pca9548"}, + "dev_attr": { "virt_bus":"0xa", "idle_state":"-2"}, + "channel": + [ + { "chn":"0", "dev":"PSU1" }, + { "chn":"1", "dev":"PSU2" }, + { "chn":"4", "dev":"TEMP1" } + ] + } + }, + + "TEMP1" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_parent":"MUX2"}, + "dev_attr": { "display_name":"Temp_1"}, + "i2c": + { + "topo_info": { "parent_bus":"0xe", "dev_addr":"0x48", "dev_type":"lm77"}, + "attr_list": + [ + { "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp1_crit"}, + { "attr_name": "temp1_crit_hyst"}, + { "attr_name": "temp1_crit_alarm"}, + { "attr_name": "temp1_max_alarm"}, + { "attr_name": "temp1_min_alarm"}, + { "attr_name": "temp1_input"}, + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, + { "attr_name": "temp1_low_threshold", "drv_attr_name":"temp1_min"}, + { "attr_name": "temp1_max_hyst"}, + { "attr_name": "temp1_min_hyst"} + ] + } + }, + + "MUX3": + { + "dev_info": { "device_type":"MUX", "device_name":"MUX3", "device_parent":"MUX1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3", "dev_addr":"0x70", "dev_type":"pca9548"}, + "dev_attr": { "virt_bus":"0x12", "idle_state":"-2"}, + "channel": + [ + { "chn":"0", "dev":"PORT49" }, + { "chn":"1", "dev":"PORT50" }, + { "chn":"2", "dev":"PORT51" }, + { "chn":"3", "dev":"PORT52" }, + { "chn":"4", "dev":"PORT53" }, + { "chn":"5", "dev":"PORT54" }, + { "chn":"6", "dev":"TEMP2" }, + { "chn":"7", "dev":"TEMP3" } + ] + } + }, + + + "TEMP2" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_parent":"MUX3"}, + "dev_attr": { "display_name":"Temp_CPU"}, + + "i2c": + { + "topo_info": { "parent_bus":"0x18", "dev_addr":"0x4b", "dev_type":"lm75"}, + "attr_list": + [ + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, + { "attr_name": "temp1_max_hyst"}, + { "attr_name": "temp1_input"} + ] + } + }, + + + "TEMP3" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_parent":"MUX3"}, + "dev_attr": { "display_name":"Temp_Fan"}, + "i2c": + { + "topo_info": { "parent_bus":"0x19", "dev_addr":"0x4a", "dev_type":"lm75"}, + "attr_list": + [ + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, + { "attr_name": "temp1_max_hyst"}, + { "attr_name": "temp1_input"} + ] + } + }, + + + "CPLD1": + { + "dev_info": { "device_type":"CPLD", "device_name":"CPLD1", "device_parent":"MUX1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3", "dev_addr":"0x60", "dev_type":"i2c_cpld"} + } + }, + + + "FAN-CTRL": + { + "dev_info": { "device_type":"FAN", "device_name":"FAN-CTRL", "device_parent":"MUX1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3", "dev_addr":"0x66", "dev_type":"fan_cpld"}, + "dev_attr": { "num_fantrays":"3"}, + "attr_list": + [ + { "attr_name":"fan1_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x87", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan2_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x87", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan3_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x87", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan1_direction", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x87", "attr_mask":"0x10", "attr_cmpval":"0x10", "attr_len":"1"}, + { "attr_name":"fan2_direction", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x87", "attr_mask":"0x20", "attr_cmpval":"0x20", "attr_len":"1"}, + { "attr_name":"fan3_direction", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x87", "attr_mask":"0x40", "attr_cmpval":"0x40", "attr_len":"1"}, + { "attr_name":"fan1_input", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x88", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"114", "attr_is_divisor":0}, + { "attr_name":"fan2_input", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x89", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"114" , "attr_is_divisor":0}, + { "attr_name":"fan3_input", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x8a", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"114", "attr_is_divisor":0}, + { "attr_name":"fan1_pwm", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1a", "attr_mask":"0x1F", "attr_len":"1"}, + { "attr_name":"fan2_pwm", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1a", "attr_mask":"0x1F", "attr_len":"1"}, + { "attr_name":"fan3_pwm", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1b", "attr_mask":"0x1F", "attr_len":"1"} + ] + } + }, + + + "SYS_LED": + { + "dev_info": { "device_type":"LED", "device_name":"SYS_LED"}, + "dev_attr": { "index":"0"}, + "i2c" : { + "attr_list": + [ + {"attr_name":"STATUS_LED_COLOR_GREEN", "bits" : "7:5", "descr" : "", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"}, + {"attr_name":"STATUS_LED_COLOR_GREEN_BLINK", "bits" : "7:5", "descr" : "", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"}, + {"attr_name":"STATUS_LED_COLOR_AMBER", "bits" : "7:5", "descr" : "", "value" : "0x4", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"}, + {"attr_name":"STATUS_LED_COLOR_AMBER_BLINK", "bits" : "7:5", "descr" : "", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"}, + {"attr_name":"STATUS_LED_COLOR_OFF", "bits" : "7:5", "descr" : "", "value" : "0x7", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"} + ] + } + }, + + + "PSU1_LED": + { + "dev_info": { "device_type":"LED", "device_name":"PSU_LED"}, + "dev_attr": { "index":"0"}, + "i2c" : { + "attr_list": + [ + {"attr_name":"STATUS_LED_COLOR_GREEN", "bits" : "1:0", "descr" : "", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"}, + {"attr_name":"STATUS_LED_COLOR_AMBER", "bits" : "1:0", "descr" : "", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"}, + {"attr_name":"STATUS_LED_COLOR_OFF", "bits" : "1:0", "descr" : "", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x30"} + ] + } + }, + + "PSU2_LED": + { + "dev_info": { "device_type":"LED", "device_name":"PSU_LED"}, + "dev_attr": { "index":"1"}, + "i2c" : { + "attr_list": + [ + {"attr_name":"STATUS_LED_COLOR_GREEN", "bits" : "7:6", "descr" : "", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"}, + {"attr_name":"STATUS_LED_COLOR_AMBER", "bits" : "7:6", "descr" : "", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"}, + {"attr_name":"STATUS_LED_COLOR_OFF", "bits" : "7:6", "descr" : "", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"} + ] + } + }, + + "FAN_LED": + { + "dev_info": { "device_type":"LED", "device_name":"FAN_LED"}, + "dev_attr": { "index":"0"}, + "i2c" : { + "attr_list": + [ + {"attr_name":"STATUS_LED_COLOR_GREEN", "bits" : "3:2", "descr" : "", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"}, + {"attr_name":"STATUS_LED_COLOR_AMBER", "bits" : "3:2", "descr" : "", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"}, + {"attr_name":"STATUS_LED_COLOR_OFF", "bits" : "3:2", "descr" : "", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x31"} + ] + } + }, + + "PSU1": + { + "dev_info": { "device_type":"PSU", "device_name":"PSU1", "device_parent":"MUX2"}, + "dev_attr": { "dev_idx":"1", "num_psu_fans": "1"}, + "i2c": + { + "interface": + [ + { "itf":"pmbus", "dev":"PSU1-PMBUS" }, + { "itf":"eeprom", "dev":"PSU1-EEPROM" } + ] + + } + }, + + "PSU1-PMBUS": + { + "dev_info": { "device_type":"PSU-PMBUS", "device_name":"PSU1-PMBUS", "device_parent":"MUX2", "virt_parent":"PSU1"}, + "i2c": + { + "topo_info":{ "parent_bus":"0xa", "dev_addr":"0x58", "dev_type":"psu_pmbus"}, + "attr_list": + [ + { "attr_name":"psu_mfr_id", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, + { "attr_name":"psu_fan_dir", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"}, + { "attr_name":"psu_v_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_i_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_p_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_temp1_input", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} + ] + } + }, + + "PSU1-EEPROM": + { + "dev_info": { "device_type":"PSU-EEPROM", "device_name":"PSU1-EEPROM", "device_parent":"MUX2", "virt_parent":"PSU1"}, + "i2c": + { + "topo_info":{ "parent_bus":"0xa", "dev_addr":"0x50", "dev_type":"psu_eeprom"}, + "attr_list": + [ + { "attr_name":"psu_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x22", "attr_mask":"0x20", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"psu_model_name", "attr_devaddr":"0x50", "attr_devtype":"eeprom", "attr_offset":"0x20", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"12" }, + { "attr_name":"psu_power_good", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x22", "attr_mask":"0x40", "attr_cmpval":"0x40", "attr_len":"1"}, + { "attr_name":"psu_serial_num", "attr_devaddr":"0x50", "attr_devtype":"eeprom", "attr_offset":"0x35", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"19" } + ] + } + }, + + + "PSU2": + { + "dev_info": { "device_type":"PSU", "device_name":"PSU2", "device_parent":"MUX2" }, + "dev_attr": { "dev_idx":"2", "num_psu_fans":"1"}, + "i2c": + { + "interface": + [ + { "itf":"pmbus", "dev":"PSU2-PMBUS"}, + { "itf":"eeprom", "dev":"PSU2-EEPROM"} + ] + } + + }, + + "PSU2-PMBUS": + { + "dev_info": {"device_type":"PSU-PMBUS", "device_name":"PSU2-PMBUS", "device_parent":"MUX2", "virt_parent":"PSU2"}, + "i2c": + { + "topo_info": { "parent_bus":"0xb", "dev_addr":"0x59", "dev_type":"psu_pmbus"}, + "attr_list": + [ + { "attr_name":"psu_mfr_id", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, + { "attr_name":"psu_fan_dir", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"}, + { "attr_name":"psu_v_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_i_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_p_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_temp1_input", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} + ] + } + }, + + "PSU2-EEPROM": + { + "dev_info": {"device_type":"PSU-EEPROM", "device_name":"PSU2-EEPROM", "device_parent":"MUX2", "virt_parent":"PSU2"}, + "i2c": + { + "topo_info": { "parent_bus":"0xb", "dev_addr":"0x51", "dev_type":"psu_eeprom"}, + "attr_list": + [ + { "attr_name":"psu_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x22", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"psu_model_name", "attr_devaddr":"0x51", "attr_devtype":"eeprom", "attr_offset":"0x20", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"12" }, + { "attr_name":"psu_power_good", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x22", "attr_mask":"0x4", "attr_cmpval":"0x4", "attr_len":"1"}, + { "attr_name":"psu_serial_num", "attr_devaddr":"0x51", "attr_devtype":"eeprom", "attr_offset":"0x35", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"19" } + ] + } + }, + + "PORT49": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT49", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"49"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT49-EEPROM" }, + { "itf":"control", "dev":"PORT49-CTRL" } + ] + } + }, + "PORT49-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT49-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT49"}, + "i2c": + { + "topo_info": { "parent_bus":"0x12", "dev_addr":"0x50", "dev_type":"optoe2"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT49-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT49-CTRL", "device_parent":"MUX3", "virt_parent":"PORT49"}, + "i2c": + { + "topo_info": { "parent_bus":"0x12", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x05", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT50": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT50", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"50"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT50-EEPROM" }, + { "itf":"control", "dev":"PORT50-CTRL" } + ] + } + }, + "PORT50-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT50-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT50"}, + "i2c": + { + "topo_info": { "parent_bus":"0x13", "dev_addr":"0x50", "dev_type":"optoe2"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT50-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT50-CTRL", "device_parent":"MUX3", "virt_parent":"PORT50"}, + "i2c": + { + "topo_info": { "parent_bus":"0x13", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x05", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT51": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT51", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"51"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT51-EEPROM" }, + { "itf":"control", "dev":"PORT51-CTRL" } + ] + } + }, + "PORT51-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT51-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT51"}, + "i2c": + { + "topo_info": { "parent_bus":"0x14", "dev_addr":"0x50", "dev_type":"optoe2"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT51-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT51-CTRL", "device_parent":"MUX3", "virt_parent":"PORT51"}, + "i2c": + { + "topo_info": { "parent_bus":"0x14", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x06", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + "PORT52": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT52", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"52"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT52-EEPROM" }, + { "itf":"control", "dev":"PORT52-CTRL" } + ] + } + }, + "PORT52-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT52-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT52"}, + "i2c": + { + "topo_info": { "parent_bus":"0x15", "dev_addr":"0x50", "dev_type":"optoe2"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT52-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT52-CTRL", "device_parent":"MUX3", "virt_parent":"PORT52"}, + "i2c": + { + "topo_info": { "parent_bus":"0x15", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x06", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT53": + { + "dev_info": { "device_type":"QSFP28", "device_name":"PORT53", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"53"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT53-EEPROM" }, + { "itf":"control", "dev":"PORT53-CTRL" } + ] + } + }, + "PORT53-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT53-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT53"}, + "i2c": + { + "topo_info": { "parent_bus":"0x16", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT53-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT53-CTRL", "device_parent":"MUX3", "virt_parent":"PORT53"}, + "i2c": + { + "topo_info": { "parent_bus":"0x16", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x21", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT54": + { + "dev_info": { "device_type":"QSFP28", "device_name":"PORT54", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"54"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT54-EEPROM" }, + { "itf":"control", "dev":"PORT54-CTRL" } + ] + } + }, + "PORT54-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT54-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT54"}, + "i2c": + { + "topo_info": { "parent_bus":"0x17", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT54-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT54-CTRL", "device_parent":"MUX3", "virt_parent":"PORT54"}, + "i2c": + { + "topo_info": { "parent_bus":"0x17", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x21", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + } + +} diff --git a/files/image_config/apt/sources.list b/device/accton/x86_64-accton_as4630_54pe-r0/pddf_support similarity index 100% rename from files/image_config/apt/sources.list rename to device/accton/x86_64-accton_as4630_54pe-r0/pddf_support diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/platform_asic b/device/accton/x86_64-accton_as4630_54pe-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/pmon_daemon_control.json b/device/accton/x86_64-accton_as4630_54pe-r0/pmon_daemon_control.json index 584a14b9d942..a3b204e20d8d 100644 --- a/device/accton/x86_64-accton_as4630_54pe-r0/pmon_daemon_control.json +++ b/device/accton/x86_64-accton_as4630_54pe-r0/pmon_daemon_control.json @@ -1,5 +1,5 @@ { "skip_ledd": true, - "skip_thermalctld": true + "skip_pcied": true } diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/__init__.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/__init__.py new file mode 100644 index 000000000000..73a7720e8979 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/__init__.py @@ -0,0 +1,2 @@ +__all__ = [ "platform", "chassis", "sfp", "eeprom", "component", "psu", "thermal", "fan", "fan_drawer" ] +from . import platform diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/chassis.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/chassis.py new file mode 100644 index 000000000000..310d0433d8bc --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/chassis.py @@ -0,0 +1,255 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Chassis information which are available in the platform +# +############################################################################# + +import os +import sys + +try: + from sonic_platform_base.chassis_base import ChassisBase + from .helper import APIHelper + from .event import SfpEvent +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +NUM_FAN_TRAY = 3 +NUM_FAN = 2 +NUM_PSU = 2 +NUM_THERMAL = 3 +PORT_START = 49 +PORT_END = 54 +NUM_COMPONENT = 2 +HOST_REBOOT_CAUSE_PATH = "/host/reboot-cause/" +PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" +REBOOT_CAUSE_FILE = "reboot-cause.txt" +PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" +HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" +SYSLED_FNODE = "/sys/class/leds/diag/brightness" +SYSLED_MODES = { + "0" : "STATUS_LED_COLOR_OFF", + "1" : "STATUS_LED_COLOR_GREEN", + "2" : "STATUS_LED_COLOR_AMBER", + "5" : "STATUS_LED_COLOR_GREEN_BLINK" +} + + +class Chassis(ChassisBase): + """Platform-specific Chassis class""" + + def __init__(self): + ChassisBase.__init__(self) + self._api_helper = APIHelper() + self.is_host = self._api_helper.is_host() + + self.config_data = {} + + self.__initialize_fan() + self.__initialize_psu() + self.__initialize_thermals() + self.__initialize_components() + self.__initialize_sfp() + self.__initialize_eeprom() + + def __initialize_sfp(self): + from sonic_platform.sfp import Sfp + for index in range(0, PORT_END): + sfp = Sfp(index) + self._sfp_list.append(sfp) + self._sfpevent = SfpEvent(self._sfp_list) + self.sfp_module_initialized = True + + def __initialize_fan(self): + from sonic_platform.fan_drawer import FanDrawer + for fant_index in range(NUM_FAN_TRAY): + fandrawer = FanDrawer(fant_index) + self._fan_drawer_list.append(fandrawer) + self._fan_list.extend(fandrawer._fan_list) + + def __initialize_psu(self): + from sonic_platform.psu import Psu + for index in range(0, NUM_PSU): + psu = Psu(index) + self._psu_list.append(psu) + + def __initialize_thermals(self): + from sonic_platform.thermal import Thermal + for index in range(0, NUM_THERMAL): + thermal = Thermal(index) + self._thermal_list.append(thermal) + + def __initialize_eeprom(self): + from sonic_platform.eeprom import Tlv + self._eeprom = Tlv() + + def __initialize_components(self): + from sonic_platform.component import Component + for index in range(0, NUM_COMPONENT): + component = Component(index) + self._component_list.append(component) + + def __initialize_watchdog(self): + from sonic_platform.watchdog import Watchdog + self._watchdog = Watchdog() + + + def __is_host(self): + return os.system(HOST_CHK_CMD) == 0 + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + data = fd.read() + return data.strip() + except IOError: + pass + return None + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + + return self._eeprom.get_product_name() + + def get_presence(self): + """ + Retrieves the presence of the Chassis + Returns: + bool: True if Chassis is present, False if not + """ + return True + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return True + + def get_base_mac(self): + """ + Retrieves the base MAC address for the chassis + Returns: + A string containing the MAC address in the format + 'XX:XX:XX:XX:XX:XX' + """ + return self._eeprom.get_mac() + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return self._eeprom.get_pn() + + def get_serial(self): + """ + Retrieves the hardware serial number for the chassis + Returns: + A string containing the hardware serial number for this chassis. + """ + return self._eeprom.get_serial() + + def get_system_eeprom_info(self): + """ + Retrieves the full content of system EEPROM information for the chassis + Returns: + A dictionary where keys are the type code defined in + OCP ONIE TlvInfo EEPROM format and values are their corresponding + values. + """ + return self._eeprom.get_eeprom() + + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + + Returns: + A tuple (string, string) where the first element is a string + containing the cause of the previous reboot. This string must be + one of the predefined strings in this class. If the first string + is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used + to pass a description of the reboot cause. + """ + + reboot_cause_path = (HOST_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE) + sw_reboot_cause = self._api_helper.read_txt_file( + reboot_cause_path) or "Unknown" + + + return ('REBOOT_CAUSE_NON_HARDWARE', sw_reboot_cause) + + def get_change_event(self, timeout=0): + # SFP event + if not self.sfp_module_initialized: + self.__initialize_sfp() + + return self._sfpevent.get_sfp_event(timeout) + + def get_sfp(self, index): + """ + Retrieves sfp represented by (1-based) index + Args: + index: An integer, the index (1-based) of the sfp to retrieve. + The index should be the sequence of a physical port in a chassis, + starting from 1. + For example, 1 for Ethernet0, 2 for Ethernet4 and so on. + Returns: + An object dervied from SfpBase representing the specified sfp + """ + sfp = None + if not self.sfp_module_initialized: + self.__initialize_sfp() + + try: + # The index will start from 1 + sfp = self._sfp_list[index-1] + except IndexError: + sys.stderr.write("SFP index {} out of range (1-{})\n".format( + index, len(self._sfp_list))) + return sfp + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False + + + def initizalize_system_led(self): + return True + + def get_status_led(self): + val = self._api_helper.read_txt_file(SYSLED_FNODE) + return SYSLED_MODES[val] if val in SYSLED_MODES else "UNKNOWN" + + def set_status_led(self, color): + mode = None + for key, val in SYSLED_MODES.items(): + if val == color: + mode = key + break + if mode is None: + return False + else: + return self._api_helper.write_txt_file(SYSLED_FNODE, mode) + diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/component.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/component.py new file mode 100644 index 000000000000..53a01c1f1475 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/component.py @@ -0,0 +1,172 @@ +############################################################################# +# Edgecore +# +# Component contains an implementation of SONiC Platform Base API and +# provides the components firmware management function +# +############################################################################# + +import shlex +import subprocess + + +try: + from sonic_platform_base.component_base import ComponentBase + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CPLD_ADDR_MAPPING = { + "CPLD1": "3-0060" +} +SYSFS_PATH = "/sys/bus/i2c/devices/" +BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version" +COMPONENT_LIST= [ + ("CPLD1", "CPLD 1"), + ("BIOS", "Basic Input/Output System") + +] + +class Component(ComponentBase): + """Platform-specific Component class""" + + DEVICE_TYPE = "component" + + def __init__(self, component_index=0): + self._api_helper=APIHelper() + ComponentBase.__init__(self) + self.index = component_index + self.name = self.get_name() + + def __run_command(self, command): + # Run bash command and print output to stdout + try: + process = subprocess.Popen( + shlex.split(command), stdout=subprocess.PIPE) + while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + rc = process.poll() + if rc != 0: + return False + except Exception: + return False + return True + + def __get_bios_version(self): + # Retrieves the BIOS firmware version + try: + with open(BIOS_VERSION_PATH, 'r') as fd: + bios_version = fd.read() + return bios_version.strip() + except Exception as e: + return None + + def __get_cpld_version(self): + # Retrieves the CPLD firmware version + cpld_version = dict() + for cpld_name in CPLD_ADDR_MAPPING: + try: + cpld_path = "{}{}{}".format(SYSFS_PATH, CPLD_ADDR_MAPPING[cpld_name], '/version') + cpld_version_raw= self._api_helper.read_txt_file(cpld_path) + cpld_version[cpld_name] = "{}".format(int(cpld_version_raw,16)) + except Exception as e: + print('Get exception when read cpld') + cpld_version[cpld_name] = 'None' + + return cpld_version + + def get_name(self): + """ + Retrieves the name of the component + Returns: + A string containing the name of the component + """ + return COMPONENT_LIST[self.index][0] + + def get_description(self): + """ + Retrieves the description of the component + Returns: + A string containing the description of the component + """ + return COMPONENT_LIST[self.index][1] + + + def get_firmware_version(self): + """ + Retrieves the firmware version of module + Returns: + string: The firmware versions of the module + """ + fw_version = None + if self.name == "BIOS": + fw_version = self.__get_bios_version() + elif "CPLD" in self.name: + cpld_version = self.__get_cpld_version() + fw_version = cpld_version.get(self.name) + + return fw_version + + def install_firmware(self, image_path): + """ + Install firmware to module + Args: + image_path: A string, path to firmware image + Returns: + A boolean, True if install successfully, False if not + """ + raise NotImplementedError + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return 'N/A' + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return 'N/A' + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return True + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/eeprom.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/eeprom.py new file mode 100644 index 000000000000..64a484faf5cf --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/eeprom.py @@ -0,0 +1,134 @@ +try: + import os + import sys + import re + if sys.version_info[0] >= 3: + from io import StringIO + else: + from cStringIO import StringIO + + from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CACHE_ROOT = '/var/cache/sonic/decode-syseeprom' +CACHE_FILE = 'syseeprom_cache' +NULL = 'N/A' + +class Tlv(eeprom_tlvinfo.TlvInfoDecoder): + + EEPROM_DECODE_HEADLINES = 6 + + def __init__(self): + self._eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom" + super(Tlv, self).__init__(self._eeprom_path, 0, '', True) + self._eeprom = self._load_eeprom() + + def __parse_output(self, decode_output): + decode_output.replace('\0', '') + lines = decode_output.split('\n') + lines = lines[self.EEPROM_DECODE_HEADLINES:] + _eeprom_info_dict = dict() + + for line in lines: + try: + match = re.search( + '(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)([\S]+)', line) + if match is not None: + idx = match.group(1) + value = match.group(3).rstrip('\0') + + _eeprom_info_dict[idx] = value + except Exception: + pass + + return _eeprom_info_dict + + def _load_eeprom(self): + original_stdout = sys.stdout + sys.stdout = StringIO() + try: + self.read_eeprom_db() + except Exception: + decode_output = sys.stdout.getvalue() + sys.stdout = original_stdout + return self.__parse_output(decode_output) + + status = self.check_status() + if 'ok' not in status: + return False + + if not os.path.exists(CACHE_ROOT): + try: + os.makedirs(CACHE_ROOT) + except Exception: + pass + + # + # only the eeprom classes that inherit from eeprom_base + # support caching. Others will work normally + # + try: + self.set_cache_name(os.path.join(CACHE_ROOT, CACHE_FILE)) + except Exception: + pass + + e = self.read_eeprom() + if e is None: + return 0 + + try: + self.update_cache(e) + except Exception: + pass + + self.decode_eeprom(e) + decode_output = sys.stdout.getvalue() + sys.stdout = original_stdout + + (is_valid, valid_crc) = self.is_checksum_valid(e) + if not is_valid: + return False + + return self.__parse_output(decode_output) + + def _valid_tlv(self, eeprom_data): + tlvinfo_type_codes_list = [ + self._TLV_CODE_PRODUCT_NAME, + self._TLV_CODE_PART_NUMBER, + self._TLV_CODE_SERIAL_NUMBER, + self._TLV_CODE_MAC_BASE, + self._TLV_CODE_MANUF_DATE, + self._TLV_CODE_DEVICE_VERSION, + self._TLV_CODE_LABEL_REVISION, + self._TLV_CODE_PLATFORM_NAME, + self._TLV_CODE_ONIE_VERSION, + self._TLV_CODE_MAC_SIZE, + self._TLV_CODE_MANUF_NAME, + self._TLV_CODE_MANUF_COUNTRY, + self._TLV_CODE_VENDOR_NAME, + self._TLV_CODE_DIAG_VERSION, + self._TLV_CODE_SERVICE_TAG, + self._TLV_CODE_VENDOR_EXT, + self._TLV_CODE_CRC_32 + ] + + for code in tlvinfo_type_codes_list: + code_str = "0x{:X}".format(code) + eeprom_data[code_str] = eeprom_data.get(code_str, NULL) + return eeprom_data + + def get_eeprom(self): + return self._valid_tlv(self._eeprom) + + def get_pn(self): + return self._eeprom.get('0x22', NULL) + + def get_serial(self): + return self._eeprom.get('0x23', NULL) + + def get_mac(self): + return self._eeprom.get('0x24', NULL) + + def get_product_name(self): + return self._eeprom.get('0x21', NULL) diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/event.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/event.py new file mode 100644 index 000000000000..96f853402abb --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/event.py @@ -0,0 +1,63 @@ +try: + import time + from .helper import APIHelper + from sonic_py_common.logger import Logger +except ImportError as e: + raise ImportError(repr(e) + " - required module not found") + +POLL_INTERVAL_IN_SEC = 1 + +class SfpEvent: + ''' Listen to insert/remove sfp events ''' + + def __init__(self, sfp_list): + self._api_helper = APIHelper() + self._sfp_list = sfp_list + self._logger = Logger() + self._sfp_change_event_data = {'present': 0} + + def get_presence_bitmap(self): + bitmap = 0 + for sfp in self._sfp_list: + modpres = sfp.get_presence() + i=sfp.port_num-1 + if modpres: + bitmap = bitmap | (1 << i) + return bitmap + + def get_sfp_event(self, timeout=2000): + #now = time.time() + port_dict = {} + change_dict = {} + change_dict['sfp'] = port_dict + + if timeout < 1000: + cd_ms = 1000 + else: + cd_ms = timeout + + while cd_ms > 0: + bitmap = self.get_presence_bitmap() + changed_ports = self._sfp_change_event_data['present'] ^ bitmap + if changed_ports != 0: + break + time.sleep(POLL_INTERVAL_IN_SEC) + # timeout=0 means wait for event forever + if timeout != 0: + cd_ms = cd_ms - POLL_INTERVAL_IN_SEC * 1000 + + if changed_ports != 0: + for sfp in self._sfp_list: + i=sfp.port_num-1 + if (changed_ports & (1 << i)): + if (bitmap & (1 << i)) == 0: + port_dict[i+1] = '0' + else: + port_dict[i+1] = '1' + + + # Update the cache dict + self._sfp_change_event_data['present'] = bitmap + return True, change_dict + else: + return True, change_dict diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/fan.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/fan.py new file mode 100644 index 000000000000..eb9d526217bb --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/fan.py @@ -0,0 +1,284 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the fan status which are available in the platform +# +############################################################################# + + + +try: + from sonic_platform_base.fan_base import FanBase + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +PSU_FAN_MAX_RPM = 26688 +SPEED_TOLERANCE = 15 +CPLD_FAN_I2C_PATH = "/sys/bus/i2c/devices/3-0060/fan_" +I2C_PATH ="/sys/bus/i2c/devices/{}-00{}/" +PSU_HWMON_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "58" + }, + 1: { + "num": 11, + "addr": "59" + }, +} + +PSU_CPLD_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "50" + }, + 1: { + "num": 11, + "addr": "51" + }, +} + + +FAN_NAME_LIST = ["FAN-1F", "FAN-1R", "FAN-2F", "FAN-2R", + "FAN-3F", "FAN-3R"] + +class Fan(FanBase): + """Platform-specific Fan class""" + + def __init__(self, fan_tray_index, fan_index=0, is_psu_fan=False, psu_index=0): + self._api_helper=APIHelper() + self.fan_index = fan_index + self.fan_tray_index = fan_tray_index + self.is_psu_fan = is_psu_fan + + if self.is_psu_fan: + self.psu_index = psu_index + self.psu_i2c_num = PSU_HWMON_I2C_MAPPING[self.psu_index]['num'] + self.psu_i2c_addr = PSU_HWMON_I2C_MAPPING[self.psu_index]['addr'] + self.psu_hwmon_path = I2C_PATH.format( + self.psu_i2c_num, self.psu_i2c_addr) + + self.psu_i2c_num = PSU_CPLD_I2C_MAPPING[self.psu_index]['num'] + self.psu_i2c_addr = PSU_CPLD_I2C_MAPPING[self.psu_index]['addr'] + self.psu_cpld_path = I2C_PATH.format( + self.psu_i2c_num, self.psu_i2c_addr) + + FanBase.__init__(self) + + + def get_direction(self): + """ + Retrieves the direction of fan + Returns: + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + """ + if not self.is_psu_fan: + dir_str = "{}{}{}".format(CPLD_FAN_I2C_PATH, 'direction_', self.fan_tray_index+1) + val=self._api_helper.read_txt_file(dir_str) + if val is not None: + if int(val, 10)==0:#F2B + direction=self.FAN_DIRECTION_EXHAUST + else: + direction=self.FAN_DIRECTION_INTAKE + else: + direction=self.FAN_DIRECTION_EXHAUST + + else: #For PSU + dir_str = "{}{}".format(self.psu_hwmon_path,'psu_fan_dir') + val=self._api_helper.read_txt_file(dir_str) + if val is not None: + if val=='F2B': + direction=self.FAN_DIRECTION_EXHAUST + else: + direction=self.FAN_DIRECTION_INTAKE + else: + direction=self.FAN_DIRECTION_EXHAUST + + return direction + + def get_speed(self): + """ + Retrieves the speed of fan as a percentage of full speed + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + + """ + speed = 0 + if self.is_psu_fan: + psu_fan_path= "{}{}".format(self.psu_hwmon_path, 'psu_fan1_speed_rpm') + fan_speed_rpm = self._api_helper.read_txt_file(psu_fan_path) + if fan_speed_rpm is not None: + speed = (int(fan_speed_rpm,10))*100/26688 + if speed > 100: + speed=100 + else: + return 0 + elif self.get_presence(): + speed_path = "{}{}".format(CPLD_FAN_I2C_PATH, 'duty_cycle_percentage') + speed=self._api_helper.read_txt_file(speed_path) + if speed is None: + return 0 + return int(speed) + + def get_target_speed(self): + """ + Retrieves the target (expected) speed of the fan + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + + Note: + speed_pc = pwm_target/255*100 + + 0 : when PWM mode is use + pwm : when pwm mode is not use + """ + return self.get_speed() + + def get_speed_tolerance(self): + """ + Retrieves the speed tolerance of the fan + Returns: + An integer, the percentage of variance from target speed which is + considered tolerable + """ + return SPEED_TOLERANCE + + def set_speed(self, speed): + """ + Sets the fan speed + Args: + speed: An integer, the percentage of full fan speed to set fan to, + in the range 0 (off) to 100 (full speed) + Returns: + A boolean, True if speed is set successfully, False if not + + """ + + if not self.is_psu_fan and self.get_presence(): + speed_path = "{}{}".format(CPLD_FAN_I2C_PATH, 'duty_cycle_percentage') + return self._api_helper.write_txt_file(speed_path, int(speed)) + + return False + + def set_status_led(self, color): + """ + Sets the state of the fan module status LED + Args: + color: A string representing the color with which to set the + fan module status LED + Returns: + bool: True if status LED state is set successfully, False if not + """ + return False #Not supported + + def get_status_led(self): + """ + Gets the state of the fan status LED + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + status=self.get_presence() + if status is None: + return self.STATUS_LED_COLOR_OFF + + return { + 1: self.STATUS_LED_COLOR_GREEN, + 0: self.STATUS_LED_COLOR_RED + }.get(status, self.STATUS_LED_COLOR_OFF) + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + fan_name = FAN_NAME_LIST[self.fan_tray_index*2 + self.fan_index] \ + if not self.is_psu_fan \ + else "PSU-{} FAN-{}".format(self.psu_index+1, self.fan_index+1) + + return fan_name + + def get_presence(self): + """ + Retrieves the presence of the FAN + Returns: + bool: True if FAN is present, False if not + """ + + + if self.is_psu_fan: + present_path="{}{}".format(self.psu_cpld_path, 'psu_present') + else: + present_path = "{}{}{}".format(CPLD_FAN_I2C_PATH, 'present_', self.fan_tray_index+1) + + val=self._api_helper.read_txt_file(present_path) + if val is not None: + return int(val, 10)==1 + else: + return False + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + if self.is_psu_fan: + psu_fan_path= "{}{}".format(self.psu_hwmon_path, 'psu_fan1_fault') + val=self._api_helper.read_txt_file(psu_fan_path) + if val is not None: + return int(val, 10)==0 + else: + return False + else: + path = "{}{}{}".format(CPLD_FAN_I2C_PATH, 'fault_', self.fan_tray_index+1) + val=self._api_helper.read_txt_file(path) + if val is not None: + return int(val, 10)==0 + else: + return False + + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + + return "N/A" + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return "N/A" + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return (self.fan_index+1) \ + if not self.is_psu_fan else (self.psu_index+1) + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True if not self.is_psu_fan else False + diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/fan_drawer.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..17d339ee55f6 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/fan_drawer.py @@ -0,0 +1,90 @@ +######################################################################## +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Fan-Drawers' information available in the platform. +# +######################################################################## + +try: + from sonic_platform_base.fan_drawer_base import FanDrawerBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +FANS_PER_FANTRAY = 2 + + +class FanDrawer(FanDrawerBase): + """Platform-specific Fan class""" + + def __init__(self, fantray_index): + + FanDrawerBase.__init__(self) + # FanTray is 0-based in platforms + self.fantrayindex = fantray_index + self.__initialize_fan_drawer() + + + def __initialize_fan_drawer(self): + from sonic_platform.fan import Fan + for i in range(FANS_PER_FANTRAY): + self._fan_list.append(Fan(self.fantrayindex, i)) + + def get_name(self): + """ + Retrieves the fan drawer name + Returns: + string: The name of the device + """ + return "FanTray{}".format(self.fantrayindex+1) + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + return self._fan_list[0].get_presence() + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return self._fan_list[0].get_model() + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return self._fan_list[0].get_serial() + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return self._fan_list[0].get_status() + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return (self.fantrayindex+1) + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/helper.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/helper.py new file mode 100644 index 000000000000..b124ca29f0df --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/helper.py @@ -0,0 +1,117 @@ +import os +import struct +import subprocess +from mmap import * +from sonic_py_common import device_info + +HOST_CHK_CMD = "docker > /dev/null 2>&1" +EMPTY_STRING = "" + + +class APIHelper(): + + def __init__(self): + (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() + + def is_host(self): + return os.system(HOST_CHK_CMD) == 0 + + def pci_get_value(self, resource, offset): + status = True + result = "" + try: + fd = os.open(resource, os.O_RDWR) + mm = mmap(fd, 0) + mm.seek(int(offset)) + read_data_stream = mm.read(4) + result = struct.unpack('I', read_data_stream) + except Exception: + status = False + return status, result + + def run_command(self, cmd): + status = True + result = "" + try: + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err == '': + result = raw_data.strip() + except Exception: + status = False + return status, result + + def run_interactive_command(self, cmd): + try: + os.system(cmd) + except Exception: + return False + return True + + def read_txt_file(self, file_path): + try: + with open(file_path, 'r', errors='replace') as fd: + data = fd.read() + return data.strip() + except IOError: + pass + return None + + def write_txt_file(self, file_path, value): + try: + with open(file_path, 'w') as fd: + fd.write(str(value)) + except IOError: + return False + return True + + def ipmi_raw(self, netfn, cmd): + status = True + result = "" + try: + cmd = "ipmitool raw {} {}".format(str(netfn), str(cmd)) + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err == '': + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result + + def ipmi_fru_id(self, id, key=None): + status = True + result = "" + try: + cmd = "ipmitool fru print {}".format(str( + id)) if not key else "ipmitool fru print {0} | grep '{1}' ".format(str(id), str(key)) + + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err == '': + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result + + def ipmi_set_ss_thres(self, id, threshold_key, value): + status = True + result = "" + try: + cmd = "ipmitool sensor thresh '{}' {} {}".format(str(id), str(threshold_key), str(value)) + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err == '': + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/platform.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/platform.py new file mode 100644 index 000000000000..2f2c2a447fcf --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/platform.py @@ -0,0 +1,21 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + +try: + from sonic_platform_base.platform_base import PlatformBase + from sonic_platform.chassis import Chassis +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PlatformBase): + """Platform-specific Platform class""" + + def __init__(self): + PlatformBase.__init__(self) + self._chassis = Chassis() diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/psu.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/psu.py new file mode 100644 index 000000000000..6f21de491b38 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/psu.py @@ -0,0 +1,269 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +#import sonic_platform + +try: + from sonic_platform_base.psu_base import PsuBase + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +I2C_PATH ="/sys/bus/i2c/devices/{0}-00{1}/" + +PSU_NAME_LIST = ["PSU-1", "PSU-2"] +PSU_NUM_FAN = [1, 1] +PSU_HWMON_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "58" + }, + 1: { + "num": 11, + "addr": "59" + }, +} + +PSU_CPLD_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "50" + }, + 1: { + "num": 11, + "addr": "51" + }, +} + +class Psu(PsuBase): + """Platform-specific Psu class""" + + def __init__(self, psu_index=0): + PsuBase.__init__(self) + self.index = psu_index + self._api_helper = APIHelper() + + self.i2c_num = PSU_HWMON_I2C_MAPPING[self.index]["num"] + self.i2c_addr = PSU_HWMON_I2C_MAPPING[self.index]["addr"] + self.hwmon_path = I2C_PATH.format(self.i2c_num, self.i2c_addr) + + self.i2c_num = PSU_CPLD_I2C_MAPPING[self.index]["num"] + self.i2c_addr = PSU_CPLD_I2C_MAPPING[self.index]["addr"] + self.cpld_path = I2C_PATH.format(self.i2c_num, self.i2c_addr) + self.__initialize_fan() + + def __initialize_fan(self): + from sonic_platform.fan import Fan + for fan_index in range(0, PSU_NUM_FAN[self.index]): + fan = Fan(fan_index, 0, is_psu_fan=True, psu_index=self.index) + self._fan_list.append(fan) + + def get_voltage(self): + """ + Retrieves current PSU voltage output + Returns: + A float number, the output voltage in volts, + e.g. 12.1 + """ + vout_path = "{}{}".format(self.hwmon_path, 'psu_v_out') + vout_val=self._api_helper.read_txt_file(vout_path) + if vout_val is not None: + return float(vout_val)/ 1000 + else: + return 0 + + def get_current(self): + """ + Retrieves present electric current supplied by PSU + Returns: + A float number, the electric current in amperes, e.g 15.4 + """ + iout_path = "{}{}".format(self.hwmon_path, 'psu_i_out') + val=self._api_helper.read_txt_file(iout_path) + if val is not None: + return float(val)/1000 + else: + return 0 + + def get_power(self): + """ + Retrieves current energy supplied by PSU + Returns: + A float number, the power in watts, e.g. 302.6 + """ + pout_path = "{}{}".format(self.hwmon_path, 'psu_p_out') + val=self._api_helper.read_txt_file(pout_path) + if val is not None: + return float(val)/1000 + else: + return 0 + + def get_powergood_status(self): + """ + Retrieves the powergood status of PSU + Returns: + A boolean, True if PSU has stablized its output voltages and passed all + its internal self-tests, False if not. + """ + return self.get_status() + + def set_status_led(self, color): + """ + Sets the state of the PSU status LED + Args: + color: A string representing the color with which to set the PSU status LED + Note: Only support green and off + Returns: + bool: True if status LED state is set successfully, False if not + """ + + return False #Controlled by HW + + def get_status_led(self): + """ + Gets the state of the PSU status LED + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + status=self.get_status() + if status is None: + return self.STATUS_LED_COLOR_OFF + + return { + 1: self.STATUS_LED_COLOR_GREEN, + 0: self.STATUS_LED_COLOR_RED + }.get(status, self.STATUS_LED_COLOR_OFF) + + + def get_temperature(self): + """ + Retrieves current temperature reading from PSU + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + temp_path = "{}{}".format(self.hwmon_path, 'psu_temp1_input') + val=self._api_helper.read_txt_file(temp_path) + if val is not None: + return float(val)/1000 + else: + return 0 + + def get_temperature_high_threshold(self): + """ + Retrieves the high threshold temperature of PSU + Returns: + A float number, the high threshold temperature of PSU in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + return False #Not supported + + def get_voltage_high_threshold(self): + """ + Retrieves the high threshold PSU voltage output + Returns: + A float number, the high threshold output voltage in volts, + e.g. 12.1 + """ + vout_path = "{}{}".format(self.hwmon_path, 'psu_mfr_vout_max') + vout_val=self._api_helper.read_txt_file(vout_path) + if vout_val is not None: + return float(vout_val)/ 1000 + else: + return 0 + + def get_voltage_low_threshold(self): + """ + Retrieves the low threshold PSU voltage output + Returns: + A float number, the low threshold output voltage in volts, + e.g. 12.1 + """ + vout_path = "{}{}".format(self.hwmon_path, 'psu_mfr_vout_min') + vout_val=self._api_helper.read_txt_file(vout_path) + if vout_val is not None: + return float(vout_val)/ 1000 + else: + return 0 + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + return PSU_NAME_LIST[self.index] + + def get_presence(self): + """ + Retrieves the presence of the PSU + Returns: + bool: True if PSU is present, False if not + """ + presence_path="{}{}".format(self.cpld_path, 'psu_present') + val=self._api_helper.read_txt_file(presence_path) + if val is not None: + return int(val, 10) == 1 + else: + return 0 + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + power_path="{}{}".format(self.cpld_path, 'psu_power_good') + val=self._api_helper.read_txt_file(power_path) + if val is not None: + return int(val, 10) == 1 + else: + return 0 + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + model_path="{}{}".format(self.cpld_path, 'psu_model_name') + model=self._api_helper.read_txt_file(model_path) + if model is None: + return "N/A" + + return model + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + serial_path="{}{}".format(self.cpld_path, 'psu_serial_number') + serial=self._api_helper.read_txt_file(serial_path) + if serial is None: + return "N/A" + return serial + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.index+1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/sfp.py new file mode 100644 index 000000000000..c421761025cf --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/sfp.py @@ -0,0 +1,484 @@ +############################################################################# +# Edgecore +# +# Sfp contains an implementation of SONiC Platform Base API and +# provides the sfp device status which are available in the platform +# +############################################################################# + +import os +import time +import sys + +from ctypes import create_string_buffer + +try: + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CPLD_I2C_PATH = "/sys/bus/i2c/devices/3-0060/" + +class Sfp(SfpOptoeBase): + """Platform-specific Sfp class""" + + # Port number + PORT_START = 49 + PORT_END = 54 + + # Path to sysfs + PLATFORM_ROOT_PATH = "/usr/share/sonic/device" + PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" + HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" + + PLATFORM = "x86_64-accton_as4630_54pe-r0" + HWSKU = "Accton-AS4630-54PE" + + _port_to_i2c_mapping = { + 49: 18, + 50: 19, + 51: 20, + 52: 21, + 53: 22, + 54: 23, + } + + def __init__(self, sfp_index=0): + SfpOptoeBase.__init__(self) + self._api_helper=APIHelper() + # Init index + self.index = sfp_index + self.port_num = self.index + 1 + # Init eeprom path + eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom' + self.port_to_eeprom_mapping = {} + for x in range(self.PORT_START, self.PORT_END + 1): + self.port_to_eeprom_mapping[x] = eeprom_path.format(self._port_to_i2c_mapping[x]) + + def get_eeprom_path(self): + return self.port_to_eeprom_mapping[self.port_num] + + def __is_host(self): + return os.system(self.HOST_CHK_CMD) == 0 + + def __get_path_to_port_config_file(self): + platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) + hwsku_path = "/".join([platform_path, self.HWSKU] + ) if self.__is_host() else self.PMON_HWSKU_PATH + return "/".join([hwsku_path, "port_config.ini"]) + + def __read_eeprom_specific_bytes(self, offset, num_bytes): + sysfsfile_eeprom = None + eeprom_raw = [] + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + sysfs_sfp_i2c_client_eeprom_path = self.port_to_eeprom_mapping[self.port_num] + try: + sysfsfile_eeprom = open( + sysfs_sfp_i2c_client_eeprom_path, mode="rb", buffering=0) + sysfsfile_eeprom.seek(offset) + raw = sysfsfile_eeprom.read(num_bytes) + if sys.version_info[0] >= 3: + for n in range(0, num_bytes): + eeprom_raw[n] = hex(raw[n])[2:].zfill(2) + else: + for n in range(0, num_bytes): + eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + except Exception: + pass + finally: + if sysfsfile_eeprom: + sysfsfile_eeprom.close() + + return eeprom_raw + + def get_reset_status(self): + """ + Retrieves the reset status of SFP + Returns: + A Boolean, True if reset enabled, False if disabled + """ + if self.port_num < 53: #Copper port and sfp ports are suported. + return False + + reset_path="{}{}{}".format(CPLD_I2C_PATH , "module_reset_" , str(self.port_num)) + val = self._api_helper.read_txt_file(reset_path) + + if val is not None: + return int(val, 10) == 1 + else: + return False + + def get_rx_los(self): + """ + Retrieves the RX LOS (lost-of-signal) status of SFP + Returns: + A Boolean, True if SFP has RX LOS, False if not. + Note : RX LOS status is latched until a call to get_rx_los or a reset. + """ + rx_los = False + + if self.port_num < 49: #Copper port, no sysfs + return False + + if self.port_num < 53: + rx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_rx_los_', self.port_num) + rx_los=self._api_helper.read_txt_file(rx_path) + if rx_los is None: + return False + else: + rx_los_list = [] + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + QSFP_CHANNL_RX_LOS_STATUS_OFFSET, QSFP_CHANNL_RX_LOS_STATUS_WIDTH) if self.get_presence() else None + if dom_channel_monitor_raw is not None: + rx_los_data = int(dom_channel_monitor_raw[0], 16) + rx_los_list.append(rx_los_data & 0x01 != 0) + rx_los_list.append(rx_los_data & 0x02 != 0) + rx_los_list.append(rx_los_data & 0x04 != 0) + rx_los_list.append(rx_los_data & 0x08 != 0) + rx_los = rx_los_list[0] and rx_los_list[1] and rx_los_list[2] and rx_los_list[3] + return rx_los + + def get_tx_fault(self): + """ + Retrieves the TX fault status of SFP + Returns: + A Boolean, True if SFP has TX fault, False if not + Note : TX fault status is lached until a call to get_tx_fault or a reset. + """ + tx_fault = False + if self.port_num < 49: #Copper port, no sysfs + return False + + if self.port_num < 53: + tx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_tx_fault_', self.port_num) + tx_fault=self._api_helper.read_txt_file(tx_path) + if tx_fault is None: + return False + else: + tx_fault_list = [] + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + QSFP_CHANNL_TX_FAULT_STATUS_OFFSET, QSFP_CHANNL_TX_FAULT_STATUS_WIDTH) if self.get_presence() else None + if dom_channel_monitor_raw is not None: + tx_fault_data = int(dom_channel_monitor_raw[0], 16) + tx_fault_list.append(tx_fault_data & 0x01 != 0) + tx_fault_list.append(tx_fault_data & 0x02 != 0) + tx_fault_list.append(tx_fault_data & 0x04 != 0) + tx_fault_list.append(tx_fault_data & 0x08 != 0) + tx_fault = tx_fault_list[0] and tx_fault_list[1] and tx_fault_list[2] and tx_fault_list[3] + + return tx_fault + + def get_tx_disable(self): + """ + Retrieves the tx_disable status of this SFP + Returns: + A Boolean, True if tx_disable is enabled, False if disabled + """ + if self.port_num < 49: #Copper port, no sysfs + return False + + if self.port_num < 53: + tx_disable = False + + tx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_tx_disable_', self.port_num) + tx_disable=self._api_helper.read_txt_file(tx_path) + + if tx_disable is not None: + return tx_disable + else: + return False + + else: + tx_disable_list = [] + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return False + + dom_control_raw = self.__read_eeprom_specific_bytes( + QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None + if dom_control_raw is not None: + dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX1Disable']['value']) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX2Disable']['value']) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX3Disable']['value']) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX4Disable']['value']) + + return tx_disable_list + + def get_tx_disable_channel(self): + """ + Retrieves the TX disabled channels in this SFP + Returns: + A hex of 4 bits (bit 0 to bit 3 as channel 0 to channel 3) to represent + TX channels which have been disabled in this SFP. + As an example, a returned value of 0x5 indicates that channel 0 + and channel 2 have been disabled. + """ + if self.port_num < 53: + # SFP doesn't support this feature + return False + else: + tx_disable_list = self.get_tx_disable() + if tx_disable_list is None: + return 0 + tx_disabled = 0 + for i in range(len(tx_disable_list)): + if tx_disable_list[i]: + tx_disabled |= 1 << i + return tx_disabled + + def get_lpmode(self): + """ + Retrieves the lpmode (low power mode) status of this SFP + Returns: + A Boolean, True if lpmode is enabled, False if disabled + """ + if self.port_num < 53: + # SFP doesn't support this feature + return False + else: + power_set=self.get_power_set() + power_override = self.get_power_override() + return power_set and power_override + + + def reset(self): + """ + Reset SFP and return all user module settings to their default srate. + Returns: + A boolean, True if successful, False if not + """ + # Check for invalid port_num + if self.port_num < 53: #Copper port and sfp ports are not supported. + return False + + reset_path = "{}{}{}".format(CPLD_I2C_PATH, 'module_reset_', self.port_num) + ret = self._api_helper.write_txt_file(reset_path, 1) + if ret is not True: + return ret + + time.sleep(0.01) + ret = self._api_helper.write_txt_file(reset_path, 0) + time.sleep(0.2) + + return ret + + def tx_disable(self, tx_disable): + """ + Disable SFP TX for all channels + Args: + tx_disable : A Boolean, True to enable tx_disable mode, False to disable + tx_disable mode. + Returns: + A boolean, True if tx_disable is set successfully, False if not + """ + if self.port_num < 49: #Copper port, no sysfs + return False + + if self.port_num < 53: + tx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_tx_disable_', self.port_num) + ret = self._api_helper.write_txt_file(tx_path, 1 if tx_disable else 0) + if ret is not None: + time.sleep(0.01) + return ret + else: + return False + + else: + if not self.get_presence(): + return False + sysfsfile_eeprom = None + try: + tx_disable_ctl = 0xf if tx_disable else 0x0 + buffer = create_string_buffer(1) + if sys.version_info[0] >= 3: + buffer[0] = tx_disable_ctl + else: + buffer[0] = chr(tx_disable_ctl) + # Write to eeprom + sysfsfile_eeprom = open( + self.port_to_eeprom_mapping[self.port_num], "r+b") + sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) + + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print ('Error: unable to open file: ',str(e)) + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + return True + + def tx_disable_channel(self, channel, disable): + """ + Sets the tx_disable for specified SFP channels + Args: + channel : A hex of 4 bits (bit 0 to bit 3) which represent channel 0 to 3, + e.g. 0x5 for channel 0 and channel 2. + disable : A boolean, True to disable TX channels specified in channel, + False to enable + Returns: + A boolean, True if successful, False if not + """ + + if self.port_num < 53: + return False # SFP doesn't support this feature + else: + if not self.get_presence(): + return False + + sysfsfile_eeprom = None + try: + channel_state = self.get_tx_disable_channel() + + for i in range(4): + channel_mask = (1 << i) + if not (channel & channel_mask): + continue + + if disable: + channel_state |= channel_mask + else: + channel_state &= ~channel_mask + + buffer = create_string_buffer(1) + if sys.version_info[0] >= 3: + buffer[0] = channel_state + else: + buffer[0] = chr(channel_state) + # Write to eeprom + sysfsfile_eeprom = open( + self.port_to_eeprom_mapping[self.port_num], "r+b") + sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print ('Error: unable to open file: ', str(e)) + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + return True + + def set_lpmode(self, lpmode): + """ + Sets the lpmode (low power mode) of SFP + Args: + lpmode: A Boolean, True to enable lpmode, False to disable it + Note : lpmode can be overridden by set_power_override + Returns: + A boolean, True if lpmode is set successfully, False if not + """ + if self.port_num < 53: + return False # SFP doesn't support this feature + else: + if lpmode is True: + self.set_power_override(True, True) + else: + self.set_power_override(False, False) + + return True + + def set_power_override(self, power_override, power_set): + """ + Sets SFP power level using power_override and power_set + Args: + power_override : + A Boolean, True to override set_lpmode and use power_set + to control SFP power, False to disable SFP power control + through power_override/power_set and use set_lpmode + to control SFP power. + power_set : + Only valid when power_override is True. + A Boolean, True to set SFP to low power mode, False to set + SFP to high power mode. + Returns: + A boolean, True if power-override and power_set are set successfully, + False if not + """ + if self.port_num < 53: + return False # SFP doesn't support this feature + else: + if not self.get_presence(): + return False + try: + power_override_bit = (1 << 0) if power_override else 0 + power_set_bit = (1 << 1) if power_set else (1 << 3) + + buffer = create_string_buffer(1) + if sys.version_info[0] >= 3: + buffer[0] = (power_override_bit | power_set_bit) + else: + buffer[0] = chr(power_override_bit | power_set_bit) + # Write to eeprom + with open(self.port_to_eeprom_mapping[self.port_num], "r+b") as fd: + fd.seek(QSFP_POWEROVERRIDE_OFFSET) + fd.write(buffer[0]) + time.sleep(0.01) + except IOError as e: + print ('Error: unable to open file: ', str(e)) + return False + return True + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + name = None + sfputil_helper = SfpUtilHelper() + sfputil_helper.read_porttab_mappings( + self.__get_path_to_port_config_file()) + name = sfputil_helper.logical[self.index] or "Unknown" + return name + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + if self.port_num < 49: #Copper port, no sysfs + return False + + present_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_present_', self.port_num) + val=self._api_helper.read_txt_file(present_path) + if val is not None: + return int(val, 10)==1 + else: + return False + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return self.get_presence() + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.port_num + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/thermal.py b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/thermal.py new file mode 100644 index 000000000000..938afca80e9e --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/thermal.py @@ -0,0 +1,236 @@ +############################################################################# +# Edgecore +# +# Thermal contains an implementation of SONiC Platform Base API and +# provides the thermal device status which are available in the platform +# +############################################################################# + +import os +import os.path +import glob + +try: + from sonic_platform_base.thermal_base import ThermalBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +PSU_I2C_PATH = "/sys/bus/i2c/devices/{}-00{}/" +PSU_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "58" + }, + 1: { + "num": 11, + "addr": "59" + }, +} + +PSU_CPLD_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "50" + }, + 1: { + "num": 11, + "addr": "51" + }, +} + + +class Thermal(ThermalBase): + """Platform-specific Thermal class""" + + THERMAL_NAME_LIST = [] + PSU_THERMAL_NAME_LIST = [] + SYSFS_PATH = "/sys/bus/i2c/devices" + + def __init__(self, thermal_index=0, is_psu=False, psu_index=0): + self.index = thermal_index + self.is_psu = is_psu + self.psu_index = psu_index + + if self.is_psu: + psu_i2c_bus = PSU_I2C_MAPPING[psu_index]["num"] + psu_i2c_addr = PSU_I2C_MAPPING[psu_index]["addr"] + self.psu_hwmon_path = PSU_I2C_PATH.format(psu_i2c_bus, + psu_i2c_addr) + psu_i2c_bus = PSU_CPLD_I2C_MAPPING[psu_index]["num"] + psu_i2c_addr = PSU_CPLD_I2C_MAPPING[psu_index]["addr"] + self.cpld_path = PSU_I2C_PATH.format(psu_i2c_bus, psu_i2c_addr) + # Add thermal name + self.THERMAL_NAME_LIST.append("Temp sensor 1") + self.THERMAL_NAME_LIST.append("Temp sensor 2") + self.THERMAL_NAME_LIST.append("Temp sensor 3") + self.PSU_THERMAL_NAME_LIST.append("PSU-1 temp sensor 1") + self.PSU_THERMAL_NAME_LIST.append("PSU-2 temp sensor 1") + + # Set hwmon path + i2c_path = { + 0: "14-0048/hwmon/hwmon*/", + 1: "24-004b/hwmon/hwmon*/", + 2: "25-004a/hwmon/hwmon*/" + }.get(self.index, None) + + self.hwmon_path = "{}/{}".format(self.SYSFS_PATH, i2c_path) + self.ss_key = self.THERMAL_NAME_LIST[self.index] + self.ss_index = 1 + + def __read_txt_file(self, file_path): + for filename in glob.glob(file_path): + try: + with open(filename, 'r') as fd: + data =fd.readline().rstrip() + return data + except IOError as e: + pass + + return None + + def __get_temp(self, temp_file): + if not self.is_psu: + temp_file_path = os.path.join(self.hwmon_path, temp_file) + else: + temp_file_path = temp_file + raw_temp = self.__read_txt_file(temp_file_path) + if raw_temp is not None: + return float(raw_temp)/1000 + else: + return 0 + + def __set_threshold(self, file_name, temperature): + if self.is_psu: + return True + temp_file_path = os.path.join(self.hwmon_path, file_name) + for filename in glob.glob(temp_file_path): + try: + with open(filename, 'w') as fd: + fd.write(str(temperature)) + return True + except IOError as e: + print("IOError") + + + def get_temperature(self): + """ + Retrieves current temperature reading from thermal + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + if not self.is_psu: + temp_file = "temp{}_input".format(self.ss_index) + else: + temp_file = self.psu_hwmon_path + "psu_temp1_input" + + return self.__get_temp(temp_file) + + def get_high_threshold(self): + """ + Retrieves the high threshold temperature of thermal + Returns: + A float number, the high threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.is_psu: + return 0 + + temp_file = "temp{}_max".format(self.ss_index) + return self.__get_temp(temp_file) + + def set_high_threshold(self, temperature): + """ + Sets the high threshold temperature of thermal + Args : + temperature: A float number up to nearest thousandth of one degree Celsius, + e.g. 30.125 + Returns: + A boolean, True if threshold is set successfully, False if not + """ + temp_file = "temp{}_max".format(self.ss_index) + temperature = temperature *1000 + self.__set_threshold(temp_file, temperature) + + return True + + def get_name(self): + """ + Retrieves the name of the thermal device + Returns: + string: The name of the thermal device + """ + if self.is_psu: + return self.PSU_THERMAL_NAME_LIST[self.psu_index] + else: + return self.THERMAL_NAME_LIST[self.index] + + def get_presence(self): + """ + Retrieves the presence of the Thermal + Returns: + bool: True if Thermal is present, False if not + """ + if self.is_psu: + val = self.__read_txt_file(self.cpld_path + "psu_present") + return int(val, 10) == 1 + temp_file = "temp{}_input".format(self.ss_index) + temp_file_path = os.path.join(self.hwmon_path, temp_file) + raw_txt = self.__read_txt_file(temp_file_path) + if raw_txt is not None: + return True + else: + return False + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + if self.is_psu: + temp_file = self.psu_hwmon_path + "psu_temp_fault" + return self.get_presence() and (not int( + self.__read_txt_file(temp_file))) + + file_str = "temp{}_input".format(self.ss_index) + file_path = os.path.join(self.hwmon_path, file_str) + raw_txt = self.__read_txt_file(file_path) + if raw_txt is None: + return False + else: + return int(raw_txt) != 0 + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + + return "N/A" + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return "N/A" + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.index+1 + + def is_replaceable(self): + """ + Retrieves whether thermal module is replaceable + Returns: + A boolean value, True if replaceable, False if not + """ + return False diff --git a/device/accton/x86_64-accton_as4630_54pe-r0/system_health_monitoring_config.json b/device/accton/x86_64-accton_as4630_54pe-r0/system_health_monitoring_config.json new file mode 100644 index 000000000000..61f624ee34c6 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54pe-r0/system_health_monitoring_config.json @@ -0,0 +1,17 @@ +{ + "services_to_ignore": [], + "devices_to_ignore": [ + "asic", + "psu.voltage", + "psu.temperature", + "PSU1_FAN1.speed", + "PSU2_FAN1.speed" + ], + "user_defined_checkers": [], + "polling_interval": 60, + "led_color": { + "fault": "STATUS_LED_COLOR_AMBER", + "normal": "STATUS_LED_COLOR_GREEN", + "booting": "STATUS_LED_COLOR_GREEN_BLINK" + } +} diff --git a/device/accton/x86_64-accton_as4630_54te-r0/platform_asic b/device/accton/x86_64-accton_as4630_54te-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/sfp.py index 25e5bce8fe40..4529c2f0ac88 100644 --- a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/sfp.py +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/sfp.py @@ -74,6 +74,7 @@ QSFP_CHANNL_TX_FAULT_STATUS_WIDTH = 1 QSFP_POWEROVERRIDE_OFFSET = 93 QSFP_POWEROVERRIDE_WIDTH = 1 +QSFP_PAGE03_OFFSET = 384 QSFP_MODULE_THRESHOLD_OFFSET = 128 QSFP_MODULE_THRESHOLD_WIDTH = 24 QSFP_CHANNEL_THRESHOLD_OFFSET = 176 @@ -151,8 +152,9 @@ def __init__(self, sfp_index=0): for x in range(self.PORT_START, self.PORT_END + 1): self.port_to_eeprom_mapping[x] = eeprom_path.format(self._port_to_i2c_mapping[x]) - self.info_dict_keys = ['type', 'hardware_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', - 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', 'vendor_date', 'vendor_oui'] + self.info_dict_keys = ['type', 'vendor_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', + 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', 'vendor_date', 'vendor_oui', + 'application_advertisement', 'type_abbrv_name'] self.dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', 'power_lpmode', 'tx_disable', 'tx_disable_channel', 'temperature', 'voltage', 'rx1power', 'rx2power', 'rx3power', 'rx4power', 'tx1bias', 'tx2bias', 'tx3bias', 'tx4bias', 'tx1power', 'tx2power', 'tx3power', 'tx4power'] @@ -234,7 +236,7 @@ def get_transceiver_info(self): keys |Value Format |Information ---------------------------|---------------|---------------------------- type |1*255VCHAR |type of SFP - hardware_rev |1*255VCHAR |hardware version of SFP + vendor_rev |1*255VCHAR |vendor revision of SFP serial |1*255VCHAR |serial number of the SFP manufacturer |1*255VCHAR |SFP vendor name model |1*255VCHAR |SFP model name @@ -247,6 +249,7 @@ def get_transceiver_info(self): specification_compliance |1*255VCHAR |specification compliance vendor_date |1*255VCHAR |vendor date vendor_oui |1*255VCHAR |vendor OUI + application_advertisement |1*255VCHAR |supported applications advertisement ======================================================================== """ # check present status @@ -321,7 +324,7 @@ def get_transceiver_info(self): transceiver_info_dict['manufacturer'] = sfp_vendor_name_data[ 'data']['Vendor Name']['value'] if sfp_vendor_name_data else 'N/A' transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] if sfp_vendor_pn_data else 'N/A' - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] if sfp_vendor_rev_data else 'N/A' + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] if sfp_vendor_rev_data else 'N/A' transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] if sfp_vendor_sn_data else 'N/A' transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] if sfp_vendor_oui_data else 'N/A' transceiver_info_dict['vendor_date'] = sfp_vendor_date_data[ @@ -442,7 +445,7 @@ def get_transceiver_bulk_status(self): qsfp_dom_capability_raw = self.__read_eeprom_specific_bytes( (offset_xcvr + XCVR_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH) if qsfp_dom_capability_raw is not None: - qspf_dom_capability_data = sfpi_obj.parse_qsfp_dom_capability( + qspf_dom_capability_data = sfpi_obj.parse_dom_capability( qsfp_dom_capability_raw, 0) else: return None @@ -598,10 +601,11 @@ def get_transceiver_threshold_info(self): if not self.get_presence() or not sfpd_obj: return {} + offset = QSFP_PAGE03_OFFSET transceiver_dom_threshold_dict = dict.fromkeys( self.threshold_dict_keys, 'N/A') dom_thres_raw = self.__read_eeprom_specific_bytes( - QSFP_MODULE_THRESHOLD_OFFSET, QSFP_MODULE_THRESHOLD_WIDTH) if self.get_presence() and sfpd_obj else None + offset + QSFP_MODULE_THRESHOLD_OFFSET, QSFP_MODULE_THRESHOLD_WIDTH) if self.get_presence() and sfpd_obj else None if dom_thres_raw: module_threshold_values = sfpd_obj.parse_module_threshold_values( @@ -618,7 +622,7 @@ def get_transceiver_threshold_info(self): transceiver_dom_threshold_dict['vcclowwarning'] = module_threshold_data['VccLowWarning']['value'] dom_thres_raw = self.__read_eeprom_specific_bytes( - QSFP_CHANNEL_THRESHOLD_OFFSET, QSFP_CHANNEL_THRESHOLD_WIDTH) if self.get_presence() and sfpd_obj else None + offset + QSFP_CHANNEL_THRESHOLD_OFFSET, QSFP_CHANNEL_THRESHOLD_WIDTH) if self.get_presence() and sfpd_obj else None channel_threshold_values = sfpd_obj.parse_channel_threshold_values( dom_thres_raw, 0) channel_threshold_data = channel_threshold_values.get('data') @@ -648,11 +652,16 @@ def get_reset_status(self): Returns: A Boolean, True if reset enabled, False if disabled """ - if self.port_num < 49: #Copper port, no sysfs + if self.port_num < 53: # non-QSFP ports don't support it. return False - return False # CPLD port doesn't support this feature + reset_path="{}{}{}".format(CPLD_I2C_PATH , "module_reset_" , str(self.port_num)) + val = self._api_helper.read_txt_file(reset_path) + if val is not None: + return int(val, 10) == 1 + else: + return False def get_rx_los(self): """ @@ -827,7 +836,7 @@ def get_power_set(self): return False dom_control_raw = self.__read_eeprom_specific_bytes( - QSFP_POWEROVERRIDE_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None + QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None if dom_control_raw is not None: dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) power_set = ( @@ -852,7 +861,7 @@ def get_power_override(self): return False dom_control_raw = self.__read_eeprom_specific_bytes( - QSFP_POWEROVERRIDE_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None + QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None if dom_control_raw is not None: dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) power_override = ( @@ -939,23 +948,19 @@ def reset(self): A boolean, True if successful, False if not """ # Check for invalid port_num - if self.port_num < 49: #Copper port, no sysfs + if self.port_num < 53: # non-QSFP ports don't support it. return False - ''' reset_path = "{}{}{}".format(CPLD_I2C_PATH, 'module_reset_', self.port_num) - ret = self.__write_txt_file(reset_path, 1) + ret = self._api_helper.write_txt_file(reset_path, 1) if ret is not True: return ret - + time.sleep(0.01) - ret = self.__write_txt_file(reset_path, 0) + ret = self._api_helper.write_txt_file(reset_path, 0) time.sleep(0.2) - - return ret - ''' - return False #CPLD doens't support this feature + return ret def tx_disable(self, tx_disable): """ @@ -1167,3 +1172,20 @@ def get_status(self): A boolean value, True if device is operating properly, False if not """ return self.get_presence() and self.get_transceiver_bulk_status() + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.port_num + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True diff --git a/device/accton/x86_64-accton_as5712_54x-r0/platform_asic b/device/accton/x86_64-accton_as5712_54x-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/accton/x86_64-accton_as5712_54x-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/accton/x86_64-accton_as5812_54t-r0/platform_asic b/device/accton/x86_64-accton_as5812_54t-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/accton/x86_64-accton_as5812_54t-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/accton/x86_64-accton_as5812_54x-r0/platform_asic b/device/accton/x86_64-accton_as5812_54x-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/accton/x86_64-accton_as5812_54x-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/accton/x86_64-accton_as5835_54t-r0/platform_asic b/device/accton/x86_64-accton_as5835_54t-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/accton/x86_64-accton_as5835_54t-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/accton/x86_64-accton_as5835_54t-r0/pmon_daemon_control.json b/device/accton/x86_64-accton_as5835_54t-r0/pmon_daemon_control.json index 584a14b9d942..a3b204e20d8d 100644 --- a/device/accton/x86_64-accton_as5835_54t-r0/pmon_daemon_control.json +++ b/device/accton/x86_64-accton_as5835_54t-r0/pmon_daemon_control.json @@ -1,5 +1,5 @@ { "skip_ledd": true, - "skip_thermalctld": true + "skip_pcied": true } diff --git a/device/accton/x86_64-accton_as5835_54x-r0/installer.conf b/device/accton/x86_64-accton_as5835_54x-r0/installer.conf index 925a32fc0c3a..735fa7992dbc 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/installer.conf +++ b/device/accton/x86_64-accton_as5835_54x-r0/installer.conf @@ -1,3 +1,4 @@ CONSOLE_PORT=0x3f8 CONSOLE_DEV=0 CONSOLE_SPEED=115200 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="intel_iommu=off modprobe.blacklist=i2c-ismt,i2c_ismt,i2c-i801,i2c_i801" diff --git a/device/accton/x86_64-accton_as5835_54x-r0/platform_asic b/device/accton/x86_64-accton_as5835_54x-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/accton/x86_64-accton_as5835_54x-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/accton/x86_64-accton_as5835_54x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as5835_54x-r0/plugins/sfputil.py index b18b15f3e68c..0c815452a7a4 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/plugins/sfputil.py @@ -148,7 +148,7 @@ def get_cage_num(self, port_num): cage_num = port_num if (port_num >= self.QSFP_PORT_START): cage_num = (port_num - self.QSFP_PORT_START)/4 - cage_num = cage_num + self.QSFP_PORT_START + cage_num = int(cage_num + self.QSFP_PORT_START) return cage_num diff --git a/device/accton/x86_64-accton_as5835_54x-r0/pmon_daemon_control.json b/device/accton/x86_64-accton_as5835_54x-r0/pmon_daemon_control.json index 584a14b9d942..a3b204e20d8d 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/pmon_daemon_control.json +++ b/device/accton/x86_64-accton_as5835_54x-r0/pmon_daemon_control.json @@ -1,5 +1,5 @@ { "skip_ledd": true, - "skip_thermalctld": true + "skip_pcied": true } diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/__init__.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/__init__.py index 43435472a423..73a7720e8979 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/__init__.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/__init__.py @@ -1,2 +1,2 @@ -__all__ = ['chassis', 'eeprom', 'platform', 'psu', 'sfp', 'thermal', 'fan'] +__all__ = [ "platform", "chassis", "sfp", "eeprom", "component", "psu", "thermal", "fan", "fan_drawer" ] from . import platform diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/chassis.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/chassis.py index 49805d6d7858..dce9f3c150cd 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/chassis.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/chassis.py @@ -28,7 +28,14 @@ PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" REBOOT_CAUSE_FILE = "reboot-cause.txt" PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" -HOST_CHK_CMD = "docker > /dev/null 2>&1" +HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" +SYSLED_FNODE= "/sys/class/leds/as5835_54x_led::diag/brightness" + +SYSLED_MODES = { + "0" : "STATUS_LED_COLOR_OFF", + "1" : "STATUS_LED_COLOR_GREEN", + "3" : "STATUS_LED_COLOR_AMBER" +} class Chassis(ChassisBase): @@ -37,7 +44,6 @@ class Chassis(ChassisBase): def __init__(self): ChassisBase.__init__(self) self._api_helper = APIHelper() - self._api_helper = APIHelper() self.is_host = self._api_helper.is_host() self.config_data = {} @@ -54,15 +60,16 @@ def __initialize_sfp(self): for index in range(0, PORT_END): sfp = Sfp(index) self._sfp_list.append(sfp) + self._sfpevent = SfpEvent(self._sfp_list) self.sfp_module_initialized = True def __initialize_fan(self): - from sonic_platform.fan import Fan - for fant_index in range(0, NUM_FAN_TRAY): - for fan_index in range(0, NUM_FAN): - fan = Fan(fant_index, fan_index) - self._fan_list.append(fan) - + from sonic_platform.fan_drawer import FanDrawer + for fant_index in range(NUM_FAN_TRAY): + fandrawer = FanDrawer(fant_index) + self._fan_drawer_list.append(fandrawer) + self._fan_list.extend(fandrawer._fan_list) + def __initialize_psu(self): from sonic_platform.psu import Psu for index in range(0, NUM_PSU): @@ -84,12 +91,12 @@ def __initialize_components(self): for index in range(0, NUM_COMPONENT): component = Component(index) self._component_list.append(component) - + def __initialize_watchdog(self): from sonic_platform.watchdog import Watchdog self._watchdog = Watchdog() - + def __is_host(self): return os.system(HOST_CHK_CMD) == 0 @@ -101,23 +108,14 @@ def __read_txt_file(self, file_path): except IOError: pass return None - - def get_model(self): - """ - Retrieves the model number (or part number) of the device - Returns: - string: Model/part number of device - """ - return self._eeprom.get_pn() - + def get_name(self): """ Retrieves the name of the device Returns: string: The name of the device """ - - return self._api_helper.hwsku + return self._eeprom.get_product_name() def get_presence(self): """ @@ -144,7 +142,15 @@ def get_base_mac(self): """ return self._eeprom.get_mac() - def get_serial_number(self): + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return self._eeprom.get_pn() + + def get_serial(self): """ Retrieves the hardware serial number for the chassis Returns: @@ -173,7 +179,7 @@ def get_reboot_cause(self): is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used to pass a description of the reboot cause. """ - + reboot_cause_path = (HOST_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE) sw_reboot_cause = self._api_helper.read_txt_file( reboot_cause_path) or "Unknown" @@ -185,10 +191,7 @@ def get_change_event(self, timeout=0): # SFP event if not self.sfp_module_initialized: self.__initialize_sfp() - - status, sfp_event = SfpEvent(self._sfp_list).get_sfp_event(timeout) - - return status, sfp_event + return self._sfpevent.get_sfp_event(timeout) def get_sfp(self, index): """ @@ -212,3 +215,40 @@ def get_sfp(self, index): sys.stderr.write("SFP index {} out of range (1-{})\n".format( index, len(self._sfp_list))) return sfp + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False + + + def initizalize_system_led(self): + return True + + def get_status_led(self): + val = self._api_helper.read_txt_file(SYSLED_FNODE) + return SYSLED_MODES[val] if val in SYSLED_MODES else "UNKNOWN" + + def set_status_led(self, color): + mode = None + for key, val in SYSLED_MODES.items(): + if val == color: + mode = key + break + if mode is None: + return False + else: + return self._api_helper.write_txt_file(SYSLED_FNODE, mode) + diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/component.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/component.py index deebd5936d0d..f3c9b3cee754 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/component.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/component.py @@ -1,5 +1,5 @@ ############################################################################# -# Celestica +# Edgecore # # Component contains an implementation of SONiC Platform Base API and # provides the components firmware management function @@ -67,14 +67,14 @@ def __get_bios_version(self): with open(BIOS_VERSION_PATH, 'r') as fd: bios_version = fd.read() return bios_version.strip() - except Exception as e: + except Exception as e: print('Get exception when read bios') return None def __get_cpld_version(self): # Retrieves the CPLD firmware version cpld_version = dict() - for cpld_name in CPLD_ADDR_MAPPING: + for cpld_name in CPLD_ADDR_MAPPING: try: cpld_path = "{}{}{}".format(SYSFS_PATH, CPLD_ADDR_MAPPING[cpld_name], '/version') cpld_version_raw= self._api_helper.read_txt_file(cpld_path) @@ -126,3 +126,55 @@ def install_firmware(self, image_path): A boolean, True if install successfully, False if not """ raise NotImplementedError + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return 'N/A' + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return 'N/A' + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return True + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/eeprom.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/eeprom.py index f3bdcbccad3f..bc9041d56b53 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/eeprom.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/eeprom.py @@ -20,7 +20,7 @@ class Tlv(eeprom_tlvinfo.TlvInfoDecoder): EEPROM_DECODE_HEADLINES = 6 def __init__(self): - self._eeprom_path = "/sys/bus/i2c/devices/0-0057/eeprom" + self._eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom" super(Tlv, self).__init__(self._eeprom_path, 0, '', True) self._eeprom = self._load_eeprom() @@ -123,9 +123,12 @@ def get_eeprom(self): def get_pn(self): return self._eeprom.get('0x22', NULL) - + def get_serial(self): return self._eeprom.get('0x23', NULL) def get_mac(self): return self._eeprom.get('0x24', NULL) + + def get_product_name(self): + return self._eeprom.get('0x21', NULL) diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/event.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/event.py index d77ee8c29dc5..7ce2598732e2 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/event.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/event.py @@ -1,42 +1,49 @@ try: import time - from .helper import APIHelper from sonic_py_common.logger import Logger except ImportError as e: raise ImportError(repr(e) + " - required module not found") +POLL_INTERVAL_IN_SEC = 1 class SfpEvent: ''' Listen to insert/remove sfp events ''' def __init__(self, sfp_list): - self._api_helper = APIHelper() self._sfp_list = sfp_list self._logger = Logger() + self._sfp_change_event_data = {'present': 0} - sfp_change_event_data = {'valid': 0, 'last': 0, 'present': 0} - def get_sfp_event(self, timeout=2000): - now = time.time() - port_dict = {} - change_dict = {} - change_dict['sfp'] = port_dict - - if timeout < 1000: - timeout = 1000 - timeout = timeout / float(1000) # Convert to secs - - if now < (self.sfp_change_event_data['last'] + timeout) and self.sfp_change_event_data['valid']: - return True, change_dict - + def get_presence_bitmap(self): bitmap = 0 for sfp in self._sfp_list: modpres = sfp.get_presence() i=sfp.port_num-1 if modpres: bitmap = bitmap | (1 << i) + return bitmap - changed_ports = self.sfp_change_event_data['present'] ^ bitmap - if changed_ports: + def get_sfp_event(self, timeout=2000): + port_dict = {} + change_dict = {} + change_dict['sfp'] = port_dict + + if timeout < 1000: + cd_ms = 1000 + else: + cd_ms = timeout + + while cd_ms > 0: + bitmap = self.get_presence_bitmap() + changed_ports = self._sfp_change_event_data['present'] ^ bitmap + if changed_ports != 0: + break + time.sleep(POLL_INTERVAL_IN_SEC) + # timeout=0 means wait for event forever + if timeout != 0: + cd_ms = cd_ms - POLL_INTERVAL_IN_SEC * 1000 + + if changed_ports != 0: for sfp in self._sfp_list: i=sfp.port_num-1 if (changed_ports & (1 << i)): @@ -47,9 +54,7 @@ def get_sfp_event(self, timeout=2000): # Update the cache dict - self.sfp_change_event_data['present'] = bitmap - self.sfp_change_event_data['last'] = now - self.sfp_change_event_data['valid'] = 1 + self._sfp_change_event_data['present'] = bitmap return True, change_dict else: return True, change_dict diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan.py index cf698bf6d014..8cb1c17fdf72 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan.py @@ -15,9 +15,10 @@ raise ImportError(str(e) + "- required module not found") PSU_FAN_MAX_RPM = 26688 -CPLD_I2C_PATH = "/sys/bus/i2c/devices/3-0063/fan" -PSU_HWMON_I2C_PATH ="/sys/bus/i2c/devices/{}-00{}/" -PSU_I2C_MAPPING = { +SPEED_TOLERANCE = 15 +CPLD_FAN_I2C_PATH = "/sys/bus/i2c/devices/3-0063/fan" +I2C_PATH ="/sys/bus/i2c/devices/{}-00{}/" +PSU_HWMON_I2C_MAPPING = { 0: { "num": 11, "addr": "58" @@ -28,6 +29,20 @@ }, } + +PSU_CPLD_I2C_MAPPING = { + 0: { + "num": 11, + "addr": "50" + }, + 1: { + "num": 12, + "addr": "53" + }, +} + + + FAN_NAME_LIST = ["FAN-1F", "FAN-1R", "FAN-2F", "FAN-2R", "FAN-3F", "FAN-3R", "FAN-4F", "FAN-4R", "FAN-5F", "FAN-5R"] @@ -42,13 +57,18 @@ def __init__(self, fan_tray_index, fan_index=0, is_psu_fan=False, psu_index=0): self.is_psu_fan = is_psu_fan if self.is_psu_fan: self.psu_index = psu_index - self.psu_i2c_num = PSU_I2C_MAPPING[self.psu_index]['num'] - self.psu_i2c_addr = PSU_I2C_MAPPING[self.psu_index]['addr'] - self.psu_hwmon_path = PSU_HWMON_I2C_PATH.format( + self.psu_i2c_num = PSU_HWMON_I2C_MAPPING[self.psu_index]['num'] + self.psu_i2c_addr = PSU_HWMON_I2C_MAPPING[self.psu_index]['addr'] + self.psu_hwmon_path = I2C_PATH.format( self.psu_i2c_num, self.psu_i2c_addr) + self.psu_i2c_num = PSU_CPLD_I2C_MAPPING[self.psu_index]['num'] + self.psu_i2c_addr = PSU_CPLD_I2C_MAPPING[self.psu_index]['addr'] + self.psu_cpld_path = I2C_PATH.format( + self.psu_i2c_num, self.psu_i2c_addr) + FanBase.__init__(self) - + def get_direction(self): """ @@ -60,9 +80,9 @@ def get_direction(self): if not self.is_psu_fan: - dir_str = "{}{}{}".format(CPLD_I2C_PATH, self.fan_tray_index+1, '_direction') + dir_str = "{}{}{}".format(CPLD_FAN_I2C_PATH, self.fan_tray_index+1, '_direction') val=self._api_helper.read_txt_file(dir_str) - if val is not None: + if val is not None: if int(val, 10)==0: direction=self.FAN_DIRECTION_EXHAUST else: @@ -90,26 +110,26 @@ def get_speed(self): Returns: An integer, the percentage of full fan speed, in the range 0 (off) to 100 (full speed) - + """ speed = 0 if self.is_psu_fan: psu_fan_path= "{}{}".format(self.psu_hwmon_path, 'psu_fan1_speed_rpm') fan_speed_rpm = self._api_helper.read_txt_file(psu_fan_path) if fan_speed_rpm is not None: - speed = (int(fan_speed_rpm,10))*100/26688 + speed = (int(fan_speed_rpm,10))*100/26688 if speed > 100: speed=100 else: return 0 elif self.get_presence(): - speed_path = "{}{}".format(CPLD_I2C_PATH, '_duty_cycle_percentage') + speed_path = "{}{}".format(CPLD_FAN_I2C_PATH, '_duty_cycle_percentage') speed=self._api_helper.read_txt_file(speed_path) if speed is None: return 0 return int(speed) - + def get_target_speed(self): """ Retrieves the target (expected) speed of the fan @@ -123,7 +143,7 @@ def get_target_speed(self): 0 : when PWM mode is use pwm : when pwm mode is not use """ - return False #Not supported + return self.get_speed() def get_speed_tolerance(self): """ @@ -132,7 +152,7 @@ def get_speed_tolerance(self): An integer, the percentage of variance from target speed which is considered tolerable """ - return False #Not supported + return SPEED_TOLERANCE def set_speed(self, speed): """ @@ -146,7 +166,7 @@ def set_speed(self, speed): """ if not self.is_psu_fan and self.get_presence(): - speed_path = "{}{}".format(CPLD_I2C_PATH, '_duty_cycle_percentage') + speed_path = "{}{}".format(CPLD_FAN_I2C_PATH, '_duty_cycle_percentage') return self._api_helper.write_txt_file(speed_path, int(speed)) return False @@ -195,17 +215,18 @@ def get_presence(self): Returns: bool: True if FAN is present, False if not """ - present_path = "{}{}{}".format(CPLD_I2C_PATH, self.fan_tray_index+1, '_present') + + + if self.is_psu_fan: + present_path="{}{}".format(self.psu_cpld_path, 'psu_present') + else: + present_path = "{}{}{}".format(CPLD_FAN_I2C_PATH, self.fan_tray_index+1, '_present') + val=self._api_helper.read_txt_file(present_path) - - if not self.is_psu_fan: - if val is not None: - return int(val, 10)==1 - else: - return False - + if val is not None: + return int(val, 10)==1 else: - return True + return False def get_status(self): """ @@ -221,7 +242,7 @@ def get_status(self): else: return False else: - path = "{}{}{}".format(CPLD_I2C_PATH, self.fan_index+1, '_fault') + path = "{}{}{}".format(CPLD_FAN_I2C_PATH, self.fan_tray_index+1, '_fault') val=self._api_helper.read_txt_file(path) if val is not None: return int(val, 10)==0 @@ -245,3 +266,25 @@ def get_serial(self): string: Serial number of device """ return "N/A" + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return (self.fan_index+1) \ + if not self.is_psu_fan else (self.psu_index+1) + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True if not self.is_psu_fan else False + diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan_drawer.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..17d339ee55f6 --- /dev/null +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan_drawer.py @@ -0,0 +1,90 @@ +######################################################################## +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Fan-Drawers' information available in the platform. +# +######################################################################## + +try: + from sonic_platform_base.fan_drawer_base import FanDrawerBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +FANS_PER_FANTRAY = 2 + + +class FanDrawer(FanDrawerBase): + """Platform-specific Fan class""" + + def __init__(self, fantray_index): + + FanDrawerBase.__init__(self) + # FanTray is 0-based in platforms + self.fantrayindex = fantray_index + self.__initialize_fan_drawer() + + + def __initialize_fan_drawer(self): + from sonic_platform.fan import Fan + for i in range(FANS_PER_FANTRAY): + self._fan_list.append(Fan(self.fantrayindex, i)) + + def get_name(self): + """ + Retrieves the fan drawer name + Returns: + string: The name of the device + """ + return "FanTray{}".format(self.fantrayindex+1) + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + return self._fan_list[0].get_presence() + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return self._fan_list[0].get_model() + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return self._fan_list[0].get_serial() + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return self._fan_list[0].get_status() + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return (self.fantrayindex+1) + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/helper.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/helper.py index 4cd60ac90611..b124ca29f0df 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/helper.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/helper.py @@ -51,7 +51,7 @@ def run_interactive_command(self, cmd): def read_txt_file(self, file_path): try: - with open(file_path, 'r') as fd: + with open(file_path, 'r', errors='replace') as fd: data = fd.read() return data.strip() except IOError: diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/psu.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/psu.py index dd6058920667..c2baa2ebf26a 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/psu.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/psu.py @@ -10,7 +10,7 @@ try: from sonic_platform_base.psu_base import PsuBase - #from sonic_platform.fan import Fan + from sonic_platform.thermal import Thermal from .helper import APIHelper except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -64,6 +64,8 @@ def __initialize_fan(self): for fan_index in range(0, PSU_NUM_FAN[self.index]): fan = Fan(fan_index, 0, is_psu_fan=True, psu_index=self.index) self._fan_list.append(fan) + + self._thermal_list.append(Thermal(is_psu=True, psu_index=self.index)) def get_voltage(self): """ @@ -154,7 +156,7 @@ def get_temperature(self): return float(val)/1000 else: return 0 - + def get_temperature_high_threshold(self): """ Retrieves the high threshold temperature of PSU @@ -251,3 +253,20 @@ def get_serial(self): if serial is None: return "N/A" return serial + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.index+1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/sfp.py index 4ea043f3d4d6..ec16e80568f4 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/sfp.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/sfp.py @@ -13,108 +13,14 @@ from ctypes import create_string_buffer try: - from sonic_platform_base.sfp_base import SfpBase - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom - from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId - #from sonic_platform_base.sonic_sfp.sff8472 import sffbase - from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase from .helper import APIHelper except ImportError as e: raise ImportError(str(e) + "- required module not found") CPLD_I2C_PATH = "/sys/bus/i2c/devices/" -QSFP_INFO_OFFSET = 128 -QSFP_DOM_OFFSET = 0 - -SFP_INFO_OFFSET = 0 -SFP_DOM_OFFSET = 256 - -XCVR_INTFACE_BULK_OFFSET = 0 -XCVR_INTFACE_BULK_WIDTH_QSFP = 20 -XCVR_INTFACE_BULK_WIDTH_SFP = 21 -XCVR_HW_REV_WIDTH_QSFP = 2 -XCVR_HW_REV_WIDTH_SFP = 4 -XCVR_CABLE_LENGTH_WIDTH_QSFP = 5 -XCVR_VENDOR_NAME_OFFSET = 20 -XCVR_VENDOR_NAME_WIDTH = 16 -XCVR_VENDOR_OUI_OFFSET = 37 -XCVR_VENDOR_OUI_WIDTH = 3 -XCVR_VENDOR_PN_OFFSET = 40 -XCVR_VENDOR_PN_WIDTH = 16 -XCVR_HW_REV_OFFSET = 56 -XCVR_HW_REV_WIDTH_OSFP = 2 -XCVR_HW_REV_WIDTH_SFP = 4 -XCVR_VENDOR_SN_OFFSET = 68 -XCVR_VENDOR_SN_WIDTH = 16 -XCVR_VENDOR_DATE_OFFSET = 84 -XCVR_VENDOR_DATE_WIDTH = 8 -XCVR_DOM_CAPABILITY_OFFSET = 92 -XCVR_DOM_CAPABILITY_WIDTH = 1 - -# Offset for values in QSFP eeprom -QSFP_DOM_REV_OFFSET = 1 -QSFP_DOM_REV_WIDTH = 1 -QSFP_TEMPE_OFFSET = 22 -QSFP_TEMPE_WIDTH = 2 -QSFP_VOLT_OFFSET = 26 -QSFP_VOLT_WIDTH = 2 -QSFP_CHANNL_MON_OFFSET = 34 -QSFP_CHANNL_MON_WIDTH = 16 -QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH = 24 -QSFP_CONTROL_OFFSET = 86 -QSFP_CONTROL_WIDTH = 8 -QSFP_CHANNL_RX_LOS_STATUS_OFFSET = 3 -QSFP_CHANNL_RX_LOS_STATUS_WIDTH = 1 -QSFP_CHANNL_TX_FAULT_STATUS_OFFSET = 4 -QSFP_CHANNL_TX_FAULT_STATUS_WIDTH = 1 -QSFP_POWEROVERRIDE_OFFSET = 93 -QSFP_POWEROVERRIDE_WIDTH = 1 -QSFP_MODULE_THRESHOLD_OFFSET = 128 -QSFP_MODULE_THRESHOLD_WIDTH = 24 -QSFP_CHANNEL_THRESHOLD_OFFSET = 176 -QSFP_CHANNEL_THRESHOLD_WIDTH = 16 - -qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)', - 'Length OM2(m)', 'Length OM1(m)', - 'Length Cable Assembly(m)') - -qsfp_compliance_code_tup = ('10/40G Ethernet Compliance Code', 'SONET Compliance codes', - 'SAS/SATA compliance codes', 'Gigabit Ethernet Compliant codes', - 'Fibre Channel link length/Transmitter Technology', - 'Fibre Channel transmission media', 'Fibre Channel Speed') - - -# Offset for values in SFP eeprom -SFP_TEMPE_OFFSET = 96 -SFP_TEMPE_WIDTH = 2 -SFP_VOLT_OFFSET = 98 -SFP_VOLT_WIDTH = 2 -SFP_CHANNL_MON_OFFSET = 100 -SFP_CHANNL_MON_WIDTH = 6 -SFP_MODULE_THRESHOLD_OFFSET = 0 -SFP_MODULE_THRESHOLD_WIDTH = 40 -SFP_CHANNL_THRESHOLD_OFFSET = 112 -SFP_CHANNL_THRESHOLD_WIDTH = 2 -SFP_STATUS_CONTROL_OFFSET = 110 -SFP_STATUS_CONTROL_WIDTH = 1 -SFP_TX_DISABLE_HARD_BIT = 7 -SFP_TX_DISABLE_SOFT_BIT = 6 - -sfp_cable_length_tup = ('LengthSMFkm-UnitsOfKm', 'LengthSMF(UnitsOf100m)', - 'Length50um(UnitsOf10m)', 'Length62.5um(UnitsOfm)', - 'LengthCable(UnitsOfm)', 'LengthOM3(UnitsOf10m)') - -sfp_compliance_code_tup = ('10GEthernetComplianceCode', 'InfinibandComplianceCode', - 'ESCONComplianceCodes', 'SONETComplianceCodes', - 'EthernetComplianceCodes', 'FibreChannelLinkLength', - 'FibreChannelTechnology', 'SFP+CableTechnology', - 'FibreChannelTransmissionMedia', 'FibreChannelSpeed') - - -class Sfp(SfpBase): +class Sfp(SfpOptoeBase): """Platform-specific Sfp class""" # Port number @@ -125,7 +31,7 @@ class Sfp(SfpBase): # Path to sysfs PLATFORM_ROOT_PATH = "/usr/share/sonic/device" PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" - HOST_CHK_CMD = "docker > /dev/null 2>&1" + HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" PLATFORM = "x86_64-accton_as5835_54x-r0" HWSKU = "Accton-AS5835-54X" @@ -194,6 +100,7 @@ class Sfp(SfpBase): } def __init__(self, sfp_index=0): + SfpOptoeBase.__init__(self) self._api_helper=APIHelper() # Init index self.index = sfp_index @@ -204,44 +111,15 @@ def __init__(self, sfp_index=0): self.port_to_eeprom_mapping = {} for x in range(self.PORT_START, self.PORT_END + 1): self.port_to_eeprom_mapping[x] = eeprom_path.format(self._port_to_i2c_mapping[x]) - - self.info_dict_keys = ['type', 'hardware_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', - 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', 'vendor_date', 'vendor_oui', - 'application_advertisement', 'type_abbrv_name'] - - self.dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', 'power_lpmode', 'tx_disable', 'tx_disable_channel', 'temperature', 'voltage', - 'rx1power', 'rx2power', 'rx3power', 'rx4power', 'tx1bias', 'tx2bias', 'tx3bias', 'tx4bias', 'tx1power', 'tx2power', 'tx3power', 'tx4power'] - - self.threshold_dict_keys = ['temphighalarm', 'temphighwarning', 'templowalarm', 'templowwarning', 'vcchighalarm', 'vcchighwarning', 'vcclowalarm', 'vcclowwarning', 'rxpowerhighalarm', 'rxpowerhighwarning', - 'rxpowerlowalarm', 'rxpowerlowwarning', 'txpowerhighalarm', 'txpowerhighwarning', 'txpowerlowalarm', 'txpowerlowwarning', 'txbiashighalarm', 'txbiashighwarning', 'txbiaslowalarm', 'txbiaslowwarning'] - SfpBase.__init__(self) - + def get_eeprom_path(self): + return self.port_to_eeprom_mapping[self.port_num] + # For cage 1~38 are at cpld2, others are at cpld3. def __get_cpld_num(self, port_num): return 1 if (port_num < 39) else 2 - def _convert_string_to_num(self, value_str): - if "-inf" in value_str: - return 'N/A' - elif "Unknown" in value_str: - return 'N/A' - elif 'dBm' in value_str: - t_str = value_str.rstrip('dBm') - return float(t_str) - elif 'mA' in value_str: - t_str = value_str.rstrip('mA') - return float(t_str) - elif 'C' in value_str: - t_str = value_str.rstrip('C') - return float(t_str) - elif 'Volts' in value_str: - t_str = value_str.rstrip('Volts') - return float(t_str) - else: - return 'N/A' - def __is_host(self): return os.system(self.HOST_CHK_CMD) == 0 @@ -277,422 +155,6 @@ def __read_eeprom_specific_bytes(self, offset, num_bytes): return eeprom_raw - def get_transceiver_info(self): - """ - Retrieves transceiver info of this SFP - Returns: - A dict which contains following keys/values : - ======================================================================== - keys |Value Format |Information - ---------------------------|---------------|---------------------------- - type |1*255VCHAR |type of SFP - hardware_rev |1*255VCHAR |hardware version of SFP - serial |1*255VCHAR |serial number of the SFP - manufacturer |1*255VCHAR |SFP vendor name - model |1*255VCHAR |SFP model name - connector |1*255VCHAR |connector information - encoding |1*255VCHAR |encoding information - ext_identifier |1*255VCHAR |extend identifier - ext_rateselect_compliance |1*255VCHAR |extended rateSelect compliance - cable_length |INT |cable length in m - nominal_bit_rate |INT |nominal bit rate by 100Mbs - specification_compliance |1*255VCHAR |specification compliance - vendor_date |1*255VCHAR |vendor date - vendor_oui |1*255VCHAR |vendor OUI - application_advertisement |1*255VCHAR |supported applications advertisement - ======================================================================== - """ - # check present status - if self.port_num < 49: - sfpi_obj = sff8472InterfaceId() #SFP - else: - sfpi_obj = sff8436InterfaceId() #QSFP - if not self.get_presence() or not sfpi_obj: - return {} - - if self.port_num < 49: - offset = SFP_INFO_OFFSET - sfp_interface_bulk_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_INTFACE_BULK_OFFSET), XCVR_INTFACE_BULK_WIDTH_SFP) - else: - offset = QSFP_INFO_OFFSET - sfp_interface_bulk_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_INTFACE_BULK_OFFSET), XCVR_INTFACE_BULK_WIDTH_QSFP) - - sfp_interface_bulk_data = sfpi_obj.parse_sfp_info_bulk( - sfp_interface_bulk_raw, 0) - - sfp_vendor_name_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_VENDOR_NAME_OFFSET), XCVR_VENDOR_NAME_WIDTH) - sfp_vendor_name_data = sfpi_obj.parse_vendor_name( - sfp_vendor_name_raw, 0) - - sfp_vendor_pn_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_VENDOR_PN_OFFSET), XCVR_VENDOR_PN_WIDTH) - sfp_vendor_pn_data = sfpi_obj.parse_vendor_pn( - sfp_vendor_pn_raw, 0) - - if self.port_num < 49: - sfp_vendor_rev_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_HW_REV_OFFSET), XCVR_HW_REV_WIDTH_SFP) - else: - sfp_vendor_rev_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_HW_REV_OFFSET), XCVR_HW_REV_WIDTH_QSFP) - - sfp_vendor_rev_data = sfpi_obj.parse_vendor_rev( - sfp_vendor_rev_raw, 0) - - sfp_vendor_sn_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_VENDOR_SN_OFFSET), XCVR_VENDOR_SN_WIDTH) - sfp_vendor_sn_data = sfpi_obj.parse_vendor_sn( - sfp_vendor_sn_raw, 0) - - sfp_vendor_oui_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_VENDOR_OUI_OFFSET), XCVR_VENDOR_OUI_WIDTH) - if sfp_vendor_oui_raw is not None: - sfp_vendor_oui_data = sfpi_obj.parse_vendor_oui( - sfp_vendor_oui_raw, 0) - - sfp_vendor_date_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_VENDOR_DATE_OFFSET), XCVR_VENDOR_DATE_WIDTH) - sfp_vendor_date_data = sfpi_obj.parse_vendor_date( - sfp_vendor_date_raw, 0) - - transceiver_info_dict = dict.fromkeys(self.info_dict_keys, 'N/A') - compliance_code_dict = dict() - - if sfp_interface_bulk_data: - transceiver_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value'] - transceiver_info_dict['connector'] = sfp_interface_bulk_data['data']['Connector']['value'] - transceiver_info_dict['encoding'] = sfp_interface_bulk_data['data']['EncodingCodes']['value'] - transceiver_info_dict['ext_identifier'] = sfp_interface_bulk_data['data']['Extended Identifier']['value'] - transceiver_info_dict['ext_rateselect_compliance'] = sfp_interface_bulk_data['data']['RateIdentifier']['value'] - transceiver_info_dict['type_abbrv_name'] = sfp_interface_bulk_data['data']['type_abbrv_name']['value'] - - transceiver_info_dict['manufacturer'] = sfp_vendor_name_data[ - 'data']['Vendor Name']['value'] if sfp_vendor_name_data else 'N/A' - transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] if sfp_vendor_pn_data else 'N/A' - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] if sfp_vendor_rev_data else 'N/A' - transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] if sfp_vendor_sn_data else 'N/A' - transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] if sfp_vendor_oui_data else 'N/A' - transceiver_info_dict['vendor_date'] = sfp_vendor_date_data[ - 'data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] if sfp_vendor_date_data else 'N/A' - transceiver_info_dict['cable_type'] = "Unknown" - transceiver_info_dict['cable_length'] = "Unknown" - - if self.port_num < 49: - for key in sfp_cable_length_tup: - if key in sfp_interface_bulk_data['data']: - transceiver_info_dict['cable_type'] = key - transceiver_info_dict['cable_length'] = str( - sfp_interface_bulk_data['data'][key]['value']) - - for key in sfp_compliance_code_tup: - if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value'] - - transceiver_info_dict['specification_compliance'] = str( - compliance_code_dict) - transceiver_info_dict['nominal_bit_rate'] = str( - sfp_interface_bulk_data['data']['NominalSignallingRate(UnitsOf100Mbd)']['value']) - else: - for key in qsfp_cable_length_tup: - if key in sfp_interface_bulk_data['data']: - transceiver_info_dict['cable_type'] = key - transceiver_info_dict['cable_length'] = str( - sfp_interface_bulk_data['data'][key]['value']) - - for key in qsfp_compliance_code_tup: - if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value'] - - transceiver_info_dict['specification_compliance'] = str( - compliance_code_dict) - transceiver_info_dict['nominal_bit_rate'] = str( - sfp_interface_bulk_data['data']['Nominal Bit Rate(100Mbs)']['value']) - - - return transceiver_info_dict - - def get_transceiver_bulk_status(self): - """ - Retrieves transceiver bulk status of this SFP - Returns: - A dict which contains following keys/values : - ======================================================================== - keys |Value Format |Information - ---------------------------|---------------|---------------------------- - rx_los |BOOLEAN |RX loss-of-signal status, True if has RX los, False if not. - tx_fault |BOOLEAN |TX fault status, True if has TX fault, False if not. - reset_status |BOOLEAN |reset status, True if SFP in reset, False if not. - lp_mode |BOOLEAN |low power mode status, True in lp mode, False if not. - tx_disable |BOOLEAN |TX disable status, True TX disabled, False if not. - tx_disabled_channel |HEX |disabled TX channels in hex, bits 0 to 3 represent channel 0 - | |to channel 3. - temperature |INT |module temperature in Celsius - voltage |INT |supply voltage in mV - txbias |INT |TX Bias Current in mA, n is the channel number, - | |for example, tx2bias stands for tx bias of channel 2. - rxpower |INT |received optical power in mW, n is the channel number, - | |for example, rx2power stands for rx power of channel 2. - txpower |INT |TX output power in mW, n is the channel number, - | |for example, tx2power stands for tx power of channel 2. - ======================================================================== - """ - # check present status - if self.port_num < 49: #SFP case - sfpd_obj = sff8472Dom() - if not self.get_presence() or not sfpd_obj: - return {} - - eeprom_ifraw = self.__read_eeprom_specific_bytes(0, SFP_DOM_OFFSET) - sfpi_obj = sff8472InterfaceId(eeprom_ifraw) - cal_type = sfpi_obj.get_calibration_type() - sfpd_obj._calibration_type = cal_type - - offset = SFP_DOM_OFFSET - transceiver_dom_info_dict = dict.fromkeys(self.dom_dict_keys, 'N/A') - dom_temperature_raw = self.__read_eeprom_specific_bytes( - (offset + SFP_TEMPE_OFFSET), SFP_TEMPE_WIDTH) - - if dom_temperature_raw is not None: - dom_temperature_data = sfpd_obj.parse_temperature( - dom_temperature_raw, 0) - transceiver_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] - - dom_voltage_raw = self.__read_eeprom_specific_bytes( - (offset + SFP_VOLT_OFFSET), SFP_VOLT_WIDTH) - if dom_voltage_raw is not None: - dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) - transceiver_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] - - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - (offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) - if dom_channel_monitor_raw is not None: - dom_voltage_data = sfpd_obj.parse_channel_monitor_params( - dom_channel_monitor_raw, 0) - transceiver_dom_info_dict['tx1power'] = dom_voltage_data['data']['TXPower']['value'] - transceiver_dom_info_dict['rx1power'] = dom_voltage_data['data']['RXPower']['value'] - transceiver_dom_info_dict['tx1bias'] = dom_voltage_data['data']['TXBias']['value'] - - else: #QSFP case - sfpd_obj = sff8436Dom() - sfpi_obj = sff8436InterfaceId() - - if not self.get_presence() or not sfpi_obj or not sfpd_obj: - return {} - - transceiver_dom_info_dict = dict.fromkeys(self.dom_dict_keys, 'N/A') - offset = QSFP_DOM_OFFSET - offset_xcvr = QSFP_INFO_OFFSET - - # QSFP capability byte parse, through this byte can know whether it support tx_power or not. - # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, - # need to add more code for determining the capability and version compliance - # in SFF-8636 dom capability definitions evolving with the versions. - qsfp_dom_capability_raw = self.__read_eeprom_specific_bytes( - (offset_xcvr + XCVR_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH) - if qsfp_dom_capability_raw is not None: - qspf_dom_capability_data = sfpi_obj.parse_dom_capability( - qsfp_dom_capability_raw, 0) - else: - return None - - dom_temperature_raw = self.__read_eeprom_specific_bytes( - (offset + QSFP_TEMPE_OFFSET), QSFP_TEMPE_WIDTH) - if dom_temperature_raw is not None: - dom_temperature_data = sfpd_obj.parse_temperature( - dom_temperature_raw, 0) - transceiver_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] - - dom_voltage_raw = self.__read_eeprom_specific_bytes( - (offset + QSFP_VOLT_OFFSET), QSFP_VOLT_WIDTH) - if dom_voltage_raw is not None: - dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) - transceiver_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] - - qsfp_dom_rev_raw = self.__read_eeprom_specific_bytes( - (offset + QSFP_DOM_REV_OFFSET), QSFP_DOM_REV_WIDTH) - if qsfp_dom_rev_raw is not None: - qsfp_dom_rev_data = sfpd_obj.parse_sfp_dom_rev(qsfp_dom_rev_raw, 0) - qsfp_dom_rev = qsfp_dom_rev_data['data']['dom_rev']['value'] - - # The tx_power monitoring is only available on QSFP which compliant with SFF-8636 - # and claimed that it support tx_power with one indicator bit. - dom_channel_monitor_data = {} - dom_channel_monitor_raw = None - qsfp_tx_power_support = qspf_dom_capability_data['data']['Tx_power_support']['value'] - if (qsfp_dom_rev[0:8] != 'SFF-8636' or (qsfp_dom_rev[0:8] == 'SFF-8636' and qsfp_tx_power_support != 'on')): - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WIDTH) - if dom_channel_monitor_raw is not None: - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params( - dom_channel_monitor_raw, 0) - - else: - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) - if dom_channel_monitor_raw is not None: - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power( - dom_channel_monitor_raw, 0) - transceiver_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TX1Power']['value'] - transceiver_dom_info_dict['tx2power'] = dom_channel_monitor_data['data']['TX2Power']['value'] - transceiver_dom_info_dict['tx3power'] = dom_channel_monitor_data['data']['TX3Power']['value'] - transceiver_dom_info_dict['tx4power'] = dom_channel_monitor_data['data']['TX4Power']['value'] - - if dom_channel_monitor_raw: - transceiver_dom_info_dict['rx1power'] = dom_channel_monitor_data['data']['RX1Power']['value'] - transceiver_dom_info_dict['rx2power'] = dom_channel_monitor_data['data']['RX2Power']['value'] - transceiver_dom_info_dict['rx3power'] = dom_channel_monitor_data['data']['RX3Power']['value'] - transceiver_dom_info_dict['rx4power'] = dom_channel_monitor_data['data']['RX4Power']['value'] - transceiver_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TX1Bias']['value'] - transceiver_dom_info_dict['tx2bias'] = dom_channel_monitor_data['data']['TX2Bias']['value'] - transceiver_dom_info_dict['tx3bias'] = dom_channel_monitor_data['data']['TX3Bias']['value'] - transceiver_dom_info_dict['tx4bias'] = dom_channel_monitor_data['data']['TX4Bias']['value'] - #End of else - - - for key in transceiver_dom_info_dict: - transceiver_dom_info_dict[key] = self._convert_string_to_num( - transceiver_dom_info_dict[key]) - - transceiver_dom_info_dict['rx_los'] = self.get_rx_los() - transceiver_dom_info_dict['tx_fault'] = self.get_tx_fault() - transceiver_dom_info_dict['reset_status'] = self.get_reset_status() - transceiver_dom_info_dict['lp_mode'] = self.get_lpmode() - - return transceiver_dom_info_dict - - def get_transceiver_threshold_info(self): - """ - Retrieves transceiver threshold info of this SFP - Returns: - A dict which contains following keys/values : - ======================================================================== - keys |Value Format |Information - ---------------------------|---------------|---------------------------- - temphighalarm |FLOAT |High Alarm Threshold value of temperature in Celsius. - templowalarm |FLOAT |Low Alarm Threshold value of temperature in Celsius. - temphighwarning |FLOAT |High Warning Threshold value of temperature in Celsius. - templowwarning |FLOAT |Low Warning Threshold value of temperature in Celsius. - vcchighalarm |FLOAT |High Alarm Threshold value of supply voltage in mV. - vcclowalarm |FLOAT |Low Alarm Threshold value of supply voltage in mV. - vcchighwarning |FLOAT |High Warning Threshold value of supply voltage in mV. - vcclowwarning |FLOAT |Low Warning Threshold value of supply voltage in mV. - rxpowerhighalarm |FLOAT |High Alarm Threshold value of received power in dBm. - rxpowerlowalarm |FLOAT |Low Alarm Threshold value of received power in dBm. - rxpowerhighwarning |FLOAT |High Warning Threshold value of received power in dBm. - rxpowerlowwarning |FLOAT |Low Warning Threshold value of received power in dBm. - txpowerhighalarm |FLOAT |High Alarm Threshold value of transmit power in dBm. - txpowerlowalarm |FLOAT |Low Alarm Threshold value of transmit power in dBm. - txpowerhighwarning |FLOAT |High Warning Threshold value of transmit power in dBm. - txpowerlowwarning |FLOAT |Low Warning Threshold value of transmit power in dBm. - txbiashighalarm |FLOAT |High Alarm Threshold value of tx Bias Current in mA. - txbiaslowalarm |FLOAT |Low Alarm Threshold value of tx Bias Current in mA. - txbiashighwarning |FLOAT |High Warning Threshold value of tx Bias Current in mA. - txbiaslowwarning |FLOAT |Low Warning Threshold value of tx Bias Current in mA. - ======================================================================== - """ - # check present status - if self.port_num < 49: - sfpd_obj = sff8472Dom() - - if not self.get_presence() and not sfpd_obj: - return {} - - eeprom_ifraw = self.__read_eeprom_specific_bytes(0, SFP_DOM_OFFSET) - sfpi_obj = sff8472InterfaceId(eeprom_ifraw) - cal_type = sfpi_obj.get_calibration_type() - sfpd_obj._calibration_type = cal_type - - offset = SFP_DOM_OFFSET - transceiver_dom_threshold_info_dict = dict.fromkeys( - self.threshold_dict_keys, 'N/A') - dom_module_threshold_raw = self.__read_eeprom_specific_bytes( - (offset + SFP_MODULE_THRESHOLD_OFFSET), SFP_MODULE_THRESHOLD_WIDTH) - if dom_module_threshold_raw is not None: - dom_module_threshold_data = sfpd_obj.parse_alarm_warning_threshold( - dom_module_threshold_raw, 0) - - transceiver_dom_threshold_info_dict['temphighalarm'] = dom_module_threshold_data['data']['TempHighAlarm']['value'] - transceiver_dom_threshold_info_dict['templowalarm'] = dom_module_threshold_data['data']['TempLowAlarm']['value'] - transceiver_dom_threshold_info_dict['temphighwarning'] = dom_module_threshold_data['data']['TempHighWarning']['value'] - transceiver_dom_threshold_info_dict['templowwarning'] = dom_module_threshold_data['data']['TempLowWarning']['value'] - transceiver_dom_threshold_info_dict['vcchighalarm'] = dom_module_threshold_data['data']['VoltageHighAlarm']['value'] - transceiver_dom_threshold_info_dict['vcclowalarm'] = dom_module_threshold_data['data']['VoltageLowAlarm']['value'] - transceiver_dom_threshold_info_dict['vcchighwarning'] = dom_module_threshold_data[ - 'data']['VoltageHighWarning']['value'] - transceiver_dom_threshold_info_dict['vcclowwarning'] = dom_module_threshold_data['data']['VoltageLowWarning']['value'] - transceiver_dom_threshold_info_dict['txbiashighalarm'] = dom_module_threshold_data['data']['BiasHighAlarm']['value'] - transceiver_dom_threshold_info_dict['txbiaslowalarm'] = dom_module_threshold_data['data']['BiasLowAlarm']['value'] - transceiver_dom_threshold_info_dict['txbiashighwarning'] = dom_module_threshold_data['data']['BiasHighWarning']['value'] - transceiver_dom_threshold_info_dict['txbiaslowwarning'] = dom_module_threshold_data['data']['BiasLowWarning']['value'] - transceiver_dom_threshold_info_dict['txpowerhighalarm'] = dom_module_threshold_data['data']['TXPowerHighAlarm']['value'] - transceiver_dom_threshold_info_dict['txpowerlowalarm'] = dom_module_threshold_data['data']['TXPowerLowAlarm']['value'] - transceiver_dom_threshold_info_dict['txpowerhighwarning'] = dom_module_threshold_data['data']['TXPowerHighWarning']['value'] - transceiver_dom_threshold_info_dict['txpowerlowwarning'] = dom_module_threshold_data['data']['TXPowerLowWarning']['value'] - transceiver_dom_threshold_info_dict['rxpowerhighalarm'] = dom_module_threshold_data['data']['RXPowerHighAlarm']['value'] - transceiver_dom_threshold_info_dict['rxpowerlowalarm'] = dom_module_threshold_data['data']['RXPowerLowAlarm']['value'] - transceiver_dom_threshold_info_dict['rxpowerhighwarning'] = dom_module_threshold_data['data']['RXPowerHighWarning']['value'] - transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_module_threshold_data['data']['RXPowerLowWarning']['value'] - - for key in transceiver_dom_threshold_info_dict: - transceiver_dom_threshold_info_dict[key] = self._convert_string_to_num( - transceiver_dom_threshold_info_dict[key]) - - return transceiver_dom_threshold_info_dict - - - else: - sfpd_obj = sff8436Dom() - - if not self.get_presence() or not sfpd_obj: - return {} - - transceiver_dom_threshold_dict = dict.fromkeys( - self.threshold_dict_keys, 'N/A') - dom_thres_raw = self.__read_eeprom_specific_bytes( - QSFP_MODULE_THRESHOLD_OFFSET, QSFP_MODULE_THRESHOLD_WIDTH) if self.get_presence() and sfpd_obj else None - - if dom_thres_raw: - module_threshold_values = sfpd_obj.parse_module_threshold_values( - dom_thres_raw, 0) - module_threshold_data = module_threshold_values.get('data') - if module_threshold_data: - transceiver_dom_threshold_dict['temphighalarm'] = module_threshold_data['TempHighAlarm']['value'] - transceiver_dom_threshold_dict['templowalarm'] = module_threshold_data['TempLowAlarm']['value'] - transceiver_dom_threshold_dict['temphighwarning'] = module_threshold_data['TempHighWarning']['value'] - transceiver_dom_threshold_dict['templowwarning'] = module_threshold_data['TempLowWarning']['value'] - transceiver_dom_threshold_dict['vcchighalarm'] = module_threshold_data['VccHighAlarm']['value'] - transceiver_dom_threshold_dict['vcclowalarm'] = module_threshold_data['VccLowAlarm']['value'] - transceiver_dom_threshold_dict['vcchighwarning'] = module_threshold_data['VccHighWarning']['value'] - transceiver_dom_threshold_dict['vcclowwarning'] = module_threshold_data['VccLowWarning']['value'] - - dom_thres_raw = self.__read_eeprom_specific_bytes( - QSFP_CHANNEL_THRESHOLD_OFFSET, QSFP_CHANNEL_THRESHOLD_WIDTH) if self.get_presence() and sfpd_obj else None - channel_threshold_values = sfpd_obj.parse_channel_threshold_values( - dom_thres_raw, 0) - channel_threshold_data = channel_threshold_values.get('data') - if channel_threshold_data: - transceiver_dom_threshold_dict['rxpowerhighalarm'] = channel_threshold_data['RxPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerlowalarm'] = channel_threshold_data['RxPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerhighwarning'] = channel_threshold_data['RxPowerHighWarning']['value'] - transceiver_dom_threshold_dict['rxpowerlowwarning'] = channel_threshold_data['RxPowerLowWarning']['value'] - transceiver_dom_threshold_dict['txpowerhighalarm'] = "0.0dBm" - transceiver_dom_threshold_dict['txpowerlowalarm'] = "0.0dBm" - transceiver_dom_threshold_dict['txpowerhighwarning'] = "0.0dBm" - transceiver_dom_threshold_dict['txpowerlowwarning'] = "0.0dBm" - transceiver_dom_threshold_dict['txbiashighalarm'] = channel_threshold_data['TxBiasHighAlarm']['value'] - transceiver_dom_threshold_dict['txbiaslowalarm'] = channel_threshold_data['TxBiasLowAlarm']['value'] - transceiver_dom_threshold_dict['txbiashighwarning'] = channel_threshold_data['TxBiasHighWarning']['value'] - transceiver_dom_threshold_dict['txbiaslowwarning'] = channel_threshold_data['TxBiasLowWarning']['value'] - - for key in transceiver_dom_threshold_dict: - transceiver_dom_threshold_dict[key] = self._convert_string_to_num( - transceiver_dom_threshold_dict[key]) - - return transceiver_dom_threshold_dict - def get_reset_status(self): """ Retrieves the reset status of SFP @@ -725,8 +187,10 @@ def get_rx_los(self): rx_path = "{}{}{}{}".format(CPLD_I2C_PATH, cpld_path, '/module_rx_los_', self.port_num) rx_los=self._api_helper.read_txt_file(rx_path) - if rx_los is None: - return False + if int(rx_los, 10) == 1: + return [True] + else: + return [False] #status_control_raw = self.__read_eeprom_specific_bytes( # SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) #if status_control_raw: @@ -743,15 +207,18 @@ def get_rx_los(self): rx_los_list.append(rx_los_data & 0x02 != 0) rx_los_list.append(rx_los_data & 0x04 != 0) rx_los_list.append(rx_los_data & 0x08 != 0) - rx_los = rx_los_list[0] and rx_los_list[1] and rx_los_list[2] and rx_los_list[3] - - return rx_los + return rx_los_list + else: + return [False]*4 def get_tx_fault(self): """ Retrieves the TX fault status of SFP Returns: - A Boolean, True if SFP has TX fault, False if not + A list of boolean values, representing the TX fault status + of each available channel, value is True if SFP channel + has TX fault, False if not. + E.g., for a tranceiver with four channels: [False, False, True, False] Note : TX fault status is lached until a call to get_tx_fault or a reset. """ tx_fault = False @@ -761,8 +228,10 @@ def get_tx_fault(self): tx_path = "{}{}{}{}".format(CPLD_I2C_PATH, cpld_path, '/module_tx_fault_', self.port_num) tx_fault=self._api_helper.read_txt_file(tx_path) - if tx_fault is None: - return False + if int(tx_fault, 10) == 1: + return [True] + else: + return [False] #status_control_raw = self.__read_eeprom_specific_bytes( # SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) #if status_control_raw: @@ -778,15 +247,19 @@ def get_tx_fault(self): tx_fault_list.append(tx_fault_data & 0x02 != 0) tx_fault_list.append(tx_fault_data & 0x04 != 0) tx_fault_list.append(tx_fault_data & 0x08 != 0) - tx_fault = tx_fault_list[0] and tx_fault_list[1] and tx_fault_list[2] and tx_fault_list[3] + return tx_fault_list + else: + return [False]*4 - return tx_fault def get_tx_disable(self): """ Retrieves the tx_disable status of this SFP Returns: - A Boolean, True if tx_disable is enabled, False if disabled + A list of boolean values, representing the TX disable status + of each available channel, value is True if SFP channel + is TX disabled, False if not. + E.g., for a tranceiver with four channels: [False, False, True, False] """ if self.port_num < 49: tx_disable = False @@ -806,10 +279,11 @@ def get_tx_disable(self): # tx_disable_soft = (sffbase().test_bit( # data, SFP_TX_DISABLE_SOFT_BIT) != 0) # tx_disable = tx_disable_hard | tx_disable_soft - if tx_disable is not None: - return tx_disable + if int(tx_disable, 10)==0: + return [False] else: - return False + return [True] + else: tx_disable_list = [] @@ -829,8 +303,9 @@ def get_tx_disable(self): 'On' == dom_control_data['data']['TX3Disable']['value']) tx_disable_list.append( 'On' == dom_control_data['data']['TX4Disable']['value']) - - return tx_disable_list + return tx_disable_list + else: + return [False]*4 def get_tx_disable_channel(self): """ @@ -841,18 +316,14 @@ def get_tx_disable_channel(self): As an example, a returned value of 0x5 indicates that channel 0 and channel 2 have been disabled. """ - if self.port_num < 49: - # SFP doesn't support this feature - return False - else: - tx_disable_list = self.get_tx_disable() - if tx_disable_list is None: - return 0 - tx_disabled = 0 - for i in range(len(tx_disable_list)): - if tx_disable_list[i]: - tx_disabled |= 1 << i - return tx_disabled + tx_disable_list = self.get_tx_disable() + if tx_disable_list is None: + return 0 + tx_disabled = 0 + for i in range(len(tx_disable_list)): + if tx_disable_list[i]: + tx_disabled |= 1 << i + return tx_disabled def get_lpmode(self): """ @@ -915,78 +386,6 @@ def get_power_override(self): return power_override - def get_temperature(self): - """ - Retrieves the temperature of this SFP - Returns: - An integer number of current temperature in Celsius - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - return transceiver_dom_info_dict.get("temperature", "N/A") - - def get_voltage(self): - """ - Retrieves the supply voltage of this SFP - Returns: - An integer number of supply voltage in mV - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - return transceiver_dom_info_dict.get("voltage", "N/A") - - def get_tx_bias(self): - """ - Retrieves the TX bias current of this SFP - Returns: - A list of four integer numbers, representing TX bias in mA - for channel 0 to channel 4. - Ex. ['110.09', '111.12', '108.21', '112.09'] - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - - tx1_bs = transceiver_dom_info_dict.get("tx1bias", "N/A") - if self.port_num < 49: - return [tx1_bs, "N/A", "N/A", "N/A"] if transceiver_dom_info_dict else [] - - tx2_bs = transceiver_dom_info_dict.get("tx2bias", "N/A") - tx3_bs = transceiver_dom_info_dict.get("tx3bias", "N/A") - tx4_bs = transceiver_dom_info_dict.get("tx4bias", "N/A") - return [tx1_bs, tx2_bs, tx3_bs, tx4_bs] if transceiver_dom_info_dict else [] - - def get_rx_power(self): - """ - Retrieves the received optical power for this SFP - Returns: - A list of four integer numbers, representing received optical - power in mW for channel 0 to channel 4. - Ex. ['1.77', '1.71', '1.68', '1.70'] - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - - rx1_pw = transceiver_dom_info_dict.get("rx1power", "N/A") - if self.port_num < 49: - return [rx1_pw, "N/A", "N/A", "N/A"] if transceiver_dom_info_dict else [] - rx2_pw = transceiver_dom_info_dict.get("rx2power", "N/A") - rx3_pw = transceiver_dom_info_dict.get("rx3power", "N/A") - rx4_pw = transceiver_dom_info_dict.get("rx4power", "N/A") - return [rx1_pw, rx2_pw, rx3_pw, rx4_pw] if transceiver_dom_info_dict else [] - - def get_tx_power(self): - """ - Retrieves the TX power of this SFP - Returns: - A list of four integer numbers, representing TX power in mW - for channel 0 to channel 4. - Ex. ['1.86', '1.86', '1.86', '1.86'] - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - tx1_pw = transceiver_dom_info_dict.get("tx1power", "N/A") - if self.port_num < 49: - return [tx1_pw, "N/A", "N/A", "N/A"] if transceiver_dom_info_dict else [] - tx2_pw = transceiver_dom_info_dict.get("tx2power", "N/A") - tx3_pw = transceiver_dom_info_dict.get("tx3power", "N/A") - tx4_pw = transceiver_dom_info_dict.get("tx4power", "N/A") - return [tx1_pw, tx2_pw, tx3_pw, tx4_pw] - def reset(self): """ Reset SFP and return all user module settings to their default srate. @@ -1000,15 +399,15 @@ def reset(self): cpld_path = self._cpld_mapping[cpld_i] reset_path = "{}{}{}{}".format(CPLD_I2C_PATH, cpld_path, '/module_reset_', self.port_num) ret = self._api_helper.write_txt_file(reset_path, 1) - + if ret is not True: - time.sleep(0.01) - ret = self.self._api_helper.write_txt_file(reset_path, 0) - time.sleep(0.2) return ret - else: - return False + time.sleep(0.01) + ret = self._api_helper.write_txt_file(reset_path, 0) + time.sleep(0.2) + + return ret def tx_disable(self, tx_disable): """ @@ -1120,7 +519,7 @@ def set_lpmode(self, lpmode): if self.port_num < 49: return False # SFP doesn't support this feature else: - if lpmode is True: + if lpmode: self.set_power_override(True, True) else: self.set_power_override(False, False) @@ -1195,28 +594,27 @@ def get_presence(self): else: return False - def get_model(self): + def get_status(self): """ - Retrieves the model number (or part number) of the device + Retrieves the operational status of the device Returns: - string: Model/part number of device + A boolean value, True if device is operating properly, False if not """ - transceiver_dom_info_dict = self.get_transceiver_info() - return transceiver_dom_info_dict.get("model", "N/A") + return self.get_presence() - def get_serial(self): + def get_position_in_parent(self): """ - Retrieves the serial number of the device + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned Returns: - string: Serial number of device + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position """ - transceiver_dom_info_dict = self.get_transceiver_info() - return transceiver_dom_info_dict.get("serial", "N/A") + return self.port_num - def get_status(self): + def is_replaceable(self): """ - Retrieves the operational status of the device + Indicate whether this device is replaceable. Returns: - A boolean value, True if device is operating properly, False if not + bool: True if it is replaceable. """ - return self.get_presence() and self.get_transceiver_bulk_status() + return True diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/thermal.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/thermal.py index 46458d02a118..4d06ad170cba 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/thermal.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/thermal.py @@ -15,22 +15,53 @@ except ImportError as e: raise ImportError(str(e) + "- required module not found") +PSU_I2C_PATH = "/sys/bus/i2c/devices/{}-00{}/" +PSU_HWMON_I2C_MAPPING = { + 0: { + "num": 11, + "addr": "58" + }, + 1: { + "num": 12, + "addr": "5b" + }, +} + +PSU_CPLD_I2C_MAPPING = { + 0: { + "num": 11, + "addr": "50" + }, + 1: { + "num": 12, + "addr": "53" + }, +} + +THERMAL_NAME_LIST = ["Temp sensor 1", "Temp sensor 2", + "Temp sensor 3", "Temp sensor 4"] + +PSU_THERMAL_NAME_LIST = ["PSU-1 temp sensor 1", "PSU-2 temp sensor 2"] + +SYSFS_PATH = "/sys/bus/i2c/devices" class Thermal(ThermalBase): """Platform-specific Thermal class""" - THERMAL_NAME_LIST = [] - SYSFS_PATH = "/sys/bus/i2c/devices" - - def __init__(self, thermal_index=0): + def __init__(self, thermal_index=0, is_psu=False, psu_index=0): self.index = thermal_index - - # Add thermal name - self.THERMAL_NAME_LIST.append("Temp sensor 1") - self.THERMAL_NAME_LIST.append("Temp sensor 2") - self.THERMAL_NAME_LIST.append("Temp sensor 3") - self.THERMAL_NAME_LIST.append("Temp sensor 4") - + self.is_psu = is_psu + self.psu_index = psu_index + + if self.is_psu: + psu_i2c_bus = PSU_HWMON_I2C_MAPPING[psu_index]["num"] + psu_i2c_addr = PSU_HWMON_I2C_MAPPING[psu_index]["addr"] + self.psu_hwmon_path = PSU_I2C_PATH.format(psu_i2c_bus, + psu_i2c_addr) + psu_i2c_bus = PSU_CPLD_I2C_MAPPING[psu_index]["num"] + psu_i2c_addr = PSU_CPLD_I2C_MAPPING[psu_index]["addr"] + self.cpld_path = PSU_I2C_PATH.format(psu_i2c_bus, psu_i2c_addr) + # Set hwmon path i2c_path = { 0: "18-004b/hwmon/hwmon*/", @@ -38,9 +69,9 @@ def __init__(self, thermal_index=0): 2: "20-0049/hwmon/hwmon*/", 3: "21-004a/hwmon/hwmon*/" }.get(self.index, None) - - self.hwmon_path = "{}/{}".format(self.SYSFS_PATH, i2c_path) - self.ss_key = self.THERMAL_NAME_LIST[self.index] + + self.hwmon_path = "{}/{}".format(SYSFS_PATH, i2c_path) + self.ss_key = THERMAL_NAME_LIST[self.index] self.ss_index = 1 def __read_txt_file(self, file_path): @@ -51,20 +82,23 @@ def __read_txt_file(self, file_path): return data except IOError as e: pass - + return None - def __get_temp(self, temp_file): - temp_file_path = os.path.join(self.hwmon_path, temp_file) + if not self.is_psu: + temp_file_path = os.path.join(self.hwmon_path, temp_file) + else: + temp_file_path = temp_file raw_temp = self.__read_txt_file(temp_file_path) if raw_temp is not None: return float(raw_temp)/1000 else: - return 0 - + return 0 def __set_threshold(self, file_name, temperature): + if self.is_psu: + return True temp_file_path = os.path.join(self.hwmon_path, file_name) for filename in glob.glob(temp_file_path): try: @@ -73,6 +107,8 @@ def __set_threshold(self, file_name, temperature): return True except IOError as e: print("IOError") + return False + def get_temperature(self): @@ -82,7 +118,11 @@ def get_temperature(self): A float number of current temperature in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - temp_file = "temp{}_input".format(self.ss_index) + if not self.is_psu: + temp_file = "temp{}_input".format(self.ss_index) + else: + temp_file = self.psu_hwmon_path + "psu_temp1_input" + return self.__get_temp(temp_file) def get_high_threshold(self): @@ -92,6 +132,9 @@ def get_high_threshold(self): A float number, the high threshold temperature of thermal in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ + if self.is_psu: + return 80 + temp_file = "temp{}_max".format(self.ss_index) return self.__get_temp(temp_file) @@ -116,7 +159,10 @@ def get_name(self): Returns: string: The name of the thermal device """ - return self.THERMAL_NAME_LIST[self.index] + if self.is_psu: + return PSU_THERMAL_NAME_LIST[self.psu_index] + else: + return THERMAL_NAME_LIST[self.index] def get_presence(self): """ @@ -124,6 +170,9 @@ def get_presence(self): Returns: bool: True if Thermal is present, False if not """ + if self.is_psu: + val = self.__read_txt_file(self.cpld_path + "psu_present") + return int(val, 10) == 1 temp_file = "temp{}_input".format(self.ss_index) temp_file_path = os.path.join(self.hwmon_path, temp_file) raw_txt = self.__read_txt_file(temp_file_path) @@ -138,11 +187,49 @@ def get_status(self): Returns: A boolean value, True if device is operating properly, False if not """ + if self.is_psu: + temp_file = self.psu_hwmon_path + "psu_temp_fault" + return self.get_presence() and (not int( + self.__read_txt_file(temp_file))) file_str = "temp{}_input".format(self.ss_index) file_path = os.path.join(self.hwmon_path, file_str) raw_txt = self.__read_txt_file(file_path) if raw_txt is None: return False - else: + else: return int(raw_txt) != 0 + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + + return "N/A" + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return "N/A" + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.index+1 + + def is_replaceable(self): + """ + Retrieves whether thermal module is replaceable + Returns: + A boolean value, True if replaceable, False if not + """ + return False diff --git a/device/accton/x86_64-accton_as5835_54x-r0/system_health_monitoring_config.json b/device/accton/x86_64-accton_as5835_54x-r0/system_health_monitoring_config.json new file mode 100644 index 000000000000..5f3b3b07e73f --- /dev/null +++ b/device/accton/x86_64-accton_as5835_54x-r0/system_health_monitoring_config.json @@ -0,0 +1,15 @@ +{ + "services_to_ignore": [], + "devices_to_ignore": [ + "asic", + "psu.temperature" + + ], + "user_defined_checkers": [], + "polling_interval": 60, + "led_color": { + "fault": "STATUS_LED_COLOR_AMBER", + "normal": "STATUS_LED_COLOR_GREEN", + "booting": "STATUS_LED_COLOR_GREEN" + } +} diff --git a/device/accton/x86_64-accton_as6712_32x-r0/platform_asic b/device/accton/x86_64-accton_as6712_32x-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/accton/x86_64-accton_as6712_32x-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/accton/x86_64-accton_as7116_54x-r0/platform_asic b/device/accton/x86_64-accton_as7116_54x-r0/platform_asic new file mode 100644 index 000000000000..4211b60b9cea --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/platform_asic @@ -0,0 +1 @@ +nephos diff --git a/device/accton/x86_64-accton_as7116_54x-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as7116_54x-r0/sonic_platform/sfp.py index 2006561ffef0..6aabc144117c 100644 --- a/device/accton/x86_64-accton_as7116_54x-r0/sonic_platform/sfp.py +++ b/device/accton/x86_64-accton_as7116_54x-r0/sonic_platform/sfp.py @@ -192,7 +192,7 @@ def __init__(self, sfp_index, sfp_type): self.port_to_eeprom_mapping[p_num] = eeprom_path.format( self.port_to_i2c_mapping[p_num]) - self.info_dict_keys = ['type', 'hardware_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', + self.info_dict_keys = ['type', 'vendor_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', 'vendor_date', 'vendor_oui'] self.dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', 'power_lpmode', 'tx_disable', 'tx_disable_channel', 'temperature', 'voltage', @@ -305,7 +305,7 @@ def get_sfp_transceiver_info(self): keys |Value Format |Information ---------------------------|---------------|---------------------------- type |1*255VCHAR |type of SFP - hardware_rev |1*255VCHAR |hardware version of SFP + vendor_rev |1*255VCHAR |vendor revision of SFP serial |1*255VCHAR |serial number of the SFP manufacturer |1*255VCHAR |SFP vendor name model |1*255VCHAR |SFP model name @@ -377,7 +377,7 @@ def get_sfp_transceiver_info(self): transceiver_info_dict['manufacturer'] = sfp_vendor_name_data[ 'data']['Vendor Name']['value'] if sfp_vendor_name_data else 'N/A' transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] if sfp_vendor_pn_data else 'N/A' - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] if sfp_vendor_rev_data else 'N/A' + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] if sfp_vendor_rev_data else 'N/A' transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] if sfp_vendor_sn_data else 'N/A' transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] if sfp_vendor_oui_data else 'N/A' transceiver_info_dict['vendor_date'] = sfp_vendor_date_data[ @@ -559,7 +559,7 @@ def get_qsfp_transceiver_info(self): keys |Value Format |Information ---------------------------|---------------|---------------------------- type |1*255VCHAR |type of SFP - hardware_rev |1*255VCHAR |hardware version of SFP + vendor_rev |1*255VCHAR |hardware version of SFP serial |1*255VCHAR |serial number of the SFP manufacturer |1*255VCHAR |SFP vendor name model |1*255VCHAR |SFP model name @@ -631,7 +631,7 @@ def get_qsfp_transceiver_info(self): transceiver_info_dict['manufacturer'] = sfp_vendor_name_data[ 'data']['Vendor Name']['value'] if sfp_vendor_name_data else 'N/A' transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] if sfp_vendor_pn_data else 'N/A' - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] if sfp_vendor_rev_data else 'N/A' + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] if sfp_vendor_rev_data else 'N/A' transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] if sfp_vendor_sn_data else 'N/A' transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] if sfp_vendor_oui_data else 'N/A' transceiver_info_dict['vendor_date'] = sfp_vendor_date_data[ diff --git a/device/accton/x86_64-accton_as7212_54x-r0/platform_asic b/device/accton/x86_64-accton_as7212_54x-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/accton/x86_64-accton_as7212_54x-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/accton/x86_64-accton_as7312_54x-r0/platform_asic b/device/accton/x86_64-accton_as7312_54x-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54x-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/accton/x86_64-accton_as7312_54x-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as7312_54x-r0/sonic_platform/sfp.py index b5e38017bc90..445b39edc73d 100644 --- a/device/accton/x86_64-accton_as7312_54x-r0/sonic_platform/sfp.py +++ b/device/accton/x86_64-accton_as7312_54x-r0/sonic_platform/sfp.py @@ -205,7 +205,7 @@ def __init__(self, sfp_index=0): for x in range(self.PORT_START, self.PORT_END + 1): self.port_to_eeprom_mapping[x] = eeprom_path.format(self._port_to_i2c_mapping[x]) - self.info_dict_keys = ['type', 'hardware_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', + self.info_dict_keys = ['type', 'vendor_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', 'vendor_date', 'vendor_oui'] self.dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', 'power_lpmode', 'tx_disable', 'tx_disable_channel', 'temperature', 'voltage', @@ -300,7 +300,7 @@ def get_transceiver_info(self): keys |Value Format |Information ---------------------------|---------------|---------------------------- type |1*255VCHAR |type of SFP - hardware_rev |1*255VCHAR |hardware version of SFP + vendor_rev |1*255VCHAR |vendor revision of SFP serial |1*255VCHAR |serial number of the SFP manufacturer |1*255VCHAR |SFP vendor name model |1*255VCHAR |SFP model name @@ -385,7 +385,7 @@ def get_transceiver_info(self): transceiver_info_dict['manufacturer'] = sfp_vendor_name_data[ 'data']['Vendor Name']['value'] if sfp_vendor_name_data else 'N/A' transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] if sfp_vendor_pn_data else 'N/A' - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] if sfp_vendor_rev_data else 'N/A' + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] if sfp_vendor_rev_data else 'N/A' transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] if sfp_vendor_sn_data else 'N/A' transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] if sfp_vendor_oui_data else 'N/A' transceiver_info_dict['vendor_date'] = sfp_vendor_date_data[ diff --git a/device/accton/x86_64-accton_as7312_54xs-r0/platform_asic b/device/accton/x86_64-accton_as7312_54xs-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/accton/x86_64-accton_as7312_54xs-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/accton/x86_64-accton_as7315_27xb-r0/installer.conf b/device/accton/x86_64-accton_as7315_27xb-r0/installer.conf index 9fa12f888545..f7358371b583 100644 --- a/device/accton/x86_64-accton_as7315_27xb-r0/installer.conf +++ b/device/accton/x86_64-accton_as7315_27xb-r0/installer.conf @@ -1,2 +1,2 @@ CONSOLE_SPEED=115200 -ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="tg3.short_preamble=1 tg3.bcm5718s_reset=1" +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="tg3.short_preamble=1 tg3.bcm5718s_reset=1 intel_iommu=off modprobe.blacklist=i2c-ismt,i2c_ismt,i2c-i801,i2c_i801" diff --git a/device/accton/x86_64-accton_as7315_27xb-r0/platform_asic b/device/accton/x86_64-accton_as7315_27xb-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/accton/x86_64-accton_as7315_27xb-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/accton/x86_64-accton_as7326_56x-r0/Accton-AS7326-56X/td3-as7326-48x25G+8x100G.config.bcm b/device/accton/x86_64-accton_as7326_56x-r0/Accton-AS7326-56X/td3-as7326-48x25G+8x100G.config.bcm index 5da8cd015da1..21ca8a2fa576 100755 --- a/device/accton/x86_64-accton_as7326_56x-r0/Accton-AS7326-56X/td3-as7326-48x25G+8x100G.config.bcm +++ b/device/accton/x86_64-accton_as7326_56x-r0/Accton-AS7326-56X/td3-as7326-48x25G+8x100G.config.bcm @@ -1,4 +1,4 @@ -sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_issu/b870.6.4.1/ +sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ #polarity/lanemap is using TH2 style. core_clock_frequency=1525 dpp_clock_ratio=2:3 diff --git a/device/accton/x86_64-accton_as7326_56x-r0/pddf/pddf-device.json b/device/accton/x86_64-accton_as7326_56x-r0/pddf/pddf-device.json index 301e1663bff3..a8bd6d0c4043 100644 --- a/device/accton/x86_64-accton_as7326_56x-r0/pddf/pddf-device.json +++ b/device/accton/x86_64-accton_as7326_56x-r0/pddf/pddf-device.json @@ -32,7 +32,7 @@ [ "i2c-i801", "i2c_dev", - "i2c_mux_pca954x force_deselect_on_exit=1", + "i2c_mux_pca954x", "optoe" ], "pddf_kos": @@ -49,6 +49,10 @@ "pddf_fan_module", "pddf_led_module", "pddf_sysstatus_module" + ], + "custom_kos": + [ + "pddf_custom_psu" ] }, @@ -108,7 +112,7 @@ "i2c": { "topo_info": { "parent_bus":"0x0", "dev_addr":"0x77", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x1"}, + "dev_attr": { "virt_bus":"0x1", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"MUX2" }, @@ -124,7 +128,7 @@ "i2c": { "topo_info": { "parent_bus":"0x1", "dev_addr":"0x70", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x9"}, + "dev_attr": { "virt_bus":"0x9", "idle_state":"-2"}, "channel": [ { "chn":"2", "dev":"FAN-CTRL" }, @@ -143,7 +147,7 @@ "i2c": { "topo_info": { "parent_bus":"0x1", "dev_addr":"0x71", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x11"}, + "dev_attr": { "virt_bus":"0x11", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"PSU1" }, @@ -161,7 +165,7 @@ "i2c": { "topo_info": { "parent_bus":"0x2", "dev_addr":"0x70", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x21"}, + "dev_attr": { "virt_bus":"0x21", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"MUX5" }, @@ -181,7 +185,8 @@ { "interface": [ - { "itf":"pmbus", "dev":"PSU2-PMBUS"} + { "itf":"pmbus", "dev":"PSU2-PMBUS"}, + { "itf":"eeprom", "dev":"PSU2-EEPROM" } ] } }, @@ -195,10 +200,8 @@ "attr_list": [ { "attr_name":"psu_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"psu_model_name", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, { "attr_name":"psu_power_good", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x4", "attr_cmpval":"0x4", "attr_len":"1"}, { "attr_name":"psu_mfr_id", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, - { "attr_name":"psu_serial_num", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x9e", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"20" }, { "attr_name":"psu_fan_dir", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"}, { "attr_name":"psu_v_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_i_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, @@ -208,7 +211,21 @@ ] } }, - + + "PSU2-EEPROM": + { + "dev_info": { "device_type":"PSU-EEPROM", "device_name":"PSU2-EEPROM", "device_parent":"MUX2", "virt_parent":"PSU2"}, + "i2c": + { + "topo_info":{ "parent_bus":"0xd", "dev_addr":"0x53", "dev_type":"psu_eeprom"}, + "attr_list": + [ + { "attr_name":"psu_model_name", "attr_devaddr":"0x53", "attr_devtype":"eeprom", "attr_offset":"0x15", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"11" }, + { "attr_name":"psu_serial_num", "attr_devaddr":"0x53", "attr_devtype":"eeprom", "attr_offset":"0x2e", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"17" } + + ] + } + }, "PSU1": { "dev_info": { "device_type":"PSU", "device_name":"PSU1", "device_parent":"MUX3" }, @@ -217,7 +234,8 @@ { "interface": [ - { "itf":"pmbus", "dev":"PSU1-PMBUS"} + { "itf":"pmbus", "dev":"PSU1-PMBUS"}, + { "itf":"eeprom", "dev":"PSU1-EEPROM" } ] } }, @@ -230,11 +248,9 @@ "topo_info": { "parent_bus":"0x11", "dev_addr":"0x59", "dev_type":"psu_pmbus"}, "attr_list": [ - { "attr_name":"psu_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"psu_model_name", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, + { "attr_name":"psu_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, { "attr_name":"psu_power_good", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x8", "attr_cmpval":"0x8", "attr_len":"1"}, { "attr_name":"psu_mfr_id", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, - { "attr_name":"psu_serial_num", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x9e", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"20" }, { "attr_name":"psu_fan_dir", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"}, { "attr_name":"psu_v_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_i_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, @@ -244,7 +260,19 @@ ] } }, - + "PSU1-EEPROM": + { + "dev_info": { "device_type":"PSU-EEPROM", "device_name":"PSU1-EEPROM", "device_parent":"MUX2", "virt_parent":"PSU1"}, + "i2c": + { + "topo_info":{ "parent_bus":"0x11", "dev_addr":"0x51", "dev_type":"psu_eeprom"}, + "attr_list": + [ + { "attr_name":"psu_model_name", "attr_devaddr":"0x51", "attr_devtype":"eeprom", "attr_offset":"0x15", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"11" }, + { "attr_name":"psu_serial_num", "attr_devaddr":"0x51", "attr_devtype":"eeprom", "attr_offset":"0x2e", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"17" } + ] + } + }, "CPLD1": { "dev_info": { "device_type":"CPLD", "device_name":"CPLD1", "device_parent":"MUX3"}, @@ -474,7 +502,7 @@ "i2c": { "topo_info": { "parent_bus":"0x21", "dev_addr":"0x71", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x29"}, + "dev_attr": { "virt_bus":"0x29", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"PORT2" }, @@ -494,7 +522,7 @@ "i2c": { "topo_info": { "parent_bus":"0x22", "dev_addr":"0x72", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x31"}, + "dev_attr": { "virt_bus":"0x31", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"PORT10" }, @@ -514,7 +542,7 @@ "i2c": { "topo_info": { "parent_bus":"0x23", "dev_addr":"0x73", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x39"}, + "dev_attr": { "virt_bus":"0x39", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"PORT18" }, @@ -534,7 +562,7 @@ "i2c": { "topo_info": { "parent_bus":"0x24", "dev_addr":"0x74", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x41"}, + "dev_attr": { "virt_bus":"0x41", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"PORT27" }, @@ -554,7 +582,7 @@ "i2c": { "topo_info": { "parent_bus":"0x25", "dev_addr":"0x75", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x49"}, + "dev_attr": { "virt_bus":"0x49", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"PORT34" }, @@ -574,7 +602,7 @@ "i2c": { "topo_info": { "parent_bus":"0x26", "dev_addr":"0x76", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x51"}, + "dev_attr": { "virt_bus":"0x51", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"PORT41" }, @@ -594,7 +622,7 @@ "i2c": { "topo_info": { "parent_bus":"0x18", "dev_addr":"0x72", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x19"}, + "dev_attr": { "virt_bus":"0x19", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"PORT49" }, @@ -887,7 +915,7 @@ { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xF", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x3", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x7", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_offset":"0xB", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"} + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0xB", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"} ] } }, @@ -927,7 +955,7 @@ { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x10", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x4", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld","attr_devname":"CPLD2", "attr_offset":"0x8", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_offset":"0xC", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"} + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0xC", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"} ] } }, @@ -2381,10 +2409,10 @@ "topo_info": { "parent_bus":"0x54", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, "attr_list": [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x11", "attr_devname":"CPLD1", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1B","attr_devname":"CPLD1", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x15", "attr_devname":"CPLD1", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x18", "attr_devname":"CPLD1","attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"} + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x11", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1B", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x15", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x18", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"} ] } }, @@ -2421,10 +2449,10 @@ "topo_info": { "parent_bus":"0x55", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, "attr_list": [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_devname":"CPLD1", "attr_offset":"0x11", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_devname":"CPLD1", "attr_offset":"0x1B", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld","attr_devname":"CPLD1", "attr_devname":"CPLD1", "attr_offset":"0x15", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_devname":"CPLD1", "attr_offset":"0x18", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"} + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x11", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1B", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld","attr_devname":"CPLD1","attr_offset":"0x15", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x18", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"} ] } }, @@ -2461,10 +2489,10 @@ "topo_info": { "parent_bus":"0x56", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, "attr_list": [ - { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld","attr_devname":"CPLD1", "attr_devname":"CPLD1", "attr_offset":"0x12", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_devname":"CPLD1","attr_offset":"0x1C", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, - { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld","attr_devname":"CPLD1", "attr_devname":"CPLD1", "attr_offset":"0x16", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, - { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_devname":"CPLD1", "attr_offset":"0x19", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"} + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld","attr_devname":"CPLD1", "attr_offset":"0x12", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x1C", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x60", "attr_devtype":"cpld","attr_devname":"CPLD1", "attr_offset":"0x16", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x19", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"} ] } }, diff --git a/device/accton/x86_64-accton_as7326_56x-r0/platform_asic b/device/accton/x86_64-accton_as7326_56x-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/accton/x86_64-accton_as7326_56x-r0/plugins/eeprom.py b/device/accton/x86_64-accton_as7326_56x-r0/plugins/eeprom.py index 4241483d68eb..8139f856f973 100644 --- a/device/accton/x86_64-accton_as7326_56x-r0/plugins/eeprom.py +++ b/device/accton/x86_64-accton_as7326_56x-r0/plugins/eeprom.py @@ -16,5 +16,10 @@ class board(eeprom_tlvinfo.TlvInfoDecoder): _TLV_INFO_MAX_LEN = 256 def __init__(self, name, path, cpld_root, ro): - self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + exists = os.path.isfile('/sys/bus/i2c/devices/0-0056/eeprom') + if (exists is True): + self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + else: + self.eeprom_path = "/sys/bus/i2c/devices/0-0057/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/accton/x86_64-accton_as7326_56x-r0/pmon_daemon_control.json b/device/accton/x86_64-accton_as7326_56x-r0/pmon_daemon_control.json index 584a14b9d942..a3b204e20d8d 100644 --- a/device/accton/x86_64-accton_as7326_56x-r0/pmon_daemon_control.json +++ b/device/accton/x86_64-accton_as7326_56x-r0/pmon_daemon_control.json @@ -1,5 +1,5 @@ { "skip_ledd": true, - "skip_thermalctld": true + "skip_pcied": true } diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/__init__.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/__init__.py new file mode 100644 index 000000000000..73a7720e8979 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/__init__.py @@ -0,0 +1,2 @@ +__all__ = [ "platform", "chassis", "sfp", "eeprom", "component", "psu", "thermal", "fan", "fan_drawer" ] +from . import platform diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/chassis.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/chassis.py new file mode 100644 index 000000000000..f32f381b7c21 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/chassis.py @@ -0,0 +1,264 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Chassis information which are available in the platform +# +############################################################################# + +import os +import sys + +try: + from sonic_platform_base.chassis_base import ChassisBase + from .event import SfpEvent + from sonic_py_common import device_info + +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +NUM_FAN_TRAY = 6 +NUM_PSU = 2 +NUM_THERMAL = 4 +NUM_PORT = 58 +NUM_COMPONENT = 4 + +HOST_REBOOT_CAUSE_PATH = "/host/reboot-cause/" +PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" +REBOOT_CAUSE_FILE = "reboot-cause.txt" +PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" +HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" +SYSLED_FNODE= "/sys/class/leds/accton_as7326_56x_led::diag/brightness" +SYSLED_MODES = { + "0" : "STATUS_LED_COLOR_OFF", + "1" : "STATUS_LED_COLOR_GREEN", + "3" : "STATUS_LED_COLOR_RED", + "5" : "STATUS_LED_COLOR_GREEN_BLINK" +} + + +class Chassis(ChassisBase): + """Platform-specific Chassis class""" + + def __init__(self): + ChassisBase.__init__(self) + self.config_data = {} + (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() + + self.__initialize_fan() + self.__initialize_psu() + self.__initialize_thermals() + self.__initialize_components() + self.__initialize_sfp() + self.__initialize_eeprom() + + def __initialize_sfp(self): + from sonic_platform.sfp import Sfp + for index in range(NUM_PORT): + sfp = Sfp(index) + self._sfp_list.append(sfp) + self._sfpevent = SfpEvent(self._sfp_list) + self.sfp_module_initialized = True + + def __initialize_fan(self): + from sonic_platform.fan_drawer import FanDrawer + for fant_index in range(NUM_FAN_TRAY): + fandrawer = FanDrawer(fant_index) + self._fan_drawer_list.append(fandrawer) + self._fan_list.extend(fandrawer._fan_list) + + def __initialize_psu(self): + from sonic_platform.psu import Psu + for index in range(NUM_PSU): + psu = Psu(index) + self._psu_list.append(psu) + + def __initialize_thermals(self): + from sonic_platform.thermal import Thermal + for index in range(NUM_THERMAL): + thermal = Thermal(index) + self._thermal_list.append(thermal) + + def __initialize_eeprom(self): + from sonic_platform.eeprom import Tlv + self._eeprom = Tlv() + + def __initialize_components(self): + from sonic_platform.component import Component + for index in range(NUM_COMPONENT): + component = Component(index) + self._component_list.append(component) + + def __initialize_watchdog(self): + self._watchdog = Watchdog() + + def __is_host(self): + return os.system(HOST_CHK_CMD) == 0 + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + return fd.read().strip() + except IOError: + pass + return None + + def __write_txt_file(self, file_path, value): + try: + with open(file_path, 'w') as fd: + fd.write(str(value)) + except Exception: + return False + return True + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + return self._eeprom.get_product_name() + + def get_presence(self): + """ + Retrieves the presence of the Chassis + Returns: + bool: True if Chassis is present, False if not + """ + return True + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return True + def get_base_mac(self): + """ + Retrieves the base MAC address for the chassis + Returns: + A string containing the MAC address in the format + 'XX:XX:XX:XX:XX:XX' + """ + return self._eeprom.get_mac() + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return self._eeprom.get_pn() + + def get_serial(self): + """ + Retrieves the hardware serial number for the chassis + Returns: + A string containing the hardware serial number for this chassis. + """ + return self._eeprom.get_serial() + + def get_system_eeprom_info(self): + """ + Retrieves the full content of system EEPROM information for the chassis + Returns: + A dictionary where keys are the type code defined in + OCP ONIE TlvInfo EEPROM format and values are their corresponding + values. + """ + return self._eeprom.get_eeprom() + + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + Returns: + A tuple (string, string) where the first element is a string + containing the cause of the previous reboot. This string must be + one of the predefined strings in this class. If the first string + is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used + to pass a description of the reboot cause. + """ + description = 'None' + + reboot_cause_path = (HOST_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE) if self.__is_host( + ) else (PMON_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE) + prev_reboot_cause_path = (HOST_REBOOT_CAUSE_PATH + PREV_REBOOT_CAUSE_FILE) if self.__is_host( + ) else (PMON_REBOOT_CAUSE_PATH + PREV_REBOOT_CAUSE_FILE) + + sw_reboot_cause = self.__read_txt_file(reboot_cause_path) or "Unknown" + prev_sw_reboot_cause = self.__read_txt_file(prev_reboot_cause_path) or "Unknown" + + if sw_reboot_cause != "Unknown": + reboot_cause = self.REBOOT_CAUSE_NON_HARDWARE + description = sw_reboot_cause + elif prev_reboot_cause_path != "Unknown": + reboot_cause = self.REBOOT_CAUSE_NON_HARDWARE + description = prev_sw_reboot_cause + + return (reboot_cause, description) + + def get_change_event(self, timeout=0): + # SFP event + if not self.sfp_module_initialized: + self.__initialize_sfp() + return self._sfpevent.get_sfp_event(timeout) + + def get_sfp(self, index): + """ + Retrieves sfp represented by (1-based) index + Args: + index: An integer, the index (1-based) of the sfp to retrieve. + The index should be the sequence of a physical port in a chassis, + starting from 1. + For example, 1 for Ethernet0, 2 for Ethernet4 and so on. + Returns: + An object dervied from SfpBase representing the specified sfp + """ + sfp = None + if not self.sfp_module_initialized: + self.__initialize_sfp() + + try: + # The index will start from 1 + sfp = self._sfp_list[index-1] + except IndexError: + sys.stderr.write("SFP index {} out of range (1-{})\n".format( + index, len(self._sfp_list))) + return sfp + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False + + + def initizalize_system_led(self): + return True + + def get_status_led(self): + val = self.__read_txt_file(SYSLED_FNODE) + return SYSLED_MODES[val] if val in SYSLED_MODES else "UNKNOWN" + + def set_status_led(self, color): + mode = None + for key, val in SYSLED_MODES.items(): + if val == color: + mode = key + break + if mode is None: + return False + else: + return self.__write_txt_file(SYSLED_FNODE, mode) diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/component.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/component.py new file mode 100644 index 000000000000..75c2d3b918d4 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/component.py @@ -0,0 +1,161 @@ +############################################################################# +# Edgecore +# +# Component contains an implementation of SONiC Platform Base API and +# provides the components firmware management function +# +############################################################################# + +try: + from sonic_platform_base.component_base import ComponentBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CPLD_ADDR_MAPPING = { + "CPLD-1": "18-0060", + "CPLD-2": "12-0062", + "CPLD-3": "19-0064", +} +SYSFS_PATH = "/sys/bus/i2c/devices/" +BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version" +COMPONENT_NAME_LIST = ["CPLD-1", "CPLD-2", "CPLD-3", "BIOS"] +COMPONENT_DES_LIST = [ + "CPLD-1", "CPLD-2", "CPLD-3", "Basic Input/Output System" +] + + +class Component(ComponentBase): + """Platform-specific Component class""" + + DEVICE_TYPE = "component" + + def __init__(self, component_index=0): + ComponentBase.__init__(self) + self.index = component_index + self.name = self.get_name() + + def __get_bios_version(self): + # Retrieves the BIOS firmware version + try: + with open(BIOS_VERSION_PATH, 'r') as fd: + bios_version = fd.read() + return bios_version.strip() + except Exception as e: + return None + + def __get_sysfs_value(self, addr, name): + # Retrieves the cpld register value + try: + with open(SYSFS_PATH + addr + '/' + name, 'r') as fd: + return fd.read().strip() + except Exception as e: + return None + + def __get_cpld_version(self): + # Retrieves the CPLD firmware version + cpld_version = dict() + for cpld_name in CPLD_ADDR_MAPPING: + try: + cpld_addr = CPLD_ADDR_MAPPING[cpld_name] + cpld_version_raw = self.__get_sysfs_value(cpld_addr, "version") + cpld_version[cpld_name] = "{}".format( + int(cpld_version_raw, 16)) + except Exception as e: + cpld_version[cpld_name] = 'None' + + return cpld_version + + def get_name(self): + """ + Retrieves the name of the component + Returns: + A string containing the name of the component + """ + return COMPONENT_NAME_LIST[self.index] + + def get_description(self): + """ + Retrieves the description of the component + Returns: + A string containing the description of the component + """ + return COMPONENT_DES_LIST[self.index] + + def get_firmware_version(self): + """ + Retrieves the firmware version of module + Returns: + string: The firmware versions of the module + """ + fw_version = None + + if self.name == "BIOS": + fw_version = self.__get_bios_version() + elif "CPLD" in self.name: + cpld_version = self.__get_cpld_version() + fw_version = cpld_version.get(self.name) + + return fw_version + + def install_firmware(self, image_path): + """ + Install firmware to module + Args: + image_path: A string, path to firmware image + Returns: + A boolean, True if install successfully, False if not + """ + raise NotImplementedError + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return 'N/A' + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return 'N/A' + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return True + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False + diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/eeprom.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/eeprom.py new file mode 100644 index 000000000000..d0bffe53a279 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/eeprom.py @@ -0,0 +1,139 @@ +try: + import os + import sys + import re + from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo + if sys.version_info[0] >= 3: + from io import StringIO + else: + from cStringIO import StringIO +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CACHE_ROOT = '/var/cache/sonic/decode-syseeprom' +CACHE_FILE = 'syseeprom_cache' +NULL = 'N/A' + +class Tlv(eeprom_tlvinfo.TlvInfoDecoder): + + EEPROM_DECODE_HEADLINES = 6 + + def __init__(self): + #self._eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + exists = os.path.isfile('/sys/bus/i2c/devices/0-0056/eeprom') + if (exists is True): + self._eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + else: + self._eeprom_path = "/sys/bus/i2c/devices/0-0057/eeprom" + + super(Tlv, self).__init__(self._eeprom_path, 0, '', True) + self._eeprom = self._load_eeprom() + + def __parse_output(self, decode_output): + decode_output.replace('\0', '') + lines = decode_output.split('\n') + lines = lines[self.EEPROM_DECODE_HEADLINES:] + _eeprom_info_dict = dict() + + for line in lines: + try: + match = re.search('(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)([\S]+)', + line) + if match is not None: + idx = match.group(1) + value = match.group(3).rstrip('\0') + + _eeprom_info_dict[idx] = value + except Exception: + pass + + return _eeprom_info_dict + + def _load_eeprom(self): + original_stdout = sys.stdout + sys.stdout = StringIO() + try: + self.read_eeprom_db() + except Exception: + decode_output = sys.stdout.getvalue() + sys.stdout = original_stdout + return self.__parse_output(decode_output) + + status = self.check_status() + if 'ok' not in status: + return False + + if not os.path.exists(CACHE_ROOT): + try: + os.makedirs(CACHE_ROOT) + except Exception: + pass + + # + # only the eeprom classes that inherit from eeprom_base + # support caching. Others will work normally + # + try: + self.set_cache_name(os.path.join(CACHE_ROOT, CACHE_FILE)) + except Exception: + pass + + e = self.read_eeprom() + if e is None: + return 0 + + try: + self.update_cache(e) + except Exception: + pass + + self.decode_eeprom(e) + decode_output = sys.stdout.getvalue() + sys.stdout = original_stdout + + (is_valid, valid_crc) = self.is_checksum_valid(e) + if not is_valid: + return False + + return self.__parse_output(decode_output) + + def _valid_tlv(self, eeprom_data): + tlvinfo_type_codes_list = [ + self._TLV_CODE_PRODUCT_NAME, + self._TLV_CODE_PART_NUMBER, + self._TLV_CODE_SERIAL_NUMBER, + self._TLV_CODE_MAC_BASE, + self._TLV_CODE_MANUF_DATE, + self._TLV_CODE_DEVICE_VERSION, + self._TLV_CODE_LABEL_REVISION, + self._TLV_CODE_PLATFORM_NAME, + self._TLV_CODE_ONIE_VERSION, + self._TLV_CODE_MAC_SIZE, + self._TLV_CODE_MANUF_NAME, + self._TLV_CODE_MANUF_COUNTRY, + self._TLV_CODE_VENDOR_NAME, + self._TLV_CODE_DIAG_VERSION, + self._TLV_CODE_SERVICE_TAG, + self._TLV_CODE_VENDOR_EXT, + self._TLV_CODE_CRC_32 + ] + + for code in tlvinfo_type_codes_list: + code_str = "0x{:X}".format(code) + eeprom_data[code_str] = eeprom_data.get(code_str, NULL) + return eeprom_data + + def get_eeprom(self): + return self._valid_tlv(self._eeprom) + + def get_pn(self): + return self._eeprom.get('0x22', NULL) + + def get_serial(self): + return self._eeprom.get('0x23', NULL) + + def get_mac(self): + return self._eeprom.get('0x24', NULL) + + def get_product_name(self): + return self._eeprom.get('0x21', NULL) diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/event.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/event.py new file mode 100644 index 000000000000..3d6f81518a26 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/event.py @@ -0,0 +1,60 @@ +try: + import time + from sonic_py_common.logger import Logger +except ImportError as e: + raise ImportError(repr(e) + " - required module not found") + +POLL_INTERVAL_IN_SEC = 1 + +class SfpEvent: + ''' Listen to insert/remove sfp events ''' + + def __init__(self, sfp_list): + self._sfp_list = sfp_list + self._logger = Logger() + self._sfp_change_event_data = {'present': 0} + + def get_presence_bitmap(self): + bitmap = 0 + for sfp in self._sfp_list: + modpres = sfp.get_presence() + i=sfp.port_num-1 + if modpres: + bitmap = bitmap | (1 << i) + return bitmap + + def get_sfp_event(self, timeout=2000): + port_dict = {} + change_dict = {} + change_dict['sfp'] = port_dict + + if timeout < 1000: + cd_ms = 1000 + else: + cd_ms = timeout + + while cd_ms > 0: + bitmap = self.get_presence_bitmap() + changed_ports = self._sfp_change_event_data['present'] ^ bitmap + if changed_ports != 0: + break + time.sleep(POLL_INTERVAL_IN_SEC) + # timeout=0 means wait for event forever + if timeout != 0: + cd_ms = cd_ms - POLL_INTERVAL_IN_SEC * 1000 + + if changed_ports != 0: + for sfp in self._sfp_list: + i=sfp.port_num-1 + if (changed_ports & (1 << i)): + if (bitmap & (1 << i)) == 0: + port_dict[i+1] = '0' + else: + port_dict[i+1] = '1' + + + # Update the cache dict + self._sfp_change_event_data['present'] = bitmap + return True, change_dict + else: + return True, change_dict diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/fan.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/fan.py new file mode 100644 index 000000000000..c64d953b758b --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/fan.py @@ -0,0 +1,270 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the fan status which are available in the platform +# +############################################################################# + +try: + from sonic_platform_base.fan_base import FanBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +FAN_MAX_RPM = 25500 +PSU_FAN_MAX_RPM = 25500 +SPEED_TOLERANCE = 15 +CPLD_I2C_PATH = "/sys/bus/i2c/devices/11-0066/fan" +PSU_I2C_PATH = "/sys/bus/i2c/devices/{}-00{}/" +PSU_HWMON_I2C_MAPPING = { + 0: { + "bus": 17, + "addr": "59" + }, + 1: { + "bus": 13, + "addr": "5b" + }, +} + +PSU_CPLD_I2C_MAPPING = { + 0: { + "bus": 17, + "addr": "51" + }, + 1: { + "bus": 13, + "addr": "53" + }, +} + +FAN_NAME_LIST = ["FAN-1F", "FAN-1R", "FAN-2F", "FAN-2R", + "FAN-3F", "FAN-3R", "FAN-4F", "FAN-4R", + "FAN-5F", "FAN-5R", "FAN-6F", "FAN-6R"] + +class Fan(FanBase): + """Platform-specific Fan class""" + + def __init__(self, + fan_tray_index, + fan_index=0, + is_psu_fan=False, + psu_index=0): + self.fan_index = fan_index + self.fan_tray_index = fan_tray_index + self.is_psu_fan = is_psu_fan + self.psu_index = psu_index + + if self.is_psu_fan: + psu_i2c_bus = PSU_HWMON_I2C_MAPPING[psu_index]["bus"] + psu_i2c_addr = PSU_HWMON_I2C_MAPPING[psu_index]["addr"] + self.psu_hwmon_path = PSU_I2C_PATH.format(psu_i2c_bus, + psu_i2c_addr) + psu_i2c_bus = PSU_CPLD_I2C_MAPPING[psu_index]["bus"] + psu_i2c_addr = PSU_CPLD_I2C_MAPPING[psu_index]["addr"] + self.cpld_path = PSU_I2C_PATH.format(psu_i2c_bus, psu_i2c_addr) + + FanBase.__init__(self) + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + return fd.read().strip() + except IOError: + pass + return "" + + def __write_txt_file(self, file_path, value): + try: + with open(file_path, 'w') as fd: + fd.write(str(value)) + except Exception: + return False + return True + + def get_direction(self): + """ + Retrieves the direction of fan + Returns: + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + """ + if not self.is_psu_fan: + val = self.__read_txt_file( + CPLD_I2C_PATH + str(self.fan_tray_index+1) + "_direction") + direction = self.FAN_DIRECTION_EXHAUST if ( + val == "0") else self.FAN_DIRECTION_INTAKE + else: + val = self.__read_txt_file(self.psu_hwmon_path + "psu_fan_dir") + direction = self.FAN_DIRECTION_EXHAUST if ( + val == "F2B") else self.FAN_DIRECTION_INTAKE + return direction + + def get_speed(self): + """ + Retrieves the speed of fan as a percentage of full speed + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + """ + speed = 0 + if self.is_psu_fan: + speed = self.__read_txt_file( + self.psu_hwmon_path + "psu_fan1_speed_rpm") + speed = (int(speed, 10)) * 100 / PSU_FAN_MAX_RPM + speed = 100 if (speed > 100) else speed + elif self.get_presence(): + speed = self.__read_txt_file(CPLD_I2C_PATH + str( + self.fan_index * 10 + self.fan_tray_index + 1) + "_input") + speed = (int(speed, 10)) * 100 / FAN_MAX_RPM + speed = 100 if (speed > 100) else speed + return int(speed) + + def get_target_speed(self): + """ + Retrieves the target (expected) speed of the fan + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + Note: + speed_pc = pwm_target/255*100 + 0 : when PWM mode is use + pwm : when pwm mode is not use + """ + return self.get_speed() + + def get_speed_tolerance(self): + """ + Retrieves the speed tolerance of the fan + Returns: + An integer, the percentage of variance from target speed which is + considered tolerable + """ + return SPEED_TOLERANCE + + def set_speed(self, speed): + """ + Sets the fan speed + Args: + speed: An integer, the percentage of full fan speed to set fan to, + in the range 0 (off) to 100 (full speed) + Returns: + A boolean, True if speed is set successfully, False if not + """ + + if not self.is_psu_fan and self.get_presence(): + return self.__write_txt_file( + CPLD_I2C_PATH + "_duty_cycle_percentage", int(speed)) + + return False + + def set_status_led(self, color): + """ + Sets the state of the fan module status LED + Args: + color: A string representing the color with which to set the + fan module status LED + Returns: + bool: True if status LED state is set successfully, False if not + """ + return False #Not supported + + def get_status_led(self): + """ + Gets the state of the fan status LED + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + status=self.get_presence() + if status is None: + return self.STATUS_LED_COLOR_OFF + + return { + 1: self.STATUS_LED_COLOR_GREEN, + 0: self.STATUS_LED_COLOR_RED + }.get(status, self.STATUS_LED_COLOR_OFF) + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + fan_name = FAN_NAME_LIST[self.fan_tray_index*2 + self.fan_index] \ + if not self.is_psu_fan \ + else "PSU-{} FAN-{}".format(self.psu_index+1, self.fan_index+1) + + return fan_name + + def get_presence(self): + """ + Retrieves the presence of the PSU + Returns: + bool: True if PSU is present, False if not + """ + if self.is_psu_fan: + val = self.__read_txt_file(self.cpld_path + "psu_present") + return int(val, 10) == 1 + + val = self.__read_txt_file( + CPLD_I2C_PATH + str(self.fan_tray_index + 1) + "_present") + return int(val, 10)==1 + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + if self.is_psu_fan: + psu_fan_path= "{}{}".format(self.psu_hwmon_path, 'psu_fan1_fault') + val=self.__read_txt_file(psu_fan_path) + if val is not None: + return int(val, 10)==0 + else: + return False + else: + path = "{}{}{}".format(CPLD_I2C_PATH, self.fan_tray_index+1, '_fault') + val=self.__read_txt_file(path) + if val is not None: + return int(val, 10)==0 + else: + return False + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + + return "N/A" + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return "N/A" + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return (self.fan_index+1) \ + if not self.is_psu_fan else (self.psu_index+1) + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True if not self.is_psu_fan else False diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/fan_drawer.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..e21163c106c1 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/fan_drawer.py @@ -0,0 +1,90 @@ +######################################################################## +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Fan-Drawers' information available in the platform. +# +######################################################################## + +try: + from sonic_platform_base.fan_drawer_base import FanDrawerBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +FANS_PER_FANTRAY = 2 + + +class FanDrawer(FanDrawerBase): + """Platform-specific Fan class""" + + def __init__(self, fantray_index): + + FanDrawerBase.__init__(self) + # FanTray is 0-based in platforms + self.fantrayindex = fantray_index + self.__initialize_fan_drawer() + + + def __initialize_fan_drawer(self): + from sonic_platform.fan import Fan + for i in range(FANS_PER_FANTRAY): + self._fan_list.append(Fan(self.fantrayindex, i)) + + def get_name(self): + """ + Retrieves the fan drawer name + Returns: + string: The name of the device + """ + return "FanTray{}".format(self.fantrayindex+1) + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + return self._fan_list[0].get_presence() + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return self._fan_list[0].get_model() + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return self._fan_list[0].get_serial() + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return self._fan_list[0].get_status() + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return (self.fantrayindex+1) + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/platform.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/platform.py new file mode 100644 index 000000000000..2f2c2a447fcf --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/platform.py @@ -0,0 +1,21 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + +try: + from sonic_platform_base.platform_base import PlatformBase + from sonic_platform.chassis import Chassis +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PlatformBase): + """Platform-specific Platform class""" + + def __init__(self): + PlatformBase.__init__(self) + self._chassis = Chassis() diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/psu.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/psu.py new file mode 100644 index 000000000000..44566aba1f3c --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/psu.py @@ -0,0 +1,264 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +#import sonic_platform + +try: + from sonic_platform_base.psu_base import PsuBase + from sonic_platform.thermal import Thermal +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +I2C_PATH = "/sys/bus/i2c/devices/{}-00{}/" + +PSU_NAME_LIST = ["PSU-1", "PSU-2"] +PSU_NUM_FAN = [1, 1] +PSU_HWMON_I2C_MAPPING = { + 0: { + "bus": 17, + "addr": "59" + }, + 1: { + "bus": 13, + "addr": "5b" + }, +} + +PSU_CPLD_I2C_MAPPING = { + 0: { + "bus": 17, + "addr": "51" + }, + 1: { + "bus": 13, + "addr": "53" + }, +} + +NUM_FAN_TRAY = 6 + + +class Psu(PsuBase): + """Platform-specific Psu class""" + + def __init__(self, psu_index=0): + PsuBase.__init__(self) + self.index = psu_index + + bus = PSU_HWMON_I2C_MAPPING[self.index]["bus"] + addr = PSU_HWMON_I2C_MAPPING[self.index]["addr"] + self.hwmon_path = I2C_PATH.format(bus, addr) + + bus = PSU_CPLD_I2C_MAPPING[self.index]["bus"] + addr = PSU_CPLD_I2C_MAPPING[self.index]["addr"] + self.cpld_path = I2C_PATH.format(bus, addr) + self.__initialize_fan() + + def __initialize_fan(self): + from sonic_platform.fan import Fan + self._fan_list.append( + Fan(NUM_FAN_TRAY + self.index, + is_psu_fan=True, + psu_index=self.index)) + self._thermal_list.append(Thermal(is_psu=True, psu_index=self.index)) + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + return fd.read().strip() + except IOError: + pass + return None + + def get_voltage(self): + """ + Retrieves current PSU voltage output + Returns: + A float number, the output voltage in volts, + e.g. 12.1 + """ + val = self.__read_txt_file(self.hwmon_path + "psu_v_out") + if val is not None: + return float(val)/ 1000 + else: + return 0 + + def get_current(self): + """ + Retrieves present electric current supplied by PSU + Returns: + A float number, the electric current in amperes, e.g 15.4 + """ + val = self.__read_txt_file(self.hwmon_path + "psu_i_out") + if val is not None: + return float(val)/1000 + else: + return 0 + + def get_power(self): + """ + Retrieves current energy supplied by PSU + Returns: + A float number, the power in watts, e.g. 302.6 + """ + val = self.__read_txt_file(self.hwmon_path + "psu_p_out") + if val is not None: + return float(val)/1000 + else: + return 0 + + def get_powergood_status(self): + """ + Retrieves the powergood status of PSU + Returns: + A boolean, True if PSU has stablized its output voltages and passed all + its internal self-tests, False if not. + """ + return self.get_status() + + def set_status_led(self, color): + """ + Sets the state of the PSU status LED + Args: + color: A string representing the color with which to set the PSU status LED + Note: Only support green and off + Returns: + bool: True if status LED state is set successfully, False if not + """ + + return False #Controlled by HW + + def get_status_led(self): + """ + Gets the state of the PSU status LED + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + status=self.get_status() + if status is None: + return self.STATUS_LED_COLOR_OFF + + return { + 1: self.STATUS_LED_COLOR_GREEN, + 0: self.STATUS_LED_COLOR_RED + }.get(status, self.STATUS_LED_COLOR_OFF) + + def get_temperature(self): + """ + Retrieves current temperature reading from PSU + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + return self._thermal_list[0].get_temperature() + + def get_temperature_high_threshold(self): + """ + Retrieves the high threshold temperature of PSU + Returns: + A float number, the high threshold temperature of PSU in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + return False #Not supported + + def get_voltage_high_threshold(self): + """ + Retrieves the high threshold PSU voltage output + Returns: + A float number, the high threshold output voltage in volts, + e.g. 12.1 + """ + val = self.__read_txt_file(self.hwmon_path + "psu_mfr_vout_max") + if val is not None: + return float(val)/ 1000 + else: + return 0 + + def get_voltage_low_threshold(self): + """ + Retrieves the low threshold PSU voltage output + Returns: + A float number, the low threshold output voltage in volts, + e.g. 12.1 + """ + val = self.__read_txt_file(self.hwmon_path + "psu_mfr_vout_min") + if val is not None: + return float(val)/ 1000 + else: + return 0 + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + return PSU_NAME_LIST[self.index] + + def get_presence(self): + """ + Retrieves the presence of the PSU + Returns: + bool: True if PSU is present, False if not + """ + val = self.__read_txt_file(self.cpld_path + "psu_present") + if val is not None: + return int(val, 10) == 1 + else: + return 0 + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + val = self.__read_txt_file(self.cpld_path + "psu_power_good") + if val is not None: + return int(val, 10) == 1 + else: + return 0 + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + model = self.__read_txt_file(self.cpld_path + "psu_model_name") + if model is None: + return "N/A" + return model + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + serial = self.__read_txt_file(self.cpld_path + "psu_serial_number") + if serial is None: + return "N/A" + return serial + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.index+1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/sfp.py new file mode 100644 index 000000000000..95a54e554a01 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/sfp.py @@ -0,0 +1,626 @@ +############################################################################# +# Edgecore +# +# Sfp contains an implementation of SONiC Platform Base API and +# provides the sfp device status which are available in the platform +# +############################################################################# + +import os +import time +import sys + +from ctypes import create_string_buffer + +try: + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase + from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CPLD_ADDR_MAPPING = { + 0: { + "bus": 18, + "addr": "60" + }, # port 31-56 + 1: { + "bus": 12, + "addr": "62" + }, # port 1-30 +} +CPLD_I2C_PATH = "/sys/bus/i2c/devices/{}-00{}/" + +class Sfp(SfpOptoeBase): + """Platform-specific Sfp class""" + + # Port number + PORT_START = 1 + PORT_END = 58 + + # Path to sysfs + PLATFORM_ROOT_PATH = "/usr/share/sonic/device" + PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" + HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" + + PLATFORM = "x86_64-accton_as7326_56x-r0" + HWSKU = "Accton-AS7326-56X" + + _port_to_i2c_mapping = { + 1: [42], + 2: [41], + 3: [44], + 4: [43], + 5: [47], + 6: [45], + 7: [46], + 8: [50], + 9: [48], + 10: [49], + 11: [52], + 12: [51], + 13: [53], + 14: [56], + 15: [55], + 16: [54], + 17: [58], + 18: [57], + 19: [60], + 20: [59], + 21: [61], + 22: [63], + 23: [62], + 24: [64], + 25: [66], + 26: [68], + 27: [65], + 28: [67], + 29: [69], + 30: [71], + 31: [72], + 32: [70], + 33: [74], + 34: [73], + 35: [76], + 36: [75], + 37: [77], + 38: [79], + 39: [78], + 40: [80], + 41: [81], + 42: [82], + 43: [84], + 44: [85], + 45: [83], + 46: [87], + 47: [88], + 48: [86], + 49: [25], + 50: [26], + 51: [27], + 52: [28], + 53: [29], + 54: [30], + 55: [31], + 56: [32], + 57: [22], + 58: [23] + } + + def __init__(self, sfp_index=0): + SfpOptoeBase.__init__(self) + # Init index + self.index = sfp_index + self.port_num = self.index + 1 + + cpld_idx = 0 if self.port_num > 30 else 1 + bus = CPLD_ADDR_MAPPING[cpld_idx]["bus"] + addr = CPLD_ADDR_MAPPING[cpld_idx]["addr"] + self.cpld_path = CPLD_I2C_PATH.format(bus, addr) + + # Init eeprom path + eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom' + self.port_to_eeprom_mapping = {} + for x in range(self.PORT_START, self.PORT_END + 1): + self.port_to_eeprom_mapping[x] = eeprom_path.format( + self._port_to_i2c_mapping[x][0]) + + def get_eeprom_path(self): + return self.port_to_eeprom_mapping[self.port_num] + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + return fd.read().strip() + except IOError: + pass + return "" + + def __write_txt_file(self, file_path, value): + try: + with open(file_path, 'w') as fd: + fd.write(str(value)) + except Exception: + return False + return True + + def __is_host(self): + return os.system(self.HOST_CHK_CMD) == 0 + + def __get_path_to_port_config_file(self): + platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) + hwsku_path = "/".join( + [platform_path, + self.HWSKU]) if self.__is_host() else self.PMON_HWSKU_PATH + return "/".join([hwsku_path, "port_config.ini"]) + + def __read_eeprom_specific_bytes(self, offset, num_bytes): + sysfsfile_eeprom = None + eeprom_raw = [] + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + sysfs_sfp_i2c_client_eeprom_path = self.port_to_eeprom_mapping[ + self.port_num] + try: + sysfsfile_eeprom = open( + sysfs_sfp_i2c_client_eeprom_path, mode="rb", buffering=0) + sysfsfile_eeprom.seek(offset) + raw = sysfsfile_eeprom.read(num_bytes) + for n in range(0, num_bytes): + if sys.version_info[0] >= 3: + eeprom_raw[n] = hex(raw[n])[2:].zfill(2) + else: + eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + except Exception: + pass + finally: + if sysfsfile_eeprom: + sysfsfile_eeprom.close() + + return eeprom_raw + + def get_reset_status(self): + """ + Retrieves the reset status of SFP + Returns: + A Boolean, True if reset enabled, False if disabled + """ + if self.port_num <= 48 or self.port_num >=57: + return False # SPF port doesn't support this feature + + val = self.__read_txt_file( + self.cpld_path + "module_reset_" + str(self.port_num)) + return int(val, 10) == 1 + + def get_rx_los(self): + """ + Retrieves the RX LOS (lost-of-signal) status of SFP + Returns: + A Boolean, True if SFP has RX LOS, False if not. + Note : RX LOS status is latched until a call to get_rx_los or a reset. + """ + if self.port_num <= 48 or self.port_num >=57: + rx_los = self.__read_txt_file( + self.cpld_path + "module_rx_los_" + str(self.port_num)) + if int(rx_los, 10) == 1: + return [True] + else: + return [False] + #status_control_raw = self.__read_eeprom_specific_bytes( + # SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) + #if status_control_raw: + # data = int(status_control_raw[0], 16) + # rx_los = (sffbase().test_bit(data, 1) != 0) + else: + rx_los_list = [] + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + QSFP_CHANNL_RX_LOS_STATUS_OFFSET, + QSFP_CHANNL_RX_LOS_STATUS_WIDTH) if self.get_presence( + ) else None + if dom_channel_monitor_raw is not None: + rx_los_data = int(dom_channel_monitor_raw[0], 16) + rx_los_list.append(rx_los_data & 0x01 != 0) + rx_los_list.append(rx_los_data & 0x02 != 0) + rx_los_list.append(rx_los_data & 0x04 != 0) + rx_los_list.append(rx_los_data & 0x08 != 0) + return rx_los_list + else: + return [False]*4 + + def get_tx_fault(self): + """ + Retrieves the TX fault status of SFP + + Returns: + A list of boolean values, representing the TX fault status + of each available channel, value is True if SFP channel + has TX fault, False if not. + E.g., for a tranceiver with four channels: [False, False, True, False] + Note : TX fault status is lached until a call to get_tx_fault or a reset. + """ + tx_fault = False + if self.port_num <= 48 or self.port_num >=57: + tx_fault = self.__read_txt_file( + self.cpld_path + "module_tx_fault_" + str(self.port_num)) + if int(tx_fault, 10) == 1: + return [True] + else: + return [False] + #status_control_raw = self.__read_eeprom_specific_bytes( + # SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) + #if status_control_raw: + # data = int(status_control_raw[0], 16) + # tx_fault = (sffbase().test_bit(data, 2) != 0) + else: + tx_fault_list = [] + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + QSFP_CHANNL_TX_FAULT_STATUS_OFFSET, + QSFP_CHANNL_TX_FAULT_STATUS_WIDTH) if self.get_presence( + ) else None + if dom_channel_monitor_raw is not None: + tx_fault_data = int(dom_channel_monitor_raw[0], 16) + tx_fault_list.append(tx_fault_data & 0x01 != 0) + tx_fault_list.append(tx_fault_data & 0x02 != 0) + tx_fault_list.append(tx_fault_data & 0x04 != 0) + tx_fault_list.append(tx_fault_data & 0x08 != 0) + return tx_fault_list + else: + return [False]*4 + + + def get_tx_disable(self): + """ + Retrieves the tx_disable status of this SFP + Returns: + A list of boolean values, representing the TX disable status + of each available channel, value is True if SFP channel + is TX disabled, False if not. + E.g., for a tranceiver with four channels: [False, False, True, False] + """ + if self.port_num <= 48 or self.port_num >=57: + tx_disable = False + + status_control_raw = self.__read_eeprom_specific_bytes( + SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) + if status_control_raw: + cpld_val = self.__read_txt_file( + self.cpld_path + "module_tx_disable_" + str(self.port_num)) + tx_disable_hard = (int(cpld_val, 10) == 1) + data = int(status_control_raw[0], 16) + #tx_disable_hard = (sffbase().test_bit( + # data, SFP_TX_DISABLE_HARD_BIT) != 0) + tx_disable_soft = (sffbase().test_bit( + data, SFP_TX_DISABLE_SOFT_BIT) != 0) + tx_disable = tx_disable_hard | tx_disable_soft + if tx_disable==0: + return [False] + else: + return [True] + + else: + return [False] + + else: + tx_disable_list = [] + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return [False] + + dom_control_raw = self.__read_eeprom_specific_bytes( + QSFP_CONTROL_OFFSET, + QSFP_CONTROL_WIDTH) if self.get_presence() else None + if dom_control_raw is not None: + dom_control_data = sfpd_obj.parse_control_bytes( + dom_control_raw, 0) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX1Disable']['value']) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX2Disable']['value']) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX3Disable']['value']) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX4Disable']['value']) + return tx_disable_list + else: + return [False]*4 + + def get_tx_disable_channel(self): + """ + Retrieves the TX disabled channels in this SFP + Returns: + A hex of 4 bits (bit 0 to bit 3 as channel 0 to channel 3) to represent + TX channels which have been disabled in this SFP. + As an example, a returned value of 0x5 indicates that channel 0 + and channel 2 have been disabled. + """ + tx_disable_list = self.get_tx_disable() + if tx_disable_list is None: + return 0 + tx_disabled = 0 + for i in range(len(tx_disable_list)): + if tx_disable_list[i]: + tx_disabled |= 1 << i + return tx_disabled + + def get_lpmode(self): + """ + Retrieves the lpmode (low power mode) status of this SFP + Returns: + A Boolean, True if lpmode is enabled, False if disabled + """ + if self.port_num <= 48 or self.port_num >= 57: + # SFP doesn't support this feature + return False + + power_set = self.get_power_set() + power_override = self.get_power_override() + return power_set and power_override + + def get_power_set(self): + + if self.port_num <= 48 or self.port_num >= 57: + # SFP doesn't support this feature + return False + else: + power_set = False + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return False + + dom_control_raw = self.__read_eeprom_specific_bytes( + QSFP_CONTROL_OFFSET, + QSFP_CONTROL_WIDTH) if self.get_presence() else None + if dom_control_raw is not None: + dom_control_data = sfpd_obj.parse_control_bytes( + dom_control_raw, 0) + power_set = ( + 'On' == dom_control_data['data']['PowerSet']['value']) + + return power_set + + def get_power_override(self): + """ + Retrieves the power-override status of this SFP + Returns: + A Boolean, True if power-override is enabled, False if disabled + """ + if self.port_num <= 48 or self.port_num >= 57: + return False # SFP doesn't support this feature + else: + power_override = False + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return False + + dom_control_raw = self.__read_eeprom_specific_bytes( + QSFP_CONTROL_OFFSET, + QSFP_CONTROL_WIDTH) if self.get_presence() else None + if dom_control_raw is not None: + dom_control_data = sfpd_obj.parse_control_bytes( + dom_control_raw, 0) + power_override = ( + 'On' == dom_control_data['data']['PowerOverride']['value']) + + return power_override + + def reset(self): + """ + Reset SFP and return all user module settings to their default srate. + Returns: + A boolean, True if successful, False if not + """ + # Check for invalid port_num + if self.port_num <= 48 or self.port_num >=57: + return False # SFP doesn't support this feature + + ret = self.__write_txt_file( + self.cpld_path + "module_reset_" + str(self.port_num), 1) + if ret is not True: + return ret + + time.sleep(0.01) + ret = self.__write_txt_file( + self.cpld_path + "module_reset_" + str(self.port_num), 0) + time.sleep(0.2) + return ret + + def tx_disable(self, tx_disable): + """ + Disable SFP TX for all channels + Args: + tx_disable : A Boolean, True to enable tx_disable mode, False to disable + tx_disable mode. + Returns: + A boolean, True if tx_disable is set successfully, False if not + """ + if self.port_num <= 48 or self.port_num >=57: + ret = self.__write_txt_file( + self.cpld_path + "module_tx_disable_" + str(self.port_num), 1 + if tx_disable else 0) + time.sleep(0.01) + return ret + else: + if not self.get_presence(): + return False + + sysfsfile_eeprom = None + try: + tx_disable_ctl = 0xf if tx_disable else 0x0 + buffer = create_string_buffer(1) + if sys.version_info[0] >= 3: + buffer[0] = tx_disable_ctl + else: + buffer[0] = chr(tx_disable_ctl) + # Write to eeprom + sysfsfile_eeprom = open( + self.port_to_eeprom_mapping[self.port_num], "r+b") + sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + return True + + def tx_disable_channel(self, channel, disable): + """ + Sets the tx_disable for specified SFP channels + Args: + channel : A hex of 4 bits (bit 0 to bit 3) which represent channel 0 to 3, + e.g. 0x5 for channel 0 and channel 2. + disable : A boolean, True to disable TX channels specified in channel, + False to enable + Returns: + A boolean, True if successful, False if not + """ + + if self.port_num <= 48 or self.port_num >=57: + return False # SFP doesn't support this feature + else: + if not self.get_presence(): + return False + + sysfsfile_eeprom = None + try: + channel_state = self.get_tx_disable_channel() + + for i in range(4): + channel_mask = (1 << i) + if not (channel & channel_mask): + continue + + if disable: + channel_state |= channel_mask + else: + channel_state &= ~channel_mask + + buffer = create_string_buffer(1) + if sys.version_info[0] >= 3: + buffer[0] = channel_state + else: + buffer[0] = chr(channel_state) + # Write to eeprom + sysfsfile_eeprom = open( + self.port_to_eeprom_mapping[self.port_num], "r+b") + sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + return True + + def set_lpmode(self, lpmode): + """ + Sets the lpmode (low power mode) of SFP + Args: + lpmode: A Boolean, True to enable lpmode, False to disable it + Note : lpmode can be overridden by set_power_override + Returns: + A boolean, True if lpmode is set successfully, False if not + """ + if self.port_num <= 48 or self.port_num >=57: + return False # SFP doesn't support this feature + + if lpmode: + return self.set_power_override(True, True) + else: + return self.set_power_override(True, False) + + def set_power_override(self, power_override, power_set): + """ + Sets SFP power level using power_override and power_set + Args: + power_override : + A Boolean, True to override set_lpmode and use power_set + to control SFP power, False to disable SFP power control + through power_override/power_set and use set_lpmode + to control SFP power. + power_set : + Only valid when power_override is True. + A Boolean, True to set SFP to low power mode, False to set + SFP to high power mode. + Returns: + A boolean, True if power-override and power_set are set successfully, + False if not + """ + if self.port_num <= 48 or self.port_num >=57: + return False # SFP doesn't support this feature + else: + if not self.get_presence(): + return False + try: + power_override_bit = (1 << 0) if power_override else 0 + power_set_bit = (1 << 1) if power_set else (1 << 3) + + buffer = create_string_buffer(1) + if sys.version_info[0] >= 3: + buffer[0] = (power_override_bit | power_set_bit) + else: + buffer[0] = chr(power_override_bit | power_set_bit) + # Write to eeprom + with open(self.port_to_eeprom_mapping[self.port_num], + "r+b") as fd: + fd.seek(QSFP_POWEROVERRIDE_OFFSET) + fd.write(buffer[0]) + time.sleep(0.01) + except Exception: + print("Error: unable to open file: %s" % str(e)) + return False + return True + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + sfputil_helper = SfpUtilHelper() + sfputil_helper.read_porttab_mappings( + self.__get_path_to_port_config_file()) + name = sfputil_helper.logical[self.index] or "Unknown" + return name + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + val = self.__read_txt_file( + self.cpld_path + "module_present_" + str(self.port_num)) + return val == '1' + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return self.get_presence() + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.port_num + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/thermal.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/thermal.py new file mode 100644 index 000000000000..b2233e7b5a72 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/thermal.py @@ -0,0 +1,232 @@ +############################################################################# +# Edgecore +# +# Thermal contains an implementation of SONiC Platform Base API and +# provides the thermal device status which are available in the platform +# +############################################################################# + +import os +import os.path +import glob + +try: + from sonic_platform_base.thermal_base import ThermalBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +PSU_I2C_PATH = "/sys/bus/i2c/devices/{}-00{}/" +PSU_HWMON_I2C_MAPPING = { + 0: { + "bus": 17, + "addr": "59" + }, + 1: { + "bus": 13, + "addr": "5b" + }, +} + +PSU_CPLD_I2C_MAPPING = { + 0: { + "bus": 17, + "addr": "51" + }, + 1: { + "bus": 13, + "addr": "53" + }, +} + + +class Thermal(ThermalBase): + """Platform-specific Thermal class""" + + THERMAL_NAME_LIST = [] + PSU_THERMAL_NAME_LIST = [] + SYSFS_PATH = "/sys/bus/i2c/devices" + + def __init__(self, thermal_index=0, is_psu=False, psu_index=0): + self.index = thermal_index + self.is_psu = is_psu + self.psu_index = psu_index + + if self.is_psu: + psu_i2c_bus = PSU_HWMON_I2C_MAPPING[psu_index]["bus"] + psu_i2c_addr = PSU_HWMON_I2C_MAPPING[psu_index]["addr"] + self.psu_hwmon_path = PSU_I2C_PATH.format(psu_i2c_bus, + psu_i2c_addr) + psu_i2c_bus = PSU_CPLD_I2C_MAPPING[psu_index]["bus"] + psu_i2c_addr = PSU_CPLD_I2C_MAPPING[psu_index]["addr"] + self.cpld_path = PSU_I2C_PATH.format(psu_i2c_bus, psu_i2c_addr) + + # Add thermal name + self.THERMAL_NAME_LIST.append("Temp sensor 1") + self.THERMAL_NAME_LIST.append("Temp sensor 2") + self.THERMAL_NAME_LIST.append("Temp sensor 3") + self.THERMAL_NAME_LIST.append("Temp sensor 4") + self.PSU_THERMAL_NAME_LIST.append("PSU-1 temp sensor 1") + self.PSU_THERMAL_NAME_LIST.append("PSU-2 temp sensor 1") + + # Set hwmon path + i2c_path = { + 0: "15-0048/hwmon/hwmon*/", + 1: "15-0049/hwmon/hwmon*/", + 2: "15-004a/hwmon/hwmon*/", + 3: "15-004b/hwmon/hwmon*/" + }.get(self.index, None) + + self.hwmon_path = "{}/{}".format(self.SYSFS_PATH, i2c_path) + self.ss_key = self.THERMAL_NAME_LIST[self.index] + self.ss_index = 1 + + def __read_txt_file(self, file_path): + for filename in glob.glob(file_path): + try: + with open(filename, 'r') as fd: + return fd.readline().rstrip() + except IOError as e: + pass + + def __get_temp(self, temp_file): + if not self.is_psu: + temp_file_path = os.path.join(self.hwmon_path, temp_file) + else: + temp_file_path = temp_file + + raw_temp = self.__read_txt_file(temp_file_path) + return float(raw_temp) / 1000 + + def __set_threshold(self, file_name, temperature): + if self.is_psu: + return True + + temp_file_path = os.path.join(self.hwmon_path, file_name) + try: + with open(temp_file_path, 'w') as fd: + fd.write(str(temperature)) + return True + except IOError: + return False + + def get_temperature(self): + """ + Retrieves current temperature reading from thermal + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + if not self.is_psu: + temp_file = "temp{}_input".format(self.ss_index) + else: + temp_file = self.psu_hwmon_path + "psu_temp1_input" + + return self.__get_temp(temp_file) + + def get_high_threshold(self): + """ + Retrieves the high threshold temperature of thermal + Returns: + A float number, the high threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.is_psu: + return 0 + + temp_file = "temp{}_max".format(self.ss_index) + return self.__get_temp(temp_file) + + def set_high_threshold(self, temperature): + """ + Sets the high threshold temperature of thermal + Args : + temperature: A float number up to nearest thousandth of one degree Celsius, + e.g. 30.125 + Returns: + A boolean, True if threshold is set successfully, False if not + """ + temp_file = "temp{}_max".format(self.ss_index) + temperature = temperature *1000 + self.__set_threshold(temp_file, temperature) + + return True + + def get_name(self): + """ + Retrieves the name of the thermal device + Returns: + string: The name of the thermal device + """ + if self.is_psu: + return self.PSU_THERMAL_NAME_LIST[self.psu_index] + else: + return self.THERMAL_NAME_LIST[self.index] + + def get_presence(self): + """ + Retrieves the presence of the PSU + Returns: + bool: True if PSU is present, False if not + """ + if self.is_psu: + val = self.__read_txt_file(self.cpld_path + "psu_present") + return int(val, 10) == 1 + + temp_file = "temp{}_input".format(self.ss_index) + temp_file_path = os.path.join(self.hwmon_path, temp_file) + raw_txt = self.__read_txt_file(temp_file_path) + return raw_txt != None + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + if self.is_psu: + temp_file = self.psu_hwmon_path + "psu_temp_fault" + return self.get_presence() and (not int( + self.__read_txt_file(temp_file))) + + file_str = "temp{}_input".format(self.ss_index) + file_path = os.path.join(self.hwmon_path, file_str) + + raw_txt = self.__read_txt_file(file_path) + if raw_txt is None: + return False + else: + return int(raw_txt) != 0 + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + + return "N/A" + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return "N/A" + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.index+1 + + def is_replaceable(self): + """ + Retrieves whether thermal module is replaceable + Returns: + A boolean value, True if replaceable, False if not + """ + return False diff --git a/device/accton/x86_64-accton_as7326_56x-r0/system_health_monitoring_config.json b/device/accton/x86_64-accton_as7326_56x-r0/system_health_monitoring_config.json new file mode 100644 index 000000000000..18d47b22a9d3 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/system_health_monitoring_config.json @@ -0,0 +1,15 @@ +{ + "services_to_ignore": [], + "devices_to_ignore": [ + "asic", + "psu.temperature" + + ], + "user_defined_checkers": [], + "polling_interval": 60, + "led_color": { + "fault": "STATUS_LED_COLOR_RED", + "normal": "STATUS_LED_COLOR_GREEN", + "booting": "STATUS_LED_COLOR_GREEN_BLINK" + } +} diff --git a/device/accton/x86_64-accton_as7512_32x-r0/platform_asic b/device/accton/x86_64-accton_as7512_32x-r0/platform_asic new file mode 100644 index 000000000000..9f633e3d1769 --- /dev/null +++ b/device/accton/x86_64-accton_as7512_32x-r0/platform_asic @@ -0,0 +1 @@ +cavium diff --git a/device/accton/x86_64-accton_as7712_32x-r0/installer.conf b/device/accton/x86_64-accton_as7712_32x-r0/installer.conf index 14404194ef53..d0ed16575e73 100644 --- a/device/accton/x86_64-accton_as7712_32x-r0/installer.conf +++ b/device/accton/x86_64-accton_as7712_32x-r0/installer.conf @@ -1,3 +1,4 @@ CONSOLE_PORT=0x2f8 CONSOLE_DEV=1 CONSOLE_SPEED=115200 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="modprobe.blacklist=i2c-ismt,i2c_ismt,i2c-i801,i2c_i801" diff --git a/device/accton/x86_64-accton_as7712_32x-r0/pddf/pd-plugin.json b/device/accton/x86_64-accton_as7712_32x-r0/pddf/pd-plugin.json new file mode 100644 index 000000000000..7df46b922ec3 --- /dev/null +++ b/device/accton/x86_64-accton_as7712_32x-r0/pddf/pd-plugin.json @@ -0,0 +1,54 @@ +{ + "PSU": + { + "psu_present": + { + "i2c": + { + "valmap": { "1":true, "0":false } + } + }, + + "psu_power_good": + { + "i2c": + { + "valmap": { "1": true, "0":false } + } + }, + + "psu_fan_dir": + { + "i2c": + { + "valmap": { "F2B":"EXHAUST", "B2F":"INTAKE" } + } + }, + + "PSU_FAN_MAX_SPEED":"18000" + }, + + "FAN": + { + "direction": + { + "i2c": + { + "valmap": {"1":"EXHAUST", "0":"INTAKE"} + } + }, + + "present": + { + "i2c": + { + "valmap": {"1":true, "0":false} + } + }, + + "duty_cycle_to_pwm": "lambda dc: ((dc*100.0)/625 - 1)", + + "pwm_to_duty_cycle": "lambda pwm: (((pwm+1)*625.0)/100)" + } + +} diff --git a/device/accton/x86_64-accton_as7712_32x-r0/pddf/pddf-device.json b/device/accton/x86_64-accton_as7712_32x-r0/pddf/pddf-device.json new file mode 100644 index 000000000000..439a52ca9a59 --- /dev/null +++ b/device/accton/x86_64-accton_as7712_32x-r0/pddf/pddf-device.json @@ -0,0 +1,1792 @@ +{ + "PLATFORM": + { + "num_psus":2, + "num_fantrays":6, + "num_fans_pertray":2, + "num_ports":32, + "num_temps": 4, + "pddf_dev_types": + { + "description":"AS7712 - Below is the list of supported PDDF device types (chip names) for various components. If any component uses some other driver, we will create the client using 'echo > /new_device' method", + "CPLD": + [ + "i2c_cpld" + ], + "PSU": + [ + "psu_eeprom", + "psu_pmbus" + ], + "FAN": + [ + "fan_ctrl", + "fan_eeprom" + ], + "PORT_MODULE": + [ + "pddf_xcvr" + ] + + }, + "std_kos": + [ + "i2c-ismt", + "i2c-i801", + "i2c_dev", + "i2c_mux_pca954x", + "optoe" + ], + "pddf_kos": + [ + "pddf_client_module", + "pddf_cpld_module", + "pddf_cpld_driver", + "pddf_mux_module", + "pddf_xcvr_module", + "pddf_xcvr_driver_module", + "pddf_psu_driver_module", + "pddf_psu_module", + "pddf_fan_driver_module", + "pddf_fan_module", + "pddf_led_module", + "pddf_sysstatus_module" + ] + }, + + "SYSTEM": + { + "dev_info": {"device_type":"CPU", "device_name":"ROOT_COMPLEX", "device_parent":null}, + "i2c": + { + "CONTROLLERS": + [ + { "dev_name":"i2c-1", "dev":"SMBUS1" }, + { "dev_name":"i2c-0", "dev":"SMBUS0" } + ] + } + }, + + "SMBUS0": + { + "dev_info": {"device_type": "SMBUS", "device_name": "SMBUS0", "device_parent": "SYSTEM"}, + "i2c": + { + "topo_info": {"dev_addr": "0x0"}, + "DEVICES": + [ + {"dev": "EEPROM1"}, + {"dev": "MUX2"}, + {"dev": "MUX3"}, + {"dev": "MUX4"}, + {"dev": "MUX5"}, + {"dev": "MUX6"} + ] + } + }, + + "SMBUS1": + { + "dev_info": {"device_type": "SMBUS", "device_name": "SMBUS1", "device_parent": "SYSTEM"}, + "i2c": + { + "topo_info": {"dev_addr": "0x1"}, + "DEVICES": + [ + {"dev": "MUX1"} + ] + } + }, + "EEPROM1": + { + "dev_info": {"device_type": "EEPROM", "device_name": "EEPROM1", "device_parent": "SMBUS0"}, + "i2c": + { + "topo_info": {"parent_bus": "0x0", "dev_addr": "0x57", "dev_type": "24c02"}, + "dev_attr": {"access_mode": "BLOCK"}, + "attr_list": [ + {"attr_name": "eeprom"} + ] + } + }, + + "MUX1": + { + "dev_info": { "device_type":"MUX", "device_name":"MUX1", "device_parent":"SMBUS1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x1", "dev_addr":"0x76", "dev_type":"pca9548"}, + "dev_attr": { "virt_bus":"0x2", "idle_state":"-2"}, + "channel": + [ + { "chn":"0", "dev":"FAN-CTRL" }, + { "chn":"1", "dev":"TEMP1" }, + { "chn":"1", "dev":"TEMP2" }, + { "chn":"1", "dev":"TEMP3" }, + { "chn":"1", "dev":"TEMP4" }, + { "chn":"2", "dev":"CPLD1" }, + { "chn":"3", "dev":"CPLD2" }, + { "chn":"4", "dev":"CPLD3" } + ] + } + }, + + "MUX2": + { + "dev_info": { "device_type":"MUX", "device_name":"MUX2", "device_parent":"SMBUS0"}, + "i2c": + { + "topo_info": { "parent_bus":"0x0", "dev_addr":"0x71", "dev_type":"pca9548"}, + "dev_attr": { "virt_bus":"0xa", "idle_state":"-2"}, + "channel": + [ + { "chn":"0", "dev":"PSU2" }, + { "chn":"1", "dev":"PSU1" } + ] + } + }, + + "FAN-CTRL": + { + "dev_info": { "device_type":"FAN", "device_name":"FAN-CTRL", "device_parent":"MUX1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2", "dev_addr":"0x66", "dev_type":"fan_ctrl"}, + "dev_attr": { "num_fantrays":"6"}, + "attr_list": + [ + { "attr_name":"fan1_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0F", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan2_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0F", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan3_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0F", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan4_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0F", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan5_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0F", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan6_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0F", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan7_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0F", "attr_mask":"0x8", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan8_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0F", "attr_mask":"0x8", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan9_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0F", "attr_mask":"0x10", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan10_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0F", "attr_mask":"0x10", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan11_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0F", "attr_mask":"0x20", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan12_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0F", "attr_mask":"0x20", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan1_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x1", "attr_cmpval":"0x1", "attr_len":"1"}, + { "attr_name":"fan2_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x1", "attr_cmpval":"0x1", "attr_len":"1"}, + { "attr_name":"fan3_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x2", "attr_cmpval":"0x2", "attr_len":"1"}, + { "attr_name":"fan4_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x2", "attr_cmpval":"0x2", "attr_len":"1"}, + { "attr_name":"fan5_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x4", "attr_cmpval":"0x4", "attr_len":"1"}, + { "attr_name":"fan6_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x4", "attr_cmpval":"0x4", "attr_len":"1"}, + { "attr_name":"fan7_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x8", "attr_cmpval":"0x8", "attr_len":"1"}, + { "attr_name":"fan8_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x8", "attr_cmpval":"0x8", "attr_len":"1"}, + { "attr_name":"fan9_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x10", "attr_cmpval":"0x10", "attr_len":"1"}, + { "attr_name":"fan10_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x10", "attr_cmpval":"0x10", "attr_len":"1"}, + { "attr_name":"fan11_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x20", "attr_cmpval":"0x20", "attr_len":"1"}, + { "attr_name":"fan12_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0x20", "attr_cmpval":"0x20", "attr_len":"1"}, + { "attr_name":"fan1_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x12", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100", "attr_is_divisor":0}, + { "attr_name":"fan2_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x22", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100" , "attr_is_divisor":0}, + { "attr_name":"fan3_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x13", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100", "attr_is_divisor":0}, + { "attr_name":"fan4_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x23", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100" , "attr_is_divisor":0}, + { "attr_name":"fan5_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x14", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100", "attr_is_divisor":0}, + { "attr_name":"fan6_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x24", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100" , "attr_is_divisor":0}, + { "attr_name":"fan7_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x15", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100", "attr_is_divisor":0}, + { "attr_name":"fan8_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x25", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100" , "attr_is_divisor":0}, + { "attr_name":"fan9_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x16", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100", "attr_is_divisor":0}, + { "attr_name":"fan10_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x26", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100" , "attr_is_divisor":0}, + { "attr_name":"fan11_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x17", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100", "attr_is_divisor":0}, + { "attr_name":"fan12_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x27", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"100" , "attr_is_divisor":0}, + { "attr_name":"fan1_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0x0F", "attr_len":"1" }, + { "attr_name":"fan2_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0x0F", "attr_len":"1" }, + { "attr_name":"fan3_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0x0F", "attr_len":"1" }, + { "attr_name":"fan4_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0x0F", "attr_len":"1" }, + { "attr_name":"fan5_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0x0F", "attr_len":"1" }, + { "attr_name":"fan6_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0x0F", "attr_len":"1" }, + { "attr_name":"fan7_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0x0F", "attr_len":"1" }, + { "attr_name":"fan8_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0x0F", "attr_len":"1" }, + { "attr_name":"fan9_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0x0F", "attr_len":"1" }, + { "attr_name":"fan10_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0x0F", "attr_len":"1" }, + { "attr_name":"fan11_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0x0F", "attr_len":"1" }, + { "attr_name":"fan12_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x11", "attr_mask":"0x0F", "attr_len":"1" } + ] + } + }, + + "TEMP1" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP1", "device_parent":"MUX1"}, + "dev_attr": { "display_name":"Temp_1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3", "dev_addr":"0x48", "dev_type":"lm75"}, + "attr_list": + [ + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, + { "attr_name": "temp1_max_hyst"}, + { "attr_name": "temp1_input"} + ] + } + }, + + "TEMP2" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP2", "device_parent":"MUX1"}, + "dev_attr": { "display_name":"Temp_2"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3", "dev_addr":"0x49", "dev_type":"lm75"}, + "attr_list": + [ + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, + { "attr_name": "temp1_max_hyst"}, + { "attr_name": "temp1_input"} + ] + } + }, + + "TEMP3" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP3", "device_parent":"MUX1"}, + "dev_attr": { "display_name":"Temp_3"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3", "dev_addr":"0x4a", "dev_type":"lm75"}, + "attr_list": + [ + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, + { "attr_name": "temp1_max_hyst"}, + { "attr_name": "temp1_input"} + ] + } + }, + + "TEMP4" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP4", "device_parent":"MUX1"}, + "dev_attr": { "display_name":"Temp_CPU"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3", "dev_addr":"0x4b", "dev_type":"lm75"}, + "attr_list": + [ + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, + { "attr_name": "temp1_max_hyst"}, + { "attr_name": "temp1_input"} + ] + } + }, + + "CPLD1": + { + "dev_info": { "device_type":"CPLD", "device_name":"CPLD1", "device_parent":"MUX1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x4", "dev_addr":"0x60", "dev_type":"i2c_cpld"}, + "dev_attr":{} + } + }, + + "CPLD2": + { + "dev_info": { "device_type":"CPLD", "device_name":"CPLD2", "device_parent":"MUX1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x5", "dev_addr":"0x62", "dev_type":"i2c_cpld"}, + "dev_attr": { } + } + }, + + "CPLD3": + { + "dev_info": { "device_type":"CPLD", "device_name":"CPLD3", "device_parent":"MUX1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x6", "dev_addr":"0x64", "dev_type":"i2c_cpld"}, + "dev_attr": { } + } + }, + + "SYSSTATUS": + { + "dev_info":{ "device_type":"SYSSTAT", "device_name":"SYSSTATUS"}, + "dev_attr":{ }, + "attr_list": + [ + + { "attr_name":"board_info","attr_devaddr":"0x60", "attr_offset":"0x0","attr_mask":"0xf","attr_len":"0x1"}, + { "attr_name":"cpld1_version","attr_devaddr":"0x60","attr_offset":"0x1","attr_mask":"0xff","attr_len":"0x1"}, + { "attr_name":"power_module_status","attr_devaddr":"0x60","attr_offset":"0x2","attr_mask":"0x2f","attr_len":"0x1"}, + { "attr_name":"system_reset5","attr_devaddr":"0x60","attr_offset":"0x8","attr_mask":"0xff","attr_len":"0x1"}, + { "attr_name":"system_reset6","attr_devaddr":"0x60","attr_offset":"0x9","attr_mask":"0xff","attr_len":"0x1"}, + { "attr_name":"system_reset7","attr_devaddr":"0x60","attr_offset":"0xa","attr_mask":"0xff","attr_len":"0x1"}, + { "attr_name":"misc1","attr_devaddr":"0x60","attr_offset":"0x48","attr_mask":"0xff","attr_len":"0x1"}, + { "attr_name":"cpld2_version","attr_devaddr":"0x62","attr_offset":"0x1","attr_mask":"0xff","attr_len":"0x1"}, + { "attr_name":"cpld3_version","attr_devaddr":"0x64","attr_offset":"0x1","attr_mask":"0xff","attr_len":"0x1"} + + ] + }, + + + "PSU1": + { + "dev_info": { "device_type":"PSU", "device_name":"PSU1", "device_parent":"MUX2"}, + "dev_attr": { "dev_idx":"1", "num_psu_fans": "1"}, + "i2c": + { + "interface": + [ + { "itf":"pmbus", "dev":"PSU1-PMBUS" } + ] + + } + }, + + "PSU1-PMBUS": + { + "dev_info": { "device_type":"PSU-PMBUS", "device_name":"PSU1-PMBUS", "device_parent":"MUX2", "virt_parent":"PSU1"}, + "i2c": + { + "topo_info":{ "parent_bus":"0xb", "dev_addr":"0x5b", "dev_type":"psu_pmbus"}, + "attr_list": + [ + { "attr_name":"psu_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"psu_model_name", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"9" }, + { "attr_name":"psu_power_good", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x28", "attr_cmpval":"0x28", "attr_len":"1"}, + { "attr_name":"psu_mfr_id", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, + { "attr_name":"psu_serial_num", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x9e", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"20" }, + { "attr_name":"psu_fan_dir", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"}, + { "attr_name":"psu_v_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_i_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_p_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_temp1_input", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} + ] + } + }, + + "PSU2": + { + "dev_info": { "device_type":"PSU", "device_name":"PSU2", "device_parent":"MUX2" }, + "dev_attr": { "dev_idx":"2", "num_psu_fans":"1"}, + "i2c": + { + "interface": + [ + { "itf":"pmbus", "dev":"PSU2-PMBUS"} + ] + } + + }, + + "PSU2-PMBUS": + { + "dev_info": {"device_type":"PSU-PMBUS", "device_name":"PSU2-PMBUS", "device_parent":"MUX2", "virt_parent":"PSU2"}, + "i2c": + { + "topo_info": { "parent_bus":"0xa", "dev_addr":"0x58", "dev_type":"psu_pmbus"}, + "attr_list": + [ + { "attr_name":"psu_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"psu_model_name", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"9" }, + { "attr_name":"psu_power_good", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x14", "attr_cmpval":"0x14", "attr_len":"1"}, + { "attr_name":"psu_mfr_id", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, + { "attr_name":"psu_serial_num", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x9e", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"20" }, + { "attr_name":"psu_fan_dir", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"}, + { "attr_name":"psu_v_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_i_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_p_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_temp1_input", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} + ] + } + }, + + "MUX3": + { + "dev_info": { "device_type":"MUX", "device_name":"MUX3", "device_parent":"SMBUS0"}, + "i2c": + { + "topo_info": { "parent_bus":"0x0", "dev_addr":"0x72", "dev_type":"pca9548"}, + "dev_attr": { "virt_bus":"0x12", "idle_state":"-2"}, + "channel": + [ + { "chn":"0", "dev":"PORT9" }, + { "chn":"1", "dev":"PORT10" }, + { "chn":"2", "dev":"PORT11" }, + { "chn":"3", "dev":"PORT12" }, + { "chn":"4", "dev":"PORT1" }, + { "chn":"5", "dev":"PORT2" }, + { "chn":"6", "dev":"PORT3" }, + { "chn":"7", "dev":"PORT4" } + ] + } + }, + + "MUX4": + { + "dev_info": { "device_type":"MUX", "device_name":"MUX4", "device_parent":"SMBUS0"}, + "i2c": + { + "topo_info": { "parent_bus":"0x0", "dev_addr":"0x73", "dev_type":"pca9548"}, + "dev_attr": { "virt_bus":"0x1a", "idle_state":"-2"}, + "channel": + [ + { "chn":"0", "dev":"PORT6" }, + { "chn":"1", "dev":"PORT5" }, + { "chn":"2", "dev":"PORT8" }, + { "chn":"3", "dev":"PORT7" }, + { "chn":"4", "dev":"PORT13" }, + { "chn":"5", "dev":"PORT14" }, + { "chn":"6", "dev":"PORT15" }, + { "chn":"7", "dev":"PORT16" } + ] + } + }, + + "MUX5": + { + "dev_info": { "device_type":"MUX", "device_name":"MUX5", "device_parent":"SMBUS0"}, + "i2c": + { + "topo_info": { "parent_bus":"0x0", "dev_addr":"0x74", "dev_type":"pca9548"}, + "dev_attr": { "virt_bus":"0x22", "idle_state":"-2"}, + "channel": + [ + { "chn":"0", "dev":"PORT17" }, + { "chn":"1", "dev":"PORT18" }, + { "chn":"2", "dev":"PORT19" }, + { "chn":"3", "dev":"PORT20" }, + { "chn":"4", "dev":"PORT25" }, + { "chn":"5", "dev":"PORT26" }, + { "chn":"6", "dev":"PORT27" }, + { "chn":"7", "dev":"PORT28" } + ] + } + }, + + "MUX6": + { + "dev_info": { "device_type":"MUX", "device_name":"MUX6", "device_parent":"SMBUS0"}, + "i2c": + { + "topo_info": { "parent_bus":"0x0", "dev_addr":"0x75", "dev_type":"pca9548"}, + "dev_attr": { "virt_bus":"0x2a", "idle_state":"-2"}, + "channel": + [ + { "chn":"0", "dev":"PORT29" }, + { "chn":"1", "dev":"PORT30" }, + { "chn":"2", "dev":"PORT31" }, + { "chn":"3", "dev":"PORT32" }, + { "chn":"4", "dev":"PORT21" }, + { "chn":"5", "dev":"PORT22" }, + { "chn":"6", "dev":"PORT23" }, + { "chn":"7", "dev":"PORT24" } + ] + } + }, + + "LOC_LED": + { + "dev_info": { "device_type":"LED", "device_name":"LOC_LED"}, + "dev_attr": { "index":"0"}, + "i2c" : { + "attr_list": + [ + {"attr_name":"STATUS_LED_COLOR_BLUE", "bits" : "7", "descr" : "", "value" : "0x0", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"}, + {"attr_name":"STATUS_LED_COLOR_OFF", "bits" : "7", "descr" : "", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"} + ] + } + }, + + "DIAG_LED": + { + "dev_info": { "device_type":"LED", "device_name":"DIAG_LED"}, + "dev_attr": { "index":"0"}, + "i2c" : { + "attr_list": + [ + {"attr_name":"STATUS_LED_COLOR_GREEN", "bits" : "1:0", "descr" : "", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"}, + {"attr_name":"STATUS_LED_COLOR_RED", "bits" : "1:0", "descr" : "", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"}, + {"attr_name":"STATUS_LED_COLOR_OFF", "bits" : "1:0", "descr" : "", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"} + ] + } + + }, + + + "PORT1": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT1", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"1"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT1-EEPROM" }, + { "itf":"control", "dev":"PORT1-CTRL" } + ] + } + }, + "PORT1-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT1-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x16", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT1-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT1-CTRL", "device_parent":"MUX3", "virt_parent":"PORT1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x16", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x30", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x04", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x10", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT2": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT2", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"2"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT2-EEPROM" }, + { "itf":"control", "dev":"PORT2-CTRL" } + ] + } + }, + "PORT2-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT2-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT2"}, + "i2c": + { + "topo_info": { "parent_bus":"0x17", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT2-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT2-CTRL", "device_parent":"MUX3", "virt_parent":"PORT2"}, + "i2c": + { + "topo_info": { "parent_bus":"0x17", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x30", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x04", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x10", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT3": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT3", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"3"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT3-EEPROM" }, + { "itf":"control", "dev":"PORT3-CTRL" } + ] + } + }, + "PORT3-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT3-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT3"}, + "i2c": + { + "topo_info": { "parent_bus":"0x18", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT3-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT3-CTRL", "device_parent":"MUX3", "virt_parent":"PORT3"}, + "i2c": + { + "topo_info": { "parent_bus":"0x18", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x30", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x04", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x10", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT4": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT4", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"4"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT4-EEPROM" }, + { "itf":"control", "dev":"PORT4-CTRL" } + ] + } + }, + "PORT4-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT4-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT4"}, + "i2c": + { + "topo_info": { "parent_bus":"0x19", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT4-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT4-CTRL", "device_parent":"MUX3", "virt_parent":"PORT4"}, + "i2c": + { + "topo_info": { "parent_bus":"0x19", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x30", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x04", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x10", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT5": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT5", "device_parent":"MUX4"}, + "dev_attr": { "dev_idx":"5"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT5-EEPROM" }, + { "itf":"control", "dev":"PORT5-CTRL" } + ] + } + }, + "PORT5-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT5-EEPROM", "device_parent":"MUX4", "virt_parent":"PORT5"}, + "i2c": + { + "topo_info": { "parent_bus":"0x1b", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT5-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT5-CTRL", "device_parent":"MUX4", "virt_parent":"PORT5"}, + "i2c": + { + "topo_info": { "parent_bus":"0x1b", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x30", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x04", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x10", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT6": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT6", "device_parent":"MUX4"}, + "dev_attr": { "dev_idx":"6"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT6-EEPROM" }, + { "itf":"control", "dev":"PORT6-CTRL" } + ] + } + }, + "PORT6-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT6-EEPROM", "device_parent":"MUX4", "virt_parent":"PORT6"}, + "i2c": + { + "topo_info": { "parent_bus":"0x1a", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT6-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT6-CTRL", "device_parent":"MUX4", "virt_parent":"PORT6"}, + "i2c": + { + "topo_info": { "parent_bus":"0x1a", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x30", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x04", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x10", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT7": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT7", "device_parent":"MUX4"}, + "dev_attr": { "dev_idx":"7"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT7-EEPROM" }, + { "itf":"control", "dev":"PORT7-CTRL" } + ] + } + }, + "PORT7-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT7-EEPROM", "device_parent":"MUX4", "virt_parent":"PORT7"}, + "i2c": + { + "topo_info": { "parent_bus":"0x1d", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT7-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT7-CTRL", "device_parent":"MUX4", "virt_parent":"PORT7"}, + "i2c": + { + "topo_info": { "parent_bus":"0x1d", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x30", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x04", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x10", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT8": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT8", "device_parent":"MUX4"}, + "dev_attr": { "dev_idx":"8"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT8-EEPROM" }, + { "itf":"control", "dev":"PORT8-CTRL" } + ] + } + }, + "PORT8-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT8-EEPROM", "device_parent":"MUX4", "virt_parent":"PORT8"}, + "i2c": + { + "topo_info": { "parent_bus":"0x1c", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT8-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT8-CTRL", "device_parent":"MUX4", "virt_parent":"PORT8"}, + "i2c": + { + "topo_info": { "parent_bus":"0x1c", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x30", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x04", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x10", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT9": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT9", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"9"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT9-EEPROM" }, + { "itf":"control", "dev":"PORT9-CTRL" } + ] + } + }, + "PORT9-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT9-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT9"}, + "i2c": + { + "topo_info": { "parent_bus":"0x12", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT9-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT9-CTRL", "device_parent":"MUX3", "virt_parent":"PORT9"}, + "i2c": + { + "topo_info": { "parent_bus":"0x12", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x31", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x05", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x11", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT10": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT10", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"10"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT10-EEPROM" }, + { "itf":"control", "dev":"PORT10-CTRL" } + ] + } + }, + "PORT10-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT10-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT10"}, + "i2c": + { + "topo_info": { "parent_bus":"0x13", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT10-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT10-CTRL", "device_parent":"MUX3", "virt_parent":"PORT10"}, + "i2c": + { + "topo_info": { "parent_bus":"0x13", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x31", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x05", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x11", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT11": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT11", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"11"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT11-EEPROM" }, + { "itf":"control", "dev":"PORT11-CTRL" } + ] + } + }, + "PORT11-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT11-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT11"}, + "i2c": + { + "topo_info": { "parent_bus":"0x14", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT11-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT11-CTRL", "device_parent":"MUX3", "virt_parent":"PORT11"}, + "i2c": + { + "topo_info": { "parent_bus":"0x14", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x31", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x05", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x11", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT12": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT12", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"12"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT12-EEPROM" }, + { "itf":"control", "dev":"PORT12-CTRL" } + ] + } + }, + "PORT12-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT12-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT12"}, + "i2c": + { + "topo_info": { "parent_bus":"0x15", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT12-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT12-CTRL", "device_parent":"MUX3", "virt_parent":"PORT12"}, + "i2c": + { + "topo_info": { "parent_bus":"0x15", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x31", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x05", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x11", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT13": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT13", "device_parent":"MUX4"}, + "dev_attr": { "dev_idx":"13"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT13-EEPROM" }, + { "itf":"control", "dev":"PORT13-CTRL" } + ] + } + }, + "PORT13-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT13-EEPROM", "device_parent":"MUX4", "virt_parent":"PORT13"}, + "i2c": + { + "topo_info": { "parent_bus":"0x1e", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT13-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT13-CTRL", "device_parent":"MUX4", "virt_parent":"PORT13"}, + "i2c": + { + "topo_info": { "parent_bus":"0x1e", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x31", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x05", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x11", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT14": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT14", "device_parent":"MUX4"}, + "dev_attr": { "dev_idx":"14"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT14-EEPROM" }, + { "itf":"control", "dev":"PORT14-CTRL" } + ] + } + }, + "PORT14-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT14-EEPROM", "device_parent":"MUX4", "virt_parent":"PORT14"}, + "i2c": + { + "topo_info": { "parent_bus":"0x1f", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT14-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT14-CTRL", "device_parent":"MUX4", "virt_parent":"PORT14"}, + "i2c": + { + "topo_info": { "parent_bus":"0x1f", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x31", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x05", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x11", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT15": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT15", "device_parent":"MUX4"}, + "dev_attr": { "dev_idx":"15"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT15-EEPROM" }, + { "itf":"control", "dev":"PORT15-CTRL" } + ] + } + }, + "PORT15-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT15-EEPROM", "device_parent":"MUX4", "virt_parent":"PORT15"}, + "i2c": + { + "topo_info": { "parent_bus":"0x20", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT15-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT15-CTRL", "device_parent":"MUX4", "virt_parent":"PORT15"}, + "i2c": + { + "topo_info": { "parent_bus":"0x20", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x31", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x05", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x11", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT16": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT16", "device_parent":"MUX4"}, + "dev_attr": { "dev_idx":"16"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT16-EEPROM" }, + { "itf":"control", "dev":"PORT16-CTRL" } + ] + } + }, + "PORT16-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT16-EEPROM", "device_parent":"MUX4", "virt_parent":"PORT16"}, + "i2c": + { + "topo_info": { "parent_bus":"0x21", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT16-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT16-CTRL", "device_parent":"MUX4", "virt_parent":"PORT16"}, + "i2c": + { + "topo_info": { "parent_bus":"0x21", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x31", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x05", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x11", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT17": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT17", "device_parent":"MUX5"}, + "dev_attr": { "dev_idx":"17"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT17-EEPROM" }, + { "itf":"control", "dev":"PORT17-CTRL" } + ] + } + }, + "PORT17-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT17-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT17"}, + "i2c": + { + "topo_info": { "parent_bus":"0x22", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT17-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT17-CTRL", "device_parent":"MUX5", "virt_parent":"PORT17"}, + "i2c": + { + "topo_info": { "parent_bus":"0x22", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x32", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x06", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x12", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT18": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT18", "device_parent":"MUX5"}, + "dev_attr": { "dev_idx":"18"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT18-EEPROM" }, + { "itf":"control", "dev":"PORT18-CTRL" } + ] + } + }, + "PORT18-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT18-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT18"}, + "i2c": + { + "topo_info": { "parent_bus":"0x23", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT18-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT18-CTRL", "device_parent":"MUX5", "virt_parent":"PORT18"}, + "i2c": + { + "topo_info": { "parent_bus":"0x23", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x32", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x06", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x12", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT19": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT19", "device_parent":"MUX5"}, + "dev_attr": { "dev_idx":"19"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT19-EEPROM" }, + { "itf":"control", "dev":"PORT19-CTRL" } + ] + } + }, + "PORT19-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT19-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT19"}, + "i2c": + { + "topo_info": { "parent_bus":"0x24", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT19-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT19-CTRL", "device_parent":"MUX5", "virt_parent":"PORT19"}, + "i2c": + { + "topo_info": { "parent_bus":"0x24", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x32", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x06", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x12", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT20": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT20", "device_parent":"MUX5"}, + "dev_attr": { "dev_idx":"20"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT20-EEPROM" }, + { "itf":"control", "dev":"PORT20-CTRL" } + ] + } + }, + "PORT20-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT20-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT20"}, + "i2c": + { + "topo_info": { "parent_bus":"0x25", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT20-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT20-CTRL", "device_parent":"MUX5", "virt_parent":"PORT20"}, + "i2c": + { + "topo_info": { "parent_bus":"0x25", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x32", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x06", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x12", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT21": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT21", "device_parent":"MUX6"}, + "dev_attr": { "dev_idx":"21"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT21-EEPROM" }, + { "itf":"control", "dev":"PORT21-CTRL" } + ] + } + }, + "PORT21-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT21-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT21"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2e", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT21-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT21-CTRL", "device_parent":"MUX6", "virt_parent":"PORT21"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2e", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x32", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x06", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x12", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT22": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT22", "device_parent":"MUX6"}, + "dev_attr": { "dev_idx":"22"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT22-EEPROM" }, + { "itf":"control", "dev":"PORT22-CTRL" } + ] + } + }, + "PORT22-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT22-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT22"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2f", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT22-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT22-CTRL", "device_parent":"MUX6", "virt_parent":"PORT22"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2f", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x32", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x06", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x12", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT23": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT23", "device_parent":"MUX6"}, + "dev_attr": { "dev_idx":"23"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT23-EEPROM" }, + { "itf":"control", "dev":"PORT23-CTRL" } + ] + } + }, + "PORT23-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT23-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT23"}, + "i2c": + { + "topo_info": { "parent_bus":"0x30", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT23-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT23-CTRL", "device_parent":"MUX6", "virt_parent":"PORT23"}, + "i2c": + { + "topo_info": { "parent_bus":"0x30", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x32", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x06", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x12", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT24": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT24", "device_parent":"MUX6"}, + "dev_attr": { "dev_idx":"24"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT24-EEPROM" }, + { "itf":"control", "dev":"PORT24-CTRL" } + ] + } + }, + "PORT24-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT24-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT24"}, + "i2c": + { + "topo_info": { "parent_bus":"0x31", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT24-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT24-CTRL", "device_parent":"MUX6", "virt_parent":"PORT24"}, + "i2c": + { + "topo_info": { "parent_bus":"0x31", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x32", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x06", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x12", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT25": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT25", "device_parent":"MUX5"}, + "dev_attr": { "dev_idx":"25"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT25-EEPROM" }, + { "itf":"control", "dev":"PORT25-CTRL" } + ] + } + }, + "PORT25-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT25-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT25"}, + "i2c": + { + "topo_info": { "parent_bus":"0x26", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT25-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT25-CTRL", "device_parent":"MUX5", "virt_parent":"PORT25"}, + "i2c": + { + "topo_info": { "parent_bus":"0x26", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x33", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x07", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x13", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT26": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT26", "device_parent":"MUX5"}, + "dev_attr": { "dev_idx":"26"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT26-EEPROM" }, + { "itf":"control", "dev":"PORT26-CTRL" } + ] + } + }, + "PORT26-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT26-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT26"}, + "i2c": + { + "topo_info": { "parent_bus":"0x27", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT26-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT26-CTRL", "device_parent":"MUX5", "virt_parent":"PORT26"}, + "i2c": + { + "topo_info": { "parent_bus":"0x27", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x33", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x07", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x13", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT27": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT27", "device_parent":"MUX5"}, + "dev_attr": { "dev_idx":"27"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT27-EEPROM" }, + { "itf":"control", "dev":"PORT27-CTRL" } + ] + } + }, + "PORT27-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT27-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT27"}, + "i2c": + { + "topo_info": { "parent_bus":"0x28", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT27-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT27-CTRL", "device_parent":"MUX5", "virt_parent":"PORT27"}, + "i2c": + { + "topo_info": { "parent_bus":"0x28", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x33", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x07", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x13", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT28": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT28", "device_parent":"MUX5"}, + "dev_attr": { "dev_idx":"28"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT28-EEPROM" }, + { "itf":"control", "dev":"PORT28-CTRL" } + ] + } + }, + "PORT28-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT28-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT28"}, + "i2c": + { + "topo_info": { "parent_bus":"0x29", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT28-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT28-CTRL", "device_parent":"MUX5", "virt_parent":"PORT28"}, + "i2c": + { + "topo_info": { "parent_bus":"0x29", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x33", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x07", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x13", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT29": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT29", "device_parent":"MUX6"}, + "dev_attr": { "dev_idx":"29"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT29-EEPROM" }, + { "itf":"control", "dev":"PORT29-CTRL" } + ] + } + }, + "PORT29-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT29-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT29"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2a", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT29-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT29-CTRL", "device_parent":"MUX6", "virt_parent":"PORT29"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2a", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x33", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x07", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x13", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT30": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT30", "device_parent":"MUX6"}, + "dev_attr": { "dev_idx":"30"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT30-EEPROM" }, + { "itf":"control", "dev":"PORT30-CTRL" } + ] + } + }, + "PORT30-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT30-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT30"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2b", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT30-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT30-CTRL", "device_parent":"MUX6", "virt_parent":"PORT30"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2b", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x33", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x07", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x13", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT31": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT31", "device_parent":"MUX6"}, + "dev_attr": { "dev_idx":"31"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT31-EEPROM" }, + { "itf":"control", "dev":"PORT31-CTRL" } + ] + } + }, + "PORT31-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT31-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT31"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2c", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT31-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT31-CTRL", "device_parent":"MUX6", "virt_parent":"PORT31"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2c", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x33", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x07", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x13", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + }, + + "PORT32": + { + "dev_info": { "device_type":"QSFP", "device_name":"PORT32", "device_parent":"MUX6"}, + "dev_attr": { "dev_idx":"32"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT32-EEPROM" }, + { "itf":"control", "dev":"PORT32-CTRL" } + ] + } + }, + "PORT32-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT32-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT32"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2d", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT32-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT32-CTRL", "device_parent":"MUX6", "virt_parent":"PORT32"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2d", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x33", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x07", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_devname":"CPLD1", "attr_offset":"0x13", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"} + ] + } + } + +} diff --git a/device/accton/x86_64-accton_as7712_32x-r0/pddf_support b/device/accton/x86_64-accton_as7712_32x-r0/pddf_support new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/device/accton/x86_64-accton_as7712_32x-r0/platform_asic b/device/accton/x86_64-accton_as7712_32x-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/accton/x86_64-accton_as7712_32x-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/accton/x86_64-accton_as7712_32x-r0/pmon_daemon_control.json b/device/accton/x86_64-accton_as7712_32x-r0/pmon_daemon_control.json index 584a14b9d942..a3b204e20d8d 100644 --- a/device/accton/x86_64-accton_as7712_32x-r0/pmon_daemon_control.json +++ b/device/accton/x86_64-accton_as7712_32x-r0/pmon_daemon_control.json @@ -1,5 +1,5 @@ { "skip_ledd": true, - "skip_thermalctld": true + "skip_pcied": true } diff --git a/device/accton/x86_64-accton_as7716_32x-r0/platform_asic b/device/accton/x86_64-accton_as7716_32x-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32x-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/accton/x86_64-accton_as7716_32xb-r0/platform_asic b/device/accton/x86_64-accton_as7716_32xb-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/accton/x86_64-accton_as7716_32xb-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/accton/x86_64-accton_as7726_32x-r0/Accton-AS7726-32X/td3-as7726-32x100G.config.bcm b/device/accton/x86_64-accton_as7726_32x-r0/Accton-AS7726-32X/td3-as7726-32x100G.config.bcm index f88656bfd5cf..1dcd7e3ef5bb 100755 --- a/device/accton/x86_64-accton_as7726_32x-r0/Accton-AS7726-32X/td3-as7726-32x100G.config.bcm +++ b/device/accton/x86_64-accton_as7726_32x-r0/Accton-AS7726-32X/td3-as7726-32x100G.config.bcm @@ -1,4 +1,4 @@ -sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_issu/b870.6.4.1/ +sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ #polarity/lanemap is using TH2 style. core_clock_frequency=1525 dpp_clock_ratio=2:3 diff --git a/device/accton/x86_64-accton_as7726_32x-r0/pddf/pddf-device.json b/device/accton/x86_64-accton_as7726_32x-r0/pddf/pddf-device.json index 82295f93b04b..68a18fd5c018 100644 --- a/device/accton/x86_64-accton_as7726_32x-r0/pddf/pddf-device.json +++ b/device/accton/x86_64-accton_as7726_32x-r0/pddf/pddf-device.json @@ -33,7 +33,7 @@ [ "i2c-i801", "i2c_dev", - "i2c_mux_pca954x force_deselect_on_exit=1", + "i2c_mux_pca954x", "optoe" ], "pddf_kos": @@ -50,6 +50,10 @@ "pddf_fan_module", "pddf_led_module", "pddf_sysstatus_module" + ], + "custom_kos": + [ + "pddf_custom_psu" ] }, @@ -1631,7 +1635,8 @@ { "interface": [ - { "itf":"pmbus", "dev":"PSU2-PMBUS"} + { "itf":"pmbus", "dev":"PSU2-PMBUS"}, + { "itf":"eeprom","dev":"PSU2-EEPROM" } ] } }, @@ -1644,19 +1649,31 @@ "topo_info": { "parent_bus":"0x31", "dev_addr":"0x58", "dev_type":"psu_pmbus"}, "attr_list": [ - { "attr_name":"psu_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"psu_model_name", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, + { "attr_name":"psu_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, { "attr_name":"psu_power_good", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x14", "attr_cmpval":"0x14", "attr_len":"1"}, - { "attr_name":"psu_mfr_id", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, - { "attr_name":"psu_serial_num", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x9e", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"20" }, + { "attr_name":"psu_mfr_id", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, { "attr_name":"psu_fan_dir", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"}, { "attr_name":"psu_v_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_i_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_p_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, - { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} + { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_temp1_input", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} ] } }, + "PSU2-EEPROM": + { + "dev_info": { "device_type":"PSU-EEPROM", "device_name":"PSU2-EEPROM", "device_parent":"MUX7", "virt_parent":"PSU2"}, + "i2c": + { + "topo_info":{ "parent_bus":"0x31", "dev_addr":"0x50", "dev_type":"psu_eeprom"}, + "attr_list": + [ + { "attr_name":"psu_model_name", "attr_devaddr":"0x50", "attr_devtype":"eeprom", "attr_offset":"0x15", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"11" }, + { "attr_name":"psu_serial_num", "attr_devaddr":"0x50", "attr_devtype":"eeprom", "attr_offset":"0x2e", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"17" } + ] + } + }, "PSU1": { @@ -1666,7 +1683,8 @@ { "interface": [ - { "itf":"pmbus", "dev":"PSU1-PMBUS" } + { "itf":"pmbus", "dev":"PSU1-PMBUS" }, + { "itf":"eeprom","dev":"PSU1-EEPROM" } ] } }, @@ -1679,20 +1697,31 @@ "topo_info":{ "parent_bus":"0x32", "dev_addr":"0x5b", "dev_type":"psu_pmbus"}, "attr_list": [ - { "attr_name":"psu_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"psu_model_name", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, + { "attr_name":"psu_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, { "attr_name":"psu_power_good", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x28", "attr_cmpval":"0x28", "attr_len":"1"}, - { "attr_name":"psu_mfr_id", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, - { "attr_name":"psu_serial_num", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x9e", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"20" }, + { "attr_name":"psu_mfr_id", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, { "attr_name":"psu_fan_dir", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"}, { "attr_name":"psu_v_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_i_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_p_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, - { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} + { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_temp1_input", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} ] } }, - + "PSU1-EEPROM": + { + "dev_info": { "device_type":"PSU-EEPROM", "device_name":"PSU1-EEPROM", "device_parent":"MUX7", "virt_parent":"PSU1"}, + "i2c": + { + "topo_info":{ "parent_bus":"0x32", "dev_addr":"0x53", "dev_type":"psu_eeprom"}, + "attr_list": + [ + { "attr_name":"psu_model_name", "attr_devaddr":"0x53", "attr_devtype":"eeprom", "attr_offset":"0x15", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"11" }, + { "attr_name":"psu_serial_num", "attr_devaddr":"0x53", "attr_devtype":"eeprom", "attr_offset":"0x2e", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"17" } + ] + } + }, "FAN-CTRL": { "dev_info": { "device_type":"FAN", "device_name":"FAN-CTRL", "device_parent":"MUX7"}, @@ -1762,7 +1791,7 @@ "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP1", "device_parent":"MUX7"}, "i2c": { - "topo_info": { "parent_bus":"0x37", "dev_addr":"0x4c", "dev_type":"lm75"}, + "topo_info": { "parent_bus":"0x36", "dev_addr":"0x4c", "dev_type":"lm75"}, "attr_list": [ { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, @@ -1825,7 +1854,7 @@ "topo_info": { "parent_bus":"0x37", "dev_addr":"0x4b", "dev_type":"lm75"}, "attr_list": [ - { "attr_name": "temp1_max"}, + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, { "attr_name": "temp1_max_hyst"}, { "attr_name": "temp1_input"} ] @@ -1860,8 +1889,8 @@ "i2c" : { "attr_list": [ - {"attr_name":"blue", "descr" : "Blue", "bits" : "7", "value" : "0x0", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"}, - {"attr_name":"off", "descr" : "Off", "bits" : "7", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"} + {"attr_name":"STATUS_LED_COLOR_BLUE", "descr" : "", "bits" : "7", "value" : "0x0", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"}, + {"attr_name":"STATUS_LED_COLOR_OFF", "descr" : "", "bits" : "7", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"} ] } }, @@ -1873,9 +1902,9 @@ "i2c" : { "attr_list": [ - {"attr_name":"green", "descr" : "Green", "bits" : "1:0", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"}, - {"attr_name":"red", "descr" : "Red" ,"bits" : "1:0", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"}, - {"attr_name":"off", "descr" : "Off" ,"bits" : "1:0", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"} + {"attr_name":"STATUS_LED_COLOR_GREEN", "descr" : "", "bits" : "1:0", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"}, + {"attr_name":"STATUS_LED_COLOR_RED", "descr" : "" ,"bits" : "1:0", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"}, + {"attr_name":"STATUS_LED_COLOR_OFF", "descr" : "" ,"bits" : "1:0", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"} ] } diff --git a/device/accton/x86_64-accton_as7726_32x-r0/platform_asic b/device/accton/x86_64-accton_as7726_32x-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/accton/x86_64-accton_as7726_32x-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/accton/x86_64-accton_as7726_32x-r0/pmon_daemon_control.json b/device/accton/x86_64-accton_as7726_32x-r0/pmon_daemon_control.json index 584a14b9d942..a3b204e20d8d 100644 --- a/device/accton/x86_64-accton_as7726_32x-r0/pmon_daemon_control.json +++ b/device/accton/x86_64-accton_as7726_32x-r0/pmon_daemon_control.json @@ -1,5 +1,5 @@ { "skip_ledd": true, - "skip_thermalctld": true + "skip_pcied": true } diff --git a/device/accton/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json b/device/accton/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json index d5461804b656..27d181da1829 100644 --- a/device/accton/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json +++ b/device/accton/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json @@ -32,7 +32,7 @@ [ "i2c-i801", "i2c_dev", - "i2c_mux_pca954x force_deselect_on_exit=1", + "i2c_mux_pca954x", "optoe" ], "pddf_kos": @@ -114,7 +114,7 @@ "i2c": { "topo_info": { "parent_bus":"0x0", "dev_addr":"0x77", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x1"}, + "dev_attr": { "virt_bus":"0x1", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"MUX2" }, @@ -137,7 +137,7 @@ "i2c": { "topo_info": { "parent_bus":"0x1", "dev_addr":"0x71", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x9"}, + "dev_attr": { "virt_bus":"0x9", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"PSU2"}, @@ -249,7 +249,7 @@ "i2c": { "topo_info": { "parent_bus":"0x1", "dev_addr":"0x76", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x11"}, + "dev_attr": { "virt_bus":"0x11", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"TEMP1" }, @@ -464,7 +464,7 @@ "i2c": { "topo_info": { "parent_bus":"0x1", "dev_addr":"0x73", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x19"}, + "dev_attr": { "virt_bus":"0x19", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"PORT61" }, @@ -484,7 +484,7 @@ "i2c": { "topo_info": { "parent_bus":"0x2", "dev_addr":"0x70", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x21"}, + "dev_attr": { "virt_bus":"0x21", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"PORT9" }, @@ -504,7 +504,7 @@ "i2c": { "topo_info": { "parent_bus":"0x2", "dev_addr":"0x71", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x29"}, + "dev_attr": { "virt_bus":"0x29", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"PORT6" }, @@ -524,7 +524,7 @@ "i2c": { "topo_info": { "parent_bus":"0x2", "dev_addr":"0x72", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x31"}, + "dev_attr": { "virt_bus":"0x31", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"PORT17" }, @@ -544,7 +544,7 @@ "i2c": { "topo_info": { "parent_bus":"0x2", "dev_addr":"0x73", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x39"}, + "dev_attr": { "virt_bus":"0x39", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"PORT29" }, @@ -564,7 +564,7 @@ "i2c": { "topo_info": { "parent_bus":"0x2", "dev_addr":"0x74", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x41"}, + "dev_attr": { "virt_bus":"0x41", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"PORT41" }, @@ -584,7 +584,7 @@ "i2c": { "topo_info": { "parent_bus":"0x2", "dev_addr":"0x75", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x49"}, + "dev_attr": { "virt_bus":"0x49", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"PORT45" }, @@ -604,7 +604,7 @@ "i2c": { "topo_info": { "parent_bus":"0x2", "dev_addr":"0x76", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x51"}, + "dev_attr": { "virt_bus":"0x51", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"PORT57" }, diff --git a/device/accton/x86_64-accton_as7816_64x-r0/platform_asic b/device/accton/x86_64-accton_as7816_64x-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/accton/x86_64-accton_as7816_64x-r0/pmon_daemon_control.json b/device/accton/x86_64-accton_as7816_64x-r0/pmon_daemon_control.json index 0d3f1fb4561d..a3b204e20d8d 100644 --- a/device/accton/x86_64-accton_as7816_64x-r0/pmon_daemon_control.json +++ b/device/accton/x86_64-accton_as7816_64x-r0/pmon_daemon_control.json @@ -1,6 +1,5 @@ { "skip_ledd": true, - "skip_pcied": true, - "skip_thermalctld": true + "skip_pcied": true } diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/__init__.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/__init__.py new file mode 100644 index 000000000000..73a7720e8979 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/__init__.py @@ -0,0 +1,2 @@ +__all__ = [ "platform", "chassis", "sfp", "eeprom", "component", "psu", "thermal", "fan", "fan_drawer" ] +from . import platform diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/chassis.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/chassis.py new file mode 100644 index 000000000000..44a759045b6b --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/chassis.py @@ -0,0 +1,250 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Chassis information which are available in the platform +# +############################################################################# + +import os +import sys + +try: + from sonic_platform_base.chassis_base import ChassisBase + from .helper import APIHelper + from .event import SfpEvent +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +NUM_FAN_TRAY = 4 +NUM_FAN = 2 +NUM_PSU = 2 +NUM_THERMAL = 6 +NUM_PORT = 64 +NUM_COMPONENT = 5 +HOST_REBOOT_CAUSE_PATH = "/host/reboot-cause/" +PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" +REBOOT_CAUSE_FILE = "reboot-cause.txt" +PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" +HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" +SYSLED_FNODE = "/sys/class/leds/as7816_64x_led::diag/brightness" +SYSLED_MODES = { + "0" : "STATUS_LED_COLOR_OFF", + "16" : "STATUS_LED_COLOR_GREEN", + "10" : "STATUS_LED_COLOR_RED" + +} + + +class Chassis(ChassisBase): + """Platform-specific Chassis class""" + + def __init__(self): + ChassisBase.__init__(self) + self._api_helper = APIHelper() + self.is_host = self._api_helper.is_host() + + self.config_data = {} + + self.__initialize_fan() + self.__initialize_psu() + self.__initialize_thermals() + self.__initialize_components() + self.__initialize_sfp() + self.__initialize_eeprom() + + def __initialize_sfp(self): + from sonic_platform.sfp import Sfp + for index in range(0, NUM_PORT): + sfp = Sfp(index) + self._sfp_list.append(sfp) + self._sfpevent = SfpEvent(self._sfp_list) + self.sfp_module_initialized = True + + def __initialize_fan(self): + from sonic_platform.fan_drawer import FanDrawer + for fant_index in range(NUM_FAN_TRAY): + fandrawer = FanDrawer(fant_index) + self._fan_drawer_list.append(fandrawer) + self._fan_list.extend(fandrawer._fan_list) + + def __initialize_psu(self): + from sonic_platform.psu import Psu + for index in range(0, NUM_PSU): + psu = Psu(index) + self._psu_list.append(psu) + + def __initialize_thermals(self): + from sonic_platform.thermal import Thermal + for index in range(0, NUM_THERMAL): + thermal = Thermal(index) + self._thermal_list.append(thermal) + + def __initialize_eeprom(self): + from sonic_platform.eeprom import Tlv + self._eeprom = Tlv() + + def __initialize_components(self): + from sonic_platform.component import Component + for index in range(0, NUM_COMPONENT): + component = Component(index) + self._component_list.append(component) + + def __initialize_watchdog(self): + from sonic_platform.watchdog import Watchdog + self._watchdog = Watchdog() + + + def __is_host(self): + return os.system(HOST_CHK_CMD) == 0 + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + data = fd.read() + return data.strip() + except IOError: + pass + return None + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + return self._eeprom.get_product_name() + + def get_presence(self): + """ + Retrieves the presence of the Chassis + Returns: + bool: True if Chassis is present, False if not + """ + return True + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return True + + def get_base_mac(self): + """ + Retrieves the base MAC address for the chassis + Returns: + A string containing the MAC address in the format + 'XX:XX:XX:XX:XX:XX' + """ + return self._eeprom.get_mac() + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return self._eeprom.get_pn() + + def get_serial(self): + """ + Retrieves the hardware serial number for the chassis + Returns: + A string containing the hardware serial number for this chassis. + """ + return self._eeprom.get_serial() + + def get_system_eeprom_info(self): + """ + Retrieves the full content of system EEPROM information for the chassis + Returns: + A dictionary where keys are the type code defined in + OCP ONIE TlvInfo EEPROM format and values are their corresponding + values. + """ + return self._eeprom.get_eeprom() + + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + Returns: + A tuple (string, string) where the first element is a string + containing the cause of the previous reboot. This string must be + one of the predefined strings in this class. If the first string + is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used + to pass a description of the reboot cause. + """ + + reboot_cause_path = (HOST_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE) + sw_reboot_cause = self._api_helper.read_txt_file( + reboot_cause_path) or "Unknown" + + + return ('REBOOT_CAUSE_NON_HARDWARE', sw_reboot_cause) + + def get_change_event(self, timeout=0): + # SFP event + if not self.sfp_module_initialized: + self.__initialize_sfp() + return self._sfpevent.get_sfp_event(timeout) + + def get_sfp(self, index): + """ + Retrieves sfp represented by (1-based) index + Args: + index: An integer, the index (1-based) of the sfp to retrieve. + The index should be the sequence of a physical port in a chassis, + starting from 1. + For example, 1 for Ethernet0, 2 for Ethernet4 and so on. + Returns: + An object dervied from SfpBase representing the specified sfp + """ + sfp = None + if not self.sfp_module_initialized: + self.__initialize_sfp() + + try: + # The index will start from 1 + sfp = self._sfp_list[index-1] + except IndexError: + sys.stderr.write("SFP index {} out of range (1-{})\n".format( + index, len(self._sfp_list))) + return sfp + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False + + + def initizalize_system_led(self): + return True + + def get_status_led(self): + val = self._api_helper.read_txt_file(SYSLED_FNODE) + return SYSLED_MODES[val] if val in SYSLED_MODES else "UNKNOWN" + + def set_status_led(self, color): + mode = None + for key, val in SYSLED_MODES.items(): + if val == color: + mode = key + break + if mode is None: + return False + else: + return self._api_helper.write_txt_file(SYSLED_FNODE, mode) diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/component.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/component.py new file mode 100644 index 000000000000..6af2f6008e72 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/component.py @@ -0,0 +1,177 @@ +############################################################################# +# Edgecore +# +# Component contains an implementation of SONiC Platform Base API and +# provides the components firmware management function +# +############################################################################# + +import shlex +import subprocess + +try: + from sonic_platform_base.component_base import ComponentBase + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CPLD_ADDR_MAPPING = { + "CPLD1": "19-0060", + "CPLD2": "20-0062", + "CPLD3": "21-0064", + "CPLD4": "22-0066", +} +SYSFS_PATH = "/sys/bus/i2c/devices/" +BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version" +COMPONENT_LIST= [ + ("CPLD1", "CPLD 1"), + ("CPLD2", "CPLD 2"), + ("CPLD3", "CPLD 3"), + ("CPLD4", "CPLD 4"), + ("BIOS", "Basic Input/Output System") + +] + +class Component(ComponentBase): + """Platform-specific Component class""" + + DEVICE_TYPE = "component" + + def __init__(self, component_index=0): + self._api_helper=APIHelper() + ComponentBase.__init__(self) + self.index = component_index + self.name = self.get_name() + + def __run_command(self, command): + # Run bash command and print output to stdout + try: + process = subprocess.Popen( + shlex.split(command), stdout=subprocess.PIPE) + while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + rc = process.poll() + if rc != 0: + return False + except Exception: + return False + return True + + def __get_bios_version(self): + # Retrieves the BIOS firmware version + try: + with open(BIOS_VERSION_PATH, 'r') as fd: + bios_version = fd.read() + return bios_version.strip() + except Exception as e: + return None + + def __get_cpld_version(self): + # Retrieves the CPLD firmware version + cpld_version = dict() + for cpld_name in CPLD_ADDR_MAPPING: + try: + cpld_path = "{}{}{}".format(SYSFS_PATH, CPLD_ADDR_MAPPING[cpld_name], '/version') + cpld_version_raw= self._api_helper.read_txt_file(cpld_path) + cpld_version[cpld_name] = "{}".format(int(cpld_version_raw,16)) + except Exception as e: + print('Get exception when read cpld') + cpld_version[cpld_name] = 'None' + + return cpld_version + + def get_name(self): + """ + Retrieves the name of the component + Returns: + A string containing the name of the component + """ + return COMPONENT_LIST[self.index][0] + + def get_description(self): + """ + Retrieves the description of the component + Returns: + A string containing the description of the component + """ + return COMPONENT_LIST[self.index][1] + + def get_firmware_version(self): + """ + Retrieves the firmware version of module + Returns: + string: The firmware versions of the module + """ + fw_version = None + + if self.name == "BIOS": + fw_version = self.__get_bios_version() + elif "CPLD" in self.name: + cpld_version = self.__get_cpld_version() + fw_version = cpld_version.get(self.name) + + return fw_version + + def install_firmware(self, image_path): + """ + Install firmware to module + Args: + image_path: A string, path to firmware image + Returns: + A boolean, True if install successfully, False if not + """ + raise NotImplementedError + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return 'N/A' + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return 'N/A' + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return True + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/eeprom.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/eeprom.py new file mode 100644 index 000000000000..c87f01c50a52 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/eeprom.py @@ -0,0 +1,134 @@ +try: + import os + import sys + import re + if sys.version_info[0] >= 3: + from io import StringIO + else: + from cStringIO import StringIO + + from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CACHE_ROOT = '/var/cache/sonic/decode-syseeprom' +CACHE_FILE = 'syseeprom_cache' +NULL = 'N/A' + +class Tlv(eeprom_tlvinfo.TlvInfoDecoder): + + EEPROM_DECODE_HEADLINES = 6 + + def __init__(self): + self._eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" + super(Tlv, self).__init__(self._eeprom_path, 0, '', True) + self._eeprom = self._load_eeprom() + + def __parse_output(self, decode_output): + decode_output.replace('\0', '') + lines = decode_output.split('\n') + lines = lines[self.EEPROM_DECODE_HEADLINES:] + _eeprom_info_dict = dict() + + for line in lines: + try: + match = re.search( + '(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)([\S]+)', line) + if match is not None: + idx = match.group(1) + value = match.group(3).rstrip('\0') + + _eeprom_info_dict[idx] = value + except Exception: + pass + + return _eeprom_info_dict + + def _load_eeprom(self): + original_stdout = sys.stdout + sys.stdout = StringIO() + try: + self.read_eeprom_db() + except Exception: + decode_output = sys.stdout.getvalue() + sys.stdout = original_stdout + return self.__parse_output(decode_output) + + status = self.check_status() + if 'ok' not in status: + return False + + if not os.path.exists(CACHE_ROOT): + try: + os.makedirs(CACHE_ROOT) + except Exception: + pass + + # + # only the eeprom classes that inherit from eeprom_base + # support caching. Others will work normally + # + try: + self.set_cache_name(os.path.join(CACHE_ROOT, CACHE_FILE)) + except Exception: + pass + + e = self.read_eeprom() + if e is None: + return 0 + + try: + self.update_cache(e) + except Exception: + pass + + self.decode_eeprom(e) + decode_output = sys.stdout.getvalue() + sys.stdout = original_stdout + + (is_valid, valid_crc) = self.is_checksum_valid(e) + if not is_valid: + return False + + return self.__parse_output(decode_output) + + def _valid_tlv(self, eeprom_data): + tlvinfo_type_codes_list = [ + self._TLV_CODE_PRODUCT_NAME, + self._TLV_CODE_PART_NUMBER, + self._TLV_CODE_SERIAL_NUMBER, + self._TLV_CODE_MAC_BASE, + self._TLV_CODE_MANUF_DATE, + self._TLV_CODE_DEVICE_VERSION, + self._TLV_CODE_LABEL_REVISION, + self._TLV_CODE_PLATFORM_NAME, + self._TLV_CODE_ONIE_VERSION, + self._TLV_CODE_MAC_SIZE, + self._TLV_CODE_MANUF_NAME, + self._TLV_CODE_MANUF_COUNTRY, + self._TLV_CODE_VENDOR_NAME, + self._TLV_CODE_DIAG_VERSION, + self._TLV_CODE_SERVICE_TAG, + self._TLV_CODE_VENDOR_EXT, + self._TLV_CODE_CRC_32 + ] + + for code in tlvinfo_type_codes_list: + code_str = "0x{:X}".format(code) + eeprom_data[code_str] = eeprom_data.get(code_str, NULL) + return eeprom_data + + def get_eeprom(self): + return self._valid_tlv(self._eeprom) + + def get_pn(self): + return self._eeprom.get('0x22', NULL) + + def get_serial(self): + return self._eeprom.get('0x23', NULL) + + def get_mac(self): + return self._eeprom.get('0x24', NULL) + + def get_product_name(self): + return self._eeprom.get('0x21', NULL) diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/event.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/event.py new file mode 100644 index 000000000000..eb845c7e4aad --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/event.py @@ -0,0 +1,62 @@ +try: + import time + from .helper import APIHelper + from sonic_py_common.logger import Logger +except ImportError as e: + raise ImportError(repr(e) + " - required module not found") + +POLL_INTERVAL_IN_SEC = 1 + +class SfpEvent: + ''' Listen to insert/remove sfp events ''' + + def __init__(self, sfp_list): + self._api_helper = APIHelper() + self._sfp_list = sfp_list + self._logger = Logger() + self._sfp_change_event_data = {'present': 0} + + def get_presence_bitmap(self): + bitmap = 0 + for sfp in self._sfp_list: + modpres = sfp.get_presence() + i=sfp.port_num-1 + if modpres: + bitmap = bitmap | (1 << i) + return bitmap + + def get_sfp_event(self, timeout=2000): + port_dict = {} + change_dict = {} + change_dict['sfp'] = port_dict + + if timeout < 1000: + cd_ms = 1000 + else: + cd_ms = timeout + + while cd_ms > 0: + bitmap = self.get_presence_bitmap() + changed_ports = self._sfp_change_event_data['present'] ^ bitmap + if changed_ports != 0: + break + time.sleep(POLL_INTERVAL_IN_SEC) + # timeout=0 means wait for event forever + if timeout != 0: + cd_ms = cd_ms - POLL_INTERVAL_IN_SEC * 1000 + + if changed_ports != 0: + for sfp in self._sfp_list: + i=sfp.port_num-1 + if (changed_ports & (1 << i)): + if (bitmap & (1 << i)) == 0: + port_dict[i+1] = '0' + else: + port_dict[i+1] = '1' + + + # Update the cache dict + self._sfp_change_event_data['present'] = bitmap + return True, change_dict + else: + return True, change_dict diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/fan.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/fan.py new file mode 100644 index 000000000000..0ec1fc3962f9 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/fan.py @@ -0,0 +1,263 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the fan status which are available in the platform +# +############################################################################# + +try: + from sonic_platform_base.fan_base import FanBase + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +SPEED_TOLERANCE = 15 +CPLD_FAN_I2C_PATH = "/sys/bus/i2c/devices/17-0068/fan" +I2C_PATH ="/sys/bus/i2c/devices/{}-00{}/" +PSU_HWMON_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "5b" + }, + 1: { + "num": 9, + "addr": "58" + }, +} + +PSU_CPLD_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "53" + }, + 1: { + "num": 9, + "addr": "50" + }, +} + +FAN_NAME_LIST = ["FAN-1F", "FAN-1R", "FAN-2F", "FAN-2R", + "FAN-3F", "FAN-3R", "FAN-4F", "FAN-4R"] + +class Fan(FanBase): + """Platform-specific Fan class""" + + def __init__(self, fan_tray_index, fan_index=0, is_psu_fan=False, psu_index=0): + self._api_helper=APIHelper() + self.fan_index = fan_index + self.fan_tray_index = fan_tray_index + self.is_psu_fan = is_psu_fan + + + if self.is_psu_fan: + self.psu_index = psu_index + self.psu_i2c_num = PSU_HWMON_I2C_MAPPING[self.psu_index]['num'] + self.psu_i2c_addr = PSU_HWMON_I2C_MAPPING[self.psu_index]['addr'] + self.psu_hwmon_path = I2C_PATH.format( + self.psu_i2c_num, self.psu_i2c_addr) + + self.psu_i2c_num = PSU_CPLD_I2C_MAPPING[self.psu_index]['num'] + self.psu_i2c_addr = PSU_CPLD_I2C_MAPPING[self.psu_index]['addr'] + self.psu_cpld_path = I2C_PATH.format( + self.psu_i2c_num, self.psu_i2c_addr) + + FanBase.__init__(self) + + + def get_direction(self): + """ + Retrieves the direction of fan + Returns: + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + """ + if not self.is_psu_fan: + dir_str = "{}{}{}".format(CPLD_FAN_I2C_PATH, self.fan_tray_index+1, '_direction') + val=self._api_helper.read_txt_file(dir_str) + if val is not None: #F2B is FAN_DIRECTION_EXHAUST + direction = self.FAN_DIRECTION_EXHAUST if ( + val == "0") else self.FAN_DIRECTION_INTAKE + else: + direction=self.FAN_DIRECTION_EXHAUST + + else: #For PSU + direction=self.FAN_DIRECTION_EXHAUST + + return direction + + def get_speed(self): + """ + Retrieves the speed of fan as a percentage of full speed + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + """ + speed = 0 + if self.is_psu_fan: + psu_fan_path= "{}{}".format(self.psu_hwmon_path, 'psu_fan1_speed_rpm') + fan_speed_rpm = self._api_helper.read_txt_file(psu_fan_path) + if fan_speed_rpm is not None: + speed = (int(fan_speed_rpm,10))*100/26688 + if speed > 100: + speed=100 + else: + return 0 + elif self.get_presence(): + speed_path = "{}{}".format(CPLD_FAN_I2C_PATH, '_duty_cycle_percentage') + speed=self._api_helper.read_txt_file(speed_path) + if speed is None: + return 0 + return int(speed) + + def get_target_speed(self): + """ + Retrieves the target (expected) speed of the fan + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + Note: + speed_pc = pwm_target/255*100 + 0 : when PWM mode is use + pwm : when pwm mode is not use + """ + return self.get_speed() + + def get_speed_tolerance(self): + """ + Retrieves the speed tolerance of the fan + Returns: + An integer, the percentage of variance from target speed which is + considered tolerable + """ + return SPEED_TOLERANCE + + def set_speed(self, speed): + """ + Sets the fan speed + Args: + speed: An integer, the percentage of full fan speed to set fan to, + in the range 0 (off) to 100 (full speed) + Returns: + A boolean, True if speed is set successfully, False if not + """ + + if not self.is_psu_fan and self.get_presence(): + speed_path = "{}{}".format(CPLD_FAN_I2C_PATH, '_duty_cycle_percentage') + return self._api_helper.write_txt_file(speed_path, int(speed)) + + return False + + def set_status_led(self, color): + """ + Sets the state of the fan module status LED + Args: + color: A string representing the color with which to set the + fan module status LED + Returns: + bool: True if status LED state is set successfully, False if not + """ + return False #Not supported + + def get_status_led(self): + """ + Gets the state of the fan status LED + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + status=self.get_presence() + if status is None: + return self.STATUS_LED_COLOR_OFF + + return { + 1: self.STATUS_LED_COLOR_GREEN, + 0: self.STATUS_LED_COLOR_RED + }.get(status, self.STATUS_LED_COLOR_OFF) + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + fan_name = FAN_NAME_LIST[self.fan_tray_index*2 + self.fan_index] \ + if not self.is_psu_fan \ + else "PSU-{} FAN-{}".format(self.psu_index+1, self.fan_index+1) + + return fan_name + + def get_presence(self): + """ + Retrieves the presence of the FAN + Returns: + bool: True if FAN is present, False if not + """ + present_path = "{}{}{}".format(CPLD_FAN_I2C_PATH, self.fan_tray_index+1, '_present') + val=self._api_helper.read_txt_file(present_path) + if not self.is_psu_fan: + if val is not None: + return int(val, 10)==1 + else: + return False + else: + return True + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + if self.is_psu_fan: + psu_fan_path= "{}{}".format(self.psu_hwmon_path, 'psu_fan1_fault') + val=self._api_helper.read_txt_file(psu_fan_path) + if val is not None: + return int(val, 10)==0 + else: + return False + else: + path = "{}{}{}".format(CPLD_FAN_I2C_PATH, self.fan_tray_index+1, '_fault') + val=self._api_helper.read_txt_file(path) + if val is not None: + return int(val, 10)==0 + else: + return False + + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + + return "N/A" + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return "N/A" + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return (self.fan_index+1) \ + if not self.is_psu_fan else (self.psu_index+1) + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True if not self.is_psu_fan else False diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/fan_drawer.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..17d339ee55f6 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/fan_drawer.py @@ -0,0 +1,90 @@ +######################################################################## +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Fan-Drawers' information available in the platform. +# +######################################################################## + +try: + from sonic_platform_base.fan_drawer_base import FanDrawerBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +FANS_PER_FANTRAY = 2 + + +class FanDrawer(FanDrawerBase): + """Platform-specific Fan class""" + + def __init__(self, fantray_index): + + FanDrawerBase.__init__(self) + # FanTray is 0-based in platforms + self.fantrayindex = fantray_index + self.__initialize_fan_drawer() + + + def __initialize_fan_drawer(self): + from sonic_platform.fan import Fan + for i in range(FANS_PER_FANTRAY): + self._fan_list.append(Fan(self.fantrayindex, i)) + + def get_name(self): + """ + Retrieves the fan drawer name + Returns: + string: The name of the device + """ + return "FanTray{}".format(self.fantrayindex+1) + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + return self._fan_list[0].get_presence() + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return self._fan_list[0].get_model() + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return self._fan_list[0].get_serial() + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return self._fan_list[0].get_status() + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return (self.fantrayindex+1) + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/helper.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/helper.py new file mode 100644 index 000000000000..b124ca29f0df --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/helper.py @@ -0,0 +1,117 @@ +import os +import struct +import subprocess +from mmap import * +from sonic_py_common import device_info + +HOST_CHK_CMD = "docker > /dev/null 2>&1" +EMPTY_STRING = "" + + +class APIHelper(): + + def __init__(self): + (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() + + def is_host(self): + return os.system(HOST_CHK_CMD) == 0 + + def pci_get_value(self, resource, offset): + status = True + result = "" + try: + fd = os.open(resource, os.O_RDWR) + mm = mmap(fd, 0) + mm.seek(int(offset)) + read_data_stream = mm.read(4) + result = struct.unpack('I', read_data_stream) + except Exception: + status = False + return status, result + + def run_command(self, cmd): + status = True + result = "" + try: + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err == '': + result = raw_data.strip() + except Exception: + status = False + return status, result + + def run_interactive_command(self, cmd): + try: + os.system(cmd) + except Exception: + return False + return True + + def read_txt_file(self, file_path): + try: + with open(file_path, 'r', errors='replace') as fd: + data = fd.read() + return data.strip() + except IOError: + pass + return None + + def write_txt_file(self, file_path, value): + try: + with open(file_path, 'w') as fd: + fd.write(str(value)) + except IOError: + return False + return True + + def ipmi_raw(self, netfn, cmd): + status = True + result = "" + try: + cmd = "ipmitool raw {} {}".format(str(netfn), str(cmd)) + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err == '': + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result + + def ipmi_fru_id(self, id, key=None): + status = True + result = "" + try: + cmd = "ipmitool fru print {}".format(str( + id)) if not key else "ipmitool fru print {0} | grep '{1}' ".format(str(id), str(key)) + + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err == '': + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result + + def ipmi_set_ss_thres(self, id, threshold_key, value): + status = True + result = "" + try: + cmd = "ipmitool sensor thresh '{}' {} {}".format(str(id), str(threshold_key), str(value)) + p = subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + if err == '': + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/platform.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/platform.py new file mode 100644 index 000000000000..2f2c2a447fcf --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/platform.py @@ -0,0 +1,21 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + +try: + from sonic_platform_base.platform_base import PlatformBase + from sonic_platform.chassis import Chassis +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PlatformBase): + """Platform-specific Platform class""" + + def __init__(self): + PlatformBase.__init__(self) + self._chassis = Chassis() diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/psu.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/psu.py new file mode 100644 index 000000000000..53dd058bbac7 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/psu.py @@ -0,0 +1,283 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +try: + from sonic_platform_base.psu_base import PsuBase + from sonic_platform.thermal import Thermal + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +I2C_PATH ="/sys/bus/i2c/devices/{0}-00{1}/" + +PSU_NAME_LIST = ["PSU-1", "PSU-2"] +PSU_NUM_FAN = [1, 1] +PSU_CPLD_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "53" + }, + 1: { + "num": 9, + "addr": "50" + }, +} + +PSU_HWMON_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "5b" + }, + 1: { + "num": 9, + "addr": "58" + }, +} + +NUM_FAN_TRAY = 4 + +class Psu(PsuBase): + """Platform-specific Psu class""" + def __init__(self, psu_index=0): + PsuBase.__init__(self) + self.index = psu_index + self._api_helper = APIHelper() + + self.i2c_num = PSU_HWMON_I2C_MAPPING[self.index]["num"] + self.i2c_addr = PSU_HWMON_I2C_MAPPING[self.index]["addr"] + self.hwmon_path = I2C_PATH.format(self.i2c_num, self.i2c_addr) + + self.i2c_num = PSU_CPLD_I2C_MAPPING[self.index]["num"] + self.i2c_addr = PSU_CPLD_I2C_MAPPING[self.index]["addr"] + self.cpld_path = I2C_PATH.format(self.i2c_num, self.i2c_addr) + + self.__initialize_fan() + + def __initialize_fan(self): + from sonic_platform.fan import Fan + self._fan_list.append( + Fan(NUM_FAN_TRAY + self.index, + is_psu_fan=True, + psu_index=self.index)) + self._thermal_list.append(Thermal(is_psu=True, psu_index=self.index)) + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + return fd.read().strip() + except IOError: + pass + return None + + def get_voltage(self): + """ + Retrieves current PSU voltage output + Returns: + A float number, the output voltage in volts, + e.g. 12.1 + """ + vout_path = "{}{}".format(self.hwmon_path, 'psu_v_out') + vout_val=self._api_helper.read_txt_file(vout_path) + + if vout_val is not None: + return float(vout_val)/ 1000 + else: + return 0 + + def get_current(self): + """ + Retrieves present electric current supplied by PSU + Returns: + A float number, the electric current in amperes, e.g 15.4 + """ + iout_path = "{}{}".format(self.hwmon_path, 'psu_i_out') + val=self._api_helper.read_txt_file(iout_path) + if val is not None: + return float(val)/1000 + else: + return 0 + + def get_power(self): + """ + Retrieves current energy supplied by PSU + Returns: + A float number, the power in watts, e.g. 302.6 + """ + pout_path = "{}{}".format(self.hwmon_path, 'psu_p_out') + val=self._api_helper.read_txt_file(pout_path) + if val is not None: + return float(val)/1000 + else: + return 0 + + def get_powergood_status(self): + """ + Retrieves the powergood status of PSU + Returns: + A boolean, True if PSU has stablized its output voltages and passed all + its internal self-tests, False if not. + """ + return self.get_status() + + def set_status_led(self, color): + """ + Sets the state of the PSU status LED + Args: + color: A string representing the color with which to set the PSU status LED + Note: Only support green and off + Returns: + bool: True if status LED state is set successfully, False if not + """ + + return False #Controlled by HW + + def get_status_led(self): + """ + Gets the state of the PSU status LED + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + status=self.get_status() + if status is None: + return self.STATUS_LED_COLOR_OFF + + return { + 1: self.STATUS_LED_COLOR_GREEN, + 0: self.STATUS_LED_COLOR_RED + }.get(status, self.STATUS_LED_COLOR_OFF) + + def get_temperature(self): + """ + Retrieves current temperature reading from PSU + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + temp_path = "{}{}".format(self.hwmon_path, 'psu_temp1_input') + val=self._api_helper.read_txt_file(temp_path) + if val is not None: + return float(val)/1000 + else: + return 0 + + def get_temperature_high_threshold(self): + """ + Retrieves the high threshold temperature of PSU + Returns: + A float number, the high threshold temperature of PSU in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + return False #Not supported + + def get_voltage_high_threshold(self): + """ + Retrieves the high threshold PSU voltage output + Returns: + A float number, the high threshold output voltage in volts, + e.g. 12.1 + """ + vout_path = "{}{}".format(self.hwmon_path, 'psu_mfr_vout_max') + vout_val=self._api_helper.read_txt_file(vout_path) + if vout_val is not None: + return float(vout_val)/ 1000 + else: + return 0 + + def get_voltage_low_threshold(self): + """ + Retrieves the low threshold PSU voltage output + Returns: + A float number, the low threshold output voltage in volts, + e.g. 12.1 + """ + vout_path = "{}{}".format(self.hwmon_path, 'psu_mfr_vout_min') + vout_val=self._api_helper.read_txt_file(vout_path) + if vout_val is not None: + return float(vout_val)/ 1000 + else: + return 0 + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + return PSU_NAME_LIST[self.index] + + def get_presence(self): + """ + Retrieves the presence of the PSU + Returns: + bool: True if PSU is present, False if not + """ + presence_path="{}{}".format(self.cpld_path, 'psu_present') + val=self._api_helper.read_txt_file(presence_path) + if val is not None: + return int(val, 10) == 1 + else: + return 0 + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + power_path="{}{}".format(self.cpld_path, 'psu_power_good') + val=self._api_helper.read_txt_file(power_path) + if val is not None: + return int(val, 10) == 1 + else: + return 0 + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + model_path="{}{}".format(self.hwmon_path, 'psu_mfr_model') + val=self._api_helper.read_txt_file(model_path) + if val is None: + return "N/A" + model=val[1:] + + return model + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + serial_path="{}{}".format(self.hwmon_path, 'psu_mfr_serial') + val=self._api_helper.read_txt_file(serial_path) + if val is None: + return "N/A" + serial=val[1:] + + return serial + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.index+1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/sfp.py new file mode 100644 index 000000000000..01e568ef3e78 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/sfp.py @@ -0,0 +1,506 @@ +############################################################################# +# Edgecore +# +# Sfp contains an implementation of SONiC Platform Base API and +# provides the sfp device status which are available in the platform +# +############################################################################# + +import os +import time +import sys + +from ctypes import create_string_buffer + +try: + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CPLD_I2C_PATH = "/sys/bus/i2c/devices/19-0060/" + + +class Sfp(SfpOptoeBase): + """Platform-specific Sfp class""" + + # Port number + PORT_START = 1 + PORT_END = 64 + + # Path to sysfs + PLATFORM_ROOT_PATH = "/usr/share/sonic/device" + PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" + HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" + + PLATFORM = "x86_64-accton_as7816_64x-r0" + HWSKU = "Accton-AS7816-64X" + + _port_to_i2c_mapping = { + 61: 25, + 62: 26, + 63: 27, + 64: 28, + 55: 29, + 56: 30, + 53: 31, + 54: 32, + 9: 33, + 10: 34, + 11: 35, + 12: 36, + 1: 37, + 2: 38, + 3: 39, + 4: 40, + 6: 41, + 5: 42, + 8: 43, + 7: 44, + 13: 45, + 14: 46, + 15: 47, + 16: 48, + 17: 49, + 18: 50, + 19: 51, + 20: 52, + 25: 53, + 26: 54, + 27: 55, + 28: 56, + 29: 57, + 30: 58, + 31: 59, + 32: 60, + 21: 61, + 22: 62, + 23: 63, + 24: 64, + 41: 65, + 42: 66, + 43: 67, + 44: 68, + 33: 69, + 34: 70, + 35: 71, + 36: 72, + 45: 73, + 46: 74, + 47: 75, + 48: 76, + 37: 77, + 38: 78, + 39: 79, + 40: 80, + 57: 81, + 58: 82, + 59: 83, + 60: 84, + 49: 85, + 50: 86, + 51: 87, + 52: 88 + } + + def __init__(self, sfp_index=0): + SfpOptoeBase.__init__(self) + self._api_helper=APIHelper() + # Init index + self.index = sfp_index + self.port_num = self.index + 1 + # Init eeprom path + eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom' + self.port_to_eeprom_mapping = {} + for x in range(self.PORT_START, self.PORT_END + 1): + self.port_to_eeprom_mapping[x] = eeprom_path.format(self._port_to_i2c_mapping[x]) + + def get_eeprom_path(self): + return self.port_to_eeprom_mapping[self.port_num] + + def __is_host(self): + return os.system(self.HOST_CHK_CMD) == 0 + + def __get_path_to_port_config_file(self): + platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) + hwsku_path = "/".join([platform_path, self.HWSKU] + ) if self.__is_host() else self.PMON_HWSKU_PATH + return "/".join([hwsku_path, "port_config.ini"]) + + def __read_eeprom_specific_bytes(self, offset, num_bytes): + sysfsfile_eeprom = None + eeprom_raw = [] + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + sysfs_sfp_i2c_client_eeprom_path = self.port_to_eeprom_mapping[self.port_num] + try: + sysfsfile_eeprom = open( + sysfs_sfp_i2c_client_eeprom_path, mode="rb", buffering=0) + sysfsfile_eeprom.seek(offset) + raw = sysfsfile_eeprom.read(num_bytes) + if sys.version_info[0] >= 3: + for n in range(0, num_bytes): + eeprom_raw[n] = hex(raw[n])[2:].zfill(2) + else: + for n in range(0, num_bytes): + eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + except Exception: + pass + finally: + if sysfsfile_eeprom: + sysfsfile_eeprom.close() + + return eeprom_raw + + def get_reset_status(self): + """ + Retrieves the reset status of SFP + Returns: + A Boolean, True if reset enabled, False if disabled + """ + reset_path="{}{}{}".format(CPLD_I2C_PATH , "module_reset_" , str(self.port_num)) + val = self._api_helper.read_txt_file(reset_path) + + if val is not None: + return int(val, 10) == 1 + else: + return False + + def get_rx_los(self): + """ + Retrieves the RX LOS (lost-of-signal) status of SFP + Returns: + A Boolean, True if SFP has RX LOS, False if not. + Note : RX LOS status is latched until a call to get_rx_los or a reset. + """ + + rx_los_list = [] + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + QSFP_CHANNL_RX_LOS_STATUS_OFFSET, QSFP_CHANNL_RX_LOS_STATUS_WIDTH) if self.get_presence() else None + if dom_channel_monitor_raw is not None: + rx_los_data = int(dom_channel_monitor_raw[0], 16) + rx_los_list.append(rx_los_data & 0x01 != 0) + rx_los_list.append(rx_los_data & 0x02 != 0) + rx_los_list.append(rx_los_data & 0x04 != 0) + rx_los_list.append(rx_los_data & 0x08 != 0) + return rx_los_list + else: + return [False]*4 + + + def get_tx_fault(self): + """ + Retrieves the TX fault status of SFP + Returns: + A Boolean, True if SFP has TX fault, False if not + Note : TX fault status is lached until a call to get_tx_fault or a reset. + """ + tx_fault_list = [] + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + QSFP_CHANNL_TX_FAULT_STATUS_OFFSET, QSFP_CHANNL_TX_FAULT_STATUS_WIDTH) if self.get_presence() else None + if dom_channel_monitor_raw is not None: + tx_fault_data = int(dom_channel_monitor_raw[0], 16) + tx_fault_list.append(tx_fault_data & 0x01 != 0) + tx_fault_list.append(tx_fault_data & 0x02 != 0) + tx_fault_list.append(tx_fault_data & 0x04 != 0) + tx_fault_list.append(tx_fault_data & 0x08 != 0) + return tx_fault_list + else: + return [False]*4 + + def get_tx_disable(self): + """ + Retrieves the tx_disable status of this SFP + Returns: + A Boolean, True if tx_disable is enabled, False if disabled + """ + + tx_disable_list = [] + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return False + + dom_control_raw = self.__read_eeprom_specific_bytes( + QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None + if dom_control_raw is not None: + dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX1Disable']['value']) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX2Disable']['value']) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX3Disable']['value']) + tx_disable_list.append( + 'On' == dom_control_data['data']['TX4Disable']['value']) + return tx_disable_list + else: + return [False]*4 + + def get_tx_disable_channel(self): + """ + Retrieves the TX disabled channels in this SFP + Returns: + A hex of 4 bits (bit 0 to bit 3 as channel 0 to channel 3) to represent + TX channels which have been disabled in this SFP. + As an example, a returned value of 0x5 indicates that channel 0 + and channel 2 have been disabled. + """ + tx_disable_list = self.get_tx_disable() + if tx_disable_list is None: + return 0 + tx_disabled = 0 + for i in range(len(tx_disable_list)): + if tx_disable_list[i]: + tx_disabled |= 1 << i + return tx_disabled + + def get_lpmode(self): + """ + Retrieves the lpmode (low power mode) status of this SFP + Returns: + A Boolean, True if lpmode is enabled, False if disabled + """ + + power_set=self.get_power_set() + power_override = self.get_power_override() + return power_set and power_override + + def get_power_set(self): + power_set = False + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return False + dom_control_raw = self.__read_eeprom_specific_bytes( + QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None + if dom_control_raw is not None: + dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) + power_set = ( + 'On' == dom_control_data['data']['PowerSet']['value']) + + return power_set + + def get_power_override(self): + """ + Retrieves the power-override status of this SFP + Returns: + A Boolean, True if power-override is enabled, False if disabled + """ + power_override = False + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return False + + dom_control_raw = self.__read_eeprom_specific_bytes( + QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None + if dom_control_raw is not None: + dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) + power_override = ( + 'On' == dom_control_data['data']['PowerOverride']['value']) + + return power_override + + def reset(self): + """ + Reset SFP and return all user module settings to their default srate. + Returns: + A boolean, True if successful, False if not + """ + reset_path = "{}{}{}".format(CPLD_I2C_PATH , 'module_reset_' , self.port_num) + ret = self._api_helper.write_txt_file(reset_path, 1) + if ret is not True: + return ret + + time.sleep(0.01) + ret = self._api_helper.write_txt_file(reset_path, 0) + time.sleep(0.2) + + return ret + + def tx_disable(self, tx_disable): + """ + Disable SFP TX for all channels + Args: + tx_disable : A Boolean, True to enable tx_disable mode, False to disable + tx_disable mode. + Returns: + A boolean, True if tx_disable is set successfully, False if not + """ + if not self.get_presence(): + return False + sysfsfile_eeprom = None + try: + tx_disable_ctl = 0xf if tx_disable else 0x0 + buffer = create_string_buffer(1) + if sys.version_info[0] >= 3: + buffer[0] = tx_disable_ctl + else: + buffer[0] = chr(tx_disable_ctl) + # Write to eeprom + sysfsfile_eeprom = open( + self.port_to_eeprom_mapping[self.port_num], "r+b") + sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print ('Error: unable to open file: ',str(e)) + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + + return True + + def tx_disable_channel(self, channel, disable): + """ + Sets the tx_disable for specified SFP channels + Args: + channel : A hex of 4 bits (bit 0 to bit 3) which represent channel 0 to 3, + e.g. 0x5 for channel 0 and channel 2. + disable : A boolean, True to disable TX channels specified in channel, + False to enable + Returns: + A boolean, True if successful, False if not + """ + if not self.get_presence(): + return False + + sysfsfile_eeprom = None + try: + channel_state = self.get_tx_disable_channel() + for i in range(4): + channel_mask = (1 << i) + if not (channel & channel_mask): + continue + + if disable: + channel_state |= channel_mask + else: + channel_state &= ~channel_mask + + buffer = create_string_buffer(1) + if sys.version_info[0] >= 3: + buffer[0] = channel_state + else: + buffer[0] = chr(channel_state) + # Write to eeprom + sysfsfile_eeprom = open( + self.port_to_eeprom_mapping[self.port_num], "r+b") + sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print ('Error: unable to open file: ', str(e)) + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + + return True + + def set_lpmode(self, lpmode): + """ + Sets the lpmode (low power mode) of SFP + Args: + lpmode: A Boolean, True to enable lpmode, False to disable it + Note : lpmode can be overridden by set_power_override + Returns: + A boolean, True if lpmode is set successfully, False if not + """ + if lpmode: + self.set_power_override(True, True) + else: + self.set_power_override(False, False) + + return True + + def set_power_override(self, power_override, power_set): + """ + Sets SFP power level using power_override and power_set + Args: + power_override : + A Boolean, True to override set_lpmode and use power_set + to control SFP power, False to disable SFP power control + through power_override/power_set and use set_lpmode + to control SFP power. + power_set : + Only valid when power_override is True. + A Boolean, True to set SFP to low power mode, False to set + SFP to high power mode. + Returns: + A boolean, True if power-override and power_set are set successfully, + False if not + """ + + if not self.get_presence(): + return False + try: + power_override_bit = (1 << 0) if power_override else 0 + power_set_bit = (1 << 1) if power_set else (1 << 3) + + buffer = create_string_buffer(1) + if sys.version_info[0] >= 3: + buffer[0] = (power_override_bit | power_set_bit) + else: + buffer[0] = chr(power_override_bit | power_set_bit) + # Write to eeprom + with open(self.port_to_eeprom_mapping[self.port_num], "r+b") as fd: + fd.seek(QSFP_POWEROVERRIDE_OFFSET) + fd.write(buffer[0]) + time.sleep(0.01) + except Exception: + print ('Error: unable to open file: ', str(e)) + return False + + return True + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + sfputil_helper = SfpUtilHelper() + sfputil_helper.read_porttab_mappings( + self.__get_path_to_port_config_file()) + name = sfputil_helper.logical[self.index] or "Unknown" + return name + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + present_path = "{}{}{}".format(CPLD_I2C_PATH , '/module_present_' , self.port_num) + val=self._api_helper.read_txt_file(present_path) + if val is not None: + return int(val, 10)==1 + else: + return False + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return self.get_presence() + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.port_num + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True diff --git a/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/thermal.py b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/thermal.py new file mode 100644 index 000000000000..34256bf8c244 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/sonic_platform/thermal.py @@ -0,0 +1,236 @@ +############################################################################# +# Edgecore +# +# Thermal contains an implementation of SONiC Platform Base API and +# provides the thermal device status which are available in the platform +# +############################################################################# + +import os +import os.path +import glob + +try: + from sonic_platform_base.thermal_base import ThermalBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +PSU_I2C_PATH = "/sys/bus/i2c/devices/{}-00{}/" + +PSU_HWMON_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "5b" + }, + 1: { + "num": 9, + "addr": "58" + }, +} + +PSU_CPLD_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "53" + }, + 1: { + "num": 9, + "addr": "50" + }, +} + +THERMAL_NAME_LIST = ["Temp sensor 1", "Temp sensor 2", "Temp sensor 3", + "Temp sensor 4", "Temp sensor 5", "Temp sensor 6"] + +PSU_THERMAL_NAME_LIST = ["PSU-1 temp sensor 1", "PSU-2 temp sensor 2"] + +SYSFS_PATH = "/sys/bus/i2c/devices" + +class Thermal(ThermalBase): + """Platform-specific Thermal class""" + + def __init__(self, thermal_index=0, is_psu=False, psu_index=0): + self.index = thermal_index + self.is_psu = is_psu + self.psu_index = psu_index + + if self.is_psu: + psu_i2c_bus = PSU_HWMON_I2C_MAPPING[psu_index]["num"] + psu_i2c_addr = PSU_HWMON_I2C_MAPPING[psu_index]["addr"] + self.psu_hwmon_path = PSU_I2C_PATH.format(psu_i2c_bus, + psu_i2c_addr) + psu_i2c_bus = PSU_CPLD_I2C_MAPPING[psu_index]["num"] + psu_i2c_addr = PSU_CPLD_I2C_MAPPING[psu_index]["addr"] + self.cpld_path = PSU_I2C_PATH.format(psu_i2c_bus, psu_i2c_addr) + + # Set hwmon path + i2c_path = { + 0: "18-0048/hwmon/hwmon*/", + 1: "18-0049/hwmon/hwmon*/", + 2: "18-004a/hwmon/hwmon*/", + 3: "18-004b/hwmon/hwmon*/", + 4: "17-004d/hwmon/hwmon*/", + 5: "17-004d/hwmon/hwmon*/" + }.get(self.index, None) + + self.hwmon_path = "{}/{}".format(SYSFS_PATH, i2c_path) + self.ss_key = THERMAL_NAME_LIST[self.index] + self.ss_index = 1 + + def __read_txt_file(self, file_path): + for filename in glob.glob(file_path): + try: + with open(filename, 'r') as fd: + data =fd.readline().rstrip() + return data + except IOError as e: + pass + + return None + + def __get_temp(self, temp_file): + if not self.is_psu: + temp_file_path = os.path.join(self.hwmon_path, temp_file) + else: + temp_file_path = temp_file + raw_temp = self.__read_txt_file(temp_file_path) + if raw_temp is not None: + return float(raw_temp)/1000 + else: + return 0 + + def __set_threshold(self, file_name, temperature): + if self.is_psu: + return True + temp_file_path = os.path.join(self.hwmon_path, file_name) + for filename in glob.glob(temp_file_path): + try: + with open(filename, 'w') as fd: + fd.write(str(temperature)) + return True + except IOError as e: + print("IOError") + return False + + + def get_temperature(self): + """ + Retrieves current temperature reading from thermal + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + if not self.is_psu: + temp_file = "temp{}_input".format(self.ss_index) + else: + temp_file = self.psu_hwmon_path + "psu_temp1_input" + return self.__get_temp(temp_file) + + def get_high_threshold(self): + """ + Retrieves the high threshold temperature of thermal + Returns: + A float number, the high threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.is_psu: + return 80 + + temp_file = "temp{}_max".format(self.ss_index) + return self.__get_temp(temp_file) + + def set_high_threshold(self, temperature): + """ + Sets the high threshold temperature of thermal + Args : + temperature: A float number up to nearest thousandth of one degree Celsius, + e.g. 30.125 + Returns: + A boolean, True if threshold is set successfully, False if not + """ + temp_file = "temp{}_max".format(self.ss_index) + temperature = temperature *1000 + self.__set_threshold(temp_file, temperature) + + return True + + def get_name(self): + """ + Retrieves the name of the thermal device + Returns: + string: The name of the thermal device + """ + if self.is_psu: + return PSU_THERMAL_NAME_LIST[self.psu_index] + else: + return THERMAL_NAME_LIST[self.index] + + def get_presence(self): + """ + Retrieves the presence of the Thermal + Returns: + bool: True if Thermal is present, False if not + """ + if self.is_psu: + val = self.__read_txt_file(self.cpld_path + "psu_present") + return int(val, 10) == 1 + temp_file = "temp{}_input".format(self.ss_index) + temp_file_path = os.path.join(self.hwmon_path, temp_file) + raw_txt = self.__read_txt_file(temp_file_path) + if raw_txt is not None: + return True + else: + return False + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + if self.is_psu: + temp_file = self.psu_hwmon_path + "psu_temp_fault" + return self.get_presence() and (not int( + self.__read_txt_file(temp_file))) + + file_str = "temp{}_input".format(self.ss_index) + file_path = os.path.join(self.hwmon_path, file_str) + raw_txt = self.__read_txt_file(file_path) + if raw_txt is None: + return False + else: + return int(raw_txt) != 0 + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + + return "N/A" + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return "N/A" + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.index+1 + + def is_replaceable(self): + """ + Retrieves whether thermal module is replaceable + Returns: + A boolean value, True if replaceable, False if not + """ + return False diff --git a/device/accton/x86_64-accton_as7816_64x-r0/system_health_monitoring_config.json b/device/accton/x86_64-accton_as7816_64x-r0/system_health_monitoring_config.json new file mode 100644 index 000000000000..92be29dfdea6 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/system_health_monitoring_config.json @@ -0,0 +1,15 @@ +{ + "services_to_ignore": [], + "devices_to_ignore": [ + "asic", + "psu.temperature" + + ], + "user_defined_checkers": [], + "polling_interval": 60, + "led_color": { + "fault": "STATUS_LED_COLOR_RED", + "normal": "STATUS_LED_COLOR_GREEN", + "booting": "STATUS_LED_COLOR_GREEN" + } +} diff --git a/device/accton/x86_64-accton_as9716_32d-r0/pddf/pddf-device.json b/device/accton/x86_64-accton_as9716_32d-r0/pddf/pddf-device.json index 21a9bef87b70..ce592286078c 100644 --- a/device/accton/x86_64-accton_as9716_32d-r0/pddf/pddf-device.json +++ b/device/accton/x86_64-accton_as9716_32d-r0/pddf/pddf-device.json @@ -33,7 +33,7 @@ "i2c-ismt", "i2c-i801", "i2c_dev", - "i2c_mux_pca954x force_deselect_on_exit=1", + "i2c_mux_pca954x", "optoe" ], "pddf_kos": diff --git a/device/accton/x86_64-accton_as9716_32d-r0/platform_asic b/device/accton/x86_64-accton_as9716_32d-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/accton/x86_64-accton_as9716_32d-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/accton/x86_64-accton_as9716_32d-r0/pmon_daemon_control.json b/device/accton/x86_64-accton_as9716_32d-r0/pmon_daemon_control.json index 584a14b9d942..a3b204e20d8d 100644 --- a/device/accton/x86_64-accton_as9716_32d-r0/pmon_daemon_control.json +++ b/device/accton/x86_64-accton_as9716_32d-r0/pmon_daemon_control.json @@ -1,5 +1,5 @@ { "skip_ledd": true, - "skip_thermalctld": true + "skip_pcied": true } diff --git a/device/accton/x86_64-accton_as9726_32d-r0/platform_asic b/device/accton/x86_64-accton_as9726_32d-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/accton/x86_64-accton_as9726_32d-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/sfp.py index 70c6838a8e88..6cefc2a29a47 100644 --- a/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/sfp.py +++ b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/sfp.py @@ -210,7 +210,7 @@ ) info_dict_keys = [ - 'type', 'hardware_rev', 'serial', 'manufacturer', + 'type', 'vendor_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', 'vendor_date', @@ -551,7 +551,7 @@ def get_transceiver_info(self): keys |Value Format |Information ---------------------------|---------------|---------------------------- type |1*255VCHAR |type of SFP - hardware_rev |1*255VCHAR |hardware version of SFP + vendor_rev |1*255VCHAR |vendor revision of SFP serial |1*255VCHAR |serial number of the SFP manufacturer |1*255VCHAR |SFP vendor name model |1*255VCHAR |SFP model name @@ -627,7 +627,7 @@ def get_transceiver_info(self): transceiver_info_dict['type'] = sfp_type_data['data']['type']['value'] transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] elif self.sfp_type == QSFP_TYPE: @@ -770,7 +770,7 @@ def get_transceiver_info(self): sfp_vendor_name_data['data']['Vendor Name']['value']) transceiver_info_dict['model'] = str( sfp_vendor_pn_data['data']['Vendor PN']['value']) - transceiver_info_dict['hardware_rev'] = str( + transceiver_info_dict['vendor_rev'] = str( sfp_vendor_rev_data['data']['Vendor Rev']['value']) transceiver_info_dict['serial'] = str( sfp_vendor_sn_data['data']['Vendor SN']['value']) @@ -845,7 +845,7 @@ def get_transceiver_info(self): transceiver_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value'] transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] transceiver_info_dict['vendor_date'] = sfp_vendor_date_data[ diff --git a/device/accton/x86_64-accton_minipack-r0/platform_asic b/device/accton/x86_64-accton_minipack-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/accton/x86_64-accton_minipack-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/accton/x86_64-accton_wedge100bf_32qs-r0/default_sku b/device/accton/x86_64-accton_wedge100bf_32qs-r0/default_sku new file mode 100644 index 000000000000..e2f0630cc576 --- /dev/null +++ b/device/accton/x86_64-accton_wedge100bf_32qs-r0/default_sku @@ -0,0 +1 @@ +montara t1 diff --git a/device/accton/x86_64-accton_wedge100bf_32qs-r0/installer.conf b/device/accton/x86_64-accton_wedge100bf_32qs-r0/installer.conf new file mode 100644 index 000000000000..3714ff053bb0 --- /dev/null +++ b/device/accton/x86_64-accton_wedge100bf_32qs-r0/installer.conf @@ -0,0 +1 @@ +CONSOLE_SPEED=57600 diff --git a/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/buffers.json.j2 b/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/buffers.json.j2 new file mode 100644 index 000000000000..1083a6210fc9 --- /dev/null +++ b/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't0' %} +{%- include 'buffers_config.j2' %} diff --git a/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/buffers_defaults_t0.j2 b/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/buffers_defaults_t0.j2 new file mode 100755 index 000000000000..31fb9fa9ad70 --- /dev/null +++ b/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/buffers_defaults_t0.j2 @@ -0,0 +1,79 @@ +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '4194304' %} +{% set ingress_lossy_pool_size = '7340032' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '7340032' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,32) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"ingress_lossless_pool", + "size":"4096", + "dynamic_th":"0" + }, + "ingress_lossy_profile": { + "pool":"ingress_lossy_pool", + "size":"4096", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"4096", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"4096", + "dynamic_th":"3" + }, + "q_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"4096", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { +{% for port in port_names.split(',') %} + "{{ port }}|0-1": { + "profile" : "q_lossy_profile" + }, +{% endfor %} +{% for port in port_names.split(',') %} + "{{ port }}|3-4": { + "profile" : "egress_lossless_profile" + }{% if not loop.last %},{% endif %} +{% endfor %} + } +{%- endmacro %} \ No newline at end of file diff --git a/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/buffers_defaults_t1.j2 b/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/buffers_defaults_t1.j2 new file mode 100755 index 000000000000..0d4224f7f3b2 --- /dev/null +++ b/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/buffers_defaults_t1.j2 @@ -0,0 +1,79 @@ +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '2097152' %} +{% set ingress_lossy_pool_size = '5242880' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '5242880' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,32) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"ingress_lossless_pool", + "size":"4096", + "dynamic_th":"0" + }, + "ingress_lossy_profile": { + "pool":"ingress_lossy_pool", + "size":"4096", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"4096", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"4096", + "dynamic_th":"3" + }, + "q_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"4096", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { +{% for port in port_names.split(',') %} + "{{ port }}|0-1": { + "profile" : "q_lossy_profile" + }, +{% endfor %} +{% for port in port_names.split(',') %} + "{{ port }}|3-4": { + "profile" : "egress_lossless_profile" + }{% if not loop.last %},{% endif %} +{% endfor %} + } +{%- endmacro %} \ No newline at end of file diff --git a/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/hwsku.json b/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/hwsku.json new file mode 100644 index 000000000000..203aa5a34047 --- /dev/null +++ b/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/hwsku.json @@ -0,0 +1,164 @@ +{ + "interfaces": { + "Ethernet0": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet4": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet8": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet12": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet16": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet20": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet24": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet28": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet32": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet36": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet40": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet44": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet48": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet52": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet56": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet60": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet64": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet68": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet72": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet76": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet80": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet84": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet88": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet92": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet96": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet100": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet104": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet108": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet112": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet116": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet120": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet124": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + } + } +} diff --git a/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/pg_profile_lookup.ini b/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/pg_profile_lookup.ini new file mode 100644 index 000000000000..b66b129fe43f --- /dev/null +++ b/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 34816 18432 16384 0 + 25000 5m 34816 18432 16384 0 + 40000 5m 34816 18432 16384 0 + 50000 5m 34816 18432 16384 0 + 100000 5m 36864 18432 18432 0 + 10000 40m 36864 18432 18432 0 + 25000 40m 39936 18432 21504 0 + 40000 40m 41984 18432 23552 0 + 50000 40m 41984 18432 23552 0 + 100000 40m 54272 18432 35840 0 + 10000 300m 49152 18432 30720 0 + 25000 300m 71680 18432 53248 0 + 40000 300m 94208 18432 75776 0 + 50000 300m 94208 18432 75776 0 + 100000 300m 184320 18432 165888 0 diff --git a/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/port_config.ini b/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/port_config.ini new file mode 100644 index 000000000000..4035147f583c --- /dev/null +++ b/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias index speed autoneg fec +Ethernet0 0,1,2,3 Ethernet0 1 100000 off rs +Ethernet4 4,5,6,7 Ethernet4 2 100000 off rs +Ethernet8 8,9,10,11 Ethernet8 3 100000 off rs +Ethernet12 12,13,14,15 Ethernet12 4 100000 off rs +Ethernet16 16,17,18,19 Ethernet16 5 100000 off rs +Ethernet20 20,21,22,23 Ethernet20 6 100000 off rs +Ethernet24 24,25,26,27 Ethernet24 7 100000 off rs +Ethernet28 28,29,30,31 Ethernet28 8 100000 off rs +Ethernet32 32,33,34,35 Ethernet32 9 100000 off rs +Ethernet36 36,37,38,39 Ethernet36 10 100000 off rs +Ethernet40 40,41,42,43 Ethernet40 11 100000 off rs +Ethernet44 44,45,46,47 Ethernet44 12 100000 off rs +Ethernet48 48,49,50,51 Ethernet48 13 100000 off rs +Ethernet52 52,53,54,55 Ethernet52 14 100000 off rs +Ethernet56 56,57,58,59 Ethernet56 15 100000 off rs +Ethernet60 60,61,62,63 Ethernet60 16 100000 off rs +Ethernet64 64,65,66,67 Ethernet64 17 100000 off rs +Ethernet68 68,69,70,71 Ethernet68 18 100000 off rs +Ethernet72 72,73,74,75 Ethernet72 19 100000 off rs +Ethernet76 76,77,78,79 Ethernet76 20 100000 off rs +Ethernet80 80,81,82,83 Ethernet80 21 100000 off rs +Ethernet84 84,85,86,87 Ethernet84 22 100000 off rs +Ethernet88 88,89,90,91 Ethernet88 23 100000 off rs +Ethernet92 92,93,94,95 Ethernet92 24 100000 off rs +Ethernet96 96,97,98,99 Ethernet96 25 100000 off rs +Ethernet100 100,101,102,103 Ethernet100 26 100000 off rs +Ethernet104 104,105,106,107 Ethernet104 27 100000 off rs +Ethernet108 108,109,110,111 Ethernet108 28 100000 off rs +Ethernet112 112,113,114,115 Ethernet112 29 100000 off rs +Ethernet116 116,117,118,119 Ethernet116 30 100000 off rs +Ethernet120 120,121,122,123 Ethernet120 31 100000 off rs +Ethernet124 124,125,126,127 Ethernet124 32 100000 off rs diff --git a/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/qos.json.j2 b/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/qos.json.j2 new file mode 100644 index 000000000000..a685277448f1 --- /dev/null +++ b/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/qos.json.j2 @@ -0,0 +1,10 @@ +{%- macro generate_tc_to_pg_map() %} + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "3": "3", + "4": "4" + } + }, +{%- endmacro %} + +{%- include 'qos_config.j2' %} diff --git a/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/sai.profile b/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/sai.profile new file mode 100644 index 000000000000..037b5c135370 --- /dev/null +++ b/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/sai.profile @@ -0,0 +1,3 @@ +SAI_KEY_WARM_BOOT_WRITE_FILE=/var/warmboot/sai-warmboot.bin +SAI_KEY_WARM_BOOT_READ_FILE=/var/warmboot/sai-warmboot.bin + diff --git a/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/switch-tna-sai.conf b/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/switch-tna-sai.conf new file mode 100644 index 000000000000..8c34ef9d6a9a --- /dev/null +++ b/device/accton/x86_64-accton_wedge100bf_32qs-r0/montara/switch-tna-sai.conf @@ -0,0 +1,39 @@ +{ + "chip_list": [ + { + "chip_family": "Tofino", + "sds_fw_path": "share/tofino_sds_fw/avago/firmware", + "instance": 0 + } + ], + "p4_devices": [ + { + "device-id": 0, + "agent0": "lib/platform/x86_64-accton_wedge100bf_32qs-r0/libpltfm_mgr.so", + "p4_programs": [ + { + "p4_pipelines": [ + { + "p4_pipeline_name": "pipe", + "config": "share/switch/pipe/tofino.bin", + "context": "share/switch/pipe/context.json" + } + ], + "program-name": "switch", + "bfrt-config": "share/switch/bf-rt.json", + "model_json_path" : "share/switch/aug_model.json", + "switchapi_port_add": false, + "non_default_port_ppgs": 5 + } + ] + } + ], + "switch_options": [ + { + "device-id": 0, + "model_json_path": "share/switch/aug_model.json", + "non_default_port_ppgs": 5, + "switchapi_port_add": false + } + ] +} diff --git a/device/accton/x86_64-accton_wedge100bf_32qs-r0/pcie.yaml b/device/accton/x86_64-accton_wedge100bf_32qs-r0/pcie.yaml new file mode 100644 index 000000000000..ab38096c9740 --- /dev/null +++ b/device/accton/x86_64-accton_wedge100bf_32qs-r0/pcie.yaml @@ -0,0 +1,412 @@ +- bus: '00' + dev: '00' + fn: '0' + id: 6f00 + name: 'Host bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D DMI2 + (rev 03)' +- bus: '00' + dev: '01' + fn: '0' + id: 6f02 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 1 (rev 03)' +- bus: '00' + dev: '01' + fn: '1' + id: 6f03 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 1 (rev 03)' +- bus: '00' + dev: '02' + fn: '0' + id: 6f04 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 2 (rev 03)' +- bus: '00' + dev: '02' + fn: '2' + id: 6f06 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 2 (rev 03)' +- bus: '00' + dev: '03' + fn: '0' + id: 6f08 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 3 (rev 03)' +- bus: '00' + dev: '05' + fn: '0' + id: 6f28 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Map/VTd_Misc/System Management (rev 03)' +- bus: '00' + dev: '05' + fn: '1' + id: 6f29 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D IIO Hot Plug (rev 03)' +- bus: '00' + dev: '05' + fn: '2' + id: 6f2a + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D IIO RAS/Control Status/Global Errors (rev 03)' +- bus: '00' + dev: '05' + fn: '4' + id: 6f2c + name: 'PIC: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D I/O APIC (rev + 03)' +- bus: '00' + dev: '14' + fn: '0' + id: 8c31 + name: 'USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB + xHCI (rev 05)' +- bus: '00' + dev: 1d + fn: '0' + id: 8c26 + name: 'USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB + EHCI #1 (rev 05)' +- bus: '00' + dev: 1f + fn: '0' + id: 8c54 + name: 'ISA bridge: Intel Corporation C224 Series Chipset Family Server Standard + SKU LPC Controller (rev 05)' +- bus: '00' + dev: 1f + fn: '2' + id: 8c02 + name: 'SATA controller: Intel Corporation 8 Series/C220 Series Chipset Family 6-port + SATA Controller 1 [AHCI mode] (rev 05)' +- bus: '00' + dev: 1f + fn: '3' + id: 8c22 + name: 'SMBus: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller + (rev 05)' +- bus: '00' + dev: 1f + fn: '6' + id: 8c24 + name: 'Signal processing controller: Intel Corporation 8 Series Chipset Family Thermal + Management Controller (rev 05)' +- bus: '02' + dev: '00' + fn: '0' + id: '1533' + name: 'Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev + 03)' +- bus: '03' + dev: '00' + fn: '0' + id: 6f50 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 0' +- bus: '03' + dev: '00' + fn: '1' + id: 6f51 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 1' +- bus: '03' + dev: '00' + fn: '2' + id: 6f52 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 2' +- bus: '03' + dev: '00' + fn: '3' + id: 6f53 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 3' +- bus: '04' + dev: '00' + fn: '0' + id: 10a6 + name: 'Unassigned class [ff00]: Intel Corporation 82599EB 10-Gigabit Dummy Function' +- bus: '05' + dev: '00' + fn: '0' + id: '0010' + name: 'Unassigned class [ff00]: Device 1d1c:0010 (rev 10)' +- bus: ff + dev: 0b + fn: '0' + id: 6f81 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link 0/1 (rev 03)' +- bus: ff + dev: 0b + fn: '1' + id: 6f36 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link 0/1 (rev 03)' +- bus: ff + dev: 0b + fn: '2' + id: 6f37 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link 0/1 (rev 03)' +- bus: ff + dev: 0b + fn: '3' + id: 6f76 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link Debug (rev 03)' +- bus: ff + dev: 0c + fn: '0' + id: 6fe0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0c + fn: '1' + id: 6fe1 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0c + fn: '2' + id: 6fe2 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0c + fn: '3' + id: 6fe3 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '0' + id: 6ff8 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '4' + id: 6ffc + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '5' + id: 6ffd + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '6' + id: 6ffe + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: '10' + fn: '0' + id: 6f1d + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R2PCIe Agent (rev 03)' +- bus: ff + dev: '10' + fn: '1' + id: 6f34 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R2PCIe Agent (rev 03)' +- bus: ff + dev: '10' + fn: '5' + id: 6f1e + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Ubox (rev 03)' +- bus: ff + dev: '10' + fn: '6' + id: 6f7d + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Ubox (rev 03)' +- bus: ff + dev: '10' + fn: '7' + id: 6f1f + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Ubox (rev 03)' +- bus: ff + dev: '12' + fn: '0' + id: 6fa0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Home Agent 0 (rev 03)' +- bus: ff + dev: '12' + fn: '1' + id: 6f30 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Home Agent 0 (rev 03)' +- bus: ff + dev: '13' + fn: '0' + id: 6fa8 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Target Address/Thermal/RAS (rev 03)' +- bus: ff + dev: '13' + fn: '1' + id: 6f71 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Target Address/Thermal/RAS (rev 03)' +- bus: ff + dev: '13' + fn: '2' + id: 6faa + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '3' + id: 6fab + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '4' + id: 6fac + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '5' + id: 6fad + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '6' + id: 6fae + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Broadcast (rev 03)' +- bus: ff + dev: '13' + fn: '7' + id: 6faf + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Global Broadcast (rev 03)' +- bus: ff + dev: '14' + fn: '0' + id: 6fb0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 0 Thermal Control (rev 03)' +- bus: ff + dev: '14' + fn: '1' + id: 6fb1 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 1 Thermal Control (rev 03)' +- bus: ff + dev: '14' + fn: '2' + id: 6fb2 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 0 Error (rev 03)' +- bus: ff + dev: '14' + fn: '3' + id: 6fb3 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 1 Error (rev 03)' +- bus: ff + dev: '14' + fn: '4' + id: 6fbc + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '14' + fn: '5' + id: 6fbd + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '14' + fn: '6' + id: 6fbe + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '14' + fn: '7' + id: 6fbf + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '15' + fn: '0' + id: 6fb4 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 2 Thermal Control (rev 03)' +- bus: ff + dev: '15' + fn: '1' + id: 6fb5 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 3 Thermal Control (rev 03)' +- bus: ff + dev: '15' + fn: '2' + id: 6fb6 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 2 Error (rev 03)' +- bus: ff + dev: '15' + fn: '3' + id: 6fb7 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 3 Error (rev 03)' +- bus: ff + dev: 1e + fn: '0' + id: 6f98 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '1' + id: 6f99 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '2' + id: 6f9a + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '3' + id: 6fc0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '4' + id: 6f9c + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1f + fn: '0' + id: 6f88 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1f + fn: '2' + id: 6f8a + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' diff --git a/device/accton/x86_64-accton_wedge100bf_32qs-r0/platform.json b/device/accton/x86_64-accton_wedge100bf_32qs-r0/platform.json new file mode 100755 index 000000000000..9f5658141f78 --- /dev/null +++ b/device/accton/x86_64-accton_wedge100bf_32qs-r0/platform.json @@ -0,0 +1,499 @@ +{ + "chassis": { + "name": "Wedge100BF-32QS-O-AC-F-BF", + "fans": [ + { + "name": "counter-rotating-fan-1" + }, + { + "name": "counter-rotating-fan-2" + }, + { + "name": "counter-rotating-fan-3" + }, + { + "name": "counter-rotating-fan-4" + }, + { + "name": "counter-rotating-fan-5" + } + ], + "fan_drawers": [ + { + "name": "fantray-1", + "fans": [ + { + "name": "counter-rotating-fan-1" + }, + { + "name": "counter-rotating-fan-2" + }, + { + "name": "counter-rotating-fan-3" + }, + { + "name": "counter-rotating-fan-4" + }, + { + "name": "counter-rotating-fan-5" + } + ] + } + ], + "psus": [ + { + "name": "psu-1" + }, + { + "name": "psu-2" + } + ], + "thermals": [ + { + "name": "com_e_driver-i2c-4-33:memory-temp" + }, + { + "name": "com_e_driver-i2c-4-33:cpu-temp" + }, + { + "name": "pfe1100-i2c-7-59:temp1" + }, + { + "name": "pfe1100-i2c-7-59:temp2" + }, + { + "name": "pfe1100-i2c-7-5a:temp1" + }, + { + "name": "pfe1100-i2c-7-5a:temp2" + }, + { + "name": "tmp75-i2c-3-48:outlet-middle-temp" + }, + { + "name": "tmp75-i2c-3-49:inlet-middle-temp" + }, + { + "name": "tmp75-i2c-3-4a:inlet-left-temp" + }, + { + "name": "tmp75-i2c-3-4b:switch-temp" + }, + { + "name": "tmp75-i2c-3-4c:inlet-right-temp" + }, + { + "name": "tmp75-i2c-8-48:outlet-right-temp" + }, + { + "name": "tmp75-i2c-8-49:outlet-left-temp" + }, + { + "name": "coretemp-isa-0000:package-id-0" + }, + { + "name": "coretemp-isa-0000:core-0" + }, + { + "name": "coretemp-isa-0000:core-1" + }, + { + "name": "coretemp-isa-0000:core-2" + }, + { + "name": "coretemp-isa-0000:core-3" + }, + { + "name": "pch_haswell-virtual-0:temp1" + } + ], + "sfps": [ + { + "name": "sfp1" + }, + { + "name": "sfp2" + }, + { + "name": "sfp3" + }, + { + "name": "sfp4" + }, + { + "name": "sfp5" + }, + { + "name": "sfp6" + }, + { + "name": "sfp7" + }, + { + "name": "sfp8" + }, + { + "name": "sfp9" + }, + { + "name": "sfp10" + }, + { + "name": "sfp11" + }, + { + "name": "sfp12" + }, + { + "name": "sfp13" + }, + { + "name": "sfp14" + }, + { + "name": "sfp15" + }, + { + "name": "sfp16" + }, + { + "name": "sfp17" + }, + { + "name": "sfp18" + }, + { + "name": "sfp19" + }, + { + "name": "sfp20" + }, + { + "name": "sfp21" + }, + { + "name": "sfp22" + }, + { + "name": "sfp23" + }, + { + "name": "sfp24" + }, + { + "name": "sfp25" + }, + { + "name": "sfp26" + }, + { + "name": "sfp27" + }, + { + "name": "sfp28" + }, + { + "name": "sfp29" + }, + { + "name": "sfp30" + }, + { + "name": "sfp31" + }, + { + "name": "sfp32" + } + ] + }, + "interfaces": { + "Ethernet0": { + "index": "1,1,1,1", + "lanes": "0,1,2,3", + "breakout_modes": { + "1x100G[40G]": ["Ethernet0"], + "2x50G": ["Ethernet0", "Ethernet2"], + "4x25G[10G]": ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3"] + } + }, + "Ethernet4": { + "index": "2,2,2,2", + "lanes": "4,5,6,7", + "breakout_modes": { + "1x100G[40G]": ["Ethernet4"], + "2x50G": ["Ethernet4", "Ethernet6"], + "4x25G[10G]": ["Ethernet4", "Ethernet5", "Ethernet6", "Ethernet7"] + } + }, + "Ethernet8": { + "index": "3,3,3,3", + "lanes": "8,9,10,11", + "breakout_modes": { + "1x100G[40G]": ["Ethernet8"], + "2x50G": ["Ethernet8", "Ethernet10"], + "4x25G[10G]": ["Ethernet8", "Ethernet9", "Ethernet10", "Ethernet11"] + } + }, + "Ethernet12": { + "index": "4,4,4,4", + "lanes": "12,13,14,15", + "breakout_modes": { + "1x100G[40G]": ["Ethernet12"], + "2x50G": ["Ethernet12", "Ethernet14"], + "4x25G[10G]": ["Ethernet12", "Ethernet13", "Ethernet14", "Ethernet15"] + } + }, + "Ethernet16": { + "index": "5,5,5,5", + "lanes": "16,17,18,19", + "breakout_modes": { + "1x100G[40G]": ["Ethernet16"], + "2x50G": ["Ethernet16", "Ethernet18"], + "4x25G[10G]": ["Ethernet16", "Ethernet17", "Ethernet18", "Ethernet19"] + } + }, + "Ethernet20": { + "index": "6,6,6,6", + "lanes": "20,21,22,23", + "breakout_modes": { + "1x100G[40G]": ["Ethernet20"], + "2x50G": ["Ethernet20", "Ethernet22"], + "4x25G[10G]": ["Ethernet20", "Ethernet21", "Ethernet22", "Ethernet23"] + } + }, + "Ethernet24": { + "index": "7,7,7,7", + "lanes": "24,25,26,27", + "breakout_modes": { + "1x100G[40G]": ["Ethernet24"], + "2x50G": ["Ethernet24", "Ethernet26"], + "4x25G[10G]": ["Ethernet24", "Ethernet25", "Ethernet26", "Ethernet27"] + } + }, + "Ethernet28": { + "index": "8,8,8,8", + "lanes": "28,29,30,31", + "breakout_modes": { + "1x100G[40G]": ["Ethernet28"], + "2x50G": ["Ethernet28", "Ethernet30"], + "4x25G[10G]": ["Ethernet28", "Ethernet29", "Ethernet30", "Ethernet31"] + } + }, + "Ethernet32": { + "index": "9,9,9,9", + "lanes": "32,33,34,35", + "breakout_modes": { + "1x100G[40G]": ["Ethernet32"], + "2x50G": ["Ethernet32", "Ethernet34"], + "4x25G[10G]": ["Ethernet32", "Ethernet33", "Ethernet34", "Ethernet35"] + } + }, + "Ethernet36": { + "index": "10,10,10,10", + "lanes": "36,37,38,39", + "breakout_modes": { + "1x100G[40G]": ["Ethernet36"], + "2x50G": ["Ethernet36", "Ethernet38"], + "4x25G[10G]": ["Ethernet36", "Ethernet37", "Ethernet38", "Ethernet39"] + } + }, + "Ethernet40": { + "index": "11,11,11,11", + "lanes": "40,41,42,43", + "breakout_modes": { + "1x100G[40G]": ["Ethernet40"], + "2x50G": ["Ethernet40", "Ethernet42"], + "4x25G[10G]": ["Ethernet40", "Ethernet41", "Ethernet42", "Ethernet43"] + } + }, + "Ethernet44": { + "index": "12,12,12,12", + "lanes": "44,45,46,47", + "breakout_modes": { + "1x100G[40G]": ["Ethernet44"], + "2x50G": ["Ethernet44", "Ethernet46"], + "4x25G[10G]": ["Ethernet44", "Ethernet45", "Ethernet46", "Ethernet47"] + } + }, + "Ethernet48": { + "index": "13,13,13,13", + "lanes": "48,49,50,51", + "breakout_modes": { + "1x100G[40G]": ["Ethernet48"], + "2x50G": ["Ethernet48", "Ethernet50"], + "4x25G[10G]": ["Ethernet48", "Ethernet49", "Ethernet50", "Ethernet51"] + } + }, + "Ethernet52": { + "index": "14,14,14,14", + "lanes": "52,53,54,55", + "breakout_modes": { + "1x100G[40G]": ["Ethernet52"], + "2x50G": ["Ethernet52", "Ethernet54"], + "4x25G[10G]": ["Ethernet52", "Ethernet53", "Ethernet54", "Ethernet55"] + } + }, + "Ethernet56": { + "index": "15,15,15,15", + "lanes": "56,57,58,59", + "breakout_modes": { + "1x100G[40G]": ["Ethernet56"], + "2x50G": ["Ethernet56", "Ethernet58"], + "4x25G[10G]": ["Ethernet56", "Ethernet57", "Ethernet58", "Ethernet59"] + } + }, + "Ethernet60": { + "index": "16,16,16,16", + "lanes": "60,61,62,63", + "breakout_modes": { + "1x100G[40G]": ["Ethernet60"], + "2x50G": ["Ethernet60", "Ethernet62"], + "4x25G[10G]": ["Ethernet60", "Ethernet61", "Ethernet62", "Ethernet63"] + } + }, + "Ethernet64": { + "index": "17,17,17,17", + "lanes": "64,65,66,67", + "breakout_modes": { + "1x100G[40G]": ["Ethernet64"], + "2x50G": ["Ethernet64", "Ethernet66"], + "4x25G[10G]": ["Ethernet64", "Ethernet65", "Ethernet66", "Ethernet67"] + } + }, + "Ethernet68": { + "index": "18,18,18,18", + "lanes": "68,69,70,71", + "breakout_modes": { + "1x100G[40G]": ["Ethernet68"], + "2x50G": ["Ethernet68", "Ethernet70"], + "4x25G[10G]": ["Ethernet68", "Ethernet69", "Ethernet70", "Ethernet71"] + } + }, + "Ethernet72": { + "index": "19,19,19,19", + "lanes": "72,73,74,75", + "breakout_modes": { + "1x100G[40G]": ["Ethernet72"], + "2x50G": ["Ethernet72", "Ethernet74"], + "4x25G[10G]": ["Ethernet72", "Ethernet73", "Ethernet74", "Ethernet75"] + } + }, + "Ethernet76": { + "index": "20,20,20,20", + "lanes": "76,77,78,79", + "breakout_modes": { + "1x100G[40G]": ["Ethernet76"], + "2x50G": ["Ethernet76", "Ethernet78"], + "4x25G[10G]": ["Ethernet76", "Ethernet77", "Ethernet78", "Ethernet79"] + } + }, + "Ethernet80": { + "index": "21,21,21,21", + "lanes": "80,81,82,83", + "breakout_modes": { + "1x100G[40G]": ["Ethernet80"], + "2x50G": ["Ethernet80", "Ethernet82"], + "4x25G[10G]": ["Ethernet80", "Ethernet81", "Ethernet82", "Ethernet83"] + } + }, + "Ethernet84": { + "index": "22,22,22,22", + "lanes": "84,85,86,87", + "breakout_modes": { + "1x100G[40G]": ["Ethernet84"], + "2x50G": ["Ethernet84", "Ethernet86"], + "4x25G[10G]": ["Ethernet84", "Ethernet85", "Ethernet86", "Ethernet87"] + } + }, + "Ethernet88": { + "index": "23,23,23,23", + "lanes": "88,89,90,91", + "breakout_modes": { + "1x100G[40G]": ["Ethernet88"], + "2x50G": ["Ethernet88", "Ethernet90"], + "4x25G[10G]": ["Ethernet88", "Ethernet89", "Ethernet90", "Ethernet91"] + } + }, + "Ethernet92": { + "index": "24,24,24,24", + "lanes": "92,93,94,95", + "breakout_modes": { + "1x100G[40G]": ["Ethernet92"], + "2x50G": ["Ethernet92", "Ethernet94"], + "4x25G[10G]": ["Ethernet92", "Ethernet93", "Ethernet94", "Ethernet95"] + } + }, + "Ethernet96": { + "index": "25,25,25,25", + "lanes": "96,97,98,99", + "breakout_modes": { + "1x100G[40G]": ["Ethernet96"], + "2x50G": ["Ethernet96", "Ethernet98"], + "4x25G[10G]": ["Ethernet96", "Ethernet97", "Ethernet98", "Ethernet99"] + } + }, + "Ethernet100": { + "index": "26,26,26,26", + "lanes": "100,101,102,103", + "breakout_modes": { + "1x100G[40G]": ["Ethernet100"], + "2x50G": ["Ethernet100", "Ethernet102"], + "4x25G[10G]": ["Ethernet100", "Ethernet101", "Ethernet102", "Ethernet103"] + } + }, + "Ethernet104": { + "index": "27,27,27,27", + "lanes": "104,105,106,107", + "breakout_modes": { + "1x100G[40G]": ["Ethernet104"], + "2x50G": ["Ethernet104", "Ethernet106"], + "4x25G[10G]": ["Ethernet104", "Ethernet105", "Ethernet106", "Ethernet107"] + } + }, + "Ethernet108": { + "index": "28,28,28,28", + "lanes": "108,109,110,111", + "breakout_modes": { + "1x100G[40G]": ["Ethernet108"], + "2x50G": ["Ethernet108", "Ethernet110"], + "4x25G[10G]": ["Ethernet108", "Ethernet109", "Ethernet110", "Ethernet111"] + } + }, + "Ethernet112": { + "index": "29,29,29,29", + "lanes": "112,113,114,115", + "breakout_modes": { + "1x100G[40G]": ["Ethernet112"], + "2x50G": ["Ethernet112", "Ethernet114"], + "4x25G[10G]": ["Ethernet112", "Ethernet113", "Ethernet112", "Ethernet113"] + } + }, + "Ethernet116": { + "index": "30,30,30,30", + "lanes": "116,117,118,119", + "breakout_modes": { + "1x100G[40G]": ["Ethernet116"], + "2x50G": ["Ethernet116", "Ethernet118"], + "4x25G[10G]": ["Ethernet116", "Ethernet117", "Ethernet118", "Ethernet119"] + } + }, + "Ethernet120": { + "index": "31,31,31,31", + "lanes": "120,121,122,123", + "breakout_modes": { + "1x100G[40G]": ["Ethernet120"], + "2x50G": ["Ethernet120", "Ethernet122"], + "4x25G[10G]": ["Ethernet120", "Ethernet121", "Ethernet122", "Ethernet123"] + } + }, + "Ethernet124": { + "index": "32,32,32,32", + "lanes": "124,125,126,127", + "breakout_modes": { + "1x100G[40G]": ["Ethernet124"], + "2x50G": ["Ethernet124", "Ethernet126"], + "4x25G[10G]": ["Ethernet124", "Ethernet125", "Ethernet126", "Ethernet127"] + } + } + } +} diff --git a/device/accton/x86_64-accton_wedge100bf_32qs-r0/platform_asic b/device/accton/x86_64-accton_wedge100bf_32qs-r0/platform_asic new file mode 100644 index 000000000000..88d88117928c --- /dev/null +++ b/device/accton/x86_64-accton_wedge100bf_32qs-r0/platform_asic @@ -0,0 +1 @@ +barefoot diff --git a/device/accton/x86_64-accton_wedge100bf_32qs-r0/platform_components.json b/device/accton/x86_64-accton_wedge100bf_32qs-r0/platform_components.json new file mode 100644 index 000000000000..086861cba552 --- /dev/null +++ b/device/accton/x86_64-accton_wedge100bf_32qs-r0/platform_components.json @@ -0,0 +1,8 @@ +{ + "chassis": { + "Wedge100BF-32QS-O-AC-F": { + "component": { + } + } + } +} \ No newline at end of file diff --git a/device/accton/x86_64-accton_wedge100bf_32qs-r0/pmon_daemon_control.json b/device/accton/x86_64-accton_wedge100bf_32qs-r0/pmon_daemon_control.json new file mode 100644 index 000000000000..b58e59ba000c --- /dev/null +++ b/device/accton/x86_64-accton_wedge100bf_32qs-r0/pmon_daemon_control.json @@ -0,0 +1,9 @@ +{ + "skip_pcied": false, + "skip_fancontrol": true, + "skip_thermalctld": false, + "skip_ledd": true, + "skip_xcvrd": false, + "skip_psud": false, + "skip_syseepromd": false +} diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/platform_asic b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/platform_asic b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/buffers.json.j2 b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/buffers.json.j2 new file mode 100644 index 000000000000..1083a6210fc9 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't0' %} +{%- include 'buffers_config.j2' %} diff --git a/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/buffers_defaults_t0.j2 b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..534ff4656204 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/buffers_defaults_t0.j2 @@ -0,0 +1,47 @@ + +{%- set default_cable = '40m' %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "egress_lossy_pool": { + "size": "67108864", + "type": "egress", + "mode": "dynamic" + }, + "ingress_lossless_pool": { + "mode": "dynamic", + "size": "59001152", + "xoff": "7428992", + "type": "ingress" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"67108864" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{%- macro generate_pg_profils(port_names_active) %} + "BUFFER_PG": { + "{{ port_names_active }}|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, +{%- endmacro %} + +{% macro generate_queue_buffers(port_names_active) %} + "BUFFER_QUEUE": { + "{{ port_names_active }}|0-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +{% endmacro %} + diff --git a/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/buffers_defaults_t1.j2 b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..534ff4656204 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/buffers_defaults_t1.j2 @@ -0,0 +1,47 @@ + +{%- set default_cable = '40m' %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "egress_lossy_pool": { + "size": "67108864", + "type": "egress", + "mode": "dynamic" + }, + "ingress_lossless_pool": { + "mode": "dynamic", + "size": "59001152", + "xoff": "7428992", + "type": "ingress" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"67108864" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{%- macro generate_pg_profils(port_names_active) %} + "BUFFER_PG": { + "{{ port_names_active }}|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, +{%- endmacro %} + +{% macro generate_queue_buffers(port_names_active) %} + "BUFFER_QUEUE": { + "{{ port_names_active }}|0-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +{% endmacro %} + diff --git a/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/hwsku.json b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/hwsku.json new file mode 100644 index 000000000000..a4ad1b352e4c --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/hwsku.json @@ -0,0 +1,106 @@ +{ + "interfaces": { + "Ethernet0": { + "default_brkout_mode": "1x400G" + }, + "Ethernet8": { + "default_brkout_mode": "1x400G" + }, + "Ethernet16": { + "default_brkout_mode": "1x400G" + }, + "Ethernet24": { + "default_brkout_mode": "1x400G" + }, + "Ethernet32": { + "default_brkout_mode": "1x400G" + }, + "Ethernet40": { + "default_brkout_mode": "1x400G" + }, + "Ethernet48": { + "default_brkout_mode": "1x400G" + }, + "Ethernet56": { + "default_brkout_mode": "1x400G" + }, + "Ethernet64": { + "default_brkout_mode": "1x400G" + }, + "Ethernet72": { + "default_brkout_mode": "1x400G" + }, + "Ethernet80": { + "default_brkout_mode": "1x400G" + }, + "Ethernet88": { + "default_brkout_mode": "1x400G" + }, + "Ethernet96": { + "default_brkout_mode": "1x400G" + }, + "Ethernet104": { + "default_brkout_mode": "1x400G" + }, + "Ethernet112": { + "default_brkout_mode": "1x400G" + }, + "Ethernet120": { + "default_brkout_mode": "1x400G" + }, + "Ethernet128": { + "default_brkout_mode": "1x400G" + }, + "Ethernet136": { + "default_brkout_mode": "1x400G" + }, + "Ethernet144": { + "default_brkout_mode": "1x400G" + }, + "Ethernet152": { + "default_brkout_mode": "1x400G" + }, + "Ethernet160": { + "default_brkout_mode": "1x400G" + }, + "Ethernet168": { + "default_brkout_mode": "1x400G" + }, + "Ethernet176": { + "default_brkout_mode": "1x400G" + }, + "Ethernet184": { + "default_brkout_mode": "1x400G" + }, + "Ethernet192": { + "default_brkout_mode": "1x400G" + }, + "Ethernet200": { + "default_brkout_mode": "1x400G" + }, + "Ethernet208": { + "default_brkout_mode": "1x400G" + }, + "Ethernet216": { + "default_brkout_mode": "1x400G" + }, + "Ethernet224": { + "default_brkout_mode": "1x400G" + }, + "Ethernet232": { + "default_brkout_mode": "1x400G" + }, + "Ethernet240": { + "default_brkout_mode": "1x400G" + }, + "Ethernet248": { + "default_brkout_mode": "1x400G" + }, + "Ethernet256": { + "default_brkout_mode": "1x10G" + }, + "Ethernet257": { + "default_brkout_mode": "1x10G" + } + } +} diff --git a/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/pg_profile_lookup.ini b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/pg_profile_lookup.ini new file mode 100644 index 000000000000..a5f3286beef8 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/pg_profile_lookup.ini @@ -0,0 +1,23 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 10000 5m 1270 0 190500 -2 2540 + 25000 5m 1270 0 190500 -2 2540 + 40000 5m 1270 0 190500 -2 2540 + 50000 5m 1270 0 190500 -2 2540 + 100000 5m 1270 0 190500 -2 2540 + 200000 5m 1270 0 190500 -2 2540 + 400000 5m 1270 0 190500 -2 2540 + 10000 40m 1270 0 190500 -2 2540 + 25000 40m 1270 0 190500 -2 2540 + 40000 40m 1270 0 190500 -2 2540 + 50000 40m 1270 0 190500 -2 2540 + 100000 40m 1270 0 190500 -2 2540 + 200000 40m 1270 0 190500 -2 2540 + 400000 40m 1270 0 190500 -2 2540 + 10000 300m 1270 0 190500 -2 2540 + 25000 300m 1270 0 190500 -2 2540 + 40000 300m 1270 0 190500 -2 2540 + 50000 300m 1270 0 190500 -2 2540 + 100000 300m 1270 0 190500 -2 2540 + 200000 300m 1270 0 190500 -2 2540 + 400000 300m 1270 0 190500 -2 2540 diff --git a/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/qos.json.j2 b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/qos.json.j2 new file mode 100644 index 000000000000..5838547e0747 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/qos.json.j2 @@ -0,0 +1,228 @@ +{%- set PORT_ALL = [] %} +{%- for port in PORT %} + {%- if PORT_ALL.append(port) %}{% endif %} +{%- endfor %} +{%- if PORT_ALL | sort_by_port_index %}{% endif %} + +{%- set port_names_list_all = [] %} +{%- for port in PORT_ALL %} + {%- if port_names_list_all.append(port) %}{% endif %} +{%- endfor %} +{%- set port_names_all = port_names_list_all | join(',') -%} + + +{%- set PORT_ACTIVE = [] %} +{%- if DEVICE_NEIGHBOR is not defined %} + {%- set PORT_ACTIVE = PORT_ALL %} +{%- else %} + {%- for port in DEVICE_NEIGHBOR.keys() %} + {%- if PORT_ACTIVE.append(port) %}{%- endif %} + {%- endfor %} +{%- endif %} +{%- if PORT_ACTIVE | sort_by_port_index %}{% endif %} + +{%- set port_names_list_active = [] %} +{%- for port in PORT_ACTIVE %} + {%- if port_names_list_active.append(port) %}{%- endif %} +{%- endfor %} +{%- set port_names_active = port_names_list_active | join(',') -%} + + +{%- set pfc_to_pg_map_supported_asics = ['mellanox', 'barefoot', 'marvell'] -%} + + +{ +{% if generate_tc_to_pg_map is defined %} + {{- generate_tc_to_pg_map() }} +{% else %} + "TC_TO_PRIORITY_GROUP_MAP": { + "DEFAULT": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "7" + } + }, +{% endif %} + "MAP_PFC_PRIORITY_TO_QUEUE": { + "DEFAULT": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "TC_TO_QUEUE_MAP": { + "DEFAULT": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "DSCP_TO_TC_MAP": { + "DEFAULT": { + "0" : "0", + "1" : "0", + "2" : "0", + "3" : "0", + "4" : "0", + "5" : "0", + "6" : "0", + "7" : "0", + "8" : "0", + "9" : "0", + "10": "0", + "11": "0", + "12": "0", + "13": "0", + "14": "0", + "15": "0", + "16": "0", + "17": "0", + "18": "0", + "19": "0", + "20": "0", + "21": "0", + "22": "0", + "23": "0", + "24": "0", + "25": "0", + "26": "0", + "27": "0", + "28": "0", + "29": "0", + "30": "0", + "31": "0", + "32": "0", + "33": "0", + "34": "0", + "35": "0", + "36": "0", + "37": "0", + "38": "0", + "39": "0", + "40": "0", + "41": "0", + "42": "0", + "43": "0", + "44": "0", + "45": "0", + "46": "0", + "47": "0", + "48": "0", + "49": "0", + "50": "0", + "51": "0", + "52": "0", + "53": "0", + "54": "0", + "55": "0", + "56": "0", + "57": "0", + "58": "0", + "59": "0", + "60": "0", + "61": "0", + "62": "0", + "63": "0" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type" : "DWRR", + "weight": "1" + }, + "scheduler.1": { + "type" : "DWRR", + "weight": "2" + }, + "scheduler.2": { + "type" : "DWRR", + "weight": "3" + }, + "scheduler.3": { + "type" : "DWRR", + "weight": "4" + }, + "scheduler.4": { + "type" : "DWRR", + "weight": "5" + }, + "scheduler.5": { + "type" : "DWRR", + "weight": "10" + }, + "scheduler.6": { + "type" : "DWRR", + "weight": "25" + }, + "scheduler.7": { + "type" : "DWRR", + "weight": "50" + } + }, + "PORT_QOS_MAP": { + "{{ port_names_active }}": { + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|DEFAULT]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|DEFAULT]", + "pfc_enable" : "3,4", + "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|DEFAULT]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|DEFAULT]" + } + }, + "QUEUE": { +{% for port in PORT_ACTIVE %} + "{{ port }}|0": { + "scheduler" : "[SCHEDULER|scheduler.0]" + }, +{% endfor %} +{% for port in PORT_ACTIVE %} + "{{ port }}|1": { + "scheduler" : "[SCHEDULER|scheduler.1]" + }, +{% endfor %} +{% for port in PORT_ACTIVE %} + "{{ port }}|2": { + "scheduler": "[SCHEDULER|scheduler.2]" + }, +{% endfor %} +{% for port in PORT_ACTIVE %} + "{{ port }}|3": { + "scheduler": "[SCHEDULER|scheduler.3]" + }, +{% endfor %} +{% for port in PORT_ACTIVE %} + "{{ port }}|4": { + "scheduler": "[SCHEDULER|scheduler.4]" + }, +{% endfor %} +{% for port in PORT_ACTIVE %} + "{{ port }}|5": { + "scheduler": "[SCHEDULER|scheduler.5]" + }, +{% endfor %} +{% for port in PORT_ACTIVE %} + "{{ port }}|6": { + "scheduler": "[SCHEDULER|scheduler.6]" + }, +{% endfor %} +{% for port in PORT_ACTIVE %} + "{{ port }}|7": { + "scheduler": "[SCHEDULER|scheduler.7]" + }{% if not loop.last %},{% endif %} +{% endfor %} + } +} diff --git a/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/sai.profile b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/sai.profile new file mode 100644 index 000000000000..0a67cd1a42ce --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th3-snj60d0-32x400G.config.bcm diff --git a/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/th3-snj60d0-32x400G.config.bcm b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/th3-snj60d0-32x400G.config.bcm new file mode 100644 index 000000000000..9cff1b075db9 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/Alphanetworks-SNJ60D0-320F/th3-snj60d0-32x400G.config.bcm @@ -0,0 +1,266 @@ +# This property file is for SNJ60D0-320F 1x400Gx32 mode only. +# SNJ60D0-320F uses Tomahawk3 BCM56980 as its mac. Besides, it is phyless. + +led_fw_path="/usr/share/sonic/platform/" +bcm_stat_interval.0=1000000 +bcm_linkscan_interval.0=250000 + +mdio_output_delay.0=0xf +mem_cache_enable=0 + +parity_enable=0 +core_clock_frequency=1325 +dpr_clock_frequency=1000 + +# Merlin Core - 2 management ports +portmap_38=257:10 +portmap_118=258:10 + +# Blackhawk Core - 32 front ports +# BlackhawkCore[0 - 3] must map to device port[1-18], PIPE-0. +portmap_1=1:400 +portmap_5=9:400 +portmap_9=17:400 +portmap_13=25:400 + +# BlackhawkCore[4 - 7] must map to device port[20-37], PIPE-1. +portmap_20=33:400 +portmap_24=41:400 +portmap_28=49:400 +portmap_32=57:400 + +# BlackhawkCore[8 - 11] must map to logical port[40-57], PIPE-2. +portmap_40=65:400 +portmap_44=73:400 +portmap_48=81:400 +portmap_52=89:400 + +# BlackhawkCore[12 - 15] must map to logical port[60-77], PIPE-3. +portmap_60=97:400 +portmap_64=105:400 +portmap_68=113:400 +portmap_72=121:400 + +# BlackhawkCore[16 - 19] must map to logical port[80-97], PIPE-4. +portmap_80=129:400 +portmap_84=137:400 +portmap_88=145:400 +portmap_92=153:400 + +# BlackhawkCore[20 - 23] must map to logical port[100-117], PIPE-5. +portmap_100=161:400 +portmap_104=169:400 +portmap_108=177:400 +portmap_112=185:400 + +# BlackhawkCore[24 - 27] must map to logical port[120-137], PIPE-6. +portmap_120=193:400 +portmap_124=201:400 +portmap_128=209:400 +portmap_132=217:400 + +# BlackhawkCore[28 - 31] must map to logical port[140-157], PIPE-7. +portmap_140=225:400 +portmap_144=233:400 +portmap_148=241:400 +portmap_152=249:400 + +# Configure all front port as XE and CD ports. +pbmp_xport_xe=0x0FFFF0FFFF4FFFF0FFFF0FFFF0FFFF4FFFF1FFFE + +# Oversubscription mode +pbmp_oversubscribe=0x0FFFF0FFFF4FFFF0FFFF0FFFF0FFFF4FFFF1FFFE + +# lane map and polarity +# BlackhawkCore0 +phy_chain_rx_lane_map_physical{1.0}=0x47105362 +serdes_core_rx_polarity_flip_physical{1}=0xd7 +phy_chain_tx_lane_map_physical{1.0}=0x51704263 +serdes_core_tx_polarity_flip_physical{1}=0x31 + +# BlackhawkCore1 +phy_chain_rx_lane_map_physical{9.0}=0x12640735 +serdes_core_rx_polarity_flip_physical{9}=0x4c +phy_chain_tx_lane_map_physical{9.0}=0x65230714 +serdes_core_tx_polarity_flip_physical{9}=0x4c + +# BlackhawkCore2 +phy_chain_rx_lane_map_physical{17.0}=0x40615273 +serdes_core_rx_polarity_flip_physical{17}=0xab +phy_chain_tx_lane_map_physical{17.0}=0x31206745 +serdes_core_tx_polarity_flip_physical{17}=0x4f + +# BlackhawkCore3 +phy_chain_rx_lane_map_physical{25.0}=0x36042715 +serdes_core_rx_polarity_flip_physical{25}=0x82 +phy_chain_tx_lane_map_physical{25.0}=0x67320415 +serdes_core_tx_polarity_flip_physical{25}=0x59 + +# BlackhawkCore4 +phy_chain_rx_lane_map_physical{33.0}=0x10476253 +serdes_core_rx_polarity_flip_physical{33}=0xa2 +phy_chain_tx_lane_map_physical{33.0}=0x75326041 +serdes_core_tx_polarity_flip_physical{33}=0x2e + +# BlackhawkCore5 +phy_chain_rx_lane_map_physical{41.0}=0x23160547 +serdes_core_rx_polarity_flip_physical{41}=0x8d +phy_chain_tx_lane_map_physical{41.0}=0x75236014 +serdes_core_tx_polarity_flip_physical{41}=0xc4 + +# BlackhawkCore6 +phy_chain_rx_lane_map_physical{49.0}=0x10765243 +serdes_core_rx_polarity_flip_physical{49}=0x98 +phy_chain_tx_lane_map_physical{49.0}=0x57306142 +serdes_core_tx_polarity_flip_physical{49}=0xab + +# BlackhawkCore7 +phy_chain_rx_lane_map_physical{57.0}=0x23460517 +serdes_core_rx_polarity_flip_physical{57}=0x8d +phy_chain_tx_lane_map_physical{57.0}=0x67230415 +serdes_core_tx_polarity_flip_physical{57}=0xe9 + +# BlackhawkCore8 +phy_chain_rx_lane_map_physical{65.0}=0x10674253 +serdes_core_rx_polarity_flip_physical{65}=0xa6 +phy_chain_tx_lane_map_physical{65.0}=0x57306142 +serdes_core_tx_polarity_flip_physical{65}=0x3b + +# BlackhawkCore9 +phy_chain_rx_lane_map_physical{73.0}=0x23160547 +serdes_core_rx_polarity_flip_physical{73}=0x8d +phy_chain_tx_lane_map_physical{73.0}=0x67230514 +serdes_core_tx_polarity_flip_physical{73}=0x6c + +# BlackhawkCore10 +phy_chain_rx_lane_map_physical{81.0}=0x10674253 +serdes_core_rx_polarity_flip_physical{81}=0xa6 +phy_chain_tx_lane_map_physical{81.0}=0x05326741 +serdes_core_tx_polarity_flip_physical{81}=0xae + +# BlackhawkCore11 +phy_chain_rx_lane_map_physical{89.0}=0x23460517 +serdes_core_rx_polarity_flip_physical{89}=0x8d +phy_chain_tx_lane_map_physical{89.0}=0x76230514 +serdes_core_tx_polarity_flip_physical{89}=0x8c + +# BlackhawkCore12 +phy_chain_rx_lane_map_physical{97.0}=0x10674253 +serdes_core_rx_polarity_flip_physical{97}=0xa3 +phy_chain_tx_lane_map_physical{97.0}=0x57316042 +serdes_core_tx_polarity_flip_physical{97}=0x3f + +# BlackhawkCore13 +phy_chain_rx_lane_map_physical{105.0}=0x64230517 +serdes_core_rx_polarity_flip_physical{105}=0x29 +phy_chain_tx_lane_map_physical{105.0}=0x67320415 +serdes_core_tx_polarity_flip_physical{105}=0x59 + +# BlackhawkCore14 +phy_chain_rx_lane_map_physical{113.0}=0x10476352 +serdes_core_rx_polarity_flip_physical{113}=0xa6 +phy_chain_tx_lane_map_physical{113.0}=0x57126043 +serdes_core_tx_polarity_flip_physical{113}=0x2e + +# BlackhawkCore15 +phy_chain_rx_lane_map_physical{121.0}=0x46201537 +serdes_core_rx_polarity_flip_physical{121}=0xce +phy_chain_tx_lane_map_physical{121.0}=0x23571406 +serdes_core_tx_polarity_flip_physical{121}=0x6d + +# BlackhawkCore16 +phy_chain_rx_lane_map_physical{129.0}=0x67015342 +serdes_core_rx_polarity_flip_physical{129}=0x63 +phy_chain_tx_lane_map_physical{129.0}=0x32574160 +serdes_core_tx_polarity_flip_physical{129}=0xf4 + +# BlackhawkCore17 +phy_chain_rx_lane_map_physical{137.0}=0x23460517 +serdes_core_rx_polarity_flip_physical{137}=0x89 +phy_chain_tx_lane_map_physical{137.0}=0x57321604 +serdes_core_tx_polarity_flip_physical{137}=0xd2 + +# BlackhawkCore18 +phy_chain_rx_lane_map_physical{145.0}=0x01675342 +serdes_core_rx_polarity_flip_physical{145}=0x6c +phy_chain_tx_lane_map_physical{145.0}=0x75126043 +serdes_core_tx_polarity_flip_physical{145}=0x2e + +# BlackhawkCore19 +phy_chain_rx_lane_map_physical{153.0}=0x40231567 +serdes_core_rx_polarity_flip_physical{153}=0x50 +phy_chain_tx_lane_map_physical{153.0}=0x46231705 +serdes_core_tx_polarity_flip_physical{153}=0xaf + +# BlackhawkCore20 +phy_chain_rx_lane_map_physical{161.0}=0x16540273 +serdes_core_rx_polarity_flip_physical{161}=0x56 +phy_chain_tx_lane_map_physical{161.0}=0x75326041 +serdes_core_tx_polarity_flip_physical{161}=0x1f + +# BlackhawkCore21 +phy_chain_rx_lane_map_physical{169.0}=0x01234567 +serdes_core_rx_polarity_flip_physical{169}=0x95 +phy_chain_tx_lane_map_physical{169.0}=0x57321604 +serdes_core_tx_polarity_flip_physical{169}=0x52 + +# BlackhawkCore22 +phy_chain_rx_lane_map_physical{177.0}=0x16540273 +serdes_core_rx_polarity_flip_physical{177}=0xde +phy_chain_tx_lane_map_physical{177.0}=0x57326041 +serdes_core_tx_polarity_flip_physical{177}=0x2e + +# BlackhawkCore23 +phy_chain_rx_lane_map_physical{185.0}=0x01234567 +serdes_core_rx_polarity_flip_physical{185}=0x95 +phy_chain_tx_lane_map_physical{185.0}=0x57320614 +serdes_core_tx_polarity_flip_physical{185}=0x58 + +# BlackhawkCore24 +phy_chain_rx_lane_map_physical{193.0}=0x16540273 +serdes_core_rx_polarity_flip_physical{193}=0xde +phy_chain_tx_lane_map_physical{193.0}=0x57326041 +serdes_core_tx_polarity_flip_physical{193}=0x2e + +# BlackhawkCore25 +phy_chain_rx_lane_map_physical{201.0}=0x01234567 +serdes_core_rx_polarity_flip_physical{201}=0x95 +phy_chain_tx_lane_map_physical{201.0}=0x57230614 +serdes_core_tx_polarity_flip_physical{201}=0x68 + +# BlackhawkCore26 +phy_chain_rx_lane_map_physical{209.0}=0x16570243 +serdes_core_rx_polarity_flip_physical{209}=0xcc +phy_chain_tx_lane_map_physical{209.0}=0x50316742 +serdes_core_tx_polarity_flip_physical{209}=0x35 + +# BlackhawkCore27 +phy_chain_rx_lane_map_physical{217.0}=0x01342567 +serdes_core_rx_polarity_flip_physical{217}=0x9d +phy_chain_tx_lane_map_physical{217.0}=0x57320614 +serdes_core_tx_polarity_flip_physical{217}=0x58 + +# BlackhawkCore28 +phy_chain_rx_lane_map_physical{225.0}=0x01456273 +serdes_core_rx_polarity_flip_physical{225}=0x5d +phy_chain_tx_lane_map_physical{225.0}=0x75326041 +serdes_core_tx_polarity_flip_physical{225}=0x2e + +# BlackhawkCore29 +phy_chain_rx_lane_map_physical{233.0}=0x43102567 +serdes_core_rx_polarity_flip_physical{233}=0xa2 +phy_chain_tx_lane_map_physical{233.0}=0x56320714 +serdes_core_tx_polarity_flip_physical{233}=0x9c + +# BlackhawkCore30 +phy_chain_rx_lane_map_physical{241.0}=0x01546273 +serdes_core_rx_polarity_flip_physical{241}=0x53 +phy_chain_tx_lane_map_physical{241.0}=0x57326041 +serdes_core_tx_polarity_flip_physical{241}=0x2e + +# BlackhawkCore31 +phy_chain_rx_lane_map_physical{249.0}=0x64103527 +serdes_core_rx_polarity_flip_physical{249}=0xed +phy_chain_tx_lane_map_physical{249.0}=0x32570416 +serdes_core_tx_polarity_flip_physical{249}=0x87 + diff --git a/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/custom_led.bin b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/custom_led.bin new file mode 100644 index 000000000000..fdbf3aa30a80 Binary files /dev/null and b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/custom_led.bin differ diff --git a/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/default_sku b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/default_sku new file mode 100644 index 000000000000..e3b3403ede2c --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/default_sku @@ -0,0 +1 @@ +Alphanetworks-SNJ60D0-320F t1 diff --git a/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/installer.conf b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/installer.conf new file mode 100644 index 000000000000..40074bddd132 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/installer.conf @@ -0,0 +1,4 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="modprobe.blacklist=i2c-ismt,i2c_ismt,i2c-i801,i2c_i801" diff --git a/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/led_proc_init.soc b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/led_proc_init.soc new file mode 100644 index 000000000000..26a5f8bab722 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/led_proc_init.soc @@ -0,0 +1,11 @@ +# LED microprocessor initialization for alphanetworks snj60b0-320f + +#LED FW is loaded in SAI platform_init.c +#m0 load 0 0x3800 /alpha/bcm/led/jungfrau-320f_traffic_led.bin +led start +led auto on + +# Load SFP Pre-Emphasis static configure +# This is work around for 6-taps mode +#rcload /usr/share/sonic/platform/preemphasis-32x400G.soc + diff --git a/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/linkscan_led_fw.bin b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/linkscan_led_fw.bin new file mode 100644 index 000000000000..b1e43d4d48d4 Binary files /dev/null and b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/linkscan_led_fw.bin differ diff --git a/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/media_settings.json b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/media_settings.json new file mode 100644 index 000000000000..f40fba218aa3 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/media_settings.json @@ -0,0 +1,3908 @@ +{ + "PORT_MEDIA_SETTINGS": { + "0": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008820", + "lane1": "0x008820", + "lane2": "0x008820", + "lane3": "0x008820", + "lane4": "0x008820", + "lane5": "0x008820", + "lane6": "0x008820", + "lane7": "0x008820" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008820", + "lane1": "0x008820", + "lane2": "0x008820", + "lane3": "0x008820", + "lane4": "0x008820", + "lane5": "0x008820", + "lane6": "0x008820", + "lane7": "0x008820" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "1": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x00881c", + "lane1": "0x00881c", + "lane2": "0x00881c", + "lane3": "0x00881c", + "lane4": "0x00881c", + "lane5": "0x00881c", + "lane6": "0x00881c", + "lane7": "0x00881c" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x00881c", + "lane1": "0x00881c", + "lane2": "0x00881c", + "lane3": "0x00881c", + "lane4": "0x00881c", + "lane5": "0x00881c", + "lane6": "0x00881c", + "lane7": "0x00881c" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "2": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x00891f", + "lane1": "0x00891f", + "lane2": "0x00891f", + "lane3": "0x00891f", + "lane4": "0x00891f", + "lane5": "0x00891f", + "lane6": "0x00891f", + "lane7": "0x00891f" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x00891f", + "lane1": "0x00891f", + "lane2": "0x00891f", + "lane3": "0x00891f", + "lane4": "0x00891f", + "lane5": "0x00891f", + "lane6": "0x00891f", + "lane7": "0x00891f" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "3": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008820", + "lane1": "0x008820", + "lane2": "0x008820", + "lane3": "0x008820", + "lane4": "0x008820", + "lane5": "0x008820", + "lane6": "0x008820", + "lane7": "0x008820" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008820", + "lane1": "0x008820", + "lane2": "0x008820", + "lane3": "0x008820", + "lane4": "0x008820", + "lane5": "0x008820", + "lane6": "0x008820", + "lane7": "0x008820" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "4": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x009018", + "lane1": "0x009018", + "lane2": "0x009018", + "lane3": "0x009018", + "lane4": "0x009018", + "lane5": "0x009018", + "lane6": "0x009018", + "lane7": "0x009018" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x009018", + "lane1": "0x009018", + "lane2": "0x009018", + "lane3": "0x009018", + "lane4": "0x009018", + "lane5": "0x009018", + "lane6": "0x009018", + "lane7": "0x009018" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "5": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008c1c", + "lane1": "0x008c1c", + "lane2": "0x008c1c", + "lane3": "0x008c1c", + "lane4": "0x008c1c", + "lane5": "0x008c1c", + "lane6": "0x008c1c", + "lane7": "0x008c1c" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008c1c", + "lane1": "0x008c1c", + "lane2": "0x008c1c", + "lane3": "0x008c1c", + "lane4": "0x008c1c", + "lane5": "0x008c1c", + "lane6": "0x008c1c", + "lane7": "0x008c1c" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "6": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008d1b", + "lane1": "0x008d1b", + "lane2": "0x008d1b", + "lane3": "0x008d1b", + "lane4": "0x008d1b", + "lane5": "0x008d1b", + "lane6": "0x008d1b", + "lane7": "0x008d1b" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008d1b", + "lane1": "0x008d1b", + "lane2": "0x008d1b", + "lane3": "0x008d1b", + "lane4": "0x008d1b", + "lane5": "0x008d1b", + "lane6": "0x008d1b", + "lane7": "0x008d1b" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "7": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008c18", + "lane1": "0x008c18", + "lane2": "0x008c18", + "lane3": "0x008c18", + "lane4": "0x008c18", + "lane5": "0x008c18", + "lane6": "0x008c18", + "lane7": "0x008c18" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008c18", + "lane1": "0x008c18", + "lane2": "0x008c18", + "lane3": "0x008c18", + "lane4": "0x008c18", + "lane5": "0x008c18", + "lane6": "0x008c18", + "lane7": "0x008c18" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "8": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008e1a", + "lane1": "0x008e1a", + "lane2": "0x008e1a", + "lane3": "0x008e1a", + "lane4": "0x008e1a", + "lane5": "0x008e1a", + "lane6": "0x008e1a", + "lane7": "0x008e1a" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008e1a", + "lane1": "0x008e1a", + "lane2": "0x008e1a", + "lane3": "0x008e1a", + "lane4": "0x008e1a", + "lane5": "0x008e1a", + "lane6": "0x008e1a", + "lane7": "0x008e1a" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "9": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008a1e", + "lane1": "0x008a1e", + "lane2": "0x008a1e", + "lane3": "0x008a1e", + "lane4": "0x008a1e", + "lane5": "0x008a1e", + "lane6": "0x008a1e", + "lane7": "0x008a1e" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008a1e", + "lane1": "0x008a1e", + "lane2": "0x008a1e", + "lane3": "0x008a1e", + "lane4": "0x008a1e", + "lane5": "0x008a1e", + "lane6": "0x008a1e", + "lane7": "0x008a1e" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "10": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0c920c", + "lane1": "0x0c920c", + "lane2": "0x0c920c", + "lane3": "0x0c920c", + "lane4": "0x0c920c", + "lane5": "0x0c920c", + "lane6": "0x0c920c", + "lane7": "0x0c920c" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0c920c", + "lane1": "0x0c920c", + "lane2": "0x0c920c", + "lane3": "0x0c920c", + "lane4": "0x0c920c", + "lane5": "0x0c920c", + "lane6": "0x0c920c", + "lane7": "0x0c920c" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0c920c", + "lane1": "0x0c920c", + "lane2": "0x0c920c", + "lane3": "0x0c920c", + "lane4": "0x0c920c", + "lane5": "0x0c920c", + "lane6": "0x0c920c", + "lane7": "0x0c920c" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0c920c", + "lane1": "0x0c920c", + "lane2": "0x0c920c", + "lane3": "0x0c920c", + "lane4": "0x0c920c", + "lane5": "0x0c920c", + "lane6": "0x0c920c", + "lane7": "0x0c920c" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0c920c", + "lane1": "0x0c920c", + "lane2": "0x0c920c", + "lane3": "0x0c920c", + "lane4": "0x0c920c", + "lane5": "0x0c920c", + "lane6": "0x0c920c", + "lane7": "0x0c920c" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008a1c", + "lane1": "0x008a1c", + "lane2": "0x008a1c", + "lane3": "0x008a1c", + "lane4": "0x008a1c", + "lane5": "0x008a1c", + "lane6": "0x008a1c", + "lane7": "0x008a1c" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008a1c", + "lane1": "0x008a1c", + "lane2": "0x008a1c", + "lane3": "0x008a1c", + "lane4": "0x008a1c", + "lane5": "0x008a1c", + "lane6": "0x008a1c", + "lane7": "0x008a1c" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "11": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0a960a", + "lane1": "0x0a960a", + "lane2": "0x0a960a", + "lane3": "0x0a960a", + "lane4": "0x0a960a", + "lane5": "0x0a960a", + "lane6": "0x0a960a", + "lane7": "0x0a960a" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0a960a", + "lane1": "0x0a960a", + "lane2": "0x0a960a", + "lane3": "0x0a960a", + "lane4": "0x0a960a", + "lane5": "0x0a960a", + "lane6": "0x0a960a", + "lane7": "0x0a960a" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0a960a", + "lane1": "0x0a960a", + "lane2": "0x0a960a", + "lane3": "0x0a960a", + "lane4": "0x0a960a", + "lane5": "0x0a960a", + "lane6": "0x0a960a", + "lane7": "0x0a960a" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0a960a", + "lane1": "0x0a960a", + "lane2": "0x0a960a", + "lane3": "0x0a960a", + "lane4": "0x0a960a", + "lane5": "0x0a960a", + "lane6": "0x0a960a", + "lane7": "0x0a960a" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0a960a", + "lane1": "0x0a960a", + "lane2": "0x0a960a", + "lane3": "0x0a960a", + "lane4": "0x0a960a", + "lane5": "0x0a960a", + "lane6": "0x0a960a", + "lane7": "0x0a960a" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0a960a", + "lane1": "0x0a960a", + "lane2": "0x0a960a", + "lane3": "0x0a960a", + "lane4": "0x0a960a", + "lane5": "0x0a960a", + "lane6": "0x0a960a", + "lane7": "0x0a960a" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0a960a", + "lane1": "0x0a960a", + "lane2": "0x0a960a", + "lane3": "0x0a960a", + "lane4": "0x0a960a", + "lane5": "0x0a960a", + "lane6": "0x0a960a", + "lane7": "0x0a960a" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x00881e", + "lane1": "0x00881e", + "lane2": "0x00881e", + "lane3": "0x00881e", + "lane4": "0x00881e", + "lane5": "0x00881e", + "lane6": "0x00881e", + "lane7": "0x00881e" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x00881e", + "lane1": "0x00881e", + "lane2": "0x00881e", + "lane3": "0x00881e", + "lane4": "0x00881e", + "lane5": "0x00881e", + "lane6": "0x00881e", + "lane7": "0x00881e" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "12": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0d900d", + "lane1": "0x0d900d", + "lane2": "0x0d900d", + "lane3": "0x0d900d", + "lane4": "0x0d900d", + "lane5": "0x0d900d", + "lane6": "0x0d900d", + "lane7": "0x0d900d" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0d900d", + "lane1": "0x0d900d", + "lane2": "0x0d900d", + "lane3": "0x0d900d", + "lane4": "0x0d900d", + "lane5": "0x0d900d", + "lane6": "0x0d900d", + "lane7": "0x0d900d" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0d900d", + "lane1": "0x0d900d", + "lane2": "0x0d900d", + "lane3": "0x0d900d", + "lane4": "0x0d900d", + "lane5": "0x0d900d", + "lane6": "0x0d900d", + "lane7": "0x0d900d" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0d900d", + "lane1": "0x0d900d", + "lane2": "0x0d900d", + "lane3": "0x0d900d", + "lane4": "0x0d900d", + "lane5": "0x0d900d", + "lane6": "0x0d900d", + "lane7": "0x0d900d" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0d900d", + "lane1": "0x0d900d", + "lane2": "0x0d900d", + "lane3": "0x0d900d", + "lane4": "0x0d900d", + "lane5": "0x0d900d", + "lane6": "0x0d900d", + "lane7": "0x0d900d" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0d900d", + "lane1": "0x0d900d", + "lane2": "0x0d900d", + "lane3": "0x0d900d", + "lane4": "0x0d900d", + "lane5": "0x0d900d", + "lane6": "0x0d900d", + "lane7": "0x0d900d" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0d900d", + "lane1": "0x0d900d", + "lane2": "0x0d900d", + "lane3": "0x0d900d", + "lane4": "0x0d900d", + "lane5": "0x0d900d", + "lane6": "0x0d900d", + "lane7": "0x0d900d" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008b1d", + "lane1": "0x008b1d", + "lane2": "0x008b1d", + "lane3": "0x008b1d", + "lane4": "0x008b1d", + "lane5": "0x008b1d", + "lane6": "0x008b1d", + "lane7": "0x008b1d" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008b1d", + "lane1": "0x008b1d", + "lane2": "0x008b1d", + "lane3": "0x008b1d", + "lane4": "0x008b1d", + "lane5": "0x008b1d", + "lane6": "0x008b1d", + "lane7": "0x008b1d" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "13": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0b940b", + "lane1": "0x0b940b", + "lane2": "0x0b940b", + "lane3": "0x0b940b", + "lane4": "0x0b940b", + "lane5": "0x0b940b", + "lane6": "0x0b940b", + "lane7": "0x0b940b" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0b940b", + "lane1": "0x0b940b", + "lane2": "0x0b940b", + "lane3": "0x0b940b", + "lane4": "0x0b940b", + "lane5": "0x0b940b", + "lane6": "0x0b940b", + "lane7": "0x0b940b" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0b940b", + "lane1": "0x0b940b", + "lane2": "0x0b940b", + "lane3": "0x0b940b", + "lane4": "0x0b940b", + "lane5": "0x0b940b", + "lane6": "0x0b940b", + "lane7": "0x0b940b" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0b940b", + "lane1": "0x0b940b", + "lane2": "0x0b940b", + "lane3": "0x0b940b", + "lane4": "0x0b940b", + "lane5": "0x0b940b", + "lane6": "0x0b940b", + "lane7": "0x0b940b" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0b940b", + "lane1": "0x0b940b", + "lane2": "0x0b940b", + "lane3": "0x0b940b", + "lane4": "0x0b940b", + "lane5": "0x0b940b", + "lane6": "0x0b940b", + "lane7": "0x0b940b" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0b940b", + "lane1": "0x0b940b", + "lane2": "0x0b940b", + "lane3": "0x0b940b", + "lane4": "0x0b940b", + "lane5": "0x0b940b", + "lane6": "0x0b940b", + "lane7": "0x0b940b" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0b940b", + "lane1": "0x0b940b", + "lane2": "0x0b940b", + "lane3": "0x0b940b", + "lane4": "0x0b940b", + "lane5": "0x0b940b", + "lane6": "0x0b940b", + "lane7": "0x0b940b" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008820", + "lane1": "0x008820", + "lane2": "0x008820", + "lane3": "0x008820", + "lane4": "0x008820", + "lane5": "0x008820", + "lane6": "0x008820", + "lane7": "0x008820" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008820", + "lane1": "0x008820", + "lane2": "0x008820", + "lane3": "0x008820", + "lane4": "0x008820", + "lane5": "0x008820", + "lane6": "0x008820", + "lane7": "0x008820" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "14": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x099809", + "lane1": "0x099809", + "lane2": "0x099809", + "lane3": "0x099809", + "lane4": "0x099809", + "lane5": "0x099809", + "lane6": "0x099809", + "lane7": "0x099809" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x099809", + "lane1": "0x099809", + "lane2": "0x099809", + "lane3": "0x099809", + "lane4": "0x099809", + "lane5": "0x099809", + "lane6": "0x099809", + "lane7": "0x099809" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x099809", + "lane1": "0x099809", + "lane2": "0x099809", + "lane3": "0x099809", + "lane4": "0x099809", + "lane5": "0x099809", + "lane6": "0x099809", + "lane7": "0x099809" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x099809", + "lane1": "0x099809", + "lane2": "0x099809", + "lane3": "0x099809", + "lane4": "0x099809", + "lane5": "0x099809", + "lane6": "0x099809", + "lane7": "0x099809" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x099809", + "lane1": "0x099809", + "lane2": "0x099809", + "lane3": "0x099809", + "lane4": "0x099809", + "lane5": "0x099809", + "lane6": "0x099809", + "lane7": "0x099809" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x099809", + "lane1": "0x099809", + "lane2": "0x099809", + "lane3": "0x099809", + "lane4": "0x099809", + "lane5": "0x099809", + "lane6": "0x099809", + "lane7": "0x099809" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x099809", + "lane1": "0x099809", + "lane2": "0x099809", + "lane3": "0x099809", + "lane4": "0x099809", + "lane5": "0x099809", + "lane6": "0x099809", + "lane7": "0x099809" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008b1d", + "lane1": "0x008b1d", + "lane2": "0x008b1d", + "lane3": "0x008b1d", + "lane4": "0x008b1d", + "lane5": "0x008b1d", + "lane6": "0x008b1d", + "lane7": "0x008b1d" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008b1d", + "lane1": "0x008b1d", + "lane2": "0x008b1d", + "lane3": "0x008b1d", + "lane4": "0x008b1d", + "lane5": "0x008b1d", + "lane6": "0x008b1d", + "lane7": "0x008b1d" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "15": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0a960a", + "lane1": "0x0a960a", + "lane2": "0x0a960a", + "lane3": "0x0a960a", + "lane4": "0x0a960a", + "lane5": "0x0a960a", + "lane6": "0x0a960a", + "lane7": "0x0a960a" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0a960a", + "lane1": "0x0a960a", + "lane2": "0x0a960a", + "lane3": "0x0a960a", + "lane4": "0x0a960a", + "lane5": "0x0a960a", + "lane6": "0x0a960a", + "lane7": "0x0a960a" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0a960a", + "lane1": "0x0a960a", + "lane2": "0x0a960a", + "lane3": "0x0a960a", + "lane4": "0x0a960a", + "lane5": "0x0a960a", + "lane6": "0x0a960a", + "lane7": "0x0a960a" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0a960a", + "lane1": "0x0a960a", + "lane2": "0x0a960a", + "lane3": "0x0a960a", + "lane4": "0x0a960a", + "lane5": "0x0a960a", + "lane6": "0x0a960a", + "lane7": "0x0a960a" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0a960a", + "lane1": "0x0a960a", + "lane2": "0x0a960a", + "lane3": "0x0a960a", + "lane4": "0x0a960a", + "lane5": "0x0a960a", + "lane6": "0x0a960a", + "lane7": "0x0a960a" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0a960a", + "lane1": "0x0a960a", + "lane2": "0x0a960a", + "lane3": "0x0a960a", + "lane4": "0x0a960a", + "lane5": "0x0a960a", + "lane6": "0x0a960a", + "lane7": "0x0a960a" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0a960a", + "lane1": "0x0a960a", + "lane2": "0x0a960a", + "lane3": "0x0a960a", + "lane4": "0x0a960a", + "lane5": "0x0a960a", + "lane6": "0x0a960a", + "lane7": "0x0a960a" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x009018", + "lane1": "0x009018", + "lane2": "0x009018", + "lane3": "0x009018", + "lane4": "0x009018", + "lane5": "0x009018", + "lane6": "0x009018", + "lane7": "0x009018" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x009018", + "lane1": "0x009018", + "lane2": "0x009018", + "lane3": "0x009018", + "lane4": "0x009018", + "lane5": "0x009018", + "lane6": "0x009018", + "lane7": "0x009018" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "16": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008e1a", + "lane1": "0x008e1a", + "lane2": "0x008e1a", + "lane3": "0x008e1a", + "lane4": "0x008e1a", + "lane5": "0x008e1a", + "lane6": "0x008e1a", + "lane7": "0x008e1a" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008e1a", + "lane1": "0x008e1a", + "lane2": "0x008e1a", + "lane3": "0x008e1a", + "lane4": "0x008e1a", + "lane5": "0x008e1a", + "lane6": "0x008e1a", + "lane7": "0x008e1a" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "17": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x069e06", + "lane1": "0x069e06", + "lane2": "0x069e06", + "lane3": "0x069e06", + "lane4": "0x069e06", + "lane5": "0x069e06", + "lane6": "0x069e06", + "lane7": "0x069e06" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x069e06", + "lane1": "0x069e06", + "lane2": "0x069e06", + "lane3": "0x069e06", + "lane4": "0x069e06", + "lane5": "0x069e06", + "lane6": "0x069e06", + "lane7": "0x069e06" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x069e06", + "lane1": "0x069e06", + "lane2": "0x069e06", + "lane3": "0x069e06", + "lane4": "0x069e06", + "lane5": "0x069e06", + "lane6": "0x069e06", + "lane7": "0x069e06" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x069e06", + "lane1": "0x069e06", + "lane2": "0x069e06", + "lane3": "0x069e06", + "lane4": "0x069e06", + "lane5": "0x069e06", + "lane6": "0x069e06", + "lane7": "0x069e06" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x069e06", + "lane1": "0x069e06", + "lane2": "0x069e06", + "lane3": "0x069e06", + "lane4": "0x069e06", + "lane5": "0x069e06", + "lane6": "0x069e06", + "lane7": "0x069e06" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x069e06", + "lane1": "0x069e06", + "lane2": "0x069e06", + "lane3": "0x069e06", + "lane4": "0x069e06", + "lane5": "0x069e06", + "lane6": "0x069e06", + "lane7": "0x069e06" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x069e06", + "lane1": "0x069e06", + "lane2": "0x069e06", + "lane3": "0x069e06", + "lane4": "0x069e06", + "lane5": "0x069e06", + "lane6": "0x069e06", + "lane7": "0x069e06" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008c1c", + "lane1": "0x008c1c", + "lane2": "0x008c1c", + "lane3": "0x008c1c", + "lane4": "0x008c1c", + "lane5": "0x008c1c", + "lane6": "0x008c1c", + "lane7": "0x008c1c" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008c1c", + "lane1": "0x008c1c", + "lane2": "0x008c1c", + "lane3": "0x008c1c", + "lane4": "0x008c1c", + "lane5": "0x008c1c", + "lane6": "0x008c1c", + "lane7": "0x008c1c" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "18": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0b940b", + "lane1": "0x0b940b", + "lane2": "0x0b940b", + "lane3": "0x0b940b", + "lane4": "0x0b940b", + "lane5": "0x0b940b", + "lane6": "0x0b940b", + "lane7": "0x0b940b" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0b940b", + "lane1": "0x0b940b", + "lane2": "0x0b940b", + "lane3": "0x0b940b", + "lane4": "0x0b940b", + "lane5": "0x0b940b", + "lane6": "0x0b940b", + "lane7": "0x0b940b" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0b940b", + "lane1": "0x0b940b", + "lane2": "0x0b940b", + "lane3": "0x0b940b", + "lane4": "0x0b940b", + "lane5": "0x0b940b", + "lane6": "0x0b940b", + "lane7": "0x0b940b" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0b940b", + "lane1": "0x0b940b", + "lane2": "0x0b940b", + "lane3": "0x0b940b", + "lane4": "0x0b940b", + "lane5": "0x0b940b", + "lane6": "0x0b940b", + "lane7": "0x0b940b" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0b940b", + "lane1": "0x0b940b", + "lane2": "0x0b940b", + "lane3": "0x0b940b", + "lane4": "0x0b940b", + "lane5": "0x0b940b", + "lane6": "0x0b940b", + "lane7": "0x0b940b" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0b940b", + "lane1": "0x0b940b", + "lane2": "0x0b940b", + "lane3": "0x0b940b", + "lane4": "0x0b940b", + "lane5": "0x0b940b", + "lane6": "0x0b940b", + "lane7": "0x0b940b" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0b940b", + "lane1": "0x0b940b", + "lane2": "0x0b940b", + "lane3": "0x0b940b", + "lane4": "0x0b940b", + "lane5": "0x0b940b", + "lane6": "0x0b940b", + "lane7": "0x0b940b" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008e1a", + "lane1": "0x008e1a", + "lane2": "0x008e1a", + "lane3": "0x008e1a", + "lane4": "0x008e1a", + "lane5": "0x008e1a", + "lane6": "0x008e1a", + "lane7": "0x008e1a" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008e1a", + "lane1": "0x008e1a", + "lane2": "0x008e1a", + "lane3": "0x008e1a", + "lane4": "0x008e1a", + "lane5": "0x008e1a", + "lane6": "0x008e1a", + "lane7": "0x008e1a" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "19": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008c1a", + "lane1": "0x008c1a", + "lane2": "0x008c1a", + "lane3": "0x008c1a", + "lane4": "0x008c1a", + "lane5": "0x008c1a", + "lane6": "0x008c1a", + "lane7": "0x008c1a" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008c1a", + "lane1": "0x008c1a", + "lane2": "0x008c1a", + "lane3": "0x008c1a", + "lane4": "0x008c1a", + "lane5": "0x008c1a", + "lane6": "0x008c1a", + "lane7": "0x008c1a" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "20": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x009018", + "lane1": "0x009018", + "lane2": "0x009018", + "lane3": "0x009018", + "lane4": "0x009018", + "lane5": "0x009018", + "lane6": "0x009018", + "lane7": "0x009018" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x009018", + "lane1": "0x009018", + "lane2": "0x009018", + "lane3": "0x009018", + "lane4": "0x009018", + "lane5": "0x009018", + "lane6": "0x009018", + "lane7": "0x009018" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "21": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0a960a", + "lane1": "0x0a960a", + "lane2": "0x0a960a", + "lane3": "0x0a960a", + "lane4": "0x0a960a", + "lane5": "0x0a960a", + "lane6": "0x0a960a", + "lane7": "0x0a960a" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0a960a", + "lane1": "0x0a960a", + "lane2": "0x0a960a", + "lane3": "0x0a960a", + "lane4": "0x0a960a", + "lane5": "0x0a960a", + "lane6": "0x0a960a", + "lane7": "0x0a960a" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0a960a", + "lane1": "0x0a960a", + "lane2": "0x0a960a", + "lane3": "0x0a960a", + "lane4": "0x0a960a", + "lane5": "0x0a960a", + "lane6": "0x0a960a", + "lane7": "0x0a960a" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0a960a", + "lane1": "0x0a960a", + "lane2": "0x0a960a", + "lane3": "0x0a960a", + "lane4": "0x0a960a", + "lane5": "0x0a960a", + "lane6": "0x0a960a", + "lane7": "0x0a960a" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0a960a", + "lane1": "0x0a960a", + "lane2": "0x0a960a", + "lane3": "0x0a960a", + "lane4": "0x0a960a", + "lane5": "0x0a960a", + "lane6": "0x0a960a", + "lane7": "0x0a960a" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0a960a", + "lane1": "0x0a960a", + "lane2": "0x0a960a", + "lane3": "0x0a960a", + "lane4": "0x0a960a", + "lane5": "0x0a960a", + "lane6": "0x0a960a", + "lane7": "0x0a960a" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0a960a", + "lane1": "0x0a960a", + "lane2": "0x0a960a", + "lane3": "0x0a960a", + "lane4": "0x0a960a", + "lane5": "0x0a960a", + "lane6": "0x0a960a", + "lane7": "0x0a960a" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008d1b", + "lane1": "0x008d1b", + "lane2": "0x008d1b", + "lane3": "0x008d1b", + "lane4": "0x008d1b", + "lane5": "0x008d1b", + "lane6": "0x008d1b", + "lane7": "0x008d1b" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008d1b", + "lane1": "0x008d1b", + "lane2": "0x008d1b", + "lane3": "0x008d1b", + "lane4": "0x008d1b", + "lane5": "0x008d1b", + "lane6": "0x008d1b", + "lane7": "0x008d1b" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "22": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008d1b", + "lane1": "0x008d1b", + "lane2": "0x008d1b", + "lane3": "0x008d1b", + "lane4": "0x008d1b", + "lane5": "0x008d1b", + "lane6": "0x008d1b", + "lane7": "0x008d1b" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008d1b", + "lane1": "0x008d1b", + "lane2": "0x008d1b", + "lane3": "0x008d1b", + "lane4": "0x008d1b", + "lane5": "0x008d1b", + "lane6": "0x008d1b", + "lane7": "0x008d1b" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "23": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x079c07", + "lane1": "0x079c07", + "lane2": "0x079c07", + "lane3": "0x079c07", + "lane4": "0x079c07", + "lane5": "0x079c07", + "lane6": "0x079c07", + "lane7": "0x079c07" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008820", + "lane1": "0x008820", + "lane2": "0x008820", + "lane3": "0x008820", + "lane4": "0x008820", + "lane5": "0x008820", + "lane6": "0x008820", + "lane7": "0x008820" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008820", + "lane1": "0x008820", + "lane2": "0x008820", + "lane3": "0x008820", + "lane4": "0x008820", + "lane5": "0x008820", + "lane6": "0x008820", + "lane7": "0x008820" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "24": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008e1a", + "lane1": "0x008e1a", + "lane2": "0x008e1a", + "lane3": "0x008e1a", + "lane4": "0x008e1a", + "lane5": "0x008e1a", + "lane6": "0x008e1a", + "lane7": "0x008e1a" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008e1a", + "lane1": "0x008e1a", + "lane2": "0x008e1a", + "lane3": "0x008e1a", + "lane4": "0x008e1a", + "lane5": "0x008e1a", + "lane6": "0x008e1a", + "lane7": "0x008e1a" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "25": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x009018", + "lane1": "0x009018", + "lane2": "0x009018", + "lane3": "0x009018", + "lane4": "0x009018", + "lane5": "0x009018", + "lane6": "0x009018", + "lane7": "0x009018" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x009018", + "lane1": "0x009018", + "lane2": "0x009018", + "lane3": "0x009018", + "lane4": "0x009018", + "lane5": "0x009018", + "lane6": "0x009018", + "lane7": "0x009018" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "26": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008d1b", + "lane1": "0x008d1b", + "lane2": "0x008d1b", + "lane3": "0x008d1b", + "lane4": "0x008d1b", + "lane5": "0x008d1b", + "lane6": "0x008d1b", + "lane7": "0x008d1b" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008d1b", + "lane1": "0x008d1b", + "lane2": "0x008d1b", + "lane3": "0x008d1b", + "lane4": "0x008d1b", + "lane5": "0x008d1b", + "lane6": "0x008d1b", + "lane7": "0x008d1b" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "27": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008a1e", + "lane1": "0x008a1e", + "lane2": "0x008a1e", + "lane3": "0x008a1e", + "lane4": "0x008a1e", + "lane5": "0x008a1e", + "lane6": "0x008a1e", + "lane7": "0x008a1e" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008a1e", + "lane1": "0x008a1e", + "lane2": "0x008a1e", + "lane3": "0x008a1e", + "lane4": "0x008a1e", + "lane5": "0x008a1e", + "lane6": "0x008a1e", + "lane7": "0x008a1e" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "28": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0f8c0f", + "lane1": "0x0f8c0f", + "lane2": "0x0f8c0f", + "lane3": "0x0f8c0f", + "lane4": "0x0f8c0f", + "lane5": "0x0f8c0f", + "lane6": "0x0f8c0f", + "lane7": "0x0f8c0f" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008c1c", + "lane1": "0x008c1c", + "lane2": "0x008c1c", + "lane3": "0x008c1c", + "lane4": "0x008c1c", + "lane5": "0x008c1c", + "lane6": "0x008c1c", + "lane7": "0x008c1c" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008c1c", + "lane1": "0x008c1c", + "lane2": "0x008c1c", + "lane3": "0x008c1c", + "lane4": "0x008c1c", + "lane5": "0x008c1c", + "lane6": "0x008c1c", + "lane7": "0x008c1c" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "29": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008c1c", + "lane1": "0x008c1c", + "lane2": "0x008c1c", + "lane3": "0x008c1c", + "lane4": "0x008c1c", + "lane5": "0x008c1c", + "lane6": "0x008c1c", + "lane7": "0x008c1c" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008c1c", + "lane1": "0x008c1c", + "lane2": "0x008c1c", + "lane3": "0x008c1c", + "lane4": "0x008c1c", + "lane5": "0x008c1c", + "lane6": "0x008c1c", + "lane7": "0x008c1c" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "30": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x0e8e0e", + "lane1": "0x0e8e0e", + "lane2": "0x0e8e0e", + "lane3": "0x0e8e0e", + "lane4": "0x0e8e0e", + "lane5": "0x0e8e0e", + "lane6": "0x0e8e0e", + "lane7": "0x0e8e0e" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008a1e", + "lane1": "0x008a1e", + "lane2": "0x008a1e", + "lane3": "0x008a1e", + "lane4": "0x008a1e", + "lane5": "0x008a1e", + "lane6": "0x008a1e", + "lane7": "0x008a1e" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008a1e", + "lane1": "0x008a1e", + "lane2": "0x008a1e", + "lane3": "0x008a1e", + "lane4": "0x008a1e", + "lane5": "0x008a1e", + "lane6": "0x008a1e", + "lane7": "0x008a1e" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + }, + "31": { + "FINISAR CORP.-FCBR850QE1C10": { + "preemphasis": { + "lane0": "0x108a10", + "lane1": "0x108a10", + "lane2": "0x108a10", + "lane3": "0x108a10", + "lane4": "0x108a10", + "lane5": "0x108a10", + "lane6": "0x108a10", + "lane7": "0x108a10" + } + }, + "CENTERA-C08050DSXN000": { + "preemphasis": { + "lane0": "0x108a10", + "lane1": "0x108a10", + "lane2": "0x108a10", + "lane3": "0x108a10", + "lane4": "0x108a10", + "lane5": "0x108a10", + "lane6": "0x108a10", + "lane7": "0x108a10" + } + }, + "INNOLIGHT-T-DP4CNH-N00": { + "preemphasis": { + "lane0": "0x108a10", + "lane1": "0x108a10", + "lane2": "0x108a10", + "lane3": "0x108a10", + "lane4": "0x108a10", + "lane5": "0x108a10", + "lane6": "0x108a10", + "lane7": "0x108a10" + } + }, + "INNOLIGHT-T-DQ4CNT-N00": { + "preemphasis": { + "lane0": "0x108a10", + "lane1": "0x108a10", + "lane2": "0x108a10", + "lane3": "0x108a10", + "lane4": "0x108a10", + "lane5": "0x108a10", + "lane6": "0x108a10", + "lane7": "0x108a10" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFA": { + "preemphasis": { + "lane0": "0x108a10", + "lane1": "0x108a10", + "lane2": "0x108a10", + "lane3": "0x108a10", + "lane4": "0x108a10", + "lane5": "0x108a10", + "lane6": "0x108a10", + "lane7": "0x108a10" + } + }, + "SOURCEPHOTONICS-SPQ4ELRCDFB": { + "preemphasis": { + "lane0": "0x108a10", + "lane1": "0x108a10", + "lane2": "0x108a10", + "lane3": "0x108a10", + "lane4": "0x108a10", + "lane5": "0x108a10", + "lane6": "0x108a10", + "lane7": "0x108a10" + } + }, + "QSFP-DD": { + "preemphasis": { + "lane0": "0x108a10", + "lane1": "0x108a10", + "lane2": "0x108a10", + "lane3": "0x108a10", + "lane4": "0x108a10", + "lane5": "0x108a10", + "lane6": "0x108a10", + "lane7": "0x108a10" + } + }, + "MOLEX-2015911010": { + "preemphasis": { + "lane0": "0x008c1c", + "lane1": "0x008c1c", + "lane2": "0x008c1c", + "lane3": "0x008c1c", + "lane4": "0x008c1c", + "lane5": "0x008c1c", + "lane6": "0x008c1c", + "lane7": "0x008c1c" + } + }, + "LUXSHARE-TECH-LWFDD002-SD-R": { + "preemphasis": { + "lane0": "0x008c1c", + "lane1": "0x008c1c", + "lane2": "0x008c1c", + "lane3": "0x008c1c", + "lane4": "0x008c1c", + "lane5": "0x008c1c", + "lane6": "0x008c1c", + "lane7": "0x008c1c" + } + }, + "Default": { + "preemphasis": { + "lane0": "0x0c8418", + "lane1": "0x0c8418", + "lane2": "0x0c8418", + "lane3": "0x0c8418", + "lane4": "0x0c8418", + "lane5": "0x0c8418", + "lane6": "0x0c8418", + "lane7": "0x0c8418" + } + } + } + } +} diff --git a/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/pcie.yaml b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/pcie.yaml new file mode 100644 index 000000000000..1496f41984ba --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/pcie.yaml @@ -0,0 +1,118 @@ +- bus: '00' + dev: '00' + fn: '0' + id: '1980' + name: 'Host bridge: Intel Corporation Atom Processor C3000 Series System Agent (rev + 11)' +- bus: '00' + dev: '04' + fn: '0' + id: 19a1 + name: 'Host bridge: Intel Corporation Atom Processor C3000 Series Error Registers + (rev 11)' +- bus: '00' + dev: '05' + fn: '0' + id: 19a2 + name: 'Generic system peripheral [0807]: Intel Corporation Atom Processor C3000 + Series Root Complex Event Collector (rev 11)' +- bus: '00' + dev: '06' + fn: '0' + id: 19a3 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series Integrated QAT + Root Port (rev 11)' +- bus: '00' + dev: 0a + fn: '0' + id: 19a5 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root + Port (rev 11)' +- bus: '00' + dev: 0c + fn: '0' + id: 19a7 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root + Port (rev 11)' +- bus: '00' + dev: 0e + fn: '0' + id: 19a8 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root + Port (rev 11)' +- bus: '00' + dev: '12' + fn: '0' + id: 19ac + name: 'System peripheral: Intel Corporation DNV SMBus Contoller - Host (rev 11)' +- bus: '00' + dev: '13' + fn: '0' + id: 19b2 + name: 'SATA controller: Intel Corporation DNV SATA Controller 0 (rev 11)' +- bus: '00' + dev: '14' + fn: '0' + id: 19c2 + name: 'SATA controller: Intel Corporation DNV SATA Controller 1 (rev 11)' +- bus: '00' + dev: '15' + fn: '0' + id: 19d0 + name: 'USB controller: Intel Corporation Atom Processor C3000 Series USB 3.0 xHCI + Controller (rev 11)' +- bus: '00' + dev: '18' + fn: '0' + id: 19d3 + name: 'Communication controller: Intel Corporation Atom Processor C3000 Series ME + HECI 1 (rev 11)' +- bus: '00' + dev: 1a + fn: '0' + id: 19d8 + name: 'Serial controller: Intel Corporation Atom Processor C3000 Series HSUART Controller + (rev 11)' +- bus: '00' + dev: 1c + fn: '0' + id: 19db + name: 'SD Host controller: Intel Corporation Device 19db (rev 11)' +- bus: '00' + dev: 1f + fn: '0' + id: 19dc + name: 'ISA bridge: Intel Corporation DNV LPC or eSPI (rev 11)' +- bus: '00' + dev: 1f + fn: '2' + id: 19de + name: 'Memory controller: Intel Corporation Atom Processor C3000 Series Power Management + Controller (rev 11)' +- bus: '00' + dev: 1f + fn: '4' + id: 19df + name: 'SMBus: Intel Corporation DNV SMBus controller (rev 11)' +- bus: '00' + dev: 1f + fn: '5' + id: 19e0 + name: 'Serial bus controller [0c80]: Intel Corporation DNV SPI Controller (rev 11)' +- bus: '01' + dev: '00' + fn: '0' + id: 19e2 + name: 'Co-processor: Intel Corporation Atom Processor C3000 Series QuickAssist Technology + (rev 11)' +- bus: '04' + dev: '00' + fn: '0' + id: '1533' + name: 'Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev + 03)' +- bus: '05' + dev: '00' + fn: '0' + id: b980 + name: 'Ethernet controller: Broadcom Limited Device b980 (rev 11)' diff --git a/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/platform.json b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/platform.json new file mode 100644 index 000000000000..d881efdd4b19 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/platform.json @@ -0,0 +1,306 @@ +{ + "interfaces": { + "Ethernet0": { + "breakout_modes": { + "1x400G": ["Ethernet1/1/1"], + "2x200G[100G]": ["Ethernet1/1/1", "Ethernet1/1/2"], + "4x100G[50G]": ["Ethernet1/1/1", "Ethernet1/1/2", "Ethernet1/1/3", "Ethernet1/1/4"] + }, + "index": "0,0,0,0,0,0,0,0", + "lanes": "1,2,3,4,5,6,7,8" + }, + "Ethernet8": { + "breakout_modes": { + "1x400G": ["Ethernet1/2/1"], + "2x200G[100G]": ["Ethernet1/2/1", "Ethernet1/2/2"], + "4x100G[50G]": ["Ethernet1/2/1", "Ethernet1/2/2", "Ethernet1/2/3", "Ethernet1/2/4"] + }, + "index": "1,1,1,1,1,1,1,1", + "lanes": "9,10,11,12,13,14,15,16" + }, + "Ethernet16": { + "breakout_modes": { + "1x400G": ["Ethernet1/3/1"], + "2x200G[100G]": ["Ethernet1/3/1", "Ethernet1/3/2"], + "4x100G[50G]": ["Ethernet1/3/1", "Ethernet1/3/2", "Ethernet1/3/3", "Ethernet1/3/4"] + }, + "index": "2,2,2,2,2,2,2,2", + "lanes": "17,18,19,20,21,22,23,24" + }, + "Ethernet24": { + "breakout_modes": { + "1x400G": ["Ethernet1/4/1"], + "2x200G[100G]": ["Ethernet1/4/1", "Ethernet1/4/2"], + "4x100G[50G]": ["Ethernet1/4/1", "Ethernet1/4/2", "Ethernet1/4/3", "Ethernet1/4/4"] + }, + "index": "3,3,3,3,3,3,3,3", + "lanes": "25,26,27,28,29,30,31,32" + }, + "Ethernet32": { + "breakout_modes": { + "1x400G": ["Ethernet1/5/1"], + "2x200G[100G]": ["Ethernet1/5/1", "Ethernet1/5/2"], + "4x100G[50G]": ["Ethernet1/5/1", "Ethernet1/5/2", "Ethernet1/5/3", "Ethernet1/5/4"] + }, + "index": "4,4,4,4,4,4,4,4", + "lanes": "33,34,35,36,37,38,39,40" + }, + "Ethernet40": { + "breakout_modes": { + "1x400G": ["Ethernet1/6/1"], + "2x200G[100G]": ["Ethernet1/6/1", "Ethernet1/6/2"], + "4x100G[50G]": ["Ethernet1/6/1", "Ethernet1/6/2", "Ethernet1/6/3", "Ethernet1/6/4"] + }, + "index": "5,5,5,5,5,5,5,5", + "lanes": "41,42,43,44,45,46,47,48" + }, + "Ethernet48": { + "breakout_modes": { + "1x400G": ["Ethernet1/7/1"], + "2x200G[100G]": ["Ethernet1/7/1", "Ethernet1/7/2"], + "4x100G[50G]": ["Ethernet1/7/1", "Ethernet1/7/2", "Ethernet1/7/3", "Ethernet1/7/4"] + }, + "index": "6,6,6,6,6,6,6,6", + "lanes": "49,50,51,52,53,54,55,56" + }, + "Ethernet56": { + "breakout_modes": { + "1x400G": ["Ethernet1/8/1"], + "2x200G[100G]": ["Ethernet1/8/1", "Ethernet1/8/2"], + "4x100G[50G]": ["Ethernet1/8/1", "Ethernet1/8/2", "Ethernet1/8/3", "Ethernet1/8/4"] + }, + "index": "7,7,7,7,7,7,7,7", + "lanes": "57,58,59,60,61,62,63,64" + }, + "Ethernet64": { + "breakout_modes": { + "1x400G": ["Ethernet1/9/1"], + "2x200G[100G]": ["Ethernet1/9/1", "Ethernet1/9/2"], + "4x100G[50G]": ["Ethernet1/9/1", "Ethernet1/9/2", "Ethernet1/9/3", "Ethernet1/9/4"] + }, + "index": "8,8,8,8,8,8,8,8", + "lanes": "65,66,67,68,69,70,71,72" + }, + "Ethernet72": { + "breakout_modes": { + "1x400G": ["Ethernet1/10/1"], + "2x200G[100G]": ["Ethernet1/10/1", "Ethernet1/10/2"], + "4x100G[50G]": ["Ethernet1/10/1", "Ethernet1/10/2", "Ethernet1/10/3", "Ethernet1/10/4"] + }, + "index": "9,9,9,9,9,9,9,9", + "lanes": "73,74,75,76,77,78,79,80" + }, + "Ethernet80": { + "breakout_modes": { + "1x400G": ["Ethernet1/11/1"], + "2x200G[100G]": ["Ethernet1/11/1", "Ethernet1/11/2"], + "4x100G[50G]": ["Ethernet1/11/1", "Ethernet1/11/2", "Ethernet1/11/3", "Ethernet1/11/4"] + }, + "index": "10,10,10,10,10,10,10,10", + "lanes": "81,82,83,84,85,86,87,88" + }, + "Ethernet88": { + "breakout_modes": { + "1x400G": ["Ethernet1/12/1"], + "2x200G[100G]": ["Ethernet1/12/1", "Ethernet1/12/2"], + "4x100G[50G]": ["Ethernet1/12/1", "Ethernet1/12/2", "Ethernet1/12/3", "Ethernet1/12/4"] + }, + "index": "11,11,11,11,11,11,11,11", + "lanes": "89,90,91,92,93,94,95,96" + }, + "Ethernet96": { + "breakout_modes": { + "1x400G": ["Ethernet1/13/1"], + "2x200G[100G]": ["Ethernet1/13/1", "Ethernet1/13/2"], + "4x100G[50G]": ["Ethernet1/13/1", "Ethernet1/13/2", "Ethernet1/13/3", "Ethernet1/13/4"] + }, + "index": "12,12,12,12,12,12,12,12", + "lanes": "97,98,99,100,101,102,103,104" + }, + "Ethernet104": { + "breakout_modes": { + "1x400G": ["Ethernet1/14/1"], + "2x200G[100G]": ["Ethernet1/14/1", "Ethernet1/14/2"], + "4x100G[50G]": ["Ethernet1/14/1", "Ethernet1/14/2", "Ethernet1/14/3", "Ethernet1/14/4"] + }, + "index": "13,13,13,13,13,13,13,13", + "lanes": "105,106,107,108,109,110,111,112" + }, + "Ethernet112": { + "breakout_modes": { + "1x400G": ["Ethernet1/15/1"], + "2x200G[100G]": ["Ethernet1/15/1", "Ethernet1/15/2"], + "4x100G[50G]": ["Ethernet1/15/1", "Ethernet1/15/2", "Ethernet1/15/3", "Ethernet1/15/4"] + }, + "index": "14,14,14,14,14,14,14,14", + "lanes": "113,114,115,116,117,118,119,120" + }, + "Ethernet120": { + "breakout_modes": { + "1x400G": ["Ethernet1/16/1"], + "2x200G[100G]": ["Ethernet1/16/1", "Ethernet1/16/2"], + "4x100G[50G]": ["Ethernet1/16/1", "Ethernet1/16/2", "Ethernet1/16/3", "Ethernet1/16/4"] + }, + "index": "15,15,15,15,15,15,15,15", + "lanes": "121,122,123,124,125,126,127,128" + }, + "Ethernet128": { + "breakout_modes": { + "1x400G": ["Ethernet1/17/1"], + "2x200G[100G]": ["Ethernet1/17/1", "Ethernet1/17/2"], + "4x100G[50G]": ["Ethernet1/17/1", "Ethernet1/17/2", "Ethernet1/17/3", "Ethernet1/17/4"] + }, + "index": "16,16,16,16,16,16,16,16", + "lanes": "129,130,131,132,133,134,135,136" + }, + "Ethernet136": { + "breakout_modes": { + "1x400G": ["Ethernet1/18/1"], + "2x200G[100G]": ["Ethernet1/18/1", "Ethernet1/18/2"], + "4x100G[50G]": ["Ethernet1/18/1", "Ethernet1/18/2", "Ethernet1/18/3", "Ethernet1/18/4"] + }, + "index": "17,17,17,17,17,17,17,17", + "lanes": "137,138,139,140,141,142,143,144" + }, + "Ethernet144": { + "breakout_modes": { + "1x400G": ["Ethernet1/19/1"], + "2x200G[100G]": ["Ethernet1/19/1", "Ethernet1/19/2"], + "4x100G[50G]": ["Ethernet1/19/1", "Ethernet1/19/2", "Ethernet1/19/3", "Ethernet1/19/4"] + }, + "index": "18,18,18,18,18,18,18,18", + "lanes": "145,146,147,148,149,150,151,152" + }, + "Ethernet152": { + "breakout_modes": { + "1x400G": ["Ethernet1/20/1"], + "2x200G[100G]": ["Ethernet1/20/1", "Ethernet1/20/2"], + "4x100G[50G]": ["Ethernet1/20/1", "Ethernet1/20/2", "Ethernet1/20/3", "Ethernet1/20/4"] + }, + "index": "19,19,19,19,19,19,19,19", + "lanes": "153,154,155,156,157,158,159,160" + }, + "Ethernet160": { + "breakout_modes": { + "1x400G": ["Ethernet1/21/1"], + "2x200G[100G]": ["Ethernet1/21/1", "Ethernet1/21/2"], + "4x100G[50G]": ["Ethernet1/21/1", "Ethernet1/21/2", "Ethernet1/21/3", "Ethernet1/21/4"] + }, + "index": "20,20,20,20,20,20,20,20", + "lanes": "161,162,163,164,165,166,167,168" + }, + "Ethernet168": { + "breakout_modes": { + "1x400G": ["Ethernet1/22/1"], + "2x200G[100G]": ["Ethernet1/22/1", "Ethernet1/22/2"], + "4x100G[50G]": ["Ethernet1/22/1", "Ethernet1/22/2", "Ethernet1/22/3", "Ethernet1/22/4"] + }, + "index": "21,21,21,21,21,21,21,21", + "lanes": "169,170,171,172,173,174,175,176" + }, + "Ethernet176": { + "breakout_modes": { + "1x400G": ["Ethernet1/23/1"], + "2x200G[100G]": ["Ethernet1/23/1", "Ethernet1/23/2"], + "4x100G[50G]": ["Ethernet1/23/1", "Ethernet1/23/2", "Ethernet1/23/3", "Ethernet1/23/4"] + }, + "index": "22,22,22,22,22,22,22,22", + "lanes": "177,178,179,180,181,182,183,184" + }, + "Ethernet184": { + "breakout_modes": { + "1x400G": ["Ethernet1/24/1"], + "2x200G[100G]": ["Ethernet1/24/1", "Ethernet1/24/2"], + "4x100G[50G]": ["Ethernet1/24/1", "Ethernet1/24/2", "Ethernet1/24/3", "Ethernet1/24/4"] + }, + "index": "23,23,23,23,23,23,23,23", + "lanes": "185,186,187,188,189,190,191,192" + }, + "Ethernet192": { + "breakout_modes": { + "1x400G": ["Ethernet1/25/1"], + "2x200G[100G]": ["Ethernet1/25/1", "Ethernet1/25/2"], + "4x100G[50G]": ["Ethernet1/25/1", "Ethernet1/25/2", "Ethernet1/25/3", "Ethernet1/25/4"] + }, + "index": "24,24,24,24,24,24,24,24", + "lanes": "193,194,195,196,197,198,199,200" + }, + "Ethernet200": { + "breakout_modes": { + "1x400G": ["Ethernet1/26/1"], + "2x200G[100G]": ["Ethernet1/26/1", "Ethernet1/26/2"], + "4x100G[50G]": ["Ethernet1/26/1", "Ethernet1/26/2", "Ethernet1/26/3", "Ethernet1/26/4"] + }, + "index": "25,25,25,25,25,25,25,25", + "lanes": "201,202,203,204,205,206,207,208" + }, + "Ethernet208": { + "breakout_modes": { + "1x400G":["Ethernet1/27/1"], + "2x200G[100G]":["Ethernet1/27/1", "Ethernet1/27/2"], + "4x100G[50G]":["Ethernet1/27/1", "Ethernet1/27/2", "Ethernet1/27/3", "Ethernet1/27/4"], + "8x50G":["Ethernet1/27/1", "Ethernet1/27/2", "Ethernet1/27/3", "Ethernet1/27/4", "Ethernet1/27/5", "Ethernet1/27/6", "Ethernet1/27/7", "Ethernet1/27/8"], + "8x25G[10G]":["Ethernet1/27/1", "Ethernet1/27/2", "Ethernet1/27/3", "Ethernet1/27/4", "Ethernet1/27/5", "Ethernet1/27/6", "Ethernet1/27/7", "Ethernet1/27/8"] + }, + "index": "26,26,26,26,26,26,26,26", + "lanes": "209,210,211,212,213,214,215,216" + }, + "Ethernet216": { + "breakout_modes": { + "1x400G":["Ethernet1/28/1"], + "2x200G[100G]":["Ethernet1/28/1", "Ethernet1/28/2"], + "4x100G[50G]":["Ethernet1/28/1", "Ethernet1/28/2", "Ethernet1/28/3", "Ethernet1/28/4"], + "8x50G":["Ethernet1/28/1", "Ethernet1/28/2", "Ethernet1/28/3", "Ethernet1/28/4", "Ethernet1/28/5", "Ethernet1/28/6", "Ethernet1/28/7", "Ethernet1/28/8"], + "8x25G[10G]":["Ethernet1/28/1", "Ethernet1/28/2", "Ethernet1/28/3", "Ethernet1/28/4", "Ethernet1/28/5", "Ethernet1/28/6", "Ethernet1/28/7", "Ethernet1/28/8"] + }, + "index": "27,27,27,27,27,27,27,27", + "lanes": "217,218,219,220,221,222,223,224" + }, + "Ethernet224": { + "breakout_modes": { + "1x400G":["Ethernet1/29/1"] + }, + "index": "28,28,28,28,28,28,28,28", + "lanes": "225,226,227,228,229,230,231,232" + }, + "Ethernet232": { + "breakout_modes": { + "1x400G":["Ethernet1/30/1"] + }, + "index": "29,29,29,29,29,29,29,29", + "lanes": "233,234,235,236,237,238,239,240" + }, + "Ethernet240": { + "breakout_modes": { + "1x400G": ["Ethernet1/31/1"], + "2x200G[100G]": ["Ethernet1/31/1", "Ethernet1/31/2"], + "4x100G[50G]": ["Ethernet1/31/1", "Ethernet1/31/2", "Ethernet1/31/3", "Ethernet1/31/4"] + }, + "index": "30,30,30,30,30,30,30,30", + "lanes": "241,242,243,244,245,246,247,248" + }, + "Ethernet248": { + "breakout_modes": { + "1x400G": ["Ethernet1/32/1"], + "2x200G[100G]": ["Ethernet1/32/1", "Ethernet1/32/2"], + "4x100G[50G]": ["Ethernet1/32/1", "Ethernet1/32/2", "Ethernet1/32/3", "Ethernet1/1/4"] + }, + "index": "31,31,31,31,31,31,31,31", + "lanes": "249,250,251,252,253,254,255,256" + }, + "Ethernet256": { + "breakout_modes": { + "1x10G": ["Ethernet1/33"] + }, + "index": "32", + "lanes": "257" + }, + "Ethernet257": { + "breakout_modes": { + "1x10G": ["Ethernet1/34"] + }, + "index": "33", + "lanes": "258" + } + } +} diff --git a/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/platform_asic b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/platform_env.conf b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/platform_env.conf new file mode 100644 index 000000000000..c8c09ab2d9d9 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/platform_env.conf @@ -0,0 +1,2 @@ +dmasize=32M +usemsi=0 diff --git a/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/pmon_daemon_control.json b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/pmon_daemon_control.json new file mode 100644 index 000000000000..d12b2100eea8 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/pmon_daemon_control.json @@ -0,0 +1,5 @@ +{ + "skip_ledd": true, + "skip_fancontrol": true +} + diff --git a/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/preemphasis-32x400G.soc b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/preemphasis-32x400G.soc new file mode 100644 index 000000000000..5ca7689675df --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/preemphasis-32x400G.soc @@ -0,0 +1,954 @@ +# Preemphasis +# port1 (DAC) +phy raw c45 0x81 0x1 0xffde 0 +phy raw c45 0x81 0x1 0xd134 0x1e0 +phy raw c45 0x81 0x1 0xd135 0x88 +phy raw c45 0x81 0x1 0xd136 0x0 +phy raw c45 0x81 0x1 0xffde 1 +phy raw c45 0x81 0x1 0xd134 0x1e0 +phy raw c45 0x81 0x1 0xd135 0x88 +phy raw c45 0x81 0x1 0xd136 0x0 +phy raw c45 0x81 0x1 0xffde 2 +phy raw c45 0x81 0x1 0xd134 0x1e0 +phy raw c45 0x81 0x1 0xd135 0x88 +phy raw c45 0x81 0x1 0xd136 0x0 +phy raw c45 0x81 0x1 0xffde 3 +phy raw c45 0x81 0x1 0xd134 0x1e0 +phy raw c45 0x81 0x1 0xd135 0x88 +phy raw c45 0x81 0x1 0xd136 0x0 +phy raw c45 0x81 0x1 0xffde 4 +phy raw c45 0x81 0x1 0xd134 0x1e0 +phy raw c45 0x81 0x1 0xd135 0x88 +phy raw c45 0x81 0x1 0xd136 0x0 +phy raw c45 0x81 0x1 0xffde 5 +phy raw c45 0x81 0x1 0xd134 0x1e0 +phy raw c45 0x81 0x1 0xd135 0x88 +phy raw c45 0x81 0x1 0xd136 0x0 +phy raw c45 0x81 0x1 0xffde 6 +phy raw c45 0x81 0x1 0xd134 0x1e0 +phy raw c45 0x81 0x1 0xd135 0x88 +phy raw c45 0x81 0x1 0xd136 0x0 +phy raw c45 0x81 0x1 0xffde 7 +phy raw c45 0x81 0x1 0xd134 0x1e0 +phy raw c45 0x81 0x1 0xd135 0x88 +phy raw c45 0x81 0x1 0xd136 0x0 + +# port2 (DAC) +phy raw c45 0x89 0x1 0xffde 0 +phy raw c45 0x89 0x1 0xd134 0x1e4 +phy raw c45 0x89 0x1 0xd135 0x88 +phy raw c45 0x89 0x1 0xd136 0x0 +phy raw c45 0x89 0x1 0xffde 1 +phy raw c45 0x89 0x1 0xd134 0x1e4 +phy raw c45 0x89 0x1 0xd135 0x88 +phy raw c45 0x89 0x1 0xd136 0x0 +phy raw c45 0x89 0x1 0xffde 2 +phy raw c45 0x89 0x1 0xd134 0x1e4 +phy raw c45 0x89 0x1 0xd135 0x88 +phy raw c45 0x89 0x1 0xd136 0x0 +phy raw c45 0x89 0x1 0xffde 3 +phy raw c45 0x89 0x1 0xd134 0x1e4 +phy raw c45 0x89 0x1 0xd135 0x88 +phy raw c45 0x89 0x1 0xd136 0x0 +phy raw c45 0x89 0x1 0xffde 4 +phy raw c45 0x89 0x1 0xd134 0x1e4 +phy raw c45 0x89 0x1 0xd135 0x88 +phy raw c45 0x89 0x1 0xd136 0x0 +phy raw c45 0x89 0x1 0xffde 5 +phy raw c45 0x89 0x1 0xd134 0x1e4 +phy raw c45 0x89 0x1 0xd135 0x88 +phy raw c45 0x89 0x1 0xd136 0x0 +phy raw c45 0x89 0x1 0xffde 6 +phy raw c45 0x89 0x1 0xd134 0x1e4 +phy raw c45 0x89 0x1 0xd135 0x88 +phy raw c45 0x89 0x1 0xd136 0x0 +phy raw c45 0x89 0x1 0xffde 7 +phy raw c45 0x89 0x1 0xd134 0x1e4 +phy raw c45 0x89 0x1 0xd135 0x88 +phy raw c45 0x89 0x1 0xd136 0x0 + +# port3 (DAC) +phy raw c45 0x91 0x1 0xffde 0 +phy raw c45 0x91 0x1 0xd134 0x1e1 +phy raw c45 0x91 0x1 0xd135 0x89 +phy raw c45 0x91 0x1 0xd136 0x0 +phy raw c45 0x91 0x1 0xffde 1 +phy raw c45 0x91 0x1 0xd134 0x1e1 +phy raw c45 0x91 0x1 0xd135 0x89 +phy raw c45 0x91 0x1 0xd136 0x0 +phy raw c45 0x91 0x1 0xffde 2 +phy raw c45 0x91 0x1 0xd134 0x1e1 +phy raw c45 0x91 0x1 0xd135 0x89 +phy raw c45 0x91 0x1 0xd136 0x0 +phy raw c45 0x91 0x1 0xffde 3 +phy raw c45 0x91 0x1 0xd134 0x1e1 +phy raw c45 0x91 0x1 0xd135 0x89 +phy raw c45 0x91 0x1 0xd136 0x0 +phy raw c45 0x91 0x1 0xffde 4 +phy raw c45 0x91 0x1 0xd134 0x1e1 +phy raw c45 0x91 0x1 0xd135 0x89 +phy raw c45 0x91 0x1 0xd136 0x0 +phy raw c45 0x91 0x1 0xffde 5 +phy raw c45 0x91 0x1 0xd134 0x1e1 +phy raw c45 0x91 0x1 0xd135 0x89 +phy raw c45 0x91 0x1 0xd136 0x0 +phy raw c45 0x91 0x1 0xffde 6 +phy raw c45 0x91 0x1 0xd134 0x1e1 +phy raw c45 0x91 0x1 0xd135 0x89 +phy raw c45 0x91 0x1 0xd136 0x0 +phy raw c45 0x91 0x1 0xffde 7 +phy raw c45 0x91 0x1 0xd134 0x1e1 +phy raw c45 0x91 0x1 0xd135 0x89 +phy raw c45 0x91 0x1 0xd136 0x0 + +# port4 (DAC) +phy raw c45 0xa1 0x1 0xffde 0 +phy raw c45 0xa1 0x1 0xd134 0x1e0 +phy raw c45 0xa1 0x1 0xd135 0x88 +phy raw c45 0xa1 0x1 0xd136 0x0 +phy raw c45 0xa1 0x1 0xffde 1 +phy raw c45 0xa1 0x1 0xd134 0x1e0 +phy raw c45 0xa1 0x1 0xd135 0x88 +phy raw c45 0xa1 0x1 0xd136 0x0 +phy raw c45 0xa1 0x1 0xffde 2 +phy raw c45 0xa1 0x1 0xd134 0x1e0 +phy raw c45 0xa1 0x1 0xd135 0x88 +phy raw c45 0xa1 0x1 0xd136 0x0 +phy raw c45 0xa1 0x1 0xffde 3 +phy raw c45 0xa1 0x1 0xd134 0x1e0 +phy raw c45 0xa1 0x1 0xd135 0x88 +phy raw c45 0xa1 0x1 0xd136 0x0 +phy raw c45 0xa1 0x1 0xffde 4 +phy raw c45 0xa1 0x1 0xd134 0x1e0 +phy raw c45 0xa1 0x1 0xd135 0x88 +phy raw c45 0xa1 0x1 0xd136 0x0 +phy raw c45 0xa1 0x1 0xffde 5 +phy raw c45 0xa1 0x1 0xd134 0x1e0 +phy raw c45 0xa1 0x1 0xd135 0x88 +phy raw c45 0xa1 0x1 0xd136 0x0 +phy raw c45 0xa1 0x1 0xffde 6 +phy raw c45 0xa1 0x1 0xd134 0x1e0 +phy raw c45 0xa1 0x1 0xd135 0x88 +phy raw c45 0xa1 0x1 0xd136 0x0 +phy raw c45 0xa1 0x1 0xffde 7 +phy raw c45 0xa1 0x1 0xd134 0x1e0 +phy raw c45 0xa1 0x1 0xd135 0x88 +phy raw c45 0xa1 0x1 0xd136 0x0 + +# port5 (DAC) +phy raw c45 0xa9 0x1 0xffde 0 +phy raw c45 0xa9 0x1 0xd134 0x1e8 +phy raw c45 0xa9 0x1 0xd135 0x90 +phy raw c45 0xa9 0x1 0xd136 0x0 +phy raw c45 0xa9 0x1 0xffde 1 +phy raw c45 0xa9 0x1 0xd134 0x1e8 +phy raw c45 0xa9 0x1 0xd135 0x90 +phy raw c45 0xa9 0x1 0xd136 0x0 +phy raw c45 0xa9 0x1 0xffde 2 +phy raw c45 0xa9 0x1 0xd134 0x1e8 +phy raw c45 0xa9 0x1 0xd135 0x90 +phy raw c45 0xa9 0x1 0xd136 0x0 +phy raw c45 0xa9 0x1 0xffde 3 +phy raw c45 0xa9 0x1 0xd134 0x1e8 +phy raw c45 0xa9 0x1 0xd135 0x90 +phy raw c45 0xa9 0x1 0xd136 0x0 +phy raw c45 0xa9 0x1 0xffde 4 +phy raw c45 0xa9 0x1 0xd134 0x1e8 +phy raw c45 0xa9 0x1 0xd135 0x90 +phy raw c45 0xa9 0x1 0xd136 0x0 +phy raw c45 0xa9 0x1 0xffde 5 +phy raw c45 0xa9 0x1 0xd134 0x1e8 +phy raw c45 0xa9 0x1 0xd135 0x90 +phy raw c45 0xa9 0x1 0xd136 0x0 +phy raw c45 0xa9 0x1 0xffde 6 +phy raw c45 0xa9 0x1 0xd134 0x1e8 +phy raw c45 0xa9 0x1 0xd135 0x90 +phy raw c45 0xa9 0x1 0xd136 0x0 +phy raw c45 0xa9 0x1 0xffde 7 +phy raw c45 0xa9 0x1 0xd134 0x1e8 +phy raw c45 0xa9 0x1 0xd135 0x90 +phy raw c45 0xa9 0x1 0xd136 0x0 + +# port6 (DAC) +phy raw c45 0xb1 0x1 0xffde 0 +phy raw c45 0xb1 0x1 0xd134 0x1e4 +phy raw c45 0xb1 0x1 0xd135 0x8c +phy raw c45 0xb1 0x1 0xd136 0x0 +phy raw c45 0xb1 0x1 0xffde 1 +phy raw c45 0xb1 0x1 0xd134 0x1e4 +phy raw c45 0xb1 0x1 0xd135 0x8c +phy raw c45 0xb1 0x1 0xd136 0x0 +phy raw c45 0xb1 0x1 0xffde 2 +phy raw c45 0xb1 0x1 0xd134 0x1e4 +phy raw c45 0xb1 0x1 0xd135 0x8c +phy raw c45 0xb1 0x1 0xd136 0x0 +phy raw c45 0xb1 0x1 0xffde 3 +phy raw c45 0xb1 0x1 0xd134 0x1e4 +phy raw c45 0xb1 0x1 0xd135 0x8c +phy raw c45 0xb1 0x1 0xd136 0x0 +phy raw c45 0xb1 0x1 0xffde 4 +phy raw c45 0xb1 0x1 0xd134 0x1e4 +phy raw c45 0xb1 0x1 0xd135 0x8c +phy raw c45 0xb1 0x1 0xd136 0x0 +phy raw c45 0xb1 0x1 0xffde 5 +phy raw c45 0xb1 0x1 0xd134 0x1e4 +phy raw c45 0xb1 0x1 0xd135 0x8c +phy raw c45 0xb1 0x1 0xd136 0x0 +phy raw c45 0xb1 0x1 0xffde 6 +phy raw c45 0xb1 0x1 0xd134 0x1e4 +phy raw c45 0xb1 0x1 0xd135 0x8c +phy raw c45 0xb1 0x1 0xd136 0x0 +phy raw c45 0xb1 0x1 0xffde 7 +phy raw c45 0xb1 0x1 0xd134 0x1e4 +phy raw c45 0xb1 0x1 0xd135 0x8c +phy raw c45 0xb1 0x1 0xd136 0x0 + +# port7 (DAC) +phy raw c45 0xc1 0x1 0xffde 0 +phy raw c45 0xc1 0x1 0xd134 0x1e5 +phy raw c45 0xc1 0x1 0xd135 0x8d +phy raw c45 0xc1 0x1 0xd136 0x0 +phy raw c45 0xc1 0x1 0xffde 1 +phy raw c45 0xc1 0x1 0xd134 0x1e5 +phy raw c45 0xc1 0x1 0xd135 0x8d +phy raw c45 0xc1 0x1 0xd136 0x0 +phy raw c45 0xc1 0x1 0xffde 2 +phy raw c45 0xc1 0x1 0xd134 0x1e5 +phy raw c45 0xc1 0x1 0xd135 0x8d +phy raw c45 0xc1 0x1 0xd136 0x0 +phy raw c45 0xc1 0x1 0xffde 3 +phy raw c45 0xc1 0x1 0xd134 0x1e5 +phy raw c45 0xc1 0x1 0xd135 0x8d +phy raw c45 0xc1 0x1 0xd136 0x0 +phy raw c45 0xc1 0x1 0xffde 4 +phy raw c45 0xc1 0x1 0xd134 0x1e5 +phy raw c45 0xc1 0x1 0xd135 0x8d +phy raw c45 0xc1 0x1 0xd136 0x0 +phy raw c45 0xc1 0x1 0xffde 5 +phy raw c45 0xc1 0x1 0xd134 0x1e5 +phy raw c45 0xc1 0x1 0xd135 0x8d +phy raw c45 0xc1 0x1 0xd136 0x0 +phy raw c45 0xc1 0x1 0xffde 6 +phy raw c45 0xc1 0x1 0xd134 0x1e5 +phy raw c45 0xc1 0x1 0xd135 0x8d +phy raw c45 0xc1 0x1 0xd136 0x0 +phy raw c45 0xc1 0x1 0xffde 7 +phy raw c45 0xc1 0x1 0xd134 0x1e5 +phy raw c45 0xc1 0x1 0xd135 0x8d +phy raw c45 0xc1 0x1 0xd136 0x0 + +# port8 (DAC) +phy raw c45 0xc9 0x1 0xffde 0 +phy raw c45 0xc9 0x1 0xd134 0x1e8 +phy raw c45 0xc9 0x1 0xd135 0x8c +phy raw c45 0xc9 0x1 0xd136 0x0 +phy raw c45 0xc9 0x1 0xffde 1 +phy raw c45 0xc9 0x1 0xd134 0x1e8 +phy raw c45 0xc9 0x1 0xd135 0x8c +phy raw c45 0xc9 0x1 0xd136 0x0 +phy raw c45 0xc9 0x1 0xffde 2 +phy raw c45 0xc9 0x1 0xd134 0x1e8 +phy raw c45 0xc9 0x1 0xd135 0x8c +phy raw c45 0xc9 0x1 0xd136 0x0 +phy raw c45 0xc9 0x1 0xffde 3 +phy raw c45 0xc9 0x1 0xd134 0x1e8 +phy raw c45 0xc9 0x1 0xd135 0x8c +phy raw c45 0xc9 0x1 0xd136 0x0 +phy raw c45 0xc9 0x1 0xffde 4 +phy raw c45 0xc9 0x1 0xd134 0x1e8 +phy raw c45 0xc9 0x1 0xd135 0x8c +phy raw c45 0xc9 0x1 0xd136 0x0 +phy raw c45 0xc9 0x1 0xffde 5 +phy raw c45 0xc9 0x1 0xd134 0x1e8 +phy raw c45 0xc9 0x1 0xd135 0x8c +phy raw c45 0xc9 0x1 0xd136 0x0 +phy raw c45 0xc9 0x1 0xffde 6 +phy raw c45 0xc9 0x1 0xd134 0x1e8 +phy raw c45 0xc9 0x1 0xd135 0x8c +phy raw c45 0xc9 0x1 0xd136 0x0 +phy raw c45 0xc9 0x1 0xffde 7 +phy raw c45 0xc9 0x1 0xd134 0x1e8 +phy raw c45 0xc9 0x1 0xd135 0x8c +phy raw c45 0xc9 0x1 0xd136 0x0 + +# port9 (Fiber) +phy raw c45 0xd1 0x1 0xffde 0 +phy raw c45 0xd1 0x1 0xd134 0x1f1 +phy raw c45 0xd1 0x1 0xd135 0x8c +phy raw c45 0xd1 0x1 0xd136 0x1f1 +phy raw c45 0xd1 0x1 0xffde 1 +phy raw c45 0xd1 0x1 0xd134 0x1f1 +phy raw c45 0xd1 0x1 0xd135 0x8c +phy raw c45 0xd1 0x1 0xd136 0x1f1 +phy raw c45 0xd1 0x1 0xffde 2 +phy raw c45 0xd1 0x1 0xd134 0x1f1 +phy raw c45 0xd1 0x1 0xd135 0x8c +phy raw c45 0xd1 0x1 0xd136 0x1f1 +phy raw c45 0xd1 0x1 0xffde 3 +phy raw c45 0xd1 0x1 0xd134 0x1f1 +phy raw c45 0xd1 0x1 0xd135 0x8c +phy raw c45 0xd1 0x1 0xd136 0x1f1 +phy raw c45 0xd1 0x1 0xffde 4 +phy raw c45 0xd1 0x1 0xd134 0x1f1 +phy raw c45 0xd1 0x1 0xd135 0x8c +phy raw c45 0xd1 0x1 0xd136 0x1f1 +phy raw c45 0xd1 0x1 0xffde 5 +phy raw c45 0xd1 0x1 0xd134 0x1f1 +phy raw c45 0xd1 0x1 0xd135 0x8c +phy raw c45 0xd1 0x1 0xd136 0x1f1 +phy raw c45 0xd1 0x1 0xffde 6 +phy raw c45 0xd1 0x1 0xd134 0x1f1 +phy raw c45 0xd1 0x1 0xd135 0x8c +phy raw c45 0xd1 0x1 0xd136 0x1f1 +phy raw c45 0xd1 0x1 0xffde 7 +phy raw c45 0xd1 0x1 0xd134 0x1f1 +phy raw c45 0xd1 0x1 0xd135 0x8c +phy raw c45 0xd1 0x1 0xd136 0x1f1 + +# port10 (Fiber) +phy raw c45 0xe1 0x1 0xffde 0 +phy raw c45 0xe1 0x1 0xd134 0x1f1 +phy raw c45 0xe1 0x1 0xd135 0x8c +phy raw c45 0xe1 0x1 0xd136 0x1f1 +phy raw c45 0xe1 0x1 0xffde 1 +phy raw c45 0xe1 0x1 0xd134 0x1f1 +phy raw c45 0xe1 0x1 0xd135 0x8c +phy raw c45 0xe1 0x1 0xd136 0x1f1 +phy raw c45 0xe1 0x1 0xffde 2 +phy raw c45 0xe1 0x1 0xd134 0x1f1 +phy raw c45 0xe1 0x1 0xd135 0x8c +phy raw c45 0xe1 0x1 0xd136 0x1f1 +phy raw c45 0xe1 0x1 0xffde 3 +phy raw c45 0xe1 0x1 0xd134 0x1f1 +phy raw c45 0xe1 0x1 0xd135 0x8c +phy raw c45 0xe1 0x1 0xd136 0x1f1 +phy raw c45 0xe1 0x1 0xffde 4 +phy raw c45 0xe1 0x1 0xd134 0x1f1 +phy raw c45 0xe1 0x1 0xd135 0x8c +phy raw c45 0xe1 0x1 0xd136 0x1f1 +phy raw c45 0xe1 0x1 0xffde 5 +phy raw c45 0xe1 0x1 0xd134 0x1f1 +phy raw c45 0xe1 0x1 0xd135 0x8c +phy raw c45 0xe1 0x1 0xd136 0x1f1 +phy raw c45 0xe1 0x1 0xffde 6 +phy raw c45 0xe1 0x1 0xd134 0x1f1 +phy raw c45 0xe1 0x1 0xd135 0x8c +phy raw c45 0xe1 0x1 0xd136 0x1f1 +phy raw c45 0xe1 0x1 0xffde 7 +phy raw c45 0xe1 0x1 0xd134 0x1f1 +phy raw c45 0xe1 0x1 0xd135 0x8c +phy raw c45 0xe1 0x1 0xd136 0x1f1 + +# port11 (Fiber) +phy raw c45 0xe9 0x1 0xffde 0 +phy raw c45 0xe9 0x1 0xd134 0x1f4 +phy raw c45 0xe9 0x1 0xd135 0x92 +phy raw c45 0xe9 0x1 0xd136 0x1f4 +phy raw c45 0xe9 0x1 0xffde 1 +phy raw c45 0xe9 0x1 0xd134 0x1f4 +phy raw c45 0xe9 0x1 0xd135 0x92 +phy raw c45 0xe9 0x1 0xd136 0x1f4 +phy raw c45 0xe9 0x1 0xffde 2 +phy raw c45 0xe9 0x1 0xd134 0x1f4 +phy raw c45 0xe9 0x1 0xd135 0x92 +phy raw c45 0xe9 0x1 0xd136 0x1f4 +phy raw c45 0xe9 0x1 0xffde 3 +phy raw c45 0xe9 0x1 0xd134 0x1f4 +phy raw c45 0xe9 0x1 0xd135 0x92 +phy raw c45 0xe9 0x1 0xd136 0x1f4 +phy raw c45 0xe9 0x1 0xffde 4 +phy raw c45 0xe9 0x1 0xd134 0x1f4 +phy raw c45 0xe9 0x1 0xd135 0x92 +phy raw c45 0xe9 0x1 0xd136 0x1f4 +phy raw c45 0xe9 0x1 0xffde 5 +phy raw c45 0xe9 0x1 0xd134 0x1f4 +phy raw c45 0xe9 0x1 0xd135 0x92 +phy raw c45 0xe9 0x1 0xd136 0x1f4 +phy raw c45 0xe9 0x1 0xffde 6 +phy raw c45 0xe9 0x1 0xd134 0x1f4 +phy raw c45 0xe9 0x1 0xd135 0x92 +phy raw c45 0xe9 0x1 0xd136 0x1f4 +phy raw c45 0xe9 0x1 0xffde 7 +phy raw c45 0xe9 0x1 0xd134 0x1f4 +phy raw c45 0xe9 0x1 0xd135 0x92 +phy raw c45 0xe9 0x1 0xd136 0x1f4 + +# port12 (Fiber) +phy raw c45 0xf1 0x1 0xffde 0 +phy raw c45 0xf1 0x1 0xd134 0x1f6 +phy raw c45 0xf1 0x1 0xd135 0x96 +phy raw c45 0xf1 0x1 0xd136 0x1f6 +phy raw c45 0xf1 0x1 0xffde 1 +phy raw c45 0xf1 0x1 0xd134 0x1f6 +phy raw c45 0xf1 0x1 0xd135 0x96 +phy raw c45 0xf1 0x1 0xd136 0x1f6 +phy raw c45 0xf1 0x1 0xffde 2 +phy raw c45 0xf1 0x1 0xd134 0x1f6 +phy raw c45 0xf1 0x1 0xd135 0x96 +phy raw c45 0xf1 0x1 0xd136 0x1f6 +phy raw c45 0xf1 0x1 0xffde 3 +phy raw c45 0xf1 0x1 0xd134 0x1f6 +phy raw c45 0xf1 0x1 0xd135 0x96 +phy raw c45 0xf1 0x1 0xd136 0x1f6 +phy raw c45 0xf1 0x1 0xffde 4 +phy raw c45 0xf1 0x1 0xd134 0x1f6 +phy raw c45 0xf1 0x1 0xd135 0x96 +phy raw c45 0xf1 0x1 0xd136 0x1f6 +phy raw c45 0xf1 0x1 0xffde 5 +phy raw c45 0xf1 0x1 0xd134 0x1f6 +phy raw c45 0xf1 0x1 0xd135 0x96 +phy raw c45 0xf1 0x1 0xd136 0x1f6 +phy raw c45 0xf1 0x1 0xffde 6 +phy raw c45 0xf1 0x1 0xd134 0x1f6 +phy raw c45 0xf1 0x1 0xd135 0x96 +phy raw c45 0xf1 0x1 0xd136 0x1f6 +phy raw c45 0xf1 0x1 0xffde 7 +phy raw c45 0xf1 0x1 0xd134 0x1f6 +phy raw c45 0xf1 0x1 0xd135 0x96 +phy raw c45 0xf1 0x1 0xd136 0x1f6 + +# port13 (Fiber) +phy raw c45 0x181 0x1 0xffde 0 +phy raw c45 0x181 0x1 0xd134 0x1f3 +phy raw c45 0x181 0x1 0xd135 0x90 +phy raw c45 0x181 0x1 0xd136 0x1f3 +phy raw c45 0x181 0x1 0xffde 1 +phy raw c45 0x181 0x1 0xd134 0x1f3 +phy raw c45 0x181 0x1 0xd135 0x90 +phy raw c45 0x181 0x1 0xd136 0x1f3 +phy raw c45 0x181 0x1 0xffde 2 +phy raw c45 0x181 0x1 0xd134 0x1f3 +phy raw c45 0x181 0x1 0xd135 0x90 +phy raw c45 0x181 0x1 0xd136 0x1f3 +phy raw c45 0x181 0x1 0xffde 3 +phy raw c45 0x181 0x1 0xd134 0x1f3 +phy raw c45 0x181 0x1 0xd135 0x90 +phy raw c45 0x181 0x1 0xd136 0x1f3 +phy raw c45 0x181 0x1 0xffde 4 +phy raw c45 0x181 0x1 0xd134 0x1f3 +phy raw c45 0x181 0x1 0xd135 0x90 +phy raw c45 0x181 0x1 0xd136 0x1f3 +phy raw c45 0x181 0x1 0xffde 5 +phy raw c45 0x181 0x1 0xd134 0x1f3 +phy raw c45 0x181 0x1 0xd135 0x90 +phy raw c45 0x181 0x1 0xd136 0x1f3 +phy raw c45 0x181 0x1 0xffde 6 +phy raw c45 0x181 0x1 0xd134 0x1f3 +phy raw c45 0x181 0x1 0xd135 0x90 +phy raw c45 0x181 0x1 0xd136 0x1f3 +phy raw c45 0x181 0x1 0xffde 7 +phy raw c45 0x181 0x1 0xd134 0x1f3 +phy raw c45 0x181 0x1 0xd135 0x90 +phy raw c45 0x181 0x1 0xd136 0x1f3 + +# port14 (Fiber) +phy raw c45 0x189 0x1 0xffde 0 +phy raw c45 0x189 0x1 0xd134 0x1f5 +phy raw c45 0x189 0x1 0xd135 0x94 +phy raw c45 0x189 0x1 0xd136 0x1f5 +phy raw c45 0x189 0x1 0xffde 1 +phy raw c45 0x189 0x1 0xd134 0x1f5 +phy raw c45 0x189 0x1 0xd135 0x94 +phy raw c45 0x189 0x1 0xd136 0x1f5 +phy raw c45 0x189 0x1 0xffde 2 +phy raw c45 0x189 0x1 0xd134 0x1f5 +phy raw c45 0x189 0x1 0xd135 0x94 +phy raw c45 0x189 0x1 0xd136 0x1f5 +phy raw c45 0x189 0x1 0xffde 3 +phy raw c45 0x189 0x1 0xd134 0x1f5 +phy raw c45 0x189 0x1 0xd135 0x94 +phy raw c45 0x189 0x1 0xd136 0x1f5 +phy raw c45 0x189 0x1 0xffde 4 +phy raw c45 0x189 0x1 0xd134 0x1f5 +phy raw c45 0x189 0x1 0xd135 0x94 +phy raw c45 0x189 0x1 0xd136 0x1f5 +phy raw c45 0x189 0x1 0xffde 5 +phy raw c45 0x189 0x1 0xd134 0x1f5 +phy raw c45 0x189 0x1 0xd135 0x94 +phy raw c45 0x189 0x1 0xd136 0x1f5 +phy raw c45 0x189 0x1 0xffde 6 +phy raw c45 0x189 0x1 0xd134 0x1f5 +phy raw c45 0x189 0x1 0xd135 0x94 +phy raw c45 0x189 0x1 0xd136 0x1f5 +phy raw c45 0x189 0x1 0xffde 7 +phy raw c45 0x189 0x1 0xd134 0x1f5 +phy raw c45 0x189 0x1 0xd135 0x94 +phy raw c45 0x189 0x1 0xd136 0x1f5 + +# port15 (Fiber) +phy raw c45 0x191 0x1 0xffde 0 +phy raw c45 0x191 0x1 0xd134 0x1f7 +phy raw c45 0x191 0x1 0xd135 0x98 +phy raw c45 0x191 0x1 0xd136 0x1f7 +phy raw c45 0x191 0x1 0xffde 1 +phy raw c45 0x191 0x1 0xd134 0x1f7 +phy raw c45 0x191 0x1 0xd135 0x98 +phy raw c45 0x191 0x1 0xd136 0x1f7 +phy raw c45 0x191 0x1 0xffde 2 +phy raw c45 0x191 0x1 0xd134 0x1f7 +phy raw c45 0x191 0x1 0xd135 0x98 +phy raw c45 0x191 0x1 0xd136 0x1f7 +phy raw c45 0x191 0x1 0xffde 3 +phy raw c45 0x191 0x1 0xd134 0x1f7 +phy raw c45 0x191 0x1 0xd135 0x98 +phy raw c45 0x191 0x1 0xd136 0x1f7 +phy raw c45 0x191 0x1 0xffde 4 +phy raw c45 0x191 0x1 0xd134 0x1f7 +phy raw c45 0x191 0x1 0xd135 0x98 +phy raw c45 0x191 0x1 0xd136 0x1f7 +phy raw c45 0x191 0x1 0xffde 5 +phy raw c45 0x191 0x1 0xd134 0x1f7 +phy raw c45 0x191 0x1 0xd135 0x98 +phy raw c45 0x191 0x1 0xd136 0x1f7 +phy raw c45 0x191 0x1 0xffde 6 +phy raw c45 0x191 0x1 0xd134 0x0 +phy raw c45 0x191 0x1 0xd135 0x96 +phy raw c45 0x191 0x1 0xd136 0x0 +phy raw c45 0x191 0x1 0xffde 7 +phy raw c45 0x191 0x1 0xd134 0x1f7 +phy raw c45 0x191 0x1 0xd135 0x98 +phy raw c45 0x191 0x1 0xd136 0x1f7 + +# port16 (Fiber) +phy raw c45 0x1a1 0x1 0xffde 0 +phy raw c45 0x1a1 0x1 0xd134 0x1f6 +phy raw c45 0x1a1 0x1 0xd135 0x96 +phy raw c45 0x1a1 0x1 0xd136 0x1f6 +phy raw c45 0x1a1 0x1 0xffde 1 +phy raw c45 0x1a1 0x1 0xd134 0x1f6 +phy raw c45 0x1a1 0x1 0xd135 0x96 +phy raw c45 0x1a1 0x1 0xd136 0x1f6 +phy raw c45 0x1a1 0x1 0xffde 2 +phy raw c45 0x1a1 0x1 0xd134 0x1f6 +phy raw c45 0x1a1 0x1 0xd135 0x96 +phy raw c45 0x1a1 0x1 0xd136 0x1f6 +phy raw c45 0x1a1 0x1 0xffde 3 +phy raw c45 0x1a1 0x1 0xd134 0x1f6 +phy raw c45 0x1a1 0x1 0xd135 0x96 +phy raw c45 0x1a1 0x1 0xd136 0x1f6 +phy raw c45 0x1a1 0x1 0xffde 4 +phy raw c45 0x1a1 0x1 0xd134 0x1f6 +phy raw c45 0x1a1 0x1 0xd135 0x96 +phy raw c45 0x1a1 0x1 0xd136 0x1f6 +phy raw c45 0x1a1 0x1 0xffde 5 +phy raw c45 0x1a1 0x1 0xd134 0x1f6 +phy raw c45 0x1a1 0x1 0xd135 0x96 +phy raw c45 0x1a1 0x1 0xd136 0x1f6 +phy raw c45 0x1a1 0x1 0xffde 6 +phy raw c45 0x1a1 0x1 0xd134 0x1f6 +phy raw c45 0x1a1 0x1 0xd135 0x96 +phy raw c45 0x1a1 0x1 0xd136 0x1f6 +phy raw c45 0x1a1 0x1 0xffde 7 +phy raw c45 0x1a1 0x1 0xd134 0x1f6 +phy raw c45 0x1a1 0x1 0xd135 0x96 +phy raw c45 0x1a1 0x1 0xd136 0x1f6 + +# port17 (Fiber) +phy raw c45 0x1a9 0x1 0xffde 0 +phy raw c45 0x1a9 0x1 0xd134 0x1f9 +phy raw c45 0x1a9 0x1 0xd135 0x9c +phy raw c45 0x1a9 0x1 0xd136 0x1f9 +phy raw c45 0x1a9 0x1 0xffde 1 +phy raw c45 0x1a9 0x1 0xd134 0x1f9 +phy raw c45 0x1a9 0x1 0xd135 0x9c +phy raw c45 0x1a9 0x1 0xd136 0x1f9 +phy raw c45 0x1a9 0x1 0xffde 2 +phy raw c45 0x1a9 0x1 0xd134 0x1f9 +phy raw c45 0x1a9 0x1 0xd135 0x9c +phy raw c45 0x1a9 0x1 0xd136 0x1f9 +phy raw c45 0x1a9 0x1 0xffde 3 +phy raw c45 0x1a9 0x1 0xd134 0x1f9 +phy raw c45 0x1a9 0x1 0xd135 0x9c +phy raw c45 0x1a9 0x1 0xd136 0x1f9 +phy raw c45 0x1a9 0x1 0xffde 4 +phy raw c45 0x1a9 0x1 0xd134 0x1f9 +phy raw c45 0x1a9 0x1 0xd135 0x9c +phy raw c45 0x1a9 0x1 0xd136 0x1f9 +phy raw c45 0x1a9 0x1 0xffde 5 +phy raw c45 0x1a9 0x1 0xd134 0x1f9 +phy raw c45 0x1a9 0x1 0xd135 0x9c +phy raw c45 0x1a9 0x1 0xd136 0x1f9 +phy raw c45 0x1a9 0x1 0xffde 6 +phy raw c45 0x1a9 0x1 0xd134 0x1f9 +phy raw c45 0x1a9 0x1 0xd135 0x9c +phy raw c45 0x1a9 0x1 0xd136 0x1f9 +phy raw c45 0x1a9 0x1 0xffde 7 +phy raw c45 0x1a9 0x1 0xd134 0x1f9 +phy raw c45 0x1a9 0x1 0xd135 0x9c +phy raw c45 0x1a9 0x1 0xd136 0x1f9 + +# port18 (Fiber) +phy raw c45 0x1b1 0x1 0xffde 0 +phy raw c45 0x1b1 0x1 0xd134 0x1fa +phy raw c45 0x1b1 0x1 0xd135 0x9e +phy raw c45 0x1b1 0x1 0xd136 0x1fa +phy raw c45 0x1b1 0x1 0xffde 1 +phy raw c45 0x1b1 0x1 0xd134 0x1fa +phy raw c45 0x1b1 0x1 0xd135 0x9e +phy raw c45 0x1b1 0x1 0xd136 0x1fa +phy raw c45 0x1b1 0x1 0xffde 2 +phy raw c45 0x1b1 0x1 0xd134 0x1fa +phy raw c45 0x1b1 0x1 0xd135 0x9e +phy raw c45 0x1b1 0x1 0xd136 0x1fa +phy raw c45 0x1b1 0x1 0xffde 3 +phy raw c45 0x1b1 0x1 0xd134 0x1fa +phy raw c45 0x1b1 0x1 0xd135 0x9e +phy raw c45 0x1b1 0x1 0xd136 0x1fa +phy raw c45 0x1b1 0x1 0xffde 4 +phy raw c45 0x1b1 0x1 0xd134 0x1fa +phy raw c45 0x1b1 0x1 0xd135 0x9e +phy raw c45 0x1b1 0x1 0xd136 0x1fa +phy raw c45 0x1b1 0x1 0xffde 5 +phy raw c45 0x1b1 0x1 0xd134 0x1fa +phy raw c45 0x1b1 0x1 0xd135 0x9e +phy raw c45 0x1b1 0x1 0xd136 0x1fa +phy raw c45 0x1b1 0x1 0xffde 6 +phy raw c45 0x1b1 0x1 0xd134 0x1fa +phy raw c45 0x1b1 0x1 0xd135 0x9e +phy raw c45 0x1b1 0x1 0xd136 0x1fa +phy raw c45 0x1b1 0x1 0xffde 7 +phy raw c45 0x1b1 0x1 0xd134 0x1fa +phy raw c45 0x1b1 0x1 0xd135 0x9e +phy raw c45 0x1b1 0x1 0xd136 0x1fa + +# port19 (Fiber) +phy raw c45 0x1c1 0x1 0xffde 0 +phy raw c45 0x1c1 0x1 0xd134 0x1f5 +phy raw c45 0x1c1 0x1 0xd135 0x94 +phy raw c45 0x1c1 0x1 0xd136 0x1f5 +phy raw c45 0x1c1 0x1 0xffde 1 +phy raw c45 0x1c1 0x1 0xd134 0x1f5 +phy raw c45 0x1c1 0x1 0xd135 0x94 +phy raw c45 0x1c1 0x1 0xd136 0x1f5 +phy raw c45 0x1c1 0x1 0xffde 2 +phy raw c45 0x1c1 0x1 0xd134 0x1f5 +phy raw c45 0x1c1 0x1 0xd135 0x94 +phy raw c45 0x1c1 0x1 0xd136 0x1f5 +phy raw c45 0x1c1 0x1 0xffde 3 +phy raw c45 0x1c1 0x1 0xd134 0x1f5 +phy raw c45 0x1c1 0x1 0xd135 0x94 +phy raw c45 0x1c1 0x1 0xd136 0x1f5 +phy raw c45 0x1c1 0x1 0xffde 4 +phy raw c45 0x1c1 0x1 0xd134 0x1f5 +phy raw c45 0x1c1 0x1 0xd135 0x94 +phy raw c45 0x1c1 0x1 0xd136 0x1f5 +phy raw c45 0x1c1 0x1 0xffde 5 +phy raw c45 0x1c1 0x1 0xd134 0x1f5 +phy raw c45 0x1c1 0x1 0xd135 0x94 +phy raw c45 0x1c1 0x1 0xd136 0x1f5 +phy raw c45 0x1c1 0x1 0xffde 6 +phy raw c45 0x1c1 0x1 0xd134 0x1f5 +phy raw c45 0x1c1 0x1 0xd135 0x94 +phy raw c45 0x1c1 0x1 0xd136 0x1f5 +phy raw c45 0x1c1 0x1 0xffde 7 +phy raw c45 0x1c1 0x1 0xd134 0x1f5 +phy raw c45 0x1c1 0x1 0xd135 0x94 +phy raw c45 0x1c1 0x1 0xd136 0x1f5 + +# port20 (Fiber) +phy raw c45 0x1c9 0x1 0xffde 0 +phy raw c45 0x1c9 0x1 0xd134 0x1f9 +phy raw c45 0x1c9 0x1 0xd135 0x9c +phy raw c45 0x1c9 0x1 0xd136 0x1f9 +phy raw c45 0x1c9 0x1 0xffde 1 +phy raw c45 0x1c9 0x1 0xd134 0x1f9 +phy raw c45 0x1c9 0x1 0xd135 0x9c +phy raw c45 0x1c9 0x1 0xd136 0x1f9 +phy raw c45 0x1c9 0x1 0xffde 2 +phy raw c45 0x1c9 0x1 0xd134 0x1f9 +phy raw c45 0x1c9 0x1 0xd135 0x9c +phy raw c45 0x1c9 0x1 0xd136 0x1f9 +phy raw c45 0x1c9 0x1 0xffde 3 +phy raw c45 0x1c9 0x1 0xd134 0x1f9 +phy raw c45 0x1c9 0x1 0xd135 0x9c +phy raw c45 0x1c9 0x1 0xd136 0x1f9 +phy raw c45 0x1c9 0x1 0xffde 4 +phy raw c45 0x1c9 0x1 0xd134 0x1f9 +phy raw c45 0x1c9 0x1 0xd135 0x9c +phy raw c45 0x1c9 0x1 0xd136 0x1f9 +phy raw c45 0x1c9 0x1 0xffde 5 +phy raw c45 0x1c9 0x1 0xd134 0x1f9 +phy raw c45 0x1c9 0x1 0xd135 0x9c +phy raw c45 0x1c9 0x1 0xd136 0x1f9 +phy raw c45 0x1c9 0x1 0xffde 6 +phy raw c45 0x1c9 0x1 0xd134 0x1f9 +phy raw c45 0x1c9 0x1 0xd135 0x9c +phy raw c45 0x1c9 0x1 0xd136 0x1f9 +phy raw c45 0x1c9 0x1 0xffde 7 +phy raw c45 0x1c9 0x1 0xd134 0x1f9 +phy raw c45 0x1c9 0x1 0xd135 0x9c +phy raw c45 0x1c9 0x1 0xd136 0x1f9 + +# port21-24 (default) + +# port25 (DAC) +phy raw c45 0x281 0x1 0xffde 0 +phy raw c45 0x281 0x1 0xd134 0x1e6 +phy raw c45 0x281 0x1 0xd135 0x8e +phy raw c45 0x281 0x1 0xd136 0x0 +phy raw c45 0x281 0x1 0xffde 1 +phy raw c45 0x281 0x1 0xd134 0x1e6 +phy raw c45 0x281 0x1 0xd135 0x8e +phy raw c45 0x281 0x1 0xd136 0x0 +phy raw c45 0x281 0x1 0xffde 2 +phy raw c45 0x281 0x1 0xd134 0x1e6 +phy raw c45 0x281 0x1 0xd135 0x8e +phy raw c45 0x281 0x1 0xd136 0x0 +phy raw c45 0x281 0x1 0xffde 3 +phy raw c45 0x281 0x1 0xd134 0x1e6 +phy raw c45 0x281 0x1 0xd135 0x8e +phy raw c45 0x281 0x1 0xd136 0x0 +phy raw c45 0x281 0x1 0xffde 4 +phy raw c45 0x281 0x1 0xd134 0x1e6 +phy raw c45 0x281 0x1 0xd135 0x8e +phy raw c45 0x281 0x1 0xd136 0x0 +phy raw c45 0x281 0x1 0xffde 5 +phy raw c45 0x281 0x1 0xd134 0x1e6 +phy raw c45 0x281 0x1 0xd135 0x8e +phy raw c45 0x281 0x1 0xd136 0x0 +phy raw c45 0x281 0x1 0xffde 6 +phy raw c45 0x281 0x1 0xd134 0x1e6 +phy raw c45 0x281 0x1 0xd135 0x8e +phy raw c45 0x281 0x1 0xd136 0x0 +phy raw c45 0x281 0x1 0xffde 7 +phy raw c45 0x281 0x1 0xd134 0x1e6 +phy raw c45 0x281 0x1 0xd135 0x8e +phy raw c45 0x281 0x1 0xd136 0x0 + +# port26 (DAC) +phy raw c45 0x289 0x1 0xffde 0 +phy raw c45 0x289 0x1 0xd134 0x1e8 +phy raw c45 0x289 0x1 0xd135 0x90 +phy raw c45 0x289 0x1 0xd136 0x0 +phy raw c45 0x289 0x1 0xffde 1 +phy raw c45 0x289 0x1 0xd134 0x1e8 +phy raw c45 0x289 0x1 0xd135 0x90 +phy raw c45 0x289 0x1 0xd136 0x0 +phy raw c45 0x289 0x1 0xffde 2 +phy raw c45 0x289 0x1 0xd134 0x1e8 +phy raw c45 0x289 0x1 0xd135 0x90 +phy raw c45 0x289 0x1 0xd136 0x0 +phy raw c45 0x289 0x1 0xffde 3 +phy raw c45 0x289 0x1 0xd134 0x1e8 +phy raw c45 0x289 0x1 0xd135 0x90 +phy raw c45 0x289 0x1 0xd136 0x0 +phy raw c45 0x289 0x1 0xffde 4 +phy raw c45 0x289 0x1 0xd134 0x1e8 +phy raw c45 0x289 0x1 0xd135 0x90 +phy raw c45 0x289 0x1 0xd136 0x0 +phy raw c45 0x289 0x1 0xffde 5 +phy raw c45 0x289 0x1 0xd134 0x1e8 +phy raw c45 0x289 0x1 0xd135 0x90 +phy raw c45 0x289 0x1 0xd136 0x0 +phy raw c45 0x289 0x1 0xffde 6 +phy raw c45 0x289 0x1 0xd134 0x1e8 +phy raw c45 0x289 0x1 0xd135 0x90 +phy raw c45 0x289 0x1 0xd136 0x0 +phy raw c45 0x289 0x1 0xffde 7 +phy raw c45 0x289 0x1 0xd134 0x1e8 +phy raw c45 0x289 0x1 0xd135 0x90 +phy raw c45 0x289 0x1 0xd136 0x0 + +# port27 (DAC) +phy raw c45 0x291 0x1 0xffde 0 +phy raw c45 0x291 0x1 0xd134 0x1e5 +phy raw c45 0x291 0x1 0xd135 0x8d +phy raw c45 0x291 0x1 0xd136 0x0 +phy raw c45 0x291 0x1 0xffde 1 +phy raw c45 0x291 0x1 0xd134 0x1e5 +phy raw c45 0x291 0x1 0xd135 0x8d +phy raw c45 0x291 0x1 0xd136 0x0 +phy raw c45 0x291 0x1 0xffde 2 +phy raw c45 0x291 0x1 0xd134 0x1e5 +phy raw c45 0x291 0x1 0xd135 0x8d +phy raw c45 0x291 0x1 0xd136 0x0 +phy raw c45 0x291 0x1 0xffde 3 +phy raw c45 0x291 0x1 0xd134 0x1e5 +phy raw c45 0x291 0x1 0xd135 0x8d +phy raw c45 0x291 0x1 0xd136 0x0 +phy raw c45 0x291 0x1 0xffde 4 +phy raw c45 0x291 0x1 0xd134 0x1e5 +phy raw c45 0x291 0x1 0xd135 0x8d +phy raw c45 0x291 0x1 0xd136 0x0 +phy raw c45 0x291 0x1 0xffde 5 +phy raw c45 0x291 0x1 0xd134 0x1e5 +phy raw c45 0x291 0x1 0xd135 0x8d +phy raw c45 0x291 0x1 0xd136 0x0 +phy raw c45 0x291 0x1 0xffde 6 +phy raw c45 0x291 0x1 0xd134 0x1e5 +phy raw c45 0x291 0x1 0xd135 0x8d +phy raw c45 0x291 0x1 0xd136 0x0 +phy raw c45 0x291 0x1 0xffde 7 +phy raw c45 0x291 0x1 0xd134 0x1e5 +phy raw c45 0x291 0x1 0xd135 0x8d +phy raw c45 0x291 0x1 0xd136 0x0 + +# port28 (DAC) +phy raw c45 0x2a1 0x1 0xffde 0 +phy raw c45 0x2a1 0x1 0xd134 0x1e2 +phy raw c45 0x2a1 0x1 0xd135 0x8a +phy raw c45 0x2a1 0x1 0xd136 0x0 +phy raw c45 0x2a1 0x1 0xffde 1 +phy raw c45 0x2a1 0x1 0xd134 0x1e2 +phy raw c45 0x2a1 0x1 0xd135 0x8a +phy raw c45 0x2a1 0x1 0xd136 0x0 +phy raw c45 0x2a1 0x1 0xffde 2 +phy raw c45 0x2a1 0x1 0xd134 0x1e2 +phy raw c45 0x2a1 0x1 0xd135 0x8a +phy raw c45 0x2a1 0x1 0xd136 0x0 +phy raw c45 0x2a1 0x1 0xffde 3 +phy raw c45 0x2a1 0x1 0xd134 0x1e2 +phy raw c45 0x2a1 0x1 0xd135 0x8a +phy raw c45 0x2a1 0x1 0xd136 0x0 +phy raw c45 0x2a1 0x1 0xffde 4 +phy raw c45 0x2a1 0x1 0xd134 0x1e2 +phy raw c45 0x2a1 0x1 0xd135 0x8a +phy raw c45 0x2a1 0x1 0xd136 0x0 +phy raw c45 0x2a1 0x1 0xffde 5 +phy raw c45 0x2a1 0x1 0xd134 0x1e2 +phy raw c45 0x2a1 0x1 0xd135 0x8a +phy raw c45 0x2a1 0x1 0xd136 0x0 +phy raw c45 0x2a1 0x1 0xffde 6 +phy raw c45 0x2a1 0x1 0xd134 0x1e2 +phy raw c45 0x2a1 0x1 0xd135 0x8a +phy raw c45 0x2a1 0x1 0xd136 0x0 +phy raw c45 0x2a1 0x1 0xffde 7 +phy raw c45 0x2a1 0x1 0xd134 0x1e2 +phy raw c45 0x2a1 0x1 0xd135 0x8a +phy raw c45 0x2a1 0x1 0xd136 0x0 + +# port29 (DAC) +phy raw c45 0x2a9 0x1 0xffde 0 +phy raw c45 0x2a9 0x1 0xd134 0x1e4 +phy raw c45 0x2a9 0x1 0xd135 0x8c +phy raw c45 0x2a9 0x1 0xd136 0x0 +phy raw c45 0x2a9 0x1 0xffde 1 +phy raw c45 0x2a9 0x1 0xd134 0x1e4 +phy raw c45 0x2a9 0x1 0xd135 0x8c +phy raw c45 0x2a9 0x1 0xd136 0x0 +phy raw c45 0x2a9 0x1 0xffde 2 +phy raw c45 0x2a9 0x1 0xd134 0x1e4 +phy raw c45 0x2a9 0x1 0xd135 0x8c +phy raw c45 0x2a9 0x1 0xd136 0x0 +phy raw c45 0x2a9 0x1 0xffde 3 +phy raw c45 0x2a9 0x1 0xd134 0x1e4 +phy raw c45 0x2a9 0x1 0xd135 0x8c +phy raw c45 0x2a9 0x1 0xd136 0x0 +phy raw c45 0x2a9 0x1 0xffde 4 +phy raw c45 0x2a9 0x1 0xd134 0x1e4 +phy raw c45 0x2a9 0x1 0xd135 0x8c +phy raw c45 0x2a9 0x1 0xd136 0x0 +phy raw c45 0x2a9 0x1 0xffde 5 +phy raw c45 0x2a9 0x1 0xd134 0x1e4 +phy raw c45 0x2a9 0x1 0xd135 0x8c +phy raw c45 0x2a9 0x1 0xd136 0x0 +phy raw c45 0x2a9 0x1 0xffde 6 +phy raw c45 0x2a9 0x1 0xd134 0x1e4 +phy raw c45 0x2a9 0x1 0xd135 0x8c +phy raw c45 0x2a9 0x1 0xd136 0x0 +phy raw c45 0x2a9 0x1 0xffde 7 +phy raw c45 0x2a9 0x1 0xd134 0x1e4 +phy raw c45 0x2a9 0x1 0xd135 0x8c +phy raw c45 0x2a9 0x1 0xd136 0x0 + +# port30 (DAC) +phy raw c45 0x2b1 0x1 0xffde 0 +phy raw c45 0x2b1 0x1 0xd134 0x1e4 +phy raw c45 0x2b1 0x1 0xd135 0x8c +phy raw c45 0x2b1 0x1 0xd136 0x0 +phy raw c45 0x2b1 0x1 0xffde 1 +phy raw c45 0x2b1 0x1 0xd134 0x1e4 +phy raw c45 0x2b1 0x1 0xd135 0x8c +phy raw c45 0x2b1 0x1 0xd136 0x0 +phy raw c45 0x2b1 0x1 0xffde 2 +phy raw c45 0x2b1 0x1 0xd134 0x1e4 +phy raw c45 0x2b1 0x1 0xd135 0x8c +phy raw c45 0x2b1 0x1 0xd136 0x0 +phy raw c45 0x2b1 0x1 0xffde 3 +phy raw c45 0x2b1 0x1 0xd134 0x1e4 +phy raw c45 0x2b1 0x1 0xd135 0x8c +phy raw c45 0x2b1 0x1 0xd136 0x0 +phy raw c45 0x2b1 0x1 0xffde 4 +phy raw c45 0x2b1 0x1 0xd134 0x1e4 +phy raw c45 0x2b1 0x1 0xd135 0x8c +phy raw c45 0x2b1 0x1 0xd136 0x0 +phy raw c45 0x2b1 0x1 0xffde 5 +phy raw c45 0x2b1 0x1 0xd134 0x1e4 +phy raw c45 0x2b1 0x1 0xd135 0x8c +phy raw c45 0x2b1 0x1 0xd136 0x0 +phy raw c45 0x2b1 0x1 0xffde 6 +phy raw c45 0x2b1 0x1 0xd134 0x1e4 +phy raw c45 0x2b1 0x1 0xd135 0x8c +phy raw c45 0x2b1 0x1 0xd136 0x0 +phy raw c45 0x2b1 0x1 0xffde 7 +phy raw c45 0x2b1 0x1 0xd134 0x1e4 +phy raw c45 0x2b1 0x1 0xd135 0x8c +phy raw c45 0x2b1 0x1 0xd136 0x0 + +# port31 (DAC) +phy raw c45 0x2c1 0x1 0xffde 0 +phy raw c45 0x2c1 0x1 0xd134 0x1e2 +phy raw c45 0x2c1 0x1 0xd135 0x8a +phy raw c45 0x2c1 0x1 0xd136 0x0 +phy raw c45 0x2c1 0x1 0xffde 1 +phy raw c45 0x2c1 0x1 0xd134 0x1e2 +phy raw c45 0x2c1 0x1 0xd135 0x8a +phy raw c45 0x2c1 0x1 0xd136 0x0 +phy raw c45 0x2c1 0x1 0xffde 2 +phy raw c45 0x2c1 0x1 0xd134 0x1e2 +phy raw c45 0x2c1 0x1 0xd135 0x8a +phy raw c45 0x2c1 0x1 0xd136 0x0 +phy raw c45 0x2c1 0x1 0xffde 3 +phy raw c45 0x2c1 0x1 0xd134 0x1e2 +phy raw c45 0x2c1 0x1 0xd135 0x8a +phy raw c45 0x2c1 0x1 0xd136 0x0 +phy raw c45 0x2c1 0x1 0xffde 4 +phy raw c45 0x2c1 0x1 0xd134 0x1e2 +phy raw c45 0x2c1 0x1 0xd135 0x8a +phy raw c45 0x2c1 0x1 0xd136 0x0 +phy raw c45 0x2c1 0x1 0xffde 5 +phy raw c45 0x2c1 0x1 0xd134 0x1e2 +phy raw c45 0x2c1 0x1 0xd135 0x8a +phy raw c45 0x2c1 0x1 0xd136 0x0 +phy raw c45 0x2c1 0x1 0xffde 6 +phy raw c45 0x2c1 0x1 0xd134 0x1e2 +phy raw c45 0x2c1 0x1 0xd135 0x8a +phy raw c45 0x2c1 0x1 0xd136 0x0 +phy raw c45 0x2c1 0x1 0xffde 7 +phy raw c45 0x2c1 0x1 0xd134 0x1e2 +phy raw c45 0x2c1 0x1 0xd135 0x8a +phy raw c45 0x2c1 0x1 0xd136 0x0 + +# port32 (DAC) +phy raw c45 0x2c9 0x1 0xffde 0 +phy raw c45 0x2c9 0x1 0xd134 0x1e4 +phy raw c45 0x2c9 0x1 0xd135 0x8c +phy raw c45 0x2c9 0x1 0xd136 0x0 +phy raw c45 0x2c9 0x1 0xffde 1 +phy raw c45 0x2c9 0x1 0xd134 0x1e4 +phy raw c45 0x2c9 0x1 0xd135 0x8c +phy raw c45 0x2c9 0x1 0xd136 0x0 +phy raw c45 0x2c9 0x1 0xffde 2 +phy raw c45 0x2c9 0x1 0xd134 0x1e4 +phy raw c45 0x2c9 0x1 0xd135 0x8c +phy raw c45 0x2c9 0x1 0xd136 0x0 +phy raw c45 0x2c9 0x1 0xffde 3 +phy raw c45 0x2c9 0x1 0xd134 0x1e4 +phy raw c45 0x2c9 0x1 0xd135 0x8c +phy raw c45 0x2c9 0x1 0xd136 0x0 +phy raw c45 0x2c9 0x1 0xffde 4 +phy raw c45 0x2c9 0x1 0xd134 0x1e4 +phy raw c45 0x2c9 0x1 0xd135 0x8c +phy raw c45 0x2c9 0x1 0xd136 0x0 +phy raw c45 0x2c9 0x1 0xffde 5 +phy raw c45 0x2c9 0x1 0xd134 0x1e4 +phy raw c45 0x2c9 0x1 0xd135 0x8c +phy raw c45 0x2c9 0x1 0xd136 0x0 +phy raw c45 0x2c9 0x1 0xffde 6 +phy raw c45 0x2c9 0x1 0xd134 0x1e4 +phy raw c45 0x2c9 0x1 0xd135 0x8c +phy raw c45 0x2c9 0x1 0xd136 0x0 +phy raw c45 0x2c9 0x1 0xffde 7 +phy raw c45 0x2c9 0x1 0xd134 0x1e4 +phy raw c45 0x2c9 0x1 0xd135 0x8c +phy raw c45 0x2c9 0x1 0xd136 0x0 diff --git a/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/sensors.conf b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/sensors.conf new file mode 100644 index 000000000000..a7c3b81e9a49 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/sensors.conf @@ -0,0 +1,13 @@ +# libsensors configuration file for snj60d0_320f +# ------------------------------------------------ + +#bus "i2c-1" "SMBus I801 adapter at f000" +#chip "goreme_power_cpld-*" +# label fan1 "Fan tray 1 front" +# label fan2 "Fan tray 2 front" +# label fan3 "Fan tray 3 front" +# label fan4 "Fan tray 4 front" +# label fan11 "Fan tray 1 rear" +# label fan12 "Fan tray 2 rear" +# label fan13 "Fan tray 3 rear" +# label fan14 "Fan tray 4 rear" diff --git a/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/system_health_monitoring_config.json b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/system_health_monitoring_config.json new file mode 100644 index 000000000000..4cc8dfbf0d35 --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/system_health_monitoring_config.json @@ -0,0 +1,18 @@ +{ + "services_to_ignore": [], + "devices_to_ignore": [ + "asic", + "psu.temperature", + "psu.voltage", + "PSU1-FAN1", + "PSU2-FAN1" + ], + "user_defined_checkers": [], + "polling_interval": 60, + "led_color": { + "fault": "amber_blink", + "normal": "green", + "booting": "amber_blink" + } +} + diff --git a/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/thermal_policy.json b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/thermal_policy.json new file mode 100644 index 000000000000..6e028272886e --- /dev/null +++ b/device/alphanetworks/x86_64-alphanetworks_snj60d0_320f-r0/thermal_policy.json @@ -0,0 +1,74 @@ +{ + "thermal_control_algorithm": { + "run_at_boot_up": "True", + "fan_speed_when_suspend": "50" + }, + "info_types": [ + { + "type": "fan_info" + }, + { + "type": "thermal_info" + }, + { + "type": "chassis_info" + } + ], + "policies": [ + { + "name": "temp over high critical threshold", + "conditions": [ + { + "type": "thermal.over.high_critical_threshold" + } + ], + "actions": [ + { + "type": "switch.shutdown" + } + ] + }, + { + "name": "any fan absence", + "conditions": [ + { + "type": "fan.any.absence" + } + ], + "actions": [ + { + "type": "fan.all.set_speed_max" + } + ] + }, + { + "name": "any fan broken", + "conditions": [ + { + "type": "fan.any.fault" + } + ], + "actions": [ + { + "type": "fan.all.set_speed_max" + } + ] + }, + { + "name": "thermal recover", + "conditions": [ + { + "type": "fan.all.presence" + }, + { + "type": "fan.all.good" + } + ], + "actions": [ + { + "type": "thermal.temp_check_and_set_all_fan_speed" + } + ] + } + ] +} diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/td2-a7050-qx32-16x40G+32x10G+8x40G.config.bcm b/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/td2-a7050-qx32-16x40G+32x10G+8x40G.config.bcm index 00714fbd400e..1686cb0bcaea 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/td2-a7050-qx32-16x40G+32x10G+8x40G.config.bcm +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-Q16S64/td2-a7050-qx32-16x40G+32x10G+8x40G.config.bcm @@ -24,6 +24,9 @@ ipv6_lpm_128b_enable=1 l2_mem_entries=32768 l3_mem_entries=16384 +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 diff --git a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/td2-a7050-qx32-32x40G.config.bcm b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/td2-a7050-qx32-32x40G.config.bcm index 074cd523c072..dc959c02878c 100644 --- a/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/td2-a7050-qx32-32x40G.config.bcm +++ b/device/arista/x86_64-arista_7050_qx32/Arista-7050-QX32/td2-a7050-qx32-32x40G.config.bcm @@ -24,6 +24,9 @@ ipv6_lpm_128b_enable=1 l2_mem_entries=32768 l3_mem_entries=16384 +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 diff --git a/device/arista/x86_64-arista_7050_qx32/platform_asic b/device/arista/x86_64-arista_7050_qx32/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/td2-a7050-q31s4-31x40G-4x10G.config.bcm b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/td2-a7050-q31s4-31x40G-4x10G.config.bcm index 1fa9817ff522..ffb3e66e7b0b 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/td2-a7050-q31s4-31x40G-4x10G.config.bcm +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX-32S-S4Q31/td2-a7050-q31s4-31x40G-4x10G.config.bcm @@ -4,6 +4,9 @@ ipv6_lpm_128b_enable=1 l2_mem_entries=32768 l3_mem_entries=16384 +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 @@ -20,7 +23,7 @@ stat_if_parity_enable=0 l2xmsg_hostbuf_size=8192 l2xmsg_mode=1 -bcm_num_cos=8 +bcm_num_cos=10 bcm_stat_interval=2000000 lls_num_l2uc=12 max_vp_lags=0 diff --git a/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX32S-Q32/td2-a7050-qx32s-32x40G.config.bcm b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX32S-Q32/td2-a7050-qx32s-32x40G.config.bcm index 5ffd9530a7c9..720b03e0fa11 100644 --- a/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX32S-Q32/td2-a7050-qx32s-32x40G.config.bcm +++ b/device/arista/x86_64-arista_7050_qx32s/Arista-7050QX32S-Q32/td2-a7050-qx32s-32x40G.config.bcm @@ -18,6 +18,9 @@ ipv6_lpm_128b_enable=1 l2_mem_entries=32768 l3_mem_entries=16384 +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 diff --git a/device/arista/x86_64-arista_7050_qx32s/default_sku b/device/arista/x86_64-arista_7050_qx32s/default_sku index 657093e0b603..3d463dfd4580 100644 --- a/device/arista/x86_64-arista_7050_qx32s/default_sku +++ b/device/arista/x86_64-arista_7050_qx32s/default_sku @@ -1 +1 @@ -Arista-7050-QX-32S t1 +Arista-7050QX-32S t1 diff --git a/device/arista/x86_64-arista_7050_qx32s/platform_asic b/device/arista/x86_64-arista_7050_qx32s/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/arista/x86_64-arista_7050_qx32s/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/qos.json.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/qos.json.j2 deleted file mode 100644 index 3e548325ea30..000000000000 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/qos.json.j2 +++ /dev/null @@ -1 +0,0 @@ -{%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/qos.json.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/qos.json.j2 new file mode 120000 index 000000000000..5ea713ce7f4c --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/qos.json.j2 @@ -0,0 +1 @@ +../Arista-7050CX3-32S-D48C8/qos.json.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/td3-a7050cx3-32s-32x100G.config.bcm b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/td3-a7050cx3-32s-32x100G.config.bcm index d07f97662d82..a575049dc06b 100644 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/td3-a7050cx3-32s-32x100G.config.bcm +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-C32/td3-a7050cx3-32s-32x100G.config.bcm @@ -1,4 +1,5 @@ -sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_issu/b870.6.4.1/ +sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ +l3_alpm_hit_skip=1 sai_adjust_acl_drop_in_rx_drop=1 host_as_route_disable=1 use_all_splithorizon_groups=1 diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/qos.json.j2 b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/qos.json.j2 index 3e548325ea30..04fddf486ace 100644 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/qos.json.j2 +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/qos.json.j2 @@ -1 +1,102 @@ +{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %} +{%- macro generate_dscp_to_tc_map() %} + "DSCP_TO_TC_MAP": { + "AZURE": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "2", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + } + }, +{%- endmacro %} +{%- macro generate_tc_to_pg_map() %} + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "7" + } + }, +{%- endmacro %} +{%- macro generate_tc_to_queue_map() %} + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "1", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, +{%- endmacro %} +{% endif %} + {%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/td3-a7050cx3-32s-48x50G+8x100G.config.bcm b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/td3-a7050cx3-32s-48x50G+8x100G.config.bcm index 3aea3e9c938b..68ae982800c8 100644 --- a/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/td3-a7050cx3-32s-48x50G+8x100G.config.bcm +++ b/device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8/td3-a7050cx3-32s-48x50G+8x100G.config.bcm @@ -1,4 +1,5 @@ -sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_issu/b870.6.4.1/ +sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ +l3_alpm_hit_skip=1 sai_adjust_acl_drop_in_rx_drop=1 host_as_route_disable=1 use_all_splithorizon_groups=1 @@ -11,7 +12,7 @@ riot_overlay_ecmp_resilient_hash_size=16384 flow_init_mode=1 arl_clean_timeout_usec=15000000 asf_mem_profile=2 -bcm_num_cos=8 +bcm_num_cos=10 bcm_stat_flags=1 bcm_stat_jumbo=9236 bcm_tunnel_term_compatible_mode=1 diff --git a/device/arista/x86_64-arista_7050cx3_32s/platform_asic b/device/arista/x86_64-arista_7050cx3_32s/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/arista/x86_64-arista_7050cx3_32s/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/arista/x86_64-arista_7050cx3_32s/td3-a7050cx3-32s-flex.config.bcm b/device/arista/x86_64-arista_7050cx3_32s/td3-a7050cx3-32s-flex.config.bcm index 29ecbf08ccee..fef962c852b7 100644 --- a/device/arista/x86_64-arista_7050cx3_32s/td3-a7050cx3-32s-flex.config.bcm +++ b/device/arista/x86_64-arista_7050cx3_32s/td3-a7050cx3-32s-flex.config.bcm @@ -1,7 +1,7 @@ PHY_AN_ALLOW_PLL_CHANGE=1 arl_clean_timeout_usec=15000000 asf_mem_profile=2 -bcm_num_cos=8 +bcm_num_cos=10 bcm_stat_flags=1 bcm_stat_jumbo=9236 bcm_tunnel_term_compatible_mode=1 @@ -395,7 +395,7 @@ port_phy_addr=0xff robust_hash_disable_egress_vlan=1 robust_hash_disable_mpls=1 robust_hash_disable_vlan=1 -sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_issu/b870.6.4.1/ +sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ sai_tunnel_support=1 serdes_core_rx_polarity_flip_physical{1}=0x8 serdes_core_rx_polarity_flip_physical{5}=0x2 diff --git a/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/td3-a7050sx3_48c8-48x10G+8x100G.config.bcm b/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/td3-a7050sx3_48c8-48x10G+8x100G.config.bcm index 18d173be6c1a..a7f91d17c97f 100644 --- a/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/td3-a7050sx3_48c8-48x10G+8x100G.config.bcm +++ b/device/arista/x86_64-arista_7050sx3_48c8/Arista-7050SX3-48C8/td3-a7050sx3_48c8-48x10G+8x100G.config.bcm @@ -1,7 +1,7 @@ PHY_AN_ALLOW_PLL_CHANGE=1 arl_clean_timeout_usec=15000000 asf_mem_profile=2 -bcm_num_cos=8 +bcm_num_cos=10 bcm_stat_flags=1 bcm_stat_jumbo=9236 bcm_tunnel_term_compatible_mode=1 diff --git a/device/arista/x86_64-arista_7050sx3_48c8/platform_asic b/device/arista/x86_64-arista_7050sx3_48c8/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48c8/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/td3-a7050sx3_48yc8-48x25G+8x100G.config.bcm b/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/td3-a7050sx3_48yc8-48x25G+8x100G.config.bcm index 1ce55f79d95a..7783b318d8a3 100644 --- a/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/td3-a7050sx3_48yc8-48x25G+8x100G.config.bcm +++ b/device/arista/x86_64-arista_7050sx3_48yc8/Arista-7050SX3-48YC8/td3-a7050sx3_48yc8-48x25G+8x100G.config.bcm @@ -1,7 +1,7 @@ PHY_AN_ALLOW_PLL_CHANGE=1 arl_clean_timeout_usec=15000000 asf_mem_profile=2 -bcm_num_cos=8 +bcm_num_cos=10 bcm_stat_flags=1 bcm_stat_jumbo=9236 bcm_tunnel_term_compatible_mode=1 diff --git a/device/arista/x86_64-arista_7050sx3_48yc8/platform_asic b/device/arista/x86_64-arista_7050sx3_48yc8/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/arista/x86_64-arista_7050sx3_48yc8/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/th-a7060-cx32s-32x100G-t1.config.bcm b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/th-a7060-cx32s-32x100G-t1.config.bcm index adbb21ca3b83..63846c22b3fe 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/th-a7060-cx32s-32x100G-t1.config.bcm +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-C32/th-a7060-cx32s-32x100G-t1.config.bcm @@ -1,5 +1,8 @@ # Arista 7060CX-32S +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/th-a7060-cx32s-8x100G+48x50G.config.bcm b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/th-a7060-cx32s-8x100G+48x50G.config.bcm index b496399451ce..f7460e8b23f7 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/th-a7060-cx32s-8x100G+48x50G.config.bcm +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-D48C8/th-a7060-cx32s-8x100G+48x50G.config.bcm @@ -1,5 +1,8 @@ # Arista 7060CX-32S +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/th-a7060-cx32s-8x100G+24x40G.config.bcm b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/th-a7060-cx32s-8x100G+24x40G.config.bcm index 1c7f37618d5f..2be9e3187ea8 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/th-a7060-cx32s-8x100G+24x40G.config.bcm +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q24C8/th-a7060-cx32s-8x100G+24x40G.config.bcm @@ -1,5 +1,8 @@ # Arista 7060CX-32S +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t0.config.bcm b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t0.config.bcm index 6a3011ca516c..e82627d6086a 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t0.config.bcm +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t0.config.bcm @@ -1,5 +1,8 @@ # Arista 7060CX-32S +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t1.config.bcm b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t1.config.bcm index 90046651bf16..90061ce680c8 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t1.config.bcm +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-Q32/th-a7060-cx32s-32x40G-t1.config.bcm @@ -1,5 +1,8 @@ # Arista 7060CX-32S +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-T96C8/th-a7060-cx32s-8x100G+96x25G.config.bcm b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-T96C8/th-a7060-cx32s-8x100G+96x25G.config.bcm index 94ac99e3e3e3..6827156a1c7e 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-T96C8/th-a7060-cx32s-8x100G+96x25G.config.bcm +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S-T96C8/th-a7060-cx32s-8x100G+96x25G.config.bcm @@ -1,5 +1,8 @@ # Arista 7060CX-32S +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S/hwsku.json b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S/hwsku.json index f25d311597c1..1af84d1f5b21 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S/hwsku.json +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S/hwsku.json @@ -96,11 +96,11 @@ "Ethernet124": { "default_brkout_mode": "1x100G[50G,40G,25G,10G]" }, - "Ethernet125": { + "Ethernet128": { "default_brkout_mode": "1x10G" }, - "Ethernet126": { + "Ethernet129": { "default_brkout_mode": "1x10G" } } -} \ No newline at end of file +} diff --git a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S/port_config.ini b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S/port_config.ini index 63360ac1d25a..d44f6f541fa3 100644 --- a/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S/port_config.ini +++ b/device/arista/x86_64-arista_7060_cx32s/Arista-7060CX-32S/port_config.ini @@ -31,5 +31,5 @@ Ethernet112 17,18,19,20 Ethernet29/1 29 Ethernet116 21,22,23,24 Ethernet30/1 30 Ethernet120 25,26,27,28 Ethernet31/1 31 Ethernet124 29,30,31,32 Ethernet32/1 32 -Ethernet125 129 Ethernet33 33 -Ethernet126 131 Ethernet34 34 +Ethernet128 129 Ethernet33 33 +Ethernet129 131 Ethernet34 34 diff --git a/device/arista/x86_64-arista_7060_cx32s/platform-init b/device/arista/x86_64-arista_7060_cx32s/platform-init new file mode 100755 index 000000000000..e31a7a0db4c7 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/platform-init @@ -0,0 +1,3 @@ +# Increase PCIe timeout value to 210ms +setpci -s01:00.0 CAP_EXP+0x28.B=6 +setpci -s01:00.1 CAP_EXP+0x28.B=6 diff --git a/device/arista/x86_64-arista_7060_cx32s/platform.json b/device/arista/x86_64-arista_7060_cx32s/platform.json index 89a08b422126..92c0d40a3758 100644 --- a/device/arista/x86_64-arista_7060_cx32s/platform.json +++ b/device/arista/x86_64-arista_7060_cx32s/platform.json @@ -802,7 +802,7 @@ ] } }, - "Ethernet125": { + "Ethernet128": { "index": "33", "lanes": "129", "breakout_modes": { @@ -811,7 +811,7 @@ ] } }, - "Ethernet126": { + "Ethernet129": { "index": "34", "lanes": "131", "breakout_modes": { diff --git a/device/arista/x86_64-arista_7060_cx32s/platform_asic b/device/arista/x86_64-arista_7060_cx32s/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/arista/x86_64-arista_7060_cx32s/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/arista/x86_64-arista_7060_cx32s/th-a7060-cx32s-flex-all.config.bcm b/device/arista/x86_64-arista_7060_cx32s/th-a7060-cx32s-flex-all.config.bcm index 34da213f5bb5..3432eea00e2e 100644 --- a/device/arista/x86_64-arista_7060_cx32s/th-a7060-cx32s-flex-all.config.bcm +++ b/device/arista/x86_64-arista_7060_cx32s/th-a7060-cx32s-flex-all.config.bcm @@ -32,71 +32,263 @@ phy_an_c37_100.0=2 phy_an_c73=1 phy_an_fec=1 phy_xaui_rx_polarity_flip_1.0=0x1 +phy_xaui_rx_polarity_flip_2.0=0x0 +phy_xaui_rx_polarity_flip_3.0=0x0 +phy_xaui_rx_polarity_flip_4.0=0x0 phy_xaui_rx_polarity_flip_5.0=0x5 +phy_xaui_rx_polarity_flip_6.0=0x2 +phy_xaui_rx_polarity_flip_7.0=0x1 +phy_xaui_rx_polarity_flip_8.0=0x0 phy_xaui_rx_polarity_flip_9.0=0x1 +phy_xaui_rx_polarity_flip_10.0=0x0 +phy_xaui_rx_polarity_flip_11.0=0x0 +phy_xaui_rx_polarity_flip_12.0=0x0 phy_xaui_rx_polarity_flip_13.0=0x7 +phy_xaui_rx_polarity_flip_14.0=0x3 +phy_xaui_rx_polarity_flip_15.0=0x1 +phy_xaui_rx_polarity_flip_16.0=0x0 phy_xaui_rx_polarity_flip_17.0=0xc +phy_xaui_rx_polarity_flip_18.0=0x6 +phy_xaui_rx_polarity_flip_19.0=0x3 +phy_xaui_rx_polarity_flip_20.0=0x1 phy_xaui_rx_polarity_flip_21.0=0xf +phy_xaui_rx_polarity_flip_22.0=0x7 +phy_xaui_rx_polarity_flip_23.0=0x3 +phy_xaui_rx_polarity_flip_24.0=0x1 phy_xaui_rx_polarity_flip_25.0=0xc +phy_xaui_rx_polarity_flip_26.0=0x6 +phy_xaui_rx_polarity_flip_27.0=0x3 +phy_xaui_rx_polarity_flip_28.0=0x1 phy_xaui_rx_polarity_flip_29.0=0xf +phy_xaui_rx_polarity_flip_30.0=0x7 +phy_xaui_rx_polarity_flip_31.0=0x3 +phy_xaui_rx_polarity_flip_32.0=0x1 phy_xaui_rx_polarity_flip_34.0=0x0 +phy_xaui_rx_polarity_flip_35.0=0x0 +phy_xaui_rx_polarity_flip_36.0=0x0 +phy_xaui_rx_polarity_flip_37.0=0x0 phy_xaui_rx_polarity_flip_38.0=0x7 +phy_xaui_rx_polarity_flip_39.0=0x3 +phy_xaui_rx_polarity_flip_40.0=0x1 +phy_xaui_rx_polarity_flip_41.0=0x0 phy_xaui_rx_polarity_flip_42.0=0x4 +phy_xaui_rx_polarity_flip_43.0=0x2 +phy_xaui_rx_polarity_flip_44.0=0x1 +phy_xaui_rx_polarity_flip_45.0=0x0 phy_xaui_rx_polarity_flip_46.0=0x7 +phy_xaui_rx_polarity_flip_47.0=0x3 +phy_xaui_rx_polarity_flip_48.0=0x1 +phy_xaui_rx_polarity_flip_49.0=0x0 phy_xaui_rx_polarity_flip_50.0=0x4 +phy_xaui_rx_polarity_flip_51.0=0x2 +phy_xaui_rx_polarity_flip_52.0=0x1 +phy_xaui_rx_polarity_flip_53.0=0x0 phy_xaui_rx_polarity_flip_54.0=0x6 +phy_xaui_rx_polarity_flip_55.0=0x3 +phy_xaui_rx_polarity_flip_56.0=0x1 +phy_xaui_rx_polarity_flip_57.0=0x0 phy_xaui_rx_polarity_flip_58.0=0x1 -phy_xaui_rx_polarity_flip_61.0=0x2 +phy_xaui_rx_polarity_flip_59.0=0x0 +phy_xaui_rx_polarity_flip_60.0=0x0 +phy_xaui_rx_polarity_flip_61.0=0x0 +phy_xaui_rx_polarity_flip_62.0=0x2 +phy_xaui_rx_polarity_flip_63.0=0x1 +phy_xaui_rx_polarity_flip_64.0=0x0 +phy_xaui_rx_polarity_flip_65.0=0x0 phy_xaui_rx_polarity_flip_68.0=0xd +phy_xaui_rx_polarity_flip_69.0=0x6 +phy_xaui_rx_polarity_flip_70.0=0x3 +phy_xaui_rx_polarity_flip_71.0=0x1 phy_xaui_rx_polarity_flip_72.0=0x6 +phy_xaui_rx_polarity_flip_73.0=0x3 +phy_xaui_rx_polarity_flip_74.0=0x1 +phy_xaui_rx_polarity_flip_75.0=0x0 phy_xaui_rx_polarity_flip_76.0=0x1 +phy_xaui_rx_polarity_flip_77.0=0x0 +phy_xaui_rx_polarity_flip_78.0=0x0 +phy_xaui_rx_polarity_flip_79.0=0x0 phy_xaui_rx_polarity_flip_80.0=0x8 +phy_xaui_rx_polarity_flip_81.0=0x4 +phy_xaui_rx_polarity_flip_82.0=0x2 +phy_xaui_rx_polarity_flip_83.0=0x1 phy_xaui_rx_polarity_flip_84.0=0x7 +phy_xaui_rx_polarity_flip_85.0=0x3 +phy_xaui_rx_polarity_flip_86.0=0x1 +phy_xaui_rx_polarity_flip_87.0=0x0 phy_xaui_rx_polarity_flip_88.0=0xc +phy_xaui_rx_polarity_flip_89.0=0x6 +phy_xaui_rx_polarity_flip_90.0=0x3 +phy_xaui_rx_polarity_flip_91.0=0x1 phy_xaui_rx_polarity_flip_92.0=0x7 +phy_xaui_rx_polarity_flip_93.0=0x3 +phy_xaui_rx_polarity_flip_94.0=0x1 +phy_xaui_rx_polarity_flip_95.0=0x0 phy_xaui_rx_polarity_flip_96.0=0x8 +phy_xaui_rx_polarity_flip_97.0=0x4 +phy_xaui_rx_polarity_flip_98.0=0x2 +phy_xaui_rx_polarity_flip_99.0=0x1 phy_xaui_rx_polarity_flip_102.0=0xb +phy_xaui_rx_polarity_flip_103.0=0x5 +phy_xaui_rx_polarity_flip_104.0=0x2 +phy_xaui_rx_polarity_flip_105.0=0x1 phy_xaui_rx_polarity_flip_106.0=0xc +phy_xaui_rx_polarity_flip_107.0=0x6 +phy_xaui_rx_polarity_flip_108.0=0x3 +phy_xaui_rx_polarity_flip_109.0=0x1 phy_xaui_rx_polarity_flip_110.0=0x3 +phy_xaui_rx_polarity_flip_111.0=0x1 +phy_xaui_rx_polarity_flip_112.0=0x0 +phy_xaui_rx_polarity_flip_113.0=0x0 phy_xaui_rx_polarity_flip_114.0=0xc +phy_xaui_rx_polarity_flip_115.0=0x6 +phy_xaui_rx_polarity_flip_116.0=0x3 +phy_xaui_rx_polarity_flip_117.0=0x1 phy_xaui_rx_polarity_flip_118.0=0xb +phy_xaui_rx_polarity_flip_119.0=0x5 +phy_xaui_rx_polarity_flip_120.0=0x2 +phy_xaui_rx_polarity_flip_121.0=0x1 phy_xaui_rx_polarity_flip_122.0=0x5 +phy_xaui_rx_polarity_flip_123.0=0x2 +phy_xaui_rx_polarity_flip_124.0=0x1 +phy_xaui_rx_polarity_flip_125.0=0x0 phy_xaui_rx_polarity_flip_126.0=0x1 +phy_xaui_rx_polarity_flip_127.0=0x0 +phy_xaui_rx_polarity_flip_128.0=0x0 +phy_xaui_rx_polarity_flip_129.0=0x0 phy_xaui_rx_polarity_flip_130.0=0x9 +phy_xaui_rx_polarity_flip_131.0=0x4 +phy_xaui_rx_polarity_flip_132.0=0x2 +phy_xaui_rx_polarity_flip_133.0=0x1 phy_xaui_rx_polarity_flip_66.0=0x0 phy_xaui_rx_polarity_flip_100.0=0x0 phy_xaui_tx_polarity_flip_1.0=0x0 +phy_xaui_tx_polarity_flip_2.0=0x0 +phy_xaui_tx_polarity_flip_3.0=0x0 +phy_xaui_tx_polarity_flip_4.0=0x0 phy_xaui_tx_polarity_flip_5.0=0xe +phy_xaui_tx_polarity_flip_6.0=0x7 +phy_xaui_tx_polarity_flip_7.0=0x3 +phy_xaui_tx_polarity_flip_8.0=0x1 phy_xaui_tx_polarity_flip_9.0=0x2 +phy_xaui_tx_polarity_flip_10.0=0x1 +phy_xaui_tx_polarity_flip_11.0=0x0 +phy_xaui_tx_polarity_flip_12.0=0x0 phy_xaui_tx_polarity_flip_13.0=0xe +phy_xaui_tx_polarity_flip_14.0=0x7 +phy_xaui_tx_polarity_flip_15.0=0x3 +phy_xaui_tx_polarity_flip_16.0=0x1 phy_xaui_tx_polarity_flip_17.0=0xc +phy_xaui_tx_polarity_flip_18.0=0x6 +phy_xaui_tx_polarity_flip_19.0=0x3 +phy_xaui_tx_polarity_flip_20.0=0x1 phy_xaui_tx_polarity_flip_21.0=0xf +phy_xaui_tx_polarity_flip_22.0=0x7 +phy_xaui_tx_polarity_flip_23.0=0x3 +phy_xaui_tx_polarity_flip_24.0=0x1 phy_xaui_tx_polarity_flip_25.0=0xc +phy_xaui_tx_polarity_flip_26.0=0x6 +phy_xaui_tx_polarity_flip_27.0=0x3 +phy_xaui_tx_polarity_flip_28.0=0x1 phy_xaui_tx_polarity_flip_29.0=0xf +phy_xaui_tx_polarity_flip_30.0=0x7 +phy_xaui_tx_polarity_flip_31.0=0x3 +phy_xaui_tx_polarity_flip_32.0=0x1 phy_xaui_tx_polarity_flip_34.0=0x0 +phy_xaui_tx_polarity_flip_35.0=0x0 +phy_xaui_tx_polarity_flip_36.0=0x0 +phy_xaui_tx_polarity_flip_37.0=0x0 phy_xaui_tx_polarity_flip_38.0=0xe +phy_xaui_tx_polarity_flip_39.0=0x7 +phy_xaui_tx_polarity_flip_40.0=0x3 +phy_xaui_tx_polarity_flip_41.0=0x1 phy_xaui_tx_polarity_flip_42.0=0x0 +phy_xaui_tx_polarity_flip_43.0=0x0 +phy_xaui_tx_polarity_flip_44.0=0x0 +phy_xaui_tx_polarity_flip_45.0=0x0 phy_xaui_tx_polarity_flip_46.0=0xe +phy_xaui_tx_polarity_flip_47.0=0x7 +phy_xaui_tx_polarity_flip_48.0=0x3 +phy_xaui_tx_polarity_flip_49.0=0x1 phy_xaui_tx_polarity_flip_50.0=0xf +phy_xaui_tx_polarity_flip_51.0=0x7 +phy_xaui_tx_polarity_flip_52.0=0x3 +phy_xaui_tx_polarity_flip_53.0=0x1 phy_xaui_tx_polarity_flip_54.0=0xe +phy_xaui_tx_polarity_flip_55.0=0x7 +phy_xaui_tx_polarity_flip_56.0=0x3 +phy_xaui_tx_polarity_flip_57.0=0x1 phy_xaui_tx_polarity_flip_58.0=0x6 -phy_xaui_tx_polarity_flip_61.0=0xb +phy_xaui_tx_polarity_flip_59.0=0x3 +phy_xaui_tx_polarity_flip_60.0=0x1 +phy_xaui_tx_polarity_flip_61.0=0x0 +phy_xaui_tx_polarity_flip_62.0=0xb +phy_xaui_tx_polarity_flip_63.0=0x5 +phy_xaui_tx_polarity_flip_64.0=0x2 +phy_xaui_tx_polarity_flip_65.0=0x1 phy_xaui_tx_polarity_flip_68.0=0x9 +phy_xaui_tx_polarity_flip_69.0=0x4 +phy_xaui_tx_polarity_flip_70.0=0x2 +phy_xaui_tx_polarity_flip_71.0=0x1 phy_xaui_tx_polarity_flip_72.0=0xb +phy_xaui_tx_polarity_flip_73.0=0x5 +phy_xaui_tx_polarity_flip_74.0=0x2 +phy_xaui_tx_polarity_flip_75.0=0x1 phy_xaui_tx_polarity_flip_76.0=0xd +phy_xaui_tx_polarity_flip_77.0=0x6 +phy_xaui_tx_polarity_flip_78.0=0x3 +phy_xaui_tx_polarity_flip_79.0=0x1 phy_xaui_tx_polarity_flip_80.0=0x9 +phy_xaui_tx_polarity_flip_81.0=0x4 +phy_xaui_tx_polarity_flip_82.0=0x2 +phy_xaui_tx_polarity_flip_83.0=0x1 phy_xaui_tx_polarity_flip_84.0=0x6 +phy_xaui_tx_polarity_flip_85.0=0x3 +phy_xaui_tx_polarity_flip_86.0=0x1 +phy_xaui_tx_polarity_flip_87.0=0x0 phy_xaui_tx_polarity_flip_88.0=0xc +phy_xaui_tx_polarity_flip_89.0=0x6 +phy_xaui_tx_polarity_flip_90.0=0x3 +phy_xaui_tx_polarity_flip_91.0=0x1 phy_xaui_tx_polarity_flip_92.0=0x9 +phy_xaui_tx_polarity_flip_93.0=0x4 +phy_xaui_tx_polarity_flip_94.0=0x2 +phy_xaui_tx_polarity_flip_95.0=0x1 phy_xaui_tx_polarity_flip_96.0=0x9 +phy_xaui_tx_polarity_flip_97.0=0x4 +phy_xaui_tx_polarity_flip_98.0=0x2 +phy_xaui_tx_polarity_flip_99.0=0x1 phy_xaui_tx_polarity_flip_102.0=0x6 +phy_xaui_tx_polarity_flip_103.0=0x3 +phy_xaui_tx_polarity_flip_104.0=0x1 +phy_xaui_tx_polarity_flip_105.0=0x0 phy_xaui_tx_polarity_flip_106.0=0xb +phy_xaui_tx_polarity_flip_107.0=0x5 +phy_xaui_tx_polarity_flip_108.0=0x2 +phy_xaui_tx_polarity_flip_109.0=0x1 phy_xaui_tx_polarity_flip_110.0=0x6 +phy_xaui_tx_polarity_flip_111.0=0x3 +phy_xaui_tx_polarity_flip_112.0=0x1 +phy_xaui_tx_polarity_flip_113.0=0x0 phy_xaui_tx_polarity_flip_114.0=0xb +phy_xaui_tx_polarity_flip_115.0=0x5 +phy_xaui_tx_polarity_flip_116.0=0x2 +phy_xaui_tx_polarity_flip_117.0=0x1 phy_xaui_tx_polarity_flip_118.0=0x6 +phy_xaui_tx_polarity_flip_119.0=0x3 +phy_xaui_tx_polarity_flip_120.0=0x1 +phy_xaui_tx_polarity_flip_121.0=0x0 phy_xaui_tx_polarity_flip_122.0=0xf +phy_xaui_tx_polarity_flip_123.0=0x7 +phy_xaui_tx_polarity_flip_124.0=0x3 +phy_xaui_tx_polarity_flip_125.0=0x1 phy_xaui_tx_polarity_flip_126.0=0x6 +phy_xaui_tx_polarity_flip_127.0=0x3 +phy_xaui_tx_polarity_flip_128.0=0x1 +phy_xaui_tx_polarity_flip_129.0=0x0 phy_xaui_tx_polarity_flip_130.0=0xc +phy_xaui_tx_polarity_flip_131.0=0x6 +phy_xaui_tx_polarity_flip_132.0=0x3 +phy_xaui_tx_polarity_flip_133.0=0x1 phy_xaui_tx_polarity_flip_66.0=0x0 phy_xaui_tx_polarity_flip_100.0=0x0 portmap_1.0=1:100 @@ -245,7 +437,7 @@ xgxs_rx_lane_map_46.0=0x0321 xgxs_rx_lane_map_50.0=0x1230 xgxs_rx_lane_map_54.0=0x2301 xgxs_rx_lane_map_58.0=0x1230 -xgxs_rx_lane_map_61.0=0x2103 +xgxs_rx_lane_map_62.0=0x2103 xgxs_rx_lane_map_68.0=0x1230 xgxs_rx_lane_map_72.0=0x2301 xgxs_rx_lane_map_76.0=0x1230 @@ -278,7 +470,7 @@ xgxs_tx_lane_map_46.0=0x0321 xgxs_tx_lane_map_50.0=0x0123 xgxs_tx_lane_map_54.0=0x1230 xgxs_tx_lane_map_58.0=0x2301 -xgxs_tx_lane_map_61.0=0x1032 +xgxs_tx_lane_map_62.0=0x1032 xgxs_tx_lane_map_68.0=0x0123 xgxs_tx_lane_map_72.0=0x1230 xgxs_tx_lane_map_76.0=0x2301 diff --git a/device/arista/x86_64-arista_7060cx2_32s/platform_asic b/device/arista/x86_64-arista_7060cx2_32s/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/arista/x86_64-arista_7060cx2_32s/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/arista/x86_64-arista_7060dx4_32/platform_asic b/device/arista/x86_64-arista_7060dx4_32/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/arista/x86_64-arista_7060dx4_32/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/arista/x86_64-arista_7060px4_32/Arista-7060PX4-C64/th3-a7060px4-32-64x100G.config.bcm b/device/arista/x86_64-arista_7060px4_32/Arista-7060PX4-C64/th3-a7060px4-32-64x100G.config.bcm index eb2c7bc0f5fb..c429c28bad68 100644 --- a/device/arista/x86_64-arista_7060px4_32/Arista-7060PX4-C64/th3-a7060px4-32-64x100G.config.bcm +++ b/device/arista/x86_64-arista_7060px4_32/Arista-7060PX4-C64/th3-a7060px4-32-64x100G.config.bcm @@ -1,5 +1,7 @@ # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 arl_clean_timeout_usec=15000000 asf_mem_profile.0=2 bcm_num_cos.0=8 diff --git a/device/arista/x86_64-arista_7060px4_32/Arista-7060PX4-O32/th3-a7060px4-o32-32x400G.config.bcm b/device/arista/x86_64-arista_7060px4_32/Arista-7060PX4-O32/th3-a7060px4-o32-32x400G.config.bcm index f9e731e58823..b23b8abf1377 100644 --- a/device/arista/x86_64-arista_7060px4_32/Arista-7060PX4-O32/th3-a7060px4-o32-32x400G.config.bcm +++ b/device/arista/x86_64-arista_7060px4_32/Arista-7060PX4-O32/th3-a7060px4-o32-32x400G.config.bcm @@ -1,5 +1,7 @@ # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 arl_clean_timeout_usec=15000000 asf_mem_profile.0=2 bcm_num_cos.0=8 diff --git a/device/arista/x86_64-arista_7060px4_32/platform_asic b/device/arista/x86_64-arista_7060px4_32/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/arista/x86_64-arista_7060px4_32/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/arista/x86_64-arista_7170_32c/Arista-7170-32C-C32/switch-sai.conf b/device/arista/x86_64-arista_7170_32c/Arista-7170-32C-C32/switch-sai.conf deleted file mode 100644 index 0a807b1c9ea7..000000000000 --- a/device/arista/x86_64-arista_7170_32c/Arista-7170-32C-C32/switch-sai.conf +++ /dev/null @@ -1,33 +0,0 @@ -{ - "chip_list": [ - { - "id": "asic-0", - "chip_family": "Tofino", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:1c.4/0000:07:00.0", - "pcie_domain": 0, - "pcie_bus": 7, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" - } - ], - "instance": 0, - "p4_program_list": [ - { - "id": "pgm-0", - "instance": 0, - "path": "switch", - "program-name": "switch", - "pd": "lib/tofinopd/switch/libpd.so", - "pd-thrift": "lib/tofinopd/switch/libpdthrift.so", - "table-config": "share/tofinopd/switch/context.json", - "tofino-bin": "share/tofinopd/switch/tofino.bin", - "switchapi": "lib/libswitchapi.so", - "sai": "lib/libsai.so", - "switchapi_port_add": false, - "non_default_port_ppgs": 5 - } - ] -} diff --git a/device/arista/x86_64-arista_7170_32c/Arista-7170-32C-C32/switch-tna-sai.conf b/device/arista/x86_64-arista_7170_32c/Arista-7170-32C-C32/switch-tna-sai.conf index ece3fcbe6a90..dc8c82ce2546 100644 --- a/device/arista/x86_64-arista_7170_32c/Arista-7170-32C-C32/switch-tna-sai.conf +++ b/device/arista/x86_64-arista_7170_32c/Arista-7170-32C-C32/switch-tna-sai.conf @@ -1,16 +1,8 @@ { - "instance": 0, "chip_list": [ { - "id": "asic-0", "chip_family": "Tofino", "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, "sds_fw_path": "share/tofino_sds_fw/avago/firmware" } ], @@ -27,7 +19,6 @@ } ], "program-name": "switch", - "sai": "lib/libsai.so", "bfrt-config": "share/switch/bf-rt.json", "model_json_path" : "share/switch/aug_model.json", "switchapi_port_add": false, @@ -35,5 +26,13 @@ } ] } + ], + "switch_options": [ + { + "device-id": 0, + "model_json_path": "share/switch/aug_model.json", + "non_default_port_ppgs": 5, + "switchapi_port_add": false + } ] } diff --git a/device/arista/x86_64-arista_7170_32c/platform_asic b/device/arista/x86_64-arista_7170_32c/platform_asic new file mode 100644 index 000000000000..88d88117928c --- /dev/null +++ b/device/arista/x86_64-arista_7170_32c/platform_asic @@ -0,0 +1 @@ +barefoot diff --git a/device/arista/x86_64-arista_7170_32cd/Arista-7170-32CD-C32/switch-sai.conf b/device/arista/x86_64-arista_7170_32cd/Arista-7170-32CD-C32/switch-sai.conf deleted file mode 100644 index 0a807b1c9ea7..000000000000 --- a/device/arista/x86_64-arista_7170_32cd/Arista-7170-32CD-C32/switch-sai.conf +++ /dev/null @@ -1,33 +0,0 @@ -{ - "chip_list": [ - { - "id": "asic-0", - "chip_family": "Tofino", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:1c.4/0000:07:00.0", - "pcie_domain": 0, - "pcie_bus": 7, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" - } - ], - "instance": 0, - "p4_program_list": [ - { - "id": "pgm-0", - "instance": 0, - "path": "switch", - "program-name": "switch", - "pd": "lib/tofinopd/switch/libpd.so", - "pd-thrift": "lib/tofinopd/switch/libpdthrift.so", - "table-config": "share/tofinopd/switch/context.json", - "tofino-bin": "share/tofinopd/switch/tofino.bin", - "switchapi": "lib/libswitchapi.so", - "sai": "lib/libsai.so", - "switchapi_port_add": false, - "non_default_port_ppgs": 5 - } - ] -} diff --git a/device/arista/x86_64-arista_7170_32cd/Arista-7170-32CD-C32/switch-tna-sai.conf b/device/arista/x86_64-arista_7170_32cd/Arista-7170-32CD-C32/switch-tna-sai.conf index ece3fcbe6a90..dc8c82ce2546 100644 --- a/device/arista/x86_64-arista_7170_32cd/Arista-7170-32CD-C32/switch-tna-sai.conf +++ b/device/arista/x86_64-arista_7170_32cd/Arista-7170-32CD-C32/switch-tna-sai.conf @@ -1,16 +1,8 @@ { - "instance": 0, "chip_list": [ { - "id": "asic-0", "chip_family": "Tofino", "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, "sds_fw_path": "share/tofino_sds_fw/avago/firmware" } ], @@ -27,7 +19,6 @@ } ], "program-name": "switch", - "sai": "lib/libsai.so", "bfrt-config": "share/switch/bf-rt.json", "model_json_path" : "share/switch/aug_model.json", "switchapi_port_add": false, @@ -35,5 +26,13 @@ } ] } + ], + "switch_options": [ + { + "device-id": 0, + "model_json_path": "share/switch/aug_model.json", + "non_default_port_ppgs": 5, + "switchapi_port_add": false + } ] } diff --git a/device/arista/x86_64-arista_7170_32cd/platform_asic b/device/arista/x86_64-arista_7170_32cd/platform_asic new file mode 100644 index 000000000000..88d88117928c --- /dev/null +++ b/device/arista/x86_64-arista_7170_32cd/platform_asic @@ -0,0 +1 @@ +barefoot diff --git a/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/switch-sai.conf b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/switch-sai.conf deleted file mode 100644 index 0a807b1c9ea7..000000000000 --- a/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/switch-sai.conf +++ /dev/null @@ -1,33 +0,0 @@ -{ - "chip_list": [ - { - "id": "asic-0", - "chip_family": "Tofino", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:1c.4/0000:07:00.0", - "pcie_domain": 0, - "pcie_bus": 7, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" - } - ], - "instance": 0, - "p4_program_list": [ - { - "id": "pgm-0", - "instance": 0, - "path": "switch", - "program-name": "switch", - "pd": "lib/tofinopd/switch/libpd.so", - "pd-thrift": "lib/tofinopd/switch/libpdthrift.so", - "table-config": "share/tofinopd/switch/context.json", - "tofino-bin": "share/tofinopd/switch/tofino.bin", - "switchapi": "lib/libswitchapi.so", - "sai": "lib/libsai.so", - "switchapi_port_add": false, - "non_default_port_ppgs": 5 - } - ] -} diff --git a/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/switch-tna-sai.conf b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/switch-tna-sai.conf index ece3fcbe6a90..dc8c82ce2546 100644 --- a/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/switch-tna-sai.conf +++ b/device/arista/x86_64-arista_7170_64c/Arista-7170-64C/switch-tna-sai.conf @@ -1,16 +1,8 @@ { - "instance": 0, "chip_list": [ { - "id": "asic-0", "chip_family": "Tofino", "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, "sds_fw_path": "share/tofino_sds_fw/avago/firmware" } ], @@ -27,7 +19,6 @@ } ], "program-name": "switch", - "sai": "lib/libsai.so", "bfrt-config": "share/switch/bf-rt.json", "model_json_path" : "share/switch/aug_model.json", "switchapi_port_add": false, @@ -35,5 +26,13 @@ } ] } + ], + "switch_options": [ + { + "device-id": 0, + "model_json_path": "share/switch/aug_model.json", + "non_default_port_ppgs": 5, + "switchapi_port_add": false + } ] } diff --git a/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/switch-sai.conf b/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/switch-sai.conf deleted file mode 100644 index 0a807b1c9ea7..000000000000 --- a/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/switch-sai.conf +++ /dev/null @@ -1,33 +0,0 @@ -{ - "chip_list": [ - { - "id": "asic-0", - "chip_family": "Tofino", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:1c.4/0000:07:00.0", - "pcie_domain": 0, - "pcie_bus": 7, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" - } - ], - "instance": 0, - "p4_program_list": [ - { - "id": "pgm-0", - "instance": 0, - "path": "switch", - "program-name": "switch", - "pd": "lib/tofinopd/switch/libpd.so", - "pd-thrift": "lib/tofinopd/switch/libpdthrift.so", - "table-config": "share/tofinopd/switch/context.json", - "tofino-bin": "share/tofinopd/switch/tofino.bin", - "switchapi": "lib/libswitchapi.so", - "sai": "lib/libsai.so", - "switchapi_port_add": false, - "non_default_port_ppgs": 5 - } - ] -} diff --git a/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/switch-tna-sai.conf b/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/switch-tna-sai.conf index ece3fcbe6a90..dc8c82ce2546 100644 --- a/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/switch-tna-sai.conf +++ b/device/arista/x86_64-arista_7170_64c/Arista-7170-Q59S20/switch-tna-sai.conf @@ -1,16 +1,8 @@ { - "instance": 0, "chip_list": [ { - "id": "asic-0", "chip_family": "Tofino", "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, "sds_fw_path": "share/tofino_sds_fw/avago/firmware" } ], @@ -27,7 +19,6 @@ } ], "program-name": "switch", - "sai": "lib/libsai.so", "bfrt-config": "share/switch/bf-rt.json", "model_json_path" : "share/switch/aug_model.json", "switchapi_port_add": false, @@ -35,5 +26,13 @@ } ] } + ], + "switch_options": [ + { + "device-id": 0, + "model_json_path": "share/switch/aug_model.json", + "non_default_port_ppgs": 5, + "switchapi_port_add": false + } ] } diff --git a/device/arista/x86_64-arista_7170_64c/platform_asic b/device/arista/x86_64-arista_7170_64c/platform_asic new file mode 100644 index 000000000000..88d88117928c --- /dev/null +++ b/device/arista/x86_64-arista_7170_64c/platform_asic @@ -0,0 +1 @@ +barefoot diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/hwsku.json b/device/arista/x86_64-arista_7170b_64c/Arista-7170B-64C/hwsku.json similarity index 76% rename from device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/hwsku.json rename to device/arista/x86_64-arista_7170b_64c/Arista-7170B-64C/hwsku.json index 04826b7f557c..5266dc3a7034 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/hwsku.json +++ b/device/arista/x86_64-arista_7170b_64c/Arista-7170B-64C/hwsku.json @@ -25,28 +25,16 @@ "default_brkout_mode": "1x100G[50G,40G,25G,10G]" }, "Ethernet32": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet34": { - "default_brkout_mode": "2x50G[25G,10G]" + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" }, "Ethernet36": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet38": { - "default_brkout_mode": "2x50G[25G,10G]" + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" }, "Ethernet40": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet42": { - "default_brkout_mode": "2x50G[25G,10G]" + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" }, "Ethernet44": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet46": { - "default_brkout_mode": "2x50G[25G,10G]" + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" }, "Ethernet48": { "default_brkout_mode": "1x100G[50G,40G,25G,10G]" @@ -91,16 +79,10 @@ "default_brkout_mode": "1x100G[50G,40G,25G,10G]" }, "Ethernet104": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet106": { - "default_brkout_mode": "2x50G[25G,10G]" + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" }, "Ethernet108": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet110": { - "default_brkout_mode": "2x50G[25G,10G]" + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" }, "Ethernet112": { "default_brkout_mode": "1x100G[50G,40G,25G,10G]" @@ -151,28 +133,16 @@ "default_brkout_mode": "1x100G[50G,40G,25G,10G]" }, "Ethernet176": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet178": { - "default_brkout_mode": "2x50G[25G,10G]" + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" }, "Ethernet180": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet182": { - "default_brkout_mode": "2x50G[25G,10G]" + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" }, "Ethernet184": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet186": { - "default_brkout_mode": "2x50G[25G,10G]" + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" }, "Ethernet188": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet190": { - "default_brkout_mode": "2x50G[25G,10G]" + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" }, "Ethernet192": { "default_brkout_mode": "1x100G[50G,40G,25G,10G]" @@ -211,22 +181,22 @@ "default_brkout_mode": "1x100G[50G,40G,25G,10G]" }, "Ethernet240": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet242": { - "default_brkout_mode": "2x50G[25G,10G]" + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" }, "Ethernet244": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet246": { - "default_brkout_mode": "2x50G[25G,10G]" + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" }, "Ethernet248": { "default_brkout_mode": "1x100G[50G,40G,25G,10G]" }, "Ethernet252": { "default_brkout_mode": "1x100G[50G,40G,25G,10G]" + }, + "Ethernet256": { + "default_brkout_mode": "1x10G" + }, + "Ethernet257": { + "default_brkout_mode": "1x10G" } } -} +} \ No newline at end of file diff --git a/device/arista/x86_64-arista_7170b_64c/default_sku b/device/arista/x86_64-arista_7170b_64c/default_sku new file mode 100644 index 000000000000..ae991fd893cd --- /dev/null +++ b/device/arista/x86_64-arista_7170b_64c/default_sku @@ -0,0 +1 @@ +Arista-7170B-64C t1 diff --git a/device/arista/x86_64-arista_7170b_64c/platform.json b/device/arista/x86_64-arista_7170b_64c/platform.json new file mode 100644 index 000000000000..aa0439463708 --- /dev/null +++ b/device/arista/x86_64-arista_7170b_64c/platform.json @@ -0,0 +1,1507 @@ +{ + "chassis": { + "name": "DCS-7170B-64C", + "components": [], + "fans": [], + "fan_drawers": [], + "psus": [ + { + "name": "psu1", + "fans": [] + }, + { + "name": "psu2", + "fans": [] + } + ], + "thermals": [ + { + "name": "Cpu temp sensor" + }, + { + "name": "CPU board temp sensor" + }, + { + "name": "Back-panel temp sensor" + }, + { + "name": "Switch card" + }, + { + "name": "Front" + }, + { + "name": "Rear" + }, + { + "name": "FrontLT" + }, + { + "name": "FrontRT" + }, + { + "name": "RearLT" + }, + { + "name": "RearRT" + }, + { + "name": "Tofino2" + }, + { + "name": "Power supply 1 inlet temp sensor" + }, + { + "name": "Power supply 1 secondary hotspot sensor" + }, + { + "name": "Power supply 1 primary hotspot sensor" + }, + { + "name": "Power supply 2 inlet temp sensor" + }, + { + "name": "Power supply 2 secondary hotspot sensor" + }, + { + "name": "Power supply 2 primary hotspot sensor" + } + ], + "sfps": [ + { + "name": "qsfp1" + }, + { + "name": "qsfp2" + }, + { + "name": "qsfp3" + }, + { + "name": "qsfp4" + }, + { + "name": "qsfp5" + }, + { + "name": "qsfp6" + }, + { + "name": "qsfp7" + }, + { + "name": "qsfp8" + }, + { + "name": "qsfp9" + }, + { + "name": "qsfp10" + }, + { + "name": "qsfp11" + }, + { + "name": "qsfp12" + }, + { + "name": "qsfp13" + }, + { + "name": "qsfp14" + }, + { + "name": "qsfp15" + }, + { + "name": "qsfp16" + }, + { + "name": "qsfp17" + }, + { + "name": "qsfp18" + }, + { + "name": "qsfp19" + }, + { + "name": "qsfp20" + }, + { + "name": "qsfp21" + }, + { + "name": "qsfp22" + }, + { + "name": "qsfp23" + }, + { + "name": "qsfp24" + }, + { + "name": "qsfp25" + }, + { + "name": "qsfp26" + }, + { + "name": "qsfp27" + }, + { + "name": "qsfp28" + }, + { + "name": "qsfp29" + }, + { + "name": "qsfp30" + }, + { + "name": "qsfp31" + }, + { + "name": "qsfp32" + }, + { + "name": "qsfp33" + }, + { + "name": "qsfp34" + }, + { + "name": "qsfp35" + }, + { + "name": "qsfp36" + }, + { + "name": "qsfp37" + }, + { + "name": "qsfp38" + }, + { + "name": "qsfp39" + }, + { + "name": "qsfp40" + }, + { + "name": "qsfp41" + }, + { + "name": "qsfp42" + }, + { + "name": "qsfp43" + }, + { + "name": "qsfp44" + }, + { + "name": "qsfp45" + }, + { + "name": "qsfp46" + }, + { + "name": "qsfp47" + }, + { + "name": "qsfp48" + }, + { + "name": "qsfp49" + }, + { + "name": "qsfp50" + }, + { + "name": "qsfp51" + }, + { + "name": "qsfp52" + }, + { + "name": "qsfp53" + }, + { + "name": "qsfp54" + }, + { + "name": "qsfp55" + }, + { + "name": "qsfp56" + }, + { + "name": "qsfp57" + }, + { + "name": "qsfp58" + }, + { + "name": "qsfp59" + }, + { + "name": "qsfp60" + }, + { + "name": "qsfp61" + }, + { + "name": "qsfp62" + }, + { + "name": "qsfp63" + }, + { + "name": "qsfp64" + }, + { + "name": "sfp65" + }, + { + "name": "sfp66" + } + ] + }, + "interfaces": { + "Ethernet0": { + "index": "1,1,1,1", + "lanes": "0,1,2,3", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet1/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet1/1", + "Ethernet1/3" + ], + "4x25G[10G]": [ + "Ethernet1/1", + "Ethernet1/2", + "Ethernet1/3", + "Ethernet1/4" + ] + } + }, + "Ethernet4": { + "index": "2,2,2,2", + "lanes": "4,5,6,7", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet2/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet2/1", + "Ethernet2/3" + ], + "4x25G[10G]": [ + "Ethernet2/1", + "Ethernet2/2", + "Ethernet2/3", + "Ethernet2/4" + ] + } + }, + "Ethernet8": { + "index": "3,3,3,3", + "lanes": "8,9,10,11", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet3/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet3/1", + "Ethernet3/3" + ], + "4x25G[10G]": [ + "Ethernet3/1", + "Ethernet3/2", + "Ethernet3/3", + "Ethernet3/4" + ] + } + }, + "Ethernet12": { + "index": "4,4,4,4", + "lanes": "12,13,14,15", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet4/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet4/1", + "Ethernet4/3" + ], + "4x25G[10G]": [ + "Ethernet4/1", + "Ethernet4/2", + "Ethernet4/3", + "Ethernet4/4" + ] + } + }, + "Ethernet16": { + "index": "5,5,5,5", + "lanes": "16,17,18,19", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet5/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet5/1", + "Ethernet5/3" + ], + "4x25G[10G]": [ + "Ethernet5/1", + "Ethernet5/2", + "Ethernet5/3", + "Ethernet5/4" + ] + } + }, + "Ethernet20": { + "index": "6,6,6,6", + "lanes": "20,21,22,23", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet6/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet6/1", + "Ethernet6/3" + ], + "4x25G[10G]": [ + "Ethernet6/1", + "Ethernet6/2", + "Ethernet6/3", + "Ethernet6/4" + ] + } + }, + "Ethernet24": { + "index": "7,7,7,7", + "lanes": "24,25,26,27", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet7/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet7/1", + "Ethernet7/3" + ], + "4x25G[10G]": [ + "Ethernet7/1", + "Ethernet7/2", + "Ethernet7/3", + "Ethernet7/4" + ] + } + }, + "Ethernet28": { + "index": "8,8,8,8", + "lanes": "28,29,30,31", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet8/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet8/1", + "Ethernet8/3" + ], + "4x25G[10G]": [ + "Ethernet8/1", + "Ethernet8/2", + "Ethernet8/3", + "Ethernet8/4" + ] + } + }, + "Ethernet32": { + "index": "9,9,9,9", + "lanes": "32,33,34,35", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet9/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet9/1", + "Ethernet9/3" + ], + "4x25G[10G]": [ + "Ethernet9/1", + "Ethernet9/2", + "Ethernet9/3", + "Ethernet9/4" + ] + } + }, + "Ethernet36": { + "index": "10,10,10,10", + "lanes": "36,37,38,39", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet10/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet10/1", + "Ethernet10/3" + ], + "4x25G[10G]": [ + "Ethernet10/1", + "Ethernet10/2", + "Ethernet10/3", + "Ethernet10/4" + ] + } + }, + "Ethernet40": { + "index": "11,11,11,11", + "lanes": "40,41,42,43", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet11/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet11/1", + "Ethernet11/3" + ], + "4x25G[10G]": [ + "Ethernet11/1", + "Ethernet11/2", + "Ethernet11/3", + "Ethernet11/4" + ] + } + }, + "Ethernet44": { + "index": "12,12,12,12", + "lanes": "44,45,46,47", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet12/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet12/1", + "Ethernet12/3" + ], + "4x25G[10G]": [ + "Ethernet12/1", + "Ethernet12/2", + "Ethernet12/3", + "Ethernet12/4" + ] + } + }, + "Ethernet48": { + "index": "13,13,13,13", + "lanes": "48,49,50,51", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet13/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet13/1", + "Ethernet13/3" + ], + "4x25G[10G]": [ + "Ethernet13/1", + "Ethernet13/2", + "Ethernet13/3", + "Ethernet13/4" + ] + } + }, + "Ethernet52": { + "index": "14,14,14,14", + "lanes": "52,53,54,55", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet14/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet14/1", + "Ethernet14/3" + ], + "4x25G[10G]": [ + "Ethernet14/1", + "Ethernet14/2", + "Ethernet14/3", + "Ethernet14/4" + ] + } + }, + "Ethernet56": { + "index": "15,15,15,15", + "lanes": "56,57,58,59", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet15/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet15/1", + "Ethernet15/3" + ], + "4x25G[10G]": [ + "Ethernet15/1", + "Ethernet15/2", + "Ethernet15/3", + "Ethernet15/4" + ] + } + }, + "Ethernet60": { + "index": "16,16,16,16", + "lanes": "60,61,62,63", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet16/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet16/1", + "Ethernet16/3" + ], + "4x25G[10G]": [ + "Ethernet16/1", + "Ethernet16/2", + "Ethernet16/3", + "Ethernet16/4" + ] + } + }, + "Ethernet64": { + "index": "17,17,17,17", + "lanes": "64,65,66,67", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet17/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet17/1", + "Ethernet17/3" + ], + "4x25G[10G]": [ + "Ethernet17/1", + "Ethernet17/2", + "Ethernet17/3", + "Ethernet17/4" + ] + } + }, + "Ethernet68": { + "index": "18,18,18,18", + "lanes": "68,69,70,71", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet18/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet18/1", + "Ethernet18/3" + ], + "4x25G[10G]": [ + "Ethernet18/1", + "Ethernet18/2", + "Ethernet18/3", + "Ethernet18/4" + ] + } + }, + "Ethernet72": { + "index": "19,19,19,19", + "lanes": "72,73,74,75", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet19/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet19/1", + "Ethernet19/3" + ], + "4x25G[10G]": [ + "Ethernet19/1", + "Ethernet19/2", + "Ethernet19/3", + "Ethernet19/4" + ] + } + }, + "Ethernet76": { + "index": "20,20,20,20", + "lanes": "76,77,78,79", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet20/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet20/1", + "Ethernet20/3" + ], + "4x25G[10G]": [ + "Ethernet20/1", + "Ethernet20/2", + "Ethernet20/3", + "Ethernet20/4" + ] + } + }, + "Ethernet80": { + "index": "21,21,21,21", + "lanes": "80,81,82,83", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet21/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet21/1", + "Ethernet21/3" + ], + "4x25G[10G]": [ + "Ethernet21/1", + "Ethernet21/2", + "Ethernet21/3", + "Ethernet21/4" + ] + } + }, + "Ethernet84": { + "index": "22,22,22,22", + "lanes": "84,85,86,87", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet22/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet22/1", + "Ethernet22/3" + ], + "4x25G[10G]": [ + "Ethernet22/1", + "Ethernet22/2", + "Ethernet22/3", + "Ethernet22/4" + ] + } + }, + "Ethernet88": { + "index": "23,23,23,23", + "lanes": "88,89,90,91", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet23/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet23/1", + "Ethernet23/3" + ], + "4x25G[10G]": [ + "Ethernet23/1", + "Ethernet23/2", + "Ethernet23/3", + "Ethernet23/4" + ] + } + }, + "Ethernet92": { + "index": "24,24,24,24", + "lanes": "92,93,94,95", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet24/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet24/1", + "Ethernet24/3" + ], + "4x25G[10G]": [ + "Ethernet24/1", + "Ethernet24/2", + "Ethernet24/3", + "Ethernet24/4" + ] + } + }, + "Ethernet96": { + "index": "25,25,25,25", + "lanes": "96,97,98,99", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet25/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet25/1", + "Ethernet25/3" + ], + "4x25G[10G]": [ + "Ethernet25/1", + "Ethernet25/2", + "Ethernet25/3", + "Ethernet25/4" + ] + } + }, + "Ethernet100": { + "index": "26,26,26,26", + "lanes": "100,101,102,103", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet26/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet26/1", + "Ethernet26/3" + ], + "4x25G[10G]": [ + "Ethernet26/1", + "Ethernet26/2", + "Ethernet26/3", + "Ethernet26/4" + ] + } + }, + "Ethernet104": { + "index": "27,27,27,27", + "lanes": "104,105,106,107", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet27/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet27/1", + "Ethernet27/3" + ], + "4x25G[10G]": [ + "Ethernet27/1", + "Ethernet27/2", + "Ethernet27/3", + "Ethernet27/4" + ] + } + }, + "Ethernet108": { + "index": "28,28,28,28", + "lanes": "108,109,110,111", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet28/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet28/1", + "Ethernet28/3" + ], + "4x25G[10G]": [ + "Ethernet28/1", + "Ethernet28/2", + "Ethernet28/3", + "Ethernet28/4" + ] + } + }, + "Ethernet112": { + "index": "29,29,29,29", + "lanes": "112,113,114,115", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet29/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet29/1", + "Ethernet29/3" + ], + "4x25G[10G]": [ + "Ethernet29/1", + "Ethernet29/2", + "Ethernet29/3", + "Ethernet29/4" + ] + } + }, + "Ethernet116": { + "index": "30,30,30,30", + "lanes": "116,117,118,119", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet30/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet30/1", + "Ethernet30/3" + ], + "4x25G[10G]": [ + "Ethernet30/1", + "Ethernet30/2", + "Ethernet30/3", + "Ethernet30/4" + ] + } + }, + "Ethernet120": { + "index": "31,31,31,31", + "lanes": "120,121,122,123", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet31/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet31/1", + "Ethernet31/3" + ], + "4x25G[10G]": [ + "Ethernet31/1", + "Ethernet31/2", + "Ethernet31/3", + "Ethernet31/4" + ] + } + }, + "Ethernet124": { + "index": "32,32,32,32", + "lanes": "124,125,126,127", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet32/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet32/1", + "Ethernet32/3" + ], + "4x25G[10G]": [ + "Ethernet32/1", + "Ethernet32/2", + "Ethernet32/3", + "Ethernet32/4" + ] + } + }, + "Ethernet128": { + "index": "33,33,33,33", + "lanes": "128,129,130,131", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet33/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet33/1", + "Ethernet33/3" + ], + "4x25G[10G]": [ + "Ethernet33/1", + "Ethernet33/2", + "Ethernet33/3", + "Ethernet33/4" + ] + } + }, + "Ethernet132": { + "index": "34,34,34,34", + "lanes": "132,133,134,135", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet34/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet34/1", + "Ethernet34/3" + ], + "4x25G[10G]": [ + "Ethernet34/1", + "Ethernet34/2", + "Ethernet34/3", + "Ethernet34/4" + ] + } + }, + "Ethernet136": { + "index": "35,35,35,35", + "lanes": "136,137,138,139", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet35/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet35/1", + "Ethernet35/3" + ], + "4x25G[10G]": [ + "Ethernet35/1", + "Ethernet35/2", + "Ethernet35/3", + "Ethernet35/4" + ] + } + }, + "Ethernet140": { + "index": "36,36,36,36", + "lanes": "140,141,142,143", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet36/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet36/1", + "Ethernet36/3" + ], + "4x25G[10G]": [ + "Ethernet36/1", + "Ethernet36/2", + "Ethernet36/3", + "Ethernet36/4" + ] + } + }, + "Ethernet144": { + "index": "37,37,37,37", + "lanes": "144,145,146,147", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet37/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet37/1", + "Ethernet37/3" + ], + "4x25G[10G]": [ + "Ethernet37/1", + "Ethernet37/2", + "Ethernet37/3", + "Ethernet37/4" + ] + } + }, + "Ethernet148": { + "index": "38,38,38,38", + "lanes": "148,149,150,151", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet38/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet38/1", + "Ethernet38/3" + ], + "4x25G[10G]": [ + "Ethernet38/1", + "Ethernet38/2", + "Ethernet38/3", + "Ethernet38/4" + ] + } + }, + "Ethernet152": { + "index": "39,39,39,39", + "lanes": "152,153,154,155", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet39/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet39/1", + "Ethernet39/3" + ], + "4x25G[10G]": [ + "Ethernet39/1", + "Ethernet39/2", + "Ethernet39/3", + "Ethernet39/4" + ] + } + }, + "Ethernet156": { + "index": "40,40,40,40", + "lanes": "156,157,158,159", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet40/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet40/1", + "Ethernet40/3" + ], + "4x25G[10G]": [ + "Ethernet40/1", + "Ethernet40/2", + "Ethernet40/3", + "Ethernet40/4" + ] + } + }, + "Ethernet160": { + "index": "41,41,41,41", + "lanes": "160,161,162,163", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet41/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet41/1", + "Ethernet41/3" + ], + "4x25G[10G]": [ + "Ethernet41/1", + "Ethernet41/2", + "Ethernet41/3", + "Ethernet41/4" + ] + } + }, + "Ethernet164": { + "index": "42,42,42,42", + "lanes": "164,165,166,167", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet42/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet42/1", + "Ethernet42/3" + ], + "4x25G[10G]": [ + "Ethernet42/1", + "Ethernet42/2", + "Ethernet42/3", + "Ethernet42/4" + ] + } + }, + "Ethernet168": { + "index": "43,43,43,43", + "lanes": "168,169,170,171", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet43/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet43/1", + "Ethernet43/3" + ], + "4x25G[10G]": [ + "Ethernet43/1", + "Ethernet43/2", + "Ethernet43/3", + "Ethernet43/4" + ] + } + }, + "Ethernet172": { + "index": "44,44,44,44", + "lanes": "172,173,174,175", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet44/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet44/1", + "Ethernet44/3" + ], + "4x25G[10G]": [ + "Ethernet44/1", + "Ethernet44/2", + "Ethernet44/3", + "Ethernet44/4" + ] + } + }, + "Ethernet176": { + "index": "45,45,45,45", + "lanes": "176,177,178,179", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet45/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet45/1", + "Ethernet45/3" + ], + "4x25G[10G]": [ + "Ethernet45/1", + "Ethernet45/2", + "Ethernet45/3", + "Ethernet45/4" + ] + } + }, + "Ethernet180": { + "index": "46,46,46,46", + "lanes": "180,181,182,183", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet46/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet46/1", + "Ethernet46/3" + ], + "4x25G[10G]": [ + "Ethernet46/1", + "Ethernet46/2", + "Ethernet46/3", + "Ethernet46/4" + ] + } + }, + "Ethernet184": { + "index": "47,47,47,47", + "lanes": "184,185,186,187", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet47/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet47/1", + "Ethernet47/3" + ], + "4x25G[10G]": [ + "Ethernet47/1", + "Ethernet47/2", + "Ethernet47/3", + "Ethernet47/4" + ] + } + }, + "Ethernet188": { + "index": "48,48,48,48", + "lanes": "188,189,190,191", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet48/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet48/1", + "Ethernet48/3" + ], + "4x25G[10G]": [ + "Ethernet48/1", + "Ethernet48/2", + "Ethernet48/3", + "Ethernet48/4" + ] + } + }, + "Ethernet192": { + "index": "49,49,49,49", + "lanes": "192,193,194,195", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet49/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet49/1", + "Ethernet49/3" + ], + "4x25G[10G]": [ + "Ethernet49/1", + "Ethernet49/2", + "Ethernet49/3", + "Ethernet49/4" + ] + } + }, + "Ethernet196": { + "index": "50,50,50,50", + "lanes": "196,197,198,199", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet50/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet50/1", + "Ethernet50/3" + ], + "4x25G[10G]": [ + "Ethernet50/1", + "Ethernet50/2", + "Ethernet50/3", + "Ethernet50/4" + ] + } + }, + "Ethernet200": { + "index": "51,51,51,51", + "lanes": "200,201,202,203", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet51/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet51/1", + "Ethernet51/3" + ], + "4x25G[10G]": [ + "Ethernet51/1", + "Ethernet51/2", + "Ethernet51/3", + "Ethernet51/4" + ] + } + }, + "Ethernet204": { + "index": "52,52,52,52", + "lanes": "204,205,206,207", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet52/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet52/1", + "Ethernet52/3" + ], + "4x25G[10G]": [ + "Ethernet52/1", + "Ethernet52/2", + "Ethernet52/3", + "Ethernet52/4" + ] + } + }, + "Ethernet208": { + "index": "53,53,53,53", + "lanes": "208,209,210,211", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet53/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet53/1", + "Ethernet53/3" + ], + "4x25G[10G]": [ + "Ethernet53/1", + "Ethernet53/2", + "Ethernet53/3", + "Ethernet53/4" + ] + } + }, + "Ethernet212": { + "index": "54,54,54,54", + "lanes": "212,213,214,215", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet54/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet54/1", + "Ethernet54/3" + ], + "4x25G[10G]": [ + "Ethernet54/1", + "Ethernet54/2", + "Ethernet54/3", + "Ethernet54/4" + ] + } + }, + "Ethernet216": { + "index": "55,55,55,55", + "lanes": "216,217,218,219", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet55/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet55/1", + "Ethernet55/3" + ], + "4x25G[10G]": [ + "Ethernet55/1", + "Ethernet55/2", + "Ethernet55/3", + "Ethernet55/4" + ] + } + }, + "Ethernet220": { + "index": "56,56,56,56", + "lanes": "220,221,222,223", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet56/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet56/1", + "Ethernet56/3" + ], + "4x25G[10G]": [ + "Ethernet56/1", + "Ethernet56/2", + "Ethernet56/3", + "Ethernet56/4" + ] + } + }, + "Ethernet224": { + "index": "57,57,57,57", + "lanes": "224,225,226,227", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet57/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet57/1", + "Ethernet57/3" + ], + "4x25G[10G]": [ + "Ethernet57/1", + "Ethernet57/2", + "Ethernet57/3", + "Ethernet57/4" + ] + } + }, + "Ethernet228": { + "index": "58,58,58,58", + "lanes": "228,229,230,231", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet58/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet58/1", + "Ethernet58/3" + ], + "4x25G[10G]": [ + "Ethernet58/1", + "Ethernet58/2", + "Ethernet58/3", + "Ethernet58/4" + ] + } + }, + "Ethernet232": { + "index": "59,59,59,59", + "lanes": "232,233,234,235", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet59/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet59/1", + "Ethernet59/3" + ], + "4x25G[10G]": [ + "Ethernet59/1", + "Ethernet59/2", + "Ethernet59/3", + "Ethernet59/4" + ] + } + }, + "Ethernet236": { + "index": "60,60,60,60", + "lanes": "236,237,238,239", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet60/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet60/1", + "Ethernet60/3" + ], + "4x25G[10G]": [ + "Ethernet60/1", + "Ethernet60/2", + "Ethernet60/3", + "Ethernet60/4" + ] + } + }, + "Ethernet240": { + "index": "61,61,61,61", + "lanes": "240,241,242,243", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet61/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet61/1", + "Ethernet61/3" + ], + "4x25G[10G]": [ + "Ethernet61/1", + "Ethernet61/2", + "Ethernet61/3", + "Ethernet61/4" + ] + } + }, + "Ethernet244": { + "index": "62,62,62,62", + "lanes": "244,245,246,247", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet62/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet62/1", + "Ethernet62/3" + ], + "4x25G[10G]": [ + "Ethernet62/1", + "Ethernet62/2", + "Ethernet62/3", + "Ethernet62/4" + ] + } + }, + "Ethernet248": { + "index": "63,63,63,63", + "lanes": "248,249,250,251", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet63/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet63/1", + "Ethernet63/3" + ], + "4x25G[10G]": [ + "Ethernet63/1", + "Ethernet63/2", + "Ethernet63/3", + "Ethernet63/4" + ] + } + }, + "Ethernet252": { + "index": "64,64,64,64", + "lanes": "252,253,254,255", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": [ + "Ethernet64/1" + ], + "2x50G[40G,25G,10G]": [ + "Ethernet64/1", + "Ethernet64/3" + ], + "4x25G[10G]": [ + "Ethernet64/1", + "Ethernet64/2", + "Ethernet64/3", + "Ethernet64/4" + ] + } + }, + "Ethernet256": { + "index": "65", + "lanes": "256", + "breakout_modes": { + "1x10G": [ + "Ethernet65" + ] + } + }, + "Ethernet257": { + "index": "66", + "lanes": "256", + "breakout_modes": { + "1x10G": [ + "Ethernet66" + ] + } + } + } +} \ No newline at end of file diff --git a/device/arista/x86_64-arista_7170b_64c/platform_asic b/device/arista/x86_64-arista_7170b_64c/platform_asic new file mode 100644 index 000000000000..88d88117928c --- /dev/null +++ b/device/arista/x86_64-arista_7170b_64c/platform_asic @@ -0,0 +1 @@ +barefoot diff --git a/device/arista/x86_64-arista_7170b_64c/platform_reboot b/device/arista/x86_64-arista_7170b_64c/platform_reboot new file mode 120000 index 000000000000..7f94a49e38b0 --- /dev/null +++ b/device/arista/x86_64-arista_7170b_64c/platform_reboot @@ -0,0 +1 @@ +../x86_64-arista_common/platform_reboot \ No newline at end of file diff --git a/device/arista/x86_64-arista_7170b_64c/plugins b/device/arista/x86_64-arista_7170b_64c/plugins new file mode 120000 index 000000000000..789a45fcace9 --- /dev/null +++ b/device/arista/x86_64-arista_7170b_64c/plugins @@ -0,0 +1 @@ +../x86_64-arista_common/plugins \ No newline at end of file diff --git a/device/arista/x86_64-arista_7170b_64c/pmon_daemon_control.json b/device/arista/x86_64-arista_7170b_64c/pmon_daemon_control.json new file mode 120000 index 000000000000..51d5ab7b0059 --- /dev/null +++ b/device/arista/x86_64-arista_7170b_64c/pmon_daemon_control.json @@ -0,0 +1 @@ +../x86_64-arista_common/pmon_daemon_control.json \ No newline at end of file diff --git a/device/arista/x86_64-arista_7170b_64c/system_health_monitoring_config.json b/device/arista/x86_64-arista_7170b_64c/system_health_monitoring_config.json new file mode 120000 index 000000000000..1185f771fa8e --- /dev/null +++ b/device/arista/x86_64-arista_7170b_64c/system_health_monitoring_config.json @@ -0,0 +1 @@ +../x86_64-arista_common/system_health_monitoring_config.json \ No newline at end of file diff --git a/device/arista/x86_64-arista_7170b_64c/thermal_policy.json b/device/arista/x86_64-arista_7170b_64c/thermal_policy.json new file mode 120000 index 000000000000..0991dc7f3638 --- /dev/null +++ b/device/arista/x86_64-arista_7170b_64c/thermal_policy.json @@ -0,0 +1 @@ +../x86_64-arista_common/thermal_policy.json \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/config.bcm.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/config.bcm.j2 index 38bc9f3dc1d2..9410a83b6716 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/config.bcm.j2 +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/config.bcm.j2 @@ -19,6 +19,7 @@ {%- endif %} {# The following is the common soc properties that used to be named "th2-a7260cx3-64-64x100G-t1.config.bcm" #} +l3_alpm_hit_skip=1 sai_adjust_acl_drop_in_rx_drop=1 PHY_AN_ALLOW_PLL_CHANGE=1 arl_clean_timeout_usec=15000000 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/pg_profile_lookup.ini b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/pg_profile_lookup.ini index 254e58d3940e..0e71479fc2c2 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/pg_profile_lookup.ini +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/pg_profile_lookup.ini @@ -1,5 +1,8 @@ # PG lossless profiles. # speed cable size xon xoff threshold xon_offset - 100000 5m 1248 1248 96928 -3 2496 + 100000 5m 1248 1248 54080 -3 2496 100000 40m 1248 1248 59696 -3 2496 100000 300m 1248 1248 101088 -3 2496 + 40000 5m 1248 1248 29536 -3 2496 + 40000 40m 1248 1248 31616 -3 2496 + 40000 300m 1248 1248 48256 -3 2496 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/qos.json.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/qos.json.j2 index 3e548325ea30..4178efbcb7aa 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/qos.json.j2 +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64/qos.json.j2 @@ -1 +1,187 @@ +{% if ('type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'LeafRouter') %} +{%- macro generate_dscp_to_tc_map() %} + "DSCP_TO_TC_MAP": { + "AZURE": { + "0" : "1", + "1" : "1", + "2" : "2", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "6", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "1", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + } + }, +{%- endmacro %} +{%- macro generate_tc_to_pg_map() %} + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "2", + "3": "3", + "4": "4", + "5": "0", + "6": "6", + "7": "7" + } + }, +{%- endmacro %} +{% elif ('subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR') %} +{%- macro generate_dscp_to_tc_map() %} + "DSCP_TO_TC_MAP": { + "AZURE": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "2", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + } + }, +{%- endmacro %} +{%- macro generate_tc_to_pg_map() %} + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "7" + } + }, +{%- endmacro %} +{%- macro generate_tc_to_queue_map() %} + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "1", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, +{%- endmacro %} +{% endif %} + {%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/config.bcm.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/config.bcm.j2 index b2ef1cdf4977..d9d8347b50ae 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/config.bcm.j2 +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/config.bcm.j2 @@ -9,6 +9,7 @@ {%- endif %} {%- endif %} {# The following is the common soc properties that used to be named "th2-a7260cx3-64-112x50G+8x100G.config.bcm" #} +l3_alpm_hit_skip=1 sai_adjust_acl_drop_in_rx_drop=1 PHY_AN_ALLOW_PLL_CHANGE=1 arl_clean_timeout_usec=15000000 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 deleted file mode 100644 index 3e548325ea30..000000000000 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 +++ /dev/null @@ -1 +0,0 @@ -{%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 new file mode 120000 index 000000000000..f0ee02749724 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8/qos.json.j2 @@ -0,0 +1 @@ +../Arista-7260CX3-C64/qos.json.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/config.bcm.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/config.bcm.j2 index e8d3bd322993..de65d73d40a1 100644 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/config.bcm.j2 +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/config.bcm.j2 @@ -18,6 +18,7 @@ {%- endif %} {%- endif %} {# The following is the common soc properties that used to be named "th2-a7260cx3-64-64x40G.config.bcm" #} +l3_alpm_hit_skip=1 sai_adjust_acl_drop_in_rx_drop=1 PHY_AN_ALLOW_PLL_CHANGE=1 arl_clean_timeout_usec=15000000 diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/qos.json.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/qos.json.j2 deleted file mode 100644 index 3e548325ea30..000000000000 --- a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/qos.json.j2 +++ /dev/null @@ -1 +0,0 @@ -{%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/qos.json.j2 b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/qos.json.j2 new file mode 120000 index 000000000000..f0ee02749724 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-Q64/qos.json.j2 @@ -0,0 +1 @@ +../Arista-7260CX3-C64/qos.json.j2 \ No newline at end of file diff --git a/device/arista/x86_64-arista_7260cx3_64/platform_asic b/device/arista/x86_64-arista_7260cx3_64/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/arista/x86_64-arista_7260cx3_64/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/arista/x86_64-arista_7280cr3_32d4/platform_asic b/device/arista/x86_64-arista_7280cr3_32d4/platform_asic new file mode 100644 index 000000000000..9ba24ca3e753 --- /dev/null +++ b/device/arista/x86_64-arista_7280cr3_32d4/platform_asic @@ -0,0 +1 @@ +broadcom-dnx diff --git a/device/arista/x86_64-arista_7280cr3_32p4/platform_asic b/device/arista/x86_64-arista_7280cr3_32p4/platform_asic new file mode 100644 index 000000000000..9ba24ca3e753 --- /dev/null +++ b/device/arista/x86_64-arista_7280cr3_32p4/platform_asic @@ -0,0 +1 @@ +broadcom-dnx diff --git a/device/arista/x86_64-arista_7280cr3mk_32d4/platform_asic b/device/arista/x86_64-arista_7280cr3mk_32d4/platform_asic new file mode 100644 index 000000000000..9ba24ca3e753 --- /dev/null +++ b/device/arista/x86_64-arista_7280cr3mk_32d4/platform_asic @@ -0,0 +1 @@ +broadcom-dnx diff --git a/device/arista/x86_64-arista_7280cr3mk_32p4/Arista-7280CR3-C40/gearbox_100G_PAM4.xml b/device/arista/x86_64-arista_7280cr3mk_32p4/Arista-7280CR3-C40/gearbox_100G_PAM4.xml index 95e20b91787e..0ac9ff7b7846 100644 --- a/device/arista/x86_64-arista_7280cr3mk_32p4/Arista-7280CR3-C40/gearbox_100G_PAM4.xml +++ b/device/arista/x86_64-arista_7280cr3mk_32p4/Arista-7280CR3-C40/gearbox_100G_PAM4.xml @@ -4,11 +4,6 @@ 0 gearbox 2 - - 2,-8,17,0,0 - 0,-8,17,0,0 - - 0,0,1,0,0 @@ -34,4 +29,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/device/arista/x86_64-arista_7280cr3mk_32p4/Arista-7280CR3-C40/gearbox_config.json b/device/arista/x86_64-arista_7280cr3mk_32p4/Arista-7280CR3-C40/gearbox_config.json index 90c075f6a641..e05ee11290ac 100644 --- a/device/arista/x86_64-arista_7280cr3mk_32p4/Arista-7280CR3-C40/gearbox_config.json +++ b/device/arista/x86_64-arista_7280cr3mk_32p4/Arista-7280CR3-C40/gearbox_config.json @@ -11,6 +11,7 @@ "phy_access": "mdio", "bus_id": 0, "context_id": 1, + "macsec_ipg": 352, "hwinfo": "mdio0_0_0/0" }, { @@ -24,6 +25,7 @@ "phy_access": "mdio", "bus_id": 0, "context_id": 1, + "macsec_ipg": 352, "hwinfo": "mdio1_0_0/0" }, { @@ -37,6 +39,7 @@ "phy_access": "mdio", "bus_id": 0, "context_id": 1, + "macsec_ipg": 352, "hwinfo": "mdio2_0_0/0" }, { @@ -50,6 +53,7 @@ "phy_access": "mdio", "bus_id": 0, "context_id": 1, + "macsec_ipg": 352, "hwinfo": "mdio3_0_0/0" }, { @@ -63,6 +67,7 @@ "phy_access": "mdio", "bus_id": 0, "context_id": 1, + "macsec_ipg": 352, "hwinfo": "mdio4_0_0/0" }, { @@ -76,6 +81,7 @@ "phy_access": "mdio", "bus_id": 0, "context_id": 1, + "macsec_ipg": 352, "hwinfo": "mdio5_0_0/0" }, { @@ -89,6 +95,7 @@ "phy_access": "mdio", "bus_id": 0, "context_id": 1, + "macsec_ipg": 352, "hwinfo": "mdio6_0_0/0" }, { @@ -102,6 +109,7 @@ "phy_access": "mdio", "bus_id": 0, "context_id": 1, + "macsec_ipg": 352, "hwinfo": "mdio7_0_0/0" } ], diff --git a/device/arista/x86_64-arista_7280cr3mk_32p4/platform_asic b/device/arista/x86_64-arista_7280cr3mk_32p4/platform_asic new file mode 100644 index 000000000000..9ba24ca3e753 --- /dev/null +++ b/device/arista/x86_64-arista_7280cr3mk_32p4/platform_asic @@ -0,0 +1 @@ +broadcom-dnx diff --git a/device/arista/x86_64-arista_7800_sup/platform.json b/device/arista/x86_64-arista_7800_sup/platform.json new file mode 100644 index 000000000000..3afdaa3eb88b --- /dev/null +++ b/device/arista/x86_64-arista_7800_sup/platform.json @@ -0,0 +1,12 @@ +{ + "chassis": { + "name": "DCS-7800A-SUP1A", + "components": [], + "fans": [], + "fan_drawers": [], + "psus": [], + "thermals": [], + "sfps": [] + }, + "interfaces": {} +} diff --git a/device/arista/x86_64-arista_7800_sup/platform_asic b/device/arista/x86_64-arista_7800_sup/platform_asic new file mode 100644 index 000000000000..9ba24ca3e753 --- /dev/null +++ b/device/arista/x86_64-arista_7800_sup/platform_asic @@ -0,0 +1 @@ +broadcom-dnx diff --git a/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/buffers.json.j2 b/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/buffers.json.j2 new file mode 100644 index 000000000000..f34a844f4a87 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't2' %} +{%- include 'buffers_config.j2' %} diff --git a/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/buffers_defaults_t2.j2 b/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/buffers_defaults_t2.j2 new file mode 100644 index 000000000000..b5931bd37268 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/buffers_defaults_t2.j2 @@ -0,0 +1,66 @@ + +{%- set default_cable = '5m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,192,4) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "3220805000", + "type": "both", + "mode": "dynamic", + "xoff": "2102272" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"1280", + "dynamic_th":"-2", + "xon_offset":"2560", + "xon":"0", + "xoff":"66048" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "xon_offset":"0", + "static_th":"30535680" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"33030144" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"-1" + } + }, +{%- endmacro %} + +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { +{% for port in port_names.split(',') %} + "{{ port }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, +{% endfor %} +{% for port in port_names.split(',') %} + "{{ port }}|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, +{% endfor %} +{% for port in port_names.split(',') %} + "{{ port }}|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }{% if not loop.last %},{% endif %} +{% endfor %} + } +{%- endmacro %} \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/pg_profile_lookup.ini b/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/pg_profile_lookup.ini new file mode 100644 index 000000000000..887b6a493291 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/pg_profile_lookup.ini @@ -0,0 +1,23 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 10000 5m 1280 2560 45506 0 1280 + 25000 5m 1280 2560 49152 0 1280 + 40000 5m 1280 2560 49152 0 1280 + 50000 5m 1280 2560 53248 0 1280 + 100000 5m 1280 2560 65536 0 1280 + 200000 5m 1280 2560 90112 0 1280 + 400000 5m 1280 2560 135168 0 1280 + 10000 40m 1280 2560 45506 0 1280 + 25000 40m 1280 2560 49152 0 1280 + 40000 40m 1280 2560 53248 0 1280 + 50000 40m 1280 2560 57344 0 1280 + 100000 40m 1280 2560 69632 0 1280 + 200000 40m 1280 2560 102400 0 1280 + 400000 40m 1280 2560 159744 0 1280 + 10000 300m 1280 2560 49152 0 1280 + 25000 300m 1280 2560 61440 0 1280 + 40000 300m 1280 2560 69632 0 1280 + 50000 300m 1280 2560 77824 0 1280 + 100000 300m 1280 2560 114688 0 1280 + 200000 300m 1280 2560 188416 0 1280 + 400000 300m 1280 2560 331776 0 1280 diff --git a/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/qos.json.j2 b/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/qos.json.j2 new file mode 100644 index 000000000000..34002048afdb --- /dev/null +++ b/device/arista/x86_64-arista_7800r3_48cq2_lc/Arista-7800R3-48CQ2-C48/qos.json.j2 @@ -0,0 +1,21 @@ +{%- macro generate_wred_profiles() %} + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable" : "true", + "wred_yellow_enable" : "true", + "wred_red_enable" : "true", + "ecn" : "ecn_all", + "green_max_threshold" : "2097152", + "green_min_threshold" : "250000", + "yellow_max_threshold" : "2097152", + "yellow_min_threshold" : "1048576", + "red_max_threshold" : "2097152", + "red_min_threshold" : "1048576", + "green_drop_probability" : "5", + "yellow_drop_probability": "5", + "red_drop_probability" : "5" + } + }, +{%- endmacro %} + +{%- include 'qos_config.j2' %} diff --git a/device/arista/x86_64-arista_7800r3_48cq2_lc/platform.json b/device/arista/x86_64-arista_7800r3_48cq2_lc/platform.json new file mode 100644 index 000000000000..edd9039804d7 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3_48cq2_lc/platform.json @@ -0,0 +1,173 @@ +{ + "chassis": { + "name": "7800R3-48CQ2-LC", + "components": [], + "fans": [], + "fan_drawers": [], + "psus": [], + "thermals": [ + { + "name": "Cpu temp sensor" + }, + { + "name": "Center back" + }, + { + "name": "Fap0 core0" + }, + { + "name": "Fap0 core1" + }, + { + "name": "PCIE" + } + ], + "sfps": [ + { + "name": "qsfp1" + }, + { + "name": "qsfp2" + }, + { + "name": "qsfp3" + }, + { + "name": "qsfp4" + }, + { + "name": "qsfp5" + }, + { + "name": "qsfp6" + }, + { + "name": "qsfp7" + }, + { + "name": "qsfp8" + }, + { + "name": "qsfp9" + }, + { + "name": "qsfp10" + }, + { + "name": "qsfp11" + }, + { + "name": "qsfp12" + }, + { + "name": "qsfp13" + }, + { + "name": "qsfp14" + }, + { + "name": "qsfp15" + }, + { + "name": "qsfp16" + }, + { + "name": "qsfp17" + }, + { + "name": "qsfp18" + }, + { + "name": "qsfp19" + }, + { + "name": "qsfp20" + }, + { + "name": "qsfp21" + }, + { + "name": "qsfp22" + }, + { + "name": "qsfp23" + }, + { + "name": "qsfp24" + }, + { + "name": "qsfp25" + }, + { + "name": "qsfp26" + }, + { + "name": "qsfp27" + }, + { + "name": "qsfp28" + }, + { + "name": "qsfp29" + }, + { + "name": "qsfp30" + }, + { + "name": "qsfp31" + }, + { + "name": "qsfp32" + }, + { + "name": "qsfp33" + }, + { + "name": "qsfp34" + }, + { + "name": "qsfp35" + }, + { + "name": "qsfp36" + }, + { + "name": "qsfp37" + }, + { + "name": "qsfp38" + }, + { + "name": "qsfp39" + }, + { + "name": "qsfp40" + }, + { + "name": "qsfp41" + }, + { + "name": "qsfp42" + }, + { + "name": "qsfp43" + }, + { + "name": "qsfp44" + }, + { + "name": "qsfp45" + }, + { + "name": "qsfp46" + }, + { + "name": "qsfp47" + }, + { + "name": "qsfp48" + } + ] + }, + "interfaces": {} +} diff --git a/device/arista/x86_64-arista_7800r3_48cq2_lc/platform_asic b/device/arista/x86_64-arista_7800r3_48cq2_lc/platform_asic new file mode 100644 index 000000000000..9ba24ca3e753 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3_48cq2_lc/platform_asic @@ -0,0 +1 @@ +broadcom-dnx diff --git a/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/gearbox_config.json b/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/gearbox_config.json index be325b59995e..d72df085bb88 100644 --- a/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/gearbox_config.json +++ b/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/gearbox_config.json @@ -11,6 +11,7 @@ "phy_access": "mdio", "bus_id": 0, "context_id": 1, + "macsec_ipg": 352, "hwinfo": "mdio0_0_0/0" }, { @@ -24,6 +25,7 @@ "phy_access": "mdio", "bus_id": 0, "context_id": 1, + "macsec_ipg": 352, "hwinfo": "mdio1_0_0/0" }, { @@ -37,6 +39,7 @@ "phy_access": "mdio", "bus_id": 0, "context_id": 1, + "macsec_ipg": 352, "hwinfo": "mdio2_0_0/0" }, { @@ -50,6 +53,7 @@ "phy_access": "mdio", "bus_id": 0, "context_id": 1, + "macsec_ipg": 352, "hwinfo": "mdio3_0_0/0" }, { @@ -63,6 +67,7 @@ "phy_access": "mdio", "bus_id": 0, "context_id": 1, + "macsec_ipg": 352, "hwinfo": "mdio4_0_0/0" }, { @@ -76,6 +81,7 @@ "phy_access": "mdio", "bus_id": 0, "context_id": 1, + "macsec_ipg": 352, "hwinfo": "mdio5_0_0/0" }, { @@ -89,6 +95,7 @@ "phy_access": "mdio", "bus_id": 0, "context_id": 1, + "macsec_ipg": 352, "hwinfo": "mdio6_0_0/0" }, { @@ -102,6 +109,7 @@ "phy_access": "mdio", "bus_id": 0, "context_id": 1, + "macsec_ipg": 352, "hwinfo": "mdio7_0_0/0" }, { @@ -115,6 +123,7 @@ "phy_access": "mdio", "bus_id": 0, "context_id": 1, + "macsec_ipg": 352, "hwinfo": "mdio8_0_0/0" }, { @@ -128,6 +137,7 @@ "phy_access": "mdio", "bus_id": 0, "context_id": 1, + "macsec_ipg": 352, "hwinfo": "mdio9_0_0/0" }, { @@ -141,6 +151,7 @@ "phy_access": "mdio", "bus_id": 0, "context_id": 1, + "macsec_ipg": 352, "hwinfo": "mdio10_0_0/0" }, { @@ -154,6 +165,7 @@ "phy_access": "mdio", "bus_id": 0, "context_id": 1, + "macsec_ipg": 352, "hwinfo": "mdio11_0_0/0" } ], diff --git a/device/arista/x86_64-arista_7800r3_48cqm2_lc/platform.json b/device/arista/x86_64-arista_7800r3_48cqm2_lc/platform.json new file mode 120000 index 000000000000..2b84d998cf25 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3_48cqm2_lc/platform.json @@ -0,0 +1 @@ +../x86_64-arista_7800r3_48cq2_lc/platform.json \ No newline at end of file diff --git a/device/arista/x86_64-arista_7800r3_48cqm2_lc/platform_asic b/device/arista/x86_64-arista_7800r3_48cqm2_lc/platform_asic new file mode 100644 index 000000000000..9ba24ca3e753 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3_48cqm2_lc/platform_asic @@ -0,0 +1 @@ +broadcom-dnx diff --git a/device/arista/x86_64-arista_common/platform_asic b/device/arista/x86_64-arista_common/platform_asic new file mode 100644 index 000000000000..7e2f4f104415 --- /dev/null +++ b/device/arista/x86_64-arista_common/platform_asic @@ -0,0 +1,2 @@ +broadcom +broadcom-dnx diff --git a/device/barefoot/x86_64-accton_as9516_32d-r0/newport/hwsku.json b/device/barefoot/x86_64-accton_as9516_32d-r0/newport/hwsku.json new file mode 100644 index 000000000000..b6ab1e206823 --- /dev/null +++ b/device/barefoot/x86_64-accton_as9516_32d-r0/newport/hwsku.json @@ -0,0 +1,100 @@ +{ + "interfaces": { + "Ethernet0": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet8": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet16": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet24": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet32": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet40": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet48": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet56": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet64": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet72": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet80": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet88": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet96": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet104": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet112": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet120": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet128": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet136": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet144": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet152": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet160": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet168": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet176": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet184": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet192": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet200": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet208": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet216": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet224": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet232": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet240": { + "default_brkout_mode": "1x400G[200G]" + }, + "Ethernet248": { + "default_brkout_mode": "1x400G[200G]" + } + } +} diff --git a/device/barefoot/x86_64-accton_as9516_32d-r0/newport/switch-tna-sai.conf b/device/barefoot/x86_64-accton_as9516_32d-r0/newport/switch-tna-sai.conf index ca838c1bb5da..2789eb0e2c0d 100644 --- a/device/barefoot/x86_64-accton_as9516_32d-r0/newport/switch-tna-sai.conf +++ b/device/barefoot/x86_64-accton_as9516_32d-r0/newport/switch-tna-sai.conf @@ -1,17 +1,9 @@ { - "instance": 0, "chip_list": [ { - "id": "asic-0", "chip_family": "Tofino2", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + "sds_fw_path": "share/tofino_sds_fw/avago/firmware", + "instance": 0 } ], "p4_devices": [ @@ -20,22 +12,28 @@ "agent0": "lib/platform/x86_64-accton_as9516bf_32d-r0/libpltfm_mgr.so", "p4_programs": [ { + "program-name": "switch", + "bfrt-config": "share/switch/bf-rt.json", "p4_pipelines": [ { "p4_pipeline_name": "pipe", "config": "share/switch/pipe/tofino2.bin", "context": "share/switch/pipe/context.json" } - ], - "program-name": "switch", - "sai": "lib/libsai.so", - "bfrt-config": "share/switch/bf-rt.json", + ], "model_json_path" : "share/switch/aug_model.json", "switchapi_port_add": false, - "non_default_port_ppgs": 5, - "cpu_port": "eth2" + "non_default_port_ppgs": 5 } ] } + ], + "switch_options": [ + { + "device-id": 0, + "model_json_path": "share/switch/aug_model.json", + "non_default_port_ppgs": 5, + "switchapi_port_add": false + } ] } diff --git a/device/barefoot/x86_64-accton_as9516_32d-r0/platform.json b/device/barefoot/x86_64-accton_as9516_32d-r0/platform.json new file mode 100644 index 000000000000..abd2fec0a303 --- /dev/null +++ b/device/barefoot/x86_64-accton_as9516_32d-r0/platform.json @@ -0,0 +1,687 @@ +{ + "chassis": { + "name": "Newport", + "components": [ + { + "name": "BIOS" + }, + { + "name": "BMC" + } + ], + "thermal_manager": false, + "fans": [ + { + "name": "counter-rotating-fan-1", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-2", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-3", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-4", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-5", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-6", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + } + ], + "fan_drawers": [ + { + "name": "fantray-1", + "status_led": { + "controllable": false + }, + "fans": [ + { + "name": "counter-rotating-fan-1", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-2", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-3", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-4", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-5", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-6", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + } + ] + } + ], + "psus": [ + { + "name": "psu-1", + "temperature": false + }, + { + "name": "psu-2", + "temperature": false + } + ], + "thermals": [ + { + "name": "com_e_driver-i2c-4-33:cpu-temp" + }, + { + "name": "com_e_driver-i2c-4-33:memory-temp" + }, + { + "name": "psu_driver-i2c-7-59:psu2-temp1" + }, + { + "name": "psu_driver-i2c-7-59:psu2-temp2" + }, + { + "name": "psu_driver-i2c-7-59:psu2-temp3" + }, + { + "name": "psu_driver-i2c-7-5a:psu1-temp1" + }, + { + "name": "psu_driver-i2c-7-5a:psu1-temp2" + }, + { + "name": "psu_driver-i2c-7-5a:psu1-temp3" + }, + { + "name": "tmp75-i2c-3-48:chip-temp" + }, + { + "name": "tmp75-i2c-3-49:exhaust2-temp" + }, + { + "name": "tmp75-i2c-3-4a:exhaust-temp" + }, + { + "name": "tmp75-i2c-3-4b:intake-temp" + }, + { + "name": "tmp75-i2c-3-4c:tofino-temp" + }, + { + "name": "tmp75-i2c-3-4d:intake2-temp" + }, + { + "name": "coretemp-isa-0000:package-id-0" + }, + { + "name": "coretemp-isa-0000:core-0" + }, + { + "name": "coretemp-isa-0000:core-1" + }, + { + "name": "coretemp-isa-0000:core-2" + }, + { + "name": "coretemp-isa-0000:core-3" + } + ], + "sfps": [ + { + "name": "sfp1" + }, + { + "name": "sfp2" + }, + { + "name": "sfp3" + }, + { + "name": "sfp4" + }, + { + "name": "sfp5" + }, + { + "name": "sfp6" + }, + { + "name": "sfp7" + }, + { + "name": "sfp8" + }, + { + "name": "sfp9" + }, + { + "name": "sfp10" + }, + { + "name": "sfp11" + }, + { + "name": "sfp12" + }, + { + "name": "sfp13" + }, + { + "name": "sfp14" + }, + { + "name": "sfp15" + }, + { + "name": "sfp16" + }, + { + "name": "sfp17" + }, + { + "name": "sfp18" + }, + { + "name": "sfp19" + }, + { + "name": "sfp20" + }, + { + "name": "sfp21" + }, + { + "name": "sfp22" + }, + { + "name": "sfp23" + }, + { + "name": "sfp24" + }, + { + "name": "sfp25" + }, + { + "name": "sfp26" + }, + { + "name": "sfp27" + }, + { + "name": "sfp28" + }, + { + "name": "sfp29" + }, + { + "name": "sfp30" + }, + { + "name": "sfp31" + }, + { + "name": "sfp32" + } + ] + }, + "interfaces": { + "Ethernet0": { + "index": "1,1,1,1,1,1,1,1", + "lanes": "0,1,2,3,4,5,6,7", + "breakout_modes": { + "1x400G[200G]": ["Ethernet0"], + "2x200G[100G,40G]": ["Ethernet0", "Ethernet4"], + "4x100G[50G]": ["Ethernet0", "Ethernet2", "Ethernet4", "Ethernet6"], + "8x50G[25G,10G]": ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3", "Ethernet4", "Ethernet5", "Ethernet6", "Ethernet7"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet0", "Ethernet4", "Ethernet5", "Ethernet6", "Ethernet7"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet0", "Ethernet1", "Ethernet2", "Ethernet3", "Ethernet4"] + } + }, + "Ethernet8": { + "index": "2,2,2,2,2,2,2,2", + "lanes": "8,9,10,11,12,13,14,15", + "breakout_modes": { + "1x400G[200G]": ["Ethernet8"], + "2x200G[100G,40G]": ["Ethernet8", "Ethernet12"], + "4x100G[50G]": ["Ethernet8", "Ethernet10", "Ethernet12", "Ethernet14"], + "8x50G[25G,10G]": ["Ethernet8", "Ethernet9", "Ethernet10", "Ethernet11", "Ethernet12", "Ethernet13", "Ethernet14", "Ethernet15"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet8", "Ethernet12", "Ethernet13", "Ethernet14", "Ethernet15"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet8", "Ethernet9", "Ethernet10", "Ethernet11", "Ethernet12"] + } + }, + "Ethernet16": { + "index": "3,3,3,3,3,3,3,3", + "lanes": "16,17,18,19,20,21,22,23", + "breakout_modes": { + "1x400G[200G]": ["Ethernet16"], + "2x200G[100G,40G]": ["Ethernet16", "Ethernet20"], + "4x100G[50G]": ["Ethernet16", "Ethernet18", "Ethernet20", "Ethernet22"], + "8x50G[25G,10G]": ["Ethernet16", "Ethernet17", "Ethernet18", "Ethernet19", "Ethernet20", "Ethernet21", "Ethernet22", "Ethernet23"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet16", "Ethernet20", "Ethernet21", "Ethernet22", "Ethernet23"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet16", "Ethernet17", "Ethernet18", "Ethernet19", "Ethernet20"] + } + }, + "Ethernet24": { + "index": "4,4,4,4,4,4,4,4", + "lanes": "24,25,26,27,28,29,30,31", + "breakout_modes": { + "1x400G[200G]": ["Ethernet24"], + "2x200G[100G,40G]": ["Ethernet24", "Ethernet28"], + "4x100G[50G]": ["Ethernet24", "Ethernet26", "Ethernet28", "Ethernet30"], + "8x50G[25G,10G]": ["Ethernet24", "Ethernet25", "Ethernet26", "Ethernet27", "Ethernet28", "Ethernet29", "Ethernet30", "Ethernet31"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet24", "Ethernet28", "Ethernet29", "Ethernet30", "Ethernet31"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet24", "Ethernet25", "Ethernet26", "Ethernet27", "Ethernet28"] + } + }, + "Ethernet32": { + "index": "5,5,5,5,5,5,5,5", + "lanes": "32,33,34,35,36,37,38,39", + "breakout_modes": { + "1x400G[200G]": ["Ethernet32"], + "2x200G[100G,40G]": ["Ethernet32", "Ethernet36"], + "4x100G[50G]": ["Ethernet32", "Ethernet34", "Ethernet36", "Ethernet38"], + "8x50G[25G,10G]": ["Ethernet32", "Ethernet33", "Ethernet34", "Ethernet35", "Ethernet36", "Ethernet37", "Ethernet38", "Ethernet39"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet32", "Ethernet36", "Ethernet37", "Ethernet38", "Ethernet39"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet32", "Ethernet33", "Ethernet34", "Ethernet35", "Ethernet36"] + } + }, + "Ethernet40": { + "index": "6,6,6,6,6,6,6,6", + "lanes": "40,41,42,43,44,45,46,47", + "breakout_modes": { + "1x400G[200G]": ["Ethernet40"], + "2x200G[100G,40G]": ["Ethernet40", "Ethernet44"], + "4x100G[50G]": ["Ethernet40", "Ethernet42", "Ethernet44", "Ethernet46"], + "8x50G[25G,10G]": ["Ethernet40", "Ethernet41", "Ethernet42", "Ethernet43", "Ethernet44", "Ethernet45", "Ethernet46", "Ethernet47"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet40", "Ethernet44", "Ethernet45", "Ethernet46", "Ethernet47"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet40", "Ethernet41", "Ethernet42", "Ethernet43", "Ethernet44"] + } + }, + "Ethernet48": { + "index": "7,7,7,7,7,7,7,7", + "lanes": "48,49,50,51,52,53,54,55", + "breakout_modes": { + "1x400G[200G]": ["Ethernet48"], + "2x200G[100G,40G]": ["Ethernet48", "Ethernet52"], + "4x100G[50G]": ["Ethernet48", "Ethernet50", "Ethernet52", "Ethernet54"], + "8x50G[25G,10G]": ["Ethernet48", "Ethernet49", "Ethernet50", "Ethernet51", "Ethernet52", "Ethernet53", "Ethernet54", "Ethernet55"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet48", "Ethernet52", "Ethernet53", "Ethernet54", "Ethernet55"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet48", "Ethernet49", "Ethernet50", "Ethernet51", "Ethernet52"] + } + }, + "Ethernet56": { + "index": "8,8,8,8,8,8,8,8", + "lanes": "56,57,58,59,60,61,62,63", + "breakout_modes": { + "1x400G[200G]": ["Ethernet56"], + "2x200G[100G,40G]": ["Ethernet56", "Ethernet60"], + "4x100G[50G]": ["Ethernet56", "Ethernet58", "Ethernet60", "Ethernet62"], + "8x50G[25G,10G]": ["Ethernet56", "Ethernet57", "Ethernet58", "Ethernet59", "Ethernet60", "Ethernet61", "Ethernet62", "Ethernet63"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet56", "Ethernet60", "Ethernet61", "Ethernet62", "Ethernet63"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet56", "Ethernet57", "Ethernet58", "Ethernet59", "Ethernet60"] + } + }, + "Ethernet64": { + "index": "9,9,9,9,9,9,9,9", + "lanes": "64,65,66,67,68,69,70,71", + "breakout_modes": { + "1x400G[200G]": ["Ethernet64"], + "2x200G[100G,40G]": ["Ethernet64", "Ethernet68"], + "4x100G[50G]": ["Ethernet64", "Ethernet66", "Ethernet68", "Ethernet70"], + "8x50G[25G,10G]": ["Ethernet64", "Ethernet65", "Ethernet66", "Ethernet67", "Ethernet68", "Ethernet69", "Ethernet70", "Ethernet71"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet64", "Ethernet68", "Ethernet69", "Ethernet70", "Ethernet71"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet64", "Ethernet65", "Ethernet66", "Ethernet67", "Ethernet68"] + } + }, + "Ethernet72": { + "index": "10,10,10,10,10,10,10,10", + "lanes": "72,73,74,75,76,77,78,79", + "breakout_modes": { + "1x400G[200G]": ["Ethernet72"], + "2x200G[100G,40G]": ["Ethernet72", "Ethernet76"], + "4x100G[50G]": ["Ethernet72", "Ethernet74", "Ethernet76", "Ethernet78"], + "8x50G[25G,10G]": ["Ethernet72", "Ethernet73", "Ethernet74", "Ethernet75", "Ethernet76", "Ethernet77", "Ethernet78", "Ethernet79"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet72", "Ethernet76", "Ethernet77", "Ethernet78", "Ethernet79"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet72", "Ethernet73", "Ethernet74", "Ethernet75", "Ethernet76"] + } + }, + "Ethernet80": { + "index": "11,11,11,11,11,11,11,11", + "lanes": "80,81,82,83,84,85,86,87", + "breakout_modes": { + "1x400G[200G]": ["Ethernet80"], + "2x200G[100G,40G]": ["Ethernet80", "Ethernet84"], + "4x100G[50G]": ["Ethernet80", "Ethernet82", "Ethernet84", "Ethernet86"], + "8x50G[25G,10G]": ["Ethernet80", "Ethernet81", "Ethernet82", "Ethernet83", "Ethernet84", "Ethernet85", "Ethernet86", "Ethernet87"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet80", "Ethernet84", "Ethernet85", "Ethernet86", "Ethernet87"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet80", "Ethernet81", "Ethernet82", "Ethernet83", "Ethernet84"] + } + }, + "Ethernet88": { + "index": "12,12,12,12,12,12,12,12", + "lanes": "88,89,90,91,92,93,94,95", + "breakout_modes": { + "1x400G[200G]": ["Ethernet88"], + "2x200G[100G,40G]": ["Ethernet88", "Ethernet92"], + "4x100G[50G]": ["Ethernet88", "Ethernet90", "Ethernet92", "Ethernet94"], + "8x50G[25G,10G]": ["Ethernet88", "Ethernet89", "Ethernet90", "Ethernet91", "Ethernet92", "Ethernet93", "Ethernet94", "Ethernet95"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet88", "Ethernet92", "Ethernet93", "Ethernet94", "Ethernet95"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet88", "Ethernet89", "Ethernet90", "Ethernet91", "Ethernet92"] + } + }, + "Ethernet96": { + "index": "13,13,13,13,13,13,13,13", + "lanes": "96,97,98,99,100,101,102,103", + "breakout_modes": { + "1x400G[200G]": ["Ethernet96"], + "2x200G[100G,40G]": ["Ethernet96", "Ethernet100"], + "4x100G[50G]": ["Ethernet96", "Ethernet98", "Ethernet100", "Ethernet102"], + "8x50G[25G,10G]": ["Ethernet96", "Ethernet97", "Ethernet98", "Ethernet99", "Ethernet100", "Ethernet101", "Ethernet102", "Ethernet103"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet96", "Ethernet100", "Ethernet101", "Ethernet102", "Ethernet103"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet96", "Ethernet97", "Ethernet98", "Ethernet99", "Ethernet100"] + } + }, + "Ethernet104": { + "index": "14,14,14,14,14,14,14,14", + "lanes": "104,105,106,107,108,109,110,111", + "breakout_modes": { + "1x400G[200G]": ["Ethernet104"], + "2x200G[100G,40G]": ["Ethernet104", "Ethernet108"], + "4x100G[50G]": ["Ethernet104", "Ethernet106", "Ethernet108", "Ethernet110"], + "8x50G[25G,10G]": ["Ethernet104", "Ethernet105", "Ethernet106", "Ethernet107", "Ethernet108", "Ethernet109", "Ethernet110", "Ethernet111"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet104", "Ethernet108", "Ethernet109", "Ethernet110", "Ethernet111"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet104", "Ethernet105", "Ethernet106", "Ethernet107", "Ethernet108"] + } + }, + "Ethernet112": { + "index": "15,15,15,15,15,15,15,15", + "lanes": "112,113,114,115,116,117,118,119", + "breakout_modes": { + "1x400G[200G]": ["Ethernet112"], + "2x200G[100G,40G]": ["Ethernet112", "Ethernet116"], + "4x100G[50G]": ["Ethernet112", "Ethernet114", "Ethernet116", "Ethernet118"], + "8x50G[25G,10G]": ["Ethernet112", "Ethernet113", "Ethernet114", "Ethernet115", "Ethernet116", "Ethernet117", "Ethernet118", "Ethernet119"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet112", "Ethernet116", "Ethernet117", "Ethernet118", "Ethernet119"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet112", "Ethernet113", "Ethernet114", "Ethernet115", "Ethernet116"] + } + }, + "Ethernet120": { + "index": "16,16,16,16,16,16,16,16", + "lanes": "120,121,122,123,124,125,126,127", + "breakout_modes": { + "1x400G[200G]": ["Ethernet120"], + "2x200G[100G,40G]": ["Ethernet120", "Ethernet124"], + "4x100G[50G]": ["Ethernet120", "Ethernet122", "Ethernet124", "Ethernet126"], + "8x50G[25G,10G]": ["Ethernet120", "Ethernet121", "Ethernet122", "Ethernet123", "Ethernet124", "Ethernet125", "Ethernet126", "Ethernet127"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet120", "Ethernet124", "Ethernet125", "Ethernet126", "Ethernet127"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet120", "Ethernet121", "Ethernet122", "Ethernet123", "Ethernet124"] + } + }, + "Ethernet128": { + "index": "17,17,17,17,17,17,17,17", + "lanes": "128,129,130,131,132,133,134,135", + "breakout_modes": { + "1x400G[200G]": ["Ethernet128"], + "2x200G[100G,40G]": ["Ethernet128", "Ethernet132"], + "4x100G[50G]": ["Ethernet128", "Ethernet130", "Ethernet132", "Ethernet134"], + "8x50G[25G,10G]": ["Ethernet128", "Ethernet129", "Ethernet130", "Ethernet131", "Ethernet132", "Ethernet133", "Ethernet134", "Ethernet135"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet128", "Ethernet132", "Ethernet133", "Ethernet134", "Ethernet135"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet128", "Ethernet129", "Ethernet130", "Ethernet131", "Ethernet132"] + } + }, + "Ethernet136": { + "index": "18,18,18,18,18,18,18,18", + "lanes": "136,137,138,139,140,141,142,143", + "breakout_modes": { + "1x400G[200G]": ["Ethernet136"], + "2x200G[100G,40G]": ["Ethernet136", "Ethernet140"], + "4x100G[50G]": ["Ethernet136", "Ethernet138", "Ethernet140", "Ethernet142"], + "8x50G[25G,10G]": ["Ethernet136", "Ethernet137", "Ethernet138", "Ethernet139", "Ethernet140", "Ethernet141", "Ethernet142", "Ethernet143"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet136", "Ethernet140", "Ethernet141", "Ethernet142", "Ethernet143"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet136", "Ethernet137", "Ethernet138", "Ethernet139", "Ethernet140"] + } + }, + "Ethernet144": { + "index": "19,19,19,19,19,19,19,19", + "lanes": "144,145,146,147,148,149,150,151", + "breakout_modes": { + "1x400G[200G]": ["Ethernet144"], + "2x200G[100G,40G]": ["Ethernet144", "Ethernet148"], + "4x100G[50G]": ["Ethernet144", "Ethernet146", "Ethernet148", "Ethernet150"], + "8x50G[25G,10G]": ["Ethernet144", "Ethernet145", "Ethernet146", "Ethernet147", "Ethernet148", "Ethernet149", "Ethernet150", "Ethernet151"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet144", "Ethernet148", "Ethernet149", "Ethernet150", "Ethernet151"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet144", "Ethernet145", "Ethernet146", "Ethernet147", "Ethernet148"] + } + }, + "Ethernet152": { + "index": "20,20,20,20,20,20,20,20", + "lanes": "152,153,154,155,156,157,158,159", + "breakout_modes": { + "1x400G[200G]": ["Ethernet152"], + "2x200G[100G,40G]": ["Ethernet152", "Ethernet156"], + "4x100G[50G]": ["Ethernet152", "Ethernet154", "Ethernet156", "Ethernet158"], + "8x50G[25G,10G]": ["Ethernet152", "Ethernet153", "Ethernet154", "Ethernet155", "Ethernet156", "Ethernet157", "Ethernet158", "Ethernet159"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet152", "Ethernet156", "Ethernet157", "Ethernet158", "Ethernet159"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet152", "Ethernet153", "Ethernet154", "Ethernet155", "Ethernet156"] + } + }, + "Ethernet160": { + "index": "21,21,21,21,21,21,21,21", + "lanes": "160,161,162,163,164,165,166,167", + "breakout_modes": { + "1x400G[200G]": ["Ethernet160"], + "2x200G[100G,40G]": ["Ethernet160", "Ethernet164"], + "4x100G[50G]": ["Ethernet160", "Ethernet162", "Ethernet164", "Ethernet166"], + "8x50G[25G,10G]": ["Ethernet160", "Ethernet161", "Ethernet162", "Ethernet163", "Ethernet164", "Ethernet165", "Ethernet166", "Ethernet167"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet160", "Ethernet164", "Ethernet165", "Ethernet166", "Ethernet167"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet160", "Ethernet161", "Ethernet162", "Ethernet163", "Ethernet164"] + } + }, + "Ethernet168": { + "index": "22,22,22,22,22,22,22,22", + "lanes": "168,169,170,171,172,173,174,175", + "breakout_modes": { + "1x400G[200G]": ["Ethernet168"], + "2x200G[100G,40G]": ["Ethernet168", "Ethernet172"], + "4x100G[50G]": ["Ethernet168", "Ethernet170", "Ethernet172", "Ethernet174"], + "8x50G[25G,10G]": ["Ethernet168", "Ethernet169", "Ethernet170", "Ethernet171", "Ethernet172", "Ethernet173", "Ethernet174", "Ethernet175"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet168", "Ethernet172", "Ethernet173", "Ethernet174", "Ethernet175"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet168", "Ethernet169", "Ethernet170", "Ethernet171", "Ethernet172"] + } + }, + "Ethernet176": { + "index": "23,23,23,23,23,23,23,23", + "lanes": "176,177,178,179,180,181,182,183", + "breakout_modes": { + "1x400G[200G]": ["Ethernet176"], + "2x200G[100G,40G]": ["Ethernet176", "Ethernet180"], + "4x100G[50G]": ["Ethernet176", "Ethernet178", "Ethernet180", "Ethernet182"], + "8x50G[25G,10G]": ["Ethernet176", "Ethernet177", "Ethernet178", "Ethernet179", "Ethernet180", "Ethernet181", "Ethernet182", "Ethernet183"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet176", "Ethernet180", "Ethernet181", "Ethernet182", "Ethernet183"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet176", "Ethernet177", "Ethernet178", "Ethernet179", "Ethernet180"] + } + }, + "Ethernet184": { + "index": "24,24,24,24,24,24,24,24", + "lanes": "184,185,186,187,188,189,190,191", + "breakout_modes": { + "1x400G[200G]": ["Ethernet184"], + "2x200G[100G,40G]": ["Ethernet184", "Ethernet188"], + "4x100G[50G]": ["Ethernet184", "Ethernet186", "Ethernet188", "Ethernet190"], + "8x50G[25G,10G]": ["Ethernet184", "Ethernet185", "Ethernet186", "Ethernet187", "Ethernet188", "Ethernet189", "Ethernet190", "Ethernet191"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet184", "Ethernet188", "Ethernet189", "Ethernet190", "Ethernet191"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet184", "Ethernet185", "Ethernet186", "Ethernet187", "Ethernet188"] + } + }, + "Ethernet192": { + "index": "25,25,25,25,25,25,25,25", + "lanes": "192,193,194,195,196,197,198,199", + "breakout_modes": { + "1x400G[200G]": ["Ethernet192"], + "2x200G[100G,40G]": ["Ethernet192", "Ethernet196"], + "4x100G[50G]": ["Ethernet192", "Ethernet194", "Ethernet196", "Ethernet198"], + "8x50G[25G,10G]": ["Ethernet192", "Ethernet193", "Ethernet194", "Ethernet195", "Ethernet196", "Ethernet197", "Ethernet198", "Ethernet199"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet192", "Ethernet196", "Ethernet197", "Ethernet198", "Ethernet199"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet192", "Ethernet193", "Ethernet194", "Ethernet195", "Ethernet196"] + } + }, + "Ethernet200": { + "index": "26,26,26,26,26,26,26,26", + "lanes": "200,201,202,203,204,205,206,207", + "breakout_modes": { + "1x400G[200G]": ["Ethernet200"], + "2x200G[100G,40G]": ["Ethernet200", "Ethernet204"], + "4x100G[50G]": ["Ethernet200", "Ethernet202", "Ethernet204", "Ethernet206"], + "8x50G[25G,10G]": ["Ethernet200", "Ethernet201", "Ethernet202", "Ethernet203", "Ethernet204", "Ethernet205", "Ethernet206", "Ethernet207"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet200", "Ethernet204", "Ethernet205", "Ethernet206", "Ethernet207"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet200", "Ethernet201", "Ethernet202", "Ethernet203", "Ethernet204"] + } + }, + "Ethernet208": { + "index": "27,27,27,27,27,27,27,27", + "lanes": "208,209,210,211,212,213,214,215", + "breakout_modes": { + "1x400G[200G]": ["Ethernet208"], + "2x200G[100G,40G]": ["Ethernet208", "Ethernet212"], + "4x100G[50G]": ["Ethernet208", "Ethernet210", "Ethernet212", "Ethernet214"], + "8x50G[25G,10G]": ["Ethernet208", "Ethernet209", "Ethernet210", "Ethernet211", "Ethernet212", "Ethernet213", "Ethernet214", "Ethernet215"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet208", "Ethernet212", "Ethernet213", "Ethernet214", "Ethernet215"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet208", "Ethernet209", "Ethernet210", "Ethernet211", "Ethernet212"] + } + }, + "Ethernet216": { + "index": "28,28,28,28,28,28,28,28", + "lanes": "216,217,218,219,220,221,222,223", + "breakout_modes": { + "1x400G[200G]": ["Ethernet216"], + "2x200G[100G,40G]": ["Ethernet216", "Ethernet220"], + "4x100G[50G]": ["Ethernet216", "Ethernet218", "Ethernet220", "Ethernet222"], + "8x50G[25G,10G]": ["Ethernet216", "Ethernet217", "Ethernet218", "Ethernet219", "Ethernet220", "Ethernet221", "Ethernet222", "Ethernet223"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet216", "Ethernet220", "Ethernet221", "Ethernet222", "Ethernet223"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet216", "Ethernet217", "Ethernet218", "Ethernet219", "Ethernet220"] + } + }, + "Ethernet224": { + "index": "29,29,29,29,29,29,29,29", + "lanes": "224,225,226,227,228,229,230,231", + "breakout_modes": { + "1x400G[200G]": ["Ethernet224"], + "2x200G[100G,40G]": ["Ethernet224", "Ethernet228"], + "4x100G[50G]": ["Ethernet224", "Ethernet226", "Ethernet228", "Ethernet230"], + "8x50G[25G,10G]": ["Ethernet224", "Ethernet225", "Ethernet226", "Ethernet227", "Ethernet228", "Ethernet229", "Ethernet230", "Ethernet231"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet224", "Ethernet228", "Ethernet229", "Ethernet230", "Ethernet231"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet224", "Ethernet225", "Ethernet226", "Ethernet227", "Ethernet228"] + } + }, + "Ethernet232": { + "index": "30,30,30,30,30,30,30,30", + "lanes": "232,233,234,235,236,237,238,239", + "breakout_modes": { + "1x400G[200G]": ["Ethernet232"], + "2x200G[100G,40G]": ["Ethernet232", "Ethernet236"], + "4x100G[50G]": ["Ethernet232", "Ethernet234", "Ethernet236", "Ethernet238"], + "8x50G[25G,10G]": ["Ethernet232", "Ethernet233", "Ethernet234", "Ethernet235", "Ethernet236", "Ethernet237", "Ethernet238", "Ethernet239"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet232", "Ethernet236", "Ethernet237", "Ethernet238", "Ethernet239"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet232", "Ethernet233", "Ethernet234", "Ethernet235", "Ethernet236"] + } + }, + "Ethernet240": { + "index": "31,31,31,31,31,31,31,31", + "lanes": "240,241,242,243,244,245,246,247", + "breakout_modes": { + "1x400G[200G]": ["Ethernet240"], + "2x200G[100G,40G]": ["Ethernet240", "Ethernet244"], + "4x100G[50G]": ["Ethernet240", "Ethernet242", "Ethernet244", "Ethernet246"], + "8x50G[25G,10G]": ["Ethernet240", "Ethernet241", "Ethernet242", "Ethernet243", "Ethernet244", "Ethernet245", "Ethernet246", "Ethernet247"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet240", "Ethernet244", "Ethernet245", "Ethernet246", "Ethernet247"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet240", "Ethernet241", "Ethernet242", "Ethernet243", "Ethernet244"] + } + }, + "Ethernet248": { + "index": "32,32,32,32,32,32,32,32", + "lanes": "248,249,250,251,252,253,254,255", + "breakout_modes": { + "1x400G[200G]": ["Ethernet248"], + "2x200G[100G,40G]": ["Ethernet248", "Ethernet252"], + "4x100G[50G]": ["Ethernet248", "Ethernet250", "Ethernet252", "Ethernet254"], + "8x50G[25G,10G]": ["Ethernet248", "Ethernet249", "Ethernet250", "Ethernet251", "Ethernet252", "Ethernet253", "Ethernet254", "Ethernet255"], + "1x200G[100G,40G](4)+4x50G[25G,10G](4)": ["Ethernet248", "Ethernet252", "Ethernet253", "Ethernet254", "Ethernet255"], + "4x50G[25G,10G](4)+1x200G[100G,40G](4)": ["Ethernet248", "Ethernet249", "Ethernet250", "Ethernet251", "Ethernet252"] + } + } + } +} diff --git a/device/barefoot/x86_64-accton_as9516_32d-r0/platform_asic b/device/barefoot/x86_64-accton_as9516_32d-r0/platform_asic new file mode 100644 index 000000000000..88d88117928c --- /dev/null +++ b/device/barefoot/x86_64-accton_as9516_32d-r0/platform_asic @@ -0,0 +1 @@ +barefoot diff --git a/device/barefoot/x86_64-accton_as9516_32d-r0/platform_components.json b/device/barefoot/x86_64-accton_as9516_32d-r0/platform_components.json index 43874566a3ad..118079de4696 100644 --- a/device/barefoot/x86_64-accton_as9516_32d-r0/platform_components.json +++ b/device/barefoot/x86_64-accton_as9516_32d-r0/platform_components.json @@ -1,8 +1,10 @@ -{ - "chassis": { - "Newport": { - "component": { - } - } - } +{ + "chassis": { + "Newport": { + "component": { + "BIOS": { }, + "BMC": { } + } + } + } } \ No newline at end of file diff --git a/device/barefoot/x86_64-accton_as9516_32d-r0/pmon_daemon_control.json b/device/barefoot/x86_64-accton_as9516_32d-r0/pmon_daemon_control.json index 1059cddb4fa2..a0431d47812a 100644 --- a/device/barefoot/x86_64-accton_as9516_32d-r0/pmon_daemon_control.json +++ b/device/barefoot/x86_64-accton_as9516_32d-r0/pmon_daemon_control.json @@ -4,6 +4,6 @@ "skip_thermalctld": false, "skip_ledd": true, "skip_xcvrd": false, - "skip_psud": true, + "skip_psud": false, "skip_syseepromd": false } diff --git a/device/barefoot/x86_64-accton_as9516_32d-r0/system_health_monitoring_config.json b/device/barefoot/x86_64-accton_as9516_32d-r0/system_health_monitoring_config.json new file mode 100644 index 000000000000..654d43d81096 --- /dev/null +++ b/device/barefoot/x86_64-accton_as9516_32d-r0/system_health_monitoring_config.json @@ -0,0 +1,11 @@ +{ + "services_to_ignore": [], + "devices_to_ignore": [], + "user_defined_checkers": [], + "polling_interval": 60, + "led_color": { + "fault": "amber", + "normal": "green", + "booting": "orange_blink" + } +} diff --git a/device/barefoot/x86_64-accton_as9516_32d-r0/thermal_thresholds.json b/device/barefoot/x86_64-accton_as9516_32d-r0/thermal_thresholds.json new file mode 100644 index 000000000000..451067eb603c --- /dev/null +++ b/device/barefoot/x86_64-accton_as9516_32d-r0/thermal_thresholds.json @@ -0,0 +1,61 @@ +{ + "thermals": [ + { + "com_e_driver-i2c-4-33:cpu-temp" : [99.0, 89.0, 11.0, 1.0] + }, + { + "com_e_driver-i2c-4-33:memory-temp" : [85.0, 75.0, 11.0, 1.0] + }, + { + "tmp75-i2c-3-48:chip-temp" : [90.0, 80.0, 11.0, 1.0] + }, + { + "tmp75-i2c-3-49:exhaust2-temp" : [80.0, 70.0, 11.0, 1.0] + }, + { + "tmp75-i2c-3-4a:exhaust-temp" : [60.0, 50.0, 11.0, 1.0] + }, + { + "tmp75-i2c-3-4b:intake-temp" : [60.0, 50.0, 11.0, 1.0] + }, + { + "tmp75-i2c-3-4c:tofino-temp" : [99.0, 89.0, 11.0, 1.0] + }, + { + "tmp75-i2c-3-4d:intake2-temp" : [60.0, 50.0, 11.0, 1.0] + }, + { + "coretemp-isa-0000:package-id-0" : [80.0, 70.0, 11.0, 1.0] + }, + { + "coretemp-isa-0000:core-0" : [99.0, 89.0, 11.0, 1.0] + }, + { + "coretemp-isa-0000:core-1" : [99.0, 89.0, 11.0, 1.0] + }, + { + "coretemp-isa-0000:core-2" : [99.0, 89.0, 11.0, 1.0] + }, + { + "coretemp-isa-0000:core-3" : [99.0, 89.0, 11.0, 1.0] + }, + { + "psu_driver-i2c-7-59:psu2-temp1" : [60.0, 50.0, 11.0, 1.0] + }, + { + "psu_driver-i2c-7-59:psu2-temp2" : [60.0, 50.0, 11.0, 1.0] + }, + { + "psu_driver-i2c-7-59:psu2-temp3" : [60.0, 50.0, 11.0, 1.0] + }, + { + "psu_driver-i2c-7-5a:psu1-temp1" : [60.0, 50.0, 11.0, 1.0] + }, + { + "psu_driver-i2c-7-5a:psu1-temp2" : [60.0, 50.0, 11.0, 1.0] + }, + { + "psu_driver-i2c-7-5a:psu1-temp3" : [60.0, 50.0, 11.0, 1.0] + } + ] +} \ No newline at end of file diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/switch-sai.conf b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/switch-sai.conf deleted file mode 100644 index fc224c9602e4..000000000000 --- a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/switch-sai.conf +++ /dev/null @@ -1,34 +0,0 @@ -{ - "chip_list": [ - { - "id": "asic-0", - "chip_family": "Tofino", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" - } - ], - "instance": 0, - "p4_program_list": [ - { - "id": "pgm-0", - "instance": 0, - "path": "switch", - "program-name": "switch", - "pd": "lib/tofinopd/switch/libpd.so", - "pd-thrift": "lib/tofinopd/switch/libpdthrift.so", - "table-config": "share/tofinopd/switch/context.json", - "tofino-bin": "share/tofinopd/switch/tofino.bin", - "switchapi": "lib/libswitchapi.so", - "sai": "lib/libsai.so", - "agent0": "lib/platform/x86_64-accton_wedge100bf_32x-r0/libpltfm_mgr.so", - "switchapi_port_add": false, - "non_default_port_ppgs": 5 - } - ] -} diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/switch-tna-sai.conf b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/switch-tna-sai.conf index 085a1b8dcdfc..dc6f78e0b1e7 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/switch-tna-sai.conf +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/switch-tna-sai.conf @@ -1,17 +1,9 @@ { - "instance": 0, "chip_list": [ { - "id": "asic-0", "chip_family": "Tofino", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + "sds_fw_path": "share/tofino_sds_fw/avago/firmware", + "instance": 0 } ], "p4_devices": [ @@ -28,7 +20,6 @@ } ], "program-name": "switch", - "sai": "lib/libsai.so", "bfrt-config": "share/switch/bf-rt.json", "model_json_path" : "share/switch/aug_model.json", "switchapi_port_add": false, @@ -36,5 +27,13 @@ } ] } + ], + "switch_options": [ + { + "device-id": 0, + "model_json_path": "share/switch/aug_model.json", + "non_default_port_ppgs": 5, + "switchapi_port_add": false + } ] } diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform.json b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform.json index b7f3756b1be1..5fee4f0eebaf 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform.json +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform.json @@ -1,4 +1,222 @@ { + "chassis": { + "name": "Wedge100BF-32X-O-AC-F-BF", + "components": [ + { + "name": "BIOS" + }, + { + "name": "BMC" + } + ], + "fans": [ + { + "name": "counter-rotating-fan-1" + }, + { + "name": "counter-rotating-fan-2" + }, + { + "name": "counter-rotating-fan-3" + }, + { + "name": "counter-rotating-fan-4" + }, + { + "name": "counter-rotating-fan-5" + } + ], + "fan_drawers": [ + { + "name": "fantray-1", + "fans": [ + { + "name": "counter-rotating-fan-1" + }, + { + "name": "counter-rotating-fan-2" + }, + { + "name": "counter-rotating-fan-3" + }, + { + "name": "counter-rotating-fan-4" + }, + { + "name": "counter-rotating-fan-5" + } + ] + } + ], + "psus": [ + { + "name": "psu-1" + }, + { + "name": "psu-2" + } + ], + "thermals": [ + { + "name": "com_e_driver-i2c-4-33:cpu-temp" + }, + { + "name": "com_e_driver-i2c-4-33:memory-temp" + }, + { + "name": "psu_driver-i2c-7-59:psu2-temp1" + }, + { + "name": "psu_driver-i2c-7-59:psu2-temp2" + }, + { + "name": "psu_driver-i2c-7-5a:psu1-temp1" + }, + { + "name": "psu_driver-i2c-7-5a:psu1-temp2" + }, + { + "name": "tmp75-i2c-3-48:chip-temp" + }, + { + "name": "tmp75-i2c-3-49:exhaust2-temp" + }, + { + "name": "tmp75-i2c-3-4a:exhaust-temp" + }, + { + "name": "tmp75-i2c-3-4b:intake-temp" + }, + { + "name": "tmp75-i2c-3-4c:tofino-temp" + }, + { + "name": "tmp75-i2c-3-4d:intake2-temp" + }, + { + "name": "tmp75-i2c-8-48:outlet-right-temp" + }, + { + "name": "tmp75-i2c-8-49:outlet-left-temp" + }, + { + "name": "pch_haswell-virtual-0:temp1" + }, + { + "name": "coretemp-isa-0000:package-id-0" + }, + { + "name": "coretemp-isa-0000:core-0" + }, + { + "name": "coretemp-isa-0000:core-1" + }, + { + "name": "coretemp-isa-0000:core-2" + }, + { + "name": "coretemp-isa-0000:core-3" + } + ], + "sfps": [ + { + "name": "sfp1" + }, + { + "name": "sfp2" + }, + { + "name": "sfp3" + }, + { + "name": "sfp4" + }, + { + "name": "sfp5" + }, + { + "name": "sfp6" + }, + { + "name": "sfp7" + }, + { + "name": "sfp8" + }, + { + "name": "sfp9" + }, + { + "name": "sfp10" + }, + { + "name": "sfp11" + }, + { + "name": "sfp12" + }, + { + "name": "sfp13" + }, + { + "name": "sfp14" + }, + { + "name": "sfp15" + }, + { + "name": "sfp16" + }, + { + "name": "sfp17" + }, + { + "name": "sfp18" + }, + { + "name": "sfp19" + }, + { + "name": "sfp20" + }, + { + "name": "sfp21" + }, + { + "name": "sfp22" + }, + { + "name": "sfp23" + }, + { + "name": "sfp24" + }, + { + "name": "sfp25" + }, + { + "name": "sfp26" + }, + { + "name": "sfp27" + }, + { + "name": "sfp28" + }, + { + "name": "sfp29" + }, + { + "name": "sfp30" + }, + { + "name": "sfp31" + }, + { + "name": "sfp32" + } + ] + }, "interfaces": { "Ethernet0": { "index": "1,1,1,1", diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform_asic b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform_asic new file mode 100644 index 000000000000..88d88117928c --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform_asic @@ -0,0 +1 @@ +barefoot diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform_components.json b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform_components.json index df77fa3e1bf9..30befc827a9e 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform_components.json +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform_components.json @@ -1,8 +1,10 @@ -{ - "chassis": { - "Wedge100BF-32X-O-AC-F-BF": { - "component": { - } - } - } +{ + "chassis": { + "Wedge100BF-32X-O-AC-F-BF": { + "component": { + "BIOS": { }, + "BMC": { } + } + } + } } \ No newline at end of file diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/system_health_monitoring_config.json b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/system_health_monitoring_config.json new file mode 100644 index 000000000000..654d43d81096 --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/system_health_monitoring_config.json @@ -0,0 +1,11 @@ +{ + "services_to_ignore": [], + "devices_to_ignore": [], + "user_defined_checkers": [], + "polling_interval": 60, + "led_color": { + "fault": "amber", + "normal": "green", + "booting": "orange_blink" + } +} diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/thermal_thresholds.json b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/thermal_thresholds.json new file mode 100644 index 000000000000..bee961a84411 --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/thermal_thresholds.json @@ -0,0 +1,64 @@ +{ + "thermals": [ + { + "com_e_driver-i2c-4-33:cpu-temp" : [99.0, 89.0, 11.0, 1.0] + }, + { + "com_e_driver-i2c-4-33:memory-temp" : [85.0, 75.0, 11.0, 1.0] + }, + { + "psu_driver-i2c-7-59:psu2-temp1" : [50.0, 40.0, 11.0, 1.0] + }, + { + "psu_driver-i2c-7-59:psu2-temp2" : [90.0, 80.0, 11.0, 1.0] + }, + { + "psu_driver-i2c-7-5a:psu1-temp1" : [50.0, 40.0, 11.0, 1.0] + }, + { + "psu_driver-i2c-7-5a:psu1-temp2" : [90.0, 80.0, 11.0, 1.0] + }, + { + "tmp75-i2c-3-48:chip-temp" : [90.0, 80.0, 11.0, 1.0] + }, + { + "tmp75-i2c-3-49:exhaust2-temp" : [80.0, 70.0, 11.0, 1.0] + }, + { + "tmp75-i2c-3-4a:exhaust-temp" : [60.0, 50.0, 11.0, 1.0] + }, + { + "tmp75-i2c-3-4b:intake-temp" : [60.0, 50.0, 11.0, 1.0] + }, + { + "tmp75-i2c-3-4c:tofino-temp" : [99.0, 89.0, 11.0, 1.0] + }, + { + "tmp75-i2c-3-4d:intake2-temp" : [60.0, 50.0, 11.0, 1.0] + }, + { + "tmp75-i2c-8-48:outlet-right-temp" : [60.0, 50.0, 11.0, 1.0] + }, + { + "tmp75-i2c-8-49:outlet-left-temp" : [60.0, 50.0, 11.0, 1.0] + }, + { + "pch_haswell-virtual-0:temp1" : [60.0, 50.0, 11.0, 1.0] + }, + { + "coretemp-isa-0000:package-id-0" : [80.0, 70.0, 11.0, 1.0] + }, + { + "coretemp-isa-0000:core-0" : [99.0, 89.0, 11.0, 1.0] + }, + { + "coretemp-isa-0000:core-1" : [99.0, 89.0, 11.0, 1.0] + }, + { + "coretemp-isa-0000:core-2" : [99.0, 89.0, 11.0, 1.0] + }, + { + "coretemp-isa-0000:core-3" : [99.0, 89.0, 11.0, 1.0] + } + ] +} \ No newline at end of file diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/switch-sai.conf b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/switch-sai.conf deleted file mode 100644 index 81a7d7bc28c3..000000000000 --- a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/switch-sai.conf +++ /dev/null @@ -1,34 +0,0 @@ -{ - "chip_list": [ - { - "id": "asic-0", - "chip_family": "Tofino", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" - } - ], - "instance": 0, - "p4_program_list": [ - { - "id": "pgm-0", - "instance": 0, - "path": "switch", - "program-name": "switch", - "pd": "lib/tofinopd/switch/libpd.so", - "pd-thrift": "lib/tofinopd/switch/libpdthrift.so", - "table-config": "share/tofinopd/switch/context.json", - "tofino-bin": "share/tofinopd/switch/tofino.bin", - "switchapi": "lib/libswitchapi.so", - "sai": "lib/libsai.so", - "agent0": "lib/platform/x86_64-accton_wedge100bf_65x-r0/libpltfm_mgr.so", - "switchapi_port_add": false, - "non_default_port_ppgs": 5 - } - ] -} diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/switch-tna-sai.conf b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/switch-tna-sai.conf index ddcb9d4ba287..e07192619af0 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/switch-tna-sai.conf +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/switch-tna-sai.conf @@ -1,17 +1,9 @@ { - "instance": 0, "chip_list": [ { - "id": "asic-0", "chip_family": "Tofino", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + "sds_fw_path": "share/tofino_sds_fw/avago/firmware", + "instance": 0 } ], "p4_devices": [ @@ -28,7 +20,6 @@ } ], "program-name": "switch", - "sai": "lib/libsai.so", "bfrt-config": "share/switch/bf-rt.json", "model_json_path" : "share/switch/aug_model.json", "switchapi_port_add": false, @@ -36,5 +27,13 @@ } ] } + ], + "switch_options": [ + { + "device-id": 0, + "model_json_path": "share/switch/aug_model.json", + "non_default_port_ppgs": 5, + "switchapi_port_add": false + } ] } diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/platform.json b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/platform.json index a2394135c0fc..73bb6008dbba 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/platform.json +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/platform.json @@ -1,4 +1,89 @@ { + "chassis": { + "name": "Mavericks", + "fans": [ + { + "name": "counter-rotating-fan-1" + }, + { + "name": "counter-rotating-fan-2" + }, + { + "name": "counter-rotating-fan-3" + }, + { + "name": "counter-rotating-fan-4" + }, + { + "name": "counter-rotating-fan-5" + }, + { + "name": "counter-rotating-fan-6" + }, + { + "name": "counter-rotating-fan-7" + }, + { + "name": "counter-rotating-fan-8" + }, + { + "name": "counter-rotating-fan-9" + }, + { + "name": "counter-rotating-fan-10" + } + ], + "fan_drawers": [ + { + "name": "fantray-1", + "fans": [ + { + "name": "counter-rotating-fan-1" + }, + { + "name": "counter-rotating-fan-2" + }, + { + "name": "counter-rotating-fan-3" + }, + { + "name": "counter-rotating-fan-4" + }, + { + "name": "counter-rotating-fan-5" + } + ] + }, + { + "name": "fantray-2", + "fans": [ + { + "name": "counter-rotating-fan-6" + }, + { + "name": "counter-rotating-fan-7" + }, + { + "name": "counter-rotating-fan-8" + }, + { + "name": "counter-rotating-fan-9" + }, + { + "name": "counter-rotating-fan-10" + } + ] + } + ] + }, + "psus": [ + { + "name": "psu-1" + }, + { + "name": "psu-2" + } + ], "interfaces": { "Ethernet0": { "index": "1,1,1,1", diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/platform_asic b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/platform_asic new file mode 100644 index 000000000000..88d88117928c --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/platform_asic @@ -0,0 +1 @@ +barefoot diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/system_health_monitoring_config.json b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/system_health_monitoring_config.json new file mode 100644 index 000000000000..654d43d81096 --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/system_health_monitoring_config.json @@ -0,0 +1,11 @@ +{ + "services_to_ignore": [], + "devices_to_ignore": [], + "user_defined_checkers": [], + "polling_interval": 60, + "led_color": { + "fault": "amber", + "normal": "green", + "booting": "orange_blink" + } +} diff --git a/device/broadcom/x86_64-bcm_xlr-r0/BCM956960K/th_32x100.config.bcm b/device/broadcom/x86_64-bcm_xlr-r0/BCM956960K/th_32x100.config.bcm index 772db95d7f34..c394602bda19 100644 --- a/device/broadcom/x86_64-bcm_xlr-r0/BCM956960K/th_32x100.config.bcm +++ b/device/broadcom/x86_64-bcm_xlr-r0/BCM956960K/th_32x100.config.bcm @@ -1,6 +1,9 @@ # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + portmap_1=1:100 portmap_2=5:100 portmap_3=9:100 diff --git a/device/broadcom/x86_64-bcm_xlr-r0/platform_asic b/device/broadcom/x86_64-bcm_xlr-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/broadcom/x86_64-bcm_xlr-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/broadcom/x86_64-broadcom_common/platform_asic b/device/broadcom/x86_64-broadcom_common/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/broadcom/x86_64-broadcom_common/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/celestica/x86_64-cel_e1031-r0/Celestica-E1031-T48S4/helix4-e1031-48x1G+4x10G.config.bcm b/device/celestica/x86_64-cel_e1031-r0/Celestica-E1031-T48S4/helix4-e1031-48x1G+4x10G.config.bcm index e7272ea9d12a..02d785aa4cb0 100644 --- a/device/celestica/x86_64-cel_e1031-r0/Celestica-E1031-T48S4/helix4-e1031-48x1G+4x10G.config.bcm +++ b/device/celestica/x86_64-cel_e1031-r0/Celestica-E1031-T48S4/helix4-e1031-48x1G+4x10G.config.bcm @@ -1,3 +1,6 @@ +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 diff --git a/device/celestica/x86_64-cel_e1031-r0/platform.json b/device/celestica/x86_64-cel_e1031-r0/platform.json index 0e4656feae60..a0a174c66a80 100644 --- a/device/celestica/x86_64-cel_e1031-r0/platform.json +++ b/device/celestica/x86_64-cel_e1031-r0/platform.json @@ -1,6 +1,10 @@ { "chassis": { "name": "Celestica-E1031-T48S4", + "status_led": { + "controllable": true, + "colors": ["green", "amber","off"] + }, "components": [ { "name": "SMC_CPLD" @@ -14,37 +18,100 @@ ], "fans": [ { - "name": "FAN-1" - }, - { - "name": "FAN-2" - }, - { - "name": "FAN-3" + "name": "FAN-1", + "speed": { + "controllable": false + }, + "status_led": { + "controllable": true, + "colors": ["green", "amber","off"] + } + }, + { + "name": "FAN-2", + "speed": { + "controllable": false + }, + "status_led": { + "controllable": true, + "colors": ["green", "amber","off"] + } + }, + { + "name": "FAN-3", + "speed": { + "controllable": false + }, + "status_led": { + "controllable": true, + "colors": ["green", "amber","off"] + } } ], "fan_drawers": [ { "name": "Drawer1", + "speed": { + "controllable": false + }, + "status_led": { + "controllable": true, + "colors": ["green", "amber","off"] + }, "fans": [ { - "name": "FAN-1" + "name": "FAN-1", + "speed": { + "controllable": false + }, + "status_led": { + "controllable": true, + "colors": ["green", "amber","off"] + } } ] }, { "name": "Drawer2", + "speed": { + "controllable": false + }, + "status_led": { + "controllable": true, + "colors": ["green", "amber","off"] + }, "fans": [ { - "name": "FAN-2" + "name": "FAN-2", + "speed": { + "controllable": false + }, + "status_led": { + "controllable": true, + "colors": ["green", "amber","off"] + } } ] }, { "name": "Drawer3", + "speed": { + "controllable": false + }, + "status_led": { + "controllable": true, + "colors": ["green", "amber","off"] + }, "fans": [ { - "name": "FAN-3" + "name": "FAN-3", + "speed": { + "controllable": false + }, + "status_led": { + "controllable": true, + "colors": ["green", "amber","off"] + } } ] } @@ -54,40 +121,79 @@ "name": "PSU-R", "fans": [ { - "name": "PSU-1 FAN-1" + "name": "PSU-1 FAN-1", + "speed": { + "controllable": false + }, + "status_led": { + "controllable": false + } } - ] + ], + "status_led": { + "controllable": false + } }, { "name": "PSU-L", "fans": [ { - "name": "PSU-2 FAN-1" + "name": "PSU-2 FAN-1", + "speed": { + "controllable": false + }, + "status_led": { + "controllable": false + } } - ] + ], + "status_led": { + "controllable": false + } } ], "thermals": [ { - "name": "Inlet ambient sensor (Rear to Front)" + "name": "Inlet ambient sensor (Rear to Front)", + "controllable": false, + "low-threshold": false, + "low-crit-threshold": false }, { - "name": "Helix shutdown sensor (Rear to Front)" + "name": "Helix shutdown sensor (Rear to Front)", + "controllable": false, + "low-threshold": false, + "low-crit-threshold": false }, { - "name": "Inlet ambient sensor (Front to Rear, right)" + "name": "Inlet ambient sensor (Front to Rear, right)", + "controllable": false, + "low-threshold": false, + "low-crit-threshold": false }, { - "name": "Helix shutdown sensor (Front to Rear)" + "name": "Helix shutdown sensor (Front to Rear)", + "controllable": false, + "low-threshold": false, + "low-crit-threshold": false }, { - "name": "Inlet ambient sensor (Front to Rear, left)" + "name": "Inlet ambient sensor (Front to Rear, left)", + "controllable": false, + "low-threshold": false, + "low-crit-threshold": false }, { - "name": "CPU errata sensor (Front to Rear)" + "name": "CPU errata sensor (Front to Rear)", + "controllable": false, + "low-threshold": false, + "low-crit-threshold": false }, { - "name": "CPU errata sensor (Rear to Front)" + "name": "CPU errata sensor (Rear to Front)", + "controllable": false, + "low-threshold": false, + "low-crit-threshold": false } ], "sfps": [ diff --git a/device/celestica/x86_64-cel_e1031-r0/platform_asic b/device/celestica/x86_64-cel_e1031-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/celestica/x86_64-cel_e1031-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/eeprom.py b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/eeprom.py index dc43a4d7ddda..48643b403071 100644 --- a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/eeprom.py +++ b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/eeprom.py @@ -45,7 +45,7 @@ def __parse_output(self, decode_output): for line in lines: try: match = re.search( - '(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)([\S]+)', line) + '(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)(.*$)', line) if match is not None: idx = match.group(1) value = match.group(3).rstrip('\0') diff --git a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/sfp.py b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/sfp.py index c0187819ec2c..e04c23dc42de 100644 --- a/device/celestica/x86_64-cel_e1031-r0/sonic_platform/sfp.py +++ b/device/celestica/x86_64-cel_e1031-r0/sonic_platform/sfp.py @@ -194,7 +194,7 @@ def __init__(self, sfp_index, sfp_name): self.port_to_eeprom_mapping[x] = eeprom_path.format( self.port_to_i2c_mapping[x]) - self.info_dict_keys = ['type', 'hardware_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', + self.info_dict_keys = ['type', 'vendor_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', 'vendor_date', 'vendor_oui', "application_advertisement", "type_abbrv_name"] @@ -364,7 +364,7 @@ def get_transceiver_info(self): keys |Value Format |Information ---------------------------|---------------|---------------------------- type |1*255VCHAR |type of SFP - hardware_rev |1*255VCHAR |hardware version of SFP + vendor_rev |1*255VCHAR |vendor revision of SFP serial |1*255VCHAR |serial number of the SFP manufacturer |1*255VCHAR |SFP vendor name model |1*255VCHAR |SFP model name @@ -438,7 +438,7 @@ def get_transceiver_info(self): transceiver_info_dict['type'] = sfp_type_data['data']['type']['value'] transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] transceiver_info_dict['vendor_oui'] = 'N/A' transceiver_info_dict['vendor_date'] = 'N/A' @@ -515,7 +515,7 @@ def get_transceiver_info(self): transceiver_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value'] transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] transceiver_info_dict['vendor_date'] = sfp_vendor_date_data[ diff --git a/device/celestica/x86_64-cel_midstone-r0/platform_asic b/device/celestica/x86_64-cel_midstone-r0/platform_asic new file mode 100644 index 000000000000..84083a7415d9 --- /dev/null +++ b/device/celestica/x86_64-cel_midstone-r0/platform_asic @@ -0,0 +1 @@ +innovium diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/th-seastone-dx010-32x100G-t0.config.bcm b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/th-seastone-dx010-32x100G-t0.config.bcm index f05fabce5822..f3a381563349 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/th-seastone-dx010-32x100G-t0.config.bcm +++ b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/th-seastone-dx010-32x100G-t0.config.bcm @@ -17,6 +17,9 @@ l3_alpm_enable=2 ipv6_lpm_128b_enable=1 mmu_lossless=0 +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/th-seastone-dx010-32x100G-t1.config.bcm b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/th-seastone-dx010-32x100G-t1.config.bcm index 96c03d184a0c..c3c755f4e446 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/th-seastone-dx010-32x100G-t1.config.bcm +++ b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-C32/th-seastone-dx010-32x100G-t1.config.bcm @@ -17,6 +17,9 @@ l3_alpm_enable=2 ipv6_lpm_128b_enable=1 mmu_lossless=0 +# Disable bcmALPMDH (ALPM distributed hitbit) thread that is used for debug only +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 diff --git a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/th-seastone-dx010-48x50G+8x100G.config.bcm b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/th-seastone-dx010-48x50G+8x100G.config.bcm index b848052c6511..2cb58079f423 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/th-seastone-dx010-48x50G+8x100G.config.bcm +++ b/device/celestica/x86_64-cel_seastone-r0/Celestica-DX010-D48C8/th-seastone-dx010-48x50G+8x100G.config.bcm @@ -1,3 +1,6 @@ +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 diff --git a/device/celestica/x86_64-cel_seastone-r0/platform_asic b/device/celestica/x86_64-cel_seastone-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/eeprom.py b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/eeprom.py index b0d37d57beac..bfde69c8d296 100644 --- a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/eeprom.py +++ b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/eeprom.py @@ -44,7 +44,7 @@ def __parse_output(self, decode_output): for line in lines: try: match = re.search( - '(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)([\S]+)', line) + '(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)(.*$)', line) if match is not None: idx = match.group(1) value = match.group(3).rstrip('\0') diff --git a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/sfp.py b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/sfp.py index c1423ed8dc7d..a90c82b50fcb 100644 --- a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/sfp.py +++ b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/sfp.py @@ -204,7 +204,7 @@ ) info_dict_keys = [ - 'type', 'hardware_rev', 'serial', 'manufacturer', + 'type', 'vendor_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', 'vendor_date', @@ -532,7 +532,7 @@ def get_transceiver_info(self): keys |Value Format |Information ---------------------------|---------------|---------------------------- type |1*255VCHAR |type of SFP - hardware_rev |1*255VCHAR |hardware version of SFP + vendor_rev |1*255VCHAR |vendor revision of SFP serial |1*255VCHAR |serial number of the SFP manufacturer |1*255VCHAR |SFP vendor name model |1*255VCHAR |SFP model name @@ -608,7 +608,7 @@ def get_transceiver_info(self): transceiver_info_dict['type'] = sfp_type_data['data']['type']['value'] transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] elif self.sfp_type == QSFP_TYPE: @@ -751,7 +751,7 @@ def get_transceiver_info(self): sfp_vendor_name_data['data']['Vendor Name']['value']) transceiver_info_dict['model'] = str( sfp_vendor_pn_data['data']['Vendor PN']['value']) - transceiver_info_dict['hardware_rev'] = str( + transceiver_info_dict['vendor_rev'] = str( sfp_vendor_rev_data['data']['Vendor Rev']['value']) transceiver_info_dict['serial'] = str( sfp_vendor_sn_data['data']['Vendor SN']['value']) @@ -826,7 +826,7 @@ def get_transceiver_info(self): transceiver_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value'] transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] transceiver_info_dict['vendor_date'] = sfp_vendor_date_data[ diff --git a/device/celestica/x86_64-cel_seastone-r0/th-seastone-dx010-config-flex-all.bcm b/device/celestica/x86_64-cel_seastone-r0/th-seastone-dx010-config-flex-all.bcm index ed5c1b6d9b19..00af55358fbd 100644 --- a/device/celestica/x86_64-cel_seastone-r0/th-seastone-dx010-config-flex-all.bcm +++ b/device/celestica/x86_64-cel_seastone-r0/th-seastone-dx010-config-flex-all.bcm @@ -19,6 +19,9 @@ ipv6_lpm_128b_enable=1 #Use MMU lossy configuration mmu_lossless=0 +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 diff --git a/device/celestica/x86_64-cel_seastone_2-r0/Seastone_2/td3-seastone_2-32x100G.config.bcm b/device/celestica/x86_64-cel_seastone_2-r0/Seastone_2/td3-seastone_2-32x100G.config.bcm index a7ee4a93ea04..d9d2f47750d9 100644 --- a/device/celestica/x86_64-cel_seastone_2-r0/Seastone_2/td3-seastone_2-32x100G.config.bcm +++ b/device/celestica/x86_64-cel_seastone_2-r0/Seastone_2/td3-seastone_2-32x100G.config.bcm @@ -1,4 +1,4 @@ -sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_issu/b870.6.4.1/ +sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ help_cli_enable=1 ifp_inports_support_enable=1 ipv6_lpm_128b_enable=0x1 diff --git a/device/celestica/x86_64-cel_seastone_2-r0/led_proc_init.soc b/device/celestica/x86_64-cel_seastone_2-r0/led_proc_init.soc index a47644c032e1..b6b474bd53d6 100644 --- a/device/celestica/x86_64-cel_seastone_2-r0/led_proc_init.soc +++ b/device/celestica/x86_64-cel_seastone_2-r0/led_proc_init.soc @@ -1,9 +1,5 @@ -#Enable all ports -port all en=1 -sleep 6 -#linkscan 250000; port xe,ce linkscan=on - -#Load LED +linkscan off +m0 load 0 0x3800 /usr/share/sonic/platform/custom.bin +sleep 10 led auto on; led start - - +linkscan on diff --git a/device/celestica/x86_64-cel_seastone_2-r0/platform_asic b/device/celestica/x86_64-cel_seastone_2-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/celestica/x86_64-cel_seastone_2-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/celestica/x86_64-cel_seastone_2-r0/plugins/sfputil.py b/device/celestica/x86_64-cel_seastone_2-r0/plugins/sfputil.py index 6f05527621fe..88c4d9a26e88 100755 --- a/device/celestica/x86_64-cel_seastone_2-r0/plugins/sfputil.py +++ b/device/celestica/x86_64-cel_seastone_2-r0/plugins/sfputil.py @@ -47,16 +47,16 @@ def get_port_name(self, port_num): if port_num in self.qsfp_ports: self._port_name = "QSFP" + str(port_num - self.QSFP_PORT_START + 1) else: - self._port_name = "SFP" + str(port_num) + self._port_name = "SFP" + str(port_num - self.QSFP_PORT_END) return self._port_name - # def get_eeprom_dom_raw(self, port_num): - # if port_num in self.qsfp_ports: - # # QSFP DOM EEPROM is also at addr 0x50 and thus also stored in eeprom_ifraw - # return None - # else: - # # Read dom eeprom at addr 0x51 - # return self._read_eeprom_devid(port_num, self.DOM_EEPROM_ADDR, 256) + def get_eeprom_dom_raw(self, port_num): + if port_num in self.qsfp_ports: + # QSFP DOM EEPROM is also at addr 0x50 and thus also stored in eeprom_ifraw + return None + else: + # Read dom eeprom as offset 0x100 on optoe eeprom + return self._read_eeprom_devid(port_num, self.DOM_EEPROM_ADDR, 256) def __init__(self): # Override port_to_eeprom_mapping for class initialization diff --git a/device/celestica/x86_64-cel_seastone_2-r0/sonic_platform_config/event.py b/device/celestica/x86_64-cel_seastone_2-r0/sonic_platform_config/event.py index ed3b78cf7fd6..32073479a1e6 100644 --- a/device/celestica/x86_64-cel_seastone_2-r0/sonic_platform_config/event.py +++ b/device/celestica/x86_64-cel_seastone_2-r0/sonic_platform_config/event.py @@ -38,9 +38,14 @@ def _initialize_interrupts(self): for index in range(self.num_sfp): port_num = index + 1 - port_name = "QSFP{}".format(port_num) - port_type = "qsfp" - sysfs_prs_file = "{}_modprs".format(port_type) + if port_num <= 32: + port_name = "QSFP{}".format(port_num) + port_type = "qsfp" + sysfs_prs_file = "{}_modprs".format(port_type) + else: + port_name = "SFP{}".format(port_num - 32) + port_type = "sfp" + sysfs_prs_file = "{}_modabs".format(port_type) sfp_info_obj[index] = {} sfp_info_obj[index]['intmask_sysfs'] = self.PATH_INTMASK_SYSFS.format( diff --git a/device/celestica/x86_64-cel_seastone_2-r0/sonic_platform_config/sfp.json b/device/celestica/x86_64-cel_seastone_2-r0/sonic_platform_config/sfp.json index d77e75e50e2f..d12f0c3ffc1b 100644 --- a/device/celestica/x86_64-cel_seastone_2-r0/sonic_platform_config/sfp.json +++ b/device/celestica/x86_64-cel_seastone_2-r0/sonic_platform_config/sfp.json @@ -1,5 +1,5 @@ { - "port_num": 32, + "port_num": 33, "eeprom_path": "/sys/bus/i2c/devices/i2c-{0}/{0}-0050/eeprom", "port_i2c_mapping": [ 2, @@ -33,12 +33,13 @@ 30, 31, 32, - 33 + 33, + 34 ], "get_presence": { "output_source": "sysfs_value", - "sysfs_path": "/sys/devices/platform/switchboard/SFF/{}/qsfp_modprs", - "argument": "$ref:_port_name", + "sysfs_path": "/sys/devices/platform/switchboard/SFF/{}", + "argument": "$ref:_presence_file", "output_translator": "False if '{}' == '1' else True" }, "get_lpmode": { @@ -101,6 +102,42 @@ "QSFP29", "QSFP30", "QSFP31", - "QSFP32" + "QSFP32", + "SFP1" + ], + "_presence_file": [ + "QSFP1/qsfp_modprs", + "QSFP2/qsfp_modprs", + "QSFP3/qsfp_modprs", + "QSFP4/qsfp_modprs", + "QSFP5/qsfp_modprs", + "QSFP6/qsfp_modprs", + "QSFP7/qsfp_modprs", + "QSFP8/qsfp_modprs", + "QSFP9/qsfp_modprs", + "QSFP10/qsfp_modprs", + "QSFP11/qsfp_modprs", + "QSFP12/qsfp_modprs", + "QSFP13/qsfp_modprs", + "QSFP14/qsfp_modprs", + "QSFP15/qsfp_modprs", + "QSFP16/qsfp_modprs", + "QSFP17/qsfp_modprs", + "QSFP18/qsfp_modprs", + "QSFP19/qsfp_modprs", + "QSFP20/qsfp_modprs", + "QSFP21/qsfp_modprs", + "QSFP22/qsfp_modprs", + "QSFP23/qsfp_modprs", + "QSFP24/qsfp_modprs", + "QSFP25/qsfp_modprs", + "QSFP26/qsfp_modprs", + "QSFP27/qsfp_modprs", + "QSFP28/qsfp_modprs", + "QSFP29/qsfp_modprs", + "QSFP30/qsfp_modprs", + "QSFP31/qsfp_modprs", + "QSFP32/qsfp_modprs", + "SFP1/sfp_modabs" ] -} \ No newline at end of file +} diff --git a/device/celestica/x86_64-cel_silverstone-r0/platform_asic b/device/celestica/x86_64-cel_silverstone-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/celestica/x86_64-cel_silverstone-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/celestica/x86_64-cel_silverstone-r0/sonic_platform/sfp.py b/device/celestica/x86_64-cel_silverstone-r0/sonic_platform/sfp.py index e909416e9081..c22c7a9b7585 100644 --- a/device/celestica/x86_64-cel_silverstone-r0/sonic_platform/sfp.py +++ b/device/celestica/x86_64-cel_silverstone-r0/sonic_platform/sfp.py @@ -225,7 +225,7 @@ def __init__(self, sfp_index): port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) self.port_to_eeprom_mapping[x] = port_eeprom_path - self.info_dict_keys = ['type', 'hardware_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', + self.info_dict_keys = ['type', 'vendor_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', 'vendor_date', 'vendor_oui'] self.dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', 'power_lpmode', 'tx_disable', 'tx_disable_channel', 'temperature', 'voltage', @@ -409,7 +409,7 @@ def get_transceiver_info(self): keys |Value Format |Information ---------------------------|---------------|---------------------------- type |1*255VCHAR |type of SFP - hardware_rev |1*255VCHAR |hardware version of SFP + vendor_rev |1*255VCHAR |vendor revision of SFP serial |1*255VCHAR |serial number of the SFP manufacturer |1*255VCHAR |SFP vendor name model |1*255VCHAR |SFP model name @@ -482,7 +482,7 @@ def get_transceiver_info(self): transceiver_info_dict['type'] = sfp_type_data['data']['type']['value'] transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] transceiver_info_dict['vendor_oui'] = 'N/A' transceiver_info_dict['vendor_date'] = 'N/A' @@ -561,7 +561,7 @@ def get_transceiver_info(self): transceiver_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value'] transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] transceiver_info_dict['vendor_date'] = sfp_vendor_date_data[ diff --git a/device/centec/arm64-centec_e530_24x2c-r0/platform_asic b/device/centec/arm64-centec_e530_24x2c-r0/platform_asic new file mode 100644 index 000000000000..74dac3505ea6 --- /dev/null +++ b/device/centec/arm64-centec_e530_24x2c-r0/platform_asic @@ -0,0 +1 @@ +centec diff --git a/device/centec/arm64-centec_e530_24x2q-r0/platform_asic b/device/centec/arm64-centec_e530_24x2q-r0/platform_asic new file mode 100644 index 000000000000..74dac3505ea6 --- /dev/null +++ b/device/centec/arm64-centec_e530_24x2q-r0/platform_asic @@ -0,0 +1 @@ +centec diff --git a/device/centec/arm64-centec_e530_48s4x-r0/platform_asic b/device/centec/arm64-centec_e530_48s4x-r0/platform_asic new file mode 100644 index 000000000000..74dac3505ea6 --- /dev/null +++ b/device/centec/arm64-centec_e530_48s4x-r0/platform_asic @@ -0,0 +1 @@ +centec diff --git a/device/centec/arm64-centec_e530_48t4x_p-r0/platform_asic b/device/centec/arm64-centec_e530_48t4x_p-r0/platform_asic new file mode 100644 index 000000000000..74dac3505ea6 --- /dev/null +++ b/device/centec/arm64-centec_e530_48t4x_p-r0/platform_asic @@ -0,0 +1 @@ +centec diff --git a/device/centec/x86_64-centec_e582_48x2q4z-r0/platform_asic b/device/centec/x86_64-centec_e582_48x2q4z-r0/platform_asic new file mode 100644 index 000000000000..74dac3505ea6 --- /dev/null +++ b/device/centec/x86_64-centec_e582_48x2q4z-r0/platform_asic @@ -0,0 +1 @@ +centec diff --git a/device/centec/x86_64-centec_e582_48x6q-r0/platform_asic b/device/centec/x86_64-centec_e582_48x6q-r0/platform_asic new file mode 100644 index 000000000000..74dac3505ea6 --- /dev/null +++ b/device/centec/x86_64-centec_e582_48x6q-r0/platform_asic @@ -0,0 +1 @@ +centec diff --git a/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/V682-48x8c-board.json b/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/V682-48x8c-board.json new file mode 100644 index 000000000000..435ab418aaba --- /dev/null +++ b/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/V682-48x8c-board.json @@ -0,0 +1,597 @@ +{ + "macleds" : { + "polarity" : 1, + "cpumode" : 1, + "maps" : [ + { + "port_id" : 32, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port0/brightness" + }, + { + "port_id" : 33, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port1/brightness" + }, + { + "port_id" : 34, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port2/brightness" + }, + { + "port_id" : 35, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port3/brightness" + }, + { + "port_id" : 0, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port4/brightness" + }, + { + "port_id" : 4, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port5/brightness" + }, + { + "port_id" : 8, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port6/brightness" + }, + { + "port_id" : 12, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port7/brightness" + }, + { + "port_id" : 16, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port8/brightness" + }, + { + "port_id" : 20, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port9/brightness" + }, + { + "port_id" : 24, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port10/brightness" + }, + { + "port_id" : 28, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port11/brightness" + }, + { + "port_id" : 40, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port12/brightness" + }, + { + "port_id" : 44, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port13/brightness" + }, + { + "port_id" : 48, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port14/brightness" + }, + { + "port_id" : 52, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port15/brightness" + }, + { + "port_id" : 56, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port16/brightness" + }, + { + "port_id" : 60, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port17/brightness" + }, + { + "port_id" : 64, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port18/brightness" + }, + { + "port_id" : 68, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port19/brightness" + }, + { + "port_id" : 72, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port20/brightness" + }, + { + "port_id" : 73, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port21/brightness" + }, + { + "port_id" : 74, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port22/brightness" + }, + { + "port_id" : 75, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port23/brightness" + }, + + { + "port_id" : 120, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port48/brightness" + }, + { + "port_id" : 124, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port49/brightness" + }, + { + "port_id" : 80, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port50/brightness" + }, + { + "port_id" : 84, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port51/brightness" + }, + + { + "port_id" : 232, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port24/brightness" + }, + { + "port_id" : 233, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port25/brightness" + }, + { + "port_id" : 234, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port26/brightness" + }, + { + "port_id" : 235, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port27/brightness" + }, + { + "port_id" : 200, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port28/brightness" + }, + { + "port_id" : 204, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port29/brightness" + }, + { + "port_id" : 208, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port30/brightness" + }, + { + "port_id" : 212, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port31/brightness" + }, + { + "port_id" : 216, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port32/brightness" + }, + { + "port_id" : 220, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port33/brightness" + }, + { + "port_id" : 224, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port34/brightness" + }, + { + "port_id" : 228, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port35/brightness" + }, + { + "port_id" : 160, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port36/brightness" + }, + { + "port_id" : 164, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port37/brightness" + }, + { + "port_id" : 168, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port38/brightness" + }, + { + "port_id" : 172, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port39/brightness" + }, + { + "port_id" : 176, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port40/brightness" + }, + { + "port_id" : 180, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port41/brightness" + }, + { + "port_id" : 184, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port42/brightness" + }, + { + "port_id" : 188, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port43/brightness" + }, + { + "port_id" : 192, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port44/brightness" + }, + { + "port_id" : 193, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port45/brightness" + }, + { + "port_id" : 194, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port46/brightness" + }, + { + "port_id" : 195, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port47/brightness" + }, + + { + "port_id" : 240, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port52/brightness" + }, + { + "port_id" : 244, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 1, + "sysfs_path" : "/sys/class/leds/port53/brightness" + }, + { + "port_id" : 280, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 1, + "sysfs_path" : "/sys/class/leds/port54/brightness" + }, + { + "port_id" : 284, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 1, + "sysfs_path" : "/sys/class/leds/port55/brightness" + }, + + { + "port_id" : 161, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_1_FORCE_OFF", + "fixed" : 0 + }, + { + "port_id" : 162, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_1_FORCE_OFF", + "fixed" : 0 + }, + { + "port_id" : 165, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_1_FORCE_OFF", + "fixed" : 0 + }, + { + "port_id" : 166, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_1_FORCE_OFF", + "fixed" : 0 + } + ] + }, + "ffe" : { + "board_material" : "BOARD_MATERIAL_M4", + "config" : [ + { + "serdes_id" : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75], + "is_dac" : 1, + "speed" : [10000, 25000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [2, -13, 46, 0, 0] + }, + { + "serdes_id" : [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 52, 53, 54, 55, 56, 57, 58, 59], + "is_dac" : 0, + "speed" : [10000, 1000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [0, 0, 46, -8, 0] + }, + { + "serdes_id" : [0, 1, 16, 17, 18, 19, 20, 21, 22, 23], + "is_dac" : 0, + "speed" : [10000, 1000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [0, 0, 42, -6, 0] + }, + { + "serdes_id" : [24, 25, 26, 27, 72, 74, 75], + "is_dac" : 0, + "speed" : [10000, 1000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [0, 0, 42, -4, 0] + }, + { + "serdes_id" : [48, 49, 51, 64, 65, 66, 67, 68, 69, 70, 71, 73], + "is_dac" : 0, + "speed" : [10000, 1000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [0, 0, 42, -6, 0] + }, + { + "serdes_id" : [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 52, 53, 54, 55, 56, 57, 58, 59], + "is_dac" : 0, + "speed" : [25000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [0, 0, 44, -14, -1] + }, + { + "serdes_id" : [0, 1, 16, 17, 18, 19, 20, 21, 22, 23], + "is_dac" : 0, + "speed" : [25000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [0, 0, 38, -10, -2] + }, + { + "serdes_id" : [24, 25, 26, 27, 72, 74, 75], + "is_dac" : 0, + "speed" : [25000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [0, 0, 36, -6, -2] + }, + { + "serdes_id" : [48, 49, 51, 64, 65, 66, 67, 68, 69, 70, 71, 73], + "is_dac" : 0, + "speed" : [25000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [0, 0, 38, -10, -2] + }, + { + "serdes_id" : [32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95], + "is_dac" : 1, + "speed" : [100000, 25000, 40000, 10000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [2, -13, 46, 0, 0] + }, + { + "serdes_id" : [32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95], + "is_dac" : 1, + "speed" : [1000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [0, 0, 42, -4, 0] + }, + { + "serdes_id" : [32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95], + "is_dac" : 0, + "speed" : [100000, 25000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [0, 0, 36, -6, -2] + }, + { + "serdes_id" : [32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95], + "is_dac" : 0, + "speed" : [40000, 10000, 1000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [0, 0, 42, -4, 0] + } + ] + } +} diff --git a/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/V682-48x8c-chip-profile.txt b/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/V682-48x8c-chip-profile.txt new file mode 100644 index 000000000000..9fadec5d5f6b --- /dev/null +++ b/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/V682-48x8c-chip-profile.txt @@ -0,0 +1,116 @@ +#----------------- SDK Feature Support -------------- +[MPLS_SUPPORT] = 1; +[APS_SUPPORT] = 1; +[OAM_SUPPORT] = 1; +[PTP_SUPPORT] = 0; +[SYNCE_SUPPORT] = 0; +[STACKING_SUPPORT] = 1; +[BPE_SUPPORT] = 0; +[IPFIX_SUPPORT] = 1; +[MONITOR_SUPPORT] = 1; +[OVERLAY_SUPPORT] = 1; +[EFD_SUPPORT] = 1; +[FCOE_SUPPORT] = 0; +[TRILL_SUPPORT] = 0; +[WLAN_SUPPORT] = 0; +[NPM_SUPPORT] = 1; +[DOT1AE_SUPPORT] = 1; +[SRV6_SUPPORT] = 0; +[DTEL_SUPPORT] = 1; +[FLEXE_SUPPORT] = 0; +[FDBTOKEN_SUPPORT] = 1; + +#----------------- Chip Init Parameter -------------- +#Local chip number and global chip id +[Local chip_num] = 1 +[Local chip0] = 0 +[Local chip1] = 1 +[Port_phy_mapping] = 1 + +#Cut through mode 0: Disable; 1:10/40/100G; 2:1/10/100G; 3:1/10/40G; other:Flex, refer to CUT_THROUGH_BITMAP +[CUT_THROUGH_SPEED] = 0 +#Flex cut through mode, speed enable by bitmap, refer to ctc_port_speed_t, Notice: 10M/100M/1G treat as the same speed +[CUT_THROUGH_BITMAP] = 0 + +#Network cpu port +[CPU_NETWORK_PORT_EN] = 0 +[CPU_NETWORK_PORT_ID] = 47 + +#Enable parity error and multi-bit ecc recover +[ECC_RECOVER_EN] = 0 +[TCAM_SCAN_EN] = 0 +[SDB_EN] = 0 + +#----------------- KNET Init Parameter -------------- +[KNET_EN] = 0 + +#----------------- FTM Init Parameter -------------- +#0: not use; 1: default; 2: layer3; 3: ipv6 +[FTM Profile] = 0 + +#----------------- Interrupt Init Parameter -------------- +#0: pin, 1: msi +[Interrupt_mode] = 1 + +#----------------- NextHop Init Parameter -------------- +#0: SDK work in pizzbox (single chip system), 1: SDK work in multi-chip system +[Nexthop Edit Mode] = 0 +[External Nexthop Number] = 16384 +[MPLS Tunnel Number] = 1024 +[H_ECMP_EN] = 0 + +#----------------- L2 Init Parameter -------------- +[FDB Hw Learning] = 0 +[Logic Port Num] = 1024 +#0: 128 instance per port, 1: 64 instance per port, 2: 32 instance per port +[STP MODE] = 0 +[MAX_FID_NUM] = 5120 + +#----------------- Stats Init Parameter -------------- +[STATS_QUEUE_DEQ_EN] = 1 +[STATS_QUEUE_DROP_EN] = 1 +[STATS_FLOW_POLICER_EN] = 1 +[STATS_VLAN_EN] = 0 +[STATS_VRF_EN] = 0 +[STATS_POLICER_NUM] = 1024 +[STATS_PORT_EN] = 0 +[STATS_ECMP_EN] = 0 + +#----------------- BPE Init Parameter -------------- +[BPE_BR_PORT_EXTENDER_EN] = 0 +[BPE_BR_UC_MAX_ECID] = 1024 +[BPE_BR_MC_MAX_ECID] = 4096 +[BPE_BR_PORT_BASE] = 0 + +#----------------- Ipuc Init Parameter -------------- +#0: tcam use prefix 16; 1: tcam use prefix 8 +[IPUC_TCAM_PREFIX_8] = 1 + +#----------------- QoS Init Parameter -------------- +#QoS policer number support 1K/2K/4K/8K, default 4K +[QOS_POLICER_NUM] = 4096 +#qos queue mode 0: 8(basic)+1(cpu) +#qos queue mode 1: 8(basic)+1(span)+1(mcast) +[QOS_QUEUE_MODE] = 0 +#QoS port extend queue number support 0/4, default 0 +[QOS_PORT_EXT_QUEUE_NUM] = 0 +#QoS CPU reason queue number support 128/64/32, default 128 +[QOS_CPU_QUEUE_NUM] = 128 +[QOS_INGRESS_VLAN_POLICER_NUM] = 0 +[QOS_EGRESS_VLAN_POLICER_NUM] = 0 +#QoS the max number of igs/egs reserve macro policer,which ACL entry support micro and macro at the same time +[QOS_INGRESS_MACRO_POLICER_NUM] = 0 +[QOS_EGRESS_MACRO_POLICER_NUM] = 0 +#QOS service queue mode, default 0,0:logic scr port + dstport enq 1:service id + dstport enq +[QOS_SERVICE_QUEUE_MODE] = 0 +#mode 0:svc policer used for service policer +#mode 1:svc policer used for stormctl +[QOS_POLICER_SVC_MODE] = 0 + +#----------------- Stacking Init Parameter -------------- +#0: normal mode; 1: spine-leaf mode +[FABRIC MODE] = 0 +[STACKING VERSION] = 1 +#----------------- LB hash Init Parameter -------------- +#0: support 4 select num; 1: support 8 select num; only TM2 support mode 1 +[LB_HASH_MODE] = 0 diff --git a/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/V682-48x8c-datapath.txt b/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/V682-48x8c-datapath.txt new file mode 100644 index 000000000000..c77ae26c389d --- /dev/null +++ b/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/V682-48x8c-datapath.txt @@ -0,0 +1,1022 @@ +#SERDES_MODE: 0-NONE, 1-XFI, 2-SGMII, 3-Not Support, 4-QSGMII, 7-XLG, 8-100GR4, 9-SGMII2G5 +# 13-XXVG, 14-50GR2, 16-50GR1, 17-100GR2, 18-200G, 19-400G +#SERDES_POLY: 0-No Inverse, 1-Inverse +#SERDES_SWITCH: 0-Not Support Dynamic Switch, 1-Support Dynamic Switch exclude QSGMII, 2-Support Dynamic Switch include QSGMII + +[CORE_PLL] = 1050 +[DP0_FLEXE_CLIENT_NUM] = 0 +[DP1_FLEXE_CLIENT_NUM] = 0 +[DP0_XPIPE_PORT_NUM] = 0 +[DP1_XPIPE_PORT_NUM] = 0 +[DOT1AE_ENABLE] = 1 + +#{ +[SERDES_ITEM] + +[SERDES_ID] = 7 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 0 + +[SERDES_ID] = 6 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 1 + +[SERDES_ID] = 5 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 2 + +[SERDES_ID] = 4 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 3 + +[SERDES_ID] = 3 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 4 + +[SERDES_ID] = 2 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 5 + +[SERDES_ID] = 1 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 6 + +[SERDES_ID] = 0 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 7 + +[SERDES_ID] = 11 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 8 + +[SERDES_ID] = 10 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 9 + +[SERDES_ID] = 9 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 10 + +[SERDES_ID] = 8 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 11 + +[SERDES_ID] = 12 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 12 + +[SERDES_ID] = 13 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 13 + +[SERDES_ID] = 14 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 14 + +[SERDES_ID] = 15 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 15 + +[SERDES_ID] = 16 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 16 + +[SERDES_ID] = 17 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 17 + +[SERDES_ID] = 18 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 18 + +[SERDES_ID] = 19 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 19 + +[SERDES_ID] = 20 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 20 + +[SERDES_ID] = 21 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 21 + +[SERDES_ID] = 22 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 22 + +[SERDES_ID] = 23 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 23 + +[SERDES_ID] = 24 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 24 + +[SERDES_ID] = 25 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 25 + +[SERDES_ID] = 26 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 26 + +[SERDES_ID] = 27 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 27 + +[SERDES_ID] = 28 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 28 + +[SERDES_ID] = 29 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 29 + +[SERDES_ID] = 30 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 30 + +[SERDES_ID] = 31 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 31 + +[SERDES_ID] = 36 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 32 + +[SERDES_ID] = 37 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 33 + +[SERDES_ID] = 38 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 34 + +[SERDES_ID] = 32 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 35 + +[SERDES_ID] = 39 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 36 + +[SERDES_ID] = 34 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 37 + +[SERDES_ID] = 35 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 38 + +[SERDES_ID] = 33 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 39 + +[SERDES_ID] = 40 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 40 + +[SERDES_ID] = 44 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 41 + +[SERDES_ID] = 42 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 42 + +[SERDES_ID] = 41 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 43 + +[SERDES_ID] = 43 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 44 + +[SERDES_ID] = 46 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 45 + +[SERDES_ID] = 47 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 46 + +[SERDES_ID] = 45 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 47 + +[SERDES_ID] = 49 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 48 + +[SERDES_ID] = 48 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 49 + +[SERDES_ID] = 51 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 50 + +[SERDES_ID] = 50 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 51 + +[SERDES_ID] = 53 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 52 + +[SERDES_ID] = 52 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 53 + +[SERDES_ID] = 55 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 54 + +[SERDES_ID] = 54 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 55 + +[SERDES_ID] = 57 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 56 + +[SERDES_ID] = 56 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 57 + +[SERDES_ID] = 59 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 58 + +[SERDES_ID] = 58 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 59 + +[SERDES_ID] = 60 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 60 + +[SERDES_ID] = 61 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 61 + +[SERDES_ID] = 62 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 62 + +[SERDES_ID] = 63 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 63 + +[SERDES_ID] = 70 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 64 + +[SERDES_ID] = 71 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 65 + +[SERDES_ID] = 68 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 66 + +[SERDES_ID] = 69 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 67 + +[SERDES_ID] = 66 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 68 + +[SERDES_ID] = 67 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 69 + +[SERDES_ID] = 64 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 70 + +[SERDES_ID] = 65 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 71 + +[SERDES_ID] = 74 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 72 + +[SERDES_ID] = 75 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 73 + +[SERDES_ID] = 72 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 74 + +[SERDES_ID] = 73 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 75 + +[SERDES_ID] = 76 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 76 + +[SERDES_ID] = 77 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 77 + +[SERDES_ID] = 78 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 78 + +[SERDES_ID] = 79 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 79 + +[SERDES_ID] = 83 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 80 + +[SERDES_ID] = 81 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 81 + +[SERDES_ID] = 87 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 82 + +[SERDES_ID] = 82 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 83 + +[SERDES_ID] = 86 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 84 + +[SERDES_ID] = 80 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 85 + +[SERDES_ID] = 84 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 86 + +[SERDES_ID] = 85 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 87 + +[SERDES_ID] = 95 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 88 + +[SERDES_ID] = 93 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 89 + +[SERDES_ID] = 91 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 90 + +[SERDES_ID] = 94 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 91 + +[SERDES_ID] = 90 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 92 + +[SERDES_ID] = 89 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 93 + +[SERDES_ID] = 88 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 94 + +[SERDES_ID] = 92 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 95 + +[SERDES_ID] = 96 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 96 + +[SERDES_ID] = 97 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 97 + +[SERDES_ID] = 98 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 98 + +[SERDES_ID] = 99 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 99 + +#} +[SERDES_TO_LPORT] +#{ +#index |serdes |QSGMII |SGMII/SGMII2G5/XFI/XXVG |XLG |50GR1 |50GR2 |100GR4 |100GR2 |200G |400G +#----------|----------|------------|------------------------|--------|--------|--------|--------|--------|--------|-------- +#0 |7 |NA |0 |0 |0 |0 |0 |0 |NA |NA +#1 |6 |NA |1 |0 |NA |0 |0 |NA |NA |NA +#2 |5 |NA |2 |0 |2 |2 |0 |0 |NA |NA +#3 |4 |NA |3 |0 |NA |2 |0 |NA |NA |NA +#4 |3 |NA |4 |4 |4 |4 |4 |4 |NA |NA +#5 |2 |NA |5 |4 |NA |4 |4 |NA |NA |NA +#6 |1 |NA |6 |4 |6 |6 |4 |4 |NA |NA +#7 |0 |NA |7 |4 |NA |6 |4 |NA |NA |NA +#8 |11 |NA |8 |8 |8 |8 |8 |8 |NA |NA +#9 |10 |NA |9 |8 |NA |8 |8 |NA |NA |NA +#10 |9 |NA |10 |8 |10 |10 |8 |8 |NA |NA +#11 |8 |NA |11 |8 |NA |10 |8 |NA |NA |NA +#12 |12 |NA |12 |12 |12 |12 |12 |12 |NA |NA +#13 |13 |NA |13 |12 |NA |12 |12 |NA |NA |NA +#14 |14 |NA |14 |12 |14 |14 |12 |12 |NA |NA +#15 |15 |NA |15 |12 |NA |14 |12 |NA |NA |NA +#16 |16 |NA |16 |16 |16 |16 |16 |16 |NA |NA +#17 |17 |NA |17 |16 |NA |16 |16 |NA |NA |NA +#18 |18 |NA |18 |16 |18 |18 |16 |16 |NA |NA +#19 |19 |NA |19 |16 |NA |18 |16 |NA |NA |NA +#20 |20 |NA |20 |20 |20 |20 |20 |20 |NA |NA +#21 |21 |NA |21 |20 |NA |20 |20 |NA |NA |NA +#22 |22 |NA |22 |20 |22 |22 |20 |20 |NA |NA +#23 |23 |NA |23 |20 |NA |22 |20 |NA |NA |NA +#24 |24 |NA |24 |24 |24 |24 |24 |24 |NA |NA +#25 |25 |NA |25 |24 |NA |24 |24 |NA |NA |NA +#26 |26 |NA |26 |24 |26 |26 |24 |24 |NA |NA +#27 |27 |NA |27 |24 |NA |26 |24 |NA |NA |NA +#28 |28 |NA |28 |28 |28 |28 |28 |28 |NA |NA +#29 |29 |NA |29 |28 |NA |28 |28 |NA |NA |NA +#30 |30 |NA |30 |28 |30 |30 |28 |28 |NA |NA +#31 |31 |NA |31 |28 |NA |30 |28 |NA |NA |NA +#32 |36 |NA |32 |32 |32 |32 |32 |32 |32 |32 +#33 |37 |NA |33 |32 |33 |32 |32 |32 |32 |32 +#34 |38 |NA |34 |32 |34 |34 |32 |34 |32 |32 +#35 |32 |NA |35 |32 |35 |34 |32 |34 |32 |32 +#36 |39 |NA |36 |36 |36 |36 |36 |36 |36 |32 +#37 |34 |NA |37 |36 |37 |36 |36 |36 |36 |32 +#38 |35 |NA |38 |36 |38 |38 |36 |38 |36 |32 +#39 |33 |NA |39 |36 |39 |38 |36 |38 |36 |32 +#40 |40 |NA |40 |40 |40 |40 |40 |40 |40 |40 +#41 |44 |NA |41 |40 |41 |40 |40 |40 |40 |40 +#42 |42 |NA |42 |40 |42 |42 |40 |42 |40 |40 +#43 |41 |NA |43 |40 |43 |42 |40 |42 |40 |40 +#44 |43 |NA |44 |44 |44 |44 |44 |44 |44 |40 +#45 |46 |NA |45 |44 |45 |44 |44 |44 |44 |40 +#46 |47 |NA |46 |44 |46 |46 |44 |46 |44 |40 +#47 |45 |NA |47 |44 |47 |46 |44 |46 |44 |40 +#48 |49 |NA |48 |48 |48 |48 |48 |48 |NA |NA +#49 |48 |NA |49 |48 |NA |48 |48 |NA |NA |NA +#50 |51 |NA |50 |48 |50 |50 |48 |48 |NA |NA +#51 |50 |NA |51 |48 |NA |50 |48 |NA |NA |NA +#52 |53 |NA |52 |52 |52 |52 |52 |52 |NA |NA +#53 |52 |NA |53 |52 |NA |52 |52 |NA |NA |NA +#54 |55 |NA |54 |52 |54 |54 |52 |52 |NA |NA +#55 |54 |NA |55 |52 |NA |54 |52 |NA |NA |NA +#56 |57 |NA |56 |56 |56 |56 |56 |56 |NA |NA +#57 |56 |NA |57 |56 |NA |56 |56 |NA |NA |NA +#58 |59 |NA |58 |56 |58 |58 |56 |56 |NA |NA +#59 |58 |NA |59 |56 |NA |58 |56 |NA |NA |NA +#60 |60 |NA |60 |60 |60 |60 |60 |60 |NA |NA +#61 |61 |NA |61 |60 |NA |60 |60 |NA |NA |NA +#62 |62 |NA |62 |60 |62 |62 |60 |60 |NA |NA +#63 |63 |NA |63 |60 |NA |62 |60 |NA |NA |NA +#64 |70 |NA |64 |64 |64 |64 |64 |64 |NA |NA +#65 |71 |NA |65 |64 |NA |64 |64 |NA |NA |NA +#66 |68 |NA |66 |64 |66 |66 |64 |64 |NA |NA +#67 |69 |NA |67 |64 |NA |66 |64 |NA |NA |NA +#68 |66 |NA |68 |68 |68 |68 |68 |68 |NA |NA +#69 |67 |NA |69 |68 |NA |68 |68 |NA |NA |NA +#70 |64 |NA |70 |68 |70 |70 |68 |68 |NA |NA +#71 |65 |NA |71 |68 |NA |70 |68 |NA |NA |NA +#72 |74 |NA |72 |72 |72 |72 |72 |72 |NA |NA +#73 |75 |NA |73 |72 |NA |72 |72 |NA |NA |NA +#74 |72 |NA |74 |72 |74 |74 |72 |72 |NA |NA +#75 |73 |NA |75 |72 |NA |74 |72 |NA |NA |NA +#76 |76 |NA |76 |76 |76 |76 |76 |76 |NA |NA +#77 |77 |NA |77 |76 |NA |76 |76 |NA |NA |NA +#78 |78 |NA |78 |76 |78 |78 |76 |76 |NA |NA +#79 |79 |NA |79 |76 |NA |78 |76 |NA |NA |NA +#80 |83 |NA |80 |80 |80 |80 |80 |80 |80 |80 +#81 |81 |NA |81 |80 |81 |80 |80 |80 |80 |80 +#82 |87 |NA |82 |80 |82 |82 |80 |82 |80 |80 +#83 |82 |NA |83 |80 |83 |82 |80 |82 |80 |80 +#84 |86 |NA |84 |84 |84 |84 |84 |84 |84 |80 +#85 |80 |NA |85 |84 |85 |84 |84 |84 |84 |80 +#86 |84 |NA |86 |84 |86 |86 |84 |86 |84 |80 +#87 |85 |NA |87 |84 |87 |86 |84 |86 |84 |80 +#88 |95 |NA |88 |88 |88 |88 |88 |88 |88 |88 +#89 |93 |NA |89 |88 |89 |88 |88 |88 |88 |88 +#90 |91 |NA |90 |88 |90 |90 |88 |90 |88 |88 +#91 |94 |NA |91 |88 |91 |90 |88 |90 |88 |88 +#92 |90 |NA |92 |92 |92 |92 |92 |92 |92 |88 +#93 |89 |NA |93 |92 |93 |92 |92 |92 |92 |88 +#94 |88 |NA |94 |92 |94 |94 |92 |94 |92 |88 +#95 |92 |NA |95 |92 |95 |94 |92 |94 |92 |88 +#96 |96 |NA |232 |232 |232 |232 |232 |232 |NA |NA +#97 |97 |NA |233 |232 |NA |232 |232 |NA |NA |NA +#98 |98 |NA |243 |232 |243 |243 |232 |232 |NA |NA +#99 |99 |NA |244 |232 |NA |243 |232 |NA |NA |NA +#} + diff --git a/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/buffers.json.j2 b/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/buffers.json.j2 new file mode 100644 index 000000000000..08e21e428b6c --- /dev/null +++ b/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/buffers.json.j2 @@ -0,0 +1,70 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} +{% set default_ports_num = 54 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(1,default_ports_num+1) %} + {% if PORT.append("Ethernet%d" % (port_idx)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + } +} + diff --git a/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/pg_profile_lookup.ini b/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/pg_profile_lookup.ini new file mode 100644 index 000000000000..a65244e69b5b --- /dev/null +++ b/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/pg_profile_lookup.ini @@ -0,0 +1,21 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 1000 5m 34816 18432 16384 0 + 10000 5m 34816 18432 16384 0 + 25000 5m 34816 18432 16384 0 + 40000 5m 34816 18432 16384 0 + 50000 5m 34816 18432 16384 0 + 100000 5m 36864 18432 18432 0 + 1000 40m 36864 18432 18432 0 + 10000 40m 36864 18432 18432 0 + 25000 40m 39936 18432 21504 0 + 40000 40m 41984 18432 23552 0 + 50000 40m 41984 18432 23552 0 + 100000 40m 54272 18432 35840 0 + 1000 300m 49152 18432 30720 0 + 10000 300m 49152 18432 30720 0 + 25000 300m 71680 18432 53248 0 + 40000 300m 94208 18432 75776 0 + 50000 300m 94208 18432 75776 0 + 100000 300m 184320 18432 165888 0 + diff --git a/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/port_config.ini b/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/port_config.ini new file mode 100644 index 000000000000..1dca36d97f66 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/port_config.ini @@ -0,0 +1,57 @@ +# name lanes alias index speed fec +Ethernet0 32 eth-0-1 0 10000 none +Ethernet1 33 eth-0-2 1 10000 none +Ethernet2 34 eth-0-3 2 10000 none +Ethernet3 35 eth-0-4 3 10000 none +Ethernet4 0 eth-0-5 4 10000 none +Ethernet5 4 eth-0-6 5 10000 none +Ethernet6 8 eth-0-7 6 10000 none +Ethernet7 12 eth-0-8 7 10000 none +Ethernet8 16 eth-0-9 8 10000 none +Ethernet9 20 eth-0-10 9 10000 none +Ethernet10 24 eth-0-11 10 10000 none +Ethernet11 28 eth-0-12 11 10000 none +Ethernet12 40 eth-0-13 12 10000 none +Ethernet13 44 eth-0-14 13 10000 none +Ethernet14 48 eth-0-15 14 10000 none +Ethernet15 52 eth-0-16 15 10000 none +Ethernet16 56 eth-0-17 16 10000 none +Ethernet17 60 eth-0-18 17 10000 none +Ethernet18 64 eth-0-19 18 10000 none +Ethernet19 68 eth-0-20 19 10000 none +Ethernet20 72 eth-0-21 20 10000 none +Ethernet21 73 eth-0-22 21 10000 none +Ethernet22 74 eth-0-23 22 10000 none +Ethernet23 75 eth-0-24 23 10000 none +Ethernet24 232 eth-0-25 24 10000 none +Ethernet25 233 eth-0-26 25 10000 none +Ethernet26 234 eth-0-27 26 10000 none +Ethernet27 235 eth-0-28 27 10000 none +Ethernet28 200 eth-0-29 28 10000 none +Ethernet29 204 eth-0-30 29 10000 none +Ethernet30 208 eth-0-31 30 10000 none +Ethernet31 212 eth-0-32 31 10000 none +Ethernet32 216 eth-0-33 32 10000 none +Ethernet33 220 eth-0-34 33 10000 none +Ethernet34 224 eth-0-35 34 10000 none +Ethernet35 228 eth-0-36 35 10000 none +Ethernet36 160 eth-0-37 36 10000 none +Ethernet37 164 eth-0-38 37 10000 none +Ethernet38 168 eth-0-39 38 10000 none +Ethernet39 172 eth-0-40 39 10000 none +Ethernet40 176 eth-0-41 40 10000 none +Ethernet41 180 eth-0-42 41 10000 none +Ethernet42 184 eth-0-43 42 10000 none +Ethernet43 188 eth-0-44 43 10000 none +Ethernet44 192 eth-0-45 44 10000 none +Ethernet45 193 eth-0-46 45 10000 none +Ethernet46 194 eth-0-47 46 10000 none +Ethernet47 195 eth-0-48 47 10000 none +Ethernet48 120,121,122,123 eth-0-49 48 100000 none +Ethernet49 124,125,126,127 eth-0-50 49 100000 none +Ethernet50 80,81,82,83 eth-0-51 50 100000 none +Ethernet51 84,85,86,87 eth-0-52 51 100000 none +Ethernet52 240,241,242,243 eth-0-53 52 100000 none +Ethernet53 244,245,246,247 eth-0-54 53 100000 none +Ethernet54 280,281,282,283 eth-0-55 54 100000 none +Ethernet55 284,285,286,287 eth-0-56 55 100000 none diff --git a/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/qos.json.j2 b/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/qos.json.j2 new file mode 100644 index 000000000000..3e548325ea30 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/qos.json.j2 @@ -0,0 +1 @@ +{%- include 'qos_config.j2' %} diff --git a/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/sai.profile b/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/sai.profile new file mode 100644 index 000000000000..314a045bffcc --- /dev/null +++ b/device/centec/x86_64-centec_v682_48x8c-r0/V682-48x8c/sai.profile @@ -0,0 +1,3 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/V682-48x8c-chip-profile.txt +SAI_HW_PORT_PROFILE_ID_CONFIG_FILE=/usr/share/sonic/hwsku/V682-48x8c-datapath.txt +SAI_PLATFORM_CFG_FILE=/usr/share/sonic/hwsku/V682-48x8c-board.json diff --git a/device/centec/x86_64-centec_v682_48x8c-r0/default_sku b/device/centec/x86_64-centec_v682_48x8c-r0/default_sku new file mode 100644 index 000000000000..a3168b7a0c3c --- /dev/null +++ b/device/centec/x86_64-centec_v682_48x8c-r0/default_sku @@ -0,0 +1 @@ +V682-48x8c l2 diff --git a/device/centec/x86_64-centec_v682_48x8c-r0/fancontrol b/device/centec/x86_64-centec_v682_48x8c-r0/fancontrol new file mode 100644 index 000000000000..07420a6dba06 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48x8c-r0/fancontrol @@ -0,0 +1,10 @@ +# Configuration file generated by pwmconfig, changes will be lost +INTERVAL=10 +DEVPATH=hwmon1=devices/pci0000:00/0000:00:1f.3/i2c-0/0-0049 hwmon2=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-9/9-002c hwmon3=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-9/9-002e +DEVNAME=hwmon1=lm77 hwmon2=adt7470 hwmon3=adt7470 +FCTEMPS=hwmon2/pwm1=hwmon1/temp1_input hwmon2/pwm2=hwmon1/temp1_input hwmon2/pwm3=hwmon1/temp1_input hwmon2/pwm4=hwmon1/temp1_input hwmon3/pwm1=hwmon1/temp1_input hwmon3/pwm2=hwmon1/temp1_input hwmon3/pwm3=hwmon1/temp1_input hwmon3/pwm4=hwmon1/temp1_input +FCFANS=hwmon2/pwm1=hwmon2/fan1_input hwmon2/pwm2=hwmon2/fan2_input hwmon2/pwm3=hwmon2/fan3_input hwmon2/pwm4=hwmon2/fan4_input hwmon3/pwm1=hwmon3/fan1_input hwmon3/pwm2=hwmon3/fan2_input hwmon3/pwm3=hwmon3/fan3_input hwmon3/pwm4=hwmon3/fan4_input +MINTEMP=hwmon2/pwm1=20 hwmon2/pwm2=20 hwmon2/pwm3=20 hwmon2/pwm4=20 hwmon3/pwm1=20 hwmon3/pwm2=20 hwmon3/pwm3=20 hwmon3/pwm4=20 +MAXTEMP=hwmon2/pwm1=60 hwmon2/pwm2=60 hwmon2/pwm3=60 hwmon2/pwm4=60 hwmon3/pwm1=60 hwmon3/pwm2=60 hwmon3/pwm3=60 hwmon3/pwm4=60 +MINSTART=hwmon2/pwm1=150 hwmon2/pwm2=150 hwmon2/pwm3=150 hwmon2/pwm4=150 hwmon3/pwm1=150 hwmon3/pwm2=150 hwmon3/pwm3=150 hwmon3/pwm4=150 +MINSTOP=hwmon2/pwm1=0 hwmon2/pwm2=0 hwmon2/pwm3=0 hwmon2/pwm4=0 hwmon3/pwm1=0 hwmon3/pwm2=0 hwmon3/pwm3=0 hwmon3/pwm4=0 diff --git a/device/centec/x86_64-centec_v682_48x8c-r0/installer.conf b/device/centec/x86_64-centec_v682_48x8c-r0/installer.conf new file mode 100644 index 000000000000..3b97b7f99da2 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48x8c-r0/installer.conf @@ -0,0 +1 @@ +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="iommu=pt" diff --git a/device/centec/x86_64-centec_v682_48x8c-r0/pcie.yaml b/device/centec/x86_64-centec_v682_48x8c-r0/pcie.yaml new file mode 100644 index 000000000000..5e00e24bc079 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48x8c-r0/pcie.yaml @@ -0,0 +1,5 @@ +- bus: '05' + dev: '00' + fn: '0' + id: 8180 + name: 'Communication controller: Device cb10:8180' diff --git a/device/centec/x86_64-centec_v682_48x8c-r0/platform_asic b/device/centec/x86_64-centec_v682_48x8c-r0/platform_asic new file mode 100644 index 000000000000..74dac3505ea6 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48x8c-r0/platform_asic @@ -0,0 +1 @@ +centec diff --git a/device/centec/x86_64-centec_v682_48x8c-r0/platform_components.json b/device/centec/x86_64-centec_v682_48x8c-r0/platform_components.json new file mode 100644 index 000000000000..4eb9f0277b9b --- /dev/null +++ b/device/centec/x86_64-centec_v682_48x8c-r0/platform_components.json @@ -0,0 +1,8 @@ +{ + "chassis": { + "V682-48X8C": { + "component": { + } + } + } +} diff --git a/device/centec/x86_64-centec_v682_48x8c-r0/platform_reboot b/device/centec/x86_64-centec_v682_48x8c-r0/platform_reboot new file mode 100755 index 000000000000..5e49eecb61ca --- /dev/null +++ b/device/centec/x86_64-centec_v682_48x8c-r0/platform_reboot @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +import os +import time + +def main(): + os.system('hwclock -w -f /dev/rtc1') + time.sleep(1) + + os.system('i2cset -y 0 0x36 0x23 0') + time.sleep(1) + os.system('i2cset -y 0 0x36 0x23 1') + +if __name__ == '__main__': + main() diff --git a/device/centec/x86_64-centec_v682_48x8c-r0/plugins/eeprom.py b/device/centec/x86_64-centec_v682_48x8c-r0/plugins/eeprom.py new file mode 100644 index 000000000000..7093e4b0f825 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48x8c-r0/plugins/eeprom.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python + +############################################################################# +# Centec V682-48X8C +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import os + from sonic_eeprom import eeprom_tlvinfo + from sonic_py_common import device_info +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +USR_SHARE_SONIC_PATH = "/usr/share/sonic" +HOST_DEVICE_PATH = USR_SHARE_SONIC_PATH + "/device" +CONTAINER_PLATFORM_PATH = USR_SHARE_SONIC_PATH + "/platform" + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + def __init__(self, name, path, cpld_root, ro): + if os.path.isdir(CONTAINER_PLATFORM_PATH): + platform_path = CONTAINER_PLATFORM_PATH + else: + platform = device_info.get_platform() + if platform is None: + raise + platform_path = os.path.join(HOST_DEVICE_PATH, platform) + + self.eeprom_path = platform_path + '/eeprom_file' + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/centec/x86_64-centec_v682_48x8c-r0/plugins/led_control.py b/device/centec/x86_64-centec_v682_48x8c-r0/plugins/led_control.py new file mode 100644 index 000000000000..b787320d7840 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48x8c-r0/plugins/led_control.py @@ -0,0 +1,214 @@ +#!/usr/bin/env python +# +# led_control.py +# +# Platform-specific LED control functionality for SONiC +# + +try: + import os + import re + import syslog + import collections + from sonic_led.led_control_base import LedControlBase + from sonic_py_common import device_info + from subprocess import Popen +except ImportError as e: + raise ImportError(str(e) + " - required module not found") + +USR_SHARE_SONIC_PATH = "/usr/share/sonic" +HOST_DEVICE_PATH = USR_SHARE_SONIC_PATH + "/device" +CONTAINER_PLATFORM_PATH = USR_SHARE_SONIC_PATH + "/platform" + +def DBG_PRINT(str): + syslog.openlog("centec-led") + syslog.syslog(syslog.LOG_INFO, str) + syslog.closelog() + +class LedControl(LedControlBase): + """Platform specific LED control class""" + + # Constructor + def __init__(self): + + self.mac_to_led = { + 32 : 0, + 33 : 1, + 34 : 2, + 35 : 3, + 0 : 4, + 4 : 5, + 8 : 6, + 12 : 7, + 16 : 8, + 20 : 9, + 24 : 10, + 28 : 11, + 40 : 12, + 44 : 13, + 48 : 14, + 52 : 15, + 56 : 16, + 60 : 17, + 64 : 18, + 68 : 19, + 72 : 20, + 73 : 21, + 74 : 22, + 75 : 23, + 232: 24, + 233: 25, + 234: 26, + 235: 27, + 200: 28, + 204: 29, + 208: 30, + 212: 31, + 216: 32, + 220: 33, + 224: 34, + 228: 35, + 160: 36, + 164: 37, + 168: 38, + 172: 39, + 176: 40, + 180: 41, + 184: 42, + 188: 43, + 192: 44, + 193: 45, + 194: 46, + 195: 47, + 120: 48, + 121: -1, + 122: -1, + 123: -1, + 124: 49, + 125: -1, + 126: -1, + 127: -1, + 80 : 50, + 81 : -1, + 82 : -1, + 83 : -1, + 84 : 51, + 85 : -1, + 86 : -1, + 87 : -1, + 240: 52, + 241: -1, + 242: -1, + 243: -1, + 244: 53, + 245: -1, + 246: -1, + 247: -1, + 280: 54, + 281: -1, + 282: -1, + 283: -1, + 284: 55, + 285: -1, + 286: -1, + 287: -1, + } + + if os.path.isdir(CONTAINER_PLATFORM_PATH): + platform_path = CONTAINER_PLATFORM_PATH + else: + platform = device_info.get_platform() + if platform is None: + raise + platform_path = os.path.join(HOST_DEVICE_PATH, platform) + + port_config_file = "/".join([platform_path, "V682-48x8c", "port_config.ini"]) + try: + f = open(port_config_file) + except: + raise + for line in f: + line.strip() + if re.search('^#', line) is not None: + Port_cfg = collections.namedtuple('Port_cfg', line.split()[1:]) + break + f.close() + f = open(port_config_file) + self._port_cfgs = [Port_cfg(*tuple((line.strip().split()))) + for line in f if re.search('^#', line) is None] + f.close() + + self.LED_MODE_UP = [5, 5] + self.LED_MODE_DOWN = [7, 7] + self.f_led = "/sys/class/leds/{}/brightness" + self._initDefaultConfig() + + # Helper method to map SONiC port name to index + def _port_name_to_index(self, port_name): + for port_cfg in self._port_cfgs: + if port_name == port_cfg.name: + macs = [int(x) for x in (port_cfg.lanes.split(','))] + led = self.mac_to_led[min(macs)] + if led < 0: + return None + return led + return None + + def _port_state_to_mode(self, port_idx, state): + if state == "up": + return self.LED_MODE_UP[1] if port_idx >= 48 else self.LED_MODE_UP[0] + else: + return self.LED_MODE_DOWN[1] if port_idx >= 48 else self.LED_MODE_DOWN[0] + + def _port_led_mode_update(self, port_idx, ledMode): + with open(self.f_led.format("port{}".format(port_idx)), 'w') as led_file: + led_file.write(str(ledMode)) + + def _initSystemLed(self): + try: + cmd = 'i2cset -y 0 0x36 0x2 0x5' + Popen(cmd, shell=True) + DBG_PRINT("init system led to normal") + cmd = 'i2cset -y 0 0x36 0x3 0x1' + Popen(cmd, shell=True) + DBG_PRINT("init idn led to off") + except IOError as e: + DBG_PRINT(str(e)) + + def _initPanelLed(self): + with open(self.f_led.format("port1"), 'r') as led_file: + shouldInit = (int(led_file.read()) == 0) + + if shouldInit == True: + for port_cfg in self._port_cfgs: + macs = [int(x) for x in (port_cfg.lanes.split(','))] + led = self.mac_to_led[min(macs)] + if led < 0: + continue + defmode = self._port_state_to_mode(led, "down") + with open(self.f_led.format("port{}".format(led)), 'w') as led_file: + led_file.write(str(defmode)) + DBG_PRINT("init port{} led to mode={}".format(led, defmode)) + + def _initDefaultConfig(self): + DBG_PRINT("start init led") + + self._initSystemLed() + self._initPanelLed() + + DBG_PRINT("init led done") + + # Concrete implementation of port_link_state_change() method + def port_link_state_change(self, portname, state): + port_idx = self._port_name_to_index(portname) + if port_idx is None: + return + ledMode = self._port_state_to_mode(port_idx, state) + with open(self.f_led.format("port{}".format(port_idx)), 'r') as led_file: + saveMode = int(led_file.read()) + + if ledMode == saveMode: + return + + self._port_led_mode_update(port_idx, ledMode) + DBG_PRINT("update {} led mode from {} to {}".format(portname, saveMode, ledMode)) diff --git a/device/centec/x86_64-centec_v682_48x8c-r0/plugins/psuutil.py b/device/centec/x86_64-centec_v682_48x8c-r0/plugins/psuutil.py new file mode 100644 index 000000000000..9e311d9b4f5a --- /dev/null +++ b/device/centec/x86_64-centec_v682_48x8c-r0/plugins/psuutil.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python + +############################################################################# +# Centec +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +from subprocess import Popen, PIPE, STDOUT + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + + :return: An integer, the number of PSUs available on the device + """ + return 2 + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is faulty + """ + if index is None: + return False + + cmd = 'i2cget -y 0 0x36 0x1e' + status = int(Popen(cmd, stdout=PIPE, stderr=STDOUT, shell=True).stdout.readline(), 16) + powergood = ((status & (1 << (3 * (index - 1) + 2))) != 0) + return powergood + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + if index is None: + return False + + cmd = 'i2cget -y 0 0x36 0x1e' + status = int(Popen(cmd, stdout=PIPE, stderr=STDOUT, shell=True).stdout.readline(), 16) + presence = ((status & (1 << (3 * (index - 1) + 1))) == 0) + return presence diff --git a/device/centec/x86_64-centec_v682_48x8c-r0/pmon_daemon_control.json b/device/centec/x86_64-centec_v682_48x8c-r0/pmon_daemon_control.json new file mode 100644 index 000000000000..0db3279e44b0 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48x8c-r0/pmon_daemon_control.json @@ -0,0 +1,3 @@ +{ + +} diff --git a/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/V682-48y8c-board.json b/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/V682-48y8c-board.json new file mode 100644 index 000000000000..435ab418aaba --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/V682-48y8c-board.json @@ -0,0 +1,597 @@ +{ + "macleds" : { + "polarity" : 1, + "cpumode" : 1, + "maps" : [ + { + "port_id" : 32, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port0/brightness" + }, + { + "port_id" : 33, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port1/brightness" + }, + { + "port_id" : 34, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port2/brightness" + }, + { + "port_id" : 35, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port3/brightness" + }, + { + "port_id" : 0, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port4/brightness" + }, + { + "port_id" : 4, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port5/brightness" + }, + { + "port_id" : 8, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port6/brightness" + }, + { + "port_id" : 12, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port7/brightness" + }, + { + "port_id" : 16, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port8/brightness" + }, + { + "port_id" : 20, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port9/brightness" + }, + { + "port_id" : 24, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port10/brightness" + }, + { + "port_id" : 28, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port11/brightness" + }, + { + "port_id" : 40, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port12/brightness" + }, + { + "port_id" : 44, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port13/brightness" + }, + { + "port_id" : 48, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port14/brightness" + }, + { + "port_id" : 52, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port15/brightness" + }, + { + "port_id" : 56, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port16/brightness" + }, + { + "port_id" : 60, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port17/brightness" + }, + { + "port_id" : 64, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port18/brightness" + }, + { + "port_id" : 68, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port19/brightness" + }, + { + "port_id" : 72, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port20/brightness" + }, + { + "port_id" : 73, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port21/brightness" + }, + { + "port_id" : 74, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port22/brightness" + }, + { + "port_id" : 75, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port23/brightness" + }, + + { + "port_id" : 120, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port48/brightness" + }, + { + "port_id" : 124, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port49/brightness" + }, + { + "port_id" : 80, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port50/brightness" + }, + { + "port_id" : 84, + "lchip" : 0, + "ctl_id" : 0, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port51/brightness" + }, + + { + "port_id" : 232, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port24/brightness" + }, + { + "port_id" : 233, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port25/brightness" + }, + { + "port_id" : 234, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port26/brightness" + }, + { + "port_id" : 235, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port27/brightness" + }, + { + "port_id" : 200, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port28/brightness" + }, + { + "port_id" : 204, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port29/brightness" + }, + { + "port_id" : 208, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port30/brightness" + }, + { + "port_id" : 212, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port31/brightness" + }, + { + "port_id" : 216, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port32/brightness" + }, + { + "port_id" : 220, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port33/brightness" + }, + { + "port_id" : 224, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port34/brightness" + }, + { + "port_id" : 228, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port35/brightness" + }, + { + "port_id" : 160, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port36/brightness" + }, + { + "port_id" : 164, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port37/brightness" + }, + { + "port_id" : 168, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port38/brightness" + }, + { + "port_id" : 172, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port39/brightness" + }, + { + "port_id" : 176, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port40/brightness" + }, + { + "port_id" : 180, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port41/brightness" + }, + { + "port_id" : 184, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port42/brightness" + }, + { + "port_id" : 188, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port43/brightness" + }, + { + "port_id" : 192, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port44/brightness" + }, + { + "port_id" : 193, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port45/brightness" + }, + { + "port_id" : 194, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port46/brightness" + }, + { + "port_id" : 195, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port47/brightness" + }, + + { + "port_id" : 240, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 0, + "sysfs_path" : "/sys/class/leds/port52/brightness" + }, + { + "port_id" : 244, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 1, + "sysfs_path" : "/sys/class/leds/port53/brightness" + }, + { + "port_id" : 280, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 1, + "sysfs_path" : "/sys/class/leds/port54/brightness" + }, + { + "port_id" : 284, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_2_FORCE_OFF", + "fixed" : 1, + "sysfs_path" : "/sys/class/leds/port55/brightness" + }, + + { + "port_id" : 161, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_1_FORCE_OFF", + "fixed" : 0 + }, + { + "port_id" : 162, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_1_FORCE_OFF", + "fixed" : 0 + }, + { + "port_id" : 165, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_1_FORCE_OFF", + "fixed" : 0 + }, + { + "port_id" : 166, + "lchip" : 0, + "ctl_id" : 1, + "mode" : "LED_MODE_1_FORCE_OFF", + "fixed" : 0 + } + ] + }, + "ffe" : { + "board_material" : "BOARD_MATERIAL_M4", + "config" : [ + { + "serdes_id" : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75], + "is_dac" : 1, + "speed" : [10000, 25000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [2, -13, 46, 0, 0] + }, + { + "serdes_id" : [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 52, 53, 54, 55, 56, 57, 58, 59], + "is_dac" : 0, + "speed" : [10000, 1000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [0, 0, 46, -8, 0] + }, + { + "serdes_id" : [0, 1, 16, 17, 18, 19, 20, 21, 22, 23], + "is_dac" : 0, + "speed" : [10000, 1000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [0, 0, 42, -6, 0] + }, + { + "serdes_id" : [24, 25, 26, 27, 72, 74, 75], + "is_dac" : 0, + "speed" : [10000, 1000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [0, 0, 42, -4, 0] + }, + { + "serdes_id" : [48, 49, 51, 64, 65, 66, 67, 68, 69, 70, 71, 73], + "is_dac" : 0, + "speed" : [10000, 1000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [0, 0, 42, -6, 0] + }, + { + "serdes_id" : [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 52, 53, 54, 55, 56, 57, 58, 59], + "is_dac" : 0, + "speed" : [25000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [0, 0, 44, -14, -1] + }, + { + "serdes_id" : [0, 1, 16, 17, 18, 19, 20, 21, 22, 23], + "is_dac" : 0, + "speed" : [25000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [0, 0, 38, -10, -2] + }, + { + "serdes_id" : [24, 25, 26, 27, 72, 74, 75], + "is_dac" : 0, + "speed" : [25000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [0, 0, 36, -6, -2] + }, + { + "serdes_id" : [48, 49, 51, 64, 65, 66, 67, 68, 69, 70, 71, 73], + "is_dac" : 0, + "speed" : [25000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [0, 0, 38, -10, -2] + }, + { + "serdes_id" : [32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95], + "is_dac" : 1, + "speed" : [100000, 25000, 40000, 10000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [2, -13, 46, 0, 0] + }, + { + "serdes_id" : [32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95], + "is_dac" : 1, + "speed" : [1000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [0, 0, 42, -4, 0] + }, + { + "serdes_id" : [32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95], + "is_dac" : 0, + "speed" : [100000, 25000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [0, 0, 36, -6, -2] + }, + { + "serdes_id" : [32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95], + "is_dac" : 0, + "speed" : [40000, 10000, 1000], + + "mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE", + "cfg" : [0, 0, 42, -4, 0] + } + ] + } +} diff --git a/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/V682-48y8c-chip-profile.txt b/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/V682-48y8c-chip-profile.txt new file mode 100644 index 000000000000..9fadec5d5f6b --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/V682-48y8c-chip-profile.txt @@ -0,0 +1,116 @@ +#----------------- SDK Feature Support -------------- +[MPLS_SUPPORT] = 1; +[APS_SUPPORT] = 1; +[OAM_SUPPORT] = 1; +[PTP_SUPPORT] = 0; +[SYNCE_SUPPORT] = 0; +[STACKING_SUPPORT] = 1; +[BPE_SUPPORT] = 0; +[IPFIX_SUPPORT] = 1; +[MONITOR_SUPPORT] = 1; +[OVERLAY_SUPPORT] = 1; +[EFD_SUPPORT] = 1; +[FCOE_SUPPORT] = 0; +[TRILL_SUPPORT] = 0; +[WLAN_SUPPORT] = 0; +[NPM_SUPPORT] = 1; +[DOT1AE_SUPPORT] = 1; +[SRV6_SUPPORT] = 0; +[DTEL_SUPPORT] = 1; +[FLEXE_SUPPORT] = 0; +[FDBTOKEN_SUPPORT] = 1; + +#----------------- Chip Init Parameter -------------- +#Local chip number and global chip id +[Local chip_num] = 1 +[Local chip0] = 0 +[Local chip1] = 1 +[Port_phy_mapping] = 1 + +#Cut through mode 0: Disable; 1:10/40/100G; 2:1/10/100G; 3:1/10/40G; other:Flex, refer to CUT_THROUGH_BITMAP +[CUT_THROUGH_SPEED] = 0 +#Flex cut through mode, speed enable by bitmap, refer to ctc_port_speed_t, Notice: 10M/100M/1G treat as the same speed +[CUT_THROUGH_BITMAP] = 0 + +#Network cpu port +[CPU_NETWORK_PORT_EN] = 0 +[CPU_NETWORK_PORT_ID] = 47 + +#Enable parity error and multi-bit ecc recover +[ECC_RECOVER_EN] = 0 +[TCAM_SCAN_EN] = 0 +[SDB_EN] = 0 + +#----------------- KNET Init Parameter -------------- +[KNET_EN] = 0 + +#----------------- FTM Init Parameter -------------- +#0: not use; 1: default; 2: layer3; 3: ipv6 +[FTM Profile] = 0 + +#----------------- Interrupt Init Parameter -------------- +#0: pin, 1: msi +[Interrupt_mode] = 1 + +#----------------- NextHop Init Parameter -------------- +#0: SDK work in pizzbox (single chip system), 1: SDK work in multi-chip system +[Nexthop Edit Mode] = 0 +[External Nexthop Number] = 16384 +[MPLS Tunnel Number] = 1024 +[H_ECMP_EN] = 0 + +#----------------- L2 Init Parameter -------------- +[FDB Hw Learning] = 0 +[Logic Port Num] = 1024 +#0: 128 instance per port, 1: 64 instance per port, 2: 32 instance per port +[STP MODE] = 0 +[MAX_FID_NUM] = 5120 + +#----------------- Stats Init Parameter -------------- +[STATS_QUEUE_DEQ_EN] = 1 +[STATS_QUEUE_DROP_EN] = 1 +[STATS_FLOW_POLICER_EN] = 1 +[STATS_VLAN_EN] = 0 +[STATS_VRF_EN] = 0 +[STATS_POLICER_NUM] = 1024 +[STATS_PORT_EN] = 0 +[STATS_ECMP_EN] = 0 + +#----------------- BPE Init Parameter -------------- +[BPE_BR_PORT_EXTENDER_EN] = 0 +[BPE_BR_UC_MAX_ECID] = 1024 +[BPE_BR_MC_MAX_ECID] = 4096 +[BPE_BR_PORT_BASE] = 0 + +#----------------- Ipuc Init Parameter -------------- +#0: tcam use prefix 16; 1: tcam use prefix 8 +[IPUC_TCAM_PREFIX_8] = 1 + +#----------------- QoS Init Parameter -------------- +#QoS policer number support 1K/2K/4K/8K, default 4K +[QOS_POLICER_NUM] = 4096 +#qos queue mode 0: 8(basic)+1(cpu) +#qos queue mode 1: 8(basic)+1(span)+1(mcast) +[QOS_QUEUE_MODE] = 0 +#QoS port extend queue number support 0/4, default 0 +[QOS_PORT_EXT_QUEUE_NUM] = 0 +#QoS CPU reason queue number support 128/64/32, default 128 +[QOS_CPU_QUEUE_NUM] = 128 +[QOS_INGRESS_VLAN_POLICER_NUM] = 0 +[QOS_EGRESS_VLAN_POLICER_NUM] = 0 +#QoS the max number of igs/egs reserve macro policer,which ACL entry support micro and macro at the same time +[QOS_INGRESS_MACRO_POLICER_NUM] = 0 +[QOS_EGRESS_MACRO_POLICER_NUM] = 0 +#QOS service queue mode, default 0,0:logic scr port + dstport enq 1:service id + dstport enq +[QOS_SERVICE_QUEUE_MODE] = 0 +#mode 0:svc policer used for service policer +#mode 1:svc policer used for stormctl +[QOS_POLICER_SVC_MODE] = 0 + +#----------------- Stacking Init Parameter -------------- +#0: normal mode; 1: spine-leaf mode +[FABRIC MODE] = 0 +[STACKING VERSION] = 1 +#----------------- LB hash Init Parameter -------------- +#0: support 4 select num; 1: support 8 select num; only TM2 support mode 1 +[LB_HASH_MODE] = 0 diff --git a/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/V682-48y8c-datapath.txt b/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/V682-48y8c-datapath.txt new file mode 100644 index 000000000000..c3bf7e2d4abf --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/V682-48y8c-datapath.txt @@ -0,0 +1,1022 @@ +#SERDES_MODE: 0-NONE, 1-XFI, 2-SGMII, 3-Not Support, 4-QSGMII, 7-XLG, 8-100GR4, 9-SGMII2G5 +# 13-XXVG, 14-50GR2, 16-50GR1, 17-100GR2, 18-200G, 19-400G +#SERDES_POLY: 0-No Inverse, 1-Inverse +#SERDES_SWITCH: 0-Not Support Dynamic Switch, 1-Support Dynamic Switch exclude QSGMII, 2-Support Dynamic Switch include QSGMII + +[CORE_PLL] = 1050 +[DP0_FLEXE_CLIENT_NUM] = 0 +[DP1_FLEXE_CLIENT_NUM] = 0 +[DP0_XPIPE_PORT_NUM] = 0 +[DP1_XPIPE_PORT_NUM] = 0 +[DOT1AE_ENABLE] = 1 + +#{ +[SERDES_ITEM] + +[SERDES_ID] = 7 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 0 + +[SERDES_ID] = 6 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 1 + +[SERDES_ID] = 5 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 2 + +[SERDES_ID] = 4 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 3 + +[SERDES_ID] = 3 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 4 + +[SERDES_ID] = 2 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 5 + +[SERDES_ID] = 1 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 6 + +[SERDES_ID] = 0 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 7 + +[SERDES_ID] = 11 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 8 + +[SERDES_ID] = 10 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 9 + +[SERDES_ID] = 9 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 10 + +[SERDES_ID] = 8 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 11 + +[SERDES_ID] = 12 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 12 + +[SERDES_ID] = 13 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 13 + +[SERDES_ID] = 14 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 14 + +[SERDES_ID] = 15 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 15 + +[SERDES_ID] = 16 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 16 + +[SERDES_ID] = 17 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 17 + +[SERDES_ID] = 18 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 18 + +[SERDES_ID] = 19 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 19 + +[SERDES_ID] = 20 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 20 + +[SERDES_ID] = 21 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 21 + +[SERDES_ID] = 22 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 22 + +[SERDES_ID] = 23 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 23 + +[SERDES_ID] = 24 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 24 + +[SERDES_ID] = 25 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 25 + +[SERDES_ID] = 26 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 26 + +[SERDES_ID] = 27 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 27 + +[SERDES_ID] = 28 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 28 + +[SERDES_ID] = 29 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 29 + +[SERDES_ID] = 30 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 30 + +[SERDES_ID] = 31 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 31 + +[SERDES_ID] = 36 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 32 + +[SERDES_ID] = 37 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 33 + +[SERDES_ID] = 38 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 34 + +[SERDES_ID] = 32 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 35 + +[SERDES_ID] = 39 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 36 + +[SERDES_ID] = 34 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 37 + +[SERDES_ID] = 35 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 38 + +[SERDES_ID] = 33 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 39 + +[SERDES_ID] = 40 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 40 + +[SERDES_ID] = 44 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 41 + +[SERDES_ID] = 42 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 42 + +[SERDES_ID] = 41 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 43 + +[SERDES_ID] = 43 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 44 + +[SERDES_ID] = 46 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 45 + +[SERDES_ID] = 47 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 46 + +[SERDES_ID] = 45 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 47 + +[SERDES_ID] = 49 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 48 + +[SERDES_ID] = 48 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 49 + +[SERDES_ID] = 51 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 50 + +[SERDES_ID] = 50 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 51 + +[SERDES_ID] = 53 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 52 + +[SERDES_ID] = 52 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 53 + +[SERDES_ID] = 55 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 54 + +[SERDES_ID] = 54 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 55 + +[SERDES_ID] = 57 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 56 + +[SERDES_ID] = 56 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 57 + +[SERDES_ID] = 59 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 58 + +[SERDES_ID] = 58 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 59 + +[SERDES_ID] = 60 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 60 + +[SERDES_ID] = 61 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 61 + +[SERDES_ID] = 62 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 62 + +[SERDES_ID] = 63 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 63 + +[SERDES_ID] = 70 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 64 + +[SERDES_ID] = 71 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 65 + +[SERDES_ID] = 68 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 66 + +[SERDES_ID] = 69 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 67 + +[SERDES_ID] = 66 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 68 + +[SERDES_ID] = 67 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 69 + +[SERDES_ID] = 64 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 70 + +[SERDES_ID] = 65 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 1 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 71 + +[SERDES_ID] = 74 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 72 + +[SERDES_ID] = 75 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 73 + +[SERDES_ID] = 72 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 74 + +[SERDES_ID] = 73 +[SERDES_MODE] = 13 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 75 + +[SERDES_ID] = 76 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 76 + +[SERDES_ID] = 77 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 77 + +[SERDES_ID] = 78 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 78 + +[SERDES_ID] = 79 +[SERDES_MODE] = 0 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 79 + +[SERDES_ID] = 83 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 80 + +[SERDES_ID] = 81 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 81 + +[SERDES_ID] = 87 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 82 + +[SERDES_ID] = 82 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 83 + +[SERDES_ID] = 86 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 84 + +[SERDES_ID] = 80 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 85 + +[SERDES_ID] = 84 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 86 + +[SERDES_ID] = 85 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 87 + +[SERDES_ID] = 95 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 88 + +[SERDES_ID] = 93 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 89 + +[SERDES_ID] = 91 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 90 + +[SERDES_ID] = 94 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 91 + +[SERDES_ID] = 90 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 92 + +[SERDES_ID] = 89 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 93 + +[SERDES_ID] = 88 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 94 + +[SERDES_ID] = 92 +[SERDES_MODE] = 8 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 95 + +[SERDES_ID] = 96 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 96 + +[SERDES_ID] = 97 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 97 + +[SERDES_ID] = 98 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 98 + +[SERDES_ID] = 99 +[SERDES_MODE] = 1 +[SERDES_RX_POLY] = 0 +[SERDES_TX_POLY] = 0 +[SERDES_SWITCH] = 1 +[SERDES_GROUP] = 0 +[SERDES_XPIPE] = 0 +[INDEX] = 99 + +#} +[SERDES_TO_LPORT] +#{ +#index |serdes |QSGMII |SGMII/SGMII2G5/XFI/XXVG |XLG |50GR1 |50GR2 |100GR4 |100GR2 |200G |400G +#----------|----------|------------|------------------------|--------|--------|--------|--------|--------|--------|-------- +#0 |7 |NA |0 |0 |0 |0 |0 |0 |NA |NA +#1 |6 |NA |1 |0 |NA |0 |0 |NA |NA |NA +#2 |5 |NA |2 |0 |2 |2 |0 |0 |NA |NA +#3 |4 |NA |3 |0 |NA |2 |0 |NA |NA |NA +#4 |3 |NA |4 |4 |4 |4 |4 |4 |NA |NA +#5 |2 |NA |5 |4 |NA |4 |4 |NA |NA |NA +#6 |1 |NA |6 |4 |6 |6 |4 |4 |NA |NA +#7 |0 |NA |7 |4 |NA |6 |4 |NA |NA |NA +#8 |11 |NA |8 |8 |8 |8 |8 |8 |NA |NA +#9 |10 |NA |9 |8 |NA |8 |8 |NA |NA |NA +#10 |9 |NA |10 |8 |10 |10 |8 |8 |NA |NA +#11 |8 |NA |11 |8 |NA |10 |8 |NA |NA |NA +#12 |12 |NA |12 |12 |12 |12 |12 |12 |NA |NA +#13 |13 |NA |13 |12 |NA |12 |12 |NA |NA |NA +#14 |14 |NA |14 |12 |14 |14 |12 |12 |NA |NA +#15 |15 |NA |15 |12 |NA |14 |12 |NA |NA |NA +#16 |16 |NA |16 |16 |16 |16 |16 |16 |NA |NA +#17 |17 |NA |17 |16 |NA |16 |16 |NA |NA |NA +#18 |18 |NA |18 |16 |18 |18 |16 |16 |NA |NA +#19 |19 |NA |19 |16 |NA |18 |16 |NA |NA |NA +#20 |20 |NA |20 |20 |20 |20 |20 |20 |NA |NA +#21 |21 |NA |21 |20 |NA |20 |20 |NA |NA |NA +#22 |22 |NA |22 |20 |22 |22 |20 |20 |NA |NA +#23 |23 |NA |23 |20 |NA |22 |20 |NA |NA |NA +#24 |24 |NA |24 |24 |24 |24 |24 |24 |NA |NA +#25 |25 |NA |25 |24 |NA |24 |24 |NA |NA |NA +#26 |26 |NA |26 |24 |26 |26 |24 |24 |NA |NA +#27 |27 |NA |27 |24 |NA |26 |24 |NA |NA |NA +#28 |28 |NA |28 |28 |28 |28 |28 |28 |NA |NA +#29 |29 |NA |29 |28 |NA |28 |28 |NA |NA |NA +#30 |30 |NA |30 |28 |30 |30 |28 |28 |NA |NA +#31 |31 |NA |31 |28 |NA |30 |28 |NA |NA |NA +#32 |36 |NA |32 |32 |32 |32 |32 |32 |32 |32 +#33 |37 |NA |33 |32 |33 |32 |32 |32 |32 |32 +#34 |38 |NA |34 |32 |34 |34 |32 |34 |32 |32 +#35 |32 |NA |35 |32 |35 |34 |32 |34 |32 |32 +#36 |39 |NA |36 |36 |36 |36 |36 |36 |36 |32 +#37 |34 |NA |37 |36 |37 |36 |36 |36 |36 |32 +#38 |35 |NA |38 |36 |38 |38 |36 |38 |36 |32 +#39 |33 |NA |39 |36 |39 |38 |36 |38 |36 |32 +#40 |40 |NA |40 |40 |40 |40 |40 |40 |40 |40 +#41 |44 |NA |41 |40 |41 |40 |40 |40 |40 |40 +#42 |42 |NA |42 |40 |42 |42 |40 |42 |40 |40 +#43 |41 |NA |43 |40 |43 |42 |40 |42 |40 |40 +#44 |43 |NA |44 |44 |44 |44 |44 |44 |44 |40 +#45 |46 |NA |45 |44 |45 |44 |44 |44 |44 |40 +#46 |47 |NA |46 |44 |46 |46 |44 |46 |44 |40 +#47 |45 |NA |47 |44 |47 |46 |44 |46 |44 |40 +#48 |49 |NA |48 |48 |48 |48 |48 |48 |NA |NA +#49 |48 |NA |49 |48 |NA |48 |48 |NA |NA |NA +#50 |51 |NA |50 |48 |50 |50 |48 |48 |NA |NA +#51 |50 |NA |51 |48 |NA |50 |48 |NA |NA |NA +#52 |53 |NA |52 |52 |52 |52 |52 |52 |NA |NA +#53 |52 |NA |53 |52 |NA |52 |52 |NA |NA |NA +#54 |55 |NA |54 |52 |54 |54 |52 |52 |NA |NA +#55 |54 |NA |55 |52 |NA |54 |52 |NA |NA |NA +#56 |57 |NA |56 |56 |56 |56 |56 |56 |NA |NA +#57 |56 |NA |57 |56 |NA |56 |56 |NA |NA |NA +#58 |59 |NA |58 |56 |58 |58 |56 |56 |NA |NA +#59 |58 |NA |59 |56 |NA |58 |56 |NA |NA |NA +#60 |60 |NA |60 |60 |60 |60 |60 |60 |NA |NA +#61 |61 |NA |61 |60 |NA |60 |60 |NA |NA |NA +#62 |62 |NA |62 |60 |62 |62 |60 |60 |NA |NA +#63 |63 |NA |63 |60 |NA |62 |60 |NA |NA |NA +#64 |70 |NA |64 |64 |64 |64 |64 |64 |NA |NA +#65 |71 |NA |65 |64 |NA |64 |64 |NA |NA |NA +#66 |68 |NA |66 |64 |66 |66 |64 |64 |NA |NA +#67 |69 |NA |67 |64 |NA |66 |64 |NA |NA |NA +#68 |66 |NA |68 |68 |68 |68 |68 |68 |NA |NA +#69 |67 |NA |69 |68 |NA |68 |68 |NA |NA |NA +#70 |64 |NA |70 |68 |70 |70 |68 |68 |NA |NA +#71 |65 |NA |71 |68 |NA |70 |68 |NA |NA |NA +#72 |74 |NA |72 |72 |72 |72 |72 |72 |NA |NA +#73 |75 |NA |73 |72 |NA |72 |72 |NA |NA |NA +#74 |72 |NA |74 |72 |74 |74 |72 |72 |NA |NA +#75 |73 |NA |75 |72 |NA |74 |72 |NA |NA |NA +#76 |76 |NA |76 |76 |76 |76 |76 |76 |NA |NA +#77 |77 |NA |77 |76 |NA |76 |76 |NA |NA |NA +#78 |78 |NA |78 |76 |78 |78 |76 |76 |NA |NA +#79 |79 |NA |79 |76 |NA |78 |76 |NA |NA |NA +#80 |83 |NA |80 |80 |80 |80 |80 |80 |80 |80 +#81 |81 |NA |81 |80 |81 |80 |80 |80 |80 |80 +#82 |87 |NA |82 |80 |82 |82 |80 |82 |80 |80 +#83 |82 |NA |83 |80 |83 |82 |80 |82 |80 |80 +#84 |86 |NA |84 |84 |84 |84 |84 |84 |84 |80 +#85 |80 |NA |85 |84 |85 |84 |84 |84 |84 |80 +#86 |84 |NA |86 |84 |86 |86 |84 |86 |84 |80 +#87 |85 |NA |87 |84 |87 |86 |84 |86 |84 |80 +#88 |95 |NA |88 |88 |88 |88 |88 |88 |88 |88 +#89 |93 |NA |89 |88 |89 |88 |88 |88 |88 |88 +#90 |91 |NA |90 |88 |90 |90 |88 |90 |88 |88 +#91 |94 |NA |91 |88 |91 |90 |88 |90 |88 |88 +#92 |90 |NA |92 |92 |92 |92 |92 |92 |92 |88 +#93 |89 |NA |93 |92 |93 |92 |92 |92 |92 |88 +#94 |88 |NA |94 |92 |94 |94 |92 |94 |92 |88 +#95 |92 |NA |95 |92 |95 |94 |92 |94 |92 |88 +#96 |96 |NA |232 |232 |232 |232 |232 |232 |NA |NA +#97 |97 |NA |233 |232 |NA |232 |232 |NA |NA |NA +#98 |98 |NA |243 |232 |243 |243 |232 |232 |NA |NA +#99 |99 |NA |244 |232 |NA |243 |232 |NA |NA |NA +#} + diff --git a/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/buffers.json.j2 b/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/buffers.json.j2 new file mode 100644 index 000000000000..08e21e428b6c --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/buffers.json.j2 @@ -0,0 +1,70 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} +{% set default_ports_num = 54 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(1,default_ports_num+1) %} + {% if PORT.append("Ethernet%d" % (port_idx)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + } +} + diff --git a/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/pg_profile_lookup.ini b/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/pg_profile_lookup.ini new file mode 100644 index 000000000000..a65244e69b5b --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/pg_profile_lookup.ini @@ -0,0 +1,21 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 1000 5m 34816 18432 16384 0 + 10000 5m 34816 18432 16384 0 + 25000 5m 34816 18432 16384 0 + 40000 5m 34816 18432 16384 0 + 50000 5m 34816 18432 16384 0 + 100000 5m 36864 18432 18432 0 + 1000 40m 36864 18432 18432 0 + 10000 40m 36864 18432 18432 0 + 25000 40m 39936 18432 21504 0 + 40000 40m 41984 18432 23552 0 + 50000 40m 41984 18432 23552 0 + 100000 40m 54272 18432 35840 0 + 1000 300m 49152 18432 30720 0 + 10000 300m 49152 18432 30720 0 + 25000 300m 71680 18432 53248 0 + 40000 300m 94208 18432 75776 0 + 50000 300m 94208 18432 75776 0 + 100000 300m 184320 18432 165888 0 + diff --git a/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/port_config.ini b/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/port_config.ini new file mode 100644 index 000000000000..45206015c94e --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/port_config.ini @@ -0,0 +1,57 @@ +# name lanes alias index speed fec +Ethernet0 32 eth-0-1 0 25000 none +Ethernet1 33 eth-0-2 1 25000 none +Ethernet2 34 eth-0-3 2 25000 none +Ethernet3 35 eth-0-4 3 25000 none +Ethernet4 0 eth-0-5 4 25000 none +Ethernet5 4 eth-0-6 5 25000 none +Ethernet6 8 eth-0-7 6 25000 none +Ethernet7 12 eth-0-8 7 25000 none +Ethernet8 16 eth-0-9 8 25000 none +Ethernet9 20 eth-0-10 9 25000 none +Ethernet10 24 eth-0-11 10 25000 none +Ethernet11 28 eth-0-12 11 25000 none +Ethernet12 40 eth-0-13 12 25000 none +Ethernet13 44 eth-0-14 13 25000 none +Ethernet14 48 eth-0-15 14 25000 none +Ethernet15 52 eth-0-16 15 25000 none +Ethernet16 56 eth-0-17 16 25000 none +Ethernet17 60 eth-0-18 17 25000 none +Ethernet18 64 eth-0-19 18 25000 none +Ethernet19 68 eth-0-20 19 25000 none +Ethernet20 72 eth-0-21 20 25000 none +Ethernet21 73 eth-0-22 21 25000 none +Ethernet22 74 eth-0-23 22 25000 none +Ethernet23 75 eth-0-24 23 25000 none +Ethernet24 232 eth-0-25 24 25000 none +Ethernet25 233 eth-0-26 25 25000 none +Ethernet26 234 eth-0-27 26 25000 none +Ethernet27 235 eth-0-28 27 25000 none +Ethernet28 200 eth-0-29 28 25000 none +Ethernet29 204 eth-0-30 29 25000 none +Ethernet30 208 eth-0-31 30 25000 none +Ethernet31 212 eth-0-32 31 25000 none +Ethernet32 216 eth-0-33 32 25000 none +Ethernet33 220 eth-0-34 33 25000 none +Ethernet34 224 eth-0-35 34 25000 none +Ethernet35 228 eth-0-36 35 25000 none +Ethernet36 160 eth-0-37 36 25000 none +Ethernet37 164 eth-0-38 37 25000 none +Ethernet38 168 eth-0-39 38 25000 none +Ethernet39 172 eth-0-40 39 25000 none +Ethernet40 176 eth-0-41 40 25000 none +Ethernet41 180 eth-0-42 41 25000 none +Ethernet42 184 eth-0-43 42 25000 none +Ethernet43 188 eth-0-44 43 25000 none +Ethernet44 192 eth-0-45 44 25000 none +Ethernet45 193 eth-0-46 45 25000 none +Ethernet46 194 eth-0-47 46 25000 none +Ethernet47 195 eth-0-48 47 25000 none +Ethernet48 120,121,122,123 eth-0-49 48 100000 none +Ethernet49 124,125,126,127 eth-0-50 49 100000 none +Ethernet50 80,81,82,83 eth-0-51 50 100000 none +Ethernet51 84,85,86,87 eth-0-52 51 100000 none +Ethernet52 240,241,242,243 eth-0-53 52 100000 none +Ethernet53 244,245,246,247 eth-0-54 53 100000 none +Ethernet54 280,281,282,283 eth-0-55 54 100000 none +Ethernet55 284,285,286,287 eth-0-56 55 100000 none diff --git a/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/qos.json.j2 b/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/qos.json.j2 new file mode 100644 index 000000000000..3e548325ea30 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/qos.json.j2 @@ -0,0 +1 @@ +{%- include 'qos_config.j2' %} diff --git a/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/sai.profile b/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/sai.profile new file mode 100644 index 000000000000..9a3643c35b20 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c-r0/V682-48y8c/sai.profile @@ -0,0 +1,3 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/V682-48y8c-chip-profile.txt +SAI_HW_PORT_PROFILE_ID_CONFIG_FILE=/usr/share/sonic/hwsku/V682-48y8c-datapath.txt +SAI_PLATFORM_CFG_FILE=/usr/share/sonic/hwsku/V682-48y8c-board.json diff --git a/device/centec/x86_64-centec_v682_48y8c-r0/default_sku b/device/centec/x86_64-centec_v682_48y8c-r0/default_sku new file mode 100644 index 000000000000..d169d9636002 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c-r0/default_sku @@ -0,0 +1 @@ +V682-48y8c l2 diff --git a/device/centec/x86_64-centec_v682_48y8c-r0/fancontrol b/device/centec/x86_64-centec_v682_48y8c-r0/fancontrol new file mode 100644 index 000000000000..07420a6dba06 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c-r0/fancontrol @@ -0,0 +1,10 @@ +# Configuration file generated by pwmconfig, changes will be lost +INTERVAL=10 +DEVPATH=hwmon1=devices/pci0000:00/0000:00:1f.3/i2c-0/0-0049 hwmon2=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-9/9-002c hwmon3=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-9/9-002e +DEVNAME=hwmon1=lm77 hwmon2=adt7470 hwmon3=adt7470 +FCTEMPS=hwmon2/pwm1=hwmon1/temp1_input hwmon2/pwm2=hwmon1/temp1_input hwmon2/pwm3=hwmon1/temp1_input hwmon2/pwm4=hwmon1/temp1_input hwmon3/pwm1=hwmon1/temp1_input hwmon3/pwm2=hwmon1/temp1_input hwmon3/pwm3=hwmon1/temp1_input hwmon3/pwm4=hwmon1/temp1_input +FCFANS=hwmon2/pwm1=hwmon2/fan1_input hwmon2/pwm2=hwmon2/fan2_input hwmon2/pwm3=hwmon2/fan3_input hwmon2/pwm4=hwmon2/fan4_input hwmon3/pwm1=hwmon3/fan1_input hwmon3/pwm2=hwmon3/fan2_input hwmon3/pwm3=hwmon3/fan3_input hwmon3/pwm4=hwmon3/fan4_input +MINTEMP=hwmon2/pwm1=20 hwmon2/pwm2=20 hwmon2/pwm3=20 hwmon2/pwm4=20 hwmon3/pwm1=20 hwmon3/pwm2=20 hwmon3/pwm3=20 hwmon3/pwm4=20 +MAXTEMP=hwmon2/pwm1=60 hwmon2/pwm2=60 hwmon2/pwm3=60 hwmon2/pwm4=60 hwmon3/pwm1=60 hwmon3/pwm2=60 hwmon3/pwm3=60 hwmon3/pwm4=60 +MINSTART=hwmon2/pwm1=150 hwmon2/pwm2=150 hwmon2/pwm3=150 hwmon2/pwm4=150 hwmon3/pwm1=150 hwmon3/pwm2=150 hwmon3/pwm3=150 hwmon3/pwm4=150 +MINSTOP=hwmon2/pwm1=0 hwmon2/pwm2=0 hwmon2/pwm3=0 hwmon2/pwm4=0 hwmon3/pwm1=0 hwmon3/pwm2=0 hwmon3/pwm3=0 hwmon3/pwm4=0 diff --git a/device/centec/x86_64-centec_v682_48y8c-r0/installer.conf b/device/centec/x86_64-centec_v682_48y8c-r0/installer.conf new file mode 100644 index 000000000000..3b97b7f99da2 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c-r0/installer.conf @@ -0,0 +1 @@ +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="iommu=pt" diff --git a/device/centec/x86_64-centec_v682_48y8c-r0/pcie.yaml b/device/centec/x86_64-centec_v682_48y8c-r0/pcie.yaml new file mode 100644 index 000000000000..5e00e24bc079 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c-r0/pcie.yaml @@ -0,0 +1,5 @@ +- bus: '05' + dev: '00' + fn: '0' + id: 8180 + name: 'Communication controller: Device cb10:8180' diff --git a/device/centec/x86_64-centec_v682_48y8c-r0/platform_asic b/device/centec/x86_64-centec_v682_48y8c-r0/platform_asic new file mode 100644 index 000000000000..74dac3505ea6 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c-r0/platform_asic @@ -0,0 +1 @@ +centec diff --git a/device/centec/x86_64-centec_v682_48y8c-r0/platform_components.json b/device/centec/x86_64-centec_v682_48y8c-r0/platform_components.json new file mode 100644 index 000000000000..15c644f6b461 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c-r0/platform_components.json @@ -0,0 +1,8 @@ +{ + "chassis": { + "V682-48Y8C": { + "component": { + } + } + } +} diff --git a/device/centec/x86_64-centec_v682_48y8c-r0/platform_reboot b/device/centec/x86_64-centec_v682_48y8c-r0/platform_reboot new file mode 100755 index 000000000000..5e49eecb61ca --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c-r0/platform_reboot @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +import os +import time + +def main(): + os.system('hwclock -w -f /dev/rtc1') + time.sleep(1) + + os.system('i2cset -y 0 0x36 0x23 0') + time.sleep(1) + os.system('i2cset -y 0 0x36 0x23 1') + +if __name__ == '__main__': + main() diff --git a/device/centec/x86_64-centec_v682_48y8c-r0/plugins/eeprom.py b/device/centec/x86_64-centec_v682_48y8c-r0/plugins/eeprom.py new file mode 100644 index 000000000000..1651279722ee --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c-r0/plugins/eeprom.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python + +############################################################################# +# Centec V682-48Y8C +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import os + from sonic_eeprom import eeprom_tlvinfo + from sonic_py_common import device_info +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +USR_SHARE_SONIC_PATH = "/usr/share/sonic" +HOST_DEVICE_PATH = USR_SHARE_SONIC_PATH + "/device" +CONTAINER_PLATFORM_PATH = USR_SHARE_SONIC_PATH + "/platform" + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + def __init__(self, name, path, cpld_root, ro): + if os.path.isdir(CONTAINER_PLATFORM_PATH): + platform_path = CONTAINER_PLATFORM_PATH + else: + platform = device_info.get_platform() + if platform is None: + raise + platform_path = os.path.join(HOST_DEVICE_PATH, platform) + + self.eeprom_path = platform_path + '/eeprom_file' + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/centec/x86_64-centec_v682_48y8c-r0/plugins/led_control.py b/device/centec/x86_64-centec_v682_48y8c-r0/plugins/led_control.py new file mode 100644 index 000000000000..973a9354fbc6 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c-r0/plugins/led_control.py @@ -0,0 +1,214 @@ +#!/usr/bin/env python +# +# led_control.py +# +# Platform-specific LED control functionality for SONiC +# + +try: + import os + import re + import syslog + import collections + from sonic_led.led_control_base import LedControlBase + from sonic_py_common import device_info + from subprocess import Popen +except ImportError as e: + raise ImportError(str(e) + " - required module not found") + +USR_SHARE_SONIC_PATH = "/usr/share/sonic" +HOST_DEVICE_PATH = USR_SHARE_SONIC_PATH + "/device" +CONTAINER_PLATFORM_PATH = USR_SHARE_SONIC_PATH + "/platform" + +def DBG_PRINT(str): + syslog.openlog("centec-led") + syslog.syslog(syslog.LOG_INFO, str) + syslog.closelog() + +class LedControl(LedControlBase): + """Platform specific LED control class""" + + # Constructor + def __init__(self): + + self.mac_to_led = { + 32 : 0, + 33 : 1, + 34 : 2, + 35 : 3, + 0 : 4, + 4 : 5, + 8 : 6, + 12 : 7, + 16 : 8, + 20 : 9, + 24 : 10, + 28 : 11, + 40 : 12, + 44 : 13, + 48 : 14, + 52 : 15, + 56 : 16, + 60 : 17, + 64 : 18, + 68 : 19, + 72 : 20, + 73 : 21, + 74 : 22, + 75 : 23, + 232: 24, + 233: 25, + 234: 26, + 235: 27, + 200: 28, + 204: 29, + 208: 30, + 212: 31, + 216: 32, + 220: 33, + 224: 34, + 228: 35, + 160: 36, + 164: 37, + 168: 38, + 172: 39, + 176: 40, + 180: 41, + 184: 42, + 188: 43, + 192: 44, + 193: 45, + 194: 46, + 195: 47, + 120: 48, + 121: -1, + 122: -1, + 123: -1, + 124: 49, + 125: -1, + 126: -1, + 127: -1, + 80 : 50, + 81 : -1, + 82 : -1, + 83 : -1, + 84 : 51, + 85 : -1, + 86 : -1, + 87 : -1, + 240: 52, + 241: -1, + 242: -1, + 243: -1, + 244: 53, + 245: -1, + 246: -1, + 247: -1, + 280: 54, + 281: -1, + 282: -1, + 283: -1, + 284: 55, + 285: -1, + 286: -1, + 287: -1, + } + + if os.path.isdir(CONTAINER_PLATFORM_PATH): + platform_path = CONTAINER_PLATFORM_PATH + else: + platform = device_info.get_platform() + if platform is None: + raise + platform_path = os.path.join(HOST_DEVICE_PATH, platform) + + port_config_file = "/".join([platform_path, "V682-48y8c", "port_config.ini"]) + try: + f = open(port_config_file) + except: + raise + for line in f: + line.strip() + if re.search('^#', line) is not None: + Port_cfg = collections.namedtuple('Port_cfg', line.split()[1:]) + break + f.close() + f = open(port_config_file) + self._port_cfgs = [Port_cfg(*tuple((line.strip().split()))) + for line in f if re.search('^#', line) is None] + f.close() + + self.LED_MODE_UP = [5, 5] + self.LED_MODE_DOWN = [7, 7] + self.f_led = "/sys/class/leds/{}/brightness" + self._initDefaultConfig() + + # Helper method to map SONiC port name to index + def _port_name_to_index(self, port_name): + for port_cfg in self._port_cfgs: + if port_name == port_cfg.name: + macs = [int(x) for x in (port_cfg.lanes.split(','))] + led = self.mac_to_led[min(macs)] + if led < 0: + return None + return led + return None + + def _port_state_to_mode(self, port_idx, state): + if state == "up": + return self.LED_MODE_UP[1] if port_idx >= 48 else self.LED_MODE_UP[0] + else: + return self.LED_MODE_DOWN[1] if port_idx >= 48 else self.LED_MODE_DOWN[0] + + def _port_led_mode_update(self, port_idx, ledMode): + with open(self.f_led.format("port{}".format(port_idx)), 'w') as led_file: + led_file.write(str(ledMode)) + + def _initSystemLed(self): + try: + cmd = 'i2cset -y 0 0x36 0x2 0x5' + Popen(cmd, shell=True) + DBG_PRINT("init system led to normal") + cmd = 'i2cset -y 0 0x36 0x3 0x1' + Popen(cmd, shell=True) + DBG_PRINT("init idn led to off") + except IOError as e: + DBG_PRINT(str(e)) + + def _initPanelLed(self): + with open(self.f_led.format("port1"), 'r') as led_file: + shouldInit = (int(led_file.read()) == 0) + + if shouldInit == True: + for port_cfg in self._port_cfgs: + macs = [int(x) for x in (port_cfg.lanes.split(','))] + led = self.mac_to_led[min(macs)] + if led < 0: + continue + defmode = self._port_state_to_mode(led, "down") + with open(self.f_led.format("port{}".format(led)), 'w') as led_file: + led_file.write(str(defmode)) + DBG_PRINT("init port{} led to mode={}".format(led, defmode)) + + def _initDefaultConfig(self): + DBG_PRINT("start init led") + + self._initSystemLed() + self._initPanelLed() + + DBG_PRINT("init led done") + + # Concrete implementation of port_link_state_change() method + def port_link_state_change(self, portname, state): + port_idx = self._port_name_to_index(portname) + if port_idx is None: + return + ledMode = self._port_state_to_mode(port_idx, state) + with open(self.f_led.format("port{}".format(port_idx)), 'r') as led_file: + saveMode = int(led_file.read()) + + if ledMode == saveMode: + return + + self._port_led_mode_update(port_idx, ledMode) + DBG_PRINT("update {} led mode from {} to {}".format(portname, saveMode, ledMode)) diff --git a/device/centec/x86_64-centec_v682_48y8c-r0/plugins/psuutil.py b/device/centec/x86_64-centec_v682_48y8c-r0/plugins/psuutil.py new file mode 100644 index 000000000000..9e311d9b4f5a --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c-r0/plugins/psuutil.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python + +############################################################################# +# Centec +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +from subprocess import Popen, PIPE, STDOUT + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + + :return: An integer, the number of PSUs available on the device + """ + return 2 + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is faulty + """ + if index is None: + return False + + cmd = 'i2cget -y 0 0x36 0x1e' + status = int(Popen(cmd, stdout=PIPE, stderr=STDOUT, shell=True).stdout.readline(), 16) + powergood = ((status & (1 << (3 * (index - 1) + 2))) != 0) + return powergood + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + if index is None: + return False + + cmd = 'i2cget -y 0 0x36 0x1e' + status = int(Popen(cmd, stdout=PIPE, stderr=STDOUT, shell=True).stdout.readline(), 16) + presence = ((status & (1 << (3 * (index - 1) + 1))) == 0) + return presence diff --git a/device/centec/x86_64-centec_v682_48y8c-r0/pmon_daemon_control.json b/device/centec/x86_64-centec_v682_48y8c-r0/pmon_daemon_control.json new file mode 100644 index 000000000000..0db3279e44b0 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c-r0/pmon_daemon_control.json @@ -0,0 +1,3 @@ +{ + +} diff --git a/device/centec/x86_64-centec_v682_48y8c_d-r0/V682-48y8c-d/buffers.json.j2 b/device/centec/x86_64-centec_v682_48y8c_d-r0/V682-48y8c-d/buffers.json.j2 new file mode 100644 index 000000000000..08e21e428b6c --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c_d-r0/V682-48y8c-d/buffers.json.j2 @@ -0,0 +1,70 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} +{% set default_ports_num = 54 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(1,default_ports_num+1) %} + {% if PORT.append("Ethernet%d" % (port_idx)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + } +} + diff --git a/device/centec/x86_64-centec_v682_48y8c_d-r0/V682-48y8c-d/pg_profile_lookup.ini b/device/centec/x86_64-centec_v682_48y8c_d-r0/V682-48y8c-d/pg_profile_lookup.ini new file mode 100644 index 000000000000..a65244e69b5b --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c_d-r0/V682-48y8c-d/pg_profile_lookup.ini @@ -0,0 +1,21 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 1000 5m 34816 18432 16384 0 + 10000 5m 34816 18432 16384 0 + 25000 5m 34816 18432 16384 0 + 40000 5m 34816 18432 16384 0 + 50000 5m 34816 18432 16384 0 + 100000 5m 36864 18432 18432 0 + 1000 40m 36864 18432 18432 0 + 10000 40m 36864 18432 18432 0 + 25000 40m 39936 18432 21504 0 + 40000 40m 41984 18432 23552 0 + 50000 40m 41984 18432 23552 0 + 100000 40m 54272 18432 35840 0 + 1000 300m 49152 18432 30720 0 + 10000 300m 49152 18432 30720 0 + 25000 300m 71680 18432 53248 0 + 40000 300m 94208 18432 75776 0 + 50000 300m 94208 18432 75776 0 + 100000 300m 184320 18432 165888 0 + diff --git a/device/centec/x86_64-centec_v682_48y8c_d-r0/V682-48y8c-d/port_config.ini b/device/centec/x86_64-centec_v682_48y8c_d-r0/V682-48y8c-d/port_config.ini new file mode 100644 index 000000000000..45206015c94e --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c_d-r0/V682-48y8c-d/port_config.ini @@ -0,0 +1,57 @@ +# name lanes alias index speed fec +Ethernet0 32 eth-0-1 0 25000 none +Ethernet1 33 eth-0-2 1 25000 none +Ethernet2 34 eth-0-3 2 25000 none +Ethernet3 35 eth-0-4 3 25000 none +Ethernet4 0 eth-0-5 4 25000 none +Ethernet5 4 eth-0-6 5 25000 none +Ethernet6 8 eth-0-7 6 25000 none +Ethernet7 12 eth-0-8 7 25000 none +Ethernet8 16 eth-0-9 8 25000 none +Ethernet9 20 eth-0-10 9 25000 none +Ethernet10 24 eth-0-11 10 25000 none +Ethernet11 28 eth-0-12 11 25000 none +Ethernet12 40 eth-0-13 12 25000 none +Ethernet13 44 eth-0-14 13 25000 none +Ethernet14 48 eth-0-15 14 25000 none +Ethernet15 52 eth-0-16 15 25000 none +Ethernet16 56 eth-0-17 16 25000 none +Ethernet17 60 eth-0-18 17 25000 none +Ethernet18 64 eth-0-19 18 25000 none +Ethernet19 68 eth-0-20 19 25000 none +Ethernet20 72 eth-0-21 20 25000 none +Ethernet21 73 eth-0-22 21 25000 none +Ethernet22 74 eth-0-23 22 25000 none +Ethernet23 75 eth-0-24 23 25000 none +Ethernet24 232 eth-0-25 24 25000 none +Ethernet25 233 eth-0-26 25 25000 none +Ethernet26 234 eth-0-27 26 25000 none +Ethernet27 235 eth-0-28 27 25000 none +Ethernet28 200 eth-0-29 28 25000 none +Ethernet29 204 eth-0-30 29 25000 none +Ethernet30 208 eth-0-31 30 25000 none +Ethernet31 212 eth-0-32 31 25000 none +Ethernet32 216 eth-0-33 32 25000 none +Ethernet33 220 eth-0-34 33 25000 none +Ethernet34 224 eth-0-35 34 25000 none +Ethernet35 228 eth-0-36 35 25000 none +Ethernet36 160 eth-0-37 36 25000 none +Ethernet37 164 eth-0-38 37 25000 none +Ethernet38 168 eth-0-39 38 25000 none +Ethernet39 172 eth-0-40 39 25000 none +Ethernet40 176 eth-0-41 40 25000 none +Ethernet41 180 eth-0-42 41 25000 none +Ethernet42 184 eth-0-43 42 25000 none +Ethernet43 188 eth-0-44 43 25000 none +Ethernet44 192 eth-0-45 44 25000 none +Ethernet45 193 eth-0-46 45 25000 none +Ethernet46 194 eth-0-47 46 25000 none +Ethernet47 195 eth-0-48 47 25000 none +Ethernet48 120,121,122,123 eth-0-49 48 100000 none +Ethernet49 124,125,126,127 eth-0-50 49 100000 none +Ethernet50 80,81,82,83 eth-0-51 50 100000 none +Ethernet51 84,85,86,87 eth-0-52 51 100000 none +Ethernet52 240,241,242,243 eth-0-53 52 100000 none +Ethernet53 244,245,246,247 eth-0-54 53 100000 none +Ethernet54 280,281,282,283 eth-0-55 54 100000 none +Ethernet55 284,285,286,287 eth-0-56 55 100000 none diff --git a/device/centec/x86_64-centec_v682_48y8c_d-r0/V682-48y8c-d/qos.json.j2 b/device/centec/x86_64-centec_v682_48y8c_d-r0/V682-48y8c-d/qos.json.j2 new file mode 100644 index 000000000000..3e548325ea30 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c_d-r0/V682-48y8c-d/qos.json.j2 @@ -0,0 +1 @@ +{%- include 'qos_config.j2' %} diff --git a/device/centec/x86_64-centec_v682_48y8c_d-r0/V682-48y8c-d/sai.profile b/device/centec/x86_64-centec_v682_48y8c_d-r0/V682-48y8c-d/sai.profile new file mode 100644 index 000000000000..c04f2aa6f42b --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c_d-r0/V682-48y8c-d/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/etc/centec/V682-48y8c-d-chip-profile.txt +SAI_HW_PORT_PROFILE_ID_CONFIG_FILE=/etc/centec/V682-48y8c-d-datapath.txt diff --git a/device/centec/x86_64-centec_v682_48y8c_d-r0/default_sku b/device/centec/x86_64-centec_v682_48y8c_d-r0/default_sku new file mode 100644 index 000000000000..9b70952dab15 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c_d-r0/default_sku @@ -0,0 +1 @@ +V682-48y8c-d l2 diff --git a/device/centec/x86_64-centec_v682_48y8c_d-r0/installer.conf b/device/centec/x86_64-centec_v682_48y8c_d-r0/installer.conf new file mode 100644 index 000000000000..3b97b7f99da2 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c_d-r0/installer.conf @@ -0,0 +1 @@ +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="iommu=pt" diff --git a/device/centec/x86_64-centec_v682_48y8c_d-r0/platform_asic b/device/centec/x86_64-centec_v682_48y8c_d-r0/platform_asic new file mode 100644 index 000000000000..74dac3505ea6 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c_d-r0/platform_asic @@ -0,0 +1 @@ +centec diff --git a/device/centec/x86_64-centec_v682_48y8c_d-r0/platform_components.json b/device/centec/x86_64-centec_v682_48y8c_d-r0/platform_components.json new file mode 100644 index 000000000000..e2525c95aed5 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c_d-r0/platform_components.json @@ -0,0 +1,8 @@ +{ + "chassis": { + "V682-48Y8C-D": { + "component": { + } + } + } +} diff --git a/device/centec/x86_64-centec_v682_48y8c_d-r0/platform_reboot b/device/centec/x86_64-centec_v682_48y8c_d-r0/platform_reboot new file mode 100755 index 000000000000..a1dff65154bf --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c_d-r0/platform_reboot @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +import os +import sys + +susi4_lib = '/usr/local/lib/python3.9/dist-packages' +if not susi4_lib in os.environ.setdefault('LD_LIBRARY_PATH', ''): + os.environ['LD_LIBRARY_PATH'] += (':' + susi4_lib) + try: + os.execv(sys.argv[0], sys.argv) + except Exception as e: + sys.exit('failed to execute under modified environment!') + +from _Susi4 import * + +def main(): + SusiLibInitialize() + + SusiI2CWriteTransfer(0, 0x36 * 2, 0x23, '\x01') + + SusiLibUninitialize() + +if __name__ == '__main__': + main() diff --git a/device/centec/x86_64-centec_v682_48y8c_d-r0/plugins/led_control.py b/device/centec/x86_64-centec_v682_48y8c_d-r0/plugins/led_control.py new file mode 100644 index 000000000000..5d23afb0ea90 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c_d-r0/plugins/led_control.py @@ -0,0 +1,213 @@ +#!/usr/bin/env python +# +# led_control.py +# +# Platform-specific LED control functionality for SONiC +# + +try: + import os + import re + import syslog + import collections + from sonic_led.led_control_base import LedControlBase + from sonic_py_common import device_info +except ImportError as e: + raise ImportError(str(e) + " - required module not found") + +USR_SHARE_SONIC_PATH = "/usr/share/sonic" +HOST_DEVICE_PATH = USR_SHARE_SONIC_PATH + "/device" +CONTAINER_PLATFORM_PATH = USR_SHARE_SONIC_PATH + "/platform" + +def DBG_PRINT(str): + syslog.openlog("centec-led") + syslog.syslog(syslog.LOG_INFO, str) + syslog.closelog() + +class LedControl(LedControlBase): + """Platform specific LED control class""" + + # Constructor + def __init__(self): + + self.mac_to_led = { + 32 : 0, + 33 : 1, + 34 : 2, + 35 : 3, + 0 : 4, + 4 : 5, + 8 : 6, + 12 : 7, + 16 : 8, + 20 : 9, + 24 : 10, + 28 : 11, + 40 : 12, + 44 : 13, + 48 : 14, + 52 : 15, + 56 : 16, + 60 : 17, + 64 : 18, + 68 : 19, + 72 : 20, + 73 : 21, + 74 : 22, + 75 : 23, + 232: 24, + 233: 25, + 234: 26, + 235: 27, + 200: 28, + 204: 29, + 208: 30, + 212: 31, + 216: 32, + 220: 33, + 224: 34, + 228: 35, + 160: 36, + 164: 37, + 168: 38, + 172: 39, + 176: 40, + 180: 41, + 184: 42, + 188: 43, + 192: 44, + 193: 45, + 194: 46, + 195: 47, + 120: 48, + 121: -1, + 122: -1, + 123: -1, + 124: 49, + 125: -1, + 126: -1, + 127: -1, + 80 : 50, + 81 : -1, + 82 : -1, + 83 : -1, + 84 : 51, + 85 : -1, + 86 : -1, + 87 : -1, + 240: 52, + 241: -1, + 242: -1, + 243: -1, + 244: 53, + 245: -1, + 246: -1, + 247: -1, + 280: 54, + 281: -1, + 282: -1, + 283: -1, + 284: 55, + 285: -1, + 286: -1, + 287: -1, + } + + if os.path.isdir(CONTAINER_PLATFORM_PATH): + platform_path = CONTAINER_PLATFORM_PATH + else: + platform = device_info.get_platform() + if platform is None: + raise + platform_path = os.path.join(HOST_DEVICE_PATH, platform) + + port_config_file = "/".join([platform_path, "V682-48y8c-d", "port_config.ini"]) + try: + f = open(port_config_file) + except: + raise + for line in f: + line.strip() + if re.search('^#', line) is not None: + Port_cfg = collections.namedtuple('Port_cfg', line.split()[1:]) + break + f.close() + f = open(port_config_file) + self._port_cfgs = [Port_cfg(*tuple((line.strip().split()))) + for line in f if re.search('^#', line) is None] + f.close() + + self.LED_MODE_UP = [11, 11] + self.LED_MODE_DOWN = [7, 7] + self.f_led = "/sys/class/leds/{}/brightness" + self._initDefaultConfig() + + # Helper method to map SONiC port name to index + def _port_name_to_index(self, port_name): + for port_cfg in self._port_cfgs: + if port_name == port_cfg.name: + macs = [int(x) for x in (port_cfg.lanes.split(','))] + led = self.mac_to_led[min(macs)] + if led < 0: + return None + return led + return None + + def _port_state_to_mode(self, port_idx, state): + if state == "up": + return self.LED_MODE_UP[1] if port_idx >= 48 else self.LED_MODE_UP[0] + else: + return self.LED_MODE_DOWN[1] if port_idx >= 48 else self.LED_MODE_DOWN[0] + + def _port_led_mode_update(self, port_idx, ledMode): + with open(self.f_led.format("port{}".format(port_idx)), 'w') as led_file: + led_file.write(str(ledMode)) + + def _initSystemLed(self): + try: + with open(self.f_led.format("system"), 'w') as led_file: + led_file.write("1") + DBG_PRINT("init system led to normal") + with open(self.f_led.format("idn"), 'w') as led_file: + led_file.write("1") + DBG_PRINT("init idn led to off") + except IOError as e: + DBG_PRINT(str(e)) + + def _initPanelLed(self): + with open(self.f_led.format("port1"), 'r') as led_file: + shouldInit = (int(led_file.read()) == 0) + + if shouldInit == True: + for port_cfg in self._port_cfgs: + macs = [int(x) for x in (port_cfg.lanes.split(','))] + led = self.mac_to_led[min(macs)] + if led < 0: + continue + defmode = self._port_state_to_mode(led, "down") + with open(self.f_led.format("port{}".format(led)), 'w') as led_file: + led_file.write(str(defmode)) + DBG_PRINT("init port{} led to mode={}".format(led, defmode)) + + def _initDefaultConfig(self): + DBG_PRINT("start init led") + + self._initSystemLed() + self._initPanelLed() + + DBG_PRINT("init led done") + + # Concrete implementation of port_link_state_change() method + def port_link_state_change(self, portname, state): + port_idx = self._port_name_to_index(portname) + if port_idx is None: + return + ledMode = self._port_state_to_mode(port_idx, state) + with open(self.f_led.format("port{}".format(port_idx)), 'r') as led_file: + saveMode = int(led_file.read()) + + if ledMode == saveMode: + return + + self._port_led_mode_update(port_idx, ledMode) + DBG_PRINT("update {} led mode from {} to {}".format(portname, saveMode, ledMode)) diff --git a/device/centec/x86_64-centec_v682_48y8c_d-r0/plugins/sfputil.py b/device/centec/x86_64-centec_v682_48y8c_d-r0/plugins/sfputil.py new file mode 100644 index 000000000000..cc1bbbd285f7 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c_d-r0/plugins/sfputil.py @@ -0,0 +1,248 @@ +#!/usr/bin/env python + +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import os + import re + import time + import collections + from sonic_sfp.sfputilbase import SfpUtilBase + from sonic_py_common import device_info +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + +SFP_STATUS_INSERTED = '1' +SFP_STATUS_REMOVED = '0' +USR_SHARE_SONIC_PATH = "/usr/share/sonic" +HOST_DEVICE_PATH = USR_SHARE_SONIC_PATH + "/device" +CONTAINER_PLATFORM_PATH = USR_SHARE_SONIC_PATH + "/platform" + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + def __init__(self): + self.mac_to_sfp = { + 32 : 0, + 33 : 1, + 34 : 2, + 35 : 3, + 0 : 4, + 4 : 5, + 8 : 6, + 12 : 7, + 16 : 8, + 20 : 9, + 24 : 10, + 28 : 11, + 40 : 12, + 44 : 13, + 48 : 14, + 52 : 15, + 56 : 16, + 60 : 17, + 64 : 18, + 68 : 19, + 72 : 20, + 73 : 21, + 74 : 22, + 75 : 23, + 232: 24, + 233: 25, + 234: 26, + 235: 27, + 200: 28, + 204: 29, + 208: 30, + 212: 31, + 216: 32, + 220: 33, + 224: 34, + 228: 35, + 160: 36, + 164: 37, + 168: 38, + 172: 39, + 176: 40, + 180: 41, + 184: 42, + 188: 43, + 192: 44, + 193: 45, + 194: 46, + 195: 47, + 120: 48, + 121: 48, + 122: 48, + 123: 48, + 124: 49, + 125: 49, + 126: 49, + 127: 49, + 80 : 50, + 81 : 50, + 82 : 50, + 83 : 50, + 84 : 51, + 85 : 51, + 86 : 51, + 87 : 51, + 240: 52, + 241: 52, + 242: 52, + 243: 52, + 244: 53, + 245: 53, + 246: 53, + 247: 53, + 280: 54, + 281: 54, + 282: 54, + 283: 54, + 284: 55, + 285: 55, + 286: 55, + 287: 55, + } + self.logical = [] + self.physical_to_logical = {} + self.logical_to_physical = {} + self.logical_to_asic = {} + self.data = {'valid':0, 'last':0} + self.f_sfp_present = "/sys/class/sfp/sfp{}/sfp_presence" + self.f_sfp_enable = "/sys/class/sfp/sfp{}/sfp_enable" + + if os.path.isdir(CONTAINER_PLATFORM_PATH): + platform_path = CONTAINER_PLATFORM_PATH + else: + platform = device_info.get_platform() + if platform is None: + raise + platform_path = os.path.join(HOST_DEVICE_PATH, platform) + + port_config_file = "/".join([platform_path, "V682-48y8c-d", "port_config.ini"]) + try: + f = open(port_config_file) + except: + raise + for line in f: + line.strip() + if re.search('^#', line) is not None: + Port_cfg = collections.namedtuple('Port_cfg', line.split()[1:]) + break + f.close() + f = open(port_config_file) + self._port_cfgs = [Port_cfg(*tuple((line.strip().split()))) + for line in f if re.search('^#', line) is None] + f.close() + + self.PORT_START = 256 + self.PORT_END = 0 + for port_cfg in self._port_cfgs: + if int(port_cfg.index) <= self.PORT_START: + self.PORT_START = int(port_cfg.index) + elif int(port_cfg.index) >= self.PORT_END: + self.PORT_END = int(port_cfg.index) + + self.eeprom_mapping = {} + self.presence = {} + for port_cfg in self._port_cfgs: + sfp_idx = self.mac_to_sfp[int(port_cfg.lanes.split(',')[0])] + if sfp_idx >= 0: + self.eeprom_mapping[int(port_cfg.index)] = "/sys/class/sfp/sfp{}/sfp_eeprom".format(sfp_idx) + self.logical.append(port_cfg.name) + else: + self.eeprom_mapping[int(port_cfg.index)] = None + self.presence[int(port_cfg.index)] = False + + SfpUtilBase.__init__(self) + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def sfp_base(self): + return self.PORT_START + + @property + def qsfp_ports(self): + start = 256 + end = 0 + for port_cfg in self._port_cfgs: + sfp_idx = self.mac_to_sfp[int(port_cfg.lanes.split(',')[0])] + if sfp_idx >= 48: + if int(port_cfg.index) <= start: + start = int(port_cfg.index) + elif int(port_cfg.index) >= end: + end = int(port_cfg.index) + return range(start, end + 1) + + @property + def port_to_eeprom_mapping(self): + return self.eeprom_mapping + + def is_logical_port(self, port_name): + return True + + def get_presence(self, port_num): + for port_cfg in self._port_cfgs: + if int(port_cfg.index) == port_num: + sfp_idx = self.mac_to_sfp[int(port_cfg.lanes.split(',')[0])] + if sfp_idx >= 0: + try: + with open(self.f_sfp_present.format(sfp_idx), 'r') as sfp_file: + return 1 == int(sfp_file.read()) + except IOError as e: + DBG_PRINT(str(e)) + return False + + def get_low_power_mode(self, port_num): + return False + + def set_low_power_mode(self, port_num, lpmode): + return False + + def reset(self, port_num): + return False + + def read_porttab_mappings(self, porttabfile, asic_inst = 0): + for port_cfg in self._port_cfgs: + self.logical_to_physical[port_cfg.name] = [int(port_cfg.index)] + self.logical_to_asic[port_cfg.name] = 0 + self.physical_to_logical[int(port_cfg.index)] = [port_cfg.name] + + def get_transceiver_change_event(self, timeout=2000): + now = time.time() + port_dict = {} + + if timeout < 1000: + timeout = 1000 + timeout = (timeout) / float(1000) # Convert to secs + + if now < (self.data['last'] + timeout) and self.data['valid']: + return True, {} + + for port_cfg in self._port_cfgs: + presence = self.get_presence(int(port_cfg.index)) + if presence != self.presence[int(port_cfg.index)]: + self.presence[int(port_cfg.index)] = presence + if presence: + port_dict[int(port_cfg.index)] = SFP_STATUS_INSERTED + else: + port_dict[int(port_cfg.index)] = SFP_STATUS_REMOVED + + if bool(port_dict): + self.data['last'] = now + self.data['valid'] = 1 + return True, port_dict + else: + time.sleep(0.5) + return True, {} diff --git a/device/centec/x86_64-centec_v682_48y8c_d-r0/pmon_daemon_control.json b/device/centec/x86_64-centec_v682_48y8c_d-r0/pmon_daemon_control.json new file mode 100644 index 000000000000..44a5ed9bb0d9 --- /dev/null +++ b/device/centec/x86_64-centec_v682_48y8c_d-r0/pmon_daemon_control.json @@ -0,0 +1,7 @@ +{ + "skip_fancontrol": true, + "skip_psud": true, + "skip_pcied": true, + "skip_thermalctld": true, + "skip_syseepromd": true +} diff --git a/device/centec/x86_64-ew_es6220_x48q2h4-r0/platform_asic b/device/centec/x86_64-ew_es6220_x48q2h4-r0/platform_asic new file mode 100644 index 000000000000..74dac3505ea6 --- /dev/null +++ b/device/centec/x86_64-ew_es6220_x48q2h4-r0/platform_asic @@ -0,0 +1 @@ +centec diff --git a/device/cig/x86_64-cig_cs5435_54p-r0/platform_asic b/device/cig/x86_64-cig_cs5435_54p-r0/platform_asic new file mode 100644 index 000000000000..4211b60b9cea --- /dev/null +++ b/device/cig/x86_64-cig_cs5435_54p-r0/platform_asic @@ -0,0 +1 @@ +nephos diff --git a/device/cig/x86_64-cig_cs6436_54p-r0/platform_asic b/device/cig/x86_64-cig_cs6436_54p-r0/platform_asic new file mode 100644 index 000000000000..4211b60b9cea --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_54p-r0/platform_asic @@ -0,0 +1 @@ +nephos diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/platform_asic b/device/cig/x86_64-cig_cs6436_56p-r0/platform_asic new file mode 100644 index 000000000000..4211b60b9cea --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/platform_asic @@ -0,0 +1 @@ +nephos diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000-Q20S48/td2-s6000-20x40G-48x10G.config.bcm b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000-Q20S48/td2-s6000-20x40G-48x10G.config.bcm index ca155cb83041..55b5782d40ed 100755 --- a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000-Q20S48/td2-s6000-20x40G-48x10G.config.bcm +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000-Q20S48/td2-s6000-20x40G-48x10G.config.bcm @@ -10,6 +10,9 @@ ipv6_lpm_128b_enable=1 l2_mem_entries=32768 l3_mem_entries=16384 +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000-Q24S32/td2-s6000-24x40G-32x10G.config.bcm b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000-Q24S32/td2-s6000-24x40G-32x10G.config.bcm index 32d86d8474b3..ab5222bda7b7 100755 --- a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000-Q24S32/td2-s6000-24x40G-32x10G.config.bcm +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000-Q24S32/td2-s6000-24x40G-32x10G.config.bcm @@ -10,6 +10,9 @@ ipv6_lpm_128b_enable=1 l2_mem_entries=32768 l3_mem_entries=16384 +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000-Q28S16/td2-s6000-28x40G-16x10G.config.bcm b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000-Q28S16/td2-s6000-28x40G-16x10G.config.bcm index af18c034fdd2..ad97f97f94bf 100755 --- a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000-Q28S16/td2-s6000-28x40G-16x10G.config.bcm +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000-Q28S16/td2-s6000-28x40G-16x10G.config.bcm @@ -10,6 +10,9 @@ ipv6_lpm_128b_enable=1 l2_mem_entries=32768 l3_mem_entries=16384 +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/td2-s6000-32x40G.config.bcm b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/td2-s6000-32x40G.config.bcm index 2626674d67ca..4f68aa896dd8 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/td2-s6000-32x40G.config.bcm +++ b/device/dell/x86_64-dell_s6000_s1220-r0/Force10-S6000/td2-s6000-32x40G.config.bcm @@ -10,6 +10,9 @@ ipv6_lpm_128b_enable=1 l2_mem_entries=32768 l3_mem_entries=16384 +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/platform.json b/device/dell/x86_64-dell_s6000_s1220-r0/platform.json index 62a53fe328fc..283906c407e0 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/platform.json +++ b/device/dell/x86_64-dell_s6000_s1220-r0/platform.json @@ -1,6 +1,10 @@ { "chassis": { "name": "S6000", + "status_led": { + "controllable": true, + "colors": ["amber", "blinking amber", "green", "blinking green"] + }, "components": [ { "name": "BIOS" @@ -17,55 +21,151 @@ ], "fans": [ { - "name": "FanTray1-Fan1" - }, - { - "name": "FanTray1-Fan2" - }, - { - "name": "FanTray2-Fan1" - }, - { - "name": "FanTray2-Fan2" - }, - { - "name": "FanTray3-Fan1" - }, - { - "name": "FanTray3-Fan2" + "name": "FanTray1-Fan1", + "speed": { + "controllable": true, + "minimum": 40 + }, + "status_led": { + "available": false + } + }, + { + "name": "FanTray1-Fan2", + "speed": { + "controllable": true, + "minimum": 40 + }, + "status_led": { + "available": false + } + }, + { + "name": "FanTray2-Fan1", + "speed": { + "controllable": true, + "minimum": 40 + }, + "status_led": { + "available": false + } + }, + { + "name": "FanTray2-Fan2", + "speed": { + "controllable": true, + "minimum": 40 + }, + "status_led": { + "available": false + } + }, + { + "name": "FanTray3-Fan1", + "speed": { + "controllable": true, + "minimum": 40 + }, + "status_led": { + "available": false + } + }, + { + "name": "FanTray3-Fan2", + "speed": { + "controllable": true, + "minimum": 40 + }, + "status_led": { + "available": false + } } ], "fan_drawers":[ { "name": "FanTray1", + "status_led": { + "controllable": true, + "colors": ["amber", "green", "off"] + }, "fans": [ { - "name": "FanTray1-Fan1" + "name": "FanTray1-Fan1", + "speed": { + "controllable": true, + "minimum": 40 + }, + "status_led": { + "available": false + } }, { - "name": "FanTray1-Fan2" + "name": "FanTray1-Fan2", + "speed": { + "controllable": true, + "minimum": 40 + }, + "status_led": { + "available": false + } } ] }, { "name": "FanTray2", + "status_led": { + "controllable": true, + "colors": ["amber", "green", "off"] + }, "fans": [ { - "name": "FanTray2-Fan1" + "name": "FanTray2-Fan1", + "speed": { + "controllable": true, + "minimum": 40 + }, + "status_led": { + "available": false + } }, { - "name": "FanTray2-Fan2" + "name": "FanTray2-Fan2", + "speed": { + "controllable": true, + "minimum": 40 + }, + "status_led": { + "available": false + } } ] }, { "name": "FanTray3", + "status_led": { + "controllable": true, + "colors": ["amber", "green", "off"] + }, "fans": [ { - "name": "FanTray3-Fan1" + "name": "FanTray3-Fan1", + "speed": { + "controllable": true, + "minimum": 40 + }, + "status_led": { + "available": false + } }, { - "name": "FanTray3-Fan2" + "name": "FanTray3-Fan2", + "speed": { + "controllable": true, + "minimum": 40 + }, + "status_led": { + "available": false + } } ] } @@ -73,55 +173,125 @@ "psus": [ { "name": "PSU1", + "status_led": { + "controllable": false + }, "fans": [ { - "name": "PSU1 Fan" + "name": "PSU1 Fan", + "speed": { + "controllable": true, + "minimum": 40 + }, + "status_led": { + "available": false + } } ], "thermals": [ { - "name": "PSU1-Sensor 1" + "name": "PSU1-Sensor 1", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false }, { - "name": "PSU1-Sensor 2" + "name": "PSU1-Sensor 2", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false } ] }, { "name": "PSU2", + "status_led": { + "controllable": false + }, "fans": [ { - "name": "PSU2 Fan" + "name": "PSU2 Fan", + "speed": { + "controllable": true, + "minimum": 40 + }, + "status_led": { + "available": false + } } ], "thermals": [ { - "name": "PSU2-Sensor 1" + "name": "PSU2-Sensor 1", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false }, { - "name": "PSU2-Sensor 2" + "name": "PSU2-Sensor 2", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false } ] } ], "thermals": [ { - "name": "ASIC On-board" + "name": "ASIC On-board", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false }, { - "name": "NIC" + "name": "NIC", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false }, { - "name": "System Front" + "name": "System Front", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false }, { - "name": "DIMM" + "name": "DIMM", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false }, { - "name": "CPU Core 0" + "name": "CPU Core 0", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false }, { - "name": "CPU Core 1" + "name": "CPU Core 1", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false } ], "modules": [], diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/platform_asic b/device/dell/x86_64-dell_s6000_s1220-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py b/device/dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py index f03415cbc7ea..8d8892fdce70 100644 --- a/device/dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py +++ b/device/dell/x86_64-dell_s6000_s1220-r0/plugins/sfputil.py @@ -6,6 +6,7 @@ try: import time import datetime + import fcntl from sonic_sfp.sfputilbase import SfpUtilBase except ImportError as e: raise ImportError("%s - required module not found" % str(e)) @@ -19,6 +20,7 @@ class SfpUtil(SfpUtilBase): PORTS_IN_BLOCK = 32 EEPROM_OFFSET = 20 + SFP_LOCK_FILE="/etc/sonic/sfp_lock" _port_to_eeprom_mapping = {} port_dict = {} @@ -72,10 +74,19 @@ def get_presence(self, port_num): if port_num < self.port_start or port_num > self.port_end: return False + try: + fd = open(self.SFP_LOCK_FILE, "r") + except IOError as e: + print("Error: unable to open file: "+ str(e)) + return False + fcntl.flock(fd, fcntl.LOCK_EX) + self.set_modsel(port_num) + try: reg_file = open("/sys/devices/platform/dell-s6000-cpld.0/qsfp_modprs") except IOError as e: print("Error: unable to open file: %s" % str(e)) + fcntl.flock(fd, fcntl.LOCK_UN) return False content = reg_file.readline().rstrip() @@ -85,13 +96,102 @@ def get_presence(self, port_num): # Mask off the bit corresponding to our port mask = (1 << port_num) - + fcntl.flock(fd, fcntl.LOCK_UN) # ModPrsL is active low if reg_value & mask == 0: return True return False + def get_modsel(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/dell-s6000-cpld.0/qsfp_modsel") + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + + if reg_value & mask == 1: + return False + + return True + + def set_modsel(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/devices/platform/dell-s6000-cpld.0/qsfp_modsel", "r+") + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + + content = reg_file.readline().rstrip() + + # content is a string containing the hex representation of the register + reg_value = int(content, 16) + + # Mask off the bit corresponding to our port + mask = (1 << port_num) + reg_value = reg_value | int("0xffffffff", 16) + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + content = hex(reg_value) + + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True + + def get_eeprom_raw(self, port_num, num_bytes=256): + # Read interface id EEPROM at addr 0x50 + try: + fd = open(self.SFP_LOCK_FILE, "r") + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return None + fcntl.flock(fd, fcntl.LOCK_EX) + self.set_modsel(port_num) + eeprom_bytes = self._read_eeprom_devid(port_num, self.IDENTITY_EEPROM_ADDR, 0, num_bytes) + fcntl.flock(fd, fcntl.LOCK_UN) + return eeprom_bytes + + def get_eeprom_dom_raw(self, port_num): + if port_num in self.osfp_ports: + return None + if port_num in self.qsfp_ports: + # QSFP DOM EEPROM is also at addr 0x50 and thus also stored in eeprom_ifraw + return None + else: + # Read dom eeprom at addr 0x51 + if not self.get_modsel(port_num): + try: + fd = open(self.SFP_LOCK_FILE, "r") + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return None + fcntl.flock(fd, fcntl.LOCK_EX) + self.set_modsel(port_num) + eeprom_bytes = self._read_eeprom_devid(port_num, self.DOM_EEPROM_ADDR, 0) + fcntl.flock(fd, fcntl.LOCK_UN) + return eeprom_bytes + else: + return self._read_eeprom_devid(port_num, self.DOM_EEPROM_ADDR, 0) + def get_low_power_mode(self, port_num): # Check for invalid port_num if port_num < self.port_start or port_num > self.port_end: diff --git a/device/dell/x86_64-dell_s6000_s1220-r0/thermal_policy.json b/device/dell/x86_64-dell_s6000_s1220-r0/thermal_policy.json new file mode 100644 index 000000000000..8649ef270caa --- /dev/null +++ b/device/dell/x86_64-dell_s6000_s1220-r0/thermal_policy.json @@ -0,0 +1,64 @@ +{ + "thermal_control_algorithm": { + "run_at_boot_up": "true", + "fan_speed_when_suspend": "80" + }, + "info_types": [ + { + "type": "chassis_info" + }, + { + "type": "fandrawer_info" + }, + { + "type": "psu_fan_info" + } + ], + "policies": [ + { + "name": "over temperature", + "conditions" : [ + { + "type": "chassis.over_temperature" + } + ], + "actions": [ + { + "type": "chassis.thermal_shutdown" + } + ] + }, + { + "name": "any fandrawer fault", + "conditions": [ + { + "type": "fandrawer.any.fault" + } + ], + "actions": [ + { + "type": "fan.all.set_max_speed" + }, + { + "type": "fandrawer.fault.set_status_led" + } + ] + }, + { + "name": "all fandrawer normal", + "conditions": [ + { + "type": "fandrawer.all.normal" + } + ], + "actions": [ + { + "type": "fan.all.set_thermal_level_speed" + }, + { + "type": "fandrawer.normal.set_status_led" + } + ] + } + ] +} diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/port_config.ini b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/port_config.ini index 1922a3e04b5a..54809b2c957a 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/port_config.ini +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/port_config.ini @@ -63,3 +63,5 @@ Ethernet60 81,82 fortyGigE1/4/13 60 40000 Ethernet61 83,84 fortyGigE1/4/14 61 40000 Ethernet62 85,86 fortyGigE1/4/15 62 40000 Ethernet63 87,88 fortyGigE1/4/16 63 40000 +Ethernet64 129 tenGigE1/1 64 10000 +Ethernet65 131 tenGigE1/2 65 10000 diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t0.config.bcm b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t0.config.bcm index dac4967f8a5f..e1eb6968df68 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t0.config.bcm +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t0.config.bcm @@ -1,4 +1,8 @@ #TH S6100 64x40 + +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 @@ -30,6 +34,8 @@ os=unix parity_correction=1 parity_enable=1 +port_phy_addr_66=0x176 +port_phy_addr_100=0x177 xgxs_tx_lane_map_104=0x3210 xgxs_rx_lane_map_104=0x0312 phy_xaui_tx_polarity_flip_104=0x0 @@ -341,6 +347,9 @@ phy_xaui_rx_polarity_flip_79=0x3 dport_map_port_78=63 dport_map_port_79=64 pbmp_xport_xe=0x3fffd0000ffff40003fffc0001fffe + +portmap_66=129:10 +portmap_100=131:10 portmap_33=132:10 portmap_67=133:10 portmap_101=134:10 @@ -409,5 +418,7 @@ portmap_114=121:40:2 portmap_115=123:40:2 portmap_116=125:40:2 portmap_117=127:40:2 +dport_map_port_66=65 +dport_map_port_100=66 mmu_init_config="MSFT-TH-Tier0" diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t1.config.bcm b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t1.config.bcm index 20234ea9a66c..87c90323d5b1 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t1.config.bcm +++ b/device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/th-s6100-64x40G-t1.config.bcm @@ -1,4 +1,8 @@ #TH S6100 64x40 + +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 @@ -30,6 +34,8 @@ os=unix parity_correction=1 parity_enable=1 +port_phy_addr_66=0x176 +port_phy_addr_100=0x177 xgxs_tx_lane_map_104=0x3210 xgxs_rx_lane_map_104=0x0312 phy_xaui_tx_polarity_flip_104=0x0 @@ -341,6 +347,9 @@ phy_xaui_rx_polarity_flip_79=0x3 dport_map_port_78=63 dport_map_port_79=64 pbmp_xport_xe=0x3fffd0000ffff40003fffc0001fffe + +portmap_66=129:10 +portmap_100=131:10 portmap_33=132:10 portmap_67=133:10 portmap_101=134:10 @@ -409,5 +418,7 @@ portmap_114=121:40:2 portmap_115=123:40:2 portmap_116=125:40:2 portmap_117=127:40:2 +dport_map_port_66=65 +dport_map_port_100=66 mmu_init_config="MSFT-TH-Tier1" diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/installer.conf b/device/dell/x86_64-dell_s6100_c2538-r0/installer.conf index 0932d0637760..87ea9d31bb18 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/installer.conf +++ b/device/dell/x86_64-dell_s6100_c2538-r0/installer.conf @@ -1,3 +1,3 @@ CONSOLE_PORT=0x2f8 CONSOLE_DEV=1 -ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="module_blacklist=gpio_ich nos-config-part=/dev/sda12" +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="module_blacklist=gpio_ich,wdat_wdt acpi_no_watchdog=1 nos-config-part=/dev/sda12" diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/platform.json b/device/dell/x86_64-dell_s6100_c2538-r0/platform.json index 24e32b16bb15..e9fbeaeff804 100644 --- a/device/dell/x86_64-dell_s6100_c2538-r0/platform.json +++ b/device/dell/x86_64-dell_s6100_c2538-r0/platform.json @@ -1,61 +1,129 @@ { "chassis": { "name": "S6100-ON", + "status_led": { + "controllable": true, + "colors": ["amber", "blinking amber", "green", "blinking green"] + }, + "thermal_manager" : false, "components": [ { "name": "BIOS" }, + { + "name": "FPGA" + }, { "name": "CPLD" }, { - "name": "FPGA" + "name": "SSD" } ], "fans": [ { - "name": "FanTray1-Fan1" - }, - { - "name": "FanTray2-Fan1" - }, - { - "name": "FanTray3-Fan1" - }, - { - "name": "FanTray4-Fan1" + "name": "FanTray1-Fan1", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } + }, + { + "name": "FanTray2-Fan1", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } + }, + { + "name": "FanTray3-Fan1", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } + }, + { + "name": "FanTray4-Fan1", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } } ], "fan_drawers":[ { "name": "FanTray1", + "status_led": { + "controllable": false + }, "fans": [ { - "name": "FanTray1-Fan1" + "name": "FanTray1-Fan1", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } } ] }, { "name": "FanTray2", + "status_led": { + "controllable": false + }, "fans": [ { - "name": "FanTray2-Fan1" + "name": "FanTray2-Fan1", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } } ] }, { "name": "FanTray3", + "status_led": { + "controllable": false + }, "fans": [ { - "name": "FanTray3-Fan1" + "name": "FanTray3-Fan1", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } } ] }, { "name": "FanTray4", + "status_led": { + "controllable": false + }, "fans": [ { - "name": "FanTray4-Fan1" + "name": "FanTray4-Fan1", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } } ] } @@ -63,51 +131,113 @@ "psus": [ { "name": "PSU1", + "status_led": { + "controllable": false + }, "fans": [ { - "name": "PSU1 Fan" + "name": "PSU1 Fan", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } } ] }, { "name": "PSU2", + "status_led": { + "controllable": false + }, "fans": [ { - "name": "PSU2 Fan" + "name": "PSU2 Fan", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } } ] } ], "thermals": [ { - "name": "CPU On-board" + "name": "CPU On-board", + "controllable": false, + "low-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false }, { - "name": "ASIC On-board Front" + "name": "ASIC On-board Front", + "controllable": false, + "low-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false }, { - "name": "System Front" + "name": "System Front", + "controllable": false, + "low-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false }, { - "name": "ASIC On-board Rear" + "name": "ASIC On-board Rear", + "controllable": false, + "low-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false }, { - "name": "Front GE board" + "name": "Front GE board", + "controllable": false, + "low-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false }, { - "name": "Front SFP+ board" + "name": "Front SFP+ board", + "controllable": false, + "low-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false }, { - "name": "CPU Core 0" + "name": "CPU Core 0", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false }, { - "name": "CPU Core 1" + "name": "CPU Core 1", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false }, { - "name": "CPU Core 2" + "name": "CPU Core 2", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false }, { - "name": "CPU Core 3" + "name": "CPU Core 3", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false } ], "modules": [ diff --git a/device/dell/x86_64-dell_s6100_c2538-r0/platform_asic b/device/dell/x86_64-dell_s6100_c2538-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/dell/x86_64-dell_s6100_c2538-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/dell/x86_64-dell_z9100_c2538-r0/platform_asic b/device/dell/x86_64-dell_z9100_c2538-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/dell/x86_64-dell_z9100_c2538-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/installer.conf b/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/installer.conf index 8e3add013c31..26e95228d292 100644 --- a/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/installer.conf +++ b/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/installer.conf @@ -1,3 +1,4 @@ CONSOLE_PORT=0x3f8 CONSOLE_DEV=0 VAR_LOG_SIZE=512 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="intel_iommu=off" diff --git a/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/platform_asic b/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/dell/x86_64-dellemc_n3248te_c3338-r0/installer.conf b/device/dell/x86_64-dellemc_n3248te_c3338-r0/installer.conf index 8e3add013c31..26e95228d292 100644 --- a/device/dell/x86_64-dellemc_n3248te_c3338-r0/installer.conf +++ b/device/dell/x86_64-dellemc_n3248te_c3338-r0/installer.conf @@ -1,3 +1,4 @@ CONSOLE_PORT=0x3f8 CONSOLE_DEV=0 VAR_LOG_SIZE=512 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="intel_iommu=off" diff --git a/device/dell/x86_64-dellemc_n3248te_c3338-r0/platform.json b/device/dell/x86_64-dellemc_n3248te_c3338-r0/platform.json new file mode 100644 index 000000000000..0bb2391ca3df --- /dev/null +++ b/device/dell/x86_64-dellemc_n3248te_c3338-r0/platform.json @@ -0,0 +1,350 @@ +{ + "chassis": { + "name": "N3248TE-ON", + "status_led": { + "controllable": true, + "colors": ["green", "blink_green", "yellow", "blink_yellow"] + }, + "thermal_manager" : false, + "components": [ + { + "name": "BIOS" + }, + { + "name": "CPU CPLD" + }, + { + "name": "SYS CPLD" + } + ], + "fans": [ + { + "name": "FanTray1-Fan1", + "speed": { + "controllable":false + }, + "status_led": { + "available": false + } + }, + { + "name": "FanTray2-Fan1", + "speed": { + "controllable":false + }, + "status_led": { + "available": false + } + }, + { + "name": "FanTray3-Fan1", + "speed": { + "controllable":false + }, + "status_led": { + "available": false + } + } + ], + "fan_drawers":[ + { + "name": "FanTray1", + "status_led": { + "controllable": true, + "colors": ["off", "green", "yellow"] + }, + "fans": [ + { + "name": "FanTray1-Fan1", + "speed": { + "controllable":false + }, + "status_led": { + "available": false + } + } + ] + }, + { + "name": "FanTray2", + "status_led": { + "controllable": true, + "colors": ["off", "green", "yellow"] + }, + "fans": [ + { + "name": "FanTray2-Fan1", + "speed": { + "controllable":false + }, + "status_led": { + "available": false + } + } + ] + }, + { + "name": "FanTray3", + "status_led": { + "controllable": true, + "colors": ["off", "green", "yellow"] + }, + "fans": [ + { + "name": "FanTray3-Fan1", + "speed": { + "controllable":false + }, + "status_led": { + "available": false + } + } + ] + } + ], + "psus": [ + { + "name": "PSU1", + "status_led": { + "controllable": false + }, + "fans": [ + { + "name": "PSU1 Fan", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } + } + ] + }, + { + "name": "PSU2", + "status_led": { + "controllable": false + }, + "fans": [ + { + "name": "PSU2 Fan", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } + } + ] + } + ], + "thermals": [ + { + "name": "Front Panel PHY Temperature", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false + }, + { + "name": "Middle Fan Tray Temperature", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false + }, + { + "name": "Near Front Panel Temperature", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false + }, + { + "name": "Switch Near Temperature", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false + }, + { + "name": "Switch Rear Temperature", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false + } + ], + "modules": [], + "sfps": [ + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "1GSFPCu" + }, + { + "name": "SFP/SFP+/SFP28" + }, + { + "name": "SFP/SFP+/SFP28" + }, + { + "name": "SFP/SFP+/SFP28" + }, + { + "name": "SFP/SFP+/SFP28" + }, + { + "name": "QSFP+ or later" + }, + { + "name": "QSFP+ or later" + } + ] + }, + "interfaces": {} +} diff --git a/device/dell/x86_64-dellemc_n3248te_c3338-r0/platform_asic b/device/dell/x86_64-dellemc_n3248te_c3338-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/dell/x86_64-dellemc_n3248te_c3338-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/dell/x86_64-dellemc_n3248te_c3338-r0/system_health_monitoring_config.json b/device/dell/x86_64-dellemc_n3248te_c3338-r0/system_health_monitoring_config.json new file mode 100644 index 000000000000..dc20d412147f --- /dev/null +++ b/device/dell/x86_64-dellemc_n3248te_c3338-r0/system_health_monitoring_config.json @@ -0,0 +1,11 @@ +{ + "services_to_ignore": [], + "devices_to_ignore": ["fan.speed","psu.temperature","psu.voltage","asic"], + "user_defined_checkers": [], + "polling_interval": 60, + "led_color": { + "fault" : "blink_yellow", + "normal" : "green", + "booting": "blink_green" + } +} diff --git a/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/buffers.json.j2 b/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/buffers.json.j2 new file mode 100644 index 000000000000..0b1cb2c541b6 --- /dev/null +++ b/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't1' %} +{%- include 'buffers_config.j2' %} diff --git a/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/buffers_defaults_t0.j2 b/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..12283a072c9a --- /dev/null +++ b/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/buffers_defaults_t0.j2 @@ -0,0 +1,37 @@ + +{%- set default_cable = '5m' %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "26531072", + "type": "ingress", + "mode": "dynamic", + "xoff": "6291456" + }, + "egress_lossless_pool": { + "size": "32822528", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "mode": "static", + "static_th":"32822528" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "mode": "dynamic", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/buffers_defaults_t1.j2 b/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..ca0528e61465 --- /dev/null +++ b/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/buffers_defaults_t1.j2 @@ -0,0 +1,37 @@ + +{%- set default_cable = '40m' %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "26531072", + "type": "ingress", + "mode": "dynamic", + "xoff": "6291456" + }, + "egress_lossless_pool": { + "size": "32822528", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "mode": "static", + "static_th":"32822528" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "mode": "dynamic", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/custom_led.bin b/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/custom_led.bin new file mode 100755 index 000000000000..e567f1bcd94d Binary files /dev/null and b/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/custom_led.bin differ diff --git a/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/linkscan_led_fw.bin b/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/linkscan_led_fw.bin new file mode 100755 index 000000000000..c2fa94a2d8cb Binary files /dev/null and b/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/linkscan_led_fw.bin differ diff --git a/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/pg_profile_lookup.ini b/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/pg_profile_lookup.ini new file mode 100644 index 000000000000..aedda37a8878 --- /dev/null +++ b/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 10000 5m 1248 2288 35776 -3 2288 + 25000 5m 1248 2288 53248 -3 2288 + 40000 5m 1248 2288 66560 -3 2288 + 50000 5m 1248 2288 90272 -3 2288 + 100000 5m 1248 2288 165568 -3 2288 + 10000 40m 1248 2288 37024 -3 2288 + 25000 40m 1248 2288 53248 -3 2288 + 40000 40m 1248 2288 71552 -3 2288 + 50000 40m 1248 2288 96096 -3 2288 + 100000 40m 1248 2288 177632 -3 2288 + 10000 300m 1248 2288 46176 -3 2288 + 25000 300m 1248 2288 79040 -3 2288 + 40000 300m 1248 2288 108160 -3 2288 + 50000 300m 1248 2288 141856 -3 2288 + 100000 300m 1248 2288 268736 -3 2288 diff --git a/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/port_config.ini b/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/port_config.ini new file mode 100644 index 000000000000..8e2024fa3b63 --- /dev/null +++ b/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/port_config.ini @@ -0,0 +1,16 @@ +# name lanes alias index speed +Ethernet0 29 twentyfiveGigE1/1 1 25000 +Ethernet1 30 twentyfiveGigE1/2 2 25000 +Ethernet2 31 twentyfiveGigE1/3 3 25000 +Ethernet3 32 twentyfiveGigE1/4 4 25000 +Ethernet4 33 twentyfiveGigE1/5 5 25000 +Ethernet5 34 twentyfiveGigE1/6 6 25000 +Ethernet6 35 twentyfiveGigE1/7 7 25000 +Ethernet7 36 twentyfiveGigE1/8 8 25000 +Ethernet8 37 twentyfiveGigE1/9 9 25000 +Ethernet9 38 twentyfiveGigE1/10 10 25000 +Ethernet10 39 twentyfiveGigE1/11 11 25000 +Ethernet11 40 twentyfiveGigE1/12 12 25000 +Ethernet12 41,42,43,44 hundredGigE1/13 13 100000 +Ethernet16 45,46,47,48 hundredGigE1/14 14 100000 +Ethernet20 49,50,51,52 hundredGigE1/15 15 100000 diff --git a/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/qos.json.j2 b/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/qos.json.j2 new file mode 100644 index 000000000000..3e548325ea30 --- /dev/null +++ b/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/qos.json.j2 @@ -0,0 +1 @@ +{%- include 'qos_config.j2' %} diff --git a/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/sai.profile b/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/sai.profile new file mode 100644 index 000000000000..76b84c77c9a1 --- /dev/null +++ b/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td3-s5212f-25g.config.bcm diff --git a/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/sai_preinit_cmd.soc b/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/sai_preinit_cmd.soc new file mode 100644 index 000000000000..4d62900f898f --- /dev/null +++ b/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/sai_preinit_cmd.soc @@ -0,0 +1,2 @@ +m0 load 0 0x0 /usr/share/sonic/hwsku/linkscan_led_fw.bin +m0 load 0 0x3800 /usr/share/sonic/hwsku/custom_led.bin diff --git a/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/td3-s5212f-25g.config.bcm b/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/td3-s5212f-25g.config.bcm new file mode 100644 index 000000000000..cad532bd2829 --- /dev/null +++ b/device/dell/x86_64-dellemc_s5212f_c3538-r0/DellEMC-S5212f-P-25G/td3-s5212f-25g.config.bcm @@ -0,0 +1,159 @@ +portmap_1.0=29:25 +portmap_2.0=30:25 +portmap_3.0=31:25 +portmap_4.0=32:25 +portmap_5.0=33:25 +portmap_6.0=34:25 +portmap_7.0=35:25 +portmap_8.0=36:25 +portmap_9.0=37:25 +portmap_10.0=38:25 +portmap_11.0=39:25 +portmap_12.0=40:25 +portmap_33.0=41:100 +portmap_37.0=45:100 +portmap_41.0=49:100 +phy_chain_tx_lane_map_physical{29.0}=0x0123 +phy_chain_rx_lane_map_physical{29.0}=0x1032 +phy_chain_tx_lane_map_physical{33.0}=0x0123 +phy_chain_rx_lane_map_physical{33.0}=0x1032 +phy_chain_tx_lane_map_physical{37.0}=0x2013 +phy_chain_rx_lane_map_physical{37.0}=0x0231 +phy_chain_tx_lane_map_physical{41.0}=0x2301 +phy_chain_rx_lane_map_physical{41.0}=0x1230 +phy_chain_tx_lane_map_physical{45.0}=0x3120 +phy_chain_rx_lane_map_physical{45.0}=0x0213 +phy_chain_tx_lane_map_physical{49.0}=0x2301 +phy_chain_rx_lane_map_physical{49.0}=0x1032 +phy_chain_tx_polarity_flip_physical{29.0}=0x1 +phy_chain_rx_polarity_flip_physical{29.0}=0x1 +phy_chain_tx_polarity_flip_physical{30.0}=0x1 +phy_chain_rx_polarity_flip_physical{30.0}=0x1 +phy_chain_tx_polarity_flip_physical{31.0}=0x1 +phy_chain_rx_polarity_flip_physical{31.0}=0x1 +phy_chain_tx_polarity_flip_physical{32.0}=0x1 +phy_chain_rx_polarity_flip_physical{32.0}=0x1 +phy_chain_tx_polarity_flip_physical{33.0}=0x1 +phy_chain_rx_polarity_flip_physical{33.0}=0x1 +phy_chain_tx_polarity_flip_physical{34.0}=0x1 +phy_chain_rx_polarity_flip_physical{34.0}=0x1 +phy_chain_tx_polarity_flip_physical{35.0}=0x1 +phy_chain_rx_polarity_flip_physical{35.0}=0x1 +phy_chain_tx_polarity_flip_physical{36.0}=0x1 +phy_chain_rx_polarity_flip_physical{36.0}=0x1 +phy_chain_tx_polarity_flip_physical{37.0}=0x0 +phy_chain_rx_polarity_flip_physical{37.0}=0x0 +phy_chain_tx_polarity_flip_physical{38.0}=0x1 +phy_chain_rx_polarity_flip_physical{38.0}=0x1 +phy_chain_tx_polarity_flip_physical{39.0}=0x1 +phy_chain_rx_polarity_flip_physical{39.0}=0x1 +phy_chain_tx_polarity_flip_physical{40.0}=0x0 +phy_chain_rx_polarity_flip_physical{40.0}=0x0 +phy_chain_tx_polarity_flip_physical{41.0}=0x0 +phy_chain_rx_polarity_flip_physical{41.0}=0x1 +phy_chain_tx_polarity_flip_physical{42.0}=0x1 +phy_chain_rx_polarity_flip_physical{42.0}=0x1 +phy_chain_tx_polarity_flip_physical{43.0}=0x1 +phy_chain_rx_polarity_flip_physical{43.0}=0x0 +phy_chain_tx_polarity_flip_physical{44.0}=0x0 +phy_chain_rx_polarity_flip_physical{44.0}=0x1 +phy_chain_tx_polarity_flip_physical{45.0}=0x1 +phy_chain_rx_polarity_flip_physical{45.0}=0x1 +phy_chain_tx_polarity_flip_physical{46.0}=0x1 +phy_chain_rx_polarity_flip_physical{46.0}=0x1 +phy_chain_tx_polarity_flip_physical{47.0}=0x0 +phy_chain_rx_polarity_flip_physical{47.0}=0x0 +phy_chain_tx_polarity_flip_physical{48.0}=0x0 +phy_chain_rx_polarity_flip_physical{48.0}=0x0 +phy_chain_tx_polarity_flip_physical{49.0}=0x0 +phy_chain_rx_polarity_flip_physical{49.0}=0x0 +phy_chain_tx_polarity_flip_physical{50.0}=0x1 +phy_chain_rx_polarity_flip_physical{50.0}=0x0 +phy_chain_tx_polarity_flip_physical{51.0}=0x1 +phy_chain_rx_polarity_flip_physical{51.0}=0x0 +phy_chain_tx_polarity_flip_physical{52.0}=0x1 +phy_chain_rx_polarity_flip_physical{52.0}=0x1 +dport_map_port_1=1 +dport_map_port_2=2 +dport_map_port_3=3 +dport_map_port_4=4 +dport_map_port_5=5 +dport_map_port_6=6 +dport_map_port_7=7 +dport_map_port_8=8 +dport_map_port_9=9 +dport_map_port_10=10 +dport_map_port_11=11 +dport_map_port_12=12 +dport_map_port_33=13 +dport_map_port_34=14 +dport_map_port_35=15 +dport_map_port_36=16 +dport_map_port_37=17 +dport_map_port_38=18 +dport_map_port_39=19 +dport_map_port_40=20 +dport_map_port_41=21 +dport_map_port_42=22 +dport_map_port_43=23 +dport_map_port_44=24 + +pbmp_oversubscribe=0x7fff9fffffffffffffffe +pbmp_xport_xe=0x7fff9fffffffffffffffe +port_flex_enable=1 +phy_an_c73=3 +oversubscribe_mode=1 +core_clock_frequency=1525 + +l2xmsg_mode=1 + +l2xmsg_hostbuf_size=16384 +module_64ports=0 + +#Interrupts and Parity +max_vp_lags=0 + +schan_intr_enable=0 +tdma_timeout_usec=5000000 + +stable_size=0x5500000 + +#Default L3 profile +l2_mem_entries=40960 +l3_alpm_enable=2 +l3_alpm_ipv6_128b_bkt_rsvd=1 +l3_mem_entries=40960 + +#Tunnels +use_all_splithorizon_groups=1 +sai_tunnel_support=1 +bcm_tunnel_term_compatible_mode=1 + +#RIOT Enable +riot_enable=1 +riot_overlay_l3_intf_mem_size=4096 +riot_overlay_l3_egress_mem_size=32768 +l3_ecmp_levels=2 +riot_overlay_ecmp_resilient_hash_size=16384 + +#sai_preinit_cmd_file=/usr/share/sonic/hwsku/sai_preinit_cmd.soc + +#New Additions +pfc_deadlock_seq_control=1 + +#Common configs from broadcom/x86_64-broadcom_common/x86_64-broadcom_b77/broadcom-sonic-td3.config.bcm (Lower version of Td3 (0xb771)) + +mem_cache_enable=0 +ifp_inports_support_enable=1 +ipv6_lpm_128b_enable=0x1 +l3_max_ecmp_mode=1 +lpm_scaling_enable=0 +bcm_num_cos=10 +default_cpu_tx_queue=9 +mmu_lossless=0 +host_as_route_disable=1 +sai_eapp_config_file=/etc/broadcom/eapps_cfg.json +sai_fast_convergence_support=1 +flow_init_mode=1 +sai_load_hw_config=/usr/lib/cancun/ +# Reduced Trap Group QSET for BRCM Sonic diff --git a/device/dell/x86_64-dellemc_s5212f_c3538-r0/default_sku b/device/dell/x86_64-dellemc_s5212f_c3538-r0/default_sku new file mode 100644 index 000000000000..f33f15e0fee8 --- /dev/null +++ b/device/dell/x86_64-dellemc_s5212f_c3538-r0/default_sku @@ -0,0 +1 @@ +DellEMC-S5212f-P-25G t1 diff --git a/device/dell/x86_64-dellemc_s5212f_c3538-r0/installer.conf b/device/dell/x86_64-dellemc_s5212f_c3538-r0/installer.conf new file mode 100644 index 000000000000..a5d5517008b1 --- /dev/null +++ b/device/dell/x86_64-dellemc_s5212f_c3538-r0/installer.conf @@ -0,0 +1,4 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="intel_iommu=off" diff --git a/device/dell/x86_64-dellemc_s5212f_c3538-r0/led_proc_init.soc b/device/dell/x86_64-dellemc_s5212f_c3538-r0/led_proc_init.soc new file mode 100644 index 000000000000..2163487ae55f --- /dev/null +++ b/device/dell/x86_64-dellemc_s5212f_c3538-r0/led_proc_init.soc @@ -0,0 +1,9 @@ +# LED microprocessor initialization for Dell S5212 +# +# +#Led0 +led stop +#m0 load 0 0x0 /usr/share/sonic/hwsku/linkscan_led_fw.bin +m0 load 0 0x3800 /usr/share/sonic/hwsku/custom_led.bin +#led auto on +led start diff --git a/device/dell/x86_64-dellemc_s5212f_c3538-r0/platform_asic b/device/dell/x86_64-dellemc_s5212f_c3538-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/dell/x86_64-dellemc_s5212f_c3538-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/dell/x86_64-dellemc_s5212f_c3538-r0/plugins/eeprom.py b/device/dell/x86_64-dellemc_s5212f_c3538-r0/plugins/eeprom.py new file mode 100644 index 000000000000..a09ce7f3ef41 --- /dev/null +++ b/device/dell/x86_64-dellemc_s5212f_c3538-r0/plugins/eeprom.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +############################################################################# +# DellEMC S5248f +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import os.path + from sonic_eeprom import eeprom_tlvinfo +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = None + for b in (0, 1): + f = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom'.format(b) + if os.path.exists(f): + self.eeprom_path = f + break + if self.eeprom_path is None: + return + + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/dell/x86_64-dellemc_s5212f_c3538-r0/plugins/psuutil.py b/device/dell/x86_64-dellemc_s5212f_c3538-r0/plugins/psuutil.py new file mode 100644 index 000000000000..ede68a22905f --- /dev/null +++ b/device/dell/x86_64-dellemc_s5212f_c3538-r0/plugins/psuutil.py @@ -0,0 +1,50 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + def isDockerEnv(self): + num_docker = open('/proc/self/cgroup', 'r').read().count(":/docker") + return (num_docker > 0) + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + S5212F_MAX_PSUS = 2 + return S5212F_MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + # Until psu_status is implemented this is hardcoded temporarily + + return 1 + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + return 1 + diff --git a/device/dell/x86_64-dellemc_s5212f_c3538-r0/plugins/sfputil.py b/device/dell/x86_64-dellemc_s5212f_c3538-r0/plugins/sfputil.py new file mode 100644 index 000000000000..ee52d90111e6 --- /dev/null +++ b/device/dell/x86_64-dellemc_s5212f_c3538-r0/plugins/sfputil.py @@ -0,0 +1,564 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# +# For S5248F-ON, hardware version X01 + +try: + import struct + import time + import io + from sonic_sfp.sfputilbase import SfpUtilBase + from os import * + from mmap import * + from sonic_sfp.sff8436 import sff8436InterfaceId + from sonic_sfp.sff8436 import sff8436Dom + from sonic_sfp.sff8472 import sff8472Dom + +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + +#definitions of the offset and width for values in DOM info eeprom +QSFP_DOM_REV_OFFSET = 1 +QSFP_DOM_REV_WIDTH = 1 +QSFP_TEMPE_OFFSET = 22 +QSFP_TEMPE_WIDTH = 2 +QSFP_VOLT_OFFSET = 26 +QSFP_VOLT_WIDTH = 2 +QSFP_CHANNL_MON_OFFSET = 34 +QSFP_CHANNL_MON_WIDTH = 16 +QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH = 24 +QSFP_MODULE_THRESHOLD_OFFSET = 128 +QSFP_MODULE_THRESHOLD_WIDTH = 24 +QSFP_CHANNL_THRESHOLD_OFFSET = 176 +QSFP_CHANNL_THRESHOLD_WIDTH = 16 +QSFP_CHANNL_MON_MASK_OFFSET = 242 +QSFP_CHANNL_MON_MASK_WIDTH = 4 + +SFP_TEMPE_OFFSET = 96 +SFP_TEMPE_WIDTH = 2 +SFP_VOLT_OFFSET = 98 +SFP_VOLT_WIDTH = 2 +SFP_MODULE_THRESHOLD_OFFSET = 0 +SFP_MODULE_THRESHOLD_WIDTH = 56 + +XCVR_DOM_CAPABILITY_OFFSET = 92 +XCVR_DOM_CAPABILITY_WIDTH = 1 + +XCVR_EEPROM_TYPE_SFP = 1 +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + PORT_START = 1 + PORT_END = 15 + PORTS_IN_BLOCK = 15 + + BASE_RES_PATH = "/sys/bus/pci/devices/0000:03:00.0/resource0" + + _port_to_i2c_mapping = { + 1: 2, + 2: 3, + 3: 4, + 4: 5, + 5: 6, + 6: 7, + 7: 8, + 8: 9, + 9: 10, + 10: 11, + 11: 12, + 12: 13, + # QSFP28 + 13: 14, + 14: 15, + 15: 16, + } + + _port_to_eeprom_mapping = {} + + + _global_port_pres_dict = {} + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(13, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def pci_mem_read(self, mm, offset): + mm.seek(offset) + read_data_stream=mm.read(4) + reg_val=struct.unpack('I',read_data_stream) + mem_val = str(reg_val)[1:-2] + # print "reg_val read:%x"%reg_val + return mem_val + + def pci_mem_write(self, mm, offset, data): + mm.seek(offset) + # print "data to write:%x"%data + mm.write(struct.pack('I',data)) + + def pci_set_value(self, resource, val, offset): + fd = open(resource, O_RDWR) + mm = mmap(fd, 0) + val = self.pci_mem_write(mm, offset, val) + mm.close() + close(fd) + return val + + def pci_get_value(self, resource, offset): + fd = open(resource, O_RDWR) + mm = mmap(fd, 0) + val = self.pci_mem_read(mm, offset) + mm.close() + close(fd) + return val + + def init_global_port_presence(self): + for port_num in range(self.port_start, (self.port_end + 1)): + presence = self.get_presence(port_num) + if(presence): + self._global_port_pres_dict[port_num] = '1' + else: + self._global_port_pres_dict[port_num] = '0' + + def __init__(self): + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + + for x in range(self.port_start, self.port_end + 1): + self.port_to_eeprom_mapping[x] = eeprom_path.format( + self._port_to_i2c_mapping[x]) + self.init_global_port_presence() + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # Port offset starts with 0x4004 + port_offset = 16388 + ((port_num-1) * 16) + + status = self.pci_get_value(self.BASE_RES_PATH, port_offset) + reg_value = int(status) + + # Absence of status throws error + if (reg_value == "" ): + return False + + # Mask off bit for presence + mask = 1 + if (port_num > 12): + mask = (1 << 4) + + + # ModPrsL is active low + if reg_value & mask == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # Port offset starts with 0x4000 + port_offset = 16384 + ((port_num-1) * 16) + + status = self.pci_get_value(self.BASE_RES_PATH, port_offset) + reg_value = int(status) + + # Absence of status throws error + if (reg_value == "" ): + return False + + # Mask off 4th bit for presence + mask = (1 << 6) + + # LPMode is active high + if reg_value & mask == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # Port offset starts with 0x4000 + port_offset = 16384 + ((port_num-1) * 16) + + status = self.pci_get_value(self.BASE_RES_PATH, port_offset) + reg_value = int(status) + + # Absence of status throws error + if (reg_value == "" ): + return False + + # Mask off 4th bit for presence + mask = (1 << 6) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = reg_value | mask + else: + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset) + + return True + + def reset(self, port_num): + + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + # Port offset starts with 0x4000 + port_offset = 16384 + ((port_num-1) * 16) + + status = self.pci_get_value(self.BASE_RES_PATH, port_offset) + reg_value = int(status) + + # Absence of status throws error + if (reg_value == "" ): + return False + + # Mask off 4th bit for presence + mask = (1 << 6) + + # ResetL is active low + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset) + + # Sleep 1 second to allow it to settle + time.sleep(1) + + reg_value = reg_value | mask + + # Convert our register value back to a hex string and write back + self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset) + + return True + + def get_transceiver_change_event(self, timeout=0): + port_dict = {} + while True: + for port_num in range(self.port_start, (self.port_end + 1)): + presence = self.get_presence(port_num) + if(presence and self._global_port_pres_dict[port_num] == '0'): + self._global_port_pres_dict[port_num] = '1' + port_dict[port_num] = '1' + elif(not presence and + self._global_port_pres_dict[port_num] == '1'): + self._global_port_pres_dict[port_num] = '0' + port_dict[port_num] = '0' + + if(len(port_dict) > 0): + return True, port_dict + + time.sleep(0.5) + + + def get_transceiver_dom_info_dict(self, port_num): + transceiver_dom_info_dict = {} + + dom_info_dict_keys = ['temperature', 'voltage', 'rx1power', + 'rx2power', 'rx3power', 'rx4power', + 'tx1bias', 'tx2bias', 'tx3bias', + 'tx4bias', 'tx1power', 'tx2power', + 'tx3power', 'tx4power', + ] + transceiver_dom_info_dict = dict.fromkeys(dom_info_dict_keys, 'N/A') + + if port_num in self.qsfp_ports: + offset = 0 + offset_xcvr = 128 + file_path = self._get_port_eeprom_path(port_num, self.IDENTITY_EEPROM_ADDR) + if not self._sfp_eeprom_present(file_path, 0): + return None + + try: + sysfsfile_eeprom = io.open(file_path, mode="rb", buffering=0) + except IOError: + print("Error: reading sysfs file %s" % file_path) + return None + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return transceiver_dom_info_dict + + sfpi_obj = sff8436InterfaceId() + if sfpi_obj is None: + return transceiver_dom_info_dict + + # QSFP capability byte parse, through this byte can know whether it support tx_power or not. + # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, + # need to add more code for determining the capability and version compliance + # in SFF-8636 dom capability definitions evolving with the versions. + qsfp_dom_capability_raw = self._read_eeprom_specific_bytes(sysfsfile_eeprom, (offset_xcvr + XCVR_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH) + if qsfp_dom_capability_raw is not None: + qspf_dom_capability_data = sfpi_obj.parse_qsfp_dom_capability(qsfp_dom_capability_raw, 0) + else: + return transceiver_dom_info_dict + + dom_temperature_raw = self._read_eeprom_specific_bytes(sysfsfile_eeprom, (offset + QSFP_TEMPE_OFFSET), QSFP_TEMPE_WIDTH) + if dom_temperature_raw is not None: + dom_temperature_data = sfpd_obj.parse_temperature(dom_temperature_raw, 0) + else: + return transceiver_dom_info_dict + + dom_voltage_raw = self._read_eeprom_specific_bytes(sysfsfile_eeprom, (offset + QSFP_VOLT_OFFSET), QSFP_VOLT_WIDTH) + if dom_voltage_raw is not None: + dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) + else: + return transceiver_dom_info_dict + + qsfp_dom_rev_raw = self._read_eeprom_specific_bytes(sysfsfile_eeprom, (offset + QSFP_DOM_REV_OFFSET), QSFP_DOM_REV_WIDTH) + if qsfp_dom_rev_raw is not None: + qsfp_dom_rev_data = sfpd_obj.parse_sfp_dom_rev(qsfp_dom_rev_raw, 0) + else: + return transceiver_dom_info_dict + + transceiver_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] + transceiver_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] + + # The tx_power monitoring is only available on QSFP which compliant with SFF-8636 + # and claimed that it support tx_power with one indicator bit. + dom_channel_monitor_data = {} + qsfp_dom_rev = qsfp_dom_rev_data['data']['dom_rev']['value'] + qsfp_tx_power_support = qspf_dom_capability_data['data']['Tx_power_support']['value'] + if (qsfp_dom_rev[0:8] != 'SFF-8636' or (qsfp_dom_rev[0:8] == 'SFF-8636' and qsfp_tx_power_support != 'on')): + dom_channel_monitor_raw = self._read_eeprom_specific_bytes(sysfsfile_eeprom, (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params(dom_channel_monitor_raw, 0) + else: + return transceiver_dom_info_dict + + transceiver_dom_info_dict['tx1power'] = 'N/A' + transceiver_dom_info_dict['tx2power'] = 'N/A' + transceiver_dom_info_dict['tx3power'] = 'N/A' + transceiver_dom_info_dict['tx4power'] = 'N/A' + try: + sysfsfile_eeprom.close() + except IOError: + print("Error: closing sysfs file %s" % file_path) + return None + + transceiver_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] + transceiver_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] + transceiver_dom_info_dict['rx1power'] = dom_channel_monitor_data['data']['RX1Power']['value'] + transceiver_dom_info_dict['rx2power'] = dom_channel_monitor_data['data']['RX2Power']['value'] + transceiver_dom_info_dict['rx3power'] = dom_channel_monitor_data['data']['RX3Power']['value'] + transceiver_dom_info_dict['rx4power'] = dom_channel_monitor_data['data']['RX4Power']['value'] + transceiver_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TX1Bias']['value'] + transceiver_dom_info_dict['tx2bias'] = dom_channel_monitor_data['data']['TX2Bias']['value'] + transceiver_dom_info_dict['tx3bias'] = dom_channel_monitor_data['data']['TX3Bias']['value'] + transceiver_dom_info_dict['tx4bias'] = dom_channel_monitor_data['data']['TX4Bias']['value'] + + else: + offset = 256 + file_path = self._get_port_eeprom_path(port_num, self.DOM_EEPROM_ADDR) + if not self._sfp_eeprom_present(file_path, 0): + return None + + try: + sysfsfile_eeprom = io.open(file_path,"rb",0) + except IOError: + print("Error: reading sysfs file %s" % file_path) + return None + + sfpd_obj = sff8472Dom(None,1) + if sfpd_obj is None: + return transceiver_dom_info_dict + + dom_temperature_raw = self._read_eeprom_specific_bytes(sysfsfile_eeprom, (offset + SFP_TEMPE_OFFSET), + SFP_TEMPE_WIDTH) + + if dom_temperature_raw is not None: + dom_temperature_data = sfpd_obj.parse_temperature(dom_temperature_raw, 0) + else: + return transceiver_dom_info_dict + + dom_voltage_raw = self._read_eeprom_specific_bytes(sysfsfile_eeprom, (offset + SFP_VOLT_OFFSET), + SFP_VOLT_WIDTH) + if dom_voltage_raw is not None: + dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) + else: + return transceiver_dom_info_dict + + dom_channel_monitor_raw = self._read_eeprom_specific_bytes(sysfsfile_eeprom, (offset + SFP_MODULE_THRESHOLD_OFFSET), + SFP_MODULE_THRESHOLD_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params(dom_channel_monitor_raw, 0) + else: + return transceiver_dom_info_dict + + try: + sysfsfile_eeprom.close() + except IOError: + print("Error: closing sysfs file %s" % file_path) + return None + + transceiver_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] + transceiver_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] + transceiver_dom_info_dict['rx1power'] = dom_channel_monitor_data['data']['RXPower']['value'] + transceiver_dom_info_dict['rx2power'] = 'N/A' + transceiver_dom_info_dict['rx3power'] = 'N/A' + transceiver_dom_info_dict['rx4power'] = 'N/A' + transceiver_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TXBias']['value'] + transceiver_dom_info_dict['tx2bias'] = 'N/A' + transceiver_dom_info_dict['tx3bias'] = 'N/A' + transceiver_dom_info_dict['tx4bias'] = 'N/A' + transceiver_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TXPower']['value'] + transceiver_dom_info_dict['tx2power'] = 'N/A' + transceiver_dom_info_dict['tx3power'] = 'N/A' + transceiver_dom_info_dict['tx4power'] = 'N/A' + + return transceiver_dom_info_dict + + def get_transceiver_dom_threshold_info_dict(self, port_num): + transceiver_dom_threshold_info_dict = {} + dom_info_dict_keys = ['temphighalarm', 'temphighwarning', + 'templowalarm', 'templowwarning', + 'vcchighalarm', 'vcchighwarning', + 'vcclowalarm', 'vcclowwarning', + 'rxpowerhighalarm', 'rxpowerhighwarning', + 'rxpowerlowalarm', 'rxpowerlowwarning', + 'txpowerhighalarm', 'txpowerhighwarning', + 'txpowerlowalarm', 'txpowerlowwarning', + 'txbiashighalarm', 'txbiashighwarning', + 'txbiaslowalarm', 'txbiaslowwarning' + ] + transceiver_dom_threshold_info_dict = dict.fromkeys(dom_info_dict_keys, 'N/A') + + if port_num in self.qsfp_ports: + file_path = self._get_port_eeprom_path(port_num, self.IDENTITY_EEPROM_ADDR) + if not self._sfp_eeprom_present(file_path, 0): + return None + + try: + sysfsfile_eeprom = io.open(file_path, mode="rb", buffering=0) + except IOError: + print("Error: reading sysfs file %s" % file_path) + return None + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return transceiver_dom_threshold_info_dict + + # Dom Threshold data starts from offset 384 + # Revert offset back to 0 once data is retrieved + offset = 384 + dom_module_threshold_raw = self._read_eeprom_specific_bytes( + sysfsfile_eeprom, + (offset + QSFP_MODULE_THRESHOLD_OFFSET), + QSFP_MODULE_THRESHOLD_WIDTH) + if dom_module_threshold_raw is not None: + dom_module_threshold_data = sfpd_obj.parse_module_threshold_values(dom_module_threshold_raw, 0) + else: + return transceiver_dom_threshold_info_dict + + dom_channel_threshold_raw = self._read_eeprom_specific_bytes( + sysfsfile_eeprom, + (offset + QSFP_CHANNL_THRESHOLD_OFFSET), + QSFP_CHANNL_THRESHOLD_WIDTH) + if dom_channel_threshold_raw is not None: + dom_channel_threshold_data = sfpd_obj.parse_channel_threshold_values(dom_channel_threshold_raw, 0) + else: + return transceiver_dom_threshold_info_dict + + try: + sysfsfile_eeprom.close() + except IOError: + print("Error: closing sysfs file %s" % file_path) + return None + + # Threshold Data + transceiver_dom_threshold_info_dict['temphighalarm'] = dom_module_threshold_data['data']['TempHighAlarm']['value'] + transceiver_dom_threshold_info_dict['temphighwarning'] = dom_module_threshold_data['data']['TempHighWarning']['value'] + transceiver_dom_threshold_info_dict['templowalarm'] = dom_module_threshold_data['data']['TempLowAlarm']['value'] + transceiver_dom_threshold_info_dict['templowwarning'] = dom_module_threshold_data['data']['TempLowWarning']['value'] + transceiver_dom_threshold_info_dict['vcchighalarm'] = dom_module_threshold_data['data']['VccHighAlarm']['value'] + transceiver_dom_threshold_info_dict['vcchighwarning'] = dom_module_threshold_data['data']['VccHighWarning']['value'] + transceiver_dom_threshold_info_dict['vcclowalarm'] = dom_module_threshold_data['data']['VccLowAlarm']['value'] + transceiver_dom_threshold_info_dict['vcclowwarning'] = dom_module_threshold_data['data']['VccLowWarning']['value'] + transceiver_dom_threshold_info_dict['rxpowerhighalarm'] = dom_channel_threshold_data['data']['RxPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerhighwarning'] = dom_channel_threshold_data['data']['RxPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowalarm'] = dom_channel_threshold_data['data']['RxPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_channel_threshold_data['data']['RxPowerLowWarning']['value'] + transceiver_dom_threshold_info_dict['txbiashighalarm'] = dom_channel_threshold_data['data']['TxBiasHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiashighwarning'] = dom_channel_threshold_data['data']['TxBiasHighWarning']['value'] + transceiver_dom_threshold_info_dict['txbiaslowalarm'] = dom_channel_threshold_data['data']['TxBiasLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiaslowwarning'] = dom_channel_threshold_data['data']['TxBiasLowWarning']['value'] + + else: + offset = 256 + file_path = self._get_port_eeprom_path(port_num, self.DOM_EEPROM_ADDR) + if not self._sfp_eeprom_present(file_path, 0): + return None + + try: + sysfsfile_eeprom = io.open(file_path,"rb",0) + except IOError: + print("Error: reading sysfs file %s" % file_path) + return None + + sfpd_obj = sff8472Dom(None,1) + if sfpd_obj is None: + return transceiver_dom_threshold_info_dict + + dom_module_threshold_raw = self._read_eeprom_specific_bytes(sysfsfile_eeprom, + (offset + SFP_MODULE_THRESHOLD_OFFSET), SFP_MODULE_THRESHOLD_WIDTH) + + if dom_module_threshold_raw is not None: + dom_module_threshold_data = sfpd_obj.parse_alarm_warning_threshold(dom_module_threshold_raw, 0) + else: + return transceiver_dom_threshold_info_dict + + try: + sysfsfile_eeprom.close() + except IOError: + print("Error: closing sysfs file %s" % file_path) + return None + + #Threshold Data + transceiver_dom_threshold_info_dict['temphighalarm'] = dom_module_threshold_data['data']['TempHighAlarm']['value'] + transceiver_dom_threshold_info_dict['templowalarm'] = dom_module_threshold_data['data']['TempLowAlarm']['value'] + transceiver_dom_threshold_info_dict['temphighwarning'] = dom_module_threshold_data['data']['TempHighWarning']['value'] + transceiver_dom_threshold_info_dict['templowwarning'] = dom_module_threshold_data['data']['TempLowWarning']['value'] + transceiver_dom_threshold_info_dict['vcchighalarm'] = dom_module_threshold_data['data']['VoltageHighAlarm']['value'] + transceiver_dom_threshold_info_dict['vcclowalarm'] = dom_module_threshold_data['data']['VoltageLowAlarm']['value'] + transceiver_dom_threshold_info_dict['vcchighwarning'] = dom_module_threshold_data['data']['VoltageHighWarning']['value'] + transceiver_dom_threshold_info_dict['vcclowwarning'] = dom_module_threshold_data['data']['VoltageLowWarning']['value'] + transceiver_dom_threshold_info_dict['txbiashighalarm'] = dom_module_threshold_data['data']['BiasHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiaslowalarm'] = dom_module_threshold_data['data']['BiasLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiashighwarning'] = dom_module_threshold_data['data']['BiasHighWarning']['value'] + transceiver_dom_threshold_info_dict['txbiaslowwarning'] = dom_module_threshold_data['data']['BiasLowWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerhighalarm'] = dom_module_threshold_data['data']['TXPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerlowalarm'] = dom_module_threshold_data['data']['TXPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerhighwarning'] = dom_module_threshold_data['data']['TXPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerlowwarning'] = dom_module_threshold_data['data']['TXPowerLowWarning']['value'] + transceiver_dom_threshold_info_dict['rxpowerhighalarm'] = dom_module_threshold_data['data']['RXPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowalarm'] = dom_module_threshold_data['data']['RXPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerhighwarning'] = dom_module_threshold_data['data']['RXPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_module_threshold_data['data']['RXPowerLowWarning']['value'] + + return transceiver_dom_threshold_info_dict diff --git a/device/dell/x86_64-dellemc_s5212f_c3538-r0/pmon_daemon_control.json b/device/dell/x86_64-dellemc_s5212f_c3538-r0/pmon_daemon_control.json new file mode 100644 index 000000000000..0c42f485acab --- /dev/null +++ b/device/dell/x86_64-dellemc_s5212f_c3538-r0/pmon_daemon_control.json @@ -0,0 +1,4 @@ +{ + "skip_ledd": true, + "start_ipmievd": true +} diff --git a/device/dell/x86_64-dellemc_s5224f_c3538-r0/installer.conf b/device/dell/x86_64-dellemc_s5224f_c3538-r0/installer.conf index 924e0fb81963..ff014aa8c25e 100644 --- a/device/dell/x86_64-dellemc_s5224f_c3538-r0/installer.conf +++ b/device/dell/x86_64-dellemc_s5224f_c3538-r0/installer.conf @@ -1,2 +1,3 @@ CONSOLE_PORT=0x3f8 CONSOLE_DEV=0 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="intel_iommu=off" diff --git a/device/dell/x86_64-dellemc_s5224f_c3538-r0/platform_asic b/device/dell/x86_64-dellemc_s5224f_c3538-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/dell/x86_64-dellemc_s5224f_c3538-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-C32/td3-s5232f-32x100G.config.bcm b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-C32/td3-s5232f-32x100G.config.bcm index bf15510bf49b..0985bd7712cc 100644 --- a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-C32/td3-s5232f-32x100G.config.bcm +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-C32/td3-s5232f-32x100G.config.bcm @@ -1,4 +1,4 @@ -sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_issu/b870.6.4.1/ +sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ os=unix core_clock_frequency=1525 diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-C8D48/td3-s5232f-8x100G+48x50G.config.bcm b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-C8D48/td3-s5232f-8x100G+48x50G.config.bcm index 68fb77a4219f..cae03e859b83 100644 --- a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-C8D48/td3-s5232f-8x100G+48x50G.config.bcm +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-C8D48/td3-s5232f-8x100G+48x50G.config.bcm @@ -1,4 +1,4 @@ -sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_issu/b870.6.4.1/ +sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ os=unix core_clock_frequency=1525 diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-100G/td3-s5232f-32x100G.config.bcm b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-100G/td3-s5232f-32x100G.config.bcm index c44e4805c62a..164d1043644d 100644 --- a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-100G/td3-s5232f-32x100G.config.bcm +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-100G/td3-s5232f-32x100G.config.bcm @@ -1,4 +1,4 @@ -sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_issu/b870.6.4.1/ +sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ os=unix core_clock_frequency=1525 diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-10G/td3-s5232f-96x10G+8x100G.config.bcm b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-10G/td3-s5232f-96x10G+8x100G.config.bcm index 6f62b7209198..c5c6fc9c8d0c 100644 --- a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-10G/td3-s5232f-96x10G+8x100G.config.bcm +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-10G/td3-s5232f-96x10G+8x100G.config.bcm @@ -1,4 +1,4 @@ -sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_issu/b870.6.4.1/ +sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ os=unix core_clock_frequency=1525 diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-25G/td3-s5232f-96x25G+8x100G.config.bcm b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-25G/td3-s5232f-96x25G+8x100G.config.bcm index a4fccde19686..ae1995d930f1 100644 --- a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-25G/td3-s5232f-96x25G+8x100G.config.bcm +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-25G/td3-s5232f-96x25G+8x100G.config.bcm @@ -1,4 +1,4 @@ -sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_issu/b870.6.4.1/ +sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ os=unix core_clock_frequency=1525 diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/installer.conf b/device/dell/x86_64-dellemc_s5232f_c3538-r0/installer.conf index 924e0fb81963..ff014aa8c25e 100644 --- a/device/dell/x86_64-dellemc_s5232f_c3538-r0/installer.conf +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/installer.conf @@ -1,2 +1,3 @@ CONSOLE_PORT=0x3f8 CONSOLE_DEV=0 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="intel_iommu=off" diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/platform_asic b/device/dell/x86_64-dellemc_s5232f_c3538-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-10G/td3-s5248f-10g.config.bcm b/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-10G/td3-s5248f-10g.config.bcm index 021f94dc32f7..69c3d1af90d9 100644 --- a/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-10G/td3-s5248f-10g.config.bcm +++ b/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-10G/td3-s5248f-10g.config.bcm @@ -1,4 +1,4 @@ -sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_issu/b870.6.4.1/ +sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ os=unix dpp_clock_ratio=2:3 oversubscribe_mode=1 diff --git a/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/td3-s5248f-25g.config.bcm b/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/td3-s5248f-25g.config.bcm index 2630512df0ca..468b7d527989 100644 --- a/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/td3-s5248f-25g.config.bcm +++ b/device/dell/x86_64-dellemc_s5248f_c3538-r0/DellEMC-S5248f-P-25G/td3-s5248f-25g.config.bcm @@ -1,4 +1,4 @@ -sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_issu/b870.6.4.1/ +sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ os=unix dpp_clock_ratio=2:3 diff --git a/device/dell/x86_64-dellemc_s5248f_c3538-r0/installer.conf b/device/dell/x86_64-dellemc_s5248f_c3538-r0/installer.conf index 925a32fc0c3a..a5d5517008b1 100644 --- a/device/dell/x86_64-dellemc_s5248f_c3538-r0/installer.conf +++ b/device/dell/x86_64-dellemc_s5248f_c3538-r0/installer.conf @@ -1,3 +1,4 @@ CONSOLE_PORT=0x3f8 CONSOLE_DEV=0 CONSOLE_SPEED=115200 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="intel_iommu=off" diff --git a/device/dell/x86_64-dellemc_s5248f_c3538-r0/platform_asic b/device/dell/x86_64-dellemc_s5248f_c3538-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/dell/x86_64-dellemc_s5248f_c3538-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/dell/x86_64-dellemc_s5296f_c3538-r0/DellEMC-S5296f-P-10G/td3-s5296f-10g.config.bcm b/device/dell/x86_64-dellemc_s5296f_c3538-r0/DellEMC-S5296f-P-10G/td3-s5296f-10g.config.bcm index ddc14d9363d3..7f8213f322e6 100644 --- a/device/dell/x86_64-dellemc_s5296f_c3538-r0/DellEMC-S5296f-P-10G/td3-s5296f-10g.config.bcm +++ b/device/dell/x86_64-dellemc_s5296f_c3538-r0/DellEMC-S5296f-P-10G/td3-s5296f-10g.config.bcm @@ -1,4 +1,4 @@ -sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_issu/b870.6.4.1/ +sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ os=unix portmap_5.0=5:10 portmap_6.0=6:10 diff --git a/device/dell/x86_64-dellemc_s5296f_c3538-r0/DellEMC-S5296f-P-25G/td3-s5296f-25g.config.bcm b/device/dell/x86_64-dellemc_s5296f_c3538-r0/DellEMC-S5296f-P-25G/td3-s5296f-25g.config.bcm index dd0901f5d01f..2e4dfd6c97a8 100644 --- a/device/dell/x86_64-dellemc_s5296f_c3538-r0/DellEMC-S5296f-P-25G/td3-s5296f-25g.config.bcm +++ b/device/dell/x86_64-dellemc_s5296f_c3538-r0/DellEMC-S5296f-P-25G/td3-s5296f-25g.config.bcm @@ -1,4 +1,4 @@ -sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_issu/b870.6.4.1/ +sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ os=unix portmap_5.0=5:25 portmap_6.0=6:25 diff --git a/device/dell/x86_64-dellemc_s5296f_c3538-r0/installer.conf b/device/dell/x86_64-dellemc_s5296f_c3538-r0/installer.conf index 924e0fb81963..ff014aa8c25e 100644 --- a/device/dell/x86_64-dellemc_s5296f_c3538-r0/installer.conf +++ b/device/dell/x86_64-dellemc_s5296f_c3538-r0/installer.conf @@ -1,2 +1,3 @@ CONSOLE_PORT=0x3f8 CONSOLE_DEV=0 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="intel_iommu=off" diff --git a/device/dell/x86_64-dellemc_s5296f_c3538-r0/platform_asic b/device/dell/x86_64-dellemc_s5296f_c3538-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/dell/x86_64-dellemc_s5296f_c3538-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/dell/x86_64-dellemc_z9264f_c3538-r0/installer.conf b/device/dell/x86_64-dellemc_z9264f_c3538-r0/installer.conf index 924e0fb81963..ff014aa8c25e 100644 --- a/device/dell/x86_64-dellemc_z9264f_c3538-r0/installer.conf +++ b/device/dell/x86_64-dellemc_z9264f_c3538-r0/installer.conf @@ -1,2 +1,3 @@ CONSOLE_PORT=0x3f8 CONSOLE_DEV=0 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="intel_iommu=off" diff --git a/device/dell/x86_64-dellemc_z9264f_c3538-r0/platform_asic b/device/dell/x86_64-dellemc_z9264f_c3538-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/dell/x86_64-dellemc_z9264f_c3538-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/dell/x86_64-dellemc_z9332f_d1508-r0/DellEMC-Z9332f-C32/th3-z9332f-32x100G.config.bcm b/device/dell/x86_64-dellemc_z9332f_d1508-r0/DellEMC-Z9332f-C32/th3-z9332f-32x100G.config.bcm index c1101797b021..73d70ce5fdab 100644 --- a/device/dell/x86_64-dellemc_z9332f_d1508-r0/DellEMC-Z9332f-C32/th3-z9332f-32x100G.config.bcm +++ b/device/dell/x86_64-dellemc_z9332f_d1508-r0/DellEMC-Z9332f-C32/th3-z9332f-32x100G.config.bcm @@ -4,6 +4,9 @@ dpr_clock_frequency=1000 device_clock_frequency=1325 port_flex_enable=1 +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 diff --git a/device/dell/x86_64-dellemc_z9332f_d1508-r0/DellEMC-Z9332f-M-O16C64/th3-z9332f-16x400G-64x100G.config.bcm b/device/dell/x86_64-dellemc_z9332f_d1508-r0/DellEMC-Z9332f-M-O16C64/th3-z9332f-16x400G-64x100G.config.bcm index 17f2d565c26a..1433de4d3b6c 100644 --- a/device/dell/x86_64-dellemc_z9332f_d1508-r0/DellEMC-Z9332f-M-O16C64/th3-z9332f-16x400G-64x100G.config.bcm +++ b/device/dell/x86_64-dellemc_z9332f_d1508-r0/DellEMC-Z9332f-M-O16C64/th3-z9332f-16x400G-64x100G.config.bcm @@ -4,6 +4,9 @@ dpr_clock_frequency=1000 device_clock_frequency=1325 port_flex_enable=1 +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 diff --git a/device/dell/x86_64-dellemc_z9332f_d1508-r0/DellEMC-Z9332f-O32/th3-z9332f-32x400G.config.bcm b/device/dell/x86_64-dellemc_z9332f_d1508-r0/DellEMC-Z9332f-O32/th3-z9332f-32x400G.config.bcm index 9f33e13cc225..a46ac765bb66 100644 --- a/device/dell/x86_64-dellemc_z9332f_d1508-r0/DellEMC-Z9332f-O32/th3-z9332f-32x400G.config.bcm +++ b/device/dell/x86_64-dellemc_z9332f_d1508-r0/DellEMC-Z9332f-O32/th3-z9332f-32x400G.config.bcm @@ -4,6 +4,9 @@ dpr_clock_frequency=1000 device_clock_frequency=1325 port_flex_enable=1 +# disables bcmALPMDH (ALPM distributed hitbit) thread. This thread is purely for debug purpose +l3_alpm_hit_skip=1 + # Disable Counting ACL Drop towards interface RX_DRP counter sai_adjust_acl_drop_in_rx_drop=1 diff --git a/device/dell/x86_64-dellemc_z9332f_d1508-r0/platform.json b/device/dell/x86_64-dellemc_z9332f_d1508-r0/platform.json index e8add067ca00..98a3322bf334 100644 --- a/device/dell/x86_64-dellemc_z9332f_d1508-r0/platform.json +++ b/device/dell/x86_64-dellemc_z9332f_d1508-r0/platform.json @@ -1,6 +1,11 @@ { "chassis": { "name": "Z9332F-ON", + "status_led": { + "controllable": true, + "colors": ["green", "flashing green", "yellow", "flashing yellow"] + }, + "thermal_manager" : false, "components": [ { "name": "BIOS" @@ -19,127 +24,322 @@ }, { "name": "Switch CPLD 2" - } - ], - "fans": [ - { - "name": "FanTray1-Fan1" - }, - { - "name": "FanTray1-Fan2" - }, - { - "name": "FanTray2-Fan1" - }, - { - "name": "FanTray2-Fan2" - }, - { - "name": "FanTray3-Fan1" - }, - { - "name": "FanTray3-Fan2" }, { - "name": "FanTray4-Fan1" + "name": "SSD" }, { - "name": "FanTray4-Fan2" - }, - { - "name": "FanTray5-Fan1" - }, - { - "name": "FanTray5-Fan2" - }, - { - "name": "FanTray6-Fan1" - }, - { - "name": "FanTray6-Fan2" - }, - { - "name": "FanTray7-Fan1" - }, + "name": "PCIe" + } + ], + "fans": [ { - "name": "FanTray7-Fan2" + "name": "FanTray1-Fan1", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } + }, + { + "name": "FanTray1-Fan2", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } + }, + { + "name": "FanTray2-Fan1", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } + }, + { + "name": "FanTray2-Fan2", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } + }, + { + "name": "FanTray3-Fan1", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } + }, + { + "name": "FanTray3-Fan2", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } + }, + { + "name": "FanTray4-Fan1", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } + }, + { + "name": "FanTray4-Fan2", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } + }, + { + "name": "FanTray5-Fan1", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } + }, + { + "name": "FanTray5-Fan2", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } + }, + { + "name": "FanTray6-Fan1", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } + }, + { + "name": "FanTray6-Fan2", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } + }, + { + "name": "FanTray7-Fan1", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } + }, + { + "name": "FanTray7-Fan2", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } } ], "fan_drawers":[ { "name": "FanTray1", + "status_led": { + "controllable": false + }, "fans": [ { - "name": "FanTray1-Fan1" + "name": "FanTray1-Fan1", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } }, { - "name": "FanTray1-Fan2" + "name": "FanTray1-Fan2", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } } ] }, { "name": "FanTray2", + "status_led": { + "controllable": false + }, "fans": [ { - "name": "FanTray2-Fan1" + "name": "FanTray2-Fan1", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } }, { - "name": "FanTray2-Fan2" + "name": "FanTray2-Fan2", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } } ] }, { "name": "FanTray3", + "status_led": { + "controllable": false + }, "fans": [ { - "name": "FanTray3-Fan1" + "name": "FanTray3-Fan1", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } }, { - "name": "FanTray3-Fan2" + "name": "FanTray3-Fan2", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } } ] }, { "name": "FanTray4", + "status_led": { + "controllable": false + }, "fans": [ { - "name": "FanTray4-Fan1" + "name": "FanTray4-Fan1", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } }, { - "name": "FanTray4-Fan2" + "name": "FanTray4-Fan2", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } } ] }, - { + { "name": "FanTray5", + "status_led": { + "controllable": false + }, "fans": [ { - "name": "FanTray5-Fan1" + "name": "FanTray5-Fan1", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } }, { - "name": "FanTray5-Fan2" + "name": "FanTray5-Fan2", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } } ] }, { "name": "FanTray6", + "status_led": { + "controllable": false + }, "fans": [ { - "name": "FanTray6-Fan1" + "name": "FanTray6-Fan1", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } }, { - "name": "FanTray6-Fan2" + "name": "FanTray6-Fan2", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } } ] }, { "name": "FanTray7", + "status_led": { + "controllable": false + }, "fans": [ { - "name": "FanTray7-Fan1" + "name": "FanTray7-Fan1", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } }, { - "name": "FanTray7-Fan2" + "name": "FanTray7-Fan2", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } } ] } @@ -147,63 +347,158 @@ "psus": [ { "name": "PSU1", + "status_led": { + "controllable": false + }, "fans": [ { - "name": "PSU1 Fan" + "name": "PSU1 Fan", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } } ] }, { "name": "PSU2", + "status_led": { + "controllable": false + }, "fans": [ { - "name": "PSU2 Fan" + "name": "PSU2 Fan", + "speed": { + "controllable": false + }, + "status_led": { + "available": false + } } ] } ], "thermals": [ { - "name": "CPU On-board" - }, - { - "name": "Baseboard U3" - }, - { - "name": "SW Internal" - }, - { - "name": "Fan U52" - }, - { - "name": "Fan U17" - }, - { - "name": "SW U52" - }, - { - "name": "SW U16" - }, - { - "name": "PSU1 Inlet" - }, - { - "name": "PSU1 Hotspot" - }, - { - "name": "PSU2 Inlet" - }, - { - "name": "PSU2 Hotspot" - }, - { - "name": "SW U04" - }, - { - "name": "SW U14" - }, - { - "name": "SW U4403" + "name": "CPU On-board", + "controllable": false, + "low-crit-threshold": false, + "high-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false + }, + { + "name": "Baseboard U3", + "controllable": false, + "low-crit-threshold": false, + "high-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false + }, + { + "name": "SW Internal", + "controllable": false, + "low-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false + }, + { + "name": "Fan U52", + "controllable": false, + "low-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false + }, + { + "name": "Fan U17", + "controllable": false, + "low-crit-threshold": false, + "high-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false + }, + { + "name": "SW U52", + "controllable": false, + "low-crit-threshold": false, + "high-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false + }, + { + "name": "SW U16", + "controllable": false, + "low-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false + }, + { + "name": "PSU1 Inlet", + "controllable": false, + "low-crit-threshold": false, + "high-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false + }, + { + "name": "PSU1 Hotspot", + "controllable": false, + "low-crit-threshold": false, + "high-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false + }, + { + "name": "PSU2 Inlet", + "controllable": false, + "low-crit-threshold": false, + "high-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false + }, + { + "name": "PSU2 Hotspot", + "controllable": false, + "low-crit-threshold": false, + "high-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false + }, + { + "name": "SW U04", + "controllable": false, + "low-crit-threshold": false, + "high-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false + }, + { + "name": "SW U14", + "controllable": false, + "low-crit-threshold": false, + "high-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false + }, + { + "name": "SW U4403", + "controllable": false, + "low-crit-threshold": false, + "high-threshold": false, + "high-crit-threshold": false, + "minimum-recorded": false, + "maximum-recorded": false } ], "modules": [], diff --git a/device/dell/x86_64-dellemc_z9332f_d1508-r0/platform_asic b/device/dell/x86_64-dellemc_z9332f_d1508-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/dell/x86_64-dellemc_z9332f_d1508-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/dell/x86_64-dellemc_z9332f_d1508-r0/plugins/sfputil.py b/device/dell/x86_64-dellemc_z9332f_d1508-r0/plugins/sfputil.py index 9ac14d83d73a..348954b94790 100644 --- a/device/dell/x86_64-dellemc_z9332f_d1508-r0/plugins/sfputil.py +++ b/device/dell/x86_64-dellemc_z9332f_d1508-r0/plugins/sfputil.py @@ -2,13 +2,12 @@ # # Platform-specific SFP transceiver interface for SONiC # - try: - import struct import sys import getopt import time import select + import io from sonic_sfp.sfputilbase import SfpUtilBase from os import * from mmap import * @@ -19,6 +18,25 @@ # from xcvrd SFP_STATUS_REMOVED = '0' SFP_STATUS_INSERTED = '1' +MEDIA_TYPE_OFFSET = 0 +MEDIA_TYPE_WIDTH = 1 +QSFP_DD_MODULE_ENC_OFFSET = 3 +QSFP_DD_MODULE_ENC_WIDTH = 1 + +SFP_TYPE_LIST = [ + '03' # SFP/SFP+/SFP28 and later +] +QSFP_TYPE_LIST = [ + '0c', # QSFP + '0d', # QSFP+ or later + '11' # QSFP28 or later +] +QSFP_DD_TYPE_LIST = [ + '18' #QSFP_DD Type +] +OSFP_TYPE_LIST=[ + '19' # OSFP 8X Type +] class SfpUtil(SfpUtilBase): @@ -29,40 +47,39 @@ class SfpUtil(SfpUtilBase): PORTS_IN_BLOCK = 34 BASE_RES_PATH = "/sys/bus/pci/devices/0000:09:00.0/resource0" - _port_to_i2c_mapping = { - 1: 4, - 2: 5, - 3: 6, - 4: 7, - 5: 8, - 6: 9, - 7: 10, - 8: 11, - 9: 12, - 10: 13, - 11: 14, - 12: 15, - 13: 16, - 14: 17, - 15: 18, - 16: 19, - 17: 20, - 18: 21, - 19: 22, - 20: 23, - 21: 24, - 22: 25, - 23: 26, - 24: 27, - 25: 28, - 26: 29, - 27: 30, - 28: 31, - 29: 32, - 30: 33, - 31: 34, - 32: 35, + 1: 10, + 2: 11, + 3: 12, + 4: 13, + 5: 14, + 6: 15, + 7: 16, + 8: 17, + 9: 18, + 10: 19, + 11: 20, + 12: 21, + 13: 22, + 14: 23, + 15: 24, + 16: 25, + 17: 26, + 18: 27, + 19: 28, + 20: 29, + 21: 30, + 22: 31, + 23: 32, + 24: 33, + 25: 34, + 26: 35, + 27: 36, + 28: 37, + 29: 38, + 30: 39, + 31: 40, + 32: 41, 33: 1, 34: 2, } @@ -87,18 +104,77 @@ def qsfp_ports(self): def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping + def _read_eeprom_bytes(self, eeprom_path, offset, num_bytes): + eeprom_raw = [] + try: + eeprom = io.open(eeprom_path, mode="rb", buffering=0) + except IOError: + return None + + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + try: + eeprom.seek(offset) + raw = eeprom.read(num_bytes) + except IOError: + eeprom.close() + return None + + try: + if isinstance(raw , str): + for n in range(0, num_bytes): + eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + else: + for n in range(0, num_bytes): + eeprom_raw[n] = hex(raw[n])[2:].zfill(2) + + except (OSError, IOError): + eeprom.close() + return None + + eeprom.close() + return eeprom_raw + + def _write_eeprom_bytes(self, eeprom_path, offset, num_bytes, value): + try: + with io.open(eeprom_path, mode='r+b', buffering=0) as f: + f.seek(offset) + f.write(value[0:num_bytes]) + except (OSError, IOError): + return False + return True + + + def get_media_type(self, port_num): + """ + Reads optic eeprom byte to determine media type inserted + """ + eeprom_raw = [] + eeprom_raw = self._read_eeprom_bytes(self.port_to_eeprom_mapping[port_num], MEDIA_TYPE_OFFSET, + MEDIA_TYPE_WIDTH) + if eeprom_raw is not None: + if eeprom_raw[0] in SFP_TYPE_LIST: + sfp_type = 'SFP' + elif eeprom_raw[0] in QSFP_TYPE_LIST: + sfp_type = 'QSFP' + elif eeprom_raw[0] in QSFP_DD_TYPE_LIST: + sfp_type = 'QSFP_DD' + else: + #Set native port type if EEPROM type is not recognized/readable + sfp_type = 'QSFP_DD' + else: + sfp_type = 'QSFP_DD' + + return sfp_type + def pci_mem_read(self, mm, offset): mm.seek(offset) - read_data_stream = mm.read(4) - reg_val = struct.unpack('I', read_data_stream) - mem_val = str(reg_val)[1:-2] - # print "reg_val read:%x"%reg_val - return mem_val + return mm.read_byte() def pci_mem_write(self, mm, offset, data): mm.seek(offset) - # print "data to write:%x"%data - mm.write(struct.pack('I', data)) + mm.write_byte(data) def pci_set_value(self, resource, val, offset): fd = open(resource, O_RDWR) @@ -181,54 +257,70 @@ def get_low_power_mode(self, port_num): # Check for invalid port_num if port_num < self.port_start or port_num > self.port_end: return False - - # Port offset starts with 0x4000 - port_offset = 16384 + ((port_num-1) * 16) - - status = self.pci_get_value(self.BASE_RES_PATH, port_offset) - reg_value = int(status) - - # Absence of status throws error - if (reg_value == ""): + if port_num > self.PORTS_IN_BLOCK: return False + if self.get_media_type(port_num) == 'QSFP_DD': + lpmode = self._read_eeprom_bytes(self.port_to_eeprom_mapping[port_num], QSFP_DD_MODULE_ENC_OFFSET, + QSFP_DD_MODULE_ENC_WIDTH) + if lpmode is not None: + if int(lpmode[0])>>1 == 1: + return True + return False + else: + # Port offset starts with 0x4000 + port_offset = 16384 + ((port_num-1) * 16) - # Mask off 4th bit for presence - mask = (1 << 6) + status = self.pci_get_value(self.BASE_RES_PATH, port_offset) + # Absence of status throws error + if (status == ""): + return False - # LPMode is active high - if reg_value & mask == 0: - return False + reg_value = int(status) - return True + # Mask off 4th bit for presence + mask = (1 << 6) + + # LPMode is active high + if reg_value & mask == 0: + return False + return True def set_low_power_mode(self, port_num, lpmode): # Check for invalid port_num if port_num < self.port_start or port_num > self.port_end: return False - - # Port offset starts with 0x4000 - port_offset = 16384 + ((port_num-1) * 16) - - status = self.pci_get_value(self.BASE_RES_PATH, port_offset) - reg_value = int(status) - - # Absence of status throws error - if (reg_value == ""): + if port_num > self.PORTS_IN_BLOCK: return False - # Mask off 4th bit for presence - mask = (1 << 6) + if self.get_media_type(port_num) == 'QSFP_DD': + if lpmode is True: + write_val = 0x10 + else: + write_val = 0x0 - # LPMode is active high; set or clear the bit accordingly - if lpmode is True: - reg_value = reg_value | mask + self._write_eeprom_bytes(self.port_to_eeprom_mapping[port_num], 26, 1, bytearray([write_val])) else: - reg_value = reg_value & ~mask + # Port offset starts with 0x4000 + port_offset = 16384 + ((port_num-1) * 16) + status = self.pci_get_value(self.BASE_RES_PATH, port_offset) + reg_value = int(status) - # Convert our register value back to a hex string and write back - status = self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset) + # Absence of status throws error + if (reg_value == ""): + return False + + # Mask off 4th bit for presence + mask = (1 << 6) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = reg_value | mask + else: + reg_value = reg_value & ~mask + # Convert our register value back to a hex string and write back + status = self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset) return True def reset(self, port_num): diff --git a/device/dell/x86_64-dellemc_z9332f_d1508-r0/system_health_monitoring_config.json b/device/dell/x86_64-dellemc_z9332f_d1508-r0/system_health_monitoring_config.json index d52b24cf905d..4f82136007a3 100644 --- a/device/dell/x86_64-dellemc_z9332f_d1508-r0/system_health_monitoring_config.json +++ b/device/dell/x86_64-dellemc_z9332f_d1508-r0/system_health_monitoring_config.json @@ -6,6 +6,6 @@ "led_color": { "fault": "yellow", "normal": "green", - "booting": "flash_green" + "booting": "flashing green" } } diff --git a/device/delta/x86_64-delta_ag5648-r0/platform_asic b/device/delta/x86_64-delta_ag5648-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/delta/x86_64-delta_ag5648-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/delta/x86_64-delta_ag9032v1-r0/platform_asic b/device/delta/x86_64-delta_ag9032v1-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v1-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/delta/x86_64-delta_ag9032v2a-r0/Delta-ag9032v2a/td3-ag9032v2a-32x100G+1x10G.config.bcm b/device/delta/x86_64-delta_ag9032v2a-r0/Delta-ag9032v2a/td3-ag9032v2a-32x100G+1x10G.config.bcm index 07600e0b8a65..c157e5f7b6cd 100755 --- a/device/delta/x86_64-delta_ag9032v2a-r0/Delta-ag9032v2a/td3-ag9032v2a-32x100G+1x10G.config.bcm +++ b/device/delta/x86_64-delta_ag9032v2a-r0/Delta-ag9032v2a/td3-ag9032v2a-32x100G+1x10G.config.bcm @@ -1,4 +1,4 @@ -sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_issu/b870.6.4.1/ +sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ pbmp_oversubscribe=0x00003fc000000ff0000003fc000001fe pbmp_xport_xe=0xffffffffffffffffffffffffffffffffffff core_clock_frequency=1525 diff --git a/device/delta/x86_64-delta_ag9032v2a-r0/platform_asic b/device/delta/x86_64-delta_ag9032v2a-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/delta/x86_64-delta_ag9032v2a-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/delta/x86_64-delta_ag9064-r0/platform_asic b/device/delta/x86_64-delta_ag9064-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/delta/x86_64-delta_ag9064-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/delta/x86_64-delta_agc032-r0/platform_asic b/device/delta/x86_64-delta_agc032-r0/platform_asic new file mode 100644 index 000000000000..84083a7415d9 --- /dev/null +++ b/device/delta/x86_64-delta_agc032-r0/platform_asic @@ -0,0 +1 @@ +innovium diff --git a/device/delta/x86_64-delta_et-6248brb-r0/platform_asic b/device/delta/x86_64-delta_et-6248brb-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/delta/x86_64-delta_et-6248brb-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/delta/x86_64-delta_et-c032if-r0/platform_asic b/device/delta/x86_64-delta_et-c032if-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/delta/x86_64-delta_et-c032if-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/facebook/x86_64-facebook_wedge100-r0/platform_asic b/device/facebook/x86_64-facebook_wedge100-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/facebook/x86_64-facebook_wedge100-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/platform_asic b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8810_32q-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/platform_asic b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_54xc-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/platform_asic b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s8900_64xc-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/ingrasys/x86_64-ingrasys_s9100-r0/platform_asic b/device/ingrasys/x86_64-ingrasys_s9100-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9100-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/platform_asic b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/platform_asic new file mode 100644 index 000000000000..4211b60b9cea --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9130_32x-r0/platform_asic @@ -0,0 +1 @@ +nephos diff --git a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/INGRASYS-S9180-32X/switch-tna-sai.conf b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/INGRASYS-S9180-32X/switch-tna-sai.conf index 9fbf9d3cdb69..193dcde96bcf 100644 --- a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/INGRASYS-S9180-32X/switch-tna-sai.conf +++ b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/INGRASYS-S9180-32X/switch-tna-sai.conf @@ -1,17 +1,9 @@ { - "instance": 0, "chip_list": [ { - "id": "asic-0", "chip_family": "Tofino", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + "sds_fw_path": "share/tofino_sds_fw/avago/firmware", + "instance": 0 } ], "p4_devices": [ @@ -28,7 +20,6 @@ } ], "program-name": "switch", - "sai": "lib/libsai.so", "bfrt-config": "share/switch/bf-rt.json", "model_json_path" : "share/switch/aug_model.json", "switchapi_port_add": false, @@ -36,5 +27,13 @@ } ] } + ], + "switch_options": [ + { + "device-id": 0, + "model_json_path": "share/switch/aug_model.json", + "non_default_port_ppgs": 5, + "switchapi_port_add": false + } ] } diff --git a/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/platform_asic b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9180_32x-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/platform_asic b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9200_64x-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/platform_asic b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/platform_asic new file mode 100644 index 000000000000..4211b60b9cea --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9230_64x-r0/platform_asic @@ -0,0 +1 @@ +nephos diff --git a/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/INGRASYS-S9280-64X/switch-tna-sai.conf b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/INGRASYS-S9280-64X/switch-tna-sai.conf index 4895ac901ff6..2425102e2319 100644 --- a/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/INGRASYS-S9280-64X/switch-tna-sai.conf +++ b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/INGRASYS-S9280-64X/switch-tna-sai.conf @@ -1,17 +1,9 @@ { - "instance": 0, "chip_list": [ { - "id": "asic-0", "chip_family": "Tofino", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + "sds_fw_path": "share/tofino_sds_fw/avago/firmware", + "instance": 0 } ], "p4_devices": [ @@ -28,7 +20,6 @@ } ], "program-name": "switch", - "sai": "lib/libsai.so", "bfrt-config": "share/switch/bf-rt.json", "model_json_path" : "share/switch/aug_model.json", "switchapi_port_add": false, @@ -36,5 +27,13 @@ } ] } + ], + "switch_options": [ + { + "device-id": 0, + "model_json_path": "share/switch/aug_model.json", + "non_default_port_ppgs": 5, + "switchapi_port_add": false + } ] } diff --git a/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/platform_asic b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/platform_asic new file mode 100644 index 000000000000..88d88117928c --- /dev/null +++ b/device/ingrasys/x86_64-ingrasys_s9280_64x-r0/platform_asic @@ -0,0 +1 @@ +barefoot diff --git a/device/inventec/x86_64-inventec_d6254qs-r0/platform_asic b/device/inventec/x86_64-inventec_d6254qs-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/inventec/x86_64-inventec_d6254qs-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/inventec/x86_64-inventec_d6332-r0/INVENTEC-D6332/td3-d6332-32x100G-SR4.config.bcm b/device/inventec/x86_64-inventec_d6332-r0/INVENTEC-D6332/td3-d6332-32x100G-SR4.config.bcm index 8fe7622f4b8f..7821bc7e6ceb 100644 --- a/device/inventec/x86_64-inventec_d6332-r0/INVENTEC-D6332/td3-d6332-32x100G-SR4.config.bcm +++ b/device/inventec/x86_64-inventec_d6332-r0/INVENTEC-D6332/td3-d6332-32x100G-SR4.config.bcm @@ -1,4 +1,4 @@ -sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_issu/b870.6.4.1/ +sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ ### fix for sonic ptp_ts_pll_fref=50000000 ptp_bs_fref_0=50000000 diff --git a/device/inventec/x86_64-inventec_d6332-r0/platform_asic b/device/inventec/x86_64-inventec_d6332-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/inventec/x86_64-inventec_d6332-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/inventec/x86_64-inventec_d6356-r0/INVENTEC-D6356/td3-d6356-48x25G-8x100G.config.bcm b/device/inventec/x86_64-inventec_d6356-r0/INVENTEC-D6356/td3-d6356-48x25G-8x100G.config.bcm index 089207abd136..895e4389c6da 100644 --- a/device/inventec/x86_64-inventec_d6356-r0/INVENTEC-D6356/td3-d6356-48x25G-8x100G.config.bcm +++ b/device/inventec/x86_64-inventec_d6356-r0/INVENTEC-D6356/td3-d6356-48x25G-8x100G.config.bcm @@ -1,4 +1,4 @@ -sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_issu/b870.6.4.1/ +sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ ### fix for sonic ptp_ts_pll_fref=50000000 ptp_bs_fref_0=50000000 diff --git a/device/inventec/x86_64-inventec_d6356-r0/platform_asic b/device/inventec/x86_64-inventec_d6356-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/inventec/x86_64-inventec_d6356-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/inventec/x86_64-inventec_d6556-r0/platform_asic b/device/inventec/x86_64-inventec_d6556-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/inventec/x86_64-inventec_d6556-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/inventec/x86_64-inventec_d7032q28b-r0/platform_asic b/device/inventec/x86_64-inventec_d7032q28b-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7032q28b-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/inventec/x86_64-inventec_d7054q28b-r0/platform_asic b/device/inventec/x86_64-inventec_d7054q28b-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7054q28b-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/inventec/x86_64-inventec_d7264q28b-r0/platform_asic b/device/inventec/x86_64-inventec_d7264q28b-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/inventec/x86_64-inventec_d7264q28b-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/juniper/x86_64-juniper_qfx5200-r0/platform_asic b/device/juniper/x86_64-juniper_qfx5200-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/juniper/x86_64-juniper_qfx5200-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/juniper/x86_64-juniper_qfx5200-r0/plugins/sfputil.py b/device/juniper/x86_64-juniper_qfx5200-r0/plugins/sfputil.py index db85347be3f4..c751ab7678ea 100644 --- a/device/juniper/x86_64-juniper_qfx5200-r0/plugins/sfputil.py +++ b/device/juniper/x86_64-juniper_qfx5200-r0/plugins/sfputil.py @@ -662,7 +662,7 @@ def get_transceiver_info_dict(self, port_num): transceiver_info_dict['type_abbrv_name'] = sfp_type_data['data']['type_abbrv_name']['value'] transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] # Below part is added to avoid fail the xcvrd, shall be implemented later transceiver_info_dict['vendor_oui'] = 'N/A' @@ -769,7 +769,7 @@ def get_transceiver_info_dict(self, port_num): transceiver_info_dict['type_abbrv_name'] = sfp_interface_bulk_data['data']['type_abbrv_name']['value'] transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] transceiver_info_dict['vendor_date'] = sfp_vendor_date_data[ diff --git a/device/juniper/x86_64-juniper_qfx5210-r0/platform_asic b/device/juniper/x86_64-juniper_qfx5210-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/juniper/x86_64-juniper_qfx5210-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/juniper/x86_64-juniper_qfx5210-r0/plugins/sfputil.py b/device/juniper/x86_64-juniper_qfx5210-r0/plugins/sfputil.py index 673bb05ed107..a994df044ff2 100644 --- a/device/juniper/x86_64-juniper_qfx5210-r0/plugins/sfputil.py +++ b/device/juniper/x86_64-juniper_qfx5210-r0/plugins/sfputil.py @@ -374,7 +374,7 @@ def get_transceiver_info_dict(self, port_num): transceiver_info_dict['type_abbrv_name'] = sfp_type_data['data']['type_abbrv_name']['value'] transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] # Below part is added to avoid fail the xcvrd, shall be implemented later transceiver_info_dict['vendor_oui'] = 'N/A' @@ -483,7 +483,7 @@ def get_transceiver_info_dict(self, port_num): transceiver_info_dict['type_abbrv_name'] = sfp_interface_bulk_data['data']['type_abbrv_name']['value'] transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] transceiver_info_dict['vendor_date'] = sfp_vendor_date_data[ diff --git a/device/marvell/arm64-marvell_db98cx8580_16cd-r0/platform_asic b/device/marvell/arm64-marvell_db98cx8580_16cd-r0/platform_asic new file mode 100644 index 000000000000..a554752878b7 --- /dev/null +++ b/device/marvell/arm64-marvell_db98cx8580_16cd-r0/platform_asic @@ -0,0 +1 @@ +marvell diff --git a/device/marvell/arm64-marvell_db98cx8580_32cd-r0/platform_asic b/device/marvell/arm64-marvell_db98cx8580_32cd-r0/platform_asic new file mode 100644 index 000000000000..a554752878b7 --- /dev/null +++ b/device/marvell/arm64-marvell_db98cx8580_32cd-r0/platform_asic @@ -0,0 +1 @@ +marvell diff --git a/device/marvell/armhf-marvell_et6448m_52x-r0/platform_asic b/device/marvell/armhf-marvell_et6448m_52x-r0/platform_asic new file mode 100644 index 000000000000..a554752878b7 --- /dev/null +++ b/device/marvell/armhf-marvell_et6448m_52x-r0/platform_asic @@ -0,0 +1 @@ +marvell diff --git a/device/marvell/x86_64-marvell_db98cx8580_16cd-r0/platform_asic b/device/marvell/x86_64-marvell_db98cx8580_16cd-r0/platform_asic new file mode 100644 index 000000000000..a554752878b7 --- /dev/null +++ b/device/marvell/x86_64-marvell_db98cx8580_16cd-r0/platform_asic @@ -0,0 +1 @@ +marvell diff --git a/device/marvell/x86_64-marvell_db98cx8580_32cd-r0/platform_asic b/device/marvell/x86_64-marvell_db98cx8580_32cd-r0/platform_asic new file mode 100644 index 000000000000..a554752878b7 --- /dev/null +++ b/device/marvell/x86_64-marvell_db98cx8580_32cd-r0/platform_asic @@ -0,0 +1 @@ +marvell diff --git a/device/marvell/x86_64-marvell_slm5401_54x-r0/platform_asic b/device/marvell/x86_64-marvell_slm5401_54x-r0/platform_asic new file mode 100644 index 000000000000..a554752878b7 --- /dev/null +++ b/device/marvell/x86_64-marvell_slm5401_54x-r0/platform_asic @@ -0,0 +1 @@ +marvell diff --git a/device/mellanox/x86_64-mlnx_lssn2700-r0/platform_asic b/device/mellanox/x86_64-mlnx_lssn2700-r0/platform_asic new file mode 100644 index 000000000000..70c074885557 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_lssn2700-r0/platform_asic @@ -0,0 +1 @@ +mellanox diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..33b6704f9902 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/port_config.ini b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/port_config.ini index f9fa81669a13..7c67e9a482e1 100644 --- a/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/port_config.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2018-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # name lanes index Ethernet0 0 1 Ethernet4 4 2 diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/sai_2010.xml b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/sai_2010.xml index 3383a5f406ef..6d8e9c910419 100644 --- a/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/sai_2010.xml +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/ACS-MSN2010/sai_2010.xml @@ -1,4 +1,20 @@ + diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/pcie.yaml b/device/mellanox/x86_64-mlnx_msn2010-r0/pcie.yaml index ca73122aaa81..c5cd9b9666da 100644 --- a/device/mellanox/x86_64-mlnx_msn2010-r0/pcie.yaml +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/pcie.yaml @@ -1,3 +1,19 @@ +# +# Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# - bus: '00' dev: '00' fn: '0' diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/platform_asic b/device/mellanox/x86_64-mlnx_msn2010-r0/platform_asic new file mode 100644 index 000000000000..70c074885557 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/platform_asic @@ -0,0 +1 @@ +mellanox diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/psuutil.py index 0d864849dc48..377232699ea3 100644 --- a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/psuutil.py +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/psuutil.py @@ -1,3 +1,19 @@ +# +# Copyright (c) 2017-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################# # Mellanox # diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..33b6704f9902 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/port_config.ini b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/port_config.ini index c7ea79bbdbee..b6658dfba546 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/port_config.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2017-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # name lanes index Ethernet0 0,1,2,3 1 Ethernet4 4,5,6,7 2 diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json.j2 index 3e548325ea30..0fab01e69a95 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/qos.json.j2 @@ -1 +1,17 @@ +{# + Copyright (c) 2017-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {%- include 'qos_config.j2' %} diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai_2100.xml b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai_2100.xml index efa0ccd2721f..3460f80e074c 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai_2100.xml +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/ACS-MSN2100/sai_2100.xml @@ -1,4 +1,20 @@ + diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/pcie.yaml b/device/mellanox/x86_64-mlnx_msn2100-r0/pcie.yaml index 63f09eecde7c..9202ae5515a2 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/pcie.yaml +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/pcie.yaml @@ -1,3 +1,19 @@ +# +# Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# - bus: '00' dev: '00' fn: '0' diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/platform_asic b/device/mellanox/x86_64-mlnx_msn2100-r0/platform_asic new file mode 100644 index 000000000000..70c074885557 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/platform_asic @@ -0,0 +1 @@ +mellanox diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py index 2b4f87397bc4..a796b63dddec 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py @@ -1,3 +1,19 @@ +# +# Copyright (c) 2017-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################# # Mellanox # diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..33b6704f9902 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/port_config.ini b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/port_config.ini index 782949e5706a..6303cc593633 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/port_config.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2017-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # name lanes index Ethernet0 0 1 Ethernet4 4 2 diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json.j2 index 3e548325ea30..0fab01e69a95 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/qos.json.j2 @@ -1 +1,17 @@ +{# + Copyright (c) 2017-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {%- include 'qos_config.j2' %} diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai_2410.xml b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai_2410.xml index 03d694c97723..a4cb1df39571 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai_2410.xml +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/ACS-MSN2410/sai_2410.xml @@ -1,4 +1,20 @@ + diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/platform_asic b/device/mellanox/x86_64-mlnx_msn2410-r0/platform_asic new file mode 100644 index 000000000000..70c074885557 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/platform_asic @@ -0,0 +1 @@ +mellanox diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 index 1083a6210fc9..434b2751f42c 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 @@ -1,2 +1,18 @@ +{# + Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {%- set default_topo = 't0' %} {%- include 'buffers_config.j2' %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_objects.j2 new file mode 100644 index 000000000000..29a3c74e5233 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_objects.j2 @@ -0,0 +1,229 @@ +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} + "BUFFER_POOL": { + {% if dynamic_mode is not defined and port_names_inactive|length > 0 -%} + "ingress_zero_pool" : { + "mode": "static", + "type": "ingress", + "size": "0" + }, + {% endif -%} + "ingress_lossless_pool": { + {% if dynamic_mode is not defined -%} + "size": "{{ ingress_lossless_pool_size }}", + {% endif -%} + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + {% if dynamic_mode is not defined -%} + "size": "{{ ingress_lossy_pool_size }}", + {% endif -%} + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + {% if dynamic_mode is not defined -%} + "size": "{{ egress_lossy_pool_size }}", + {% endif -%} + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + {% if dynamic_mode is not defined and port_names_inactive|length > 0 -%} + "ingress_lossy_pg_zero_profile" : { + "pool":"ingress_zero_pool", + "size":"0", + "static_th":"0" + }, + "ingress_lossless_zero_profile" : { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"-8" + }, + "ingress_lossy_zero_profile" : { + "pool":"ingress_lossy_pool", + "size":"0", + "dynamic_th":"-8" + }, + "egress_lossless_zero_profile" : { + "pool":"egress_lossless_pool", + "size":"0", + "dynamic_th":"-8" + }, + "egress_lossy_zero_profile" : { + "pool":"egress_lossy_pool", + "size":"0", + "dynamic_th":"-8" + }, + {% endif -%} + "ingress_lossless_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "ingress_lossy_profile": { + "pool":"ingress_lossy_pool", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"9216", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"0", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{%- macro generate_profile_lists(port_names_active, port_names_inactive) %} + "BUFFER_PORT_INGRESS_PROFILE_LIST": { +{% for port in port_names_active.split(',') %} + "{{ port }}": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }{% if not loop.last %},{% endif %} + +{% endfor %} +{% if port_names_inactive|length > 0 %} +, +{% for port in port_names_inactive.split(',') %} + "{{ port }}": { +{% if dynamic_mode is defined %} + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" +{% else %} + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" +{% endif %} + }{% if not loop.last %},{% endif %} + +{% endfor %} +{% endif %} + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { +{% for port in port_names_active.split(',') %} + "{{ port }}": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }{% if not loop.last %},{% endif %} + +{% endfor %} +{% if port_names_inactive|length > 0 %} +, +{% for port in port_names_inactive.split(',') %} + "{{ port }}": { +{% if dynamic_mode is defined %} + "profile_list" : "egress_lossless_profile,egress_lossy_profile" +{% else %} + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" +{% endif %} + }{% if not loop.last %},{% endif %} + +{% endfor %} +{% endif %} + } +{%- endmacro %} + +{%- macro generate_queue_buffers(port_names_active, port_names_inactive) %} + "BUFFER_QUEUE": { +{% for port in port_names_active.split(',') %} + "{{ port }}|3-4": { + "profile" : "egress_lossless_profile" + }, +{% endfor %} +{% for port in port_names_active.split(',') %} + "{{ port }}|0-2": { + "profile" : "q_lossy_profile" + }, +{% endfor %} +{% for port in port_names_active.split(',') %} + "{{ port }}|5-6": { + "profile" : "q_lossy_profile" + }{% if not loop.last %},{% endif %} + +{% endfor %} +{% if port_names_inactive|length > 0 %} +, +{% if dynamic_mode is defined %} +{% for port in port_names_inactive.split(',') %} + "{{ port }}|3-4": { + "profile" : "egress_lossless_profile" + }, +{% endfor %} +{% for port in port_names_inactive.split(',') %} + "{{ port }}|0-2": { + "profile" : "q_lossy_profile" + }, +{% endfor %} +{% for port in port_names_inactive.split(',') %} + "{{ port }}|5-6": { + "profile" : "q_lossy_profile" + }{% if not loop.last %},{% endif %} + +{% endfor %} +{% else %} +{% for port in port_names_inactive.split(',') %} + "{{ port }}|3-4": { + "profile" : "egress_lossless_zero_profile" + }, +{% endfor %} +{% for port in port_names_inactive.split(',') %} + "{{ port }}|0-2": { + "profile" : "egress_lossy_zero_profile" + }, +{% endfor %} +{% for port in port_names_inactive.split(',') %} + "{{ port }}|5-6": { + "profile" : "egress_lossy_zero_profile" + }{% if not loop.last %},{% endif %} + +{% endfor %} +{% endif %} +{% endif %} + } +{%- endmacro %} + +{%- macro generate_pg_profiles(port_names_active, port_names_inactive) %} + "BUFFER_PG": { +{% for port in port_names_active.split(',') %} +{% if dynamic_mode is defined %} + "{{ port }}|3-4": { + "profile" : "NULL" + }, +{% endif %} + "{{ port }}|0": { + "profile" : "ingress_lossy_profile" + }{% if not loop.last %},{% endif %} + +{% endfor %} +{% if port_names_inactive|length > 0 %} +{%- for port in port_names_inactive.split(',') %} + {%- if loop.first -%},{%- endif -%} +{% if dynamic_mode is defined %} + "{{ port }}|3-4": { + "profile" : "NULL" + }, +{% endif %} + "{{ port }}|0": { +{% if dynamic_mode is defined %} + "profile" : "ingress_lossy_profile" +{% else %} + "profile" : "ingress_lossy_pg_zero_profile" +{% endif %} + }{% if not loop.last %},{% endif %} + +{% endfor %} +{% endif %} + } +{%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 index 37230af25627..37d3395a43c0 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 @@ -1,112 +1,39 @@ +{# + Copyright (c) 2018-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '4580864' %} {% set ingress_lossy_pool_size = '4580864' %} {% set egress_lossless_pool_size = '13945824' %} {% set egress_lossy_pool_size = '4580864' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "ingress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossy_pool_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossy_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} {%- endmacro %} - +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} +{%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 index 6adfd1f26f23..ca3410fabf28 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 @@ -1,112 +1,39 @@ +{# + Copyright (c) 2018-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '3302912' %} {% set ingress_lossy_pool_size = '3302912' %} {% set egress_lossless_pool_size = '13945824' %} {% set egress_lossy_pool_size = '3302912' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "ingress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossy_pool_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossy_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} {%- endmacro %} - +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} +{%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 index 5954cc77c114..3c7f67da0f41 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 @@ -1,3 +1,19 @@ +{# + Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {%- set default_topo = 't0' %} {%- set dynamic_mode = 'true' %} {%- include 'buffers_config.j2' %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini index 7abb2a058d1b..9cac7af8c2fa 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2018-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # PG lossless profiles. # speed cable size xon xoff threshold 10000 5m 49152 19456 29696 0 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/port_config.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/port_config.ini index c1e59909c0fb..3205ee7a66bd 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/port_config.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # name lanes alias index Ethernet0 0,1,2,3 etp1 1 Ethernet4 4,5,6,7 etp2 2 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 index 3e548325ea30..68a41d8d5975 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 @@ -1 +1,17 @@ +{# + Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {%- include 'qos_config.j2' %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai_2700.xml b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai_2700.xml index f025df1d3ef0..fc3d46a4b057 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai_2700.xml +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/ACS-MSN2700/sai_2700.xml @@ -1,4 +1,20 @@ + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..c01aebb7ae12 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/port_config.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/port_config.ini index 653a61ecc23c..a8372f7271b7 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/port_config.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # name lanes alias index speed Ethernet0 0,1,2,3 etp1 1 100000 Ethernet4 4,5,6,7 etp2 2 100000 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai_2700_8x50g_28x100g.xml b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai_2700_8x50g_28x100g.xml index 3127518b21a9..d7e64e106454 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai_2700_8x50g_28x100g.xml +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-C28D8/sai_2700_8x50g_28x100g.xml @@ -1,4 +1,20 @@ + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..c01aebb7ae12 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/hwsku.json b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/hwsku.json deleted file mode 100644 index 1ac7b9e06324..000000000000 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/hwsku.json +++ /dev/null @@ -1,178 +0,0 @@ -{ - "interfaces": { - "Ethernet0": { - "default_brkout_mode": "1x10G" - }, - "Ethernet1": { - "default_brkout_mode": "1x10G" - }, - "Ethernet2": { - "default_brkout_mode": "1x10G" - }, - "Ethernet3": { - "default_brkout_mode": "1x10G" - }, - "Ethernet4": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet8": { - "default_brkout_mode": "1x10G" - }, - "Ethernet9": { - "default_brkout_mode": "1x10G" - }, - "Ethernet10": { - "default_brkout_mode": "1x10G" - }, - "Ethernet11": { - "default_brkout_mode": "1x10G" - }, - "Ethernet12": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet16": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet18": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet20": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet22": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet24": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet28": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet32": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet36": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet40": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet42": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet44": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet46": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet48": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet50": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet52": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet54": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet56": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet58": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet60": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet62": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet64": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet66": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet68": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet70": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet72": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet74": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet76": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet78": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet80": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet82": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet84": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet86": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet88": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet92": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet96": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet100": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet104": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet106": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet108": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet110": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet112": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet114": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet116": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet118": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet120": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet122": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet124": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet126": { - "default_brkout_mode": "2x50G[25G,10G]" - } - } -} \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/pg_profile_lookup.ini index cdd674e4e715..b73975ed89bc 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/pg_profile_lookup.ini +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/pg_profile_lookup.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2018-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # PG lossless profiles. # speed cable size xon xoff threshold 10000 5m 19456 19456 22528 0 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/port_config.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/port_config.ini index b4072ceb32a1..d13e9a2c4433 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/port_config.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2018-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # name lanes alias index speed Ethernet0 0 etp1a 1 10000 Ethernet1 1 etp1b 1 10000 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/qos.json.j2 index 3e548325ea30..0fab01e69a95 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/qos.json.j2 @@ -1 +1,17 @@ +{# + Copyright (c) 2017-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {%- include 'qos_config.j2' %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/sai_2700_8x100g_40x50g_8x10g.xml b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/sai_2700_8x100g_40x50g_8x10g.xml index bc2d1509fd36..ec4cdf11cad8 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/sai_2700_8x100g_40x50g_8x10g.xml +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D40C8S8/sai_2700_8x100g_40x50g_8x10g.xml @@ -1,4 +1,20 @@ + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_objects.j2 new file mode 100644 index 000000000000..92014175581c --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_objects.j2 @@ -0,0 +1,218 @@ +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} + "BUFFER_POOL": { + {% if dynamic_mode is not defined and port_names_inactive|length > 0 -%} + "ingress_zero_pool" : { + "mode": "static", + "type": "ingress", + "size": "0" + }, + {% endif -%} + "ingress_lossless_pool": { + {% if dynamic_mode is not defined -%} + "size": "{{ ingress_lossless_pool_size }}", + "xoff": "{{ ingress_lossless_pool_xoff }}", + {% endif -%} + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + {% if dynamic_mode is not defined -%} + "size": "{{ egress_lossy_pool_size }}", + {% endif -%} + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + {% if dynamic_mode is not defined and port_names_inactive|length > 0 -%} + "ingress_lossy_pg_zero_profile" : { + "pool":"ingress_zero_pool", + "size":"0", + "static_th":"0" + }, + "ingress_lossless_zero_profile" : { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"-8" + }, + "egress_lossless_zero_profile" : { + "pool":"egress_lossless_pool", + "size":"0", + "dynamic_th":"-8" + }, + "egress_lossy_zero_profile" : { + "pool":"egress_lossy_pool", + "size":"0", + "dynamic_th":"-8" + }, + {% endif -%} + "ingress_lossless_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"9216", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"0", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{%- macro generate_profile_lists(port_names_active, port_names_inactive) %} + "BUFFER_PORT_INGRESS_PROFILE_LIST": { +{% for port in port_names_active.split(',') %} + "{{ port }}": { + "profile_list" : "ingress_lossless_profile" + }{% if not loop.last %},{% endif %} + +{% endfor %} +{% if port_names_inactive|length > 0 %} +, +{% for port in port_names_inactive.split(',') %} + "{{ port }}": { +{% if dynamic_mode is defined %} + "profile_list" : "ingress_lossless_profile" +{% else %} + "profile_list" : "ingress_lossless_zero_profile" +{% endif %} + }{% if not loop.last %},{% endif %} + +{% endfor %} +{% endif %} + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { +{% for port in port_names_active.split(',') %} + "{{ port }}": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }{% if not loop.last %},{% endif %} + +{% endfor %} +{% if port_names_inactive|length > 0 %} +, +{% for port in port_names_inactive.split(',') %} + "{{ port }}": { +{% if dynamic_mode is defined %} + "profile_list" : "egress_lossless_profile,egress_lossy_profile" +{% else %} + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" +{% endif %} + }{% if not loop.last %},{% endif %} + +{% endfor %} +{% endif %} + } +{%- endmacro %} + +{%- macro generate_queue_buffers(port_names_active, port_names_inactive) %} + "BUFFER_QUEUE": { +{% for port in port_names_active.split(',') %} + "{{ port }}|3-4": { + "profile" : "egress_lossless_profile" + }, +{% endfor %} +{% for port in port_names_active.split(',') %} + "{{ port }}|0-2": { + "profile" : "q_lossy_profile" + }, +{% endfor %} +{% for port in port_names_active.split(',') %} + "{{ port }}|5-6": { + "profile" : "q_lossy_profile" + }{% if not loop.last %},{% endif %} + +{% endfor %} +{% if port_names_inactive|length > 0 %} +, +{% if dynamic_mode is defined %} +{% for port in port_names_inactive.split(',') %} + "{{ port }}|3-4": { + "profile" : "egress_lossless_profile" + }, +{% endfor %} +{% for port in port_names_inactive.split(',') %} + "{{ port }}|0-2": { + "profile" : "q_lossy_profile" + }, +{% endfor %} +{% for port in port_names_inactive.split(',') %} + "{{ port }}|5-6": { + "profile" : "q_lossy_profile" + }{% if not loop.last %},{% endif %} + +{% endfor %} +{% else %} +{% for port in port_names_inactive.split(',') %} + "{{ port }}|3-4": { + "profile" : "egress_lossless_zero_profile" + }, +{% endfor %} +{% for port in port_names_inactive.split(',') %} + "{{ port }}|0-2": { + "profile" : "egress_lossy_zero_profile" + }, +{% endfor %} +{% for port in port_names_inactive.split(',') %} + "{{ port }}|5-6": { + "profile" : "egress_lossy_zero_profile" + }{% if not loop.last %},{% endif %} + +{% endfor %} +{% endif %} +{% endif %} + } +{%- endmacro %} + +{%- macro generate_pg_profiles(port_names_active, port_names_inactive) %} + "BUFFER_PG": { +{% for port in port_names_active.split(',') %} +{% if dynamic_mode is defined %} + "{{ port }}|3-4": { + "profile" : "NULL" + }, +{% endif %} + "{{ port }}|0": { + "profile" : "ingress_lossy_profile" + }{% if not loop.last %},{% endif %} + +{% endfor %} +{% if port_names_inactive|length > 0 %} +{%- for port in port_names_inactive.split(',') %} + {%- if loop.first -%},{%- endif -%} +{% if dynamic_mode is defined %} + "{{ port }}|3-4": { + "profile" : "NULL" + }, +{% endif %} + "{{ port }}|0": { +{% if dynamic_mode is defined %} + "profile" : "ingress_lossy_profile" +{% else %} + "profile" : "ingress_lossy_pg_zero_profile" +{% endif %} + }{% if not loop.last %},{% endif %} + +{% endfor %} +{% endif %} + } +{%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 index db4d794ad3cd..3a3f2499c8d8 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t0.j2 @@ -1,106 +1,39 @@ +{# + Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '7719936' %} {% set ingress_lossless_pool_xoff = '1032192' %} {% set egress_lossless_pool_size = '13945824' %} {% set egress_lossy_pool_size = '7719936' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_pool_xoff }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} {%- endmacro %} - +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} +{%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t1.j2 index 54e4aaa4b55d..97965488eaed 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_t1.j2 @@ -1,106 +1,39 @@ +{# + Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '9686016' %} {% set ingress_lossless_pool_xoff = '1179648' %} {% set egress_lossless_pool_size = '13945824' %} {% set egress_lossy_pool_size = '9686016' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_pool_xoff }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} {%- endmacro %} - +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} +{%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/pg_profile_lookup.ini index b4bb2aaadb92..05cfe57a8ec2 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/pg_profile_lookup.ini +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/pg_profile_lookup.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # PG lossless profiles. # speed cable size xon xoff threshold 10000 5m 19456 19456 22528 0 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/port_config.ini b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/port_config.ini index 830f558fb383..cb118d692d79 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/port_config.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # name lanes alias index speed Ethernet0 0,1 etp1a 1 50000 Ethernet2 2,3 etp1b 1 50000 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 index 3e548325ea30..94bd7dda2c37 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/qos.json.j2 @@ -1 +1,17 @@ +{# + Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {%- include 'qos_config.j2' %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/sai.profile b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/sai.profile index aa93654b5406..ce9e96ee4fa3 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/sai.profile +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/sai.profile @@ -1,4 +1,3 @@ SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_2700_48x50g_8x100g.xml -SAI_VXLAN_SRCPORT_RANGE_ENABLE=1 SAI_DUMP_STORE_PATH=/var/log/mellanox/sdk-dumps SAI_DUMP_STORE_AMOUNT=10 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/sai_2700_48x50g_8x100g.xml b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/sai_2700_48x50g_8x100g.xml index 5d92ffd45e91..44e1962fa110 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/sai_2700_48x50g_8x100g.xml +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/sai_2700_48x50g_8x100g.xml @@ -1,270 +1,286 @@ - - - - - - 00:02:03:04:05:00 - - - 1 - - - 32 - - - - - 1 - 4 - 16 - - - 3 - - - 3221487616 - 2 - - - 3 - 4 - 17 - 1 - 3221487616 - 2 - - - 5 - 4 - 18 - 3 - 3221487616 - 2 - - - 7 - 4 - 19 - 1 - 3221487616 - 2 - - - 9 - 4 - 20 - 3 - 3221487616 - 2 - - - 11 - 4 - 21 - 1 - 3221487616 - 2 - - - 13 - 4 - 22 - 3 - 11534336 - - - 15 - 4 - 23 - 1 - 11534336 - - - 17 - 4 - 24 - 3 - 11534336 - - - 19 - 4 - 25 - 1 - 11534336 - - - 21 - 4 - 26 - 3 - 3221487616 - 2 - - - 23 - 4 - 27 - 1 - 3221487616 - 2> - - - 25 - 4 - 28 - 3 - 3221487616 - 2 - - - 27 - 4 - 29 - 1 - 3221487616 - 2 - - - 29 - 4 - 30 - 3 - 3221487616 - 2 - - - 31 - 4 - 31 - 1 - 3221487616 - 2 - - - 33 - 4 - 14 - 3 - 3221487616 - 2 - - - 35 - 4 - 15 - 1 - 3221487616 - 2 - - - 37 - 4 - 12 - 3 - 3221487616 - 2 - - - 39 - 4 - 13 - 1 - 3221487616 - 2 - - - 41 - 4 - 10 - 3 - 3221487616 - 2 - - - 43 - 4 - 11 - 1 - 3221487616 - 2 - - - 45 - 4 - 8 - 3 - 11534336 - - - 47 - 4 - 9 - 1 - 11534336 - - - 49 - 4 - 6 - 3 - 11534336 - - - 51 - 4 - 7 - 1 - 11534336 - - - 53 - 4 - 4 - 3 - 3221487616 - 2 - - - 55 - 4 - 5 - 1 - 3221487616 - 2 - - - 57 - 4 - 2 - 3 - 3221487616 - 2 - - - 59 - 4 - 3 - 1 - 3221487616 - 2 - - - 61 - 4 - 0 - 3 - 3221487616 - 2 - - - 63 - 4 - 1 - 1 - 3221487616 - 2 - - - - + + + + + + + 00:02:03:04:05:00 + + + 1 + + + 32 + + + + + 1 + 4 + 16 + + + 3 + + + 3221487616 + 2 + + + 3 + 4 + 17 + 1 + 3221487616 + 2 + + + 5 + 4 + 18 + 3 + 3221487616 + 2 + + + 7 + 4 + 19 + 1 + 3221487616 + 2 + + + 9 + 4 + 20 + 3 + 3221487616 + 2 + + + 11 + 4 + 21 + 1 + 3221487616 + 2 + + + 13 + 4 + 22 + 3 + 11534336 + + + 15 + 4 + 23 + 1 + 11534336 + + + 17 + 4 + 24 + 3 + 11534336 + + + 19 + 4 + 25 + 1 + 11534336 + + + 21 + 4 + 26 + 3 + 3221487616 + 2 + + + 23 + 4 + 27 + 1 + 3221487616 + 2> + + + 25 + 4 + 28 + 3 + 3221487616 + 2 + + + 27 + 4 + 29 + 1 + 3221487616 + 2 + + + 29 + 4 + 30 + 3 + 3221487616 + 2 + + + 31 + 4 + 31 + 1 + 3221487616 + 2 + + + 33 + 4 + 14 + 3 + 3221487616 + 2 + + + 35 + 4 + 15 + 1 + 3221487616 + 2 + + + 37 + 4 + 12 + 3 + 3221487616 + 2 + + + 39 + 4 + 13 + 1 + 3221487616 + 2 + + + 41 + 4 + 10 + 3 + 3221487616 + 2 + + + 43 + 4 + 11 + 1 + 3221487616 + 2 + + + 45 + 4 + 8 + 3 + 11534336 + + + 47 + 4 + 9 + 1 + 11534336 + + + 49 + 4 + 6 + 3 + 11534336 + + + 51 + 4 + 7 + 1 + 11534336 + + + 53 + 4 + 4 + 3 + 3221487616 + 2 + + + 55 + 4 + 5 + 1 + 3221487616 + 2 + + + 57 + 4 + 2 + 3 + 3221487616 + 2 + + + 59 + 4 + 3 + 1 + 3221487616 + 2 + + + 61 + 4 + 0 + 3 + 3221487616 + 2 + + + 63 + 4 + 1 + 1 + 3221487616 + 2 + + + + diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..c01aebb7ae12 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t0.j2 index 0627adbbf202..e36cc754fa52 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t0.j2 @@ -1,106 +1,39 @@ +{# + Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '10177536' %} {% set ingress_lossless_pool_xoff = '688128' %} {% set egress_lossless_pool_size = '13945824' %} {% set egress_lossy_pool_size = '10177536' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_pool_xoff }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} {%- endmacro %} - +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} +{%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t1.j2 index afc6ba46e0c9..d7f9dddd5564 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/Mellanox-SN2700/buffers_defaults_t1.j2 @@ -1,106 +1,39 @@ +{# + Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '8719360' %} {% set ingress_lossless_pool_xoff = '2146304' %} {% set egress_lossless_pool_size = '13945824' %} {% set egress_lossy_pool_size = '8719360' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_pool_xoff }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} {%- endmacro %} - +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} +{%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/pcie.yaml b/device/mellanox/x86_64-mlnx_msn2700-r0/pcie.yaml index 8796390b73c6..440afffc3256 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/pcie.yaml +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/pcie.yaml @@ -1,3 +1,19 @@ +# +# Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# - bus: '00' dev: '00' fn: '0' diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/platform_asic b/device/mellanox/x86_64-mlnx_msn2700-r0/platform_asic new file mode 100644 index 000000000000..70c074885557 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/platform_asic @@ -0,0 +1 @@ +mellanox diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot b/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot index 28c5aedc4e32..7a38268ff09c 100755 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot @@ -3,6 +3,7 @@ declare -r EXIT_SUCCESS="0" declare -r EXIT_ERROR="1" +declare -r PENDING_COMPONENT_FW="/usr/bin/install-pending-fw.py" declare -r FW_UPGRADE_SCRIPT="/usr/bin/mlnx-fw-upgrade.sh" declare -r SYSFS_PWR_CYCLE="/sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/pwr_cycle" @@ -40,4 +41,6 @@ if [[ "${EXIT_CODE}" != "${EXIT_SUCCESS}" ]]; then fi fi +${PENDING_COMPONENT_FW} + SafePwrCycle diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py index 0f20ffff3b53..768ee5e72183 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/eeprom.py @@ -1,3 +1,19 @@ +# +# Copyright (c) 2017-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################# # Mellanox # diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/fanutil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/fanutil.py index ee6446e7c053..6d54455af408 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/fanutil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/fanutil.py @@ -1,3 +1,19 @@ +# +# Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################# # Mellanox # diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py index 6da5770c294f..915c90bf25a6 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py @@ -1,3 +1,19 @@ +# +# Copyright (c) 2017-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################# # Mellanox # diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfplpmget.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfplpmget.py index ca16c3573d06..c149d51bdde9 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfplpmget.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfplpmget.py @@ -1,4 +1,20 @@ #!/usr/bin/env python3 +# +# Copyright (c) 2018-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# """ This utility get the power mode of a given module. diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py index 61423880ac71..6fa34d9b71aa 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py @@ -1,4 +1,20 @@ #!/usr/bin/env python3 +# +# Copyright (c) 2018-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# """ This utility set the power mode of a given module. diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfpreset.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfpreset.py index af237b705e9f..e49186c10609 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfpreset.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfpreset.py @@ -1,4 +1,20 @@ #!/usr/bin/env python3 +# +# Copyright (c) 2018-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# """ This utility reset the given SFP module. diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py index 952620dc22f8..9423de8dd75b 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py @@ -1,3 +1,19 @@ +# +# Copyright (c) 2017-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# # sfputil.py # # Platform-specific SFP transceiver interface for SONiC @@ -44,9 +60,9 @@ 'x86_64-mlnx_msn2410-r0': 2, 'x86_64-mlnx_msn2010-r0': 3, 'x86_64-mlnx_msn3420-r0': 5, 'x86_64-mlnx_msn3700-r0': 0, 'x86_64-mlnx_msn3700c-r0': 0, 'x86_64-mlnx_msn3800-r0': 4, 'x86_64-mlnx_msn4410-r0': 0, 'x86_64-mlnx_msn4600-r0': 4, 'x86_64-mlnx_msn4600c-r0': 4, - 'x86_64-mlnx_msn4700-r0': 0} + 'x86_64-mlnx_msn4700-r0': 0, 'x86_64-nvidia_sn2201-r0': 6, 'x86_64-nvidia_sn5600-r0': 4} port_position_tuple_list = [(0, 0, 31, 32, 1), (0, 0, 15, 16, 1), (0, 48, 55, 56, 1), - (0, 18, 21, 22, 1), (0, 0, 63, 64, 1), (0, 48, 59, 60, 1)] + (0, 18, 21, 22, 1), (0, 0, 63, 64, 1), (0, 48, 59, 60, 1), (0, 48, 51, 52, 1)] def log_info(msg, also_print_to_console=False): @@ -333,7 +349,7 @@ def get_transceiver_info_dict(self, port_num): transceiver_info_dict['type'] = sfp_type_data['data']['type']['value'] transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] # Below part is added to avoid fail the xcvrd, shall be implemented later transceiver_info_dict['vendor_oui'] = 'N/A' @@ -422,7 +438,7 @@ def get_transceiver_info_dict(self, port_num): transceiver_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value'] transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] transceiver_info_dict['vendor_date'] = sfp_vendor_date_data[ diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/thermalutil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/thermalutil.py index 980ef8a9fc38..8ee172feacdd 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/thermalutil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/thermalutil.py @@ -1,3 +1,19 @@ +# +# Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################# # Mellanox # diff --git a/device/mellanox/x86_64-mlnx_msn2700_simx-r0/platform.json b/device/mellanox/x86_64-mlnx_msn2700_simx-r0/platform.json new file mode 120000 index 000000000000..e5572096d1a5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700_simx-r0/platform.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/platform.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700_simx-r0/platform_asic b/device/mellanox/x86_64-mlnx_msn2700_simx-r0/platform_asic new file mode 100644 index 000000000000..70c074885557 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700_simx-r0/platform_asic @@ -0,0 +1 @@ +mellanox diff --git a/device/mellanox/x86_64-mlnx_msn2700_simx-r0/pmon_daemon_control.json b/device/mellanox/x86_64-mlnx_msn2700_simx-r0/pmon_daemon_control.json index dd83c2db12c5..e7852dad6d11 100644 --- a/device/mellanox/x86_64-mlnx_msn2700_simx-r0/pmon_daemon_control.json +++ b/device/mellanox/x86_64-mlnx_msn2700_simx-r0/pmon_daemon_control.json @@ -3,5 +3,6 @@ "skip_xcvrd": true, "skip_psud": true, "skip_pcied": true, - "skip_thermalctld": true + "skip_thermalctld": true, + "skip_chassis_db_init": true } diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..33b6704f9902 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/port_config.ini b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/port_config.ini index 2ef052c68d52..6ade639701d8 100644 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/port_config.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2017-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # name lanes index Ethernet0 0,1,2,3 1 Ethernet4 4,5,6,7 2 diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai_2740.xml b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai_2740.xml index a21dc696ddd9..fe584ea7a027 100644 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai_2740.xml +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/ACS-MSN2740/sai_2740.xml @@ -1,4 +1,20 @@ + diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/pcie.yaml b/device/mellanox/x86_64-mlnx_msn2740-r0/pcie.yaml index ca73122aaa81..c5cd9b9666da 100644 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/pcie.yaml +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/pcie.yaml @@ -1,3 +1,19 @@ +# +# Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# - bus: '00' dev: '00' fn: '0' diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/platform_asic b/device/mellanox/x86_64-mlnx_msn2740-r0/platform_asic new file mode 100644 index 000000000000..70c074885557 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/platform_asic @@ -0,0 +1 @@ +mellanox diff --git a/device/mellanox/x86_64-mlnx_msn3420-r0/ACS-MSN3420/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn3420-r0/ACS-MSN3420/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..33b6704f9902 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3420-r0/ACS-MSN3420/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3420-r0/ACS-MSN3420/port_config.ini b/device/mellanox/x86_64-mlnx_msn3420-r0/ACS-MSN3420/port_config.ini index 38441f21f003..ba1995749076 100644 --- a/device/mellanox/x86_64-mlnx_msn3420-r0/ACS-MSN3420/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn3420-r0/ACS-MSN3420/port_config.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # name lanes alias index Ethernet0 0 etp1 1 Ethernet4 4 etp2 2 diff --git a/device/mellanox/x86_64-mlnx_msn3420-r0/ACS-MSN3420/sai_3420.xml b/device/mellanox/x86_64-mlnx_msn3420-r0/ACS-MSN3420/sai_3420.xml index 5064ee3ef81b..73ab81a18b1a 100644 --- a/device/mellanox/x86_64-mlnx_msn3420-r0/ACS-MSN3420/sai_3420.xml +++ b/device/mellanox/x86_64-mlnx_msn3420-r0/ACS-MSN3420/sai_3420.xml @@ -1,4 +1,20 @@ + diff --git a/device/mellanox/x86_64-mlnx_msn3420-r0/platform_asic b/device/mellanox/x86_64-mlnx_msn3420-r0/platform_asic new file mode 100644 index 000000000000..70c074885557 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3420-r0/platform_asic @@ -0,0 +1 @@ +mellanox diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..33b6704f9902 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t0.j2 index f795c2016843..624bccc3da9d 100644 --- a/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t0.j2 @@ -1,110 +1,39 @@ +{# + Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '14542848' %} {% set ingress_lossy_pool_size = '14542848' %} {% set egress_lossless_pool_size = '34287552' %} {% set egress_lossy_pool_size = '14542848' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "ingress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossy_pool_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossy_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} -{% endfor %} - } +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t1.j2 index 68eaf2d7816a..106bc95c7ce7 100644 --- a/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/buffers_defaults_t1.j2 @@ -1,110 +1,39 @@ +{# + Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '11622400' %} {% set ingress_lossy_pool_size = '11622400' %} {% set egress_lossless_pool_size = '34287552' %} {% set egress_lossy_pool_size = '11622400' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "ingress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossy_pool_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossy_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} -{% endfor %} - } +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/pg_profile_lookup.ini index 2e420e15871a..85c3b15f29e7 100644 --- a/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/pg_profile_lookup.ini +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/pg_profile_lookup.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # PG lossless profiles. # speed cable size xon xoff threshold 10000 5m 52224 19456 32768 0 diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/sai_3700.xml b/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/sai_3700.xml index a7ac42950668..4234a4c1d000 100644 --- a/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/sai_3700.xml +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/ACS-MSN3700/sai_3700.xml @@ -1,4 +1,20 @@ + diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/pcie.yaml b/device/mellanox/x86_64-mlnx_msn3700-r0/pcie.yaml index f9c4a2573153..7f2f50aab240 100644 --- a/device/mellanox/x86_64-mlnx_msn3700-r0/pcie.yaml +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/pcie.yaml @@ -1,3 +1,19 @@ +# +# Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# - bus: '00' dev: '00' fn: '0' diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/platform_asic b/device/mellanox/x86_64-mlnx_msn3700-r0/platform_asic new file mode 100644 index 000000000000..70c074885557 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/platform_asic @@ -0,0 +1 @@ +mellanox diff --git a/device/mellanox/x86_64-mlnx_msn3700_simx-r0/platform.json b/device/mellanox/x86_64-mlnx_msn3700_simx-r0/platform.json new file mode 120000 index 000000000000..e32316c3be95 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3700_simx-r0/platform.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn3700-r0/platform.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3700_simx-r0/platform_asic b/device/mellanox/x86_64-mlnx_msn3700_simx-r0/platform_asic new file mode 100644 index 000000000000..70c074885557 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3700_simx-r0/platform_asic @@ -0,0 +1 @@ +mellanox diff --git a/device/mellanox/x86_64-mlnx_msn3700_simx-r0/pmon_daemon_control.json b/device/mellanox/x86_64-mlnx_msn3700_simx-r0/pmon_daemon_control.json deleted file mode 100644 index dd83c2db12c5..000000000000 --- a/device/mellanox/x86_64-mlnx_msn3700_simx-r0/pmon_daemon_control.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "skip_ledd": true, - "skip_xcvrd": true, - "skip_psud": true, - "skip_pcied": true, - "skip_thermalctld": true -} diff --git a/device/mellanox/x86_64-mlnx_msn3700_simx-r0/pmon_daemon_control.json b/device/mellanox/x86_64-mlnx_msn3700_simx-r0/pmon_daemon_control.json new file mode 120000 index 000000000000..d9fa54f8d2b9 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3700_simx-r0/pmon_daemon_control.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700_simx-r0/pmon_daemon_control.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3700c-r0/ACS-MSN3700C/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn3700c-r0/ACS-MSN3700C/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..33b6704f9902 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3700c-r0/ACS-MSN3700C/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3700c-r0/pcie.yaml b/device/mellanox/x86_64-mlnx_msn3700c-r0/pcie.yaml index 6daf5eefa130..3c3006b5b4c8 100644 --- a/device/mellanox/x86_64-mlnx_msn3700c-r0/pcie.yaml +++ b/device/mellanox/x86_64-mlnx_msn3700c-r0/pcie.yaml @@ -1,3 +1,19 @@ +# +# Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# - bus: '00' dev: '00' fn: '0' diff --git a/device/mellanox/x86_64-mlnx_msn3700c-r0/platform_asic b/device/mellanox/x86_64-mlnx_msn3700c-r0/platform_asic new file mode 100644 index 000000000000..70c074885557 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3700c-r0/platform_asic @@ -0,0 +1 @@ +mellanox diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..33b6704f9902 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t0.j2 index 82631fa1b3f3..6f6774e3b911 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t0.j2 @@ -1,110 +1,39 @@ +{# + Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '13924352' %} {% set ingress_lossy_pool_size = '13924352' %} {% set egress_lossless_pool_size = '34287552' %} {% set egress_lossy_pool_size = '13924352' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "ingress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossy_pool_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossy_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} -{% endfor %} - } +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t1.j2 index 44ef77cf93e9..c3781ef6d5da 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/buffers_defaults_t1.j2 @@ -1,110 +1,39 @@ +{# + Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '12457984' %} {% set ingress_lossy_pool_size = '12457984' %} {% set egress_lossless_pool_size = '34287552' %} {% set egress_lossy_pool_size = '12457984' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "ingress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossy_pool_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossy_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} -{% endfor %} - } +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/pg_profile_lookup.ini index 320daa45d29b..a025c159759e 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/pg_profile_lookup.ini +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/pg_profile_lookup.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # PG lossless profiles. # speed cable size xon xoff threshold 10000 5m 54272 19456 34816 0 diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/port_config.ini b/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/port_config.ini index d43b11a22eb6..ad1883259f2a 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/port_config.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # name lanes alias index Ethernet0 0,1,2,3 etp1 1 Ethernet4 4,5,6,7 etp2 2 diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/sai_3800.xml b/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/sai_3800.xml index 4d9cc3cf7f8c..85d33f9da6c8 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/sai_3800.xml +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/ACS-MSN3800/sai_3800.xml @@ -1,4 +1,20 @@ + diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..c01aebb7ae12 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t0.j2 index 7f7a7f7c7f7f..a993c2f230e6 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t0.j2 @@ -1,104 +1,39 @@ +{# + Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '25866240' %} {% set ingress_lossless_pool_xoff = '2523136' %} {% set egress_lossless_pool_size = '34287552' %} {% set egress_lossy_pool_size = '25866240' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_pool_xoff }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} -{% endfor %} - } +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t1.j2 index 7ab2d7cddb3d..0482d37d4f5e 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/buffers_defaults_t1.j2 @@ -1,104 +1,39 @@ +{# + Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '24219648' %} {% set ingress_lossless_pool_xoff = '4169728' %} {% set egress_lossless_pool_size = '34287552' %} {% set egress_lossy_pool_size = '24219648' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_pool_xoff }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} -{% endfor %} - } +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/sai.profile b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/sai.profile index 35d3ce25a43a..9c74ce166084 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/sai.profile +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-C64/sai.profile @@ -1,4 +1,3 @@ SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_3800.xml -SAI_VXLAN_SRCPORT_RANGE_ENABLE=1 SAI_DUMP_STORE_PATH=/var/log/mellanox/sdk-dumps SAI_DUMP_STORE_AMOUNT=10 diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..c01aebb7ae12 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/buffers_defaults_t0.j2 index 51939d1ab3fc..88a9cc20732e 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/buffers_defaults_t0.j2 @@ -1,100 +1,39 @@ +{# + Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '20664320' %} -{% set ingress_lossless_xoff_size = '3321856' %} +{% set ingress_lossless_pool_xoff = '3321856' %} {% set egress_lossless_pool_size = '34287552' %} {% set egress_lossy_pool_size = '20664320' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_xoff_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} -{% endfor %} - } +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/buffers_defaults_t1.j2 index 5327842e9d1b..0e805a09a933 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/buffers_defaults_t1.j2 @@ -1,100 +1,39 @@ +{# + Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '19601408' %} -{% set ingress_lossless_xoff_size = '4384768' %} +{% set ingress_lossless_pool_xoff = '4384768' %} {% set egress_lossless_pool_size = '34287552' %} {% set egress_lossy_pool_size = '19601408' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_xoff_size }}", - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} -{% endfor %} - } +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/hwsku.json b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/hwsku.json deleted file mode 100644 index 2b1d5d322282..000000000000 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/hwsku.json +++ /dev/null @@ -1,346 +0,0 @@ -{ - "interfaces": { - "Ethernet0": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet2": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet4": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet6": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet8": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet10": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet12": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet14": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet16": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet18": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet20": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet22": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet24": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet26": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet28": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet30": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet32": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet34": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet36": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet38": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet40": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet42": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet44": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet46": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet48": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet50": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet52": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet54": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet56": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet58": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet60": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet62": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet64": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet66": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet68": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet70": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet72": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet74": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet76": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet78": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet80": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet82": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet84": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet86": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet88": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet90": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet92": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet94": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet96": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet98": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet100": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet102": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet104": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet106": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet108": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet110": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet112": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet114": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet116": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet118": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet120": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet122": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet124": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet126": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet128": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet130": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet132": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet134": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet136": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet138": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet140": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet142": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet144": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet146": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet148": { - "default_brkout_mode": "1x10G[100G,50G,40G,25G]" - }, - "Ethernet152": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet154": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet156": { - "default_brkout_mode": "1x10G[100G,50G,40G,25G]" - }, - "Ethernet160": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet162": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet164": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet166": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet168": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet170": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet172": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet174": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet176": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet178": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet180": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet182": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet184": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet186": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet188": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet190": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet192": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet194": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet196": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet198": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet200": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet202": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet204": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet206": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet208": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet212": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet216": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet220": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet224": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet228": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet232": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet236": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet240": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet244": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet248": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet252": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - } - } -} diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/port_config.ini b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/port_config.ini index 535556ebfb3b..e092e0810f6a 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/port_config.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # name lanes alias index speed Ethernet0 0,1 etp1a 1 50000 Ethernet2 2,3 etp1b 1 50000 diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/sai.profile b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/sai.profile index 5543225b55f5..2d6c6ad4acc8 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/sai.profile +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/sai.profile @@ -1,2 +1 @@ SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_3800_2x10g_100x50g_12x100g.xml -SAI_VXLAN_SRCPORT_RANGE_ENABLE=1 diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/sai_3800_2x10g_100x50g_12x100g.xml b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/sai_3800_2x10g_100x50g_12x100g.xml index bf0fa4ca6909..b50bc30fb9a1 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/sai_3800_2x10g_100x50g_12x100g.xml +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D100C12S2/sai_3800_2x10g_100x50g_12x100g.xml @@ -1,4 +1,20 @@ + diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..c01aebb7ae12 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t0.j2 index 8b2f123f2e76..7e3236b2f199 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t0.j2 @@ -1,104 +1,39 @@ +{# + Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '20017152' %} {% set ingress_lossless_pool_xoff = '3440640' %} {% set egress_lossless_pool_size = '34287552' %} {% set egress_lossy_pool_size = '20017152' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_pool_xoff }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} -{% endfor %} - } +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t1.j2 index b6e9490fe28c..2282534322fc 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/buffers_defaults_t1.j2 @@ -1,104 +1,39 @@ +{# + Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '19124224' %} {% set ingress_lossless_pool_xoff = '4333568' %} {% set egress_lossless_pool_size = '34287552' %} {% set egress_lossy_pool_size = '19124224' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_pool_xoff }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} -{% endfor %} - } +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/hwsku.json b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/hwsku.json deleted file mode 100644 index 5bc784192c84..000000000000 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/hwsku.json +++ /dev/null @@ -1,364 +0,0 @@ -{ - "interfaces": { - "Ethernet0": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet2": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet4": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet6": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet8": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet10": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet12": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet14": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet16": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet18": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet20": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet22": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet24": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet26": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet28": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet30": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet32": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet34": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet36": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet38": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet40": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet42": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet44": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet46": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet48": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet50": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet52": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet54": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet56": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet58": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet60": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet62": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet64": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet66": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet68": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet70": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet72": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet74": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet76": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet78": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet80": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet82": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet84": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet86": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet88": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet90": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet92": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet94": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet96": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet100": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet104": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet106": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet108": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet110": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet112": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet116": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet120": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet122": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet124": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet126": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet128": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet132": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet136": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet138": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet140": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet142": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet144": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet148": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet152": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet154": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet156": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet158": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet160": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet162": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet164": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet166": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet168": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet170": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet172": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet174": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet176": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet178": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet180": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet182": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet184": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet186": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet188": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet190": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet192": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet194": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet196": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet198": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet200": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet202": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet204": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet206": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet208": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet210": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet212": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet214": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet216": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet218": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet220": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet222": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet224": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet226": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet228": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet230": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet232": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet234": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet236": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet238": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet240": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet242": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet244": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet246": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet248": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet250": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet252": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet254": { - "default_brkout_mode": "2x50G[25G,10G]" - } - } -} diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/pg_profile_lookup.ini index fd98cbe468bc..84b2ea701961 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/pg_profile_lookup.ini +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/pg_profile_lookup.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # PG lossless profiles. # speed cable size xon xoff threshold 10000 5m 19456 19456 25600 0 diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/port_config.ini b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/port_config.ini index 8e40d6bd41ec..d3a100a8486d 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/port_config.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # name lanes alias index speed Ethernet0 0,1 etp1a 1 50000 Ethernet2 2,3 etp1b 1 50000 diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/sai.profile b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/sai.profile index 8e672b95e232..181ced0f1269 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/sai.profile +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/sai.profile @@ -1,4 +1,3 @@ SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_3800_112x50g_8x100g.xml -SAI_VXLAN_SRCPORT_RANGE_ENABLE=1 SAI_DUMP_STORE_PATH=/var/log/mellanox/sdk-dumps SAI_DUMP_STORE_AMOUNT=10 diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/sai_3800_112x50g_8x100g.xml b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/sai_3800_112x50g_8x100g.xml index a72edb85633d..250c4269f891 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/sai_3800_112x50g_8x100g.xml +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D112C8/sai_3800_112x50g_8x100g.xml @@ -1,4 +1,20 @@ + @@ -46,6 +62,7 @@ 4 51 3 + 2 384 @@ -77,6 +94,7 @@ 4 55 3 + 2 384 @@ -108,6 +126,7 @@ 4 59 3 + 2 384 @@ -139,6 +158,7 @@ 4 63 3 + 2 384 @@ -170,6 +190,7 @@ 4 15 3 + 2 384 @@ -201,6 +222,7 @@ 4 11 3 + 2 384 @@ -232,6 +254,7 @@ 4 7 3 + 2 384 @@ -263,6 +286,7 @@ 4 3 3 + 2 384 @@ -294,6 +318,7 @@ 4 47 3 + 2 384 @@ -325,6 +350,7 @@ 4 43 3 + 2 384 @@ -354,6 +380,7 @@ 4 39 3 + 2 384 @@ -383,6 +410,7 @@ 4 35 3 + 2 384 @@ -414,6 +442,7 @@ 4 19 3 + 2 384 @@ -445,6 +474,7 @@ 4 23 3 + 2 384 @@ -474,6 +504,7 @@ 4 27 3 + 2 384 @@ -503,8 +534,9 @@ 4 31 3 + 2 384 - + \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..c01aebb7ae12 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t0.j2 index dc5342b10a80..41c55324b63c 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t0.j2 @@ -1,104 +1,39 @@ +{# + Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '24576000' %} {% set ingress_lossless_pool_xoff = '2756608' %} {% set egress_lossless_pool_size = '34287552' %} {% set egress_lossy_pool_size = '24576000' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_pool_xoff }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} -{% endfor %} - } +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t1.j2 index fefb9e60f870..a3daf90d639f 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/buffers_defaults_t1.j2 @@ -1,104 +1,39 @@ +{# + Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '22597632' %} {% set ingress_lossless_pool_xoff = '4734976' %} {% set egress_lossless_pool_size = '34287552' %} {% set egress_lossy_pool_size = '22597632' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_pool_xoff }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} -{% endfor %} - } +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/port_config.ini b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/port_config.ini index 87d4485963f7..001b7c1aa400 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/port_config.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # name lanes alias index speed Ethernet0 0,1,2,3 etp1 1 100000 Ethernet4 4,5,6,7 etp2 2 100000 diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/sai_3800_24x50g_52x100g.xml b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/sai_3800_24x50g_52x100g.xml index 1b3c77ce381c..0ce4e0d8e66b 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/sai_3800_24x50g_52x100g.xml +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D24C52/sai_3800_24x50g_52x100g.xml @@ -1,4 +1,20 @@ + diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..c01aebb7ae12 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/buffers_defaults_t0.j2 index 974b747c6721..d465c68c1672 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/buffers_defaults_t0.j2 @@ -1,100 +1,39 @@ +{# + Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '24360960' %} {% set ingress_lossless_pool_xoff = '2795520' %} {% set egress_lossless_pool_size = '34287552' %} {% set egress_lossy_pool_size = '24360960' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_pool_xoff }}", - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} -{% endfor %} - } +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/buffers_defaults_t1.j2 index cde3e85ba469..f2f57077c459 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/buffers_defaults_t1.j2 @@ -1,100 +1,39 @@ +{# + Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '22380544' %} {% set ingress_lossless_pool_xoff = '4775936' %} {% set egress_lossless_pool_size = '34287552' %} {% set egress_lossy_pool_size = '22380544' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_pool_xoff }}", - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - "size": "{{ egress_lossy_pool_size }}", - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} -{% endfor %} - } +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/hwsku.json b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/hwsku.json deleted file mode 100644 index 83c69052a64c..000000000000 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/hwsku.json +++ /dev/null @@ -1,238 +0,0 @@ -{ - "interfaces": { - "Ethernet0": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet4": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet8": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet12": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet16": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet20": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet24": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet28": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet32": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet34": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet36": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet38": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet40": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet42": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet44": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet46": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet48": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet52": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet56": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet60": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet64": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet68": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet72": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet76": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet80": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet84": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet88": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet92": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet96": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet100": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet104": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet106": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet108": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet110": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet112": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet116": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet120": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet124": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet128": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet132": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet136": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet140": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet144": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet148": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet152": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet156": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet160": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet164": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet166": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet168": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet172": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet176": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet178": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet180": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet182": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet184": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet186": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet188": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet190": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet192": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet196": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet200": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet204": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet208": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet212": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet216": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet220": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet224": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet228": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet232": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet236": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet240": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet242": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet244": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet246": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet248": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet250": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet252": { - "default_brkout_mode": "1x10G[100G,50G,40G,25G]" - } - } -} diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/port_config.ini b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/port_config.ini index 5f9a4de25b96..b80b308dd724 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/port_config.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # name lanes alias index speed Ethernet0 0,1,2,3 etp1 1 100000 Ethernet4 4,5,6,7 etp2 2 100000 diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/sai.profile b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/sai.profile index 4846e323ae99..bd07d661025d 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/sai.profile +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/sai.profile @@ -1,4 +1,3 @@ SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_3800_1x10g_28x50g_49x100g.xml -SAI_VXLAN_SRCPORT_RANGE_ENABLE=1 SAI_DUMP_STORE_PATH=/var/log/mellanox/sdk-dumps SAI_DUMP_STORE_AMOUNT=10 diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/sai_3800_1x10g_28x50g_49x100g.xml b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/sai_3800_1x10g_28x50g_49x100g.xml index 5844f53f4c0a..ed308a83aabb 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/sai_3800_1x10g_28x50g_49x100g.xml +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C49S1/sai_3800_1x10g_28x50g_49x100g.xml @@ -1,4 +1,20 @@ + diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..c01aebb7ae12 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t0.j2 index ac6b58a305b0..d465c68c1672 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t0.j2 @@ -1,104 +1,39 @@ +{# + Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '24360960' %} {% set ingress_lossless_pool_xoff = '2795520' %} {% set egress_lossless_pool_size = '34287552' %} {% set egress_lossy_pool_size = '24360960' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_pool_xoff }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} -{% endfor %} - } +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t1.j2 index 7f2f4afc90cb..f2f57077c459 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/buffers_defaults_t1.j2 @@ -1,104 +1,39 @@ +{# + Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '22380544' %} {% set ingress_lossless_pool_xoff = '4775936' %} {% set egress_lossless_pool_size = '34287552' %} {% set egress_lossy_pool_size = '22380544' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_pool_xoff }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} -{% endfor %} - } +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/hwsku.json b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/hwsku.json deleted file mode 100644 index f7334a858bf1..000000000000 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/hwsku.json +++ /dev/null @@ -1,238 +0,0 @@ -{ - "interfaces": { - "Ethernet0": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet4": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet8": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet12": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet16": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet20": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet24": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet28": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet32": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet34": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet36": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet38": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet40": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet42": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet44": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet46": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet48": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet52": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet56": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet60": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet64": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet68": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet72": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet76": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet80": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet84": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet88": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet92": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet96": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet100": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet104": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet106": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet108": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet110": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet112": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet116": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet120": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet124": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet128": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet132": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet136": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet140": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet144": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet148": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet152": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet156": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet160": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet164": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet168": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet172": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet176": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet178": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet180": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet182": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet184": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet186": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet188": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet190": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet192": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet196": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet200": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet204": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet208": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet212": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet216": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet220": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet224": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet228": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet232": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet236": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G]" - }, - "Ethernet240": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet242": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet244": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet246": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet248": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet250": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet252": { - "default_brkout_mode": "2x50G[25G,10G]" - }, - "Ethernet254": { - "default_brkout_mode": "2x50G[25G,10G]" - } - } -} diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/port_config.ini b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/port_config.ini index 95f42923c11f..1c03c123f906 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/port_config.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # name lanes alias index speed Ethernet0 0,1,2,3 etp1 1 100000 Ethernet4 4,5,6,7 etp2 2 100000 diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/sai.profile b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/sai.profile index ea9a7997fc04..ef03ceff837e 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/sai.profile +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/sai.profile @@ -1,4 +1,3 @@ SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_3800_28x50g_52x100g.xml -SAI_VXLAN_SRCPORT_RANGE_ENABLE=1 SAI_DUMP_STORE_PATH=/var/log/mellanox/sdk-dumps SAI_DUMP_STORE_AMOUNT=10 diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/sai_3800_28x50g_52x100g.xml b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/sai_3800_28x50g_52x100g.xml index 1b3c77ce381c..0ce4e0d8e66b 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/sai_3800_28x50g_52x100g.xml +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/Mellanox-SN3800-D28C50/sai_3800_28x50g_52x100g.xml @@ -1,4 +1,20 @@ + diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/platform.json b/device/mellanox/x86_64-mlnx_msn3800-r0/platform.json index 92865e228ee5..fa50c8850844 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/platform.json @@ -724,576 +724,448 @@ "index": "1,1,1,1", "lanes": "0,1,2,3", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp1"], - "1x10G[100G,50G,40G,25G]": ["etp1"], - "2x50G[25G,10G]": ["etp1a", "etp1b"] + "1x100G[50G,40G,25G,10G]": ["etp1"] } }, "Ethernet4": { "index": "2,2,2,2", "lanes": "4,5,6,7", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp2"], - "1x10G[100G,50G,40G,25G]": ["etp2"], - "2x50G[25G,10G]": ["etp2a", "etp2b"] + "1x100G[50G,40G,25G,10G]": ["etp2"] } }, "Ethernet8": { "index": "3,3,3,3", "lanes": "8,9,10,11", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp3"], - "1x10G[100G,50G,40G,25G]": ["etp3"], - "2x50G[25G,10G]": ["etp3a", "etp3b"] + "1x100G[50G,40G,25G,10G]": ["etp3"] } }, "Ethernet12": { "index": "4,4,4,4", "lanes": "12,13,14,15", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp4"], - "1x10G[100G,50G,40G,25G]": ["etp4"], - "2x50G[25G,10G]": ["etp4a", "etp4b"] + "1x100G[50G,40G,25G,10G]": ["etp4"] } }, "Ethernet16": { "index": "5,5,5,5", "lanes": "16,17,18,19", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp5"], - "1x10G[100G,50G,40G,25G]": ["etp5"], - "2x50G[25G,10G]": ["etp5a", "etp5b"] + "1x100G[50G,40G,25G,10G]": ["etp5"] } }, "Ethernet20": { "index": "6,6,6,6", "lanes": "20,21,22,23", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp6"], - "1x10G[100G,50G,40G,25G]": ["etp6"], - "2x50G[25G,10G]": ["etp6a", "etp6b"] + "1x100G[50G,40G,25G,10G]": ["etp6"] } }, "Ethernet24": { "index": "7,7,7,7", "lanes": "24,25,26,27", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp7"], - "1x10G[100G,50G,40G,25G]": ["etp7"], - "2x50G[25G,10G]": ["etp7a", "etp7b"] + "1x100G[50G,40G,25G,10G]": ["etp7"] } }, "Ethernet28": { "index": "8,8,8,8", "lanes": "28,29,30,31", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp8"], - "1x10G[100G,50G,40G,25G]": ["etp8"], - "2x50G[25G,10G]": ["etp8a", "etp8b"] + "1x100G[50G,40G,25G,10G]": ["etp8"] } }, "Ethernet32": { "index": "9,9,9,9", "lanes": "32,33,34,35", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp9"], - "1x10G[100G,50G,40G,25G]": ["etp9"], - "2x50G[25G,10G]": ["etp9a", "etp9b"] + "1x100G[50G,40G,25G,10G]": ["etp9"] } }, "Ethernet36": { "index": "10,10,10,10", "lanes": "36,37,38,39", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp10"], - "1x10G[100G,50G,40G,25G]": ["etp10"], - "2x50G[25G,10G]": ["etp10a", "etp10b"] + "1x100G[50G,40G,25G,10G]": ["etp10"] } }, "Ethernet40": { "index": "11,11,11,11", "lanes": "40,41,42,43", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp11"], - "1x10G[100G,50G,40G,25G]": ["etp11"], - "2x50G[25G,10G]": ["etp11a", "etp11b"] + "1x100G[50G,40G,25G,10G]": ["etp11"] } }, "Ethernet44": { "index": "12,12,12,12", "lanes": "44,45,46,47", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp12"], - "1x10G[100G,50G,40G,25G]": ["etp12"], - "2x50G[25G,10G]": ["etp12a", "etp12b"] + "1x100G[50G,40G,25G,10G]": ["etp12"] } }, "Ethernet48": { "index": "13,13,13,13", "lanes": "48,49,50,51", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp13"], - "1x10G[100G,50G,40G,25G]": ["etp13"], - "2x50G[25G,10G]": ["etp13a", "etp13b"] + "1x100G[50G,40G,25G,10G]": ["etp13"] } }, "Ethernet52": { "index": "14,14,14,14", "lanes": "52,53,54,55", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp14"], - "1x10G[100G,50G,40G,25G]": ["etp14"], - "2x50G[25G,10G]": ["etp14a", "etp14b"] + "1x100G[50G,40G,25G,10G]": ["etp14"] } }, "Ethernet56": { "index": "15,15,15,15", "lanes": "56,57,58,59", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp15"], - "1x10G[100G,50G,40G,25G]": ["etp15"], - "2x50G[25G,10G]": ["etp15a", "etp15b"] + "1x100G[50G,40G,25G,10G]": ["etp15"] } }, "Ethernet60": { "index": "16,16,16,16", "lanes": "60,61,62,63", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp16"], - "1x10G[100G,50G,40G,25G]": ["etp16"], - "2x50G[25G,10G]": ["etp16a", "etp16b"] + "1x100G[50G,40G,25G,10G]": ["etp16"] } }, "Ethernet64": { "index": "17,17,17,17", "lanes": "64,65,66,67", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp17"], - "1x10G[100G,50G,40G,25G]": ["etp17"], - "2x50G[25G,10G]": ["etp17a", "etp17b"] + "1x100G[50G,40G,25G,10G]": ["etp17"] } }, "Ethernet68": { "index": "18,18,18,18", "lanes": "68,69,70,71", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp18"], - "1x10G[100G,50G,40G,25G]": ["etp18"], - "2x50G[25G,10G]": ["etp18a", "etp18b"] + "1x100G[50G,40G,25G,10G]": ["etp18"] } }, "Ethernet72": { "index": "19,19,19,19", "lanes": "72,73,74,75", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp19"], - "1x10G[100G,50G,40G,25G]": ["etp19"], - "2x50G[25G,10G]": ["etp19a", "etp19b"] + "1x100G[50G,40G,25G,10G]": ["etp19"] } }, "Ethernet76": { "index": "20,20,20,20", "lanes": "76,77,78,79", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp20"], - "1x10G[100G,50G,40G,25G]": ["etp20"], - "2x50G[25G,10G]": ["etp20a", "etp20b"] + "1x100G[50G,40G,25G,10G]": ["etp20"] } }, "Ethernet80": { "index": "21,21,21,21", "lanes": "80,81,82,83", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp21"], - "1x10G[100G,50G,40G,25G]": ["etp21"], - "2x50G[25G,10G]": ["etp21a", "etp21b"] + "1x100G[50G,40G,25G,10G]": ["etp21"] } }, "Ethernet84": { "index": "22,22,22,22", "lanes": "84,85,86,87", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp22"], - "1x10G[100G,50G,40G,25G]": ["etp22"], - "2x50G[25G,10G]": ["etp22a", "etp22b"] + "1x100G[50G,40G,25G,10G]": ["etp22"] } }, "Ethernet88": { "index": "23,23,23,23", "lanes": "88,89,90,91", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp23"], - "1x10G[100G,50G,40G,25G]": ["etp23"], - "2x50G[25G,10G]": ["etp23a", "etp23b"] + "1x100G[50G,40G,25G,10G]": ["etp23"] } }, "Ethernet92": { "index": "24,24,24,24", "lanes": "92,93,94,95", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp24"], - "1x10G[100G,50G,40G,25G]": ["etp24"], - "2x50G[25G,10G]": ["etp24a", "etp24b"] + "1x100G[50G,40G,25G,10G]": ["etp24"] } }, "Ethernet96": { "index": "25,25,25,25", "lanes": "96,97,98,99", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp25"], - "1x10G[100G,50G,40G,25G]": ["etp25"], - "2x50G[25G,10G]": ["etp25a", "etp25b"] + "1x100G[50G,40G,25G,10G]": ["etp25"] } }, "Ethernet100": { "index": "26,26,26,26", "lanes": "100,101,102,103", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp26"], - "1x10G[100G,50G,40G,25G]": ["etp26"], - "2x50G[25G,10G]": ["etp26a", "etp26b"] + "1x100G[50G,40G,25G,10G]": ["etp26"] } }, "Ethernet104": { "index": "27,27,27,27", "lanes": "104,105,106,107", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp27"], - "1x10G[100G,50G,40G,25G]": ["etp27"], - "2x50G[25G,10G]": ["etp27a", "etp27b"] + "1x100G[50G,40G,25G,10G]": ["etp27"] } }, "Ethernet108": { "index": "28,28,28,28", "lanes": "108,109,110,111", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp28"], - "1x10G[100G,50G,40G,25G]": ["etp28"], - "2x50G[25G,10G]": ["etp28a", "etp28b"] + "1x100G[50G,40G,25G,10G]": ["etp28"] } }, "Ethernet112": { "index": "29,29,29,29", "lanes": "112,113,114,115", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp29"], - "1x10G[100G,50G,40G,25G]": ["etp29"], - "2x50G[25G,10G]": ["etp29a", "etp29b"] + "1x100G[50G,40G,25G,10G]": ["etp29"] } }, "Ethernet116": { "index": "30,30,30,30", "lanes": "116,117,118,119", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp30"], - "1x10G[100G,50G,40G,25G]": ["etp30"], - "2x50G[25G,10G]": ["etp30a", "etp30b"] + "1x100G[50G,40G,25G,10G]": ["etp30"] } }, "Ethernet120": { "index": "31,31,31,31", "lanes": "120,121,122,123", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp31"], - "1x10G[100G,50G,40G,25G]": ["etp31"], - "2x50G[25G,10G]": ["etp31a", "etp31b"] + "1x100G[50G,40G,25G,10G]": ["etp31"] } }, "Ethernet124": { "index": "32,32,32,32", "lanes": "124,125,126,127", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp32"], - "1x10G[100G,50G,40G,25G]": ["etp32"], - "2x50G[25G,10G]": ["etp32a", "etp32b"] + "1x100G[50G,40G,25G,10G]": ["etp32"] } }, "Ethernet128": { "index": "33,33,33,33", "lanes": "128,129,130,131", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp33"], - "1x10G[100G,50G,40G,25G]": ["etp33"], - "2x50G[25G,10G]": ["etp33a", "etp33b"] + "1x100G[50G,40G,25G,10G]": ["etp33"] } }, "Ethernet132": { "index": "34,34,34,34", "lanes": "132,133,134,135", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp34"], - "1x10G[100G,50G,40G,25G]": ["etp34"], - "2x50G[25G,10G]": ["etp34a", "etp34b"] + "1x100G[50G,40G,25G,10G]": ["etp34"] } }, "Ethernet136": { "index": "35,35,35,35", "lanes": "136,137,138,139", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp35"], - "1x10G[100G,50G,40G,25G]": ["etp35"], - "2x50G[25G,10G]": ["etp35a", "etp35b"] + "1x100G[50G,40G,25G,10G]": ["etp35"] } }, "Ethernet140": { "index": "36,36,36,36", "lanes": "140,141,142,143", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp36"], - "1x10G[100G,50G,40G,25G]": ["etp36"], - "2x50G[25G,10G]": ["etp36a", "etp36b"] + "1x100G[50G,40G,25G,10G]": ["etp36"] } }, "Ethernet144": { "index": "37,37,37,37", "lanes": "144,145,146,147", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp37"], - "1x10G[100G,50G,40G,25G]": ["etp37"], - "2x50G[25G,10G]": ["etp37a", "etp37b"] + "1x100G[50G,40G,25G,10G]": ["etp37"] } }, "Ethernet148": { "index": "38,38,38,38", "lanes": "148,149,150,151", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp38"], - "1x10G[100G,50G,40G,25G]": ["etp38"], - "2x50G[25G,10G]": ["etp38a", "etp38b"] + "1x100G[50G,40G,25G,10G]": ["etp38"] } }, "Ethernet152": { "index": "39,39,39,39", "lanes": "152,153,154,155", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp39"], - "1x10G[100G,50G,40G,25G]": ["etp39"], - "2x50G[25G,10G]": ["etp39a", "etp39b"] + "1x100G[50G,40G,25G,10G]": ["etp39"] } }, "Ethernet156": { "index": "40,40,40,40", "lanes": "156,157,158,159", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp40"], - "1x10G[100G,50G,40G,25G]": ["etp40"], - "2x50G[25G,10G]": ["etp40a", "etp40b"] + "1x100G[50G,40G,25G,10G]": ["etp40"] } }, "Ethernet160": { "index": "41,41,41,41", "lanes": "160,161,162,163", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp41"], - "1x10G[100G,50G,40G,25G]": ["etp41"], - "2x50G[25G,10G]": ["etp41a", "etp41b"] + "1x100G[50G,40G,25G,10G]": ["etp41"] } }, "Ethernet164": { "index": "42,42,42,42", "lanes": "164,165,166,167", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp42"], - "1x10G[100G,50G,40G,25G]": ["etp42"], - "2x50G[25G,10G]": ["etp42a", "etp42b"] + "1x100G[50G,40G,25G,10G]": ["etp42"] } }, "Ethernet168": { "index": "43,43,43,43", "lanes": "168,169,170,171", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp43"], - "1x10G[100G,50G,40G,25G]": ["etp43"], - "2x50G[25G,10G]": ["etp43a", "etp43b"] + "1x100G[50G,40G,25G,10G]": ["etp43"] } }, "Ethernet172": { "index": "44,44,44,44", "lanes": "172,173,174,175", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp44"], - "1x10G[100G,50G,40G,25G]": ["etp44"], - "2x50G[25G,10G]": ["etp44a", "etp44b"] + "1x100G[50G,40G,25G,10G]": ["etp44"] } }, "Ethernet176": { "index": "45,45,45,45", "lanes": "176,177,178,179", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp45"], - "1x10G[100G,50G,40G,25G]": ["etp45"], - "2x50G[25G,10G]": ["etp45a", "etp45b"] + "1x100G[50G,40G,25G,10G]": ["etp45"] } }, "Ethernet180": { "index": "46,46,46,46", "lanes": "180,181,182,183", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp46"], - "1x10G[100G,50G,40G,25G]": ["etp46"], - "2x50G[25G,10G]": ["etp46a", "etp46b"] + "1x100G[50G,40G,25G,10G]": ["etp46"] } }, "Ethernet184": { "index": "47,47,47,47", "lanes": "184,185,186,187", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp47"], - "1x10G[100G,50G,40G,25G]": ["etp47"], - "2x50G[25G,10G]": ["etp47a", "etp47b"] + "1x100G[50G,40G,25G,10G]": ["etp47"] } }, "Ethernet188": { "index": "48,48,48,48", "lanes": "188,189,190,191", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp48"], - "1x10G[100G,50G,40G,25G]": ["etp48"], - "2x50G[25G,10G]": ["etp48a", "etp48b"] + "1x100G[50G,40G,25G,10G]": ["etp48"] } }, "Ethernet192": { "index": "49,49,49,49", "lanes": "192,193,194,195", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp49"], - "1x10G[100G,50G,40G,25G]": ["etp49"], - "2x50G[25G,10G]": ["etp49a", "etp49b"] + "1x100G[50G,40G,25G,10G]": ["etp49"] } }, "Ethernet196": { "index": "50,50,50,50", "lanes": "196,197,198,199", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp50"], - "1x10G[100G,50G,40G,25G]": ["etp50"], - "2x50G[25G,10G]": ["etp50a", "etp50b"] + "1x100G[50G,40G,25G,10G]": ["etp50"] } }, "Ethernet200": { "index": "51,51,51,51", "lanes": "200,201,202,203", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp51"], - "1x10G[100G,50G,40G,25G]": ["etp51"], - "2x50G[25G,10G]": ["etp51a", "etp51b"] + "1x100G[50G,40G,25G,10G]": ["etp51"] } }, "Ethernet204": { "index": "52,52,52,52", "lanes": "204,205,206,207", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp52"], - "1x10G[100G,50G,40G,25G]": ["etp52"], - "2x50G[25G,10G]": ["etp52a", "etp52b"] + "1x100G[50G,40G,25G,10G]": ["etp52"] } }, "Ethernet208": { "index": "53,53,53,53", "lanes": "208,209,210,211", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp53"], - "1x10G[100G,50G,40G,25G]": ["etp53"], - "2x50G[25G,10G]": ["etp53a", "etp53b"] + "1x100G[50G,40G,25G,10G]": ["etp53"] } }, "Ethernet212": { "index": "54,54,54,54", "lanes": "212,213,214,215", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp54"], - "1x10G[100G,50G,40G,25G]": ["etp54"], - "2x50G[25G,10G]": ["etp54a", "etp54b"] + "1x100G[50G,40G,25G,10G]": ["etp54"] } }, "Ethernet216": { "index": "55,55,55,55", "lanes": "216,217,218,219", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp55"], - "1x10G[100G,50G,40G,25G]": ["etp55"], - "2x50G[25G,10G]": ["etp55a", "etp55b"] + "1x100G[50G,40G,25G,10G]": ["etp55"] } }, "Ethernet220": { "index": "56,56,56,56", "lanes": "220,221,222,223", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp56"], - "1x10G[100G,50G,40G,25G]": ["etp56"], - "2x50G[25G,10G]": ["etp56a", "etp56b"] + "1x100G[50G,40G,25G,10G]": ["etp56"] } }, "Ethernet224": { "index": "57,57,57,57", "lanes": "224,225,226,227", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp57"], - "1x10G[100G,50G,40G,25G]": ["etp57"], - "2x50G[25G,10G]": ["etp57a", "etp57b"] + "1x100G[50G,40G,25G,10G]": ["etp57"] } }, "Ethernet228": { "index": "58,58,58,58", "lanes": "228,229,230,231", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp58"], - "1x10G[100G,50G,40G,25G]": ["etp58"], - "2x50G[25G,10G]": ["etp58a", "etp58b"] + "1x100G[50G,40G,25G,10G]": ["etp58"] } }, "Ethernet232": { "index": "59,59,59,59", "lanes": "232,233,234,235", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp59"], - "1x10G[100G,50G,40G,25G]": ["etp59"], - "2x50G[25G,10G]": ["etp59a", "etp59b"] + "1x100G[50G,40G,25G,10G]": ["etp59"] } }, "Ethernet236": { "index": "60,60,60,60", "lanes": "236,237,238,239", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp60"], - "1x10G[100G,50G,40G,25G]": ["etp60"], - "2x50G[25G,10G]": ["etp60a", "etp60b"] + "1x100G[50G,40G,25G,10G]": ["etp60"] } }, "Ethernet240": { "index": "61,61,61,61", "lanes": "240,241,242,243", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp61"], - "1x10G[100G,50G,40G,25G]": ["etp61"], - "2x50G[25G,10G]": ["etp61a", "etp61b"] + "1x100G[50G,40G,25G,10G]": ["etp61"] } }, "Ethernet244": { "index": "62,62,62,62", "lanes": "244,245,246,247", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp62"], - "1x10G[100G,50G,40G,25G]": ["etp62"], - "2x50G[25G,10G]": ["etp62a", "etp62b"] + "1x100G[50G,40G,25G,10G]": ["etp62"] } }, "Ethernet248": { "index": "63,63,63,63", "lanes": "248,249,250,251", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp63"], - "1x10G[100G,50G,40G,25G]": ["etp63"], - "2x50G[25G,10G]": ["etp63a", "etp63b"] + "1x100G[50G,40G,25G,10G]": ["etp63"] } }, "Ethernet252": { "index": "64,64,64,64", "lanes": "252,253,254,255", "breakout_modes": { - "1x100G[50G,40G,25G,10G]": ["etp64"], - "1x10G[100G,50G,40G,25G]": ["etp64"], - "2x50G[25G,10G]": ["etp64a", "etp64b"] + "1x100G[50G,40G,25G,10G]": ["etp64"] } } } diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/platform_asic b/device/mellanox/x86_64-mlnx_msn3800-r0/platform_asic new file mode 100644 index 000000000000..70c074885557 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/platform_asic @@ -0,0 +1 @@ +mellanox diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/port_peripheral_config.j2 b/device/mellanox/x86_64-mlnx_msn3800-r0/port_peripheral_config.j2 index 1cad105ed1ee..a89479dd14fe 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/port_peripheral_config.j2 +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/port_peripheral_config.j2 @@ -1,3 +1,19 @@ +{# + Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} [ {%- include 'peripheral_table.j2' %} , diff --git a/device/mellanox/x86_64-mlnx_msn4410-r0/ACS-MSN4410/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn4410-r0/ACS-MSN4410/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..33b6704f9902 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4410-r0/ACS-MSN4410/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4410-r0/ACS-MSN4410/hwsku.json b/device/mellanox/x86_64-mlnx_msn4410-r0/ACS-MSN4410/hwsku.json index f170ecd32b98..13eceb4baba5 100644 --- a/device/mellanox/x86_64-mlnx_msn4410-r0/ACS-MSN4410/hwsku.json +++ b/device/mellanox/x86_64-mlnx_msn4410-r0/ACS-MSN4410/hwsku.json @@ -1,76 +1,76 @@ { "interfaces": { "Ethernet0": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet8": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet16": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet24": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet32": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet40": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet48": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet56": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet64": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet72": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet80": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet88": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet96": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet104": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet112": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet120": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet128": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet136": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet144": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet152": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet160": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet168": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet176": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet184": { - "default_brkout_mode": "1x100G[50G,40G,25G,10G,1G]" + "default_brkout_mode": "2x100G[50G,40G,25G,10G,1G]" }, "Ethernet192": { "default_brkout_mode": "1x400G[200G,100G,50G,40G,25G,10G,1G]" diff --git a/device/mellanox/x86_64-mlnx_msn4410-r0/ACS-MSN4410/port_config.ini b/device/mellanox/x86_64-mlnx_msn4410-r0/ACS-MSN4410/port_config.ini index 3df8315b49ef..a43476ca0cbd 100644 --- a/device/mellanox/x86_64-mlnx_msn4410-r0/ACS-MSN4410/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn4410-r0/ACS-MSN4410/port_config.ini @@ -1,33 +1,73 @@ -# name lanes alias index -Ethernet0 0,1,2,3,4,5,6,7 etp1 1 -Ethernet8 8,9,10,11,12,13,14,15 etp2 2 -Ethernet16 16,17,18,19,20,21,22,23 etp3 3 -Ethernet24 24,25,26,27,28,29,30,31 etp4 4 -Ethernet32 32,33,34,35,36,37,38,39 etp5 5 -Ethernet40 40,41,42,43,44,45,46,47 etp6 6 -Ethernet48 48,49,50,51,52,53,54,55 etp7 7 -Ethernet56 56,57,58,59,60,61,62,63 etp8 8 -Ethernet64 64,65,66,67,68,69,70,71 etp9 9 -Ethernet72 72,73,74,75,76,77,78,79 etp10 10 -Ethernet80 80,81,82,83,84,85,86,87 etp11 11 -Ethernet88 88,89,90,91,92,93,94,95 etp12 12 -Ethernet96 96,97,98,99,100,101,102,103 etp13 13 -Ethernet104 104,105,106,107,108,109,110,111 etp14 14 -Ethernet112 112,113,114,115,116,117,118,119 etp15 15 -Ethernet120 120,121,122,123,124,125,126,127 etp16 16 -Ethernet128 128,129,130,131,132,133,134,135 etp17 17 -Ethernet136 136,137,138,139,140,141,142,143 etp18 18 -Ethernet144 144,145,146,147,148,149,150,151 etp19 19 -Ethernet152 152,153,154,155,156,157,158,159 etp20 20 -Ethernet160 160,161,162,163,164,165,166,167 etp21 21 -Ethernet168 168,169,170,171,172.173,174,175 etp22 22 -Ethernet176 176,177,178,179,180,181,182,183 etp23 23 -Ethernet184 184,185,186,187,188,189,190,191 etp24 24 -Ethernet192 192,193,194,195,196,197,198,199 etp25 25 -Ethernet200 200,201,202,203,204,205,206,207 etp26 26 -Ethernet208 208,209,210,211,212,213,214,215 etp27 27 -Ethernet216 216,217,218,219,220,221,222,223 etp28 28 -Ethernet224 224,225,226,227,228,229,230,231 etp29 29 -Ethernet232 232,233,234,235,236,237,238,239 etp30 30 -Ethernet240 240,241,242,243,244,245,246,247 etp31 31 -Ethernet248 248,249,250,251,252,253,254,255 etp32 32 +## +## Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## +# name lanes alias index speed +Ethernet0 0,1,2,3 etp1a 1 100000 +Ethernet4 4,5,6,7 etp1b 1 100000 +Ethernet8 8,9,10,11 etp2a 2 100000 +Ethernet12 12,13,14,15 etp2b 2 100000 +Ethernet16 16,17,18,19 etp3a 3 100000 +Ethernet20 20,21,22,23 etp3b 3 100000 +Ethernet24 24,25,26,27 etp4a 4 100000 +Ethernet28 28,29,30,31 etp4b 4 100000 +Ethernet32 32,33,34,35 etp5a 5 100000 +Ethernet36 36,37,38,39 etp5b 5 100000 +Ethernet40 40,41,42,43 etp6a 6 100000 +Ethernet44 44,45,46,47 etp6b 6 100000 +Ethernet48 48,49,50,51 etp7a 7 100000 +Ethernet52 52,53,54,55 etp7b 7 100000 +Ethernet56 56,57,58,59 etp8a 8 100000 +Ethernet60 60,61,62,63 etp8b 8 100000 +Ethernet64 64,65,66,67 etp9a 9 100000 +Ethernet68 68,69,70,71 etp9b 9 100000 +Ethernet72 72,73,74,75 etp10a 10 100000 +Ethernet76 76,77,78,79 etp10b 10 100000 +Ethernet80 80,81,82,83 etp11a 11 100000 +Ethernet84 84,85,86,87 etp11b 11 100000 +Ethernet88 88,89,90,91 etp12a 12 100000 +Ethernet92 92,93,94,95 etp12b 12 100000 +Ethernet96 96,97,98,99 etp13a 13 100000 +Ethernet100 100,101,102,103 etp13b 13 100000 +Ethernet104 104,105,106,107 etp14a 14 100000 +Ethernet108 108,109,110,111 etp14b 14 100000 +Ethernet112 112,113,114,115 etp15a 15 100000 +Ethernet116 116,117,118,119 etp15b 15 100000 +Ethernet120 120,121,122,123 etp16a 16 100000 +Ethernet124 124,125,126,127 etp16b 16 100000 +Ethernet128 128,129,130,131 etp17a 17 100000 +Ethernet132 132,133,134,135 etp17b 17 100000 +Ethernet136 136,137,138,139 etp18a 18 100000 +Ethernet140 140,141,142,143 etp18b 18 100000 +Ethernet144 144,145,146,147 etp19a 19 100000 +Ethernet148 148,149,150,151 etp19b 19 100000 +Ethernet152 152,153,154,155 etp20a 20 100000 +Ethernet156 156,157,158,159 etp20b 20 100000 +Ethernet160 160,161,162,163 etp21a 21 100000 +Ethernet164 164,165,166,167 etp21b 21 100000 +Ethernet168 168,169,170,171 etp22a 22 100000 +Ethernet172 172,173,174,175 etp22b 22 100000 +Ethernet176 176,177,178,179 etp23a 23 100000 +Ethernet180 180,181,182,183 etp23b 23 100000 +Ethernet184 184,185,186,187 etp24a 24 100000 +Ethernet188 188,189,190,191 etp24b 24 100000 +Ethernet192 192,193,194,195,196,197,198,199 etp25 25 400000 +Ethernet200 200,201,202,203,204,205,206,207 etp26 26 400000 +Ethernet208 208,209,210,211,212,213,214,215 etp27 27 400000 +Ethernet216 216,217,218,219,220,221,222,223 etp28 28 400000 +Ethernet224 224,225,226,227,228,229,230,231 etp29 29 400000 +Ethernet232 232,233,234,235,236,237,238,239 etp30 30 400000 +Ethernet240 240,241,242,243,244,245,246,247 etp31 31 400000 +Ethernet248 248,249,250,251,252,253,254,255 etp32 32 400000 diff --git a/device/mellanox/x86_64-mlnx_msn4410-r0/ACS-MSN4410/sai_4410.xml b/device/mellanox/x86_64-mlnx_msn4410-r0/ACS-MSN4410/sai_4410.xml index 5e5b01cad626..cb721bd52c22 100644 --- a/device/mellanox/x86_64-mlnx_msn4410-r0/ACS-MSN4410/sai_4410.xml +++ b/device/mellanox/x86_64-mlnx_msn4410-r0/ACS-MSN4410/sai_4410.xml @@ -1,4 +1,20 @@ + diff --git a/device/mellanox/x86_64-mlnx_msn4410-r0/platform.json b/device/mellanox/x86_64-mlnx_msn4410-r0/platform.json index 80c532b175e4..bf9b9ea30247 100644 --- a/device/mellanox/x86_64-mlnx_msn4410-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn4410-r0/platform.json @@ -412,7 +412,7 @@ "lanes": "0,1,2,3,4,5,6,7", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp1"], - "2x100G[50G,25G,10G,1G]": ["etp1a", "etp1b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp1a", "etp1b"], "4x50G[25G,10G,1G]": ["etp1a", "etp1b", "etp1c", "etp1d"] } }, @@ -421,7 +421,7 @@ "lanes": "8,9,10,11,12,13,14,15", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp2"], - "2x100G[50G,25G,10G,1G]": ["etp2a", "etp2b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp2a", "etp2b"], "4x50G[25G,10G,1G]": ["etp2a", "etp2b", "etp2c", "etp2d"] } }, @@ -430,7 +430,7 @@ "lanes": "16,17,18,19,20,21,22,23", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp3"], - "2x100G[50G,25G,10G,1G]": ["etp3a", "etp3b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp3a", "etp3b"], "4x50G[25G,10G,1G]": ["etp3a", "etp3b", "etp3c", "etp3d"] } }, @@ -439,7 +439,7 @@ "lanes": "24,25,26,27,28,29,30,31", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp4"], - "2x100G[50G,25G,10G,1G]": ["etp4a", "etp4b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp4a", "etp4b"], "4x50G[25G,10G,1G]": ["etp4a", "etp4b", "etp4c", "etp4d"] } }, @@ -448,7 +448,7 @@ "lanes": "32,33,34,35,36,37,38,39", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp5"], - "2x100G[50G,25G,10G,1G]": ["etp5a", "etp5b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp5a", "etp5b"], "4x50G[25G,10G,1G]": ["etp5a", "etp5b", "etp5c", "etp5d"] } }, @@ -457,7 +457,7 @@ "lanes": "40,41,42,43,44,45,46,47", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp6"], - "2x100G[50G,25G,10G,1G]": ["etp6a", "etp6b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp6a", "etp6b"], "4x50G[25G,10G,1G]": ["etp6a", "etp6b", "etp6c", "etp6d"] } }, @@ -466,7 +466,7 @@ "lanes": "48,49,50,51,52,53,54,55", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp7"], - "2x100G[50G,25G,10G,1G]": ["etp7a", "etp7b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp7a", "etp7b"], "4x50G[25G,10G,1G]": ["etp7a", "etp7b", "etp7c", "etp7d"] } }, @@ -475,7 +475,7 @@ "lanes": "56,57,58,59,60,61,62,63", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp8"], - "2x100G[50G,25G,10G,1G]": ["etp8a", "etp8b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp8a", "etp8b"], "4x50G[25G,10G,1G]": ["etp8a", "etp8b", "etp8c", "etp8d"] } }, @@ -484,7 +484,7 @@ "lanes": "64,65,66,67,68,69,70,71", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp9"], - "2x100G[50G,25G,10G,1G]": ["etp9a", "etp9b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp9a", "etp9b"], "4x50G[25G,10G,1G]": ["etp9a", "etp9b", "etp9c", "etp9d"] } }, @@ -493,7 +493,7 @@ "lanes": "72,73,74,75,76,77,78,79", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp10"], - "2x100G[50G,25G,10G,1G]": ["etp10a", "etp10b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp10a", "etp10b"], "4x50G[25G,10G,1G]": ["etp10a", "etp10b", "etp10c", "etp10d"] } }, @@ -502,7 +502,7 @@ "lanes": "80,81,82,83,84,85,86,87", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp11"], - "2x100G[50G,25G,10G,1G]": ["etp11a", "etp11b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp11a", "etp11b"], "4x50G[25G,10G,1G]": ["etp11a", "etp11b", "etp11c", "etp11d"] } }, @@ -511,7 +511,7 @@ "lanes": "88,89,90,91,92,93,94,95", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp12"], - "2x100G[50G,25G,10G,1G]": ["etp12a", "etp12b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp12a", "etp12b"], "4x50G[25G,10G,1G]": ["etp12a", "etp12b", "etp12c", "etp12d"] } }, @@ -520,7 +520,7 @@ "lanes": "96,97,98,99,100,101,102,103", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp13"], - "2x100G[50G,25G,10G,1G]": ["etp13a", "etp13b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp13a", "etp13b"], "4x50G[25G,10G,1G]": ["etp13a", "etp13b", "etp13c", "etp13d"] } }, @@ -529,7 +529,7 @@ "lanes": "104,105,106,107,108,109,110,111", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp14"], - "2x100G[50G,25G,10G,1G]": ["etp14a", "etp14b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp14a", "etp14b"], "4x50G[25G,10G,1G]": ["etp14a", "etp14b", "etp14c", "etp14d"] } }, @@ -538,7 +538,7 @@ "lanes": "112,113,114,115,116,117,118,119", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp15"], - "2x100G[50G,25G,10G,1G]": ["etp15a", "etp15b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp15a", "etp15b"], "4x50G[25G,10G,1G]": ["etp15a", "etp15b", "etp15c", "etp15d"] } }, @@ -547,7 +547,7 @@ "lanes": "120,121,122,123,124,125,126,127", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp16"], - "2x100G[50G,25G,10G,1G]": ["etp16a", "etp16b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp16a", "etp16b"], "4x50G[25G,10G,1G]": ["etp16a", "etp16b", "etp16c", "etp16d"] } }, @@ -556,7 +556,7 @@ "lanes": "128,129,130,131,132,133,134,135", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp17"], - "2x100G[50G,25G,10G,1G]": ["etp17a", "etp17b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp17a", "etp17b"], "4x50G[25G,10G,1G]": ["etp17a", "etp17b", "etp17c", "etp17d"] } }, @@ -565,7 +565,7 @@ "lanes": "136,137,138,139,140,141,142,143", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp18"], - "2x100G[50G,25G,10G,1G]": ["etp18a", "etp18b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp18a", "etp18b"], "4x50G[25G,10G,1G]": ["etp18a", "etp18b", "etp18c", "etp18d"] } }, @@ -574,7 +574,7 @@ "lanes": "144,145,146,147,148,149,150,151", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp19"], - "2x100G[50G,25G,10G,1G]": ["etp19a", "etp19b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp19a", "etp19b"], "4x50G[25G,10G,1G]": ["etp19a", "etp19b", "etp19c", "etp19d"] } }, @@ -583,7 +583,7 @@ "lanes": "152,153,154,155,156,157,158,159", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp20"], - "2x100G[50G,25G,10G,1G]": ["etp20a", "etp20b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp20a", "etp20b"], "4x50G[25G,10G,1G]": ["etp20a", "etp20b", "etp20c", "etp20d"] } }, @@ -592,7 +592,7 @@ "lanes": "160,161,162,163,164,165,166,167", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp21"], - "2x100G[50G,25G,10G,1G]": ["etp21a", "etp21b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp21a", "etp21b"], "4x50G[25G,10G,1G]": ["etp21a", "etp21b", "etp21c", "etp21d"] } }, @@ -601,7 +601,7 @@ "lanes": "168,169,170,171,172,173,174,175", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp22"], - "2x100G[50G,25G,10G,1G]": ["etp22a", "etp22b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp22a", "etp22b"], "4x50G[25G,10G,1G]": ["etp22a", "etp22b", "etp22c", "etp22d"] } }, @@ -610,7 +610,7 @@ "lanes": "176,177,178,179,180,181,182,183", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp23"], - "2x100G[50G,25G,10G,1G]": ["etp23a", "etp23b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp23a", "etp23b"], "4x50G[25G,10G,1G]": ["etp23a", "etp23b", "etp23c", "etp23d"] } }, @@ -619,7 +619,7 @@ "lanes": "184,185,186,187,188,189,190,191", "breakout_modes": { "1x100G[50G,40G,25G,10G,1G]": ["etp24"], - "2x100G[50G,25G,10G,1G]": ["etp24a", "etp24b"], + "2x100G[50G,40G,25G,10G,1G]": ["etp24a", "etp24b"], "4x50G[25G,10G,1G]": ["etp24a", "etp24b", "etp24c", "etp24d"] } }, @@ -628,7 +628,7 @@ "lanes": "192,193,194,195,196,197,198,199", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp25"], - "2x200G[100G,50G,25G,10G,1G]": ["etp25a", "etp25b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp25a", "etp25b"], "4x100G[50G,25G,10G,1G]": ["etp25a", "etp25b", "etp25c", "etp25d"] } }, @@ -637,7 +637,7 @@ "lanes": "200,201,202,203,204,205,206,207", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp26"], - "2x200G[100G,50G,25G,10G,1G]": ["etp26a", "etp26b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp26a", "etp26b"], "4x100G[50G,25G,10G,1G]": ["etp26a", "etp26b", "etp26c", "etp26d"] } }, @@ -646,7 +646,7 @@ "lanes": "208,209,210,211,212,213,214,215", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp27"], - "2x200G[100G,50G,25G,10G,1G]": ["etp27a", "etp27b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp27a", "etp27b"], "4x100G[50G,25G,10G,1G]": ["etp27a", "etp27b", "etp27c", "etp27d"] } }, @@ -655,7 +655,7 @@ "lanes": "216,217,218,219,220,221,222,223", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp28"], - "2x200G[100G,50G,25G,10G,1G]": ["etp28a", "etp28b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp28a", "etp28b"], "4x100G[50G,25G,10G,1G]": ["etp28a", "etp28b", "etp28c", "etp28d"] } }, @@ -664,7 +664,7 @@ "lanes": "224,225,226,227,228,229,230,231", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp29"], - "2x200G[100G,50G,25G,10G,1G]": ["etp29a", "etp29b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp29a", "etp29b"], "4x100G[50G,25G,10G,1G]": ["etp29a", "etp29b", "etp29c", "etp29d"] } }, @@ -673,7 +673,7 @@ "lanes": "232,233,234,235,236,237,238,239", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp30"], - "2x200G[100G,50G,25G,10G,1G]": ["etp30a", "etp30b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp30a", "etp30b"], "4x100G[50G,25G,10G,1G]": ["etp30a", "etp30b", "etp30c", "etp30d"] } }, @@ -682,7 +682,7 @@ "lanes": "240,241,242,243,244,245,246,247", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp31"], - "2x200G[100G,50G,25G,10G,1G]": ["etp31a", "etp31b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp31a", "etp31b"], "4x100G[50G,25G,10G,1G]": ["etp31a", "etp31b", "etp31c", "etp31d"] } }, @@ -691,7 +691,7 @@ "lanes": "248,249,250,251,252,253,254,255", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp32"], - "2x200G[100G,50G,25G,10G,1G]": ["etp32a", "etp32b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp32a", "etp32b"], "4x100G[50G,25G,10G,1G]": ["etp32a", "etp32b", "etp32c", "etp32d"] } } diff --git a/device/mellanox/x86_64-mlnx_msn4410-r0/platform_asic b/device/mellanox/x86_64-mlnx_msn4410-r0/platform_asic new file mode 100644 index 000000000000..70c074885557 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4410-r0/platform_asic @@ -0,0 +1 @@ +mellanox diff --git a/device/mellanox/x86_64-mlnx_msn4410-r0/platform_components.json b/device/mellanox/x86_64-mlnx_msn4410-r0/platform_components.json index bb1afce80161..dac126d0b697 100644 --- a/device/mellanox/x86_64-mlnx_msn4410-r0/platform_components.json +++ b/device/mellanox/x86_64-mlnx_msn4410-r0/platform_components.json @@ -1,6 +1,6 @@ { "chassis": { - "x86_64-mlnx_msn4410-r0": { + "MSN4410": { "component": { "ONIE": { }, "SSD": { }, diff --git a/device/mellanox/x86_64-mlnx_msn4410-r0/system_health_monitoring_config.json b/device/mellanox/x86_64-mlnx_msn4410-r0/system_health_monitoring_config.json index 98df66c27ca5..27d507cf56e1 120000 --- a/device/mellanox/x86_64-mlnx_msn4410-r0/system_health_monitoring_config.json +++ b/device/mellanox/x86_64-mlnx_msn4410-r0/system_health_monitoring_config.json @@ -1 +1 @@ -../x86_64-mlnx_msn2700-r0/system_health_monitoring_config.json \ No newline at end of file +../x86_64-mlnx_msn4700-r0/system_health_monitoring_config.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..33b6704f9902 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/port_config.ini b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/port_config.ini index 2e6212ef692c..9bfa94369ed3 100644 --- a/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/port_config.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # name lanes alias index Ethernet0 0,1,2,3 etp1 1 Ethernet4 8,9,10,11 etp2 2 diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/sai_4600.xml b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/sai_4600.xml index 96e09ce694f5..a16f49cb317d 100644 --- a/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/sai_4600.xml +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/ACS-MSN4600/sai_4600.xml @@ -1,4 +1,20 @@ + diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/pcie.yaml b/device/mellanox/x86_64-mlnx_msn4600-r0/pcie.yaml index d110ef7c79cb..4356f48a250b 100644 --- a/device/mellanox/x86_64-mlnx_msn4600-r0/pcie.yaml +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/pcie.yaml @@ -1,3 +1,19 @@ +# +# Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# - bus: '00' dev: '00' fn: '0' diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/platform.json b/device/mellanox/x86_64-mlnx_msn4600-r0/platform.json index a16b210d90ed..e4f4845dfe3f 100644 --- a/device/mellanox/x86_64-mlnx_msn4600-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/platform.json @@ -626,8 +626,7 @@ "lanes": "0,1,2,3", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp1"], - "2x100G[50G,25G,10G,1G]": ["etp1a", "etp1b"], - "4x50G[25G,10G,1G]": ["etp1a", "etp1b", "etp1c", "etp1d"] + "2x100G[50G,25G,10G,1G]": ["etp1a", "etp1b"] } }, "Ethernet4": { @@ -635,8 +634,7 @@ "lanes": "8,9,10,11", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp2"], - "2x100G[50G,25G,10G,1G]": ["etp2a", "etp2b"], - "4x50G[25G,10G,1G]": ["etp2a", "etp2b", "etp2c", "etp2d"] + "2x100G[50G,25G,10G,1G]": ["etp2a", "etp2b"] } }, "Ethernet8": { @@ -644,8 +642,7 @@ "lanes": "16,17,18,19", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp3"], - "2x100G[50G,25G,10G,1G]": ["etp3a", "etp3b"], - "4x50G[25G,10G,1G]": ["etp3a", "etp3b", "etp3c", "etp3d"] + "2x100G[50G,25G,10G,1G]": ["etp3a", "etp3b"] } }, "Ethernet12": { @@ -653,8 +650,7 @@ "lanes": "24,25,26,27", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp4"], - "2x100G[50G,25G,10G,1G]": ["etp4a", "etp4b"], - "4x50G[25G,10G,1G]": ["etp4a", "etp4b", "etp4c", "etp4d"] + "2x100G[50G,25G,10G,1G]": ["etp4a", "etp4b"] } }, "Ethernet16": { @@ -662,8 +658,7 @@ "lanes": "32,33,34,35", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp5"], - "2x100G[50G,25G,10G,1G]": ["etp5a", "etp5b"], - "4x50G[25G,10G,1G]": ["etp5a", "etp5b", "etp5c", "etp5d"] + "2x100G[50G,25G,10G,1G]": ["etp5a", "etp5b"] } }, "Ethernet20": { @@ -671,8 +666,7 @@ "lanes": "40,41,42,43", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp6"], - "2x100G[50G,25G,10G,1G]": ["etp6a", "etp6b"], - "4x50G[25G,10G,1G]": ["etp6a", "etp6b", "etp6c", "etp6d"] + "2x100G[50G,25G,10G,1G]": ["etp6a", "etp6b"] } }, "Ethernet24": { @@ -680,8 +674,7 @@ "lanes": "48,49,50,51", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp7"], - "2x100G[50G,25G,10G,1G]": ["etp7a", "etp7b"], - "4x50G[25G,10G,1G]": ["etp7a", "etp7b", "etp7c", "etp7d"] + "2x100G[50G,25G,10G,1G]": ["etp7a", "etp7b"] } }, "Ethernet28": { @@ -689,8 +682,7 @@ "lanes": "56,57,58,59", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp8"], - "2x100G[50G,25G,10G,1G]": ["etp8a", "etp8b"], - "4x50G[25G,10G,1G]": ["etp8a", "etp8b", "etp8c", "etp8d"] + "2x100G[50G,25G,10G,1G]": ["etp8a", "etp8b"] } }, "Ethernet32": { @@ -698,8 +690,7 @@ "lanes": "64,65,66,67", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp9"], - "2x100G[50G,25G,10G,1G]": ["etp9a", "etp9b"], - "4x50G[25G,10G,1G]": ["etp9a", "etp9b", "etp9c", "etp9d"] + "2x100G[50G,25G,10G,1G]": ["etp9a", "etp9b"] } }, "Ethernet36": { @@ -707,8 +698,7 @@ "lanes": "72,73,74,75", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp10"], - "2x100G[50G,25G,10G,1G]": ["etp10a", "etp10b"], - "4x50G[25G,10G,1G]": ["etp10a", "etp10b", "etp10c", "etp10d"] + "2x100G[50G,25G,10G,1G]": ["etp10a", "etp10b"] } }, "Ethernet40": { @@ -716,8 +706,7 @@ "lanes": "80,81,82,83", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp11"], - "2x100G[50G,25G,10G,1G]": ["etp11a", "etp11b"], - "4x50G[25G,10G,1G]": ["etp11a", "etp11b", "etp11c", "etp11d"] + "2x100G[50G,25G,10G,1G]": ["etp11a", "etp11b"] } }, "Ethernet44": { @@ -725,8 +714,7 @@ "lanes": "88,89,90,91", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp12"], - "2x100G[50G,25G,10G,1G]": ["etp12a", "etp12b"], - "4x50G[25G,10G,1G]": ["etp12a", "etp12b", "etp12c", "etp12d"] + "2x100G[50G,25G,10G,1G]": ["etp12a", "etp12b"] } }, "Ethernet48": { @@ -734,8 +722,7 @@ "lanes": "96,97,98,99", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp13"], - "2x100G[50G,25G,10G,1G]": ["etp13a", "etp13b"], - "4x50G[25G,10G,1G]": ["etp13a", "etp13b", "etp13c", "etp13d"] + "2x100G[50G,25G,10G,1G]": ["etp13a", "etp13b"] } }, "Ethernet52": { @@ -743,8 +730,7 @@ "lanes": "104,105,106,107", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp14"], - "2x100G[50G,25G,10G,1G]": ["etp14a", "etp14b"], - "4x50G[25G,10G,1G]": ["etp14a", "etp14b", "etp14c", "etp14d"] + "2x100G[50G,25G,10G,1G]": ["etp14a", "etp14b"] } }, "Ethernet56": { @@ -752,8 +738,7 @@ "lanes": "112,113,114,115", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp15"], - "2x100G[50G,25G,10G,1G]": ["etp15a", "etp15b"], - "4x50G[25G,10G,1G]": ["etp15a", "etp15b", "etp15c", "etp15d"] + "2x100G[50G,25G,10G,1G]": ["etp15a", "etp15b"] } }, "Ethernet60": { @@ -761,8 +746,7 @@ "lanes": "120,121,122,123", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp16"], - "2x100G[50G,25G,10G,1G]": ["etp16a", "etp16b"], - "4x50G[25G,10G,1G]": ["etp16a", "etp16b", "etp16c", "etp16d"] + "2x100G[50G,25G,10G,1G]": ["etp16a", "etp16b"] } }, "Ethernet64": { @@ -770,8 +754,7 @@ "lanes": "128,129,130,131", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp17"], - "2x100G[50G,25G,10G,1G]": ["etp17a", "etp17b"], - "4x50G[25G,10G,1G]": ["etp17a", "etp17b", "etp17c", "etp17d"] + "2x100G[50G,25G,10G,1G]": ["etp17a", "etp17b"] } }, "Ethernet68": { @@ -779,8 +762,7 @@ "lanes": "136,137,138,139", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp18"], - "2x100G[50G,25G,10G,1G]": ["etp18a", "etp18b"], - "4x50G[25G,10G,1G]": ["etp18a", "etp18b", "etp18c", "etp18d"] + "2x100G[50G,25G,10G,1G]": ["etp18a", "etp18b"] } }, "Ethernet72": { @@ -788,8 +770,7 @@ "lanes": "144,145,146,147", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp19"], - "2x100G[50G,25G,10G,1G]": ["etp19a", "etp19b"], - "4x50G[25G,10G,1G]": ["etp19a", "etp19b", "etp19c", "etp19d"] + "2x100G[50G,25G,10G,1G]": ["etp19a", "etp19b"] } }, "Ethernet76": { @@ -797,8 +778,7 @@ "lanes": "152,153,154,155", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp20"], - "2x100G[50G,25G,10G,1G]": ["etp20a", "etp20b"], - "4x50G[25G,10G,1G]": ["etp20a", "etp20b", "etp20c", "etp20d"] + "2x100G[50G,25G,10G,1G]": ["etp20a", "etp20b"] } }, "Ethernet80": { @@ -806,8 +786,7 @@ "lanes": "160,161,162,163", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp21"], - "2x100G[50G,25G,10G,1G]": ["etp21a", "etp21b"], - "4x50G[25G,10G,1G]": ["etp21a", "etp21b", "etp21c", "etp21d"] + "2x100G[50G,25G,10G,1G]": ["etp21a", "etp21b"] } }, "Ethernet84": { @@ -815,8 +794,7 @@ "lanes": "168,169,170,171", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp22"], - "2x100G[50G,25G,10G,1G]": ["etp22a", "etp22b"], - "4x50G[25G,10G,1G]": ["etp22a", "etp22b", "etp22c", "etp22d"] + "2x100G[50G,25G,10G,1G]": ["etp22a", "etp22b"] } }, "Ethernet88": { @@ -824,8 +802,7 @@ "lanes": "176,177,178,179", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp23"], - "2x100G[50G,25G,10G,1G]": ["etp23a", "etp23b"], - "4x50G[25G,10G,1G]": ["etp23a", "etp23b", "etp23c", "etp23d"] + "2x100G[50G,25G,10G,1G]": ["etp23a", "etp23b"] } }, "Ethernet92": { @@ -833,8 +810,7 @@ "lanes": "184,185,186,187", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp24"], - "2x100G[50G,25G,10G,1G]": ["etp24a", "etp24b"], - "4x50G[25G,10G,1G]": ["etp24a", "etp24b", "etp24c", "etp24d"] + "2x100G[50G,25G,10G,1G]": ["etp24a", "etp24b"] } }, "Ethernet96": { @@ -842,8 +818,7 @@ "lanes": "192,193,194,195", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp25"], - "2x100G[50G,25G,10G,1G]": ["etp25a", "etp25b"], - "4x50G[25G,10G,1G]": ["etp25a", "etp25b", "etp25c", "etp25d"] + "2x100G[50G,25G,10G,1G]": ["etp25a", "etp25b"] } }, "Ethernet100": { @@ -851,8 +826,7 @@ "lanes": "200,201,202,203", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp26"], - "2x100G[50G,25G,10G,1G]": ["etp26a", "etp26b"], - "4x50G[25G,10G,1G]": ["etp26a", "etp26b", "etp26c", "etp26d"] + "2x100G[50G,25G,10G,1G]": ["etp26a", "etp26b"] } }, "Ethernet104": { @@ -860,8 +834,7 @@ "lanes": "208,209,210,211", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp27"], - "2x100G[50G,25G,10G,1G]": ["etp27a", "etp27b"], - "4x50G[25G,10G,1G]": ["etp27a", "etp27b", "etp27c", "etp27d"] + "2x100G[50G,25G,10G,1G]": ["etp27a", "etp27b"] } }, "Ethernet108": { @@ -869,8 +842,7 @@ "lanes": "216,217,218,219", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp28"], - "2x100G[50G,25G,10G,1G]": ["etp28a", "etp28b"], - "4x50G[25G,10G,1G]": ["etp28a", "etp28b", "etp28c", "etp28d"] + "2x100G[50G,25G,10G,1G]": ["etp28a", "etp28b"] } }, "Ethernet112": { @@ -878,16 +850,14 @@ "lanes": "224,225,226,227", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp29"], - "2x100G[50G,25G,10G,1G]": ["etp29a", "etp29b"], - "4x50G[25G,10G,1G]": ["etp29a", "etp29b", "etp29c", "etp29d"] + "2x100G[50G,25G,10G,1G]": ["etp29a", "etp29b"] } }, "Ethernet116": { "index": "30,30,30,30", "lanes": "232,233,234,235", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp30"], - "2x100G[50G,25G,10G,1G]": ["etp30a", "etp30b"], - "4x50G[25G,10G,1G]": ["etp30a", "etp30b", "etp30c", "etp30d"] + "2x100G[50G,25G,10G,1G]": ["etp30a", "etp30b"] } }, "Ethernet120": { @@ -895,8 +865,7 @@ "lanes": "240,241,242,243", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp31"], - "2x100G[50G,25G,10G,1G]": ["etp31a", "etp31b"], - "4x50G[25G,10G,1G]": ["etp31a", "etp31b", "etp31c", "etp31d"] + "2x100G[50G,25G,10G,1G]": ["etp31a", "etp31b"] } }, "Ethernet124": { @@ -904,8 +873,7 @@ "lanes": "248,249,250,251", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp32"], - "2x100G[50G,25G,10G,1G]": ["etp32a", "etp32b"], - "4x50G[25G,10G,1G]": ["etp32a", "etp32b", "etp32c", "etp32d"] + "2x100G[50G,25G,10G,1G]": ["etp32a", "etp32b"] } }, "Ethernet128": { @@ -913,8 +881,7 @@ "lanes": "256,257,258,259", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp33"], - "2x100G[50G,25G,10G,1G]": ["etp33a", "etp33b"], - "4x50G[25G,10G,1G]": ["etp33a", "etp33b", "etp33c", "etp33d"] + "2x100G[50G,25G,10G,1G]": ["etp33a", "etp33b"] } }, "Ethernet132": { @@ -922,8 +889,7 @@ "lanes": "264,265,266,267", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp34"], - "2x100G[50G,25G,10G,1G]": ["etp34a", "etp34b"], - "4x50G[25G,10G,1G]": ["etp34a", "etp34b", "etp34c", "etp34d"] + "2x100G[50G,25G,10G,1G]": ["etp34a", "etp34b"] } }, "Ethernet136": { @@ -931,8 +897,7 @@ "lanes": "272,273,274,275", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp35"], - "2x100G[50G,25G,10G,1G]": ["etp35a", "etp35b"], - "4x50G[25G,10G,1G]": ["etp35a", "etp35b", "etp35c", "etp35d"] + "2x100G[50G,25G,10G,1G]": ["etp35a", "etp35b"] } }, "Ethernet140": { @@ -940,8 +905,7 @@ "lanes": "280,281,282,283", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp36"], - "2x100G[50G,25G,10G,1G]": ["etp36a", "etp36b"], - "4x50G[25G,10G,1G]": ["etp36a", "etp36b", "etp36c", "etp36d"] + "2x100G[50G,25G,10G,1G]": ["etp36a", "etp36b"] } }, "Ethernet144": { @@ -949,8 +913,7 @@ "lanes": "288,289,290,291", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp37"], - "2x100G[50G,25G,10G,1G]": ["etp37a", "etp37b"], - "4x50G[25G,10G,1G]": ["etp37a", "etp37b", "etp37c", "etp37d"] + "2x100G[50G,25G,10G,1G]": ["etp37a", "etp37b"] } }, "Ethernet148": { @@ -958,8 +921,7 @@ "lanes": "296,297,298,299", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp38"], - "2x100G[50G,25G,10G,1G]": ["etp38a", "etp38b"], - "4x50G[25G,10G,1G]": ["etp38a", "etp38b", "etp38c", "etp38d"] + "2x100G[50G,25G,10G,1G]": ["etp38a", "etp38b"] } }, "Ethernet152": { @@ -967,8 +929,7 @@ "lanes": "304,305,306,307", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp39"], - "2x100G[50G,25G,10G,1G]": ["etp39a", "etp39b"], - "4x50G[25G,10G,1G]": ["etp39a", "etp39b", "etp39c", "etp39d"] + "2x100G[50G,25G,10G,1G]": ["etp39a", "etp39b"] } }, "Ethernet156": { @@ -976,8 +937,7 @@ "lanes": "312,313,314,315", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp40"], - "2x100G[50G,25G,10G,1G]": ["etp40a", "etp40b"], - "4x50G[25G,10G,1G]": ["etp40a", "etp40b", "etp40c", "etp40d"] + "2x100G[50G,25G,10G,1G]": ["etp40a", "etp40b"] } }, "Ethernet160": { @@ -985,8 +945,7 @@ "lanes": "320,321,322,323", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp41"], - "2x100G[50G,25G,10G,1G]": ["etp41a", "etp41b"], - "4x50G[25G,10G,1G]": ["etp41a", "etp41b", "etp41c", "etp41d"] + "2x100G[50G,25G,10G,1G]": ["etp41a", "etp41b"] } }, "Ethernet164": { @@ -994,8 +953,7 @@ "lanes": "328,329,330,331", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp42"], - "2x100G[50G,25G,10G,1G]": ["etp42a", "etp42b"], - "4x50G[25G,10G,1G]": ["etp42a", "etp42b", "etp42c", "etp42d"] + "2x100G[50G,25G,10G,1G]": ["etp42a", "etp42b"] } }, "Ethernet168": { @@ -1003,8 +961,7 @@ "lanes": "336,337,338,339", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp43"], - "2x100G[50G,25G,10G,1G]": ["etp43a", "etp43b"], - "4x50G[25G,10G,1G]": ["etp43a", "etp43b", "etp43c", "etp43d"] + "2x100G[50G,25G,10G,1G]": ["etp43a", "etp43b"] } }, "Ethernet172": { @@ -1012,8 +969,7 @@ "lanes": "344,345,346,347", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp44"], - "2x100G[50G,25G,10G,1G]": ["etp44a", "etp44b"], - "4x50G[25G,10G,1G]": ["etp44a", "etp44b", "etp44c", "etp44d"] + "2x100G[50G,25G,10G,1G]": ["etp44a", "etp44b"] } }, "Ethernet176": { @@ -1021,8 +977,7 @@ "lanes": "352,353,354,355", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp45"], - "2x100G[50G,25G,10G,1G]": ["etp45a", "etp45b"], - "4x50G[25G,10G,1G]": ["etp45a", "etp45b", "etp45c", "etp45d"] + "2x100G[50G,25G,10G,1G]": ["etp45a", "etp45b"] } }, "Ethernet180": { @@ -1030,8 +985,7 @@ "lanes": "360,361,362,363", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp46"], - "2x100G[50G,25G,10G,1G]": ["etp46a", "etp46b"], - "4x50G[25G,10G,1G]": ["etp46a", "etp46b", "etp46c", "etp46d"] + "2x100G[50G,25G,10G,1G]": ["etp46a", "etp46b"] } }, "Ethernet184": { @@ -1039,8 +993,7 @@ "lanes": "368,369,370,371", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp47"], - "2x100G[50G,25G,10G,1G]": ["etp47a", "etp47b"], - "4x50G[25G,10G,1G]": ["etp47a", "etp47b", "etp47c", "etp47d"] + "2x100G[50G,25G,10G,1G]": ["etp47a", "etp47b"] } }, "Ethernet188": { @@ -1048,8 +1001,7 @@ "lanes": "376,377,378,379", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp48"], - "2x100G[50G,25G,10G,1G]": ["etp48a", "etp48b"], - "4x50G[25G,10G,1G]": ["etp48a", "etp48b", "etp48c", "etp48d"] + "2x100G[50G,25G,10G,1G]": ["etp48a", "etp48b"] } }, "Ethernet192": { @@ -1057,8 +1009,7 @@ "lanes": "384,385,386,387", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp49"], - "2x100G[50G,25G,10G,1G]": ["etp49a", "etp49b"], - "4x50G[25G,10G,1G]": ["etp49a", "etp49b", "etp49c", "etp49d"] + "2x100G[50G,25G,10G,1G]": ["etp49a", "etp49b"] } }, "Ethernet196": { @@ -1066,8 +1017,7 @@ "lanes": "392,393,394,395", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp50"], - "2x100G[50G,25G,10G,1G]": ["etp50a", "etp50b"], - "4x50G[25G,10G,1G]": ["etp50a", "etp50b", "etp50c", "etp50d"] + "2x100G[50G,25G,10G,1G]": ["etp50a", "etp50b"] } }, "Ethernet200": { @@ -1075,8 +1025,7 @@ "lanes": "400,401,402,403", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp51"], - "2x100G[50G,25G,10G,1G]": ["etp51a", "etp51b"], - "4x50G[25G,10G,1G]": ["etp51a", "etp51b", "etp51c", "etp51d"] + "2x100G[50G,25G,10G,1G]": ["etp51a", "etp51b"] } }, "Ethernet204": { @@ -1084,8 +1033,7 @@ "lanes": "408,409,410,411", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp52"], - "2x100G[50G,25G,10G,1G]": ["etp52a", "etp52b"], - "4x50G[25G,10G,1G]": ["etp52a", "etp52b", "etp52c", "etp52d"] + "2x100G[50G,25G,10G,1G]": ["etp52a", "etp52b"] } }, "Ethernet208": { @@ -1093,8 +1041,7 @@ "lanes": "416,417,418,419", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp53"], - "2x100G[50G,25G,10G,1G]": ["etp53a", "etp53b"], - "4x50G[25G,10G,1G]": ["etp53a", "etp53b", "etp53c", "etp53d"] + "2x100G[50G,25G,10G,1G]": ["etp53a", "etp53b"] } }, "Ethernet212": { @@ -1102,8 +1049,7 @@ "lanes": "424,425,426,427", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp54"], - "2x100G[50G,25G,10G,1G]": ["etp54a", "etp54b"], - "4x50G[25G,10G,1G]": ["etp54a", "etp54b", "etp54c", "etp54d"] + "2x100G[50G,25G,10G,1G]": ["etp54a", "etp54b"] } }, "Ethernet216": { @@ -1111,8 +1057,7 @@ "lanes": "432,433,434,435", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp55"], - "2x100G[50G,25G,10G,1G]": ["etp55a", "etp55b"], - "4x50G[25G,10G,1G]": ["etp55a", "etp55b", "etp55c", "etp55d"] + "2x100G[50G,25G,10G,1G]": ["etp55a", "etp55b"] } }, "Ethernet220": { @@ -1120,8 +1065,7 @@ "lanes": "440,441,442,443", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp56"], - "2x100G[50G,25G,10G,1G]": ["etp56a", "etp56b"], - "4x50G[25G,10G,1G]": ["etp56a", "etp56b", "etp56c", "etp56d"] + "2x100G[50G,25G,10G,1G]": ["etp56a", "etp56b"] } }, "Ethernet224": { @@ -1129,8 +1073,7 @@ "lanes": "448,449,450,451", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp57"], - "2x100G[50G,25G,10G,1G]": ["etp57a", "etp57b"], - "4x50G[25G,10G,1G]": ["etp57a", "etp57b", "etp57c", "etp57d"] + "2x100G[50G,25G,10G,1G]": ["etp57a", "etp57b"] } }, "Ethernet228": { @@ -1138,8 +1081,7 @@ "lanes": "456,457,458,459", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp58"], - "2x100G[50G,25G,10G,1G]": ["etp58a", "etp58b"], - "4x50G[25G,10G,1G]": ["etp58a", "etp58b", "etp58c", "etp58d"] + "2x100G[50G,25G,10G,1G]": ["etp58a", "etp58b"] } }, "Ethernet232": { @@ -1147,8 +1089,7 @@ "lanes": "464,465,466,467", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp59"], - "2x100G[50G,25G,10G,1G]": ["etp59a", "etp59b"], - "4x50G[25G,10G,1G]": ["etp59a", "etp59b", "etp59c", "etp59d"] + "2x100G[50G,25G,10G,1G]": ["etp59a", "etp59b"] } }, "Ethernet236": { @@ -1156,8 +1097,7 @@ "lanes": "472,473,474,475", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp60"], - "2x100G[50G,25G,10G,1G]": ["etp60a", "etp60b"], - "4x50G[25G,10G,1G]": ["etp60a", "etp60b", "etp60c", "etp60d"] + "2x100G[50G,25G,10G,1G]": ["etp60a", "etp60b"] } }, "Ethernet240": { @@ -1165,8 +1105,7 @@ "lanes": "480,481,482,483", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp61"], - "2x100G[50G,25G,10G,1G]": ["etp61a", "etp61b"], - "4x50G[25G,10G,1G]": ["etp61a", "etp61b", "etp61c", "etp61d"] + "2x100G[50G,25G,10G,1G]": ["etp61a", "etp61b"] } }, "Ethernet244": { @@ -1174,8 +1113,7 @@ "lanes": "488,489,490,491", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp62"], - "2x100G[50G,25G,10G,1G]": ["etp62a", "etp62b"], - "4x50G[25G,10G,1G]": ["etp62a", "etp62b", "etp62c", "etp62d"] + "2x100G[50G,25G,10G,1G]": ["etp62a", "etp62b"] } }, "Ethernet248": { @@ -1183,8 +1121,7 @@ "lanes": "496,497,498,499", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp63"], - "2x100G[50G,25G,10G,1G]": ["etp63a", "etp63b"], - "4x50G[25G,10G,1G]": ["etp63a", "etp63b", "etp63c", "etp63d"] + "2x100G[50G,25G,10G,1G]": ["etp63a", "etp63b"] } }, "Ethernet252": { @@ -1192,8 +1129,7 @@ "lanes": "504,505,506,507", "breakout_modes": { "1x200G[100G,50G,40G,25G,10G,1G]": ["etp64"], - "2x100G[50G,25G,10G,1G]": ["etp64a", "etp64b"], - "4x50G[25G,10G,1G]": ["etp64a", "etp64b", "etp64c", "etp64d"] + "2x100G[50G,25G,10G,1G]": ["etp64a", "etp64b"] } } } diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/platform_asic b/device/mellanox/x86_64-mlnx_msn4600-r0/platform_asic new file mode 100644 index 000000000000..70c074885557 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/platform_asic @@ -0,0 +1 @@ +mellanox diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/system_health_monitoring_config.json b/device/mellanox/x86_64-mlnx_msn4600-r0/system_health_monitoring_config.json index 98df66c27ca5..27d507cf56e1 120000 --- a/device/mellanox/x86_64-mlnx_msn4600-r0/system_health_monitoring_config.json +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/system_health_monitoring_config.json @@ -1 +1 @@ -../x86_64-mlnx_msn2700-r0/system_health_monitoring_config.json \ No newline at end of file +../x86_64-mlnx_msn4700-r0/system_health_monitoring_config.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/ACS-MSN4600C/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn4600c-r0/ACS-MSN4600C/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..33b6704f9902 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/ACS-MSN4600C/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/ACS-MSN4600C/port_config.ini b/device/mellanox/x86_64-mlnx_msn4600c-r0/ACS-MSN4600C/port_config.ini index 2e6212ef692c..9bfa94369ed3 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/ACS-MSN4600C/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/ACS-MSN4600C/port_config.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # name lanes alias index Ethernet0 0,1,2,3 etp1 1 Ethernet4 8,9,10,11 etp2 2 diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/ACS-MSN4600C/sai_4600C.xml b/device/mellanox/x86_64-mlnx_msn4600c-r0/ACS-MSN4600C/sai_4600C.xml index 02d0ed6ccd8e..88defea78508 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/ACS-MSN4600C/sai_4600C.xml +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/ACS-MSN4600C/sai_4600C.xml @@ -1,4 +1,20 @@ + diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..c01aebb7ae12 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/buffers_defaults_t0.j2 index 0ef452867df7..a66a404bb2c2 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/buffers_defaults_t0.j2 @@ -1,106 +1,39 @@ +{# + Copyright (c) 2018-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '53379072' %} -{% set ingress_lossless_xoff_size = '1540096' %} +{% set ingress_lossless_pool_size = '49905664' %} +{% set ingress_lossless_pool_xoff = '3702784' %} {% set egress_lossless_pool_size = '60817392' %} -{% set egress_lossy_pool_size = '53379072' %} +{% set egress_lossy_pool_size = '49905664' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_xoff_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} {%- endmacro %} - +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} +{%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/buffers_defaults_t1.j2 index 2bebd4a79954..d77d5cc1f136 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/buffers_defaults_t1.j2 @@ -1,106 +1,39 @@ +{# + Copyright (c) 2018-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '52723712' %} -{% set ingress_lossless_xoff_size = '2195456' %} +{% set ingress_lossless_pool_size = '48332800' %} +{% set ingress_lossless_pool_xoff = '5275648' %} {% set egress_lossless_pool_size = '60817392' %} -{% set egress_lossy_pool_size = '52723712' %} +{% set egress_lossy_pool_size = '48332800' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_xoff_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} {%- endmacro %} - +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} +{%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/sai.profile b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/sai.profile index a9835c51dc3f..33f195e4a17f 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/sai.profile +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64/sai.profile @@ -1,4 +1,3 @@ SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_4600C.xml -SAI_VXLAN_SRCPORT_RANGE_ENABLE=1 SAI_DUMP_STORE_PATH=/var/log/mellanox/sdk-dumps SAI_DUMP_STORE_AMOUNT=10 diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D100C12S2/buffers_default_objects.j2 b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D100C12S2/buffers_default_objects.j2 new file mode 120000 index 000000000000..c01aebb7ae12 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D100C12S2/buffers_default_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D100C12S2/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D100C12S2/buffers_defaults_t0.j2 index e5785e0744e7..c4fdce6ef4cf 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D100C12S2/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D100C12S2/buffers_defaults_t0.j2 @@ -1,104 +1,38 @@ +{# + Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} + {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '48228352' %} -{% set ingress_lossless_xoff_size = '2287616' %} +{% set ingress_lossless_pool_size = '44566528' %} +{% set ingress_lossless_pool_xoff = '3614720' %} {% set egress_lossless_pool_size = '60817392' %} -{% set egress_lossy_pool_size = '48228352' %} +{% set egress_lossy_pool_size = '44566528' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_xoff_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile]" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "[BUFFER_PROFILE|q_lossy_profile]" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "[BUFFER_PROFILE|q_lossy_profile]" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D100C12S2/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D100C12S2/buffers_defaults_t1.j2 index a8f95220924f..278172ce12fd 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D100C12S2/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D100C12S2/buffers_defaults_t1.j2 @@ -1,104 +1,40 @@ +{# + Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} + {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '46315520' %} -{% set ingress_lossless_xoff_size = '4200448' %} +{% set ingress_lossless_pool_size = '43794432' %} +{% set ingress_lossless_pool_xoff = '4386816' %} {% set egress_lossless_pool_size = '60817392' %} -{% set egress_lossy_pool_size = '46315520' %} +{% set egress_lossy_pool_size = '43794432' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_xoff_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"[BUFFER_POOL|ingress_lossless_pool]", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "[BUFFER_PROFILE|ingress_lossless_profile]" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "[BUFFER_PROFILE|egress_lossless_profile],[BUFFER_PROFILE|egress_lossy_profile]" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "[BUFFER_PROFILE|q_lossy_profile]" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "[BUFFER_PROFILE|q_lossy_profile]" - }{% if not loop.last %},{% endif %} +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} -{% endfor %} - } +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D100C12S2/port_config.ini b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D100C12S2/port_config.ini index 48f92f311a94..04fb27d68930 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D100C12S2/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D100C12S2/port_config.ini @@ -1,3 +1,20 @@ +## +## Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## + # name lanes alias index speed Ethernet0 0,1 etp1a 1 50000 Ethernet2 2,3 etp1b 1 50000 diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D100C12S2/sai.profile b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D100C12S2/sai.profile index c05c9ac6a1d1..2b9929123105 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D100C12S2/sai.profile +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D100C12S2/sai.profile @@ -1,4 +1,3 @@ -SAI_VXLAN_SRCPORT_RANGE_ENABLE=1 SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_4600c_100x50g_12x100g_2x10g.xml SAI_DUMP_STORE_PATH=/var/log/mellanox/sdk-dumps SAI_DUMP_STORE_AMOUNT=10 diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D100C12S2/sai_4600c_100x50g_12x100g_2x10g.xml b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D100C12S2/sai_4600c_100x50g_12x100g_2x10g.xml index bcf792d6337c..fe91dc678e77 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D100C12S2/sai_4600c_100x50g_12x100g_2x10g.xml +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D100C12S2/sai_4600c_100x50g_12x100g_2x10g.xml @@ -1,3 +1,20 @@ + + diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..c01aebb7ae12 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t0.j2 index 74ee90a25ece..eede5087d0f6 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t0.j2 @@ -1,104 +1,39 @@ +{# + Copyright (c) 2018-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '47587328' %} -{% set ingress_lossless_xoff_size = '2400256' %} +{% set ingress_lossless_pool_size = '43827200' %} +{% set ingress_lossless_pool_xoff = '3702784' %} {% set egress_lossless_pool_size = '60817392' %} -{% set egress_lossy_pool_size = '47587328' %} +{% set egress_lossy_pool_size = '43827200' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_xoff_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} -{% endfor %} - } +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t1.j2 index d6fe21de5d9b..317d1a56994f 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/buffers_defaults_t1.j2 @@ -1,104 +1,39 @@ +{# + Copyright (c) 2018-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '46702592' %} -{% set ingress_lossless_xoff_size = '3284992' %} +{% set ingress_lossless_pool_size = '43048960' %} +{% set ingress_lossless_pool_xoff = '4481024' %} {% set egress_lossless_pool_size = '60817392' %} -{% set egress_lossy_pool_size = '46702592' %} +{% set egress_lossy_pool_size = '43048960' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_xoff_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} -{% endfor %} - } +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/pg_profile_lookup.ini index fdcf8c0c3050..d4d085610dfc 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/pg_profile_lookup.ini +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/pg_profile_lookup.ini @@ -1,22 +1,38 @@ +## +## Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # PG lossless profiles. # speed cable size xon xoff threshold 10000 5m 19456 19456 24576 0 - 25000 5m 19456 19456 24576 0 - 40000 5m 19456 19456 24576 0 - 50000 5m 19456 19456 24576 0 - 100000 5m 19456 19456 25600 0 - 10000 40m 19456 19456 24576 0 - 25000 40m 19456 19456 26624 0 - 40000 40m 19456 19456 27648 0 - 50000 40m 19456 19456 28672 0 - 100000 40m 19456 19456 32768 0 + 25000 5m 19456 19456 26624 0 + 40000 5m 19456 19456 30720 0 + 50000 5m 19456 19456 33792 0 + 100000 5m 19456 19456 59392 0 + 10000 40m 19456 19456 25600 0 + 25000 40m 19456 19456 28672 0 + 40000 40m 19456 19456 33792 0 + 50000 40m 19456 19456 36864 0 + 100000 40m 19456 19456 66560 0 10000 300m 19456 19456 30720 0 - 25000 300m 19456 19456 39936 0 - 40000 300m 19456 19456 49152 0 - 50000 300m 19456 19456 55296 0 - 100000 300m 19456 19456 86016 0 + 25000 300m 19456 19456 41984 0 + 40000 300m 19456 19456 54272 0 + 50000 300m 19456 19456 63488 0 + 100000 300m 19456 19456 120832 0 10000 2000m 19456 19456 32768 0 - 25000 2000m 19456 19456 63488 0 - 40000 2000m 19456 19456 94208 0 - 50000 2000m 19456 19456 114688 0 - 100000 2000m 19456 19456 217088 0 + 25000 2000m 19456 19456 64512 0 + 40000 2000m 19456 19456 97280 0 + 50000 2000m 19456 19456 119808 0 + 100000 2000m 19456 19456 234496 0 diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/port_config.ini b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/port_config.ini index be2c7d9255ca..356e24c1339f 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/port_config.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # name lanes alias index speed fec Ethernet0 0,1 etp1a 1 50000 none Ethernet2 2,3 etp1b 1 50000 none diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/sai_4600c_112x50g_8x100g.xml b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/sai_4600c_112x50g_8x100g.xml index 2016d0bdf297..b5aece3e266e 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/sai_4600c_112x50g_8x100g.xml +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D112C8/sai_4600c_112x50g_8x100g.xml @@ -1,4 +1,20 @@ + diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..c01aebb7ae12 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/Mellanox-SN2700-D48C8/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/buffers_defaults_t0.j2 index 8046720e1b13..87d8bda4c55f 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/buffers_defaults_t0.j2 @@ -1,104 +1,39 @@ +{# + Copyright (c) 2018-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '50995200' %} -{% set ingress_lossless_xoff_size = '1810432' %} +{% set ingress_lossless_pool_size = '47398912' %} +{% set ingress_lossless_pool_xoff = '3604480' %} {% set egress_lossless_pool_size = '60817392' %} -{% set egress_lossy_pool_size = '50995200' %} +{% set egress_lossy_pool_size = '47398912' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_xoff_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} -{% endfor %} - } +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/buffers_defaults_t1.j2 index 35d338b0e5eb..6cf1904e30c7 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/buffers_defaults_t1.j2 @@ -1,104 +1,39 @@ +{# + Copyright (c) 2018-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} -{% set ingress_lossless_pool_size = '50143232' %} -{% set ingress_lossless_xoff_size = '2662400' %} +{% set ingress_lossless_pool_size = '46587904' %} +{% set ingress_lossless_pool_xoff = '4415488' %} {% set egress_lossless_pool_size = '60817392' %} -{% set egress_lossy_pool_size = '50143232' %} +{% set egress_lossy_pool_size = '46587904' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - "xoff": "{{ ingress_lossless_xoff_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} +{%- endmacro %} -{% endfor %} - } +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} {%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/port_config.ini b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/port_config.ini index f98cd3b232fa..b30fe0befcec 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/port_config.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # name lanes alias index speed Ethernet0 0,1 etp1a 1 50000 Ethernet2 2,3 etp1b 1 50000 diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/sai.profile b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/sai.profile index 8719655c1ccc..c255886841ba 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/sai.profile +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/sai.profile @@ -1,4 +1,3 @@ SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_4600c_48x50g_40x100g.xml SAI_DUMP_STORE_PATH=/var/log/mellanox/sdk-dumps SAI_DUMP_STORE_AMOUNT=10 -SAI_VXLAN_SRCPORT_RANGE_ENABLE=1 diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/sai_4600c_48x50g_40x100g.xml b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/sai_4600c_48x50g_40x100g.xml index bc26a518c08a..51d741cd5873 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/sai_4600c_48x50g_40x100g.xml +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-D48C40/sai_4600c_48x50g_40x100g.xml @@ -1,4 +1,20 @@ + diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/get_sensors_conf_path b/device/mellanox/x86_64-mlnx_msn4600c-r0/get_sensors_conf_path new file mode 120000 index 000000000000..f1509a1e1d3d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/get_sensors_conf_path @@ -0,0 +1 @@ +../x86_64-mlnx_msn4700-r0/get_sensors_conf_path \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/pcie.yaml b/device/mellanox/x86_64-mlnx_msn4600c-r0/pcie.yaml index d110ef7c79cb..4356f48a250b 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/pcie.yaml +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/pcie.yaml @@ -1,3 +1,19 @@ +# +# Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# - bus: '00' dev: '00' fn: '0' diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/platform.json b/device/mellanox/x86_64-mlnx_msn4600c-r0/platform.json index ab22b4fd18da..70c5c60a5508 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/platform.json @@ -95,6 +95,12 @@ { "name": "CPU Core 1 Temp" }, + { + "name": "CPU Core 2 Temp" + }, + { + "name": "CPU Core 3 Temp" + }, { "name": "CPU Pack Temp" } diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/platform_asic b/device/mellanox/x86_64-mlnx_msn4600c-r0/platform_asic new file mode 100644 index 000000000000..70c074885557 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/platform_asic @@ -0,0 +1 @@ +mellanox diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors.conf.a1 b/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors.conf.a1 new file mode 100644 index 000000000000..44fff272e544 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors.conf.a1 @@ -0,0 +1,146 @@ +## +## Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## + + +# Temperature sensors +bus "i2c-2" "i2c-1-mux (chan_id 1)" + chip "mlxsw-i2c-*-48" + label temp1 "Ambient ASIC Temp" + +bus "i2c-7" "i2c-1-mux (chan_id 6)" + chip "tmp102-i2c-*-49" + label temp1 "Ambient Fan Side Temp (air intake)" + chip "tmp102-i2c-*-4a" + label temp1 "Ambient Port Side Temp (air exhaust)" + +bus "i2c-15" "i2c-1-mux (chan_id 6)" + chip "tmp102-i2c-15-49" + label temp1 "Ambient COMEX Temp" + +# Power controllers +bus "i2c-5" "i2c-1-mux (chan_id 4)" + chip "mp2975-i2c-*-62" + label in1 "PMIC-1 PSU 12V Rail (in1)" + label in2 "PMIC-1 ASIC 0.8V VCORE MAIN Rail (out)" + label temp1 "PMIC-1 Temp 1" + label power1 "PMIC-1 PSU 12V Rail Pwr (in1)" + label power2 "PMIC-1 ASIC 0.8V VCORE MAIN Rail Pwr (out)" + label curr1 "PMIC-1 PSU 12V Rail Curr (in1)" + label curr2 "PMIC-1 ASIC 0.8V VCORE MAIN Rail Curr (out)" + chip "mp2975-i2c-*-64" + label in1 "PMIC-2 PSU 12V Rail (in1)" + label in2 "PMIC-2 ASIC 1.8V VCORE MAIN Rail (out)" + label in3 "PMIC-2 ASIC 1.2V VCORE MAIN Rail (out)" + label temp1 "PMIC-2 Temp 1" + label power1 "PMIC-2 PSU 12V Rail Pwr (in1)" + label power2 "PMIC-2 ASIC 1.8V VCORE MAIN Rail Pwr (out)" + label curr1 "PMIC-2 PSU 12V Rail Curr (in1)" + label curr2 "PMIC-2 ASIC 1.8V VCORE MAIN Rail Curr (out)" + label curr3 "PMIC-2 ASIC 1.2V VCORE MAIN Rail Curr (out)" + chip "mp2975-i2c-*-66" + label in1 "PMIC-3 PSU 12V Rail (in1)" + label in2 "PMIC-3 ASIC 0.85V T0_1 Rail (out)" + label in3 "PMIC-3 ASIC 1.8V T0_1 Rail (out)" + label temp1 "PMIC-3 Temp 1" + label power1 "PMIC-3 PSU 12V Rail Pwr (in1)" + label power2 "PMIC-3 ASIC 0.85V T0_1 Rail Pwr (out)" + label curr1 "PMIC-3 PSU 12V Rail Curr (in1)" + label curr2 "PMIC-3 ASIC 0.85V T0_1 Rail Curr (out)" + label curr3 "PMIC-3 ASIC 1.8V T0_1 Rail Curr (out)" + chip "mp2975-i2c-*-6a" + label in1 "PMIC-4 PSU 12V Rail (in1)" + label in2 "PMIC-4 ASIC 0.85V T2_3 Rail (out)" + label in3 "PMIC-4 ASIC 1.8V T2_3 Rail (out)" + label temp1 "PMIC-4 Temp 1" + label power1 "PMIC-4 PSU 12V Rail Pwr (in1)" + label power2 "PMIC-4 ASIC 0.85V T2_3 Rail Pwr (out)" + label curr1 "PMIC-4 PSU 12V Rail Curr (in1)" + label curr2 "PMIC-4 ASIC 0.85V T2_3 Rail Curr (out)" + label curr3 "PMIC-4 ASIC 1.8V T2_3 Rail Curr (out)" + chip "mp2975-i2c-*-6e" + label in1 "PMIC-5 PSU 12V Rail (in1)" + label in2 "PMIC-5 ASIC 1.2V T0_3 Rail_1 (out)" + label in3 "PMIC-5 ASIC 1.2V T4_7 Rail_2 (out)" + label temp1 "PMIC-5 Temp 1" + label power1 "PMIC-5 PSU 12V Rail Pwr (in1)" + label power2 "PMIC-5 ASIC 1.2V T0_3 Rail_1 Pwr (out)" + label power3 "PMIC-5 ASIC 1.2V T4_7 Rail_2 Pwr (out)" + label curr1 "PMIC-5 PSU 12V Rail Curr (in1)" + label curr2 "PMIC-5 ASIC 1.2V T0_3 Rail_1 Curr (out)" + label curr3 "PMIC-5 ASIC 1.2V T4_7 Rail_2 Curr (out)" + +bus "i2c-15" "i2c-1-mux (chan_id 6)" + chip "tps53679-i2c-*-58" + label in1 "PMIC-6 PSU 12V Rail (in1)" + label in2 "PMIC-6 PSU 12V Rail (in2)" + label in3 "PMIC-6 COMEX 1.8V Rail (out)" + label in4 "PMIC-6 COMEX 1.05V Rail (out)" + label temp1 "PMIC-6 Temp 1" + label temp2 "PMIC-6 Temp 2" + label power1 "PMIC-6 COMEX 1.8V Rail Pwr (out)" + label power2 "PMIC-6 COMEX 1.05V Rail Pwr (out)" + label curr1 "PMIC-6 COMEX 1.8V Rail Curr (out)" + label curr2 "PMIC-6 COMEX 1.05V Rail Curr (out)" + chip "tps53679-i2c-*-61" + label in1 "PMIC-7 PSU 12V Rail (in1)" + label in2 "PMIC-7 PSU 12V Rail (in2)" + label in3 "PMIC-7 COMEX 1.2V Rail (out)" + ignore in4 + label temp1 "PMIC-7 Temp 1" + label temp2 "PMIC-7 Temp 2" + label power1 "PMIC-7 COMEX 1.2V Rail Pwr (out)" + ignore power2 + label curr1 "PMIC-7 COMEX 1.2V Rail Curr (out)" + ignore curr2 + +# Power supplies +bus "i2c-4" "i2c-1-mux (chan_id 3)" + chip "dps460-i2c-*-58" + label in1 "PSU-1(L) 220V Rail (in)" + ignore in2 + label in3 "PSU-1(L) 12V Rail (out)" + label fan1 "PSU-1(L) Fan 1" + ignore fan2 + ignore fan3 + label temp1 "PSU-1(L) Temp 1" + label temp2 "PSU-1(L) Temp 2" + label temp3 "PSU-1(L) Temp 3" + label power1 "PSU-1(L) 220V Rail Pwr (in)" + label power2 "PSU-1(L) 12V Rail Pwr (out)" + label curr1 "PSU-1(L) 220V Rail Curr (in)" + label curr2 "PSU-1(L) 12V Rail Curr (out)" + chip "dps460-i2c-*-59" + label in1 "PSU-2(R) 220V Rail (in)" + ignore in2 + label in3 "PSU-2(R) 12V Rail (out)" + label fan1 "PSU-2(R) Fan 1" + ignore fan2 + ignore fan3 + label temp1 "PSU-2(R) Temp 1" + label temp2 "PSU-2(R) Temp 2" + label temp3 "PSU-2(R) Temp 3" + label power1 "PSU-2(R) 220V Rail Pwr (in)" + label power2 "PSU-2(R) 12V Rail Pwr (out)" + label curr1 "PSU-2(R) 220V Rail Curr (in)" + label curr2 "PSU-2(R) 12V Rail Curr (out)" + +# Chassis fans +chip "mlxreg_fan-isa-*" + label fan1 "Chassis Fan Drawer-1" + label fan2 "Chassis Fan Drawer-2" + label fan3 "Chassis Fan Drawer-3" + diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_objects.j2 b/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..33b6704f9902 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t0.j2 b/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t0.j2 index e886bea8f3c2..2120531db8ca 100644 --- a/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t0.j2 +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t0.j2 @@ -1,112 +1,39 @@ +{# + Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '26451968' %} {% set ingress_lossy_pool_size = '26451968' %} {% set egress_lossless_pool_size = '60817392' %} {% set egress_lossy_pool_size = '26451968' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "ingress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossy_pool_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossy_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} {%- endmacro %} - +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} +{%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t1.j2 b/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t1.j2 index 1d0209873642..61d972955e04 100644 --- a/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t1.j2 +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/buffers_defaults_t1.j2 @@ -1,112 +1,39 @@ +{# + Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {% set default_cable = '5m' %} {% set ingress_lossless_pool_size = '20627456' %} {% set ingress_lossy_pool_size = '20627456' %} {% set egress_lossless_pool_size = '60817392' %} {% set egress_lossy_pool_size = '20627456' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0, 32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} +{% import 'buffers_defaults_objects.j2' as defs with context %} -{%- macro generate_buffer_pool_and_profiles() %} - "BUFFER_POOL": { - "ingress_lossless_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossless_pool_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "ingress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ ingress_lossy_pool_size }}", - {%- endif %} - "type": "ingress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "{{ egress_lossless_pool_size }}", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossy_pool": { - {%- if dynamic_mode is not defined %} - "size": "{{ egress_lossy_pool_size }}", - {%- endif %} - "type": "egress", - "mode": "dynamic" - } - }, - "BUFFER_PROFILE": { - "ingress_lossless_profile": { - "pool":"ingress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "ingress_lossy_profile": { - "pool":"ingress_lossy_pool", - "size":"0", - "dynamic_th":"3" - }, - "egress_lossless_profile": { - "pool":"egress_lossless_pool", - "size":"0", - "dynamic_th":"7" - }, - "egress_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"9216", - "dynamic_th":"7" - }, - "q_lossy_profile": { - "pool":"egress_lossy_pool", - "size":"0", - "dynamic_th":"3" - } - }, +{%- macro generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {%- endmacro %} -{%- macro generate_profile_lists(port_names) %} - "BUFFER_PORT_INGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - }, - "BUFFER_PORT_EGRESS_PROFILE_LIST": { -{% for port in port_names.split(',') %} - "{{ port }}": { - "profile_list" : "egress_lossless_profile,egress_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_profile_lists(port_names_active, port_names_inactive) }} {%- endmacro %} -{%- macro generate_queue_buffers(port_names) %} - "BUFFER_QUEUE": { -{% for port in port_names.split(',') %} - "{{ port }}|3-4": { - "profile" : "egress_lossless_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|0-2": { - "profile" : "q_lossy_profile" - }, -{% endfor %} -{% for port in port_names.split(',') %} - "{{ port }}|5-6": { - "profile" : "q_lossy_profile" - }{% if not loop.last %},{% endif %} - -{% endfor %} - } +{%- macro generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_queue_buffers(port_names_active, port_names_inactive) }} {%- endmacro %} - +{%- macro generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) %} +{{ defs.generate_pg_profiles(port_names_active, port_names_inactive) }} +{%- endmacro %} diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/pg_profile_lookup.ini b/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/pg_profile_lookup.ini index 1fb3f9c328c9..b1b13a5c303c 100644 --- a/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/pg_profile_lookup.ini +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/pg_profile_lookup.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # PG lossless profiles. # speed cable size xon xoff threshold 10000 5m 52224 19456 32768 0 diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/port_config.ini b/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/port_config.ini index ea7219932624..cb3e7fd71094 100644 --- a/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/port_config.ini +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/port_config.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2017-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # name lanes alias index Ethernet0 0,1,2,3,4,5,6,7 etp1 1 Ethernet8 8,9,10,11,12,13,14,15 etp2 2 diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/sai_4700.xml b/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/sai_4700.xml index e3d0e4ea723d..83fc07b0c28b 100644 --- a/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/sai_4700.xml +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/ACS-MSN4700/sai_4700.xml @@ -1,4 +1,20 @@ + diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/platform.json b/device/mellanox/x86_64-mlnx_msn4700-r0/platform.json index 88b5045afadc..58fd5d08c6e1 100644 --- a/device/mellanox/x86_64-mlnx_msn4700-r0/platform.json +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/platform.json @@ -412,7 +412,7 @@ "lanes": "0,1,2,3,4,5,6,7", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp1"], - "2x200G[100G,50G,25G,10G,1G]": ["etp1a", "etp1b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp1a", "etp1b"], "4x100G[50G,25G,10G,1G]": ["etp1a", "etp1b", "etp1c", "etp1d"] } }, @@ -421,7 +421,7 @@ "lanes": "8,9,10,11,12,13,14,15", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp2"], - "2x200G[100G,50G,25G,10G,1G]": ["etp2a", "etp2b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp2a", "etp2b"], "4x100G[50G,25G,10G,1G]": ["etp2a", "etp2b", "etp2c", "etp2d"] } }, @@ -430,7 +430,7 @@ "lanes": "16,17,18,19,20,21,22,23", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp3"], - "2x200G[100G,50G,25G,10G,1G]": ["etp3a", "etp3b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp3a", "etp3b"], "4x100G[50G,25G,10G,1G]": ["etp3a", "etp3b", "etp3c", "etp3d"] } }, @@ -439,7 +439,7 @@ "lanes": "24,25,26,27,28,29,30,31", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp4"], - "2x200G[100G,50G,25G,10G,1G]": ["etp4a", "etp4b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp4a", "etp4b"], "4x100G[50G,25G,10G,1G]": ["etp4a", "etp4b", "etp4c", "etp4d"] } }, @@ -448,7 +448,7 @@ "lanes": "32,33,34,35,36,37,38,39", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp5"], - "2x200G[100G,50G,25G,10G,1G]": ["etp5a", "etp5b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp5a", "etp5b"], "4x100G[50G,25G,10G,1G]": ["etp5a", "etp5b", "etp5c", "etp5d"] } }, @@ -457,7 +457,7 @@ "lanes": "40,41,42,43,44,45,46,47", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp6"], - "2x200G[100G,50G,25G,10G,1G]": ["etp6a", "etp6b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp6a", "etp6b"], "4x100G[50G,25G,10G,1G]": ["etp6a", "etp6b", "etp6c", "etp6d"] } }, @@ -466,7 +466,7 @@ "lanes": "48,49,50,51,52,53,54,55", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp7"], - "2x200G[100G,50G,25G,10G,1G]": ["etp7a", "etp7b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp7a", "etp7b"], "4x100G[50G,25G,10G,1G]": ["etp7a", "etp7b", "etp7c", "etp7d"] } }, @@ -475,7 +475,7 @@ "lanes": "56,57,58,59,60,61,62,63", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp8"], - "2x200G[100G,50G,25G,10G,1G]": ["etp8a", "etp8b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp8a", "etp8b"], "4x100G[50G,25G,10G,1G]": ["etp8a", "etp8b", "etp8c", "etp8d"] } }, @@ -484,7 +484,7 @@ "lanes": "64,65,66,67,68,69,70,71", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp9"], - "2x200G[100G,50G,25G,10G,1G]": ["etp9a", "etp9b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp9a", "etp9b"], "4x100G[50G,25G,10G,1G]": ["etp9a", "etp9b", "etp9c", "etp9d"] } }, @@ -493,7 +493,7 @@ "lanes": "72,73,74,75,76,77,78,79", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp10"], - "2x200G[100G,50G,25G,10G,1G]": ["etp10a", "etp10b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp10a", "etp10b"], "4x100G[50G,25G,10G,1G]": ["etp10a", "etp10b", "etp10c", "etp10d"] } }, @@ -502,7 +502,7 @@ "lanes": "80,81,82,83,84,85,86,87", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp11"], - "2x200G[100G,50G,25G,10G,1G]": ["etp11a", "etp11b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp11a", "etp11b"], "4x100G[50G,25G,10G,1G]": ["etp11a", "etp11b", "etp11c", "etp11d"] } }, @@ -511,7 +511,7 @@ "lanes": "88,89,90,91,92,93,94,95", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp12"], - "2x200G[100G,50G,25G,10G,1G]": ["etp12a", "etp12b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp12a", "etp12b"], "4x100G[50G,25G,10G,1G]": ["etp12a", "etp12b", "etp12c", "etp12d"] } }, @@ -520,7 +520,7 @@ "lanes": "96,97,98,99,100,101,102,103", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp13"], - "2x200G[100G,50G,25G,10G,1G]": ["etp13a", "etp13b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp13a", "etp13b"], "4x100G[50G,25G,10G,1G]": ["etp13a", "etp13b", "etp13c", "etp13d"] } }, @@ -529,7 +529,7 @@ "lanes": "104,105,106,107,108,109,110,111", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp14"], - "2x200G[100G,50G,25G,10G,1G]": ["etp14a", "etp14b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp14a", "etp14b"], "4x100G[50G,25G,10G,1G]": ["etp14a", "etp14b", "etp14c", "etp14d"] } }, @@ -538,7 +538,7 @@ "lanes": "112,113,114,115,116,117,118,119", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp15"], - "2x200G[100G,50G,25G,10G,1G]": ["etp15a", "etp15b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp15a", "etp15b"], "4x100G[50G,25G,10G,1G]": ["etp15a", "etp15b", "etp15c", "etp15d"] } }, @@ -547,7 +547,7 @@ "lanes": "120,121,122,123,124,125,126,127", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp16"], - "2x200G[100G,50G,25G,10G,1G]": ["etp16a", "etp16b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp16a", "etp16b"], "4x100G[50G,25G,10G,1G]": ["etp16a", "etp16b", "etp16c", "etp16d"] } }, @@ -556,7 +556,7 @@ "lanes": "128,129,130,131,132,133,134,135", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp17"], - "2x200G[100G,50G,25G,10G,1G]": ["etp17a", "etp17b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp17a", "etp17b"], "4x100G[50G,25G,10G,1G]": ["etp17a", "etp17b", "etp17c", "etp17d"] } }, @@ -565,7 +565,7 @@ "lanes": "136,137,138,139,140,141,142,143", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp18"], - "2x200G[100G,50G,25G,10G,1G]": ["etp18a", "etp18b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp18a", "etp18b"], "4x100G[50G,25G,10G,1G]": ["etp18a", "etp18b", "etp18c", "etp18d"] } }, @@ -574,7 +574,7 @@ "lanes": "144,145,146,147,148,149,150,151", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp19"], - "2x200G[100G,50G,25G,10G,1G]": ["etp19a", "etp19b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp19a", "etp19b"], "4x100G[50G,25G,10G,1G]": ["etp19a", "etp19b", "etp19c", "etp19d"] } }, @@ -583,7 +583,7 @@ "lanes": "152,153,154,155,156,157,158,159", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp20"], - "2x200G[100G,50G,25G,10G,1G]": ["etp20a", "etp20b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp20a", "etp20b"], "4x100G[50G,25G,10G,1G]": ["etp20a", "etp20b", "etp20c", "etp20d"] } }, @@ -592,7 +592,7 @@ "lanes": "160,161,162,163,164,165,166,167", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp21"], - "2x200G[100G,50G,25G,10G,1G]": ["etp21a", "etp21b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp21a", "etp21b"], "4x100G[50G,25G,10G,1G]": ["etp21a", "etp21b", "etp21c", "etp21d"] } }, @@ -601,7 +601,7 @@ "lanes": "168,169,170,171,172,173,174,175", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp22"], - "2x200G[100G,50G,25G,10G,1G]": ["etp22a", "etp22b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp22a", "etp22b"], "4x100G[50G,25G,10G,1G]": ["etp22a", "etp22b", "etp22c", "etp22d"] } }, @@ -610,7 +610,7 @@ "lanes": "176,177,178,179,180,181,182,183", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp23"], - "2x200G[100G,50G,25G,10G,1G]": ["etp23a", "etp23b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp23a", "etp23b"], "4x100G[50G,25G,10G,1G]": ["etp23a", "etp23b", "etp23c", "etp23d"] } }, @@ -619,7 +619,7 @@ "lanes": "184,185,186,187,188,189,190,191", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp24"], - "2x200G[100G,50G,25G,10G,1G]": ["etp24a", "etp24b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp24a", "etp24b"], "4x100G[50G,25G,10G,1G]": ["etp24a", "etp24b", "etp24c", "etp24d"] } }, @@ -628,7 +628,7 @@ "lanes": "192,193,194,195,196,197,198,199", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp25"], - "2x200G[100G,50G,25G,10G,1G]": ["etp25a", "etp25b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp25a", "etp25b"], "4x100G[50G,25G,10G,1G]": ["etp25a", "etp25b", "etp25c", "etp25d"] } }, @@ -637,7 +637,7 @@ "lanes": "200,201,202,203,204,205,206,207", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp26"], - "2x200G[100G,50G,25G,10G,1G]": ["etp26a", "etp26b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp26a", "etp26b"], "4x100G[50G,25G,10G,1G]": ["etp26a", "etp26b", "etp26c", "etp26d"] } }, @@ -646,7 +646,7 @@ "lanes": "208,209,210,211,212,213,214,215", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp27"], - "2x200G[100G,50G,25G,10G,1G]": ["etp27a", "etp27b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp27a", "etp27b"], "4x100G[50G,25G,10G,1G]": ["etp27a", "etp27b", "etp27c", "etp27d"] } }, @@ -655,7 +655,7 @@ "lanes": "216,217,218,219,220,221,222,223", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp28"], - "2x200G[100G,50G,25G,10G,1G]": ["etp28a", "etp28b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp28a", "etp28b"], "4x100G[50G,25G,10G,1G]": ["etp28a", "etp28b", "etp28c", "etp28d"] } }, @@ -664,7 +664,7 @@ "lanes": "224,225,226,227,228,229,230,231", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp29"], - "2x200G[100G,50G,25G,10G,1G]": ["etp29a", "etp29b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp29a", "etp29b"], "4x100G[50G,25G,10G,1G]": ["etp29a", "etp29b", "etp29c", "etp29d"] } }, @@ -673,7 +673,7 @@ "lanes": "232,233,234,235,236,237,238,239", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp30"], - "2x200G[100G,50G,25G,10G,1G]": ["etp30a", "etp30b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp30a", "etp30b"], "4x100G[50G,25G,10G,1G]": ["etp30a", "etp30b", "etp30c", "etp30d"] } }, @@ -682,7 +682,7 @@ "lanes": "240,241,242,243,244,245,246,247", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp31"], - "2x200G[100G,50G,25G,10G,1G]": ["etp31a", "etp31b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp31a", "etp31b"], "4x100G[50G,25G,10G,1G]": ["etp31a", "etp31b", "etp31c", "etp31d"] } }, @@ -691,7 +691,7 @@ "lanes": "248,249,250,251,252,253,254,255", "breakout_modes": { "1x400G[200G,100G,50G,40G,25G,10G,1G]": ["etp32"], - "2x200G[100G,50G,25G,10G,1G]": ["etp32a", "etp32b"], + "2x200G[100G,50G,40G,25G,10G,1G]": ["etp32a", "etp32b"], "4x100G[50G,25G,10G,1G]": ["etp32a", "etp32b", "etp32c", "etp32d"] } } diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/platform_asic b/device/mellanox/x86_64-mlnx_msn4700-r0/platform_asic new file mode 100644 index 000000000000..70c074885557 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/platform_asic @@ -0,0 +1 @@ +mellanox diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf.a1 b/device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf.a1 index 9511fac1278e..87308be500ce 100644 --- a/device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf.a1 +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf.a1 @@ -1,5 +1,6 @@ ################################################################################ # Copyright (C) 20xx-2021 Mellanox Technologies, Ltd. ALL RIGHTS RESERVED. +## Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. # # Platform specific sensors config for SN4700 A0/A1 ################################################################################ diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/system_health_monitoring_config.json b/device/mellanox/x86_64-mlnx_msn4700-r0/system_health_monitoring_config.json deleted file mode 120000 index 98df66c27ca5..000000000000 --- a/device/mellanox/x86_64-mlnx_msn4700-r0/system_health_monitoring_config.json +++ /dev/null @@ -1 +0,0 @@ -../x86_64-mlnx_msn2700-r0/system_health_monitoring_config.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/system_health_monitoring_config.json b/device/mellanox/x86_64-mlnx_msn4700-r0/system_health_monitoring_config.json new file mode 100644 index 000000000000..6a5d7d19e9b4 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/system_health_monitoring_config.json @@ -0,0 +1,11 @@ +{ + "services_to_ignore": [], + "devices_to_ignore": [], + "user_defined_checkers": [], + "polling_interval": 60, + "led_color": { + "fault": "orange", + "normal": "green", + "booting": "orange_blink" + } +} diff --git a/device/mellanox/x86_64-mlnx_msn4700_simx-r0/platform.json b/device/mellanox/x86_64-mlnx_msn4700_simx-r0/platform.json new file mode 120000 index 000000000000..ae928545f4ba --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700_simx-r0/platform.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn4700-r0/platform.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4700_simx-r0/platform_asic b/device/mellanox/x86_64-mlnx_msn4700_simx-r0/platform_asic new file mode 100644 index 000000000000..70c074885557 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700_simx-r0/platform_asic @@ -0,0 +1 @@ +mellanox diff --git a/device/mellanox/x86_64-mlnx_msn4700_simx-r0/pmon_daemon_control.json b/device/mellanox/x86_64-mlnx_msn4700_simx-r0/pmon_daemon_control.json deleted file mode 100644 index dd83c2db12c5..000000000000 --- a/device/mellanox/x86_64-mlnx_msn4700_simx-r0/pmon_daemon_control.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "skip_ledd": true, - "skip_xcvrd": true, - "skip_psud": true, - "skip_pcied": true, - "skip_thermalctld": true -} diff --git a/device/mellanox/x86_64-mlnx_msn4700_simx-r0/pmon_daemon_control.json b/device/mellanox/x86_64-mlnx_msn4700_simx-r0/pmon_daemon_control.json new file mode 120000 index 000000000000..d9fa54f8d2b9 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700_simx-r0/pmon_daemon_control.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700_simx-r0/pmon_daemon_control.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/port_config.ini b/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/port_config.ini deleted file mode 100644 index 51c0ed3798cc..000000000000 --- a/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/port_config.ini +++ /dev/null @@ -1 +0,0 @@ -# name lanes alias index diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/sai_4800.xml b/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/sai_4800.xml deleted file mode 100644 index 1625d5b60948..000000000000 --- a/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/sai_4800.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - 00:02:03:04:05:00 - - - 0 - - - - - - - diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/default_sku b/device/mellanox/x86_64-mlnx_msn4800-r0/default_sku deleted file mode 100644 index f50c8b52baa3..000000000000 --- a/device/mellanox/x86_64-mlnx_msn4800-r0/default_sku +++ /dev/null @@ -1 +0,0 @@ -ACS-MSN4800 t1 diff --git a/device/mellanox/x86_64-mlnx_msn4800_simx-r0/ACS-MSN4800 b/device/mellanox/x86_64-mlnx_msn4800_simx-r0/ACS-MSN4800 deleted file mode 120000 index c91b607a31cc..000000000000 --- a/device/mellanox/x86_64-mlnx_msn4800_simx-r0/ACS-MSN4800 +++ /dev/null @@ -1 +0,0 @@ -../x86_64-mlnx_msn4800-r0/ACS-MSN4800/ \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4800_simx-r0/default_sku b/device/mellanox/x86_64-mlnx_msn4800_simx-r0/default_sku deleted file mode 120000 index a81dbe5c2475..000000000000 --- a/device/mellanox/x86_64-mlnx_msn4800_simx-r0/default_sku +++ /dev/null @@ -1 +0,0 @@ -../x86_64-mlnx_msn4800-r0/default_sku \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4800_simx-r0/plugins b/device/mellanox/x86_64-mlnx_msn4800_simx-r0/plugins deleted file mode 120000 index 92912a201dd1..000000000000 --- a/device/mellanox/x86_64-mlnx_msn4800_simx-r0/plugins +++ /dev/null @@ -1 +0,0 @@ -../x86_64-mlnx_msn4800-r0/plugins/ \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_x86-r5.0.1400/platform_asic b/device/mellanox/x86_64-mlnx_x86-r5.0.1400/platform_asic new file mode 100644 index 000000000000..70c074885557 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_x86-r5.0.1400/platform_asic @@ -0,0 +1 @@ +mellanox diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/buffers.json.j2 b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/buffers.json.j2 new file mode 120000 index 000000000000..add8bf8bb7c2 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/buffers.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/buffers_defaults_objects.j2 b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..33b6704f9902 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/buffers_defaults_t0.j2 b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/buffers_defaults_t0.j2 new file mode 120000 index 000000000000..7bcae62336f6 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/buffers_defaults_t0.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/buffers_defaults_t1.j2 b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/buffers_defaults_t1.j2 new file mode 120000 index 000000000000..a437d613434d --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/buffers_defaults_t1.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/buffers_dynamic.json.j2 b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/buffers_dynamic.json.j2 similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/buffers_dynamic.json.j2 rename to device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/buffers_dynamic.json.j2 diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/hwsku.json b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/hwsku.json new file mode 100644 index 000000000000..435135cef434 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/hwsku.json @@ -0,0 +1,208 @@ +{ + "interfaces": { + "Ethernet0": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet1": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet2": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet3": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet4": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet5": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet6": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet7": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet8": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet9": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet10": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet11": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet12": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet13": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet14": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet15": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet16": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet17": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet18": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet19": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet20": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet21": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet22": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet23": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet24": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet25": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet26": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet27": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet28": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet29": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet30": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet31": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet32": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet33": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet34": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet35": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet36": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet37": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet38": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet39": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet40": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet41": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet42": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet43": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet44": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet45": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet46": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet47": { + "default_brkout_mode": "1x1000[100,10]", + "port_type": "RJ45" + }, + "Ethernet48": { + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" + }, + "Ethernet52": { + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" + }, + "Ethernet56": { + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" + }, + "Ethernet60": { + "default_brkout_mode": "1x100G[50G,40G,25G,10G]" + } + } +} diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/pg_profile_lookup.ini b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/pg_profile_lookup.ini new file mode 100644 index 000000000000..53652080e967 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/pg_profile_lookup.ini @@ -0,0 +1,40 @@ +## +## Copyright (c) 2018-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## + +# PG lossless profiles. +# speed cable size xon xoff threshold + 100 5m 49152 19456 29696 0 + 1000 5m 49152 19456 29696 0 + 10000 5m 49152 19456 29696 0 + 25000 5m 49152 19456 29696 0 + 40000 5m 49152 19456 29696 0 + 50000 5m 49152 19456 29696 0 + 100000 5m 50176 19456 30720 0 + 100 40m 49152 19456 29696 0 + 1000 40m 49152 19456 29696 0 + 10000 40m 49152 19456 29696 0 + 25000 40m 51200 19456 31744 0 + 40000 40m 52224 19456 32768 0 + 50000 40m 53248 19456 33792 0 + 100000 40m 58368 19456 38912 0 + 100 300m 56320 19456 29696 0 + 1000 300m 56320 19456 29696 0 + 10000 300m 56320 19456 36864 0 + 25000 300m 67584 19456 48128 0 + 40000 300m 78848 19456 59392 0 + 50000 300m 86016 19456 66560 0 + 100000 300m 123904 19456 104448 0 diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/port_config.ini b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/port_config.ini new file mode 100644 index 000000000000..08d2e2df073a --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/port_config.ini @@ -0,0 +1,70 @@ +## +## Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## + +# name lanes alias index speed +Ethernet0 0 etp1 1 1000 +Ethernet1 4 etp2 2 1000 +Ethernet2 8 etp3 3 1000 +Ethernet3 12 etp4 4 1000 +Ethernet4 16 etp5 5 1000 +Ethernet5 20 etp6 6 1000 +Ethernet6 24 etp7 7 1000 +Ethernet7 28 etp8 8 1000 +Ethernet8 32 etp9 9 1000 +Ethernet9 36 etp10 10 1000 +Ethernet10 40 etp11 11 1000 +Ethernet11 44 etp12 12 1000 +Ethernet12 48 etp13 13 1000 +Ethernet13 52 etp14 14 1000 +Ethernet14 56 etp15 15 1000 +Ethernet15 60 etp16 16 1000 +Ethernet16 64 etp17 17 1000 +Ethernet17 68 etp18 18 1000 +Ethernet18 72 etp19 19 1000 +Ethernet19 76 etp20 20 1000 +Ethernet20 80 etp21 21 1000 +Ethernet21 84 etp22 22 1000 +Ethernet22 88 etp23 23 1000 +Ethernet23 92 etp24 24 1000 +Ethernet24 96 etp25 25 1000 +Ethernet25 100 etp26 26 1000 +Ethernet26 104 etp27 27 1000 +Ethernet27 108 etp28 28 1000 +Ethernet28 112 etp29 29 1000 +Ethernet29 116 etp30 30 1000 +Ethernet30 120 etp31 31 1000 +Ethernet31 124 etp32 32 1000 +Ethernet32 128 etp33 33 1000 +Ethernet33 132 etp34 34 1000 +Ethernet34 136 etp35 35 1000 +Ethernet35 140 etp36 36 1000 +Ethernet36 144 etp37 37 1000 +Ethernet37 148 etp38 38 1000 +Ethernet38 152 etp39 39 1000 +Ethernet39 156 etp40 40 1000 +Ethernet40 160 etp41 41 1000 +Ethernet41 164 etp42 42 1000 +Ethernet42 168 etp43 43 1000 +Ethernet43 172 etp44 44 1000 +Ethernet44 176 etp45 45 1000 +Ethernet45 180 etp46 46 1000 +Ethernet46 184 etp47 47 1000 +Ethernet47 188 etp48 48 1000 +Ethernet48 192,193,194,195 etp49 49 100000 +Ethernet52 196,197,198,199 etp50 50 100000 +Ethernet56 200,201,202,203 etp51 51 100000 +Ethernet60 204,205,206,207 etp52 52 100000 diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/qos.json.j2 b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/qos.json.j2 similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/qos.json.j2 rename to device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/qos.json.j2 diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/sai.profile b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/sai.profile new file mode 100644 index 000000000000..692ad368de4c --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/sai.profile @@ -0,0 +1,3 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_2201.xml +SAI_DUMP_STORE_PATH=/var/log/mellanox/sdk-dumps +SAI_DUMP_STORE_AMOUNT=10 diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/sai_2201.xml b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/sai_2201.xml new file mode 100644 index 000000000000..d50843270cfd --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/ACS-SN2201/sai_2201.xml @@ -0,0 +1,402 @@ + + + + + + + + 00:02:03:04:05:00 + + + 1 + + + 52 + + + + + 61 + 1 + 0 + + 0 + + 3 + + + 62 + 1 + 1 + 0 + 3 + + + 63 + 1 + 2 + 0 + 3 + + + 64 + 1 + 3 + 0 + 3 + + + 57 + 1 + 4 + 0 + 3 + + + 58 + 1 + 5 + 0 + 3 + + + 59 + 1 + 6 + 0 + 3 + + + 60 + 1 + 7 + 0 + 3 + + + 53 + 1 + 8 + 0 + 3 + + + 54 + 1 + 9 + 0 + 3 + + + 55 + 1 + 10 + 0 + 3 + + + 56 + 1 + 11 + 0 + 3 + + + 49 + 1 + 12 + 0 + 3 + + + 50 + 1 + 13 + 0 + 3 + + + 51 + 1 + 14 + 0 + 3 + + + 52 + 1 + 15 + 0 + 3 + + + 45 + 1 + 16 + 0 + 3 + + + 46 + 1 + 17 + 0 + 3 + + + 47 + 1 + 18 + 0 + 3 + + + 48 + 1 + 19 + 0 + 3 + + + 41 + 1 + 20 + 0 + 3 + + + 42 + 1 + 21 + 0 + 3 + + + 43 + 1 + 22 + 0 + 3 + + + 44 + 1 + 23 + 0 + 3 + + + 37 + 1 + 24 + 0 + 3 + + + 38 + 1 + 25 + 0 + 3 + + + 39 + 1 + 26 + 0 + 3 + + + 40 + 1 + 27 + 0 + 3 + + + 33 + 1 + 28 + 0 + 3 + + + 34 + 1 + 29 + 0 + 3 + + + 35 + 1 + 30 + 0 + 3 + + + 36 + 1 + 31 + 0 + 3 + + + 1 + 1 + 32 + 0 + 3 + + + 2 + 1 + 33 + 0 + 3 + + + 3 + 1 + 34 + 0 + 3 + + + 4 + 1 + 35 + 0 + 3 + + + 5 + 1 + 36 + 0 + 3 + + + 6 + 1 + 37 + 0 + 3 + + + 17 + 1 + 38 + 0 + 3 + + + 18 + 1 + 39 + 0 + 3 + + + 19 + 1 + 40 + 0 + 3 + + + 20 + 1 + 41 + 0 + 3 + + + 21 + 1 + 42 + 0 + 3 + + + 22 + 1 + 43 + 0 + 3 + + + 23 + 1 + 44 + 0 + 3 + + + 24 + 1 + 45 + 0 + 3 + + + 25 + 1 + 46 + 0 + 3 + + + 26 + 1 + 47 + 0 + 3 + + + 9 + 4 + 48 + 3 + 11534336 + + + 7 + 4 + 49 + 3 + 11534336 + + + 13 + 4 + 50 + 3 + 11534336 + + + 11 + 4 + 51 + 3 + 11534336 + + + + + diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/default_sku b/device/mellanox/x86_64-nvidia_sn2201-r0/default_sku new file mode 100644 index 000000000000..2ef2c5dd0d32 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/default_sku @@ -0,0 +1 @@ +ACS-SN2201 t1 diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/installer.conf b/device/mellanox/x86_64-nvidia_sn2201-r0/installer.conf new file mode 100644 index 000000000000..8fcb08aba3b8 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/installer.conf @@ -0,0 +1 @@ +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="acpi_enforce_resources=lax" diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/pcie.yaml b/device/mellanox/x86_64-nvidia_sn2201-r0/pcie.yaml new file mode 100644 index 000000000000..c4fb7293cc10 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/pcie.yaml @@ -0,0 +1,140 @@ +## +## Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## + +- bus: '00' + dev: '00' + fn: '0' + id: '1980' + name: 'Host bridge: Intel Corporation Atom Processor C3000 Series System Agent (rev + 11)' +- bus: '00' + dev: '04' + fn: '0' + id: 19a1 + name: 'Host bridge: Intel Corporation Atom Processor C3000 Series Error Registers + (rev 11)' +- bus: '00' + dev: '05' + fn: '0' + id: 19a2 + name: 'Generic system peripheral [0807]: Intel Corporation Atom Processor C3000 + Series Root Complex Event Collector (rev 11)' +- bus: '00' + dev: '06' + fn: '0' + id: 19a3 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series Integrated QAT + Root Port (rev 11)' +- bus: '00' + dev: 09 + fn: '0' + id: 19a4 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root + Port #0 (rev 11)' +- bus: '00' + dev: 0b + fn: '0' + id: 19a6 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root + Port #2 (rev 11)' +- bus: '00' + dev: 0f + fn: '0' + id: 19a9 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root + Port #5 (rev 11)' +- bus: '00' + dev: '10' + fn: '0' + id: 19aa + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root + Port #6 (rev 11)' +- bus: '00' + dev: '11' + fn: '0' + id: 19ab + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root + Port #7 (rev 11)' +- bus: '00' + dev: '12' + fn: '0' + id: 19ac + name: 'System peripheral: Intel Corporation Atom Processor C3000 Series SMBus Contoller + - Host (rev 11)' +- bus: '00' + dev: '15' + fn: '0' + id: 19d0 + name: 'USB controller: Intel Corporation Atom Processor C3000 Series USB 3.0 xHCI + Controller (rev 11)' +- bus: '00' + dev: '18' + fn: '0' + id: 19d3 + name: 'Communication controller: Intel Corporation Atom Processor C3000 Series ME + HECI 1 (rev 11)' +- bus: '00' + dev: 1c + fn: '0' + id: 19db + name: 'SD Host controller: Intel Corporation Device 19db (rev 11)' +- bus: '00' + dev: 1f + fn: '0' + id: 19dc + name: 'ISA bridge: Intel Corporation Atom Processor C3000 Series LPC or eSPI (rev + 11)' +- bus: '00' + dev: 1f + fn: '2' + id: 19de + name: 'Memory controller: Intel Corporation Atom Processor C3000 Series Power Management + Controller (rev 11)' +- bus: '00' + dev: 1f + fn: '4' + id: 19df + name: 'SMBus: Intel Corporation Atom Processor C3000 Series SMBus controller (rev + 11)' +- bus: '00' + dev: 1f + fn: '5' + id: 19e0 + name: 'Serial bus controller [0c80]: Intel Corporation Atom Processor C3000 Series + SPI Controller (rev 11)' +- bus: '01' + dev: '00' + fn: '0' + id: 19e2 + name: 'Co-processor: Intel Corporation Atom Processor C3000 Series QuickAssist Technology + (rev 11)' +- bus: '02' + dev: '00' + fn: '0' + id: '0026' + name: 'Non-Volatile memory controller: Device 1dd4:0026 (rev 03)' +- bus: '03' + dev: '00' + fn: '0' + id: cb84 + name: 'Ethernet controller: Mellanox Technologies MT52100' +- bus: '06' + dev: '00' + fn: '0' + id: '1533' + name: 'Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev + 03)' diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/platform.json b/device/mellanox/x86_64-nvidia_sn2201-r0/platform.json new file mode 100644 index 000000000000..f600f26293ce --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/platform.json @@ -0,0 +1,507 @@ +{ + "chassis": { + "name": "SN2201", + "components": [{ + "name": "ONIE" + }, + { + "name": "SSD" + }, + { + "name": "BIOS" + }, + { + "name": "CPLD1" + }, + { + "name": "CPLD2" + } + ], + "fans": [], + "fan_drawers": [ + { + "name": "drawer1", + "fans": [ + { + "name": "fan1" + } + ] + }, + { + "name": "drawer2", + "fans": [ + { + "name": "fan2" + } + ] + }, + { + "name": "drawer3", + "fans": [ + { + "name": "fan3" + } + ] + }, + { + "name": "drawer4", + "fans": [ + { + "name": "fan4" + } + ] + } + ], + "psus": [ + { + "name": "PSU 1", + "fans": [ + { + "name": "psu1_fan1" + } + ], + "thermals": [ + { + "name": "PSU-1 Temp" + } + ] + }, + { + "name": "PSU 2", + "fans": [ + { + "name": "psu2_fan1" + } + ], + "thermals": [ + { + "name": "PSU-2 Temp" + } + ] + } + ], + "thermals": [ + { + "name": "Ambient Port Side Temp" + }, + { + "name": "Ambient Fan Side Temp" + }, + { + "name": "Ambient CPU Board Temp" + }, + { + "name": "Ambient Switch Board Temp" + }, + { + "name": "CPU Pack Temp" + }, + { + "name": "CPU Core 0 Temp" + }, + { + "name": "CPU Core 1 Temp" + }, + { + "name": "ASIC" + } + ], + "sfps": [{ + "name": "sfp1", + "thermals": [{ + "name": "xSFP module 1 Temp" + }] + }, + { + "name": "sfp2", + "thermals": [{ + "name": "xSFP module 2 Temp" + }] + }, + { + "name": "sfp3", + "thermals": [{ + "name": "xSFP module 3 Temp" + }] + }, + { + "name": "sfp4", + "thermals": [{ + "name": "xSFP module 4 Temp" + }] + } + ] + }, + "interfaces": { + "Ethernet0": { + "index": "1", + "lanes": "0", + "breakout_modes": { + "1x1000[100,10]": ["etp1"] + } + }, + "Ethernet1": { + "index": "2", + "lanes": "4", + "breakout_modes": { + "1x1000[100,10]": ["etp2"] + } + }, + "Ethernet2": { + "index": "3", + "lanes": "8", + "breakout_modes": { + "1x1000[100,10]": ["etp3"] + } + }, + "Ethernet3": { + "index": "4", + "lanes": "12", + "breakout_modes": { + "1x1000[100,10]": ["etp4"] + } + }, + "Ethernet4": { + "index": "5", + "lanes": "16", + "breakout_modes": { + "1x1000[100,10]": ["etp5"] + } + }, + "Ethernet5": { + "index": "6", + "lanes": "20", + "breakout_modes": { + "1x1000[100,10]": ["etp6"] + } + }, + "Ethernet6": { + "index": "7", + "lanes": "24", + "breakout_modes": { + "1x1000[100,10]": ["etp7"] + } + }, + "Ethernet7": { + "index": "8", + "lanes": "28", + "breakout_modes": { + "1x1000[100,10]": ["etp8"] + } + }, + + "Ethernet8": { + "index": "9", + "lanes": "32", + "breakout_modes": { + "1x1000[100,10]": ["etp9"] + } + }, + "Ethernet9": { + "index": "10", + "lanes": "36", + "breakout_modes": { + "1x1000[100,10]": ["etp10"] + } + }, + "Ethernet10": { + "index": "11", + "lanes": "40", + "breakout_modes": { + "1x1000[100,10]": ["etp11"] + } + }, + "Ethernet11": { + "index": "12", + "lanes": "44", + "breakout_modes": { + "1x1000[100,10]": ["etp12"] + } + }, + "Ethernet12": { + "index": "13", + "lanes": "48", + "breakout_modes": { + "1x1000[100,10]": ["etp13"] + } + }, + "Ethernet13": { + "index": "14", + "lanes": "52", + "breakout_modes": { + "1x1000[100,10]": ["etp14"] + } + }, + "Ethernet14": { + "index": "15", + "lanes": "56", + "breakout_modes": { + "1x1000[100,10]": ["etp15"] + } + }, + "Ethernet15": { + "index": "16", + "lanes": "60", + "breakout_modes": { + "1x1000[100,10]": ["etp16"] + } + }, + + "Ethernet16": { + "index": "17", + "lanes": "64", + "breakout_modes": { + "1x1000[100,10]": ["etp17"] + } + }, + "Ethernet17": { + "index": "18", + "lanes": "68", + "breakout_modes": { + "1x1000[100,10]": ["etp18"] + } + }, + "Ethernet18": { + "index": "19", + "lanes": "72", + "breakout_modes": { + "1x1000[100,10]": ["etp19"] + } + }, + "Ethernet19": { + "index": "20", + "lanes": "76", + "breakout_modes": { + "1x1000[100,10]": ["etp20"] + } + }, + "Ethernet20": { + "index": "21", + "lanes": "80", + "breakout_modes": { + "1x1000[100,10]": ["etp21"] + } + }, + "Ethernet21": { + "index": "22", + "lanes": "84", + "breakout_modes": { + "1x1000[100,10]": ["etp22"] + } + }, + "Ethernet22": { + "index": "23", + "lanes": "88", + "breakout_modes": { + "1x1000[100,10]": ["etp23"] + } + }, + "Ethernet23": { + "index": "24", + "lanes": "92", + "breakout_modes": { + "1x1000[100,10]": ["etp24"] + } + }, + "Ethernet24": { + "index": "25", + "lanes": "96", + "breakout_modes": { + "1x1000[100,10]": ["etp25"] + } + }, + "Ethernet25": { + "index": "26", + "lanes": "100", + "breakout_modes": { + "1x1000[100,10]": ["etp26"] + } + }, + "Ethernet26": { + "index": "27", + "lanes": "104", + "breakout_modes": { + "1x1000[100,10]": ["etp27"] + } + }, + "Ethernet27": { + "index": "28", + "lanes": "108", + "breakout_modes": { + "1x1000[100,10]": ["etp28"] + } + }, + "Ethernet28": { + "index": "29", + "lanes": "112", + "breakout_modes": { + "1x1000[100,10]": ["etp29"] + } + }, + "Ethernet29": { + "index": "30", + "lanes": "116", + "breakout_modes": { + "1x1000[100,10]": ["etp30"] + } + }, + "Ethernet30": { + "index": "31", + "lanes": "120", + "breakout_modes": { + "1x1000[100,10]": ["etp31"] + } + }, + "Ethernet31": { + "index": "32", + "lanes": "124", + "breakout_modes": { + "1x1000[100,10]": ["etp32"] + } + }, + "Ethernet32": { + "index": "33", + "lanes": "128", + "breakout_modes": { + "1x1000[100,10]": ["etp33"] + } + }, + "Ethernet33": { + "index": "34", + "lanes": "132", + "breakout_modes": { + "1x1000[100,10]": ["etp34"] + } + }, + "Ethernet34": { + "index": "35", + "lanes": "136", + "breakout_modes": { + "1x1000[100,10]": ["etp35"] + } + }, + "Ethernet35": { + "index": "36", + "lanes": "140", + "breakout_modes": { + "1x1000[100,10]": ["etp36"] + } + }, + "Ethernet36": { + "index": "37", + "lanes": "144", + "breakout_modes": { + "1x1000[100,10]": ["etp37"] + } + }, + "Ethernet37": { + "index": "38", + "lanes": "148", + "breakout_modes": { + "1x1000[100,10]": ["etp38"] + } + }, + "Ethernet38": { + "index": "39", + "lanes": "152", + "breakout_modes": { + "1x1000[100,10]": ["etp39"] + } + }, + "Ethernet39": { + "index": "40", + "lanes": "156", + "breakout_modes": { + "1x1000[100,10]": ["etp40"] + } + }, + "Ethernet40": { + "index": "41", + "lanes": "160", + "breakout_modes": { + "1x1000[100,10]": ["etp41"] + } + }, + "Ethernet41": { + "index": "42", + "lanes": "164", + "breakout_modes": { + "1x1000[100,10]": ["etp42"] + } + }, + "Ethernet42": { + "index": "43", + "lanes": "168", + "breakout_modes": { + "1x1000[100,10]": ["etp43"] + } + }, + "Ethernet43": { + "index": "44", + "lanes": "172", + "breakout_modes": { + "1x1000[100,10]": ["etp44"] + } + }, + "Ethernet44": { + "index": "45", + "lanes": "176", + "breakout_modes": { + "1x1000[100,10]": ["etp45"] + } + }, + "Ethernet45": { + "index": "46", + "lanes": "180", + "breakout_modes": { + "1x1000[100,10]": ["etp46"] + } + }, + "Ethernet46": { + "index": "47", + "lanes": "184", + "breakout_modes": { + "1x1000[100,10]": ["etp47"] + } + }, + "Ethernet47": { + "index": "48", + "lanes": "188", + "breakout_modes": { + "1x1000[100,10]": ["etp48"] + } + }, + "Ethernet48": { + "index": "49,49,49,49", + "lanes": "192,193,194,195", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp49"], + "2x50G[25G,10G]": ["etp49a", "etp49b"] + } + }, + "Ethernet52": { + "index": "50,50,50,50", + "lanes": "196,197,198,199", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp50"], + "2x50G[25G,10G]": ["etp50a", "etp50b"] + } + }, + "Ethernet56": { + "index": "51,51,51,51", + "lanes": "200,201,202,203", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp51"], + "2x50G[25G,10G]": ["etp51a", "etp51b"] + } + }, + "Ethernet60": { + "index": "52,52,52,52", + "lanes": "204,205,206,207", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["etp52"], + "2x50G[25G,10G]": ["etp52a", "etp52b"] + } + } + } +} diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/platform_asic b/device/mellanox/x86_64-nvidia_sn2201-r0/platform_asic new file mode 100644 index 000000000000..70c074885557 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/platform_asic @@ -0,0 +1 @@ +mellanox diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/platform_components.json b/device/mellanox/x86_64-nvidia_sn2201-r0/platform_components.json new file mode 100644 index 000000000000..e28c19087875 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/platform_components.json @@ -0,0 +1,12 @@ +{ + "chassis": { + "SN2201": { + "component": { + "ONIE": { }, + "SSD": { }, + "CPLD1": { }, + "CPLD2": { } + } + } + } +} diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/platform_reboot b/device/mellanox/x86_64-nvidia_sn2201-r0/platform_reboot similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4800-r0/platform_reboot rename to device/mellanox/x86_64-nvidia_sn2201-r0/platform_reboot diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/platform_wait b/device/mellanox/x86_64-nvidia_sn2201-r0/platform_wait new file mode 120000 index 000000000000..4b30bd429854 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/platform_wait @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/platform_wait \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/plugins/eeprom.py b/device/mellanox/x86_64-nvidia_sn2201-r0/plugins/eeprom.py similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4800-r0/plugins/eeprom.py rename to device/mellanox/x86_64-nvidia_sn2201-r0/plugins/eeprom.py diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/plugins/fanutil.py b/device/mellanox/x86_64-nvidia_sn2201-r0/plugins/fanutil.py new file mode 120000 index 000000000000..82ea06ef915f --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/plugins/fanutil.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/fanutil.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/plugins/psuutil.py b/device/mellanox/x86_64-nvidia_sn2201-r0/plugins/psuutil.py similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4800-r0/plugins/psuutil.py rename to device/mellanox/x86_64-nvidia_sn2201-r0/plugins/psuutil.py diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/plugins/sfplpmget.py b/device/mellanox/x86_64-nvidia_sn2201-r0/plugins/sfplpmget.py similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4800-r0/plugins/sfplpmget.py rename to device/mellanox/x86_64-nvidia_sn2201-r0/plugins/sfplpmget.py diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/plugins/sfplpmset.py b/device/mellanox/x86_64-nvidia_sn2201-r0/plugins/sfplpmset.py similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4800-r0/plugins/sfplpmset.py rename to device/mellanox/x86_64-nvidia_sn2201-r0/plugins/sfplpmset.py diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/plugins/sfpreset.py b/device/mellanox/x86_64-nvidia_sn2201-r0/plugins/sfpreset.py similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4800-r0/plugins/sfpreset.py rename to device/mellanox/x86_64-nvidia_sn2201-r0/plugins/sfpreset.py diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/plugins/sfputil.py b/device/mellanox/x86_64-nvidia_sn2201-r0/plugins/sfputil.py similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4800-r0/plugins/sfputil.py rename to device/mellanox/x86_64-nvidia_sn2201-r0/plugins/sfputil.py diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/plugins/thermalutil.py b/device/mellanox/x86_64-nvidia_sn2201-r0/plugins/thermalutil.py new file mode 120000 index 000000000000..cef21ffacccc --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/plugins/thermalutil.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/thermalutil.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/pmon_daemon_control.json b/device/mellanox/x86_64-nvidia_sn2201-r0/pmon_daemon_control.json similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4800-r0/pmon_daemon_control.json rename to device/mellanox/x86_64-nvidia_sn2201-r0/pmon_daemon_control.json diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/sensors.conf b/device/mellanox/x86_64-nvidia_sn2201-r0/sensors.conf new file mode 100644 index 000000000000..1c29cfd2d7b3 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/sensors.conf @@ -0,0 +1,160 @@ +################################################################################ +# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# Platform specific sensors config for SN2201 +################################################################################ + +# Fan Controller emc2305. +bus "i2c-7" "i2c-1-mux (chan_id 5)" + chip "emc2305-i2c-7-4d" + label fan1 "Chassis Fan Drawer-1" + label fan2 "Chassis Fan Drawer-2" + label fan3 "Chassis Fan Drawer-3" + label fan4 "Chassis Fan Drawer-4" + ignore fan5 + +# Temperature sensors +chip "coretemp-isa-0000" + label temp8 "Core 0" + label temp14 "Core 1" + +bus "i2c-2" "i2c-1-mux (chan_id 4)" + chip "mlxsw-i2c-*-48" + label temp1 "Ambient ASIC Temp" + ignore temp2 + ignore temp3 + ignore temp4 + ignore temp5 + ignore temp6 + ignore temp7 + ignore temp8 + ignore temp9 + ignore temp10 + ignore temp11 + ignore temp12 + ignore temp13 + ignore temp14 + ignore temp15 + ignore temp16 + ignore temp17 + ignore temp18 + ignore temp19 + ignore temp20 + ignore temp21 + ignore temp22 + ignore temp23 + ignore temp24 + ignore temp25 + ignore temp26 + ignore temp26 + ignore temp27 + ignore temp28 + ignore temp29 + ignore temp30 + ignore temp31 + ignore temp32 + ignore temp33 + ignore temp34 + ignore temp35 + ignore temp36 + ignore temp37 + ignore temp38 + ignore temp39 + ignore temp40 + ignore temp41 + ignore temp42 + ignore temp43 + ignore temp44 + ignore temp45 + ignore temp46 + ignore temp47 + ignore temp48 + ignore temp49 + +bus "i2c-2" "i2c-1-mux (chan_id 0)" + chip "lm75-i2c-*-4a" + label temp1 "Ambient Switch Board Temp" + +bus "i2c-2" "i2c-1-mux (chan_id 0)" + chip "lm75-i2c-*-4b" + label temp1 "Ambient Port side Temp" + +bus "i2c-7" "i2c-1-mux (chan_id 5)" + chip "lm75-i2c-*-49" + label temp1 "Ambient Fan side Temp" + +bus "i2c-8" "i2c-1-mux (chan_id 6)" + chip "lm75-i2c-*-4f" + label temp1 "Ambient CPU Board Temp" + +# Power controllers +bus "i2c-9" "i2c-1-mux (chan_id 7)" + chip "pmbus-i2c-*-40" + label curr1 "VR IC PSU 12V Rail Curr(in)" + label curr2 "ASIC 0.9V VCORE Rail Curr(out)" + label in1 "VR IC PSU 12V Rail" + label in2 "VR IC ASIC 0.9V VCORE Rail" + label power1 "VR IC PSU 12V Rail Pwr(in)" + label power2 "ASIC 0.9V VCORE Rail Pwr(out)" + ignore curr3 + ignore in3 + ignore power3 + label temp1 "VR IC Temp1" + +bus "i2c-2" "i2c-1-mux (chan_id 0)" + chip "ads1015-i2c-*-49" + label in0 "ASIC 1.8V Rail" + label in3 "MONITOR MB 12V" + compute in3 (7.2)*@, @/(7.2) + ignore in1 + ignore in2 + ignore in4 + ignore in5 + ignore in6 + ignore in7 + +bus "i2c-8" "i2c-1-mux (chan_id 6)" + chip "powr1014-i2c-8-37" + label in0 "MONITOR CPU Board V3P3" + label in1 "MONITOR CPU Board VR_VCC_1V15" + label in2 "MONITOR CPU Board VR_VNN_1V05" + label in3 "MONITOR CPU Board VR_VCCRAM_1V15" + label in4 "MONITOR CPU Board VR_VDDQ_1V20" + label in5 "MONITOR CPU Board V1P05" + label in6 "MONITOR CPU Board P2V5_VPP" + label in7 "MONITOR CPU Board P0V6_VTT_DIMM" + label in8 "MONITOR CPU Board V1P8" + label in9 "MONITOR CPU Board V1P24" + +# PSU PMBus sensors +bus "i2c-3" "i2c-1-mux (chan_id 1)" + chip "pmbus-i2c-3-58" + label in1 "PSU-1 220V Rail(in)" + label in2 "PSU-1 12V Rail(out)" + ignore in3 + label fan1 "PSU-1 Fan1" + label temp1 "PSU-1 Temp1" + label temp2 "PSU-1 Temp2" + label temp3 "PSU-1 Temp3" + label curr1 "PSU-1 220V Rail Curr(in)" + label curr2 "PSU-1 12V Rail Curr(out)" + ignore curr3 + label power1 "PSU-1 220V Rail Pwr(in)" + label power2 "PSU-1 12V Rail Pwr(out)" + ignore power3 + +bus "i2c-4" "i2c-1-mux (chan_id 2)" + chip "pmbus-i2c-4-58" + label in1 "PSU-2 220V Rail(in)" + label in2 "PSU-2 12V Rail(out)" + ignore in3 + label fan1 "PSU-2 Fan1" + label temp1 "PSU-2 Temp1" + label temp2 "PSU-2 Temp2" + label temp3 "PSU-2 Temp3" + label curr1 "PSU-2 220V Rail Curr(in)" + label curr2 "PSU-2 12V Rail Curr(out)" + ignore curr3 + label power1 "PSU-2 220V Rail Pwr(in)" + label power2 "PSU-2 12V Rail Pwr(out)" + ignore power3 diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/system_health_monitoring_config.json b/device/mellanox/x86_64-nvidia_sn2201-r0/system_health_monitoring_config.json similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4800-r0/system_health_monitoring_config.json rename to device/mellanox/x86_64-nvidia_sn2201-r0/system_health_monitoring_config.json diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/thermal_policy.json b/device/mellanox/x86_64-nvidia_sn2201-r0/thermal_policy.json similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4800-r0/thermal_policy.json rename to device/mellanox/x86_64-nvidia_sn2201-r0/thermal_policy.json diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/buffers.json.j2 b/device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/buffers.json.j2 similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/buffers.json.j2 rename to device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/buffers.json.j2 diff --git a/device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/buffers_defaults_objects.j2 b/device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/buffers_defaults_objects.j2 new file mode 120000 index 000000000000..33b6704f9902 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/buffers_defaults_objects.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_objects.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/buffers_defaults_t0.j2 b/device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/buffers_defaults_t0.j2 similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/buffers_defaults_t0.j2 rename to device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/buffers_defaults_t0.j2 diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/buffers_defaults_t1.j2 b/device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/buffers_defaults_t1.j2 similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/buffers_defaults_t1.j2 rename to device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/buffers_defaults_t1.j2 diff --git a/device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/buffers_dynamic.json.j2 b/device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/buffers_dynamic.json.j2 new file mode 120000 index 000000000000..8c4117c66214 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/buffers_dynamic.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/hwsku.json b/device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/hwsku.json similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/hwsku.json rename to device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/hwsku.json diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/pg_profile_lookup.ini b/device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/pg_profile_lookup.ini similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/pg_profile_lookup.ini rename to device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/pg_profile_lookup.ini diff --git a/device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/port_config.ini b/device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/port_config.ini new file mode 100644 index 000000000000..2978b24428cd --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/port_config.ini @@ -0,0 +1,17 @@ +## +## Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## +# name lanes alias index diff --git a/device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/qos.json.j2 b/device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/qos.json.j2 new file mode 120000 index 000000000000..eccf286dc879 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/qos.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/sai.profile b/device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/sai.profile similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4800-r0/ACS-MSN4800/sai.profile rename to device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/sai.profile diff --git a/device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/sai_4800.xml b/device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/sai_4800.xml new file mode 100644 index 000000000000..3ac8606ac2f0 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/ACS-SN4800/sai_4800.xml @@ -0,0 +1,32 @@ + + + + + + + 00:02:03:04:05:00 + + + 0 + + + + + + + diff --git a/device/mellanox/x86_64-nvidia_sn4800-r0/default_sku b/device/mellanox/x86_64-nvidia_sn4800-r0/default_sku new file mode 100644 index 000000000000..50dfa0dc6ddf --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/default_sku @@ -0,0 +1 @@ +ACS-SN4800 t1 diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/pcie.yaml b/device/mellanox/x86_64-nvidia_sn4800-r0/pcie.yaml similarity index 88% rename from device/mellanox/x86_64-mlnx_msn4800-r0/pcie.yaml rename to device/mellanox/x86_64-nvidia_sn4800-r0/pcie.yaml index 15567004fb9d..89c452033b99 100644 --- a/device/mellanox/x86_64-mlnx_msn4800-r0/pcie.yaml +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/pcie.yaml @@ -1,3 +1,19 @@ +# +# Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# - bus: '00' dev: '00' fn: '0' diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/platform.json b/device/mellanox/x86_64-nvidia_sn4800-r0/platform.json similarity index 99% rename from device/mellanox/x86_64-mlnx_msn4800-r0/platform.json rename to device/mellanox/x86_64-nvidia_sn4800-r0/platform.json index 2b75ae2ab775..69dc1afcf386 100644 --- a/device/mellanox/x86_64-mlnx_msn4800-r0/platform.json +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/platform.json @@ -1,6 +1,6 @@ { "chassis": { - "name": "MSN4800", + "name": "SN4800", "components": [ { "name": "ONIE" diff --git a/device/mellanox/x86_64-nvidia_sn4800-r0/platform_asic b/device/mellanox/x86_64-nvidia_sn4800-r0/platform_asic new file mode 100644 index 000000000000..70c074885557 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/platform_asic @@ -0,0 +1 @@ +mellanox diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/platform_components.json b/device/mellanox/x86_64-nvidia_sn4800-r0/platform_components.json similarity index 92% rename from device/mellanox/x86_64-mlnx_msn4800-r0/platform_components.json rename to device/mellanox/x86_64-nvidia_sn4800-r0/platform_components.json index cdd08c656105..80736e44e317 100644 --- a/device/mellanox/x86_64-mlnx_msn4800-r0/platform_components.json +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/platform_components.json @@ -1,6 +1,6 @@ { "chassis": { - "MSN4800": { + "SN4800": { "component": { "ONIE": { }, "SSD": { }, diff --git a/device/mellanox/x86_64-nvidia_sn4800-r0/platform_reboot b/device/mellanox/x86_64-nvidia_sn4800-r0/platform_reboot new file mode 120000 index 000000000000..43c8ea567493 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/platform_reboot @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/platform_reboot \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/platform_wait b/device/mellanox/x86_64-nvidia_sn4800-r0/platform_wait similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4800-r0/platform_wait rename to device/mellanox/x86_64-nvidia_sn4800-r0/platform_wait diff --git a/device/mellanox/x86_64-nvidia_sn4800-r0/plugins/eeprom.py b/device/mellanox/x86_64-nvidia_sn4800-r0/plugins/eeprom.py new file mode 120000 index 000000000000..b4e2a6a61671 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/plugins/eeprom.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/eeprom.py \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn4800-r0/plugins/psuutil.py b/device/mellanox/x86_64-nvidia_sn4800-r0/plugins/psuutil.py new file mode 120000 index 000000000000..9f724238a8d5 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/plugins/psuutil.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/psuutil.py \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn4800-r0/plugins/sfplpmget.py b/device/mellanox/x86_64-nvidia_sn4800-r0/plugins/sfplpmget.py new file mode 120000 index 000000000000..2e84f435abd9 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/plugins/sfplpmget.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfplpmget.py \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn4800-r0/plugins/sfplpmset.py b/device/mellanox/x86_64-nvidia_sn4800-r0/plugins/sfplpmset.py new file mode 120000 index 000000000000..6a88bac30467 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/plugins/sfplpmset.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn4800-r0/plugins/sfpreset.py b/device/mellanox/x86_64-nvidia_sn4800-r0/plugins/sfpreset.py new file mode 120000 index 000000000000..fef2063e3496 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/plugins/sfpreset.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfpreset.py \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn4800-r0/plugins/sfputil.py b/device/mellanox/x86_64-nvidia_sn4800-r0/plugins/sfputil.py new file mode 120000 index 000000000000..45909b880fc9 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/plugins/sfputil.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfputil.py \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn4800-r0/pmon_daemon_control.json b/device/mellanox/x86_64-nvidia_sn4800-r0/pmon_daemon_control.json new file mode 120000 index 000000000000..435a2ce7c0ba --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/pmon_daemon_control.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/pmon_daemon_control.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4800-r0/sensors.conf b/device/mellanox/x86_64-nvidia_sn4800-r0/sensors.conf similarity index 94% rename from device/mellanox/x86_64-mlnx_msn4800-r0/sensors.conf rename to device/mellanox/x86_64-nvidia_sn4800-r0/sensors.conf index f4c981f5ecac..3cf718641a81 100644 --- a/device/mellanox/x86_64-mlnx_msn4800-r0/sensors.conf +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/sensors.conf @@ -141,16 +141,17 @@ bus "i2c-5" "i2c-1-mux (chan_id 3)" ignore curr4 bus "i2c-56" "i2c-1-mux (chan_id 6)" chip "mp2975-i2c-*-6b" - label in1 "PMIC-6 PSU 12V Rail (in1)" - label in2 "PMIC-6 PSU 12V Rail (in2)" - label in3 "PMIC-6 COMEX 1.8V Rail (out1)" - label in4 "PMIC-6 COMEX 1.05V Rail (out2)" - label temp1 "PMIC-6 Temp 1" - label temp2 "PMIC-6 Temp 2" - label power1 "PMIC-6 COMEX 1.8V Rail Pwr (out1)" - label power2 "PMIC-6 COMEX 1.05V Rail Pwr (out2)" - label curr1 "PMIC-6 COMEX 1.8V Rail Curr (out1)" - label curr2 "PMIC-6 COMEX 1.05V Rail Curr (out2)" + label in1 "PMIC-6 PSU 12V Rail (vin)" + ignore in2 + label in3 "PMIC-6 COMEX VCORE (out1)" + label in4 "PMIC-6 COMEX VCCSA (out2)" + label temp1 "PMIC-6 Temp" + label power1 "PMIC-6 COMEX Pwr (pin)" + label power2 "PMIC-6 COMEX VCORE Pwr (pout1)" + label power3 "PMIC-6 COMEX VCCSA Pwr (pout2)" + label curr1 "PMIC-6 COMEX Curr (iin)" + label curr2 "PMIC-6 COMEX VCORE Rail Curr (out1)" + label curr3 "PMIC-6 COMEX VCCSA Rail Curr (out2)" # Power supplies bus "i2c-4" "i2c-1-mux (chan_id 3)" diff --git a/device/mellanox/x86_64-nvidia_sn4800-r0/system_health_monitoring_config.json b/device/mellanox/x86_64-nvidia_sn4800-r0/system_health_monitoring_config.json new file mode 120000 index 000000000000..98df66c27ca5 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/system_health_monitoring_config.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/system_health_monitoring_config.json \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn4800-r0/thermal_policy.json b/device/mellanox/x86_64-nvidia_sn4800-r0/thermal_policy.json new file mode 120000 index 000000000000..5a25cd87f70c --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/thermal_policy.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/thermal_policy.json \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn4800_simx-r0/ACS-SN4800 b/device/mellanox/x86_64-nvidia_sn4800_simx-r0/ACS-SN4800 new file mode 120000 index 000000000000..9a7b8fc17cc8 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800_simx-r0/ACS-SN4800 @@ -0,0 +1 @@ +../x86_64-nvidia_sn4800-r0/ACS-SN4800 \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn4800_simx-r0/default_sku b/device/mellanox/x86_64-nvidia_sn4800_simx-r0/default_sku new file mode 120000 index 000000000000..2aee4b06cc35 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800_simx-r0/default_sku @@ -0,0 +1 @@ +../x86_64-nvidia_sn4800-r0/default_sku \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn4800_simx-r0/platform.json b/device/mellanox/x86_64-nvidia_sn4800_simx-r0/platform.json new file mode 120000 index 000000000000..4815676a68ae --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800_simx-r0/platform.json @@ -0,0 +1 @@ +../x86_64-nvidia_sn4800-r0/platform.json \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn4800_simx-r0/platform_asic b/device/mellanox/x86_64-nvidia_sn4800_simx-r0/platform_asic new file mode 100644 index 000000000000..70c074885557 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800_simx-r0/platform_asic @@ -0,0 +1 @@ +mellanox diff --git a/device/mellanox/x86_64-mlnx_msn4800_simx-r0/platform_reboot b/device/mellanox/x86_64-nvidia_sn4800_simx-r0/platform_reboot similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4800_simx-r0/platform_reboot rename to device/mellanox/x86_64-nvidia_sn4800_simx-r0/platform_reboot diff --git a/device/mellanox/x86_64-nvidia_sn4800_simx-r0/plugins b/device/mellanox/x86_64-nvidia_sn4800_simx-r0/plugins new file mode 120000 index 000000000000..568d16ab2902 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800_simx-r0/plugins @@ -0,0 +1 @@ +../x86_64-nvidia_sn4800-r0/plugins \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn4800_simx-r0/pmon_daemon_control.json b/device/mellanox/x86_64-nvidia_sn4800_simx-r0/pmon_daemon_control.json new file mode 120000 index 000000000000..d9fa54f8d2b9 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800_simx-r0/pmon_daemon_control.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700_simx-r0/pmon_daemon_control.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4800_simx-r0/syseeprom.hex b/device/mellanox/x86_64-nvidia_sn4800_simx-r0/syseeprom.hex similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4800_simx-r0/syseeprom.hex rename to device/mellanox/x86_64-nvidia_sn4800_simx-r0/syseeprom.hex diff --git a/device/mellanox/x86_64-mlnx_msn4800_simx-r0/system_health_monitoring_config.json b/device/mellanox/x86_64-nvidia_sn4800_simx-r0/system_health_monitoring_config.json similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4800_simx-r0/system_health_monitoring_config.json rename to device/mellanox/x86_64-nvidia_sn4800_simx-r0/system_health_monitoring_config.json diff --git a/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/buffers.json.j2 b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/buffers.json.j2 new file mode 120000 index 000000000000..add8bf8bb7c2 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/buffers.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/buffers_defaults_t0.j2 b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..011f30f51fd6 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/buffers_defaults_t0.j2 @@ -0,0 +1,128 @@ +{# + Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '67737959' %} +{% set ingress_lossy_pool_size = '67737959' %} +{% set egress_lossless_pool_size = '158229504' %} +{% set egress_lossy_pool_size = '67737959' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0, 32) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + {%- if dynamic_mode is not defined %} + "size": "{{ ingress_lossless_pool_size }}", + {%- endif %} + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + {%- if dynamic_mode is not defined %} + "size": "{{ ingress_lossy_pool_size }}", + {%- endif %} + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} + "size": "{{ egress_lossy_pool_size }}", + {%- endif %} + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "ingress_lossy_profile": { + "pool":"ingress_lossy_pool", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"9216", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"0", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{%- macro generate_profile_lists(port_names) %} + "BUFFER_PORT_INGRESS_PROFILE_LIST": { +{% for port in port_names.split(',') %} + "{{ port }}": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }{% if not loop.last %},{% endif %} + +{% endfor %} + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { +{% for port in port_names.split(',') %} + "{{ port }}": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }{% if not loop.last %},{% endif %} + +{% endfor %} + } +{%- endmacro %} + +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { +{% for port in port_names.split(',') %} + "{{ port }}|3-4": { + "profile" : "egress_lossless_profile" + }, +{% endfor %} +{% for port in port_names.split(',') %} + "{{ port }}|0-2": { + "profile" : "q_lossy_profile" + }, +{% endfor %} +{% for port in port_names.split(',') %} + "{{ port }}|5-6": { + "profile" : "q_lossy_profile" + }{% if not loop.last %},{% endif %} + +{% endfor %} + } +{%- endmacro %} + + diff --git a/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/buffers_defaults_t1.j2 b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..ba44cdcbc500 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/buffers_defaults_t1.j2 @@ -0,0 +1,128 @@ +{# + Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '52161690' %} +{% set ingress_lossy_pool_size = '52161690' %} +{% set egress_lossless_pool_size = '158229504' %} +{% set egress_lossy_pool_size = '52161690' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0, 32) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + {%- if dynamic_mode is not defined %} + "size": "{{ ingress_lossless_pool_size }}", + {%- endif %} + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + {%- if dynamic_mode is not defined %} + "size": "{{ ingress_lossy_pool_size }}", + {%- endif %} + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + {%- if dynamic_mode is not defined %} + "size": "{{ egress_lossy_pool_size }}", + {%- endif %} + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "ingress_lossy_profile": { + "pool":"ingress_lossy_pool", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"9216", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"0", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{%- macro generate_profile_lists(port_names) %} + "BUFFER_PORT_INGRESS_PROFILE_LIST": { +{% for port in port_names.split(',') %} + "{{ port }}": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }{% if not loop.last %},{% endif %} + +{% endfor %} + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { +{% for port in port_names.split(',') %} + "{{ port }}": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }{% if not loop.last %},{% endif %} + +{% endfor %} + } +{%- endmacro %} + +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { +{% for port in port_names.split(',') %} + "{{ port }}|3-4": { + "profile" : "egress_lossless_profile" + }, +{% endfor %} +{% for port in port_names.split(',') %} + "{{ port }}|0-2": { + "profile" : "q_lossy_profile" + }, +{% endfor %} +{% for port in port_names.split(',') %} + "{{ port }}|5-6": { + "profile" : "q_lossy_profile" + }{% if not loop.last %},{% endif %} + +{% endfor %} + } +{%- endmacro %} + + diff --git a/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/buffers_dynamic.json.j2 b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/buffers_dynamic.json.j2 new file mode 120000 index 000000000000..8c4117c66214 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/buffers_dynamic.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_dynamic.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/hwsku.json b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/hwsku.json new file mode 100644 index 000000000000..9eaac1e2cf86 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/hwsku.json @@ -0,0 +1,196 @@ +{ + "interfaces": { + "Ethernet0": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet8": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet16": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet24": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet32": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet40": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet48": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet56": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet64": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet72": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet80": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet88": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet96": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet104": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet112": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet120": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet128": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet136": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet144": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet152": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet160": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet168": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet176": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet184": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet192": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet200": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet208": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet216": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet224": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet232": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet240": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet248": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet256": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet264": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet272": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet280": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet288": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet296": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet304": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet312": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet320": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet328": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet336": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet344": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet352": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet360": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet368": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet376": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet384": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet392": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet400": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet408": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet416": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet424": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet432": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet440": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet448": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet456": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet464": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet472": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet480": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet488": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet496": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + }, + "Ethernet504": { + "default_brkout_mode": "1x800G[400G,200G,100G,50G,40G,25G,10G]" + } + } +} diff --git a/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/pg_profile_lookup.ini b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/pg_profile_lookup.ini new file mode 100644 index 000000000000..a2219ac7c034 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/pg_profile_lookup.ini @@ -0,0 +1,42 @@ +## +## Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 64512 19456 45056 0 + 25000 5m 67584 19456 48128 0 + 40000 5m 75776 19456 57344 0 + 50000 5m 82944 19456 63488 0 + 100000 5m 133120 19456 113664 0 + 200000 5m 150528 19456 131072 0 + 400000 5m 250880 19456 231424 0 + 800000 5m 304128 38912 257024 0 + 10000 40m 65536 19456 46080 0 + 25000 40m 71680 19456 52224 0 + 40000 40m 81920 19456 62464 0 + 50000 40m 89088 19456 69632 0 + 100000 40m 146432 19456 126976 0 + 200000 40m 177152 19456 157696 0 + 400000 40m 303104 19456 283648 0 + 800000 40m 410624 38912 362496 0 + 10000 300m 75776 19456 56320 0 + 25000 300m 96256 19456 76800 0 + 40000 300m 120832 19456 101376 0 + 50000 300m 138240 19456 118784 0 + 100000 300m 244736 19456 225280 0 + 200000 300m 374784 19456 355328 0 + 400000 300m 697344 19456 677888 0 + 800000 300m 1198080 38912 1150976 0 diff --git a/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/port_config.ini b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/port_config.ini new file mode 100644 index 000000000000..591fe2a7d428 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/port_config.ini @@ -0,0 +1,81 @@ +## +## Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## +# name lanes alias index +Ethernet0 0,1,2,3,4,5,6,7 etp1 1 +Ethernet8 8,9,10,11,12,13,14,15 etp2 2 +Ethernet16 16,17,18,19,20,21,22,23 etp3 3 +Ethernet24 24,25,26,27,28,29,30,31 etp4 4 +Ethernet32 32,33,34,35,36,37,38,39 etp5 5 +Ethernet40 40,41,42,43,44,45,46,47 etp6 6 +Ethernet48 48,49,50,51,52,53,54,55 etp7 7 +Ethernet56 56,57,58,59,60,61,62,63 etp8 8 +Ethernet64 64,65,66,67,68,69,70,71 etp9 9 +Ethernet72 72,73,74,75,76,77,78,79 etp10 10 +Ethernet80 80,81,82,83,84,85,86,87 etp11 11 +Ethernet88 88,89,90,91,92,93,94,95 etp12 12 +Ethernet96 96,97,98,99,100,101,102,103 etp13 13 +Ethernet104 104,105,106,107,108,109,110,111 etp14 14 +Ethernet112 112,113,114,115,116,117,118,119 etp15 15 +Ethernet120 120,121,122,123,124,125,126,127 etp16 16 +Ethernet128 128,129,130,131,132,133,134,135 etp17 17 +Ethernet136 136,137,138,139,140,141,142,143 etp18 18 +Ethernet144 144,145,146,147,148,149,150,151 etp19 19 +Ethernet152 152,153,154,155,156,157,158,159 etp20 20 +Ethernet160 160,161,162,163,164,165,166,167 etp21 21 +Ethernet168 168,169,170,171,172,173,174,175 etp22 22 +Ethernet176 176,177,178,179,180,181,182,183 etp23 23 +Ethernet184 184,185,186,187,188,189,190,191 etp24 24 +Ethernet192 192,193,194,195,196,197,198,199 etp25 25 +Ethernet200 200,201,202,203,204,205,206,207 etp26 26 +Ethernet208 208,209,210,211,212,213,214,215 etp27 27 +Ethernet216 216,217,218,219,220,221,222,223 etp28 28 +Ethernet224 224,225,226,227,228,229,230,231 etp29 29 +Ethernet232 232,233,234,235,236,237,238,239 etp30 30 +Ethernet240 240,241,242,243,244,245,246,247 etp31 31 +Ethernet248 248,249,250,251,252,253,254,255 etp32 32 +Ethernet256 256,257,258,259,260,261,262,263 etp33 33 +Ethernet264 264,265,266,267,268,269,270,271 etp34 34 +Ethernet272 272,273,274,275,276,277,278,279 etp35 35 +Ethernet280 280,281,282,283,284,285,286,287 etp36 36 +Ethernet288 288,289,290,291,292,293,294,295 etp37 37 +Ethernet296 296,297,298,299,300,301,302,303 etp38 38 +Ethernet304 304,305,306,307,308,309,310,311 etp39 39 +Ethernet312 312,313,314,315,316,317,318,319 etp40 40 +Ethernet320 320,321,322,323,324,325,326,327 etp41 41 +Ethernet328 328,329,330,331,332,333,334,335 etp42 42 +Ethernet336 336,337,338,339,340,341,342,343 etp43 43 +Ethernet344 344,345,346,347,348,349,350,351 etp44 44 +Ethernet352 352,353,354,355,356,357,358,359 etp45 45 +Ethernet360 360,361,362,363,364,365,366,367 etp46 46 +Ethernet368 368,369,370,371,372,373,374,375 etp47 47 +Ethernet376 376,377,378,379,380,381,382,383 etp48 48 +Ethernet384 384,385,386,387,388,389,390,391 etp49 49 +Ethernet392 392,393,394,395,396,397,398,399 etp50 50 +Ethernet400 400,401,402,403,404,405,406,407 etp51 51 +Ethernet408 408,409,410,411,412,413,414,415 etp52 52 +Ethernet416 416,417,418,419,420,421,422,423 etp53 53 +Ethernet424 424,425,426,427,428,429,430,431 etp54 54 +Ethernet432 432,433,434,435,436,437,438,439 etp55 55 +Ethernet440 440,441,442,443,444,445,446,447 etp56 56 +Ethernet448 448,449,450,451,452,453,454,455 etp57 57 +Ethernet456 456,457,458,459,460,461,462,463 etp58 58 +Ethernet464 464,465,466,467,468,469,470,471 etp59 59 +Ethernet472 472,473,474,475,476,477,478,479 etp60 60 +Ethernet480 480,481,482,483,484,485,486,487 etp61 61 +Ethernet488 488,489,490,491,492,493,494,495 etp62 62 +Ethernet496 496,497,498,499,500,501,502,503 etp63 63 +Ethernet504 504,505,506,507,508,509,510,511 etp64 64 diff --git a/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/qos.json.j2 b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/qos.json.j2 new file mode 120000 index 000000000000..eccf286dc879 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/qos.json.j2 @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2 \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/sai.profile b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/sai.profile new file mode 100644 index 000000000000..b37ca8c3ed0c --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/sai.profile @@ -0,0 +1,3 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/sai_5600.xml +SAI_DUMP_STORE_PATH=/var/log/mellanox/sdk-dumps +SAI_DUMP_STORE_AMOUNT=10 diff --git a/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/sai_5600.xml b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/sai_5600.xml new file mode 100644 index 000000000000..b9ef3af7a82a --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/ACS-SN5600/sai_5600.xml @@ -0,0 +1,495 @@ + + + + + + + 00:02:03:04:05:00 + + + 1 + + + 64 + + + + + 1 + 8 + 34 + + + 3 + + + 1536 + + + 5 + 8 + 35 + 3 + 1536 + + + 9 + 8 + 32 + 3 + 1536 + + + 13 + 8 + 33 + 3 + 1536 + + + 17 + 8 + 38 + 3 + 1536 + + + 21 + 8 + 39 + 3 + 1536 + + + 25 + 8 + 36 + 3 + 1536 + + + 29 + 8 + 37 + 3 + 1536 + + + 33 + 8 + 42 + 3 + 1536 + + + 37 + 8 + 43 + 3 + 1536 + + + 41 + 8 + 40 + 3 + 1536 + + + 45 + 8 + 41 + 3 + 1536 + + + 49 + 8 + 46 + 3 + 1536 + + + 53 + 8 + 47 + 3 + 1536 + + + 57 + 8 + 44 + 3 + 1536 + + + 61 + 8 + 45 + 3 + 1536 + + + 65 + 8 + 58 + 3 + 1536 + + + 69 + 8 + 59 + 3 + 1536 + + + 73 + 8 + 56 + 3 + 1536 + + + 77 + 8 + 57 + 3 + 1536 + + + 81 + 8 + 62 + 3 + 1536 + + + 85 + 8 + 63 + 3 + 1536 + + + 89 + 8 + 60 + 3 + 1536 + + + 93 + 8 + 61 + 3 + 1536 + + + 97 + 8 + 50 + 3 + 1536 + + + 101 + 8 + 51 + 3 + 1536 + + + 105 + 8 + 48 + + + 3 + + + 1536 + + + 109 + 8 + 49 + 3 + 1536 + + + 113 + 8 + 54 + 3 + 1536 + + + 117 + 8 + 55 + 3 + 1536 + + + 121 + 8 + 52 + 3 + 1536 + + + 125 + 8 + 53 + 3 + 1536 + + + 129 + 8 + 28 + 3 + 1536 + + + 133 + 8 + 29 + 3 + 1536 + + + 137 + 8 + 30 + 3 + 1536 + + + 141 + 8 + 31 + 3 + 1536 + + + 145 + 8 + 24 + 3 + 1536 + + + 149 + 8 + 25 + 3 + 1536 + + + 153 + 8 + 26 + 3 + 1536 + + + 157 + 8 + 27 + 3 + 1536 + + + 161 + 8 + 20 + 3 + 1536 + + + 165 + 8 + 21 + 3 + 1536 + + + 169 + 8 + 22 + 3 + 1536 + + + 173 + 8 + 23 + 3 + 1536 + + + 177 + 8 + 16 + 3 + 1536 + + + 181 + 8 + 17 + 3 + 1536 + + + 185 + 8 + 18 + 3 + 1536 + + + 189 + 8 + 19 + 3 + 1536 + + + 193 + 8 + 4 + 3 + 1536 + + + 197 + 8 + 5 + 3 + 1536 + + + 201 + 8 + 6 + 3 + 1536 + + + 205 + 8 + 7 + 3 + 1536 + + + 209 + 8 + 0 + 3 + 1536 + + + 213 + 8 + 1 + 3 + 1536 + + + 217 + 8 + 2 + 3 + 1536 + + + 221 + 8 + 3 + 3 + 1536 + + + 225 + 8 + 12 + 3 + 1536 + + + 229 + 8 + 13 + 3 + 1536 + + + 233 + 8 + 14 + + + 3 + + + 1536 + + + 237 + 8 + 15 + 3 + 1536 + + + 241 + 8 + 8 + 3 + 1536 + + + 245 + 8 + 9 + 3 + 1536 + + + 249 + 8 + 10 + 3 + 1536 + + + 253 + 8 + 11 + 3 + 1536 + + + + + diff --git a/device/mellanox/x86_64-nvidia_sn5600_simx-r0/default_sku b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/default_sku new file mode 100644 index 000000000000..38a760f3c747 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/default_sku @@ -0,0 +1 @@ +ACS-SN5600 t1 diff --git a/device/mellanox/x86_64-nvidia_sn5600_simx-r0/platform.json b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/platform.json new file mode 100644 index 000000000000..fdc689855c80 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/platform.json @@ -0,0 +1,1282 @@ +{ + "chassis": { + "name": "SN5600", + "components": [ + { + "name": "ONIE" + }, + { + "name": "SSD" + }, + { + "name": "BIOS" + }, + { + "name": "CPLD1" + }, + { + "name": "CPLD2" + }, + { + "name": "CPLD3" + }, + { + "name": "CPLD4" + }, + { + "name": "CPLD5" + }, + { + "name": "CPLD6" + } + ], + "fans": [], + "fan_drawers": [ + { + "name": "drawer1", + "fans": [ + { + "name": "fan1" + } + ] + }, + { + "name": "drawer2", + "fans": [ + { + "name": "fan2" + } + ] + }, + { + "name": "drawer3", + "fans": [ + { + "name": "fan3" + } + ] + }, + { + "name": "drawer4", + "fans": [ + { + "name": "fan4" + } + ] + } + ], + "psus": [ + { + "name": "PSU 1", + "fans": [ + { + "name": "psu1_fan1" + } + ], + "thermals": [ + { + "name": "PSU-1 Temp" + } + ] + }, + { + "name": "PSU 2", + "fans": [ + { + "name": "psu2_fan1" + } + ], + "thermals": [ + { + "name": "PSU-2 Temp" + } + ] + } + ], + "thermals": [ + { + "name": "ASIC" + }, + { + "name": "Ambient COMEX Temp" + }, + { + "name": "Ambient Fan Side Temp" + }, + { + "name": "Ambient Port Side Temp" + }, + { + "name": "CPU Core 0 Temp" + }, + { + "name": "CPU Core 1 Temp" + }, + { + "name": "CPU Core 2 Temp" + }, + { + "name": "CPU Core 3 Temp" + }, + { + "name": "CPU Pack Temp" + } + ], + "sfps": [ + { + "name": "sfp1", + "thermals": [ + { + "name": "xSFP module 1 Temp" + } + ] + }, + { + "name": "sfp2", + "thermals": [ + { + "name": "xSFP module 2 Temp" + } + ] + }, + { + "name": "sfp3", + "thermals": [ + { + "name": "xSFP module 3 Temp" + } + ] + }, + { + "name": "sfp4", + "thermals": [ + { + "name": "xSFP module 4 Temp" + } + ] + }, + { + "name": "sfp5", + "thermals": [ + { + "name": "xSFP module 5 Temp" + } + ] + }, + { + "name": "sfp6", + "thermals": [ + { + "name": "xSFP module 6 Temp" + } + ] + }, + { + "name": "sfp7", + "thermals": [ + { + "name": "xSFP module 7 Temp" + } + ] + }, + { + "name": "sfp8", + "thermals": [ + { + "name": "xSFP module 8 Temp" + } + ] + }, + { + "name": "sfp9", + "thermals": [ + { + "name": "xSFP module 9 Temp" + } + ] + }, + { + "name": "sfp10", + "thermals": [ + { + "name": "xSFP module 10 Temp" + } + ] + }, + { + "name": "sfp11", + "thermals": [ + { + "name": "xSFP module 11 Temp" + } + ] + }, + { + "name": "sfp12", + "thermals": [ + { + "name": "xSFP module 12 Temp" + } + ] + }, + { + "name": "sfp13", + "thermals": [ + { + "name": "xSFP module 13 Temp" + } + ] + }, + { + "name": "sfp14", + "thermals": [ + { + "name": "xSFP module 14 Temp" + } + ] + }, + { + "name": "sfp15", + "thermals": [ + { + "name": "xSFP module 15 Temp" + } + ] + }, + { + "name": "sfp16", + "thermals": [ + { + "name": "xSFP module 16 Temp" + } + ] + }, + { + "name": "sfp17", + "thermals": [ + { + "name": "xSFP module 17 Temp" + } + ] + }, + { + "name": "sfp18", + "thermals": [ + { + "name": "xSFP module 18 Temp" + } + ] + }, + { + "name": "sfp19", + "thermals": [ + { + "name": "xSFP module 19 Temp" + } + ] + }, + { + "name": "sfp20", + "thermals": [ + { + "name": "xSFP module 20 Temp" + } + ] + }, + { + "name": "sfp21", + "thermals": [ + { + "name": "xSFP module 21 Temp" + } + ] + }, + { + "name": "sfp22", + "thermals": [ + { + "name": "xSFP module 22 Temp" + } + ] + }, + { + "name": "sfp23", + "thermals": [ + { + "name": "xSFP module 23 Temp" + } + ] + }, + { + "name": "sfp24", + "thermals": [ + { + "name": "xSFP module 24 Temp" + } + ] + }, + { + "name": "sfp25", + "thermals": [ + { + "name": "xSFP module 25 Temp" + } + ] + }, + { + "name": "sfp26", + "thermals": [ + { + "name": "xSFP module 26 Temp" + } + ] + }, + { + "name": "sfp27", + "thermals": [ + { + "name": "xSFP module 27 Temp" + } + ] + }, + { + "name": "sfp28", + "thermals": [ + { + "name": "xSFP module 28 Temp" + } + ] + }, + { + "name": "sfp29", + "thermals": [ + { + "name": "xSFP module 29 Temp" + } + ] + }, + { + "name": "sfp30", + "thermals": [ + { + "name": "xSFP module 30 Temp" + } + ] + }, + { + "name": "sfp31", + "thermals": [ + { + "name": "xSFP module 31 Temp" + } + ] + }, + { + "name": "sfp32", + "thermals": [ + { + "name": "xSFP module 32 Temp" + } + ] + }, + { + "name": "sfp33", + "thermals": [ + { + "name": "xSFP module 33 Temp" + } + ] + }, + { + "name": "sfp34", + "thermals": [ + { + "name": "xSFP module 34 Temp" + } + ] + }, + { + "name": "sfp35", + "thermals": [ + { + "name": "xSFP module 35 Temp" + } + ] + }, + { + "name": "sfp36", + "thermals": [ + { + "name": "xSFP module 36 Temp" + } + ] + }, + { + "name": "sfp37", + "thermals": [ + { + "name": "xSFP module 37 Temp" + } + ] + }, + { + "name": "sfp38", + "thermals": [ + { + "name": "xSFP module 38 Temp" + } + ] + }, + { + "name": "sfp39", + "thermals": [ + { + "name": "xSFP module 39 Temp" + } + ] + }, + { + "name": "sfp40", + "thermals": [ + { + "name": "xSFP module 40 Temp" + } + ] + }, + { + "name": "sfp41", + "thermals": [ + { + "name": "xSFP module 41 Temp" + } + ] + }, + { + "name": "sfp42", + "thermals": [ + { + "name": "xSFP module 42 Temp" + } + ] + }, + { + "name": "sfp43", + "thermals": [ + { + "name": "xSFP module 43 Temp" + } + ] + }, + { + "name": "sfp44", + "thermals": [ + { + "name": "xSFP module 44 Temp" + } + ] + }, + { + "name": "sfp45", + "thermals": [ + { + "name": "xSFP module 45 Temp" + } + ] + }, + { + "name": "sfp46", + "thermals": [ + { + "name": "xSFP module 46 Temp" + } + ] + }, + { + "name": "sfp47", + "thermals": [ + { + "name": "xSFP module 47 Temp" + } + ] + }, + { + "name": "sfp48", + "thermals": [ + { + "name": "xSFP module 48 Temp" + } + ] + }, + { + "name": "sfp49", + "thermals": [ + { + "name": "xSFP module 49 Temp" + } + ] + }, + { + "name": "sfp50", + "thermals": [ + { + "name": "xSFP module 50 Temp" + } + ] + }, + { + "name": "sfp51", + "thermals": [ + { + "name": "xSFP module 51 Temp" + } + ] + }, + { + "name": "sfp52", + "thermals": [ + { + "name": "xSFP module 52 Temp" + } + ] + }, + { + "name": "sfp53", + "thermals": [ + { + "name": "xSFP module 53 Temp" + } + ] + }, + { + "name": "sfp54", + "thermals": [ + { + "name": "xSFP module 54 Temp" + } + ] + }, + { + "name": "sfp55", + "thermals": [ + { + "name": "xSFP module 55 Temp" + } + ] + }, + { + "name": "sfp56", + "thermals": [ + { + "name": "xSFP module 56 Temp" + } + ] + }, + { + "name": "sfp57", + "thermals": [ + { + "name": "xSFP module 57 Temp" + } + ] + }, + { + "name": "sfp58", + "thermals": [ + { + "name": "xSFP module 58 Temp" + } + ] + }, + { + "name": "sfp59", + "thermals": [ + { + "name": "xSFP module 59 Temp" + } + ] + }, + { + "name": "sfp60", + "thermals": [ + { + "name": "xSFP module 60 Temp" + } + ] + }, + { + "name": "sfp61", + "thermals": [ + { + "name": "xSFP module 61 Temp" + } + ] + }, + { + "name": "sfp62", + "thermals": [ + { + "name": "xSFP module 62 Temp" + } + ] + }, + { + "name": "sfp63", + "thermals": [ + { + "name": "xSFP module 63 Temp" + } + ] + }, + { + "name": "sfp64", + "thermals": [ + { + "name": "xSFP module 64 Temp" + } + ] + } + ] + }, + "interfaces": { + "Ethernet0": { + "index": "1,1,1,1,1,1,1,1", + "lanes": "0,1,2,3,4,5,6,7", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp1"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp1a", "etp1b"], + "4x200G[100G,50G,25G,10G]": ["etp1a", "etp1b", "etp1c", "etp1d"], + "8x100G[50G,25G,10G]": ["etp1a", "etp1b", "etp1c", "etp1d", "etp1e", "etp1f", "etp1g", "etp1h"] + } + }, + "Ethernet8": { + "index": "2,2,2,2,2,2,2,2", + "lanes": "8,9,10,11,12,13,14,15", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp2"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp2a", "etp2b"], + "4x200G[100G,50G,25G,10G]": ["etp2a", "etp2b", "etp2c", "etp2d"], + "8x100G[50G,25G,10G]": ["etp2a", "etp2b", "etp2c", "etp2d", "etp2e", "etp2f", "etp2g", "etp2h"] + } + }, + "Ethernet16": { + "index": "3,3,3,3,3,3,3,3", + "lanes": "16,17,18,19,20,21,22,23", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp3"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp3a", "etp3b"], + "4x200G[100G,50G,25G,10G]": ["etp3a", "etp3b", "etp3c", "etp3d"], + "8x100G[50G,25G,10G]": ["etp3a", "etp3b", "etp3c", "etp3d", "etp3e", "etp3f", "etp3g", "etp3h"] + } + }, + "Ethernet24": { + "index": "4,4,4,4,4,4,4,4", + "lanes": "24,25,26,27,28,29,30,31", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp4"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp4a", "etp4b"], + "4x200G[100G,50G,25G,10G]": ["etp4a", "etp4b", "etp4c", "etp4d"], + "8x100G[50G,25G,10G]": ["etp4a", "etp4b", "etp4c", "etp4d", "etp4e", "etp4f", "etp4g", "etp4h"] + } + }, + "Ethernet32": { + "index": "5,5,5,5,5,5,5,5", + "lanes": "32,33,34,35,36,37,38,39", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp5"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp5a", "etp5b"], + "4x200G[100G,50G,25G,10G]": ["etp5a", "etp5b", "etp5c", "etp5d"], + "8x100G[50G,25G,10G]": ["etp5a", "etp5b", "etp5c", "etp5d", "etp5e", "etp5f", "etp5g", "etp5h"] + } + }, + "Ethernet40": { + "index": "6,6,6,6,6,6,6,6", + "lanes": "40,41,42,43,44,45,46,47", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp6"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp6a", "etp6b"], + "4x200G[100G,50G,25G,10G]": ["etp6a", "etp6b", "etp6c", "etp6d"], + "8x100G[50G,25G,10G]": ["etp6a", "etp6b", "etp6c", "etp6d", "etp6e", "etp6f", "etp6g", "etp6h"] + } + }, + "Ethernet48": { + "index": "7,7,7,7,7,7,7,7", + "lanes": "48,49,50,51,52,53,54,55", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp7"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp7a", "etp7b"], + "4x200G[100G,50G,25G,10G]": ["etp7a", "etp7b", "etp7c", "etp7d"], + "8x100G[50G,25G,10G]": ["etp7a", "etp7b", "etp7c", "etp7d", "etp7e", "etp7f", "etp7g", "etp7h"] + } + }, + "Ethernet56": { + "index": "8,8,8,8,8,8,8,8", + "lanes": "56,57,58,59,60,61,62,63", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp8"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp8a", "etp8b"], + "4x200G[100G,50G,25G,10G]": ["etp8a", "etp8b", "etp8c", "etp8d"], + "8x100G[50G,25G,10G]": ["etp8a", "etp8b", "etp8c", "etp8d", "etp8e", "etp8f", "etp8g", "etp8h"] + } + }, + "Ethernet64": { + "index": "9,9,9,9,9,9,9,9", + "lanes": "64,65,66,67,68,69,70,71", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp9"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp9a", "etp9b"], + "4x200G[100G,50G,25G,10G]": ["etp9a", "etp9b", "etp9c", "etp9d"], + "8x100G[50G,25G,10G]": ["etp9a", "etp9b", "etp9c", "etp9d", "etp9e", "etp9f", "etp9g", "etp9h"] + } + }, + "Ethernet72": { + "index": "10,10,10,10,10,10,10,10", + "lanes": "72,73,74,75,76,77,78,79", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp10"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp10a", "etp10b"], + "4x200G[100G,50G,25G,10G]": ["etp10a", "etp10b", "etp10c", "etp10d"], + "8x100G[50G,25G,10G]": ["etp10a", "etp10b", "etp10c", "etp10d", "etp10e", "etp10f", "etp10g", "etp10h"] + } + }, + "Ethernet80": { + "index": "11,11,11,11,11,11,11,11", + "lanes": "80,81,82,83,84,85,86,87", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp11"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp11a", "etp11b"], + "4x200G[100G,50G,25G,10G]": ["etp11a", "etp11b", "etp11c", "etp11d"], + "8x100G[50G,25G,10G]": ["etp11a", "etp11b", "etp11c", "etp11d", "etp11e", "etp11f", "etp11g", "etp11h"] + } + }, + "Ethernet88": { + "index": "12,12,12,12,12,12,12,12", + "lanes": "88,89,90,91,92,93,94,95", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp12"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp12a", "etp12b"], + "4x200G[100G,50G,25G,10G]": ["etp12a", "etp12b", "etp12c", "etp12d"], + "8x100G[50G,25G,10G]": ["etp12a", "etp12b", "etp12c", "etp12d", "etp12e", "etp12f", "etp12g", "etp12h"] + } + }, + "Ethernet96": { + "index": "13,13,13,13,13,13,13,13", + "lanes": "96,97,98,99,100,101,102,103", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp13"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp13a", "etp13b"], + "4x200G[100G,50G,25G,10G]": ["etp13a", "etp13b", "etp13c", "etp13d"], + "8x100G[50G,25G,10G]": ["etp13a", "etp13b", "etp13c", "etp13d", "etp13e", "etp13f", "etp13g", "etp13h"] + } + }, + "Ethernet104": { + "index": "14,14,14,14,14,14,14,14", + "lanes": "104,105,106,107,108,109,110,111", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp14"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp14a", "etp14b"], + "4x200G[100G,50G,25G,10G]": ["etp14a", "etp14b", "etp14c", "etp14d"], + "8x100G[50G,25G,10G]": ["etp14a", "etp14b", "etp14c", "etp14d", "etp14e", "etp14f", "etp14g", "etp14h"] + } + }, + "Ethernet112": { + "index": "15,15,15,15,15,15,15,15", + "lanes": "112,113,114,115,116,117,118,119", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp15"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp15a", "etp15b"], + "4x200G[100G,50G,25G,10G]": ["etp15a", "etp15b", "etp15c", "etp15d"], + "8x100G[50G,25G,10G]": ["etp15a", "etp15b", "etp15c", "etp15d", "etp15e", "etp15f", "etp15g", "etp15h"] + } + }, + "Ethernet120": { + "index": "16,16,16,16,16,16,16,16", + "lanes": "120,121,122,123,124,125,126,127", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp16"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp16a", "etp16b"], + "4x200G[100G,50G,25G,10G]": ["etp16a", "etp16b", "etp16c", "etp16d"], + "8x100G[50G,25G,10G]": ["etp16a", "etp16b", "etp16c", "etp16d", "etp16e", "etp16f", "etp16g", "etp16h"] + } + }, + "Ethernet128": { + "index": "17,17,17,17,17,17,17,17", + "lanes": "128,129,130,131,132,133,134,135", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp17"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp17a", "etp17b"], + "4x200G[100G,50G,25G,10G]": ["etp17a", "etp17b", "etp17c", "etp17d"], + "8x100G[50G,25G,10G]": ["etp17a", "etp17b", "etp17c", "etp17d", "etp17e", "etp17f", "etp17g", "etp17h"] + } + }, + "Ethernet136": { + "index": "18,18,18,18,18,18,18,18", + "lanes": "136,137,138,139,140,141,142,143", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp18"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp18a", "etp18b"], + "4x200G[100G,50G,25G,10G]": ["etp18a", "etp18b", "etp18c", "etp18d"], + "8x100G[50G,25G,10G]": ["etp18a", "etp18b", "etp18c", "etp18d", "etp18e", "etp18f", "etp18g", "etp18h"] + } + }, + "Ethernet144": { + "index": "19,19,19,19,19,19,19,19", + "lanes": "144,145,146,147,148,149,150,151", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp19"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp19a", "etp19b"], + "4x200G[100G,50G,25G,10G]": ["etp19a", "etp19b", "etp19c", "etp19d"], + "8x100G[50G,25G,10G]": ["etp19a", "etp19b", "etp19c", "etp19d", "etp19e", "etp19f", "etp19g", "etp19h"] + } + }, + "Ethernet152": { + "index": "20,20,20,20,20,20,20,20", + "lanes": "152,153,154,155,156,157,158,159", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp20"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp20a", "etp20b"], + "4x200G[100G,50G,25G,10G]": ["etp20a", "etp20b", "etp20c", "etp20d"], + "8x100G[50G,25G,10G]": ["etp20a", "etp20b", "etp20c", "etp20d", "etp20e", "etp20f", "etp20g", "etp20h"] + } + }, + "Ethernet160": { + "index": "21,21,21,21,21,21,21,21", + "lanes": "160,161,162,163,164,165,166,167", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp21"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp21a", "etp21b"], + "4x200G[100G,50G,25G,10G]": ["etp21a", "etp21b", "etp21c", "etp21d"], + "8x100G[50G,25G,10G]": ["etp21a", "etp21b", "etp21c", "etp21d", "etp21e", "etp21f", "etp21g", "etp21h"] + } + }, + "Ethernet168": { + "index": "22,22,22,22,22,22,22,22", + "lanes": "168,169,170,171,172,173,174,175", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp22"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp22a", "etp22b"], + "4x200G[100G,50G,25G,10G]": ["etp22a", "etp22b", "etp22c", "etp22d"], + "8x100G[50G,25G,10G]": ["etp22a", "etp22b", "etp22c", "etp22d", "etp22e", "etp22f", "etp22g", "etp22h"] + } + }, + "Ethernet176": { + "index": "23,23,23,23,23,23,23,23", + "lanes": "176,177,178,179,180,181,182,183", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp23"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp23a", "etp23b"], + "4x200G[100G,50G,25G,10G]": ["etp23a", "etp23b", "etp23c", "etp23d"], + "8x100G[50G,25G,10G]": ["etp23a", "etp23b", "etp23c", "etp23d", "etp23e", "etp23f", "etp23g", "etp23h"] + } + }, + "Ethernet184": { + "index": "24,24,24,24,24,24,24,24", + "lanes": "184,185,186,187,188,189,190,191", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp24"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp24a", "etp24b"], + "4x200G[100G,50G,25G,10G]": ["etp24a", "etp24b", "etp24c", "etp24d"], + "8x100G[50G,25G,10G]": ["etp24a", "etp24b", "etp24c", "etp24d", "etp24e", "etp24f", "etp24g", "etp24h"] + } + }, + "Ethernet192": { + "index": "25,25,25,25,25,25,25,25", + "lanes": "192,193,194,195,196,197,198,199", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp25"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp25a", "etp25b"], + "4x200G[100G,50G,25G,10G]": ["etp25a", "etp25b", "etp25c", "etp25d"], + "8x100G[50G,25G,10G]": ["etp25a", "etp25b", "etp25c", "etp25d", "etp25e", "etp25f", "etp25g", "etp25h"] + } + }, + "Ethernet200": { + "index": "26,26,26,26,26,26,26,26", + "lanes": "200,201,202,203,204,205,206,207", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp26"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp26a", "etp26b"], + "4x200G[100G,50G,25G,10G]": ["etp26a", "etp26b", "etp26c", "etp26d"], + "8x100G[50G,25G,10G]": ["etp26a", "etp26b", "etp26c", "etp26d", "etp26e", "etp26f", "etp26g", "etp26h"] + } + }, + "Ethernet208": { + "index": "27,27,27,27,27,27,27,27", + "lanes": "208,209,210,211,212,213,214,215", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp27"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp27a", "etp27b"], + "4x200G[100G,50G,25G,10G]": ["etp27a", "etp27b", "etp27c", "etp27d"], + "8x100G[50G,25G,10G]": ["etp27a", "etp27b", "etp27c", "etp27d", "etp27e", "etp27f", "etp27g", "etp27h"] + } + }, + "Ethernet216": { + "index": "28,28,28,28,28,28,28,28", + "lanes": "216,217,218,219,220,221,222,223", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp28"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp28a", "etp28b"], + "4x200G[100G,50G,25G,10G]": ["etp28a", "etp28b", "etp28c", "etp28d"], + "8x100G[50G,25G,10G]": ["etp28a", "etp28b", "etp28c", "etp28d", "etp28e", "etp28f", "etp28g", "etp28h"] + } + }, + "Ethernet224": { + "index": "29,29,29,29,29,29,29,29", + "lanes": "224,225,226,227,228,229,230,231", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp29"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp29a", "etp29b"], + "4x200G[100G,50G,25G,10G]": ["etp29a", "etp29b", "etp29c", "etp29d"], + "8x100G[50G,25G,10G]": ["etp29a", "etp29b", "etp29c", "etp29d", "etp29e", "etp29f", "etp29g", "etp29h"] + } + }, + "Ethernet232": { + "index": "30,30,30,30,30,30,30,30", + "lanes": "232,233,234,235,236,237,238,239", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp30"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp30a", "etp30b"], + "4x200G[100G,50G,25G,10G]": ["etp30a", "etp30b", "etp30c", "etp30d"], + "8x100G[50G,25G,10G]": ["etp30a", "etp30b", "etp30c", "etp30d", "etp30e", "etp30f", "etp30g", "etp30h"] + } + }, + "Ethernet240": { + "index": "31,31,31,31,31,31,31,31", + "lanes": "240,241,242,243,244,245,246,247", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp31"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp31a", "etp31b"], + "4x200G[100G,50G,25G,10G]": ["etp31a", "etp31b", "etp31c", "etp31d"], + "8x100G[50G,25G,10G]": ["etp31a", "etp31b", "etp31c", "etp31d", "etp31e", "etp31f", "etp31g", "etp31h"] + } + }, + "Ethernet248": { + "index": "32,32,32,32,32,32,32,32", + "lanes": "248,249,250,251,252,253,254,255", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp32"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp32a", "etp32b"], + "4x200G[100G,50G,25G,10G]": ["etp32a", "etp32b", "etp32c", "etp32d"], + "8x100G[50G,25G,10G]": ["etp32a", "etp32b", "etp32c", "etp32d", "etp32e", "etp32f", "etp32g", "etp32h"] + } + }, + "Ethernet256": { + "index": "33,33,33,33,33,33,33,33", + "lanes": "256,257,258,259,260,261,262,263", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp33"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp33a", "etp33b"], + "4x200G[100G,50G,25G,10G]": ["etp33a", "etp33b", "etp33c", "etp33d"], + "8x100G[50G,25G,10G]": ["etp33a", "etp33b", "etp33c", "etp33d", "etp33e", "etp33f", "etp33g", "etp33h"] + } + }, + "Ethernet264": { + "index": "34,34,34,34,34,34,34,34", + "lanes": "264,265,266,267,268,269,270,271", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp34"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp34a", "etp34b"], + "4x200G[100G,50G,25G,10G]": ["etp34a", "etp34b", "etp34c", "etp34d"], + "8x100G[50G,25G,10G]": ["etp34a", "etp34b", "etp34c", "etp34d", "etp34e", "etp34f", "etp34g", "etp34h"] + } + }, + "Ethernet272": { + "index": "35,35,35,35,35,35,35,35", + "lanes": "272,273,274,275,276,277,278,279", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp35"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp35a", "etp35b"], + "4x200G[100G,50G,25G,10G]": ["etp35a", "etp35b", "etp35c", "etp35d"], + "8x100G[50G,25G,10G]": ["etp35a", "etp35b", "etp35c", "etp35d", "etp35e", "etp35f", "etp35g", "etp35h"] + } + }, + "Ethernet280": { + "index": "36,36,36,36,36,36,36,36", + "lanes": "280,281,282,283,284,285,286,287", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp36"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp36a", "etp36b"], + "4x200G[100G,50G,25G,10G]": ["etp36a", "etp36b", "etp36c", "etp36d"], + "8x100G[50G,25G,10G]": ["etp36a", "etp36b", "etp36c", "etp36d", "etp36e", "etp36f", "etp36g", "etp36h"] + } + }, + "Ethernet288": { + "index": "37,37,37,37,37,37,37,37", + "lanes": "288,289,290,291,292,293,294,295", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp37"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp37a", "etp37b"], + "4x200G[100G,50G,25G,10G]": ["etp37a", "etp37b", "etp37c", "etp37d"], + "8x100G[50G,25G,10G]": ["etp37a", "etp37b", "etp37c", "etp37d", "etp37e", "etp37f", "etp37g", "etp37h"] + } + }, + "Ethernet296": { + "index": "38,38,38,38,38,38,38,38", + "lanes": "296,297,298,299,300,301,302,303", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp38"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp38a", "etp38b"], + "4x200G[100G,50G,25G,10G]": ["etp38a", "etp38b", "etp38c", "etp38d"], + "8x100G[50G,25G,10G]": ["etp38a", "etp38b", "etp38c", "etp38d", "etp38e", "etp38f", "etp38g", "etp38h"] + } + }, + "Ethernet304": { + "index": "39,39,39,39,39,39,39,39", + "lanes": "304,305,306,307,308,309,310,311", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp39"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp39a", "etp39b"], + "4x200G[100G,50G,25G,10G]": ["etp39a", "etp39b", "etp39c", "etp39d"], + "8x100G[50G,25G,10G]": ["etp39a", "etp39b", "etp39c", "etp39d", "etp39e", "etp39f", "etp39g", "etp39h"] + } + }, + "Ethernet312": { + "index": "40,40,40,40,40,40,40,40", + "lanes": "312,313,314,315,316,317,318,319", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp40"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp40a", "etp40b"], + "4x200G[100G,50G,25G,10G]": ["etp40a", "etp40b", "etp40c", "etp40d"], + "8x100G[50G,25G,10G]": ["etp40a", "etp40b", "etp40c", "etp40d", "etp40e", "etp40f", "etp40g", "etp40h"] + } + }, + "Ethernet320": { + "index": "41,41,41,41,41,41,41,41", + "lanes": "320,321,322,323,324,325,326,327", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp41"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp41a", "etp41b"], + "4x200G[100G,50G,25G,10G]": ["etp41a", "etp41b", "etp41c", "etp41d"], + "8x100G[50G,25G,10G]": ["etp41a", "etp41b", "etp41c", "etp41d", "etp41e", "etp41f", "etp41g", "etp41h"] + } + }, + "Ethernet328": { + "index": "42,42,42,42,42,42,42,42", + "lanes": "328,329,330,331,332,333,334,335", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp42"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp42a", "etp42b"], + "4x200G[100G,50G,25G,10G]": ["etp42a", "etp42b", "etp42c", "etp42d"], + "8x100G[50G,25G,10G]": ["etp42a", "etp42b", "etp42c", "etp42d", "etp42e", "etp42f", "etp42g", "etp42h"] + } + }, + "Ethernet336": { + "index": "43,43,43,43,43,43,43,43", + "lanes": "336,337,338,339,340,341,342,343", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp43"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp43a", "etp43b"], + "4x200G[100G,50G,25G,10G]": ["etp43a", "etp43b", "etp43c", "etp43d"], + "8x100G[50G,25G,10G]": ["etp43a", "etp43b", "etp43c", "etp43d", "etp43e", "etp43f", "etp43g", "etp43h"] + } + }, + "Ethernet344": { + "index": "44,44,44,44,44,44,44,44", + "lanes": "344,345,346,347,348,349,350,351", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp44"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp44a", "etp44b"], + "4x200G[100G,50G,25G,10G]": ["etp44a", "etp44b", "etp44c", "etp44d"], + "8x100G[50G,25G,10G]": ["etp44a", "etp44b", "etp44c", "etp44d", "etp44e", "etp44f", "etp44g", "etp44h"] + } + }, + "Ethernet352": { + "index": "45,45,45,45,45,45,45,45", + "lanes": "352,353,354,355,356,357,358,359", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp45"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp45a", "etp45b"], + "4x200G[100G,50G,25G,10G]": ["etp45a", "etp45b", "etp45c", "etp45d"], + "8x100G[50G,25G,10G]": ["etp45a", "etp45b", "etp45c", "etp45d", "etp45e", "etp45f", "etp45g", "etp45h"] + } + }, + "Ethernet360": { + "index": "46,46,46,46,46,46,46,46", + "lanes": "360,361,362,363,364,365,366,367", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp46"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp46a", "etp46b"], + "4x200G[100G,50G,25G,10G]": ["etp46a", "etp46b", "etp46c", "etp46d"], + "8x100G[50G,25G,10G]": ["etp46a", "etp46b", "etp46c", "etp46d", "etp46e", "etp46f", "etp46g", "etp46h"] + } + }, + "Ethernet368": { + "index": "47,47,47,47,47,47,47,47", + "lanes": "368,369,370,371,372,373,374,375", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp47"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp47a", "etp47b"], + "4x200G[100G,50G,25G,10G]": ["etp47a", "etp47b", "etp47c", "etp47d"], + "8x100G[50G,25G,10G]": ["etp47a", "etp47b", "etp47c", "etp47d", "etp47e", "etp47f", "etp47g", "etp47h"] + } + }, + "Ethernet376": { + "index": "48,48,48,48,48,48,48,48", + "lanes": "376,377,378,379,380,381,382,383", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp48"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp48a", "etp48b"], + "4x200G[100G,50G,25G,10G]": ["etp48a", "etp48b", "etp48c", "etp48d"], + "8x100G[50G,25G,10G]": ["etp48a", "etp48b", "etp48c", "etp48d", "etp48e", "etp48f", "etp48g", "etp48h"] + } + }, + "Ethernet384": { + "index": "49,49,49,49,49,49,49,49", + "lanes": "384,385,386,387,388,389,390,391", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp49"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp49a", "etp49b"], + "4x200G[100G,50G,25G,10G]": ["etp49a", "etp49b", "etp49c", "etp49d"], + "8x100G[50G,25G,10G]": ["etp49a", "etp49b", "etp49c", "etp49d", "etp49e", "etp49f", "etp49g", "etp49h"] + } + }, + "Ethernet392": { + "index": "50,50,50,50,50,50,50,50", + "lanes": "392,393,394,395,396,397,398,399", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp50"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp50a", "etp50b"], + "4x200G[100G,50G,25G,10G]": ["etp50a", "etp50b", "etp50c", "etp50d"], + "8x100G[50G,25G,10G]": ["etp50a", "etp50b", "etp50c", "etp50d", "etp50e", "etp50f", "etp50g", "etp50h"] + } + }, + "Ethernet400": { + "index": "51,51,51,51,51,51,51,51", + "lanes": "400,401,402,403,404,405,406,407", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp51"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp51a", "etp51b"], + "4x200G[100G,50G,25G,10G]": ["etp51a", "etp51b", "etp51c", "etp51d"], + "8x100G[50G,25G,10G]": ["etp51a", "etp51b", "etp51c", "etp51d", "etp51e", "etp51f", "etp51g", "etp51h"] + } + }, + "Ethernet408": { + "index": "52,52,52,52,52,52,52,52", + "lanes": "408,409,410,411,412,413,414,415", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp52"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp52a", "etp52b"], + "4x200G[100G,50G,25G,10G]": ["etp52a", "etp52b", "etp52c", "etp52d"], + "8x100G[50G,25G,10G]": ["etp52a", "etp52b", "etp52c", "etp52d", "etp52e", "etp52f", "etp52g", "etp52h"] + } + }, + "Ethernet416": { + "index": "53,53,53,53,53,53,53,53", + "lanes": "416,417,418,419,420,421,422,423", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp53"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp53a", "etp53b"], + "4x200G[100G,50G,25G,10G]": ["etp53a", "etp53b", "etp53c", "etp53d"], + "8x100G[50G,25G,10G]": ["etp53a", "etp53b", "etp53c", "etp53d", "etp53e", "etp53f", "etp53g", "etp53h"] + } + }, + "Ethernet424": { + "index": "54,54,54,54,54,54,54,54", + "lanes": "424,425,426,427,428,429,430,431", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp54"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp54a", "etp54b"], + "4x200G[100G,50G,25G,10G]": ["etp54a", "etp54b", "etp54c", "etp54d"], + "8x100G[50G,25G,10G]": ["etp54a", "etp54b", "etp54c", "etp54d", "etp54e", "etp54f", "etp54g", "etp54h"] + } + }, + "Ethernet432": { + "index": "55,55,55,55,55,55,55,55", + "lanes": "432,433,434,435,436,437,438,439", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp55"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp55a", "etp55b"], + "4x200G[100G,50G,25G,10G]": ["etp55a", "etp55b", "etp55c", "etp55d"], + "8x100G[50G,25G,10G]": ["etp55a", "etp55b", "etp55c", "etp55d", "etp55e", "etp55f", "etp55g", "etp55h"] + } + }, + "Ethernet440": { + "index": "56,56,56,56,56,56,56,56", + "lanes": "440,441,442,443,444,445,446,447", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp56"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp56a", "etp56b"], + "4x200G[100G,50G,25G,10G]": ["etp56a", "etp56b", "etp56c", "etp56d"], + "8x100G[50G,25G,10G]": ["etp56a", "etp56b", "etp56c", "etp56d", "etp56e", "etp56f", "etp56g", "etp56h"] + } + }, + "Ethernet448": { + "index": "57,57,57,57,57,57,57,57", + "lanes": "448,449,450,451,452,453,454,455", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp57"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp57a", "etp57b"], + "4x200G[100G,50G,25G,10G]": ["etp57a", "etp57b", "etp57c", "etp57d"], + "8x100G[50G,25G,10G]": ["etp57a", "etp57b", "etp57c", "etp57d", "etp57e", "etp57f", "etp57g", "etp57h"] + } + }, + "Ethernet456": { + "index": "58,58,58,58,58,58,58,58", + "lanes": "456,457,458,459,460,461,462,463", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp58"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp58a", "etp58b"], + "4x200G[100G,50G,25G,10G]": ["etp58a", "etp58b", "etp58c", "etp58d"], + "8x100G[50G,25G,10G]": ["etp58a", "etp58b", "etp58c", "etp58d", "etp58e", "etp58f", "etp58g", "etp58h"] + } + }, + "Ethernet464": { + "index": "59,59,59,59,59,59,59,59", + "lanes": "464,465,466,467,468,469,470,471", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp59"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp59a", "etp59b"], + "4x200G[100G,50G,25G,10G]": ["etp59a", "etp59b", "etp59c", "etp59d"], + "8x100G[50G,25G,10G]": ["etp59a", "etp59b", "etp59c", "etp59d", "etp59e", "etp59f", "etp59g", "etp59h"] + } + }, + "Ethernet472": { + "index": "60,60,60,60,60,60,60,60", + "lanes": "472,473,474,475,476,477,478,479", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp60"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp60a", "etp60b"], + "4x200G[100G,50G,25G,10G]": ["etp60a", "etp60b", "etp60c", "etp60d"], + "8x100G[50G,25G,10G]": ["etp60a", "etp60b", "etp60c", "etp60d", "etp60e", "etp60f", "etp60g", "etp60h"] + } + }, + "Ethernet480": { + "index": "61,61,61,61,61,61,61,61", + "lanes": "480,481,482,483,484,485,486,487", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp61"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp61a", "etp61b"], + "4x200G[100G,50G,25G,10G]": ["etp61a", "etp61b", "etp61c", "etp61d"], + "8x100G[50G,25G,10G]": ["etp61a", "etp61b", "etp61c", "etp61d", "etp61e", "etp61f", "etp61g", "etp61h"] + } + }, + "Ethernet488": { + "index": "62,62,62,62,62,62,62,62", + "lanes": "488,489,490,491,492,493,494,495", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp62"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp62a", "etp62b"], + "4x200G[100G,50G,25G,10G]": ["etp62a", "etp62b", "etp62c", "etp62d"], + "8x100G[50G,25G,10G]": ["etp62a", "etp62b", "etp62c", "etp62d", "etp62e", "etp62f", "etp62g", "etp62h"] + } + }, + "Ethernet496": { + "index": "63,63,63,63,63,63,63,63", + "lanes": "496,497,498,499,500,501,502,503", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp63"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp63a", "etp63b"], + "4x200G[100G,50G,25G,10G]": ["etp63a", "etp63b", "etp63c", "etp63d"], + "8x100G[50G,25G,10G]": ["etp63a", "etp63b", "etp63c", "etp63d", "etp63e", "etp63f", "etp63g", "etp63h"] + } + }, + "Ethernet504": { + "index": "64,64,64,64,64,64,64,64", + "lanes": "504,505,506,507,508,509,510,511", + "breakout_modes": { + "1x800G[400G,200G,100G,50G,40G,25G,10G]": ["etp64"], + "2x400G[200G,100G,50G,40G,25G,10G]": ["etp64a", "etp64b"], + "4x200G[100G,50G,25G,10G]": ["etp64a", "etp64b", "etp64c", "etp64d"], + "8x100G[50G,25G,10G]": ["etp64a", "etp64b", "etp64c", "etp64d", "etp64e", "etp64f", "etp64g", "etp64h"] + } + } + } +} diff --git a/device/mellanox/x86_64-nvidia_sn5600_simx-r0/platform_asic b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/platform_asic new file mode 100644 index 000000000000..70c074885557 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/platform_asic @@ -0,0 +1 @@ +mellanox diff --git a/device/mellanox/x86_64-nvidia_sn5600_simx-r0/platform_reboot b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/platform_reboot new file mode 120000 index 000000000000..dfaf53417665 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/platform_reboot @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700_simx-r0/platform_reboot \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn5600_simx-r0/plugins/eeprom.py b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/plugins/eeprom.py new file mode 120000 index 000000000000..b4e2a6a61671 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/plugins/eeprom.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/eeprom.py \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn5600_simx-r0/plugins/psuutil.py b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/plugins/psuutil.py new file mode 120000 index 000000000000..9f724238a8d5 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/plugins/psuutil.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/psuutil.py \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn5600_simx-r0/plugins/sfplpmget.py b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/plugins/sfplpmget.py new file mode 120000 index 000000000000..2e84f435abd9 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/plugins/sfplpmget.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfplpmget.py \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn5600_simx-r0/plugins/sfplpmset.py b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/plugins/sfplpmset.py new file mode 120000 index 000000000000..6a88bac30467 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/plugins/sfplpmset.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfplpmset.py \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn5600_simx-r0/plugins/sfpreset.py b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/plugins/sfpreset.py new file mode 120000 index 000000000000..fef2063e3496 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/plugins/sfpreset.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfpreset.py \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn5600_simx-r0/plugins/sfputil.py b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/plugins/sfputil.py new file mode 120000 index 000000000000..45909b880fc9 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/plugins/sfputil.py @@ -0,0 +1 @@ +../../x86_64-mlnx_msn2700-r0/plugins/sfputil.py \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4800_simx-r0/pmon_daemon_control.json b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/pmon_daemon_control.json similarity index 100% rename from device/mellanox/x86_64-mlnx_msn4800_simx-r0/pmon_daemon_control.json rename to device/mellanox/x86_64-nvidia_sn5600_simx-r0/pmon_daemon_control.json diff --git a/device/mellanox/x86_64-nvidia_sn5600_simx-r0/syseeprom.hex b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/syseeprom.hex new file mode 100644 index 000000000000..cfd9f961997f --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/syseeprom.hex @@ -0,0 +1,256 @@ +54 6c 76 49 6e 66 6f 00 01 01 ee 22 14 4d 53 4e +34 37 30 30 2d 57 53 32 46 4f 00 00 00 00 00 00 +00 23 18 4d 54 32 30 32 32 58 30 38 35 39 37 00 +00 00 00 00 00 00 00 00 00 00 00 24 06 1c 34 da +1d 42 00 25 13 30 37 2f 30 32 2f 32 30 32 30 20 +30 32 3a 33 38 3a 32 36 26 01 00 2a 02 00 fe fd +24 00 00 81 19 00 16 01 01 00 56 00 00 4d 4c 4e +58 02 01 0c 05 0e 02 10 06 12 07 00 00 00 00 00 +00 00 00 00 00 fd a4 00 00 81 19 00 92 00 03 01 +8a 00 00 4d 54 32 30 32 32 58 30 38 35 39 37 00 +00 00 00 00 00 00 00 00 00 00 00 4d 53 4e 34 37 +30 30 2d 57 53 32 46 4f 00 00 00 00 00 00 00 41 +37 00 00 00 82 a2 c4 4c 65 6f 70 61 72 64 20 45 +74 68 20 34 30 30 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 7a 00 00 00 12 5c 4d +53 4e 34 37 30 30 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 fd 24 00 00 81 +19 00 10 00 03 05 e8 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 fd 24 00 00 81 19 00 1e 00 11 02 af 00 00 0d +00 00 00 00 00 00 00 1c 34 da 1d 42 00 00 fe 1c +34 da 03 00 1d 42 00 fd 24 00 00 81 19 00 12 00 +01 06 7d 00 00 00 46 00 00 08 00 07 07 07 07 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 fd 14 00 +00 81 19 00 0e 00 02 07 99 00 00 30 00 20 00 00 +00 00 00 29 15 32 30 32 30 2e 31 31 2d 35 2e 33 +2e 30 30 30 35 2d 39 36 30 30 21 06 53 4e 35 36 +30 30 2b 06 4e 76 69 64 69 61 28 17 78 38 36 5f +36 34 2d 6e 76 69 64 69 61 5f 73 6e 35 36 30 30 +2d 72 30 fe 04 65 11 86 e0 32 30 2e 31 31 2d 35 +2e 33 2e 30 30 30 35 2d 39 36 30 30 21 06 53 4e +35 36 30 30 2b 06 4e 76 69 64 69 61 fe 04 7b d3 +21 17 8f b7 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 29 15 32 30 32 30 2e 31 31 2d 35 2e 33 2e 30 +30 30 35 2d 39 36 30 30 fe 04 12 38 c7 41 d3 2a +00 00 00 fe 04 4f b8 08 f0 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 diff --git a/device/mellanox/x86_64-nvidia_sn5600_simx-r0/system_health_monitoring_config.json b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/system_health_monitoring_config.json new file mode 120000 index 000000000000..42fe945344c9 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600_simx-r0/system_health_monitoring_config.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700_simx-r0/system_health_monitoring_config.json \ No newline at end of file diff --git a/device/mitac/x86_64-mitac_ly1200_b32h0_c3-r0/platform_asic b/device/mitac/x86_64-mitac_ly1200_b32h0_c3-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/mitac/x86_64-mitac_ly1200_b32h0_c3-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/buffers.json.j2 b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/buffers.json.j2 new file mode 100644 index 000000000000..6f9ed3c7f64b --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/buffers.json.j2 @@ -0,0 +1,137 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) %} + {%- set cable_len = [] %} + {%- for local_port in DEVICE_NEIGHBOR %} + {%- if local_port == port_name %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor_role = neighbor.type %} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role %} + {%- set roles1 = roles1 | lower %} + {%- set roles2 = roles2 | lower %} + {%- if roles1 in ports2cable %} + {%- if cable_len.append(ports2cable[roles1]) %}{% endif %} + {%- elif roles2 in ports2cable %} + {%- if cable_len.append(ports2cable[roles2]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else %} + {%- if switch_role.lower() == 'torrouter' %} + {%- for local_port in VLAN_MEMBER %} + {%- if local_port[1] == port_name %} + {%- set roles3 = switch_role + '_' + 'server' %} + {%- set roles3 = roles3 | lower %} + {%- if roles3 in ports2cable %} + {%- if cable_len.append(ports2cable[roles3]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- endif %} +{%- endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "34056960", + "type": "ingress", + "mode": "dynamic", + "xoff": "4185600" + }, + "lossy_pool": { + "size": "14595840", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"38816", + "size":"1518", + "dynamic_th":"1", + "xon_offset":"13440" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"23001600" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"23001600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/buffers_defaults_def_lossy.j2 b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/buffers_defaults_def_lossy.j2 new file mode 100644 index 000000000000..72a618f07f4c --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/buffers_defaults_def_lossy.j2 @@ -0,0 +1,38 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "BUFFER_POOL": { + "lossy_pool": { + "size": "46003200", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"23001600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|0-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/buffers_defaults_t1.j2 b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..6f9ed3c7f64b --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/buffers_defaults_t1.j2 @@ -0,0 +1,137 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) %} + {%- set cable_len = [] %} + {%- for local_port in DEVICE_NEIGHBOR %} + {%- if local_port == port_name %} + {%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %} + {%- set neighbor_role = neighbor.type %} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role %} + {%- set roles1 = roles1 | lower %} + {%- set roles2 = roles2 | lower %} + {%- if roles1 in ports2cable %} + {%- if cable_len.append(ports2cable[roles1]) %}{% endif %} + {%- elif roles2 in ports2cable %} + {%- if cable_len.append(ports2cable[roles2]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else %} + {%- if switch_role.lower() == 'torrouter' %} + {%- for local_port in VLAN_MEMBER %} + {%- if local_port[1] == port_name %} + {%- set roles3 = switch_role + '_' + 'server' %} + {%- set roles3 = roles3 | lower %} + {%- if roles3 in ports2cable %} + {%- if cable_len.append(ports2cable[roles3]) %}{% endif %} + {%- endif %} + {%- endif %} + {%- endfor %} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- else -%} + {{ default_cable }} + {%- endif %} + {%- endif %} +{%- endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "34056960", + "type": "ingress", + "mode": "dynamic", + "xoff": "4185600" + }, + "lossy_pool": { + "size": "14595840", + "type": "egress", + "mode": "dynamic", + "xoff": "0" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xoff":"38816", + "size":"1518", + "dynamic_th":"1", + "xon_offset":"13440" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"23001600" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"0", + "static_th":"23001600" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|lossy_pool]", + "size":"1518", + "dynamic_th":"2" + } + }, + "BUFFER_PG": { + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, + "BUFFER_QUEUE": { + "{{ port_names }}|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "{{ port_names }}|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "{{ port_names }}|5-7": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/config_32x100G_netberg-aurora-715.yaml b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/config_32x100G_netberg-aurora-715.yaml new file mode 100644 index 000000000000..346c61d82871 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/config_32x100G_netberg-aurora-715.yaml @@ -0,0 +1,397 @@ +ifcs: + options: + log_level: "info" +nodes: +- node_id: "0" + options: + sku: "configs/sku/innovium.55300" + netdev: + - auto_create: "no" + multi_interface: "yes" + buffer_management_mode: "api_driven" + max_lossless_tc: "2" + skip_pll_check: "false" + ilpm_enable: "1" + forward_profile: "IFCS_FORWARD_PROFILE_ID_PROFILE_E" + mac_clk: "750" + sys_clk: "1300" + ifc_clk: "675" + txring: + - txring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + - txring_id: "3" + desc_count: "1024" + prio: "1" + netdev: "true" + rxring: + - rxring_id: "0" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39" + - rxring_id: "1" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40" + - rxring_id: "2" + desc_count: "1024" + prio: "1" + netdev: "true" + queues: "2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 47" + - rxring_id: "3" + desc_count: "1024" + prio: "1" + queues: "42, 43, 44, 45, 46" + devports: + - id: "0" + sysport: "129" + type: "cpu" + - fec: "KRFEC" + id: "121" + lanes: "0:4" + serdes_group: "15" + speed: "100G" + sysport: "121" + type: "eth" + - fec: "KRFEC" + id: "125" + lanes: "4:4" + serdes_group: "15" + speed: "100G" + sysport: "125" + type: "eth" + - fec: "KRFEC" + id: "113" + lanes: "0:4" + serdes_group: "14" + speed: "100G" + sysport: "113" + type: "eth" + - fec: "KRFEC" + id: "117" + lanes: "4:4" + serdes_group: "14" + speed: "100G" + sysport: "117" + type: "eth" + - fec: "KRFEC" + id: "105" + lanes: "0:4" + serdes_group: "13" + speed: "100G" + sysport: "105" + type: "eth" + - fec: "KRFEC" + id: "109" + lanes: "4:4" + serdes_group: "13" + speed: "100G" + sysport: "109" + type: "eth" + - fec: "KRFEC" + id: "97" + lanes: "0:4" + serdes_group: "12" + speed: "100G" + sysport: "97" + type: "eth" + - fec: "KRFEC" + id: "101" + lanes: "4:4" + serdes_group: "12" + speed: "100G" + sysport: "101" + type: "eth" + - fec: "KRFEC" + id: "89" + lanes: "0:4" + serdes_group: "11" + speed: "100G" + sysport: "89" + type: "eth" + - fec: "KRFEC" + id: "93" + lanes: "4:4" + serdes_group: "11" + speed: "100G" + sysport: "93" + type: "eth" + - fec: "KRFEC" + id: "81" + lanes: "0:4" + serdes_group: "10" + speed: "100G" + sysport: "81" + type: "eth" + - fec: "KRFEC" + id: "85" + lanes: "4:4" + serdes_group: "10" + speed: "100G" + sysport: "85" + type: "eth" + - fec: "KRFEC" + id: "73" + lanes: "0:4" + serdes_group: "9" + speed: "100G" + sysport: "73" + type: "eth" + - fec: "KRFEC" + id: "77" + lanes: "4:4" + serdes_group: "9" + speed: "100G" + sysport: "77" + type: "eth" + - fec: "KRFEC" + id: "65" + lanes: "0:4" + serdes_group: "8" + speed: "100G" + sysport: "65" + type: "eth" + - fec: "KRFEC" + id: "69" + lanes: "4:4" + serdes_group: "8" + speed: "100G" + sysport: "69" + type: "eth" + - fec: "KRFEC" + id: "57" + lanes: "0:4" + serdes_group: "7" + speed: "100G" + sysport: "57" + type: "eth" + - fec: "KRFEC" + id: "61" + lanes: "4:4" + serdes_group: "7" + speed: "100G" + sysport: "61" + type: "eth" + - fec: "KRFEC" + id: "49" + lanes: "0:4" + serdes_group: "6" + speed: "100G" + sysport: "49" + type: "eth" + - fec: "KRFEC" + id: "53" + lanes: "4:4" + serdes_group: "6" + speed: "100G" + sysport: "53" + type: "eth" + - fec: "KRFEC" + id: "41" + lanes: "0:4" + serdes_group: "5" + speed: "100G" + sysport: "41" + type: "eth" + - fec: "KRFEC" + id: "45" + lanes: "4:4" + serdes_group: "5" + speed: "100G" + sysport: "45" + type: "eth" + - fec: "KRFEC" + id: "33" + lanes: "0:4" + serdes_group: "4" + speed: "100G" + sysport: "33" + type: "eth" + - fec: "KRFEC" + id: "37" + lanes: "4:4" + serdes_group: "4" + speed: "100G" + sysport: "37" + type: "eth" + - fec: "KRFEC" + id: "25" + lanes: "0:4" + serdes_group: "3" + speed: "100G" + sysport: "25" + type: "eth" + - fec: "KRFEC" + id: "29" + lanes: "4:4" + serdes_group: "3" + speed: "100G" + sysport: "29" + type: "eth" + - fec: "KRFEC" + id: "17" + lanes: "0:4" + serdes_group: "2" + speed: "100G" + sysport: "17" + type: "eth" + - fec: "KRFEC" + id: "21" + lanes: "4:4" + serdes_group: "2" + speed: "100G" + sysport: "21" + type: "eth" + - fec: "KRFEC" + id: "9" + lanes: "0:4" + serdes_group: "1" + speed: "100G" + sysport: "9" + type: "eth" + - fec: "KRFEC" + id: "13" + lanes: "4:4" + serdes_group: "1" + speed: "100G" + sysport: "13" + type: "eth" + - fec: "KRFEC" + id: "1" + lanes: "0:4" + serdes_group: "0" + speed: "100G" + sysport: "1" + type: "eth" + - fec: "KRFEC" + id: "5" + lanes: "4:4" + serdes_group: "0" + speed: "100G" + sysport: "5" + type: "eth" +# Aux ports to be enabled later +# - id: "33" +# fec: "NONE" +# lanes: "0:1" +# serdes_group: "16" +# speed: "10G" +# sysport: "33" +# type: "mgmt 0" +# - id: "34" +# fec: "NONE" +# lanes: "1:1" +# serdes_group: "16" +# speed: "10G" +# sysport: "34" +# type: "mgmt 1" + isg: + - id: "0" + tx_polarity: "00001010" + rx_polarity: "01001001" + lane_swap: "46750132" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "1" + tx_polarity: "00011111" + rx_polarity: "01101001" + lane_swap: "46752130" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "2" + tx_polarity: "00101000" + rx_polarity: "11110111" + lane_swap: "57462301" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "3" + tx_polarity: "00111101" + rx_polarity: "00101101" + lane_swap: "67542301" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "4" + tx_polarity: "01110110" + rx_polarity: "01111101" + lane_swap: "76543021" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "5" + tx_polarity: "00100100" + rx_polarity: "01101010" + lane_swap: "76542103" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "6" + tx_polarity: "11000011" + rx_polarity: "11110101" + lane_swap: "45672013" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "7" + tx_polarity: "10011101" + rx_polarity: "11111010" + lane_swap: "74562103" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "8" + tx_polarity: "01001000" + rx_polarity: "00100011" + lane_swap: "54672301" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "9" + tx_polarity: "11111111" + rx_polarity: "01110111" + lane_swap: "46750321" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "10" + tx_polarity: "10011110" + rx_polarity: "10110000" + lane_swap: "67542310" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "11" + tx_polarity: "01010010" + rx_polarity: "10101011" + lane_swap: "65741302" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "12" + tx_polarity: "11010110" + rx_polarity: "01101001" + lane_swap: "45760321" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "13" + tx_polarity: "01110111" + rx_polarity: "00101000" + lane_swap: "45670123" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "14" + tx_polarity: "11110110" + rx_polarity: "10111100" + lane_swap: "67542013" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + - id: "15" + tx_polarity: "01011011" + rx_polarity: "01101000" + lane_swap: "64572103" + pre1: "-3, -3, -3, -3, -3, -3, -3, -3" + main: "20, 20, 20, 20, 20, 20, 20, 20" + + diff --git a/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/innovium.55300 b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/innovium.55300 new file mode 100644 index 000000000000..59383ec30ec1 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/innovium.55300 @@ -0,0 +1,62 @@ +sku: innovium.55300 + +device_id: 0x1b59 + +# Hardware constraint information +hardware: + num_ibs: 2 + ib_active: 0, 1 + + ports_per_ib: 64, 64 + recirc_port_num: 64, 64 + cpu_port_num: 65 + cpu_port_ib: 0 + mgmt_port_num: 65, 66 + mgmt_port_ibs: 1, 1 + + pics_per_ib: 9, 9 + pic_ports_per_pic: 8 + max_serdes_speed: 25 + + num_shared_pics: 0 + + isg [0-7]: + ib: 0 + pic_id: [0-7] + + isg 8: + ib: 1 + pic_id: 7 + + isg 9: + ib: 1 + pic_id: 6 + + isg 10: + ib: 1 + pic_id: 5 + + isg 11: + ib: 1 + pic_id: 4 + + isg 12: + ib: 1 + pic_id: 3 + + isg 13: + ib: 1 + pic_id: 2 + + isg 14: + ib: 1 + pic_id: 1 + + isg 15: + ib: 1 + pic_id: 0 + + isg 16: + mode: 0:2 + ib: 1 + pic_id: 8 diff --git a/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/ivm.sai.config.yaml b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/ivm.sai.config.yaml new file mode 100644 index 000000000000..cac1cb8ebac6 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/ivm.sai.config.yaml @@ -0,0 +1,8 @@ +IFCS_INIT_FILE : "/usr/share/sonic/hwsku/config_32x100G_netberg-aurora-715.yaml" +IFCS_SKU_FILE : "/usr/share/sonic/hwsku/innovium.55300" +IFCS_INNO_CLI_PORT : "9999" +IFCS_TARGET : "device" +INNOVIUM_DIR : "/innovium" +PYTHONPATH : "$INNOVIUM_DIR:$INNOVIUM_DIR/cmds:$INNOVIUM_DIR/scripts:$INNOVIUM_DIR/test/:$INNOVIUM_DIR/test/utils:$INNOVIUM_DIR/utils:$INNOVIUM_DIR/pyctypes" +IVM_SAI_DATAPATH_CONFIG_FILE: "/usr/share/sonic/hwsku/ivm.sai.datapath.config.yaml" +IVM_SAI_PARAM_A0008: "64" diff --git a/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/ivm.sai.datapath.config.yaml b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/ivm.sai.datapath.config.yaml new file mode 100644 index 000000000000..ef4bc6d129ce --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/ivm.sai.datapath.config.yaml @@ -0,0 +1,9 @@ +ISAI_PARAM_P0_0_LS : "9216 9216" +ISAI_PARAM_P0_1_LS : "2850 2650" +ISAI_PARAM_P0_1_ALS : "290 90" +ISAI_PARAM_P1_0_LS : "3072 3072" +ISAI_PARAM_P1_0_LL : "6144 6144" +ISAI_PARAM_P1_1_LS : "2210 2010" +ISAI_PARAM_P1_1_LL : "1330 1330" +ISAI_PARAM_P1_1_ALS : "290 90" +ISAI_PARAM_P1_1_ALL : "50 50" diff --git a/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/pg_profile_lookup.ini b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/pg_profile_lookup.ini new file mode 100644 index 000000000000..adcb52ab2a29 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/pg_profile_lookup.ini @@ -0,0 +1,18 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 25000 5m 1518 0 15680 1 13440 + 50000 5m 1518 0 21248 1 13440 + 100000 5m 1518 0 34624 1 13440 + 400000 5m 1518 0 117536 1 13440 + 25000 40m 1518 0 16928 1 13440 + 50000 40m 1518 0 23392 1 13440 + 100000 40m 1518 0 38816 1 13440 + 400000 40m 1518 0 135520 1 13440 + 25000 100m 1518 0 18848 1 13440 + 50000 100m 1518 0 27264 1 13440 + 100000 100m 1518 0 46496 1 13440 + 400000 100m 1518 0 166688 1 13440 + 25000 300m 1518 0 25184 1 13440 + 50000 300m 1518 0 40128 1 13440 + 100000 300m 1518 0 72384 1 13440 + 400000 300m 1518 0 268640 1 13440 diff --git a/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/port_config.ini b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/port_config.ini new file mode 100644 index 000000000000..7cb58b4120c7 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/port_config.ini @@ -0,0 +1,33 @@ +# name lanes speed index mtu fec +Ethernet0 121,122,123,124 100000 0 9126 rs +Ethernet4 125,126,127,128 100000 1 9126 rs +Ethernet8 113,114,115,116 100000 2 9126 rs +Ethernet12 117,118,119,120 100000 3 9126 rs +Ethernet16 105,106,107,108 100000 4 9126 rs +Ethernet20 109,110,111,112 100000 5 9126 rs +Ethernet24 97,98,99,100 100000 6 9126 rs +Ethernet28 101,102,103,104 100000 7 9126 rs +Ethernet32 89,90,91,92 100000 8 9126 rs +Ethernet36 93,94,95,96 100000 9 9126 rs +Ethernet40 81,82,83,84 100000 10 9126 rs +Ethernet44 85,86,87,88 100000 11 9126 rs +Ethernet48 73,74,75,76 100000 12 9126 rs +Ethernet52 77,78,79,80 100000 13 9126 rs +Ethernet56 65,66,67,68 100000 14 9126 rs +Ethernet60 69,70,71,72 100000 15 9126 rs +Ethernet64 57,58,59,60 100000 16 9126 rs +Ethernet68 61,62,63,64 100000 17 9126 rs +Ethernet72 49,50,51,52 100000 18 9126 rs +Ethernet76 53,54,55,56 100000 19 9126 rs +Ethernet80 41,42,43,44 100000 20 9126 rs +Ethernet84 45,46,47,48 100000 21 9126 rs +Ethernet88 33,34,35,36 100000 22 9126 rs +Ethernet92 37,38,39,40 100000 23 9126 rs +Ethernet96 25,26,27,28 100000 24 9126 rs +Ethernet100 29,30,31,32 100000 25 9126 rs +Ethernet104 17,18,19,20 100000 26 9126 rs +Ethernet108 21,22,23,24 100000 27 9126 rs +Ethernet112 9,10,11,12 100000 28 9126 rs +Ethernet116 13,14,15,16 100000 29 9126 rs +Ethernet120 1,2,3,4 100000 30 9126 rs +Ethernet124 5,6,7,8 100000 31 9126 rs diff --git a/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/qos.json.j2 b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/qos.json.j2 new file mode 100644 index 000000000000..4b9748c7b594 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/qos.json.j2 @@ -0,0 +1,114 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "red_min_threshold":"50000" + } + } +} diff --git a/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/qos_defaults_def_lossy.j2 b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/qos_defaults_def_lossy.j2 new file mode 100644 index 000000000000..104d2d78de87 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/qos_defaults_def_lossy.j2 @@ -0,0 +1,118 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"0", + "4":"0", + "5":"0", + "6":"0", + "7":"0", + "8":"0", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]" + } + }, + "SCHEDULER": { + "scheduler.7": { + "type": "STRICT" + } + }, + "QUEUE": { + "{{ port_names }}|7": { + "scheduler": "[SCHEDULER|scheduler.7]" + } + } +} diff --git a/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/qos_defaults_t1.j2 b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/qos_defaults_t1.j2 new file mode 100644 index 000000000000..4b9748c7b594 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/qos_defaults_t1.j2 @@ -0,0 +1,114 @@ +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + + +{ + "TC_TO_QUEUE_MAP":{ + "AZURE":{ + "0":"0", + "1":"1", + "2":"2", + "3":"3", + "4":"4", + "5":"5", + "6":"6", + "7":"7" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "0" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"0", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "PORT_QOS_MAP": { + "{{ port_names }}": { + "tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]", + "tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]", + "dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]", + "pfc_enable": "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "red_min_threshold":"50000" + } + } +} diff --git a/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/sai.profile b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/sai.profile new file mode 100644 index 000000000000..aba4fc81fb17 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_715-r0/aurora-715/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/ivm.sai.config.yaml diff --git a/device/netberg/x86_64-netberg_aurora_715-r0/default_sku b/device/netberg/x86_64-netberg_aurora_715-r0/default_sku new file mode 100644 index 000000000000..4da2644eb78a --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_715-r0/default_sku @@ -0,0 +1 @@ +aurora-715 t1 diff --git a/device/netberg/x86_64-netberg_aurora_715-r0/installer.conf b/device/netberg/x86_64-netberg_aurora_715-r0/installer.conf new file mode 100644 index 000000000000..925a32fc0c3a --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_715-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 diff --git a/device/netberg/x86_64-netberg_aurora_715-r0/platform_asic b/device/netberg/x86_64-netberg_aurora_715-r0/platform_asic new file mode 100644 index 000000000000..84083a7415d9 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_715-r0/platform_asic @@ -0,0 +1 @@ +innovium diff --git a/device/netberg/x86_64-netberg_aurora_715-r0/platform_reboot b/device/netberg/x86_64-netberg_aurora_715-r0/platform_reboot new file mode 100755 index 000000000000..43a798cb4856 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_715-r0/platform_reboot @@ -0,0 +1,16 @@ +#!/bin/sh + +mr_reboot() { + + sudo rmmod x86-64-netberg-aurora-715 + sudo i2cset -y 0 0x30 0xa1 0 + +} + +if [ $# -eq 0 ] || [ $@ = "-f" ] || [ $@ = "--force" ] || [ $@ = "reboot" ]; then + mr_reboot +elif [ $@ = "-p" ] ; then + sudo halt +else + echo "unsupported option" +fi diff --git a/device/netberg/x86_64-netberg_aurora_715-r0/plugins/eeprom.py b/device/netberg/x86_64-netberg_aurora_715-r0/plugins/eeprom.py new file mode 100755 index 000000000000..4bee23113cc9 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_715-r0/plugins/eeprom.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +try: + from sonic_eeprom import eeprom_tlvinfo +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/0-0030/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/netberg/x86_64-netberg_aurora_715-r0/plugins/psuutil.py b/device/netberg/x86_64-netberg_aurora_715-r0/plugins/psuutil.py new file mode 100755 index 000000000000..49a359e1a1c1 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_715-r0/plugins/psuutil.py @@ -0,0 +1,95 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +ATTR_PATH = '/sys/class/hwmon/hwmon2/device/NBA715_POWER/' +MAX_PSUS = 2 + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + # Get sysfs attribute + + def get_attr_value(self, path): + + retval = 'ERR' + if not os.path.isfile(path): + return retval + + try: + with open(path, 'r') as file_d: + retval = file_d.read() + except IOError as error: + print("Unable to open ", path, " file !", str(error)) + + retval = retval.rstrip('\r\n') + return retval + + def get_num_psus(self): + """ + Retrieves the number of PSUs available on the device + :return: An integer, the number of PSUs available on the device + """ + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + attr_file = 'psu{}_good'.format(index) + status_path = ATTR_PATH + attr_file + try: + reg_file = open(status_path, 'r') + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + text = reg_file.read() + + if int(text) == 1: + status = 1 + + reg_file.close() + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + attr_file = 'psu{}_prnt'.format(index) + presence_path = ATTR_PATH + attr_file + try: + reg_file = open(presence_path, 'r') + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + text = reg_file.read() + + if int(text) == 1: + status = 1 + + reg_file.close() + + return status diff --git a/device/netberg/x86_64-netberg_aurora_715-r0/plugins/sfputil.py b/device/netberg/x86_64-netberg_aurora_715-r0/plugins/sfputil.py new file mode 100755 index 000000000000..8169955a0714 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_715-r0/plugins/sfputil.py @@ -0,0 +1,213 @@ +#!/usr/bin/env python + + +import time + +try: + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +ATTR_PATH = '/sys/class/hwmon/hwmon2/device/' + +SFP_GROUPS = { + 'SFP-G01': { + "type": "QSFP28", + 'number': 8, + 'parent': 'PCA9548_0x71_1', + 'channels': [0, 1, 2, 3, 4, 5, 6, 7], + 'driver': 'optoe1', + 'i2caddr': '0x50', + 'paths': ["/sys/bus/i2c/devices/9-0050", "/sys/bus/i2c/devices/10-0050", + "/sys/bus/i2c/devices/11-0050", "/sys/bus/i2c/devices/12-0050", + "/sys/bus/i2c/devices/13-0050", "/sys/bus/i2c/devices/14-0050", + "/sys/bus/i2c/devices/15-0050", "/sys/bus/i2c/devices/16-0050"], + 'status': 'NOTINST' + }, + 'SFP-G02': { + "type": "QSFP28", + 'number': 8, + 'parent': 'PCA9548_0x71_2', + 'channels': [0, 1, 2, 3, 4, 5, 6, 7], + 'driver': 'optoe1', + 'i2caddr': '0x50', + 'paths': ["/sys/bus/i2c/devices/17-0050", "/sys/bus/i2c/devices/18-0050", + "/sys/bus/i2c/devices/19-0050", "/sys/bus/i2c/devices/20-0050", + "/sys/bus/i2c/devices/21-0050", "/sys/bus/i2c/devices/22-0050", + "/sys/bus/i2c/devices/23-0050", "/sys/bus/i2c/devices/24-0050"], + 'status': 'NOTINST' + }, + 'SFP-G03': { + "type": "QSFP28", + 'number': 8, + 'parent': 'PCA9548_0x71_3', + 'channels': [0, 1, 2, 3, 4, 5, 6, 7], + 'driver': 'optoe1', + 'i2caddr': '0x50', + 'paths': ["/sys/bus/i2c/devices/25-0050", "/sys/bus/i2c/devices/26-0050", + "/sys/bus/i2c/devices/27-0050", "/sys/bus/i2c/devices/28-0050", + "/sys/bus/i2c/devices/29-0050", "/sys/bus/i2c/devices/30-0050", + "/sys/bus/i2c/devices/31-0050", "/sys/bus/i2c/devices/32-0050"], + 'status': 'NOTINST' + }, + 'SFP-G04': { + "type": "QSFP28", + 'number': 8, + 'parent': 'PCA9548_0x71_4', + 'channels': [0, 1, 2, 3, 4, 5, 6, 7], + 'driver': 'optoe1', + 'i2caddr': '0x50', + 'paths': ["/sys/bus/i2c/devices/33-0050", "/sys/bus/i2c/devices/34-0050", + "/sys/bus/i2c/devices/35-0050", "/sys/bus/i2c/devices/36-0050", + "/sys/bus/i2c/devices/37-0050", "/sys/bus/i2c/devices/38-0050", + "/sys/bus/i2c/devices/39-0050", "/sys/bus/i2c/devices/40-0050"], + 'status': 'NOTINST' + } +} + +QSFP_RESET_FILE = 'NBA715_QSFP/qsfp{}_reset' +QSFP_LOWPOWER_FILE = 'NBA715_QSFP/qsfp{}_low_power' +QSFP_PRESENT_FILE = 'NBA715_QSFP/qsfp{}_present' + + +class SfpUtil(SfpUtilBase): + """Platform specific SfpUtill class""" + + _port_start = 0 + _port_end = 31 + _port_in_block = 32 + _port_to_eeprom_mapping = {} + _global_port_pres_dict = {} + + def __init__(self): + eeprom_path = "{}/eeprom" + path_list = self.get_sfp_path() + for port_n in range(self._port_start, self._port_end + 1): + port_eeprom_path = eeprom_path.format(path_list[port_n]) + self._port_to_eeprom_mapping[port_n] = port_eeprom_path + + self.init_global_port_presence() + SfpUtilBase.__init__(self) + + def get_sfp_path(self): + paths = [] + for sfp_group in SFP_GROUPS: + paths += SFP_GROUPS[sfp_group]['paths'] + return paths + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = ATTR_PATH+QSFP_RESET_FILE.format(port_num+1) + try: + reg_file = open(path, 'w') + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + + reg_file.seek(0) + reg_file.write('1') + + reg_file.close() + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + path = ATTR_PATH+QSFP_LOWPOWER_FILE.format(port_num+1) + try: + reg_file = open(path, 'w') + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + + # the gpio pin is ACTIVE_HIGH + if lpmode is True: + val = "1" + else: + val = "0" + + # write value to gpio + reg_file.seek(0) + reg_file.write(val) + reg_file.close() + + return True + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = ATTR_PATH+QSFP_LOWPOWER_FILE.format(port_num+1) + try: + reg_file = open(path, 'r') + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + + text = reg_file.read() + reg_file.close() + + return int(text) == 1 + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = ATTR_PATH+QSFP_PRESENT_FILE.format(port_num+1) + try: + reg_file = open(path, 'r') + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + text = reg_file.read() + reg_file.close() + return int(text) == 1 + + def init_global_port_presence(self): + for port_num in range(self.port_start, (self.port_end + 1)): + presence = self.get_presence(port_num) + if presence: + self._global_port_pres_dict[port_num] = '1' + else: + self._global_port_pres_dict[port_num] = '0' + + def get_transceiver_change_event(self, timeout=0): + port_dict = {} + while True: + for port_num in range(self.port_start, (self.port_end + 1)): + presence = self.get_presence(port_num) + if(presence and self._global_port_pres_dict[port_num] == '0'): + self._global_port_pres_dict[port_num] = '1' + port_dict[port_num] = '1' + elif(not presence and + self._global_port_pres_dict[port_num] == '1'): + self._global_port_pres_dict[port_num] = '0' + port_dict[port_num] = '0' + + if len(port_dict) > 0: + return True, port_dict + + time.sleep(1) + + @property + def port_start(self): + return self._port_start + + @property + def port_end(self): + return self._port_end + + @property + def qsfp_ports(self): + return range(0, self._port_in_block + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping diff --git a/device/netberg/x86_64-netberg_aurora_715-r0/pmon_daemon_control.json b/device/netberg/x86_64-netberg_aurora_715-r0/pmon_daemon_control.json new file mode 100644 index 000000000000..44871c057e82 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_715-r0/pmon_daemon_control.json @@ -0,0 +1,4 @@ +{ + "skip_ledd": true, + "skip_thermalctld": true +} diff --git a/device/netberg/x86_64-netberg_aurora_715-r0/sensors.conf b/device/netberg/x86_64-netberg_aurora_715-r0/sensors.conf new file mode 100644 index 000000000000..b28b04f64312 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_715-r0/sensors.conf @@ -0,0 +1,3 @@ + + + diff --git a/device/netberg/x86_64-netberg_aurora_715-r0/topo.conf b/device/netberg/x86_64-netberg_aurora_715-r0/topo.conf new file mode 100644 index 000000000000..795ea43143eb --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_715-r0/topo.conf @@ -0,0 +1 @@ +t1 diff --git a/device/nokia/armhf-nokia_ixs7215_52x-r0/platform.json b/device/nokia/armhf-nokia_ixs7215_52x-r0/platform.json index d6a28d19b026..4f4585b1e4de 100644 --- a/device/nokia/armhf-nokia_ixs7215_52x-r0/platform.json +++ b/device/nokia/armhf-nokia_ixs7215_52x-r0/platform.json @@ -11,15 +11,28 @@ ], "fans": [ { - "name": "Fan1" + "name": "Fan1", + "status_led": { + "controllable": true, + "colors": ["red", "green"] + } }, { - "name": "Fan2" + "name": "Fan2", + "status_led": { + "controllable": true, + "colors": ["red", "green"] + } } - ], - "fan_drawers": [ + ], + "fan_drawers": [ { "name": "drawer1", + "status_led": { + "controllable": true, + "colors": ["red", "green"] + }, + "max_consumed_power": false, "fans": [ { "name": "Fan1" @@ -28,6 +41,11 @@ }, { "name": "drawer2", + "status_led": { + "controllable": true, + "colors": ["red", "green"] + }, + "max_consumed_power": false, "fans": [ { "name": "Fan2" @@ -35,192 +53,232 @@ ] } ], - "psus": [ + "psus": [ { - "name": "PSU1" + "name": "PSU1", + "status_led": { + "controllable": false + }, + "current": false, + "power": false, + "max_power": false, + "voltage_high_threshold": false, + "voltage_low_threshold": false, + "temperature": false }, { - "name": "PSU2" + "name": "PSU2", + "status_led": { + "controllable": false + }, + "current": false, + "power": false, + "max_power": false, + "voltage_high_threshold": false, + "voltage_low_threshold": false, + "temperature": false } ], "thermals": [ { - "name": "PCB PHY" + "name": "PCB PHY", + "controllable": false, + "low-threshold": false, + "low-crit-threshold": false, + "high-crit-threshold": false }, { - "name": "PCB MAC" + "name": "PCB MAC", + "controllable": false, + "low-threshold": false, + "low-crit-threshold": false, + "high-crit-threshold": false }, { - "name": "ADT7473-CPU" + "name": "ADT7473-CPU", + "controllable": false, + "low-threshold": false, + "low-crit-threshold": false }, { - "name": "ADT7473-LOC" + "name": "ADT7473-LOC", + "controllable": false, + "low-threshold": false, + "low-crit-threshold": false }, { - "name": "ADT7473-MAC" + "name": "ADT7473-MAC", + "controllable": false, + "low-threshold": false, + "low-crit-threshold": false }, { - "name": "CPU Core" + "name": "CPU Core", + "controllable": false, + "low-threshold": false, + "high-threshold": false, + "low-crit-threshold": false, + "high-crit-threshold": false } ], - "sfps": [ + "sfps": [ { "name": "Ethernet0" }, - { + { "name": "Ethernet1" }, - { + { "name": "Ethernet2" }, - { + { "name": "Ethernet3" }, - { + { "name": "Ethernet4" }, - { + { "name": "Ethernet5" }, - { + { "name": "Ethernet6" }, - { + { "name": "Ethernet7" }, - { + { "name": "Ethernet8" }, - { + { "name": "Ethernet9" }, - { + { "name": "Ethernet10" }, - { + { "name": "Ethernet11" }, - { + { "name": "Ethernet12" }, - { + { "name": "Ethernet13" }, - { + { "name": "Ethernet14" }, - { + { "name": "Ethernet15" }, - { + { "name": "Ethernet16" }, - { + { "name": "Ethernet17" }, - { + { "name": "Ethernet18" }, - { + { "name": "Ethernet19" }, - { + { "name": "Ethernet20" }, - { + { "name": "Ethernet21" }, - { + { "name": "Ethernet22" }, - { + { "name": "Ethernet23" }, - { + { "name": "Ethernet24" }, - { + { "name": "Ethernet25" }, - { + { "name": "Ethernet26" }, - { + { "name": "Ethernet27" }, - { + { "name": "Ethernet28" }, - { + { "name": "Ethernet29" }, - { + { "name": "Ethernet30" }, - { + { "name": "Ethernet31" }, - { + { "name": "Ethernet32" }, - { + { "name": "Ethernet33" }, - { + { "name": "Ethernet34" }, - { + { "name": "Ethernet35" }, - { + { "name": "Ethernet36" }, - { + { "name": "Ethernet37" }, - { + { "name": "Ethernet38" }, - { + { "name": "Ethernet39" }, - { + { "name": "Ethernet40" }, - { + { "name": "Ethernet41" }, - { + { "name": "Ethernet42" }, - { + { "name": "Ethernet43" }, - { + { "name": "Ethernet44" }, - { + { "name": "Ethernet45" }, - { + { "name": "Ethernet46" }, - { + { "name": "Ethernet47" }, - { + { "name": "Ethernet48" }, - { + { "name": "Ethernet49" }, - { + { "name": "Ethernet50" }, - { + { "name": "Ethernet51" } - ] + ] }, "interfaces": {} } diff --git a/device/nokia/armhf-nokia_ixs7215_52x-r0/platform_asic b/device/nokia/armhf-nokia_ixs7215_52x-r0/platform_asic new file mode 100644 index 000000000000..a554752878b7 --- /dev/null +++ b/device/nokia/armhf-nokia_ixs7215_52x-r0/platform_asic @@ -0,0 +1 @@ +marvell diff --git a/device/nokia/armhf-nokia_ixs7215_52x-r0/plugins/led_control.py b/device/nokia/armhf-nokia_ixs7215_52x-r0/plugins/led_control.py index 935343a84ce1..55d5c74808d0 100644 --- a/device/nokia/armhf-nokia_ixs7215_52x-r0/plugins/led_control.py +++ b/device/nokia/armhf-nokia_ixs7215_52x-r0/plugins/led_control.py @@ -60,8 +60,8 @@ def _set_i2c_register(self, reg_file, value): def _initSystemLed(self): # Front Panel System LEDs setting - oldfan = 0xf - oldpsu = 0xf + oldfan = 0xf # 0=amber, 1=green + oldpsu = 0xf # 0=amber, 1=green # Write sys led if smbus_present == 0: @@ -73,18 +73,19 @@ def _initSystemLed(self): bus.write_byte_data(DEVICE_ADDRESS, DEVICEREG, 0x02) DBG_PRINT(" System LED set O.K. ") + # Timer loop to monitor and set front panel Status, Fan, and PSU LEDs while True: - # Front Panel FAN Panel LED setting in register 0x08 + # Front Panel FAN Panel LED setting if (self.chassis.get_fan(0).get_status() == self.chassis.get_fan(1).get_status() == True): - if (os.path.isfile("/sys/class/gpio/fanLedAmber/value")): + if (os.path.isfile("/sys/class/gpio/fanLedGreen/value")): if oldfan != 0x1: self._set_i2c_register("/sys/class/gpio/fanLedAmber/value", 0) self._set_i2c_register("/sys/class/gpio/fanLedGreen/value", 1) oldfan = 0x1 else: - oldfan = 0xf + oldfan = 0xf else: - if (os.path.isfile("/sys/class/gpio/fanLedGreen/value")): + if (os.path.isfile("/sys/class/gpio/fanLedAmber/value")): if oldfan != 0x0: self._set_i2c_register("/sys/class/gpio/fanLedGreen/value", 0) self._set_i2c_register("/sys/class/gpio/fanLedAmber/value", 1) @@ -92,9 +93,9 @@ def _initSystemLed(self): else: oldfan = 0xf - # Front Panel PSU Panel LED setting in register 0x09 + # Front Panel PSU Panel LED setting if (self.chassis.get_psu(0).get_status() == self.chassis.get_psu(1).get_status() == True): - if (os.path.isfile("/sys/class/gpio/psuLedAmber/value")): + if (os.path.isfile("/sys/class/gpio/psuLedGreen/value")): if oldpsu != 0x1: self._set_i2c_register("/sys/class/gpio/psuLedAmber/value", 0) self._set_i2c_register("/sys/class/gpio/psuLedGreen/value", 1) @@ -102,13 +103,14 @@ def _initSystemLed(self): else: oldpsu = 0xf else: - if (os.path.isfile("/sys/class/gpio/psuLedGreen/value")): + if (os.path.isfile("/sys/class/gpio/psuLedAmber/value")): if oldpsu != 0x0: self._set_i2c_register("/sys/class/gpio/psuLedGreen/value", 0) self._set_i2c_register("/sys/class/gpio/psuLedAmber/value", 1) oldpsu = 0x0 else: oldpsu = 0xf + time.sleep(6) # Helper method to map SONiC port name to index diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/jr2cp-nokia-18x400g-config.bcm b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/jr2cp-nokia-18x400g-config.bcm new file mode 100644 index 000000000000..bbafccdc377e --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/jr2cp-nokia-18x400g-config.bcm @@ -0,0 +1,2054 @@ +appl_enable_intr_init.BCM8885X=1 +appl_enable_learn_and_limit_init.BCM8885X=0 +appl_enable_oam.BCM8885X=0 +appl_enable_oam_fwd_idx_wa_init.BCM8885X=0 +appl_enable_oam_stat_wa_init.BCM8885X=0 +dma_desc_aggregator_buff_size_kb.BCM8885X=100 +dma_desc_aggregator_chain_length_max.BCM8885X=1000 +dma_desc_aggregator_enable_specific_MDB_LPM.BCM8885X=1 +dma_desc_aggregator_timeout_usec.BCM8885X=1000 +dport_map_direct.BCM8885X=1 +sai_postinit_cmd_file=/usr/share/sonic/hwsku/sai_postinit_cmd.soc +dtm_flow_mapping_mode_region_64.BCM8885X=3 +dtm_flow_mapping_mode_region_65.BCM8885X=3 +dtm_flow_mapping_mode_region_66.BCM8885X=3 +dtm_flow_mapping_mode_region_67.BCM8885X=3 +dtm_flow_mapping_mode_region_68.BCM8885X=3 +dtm_flow_mapping_mode_region_69.BCM8885X=3 +dtm_flow_mapping_mode_region_70.BCM8885X=3 +dtm_flow_mapping_mode_region_71.BCM8885X=3 +dtm_flow_mapping_mode_region_72.BCM8885X=3 +dtm_flow_mapping_mode_region_73.BCM8885X=3 +dtm_flow_mapping_mode_region_74.BCM8885X=3 +dtm_flow_mapping_mode_region_75.BCM8885X=3 +dtm_flow_mapping_mode_region_76.BCM8885X=3 +dtm_flow_mapping_mode_region_77.BCM8885X=3 +dtm_flow_mapping_mode_region_78.BCM8885X=3 +dtm_flow_mapping_mode_region_79.BCM8885X=7 +dtm_flow_mapping_mode_region_80.BCM8885X=3 +dtm_flow_mapping_mode_region_81.BCM8885X=1 +dtm_flow_mapping_mode_region_82.BCM8885X=3 +dtm_flow_mapping_mode_region_83.BCM8885X=3 +dtm_flow_mapping_mode_region_84.BCM8885X=3 +dtm_flow_mapping_mode_region_85.BCM8885X=3 +dtm_flow_mapping_mode_region_86.BCM8885X=3 +dtm_flow_mapping_mode_region_87.BCM8885X=3 +dtm_flow_mapping_mode_region_88.BCM8885X=3 +dtm_flow_mapping_mode_region_89.BCM8885X=3 +dtm_flow_mapping_mode_region_90.BCM8885X=3 +dtm_flow_mapping_mode_region_91.BCM8885X=3 +dtm_flow_mapping_mode_region_92.BCM8885X=3 +dtm_flow_mapping_mode_region_93.BCM8885X=3 +dtm_flow_mapping_mode_region_94.BCM8885X=3 +dtm_flow_nof_remote_cores_region_1.BCM8885X=2 +dtm_flow_nof_remote_cores_region_10.BCM8885X=2 +dtm_flow_nof_remote_cores_region_11.BCM8885X=2 +dtm_flow_nof_remote_cores_region_12.BCM8885X=2 +dtm_flow_nof_remote_cores_region_13.BCM8885X=2 +dtm_flow_nof_remote_cores_region_14.BCM8885X=2 +dtm_flow_nof_remote_cores_region_15.BCM8885X=2 +dtm_flow_nof_remote_cores_region_16.BCM8885X=2 +dtm_flow_nof_remote_cores_region_17.BCM8885X=2 +dtm_flow_nof_remote_cores_region_18.BCM8885X=2 +dtm_flow_nof_remote_cores_region_19.BCM8885X=2 +dtm_flow_nof_remote_cores_region_2.BCM8885X=2 +dtm_flow_nof_remote_cores_region_20.BCM8885X=2 +dtm_flow_nof_remote_cores_region_21.BCM8885X=2 +dtm_flow_nof_remote_cores_region_22.BCM8885X=2 +dtm_flow_nof_remote_cores_region_23.BCM8885X=2 +dtm_flow_nof_remote_cores_region_24.BCM8885X=2 +dtm_flow_nof_remote_cores_region_25.BCM8885X=2 +dtm_flow_nof_remote_cores_region_26.BCM8885X=2 +dtm_flow_nof_remote_cores_region_27.BCM8885X=2 +dtm_flow_nof_remote_cores_region_28.BCM8885X=2 +dtm_flow_nof_remote_cores_region_29.BCM8885X=2 +dtm_flow_nof_remote_cores_region_3.BCM8885X=2 +dtm_flow_nof_remote_cores_region_30.BCM8885X=2 +dtm_flow_nof_remote_cores_region_31.BCM8885X=2 +dtm_flow_nof_remote_cores_region_32.BCM8885X=2 +dtm_flow_nof_remote_cores_region_33.BCM8885X=2 +dtm_flow_nof_remote_cores_region_34.BCM8885X=2 +dtm_flow_nof_remote_cores_region_35.BCM8885X=2 +dtm_flow_nof_remote_cores_region_36.BCM8885X=2 +dtm_flow_nof_remote_cores_region_37.BCM8885X=2 +dtm_flow_nof_remote_cores_region_38.BCM8885X=2 +dtm_flow_nof_remote_cores_region_39.BCM8885X=2 +dtm_flow_nof_remote_cores_region_4.BCM8885X=2 +dtm_flow_nof_remote_cores_region_40.BCM8885X=2 +dtm_flow_nof_remote_cores_region_41.BCM8885X=2 +dtm_flow_nof_remote_cores_region_42.BCM8885X=2 +dtm_flow_nof_remote_cores_region_43.BCM8885X=2 +dtm_flow_nof_remote_cores_region_44.BCM8885X=2 +dtm_flow_nof_remote_cores_region_45.BCM8885X=2 +dtm_flow_nof_remote_cores_region_46.BCM8885X=2 +dtm_flow_nof_remote_cores_region_47.BCM8885X=2 +dtm_flow_nof_remote_cores_region_48.BCM8885X=2 +dtm_flow_nof_remote_cores_region_49.BCM8885X=2 +dtm_flow_nof_remote_cores_region_5.BCM8885X=2 +dtm_flow_nof_remote_cores_region_50.BCM8885X=2 +dtm_flow_nof_remote_cores_region_51.BCM8885X=2 +dtm_flow_nof_remote_cores_region_52.BCM8885X=2 +dtm_flow_nof_remote_cores_region_53.BCM8885X=2 +dtm_flow_nof_remote_cores_region_54.BCM8885X=2 +dtm_flow_nof_remote_cores_region_55.BCM8885X=2 +dtm_flow_nof_remote_cores_region_56.BCM8885X=2 +dtm_flow_nof_remote_cores_region_57.BCM8885X=2 +dtm_flow_nof_remote_cores_region_58.BCM8885X=2 +dtm_flow_nof_remote_cores_region_59.BCM8885X=2 +dtm_flow_nof_remote_cores_region_6.BCM8885X=2 +dtm_flow_nof_remote_cores_region_60.BCM8885X=2 +dtm_flow_nof_remote_cores_region_7.BCM8885X=2 +dtm_flow_nof_remote_cores_region_8.BCM8885X=2 +dtm_flow_nof_remote_cores_region_9.BCM8885X=2 +dtm_flow_nof_remote_cores_region_73.BCM8869X=2 +dtm_flow_mapping_mode_region_73.BCM8869X=0 +dtm_flow_nof_remote_cores_region_74.BCM8869X=2 +dtm_flow_mapping_mode_region_74.BCM8869X=0 +dtm_flow_nof_remote_cores_region_75.BCM8869X=2 +dtm_flow_mapping_mode_region_75.BCM8869X=0 +ext_ram_enabled_bitmap.BCM8885X=3 +ext_ram_freq.BCM8885X=1200 +dram_temperature_threshold_restore_traffic.BCM8885X=89 +dram_temperature_threshold_power_down.BCM8885X=102 +dram_temperature_threshold_stop_traffic.BCM8885X=94 +dram_temperature_monitor_enable.BCM8885X=1 +fabric_connect_mode.BCM8885X=FE +ftmh_stacking_extension_size=0 +j2_ftmh_lb_key_extension_size=3 +j_ftmh_lb_key_extension_size=0 + + +lane_to_serdes_map_fabric_lane0.BCM8885X=rx0:tx0 +lane_to_serdes_map_fabric_lane1.BCM8885X=rx1:tx1 +lane_to_serdes_map_fabric_lane2.BCM8885X=rx2:tx3 +lane_to_serdes_map_fabric_lane3.BCM8885X=rx3:tx2 + +lane_to_serdes_map_fabric_lane4.BCM8885X=rx4:tx4 +lane_to_serdes_map_fabric_lane5.BCM8885X=rx5:tx7 +lane_to_serdes_map_fabric_lane6.BCM8885X=rx6:tx6 +lane_to_serdes_map_fabric_lane7.BCM8885X=rx7:tx5 + +lane_to_serdes_map_fabric_lane8.BCM8885X=rx8:tx8 +lane_to_serdes_map_fabric_lane9.BCM8885X=rx9:tx9 +lane_to_serdes_map_fabric_lane10.BCM8885X=rx10:tx10 +lane_to_serdes_map_fabric_lane11.BCM8885X=rx11:tx11 + +lane_to_serdes_map_fabric_lane12.BCM8885X=rx12:tx12 +lane_to_serdes_map_fabric_lane13.BCM8885X=rx13:tx13 +lane_to_serdes_map_fabric_lane14.BCM8885X=rx14:tx14 +lane_to_serdes_map_fabric_lane15.BCM8885X=rx15:tx15 + +lane_to_serdes_map_fabric_lane16.BCM8885X=rx16:tx16 +lane_to_serdes_map_fabric_lane17.BCM8885X=rx17:tx17 +lane_to_serdes_map_fabric_lane18.BCM8885X=rx18:tx18 +lane_to_serdes_map_fabric_lane19.BCM8885X=rx19:tx19 + +lane_to_serdes_map_fabric_lane20.BCM8885X=rx20:tx20 +lane_to_serdes_map_fabric_lane21.BCM8885X=rx21:tx21 +lane_to_serdes_map_fabric_lane22.BCM8885X=rx22:tx22 +lane_to_serdes_map_fabric_lane23.BCM8885X=rx23:tx23 + +lane_to_serdes_map_fabric_lane24.BCM8885X=rx24:tx26 +lane_to_serdes_map_fabric_lane25.BCM8885X=rx25:tx25 +lane_to_serdes_map_fabric_lane26.BCM8885X=rx26:tx24 +lane_to_serdes_map_fabric_lane27.BCM8885X=rx27:tx27 + +lane_to_serdes_map_fabric_lane28.BCM8885X=rx28:tx28 +lane_to_serdes_map_fabric_lane29.BCM8885X=rx29:tx31 +lane_to_serdes_map_fabric_lane30.BCM8885X=rx30:tx30 +lane_to_serdes_map_fabric_lane31.BCM8885X=rx31:tx29 + +lane_to_serdes_map_fabric_lane32.BCM8885X=rx32:tx32 +lane_to_serdes_map_fabric_lane33.BCM8885X=rx33:tx33 +lane_to_serdes_map_fabric_lane34.BCM8885X=rx34:tx34 +lane_to_serdes_map_fabric_lane35.BCM8885X=rx35:tx35 + +lane_to_serdes_map_fabric_lane36.BCM8885X=rx36:tx36 +lane_to_serdes_map_fabric_lane37.BCM8885X=rx37:tx37 +lane_to_serdes_map_fabric_lane38.BCM8885X=rx38:tx38 +lane_to_serdes_map_fabric_lane39.BCM8885X=rx39:tx39 + +lane_to_serdes_map_fabric_lane40.BCM8885X=rx40:tx43 +lane_to_serdes_map_fabric_lane41.BCM8885X=rx41:tx42 +lane_to_serdes_map_fabric_lane42.BCM8885X=rx42:tx41 +lane_to_serdes_map_fabric_lane43.BCM8885X=rx43:tx40 + +lane_to_serdes_map_fabric_lane44.BCM8885X=rx44:tx47 +lane_to_serdes_map_fabric_lane45.BCM8885X=rx45:tx45 +lane_to_serdes_map_fabric_lane46.BCM8885X=rx46:tx46 +lane_to_serdes_map_fabric_lane47.BCM8885X=rx47:tx44 + +lane_to_serdes_map_fabric_lane48.BCM8885X=rx48:tx48 +lane_to_serdes_map_fabric_lane49.BCM8885X=rx49:tx49 +lane_to_serdes_map_fabric_lane50.BCM8885X=rx50:tx50 +lane_to_serdes_map_fabric_lane51.BCM8885X=rx51:tx51 + +lane_to_serdes_map_fabric_lane52.BCM8885X=rx52:tx52 +lane_to_serdes_map_fabric_lane53.BCM8885X=rx53:tx53 +lane_to_serdes_map_fabric_lane54.BCM8885X=rx54:tx54 +lane_to_serdes_map_fabric_lane55.BCM8885X=rx55:tx55 + +lane_to_serdes_map_fabric_lane56.BCM8885X=rx56:tx59 +lane_to_serdes_map_fabric_lane57.BCM8885X=rx57:tx58 +lane_to_serdes_map_fabric_lane58.BCM8885X=rx58:tx57 +lane_to_serdes_map_fabric_lane59.BCM8885X=rx59:tx56 + +lane_to_serdes_map_fabric_lane60.BCM8885X=rx60:tx63 +lane_to_serdes_map_fabric_lane61.BCM8885X=rx61:tx61 +lane_to_serdes_map_fabric_lane62.BCM8885X=rx62:tx62 +lane_to_serdes_map_fabric_lane63.BCM8885X=rx63:tx60 + +lane_to_serdes_map_fabric_lane64.BCM8885X=rx64:tx64 +lane_to_serdes_map_fabric_lane65.BCM8885X=rx65:tx65 +lane_to_serdes_map_fabric_lane66.BCM8885X=rx66:tx66 +lane_to_serdes_map_fabric_lane67.BCM8885X=rx67:tx67 + +lane_to_serdes_map_fabric_lane68.BCM8885X=rx68:tx68 +lane_to_serdes_map_fabric_lane69.BCM8885X=rx69:tx69 +lane_to_serdes_map_fabric_lane70.BCM8885X=rx70:tx70 +lane_to_serdes_map_fabric_lane71.BCM8885X=rx71:tx71 + +lane_to_serdes_map_fabric_lane72.BCM8885X=rx72:tx75 +lane_to_serdes_map_fabric_lane73.BCM8885X=rx73:tx73 +lane_to_serdes_map_fabric_lane74.BCM8885X=rx74:tx74 +lane_to_serdes_map_fabric_lane75.BCM8885X=rx75:tx72 + +lane_to_serdes_map_fabric_lane76.BCM8885X=rx76:tx79 +lane_to_serdes_map_fabric_lane77.BCM8885X=rx77:tx78 +lane_to_serdes_map_fabric_lane78.BCM8885X=rx78:tx77 +lane_to_serdes_map_fabric_lane79.BCM8885X=rx79:tx76 + +lane_to_serdes_map_fabric_lane80.BCM8885X=rx80:tx80 +lane_to_serdes_map_fabric_lane81.BCM8885X=rx81:tx81 +lane_to_serdes_map_fabric_lane82.BCM8885X=rx82:tx82 +lane_to_serdes_map_fabric_lane83.BCM8885X=rx83:tx83 + +lane_to_serdes_map_fabric_lane84.BCM8885X=rx84:tx84 +lane_to_serdes_map_fabric_lane85.BCM8885X=rx85:tx85 +lane_to_serdes_map_fabric_lane86.BCM8885X=rx86:tx86 +lane_to_serdes_map_fabric_lane87.BCM8885X=rx87:tx87 + +lane_to_serdes_map_fabric_lane88.BCM8885X=rx88:tx88 +lane_to_serdes_map_fabric_lane89.BCM8885X=rx89:tx90 +lane_to_serdes_map_fabric_lane90.BCM8885X=rx90:tx89 +lane_to_serdes_map_fabric_lane91.BCM8885X=rx91:tx91 + +lane_to_serdes_map_fabric_lane92.BCM8885X=rx92:tx94 +lane_to_serdes_map_fabric_lane93.BCM8885X=rx93:tx93 +lane_to_serdes_map_fabric_lane94.BCM8885X=rx94:tx92 +lane_to_serdes_map_fabric_lane95.BCM8885X=rx95:tx95 + +lane_to_serdes_map_fabric_lane96.BCM8885X=rx96:tx96 +lane_to_serdes_map_fabric_lane97.BCM8885X=rx97:tx97 +lane_to_serdes_map_fabric_lane98.BCM8885X=rx98:tx98 +lane_to_serdes_map_fabric_lane99.BCM8885X=rx99:tx99 + +lane_to_serdes_map_fabric_lane100.BCM8885X=rx100:tx100 +lane_to_serdes_map_fabric_lane101.BCM8885X=rx101:tx101 +lane_to_serdes_map_fabric_lane102.BCM8885X=rx102:tx102 +lane_to_serdes_map_fabric_lane103.BCM8885X=rx103:tx103 + +lane_to_serdes_map_fabric_lane104.BCM8885X=rx104:tx104 +lane_to_serdes_map_fabric_lane105.BCM8885X=rx105:tx105 +lane_to_serdes_map_fabric_lane106.BCM8885X=rx106:tx106 +lane_to_serdes_map_fabric_lane107.BCM8885X=rx107:tx107 + +lane_to_serdes_map_fabric_lane108.BCM8885X=rx108:tx108 +lane_to_serdes_map_fabric_lane109.BCM8885X=rx109:tx109 +lane_to_serdes_map_fabric_lane110.BCM8885X=rx110:tx110 +lane_to_serdes_map_fabric_lane111.BCM8885X=rx111:tx111 + +lane_to_serdes_map_fabric_lane112.BCM8885X=rx112:tx114 +lane_to_serdes_map_fabric_lane113.BCM8885X=rx113:tx113 +lane_to_serdes_map_fabric_lane114.BCM8885X=rx114:tx112 +lane_to_serdes_map_fabric_lane115.BCM8885X=rx115:tx115 + +lane_to_serdes_map_fabric_lane116.BCM8885X=rx116:tx116 +lane_to_serdes_map_fabric_lane117.BCM8885X=rx117:tx117 +lane_to_serdes_map_fabric_lane118.BCM8885X=rx118:tx118 +lane_to_serdes_map_fabric_lane119.BCM8885X=rx119:tx119 + +lane_to_serdes_map_fabric_lane120.BCM8885X=rx120:tx120 +lane_to_serdes_map_fabric_lane121.BCM8885X=rx121:tx121 +lane_to_serdes_map_fabric_lane122.BCM8885X=rx122:tx122 +lane_to_serdes_map_fabric_lane123.BCM8885X=rx123:tx123 + +lane_to_serdes_map_fabric_lane124.BCM8885X=rx124:tx124 +lane_to_serdes_map_fabric_lane125.BCM8885X=rx125:tx125 +lane_to_serdes_map_fabric_lane126.BCM8885X=rx126:tx126 +lane_to_serdes_map_fabric_lane127.BCM8885X=rx127:tx127 + +lane_to_serdes_map_fabric_lane128.BCM8885X=rx128:tx128 +lane_to_serdes_map_fabric_lane129.BCM8885X=rx129:tx129 +lane_to_serdes_map_fabric_lane130.BCM8885X=rx130:tx130 +lane_to_serdes_map_fabric_lane131.BCM8885X=rx131:tx131 + +lane_to_serdes_map_fabric_lane132.BCM8885X=rx132:tx132 +lane_to_serdes_map_fabric_lane133.BCM8885X=rx133:tx133 +lane_to_serdes_map_fabric_lane134.BCM8885X=rx134:tx134 +lane_to_serdes_map_fabric_lane135.BCM8885X=rx135:tx135 + +lane_to_serdes_map_fabric_lane136.BCM8885X=rx136:tx139 +lane_to_serdes_map_fabric_lane137.BCM8885X=rx137:tx138 +lane_to_serdes_map_fabric_lane138.BCM8885X=rx138:tx137 +lane_to_serdes_map_fabric_lane139.BCM8885X=rx139:tx136 + +lane_to_serdes_map_fabric_lane140.BCM8885X=rx140:tx143 +lane_to_serdes_map_fabric_lane141.BCM8885X=rx141:tx141 +lane_to_serdes_map_fabric_lane142.BCM8885X=rx142:tx142 +lane_to_serdes_map_fabric_lane143.BCM8885X=rx143:tx140 + +lane_to_serdes_map_fabric_lane144.BCM8885X=rx144:tx144 +lane_to_serdes_map_fabric_lane145.BCM8885X=rx145:tx145 +lane_to_serdes_map_fabric_lane146.BCM8885X=rx146:tx146 +lane_to_serdes_map_fabric_lane147.BCM8885X=rx147:tx147 + +lane_to_serdes_map_fabric_lane148.BCM8885X=rx148:tx148 +lane_to_serdes_map_fabric_lane149.BCM8885X=rx149:tx149 +lane_to_serdes_map_fabric_lane150.BCM8885X=rx150:tx150 +lane_to_serdes_map_fabric_lane151.BCM8885X=rx151:tx151 + +lane_to_serdes_map_fabric_lane152.BCM8885X=rx152:tx155 +lane_to_serdes_map_fabric_lane153.BCM8885X=rx153:tx154 +lane_to_serdes_map_fabric_lane154.BCM8885X=rx154:tx153 +lane_to_serdes_map_fabric_lane155.BCM8885X=rx155:tx152 + +lane_to_serdes_map_fabric_lane156.BCM8885X=rx156:tx159 +lane_to_serdes_map_fabric_lane157.BCM8885X=rx157:tx157 +lane_to_serdes_map_fabric_lane158.BCM8885X=rx158:tx158 +lane_to_serdes_map_fabric_lane159.BCM8885X=rx159:tx156 + +lane_to_serdes_map_fabric_lane160.BCM8885X=rx160:tx160 +lane_to_serdes_map_fabric_lane161.BCM8885X=rx161:tx161 +lane_to_serdes_map_fabric_lane162.BCM8885X=rx162:tx162 +lane_to_serdes_map_fabric_lane163.BCM8885X=rx163:tx163 + +lane_to_serdes_map_fabric_lane164.BCM8885X=rx164:tx164 +lane_to_serdes_map_fabric_lane165.BCM8885X=rx165:tx165 +lane_to_serdes_map_fabric_lane166.BCM8885X=rx166:tx166 +lane_to_serdes_map_fabric_lane167.BCM8885X=rx167:tx167 + +lane_to_serdes_map_fabric_lane168.BCM8885X=rx168:tx171 +lane_to_serdes_map_fabric_lane169.BCM8885X=rx169:tx169 +lane_to_serdes_map_fabric_lane170.BCM8885X=rx170:tx170 +lane_to_serdes_map_fabric_lane171.BCM8885X=rx171:tx168 + +lane_to_serdes_map_fabric_lane172.BCM8885X=rx172:tx175 +lane_to_serdes_map_fabric_lane173.BCM8885X=rx173:tx174 +lane_to_serdes_map_fabric_lane174.BCM8885X=rx174:tx173 +lane_to_serdes_map_fabric_lane175.BCM8885X=rx175:tx172 + +lane_to_serdes_map_fabric_lane176.BCM8885X=rx176:tx176 +lane_to_serdes_map_fabric_lane177.BCM8885X=rx177:tx177 +lane_to_serdes_map_fabric_lane178.BCM8885X=rx178:tx178 +lane_to_serdes_map_fabric_lane179.BCM8885X=rx179:tx179 + +lane_to_serdes_map_fabric_lane180.BCM8885X=rx180:tx180 +lane_to_serdes_map_fabric_lane181.BCM8885X=rx181:tx181 +lane_to_serdes_map_fabric_lane182.BCM8885X=rx182:tx182 +lane_to_serdes_map_fabric_lane183.BCM8885X=rx183:tx183 + +lane_to_serdes_map_fabric_lane184.BCM8885X=rx184:tx184 +lane_to_serdes_map_fabric_lane185.BCM8885X=rx185:tx185 +lane_to_serdes_map_fabric_lane186.BCM8885X=rx186:tx186 +lane_to_serdes_map_fabric_lane187.BCM8885X=rx187:tx187 + +lane_to_serdes_map_fabric_lane188.BCM8885X=rx188:tx190 +lane_to_serdes_map_fabric_lane189.BCM8885X=rx189:tx189 +lane_to_serdes_map_fabric_lane190.BCM8885X=rx190:tx188 +lane_to_serdes_map_fabric_lane191.BCM8885X=rx191:tx191 + + +phy_rx_polarity_flip_fabric0.BCM8885X=0 +phy_rx_polarity_flip_fabric1.BCM8885X=1 +phy_rx_polarity_flip_fabric2.BCM8885X=0 +phy_rx_polarity_flip_fabric3.BCM8885X=0 +phy_rx_polarity_flip_fabric4.BCM8885X=0 +phy_rx_polarity_flip_fabric5.BCM8885X=0 +phy_rx_polarity_flip_fabric6.BCM8885X=0 +phy_rx_polarity_flip_fabric7.BCM8885X=0 +phy_rx_polarity_flip_fabric8.BCM8885X=1 +phy_rx_polarity_flip_fabric9.BCM8885X=1 +phy_rx_polarity_flip_fabric10.BCM8885X=0 +phy_rx_polarity_flip_fabric11.BCM8885X=0 +phy_rx_polarity_flip_fabric12.BCM8885X=1 +phy_rx_polarity_flip_fabric13.BCM8885X=0 +phy_rx_polarity_flip_fabric14.BCM8885X=0 +phy_rx_polarity_flip_fabric15.BCM8885X=1 +phy_rx_polarity_flip_fabric16.BCM8885X=1 +phy_rx_polarity_flip_fabric17.BCM8885X=1 +phy_rx_polarity_flip_fabric18.BCM8885X=0 +phy_rx_polarity_flip_fabric19.BCM8885X=0 +phy_rx_polarity_flip_fabric20.BCM8885X=0 +phy_rx_polarity_flip_fabric21.BCM8885X=0 +phy_rx_polarity_flip_fabric22.BCM8885X=1 +phy_rx_polarity_flip_fabric23.BCM8885X=0 +phy_rx_polarity_flip_fabric24.BCM8885X=1 +phy_rx_polarity_flip_fabric25.BCM8885X=0 +phy_rx_polarity_flip_fabric26.BCM8885X=1 +phy_rx_polarity_flip_fabric27.BCM8885X=1 +phy_rx_polarity_flip_fabric28.BCM8885X=1 +phy_rx_polarity_flip_fabric29.BCM8885X=1 +phy_rx_polarity_flip_fabric30.BCM8885X=0 +phy_rx_polarity_flip_fabric31.BCM8885X=1 +phy_rx_polarity_flip_fabric32.BCM8885X=0 +phy_rx_polarity_flip_fabric33.BCM8885X=1 +phy_rx_polarity_flip_fabric34.BCM8885X=0 +phy_rx_polarity_flip_fabric35.BCM8885X=0 +phy_rx_polarity_flip_fabric36.BCM8885X=0 +phy_rx_polarity_flip_fabric37.BCM8885X=1 +phy_rx_polarity_flip_fabric38.BCM8885X=1 +phy_rx_polarity_flip_fabric39.BCM8885X=0 +phy_rx_polarity_flip_fabric40.BCM8885X=1 +phy_rx_polarity_flip_fabric41.BCM8885X=0 +phy_rx_polarity_flip_fabric42.BCM8885X=0 +phy_rx_polarity_flip_fabric43.BCM8885X=0 +phy_rx_polarity_flip_fabric44.BCM8885X=1 +phy_rx_polarity_flip_fabric45.BCM8885X=0 +phy_rx_polarity_flip_fabric46.BCM8885X=0 +phy_rx_polarity_flip_fabric47.BCM8885X=1 +phy_rx_polarity_flip_fabric48.BCM8885X=1 +phy_rx_polarity_flip_fabric49.BCM8885X=1 +phy_rx_polarity_flip_fabric50.BCM8885X=1 +phy_rx_polarity_flip_fabric51.BCM8885X=1 +phy_rx_polarity_flip_fabric52.BCM8885X=1 +phy_rx_polarity_flip_fabric53.BCM8885X=1 +phy_rx_polarity_flip_fabric54.BCM8885X=1 +phy_rx_polarity_flip_fabric55.BCM8885X=1 +phy_rx_polarity_flip_fabric56.BCM8885X=0 +phy_rx_polarity_flip_fabric57.BCM8885X=0 +phy_rx_polarity_flip_fabric58.BCM8885X=0 +phy_rx_polarity_flip_fabric59.BCM8885X=0 +phy_rx_polarity_flip_fabric60.BCM8885X=0 +phy_rx_polarity_flip_fabric61.BCM8885X=0 +phy_rx_polarity_flip_fabric62.BCM8885X=1 +phy_rx_polarity_flip_fabric63.BCM8885X=0 +phy_rx_polarity_flip_fabric64.BCM8885X=1 +phy_rx_polarity_flip_fabric65.BCM8885X=1 +phy_rx_polarity_flip_fabric66.BCM8885X=0 +phy_rx_polarity_flip_fabric67.BCM8885X=0 +phy_rx_polarity_flip_fabric68.BCM8885X=1 +phy_rx_polarity_flip_fabric69.BCM8885X=1 +phy_rx_polarity_flip_fabric70.BCM8885X=1 +phy_rx_polarity_flip_fabric71.BCM8885X=0 +phy_rx_polarity_flip_fabric72.BCM8885X=0 +phy_rx_polarity_flip_fabric73.BCM8885X=1 +phy_rx_polarity_flip_fabric74.BCM8885X=0 +phy_rx_polarity_flip_fabric75.BCM8885X=1 +phy_rx_polarity_flip_fabric76.BCM8885X=1 +phy_rx_polarity_flip_fabric77.BCM8885X=1 +phy_rx_polarity_flip_fabric78.BCM8885X=1 +phy_rx_polarity_flip_fabric79.BCM8885X=0 +phy_rx_polarity_flip_fabric80.BCM8885X=1 +phy_rx_polarity_flip_fabric81.BCM8885X=0 +phy_rx_polarity_flip_fabric82.BCM8885X=0 +phy_rx_polarity_flip_fabric83.BCM8885X=0 +phy_rx_polarity_flip_fabric84.BCM8885X=1 +phy_rx_polarity_flip_fabric85.BCM8885X=0 +phy_rx_polarity_flip_fabric86.BCM8885X=1 +phy_rx_polarity_flip_fabric87.BCM8885X=0 +phy_rx_polarity_flip_fabric88.BCM8885X=1 +phy_rx_polarity_flip_fabric89.BCM8885X=1 +phy_rx_polarity_flip_fabric90.BCM8885X=1 +phy_rx_polarity_flip_fabric91.BCM8885X=1 +phy_rx_polarity_flip_fabric92.BCM8885X=1 +phy_rx_polarity_flip_fabric93.BCM8885X=1 +phy_rx_polarity_flip_fabric94.BCM8885X=1 +phy_rx_polarity_flip_fabric95.BCM8885X=1 +phy_rx_polarity_flip_fabric96.BCM8885X=0 +phy_rx_polarity_flip_fabric97.BCM8885X=1 +phy_rx_polarity_flip_fabric98.BCM8885X=0 +phy_rx_polarity_flip_fabric99.BCM8885X=0 +phy_rx_polarity_flip_fabric100.BCM8885X=0 +phy_rx_polarity_flip_fabric101.BCM8885X=1 +phy_rx_polarity_flip_fabric102.BCM8885X=1 +phy_rx_polarity_flip_fabric103.BCM8885X=0 +phy_rx_polarity_flip_fabric104.BCM8885X=1 +phy_rx_polarity_flip_fabric105.BCM8885X=0 +phy_rx_polarity_flip_fabric106.BCM8885X=0 +phy_rx_polarity_flip_fabric107.BCM8885X=0 +phy_rx_polarity_flip_fabric108.BCM8885X=1 +phy_rx_polarity_flip_fabric109.BCM8885X=1 +phy_rx_polarity_flip_fabric110.BCM8885X=0 +phy_rx_polarity_flip_fabric111.BCM8885X=1 +phy_rx_polarity_flip_fabric112.BCM8885X=0 +phy_rx_polarity_flip_fabric113.BCM8885X=0 +phy_rx_polarity_flip_fabric114.BCM8885X=1 +phy_rx_polarity_flip_fabric115.BCM8885X=1 +phy_rx_polarity_flip_fabric116.BCM8885X=0 +phy_rx_polarity_flip_fabric117.BCM8885X=1 +phy_rx_polarity_flip_fabric118.BCM8885X=1 +phy_rx_polarity_flip_fabric119.BCM8885X=1 +phy_rx_polarity_flip_fabric120.BCM8885X=1 +phy_rx_polarity_flip_fabric121.BCM8885X=1 +phy_rx_polarity_flip_fabric122.BCM8885X=1 +phy_rx_polarity_flip_fabric123.BCM8885X=0 +phy_rx_polarity_flip_fabric124.BCM8885X=0 +phy_rx_polarity_flip_fabric125.BCM8885X=0 +phy_rx_polarity_flip_fabric126.BCM8885X=0 +phy_rx_polarity_flip_fabric127.BCM8885X=1 +phy_rx_polarity_flip_fabric128.BCM8885X=0 +phy_rx_polarity_flip_fabric129.BCM8885X=0 +phy_rx_polarity_flip_fabric130.BCM8885X=1 +phy_rx_polarity_flip_fabric131.BCM8885X=0 +phy_rx_polarity_flip_fabric132.BCM8885X=0 +phy_rx_polarity_flip_fabric133.BCM8885X=1 +phy_rx_polarity_flip_fabric134.BCM8885X=1 +phy_rx_polarity_flip_fabric135.BCM8885X=0 +phy_rx_polarity_flip_fabric136.BCM8885X=0 +phy_rx_polarity_flip_fabric137.BCM8885X=1 +phy_rx_polarity_flip_fabric138.BCM8885X=1 +phy_rx_polarity_flip_fabric139.BCM8885X=0 +phy_rx_polarity_flip_fabric140.BCM8885X=1 +phy_rx_polarity_flip_fabric141.BCM8885X=0 +phy_rx_polarity_flip_fabric142.BCM8885X=1 +phy_rx_polarity_flip_fabric143.BCM8885X=1 +phy_rx_polarity_flip_fabric144.BCM8885X=1 +phy_rx_polarity_flip_fabric145.BCM8885X=1 +phy_rx_polarity_flip_fabric146.BCM8885X=1 +phy_rx_polarity_flip_fabric147.BCM8885X=0 +phy_rx_polarity_flip_fabric148.BCM8885X=1 +phy_rx_polarity_flip_fabric149.BCM8885X=1 +phy_rx_polarity_flip_fabric150.BCM8885X=0 +phy_rx_polarity_flip_fabric151.BCM8885X=0 +phy_rx_polarity_flip_fabric152.BCM8885X=0 +phy_rx_polarity_flip_fabric153.BCM8885X=0 +phy_rx_polarity_flip_fabric154.BCM8885X=0 +phy_rx_polarity_flip_fabric155.BCM8885X=1 +phy_rx_polarity_flip_fabric156.BCM8885X=0 +phy_rx_polarity_flip_fabric157.BCM8885X=0 +phy_rx_polarity_flip_fabric158.BCM8885X=0 +phy_rx_polarity_flip_fabric159.BCM8885X=1 +phy_rx_polarity_flip_fabric160.BCM8885X=0 +phy_rx_polarity_flip_fabric161.BCM8885X=1 +phy_rx_polarity_flip_fabric162.BCM8885X=1 +phy_rx_polarity_flip_fabric163.BCM8885X=1 +phy_rx_polarity_flip_fabric164.BCM8885X=1 +phy_rx_polarity_flip_fabric165.BCM8885X=0 +phy_rx_polarity_flip_fabric166.BCM8885X=0 +phy_rx_polarity_flip_fabric167.BCM8885X=1 +phy_rx_polarity_flip_fabric168.BCM8885X=0 +phy_rx_polarity_flip_fabric169.BCM8885X=1 +phy_rx_polarity_flip_fabric170.BCM8885X=0 +phy_rx_polarity_flip_fabric171.BCM8885X=0 +phy_rx_polarity_flip_fabric172.BCM8885X=0 +phy_rx_polarity_flip_fabric173.BCM8885X=1 +phy_rx_polarity_flip_fabric174.BCM8885X=1 +phy_rx_polarity_flip_fabric175.BCM8885X=1 +phy_rx_polarity_flip_fabric176.BCM8885X=0 +phy_rx_polarity_flip_fabric177.BCM8885X=1 +phy_rx_polarity_flip_fabric178.BCM8885X=0 +phy_rx_polarity_flip_fabric179.BCM8885X=1 +phy_rx_polarity_flip_fabric180.BCM8885X=1 +phy_rx_polarity_flip_fabric181.BCM8885X=0 +phy_rx_polarity_flip_fabric182.BCM8885X=0 +phy_rx_polarity_flip_fabric183.BCM8885X=0 +phy_rx_polarity_flip_fabric184.BCM8885X=0 +phy_rx_polarity_flip_fabric185.BCM8885X=0 +phy_rx_polarity_flip_fabric186.BCM8885X=1 +phy_rx_polarity_flip_fabric187.BCM8885X=0 +phy_rx_polarity_flip_fabric188.BCM8885X=0 +phy_rx_polarity_flip_fabric189.BCM8885X=0 +phy_rx_polarity_flip_fabric190.BCM8885X=0 +phy_rx_polarity_flip_fabric191.BCM8885X=1 + + +phy_tx_polarity_flip_fabric0.BCM8885X=0 +phy_tx_polarity_flip_fabric1.BCM8885X=0 +phy_tx_polarity_flip_fabric2.BCM8885X=0 +phy_tx_polarity_flip_fabric3.BCM8885X=1 +phy_tx_polarity_flip_fabric4.BCM8885X=1 +phy_tx_polarity_flip_fabric5.BCM8885X=0 +phy_tx_polarity_flip_fabric6.BCM8885X=1 +phy_tx_polarity_flip_fabric7.BCM8885X=1 +phy_tx_polarity_flip_fabric8.BCM8885X=0 +phy_tx_polarity_flip_fabric9.BCM8885X=1 +phy_tx_polarity_flip_fabric10.BCM8885X=1 +phy_tx_polarity_flip_fabric11.BCM8885X=1 +phy_tx_polarity_flip_fabric12.BCM8885X=1 +phy_tx_polarity_flip_fabric13.BCM8885X=0 +phy_tx_polarity_flip_fabric14.BCM8885X=1 +phy_tx_polarity_flip_fabric15.BCM8885X=1 +phy_tx_polarity_flip_fabric16.BCM8885X=1 +phy_tx_polarity_flip_fabric17.BCM8885X=1 +phy_tx_polarity_flip_fabric18.BCM8885X=0 +phy_tx_polarity_flip_fabric19.BCM8885X=0 +phy_tx_polarity_flip_fabric20.BCM8885X=0 +phy_tx_polarity_flip_fabric21.BCM8885X=1 +phy_tx_polarity_flip_fabric22.BCM8885X=1 +phy_tx_polarity_flip_fabric23.BCM8885X=0 +phy_tx_polarity_flip_fabric24.BCM8885X=0 +phy_tx_polarity_flip_fabric25.BCM8885X=1 +phy_tx_polarity_flip_fabric26.BCM8885X=1 +phy_tx_polarity_flip_fabric27.BCM8885X=0 +phy_tx_polarity_flip_fabric28.BCM8885X=1 +phy_tx_polarity_flip_fabric29.BCM8885X=0 +phy_tx_polarity_flip_fabric30.BCM8885X=1 +phy_tx_polarity_flip_fabric31.BCM8885X=0 +phy_tx_polarity_flip_fabric32.BCM8885X=0 +phy_tx_polarity_flip_fabric33.BCM8885X=0 +phy_tx_polarity_flip_fabric34.BCM8885X=0 +phy_tx_polarity_flip_fabric35.BCM8885X=0 +phy_tx_polarity_flip_fabric36.BCM8885X=1 +phy_tx_polarity_flip_fabric37.BCM8885X=1 +phy_tx_polarity_flip_fabric38.BCM8885X=0 +phy_tx_polarity_flip_fabric39.BCM8885X=0 +phy_tx_polarity_flip_fabric40.BCM8885X=1 +phy_tx_polarity_flip_fabric41.BCM8885X=0 +phy_tx_polarity_flip_fabric42.BCM8885X=0 +phy_tx_polarity_flip_fabric43.BCM8885X=1 +phy_tx_polarity_flip_fabric44.BCM8885X=0 +phy_tx_polarity_flip_fabric45.BCM8885X=0 +phy_tx_polarity_flip_fabric46.BCM8885X=1 +phy_tx_polarity_flip_fabric47.BCM8885X=0 +phy_tx_polarity_flip_fabric48.BCM8885X=1 +phy_tx_polarity_flip_fabric49.BCM8885X=1 +phy_tx_polarity_flip_fabric50.BCM8885X=0 +phy_tx_polarity_flip_fabric51.BCM8885X=0 +phy_tx_polarity_flip_fabric52.BCM8885X=1 +phy_tx_polarity_flip_fabric53.BCM8885X=0 +phy_tx_polarity_flip_fabric54.BCM8885X=0 +phy_tx_polarity_flip_fabric55.BCM8885X=1 +phy_tx_polarity_flip_fabric56.BCM8885X=0 +phy_tx_polarity_flip_fabric57.BCM8885X=0 +phy_tx_polarity_flip_fabric58.BCM8885X=1 +phy_tx_polarity_flip_fabric59.BCM8885X=0 +phy_tx_polarity_flip_fabric60.BCM8885X=1 +phy_tx_polarity_flip_fabric61.BCM8885X=1 +phy_tx_polarity_flip_fabric62.BCM8885X=1 +phy_tx_polarity_flip_fabric63.BCM8885X=1 +phy_tx_polarity_flip_fabric64.BCM8885X=1 +phy_tx_polarity_flip_fabric65.BCM8885X=0 +phy_tx_polarity_flip_fabric66.BCM8885X=1 +phy_tx_polarity_flip_fabric67.BCM8885X=0 +phy_tx_polarity_flip_fabric68.BCM8885X=0 +phy_tx_polarity_flip_fabric69.BCM8885X=0 +phy_tx_polarity_flip_fabric70.BCM8885X=0 +phy_tx_polarity_flip_fabric71.BCM8885X=1 +phy_tx_polarity_flip_fabric72.BCM8885X=0 +phy_tx_polarity_flip_fabric73.BCM8885X=1 +phy_tx_polarity_flip_fabric74.BCM8885X=0 +phy_tx_polarity_flip_fabric75.BCM8885X=1 +phy_tx_polarity_flip_fabric76.BCM8885X=0 +phy_tx_polarity_flip_fabric77.BCM8885X=0 +phy_tx_polarity_flip_fabric78.BCM8885X=0 +phy_tx_polarity_flip_fabric79.BCM8885X=1 +phy_tx_polarity_flip_fabric80.BCM8885X=1 +phy_tx_polarity_flip_fabric81.BCM8885X=0 +phy_tx_polarity_flip_fabric82.BCM8885X=0 +phy_tx_polarity_flip_fabric83.BCM8885X=0 +phy_tx_polarity_flip_fabric84.BCM8885X=1 +phy_tx_polarity_flip_fabric85.BCM8885X=0 +phy_tx_polarity_flip_fabric86.BCM8885X=1 +phy_tx_polarity_flip_fabric87.BCM8885X=0 +phy_tx_polarity_flip_fabric88.BCM8885X=1 +phy_tx_polarity_flip_fabric89.BCM8885X=1 +phy_tx_polarity_flip_fabric90.BCM8885X=1 +phy_tx_polarity_flip_fabric91.BCM8885X=1 +phy_tx_polarity_flip_fabric92.BCM8885X=1 +phy_tx_polarity_flip_fabric93.BCM8885X=1 +phy_tx_polarity_flip_fabric94.BCM8885X=0 +phy_tx_polarity_flip_fabric95.BCM8885X=0 +phy_tx_polarity_flip_fabric96.BCM8885X=1 +phy_tx_polarity_flip_fabric97.BCM8885X=1 +phy_tx_polarity_flip_fabric98.BCM8885X=1 +phy_tx_polarity_flip_fabric99.BCM8885X=0 +phy_tx_polarity_flip_fabric100.BCM8885X=0 +phy_tx_polarity_flip_fabric101.BCM8885X=0 +phy_tx_polarity_flip_fabric102.BCM8885X=1 +phy_tx_polarity_flip_fabric103.BCM8885X=1 +phy_tx_polarity_flip_fabric104.BCM8885X=1 +phy_tx_polarity_flip_fabric105.BCM8885X=0 +phy_tx_polarity_flip_fabric106.BCM8885X=1 +phy_tx_polarity_flip_fabric107.BCM8885X=0 +phy_tx_polarity_flip_fabric108.BCM8885X=0 +phy_tx_polarity_flip_fabric109.BCM8885X=1 +phy_tx_polarity_flip_fabric110.BCM8885X=0 +phy_tx_polarity_flip_fabric111.BCM8885X=0 +phy_tx_polarity_flip_fabric112.BCM8885X=1 +phy_tx_polarity_flip_fabric113.BCM8885X=0 +phy_tx_polarity_flip_fabric114.BCM8885X=0 +phy_tx_polarity_flip_fabric115.BCM8885X=1 +phy_tx_polarity_flip_fabric116.BCM8885X=1 +phy_tx_polarity_flip_fabric117.BCM8885X=1 +phy_tx_polarity_flip_fabric118.BCM8885X=0 +phy_tx_polarity_flip_fabric119.BCM8885X=0 +phy_tx_polarity_flip_fabric120.BCM8885X=0 +phy_tx_polarity_flip_fabric121.BCM8885X=0 +phy_tx_polarity_flip_fabric122.BCM8885X=1 +phy_tx_polarity_flip_fabric123.BCM8885X=1 +phy_tx_polarity_flip_fabric124.BCM8885X=0 +phy_tx_polarity_flip_fabric125.BCM8885X=0 +phy_tx_polarity_flip_fabric126.BCM8885X=0 +phy_tx_polarity_flip_fabric127.BCM8885X=1 +phy_tx_polarity_flip_fabric128.BCM8885X=0 +phy_tx_polarity_flip_fabric129.BCM8885X=0 +phy_tx_polarity_flip_fabric130.BCM8885X=0 +phy_tx_polarity_flip_fabric131.BCM8885X=1 +phy_tx_polarity_flip_fabric132.BCM8885X=0 +phy_tx_polarity_flip_fabric133.BCM8885X=0 +phy_tx_polarity_flip_fabric134.BCM8885X=1 +phy_tx_polarity_flip_fabric135.BCM8885X=1 +phy_tx_polarity_flip_fabric136.BCM8885X=1 +phy_tx_polarity_flip_fabric137.BCM8885X=1 +phy_tx_polarity_flip_fabric138.BCM8885X=1 +phy_tx_polarity_flip_fabric139.BCM8885X=1 +phy_tx_polarity_flip_fabric140.BCM8885X=0 +phy_tx_polarity_flip_fabric141.BCM8885X=0 +phy_tx_polarity_flip_fabric142.BCM8885X=0 +phy_tx_polarity_flip_fabric143.BCM8885X=0 +phy_tx_polarity_flip_fabric144.BCM8885X=1 +phy_tx_polarity_flip_fabric145.BCM8885X=1 +phy_tx_polarity_flip_fabric146.BCM8885X=1 +phy_tx_polarity_flip_fabric147.BCM8885X=1 +phy_tx_polarity_flip_fabric148.BCM8885X=1 +phy_tx_polarity_flip_fabric149.BCM8885X=1 +phy_tx_polarity_flip_fabric150.BCM8885X=1 +phy_tx_polarity_flip_fabric151.BCM8885X=1 +phy_tx_polarity_flip_fabric152.BCM8885X=1 +phy_tx_polarity_flip_fabric153.BCM8885X=1 +phy_tx_polarity_flip_fabric154.BCM8885X=1 +phy_tx_polarity_flip_fabric155.BCM8885X=0 +phy_tx_polarity_flip_fabric156.BCM8885X=1 +phy_tx_polarity_flip_fabric157.BCM8885X=0 +phy_tx_polarity_flip_fabric158.BCM8885X=0 +phy_tx_polarity_flip_fabric159.BCM8885X=0 +phy_tx_polarity_flip_fabric160.BCM8885X=0 +phy_tx_polarity_flip_fabric161.BCM8885X=1 +phy_tx_polarity_flip_fabric162.BCM8885X=0 +phy_tx_polarity_flip_fabric163.BCM8885X=1 +phy_tx_polarity_flip_fabric164.BCM8885X=1 +phy_tx_polarity_flip_fabric165.BCM8885X=1 +phy_tx_polarity_flip_fabric166.BCM8885X=0 +phy_tx_polarity_flip_fabric167.BCM8885X=0 +phy_tx_polarity_flip_fabric168.BCM8885X=0 +phy_tx_polarity_flip_fabric169.BCM8885X=0 +phy_tx_polarity_flip_fabric170.BCM8885X=1 +phy_tx_polarity_flip_fabric171.BCM8885X=0 +phy_tx_polarity_flip_fabric172.BCM8885X=0 +phy_tx_polarity_flip_fabric173.BCM8885X=0 +phy_tx_polarity_flip_fabric174.BCM8885X=0 +phy_tx_polarity_flip_fabric175.BCM8885X=1 +phy_tx_polarity_flip_fabric176.BCM8885X=0 +phy_tx_polarity_flip_fabric177.BCM8885X=0 +phy_tx_polarity_flip_fabric178.BCM8885X=0 +phy_tx_polarity_flip_fabric179.BCM8885X=1 +phy_tx_polarity_flip_fabric180.BCM8885X=1 +phy_tx_polarity_flip_fabric181.BCM8885X=0 +phy_tx_polarity_flip_fabric182.BCM8885X=0 +phy_tx_polarity_flip_fabric183.BCM8885X=0 +phy_tx_polarity_flip_fabric184.BCM8885X=0 +phy_tx_polarity_flip_fabric185.BCM8885X=1 +phy_tx_polarity_flip_fabric186.BCM8885X=1 +phy_tx_polarity_flip_fabric187.BCM8885X=0 +phy_tx_polarity_flip_fabric188.BCM8885X=1 +phy_tx_polarity_flip_fabric189.BCM8885X=0 +phy_tx_polarity_flip_fabric190.BCM8885X=0 +phy_tx_polarity_flip_fabric191.BCM8885X=1 + + +lane_to_serdes_map_nif_lane0.BCM8885X=rx0:tx0 +lane_to_serdes_map_nif_lane1.BCM8885X=rx1:tx1 +lane_to_serdes_map_nif_lane2.BCM8885X=rx2:tx2 +lane_to_serdes_map_nif_lane3.BCM8885X=rx3:tx3 +lane_to_serdes_map_nif_lane4.BCM8885X=rx4:tx4 +lane_to_serdes_map_nif_lane5.BCM8885X=rx5:tx5 +lane_to_serdes_map_nif_lane6.BCM8885X=rx6:tx6 +lane_to_serdes_map_nif_lane7.BCM8885X=rx7:tx7 + +lane_to_serdes_map_nif_lane8.BCM8885X=rx8:tx8 +lane_to_serdes_map_nif_lane9.BCM8885X=rx9:tx9 +lane_to_serdes_map_nif_lane10.BCM8885X=rx10:tx10 +lane_to_serdes_map_nif_lane11.BCM8885X=rx11:tx11 +lane_to_serdes_map_nif_lane12.BCM8885X=rx12:tx12 +lane_to_serdes_map_nif_lane13.BCM8885X=rx13:tx13 +lane_to_serdes_map_nif_lane14.BCM8885X=rx14:tx14 +lane_to_serdes_map_nif_lane15.BCM8885X=rx15:tx15 + +lane_to_serdes_map_nif_lane16.BCM8885X=rx16:tx16 +lane_to_serdes_map_nif_lane17.BCM8885X=rx17:tx17 +lane_to_serdes_map_nif_lane18.BCM8885X=rx18:tx18 +lane_to_serdes_map_nif_lane19.BCM8885X=rx19:tx19 +lane_to_serdes_map_nif_lane20.BCM8885X=rx20:tx20 +lane_to_serdes_map_nif_lane21.BCM8885X=rx21:tx21 +lane_to_serdes_map_nif_lane22.BCM8885X=rx22:tx22 +lane_to_serdes_map_nif_lane23.BCM8885X=rx23:tx23 + +lane_to_serdes_map_nif_lane24.BCM8885X=rx24:tx24 +lane_to_serdes_map_nif_lane25.BCM8885X=rx25:tx25 +lane_to_serdes_map_nif_lane26.BCM8885X=rx26:tx26 +lane_to_serdes_map_nif_lane27.BCM8885X=rx27:tx27 +lane_to_serdes_map_nif_lane28.BCM8885X=rx28:tx28 +lane_to_serdes_map_nif_lane29.BCM8885X=rx29:tx29 +lane_to_serdes_map_nif_lane30.BCM8885X=rx30:tx30 +lane_to_serdes_map_nif_lane31.BCM8885X=rx31:tx31 + +lane_to_serdes_map_nif_lane32.BCM8885X=rx32:tx32 +lane_to_serdes_map_nif_lane33.BCM8885X=rx33:tx33 +lane_to_serdes_map_nif_lane34.BCM8885X=rx34:tx34 +lane_to_serdes_map_nif_lane35.BCM8885X=rx35:tx35 +lane_to_serdes_map_nif_lane36.BCM8885X=rx36:tx36 +lane_to_serdes_map_nif_lane37.BCM8885X=rx37:tx37 +lane_to_serdes_map_nif_lane38.BCM8885X=rx38:tx38 +lane_to_serdes_map_nif_lane39.BCM8885X=rx39:tx39 + +lane_to_serdes_map_nif_lane40.BCM8885X=rx40:tx40 +lane_to_serdes_map_nif_lane41.BCM8885X=rx41:tx41 +lane_to_serdes_map_nif_lane42.BCM8885X=rx42:tx42 +lane_to_serdes_map_nif_lane43.BCM8885X=rx43:tx43 +lane_to_serdes_map_nif_lane44.BCM8885X=rx44:tx44 +lane_to_serdes_map_nif_lane45.BCM8885X=rx45:tx45 +lane_to_serdes_map_nif_lane46.BCM8885X=rx46:tx46 +lane_to_serdes_map_nif_lane47.BCM8885X=rx47:tx47 + +lane_to_serdes_map_nif_lane48.BCM8885X=rx48:tx48 +lane_to_serdes_map_nif_lane49.BCM8885X=rx49:tx49 +lane_to_serdes_map_nif_lane50.BCM8885X=rx50:tx50 +lane_to_serdes_map_nif_lane51.BCM8885X=rx51:tx51 +lane_to_serdes_map_nif_lane52.BCM8885X=rx52:tx52 +lane_to_serdes_map_nif_lane53.BCM8885X=rx53:tx53 +lane_to_serdes_map_nif_lane54.BCM8885X=rx54:tx54 +lane_to_serdes_map_nif_lane55.BCM8885X=rx55:tx55 + +lane_to_serdes_map_nif_lane56.BCM8885X=rx56:tx56 +lane_to_serdes_map_nif_lane57.BCM8885X=rx57:tx57 +lane_to_serdes_map_nif_lane58.BCM8885X=rx58:tx58 +lane_to_serdes_map_nif_lane59.BCM8885X=rx59:tx59 +lane_to_serdes_map_nif_lane60.BCM8885X=rx60:tx60 +lane_to_serdes_map_nif_lane61.BCM8885X=rx61:tx61 +lane_to_serdes_map_nif_lane62.BCM8885X=rx62:tx62 +lane_to_serdes_map_nif_lane63.BCM8885X=rx63:tx63 + +lane_to_serdes_map_nif_lane64.BCM8885X=rx64:tx64 +lane_to_serdes_map_nif_lane65.BCM8885X=rx65:tx65 +lane_to_serdes_map_nif_lane66.BCM8885X=rx66:tx66 +lane_to_serdes_map_nif_lane67.BCM8885X=rx67:tx67 +lane_to_serdes_map_nif_lane68.BCM8885X=rx68:tx68 +lane_to_serdes_map_nif_lane69.BCM8885X=rx69:tx69 +lane_to_serdes_map_nif_lane70.BCM8885X=rx70:tx70 +lane_to_serdes_map_nif_lane71.BCM8885X=rx71:tx71 + +lane_to_serdes_map_nif_lane72.BCM8885X=rx72:tx72 +lane_to_serdes_map_nif_lane73.BCM8885X=rx73:tx73 +lane_to_serdes_map_nif_lane74.BCM8885X=rx74:tx74 +lane_to_serdes_map_nif_lane75.BCM8885X=rx75:tx75 +lane_to_serdes_map_nif_lane76.BCM8885X=rx76:tx76 +lane_to_serdes_map_nif_lane77.BCM8885X=rx77:tx77 +lane_to_serdes_map_nif_lane78.BCM8885X=rx78:tx78 +lane_to_serdes_map_nif_lane79.BCM8885X=rx79:tx79 + +lane_to_serdes_map_nif_lane80.BCM8885X=rx80:tx80 +lane_to_serdes_map_nif_lane81.BCM8885X=rx81:tx81 +lane_to_serdes_map_nif_lane82.BCM8885X=rx82:tx82 +lane_to_serdes_map_nif_lane83.BCM8885X=rx83:tx83 +lane_to_serdes_map_nif_lane84.BCM8885X=rx84:tx84 +lane_to_serdes_map_nif_lane85.BCM8885X=rx85:tx85 +lane_to_serdes_map_nif_lane86.BCM8885X=rx86:tx86 +lane_to_serdes_map_nif_lane87.BCM8885X=rx87:tx87 + +lane_to_serdes_map_nif_lane88.BCM8885X=rx88:tx88 +lane_to_serdes_map_nif_lane89.BCM8885X=rx89:tx89 +lane_to_serdes_map_nif_lane90.BCM8885X=rx90:tx90 +lane_to_serdes_map_nif_lane91.BCM8885X=rx91:tx91 +lane_to_serdes_map_nif_lane92.BCM8885X=rx92:tx92 +lane_to_serdes_map_nif_lane93.BCM8885X=rx93:tx93 +lane_to_serdes_map_nif_lane94.BCM8885X=rx94:tx94 +lane_to_serdes_map_nif_lane95.BCM8885X=rx95:tx95 + +lane_to_serdes_map_nif_lane96.BCM8885X=rx96:tx96 +lane_to_serdes_map_nif_lane97.BCM8885X=rx97:tx97 +lane_to_serdes_map_nif_lane98.BCM8885X=rx98:tx98 +lane_to_serdes_map_nif_lane99.BCM8885X=rx99:tx99 +lane_to_serdes_map_nif_lane100.BCM8885X=rx100:tx100 +lane_to_serdes_map_nif_lane101.BCM8885X=rx101:tx101 +lane_to_serdes_map_nif_lane102.BCM8885X=rx102:tx102 +lane_to_serdes_map_nif_lane103.BCM8885X=rx103:tx103 + +lane_to_serdes_map_nif_lane104.BCM8885X=rx104:tx104 +lane_to_serdes_map_nif_lane105.BCM8885X=rx105:tx105 +lane_to_serdes_map_nif_lane106.BCM8885X=rx106:tx106 +lane_to_serdes_map_nif_lane107.BCM8885X=rx107:tx107 +lane_to_serdes_map_nif_lane108.BCM8885X=rx108:tx108 +lane_to_serdes_map_nif_lane109.BCM8885X=rx109:tx109 +lane_to_serdes_map_nif_lane110.BCM8885X=rx110:tx110 +lane_to_serdes_map_nif_lane111.BCM8885X=rx111:tx111 + +lane_to_serdes_map_nif_lane112.BCM8885X=rx112:tx112 +lane_to_serdes_map_nif_lane113.BCM8885X=rx113:tx113 +lane_to_serdes_map_nif_lane114.BCM8885X=rx114:tx114 +lane_to_serdes_map_nif_lane115.BCM8885X=rx115:tx115 +lane_to_serdes_map_nif_lane116.BCM8885X=rx116:tx116 +lane_to_serdes_map_nif_lane117.BCM8885X=rx117:tx117 +lane_to_serdes_map_nif_lane118.BCM8885X=rx118:tx118 +lane_to_serdes_map_nif_lane119.BCM8885X=rx119:tx119 + +lane_to_serdes_map_nif_lane120.BCM8885X=rx120:tx120 +lane_to_serdes_map_nif_lane121.BCM8885X=rx121:tx121 +lane_to_serdes_map_nif_lane122.BCM8885X=rx122:tx122 +lane_to_serdes_map_nif_lane123.BCM8885X=rx123:tx123 +lane_to_serdes_map_nif_lane124.BCM8885X=rx124:tx124 +lane_to_serdes_map_nif_lane125.BCM8885X=rx125:tx125 +lane_to_serdes_map_nif_lane126.BCM8885X=rx126:tx126 +lane_to_serdes_map_nif_lane127.BCM8885X=rx127:tx127 + +lane_to_serdes_map_nif_lane128.BCM8885X=rx128:tx128 +lane_to_serdes_map_nif_lane129.BCM8885X=rx129:tx129 +lane_to_serdes_map_nif_lane130.BCM8885X=rx130:tx130 +lane_to_serdes_map_nif_lane131.BCM8885X=rx131:tx131 +lane_to_serdes_map_nif_lane132.BCM8885X=rx132:tx132 +lane_to_serdes_map_nif_lane133.BCM8885X=rx133:tx133 +lane_to_serdes_map_nif_lane134.BCM8885X=rx134:tx134 +lane_to_serdes_map_nif_lane135.BCM8885X=rx135:tx135 + +lane_to_serdes_map_nif_lane136.BCM8885X=rx136:tx136 +lane_to_serdes_map_nif_lane137.BCM8885X=rx137:tx137 +lane_to_serdes_map_nif_lane138.BCM8885X=rx138:tx138 +lane_to_serdes_map_nif_lane139.BCM8885X=rx139:tx139 +lane_to_serdes_map_nif_lane140.BCM8885X=rx140:tx140 +lane_to_serdes_map_nif_lane141.BCM8885X=rx141:tx141 +lane_to_serdes_map_nif_lane142.BCM8885X=rx142:tx142 +lane_to_serdes_map_nif_lane143.BCM8885X=rx143:tx143 + + +mdb_profile=Balanced-Exem +mdb_profile_kaps_cfg.BCM8885X=2 +mdio_output_delay=16 +mem_cache_enable_ecc.BCM8885X=1 +mem_cache_enable_parity.BCM8885X=1 +miim_intr_enable.BCM8885X=0 +os=unix +outlif_logical_to_physical_phase_map_1=S1 +outlif_logical_to_physical_phase_map_2=L1 +outlif_logical_to_physical_phase_map_3=XL +outlif_logical_to_physical_phase_map_4=L2 +outlif_logical_to_physical_phase_map_5=M1 +outlif_logical_to_physical_phase_map_6=M2 +outlif_logical_to_physical_phase_map_7=M3 +outlif_logical_to_physical_phase_map_8=S2 +outlif_physical_phase_data_granularity_L1=60 +outlif_physical_phase_data_granularity_L2=60 +outlif_physical_phase_data_granularity_M1=60 +outlif_physical_phase_data_granularity_M2=60 +outlif_physical_phase_data_granularity_M3=60 +outlif_physical_phase_data_granularity_S1=60 +outlif_physical_phase_data_granularity_S2=60 +outlif_physical_phase_data_granularity_XL=60 +pdma_continuous_mode_enable.BCM8885X=1 + + +phy_rx_polarity_flip_phy0.BCM8885X=1 +phy_rx_polarity_flip_phy1.BCM8885X=0 +phy_rx_polarity_flip_phy2.BCM8885X=1 +phy_rx_polarity_flip_phy3.BCM8885X=0 +phy_rx_polarity_flip_phy4.BCM8885X=1 +phy_rx_polarity_flip_phy5.BCM8885X=1 +phy_rx_polarity_flip_phy6.BCM8885X=1 +phy_rx_polarity_flip_phy7.BCM8885X=0 + +phy_rx_polarity_flip_phy8.BCM8885X=0 +phy_rx_polarity_flip_phy9.BCM8885X=0 +phy_rx_polarity_flip_phy10.BCM8885X=1 +phy_rx_polarity_flip_phy11.BCM8885X=0 +phy_rx_polarity_flip_phy12.BCM8885X=1 +phy_rx_polarity_flip_phy13.BCM8885X=0 +phy_rx_polarity_flip_phy14.BCM8885X=0 +phy_rx_polarity_flip_phy15.BCM8885X=0 + +phy_rx_polarity_flip_phy16.BCM8885X=1 +phy_rx_polarity_flip_phy17.BCM8885X=0 +phy_rx_polarity_flip_phy18.BCM8885X=1 +phy_rx_polarity_flip_phy19.BCM8885X=0 +phy_rx_polarity_flip_phy20.BCM8885X=1 +phy_rx_polarity_flip_phy21.BCM8885X=1 +phy_rx_polarity_flip_phy22.BCM8885X=1 +phy_rx_polarity_flip_phy23.BCM8885X=1 + +phy_rx_polarity_flip_phy24.BCM8885X=0 +phy_rx_polarity_flip_phy25.BCM8885X=1 +phy_rx_polarity_flip_phy26.BCM8885X=0 +phy_rx_polarity_flip_phy27.BCM8885X=1 +phy_rx_polarity_flip_phy28.BCM8885X=1 +phy_rx_polarity_flip_phy29.BCM8885X=1 +phy_rx_polarity_flip_phy30.BCM8885X=0 +phy_rx_polarity_flip_phy31.BCM8885X=1 + +phy_rx_polarity_flip_phy32.BCM8885X=1 +phy_rx_polarity_flip_phy33.BCM8885X=0 +phy_rx_polarity_flip_phy34.BCM8885X=1 +phy_rx_polarity_flip_phy35.BCM8885X=0 +phy_rx_polarity_flip_phy36.BCM8885X=0 +phy_rx_polarity_flip_phy37.BCM8885X=0 +phy_rx_polarity_flip_phy38.BCM8885X=0 +phy_rx_polarity_flip_phy39.BCM8885X=1 + +phy_rx_polarity_flip_phy40.BCM8885X=1 +phy_rx_polarity_flip_phy41.BCM8885X=1 +phy_rx_polarity_flip_phy42.BCM8885X=0 +phy_rx_polarity_flip_phy43.BCM8885X=1 +phy_rx_polarity_flip_phy44.BCM8885X=1 +phy_rx_polarity_flip_phy45.BCM8885X=0 +phy_rx_polarity_flip_phy46.BCM8885X=0 +phy_rx_polarity_flip_phy47.BCM8885X=1 + +phy_rx_polarity_flip_phy48.BCM8885X=0 +phy_rx_polarity_flip_phy49.BCM8885X=1 +phy_rx_polarity_flip_phy50.BCM8885X=0 +phy_rx_polarity_flip_phy51.BCM8885X=0 +phy_rx_polarity_flip_phy52.BCM8885X=0 +phy_rx_polarity_flip_phy53.BCM8885X=1 +phy_rx_polarity_flip_phy54.BCM8885X=0 +phy_rx_polarity_flip_phy55.BCM8885X=0 + +phy_rx_polarity_flip_phy56.BCM8885X=0 +phy_rx_polarity_flip_phy57.BCM8885X=0 +phy_rx_polarity_flip_phy58.BCM8885X=0 +phy_rx_polarity_flip_phy59.BCM8885X=0 +phy_rx_polarity_flip_phy60.BCM8885X=0 +phy_rx_polarity_flip_phy61.BCM8885X=0 +phy_rx_polarity_flip_phy62.BCM8885X=1 +phy_rx_polarity_flip_phy63.BCM8885X=1 + +phy_rx_polarity_flip_phy64.BCM8885X=0 +phy_rx_polarity_flip_phy65.BCM8885X=0 +phy_rx_polarity_flip_phy66.BCM8885X=0 +phy_rx_polarity_flip_phy67.BCM8885X=0 +phy_rx_polarity_flip_phy68.BCM8885X=0 +phy_rx_polarity_flip_phy69.BCM8885X=0 +phy_rx_polarity_flip_phy70.BCM8885X=0 +phy_rx_polarity_flip_phy71.BCM8885X=0 + +phy_rx_polarity_flip_phy72.BCM8885X=0 +phy_rx_polarity_flip_phy73.BCM8885X=0 +phy_rx_polarity_flip_phy74.BCM8885X=0 +phy_rx_polarity_flip_phy75.BCM8885X=1 +phy_rx_polarity_flip_phy76.BCM8885X=0 +phy_rx_polarity_flip_phy77.BCM8885X=1 +phy_rx_polarity_flip_phy78.BCM8885X=0 +phy_rx_polarity_flip_phy79.BCM8885X=0 + +phy_rx_polarity_flip_phy80.BCM8885X=1 +phy_rx_polarity_flip_phy81.BCM8885X=0 +phy_rx_polarity_flip_phy82.BCM8885X=1 +phy_rx_polarity_flip_phy83.BCM8885X=1 +phy_rx_polarity_flip_phy84.BCM8885X=0 +phy_rx_polarity_flip_phy85.BCM8885X=0 +phy_rx_polarity_flip_phy86.BCM8885X=1 +phy_rx_polarity_flip_phy87.BCM8885X=1 + +phy_rx_polarity_flip_phy88.BCM8885X=0 +phy_rx_polarity_flip_phy89.BCM8885X=1 +phy_rx_polarity_flip_phy90.BCM8885X=0 +phy_rx_polarity_flip_phy91.BCM8885X=0 +phy_rx_polarity_flip_phy92.BCM8885X=0 +phy_rx_polarity_flip_phy93.BCM8885X=0 +phy_rx_polarity_flip_phy94.BCM8885X=0 +phy_rx_polarity_flip_phy95.BCM8885X=1 + +phy_rx_polarity_flip_phy96.BCM8885X=0 +phy_rx_polarity_flip_phy97.BCM8885X=0 +phy_rx_polarity_flip_phy98.BCM8885X=0 +phy_rx_polarity_flip_phy99.BCM8885X=0 +phy_rx_polarity_flip_phy100.BCM8885X=0 +phy_rx_polarity_flip_phy101.BCM8885X=1 +phy_rx_polarity_flip_phy102.BCM8885X=1 +phy_rx_polarity_flip_phy103.BCM8885X=0 + +phy_rx_polarity_flip_phy104.BCM8885X=1 +phy_rx_polarity_flip_phy105.BCM8885X=1 +phy_rx_polarity_flip_phy106.BCM8885X=1 +phy_rx_polarity_flip_phy107.BCM8885X=1 +phy_rx_polarity_flip_phy108.BCM8885X=0 +phy_rx_polarity_flip_phy109.BCM8885X=1 +phy_rx_polarity_flip_phy110.BCM8885X=1 +phy_rx_polarity_flip_phy111.BCM8885X=1 + +phy_rx_polarity_flip_phy112.BCM8885X=0 +phy_rx_polarity_flip_phy113.BCM8885X=1 +phy_rx_polarity_flip_phy114.BCM8885X=1 +phy_rx_polarity_flip_phy115.BCM8885X=1 +phy_rx_polarity_flip_phy116.BCM8885X=1 +phy_rx_polarity_flip_phy117.BCM8885X=1 +phy_rx_polarity_flip_phy118.BCM8885X=0 +phy_rx_polarity_flip_phy119.BCM8885X=0 + +phy_rx_polarity_flip_phy120.BCM8885X=1 +phy_rx_polarity_flip_phy121.BCM8885X=0 +phy_rx_polarity_flip_phy122.BCM8885X=0 +phy_rx_polarity_flip_phy123.BCM8885X=1 +phy_rx_polarity_flip_phy124.BCM8885X=0 +phy_rx_polarity_flip_phy125.BCM8885X=1 +phy_rx_polarity_flip_phy126.BCM8885X=1 +phy_rx_polarity_flip_phy127.BCM8885X=0 + +phy_rx_polarity_flip_phy128.BCM8885X=0 +phy_rx_polarity_flip_phy129.BCM8885X=0 +phy_rx_polarity_flip_phy130.BCM8885X=1 +phy_rx_polarity_flip_phy131.BCM8885X=0 +phy_rx_polarity_flip_phy132.BCM8885X=0 +phy_rx_polarity_flip_phy133.BCM8885X=1 +phy_rx_polarity_flip_phy134.BCM8885X=1 +phy_rx_polarity_flip_phy135.BCM8885X=0 + +phy_rx_polarity_flip_phy136.BCM8885X=1 +phy_rx_polarity_flip_phy137.BCM8885X=0 +phy_rx_polarity_flip_phy138.BCM8885X=0 +phy_rx_polarity_flip_phy139.BCM8885X=1 +phy_rx_polarity_flip_phy140.BCM8885X=1 +phy_rx_polarity_flip_phy141.BCM8885X=1 +phy_rx_polarity_flip_phy142.BCM8885X=0 +phy_rx_polarity_flip_phy143.BCM8885X=1 + + +phy_tx_polarity_flip_phy0.BCM8885X=1 +phy_tx_polarity_flip_phy1.BCM8885X=0 +phy_tx_polarity_flip_phy2.BCM8885X=0 +phy_tx_polarity_flip_phy3.BCM8885X=0 +phy_tx_polarity_flip_phy4.BCM8885X=1 +phy_tx_polarity_flip_phy5.BCM8885X=0 +phy_tx_polarity_flip_phy6.BCM8885X=0 +phy_tx_polarity_flip_phy7.BCM8885X=1 + +phy_tx_polarity_flip_phy8.BCM8885X=0 +phy_tx_polarity_flip_phy9.BCM8885X=1 +phy_tx_polarity_flip_phy10.BCM8885X=0 +phy_tx_polarity_flip_phy11.BCM8885X=1 +phy_tx_polarity_flip_phy12.BCM8885X=1 +phy_tx_polarity_flip_phy13.BCM8885X=1 +phy_tx_polarity_flip_phy14.BCM8885X=0 +phy_tx_polarity_flip_phy15.BCM8885X=1 + +phy_tx_polarity_flip_phy16.BCM8885X=1 +phy_tx_polarity_flip_phy17.BCM8885X=1 +phy_tx_polarity_flip_phy18.BCM8885X=0 +phy_tx_polarity_flip_phy19.BCM8885X=0 +phy_tx_polarity_flip_phy20.BCM8885X=1 +phy_tx_polarity_flip_phy21.BCM8885X=1 +phy_tx_polarity_flip_phy22.BCM8885X=0 +phy_tx_polarity_flip_phy23.BCM8885X=0 + +phy_tx_polarity_flip_phy24.BCM8885X=0 +phy_tx_polarity_flip_phy25.BCM8885X=0 +phy_tx_polarity_flip_phy26.BCM8885X=0 +phy_tx_polarity_flip_phy27.BCM8885X=1 +phy_tx_polarity_flip_phy28.BCM8885X=0 +phy_tx_polarity_flip_phy29.BCM8885X=0 +phy_tx_polarity_flip_phy30.BCM8885X=0 +phy_tx_polarity_flip_phy31.BCM8885X=0 + +phy_tx_polarity_flip_phy32.BCM8885X=1 +phy_tx_polarity_flip_phy33.BCM8885X=1 +phy_tx_polarity_flip_phy34.BCM8885X=1 +phy_tx_polarity_flip_phy35.BCM8885X=0 +phy_tx_polarity_flip_phy36.BCM8885X=1 +phy_tx_polarity_flip_phy37.BCM8885X=1 +phy_tx_polarity_flip_phy38.BCM8885X=1 +phy_tx_polarity_flip_phy39.BCM8885X=0 + +phy_tx_polarity_flip_phy40.BCM8885X=0 +phy_tx_polarity_flip_phy41.BCM8885X=0 +phy_tx_polarity_flip_phy42.BCM8885X=1 +phy_tx_polarity_flip_phy43.BCM8885X=1 +phy_tx_polarity_flip_phy44.BCM8885X=0 +phy_tx_polarity_flip_phy45.BCM8885X=0 +phy_tx_polarity_flip_phy46.BCM8885X=1 +phy_tx_polarity_flip_phy47.BCM8885X=0 + +phy_tx_polarity_flip_phy48.BCM8885X=1 +phy_tx_polarity_flip_phy49.BCM8885X=1 +phy_tx_polarity_flip_phy50.BCM8885X=1 +phy_tx_polarity_flip_phy51.BCM8885X=0 +phy_tx_polarity_flip_phy52.BCM8885X=1 +phy_tx_polarity_flip_phy53.BCM8885X=0 +phy_tx_polarity_flip_phy54.BCM8885X=0 +phy_tx_polarity_flip_phy55.BCM8885X=0 + +phy_tx_polarity_flip_phy56.BCM8885X=0 +phy_tx_polarity_flip_phy57.BCM8885X=1 +phy_tx_polarity_flip_phy58.BCM8885X=0 +phy_tx_polarity_flip_phy59.BCM8885X=0 +phy_tx_polarity_flip_phy60.BCM8885X=0 +phy_tx_polarity_flip_phy61.BCM8885X=0 +phy_tx_polarity_flip_phy62.BCM8885X=0 +phy_tx_polarity_flip_phy63.BCM8885X=0 + +phy_tx_polarity_flip_phy64.BCM8885X=0 +phy_tx_polarity_flip_phy65.BCM8885X=1 +phy_tx_polarity_flip_phy66.BCM8885X=1 +phy_tx_polarity_flip_phy67.BCM8885X=0 +phy_tx_polarity_flip_phy68.BCM8885X=1 +phy_tx_polarity_flip_phy69.BCM8885X=0 +phy_tx_polarity_flip_phy70.BCM8885X=0 +phy_tx_polarity_flip_phy71.BCM8885X=1 + +phy_tx_polarity_flip_phy72.BCM8885X=1 +phy_tx_polarity_flip_phy73.BCM8885X=1 +phy_tx_polarity_flip_phy74.BCM8885X=0 +phy_tx_polarity_flip_phy75.BCM8885X=1 +phy_tx_polarity_flip_phy76.BCM8885X=1 +phy_tx_polarity_flip_phy77.BCM8885X=0 +phy_tx_polarity_flip_phy78.BCM8885X=0 +phy_tx_polarity_flip_phy79.BCM8885X=1 + +phy_tx_polarity_flip_phy80.BCM8885X=1 +phy_tx_polarity_flip_phy81.BCM8885X=0 +phy_tx_polarity_flip_phy82.BCM8885X=0 +phy_tx_polarity_flip_phy83.BCM8885X=0 +phy_tx_polarity_flip_phy84.BCM8885X=0 +phy_tx_polarity_flip_phy85.BCM8885X=0 +phy_tx_polarity_flip_phy86.BCM8885X=1 +phy_tx_polarity_flip_phy87.BCM8885X=0 + +phy_tx_polarity_flip_phy88.BCM8885X=1 +phy_tx_polarity_flip_phy89.BCM8885X=0 +phy_tx_polarity_flip_phy90.BCM8885X=1 +phy_tx_polarity_flip_phy91.BCM8885X=1 +phy_tx_polarity_flip_phy92.BCM8885X=1 +phy_tx_polarity_flip_phy93.BCM8885X=0 +phy_tx_polarity_flip_phy94.BCM8885X=1 +phy_tx_polarity_flip_phy95.BCM8885X=1 + +phy_tx_polarity_flip_phy96.BCM8885X=1 +phy_tx_polarity_flip_phy97.BCM8885X=1 +phy_tx_polarity_flip_phy98.BCM8885X=1 +phy_tx_polarity_flip_phy99.BCM8885X=0 +phy_tx_polarity_flip_phy100.BCM8885X=1 +phy_tx_polarity_flip_phy101.BCM8885X=1 +phy_tx_polarity_flip_phy102.BCM8885X=1 +phy_tx_polarity_flip_phy103.BCM8885X=0 + +phy_tx_polarity_flip_phy104.BCM8885X=0 +phy_tx_polarity_flip_phy105.BCM8885X=0 +phy_tx_polarity_flip_phy106.BCM8885X=0 +phy_tx_polarity_flip_phy107.BCM8885X=1 +phy_tx_polarity_flip_phy108.BCM8885X=1 +phy_tx_polarity_flip_phy109.BCM8885X=0 +phy_tx_polarity_flip_phy110.BCM8885X=1 +phy_tx_polarity_flip_phy111.BCM8885X=0 + +phy_tx_polarity_flip_phy112.BCM8885X=0 +phy_tx_polarity_flip_phy113.BCM8885X=1 +phy_tx_polarity_flip_phy114.BCM8885X=1 +phy_tx_polarity_flip_phy115.BCM8885X=0 +phy_tx_polarity_flip_phy116.BCM8885X=0 +phy_tx_polarity_flip_phy117.BCM8885X=1 +phy_tx_polarity_flip_phy118.BCM8885X=0 +phy_tx_polarity_flip_phy119.BCM8885X=0 + +phy_tx_polarity_flip_phy120.BCM8885X=0 +phy_tx_polarity_flip_phy121.BCM8885X=1 +phy_tx_polarity_flip_phy122.BCM8885X=1 +phy_tx_polarity_flip_phy123.BCM8885X=0 +phy_tx_polarity_flip_phy124.BCM8885X=0 +phy_tx_polarity_flip_phy125.BCM8885X=0 +phy_tx_polarity_flip_phy126.BCM8885X=1 +phy_tx_polarity_flip_phy127.BCM8885X=0 + +phy_tx_polarity_flip_phy128.BCM8885X=1 +phy_tx_polarity_flip_phy129.BCM8885X=1 +phy_tx_polarity_flip_phy130.BCM8885X=0 +phy_tx_polarity_flip_phy131.BCM8885X=0 +phy_tx_polarity_flip_phy132.BCM8885X=0 +phy_tx_polarity_flip_phy133.BCM8885X=1 +phy_tx_polarity_flip_phy134.BCM8885X=0 +phy_tx_polarity_flip_phy135.BCM8885X=0 + +phy_tx_polarity_flip_phy136.BCM8885X=0 +phy_tx_polarity_flip_phy137.BCM8885X=0 +phy_tx_polarity_flip_phy138.BCM8885X=0 +phy_tx_polarity_flip_phy139.BCM8885X=0 +phy_tx_polarity_flip_phy140.BCM8885X=0 +phy_tx_polarity_flip_phy141.BCM8885X=0 +phy_tx_polarity_flip_phy142.BCM8885X=0 +phy_tx_polarity_flip_phy143.BCM8885X=0 + + +polled_irq_delay.BCM8885X=5 +polled_irq_mode.BCM8885X=0 +port_fec_fabric.BCM8885X=7 +bcm_stat_interval.BCM8885X=1000000 + + +port_init_cl72_1=0 +port_init_cl72_2=0 +port_init_cl72_3=0 +port_init_cl72_4=0 +port_init_cl72_5=0 +port_init_cl72_6=0 +port_init_cl72_7=0 +port_init_cl72_8=0 +port_init_cl72_9=0 +port_init_cl72_10=0 +port_init_cl72_11=0 +port_init_cl72_12=0 +port_init_cl72_13=0 +port_init_cl72_14=0 +port_init_cl72_15=0 +port_init_cl72_16=0 +port_init_cl72_17=0 +port_init_cl72_18=0 + +port_init_cl72_256=0 +port_init_cl72_257=0 +port_init_cl72_258=0 +port_init_cl72_259=0 +port_init_cl72_260=0 +port_init_cl72_261=0 +port_init_cl72_262=0 +port_init_cl72_263=0 +port_init_cl72_264=0 +port_init_cl72_265=0 +port_init_cl72_266=0 +port_init_cl72_267=0 +port_init_cl72_268=0 +port_init_cl72_269=0 +port_init_cl72_270=0 +port_init_cl72_271=0 +port_init_cl72_272=0 +port_init_cl72_273=0 +port_init_cl72_274=0 +port_init_cl72_275=0 +port_init_cl72_276=0 +port_init_cl72_277=0 +port_init_cl72_278=0 +port_init_cl72_279=0 +port_init_cl72_280=0 +port_init_cl72_281=0 +port_init_cl72_282=0 +port_init_cl72_283=0 +port_init_cl72_284=0 +port_init_cl72_285=0 +port_init_cl72_286=0 +port_init_cl72_287=0 +port_init_cl72_288=0 +port_init_cl72_289=0 +port_init_cl72_290=0 +port_init_cl72_291=0 +port_init_cl72_292=0 +port_init_cl72_293=0 +port_init_cl72_294=0 +port_init_cl72_295=0 +port_init_cl72_296=0 +port_init_cl72_297=0 +port_init_cl72_298=0 +port_init_cl72_299=0 +port_init_cl72_300=0 +port_init_cl72_301=0 +port_init_cl72_302=0 +port_init_cl72_303=0 +port_init_cl72_304=0 +port_init_cl72_305=0 +port_init_cl72_306=0 +port_init_cl72_307=0 +port_init_cl72_308=0 +port_init_cl72_309=0 +port_init_cl72_310=0 +port_init_cl72_311=0 +port_init_cl72_312=0 +port_init_cl72_313=0 +port_init_cl72_314=0 +port_init_cl72_315=0 +port_init_cl72_316=0 +port_init_cl72_317=0 +port_init_cl72_318=0 +port_init_cl72_319=0 +port_init_cl72_320=0 +port_init_cl72_321=0 +port_init_cl72_322=0 +port_init_cl72_323=0 +port_init_cl72_324=0 +port_init_cl72_325=0 +port_init_cl72_326=0 +port_init_cl72_327=0 +port_init_cl72_328=0 +port_init_cl72_329=0 +port_init_cl72_330=0 +port_init_cl72_331=0 +port_init_cl72_332=0 +port_init_cl72_333=0 +port_init_cl72_334=0 +port_init_cl72_335=0 +port_init_cl72_336=0 +port_init_cl72_337=0 +port_init_cl72_338=0 +port_init_cl72_339=0 +port_init_cl72_340=0 +port_init_cl72_341=0 +port_init_cl72_342=0 +port_init_cl72_343=0 +port_init_cl72_344=0 +port_init_cl72_345=0 +port_init_cl72_346=0 +port_init_cl72_347=0 +port_init_cl72_348=0 +port_init_cl72_349=0 +port_init_cl72_350=0 +port_init_cl72_351=0 +port_init_cl72_352=0 +port_init_cl72_353=0 +port_init_cl72_354=0 +port_init_cl72_355=0 +port_init_cl72_356=0 +port_init_cl72_357=0 +port_init_cl72_358=0 +port_init_cl72_359=0 +port_init_cl72_360=0 +port_init_cl72_361=0 +port_init_cl72_362=0 +port_init_cl72_363=0 +port_init_cl72_364=0 +port_init_cl72_365=0 +port_init_cl72_366=0 +port_init_cl72_367=0 +port_init_cl72_368=0 +port_init_cl72_369=0 +port_init_cl72_370=0 +port_init_cl72_371=0 +port_init_cl72_372=0 +port_init_cl72_373=0 +port_init_cl72_374=0 +port_init_cl72_375=0 +port_init_cl72_376=0 +port_init_cl72_377=0 +port_init_cl72_378=0 +port_init_cl72_379=0 +port_init_cl72_380=0 +port_init_cl72_381=0 +port_init_cl72_382=0 +port_init_cl72_383=0 +port_init_cl72_384=0 +port_init_cl72_385=0 +port_init_cl72_386=0 +port_init_cl72_387=0 +port_init_cl72_388=0 +port_init_cl72_389=0 +port_init_cl72_390=0 +port_init_cl72_391=0 +port_init_cl72_392=0 +port_init_cl72_393=0 +port_init_cl72_394=0 +port_init_cl72_395=0 +port_init_cl72_396=0 +port_init_cl72_397=0 +port_init_cl72_398=0 +port_init_cl72_399=0 +port_init_cl72_400=0 +port_init_cl72_401=0 +port_init_cl72_402=0 +port_init_cl72_403=0 +port_init_cl72_404=0 +port_init_cl72_405=0 +port_init_cl72_406=0 +port_init_cl72_407=0 +port_init_cl72_408=0 +port_init_cl72_409=0 +port_init_cl72_410=0 +port_init_cl72_411=0 +port_init_cl72_412=0 +port_init_cl72_413=0 +port_init_cl72_414=0 +port_init_cl72_415=0 +port_init_cl72_416=0 +port_init_cl72_417=0 +port_init_cl72_418=0 +port_init_cl72_419=0 +port_init_cl72_420=0 +port_init_cl72_421=0 +port_init_cl72_422=0 +port_init_cl72_423=0 +port_init_cl72_424=0 +port_init_cl72_425=0 +port_init_cl72_426=0 +port_init_cl72_427=0 +port_init_cl72_428=0 +port_init_cl72_429=0 +port_init_cl72_430=0 +port_init_cl72_431=0 +port_init_cl72_432=0 +port_init_cl72_433=0 +port_init_cl72_434=0 +port_init_cl72_435=0 +port_init_cl72_436=0 +port_init_cl72_437=0 +port_init_cl72_438=0 +port_init_cl72_439=0 +port_init_cl72_440=0 +port_init_cl72_441=0 +port_init_cl72_442=0 +port_init_cl72_443=0 +port_init_cl72_444=0 +port_init_cl72_445=0 +port_init_cl72_446=0 +port_init_cl72_447=0 + + +port_init_speed_cc.BCM8885X=200000 +port_init_speed_cd.BCM8885X=400000 +port_init_speed_ce.BCM8885X=100000 +port_init_speed_fabric.BCM8885X=53125 +port_init_speed_il.BCM8885X=10312 +port_init_speed_le.BCM8885X=50000 +port_init_speed_xe.BCM8885X=10000 +port_init_speed_xl.BCM8885X=40000 +port_priorities.BCM8885X=8 +protocol_traps_mode.BCM8885X=IN_LIF +rate_ext_mdio_divisor=16 +schan_intr_enable.BCM8885X=0 +schan_timeout_usec.BCM8885X=900000 +serdes_fabric_clk_freq_in.BCM8885X=1 +serdes_fabric_clk_freq_out.BCM8885X=bypass +serdes_nif_clk_freq_in0.BCM8885X=1 +serdes_nif_clk_freq_in1.BCM8885X=1 +serdes_nif_clk_freq_out0.BCM8885X=bypass +serdes_nif_clk_freq_out1.BCM8885X=bypass +soc_family.BCM8885X=BCM8885X +stable_filename.BCM8885X=/tmp/warmboot_data +stable_location.BCM8885X=3 +stable_size.BCM8885X=800000000 +sw_state_max_size.BCM8885X=750000000 +system_headers_mode=1 +tdma_intr_enable.BCM8885X=0 +tdma_timeout_usec.BCM8885X=1000000 +tm_port_header_type_in_0.BCM8885X=INJECTED_2 +tm_port_header_type_in_200.BCM8885X=INJECTED_2_PP +tm_port_header_type_in_201.BCM8885X=INJECTED_2_PP +tm_port_header_type_in_202.BCM8885X=INJECTED_2_PP +tm_port_header_type_in_203.BCM8885X=INJECTED_2_PP +tm_port_header_type_in_232.BCM8885X=INJECTED_2 +tm_port_header_type_in_19.BCM8885X=ETH +tm_port_header_type_in_20.BCM8885X=INJECTED_2 +tm_port_header_type_out_0.BCM8885X=CPU +tm_port_header_type_out_200.BCM8885X=ETH +tm_port_header_type_out_201.BCM8885X=ETH +tm_port_header_type_out_202.BCM8885X=ETH +tm_port_header_type_out_203.BCM8885X=ETH +tm_port_header_type_out_232.BCM8885X=CPU +tm_port_header_type_out_19.BCM8885X=ETH +tm_port_header_type_out_20.BCM8885X=RAW +tslam_intr_enable.BCM8885X=0 +tslam_timeout_usec.BCM8885X=1000000 +ucode_port_0.BCM8885X=CPU.0:core_0.0 +ucode_port_200.BCM8885X=CPU.8:core_1.200 +ucode_port_201.BCM8885X=CPU.16:core_1.201 +ucode_port_202.BCM8885X=CPU.24:core_1.202 +ucode_port_203.BCM8885X=CPU.32:core_1.203 + + +ucode_port_1.BCM8885X=CDGE9:core_1.1 +ucode_port_2.BCM8885X=CDGE10:core_1.2 +ucode_port_3.BCM8885X=CDGE11:core_1.3 +ucode_port_4.BCM8885X=CDGE12:core_1.4 +ucode_port_5.BCM8885X=CDGE13:core_1.5 +ucode_port_6.BCM8885X=CDGE14:core_1.6 +ucode_port_7.BCM8885X=CDGE15:core_1.7 +ucode_port_8.BCM8885X=CDGE16:core_1.8 +ucode_port_9.BCM8885X=CDGE17:core_1.9 +ucode_port_10.BCM8885X=CDGE8:core_0.10 +ucode_port_11.BCM8885X=CDGE7:core_0.11 +ucode_port_12.BCM8885X=CDGE6:core_0.12 +ucode_port_13.BCM8885X=CDGE5:core_0.13 +ucode_port_14.BCM8885X=CDGE4:core_0.14 +ucode_port_15.BCM8885X=CDGE3:core_0.15 +ucode_port_16.BCM8885X=CDGE2:core_0.16 +ucode_port_17.BCM8885X=CDGE1:core_0.17 +ucode_port_18.BCM8885X=CDGE0:core_0.18 + + +ucode_port_19.BCM8885X=RCY0:core_0.19 +ucode_port_20.BCM8885X=RCY1:core_1.20 +ucode_port_21.BCM8885X=OLP:core_1.21 + + + +serdes_lane_config_dfe_1.BCM8885X=on +serdes_lane_config_dfe_2.BCM8885X=on +serdes_lane_config_dfe_3.BCM8885X=on +serdes_lane_config_dfe_4.BCM8885X=on +serdes_lane_config_dfe_5.BCM8885X=on +serdes_lane_config_dfe_6.BCM8885X=on +serdes_lane_config_dfe_7.BCM8885X=on +serdes_lane_config_dfe_8.BCM8885X=on +serdes_lane_config_dfe_9.BCM8885X=on +serdes_lane_config_dfe_10.BCM8885X=on +serdes_lane_config_dfe_11.BCM8885X=on +serdes_lane_config_dfe_12.BCM8885X=on +serdes_lane_config_dfe_13.BCM8885X=on +serdes_lane_config_dfe_14.BCM8885X=on +serdes_lane_config_dfe_15.BCM8885X=on +serdes_lane_config_dfe_16.BCM8885X=on +serdes_lane_config_dfe_17.BCM8885X=on +serdes_lane_config_dfe_18.BCM8885X=on + + +serdes_lane_config_channel_mode_1.BCM8885X=force_nr +serdes_lane_config_channel_mode_2.BCM8885X=force_nr +serdes_lane_config_channel_mode_3.BCM8885X=force_nr +serdes_lane_config_channel_mode_4.BCM8885X=force_nr +serdes_lane_config_channel_mode_5.BCM8885X=force_nr +serdes_lane_config_channel_mode_6.BCM8885X=force_nr +serdes_lane_config_channel_mode_7.BCM8885X=force_nr +serdes_lane_config_channel_mode_8.BCM8885X=force_nr +serdes_lane_config_channel_mode_9.BCM8885X=force_nr +serdes_lane_config_channel_mode_10.BCM8885X=force_nr +serdes_lane_config_channel_mode_11.BCM8885X=force_nr +serdes_lane_config_channel_mode_12.BCM8885X=force_nr +serdes_lane_config_channel_mode_13.BCM8885X=force_nr +serdes_lane_config_channel_mode_14.BCM8885X=force_nr +serdes_lane_config_channel_mode_15.BCM8885X=force_nr +serdes_lane_config_channel_mode_16.BCM8885X=force_nr +serdes_lane_config_channel_mode_17.BCM8885X=force_nr +serdes_lane_config_channel_mode_18.BCM8885X=force_nr + + +serdes_lane_config_media_type_1.BCM8885X=backplane +serdes_lane_config_media_type_2.BCM8885X=backplane +serdes_lane_config_media_type_3.BCM8885X=backplane +serdes_lane_config_media_type_4.BCM8885X=backplane +serdes_lane_config_media_type_5.BCM8885X=backplane +serdes_lane_config_media_type_6.BCM8885X=backplane +serdes_lane_config_media_type_7.BCM8885X=backplane +serdes_lane_config_media_type_8.BCM8885X=backplane +serdes_lane_config_media_type_9.BCM8885X=backplane +serdes_lane_config_media_type_10.BCM8885X=backplane +serdes_lane_config_media_type_11.BCM8885X=backplane +serdes_lane_config_media_type_12.BCM8885X=backplane +serdes_lane_config_media_type_13.BCM8885X=backplane +serdes_lane_config_media_type_14.BCM8885X=backplane +serdes_lane_config_media_type_15.BCM8885X=backplane +serdes_lane_config_media_type_16.BCM8885X=backplane +serdes_lane_config_media_type_17.BCM8885X=backplane +serdes_lane_config_media_type_18.BCM8885X=backplane + + +port_fec.1.BCM8885x=9 +port_fec.2.BCM8885x=9 +port_fec.3.BCM8885x=9 +port_fec.4.BCM8885x=9 +port_fec.5.BCM8885x=9 +port_fec.6.BCM8885x=9 +port_fec.7.BCM8885x=9 +port_fec.8.BCM8885x=9 +port_fec.9.BCM8885x=9 +port_fec.10.BCM8885x=9 +port_fec.11.BCM8885x=9 +port_fec.12.BCM8885x=9 +port_fec.13.BCM8885x=9 +port_fec.14.BCM8885x=9 +port_fec.15.BCM8885x=9 +port_fec.16.BCM8885x=9 +port_fec.17.BCM8885x=9 +port_fec.18.BCM8885x=9 + + +serdes_tx_taps_1.BCM8885X=pam4:-8:128:-8:0:0:0 +serdes_tx_taps_2.BCM8885X=pam4:-8:128:-8:0:0:0 +serdes_tx_taps_3.BCM8885X=pam4:-8:132:-12:4:0:0 +serdes_tx_taps_4.BCM8885X=pam4:-8:128:-4:4:0:0 +serdes_tx_taps_5.BCM8885X=pam4:-8:128:-4:4:0:0 +serdes_tx_taps_6.BCM8885X=pam4:-8:136:0:0:0:0 +serdes_tx_taps_7.BCM8885X=pam4:-8:132:-4:0:-4:0 +serdes_tx_taps_8.BCM8885X=pam4:-4:144:0:0:0:0 +serdes_tx_taps_9.BCM8885X=pam4:-8:132:-4:2:-4:0 +serdes_tx_taps_10.BCM8885X=pam4:-4:144:0:0:0:0 +serdes_tx_taps_11.BCM8885X=pam4:-8:132:-4:0:-4:0 +serdes_tx_taps_12.BCM8885X=pam4:-4:144:0:0:0:0 +serdes_tx_taps_13.BCM8885X=pam4:-8:128:-8:4:0:0 +serdes_tx_taps_14.BCM8885X=pam4:-4:144:0:0:0:0 +serdes_tx_taps_15.BCM8885X=pam4:-8:128:-8:4:0:0 +serdes_tx_taps_16.BCM8885X=pam4:-8:136:-4:4:-4:0 +serdes_tx_taps_17.BCM8885X=pam4:-8:132:-8:0:0:0 +serdes_tx_taps_18.BCM8885X=pam4:-4:128:-8:0:0:0 + + +serdes_tx_taps_256.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_257.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_258.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_259.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_260.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_261.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_262.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_263.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_264.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_265.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_266.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_267.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_268.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_269.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_270.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_271.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_272.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_273.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_274.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_275.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_276.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_277.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_278.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_279.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_280.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_281.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_282.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_283.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_284.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_285.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_286.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_287.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_288.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_289.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_290.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_291.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_292.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_293.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_294.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_295.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_296.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_297.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_298.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_299.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_300.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_301.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_302.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_303.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_304.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_305.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_306.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_307.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_308.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_309.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_310.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_311.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_312.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_313.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_314.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_315.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_316.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_317.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_318.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_319.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_320.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_321.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_322.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_323.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_324.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_325.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_326.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_327.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_328.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_329.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_330.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_331.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_332.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_333.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_334.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_335.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_336.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_337.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_338.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_339.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_340.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_341.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_342.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_343.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_344.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_345.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_346.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_347.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_348.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_349.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_350.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_351.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_352.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_353.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_354.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_355.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_356.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_357.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_358.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_359.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_360.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_361.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_362.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_363.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_364.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_365.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_366.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_367.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_368.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_369.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_370.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_371.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_372.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_373.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_374.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_375.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_376.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_377.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_378.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_379.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_380.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_381.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_382.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_383.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_384.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_385.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_386.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_387.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_388.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_389.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_390.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_391.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_392.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_393.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_394.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_395.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_396.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_397.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_398.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_399.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_400.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_401.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_402.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_403.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_404.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_405.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_406.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_407.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_408.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_409.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_410.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_411.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_412.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_413.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_414.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_415.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_416.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_417.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_418.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_419.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_420.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_421.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_422.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_423.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_424.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_425.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_426.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_427.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_428.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_429.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_430.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_431.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_432.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_433.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_434.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_435.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_436.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_437.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_438.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_439.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_440.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_441.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_442.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_443.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_444.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_445.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_446.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_447.BCM8885X=pam4:-20:148:0:0:0:0 + + +serdes_lane_config_channel_mode_256=force_nr +serdes_lane_config_channel_mode_257=force_nr +serdes_lane_config_channel_mode_258=force_nr +serdes_lane_config_channel_mode_259=force_nr +serdes_lane_config_channel_mode_260=force_nr +serdes_lane_config_channel_mode_261=force_nr +serdes_lane_config_channel_mode_262=force_nr +serdes_lane_config_channel_mode_263=force_nr +serdes_lane_config_channel_mode_264=force_nr +serdes_lane_config_channel_mode_265=force_nr +serdes_lane_config_channel_mode_266=force_nr +serdes_lane_config_channel_mode_267=force_nr +serdes_lane_config_channel_mode_268=force_nr +serdes_lane_config_channel_mode_269=force_nr +serdes_lane_config_channel_mode_270=force_nr +serdes_lane_config_channel_mode_271=force_nr +serdes_lane_config_channel_mode_272=force_nr +serdes_lane_config_channel_mode_273=force_nr +serdes_lane_config_channel_mode_274=force_nr +serdes_lane_config_channel_mode_275=force_nr +serdes_lane_config_channel_mode_276=force_nr +serdes_lane_config_channel_mode_277=force_nr +serdes_lane_config_channel_mode_278=force_nr +serdes_lane_config_channel_mode_279=force_nr +serdes_lane_config_channel_mode_280=force_nr +serdes_lane_config_channel_mode_281=force_nr +serdes_lane_config_channel_mode_282=force_nr +serdes_lane_config_channel_mode_283=force_nr +serdes_lane_config_channel_mode_284=force_nr +serdes_lane_config_channel_mode_285=force_nr +serdes_lane_config_channel_mode_286=force_nr +serdes_lane_config_channel_mode_287=force_nr +serdes_lane_config_channel_mode_288=force_nr +serdes_lane_config_channel_mode_289=force_nr +serdes_lane_config_channel_mode_290=force_nr +serdes_lane_config_channel_mode_291=force_nr +serdes_lane_config_channel_mode_292=force_nr +serdes_lane_config_channel_mode_293=force_nr +serdes_lane_config_channel_mode_294=force_nr +serdes_lane_config_channel_mode_295=force_nr +serdes_lane_config_channel_mode_296=force_nr +serdes_lane_config_channel_mode_297=force_nr +serdes_lane_config_channel_mode_298=force_nr +serdes_lane_config_channel_mode_299=force_nr +serdes_lane_config_channel_mode_300=force_nr +serdes_lane_config_channel_mode_301=force_nr +serdes_lane_config_channel_mode_302=force_nr +serdes_lane_config_channel_mode_303=force_nr +serdes_lane_config_channel_mode_304=force_nr +serdes_lane_config_channel_mode_305=force_nr +serdes_lane_config_channel_mode_306=force_nr +serdes_lane_config_channel_mode_307=force_nr +serdes_lane_config_channel_mode_308=force_nr +serdes_lane_config_channel_mode_309=force_nr +serdes_lane_config_channel_mode_310=force_nr +serdes_lane_config_channel_mode_311=force_nr +serdes_lane_config_channel_mode_312=force_nr +serdes_lane_config_channel_mode_313=force_nr +serdes_lane_config_channel_mode_314=force_nr +serdes_lane_config_channel_mode_315=force_nr +serdes_lane_config_channel_mode_316=force_nr +serdes_lane_config_channel_mode_317=force_nr +serdes_lane_config_channel_mode_318=force_nr +serdes_lane_config_channel_mode_319=force_nr +serdes_lane_config_channel_mode_320=force_nr +serdes_lane_config_channel_mode_321=force_nr +serdes_lane_config_channel_mode_322=force_nr +serdes_lane_config_channel_mode_323=force_nr +serdes_lane_config_channel_mode_324=force_nr +serdes_lane_config_channel_mode_325=force_nr +serdes_lane_config_channel_mode_326=force_nr +serdes_lane_config_channel_mode_327=force_nr +serdes_lane_config_channel_mode_328=force_nr +serdes_lane_config_channel_mode_329=force_nr +serdes_lane_config_channel_mode_330=force_nr +serdes_lane_config_channel_mode_331=force_nr +serdes_lane_config_channel_mode_332=force_nr +serdes_lane_config_channel_mode_333=force_nr +serdes_lane_config_channel_mode_334=force_nr +serdes_lane_config_channel_mode_335=force_nr +serdes_lane_config_channel_mode_336=force_nr +serdes_lane_config_channel_mode_337=force_nr +serdes_lane_config_channel_mode_338=force_nr +serdes_lane_config_channel_mode_339=force_nr +serdes_lane_config_channel_mode_340=force_nr +serdes_lane_config_channel_mode_341=force_nr +serdes_lane_config_channel_mode_342=force_nr +serdes_lane_config_channel_mode_343=force_nr +serdes_lane_config_channel_mode_344=force_nr +serdes_lane_config_channel_mode_345=force_nr +serdes_lane_config_channel_mode_346=force_nr +serdes_lane_config_channel_mode_347=force_nr +serdes_lane_config_channel_mode_348=force_nr +serdes_lane_config_channel_mode_349=force_nr +serdes_lane_config_channel_mode_350=force_nr +serdes_lane_config_channel_mode_351=force_nr +serdes_lane_config_channel_mode_352=force_nr +serdes_lane_config_channel_mode_353=force_nr +serdes_lane_config_channel_mode_354=force_nr +serdes_lane_config_channel_mode_355=force_nr +serdes_lane_config_channel_mode_356=force_nr +serdes_lane_config_channel_mode_357=force_nr +serdes_lane_config_channel_mode_358=force_nr +serdes_lane_config_channel_mode_359=force_nr +serdes_lane_config_channel_mode_360=force_nr +serdes_lane_config_channel_mode_361=force_nr +serdes_lane_config_channel_mode_362=force_nr +serdes_lane_config_channel_mode_363=force_nr +serdes_lane_config_channel_mode_364=force_nr +serdes_lane_config_channel_mode_365=force_nr +serdes_lane_config_channel_mode_366=force_nr +serdes_lane_config_channel_mode_367=force_nr +serdes_lane_config_channel_mode_368=force_nr +serdes_lane_config_channel_mode_369=force_nr +serdes_lane_config_channel_mode_370=force_nr +serdes_lane_config_channel_mode_371=force_nr +serdes_lane_config_channel_mode_372=force_nr +serdes_lane_config_channel_mode_373=force_nr +serdes_lane_config_channel_mode_374=force_nr +serdes_lane_config_channel_mode_375=force_nr +serdes_lane_config_channel_mode_376=force_nr +serdes_lane_config_channel_mode_377=force_nr +serdes_lane_config_channel_mode_378=force_nr +serdes_lane_config_channel_mode_379=force_nr +serdes_lane_config_channel_mode_380=force_nr +serdes_lane_config_channel_mode_381=force_nr +serdes_lane_config_channel_mode_382=force_nr +serdes_lane_config_channel_mode_383=force_nr +serdes_lane_config_channel_mode_384=force_nr +serdes_lane_config_channel_mode_385=force_nr +serdes_lane_config_channel_mode_386=force_nr +serdes_lane_config_channel_mode_387=force_nr +serdes_lane_config_channel_mode_388=force_nr +serdes_lane_config_channel_mode_389=force_nr +serdes_lane_config_channel_mode_390=force_nr +serdes_lane_config_channel_mode_391=force_nr +serdes_lane_config_channel_mode_392=force_nr +serdes_lane_config_channel_mode_393=force_nr +serdes_lane_config_channel_mode_394=force_nr +serdes_lane_config_channel_mode_395=force_nr +serdes_lane_config_channel_mode_396=force_nr +serdes_lane_config_channel_mode_397=force_nr +serdes_lane_config_channel_mode_398=force_nr +serdes_lane_config_channel_mode_399=force_nr +serdes_lane_config_channel_mode_400=force_nr +serdes_lane_config_channel_mode_401=force_nr +serdes_lane_config_channel_mode_402=force_nr +serdes_lane_config_channel_mode_403=force_nr +serdes_lane_config_channel_mode_404=force_nr +serdes_lane_config_channel_mode_405=force_nr +serdes_lane_config_channel_mode_406=force_nr +serdes_lane_config_channel_mode_407=force_nr +serdes_lane_config_channel_mode_408=force_nr +serdes_lane_config_channel_mode_409=force_nr +serdes_lane_config_channel_mode_410=force_nr +serdes_lane_config_channel_mode_411=force_nr +serdes_lane_config_channel_mode_412=force_nr +serdes_lane_config_channel_mode_413=force_nr +serdes_lane_config_channel_mode_414=force_nr +serdes_lane_config_channel_mode_415=force_nr +serdes_lane_config_channel_mode_416=force_nr +serdes_lane_config_channel_mode_417=force_nr +serdes_lane_config_channel_mode_418=force_nr +serdes_lane_config_channel_mode_419=force_nr +serdes_lane_config_channel_mode_420=force_nr +serdes_lane_config_channel_mode_421=force_nr +serdes_lane_config_channel_mode_422=force_nr +serdes_lane_config_channel_mode_423=force_nr +serdes_lane_config_channel_mode_424=force_nr +serdes_lane_config_channel_mode_425=force_nr +serdes_lane_config_channel_mode_426=force_nr +serdes_lane_config_channel_mode_427=force_nr +serdes_lane_config_channel_mode_428=force_nr +serdes_lane_config_channel_mode_429=force_nr +serdes_lane_config_channel_mode_430=force_nr +serdes_lane_config_channel_mode_431=force_nr +serdes_lane_config_channel_mode_432=force_nr +serdes_lane_config_channel_mode_433=force_nr +serdes_lane_config_channel_mode_434=force_nr +serdes_lane_config_channel_mode_435=force_nr +serdes_lane_config_channel_mode_436=force_nr +serdes_lane_config_channel_mode_437=force_nr +serdes_lane_config_channel_mode_438=force_nr +serdes_lane_config_channel_mode_439=force_nr +serdes_lane_config_channel_mode_440=force_nr +serdes_lane_config_channel_mode_441=force_nr +serdes_lane_config_channel_mode_442=force_nr +serdes_lane_config_channel_mode_443=force_nr +serdes_lane_config_channel_mode_444=force_nr +serdes_lane_config_channel_mode_445=force_nr +serdes_lane_config_channel_mode_446=force_nr +serdes_lane_config_channel_mode_447=force_nr + +rif_id_max=24576 +dpp_db_path=/usr/share/bcm/db +sai_recycle_port_lane_base=96 +appl_param_nof_ports_per_modid=64 +udh_exists=1 +modreg IPS_FORCE_LOCAL_OR_FABRIC FORCE_FABRIC=1 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/port_config.ini b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/port_config.ini index c05fc0a12dd2..3633842330f8 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/port_config.ini +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/port_config.ini @@ -1,20 +1,21 @@ # name lanes alias index asic_port_name role speed coreid coreportid numvoq -Ethernet0 72,73,74,75,76,77,78,79 Ethernet0 1 Eth0-ASIC0 Ext 400000 1 0 8 -Ethernet1 80,81,82,83,84,85,86,87 Ethernet1 2 Eth1-ASIC0 Ext 400000 1 1 8 -Ethernet2 88,89,90,91,92,93,94,95 Ethernet2 3 Eth2-ASIC0 Ext 400000 1 2 8 -Ethernet3 96,97,98,99,100,101,102,103 Ethernet3 4 Eth3-ASIC0 Ext 400000 1 3 8 -Ethernet4 104,105,106,107,108,109,110,111 Ethernet4 5 Eth4-ASIC0 Ext 400000 1 4 8 -Ethernet5 112,113,114,115,116,117,118,119 Ethernet5 6 Eth5-ASIC0 Ext 400000 1 5 8 -Ethernet6 120,121,122,123,124,125,126,127 Ethernet6 7 Eth6-ASIC0 Ext 400000 1 6 8 -Ethernet7 128,129,130,131,132,133,134,135 Ethernet7 8 Eth7-ASIC0 Ext 400000 1 7 8 -Ethernet8 136,137,138,139,140,141,142,143 Ethernet8 9 Eth8-ASIC0 Ext 400000 1 8 8 -Ethernet9 64,65,66,67,68,69,70,71 Ethernet9 10 Eth9-ASIC0 Ext 400000 0 1 8 -Ethernet10 56,57,58,59,60,61,62,63 Ethernet10 11 Eth10-ASIC0 Ext 400000 0 2 8 -Ethernet11 48,49,50,51,52,53,54,55 Ethernet11 12 Eth11-ASIC0 Ext 400000 0 3 8 -Ethernet12 40,41,42,43,44,45,46,47 Ethernet12 13 Eth12-ASIC0 Ext 400000 0 4 8 -Ethernet13 32,33,34,35,36,37,38,39 Ethernet13 14 Eth13-ASIC0 Ext 400000 0 5 8 -Ethernet14 24,25,26,27,28,29,30,31 Ethernet14 15 Eth14-ASIC0 Ext 400000 0 6 8 -Ethernet15 16,17,18,19,20,21,22,23 Ethernet15 16 Eth15-ASIC0 Ext 400000 0 7 8 -Ethernet16 8,9,10,11,12,13,14,15 Ethernet16 17 Eth16-ASIC0 Ext 400000 0 8 8 -Ethernet17 0,1,2,3,4,5,6,7 Ethernet17 18 Eth17-ASIC0 Ext 400000 0 9 8 -Ethernet-IB0 115 Ethernet-IB0 37 Rcy-ASIC0 Int 10000 0 10 8 +Ethernet0 72,73,74,75,76,77,78,79 Ethernet0 1 Eth0-ASIC0 Ext 400000 1 1 8 +Ethernet1 80,81,82,83,84,85,86,87 Ethernet1 2 Eth1-ASIC0 Ext 400000 1 2 8 +Ethernet2 88,89,90,91,92,93,94,95 Ethernet2 3 Eth2-ASIC0 Ext 400000 1 3 8 +Ethernet3 96,97,98,99,100,101,102,103 Ethernet3 4 Eth3-ASIC0 Ext 400000 1 4 8 +Ethernet4 104,105,106,107,108,109,110,111 Ethernet4 5 Eth4-ASIC0 Ext 400000 1 5 8 +Ethernet5 112,113,114,115,116,117,118,119 Ethernet5 6 Eth5-ASIC0 Ext 400000 1 6 8 +Ethernet6 120,121,122,123,124,125,126,127 Ethernet6 7 Eth6-ASIC0 Ext 400000 1 7 8 +Ethernet7 128,129,130,131,132,133,134,135 Ethernet7 8 Eth7-ASIC0 Ext 400000 1 8 8 +Ethernet8 136,137,138,139,140,141,142,143 Ethernet8 9 Eth8-ASIC0 Ext 400000 1 9 8 +Ethernet9 64,65,66,67,68,69,70,71 Ethernet9 10 Eth9-ASIC0 Ext 400000 0 10 8 +Ethernet10 56,57,58,59,60,61,62,63 Ethernet10 11 Eth10-ASIC0 Ext 400000 0 11 8 +Ethernet11 48,49,50,51,52,53,54,55 Ethernet11 12 Eth11-ASIC0 Ext 400000 0 12 8 +Ethernet12 40,41,42,43,44,45,46,47 Ethernet12 13 Eth12-ASIC0 Ext 400000 0 13 8 +Ethernet13 32,33,34,35,36,37,38,39 Ethernet13 14 Eth13-ASIC0 Ext 400000 0 14 8 +Ethernet14 24,25,26,27,28,29,30,31 Ethernet14 15 Eth14-ASIC0 Ext 400000 0 15 8 +Ethernet15 16,17,18,19,20,21,22,23 Ethernet15 16 Eth15-ASIC0 Ext 400000 0 16 8 +Ethernet16 8,9,10,11,12,13,14,15 Ethernet16 17 Eth16-ASIC0 Ext 400000 0 17 8 +Ethernet17 0,1,2,3,4,5,6,7 Ethernet17 18 Eth17-ASIC0 Ext 400000 0 18 8 +Ethernet-IB0 115 Ethernet-IB0 37 Rcy1-ASIC0 Inb 10000 0 19 8 +Ethernet-Rec0 116 Ethernet-Rec0 39 Rcy2-ASIC0 Rec 10000 1 20 8 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/sai_postinit_cmd.soc b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/sai_postinit_cmd.soc new file mode 100644 index 000000000000..26466f89ae44 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/0/sai_postinit_cmd.soc @@ -0,0 +1,36 @@ +phy set 3 reg=0xd134 data=-8 lane=0 +phy set 3 reg=0xd135 data=132 lane=0 +phy set 3 reg=0xd136 data=-8 lane=0 +phy set 3 reg=0xd137 data=0 lane=0 +phy set 3 reg=0xd138 data=0 lane=0 +phy set 3 reg=0xd133 data=0x1802 lane=0 + +phy set 3 reg=0xd134 data=-8 lane=1 +phy set 3 reg=0xd135 data=132 lane=1 +phy set 3 reg=0xd136 data=-12 lane=1 +phy set 3 reg=0xd137 data=0 lane=1 +phy set 3 reg=0xd138 data=0 lane=1 +phy set 3 reg=0xd133 data=0x1800 lane=1 + +phy set 3 reg=0xd134 data=-8 lane=7 +phy set 3 reg=0xd135 data=132 lane=7 +phy set 3 reg=0xd136 data=-8 lane=7 +phy set 3 reg=0xd137 data=0 lane=7 +phy set 3 reg=0xd138 data=0 lane=7 +phy set 3 reg=0xd133 data=0x1804 lane=7 + + +phy set 6 reg=0xd134 data=-8 lane=1 +phy set 6 reg=0xd135 data=132 lane=1 +phy set 6 reg=0xd136 data=-8 lane=1 +phy set 6 reg=0xd137 data=0 lane=1 +phy set 6 reg=0xd138 data=0 lane=1 +phy set 6 reg=0xd133 data=0x1802 lane=1 + + +phy set 8 reg=0xd134 data=-8 lane=1 +phy set 8 reg=0xd135 data=132 lane=1 +phy set 8 reg=0xd136 data=-8 lane=1 +phy set 8 reg=0xd137 data=0 lane=1 +phy set 8 reg=0xd138 data=0 lane=1 +phy set 8 reg=0xd133 data=0x1802 lane=1 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/jr2cp-nokia-18x400g-config.bcm b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/jr2cp-nokia-18x400g-config.bcm new file mode 100644 index 000000000000..ce7f77de5bb2 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/jr2cp-nokia-18x400g-config.bcm @@ -0,0 +1,2056 @@ +appl_enable_intr_init.BCM8885X=1 +appl_enable_learn_and_limit_init.BCM8885X=0 +appl_enable_oam.BCM8885X=0 +appl_enable_oam_fwd_idx_wa_init.BCM8885X=0 +appl_enable_oam_stat_wa_init.BCM8885X=0 +dma_desc_aggregator_buff_size_kb.BCM8885X=100 +dma_desc_aggregator_chain_length_max.BCM8885X=1000 +dma_desc_aggregator_enable_specific_MDB_LPM.BCM8885X=1 +dma_desc_aggregator_timeout_usec.BCM8885X=1000 +dport_map_direct.BCM8885X=1 +sai_postinit_cmd_file=/usr/share/sonic/hwsku/sai_postinit_cmd.soc +dtm_flow_mapping_mode_region_64.BCM8885X=3 +dtm_flow_mapping_mode_region_65.BCM8885X=3 +dtm_flow_mapping_mode_region_66.BCM8885X=3 +dtm_flow_mapping_mode_region_67.BCM8885X=3 +dtm_flow_mapping_mode_region_68.BCM8885X=3 +dtm_flow_mapping_mode_region_69.BCM8885X=3 +dtm_flow_mapping_mode_region_70.BCM8885X=3 +dtm_flow_mapping_mode_region_71.BCM8885X=3 +dtm_flow_mapping_mode_region_72.BCM8885X=3 +dtm_flow_mapping_mode_region_73.BCM8885X=3 +dtm_flow_mapping_mode_region_74.BCM8885X=3 +dtm_flow_mapping_mode_region_75.BCM8885X=3 +dtm_flow_mapping_mode_region_76.BCM8885X=3 +dtm_flow_mapping_mode_region_77.BCM8885X=3 +dtm_flow_mapping_mode_region_78.BCM8885X=3 +dtm_flow_mapping_mode_region_79.BCM8885X=7 +dtm_flow_mapping_mode_region_80.BCM8885X=3 +dtm_flow_mapping_mode_region_81.BCM8885X=1 +dtm_flow_mapping_mode_region_82.BCM8885X=3 +dtm_flow_mapping_mode_region_83.BCM8885X=3 +dtm_flow_mapping_mode_region_84.BCM8885X=3 +dtm_flow_mapping_mode_region_85.BCM8885X=3 +dtm_flow_mapping_mode_region_86.BCM8885X=3 +dtm_flow_mapping_mode_region_87.BCM8885X=3 +dtm_flow_mapping_mode_region_88.BCM8885X=3 +dtm_flow_mapping_mode_region_89.BCM8885X=3 +dtm_flow_mapping_mode_region_90.BCM8885X=3 +dtm_flow_mapping_mode_region_91.BCM8885X=3 +dtm_flow_mapping_mode_region_92.BCM8885X=3 +dtm_flow_mapping_mode_region_93.BCM8885X=3 +dtm_flow_mapping_mode_region_94.BCM8885X=3 +dtm_flow_nof_remote_cores_region_1.BCM8885X=2 +dtm_flow_nof_remote_cores_region_10.BCM8885X=2 +dtm_flow_nof_remote_cores_region_11.BCM8885X=2 +dtm_flow_nof_remote_cores_region_12.BCM8885X=2 +dtm_flow_nof_remote_cores_region_13.BCM8885X=2 +dtm_flow_nof_remote_cores_region_14.BCM8885X=2 +dtm_flow_nof_remote_cores_region_15.BCM8885X=2 +dtm_flow_nof_remote_cores_region_16.BCM8885X=2 +dtm_flow_nof_remote_cores_region_17.BCM8885X=2 +dtm_flow_nof_remote_cores_region_18.BCM8885X=2 +dtm_flow_nof_remote_cores_region_19.BCM8885X=2 +dtm_flow_nof_remote_cores_region_2.BCM8885X=2 +dtm_flow_nof_remote_cores_region_20.BCM8885X=2 +dtm_flow_nof_remote_cores_region_21.BCM8885X=2 +dtm_flow_nof_remote_cores_region_22.BCM8885X=2 +dtm_flow_nof_remote_cores_region_23.BCM8885X=2 +dtm_flow_nof_remote_cores_region_24.BCM8885X=2 +dtm_flow_nof_remote_cores_region_25.BCM8885X=2 +dtm_flow_nof_remote_cores_region_26.BCM8885X=2 +dtm_flow_nof_remote_cores_region_27.BCM8885X=2 +dtm_flow_nof_remote_cores_region_28.BCM8885X=2 +dtm_flow_nof_remote_cores_region_29.BCM8885X=2 +dtm_flow_nof_remote_cores_region_3.BCM8885X=2 +dtm_flow_nof_remote_cores_region_30.BCM8885X=2 +dtm_flow_nof_remote_cores_region_31.BCM8885X=2 +dtm_flow_nof_remote_cores_region_32.BCM8885X=2 +dtm_flow_nof_remote_cores_region_33.BCM8885X=2 +dtm_flow_nof_remote_cores_region_34.BCM8885X=2 +dtm_flow_nof_remote_cores_region_35.BCM8885X=2 +dtm_flow_nof_remote_cores_region_36.BCM8885X=2 +dtm_flow_nof_remote_cores_region_37.BCM8885X=2 +dtm_flow_nof_remote_cores_region_38.BCM8885X=2 +dtm_flow_nof_remote_cores_region_39.BCM8885X=2 +dtm_flow_nof_remote_cores_region_4.BCM8885X=2 +dtm_flow_nof_remote_cores_region_40.BCM8885X=2 +dtm_flow_nof_remote_cores_region_41.BCM8885X=2 +dtm_flow_nof_remote_cores_region_42.BCM8885X=2 +dtm_flow_nof_remote_cores_region_43.BCM8885X=2 +dtm_flow_nof_remote_cores_region_44.BCM8885X=2 +dtm_flow_nof_remote_cores_region_45.BCM8885X=2 +dtm_flow_nof_remote_cores_region_46.BCM8885X=2 +dtm_flow_nof_remote_cores_region_47.BCM8885X=2 +dtm_flow_nof_remote_cores_region_48.BCM8885X=2 +dtm_flow_nof_remote_cores_region_49.BCM8885X=2 +dtm_flow_nof_remote_cores_region_5.BCM8885X=2 +dtm_flow_nof_remote_cores_region_50.BCM8885X=2 +dtm_flow_nof_remote_cores_region_51.BCM8885X=2 +dtm_flow_nof_remote_cores_region_52.BCM8885X=2 +dtm_flow_nof_remote_cores_region_53.BCM8885X=2 +dtm_flow_nof_remote_cores_region_54.BCM8885X=2 +dtm_flow_nof_remote_cores_region_55.BCM8885X=2 +dtm_flow_nof_remote_cores_region_56.BCM8885X=2 +dtm_flow_nof_remote_cores_region_57.BCM8885X=2 +dtm_flow_nof_remote_cores_region_58.BCM8885X=2 +dtm_flow_nof_remote_cores_region_59.BCM8885X=2 +dtm_flow_nof_remote_cores_region_6.BCM8885X=2 +dtm_flow_nof_remote_cores_region_60.BCM8885X=2 +dtm_flow_nof_remote_cores_region_7.BCM8885X=2 +dtm_flow_nof_remote_cores_region_8.BCM8885X=2 +dtm_flow_nof_remote_cores_region_9.BCM8885X=2 +dtm_flow_nof_remote_cores_region_73.BCM8869X=2 +dtm_flow_mapping_mode_region_73.BCM8869X=0 +dtm_flow_nof_remote_cores_region_74.BCM8869X=2 +dtm_flow_mapping_mode_region_74.BCM8869X=0 +dtm_flow_nof_remote_cores_region_75.BCM8869X=2 +dtm_flow_mapping_mode_region_75.BCM8869X=0 +ext_ram_enabled_bitmap.BCM8885X=3 +ext_ram_freq.BCM8885X=1200 +dram_temperature_threshold_restore_traffic.BCM8885X=89 +dram_temperature_threshold_power_down.BCM8885X=102 +dram_temperature_threshold_stop_traffic.BCM8885X=94 +dram_temperature_monitor_enable.BCM8885X=1 +fabric_connect_mode.BCM8885X=FE +ftmh_stacking_extension_size=0 +j2_ftmh_lb_key_extension_size=3 +j_ftmh_lb_key_extension_size=0 + + +lane_to_serdes_map_fabric_lane0.BCM8885X=rx0:tx0 +lane_to_serdes_map_fabric_lane1.BCM8885X=rx1:tx1 +lane_to_serdes_map_fabric_lane2.BCM8885X=rx2:tx3 +lane_to_serdes_map_fabric_lane3.BCM8885X=rx3:tx2 + +lane_to_serdes_map_fabric_lane4.BCM8885X=rx4:tx4 +lane_to_serdes_map_fabric_lane5.BCM8885X=rx5:tx7 +lane_to_serdes_map_fabric_lane6.BCM8885X=rx6:tx6 +lane_to_serdes_map_fabric_lane7.BCM8885X=rx7:tx5 + +lane_to_serdes_map_fabric_lane8.BCM8885X=rx8:tx8 +lane_to_serdes_map_fabric_lane9.BCM8885X=rx9:tx9 +lane_to_serdes_map_fabric_lane10.BCM8885X=rx10:tx10 +lane_to_serdes_map_fabric_lane11.BCM8885X=rx11:tx11 + +lane_to_serdes_map_fabric_lane12.BCM8885X=rx12:tx12 +lane_to_serdes_map_fabric_lane13.BCM8885X=rx13:tx13 +lane_to_serdes_map_fabric_lane14.BCM8885X=rx14:tx14 +lane_to_serdes_map_fabric_lane15.BCM8885X=rx15:tx15 + +lane_to_serdes_map_fabric_lane16.BCM8885X=rx16:tx16 +lane_to_serdes_map_fabric_lane17.BCM8885X=rx17:tx17 +lane_to_serdes_map_fabric_lane18.BCM8885X=rx18:tx18 +lane_to_serdes_map_fabric_lane19.BCM8885X=rx19:tx19 + +lane_to_serdes_map_fabric_lane20.BCM8885X=rx20:tx20 +lane_to_serdes_map_fabric_lane21.BCM8885X=rx21:tx21 +lane_to_serdes_map_fabric_lane22.BCM8885X=rx22:tx22 +lane_to_serdes_map_fabric_lane23.BCM8885X=rx23:tx23 + +lane_to_serdes_map_fabric_lane24.BCM8885X=rx24:tx26 +lane_to_serdes_map_fabric_lane25.BCM8885X=rx25:tx25 +lane_to_serdes_map_fabric_lane26.BCM8885X=rx26:tx24 +lane_to_serdes_map_fabric_lane27.BCM8885X=rx27:tx27 + +lane_to_serdes_map_fabric_lane28.BCM8885X=rx28:tx28 +lane_to_serdes_map_fabric_lane29.BCM8885X=rx29:tx31 +lane_to_serdes_map_fabric_lane30.BCM8885X=rx30:tx30 +lane_to_serdes_map_fabric_lane31.BCM8885X=rx31:tx29 + +lane_to_serdes_map_fabric_lane32.BCM8885X=rx32:tx32 +lane_to_serdes_map_fabric_lane33.BCM8885X=rx33:tx33 +lane_to_serdes_map_fabric_lane34.BCM8885X=rx34:tx34 +lane_to_serdes_map_fabric_lane35.BCM8885X=rx35:tx35 + +lane_to_serdes_map_fabric_lane36.BCM8885X=rx36:tx36 +lane_to_serdes_map_fabric_lane37.BCM8885X=rx37:tx37 +lane_to_serdes_map_fabric_lane38.BCM8885X=rx38:tx38 +lane_to_serdes_map_fabric_lane39.BCM8885X=rx39:tx39 + +lane_to_serdes_map_fabric_lane40.BCM8885X=rx40:tx43 +lane_to_serdes_map_fabric_lane41.BCM8885X=rx41:tx42 +lane_to_serdes_map_fabric_lane42.BCM8885X=rx42:tx41 +lane_to_serdes_map_fabric_lane43.BCM8885X=rx43:tx40 + +lane_to_serdes_map_fabric_lane44.BCM8885X=rx44:tx47 +lane_to_serdes_map_fabric_lane45.BCM8885X=rx45:tx45 +lane_to_serdes_map_fabric_lane46.BCM8885X=rx46:tx46 +lane_to_serdes_map_fabric_lane47.BCM8885X=rx47:tx44 + +lane_to_serdes_map_fabric_lane48.BCM8885X=rx48:tx48 +lane_to_serdes_map_fabric_lane49.BCM8885X=rx49:tx49 +lane_to_serdes_map_fabric_lane50.BCM8885X=rx50:tx50 +lane_to_serdes_map_fabric_lane51.BCM8885X=rx51:tx51 + +lane_to_serdes_map_fabric_lane52.BCM8885X=rx52:tx52 +lane_to_serdes_map_fabric_lane53.BCM8885X=rx53:tx53 +lane_to_serdes_map_fabric_lane54.BCM8885X=rx54:tx54 +lane_to_serdes_map_fabric_lane55.BCM8885X=rx55:tx55 + +lane_to_serdes_map_fabric_lane56.BCM8885X=rx56:tx59 +lane_to_serdes_map_fabric_lane57.BCM8885X=rx57:tx58 +lane_to_serdes_map_fabric_lane58.BCM8885X=rx58:tx57 +lane_to_serdes_map_fabric_lane59.BCM8885X=rx59:tx56 + +lane_to_serdes_map_fabric_lane60.BCM8885X=rx60:tx63 +lane_to_serdes_map_fabric_lane61.BCM8885X=rx61:tx61 +lane_to_serdes_map_fabric_lane62.BCM8885X=rx62:tx62 +lane_to_serdes_map_fabric_lane63.BCM8885X=rx63:tx60 + +lane_to_serdes_map_fabric_lane64.BCM8885X=rx64:tx64 +lane_to_serdes_map_fabric_lane65.BCM8885X=rx65:tx65 +lane_to_serdes_map_fabric_lane66.BCM8885X=rx66:tx66 +lane_to_serdes_map_fabric_lane67.BCM8885X=rx67:tx67 + +lane_to_serdes_map_fabric_lane68.BCM8885X=rx68:tx68 +lane_to_serdes_map_fabric_lane69.BCM8885X=rx69:tx69 +lane_to_serdes_map_fabric_lane70.BCM8885X=rx70:tx70 +lane_to_serdes_map_fabric_lane71.BCM8885X=rx71:tx71 + +lane_to_serdes_map_fabric_lane72.BCM8885X=rx72:tx75 +lane_to_serdes_map_fabric_lane73.BCM8885X=rx73:tx73 +lane_to_serdes_map_fabric_lane74.BCM8885X=rx74:tx74 +lane_to_serdes_map_fabric_lane75.BCM8885X=rx75:tx72 + +lane_to_serdes_map_fabric_lane76.BCM8885X=rx76:tx79 +lane_to_serdes_map_fabric_lane77.BCM8885X=rx77:tx78 +lane_to_serdes_map_fabric_lane78.BCM8885X=rx78:tx77 +lane_to_serdes_map_fabric_lane79.BCM8885X=rx79:tx76 + +lane_to_serdes_map_fabric_lane80.BCM8885X=rx80:tx80 +lane_to_serdes_map_fabric_lane81.BCM8885X=rx81:tx81 +lane_to_serdes_map_fabric_lane82.BCM8885X=rx82:tx82 +lane_to_serdes_map_fabric_lane83.BCM8885X=rx83:tx83 + +lane_to_serdes_map_fabric_lane84.BCM8885X=rx84:tx84 +lane_to_serdes_map_fabric_lane85.BCM8885X=rx85:tx85 +lane_to_serdes_map_fabric_lane86.BCM8885X=rx86:tx86 +lane_to_serdes_map_fabric_lane87.BCM8885X=rx87:tx87 + +lane_to_serdes_map_fabric_lane88.BCM8885X=rx88:tx88 +lane_to_serdes_map_fabric_lane89.BCM8885X=rx89:tx90 +lane_to_serdes_map_fabric_lane90.BCM8885X=rx90:tx89 +lane_to_serdes_map_fabric_lane91.BCM8885X=rx91:tx91 + +lane_to_serdes_map_fabric_lane92.BCM8885X=rx92:tx94 +lane_to_serdes_map_fabric_lane93.BCM8885X=rx93:tx93 +lane_to_serdes_map_fabric_lane94.BCM8885X=rx94:tx92 +lane_to_serdes_map_fabric_lane95.BCM8885X=rx95:tx95 + +lane_to_serdes_map_fabric_lane96.BCM8885X=rx96:tx96 +lane_to_serdes_map_fabric_lane97.BCM8885X=rx97:tx97 +lane_to_serdes_map_fabric_lane98.BCM8885X=rx98:tx98 +lane_to_serdes_map_fabric_lane99.BCM8885X=rx99:tx99 + +lane_to_serdes_map_fabric_lane100.BCM8885X=rx100:tx100 +lane_to_serdes_map_fabric_lane101.BCM8885X=rx101:tx101 +lane_to_serdes_map_fabric_lane102.BCM8885X=rx102:tx102 +lane_to_serdes_map_fabric_lane103.BCM8885X=rx103:tx103 + +lane_to_serdes_map_fabric_lane104.BCM8885X=rx104:tx104 +lane_to_serdes_map_fabric_lane105.BCM8885X=rx105:tx105 +lane_to_serdes_map_fabric_lane106.BCM8885X=rx106:tx106 +lane_to_serdes_map_fabric_lane107.BCM8885X=rx107:tx107 + +lane_to_serdes_map_fabric_lane108.BCM8885X=rx108:tx108 +lane_to_serdes_map_fabric_lane109.BCM8885X=rx109:tx109 +lane_to_serdes_map_fabric_lane110.BCM8885X=rx110:tx110 +lane_to_serdes_map_fabric_lane111.BCM8885X=rx111:tx111 + +lane_to_serdes_map_fabric_lane112.BCM8885X=rx112:tx114 +lane_to_serdes_map_fabric_lane113.BCM8885X=rx113:tx113 +lane_to_serdes_map_fabric_lane114.BCM8885X=rx114:tx112 +lane_to_serdes_map_fabric_lane115.BCM8885X=rx115:tx115 + +lane_to_serdes_map_fabric_lane116.BCM8885X=rx116:tx116 +lane_to_serdes_map_fabric_lane117.BCM8885X=rx117:tx117 +lane_to_serdes_map_fabric_lane118.BCM8885X=rx118:tx118 +lane_to_serdes_map_fabric_lane119.BCM8885X=rx119:tx119 + +lane_to_serdes_map_fabric_lane120.BCM8885X=rx120:tx120 +lane_to_serdes_map_fabric_lane121.BCM8885X=rx121:tx121 +lane_to_serdes_map_fabric_lane122.BCM8885X=rx122:tx122 +lane_to_serdes_map_fabric_lane123.BCM8885X=rx123:tx123 + +lane_to_serdes_map_fabric_lane124.BCM8885X=rx124:tx124 +lane_to_serdes_map_fabric_lane125.BCM8885X=rx125:tx125 +lane_to_serdes_map_fabric_lane126.BCM8885X=rx126:tx126 +lane_to_serdes_map_fabric_lane127.BCM8885X=rx127:tx127 + +lane_to_serdes_map_fabric_lane128.BCM8885X=rx128:tx128 +lane_to_serdes_map_fabric_lane129.BCM8885X=rx129:tx129 +lane_to_serdes_map_fabric_lane130.BCM8885X=rx130:tx130 +lane_to_serdes_map_fabric_lane131.BCM8885X=rx131:tx131 + +lane_to_serdes_map_fabric_lane132.BCM8885X=rx132:tx132 +lane_to_serdes_map_fabric_lane133.BCM8885X=rx133:tx133 +lane_to_serdes_map_fabric_lane134.BCM8885X=rx134:tx134 +lane_to_serdes_map_fabric_lane135.BCM8885X=rx135:tx135 + +lane_to_serdes_map_fabric_lane136.BCM8885X=rx136:tx139 +lane_to_serdes_map_fabric_lane137.BCM8885X=rx137:tx138 +lane_to_serdes_map_fabric_lane138.BCM8885X=rx138:tx137 +lane_to_serdes_map_fabric_lane139.BCM8885X=rx139:tx136 + +lane_to_serdes_map_fabric_lane140.BCM8885X=rx140:tx143 +lane_to_serdes_map_fabric_lane141.BCM8885X=rx141:tx141 +lane_to_serdes_map_fabric_lane142.BCM8885X=rx142:tx142 +lane_to_serdes_map_fabric_lane143.BCM8885X=rx143:tx140 + +lane_to_serdes_map_fabric_lane144.BCM8885X=rx144:tx144 +lane_to_serdes_map_fabric_lane145.BCM8885X=rx145:tx145 +lane_to_serdes_map_fabric_lane146.BCM8885X=rx146:tx146 +lane_to_serdes_map_fabric_lane147.BCM8885X=rx147:tx147 + +lane_to_serdes_map_fabric_lane148.BCM8885X=rx148:tx148 +lane_to_serdes_map_fabric_lane149.BCM8885X=rx149:tx149 +lane_to_serdes_map_fabric_lane150.BCM8885X=rx150:tx150 +lane_to_serdes_map_fabric_lane151.BCM8885X=rx151:tx151 + +lane_to_serdes_map_fabric_lane152.BCM8885X=rx152:tx155 +lane_to_serdes_map_fabric_lane153.BCM8885X=rx153:tx154 +lane_to_serdes_map_fabric_lane154.BCM8885X=rx154:tx153 +lane_to_serdes_map_fabric_lane155.BCM8885X=rx155:tx152 + +lane_to_serdes_map_fabric_lane156.BCM8885X=rx156:tx159 +lane_to_serdes_map_fabric_lane157.BCM8885X=rx157:tx157 +lane_to_serdes_map_fabric_lane158.BCM8885X=rx158:tx158 +lane_to_serdes_map_fabric_lane159.BCM8885X=rx159:tx156 + +lane_to_serdes_map_fabric_lane160.BCM8885X=rx160:tx160 +lane_to_serdes_map_fabric_lane161.BCM8885X=rx161:tx161 +lane_to_serdes_map_fabric_lane162.BCM8885X=rx162:tx162 +lane_to_serdes_map_fabric_lane163.BCM8885X=rx163:tx163 + +lane_to_serdes_map_fabric_lane164.BCM8885X=rx164:tx164 +lane_to_serdes_map_fabric_lane165.BCM8885X=rx165:tx165 +lane_to_serdes_map_fabric_lane166.BCM8885X=rx166:tx166 +lane_to_serdes_map_fabric_lane167.BCM8885X=rx167:tx167 + +lane_to_serdes_map_fabric_lane168.BCM8885X=rx168:tx171 +lane_to_serdes_map_fabric_lane169.BCM8885X=rx169:tx169 +lane_to_serdes_map_fabric_lane170.BCM8885X=rx170:tx170 +lane_to_serdes_map_fabric_lane171.BCM8885X=rx171:tx168 + +lane_to_serdes_map_fabric_lane172.BCM8885X=rx172:tx175 +lane_to_serdes_map_fabric_lane173.BCM8885X=rx173:tx174 +lane_to_serdes_map_fabric_lane174.BCM8885X=rx174:tx173 +lane_to_serdes_map_fabric_lane175.BCM8885X=rx175:tx172 + +lane_to_serdes_map_fabric_lane176.BCM8885X=rx176:tx176 +lane_to_serdes_map_fabric_lane177.BCM8885X=rx177:tx177 +lane_to_serdes_map_fabric_lane178.BCM8885X=rx178:tx178 +lane_to_serdes_map_fabric_lane179.BCM8885X=rx179:tx179 + +lane_to_serdes_map_fabric_lane180.BCM8885X=rx180:tx180 +lane_to_serdes_map_fabric_lane181.BCM8885X=rx181:tx181 +lane_to_serdes_map_fabric_lane182.BCM8885X=rx182:tx182 +lane_to_serdes_map_fabric_lane183.BCM8885X=rx183:tx183 + +lane_to_serdes_map_fabric_lane184.BCM8885X=rx184:tx184 +lane_to_serdes_map_fabric_lane185.BCM8885X=rx185:tx185 +lane_to_serdes_map_fabric_lane186.BCM8885X=rx186:tx186 +lane_to_serdes_map_fabric_lane187.BCM8885X=rx187:tx187 + +lane_to_serdes_map_fabric_lane188.BCM8885X=rx188:tx190 +lane_to_serdes_map_fabric_lane189.BCM8885X=rx189:tx189 +lane_to_serdes_map_fabric_lane190.BCM8885X=rx190:tx188 +lane_to_serdes_map_fabric_lane191.BCM8885X=rx191:tx191 + + +phy_rx_polarity_flip_fabric0.BCM8885X=0 +phy_rx_polarity_flip_fabric1.BCM8885X=1 +phy_rx_polarity_flip_fabric2.BCM8885X=0 +phy_rx_polarity_flip_fabric3.BCM8885X=0 +phy_rx_polarity_flip_fabric4.BCM8885X=0 +phy_rx_polarity_flip_fabric5.BCM8885X=0 +phy_rx_polarity_flip_fabric6.BCM8885X=0 +phy_rx_polarity_flip_fabric7.BCM8885X=0 +phy_rx_polarity_flip_fabric8.BCM8885X=1 +phy_rx_polarity_flip_fabric9.BCM8885X=1 +phy_rx_polarity_flip_fabric10.BCM8885X=0 +phy_rx_polarity_flip_fabric11.BCM8885X=0 +phy_rx_polarity_flip_fabric12.BCM8885X=1 +phy_rx_polarity_flip_fabric13.BCM8885X=0 +phy_rx_polarity_flip_fabric14.BCM8885X=0 +phy_rx_polarity_flip_fabric15.BCM8885X=1 +phy_rx_polarity_flip_fabric16.BCM8885X=1 +phy_rx_polarity_flip_fabric17.BCM8885X=1 +phy_rx_polarity_flip_fabric18.BCM8885X=0 +phy_rx_polarity_flip_fabric19.BCM8885X=0 +phy_rx_polarity_flip_fabric20.BCM8885X=0 +phy_rx_polarity_flip_fabric21.BCM8885X=0 +phy_rx_polarity_flip_fabric22.BCM8885X=1 +phy_rx_polarity_flip_fabric23.BCM8885X=0 +phy_rx_polarity_flip_fabric24.BCM8885X=1 +phy_rx_polarity_flip_fabric25.BCM8885X=0 +phy_rx_polarity_flip_fabric26.BCM8885X=1 +phy_rx_polarity_flip_fabric27.BCM8885X=1 +phy_rx_polarity_flip_fabric28.BCM8885X=1 +phy_rx_polarity_flip_fabric29.BCM8885X=1 +phy_rx_polarity_flip_fabric30.BCM8885X=0 +phy_rx_polarity_flip_fabric31.BCM8885X=1 +phy_rx_polarity_flip_fabric32.BCM8885X=0 +phy_rx_polarity_flip_fabric33.BCM8885X=1 +phy_rx_polarity_flip_fabric34.BCM8885X=0 +phy_rx_polarity_flip_fabric35.BCM8885X=0 +phy_rx_polarity_flip_fabric36.BCM8885X=0 +phy_rx_polarity_flip_fabric37.BCM8885X=1 +phy_rx_polarity_flip_fabric38.BCM8885X=1 +phy_rx_polarity_flip_fabric39.BCM8885X=0 +phy_rx_polarity_flip_fabric40.BCM8885X=1 +phy_rx_polarity_flip_fabric41.BCM8885X=0 +phy_rx_polarity_flip_fabric42.BCM8885X=0 +phy_rx_polarity_flip_fabric43.BCM8885X=0 +phy_rx_polarity_flip_fabric44.BCM8885X=1 +phy_rx_polarity_flip_fabric45.BCM8885X=0 +phy_rx_polarity_flip_fabric46.BCM8885X=0 +phy_rx_polarity_flip_fabric47.BCM8885X=1 +phy_rx_polarity_flip_fabric48.BCM8885X=1 +phy_rx_polarity_flip_fabric49.BCM8885X=1 +phy_rx_polarity_flip_fabric50.BCM8885X=1 +phy_rx_polarity_flip_fabric51.BCM8885X=1 +phy_rx_polarity_flip_fabric52.BCM8885X=1 +phy_rx_polarity_flip_fabric53.BCM8885X=1 +phy_rx_polarity_flip_fabric54.BCM8885X=1 +phy_rx_polarity_flip_fabric55.BCM8885X=1 +phy_rx_polarity_flip_fabric56.BCM8885X=0 +phy_rx_polarity_flip_fabric57.BCM8885X=0 +phy_rx_polarity_flip_fabric58.BCM8885X=0 +phy_rx_polarity_flip_fabric59.BCM8885X=0 +phy_rx_polarity_flip_fabric60.BCM8885X=0 +phy_rx_polarity_flip_fabric61.BCM8885X=0 +phy_rx_polarity_flip_fabric62.BCM8885X=1 +phy_rx_polarity_flip_fabric63.BCM8885X=0 +phy_rx_polarity_flip_fabric64.BCM8885X=1 +phy_rx_polarity_flip_fabric65.BCM8885X=1 +phy_rx_polarity_flip_fabric66.BCM8885X=0 +phy_rx_polarity_flip_fabric67.BCM8885X=0 +phy_rx_polarity_flip_fabric68.BCM8885X=1 +phy_rx_polarity_flip_fabric69.BCM8885X=1 +phy_rx_polarity_flip_fabric70.BCM8885X=1 +phy_rx_polarity_flip_fabric71.BCM8885X=0 +phy_rx_polarity_flip_fabric72.BCM8885X=0 +phy_rx_polarity_flip_fabric73.BCM8885X=1 +phy_rx_polarity_flip_fabric74.BCM8885X=0 +phy_rx_polarity_flip_fabric75.BCM8885X=1 +phy_rx_polarity_flip_fabric76.BCM8885X=1 +phy_rx_polarity_flip_fabric77.BCM8885X=1 +phy_rx_polarity_flip_fabric78.BCM8885X=1 +phy_rx_polarity_flip_fabric79.BCM8885X=0 +phy_rx_polarity_flip_fabric80.BCM8885X=1 +phy_rx_polarity_flip_fabric81.BCM8885X=0 +phy_rx_polarity_flip_fabric82.BCM8885X=0 +phy_rx_polarity_flip_fabric83.BCM8885X=0 +phy_rx_polarity_flip_fabric84.BCM8885X=1 +phy_rx_polarity_flip_fabric85.BCM8885X=0 +phy_rx_polarity_flip_fabric86.BCM8885X=1 +phy_rx_polarity_flip_fabric87.BCM8885X=0 +phy_rx_polarity_flip_fabric88.BCM8885X=1 +phy_rx_polarity_flip_fabric89.BCM8885X=1 +phy_rx_polarity_flip_fabric90.BCM8885X=1 +phy_rx_polarity_flip_fabric91.BCM8885X=1 +phy_rx_polarity_flip_fabric92.BCM8885X=1 +phy_rx_polarity_flip_fabric93.BCM8885X=1 +phy_rx_polarity_flip_fabric94.BCM8885X=1 +phy_rx_polarity_flip_fabric95.BCM8885X=1 +phy_rx_polarity_flip_fabric96.BCM8885X=0 +phy_rx_polarity_flip_fabric97.BCM8885X=1 +phy_rx_polarity_flip_fabric98.BCM8885X=0 +phy_rx_polarity_flip_fabric99.BCM8885X=0 +phy_rx_polarity_flip_fabric100.BCM8885X=0 +phy_rx_polarity_flip_fabric101.BCM8885X=1 +phy_rx_polarity_flip_fabric102.BCM8885X=1 +phy_rx_polarity_flip_fabric103.BCM8885X=0 +phy_rx_polarity_flip_fabric104.BCM8885X=1 +phy_rx_polarity_flip_fabric105.BCM8885X=0 +phy_rx_polarity_flip_fabric106.BCM8885X=0 +phy_rx_polarity_flip_fabric107.BCM8885X=0 +phy_rx_polarity_flip_fabric108.BCM8885X=1 +phy_rx_polarity_flip_fabric109.BCM8885X=1 +phy_rx_polarity_flip_fabric110.BCM8885X=0 +phy_rx_polarity_flip_fabric111.BCM8885X=1 +phy_rx_polarity_flip_fabric112.BCM8885X=0 +phy_rx_polarity_flip_fabric113.BCM8885X=0 +phy_rx_polarity_flip_fabric114.BCM8885X=1 +phy_rx_polarity_flip_fabric115.BCM8885X=1 +phy_rx_polarity_flip_fabric116.BCM8885X=0 +phy_rx_polarity_flip_fabric117.BCM8885X=1 +phy_rx_polarity_flip_fabric118.BCM8885X=1 +phy_rx_polarity_flip_fabric119.BCM8885X=1 +phy_rx_polarity_flip_fabric120.BCM8885X=1 +phy_rx_polarity_flip_fabric121.BCM8885X=1 +phy_rx_polarity_flip_fabric122.BCM8885X=1 +phy_rx_polarity_flip_fabric123.BCM8885X=0 +phy_rx_polarity_flip_fabric124.BCM8885X=0 +phy_rx_polarity_flip_fabric125.BCM8885X=0 +phy_rx_polarity_flip_fabric126.BCM8885X=0 +phy_rx_polarity_flip_fabric127.BCM8885X=1 +phy_rx_polarity_flip_fabric128.BCM8885X=0 +phy_rx_polarity_flip_fabric129.BCM8885X=0 +phy_rx_polarity_flip_fabric130.BCM8885X=1 +phy_rx_polarity_flip_fabric131.BCM8885X=0 +phy_rx_polarity_flip_fabric132.BCM8885X=0 +phy_rx_polarity_flip_fabric133.BCM8885X=1 +phy_rx_polarity_flip_fabric134.BCM8885X=1 +phy_rx_polarity_flip_fabric135.BCM8885X=0 +phy_rx_polarity_flip_fabric136.BCM8885X=0 +phy_rx_polarity_flip_fabric137.BCM8885X=1 +phy_rx_polarity_flip_fabric138.BCM8885X=1 +phy_rx_polarity_flip_fabric139.BCM8885X=0 +phy_rx_polarity_flip_fabric140.BCM8885X=1 +phy_rx_polarity_flip_fabric141.BCM8885X=0 +phy_rx_polarity_flip_fabric142.BCM8885X=1 +phy_rx_polarity_flip_fabric143.BCM8885X=1 +phy_rx_polarity_flip_fabric144.BCM8885X=1 +phy_rx_polarity_flip_fabric145.BCM8885X=1 +phy_rx_polarity_flip_fabric146.BCM8885X=1 +phy_rx_polarity_flip_fabric147.BCM8885X=0 +phy_rx_polarity_flip_fabric148.BCM8885X=1 +phy_rx_polarity_flip_fabric149.BCM8885X=1 +phy_rx_polarity_flip_fabric150.BCM8885X=0 +phy_rx_polarity_flip_fabric151.BCM8885X=0 +phy_rx_polarity_flip_fabric152.BCM8885X=0 +phy_rx_polarity_flip_fabric153.BCM8885X=0 +phy_rx_polarity_flip_fabric154.BCM8885X=0 +phy_rx_polarity_flip_fabric155.BCM8885X=1 +phy_rx_polarity_flip_fabric156.BCM8885X=0 +phy_rx_polarity_flip_fabric157.BCM8885X=0 +phy_rx_polarity_flip_fabric158.BCM8885X=0 +phy_rx_polarity_flip_fabric159.BCM8885X=1 +phy_rx_polarity_flip_fabric160.BCM8885X=0 +phy_rx_polarity_flip_fabric161.BCM8885X=1 +phy_rx_polarity_flip_fabric162.BCM8885X=1 +phy_rx_polarity_flip_fabric163.BCM8885X=1 +phy_rx_polarity_flip_fabric164.BCM8885X=1 +phy_rx_polarity_flip_fabric165.BCM8885X=0 +phy_rx_polarity_flip_fabric166.BCM8885X=0 +phy_rx_polarity_flip_fabric167.BCM8885X=1 +phy_rx_polarity_flip_fabric168.BCM8885X=0 +phy_rx_polarity_flip_fabric169.BCM8885X=1 +phy_rx_polarity_flip_fabric170.BCM8885X=0 +phy_rx_polarity_flip_fabric171.BCM8885X=0 +phy_rx_polarity_flip_fabric172.BCM8885X=0 +phy_rx_polarity_flip_fabric173.BCM8885X=1 +phy_rx_polarity_flip_fabric174.BCM8885X=1 +phy_rx_polarity_flip_fabric175.BCM8885X=1 +phy_rx_polarity_flip_fabric176.BCM8885X=0 +phy_rx_polarity_flip_fabric177.BCM8885X=1 +phy_rx_polarity_flip_fabric178.BCM8885X=0 +phy_rx_polarity_flip_fabric179.BCM8885X=1 +phy_rx_polarity_flip_fabric180.BCM8885X=1 +phy_rx_polarity_flip_fabric181.BCM8885X=0 +phy_rx_polarity_flip_fabric182.BCM8885X=0 +phy_rx_polarity_flip_fabric183.BCM8885X=0 +phy_rx_polarity_flip_fabric184.BCM8885X=0 +phy_rx_polarity_flip_fabric185.BCM8885X=0 +phy_rx_polarity_flip_fabric186.BCM8885X=1 +phy_rx_polarity_flip_fabric187.BCM8885X=0 +phy_rx_polarity_flip_fabric188.BCM8885X=0 +phy_rx_polarity_flip_fabric189.BCM8885X=0 +phy_rx_polarity_flip_fabric190.BCM8885X=0 +phy_rx_polarity_flip_fabric191.BCM8885X=1 + + +phy_tx_polarity_flip_fabric0.BCM8885X=0 +phy_tx_polarity_flip_fabric1.BCM8885X=0 +phy_tx_polarity_flip_fabric2.BCM8885X=0 +phy_tx_polarity_flip_fabric3.BCM8885X=1 +phy_tx_polarity_flip_fabric4.BCM8885X=1 +phy_tx_polarity_flip_fabric5.BCM8885X=0 +phy_tx_polarity_flip_fabric6.BCM8885X=1 +phy_tx_polarity_flip_fabric7.BCM8885X=1 +phy_tx_polarity_flip_fabric8.BCM8885X=0 +phy_tx_polarity_flip_fabric9.BCM8885X=1 +phy_tx_polarity_flip_fabric10.BCM8885X=1 +phy_tx_polarity_flip_fabric11.BCM8885X=1 +phy_tx_polarity_flip_fabric12.BCM8885X=1 +phy_tx_polarity_flip_fabric13.BCM8885X=0 +phy_tx_polarity_flip_fabric14.BCM8885X=1 +phy_tx_polarity_flip_fabric15.BCM8885X=1 +phy_tx_polarity_flip_fabric16.BCM8885X=1 +phy_tx_polarity_flip_fabric17.BCM8885X=1 +phy_tx_polarity_flip_fabric18.BCM8885X=0 +phy_tx_polarity_flip_fabric19.BCM8885X=0 +phy_tx_polarity_flip_fabric20.BCM8885X=0 +phy_tx_polarity_flip_fabric21.BCM8885X=1 +phy_tx_polarity_flip_fabric22.BCM8885X=1 +phy_tx_polarity_flip_fabric23.BCM8885X=0 +phy_tx_polarity_flip_fabric24.BCM8885X=0 +phy_tx_polarity_flip_fabric25.BCM8885X=1 +phy_tx_polarity_flip_fabric26.BCM8885X=1 +phy_tx_polarity_flip_fabric27.BCM8885X=0 +phy_tx_polarity_flip_fabric28.BCM8885X=1 +phy_tx_polarity_flip_fabric29.BCM8885X=0 +phy_tx_polarity_flip_fabric30.BCM8885X=1 +phy_tx_polarity_flip_fabric31.BCM8885X=0 +phy_tx_polarity_flip_fabric32.BCM8885X=0 +phy_tx_polarity_flip_fabric33.BCM8885X=0 +phy_tx_polarity_flip_fabric34.BCM8885X=0 +phy_tx_polarity_flip_fabric35.BCM8885X=0 +phy_tx_polarity_flip_fabric36.BCM8885X=1 +phy_tx_polarity_flip_fabric37.BCM8885X=1 +phy_tx_polarity_flip_fabric38.BCM8885X=0 +phy_tx_polarity_flip_fabric39.BCM8885X=0 +phy_tx_polarity_flip_fabric40.BCM8885X=1 +phy_tx_polarity_flip_fabric41.BCM8885X=0 +phy_tx_polarity_flip_fabric42.BCM8885X=0 +phy_tx_polarity_flip_fabric43.BCM8885X=1 +phy_tx_polarity_flip_fabric44.BCM8885X=0 +phy_tx_polarity_flip_fabric45.BCM8885X=0 +phy_tx_polarity_flip_fabric46.BCM8885X=1 +phy_tx_polarity_flip_fabric47.BCM8885X=0 +phy_tx_polarity_flip_fabric48.BCM8885X=1 +phy_tx_polarity_flip_fabric49.BCM8885X=1 +phy_tx_polarity_flip_fabric50.BCM8885X=0 +phy_tx_polarity_flip_fabric51.BCM8885X=0 +phy_tx_polarity_flip_fabric52.BCM8885X=1 +phy_tx_polarity_flip_fabric53.BCM8885X=0 +phy_tx_polarity_flip_fabric54.BCM8885X=0 +phy_tx_polarity_flip_fabric55.BCM8885X=1 +phy_tx_polarity_flip_fabric56.BCM8885X=0 +phy_tx_polarity_flip_fabric57.BCM8885X=0 +phy_tx_polarity_flip_fabric58.BCM8885X=1 +phy_tx_polarity_flip_fabric59.BCM8885X=0 +phy_tx_polarity_flip_fabric60.BCM8885X=1 +phy_tx_polarity_flip_fabric61.BCM8885X=1 +phy_tx_polarity_flip_fabric62.BCM8885X=1 +phy_tx_polarity_flip_fabric63.BCM8885X=1 +phy_tx_polarity_flip_fabric64.BCM8885X=1 +phy_tx_polarity_flip_fabric65.BCM8885X=0 +phy_tx_polarity_flip_fabric66.BCM8885X=1 +phy_tx_polarity_flip_fabric67.BCM8885X=0 +phy_tx_polarity_flip_fabric68.BCM8885X=0 +phy_tx_polarity_flip_fabric69.BCM8885X=0 +phy_tx_polarity_flip_fabric70.BCM8885X=0 +phy_tx_polarity_flip_fabric71.BCM8885X=1 +phy_tx_polarity_flip_fabric72.BCM8885X=0 +phy_tx_polarity_flip_fabric73.BCM8885X=1 +phy_tx_polarity_flip_fabric74.BCM8885X=0 +phy_tx_polarity_flip_fabric75.BCM8885X=1 +phy_tx_polarity_flip_fabric76.BCM8885X=0 +phy_tx_polarity_flip_fabric77.BCM8885X=0 +phy_tx_polarity_flip_fabric78.BCM8885X=0 +phy_tx_polarity_flip_fabric79.BCM8885X=1 +phy_tx_polarity_flip_fabric80.BCM8885X=1 +phy_tx_polarity_flip_fabric81.BCM8885X=0 +phy_tx_polarity_flip_fabric82.BCM8885X=0 +phy_tx_polarity_flip_fabric83.BCM8885X=0 +phy_tx_polarity_flip_fabric84.BCM8885X=1 +phy_tx_polarity_flip_fabric85.BCM8885X=0 +phy_tx_polarity_flip_fabric86.BCM8885X=1 +phy_tx_polarity_flip_fabric87.BCM8885X=0 +phy_tx_polarity_flip_fabric88.BCM8885X=1 +phy_tx_polarity_flip_fabric89.BCM8885X=1 +phy_tx_polarity_flip_fabric90.BCM8885X=1 +phy_tx_polarity_flip_fabric91.BCM8885X=1 +phy_tx_polarity_flip_fabric92.BCM8885X=1 +phy_tx_polarity_flip_fabric93.BCM8885X=1 +phy_tx_polarity_flip_fabric94.BCM8885X=0 +phy_tx_polarity_flip_fabric95.BCM8885X=0 +phy_tx_polarity_flip_fabric96.BCM8885X=1 +phy_tx_polarity_flip_fabric97.BCM8885X=1 +phy_tx_polarity_flip_fabric98.BCM8885X=1 +phy_tx_polarity_flip_fabric99.BCM8885X=0 +phy_tx_polarity_flip_fabric100.BCM8885X=0 +phy_tx_polarity_flip_fabric101.BCM8885X=0 +phy_tx_polarity_flip_fabric102.BCM8885X=1 +phy_tx_polarity_flip_fabric103.BCM8885X=1 +phy_tx_polarity_flip_fabric104.BCM8885X=1 +phy_tx_polarity_flip_fabric105.BCM8885X=0 +phy_tx_polarity_flip_fabric106.BCM8885X=1 +phy_tx_polarity_flip_fabric107.BCM8885X=0 +phy_tx_polarity_flip_fabric108.BCM8885X=0 +phy_tx_polarity_flip_fabric109.BCM8885X=1 +phy_tx_polarity_flip_fabric110.BCM8885X=0 +phy_tx_polarity_flip_fabric111.BCM8885X=0 +phy_tx_polarity_flip_fabric112.BCM8885X=1 +phy_tx_polarity_flip_fabric113.BCM8885X=0 +phy_tx_polarity_flip_fabric114.BCM8885X=0 +phy_tx_polarity_flip_fabric115.BCM8885X=1 +phy_tx_polarity_flip_fabric116.BCM8885X=1 +phy_tx_polarity_flip_fabric117.BCM8885X=1 +phy_tx_polarity_flip_fabric118.BCM8885X=0 +phy_tx_polarity_flip_fabric119.BCM8885X=0 +phy_tx_polarity_flip_fabric120.BCM8885X=0 +phy_tx_polarity_flip_fabric121.BCM8885X=0 +phy_tx_polarity_flip_fabric122.BCM8885X=1 +phy_tx_polarity_flip_fabric123.BCM8885X=1 +phy_tx_polarity_flip_fabric124.BCM8885X=0 +phy_tx_polarity_flip_fabric125.BCM8885X=0 +phy_tx_polarity_flip_fabric126.BCM8885X=0 +phy_tx_polarity_flip_fabric127.BCM8885X=1 +phy_tx_polarity_flip_fabric128.BCM8885X=0 +phy_tx_polarity_flip_fabric129.BCM8885X=0 +phy_tx_polarity_flip_fabric130.BCM8885X=0 +phy_tx_polarity_flip_fabric131.BCM8885X=1 +phy_tx_polarity_flip_fabric132.BCM8885X=0 +phy_tx_polarity_flip_fabric133.BCM8885X=0 +phy_tx_polarity_flip_fabric134.BCM8885X=1 +phy_tx_polarity_flip_fabric135.BCM8885X=1 +phy_tx_polarity_flip_fabric136.BCM8885X=1 +phy_tx_polarity_flip_fabric137.BCM8885X=1 +phy_tx_polarity_flip_fabric138.BCM8885X=1 +phy_tx_polarity_flip_fabric139.BCM8885X=1 +phy_tx_polarity_flip_fabric140.BCM8885X=0 +phy_tx_polarity_flip_fabric141.BCM8885X=0 +phy_tx_polarity_flip_fabric142.BCM8885X=0 +phy_tx_polarity_flip_fabric143.BCM8885X=0 +phy_tx_polarity_flip_fabric144.BCM8885X=1 +phy_tx_polarity_flip_fabric145.BCM8885X=1 +phy_tx_polarity_flip_fabric146.BCM8885X=1 +phy_tx_polarity_flip_fabric147.BCM8885X=1 +phy_tx_polarity_flip_fabric148.BCM8885X=1 +phy_tx_polarity_flip_fabric149.BCM8885X=1 +phy_tx_polarity_flip_fabric150.BCM8885X=1 +phy_tx_polarity_flip_fabric151.BCM8885X=1 +phy_tx_polarity_flip_fabric152.BCM8885X=1 +phy_tx_polarity_flip_fabric153.BCM8885X=1 +phy_tx_polarity_flip_fabric154.BCM8885X=1 +phy_tx_polarity_flip_fabric155.BCM8885X=0 +phy_tx_polarity_flip_fabric156.BCM8885X=1 +phy_tx_polarity_flip_fabric157.BCM8885X=0 +phy_tx_polarity_flip_fabric158.BCM8885X=0 +phy_tx_polarity_flip_fabric159.BCM8885X=0 +phy_tx_polarity_flip_fabric160.BCM8885X=0 +phy_tx_polarity_flip_fabric161.BCM8885X=1 +phy_tx_polarity_flip_fabric162.BCM8885X=0 +phy_tx_polarity_flip_fabric163.BCM8885X=1 +phy_tx_polarity_flip_fabric164.BCM8885X=1 +phy_tx_polarity_flip_fabric165.BCM8885X=1 +phy_tx_polarity_flip_fabric166.BCM8885X=0 +phy_tx_polarity_flip_fabric167.BCM8885X=0 +phy_tx_polarity_flip_fabric168.BCM8885X=0 +phy_tx_polarity_flip_fabric169.BCM8885X=0 +phy_tx_polarity_flip_fabric170.BCM8885X=1 +phy_tx_polarity_flip_fabric171.BCM8885X=0 +phy_tx_polarity_flip_fabric172.BCM8885X=0 +phy_tx_polarity_flip_fabric173.BCM8885X=0 +phy_tx_polarity_flip_fabric174.BCM8885X=0 +phy_tx_polarity_flip_fabric175.BCM8885X=1 +phy_tx_polarity_flip_fabric176.BCM8885X=0 +phy_tx_polarity_flip_fabric177.BCM8885X=0 +phy_tx_polarity_flip_fabric178.BCM8885X=0 +phy_tx_polarity_flip_fabric179.BCM8885X=1 +phy_tx_polarity_flip_fabric180.BCM8885X=1 +phy_tx_polarity_flip_fabric181.BCM8885X=0 +phy_tx_polarity_flip_fabric182.BCM8885X=0 +phy_tx_polarity_flip_fabric183.BCM8885X=0 +phy_tx_polarity_flip_fabric184.BCM8885X=0 +phy_tx_polarity_flip_fabric185.BCM8885X=1 +phy_tx_polarity_flip_fabric186.BCM8885X=1 +phy_tx_polarity_flip_fabric187.BCM8885X=0 +phy_tx_polarity_flip_fabric188.BCM8885X=1 +phy_tx_polarity_flip_fabric189.BCM8885X=0 +phy_tx_polarity_flip_fabric190.BCM8885X=0 +phy_tx_polarity_flip_fabric191.BCM8885X=1 + + +lane_to_serdes_map_nif_lane0.BCM8885X=rx0:tx0 +lane_to_serdes_map_nif_lane1.BCM8885X=rx1:tx1 +lane_to_serdes_map_nif_lane2.BCM8885X=rx2:tx2 +lane_to_serdes_map_nif_lane3.BCM8885X=rx3:tx3 +lane_to_serdes_map_nif_lane4.BCM8885X=rx4:tx4 +lane_to_serdes_map_nif_lane5.BCM8885X=rx5:tx5 +lane_to_serdes_map_nif_lane6.BCM8885X=rx6:tx6 +lane_to_serdes_map_nif_lane7.BCM8885X=rx7:tx7 + +lane_to_serdes_map_nif_lane8.BCM8885X=rx8:tx8 +lane_to_serdes_map_nif_lane9.BCM8885X=rx9:tx9 +lane_to_serdes_map_nif_lane10.BCM8885X=rx10:tx10 +lane_to_serdes_map_nif_lane11.BCM8885X=rx11:tx11 +lane_to_serdes_map_nif_lane12.BCM8885X=rx12:tx12 +lane_to_serdes_map_nif_lane13.BCM8885X=rx13:tx13 +lane_to_serdes_map_nif_lane14.BCM8885X=rx14:tx14 +lane_to_serdes_map_nif_lane15.BCM8885X=rx15:tx15 + +lane_to_serdes_map_nif_lane16.BCM8885X=rx16:tx16 +lane_to_serdes_map_nif_lane17.BCM8885X=rx17:tx17 +lane_to_serdes_map_nif_lane18.BCM8885X=rx18:tx18 +lane_to_serdes_map_nif_lane19.BCM8885X=rx19:tx19 +lane_to_serdes_map_nif_lane20.BCM8885X=rx20:tx20 +lane_to_serdes_map_nif_lane21.BCM8885X=rx21:tx21 +lane_to_serdes_map_nif_lane22.BCM8885X=rx22:tx22 +lane_to_serdes_map_nif_lane23.BCM8885X=rx23:tx23 + +lane_to_serdes_map_nif_lane24.BCM8885X=rx24:tx24 +lane_to_serdes_map_nif_lane25.BCM8885X=rx25:tx25 +lane_to_serdes_map_nif_lane26.BCM8885X=rx26:tx26 +lane_to_serdes_map_nif_lane27.BCM8885X=rx27:tx27 +lane_to_serdes_map_nif_lane28.BCM8885X=rx28:tx28 +lane_to_serdes_map_nif_lane29.BCM8885X=rx29:tx29 +lane_to_serdes_map_nif_lane30.BCM8885X=rx30:tx30 +lane_to_serdes_map_nif_lane31.BCM8885X=rx31:tx31 + +lane_to_serdes_map_nif_lane32.BCM8885X=rx32:tx32 +lane_to_serdes_map_nif_lane33.BCM8885X=rx33:tx33 +lane_to_serdes_map_nif_lane34.BCM8885X=rx34:tx34 +lane_to_serdes_map_nif_lane35.BCM8885X=rx35:tx35 +lane_to_serdes_map_nif_lane36.BCM8885X=rx36:tx36 +lane_to_serdes_map_nif_lane37.BCM8885X=rx37:tx37 +lane_to_serdes_map_nif_lane38.BCM8885X=rx38:tx38 +lane_to_serdes_map_nif_lane39.BCM8885X=rx39:tx39 + +lane_to_serdes_map_nif_lane40.BCM8885X=rx40:tx40 +lane_to_serdes_map_nif_lane41.BCM8885X=rx41:tx41 +lane_to_serdes_map_nif_lane42.BCM8885X=rx42:tx42 +lane_to_serdes_map_nif_lane43.BCM8885X=rx43:tx43 +lane_to_serdes_map_nif_lane44.BCM8885X=rx44:tx44 +lane_to_serdes_map_nif_lane45.BCM8885X=rx45:tx45 +lane_to_serdes_map_nif_lane46.BCM8885X=rx46:tx46 +lane_to_serdes_map_nif_lane47.BCM8885X=rx47:tx47 + +lane_to_serdes_map_nif_lane48.BCM8885X=rx48:tx48 +lane_to_serdes_map_nif_lane49.BCM8885X=rx49:tx49 +lane_to_serdes_map_nif_lane50.BCM8885X=rx50:tx50 +lane_to_serdes_map_nif_lane51.BCM8885X=rx51:tx51 +lane_to_serdes_map_nif_lane52.BCM8885X=rx52:tx52 +lane_to_serdes_map_nif_lane53.BCM8885X=rx53:tx53 +lane_to_serdes_map_nif_lane54.BCM8885X=rx54:tx54 +lane_to_serdes_map_nif_lane55.BCM8885X=rx55:tx55 + +lane_to_serdes_map_nif_lane56.BCM8885X=rx56:tx56 +lane_to_serdes_map_nif_lane57.BCM8885X=rx57:tx57 +lane_to_serdes_map_nif_lane58.BCM8885X=rx58:tx58 +lane_to_serdes_map_nif_lane59.BCM8885X=rx59:tx59 +lane_to_serdes_map_nif_lane60.BCM8885X=rx60:tx60 +lane_to_serdes_map_nif_lane61.BCM8885X=rx61:tx61 +lane_to_serdes_map_nif_lane62.BCM8885X=rx62:tx62 +lane_to_serdes_map_nif_lane63.BCM8885X=rx63:tx63 + +lane_to_serdes_map_nif_lane64.BCM8885X=rx64:tx64 +lane_to_serdes_map_nif_lane65.BCM8885X=rx65:tx65 +lane_to_serdes_map_nif_lane66.BCM8885X=rx66:tx66 +lane_to_serdes_map_nif_lane67.BCM8885X=rx67:tx67 +lane_to_serdes_map_nif_lane68.BCM8885X=rx68:tx68 +lane_to_serdes_map_nif_lane69.BCM8885X=rx69:tx69 +lane_to_serdes_map_nif_lane70.BCM8885X=rx70:tx70 +lane_to_serdes_map_nif_lane71.BCM8885X=rx71:tx71 + +lane_to_serdes_map_nif_lane72.BCM8885X=rx72:tx72 +lane_to_serdes_map_nif_lane73.BCM8885X=rx73:tx73 +lane_to_serdes_map_nif_lane74.BCM8885X=rx74:tx74 +lane_to_serdes_map_nif_lane75.BCM8885X=rx75:tx75 +lane_to_serdes_map_nif_lane76.BCM8885X=rx76:tx76 +lane_to_serdes_map_nif_lane77.BCM8885X=rx77:tx77 +lane_to_serdes_map_nif_lane78.BCM8885X=rx78:tx78 +lane_to_serdes_map_nif_lane79.BCM8885X=rx79:tx79 + +lane_to_serdes_map_nif_lane80.BCM8885X=rx80:tx80 +lane_to_serdes_map_nif_lane81.BCM8885X=rx81:tx81 +lane_to_serdes_map_nif_lane82.BCM8885X=rx82:tx82 +lane_to_serdes_map_nif_lane83.BCM8885X=rx83:tx83 +lane_to_serdes_map_nif_lane84.BCM8885X=rx84:tx84 +lane_to_serdes_map_nif_lane85.BCM8885X=rx85:tx85 +lane_to_serdes_map_nif_lane86.BCM8885X=rx86:tx86 +lane_to_serdes_map_nif_lane87.BCM8885X=rx87:tx87 + +lane_to_serdes_map_nif_lane88.BCM8885X=rx88:tx88 +lane_to_serdes_map_nif_lane89.BCM8885X=rx89:tx89 +lane_to_serdes_map_nif_lane90.BCM8885X=rx90:tx90 +lane_to_serdes_map_nif_lane91.BCM8885X=rx91:tx91 +lane_to_serdes_map_nif_lane92.BCM8885X=rx92:tx92 +lane_to_serdes_map_nif_lane93.BCM8885X=rx93:tx93 +lane_to_serdes_map_nif_lane94.BCM8885X=rx94:tx94 +lane_to_serdes_map_nif_lane95.BCM8885X=rx95:tx95 + +lane_to_serdes_map_nif_lane96.BCM8885X=rx96:tx96 +lane_to_serdes_map_nif_lane97.BCM8885X=rx97:tx97 +lane_to_serdes_map_nif_lane98.BCM8885X=rx98:tx98 +lane_to_serdes_map_nif_lane99.BCM8885X=rx99:tx99 +lane_to_serdes_map_nif_lane100.BCM8885X=rx100:tx100 +lane_to_serdes_map_nif_lane101.BCM8885X=rx101:tx101 +lane_to_serdes_map_nif_lane102.BCM8885X=rx102:tx102 +lane_to_serdes_map_nif_lane103.BCM8885X=rx103:tx103 + +lane_to_serdes_map_nif_lane104.BCM8885X=rx104:tx104 +lane_to_serdes_map_nif_lane105.BCM8885X=rx105:tx105 +lane_to_serdes_map_nif_lane106.BCM8885X=rx106:tx106 +lane_to_serdes_map_nif_lane107.BCM8885X=rx107:tx107 +lane_to_serdes_map_nif_lane108.BCM8885X=rx108:tx108 +lane_to_serdes_map_nif_lane109.BCM8885X=rx109:tx109 +lane_to_serdes_map_nif_lane110.BCM8885X=rx110:tx110 +lane_to_serdes_map_nif_lane111.BCM8885X=rx111:tx111 + +lane_to_serdes_map_nif_lane112.BCM8885X=rx112:tx112 +lane_to_serdes_map_nif_lane113.BCM8885X=rx113:tx113 +lane_to_serdes_map_nif_lane114.BCM8885X=rx114:tx114 +lane_to_serdes_map_nif_lane115.BCM8885X=rx115:tx115 +lane_to_serdes_map_nif_lane116.BCM8885X=rx116:tx116 +lane_to_serdes_map_nif_lane117.BCM8885X=rx117:tx117 +lane_to_serdes_map_nif_lane118.BCM8885X=rx118:tx118 +lane_to_serdes_map_nif_lane119.BCM8885X=rx119:tx119 + +lane_to_serdes_map_nif_lane120.BCM8885X=rx120:tx120 +lane_to_serdes_map_nif_lane121.BCM8885X=rx121:tx121 +lane_to_serdes_map_nif_lane122.BCM8885X=rx122:tx122 +lane_to_serdes_map_nif_lane123.BCM8885X=rx123:tx123 +lane_to_serdes_map_nif_lane124.BCM8885X=rx124:tx124 +lane_to_serdes_map_nif_lane125.BCM8885X=rx125:tx125 +lane_to_serdes_map_nif_lane126.BCM8885X=rx126:tx126 +lane_to_serdes_map_nif_lane127.BCM8885X=rx127:tx127 + +lane_to_serdes_map_nif_lane128.BCM8885X=rx128:tx128 +lane_to_serdes_map_nif_lane129.BCM8885X=rx129:tx129 +lane_to_serdes_map_nif_lane130.BCM8885X=rx130:tx130 +lane_to_serdes_map_nif_lane131.BCM8885X=rx131:tx131 +lane_to_serdes_map_nif_lane132.BCM8885X=rx132:tx132 +lane_to_serdes_map_nif_lane133.BCM8885X=rx133:tx133 +lane_to_serdes_map_nif_lane134.BCM8885X=rx134:tx134 +lane_to_serdes_map_nif_lane135.BCM8885X=rx135:tx135 + +lane_to_serdes_map_nif_lane136.BCM8885X=rx136:tx136 +lane_to_serdes_map_nif_lane137.BCM8885X=rx137:tx137 +lane_to_serdes_map_nif_lane138.BCM8885X=rx138:tx138 +lane_to_serdes_map_nif_lane139.BCM8885X=rx139:tx139 +lane_to_serdes_map_nif_lane140.BCM8885X=rx140:tx140 +lane_to_serdes_map_nif_lane141.BCM8885X=rx141:tx141 +lane_to_serdes_map_nif_lane142.BCM8885X=rx142:tx142 +lane_to_serdes_map_nif_lane143.BCM8885X=rx143:tx143 + + +mdb_profile=Balanced-Exem +mdb_profile_kaps_cfg.BCM8885X=2 +mdio_output_delay=16 +mem_cache_enable_ecc.BCM8885X=1 +mem_cache_enable_parity.BCM8885X=1 +miim_intr_enable.BCM8885X=0 +os=unix +outlif_logical_to_physical_phase_map_1=S1 +outlif_logical_to_physical_phase_map_2=L1 +outlif_logical_to_physical_phase_map_3=XL +outlif_logical_to_physical_phase_map_4=L2 +outlif_logical_to_physical_phase_map_5=M1 +outlif_logical_to_physical_phase_map_6=M2 +outlif_logical_to_physical_phase_map_7=M3 +outlif_logical_to_physical_phase_map_8=S2 +outlif_physical_phase_data_granularity_L1=60 +outlif_physical_phase_data_granularity_L2=60 +outlif_physical_phase_data_granularity_M1=60 +outlif_physical_phase_data_granularity_M2=60 +outlif_physical_phase_data_granularity_M3=60 +outlif_physical_phase_data_granularity_S1=60 +outlif_physical_phase_data_granularity_S2=60 +outlif_physical_phase_data_granularity_XL=60 +pdma_continuous_mode_enable.BCM8885X=1 + + +phy_rx_polarity_flip_phy0.BCM8885X=0 +phy_rx_polarity_flip_phy1.BCM8885X=0 +phy_rx_polarity_flip_phy2.BCM8885X=1 +phy_rx_polarity_flip_phy3.BCM8885X=0 +phy_rx_polarity_flip_phy4.BCM8885X=0 +phy_rx_polarity_flip_phy5.BCM8885X=0 +phy_rx_polarity_flip_phy6.BCM8885X=1 +phy_rx_polarity_flip_phy7.BCM8885X=0 + +phy_rx_polarity_flip_phy8.BCM8885X=0 +phy_rx_polarity_flip_phy9.BCM8885X=1 +phy_rx_polarity_flip_phy10.BCM8885X=1 +phy_rx_polarity_flip_phy11.BCM8885X=1 +phy_rx_polarity_flip_phy12.BCM8885X=1 +phy_rx_polarity_flip_phy13.BCM8885X=0 +phy_rx_polarity_flip_phy14.BCM8885X=0 +phy_rx_polarity_flip_phy15.BCM8885X=1 + +phy_rx_polarity_flip_phy16.BCM8885X=1 +phy_rx_polarity_flip_phy17.BCM8885X=0 +phy_rx_polarity_flip_phy18.BCM8885X=1 +phy_rx_polarity_flip_phy19.BCM8885X=0 +phy_rx_polarity_flip_phy20.BCM8885X=1 +phy_rx_polarity_flip_phy21.BCM8885X=1 +phy_rx_polarity_flip_phy22.BCM8885X=1 +phy_rx_polarity_flip_phy23.BCM8885X=1 + +phy_rx_polarity_flip_phy24.BCM8885X=0 +phy_rx_polarity_flip_phy25.BCM8885X=1 +phy_rx_polarity_flip_phy26.BCM8885X=0 +phy_rx_polarity_flip_phy27.BCM8885X=1 +phy_rx_polarity_flip_phy28.BCM8885X=1 +phy_rx_polarity_flip_phy29.BCM8885X=1 +phy_rx_polarity_flip_phy30.BCM8885X=0 +phy_rx_polarity_flip_phy31.BCM8885X=1 + +phy_rx_polarity_flip_phy32.BCM8885X=1 +phy_rx_polarity_flip_phy33.BCM8885X=0 +phy_rx_polarity_flip_phy34.BCM8885X=1 +phy_rx_polarity_flip_phy35.BCM8885X=0 +phy_rx_polarity_flip_phy36.BCM8885X=0 +phy_rx_polarity_flip_phy37.BCM8885X=0 +phy_rx_polarity_flip_phy38.BCM8885X=0 +phy_rx_polarity_flip_phy39.BCM8885X=1 + +phy_rx_polarity_flip_phy40.BCM8885X=1 +phy_rx_polarity_flip_phy41.BCM8885X=1 +phy_rx_polarity_flip_phy42.BCM8885X=0 +phy_rx_polarity_flip_phy43.BCM8885X=1 +phy_rx_polarity_flip_phy44.BCM8885X=1 +phy_rx_polarity_flip_phy45.BCM8885X=0 +phy_rx_polarity_flip_phy46.BCM8885X=0 +phy_rx_polarity_flip_phy47.BCM8885X=1 + +phy_rx_polarity_flip_phy48.BCM8885X=0 +phy_rx_polarity_flip_phy49.BCM8885X=1 +phy_rx_polarity_flip_phy50.BCM8885X=0 +phy_rx_polarity_flip_phy51.BCM8885X=0 +phy_rx_polarity_flip_phy52.BCM8885X=0 +phy_rx_polarity_flip_phy53.BCM8885X=1 +phy_rx_polarity_flip_phy54.BCM8885X=0 +phy_rx_polarity_flip_phy55.BCM8885X=0 + +phy_rx_polarity_flip_phy56.BCM8885X=0 +phy_rx_polarity_flip_phy57.BCM8885X=0 +phy_rx_polarity_flip_phy58.BCM8885X=0 +phy_rx_polarity_flip_phy59.BCM8885X=0 +phy_rx_polarity_flip_phy60.BCM8885X=0 +phy_rx_polarity_flip_phy61.BCM8885X=0 +phy_rx_polarity_flip_phy62.BCM8885X=1 +phy_rx_polarity_flip_phy63.BCM8885X=1 + +phy_rx_polarity_flip_phy64.BCM8885X=0 +phy_rx_polarity_flip_phy65.BCM8885X=0 +phy_rx_polarity_flip_phy66.BCM8885X=0 +phy_rx_polarity_flip_phy67.BCM8885X=0 +phy_rx_polarity_flip_phy68.BCM8885X=0 +phy_rx_polarity_flip_phy69.BCM8885X=0 +phy_rx_polarity_flip_phy70.BCM8885X=0 +phy_rx_polarity_flip_phy71.BCM8885X=0 + +phy_rx_polarity_flip_phy72.BCM8885X=1 +phy_rx_polarity_flip_phy73.BCM8885X=0 +phy_rx_polarity_flip_phy74.BCM8885X=0 +phy_rx_polarity_flip_phy75.BCM8885X=1 +phy_rx_polarity_flip_phy76.BCM8885X=1 +phy_rx_polarity_flip_phy77.BCM8885X=1 +phy_rx_polarity_flip_phy78.BCM8885X=0 +phy_rx_polarity_flip_phy79.BCM8885X=1 + +phy_rx_polarity_flip_phy80.BCM8885X=1 +phy_rx_polarity_flip_phy81.BCM8885X=0 +phy_rx_polarity_flip_phy82.BCM8885X=1 +phy_rx_polarity_flip_phy83.BCM8885X=1 +phy_rx_polarity_flip_phy84.BCM8885X=0 +phy_rx_polarity_flip_phy85.BCM8885X=0 +phy_rx_polarity_flip_phy86.BCM8885X=1 +phy_rx_polarity_flip_phy87.BCM8885X=1 + +phy_rx_polarity_flip_phy88.BCM8885X=0 +phy_rx_polarity_flip_phy89.BCM8885X=1 +phy_rx_polarity_flip_phy90.BCM8885X=0 +phy_rx_polarity_flip_phy91.BCM8885X=0 +phy_rx_polarity_flip_phy92.BCM8885X=0 +phy_rx_polarity_flip_phy93.BCM8885X=0 +phy_rx_polarity_flip_phy94.BCM8885X=0 +phy_rx_polarity_flip_phy95.BCM8885X=1 + +phy_rx_polarity_flip_phy96.BCM8885X=0 +phy_rx_polarity_flip_phy97.BCM8885X=0 +phy_rx_polarity_flip_phy98.BCM8885X=0 +phy_rx_polarity_flip_phy99.BCM8885X=0 +phy_rx_polarity_flip_phy100.BCM8885X=0 +phy_rx_polarity_flip_phy101.BCM8885X=1 +phy_rx_polarity_flip_phy102.BCM8885X=1 +phy_rx_polarity_flip_phy103.BCM8885X=0 + +phy_rx_polarity_flip_phy104.BCM8885X=1 +phy_rx_polarity_flip_phy105.BCM8885X=1 +phy_rx_polarity_flip_phy106.BCM8885X=1 +phy_rx_polarity_flip_phy107.BCM8885X=1 +phy_rx_polarity_flip_phy108.BCM8885X=0 +phy_rx_polarity_flip_phy109.BCM8885X=1 +phy_rx_polarity_flip_phy110.BCM8885X=1 +phy_rx_polarity_flip_phy111.BCM8885X=1 + +phy_rx_polarity_flip_phy112.BCM8885X=0 +phy_rx_polarity_flip_phy113.BCM8885X=1 +phy_rx_polarity_flip_phy114.BCM8885X=1 +phy_rx_polarity_flip_phy115.BCM8885X=1 +phy_rx_polarity_flip_phy116.BCM8885X=1 +phy_rx_polarity_flip_phy117.BCM8885X=1 +phy_rx_polarity_flip_phy118.BCM8885X=0 +phy_rx_polarity_flip_phy119.BCM8885X=0 + +phy_rx_polarity_flip_phy120.BCM8885X=1 +phy_rx_polarity_flip_phy121.BCM8885X=0 +phy_rx_polarity_flip_phy122.BCM8885X=0 +phy_rx_polarity_flip_phy123.BCM8885X=1 +phy_rx_polarity_flip_phy124.BCM8885X=0 +phy_rx_polarity_flip_phy125.BCM8885X=1 +phy_rx_polarity_flip_phy126.BCM8885X=1 +phy_rx_polarity_flip_phy127.BCM8885X=0 + +phy_rx_polarity_flip_phy128.BCM8885X=0 +phy_rx_polarity_flip_phy129.BCM8885X=0 +phy_rx_polarity_flip_phy130.BCM8885X=1 +phy_rx_polarity_flip_phy131.BCM8885X=0 +phy_rx_polarity_flip_phy132.BCM8885X=0 +phy_rx_polarity_flip_phy133.BCM8885X=1 +phy_rx_polarity_flip_phy134.BCM8885X=1 +phy_rx_polarity_flip_phy135.BCM8885X=0 + +phy_rx_polarity_flip_phy136.BCM8885X=1 +phy_rx_polarity_flip_phy137.BCM8885X=0 +phy_rx_polarity_flip_phy138.BCM8885X=0 +phy_rx_polarity_flip_phy139.BCM8885X=1 +phy_rx_polarity_flip_phy140.BCM8885X=1 +phy_rx_polarity_flip_phy141.BCM8885X=1 +phy_rx_polarity_flip_phy142.BCM8885X=0 +phy_rx_polarity_flip_phy143.BCM8885X=1 + + +phy_tx_polarity_flip_phy0.BCM8885X=1 +phy_tx_polarity_flip_phy1.BCM8885X=1 +phy_tx_polarity_flip_phy2.BCM8885X=0 +phy_tx_polarity_flip_phy3.BCM8885X=1 +phy_tx_polarity_flip_phy4.BCM8885X=1 +phy_tx_polarity_flip_phy5.BCM8885X=0 +phy_tx_polarity_flip_phy6.BCM8885X=0 +phy_tx_polarity_flip_phy7.BCM8885X=1 + +phy_tx_polarity_flip_phy8.BCM8885X=0 +phy_tx_polarity_flip_phy9.BCM8885X=1 +phy_tx_polarity_flip_phy10.BCM8885X=0 +phy_tx_polarity_flip_phy11.BCM8885X=1 +phy_tx_polarity_flip_phy12.BCM8885X=1 +phy_tx_polarity_flip_phy13.BCM8885X=1 +phy_tx_polarity_flip_phy14.BCM8885X=0 +phy_tx_polarity_flip_phy15.BCM8885X=1 + +phy_tx_polarity_flip_phy16.BCM8885X=1 +phy_tx_polarity_flip_phy17.BCM8885X=1 +phy_tx_polarity_flip_phy18.BCM8885X=0 +phy_tx_polarity_flip_phy19.BCM8885X=0 +phy_tx_polarity_flip_phy20.BCM8885X=1 +phy_tx_polarity_flip_phy21.BCM8885X=1 +phy_tx_polarity_flip_phy22.BCM8885X=0 +phy_tx_polarity_flip_phy23.BCM8885X=0 + +phy_tx_polarity_flip_phy24.BCM8885X=0 +phy_tx_polarity_flip_phy25.BCM8885X=0 +phy_tx_polarity_flip_phy26.BCM8885X=0 +phy_tx_polarity_flip_phy27.BCM8885X=1 +phy_tx_polarity_flip_phy28.BCM8885X=0 +phy_tx_polarity_flip_phy29.BCM8885X=0 +phy_tx_polarity_flip_phy30.BCM8885X=0 +phy_tx_polarity_flip_phy31.BCM8885X=0 + +phy_tx_polarity_flip_phy32.BCM8885X=1 +phy_tx_polarity_flip_phy33.BCM8885X=1 +phy_tx_polarity_flip_phy34.BCM8885X=1 +phy_tx_polarity_flip_phy35.BCM8885X=0 +phy_tx_polarity_flip_phy36.BCM8885X=1 +phy_tx_polarity_flip_phy37.BCM8885X=1 +phy_tx_polarity_flip_phy38.BCM8885X=1 +phy_tx_polarity_flip_phy39.BCM8885X=0 + +phy_tx_polarity_flip_phy40.BCM8885X=0 +phy_tx_polarity_flip_phy41.BCM8885X=0 +phy_tx_polarity_flip_phy42.BCM8885X=1 +phy_tx_polarity_flip_phy43.BCM8885X=1 +phy_tx_polarity_flip_phy44.BCM8885X=0 +phy_tx_polarity_flip_phy45.BCM8885X=0 +phy_tx_polarity_flip_phy46.BCM8885X=1 +phy_tx_polarity_flip_phy47.BCM8885X=0 + +phy_tx_polarity_flip_phy48.BCM8885X=1 +phy_tx_polarity_flip_phy49.BCM8885X=1 +phy_tx_polarity_flip_phy50.BCM8885X=1 +phy_tx_polarity_flip_phy51.BCM8885X=0 +phy_tx_polarity_flip_phy52.BCM8885X=1 +phy_tx_polarity_flip_phy53.BCM8885X=0 +phy_tx_polarity_flip_phy54.BCM8885X=0 +phy_tx_polarity_flip_phy55.BCM8885X=0 + +phy_tx_polarity_flip_phy56.BCM8885X=0 +phy_tx_polarity_flip_phy57.BCM8885X=1 +phy_tx_polarity_flip_phy58.BCM8885X=0 +phy_tx_polarity_flip_phy59.BCM8885X=0 +phy_tx_polarity_flip_phy60.BCM8885X=0 +phy_tx_polarity_flip_phy61.BCM8885X=0 +phy_tx_polarity_flip_phy62.BCM8885X=0 +phy_tx_polarity_flip_phy63.BCM8885X=0 + +phy_tx_polarity_flip_phy64.BCM8885X=0 +phy_tx_polarity_flip_phy65.BCM8885X=1 +phy_tx_polarity_flip_phy66.BCM8885X=1 +phy_tx_polarity_flip_phy67.BCM8885X=0 +phy_tx_polarity_flip_phy68.BCM8885X=1 +phy_tx_polarity_flip_phy69.BCM8885X=0 +phy_tx_polarity_flip_phy70.BCM8885X=0 +phy_tx_polarity_flip_phy71.BCM8885X=1 + +phy_tx_polarity_flip_phy72.BCM8885X=1 +phy_tx_polarity_flip_phy73.BCM8885X=1 +phy_tx_polarity_flip_phy74.BCM8885X=0 +phy_tx_polarity_flip_phy75.BCM8885X=1 +phy_tx_polarity_flip_phy76.BCM8885X=1 +phy_tx_polarity_flip_phy77.BCM8885X=1 +phy_tx_polarity_flip_phy78.BCM8885X=0 +phy_tx_polarity_flip_phy79.BCM8885X=1 + +phy_tx_polarity_flip_phy80.BCM8885X=1 +phy_tx_polarity_flip_phy81.BCM8885X=0 +phy_tx_polarity_flip_phy82.BCM8885X=0 +phy_tx_polarity_flip_phy83.BCM8885X=0 +phy_tx_polarity_flip_phy84.BCM8885X=0 +phy_tx_polarity_flip_phy85.BCM8885X=0 +phy_tx_polarity_flip_phy86.BCM8885X=1 +phy_tx_polarity_flip_phy87.BCM8885X=0 + +phy_tx_polarity_flip_phy88.BCM8885X=1 +phy_tx_polarity_flip_phy89.BCM8885X=0 +phy_tx_polarity_flip_phy90.BCM8885X=1 +phy_tx_polarity_flip_phy91.BCM8885X=1 +phy_tx_polarity_flip_phy92.BCM8885X=1 +phy_tx_polarity_flip_phy93.BCM8885X=0 +phy_tx_polarity_flip_phy94.BCM8885X=1 +phy_tx_polarity_flip_phy95.BCM8885X=1 + +phy_tx_polarity_flip_phy96.BCM8885X=1 +phy_tx_polarity_flip_phy97.BCM8885X=1 +phy_tx_polarity_flip_phy98.BCM8885X=1 +phy_tx_polarity_flip_phy99.BCM8885X=0 +phy_tx_polarity_flip_phy100.BCM8885X=1 +phy_tx_polarity_flip_phy101.BCM8885X=1 +phy_tx_polarity_flip_phy102.BCM8885X=1 +phy_tx_polarity_flip_phy103.BCM8885X=0 + +phy_tx_polarity_flip_phy104.BCM8885X=0 +phy_tx_polarity_flip_phy105.BCM8885X=0 +phy_tx_polarity_flip_phy106.BCM8885X=0 +phy_tx_polarity_flip_phy107.BCM8885X=1 +phy_tx_polarity_flip_phy108.BCM8885X=1 +phy_tx_polarity_flip_phy109.BCM8885X=0 +phy_tx_polarity_flip_phy110.BCM8885X=1 +phy_tx_polarity_flip_phy111.BCM8885X=0 + +phy_tx_polarity_flip_phy112.BCM8885X=0 +phy_tx_polarity_flip_phy113.BCM8885X=1 +phy_tx_polarity_flip_phy114.BCM8885X=1 +phy_tx_polarity_flip_phy115.BCM8885X=0 +phy_tx_polarity_flip_phy116.BCM8885X=0 +phy_tx_polarity_flip_phy117.BCM8885X=1 +phy_tx_polarity_flip_phy118.BCM8885X=0 +phy_tx_polarity_flip_phy119.BCM8885X=0 + +phy_tx_polarity_flip_phy120.BCM8885X=0 +phy_tx_polarity_flip_phy121.BCM8885X=1 +phy_tx_polarity_flip_phy122.BCM8885X=1 +phy_tx_polarity_flip_phy123.BCM8885X=0 +phy_tx_polarity_flip_phy124.BCM8885X=0 +phy_tx_polarity_flip_phy125.BCM8885X=0 +phy_tx_polarity_flip_phy126.BCM8885X=1 +phy_tx_polarity_flip_phy127.BCM8885X=0 + +phy_tx_polarity_flip_phy128.BCM8885X=1 +phy_tx_polarity_flip_phy129.BCM8885X=1 +phy_tx_polarity_flip_phy130.BCM8885X=0 +phy_tx_polarity_flip_phy131.BCM8885X=0 +phy_tx_polarity_flip_phy132.BCM8885X=0 +phy_tx_polarity_flip_phy133.BCM8885X=1 +phy_tx_polarity_flip_phy134.BCM8885X=0 +phy_tx_polarity_flip_phy135.BCM8885X=0 + +phy_tx_polarity_flip_phy136.BCM8885X=0 +phy_tx_polarity_flip_phy137.BCM8885X=0 +phy_tx_polarity_flip_phy138.BCM8885X=0 +phy_tx_polarity_flip_phy139.BCM8885X=0 +phy_tx_polarity_flip_phy140.BCM8885X=0 +phy_tx_polarity_flip_phy141.BCM8885X=0 +phy_tx_polarity_flip_phy142.BCM8885X=0 +phy_tx_polarity_flip_phy143.BCM8885X=0 + + +polled_irq_delay.BCM8885X=5 +polled_irq_mode.BCM8885X=0 +port_fec_fabric.BCM8885X=7 +bcm_stat_interval.BCM8885X=1000000 + + +port_init_cl72_1=0 +port_init_cl72_2=0 +port_init_cl72_3=0 +port_init_cl72_4=0 +port_init_cl72_5=0 +port_init_cl72_6=0 +port_init_cl72_7=0 +port_init_cl72_8=0 +port_init_cl72_9=0 +port_init_cl72_10=0 +port_init_cl72_11=0 +port_init_cl72_12=0 +port_init_cl72_13=0 +port_init_cl72_14=0 +port_init_cl72_15=0 +port_init_cl72_16=0 +port_init_cl72_17=0 +port_init_cl72_18=0 + +port_init_cl72_256=0 +port_init_cl72_257=0 +port_init_cl72_258=0 +port_init_cl72_259=0 +port_init_cl72_260=0 +port_init_cl72_261=0 +port_init_cl72_262=0 +port_init_cl72_263=0 +port_init_cl72_264=0 +port_init_cl72_265=0 +port_init_cl72_266=0 +port_init_cl72_267=0 +port_init_cl72_268=0 +port_init_cl72_269=0 +port_init_cl72_270=0 +port_init_cl72_271=0 +port_init_cl72_272=0 +port_init_cl72_273=0 +port_init_cl72_274=0 +port_init_cl72_275=0 +port_init_cl72_276=0 +port_init_cl72_277=0 +port_init_cl72_278=0 +port_init_cl72_279=0 +port_init_cl72_280=0 +port_init_cl72_281=0 +port_init_cl72_282=0 +port_init_cl72_283=0 +port_init_cl72_284=0 +port_init_cl72_285=0 +port_init_cl72_286=0 +port_init_cl72_287=0 +port_init_cl72_288=0 +port_init_cl72_289=0 +port_init_cl72_290=0 +port_init_cl72_291=0 +port_init_cl72_292=0 +port_init_cl72_293=0 +port_init_cl72_294=0 +port_init_cl72_295=0 +port_init_cl72_296=0 +port_init_cl72_297=0 +port_init_cl72_298=0 +port_init_cl72_299=0 +port_init_cl72_300=0 +port_init_cl72_301=0 +port_init_cl72_302=0 +port_init_cl72_303=0 +port_init_cl72_304=0 +port_init_cl72_305=0 +port_init_cl72_306=0 +port_init_cl72_307=0 +port_init_cl72_308=0 +port_init_cl72_309=0 +port_init_cl72_310=0 +port_init_cl72_311=0 +port_init_cl72_312=0 +port_init_cl72_313=0 +port_init_cl72_314=0 +port_init_cl72_315=0 +port_init_cl72_316=0 +port_init_cl72_317=0 +port_init_cl72_318=0 +port_init_cl72_319=0 +port_init_cl72_320=0 +port_init_cl72_321=0 +port_init_cl72_322=0 +port_init_cl72_323=0 +port_init_cl72_324=0 +port_init_cl72_325=0 +port_init_cl72_326=0 +port_init_cl72_327=0 +port_init_cl72_328=0 +port_init_cl72_329=0 +port_init_cl72_330=0 +port_init_cl72_331=0 +port_init_cl72_332=0 +port_init_cl72_333=0 +port_init_cl72_334=0 +port_init_cl72_335=0 +port_init_cl72_336=0 +port_init_cl72_337=0 +port_init_cl72_338=0 +port_init_cl72_339=0 +port_init_cl72_340=0 +port_init_cl72_341=0 +port_init_cl72_342=0 +port_init_cl72_343=0 +port_init_cl72_344=0 +port_init_cl72_345=0 +port_init_cl72_346=0 +port_init_cl72_347=0 +port_init_cl72_348=0 +port_init_cl72_349=0 +port_init_cl72_350=0 +port_init_cl72_351=0 +port_init_cl72_352=0 +port_init_cl72_353=0 +port_init_cl72_354=0 +port_init_cl72_355=0 +port_init_cl72_356=0 +port_init_cl72_357=0 +port_init_cl72_358=0 +port_init_cl72_359=0 +port_init_cl72_360=0 +port_init_cl72_361=0 +port_init_cl72_362=0 +port_init_cl72_363=0 +port_init_cl72_364=0 +port_init_cl72_365=0 +port_init_cl72_366=0 +port_init_cl72_367=0 +port_init_cl72_368=0 +port_init_cl72_369=0 +port_init_cl72_370=0 +port_init_cl72_371=0 +port_init_cl72_372=0 +port_init_cl72_373=0 +port_init_cl72_374=0 +port_init_cl72_375=0 +port_init_cl72_376=0 +port_init_cl72_377=0 +port_init_cl72_378=0 +port_init_cl72_379=0 +port_init_cl72_380=0 +port_init_cl72_381=0 +port_init_cl72_382=0 +port_init_cl72_383=0 +port_init_cl72_384=0 +port_init_cl72_385=0 +port_init_cl72_386=0 +port_init_cl72_387=0 +port_init_cl72_388=0 +port_init_cl72_389=0 +port_init_cl72_390=0 +port_init_cl72_391=0 +port_init_cl72_392=0 +port_init_cl72_393=0 +port_init_cl72_394=0 +port_init_cl72_395=0 +port_init_cl72_396=0 +port_init_cl72_397=0 +port_init_cl72_398=0 +port_init_cl72_399=0 +port_init_cl72_400=0 +port_init_cl72_401=0 +port_init_cl72_402=0 +port_init_cl72_403=0 +port_init_cl72_404=0 +port_init_cl72_405=0 +port_init_cl72_406=0 +port_init_cl72_407=0 +port_init_cl72_408=0 +port_init_cl72_409=0 +port_init_cl72_410=0 +port_init_cl72_411=0 +port_init_cl72_412=0 +port_init_cl72_413=0 +port_init_cl72_414=0 +port_init_cl72_415=0 +port_init_cl72_416=0 +port_init_cl72_417=0 +port_init_cl72_418=0 +port_init_cl72_419=0 +port_init_cl72_420=0 +port_init_cl72_421=0 +port_init_cl72_422=0 +port_init_cl72_423=0 +port_init_cl72_424=0 +port_init_cl72_425=0 +port_init_cl72_426=0 +port_init_cl72_427=0 +port_init_cl72_428=0 +port_init_cl72_429=0 +port_init_cl72_430=0 +port_init_cl72_431=0 +port_init_cl72_432=0 +port_init_cl72_433=0 +port_init_cl72_434=0 +port_init_cl72_435=0 +port_init_cl72_436=0 +port_init_cl72_437=0 +port_init_cl72_438=0 +port_init_cl72_439=0 +port_init_cl72_440=0 +port_init_cl72_441=0 +port_init_cl72_442=0 +port_init_cl72_443=0 +port_init_cl72_444=0 +port_init_cl72_445=0 +port_init_cl72_446=0 +port_init_cl72_447=0 + + +port_init_speed_cc.BCM8885X=200000 +port_init_speed_cd.BCM8885X=400000 +port_init_speed_ce.BCM8885X=100000 +port_init_speed_fabric.BCM8885X=53125 +port_init_speed_il.BCM8885X=10312 +port_init_speed_le.BCM8885X=50000 +port_init_speed_xe.BCM8885X=10000 +port_init_speed_xl.BCM8885X=40000 +port_priorities.BCM8885X=8 +protocol_traps_mode.BCM8885X=IN_LIF +rate_ext_mdio_divisor=16 +schan_intr_enable.BCM8885X=0 +schan_timeout_usec.BCM8885X=900000 +serdes_fabric_clk_freq_in.BCM8885X=1 +serdes_fabric_clk_freq_out.BCM8885X=bypass +serdes_nif_clk_freq_in0.BCM8885X=1 +serdes_nif_clk_freq_in1.BCM8885X=1 +serdes_nif_clk_freq_out0.BCM8885X=bypass +serdes_nif_clk_freq_out1.BCM8885X=bypass +soc_family.BCM8885X=BCM8885X +stable_filename.BCM8885X=/tmp/warmboot_data +stable_location.BCM8885X=3 +stable_size.BCM8885X=800000000 +sw_state_max_size.BCM8885X=750000000 +system_headers_mode=1 +tdma_intr_enable.BCM8885X=0 +tdma_timeout_usec.BCM8885X=1000000 +tm_port_header_type_in_0.BCM8885X=INJECTED_2 +tm_port_header_type_in_200.BCM8885X=INJECTED_2_PP +tm_port_header_type_in_201.BCM8885X=INJECTED_2_PP +tm_port_header_type_in_202.BCM8885X=INJECTED_2_PP +tm_port_header_type_in_203.BCM8885X=INJECTED_2_PP +tm_port_header_type_in_232.BCM8885X=INJECTED_2 +tm_port_header_type_in_19.BCM8885X=ETH +tm_port_header_type_in_20.BCM8885X=INJECTED_2 +tm_port_header_type_out_0.BCM8885X=CPU +tm_port_header_type_out_200.BCM8885X=ETH +tm_port_header_type_out_201.BCM8885X=ETH +tm_port_header_type_out_202.BCM8885X=ETH +tm_port_header_type_out_203.BCM8885X=ETH +tm_port_header_type_out_232.BCM8885X=CPU +tm_port_header_type_out_19.BCM8885X=ETH +tm_port_header_type_out_20.BCM8885X=RAW +tslam_intr_enable.BCM8885X=0 +tslam_timeout_usec.BCM8885X=1000000 +ucode_port_0.BCM8885X=CPU.0:core_0.0 +ucode_port_200.BCM8885X=CPU.8:core_1.200 +ucode_port_201.BCM8885X=CPU.16:core_1.201 +ucode_port_202.BCM8885X=CPU.24:core_1.202 +ucode_port_203.BCM8885X=CPU.32:core_1.203 + + +ucode_port_1.BCM8885X=CDGE9:core_1.1 +ucode_port_2.BCM8885X=CDGE10:core_1.2 +ucode_port_3.BCM8885X=CDGE11:core_1.3 +ucode_port_4.BCM8885X=CDGE12:core_1.4 +ucode_port_5.BCM8885X=CDGE13:core_1.5 +ucode_port_6.BCM8885X=CDGE14:core_1.6 +ucode_port_7.BCM8885X=CDGE15:core_1.7 +ucode_port_8.BCM8885X=CDGE16:core_1.8 +ucode_port_9.BCM8885X=CDGE17:core_1.9 +ucode_port_10.BCM8885X=CDGE8:core_0.10 +ucode_port_11.BCM8885X=CDGE7:core_0.11 +ucode_port_12.BCM8885X=CDGE6:core_0.12 +ucode_port_13.BCM8885X=CDGE5:core_0.13 +ucode_port_14.BCM8885X=CDGE4:core_0.14 +ucode_port_15.BCM8885X=CDGE3:core_0.15 +ucode_port_16.BCM8885X=CDGE2:core_0.16 +ucode_port_17.BCM8885X=CDGE1:core_0.17 +ucode_port_18.BCM8885X=CDGE0:core_0.18 + + +ucode_port_19.BCM8885X=RCY0:core_0.19 +ucode_port_20.BCM8885X=RCY1:core_1.20 +ucode_port_21.BCM8885X=OLP:core_1.21 + + + +serdes_lane_config_dfe_1.BCM8885X=on +serdes_lane_config_dfe_2.BCM8885X=on +serdes_lane_config_dfe_3.BCM8885X=on +serdes_lane_config_dfe_4.BCM8885X=on +serdes_lane_config_dfe_5.BCM8885X=on +serdes_lane_config_dfe_6.BCM8885X=on +serdes_lane_config_dfe_7.BCM8885X=on +serdes_lane_config_dfe_8.BCM8885X=on +serdes_lane_config_dfe_9.BCM8885X=on +serdes_lane_config_dfe_10.BCM8885X=on +serdes_lane_config_dfe_11.BCM8885X=on +serdes_lane_config_dfe_12.BCM8885X=on +serdes_lane_config_dfe_13.BCM8885X=on +serdes_lane_config_dfe_14.BCM8885X=on +serdes_lane_config_dfe_15.BCM8885X=on +serdes_lane_config_dfe_16.BCM8885X=on +serdes_lane_config_dfe_17.BCM8885X=on +serdes_lane_config_dfe_18.BCM8885X=on + + +serdes_lane_config_channel_mode_1.BCM8885X=force_nr +serdes_lane_config_channel_mode_2.BCM8885X=force_nr +serdes_lane_config_channel_mode_3.BCM8885X=force_nr +serdes_lane_config_channel_mode_4.BCM8885X=force_nr +serdes_lane_config_channel_mode_5.BCM8885X=force_nr +serdes_lane_config_channel_mode_6.BCM8885X=force_nr +serdes_lane_config_channel_mode_7.BCM8885X=force_nr +serdes_lane_config_channel_mode_8.BCM8885X=force_nr +serdes_lane_config_channel_mode_9.BCM8885X=force_nr +serdes_lane_config_channel_mode_10.BCM8885X=force_nr +serdes_lane_config_channel_mode_11.BCM8885X=force_nr +serdes_lane_config_channel_mode_12.BCM8885X=force_nr +serdes_lane_config_channel_mode_13.BCM8885X=force_nr +serdes_lane_config_channel_mode_14.BCM8885X=force_nr +serdes_lane_config_channel_mode_15.BCM8885X=force_nr +serdes_lane_config_channel_mode_16.BCM8885X=force_nr +serdes_lane_config_channel_mode_17.BCM8885X=force_nr +serdes_lane_config_channel_mode_18.BCM8885X=force_nr + + +serdes_lane_config_media_type_1.BCM8885X=backplane +serdes_lane_config_media_type_2.BCM8885X=backplane +serdes_lane_config_media_type_3.BCM8885X=backplane +serdes_lane_config_media_type_4.BCM8885X=backplane +serdes_lane_config_media_type_5.BCM8885X=backplane +serdes_lane_config_media_type_6.BCM8885X=backplane +serdes_lane_config_media_type_7.BCM8885X=backplane +serdes_lane_config_media_type_8.BCM8885X=backplane +serdes_lane_config_media_type_9.BCM8885X=backplane +serdes_lane_config_media_type_10.BCM8885X=backplane +serdes_lane_config_media_type_11.BCM8885X=backplane +serdes_lane_config_media_type_12.BCM8885X=backplane +serdes_lane_config_media_type_13.BCM8885X=backplane +serdes_lane_config_media_type_14.BCM8885X=backplane +serdes_lane_config_media_type_15.BCM8885X=backplane +serdes_lane_config_media_type_16.BCM8885X=backplane +serdes_lane_config_media_type_17.BCM8885X=backplane +serdes_lane_config_media_type_18.BCM8885X=backplane + + +port_fec.1.BCM8885x=9 +port_fec.2.BCM8885x=9 +port_fec.3.BCM8885x=9 +port_fec.4.BCM8885x=9 +port_fec.5.BCM8885x=9 +port_fec.6.BCM8885x=9 +port_fec.7.BCM8885x=9 +port_fec.8.BCM8885x=9 +port_fec.9.BCM8885x=9 +port_fec.10.BCM8885x=9 +port_fec.11.BCM8885x=9 +port_fec.12.BCM8885x=9 +port_fec.13.BCM8885x=9 +port_fec.14.BCM8885x=9 +port_fec.15.BCM8885x=9 +port_fec.16.BCM8885x=9 +port_fec.17.BCM8885x=9 +port_fec.18.BCM8885x=9 + + +serdes_tx_taps_1.BCM8885X=pam4:-8:132:-8:0:0:0 +serdes_tx_taps_2.BCM8885X=pam4:-8:132:-8:0:0:0 +serdes_tx_taps_3.BCM8885X=pam4:-8:132:-8:4:0:0 +serdes_tx_taps_4.BCM8885X=pam4:-8:128:-4:4:0:0 +serdes_tx_taps_5.BCM8885X=pam4:-8:132:-8:4:0:0 +serdes_tx_taps_6.BCM8885X=pam4:-8:136:0:0:0:0 +serdes_tx_taps_7.BCM8885X=pam4:-8:132:-4:0:-4:0 +serdes_tx_taps_8.BCM8885X=pam4:-4:144:0:0:0:0 +serdes_tx_taps_9.BCM8885X=pam4:-8:132:-4:2:-4:0 +serdes_tx_taps_10.BCM8885X=pam4:-4:144:0:0:0:0 +serdes_tx_taps_11.BCM8885X=pam4:-8:132:-4:0:-4:0 +serdes_tx_taps_12.BCM8885X=pam4:-4:144:0:0:0:0 +serdes_tx_taps_13.BCM8885X=pam4:-8:132:-8:4:0:0 +serdes_tx_taps_14.BCM8885X=pam4:-4:144:0:0:0:0 +serdes_tx_taps_15.BCM8885X=pam4:-8:132:-8:4:0:0 +serdes_tx_taps_16.BCM8885X=pam4:-8:136:-4:4:-4:0 +serdes_tx_taps_17.BCM8885X=pam4:-8:132:-4:0:0:0 +serdes_tx_taps_18.BCM8885X=pam4:-4:128:-4:0:0:0 + + +serdes_tx_taps_256.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_257.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_258.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_259.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_260.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_261.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_262.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_263.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_264.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_265.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_266.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_267.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_268.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_269.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_270.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_271.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_272.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_273.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_274.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_275.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_276.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_277.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_278.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_279.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_280.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_281.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_282.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_283.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_284.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_285.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_286.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_287.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_288.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_289.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_290.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_291.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_292.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_293.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_294.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_295.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_296.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_297.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_298.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_299.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_300.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_301.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_302.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_303.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_304.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_305.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_306.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_307.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_308.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_309.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_310.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_311.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_312.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_313.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_314.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_315.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_316.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_317.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_318.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_319.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_320.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_321.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_322.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_323.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_324.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_325.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_326.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_327.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_328.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_329.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_330.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_331.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_332.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_333.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_334.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_335.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_336.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_337.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_338.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_339.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_340.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_341.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_342.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_343.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_344.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_345.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_346.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_347.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_348.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_349.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_350.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_351.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_352.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_353.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_354.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_355.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_356.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_357.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_358.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_359.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_360.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_361.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_362.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_363.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_364.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_365.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_366.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_367.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_368.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_369.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_370.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_371.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_372.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_373.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_374.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_375.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_376.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_377.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_378.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_379.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_380.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_381.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_382.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_383.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_384.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_385.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_386.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_387.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_388.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_389.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_390.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_391.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_392.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_393.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_394.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_395.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_396.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_397.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_398.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_399.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_400.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_401.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_402.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_403.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_404.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_405.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_406.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_407.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_408.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_409.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_410.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_411.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_412.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_413.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_414.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_415.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_416.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_417.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_418.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_419.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_420.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_421.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_422.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_423.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_424.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_425.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_426.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_427.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_428.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_429.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_430.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_431.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_432.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_433.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_434.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_435.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_436.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_437.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_438.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_439.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_440.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_441.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_442.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_443.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_444.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_445.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_446.BCM8885X=pam4:-20:148:0:0:0:0 +serdes_tx_taps_447.BCM8885X=pam4:-20:148:0:0:0:0 + + +serdes_lane_config_channel_mode_256=force_nr +serdes_lane_config_channel_mode_257=force_nr +serdes_lane_config_channel_mode_258=force_nr +serdes_lane_config_channel_mode_259=force_nr +serdes_lane_config_channel_mode_260=force_nr +serdes_lane_config_channel_mode_261=force_nr +serdes_lane_config_channel_mode_262=force_nr +serdes_lane_config_channel_mode_263=force_nr +serdes_lane_config_channel_mode_264=force_nr +serdes_lane_config_channel_mode_265=force_nr +serdes_lane_config_channel_mode_266=force_nr +serdes_lane_config_channel_mode_267=force_nr +serdes_lane_config_channel_mode_268=force_nr +serdes_lane_config_channel_mode_269=force_nr +serdes_lane_config_channel_mode_270=force_nr +serdes_lane_config_channel_mode_271=force_nr +serdes_lane_config_channel_mode_272=force_nr +serdes_lane_config_channel_mode_273=force_nr +serdes_lane_config_channel_mode_274=force_nr +serdes_lane_config_channel_mode_275=force_nr +serdes_lane_config_channel_mode_276=force_nr +serdes_lane_config_channel_mode_277=force_nr +serdes_lane_config_channel_mode_278=force_nr +serdes_lane_config_channel_mode_279=force_nr +serdes_lane_config_channel_mode_280=force_nr +serdes_lane_config_channel_mode_281=force_nr +serdes_lane_config_channel_mode_282=force_nr +serdes_lane_config_channel_mode_283=force_nr +serdes_lane_config_channel_mode_284=force_nr +serdes_lane_config_channel_mode_285=force_nr +serdes_lane_config_channel_mode_286=force_nr +serdes_lane_config_channel_mode_287=force_nr +serdes_lane_config_channel_mode_288=force_nr +serdes_lane_config_channel_mode_289=force_nr +serdes_lane_config_channel_mode_290=force_nr +serdes_lane_config_channel_mode_291=force_nr +serdes_lane_config_channel_mode_292=force_nr +serdes_lane_config_channel_mode_293=force_nr +serdes_lane_config_channel_mode_294=force_nr +serdes_lane_config_channel_mode_295=force_nr +serdes_lane_config_channel_mode_296=force_nr +serdes_lane_config_channel_mode_297=force_nr +serdes_lane_config_channel_mode_298=force_nr +serdes_lane_config_channel_mode_299=force_nr +serdes_lane_config_channel_mode_300=force_nr +serdes_lane_config_channel_mode_301=force_nr +serdes_lane_config_channel_mode_302=force_nr +serdes_lane_config_channel_mode_303=force_nr +serdes_lane_config_channel_mode_304=force_nr +serdes_lane_config_channel_mode_305=force_nr +serdes_lane_config_channel_mode_306=force_nr +serdes_lane_config_channel_mode_307=force_nr +serdes_lane_config_channel_mode_308=force_nr +serdes_lane_config_channel_mode_309=force_nr +serdes_lane_config_channel_mode_310=force_nr +serdes_lane_config_channel_mode_311=force_nr +serdes_lane_config_channel_mode_312=force_nr +serdes_lane_config_channel_mode_313=force_nr +serdes_lane_config_channel_mode_314=force_nr +serdes_lane_config_channel_mode_315=force_nr +serdes_lane_config_channel_mode_316=force_nr +serdes_lane_config_channel_mode_317=force_nr +serdes_lane_config_channel_mode_318=force_nr +serdes_lane_config_channel_mode_319=force_nr +serdes_lane_config_channel_mode_320=force_nr +serdes_lane_config_channel_mode_321=force_nr +serdes_lane_config_channel_mode_322=force_nr +serdes_lane_config_channel_mode_323=force_nr +serdes_lane_config_channel_mode_324=force_nr +serdes_lane_config_channel_mode_325=force_nr +serdes_lane_config_channel_mode_326=force_nr +serdes_lane_config_channel_mode_327=force_nr +serdes_lane_config_channel_mode_328=force_nr +serdes_lane_config_channel_mode_329=force_nr +serdes_lane_config_channel_mode_330=force_nr +serdes_lane_config_channel_mode_331=force_nr +serdes_lane_config_channel_mode_332=force_nr +serdes_lane_config_channel_mode_333=force_nr +serdes_lane_config_channel_mode_334=force_nr +serdes_lane_config_channel_mode_335=force_nr +serdes_lane_config_channel_mode_336=force_nr +serdes_lane_config_channel_mode_337=force_nr +serdes_lane_config_channel_mode_338=force_nr +serdes_lane_config_channel_mode_339=force_nr +serdes_lane_config_channel_mode_340=force_nr +serdes_lane_config_channel_mode_341=force_nr +serdes_lane_config_channel_mode_342=force_nr +serdes_lane_config_channel_mode_343=force_nr +serdes_lane_config_channel_mode_344=force_nr +serdes_lane_config_channel_mode_345=force_nr +serdes_lane_config_channel_mode_346=force_nr +serdes_lane_config_channel_mode_347=force_nr +serdes_lane_config_channel_mode_348=force_nr +serdes_lane_config_channel_mode_349=force_nr +serdes_lane_config_channel_mode_350=force_nr +serdes_lane_config_channel_mode_351=force_nr +serdes_lane_config_channel_mode_352=force_nr +serdes_lane_config_channel_mode_353=force_nr +serdes_lane_config_channel_mode_354=force_nr +serdes_lane_config_channel_mode_355=force_nr +serdes_lane_config_channel_mode_356=force_nr +serdes_lane_config_channel_mode_357=force_nr +serdes_lane_config_channel_mode_358=force_nr +serdes_lane_config_channel_mode_359=force_nr +serdes_lane_config_channel_mode_360=force_nr +serdes_lane_config_channel_mode_361=force_nr +serdes_lane_config_channel_mode_362=force_nr +serdes_lane_config_channel_mode_363=force_nr +serdes_lane_config_channel_mode_364=force_nr +serdes_lane_config_channel_mode_365=force_nr +serdes_lane_config_channel_mode_366=force_nr +serdes_lane_config_channel_mode_367=force_nr +serdes_lane_config_channel_mode_368=force_nr +serdes_lane_config_channel_mode_369=force_nr +serdes_lane_config_channel_mode_370=force_nr +serdes_lane_config_channel_mode_371=force_nr +serdes_lane_config_channel_mode_372=force_nr +serdes_lane_config_channel_mode_373=force_nr +serdes_lane_config_channel_mode_374=force_nr +serdes_lane_config_channel_mode_375=force_nr +serdes_lane_config_channel_mode_376=force_nr +serdes_lane_config_channel_mode_377=force_nr +serdes_lane_config_channel_mode_378=force_nr +serdes_lane_config_channel_mode_379=force_nr +serdes_lane_config_channel_mode_380=force_nr +serdes_lane_config_channel_mode_381=force_nr +serdes_lane_config_channel_mode_382=force_nr +serdes_lane_config_channel_mode_383=force_nr +serdes_lane_config_channel_mode_384=force_nr +serdes_lane_config_channel_mode_385=force_nr +serdes_lane_config_channel_mode_386=force_nr +serdes_lane_config_channel_mode_387=force_nr +serdes_lane_config_channel_mode_388=force_nr +serdes_lane_config_channel_mode_389=force_nr +serdes_lane_config_channel_mode_390=force_nr +serdes_lane_config_channel_mode_391=force_nr +serdes_lane_config_channel_mode_392=force_nr +serdes_lane_config_channel_mode_393=force_nr +serdes_lane_config_channel_mode_394=force_nr +serdes_lane_config_channel_mode_395=force_nr +serdes_lane_config_channel_mode_396=force_nr +serdes_lane_config_channel_mode_397=force_nr +serdes_lane_config_channel_mode_398=force_nr +serdes_lane_config_channel_mode_399=force_nr +serdes_lane_config_channel_mode_400=force_nr +serdes_lane_config_channel_mode_401=force_nr +serdes_lane_config_channel_mode_402=force_nr +serdes_lane_config_channel_mode_403=force_nr +serdes_lane_config_channel_mode_404=force_nr +serdes_lane_config_channel_mode_405=force_nr +serdes_lane_config_channel_mode_406=force_nr +serdes_lane_config_channel_mode_407=force_nr +serdes_lane_config_channel_mode_408=force_nr +serdes_lane_config_channel_mode_409=force_nr +serdes_lane_config_channel_mode_410=force_nr +serdes_lane_config_channel_mode_411=force_nr +serdes_lane_config_channel_mode_412=force_nr +serdes_lane_config_channel_mode_413=force_nr +serdes_lane_config_channel_mode_414=force_nr +serdes_lane_config_channel_mode_415=force_nr +serdes_lane_config_channel_mode_416=force_nr +serdes_lane_config_channel_mode_417=force_nr +serdes_lane_config_channel_mode_418=force_nr +serdes_lane_config_channel_mode_419=force_nr +serdes_lane_config_channel_mode_420=force_nr +serdes_lane_config_channel_mode_421=force_nr +serdes_lane_config_channel_mode_422=force_nr +serdes_lane_config_channel_mode_423=force_nr +serdes_lane_config_channel_mode_424=force_nr +serdes_lane_config_channel_mode_425=force_nr +serdes_lane_config_channel_mode_426=force_nr +serdes_lane_config_channel_mode_427=force_nr +serdes_lane_config_channel_mode_428=force_nr +serdes_lane_config_channel_mode_429=force_nr +serdes_lane_config_channel_mode_430=force_nr +serdes_lane_config_channel_mode_431=force_nr +serdes_lane_config_channel_mode_432=force_nr +serdes_lane_config_channel_mode_433=force_nr +serdes_lane_config_channel_mode_434=force_nr +serdes_lane_config_channel_mode_435=force_nr +serdes_lane_config_channel_mode_436=force_nr +serdes_lane_config_channel_mode_437=force_nr +serdes_lane_config_channel_mode_438=force_nr +serdes_lane_config_channel_mode_439=force_nr +serdes_lane_config_channel_mode_440=force_nr +serdes_lane_config_channel_mode_441=force_nr +serdes_lane_config_channel_mode_442=force_nr +serdes_lane_config_channel_mode_443=force_nr +serdes_lane_config_channel_mode_444=force_nr +serdes_lane_config_channel_mode_445=force_nr +serdes_lane_config_channel_mode_446=force_nr +serdes_lane_config_channel_mode_447=force_nr + + + +rif_id_max=24576 +dpp_db_path=/usr/share/bcm/db +sai_recycle_port_lane_base=96 +appl_param_nof_ports_per_modid=64 +udh_exists=1 +modreg IPS_FORCE_LOCAL_OR_FABRIC FORCE_FABRIC=1 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/port_config.ini b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/port_config.ini index 9f043d832eda..90376150d657 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/port_config.ini +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/port_config.ini @@ -1,20 +1,21 @@ # name lanes alias index asic_port_name role speed coreid coreportid numvoq -Ethernet18 72,73,74,75,76,77,78,79 Ethernet18 19 Eth0-ASIC1 Ext 400000 1 0 8 -Ethernet19 80,81,82,83,84,85,86,87 Ethernet19 20 Eth1-ASIC1 Ext 400000 1 1 8 -Ethernet20 88,89,90,91,92,93,94,95 Ethernet20 21 Eth2-ASIC1 Ext 400000 1 2 8 -Ethernet21 96,97,98,99,100,101,102,103 Ethernet21 22 Eth3-ASIC1 Ext 400000 1 3 8 -Ethernet22 104,105,106,107,108,109,110,111 Ethernet22 23 Eth4-ASIC1 Ext 400000 1 4 8 -Ethernet23 112,113,114,115,116,117,118,119 Ethernet23 24 Eth5-ASIC1 Ext 400000 1 5 8 -Ethernet24 120,121,122,123,124,125,126,127 Ethernet24 25 Eth6-ASIC1 Ext 400000 1 6 8 -Ethernet25 128,129,130,131,132,133,134,135 Ethernet25 26 Eth7-ASIC1 Ext 400000 1 7 8 -Ethernet26 136,137,138,139,140,141,142,143 Ethernet26 27 Eth8-ASIC1 Ext 400000 1 8 8 -Ethernet27 64,65,66,67,68,69,70,71 Ethernet27 28 Eth9-ASIC1 Ext 400000 0 1 8 -Ethernet28 56,57,58,59,60,61,62,63 Ethernet28 29 Eth10-ASIC1 Ext 400000 0 2 8 -Ethernet29 48,49,50,51,52,53,54,55 Ethernet29 30 Eth11-ASIC1 Ext 400000 0 3 8 -Ethernet30 40,41,42,43,44,45,46,47 Ethernet30 31 Eth12-ASIC1 Ext 400000 0 4 8 -Ethernet31 32,33,34,35,36,37,38,39 Ethernet31 32 Eth13-ASIC1 Ext 400000 0 5 8 -Ethernet32 24,25,26,27,28,29,30,31 Ethernet32 33 Eth14-ASIC1 Ext 400000 0 6 8 -Ethernet33 16,17,18,19,20,21,22,23 Ethernet33 34 Eth15-ASIC1 Ext 400000 0 7 8 -Ethernet34 8,9,10,11,12,13,14,15 Ethernet34 35 Eth16-ASIC1 Ext 400000 0 8 8 -Ethernet35 0,1,2,3,4,5,6,7 Ethernet35 36 Eth17-ASIC1 Ext 400000 0 9 8 -Ethernet-IB1 115 Ethernet-IB1 38 Rcy-ASIC1 Int 10000 0 10 8 +Ethernet18 72,73,74,75,76,77,78,79 Ethernet18 19 Eth0-ASIC1 Ext 400000 1 1 8 +Ethernet19 80,81,82,83,84,85,86,87 Ethernet19 20 Eth1-ASIC1 Ext 400000 1 2 8 +Ethernet20 88,89,90,91,92,93,94,95 Ethernet20 21 Eth2-ASIC1 Ext 400000 1 3 8 +Ethernet21 96,97,98,99,100,101,102,103 Ethernet21 22 Eth3-ASIC1 Ext 400000 1 4 8 +Ethernet22 104,105,106,107,108,109,110,111 Ethernet22 23 Eth4-ASIC1 Ext 400000 1 5 8 +Ethernet23 112,113,114,115,116,117,118,119 Ethernet23 24 Eth5-ASIC1 Ext 400000 1 6 8 +Ethernet24 120,121,122,123,124,125,126,127 Ethernet24 25 Eth6-ASIC1 Ext 400000 1 7 8 +Ethernet25 128,129,130,131,132,133,134,135 Ethernet25 26 Eth7-ASIC1 Ext 400000 1 8 8 +Ethernet26 136,137,138,139,140,141,142,143 Ethernet26 27 Eth8-ASIC1 Ext 400000 1 9 8 +Ethernet27 64,65,66,67,68,69,70,71 Ethernet27 28 Eth9-ASIC1 Ext 400000 0 10 8 +Ethernet28 56,57,58,59,60,61,62,63 Ethernet28 29 Eth10-ASIC1 Ext 400000 0 11 8 +Ethernet29 48,49,50,51,52,53,54,55 Ethernet29 30 Eth11-ASIC1 Ext 400000 0 12 8 +Ethernet30 40,41,42,43,44,45,46,47 Ethernet30 31 Eth12-ASIC1 Ext 400000 0 13 8 +Ethernet31 32,33,34,35,36,37,38,39 Ethernet31 32 Eth13-ASIC1 Ext 400000 0 14 8 +Ethernet32 24,25,26,27,28,29,30,31 Ethernet32 33 Eth14-ASIC1 Ext 400000 0 15 8 +Ethernet33 16,17,18,19,20,21,22,23 Ethernet33 34 Eth15-ASIC1 Ext 400000 0 16 8 +Ethernet34 8,9,10,11,12,13,14,15 Ethernet34 35 Eth16-ASIC1 Ext 400000 0 17 8 +Ethernet35 0,1,2,3,4,5,6,7 Ethernet35 36 Eth17-ASIC1 Ext 400000 0 18 8 +Ethernet-IB1 115 Ethernet-IB1 38 Rcy1-ASIC1 Inb 10000 0 19 8 +Ethernet-Rec1 116 Ethernet-Rec1 40 Rcy2-ASIC1 Rec 10000 1 20 8 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/sai_postinit_cmd.soc b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/sai_postinit_cmd.soc new file mode 100644 index 000000000000..db5ad5ebb264 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/Nokia-IXR7250E-36x400G/1/sai_postinit_cmd.soc @@ -0,0 +1,6 @@ +phy set 8 reg=0xd134 data=-8 lane=1 +phy set 8 reg=0xd135 data=132 lane=1 +phy set 8 reg=0xd136 data=-8 lane=1 +phy set 8 reg=0xd137 data=0 lane=1 +phy set 8 reg=0xd138 data=0 lane=1 +phy set 8 reg=0xd133 data=0x1802 lane=1 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/chassisdb.conf b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/chassisdb.conf index cb602c6eb4d8..fa5af525eda0 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/chassisdb.conf +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/chassisdb.conf @@ -1 +1,3 @@ -chassis_db_address=10.0.5.16 +chassis_db_address=10.6.0.100 +chassis_internal_intfs=enp12s0f2,enp5s0f4,enp5s0f4.2 +midplane_subnet=10.6.0.0/16 diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform.json b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform.json index ad911fb609b0..55630de1126a 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform.json +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform.json @@ -12,148 +12,209 @@ "name": "FPGA2" } ], - + "watchdog": { + "disarm": false + }, + "get_module_attributes": { + "model": false, + "serial": false, + "base_mac": false, + "system_eeprom_info": false + }, + "thermal_temperature": { + "minimum": 0, + "maximum": 110 + }, "fans": [], "fan_drawers": [], "master_psu_led_color": [], "psus": [], "thermals": [ { - "name": "temp_1(fan)" + "name": "temp_1(fan)", + "controllable": false }, { - "name": "temp_2(fan)" + "name": "temp_2(fan)", + "controllable": false }, { - "name": "temp_3" + "name": "temp_3(fan)", + "controllable": false }, { - "name": "temp_4" + "name": "temp_4", + "controllable": false }, { - "name": "temp_5" + "name": "temp_5", + "controllable": false }, { - "name": "temp_6" + "name": "temp_6(fan)", + "controllable": false }, { - "name": "temp_7" + "name": "temp_7(fan)", + "controllable": false }, { - "name": "temp_8" + "name": "temp_8(fan)", + "controllable": false }, { - "name": "temp_9" + "name": "temp_9(fan)", + "controllable": false + }, + { + "name": "temp_10(fan)", + "controllable": false } ], "sfps": [ { - "name": "QSFPDD_1" + "name": "QSFPDD_1", + "tx_disable_channel": false }, { - "name": "QSFPDD_2" + "name": "QSFPDD_2", + "tx_disable_channel": false }, { - "name": "QSFPDD_3" + "name": "QSFPDD_3", + "tx_disable_channel": false }, { - "name": "QSFPDD_4" + "name": "QSFPDD_4", + "tx_disable_channel": false }, { - "name": "QSFPDD_5" + "name": "QSFPDD_5", + "tx_disable_channel": false }, { - "name": "QSFPDD_6" + "name": "QSFPDD_6", + "tx_disable_channel": false }, { - "name": "QSFPDD_7" + "name": "QSFPDD_7", + "tx_disable_channel": false }, { - "name": "QSFPDD_8" + "name": "QSFPDD_8", + "tx_disable_channel": false }, { - "name": "QSFPDD_9" + "name": "QSFPDD_9", + "tx_disable_channel": false }, { - "name": "QSFPDD_10" + "name": "QSFPDD_10", + "tx_disable_channel": false }, { - "name": "QSFPDD_11" + "name": "QSFPDD_11", + "tx_disable_channel": false }, { - "name": "QSFPDD_12" + "name": "QSFPDD_12", + "tx_disable_channel": false }, { - "name": "QSFPDD_13" + "name": "QSFPDD_13", + "tx_disable_channel": false }, { - "name": "QSFPDD_14" + "name": "QSFPDD_14", + "tx_disable_channel": false }, { - "name": "QSFPDD_15" + "name": "QSFPDD_15", + "tx_disable_channel": false }, { - "name": "QSFPDD_16" + "name": "QSFPDD_16", + "tx_disable_channel": false }, { - "name": "QSFPDD_17" + "name": "QSFPDD_17", + "tx_disable_channel": false }, { - "name": "QSFPDD_18" + "name": "QSFPDD_18", + "tx_disable_channel": false }, { - "name": "QSFPDD_19" + "name": "QSFPDD_19", + "tx_disable_channel": false }, { - "name": "QSFPDD_20" + "name": "QSFPDD_20", + "tx_disable_channel": false }, { - "name": "QSFPDD_21" + "name": "QSFPDD_21", + "tx_disable_channel": false }, { - "name": "QSFPDD_22" + "name": "QSFPDD_22", + "tx_disable_channel": false }, { - "name": "QSFPDD_23" + "name": "QSFPDD_23", + "tx_disable_channel": false }, { - "name": "QSFPDD_24" + "name": "QSFPDD_24", + "tx_disable_channel": false }, { - "name": "QSFPDD_25" + "name": "QSFPDD_25", + "tx_disable_channel": false }, { - "name": "QSFPDD_26" + "name": "QSFPDD_26", + "tx_disable_channel": false }, { - "name": "QSFPDD_27" + "name": "QSFPDD_27", + "tx_disable_channel": false }, { - "name": "QSFPDD_28" + "name": "QSFPDD_28", + "tx_disable_channel": false }, { - "name": "QSFPDD_29" + "name": "QSFPDD_29", + "tx_disable_channel": false }, { - "name": "QSFPDD_30" + "name": "QSFPDD_30", + "tx_disable_channel": false }, { - "name": "QSFPDD_31" + "name": "QSFPDD_31", + "tx_disable_channel": false }, { - "name": "QSFPDD_32" + "name": "QSFPDD_32", + "tx_disable_channel": false }, { - "name": "QSFPDD_33" + "name": "QSFPDD_33", + "tx_disable_channel": false }, { - "name": "QSFPDD_34" + "name": "QSFPDD_34", + "tx_disable_channel": false }, { - "name": "QSFPDD_35" + "name": "QSFPDD_35", + "tx_disable_channel": false }, { - "name": "QSFPDD_36" + "name": "QSFPDD_36", + "tx_disable_channel": false } ] }, diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_asic b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_asic new file mode 100644 index 000000000000..9ba24ca3e753 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_asic @@ -0,0 +1 @@ +broadcom-dnx diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_ndk.json b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_ndk.json index 92a206bb490b..039b950f03ba 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_ndk.json +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_ndk.json @@ -6,7 +6,7 @@ }, { "key": "midplane_subnet", - "stringval": "10.0.5.0" + "stringval": "10.6.0.0/16" }, { "key": "midplane_monitor", @@ -27,6 +27,10 @@ { "key": "sonic_bdb_mode", "intval": 0 + }, + { + "key": "update_asic_pvt", + "intval": 10 } ] } diff --git a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_reboot b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_reboot index 65cba5185eb1..d128455d40fc 100755 --- a/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_reboot +++ b/device/nokia/x86_64-nokia_ixr7250e_36x400g-r0/platform_reboot @@ -5,5 +5,6 @@ sleep 2 echo "w" > /dev/watchdog kick_date=`date -u` echo "last watchdog kick $kick_date" > /var/log/nokia-watchdog-last.log +rm -f /sys/firmware/efi/efivars/dump-* sync /sbin/reboot diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/0/config-ramon-1-0.bcm b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/0/config-ramon-1-0.bcm new file mode 100644 index 000000000000..e55bc4a4ebc7 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/0/config-ramon-1-0.bcm @@ -0,0 +1,1398 @@ + +appl_enable_intr_init.BCM8879X=0 +appl_param_module_id.BCM8879X=1 +bcm_linkscan_interval.BCM8879X=0 +bcm_stat_interval.BCM8879X=4000000 +bist_enable.BCM8879X=0 +core_clock_speed_khz.BCM8879X=1000000 +custom_feature_access_only.BCM8879X=0 +custom_feature_lane_swap_disable.BCM8879X=0 +dport_map_direct.BCM8879X=1 +fabric_cell_fifo_dma_enable.BCM8879X=0 +fabric_device_mode.BCM8879X=SINGLE_STAGE_FE2 +fabric_load_balancing_mode.BCM8879X=NORMAL_LOAD_BALANCE +fabric_multicast_mode.BCM8879X=DIRECT +fabric_num_pipes.BCM8879X=1 +fabric_pipe_map.BCM8879X=0 +fe_mc_id_range.BCM8879X=128K +load_firmware.BCM8879X=0x102 +mdio_output_delay_ext.BCM8879X=14 +mdio_output_delay_int.BCM8879X=25 +mem_cache_enable_parity.BCM8879X=1 +mm_intr_enable.BCM8879X=0 +mm_timeout_usec.BCM8879X=300000 +polled_irq_delay.BCM8879X=100000 +polled_irq_mode.BCM8879X=1 +port_fec.BCM8879X=7 +port_init_cl72.BCM8879X=0 +port_init_speed.BCM8879X=53125 +rate_ext_mdio_divisor.BCM8879X=14 +rate_int_mdio_divisor.BCM8879X=50 +schan_intr_enable.BCM8879X=0 +schan_timeout_usec.BCM8879X=300000 +serdes_fabric_clk_freq_in.BCM8879X=1 +serdes_fabric_clk_freq_out.BCM8879X=bypass +soc_family.BCM8879X=BCM8879X +srd_tx_drv_hv_disable.BCM8879X=0 +system_contains_multiple_pipe_device.BCM8879X=0 +system_ref_core_clock_khz.BCM8879X=1200000 +table_dma_enable.BCM8879X=0 +tdma_intr_enable.BCM8879X=0 +tdma_timeout_usec.BCM8879X=5000000 +tslam_dma_enable.BCM8879X=0 +tslam_intr_enable.BCM8879X=0 +tslam_timeout_usec.BCM8879X=5000000 + +lane_to_serdes_map_fabric_lane0.BCM8879X=rx0:tx0 +lane_to_serdes_map_fabric_lane1.BCM8879X=rx1:tx1 +lane_to_serdes_map_fabric_lane2.BCM8879X=rx2:tx2 +lane_to_serdes_map_fabric_lane3.BCM8879X=rx3:tx3 + +lane_to_serdes_map_fabric_lane4.BCM8879X=rx4:tx4 +lane_to_serdes_map_fabric_lane5.BCM8879X=rx5:tx5 +lane_to_serdes_map_fabric_lane6.BCM8879X=rx6:tx6 +lane_to_serdes_map_fabric_lane7.BCM8879X=rx7:tx7 + +lane_to_serdes_map_fabric_lane8.BCM8879X=rx8:tx8 +lane_to_serdes_map_fabric_lane9.BCM8879X=rx9:tx9 +lane_to_serdes_map_fabric_lane10.BCM8879X=rx10:tx10 +lane_to_serdes_map_fabric_lane11.BCM8879X=rx11:tx11 + +lane_to_serdes_map_fabric_lane12.BCM8879X=rx12:tx12 +lane_to_serdes_map_fabric_lane13.BCM8879X=rx13:tx13 +lane_to_serdes_map_fabric_lane14.BCM8879X=rx14:tx14 +lane_to_serdes_map_fabric_lane15.BCM8879X=rx15:tx15 + +lane_to_serdes_map_fabric_lane16.BCM8879X=rx16:tx16 +lane_to_serdes_map_fabric_lane17.BCM8879X=rx17:tx17 +lane_to_serdes_map_fabric_lane18.BCM8879X=rx18:tx18 +lane_to_serdes_map_fabric_lane19.BCM8879X=rx19:tx19 + +lane_to_serdes_map_fabric_lane20.BCM8879X=rx20:tx20 +lane_to_serdes_map_fabric_lane21.BCM8879X=rx21:tx21 +lane_to_serdes_map_fabric_lane22.BCM8879X=rx22:tx22 +lane_to_serdes_map_fabric_lane23.BCM8879X=rx23:tx23 + +lane_to_serdes_map_fabric_lane24.BCM8879X=rx24:tx24 +lane_to_serdes_map_fabric_lane25.BCM8879X=rx25:tx25 +lane_to_serdes_map_fabric_lane26.BCM8879X=rx26:tx26 +lane_to_serdes_map_fabric_lane27.BCM8879X=rx27:tx27 + +lane_to_serdes_map_fabric_lane28.BCM8879X=rx28:tx28 +lane_to_serdes_map_fabric_lane29.BCM8879X=rx29:tx29 +lane_to_serdes_map_fabric_lane30.BCM8879X=rx30:tx30 +lane_to_serdes_map_fabric_lane31.BCM8879X=rx31:tx31 + +lane_to_serdes_map_fabric_lane32.BCM8879X=rx32:tx32 +lane_to_serdes_map_fabric_lane33.BCM8879X=rx33:tx33 +lane_to_serdes_map_fabric_lane34.BCM8879X=rx34:tx34 +lane_to_serdes_map_fabric_lane35.BCM8879X=rx35:tx35 + +lane_to_serdes_map_fabric_lane36.BCM8879X=rx36:tx36 +lane_to_serdes_map_fabric_lane37.BCM8879X=rx37:tx37 +lane_to_serdes_map_fabric_lane38.BCM8879X=rx38:tx38 +lane_to_serdes_map_fabric_lane39.BCM8879X=rx39:tx39 + +lane_to_serdes_map_fabric_lane40.BCM8879X=rx40:tx40 +lane_to_serdes_map_fabric_lane41.BCM8879X=rx41:tx41 +lane_to_serdes_map_fabric_lane42.BCM8879X=rx42:tx42 +lane_to_serdes_map_fabric_lane43.BCM8879X=rx43:tx43 + +lane_to_serdes_map_fabric_lane44.BCM8879X=rx44:tx44 +lane_to_serdes_map_fabric_lane45.BCM8879X=rx45:tx45 +lane_to_serdes_map_fabric_lane46.BCM8879X=rx46:tx46 +lane_to_serdes_map_fabric_lane47.BCM8879X=rx47:tx47 + +lane_to_serdes_map_fabric_lane48.BCM8879X=rx48:tx48 +lane_to_serdes_map_fabric_lane49.BCM8879X=rx49:tx49 +lane_to_serdes_map_fabric_lane50.BCM8879X=rx50:tx50 +lane_to_serdes_map_fabric_lane51.BCM8879X=rx51:tx51 + +lane_to_serdes_map_fabric_lane52.BCM8879X=rx52:tx52 +lane_to_serdes_map_fabric_lane53.BCM8879X=rx53:tx53 +lane_to_serdes_map_fabric_lane54.BCM8879X=rx54:tx54 +lane_to_serdes_map_fabric_lane55.BCM8879X=rx55:tx55 + +lane_to_serdes_map_fabric_lane56.BCM8879X=rx56:tx56 +lane_to_serdes_map_fabric_lane57.BCM8879X=rx57:tx57 +lane_to_serdes_map_fabric_lane58.BCM8879X=rx58:tx58 +lane_to_serdes_map_fabric_lane59.BCM8879X=rx59:tx59 + +lane_to_serdes_map_fabric_lane60.BCM8879X=rx60:tx60 +lane_to_serdes_map_fabric_lane61.BCM8879X=rx61:tx61 +lane_to_serdes_map_fabric_lane62.BCM8879X=rx62:tx62 +lane_to_serdes_map_fabric_lane63.BCM8879X=rx63:tx63 + +lane_to_serdes_map_fabric_lane64.BCM8879X=rx64:tx64 +lane_to_serdes_map_fabric_lane65.BCM8879X=rx65:tx65 +lane_to_serdes_map_fabric_lane66.BCM8879X=rx66:tx66 +lane_to_serdes_map_fabric_lane67.BCM8879X=rx67:tx67 + +lane_to_serdes_map_fabric_lane68.BCM8879X=rx68:tx68 +lane_to_serdes_map_fabric_lane69.BCM8879X=rx69:tx69 +lane_to_serdes_map_fabric_lane70.BCM8879X=rx70:tx70 +lane_to_serdes_map_fabric_lane71.BCM8879X=rx71:tx71 + +lane_to_serdes_map_fabric_lane72.BCM8879X=rx72:tx72 +lane_to_serdes_map_fabric_lane73.BCM8879X=rx73:tx73 +lane_to_serdes_map_fabric_lane74.BCM8879X=rx74:tx74 +lane_to_serdes_map_fabric_lane75.BCM8879X=rx75:tx75 + +lane_to_serdes_map_fabric_lane76.BCM8879X=rx76:tx76 +lane_to_serdes_map_fabric_lane77.BCM8879X=rx77:tx77 +lane_to_serdes_map_fabric_lane78.BCM8879X=rx78:tx78 +lane_to_serdes_map_fabric_lane79.BCM8879X=rx79:tx79 + +lane_to_serdes_map_fabric_lane80.BCM8879X=rx80:tx80 +lane_to_serdes_map_fabric_lane81.BCM8879X=rx81:tx81 +lane_to_serdes_map_fabric_lane82.BCM8879X=rx82:tx82 +lane_to_serdes_map_fabric_lane83.BCM8879X=rx83:tx83 + +lane_to_serdes_map_fabric_lane84.BCM8879X=rx84:tx84 +lane_to_serdes_map_fabric_lane85.BCM8879X=rx85:tx85 +lane_to_serdes_map_fabric_lane86.BCM8879X=rx86:tx86 +lane_to_serdes_map_fabric_lane87.BCM8879X=rx87:tx87 + +lane_to_serdes_map_fabric_lane88.BCM8879X=rx88:tx88 +lane_to_serdes_map_fabric_lane89.BCM8879X=rx89:tx89 +lane_to_serdes_map_fabric_lane90.BCM8879X=rx90:tx90 +lane_to_serdes_map_fabric_lane91.BCM8879X=rx91:tx91 + +lane_to_serdes_map_fabric_lane92.BCM8879X=rx92:tx92 +lane_to_serdes_map_fabric_lane93.BCM8879X=rx93:tx93 +lane_to_serdes_map_fabric_lane94.BCM8879X=rx94:tx94 +lane_to_serdes_map_fabric_lane95.BCM8879X=rx95:tx95 + +lane_to_serdes_map_fabric_lane96.BCM8879X=rx96:tx96 +lane_to_serdes_map_fabric_lane97.BCM8879X=rx97:tx97 +lane_to_serdes_map_fabric_lane98.BCM8879X=rx98:tx98 +lane_to_serdes_map_fabric_lane99.BCM8879X=rx99:tx99 + +lane_to_serdes_map_fabric_lane100.BCM8879X=rx100:tx100 +lane_to_serdes_map_fabric_lane101.BCM8879X=rx101:tx101 +lane_to_serdes_map_fabric_lane102.BCM8879X=rx102:tx102 +lane_to_serdes_map_fabric_lane103.BCM8879X=rx103:tx103 + +lane_to_serdes_map_fabric_lane104.BCM8879X=rx104:tx104 +lane_to_serdes_map_fabric_lane105.BCM8879X=rx105:tx105 +lane_to_serdes_map_fabric_lane106.BCM8879X=rx106:tx106 +lane_to_serdes_map_fabric_lane107.BCM8879X=rx107:tx107 + +lane_to_serdes_map_fabric_lane108.BCM8879X=rx108:tx108 +lane_to_serdes_map_fabric_lane109.BCM8879X=rx109:tx109 +lane_to_serdes_map_fabric_lane110.BCM8879X=rx110:tx110 +lane_to_serdes_map_fabric_lane111.BCM8879X=rx111:tx111 + +lane_to_serdes_map_fabric_lane112.BCM8879X=rx112:tx112 +lane_to_serdes_map_fabric_lane113.BCM8879X=rx113:tx113 +lane_to_serdes_map_fabric_lane114.BCM8879X=rx114:tx114 +lane_to_serdes_map_fabric_lane115.BCM8879X=rx115:tx115 + +lane_to_serdes_map_fabric_lane116.BCM8879X=rx116:tx116 +lane_to_serdes_map_fabric_lane117.BCM8879X=rx117:tx117 +lane_to_serdes_map_fabric_lane118.BCM8879X=rx118:tx118 +lane_to_serdes_map_fabric_lane119.BCM8879X=rx119:tx119 + +lane_to_serdes_map_fabric_lane120.BCM8879X=rx120:tx120 +lane_to_serdes_map_fabric_lane121.BCM8879X=rx121:tx121 +lane_to_serdes_map_fabric_lane122.BCM8879X=rx122:tx122 +lane_to_serdes_map_fabric_lane123.BCM8879X=rx123:tx123 + +lane_to_serdes_map_fabric_lane124.BCM8879X=rx124:tx124 +lane_to_serdes_map_fabric_lane125.BCM8879X=rx125:tx125 +lane_to_serdes_map_fabric_lane126.BCM8879X=rx126:tx126 +lane_to_serdes_map_fabric_lane127.BCM8879X=rx127:tx127 + +lane_to_serdes_map_fabric_lane128.BCM8879X=rx128:tx128 +lane_to_serdes_map_fabric_lane129.BCM8879X=rx129:tx129 +lane_to_serdes_map_fabric_lane130.BCM8879X=rx130:tx130 +lane_to_serdes_map_fabric_lane131.BCM8879X=rx131:tx131 + +lane_to_serdes_map_fabric_lane132.BCM8879X=rx132:tx132 +lane_to_serdes_map_fabric_lane133.BCM8879X=rx133:tx133 +lane_to_serdes_map_fabric_lane134.BCM8879X=rx134:tx134 +lane_to_serdes_map_fabric_lane135.BCM8879X=rx135:tx135 + +lane_to_serdes_map_fabric_lane136.BCM8879X=rx136:tx136 +lane_to_serdes_map_fabric_lane137.BCM8879X=rx137:tx137 +lane_to_serdes_map_fabric_lane138.BCM8879X=rx138:tx138 +lane_to_serdes_map_fabric_lane139.BCM8879X=rx139:tx139 + +lane_to_serdes_map_fabric_lane140.BCM8879X=rx140:tx140 +lane_to_serdes_map_fabric_lane141.BCM8879X=rx141:tx141 +lane_to_serdes_map_fabric_lane142.BCM8879X=rx142:tx142 +lane_to_serdes_map_fabric_lane143.BCM8879X=rx143:tx143 + +lane_to_serdes_map_fabric_lane144.BCM8879X=rx144:tx144 +lane_to_serdes_map_fabric_lane145.BCM8879X=rx145:tx145 +lane_to_serdes_map_fabric_lane146.BCM8879X=rx146:tx146 +lane_to_serdes_map_fabric_lane147.BCM8879X=rx147:tx147 + +lane_to_serdes_map_fabric_lane148.BCM8879X=rx148:tx148 +lane_to_serdes_map_fabric_lane149.BCM8879X=rx149:tx149 +lane_to_serdes_map_fabric_lane150.BCM8879X=rx150:tx150 +lane_to_serdes_map_fabric_lane151.BCM8879X=rx151:tx151 + +lane_to_serdes_map_fabric_lane152.BCM8879X=rx152:tx152 +lane_to_serdes_map_fabric_lane153.BCM8879X=rx153:tx153 +lane_to_serdes_map_fabric_lane154.BCM8879X=rx154:tx154 +lane_to_serdes_map_fabric_lane155.BCM8879X=rx155:tx155 + +lane_to_serdes_map_fabric_lane156.BCM8879X=rx156:tx156 +lane_to_serdes_map_fabric_lane157.BCM8879X=rx157:tx157 +lane_to_serdes_map_fabric_lane158.BCM8879X=rx158:tx158 +lane_to_serdes_map_fabric_lane159.BCM8879X=rx159:tx159 + +lane_to_serdes_map_fabric_lane160.BCM8879X=rx160:tx160 +lane_to_serdes_map_fabric_lane161.BCM8879X=rx161:tx161 +lane_to_serdes_map_fabric_lane162.BCM8879X=rx162:tx162 +lane_to_serdes_map_fabric_lane163.BCM8879X=rx163:tx163 + +lane_to_serdes_map_fabric_lane164.BCM8879X=rx164:tx164 +lane_to_serdes_map_fabric_lane165.BCM8879X=rx165:tx165 +lane_to_serdes_map_fabric_lane166.BCM8879X=rx166:tx166 +lane_to_serdes_map_fabric_lane167.BCM8879X=rx167:tx167 + +lane_to_serdes_map_fabric_lane168.BCM8879X=rx168:tx168 +lane_to_serdes_map_fabric_lane169.BCM8879X=rx169:tx169 +lane_to_serdes_map_fabric_lane170.BCM8879X=rx170:tx170 +lane_to_serdes_map_fabric_lane171.BCM8879X=rx171:tx171 + +lane_to_serdes_map_fabric_lane172.BCM8879X=rx172:tx172 +lane_to_serdes_map_fabric_lane173.BCM8879X=rx173:tx173 +lane_to_serdes_map_fabric_lane174.BCM8879X=rx174:tx174 +lane_to_serdes_map_fabric_lane175.BCM8879X=rx175:tx175 + +lane_to_serdes_map_fabric_lane176.BCM8879X=rx176:tx176 +lane_to_serdes_map_fabric_lane177.BCM8879X=rx177:tx177 +lane_to_serdes_map_fabric_lane178.BCM8879X=rx178:tx178 +lane_to_serdes_map_fabric_lane179.BCM8879X=rx179:tx179 + +lane_to_serdes_map_fabric_lane180.BCM8879X=rx180:tx180 +lane_to_serdes_map_fabric_lane181.BCM8879X=rx181:tx181 +lane_to_serdes_map_fabric_lane182.BCM8879X=rx182:tx182 +lane_to_serdes_map_fabric_lane183.BCM8879X=rx183:tx183 + +lane_to_serdes_map_fabric_lane184.BCM8879X=rx184:tx184 +lane_to_serdes_map_fabric_lane185.BCM8879X=rx185:tx185 +lane_to_serdes_map_fabric_lane186.BCM8879X=rx186:tx186 +lane_to_serdes_map_fabric_lane187.BCM8879X=rx187:tx187 + +lane_to_serdes_map_fabric_lane188.BCM8879X=rx188:tx188 +lane_to_serdes_map_fabric_lane189.BCM8879X=rx189:tx189 +lane_to_serdes_map_fabric_lane190.BCM8879X=rx190:tx190 +lane_to_serdes_map_fabric_lane191.BCM8879X=rx191:tx191 + + +phy_rx_polarity_flip_fabric0.BCM8879X=1 +phy_rx_polarity_flip_fabric1.BCM8879X=0 +phy_rx_polarity_flip_fabric2.BCM8879X=1 +phy_rx_polarity_flip_fabric3.BCM8879X=0 + +phy_rx_polarity_flip_fabric4.BCM8879X=0 +phy_rx_polarity_flip_fabric5.BCM8879X=1 +phy_rx_polarity_flip_fabric6.BCM8879X=0 +phy_rx_polarity_flip_fabric7.BCM8879X=1 + +phy_rx_polarity_flip_fabric8.BCM8879X=1 +phy_rx_polarity_flip_fabric9.BCM8879X=0 +phy_rx_polarity_flip_fabric10.BCM8879X=1 +phy_rx_polarity_flip_fabric11.BCM8879X=0 + +phy_rx_polarity_flip_fabric12.BCM8879X=0 +phy_rx_polarity_flip_fabric13.BCM8879X=1 +phy_rx_polarity_flip_fabric14.BCM8879X=0 +phy_rx_polarity_flip_fabric15.BCM8879X=1 + +phy_rx_polarity_flip_fabric16.BCM8879X=1 +phy_rx_polarity_flip_fabric17.BCM8879X=0 +phy_rx_polarity_flip_fabric18.BCM8879X=1 +phy_rx_polarity_flip_fabric19.BCM8879X=0 + +phy_rx_polarity_flip_fabric20.BCM8879X=1 +phy_rx_polarity_flip_fabric21.BCM8879X=0 +phy_rx_polarity_flip_fabric22.BCM8879X=1 +phy_rx_polarity_flip_fabric23.BCM8879X=0 + +phy_rx_polarity_flip_fabric24.BCM8879X=1 +phy_rx_polarity_flip_fabric25.BCM8879X=0 +phy_rx_polarity_flip_fabric26.BCM8879X=1 +phy_rx_polarity_flip_fabric27.BCM8879X=0 + +phy_rx_polarity_flip_fabric28.BCM8879X=0 +phy_rx_polarity_flip_fabric29.BCM8879X=1 +phy_rx_polarity_flip_fabric30.BCM8879X=0 +phy_rx_polarity_flip_fabric31.BCM8879X=1 + +phy_rx_polarity_flip_fabric32.BCM8879X=1 +phy_rx_polarity_flip_fabric33.BCM8879X=0 +phy_rx_polarity_flip_fabric34.BCM8879X=1 +phy_rx_polarity_flip_fabric35.BCM8879X=0 + +phy_rx_polarity_flip_fabric36.BCM8879X=0 +phy_rx_polarity_flip_fabric37.BCM8879X=1 +phy_rx_polarity_flip_fabric38.BCM8879X=0 +phy_rx_polarity_flip_fabric39.BCM8879X=1 + +phy_rx_polarity_flip_fabric40.BCM8879X=1 +phy_rx_polarity_flip_fabric41.BCM8879X=0 +phy_rx_polarity_flip_fabric42.BCM8879X=1 +phy_rx_polarity_flip_fabric43.BCM8879X=0 + +phy_rx_polarity_flip_fabric44.BCM8879X=1 +phy_rx_polarity_flip_fabric45.BCM8879X=0 +phy_rx_polarity_flip_fabric46.BCM8879X=1 +phy_rx_polarity_flip_fabric47.BCM8879X=0 + +phy_rx_polarity_flip_fabric48.BCM8879X=0 +phy_rx_polarity_flip_fabric49.BCM8879X=1 +phy_rx_polarity_flip_fabric50.BCM8879X=0 +phy_rx_polarity_flip_fabric51.BCM8879X=1 + +phy_rx_polarity_flip_fabric52.BCM8879X=1 +phy_rx_polarity_flip_fabric53.BCM8879X=0 +phy_rx_polarity_flip_fabric54.BCM8879X=1 +phy_rx_polarity_flip_fabric55.BCM8879X=0 + +phy_rx_polarity_flip_fabric56.BCM8879X=0 +phy_rx_polarity_flip_fabric57.BCM8879X=1 +phy_rx_polarity_flip_fabric58.BCM8879X=0 +phy_rx_polarity_flip_fabric59.BCM8879X=1 + +phy_rx_polarity_flip_fabric60.BCM8879X=0 +phy_rx_polarity_flip_fabric61.BCM8879X=1 +phy_rx_polarity_flip_fabric62.BCM8879X=0 +phy_rx_polarity_flip_fabric63.BCM8879X=1 + +phy_rx_polarity_flip_fabric64.BCM8879X=1 +phy_rx_polarity_flip_fabric65.BCM8879X=0 +phy_rx_polarity_flip_fabric66.BCM8879X=1 +phy_rx_polarity_flip_fabric67.BCM8879X=0 + +phy_rx_polarity_flip_fabric68.BCM8879X=0 +phy_rx_polarity_flip_fabric69.BCM8879X=1 +phy_rx_polarity_flip_fabric70.BCM8879X=0 +phy_rx_polarity_flip_fabric71.BCM8879X=1 + +phy_rx_polarity_flip_fabric72.BCM8879X=1 +phy_rx_polarity_flip_fabric73.BCM8879X=0 +phy_rx_polarity_flip_fabric74.BCM8879X=1 +phy_rx_polarity_flip_fabric75.BCM8879X=0 + +phy_rx_polarity_flip_fabric76.BCM8879X=1 +phy_rx_polarity_flip_fabric77.BCM8879X=0 +phy_rx_polarity_flip_fabric78.BCM8879X=1 +phy_rx_polarity_flip_fabric79.BCM8879X=0 + +phy_rx_polarity_flip_fabric80.BCM8879X=0 +phy_rx_polarity_flip_fabric81.BCM8879X=1 +phy_rx_polarity_flip_fabric82.BCM8879X=0 +phy_rx_polarity_flip_fabric83.BCM8879X=1 + +phy_rx_polarity_flip_fabric84.BCM8879X=1 +phy_rx_polarity_flip_fabric85.BCM8879X=0 +phy_rx_polarity_flip_fabric86.BCM8879X=1 +phy_rx_polarity_flip_fabric87.BCM8879X=0 + +phy_rx_polarity_flip_fabric88.BCM8879X=0 +phy_rx_polarity_flip_fabric89.BCM8879X=1 +phy_rx_polarity_flip_fabric90.BCM8879X=0 +phy_rx_polarity_flip_fabric91.BCM8879X=1 + +phy_rx_polarity_flip_fabric92.BCM8879X=1 +phy_rx_polarity_flip_fabric93.BCM8879X=0 +phy_rx_polarity_flip_fabric94.BCM8879X=1 +phy_rx_polarity_flip_fabric95.BCM8879X=0 + +phy_rx_polarity_flip_fabric96.BCM8879X=1 +phy_rx_polarity_flip_fabric97.BCM8879X=0 +phy_rx_polarity_flip_fabric98.BCM8879X=1 +phy_rx_polarity_flip_fabric99.BCM8879X=0 + +phy_rx_polarity_flip_fabric100.BCM8879X=0 +phy_rx_polarity_flip_fabric101.BCM8879X=1 +phy_rx_polarity_flip_fabric102.BCM8879X=0 +phy_rx_polarity_flip_fabric103.BCM8879X=1 + +phy_rx_polarity_flip_fabric104.BCM8879X=0 +phy_rx_polarity_flip_fabric105.BCM8879X=1 +phy_rx_polarity_flip_fabric106.BCM8879X=0 +phy_rx_polarity_flip_fabric107.BCM8879X=1 + +phy_rx_polarity_flip_fabric108.BCM8879X=0 +phy_rx_polarity_flip_fabric109.BCM8879X=1 +phy_rx_polarity_flip_fabric110.BCM8879X=0 +phy_rx_polarity_flip_fabric111.BCM8879X=1 + +phy_rx_polarity_flip_fabric112.BCM8879X=0 +phy_rx_polarity_flip_fabric113.BCM8879X=1 +phy_rx_polarity_flip_fabric114.BCM8879X=0 +phy_rx_polarity_flip_fabric115.BCM8879X=1 + +phy_rx_polarity_flip_fabric116.BCM8879X=1 +phy_rx_polarity_flip_fabric117.BCM8879X=0 +phy_rx_polarity_flip_fabric118.BCM8879X=1 +phy_rx_polarity_flip_fabric119.BCM8879X=0 + +phy_rx_polarity_flip_fabric120.BCM8879X=1 +phy_rx_polarity_flip_fabric121.BCM8879X=0 +phy_rx_polarity_flip_fabric122.BCM8879X=1 +phy_rx_polarity_flip_fabric123.BCM8879X=0 + +phy_rx_polarity_flip_fabric124.BCM8879X=0 +phy_rx_polarity_flip_fabric125.BCM8879X=1 +phy_rx_polarity_flip_fabric126.BCM8879X=0 +phy_rx_polarity_flip_fabric127.BCM8879X=1 + +phy_rx_polarity_flip_fabric128.BCM8879X=1 +phy_rx_polarity_flip_fabric129.BCM8879X=0 +phy_rx_polarity_flip_fabric130.BCM8879X=1 +phy_rx_polarity_flip_fabric131.BCM8879X=0 + +phy_rx_polarity_flip_fabric132.BCM8879X=0 +phy_rx_polarity_flip_fabric133.BCM8879X=1 +phy_rx_polarity_flip_fabric134.BCM8879X=0 +phy_rx_polarity_flip_fabric135.BCM8879X=1 + +phy_rx_polarity_flip_fabric136.BCM8879X=1 +phy_rx_polarity_flip_fabric137.BCM8879X=0 +phy_rx_polarity_flip_fabric138.BCM8879X=1 +phy_rx_polarity_flip_fabric139.BCM8879X=0 + +phy_rx_polarity_flip_fabric140.BCM8879X=1 +phy_rx_polarity_flip_fabric141.BCM8879X=0 +phy_rx_polarity_flip_fabric142.BCM8879X=1 +phy_rx_polarity_flip_fabric143.BCM8879X=0 + +phy_rx_polarity_flip_fabric144.BCM8879X=1 +phy_rx_polarity_flip_fabric145.BCM8879X=0 +phy_rx_polarity_flip_fabric146.BCM8879X=1 +phy_rx_polarity_flip_fabric147.BCM8879X=0 + +phy_rx_polarity_flip_fabric148.BCM8879X=1 +phy_rx_polarity_flip_fabric149.BCM8879X=0 +phy_rx_polarity_flip_fabric150.BCM8879X=1 +phy_rx_polarity_flip_fabric151.BCM8879X=0 + +phy_rx_polarity_flip_fabric152.BCM8879X=0 +phy_rx_polarity_flip_fabric153.BCM8879X=1 +phy_rx_polarity_flip_fabric154.BCM8879X=0 +phy_rx_polarity_flip_fabric155.BCM8879X=1 + +phy_rx_polarity_flip_fabric156.BCM8879X=1 +phy_rx_polarity_flip_fabric157.BCM8879X=0 +phy_rx_polarity_flip_fabric158.BCM8879X=1 +phy_rx_polarity_flip_fabric159.BCM8879X=0 + +phy_rx_polarity_flip_fabric160.BCM8879X=1 +phy_rx_polarity_flip_fabric161.BCM8879X=0 +phy_rx_polarity_flip_fabric162.BCM8879X=1 +phy_rx_polarity_flip_fabric163.BCM8879X=0 + +phy_rx_polarity_flip_fabric164.BCM8879X=0 +phy_rx_polarity_flip_fabric165.BCM8879X=1 +phy_rx_polarity_flip_fabric166.BCM8879X=0 +phy_rx_polarity_flip_fabric167.BCM8879X=1 + +phy_rx_polarity_flip_fabric168.BCM8879X=1 +phy_rx_polarity_flip_fabric169.BCM8879X=0 +phy_rx_polarity_flip_fabric170.BCM8879X=1 +phy_rx_polarity_flip_fabric171.BCM8879X=0 + +phy_rx_polarity_flip_fabric172.BCM8879X=1 +phy_rx_polarity_flip_fabric173.BCM8879X=0 +phy_rx_polarity_flip_fabric174.BCM8879X=1 +phy_rx_polarity_flip_fabric175.BCM8879X=0 + +phy_rx_polarity_flip_fabric176.BCM8879X=0 +phy_rx_polarity_flip_fabric177.BCM8879X=1 +phy_rx_polarity_flip_fabric178.BCM8879X=0 +phy_rx_polarity_flip_fabric179.BCM8879X=1 + +phy_rx_polarity_flip_fabric180.BCM8879X=1 +phy_rx_polarity_flip_fabric181.BCM8879X=0 +phy_rx_polarity_flip_fabric182.BCM8879X=1 +phy_rx_polarity_flip_fabric183.BCM8879X=0 + +phy_rx_polarity_flip_fabric184.BCM8879X=0 +phy_rx_polarity_flip_fabric185.BCM8879X=1 +phy_rx_polarity_flip_fabric186.BCM8879X=0 +phy_rx_polarity_flip_fabric187.BCM8879X=1 + +phy_rx_polarity_flip_fabric188.BCM8879X=1 +phy_rx_polarity_flip_fabric189.BCM8879X=0 +phy_rx_polarity_flip_fabric190.BCM8879X=1 +phy_rx_polarity_flip_fabric191.BCM8879X=0 + +phy_tx_polarity_flip_fabric0.BCM8879X=0 +phy_tx_polarity_flip_fabric1.BCM8879X=1 +phy_tx_polarity_flip_fabric2.BCM8879X=0 +phy_tx_polarity_flip_fabric3.BCM8879X=1 + +phy_tx_polarity_flip_fabric4.BCM8879X=1 +phy_tx_polarity_flip_fabric5.BCM8879X=0 +phy_tx_polarity_flip_fabric6.BCM8879X=1 +phy_tx_polarity_flip_fabric7.BCM8879X=0 + +phy_tx_polarity_flip_fabric8.BCM8879X=0 +phy_tx_polarity_flip_fabric9.BCM8879X=1 +phy_tx_polarity_flip_fabric10.BCM8879X=0 +phy_tx_polarity_flip_fabric11.BCM8879X=1 + +phy_tx_polarity_flip_fabric12.BCM8879X=1 +phy_tx_polarity_flip_fabric13.BCM8879X=0 +phy_tx_polarity_flip_fabric14.BCM8879X=1 +phy_tx_polarity_flip_fabric15.BCM8879X=0 + +phy_tx_polarity_flip_fabric16.BCM8879X=0 +phy_tx_polarity_flip_fabric17.BCM8879X=1 +phy_tx_polarity_flip_fabric18.BCM8879X=0 +phy_tx_polarity_flip_fabric19.BCM8879X=1 + +phy_tx_polarity_flip_fabric20.BCM8879X=0 +phy_tx_polarity_flip_fabric21.BCM8879X=1 +phy_tx_polarity_flip_fabric22.BCM8879X=0 +phy_tx_polarity_flip_fabric23.BCM8879X=1 + +phy_tx_polarity_flip_fabric24.BCM8879X=0 +phy_tx_polarity_flip_fabric25.BCM8879X=1 +phy_tx_polarity_flip_fabric26.BCM8879X=0 +phy_tx_polarity_flip_fabric27.BCM8879X=1 + +phy_tx_polarity_flip_fabric28.BCM8879X=1 +phy_tx_polarity_flip_fabric29.BCM8879X=0 +phy_tx_polarity_flip_fabric30.BCM8879X=1 +phy_tx_polarity_flip_fabric31.BCM8879X=0 + +phy_tx_polarity_flip_fabric32.BCM8879X=0 +phy_tx_polarity_flip_fabric33.BCM8879X=1 +phy_tx_polarity_flip_fabric34.BCM8879X=0 +phy_tx_polarity_flip_fabric35.BCM8879X=1 + +phy_tx_polarity_flip_fabric36.BCM8879X=1 +phy_tx_polarity_flip_fabric37.BCM8879X=0 +phy_tx_polarity_flip_fabric38.BCM8879X=1 +phy_tx_polarity_flip_fabric39.BCM8879X=0 + +phy_tx_polarity_flip_fabric40.BCM8879X=0 +phy_tx_polarity_flip_fabric41.BCM8879X=1 +phy_tx_polarity_flip_fabric42.BCM8879X=0 +phy_tx_polarity_flip_fabric43.BCM8879X=1 + +phy_tx_polarity_flip_fabric44.BCM8879X=0 +phy_tx_polarity_flip_fabric45.BCM8879X=1 +phy_tx_polarity_flip_fabric46.BCM8879X=0 +phy_tx_polarity_flip_fabric47.BCM8879X=1 + +phy_tx_polarity_flip_fabric48.BCM8879X=1 +phy_tx_polarity_flip_fabric49.BCM8879X=0 +phy_tx_polarity_flip_fabric50.BCM8879X=1 +phy_tx_polarity_flip_fabric51.BCM8879X=0 + +phy_tx_polarity_flip_fabric52.BCM8879X=0 +phy_tx_polarity_flip_fabric53.BCM8879X=1 +phy_tx_polarity_flip_fabric54.BCM8879X=0 +phy_tx_polarity_flip_fabric55.BCM8879X=1 + +phy_tx_polarity_flip_fabric56.BCM8879X=1 +phy_tx_polarity_flip_fabric57.BCM8879X=0 +phy_tx_polarity_flip_fabric58.BCM8879X=1 +phy_tx_polarity_flip_fabric59.BCM8879X=0 + +phy_tx_polarity_flip_fabric60.BCM8879X=1 +phy_tx_polarity_flip_fabric61.BCM8879X=0 +phy_tx_polarity_flip_fabric62.BCM8879X=1 +phy_tx_polarity_flip_fabric63.BCM8879X=0 + +phy_tx_polarity_flip_fabric64.BCM8879X=0 +phy_tx_polarity_flip_fabric65.BCM8879X=1 +phy_tx_polarity_flip_fabric66.BCM8879X=0 +phy_tx_polarity_flip_fabric67.BCM8879X=1 + +phy_tx_polarity_flip_fabric68.BCM8879X=1 +phy_tx_polarity_flip_fabric69.BCM8879X=0 +phy_tx_polarity_flip_fabric70.BCM8879X=1 +phy_tx_polarity_flip_fabric71.BCM8879X=0 + +phy_tx_polarity_flip_fabric72.BCM8879X=0 +phy_tx_polarity_flip_fabric73.BCM8879X=1 +phy_tx_polarity_flip_fabric74.BCM8879X=0 +phy_tx_polarity_flip_fabric75.BCM8879X=1 + +phy_tx_polarity_flip_fabric76.BCM8879X=0 +phy_tx_polarity_flip_fabric77.BCM8879X=1 +phy_tx_polarity_flip_fabric78.BCM8879X=0 +phy_tx_polarity_flip_fabric79.BCM8879X=1 + +phy_tx_polarity_flip_fabric80.BCM8879X=1 +phy_tx_polarity_flip_fabric81.BCM8879X=0 +phy_tx_polarity_flip_fabric82.BCM8879X=1 +phy_tx_polarity_flip_fabric83.BCM8879X=0 + +phy_tx_polarity_flip_fabric84.BCM8879X=0 +phy_tx_polarity_flip_fabric85.BCM8879X=1 +phy_tx_polarity_flip_fabric86.BCM8879X=0 +phy_tx_polarity_flip_fabric87.BCM8879X=1 + +phy_tx_polarity_flip_fabric88.BCM8879X=1 +phy_tx_polarity_flip_fabric89.BCM8879X=0 +phy_tx_polarity_flip_fabric90.BCM8879X=1 +phy_tx_polarity_flip_fabric91.BCM8879X=0 + +phy_tx_polarity_flip_fabric92.BCM8879X=0 +phy_tx_polarity_flip_fabric93.BCM8879X=1 +phy_tx_polarity_flip_fabric94.BCM8879X=0 +phy_tx_polarity_flip_fabric95.BCM8879X=1 + +phy_tx_polarity_flip_fabric96.BCM8879X=0 +phy_tx_polarity_flip_fabric97.BCM8879X=1 +phy_tx_polarity_flip_fabric98.BCM8879X=0 +phy_tx_polarity_flip_fabric99.BCM8879X=1 + +phy_tx_polarity_flip_fabric100.BCM8879X=1 +phy_tx_polarity_flip_fabric101.BCM8879X=0 +phy_tx_polarity_flip_fabric102.BCM8879X=1 +phy_tx_polarity_flip_fabric103.BCM8879X=0 + +phy_tx_polarity_flip_fabric104.BCM8879X=1 +phy_tx_polarity_flip_fabric105.BCM8879X=0 +phy_tx_polarity_flip_fabric106.BCM8879X=1 +phy_tx_polarity_flip_fabric107.BCM8879X=0 + +phy_tx_polarity_flip_fabric108.BCM8879X=1 +phy_tx_polarity_flip_fabric109.BCM8879X=0 +phy_tx_polarity_flip_fabric110.BCM8879X=1 +phy_tx_polarity_flip_fabric111.BCM8879X=0 + +phy_tx_polarity_flip_fabric112.BCM8879X=1 +phy_tx_polarity_flip_fabric113.BCM8879X=0 +phy_tx_polarity_flip_fabric114.BCM8879X=1 +phy_tx_polarity_flip_fabric115.BCM8879X=0 + +phy_tx_polarity_flip_fabric116.BCM8879X=0 +phy_tx_polarity_flip_fabric117.BCM8879X=1 +phy_tx_polarity_flip_fabric118.BCM8879X=0 +phy_tx_polarity_flip_fabric119.BCM8879X=1 + +phy_tx_polarity_flip_fabric120.BCM8879X=0 +phy_tx_polarity_flip_fabric121.BCM8879X=1 +phy_tx_polarity_flip_fabric122.BCM8879X=0 +phy_tx_polarity_flip_fabric123.BCM8879X=1 + +phy_tx_polarity_flip_fabric124.BCM8879X=1 +phy_tx_polarity_flip_fabric125.BCM8879X=0 +phy_tx_polarity_flip_fabric126.BCM8879X=1 +phy_tx_polarity_flip_fabric127.BCM8879X=0 + +phy_tx_polarity_flip_fabric128.BCM8879X=0 +phy_tx_polarity_flip_fabric129.BCM8879X=1 +phy_tx_polarity_flip_fabric130.BCM8879X=0 +phy_tx_polarity_flip_fabric131.BCM8879X=1 + +phy_tx_polarity_flip_fabric132.BCM8879X=1 +phy_tx_polarity_flip_fabric133.BCM8879X=0 +phy_tx_polarity_flip_fabric134.BCM8879X=1 +phy_tx_polarity_flip_fabric135.BCM8879X=0 + +phy_tx_polarity_flip_fabric136.BCM8879X=0 +phy_tx_polarity_flip_fabric137.BCM8879X=1 +phy_tx_polarity_flip_fabric138.BCM8879X=0 +phy_tx_polarity_flip_fabric139.BCM8879X=1 + +phy_tx_polarity_flip_fabric140.BCM8879X=0 +phy_tx_polarity_flip_fabric141.BCM8879X=1 +phy_tx_polarity_flip_fabric142.BCM8879X=0 +phy_tx_polarity_flip_fabric143.BCM8879X=1 + +phy_tx_polarity_flip_fabric144.BCM8879X=0 +phy_tx_polarity_flip_fabric145.BCM8879X=1 +phy_tx_polarity_flip_fabric146.BCM8879X=0 +phy_tx_polarity_flip_fabric147.BCM8879X=1 + +phy_tx_polarity_flip_fabric148.BCM8879X=0 +phy_tx_polarity_flip_fabric149.BCM8879X=1 +phy_tx_polarity_flip_fabric150.BCM8879X=0 +phy_tx_polarity_flip_fabric151.BCM8879X=1 + +phy_tx_polarity_flip_fabric152.BCM8879X=1 +phy_tx_polarity_flip_fabric153.BCM8879X=0 +phy_tx_polarity_flip_fabric154.BCM8879X=1 +phy_tx_polarity_flip_fabric155.BCM8879X=0 + +phy_tx_polarity_flip_fabric156.BCM8879X=0 +phy_tx_polarity_flip_fabric157.BCM8879X=1 +phy_tx_polarity_flip_fabric158.BCM8879X=0 +phy_tx_polarity_flip_fabric159.BCM8879X=1 + +phy_tx_polarity_flip_fabric160.BCM8879X=0 +phy_tx_polarity_flip_fabric161.BCM8879X=1 +phy_tx_polarity_flip_fabric162.BCM8879X=0 +phy_tx_polarity_flip_fabric163.BCM8879X=1 + +phy_tx_polarity_flip_fabric164.BCM8879X=1 +phy_tx_polarity_flip_fabric165.BCM8879X=0 +phy_tx_polarity_flip_fabric166.BCM8879X=1 +phy_tx_polarity_flip_fabric167.BCM8879X=0 + +phy_tx_polarity_flip_fabric168.BCM8879X=0 +phy_tx_polarity_flip_fabric169.BCM8879X=1 +phy_tx_polarity_flip_fabric170.BCM8879X=0 +phy_tx_polarity_flip_fabric171.BCM8879X=1 + +phy_tx_polarity_flip_fabric172.BCM8879X=0 +phy_tx_polarity_flip_fabric173.BCM8879X=1 +phy_tx_polarity_flip_fabric174.BCM8879X=0 +phy_tx_polarity_flip_fabric175.BCM8879X=1 + +phy_tx_polarity_flip_fabric176.BCM8879X=1 +phy_tx_polarity_flip_fabric177.BCM8879X=0 +phy_tx_polarity_flip_fabric178.BCM8879X=1 +phy_tx_polarity_flip_fabric179.BCM8879X=0 + +phy_tx_polarity_flip_fabric180.BCM8879X=0 +phy_tx_polarity_flip_fabric181.BCM8879X=1 +phy_tx_polarity_flip_fabric182.BCM8879X=0 +phy_tx_polarity_flip_fabric183.BCM8879X=1 + +phy_tx_polarity_flip_fabric184.BCM8879X=1 +phy_tx_polarity_flip_fabric185.BCM8879X=0 +phy_tx_polarity_flip_fabric186.BCM8879X=1 +phy_tx_polarity_flip_fabric187.BCM8879X=0 + +phy_tx_polarity_flip_fabric188.BCM8879X=0 +phy_tx_polarity_flip_fabric189.BCM8879X=1 +phy_tx_polarity_flip_fabric190.BCM8879X=0 +phy_tx_polarity_flip_fabric191.BCM8879X=1 + + +port_init_cl72_0=0 +port_init_cl72_1=0 +port_init_cl72_2=0 +port_init_cl72_3=0 +port_init_cl72_4=0 +port_init_cl72_5=0 +port_init_cl72_6=0 +port_init_cl72_7=0 +port_init_cl72_8=0 +port_init_cl72_9=0 +port_init_cl72_10=0 +port_init_cl72_11=0 +port_init_cl72_12=0 +port_init_cl72_13=0 +port_init_cl72_14=0 +port_init_cl72_15=0 +port_init_cl72_16=0 +port_init_cl72_17=0 +port_init_cl72_18=0 +port_init_cl72_19=0 +port_init_cl72_20=0 +port_init_cl72_21=0 +port_init_cl72_22=0 +port_init_cl72_23=0 +port_init_cl72_24=0 +port_init_cl72_25=0 +port_init_cl72_26=0 +port_init_cl72_27=0 +port_init_cl72_28=0 +port_init_cl72_29=0 +port_init_cl72_30=0 +port_init_cl72_31=0 +port_init_cl72_32=0 +port_init_cl72_33=0 +port_init_cl72_34=0 +port_init_cl72_35=0 +port_init_cl72_36=0 +port_init_cl72_37=0 +port_init_cl72_38=0 +port_init_cl72_39=0 +port_init_cl72_40=0 +port_init_cl72_41=0 +port_init_cl72_42=0 +port_init_cl72_43=0 +port_init_cl72_44=0 +port_init_cl72_45=0 +port_init_cl72_46=0 +port_init_cl72_47=0 +port_init_cl72_48=0 +port_init_cl72_49=0 +port_init_cl72_50=0 +port_init_cl72_51=0 +port_init_cl72_52=0 +port_init_cl72_53=0 +port_init_cl72_54=0 +port_init_cl72_55=0 +port_init_cl72_56=0 +port_init_cl72_57=0 +port_init_cl72_58=0 +port_init_cl72_59=0 +port_init_cl72_60=0 +port_init_cl72_61=0 +port_init_cl72_62=0 +port_init_cl72_63=0 +port_init_cl72_64=0 +port_init_cl72_65=0 +port_init_cl72_66=0 +port_init_cl72_67=0 +port_init_cl72_68=0 +port_init_cl72_69=0 +port_init_cl72_70=0 +port_init_cl72_71=0 +port_init_cl72_72=0 +port_init_cl72_73=0 +port_init_cl72_74=0 +port_init_cl72_75=0 +port_init_cl72_76=0 +port_init_cl72_77=0 +port_init_cl72_78=0 +port_init_cl72_79=0 +port_init_cl72_80=0 +port_init_cl72_81=0 +port_init_cl72_82=0 +port_init_cl72_83=0 +port_init_cl72_84=0 +port_init_cl72_85=0 +port_init_cl72_86=0 +port_init_cl72_87=0 +port_init_cl72_88=0 +port_init_cl72_89=0 +port_init_cl72_90=0 +port_init_cl72_91=0 +port_init_cl72_92=0 +port_init_cl72_93=0 +port_init_cl72_94=0 +port_init_cl72_95=0 +port_init_cl72_96=0 +port_init_cl72_97=0 +port_init_cl72_98=0 +port_init_cl72_99=0 +port_init_cl72_100=0 +port_init_cl72_101=0 +port_init_cl72_102=0 +port_init_cl72_103=0 +port_init_cl72_104=0 +port_init_cl72_105=0 +port_init_cl72_106=0 +port_init_cl72_107=0 +port_init_cl72_108=0 +port_init_cl72_109=0 +port_init_cl72_110=0 +port_init_cl72_111=0 +port_init_cl72_112=0 +port_init_cl72_113=0 +port_init_cl72_114=0 +port_init_cl72_115=0 +port_init_cl72_116=0 +port_init_cl72_117=0 +port_init_cl72_118=0 +port_init_cl72_119=0 +port_init_cl72_120=0 +port_init_cl72_121=0 +port_init_cl72_122=0 +port_init_cl72_123=0 +port_init_cl72_124=0 +port_init_cl72_125=0 +port_init_cl72_126=0 +port_init_cl72_127=0 +port_init_cl72_128=0 +port_init_cl72_129=0 +port_init_cl72_130=0 +port_init_cl72_131=0 +port_init_cl72_132=0 +port_init_cl72_133=0 +port_init_cl72_134=0 +port_init_cl72_135=0 +port_init_cl72_136=0 +port_init_cl72_137=0 +port_init_cl72_138=0 +port_init_cl72_139=0 +port_init_cl72_140=0 +port_init_cl72_141=0 +port_init_cl72_142=0 +port_init_cl72_143=0 +port_init_cl72_144=0 +port_init_cl72_145=0 +port_init_cl72_146=0 +port_init_cl72_147=0 +port_init_cl72_148=0 +port_init_cl72_149=0 +port_init_cl72_150=0 +port_init_cl72_151=0 +port_init_cl72_152=0 +port_init_cl72_153=0 +port_init_cl72_154=0 +port_init_cl72_155=0 +port_init_cl72_156=0 +port_init_cl72_157=0 +port_init_cl72_158=0 +port_init_cl72_159=0 +port_init_cl72_160=0 +port_init_cl72_161=0 +port_init_cl72_162=0 +port_init_cl72_163=0 +port_init_cl72_164=0 +port_init_cl72_165=0 +port_init_cl72_166=0 +port_init_cl72_167=0 +port_init_cl72_168=0 +port_init_cl72_169=0 +port_init_cl72_170=0 +port_init_cl72_171=0 +port_init_cl72_172=0 +port_init_cl72_173=0 +port_init_cl72_174=0 +port_init_cl72_175=0 +port_init_cl72_176=0 +port_init_cl72_177=0 +port_init_cl72_178=0 +port_init_cl72_179=0 +port_init_cl72_180=0 +port_init_cl72_181=0 +port_init_cl72_182=0 +port_init_cl72_183=0 +port_init_cl72_184=0 +port_init_cl72_185=0 +port_init_cl72_186=0 +port_init_cl72_187=0 +port_init_cl72_188=0 +port_init_cl72_189=0 +port_init_cl72_190=0 +port_init_cl72_191=0 + +serdes_tx_taps_0.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_1.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_2.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_3.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_4.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_5.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_6.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_7.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_8.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_9.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_10.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_11.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_12.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_13.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_14.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_15.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_16.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_17.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_18.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_19.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_20.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_21.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_22.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_23.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_24.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_25.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_26.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_27.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_28.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_29.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_30.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_31.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_32.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_33.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_34.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_35.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_36.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_37.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_38.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_39.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_40.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_41.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_42.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_43.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_44.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_45.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_46.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_47.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_48.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_49.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_50.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_51.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_52.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_53.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_54.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_55.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_56.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_57.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_58.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_59.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_60.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_61.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_62.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_63.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_64.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_65.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_66.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_67.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_68.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_69.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_70.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_71.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_72.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_73.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_74.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_75.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_76.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_77.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_78.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_79.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_80.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_81.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_82.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_83.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_84.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_85.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_86.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_87.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_88.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_89.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_90.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_91.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_92.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_93.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_94.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_95.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_96.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_97.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_98.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_99.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_100.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_101.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_102.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_103.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_104.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_105.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_106.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_107.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_108.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_109.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_110.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_111.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_112.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_113.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_114.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_115.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_116.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_117.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_118.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_119.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_120.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_121.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_122.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_123.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_124.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_125.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_126.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_127.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_128.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_129.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_130.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_131.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_132.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_133.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_134.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_135.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_136.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_137.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_138.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_139.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_140.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_141.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_142.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_143.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_144.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_145.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_146.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_147.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_148.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_149.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_150.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_151.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_152.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_153.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_154.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_155.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_156.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_157.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_158.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_159.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_160.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_161.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_162.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_163.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_164.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_165.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_166.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_167.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_168.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_169.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_170.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_171.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_172.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_173.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_174.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_175.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_176.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_177.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_178.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_179.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_180.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_181.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_182.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_183.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_184.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_185.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_186.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_187.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_188.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_189.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_190.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_191.BCM8879X=pam4:-24:132:-12:0:0:0 + +serdes_lane_config_channel_mode_0.0=force_nr +serdes_lane_config_channel_mode_1.0=force_nr +serdes_lane_config_channel_mode_2.0=force_nr +serdes_lane_config_channel_mode_3.0=force_nr +serdes_lane_config_channel_mode_4.0=force_nr +serdes_lane_config_channel_mode_5.0=force_nr +serdes_lane_config_channel_mode_6.0=force_nr +serdes_lane_config_channel_mode_7.0=force_nr +serdes_lane_config_channel_mode_8.0=force_nr +serdes_lane_config_channel_mode_9.0=force_nr +serdes_lane_config_channel_mode_10.0=force_nr +serdes_lane_config_channel_mode_11.0=force_nr +serdes_lane_config_channel_mode_12.0=force_nr +serdes_lane_config_channel_mode_13.0=force_nr +serdes_lane_config_channel_mode_14.0=force_nr +serdes_lane_config_channel_mode_15.0=force_nr +serdes_lane_config_channel_mode_16.0=force_nr +serdes_lane_config_channel_mode_17.0=force_nr +serdes_lane_config_channel_mode_18.0=force_nr +serdes_lane_config_channel_mode_19.0=force_nr +serdes_lane_config_channel_mode_20.0=force_nr +serdes_lane_config_channel_mode_21.0=force_nr +serdes_lane_config_channel_mode_22.0=force_nr +serdes_lane_config_channel_mode_23.0=force_nr +serdes_lane_config_channel_mode_24.0=force_nr +serdes_lane_config_channel_mode_25.0=force_nr +serdes_lane_config_channel_mode_26.0=force_nr +serdes_lane_config_channel_mode_27.0=force_nr +serdes_lane_config_channel_mode_28.0=force_nr +serdes_lane_config_channel_mode_29.0=force_nr +serdes_lane_config_channel_mode_30.0=force_nr +serdes_lane_config_channel_mode_31.0=force_nr +serdes_lane_config_channel_mode_32.0=force_nr +serdes_lane_config_channel_mode_33.0=force_nr +serdes_lane_config_channel_mode_34.0=force_nr +serdes_lane_config_channel_mode_35.0=force_nr +serdes_lane_config_channel_mode_36.0=force_nr +serdes_lane_config_channel_mode_37.0=force_nr +serdes_lane_config_channel_mode_38.0=force_nr +serdes_lane_config_channel_mode_39.0=force_nr +serdes_lane_config_channel_mode_40.0=force_nr +serdes_lane_config_channel_mode_41.0=force_nr +serdes_lane_config_channel_mode_42.0=force_nr +serdes_lane_config_channel_mode_43.0=force_nr +serdes_lane_config_channel_mode_44.0=force_nr +serdes_lane_config_channel_mode_45.0=force_nr +serdes_lane_config_channel_mode_46.0=force_nr +serdes_lane_config_channel_mode_47.0=force_nr +serdes_lane_config_channel_mode_48.0=force_nr +serdes_lane_config_channel_mode_49.0=force_nr +serdes_lane_config_channel_mode_50.0=force_nr +serdes_lane_config_channel_mode_51.0=force_nr +serdes_lane_config_channel_mode_52.0=force_nr +serdes_lane_config_channel_mode_53.0=force_nr +serdes_lane_config_channel_mode_54.0=force_nr +serdes_lane_config_channel_mode_55.0=force_nr +serdes_lane_config_channel_mode_56.0=force_nr +serdes_lane_config_channel_mode_57.0=force_nr +serdes_lane_config_channel_mode_58.0=force_nr +serdes_lane_config_channel_mode_59.0=force_nr +serdes_lane_config_channel_mode_60.0=force_nr +serdes_lane_config_channel_mode_61.0=force_nr +serdes_lane_config_channel_mode_62.0=force_nr +serdes_lane_config_channel_mode_63.0=force_nr +serdes_lane_config_channel_mode_64.0=force_nr +serdes_lane_config_channel_mode_65.0=force_nr +serdes_lane_config_channel_mode_66.0=force_nr +serdes_lane_config_channel_mode_67.0=force_nr +serdes_lane_config_channel_mode_68.0=force_nr +serdes_lane_config_channel_mode_69.0=force_nr +serdes_lane_config_channel_mode_70.0=force_nr +serdes_lane_config_channel_mode_71.0=force_nr +serdes_lane_config_channel_mode_72.0=force_nr +serdes_lane_config_channel_mode_73.0=force_nr +serdes_lane_config_channel_mode_74.0=force_nr +serdes_lane_config_channel_mode_75.0=force_nr +serdes_lane_config_channel_mode_76.0=force_nr +serdes_lane_config_channel_mode_77.0=force_nr +serdes_lane_config_channel_mode_78.0=force_nr +serdes_lane_config_channel_mode_79.0=force_nr +serdes_lane_config_channel_mode_80.0=force_nr +serdes_lane_config_channel_mode_81.0=force_nr +serdes_lane_config_channel_mode_82.0=force_nr +serdes_lane_config_channel_mode_83.0=force_nr +serdes_lane_config_channel_mode_84.0=force_nr +serdes_lane_config_channel_mode_85.0=force_nr +serdes_lane_config_channel_mode_86.0=force_nr +serdes_lane_config_channel_mode_87.0=force_nr +serdes_lane_config_channel_mode_88.0=force_nr +serdes_lane_config_channel_mode_89.0=force_nr +serdes_lane_config_channel_mode_90.0=force_nr +serdes_lane_config_channel_mode_91.0=force_nr +serdes_lane_config_channel_mode_92.0=force_nr +serdes_lane_config_channel_mode_93.0=force_nr +serdes_lane_config_channel_mode_94.0=force_nr +serdes_lane_config_channel_mode_95.0=force_nr +serdes_lane_config_channel_mode_96.0=force_nr +serdes_lane_config_channel_mode_97.0=force_nr +serdes_lane_config_channel_mode_98.0=force_nr +serdes_lane_config_channel_mode_99.0=force_nr +serdes_lane_config_channel_mode_100.0=force_nr +serdes_lane_config_channel_mode_101.0=force_nr +serdes_lane_config_channel_mode_102.0=force_nr +serdes_lane_config_channel_mode_103.0=force_nr +serdes_lane_config_channel_mode_104.0=force_nr +serdes_lane_config_channel_mode_105.0=force_nr +serdes_lane_config_channel_mode_106.0=force_nr +serdes_lane_config_channel_mode_107.0=force_nr +serdes_lane_config_channel_mode_108.0=force_nr +serdes_lane_config_channel_mode_109.0=force_nr +serdes_lane_config_channel_mode_110.0=force_nr +serdes_lane_config_channel_mode_111.0=force_nr +serdes_lane_config_channel_mode_112.0=force_nr +serdes_lane_config_channel_mode_113.0=force_nr +serdes_lane_config_channel_mode_114.0=force_nr +serdes_lane_config_channel_mode_115.0=force_nr +serdes_lane_config_channel_mode_116.0=force_nr +serdes_lane_config_channel_mode_117.0=force_nr +serdes_lane_config_channel_mode_118.0=force_nr +serdes_lane_config_channel_mode_119.0=force_nr +serdes_lane_config_channel_mode_120.0=force_nr +serdes_lane_config_channel_mode_121.0=force_nr +serdes_lane_config_channel_mode_122.0=force_nr +serdes_lane_config_channel_mode_123.0=force_nr +serdes_lane_config_channel_mode_124.0=force_nr +serdes_lane_config_channel_mode_125.0=force_nr +serdes_lane_config_channel_mode_126.0=force_nr +serdes_lane_config_channel_mode_127.0=force_nr +serdes_lane_config_channel_mode_128.0=force_nr +serdes_lane_config_channel_mode_129.0=force_nr +serdes_lane_config_channel_mode_130.0=force_nr +serdes_lane_config_channel_mode_131.0=force_nr +serdes_lane_config_channel_mode_132.0=force_nr +serdes_lane_config_channel_mode_133.0=force_nr +serdes_lane_config_channel_mode_134.0=force_nr +serdes_lane_config_channel_mode_135.0=force_nr +serdes_lane_config_channel_mode_136.0=force_nr +serdes_lane_config_channel_mode_137.0=force_nr +serdes_lane_config_channel_mode_138.0=force_nr +serdes_lane_config_channel_mode_139.0=force_nr +serdes_lane_config_channel_mode_140.0=force_nr +serdes_lane_config_channel_mode_141.0=force_nr +serdes_lane_config_channel_mode_142.0=force_nr +serdes_lane_config_channel_mode_143.0=force_nr +serdes_lane_config_channel_mode_144.0=force_nr +serdes_lane_config_channel_mode_145.0=force_nr +serdes_lane_config_channel_mode_146.0=force_nr +serdes_lane_config_channel_mode_147.0=force_nr +serdes_lane_config_channel_mode_148.0=force_nr +serdes_lane_config_channel_mode_149.0=force_nr +serdes_lane_config_channel_mode_150.0=force_nr +serdes_lane_config_channel_mode_151.0=force_nr +serdes_lane_config_channel_mode_152.0=force_nr +serdes_lane_config_channel_mode_153.0=force_nr +serdes_lane_config_channel_mode_154.0=force_nr +serdes_lane_config_channel_mode_155.0=force_nr +serdes_lane_config_channel_mode_156.0=force_nr +serdes_lane_config_channel_mode_157.0=force_nr +serdes_lane_config_channel_mode_158.0=force_nr +serdes_lane_config_channel_mode_159.0=force_nr +serdes_lane_config_channel_mode_160.0=force_nr +serdes_lane_config_channel_mode_161.0=force_nr +serdes_lane_config_channel_mode_162.0=force_nr +serdes_lane_config_channel_mode_163.0=force_nr +serdes_lane_config_channel_mode_164.0=force_nr +serdes_lane_config_channel_mode_165.0=force_nr +serdes_lane_config_channel_mode_166.0=force_nr +serdes_lane_config_channel_mode_167.0=force_nr +serdes_lane_config_channel_mode_168.0=force_nr +serdes_lane_config_channel_mode_169.0=force_nr +serdes_lane_config_channel_mode_170.0=force_nr +serdes_lane_config_channel_mode_171.0=force_nr +serdes_lane_config_channel_mode_172.0=force_nr +serdes_lane_config_channel_mode_173.0=force_nr +serdes_lane_config_channel_mode_174.0=force_nr +serdes_lane_config_channel_mode_175.0=force_nr +serdes_lane_config_channel_mode_176.0=force_nr +serdes_lane_config_channel_mode_177.0=force_nr +serdes_lane_config_channel_mode_178.0=force_nr +serdes_lane_config_channel_mode_179.0=force_nr +serdes_lane_config_channel_mode_180.0=force_nr +serdes_lane_config_channel_mode_181.0=force_nr +serdes_lane_config_channel_mode_182.0=force_nr +serdes_lane_config_channel_mode_183.0=force_nr +serdes_lane_config_channel_mode_184.0=force_nr +serdes_lane_config_channel_mode_185.0=force_nr +serdes_lane_config_channel_mode_186.0=force_nr +serdes_lane_config_channel_mode_187.0=force_nr +serdes_lane_config_channel_mode_188.0=force_nr +serdes_lane_config_channel_mode_189.0=force_nr +serdes_lane_config_channel_mode_190.0=force_nr +serdes_lane_config_channel_mode_191.0=force_nr + + + + + +serdes_qrtt_active_0.0=1 +serdes_qrtt_active_1.0=1 +serdes_qrtt_active_2.0=1 +serdes_qrtt_active_3.0=1 +serdes_qrtt_active_4.0=1 +serdes_qrtt_active_5.0=1 +serdes_qrtt_active_6.0=1 +serdes_qrtt_active_7.0=1 +serdes_qrtt_active_8.0=1 +serdes_qrtt_active_9.0=1 +serdes_qrtt_active_10.0=1 +serdes_qrtt_active_11.0=1 +serdes_qrtt_active_12.0=1 +serdes_qrtt_active_13.0=1 +serdes_qrtt_active_14.0=1 +serdes_qrtt_active_15.0=1 +serdes_qrtt_active_16.0=1 +serdes_qrtt_active_17.0=1 +serdes_qrtt_active_18.0=1 +serdes_qrtt_active_19.0=1 +serdes_qrtt_active_20.0=1 +serdes_qrtt_active_21.0=1 +serdes_qrtt_active_22.0=1 +serdes_qrtt_active_23.0=1 +serdes_qrtt_active_24.0=1 +serdes_qrtt_active_25.0=1 +serdes_qrtt_active_26.0=1 +serdes_qrtt_active_27.0=1 +serdes_qrtt_active_28.0=1 +serdes_qrtt_active_29.0=1 +serdes_qrtt_active_30.0=1 +serdes_qrtt_active_31.0=1 +serdes_qrtt_active_32.0=1 +serdes_qrtt_active_33.0=1 +serdes_qrtt_active_34.0=1 +serdes_qrtt_active_35.0=1 +serdes_qrtt_active_36.0=1 +serdes_qrtt_active_37.0=1 +serdes_qrtt_active_38.0=1 +serdes_qrtt_active_39.0=1 +serdes_qrtt_active_40.0=1 +serdes_qrtt_active_41.0=1 +serdes_qrtt_active_42.0=1 +serdes_qrtt_active_43.0=1 +serdes_qrtt_active_44.0=1 +serdes_qrtt_active_45.0=1 +serdes_qrtt_active_46.0=1 +serdes_qrtt_active_47.0=1 diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/1/config-ramon-1-1.bcm b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/1/config-ramon-1-1.bcm new file mode 100644 index 000000000000..802109801fa3 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/1/config-ramon-1-1.bcm @@ -0,0 +1,1395 @@ + +appl_enable_intr_init.BCM8879X=0 +appl_param_module_id.BCM8879X=2 +bcm_linkscan_interval.BCM8879X=0 +bcm_stat_interval.BCM8879X=4000000 +bist_enable.BCM8879X=0 +core_clock_speed_khz.BCM8879X=1000000 +custom_feature_access_only.BCM8879X=0 +custom_feature_lane_swap_disable.BCM8879X=0 +dport_map_direct.BCM8879X=1 +fabric_cell_fifo_dma_enable.BCM8879X=0 +fabric_device_mode.BCM8879X=SINGLE_STAGE_FE2 +fabric_load_balancing_mode.BCM8879X=NORMAL_LOAD_BALANCE +fabric_multicast_mode.BCM8879X=DIRECT +fabric_num_pipes.BCM8879X=1 +fabric_pipe_map.BCM8879X=0 +fe_mc_id_range.BCM8879X=128K +load_firmware.BCM8879X=0x102 +mdio_output_delay_ext.BCM8879X=14 +mdio_output_delay_int.BCM8879X=25 +mem_cache_enable_parity.BCM8879X=1 +mm_intr_enable.BCM8879X=0 +mm_timeout_usec.BCM8879X=300000 +polled_irq_delay.BCM8879X=100000 +polled_irq_mode.BCM8879X=1 +port_fec.BCM8879X=7 +port_init_cl72.BCM8879X=0 +port_init_speed.BCM8879X=53125 +rate_ext_mdio_divisor.BCM8879X=14 +rate_int_mdio_divisor.BCM8879X=50 +schan_intr_enable.BCM8879X=0 +schan_timeout_usec.BCM8879X=300000 +serdes_fabric_clk_freq_in.BCM8879X=1 +serdes_fabric_clk_freq_out.BCM8879X=bypass +soc_family.BCM8879X=BCM8879X +srd_tx_drv_hv_disable.BCM8879X=0 +system_contains_multiple_pipe_device.BCM8879X=0 +system_ref_core_clock_khz.BCM8879X=1200000 +table_dma_enable.BCM8879X=0 +tdma_intr_enable.BCM8879X=0 +tdma_timeout_usec.BCM8879X=5000000 +tslam_dma_enable.BCM8879X=0 +tslam_intr_enable.BCM8879X=0 +tslam_timeout_usec.BCM8879X=5000000 + +lane_to_serdes_map_fabric_lane0.BCM8879X=rx0:tx0 +lane_to_serdes_map_fabric_lane1.BCM8879X=rx1:tx1 +lane_to_serdes_map_fabric_lane2.BCM8879X=rx2:tx2 +lane_to_serdes_map_fabric_lane3.BCM8879X=rx3:tx3 + +lane_to_serdes_map_fabric_lane4.BCM8879X=rx4:tx4 +lane_to_serdes_map_fabric_lane5.BCM8879X=rx5:tx5 +lane_to_serdes_map_fabric_lane6.BCM8879X=rx6:tx6 +lane_to_serdes_map_fabric_lane7.BCM8879X=rx7:tx7 + +lane_to_serdes_map_fabric_lane8.BCM8879X=rx8:tx8 +lane_to_serdes_map_fabric_lane9.BCM8879X=rx9:tx9 +lane_to_serdes_map_fabric_lane10.BCM8879X=rx10:tx10 +lane_to_serdes_map_fabric_lane11.BCM8879X=rx11:tx11 + +lane_to_serdes_map_fabric_lane12.BCM8879X=rx12:tx12 +lane_to_serdes_map_fabric_lane13.BCM8879X=rx13:tx13 +lane_to_serdes_map_fabric_lane14.BCM8879X=rx14:tx14 +lane_to_serdes_map_fabric_lane15.BCM8879X=rx15:tx15 + +lane_to_serdes_map_fabric_lane16.BCM8879X=rx16:tx16 +lane_to_serdes_map_fabric_lane17.BCM8879X=rx17:tx17 +lane_to_serdes_map_fabric_lane18.BCM8879X=rx18:tx18 +lane_to_serdes_map_fabric_lane19.BCM8879X=rx19:tx19 + +lane_to_serdes_map_fabric_lane20.BCM8879X=rx20:tx20 +lane_to_serdes_map_fabric_lane21.BCM8879X=rx21:tx21 +lane_to_serdes_map_fabric_lane22.BCM8879X=rx22:tx22 +lane_to_serdes_map_fabric_lane23.BCM8879X=rx23:tx23 + +lane_to_serdes_map_fabric_lane24.BCM8879X=rx24:tx24 +lane_to_serdes_map_fabric_lane25.BCM8879X=rx25:tx25 +lane_to_serdes_map_fabric_lane26.BCM8879X=rx26:tx26 +lane_to_serdes_map_fabric_lane27.BCM8879X=rx27:tx27 + +lane_to_serdes_map_fabric_lane28.BCM8879X=rx28:tx28 +lane_to_serdes_map_fabric_lane29.BCM8879X=rx29:tx29 +lane_to_serdes_map_fabric_lane30.BCM8879X=rx30:tx30 +lane_to_serdes_map_fabric_lane31.BCM8879X=rx31:tx31 + +lane_to_serdes_map_fabric_lane32.BCM8879X=rx32:tx32 +lane_to_serdes_map_fabric_lane33.BCM8879X=rx33:tx33 +lane_to_serdes_map_fabric_lane34.BCM8879X=rx34:tx34 +lane_to_serdes_map_fabric_lane35.BCM8879X=rx35:tx35 + +lane_to_serdes_map_fabric_lane36.BCM8879X=rx36:tx36 +lane_to_serdes_map_fabric_lane37.BCM8879X=rx37:tx37 +lane_to_serdes_map_fabric_lane38.BCM8879X=rx38:tx38 +lane_to_serdes_map_fabric_lane39.BCM8879X=rx39:tx39 + +lane_to_serdes_map_fabric_lane40.BCM8879X=rx40:tx40 +lane_to_serdes_map_fabric_lane41.BCM8879X=rx41:tx41 +lane_to_serdes_map_fabric_lane42.BCM8879X=rx42:tx42 +lane_to_serdes_map_fabric_lane43.BCM8879X=rx43:tx43 + +lane_to_serdes_map_fabric_lane44.BCM8879X=rx44:tx44 +lane_to_serdes_map_fabric_lane45.BCM8879X=rx45:tx45 +lane_to_serdes_map_fabric_lane46.BCM8879X=rx46:tx46 +lane_to_serdes_map_fabric_lane47.BCM8879X=rx47:tx47 + +lane_to_serdes_map_fabric_lane48.BCM8879X=rx48:tx48 +lane_to_serdes_map_fabric_lane49.BCM8879X=rx49:tx49 +lane_to_serdes_map_fabric_lane50.BCM8879X=rx50:tx50 +lane_to_serdes_map_fabric_lane51.BCM8879X=rx51:tx51 + +lane_to_serdes_map_fabric_lane52.BCM8879X=rx52:tx52 +lane_to_serdes_map_fabric_lane53.BCM8879X=rx53:tx53 +lane_to_serdes_map_fabric_lane54.BCM8879X=rx54:tx54 +lane_to_serdes_map_fabric_lane55.BCM8879X=rx55:tx55 + +lane_to_serdes_map_fabric_lane56.BCM8879X=rx56:tx56 +lane_to_serdes_map_fabric_lane57.BCM8879X=rx57:tx57 +lane_to_serdes_map_fabric_lane58.BCM8879X=rx58:tx58 +lane_to_serdes_map_fabric_lane59.BCM8879X=rx59:tx59 + +lane_to_serdes_map_fabric_lane60.BCM8879X=rx60:tx60 +lane_to_serdes_map_fabric_lane61.BCM8879X=rx61:tx61 +lane_to_serdes_map_fabric_lane62.BCM8879X=rx62:tx62 +lane_to_serdes_map_fabric_lane63.BCM8879X=rx63:tx63 + +lane_to_serdes_map_fabric_lane64.BCM8879X=rx64:tx64 +lane_to_serdes_map_fabric_lane65.BCM8879X=rx65:tx65 +lane_to_serdes_map_fabric_lane66.BCM8879X=rx66:tx66 +lane_to_serdes_map_fabric_lane67.BCM8879X=rx67:tx67 + +lane_to_serdes_map_fabric_lane68.BCM8879X=rx68:tx68 +lane_to_serdes_map_fabric_lane69.BCM8879X=rx69:tx69 +lane_to_serdes_map_fabric_lane70.BCM8879X=rx70:tx70 +lane_to_serdes_map_fabric_lane71.BCM8879X=rx71:tx71 + +lane_to_serdes_map_fabric_lane72.BCM8879X=rx72:tx72 +lane_to_serdes_map_fabric_lane73.BCM8879X=rx73:tx73 +lane_to_serdes_map_fabric_lane74.BCM8879X=rx74:tx74 +lane_to_serdes_map_fabric_lane75.BCM8879X=rx75:tx75 + +lane_to_serdes_map_fabric_lane76.BCM8879X=rx76:tx76 +lane_to_serdes_map_fabric_lane77.BCM8879X=rx77:tx77 +lane_to_serdes_map_fabric_lane78.BCM8879X=rx78:tx78 +lane_to_serdes_map_fabric_lane79.BCM8879X=rx79:tx79 + +lane_to_serdes_map_fabric_lane80.BCM8879X=rx80:tx80 +lane_to_serdes_map_fabric_lane81.BCM8879X=rx81:tx81 +lane_to_serdes_map_fabric_lane82.BCM8879X=rx82:tx82 +lane_to_serdes_map_fabric_lane83.BCM8879X=rx83:tx83 + +lane_to_serdes_map_fabric_lane84.BCM8879X=rx84:tx84 +lane_to_serdes_map_fabric_lane85.BCM8879X=rx85:tx85 +lane_to_serdes_map_fabric_lane86.BCM8879X=rx86:tx86 +lane_to_serdes_map_fabric_lane87.BCM8879X=rx87:tx87 + +lane_to_serdes_map_fabric_lane88.BCM8879X=rx88:tx88 +lane_to_serdes_map_fabric_lane89.BCM8879X=rx89:tx89 +lane_to_serdes_map_fabric_lane90.BCM8879X=rx90:tx90 +lane_to_serdes_map_fabric_lane91.BCM8879X=rx91:tx91 + +lane_to_serdes_map_fabric_lane92.BCM8879X=rx92:tx92 +lane_to_serdes_map_fabric_lane93.BCM8879X=rx93:tx93 +lane_to_serdes_map_fabric_lane94.BCM8879X=rx94:tx94 +lane_to_serdes_map_fabric_lane95.BCM8879X=rx95:tx95 + +lane_to_serdes_map_fabric_lane96.BCM8879X=rx96:tx96 +lane_to_serdes_map_fabric_lane97.BCM8879X=rx97:tx97 +lane_to_serdes_map_fabric_lane98.BCM8879X=rx98:tx98 +lane_to_serdes_map_fabric_lane99.BCM8879X=rx99:tx99 + +lane_to_serdes_map_fabric_lane100.BCM8879X=rx100:tx100 +lane_to_serdes_map_fabric_lane101.BCM8879X=rx101:tx101 +lane_to_serdes_map_fabric_lane102.BCM8879X=rx102:tx102 +lane_to_serdes_map_fabric_lane103.BCM8879X=rx103:tx103 + +lane_to_serdes_map_fabric_lane104.BCM8879X=rx104:tx104 +lane_to_serdes_map_fabric_lane105.BCM8879X=rx105:tx105 +lane_to_serdes_map_fabric_lane106.BCM8879X=rx106:tx106 +lane_to_serdes_map_fabric_lane107.BCM8879X=rx107:tx107 + +lane_to_serdes_map_fabric_lane108.BCM8879X=rx108:tx108 +lane_to_serdes_map_fabric_lane109.BCM8879X=rx109:tx109 +lane_to_serdes_map_fabric_lane110.BCM8879X=rx110:tx110 +lane_to_serdes_map_fabric_lane111.BCM8879X=rx111:tx111 + +lane_to_serdes_map_fabric_lane112.BCM8879X=rx112:tx112 +lane_to_serdes_map_fabric_lane113.BCM8879X=rx113:tx113 +lane_to_serdes_map_fabric_lane114.BCM8879X=rx114:tx114 +lane_to_serdes_map_fabric_lane115.BCM8879X=rx115:tx115 + +lane_to_serdes_map_fabric_lane116.BCM8879X=rx116:tx116 +lane_to_serdes_map_fabric_lane117.BCM8879X=rx117:tx117 +lane_to_serdes_map_fabric_lane118.BCM8879X=rx118:tx118 +lane_to_serdes_map_fabric_lane119.BCM8879X=rx119:tx119 + +lane_to_serdes_map_fabric_lane120.BCM8879X=rx120:tx120 +lane_to_serdes_map_fabric_lane121.BCM8879X=rx121:tx121 +lane_to_serdes_map_fabric_lane122.BCM8879X=rx122:tx122 +lane_to_serdes_map_fabric_lane123.BCM8879X=rx123:tx123 + +lane_to_serdes_map_fabric_lane124.BCM8879X=rx124:tx124 +lane_to_serdes_map_fabric_lane125.BCM8879X=rx125:tx125 +lane_to_serdes_map_fabric_lane126.BCM8879X=rx126:tx126 +lane_to_serdes_map_fabric_lane127.BCM8879X=rx127:tx127 + +lane_to_serdes_map_fabric_lane128.BCM8879X=rx128:tx128 +lane_to_serdes_map_fabric_lane129.BCM8879X=rx129:tx129 +lane_to_serdes_map_fabric_lane130.BCM8879X=rx130:tx130 +lane_to_serdes_map_fabric_lane131.BCM8879X=rx131:tx131 + +lane_to_serdes_map_fabric_lane132.BCM8879X=rx132:tx132 +lane_to_serdes_map_fabric_lane133.BCM8879X=rx133:tx133 +lane_to_serdes_map_fabric_lane134.BCM8879X=rx134:tx134 +lane_to_serdes_map_fabric_lane135.BCM8879X=rx135:tx135 + +lane_to_serdes_map_fabric_lane136.BCM8879X=rx136:tx136 +lane_to_serdes_map_fabric_lane137.BCM8879X=rx137:tx137 +lane_to_serdes_map_fabric_lane138.BCM8879X=rx138:tx138 +lane_to_serdes_map_fabric_lane139.BCM8879X=rx139:tx139 + +lane_to_serdes_map_fabric_lane140.BCM8879X=rx140:tx140 +lane_to_serdes_map_fabric_lane141.BCM8879X=rx141:tx141 +lane_to_serdes_map_fabric_lane142.BCM8879X=rx142:tx142 +lane_to_serdes_map_fabric_lane143.BCM8879X=rx143:tx143 + +lane_to_serdes_map_fabric_lane144.BCM8879X=rx144:tx144 +lane_to_serdes_map_fabric_lane145.BCM8879X=rx145:tx145 +lane_to_serdes_map_fabric_lane146.BCM8879X=rx146:tx146 +lane_to_serdes_map_fabric_lane147.BCM8879X=rx147:tx147 + +lane_to_serdes_map_fabric_lane148.BCM8879X=rx148:tx148 +lane_to_serdes_map_fabric_lane149.BCM8879X=rx149:tx149 +lane_to_serdes_map_fabric_lane150.BCM8879X=rx150:tx150 +lane_to_serdes_map_fabric_lane151.BCM8879X=rx151:tx151 + +lane_to_serdes_map_fabric_lane152.BCM8879X=rx152:tx152 +lane_to_serdes_map_fabric_lane153.BCM8879X=rx153:tx153 +lane_to_serdes_map_fabric_lane154.BCM8879X=rx154:tx154 +lane_to_serdes_map_fabric_lane155.BCM8879X=rx155:tx155 + +lane_to_serdes_map_fabric_lane156.BCM8879X=rx156:tx156 +lane_to_serdes_map_fabric_lane157.BCM8879X=rx157:tx157 +lane_to_serdes_map_fabric_lane158.BCM8879X=rx158:tx158 +lane_to_serdes_map_fabric_lane159.BCM8879X=rx159:tx159 + +lane_to_serdes_map_fabric_lane160.BCM8879X=rx160:tx160 +lane_to_serdes_map_fabric_lane161.BCM8879X=rx161:tx161 +lane_to_serdes_map_fabric_lane162.BCM8879X=rx162:tx162 +lane_to_serdes_map_fabric_lane163.BCM8879X=rx163:tx163 + +lane_to_serdes_map_fabric_lane164.BCM8879X=rx164:tx164 +lane_to_serdes_map_fabric_lane165.BCM8879X=rx165:tx165 +lane_to_serdes_map_fabric_lane166.BCM8879X=rx166:tx166 +lane_to_serdes_map_fabric_lane167.BCM8879X=rx167:tx167 + +lane_to_serdes_map_fabric_lane168.BCM8879X=rx168:tx168 +lane_to_serdes_map_fabric_lane169.BCM8879X=rx169:tx169 +lane_to_serdes_map_fabric_lane170.BCM8879X=rx170:tx170 +lane_to_serdes_map_fabric_lane171.BCM8879X=rx171:tx171 + +lane_to_serdes_map_fabric_lane172.BCM8879X=rx172:tx172 +lane_to_serdes_map_fabric_lane173.BCM8879X=rx173:tx173 +lane_to_serdes_map_fabric_lane174.BCM8879X=rx174:tx174 +lane_to_serdes_map_fabric_lane175.BCM8879X=rx175:tx175 + +lane_to_serdes_map_fabric_lane176.BCM8879X=rx176:tx176 +lane_to_serdes_map_fabric_lane177.BCM8879X=rx177:tx177 +lane_to_serdes_map_fabric_lane178.BCM8879X=rx178:tx178 +lane_to_serdes_map_fabric_lane179.BCM8879X=rx179:tx179 + +lane_to_serdes_map_fabric_lane180.BCM8879X=rx180:tx180 +lane_to_serdes_map_fabric_lane181.BCM8879X=rx181:tx181 +lane_to_serdes_map_fabric_lane182.BCM8879X=rx182:tx182 +lane_to_serdes_map_fabric_lane183.BCM8879X=rx183:tx183 + +lane_to_serdes_map_fabric_lane184.BCM8879X=rx184:tx184 +lane_to_serdes_map_fabric_lane185.BCM8879X=rx185:tx185 +lane_to_serdes_map_fabric_lane186.BCM8879X=rx186:tx186 +lane_to_serdes_map_fabric_lane187.BCM8879X=rx187:tx187 + +lane_to_serdes_map_fabric_lane188.BCM8879X=rx188:tx188 +lane_to_serdes_map_fabric_lane189.BCM8879X=rx189:tx189 +lane_to_serdes_map_fabric_lane190.BCM8879X=rx190:tx190 +lane_to_serdes_map_fabric_lane191.BCM8879X=rx191:tx191 + + +phy_rx_polarity_flip_fabric0.BCM8879X=1 +phy_rx_polarity_flip_fabric1.BCM8879X=0 +phy_rx_polarity_flip_fabric2.BCM8879X=1 +phy_rx_polarity_flip_fabric3.BCM8879X=0 + +phy_rx_polarity_flip_fabric4.BCM8879X=1 +phy_rx_polarity_flip_fabric5.BCM8879X=0 +phy_rx_polarity_flip_fabric6.BCM8879X=1 +phy_rx_polarity_flip_fabric7.BCM8879X=0 + +phy_rx_polarity_flip_fabric8.BCM8879X=0 +phy_rx_polarity_flip_fabric9.BCM8879X=1 +phy_rx_polarity_flip_fabric10.BCM8879X=0 +phy_rx_polarity_flip_fabric11.BCM8879X=1 + +phy_rx_polarity_flip_fabric12.BCM8879X=1 +phy_rx_polarity_flip_fabric13.BCM8879X=0 +phy_rx_polarity_flip_fabric14.BCM8879X=1 +phy_rx_polarity_flip_fabric15.BCM8879X=0 + +phy_rx_polarity_flip_fabric16.BCM8879X=1 +phy_rx_polarity_flip_fabric17.BCM8879X=0 +phy_rx_polarity_flip_fabric18.BCM8879X=1 +phy_rx_polarity_flip_fabric19.BCM8879X=0 + +phy_rx_polarity_flip_fabric20.BCM8879X=0 +phy_rx_polarity_flip_fabric21.BCM8879X=1 +phy_rx_polarity_flip_fabric22.BCM8879X=0 +phy_rx_polarity_flip_fabric23.BCM8879X=1 + +phy_rx_polarity_flip_fabric24.BCM8879X=1 +phy_rx_polarity_flip_fabric25.BCM8879X=0 +phy_rx_polarity_flip_fabric26.BCM8879X=1 +phy_rx_polarity_flip_fabric27.BCM8879X=0 + +phy_rx_polarity_flip_fabric28.BCM8879X=1 +phy_rx_polarity_flip_fabric29.BCM8879X=0 +phy_rx_polarity_flip_fabric30.BCM8879X=1 +phy_rx_polarity_flip_fabric31.BCM8879X=0 + +phy_rx_polarity_flip_fabric32.BCM8879X=0 +phy_rx_polarity_flip_fabric33.BCM8879X=1 +phy_rx_polarity_flip_fabric34.BCM8879X=0 +phy_rx_polarity_flip_fabric35.BCM8879X=1 + +phy_rx_polarity_flip_fabric36.BCM8879X=1 +phy_rx_polarity_flip_fabric37.BCM8879X=0 +phy_rx_polarity_flip_fabric38.BCM8879X=1 +phy_rx_polarity_flip_fabric39.BCM8879X=0 + +phy_rx_polarity_flip_fabric40.BCM8879X=0 +phy_rx_polarity_flip_fabric41.BCM8879X=1 +phy_rx_polarity_flip_fabric42.BCM8879X=0 +phy_rx_polarity_flip_fabric43.BCM8879X=1 + +phy_rx_polarity_flip_fabric44.BCM8879X=1 +phy_rx_polarity_flip_fabric45.BCM8879X=0 +phy_rx_polarity_flip_fabric46.BCM8879X=1 +phy_rx_polarity_flip_fabric47.BCM8879X=0 + +phy_rx_polarity_flip_fabric48.BCM8879X=1 +phy_rx_polarity_flip_fabric49.BCM8879X=0 +phy_rx_polarity_flip_fabric50.BCM8879X=1 +phy_rx_polarity_flip_fabric51.BCM8879X=0 + +phy_rx_polarity_flip_fabric52.BCM8879X=0 +phy_rx_polarity_flip_fabric53.BCM8879X=1 +phy_rx_polarity_flip_fabric54.BCM8879X=0 +phy_rx_polarity_flip_fabric55.BCM8879X=1 + +phy_rx_polarity_flip_fabric56.BCM8879X=0 +phy_rx_polarity_flip_fabric57.BCM8879X=1 +phy_rx_polarity_flip_fabric58.BCM8879X=0 +phy_rx_polarity_flip_fabric59.BCM8879X=1 + +phy_rx_polarity_flip_fabric60.BCM8879X=0 +phy_rx_polarity_flip_fabric61.BCM8879X=1 +phy_rx_polarity_flip_fabric62.BCM8879X=0 +phy_rx_polarity_flip_fabric63.BCM8879X=1 + +phy_rx_polarity_flip_fabric64.BCM8879X=0 +phy_rx_polarity_flip_fabric65.BCM8879X=1 +phy_rx_polarity_flip_fabric66.BCM8879X=0 +phy_rx_polarity_flip_fabric67.BCM8879X=1 + +phy_rx_polarity_flip_fabric68.BCM8879X=1 +phy_rx_polarity_flip_fabric69.BCM8879X=0 +phy_rx_polarity_flip_fabric70.BCM8879X=1 +phy_rx_polarity_flip_fabric71.BCM8879X=0 + +phy_rx_polarity_flip_fabric72.BCM8879X=1 +phy_rx_polarity_flip_fabric73.BCM8879X=0 +phy_rx_polarity_flip_fabric74.BCM8879X=1 +phy_rx_polarity_flip_fabric75.BCM8879X=0 + +phy_rx_polarity_flip_fabric76.BCM8879X=0 +phy_rx_polarity_flip_fabric77.BCM8879X=1 +phy_rx_polarity_flip_fabric78.BCM8879X=0 +phy_rx_polarity_flip_fabric79.BCM8879X=1 + +phy_rx_polarity_flip_fabric80.BCM8879X=1 +phy_rx_polarity_flip_fabric81.BCM8879X=0 +phy_rx_polarity_flip_fabric82.BCM8879X=1 +phy_rx_polarity_flip_fabric83.BCM8879X=0 + +phy_rx_polarity_flip_fabric84.BCM8879X=0 +phy_rx_polarity_flip_fabric85.BCM8879X=1 +phy_rx_polarity_flip_fabric86.BCM8879X=0 +phy_rx_polarity_flip_fabric87.BCM8879X=1 + +phy_rx_polarity_flip_fabric88.BCM8879X=1 +phy_rx_polarity_flip_fabric89.BCM8879X=0 +phy_rx_polarity_flip_fabric90.BCM8879X=1 +phy_rx_polarity_flip_fabric91.BCM8879X=0 + +phy_rx_polarity_flip_fabric92.BCM8879X=1 +phy_rx_polarity_flip_fabric93.BCM8879X=0 +phy_rx_polarity_flip_fabric94.BCM8879X=1 +phy_rx_polarity_flip_fabric95.BCM8879X=0 + +phy_rx_polarity_flip_fabric96.BCM8879X=0 +phy_rx_polarity_flip_fabric97.BCM8879X=1 +phy_rx_polarity_flip_fabric98.BCM8879X=0 +phy_rx_polarity_flip_fabric99.BCM8879X=1 + +phy_rx_polarity_flip_fabric100.BCM8879X=1 +phy_rx_polarity_flip_fabric101.BCM8879X=0 +phy_rx_polarity_flip_fabric102.BCM8879X=1 +phy_rx_polarity_flip_fabric103.BCM8879X=0 + +phy_rx_polarity_flip_fabric104.BCM8879X=0 +phy_rx_polarity_flip_fabric105.BCM8879X=1 +phy_rx_polarity_flip_fabric106.BCM8879X=0 +phy_rx_polarity_flip_fabric107.BCM8879X=1 + +phy_rx_polarity_flip_fabric108.BCM8879X=0 +phy_rx_polarity_flip_fabric109.BCM8879X=1 +phy_rx_polarity_flip_fabric110.BCM8879X=0 +phy_rx_polarity_flip_fabric111.BCM8879X=1 + +phy_rx_polarity_flip_fabric112.BCM8879X=1 +phy_rx_polarity_flip_fabric113.BCM8879X=0 +phy_rx_polarity_flip_fabric114.BCM8879X=1 +phy_rx_polarity_flip_fabric115.BCM8879X=0 + +phy_rx_polarity_flip_fabric116.BCM8879X=0 +phy_rx_polarity_flip_fabric117.BCM8879X=1 +phy_rx_polarity_flip_fabric118.BCM8879X=0 +phy_rx_polarity_flip_fabric119.BCM8879X=1 + +phy_rx_polarity_flip_fabric120.BCM8879X=1 +phy_rx_polarity_flip_fabric121.BCM8879X=0 +phy_rx_polarity_flip_fabric122.BCM8879X=1 +phy_rx_polarity_flip_fabric123.BCM8879X=0 + +phy_rx_polarity_flip_fabric124.BCM8879X=1 +phy_rx_polarity_flip_fabric125.BCM8879X=0 +phy_rx_polarity_flip_fabric126.BCM8879X=1 +phy_rx_polarity_flip_fabric127.BCM8879X=0 + +phy_rx_polarity_flip_fabric128.BCM8879X=0 +phy_rx_polarity_flip_fabric129.BCM8879X=1 +phy_rx_polarity_flip_fabric130.BCM8879X=0 +phy_rx_polarity_flip_fabric131.BCM8879X=1 + +phy_rx_polarity_flip_fabric132.BCM8879X=1 +phy_rx_polarity_flip_fabric133.BCM8879X=0 +phy_rx_polarity_flip_fabric134.BCM8879X=1 +phy_rx_polarity_flip_fabric135.BCM8879X=0 + +phy_rx_polarity_flip_fabric136.BCM8879X=0 +phy_rx_polarity_flip_fabric137.BCM8879X=1 +phy_rx_polarity_flip_fabric138.BCM8879X=0 +phy_rx_polarity_flip_fabric139.BCM8879X=1 + +phy_rx_polarity_flip_fabric140.BCM8879X=1 +phy_rx_polarity_flip_fabric141.BCM8879X=0 +phy_rx_polarity_flip_fabric142.BCM8879X=1 +phy_rx_polarity_flip_fabric143.BCM8879X=0 + +phy_rx_polarity_flip_fabric144.BCM8879X=1 +phy_rx_polarity_flip_fabric145.BCM8879X=0 +phy_rx_polarity_flip_fabric146.BCM8879X=1 +phy_rx_polarity_flip_fabric147.BCM8879X=0 + +phy_rx_polarity_flip_fabric148.BCM8879X=0 +phy_rx_polarity_flip_fabric149.BCM8879X=1 +phy_rx_polarity_flip_fabric150.BCM8879X=0 +phy_rx_polarity_flip_fabric151.BCM8879X=1 + +phy_rx_polarity_flip_fabric152.BCM8879X=1 +phy_rx_polarity_flip_fabric153.BCM8879X=0 +phy_rx_polarity_flip_fabric154.BCM8879X=1 +phy_rx_polarity_flip_fabric155.BCM8879X=0 + +phy_rx_polarity_flip_fabric156.BCM8879X=0 +phy_rx_polarity_flip_fabric157.BCM8879X=1 +phy_rx_polarity_flip_fabric158.BCM8879X=0 +phy_rx_polarity_flip_fabric159.BCM8879X=1 + +phy_rx_polarity_flip_fabric160.BCM8879X=1 +phy_rx_polarity_flip_fabric161.BCM8879X=0 +phy_rx_polarity_flip_fabric162.BCM8879X=1 +phy_rx_polarity_flip_fabric163.BCM8879X=0 + +phy_rx_polarity_flip_fabric164.BCM8879X=1 +phy_rx_polarity_flip_fabric165.BCM8879X=0 +phy_rx_polarity_flip_fabric166.BCM8879X=1 +phy_rx_polarity_flip_fabric167.BCM8879X=0 + +phy_rx_polarity_flip_fabric168.BCM8879X=1 +phy_rx_polarity_flip_fabric169.BCM8879X=0 +phy_rx_polarity_flip_fabric170.BCM8879X=1 +phy_rx_polarity_flip_fabric171.BCM8879X=0 + +phy_rx_polarity_flip_fabric172.BCM8879X=0 +phy_rx_polarity_flip_fabric173.BCM8879X=1 +phy_rx_polarity_flip_fabric174.BCM8879X=0 +phy_rx_polarity_flip_fabric175.BCM8879X=1 + +phy_rx_polarity_flip_fabric176.BCM8879X=1 +phy_rx_polarity_flip_fabric177.BCM8879X=0 +phy_rx_polarity_flip_fabric178.BCM8879X=1 +phy_rx_polarity_flip_fabric179.BCM8879X=0 + +phy_rx_polarity_flip_fabric180.BCM8879X=0 +phy_rx_polarity_flip_fabric181.BCM8879X=1 +phy_rx_polarity_flip_fabric182.BCM8879X=0 +phy_rx_polarity_flip_fabric183.BCM8879X=1 + +phy_rx_polarity_flip_fabric184.BCM8879X=1 +phy_rx_polarity_flip_fabric185.BCM8879X=0 +phy_rx_polarity_flip_fabric186.BCM8879X=1 +phy_rx_polarity_flip_fabric187.BCM8879X=0 + +phy_rx_polarity_flip_fabric188.BCM8879X=1 +phy_rx_polarity_flip_fabric189.BCM8879X=0 +phy_rx_polarity_flip_fabric190.BCM8879X=1 +phy_rx_polarity_flip_fabric191.BCM8879X=0 + + +phy_tx_polarity_flip_fabric0.BCM8879X=0 +phy_tx_polarity_flip_fabric1.BCM8879X=1 +phy_tx_polarity_flip_fabric2.BCM8879X=0 +phy_tx_polarity_flip_fabric3.BCM8879X=1 + +phy_tx_polarity_flip_fabric4.BCM8879X=0 +phy_tx_polarity_flip_fabric5.BCM8879X=1 +phy_tx_polarity_flip_fabric6.BCM8879X=0 +phy_tx_polarity_flip_fabric7.BCM8879X=1 + +phy_tx_polarity_flip_fabric8.BCM8879X=1 +phy_tx_polarity_flip_fabric9.BCM8879X=0 +phy_tx_polarity_flip_fabric10.BCM8879X=1 +phy_tx_polarity_flip_fabric11.BCM8879X=0 + +phy_tx_polarity_flip_fabric12.BCM8879X=0 +phy_tx_polarity_flip_fabric13.BCM8879X=1 +phy_tx_polarity_flip_fabric14.BCM8879X=0 +phy_tx_polarity_flip_fabric15.BCM8879X=1 + +phy_tx_polarity_flip_fabric16.BCM8879X=0 +phy_tx_polarity_flip_fabric17.BCM8879X=1 +phy_tx_polarity_flip_fabric18.BCM8879X=0 +phy_tx_polarity_flip_fabric19.BCM8879X=1 + +phy_tx_polarity_flip_fabric20.BCM8879X=1 +phy_tx_polarity_flip_fabric21.BCM8879X=0 +phy_tx_polarity_flip_fabric22.BCM8879X=1 +phy_tx_polarity_flip_fabric23.BCM8879X=0 + +phy_tx_polarity_flip_fabric24.BCM8879X=0 +phy_tx_polarity_flip_fabric25.BCM8879X=1 +phy_tx_polarity_flip_fabric26.BCM8879X=0 +phy_tx_polarity_flip_fabric27.BCM8879X=1 + +phy_tx_polarity_flip_fabric28.BCM8879X=0 +phy_tx_polarity_flip_fabric29.BCM8879X=1 +phy_tx_polarity_flip_fabric30.BCM8879X=0 +phy_tx_polarity_flip_fabric31.BCM8879X=1 + +phy_tx_polarity_flip_fabric32.BCM8879X=1 +phy_tx_polarity_flip_fabric33.BCM8879X=0 +phy_tx_polarity_flip_fabric34.BCM8879X=1 +phy_tx_polarity_flip_fabric35.BCM8879X=0 + +phy_tx_polarity_flip_fabric36.BCM8879X=0 +phy_tx_polarity_flip_fabric37.BCM8879X=1 +phy_tx_polarity_flip_fabric38.BCM8879X=0 +phy_tx_polarity_flip_fabric39.BCM8879X=1 + +phy_tx_polarity_flip_fabric40.BCM8879X=1 +phy_tx_polarity_flip_fabric41.BCM8879X=0 +phy_tx_polarity_flip_fabric42.BCM8879X=1 +phy_tx_polarity_flip_fabric43.BCM8879X=0 + +phy_tx_polarity_flip_fabric44.BCM8879X=0 +phy_tx_polarity_flip_fabric45.BCM8879X=1 +phy_tx_polarity_flip_fabric46.BCM8879X=0 +phy_tx_polarity_flip_fabric47.BCM8879X=1 + +phy_tx_polarity_flip_fabric48.BCM8879X=0 +phy_tx_polarity_flip_fabric49.BCM8879X=1 +phy_tx_polarity_flip_fabric50.BCM8879X=0 +phy_tx_polarity_flip_fabric51.BCM8879X=1 + +phy_tx_polarity_flip_fabric52.BCM8879X=1 +phy_tx_polarity_flip_fabric53.BCM8879X=0 +phy_tx_polarity_flip_fabric54.BCM8879X=1 +phy_tx_polarity_flip_fabric55.BCM8879X=0 + +phy_tx_polarity_flip_fabric56.BCM8879X=1 +phy_tx_polarity_flip_fabric57.BCM8879X=0 +phy_tx_polarity_flip_fabric58.BCM8879X=1 +phy_tx_polarity_flip_fabric59.BCM8879X=0 + +phy_tx_polarity_flip_fabric60.BCM8879X=1 +phy_tx_polarity_flip_fabric61.BCM8879X=0 +phy_tx_polarity_flip_fabric62.BCM8879X=1 +phy_tx_polarity_flip_fabric63.BCM8879X=0 + +phy_tx_polarity_flip_fabric64.BCM8879X=1 +phy_tx_polarity_flip_fabric65.BCM8879X=0 +phy_tx_polarity_flip_fabric66.BCM8879X=1 +phy_tx_polarity_flip_fabric67.BCM8879X=0 + +phy_tx_polarity_flip_fabric68.BCM8879X=0 +phy_tx_polarity_flip_fabric69.BCM8879X=1 +phy_tx_polarity_flip_fabric70.BCM8879X=0 +phy_tx_polarity_flip_fabric71.BCM8879X=1 + +phy_tx_polarity_flip_fabric72.BCM8879X=0 +phy_tx_polarity_flip_fabric73.BCM8879X=1 +phy_tx_polarity_flip_fabric74.BCM8879X=0 +phy_tx_polarity_flip_fabric75.BCM8879X=1 + +phy_tx_polarity_flip_fabric76.BCM8879X=1 +phy_tx_polarity_flip_fabric77.BCM8879X=0 +phy_tx_polarity_flip_fabric78.BCM8879X=1 +phy_tx_polarity_flip_fabric79.BCM8879X=0 + +phy_tx_polarity_flip_fabric80.BCM8879X=0 +phy_tx_polarity_flip_fabric81.BCM8879X=1 +phy_tx_polarity_flip_fabric82.BCM8879X=0 +phy_tx_polarity_flip_fabric83.BCM8879X=1 + +phy_tx_polarity_flip_fabric84.BCM8879X=1 +phy_tx_polarity_flip_fabric85.BCM8879X=0 +phy_tx_polarity_flip_fabric86.BCM8879X=1 +phy_tx_polarity_flip_fabric87.BCM8879X=0 + +phy_tx_polarity_flip_fabric88.BCM8879X=0 +phy_tx_polarity_flip_fabric89.BCM8879X=1 +phy_tx_polarity_flip_fabric90.BCM8879X=0 +phy_tx_polarity_flip_fabric91.BCM8879X=1 + +phy_tx_polarity_flip_fabric92.BCM8879X=0 +phy_tx_polarity_flip_fabric93.BCM8879X=1 +phy_tx_polarity_flip_fabric94.BCM8879X=0 +phy_tx_polarity_flip_fabric95.BCM8879X=1 + +phy_tx_polarity_flip_fabric96.BCM8879X=1 +phy_tx_polarity_flip_fabric97.BCM8879X=0 +phy_tx_polarity_flip_fabric98.BCM8879X=1 +phy_tx_polarity_flip_fabric99.BCM8879X=0 + +phy_tx_polarity_flip_fabric100.BCM8879X=0 +phy_tx_polarity_flip_fabric101.BCM8879X=1 +phy_tx_polarity_flip_fabric102.BCM8879X=0 +phy_tx_polarity_flip_fabric103.BCM8879X=1 + +phy_tx_polarity_flip_fabric104.BCM8879X=1 +phy_tx_polarity_flip_fabric105.BCM8879X=0 +phy_tx_polarity_flip_fabric106.BCM8879X=1 +phy_tx_polarity_flip_fabric107.BCM8879X=0 + +phy_tx_polarity_flip_fabric108.BCM8879X=1 +phy_tx_polarity_flip_fabric109.BCM8879X=0 +phy_tx_polarity_flip_fabric110.BCM8879X=1 +phy_tx_polarity_flip_fabric111.BCM8879X=0 + +phy_tx_polarity_flip_fabric112.BCM8879X=0 +phy_tx_polarity_flip_fabric113.BCM8879X=1 +phy_tx_polarity_flip_fabric114.BCM8879X=0 +phy_tx_polarity_flip_fabric115.BCM8879X=1 + +phy_tx_polarity_flip_fabric116.BCM8879X=1 +phy_tx_polarity_flip_fabric117.BCM8879X=0 +phy_tx_polarity_flip_fabric118.BCM8879X=1 +phy_tx_polarity_flip_fabric119.BCM8879X=0 + +phy_tx_polarity_flip_fabric120.BCM8879X=0 +phy_tx_polarity_flip_fabric121.BCM8879X=1 +phy_tx_polarity_flip_fabric122.BCM8879X=0 +phy_tx_polarity_flip_fabric123.BCM8879X=1 + +phy_tx_polarity_flip_fabric124.BCM8879X=0 +phy_tx_polarity_flip_fabric125.BCM8879X=1 +phy_tx_polarity_flip_fabric126.BCM8879X=0 +phy_tx_polarity_flip_fabric127.BCM8879X=1 + +phy_tx_polarity_flip_fabric128.BCM8879X=1 +phy_tx_polarity_flip_fabric129.BCM8879X=0 +phy_tx_polarity_flip_fabric130.BCM8879X=1 +phy_tx_polarity_flip_fabric131.BCM8879X=0 + +phy_tx_polarity_flip_fabric132.BCM8879X=0 +phy_tx_polarity_flip_fabric133.BCM8879X=1 +phy_tx_polarity_flip_fabric134.BCM8879X=0 +phy_tx_polarity_flip_fabric135.BCM8879X=1 + +phy_tx_polarity_flip_fabric136.BCM8879X=1 +phy_tx_polarity_flip_fabric137.BCM8879X=0 +phy_tx_polarity_flip_fabric138.BCM8879X=1 +phy_tx_polarity_flip_fabric139.BCM8879X=0 + +phy_tx_polarity_flip_fabric140.BCM8879X=0 +phy_tx_polarity_flip_fabric141.BCM8879X=1 +phy_tx_polarity_flip_fabric142.BCM8879X=0 +phy_tx_polarity_flip_fabric143.BCM8879X=1 + +phy_tx_polarity_flip_fabric144.BCM8879X=0 +phy_tx_polarity_flip_fabric145.BCM8879X=1 +phy_tx_polarity_flip_fabric146.BCM8879X=0 +phy_tx_polarity_flip_fabric147.BCM8879X=1 + +phy_tx_polarity_flip_fabric148.BCM8879X=1 +phy_tx_polarity_flip_fabric149.BCM8879X=0 +phy_tx_polarity_flip_fabric150.BCM8879X=1 +phy_tx_polarity_flip_fabric151.BCM8879X=0 + +phy_tx_polarity_flip_fabric152.BCM8879X=0 +phy_tx_polarity_flip_fabric153.BCM8879X=1 +phy_tx_polarity_flip_fabric154.BCM8879X=0 +phy_tx_polarity_flip_fabric155.BCM8879X=1 + +phy_tx_polarity_flip_fabric156.BCM8879X=1 +phy_tx_polarity_flip_fabric157.BCM8879X=0 +phy_tx_polarity_flip_fabric158.BCM8879X=1 +phy_tx_polarity_flip_fabric159.BCM8879X=0 + +phy_tx_polarity_flip_fabric160.BCM8879X=0 +phy_tx_polarity_flip_fabric161.BCM8879X=1 +phy_tx_polarity_flip_fabric162.BCM8879X=0 +phy_tx_polarity_flip_fabric163.BCM8879X=1 + +phy_tx_polarity_flip_fabric164.BCM8879X=0 +phy_tx_polarity_flip_fabric165.BCM8879X=1 +phy_tx_polarity_flip_fabric166.BCM8879X=0 +phy_tx_polarity_flip_fabric167.BCM8879X=1 + +phy_tx_polarity_flip_fabric168.BCM8879X=0 +phy_tx_polarity_flip_fabric169.BCM8879X=1 +phy_tx_polarity_flip_fabric170.BCM8879X=0 +phy_tx_polarity_flip_fabric171.BCM8879X=1 + +phy_tx_polarity_flip_fabric172.BCM8879X=1 +phy_tx_polarity_flip_fabric173.BCM8879X=0 +phy_tx_polarity_flip_fabric174.BCM8879X=1 +phy_tx_polarity_flip_fabric175.BCM8879X=0 + +phy_tx_polarity_flip_fabric176.BCM8879X=0 +phy_tx_polarity_flip_fabric177.BCM8879X=1 +phy_tx_polarity_flip_fabric178.BCM8879X=0 +phy_tx_polarity_flip_fabric179.BCM8879X=1 + +phy_tx_polarity_flip_fabric180.BCM8879X=1 +phy_tx_polarity_flip_fabric181.BCM8879X=0 +phy_tx_polarity_flip_fabric182.BCM8879X=1 +phy_tx_polarity_flip_fabric183.BCM8879X=0 + +phy_tx_polarity_flip_fabric184.BCM8879X=0 +phy_tx_polarity_flip_fabric185.BCM8879X=1 +phy_tx_polarity_flip_fabric186.BCM8879X=0 +phy_tx_polarity_flip_fabric187.BCM8879X=1 + +phy_tx_polarity_flip_fabric188.BCM8879X=0 +phy_tx_polarity_flip_fabric189.BCM8879X=1 +phy_tx_polarity_flip_fabric190.BCM8879X=0 +phy_tx_polarity_flip_fabric191.BCM8879X=1 + +port_init_cl72_0=0 +port_init_cl72_1=0 +port_init_cl72_2=0 +port_init_cl72_3=0 +port_init_cl72_4=0 +port_init_cl72_5=0 +port_init_cl72_6=0 +port_init_cl72_7=0 +port_init_cl72_8=0 +port_init_cl72_9=0 +port_init_cl72_10=0 +port_init_cl72_11=0 +port_init_cl72_12=0 +port_init_cl72_13=0 +port_init_cl72_14=0 +port_init_cl72_15=0 +port_init_cl72_16=0 +port_init_cl72_17=0 +port_init_cl72_18=0 +port_init_cl72_19=0 +port_init_cl72_20=0 +port_init_cl72_21=0 +port_init_cl72_22=0 +port_init_cl72_23=0 +port_init_cl72_24=0 +port_init_cl72_25=0 +port_init_cl72_26=0 +port_init_cl72_27=0 +port_init_cl72_28=0 +port_init_cl72_29=0 +port_init_cl72_30=0 +port_init_cl72_31=0 +port_init_cl72_32=0 +port_init_cl72_33=0 +port_init_cl72_34=0 +port_init_cl72_35=0 +port_init_cl72_36=0 +port_init_cl72_37=0 +port_init_cl72_38=0 +port_init_cl72_39=0 +port_init_cl72_40=0 +port_init_cl72_41=0 +port_init_cl72_42=0 +port_init_cl72_43=0 +port_init_cl72_44=0 +port_init_cl72_45=0 +port_init_cl72_46=0 +port_init_cl72_47=0 +port_init_cl72_48=0 +port_init_cl72_49=0 +port_init_cl72_50=0 +port_init_cl72_51=0 +port_init_cl72_52=0 +port_init_cl72_53=0 +port_init_cl72_54=0 +port_init_cl72_55=0 +port_init_cl72_56=0 +port_init_cl72_57=0 +port_init_cl72_58=0 +port_init_cl72_59=0 +port_init_cl72_60=0 +port_init_cl72_61=0 +port_init_cl72_62=0 +port_init_cl72_63=0 +port_init_cl72_64=0 +port_init_cl72_65=0 +port_init_cl72_66=0 +port_init_cl72_67=0 +port_init_cl72_68=0 +port_init_cl72_69=0 +port_init_cl72_70=0 +port_init_cl72_71=0 +port_init_cl72_72=0 +port_init_cl72_73=0 +port_init_cl72_74=0 +port_init_cl72_75=0 +port_init_cl72_76=0 +port_init_cl72_77=0 +port_init_cl72_78=0 +port_init_cl72_79=0 +port_init_cl72_80=0 +port_init_cl72_81=0 +port_init_cl72_82=0 +port_init_cl72_83=0 +port_init_cl72_84=0 +port_init_cl72_85=0 +port_init_cl72_86=0 +port_init_cl72_87=0 +port_init_cl72_88=0 +port_init_cl72_89=0 +port_init_cl72_90=0 +port_init_cl72_91=0 +port_init_cl72_92=0 +port_init_cl72_93=0 +port_init_cl72_94=0 +port_init_cl72_95=0 +port_init_cl72_96=0 +port_init_cl72_97=0 +port_init_cl72_98=0 +port_init_cl72_99=0 +port_init_cl72_100=0 +port_init_cl72_101=0 +port_init_cl72_102=0 +port_init_cl72_103=0 +port_init_cl72_104=0 +port_init_cl72_105=0 +port_init_cl72_106=0 +port_init_cl72_107=0 +port_init_cl72_108=0 +port_init_cl72_109=0 +port_init_cl72_110=0 +port_init_cl72_111=0 +port_init_cl72_112=0 +port_init_cl72_113=0 +port_init_cl72_114=0 +port_init_cl72_115=0 +port_init_cl72_116=0 +port_init_cl72_117=0 +port_init_cl72_118=0 +port_init_cl72_119=0 +port_init_cl72_120=0 +port_init_cl72_121=0 +port_init_cl72_122=0 +port_init_cl72_123=0 +port_init_cl72_124=0 +port_init_cl72_125=0 +port_init_cl72_126=0 +port_init_cl72_127=0 +port_init_cl72_128=0 +port_init_cl72_129=0 +port_init_cl72_130=0 +port_init_cl72_131=0 +port_init_cl72_132=0 +port_init_cl72_133=0 +port_init_cl72_134=0 +port_init_cl72_135=0 +port_init_cl72_136=0 +port_init_cl72_137=0 +port_init_cl72_138=0 +port_init_cl72_139=0 +port_init_cl72_140=0 +port_init_cl72_141=0 +port_init_cl72_142=0 +port_init_cl72_143=0 +port_init_cl72_144=0 +port_init_cl72_145=0 +port_init_cl72_146=0 +port_init_cl72_147=0 +port_init_cl72_148=0 +port_init_cl72_149=0 +port_init_cl72_150=0 +port_init_cl72_151=0 +port_init_cl72_152=0 +port_init_cl72_153=0 +port_init_cl72_154=0 +port_init_cl72_155=0 +port_init_cl72_156=0 +port_init_cl72_157=0 +port_init_cl72_158=0 +port_init_cl72_159=0 +port_init_cl72_160=0 +port_init_cl72_161=0 +port_init_cl72_162=0 +port_init_cl72_163=0 +port_init_cl72_164=0 +port_init_cl72_165=0 +port_init_cl72_166=0 +port_init_cl72_167=0 +port_init_cl72_168=0 +port_init_cl72_169=0 +port_init_cl72_170=0 +port_init_cl72_171=0 +port_init_cl72_172=0 +port_init_cl72_173=0 +port_init_cl72_174=0 +port_init_cl72_175=0 +port_init_cl72_176=0 +port_init_cl72_177=0 +port_init_cl72_178=0 +port_init_cl72_179=0 +port_init_cl72_180=0 +port_init_cl72_181=0 +port_init_cl72_182=0 +port_init_cl72_183=0 +port_init_cl72_184=0 +port_init_cl72_185=0 +port_init_cl72_186=0 +port_init_cl72_187=0 +port_init_cl72_188=0 +port_init_cl72_189=0 +port_init_cl72_190=0 +port_init_cl72_191=0 + +serdes_tx_taps_0.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_1.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_2.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_3.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_4.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_5.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_6.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_7.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_8.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_9.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_10.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_11.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_12.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_13.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_14.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_15.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_16.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_17.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_18.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_19.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_20.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_21.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_22.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_23.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_24.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_25.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_26.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_27.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_28.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_29.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_30.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_31.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_32.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_33.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_34.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_35.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_36.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_37.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_38.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_39.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_40.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_41.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_42.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_43.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_44.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_45.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_46.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_47.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_48.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_49.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_50.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_51.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_52.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_53.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_54.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_55.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_56.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_57.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_58.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_59.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_60.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_61.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_62.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_63.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_64.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_65.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_66.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_67.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_68.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_69.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_70.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_71.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_72.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_73.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_74.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_75.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_76.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_77.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_78.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_79.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_80.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_81.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_82.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_83.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_84.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_85.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_86.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_87.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_88.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_89.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_90.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_91.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_92.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_93.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_94.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_95.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_96.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_97.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_98.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_99.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_100.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_101.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_102.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_103.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_104.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_105.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_106.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_107.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_108.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_109.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_110.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_111.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_112.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_113.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_114.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_115.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_116.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_117.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_118.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_119.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_120.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_121.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_122.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_123.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_124.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_125.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_126.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_127.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_128.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_129.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_130.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_131.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_132.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_133.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_134.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_135.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_136.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_137.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_138.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_139.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_140.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_141.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_142.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_143.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_144.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_145.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_146.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_147.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_148.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_149.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_150.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_151.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_152.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_153.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_154.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_155.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_156.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_157.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_158.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_159.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_160.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_161.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_162.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_163.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_164.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_165.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_166.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_167.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_168.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_169.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_170.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_171.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_172.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_173.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_174.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_175.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_176.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_177.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_178.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_179.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_180.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_181.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_182.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_183.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_184.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_185.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_186.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_187.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_188.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_189.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_190.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_191.BCM8879X=pam4:-24:132:-12:0:0:0 + +serdes_lane_config_channel_mode_0.0=force_nr +serdes_lane_config_channel_mode_1.0=force_nr +serdes_lane_config_channel_mode_2.0=force_nr +serdes_lane_config_channel_mode_3.0=force_nr +serdes_lane_config_channel_mode_4.0=force_nr +serdes_lane_config_channel_mode_5.0=force_nr +serdes_lane_config_channel_mode_6.0=force_nr +serdes_lane_config_channel_mode_7.0=force_nr +serdes_lane_config_channel_mode_8.0=force_nr +serdes_lane_config_channel_mode_9.0=force_nr +serdes_lane_config_channel_mode_10.0=force_nr +serdes_lane_config_channel_mode_11.0=force_nr +serdes_lane_config_channel_mode_12.0=force_nr +serdes_lane_config_channel_mode_13.0=force_nr +serdes_lane_config_channel_mode_14.0=force_nr +serdes_lane_config_channel_mode_15.0=force_nr +serdes_lane_config_channel_mode_16.0=force_nr +serdes_lane_config_channel_mode_17.0=force_nr +serdes_lane_config_channel_mode_18.0=force_nr +serdes_lane_config_channel_mode_19.0=force_nr +serdes_lane_config_channel_mode_20.0=force_nr +serdes_lane_config_channel_mode_21.0=force_nr +serdes_lane_config_channel_mode_22.0=force_nr +serdes_lane_config_channel_mode_23.0=force_nr +serdes_lane_config_channel_mode_24.0=force_nr +serdes_lane_config_channel_mode_25.0=force_nr +serdes_lane_config_channel_mode_26.0=force_nr +serdes_lane_config_channel_mode_27.0=force_nr +serdes_lane_config_channel_mode_28.0=force_nr +serdes_lane_config_channel_mode_29.0=force_nr +serdes_lane_config_channel_mode_30.0=force_nr +serdes_lane_config_channel_mode_31.0=force_nr +serdes_lane_config_channel_mode_32.0=force_nr +serdes_lane_config_channel_mode_33.0=force_nr +serdes_lane_config_channel_mode_34.0=force_nr +serdes_lane_config_channel_mode_35.0=force_nr +serdes_lane_config_channel_mode_36.0=force_nr +serdes_lane_config_channel_mode_37.0=force_nr +serdes_lane_config_channel_mode_38.0=force_nr +serdes_lane_config_channel_mode_39.0=force_nr +serdes_lane_config_channel_mode_40.0=force_nr +serdes_lane_config_channel_mode_41.0=force_nr +serdes_lane_config_channel_mode_42.0=force_nr +serdes_lane_config_channel_mode_43.0=force_nr +serdes_lane_config_channel_mode_44.0=force_nr +serdes_lane_config_channel_mode_45.0=force_nr +serdes_lane_config_channel_mode_46.0=force_nr +serdes_lane_config_channel_mode_47.0=force_nr +serdes_lane_config_channel_mode_48.0=force_nr +serdes_lane_config_channel_mode_49.0=force_nr +serdes_lane_config_channel_mode_50.0=force_nr +serdes_lane_config_channel_mode_51.0=force_nr +serdes_lane_config_channel_mode_52.0=force_nr +serdes_lane_config_channel_mode_53.0=force_nr +serdes_lane_config_channel_mode_54.0=force_nr +serdes_lane_config_channel_mode_55.0=force_nr +serdes_lane_config_channel_mode_56.0=force_nr +serdes_lane_config_channel_mode_57.0=force_nr +serdes_lane_config_channel_mode_58.0=force_nr +serdes_lane_config_channel_mode_59.0=force_nr +serdes_lane_config_channel_mode_60.0=force_nr +serdes_lane_config_channel_mode_61.0=force_nr +serdes_lane_config_channel_mode_62.0=force_nr +serdes_lane_config_channel_mode_63.0=force_nr +serdes_lane_config_channel_mode_64.0=force_nr +serdes_lane_config_channel_mode_65.0=force_nr +serdes_lane_config_channel_mode_66.0=force_nr +serdes_lane_config_channel_mode_67.0=force_nr +serdes_lane_config_channel_mode_68.0=force_nr +serdes_lane_config_channel_mode_69.0=force_nr +serdes_lane_config_channel_mode_70.0=force_nr +serdes_lane_config_channel_mode_71.0=force_nr +serdes_lane_config_channel_mode_72.0=force_nr +serdes_lane_config_channel_mode_73.0=force_nr +serdes_lane_config_channel_mode_74.0=force_nr +serdes_lane_config_channel_mode_75.0=force_nr +serdes_lane_config_channel_mode_76.0=force_nr +serdes_lane_config_channel_mode_77.0=force_nr +serdes_lane_config_channel_mode_78.0=force_nr +serdes_lane_config_channel_mode_79.0=force_nr +serdes_lane_config_channel_mode_80.0=force_nr +serdes_lane_config_channel_mode_81.0=force_nr +serdes_lane_config_channel_mode_82.0=force_nr +serdes_lane_config_channel_mode_83.0=force_nr +serdes_lane_config_channel_mode_84.0=force_nr +serdes_lane_config_channel_mode_85.0=force_nr +serdes_lane_config_channel_mode_86.0=force_nr +serdes_lane_config_channel_mode_87.0=force_nr +serdes_lane_config_channel_mode_88.0=force_nr +serdes_lane_config_channel_mode_89.0=force_nr +serdes_lane_config_channel_mode_90.0=force_nr +serdes_lane_config_channel_mode_91.0=force_nr +serdes_lane_config_channel_mode_92.0=force_nr +serdes_lane_config_channel_mode_93.0=force_nr +serdes_lane_config_channel_mode_94.0=force_nr +serdes_lane_config_channel_mode_95.0=force_nr +serdes_lane_config_channel_mode_96.0=force_nr +serdes_lane_config_channel_mode_97.0=force_nr +serdes_lane_config_channel_mode_98.0=force_nr +serdes_lane_config_channel_mode_99.0=force_nr +serdes_lane_config_channel_mode_100.0=force_nr +serdes_lane_config_channel_mode_101.0=force_nr +serdes_lane_config_channel_mode_102.0=force_nr +serdes_lane_config_channel_mode_103.0=force_nr +serdes_lane_config_channel_mode_104.0=force_nr +serdes_lane_config_channel_mode_105.0=force_nr +serdes_lane_config_channel_mode_106.0=force_nr +serdes_lane_config_channel_mode_107.0=force_nr +serdes_lane_config_channel_mode_108.0=force_nr +serdes_lane_config_channel_mode_109.0=force_nr +serdes_lane_config_channel_mode_110.0=force_nr +serdes_lane_config_channel_mode_111.0=force_nr +serdes_lane_config_channel_mode_112.0=force_nr +serdes_lane_config_channel_mode_113.0=force_nr +serdes_lane_config_channel_mode_114.0=force_nr +serdes_lane_config_channel_mode_115.0=force_nr +serdes_lane_config_channel_mode_116.0=force_nr +serdes_lane_config_channel_mode_117.0=force_nr +serdes_lane_config_channel_mode_118.0=force_nr +serdes_lane_config_channel_mode_119.0=force_nr +serdes_lane_config_channel_mode_120.0=force_nr +serdes_lane_config_channel_mode_121.0=force_nr +serdes_lane_config_channel_mode_122.0=force_nr +serdes_lane_config_channel_mode_123.0=force_nr +serdes_lane_config_channel_mode_124.0=force_nr +serdes_lane_config_channel_mode_125.0=force_nr +serdes_lane_config_channel_mode_126.0=force_nr +serdes_lane_config_channel_mode_127.0=force_nr +serdes_lane_config_channel_mode_128.0=force_nr +serdes_lane_config_channel_mode_129.0=force_nr +serdes_lane_config_channel_mode_130.0=force_nr +serdes_lane_config_channel_mode_131.0=force_nr +serdes_lane_config_channel_mode_132.0=force_nr +serdes_lane_config_channel_mode_133.0=force_nr +serdes_lane_config_channel_mode_134.0=force_nr +serdes_lane_config_channel_mode_135.0=force_nr +serdes_lane_config_channel_mode_136.0=force_nr +serdes_lane_config_channel_mode_137.0=force_nr +serdes_lane_config_channel_mode_138.0=force_nr +serdes_lane_config_channel_mode_139.0=force_nr +serdes_lane_config_channel_mode_140.0=force_nr +serdes_lane_config_channel_mode_141.0=force_nr +serdes_lane_config_channel_mode_142.0=force_nr +serdes_lane_config_channel_mode_143.0=force_nr +serdes_lane_config_channel_mode_144.0=force_nr +serdes_lane_config_channel_mode_145.0=force_nr +serdes_lane_config_channel_mode_146.0=force_nr +serdes_lane_config_channel_mode_147.0=force_nr +serdes_lane_config_channel_mode_148.0=force_nr +serdes_lane_config_channel_mode_149.0=force_nr +serdes_lane_config_channel_mode_150.0=force_nr +serdes_lane_config_channel_mode_151.0=force_nr +serdes_lane_config_channel_mode_152.0=force_nr +serdes_lane_config_channel_mode_153.0=force_nr +serdes_lane_config_channel_mode_154.0=force_nr +serdes_lane_config_channel_mode_155.0=force_nr +serdes_lane_config_channel_mode_156.0=force_nr +serdes_lane_config_channel_mode_157.0=force_nr +serdes_lane_config_channel_mode_158.0=force_nr +serdes_lane_config_channel_mode_159.0=force_nr +serdes_lane_config_channel_mode_160.0=force_nr +serdes_lane_config_channel_mode_161.0=force_nr +serdes_lane_config_channel_mode_162.0=force_nr +serdes_lane_config_channel_mode_163.0=force_nr +serdes_lane_config_channel_mode_164.0=force_nr +serdes_lane_config_channel_mode_165.0=force_nr +serdes_lane_config_channel_mode_166.0=force_nr +serdes_lane_config_channel_mode_167.0=force_nr +serdes_lane_config_channel_mode_168.0=force_nr +serdes_lane_config_channel_mode_169.0=force_nr +serdes_lane_config_channel_mode_170.0=force_nr +serdes_lane_config_channel_mode_171.0=force_nr +serdes_lane_config_channel_mode_172.0=force_nr +serdes_lane_config_channel_mode_173.0=force_nr +serdes_lane_config_channel_mode_174.0=force_nr +serdes_lane_config_channel_mode_175.0=force_nr +serdes_lane_config_channel_mode_176.0=force_nr +serdes_lane_config_channel_mode_177.0=force_nr +serdes_lane_config_channel_mode_178.0=force_nr +serdes_lane_config_channel_mode_179.0=force_nr +serdes_lane_config_channel_mode_180.0=force_nr +serdes_lane_config_channel_mode_181.0=force_nr +serdes_lane_config_channel_mode_182.0=force_nr +serdes_lane_config_channel_mode_183.0=force_nr +serdes_lane_config_channel_mode_184.0=force_nr +serdes_lane_config_channel_mode_185.0=force_nr +serdes_lane_config_channel_mode_186.0=force_nr +serdes_lane_config_channel_mode_187.0=force_nr +serdes_lane_config_channel_mode_188.0=force_nr +serdes_lane_config_channel_mode_189.0=force_nr +serdes_lane_config_channel_mode_190.0=force_nr +serdes_lane_config_channel_mode_191.0=force_nr + + +serdes_qrtt_active_0.0=1 +serdes_qrtt_active_1.0=1 +serdes_qrtt_active_2.0=1 +serdes_qrtt_active_3.0=1 +serdes_qrtt_active_4.0=1 +serdes_qrtt_active_5.0=1 +serdes_qrtt_active_6.0=1 +serdes_qrtt_active_7.0=1 +serdes_qrtt_active_8.0=1 +serdes_qrtt_active_9.0=1 +serdes_qrtt_active_10.0=1 +serdes_qrtt_active_11.0=1 +serdes_qrtt_active_12.0=1 +serdes_qrtt_active_13.0=1 +serdes_qrtt_active_14.0=1 +serdes_qrtt_active_15.0=1 +serdes_qrtt_active_16.0=1 +serdes_qrtt_active_17.0=1 +serdes_qrtt_active_18.0=1 +serdes_qrtt_active_19.0=1 +serdes_qrtt_active_20.0=1 +serdes_qrtt_active_21.0=1 +serdes_qrtt_active_22.0=1 +serdes_qrtt_active_23.0=1 +serdes_qrtt_active_24.0=1 +serdes_qrtt_active_25.0=1 +serdes_qrtt_active_26.0=1 +serdes_qrtt_active_27.0=1 +serdes_qrtt_active_28.0=1 +serdes_qrtt_active_29.0=1 +serdes_qrtt_active_30.0=1 +serdes_qrtt_active_31.0=1 +serdes_qrtt_active_32.0=1 +serdes_qrtt_active_33.0=1 +serdes_qrtt_active_34.0=1 +serdes_qrtt_active_35.0=1 +serdes_qrtt_active_36.0=1 +serdes_qrtt_active_37.0=1 +serdes_qrtt_active_38.0=1 +serdes_qrtt_active_39.0=1 +serdes_qrtt_active_40.0=1 +serdes_qrtt_active_41.0=1 +serdes_qrtt_active_42.0=1 +serdes_qrtt_active_43.0=1 +serdes_qrtt_active_44.0=1 +serdes_qrtt_active_45.0=1 +serdes_qrtt_active_46.0=1 +serdes_qrtt_active_47.0=1 diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/10/config-ramon-6-0.bcm b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/10/config-ramon-6-0.bcm new file mode 100644 index 000000000000..372ea07d1cf0 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/10/config-ramon-6-0.bcm @@ -0,0 +1,1394 @@ + +appl_enable_intr_init.BCM8879X=0 +appl_param_module_id.BCM8879X=11 +bcm_linkscan_interval.BCM8879X=0 +bcm_stat_interval.BCM8879X=4000000 +bist_enable.BCM8879X=0 +core_clock_speed_khz.BCM8879X=1000000 +custom_feature_access_only.BCM8879X=0 +custom_feature_lane_swap_disable.BCM8879X=0 +dport_map_direct.BCM8879X=1 +fabric_cell_fifo_dma_enable.BCM8879X=0 +fabric_device_mode.BCM8879X=SINGLE_STAGE_FE2 +fabric_load_balancing_mode.BCM8879X=NORMAL_LOAD_BALANCE +fabric_multicast_mode.BCM8879X=DIRECT +fabric_num_pipes.BCM8879X=1 +fabric_pipe_map.BCM8879X=0 +fe_mc_id_range.BCM8879X=128K +load_firmware.BCM8879X=0x102 +mdio_output_delay_ext.BCM8879X=14 +mdio_output_delay_int.BCM8879X=25 +mem_cache_enable_parity.BCM8879X=1 +mm_intr_enable.BCM8879X=0 +mm_timeout_usec.BCM8879X=300000 +polled_irq_delay.BCM8879X=100000 +polled_irq_mode.BCM8879X=1 +port_fec.BCM8879X=7 +port_init_cl72.BCM8879X=0 +port_init_speed.BCM8879X=53125 +rate_ext_mdio_divisor.BCM8879X=14 +rate_int_mdio_divisor.BCM8879X=50 +schan_intr_enable.BCM8879X=0 +schan_timeout_usec.BCM8879X=300000 +serdes_fabric_clk_freq_in.BCM8879X=1 +serdes_fabric_clk_freq_out.BCM8879X=bypass +soc_family.BCM8879X=BCM8879X +srd_tx_drv_hv_disable.BCM8879X=0 +system_contains_multiple_pipe_device.BCM8879X=0 +system_ref_core_clock_khz.BCM8879X=1200000 +table_dma_enable.BCM8879X=0 +tdma_intr_enable.BCM8879X=0 +tdma_timeout_usec.BCM8879X=5000000 +tslam_dma_enable.BCM8879X=0 +tslam_intr_enable.BCM8879X=0 +tslam_timeout_usec.BCM8879X=5000000 + +lane_to_serdes_map_fabric_lane0.BCM8879X=rx0:tx0 +lane_to_serdes_map_fabric_lane1.BCM8879X=rx1:tx1 +lane_to_serdes_map_fabric_lane2.BCM8879X=rx2:tx2 +lane_to_serdes_map_fabric_lane3.BCM8879X=rx3:tx3 + +lane_to_serdes_map_fabric_lane4.BCM8879X=rx4:tx4 +lane_to_serdes_map_fabric_lane5.BCM8879X=rx5:tx5 +lane_to_serdes_map_fabric_lane6.BCM8879X=rx6:tx6 +lane_to_serdes_map_fabric_lane7.BCM8879X=rx7:tx7 + +lane_to_serdes_map_fabric_lane8.BCM8879X=rx8:tx8 +lane_to_serdes_map_fabric_lane9.BCM8879X=rx9:tx9 +lane_to_serdes_map_fabric_lane10.BCM8879X=rx10:tx10 +lane_to_serdes_map_fabric_lane11.BCM8879X=rx11:tx11 + +lane_to_serdes_map_fabric_lane12.BCM8879X=rx12:tx12 +lane_to_serdes_map_fabric_lane13.BCM8879X=rx13:tx13 +lane_to_serdes_map_fabric_lane14.BCM8879X=rx14:tx14 +lane_to_serdes_map_fabric_lane15.BCM8879X=rx15:tx15 + +lane_to_serdes_map_fabric_lane16.BCM8879X=rx16:tx16 +lane_to_serdes_map_fabric_lane17.BCM8879X=rx17:tx17 +lane_to_serdes_map_fabric_lane18.BCM8879X=rx18:tx18 +lane_to_serdes_map_fabric_lane19.BCM8879X=rx19:tx19 + +lane_to_serdes_map_fabric_lane20.BCM8879X=rx20:tx20 +lane_to_serdes_map_fabric_lane21.BCM8879X=rx21:tx21 +lane_to_serdes_map_fabric_lane22.BCM8879X=rx22:tx22 +lane_to_serdes_map_fabric_lane23.BCM8879X=rx23:tx23 + +lane_to_serdes_map_fabric_lane24.BCM8879X=rx24:tx24 +lane_to_serdes_map_fabric_lane25.BCM8879X=rx25:tx25 +lane_to_serdes_map_fabric_lane26.BCM8879X=rx26:tx26 +lane_to_serdes_map_fabric_lane27.BCM8879X=rx27:tx27 + +lane_to_serdes_map_fabric_lane28.BCM8879X=rx28:tx28 +lane_to_serdes_map_fabric_lane29.BCM8879X=rx29:tx29 +lane_to_serdes_map_fabric_lane30.BCM8879X=rx30:tx30 +lane_to_serdes_map_fabric_lane31.BCM8879X=rx31:tx31 + +lane_to_serdes_map_fabric_lane32.BCM8879X=rx32:tx32 +lane_to_serdes_map_fabric_lane33.BCM8879X=rx33:tx33 +lane_to_serdes_map_fabric_lane34.BCM8879X=rx34:tx34 +lane_to_serdes_map_fabric_lane35.BCM8879X=rx35:tx35 + +lane_to_serdes_map_fabric_lane36.BCM8879X=rx36:tx36 +lane_to_serdes_map_fabric_lane37.BCM8879X=rx37:tx37 +lane_to_serdes_map_fabric_lane38.BCM8879X=rx38:tx38 +lane_to_serdes_map_fabric_lane39.BCM8879X=rx39:tx39 + +lane_to_serdes_map_fabric_lane40.BCM8879X=rx40:tx40 +lane_to_serdes_map_fabric_lane41.BCM8879X=rx41:tx41 +lane_to_serdes_map_fabric_lane42.BCM8879X=rx42:tx42 +lane_to_serdes_map_fabric_lane43.BCM8879X=rx43:tx43 + +lane_to_serdes_map_fabric_lane44.BCM8879X=rx44:tx44 +lane_to_serdes_map_fabric_lane45.BCM8879X=rx45:tx45 +lane_to_serdes_map_fabric_lane46.BCM8879X=rx46:tx46 +lane_to_serdes_map_fabric_lane47.BCM8879X=rx47:tx47 + +lane_to_serdes_map_fabric_lane48.BCM8879X=rx48:tx48 +lane_to_serdes_map_fabric_lane49.BCM8879X=rx49:tx49 +lane_to_serdes_map_fabric_lane50.BCM8879X=rx50:tx50 +lane_to_serdes_map_fabric_lane51.BCM8879X=rx51:tx51 + +lane_to_serdes_map_fabric_lane52.BCM8879X=rx52:tx52 +lane_to_serdes_map_fabric_lane53.BCM8879X=rx53:tx53 +lane_to_serdes_map_fabric_lane54.BCM8879X=rx54:tx54 +lane_to_serdes_map_fabric_lane55.BCM8879X=rx55:tx55 + +lane_to_serdes_map_fabric_lane56.BCM8879X=rx56:tx56 +lane_to_serdes_map_fabric_lane57.BCM8879X=rx57:tx57 +lane_to_serdes_map_fabric_lane58.BCM8879X=rx58:tx58 +lane_to_serdes_map_fabric_lane59.BCM8879X=rx59:tx59 + +lane_to_serdes_map_fabric_lane60.BCM8879X=rx60:tx60 +lane_to_serdes_map_fabric_lane61.BCM8879X=rx61:tx61 +lane_to_serdes_map_fabric_lane62.BCM8879X=rx62:tx62 +lane_to_serdes_map_fabric_lane63.BCM8879X=rx63:tx63 + +lane_to_serdes_map_fabric_lane64.BCM8879X=rx64:tx64 +lane_to_serdes_map_fabric_lane65.BCM8879X=rx65:tx65 +lane_to_serdes_map_fabric_lane66.BCM8879X=rx66:tx66 +lane_to_serdes_map_fabric_lane67.BCM8879X=rx67:tx67 + +lane_to_serdes_map_fabric_lane68.BCM8879X=rx68:tx68 +lane_to_serdes_map_fabric_lane69.BCM8879X=rx69:tx69 +lane_to_serdes_map_fabric_lane70.BCM8879X=rx70:tx70 +lane_to_serdes_map_fabric_lane71.BCM8879X=rx71:tx71 + +lane_to_serdes_map_fabric_lane72.BCM8879X=rx72:tx72 +lane_to_serdes_map_fabric_lane73.BCM8879X=rx73:tx73 +lane_to_serdes_map_fabric_lane74.BCM8879X=rx74:tx74 +lane_to_serdes_map_fabric_lane75.BCM8879X=rx75:tx75 + +lane_to_serdes_map_fabric_lane76.BCM8879X=rx76:tx76 +lane_to_serdes_map_fabric_lane77.BCM8879X=rx77:tx77 +lane_to_serdes_map_fabric_lane78.BCM8879X=rx78:tx78 +lane_to_serdes_map_fabric_lane79.BCM8879X=rx79:tx79 + +lane_to_serdes_map_fabric_lane80.BCM8879X=rx80:tx80 +lane_to_serdes_map_fabric_lane81.BCM8879X=rx81:tx81 +lane_to_serdes_map_fabric_lane82.BCM8879X=rx82:tx82 +lane_to_serdes_map_fabric_lane83.BCM8879X=rx83:tx83 + +lane_to_serdes_map_fabric_lane84.BCM8879X=rx84:tx84 +lane_to_serdes_map_fabric_lane85.BCM8879X=rx85:tx85 +lane_to_serdes_map_fabric_lane86.BCM8879X=rx86:tx86 +lane_to_serdes_map_fabric_lane87.BCM8879X=rx87:tx87 + +lane_to_serdes_map_fabric_lane88.BCM8879X=rx88:tx88 +lane_to_serdes_map_fabric_lane89.BCM8879X=rx89:tx89 +lane_to_serdes_map_fabric_lane90.BCM8879X=rx90:tx90 +lane_to_serdes_map_fabric_lane91.BCM8879X=rx91:tx91 + +lane_to_serdes_map_fabric_lane92.BCM8879X=rx92:tx92 +lane_to_serdes_map_fabric_lane93.BCM8879X=rx93:tx93 +lane_to_serdes_map_fabric_lane94.BCM8879X=rx94:tx94 +lane_to_serdes_map_fabric_lane95.BCM8879X=rx95:tx95 + +lane_to_serdes_map_fabric_lane96.BCM8879X=rx96:tx96 +lane_to_serdes_map_fabric_lane97.BCM8879X=rx97:tx97 +lane_to_serdes_map_fabric_lane98.BCM8879X=rx98:tx98 +lane_to_serdes_map_fabric_lane99.BCM8879X=rx99:tx99 + +lane_to_serdes_map_fabric_lane100.BCM8879X=rx100:tx100 +lane_to_serdes_map_fabric_lane101.BCM8879X=rx101:tx101 +lane_to_serdes_map_fabric_lane102.BCM8879X=rx102:tx102 +lane_to_serdes_map_fabric_lane103.BCM8879X=rx103:tx103 + +lane_to_serdes_map_fabric_lane104.BCM8879X=rx104:tx104 +lane_to_serdes_map_fabric_lane105.BCM8879X=rx105:tx105 +lane_to_serdes_map_fabric_lane106.BCM8879X=rx106:tx106 +lane_to_serdes_map_fabric_lane107.BCM8879X=rx107:tx107 + +lane_to_serdes_map_fabric_lane108.BCM8879X=rx108:tx108 +lane_to_serdes_map_fabric_lane109.BCM8879X=rx109:tx109 +lane_to_serdes_map_fabric_lane110.BCM8879X=rx110:tx110 +lane_to_serdes_map_fabric_lane111.BCM8879X=rx111:tx111 + +lane_to_serdes_map_fabric_lane112.BCM8879X=rx112:tx112 +lane_to_serdes_map_fabric_lane113.BCM8879X=rx113:tx113 +lane_to_serdes_map_fabric_lane114.BCM8879X=rx114:tx114 +lane_to_serdes_map_fabric_lane115.BCM8879X=rx115:tx115 + +lane_to_serdes_map_fabric_lane116.BCM8879X=rx116:tx116 +lane_to_serdes_map_fabric_lane117.BCM8879X=rx117:tx117 +lane_to_serdes_map_fabric_lane118.BCM8879X=rx118:tx118 +lane_to_serdes_map_fabric_lane119.BCM8879X=rx119:tx119 + +lane_to_serdes_map_fabric_lane120.BCM8879X=rx120:tx120 +lane_to_serdes_map_fabric_lane121.BCM8879X=rx121:tx121 +lane_to_serdes_map_fabric_lane122.BCM8879X=rx122:tx122 +lane_to_serdes_map_fabric_lane123.BCM8879X=rx123:tx123 + +lane_to_serdes_map_fabric_lane124.BCM8879X=rx124:tx124 +lane_to_serdes_map_fabric_lane125.BCM8879X=rx125:tx125 +lane_to_serdes_map_fabric_lane126.BCM8879X=rx126:tx126 +lane_to_serdes_map_fabric_lane127.BCM8879X=rx127:tx127 + +lane_to_serdes_map_fabric_lane128.BCM8879X=rx128:tx128 +lane_to_serdes_map_fabric_lane129.BCM8879X=rx129:tx129 +lane_to_serdes_map_fabric_lane130.BCM8879X=rx130:tx130 +lane_to_serdes_map_fabric_lane131.BCM8879X=rx131:tx131 + +lane_to_serdes_map_fabric_lane132.BCM8879X=rx132:tx132 +lane_to_serdes_map_fabric_lane133.BCM8879X=rx133:tx133 +lane_to_serdes_map_fabric_lane134.BCM8879X=rx134:tx134 +lane_to_serdes_map_fabric_lane135.BCM8879X=rx135:tx135 + +lane_to_serdes_map_fabric_lane136.BCM8879X=rx136:tx136 +lane_to_serdes_map_fabric_lane137.BCM8879X=rx137:tx137 +lane_to_serdes_map_fabric_lane138.BCM8879X=rx138:tx138 +lane_to_serdes_map_fabric_lane139.BCM8879X=rx139:tx139 + +lane_to_serdes_map_fabric_lane140.BCM8879X=rx140:tx140 +lane_to_serdes_map_fabric_lane141.BCM8879X=rx141:tx141 +lane_to_serdes_map_fabric_lane142.BCM8879X=rx142:tx142 +lane_to_serdes_map_fabric_lane143.BCM8879X=rx143:tx143 + +lane_to_serdes_map_fabric_lane144.BCM8879X=rx144:tx144 +lane_to_serdes_map_fabric_lane145.BCM8879X=rx145:tx145 +lane_to_serdes_map_fabric_lane146.BCM8879X=rx146:tx146 +lane_to_serdes_map_fabric_lane147.BCM8879X=rx147:tx147 + +lane_to_serdes_map_fabric_lane148.BCM8879X=rx148:tx148 +lane_to_serdes_map_fabric_lane149.BCM8879X=rx149:tx149 +lane_to_serdes_map_fabric_lane150.BCM8879X=rx150:tx150 +lane_to_serdes_map_fabric_lane151.BCM8879X=rx151:tx151 + +lane_to_serdes_map_fabric_lane152.BCM8879X=rx152:tx152 +lane_to_serdes_map_fabric_lane153.BCM8879X=rx153:tx153 +lane_to_serdes_map_fabric_lane154.BCM8879X=rx154:tx154 +lane_to_serdes_map_fabric_lane155.BCM8879X=rx155:tx155 + +lane_to_serdes_map_fabric_lane156.BCM8879X=rx156:tx156 +lane_to_serdes_map_fabric_lane157.BCM8879X=rx157:tx157 +lane_to_serdes_map_fabric_lane158.BCM8879X=rx158:tx158 +lane_to_serdes_map_fabric_lane159.BCM8879X=rx159:tx159 + +lane_to_serdes_map_fabric_lane160.BCM8879X=rx160:tx160 +lane_to_serdes_map_fabric_lane161.BCM8879X=rx161:tx161 +lane_to_serdes_map_fabric_lane162.BCM8879X=rx162:tx162 +lane_to_serdes_map_fabric_lane163.BCM8879X=rx163:tx163 + +lane_to_serdes_map_fabric_lane164.BCM8879X=rx164:tx164 +lane_to_serdes_map_fabric_lane165.BCM8879X=rx165:tx165 +lane_to_serdes_map_fabric_lane166.BCM8879X=rx166:tx166 +lane_to_serdes_map_fabric_lane167.BCM8879X=rx167:tx167 + +lane_to_serdes_map_fabric_lane168.BCM8879X=rx168:tx168 +lane_to_serdes_map_fabric_lane169.BCM8879X=rx169:tx169 +lane_to_serdes_map_fabric_lane170.BCM8879X=rx170:tx170 +lane_to_serdes_map_fabric_lane171.BCM8879X=rx171:tx171 + +lane_to_serdes_map_fabric_lane172.BCM8879X=rx172:tx172 +lane_to_serdes_map_fabric_lane173.BCM8879X=rx173:tx173 +lane_to_serdes_map_fabric_lane174.BCM8879X=rx174:tx174 +lane_to_serdes_map_fabric_lane175.BCM8879X=rx175:tx175 + +lane_to_serdes_map_fabric_lane176.BCM8879X=rx176:tx176 +lane_to_serdes_map_fabric_lane177.BCM8879X=rx177:tx177 +lane_to_serdes_map_fabric_lane178.BCM8879X=rx178:tx178 +lane_to_serdes_map_fabric_lane179.BCM8879X=rx179:tx179 + +lane_to_serdes_map_fabric_lane180.BCM8879X=rx180:tx180 +lane_to_serdes_map_fabric_lane181.BCM8879X=rx181:tx181 +lane_to_serdes_map_fabric_lane182.BCM8879X=rx182:tx182 +lane_to_serdes_map_fabric_lane183.BCM8879X=rx183:tx183 + +lane_to_serdes_map_fabric_lane184.BCM8879X=rx184:tx184 +lane_to_serdes_map_fabric_lane185.BCM8879X=rx185:tx185 +lane_to_serdes_map_fabric_lane186.BCM8879X=rx186:tx186 +lane_to_serdes_map_fabric_lane187.BCM8879X=rx187:tx187 + +lane_to_serdes_map_fabric_lane188.BCM8879X=rx188:tx188 +lane_to_serdes_map_fabric_lane189.BCM8879X=rx189:tx189 +lane_to_serdes_map_fabric_lane190.BCM8879X=rx190:tx190 +lane_to_serdes_map_fabric_lane191.BCM8879X=rx191:tx191 + + +phy_rx_polarity_flip_fabric0.BCM8879X=1 +phy_rx_polarity_flip_fabric1.BCM8879X=0 +phy_rx_polarity_flip_fabric2.BCM8879X=1 +phy_rx_polarity_flip_fabric3.BCM8879X=0 + +phy_rx_polarity_flip_fabric4.BCM8879X=0 +phy_rx_polarity_flip_fabric5.BCM8879X=1 +phy_rx_polarity_flip_fabric6.BCM8879X=0 +phy_rx_polarity_flip_fabric7.BCM8879X=1 + +phy_rx_polarity_flip_fabric8.BCM8879X=1 +phy_rx_polarity_flip_fabric9.BCM8879X=0 +phy_rx_polarity_flip_fabric10.BCM8879X=1 +phy_rx_polarity_flip_fabric11.BCM8879X=0 + +phy_rx_polarity_flip_fabric12.BCM8879X=0 +phy_rx_polarity_flip_fabric13.BCM8879X=1 +phy_rx_polarity_flip_fabric14.BCM8879X=0 +phy_rx_polarity_flip_fabric15.BCM8879X=1 + +phy_rx_polarity_flip_fabric16.BCM8879X=1 +phy_rx_polarity_flip_fabric17.BCM8879X=0 +phy_rx_polarity_flip_fabric18.BCM8879X=1 +phy_rx_polarity_flip_fabric19.BCM8879X=0 + +phy_rx_polarity_flip_fabric20.BCM8879X=1 +phy_rx_polarity_flip_fabric21.BCM8879X=0 +phy_rx_polarity_flip_fabric22.BCM8879X=1 +phy_rx_polarity_flip_fabric23.BCM8879X=0 + +phy_rx_polarity_flip_fabric24.BCM8879X=1 +phy_rx_polarity_flip_fabric25.BCM8879X=0 +phy_rx_polarity_flip_fabric26.BCM8879X=1 +phy_rx_polarity_flip_fabric27.BCM8879X=0 + +phy_rx_polarity_flip_fabric28.BCM8879X=0 +phy_rx_polarity_flip_fabric29.BCM8879X=1 +phy_rx_polarity_flip_fabric30.BCM8879X=0 +phy_rx_polarity_flip_fabric31.BCM8879X=1 + +phy_rx_polarity_flip_fabric32.BCM8879X=1 +phy_rx_polarity_flip_fabric33.BCM8879X=0 +phy_rx_polarity_flip_fabric34.BCM8879X=1 +phy_rx_polarity_flip_fabric35.BCM8879X=0 + +phy_rx_polarity_flip_fabric36.BCM8879X=0 +phy_rx_polarity_flip_fabric37.BCM8879X=1 +phy_rx_polarity_flip_fabric38.BCM8879X=0 +phy_rx_polarity_flip_fabric39.BCM8879X=1 + +phy_rx_polarity_flip_fabric40.BCM8879X=1 +phy_rx_polarity_flip_fabric41.BCM8879X=0 +phy_rx_polarity_flip_fabric42.BCM8879X=1 +phy_rx_polarity_flip_fabric43.BCM8879X=0 + +phy_rx_polarity_flip_fabric44.BCM8879X=1 +phy_rx_polarity_flip_fabric45.BCM8879X=0 +phy_rx_polarity_flip_fabric46.BCM8879X=1 +phy_rx_polarity_flip_fabric47.BCM8879X=0 + +phy_rx_polarity_flip_fabric48.BCM8879X=0 +phy_rx_polarity_flip_fabric49.BCM8879X=1 +phy_rx_polarity_flip_fabric50.BCM8879X=0 +phy_rx_polarity_flip_fabric51.BCM8879X=1 + +phy_rx_polarity_flip_fabric52.BCM8879X=1 +phy_rx_polarity_flip_fabric53.BCM8879X=0 +phy_rx_polarity_flip_fabric54.BCM8879X=1 +phy_rx_polarity_flip_fabric55.BCM8879X=0 + +phy_rx_polarity_flip_fabric56.BCM8879X=0 +phy_rx_polarity_flip_fabric57.BCM8879X=1 +phy_rx_polarity_flip_fabric58.BCM8879X=0 +phy_rx_polarity_flip_fabric59.BCM8879X=1 + +phy_rx_polarity_flip_fabric60.BCM8879X=0 +phy_rx_polarity_flip_fabric61.BCM8879X=1 +phy_rx_polarity_flip_fabric62.BCM8879X=0 +phy_rx_polarity_flip_fabric63.BCM8879X=1 + +phy_rx_polarity_flip_fabric64.BCM8879X=1 +phy_rx_polarity_flip_fabric65.BCM8879X=0 +phy_rx_polarity_flip_fabric66.BCM8879X=1 +phy_rx_polarity_flip_fabric67.BCM8879X=0 + +phy_rx_polarity_flip_fabric68.BCM8879X=0 +phy_rx_polarity_flip_fabric69.BCM8879X=1 +phy_rx_polarity_flip_fabric70.BCM8879X=0 +phy_rx_polarity_flip_fabric71.BCM8879X=1 + +phy_rx_polarity_flip_fabric72.BCM8879X=1 +phy_rx_polarity_flip_fabric73.BCM8879X=0 +phy_rx_polarity_flip_fabric74.BCM8879X=1 +phy_rx_polarity_flip_fabric75.BCM8879X=0 + +phy_rx_polarity_flip_fabric76.BCM8879X=1 +phy_rx_polarity_flip_fabric77.BCM8879X=0 +phy_rx_polarity_flip_fabric78.BCM8879X=1 +phy_rx_polarity_flip_fabric79.BCM8879X=0 + +phy_rx_polarity_flip_fabric80.BCM8879X=0 +phy_rx_polarity_flip_fabric81.BCM8879X=1 +phy_rx_polarity_flip_fabric82.BCM8879X=0 +phy_rx_polarity_flip_fabric83.BCM8879X=1 + +phy_rx_polarity_flip_fabric84.BCM8879X=1 +phy_rx_polarity_flip_fabric85.BCM8879X=0 +phy_rx_polarity_flip_fabric86.BCM8879X=1 +phy_rx_polarity_flip_fabric87.BCM8879X=0 + +phy_rx_polarity_flip_fabric88.BCM8879X=0 +phy_rx_polarity_flip_fabric89.BCM8879X=1 +phy_rx_polarity_flip_fabric90.BCM8879X=0 +phy_rx_polarity_flip_fabric91.BCM8879X=1 + +phy_rx_polarity_flip_fabric92.BCM8879X=1 +phy_rx_polarity_flip_fabric93.BCM8879X=0 +phy_rx_polarity_flip_fabric94.BCM8879X=1 +phy_rx_polarity_flip_fabric95.BCM8879X=0 + +phy_rx_polarity_flip_fabric96.BCM8879X=1 +phy_rx_polarity_flip_fabric97.BCM8879X=0 +phy_rx_polarity_flip_fabric98.BCM8879X=1 +phy_rx_polarity_flip_fabric99.BCM8879X=0 + +phy_rx_polarity_flip_fabric100.BCM8879X=0 +phy_rx_polarity_flip_fabric101.BCM8879X=1 +phy_rx_polarity_flip_fabric102.BCM8879X=0 +phy_rx_polarity_flip_fabric103.BCM8879X=1 + +phy_rx_polarity_flip_fabric104.BCM8879X=0 +phy_rx_polarity_flip_fabric105.BCM8879X=1 +phy_rx_polarity_flip_fabric106.BCM8879X=0 +phy_rx_polarity_flip_fabric107.BCM8879X=1 + +phy_rx_polarity_flip_fabric108.BCM8879X=0 +phy_rx_polarity_flip_fabric109.BCM8879X=1 +phy_rx_polarity_flip_fabric110.BCM8879X=0 +phy_rx_polarity_flip_fabric111.BCM8879X=1 + +phy_rx_polarity_flip_fabric112.BCM8879X=0 +phy_rx_polarity_flip_fabric113.BCM8879X=1 +phy_rx_polarity_flip_fabric114.BCM8879X=0 +phy_rx_polarity_flip_fabric115.BCM8879X=1 + +phy_rx_polarity_flip_fabric116.BCM8879X=1 +phy_rx_polarity_flip_fabric117.BCM8879X=0 +phy_rx_polarity_flip_fabric118.BCM8879X=1 +phy_rx_polarity_flip_fabric119.BCM8879X=0 + +phy_rx_polarity_flip_fabric120.BCM8879X=1 +phy_rx_polarity_flip_fabric121.BCM8879X=0 +phy_rx_polarity_flip_fabric122.BCM8879X=1 +phy_rx_polarity_flip_fabric123.BCM8879X=0 + +phy_rx_polarity_flip_fabric124.BCM8879X=0 +phy_rx_polarity_flip_fabric125.BCM8879X=1 +phy_rx_polarity_flip_fabric126.BCM8879X=0 +phy_rx_polarity_flip_fabric127.BCM8879X=1 + +phy_rx_polarity_flip_fabric128.BCM8879X=1 +phy_rx_polarity_flip_fabric129.BCM8879X=0 +phy_rx_polarity_flip_fabric130.BCM8879X=1 +phy_rx_polarity_flip_fabric131.BCM8879X=0 + +phy_rx_polarity_flip_fabric132.BCM8879X=0 +phy_rx_polarity_flip_fabric133.BCM8879X=1 +phy_rx_polarity_flip_fabric134.BCM8879X=0 +phy_rx_polarity_flip_fabric135.BCM8879X=1 + +phy_rx_polarity_flip_fabric136.BCM8879X=1 +phy_rx_polarity_flip_fabric137.BCM8879X=0 +phy_rx_polarity_flip_fabric138.BCM8879X=1 +phy_rx_polarity_flip_fabric139.BCM8879X=0 + +phy_rx_polarity_flip_fabric140.BCM8879X=1 +phy_rx_polarity_flip_fabric141.BCM8879X=0 +phy_rx_polarity_flip_fabric142.BCM8879X=1 +phy_rx_polarity_flip_fabric143.BCM8879X=0 + +phy_rx_polarity_flip_fabric144.BCM8879X=1 +phy_rx_polarity_flip_fabric145.BCM8879X=0 +phy_rx_polarity_flip_fabric146.BCM8879X=1 +phy_rx_polarity_flip_fabric147.BCM8879X=0 + +phy_rx_polarity_flip_fabric148.BCM8879X=1 +phy_rx_polarity_flip_fabric149.BCM8879X=0 +phy_rx_polarity_flip_fabric150.BCM8879X=1 +phy_rx_polarity_flip_fabric151.BCM8879X=0 + +phy_rx_polarity_flip_fabric152.BCM8879X=0 +phy_rx_polarity_flip_fabric153.BCM8879X=1 +phy_rx_polarity_flip_fabric154.BCM8879X=0 +phy_rx_polarity_flip_fabric155.BCM8879X=1 + +phy_rx_polarity_flip_fabric156.BCM8879X=1 +phy_rx_polarity_flip_fabric157.BCM8879X=0 +phy_rx_polarity_flip_fabric158.BCM8879X=1 +phy_rx_polarity_flip_fabric159.BCM8879X=0 + +phy_rx_polarity_flip_fabric160.BCM8879X=1 +phy_rx_polarity_flip_fabric161.BCM8879X=0 +phy_rx_polarity_flip_fabric162.BCM8879X=1 +phy_rx_polarity_flip_fabric163.BCM8879X=0 + +phy_rx_polarity_flip_fabric164.BCM8879X=0 +phy_rx_polarity_flip_fabric165.BCM8879X=1 +phy_rx_polarity_flip_fabric166.BCM8879X=0 +phy_rx_polarity_flip_fabric167.BCM8879X=1 + +phy_rx_polarity_flip_fabric168.BCM8879X=1 +phy_rx_polarity_flip_fabric169.BCM8879X=0 +phy_rx_polarity_flip_fabric170.BCM8879X=1 +phy_rx_polarity_flip_fabric171.BCM8879X=0 + +phy_rx_polarity_flip_fabric172.BCM8879X=1 +phy_rx_polarity_flip_fabric173.BCM8879X=0 +phy_rx_polarity_flip_fabric174.BCM8879X=1 +phy_rx_polarity_flip_fabric175.BCM8879X=0 + +phy_rx_polarity_flip_fabric176.BCM8879X=0 +phy_rx_polarity_flip_fabric177.BCM8879X=1 +phy_rx_polarity_flip_fabric178.BCM8879X=0 +phy_rx_polarity_flip_fabric179.BCM8879X=1 + +phy_rx_polarity_flip_fabric180.BCM8879X=1 +phy_rx_polarity_flip_fabric181.BCM8879X=0 +phy_rx_polarity_flip_fabric182.BCM8879X=1 +phy_rx_polarity_flip_fabric183.BCM8879X=0 + +phy_rx_polarity_flip_fabric184.BCM8879X=0 +phy_rx_polarity_flip_fabric185.BCM8879X=1 +phy_rx_polarity_flip_fabric186.BCM8879X=0 +phy_rx_polarity_flip_fabric187.BCM8879X=1 + +phy_rx_polarity_flip_fabric188.BCM8879X=1 +phy_rx_polarity_flip_fabric189.BCM8879X=0 +phy_rx_polarity_flip_fabric190.BCM8879X=1 +phy_rx_polarity_flip_fabric191.BCM8879X=0 + +phy_tx_polarity_flip_fabric0.BCM8879X=0 +phy_tx_polarity_flip_fabric1.BCM8879X=1 +phy_tx_polarity_flip_fabric2.BCM8879X=0 +phy_tx_polarity_flip_fabric3.BCM8879X=1 + +phy_tx_polarity_flip_fabric4.BCM8879X=1 +phy_tx_polarity_flip_fabric5.BCM8879X=0 +phy_tx_polarity_flip_fabric6.BCM8879X=1 +phy_tx_polarity_flip_fabric7.BCM8879X=0 + +phy_tx_polarity_flip_fabric8.BCM8879X=0 +phy_tx_polarity_flip_fabric9.BCM8879X=1 +phy_tx_polarity_flip_fabric10.BCM8879X=0 +phy_tx_polarity_flip_fabric11.BCM8879X=1 + +phy_tx_polarity_flip_fabric12.BCM8879X=1 +phy_tx_polarity_flip_fabric13.BCM8879X=0 +phy_tx_polarity_flip_fabric14.BCM8879X=1 +phy_tx_polarity_flip_fabric15.BCM8879X=0 + +phy_tx_polarity_flip_fabric16.BCM8879X=0 +phy_tx_polarity_flip_fabric17.BCM8879X=1 +phy_tx_polarity_flip_fabric18.BCM8879X=0 +phy_tx_polarity_flip_fabric19.BCM8879X=1 + +phy_tx_polarity_flip_fabric20.BCM8879X=0 +phy_tx_polarity_flip_fabric21.BCM8879X=1 +phy_tx_polarity_flip_fabric22.BCM8879X=0 +phy_tx_polarity_flip_fabric23.BCM8879X=1 + +phy_tx_polarity_flip_fabric24.BCM8879X=0 +phy_tx_polarity_flip_fabric25.BCM8879X=1 +phy_tx_polarity_flip_fabric26.BCM8879X=0 +phy_tx_polarity_flip_fabric27.BCM8879X=1 + +phy_tx_polarity_flip_fabric28.BCM8879X=1 +phy_tx_polarity_flip_fabric29.BCM8879X=0 +phy_tx_polarity_flip_fabric30.BCM8879X=1 +phy_tx_polarity_flip_fabric31.BCM8879X=0 + +phy_tx_polarity_flip_fabric32.BCM8879X=0 +phy_tx_polarity_flip_fabric33.BCM8879X=1 +phy_tx_polarity_flip_fabric34.BCM8879X=0 +phy_tx_polarity_flip_fabric35.BCM8879X=1 + +phy_tx_polarity_flip_fabric36.BCM8879X=1 +phy_tx_polarity_flip_fabric37.BCM8879X=0 +phy_tx_polarity_flip_fabric38.BCM8879X=1 +phy_tx_polarity_flip_fabric39.BCM8879X=0 + +phy_tx_polarity_flip_fabric40.BCM8879X=0 +phy_tx_polarity_flip_fabric41.BCM8879X=1 +phy_tx_polarity_flip_fabric42.BCM8879X=0 +phy_tx_polarity_flip_fabric43.BCM8879X=1 + +phy_tx_polarity_flip_fabric44.BCM8879X=0 +phy_tx_polarity_flip_fabric45.BCM8879X=1 +phy_tx_polarity_flip_fabric46.BCM8879X=0 +phy_tx_polarity_flip_fabric47.BCM8879X=1 + +phy_tx_polarity_flip_fabric48.BCM8879X=1 +phy_tx_polarity_flip_fabric49.BCM8879X=0 +phy_tx_polarity_flip_fabric50.BCM8879X=1 +phy_tx_polarity_flip_fabric51.BCM8879X=0 + +phy_tx_polarity_flip_fabric52.BCM8879X=0 +phy_tx_polarity_flip_fabric53.BCM8879X=1 +phy_tx_polarity_flip_fabric54.BCM8879X=0 +phy_tx_polarity_flip_fabric55.BCM8879X=1 + +phy_tx_polarity_flip_fabric56.BCM8879X=1 +phy_tx_polarity_flip_fabric57.BCM8879X=0 +phy_tx_polarity_flip_fabric58.BCM8879X=1 +phy_tx_polarity_flip_fabric59.BCM8879X=0 + +phy_tx_polarity_flip_fabric60.BCM8879X=1 +phy_tx_polarity_flip_fabric61.BCM8879X=0 +phy_tx_polarity_flip_fabric62.BCM8879X=1 +phy_tx_polarity_flip_fabric63.BCM8879X=0 + +phy_tx_polarity_flip_fabric64.BCM8879X=0 +phy_tx_polarity_flip_fabric65.BCM8879X=1 +phy_tx_polarity_flip_fabric66.BCM8879X=0 +phy_tx_polarity_flip_fabric67.BCM8879X=1 + +phy_tx_polarity_flip_fabric68.BCM8879X=1 +phy_tx_polarity_flip_fabric69.BCM8879X=0 +phy_tx_polarity_flip_fabric70.BCM8879X=1 +phy_tx_polarity_flip_fabric71.BCM8879X=0 + +phy_tx_polarity_flip_fabric72.BCM8879X=0 +phy_tx_polarity_flip_fabric73.BCM8879X=1 +phy_tx_polarity_flip_fabric74.BCM8879X=0 +phy_tx_polarity_flip_fabric75.BCM8879X=1 + +phy_tx_polarity_flip_fabric76.BCM8879X=0 +phy_tx_polarity_flip_fabric77.BCM8879X=1 +phy_tx_polarity_flip_fabric78.BCM8879X=0 +phy_tx_polarity_flip_fabric79.BCM8879X=1 + +phy_tx_polarity_flip_fabric80.BCM8879X=1 +phy_tx_polarity_flip_fabric81.BCM8879X=0 +phy_tx_polarity_flip_fabric82.BCM8879X=1 +phy_tx_polarity_flip_fabric83.BCM8879X=0 + +phy_tx_polarity_flip_fabric84.BCM8879X=0 +phy_tx_polarity_flip_fabric85.BCM8879X=1 +phy_tx_polarity_flip_fabric86.BCM8879X=0 +phy_tx_polarity_flip_fabric87.BCM8879X=1 + +phy_tx_polarity_flip_fabric88.BCM8879X=1 +phy_tx_polarity_flip_fabric89.BCM8879X=0 +phy_tx_polarity_flip_fabric90.BCM8879X=1 +phy_tx_polarity_flip_fabric91.BCM8879X=0 + +phy_tx_polarity_flip_fabric92.BCM8879X=0 +phy_tx_polarity_flip_fabric93.BCM8879X=1 +phy_tx_polarity_flip_fabric94.BCM8879X=0 +phy_tx_polarity_flip_fabric95.BCM8879X=1 + +phy_tx_polarity_flip_fabric96.BCM8879X=0 +phy_tx_polarity_flip_fabric97.BCM8879X=1 +phy_tx_polarity_flip_fabric98.BCM8879X=0 +phy_tx_polarity_flip_fabric99.BCM8879X=1 + +phy_tx_polarity_flip_fabric100.BCM8879X=1 +phy_tx_polarity_flip_fabric101.BCM8879X=0 +phy_tx_polarity_flip_fabric102.BCM8879X=1 +phy_tx_polarity_flip_fabric103.BCM8879X=0 + +phy_tx_polarity_flip_fabric104.BCM8879X=1 +phy_tx_polarity_flip_fabric105.BCM8879X=0 +phy_tx_polarity_flip_fabric106.BCM8879X=1 +phy_tx_polarity_flip_fabric107.BCM8879X=0 + +phy_tx_polarity_flip_fabric108.BCM8879X=1 +phy_tx_polarity_flip_fabric109.BCM8879X=0 +phy_tx_polarity_flip_fabric110.BCM8879X=1 +phy_tx_polarity_flip_fabric111.BCM8879X=0 + +phy_tx_polarity_flip_fabric112.BCM8879X=1 +phy_tx_polarity_flip_fabric113.BCM8879X=0 +phy_tx_polarity_flip_fabric114.BCM8879X=1 +phy_tx_polarity_flip_fabric115.BCM8879X=0 + +phy_tx_polarity_flip_fabric116.BCM8879X=0 +phy_tx_polarity_flip_fabric117.BCM8879X=1 +phy_tx_polarity_flip_fabric118.BCM8879X=0 +phy_tx_polarity_flip_fabric119.BCM8879X=1 + +phy_tx_polarity_flip_fabric120.BCM8879X=0 +phy_tx_polarity_flip_fabric121.BCM8879X=1 +phy_tx_polarity_flip_fabric122.BCM8879X=0 +phy_tx_polarity_flip_fabric123.BCM8879X=1 + +phy_tx_polarity_flip_fabric124.BCM8879X=1 +phy_tx_polarity_flip_fabric125.BCM8879X=0 +phy_tx_polarity_flip_fabric126.BCM8879X=1 +phy_tx_polarity_flip_fabric127.BCM8879X=0 + +phy_tx_polarity_flip_fabric128.BCM8879X=0 +phy_tx_polarity_flip_fabric129.BCM8879X=1 +phy_tx_polarity_flip_fabric130.BCM8879X=0 +phy_tx_polarity_flip_fabric131.BCM8879X=1 + +phy_tx_polarity_flip_fabric132.BCM8879X=1 +phy_tx_polarity_flip_fabric133.BCM8879X=0 +phy_tx_polarity_flip_fabric134.BCM8879X=1 +phy_tx_polarity_flip_fabric135.BCM8879X=0 + +phy_tx_polarity_flip_fabric136.BCM8879X=0 +phy_tx_polarity_flip_fabric137.BCM8879X=1 +phy_tx_polarity_flip_fabric138.BCM8879X=0 +phy_tx_polarity_flip_fabric139.BCM8879X=1 + +phy_tx_polarity_flip_fabric140.BCM8879X=0 +phy_tx_polarity_flip_fabric141.BCM8879X=1 +phy_tx_polarity_flip_fabric142.BCM8879X=0 +phy_tx_polarity_flip_fabric143.BCM8879X=1 + +phy_tx_polarity_flip_fabric144.BCM8879X=0 +phy_tx_polarity_flip_fabric145.BCM8879X=1 +phy_tx_polarity_flip_fabric146.BCM8879X=0 +phy_tx_polarity_flip_fabric147.BCM8879X=1 + +phy_tx_polarity_flip_fabric148.BCM8879X=0 +phy_tx_polarity_flip_fabric149.BCM8879X=1 +phy_tx_polarity_flip_fabric150.BCM8879X=0 +phy_tx_polarity_flip_fabric151.BCM8879X=1 + +phy_tx_polarity_flip_fabric152.BCM8879X=1 +phy_tx_polarity_flip_fabric153.BCM8879X=0 +phy_tx_polarity_flip_fabric154.BCM8879X=1 +phy_tx_polarity_flip_fabric155.BCM8879X=0 + +phy_tx_polarity_flip_fabric156.BCM8879X=0 +phy_tx_polarity_flip_fabric157.BCM8879X=1 +phy_tx_polarity_flip_fabric158.BCM8879X=0 +phy_tx_polarity_flip_fabric159.BCM8879X=1 + +phy_tx_polarity_flip_fabric160.BCM8879X=0 +phy_tx_polarity_flip_fabric161.BCM8879X=1 +phy_tx_polarity_flip_fabric162.BCM8879X=0 +phy_tx_polarity_flip_fabric163.BCM8879X=1 + +phy_tx_polarity_flip_fabric164.BCM8879X=1 +phy_tx_polarity_flip_fabric165.BCM8879X=0 +phy_tx_polarity_flip_fabric166.BCM8879X=1 +phy_tx_polarity_flip_fabric167.BCM8879X=0 + +phy_tx_polarity_flip_fabric168.BCM8879X=0 +phy_tx_polarity_flip_fabric169.BCM8879X=1 +phy_tx_polarity_flip_fabric170.BCM8879X=0 +phy_tx_polarity_flip_fabric171.BCM8879X=1 + +phy_tx_polarity_flip_fabric172.BCM8879X=0 +phy_tx_polarity_flip_fabric173.BCM8879X=1 +phy_tx_polarity_flip_fabric174.BCM8879X=0 +phy_tx_polarity_flip_fabric175.BCM8879X=1 + +phy_tx_polarity_flip_fabric176.BCM8879X=1 +phy_tx_polarity_flip_fabric177.BCM8879X=0 +phy_tx_polarity_flip_fabric178.BCM8879X=1 +phy_tx_polarity_flip_fabric179.BCM8879X=0 + +phy_tx_polarity_flip_fabric180.BCM8879X=0 +phy_tx_polarity_flip_fabric181.BCM8879X=1 +phy_tx_polarity_flip_fabric182.BCM8879X=0 +phy_tx_polarity_flip_fabric183.BCM8879X=1 + +phy_tx_polarity_flip_fabric184.BCM8879X=1 +phy_tx_polarity_flip_fabric185.BCM8879X=0 +phy_tx_polarity_flip_fabric186.BCM8879X=1 +phy_tx_polarity_flip_fabric187.BCM8879X=0 + +phy_tx_polarity_flip_fabric188.BCM8879X=0 +phy_tx_polarity_flip_fabric189.BCM8879X=1 +phy_tx_polarity_flip_fabric190.BCM8879X=0 +phy_tx_polarity_flip_fabric191.BCM8879X=1 + +port_init_cl72_0=0 +port_init_cl72_1=0 +port_init_cl72_2=0 +port_init_cl72_3=0 +port_init_cl72_4=0 +port_init_cl72_5=0 +port_init_cl72_6=0 +port_init_cl72_7=0 +port_init_cl72_8=0 +port_init_cl72_9=0 +port_init_cl72_10=0 +port_init_cl72_11=0 +port_init_cl72_12=0 +port_init_cl72_13=0 +port_init_cl72_14=0 +port_init_cl72_15=0 +port_init_cl72_16=0 +port_init_cl72_17=0 +port_init_cl72_18=0 +port_init_cl72_19=0 +port_init_cl72_20=0 +port_init_cl72_21=0 +port_init_cl72_22=0 +port_init_cl72_23=0 +port_init_cl72_24=0 +port_init_cl72_25=0 +port_init_cl72_26=0 +port_init_cl72_27=0 +port_init_cl72_28=0 +port_init_cl72_29=0 +port_init_cl72_30=0 +port_init_cl72_31=0 +port_init_cl72_32=0 +port_init_cl72_33=0 +port_init_cl72_34=0 +port_init_cl72_35=0 +port_init_cl72_36=0 +port_init_cl72_37=0 +port_init_cl72_38=0 +port_init_cl72_39=0 +port_init_cl72_40=0 +port_init_cl72_41=0 +port_init_cl72_42=0 +port_init_cl72_43=0 +port_init_cl72_44=0 +port_init_cl72_45=0 +port_init_cl72_46=0 +port_init_cl72_47=0 +port_init_cl72_48=0 +port_init_cl72_49=0 +port_init_cl72_50=0 +port_init_cl72_51=0 +port_init_cl72_52=0 +port_init_cl72_53=0 +port_init_cl72_54=0 +port_init_cl72_55=0 +port_init_cl72_56=0 +port_init_cl72_57=0 +port_init_cl72_58=0 +port_init_cl72_59=0 +port_init_cl72_60=0 +port_init_cl72_61=0 +port_init_cl72_62=0 +port_init_cl72_63=0 +port_init_cl72_64=0 +port_init_cl72_65=0 +port_init_cl72_66=0 +port_init_cl72_67=0 +port_init_cl72_68=0 +port_init_cl72_69=0 +port_init_cl72_70=0 +port_init_cl72_71=0 +port_init_cl72_72=0 +port_init_cl72_73=0 +port_init_cl72_74=0 +port_init_cl72_75=0 +port_init_cl72_76=0 +port_init_cl72_77=0 +port_init_cl72_78=0 +port_init_cl72_79=0 +port_init_cl72_80=0 +port_init_cl72_81=0 +port_init_cl72_82=0 +port_init_cl72_83=0 +port_init_cl72_84=0 +port_init_cl72_85=0 +port_init_cl72_86=0 +port_init_cl72_87=0 +port_init_cl72_88=0 +port_init_cl72_89=0 +port_init_cl72_90=0 +port_init_cl72_91=0 +port_init_cl72_92=0 +port_init_cl72_93=0 +port_init_cl72_94=0 +port_init_cl72_95=0 +port_init_cl72_96=0 +port_init_cl72_97=0 +port_init_cl72_98=0 +port_init_cl72_99=0 +port_init_cl72_100=0 +port_init_cl72_101=0 +port_init_cl72_102=0 +port_init_cl72_103=0 +port_init_cl72_104=0 +port_init_cl72_105=0 +port_init_cl72_106=0 +port_init_cl72_107=0 +port_init_cl72_108=0 +port_init_cl72_109=0 +port_init_cl72_110=0 +port_init_cl72_111=0 +port_init_cl72_112=0 +port_init_cl72_113=0 +port_init_cl72_114=0 +port_init_cl72_115=0 +port_init_cl72_116=0 +port_init_cl72_117=0 +port_init_cl72_118=0 +port_init_cl72_119=0 +port_init_cl72_120=0 +port_init_cl72_121=0 +port_init_cl72_122=0 +port_init_cl72_123=0 +port_init_cl72_124=0 +port_init_cl72_125=0 +port_init_cl72_126=0 +port_init_cl72_127=0 +port_init_cl72_128=0 +port_init_cl72_129=0 +port_init_cl72_130=0 +port_init_cl72_131=0 +port_init_cl72_132=0 +port_init_cl72_133=0 +port_init_cl72_134=0 +port_init_cl72_135=0 +port_init_cl72_136=0 +port_init_cl72_137=0 +port_init_cl72_138=0 +port_init_cl72_139=0 +port_init_cl72_140=0 +port_init_cl72_141=0 +port_init_cl72_142=0 +port_init_cl72_143=0 +port_init_cl72_144=0 +port_init_cl72_145=0 +port_init_cl72_146=0 +port_init_cl72_147=0 +port_init_cl72_148=0 +port_init_cl72_149=0 +port_init_cl72_150=0 +port_init_cl72_151=0 +port_init_cl72_152=0 +port_init_cl72_153=0 +port_init_cl72_154=0 +port_init_cl72_155=0 +port_init_cl72_156=0 +port_init_cl72_157=0 +port_init_cl72_158=0 +port_init_cl72_159=0 +port_init_cl72_160=0 +port_init_cl72_161=0 +port_init_cl72_162=0 +port_init_cl72_163=0 +port_init_cl72_164=0 +port_init_cl72_165=0 +port_init_cl72_166=0 +port_init_cl72_167=0 +port_init_cl72_168=0 +port_init_cl72_169=0 +port_init_cl72_170=0 +port_init_cl72_171=0 +port_init_cl72_172=0 +port_init_cl72_173=0 +port_init_cl72_174=0 +port_init_cl72_175=0 +port_init_cl72_176=0 +port_init_cl72_177=0 +port_init_cl72_178=0 +port_init_cl72_179=0 +port_init_cl72_180=0 +port_init_cl72_181=0 +port_init_cl72_182=0 +port_init_cl72_183=0 +port_init_cl72_184=0 +port_init_cl72_185=0 +port_init_cl72_186=0 +port_init_cl72_187=0 +port_init_cl72_188=0 +port_init_cl72_189=0 +port_init_cl72_190=0 +port_init_cl72_191=0 + +serdes_tx_taps_0.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_1.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_2.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_3.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_4.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_5.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_6.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_7.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_8.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_9.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_10.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_11.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_12.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_13.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_14.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_15.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_16.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_17.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_18.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_19.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_20.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_21.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_22.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_23.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_24.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_25.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_26.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_27.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_28.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_29.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_30.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_31.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_32.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_33.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_34.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_35.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_36.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_37.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_38.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_39.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_40.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_41.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_42.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_43.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_44.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_45.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_46.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_47.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_48.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_49.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_50.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_51.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_52.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_53.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_54.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_55.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_56.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_57.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_58.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_59.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_60.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_61.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_62.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_63.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_64.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_65.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_66.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_67.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_68.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_69.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_70.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_71.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_72.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_73.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_74.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_75.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_76.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_77.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_78.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_79.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_80.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_81.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_82.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_83.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_84.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_85.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_86.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_87.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_88.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_89.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_90.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_91.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_92.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_93.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_94.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_95.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_96.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_97.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_98.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_99.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_100.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_101.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_102.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_103.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_104.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_105.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_106.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_107.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_108.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_109.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_110.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_111.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_112.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_113.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_114.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_115.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_116.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_117.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_118.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_119.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_120.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_121.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_122.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_123.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_124.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_125.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_126.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_127.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_128.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_129.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_130.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_131.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_132.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_133.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_134.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_135.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_136.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_137.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_138.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_139.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_140.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_141.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_142.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_143.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_144.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_145.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_146.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_147.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_148.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_149.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_150.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_151.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_152.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_153.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_154.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_155.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_156.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_157.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_158.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_159.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_160.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_161.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_162.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_163.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_164.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_165.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_166.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_167.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_168.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_169.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_170.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_171.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_172.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_173.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_174.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_175.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_176.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_177.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_178.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_179.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_180.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_181.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_182.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_183.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_184.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_185.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_186.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_187.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_188.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_189.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_190.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_191.BCM8879X=pam4:-24:132:-12:0:0:0 + +serdes_lane_config_channel_mode_0.0=force_nr +serdes_lane_config_channel_mode_1.0=force_nr +serdes_lane_config_channel_mode_2.0=force_nr +serdes_lane_config_channel_mode_3.0=force_nr +serdes_lane_config_channel_mode_4.0=force_nr +serdes_lane_config_channel_mode_5.0=force_nr +serdes_lane_config_channel_mode_6.0=force_nr +serdes_lane_config_channel_mode_7.0=force_nr +serdes_lane_config_channel_mode_8.0=force_nr +serdes_lane_config_channel_mode_9.0=force_nr +serdes_lane_config_channel_mode_10.0=force_nr +serdes_lane_config_channel_mode_11.0=force_nr +serdes_lane_config_channel_mode_12.0=force_nr +serdes_lane_config_channel_mode_13.0=force_nr +serdes_lane_config_channel_mode_14.0=force_nr +serdes_lane_config_channel_mode_15.0=force_nr +serdes_lane_config_channel_mode_16.0=force_nr +serdes_lane_config_channel_mode_17.0=force_nr +serdes_lane_config_channel_mode_18.0=force_nr +serdes_lane_config_channel_mode_19.0=force_nr +serdes_lane_config_channel_mode_20.0=force_nr +serdes_lane_config_channel_mode_21.0=force_nr +serdes_lane_config_channel_mode_22.0=force_nr +serdes_lane_config_channel_mode_23.0=force_nr +serdes_lane_config_channel_mode_24.0=force_nr +serdes_lane_config_channel_mode_25.0=force_nr +serdes_lane_config_channel_mode_26.0=force_nr +serdes_lane_config_channel_mode_27.0=force_nr +serdes_lane_config_channel_mode_28.0=force_nr +serdes_lane_config_channel_mode_29.0=force_nr +serdes_lane_config_channel_mode_30.0=force_nr +serdes_lane_config_channel_mode_31.0=force_nr +serdes_lane_config_channel_mode_32.0=force_nr +serdes_lane_config_channel_mode_33.0=force_nr +serdes_lane_config_channel_mode_34.0=force_nr +serdes_lane_config_channel_mode_35.0=force_nr +serdes_lane_config_channel_mode_36.0=force_nr +serdes_lane_config_channel_mode_37.0=force_nr +serdes_lane_config_channel_mode_38.0=force_nr +serdes_lane_config_channel_mode_39.0=force_nr +serdes_lane_config_channel_mode_40.0=force_nr +serdes_lane_config_channel_mode_41.0=force_nr +serdes_lane_config_channel_mode_42.0=force_nr +serdes_lane_config_channel_mode_43.0=force_nr +serdes_lane_config_channel_mode_44.0=force_nr +serdes_lane_config_channel_mode_45.0=force_nr +serdes_lane_config_channel_mode_46.0=force_nr +serdes_lane_config_channel_mode_47.0=force_nr +serdes_lane_config_channel_mode_48.0=force_nr +serdes_lane_config_channel_mode_49.0=force_nr +serdes_lane_config_channel_mode_50.0=force_nr +serdes_lane_config_channel_mode_51.0=force_nr +serdes_lane_config_channel_mode_52.0=force_nr +serdes_lane_config_channel_mode_53.0=force_nr +serdes_lane_config_channel_mode_54.0=force_nr +serdes_lane_config_channel_mode_55.0=force_nr +serdes_lane_config_channel_mode_56.0=force_nr +serdes_lane_config_channel_mode_57.0=force_nr +serdes_lane_config_channel_mode_58.0=force_nr +serdes_lane_config_channel_mode_59.0=force_nr +serdes_lane_config_channel_mode_60.0=force_nr +serdes_lane_config_channel_mode_61.0=force_nr +serdes_lane_config_channel_mode_62.0=force_nr +serdes_lane_config_channel_mode_63.0=force_nr +serdes_lane_config_channel_mode_64.0=force_nr +serdes_lane_config_channel_mode_65.0=force_nr +serdes_lane_config_channel_mode_66.0=force_nr +serdes_lane_config_channel_mode_67.0=force_nr +serdes_lane_config_channel_mode_68.0=force_nr +serdes_lane_config_channel_mode_69.0=force_nr +serdes_lane_config_channel_mode_70.0=force_nr +serdes_lane_config_channel_mode_71.0=force_nr +serdes_lane_config_channel_mode_72.0=force_nr +serdes_lane_config_channel_mode_73.0=force_nr +serdes_lane_config_channel_mode_74.0=force_nr +serdes_lane_config_channel_mode_75.0=force_nr +serdes_lane_config_channel_mode_76.0=force_nr +serdes_lane_config_channel_mode_77.0=force_nr +serdes_lane_config_channel_mode_78.0=force_nr +serdes_lane_config_channel_mode_79.0=force_nr +serdes_lane_config_channel_mode_80.0=force_nr +serdes_lane_config_channel_mode_81.0=force_nr +serdes_lane_config_channel_mode_82.0=force_nr +serdes_lane_config_channel_mode_83.0=force_nr +serdes_lane_config_channel_mode_84.0=force_nr +serdes_lane_config_channel_mode_85.0=force_nr +serdes_lane_config_channel_mode_86.0=force_nr +serdes_lane_config_channel_mode_87.0=force_nr +serdes_lane_config_channel_mode_88.0=force_nr +serdes_lane_config_channel_mode_89.0=force_nr +serdes_lane_config_channel_mode_90.0=force_nr +serdes_lane_config_channel_mode_91.0=force_nr +serdes_lane_config_channel_mode_92.0=force_nr +serdes_lane_config_channel_mode_93.0=force_nr +serdes_lane_config_channel_mode_94.0=force_nr +serdes_lane_config_channel_mode_95.0=force_nr +serdes_lane_config_channel_mode_96.0=force_nr +serdes_lane_config_channel_mode_97.0=force_nr +serdes_lane_config_channel_mode_98.0=force_nr +serdes_lane_config_channel_mode_99.0=force_nr +serdes_lane_config_channel_mode_100.0=force_nr +serdes_lane_config_channel_mode_101.0=force_nr +serdes_lane_config_channel_mode_102.0=force_nr +serdes_lane_config_channel_mode_103.0=force_nr +serdes_lane_config_channel_mode_104.0=force_nr +serdes_lane_config_channel_mode_105.0=force_nr +serdes_lane_config_channel_mode_106.0=force_nr +serdes_lane_config_channel_mode_107.0=force_nr +serdes_lane_config_channel_mode_108.0=force_nr +serdes_lane_config_channel_mode_109.0=force_nr +serdes_lane_config_channel_mode_110.0=force_nr +serdes_lane_config_channel_mode_111.0=force_nr +serdes_lane_config_channel_mode_112.0=force_nr +serdes_lane_config_channel_mode_113.0=force_nr +serdes_lane_config_channel_mode_114.0=force_nr +serdes_lane_config_channel_mode_115.0=force_nr +serdes_lane_config_channel_mode_116.0=force_nr +serdes_lane_config_channel_mode_117.0=force_nr +serdes_lane_config_channel_mode_118.0=force_nr +serdes_lane_config_channel_mode_119.0=force_nr +serdes_lane_config_channel_mode_120.0=force_nr +serdes_lane_config_channel_mode_121.0=force_nr +serdes_lane_config_channel_mode_122.0=force_nr +serdes_lane_config_channel_mode_123.0=force_nr +serdes_lane_config_channel_mode_124.0=force_nr +serdes_lane_config_channel_mode_125.0=force_nr +serdes_lane_config_channel_mode_126.0=force_nr +serdes_lane_config_channel_mode_127.0=force_nr +serdes_lane_config_channel_mode_128.0=force_nr +serdes_lane_config_channel_mode_129.0=force_nr +serdes_lane_config_channel_mode_130.0=force_nr +serdes_lane_config_channel_mode_131.0=force_nr +serdes_lane_config_channel_mode_132.0=force_nr +serdes_lane_config_channel_mode_133.0=force_nr +serdes_lane_config_channel_mode_134.0=force_nr +serdes_lane_config_channel_mode_135.0=force_nr +serdes_lane_config_channel_mode_136.0=force_nr +serdes_lane_config_channel_mode_137.0=force_nr +serdes_lane_config_channel_mode_138.0=force_nr +serdes_lane_config_channel_mode_139.0=force_nr +serdes_lane_config_channel_mode_140.0=force_nr +serdes_lane_config_channel_mode_141.0=force_nr +serdes_lane_config_channel_mode_142.0=force_nr +serdes_lane_config_channel_mode_143.0=force_nr +serdes_lane_config_channel_mode_144.0=force_nr +serdes_lane_config_channel_mode_145.0=force_nr +serdes_lane_config_channel_mode_146.0=force_nr +serdes_lane_config_channel_mode_147.0=force_nr +serdes_lane_config_channel_mode_148.0=force_nr +serdes_lane_config_channel_mode_149.0=force_nr +serdes_lane_config_channel_mode_150.0=force_nr +serdes_lane_config_channel_mode_151.0=force_nr +serdes_lane_config_channel_mode_152.0=force_nr +serdes_lane_config_channel_mode_153.0=force_nr +serdes_lane_config_channel_mode_154.0=force_nr +serdes_lane_config_channel_mode_155.0=force_nr +serdes_lane_config_channel_mode_156.0=force_nr +serdes_lane_config_channel_mode_157.0=force_nr +serdes_lane_config_channel_mode_158.0=force_nr +serdes_lane_config_channel_mode_159.0=force_nr +serdes_lane_config_channel_mode_160.0=force_nr +serdes_lane_config_channel_mode_161.0=force_nr +serdes_lane_config_channel_mode_162.0=force_nr +serdes_lane_config_channel_mode_163.0=force_nr +serdes_lane_config_channel_mode_164.0=force_nr +serdes_lane_config_channel_mode_165.0=force_nr +serdes_lane_config_channel_mode_166.0=force_nr +serdes_lane_config_channel_mode_167.0=force_nr +serdes_lane_config_channel_mode_168.0=force_nr +serdes_lane_config_channel_mode_169.0=force_nr +serdes_lane_config_channel_mode_170.0=force_nr +serdes_lane_config_channel_mode_171.0=force_nr +serdes_lane_config_channel_mode_172.0=force_nr +serdes_lane_config_channel_mode_173.0=force_nr +serdes_lane_config_channel_mode_174.0=force_nr +serdes_lane_config_channel_mode_175.0=force_nr +serdes_lane_config_channel_mode_176.0=force_nr +serdes_lane_config_channel_mode_177.0=force_nr +serdes_lane_config_channel_mode_178.0=force_nr +serdes_lane_config_channel_mode_179.0=force_nr +serdes_lane_config_channel_mode_180.0=force_nr +serdes_lane_config_channel_mode_181.0=force_nr +serdes_lane_config_channel_mode_182.0=force_nr +serdes_lane_config_channel_mode_183.0=force_nr +serdes_lane_config_channel_mode_184.0=force_nr +serdes_lane_config_channel_mode_185.0=force_nr +serdes_lane_config_channel_mode_186.0=force_nr +serdes_lane_config_channel_mode_187.0=force_nr +serdes_lane_config_channel_mode_188.0=force_nr +serdes_lane_config_channel_mode_189.0=force_nr +serdes_lane_config_channel_mode_190.0=force_nr +serdes_lane_config_channel_mode_191.0=force_nr + + +serdes_qrtt_active_0.0=1 +serdes_qrtt_active_1.0=1 +serdes_qrtt_active_2.0=1 +serdes_qrtt_active_3.0=1 +serdes_qrtt_active_4.0=1 +serdes_qrtt_active_5.0=1 +serdes_qrtt_active_6.0=1 +serdes_qrtt_active_7.0=1 +serdes_qrtt_active_8.0=1 +serdes_qrtt_active_9.0=1 +serdes_qrtt_active_10.0=1 +serdes_qrtt_active_11.0=1 +serdes_qrtt_active_12.0=1 +serdes_qrtt_active_13.0=1 +serdes_qrtt_active_14.0=1 +serdes_qrtt_active_15.0=1 +serdes_qrtt_active_16.0=1 +serdes_qrtt_active_17.0=1 +serdes_qrtt_active_18.0=1 +serdes_qrtt_active_19.0=1 +serdes_qrtt_active_20.0=1 +serdes_qrtt_active_21.0=1 +serdes_qrtt_active_22.0=1 +serdes_qrtt_active_23.0=1 +serdes_qrtt_active_24.0=1 +serdes_qrtt_active_25.0=1 +serdes_qrtt_active_26.0=1 +serdes_qrtt_active_27.0=1 +serdes_qrtt_active_28.0=1 +serdes_qrtt_active_29.0=1 +serdes_qrtt_active_30.0=1 +serdes_qrtt_active_31.0=1 +serdes_qrtt_active_32.0=1 +serdes_qrtt_active_33.0=1 +serdes_qrtt_active_34.0=1 +serdes_qrtt_active_35.0=1 +serdes_qrtt_active_36.0=1 +serdes_qrtt_active_37.0=1 +serdes_qrtt_active_38.0=1 +serdes_qrtt_active_39.0=1 +serdes_qrtt_active_40.0=1 +serdes_qrtt_active_41.0=1 +serdes_qrtt_active_42.0=1 +serdes_qrtt_active_43.0=1 +serdes_qrtt_active_44.0=1 +serdes_qrtt_active_45.0=1 +serdes_qrtt_active_46.0=1 +serdes_qrtt_active_47.0=1 diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/11/config-ramon-6-1.bcm b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/11/config-ramon-6-1.bcm new file mode 100644 index 000000000000..3070800dbf4d --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/11/config-ramon-6-1.bcm @@ -0,0 +1,1395 @@ + +appl_enable_intr_init.BCM8879X=0 +appl_param_module_id.BCM8879X=12 +bcm_linkscan_interval.BCM8879X=0 +bcm_stat_interval.BCM8879X=4000000 +bist_enable.BCM8879X=0 +core_clock_speed_khz.BCM8879X=1000000 +custom_feature_access_only.BCM8879X=0 +custom_feature_lane_swap_disable.BCM8879X=0 +dport_map_direct.BCM8879X=1 +fabric_cell_fifo_dma_enable.BCM8879X=0 +fabric_device_mode.BCM8879X=SINGLE_STAGE_FE2 +fabric_load_balancing_mode.BCM8879X=NORMAL_LOAD_BALANCE +fabric_multicast_mode.BCM8879X=DIRECT +fabric_num_pipes.BCM8879X=1 +fabric_pipe_map.BCM8879X=0 +fe_mc_id_range.BCM8879X=128K +load_firmware.BCM8879X=0x102 +mdio_output_delay_ext.BCM8879X=14 +mdio_output_delay_int.BCM8879X=25 +mem_cache_enable_parity.BCM8879X=1 +mm_intr_enable.BCM8879X=0 +mm_timeout_usec.BCM8879X=300000 +polled_irq_delay.BCM8879X=100000 +polled_irq_mode.BCM8879X=1 +port_fec.BCM8879X=7 +port_init_cl72.BCM8879X=0 +port_init_speed.BCM8879X=53125 +rate_ext_mdio_divisor.BCM8879X=14 +rate_int_mdio_divisor.BCM8879X=50 +schan_intr_enable.BCM8879X=0 +schan_timeout_usec.BCM8879X=300000 +serdes_fabric_clk_freq_in.BCM8879X=1 +serdes_fabric_clk_freq_out.BCM8879X=bypass +soc_family.BCM8879X=BCM8879X +srd_tx_drv_hv_disable.BCM8879X=0 +system_contains_multiple_pipe_device.BCM8879X=0 +system_ref_core_clock_khz.BCM8879X=1200000 +table_dma_enable.BCM8879X=0 +tdma_intr_enable.BCM8879X=0 +tdma_timeout_usec.BCM8879X=5000000 +tslam_dma_enable.BCM8879X=0 +tslam_intr_enable.BCM8879X=0 +tslam_timeout_usec.BCM8879X=5000000 + +lane_to_serdes_map_fabric_lane0.BCM8879X=rx0:tx0 +lane_to_serdes_map_fabric_lane1.BCM8879X=rx1:tx1 +lane_to_serdes_map_fabric_lane2.BCM8879X=rx2:tx2 +lane_to_serdes_map_fabric_lane3.BCM8879X=rx3:tx3 + +lane_to_serdes_map_fabric_lane4.BCM8879X=rx4:tx4 +lane_to_serdes_map_fabric_lane5.BCM8879X=rx5:tx5 +lane_to_serdes_map_fabric_lane6.BCM8879X=rx6:tx6 +lane_to_serdes_map_fabric_lane7.BCM8879X=rx7:tx7 + +lane_to_serdes_map_fabric_lane8.BCM8879X=rx8:tx8 +lane_to_serdes_map_fabric_lane9.BCM8879X=rx9:tx9 +lane_to_serdes_map_fabric_lane10.BCM8879X=rx10:tx10 +lane_to_serdes_map_fabric_lane11.BCM8879X=rx11:tx11 + +lane_to_serdes_map_fabric_lane12.BCM8879X=rx12:tx12 +lane_to_serdes_map_fabric_lane13.BCM8879X=rx13:tx13 +lane_to_serdes_map_fabric_lane14.BCM8879X=rx14:tx14 +lane_to_serdes_map_fabric_lane15.BCM8879X=rx15:tx15 + +lane_to_serdes_map_fabric_lane16.BCM8879X=rx16:tx16 +lane_to_serdes_map_fabric_lane17.BCM8879X=rx17:tx17 +lane_to_serdes_map_fabric_lane18.BCM8879X=rx18:tx18 +lane_to_serdes_map_fabric_lane19.BCM8879X=rx19:tx19 + +lane_to_serdes_map_fabric_lane20.BCM8879X=rx20:tx20 +lane_to_serdes_map_fabric_lane21.BCM8879X=rx21:tx21 +lane_to_serdes_map_fabric_lane22.BCM8879X=rx22:tx22 +lane_to_serdes_map_fabric_lane23.BCM8879X=rx23:tx23 + +lane_to_serdes_map_fabric_lane24.BCM8879X=rx24:tx24 +lane_to_serdes_map_fabric_lane25.BCM8879X=rx25:tx25 +lane_to_serdes_map_fabric_lane26.BCM8879X=rx26:tx26 +lane_to_serdes_map_fabric_lane27.BCM8879X=rx27:tx27 + +lane_to_serdes_map_fabric_lane28.BCM8879X=rx28:tx28 +lane_to_serdes_map_fabric_lane29.BCM8879X=rx29:tx29 +lane_to_serdes_map_fabric_lane30.BCM8879X=rx30:tx30 +lane_to_serdes_map_fabric_lane31.BCM8879X=rx31:tx31 + +lane_to_serdes_map_fabric_lane32.BCM8879X=rx32:tx32 +lane_to_serdes_map_fabric_lane33.BCM8879X=rx33:tx33 +lane_to_serdes_map_fabric_lane34.BCM8879X=rx34:tx34 +lane_to_serdes_map_fabric_lane35.BCM8879X=rx35:tx35 + +lane_to_serdes_map_fabric_lane36.BCM8879X=rx36:tx36 +lane_to_serdes_map_fabric_lane37.BCM8879X=rx37:tx37 +lane_to_serdes_map_fabric_lane38.BCM8879X=rx38:tx38 +lane_to_serdes_map_fabric_lane39.BCM8879X=rx39:tx39 + +lane_to_serdes_map_fabric_lane40.BCM8879X=rx40:tx40 +lane_to_serdes_map_fabric_lane41.BCM8879X=rx41:tx41 +lane_to_serdes_map_fabric_lane42.BCM8879X=rx42:tx42 +lane_to_serdes_map_fabric_lane43.BCM8879X=rx43:tx43 + +lane_to_serdes_map_fabric_lane44.BCM8879X=rx44:tx44 +lane_to_serdes_map_fabric_lane45.BCM8879X=rx45:tx45 +lane_to_serdes_map_fabric_lane46.BCM8879X=rx46:tx46 +lane_to_serdes_map_fabric_lane47.BCM8879X=rx47:tx47 + +lane_to_serdes_map_fabric_lane48.BCM8879X=rx48:tx48 +lane_to_serdes_map_fabric_lane49.BCM8879X=rx49:tx49 +lane_to_serdes_map_fabric_lane50.BCM8879X=rx50:tx50 +lane_to_serdes_map_fabric_lane51.BCM8879X=rx51:tx51 + +lane_to_serdes_map_fabric_lane52.BCM8879X=rx52:tx52 +lane_to_serdes_map_fabric_lane53.BCM8879X=rx53:tx53 +lane_to_serdes_map_fabric_lane54.BCM8879X=rx54:tx54 +lane_to_serdes_map_fabric_lane55.BCM8879X=rx55:tx55 + +lane_to_serdes_map_fabric_lane56.BCM8879X=rx56:tx56 +lane_to_serdes_map_fabric_lane57.BCM8879X=rx57:tx57 +lane_to_serdes_map_fabric_lane58.BCM8879X=rx58:tx58 +lane_to_serdes_map_fabric_lane59.BCM8879X=rx59:tx59 + +lane_to_serdes_map_fabric_lane60.BCM8879X=rx60:tx60 +lane_to_serdes_map_fabric_lane61.BCM8879X=rx61:tx61 +lane_to_serdes_map_fabric_lane62.BCM8879X=rx62:tx62 +lane_to_serdes_map_fabric_lane63.BCM8879X=rx63:tx63 + +lane_to_serdes_map_fabric_lane64.BCM8879X=rx64:tx64 +lane_to_serdes_map_fabric_lane65.BCM8879X=rx65:tx65 +lane_to_serdes_map_fabric_lane66.BCM8879X=rx66:tx66 +lane_to_serdes_map_fabric_lane67.BCM8879X=rx67:tx67 + +lane_to_serdes_map_fabric_lane68.BCM8879X=rx68:tx68 +lane_to_serdes_map_fabric_lane69.BCM8879X=rx69:tx69 +lane_to_serdes_map_fabric_lane70.BCM8879X=rx70:tx70 +lane_to_serdes_map_fabric_lane71.BCM8879X=rx71:tx71 + +lane_to_serdes_map_fabric_lane72.BCM8879X=rx72:tx72 +lane_to_serdes_map_fabric_lane73.BCM8879X=rx73:tx73 +lane_to_serdes_map_fabric_lane74.BCM8879X=rx74:tx74 +lane_to_serdes_map_fabric_lane75.BCM8879X=rx75:tx75 + +lane_to_serdes_map_fabric_lane76.BCM8879X=rx76:tx76 +lane_to_serdes_map_fabric_lane77.BCM8879X=rx77:tx77 +lane_to_serdes_map_fabric_lane78.BCM8879X=rx78:tx78 +lane_to_serdes_map_fabric_lane79.BCM8879X=rx79:tx79 + +lane_to_serdes_map_fabric_lane80.BCM8879X=rx80:tx80 +lane_to_serdes_map_fabric_lane81.BCM8879X=rx81:tx81 +lane_to_serdes_map_fabric_lane82.BCM8879X=rx82:tx82 +lane_to_serdes_map_fabric_lane83.BCM8879X=rx83:tx83 + +lane_to_serdes_map_fabric_lane84.BCM8879X=rx84:tx84 +lane_to_serdes_map_fabric_lane85.BCM8879X=rx85:tx85 +lane_to_serdes_map_fabric_lane86.BCM8879X=rx86:tx86 +lane_to_serdes_map_fabric_lane87.BCM8879X=rx87:tx87 + +lane_to_serdes_map_fabric_lane88.BCM8879X=rx88:tx88 +lane_to_serdes_map_fabric_lane89.BCM8879X=rx89:tx89 +lane_to_serdes_map_fabric_lane90.BCM8879X=rx90:tx90 +lane_to_serdes_map_fabric_lane91.BCM8879X=rx91:tx91 + +lane_to_serdes_map_fabric_lane92.BCM8879X=rx92:tx92 +lane_to_serdes_map_fabric_lane93.BCM8879X=rx93:tx93 +lane_to_serdes_map_fabric_lane94.BCM8879X=rx94:tx94 +lane_to_serdes_map_fabric_lane95.BCM8879X=rx95:tx95 + +lane_to_serdes_map_fabric_lane96.BCM8879X=rx96:tx96 +lane_to_serdes_map_fabric_lane97.BCM8879X=rx97:tx97 +lane_to_serdes_map_fabric_lane98.BCM8879X=rx98:tx98 +lane_to_serdes_map_fabric_lane99.BCM8879X=rx99:tx99 + +lane_to_serdes_map_fabric_lane100.BCM8879X=rx100:tx100 +lane_to_serdes_map_fabric_lane101.BCM8879X=rx101:tx101 +lane_to_serdes_map_fabric_lane102.BCM8879X=rx102:tx102 +lane_to_serdes_map_fabric_lane103.BCM8879X=rx103:tx103 + +lane_to_serdes_map_fabric_lane104.BCM8879X=rx104:tx104 +lane_to_serdes_map_fabric_lane105.BCM8879X=rx105:tx105 +lane_to_serdes_map_fabric_lane106.BCM8879X=rx106:tx106 +lane_to_serdes_map_fabric_lane107.BCM8879X=rx107:tx107 + +lane_to_serdes_map_fabric_lane108.BCM8879X=rx108:tx108 +lane_to_serdes_map_fabric_lane109.BCM8879X=rx109:tx109 +lane_to_serdes_map_fabric_lane110.BCM8879X=rx110:tx110 +lane_to_serdes_map_fabric_lane111.BCM8879X=rx111:tx111 + +lane_to_serdes_map_fabric_lane112.BCM8879X=rx112:tx112 +lane_to_serdes_map_fabric_lane113.BCM8879X=rx113:tx113 +lane_to_serdes_map_fabric_lane114.BCM8879X=rx114:tx114 +lane_to_serdes_map_fabric_lane115.BCM8879X=rx115:tx115 + +lane_to_serdes_map_fabric_lane116.BCM8879X=rx116:tx116 +lane_to_serdes_map_fabric_lane117.BCM8879X=rx117:tx117 +lane_to_serdes_map_fabric_lane118.BCM8879X=rx118:tx118 +lane_to_serdes_map_fabric_lane119.BCM8879X=rx119:tx119 + +lane_to_serdes_map_fabric_lane120.BCM8879X=rx120:tx120 +lane_to_serdes_map_fabric_lane121.BCM8879X=rx121:tx121 +lane_to_serdes_map_fabric_lane122.BCM8879X=rx122:tx122 +lane_to_serdes_map_fabric_lane123.BCM8879X=rx123:tx123 + +lane_to_serdes_map_fabric_lane124.BCM8879X=rx124:tx124 +lane_to_serdes_map_fabric_lane125.BCM8879X=rx125:tx125 +lane_to_serdes_map_fabric_lane126.BCM8879X=rx126:tx126 +lane_to_serdes_map_fabric_lane127.BCM8879X=rx127:tx127 + +lane_to_serdes_map_fabric_lane128.BCM8879X=rx128:tx128 +lane_to_serdes_map_fabric_lane129.BCM8879X=rx129:tx129 +lane_to_serdes_map_fabric_lane130.BCM8879X=rx130:tx130 +lane_to_serdes_map_fabric_lane131.BCM8879X=rx131:tx131 + +lane_to_serdes_map_fabric_lane132.BCM8879X=rx132:tx132 +lane_to_serdes_map_fabric_lane133.BCM8879X=rx133:tx133 +lane_to_serdes_map_fabric_lane134.BCM8879X=rx134:tx134 +lane_to_serdes_map_fabric_lane135.BCM8879X=rx135:tx135 + +lane_to_serdes_map_fabric_lane136.BCM8879X=rx136:tx136 +lane_to_serdes_map_fabric_lane137.BCM8879X=rx137:tx137 +lane_to_serdes_map_fabric_lane138.BCM8879X=rx138:tx138 +lane_to_serdes_map_fabric_lane139.BCM8879X=rx139:tx139 + +lane_to_serdes_map_fabric_lane140.BCM8879X=rx140:tx140 +lane_to_serdes_map_fabric_lane141.BCM8879X=rx141:tx141 +lane_to_serdes_map_fabric_lane142.BCM8879X=rx142:tx142 +lane_to_serdes_map_fabric_lane143.BCM8879X=rx143:tx143 + +lane_to_serdes_map_fabric_lane144.BCM8879X=rx144:tx144 +lane_to_serdes_map_fabric_lane145.BCM8879X=rx145:tx145 +lane_to_serdes_map_fabric_lane146.BCM8879X=rx146:tx146 +lane_to_serdes_map_fabric_lane147.BCM8879X=rx147:tx147 + +lane_to_serdes_map_fabric_lane148.BCM8879X=rx148:tx148 +lane_to_serdes_map_fabric_lane149.BCM8879X=rx149:tx149 +lane_to_serdes_map_fabric_lane150.BCM8879X=rx150:tx150 +lane_to_serdes_map_fabric_lane151.BCM8879X=rx151:tx151 + +lane_to_serdes_map_fabric_lane152.BCM8879X=rx152:tx152 +lane_to_serdes_map_fabric_lane153.BCM8879X=rx153:tx153 +lane_to_serdes_map_fabric_lane154.BCM8879X=rx154:tx154 +lane_to_serdes_map_fabric_lane155.BCM8879X=rx155:tx155 + +lane_to_serdes_map_fabric_lane156.BCM8879X=rx156:tx156 +lane_to_serdes_map_fabric_lane157.BCM8879X=rx157:tx157 +lane_to_serdes_map_fabric_lane158.BCM8879X=rx158:tx158 +lane_to_serdes_map_fabric_lane159.BCM8879X=rx159:tx159 + +lane_to_serdes_map_fabric_lane160.BCM8879X=rx160:tx160 +lane_to_serdes_map_fabric_lane161.BCM8879X=rx161:tx161 +lane_to_serdes_map_fabric_lane162.BCM8879X=rx162:tx162 +lane_to_serdes_map_fabric_lane163.BCM8879X=rx163:tx163 + +lane_to_serdes_map_fabric_lane164.BCM8879X=rx164:tx164 +lane_to_serdes_map_fabric_lane165.BCM8879X=rx165:tx165 +lane_to_serdes_map_fabric_lane166.BCM8879X=rx166:tx166 +lane_to_serdes_map_fabric_lane167.BCM8879X=rx167:tx167 + +lane_to_serdes_map_fabric_lane168.BCM8879X=rx168:tx168 +lane_to_serdes_map_fabric_lane169.BCM8879X=rx169:tx169 +lane_to_serdes_map_fabric_lane170.BCM8879X=rx170:tx170 +lane_to_serdes_map_fabric_lane171.BCM8879X=rx171:tx171 + +lane_to_serdes_map_fabric_lane172.BCM8879X=rx172:tx172 +lane_to_serdes_map_fabric_lane173.BCM8879X=rx173:tx173 +lane_to_serdes_map_fabric_lane174.BCM8879X=rx174:tx174 +lane_to_serdes_map_fabric_lane175.BCM8879X=rx175:tx175 + +lane_to_serdes_map_fabric_lane176.BCM8879X=rx176:tx176 +lane_to_serdes_map_fabric_lane177.BCM8879X=rx177:tx177 +lane_to_serdes_map_fabric_lane178.BCM8879X=rx178:tx178 +lane_to_serdes_map_fabric_lane179.BCM8879X=rx179:tx179 + +lane_to_serdes_map_fabric_lane180.BCM8879X=rx180:tx180 +lane_to_serdes_map_fabric_lane181.BCM8879X=rx181:tx181 +lane_to_serdes_map_fabric_lane182.BCM8879X=rx182:tx182 +lane_to_serdes_map_fabric_lane183.BCM8879X=rx183:tx183 + +lane_to_serdes_map_fabric_lane184.BCM8879X=rx184:tx184 +lane_to_serdes_map_fabric_lane185.BCM8879X=rx185:tx185 +lane_to_serdes_map_fabric_lane186.BCM8879X=rx186:tx186 +lane_to_serdes_map_fabric_lane187.BCM8879X=rx187:tx187 + +lane_to_serdes_map_fabric_lane188.BCM8879X=rx188:tx188 +lane_to_serdes_map_fabric_lane189.BCM8879X=rx189:tx189 +lane_to_serdes_map_fabric_lane190.BCM8879X=rx190:tx190 +lane_to_serdes_map_fabric_lane191.BCM8879X=rx191:tx191 + + +phy_rx_polarity_flip_fabric0.BCM8879X=1 +phy_rx_polarity_flip_fabric1.BCM8879X=0 +phy_rx_polarity_flip_fabric2.BCM8879X=1 +phy_rx_polarity_flip_fabric3.BCM8879X=0 + +phy_rx_polarity_flip_fabric4.BCM8879X=1 +phy_rx_polarity_flip_fabric5.BCM8879X=0 +phy_rx_polarity_flip_fabric6.BCM8879X=1 +phy_rx_polarity_flip_fabric7.BCM8879X=0 + +phy_rx_polarity_flip_fabric8.BCM8879X=0 +phy_rx_polarity_flip_fabric9.BCM8879X=1 +phy_rx_polarity_flip_fabric10.BCM8879X=0 +phy_rx_polarity_flip_fabric11.BCM8879X=1 + +phy_rx_polarity_flip_fabric12.BCM8879X=1 +phy_rx_polarity_flip_fabric13.BCM8879X=0 +phy_rx_polarity_flip_fabric14.BCM8879X=1 +phy_rx_polarity_flip_fabric15.BCM8879X=0 + +phy_rx_polarity_flip_fabric16.BCM8879X=1 +phy_rx_polarity_flip_fabric17.BCM8879X=0 +phy_rx_polarity_flip_fabric18.BCM8879X=1 +phy_rx_polarity_flip_fabric19.BCM8879X=0 + +phy_rx_polarity_flip_fabric20.BCM8879X=0 +phy_rx_polarity_flip_fabric21.BCM8879X=1 +phy_rx_polarity_flip_fabric22.BCM8879X=0 +phy_rx_polarity_flip_fabric23.BCM8879X=1 + +phy_rx_polarity_flip_fabric24.BCM8879X=1 +phy_rx_polarity_flip_fabric25.BCM8879X=0 +phy_rx_polarity_flip_fabric26.BCM8879X=1 +phy_rx_polarity_flip_fabric27.BCM8879X=0 + +phy_rx_polarity_flip_fabric28.BCM8879X=1 +phy_rx_polarity_flip_fabric29.BCM8879X=0 +phy_rx_polarity_flip_fabric30.BCM8879X=1 +phy_rx_polarity_flip_fabric31.BCM8879X=0 + +phy_rx_polarity_flip_fabric32.BCM8879X=0 +phy_rx_polarity_flip_fabric33.BCM8879X=1 +phy_rx_polarity_flip_fabric34.BCM8879X=0 +phy_rx_polarity_flip_fabric35.BCM8879X=1 + +phy_rx_polarity_flip_fabric36.BCM8879X=1 +phy_rx_polarity_flip_fabric37.BCM8879X=0 +phy_rx_polarity_flip_fabric38.BCM8879X=1 +phy_rx_polarity_flip_fabric39.BCM8879X=0 + +phy_rx_polarity_flip_fabric40.BCM8879X=0 +phy_rx_polarity_flip_fabric41.BCM8879X=1 +phy_rx_polarity_flip_fabric42.BCM8879X=0 +phy_rx_polarity_flip_fabric43.BCM8879X=1 + +phy_rx_polarity_flip_fabric44.BCM8879X=1 +phy_rx_polarity_flip_fabric45.BCM8879X=0 +phy_rx_polarity_flip_fabric46.BCM8879X=1 +phy_rx_polarity_flip_fabric47.BCM8879X=0 + +phy_rx_polarity_flip_fabric48.BCM8879X=1 +phy_rx_polarity_flip_fabric49.BCM8879X=0 +phy_rx_polarity_flip_fabric50.BCM8879X=1 +phy_rx_polarity_flip_fabric51.BCM8879X=0 + +phy_rx_polarity_flip_fabric52.BCM8879X=0 +phy_rx_polarity_flip_fabric53.BCM8879X=1 +phy_rx_polarity_flip_fabric54.BCM8879X=0 +phy_rx_polarity_flip_fabric55.BCM8879X=1 + +phy_rx_polarity_flip_fabric56.BCM8879X=0 +phy_rx_polarity_flip_fabric57.BCM8879X=1 +phy_rx_polarity_flip_fabric58.BCM8879X=0 +phy_rx_polarity_flip_fabric59.BCM8879X=1 + +phy_rx_polarity_flip_fabric60.BCM8879X=0 +phy_rx_polarity_flip_fabric61.BCM8879X=1 +phy_rx_polarity_flip_fabric62.BCM8879X=0 +phy_rx_polarity_flip_fabric63.BCM8879X=1 + +phy_rx_polarity_flip_fabric64.BCM8879X=0 +phy_rx_polarity_flip_fabric65.BCM8879X=1 +phy_rx_polarity_flip_fabric66.BCM8879X=0 +phy_rx_polarity_flip_fabric67.BCM8879X=1 + +phy_rx_polarity_flip_fabric68.BCM8879X=1 +phy_rx_polarity_flip_fabric69.BCM8879X=0 +phy_rx_polarity_flip_fabric70.BCM8879X=1 +phy_rx_polarity_flip_fabric71.BCM8879X=0 + +phy_rx_polarity_flip_fabric72.BCM8879X=1 +phy_rx_polarity_flip_fabric73.BCM8879X=0 +phy_rx_polarity_flip_fabric74.BCM8879X=1 +phy_rx_polarity_flip_fabric75.BCM8879X=0 + +phy_rx_polarity_flip_fabric76.BCM8879X=0 +phy_rx_polarity_flip_fabric77.BCM8879X=1 +phy_rx_polarity_flip_fabric78.BCM8879X=0 +phy_rx_polarity_flip_fabric79.BCM8879X=1 + +phy_rx_polarity_flip_fabric80.BCM8879X=1 +phy_rx_polarity_flip_fabric81.BCM8879X=0 +phy_rx_polarity_flip_fabric82.BCM8879X=1 +phy_rx_polarity_flip_fabric83.BCM8879X=0 + +phy_rx_polarity_flip_fabric84.BCM8879X=0 +phy_rx_polarity_flip_fabric85.BCM8879X=1 +phy_rx_polarity_flip_fabric86.BCM8879X=0 +phy_rx_polarity_flip_fabric87.BCM8879X=1 + +phy_rx_polarity_flip_fabric88.BCM8879X=1 +phy_rx_polarity_flip_fabric89.BCM8879X=0 +phy_rx_polarity_flip_fabric90.BCM8879X=1 +phy_rx_polarity_flip_fabric91.BCM8879X=0 + +phy_rx_polarity_flip_fabric92.BCM8879X=1 +phy_rx_polarity_flip_fabric93.BCM8879X=0 +phy_rx_polarity_flip_fabric94.BCM8879X=1 +phy_rx_polarity_flip_fabric95.BCM8879X=0 + +phy_rx_polarity_flip_fabric96.BCM8879X=0 +phy_rx_polarity_flip_fabric97.BCM8879X=1 +phy_rx_polarity_flip_fabric98.BCM8879X=0 +phy_rx_polarity_flip_fabric99.BCM8879X=1 + +phy_rx_polarity_flip_fabric100.BCM8879X=1 +phy_rx_polarity_flip_fabric101.BCM8879X=0 +phy_rx_polarity_flip_fabric102.BCM8879X=1 +phy_rx_polarity_flip_fabric103.BCM8879X=0 + +phy_rx_polarity_flip_fabric104.BCM8879X=0 +phy_rx_polarity_flip_fabric105.BCM8879X=1 +phy_rx_polarity_flip_fabric106.BCM8879X=0 +phy_rx_polarity_flip_fabric107.BCM8879X=1 + +phy_rx_polarity_flip_fabric108.BCM8879X=0 +phy_rx_polarity_flip_fabric109.BCM8879X=1 +phy_rx_polarity_flip_fabric110.BCM8879X=0 +phy_rx_polarity_flip_fabric111.BCM8879X=1 + +phy_rx_polarity_flip_fabric112.BCM8879X=1 +phy_rx_polarity_flip_fabric113.BCM8879X=0 +phy_rx_polarity_flip_fabric114.BCM8879X=1 +phy_rx_polarity_flip_fabric115.BCM8879X=0 + +phy_rx_polarity_flip_fabric116.BCM8879X=0 +phy_rx_polarity_flip_fabric117.BCM8879X=1 +phy_rx_polarity_flip_fabric118.BCM8879X=0 +phy_rx_polarity_flip_fabric119.BCM8879X=1 + +phy_rx_polarity_flip_fabric120.BCM8879X=1 +phy_rx_polarity_flip_fabric121.BCM8879X=0 +phy_rx_polarity_flip_fabric122.BCM8879X=1 +phy_rx_polarity_flip_fabric123.BCM8879X=0 + +phy_rx_polarity_flip_fabric124.BCM8879X=1 +phy_rx_polarity_flip_fabric125.BCM8879X=0 +phy_rx_polarity_flip_fabric126.BCM8879X=1 +phy_rx_polarity_flip_fabric127.BCM8879X=0 + +phy_rx_polarity_flip_fabric128.BCM8879X=0 +phy_rx_polarity_flip_fabric129.BCM8879X=1 +phy_rx_polarity_flip_fabric130.BCM8879X=0 +phy_rx_polarity_flip_fabric131.BCM8879X=1 + +phy_rx_polarity_flip_fabric132.BCM8879X=1 +phy_rx_polarity_flip_fabric133.BCM8879X=0 +phy_rx_polarity_flip_fabric134.BCM8879X=1 +phy_rx_polarity_flip_fabric135.BCM8879X=0 + +phy_rx_polarity_flip_fabric136.BCM8879X=0 +phy_rx_polarity_flip_fabric137.BCM8879X=1 +phy_rx_polarity_flip_fabric138.BCM8879X=0 +phy_rx_polarity_flip_fabric139.BCM8879X=1 + +phy_rx_polarity_flip_fabric140.BCM8879X=1 +phy_rx_polarity_flip_fabric141.BCM8879X=0 +phy_rx_polarity_flip_fabric142.BCM8879X=1 +phy_rx_polarity_flip_fabric143.BCM8879X=0 + +phy_rx_polarity_flip_fabric144.BCM8879X=1 +phy_rx_polarity_flip_fabric145.BCM8879X=0 +phy_rx_polarity_flip_fabric146.BCM8879X=1 +phy_rx_polarity_flip_fabric147.BCM8879X=0 + +phy_rx_polarity_flip_fabric148.BCM8879X=0 +phy_rx_polarity_flip_fabric149.BCM8879X=1 +phy_rx_polarity_flip_fabric150.BCM8879X=0 +phy_rx_polarity_flip_fabric151.BCM8879X=1 + +phy_rx_polarity_flip_fabric152.BCM8879X=1 +phy_rx_polarity_flip_fabric153.BCM8879X=0 +phy_rx_polarity_flip_fabric154.BCM8879X=1 +phy_rx_polarity_flip_fabric155.BCM8879X=0 + +phy_rx_polarity_flip_fabric156.BCM8879X=0 +phy_rx_polarity_flip_fabric157.BCM8879X=1 +phy_rx_polarity_flip_fabric158.BCM8879X=0 +phy_rx_polarity_flip_fabric159.BCM8879X=1 + +phy_rx_polarity_flip_fabric160.BCM8879X=1 +phy_rx_polarity_flip_fabric161.BCM8879X=0 +phy_rx_polarity_flip_fabric162.BCM8879X=1 +phy_rx_polarity_flip_fabric163.BCM8879X=0 + +phy_rx_polarity_flip_fabric164.BCM8879X=1 +phy_rx_polarity_flip_fabric165.BCM8879X=0 +phy_rx_polarity_flip_fabric166.BCM8879X=1 +phy_rx_polarity_flip_fabric167.BCM8879X=0 + +phy_rx_polarity_flip_fabric168.BCM8879X=1 +phy_rx_polarity_flip_fabric169.BCM8879X=0 +phy_rx_polarity_flip_fabric170.BCM8879X=1 +phy_rx_polarity_flip_fabric171.BCM8879X=0 + +phy_rx_polarity_flip_fabric172.BCM8879X=0 +phy_rx_polarity_flip_fabric173.BCM8879X=1 +phy_rx_polarity_flip_fabric174.BCM8879X=0 +phy_rx_polarity_flip_fabric175.BCM8879X=1 + +phy_rx_polarity_flip_fabric176.BCM8879X=1 +phy_rx_polarity_flip_fabric177.BCM8879X=0 +phy_rx_polarity_flip_fabric178.BCM8879X=1 +phy_rx_polarity_flip_fabric179.BCM8879X=0 + +phy_rx_polarity_flip_fabric180.BCM8879X=0 +phy_rx_polarity_flip_fabric181.BCM8879X=1 +phy_rx_polarity_flip_fabric182.BCM8879X=0 +phy_rx_polarity_flip_fabric183.BCM8879X=1 + +phy_rx_polarity_flip_fabric184.BCM8879X=1 +phy_rx_polarity_flip_fabric185.BCM8879X=0 +phy_rx_polarity_flip_fabric186.BCM8879X=1 +phy_rx_polarity_flip_fabric187.BCM8879X=0 + +phy_rx_polarity_flip_fabric188.BCM8879X=1 +phy_rx_polarity_flip_fabric189.BCM8879X=0 +phy_rx_polarity_flip_fabric190.BCM8879X=1 +phy_rx_polarity_flip_fabric191.BCM8879X=0 + + +phy_tx_polarity_flip_fabric0.BCM8879X=0 +phy_tx_polarity_flip_fabric1.BCM8879X=1 +phy_tx_polarity_flip_fabric2.BCM8879X=0 +phy_tx_polarity_flip_fabric3.BCM8879X=1 + +phy_tx_polarity_flip_fabric4.BCM8879X=0 +phy_tx_polarity_flip_fabric5.BCM8879X=1 +phy_tx_polarity_flip_fabric6.BCM8879X=0 +phy_tx_polarity_flip_fabric7.BCM8879X=1 + +phy_tx_polarity_flip_fabric8.BCM8879X=1 +phy_tx_polarity_flip_fabric9.BCM8879X=0 +phy_tx_polarity_flip_fabric10.BCM8879X=1 +phy_tx_polarity_flip_fabric11.BCM8879X=0 + +phy_tx_polarity_flip_fabric12.BCM8879X=0 +phy_tx_polarity_flip_fabric13.BCM8879X=1 +phy_tx_polarity_flip_fabric14.BCM8879X=0 +phy_tx_polarity_flip_fabric15.BCM8879X=1 + +phy_tx_polarity_flip_fabric16.BCM8879X=0 +phy_tx_polarity_flip_fabric17.BCM8879X=1 +phy_tx_polarity_flip_fabric18.BCM8879X=0 +phy_tx_polarity_flip_fabric19.BCM8879X=1 + +phy_tx_polarity_flip_fabric20.BCM8879X=1 +phy_tx_polarity_flip_fabric21.BCM8879X=0 +phy_tx_polarity_flip_fabric22.BCM8879X=1 +phy_tx_polarity_flip_fabric23.BCM8879X=0 + +phy_tx_polarity_flip_fabric24.BCM8879X=0 +phy_tx_polarity_flip_fabric25.BCM8879X=1 +phy_tx_polarity_flip_fabric26.BCM8879X=0 +phy_tx_polarity_flip_fabric27.BCM8879X=1 + +phy_tx_polarity_flip_fabric28.BCM8879X=0 +phy_tx_polarity_flip_fabric29.BCM8879X=1 +phy_tx_polarity_flip_fabric30.BCM8879X=0 +phy_tx_polarity_flip_fabric31.BCM8879X=1 + +phy_tx_polarity_flip_fabric32.BCM8879X=1 +phy_tx_polarity_flip_fabric33.BCM8879X=0 +phy_tx_polarity_flip_fabric34.BCM8879X=1 +phy_tx_polarity_flip_fabric35.BCM8879X=0 + +phy_tx_polarity_flip_fabric36.BCM8879X=0 +phy_tx_polarity_flip_fabric37.BCM8879X=1 +phy_tx_polarity_flip_fabric38.BCM8879X=0 +phy_tx_polarity_flip_fabric39.BCM8879X=1 + +phy_tx_polarity_flip_fabric40.BCM8879X=1 +phy_tx_polarity_flip_fabric41.BCM8879X=0 +phy_tx_polarity_flip_fabric42.BCM8879X=1 +phy_tx_polarity_flip_fabric43.BCM8879X=0 + +phy_tx_polarity_flip_fabric44.BCM8879X=0 +phy_tx_polarity_flip_fabric45.BCM8879X=1 +phy_tx_polarity_flip_fabric46.BCM8879X=0 +phy_tx_polarity_flip_fabric47.BCM8879X=1 + +phy_tx_polarity_flip_fabric48.BCM8879X=0 +phy_tx_polarity_flip_fabric49.BCM8879X=1 +phy_tx_polarity_flip_fabric50.BCM8879X=0 +phy_tx_polarity_flip_fabric51.BCM8879X=1 + +phy_tx_polarity_flip_fabric52.BCM8879X=1 +phy_tx_polarity_flip_fabric53.BCM8879X=0 +phy_tx_polarity_flip_fabric54.BCM8879X=1 +phy_tx_polarity_flip_fabric55.BCM8879X=0 + +phy_tx_polarity_flip_fabric56.BCM8879X=1 +phy_tx_polarity_flip_fabric57.BCM8879X=0 +phy_tx_polarity_flip_fabric58.BCM8879X=1 +phy_tx_polarity_flip_fabric59.BCM8879X=0 + +phy_tx_polarity_flip_fabric60.BCM8879X=1 +phy_tx_polarity_flip_fabric61.BCM8879X=0 +phy_tx_polarity_flip_fabric62.BCM8879X=1 +phy_tx_polarity_flip_fabric63.BCM8879X=0 + +phy_tx_polarity_flip_fabric64.BCM8879X=1 +phy_tx_polarity_flip_fabric65.BCM8879X=0 +phy_tx_polarity_flip_fabric66.BCM8879X=1 +phy_tx_polarity_flip_fabric67.BCM8879X=0 + +phy_tx_polarity_flip_fabric68.BCM8879X=0 +phy_tx_polarity_flip_fabric69.BCM8879X=1 +phy_tx_polarity_flip_fabric70.BCM8879X=0 +phy_tx_polarity_flip_fabric71.BCM8879X=1 + +phy_tx_polarity_flip_fabric72.BCM8879X=0 +phy_tx_polarity_flip_fabric73.BCM8879X=1 +phy_tx_polarity_flip_fabric74.BCM8879X=0 +phy_tx_polarity_flip_fabric75.BCM8879X=1 + +phy_tx_polarity_flip_fabric76.BCM8879X=1 +phy_tx_polarity_flip_fabric77.BCM8879X=0 +phy_tx_polarity_flip_fabric78.BCM8879X=1 +phy_tx_polarity_flip_fabric79.BCM8879X=0 + +phy_tx_polarity_flip_fabric80.BCM8879X=0 +phy_tx_polarity_flip_fabric81.BCM8879X=1 +phy_tx_polarity_flip_fabric82.BCM8879X=0 +phy_tx_polarity_flip_fabric83.BCM8879X=1 + +phy_tx_polarity_flip_fabric84.BCM8879X=1 +phy_tx_polarity_flip_fabric85.BCM8879X=0 +phy_tx_polarity_flip_fabric86.BCM8879X=1 +phy_tx_polarity_flip_fabric87.BCM8879X=0 + +phy_tx_polarity_flip_fabric88.BCM8879X=0 +phy_tx_polarity_flip_fabric89.BCM8879X=1 +phy_tx_polarity_flip_fabric90.BCM8879X=0 +phy_tx_polarity_flip_fabric91.BCM8879X=1 + +phy_tx_polarity_flip_fabric92.BCM8879X=0 +phy_tx_polarity_flip_fabric93.BCM8879X=1 +phy_tx_polarity_flip_fabric94.BCM8879X=0 +phy_tx_polarity_flip_fabric95.BCM8879X=1 + +phy_tx_polarity_flip_fabric96.BCM8879X=1 +phy_tx_polarity_flip_fabric97.BCM8879X=0 +phy_tx_polarity_flip_fabric98.BCM8879X=1 +phy_tx_polarity_flip_fabric99.BCM8879X=0 + +phy_tx_polarity_flip_fabric100.BCM8879X=0 +phy_tx_polarity_flip_fabric101.BCM8879X=1 +phy_tx_polarity_flip_fabric102.BCM8879X=0 +phy_tx_polarity_flip_fabric103.BCM8879X=1 + +phy_tx_polarity_flip_fabric104.BCM8879X=1 +phy_tx_polarity_flip_fabric105.BCM8879X=0 +phy_tx_polarity_flip_fabric106.BCM8879X=1 +phy_tx_polarity_flip_fabric107.BCM8879X=0 + +phy_tx_polarity_flip_fabric108.BCM8879X=1 +phy_tx_polarity_flip_fabric109.BCM8879X=0 +phy_tx_polarity_flip_fabric110.BCM8879X=1 +phy_tx_polarity_flip_fabric111.BCM8879X=0 + +phy_tx_polarity_flip_fabric112.BCM8879X=0 +phy_tx_polarity_flip_fabric113.BCM8879X=1 +phy_tx_polarity_flip_fabric114.BCM8879X=0 +phy_tx_polarity_flip_fabric115.BCM8879X=1 + +phy_tx_polarity_flip_fabric116.BCM8879X=1 +phy_tx_polarity_flip_fabric117.BCM8879X=0 +phy_tx_polarity_flip_fabric118.BCM8879X=1 +phy_tx_polarity_flip_fabric119.BCM8879X=0 + +phy_tx_polarity_flip_fabric120.BCM8879X=0 +phy_tx_polarity_flip_fabric121.BCM8879X=1 +phy_tx_polarity_flip_fabric122.BCM8879X=0 +phy_tx_polarity_flip_fabric123.BCM8879X=1 + +phy_tx_polarity_flip_fabric124.BCM8879X=0 +phy_tx_polarity_flip_fabric125.BCM8879X=1 +phy_tx_polarity_flip_fabric126.BCM8879X=0 +phy_tx_polarity_flip_fabric127.BCM8879X=1 + +phy_tx_polarity_flip_fabric128.BCM8879X=1 +phy_tx_polarity_flip_fabric129.BCM8879X=0 +phy_tx_polarity_flip_fabric130.BCM8879X=1 +phy_tx_polarity_flip_fabric131.BCM8879X=0 + +phy_tx_polarity_flip_fabric132.BCM8879X=0 +phy_tx_polarity_flip_fabric133.BCM8879X=1 +phy_tx_polarity_flip_fabric134.BCM8879X=0 +phy_tx_polarity_flip_fabric135.BCM8879X=1 + +phy_tx_polarity_flip_fabric136.BCM8879X=1 +phy_tx_polarity_flip_fabric137.BCM8879X=0 +phy_tx_polarity_flip_fabric138.BCM8879X=1 +phy_tx_polarity_flip_fabric139.BCM8879X=0 + +phy_tx_polarity_flip_fabric140.BCM8879X=0 +phy_tx_polarity_flip_fabric141.BCM8879X=1 +phy_tx_polarity_flip_fabric142.BCM8879X=0 +phy_tx_polarity_flip_fabric143.BCM8879X=1 + +phy_tx_polarity_flip_fabric144.BCM8879X=0 +phy_tx_polarity_flip_fabric145.BCM8879X=1 +phy_tx_polarity_flip_fabric146.BCM8879X=0 +phy_tx_polarity_flip_fabric147.BCM8879X=1 + +phy_tx_polarity_flip_fabric148.BCM8879X=1 +phy_tx_polarity_flip_fabric149.BCM8879X=0 +phy_tx_polarity_flip_fabric150.BCM8879X=1 +phy_tx_polarity_flip_fabric151.BCM8879X=0 + +phy_tx_polarity_flip_fabric152.BCM8879X=0 +phy_tx_polarity_flip_fabric153.BCM8879X=1 +phy_tx_polarity_flip_fabric154.BCM8879X=0 +phy_tx_polarity_flip_fabric155.BCM8879X=1 + +phy_tx_polarity_flip_fabric156.BCM8879X=1 +phy_tx_polarity_flip_fabric157.BCM8879X=0 +phy_tx_polarity_flip_fabric158.BCM8879X=1 +phy_tx_polarity_flip_fabric159.BCM8879X=0 + +phy_tx_polarity_flip_fabric160.BCM8879X=0 +phy_tx_polarity_flip_fabric161.BCM8879X=1 +phy_tx_polarity_flip_fabric162.BCM8879X=0 +phy_tx_polarity_flip_fabric163.BCM8879X=1 + +phy_tx_polarity_flip_fabric164.BCM8879X=0 +phy_tx_polarity_flip_fabric165.BCM8879X=1 +phy_tx_polarity_flip_fabric166.BCM8879X=0 +phy_tx_polarity_flip_fabric167.BCM8879X=1 + +phy_tx_polarity_flip_fabric168.BCM8879X=0 +phy_tx_polarity_flip_fabric169.BCM8879X=1 +phy_tx_polarity_flip_fabric170.BCM8879X=0 +phy_tx_polarity_flip_fabric171.BCM8879X=1 + +phy_tx_polarity_flip_fabric172.BCM8879X=1 +phy_tx_polarity_flip_fabric173.BCM8879X=0 +phy_tx_polarity_flip_fabric174.BCM8879X=1 +phy_tx_polarity_flip_fabric175.BCM8879X=0 + +phy_tx_polarity_flip_fabric176.BCM8879X=0 +phy_tx_polarity_flip_fabric177.BCM8879X=1 +phy_tx_polarity_flip_fabric178.BCM8879X=0 +phy_tx_polarity_flip_fabric179.BCM8879X=1 + +phy_tx_polarity_flip_fabric180.BCM8879X=1 +phy_tx_polarity_flip_fabric181.BCM8879X=0 +phy_tx_polarity_flip_fabric182.BCM8879X=1 +phy_tx_polarity_flip_fabric183.BCM8879X=0 + +phy_tx_polarity_flip_fabric184.BCM8879X=0 +phy_tx_polarity_flip_fabric185.BCM8879X=1 +phy_tx_polarity_flip_fabric186.BCM8879X=0 +phy_tx_polarity_flip_fabric187.BCM8879X=1 + +phy_tx_polarity_flip_fabric188.BCM8879X=0 +phy_tx_polarity_flip_fabric189.BCM8879X=1 +phy_tx_polarity_flip_fabric190.BCM8879X=0 +phy_tx_polarity_flip_fabric191.BCM8879X=1 + +port_init_cl72_0=0 +port_init_cl72_1=0 +port_init_cl72_2=0 +port_init_cl72_3=0 +port_init_cl72_4=0 +port_init_cl72_5=0 +port_init_cl72_6=0 +port_init_cl72_7=0 +port_init_cl72_8=0 +port_init_cl72_9=0 +port_init_cl72_10=0 +port_init_cl72_11=0 +port_init_cl72_12=0 +port_init_cl72_13=0 +port_init_cl72_14=0 +port_init_cl72_15=0 +port_init_cl72_16=0 +port_init_cl72_17=0 +port_init_cl72_18=0 +port_init_cl72_19=0 +port_init_cl72_20=0 +port_init_cl72_21=0 +port_init_cl72_22=0 +port_init_cl72_23=0 +port_init_cl72_24=0 +port_init_cl72_25=0 +port_init_cl72_26=0 +port_init_cl72_27=0 +port_init_cl72_28=0 +port_init_cl72_29=0 +port_init_cl72_30=0 +port_init_cl72_31=0 +port_init_cl72_32=0 +port_init_cl72_33=0 +port_init_cl72_34=0 +port_init_cl72_35=0 +port_init_cl72_36=0 +port_init_cl72_37=0 +port_init_cl72_38=0 +port_init_cl72_39=0 +port_init_cl72_40=0 +port_init_cl72_41=0 +port_init_cl72_42=0 +port_init_cl72_43=0 +port_init_cl72_44=0 +port_init_cl72_45=0 +port_init_cl72_46=0 +port_init_cl72_47=0 +port_init_cl72_48=0 +port_init_cl72_49=0 +port_init_cl72_50=0 +port_init_cl72_51=0 +port_init_cl72_52=0 +port_init_cl72_53=0 +port_init_cl72_54=0 +port_init_cl72_55=0 +port_init_cl72_56=0 +port_init_cl72_57=0 +port_init_cl72_58=0 +port_init_cl72_59=0 +port_init_cl72_60=0 +port_init_cl72_61=0 +port_init_cl72_62=0 +port_init_cl72_63=0 +port_init_cl72_64=0 +port_init_cl72_65=0 +port_init_cl72_66=0 +port_init_cl72_67=0 +port_init_cl72_68=0 +port_init_cl72_69=0 +port_init_cl72_70=0 +port_init_cl72_71=0 +port_init_cl72_72=0 +port_init_cl72_73=0 +port_init_cl72_74=0 +port_init_cl72_75=0 +port_init_cl72_76=0 +port_init_cl72_77=0 +port_init_cl72_78=0 +port_init_cl72_79=0 +port_init_cl72_80=0 +port_init_cl72_81=0 +port_init_cl72_82=0 +port_init_cl72_83=0 +port_init_cl72_84=0 +port_init_cl72_85=0 +port_init_cl72_86=0 +port_init_cl72_87=0 +port_init_cl72_88=0 +port_init_cl72_89=0 +port_init_cl72_90=0 +port_init_cl72_91=0 +port_init_cl72_92=0 +port_init_cl72_93=0 +port_init_cl72_94=0 +port_init_cl72_95=0 +port_init_cl72_96=0 +port_init_cl72_97=0 +port_init_cl72_98=0 +port_init_cl72_99=0 +port_init_cl72_100=0 +port_init_cl72_101=0 +port_init_cl72_102=0 +port_init_cl72_103=0 +port_init_cl72_104=0 +port_init_cl72_105=0 +port_init_cl72_106=0 +port_init_cl72_107=0 +port_init_cl72_108=0 +port_init_cl72_109=0 +port_init_cl72_110=0 +port_init_cl72_111=0 +port_init_cl72_112=0 +port_init_cl72_113=0 +port_init_cl72_114=0 +port_init_cl72_115=0 +port_init_cl72_116=0 +port_init_cl72_117=0 +port_init_cl72_118=0 +port_init_cl72_119=0 +port_init_cl72_120=0 +port_init_cl72_121=0 +port_init_cl72_122=0 +port_init_cl72_123=0 +port_init_cl72_124=0 +port_init_cl72_125=0 +port_init_cl72_126=0 +port_init_cl72_127=0 +port_init_cl72_128=0 +port_init_cl72_129=0 +port_init_cl72_130=0 +port_init_cl72_131=0 +port_init_cl72_132=0 +port_init_cl72_133=0 +port_init_cl72_134=0 +port_init_cl72_135=0 +port_init_cl72_136=0 +port_init_cl72_137=0 +port_init_cl72_138=0 +port_init_cl72_139=0 +port_init_cl72_140=0 +port_init_cl72_141=0 +port_init_cl72_142=0 +port_init_cl72_143=0 +port_init_cl72_144=0 +port_init_cl72_145=0 +port_init_cl72_146=0 +port_init_cl72_147=0 +port_init_cl72_148=0 +port_init_cl72_149=0 +port_init_cl72_150=0 +port_init_cl72_151=0 +port_init_cl72_152=0 +port_init_cl72_153=0 +port_init_cl72_154=0 +port_init_cl72_155=0 +port_init_cl72_156=0 +port_init_cl72_157=0 +port_init_cl72_158=0 +port_init_cl72_159=0 +port_init_cl72_160=0 +port_init_cl72_161=0 +port_init_cl72_162=0 +port_init_cl72_163=0 +port_init_cl72_164=0 +port_init_cl72_165=0 +port_init_cl72_166=0 +port_init_cl72_167=0 +port_init_cl72_168=0 +port_init_cl72_169=0 +port_init_cl72_170=0 +port_init_cl72_171=0 +port_init_cl72_172=0 +port_init_cl72_173=0 +port_init_cl72_174=0 +port_init_cl72_175=0 +port_init_cl72_176=0 +port_init_cl72_177=0 +port_init_cl72_178=0 +port_init_cl72_179=0 +port_init_cl72_180=0 +port_init_cl72_181=0 +port_init_cl72_182=0 +port_init_cl72_183=0 +port_init_cl72_184=0 +port_init_cl72_185=0 +port_init_cl72_186=0 +port_init_cl72_187=0 +port_init_cl72_188=0 +port_init_cl72_189=0 +port_init_cl72_190=0 +port_init_cl72_191=0 + +serdes_tx_taps_0.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_1.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_2.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_3.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_4.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_5.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_6.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_7.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_8.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_9.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_10.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_11.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_12.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_13.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_14.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_15.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_16.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_17.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_18.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_19.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_20.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_21.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_22.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_23.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_24.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_25.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_26.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_27.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_28.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_29.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_30.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_31.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_32.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_33.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_34.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_35.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_36.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_37.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_38.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_39.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_40.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_41.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_42.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_43.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_44.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_45.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_46.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_47.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_48.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_49.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_50.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_51.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_52.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_53.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_54.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_55.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_56.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_57.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_58.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_59.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_60.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_61.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_62.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_63.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_64.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_65.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_66.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_67.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_68.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_69.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_70.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_71.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_72.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_73.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_74.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_75.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_76.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_77.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_78.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_79.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_80.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_81.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_82.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_83.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_84.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_85.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_86.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_87.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_88.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_89.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_90.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_91.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_92.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_93.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_94.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_95.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_96.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_97.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_98.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_99.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_100.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_101.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_102.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_103.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_104.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_105.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_106.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_107.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_108.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_109.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_110.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_111.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_112.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_113.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_114.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_115.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_116.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_117.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_118.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_119.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_120.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_121.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_122.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_123.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_124.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_125.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_126.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_127.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_128.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_129.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_130.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_131.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_132.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_133.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_134.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_135.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_136.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_137.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_138.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_139.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_140.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_141.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_142.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_143.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_144.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_145.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_146.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_147.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_148.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_149.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_150.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_151.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_152.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_153.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_154.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_155.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_156.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_157.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_158.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_159.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_160.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_161.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_162.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_163.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_164.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_165.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_166.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_167.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_168.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_169.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_170.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_171.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_172.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_173.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_174.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_175.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_176.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_177.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_178.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_179.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_180.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_181.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_182.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_183.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_184.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_185.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_186.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_187.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_188.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_189.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_190.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_191.BCM8879X=pam4:-24:132:-12:0:0:0 + +serdes_lane_config_channel_mode_0.0=force_nr +serdes_lane_config_channel_mode_1.0=force_nr +serdes_lane_config_channel_mode_2.0=force_nr +serdes_lane_config_channel_mode_3.0=force_nr +serdes_lane_config_channel_mode_4.0=force_nr +serdes_lane_config_channel_mode_5.0=force_nr +serdes_lane_config_channel_mode_6.0=force_nr +serdes_lane_config_channel_mode_7.0=force_nr +serdes_lane_config_channel_mode_8.0=force_nr +serdes_lane_config_channel_mode_9.0=force_nr +serdes_lane_config_channel_mode_10.0=force_nr +serdes_lane_config_channel_mode_11.0=force_nr +serdes_lane_config_channel_mode_12.0=force_nr +serdes_lane_config_channel_mode_13.0=force_nr +serdes_lane_config_channel_mode_14.0=force_nr +serdes_lane_config_channel_mode_15.0=force_nr +serdes_lane_config_channel_mode_16.0=force_nr +serdes_lane_config_channel_mode_17.0=force_nr +serdes_lane_config_channel_mode_18.0=force_nr +serdes_lane_config_channel_mode_19.0=force_nr +serdes_lane_config_channel_mode_20.0=force_nr +serdes_lane_config_channel_mode_21.0=force_nr +serdes_lane_config_channel_mode_22.0=force_nr +serdes_lane_config_channel_mode_23.0=force_nr +serdes_lane_config_channel_mode_24.0=force_nr +serdes_lane_config_channel_mode_25.0=force_nr +serdes_lane_config_channel_mode_26.0=force_nr +serdes_lane_config_channel_mode_27.0=force_nr +serdes_lane_config_channel_mode_28.0=force_nr +serdes_lane_config_channel_mode_29.0=force_nr +serdes_lane_config_channel_mode_30.0=force_nr +serdes_lane_config_channel_mode_31.0=force_nr +serdes_lane_config_channel_mode_32.0=force_nr +serdes_lane_config_channel_mode_33.0=force_nr +serdes_lane_config_channel_mode_34.0=force_nr +serdes_lane_config_channel_mode_35.0=force_nr +serdes_lane_config_channel_mode_36.0=force_nr +serdes_lane_config_channel_mode_37.0=force_nr +serdes_lane_config_channel_mode_38.0=force_nr +serdes_lane_config_channel_mode_39.0=force_nr +serdes_lane_config_channel_mode_40.0=force_nr +serdes_lane_config_channel_mode_41.0=force_nr +serdes_lane_config_channel_mode_42.0=force_nr +serdes_lane_config_channel_mode_43.0=force_nr +serdes_lane_config_channel_mode_44.0=force_nr +serdes_lane_config_channel_mode_45.0=force_nr +serdes_lane_config_channel_mode_46.0=force_nr +serdes_lane_config_channel_mode_47.0=force_nr +serdes_lane_config_channel_mode_48.0=force_nr +serdes_lane_config_channel_mode_49.0=force_nr +serdes_lane_config_channel_mode_50.0=force_nr +serdes_lane_config_channel_mode_51.0=force_nr +serdes_lane_config_channel_mode_52.0=force_nr +serdes_lane_config_channel_mode_53.0=force_nr +serdes_lane_config_channel_mode_54.0=force_nr +serdes_lane_config_channel_mode_55.0=force_nr +serdes_lane_config_channel_mode_56.0=force_nr +serdes_lane_config_channel_mode_57.0=force_nr +serdes_lane_config_channel_mode_58.0=force_nr +serdes_lane_config_channel_mode_59.0=force_nr +serdes_lane_config_channel_mode_60.0=force_nr +serdes_lane_config_channel_mode_61.0=force_nr +serdes_lane_config_channel_mode_62.0=force_nr +serdes_lane_config_channel_mode_63.0=force_nr +serdes_lane_config_channel_mode_64.0=force_nr +serdes_lane_config_channel_mode_65.0=force_nr +serdes_lane_config_channel_mode_66.0=force_nr +serdes_lane_config_channel_mode_67.0=force_nr +serdes_lane_config_channel_mode_68.0=force_nr +serdes_lane_config_channel_mode_69.0=force_nr +serdes_lane_config_channel_mode_70.0=force_nr +serdes_lane_config_channel_mode_71.0=force_nr +serdes_lane_config_channel_mode_72.0=force_nr +serdes_lane_config_channel_mode_73.0=force_nr +serdes_lane_config_channel_mode_74.0=force_nr +serdes_lane_config_channel_mode_75.0=force_nr +serdes_lane_config_channel_mode_76.0=force_nr +serdes_lane_config_channel_mode_77.0=force_nr +serdes_lane_config_channel_mode_78.0=force_nr +serdes_lane_config_channel_mode_79.0=force_nr +serdes_lane_config_channel_mode_80.0=force_nr +serdes_lane_config_channel_mode_81.0=force_nr +serdes_lane_config_channel_mode_82.0=force_nr +serdes_lane_config_channel_mode_83.0=force_nr +serdes_lane_config_channel_mode_84.0=force_nr +serdes_lane_config_channel_mode_85.0=force_nr +serdes_lane_config_channel_mode_86.0=force_nr +serdes_lane_config_channel_mode_87.0=force_nr +serdes_lane_config_channel_mode_88.0=force_nr +serdes_lane_config_channel_mode_89.0=force_nr +serdes_lane_config_channel_mode_90.0=force_nr +serdes_lane_config_channel_mode_91.0=force_nr +serdes_lane_config_channel_mode_92.0=force_nr +serdes_lane_config_channel_mode_93.0=force_nr +serdes_lane_config_channel_mode_94.0=force_nr +serdes_lane_config_channel_mode_95.0=force_nr +serdes_lane_config_channel_mode_96.0=force_nr +serdes_lane_config_channel_mode_97.0=force_nr +serdes_lane_config_channel_mode_98.0=force_nr +serdes_lane_config_channel_mode_99.0=force_nr +serdes_lane_config_channel_mode_100.0=force_nr +serdes_lane_config_channel_mode_101.0=force_nr +serdes_lane_config_channel_mode_102.0=force_nr +serdes_lane_config_channel_mode_103.0=force_nr +serdes_lane_config_channel_mode_104.0=force_nr +serdes_lane_config_channel_mode_105.0=force_nr +serdes_lane_config_channel_mode_106.0=force_nr +serdes_lane_config_channel_mode_107.0=force_nr +serdes_lane_config_channel_mode_108.0=force_nr +serdes_lane_config_channel_mode_109.0=force_nr +serdes_lane_config_channel_mode_110.0=force_nr +serdes_lane_config_channel_mode_111.0=force_nr +serdes_lane_config_channel_mode_112.0=force_nr +serdes_lane_config_channel_mode_113.0=force_nr +serdes_lane_config_channel_mode_114.0=force_nr +serdes_lane_config_channel_mode_115.0=force_nr +serdes_lane_config_channel_mode_116.0=force_nr +serdes_lane_config_channel_mode_117.0=force_nr +serdes_lane_config_channel_mode_118.0=force_nr +serdes_lane_config_channel_mode_119.0=force_nr +serdes_lane_config_channel_mode_120.0=force_nr +serdes_lane_config_channel_mode_121.0=force_nr +serdes_lane_config_channel_mode_122.0=force_nr +serdes_lane_config_channel_mode_123.0=force_nr +serdes_lane_config_channel_mode_124.0=force_nr +serdes_lane_config_channel_mode_125.0=force_nr +serdes_lane_config_channel_mode_126.0=force_nr +serdes_lane_config_channel_mode_127.0=force_nr +serdes_lane_config_channel_mode_128.0=force_nr +serdes_lane_config_channel_mode_129.0=force_nr +serdes_lane_config_channel_mode_130.0=force_nr +serdes_lane_config_channel_mode_131.0=force_nr +serdes_lane_config_channel_mode_132.0=force_nr +serdes_lane_config_channel_mode_133.0=force_nr +serdes_lane_config_channel_mode_134.0=force_nr +serdes_lane_config_channel_mode_135.0=force_nr +serdes_lane_config_channel_mode_136.0=force_nr +serdes_lane_config_channel_mode_137.0=force_nr +serdes_lane_config_channel_mode_138.0=force_nr +serdes_lane_config_channel_mode_139.0=force_nr +serdes_lane_config_channel_mode_140.0=force_nr +serdes_lane_config_channel_mode_141.0=force_nr +serdes_lane_config_channel_mode_142.0=force_nr +serdes_lane_config_channel_mode_143.0=force_nr +serdes_lane_config_channel_mode_144.0=force_nr +serdes_lane_config_channel_mode_145.0=force_nr +serdes_lane_config_channel_mode_146.0=force_nr +serdes_lane_config_channel_mode_147.0=force_nr +serdes_lane_config_channel_mode_148.0=force_nr +serdes_lane_config_channel_mode_149.0=force_nr +serdes_lane_config_channel_mode_150.0=force_nr +serdes_lane_config_channel_mode_151.0=force_nr +serdes_lane_config_channel_mode_152.0=force_nr +serdes_lane_config_channel_mode_153.0=force_nr +serdes_lane_config_channel_mode_154.0=force_nr +serdes_lane_config_channel_mode_155.0=force_nr +serdes_lane_config_channel_mode_156.0=force_nr +serdes_lane_config_channel_mode_157.0=force_nr +serdes_lane_config_channel_mode_158.0=force_nr +serdes_lane_config_channel_mode_159.0=force_nr +serdes_lane_config_channel_mode_160.0=force_nr +serdes_lane_config_channel_mode_161.0=force_nr +serdes_lane_config_channel_mode_162.0=force_nr +serdes_lane_config_channel_mode_163.0=force_nr +serdes_lane_config_channel_mode_164.0=force_nr +serdes_lane_config_channel_mode_165.0=force_nr +serdes_lane_config_channel_mode_166.0=force_nr +serdes_lane_config_channel_mode_167.0=force_nr +serdes_lane_config_channel_mode_168.0=force_nr +serdes_lane_config_channel_mode_169.0=force_nr +serdes_lane_config_channel_mode_170.0=force_nr +serdes_lane_config_channel_mode_171.0=force_nr +serdes_lane_config_channel_mode_172.0=force_nr +serdes_lane_config_channel_mode_173.0=force_nr +serdes_lane_config_channel_mode_174.0=force_nr +serdes_lane_config_channel_mode_175.0=force_nr +serdes_lane_config_channel_mode_176.0=force_nr +serdes_lane_config_channel_mode_177.0=force_nr +serdes_lane_config_channel_mode_178.0=force_nr +serdes_lane_config_channel_mode_179.0=force_nr +serdes_lane_config_channel_mode_180.0=force_nr +serdes_lane_config_channel_mode_181.0=force_nr +serdes_lane_config_channel_mode_182.0=force_nr +serdes_lane_config_channel_mode_183.0=force_nr +serdes_lane_config_channel_mode_184.0=force_nr +serdes_lane_config_channel_mode_185.0=force_nr +serdes_lane_config_channel_mode_186.0=force_nr +serdes_lane_config_channel_mode_187.0=force_nr +serdes_lane_config_channel_mode_188.0=force_nr +serdes_lane_config_channel_mode_189.0=force_nr +serdes_lane_config_channel_mode_190.0=force_nr +serdes_lane_config_channel_mode_191.0=force_nr + + +serdes_qrtt_active_0.0=1 +serdes_qrtt_active_1.0=1 +serdes_qrtt_active_2.0=1 +serdes_qrtt_active_3.0=1 +serdes_qrtt_active_4.0=1 +serdes_qrtt_active_5.0=1 +serdes_qrtt_active_6.0=1 +serdes_qrtt_active_7.0=1 +serdes_qrtt_active_8.0=1 +serdes_qrtt_active_9.0=1 +serdes_qrtt_active_10.0=1 +serdes_qrtt_active_11.0=1 +serdes_qrtt_active_12.0=1 +serdes_qrtt_active_13.0=1 +serdes_qrtt_active_14.0=1 +serdes_qrtt_active_15.0=1 +serdes_qrtt_active_16.0=1 +serdes_qrtt_active_17.0=1 +serdes_qrtt_active_18.0=1 +serdes_qrtt_active_19.0=1 +serdes_qrtt_active_20.0=1 +serdes_qrtt_active_21.0=1 +serdes_qrtt_active_22.0=1 +serdes_qrtt_active_23.0=1 +serdes_qrtt_active_24.0=1 +serdes_qrtt_active_25.0=1 +serdes_qrtt_active_26.0=1 +serdes_qrtt_active_27.0=1 +serdes_qrtt_active_28.0=1 +serdes_qrtt_active_29.0=1 +serdes_qrtt_active_30.0=1 +serdes_qrtt_active_31.0=1 +serdes_qrtt_active_32.0=1 +serdes_qrtt_active_33.0=1 +serdes_qrtt_active_34.0=1 +serdes_qrtt_active_35.0=1 +serdes_qrtt_active_36.0=1 +serdes_qrtt_active_37.0=1 +serdes_qrtt_active_38.0=1 +serdes_qrtt_active_39.0=1 +serdes_qrtt_active_40.0=1 +serdes_qrtt_active_41.0=1 +serdes_qrtt_active_42.0=1 +serdes_qrtt_active_43.0=1 +serdes_qrtt_active_44.0=1 +serdes_qrtt_active_45.0=1 +serdes_qrtt_active_46.0=1 +serdes_qrtt_active_47.0=1 diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/12/config-ramon-7-0.bcm b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/12/config-ramon-7-0.bcm new file mode 100644 index 000000000000..8f7297b7716a --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/12/config-ramon-7-0.bcm @@ -0,0 +1,1394 @@ + +appl_enable_intr_init.BCM8879X=0 +appl_param_module_id.BCM8879X=13 +bcm_linkscan_interval.BCM8879X=0 +bcm_stat_interval.BCM8879X=4000000 +bist_enable.BCM8879X=0 +core_clock_speed_khz.BCM8879X=1000000 +custom_feature_access_only.BCM8879X=0 +custom_feature_lane_swap_disable.BCM8879X=0 +dport_map_direct.BCM8879X=1 +fabric_cell_fifo_dma_enable.BCM8879X=0 +fabric_device_mode.BCM8879X=SINGLE_STAGE_FE2 +fabric_load_balancing_mode.BCM8879X=NORMAL_LOAD_BALANCE +fabric_multicast_mode.BCM8879X=DIRECT +fabric_num_pipes.BCM8879X=1 +fabric_pipe_map.BCM8879X=0 +fe_mc_id_range.BCM8879X=128K +load_firmware.BCM8879X=0x102 +mdio_output_delay_ext.BCM8879X=14 +mdio_output_delay_int.BCM8879X=25 +mem_cache_enable_parity.BCM8879X=1 +mm_intr_enable.BCM8879X=0 +mm_timeout_usec.BCM8879X=300000 +polled_irq_delay.BCM8879X=100000 +polled_irq_mode.BCM8879X=1 +port_fec.BCM8879X=7 +port_init_cl72.BCM8879X=0 +port_init_speed.BCM8879X=53125 +rate_ext_mdio_divisor.BCM8879X=14 +rate_int_mdio_divisor.BCM8879X=50 +schan_intr_enable.BCM8879X=0 +schan_timeout_usec.BCM8879X=300000 +serdes_fabric_clk_freq_in.BCM8879X=1 +serdes_fabric_clk_freq_out.BCM8879X=bypass +soc_family.BCM8879X=BCM8879X +srd_tx_drv_hv_disable.BCM8879X=0 +system_contains_multiple_pipe_device.BCM8879X=0 +system_ref_core_clock_khz.BCM8879X=1200000 +table_dma_enable.BCM8879X=0 +tdma_intr_enable.BCM8879X=0 +tdma_timeout_usec.BCM8879X=5000000 +tslam_dma_enable.BCM8879X=0 +tslam_intr_enable.BCM8879X=0 +tslam_timeout_usec.BCM8879X=5000000 + +lane_to_serdes_map_fabric_lane0.BCM8879X=rx0:tx0 +lane_to_serdes_map_fabric_lane1.BCM8879X=rx1:tx1 +lane_to_serdes_map_fabric_lane2.BCM8879X=rx2:tx2 +lane_to_serdes_map_fabric_lane3.BCM8879X=rx3:tx3 + +lane_to_serdes_map_fabric_lane4.BCM8879X=rx4:tx4 +lane_to_serdes_map_fabric_lane5.BCM8879X=rx5:tx5 +lane_to_serdes_map_fabric_lane6.BCM8879X=rx6:tx6 +lane_to_serdes_map_fabric_lane7.BCM8879X=rx7:tx7 + +lane_to_serdes_map_fabric_lane8.BCM8879X=rx8:tx8 +lane_to_serdes_map_fabric_lane9.BCM8879X=rx9:tx9 +lane_to_serdes_map_fabric_lane10.BCM8879X=rx10:tx10 +lane_to_serdes_map_fabric_lane11.BCM8879X=rx11:tx11 + +lane_to_serdes_map_fabric_lane12.BCM8879X=rx12:tx12 +lane_to_serdes_map_fabric_lane13.BCM8879X=rx13:tx13 +lane_to_serdes_map_fabric_lane14.BCM8879X=rx14:tx14 +lane_to_serdes_map_fabric_lane15.BCM8879X=rx15:tx15 + +lane_to_serdes_map_fabric_lane16.BCM8879X=rx16:tx16 +lane_to_serdes_map_fabric_lane17.BCM8879X=rx17:tx17 +lane_to_serdes_map_fabric_lane18.BCM8879X=rx18:tx18 +lane_to_serdes_map_fabric_lane19.BCM8879X=rx19:tx19 + +lane_to_serdes_map_fabric_lane20.BCM8879X=rx20:tx20 +lane_to_serdes_map_fabric_lane21.BCM8879X=rx21:tx21 +lane_to_serdes_map_fabric_lane22.BCM8879X=rx22:tx22 +lane_to_serdes_map_fabric_lane23.BCM8879X=rx23:tx23 + +lane_to_serdes_map_fabric_lane24.BCM8879X=rx24:tx24 +lane_to_serdes_map_fabric_lane25.BCM8879X=rx25:tx25 +lane_to_serdes_map_fabric_lane26.BCM8879X=rx26:tx26 +lane_to_serdes_map_fabric_lane27.BCM8879X=rx27:tx27 + +lane_to_serdes_map_fabric_lane28.BCM8879X=rx28:tx28 +lane_to_serdes_map_fabric_lane29.BCM8879X=rx29:tx29 +lane_to_serdes_map_fabric_lane30.BCM8879X=rx30:tx30 +lane_to_serdes_map_fabric_lane31.BCM8879X=rx31:tx31 + +lane_to_serdes_map_fabric_lane32.BCM8879X=rx32:tx32 +lane_to_serdes_map_fabric_lane33.BCM8879X=rx33:tx33 +lane_to_serdes_map_fabric_lane34.BCM8879X=rx34:tx34 +lane_to_serdes_map_fabric_lane35.BCM8879X=rx35:tx35 + +lane_to_serdes_map_fabric_lane36.BCM8879X=rx36:tx36 +lane_to_serdes_map_fabric_lane37.BCM8879X=rx37:tx37 +lane_to_serdes_map_fabric_lane38.BCM8879X=rx38:tx38 +lane_to_serdes_map_fabric_lane39.BCM8879X=rx39:tx39 + +lane_to_serdes_map_fabric_lane40.BCM8879X=rx40:tx40 +lane_to_serdes_map_fabric_lane41.BCM8879X=rx41:tx41 +lane_to_serdes_map_fabric_lane42.BCM8879X=rx42:tx42 +lane_to_serdes_map_fabric_lane43.BCM8879X=rx43:tx43 + +lane_to_serdes_map_fabric_lane44.BCM8879X=rx44:tx44 +lane_to_serdes_map_fabric_lane45.BCM8879X=rx45:tx45 +lane_to_serdes_map_fabric_lane46.BCM8879X=rx46:tx46 +lane_to_serdes_map_fabric_lane47.BCM8879X=rx47:tx47 + +lane_to_serdes_map_fabric_lane48.BCM8879X=rx48:tx48 +lane_to_serdes_map_fabric_lane49.BCM8879X=rx49:tx49 +lane_to_serdes_map_fabric_lane50.BCM8879X=rx50:tx50 +lane_to_serdes_map_fabric_lane51.BCM8879X=rx51:tx51 + +lane_to_serdes_map_fabric_lane52.BCM8879X=rx52:tx52 +lane_to_serdes_map_fabric_lane53.BCM8879X=rx53:tx53 +lane_to_serdes_map_fabric_lane54.BCM8879X=rx54:tx54 +lane_to_serdes_map_fabric_lane55.BCM8879X=rx55:tx55 + +lane_to_serdes_map_fabric_lane56.BCM8879X=rx56:tx56 +lane_to_serdes_map_fabric_lane57.BCM8879X=rx57:tx57 +lane_to_serdes_map_fabric_lane58.BCM8879X=rx58:tx58 +lane_to_serdes_map_fabric_lane59.BCM8879X=rx59:tx59 + +lane_to_serdes_map_fabric_lane60.BCM8879X=rx60:tx60 +lane_to_serdes_map_fabric_lane61.BCM8879X=rx61:tx61 +lane_to_serdes_map_fabric_lane62.BCM8879X=rx62:tx62 +lane_to_serdes_map_fabric_lane63.BCM8879X=rx63:tx63 + +lane_to_serdes_map_fabric_lane64.BCM8879X=rx64:tx64 +lane_to_serdes_map_fabric_lane65.BCM8879X=rx65:tx65 +lane_to_serdes_map_fabric_lane66.BCM8879X=rx66:tx66 +lane_to_serdes_map_fabric_lane67.BCM8879X=rx67:tx67 + +lane_to_serdes_map_fabric_lane68.BCM8879X=rx68:tx68 +lane_to_serdes_map_fabric_lane69.BCM8879X=rx69:tx69 +lane_to_serdes_map_fabric_lane70.BCM8879X=rx70:tx70 +lane_to_serdes_map_fabric_lane71.BCM8879X=rx71:tx71 + +lane_to_serdes_map_fabric_lane72.BCM8879X=rx72:tx72 +lane_to_serdes_map_fabric_lane73.BCM8879X=rx73:tx73 +lane_to_serdes_map_fabric_lane74.BCM8879X=rx74:tx74 +lane_to_serdes_map_fabric_lane75.BCM8879X=rx75:tx75 + +lane_to_serdes_map_fabric_lane76.BCM8879X=rx76:tx76 +lane_to_serdes_map_fabric_lane77.BCM8879X=rx77:tx77 +lane_to_serdes_map_fabric_lane78.BCM8879X=rx78:tx78 +lane_to_serdes_map_fabric_lane79.BCM8879X=rx79:tx79 + +lane_to_serdes_map_fabric_lane80.BCM8879X=rx80:tx80 +lane_to_serdes_map_fabric_lane81.BCM8879X=rx81:tx81 +lane_to_serdes_map_fabric_lane82.BCM8879X=rx82:tx82 +lane_to_serdes_map_fabric_lane83.BCM8879X=rx83:tx83 + +lane_to_serdes_map_fabric_lane84.BCM8879X=rx84:tx84 +lane_to_serdes_map_fabric_lane85.BCM8879X=rx85:tx85 +lane_to_serdes_map_fabric_lane86.BCM8879X=rx86:tx86 +lane_to_serdes_map_fabric_lane87.BCM8879X=rx87:tx87 + +lane_to_serdes_map_fabric_lane88.BCM8879X=rx88:tx88 +lane_to_serdes_map_fabric_lane89.BCM8879X=rx89:tx89 +lane_to_serdes_map_fabric_lane90.BCM8879X=rx90:tx90 +lane_to_serdes_map_fabric_lane91.BCM8879X=rx91:tx91 + +lane_to_serdes_map_fabric_lane92.BCM8879X=rx92:tx92 +lane_to_serdes_map_fabric_lane93.BCM8879X=rx93:tx93 +lane_to_serdes_map_fabric_lane94.BCM8879X=rx94:tx94 +lane_to_serdes_map_fabric_lane95.BCM8879X=rx95:tx95 + +lane_to_serdes_map_fabric_lane96.BCM8879X=rx96:tx96 +lane_to_serdes_map_fabric_lane97.BCM8879X=rx97:tx97 +lane_to_serdes_map_fabric_lane98.BCM8879X=rx98:tx98 +lane_to_serdes_map_fabric_lane99.BCM8879X=rx99:tx99 + +lane_to_serdes_map_fabric_lane100.BCM8879X=rx100:tx100 +lane_to_serdes_map_fabric_lane101.BCM8879X=rx101:tx101 +lane_to_serdes_map_fabric_lane102.BCM8879X=rx102:tx102 +lane_to_serdes_map_fabric_lane103.BCM8879X=rx103:tx103 + +lane_to_serdes_map_fabric_lane104.BCM8879X=rx104:tx104 +lane_to_serdes_map_fabric_lane105.BCM8879X=rx105:tx105 +lane_to_serdes_map_fabric_lane106.BCM8879X=rx106:tx106 +lane_to_serdes_map_fabric_lane107.BCM8879X=rx107:tx107 + +lane_to_serdes_map_fabric_lane108.BCM8879X=rx108:tx108 +lane_to_serdes_map_fabric_lane109.BCM8879X=rx109:tx109 +lane_to_serdes_map_fabric_lane110.BCM8879X=rx110:tx110 +lane_to_serdes_map_fabric_lane111.BCM8879X=rx111:tx111 + +lane_to_serdes_map_fabric_lane112.BCM8879X=rx112:tx112 +lane_to_serdes_map_fabric_lane113.BCM8879X=rx113:tx113 +lane_to_serdes_map_fabric_lane114.BCM8879X=rx114:tx114 +lane_to_serdes_map_fabric_lane115.BCM8879X=rx115:tx115 + +lane_to_serdes_map_fabric_lane116.BCM8879X=rx116:tx116 +lane_to_serdes_map_fabric_lane117.BCM8879X=rx117:tx117 +lane_to_serdes_map_fabric_lane118.BCM8879X=rx118:tx118 +lane_to_serdes_map_fabric_lane119.BCM8879X=rx119:tx119 + +lane_to_serdes_map_fabric_lane120.BCM8879X=rx120:tx120 +lane_to_serdes_map_fabric_lane121.BCM8879X=rx121:tx121 +lane_to_serdes_map_fabric_lane122.BCM8879X=rx122:tx122 +lane_to_serdes_map_fabric_lane123.BCM8879X=rx123:tx123 + +lane_to_serdes_map_fabric_lane124.BCM8879X=rx124:tx124 +lane_to_serdes_map_fabric_lane125.BCM8879X=rx125:tx125 +lane_to_serdes_map_fabric_lane126.BCM8879X=rx126:tx126 +lane_to_serdes_map_fabric_lane127.BCM8879X=rx127:tx127 + +lane_to_serdes_map_fabric_lane128.BCM8879X=rx128:tx128 +lane_to_serdes_map_fabric_lane129.BCM8879X=rx129:tx129 +lane_to_serdes_map_fabric_lane130.BCM8879X=rx130:tx130 +lane_to_serdes_map_fabric_lane131.BCM8879X=rx131:tx131 + +lane_to_serdes_map_fabric_lane132.BCM8879X=rx132:tx132 +lane_to_serdes_map_fabric_lane133.BCM8879X=rx133:tx133 +lane_to_serdes_map_fabric_lane134.BCM8879X=rx134:tx134 +lane_to_serdes_map_fabric_lane135.BCM8879X=rx135:tx135 + +lane_to_serdes_map_fabric_lane136.BCM8879X=rx136:tx136 +lane_to_serdes_map_fabric_lane137.BCM8879X=rx137:tx137 +lane_to_serdes_map_fabric_lane138.BCM8879X=rx138:tx138 +lane_to_serdes_map_fabric_lane139.BCM8879X=rx139:tx139 + +lane_to_serdes_map_fabric_lane140.BCM8879X=rx140:tx140 +lane_to_serdes_map_fabric_lane141.BCM8879X=rx141:tx141 +lane_to_serdes_map_fabric_lane142.BCM8879X=rx142:tx142 +lane_to_serdes_map_fabric_lane143.BCM8879X=rx143:tx143 + +lane_to_serdes_map_fabric_lane144.BCM8879X=rx144:tx144 +lane_to_serdes_map_fabric_lane145.BCM8879X=rx145:tx145 +lane_to_serdes_map_fabric_lane146.BCM8879X=rx146:tx146 +lane_to_serdes_map_fabric_lane147.BCM8879X=rx147:tx147 + +lane_to_serdes_map_fabric_lane148.BCM8879X=rx148:tx148 +lane_to_serdes_map_fabric_lane149.BCM8879X=rx149:tx149 +lane_to_serdes_map_fabric_lane150.BCM8879X=rx150:tx150 +lane_to_serdes_map_fabric_lane151.BCM8879X=rx151:tx151 + +lane_to_serdes_map_fabric_lane152.BCM8879X=rx152:tx152 +lane_to_serdes_map_fabric_lane153.BCM8879X=rx153:tx153 +lane_to_serdes_map_fabric_lane154.BCM8879X=rx154:tx154 +lane_to_serdes_map_fabric_lane155.BCM8879X=rx155:tx155 + +lane_to_serdes_map_fabric_lane156.BCM8879X=rx156:tx156 +lane_to_serdes_map_fabric_lane157.BCM8879X=rx157:tx157 +lane_to_serdes_map_fabric_lane158.BCM8879X=rx158:tx158 +lane_to_serdes_map_fabric_lane159.BCM8879X=rx159:tx159 + +lane_to_serdes_map_fabric_lane160.BCM8879X=rx160:tx160 +lane_to_serdes_map_fabric_lane161.BCM8879X=rx161:tx161 +lane_to_serdes_map_fabric_lane162.BCM8879X=rx162:tx162 +lane_to_serdes_map_fabric_lane163.BCM8879X=rx163:tx163 + +lane_to_serdes_map_fabric_lane164.BCM8879X=rx164:tx164 +lane_to_serdes_map_fabric_lane165.BCM8879X=rx165:tx165 +lane_to_serdes_map_fabric_lane166.BCM8879X=rx166:tx166 +lane_to_serdes_map_fabric_lane167.BCM8879X=rx167:tx167 + +lane_to_serdes_map_fabric_lane168.BCM8879X=rx168:tx168 +lane_to_serdes_map_fabric_lane169.BCM8879X=rx169:tx169 +lane_to_serdes_map_fabric_lane170.BCM8879X=rx170:tx170 +lane_to_serdes_map_fabric_lane171.BCM8879X=rx171:tx171 + +lane_to_serdes_map_fabric_lane172.BCM8879X=rx172:tx172 +lane_to_serdes_map_fabric_lane173.BCM8879X=rx173:tx173 +lane_to_serdes_map_fabric_lane174.BCM8879X=rx174:tx174 +lane_to_serdes_map_fabric_lane175.BCM8879X=rx175:tx175 + +lane_to_serdes_map_fabric_lane176.BCM8879X=rx176:tx176 +lane_to_serdes_map_fabric_lane177.BCM8879X=rx177:tx177 +lane_to_serdes_map_fabric_lane178.BCM8879X=rx178:tx178 +lane_to_serdes_map_fabric_lane179.BCM8879X=rx179:tx179 + +lane_to_serdes_map_fabric_lane180.BCM8879X=rx180:tx180 +lane_to_serdes_map_fabric_lane181.BCM8879X=rx181:tx181 +lane_to_serdes_map_fabric_lane182.BCM8879X=rx182:tx182 +lane_to_serdes_map_fabric_lane183.BCM8879X=rx183:tx183 + +lane_to_serdes_map_fabric_lane184.BCM8879X=rx184:tx184 +lane_to_serdes_map_fabric_lane185.BCM8879X=rx185:tx185 +lane_to_serdes_map_fabric_lane186.BCM8879X=rx186:tx186 +lane_to_serdes_map_fabric_lane187.BCM8879X=rx187:tx187 + +lane_to_serdes_map_fabric_lane188.BCM8879X=rx188:tx188 +lane_to_serdes_map_fabric_lane189.BCM8879X=rx189:tx189 +lane_to_serdes_map_fabric_lane190.BCM8879X=rx190:tx190 +lane_to_serdes_map_fabric_lane191.BCM8879X=rx191:tx191 + + +phy_rx_polarity_flip_fabric0.BCM8879X=1 +phy_rx_polarity_flip_fabric1.BCM8879X=0 +phy_rx_polarity_flip_fabric2.BCM8879X=1 +phy_rx_polarity_flip_fabric3.BCM8879X=0 + +phy_rx_polarity_flip_fabric4.BCM8879X=0 +phy_rx_polarity_flip_fabric5.BCM8879X=1 +phy_rx_polarity_flip_fabric6.BCM8879X=0 +phy_rx_polarity_flip_fabric7.BCM8879X=1 + +phy_rx_polarity_flip_fabric8.BCM8879X=1 +phy_rx_polarity_flip_fabric9.BCM8879X=0 +phy_rx_polarity_flip_fabric10.BCM8879X=1 +phy_rx_polarity_flip_fabric11.BCM8879X=0 + +phy_rx_polarity_flip_fabric12.BCM8879X=0 +phy_rx_polarity_flip_fabric13.BCM8879X=1 +phy_rx_polarity_flip_fabric14.BCM8879X=0 +phy_rx_polarity_flip_fabric15.BCM8879X=1 + +phy_rx_polarity_flip_fabric16.BCM8879X=1 +phy_rx_polarity_flip_fabric17.BCM8879X=0 +phy_rx_polarity_flip_fabric18.BCM8879X=1 +phy_rx_polarity_flip_fabric19.BCM8879X=0 + +phy_rx_polarity_flip_fabric20.BCM8879X=1 +phy_rx_polarity_flip_fabric21.BCM8879X=0 +phy_rx_polarity_flip_fabric22.BCM8879X=1 +phy_rx_polarity_flip_fabric23.BCM8879X=0 + +phy_rx_polarity_flip_fabric24.BCM8879X=1 +phy_rx_polarity_flip_fabric25.BCM8879X=0 +phy_rx_polarity_flip_fabric26.BCM8879X=1 +phy_rx_polarity_flip_fabric27.BCM8879X=0 + +phy_rx_polarity_flip_fabric28.BCM8879X=0 +phy_rx_polarity_flip_fabric29.BCM8879X=1 +phy_rx_polarity_flip_fabric30.BCM8879X=0 +phy_rx_polarity_flip_fabric31.BCM8879X=1 + +phy_rx_polarity_flip_fabric32.BCM8879X=1 +phy_rx_polarity_flip_fabric33.BCM8879X=0 +phy_rx_polarity_flip_fabric34.BCM8879X=1 +phy_rx_polarity_flip_fabric35.BCM8879X=0 + +phy_rx_polarity_flip_fabric36.BCM8879X=0 +phy_rx_polarity_flip_fabric37.BCM8879X=1 +phy_rx_polarity_flip_fabric38.BCM8879X=0 +phy_rx_polarity_flip_fabric39.BCM8879X=1 + +phy_rx_polarity_flip_fabric40.BCM8879X=1 +phy_rx_polarity_flip_fabric41.BCM8879X=0 +phy_rx_polarity_flip_fabric42.BCM8879X=1 +phy_rx_polarity_flip_fabric43.BCM8879X=0 + +phy_rx_polarity_flip_fabric44.BCM8879X=1 +phy_rx_polarity_flip_fabric45.BCM8879X=0 +phy_rx_polarity_flip_fabric46.BCM8879X=1 +phy_rx_polarity_flip_fabric47.BCM8879X=0 + +phy_rx_polarity_flip_fabric48.BCM8879X=0 +phy_rx_polarity_flip_fabric49.BCM8879X=1 +phy_rx_polarity_flip_fabric50.BCM8879X=0 +phy_rx_polarity_flip_fabric51.BCM8879X=1 + +phy_rx_polarity_flip_fabric52.BCM8879X=1 +phy_rx_polarity_flip_fabric53.BCM8879X=0 +phy_rx_polarity_flip_fabric54.BCM8879X=1 +phy_rx_polarity_flip_fabric55.BCM8879X=0 + +phy_rx_polarity_flip_fabric56.BCM8879X=0 +phy_rx_polarity_flip_fabric57.BCM8879X=1 +phy_rx_polarity_flip_fabric58.BCM8879X=0 +phy_rx_polarity_flip_fabric59.BCM8879X=1 + +phy_rx_polarity_flip_fabric60.BCM8879X=0 +phy_rx_polarity_flip_fabric61.BCM8879X=1 +phy_rx_polarity_flip_fabric62.BCM8879X=0 +phy_rx_polarity_flip_fabric63.BCM8879X=1 + +phy_rx_polarity_flip_fabric64.BCM8879X=1 +phy_rx_polarity_flip_fabric65.BCM8879X=0 +phy_rx_polarity_flip_fabric66.BCM8879X=1 +phy_rx_polarity_flip_fabric67.BCM8879X=0 + +phy_rx_polarity_flip_fabric68.BCM8879X=0 +phy_rx_polarity_flip_fabric69.BCM8879X=1 +phy_rx_polarity_flip_fabric70.BCM8879X=0 +phy_rx_polarity_flip_fabric71.BCM8879X=1 + +phy_rx_polarity_flip_fabric72.BCM8879X=1 +phy_rx_polarity_flip_fabric73.BCM8879X=0 +phy_rx_polarity_flip_fabric74.BCM8879X=1 +phy_rx_polarity_flip_fabric75.BCM8879X=0 + +phy_rx_polarity_flip_fabric76.BCM8879X=1 +phy_rx_polarity_flip_fabric77.BCM8879X=0 +phy_rx_polarity_flip_fabric78.BCM8879X=1 +phy_rx_polarity_flip_fabric79.BCM8879X=0 + +phy_rx_polarity_flip_fabric80.BCM8879X=0 +phy_rx_polarity_flip_fabric81.BCM8879X=1 +phy_rx_polarity_flip_fabric82.BCM8879X=0 +phy_rx_polarity_flip_fabric83.BCM8879X=1 + +phy_rx_polarity_flip_fabric84.BCM8879X=1 +phy_rx_polarity_flip_fabric85.BCM8879X=0 +phy_rx_polarity_flip_fabric86.BCM8879X=1 +phy_rx_polarity_flip_fabric87.BCM8879X=0 + +phy_rx_polarity_flip_fabric88.BCM8879X=0 +phy_rx_polarity_flip_fabric89.BCM8879X=1 +phy_rx_polarity_flip_fabric90.BCM8879X=0 +phy_rx_polarity_flip_fabric91.BCM8879X=1 + +phy_rx_polarity_flip_fabric92.BCM8879X=1 +phy_rx_polarity_flip_fabric93.BCM8879X=0 +phy_rx_polarity_flip_fabric94.BCM8879X=1 +phy_rx_polarity_flip_fabric95.BCM8879X=0 + +phy_rx_polarity_flip_fabric96.BCM8879X=1 +phy_rx_polarity_flip_fabric97.BCM8879X=0 +phy_rx_polarity_flip_fabric98.BCM8879X=1 +phy_rx_polarity_flip_fabric99.BCM8879X=0 + +phy_rx_polarity_flip_fabric100.BCM8879X=0 +phy_rx_polarity_flip_fabric101.BCM8879X=1 +phy_rx_polarity_flip_fabric102.BCM8879X=0 +phy_rx_polarity_flip_fabric103.BCM8879X=1 + +phy_rx_polarity_flip_fabric104.BCM8879X=0 +phy_rx_polarity_flip_fabric105.BCM8879X=1 +phy_rx_polarity_flip_fabric106.BCM8879X=0 +phy_rx_polarity_flip_fabric107.BCM8879X=1 + +phy_rx_polarity_flip_fabric108.BCM8879X=0 +phy_rx_polarity_flip_fabric109.BCM8879X=1 +phy_rx_polarity_flip_fabric110.BCM8879X=0 +phy_rx_polarity_flip_fabric111.BCM8879X=1 + +phy_rx_polarity_flip_fabric112.BCM8879X=0 +phy_rx_polarity_flip_fabric113.BCM8879X=1 +phy_rx_polarity_flip_fabric114.BCM8879X=0 +phy_rx_polarity_flip_fabric115.BCM8879X=1 + +phy_rx_polarity_flip_fabric116.BCM8879X=1 +phy_rx_polarity_flip_fabric117.BCM8879X=0 +phy_rx_polarity_flip_fabric118.BCM8879X=1 +phy_rx_polarity_flip_fabric119.BCM8879X=0 + +phy_rx_polarity_flip_fabric120.BCM8879X=1 +phy_rx_polarity_flip_fabric121.BCM8879X=0 +phy_rx_polarity_flip_fabric122.BCM8879X=1 +phy_rx_polarity_flip_fabric123.BCM8879X=0 + +phy_rx_polarity_flip_fabric124.BCM8879X=0 +phy_rx_polarity_flip_fabric125.BCM8879X=1 +phy_rx_polarity_flip_fabric126.BCM8879X=0 +phy_rx_polarity_flip_fabric127.BCM8879X=1 + +phy_rx_polarity_flip_fabric128.BCM8879X=1 +phy_rx_polarity_flip_fabric129.BCM8879X=0 +phy_rx_polarity_flip_fabric130.BCM8879X=1 +phy_rx_polarity_flip_fabric131.BCM8879X=0 + +phy_rx_polarity_flip_fabric132.BCM8879X=0 +phy_rx_polarity_flip_fabric133.BCM8879X=1 +phy_rx_polarity_flip_fabric134.BCM8879X=0 +phy_rx_polarity_flip_fabric135.BCM8879X=1 + +phy_rx_polarity_flip_fabric136.BCM8879X=1 +phy_rx_polarity_flip_fabric137.BCM8879X=0 +phy_rx_polarity_flip_fabric138.BCM8879X=1 +phy_rx_polarity_flip_fabric139.BCM8879X=0 + +phy_rx_polarity_flip_fabric140.BCM8879X=1 +phy_rx_polarity_flip_fabric141.BCM8879X=0 +phy_rx_polarity_flip_fabric142.BCM8879X=1 +phy_rx_polarity_flip_fabric143.BCM8879X=0 + +phy_rx_polarity_flip_fabric144.BCM8879X=1 +phy_rx_polarity_flip_fabric145.BCM8879X=0 +phy_rx_polarity_flip_fabric146.BCM8879X=1 +phy_rx_polarity_flip_fabric147.BCM8879X=0 + +phy_rx_polarity_flip_fabric148.BCM8879X=1 +phy_rx_polarity_flip_fabric149.BCM8879X=0 +phy_rx_polarity_flip_fabric150.BCM8879X=1 +phy_rx_polarity_flip_fabric151.BCM8879X=0 + +phy_rx_polarity_flip_fabric152.BCM8879X=0 +phy_rx_polarity_flip_fabric153.BCM8879X=1 +phy_rx_polarity_flip_fabric154.BCM8879X=0 +phy_rx_polarity_flip_fabric155.BCM8879X=1 + +phy_rx_polarity_flip_fabric156.BCM8879X=1 +phy_rx_polarity_flip_fabric157.BCM8879X=0 +phy_rx_polarity_flip_fabric158.BCM8879X=1 +phy_rx_polarity_flip_fabric159.BCM8879X=0 + +phy_rx_polarity_flip_fabric160.BCM8879X=1 +phy_rx_polarity_flip_fabric161.BCM8879X=0 +phy_rx_polarity_flip_fabric162.BCM8879X=1 +phy_rx_polarity_flip_fabric163.BCM8879X=0 + +phy_rx_polarity_flip_fabric164.BCM8879X=0 +phy_rx_polarity_flip_fabric165.BCM8879X=1 +phy_rx_polarity_flip_fabric166.BCM8879X=0 +phy_rx_polarity_flip_fabric167.BCM8879X=1 + +phy_rx_polarity_flip_fabric168.BCM8879X=1 +phy_rx_polarity_flip_fabric169.BCM8879X=0 +phy_rx_polarity_flip_fabric170.BCM8879X=1 +phy_rx_polarity_flip_fabric171.BCM8879X=0 + +phy_rx_polarity_flip_fabric172.BCM8879X=1 +phy_rx_polarity_flip_fabric173.BCM8879X=0 +phy_rx_polarity_flip_fabric174.BCM8879X=1 +phy_rx_polarity_flip_fabric175.BCM8879X=0 + +phy_rx_polarity_flip_fabric176.BCM8879X=0 +phy_rx_polarity_flip_fabric177.BCM8879X=1 +phy_rx_polarity_flip_fabric178.BCM8879X=0 +phy_rx_polarity_flip_fabric179.BCM8879X=1 + +phy_rx_polarity_flip_fabric180.BCM8879X=1 +phy_rx_polarity_flip_fabric181.BCM8879X=0 +phy_rx_polarity_flip_fabric182.BCM8879X=1 +phy_rx_polarity_flip_fabric183.BCM8879X=0 + +phy_rx_polarity_flip_fabric184.BCM8879X=0 +phy_rx_polarity_flip_fabric185.BCM8879X=1 +phy_rx_polarity_flip_fabric186.BCM8879X=0 +phy_rx_polarity_flip_fabric187.BCM8879X=1 + +phy_rx_polarity_flip_fabric188.BCM8879X=1 +phy_rx_polarity_flip_fabric189.BCM8879X=0 +phy_rx_polarity_flip_fabric190.BCM8879X=1 +phy_rx_polarity_flip_fabric191.BCM8879X=0 + +phy_tx_polarity_flip_fabric0.BCM8879X=0 +phy_tx_polarity_flip_fabric1.BCM8879X=1 +phy_tx_polarity_flip_fabric2.BCM8879X=0 +phy_tx_polarity_flip_fabric3.BCM8879X=1 + +phy_tx_polarity_flip_fabric4.BCM8879X=1 +phy_tx_polarity_flip_fabric5.BCM8879X=0 +phy_tx_polarity_flip_fabric6.BCM8879X=1 +phy_tx_polarity_flip_fabric7.BCM8879X=0 + +phy_tx_polarity_flip_fabric8.BCM8879X=0 +phy_tx_polarity_flip_fabric9.BCM8879X=1 +phy_tx_polarity_flip_fabric10.BCM8879X=0 +phy_tx_polarity_flip_fabric11.BCM8879X=1 + +phy_tx_polarity_flip_fabric12.BCM8879X=1 +phy_tx_polarity_flip_fabric13.BCM8879X=0 +phy_tx_polarity_flip_fabric14.BCM8879X=1 +phy_tx_polarity_flip_fabric15.BCM8879X=0 + +phy_tx_polarity_flip_fabric16.BCM8879X=0 +phy_tx_polarity_flip_fabric17.BCM8879X=1 +phy_tx_polarity_flip_fabric18.BCM8879X=0 +phy_tx_polarity_flip_fabric19.BCM8879X=1 + +phy_tx_polarity_flip_fabric20.BCM8879X=0 +phy_tx_polarity_flip_fabric21.BCM8879X=1 +phy_tx_polarity_flip_fabric22.BCM8879X=0 +phy_tx_polarity_flip_fabric23.BCM8879X=1 + +phy_tx_polarity_flip_fabric24.BCM8879X=0 +phy_tx_polarity_flip_fabric25.BCM8879X=1 +phy_tx_polarity_flip_fabric26.BCM8879X=0 +phy_tx_polarity_flip_fabric27.BCM8879X=1 + +phy_tx_polarity_flip_fabric28.BCM8879X=1 +phy_tx_polarity_flip_fabric29.BCM8879X=0 +phy_tx_polarity_flip_fabric30.BCM8879X=1 +phy_tx_polarity_flip_fabric31.BCM8879X=0 + +phy_tx_polarity_flip_fabric32.BCM8879X=0 +phy_tx_polarity_flip_fabric33.BCM8879X=1 +phy_tx_polarity_flip_fabric34.BCM8879X=0 +phy_tx_polarity_flip_fabric35.BCM8879X=1 + +phy_tx_polarity_flip_fabric36.BCM8879X=1 +phy_tx_polarity_flip_fabric37.BCM8879X=0 +phy_tx_polarity_flip_fabric38.BCM8879X=1 +phy_tx_polarity_flip_fabric39.BCM8879X=0 + +phy_tx_polarity_flip_fabric40.BCM8879X=0 +phy_tx_polarity_flip_fabric41.BCM8879X=1 +phy_tx_polarity_flip_fabric42.BCM8879X=0 +phy_tx_polarity_flip_fabric43.BCM8879X=1 + +phy_tx_polarity_flip_fabric44.BCM8879X=0 +phy_tx_polarity_flip_fabric45.BCM8879X=1 +phy_tx_polarity_flip_fabric46.BCM8879X=0 +phy_tx_polarity_flip_fabric47.BCM8879X=1 + +phy_tx_polarity_flip_fabric48.BCM8879X=1 +phy_tx_polarity_flip_fabric49.BCM8879X=0 +phy_tx_polarity_flip_fabric50.BCM8879X=1 +phy_tx_polarity_flip_fabric51.BCM8879X=0 + +phy_tx_polarity_flip_fabric52.BCM8879X=0 +phy_tx_polarity_flip_fabric53.BCM8879X=1 +phy_tx_polarity_flip_fabric54.BCM8879X=0 +phy_tx_polarity_flip_fabric55.BCM8879X=1 + +phy_tx_polarity_flip_fabric56.BCM8879X=1 +phy_tx_polarity_flip_fabric57.BCM8879X=0 +phy_tx_polarity_flip_fabric58.BCM8879X=1 +phy_tx_polarity_flip_fabric59.BCM8879X=0 + +phy_tx_polarity_flip_fabric60.BCM8879X=1 +phy_tx_polarity_flip_fabric61.BCM8879X=0 +phy_tx_polarity_flip_fabric62.BCM8879X=1 +phy_tx_polarity_flip_fabric63.BCM8879X=0 + +phy_tx_polarity_flip_fabric64.BCM8879X=0 +phy_tx_polarity_flip_fabric65.BCM8879X=1 +phy_tx_polarity_flip_fabric66.BCM8879X=0 +phy_tx_polarity_flip_fabric67.BCM8879X=1 + +phy_tx_polarity_flip_fabric68.BCM8879X=1 +phy_tx_polarity_flip_fabric69.BCM8879X=0 +phy_tx_polarity_flip_fabric70.BCM8879X=1 +phy_tx_polarity_flip_fabric71.BCM8879X=0 + +phy_tx_polarity_flip_fabric72.BCM8879X=0 +phy_tx_polarity_flip_fabric73.BCM8879X=1 +phy_tx_polarity_flip_fabric74.BCM8879X=0 +phy_tx_polarity_flip_fabric75.BCM8879X=1 + +phy_tx_polarity_flip_fabric76.BCM8879X=0 +phy_tx_polarity_flip_fabric77.BCM8879X=1 +phy_tx_polarity_flip_fabric78.BCM8879X=0 +phy_tx_polarity_flip_fabric79.BCM8879X=1 + +phy_tx_polarity_flip_fabric80.BCM8879X=1 +phy_tx_polarity_flip_fabric81.BCM8879X=0 +phy_tx_polarity_flip_fabric82.BCM8879X=1 +phy_tx_polarity_flip_fabric83.BCM8879X=0 + +phy_tx_polarity_flip_fabric84.BCM8879X=0 +phy_tx_polarity_flip_fabric85.BCM8879X=1 +phy_tx_polarity_flip_fabric86.BCM8879X=0 +phy_tx_polarity_flip_fabric87.BCM8879X=1 + +phy_tx_polarity_flip_fabric88.BCM8879X=1 +phy_tx_polarity_flip_fabric89.BCM8879X=0 +phy_tx_polarity_flip_fabric90.BCM8879X=1 +phy_tx_polarity_flip_fabric91.BCM8879X=0 + +phy_tx_polarity_flip_fabric92.BCM8879X=0 +phy_tx_polarity_flip_fabric93.BCM8879X=1 +phy_tx_polarity_flip_fabric94.BCM8879X=0 +phy_tx_polarity_flip_fabric95.BCM8879X=1 + +phy_tx_polarity_flip_fabric96.BCM8879X=0 +phy_tx_polarity_flip_fabric97.BCM8879X=1 +phy_tx_polarity_flip_fabric98.BCM8879X=0 +phy_tx_polarity_flip_fabric99.BCM8879X=1 + +phy_tx_polarity_flip_fabric100.BCM8879X=1 +phy_tx_polarity_flip_fabric101.BCM8879X=0 +phy_tx_polarity_flip_fabric102.BCM8879X=1 +phy_tx_polarity_flip_fabric103.BCM8879X=0 + +phy_tx_polarity_flip_fabric104.BCM8879X=1 +phy_tx_polarity_flip_fabric105.BCM8879X=0 +phy_tx_polarity_flip_fabric106.BCM8879X=1 +phy_tx_polarity_flip_fabric107.BCM8879X=0 + +phy_tx_polarity_flip_fabric108.BCM8879X=1 +phy_tx_polarity_flip_fabric109.BCM8879X=0 +phy_tx_polarity_flip_fabric110.BCM8879X=1 +phy_tx_polarity_flip_fabric111.BCM8879X=0 + +phy_tx_polarity_flip_fabric112.BCM8879X=1 +phy_tx_polarity_flip_fabric113.BCM8879X=0 +phy_tx_polarity_flip_fabric114.BCM8879X=1 +phy_tx_polarity_flip_fabric115.BCM8879X=0 + +phy_tx_polarity_flip_fabric116.BCM8879X=0 +phy_tx_polarity_flip_fabric117.BCM8879X=1 +phy_tx_polarity_flip_fabric118.BCM8879X=0 +phy_tx_polarity_flip_fabric119.BCM8879X=1 + +phy_tx_polarity_flip_fabric120.BCM8879X=0 +phy_tx_polarity_flip_fabric121.BCM8879X=1 +phy_tx_polarity_flip_fabric122.BCM8879X=0 +phy_tx_polarity_flip_fabric123.BCM8879X=1 + +phy_tx_polarity_flip_fabric124.BCM8879X=1 +phy_tx_polarity_flip_fabric125.BCM8879X=0 +phy_tx_polarity_flip_fabric126.BCM8879X=1 +phy_tx_polarity_flip_fabric127.BCM8879X=0 + +phy_tx_polarity_flip_fabric128.BCM8879X=0 +phy_tx_polarity_flip_fabric129.BCM8879X=1 +phy_tx_polarity_flip_fabric130.BCM8879X=0 +phy_tx_polarity_flip_fabric131.BCM8879X=1 + +phy_tx_polarity_flip_fabric132.BCM8879X=1 +phy_tx_polarity_flip_fabric133.BCM8879X=0 +phy_tx_polarity_flip_fabric134.BCM8879X=1 +phy_tx_polarity_flip_fabric135.BCM8879X=0 + +phy_tx_polarity_flip_fabric136.BCM8879X=0 +phy_tx_polarity_flip_fabric137.BCM8879X=1 +phy_tx_polarity_flip_fabric138.BCM8879X=0 +phy_tx_polarity_flip_fabric139.BCM8879X=1 + +phy_tx_polarity_flip_fabric140.BCM8879X=0 +phy_tx_polarity_flip_fabric141.BCM8879X=1 +phy_tx_polarity_flip_fabric142.BCM8879X=0 +phy_tx_polarity_flip_fabric143.BCM8879X=1 + +phy_tx_polarity_flip_fabric144.BCM8879X=0 +phy_tx_polarity_flip_fabric145.BCM8879X=1 +phy_tx_polarity_flip_fabric146.BCM8879X=0 +phy_tx_polarity_flip_fabric147.BCM8879X=1 + +phy_tx_polarity_flip_fabric148.BCM8879X=0 +phy_tx_polarity_flip_fabric149.BCM8879X=1 +phy_tx_polarity_flip_fabric150.BCM8879X=0 +phy_tx_polarity_flip_fabric151.BCM8879X=1 + +phy_tx_polarity_flip_fabric152.BCM8879X=1 +phy_tx_polarity_flip_fabric153.BCM8879X=0 +phy_tx_polarity_flip_fabric154.BCM8879X=1 +phy_tx_polarity_flip_fabric155.BCM8879X=0 + +phy_tx_polarity_flip_fabric156.BCM8879X=0 +phy_tx_polarity_flip_fabric157.BCM8879X=1 +phy_tx_polarity_flip_fabric158.BCM8879X=0 +phy_tx_polarity_flip_fabric159.BCM8879X=1 + +phy_tx_polarity_flip_fabric160.BCM8879X=0 +phy_tx_polarity_flip_fabric161.BCM8879X=1 +phy_tx_polarity_flip_fabric162.BCM8879X=0 +phy_tx_polarity_flip_fabric163.BCM8879X=1 + +phy_tx_polarity_flip_fabric164.BCM8879X=1 +phy_tx_polarity_flip_fabric165.BCM8879X=0 +phy_tx_polarity_flip_fabric166.BCM8879X=1 +phy_tx_polarity_flip_fabric167.BCM8879X=0 + +phy_tx_polarity_flip_fabric168.BCM8879X=0 +phy_tx_polarity_flip_fabric169.BCM8879X=1 +phy_tx_polarity_flip_fabric170.BCM8879X=0 +phy_tx_polarity_flip_fabric171.BCM8879X=1 + +phy_tx_polarity_flip_fabric172.BCM8879X=0 +phy_tx_polarity_flip_fabric173.BCM8879X=1 +phy_tx_polarity_flip_fabric174.BCM8879X=0 +phy_tx_polarity_flip_fabric175.BCM8879X=1 + +phy_tx_polarity_flip_fabric176.BCM8879X=1 +phy_tx_polarity_flip_fabric177.BCM8879X=0 +phy_tx_polarity_flip_fabric178.BCM8879X=1 +phy_tx_polarity_flip_fabric179.BCM8879X=0 + +phy_tx_polarity_flip_fabric180.BCM8879X=0 +phy_tx_polarity_flip_fabric181.BCM8879X=1 +phy_tx_polarity_flip_fabric182.BCM8879X=0 +phy_tx_polarity_flip_fabric183.BCM8879X=1 + +phy_tx_polarity_flip_fabric184.BCM8879X=1 +phy_tx_polarity_flip_fabric185.BCM8879X=0 +phy_tx_polarity_flip_fabric186.BCM8879X=1 +phy_tx_polarity_flip_fabric187.BCM8879X=0 + +phy_tx_polarity_flip_fabric188.BCM8879X=0 +phy_tx_polarity_flip_fabric189.BCM8879X=1 +phy_tx_polarity_flip_fabric190.BCM8879X=0 +phy_tx_polarity_flip_fabric191.BCM8879X=1 + +port_init_cl72_0=0 +port_init_cl72_1=0 +port_init_cl72_2=0 +port_init_cl72_3=0 +port_init_cl72_4=0 +port_init_cl72_5=0 +port_init_cl72_6=0 +port_init_cl72_7=0 +port_init_cl72_8=0 +port_init_cl72_9=0 +port_init_cl72_10=0 +port_init_cl72_11=0 +port_init_cl72_12=0 +port_init_cl72_13=0 +port_init_cl72_14=0 +port_init_cl72_15=0 +port_init_cl72_16=0 +port_init_cl72_17=0 +port_init_cl72_18=0 +port_init_cl72_19=0 +port_init_cl72_20=0 +port_init_cl72_21=0 +port_init_cl72_22=0 +port_init_cl72_23=0 +port_init_cl72_24=0 +port_init_cl72_25=0 +port_init_cl72_26=0 +port_init_cl72_27=0 +port_init_cl72_28=0 +port_init_cl72_29=0 +port_init_cl72_30=0 +port_init_cl72_31=0 +port_init_cl72_32=0 +port_init_cl72_33=0 +port_init_cl72_34=0 +port_init_cl72_35=0 +port_init_cl72_36=0 +port_init_cl72_37=0 +port_init_cl72_38=0 +port_init_cl72_39=0 +port_init_cl72_40=0 +port_init_cl72_41=0 +port_init_cl72_42=0 +port_init_cl72_43=0 +port_init_cl72_44=0 +port_init_cl72_45=0 +port_init_cl72_46=0 +port_init_cl72_47=0 +port_init_cl72_48=0 +port_init_cl72_49=0 +port_init_cl72_50=0 +port_init_cl72_51=0 +port_init_cl72_52=0 +port_init_cl72_53=0 +port_init_cl72_54=0 +port_init_cl72_55=0 +port_init_cl72_56=0 +port_init_cl72_57=0 +port_init_cl72_58=0 +port_init_cl72_59=0 +port_init_cl72_60=0 +port_init_cl72_61=0 +port_init_cl72_62=0 +port_init_cl72_63=0 +port_init_cl72_64=0 +port_init_cl72_65=0 +port_init_cl72_66=0 +port_init_cl72_67=0 +port_init_cl72_68=0 +port_init_cl72_69=0 +port_init_cl72_70=0 +port_init_cl72_71=0 +port_init_cl72_72=0 +port_init_cl72_73=0 +port_init_cl72_74=0 +port_init_cl72_75=0 +port_init_cl72_76=0 +port_init_cl72_77=0 +port_init_cl72_78=0 +port_init_cl72_79=0 +port_init_cl72_80=0 +port_init_cl72_81=0 +port_init_cl72_82=0 +port_init_cl72_83=0 +port_init_cl72_84=0 +port_init_cl72_85=0 +port_init_cl72_86=0 +port_init_cl72_87=0 +port_init_cl72_88=0 +port_init_cl72_89=0 +port_init_cl72_90=0 +port_init_cl72_91=0 +port_init_cl72_92=0 +port_init_cl72_93=0 +port_init_cl72_94=0 +port_init_cl72_95=0 +port_init_cl72_96=0 +port_init_cl72_97=0 +port_init_cl72_98=0 +port_init_cl72_99=0 +port_init_cl72_100=0 +port_init_cl72_101=0 +port_init_cl72_102=0 +port_init_cl72_103=0 +port_init_cl72_104=0 +port_init_cl72_105=0 +port_init_cl72_106=0 +port_init_cl72_107=0 +port_init_cl72_108=0 +port_init_cl72_109=0 +port_init_cl72_110=0 +port_init_cl72_111=0 +port_init_cl72_112=0 +port_init_cl72_113=0 +port_init_cl72_114=0 +port_init_cl72_115=0 +port_init_cl72_116=0 +port_init_cl72_117=0 +port_init_cl72_118=0 +port_init_cl72_119=0 +port_init_cl72_120=0 +port_init_cl72_121=0 +port_init_cl72_122=0 +port_init_cl72_123=0 +port_init_cl72_124=0 +port_init_cl72_125=0 +port_init_cl72_126=0 +port_init_cl72_127=0 +port_init_cl72_128=0 +port_init_cl72_129=0 +port_init_cl72_130=0 +port_init_cl72_131=0 +port_init_cl72_132=0 +port_init_cl72_133=0 +port_init_cl72_134=0 +port_init_cl72_135=0 +port_init_cl72_136=0 +port_init_cl72_137=0 +port_init_cl72_138=0 +port_init_cl72_139=0 +port_init_cl72_140=0 +port_init_cl72_141=0 +port_init_cl72_142=0 +port_init_cl72_143=0 +port_init_cl72_144=0 +port_init_cl72_145=0 +port_init_cl72_146=0 +port_init_cl72_147=0 +port_init_cl72_148=0 +port_init_cl72_149=0 +port_init_cl72_150=0 +port_init_cl72_151=0 +port_init_cl72_152=0 +port_init_cl72_153=0 +port_init_cl72_154=0 +port_init_cl72_155=0 +port_init_cl72_156=0 +port_init_cl72_157=0 +port_init_cl72_158=0 +port_init_cl72_159=0 +port_init_cl72_160=0 +port_init_cl72_161=0 +port_init_cl72_162=0 +port_init_cl72_163=0 +port_init_cl72_164=0 +port_init_cl72_165=0 +port_init_cl72_166=0 +port_init_cl72_167=0 +port_init_cl72_168=0 +port_init_cl72_169=0 +port_init_cl72_170=0 +port_init_cl72_171=0 +port_init_cl72_172=0 +port_init_cl72_173=0 +port_init_cl72_174=0 +port_init_cl72_175=0 +port_init_cl72_176=0 +port_init_cl72_177=0 +port_init_cl72_178=0 +port_init_cl72_179=0 +port_init_cl72_180=0 +port_init_cl72_181=0 +port_init_cl72_182=0 +port_init_cl72_183=0 +port_init_cl72_184=0 +port_init_cl72_185=0 +port_init_cl72_186=0 +port_init_cl72_187=0 +port_init_cl72_188=0 +port_init_cl72_189=0 +port_init_cl72_190=0 +port_init_cl72_191=0 + +serdes_tx_taps_0.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_1.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_2.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_3.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_4.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_5.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_6.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_7.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_8.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_9.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_10.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_11.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_12.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_13.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_14.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_15.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_16.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_17.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_18.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_19.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_20.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_21.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_22.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_23.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_24.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_25.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_26.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_27.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_28.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_29.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_30.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_31.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_32.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_33.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_34.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_35.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_36.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_37.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_38.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_39.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_40.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_41.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_42.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_43.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_44.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_45.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_46.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_47.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_48.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_49.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_50.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_51.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_52.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_53.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_54.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_55.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_56.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_57.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_58.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_59.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_60.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_61.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_62.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_63.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_64.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_65.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_66.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_67.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_68.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_69.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_70.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_71.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_72.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_73.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_74.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_75.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_76.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_77.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_78.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_79.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_80.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_81.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_82.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_83.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_84.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_85.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_86.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_87.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_88.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_89.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_90.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_91.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_92.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_93.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_94.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_95.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_96.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_97.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_98.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_99.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_100.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_101.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_102.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_103.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_104.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_105.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_106.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_107.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_108.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_109.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_110.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_111.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_112.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_113.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_114.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_115.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_116.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_117.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_118.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_119.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_120.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_121.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_122.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_123.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_124.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_125.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_126.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_127.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_128.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_129.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_130.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_131.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_132.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_133.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_134.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_135.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_136.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_137.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_138.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_139.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_140.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_141.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_142.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_143.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_144.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_145.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_146.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_147.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_148.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_149.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_150.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_151.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_152.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_153.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_154.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_155.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_156.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_157.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_158.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_159.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_160.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_161.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_162.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_163.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_164.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_165.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_166.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_167.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_168.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_169.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_170.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_171.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_172.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_173.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_174.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_175.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_176.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_177.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_178.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_179.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_180.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_181.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_182.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_183.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_184.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_185.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_186.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_187.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_188.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_189.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_190.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_191.BCM8879X=pam4:-24:132:-12:0:0:0 + +serdes_lane_config_channel_mode_0.0=force_nr +serdes_lane_config_channel_mode_1.0=force_nr +serdes_lane_config_channel_mode_2.0=force_nr +serdes_lane_config_channel_mode_3.0=force_nr +serdes_lane_config_channel_mode_4.0=force_nr +serdes_lane_config_channel_mode_5.0=force_nr +serdes_lane_config_channel_mode_6.0=force_nr +serdes_lane_config_channel_mode_7.0=force_nr +serdes_lane_config_channel_mode_8.0=force_nr +serdes_lane_config_channel_mode_9.0=force_nr +serdes_lane_config_channel_mode_10.0=force_nr +serdes_lane_config_channel_mode_11.0=force_nr +serdes_lane_config_channel_mode_12.0=force_nr +serdes_lane_config_channel_mode_13.0=force_nr +serdes_lane_config_channel_mode_14.0=force_nr +serdes_lane_config_channel_mode_15.0=force_nr +serdes_lane_config_channel_mode_16.0=force_nr +serdes_lane_config_channel_mode_17.0=force_nr +serdes_lane_config_channel_mode_18.0=force_nr +serdes_lane_config_channel_mode_19.0=force_nr +serdes_lane_config_channel_mode_20.0=force_nr +serdes_lane_config_channel_mode_21.0=force_nr +serdes_lane_config_channel_mode_22.0=force_nr +serdes_lane_config_channel_mode_23.0=force_nr +serdes_lane_config_channel_mode_24.0=force_nr +serdes_lane_config_channel_mode_25.0=force_nr +serdes_lane_config_channel_mode_26.0=force_nr +serdes_lane_config_channel_mode_27.0=force_nr +serdes_lane_config_channel_mode_28.0=force_nr +serdes_lane_config_channel_mode_29.0=force_nr +serdes_lane_config_channel_mode_30.0=force_nr +serdes_lane_config_channel_mode_31.0=force_nr +serdes_lane_config_channel_mode_32.0=force_nr +serdes_lane_config_channel_mode_33.0=force_nr +serdes_lane_config_channel_mode_34.0=force_nr +serdes_lane_config_channel_mode_35.0=force_nr +serdes_lane_config_channel_mode_36.0=force_nr +serdes_lane_config_channel_mode_37.0=force_nr +serdes_lane_config_channel_mode_38.0=force_nr +serdes_lane_config_channel_mode_39.0=force_nr +serdes_lane_config_channel_mode_40.0=force_nr +serdes_lane_config_channel_mode_41.0=force_nr +serdes_lane_config_channel_mode_42.0=force_nr +serdes_lane_config_channel_mode_43.0=force_nr +serdes_lane_config_channel_mode_44.0=force_nr +serdes_lane_config_channel_mode_45.0=force_nr +serdes_lane_config_channel_mode_46.0=force_nr +serdes_lane_config_channel_mode_47.0=force_nr +serdes_lane_config_channel_mode_48.0=force_nr +serdes_lane_config_channel_mode_49.0=force_nr +serdes_lane_config_channel_mode_50.0=force_nr +serdes_lane_config_channel_mode_51.0=force_nr +serdes_lane_config_channel_mode_52.0=force_nr +serdes_lane_config_channel_mode_53.0=force_nr +serdes_lane_config_channel_mode_54.0=force_nr +serdes_lane_config_channel_mode_55.0=force_nr +serdes_lane_config_channel_mode_56.0=force_nr +serdes_lane_config_channel_mode_57.0=force_nr +serdes_lane_config_channel_mode_58.0=force_nr +serdes_lane_config_channel_mode_59.0=force_nr +serdes_lane_config_channel_mode_60.0=force_nr +serdes_lane_config_channel_mode_61.0=force_nr +serdes_lane_config_channel_mode_62.0=force_nr +serdes_lane_config_channel_mode_63.0=force_nr +serdes_lane_config_channel_mode_64.0=force_nr +serdes_lane_config_channel_mode_65.0=force_nr +serdes_lane_config_channel_mode_66.0=force_nr +serdes_lane_config_channel_mode_67.0=force_nr +serdes_lane_config_channel_mode_68.0=force_nr +serdes_lane_config_channel_mode_69.0=force_nr +serdes_lane_config_channel_mode_70.0=force_nr +serdes_lane_config_channel_mode_71.0=force_nr +serdes_lane_config_channel_mode_72.0=force_nr +serdes_lane_config_channel_mode_73.0=force_nr +serdes_lane_config_channel_mode_74.0=force_nr +serdes_lane_config_channel_mode_75.0=force_nr +serdes_lane_config_channel_mode_76.0=force_nr +serdes_lane_config_channel_mode_77.0=force_nr +serdes_lane_config_channel_mode_78.0=force_nr +serdes_lane_config_channel_mode_79.0=force_nr +serdes_lane_config_channel_mode_80.0=force_nr +serdes_lane_config_channel_mode_81.0=force_nr +serdes_lane_config_channel_mode_82.0=force_nr +serdes_lane_config_channel_mode_83.0=force_nr +serdes_lane_config_channel_mode_84.0=force_nr +serdes_lane_config_channel_mode_85.0=force_nr +serdes_lane_config_channel_mode_86.0=force_nr +serdes_lane_config_channel_mode_87.0=force_nr +serdes_lane_config_channel_mode_88.0=force_nr +serdes_lane_config_channel_mode_89.0=force_nr +serdes_lane_config_channel_mode_90.0=force_nr +serdes_lane_config_channel_mode_91.0=force_nr +serdes_lane_config_channel_mode_92.0=force_nr +serdes_lane_config_channel_mode_93.0=force_nr +serdes_lane_config_channel_mode_94.0=force_nr +serdes_lane_config_channel_mode_95.0=force_nr +serdes_lane_config_channel_mode_96.0=force_nr +serdes_lane_config_channel_mode_97.0=force_nr +serdes_lane_config_channel_mode_98.0=force_nr +serdes_lane_config_channel_mode_99.0=force_nr +serdes_lane_config_channel_mode_100.0=force_nr +serdes_lane_config_channel_mode_101.0=force_nr +serdes_lane_config_channel_mode_102.0=force_nr +serdes_lane_config_channel_mode_103.0=force_nr +serdes_lane_config_channel_mode_104.0=force_nr +serdes_lane_config_channel_mode_105.0=force_nr +serdes_lane_config_channel_mode_106.0=force_nr +serdes_lane_config_channel_mode_107.0=force_nr +serdes_lane_config_channel_mode_108.0=force_nr +serdes_lane_config_channel_mode_109.0=force_nr +serdes_lane_config_channel_mode_110.0=force_nr +serdes_lane_config_channel_mode_111.0=force_nr +serdes_lane_config_channel_mode_112.0=force_nr +serdes_lane_config_channel_mode_113.0=force_nr +serdes_lane_config_channel_mode_114.0=force_nr +serdes_lane_config_channel_mode_115.0=force_nr +serdes_lane_config_channel_mode_116.0=force_nr +serdes_lane_config_channel_mode_117.0=force_nr +serdes_lane_config_channel_mode_118.0=force_nr +serdes_lane_config_channel_mode_119.0=force_nr +serdes_lane_config_channel_mode_120.0=force_nr +serdes_lane_config_channel_mode_121.0=force_nr +serdes_lane_config_channel_mode_122.0=force_nr +serdes_lane_config_channel_mode_123.0=force_nr +serdes_lane_config_channel_mode_124.0=force_nr +serdes_lane_config_channel_mode_125.0=force_nr +serdes_lane_config_channel_mode_126.0=force_nr +serdes_lane_config_channel_mode_127.0=force_nr +serdes_lane_config_channel_mode_128.0=force_nr +serdes_lane_config_channel_mode_129.0=force_nr +serdes_lane_config_channel_mode_130.0=force_nr +serdes_lane_config_channel_mode_131.0=force_nr +serdes_lane_config_channel_mode_132.0=force_nr +serdes_lane_config_channel_mode_133.0=force_nr +serdes_lane_config_channel_mode_134.0=force_nr +serdes_lane_config_channel_mode_135.0=force_nr +serdes_lane_config_channel_mode_136.0=force_nr +serdes_lane_config_channel_mode_137.0=force_nr +serdes_lane_config_channel_mode_138.0=force_nr +serdes_lane_config_channel_mode_139.0=force_nr +serdes_lane_config_channel_mode_140.0=force_nr +serdes_lane_config_channel_mode_141.0=force_nr +serdes_lane_config_channel_mode_142.0=force_nr +serdes_lane_config_channel_mode_143.0=force_nr +serdes_lane_config_channel_mode_144.0=force_nr +serdes_lane_config_channel_mode_145.0=force_nr +serdes_lane_config_channel_mode_146.0=force_nr +serdes_lane_config_channel_mode_147.0=force_nr +serdes_lane_config_channel_mode_148.0=force_nr +serdes_lane_config_channel_mode_149.0=force_nr +serdes_lane_config_channel_mode_150.0=force_nr +serdes_lane_config_channel_mode_151.0=force_nr +serdes_lane_config_channel_mode_152.0=force_nr +serdes_lane_config_channel_mode_153.0=force_nr +serdes_lane_config_channel_mode_154.0=force_nr +serdes_lane_config_channel_mode_155.0=force_nr +serdes_lane_config_channel_mode_156.0=force_nr +serdes_lane_config_channel_mode_157.0=force_nr +serdes_lane_config_channel_mode_158.0=force_nr +serdes_lane_config_channel_mode_159.0=force_nr +serdes_lane_config_channel_mode_160.0=force_nr +serdes_lane_config_channel_mode_161.0=force_nr +serdes_lane_config_channel_mode_162.0=force_nr +serdes_lane_config_channel_mode_163.0=force_nr +serdes_lane_config_channel_mode_164.0=force_nr +serdes_lane_config_channel_mode_165.0=force_nr +serdes_lane_config_channel_mode_166.0=force_nr +serdes_lane_config_channel_mode_167.0=force_nr +serdes_lane_config_channel_mode_168.0=force_nr +serdes_lane_config_channel_mode_169.0=force_nr +serdes_lane_config_channel_mode_170.0=force_nr +serdes_lane_config_channel_mode_171.0=force_nr +serdes_lane_config_channel_mode_172.0=force_nr +serdes_lane_config_channel_mode_173.0=force_nr +serdes_lane_config_channel_mode_174.0=force_nr +serdes_lane_config_channel_mode_175.0=force_nr +serdes_lane_config_channel_mode_176.0=force_nr +serdes_lane_config_channel_mode_177.0=force_nr +serdes_lane_config_channel_mode_178.0=force_nr +serdes_lane_config_channel_mode_179.0=force_nr +serdes_lane_config_channel_mode_180.0=force_nr +serdes_lane_config_channel_mode_181.0=force_nr +serdes_lane_config_channel_mode_182.0=force_nr +serdes_lane_config_channel_mode_183.0=force_nr +serdes_lane_config_channel_mode_184.0=force_nr +serdes_lane_config_channel_mode_185.0=force_nr +serdes_lane_config_channel_mode_186.0=force_nr +serdes_lane_config_channel_mode_187.0=force_nr +serdes_lane_config_channel_mode_188.0=force_nr +serdes_lane_config_channel_mode_189.0=force_nr +serdes_lane_config_channel_mode_190.0=force_nr +serdes_lane_config_channel_mode_191.0=force_nr + + +serdes_qrtt_active_0.0=1 +serdes_qrtt_active_1.0=1 +serdes_qrtt_active_2.0=1 +serdes_qrtt_active_3.0=1 +serdes_qrtt_active_4.0=1 +serdes_qrtt_active_5.0=1 +serdes_qrtt_active_6.0=1 +serdes_qrtt_active_7.0=1 +serdes_qrtt_active_8.0=1 +serdes_qrtt_active_9.0=1 +serdes_qrtt_active_10.0=1 +serdes_qrtt_active_11.0=1 +serdes_qrtt_active_12.0=1 +serdes_qrtt_active_13.0=1 +serdes_qrtt_active_14.0=1 +serdes_qrtt_active_15.0=1 +serdes_qrtt_active_16.0=1 +serdes_qrtt_active_17.0=1 +serdes_qrtt_active_18.0=1 +serdes_qrtt_active_19.0=1 +serdes_qrtt_active_20.0=1 +serdes_qrtt_active_21.0=1 +serdes_qrtt_active_22.0=1 +serdes_qrtt_active_23.0=1 +serdes_qrtt_active_24.0=1 +serdes_qrtt_active_25.0=1 +serdes_qrtt_active_26.0=1 +serdes_qrtt_active_27.0=1 +serdes_qrtt_active_28.0=1 +serdes_qrtt_active_29.0=1 +serdes_qrtt_active_30.0=1 +serdes_qrtt_active_31.0=1 +serdes_qrtt_active_32.0=1 +serdes_qrtt_active_33.0=1 +serdes_qrtt_active_34.0=1 +serdes_qrtt_active_35.0=1 +serdes_qrtt_active_36.0=1 +serdes_qrtt_active_37.0=1 +serdes_qrtt_active_38.0=1 +serdes_qrtt_active_39.0=1 +serdes_qrtt_active_40.0=1 +serdes_qrtt_active_41.0=1 +serdes_qrtt_active_42.0=1 +serdes_qrtt_active_43.0=1 +serdes_qrtt_active_44.0=1 +serdes_qrtt_active_45.0=1 +serdes_qrtt_active_46.0=1 +serdes_qrtt_active_47.0=1 diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/13/config-ramon-7-1.bcm b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/13/config-ramon-7-1.bcm new file mode 100644 index 000000000000..219aaa4aea1d --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/13/config-ramon-7-1.bcm @@ -0,0 +1,1395 @@ + +appl_enable_intr_init.BCM8879X=0 +appl_param_module_id.BCM8879X=14 +bcm_linkscan_interval.BCM8879X=0 +bcm_stat_interval.BCM8879X=4000000 +bist_enable.BCM8879X=0 +core_clock_speed_khz.BCM8879X=1000000 +custom_feature_access_only.BCM8879X=0 +custom_feature_lane_swap_disable.BCM8879X=0 +dport_map_direct.BCM8879X=1 +fabric_cell_fifo_dma_enable.BCM8879X=0 +fabric_device_mode.BCM8879X=SINGLE_STAGE_FE2 +fabric_load_balancing_mode.BCM8879X=NORMAL_LOAD_BALANCE +fabric_multicast_mode.BCM8879X=DIRECT +fabric_num_pipes.BCM8879X=1 +fabric_pipe_map.BCM8879X=0 +fe_mc_id_range.BCM8879X=128K +load_firmware.BCM8879X=0x102 +mdio_output_delay_ext.BCM8879X=14 +mdio_output_delay_int.BCM8879X=25 +mem_cache_enable_parity.BCM8879X=1 +mm_intr_enable.BCM8879X=0 +mm_timeout_usec.BCM8879X=300000 +polled_irq_delay.BCM8879X=100000 +polled_irq_mode.BCM8879X=1 +port_fec.BCM8879X=7 +port_init_cl72.BCM8879X=0 +port_init_speed.BCM8879X=53125 +rate_ext_mdio_divisor.BCM8879X=14 +rate_int_mdio_divisor.BCM8879X=50 +schan_intr_enable.BCM8879X=0 +schan_timeout_usec.BCM8879X=300000 +serdes_fabric_clk_freq_in.BCM8879X=1 +serdes_fabric_clk_freq_out.BCM8879X=bypass +soc_family.BCM8879X=BCM8879X +srd_tx_drv_hv_disable.BCM8879X=0 +system_contains_multiple_pipe_device.BCM8879X=0 +system_ref_core_clock_khz.BCM8879X=1200000 +table_dma_enable.BCM8879X=0 +tdma_intr_enable.BCM8879X=0 +tdma_timeout_usec.BCM8879X=5000000 +tslam_dma_enable.BCM8879X=0 +tslam_intr_enable.BCM8879X=0 +tslam_timeout_usec.BCM8879X=5000000 + +lane_to_serdes_map_fabric_lane0.BCM8879X=rx0:tx0 +lane_to_serdes_map_fabric_lane1.BCM8879X=rx1:tx1 +lane_to_serdes_map_fabric_lane2.BCM8879X=rx2:tx2 +lane_to_serdes_map_fabric_lane3.BCM8879X=rx3:tx3 + +lane_to_serdes_map_fabric_lane4.BCM8879X=rx4:tx4 +lane_to_serdes_map_fabric_lane5.BCM8879X=rx5:tx5 +lane_to_serdes_map_fabric_lane6.BCM8879X=rx6:tx6 +lane_to_serdes_map_fabric_lane7.BCM8879X=rx7:tx7 + +lane_to_serdes_map_fabric_lane8.BCM8879X=rx8:tx8 +lane_to_serdes_map_fabric_lane9.BCM8879X=rx9:tx9 +lane_to_serdes_map_fabric_lane10.BCM8879X=rx10:tx10 +lane_to_serdes_map_fabric_lane11.BCM8879X=rx11:tx11 + +lane_to_serdes_map_fabric_lane12.BCM8879X=rx12:tx12 +lane_to_serdes_map_fabric_lane13.BCM8879X=rx13:tx13 +lane_to_serdes_map_fabric_lane14.BCM8879X=rx14:tx14 +lane_to_serdes_map_fabric_lane15.BCM8879X=rx15:tx15 + +lane_to_serdes_map_fabric_lane16.BCM8879X=rx16:tx16 +lane_to_serdes_map_fabric_lane17.BCM8879X=rx17:tx17 +lane_to_serdes_map_fabric_lane18.BCM8879X=rx18:tx18 +lane_to_serdes_map_fabric_lane19.BCM8879X=rx19:tx19 + +lane_to_serdes_map_fabric_lane20.BCM8879X=rx20:tx20 +lane_to_serdes_map_fabric_lane21.BCM8879X=rx21:tx21 +lane_to_serdes_map_fabric_lane22.BCM8879X=rx22:tx22 +lane_to_serdes_map_fabric_lane23.BCM8879X=rx23:tx23 + +lane_to_serdes_map_fabric_lane24.BCM8879X=rx24:tx24 +lane_to_serdes_map_fabric_lane25.BCM8879X=rx25:tx25 +lane_to_serdes_map_fabric_lane26.BCM8879X=rx26:tx26 +lane_to_serdes_map_fabric_lane27.BCM8879X=rx27:tx27 + +lane_to_serdes_map_fabric_lane28.BCM8879X=rx28:tx28 +lane_to_serdes_map_fabric_lane29.BCM8879X=rx29:tx29 +lane_to_serdes_map_fabric_lane30.BCM8879X=rx30:tx30 +lane_to_serdes_map_fabric_lane31.BCM8879X=rx31:tx31 + +lane_to_serdes_map_fabric_lane32.BCM8879X=rx32:tx32 +lane_to_serdes_map_fabric_lane33.BCM8879X=rx33:tx33 +lane_to_serdes_map_fabric_lane34.BCM8879X=rx34:tx34 +lane_to_serdes_map_fabric_lane35.BCM8879X=rx35:tx35 + +lane_to_serdes_map_fabric_lane36.BCM8879X=rx36:tx36 +lane_to_serdes_map_fabric_lane37.BCM8879X=rx37:tx37 +lane_to_serdes_map_fabric_lane38.BCM8879X=rx38:tx38 +lane_to_serdes_map_fabric_lane39.BCM8879X=rx39:tx39 + +lane_to_serdes_map_fabric_lane40.BCM8879X=rx40:tx40 +lane_to_serdes_map_fabric_lane41.BCM8879X=rx41:tx41 +lane_to_serdes_map_fabric_lane42.BCM8879X=rx42:tx42 +lane_to_serdes_map_fabric_lane43.BCM8879X=rx43:tx43 + +lane_to_serdes_map_fabric_lane44.BCM8879X=rx44:tx44 +lane_to_serdes_map_fabric_lane45.BCM8879X=rx45:tx45 +lane_to_serdes_map_fabric_lane46.BCM8879X=rx46:tx46 +lane_to_serdes_map_fabric_lane47.BCM8879X=rx47:tx47 + +lane_to_serdes_map_fabric_lane48.BCM8879X=rx48:tx48 +lane_to_serdes_map_fabric_lane49.BCM8879X=rx49:tx49 +lane_to_serdes_map_fabric_lane50.BCM8879X=rx50:tx50 +lane_to_serdes_map_fabric_lane51.BCM8879X=rx51:tx51 + +lane_to_serdes_map_fabric_lane52.BCM8879X=rx52:tx52 +lane_to_serdes_map_fabric_lane53.BCM8879X=rx53:tx53 +lane_to_serdes_map_fabric_lane54.BCM8879X=rx54:tx54 +lane_to_serdes_map_fabric_lane55.BCM8879X=rx55:tx55 + +lane_to_serdes_map_fabric_lane56.BCM8879X=rx56:tx56 +lane_to_serdes_map_fabric_lane57.BCM8879X=rx57:tx57 +lane_to_serdes_map_fabric_lane58.BCM8879X=rx58:tx58 +lane_to_serdes_map_fabric_lane59.BCM8879X=rx59:tx59 + +lane_to_serdes_map_fabric_lane60.BCM8879X=rx60:tx60 +lane_to_serdes_map_fabric_lane61.BCM8879X=rx61:tx61 +lane_to_serdes_map_fabric_lane62.BCM8879X=rx62:tx62 +lane_to_serdes_map_fabric_lane63.BCM8879X=rx63:tx63 + +lane_to_serdes_map_fabric_lane64.BCM8879X=rx64:tx64 +lane_to_serdes_map_fabric_lane65.BCM8879X=rx65:tx65 +lane_to_serdes_map_fabric_lane66.BCM8879X=rx66:tx66 +lane_to_serdes_map_fabric_lane67.BCM8879X=rx67:tx67 + +lane_to_serdes_map_fabric_lane68.BCM8879X=rx68:tx68 +lane_to_serdes_map_fabric_lane69.BCM8879X=rx69:tx69 +lane_to_serdes_map_fabric_lane70.BCM8879X=rx70:tx70 +lane_to_serdes_map_fabric_lane71.BCM8879X=rx71:tx71 + +lane_to_serdes_map_fabric_lane72.BCM8879X=rx72:tx72 +lane_to_serdes_map_fabric_lane73.BCM8879X=rx73:tx73 +lane_to_serdes_map_fabric_lane74.BCM8879X=rx74:tx74 +lane_to_serdes_map_fabric_lane75.BCM8879X=rx75:tx75 + +lane_to_serdes_map_fabric_lane76.BCM8879X=rx76:tx76 +lane_to_serdes_map_fabric_lane77.BCM8879X=rx77:tx77 +lane_to_serdes_map_fabric_lane78.BCM8879X=rx78:tx78 +lane_to_serdes_map_fabric_lane79.BCM8879X=rx79:tx79 + +lane_to_serdes_map_fabric_lane80.BCM8879X=rx80:tx80 +lane_to_serdes_map_fabric_lane81.BCM8879X=rx81:tx81 +lane_to_serdes_map_fabric_lane82.BCM8879X=rx82:tx82 +lane_to_serdes_map_fabric_lane83.BCM8879X=rx83:tx83 + +lane_to_serdes_map_fabric_lane84.BCM8879X=rx84:tx84 +lane_to_serdes_map_fabric_lane85.BCM8879X=rx85:tx85 +lane_to_serdes_map_fabric_lane86.BCM8879X=rx86:tx86 +lane_to_serdes_map_fabric_lane87.BCM8879X=rx87:tx87 + +lane_to_serdes_map_fabric_lane88.BCM8879X=rx88:tx88 +lane_to_serdes_map_fabric_lane89.BCM8879X=rx89:tx89 +lane_to_serdes_map_fabric_lane90.BCM8879X=rx90:tx90 +lane_to_serdes_map_fabric_lane91.BCM8879X=rx91:tx91 + +lane_to_serdes_map_fabric_lane92.BCM8879X=rx92:tx92 +lane_to_serdes_map_fabric_lane93.BCM8879X=rx93:tx93 +lane_to_serdes_map_fabric_lane94.BCM8879X=rx94:tx94 +lane_to_serdes_map_fabric_lane95.BCM8879X=rx95:tx95 + +lane_to_serdes_map_fabric_lane96.BCM8879X=rx96:tx96 +lane_to_serdes_map_fabric_lane97.BCM8879X=rx97:tx97 +lane_to_serdes_map_fabric_lane98.BCM8879X=rx98:tx98 +lane_to_serdes_map_fabric_lane99.BCM8879X=rx99:tx99 + +lane_to_serdes_map_fabric_lane100.BCM8879X=rx100:tx100 +lane_to_serdes_map_fabric_lane101.BCM8879X=rx101:tx101 +lane_to_serdes_map_fabric_lane102.BCM8879X=rx102:tx102 +lane_to_serdes_map_fabric_lane103.BCM8879X=rx103:tx103 + +lane_to_serdes_map_fabric_lane104.BCM8879X=rx104:tx104 +lane_to_serdes_map_fabric_lane105.BCM8879X=rx105:tx105 +lane_to_serdes_map_fabric_lane106.BCM8879X=rx106:tx106 +lane_to_serdes_map_fabric_lane107.BCM8879X=rx107:tx107 + +lane_to_serdes_map_fabric_lane108.BCM8879X=rx108:tx108 +lane_to_serdes_map_fabric_lane109.BCM8879X=rx109:tx109 +lane_to_serdes_map_fabric_lane110.BCM8879X=rx110:tx110 +lane_to_serdes_map_fabric_lane111.BCM8879X=rx111:tx111 + +lane_to_serdes_map_fabric_lane112.BCM8879X=rx112:tx112 +lane_to_serdes_map_fabric_lane113.BCM8879X=rx113:tx113 +lane_to_serdes_map_fabric_lane114.BCM8879X=rx114:tx114 +lane_to_serdes_map_fabric_lane115.BCM8879X=rx115:tx115 + +lane_to_serdes_map_fabric_lane116.BCM8879X=rx116:tx116 +lane_to_serdes_map_fabric_lane117.BCM8879X=rx117:tx117 +lane_to_serdes_map_fabric_lane118.BCM8879X=rx118:tx118 +lane_to_serdes_map_fabric_lane119.BCM8879X=rx119:tx119 + +lane_to_serdes_map_fabric_lane120.BCM8879X=rx120:tx120 +lane_to_serdes_map_fabric_lane121.BCM8879X=rx121:tx121 +lane_to_serdes_map_fabric_lane122.BCM8879X=rx122:tx122 +lane_to_serdes_map_fabric_lane123.BCM8879X=rx123:tx123 + +lane_to_serdes_map_fabric_lane124.BCM8879X=rx124:tx124 +lane_to_serdes_map_fabric_lane125.BCM8879X=rx125:tx125 +lane_to_serdes_map_fabric_lane126.BCM8879X=rx126:tx126 +lane_to_serdes_map_fabric_lane127.BCM8879X=rx127:tx127 + +lane_to_serdes_map_fabric_lane128.BCM8879X=rx128:tx128 +lane_to_serdes_map_fabric_lane129.BCM8879X=rx129:tx129 +lane_to_serdes_map_fabric_lane130.BCM8879X=rx130:tx130 +lane_to_serdes_map_fabric_lane131.BCM8879X=rx131:tx131 + +lane_to_serdes_map_fabric_lane132.BCM8879X=rx132:tx132 +lane_to_serdes_map_fabric_lane133.BCM8879X=rx133:tx133 +lane_to_serdes_map_fabric_lane134.BCM8879X=rx134:tx134 +lane_to_serdes_map_fabric_lane135.BCM8879X=rx135:tx135 + +lane_to_serdes_map_fabric_lane136.BCM8879X=rx136:tx136 +lane_to_serdes_map_fabric_lane137.BCM8879X=rx137:tx137 +lane_to_serdes_map_fabric_lane138.BCM8879X=rx138:tx138 +lane_to_serdes_map_fabric_lane139.BCM8879X=rx139:tx139 + +lane_to_serdes_map_fabric_lane140.BCM8879X=rx140:tx140 +lane_to_serdes_map_fabric_lane141.BCM8879X=rx141:tx141 +lane_to_serdes_map_fabric_lane142.BCM8879X=rx142:tx142 +lane_to_serdes_map_fabric_lane143.BCM8879X=rx143:tx143 + +lane_to_serdes_map_fabric_lane144.BCM8879X=rx144:tx144 +lane_to_serdes_map_fabric_lane145.BCM8879X=rx145:tx145 +lane_to_serdes_map_fabric_lane146.BCM8879X=rx146:tx146 +lane_to_serdes_map_fabric_lane147.BCM8879X=rx147:tx147 + +lane_to_serdes_map_fabric_lane148.BCM8879X=rx148:tx148 +lane_to_serdes_map_fabric_lane149.BCM8879X=rx149:tx149 +lane_to_serdes_map_fabric_lane150.BCM8879X=rx150:tx150 +lane_to_serdes_map_fabric_lane151.BCM8879X=rx151:tx151 + +lane_to_serdes_map_fabric_lane152.BCM8879X=rx152:tx152 +lane_to_serdes_map_fabric_lane153.BCM8879X=rx153:tx153 +lane_to_serdes_map_fabric_lane154.BCM8879X=rx154:tx154 +lane_to_serdes_map_fabric_lane155.BCM8879X=rx155:tx155 + +lane_to_serdes_map_fabric_lane156.BCM8879X=rx156:tx156 +lane_to_serdes_map_fabric_lane157.BCM8879X=rx157:tx157 +lane_to_serdes_map_fabric_lane158.BCM8879X=rx158:tx158 +lane_to_serdes_map_fabric_lane159.BCM8879X=rx159:tx159 + +lane_to_serdes_map_fabric_lane160.BCM8879X=rx160:tx160 +lane_to_serdes_map_fabric_lane161.BCM8879X=rx161:tx161 +lane_to_serdes_map_fabric_lane162.BCM8879X=rx162:tx162 +lane_to_serdes_map_fabric_lane163.BCM8879X=rx163:tx163 + +lane_to_serdes_map_fabric_lane164.BCM8879X=rx164:tx164 +lane_to_serdes_map_fabric_lane165.BCM8879X=rx165:tx165 +lane_to_serdes_map_fabric_lane166.BCM8879X=rx166:tx166 +lane_to_serdes_map_fabric_lane167.BCM8879X=rx167:tx167 + +lane_to_serdes_map_fabric_lane168.BCM8879X=rx168:tx168 +lane_to_serdes_map_fabric_lane169.BCM8879X=rx169:tx169 +lane_to_serdes_map_fabric_lane170.BCM8879X=rx170:tx170 +lane_to_serdes_map_fabric_lane171.BCM8879X=rx171:tx171 + +lane_to_serdes_map_fabric_lane172.BCM8879X=rx172:tx172 +lane_to_serdes_map_fabric_lane173.BCM8879X=rx173:tx173 +lane_to_serdes_map_fabric_lane174.BCM8879X=rx174:tx174 +lane_to_serdes_map_fabric_lane175.BCM8879X=rx175:tx175 + +lane_to_serdes_map_fabric_lane176.BCM8879X=rx176:tx176 +lane_to_serdes_map_fabric_lane177.BCM8879X=rx177:tx177 +lane_to_serdes_map_fabric_lane178.BCM8879X=rx178:tx178 +lane_to_serdes_map_fabric_lane179.BCM8879X=rx179:tx179 + +lane_to_serdes_map_fabric_lane180.BCM8879X=rx180:tx180 +lane_to_serdes_map_fabric_lane181.BCM8879X=rx181:tx181 +lane_to_serdes_map_fabric_lane182.BCM8879X=rx182:tx182 +lane_to_serdes_map_fabric_lane183.BCM8879X=rx183:tx183 + +lane_to_serdes_map_fabric_lane184.BCM8879X=rx184:tx184 +lane_to_serdes_map_fabric_lane185.BCM8879X=rx185:tx185 +lane_to_serdes_map_fabric_lane186.BCM8879X=rx186:tx186 +lane_to_serdes_map_fabric_lane187.BCM8879X=rx187:tx187 + +lane_to_serdes_map_fabric_lane188.BCM8879X=rx188:tx188 +lane_to_serdes_map_fabric_lane189.BCM8879X=rx189:tx189 +lane_to_serdes_map_fabric_lane190.BCM8879X=rx190:tx190 +lane_to_serdes_map_fabric_lane191.BCM8879X=rx191:tx191 + + +phy_rx_polarity_flip_fabric0.BCM8879X=1 +phy_rx_polarity_flip_fabric1.BCM8879X=0 +phy_rx_polarity_flip_fabric2.BCM8879X=1 +phy_rx_polarity_flip_fabric3.BCM8879X=0 + +phy_rx_polarity_flip_fabric4.BCM8879X=1 +phy_rx_polarity_flip_fabric5.BCM8879X=0 +phy_rx_polarity_flip_fabric6.BCM8879X=1 +phy_rx_polarity_flip_fabric7.BCM8879X=0 + +phy_rx_polarity_flip_fabric8.BCM8879X=0 +phy_rx_polarity_flip_fabric9.BCM8879X=1 +phy_rx_polarity_flip_fabric10.BCM8879X=0 +phy_rx_polarity_flip_fabric11.BCM8879X=1 + +phy_rx_polarity_flip_fabric12.BCM8879X=1 +phy_rx_polarity_flip_fabric13.BCM8879X=0 +phy_rx_polarity_flip_fabric14.BCM8879X=1 +phy_rx_polarity_flip_fabric15.BCM8879X=0 + +phy_rx_polarity_flip_fabric16.BCM8879X=1 +phy_rx_polarity_flip_fabric17.BCM8879X=0 +phy_rx_polarity_flip_fabric18.BCM8879X=1 +phy_rx_polarity_flip_fabric19.BCM8879X=0 + +phy_rx_polarity_flip_fabric20.BCM8879X=0 +phy_rx_polarity_flip_fabric21.BCM8879X=1 +phy_rx_polarity_flip_fabric22.BCM8879X=0 +phy_rx_polarity_flip_fabric23.BCM8879X=1 + +phy_rx_polarity_flip_fabric24.BCM8879X=1 +phy_rx_polarity_flip_fabric25.BCM8879X=0 +phy_rx_polarity_flip_fabric26.BCM8879X=1 +phy_rx_polarity_flip_fabric27.BCM8879X=0 + +phy_rx_polarity_flip_fabric28.BCM8879X=1 +phy_rx_polarity_flip_fabric29.BCM8879X=0 +phy_rx_polarity_flip_fabric30.BCM8879X=1 +phy_rx_polarity_flip_fabric31.BCM8879X=0 + +phy_rx_polarity_flip_fabric32.BCM8879X=0 +phy_rx_polarity_flip_fabric33.BCM8879X=1 +phy_rx_polarity_flip_fabric34.BCM8879X=0 +phy_rx_polarity_flip_fabric35.BCM8879X=1 + +phy_rx_polarity_flip_fabric36.BCM8879X=1 +phy_rx_polarity_flip_fabric37.BCM8879X=0 +phy_rx_polarity_flip_fabric38.BCM8879X=1 +phy_rx_polarity_flip_fabric39.BCM8879X=0 + +phy_rx_polarity_flip_fabric40.BCM8879X=0 +phy_rx_polarity_flip_fabric41.BCM8879X=1 +phy_rx_polarity_flip_fabric42.BCM8879X=0 +phy_rx_polarity_flip_fabric43.BCM8879X=1 + +phy_rx_polarity_flip_fabric44.BCM8879X=1 +phy_rx_polarity_flip_fabric45.BCM8879X=0 +phy_rx_polarity_flip_fabric46.BCM8879X=1 +phy_rx_polarity_flip_fabric47.BCM8879X=0 + +phy_rx_polarity_flip_fabric48.BCM8879X=1 +phy_rx_polarity_flip_fabric49.BCM8879X=0 +phy_rx_polarity_flip_fabric50.BCM8879X=1 +phy_rx_polarity_flip_fabric51.BCM8879X=0 + +phy_rx_polarity_flip_fabric52.BCM8879X=0 +phy_rx_polarity_flip_fabric53.BCM8879X=1 +phy_rx_polarity_flip_fabric54.BCM8879X=0 +phy_rx_polarity_flip_fabric55.BCM8879X=1 + +phy_rx_polarity_flip_fabric56.BCM8879X=0 +phy_rx_polarity_flip_fabric57.BCM8879X=1 +phy_rx_polarity_flip_fabric58.BCM8879X=0 +phy_rx_polarity_flip_fabric59.BCM8879X=1 + +phy_rx_polarity_flip_fabric60.BCM8879X=0 +phy_rx_polarity_flip_fabric61.BCM8879X=1 +phy_rx_polarity_flip_fabric62.BCM8879X=0 +phy_rx_polarity_flip_fabric63.BCM8879X=1 + +phy_rx_polarity_flip_fabric64.BCM8879X=0 +phy_rx_polarity_flip_fabric65.BCM8879X=1 +phy_rx_polarity_flip_fabric66.BCM8879X=0 +phy_rx_polarity_flip_fabric67.BCM8879X=1 + +phy_rx_polarity_flip_fabric68.BCM8879X=1 +phy_rx_polarity_flip_fabric69.BCM8879X=0 +phy_rx_polarity_flip_fabric70.BCM8879X=1 +phy_rx_polarity_flip_fabric71.BCM8879X=0 + +phy_rx_polarity_flip_fabric72.BCM8879X=1 +phy_rx_polarity_flip_fabric73.BCM8879X=0 +phy_rx_polarity_flip_fabric74.BCM8879X=1 +phy_rx_polarity_flip_fabric75.BCM8879X=0 + +phy_rx_polarity_flip_fabric76.BCM8879X=0 +phy_rx_polarity_flip_fabric77.BCM8879X=1 +phy_rx_polarity_flip_fabric78.BCM8879X=0 +phy_rx_polarity_flip_fabric79.BCM8879X=1 + +phy_rx_polarity_flip_fabric80.BCM8879X=1 +phy_rx_polarity_flip_fabric81.BCM8879X=0 +phy_rx_polarity_flip_fabric82.BCM8879X=1 +phy_rx_polarity_flip_fabric83.BCM8879X=0 + +phy_rx_polarity_flip_fabric84.BCM8879X=0 +phy_rx_polarity_flip_fabric85.BCM8879X=1 +phy_rx_polarity_flip_fabric86.BCM8879X=0 +phy_rx_polarity_flip_fabric87.BCM8879X=1 + +phy_rx_polarity_flip_fabric88.BCM8879X=1 +phy_rx_polarity_flip_fabric89.BCM8879X=0 +phy_rx_polarity_flip_fabric90.BCM8879X=1 +phy_rx_polarity_flip_fabric91.BCM8879X=0 + +phy_rx_polarity_flip_fabric92.BCM8879X=1 +phy_rx_polarity_flip_fabric93.BCM8879X=0 +phy_rx_polarity_flip_fabric94.BCM8879X=1 +phy_rx_polarity_flip_fabric95.BCM8879X=0 + +phy_rx_polarity_flip_fabric96.BCM8879X=0 +phy_rx_polarity_flip_fabric97.BCM8879X=1 +phy_rx_polarity_flip_fabric98.BCM8879X=0 +phy_rx_polarity_flip_fabric99.BCM8879X=1 + +phy_rx_polarity_flip_fabric100.BCM8879X=1 +phy_rx_polarity_flip_fabric101.BCM8879X=0 +phy_rx_polarity_flip_fabric102.BCM8879X=1 +phy_rx_polarity_flip_fabric103.BCM8879X=0 + +phy_rx_polarity_flip_fabric104.BCM8879X=0 +phy_rx_polarity_flip_fabric105.BCM8879X=1 +phy_rx_polarity_flip_fabric106.BCM8879X=0 +phy_rx_polarity_flip_fabric107.BCM8879X=1 + +phy_rx_polarity_flip_fabric108.BCM8879X=0 +phy_rx_polarity_flip_fabric109.BCM8879X=1 +phy_rx_polarity_flip_fabric110.BCM8879X=0 +phy_rx_polarity_flip_fabric111.BCM8879X=1 + +phy_rx_polarity_flip_fabric112.BCM8879X=1 +phy_rx_polarity_flip_fabric113.BCM8879X=0 +phy_rx_polarity_flip_fabric114.BCM8879X=1 +phy_rx_polarity_flip_fabric115.BCM8879X=0 + +phy_rx_polarity_flip_fabric116.BCM8879X=0 +phy_rx_polarity_flip_fabric117.BCM8879X=1 +phy_rx_polarity_flip_fabric118.BCM8879X=0 +phy_rx_polarity_flip_fabric119.BCM8879X=1 + +phy_rx_polarity_flip_fabric120.BCM8879X=1 +phy_rx_polarity_flip_fabric121.BCM8879X=0 +phy_rx_polarity_flip_fabric122.BCM8879X=1 +phy_rx_polarity_flip_fabric123.BCM8879X=0 + +phy_rx_polarity_flip_fabric124.BCM8879X=1 +phy_rx_polarity_flip_fabric125.BCM8879X=0 +phy_rx_polarity_flip_fabric126.BCM8879X=1 +phy_rx_polarity_flip_fabric127.BCM8879X=0 + +phy_rx_polarity_flip_fabric128.BCM8879X=0 +phy_rx_polarity_flip_fabric129.BCM8879X=1 +phy_rx_polarity_flip_fabric130.BCM8879X=0 +phy_rx_polarity_flip_fabric131.BCM8879X=1 + +phy_rx_polarity_flip_fabric132.BCM8879X=1 +phy_rx_polarity_flip_fabric133.BCM8879X=0 +phy_rx_polarity_flip_fabric134.BCM8879X=1 +phy_rx_polarity_flip_fabric135.BCM8879X=0 + +phy_rx_polarity_flip_fabric136.BCM8879X=0 +phy_rx_polarity_flip_fabric137.BCM8879X=1 +phy_rx_polarity_flip_fabric138.BCM8879X=0 +phy_rx_polarity_flip_fabric139.BCM8879X=1 + +phy_rx_polarity_flip_fabric140.BCM8879X=1 +phy_rx_polarity_flip_fabric141.BCM8879X=0 +phy_rx_polarity_flip_fabric142.BCM8879X=1 +phy_rx_polarity_flip_fabric143.BCM8879X=0 + +phy_rx_polarity_flip_fabric144.BCM8879X=1 +phy_rx_polarity_flip_fabric145.BCM8879X=0 +phy_rx_polarity_flip_fabric146.BCM8879X=1 +phy_rx_polarity_flip_fabric147.BCM8879X=0 + +phy_rx_polarity_flip_fabric148.BCM8879X=0 +phy_rx_polarity_flip_fabric149.BCM8879X=1 +phy_rx_polarity_flip_fabric150.BCM8879X=0 +phy_rx_polarity_flip_fabric151.BCM8879X=1 + +phy_rx_polarity_flip_fabric152.BCM8879X=1 +phy_rx_polarity_flip_fabric153.BCM8879X=0 +phy_rx_polarity_flip_fabric154.BCM8879X=1 +phy_rx_polarity_flip_fabric155.BCM8879X=0 + +phy_rx_polarity_flip_fabric156.BCM8879X=0 +phy_rx_polarity_flip_fabric157.BCM8879X=1 +phy_rx_polarity_flip_fabric158.BCM8879X=0 +phy_rx_polarity_flip_fabric159.BCM8879X=1 + +phy_rx_polarity_flip_fabric160.BCM8879X=1 +phy_rx_polarity_flip_fabric161.BCM8879X=0 +phy_rx_polarity_flip_fabric162.BCM8879X=1 +phy_rx_polarity_flip_fabric163.BCM8879X=0 + +phy_rx_polarity_flip_fabric164.BCM8879X=1 +phy_rx_polarity_flip_fabric165.BCM8879X=0 +phy_rx_polarity_flip_fabric166.BCM8879X=1 +phy_rx_polarity_flip_fabric167.BCM8879X=0 + +phy_rx_polarity_flip_fabric168.BCM8879X=1 +phy_rx_polarity_flip_fabric169.BCM8879X=0 +phy_rx_polarity_flip_fabric170.BCM8879X=1 +phy_rx_polarity_flip_fabric171.BCM8879X=0 + +phy_rx_polarity_flip_fabric172.BCM8879X=0 +phy_rx_polarity_flip_fabric173.BCM8879X=1 +phy_rx_polarity_flip_fabric174.BCM8879X=0 +phy_rx_polarity_flip_fabric175.BCM8879X=1 + +phy_rx_polarity_flip_fabric176.BCM8879X=1 +phy_rx_polarity_flip_fabric177.BCM8879X=0 +phy_rx_polarity_flip_fabric178.BCM8879X=1 +phy_rx_polarity_flip_fabric179.BCM8879X=0 + +phy_rx_polarity_flip_fabric180.BCM8879X=0 +phy_rx_polarity_flip_fabric181.BCM8879X=1 +phy_rx_polarity_flip_fabric182.BCM8879X=0 +phy_rx_polarity_flip_fabric183.BCM8879X=1 + +phy_rx_polarity_flip_fabric184.BCM8879X=1 +phy_rx_polarity_flip_fabric185.BCM8879X=0 +phy_rx_polarity_flip_fabric186.BCM8879X=1 +phy_rx_polarity_flip_fabric187.BCM8879X=0 + +phy_rx_polarity_flip_fabric188.BCM8879X=1 +phy_rx_polarity_flip_fabric189.BCM8879X=0 +phy_rx_polarity_flip_fabric190.BCM8879X=1 +phy_rx_polarity_flip_fabric191.BCM8879X=0 + + +phy_tx_polarity_flip_fabric0.BCM8879X=0 +phy_tx_polarity_flip_fabric1.BCM8879X=1 +phy_tx_polarity_flip_fabric2.BCM8879X=0 +phy_tx_polarity_flip_fabric3.BCM8879X=1 + +phy_tx_polarity_flip_fabric4.BCM8879X=0 +phy_tx_polarity_flip_fabric5.BCM8879X=1 +phy_tx_polarity_flip_fabric6.BCM8879X=0 +phy_tx_polarity_flip_fabric7.BCM8879X=1 + +phy_tx_polarity_flip_fabric8.BCM8879X=1 +phy_tx_polarity_flip_fabric9.BCM8879X=0 +phy_tx_polarity_flip_fabric10.BCM8879X=1 +phy_tx_polarity_flip_fabric11.BCM8879X=0 + +phy_tx_polarity_flip_fabric12.BCM8879X=0 +phy_tx_polarity_flip_fabric13.BCM8879X=1 +phy_tx_polarity_flip_fabric14.BCM8879X=0 +phy_tx_polarity_flip_fabric15.BCM8879X=1 + +phy_tx_polarity_flip_fabric16.BCM8879X=0 +phy_tx_polarity_flip_fabric17.BCM8879X=1 +phy_tx_polarity_flip_fabric18.BCM8879X=0 +phy_tx_polarity_flip_fabric19.BCM8879X=1 + +phy_tx_polarity_flip_fabric20.BCM8879X=1 +phy_tx_polarity_flip_fabric21.BCM8879X=0 +phy_tx_polarity_flip_fabric22.BCM8879X=1 +phy_tx_polarity_flip_fabric23.BCM8879X=0 + +phy_tx_polarity_flip_fabric24.BCM8879X=0 +phy_tx_polarity_flip_fabric25.BCM8879X=1 +phy_tx_polarity_flip_fabric26.BCM8879X=0 +phy_tx_polarity_flip_fabric27.BCM8879X=1 + +phy_tx_polarity_flip_fabric28.BCM8879X=0 +phy_tx_polarity_flip_fabric29.BCM8879X=1 +phy_tx_polarity_flip_fabric30.BCM8879X=0 +phy_tx_polarity_flip_fabric31.BCM8879X=1 + +phy_tx_polarity_flip_fabric32.BCM8879X=1 +phy_tx_polarity_flip_fabric33.BCM8879X=0 +phy_tx_polarity_flip_fabric34.BCM8879X=1 +phy_tx_polarity_flip_fabric35.BCM8879X=0 + +phy_tx_polarity_flip_fabric36.BCM8879X=0 +phy_tx_polarity_flip_fabric37.BCM8879X=1 +phy_tx_polarity_flip_fabric38.BCM8879X=0 +phy_tx_polarity_flip_fabric39.BCM8879X=1 + +phy_tx_polarity_flip_fabric40.BCM8879X=1 +phy_tx_polarity_flip_fabric41.BCM8879X=0 +phy_tx_polarity_flip_fabric42.BCM8879X=1 +phy_tx_polarity_flip_fabric43.BCM8879X=0 + +phy_tx_polarity_flip_fabric44.BCM8879X=0 +phy_tx_polarity_flip_fabric45.BCM8879X=1 +phy_tx_polarity_flip_fabric46.BCM8879X=0 +phy_tx_polarity_flip_fabric47.BCM8879X=1 + +phy_tx_polarity_flip_fabric48.BCM8879X=0 +phy_tx_polarity_flip_fabric49.BCM8879X=1 +phy_tx_polarity_flip_fabric50.BCM8879X=0 +phy_tx_polarity_flip_fabric51.BCM8879X=1 + +phy_tx_polarity_flip_fabric52.BCM8879X=1 +phy_tx_polarity_flip_fabric53.BCM8879X=0 +phy_tx_polarity_flip_fabric54.BCM8879X=1 +phy_tx_polarity_flip_fabric55.BCM8879X=0 + +phy_tx_polarity_flip_fabric56.BCM8879X=1 +phy_tx_polarity_flip_fabric57.BCM8879X=0 +phy_tx_polarity_flip_fabric58.BCM8879X=1 +phy_tx_polarity_flip_fabric59.BCM8879X=0 + +phy_tx_polarity_flip_fabric60.BCM8879X=1 +phy_tx_polarity_flip_fabric61.BCM8879X=0 +phy_tx_polarity_flip_fabric62.BCM8879X=1 +phy_tx_polarity_flip_fabric63.BCM8879X=0 + +phy_tx_polarity_flip_fabric64.BCM8879X=1 +phy_tx_polarity_flip_fabric65.BCM8879X=0 +phy_tx_polarity_flip_fabric66.BCM8879X=1 +phy_tx_polarity_flip_fabric67.BCM8879X=0 + +phy_tx_polarity_flip_fabric68.BCM8879X=0 +phy_tx_polarity_flip_fabric69.BCM8879X=1 +phy_tx_polarity_flip_fabric70.BCM8879X=0 +phy_tx_polarity_flip_fabric71.BCM8879X=1 + +phy_tx_polarity_flip_fabric72.BCM8879X=0 +phy_tx_polarity_flip_fabric73.BCM8879X=1 +phy_tx_polarity_flip_fabric74.BCM8879X=0 +phy_tx_polarity_flip_fabric75.BCM8879X=1 + +phy_tx_polarity_flip_fabric76.BCM8879X=1 +phy_tx_polarity_flip_fabric77.BCM8879X=0 +phy_tx_polarity_flip_fabric78.BCM8879X=1 +phy_tx_polarity_flip_fabric79.BCM8879X=0 + +phy_tx_polarity_flip_fabric80.BCM8879X=0 +phy_tx_polarity_flip_fabric81.BCM8879X=1 +phy_tx_polarity_flip_fabric82.BCM8879X=0 +phy_tx_polarity_flip_fabric83.BCM8879X=1 + +phy_tx_polarity_flip_fabric84.BCM8879X=1 +phy_tx_polarity_flip_fabric85.BCM8879X=0 +phy_tx_polarity_flip_fabric86.BCM8879X=1 +phy_tx_polarity_flip_fabric87.BCM8879X=0 + +phy_tx_polarity_flip_fabric88.BCM8879X=0 +phy_tx_polarity_flip_fabric89.BCM8879X=1 +phy_tx_polarity_flip_fabric90.BCM8879X=0 +phy_tx_polarity_flip_fabric91.BCM8879X=1 + +phy_tx_polarity_flip_fabric92.BCM8879X=0 +phy_tx_polarity_flip_fabric93.BCM8879X=1 +phy_tx_polarity_flip_fabric94.BCM8879X=0 +phy_tx_polarity_flip_fabric95.BCM8879X=1 + +phy_tx_polarity_flip_fabric96.BCM8879X=1 +phy_tx_polarity_flip_fabric97.BCM8879X=0 +phy_tx_polarity_flip_fabric98.BCM8879X=1 +phy_tx_polarity_flip_fabric99.BCM8879X=0 + +phy_tx_polarity_flip_fabric100.BCM8879X=0 +phy_tx_polarity_flip_fabric101.BCM8879X=1 +phy_tx_polarity_flip_fabric102.BCM8879X=0 +phy_tx_polarity_flip_fabric103.BCM8879X=1 + +phy_tx_polarity_flip_fabric104.BCM8879X=1 +phy_tx_polarity_flip_fabric105.BCM8879X=0 +phy_tx_polarity_flip_fabric106.BCM8879X=1 +phy_tx_polarity_flip_fabric107.BCM8879X=0 + +phy_tx_polarity_flip_fabric108.BCM8879X=1 +phy_tx_polarity_flip_fabric109.BCM8879X=0 +phy_tx_polarity_flip_fabric110.BCM8879X=1 +phy_tx_polarity_flip_fabric111.BCM8879X=0 + +phy_tx_polarity_flip_fabric112.BCM8879X=0 +phy_tx_polarity_flip_fabric113.BCM8879X=1 +phy_tx_polarity_flip_fabric114.BCM8879X=0 +phy_tx_polarity_flip_fabric115.BCM8879X=1 + +phy_tx_polarity_flip_fabric116.BCM8879X=1 +phy_tx_polarity_flip_fabric117.BCM8879X=0 +phy_tx_polarity_flip_fabric118.BCM8879X=1 +phy_tx_polarity_flip_fabric119.BCM8879X=0 + +phy_tx_polarity_flip_fabric120.BCM8879X=0 +phy_tx_polarity_flip_fabric121.BCM8879X=1 +phy_tx_polarity_flip_fabric122.BCM8879X=0 +phy_tx_polarity_flip_fabric123.BCM8879X=1 + +phy_tx_polarity_flip_fabric124.BCM8879X=0 +phy_tx_polarity_flip_fabric125.BCM8879X=1 +phy_tx_polarity_flip_fabric126.BCM8879X=0 +phy_tx_polarity_flip_fabric127.BCM8879X=1 + +phy_tx_polarity_flip_fabric128.BCM8879X=1 +phy_tx_polarity_flip_fabric129.BCM8879X=0 +phy_tx_polarity_flip_fabric130.BCM8879X=1 +phy_tx_polarity_flip_fabric131.BCM8879X=0 + +phy_tx_polarity_flip_fabric132.BCM8879X=0 +phy_tx_polarity_flip_fabric133.BCM8879X=1 +phy_tx_polarity_flip_fabric134.BCM8879X=0 +phy_tx_polarity_flip_fabric135.BCM8879X=1 + +phy_tx_polarity_flip_fabric136.BCM8879X=1 +phy_tx_polarity_flip_fabric137.BCM8879X=0 +phy_tx_polarity_flip_fabric138.BCM8879X=1 +phy_tx_polarity_flip_fabric139.BCM8879X=0 + +phy_tx_polarity_flip_fabric140.BCM8879X=0 +phy_tx_polarity_flip_fabric141.BCM8879X=1 +phy_tx_polarity_flip_fabric142.BCM8879X=0 +phy_tx_polarity_flip_fabric143.BCM8879X=1 + +phy_tx_polarity_flip_fabric144.BCM8879X=0 +phy_tx_polarity_flip_fabric145.BCM8879X=1 +phy_tx_polarity_flip_fabric146.BCM8879X=0 +phy_tx_polarity_flip_fabric147.BCM8879X=1 + +phy_tx_polarity_flip_fabric148.BCM8879X=1 +phy_tx_polarity_flip_fabric149.BCM8879X=0 +phy_tx_polarity_flip_fabric150.BCM8879X=1 +phy_tx_polarity_flip_fabric151.BCM8879X=0 + +phy_tx_polarity_flip_fabric152.BCM8879X=0 +phy_tx_polarity_flip_fabric153.BCM8879X=1 +phy_tx_polarity_flip_fabric154.BCM8879X=0 +phy_tx_polarity_flip_fabric155.BCM8879X=1 + +phy_tx_polarity_flip_fabric156.BCM8879X=1 +phy_tx_polarity_flip_fabric157.BCM8879X=0 +phy_tx_polarity_flip_fabric158.BCM8879X=1 +phy_tx_polarity_flip_fabric159.BCM8879X=0 + +phy_tx_polarity_flip_fabric160.BCM8879X=0 +phy_tx_polarity_flip_fabric161.BCM8879X=1 +phy_tx_polarity_flip_fabric162.BCM8879X=0 +phy_tx_polarity_flip_fabric163.BCM8879X=1 + +phy_tx_polarity_flip_fabric164.BCM8879X=0 +phy_tx_polarity_flip_fabric165.BCM8879X=1 +phy_tx_polarity_flip_fabric166.BCM8879X=0 +phy_tx_polarity_flip_fabric167.BCM8879X=1 + +phy_tx_polarity_flip_fabric168.BCM8879X=0 +phy_tx_polarity_flip_fabric169.BCM8879X=1 +phy_tx_polarity_flip_fabric170.BCM8879X=0 +phy_tx_polarity_flip_fabric171.BCM8879X=1 + +phy_tx_polarity_flip_fabric172.BCM8879X=1 +phy_tx_polarity_flip_fabric173.BCM8879X=0 +phy_tx_polarity_flip_fabric174.BCM8879X=1 +phy_tx_polarity_flip_fabric175.BCM8879X=0 + +phy_tx_polarity_flip_fabric176.BCM8879X=0 +phy_tx_polarity_flip_fabric177.BCM8879X=1 +phy_tx_polarity_flip_fabric178.BCM8879X=0 +phy_tx_polarity_flip_fabric179.BCM8879X=1 + +phy_tx_polarity_flip_fabric180.BCM8879X=1 +phy_tx_polarity_flip_fabric181.BCM8879X=0 +phy_tx_polarity_flip_fabric182.BCM8879X=1 +phy_tx_polarity_flip_fabric183.BCM8879X=0 + +phy_tx_polarity_flip_fabric184.BCM8879X=0 +phy_tx_polarity_flip_fabric185.BCM8879X=1 +phy_tx_polarity_flip_fabric186.BCM8879X=0 +phy_tx_polarity_flip_fabric187.BCM8879X=1 + +phy_tx_polarity_flip_fabric188.BCM8879X=0 +phy_tx_polarity_flip_fabric189.BCM8879X=1 +phy_tx_polarity_flip_fabric190.BCM8879X=0 +phy_tx_polarity_flip_fabric191.BCM8879X=1 + +port_init_cl72_0=0 +port_init_cl72_1=0 +port_init_cl72_2=0 +port_init_cl72_3=0 +port_init_cl72_4=0 +port_init_cl72_5=0 +port_init_cl72_6=0 +port_init_cl72_7=0 +port_init_cl72_8=0 +port_init_cl72_9=0 +port_init_cl72_10=0 +port_init_cl72_11=0 +port_init_cl72_12=0 +port_init_cl72_13=0 +port_init_cl72_14=0 +port_init_cl72_15=0 +port_init_cl72_16=0 +port_init_cl72_17=0 +port_init_cl72_18=0 +port_init_cl72_19=0 +port_init_cl72_20=0 +port_init_cl72_21=0 +port_init_cl72_22=0 +port_init_cl72_23=0 +port_init_cl72_24=0 +port_init_cl72_25=0 +port_init_cl72_26=0 +port_init_cl72_27=0 +port_init_cl72_28=0 +port_init_cl72_29=0 +port_init_cl72_30=0 +port_init_cl72_31=0 +port_init_cl72_32=0 +port_init_cl72_33=0 +port_init_cl72_34=0 +port_init_cl72_35=0 +port_init_cl72_36=0 +port_init_cl72_37=0 +port_init_cl72_38=0 +port_init_cl72_39=0 +port_init_cl72_40=0 +port_init_cl72_41=0 +port_init_cl72_42=0 +port_init_cl72_43=0 +port_init_cl72_44=0 +port_init_cl72_45=0 +port_init_cl72_46=0 +port_init_cl72_47=0 +port_init_cl72_48=0 +port_init_cl72_49=0 +port_init_cl72_50=0 +port_init_cl72_51=0 +port_init_cl72_52=0 +port_init_cl72_53=0 +port_init_cl72_54=0 +port_init_cl72_55=0 +port_init_cl72_56=0 +port_init_cl72_57=0 +port_init_cl72_58=0 +port_init_cl72_59=0 +port_init_cl72_60=0 +port_init_cl72_61=0 +port_init_cl72_62=0 +port_init_cl72_63=0 +port_init_cl72_64=0 +port_init_cl72_65=0 +port_init_cl72_66=0 +port_init_cl72_67=0 +port_init_cl72_68=0 +port_init_cl72_69=0 +port_init_cl72_70=0 +port_init_cl72_71=0 +port_init_cl72_72=0 +port_init_cl72_73=0 +port_init_cl72_74=0 +port_init_cl72_75=0 +port_init_cl72_76=0 +port_init_cl72_77=0 +port_init_cl72_78=0 +port_init_cl72_79=0 +port_init_cl72_80=0 +port_init_cl72_81=0 +port_init_cl72_82=0 +port_init_cl72_83=0 +port_init_cl72_84=0 +port_init_cl72_85=0 +port_init_cl72_86=0 +port_init_cl72_87=0 +port_init_cl72_88=0 +port_init_cl72_89=0 +port_init_cl72_90=0 +port_init_cl72_91=0 +port_init_cl72_92=0 +port_init_cl72_93=0 +port_init_cl72_94=0 +port_init_cl72_95=0 +port_init_cl72_96=0 +port_init_cl72_97=0 +port_init_cl72_98=0 +port_init_cl72_99=0 +port_init_cl72_100=0 +port_init_cl72_101=0 +port_init_cl72_102=0 +port_init_cl72_103=0 +port_init_cl72_104=0 +port_init_cl72_105=0 +port_init_cl72_106=0 +port_init_cl72_107=0 +port_init_cl72_108=0 +port_init_cl72_109=0 +port_init_cl72_110=0 +port_init_cl72_111=0 +port_init_cl72_112=0 +port_init_cl72_113=0 +port_init_cl72_114=0 +port_init_cl72_115=0 +port_init_cl72_116=0 +port_init_cl72_117=0 +port_init_cl72_118=0 +port_init_cl72_119=0 +port_init_cl72_120=0 +port_init_cl72_121=0 +port_init_cl72_122=0 +port_init_cl72_123=0 +port_init_cl72_124=0 +port_init_cl72_125=0 +port_init_cl72_126=0 +port_init_cl72_127=0 +port_init_cl72_128=0 +port_init_cl72_129=0 +port_init_cl72_130=0 +port_init_cl72_131=0 +port_init_cl72_132=0 +port_init_cl72_133=0 +port_init_cl72_134=0 +port_init_cl72_135=0 +port_init_cl72_136=0 +port_init_cl72_137=0 +port_init_cl72_138=0 +port_init_cl72_139=0 +port_init_cl72_140=0 +port_init_cl72_141=0 +port_init_cl72_142=0 +port_init_cl72_143=0 +port_init_cl72_144=0 +port_init_cl72_145=0 +port_init_cl72_146=0 +port_init_cl72_147=0 +port_init_cl72_148=0 +port_init_cl72_149=0 +port_init_cl72_150=0 +port_init_cl72_151=0 +port_init_cl72_152=0 +port_init_cl72_153=0 +port_init_cl72_154=0 +port_init_cl72_155=0 +port_init_cl72_156=0 +port_init_cl72_157=0 +port_init_cl72_158=0 +port_init_cl72_159=0 +port_init_cl72_160=0 +port_init_cl72_161=0 +port_init_cl72_162=0 +port_init_cl72_163=0 +port_init_cl72_164=0 +port_init_cl72_165=0 +port_init_cl72_166=0 +port_init_cl72_167=0 +port_init_cl72_168=0 +port_init_cl72_169=0 +port_init_cl72_170=0 +port_init_cl72_171=0 +port_init_cl72_172=0 +port_init_cl72_173=0 +port_init_cl72_174=0 +port_init_cl72_175=0 +port_init_cl72_176=0 +port_init_cl72_177=0 +port_init_cl72_178=0 +port_init_cl72_179=0 +port_init_cl72_180=0 +port_init_cl72_181=0 +port_init_cl72_182=0 +port_init_cl72_183=0 +port_init_cl72_184=0 +port_init_cl72_185=0 +port_init_cl72_186=0 +port_init_cl72_187=0 +port_init_cl72_188=0 +port_init_cl72_189=0 +port_init_cl72_190=0 +port_init_cl72_191=0 + +serdes_tx_taps_0.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_1.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_2.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_3.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_4.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_5.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_6.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_7.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_8.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_9.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_10.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_11.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_12.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_13.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_14.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_15.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_16.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_17.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_18.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_19.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_20.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_21.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_22.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_23.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_24.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_25.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_26.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_27.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_28.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_29.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_30.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_31.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_32.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_33.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_34.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_35.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_36.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_37.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_38.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_39.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_40.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_41.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_42.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_43.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_44.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_45.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_46.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_47.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_48.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_49.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_50.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_51.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_52.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_53.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_54.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_55.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_56.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_57.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_58.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_59.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_60.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_61.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_62.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_63.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_64.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_65.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_66.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_67.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_68.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_69.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_70.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_71.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_72.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_73.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_74.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_75.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_76.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_77.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_78.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_79.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_80.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_81.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_82.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_83.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_84.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_85.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_86.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_87.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_88.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_89.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_90.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_91.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_92.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_93.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_94.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_95.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_96.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_97.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_98.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_99.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_100.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_101.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_102.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_103.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_104.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_105.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_106.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_107.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_108.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_109.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_110.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_111.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_112.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_113.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_114.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_115.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_116.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_117.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_118.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_119.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_120.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_121.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_122.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_123.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_124.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_125.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_126.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_127.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_128.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_129.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_130.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_131.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_132.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_133.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_134.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_135.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_136.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_137.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_138.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_139.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_140.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_141.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_142.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_143.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_144.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_145.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_146.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_147.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_148.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_149.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_150.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_151.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_152.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_153.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_154.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_155.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_156.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_157.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_158.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_159.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_160.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_161.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_162.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_163.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_164.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_165.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_166.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_167.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_168.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_169.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_170.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_171.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_172.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_173.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_174.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_175.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_176.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_177.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_178.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_179.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_180.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_181.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_182.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_183.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_184.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_185.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_186.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_187.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_188.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_189.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_190.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_191.BCM8879X=pam4:-24:132:-12:0:0:0 + +serdes_lane_config_channel_mode_0.0=force_nr +serdes_lane_config_channel_mode_1.0=force_nr +serdes_lane_config_channel_mode_2.0=force_nr +serdes_lane_config_channel_mode_3.0=force_nr +serdes_lane_config_channel_mode_4.0=force_nr +serdes_lane_config_channel_mode_5.0=force_nr +serdes_lane_config_channel_mode_6.0=force_nr +serdes_lane_config_channel_mode_7.0=force_nr +serdes_lane_config_channel_mode_8.0=force_nr +serdes_lane_config_channel_mode_9.0=force_nr +serdes_lane_config_channel_mode_10.0=force_nr +serdes_lane_config_channel_mode_11.0=force_nr +serdes_lane_config_channel_mode_12.0=force_nr +serdes_lane_config_channel_mode_13.0=force_nr +serdes_lane_config_channel_mode_14.0=force_nr +serdes_lane_config_channel_mode_15.0=force_nr +serdes_lane_config_channel_mode_16.0=force_nr +serdes_lane_config_channel_mode_17.0=force_nr +serdes_lane_config_channel_mode_18.0=force_nr +serdes_lane_config_channel_mode_19.0=force_nr +serdes_lane_config_channel_mode_20.0=force_nr +serdes_lane_config_channel_mode_21.0=force_nr +serdes_lane_config_channel_mode_22.0=force_nr +serdes_lane_config_channel_mode_23.0=force_nr +serdes_lane_config_channel_mode_24.0=force_nr +serdes_lane_config_channel_mode_25.0=force_nr +serdes_lane_config_channel_mode_26.0=force_nr +serdes_lane_config_channel_mode_27.0=force_nr +serdes_lane_config_channel_mode_28.0=force_nr +serdes_lane_config_channel_mode_29.0=force_nr +serdes_lane_config_channel_mode_30.0=force_nr +serdes_lane_config_channel_mode_31.0=force_nr +serdes_lane_config_channel_mode_32.0=force_nr +serdes_lane_config_channel_mode_33.0=force_nr +serdes_lane_config_channel_mode_34.0=force_nr +serdes_lane_config_channel_mode_35.0=force_nr +serdes_lane_config_channel_mode_36.0=force_nr +serdes_lane_config_channel_mode_37.0=force_nr +serdes_lane_config_channel_mode_38.0=force_nr +serdes_lane_config_channel_mode_39.0=force_nr +serdes_lane_config_channel_mode_40.0=force_nr +serdes_lane_config_channel_mode_41.0=force_nr +serdes_lane_config_channel_mode_42.0=force_nr +serdes_lane_config_channel_mode_43.0=force_nr +serdes_lane_config_channel_mode_44.0=force_nr +serdes_lane_config_channel_mode_45.0=force_nr +serdes_lane_config_channel_mode_46.0=force_nr +serdes_lane_config_channel_mode_47.0=force_nr +serdes_lane_config_channel_mode_48.0=force_nr +serdes_lane_config_channel_mode_49.0=force_nr +serdes_lane_config_channel_mode_50.0=force_nr +serdes_lane_config_channel_mode_51.0=force_nr +serdes_lane_config_channel_mode_52.0=force_nr +serdes_lane_config_channel_mode_53.0=force_nr +serdes_lane_config_channel_mode_54.0=force_nr +serdes_lane_config_channel_mode_55.0=force_nr +serdes_lane_config_channel_mode_56.0=force_nr +serdes_lane_config_channel_mode_57.0=force_nr +serdes_lane_config_channel_mode_58.0=force_nr +serdes_lane_config_channel_mode_59.0=force_nr +serdes_lane_config_channel_mode_60.0=force_nr +serdes_lane_config_channel_mode_61.0=force_nr +serdes_lane_config_channel_mode_62.0=force_nr +serdes_lane_config_channel_mode_63.0=force_nr +serdes_lane_config_channel_mode_64.0=force_nr +serdes_lane_config_channel_mode_65.0=force_nr +serdes_lane_config_channel_mode_66.0=force_nr +serdes_lane_config_channel_mode_67.0=force_nr +serdes_lane_config_channel_mode_68.0=force_nr +serdes_lane_config_channel_mode_69.0=force_nr +serdes_lane_config_channel_mode_70.0=force_nr +serdes_lane_config_channel_mode_71.0=force_nr +serdes_lane_config_channel_mode_72.0=force_nr +serdes_lane_config_channel_mode_73.0=force_nr +serdes_lane_config_channel_mode_74.0=force_nr +serdes_lane_config_channel_mode_75.0=force_nr +serdes_lane_config_channel_mode_76.0=force_nr +serdes_lane_config_channel_mode_77.0=force_nr +serdes_lane_config_channel_mode_78.0=force_nr +serdes_lane_config_channel_mode_79.0=force_nr +serdes_lane_config_channel_mode_80.0=force_nr +serdes_lane_config_channel_mode_81.0=force_nr +serdes_lane_config_channel_mode_82.0=force_nr +serdes_lane_config_channel_mode_83.0=force_nr +serdes_lane_config_channel_mode_84.0=force_nr +serdes_lane_config_channel_mode_85.0=force_nr +serdes_lane_config_channel_mode_86.0=force_nr +serdes_lane_config_channel_mode_87.0=force_nr +serdes_lane_config_channel_mode_88.0=force_nr +serdes_lane_config_channel_mode_89.0=force_nr +serdes_lane_config_channel_mode_90.0=force_nr +serdes_lane_config_channel_mode_91.0=force_nr +serdes_lane_config_channel_mode_92.0=force_nr +serdes_lane_config_channel_mode_93.0=force_nr +serdes_lane_config_channel_mode_94.0=force_nr +serdes_lane_config_channel_mode_95.0=force_nr +serdes_lane_config_channel_mode_96.0=force_nr +serdes_lane_config_channel_mode_97.0=force_nr +serdes_lane_config_channel_mode_98.0=force_nr +serdes_lane_config_channel_mode_99.0=force_nr +serdes_lane_config_channel_mode_100.0=force_nr +serdes_lane_config_channel_mode_101.0=force_nr +serdes_lane_config_channel_mode_102.0=force_nr +serdes_lane_config_channel_mode_103.0=force_nr +serdes_lane_config_channel_mode_104.0=force_nr +serdes_lane_config_channel_mode_105.0=force_nr +serdes_lane_config_channel_mode_106.0=force_nr +serdes_lane_config_channel_mode_107.0=force_nr +serdes_lane_config_channel_mode_108.0=force_nr +serdes_lane_config_channel_mode_109.0=force_nr +serdes_lane_config_channel_mode_110.0=force_nr +serdes_lane_config_channel_mode_111.0=force_nr +serdes_lane_config_channel_mode_112.0=force_nr +serdes_lane_config_channel_mode_113.0=force_nr +serdes_lane_config_channel_mode_114.0=force_nr +serdes_lane_config_channel_mode_115.0=force_nr +serdes_lane_config_channel_mode_116.0=force_nr +serdes_lane_config_channel_mode_117.0=force_nr +serdes_lane_config_channel_mode_118.0=force_nr +serdes_lane_config_channel_mode_119.0=force_nr +serdes_lane_config_channel_mode_120.0=force_nr +serdes_lane_config_channel_mode_121.0=force_nr +serdes_lane_config_channel_mode_122.0=force_nr +serdes_lane_config_channel_mode_123.0=force_nr +serdes_lane_config_channel_mode_124.0=force_nr +serdes_lane_config_channel_mode_125.0=force_nr +serdes_lane_config_channel_mode_126.0=force_nr +serdes_lane_config_channel_mode_127.0=force_nr +serdes_lane_config_channel_mode_128.0=force_nr +serdes_lane_config_channel_mode_129.0=force_nr +serdes_lane_config_channel_mode_130.0=force_nr +serdes_lane_config_channel_mode_131.0=force_nr +serdes_lane_config_channel_mode_132.0=force_nr +serdes_lane_config_channel_mode_133.0=force_nr +serdes_lane_config_channel_mode_134.0=force_nr +serdes_lane_config_channel_mode_135.0=force_nr +serdes_lane_config_channel_mode_136.0=force_nr +serdes_lane_config_channel_mode_137.0=force_nr +serdes_lane_config_channel_mode_138.0=force_nr +serdes_lane_config_channel_mode_139.0=force_nr +serdes_lane_config_channel_mode_140.0=force_nr +serdes_lane_config_channel_mode_141.0=force_nr +serdes_lane_config_channel_mode_142.0=force_nr +serdes_lane_config_channel_mode_143.0=force_nr +serdes_lane_config_channel_mode_144.0=force_nr +serdes_lane_config_channel_mode_145.0=force_nr +serdes_lane_config_channel_mode_146.0=force_nr +serdes_lane_config_channel_mode_147.0=force_nr +serdes_lane_config_channel_mode_148.0=force_nr +serdes_lane_config_channel_mode_149.0=force_nr +serdes_lane_config_channel_mode_150.0=force_nr +serdes_lane_config_channel_mode_151.0=force_nr +serdes_lane_config_channel_mode_152.0=force_nr +serdes_lane_config_channel_mode_153.0=force_nr +serdes_lane_config_channel_mode_154.0=force_nr +serdes_lane_config_channel_mode_155.0=force_nr +serdes_lane_config_channel_mode_156.0=force_nr +serdes_lane_config_channel_mode_157.0=force_nr +serdes_lane_config_channel_mode_158.0=force_nr +serdes_lane_config_channel_mode_159.0=force_nr +serdes_lane_config_channel_mode_160.0=force_nr +serdes_lane_config_channel_mode_161.0=force_nr +serdes_lane_config_channel_mode_162.0=force_nr +serdes_lane_config_channel_mode_163.0=force_nr +serdes_lane_config_channel_mode_164.0=force_nr +serdes_lane_config_channel_mode_165.0=force_nr +serdes_lane_config_channel_mode_166.0=force_nr +serdes_lane_config_channel_mode_167.0=force_nr +serdes_lane_config_channel_mode_168.0=force_nr +serdes_lane_config_channel_mode_169.0=force_nr +serdes_lane_config_channel_mode_170.0=force_nr +serdes_lane_config_channel_mode_171.0=force_nr +serdes_lane_config_channel_mode_172.0=force_nr +serdes_lane_config_channel_mode_173.0=force_nr +serdes_lane_config_channel_mode_174.0=force_nr +serdes_lane_config_channel_mode_175.0=force_nr +serdes_lane_config_channel_mode_176.0=force_nr +serdes_lane_config_channel_mode_177.0=force_nr +serdes_lane_config_channel_mode_178.0=force_nr +serdes_lane_config_channel_mode_179.0=force_nr +serdes_lane_config_channel_mode_180.0=force_nr +serdes_lane_config_channel_mode_181.0=force_nr +serdes_lane_config_channel_mode_182.0=force_nr +serdes_lane_config_channel_mode_183.0=force_nr +serdes_lane_config_channel_mode_184.0=force_nr +serdes_lane_config_channel_mode_185.0=force_nr +serdes_lane_config_channel_mode_186.0=force_nr +serdes_lane_config_channel_mode_187.0=force_nr +serdes_lane_config_channel_mode_188.0=force_nr +serdes_lane_config_channel_mode_189.0=force_nr +serdes_lane_config_channel_mode_190.0=force_nr +serdes_lane_config_channel_mode_191.0=force_nr + + +serdes_qrtt_active_0.0=1 +serdes_qrtt_active_1.0=1 +serdes_qrtt_active_2.0=1 +serdes_qrtt_active_3.0=1 +serdes_qrtt_active_4.0=1 +serdes_qrtt_active_5.0=1 +serdes_qrtt_active_6.0=1 +serdes_qrtt_active_7.0=1 +serdes_qrtt_active_8.0=1 +serdes_qrtt_active_9.0=1 +serdes_qrtt_active_10.0=1 +serdes_qrtt_active_11.0=1 +serdes_qrtt_active_12.0=1 +serdes_qrtt_active_13.0=1 +serdes_qrtt_active_14.0=1 +serdes_qrtt_active_15.0=1 +serdes_qrtt_active_16.0=1 +serdes_qrtt_active_17.0=1 +serdes_qrtt_active_18.0=1 +serdes_qrtt_active_19.0=1 +serdes_qrtt_active_20.0=1 +serdes_qrtt_active_21.0=1 +serdes_qrtt_active_22.0=1 +serdes_qrtt_active_23.0=1 +serdes_qrtt_active_24.0=1 +serdes_qrtt_active_25.0=1 +serdes_qrtt_active_26.0=1 +serdes_qrtt_active_27.0=1 +serdes_qrtt_active_28.0=1 +serdes_qrtt_active_29.0=1 +serdes_qrtt_active_30.0=1 +serdes_qrtt_active_31.0=1 +serdes_qrtt_active_32.0=1 +serdes_qrtt_active_33.0=1 +serdes_qrtt_active_34.0=1 +serdes_qrtt_active_35.0=1 +serdes_qrtt_active_36.0=1 +serdes_qrtt_active_37.0=1 +serdes_qrtt_active_38.0=1 +serdes_qrtt_active_39.0=1 +serdes_qrtt_active_40.0=1 +serdes_qrtt_active_41.0=1 +serdes_qrtt_active_42.0=1 +serdes_qrtt_active_43.0=1 +serdes_qrtt_active_44.0=1 +serdes_qrtt_active_45.0=1 +serdes_qrtt_active_46.0=1 +serdes_qrtt_active_47.0=1 diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/14/config-ramon-8-0.bcm b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/14/config-ramon-8-0.bcm new file mode 100644 index 000000000000..ba21d010fa47 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/14/config-ramon-8-0.bcm @@ -0,0 +1,1396 @@ + +appl_enable_intr_init.BCM8879X=0 +appl_param_module_id.BCM8879X=15 +bcm_linkscan_interval.BCM8879X=0 +bcm_stat_interval.BCM8879X=4000000 +bist_enable.BCM8879X=0 +core_clock_speed_khz.BCM8879X=1000000 +custom_feature_access_only.BCM8879X=0 +custom_feature_lane_swap_disable.BCM8879X=0 +dport_map_direct.BCM8879X=1 +fabric_cell_fifo_dma_enable.BCM8879X=0 +fabric_device_mode.BCM8879X=SINGLE_STAGE_FE2 +fabric_load_balancing_mode.BCM8879X=NORMAL_LOAD_BALANCE +fabric_multicast_mode.BCM8879X=DIRECT +fabric_num_pipes.BCM8879X=1 +fabric_pipe_map.BCM8879X=0 +fe_mc_id_range.BCM8879X=128K +load_firmware.BCM8879X=0x102 +mdio_output_delay_ext.BCM8879X=14 +mdio_output_delay_int.BCM8879X=25 +mem_cache_enable_parity.BCM8879X=1 +mm_intr_enable.BCM8879X=0 +mm_timeout_usec.BCM8879X=300000 +polled_irq_delay.BCM8879X=100000 +polled_irq_mode.BCM8879X=1 +port_fec.BCM8879X=7 +port_init_cl72.BCM8879X=0 +port_init_speed.BCM8879X=53125 +rate_ext_mdio_divisor.BCM8879X=14 +rate_int_mdio_divisor.BCM8879X=50 +schan_intr_enable.BCM8879X=0 +schan_timeout_usec.BCM8879X=300000 +serdes_fabric_clk_freq_in.BCM8879X=1 +serdes_fabric_clk_freq_out.BCM8879X=bypass +soc_family.BCM8879X=BCM8879X +srd_tx_drv_hv_disable.BCM8879X=0 +system_contains_multiple_pipe_device.BCM8879X=0 +system_ref_core_clock_khz.BCM8879X=1200000 +table_dma_enable.BCM8879X=0 +tdma_intr_enable.BCM8879X=0 +tdma_timeout_usec.BCM8879X=5000000 +tslam_dma_enable.BCM8879X=0 +tslam_intr_enable.BCM8879X=0 +tslam_timeout_usec.BCM8879X=5000000 + +lane_to_serdes_map_fabric_lane0.BCM8879X=rx0:tx0 +lane_to_serdes_map_fabric_lane1.BCM8879X=rx1:tx1 +lane_to_serdes_map_fabric_lane2.BCM8879X=rx2:tx2 +lane_to_serdes_map_fabric_lane3.BCM8879X=rx3:tx3 + +lane_to_serdes_map_fabric_lane4.BCM8879X=rx4:tx4 +lane_to_serdes_map_fabric_lane5.BCM8879X=rx5:tx5 +lane_to_serdes_map_fabric_lane6.BCM8879X=rx6:tx6 +lane_to_serdes_map_fabric_lane7.BCM8879X=rx7:tx7 + +lane_to_serdes_map_fabric_lane8.BCM8879X=rx8:tx8 +lane_to_serdes_map_fabric_lane9.BCM8879X=rx9:tx9 +lane_to_serdes_map_fabric_lane10.BCM8879X=rx10:tx10 +lane_to_serdes_map_fabric_lane11.BCM8879X=rx11:tx11 + +lane_to_serdes_map_fabric_lane12.BCM8879X=rx12:tx12 +lane_to_serdes_map_fabric_lane13.BCM8879X=rx13:tx13 +lane_to_serdes_map_fabric_lane14.BCM8879X=rx14:tx14 +lane_to_serdes_map_fabric_lane15.BCM8879X=rx15:tx15 + +lane_to_serdes_map_fabric_lane16.BCM8879X=rx16:tx16 +lane_to_serdes_map_fabric_lane17.BCM8879X=rx17:tx17 +lane_to_serdes_map_fabric_lane18.BCM8879X=rx18:tx18 +lane_to_serdes_map_fabric_lane19.BCM8879X=rx19:tx19 + +lane_to_serdes_map_fabric_lane20.BCM8879X=rx20:tx20 +lane_to_serdes_map_fabric_lane21.BCM8879X=rx21:tx21 +lane_to_serdes_map_fabric_lane22.BCM8879X=rx22:tx22 +lane_to_serdes_map_fabric_lane23.BCM8879X=rx23:tx23 + +lane_to_serdes_map_fabric_lane24.BCM8879X=rx24:tx24 +lane_to_serdes_map_fabric_lane25.BCM8879X=rx25:tx25 +lane_to_serdes_map_fabric_lane26.BCM8879X=rx26:tx26 +lane_to_serdes_map_fabric_lane27.BCM8879X=rx27:tx27 + +lane_to_serdes_map_fabric_lane28.BCM8879X=rx28:tx28 +lane_to_serdes_map_fabric_lane29.BCM8879X=rx29:tx29 +lane_to_serdes_map_fabric_lane30.BCM8879X=rx30:tx30 +lane_to_serdes_map_fabric_lane31.BCM8879X=rx31:tx31 + +lane_to_serdes_map_fabric_lane32.BCM8879X=rx32:tx32 +lane_to_serdes_map_fabric_lane33.BCM8879X=rx33:tx33 +lane_to_serdes_map_fabric_lane34.BCM8879X=rx34:tx34 +lane_to_serdes_map_fabric_lane35.BCM8879X=rx35:tx35 + +lane_to_serdes_map_fabric_lane36.BCM8879X=rx36:tx36 +lane_to_serdes_map_fabric_lane37.BCM8879X=rx37:tx37 +lane_to_serdes_map_fabric_lane38.BCM8879X=rx38:tx38 +lane_to_serdes_map_fabric_lane39.BCM8879X=rx39:tx39 + +lane_to_serdes_map_fabric_lane40.BCM8879X=rx40:tx40 +lane_to_serdes_map_fabric_lane41.BCM8879X=rx41:tx41 +lane_to_serdes_map_fabric_lane42.BCM8879X=rx42:tx42 +lane_to_serdes_map_fabric_lane43.BCM8879X=rx43:tx43 + +lane_to_serdes_map_fabric_lane44.BCM8879X=rx44:tx44 +lane_to_serdes_map_fabric_lane45.BCM8879X=rx45:tx45 +lane_to_serdes_map_fabric_lane46.BCM8879X=rx46:tx46 +lane_to_serdes_map_fabric_lane47.BCM8879X=rx47:tx47 + +lane_to_serdes_map_fabric_lane48.BCM8879X=rx48:tx48 +lane_to_serdes_map_fabric_lane49.BCM8879X=rx49:tx49 +lane_to_serdes_map_fabric_lane50.BCM8879X=rx50:tx50 +lane_to_serdes_map_fabric_lane51.BCM8879X=rx51:tx51 + +lane_to_serdes_map_fabric_lane52.BCM8879X=rx52:tx52 +lane_to_serdes_map_fabric_lane53.BCM8879X=rx53:tx53 +lane_to_serdes_map_fabric_lane54.BCM8879X=rx54:tx54 +lane_to_serdes_map_fabric_lane55.BCM8879X=rx55:tx55 + +lane_to_serdes_map_fabric_lane56.BCM8879X=rx56:tx56 +lane_to_serdes_map_fabric_lane57.BCM8879X=rx57:tx57 +lane_to_serdes_map_fabric_lane58.BCM8879X=rx58:tx58 +lane_to_serdes_map_fabric_lane59.BCM8879X=rx59:tx59 + +lane_to_serdes_map_fabric_lane60.BCM8879X=rx60:tx60 +lane_to_serdes_map_fabric_lane61.BCM8879X=rx61:tx61 +lane_to_serdes_map_fabric_lane62.BCM8879X=rx62:tx62 +lane_to_serdes_map_fabric_lane63.BCM8879X=rx63:tx63 + +lane_to_serdes_map_fabric_lane64.BCM8879X=rx64:tx64 +lane_to_serdes_map_fabric_lane65.BCM8879X=rx65:tx65 +lane_to_serdes_map_fabric_lane66.BCM8879X=rx66:tx66 +lane_to_serdes_map_fabric_lane67.BCM8879X=rx67:tx67 + +lane_to_serdes_map_fabric_lane68.BCM8879X=rx68:tx68 +lane_to_serdes_map_fabric_lane69.BCM8879X=rx69:tx69 +lane_to_serdes_map_fabric_lane70.BCM8879X=rx70:tx70 +lane_to_serdes_map_fabric_lane71.BCM8879X=rx71:tx71 + +lane_to_serdes_map_fabric_lane72.BCM8879X=rx72:tx72 +lane_to_serdes_map_fabric_lane73.BCM8879X=rx73:tx73 +lane_to_serdes_map_fabric_lane74.BCM8879X=rx74:tx74 +lane_to_serdes_map_fabric_lane75.BCM8879X=rx75:tx75 + +lane_to_serdes_map_fabric_lane76.BCM8879X=rx76:tx76 +lane_to_serdes_map_fabric_lane77.BCM8879X=rx77:tx77 +lane_to_serdes_map_fabric_lane78.BCM8879X=rx78:tx78 +lane_to_serdes_map_fabric_lane79.BCM8879X=rx79:tx79 + +lane_to_serdes_map_fabric_lane80.BCM8879X=rx80:tx80 +lane_to_serdes_map_fabric_lane81.BCM8879X=rx81:tx81 +lane_to_serdes_map_fabric_lane82.BCM8879X=rx82:tx82 +lane_to_serdes_map_fabric_lane83.BCM8879X=rx83:tx83 + +lane_to_serdes_map_fabric_lane84.BCM8879X=rx84:tx84 +lane_to_serdes_map_fabric_lane85.BCM8879X=rx85:tx85 +lane_to_serdes_map_fabric_lane86.BCM8879X=rx86:tx86 +lane_to_serdes_map_fabric_lane87.BCM8879X=rx87:tx87 + +lane_to_serdes_map_fabric_lane88.BCM8879X=rx88:tx88 +lane_to_serdes_map_fabric_lane89.BCM8879X=rx89:tx89 +lane_to_serdes_map_fabric_lane90.BCM8879X=rx90:tx90 +lane_to_serdes_map_fabric_lane91.BCM8879X=rx91:tx91 + +lane_to_serdes_map_fabric_lane92.BCM8879X=rx92:tx92 +lane_to_serdes_map_fabric_lane93.BCM8879X=rx93:tx93 +lane_to_serdes_map_fabric_lane94.BCM8879X=rx94:tx94 +lane_to_serdes_map_fabric_lane95.BCM8879X=rx95:tx95 + +lane_to_serdes_map_fabric_lane96.BCM8879X=rx96:tx96 +lane_to_serdes_map_fabric_lane97.BCM8879X=rx97:tx97 +lane_to_serdes_map_fabric_lane98.BCM8879X=rx98:tx98 +lane_to_serdes_map_fabric_lane99.BCM8879X=rx99:tx99 + +lane_to_serdes_map_fabric_lane100.BCM8879X=rx100:tx100 +lane_to_serdes_map_fabric_lane101.BCM8879X=rx101:tx101 +lane_to_serdes_map_fabric_lane102.BCM8879X=rx102:tx102 +lane_to_serdes_map_fabric_lane103.BCM8879X=rx103:tx103 + +lane_to_serdes_map_fabric_lane104.BCM8879X=rx104:tx104 +lane_to_serdes_map_fabric_lane105.BCM8879X=rx105:tx105 +lane_to_serdes_map_fabric_lane106.BCM8879X=rx106:tx106 +lane_to_serdes_map_fabric_lane107.BCM8879X=rx107:tx107 + +lane_to_serdes_map_fabric_lane108.BCM8879X=rx108:tx108 +lane_to_serdes_map_fabric_lane109.BCM8879X=rx109:tx109 +lane_to_serdes_map_fabric_lane110.BCM8879X=rx110:tx110 +lane_to_serdes_map_fabric_lane111.BCM8879X=rx111:tx111 + +lane_to_serdes_map_fabric_lane112.BCM8879X=rx112:tx112 +lane_to_serdes_map_fabric_lane113.BCM8879X=rx113:tx113 +lane_to_serdes_map_fabric_lane114.BCM8879X=rx114:tx114 +lane_to_serdes_map_fabric_lane115.BCM8879X=rx115:tx115 + +lane_to_serdes_map_fabric_lane116.BCM8879X=rx116:tx116 +lane_to_serdes_map_fabric_lane117.BCM8879X=rx117:tx117 +lane_to_serdes_map_fabric_lane118.BCM8879X=rx118:tx118 +lane_to_serdes_map_fabric_lane119.BCM8879X=rx119:tx119 + +lane_to_serdes_map_fabric_lane120.BCM8879X=rx120:tx120 +lane_to_serdes_map_fabric_lane121.BCM8879X=rx121:tx121 +lane_to_serdes_map_fabric_lane122.BCM8879X=rx122:tx122 +lane_to_serdes_map_fabric_lane123.BCM8879X=rx123:tx123 + +lane_to_serdes_map_fabric_lane124.BCM8879X=rx124:tx124 +lane_to_serdes_map_fabric_lane125.BCM8879X=rx125:tx125 +lane_to_serdes_map_fabric_lane126.BCM8879X=rx126:tx126 +lane_to_serdes_map_fabric_lane127.BCM8879X=rx127:tx127 + +lane_to_serdes_map_fabric_lane128.BCM8879X=rx128:tx128 +lane_to_serdes_map_fabric_lane129.BCM8879X=rx129:tx129 +lane_to_serdes_map_fabric_lane130.BCM8879X=rx130:tx130 +lane_to_serdes_map_fabric_lane131.BCM8879X=rx131:tx131 + +lane_to_serdes_map_fabric_lane132.BCM8879X=rx132:tx132 +lane_to_serdes_map_fabric_lane133.BCM8879X=rx133:tx133 +lane_to_serdes_map_fabric_lane134.BCM8879X=rx134:tx134 +lane_to_serdes_map_fabric_lane135.BCM8879X=rx135:tx135 + +lane_to_serdes_map_fabric_lane136.BCM8879X=rx136:tx136 +lane_to_serdes_map_fabric_lane137.BCM8879X=rx137:tx137 +lane_to_serdes_map_fabric_lane138.BCM8879X=rx138:tx138 +lane_to_serdes_map_fabric_lane139.BCM8879X=rx139:tx139 + +lane_to_serdes_map_fabric_lane140.BCM8879X=rx140:tx140 +lane_to_serdes_map_fabric_lane141.BCM8879X=rx141:tx141 +lane_to_serdes_map_fabric_lane142.BCM8879X=rx142:tx142 +lane_to_serdes_map_fabric_lane143.BCM8879X=rx143:tx143 + +lane_to_serdes_map_fabric_lane144.BCM8879X=rx144:tx144 +lane_to_serdes_map_fabric_lane145.BCM8879X=rx145:tx145 +lane_to_serdes_map_fabric_lane146.BCM8879X=rx146:tx146 +lane_to_serdes_map_fabric_lane147.BCM8879X=rx147:tx147 + +lane_to_serdes_map_fabric_lane148.BCM8879X=rx148:tx148 +lane_to_serdes_map_fabric_lane149.BCM8879X=rx149:tx149 +lane_to_serdes_map_fabric_lane150.BCM8879X=rx150:tx150 +lane_to_serdes_map_fabric_lane151.BCM8879X=rx151:tx151 + +lane_to_serdes_map_fabric_lane152.BCM8879X=rx152:tx152 +lane_to_serdes_map_fabric_lane153.BCM8879X=rx153:tx153 +lane_to_serdes_map_fabric_lane154.BCM8879X=rx154:tx154 +lane_to_serdes_map_fabric_lane155.BCM8879X=rx155:tx155 + +lane_to_serdes_map_fabric_lane156.BCM8879X=rx156:tx156 +lane_to_serdes_map_fabric_lane157.BCM8879X=rx157:tx157 +lane_to_serdes_map_fabric_lane158.BCM8879X=rx158:tx158 +lane_to_serdes_map_fabric_lane159.BCM8879X=rx159:tx159 + +lane_to_serdes_map_fabric_lane160.BCM8879X=rx160:tx160 +lane_to_serdes_map_fabric_lane161.BCM8879X=rx161:tx161 +lane_to_serdes_map_fabric_lane162.BCM8879X=rx162:tx162 +lane_to_serdes_map_fabric_lane163.BCM8879X=rx163:tx163 + +lane_to_serdes_map_fabric_lane164.BCM8879X=rx164:tx164 +lane_to_serdes_map_fabric_lane165.BCM8879X=rx165:tx165 +lane_to_serdes_map_fabric_lane166.BCM8879X=rx166:tx166 +lane_to_serdes_map_fabric_lane167.BCM8879X=rx167:tx167 + +lane_to_serdes_map_fabric_lane168.BCM8879X=rx168:tx168 +lane_to_serdes_map_fabric_lane169.BCM8879X=rx169:tx169 +lane_to_serdes_map_fabric_lane170.BCM8879X=rx170:tx170 +lane_to_serdes_map_fabric_lane171.BCM8879X=rx171:tx171 + +lane_to_serdes_map_fabric_lane172.BCM8879X=rx172:tx172 +lane_to_serdes_map_fabric_lane173.BCM8879X=rx173:tx173 +lane_to_serdes_map_fabric_lane174.BCM8879X=rx174:tx174 +lane_to_serdes_map_fabric_lane175.BCM8879X=rx175:tx175 + +lane_to_serdes_map_fabric_lane176.BCM8879X=rx176:tx176 +lane_to_serdes_map_fabric_lane177.BCM8879X=rx177:tx177 +lane_to_serdes_map_fabric_lane178.BCM8879X=rx178:tx178 +lane_to_serdes_map_fabric_lane179.BCM8879X=rx179:tx179 + +lane_to_serdes_map_fabric_lane180.BCM8879X=rx180:tx180 +lane_to_serdes_map_fabric_lane181.BCM8879X=rx181:tx181 +lane_to_serdes_map_fabric_lane182.BCM8879X=rx182:tx182 +lane_to_serdes_map_fabric_lane183.BCM8879X=rx183:tx183 + +lane_to_serdes_map_fabric_lane184.BCM8879X=rx184:tx184 +lane_to_serdes_map_fabric_lane185.BCM8879X=rx185:tx185 +lane_to_serdes_map_fabric_lane186.BCM8879X=rx186:tx186 +lane_to_serdes_map_fabric_lane187.BCM8879X=rx187:tx187 + +lane_to_serdes_map_fabric_lane188.BCM8879X=rx188:tx188 +lane_to_serdes_map_fabric_lane189.BCM8879X=rx189:tx189 +lane_to_serdes_map_fabric_lane190.BCM8879X=rx190:tx190 +lane_to_serdes_map_fabric_lane191.BCM8879X=rx191:tx191 + + +phy_rx_polarity_flip_fabric0.BCM8879X=1 +phy_rx_polarity_flip_fabric1.BCM8879X=0 +phy_rx_polarity_flip_fabric2.BCM8879X=1 +phy_rx_polarity_flip_fabric3.BCM8879X=0 + +phy_rx_polarity_flip_fabric4.BCM8879X=0 +phy_rx_polarity_flip_fabric5.BCM8879X=1 +phy_rx_polarity_flip_fabric6.BCM8879X=0 +phy_rx_polarity_flip_fabric7.BCM8879X=1 + +phy_rx_polarity_flip_fabric8.BCM8879X=1 +phy_rx_polarity_flip_fabric9.BCM8879X=0 +phy_rx_polarity_flip_fabric10.BCM8879X=1 +phy_rx_polarity_flip_fabric11.BCM8879X=0 + +phy_rx_polarity_flip_fabric12.BCM8879X=0 +phy_rx_polarity_flip_fabric13.BCM8879X=1 +phy_rx_polarity_flip_fabric14.BCM8879X=0 +phy_rx_polarity_flip_fabric15.BCM8879X=1 + +phy_rx_polarity_flip_fabric16.BCM8879X=1 +phy_rx_polarity_flip_fabric17.BCM8879X=0 +phy_rx_polarity_flip_fabric18.BCM8879X=1 +phy_rx_polarity_flip_fabric19.BCM8879X=0 + +phy_rx_polarity_flip_fabric20.BCM8879X=1 +phy_rx_polarity_flip_fabric21.BCM8879X=0 +phy_rx_polarity_flip_fabric22.BCM8879X=1 +phy_rx_polarity_flip_fabric23.BCM8879X=0 + +phy_rx_polarity_flip_fabric24.BCM8879X=1 +phy_rx_polarity_flip_fabric25.BCM8879X=0 +phy_rx_polarity_flip_fabric26.BCM8879X=1 +phy_rx_polarity_flip_fabric27.BCM8879X=0 + +phy_rx_polarity_flip_fabric28.BCM8879X=0 +phy_rx_polarity_flip_fabric29.BCM8879X=1 +phy_rx_polarity_flip_fabric30.BCM8879X=0 +phy_rx_polarity_flip_fabric31.BCM8879X=1 + +phy_rx_polarity_flip_fabric32.BCM8879X=1 +phy_rx_polarity_flip_fabric33.BCM8879X=0 +phy_rx_polarity_flip_fabric34.BCM8879X=1 +phy_rx_polarity_flip_fabric35.BCM8879X=0 + +phy_rx_polarity_flip_fabric36.BCM8879X=0 +phy_rx_polarity_flip_fabric37.BCM8879X=1 +phy_rx_polarity_flip_fabric38.BCM8879X=0 +phy_rx_polarity_flip_fabric39.BCM8879X=1 + +phy_rx_polarity_flip_fabric40.BCM8879X=1 +phy_rx_polarity_flip_fabric41.BCM8879X=0 +phy_rx_polarity_flip_fabric42.BCM8879X=1 +phy_rx_polarity_flip_fabric43.BCM8879X=0 + +phy_rx_polarity_flip_fabric44.BCM8879X=1 +phy_rx_polarity_flip_fabric45.BCM8879X=0 +phy_rx_polarity_flip_fabric46.BCM8879X=1 +phy_rx_polarity_flip_fabric47.BCM8879X=0 + +phy_rx_polarity_flip_fabric48.BCM8879X=0 +phy_rx_polarity_flip_fabric49.BCM8879X=1 +phy_rx_polarity_flip_fabric50.BCM8879X=0 +phy_rx_polarity_flip_fabric51.BCM8879X=1 + +phy_rx_polarity_flip_fabric52.BCM8879X=1 +phy_rx_polarity_flip_fabric53.BCM8879X=0 +phy_rx_polarity_flip_fabric54.BCM8879X=1 +phy_rx_polarity_flip_fabric55.BCM8879X=0 + +phy_rx_polarity_flip_fabric56.BCM8879X=0 +phy_rx_polarity_flip_fabric57.BCM8879X=1 +phy_rx_polarity_flip_fabric58.BCM8879X=0 +phy_rx_polarity_flip_fabric59.BCM8879X=1 + +phy_rx_polarity_flip_fabric60.BCM8879X=0 +phy_rx_polarity_flip_fabric61.BCM8879X=1 +phy_rx_polarity_flip_fabric62.BCM8879X=0 +phy_rx_polarity_flip_fabric63.BCM8879X=1 + +phy_rx_polarity_flip_fabric64.BCM8879X=1 +phy_rx_polarity_flip_fabric65.BCM8879X=0 +phy_rx_polarity_flip_fabric66.BCM8879X=1 +phy_rx_polarity_flip_fabric67.BCM8879X=0 + +phy_rx_polarity_flip_fabric68.BCM8879X=0 +phy_rx_polarity_flip_fabric69.BCM8879X=1 +phy_rx_polarity_flip_fabric70.BCM8879X=0 +phy_rx_polarity_flip_fabric71.BCM8879X=1 + +phy_rx_polarity_flip_fabric72.BCM8879X=1 +phy_rx_polarity_flip_fabric73.BCM8879X=0 +phy_rx_polarity_flip_fabric74.BCM8879X=1 +phy_rx_polarity_flip_fabric75.BCM8879X=0 + +phy_rx_polarity_flip_fabric76.BCM8879X=1 +phy_rx_polarity_flip_fabric77.BCM8879X=0 +phy_rx_polarity_flip_fabric78.BCM8879X=1 +phy_rx_polarity_flip_fabric79.BCM8879X=0 + +phy_rx_polarity_flip_fabric80.BCM8879X=0 +phy_rx_polarity_flip_fabric81.BCM8879X=1 +phy_rx_polarity_flip_fabric82.BCM8879X=0 +phy_rx_polarity_flip_fabric83.BCM8879X=1 + +phy_rx_polarity_flip_fabric84.BCM8879X=1 +phy_rx_polarity_flip_fabric85.BCM8879X=0 +phy_rx_polarity_flip_fabric86.BCM8879X=1 +phy_rx_polarity_flip_fabric87.BCM8879X=0 + +phy_rx_polarity_flip_fabric88.BCM8879X=0 +phy_rx_polarity_flip_fabric89.BCM8879X=1 +phy_rx_polarity_flip_fabric90.BCM8879X=0 +phy_rx_polarity_flip_fabric91.BCM8879X=1 + +phy_rx_polarity_flip_fabric92.BCM8879X=1 +phy_rx_polarity_flip_fabric93.BCM8879X=0 +phy_rx_polarity_flip_fabric94.BCM8879X=1 +phy_rx_polarity_flip_fabric95.BCM8879X=0 + +phy_rx_polarity_flip_fabric96.BCM8879X=1 +phy_rx_polarity_flip_fabric97.BCM8879X=0 +phy_rx_polarity_flip_fabric98.BCM8879X=1 +phy_rx_polarity_flip_fabric99.BCM8879X=0 + +phy_rx_polarity_flip_fabric100.BCM8879X=0 +phy_rx_polarity_flip_fabric101.BCM8879X=1 +phy_rx_polarity_flip_fabric102.BCM8879X=0 +phy_rx_polarity_flip_fabric103.BCM8879X=1 + +phy_rx_polarity_flip_fabric104.BCM8879X=0 +phy_rx_polarity_flip_fabric105.BCM8879X=1 +phy_rx_polarity_flip_fabric106.BCM8879X=0 +phy_rx_polarity_flip_fabric107.BCM8879X=1 + +phy_rx_polarity_flip_fabric108.BCM8879X=0 +phy_rx_polarity_flip_fabric109.BCM8879X=1 +phy_rx_polarity_flip_fabric110.BCM8879X=0 +phy_rx_polarity_flip_fabric111.BCM8879X=1 + +phy_rx_polarity_flip_fabric112.BCM8879X=0 +phy_rx_polarity_flip_fabric113.BCM8879X=1 +phy_rx_polarity_flip_fabric114.BCM8879X=0 +phy_rx_polarity_flip_fabric115.BCM8879X=1 + +phy_rx_polarity_flip_fabric116.BCM8879X=1 +phy_rx_polarity_flip_fabric117.BCM8879X=0 +phy_rx_polarity_flip_fabric118.BCM8879X=1 +phy_rx_polarity_flip_fabric119.BCM8879X=0 + +phy_rx_polarity_flip_fabric120.BCM8879X=1 +phy_rx_polarity_flip_fabric121.BCM8879X=0 +phy_rx_polarity_flip_fabric122.BCM8879X=1 +phy_rx_polarity_flip_fabric123.BCM8879X=0 + +phy_rx_polarity_flip_fabric124.BCM8879X=0 +phy_rx_polarity_flip_fabric125.BCM8879X=1 +phy_rx_polarity_flip_fabric126.BCM8879X=0 +phy_rx_polarity_flip_fabric127.BCM8879X=1 + +phy_rx_polarity_flip_fabric128.BCM8879X=1 +phy_rx_polarity_flip_fabric129.BCM8879X=0 +phy_rx_polarity_flip_fabric130.BCM8879X=1 +phy_rx_polarity_flip_fabric131.BCM8879X=0 + +phy_rx_polarity_flip_fabric132.BCM8879X=0 +phy_rx_polarity_flip_fabric133.BCM8879X=1 +phy_rx_polarity_flip_fabric134.BCM8879X=0 +phy_rx_polarity_flip_fabric135.BCM8879X=1 + +phy_rx_polarity_flip_fabric136.BCM8879X=1 +phy_rx_polarity_flip_fabric137.BCM8879X=0 +phy_rx_polarity_flip_fabric138.BCM8879X=1 +phy_rx_polarity_flip_fabric139.BCM8879X=0 + +phy_rx_polarity_flip_fabric140.BCM8879X=1 +phy_rx_polarity_flip_fabric141.BCM8879X=0 +phy_rx_polarity_flip_fabric142.BCM8879X=1 +phy_rx_polarity_flip_fabric143.BCM8879X=0 + +phy_rx_polarity_flip_fabric144.BCM8879X=1 +phy_rx_polarity_flip_fabric145.BCM8879X=0 +phy_rx_polarity_flip_fabric146.BCM8879X=1 +phy_rx_polarity_flip_fabric147.BCM8879X=0 + +phy_rx_polarity_flip_fabric148.BCM8879X=1 +phy_rx_polarity_flip_fabric149.BCM8879X=0 +phy_rx_polarity_flip_fabric150.BCM8879X=1 +phy_rx_polarity_flip_fabric151.BCM8879X=0 + +phy_rx_polarity_flip_fabric152.BCM8879X=0 +phy_rx_polarity_flip_fabric153.BCM8879X=1 +phy_rx_polarity_flip_fabric154.BCM8879X=0 +phy_rx_polarity_flip_fabric155.BCM8879X=1 + +phy_rx_polarity_flip_fabric156.BCM8879X=1 +phy_rx_polarity_flip_fabric157.BCM8879X=0 +phy_rx_polarity_flip_fabric158.BCM8879X=1 +phy_rx_polarity_flip_fabric159.BCM8879X=0 + +phy_rx_polarity_flip_fabric160.BCM8879X=1 +phy_rx_polarity_flip_fabric161.BCM8879X=0 +phy_rx_polarity_flip_fabric162.BCM8879X=1 +phy_rx_polarity_flip_fabric163.BCM8879X=0 + +phy_rx_polarity_flip_fabric164.BCM8879X=0 +phy_rx_polarity_flip_fabric165.BCM8879X=1 +phy_rx_polarity_flip_fabric166.BCM8879X=0 +phy_rx_polarity_flip_fabric167.BCM8879X=1 + +phy_rx_polarity_flip_fabric168.BCM8879X=1 +phy_rx_polarity_flip_fabric169.BCM8879X=0 +phy_rx_polarity_flip_fabric170.BCM8879X=1 +phy_rx_polarity_flip_fabric171.BCM8879X=0 + +phy_rx_polarity_flip_fabric172.BCM8879X=1 +phy_rx_polarity_flip_fabric173.BCM8879X=0 +phy_rx_polarity_flip_fabric174.BCM8879X=1 +phy_rx_polarity_flip_fabric175.BCM8879X=0 + +phy_rx_polarity_flip_fabric176.BCM8879X=0 +phy_rx_polarity_flip_fabric177.BCM8879X=1 +phy_rx_polarity_flip_fabric178.BCM8879X=0 +phy_rx_polarity_flip_fabric179.BCM8879X=1 + +phy_rx_polarity_flip_fabric180.BCM8879X=1 +phy_rx_polarity_flip_fabric181.BCM8879X=0 +phy_rx_polarity_flip_fabric182.BCM8879X=1 +phy_rx_polarity_flip_fabric183.BCM8879X=0 + +phy_rx_polarity_flip_fabric184.BCM8879X=0 +phy_rx_polarity_flip_fabric185.BCM8879X=1 +phy_rx_polarity_flip_fabric186.BCM8879X=0 +phy_rx_polarity_flip_fabric187.BCM8879X=1 + +phy_rx_polarity_flip_fabric188.BCM8879X=1 +phy_rx_polarity_flip_fabric189.BCM8879X=0 +phy_rx_polarity_flip_fabric190.BCM8879X=1 +phy_rx_polarity_flip_fabric191.BCM8879X=0 + +phy_tx_polarity_flip_fabric0.BCM8879X=0 +phy_tx_polarity_flip_fabric1.BCM8879X=1 +phy_tx_polarity_flip_fabric2.BCM8879X=0 +phy_tx_polarity_flip_fabric3.BCM8879X=1 + +phy_tx_polarity_flip_fabric4.BCM8879X=1 +phy_tx_polarity_flip_fabric5.BCM8879X=0 +phy_tx_polarity_flip_fabric6.BCM8879X=1 +phy_tx_polarity_flip_fabric7.BCM8879X=0 + +phy_tx_polarity_flip_fabric8.BCM8879X=0 +phy_tx_polarity_flip_fabric9.BCM8879X=1 +phy_tx_polarity_flip_fabric10.BCM8879X=0 +phy_tx_polarity_flip_fabric11.BCM8879X=1 + +phy_tx_polarity_flip_fabric12.BCM8879X=1 +phy_tx_polarity_flip_fabric13.BCM8879X=0 +phy_tx_polarity_flip_fabric14.BCM8879X=1 +phy_tx_polarity_flip_fabric15.BCM8879X=0 + +phy_tx_polarity_flip_fabric16.BCM8879X=0 +phy_tx_polarity_flip_fabric17.BCM8879X=1 +phy_tx_polarity_flip_fabric18.BCM8879X=0 +phy_tx_polarity_flip_fabric19.BCM8879X=1 + +phy_tx_polarity_flip_fabric20.BCM8879X=0 +phy_tx_polarity_flip_fabric21.BCM8879X=1 +phy_tx_polarity_flip_fabric22.BCM8879X=0 +phy_tx_polarity_flip_fabric23.BCM8879X=1 + +phy_tx_polarity_flip_fabric24.BCM8879X=0 +phy_tx_polarity_flip_fabric25.BCM8879X=1 +phy_tx_polarity_flip_fabric26.BCM8879X=0 +phy_tx_polarity_flip_fabric27.BCM8879X=1 + +phy_tx_polarity_flip_fabric28.BCM8879X=1 +phy_tx_polarity_flip_fabric29.BCM8879X=0 +phy_tx_polarity_flip_fabric30.BCM8879X=1 +phy_tx_polarity_flip_fabric31.BCM8879X=0 + +phy_tx_polarity_flip_fabric32.BCM8879X=0 +phy_tx_polarity_flip_fabric33.BCM8879X=1 +phy_tx_polarity_flip_fabric34.BCM8879X=0 +phy_tx_polarity_flip_fabric35.BCM8879X=1 + +phy_tx_polarity_flip_fabric36.BCM8879X=1 +phy_tx_polarity_flip_fabric37.BCM8879X=0 +phy_tx_polarity_flip_fabric38.BCM8879X=1 +phy_tx_polarity_flip_fabric39.BCM8879X=0 + +phy_tx_polarity_flip_fabric40.BCM8879X=0 +phy_tx_polarity_flip_fabric41.BCM8879X=1 +phy_tx_polarity_flip_fabric42.BCM8879X=0 +phy_tx_polarity_flip_fabric43.BCM8879X=1 + +phy_tx_polarity_flip_fabric44.BCM8879X=0 +phy_tx_polarity_flip_fabric45.BCM8879X=1 +phy_tx_polarity_flip_fabric46.BCM8879X=0 +phy_tx_polarity_flip_fabric47.BCM8879X=1 + +phy_tx_polarity_flip_fabric48.BCM8879X=1 +phy_tx_polarity_flip_fabric49.BCM8879X=0 +phy_tx_polarity_flip_fabric50.BCM8879X=1 +phy_tx_polarity_flip_fabric51.BCM8879X=0 + +phy_tx_polarity_flip_fabric52.BCM8879X=0 +phy_tx_polarity_flip_fabric53.BCM8879X=1 +phy_tx_polarity_flip_fabric54.BCM8879X=0 +phy_tx_polarity_flip_fabric55.BCM8879X=1 + +phy_tx_polarity_flip_fabric56.BCM8879X=1 +phy_tx_polarity_flip_fabric57.BCM8879X=0 +phy_tx_polarity_flip_fabric58.BCM8879X=1 +phy_tx_polarity_flip_fabric59.BCM8879X=0 + +phy_tx_polarity_flip_fabric60.BCM8879X=1 +phy_tx_polarity_flip_fabric61.BCM8879X=0 +phy_tx_polarity_flip_fabric62.BCM8879X=1 +phy_tx_polarity_flip_fabric63.BCM8879X=0 + +phy_tx_polarity_flip_fabric64.BCM8879X=0 +phy_tx_polarity_flip_fabric65.BCM8879X=1 +phy_tx_polarity_flip_fabric66.BCM8879X=0 +phy_tx_polarity_flip_fabric67.BCM8879X=1 + +phy_tx_polarity_flip_fabric68.BCM8879X=1 +phy_tx_polarity_flip_fabric69.BCM8879X=0 +phy_tx_polarity_flip_fabric70.BCM8879X=1 +phy_tx_polarity_flip_fabric71.BCM8879X=0 + +phy_tx_polarity_flip_fabric72.BCM8879X=0 +phy_tx_polarity_flip_fabric73.BCM8879X=1 +phy_tx_polarity_flip_fabric74.BCM8879X=0 +phy_tx_polarity_flip_fabric75.BCM8879X=1 + +phy_tx_polarity_flip_fabric76.BCM8879X=0 +phy_tx_polarity_flip_fabric77.BCM8879X=1 +phy_tx_polarity_flip_fabric78.BCM8879X=0 +phy_tx_polarity_flip_fabric79.BCM8879X=1 + +phy_tx_polarity_flip_fabric80.BCM8879X=1 +phy_tx_polarity_flip_fabric81.BCM8879X=0 +phy_tx_polarity_flip_fabric82.BCM8879X=1 +phy_tx_polarity_flip_fabric83.BCM8879X=0 + +phy_tx_polarity_flip_fabric84.BCM8879X=0 +phy_tx_polarity_flip_fabric85.BCM8879X=1 +phy_tx_polarity_flip_fabric86.BCM8879X=0 +phy_tx_polarity_flip_fabric87.BCM8879X=1 + +phy_tx_polarity_flip_fabric88.BCM8879X=1 +phy_tx_polarity_flip_fabric89.BCM8879X=0 +phy_tx_polarity_flip_fabric90.BCM8879X=1 +phy_tx_polarity_flip_fabric91.BCM8879X=0 + +phy_tx_polarity_flip_fabric92.BCM8879X=0 +phy_tx_polarity_flip_fabric93.BCM8879X=1 +phy_tx_polarity_flip_fabric94.BCM8879X=0 +phy_tx_polarity_flip_fabric95.BCM8879X=1 + +phy_tx_polarity_flip_fabric96.BCM8879X=0 +phy_tx_polarity_flip_fabric97.BCM8879X=1 +phy_tx_polarity_flip_fabric98.BCM8879X=0 +phy_tx_polarity_flip_fabric99.BCM8879X=1 + +phy_tx_polarity_flip_fabric100.BCM8879X=1 +phy_tx_polarity_flip_fabric101.BCM8879X=0 +phy_tx_polarity_flip_fabric102.BCM8879X=1 +phy_tx_polarity_flip_fabric103.BCM8879X=0 + +phy_tx_polarity_flip_fabric104.BCM8879X=1 +phy_tx_polarity_flip_fabric105.BCM8879X=0 +phy_tx_polarity_flip_fabric106.BCM8879X=1 +phy_tx_polarity_flip_fabric107.BCM8879X=0 + +phy_tx_polarity_flip_fabric108.BCM8879X=1 +phy_tx_polarity_flip_fabric109.BCM8879X=0 +phy_tx_polarity_flip_fabric110.BCM8879X=1 +phy_tx_polarity_flip_fabric111.BCM8879X=0 + +phy_tx_polarity_flip_fabric112.BCM8879X=1 +phy_tx_polarity_flip_fabric113.BCM8879X=0 +phy_tx_polarity_flip_fabric114.BCM8879X=1 +phy_tx_polarity_flip_fabric115.BCM8879X=0 + +phy_tx_polarity_flip_fabric116.BCM8879X=0 +phy_tx_polarity_flip_fabric117.BCM8879X=1 +phy_tx_polarity_flip_fabric118.BCM8879X=0 +phy_tx_polarity_flip_fabric119.BCM8879X=1 + +phy_tx_polarity_flip_fabric120.BCM8879X=0 +phy_tx_polarity_flip_fabric121.BCM8879X=1 +phy_tx_polarity_flip_fabric122.BCM8879X=0 +phy_tx_polarity_flip_fabric123.BCM8879X=1 + +phy_tx_polarity_flip_fabric124.BCM8879X=1 +phy_tx_polarity_flip_fabric125.BCM8879X=0 +phy_tx_polarity_flip_fabric126.BCM8879X=1 +phy_tx_polarity_flip_fabric127.BCM8879X=0 + +phy_tx_polarity_flip_fabric128.BCM8879X=0 +phy_tx_polarity_flip_fabric129.BCM8879X=1 +phy_tx_polarity_flip_fabric130.BCM8879X=0 +phy_tx_polarity_flip_fabric131.BCM8879X=1 + +phy_tx_polarity_flip_fabric132.BCM8879X=1 +phy_tx_polarity_flip_fabric133.BCM8879X=0 +phy_tx_polarity_flip_fabric134.BCM8879X=1 +phy_tx_polarity_flip_fabric135.BCM8879X=0 + +phy_tx_polarity_flip_fabric136.BCM8879X=0 +phy_tx_polarity_flip_fabric137.BCM8879X=1 +phy_tx_polarity_flip_fabric138.BCM8879X=0 +phy_tx_polarity_flip_fabric139.BCM8879X=1 + +phy_tx_polarity_flip_fabric140.BCM8879X=0 +phy_tx_polarity_flip_fabric141.BCM8879X=1 +phy_tx_polarity_flip_fabric142.BCM8879X=0 +phy_tx_polarity_flip_fabric143.BCM8879X=1 + +phy_tx_polarity_flip_fabric144.BCM8879X=0 +phy_tx_polarity_flip_fabric145.BCM8879X=1 +phy_tx_polarity_flip_fabric146.BCM8879X=0 +phy_tx_polarity_flip_fabric147.BCM8879X=1 + +phy_tx_polarity_flip_fabric148.BCM8879X=0 +phy_tx_polarity_flip_fabric149.BCM8879X=1 +phy_tx_polarity_flip_fabric150.BCM8879X=0 +phy_tx_polarity_flip_fabric151.BCM8879X=1 + +phy_tx_polarity_flip_fabric152.BCM8879X=1 +phy_tx_polarity_flip_fabric153.BCM8879X=0 +phy_tx_polarity_flip_fabric154.BCM8879X=1 +phy_tx_polarity_flip_fabric155.BCM8879X=0 + +phy_tx_polarity_flip_fabric156.BCM8879X=0 +phy_tx_polarity_flip_fabric157.BCM8879X=1 +phy_tx_polarity_flip_fabric158.BCM8879X=0 +phy_tx_polarity_flip_fabric159.BCM8879X=1 + +phy_tx_polarity_flip_fabric160.BCM8879X=0 +phy_tx_polarity_flip_fabric161.BCM8879X=1 +phy_tx_polarity_flip_fabric162.BCM8879X=0 +phy_tx_polarity_flip_fabric163.BCM8879X=1 + +phy_tx_polarity_flip_fabric164.BCM8879X=1 +phy_tx_polarity_flip_fabric165.BCM8879X=0 +phy_tx_polarity_flip_fabric166.BCM8879X=1 +phy_tx_polarity_flip_fabric167.BCM8879X=0 + +phy_tx_polarity_flip_fabric168.BCM8879X=0 +phy_tx_polarity_flip_fabric169.BCM8879X=1 +phy_tx_polarity_flip_fabric170.BCM8879X=0 +phy_tx_polarity_flip_fabric171.BCM8879X=1 + +phy_tx_polarity_flip_fabric172.BCM8879X=0 +phy_tx_polarity_flip_fabric173.BCM8879X=1 +phy_tx_polarity_flip_fabric174.BCM8879X=0 +phy_tx_polarity_flip_fabric175.BCM8879X=1 + +phy_tx_polarity_flip_fabric176.BCM8879X=1 +phy_tx_polarity_flip_fabric177.BCM8879X=0 +phy_tx_polarity_flip_fabric178.BCM8879X=1 +phy_tx_polarity_flip_fabric179.BCM8879X=0 + +phy_tx_polarity_flip_fabric180.BCM8879X=0 +phy_tx_polarity_flip_fabric181.BCM8879X=1 +phy_tx_polarity_flip_fabric182.BCM8879X=0 +phy_tx_polarity_flip_fabric183.BCM8879X=1 + +phy_tx_polarity_flip_fabric184.BCM8879X=1 +phy_tx_polarity_flip_fabric185.BCM8879X=0 +phy_tx_polarity_flip_fabric186.BCM8879X=1 +phy_tx_polarity_flip_fabric187.BCM8879X=0 + +phy_tx_polarity_flip_fabric188.BCM8879X=0 +phy_tx_polarity_flip_fabric189.BCM8879X=1 +phy_tx_polarity_flip_fabric190.BCM8879X=0 +phy_tx_polarity_flip_fabric191.BCM8879X=1 + +port_init_cl72_0=0 +port_init_cl72_1=0 +port_init_cl72_2=0 +port_init_cl72_3=0 +port_init_cl72_4=0 +port_init_cl72_5=0 +port_init_cl72_6=0 +port_init_cl72_7=0 +port_init_cl72_8=0 +port_init_cl72_9=0 +port_init_cl72_10=0 +port_init_cl72_11=0 +port_init_cl72_12=0 +port_init_cl72_13=0 +port_init_cl72_14=0 +port_init_cl72_15=0 +port_init_cl72_16=0 +port_init_cl72_17=0 +port_init_cl72_18=0 +port_init_cl72_19=0 +port_init_cl72_20=0 +port_init_cl72_21=0 +port_init_cl72_22=0 +port_init_cl72_23=0 +port_init_cl72_24=0 +port_init_cl72_25=0 +port_init_cl72_26=0 +port_init_cl72_27=0 +port_init_cl72_28=0 +port_init_cl72_29=0 +port_init_cl72_30=0 +port_init_cl72_31=0 +port_init_cl72_32=0 +port_init_cl72_33=0 +port_init_cl72_34=0 +port_init_cl72_35=0 +port_init_cl72_36=0 +port_init_cl72_37=0 +port_init_cl72_38=0 +port_init_cl72_39=0 +port_init_cl72_40=0 +port_init_cl72_41=0 +port_init_cl72_42=0 +port_init_cl72_43=0 +port_init_cl72_44=0 +port_init_cl72_45=0 +port_init_cl72_46=0 +port_init_cl72_47=0 +port_init_cl72_48=0 +port_init_cl72_49=0 +port_init_cl72_50=0 +port_init_cl72_51=0 +port_init_cl72_52=0 +port_init_cl72_53=0 +port_init_cl72_54=0 +port_init_cl72_55=0 +port_init_cl72_56=0 +port_init_cl72_57=0 +port_init_cl72_58=0 +port_init_cl72_59=0 +port_init_cl72_60=0 +port_init_cl72_61=0 +port_init_cl72_62=0 +port_init_cl72_63=0 +port_init_cl72_64=0 +port_init_cl72_65=0 +port_init_cl72_66=0 +port_init_cl72_67=0 +port_init_cl72_68=0 +port_init_cl72_69=0 +port_init_cl72_70=0 +port_init_cl72_71=0 +port_init_cl72_72=0 +port_init_cl72_73=0 +port_init_cl72_74=0 +port_init_cl72_75=0 +port_init_cl72_76=0 +port_init_cl72_77=0 +port_init_cl72_78=0 +port_init_cl72_79=0 +port_init_cl72_80=0 +port_init_cl72_81=0 +port_init_cl72_82=0 +port_init_cl72_83=0 +port_init_cl72_84=0 +port_init_cl72_85=0 +port_init_cl72_86=0 +port_init_cl72_87=0 +port_init_cl72_88=0 +port_init_cl72_89=0 +port_init_cl72_90=0 +port_init_cl72_91=0 +port_init_cl72_92=0 +port_init_cl72_93=0 +port_init_cl72_94=0 +port_init_cl72_95=0 +port_init_cl72_96=0 +port_init_cl72_97=0 +port_init_cl72_98=0 +port_init_cl72_99=0 +port_init_cl72_100=0 +port_init_cl72_101=0 +port_init_cl72_102=0 +port_init_cl72_103=0 +port_init_cl72_104=0 +port_init_cl72_105=0 +port_init_cl72_106=0 +port_init_cl72_107=0 +port_init_cl72_108=0 +port_init_cl72_109=0 +port_init_cl72_110=0 +port_init_cl72_111=0 +port_init_cl72_112=0 +port_init_cl72_113=0 +port_init_cl72_114=0 +port_init_cl72_115=0 +port_init_cl72_116=0 +port_init_cl72_117=0 +port_init_cl72_118=0 +port_init_cl72_119=0 +port_init_cl72_120=0 +port_init_cl72_121=0 +port_init_cl72_122=0 +port_init_cl72_123=0 +port_init_cl72_124=0 +port_init_cl72_125=0 +port_init_cl72_126=0 +port_init_cl72_127=0 +port_init_cl72_128=0 +port_init_cl72_129=0 +port_init_cl72_130=0 +port_init_cl72_131=0 +port_init_cl72_132=0 +port_init_cl72_133=0 +port_init_cl72_134=0 +port_init_cl72_135=0 +port_init_cl72_136=0 +port_init_cl72_137=0 +port_init_cl72_138=0 +port_init_cl72_139=0 +port_init_cl72_140=0 +port_init_cl72_141=0 +port_init_cl72_142=0 +port_init_cl72_143=0 +port_init_cl72_144=0 +port_init_cl72_145=0 +port_init_cl72_146=0 +port_init_cl72_147=0 +port_init_cl72_148=0 +port_init_cl72_149=0 +port_init_cl72_150=0 +port_init_cl72_151=0 +port_init_cl72_152=0 +port_init_cl72_153=0 +port_init_cl72_154=0 +port_init_cl72_155=0 +port_init_cl72_156=0 +port_init_cl72_157=0 +port_init_cl72_158=0 +port_init_cl72_159=0 +port_init_cl72_160=0 +port_init_cl72_161=0 +port_init_cl72_162=0 +port_init_cl72_163=0 +port_init_cl72_164=0 +port_init_cl72_165=0 +port_init_cl72_166=0 +port_init_cl72_167=0 +port_init_cl72_168=0 +port_init_cl72_169=0 +port_init_cl72_170=0 +port_init_cl72_171=0 +port_init_cl72_172=0 +port_init_cl72_173=0 +port_init_cl72_174=0 +port_init_cl72_175=0 +port_init_cl72_176=0 +port_init_cl72_177=0 +port_init_cl72_178=0 +port_init_cl72_179=0 +port_init_cl72_180=0 +port_init_cl72_181=0 +port_init_cl72_182=0 +port_init_cl72_183=0 +port_init_cl72_184=0 +port_init_cl72_185=0 +port_init_cl72_186=0 +port_init_cl72_187=0 +port_init_cl72_188=0 +port_init_cl72_189=0 +port_init_cl72_190=0 +port_init_cl72_191=0 + +serdes_tx_taps_0.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_1.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_2.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_3.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_4.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_5.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_6.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_7.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_8.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_9.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_10.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_11.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_12.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_13.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_14.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_15.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_16.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_17.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_18.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_19.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_20.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_21.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_22.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_23.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_24.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_25.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_26.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_27.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_28.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_29.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_30.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_31.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_32.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_33.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_34.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_35.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_36.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_37.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_38.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_39.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_40.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_41.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_42.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_43.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_44.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_45.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_46.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_47.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_48.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_49.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_50.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_51.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_52.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_53.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_54.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_55.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_56.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_57.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_58.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_59.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_60.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_61.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_62.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_63.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_64.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_65.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_66.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_67.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_68.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_69.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_70.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_71.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_72.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_73.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_74.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_75.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_76.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_77.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_78.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_79.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_80.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_81.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_82.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_83.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_84.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_85.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_86.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_87.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_88.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_89.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_90.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_91.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_92.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_93.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_94.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_95.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_96.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_97.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_98.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_99.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_100.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_101.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_102.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_103.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_104.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_105.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_106.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_107.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_108.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_109.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_110.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_111.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_112.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_113.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_114.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_115.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_116.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_117.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_118.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_119.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_120.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_121.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_122.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_123.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_124.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_125.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_126.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_127.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_128.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_129.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_130.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_131.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_132.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_133.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_134.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_135.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_136.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_137.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_138.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_139.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_140.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_141.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_142.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_143.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_144.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_145.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_146.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_147.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_148.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_149.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_150.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_151.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_152.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_153.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_154.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_155.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_156.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_157.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_158.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_159.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_160.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_161.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_162.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_163.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_164.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_165.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_166.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_167.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_168.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_169.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_170.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_171.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_172.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_173.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_174.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_175.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_176.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_177.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_178.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_179.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_180.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_181.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_182.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_183.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_184.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_185.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_186.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_187.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_188.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_189.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_190.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_191.BCM8879X=pam4:-24:132:-12:0:0:0 + +serdes_lane_config_channel_mode_0.0=force_nr +serdes_lane_config_channel_mode_1.0=force_nr +serdes_lane_config_channel_mode_2.0=force_nr +serdes_lane_config_channel_mode_3.0=force_nr +serdes_lane_config_channel_mode_4.0=force_nr +serdes_lane_config_channel_mode_5.0=force_nr +serdes_lane_config_channel_mode_6.0=force_nr +serdes_lane_config_channel_mode_7.0=force_nr +serdes_lane_config_channel_mode_8.0=force_nr +serdes_lane_config_channel_mode_9.0=force_nr +serdes_lane_config_channel_mode_10.0=force_nr +serdes_lane_config_channel_mode_11.0=force_nr +serdes_lane_config_channel_mode_12.0=force_nr +serdes_lane_config_channel_mode_13.0=force_nr +serdes_lane_config_channel_mode_14.0=force_nr +serdes_lane_config_channel_mode_15.0=force_nr +serdes_lane_config_channel_mode_16.0=force_nr +serdes_lane_config_channel_mode_17.0=force_nr +serdes_lane_config_channel_mode_18.0=force_nr +serdes_lane_config_channel_mode_19.0=force_nr +serdes_lane_config_channel_mode_20.0=force_nr +serdes_lane_config_channel_mode_21.0=force_nr +serdes_lane_config_channel_mode_22.0=force_nr +serdes_lane_config_channel_mode_23.0=force_nr +serdes_lane_config_channel_mode_24.0=force_nr +serdes_lane_config_channel_mode_25.0=force_nr +serdes_lane_config_channel_mode_26.0=force_nr +serdes_lane_config_channel_mode_27.0=force_nr +serdes_lane_config_channel_mode_28.0=force_nr +serdes_lane_config_channel_mode_29.0=force_nr +serdes_lane_config_channel_mode_30.0=force_nr +serdes_lane_config_channel_mode_31.0=force_nr +serdes_lane_config_channel_mode_32.0=force_nr +serdes_lane_config_channel_mode_33.0=force_nr +serdes_lane_config_channel_mode_34.0=force_nr +serdes_lane_config_channel_mode_35.0=force_nr +serdes_lane_config_channel_mode_36.0=force_nr +serdes_lane_config_channel_mode_37.0=force_nr +serdes_lane_config_channel_mode_38.0=force_nr +serdes_lane_config_channel_mode_39.0=force_nr +serdes_lane_config_channel_mode_40.0=force_nr +serdes_lane_config_channel_mode_41.0=force_nr +serdes_lane_config_channel_mode_42.0=force_nr +serdes_lane_config_channel_mode_43.0=force_nr +serdes_lane_config_channel_mode_44.0=force_nr +serdes_lane_config_channel_mode_45.0=force_nr +serdes_lane_config_channel_mode_46.0=force_nr +serdes_lane_config_channel_mode_47.0=force_nr +serdes_lane_config_channel_mode_48.0=force_nr +serdes_lane_config_channel_mode_49.0=force_nr +serdes_lane_config_channel_mode_50.0=force_nr +serdes_lane_config_channel_mode_51.0=force_nr +serdes_lane_config_channel_mode_52.0=force_nr +serdes_lane_config_channel_mode_53.0=force_nr +serdes_lane_config_channel_mode_54.0=force_nr +serdes_lane_config_channel_mode_55.0=force_nr +serdes_lane_config_channel_mode_56.0=force_nr +serdes_lane_config_channel_mode_57.0=force_nr +serdes_lane_config_channel_mode_58.0=force_nr +serdes_lane_config_channel_mode_59.0=force_nr +serdes_lane_config_channel_mode_60.0=force_nr +serdes_lane_config_channel_mode_61.0=force_nr +serdes_lane_config_channel_mode_62.0=force_nr +serdes_lane_config_channel_mode_63.0=force_nr +serdes_lane_config_channel_mode_64.0=force_nr +serdes_lane_config_channel_mode_65.0=force_nr +serdes_lane_config_channel_mode_66.0=force_nr +serdes_lane_config_channel_mode_67.0=force_nr +serdes_lane_config_channel_mode_68.0=force_nr +serdes_lane_config_channel_mode_69.0=force_nr +serdes_lane_config_channel_mode_70.0=force_nr +serdes_lane_config_channel_mode_71.0=force_nr +serdes_lane_config_channel_mode_72.0=force_nr +serdes_lane_config_channel_mode_73.0=force_nr +serdes_lane_config_channel_mode_74.0=force_nr +serdes_lane_config_channel_mode_75.0=force_nr +serdes_lane_config_channel_mode_76.0=force_nr +serdes_lane_config_channel_mode_77.0=force_nr +serdes_lane_config_channel_mode_78.0=force_nr +serdes_lane_config_channel_mode_79.0=force_nr +serdes_lane_config_channel_mode_80.0=force_nr +serdes_lane_config_channel_mode_81.0=force_nr +serdes_lane_config_channel_mode_82.0=force_nr +serdes_lane_config_channel_mode_83.0=force_nr +serdes_lane_config_channel_mode_84.0=force_nr +serdes_lane_config_channel_mode_85.0=force_nr +serdes_lane_config_channel_mode_86.0=force_nr +serdes_lane_config_channel_mode_87.0=force_nr +serdes_lane_config_channel_mode_88.0=force_nr +serdes_lane_config_channel_mode_89.0=force_nr +serdes_lane_config_channel_mode_90.0=force_nr +serdes_lane_config_channel_mode_91.0=force_nr +serdes_lane_config_channel_mode_92.0=force_nr +serdes_lane_config_channel_mode_93.0=force_nr +serdes_lane_config_channel_mode_94.0=force_nr +serdes_lane_config_channel_mode_95.0=force_nr +serdes_lane_config_channel_mode_96.0=force_nr +serdes_lane_config_channel_mode_97.0=force_nr +serdes_lane_config_channel_mode_98.0=force_nr +serdes_lane_config_channel_mode_99.0=force_nr +serdes_lane_config_channel_mode_100.0=force_nr +serdes_lane_config_channel_mode_101.0=force_nr +serdes_lane_config_channel_mode_102.0=force_nr +serdes_lane_config_channel_mode_103.0=force_nr +serdes_lane_config_channel_mode_104.0=force_nr +serdes_lane_config_channel_mode_105.0=force_nr +serdes_lane_config_channel_mode_106.0=force_nr +serdes_lane_config_channel_mode_107.0=force_nr +serdes_lane_config_channel_mode_108.0=force_nr +serdes_lane_config_channel_mode_109.0=force_nr +serdes_lane_config_channel_mode_110.0=force_nr +serdes_lane_config_channel_mode_111.0=force_nr +serdes_lane_config_channel_mode_112.0=force_nr +serdes_lane_config_channel_mode_113.0=force_nr +serdes_lane_config_channel_mode_114.0=force_nr +serdes_lane_config_channel_mode_115.0=force_nr +serdes_lane_config_channel_mode_116.0=force_nr +serdes_lane_config_channel_mode_117.0=force_nr +serdes_lane_config_channel_mode_118.0=force_nr +serdes_lane_config_channel_mode_119.0=force_nr +serdes_lane_config_channel_mode_120.0=force_nr +serdes_lane_config_channel_mode_121.0=force_nr +serdes_lane_config_channel_mode_122.0=force_nr +serdes_lane_config_channel_mode_123.0=force_nr +serdes_lane_config_channel_mode_124.0=force_nr +serdes_lane_config_channel_mode_125.0=force_nr +serdes_lane_config_channel_mode_126.0=force_nr +serdes_lane_config_channel_mode_127.0=force_nr +serdes_lane_config_channel_mode_128.0=force_nr +serdes_lane_config_channel_mode_129.0=force_nr +serdes_lane_config_channel_mode_130.0=force_nr +serdes_lane_config_channel_mode_131.0=force_nr +serdes_lane_config_channel_mode_132.0=force_nr +serdes_lane_config_channel_mode_133.0=force_nr +serdes_lane_config_channel_mode_134.0=force_nr +serdes_lane_config_channel_mode_135.0=force_nr +serdes_lane_config_channel_mode_136.0=force_nr +serdes_lane_config_channel_mode_137.0=force_nr +serdes_lane_config_channel_mode_138.0=force_nr +serdes_lane_config_channel_mode_139.0=force_nr +serdes_lane_config_channel_mode_140.0=force_nr +serdes_lane_config_channel_mode_141.0=force_nr +serdes_lane_config_channel_mode_142.0=force_nr +serdes_lane_config_channel_mode_143.0=force_nr +serdes_lane_config_channel_mode_144.0=force_nr +serdes_lane_config_channel_mode_145.0=force_nr +serdes_lane_config_channel_mode_146.0=force_nr +serdes_lane_config_channel_mode_147.0=force_nr +serdes_lane_config_channel_mode_148.0=force_nr +serdes_lane_config_channel_mode_149.0=force_nr +serdes_lane_config_channel_mode_150.0=force_nr +serdes_lane_config_channel_mode_151.0=force_nr +serdes_lane_config_channel_mode_152.0=force_nr +serdes_lane_config_channel_mode_153.0=force_nr +serdes_lane_config_channel_mode_154.0=force_nr +serdes_lane_config_channel_mode_155.0=force_nr +#port_init_cl72_155=0 +#serdes_tx_taps_155.BCM8879X=pam4:-20:148:0:0:0:0 +serdes_lane_config_channel_mode_156.0=force_nr +serdes_lane_config_channel_mode_157.0=force_nr +serdes_lane_config_channel_mode_158.0=force_nr +serdes_lane_config_channel_mode_159.0=force_nr +serdes_lane_config_channel_mode_160.0=force_nr +serdes_lane_config_channel_mode_161.0=force_nr +serdes_lane_config_channel_mode_162.0=force_nr +serdes_lane_config_channel_mode_163.0=force_nr +serdes_lane_config_channel_mode_164.0=force_nr +serdes_lane_config_channel_mode_165.0=force_nr +serdes_lane_config_channel_mode_166.0=force_nr +serdes_lane_config_channel_mode_167.0=force_nr +serdes_lane_config_channel_mode_168.0=force_nr +serdes_lane_config_channel_mode_169.0=force_nr +serdes_lane_config_channel_mode_170.0=force_nr +serdes_lane_config_channel_mode_171.0=force_nr +serdes_lane_config_channel_mode_172.0=force_nr +serdes_lane_config_channel_mode_173.0=force_nr +serdes_lane_config_channel_mode_174.0=force_nr +serdes_lane_config_channel_mode_175.0=force_nr +serdes_lane_config_channel_mode_176.0=force_nr +serdes_lane_config_channel_mode_177.0=force_nr +serdes_lane_config_channel_mode_178.0=force_nr +serdes_lane_config_channel_mode_179.0=force_nr +serdes_lane_config_channel_mode_180.0=force_nr +serdes_lane_config_channel_mode_181.0=force_nr +serdes_lane_config_channel_mode_182.0=force_nr +serdes_lane_config_channel_mode_183.0=force_nr +serdes_lane_config_channel_mode_184.0=force_nr +serdes_lane_config_channel_mode_185.0=force_nr +serdes_lane_config_channel_mode_186.0=force_nr +serdes_lane_config_channel_mode_187.0=force_nr +serdes_lane_config_channel_mode_188.0=force_nr +serdes_lane_config_channel_mode_189.0=force_nr +serdes_lane_config_channel_mode_190.0=force_nr +serdes_lane_config_channel_mode_191.0=force_nr + + +serdes_qrtt_active_0.0=1 +serdes_qrtt_active_1.0=1 +serdes_qrtt_active_2.0=1 +serdes_qrtt_active_3.0=1 +serdes_qrtt_active_4.0=1 +serdes_qrtt_active_5.0=1 +serdes_qrtt_active_6.0=1 +serdes_qrtt_active_7.0=1 +serdes_qrtt_active_8.0=1 +serdes_qrtt_active_9.0=1 +serdes_qrtt_active_10.0=1 +serdes_qrtt_active_11.0=1 +serdes_qrtt_active_12.0=1 +serdes_qrtt_active_13.0=1 +serdes_qrtt_active_14.0=1 +serdes_qrtt_active_15.0=1 +serdes_qrtt_active_16.0=1 +serdes_qrtt_active_17.0=1 +serdes_qrtt_active_18.0=1 +serdes_qrtt_active_19.0=1 +serdes_qrtt_active_20.0=1 +serdes_qrtt_active_21.0=1 +serdes_qrtt_active_22.0=1 +serdes_qrtt_active_23.0=1 +serdes_qrtt_active_24.0=1 +serdes_qrtt_active_25.0=1 +serdes_qrtt_active_26.0=1 +serdes_qrtt_active_27.0=1 +serdes_qrtt_active_28.0=1 +serdes_qrtt_active_29.0=1 +serdes_qrtt_active_30.0=1 +serdes_qrtt_active_31.0=1 +serdes_qrtt_active_32.0=1 +serdes_qrtt_active_33.0=1 +serdes_qrtt_active_34.0=1 +serdes_qrtt_active_35.0=1 +serdes_qrtt_active_36.0=1 +serdes_qrtt_active_37.0=1 +serdes_qrtt_active_38.0=1 +serdes_qrtt_active_39.0=1 +serdes_qrtt_active_40.0=1 +serdes_qrtt_active_41.0=1 +serdes_qrtt_active_42.0=1 +serdes_qrtt_active_43.0=1 +serdes_qrtt_active_44.0=1 +serdes_qrtt_active_45.0=1 +serdes_qrtt_active_46.0=1 +serdes_qrtt_active_47.0=1 diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/15/config-ramon-8-1.bcm b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/15/config-ramon-8-1.bcm new file mode 100644 index 000000000000..4e9aeef329f9 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/15/config-ramon-8-1.bcm @@ -0,0 +1,1395 @@ + +appl_enable_intr_init.BCM8879X=0 +appl_param_module_id.BCM8879X=16 +bcm_linkscan_interval.BCM8879X=0 +bcm_stat_interval.BCM8879X=4000000 +bist_enable.BCM8879X=0 +core_clock_speed_khz.BCM8879X=1000000 +custom_feature_access_only.BCM8879X=0 +custom_feature_lane_swap_disable.BCM8879X=0 +dport_map_direct.BCM8879X=1 +fabric_cell_fifo_dma_enable.BCM8879X=0 +fabric_device_mode.BCM8879X=SINGLE_STAGE_FE2 +fabric_load_balancing_mode.BCM8879X=NORMAL_LOAD_BALANCE +fabric_multicast_mode.BCM8879X=DIRECT +fabric_num_pipes.BCM8879X=1 +fabric_pipe_map.BCM8879X=0 +fe_mc_id_range.BCM8879X=128K +load_firmware.BCM8879X=0x102 +mdio_output_delay_ext.BCM8879X=14 +mdio_output_delay_int.BCM8879X=25 +mem_cache_enable_parity.BCM8879X=1 +mm_intr_enable.BCM8879X=0 +mm_timeout_usec.BCM8879X=300000 +polled_irq_delay.BCM8879X=100000 +polled_irq_mode.BCM8879X=1 +port_fec.BCM8879X=7 +port_init_cl72.BCM8879X=0 +port_init_speed.BCM8879X=53125 +rate_ext_mdio_divisor.BCM8879X=14 +rate_int_mdio_divisor.BCM8879X=50 +schan_intr_enable.BCM8879X=0 +schan_timeout_usec.BCM8879X=300000 +serdes_fabric_clk_freq_in.BCM8879X=1 +serdes_fabric_clk_freq_out.BCM8879X=bypass +soc_family.BCM8879X=BCM8879X +srd_tx_drv_hv_disable.BCM8879X=0 +system_contains_multiple_pipe_device.BCM8879X=0 +system_ref_core_clock_khz.BCM8879X=1200000 +table_dma_enable.BCM8879X=0 +tdma_intr_enable.BCM8879X=0 +tdma_timeout_usec.BCM8879X=5000000 +tslam_dma_enable.BCM8879X=0 +tslam_intr_enable.BCM8879X=0 +tslam_timeout_usec.BCM8879X=5000000 + +lane_to_serdes_map_fabric_lane0.BCM8879X=rx0:tx0 +lane_to_serdes_map_fabric_lane1.BCM8879X=rx1:tx1 +lane_to_serdes_map_fabric_lane2.BCM8879X=rx2:tx2 +lane_to_serdes_map_fabric_lane3.BCM8879X=rx3:tx3 + +lane_to_serdes_map_fabric_lane4.BCM8879X=rx4:tx4 +lane_to_serdes_map_fabric_lane5.BCM8879X=rx5:tx5 +lane_to_serdes_map_fabric_lane6.BCM8879X=rx6:tx6 +lane_to_serdes_map_fabric_lane7.BCM8879X=rx7:tx7 + +lane_to_serdes_map_fabric_lane8.BCM8879X=rx8:tx8 +lane_to_serdes_map_fabric_lane9.BCM8879X=rx9:tx9 +lane_to_serdes_map_fabric_lane10.BCM8879X=rx10:tx10 +lane_to_serdes_map_fabric_lane11.BCM8879X=rx11:tx11 + +lane_to_serdes_map_fabric_lane12.BCM8879X=rx12:tx12 +lane_to_serdes_map_fabric_lane13.BCM8879X=rx13:tx13 +lane_to_serdes_map_fabric_lane14.BCM8879X=rx14:tx14 +lane_to_serdes_map_fabric_lane15.BCM8879X=rx15:tx15 + +lane_to_serdes_map_fabric_lane16.BCM8879X=rx16:tx16 +lane_to_serdes_map_fabric_lane17.BCM8879X=rx17:tx17 +lane_to_serdes_map_fabric_lane18.BCM8879X=rx18:tx18 +lane_to_serdes_map_fabric_lane19.BCM8879X=rx19:tx19 + +lane_to_serdes_map_fabric_lane20.BCM8879X=rx20:tx20 +lane_to_serdes_map_fabric_lane21.BCM8879X=rx21:tx21 +lane_to_serdes_map_fabric_lane22.BCM8879X=rx22:tx22 +lane_to_serdes_map_fabric_lane23.BCM8879X=rx23:tx23 + +lane_to_serdes_map_fabric_lane24.BCM8879X=rx24:tx24 +lane_to_serdes_map_fabric_lane25.BCM8879X=rx25:tx25 +lane_to_serdes_map_fabric_lane26.BCM8879X=rx26:tx26 +lane_to_serdes_map_fabric_lane27.BCM8879X=rx27:tx27 + +lane_to_serdes_map_fabric_lane28.BCM8879X=rx28:tx28 +lane_to_serdes_map_fabric_lane29.BCM8879X=rx29:tx29 +lane_to_serdes_map_fabric_lane30.BCM8879X=rx30:tx30 +lane_to_serdes_map_fabric_lane31.BCM8879X=rx31:tx31 + +lane_to_serdes_map_fabric_lane32.BCM8879X=rx32:tx32 +lane_to_serdes_map_fabric_lane33.BCM8879X=rx33:tx33 +lane_to_serdes_map_fabric_lane34.BCM8879X=rx34:tx34 +lane_to_serdes_map_fabric_lane35.BCM8879X=rx35:tx35 + +lane_to_serdes_map_fabric_lane36.BCM8879X=rx36:tx36 +lane_to_serdes_map_fabric_lane37.BCM8879X=rx37:tx37 +lane_to_serdes_map_fabric_lane38.BCM8879X=rx38:tx38 +lane_to_serdes_map_fabric_lane39.BCM8879X=rx39:tx39 + +lane_to_serdes_map_fabric_lane40.BCM8879X=rx40:tx40 +lane_to_serdes_map_fabric_lane41.BCM8879X=rx41:tx41 +lane_to_serdes_map_fabric_lane42.BCM8879X=rx42:tx42 +lane_to_serdes_map_fabric_lane43.BCM8879X=rx43:tx43 + +lane_to_serdes_map_fabric_lane44.BCM8879X=rx44:tx44 +lane_to_serdes_map_fabric_lane45.BCM8879X=rx45:tx45 +lane_to_serdes_map_fabric_lane46.BCM8879X=rx46:tx46 +lane_to_serdes_map_fabric_lane47.BCM8879X=rx47:tx47 + +lane_to_serdes_map_fabric_lane48.BCM8879X=rx48:tx48 +lane_to_serdes_map_fabric_lane49.BCM8879X=rx49:tx49 +lane_to_serdes_map_fabric_lane50.BCM8879X=rx50:tx50 +lane_to_serdes_map_fabric_lane51.BCM8879X=rx51:tx51 + +lane_to_serdes_map_fabric_lane52.BCM8879X=rx52:tx52 +lane_to_serdes_map_fabric_lane53.BCM8879X=rx53:tx53 +lane_to_serdes_map_fabric_lane54.BCM8879X=rx54:tx54 +lane_to_serdes_map_fabric_lane55.BCM8879X=rx55:tx55 + +lane_to_serdes_map_fabric_lane56.BCM8879X=rx56:tx56 +lane_to_serdes_map_fabric_lane57.BCM8879X=rx57:tx57 +lane_to_serdes_map_fabric_lane58.BCM8879X=rx58:tx58 +lane_to_serdes_map_fabric_lane59.BCM8879X=rx59:tx59 + +lane_to_serdes_map_fabric_lane60.BCM8879X=rx60:tx60 +lane_to_serdes_map_fabric_lane61.BCM8879X=rx61:tx61 +lane_to_serdes_map_fabric_lane62.BCM8879X=rx62:tx62 +lane_to_serdes_map_fabric_lane63.BCM8879X=rx63:tx63 + +lane_to_serdes_map_fabric_lane64.BCM8879X=rx64:tx64 +lane_to_serdes_map_fabric_lane65.BCM8879X=rx65:tx65 +lane_to_serdes_map_fabric_lane66.BCM8879X=rx66:tx66 +lane_to_serdes_map_fabric_lane67.BCM8879X=rx67:tx67 + +lane_to_serdes_map_fabric_lane68.BCM8879X=rx68:tx68 +lane_to_serdes_map_fabric_lane69.BCM8879X=rx69:tx69 +lane_to_serdes_map_fabric_lane70.BCM8879X=rx70:tx70 +lane_to_serdes_map_fabric_lane71.BCM8879X=rx71:tx71 + +lane_to_serdes_map_fabric_lane72.BCM8879X=rx72:tx72 +lane_to_serdes_map_fabric_lane73.BCM8879X=rx73:tx73 +lane_to_serdes_map_fabric_lane74.BCM8879X=rx74:tx74 +lane_to_serdes_map_fabric_lane75.BCM8879X=rx75:tx75 + +lane_to_serdes_map_fabric_lane76.BCM8879X=rx76:tx76 +lane_to_serdes_map_fabric_lane77.BCM8879X=rx77:tx77 +lane_to_serdes_map_fabric_lane78.BCM8879X=rx78:tx78 +lane_to_serdes_map_fabric_lane79.BCM8879X=rx79:tx79 + +lane_to_serdes_map_fabric_lane80.BCM8879X=rx80:tx80 +lane_to_serdes_map_fabric_lane81.BCM8879X=rx81:tx81 +lane_to_serdes_map_fabric_lane82.BCM8879X=rx82:tx82 +lane_to_serdes_map_fabric_lane83.BCM8879X=rx83:tx83 + +lane_to_serdes_map_fabric_lane84.BCM8879X=rx84:tx84 +lane_to_serdes_map_fabric_lane85.BCM8879X=rx85:tx85 +lane_to_serdes_map_fabric_lane86.BCM8879X=rx86:tx86 +lane_to_serdes_map_fabric_lane87.BCM8879X=rx87:tx87 + +lane_to_serdes_map_fabric_lane88.BCM8879X=rx88:tx88 +lane_to_serdes_map_fabric_lane89.BCM8879X=rx89:tx89 +lane_to_serdes_map_fabric_lane90.BCM8879X=rx90:tx90 +lane_to_serdes_map_fabric_lane91.BCM8879X=rx91:tx91 + +lane_to_serdes_map_fabric_lane92.BCM8879X=rx92:tx92 +lane_to_serdes_map_fabric_lane93.BCM8879X=rx93:tx93 +lane_to_serdes_map_fabric_lane94.BCM8879X=rx94:tx94 +lane_to_serdes_map_fabric_lane95.BCM8879X=rx95:tx95 + +lane_to_serdes_map_fabric_lane96.BCM8879X=rx96:tx96 +lane_to_serdes_map_fabric_lane97.BCM8879X=rx97:tx97 +lane_to_serdes_map_fabric_lane98.BCM8879X=rx98:tx98 +lane_to_serdes_map_fabric_lane99.BCM8879X=rx99:tx99 + +lane_to_serdes_map_fabric_lane100.BCM8879X=rx100:tx100 +lane_to_serdes_map_fabric_lane101.BCM8879X=rx101:tx101 +lane_to_serdes_map_fabric_lane102.BCM8879X=rx102:tx102 +lane_to_serdes_map_fabric_lane103.BCM8879X=rx103:tx103 + +lane_to_serdes_map_fabric_lane104.BCM8879X=rx104:tx104 +lane_to_serdes_map_fabric_lane105.BCM8879X=rx105:tx105 +lane_to_serdes_map_fabric_lane106.BCM8879X=rx106:tx106 +lane_to_serdes_map_fabric_lane107.BCM8879X=rx107:tx107 + +lane_to_serdes_map_fabric_lane108.BCM8879X=rx108:tx108 +lane_to_serdes_map_fabric_lane109.BCM8879X=rx109:tx109 +lane_to_serdes_map_fabric_lane110.BCM8879X=rx110:tx110 +lane_to_serdes_map_fabric_lane111.BCM8879X=rx111:tx111 + +lane_to_serdes_map_fabric_lane112.BCM8879X=rx112:tx112 +lane_to_serdes_map_fabric_lane113.BCM8879X=rx113:tx113 +lane_to_serdes_map_fabric_lane114.BCM8879X=rx114:tx114 +lane_to_serdes_map_fabric_lane115.BCM8879X=rx115:tx115 + +lane_to_serdes_map_fabric_lane116.BCM8879X=rx116:tx116 +lane_to_serdes_map_fabric_lane117.BCM8879X=rx117:tx117 +lane_to_serdes_map_fabric_lane118.BCM8879X=rx118:tx118 +lane_to_serdes_map_fabric_lane119.BCM8879X=rx119:tx119 + +lane_to_serdes_map_fabric_lane120.BCM8879X=rx120:tx120 +lane_to_serdes_map_fabric_lane121.BCM8879X=rx121:tx121 +lane_to_serdes_map_fabric_lane122.BCM8879X=rx122:tx122 +lane_to_serdes_map_fabric_lane123.BCM8879X=rx123:tx123 + +lane_to_serdes_map_fabric_lane124.BCM8879X=rx124:tx124 +lane_to_serdes_map_fabric_lane125.BCM8879X=rx125:tx125 +lane_to_serdes_map_fabric_lane126.BCM8879X=rx126:tx126 +lane_to_serdes_map_fabric_lane127.BCM8879X=rx127:tx127 + +lane_to_serdes_map_fabric_lane128.BCM8879X=rx128:tx128 +lane_to_serdes_map_fabric_lane129.BCM8879X=rx129:tx129 +lane_to_serdes_map_fabric_lane130.BCM8879X=rx130:tx130 +lane_to_serdes_map_fabric_lane131.BCM8879X=rx131:tx131 + +lane_to_serdes_map_fabric_lane132.BCM8879X=rx132:tx132 +lane_to_serdes_map_fabric_lane133.BCM8879X=rx133:tx133 +lane_to_serdes_map_fabric_lane134.BCM8879X=rx134:tx134 +lane_to_serdes_map_fabric_lane135.BCM8879X=rx135:tx135 + +lane_to_serdes_map_fabric_lane136.BCM8879X=rx136:tx136 +lane_to_serdes_map_fabric_lane137.BCM8879X=rx137:tx137 +lane_to_serdes_map_fabric_lane138.BCM8879X=rx138:tx138 +lane_to_serdes_map_fabric_lane139.BCM8879X=rx139:tx139 + +lane_to_serdes_map_fabric_lane140.BCM8879X=rx140:tx140 +lane_to_serdes_map_fabric_lane141.BCM8879X=rx141:tx141 +lane_to_serdes_map_fabric_lane142.BCM8879X=rx142:tx142 +lane_to_serdes_map_fabric_lane143.BCM8879X=rx143:tx143 + +lane_to_serdes_map_fabric_lane144.BCM8879X=rx144:tx144 +lane_to_serdes_map_fabric_lane145.BCM8879X=rx145:tx145 +lane_to_serdes_map_fabric_lane146.BCM8879X=rx146:tx146 +lane_to_serdes_map_fabric_lane147.BCM8879X=rx147:tx147 + +lane_to_serdes_map_fabric_lane148.BCM8879X=rx148:tx148 +lane_to_serdes_map_fabric_lane149.BCM8879X=rx149:tx149 +lane_to_serdes_map_fabric_lane150.BCM8879X=rx150:tx150 +lane_to_serdes_map_fabric_lane151.BCM8879X=rx151:tx151 + +lane_to_serdes_map_fabric_lane152.BCM8879X=rx152:tx152 +lane_to_serdes_map_fabric_lane153.BCM8879X=rx153:tx153 +lane_to_serdes_map_fabric_lane154.BCM8879X=rx154:tx154 +lane_to_serdes_map_fabric_lane155.BCM8879X=rx155:tx155 + +lane_to_serdes_map_fabric_lane156.BCM8879X=rx156:tx156 +lane_to_serdes_map_fabric_lane157.BCM8879X=rx157:tx157 +lane_to_serdes_map_fabric_lane158.BCM8879X=rx158:tx158 +lane_to_serdes_map_fabric_lane159.BCM8879X=rx159:tx159 + +lane_to_serdes_map_fabric_lane160.BCM8879X=rx160:tx160 +lane_to_serdes_map_fabric_lane161.BCM8879X=rx161:tx161 +lane_to_serdes_map_fabric_lane162.BCM8879X=rx162:tx162 +lane_to_serdes_map_fabric_lane163.BCM8879X=rx163:tx163 + +lane_to_serdes_map_fabric_lane164.BCM8879X=rx164:tx164 +lane_to_serdes_map_fabric_lane165.BCM8879X=rx165:tx165 +lane_to_serdes_map_fabric_lane166.BCM8879X=rx166:tx166 +lane_to_serdes_map_fabric_lane167.BCM8879X=rx167:tx167 + +lane_to_serdes_map_fabric_lane168.BCM8879X=rx168:tx168 +lane_to_serdes_map_fabric_lane169.BCM8879X=rx169:tx169 +lane_to_serdes_map_fabric_lane170.BCM8879X=rx170:tx170 +lane_to_serdes_map_fabric_lane171.BCM8879X=rx171:tx171 + +lane_to_serdes_map_fabric_lane172.BCM8879X=rx172:tx172 +lane_to_serdes_map_fabric_lane173.BCM8879X=rx173:tx173 +lane_to_serdes_map_fabric_lane174.BCM8879X=rx174:tx174 +lane_to_serdes_map_fabric_lane175.BCM8879X=rx175:tx175 + +lane_to_serdes_map_fabric_lane176.BCM8879X=rx176:tx176 +lane_to_serdes_map_fabric_lane177.BCM8879X=rx177:tx177 +lane_to_serdes_map_fabric_lane178.BCM8879X=rx178:tx178 +lane_to_serdes_map_fabric_lane179.BCM8879X=rx179:tx179 + +lane_to_serdes_map_fabric_lane180.BCM8879X=rx180:tx180 +lane_to_serdes_map_fabric_lane181.BCM8879X=rx181:tx181 +lane_to_serdes_map_fabric_lane182.BCM8879X=rx182:tx182 +lane_to_serdes_map_fabric_lane183.BCM8879X=rx183:tx183 + +lane_to_serdes_map_fabric_lane184.BCM8879X=rx184:tx184 +lane_to_serdes_map_fabric_lane185.BCM8879X=rx185:tx185 +lane_to_serdes_map_fabric_lane186.BCM8879X=rx186:tx186 +lane_to_serdes_map_fabric_lane187.BCM8879X=rx187:tx187 + +lane_to_serdes_map_fabric_lane188.BCM8879X=rx188:tx188 +lane_to_serdes_map_fabric_lane189.BCM8879X=rx189:tx189 +lane_to_serdes_map_fabric_lane190.BCM8879X=rx190:tx190 +lane_to_serdes_map_fabric_lane191.BCM8879X=rx191:tx191 + + +phy_rx_polarity_flip_fabric0.BCM8879X=1 +phy_rx_polarity_flip_fabric1.BCM8879X=0 +phy_rx_polarity_flip_fabric2.BCM8879X=1 +phy_rx_polarity_flip_fabric3.BCM8879X=0 + +phy_rx_polarity_flip_fabric4.BCM8879X=1 +phy_rx_polarity_flip_fabric5.BCM8879X=0 +phy_rx_polarity_flip_fabric6.BCM8879X=1 +phy_rx_polarity_flip_fabric7.BCM8879X=0 + +phy_rx_polarity_flip_fabric8.BCM8879X=0 +phy_rx_polarity_flip_fabric9.BCM8879X=1 +phy_rx_polarity_flip_fabric10.BCM8879X=0 +phy_rx_polarity_flip_fabric11.BCM8879X=1 + +phy_rx_polarity_flip_fabric12.BCM8879X=1 +phy_rx_polarity_flip_fabric13.BCM8879X=0 +phy_rx_polarity_flip_fabric14.BCM8879X=1 +phy_rx_polarity_flip_fabric15.BCM8879X=0 + +phy_rx_polarity_flip_fabric16.BCM8879X=1 +phy_rx_polarity_flip_fabric17.BCM8879X=0 +phy_rx_polarity_flip_fabric18.BCM8879X=1 +phy_rx_polarity_flip_fabric19.BCM8879X=0 + +phy_rx_polarity_flip_fabric20.BCM8879X=0 +phy_rx_polarity_flip_fabric21.BCM8879X=1 +phy_rx_polarity_flip_fabric22.BCM8879X=0 +phy_rx_polarity_flip_fabric23.BCM8879X=1 + +phy_rx_polarity_flip_fabric24.BCM8879X=1 +phy_rx_polarity_flip_fabric25.BCM8879X=0 +phy_rx_polarity_flip_fabric26.BCM8879X=1 +phy_rx_polarity_flip_fabric27.BCM8879X=0 + +phy_rx_polarity_flip_fabric28.BCM8879X=1 +phy_rx_polarity_flip_fabric29.BCM8879X=0 +phy_rx_polarity_flip_fabric30.BCM8879X=1 +phy_rx_polarity_flip_fabric31.BCM8879X=0 + +phy_rx_polarity_flip_fabric32.BCM8879X=0 +phy_rx_polarity_flip_fabric33.BCM8879X=1 +phy_rx_polarity_flip_fabric34.BCM8879X=0 +phy_rx_polarity_flip_fabric35.BCM8879X=1 + +phy_rx_polarity_flip_fabric36.BCM8879X=1 +phy_rx_polarity_flip_fabric37.BCM8879X=0 +phy_rx_polarity_flip_fabric38.BCM8879X=1 +phy_rx_polarity_flip_fabric39.BCM8879X=0 + +phy_rx_polarity_flip_fabric40.BCM8879X=0 +phy_rx_polarity_flip_fabric41.BCM8879X=1 +phy_rx_polarity_flip_fabric42.BCM8879X=0 +phy_rx_polarity_flip_fabric43.BCM8879X=1 + +phy_rx_polarity_flip_fabric44.BCM8879X=1 +phy_rx_polarity_flip_fabric45.BCM8879X=0 +phy_rx_polarity_flip_fabric46.BCM8879X=1 +phy_rx_polarity_flip_fabric47.BCM8879X=0 + +phy_rx_polarity_flip_fabric48.BCM8879X=1 +phy_rx_polarity_flip_fabric49.BCM8879X=0 +phy_rx_polarity_flip_fabric50.BCM8879X=1 +phy_rx_polarity_flip_fabric51.BCM8879X=0 + +phy_rx_polarity_flip_fabric52.BCM8879X=0 +phy_rx_polarity_flip_fabric53.BCM8879X=1 +phy_rx_polarity_flip_fabric54.BCM8879X=0 +phy_rx_polarity_flip_fabric55.BCM8879X=1 + +phy_rx_polarity_flip_fabric56.BCM8879X=0 +phy_rx_polarity_flip_fabric57.BCM8879X=1 +phy_rx_polarity_flip_fabric58.BCM8879X=0 +phy_rx_polarity_flip_fabric59.BCM8879X=1 + +phy_rx_polarity_flip_fabric60.BCM8879X=0 +phy_rx_polarity_flip_fabric61.BCM8879X=1 +phy_rx_polarity_flip_fabric62.BCM8879X=0 +phy_rx_polarity_flip_fabric63.BCM8879X=1 + +phy_rx_polarity_flip_fabric64.BCM8879X=0 +phy_rx_polarity_flip_fabric65.BCM8879X=1 +phy_rx_polarity_flip_fabric66.BCM8879X=0 +phy_rx_polarity_flip_fabric67.BCM8879X=1 + +phy_rx_polarity_flip_fabric68.BCM8879X=1 +phy_rx_polarity_flip_fabric69.BCM8879X=0 +phy_rx_polarity_flip_fabric70.BCM8879X=1 +phy_rx_polarity_flip_fabric71.BCM8879X=0 + +phy_rx_polarity_flip_fabric72.BCM8879X=1 +phy_rx_polarity_flip_fabric73.BCM8879X=0 +phy_rx_polarity_flip_fabric74.BCM8879X=1 +phy_rx_polarity_flip_fabric75.BCM8879X=0 + +phy_rx_polarity_flip_fabric76.BCM8879X=0 +phy_rx_polarity_flip_fabric77.BCM8879X=1 +phy_rx_polarity_flip_fabric78.BCM8879X=0 +phy_rx_polarity_flip_fabric79.BCM8879X=1 + +phy_rx_polarity_flip_fabric80.BCM8879X=1 +phy_rx_polarity_flip_fabric81.BCM8879X=0 +phy_rx_polarity_flip_fabric82.BCM8879X=1 +phy_rx_polarity_flip_fabric83.BCM8879X=0 + +phy_rx_polarity_flip_fabric84.BCM8879X=0 +phy_rx_polarity_flip_fabric85.BCM8879X=1 +phy_rx_polarity_flip_fabric86.BCM8879X=0 +phy_rx_polarity_flip_fabric87.BCM8879X=1 + +phy_rx_polarity_flip_fabric88.BCM8879X=1 +phy_rx_polarity_flip_fabric89.BCM8879X=0 +phy_rx_polarity_flip_fabric90.BCM8879X=1 +phy_rx_polarity_flip_fabric91.BCM8879X=0 + +phy_rx_polarity_flip_fabric92.BCM8879X=1 +phy_rx_polarity_flip_fabric93.BCM8879X=0 +phy_rx_polarity_flip_fabric94.BCM8879X=1 +phy_rx_polarity_flip_fabric95.BCM8879X=0 + +phy_rx_polarity_flip_fabric96.BCM8879X=0 +phy_rx_polarity_flip_fabric97.BCM8879X=1 +phy_rx_polarity_flip_fabric98.BCM8879X=0 +phy_rx_polarity_flip_fabric99.BCM8879X=1 + +phy_rx_polarity_flip_fabric100.BCM8879X=1 +phy_rx_polarity_flip_fabric101.BCM8879X=0 +phy_rx_polarity_flip_fabric102.BCM8879X=1 +phy_rx_polarity_flip_fabric103.BCM8879X=0 + +phy_rx_polarity_flip_fabric104.BCM8879X=0 +phy_rx_polarity_flip_fabric105.BCM8879X=1 +phy_rx_polarity_flip_fabric106.BCM8879X=0 +phy_rx_polarity_flip_fabric107.BCM8879X=1 + +phy_rx_polarity_flip_fabric108.BCM8879X=0 +phy_rx_polarity_flip_fabric109.BCM8879X=1 +phy_rx_polarity_flip_fabric110.BCM8879X=0 +phy_rx_polarity_flip_fabric111.BCM8879X=1 + +phy_rx_polarity_flip_fabric112.BCM8879X=1 +phy_rx_polarity_flip_fabric113.BCM8879X=0 +phy_rx_polarity_flip_fabric114.BCM8879X=1 +phy_rx_polarity_flip_fabric115.BCM8879X=0 + +phy_rx_polarity_flip_fabric116.BCM8879X=0 +phy_rx_polarity_flip_fabric117.BCM8879X=1 +phy_rx_polarity_flip_fabric118.BCM8879X=0 +phy_rx_polarity_flip_fabric119.BCM8879X=1 + +phy_rx_polarity_flip_fabric120.BCM8879X=1 +phy_rx_polarity_flip_fabric121.BCM8879X=0 +phy_rx_polarity_flip_fabric122.BCM8879X=1 +phy_rx_polarity_flip_fabric123.BCM8879X=0 + +phy_rx_polarity_flip_fabric124.BCM8879X=1 +phy_rx_polarity_flip_fabric125.BCM8879X=0 +phy_rx_polarity_flip_fabric126.BCM8879X=1 +phy_rx_polarity_flip_fabric127.BCM8879X=0 + +phy_rx_polarity_flip_fabric128.BCM8879X=0 +phy_rx_polarity_flip_fabric129.BCM8879X=1 +phy_rx_polarity_flip_fabric130.BCM8879X=0 +phy_rx_polarity_flip_fabric131.BCM8879X=1 + +phy_rx_polarity_flip_fabric132.BCM8879X=1 +phy_rx_polarity_flip_fabric133.BCM8879X=0 +phy_rx_polarity_flip_fabric134.BCM8879X=1 +phy_rx_polarity_flip_fabric135.BCM8879X=0 + +phy_rx_polarity_flip_fabric136.BCM8879X=0 +phy_rx_polarity_flip_fabric137.BCM8879X=1 +phy_rx_polarity_flip_fabric138.BCM8879X=0 +phy_rx_polarity_flip_fabric139.BCM8879X=1 + +phy_rx_polarity_flip_fabric140.BCM8879X=1 +phy_rx_polarity_flip_fabric141.BCM8879X=0 +phy_rx_polarity_flip_fabric142.BCM8879X=1 +phy_rx_polarity_flip_fabric143.BCM8879X=0 + +phy_rx_polarity_flip_fabric144.BCM8879X=1 +phy_rx_polarity_flip_fabric145.BCM8879X=0 +phy_rx_polarity_flip_fabric146.BCM8879X=1 +phy_rx_polarity_flip_fabric147.BCM8879X=0 + +phy_rx_polarity_flip_fabric148.BCM8879X=0 +phy_rx_polarity_flip_fabric149.BCM8879X=1 +phy_rx_polarity_flip_fabric150.BCM8879X=0 +phy_rx_polarity_flip_fabric151.BCM8879X=1 + +phy_rx_polarity_flip_fabric152.BCM8879X=1 +phy_rx_polarity_flip_fabric153.BCM8879X=0 +phy_rx_polarity_flip_fabric154.BCM8879X=1 +phy_rx_polarity_flip_fabric155.BCM8879X=0 + +phy_rx_polarity_flip_fabric156.BCM8879X=0 +phy_rx_polarity_flip_fabric157.BCM8879X=1 +phy_rx_polarity_flip_fabric158.BCM8879X=0 +phy_rx_polarity_flip_fabric159.BCM8879X=1 + +phy_rx_polarity_flip_fabric160.BCM8879X=1 +phy_rx_polarity_flip_fabric161.BCM8879X=0 +phy_rx_polarity_flip_fabric162.BCM8879X=1 +phy_rx_polarity_flip_fabric163.BCM8879X=0 + +phy_rx_polarity_flip_fabric164.BCM8879X=1 +phy_rx_polarity_flip_fabric165.BCM8879X=0 +phy_rx_polarity_flip_fabric166.BCM8879X=1 +phy_rx_polarity_flip_fabric167.BCM8879X=0 + +phy_rx_polarity_flip_fabric168.BCM8879X=1 +phy_rx_polarity_flip_fabric169.BCM8879X=0 +phy_rx_polarity_flip_fabric170.BCM8879X=1 +phy_rx_polarity_flip_fabric171.BCM8879X=0 + +phy_rx_polarity_flip_fabric172.BCM8879X=0 +phy_rx_polarity_flip_fabric173.BCM8879X=1 +phy_rx_polarity_flip_fabric174.BCM8879X=0 +phy_rx_polarity_flip_fabric175.BCM8879X=1 + +phy_rx_polarity_flip_fabric176.BCM8879X=1 +phy_rx_polarity_flip_fabric177.BCM8879X=0 +phy_rx_polarity_flip_fabric178.BCM8879X=1 +phy_rx_polarity_flip_fabric179.BCM8879X=0 + +phy_rx_polarity_flip_fabric180.BCM8879X=0 +phy_rx_polarity_flip_fabric181.BCM8879X=1 +phy_rx_polarity_flip_fabric182.BCM8879X=0 +phy_rx_polarity_flip_fabric183.BCM8879X=1 + +phy_rx_polarity_flip_fabric184.BCM8879X=1 +phy_rx_polarity_flip_fabric185.BCM8879X=0 +phy_rx_polarity_flip_fabric186.BCM8879X=1 +phy_rx_polarity_flip_fabric187.BCM8879X=0 + +phy_rx_polarity_flip_fabric188.BCM8879X=1 +phy_rx_polarity_flip_fabric189.BCM8879X=0 +phy_rx_polarity_flip_fabric190.BCM8879X=1 +phy_rx_polarity_flip_fabric191.BCM8879X=0 + + +phy_tx_polarity_flip_fabric0.BCM8879X=0 +phy_tx_polarity_flip_fabric1.BCM8879X=1 +phy_tx_polarity_flip_fabric2.BCM8879X=0 +phy_tx_polarity_flip_fabric3.BCM8879X=1 + +phy_tx_polarity_flip_fabric4.BCM8879X=0 +phy_tx_polarity_flip_fabric5.BCM8879X=1 +phy_tx_polarity_flip_fabric6.BCM8879X=0 +phy_tx_polarity_flip_fabric7.BCM8879X=1 + +phy_tx_polarity_flip_fabric8.BCM8879X=1 +phy_tx_polarity_flip_fabric9.BCM8879X=0 +phy_tx_polarity_flip_fabric10.BCM8879X=1 +phy_tx_polarity_flip_fabric11.BCM8879X=0 + +phy_tx_polarity_flip_fabric12.BCM8879X=0 +phy_tx_polarity_flip_fabric13.BCM8879X=1 +phy_tx_polarity_flip_fabric14.BCM8879X=0 +phy_tx_polarity_flip_fabric15.BCM8879X=1 + +phy_tx_polarity_flip_fabric16.BCM8879X=0 +phy_tx_polarity_flip_fabric17.BCM8879X=1 +phy_tx_polarity_flip_fabric18.BCM8879X=0 +phy_tx_polarity_flip_fabric19.BCM8879X=1 + +phy_tx_polarity_flip_fabric20.BCM8879X=1 +phy_tx_polarity_flip_fabric21.BCM8879X=0 +phy_tx_polarity_flip_fabric22.BCM8879X=1 +phy_tx_polarity_flip_fabric23.BCM8879X=0 + +phy_tx_polarity_flip_fabric24.BCM8879X=0 +phy_tx_polarity_flip_fabric25.BCM8879X=1 +phy_tx_polarity_flip_fabric26.BCM8879X=0 +phy_tx_polarity_flip_fabric27.BCM8879X=1 + +phy_tx_polarity_flip_fabric28.BCM8879X=0 +phy_tx_polarity_flip_fabric29.BCM8879X=1 +phy_tx_polarity_flip_fabric30.BCM8879X=0 +phy_tx_polarity_flip_fabric31.BCM8879X=1 + +phy_tx_polarity_flip_fabric32.BCM8879X=1 +phy_tx_polarity_flip_fabric33.BCM8879X=0 +phy_tx_polarity_flip_fabric34.BCM8879X=1 +phy_tx_polarity_flip_fabric35.BCM8879X=0 + +phy_tx_polarity_flip_fabric36.BCM8879X=0 +phy_tx_polarity_flip_fabric37.BCM8879X=1 +phy_tx_polarity_flip_fabric38.BCM8879X=0 +phy_tx_polarity_flip_fabric39.BCM8879X=1 + +phy_tx_polarity_flip_fabric40.BCM8879X=1 +phy_tx_polarity_flip_fabric41.BCM8879X=0 +phy_tx_polarity_flip_fabric42.BCM8879X=1 +phy_tx_polarity_flip_fabric43.BCM8879X=0 + +phy_tx_polarity_flip_fabric44.BCM8879X=0 +phy_tx_polarity_flip_fabric45.BCM8879X=1 +phy_tx_polarity_flip_fabric46.BCM8879X=0 +phy_tx_polarity_flip_fabric47.BCM8879X=1 + +phy_tx_polarity_flip_fabric48.BCM8879X=0 +phy_tx_polarity_flip_fabric49.BCM8879X=1 +phy_tx_polarity_flip_fabric50.BCM8879X=0 +phy_tx_polarity_flip_fabric51.BCM8879X=1 + +phy_tx_polarity_flip_fabric52.BCM8879X=1 +phy_tx_polarity_flip_fabric53.BCM8879X=0 +phy_tx_polarity_flip_fabric54.BCM8879X=1 +phy_tx_polarity_flip_fabric55.BCM8879X=0 + +phy_tx_polarity_flip_fabric56.BCM8879X=1 +phy_tx_polarity_flip_fabric57.BCM8879X=0 +phy_tx_polarity_flip_fabric58.BCM8879X=1 +phy_tx_polarity_flip_fabric59.BCM8879X=0 + +phy_tx_polarity_flip_fabric60.BCM8879X=1 +phy_tx_polarity_flip_fabric61.BCM8879X=0 +phy_tx_polarity_flip_fabric62.BCM8879X=1 +phy_tx_polarity_flip_fabric63.BCM8879X=0 + +phy_tx_polarity_flip_fabric64.BCM8879X=1 +phy_tx_polarity_flip_fabric65.BCM8879X=0 +phy_tx_polarity_flip_fabric66.BCM8879X=1 +phy_tx_polarity_flip_fabric67.BCM8879X=0 + +phy_tx_polarity_flip_fabric68.BCM8879X=0 +phy_tx_polarity_flip_fabric69.BCM8879X=1 +phy_tx_polarity_flip_fabric70.BCM8879X=0 +phy_tx_polarity_flip_fabric71.BCM8879X=1 + +phy_tx_polarity_flip_fabric72.BCM8879X=0 +phy_tx_polarity_flip_fabric73.BCM8879X=1 +phy_tx_polarity_flip_fabric74.BCM8879X=0 +phy_tx_polarity_flip_fabric75.BCM8879X=1 + +phy_tx_polarity_flip_fabric76.BCM8879X=1 +phy_tx_polarity_flip_fabric77.BCM8879X=0 +phy_tx_polarity_flip_fabric78.BCM8879X=1 +phy_tx_polarity_flip_fabric79.BCM8879X=0 + +phy_tx_polarity_flip_fabric80.BCM8879X=0 +phy_tx_polarity_flip_fabric81.BCM8879X=1 +phy_tx_polarity_flip_fabric82.BCM8879X=0 +phy_tx_polarity_flip_fabric83.BCM8879X=1 + +phy_tx_polarity_flip_fabric84.BCM8879X=1 +phy_tx_polarity_flip_fabric85.BCM8879X=0 +phy_tx_polarity_flip_fabric86.BCM8879X=1 +phy_tx_polarity_flip_fabric87.BCM8879X=0 + +phy_tx_polarity_flip_fabric88.BCM8879X=0 +phy_tx_polarity_flip_fabric89.BCM8879X=1 +phy_tx_polarity_flip_fabric90.BCM8879X=0 +phy_tx_polarity_flip_fabric91.BCM8879X=1 + +phy_tx_polarity_flip_fabric92.BCM8879X=0 +phy_tx_polarity_flip_fabric93.BCM8879X=1 +phy_tx_polarity_flip_fabric94.BCM8879X=0 +phy_tx_polarity_flip_fabric95.BCM8879X=1 + +phy_tx_polarity_flip_fabric96.BCM8879X=1 +phy_tx_polarity_flip_fabric97.BCM8879X=0 +phy_tx_polarity_flip_fabric98.BCM8879X=1 +phy_tx_polarity_flip_fabric99.BCM8879X=0 + +phy_tx_polarity_flip_fabric100.BCM8879X=0 +phy_tx_polarity_flip_fabric101.BCM8879X=1 +phy_tx_polarity_flip_fabric102.BCM8879X=0 +phy_tx_polarity_flip_fabric103.BCM8879X=1 + +phy_tx_polarity_flip_fabric104.BCM8879X=1 +phy_tx_polarity_flip_fabric105.BCM8879X=0 +phy_tx_polarity_flip_fabric106.BCM8879X=1 +phy_tx_polarity_flip_fabric107.BCM8879X=0 + +phy_tx_polarity_flip_fabric108.BCM8879X=1 +phy_tx_polarity_flip_fabric109.BCM8879X=0 +phy_tx_polarity_flip_fabric110.BCM8879X=1 +phy_tx_polarity_flip_fabric111.BCM8879X=0 + +phy_tx_polarity_flip_fabric112.BCM8879X=0 +phy_tx_polarity_flip_fabric113.BCM8879X=1 +phy_tx_polarity_flip_fabric114.BCM8879X=0 +phy_tx_polarity_flip_fabric115.BCM8879X=1 + +phy_tx_polarity_flip_fabric116.BCM8879X=1 +phy_tx_polarity_flip_fabric117.BCM8879X=0 +phy_tx_polarity_flip_fabric118.BCM8879X=1 +phy_tx_polarity_flip_fabric119.BCM8879X=0 + +phy_tx_polarity_flip_fabric120.BCM8879X=0 +phy_tx_polarity_flip_fabric121.BCM8879X=1 +phy_tx_polarity_flip_fabric122.BCM8879X=0 +phy_tx_polarity_flip_fabric123.BCM8879X=1 + +phy_tx_polarity_flip_fabric124.BCM8879X=0 +phy_tx_polarity_flip_fabric125.BCM8879X=1 +phy_tx_polarity_flip_fabric126.BCM8879X=0 +phy_tx_polarity_flip_fabric127.BCM8879X=1 + +phy_tx_polarity_flip_fabric128.BCM8879X=1 +phy_tx_polarity_flip_fabric129.BCM8879X=0 +phy_tx_polarity_flip_fabric130.BCM8879X=1 +phy_tx_polarity_flip_fabric131.BCM8879X=0 + +phy_tx_polarity_flip_fabric132.BCM8879X=0 +phy_tx_polarity_flip_fabric133.BCM8879X=1 +phy_tx_polarity_flip_fabric134.BCM8879X=0 +phy_tx_polarity_flip_fabric135.BCM8879X=1 + +phy_tx_polarity_flip_fabric136.BCM8879X=1 +phy_tx_polarity_flip_fabric137.BCM8879X=0 +phy_tx_polarity_flip_fabric138.BCM8879X=1 +phy_tx_polarity_flip_fabric139.BCM8879X=0 + +phy_tx_polarity_flip_fabric140.BCM8879X=0 +phy_tx_polarity_flip_fabric141.BCM8879X=1 +phy_tx_polarity_flip_fabric142.BCM8879X=0 +phy_tx_polarity_flip_fabric143.BCM8879X=1 + +phy_tx_polarity_flip_fabric144.BCM8879X=0 +phy_tx_polarity_flip_fabric145.BCM8879X=1 +phy_tx_polarity_flip_fabric146.BCM8879X=0 +phy_tx_polarity_flip_fabric147.BCM8879X=1 + +phy_tx_polarity_flip_fabric148.BCM8879X=1 +phy_tx_polarity_flip_fabric149.BCM8879X=0 +phy_tx_polarity_flip_fabric150.BCM8879X=1 +phy_tx_polarity_flip_fabric151.BCM8879X=0 + +phy_tx_polarity_flip_fabric152.BCM8879X=0 +phy_tx_polarity_flip_fabric153.BCM8879X=1 +phy_tx_polarity_flip_fabric154.BCM8879X=0 +phy_tx_polarity_flip_fabric155.BCM8879X=1 + +phy_tx_polarity_flip_fabric156.BCM8879X=1 +phy_tx_polarity_flip_fabric157.BCM8879X=0 +phy_tx_polarity_flip_fabric158.BCM8879X=1 +phy_tx_polarity_flip_fabric159.BCM8879X=0 + +phy_tx_polarity_flip_fabric160.BCM8879X=0 +phy_tx_polarity_flip_fabric161.BCM8879X=1 +phy_tx_polarity_flip_fabric162.BCM8879X=0 +phy_tx_polarity_flip_fabric163.BCM8879X=1 + +phy_tx_polarity_flip_fabric164.BCM8879X=0 +phy_tx_polarity_flip_fabric165.BCM8879X=1 +phy_tx_polarity_flip_fabric166.BCM8879X=0 +phy_tx_polarity_flip_fabric167.BCM8879X=1 + +phy_tx_polarity_flip_fabric168.BCM8879X=0 +phy_tx_polarity_flip_fabric169.BCM8879X=1 +phy_tx_polarity_flip_fabric170.BCM8879X=0 +phy_tx_polarity_flip_fabric171.BCM8879X=1 + +phy_tx_polarity_flip_fabric172.BCM8879X=1 +phy_tx_polarity_flip_fabric173.BCM8879X=0 +phy_tx_polarity_flip_fabric174.BCM8879X=1 +phy_tx_polarity_flip_fabric175.BCM8879X=0 + +phy_tx_polarity_flip_fabric176.BCM8879X=0 +phy_tx_polarity_flip_fabric177.BCM8879X=1 +phy_tx_polarity_flip_fabric178.BCM8879X=0 +phy_tx_polarity_flip_fabric179.BCM8879X=1 + +phy_tx_polarity_flip_fabric180.BCM8879X=1 +phy_tx_polarity_flip_fabric181.BCM8879X=0 +phy_tx_polarity_flip_fabric182.BCM8879X=1 +phy_tx_polarity_flip_fabric183.BCM8879X=0 + +phy_tx_polarity_flip_fabric184.BCM8879X=0 +phy_tx_polarity_flip_fabric185.BCM8879X=1 +phy_tx_polarity_flip_fabric186.BCM8879X=0 +phy_tx_polarity_flip_fabric187.BCM8879X=1 + +phy_tx_polarity_flip_fabric188.BCM8879X=0 +phy_tx_polarity_flip_fabric189.BCM8879X=1 +phy_tx_polarity_flip_fabric190.BCM8879X=0 +phy_tx_polarity_flip_fabric191.BCM8879X=1 + +port_init_cl72_0=0 +port_init_cl72_1=0 +port_init_cl72_2=0 +port_init_cl72_3=0 +port_init_cl72_4=0 +port_init_cl72_5=0 +port_init_cl72_6=0 +port_init_cl72_7=0 +port_init_cl72_8=0 +port_init_cl72_9=0 +port_init_cl72_10=0 +port_init_cl72_11=0 +port_init_cl72_12=0 +port_init_cl72_13=0 +port_init_cl72_14=0 +port_init_cl72_15=0 +port_init_cl72_16=0 +port_init_cl72_17=0 +port_init_cl72_18=0 +port_init_cl72_19=0 +port_init_cl72_20=0 +port_init_cl72_21=0 +port_init_cl72_22=0 +port_init_cl72_23=0 +port_init_cl72_24=0 +port_init_cl72_25=0 +port_init_cl72_26=0 +port_init_cl72_27=0 +port_init_cl72_28=0 +port_init_cl72_29=0 +port_init_cl72_30=0 +port_init_cl72_31=0 +port_init_cl72_32=0 +port_init_cl72_33=0 +port_init_cl72_34=0 +port_init_cl72_35=0 +port_init_cl72_36=0 +port_init_cl72_37=0 +port_init_cl72_38=0 +port_init_cl72_39=0 +port_init_cl72_40=0 +port_init_cl72_41=0 +port_init_cl72_42=0 +port_init_cl72_43=0 +port_init_cl72_44=0 +port_init_cl72_45=0 +port_init_cl72_46=0 +port_init_cl72_47=0 +port_init_cl72_48=0 +port_init_cl72_49=0 +port_init_cl72_50=0 +port_init_cl72_51=0 +port_init_cl72_52=0 +port_init_cl72_53=0 +port_init_cl72_54=0 +port_init_cl72_55=0 +port_init_cl72_56=0 +port_init_cl72_57=0 +port_init_cl72_58=0 +port_init_cl72_59=0 +port_init_cl72_60=0 +port_init_cl72_61=0 +port_init_cl72_62=0 +port_init_cl72_63=0 +port_init_cl72_64=0 +port_init_cl72_65=0 +port_init_cl72_66=0 +port_init_cl72_67=0 +port_init_cl72_68=0 +port_init_cl72_69=0 +port_init_cl72_70=0 +port_init_cl72_71=0 +port_init_cl72_72=0 +port_init_cl72_73=0 +port_init_cl72_74=0 +port_init_cl72_75=0 +port_init_cl72_76=0 +port_init_cl72_77=0 +port_init_cl72_78=0 +port_init_cl72_79=0 +port_init_cl72_80=0 +port_init_cl72_81=0 +port_init_cl72_82=0 +port_init_cl72_83=0 +port_init_cl72_84=0 +port_init_cl72_85=0 +port_init_cl72_86=0 +port_init_cl72_87=0 +port_init_cl72_88=0 +port_init_cl72_89=0 +port_init_cl72_90=0 +port_init_cl72_91=0 +port_init_cl72_92=0 +port_init_cl72_93=0 +port_init_cl72_94=0 +port_init_cl72_95=0 +port_init_cl72_96=0 +port_init_cl72_97=0 +port_init_cl72_98=0 +port_init_cl72_99=0 +port_init_cl72_100=0 +port_init_cl72_101=0 +port_init_cl72_102=0 +port_init_cl72_103=0 +port_init_cl72_104=0 +port_init_cl72_105=0 +port_init_cl72_106=0 +port_init_cl72_107=0 +port_init_cl72_108=0 +port_init_cl72_109=0 +port_init_cl72_110=0 +port_init_cl72_111=0 +port_init_cl72_112=0 +port_init_cl72_113=0 +port_init_cl72_114=0 +port_init_cl72_115=0 +port_init_cl72_116=0 +port_init_cl72_117=0 +port_init_cl72_118=0 +port_init_cl72_119=0 +port_init_cl72_120=0 +port_init_cl72_121=0 +port_init_cl72_122=0 +port_init_cl72_123=0 +port_init_cl72_124=0 +port_init_cl72_125=0 +port_init_cl72_126=0 +port_init_cl72_127=0 +port_init_cl72_128=0 +port_init_cl72_129=0 +port_init_cl72_130=0 +port_init_cl72_131=0 +port_init_cl72_132=0 +port_init_cl72_133=0 +port_init_cl72_134=0 +port_init_cl72_135=0 +port_init_cl72_136=0 +port_init_cl72_137=0 +port_init_cl72_138=0 +port_init_cl72_139=0 +port_init_cl72_140=0 +port_init_cl72_141=0 +port_init_cl72_142=0 +port_init_cl72_143=0 +port_init_cl72_144=0 +port_init_cl72_145=0 +port_init_cl72_146=0 +port_init_cl72_147=0 +port_init_cl72_148=0 +port_init_cl72_149=0 +port_init_cl72_150=0 +port_init_cl72_151=0 +port_init_cl72_152=0 +port_init_cl72_153=0 +port_init_cl72_154=0 +port_init_cl72_155=0 +port_init_cl72_156=0 +port_init_cl72_157=0 +port_init_cl72_158=0 +port_init_cl72_159=0 +port_init_cl72_160=0 +port_init_cl72_161=0 +port_init_cl72_162=0 +port_init_cl72_163=0 +port_init_cl72_164=0 +port_init_cl72_165=0 +port_init_cl72_166=0 +port_init_cl72_167=0 +port_init_cl72_168=0 +port_init_cl72_169=0 +port_init_cl72_170=0 +port_init_cl72_171=0 +port_init_cl72_172=0 +port_init_cl72_173=0 +port_init_cl72_174=0 +port_init_cl72_175=0 +port_init_cl72_176=0 +port_init_cl72_177=0 +port_init_cl72_178=0 +port_init_cl72_179=0 +port_init_cl72_180=0 +port_init_cl72_181=0 +port_init_cl72_182=0 +port_init_cl72_183=0 +port_init_cl72_184=0 +port_init_cl72_185=0 +port_init_cl72_186=0 +port_init_cl72_187=0 +port_init_cl72_188=0 +port_init_cl72_189=0 +port_init_cl72_190=0 +port_init_cl72_191=0 + +serdes_tx_taps_0.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_1.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_2.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_3.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_4.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_5.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_6.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_7.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_8.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_9.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_10.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_11.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_12.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_13.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_14.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_15.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_16.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_17.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_18.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_19.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_20.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_21.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_22.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_23.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_24.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_25.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_26.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_27.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_28.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_29.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_30.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_31.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_32.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_33.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_34.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_35.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_36.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_37.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_38.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_39.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_40.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_41.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_42.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_43.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_44.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_45.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_46.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_47.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_48.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_49.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_50.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_51.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_52.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_53.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_54.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_55.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_56.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_57.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_58.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_59.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_60.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_61.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_62.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_63.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_64.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_65.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_66.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_67.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_68.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_69.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_70.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_71.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_72.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_73.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_74.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_75.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_76.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_77.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_78.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_79.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_80.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_81.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_82.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_83.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_84.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_85.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_86.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_87.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_88.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_89.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_90.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_91.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_92.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_93.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_94.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_95.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_96.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_97.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_98.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_99.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_100.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_101.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_102.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_103.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_104.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_105.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_106.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_107.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_108.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_109.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_110.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_111.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_112.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_113.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_114.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_115.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_116.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_117.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_118.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_119.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_120.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_121.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_122.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_123.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_124.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_125.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_126.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_127.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_128.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_129.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_130.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_131.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_132.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_133.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_134.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_135.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_136.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_137.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_138.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_139.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_140.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_141.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_142.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_143.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_144.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_145.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_146.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_147.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_148.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_149.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_150.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_151.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_152.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_153.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_154.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_155.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_156.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_157.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_158.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_159.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_160.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_161.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_162.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_163.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_164.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_165.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_166.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_167.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_168.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_169.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_170.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_171.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_172.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_173.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_174.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_175.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_176.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_177.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_178.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_179.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_180.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_181.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_182.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_183.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_184.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_185.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_186.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_187.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_188.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_189.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_190.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_191.BCM8879X=pam4:-24:132:-12:0:0:0 + +serdes_lane_config_channel_mode_0.0=force_nr +serdes_lane_config_channel_mode_1.0=force_nr +serdes_lane_config_channel_mode_2.0=force_nr +serdes_lane_config_channel_mode_3.0=force_nr +serdes_lane_config_channel_mode_4.0=force_nr +serdes_lane_config_channel_mode_5.0=force_nr +serdes_lane_config_channel_mode_6.0=force_nr +serdes_lane_config_channel_mode_7.0=force_nr +serdes_lane_config_channel_mode_8.0=force_nr +serdes_lane_config_channel_mode_9.0=force_nr +serdes_lane_config_channel_mode_10.0=force_nr +serdes_lane_config_channel_mode_11.0=force_nr +serdes_lane_config_channel_mode_12.0=force_nr +serdes_lane_config_channel_mode_13.0=force_nr +serdes_lane_config_channel_mode_14.0=force_nr +serdes_lane_config_channel_mode_15.0=force_nr +serdes_lane_config_channel_mode_16.0=force_nr +serdes_lane_config_channel_mode_17.0=force_nr +serdes_lane_config_channel_mode_18.0=force_nr +serdes_lane_config_channel_mode_19.0=force_nr +serdes_lane_config_channel_mode_20.0=force_nr +serdes_lane_config_channel_mode_21.0=force_nr +serdes_lane_config_channel_mode_22.0=force_nr +serdes_lane_config_channel_mode_23.0=force_nr +serdes_lane_config_channel_mode_24.0=force_nr +serdes_lane_config_channel_mode_25.0=force_nr +serdes_lane_config_channel_mode_26.0=force_nr +serdes_lane_config_channel_mode_27.0=force_nr +serdes_lane_config_channel_mode_28.0=force_nr +serdes_lane_config_channel_mode_29.0=force_nr +serdes_lane_config_channel_mode_30.0=force_nr +serdes_lane_config_channel_mode_31.0=force_nr +serdes_lane_config_channel_mode_32.0=force_nr +serdes_lane_config_channel_mode_33.0=force_nr +serdes_lane_config_channel_mode_34.0=force_nr +serdes_lane_config_channel_mode_35.0=force_nr +serdes_lane_config_channel_mode_36.0=force_nr +serdes_lane_config_channel_mode_37.0=force_nr +serdes_lane_config_channel_mode_38.0=force_nr +serdes_lane_config_channel_mode_39.0=force_nr +serdes_lane_config_channel_mode_40.0=force_nr +serdes_lane_config_channel_mode_41.0=force_nr +serdes_lane_config_channel_mode_42.0=force_nr +serdes_lane_config_channel_mode_43.0=force_nr +serdes_lane_config_channel_mode_44.0=force_nr +serdes_lane_config_channel_mode_45.0=force_nr +serdes_lane_config_channel_mode_46.0=force_nr +serdes_lane_config_channel_mode_47.0=force_nr +serdes_lane_config_channel_mode_48.0=force_nr +serdes_lane_config_channel_mode_49.0=force_nr +serdes_lane_config_channel_mode_50.0=force_nr +serdes_lane_config_channel_mode_51.0=force_nr +serdes_lane_config_channel_mode_52.0=force_nr +serdes_lane_config_channel_mode_53.0=force_nr +serdes_lane_config_channel_mode_54.0=force_nr +serdes_lane_config_channel_mode_55.0=force_nr +serdes_lane_config_channel_mode_56.0=force_nr +serdes_lane_config_channel_mode_57.0=force_nr +serdes_lane_config_channel_mode_58.0=force_nr +serdes_lane_config_channel_mode_59.0=force_nr +serdes_lane_config_channel_mode_60.0=force_nr +serdes_lane_config_channel_mode_61.0=force_nr +serdes_lane_config_channel_mode_62.0=force_nr +serdes_lane_config_channel_mode_63.0=force_nr +serdes_lane_config_channel_mode_64.0=force_nr +serdes_lane_config_channel_mode_65.0=force_nr +serdes_lane_config_channel_mode_66.0=force_nr +serdes_lane_config_channel_mode_67.0=force_nr +serdes_lane_config_channel_mode_68.0=force_nr +serdes_lane_config_channel_mode_69.0=force_nr +serdes_lane_config_channel_mode_70.0=force_nr +serdes_lane_config_channel_mode_71.0=force_nr +serdes_lane_config_channel_mode_72.0=force_nr +serdes_lane_config_channel_mode_73.0=force_nr +serdes_lane_config_channel_mode_74.0=force_nr +serdes_lane_config_channel_mode_75.0=force_nr +serdes_lane_config_channel_mode_76.0=force_nr +serdes_lane_config_channel_mode_77.0=force_nr +serdes_lane_config_channel_mode_78.0=force_nr +serdes_lane_config_channel_mode_79.0=force_nr +serdes_lane_config_channel_mode_80.0=force_nr +serdes_lane_config_channel_mode_81.0=force_nr +serdes_lane_config_channel_mode_82.0=force_nr +serdes_lane_config_channel_mode_83.0=force_nr +serdes_lane_config_channel_mode_84.0=force_nr +serdes_lane_config_channel_mode_85.0=force_nr +serdes_lane_config_channel_mode_86.0=force_nr +serdes_lane_config_channel_mode_87.0=force_nr +serdes_lane_config_channel_mode_88.0=force_nr +serdes_lane_config_channel_mode_89.0=force_nr +serdes_lane_config_channel_mode_90.0=force_nr +serdes_lane_config_channel_mode_91.0=force_nr +serdes_lane_config_channel_mode_92.0=force_nr +serdes_lane_config_channel_mode_93.0=force_nr +serdes_lane_config_channel_mode_94.0=force_nr +serdes_lane_config_channel_mode_95.0=force_nr +serdes_lane_config_channel_mode_96.0=force_nr +serdes_lane_config_channel_mode_97.0=force_nr +serdes_lane_config_channel_mode_98.0=force_nr +serdes_lane_config_channel_mode_99.0=force_nr +serdes_lane_config_channel_mode_100.0=force_nr +serdes_lane_config_channel_mode_101.0=force_nr +serdes_lane_config_channel_mode_102.0=force_nr +serdes_lane_config_channel_mode_103.0=force_nr +serdes_lane_config_channel_mode_104.0=force_nr +serdes_lane_config_channel_mode_105.0=force_nr +serdes_lane_config_channel_mode_106.0=force_nr +serdes_lane_config_channel_mode_107.0=force_nr +serdes_lane_config_channel_mode_108.0=force_nr +serdes_lane_config_channel_mode_109.0=force_nr +serdes_lane_config_channel_mode_110.0=force_nr +serdes_lane_config_channel_mode_111.0=force_nr +serdes_lane_config_channel_mode_112.0=force_nr +serdes_lane_config_channel_mode_113.0=force_nr +serdes_lane_config_channel_mode_114.0=force_nr +serdes_lane_config_channel_mode_115.0=force_nr +serdes_lane_config_channel_mode_116.0=force_nr +serdes_lane_config_channel_mode_117.0=force_nr +serdes_lane_config_channel_mode_118.0=force_nr +serdes_lane_config_channel_mode_119.0=force_nr +serdes_lane_config_channel_mode_120.0=force_nr +serdes_lane_config_channel_mode_121.0=force_nr +serdes_lane_config_channel_mode_122.0=force_nr +serdes_lane_config_channel_mode_123.0=force_nr +serdes_lane_config_channel_mode_124.0=force_nr +serdes_lane_config_channel_mode_125.0=force_nr +serdes_lane_config_channel_mode_126.0=force_nr +serdes_lane_config_channel_mode_127.0=force_nr +serdes_lane_config_channel_mode_128.0=force_nr +serdes_lane_config_channel_mode_129.0=force_nr +serdes_lane_config_channel_mode_130.0=force_nr +serdes_lane_config_channel_mode_131.0=force_nr +serdes_lane_config_channel_mode_132.0=force_nr +serdes_lane_config_channel_mode_133.0=force_nr +serdes_lane_config_channel_mode_134.0=force_nr +serdes_lane_config_channel_mode_135.0=force_nr +serdes_lane_config_channel_mode_136.0=force_nr +serdes_lane_config_channel_mode_137.0=force_nr +serdes_lane_config_channel_mode_138.0=force_nr +serdes_lane_config_channel_mode_139.0=force_nr +serdes_lane_config_channel_mode_140.0=force_nr +serdes_lane_config_channel_mode_141.0=force_nr +serdes_lane_config_channel_mode_142.0=force_nr +serdes_lane_config_channel_mode_143.0=force_nr +serdes_lane_config_channel_mode_144.0=force_nr +serdes_lane_config_channel_mode_145.0=force_nr +serdes_lane_config_channel_mode_146.0=force_nr +serdes_lane_config_channel_mode_147.0=force_nr +serdes_lane_config_channel_mode_148.0=force_nr +serdes_lane_config_channel_mode_149.0=force_nr +serdes_lane_config_channel_mode_150.0=force_nr +serdes_lane_config_channel_mode_151.0=force_nr +serdes_lane_config_channel_mode_152.0=force_nr +serdes_lane_config_channel_mode_153.0=force_nr +serdes_lane_config_channel_mode_154.0=force_nr +serdes_lane_config_channel_mode_155.0=force_nr +serdes_lane_config_channel_mode_156.0=force_nr +serdes_lane_config_channel_mode_157.0=force_nr +serdes_lane_config_channel_mode_158.0=force_nr +serdes_lane_config_channel_mode_159.0=force_nr +serdes_lane_config_channel_mode_160.0=force_nr +serdes_lane_config_channel_mode_161.0=force_nr +serdes_lane_config_channel_mode_162.0=force_nr +serdes_lane_config_channel_mode_163.0=force_nr +serdes_lane_config_channel_mode_164.0=force_nr +serdes_lane_config_channel_mode_165.0=force_nr +serdes_lane_config_channel_mode_166.0=force_nr +serdes_lane_config_channel_mode_167.0=force_nr +serdes_lane_config_channel_mode_168.0=force_nr +serdes_lane_config_channel_mode_169.0=force_nr +serdes_lane_config_channel_mode_170.0=force_nr +serdes_lane_config_channel_mode_171.0=force_nr +serdes_lane_config_channel_mode_172.0=force_nr +serdes_lane_config_channel_mode_173.0=force_nr +serdes_lane_config_channel_mode_174.0=force_nr +serdes_lane_config_channel_mode_175.0=force_nr +serdes_lane_config_channel_mode_176.0=force_nr +serdes_lane_config_channel_mode_177.0=force_nr +serdes_lane_config_channel_mode_178.0=force_nr +serdes_lane_config_channel_mode_179.0=force_nr +serdes_lane_config_channel_mode_180.0=force_nr +serdes_lane_config_channel_mode_181.0=force_nr +serdes_lane_config_channel_mode_182.0=force_nr +serdes_lane_config_channel_mode_183.0=force_nr +serdes_lane_config_channel_mode_184.0=force_nr +serdes_lane_config_channel_mode_185.0=force_nr +serdes_lane_config_channel_mode_186.0=force_nr +serdes_lane_config_channel_mode_187.0=force_nr +serdes_lane_config_channel_mode_188.0=force_nr +serdes_lane_config_channel_mode_189.0=force_nr +serdes_lane_config_channel_mode_190.0=force_nr +serdes_lane_config_channel_mode_191.0=force_nr + + +serdes_qrtt_active_0.0=1 +serdes_qrtt_active_1.0=1 +serdes_qrtt_active_2.0=1 +serdes_qrtt_active_3.0=1 +serdes_qrtt_active_4.0=1 +serdes_qrtt_active_5.0=1 +serdes_qrtt_active_6.0=1 +serdes_qrtt_active_7.0=1 +serdes_qrtt_active_8.0=1 +serdes_qrtt_active_9.0=1 +serdes_qrtt_active_10.0=1 +serdes_qrtt_active_11.0=1 +serdes_qrtt_active_12.0=1 +serdes_qrtt_active_13.0=1 +serdes_qrtt_active_14.0=1 +serdes_qrtt_active_15.0=1 +serdes_qrtt_active_16.0=1 +serdes_qrtt_active_17.0=1 +serdes_qrtt_active_18.0=1 +serdes_qrtt_active_19.0=1 +serdes_qrtt_active_20.0=1 +serdes_qrtt_active_21.0=1 +serdes_qrtt_active_22.0=1 +serdes_qrtt_active_23.0=1 +serdes_qrtt_active_24.0=1 +serdes_qrtt_active_25.0=1 +serdes_qrtt_active_26.0=1 +serdes_qrtt_active_27.0=1 +serdes_qrtt_active_28.0=1 +serdes_qrtt_active_29.0=1 +serdes_qrtt_active_30.0=1 +serdes_qrtt_active_31.0=1 +serdes_qrtt_active_32.0=1 +serdes_qrtt_active_33.0=1 +serdes_qrtt_active_34.0=1 +serdes_qrtt_active_35.0=1 +serdes_qrtt_active_36.0=1 +serdes_qrtt_active_37.0=1 +serdes_qrtt_active_38.0=1 +serdes_qrtt_active_39.0=1 +serdes_qrtt_active_40.0=1 +serdes_qrtt_active_41.0=1 +serdes_qrtt_active_42.0=1 +serdes_qrtt_active_43.0=1 +serdes_qrtt_active_44.0=1 +serdes_qrtt_active_45.0=1 +serdes_qrtt_active_46.0=1 +serdes_qrtt_active_47.0=1 diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/2/config-ramon-2-0.bcm b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/2/config-ramon-2-0.bcm new file mode 100644 index 000000000000..6a5423c5e185 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/2/config-ramon-2-0.bcm @@ -0,0 +1,1394 @@ + +appl_enable_intr_init.BCM8879X=0 +appl_param_module_id.BCM8879X=3 +bcm_linkscan_interval.BCM8879X=0 +bcm_stat_interval.BCM8879X=4000000 +bist_enable.BCM8879X=0 +core_clock_speed_khz.BCM8879X=1000000 +custom_feature_access_only.BCM8879X=0 +custom_feature_lane_swap_disable.BCM8879X=0 +dport_map_direct.BCM8879X=1 +fabric_cell_fifo_dma_enable.BCM8879X=0 +fabric_device_mode.BCM8879X=SINGLE_STAGE_FE2 +fabric_load_balancing_mode.BCM8879X=NORMAL_LOAD_BALANCE +fabric_multicast_mode.BCM8879X=DIRECT +fabric_num_pipes.BCM8879X=1 +fabric_pipe_map.BCM8879X=0 +fe_mc_id_range.BCM8879X=128K +load_firmware.BCM8879X=0x102 +mdio_output_delay_ext.BCM8879X=14 +mdio_output_delay_int.BCM8879X=25 +mem_cache_enable_parity.BCM8879X=1 +mm_intr_enable.BCM8879X=0 +mm_timeout_usec.BCM8879X=300000 +polled_irq_delay.BCM8879X=100000 +polled_irq_mode.BCM8879X=1 +port_fec.BCM8879X=7 +port_init_cl72.BCM8879X=0 +port_init_speed.BCM8879X=53125 +rate_ext_mdio_divisor.BCM8879X=14 +rate_int_mdio_divisor.BCM8879X=50 +schan_intr_enable.BCM8879X=0 +schan_timeout_usec.BCM8879X=300000 +serdes_fabric_clk_freq_in.BCM8879X=1 +serdes_fabric_clk_freq_out.BCM8879X=bypass +soc_family.BCM8879X=BCM8879X +srd_tx_drv_hv_disable.BCM8879X=0 +system_contains_multiple_pipe_device.BCM8879X=0 +system_ref_core_clock_khz.BCM8879X=1200000 +table_dma_enable.BCM8879X=0 +tdma_intr_enable.BCM8879X=0 +tdma_timeout_usec.BCM8879X=5000000 +tslam_dma_enable.BCM8879X=0 +tslam_intr_enable.BCM8879X=0 +tslam_timeout_usec.BCM8879X=5000000 + +lane_to_serdes_map_fabric_lane0.BCM8879X=rx0:tx0 +lane_to_serdes_map_fabric_lane1.BCM8879X=rx1:tx1 +lane_to_serdes_map_fabric_lane2.BCM8879X=rx2:tx2 +lane_to_serdes_map_fabric_lane3.BCM8879X=rx3:tx3 + +lane_to_serdes_map_fabric_lane4.BCM8879X=rx4:tx4 +lane_to_serdes_map_fabric_lane5.BCM8879X=rx5:tx5 +lane_to_serdes_map_fabric_lane6.BCM8879X=rx6:tx6 +lane_to_serdes_map_fabric_lane7.BCM8879X=rx7:tx7 + +lane_to_serdes_map_fabric_lane8.BCM8879X=rx8:tx8 +lane_to_serdes_map_fabric_lane9.BCM8879X=rx9:tx9 +lane_to_serdes_map_fabric_lane10.BCM8879X=rx10:tx10 +lane_to_serdes_map_fabric_lane11.BCM8879X=rx11:tx11 + +lane_to_serdes_map_fabric_lane12.BCM8879X=rx12:tx12 +lane_to_serdes_map_fabric_lane13.BCM8879X=rx13:tx13 +lane_to_serdes_map_fabric_lane14.BCM8879X=rx14:tx14 +lane_to_serdes_map_fabric_lane15.BCM8879X=rx15:tx15 + +lane_to_serdes_map_fabric_lane16.BCM8879X=rx16:tx16 +lane_to_serdes_map_fabric_lane17.BCM8879X=rx17:tx17 +lane_to_serdes_map_fabric_lane18.BCM8879X=rx18:tx18 +lane_to_serdes_map_fabric_lane19.BCM8879X=rx19:tx19 + +lane_to_serdes_map_fabric_lane20.BCM8879X=rx20:tx20 +lane_to_serdes_map_fabric_lane21.BCM8879X=rx21:tx21 +lane_to_serdes_map_fabric_lane22.BCM8879X=rx22:tx22 +lane_to_serdes_map_fabric_lane23.BCM8879X=rx23:tx23 + +lane_to_serdes_map_fabric_lane24.BCM8879X=rx24:tx24 +lane_to_serdes_map_fabric_lane25.BCM8879X=rx25:tx25 +lane_to_serdes_map_fabric_lane26.BCM8879X=rx26:tx26 +lane_to_serdes_map_fabric_lane27.BCM8879X=rx27:tx27 + +lane_to_serdes_map_fabric_lane28.BCM8879X=rx28:tx28 +lane_to_serdes_map_fabric_lane29.BCM8879X=rx29:tx29 +lane_to_serdes_map_fabric_lane30.BCM8879X=rx30:tx30 +lane_to_serdes_map_fabric_lane31.BCM8879X=rx31:tx31 + +lane_to_serdes_map_fabric_lane32.BCM8879X=rx32:tx32 +lane_to_serdes_map_fabric_lane33.BCM8879X=rx33:tx33 +lane_to_serdes_map_fabric_lane34.BCM8879X=rx34:tx34 +lane_to_serdes_map_fabric_lane35.BCM8879X=rx35:tx35 + +lane_to_serdes_map_fabric_lane36.BCM8879X=rx36:tx36 +lane_to_serdes_map_fabric_lane37.BCM8879X=rx37:tx37 +lane_to_serdes_map_fabric_lane38.BCM8879X=rx38:tx38 +lane_to_serdes_map_fabric_lane39.BCM8879X=rx39:tx39 + +lane_to_serdes_map_fabric_lane40.BCM8879X=rx40:tx40 +lane_to_serdes_map_fabric_lane41.BCM8879X=rx41:tx41 +lane_to_serdes_map_fabric_lane42.BCM8879X=rx42:tx42 +lane_to_serdes_map_fabric_lane43.BCM8879X=rx43:tx43 + +lane_to_serdes_map_fabric_lane44.BCM8879X=rx44:tx44 +lane_to_serdes_map_fabric_lane45.BCM8879X=rx45:tx45 +lane_to_serdes_map_fabric_lane46.BCM8879X=rx46:tx46 +lane_to_serdes_map_fabric_lane47.BCM8879X=rx47:tx47 + +lane_to_serdes_map_fabric_lane48.BCM8879X=rx48:tx48 +lane_to_serdes_map_fabric_lane49.BCM8879X=rx49:tx49 +lane_to_serdes_map_fabric_lane50.BCM8879X=rx50:tx50 +lane_to_serdes_map_fabric_lane51.BCM8879X=rx51:tx51 + +lane_to_serdes_map_fabric_lane52.BCM8879X=rx52:tx52 +lane_to_serdes_map_fabric_lane53.BCM8879X=rx53:tx53 +lane_to_serdes_map_fabric_lane54.BCM8879X=rx54:tx54 +lane_to_serdes_map_fabric_lane55.BCM8879X=rx55:tx55 + +lane_to_serdes_map_fabric_lane56.BCM8879X=rx56:tx56 +lane_to_serdes_map_fabric_lane57.BCM8879X=rx57:tx57 +lane_to_serdes_map_fabric_lane58.BCM8879X=rx58:tx58 +lane_to_serdes_map_fabric_lane59.BCM8879X=rx59:tx59 + +lane_to_serdes_map_fabric_lane60.BCM8879X=rx60:tx60 +lane_to_serdes_map_fabric_lane61.BCM8879X=rx61:tx61 +lane_to_serdes_map_fabric_lane62.BCM8879X=rx62:tx62 +lane_to_serdes_map_fabric_lane63.BCM8879X=rx63:tx63 + +lane_to_serdes_map_fabric_lane64.BCM8879X=rx64:tx64 +lane_to_serdes_map_fabric_lane65.BCM8879X=rx65:tx65 +lane_to_serdes_map_fabric_lane66.BCM8879X=rx66:tx66 +lane_to_serdes_map_fabric_lane67.BCM8879X=rx67:tx67 + +lane_to_serdes_map_fabric_lane68.BCM8879X=rx68:tx68 +lane_to_serdes_map_fabric_lane69.BCM8879X=rx69:tx69 +lane_to_serdes_map_fabric_lane70.BCM8879X=rx70:tx70 +lane_to_serdes_map_fabric_lane71.BCM8879X=rx71:tx71 + +lane_to_serdes_map_fabric_lane72.BCM8879X=rx72:tx72 +lane_to_serdes_map_fabric_lane73.BCM8879X=rx73:tx73 +lane_to_serdes_map_fabric_lane74.BCM8879X=rx74:tx74 +lane_to_serdes_map_fabric_lane75.BCM8879X=rx75:tx75 + +lane_to_serdes_map_fabric_lane76.BCM8879X=rx76:tx76 +lane_to_serdes_map_fabric_lane77.BCM8879X=rx77:tx77 +lane_to_serdes_map_fabric_lane78.BCM8879X=rx78:tx78 +lane_to_serdes_map_fabric_lane79.BCM8879X=rx79:tx79 + +lane_to_serdes_map_fabric_lane80.BCM8879X=rx80:tx80 +lane_to_serdes_map_fabric_lane81.BCM8879X=rx81:tx81 +lane_to_serdes_map_fabric_lane82.BCM8879X=rx82:tx82 +lane_to_serdes_map_fabric_lane83.BCM8879X=rx83:tx83 + +lane_to_serdes_map_fabric_lane84.BCM8879X=rx84:tx84 +lane_to_serdes_map_fabric_lane85.BCM8879X=rx85:tx85 +lane_to_serdes_map_fabric_lane86.BCM8879X=rx86:tx86 +lane_to_serdes_map_fabric_lane87.BCM8879X=rx87:tx87 + +lane_to_serdes_map_fabric_lane88.BCM8879X=rx88:tx88 +lane_to_serdes_map_fabric_lane89.BCM8879X=rx89:tx89 +lane_to_serdes_map_fabric_lane90.BCM8879X=rx90:tx90 +lane_to_serdes_map_fabric_lane91.BCM8879X=rx91:tx91 + +lane_to_serdes_map_fabric_lane92.BCM8879X=rx92:tx92 +lane_to_serdes_map_fabric_lane93.BCM8879X=rx93:tx93 +lane_to_serdes_map_fabric_lane94.BCM8879X=rx94:tx94 +lane_to_serdes_map_fabric_lane95.BCM8879X=rx95:tx95 + +lane_to_serdes_map_fabric_lane96.BCM8879X=rx96:tx96 +lane_to_serdes_map_fabric_lane97.BCM8879X=rx97:tx97 +lane_to_serdes_map_fabric_lane98.BCM8879X=rx98:tx98 +lane_to_serdes_map_fabric_lane99.BCM8879X=rx99:tx99 + +lane_to_serdes_map_fabric_lane100.BCM8879X=rx100:tx100 +lane_to_serdes_map_fabric_lane101.BCM8879X=rx101:tx101 +lane_to_serdes_map_fabric_lane102.BCM8879X=rx102:tx102 +lane_to_serdes_map_fabric_lane103.BCM8879X=rx103:tx103 + +lane_to_serdes_map_fabric_lane104.BCM8879X=rx104:tx104 +lane_to_serdes_map_fabric_lane105.BCM8879X=rx105:tx105 +lane_to_serdes_map_fabric_lane106.BCM8879X=rx106:tx106 +lane_to_serdes_map_fabric_lane107.BCM8879X=rx107:tx107 + +lane_to_serdes_map_fabric_lane108.BCM8879X=rx108:tx108 +lane_to_serdes_map_fabric_lane109.BCM8879X=rx109:tx109 +lane_to_serdes_map_fabric_lane110.BCM8879X=rx110:tx110 +lane_to_serdes_map_fabric_lane111.BCM8879X=rx111:tx111 + +lane_to_serdes_map_fabric_lane112.BCM8879X=rx112:tx112 +lane_to_serdes_map_fabric_lane113.BCM8879X=rx113:tx113 +lane_to_serdes_map_fabric_lane114.BCM8879X=rx114:tx114 +lane_to_serdes_map_fabric_lane115.BCM8879X=rx115:tx115 + +lane_to_serdes_map_fabric_lane116.BCM8879X=rx116:tx116 +lane_to_serdes_map_fabric_lane117.BCM8879X=rx117:tx117 +lane_to_serdes_map_fabric_lane118.BCM8879X=rx118:tx118 +lane_to_serdes_map_fabric_lane119.BCM8879X=rx119:tx119 + +lane_to_serdes_map_fabric_lane120.BCM8879X=rx120:tx120 +lane_to_serdes_map_fabric_lane121.BCM8879X=rx121:tx121 +lane_to_serdes_map_fabric_lane122.BCM8879X=rx122:tx122 +lane_to_serdes_map_fabric_lane123.BCM8879X=rx123:tx123 + +lane_to_serdes_map_fabric_lane124.BCM8879X=rx124:tx124 +lane_to_serdes_map_fabric_lane125.BCM8879X=rx125:tx125 +lane_to_serdes_map_fabric_lane126.BCM8879X=rx126:tx126 +lane_to_serdes_map_fabric_lane127.BCM8879X=rx127:tx127 + +lane_to_serdes_map_fabric_lane128.BCM8879X=rx128:tx128 +lane_to_serdes_map_fabric_lane129.BCM8879X=rx129:tx129 +lane_to_serdes_map_fabric_lane130.BCM8879X=rx130:tx130 +lane_to_serdes_map_fabric_lane131.BCM8879X=rx131:tx131 + +lane_to_serdes_map_fabric_lane132.BCM8879X=rx132:tx132 +lane_to_serdes_map_fabric_lane133.BCM8879X=rx133:tx133 +lane_to_serdes_map_fabric_lane134.BCM8879X=rx134:tx134 +lane_to_serdes_map_fabric_lane135.BCM8879X=rx135:tx135 + +lane_to_serdes_map_fabric_lane136.BCM8879X=rx136:tx136 +lane_to_serdes_map_fabric_lane137.BCM8879X=rx137:tx137 +lane_to_serdes_map_fabric_lane138.BCM8879X=rx138:tx138 +lane_to_serdes_map_fabric_lane139.BCM8879X=rx139:tx139 + +lane_to_serdes_map_fabric_lane140.BCM8879X=rx140:tx140 +lane_to_serdes_map_fabric_lane141.BCM8879X=rx141:tx141 +lane_to_serdes_map_fabric_lane142.BCM8879X=rx142:tx142 +lane_to_serdes_map_fabric_lane143.BCM8879X=rx143:tx143 + +lane_to_serdes_map_fabric_lane144.BCM8879X=rx144:tx144 +lane_to_serdes_map_fabric_lane145.BCM8879X=rx145:tx145 +lane_to_serdes_map_fabric_lane146.BCM8879X=rx146:tx146 +lane_to_serdes_map_fabric_lane147.BCM8879X=rx147:tx147 + +lane_to_serdes_map_fabric_lane148.BCM8879X=rx148:tx148 +lane_to_serdes_map_fabric_lane149.BCM8879X=rx149:tx149 +lane_to_serdes_map_fabric_lane150.BCM8879X=rx150:tx150 +lane_to_serdes_map_fabric_lane151.BCM8879X=rx151:tx151 + +lane_to_serdes_map_fabric_lane152.BCM8879X=rx152:tx152 +lane_to_serdes_map_fabric_lane153.BCM8879X=rx153:tx153 +lane_to_serdes_map_fabric_lane154.BCM8879X=rx154:tx154 +lane_to_serdes_map_fabric_lane155.BCM8879X=rx155:tx155 + +lane_to_serdes_map_fabric_lane156.BCM8879X=rx156:tx156 +lane_to_serdes_map_fabric_lane157.BCM8879X=rx157:tx157 +lane_to_serdes_map_fabric_lane158.BCM8879X=rx158:tx158 +lane_to_serdes_map_fabric_lane159.BCM8879X=rx159:tx159 + +lane_to_serdes_map_fabric_lane160.BCM8879X=rx160:tx160 +lane_to_serdes_map_fabric_lane161.BCM8879X=rx161:tx161 +lane_to_serdes_map_fabric_lane162.BCM8879X=rx162:tx162 +lane_to_serdes_map_fabric_lane163.BCM8879X=rx163:tx163 + +lane_to_serdes_map_fabric_lane164.BCM8879X=rx164:tx164 +lane_to_serdes_map_fabric_lane165.BCM8879X=rx165:tx165 +lane_to_serdes_map_fabric_lane166.BCM8879X=rx166:tx166 +lane_to_serdes_map_fabric_lane167.BCM8879X=rx167:tx167 + +lane_to_serdes_map_fabric_lane168.BCM8879X=rx168:tx168 +lane_to_serdes_map_fabric_lane169.BCM8879X=rx169:tx169 +lane_to_serdes_map_fabric_lane170.BCM8879X=rx170:tx170 +lane_to_serdes_map_fabric_lane171.BCM8879X=rx171:tx171 + +lane_to_serdes_map_fabric_lane172.BCM8879X=rx172:tx172 +lane_to_serdes_map_fabric_lane173.BCM8879X=rx173:tx173 +lane_to_serdes_map_fabric_lane174.BCM8879X=rx174:tx174 +lane_to_serdes_map_fabric_lane175.BCM8879X=rx175:tx175 + +lane_to_serdes_map_fabric_lane176.BCM8879X=rx176:tx176 +lane_to_serdes_map_fabric_lane177.BCM8879X=rx177:tx177 +lane_to_serdes_map_fabric_lane178.BCM8879X=rx178:tx178 +lane_to_serdes_map_fabric_lane179.BCM8879X=rx179:tx179 + +lane_to_serdes_map_fabric_lane180.BCM8879X=rx180:tx180 +lane_to_serdes_map_fabric_lane181.BCM8879X=rx181:tx181 +lane_to_serdes_map_fabric_lane182.BCM8879X=rx182:tx182 +lane_to_serdes_map_fabric_lane183.BCM8879X=rx183:tx183 + +lane_to_serdes_map_fabric_lane184.BCM8879X=rx184:tx184 +lane_to_serdes_map_fabric_lane185.BCM8879X=rx185:tx185 +lane_to_serdes_map_fabric_lane186.BCM8879X=rx186:tx186 +lane_to_serdes_map_fabric_lane187.BCM8879X=rx187:tx187 + +lane_to_serdes_map_fabric_lane188.BCM8879X=rx188:tx188 +lane_to_serdes_map_fabric_lane189.BCM8879X=rx189:tx189 +lane_to_serdes_map_fabric_lane190.BCM8879X=rx190:tx190 +lane_to_serdes_map_fabric_lane191.BCM8879X=rx191:tx191 + + +phy_rx_polarity_flip_fabric0.BCM8879X=1 +phy_rx_polarity_flip_fabric1.BCM8879X=0 +phy_rx_polarity_flip_fabric2.BCM8879X=1 +phy_rx_polarity_flip_fabric3.BCM8879X=0 + +phy_rx_polarity_flip_fabric4.BCM8879X=0 +phy_rx_polarity_flip_fabric5.BCM8879X=1 +phy_rx_polarity_flip_fabric6.BCM8879X=0 +phy_rx_polarity_flip_fabric7.BCM8879X=1 + +phy_rx_polarity_flip_fabric8.BCM8879X=1 +phy_rx_polarity_flip_fabric9.BCM8879X=0 +phy_rx_polarity_flip_fabric10.BCM8879X=1 +phy_rx_polarity_flip_fabric11.BCM8879X=0 + +phy_rx_polarity_flip_fabric12.BCM8879X=0 +phy_rx_polarity_flip_fabric13.BCM8879X=1 +phy_rx_polarity_flip_fabric14.BCM8879X=0 +phy_rx_polarity_flip_fabric15.BCM8879X=1 + +phy_rx_polarity_flip_fabric16.BCM8879X=1 +phy_rx_polarity_flip_fabric17.BCM8879X=0 +phy_rx_polarity_flip_fabric18.BCM8879X=1 +phy_rx_polarity_flip_fabric19.BCM8879X=0 + +phy_rx_polarity_flip_fabric20.BCM8879X=1 +phy_rx_polarity_flip_fabric21.BCM8879X=0 +phy_rx_polarity_flip_fabric22.BCM8879X=1 +phy_rx_polarity_flip_fabric23.BCM8879X=0 + +phy_rx_polarity_flip_fabric24.BCM8879X=1 +phy_rx_polarity_flip_fabric25.BCM8879X=0 +phy_rx_polarity_flip_fabric26.BCM8879X=1 +phy_rx_polarity_flip_fabric27.BCM8879X=0 + +phy_rx_polarity_flip_fabric28.BCM8879X=0 +phy_rx_polarity_flip_fabric29.BCM8879X=1 +phy_rx_polarity_flip_fabric30.BCM8879X=0 +phy_rx_polarity_flip_fabric31.BCM8879X=1 + +phy_rx_polarity_flip_fabric32.BCM8879X=1 +phy_rx_polarity_flip_fabric33.BCM8879X=0 +phy_rx_polarity_flip_fabric34.BCM8879X=1 +phy_rx_polarity_flip_fabric35.BCM8879X=0 + +phy_rx_polarity_flip_fabric36.BCM8879X=0 +phy_rx_polarity_flip_fabric37.BCM8879X=1 +phy_rx_polarity_flip_fabric38.BCM8879X=0 +phy_rx_polarity_flip_fabric39.BCM8879X=1 + +phy_rx_polarity_flip_fabric40.BCM8879X=1 +phy_rx_polarity_flip_fabric41.BCM8879X=0 +phy_rx_polarity_flip_fabric42.BCM8879X=1 +phy_rx_polarity_flip_fabric43.BCM8879X=0 + +phy_rx_polarity_flip_fabric44.BCM8879X=1 +phy_rx_polarity_flip_fabric45.BCM8879X=0 +phy_rx_polarity_flip_fabric46.BCM8879X=1 +phy_rx_polarity_flip_fabric47.BCM8879X=0 + +phy_rx_polarity_flip_fabric48.BCM8879X=0 +phy_rx_polarity_flip_fabric49.BCM8879X=1 +phy_rx_polarity_flip_fabric50.BCM8879X=0 +phy_rx_polarity_flip_fabric51.BCM8879X=1 + +phy_rx_polarity_flip_fabric52.BCM8879X=1 +phy_rx_polarity_flip_fabric53.BCM8879X=0 +phy_rx_polarity_flip_fabric54.BCM8879X=1 +phy_rx_polarity_flip_fabric55.BCM8879X=0 + +phy_rx_polarity_flip_fabric56.BCM8879X=0 +phy_rx_polarity_flip_fabric57.BCM8879X=1 +phy_rx_polarity_flip_fabric58.BCM8879X=0 +phy_rx_polarity_flip_fabric59.BCM8879X=1 + +phy_rx_polarity_flip_fabric60.BCM8879X=0 +phy_rx_polarity_flip_fabric61.BCM8879X=1 +phy_rx_polarity_flip_fabric62.BCM8879X=0 +phy_rx_polarity_flip_fabric63.BCM8879X=1 + +phy_rx_polarity_flip_fabric64.BCM8879X=1 +phy_rx_polarity_flip_fabric65.BCM8879X=0 +phy_rx_polarity_flip_fabric66.BCM8879X=1 +phy_rx_polarity_flip_fabric67.BCM8879X=0 + +phy_rx_polarity_flip_fabric68.BCM8879X=0 +phy_rx_polarity_flip_fabric69.BCM8879X=1 +phy_rx_polarity_flip_fabric70.BCM8879X=0 +phy_rx_polarity_flip_fabric71.BCM8879X=1 + +phy_rx_polarity_flip_fabric72.BCM8879X=1 +phy_rx_polarity_flip_fabric73.BCM8879X=0 +phy_rx_polarity_flip_fabric74.BCM8879X=1 +phy_rx_polarity_flip_fabric75.BCM8879X=0 + +phy_rx_polarity_flip_fabric76.BCM8879X=1 +phy_rx_polarity_flip_fabric77.BCM8879X=0 +phy_rx_polarity_flip_fabric78.BCM8879X=1 +phy_rx_polarity_flip_fabric79.BCM8879X=0 + +phy_rx_polarity_flip_fabric80.BCM8879X=0 +phy_rx_polarity_flip_fabric81.BCM8879X=1 +phy_rx_polarity_flip_fabric82.BCM8879X=0 +phy_rx_polarity_flip_fabric83.BCM8879X=1 + +phy_rx_polarity_flip_fabric84.BCM8879X=1 +phy_rx_polarity_flip_fabric85.BCM8879X=0 +phy_rx_polarity_flip_fabric86.BCM8879X=1 +phy_rx_polarity_flip_fabric87.BCM8879X=0 + +phy_rx_polarity_flip_fabric88.BCM8879X=0 +phy_rx_polarity_flip_fabric89.BCM8879X=1 +phy_rx_polarity_flip_fabric90.BCM8879X=0 +phy_rx_polarity_flip_fabric91.BCM8879X=1 + +phy_rx_polarity_flip_fabric92.BCM8879X=1 +phy_rx_polarity_flip_fabric93.BCM8879X=0 +phy_rx_polarity_flip_fabric94.BCM8879X=1 +phy_rx_polarity_flip_fabric95.BCM8879X=0 + +phy_rx_polarity_flip_fabric96.BCM8879X=1 +phy_rx_polarity_flip_fabric97.BCM8879X=0 +phy_rx_polarity_flip_fabric98.BCM8879X=1 +phy_rx_polarity_flip_fabric99.BCM8879X=0 + +phy_rx_polarity_flip_fabric100.BCM8879X=0 +phy_rx_polarity_flip_fabric101.BCM8879X=1 +phy_rx_polarity_flip_fabric102.BCM8879X=0 +phy_rx_polarity_flip_fabric103.BCM8879X=1 + +phy_rx_polarity_flip_fabric104.BCM8879X=0 +phy_rx_polarity_flip_fabric105.BCM8879X=1 +phy_rx_polarity_flip_fabric106.BCM8879X=0 +phy_rx_polarity_flip_fabric107.BCM8879X=1 + +phy_rx_polarity_flip_fabric108.BCM8879X=0 +phy_rx_polarity_flip_fabric109.BCM8879X=1 +phy_rx_polarity_flip_fabric110.BCM8879X=0 +phy_rx_polarity_flip_fabric111.BCM8879X=1 + +phy_rx_polarity_flip_fabric112.BCM8879X=0 +phy_rx_polarity_flip_fabric113.BCM8879X=1 +phy_rx_polarity_flip_fabric114.BCM8879X=0 +phy_rx_polarity_flip_fabric115.BCM8879X=1 + +phy_rx_polarity_flip_fabric116.BCM8879X=1 +phy_rx_polarity_flip_fabric117.BCM8879X=0 +phy_rx_polarity_flip_fabric118.BCM8879X=1 +phy_rx_polarity_flip_fabric119.BCM8879X=0 + +phy_rx_polarity_flip_fabric120.BCM8879X=1 +phy_rx_polarity_flip_fabric121.BCM8879X=0 +phy_rx_polarity_flip_fabric122.BCM8879X=1 +phy_rx_polarity_flip_fabric123.BCM8879X=0 + +phy_rx_polarity_flip_fabric124.BCM8879X=0 +phy_rx_polarity_flip_fabric125.BCM8879X=1 +phy_rx_polarity_flip_fabric126.BCM8879X=0 +phy_rx_polarity_flip_fabric127.BCM8879X=1 + +phy_rx_polarity_flip_fabric128.BCM8879X=1 +phy_rx_polarity_flip_fabric129.BCM8879X=0 +phy_rx_polarity_flip_fabric130.BCM8879X=1 +phy_rx_polarity_flip_fabric131.BCM8879X=0 + +phy_rx_polarity_flip_fabric132.BCM8879X=0 +phy_rx_polarity_flip_fabric133.BCM8879X=1 +phy_rx_polarity_flip_fabric134.BCM8879X=0 +phy_rx_polarity_flip_fabric135.BCM8879X=1 + +phy_rx_polarity_flip_fabric136.BCM8879X=1 +phy_rx_polarity_flip_fabric137.BCM8879X=0 +phy_rx_polarity_flip_fabric138.BCM8879X=1 +phy_rx_polarity_flip_fabric139.BCM8879X=0 + +phy_rx_polarity_flip_fabric140.BCM8879X=1 +phy_rx_polarity_flip_fabric141.BCM8879X=0 +phy_rx_polarity_flip_fabric142.BCM8879X=1 +phy_rx_polarity_flip_fabric143.BCM8879X=0 + +phy_rx_polarity_flip_fabric144.BCM8879X=1 +phy_rx_polarity_flip_fabric145.BCM8879X=0 +phy_rx_polarity_flip_fabric146.BCM8879X=1 +phy_rx_polarity_flip_fabric147.BCM8879X=0 + +phy_rx_polarity_flip_fabric148.BCM8879X=1 +phy_rx_polarity_flip_fabric149.BCM8879X=0 +phy_rx_polarity_flip_fabric150.BCM8879X=1 +phy_rx_polarity_flip_fabric151.BCM8879X=0 + +phy_rx_polarity_flip_fabric152.BCM8879X=0 +phy_rx_polarity_flip_fabric153.BCM8879X=1 +phy_rx_polarity_flip_fabric154.BCM8879X=0 +phy_rx_polarity_flip_fabric155.BCM8879X=1 + +phy_rx_polarity_flip_fabric156.BCM8879X=1 +phy_rx_polarity_flip_fabric157.BCM8879X=0 +phy_rx_polarity_flip_fabric158.BCM8879X=1 +phy_rx_polarity_flip_fabric159.BCM8879X=0 + +phy_rx_polarity_flip_fabric160.BCM8879X=1 +phy_rx_polarity_flip_fabric161.BCM8879X=0 +phy_rx_polarity_flip_fabric162.BCM8879X=1 +phy_rx_polarity_flip_fabric163.BCM8879X=0 + +phy_rx_polarity_flip_fabric164.BCM8879X=0 +phy_rx_polarity_flip_fabric165.BCM8879X=1 +phy_rx_polarity_flip_fabric166.BCM8879X=0 +phy_rx_polarity_flip_fabric167.BCM8879X=1 + +phy_rx_polarity_flip_fabric168.BCM8879X=1 +phy_rx_polarity_flip_fabric169.BCM8879X=0 +phy_rx_polarity_flip_fabric170.BCM8879X=1 +phy_rx_polarity_flip_fabric171.BCM8879X=0 + +phy_rx_polarity_flip_fabric172.BCM8879X=1 +phy_rx_polarity_flip_fabric173.BCM8879X=0 +phy_rx_polarity_flip_fabric174.BCM8879X=1 +phy_rx_polarity_flip_fabric175.BCM8879X=0 + +phy_rx_polarity_flip_fabric176.BCM8879X=0 +phy_rx_polarity_flip_fabric177.BCM8879X=1 +phy_rx_polarity_flip_fabric178.BCM8879X=0 +phy_rx_polarity_flip_fabric179.BCM8879X=1 + +phy_rx_polarity_flip_fabric180.BCM8879X=1 +phy_rx_polarity_flip_fabric181.BCM8879X=0 +phy_rx_polarity_flip_fabric182.BCM8879X=1 +phy_rx_polarity_flip_fabric183.BCM8879X=0 + +phy_rx_polarity_flip_fabric184.BCM8879X=0 +phy_rx_polarity_flip_fabric185.BCM8879X=1 +phy_rx_polarity_flip_fabric186.BCM8879X=0 +phy_rx_polarity_flip_fabric187.BCM8879X=1 + +phy_rx_polarity_flip_fabric188.BCM8879X=1 +phy_rx_polarity_flip_fabric189.BCM8879X=0 +phy_rx_polarity_flip_fabric190.BCM8879X=1 +phy_rx_polarity_flip_fabric191.BCM8879X=0 + +phy_tx_polarity_flip_fabric0.BCM8879X=0 +phy_tx_polarity_flip_fabric1.BCM8879X=1 +phy_tx_polarity_flip_fabric2.BCM8879X=0 +phy_tx_polarity_flip_fabric3.BCM8879X=1 + +phy_tx_polarity_flip_fabric4.BCM8879X=1 +phy_tx_polarity_flip_fabric5.BCM8879X=0 +phy_tx_polarity_flip_fabric6.BCM8879X=1 +phy_tx_polarity_flip_fabric7.BCM8879X=0 + +phy_tx_polarity_flip_fabric8.BCM8879X=0 +phy_tx_polarity_flip_fabric9.BCM8879X=1 +phy_tx_polarity_flip_fabric10.BCM8879X=0 +phy_tx_polarity_flip_fabric11.BCM8879X=1 + +phy_tx_polarity_flip_fabric12.BCM8879X=1 +phy_tx_polarity_flip_fabric13.BCM8879X=0 +phy_tx_polarity_flip_fabric14.BCM8879X=1 +phy_tx_polarity_flip_fabric15.BCM8879X=0 + +phy_tx_polarity_flip_fabric16.BCM8879X=0 +phy_tx_polarity_flip_fabric17.BCM8879X=1 +phy_tx_polarity_flip_fabric18.BCM8879X=0 +phy_tx_polarity_flip_fabric19.BCM8879X=1 + +phy_tx_polarity_flip_fabric20.BCM8879X=0 +phy_tx_polarity_flip_fabric21.BCM8879X=1 +phy_tx_polarity_flip_fabric22.BCM8879X=0 +phy_tx_polarity_flip_fabric23.BCM8879X=1 + +phy_tx_polarity_flip_fabric24.BCM8879X=0 +phy_tx_polarity_flip_fabric25.BCM8879X=1 +phy_tx_polarity_flip_fabric26.BCM8879X=0 +phy_tx_polarity_flip_fabric27.BCM8879X=1 + +phy_tx_polarity_flip_fabric28.BCM8879X=1 +phy_tx_polarity_flip_fabric29.BCM8879X=0 +phy_tx_polarity_flip_fabric30.BCM8879X=1 +phy_tx_polarity_flip_fabric31.BCM8879X=0 + +phy_tx_polarity_flip_fabric32.BCM8879X=0 +phy_tx_polarity_flip_fabric33.BCM8879X=1 +phy_tx_polarity_flip_fabric34.BCM8879X=0 +phy_tx_polarity_flip_fabric35.BCM8879X=1 + +phy_tx_polarity_flip_fabric36.BCM8879X=1 +phy_tx_polarity_flip_fabric37.BCM8879X=0 +phy_tx_polarity_flip_fabric38.BCM8879X=1 +phy_tx_polarity_flip_fabric39.BCM8879X=0 + +phy_tx_polarity_flip_fabric40.BCM8879X=0 +phy_tx_polarity_flip_fabric41.BCM8879X=1 +phy_tx_polarity_flip_fabric42.BCM8879X=0 +phy_tx_polarity_flip_fabric43.BCM8879X=1 + +phy_tx_polarity_flip_fabric44.BCM8879X=0 +phy_tx_polarity_flip_fabric45.BCM8879X=1 +phy_tx_polarity_flip_fabric46.BCM8879X=0 +phy_tx_polarity_flip_fabric47.BCM8879X=1 + +phy_tx_polarity_flip_fabric48.BCM8879X=1 +phy_tx_polarity_flip_fabric49.BCM8879X=0 +phy_tx_polarity_flip_fabric50.BCM8879X=1 +phy_tx_polarity_flip_fabric51.BCM8879X=0 + +phy_tx_polarity_flip_fabric52.BCM8879X=0 +phy_tx_polarity_flip_fabric53.BCM8879X=1 +phy_tx_polarity_flip_fabric54.BCM8879X=0 +phy_tx_polarity_flip_fabric55.BCM8879X=1 + +phy_tx_polarity_flip_fabric56.BCM8879X=1 +phy_tx_polarity_flip_fabric57.BCM8879X=0 +phy_tx_polarity_flip_fabric58.BCM8879X=1 +phy_tx_polarity_flip_fabric59.BCM8879X=0 + +phy_tx_polarity_flip_fabric60.BCM8879X=1 +phy_tx_polarity_flip_fabric61.BCM8879X=0 +phy_tx_polarity_flip_fabric62.BCM8879X=1 +phy_tx_polarity_flip_fabric63.BCM8879X=0 + +phy_tx_polarity_flip_fabric64.BCM8879X=0 +phy_tx_polarity_flip_fabric65.BCM8879X=1 +phy_tx_polarity_flip_fabric66.BCM8879X=0 +phy_tx_polarity_flip_fabric67.BCM8879X=1 + +phy_tx_polarity_flip_fabric68.BCM8879X=1 +phy_tx_polarity_flip_fabric69.BCM8879X=0 +phy_tx_polarity_flip_fabric70.BCM8879X=1 +phy_tx_polarity_flip_fabric71.BCM8879X=0 + +phy_tx_polarity_flip_fabric72.BCM8879X=0 +phy_tx_polarity_flip_fabric73.BCM8879X=1 +phy_tx_polarity_flip_fabric74.BCM8879X=0 +phy_tx_polarity_flip_fabric75.BCM8879X=1 + +phy_tx_polarity_flip_fabric76.BCM8879X=0 +phy_tx_polarity_flip_fabric77.BCM8879X=1 +phy_tx_polarity_flip_fabric78.BCM8879X=0 +phy_tx_polarity_flip_fabric79.BCM8879X=1 + +phy_tx_polarity_flip_fabric80.BCM8879X=1 +phy_tx_polarity_flip_fabric81.BCM8879X=0 +phy_tx_polarity_flip_fabric82.BCM8879X=1 +phy_tx_polarity_flip_fabric83.BCM8879X=0 + +phy_tx_polarity_flip_fabric84.BCM8879X=0 +phy_tx_polarity_flip_fabric85.BCM8879X=1 +phy_tx_polarity_flip_fabric86.BCM8879X=0 +phy_tx_polarity_flip_fabric87.BCM8879X=1 + +phy_tx_polarity_flip_fabric88.BCM8879X=1 +phy_tx_polarity_flip_fabric89.BCM8879X=0 +phy_tx_polarity_flip_fabric90.BCM8879X=1 +phy_tx_polarity_flip_fabric91.BCM8879X=0 + +phy_tx_polarity_flip_fabric92.BCM8879X=0 +phy_tx_polarity_flip_fabric93.BCM8879X=1 +phy_tx_polarity_flip_fabric94.BCM8879X=0 +phy_tx_polarity_flip_fabric95.BCM8879X=1 + +phy_tx_polarity_flip_fabric96.BCM8879X=0 +phy_tx_polarity_flip_fabric97.BCM8879X=1 +phy_tx_polarity_flip_fabric98.BCM8879X=0 +phy_tx_polarity_flip_fabric99.BCM8879X=1 + +phy_tx_polarity_flip_fabric100.BCM8879X=1 +phy_tx_polarity_flip_fabric101.BCM8879X=0 +phy_tx_polarity_flip_fabric102.BCM8879X=1 +phy_tx_polarity_flip_fabric103.BCM8879X=0 + +phy_tx_polarity_flip_fabric104.BCM8879X=1 +phy_tx_polarity_flip_fabric105.BCM8879X=0 +phy_tx_polarity_flip_fabric106.BCM8879X=1 +phy_tx_polarity_flip_fabric107.BCM8879X=0 + +phy_tx_polarity_flip_fabric108.BCM8879X=1 +phy_tx_polarity_flip_fabric109.BCM8879X=0 +phy_tx_polarity_flip_fabric110.BCM8879X=1 +phy_tx_polarity_flip_fabric111.BCM8879X=0 + +phy_tx_polarity_flip_fabric112.BCM8879X=1 +phy_tx_polarity_flip_fabric113.BCM8879X=0 +phy_tx_polarity_flip_fabric114.BCM8879X=1 +phy_tx_polarity_flip_fabric115.BCM8879X=0 + +phy_tx_polarity_flip_fabric116.BCM8879X=0 +phy_tx_polarity_flip_fabric117.BCM8879X=1 +phy_tx_polarity_flip_fabric118.BCM8879X=0 +phy_tx_polarity_flip_fabric119.BCM8879X=1 + +phy_tx_polarity_flip_fabric120.BCM8879X=0 +phy_tx_polarity_flip_fabric121.BCM8879X=1 +phy_tx_polarity_flip_fabric122.BCM8879X=0 +phy_tx_polarity_flip_fabric123.BCM8879X=1 + +phy_tx_polarity_flip_fabric124.BCM8879X=1 +phy_tx_polarity_flip_fabric125.BCM8879X=0 +phy_tx_polarity_flip_fabric126.BCM8879X=1 +phy_tx_polarity_flip_fabric127.BCM8879X=0 + +phy_tx_polarity_flip_fabric128.BCM8879X=0 +phy_tx_polarity_flip_fabric129.BCM8879X=1 +phy_tx_polarity_flip_fabric130.BCM8879X=0 +phy_tx_polarity_flip_fabric131.BCM8879X=1 + +phy_tx_polarity_flip_fabric132.BCM8879X=1 +phy_tx_polarity_flip_fabric133.BCM8879X=0 +phy_tx_polarity_flip_fabric134.BCM8879X=1 +phy_tx_polarity_flip_fabric135.BCM8879X=0 + +phy_tx_polarity_flip_fabric136.BCM8879X=0 +phy_tx_polarity_flip_fabric137.BCM8879X=1 +phy_tx_polarity_flip_fabric138.BCM8879X=0 +phy_tx_polarity_flip_fabric139.BCM8879X=1 + +phy_tx_polarity_flip_fabric140.BCM8879X=0 +phy_tx_polarity_flip_fabric141.BCM8879X=1 +phy_tx_polarity_flip_fabric142.BCM8879X=0 +phy_tx_polarity_flip_fabric143.BCM8879X=1 + +phy_tx_polarity_flip_fabric144.BCM8879X=0 +phy_tx_polarity_flip_fabric145.BCM8879X=1 +phy_tx_polarity_flip_fabric146.BCM8879X=0 +phy_tx_polarity_flip_fabric147.BCM8879X=1 + +phy_tx_polarity_flip_fabric148.BCM8879X=0 +phy_tx_polarity_flip_fabric149.BCM8879X=1 +phy_tx_polarity_flip_fabric150.BCM8879X=0 +phy_tx_polarity_flip_fabric151.BCM8879X=1 + +phy_tx_polarity_flip_fabric152.BCM8879X=1 +phy_tx_polarity_flip_fabric153.BCM8879X=0 +phy_tx_polarity_flip_fabric154.BCM8879X=1 +phy_tx_polarity_flip_fabric155.BCM8879X=0 + +phy_tx_polarity_flip_fabric156.BCM8879X=0 +phy_tx_polarity_flip_fabric157.BCM8879X=1 +phy_tx_polarity_flip_fabric158.BCM8879X=0 +phy_tx_polarity_flip_fabric159.BCM8879X=1 + +phy_tx_polarity_flip_fabric160.BCM8879X=0 +phy_tx_polarity_flip_fabric161.BCM8879X=1 +phy_tx_polarity_flip_fabric162.BCM8879X=0 +phy_tx_polarity_flip_fabric163.BCM8879X=1 + +phy_tx_polarity_flip_fabric164.BCM8879X=1 +phy_tx_polarity_flip_fabric165.BCM8879X=0 +phy_tx_polarity_flip_fabric166.BCM8879X=1 +phy_tx_polarity_flip_fabric167.BCM8879X=0 + +phy_tx_polarity_flip_fabric168.BCM8879X=0 +phy_tx_polarity_flip_fabric169.BCM8879X=1 +phy_tx_polarity_flip_fabric170.BCM8879X=0 +phy_tx_polarity_flip_fabric171.BCM8879X=1 + +phy_tx_polarity_flip_fabric172.BCM8879X=0 +phy_tx_polarity_flip_fabric173.BCM8879X=1 +phy_tx_polarity_flip_fabric174.BCM8879X=0 +phy_tx_polarity_flip_fabric175.BCM8879X=1 + +phy_tx_polarity_flip_fabric176.BCM8879X=1 +phy_tx_polarity_flip_fabric177.BCM8879X=0 +phy_tx_polarity_flip_fabric178.BCM8879X=1 +phy_tx_polarity_flip_fabric179.BCM8879X=0 + +phy_tx_polarity_flip_fabric180.BCM8879X=0 +phy_tx_polarity_flip_fabric181.BCM8879X=1 +phy_tx_polarity_flip_fabric182.BCM8879X=0 +phy_tx_polarity_flip_fabric183.BCM8879X=1 + +phy_tx_polarity_flip_fabric184.BCM8879X=1 +phy_tx_polarity_flip_fabric185.BCM8879X=0 +phy_tx_polarity_flip_fabric186.BCM8879X=1 +phy_tx_polarity_flip_fabric187.BCM8879X=0 + +phy_tx_polarity_flip_fabric188.BCM8879X=0 +phy_tx_polarity_flip_fabric189.BCM8879X=1 +phy_tx_polarity_flip_fabric190.BCM8879X=0 +phy_tx_polarity_flip_fabric191.BCM8879X=1 + +port_init_cl72_0=0 +port_init_cl72_1=0 +port_init_cl72_2=0 +port_init_cl72_3=0 +port_init_cl72_4=0 +port_init_cl72_5=0 +port_init_cl72_6=0 +port_init_cl72_7=0 +port_init_cl72_8=0 +port_init_cl72_9=0 +port_init_cl72_10=0 +port_init_cl72_11=0 +port_init_cl72_12=0 +port_init_cl72_13=0 +port_init_cl72_14=0 +port_init_cl72_15=0 +port_init_cl72_16=0 +port_init_cl72_17=0 +port_init_cl72_18=0 +port_init_cl72_19=0 +port_init_cl72_20=0 +port_init_cl72_21=0 +port_init_cl72_22=0 +port_init_cl72_23=0 +port_init_cl72_24=0 +port_init_cl72_25=0 +port_init_cl72_26=0 +port_init_cl72_27=0 +port_init_cl72_28=0 +port_init_cl72_29=0 +port_init_cl72_30=0 +port_init_cl72_31=0 +port_init_cl72_32=0 +port_init_cl72_33=0 +port_init_cl72_34=0 +port_init_cl72_35=0 +port_init_cl72_36=0 +port_init_cl72_37=0 +port_init_cl72_38=0 +port_init_cl72_39=0 +port_init_cl72_40=0 +port_init_cl72_41=0 +port_init_cl72_42=0 +port_init_cl72_43=0 +port_init_cl72_44=0 +port_init_cl72_45=0 +port_init_cl72_46=0 +port_init_cl72_47=0 +port_init_cl72_48=0 +port_init_cl72_49=0 +port_init_cl72_50=0 +port_init_cl72_51=0 +port_init_cl72_52=0 +port_init_cl72_53=0 +port_init_cl72_54=0 +port_init_cl72_55=0 +port_init_cl72_56=0 +port_init_cl72_57=0 +port_init_cl72_58=0 +port_init_cl72_59=0 +port_init_cl72_60=0 +port_init_cl72_61=0 +port_init_cl72_62=0 +port_init_cl72_63=0 +port_init_cl72_64=0 +port_init_cl72_65=0 +port_init_cl72_66=0 +port_init_cl72_67=0 +port_init_cl72_68=0 +port_init_cl72_69=0 +port_init_cl72_70=0 +port_init_cl72_71=0 +port_init_cl72_72=0 +port_init_cl72_73=0 +port_init_cl72_74=0 +port_init_cl72_75=0 +port_init_cl72_76=0 +port_init_cl72_77=0 +port_init_cl72_78=0 +port_init_cl72_79=0 +port_init_cl72_80=0 +port_init_cl72_81=0 +port_init_cl72_82=0 +port_init_cl72_83=0 +port_init_cl72_84=0 +port_init_cl72_85=0 +port_init_cl72_86=0 +port_init_cl72_87=0 +port_init_cl72_88=0 +port_init_cl72_89=0 +port_init_cl72_90=0 +port_init_cl72_91=0 +port_init_cl72_92=0 +port_init_cl72_93=0 +port_init_cl72_94=0 +port_init_cl72_95=0 +port_init_cl72_96=0 +port_init_cl72_97=0 +port_init_cl72_98=0 +port_init_cl72_99=0 +port_init_cl72_100=0 +port_init_cl72_101=0 +port_init_cl72_102=0 +port_init_cl72_103=0 +port_init_cl72_104=0 +port_init_cl72_105=0 +port_init_cl72_106=0 +port_init_cl72_107=0 +port_init_cl72_108=0 +port_init_cl72_109=0 +port_init_cl72_110=0 +port_init_cl72_111=0 +port_init_cl72_112=0 +port_init_cl72_113=0 +port_init_cl72_114=0 +port_init_cl72_115=0 +port_init_cl72_116=0 +port_init_cl72_117=0 +port_init_cl72_118=0 +port_init_cl72_119=0 +port_init_cl72_120=0 +port_init_cl72_121=0 +port_init_cl72_122=0 +port_init_cl72_123=0 +port_init_cl72_124=0 +port_init_cl72_125=0 +port_init_cl72_126=0 +port_init_cl72_127=0 +port_init_cl72_128=0 +port_init_cl72_129=0 +port_init_cl72_130=0 +port_init_cl72_131=0 +port_init_cl72_132=0 +port_init_cl72_133=0 +port_init_cl72_134=0 +port_init_cl72_135=0 +port_init_cl72_136=0 +port_init_cl72_137=0 +port_init_cl72_138=0 +port_init_cl72_139=0 +port_init_cl72_140=0 +port_init_cl72_141=0 +port_init_cl72_142=0 +port_init_cl72_143=0 +port_init_cl72_144=0 +port_init_cl72_145=0 +port_init_cl72_146=0 +port_init_cl72_147=0 +port_init_cl72_148=0 +port_init_cl72_149=0 +port_init_cl72_150=0 +port_init_cl72_151=0 +port_init_cl72_152=0 +port_init_cl72_153=0 +port_init_cl72_154=0 +port_init_cl72_155=0 +port_init_cl72_156=0 +port_init_cl72_157=0 +port_init_cl72_158=0 +port_init_cl72_159=0 +port_init_cl72_160=0 +port_init_cl72_161=0 +port_init_cl72_162=0 +port_init_cl72_163=0 +port_init_cl72_164=0 +port_init_cl72_165=0 +port_init_cl72_166=0 +port_init_cl72_167=0 +port_init_cl72_168=0 +port_init_cl72_169=0 +port_init_cl72_170=0 +port_init_cl72_171=0 +port_init_cl72_172=0 +port_init_cl72_173=0 +port_init_cl72_174=0 +port_init_cl72_175=0 +port_init_cl72_176=0 +port_init_cl72_177=0 +port_init_cl72_178=0 +port_init_cl72_179=0 +port_init_cl72_180=0 +port_init_cl72_181=0 +port_init_cl72_182=0 +port_init_cl72_183=0 +port_init_cl72_184=0 +port_init_cl72_185=0 +port_init_cl72_186=0 +port_init_cl72_187=0 +port_init_cl72_188=0 +port_init_cl72_189=0 +port_init_cl72_190=0 +port_init_cl72_191=0 + +serdes_tx_taps_0.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_1.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_2.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_3.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_4.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_5.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_6.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_7.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_8.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_9.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_10.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_11.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_12.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_13.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_14.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_15.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_16.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_17.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_18.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_19.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_20.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_21.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_22.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_23.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_24.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_25.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_26.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_27.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_28.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_29.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_30.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_31.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_32.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_33.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_34.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_35.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_36.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_37.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_38.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_39.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_40.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_41.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_42.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_43.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_44.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_45.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_46.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_47.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_48.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_49.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_50.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_51.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_52.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_53.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_54.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_55.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_56.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_57.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_58.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_59.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_60.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_61.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_62.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_63.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_64.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_65.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_66.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_67.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_68.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_69.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_70.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_71.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_72.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_73.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_74.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_75.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_76.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_77.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_78.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_79.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_80.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_81.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_82.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_83.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_84.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_85.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_86.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_87.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_88.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_89.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_90.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_91.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_92.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_93.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_94.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_95.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_96.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_97.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_98.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_99.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_100.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_101.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_102.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_103.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_104.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_105.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_106.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_107.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_108.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_109.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_110.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_111.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_112.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_113.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_114.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_115.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_116.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_117.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_118.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_119.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_120.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_121.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_122.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_123.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_124.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_125.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_126.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_127.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_128.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_129.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_130.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_131.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_132.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_133.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_134.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_135.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_136.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_137.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_138.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_139.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_140.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_141.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_142.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_143.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_144.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_145.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_146.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_147.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_148.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_149.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_150.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_151.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_152.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_153.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_154.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_155.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_156.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_157.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_158.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_159.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_160.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_161.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_162.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_163.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_164.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_165.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_166.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_167.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_168.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_169.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_170.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_171.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_172.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_173.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_174.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_175.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_176.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_177.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_178.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_179.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_180.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_181.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_182.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_183.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_184.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_185.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_186.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_187.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_188.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_189.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_190.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_191.BCM8879X=pam4:-24:132:-12:0:0:0 + +serdes_lane_config_channel_mode_0.0=force_nr +serdes_lane_config_channel_mode_1.0=force_nr +serdes_lane_config_channel_mode_2.0=force_nr +serdes_lane_config_channel_mode_3.0=force_nr +serdes_lane_config_channel_mode_4.0=force_nr +serdes_lane_config_channel_mode_5.0=force_nr +serdes_lane_config_channel_mode_6.0=force_nr +serdes_lane_config_channel_mode_7.0=force_nr +serdes_lane_config_channel_mode_8.0=force_nr +serdes_lane_config_channel_mode_9.0=force_nr +serdes_lane_config_channel_mode_10.0=force_nr +serdes_lane_config_channel_mode_11.0=force_nr +serdes_lane_config_channel_mode_12.0=force_nr +serdes_lane_config_channel_mode_13.0=force_nr +serdes_lane_config_channel_mode_14.0=force_nr +serdes_lane_config_channel_mode_15.0=force_nr +serdes_lane_config_channel_mode_16.0=force_nr +serdes_lane_config_channel_mode_17.0=force_nr +serdes_lane_config_channel_mode_18.0=force_nr +serdes_lane_config_channel_mode_19.0=force_nr +serdes_lane_config_channel_mode_20.0=force_nr +serdes_lane_config_channel_mode_21.0=force_nr +serdes_lane_config_channel_mode_22.0=force_nr +serdes_lane_config_channel_mode_23.0=force_nr +serdes_lane_config_channel_mode_24.0=force_nr +serdes_lane_config_channel_mode_25.0=force_nr +serdes_lane_config_channel_mode_26.0=force_nr +serdes_lane_config_channel_mode_27.0=force_nr +serdes_lane_config_channel_mode_28.0=force_nr +serdes_lane_config_channel_mode_29.0=force_nr +serdes_lane_config_channel_mode_30.0=force_nr +serdes_lane_config_channel_mode_31.0=force_nr +serdes_lane_config_channel_mode_32.0=force_nr +serdes_lane_config_channel_mode_33.0=force_nr +serdes_lane_config_channel_mode_34.0=force_nr +serdes_lane_config_channel_mode_35.0=force_nr +serdes_lane_config_channel_mode_36.0=force_nr +serdes_lane_config_channel_mode_37.0=force_nr +serdes_lane_config_channel_mode_38.0=force_nr +serdes_lane_config_channel_mode_39.0=force_nr +serdes_lane_config_channel_mode_40.0=force_nr +serdes_lane_config_channel_mode_41.0=force_nr +serdes_lane_config_channel_mode_42.0=force_nr +serdes_lane_config_channel_mode_43.0=force_nr +serdes_lane_config_channel_mode_44.0=force_nr +serdes_lane_config_channel_mode_45.0=force_nr +serdes_lane_config_channel_mode_46.0=force_nr +serdes_lane_config_channel_mode_47.0=force_nr +serdes_lane_config_channel_mode_48.0=force_nr +serdes_lane_config_channel_mode_49.0=force_nr +serdes_lane_config_channel_mode_50.0=force_nr +serdes_lane_config_channel_mode_51.0=force_nr +serdes_lane_config_channel_mode_52.0=force_nr +serdes_lane_config_channel_mode_53.0=force_nr +serdes_lane_config_channel_mode_54.0=force_nr +serdes_lane_config_channel_mode_55.0=force_nr +serdes_lane_config_channel_mode_56.0=force_nr +serdes_lane_config_channel_mode_57.0=force_nr +serdes_lane_config_channel_mode_58.0=force_nr +serdes_lane_config_channel_mode_59.0=force_nr +serdes_lane_config_channel_mode_60.0=force_nr +serdes_lane_config_channel_mode_61.0=force_nr +serdes_lane_config_channel_mode_62.0=force_nr +serdes_lane_config_channel_mode_63.0=force_nr +serdes_lane_config_channel_mode_64.0=force_nr +serdes_lane_config_channel_mode_65.0=force_nr +serdes_lane_config_channel_mode_66.0=force_nr +serdes_lane_config_channel_mode_67.0=force_nr +serdes_lane_config_channel_mode_68.0=force_nr +serdes_lane_config_channel_mode_69.0=force_nr +serdes_lane_config_channel_mode_70.0=force_nr +serdes_lane_config_channel_mode_71.0=force_nr +serdes_lane_config_channel_mode_72.0=force_nr +serdes_lane_config_channel_mode_73.0=force_nr +serdes_lane_config_channel_mode_74.0=force_nr +serdes_lane_config_channel_mode_75.0=force_nr +serdes_lane_config_channel_mode_76.0=force_nr +serdes_lane_config_channel_mode_77.0=force_nr +serdes_lane_config_channel_mode_78.0=force_nr +serdes_lane_config_channel_mode_79.0=force_nr +serdes_lane_config_channel_mode_80.0=force_nr +serdes_lane_config_channel_mode_81.0=force_nr +serdes_lane_config_channel_mode_82.0=force_nr +serdes_lane_config_channel_mode_83.0=force_nr +serdes_lane_config_channel_mode_84.0=force_nr +serdes_lane_config_channel_mode_85.0=force_nr +serdes_lane_config_channel_mode_86.0=force_nr +serdes_lane_config_channel_mode_87.0=force_nr +serdes_lane_config_channel_mode_88.0=force_nr +serdes_lane_config_channel_mode_89.0=force_nr +serdes_lane_config_channel_mode_90.0=force_nr +serdes_lane_config_channel_mode_91.0=force_nr +serdes_lane_config_channel_mode_92.0=force_nr +serdes_lane_config_channel_mode_93.0=force_nr +serdes_lane_config_channel_mode_94.0=force_nr +serdes_lane_config_channel_mode_95.0=force_nr +serdes_lane_config_channel_mode_96.0=force_nr +serdes_lane_config_channel_mode_97.0=force_nr +serdes_lane_config_channel_mode_98.0=force_nr +serdes_lane_config_channel_mode_99.0=force_nr +serdes_lane_config_channel_mode_100.0=force_nr +serdes_lane_config_channel_mode_101.0=force_nr +serdes_lane_config_channel_mode_102.0=force_nr +serdes_lane_config_channel_mode_103.0=force_nr +serdes_lane_config_channel_mode_104.0=force_nr +serdes_lane_config_channel_mode_105.0=force_nr +serdes_lane_config_channel_mode_106.0=force_nr +serdes_lane_config_channel_mode_107.0=force_nr +serdes_lane_config_channel_mode_108.0=force_nr +serdes_lane_config_channel_mode_109.0=force_nr +serdes_lane_config_channel_mode_110.0=force_nr +serdes_lane_config_channel_mode_111.0=force_nr +serdes_lane_config_channel_mode_112.0=force_nr +serdes_lane_config_channel_mode_113.0=force_nr +serdes_lane_config_channel_mode_114.0=force_nr +serdes_lane_config_channel_mode_115.0=force_nr +serdes_lane_config_channel_mode_116.0=force_nr +serdes_lane_config_channel_mode_117.0=force_nr +serdes_lane_config_channel_mode_118.0=force_nr +serdes_lane_config_channel_mode_119.0=force_nr +serdes_lane_config_channel_mode_120.0=force_nr +serdes_lane_config_channel_mode_121.0=force_nr +serdes_lane_config_channel_mode_122.0=force_nr +serdes_lane_config_channel_mode_123.0=force_nr +serdes_lane_config_channel_mode_124.0=force_nr +serdes_lane_config_channel_mode_125.0=force_nr +serdes_lane_config_channel_mode_126.0=force_nr +serdes_lane_config_channel_mode_127.0=force_nr +serdes_lane_config_channel_mode_128.0=force_nr +serdes_lane_config_channel_mode_129.0=force_nr +serdes_lane_config_channel_mode_130.0=force_nr +serdes_lane_config_channel_mode_131.0=force_nr +serdes_lane_config_channel_mode_132.0=force_nr +serdes_lane_config_channel_mode_133.0=force_nr +serdes_lane_config_channel_mode_134.0=force_nr +serdes_lane_config_channel_mode_135.0=force_nr +serdes_lane_config_channel_mode_136.0=force_nr +serdes_lane_config_channel_mode_137.0=force_nr +serdes_lane_config_channel_mode_138.0=force_nr +serdes_lane_config_channel_mode_139.0=force_nr +serdes_lane_config_channel_mode_140.0=force_nr +serdes_lane_config_channel_mode_141.0=force_nr +serdes_lane_config_channel_mode_142.0=force_nr +serdes_lane_config_channel_mode_143.0=force_nr +serdes_lane_config_channel_mode_144.0=force_nr +serdes_lane_config_channel_mode_145.0=force_nr +serdes_lane_config_channel_mode_146.0=force_nr +serdes_lane_config_channel_mode_147.0=force_nr +serdes_lane_config_channel_mode_148.0=force_nr +serdes_lane_config_channel_mode_149.0=force_nr +serdes_lane_config_channel_mode_150.0=force_nr +serdes_lane_config_channel_mode_151.0=force_nr +serdes_lane_config_channel_mode_152.0=force_nr +serdes_lane_config_channel_mode_153.0=force_nr +serdes_lane_config_channel_mode_154.0=force_nr +serdes_lane_config_channel_mode_155.0=force_nr +serdes_lane_config_channel_mode_156.0=force_nr +serdes_lane_config_channel_mode_157.0=force_nr +serdes_lane_config_channel_mode_158.0=force_nr +serdes_lane_config_channel_mode_159.0=force_nr +serdes_lane_config_channel_mode_160.0=force_nr +serdes_lane_config_channel_mode_161.0=force_nr +serdes_lane_config_channel_mode_162.0=force_nr +serdes_lane_config_channel_mode_163.0=force_nr +serdes_lane_config_channel_mode_164.0=force_nr +serdes_lane_config_channel_mode_165.0=force_nr +serdes_lane_config_channel_mode_166.0=force_nr +serdes_lane_config_channel_mode_167.0=force_nr +serdes_lane_config_channel_mode_168.0=force_nr +serdes_lane_config_channel_mode_169.0=force_nr +serdes_lane_config_channel_mode_170.0=force_nr +serdes_lane_config_channel_mode_171.0=force_nr +serdes_lane_config_channel_mode_172.0=force_nr +serdes_lane_config_channel_mode_173.0=force_nr +serdes_lane_config_channel_mode_174.0=force_nr +serdes_lane_config_channel_mode_175.0=force_nr +serdes_lane_config_channel_mode_176.0=force_nr +serdes_lane_config_channel_mode_177.0=force_nr +serdes_lane_config_channel_mode_178.0=force_nr +serdes_lane_config_channel_mode_179.0=force_nr +serdes_lane_config_channel_mode_180.0=force_nr +serdes_lane_config_channel_mode_181.0=force_nr +serdes_lane_config_channel_mode_182.0=force_nr +serdes_lane_config_channel_mode_183.0=force_nr +serdes_lane_config_channel_mode_184.0=force_nr +serdes_lane_config_channel_mode_185.0=force_nr +serdes_lane_config_channel_mode_186.0=force_nr +serdes_lane_config_channel_mode_187.0=force_nr +serdes_lane_config_channel_mode_188.0=force_nr +serdes_lane_config_channel_mode_189.0=force_nr +serdes_lane_config_channel_mode_190.0=force_nr +serdes_lane_config_channel_mode_191.0=force_nr + + +serdes_qrtt_active_0.0=1 +serdes_qrtt_active_1.0=1 +serdes_qrtt_active_2.0=1 +serdes_qrtt_active_3.0=1 +serdes_qrtt_active_4.0=1 +serdes_qrtt_active_5.0=1 +serdes_qrtt_active_6.0=1 +serdes_qrtt_active_7.0=1 +serdes_qrtt_active_8.0=1 +serdes_qrtt_active_9.0=1 +serdes_qrtt_active_10.0=1 +serdes_qrtt_active_11.0=1 +serdes_qrtt_active_12.0=1 +serdes_qrtt_active_13.0=1 +serdes_qrtt_active_14.0=1 +serdes_qrtt_active_15.0=1 +serdes_qrtt_active_16.0=1 +serdes_qrtt_active_17.0=1 +serdes_qrtt_active_18.0=1 +serdes_qrtt_active_19.0=1 +serdes_qrtt_active_20.0=1 +serdes_qrtt_active_21.0=1 +serdes_qrtt_active_22.0=1 +serdes_qrtt_active_23.0=1 +serdes_qrtt_active_24.0=1 +serdes_qrtt_active_25.0=1 +serdes_qrtt_active_26.0=1 +serdes_qrtt_active_27.0=1 +serdes_qrtt_active_28.0=1 +serdes_qrtt_active_29.0=1 +serdes_qrtt_active_30.0=1 +serdes_qrtt_active_31.0=1 +serdes_qrtt_active_32.0=1 +serdes_qrtt_active_33.0=1 +serdes_qrtt_active_34.0=1 +serdes_qrtt_active_35.0=1 +serdes_qrtt_active_36.0=1 +serdes_qrtt_active_37.0=1 +serdes_qrtt_active_38.0=1 +serdes_qrtt_active_39.0=1 +serdes_qrtt_active_40.0=1 +serdes_qrtt_active_41.0=1 +serdes_qrtt_active_42.0=1 +serdes_qrtt_active_43.0=1 +serdes_qrtt_active_44.0=1 +serdes_qrtt_active_45.0=1 +serdes_qrtt_active_46.0=1 +serdes_qrtt_active_47.0=1 diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/3/config-ramon-2-1.bcm b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/3/config-ramon-2-1.bcm new file mode 100644 index 000000000000..a13d25a0264f --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/3/config-ramon-2-1.bcm @@ -0,0 +1,1395 @@ + +appl_enable_intr_init.BCM8879X=0 +appl_param_module_id.BCM8879X=4 +bcm_linkscan_interval.BCM8879X=0 +bcm_stat_interval.BCM8879X=4000000 +bist_enable.BCM8879X=0 +core_clock_speed_khz.BCM8879X=1000000 +custom_feature_access_only.BCM8879X=0 +custom_feature_lane_swap_disable.BCM8879X=0 +dport_map_direct.BCM8879X=1 +fabric_cell_fifo_dma_enable.BCM8879X=0 +fabric_device_mode.BCM8879X=SINGLE_STAGE_FE2 +fabric_load_balancing_mode.BCM8879X=NORMAL_LOAD_BALANCE +fabric_multicast_mode.BCM8879X=DIRECT +fabric_num_pipes.BCM8879X=1 +fabric_pipe_map.BCM8879X=0 +fe_mc_id_range.BCM8879X=128K +load_firmware.BCM8879X=0x102 +mdio_output_delay_ext.BCM8879X=14 +mdio_output_delay_int.BCM8879X=25 +mem_cache_enable_parity.BCM8879X=1 +mm_intr_enable.BCM8879X=0 +mm_timeout_usec.BCM8879X=300000 +polled_irq_delay.BCM8879X=100000 +polled_irq_mode.BCM8879X=1 +port_fec.BCM8879X=7 +port_init_cl72.BCM8879X=0 +port_init_speed.BCM8879X=53125 +rate_ext_mdio_divisor.BCM8879X=14 +rate_int_mdio_divisor.BCM8879X=50 +schan_intr_enable.BCM8879X=0 +schan_timeout_usec.BCM8879X=300000 +serdes_fabric_clk_freq_in.BCM8879X=1 +serdes_fabric_clk_freq_out.BCM8879X=bypass +soc_family.BCM8879X=BCM8879X +srd_tx_drv_hv_disable.BCM8879X=0 +system_contains_multiple_pipe_device.BCM8879X=0 +system_ref_core_clock_khz.BCM8879X=1200000 +table_dma_enable.BCM8879X=0 +tdma_intr_enable.BCM8879X=0 +tdma_timeout_usec.BCM8879X=5000000 +tslam_dma_enable.BCM8879X=0 +tslam_intr_enable.BCM8879X=0 +tslam_timeout_usec.BCM8879X=5000000 + +lane_to_serdes_map_fabric_lane0.BCM8879X=rx0:tx0 +lane_to_serdes_map_fabric_lane1.BCM8879X=rx1:tx1 +lane_to_serdes_map_fabric_lane2.BCM8879X=rx2:tx2 +lane_to_serdes_map_fabric_lane3.BCM8879X=rx3:tx3 + +lane_to_serdes_map_fabric_lane4.BCM8879X=rx4:tx4 +lane_to_serdes_map_fabric_lane5.BCM8879X=rx5:tx5 +lane_to_serdes_map_fabric_lane6.BCM8879X=rx6:tx6 +lane_to_serdes_map_fabric_lane7.BCM8879X=rx7:tx7 + +lane_to_serdes_map_fabric_lane8.BCM8879X=rx8:tx8 +lane_to_serdes_map_fabric_lane9.BCM8879X=rx9:tx9 +lane_to_serdes_map_fabric_lane10.BCM8879X=rx10:tx10 +lane_to_serdes_map_fabric_lane11.BCM8879X=rx11:tx11 + +lane_to_serdes_map_fabric_lane12.BCM8879X=rx12:tx12 +lane_to_serdes_map_fabric_lane13.BCM8879X=rx13:tx13 +lane_to_serdes_map_fabric_lane14.BCM8879X=rx14:tx14 +lane_to_serdes_map_fabric_lane15.BCM8879X=rx15:tx15 + +lane_to_serdes_map_fabric_lane16.BCM8879X=rx16:tx16 +lane_to_serdes_map_fabric_lane17.BCM8879X=rx17:tx17 +lane_to_serdes_map_fabric_lane18.BCM8879X=rx18:tx18 +lane_to_serdes_map_fabric_lane19.BCM8879X=rx19:tx19 + +lane_to_serdes_map_fabric_lane20.BCM8879X=rx20:tx20 +lane_to_serdes_map_fabric_lane21.BCM8879X=rx21:tx21 +lane_to_serdes_map_fabric_lane22.BCM8879X=rx22:tx22 +lane_to_serdes_map_fabric_lane23.BCM8879X=rx23:tx23 + +lane_to_serdes_map_fabric_lane24.BCM8879X=rx24:tx24 +lane_to_serdes_map_fabric_lane25.BCM8879X=rx25:tx25 +lane_to_serdes_map_fabric_lane26.BCM8879X=rx26:tx26 +lane_to_serdes_map_fabric_lane27.BCM8879X=rx27:tx27 + +lane_to_serdes_map_fabric_lane28.BCM8879X=rx28:tx28 +lane_to_serdes_map_fabric_lane29.BCM8879X=rx29:tx29 +lane_to_serdes_map_fabric_lane30.BCM8879X=rx30:tx30 +lane_to_serdes_map_fabric_lane31.BCM8879X=rx31:tx31 + +lane_to_serdes_map_fabric_lane32.BCM8879X=rx32:tx32 +lane_to_serdes_map_fabric_lane33.BCM8879X=rx33:tx33 +lane_to_serdes_map_fabric_lane34.BCM8879X=rx34:tx34 +lane_to_serdes_map_fabric_lane35.BCM8879X=rx35:tx35 + +lane_to_serdes_map_fabric_lane36.BCM8879X=rx36:tx36 +lane_to_serdes_map_fabric_lane37.BCM8879X=rx37:tx37 +lane_to_serdes_map_fabric_lane38.BCM8879X=rx38:tx38 +lane_to_serdes_map_fabric_lane39.BCM8879X=rx39:tx39 + +lane_to_serdes_map_fabric_lane40.BCM8879X=rx40:tx40 +lane_to_serdes_map_fabric_lane41.BCM8879X=rx41:tx41 +lane_to_serdes_map_fabric_lane42.BCM8879X=rx42:tx42 +lane_to_serdes_map_fabric_lane43.BCM8879X=rx43:tx43 + +lane_to_serdes_map_fabric_lane44.BCM8879X=rx44:tx44 +lane_to_serdes_map_fabric_lane45.BCM8879X=rx45:tx45 +lane_to_serdes_map_fabric_lane46.BCM8879X=rx46:tx46 +lane_to_serdes_map_fabric_lane47.BCM8879X=rx47:tx47 + +lane_to_serdes_map_fabric_lane48.BCM8879X=rx48:tx48 +lane_to_serdes_map_fabric_lane49.BCM8879X=rx49:tx49 +lane_to_serdes_map_fabric_lane50.BCM8879X=rx50:tx50 +lane_to_serdes_map_fabric_lane51.BCM8879X=rx51:tx51 + +lane_to_serdes_map_fabric_lane52.BCM8879X=rx52:tx52 +lane_to_serdes_map_fabric_lane53.BCM8879X=rx53:tx53 +lane_to_serdes_map_fabric_lane54.BCM8879X=rx54:tx54 +lane_to_serdes_map_fabric_lane55.BCM8879X=rx55:tx55 + +lane_to_serdes_map_fabric_lane56.BCM8879X=rx56:tx56 +lane_to_serdes_map_fabric_lane57.BCM8879X=rx57:tx57 +lane_to_serdes_map_fabric_lane58.BCM8879X=rx58:tx58 +lane_to_serdes_map_fabric_lane59.BCM8879X=rx59:tx59 + +lane_to_serdes_map_fabric_lane60.BCM8879X=rx60:tx60 +lane_to_serdes_map_fabric_lane61.BCM8879X=rx61:tx61 +lane_to_serdes_map_fabric_lane62.BCM8879X=rx62:tx62 +lane_to_serdes_map_fabric_lane63.BCM8879X=rx63:tx63 + +lane_to_serdes_map_fabric_lane64.BCM8879X=rx64:tx64 +lane_to_serdes_map_fabric_lane65.BCM8879X=rx65:tx65 +lane_to_serdes_map_fabric_lane66.BCM8879X=rx66:tx66 +lane_to_serdes_map_fabric_lane67.BCM8879X=rx67:tx67 + +lane_to_serdes_map_fabric_lane68.BCM8879X=rx68:tx68 +lane_to_serdes_map_fabric_lane69.BCM8879X=rx69:tx69 +lane_to_serdes_map_fabric_lane70.BCM8879X=rx70:tx70 +lane_to_serdes_map_fabric_lane71.BCM8879X=rx71:tx71 + +lane_to_serdes_map_fabric_lane72.BCM8879X=rx72:tx72 +lane_to_serdes_map_fabric_lane73.BCM8879X=rx73:tx73 +lane_to_serdes_map_fabric_lane74.BCM8879X=rx74:tx74 +lane_to_serdes_map_fabric_lane75.BCM8879X=rx75:tx75 + +lane_to_serdes_map_fabric_lane76.BCM8879X=rx76:tx76 +lane_to_serdes_map_fabric_lane77.BCM8879X=rx77:tx77 +lane_to_serdes_map_fabric_lane78.BCM8879X=rx78:tx78 +lane_to_serdes_map_fabric_lane79.BCM8879X=rx79:tx79 + +lane_to_serdes_map_fabric_lane80.BCM8879X=rx80:tx80 +lane_to_serdes_map_fabric_lane81.BCM8879X=rx81:tx81 +lane_to_serdes_map_fabric_lane82.BCM8879X=rx82:tx82 +lane_to_serdes_map_fabric_lane83.BCM8879X=rx83:tx83 + +lane_to_serdes_map_fabric_lane84.BCM8879X=rx84:tx84 +lane_to_serdes_map_fabric_lane85.BCM8879X=rx85:tx85 +lane_to_serdes_map_fabric_lane86.BCM8879X=rx86:tx86 +lane_to_serdes_map_fabric_lane87.BCM8879X=rx87:tx87 + +lane_to_serdes_map_fabric_lane88.BCM8879X=rx88:tx88 +lane_to_serdes_map_fabric_lane89.BCM8879X=rx89:tx89 +lane_to_serdes_map_fabric_lane90.BCM8879X=rx90:tx90 +lane_to_serdes_map_fabric_lane91.BCM8879X=rx91:tx91 + +lane_to_serdes_map_fabric_lane92.BCM8879X=rx92:tx92 +lane_to_serdes_map_fabric_lane93.BCM8879X=rx93:tx93 +lane_to_serdes_map_fabric_lane94.BCM8879X=rx94:tx94 +lane_to_serdes_map_fabric_lane95.BCM8879X=rx95:tx95 + +lane_to_serdes_map_fabric_lane96.BCM8879X=rx96:tx96 +lane_to_serdes_map_fabric_lane97.BCM8879X=rx97:tx97 +lane_to_serdes_map_fabric_lane98.BCM8879X=rx98:tx98 +lane_to_serdes_map_fabric_lane99.BCM8879X=rx99:tx99 + +lane_to_serdes_map_fabric_lane100.BCM8879X=rx100:tx100 +lane_to_serdes_map_fabric_lane101.BCM8879X=rx101:tx101 +lane_to_serdes_map_fabric_lane102.BCM8879X=rx102:tx102 +lane_to_serdes_map_fabric_lane103.BCM8879X=rx103:tx103 + +lane_to_serdes_map_fabric_lane104.BCM8879X=rx104:tx104 +lane_to_serdes_map_fabric_lane105.BCM8879X=rx105:tx105 +lane_to_serdes_map_fabric_lane106.BCM8879X=rx106:tx106 +lane_to_serdes_map_fabric_lane107.BCM8879X=rx107:tx107 + +lane_to_serdes_map_fabric_lane108.BCM8879X=rx108:tx108 +lane_to_serdes_map_fabric_lane109.BCM8879X=rx109:tx109 +lane_to_serdes_map_fabric_lane110.BCM8879X=rx110:tx110 +lane_to_serdes_map_fabric_lane111.BCM8879X=rx111:tx111 + +lane_to_serdes_map_fabric_lane112.BCM8879X=rx112:tx112 +lane_to_serdes_map_fabric_lane113.BCM8879X=rx113:tx113 +lane_to_serdes_map_fabric_lane114.BCM8879X=rx114:tx114 +lane_to_serdes_map_fabric_lane115.BCM8879X=rx115:tx115 + +lane_to_serdes_map_fabric_lane116.BCM8879X=rx116:tx116 +lane_to_serdes_map_fabric_lane117.BCM8879X=rx117:tx117 +lane_to_serdes_map_fabric_lane118.BCM8879X=rx118:tx118 +lane_to_serdes_map_fabric_lane119.BCM8879X=rx119:tx119 + +lane_to_serdes_map_fabric_lane120.BCM8879X=rx120:tx120 +lane_to_serdes_map_fabric_lane121.BCM8879X=rx121:tx121 +lane_to_serdes_map_fabric_lane122.BCM8879X=rx122:tx122 +lane_to_serdes_map_fabric_lane123.BCM8879X=rx123:tx123 + +lane_to_serdes_map_fabric_lane124.BCM8879X=rx124:tx124 +lane_to_serdes_map_fabric_lane125.BCM8879X=rx125:tx125 +lane_to_serdes_map_fabric_lane126.BCM8879X=rx126:tx126 +lane_to_serdes_map_fabric_lane127.BCM8879X=rx127:tx127 + +lane_to_serdes_map_fabric_lane128.BCM8879X=rx128:tx128 +lane_to_serdes_map_fabric_lane129.BCM8879X=rx129:tx129 +lane_to_serdes_map_fabric_lane130.BCM8879X=rx130:tx130 +lane_to_serdes_map_fabric_lane131.BCM8879X=rx131:tx131 + +lane_to_serdes_map_fabric_lane132.BCM8879X=rx132:tx132 +lane_to_serdes_map_fabric_lane133.BCM8879X=rx133:tx133 +lane_to_serdes_map_fabric_lane134.BCM8879X=rx134:tx134 +lane_to_serdes_map_fabric_lane135.BCM8879X=rx135:tx135 + +lane_to_serdes_map_fabric_lane136.BCM8879X=rx136:tx136 +lane_to_serdes_map_fabric_lane137.BCM8879X=rx137:tx137 +lane_to_serdes_map_fabric_lane138.BCM8879X=rx138:tx138 +lane_to_serdes_map_fabric_lane139.BCM8879X=rx139:tx139 + +lane_to_serdes_map_fabric_lane140.BCM8879X=rx140:tx140 +lane_to_serdes_map_fabric_lane141.BCM8879X=rx141:tx141 +lane_to_serdes_map_fabric_lane142.BCM8879X=rx142:tx142 +lane_to_serdes_map_fabric_lane143.BCM8879X=rx143:tx143 + +lane_to_serdes_map_fabric_lane144.BCM8879X=rx144:tx144 +lane_to_serdes_map_fabric_lane145.BCM8879X=rx145:tx145 +lane_to_serdes_map_fabric_lane146.BCM8879X=rx146:tx146 +lane_to_serdes_map_fabric_lane147.BCM8879X=rx147:tx147 + +lane_to_serdes_map_fabric_lane148.BCM8879X=rx148:tx148 +lane_to_serdes_map_fabric_lane149.BCM8879X=rx149:tx149 +lane_to_serdes_map_fabric_lane150.BCM8879X=rx150:tx150 +lane_to_serdes_map_fabric_lane151.BCM8879X=rx151:tx151 + +lane_to_serdes_map_fabric_lane152.BCM8879X=rx152:tx152 +lane_to_serdes_map_fabric_lane153.BCM8879X=rx153:tx153 +lane_to_serdes_map_fabric_lane154.BCM8879X=rx154:tx154 +lane_to_serdes_map_fabric_lane155.BCM8879X=rx155:tx155 + +lane_to_serdes_map_fabric_lane156.BCM8879X=rx156:tx156 +lane_to_serdes_map_fabric_lane157.BCM8879X=rx157:tx157 +lane_to_serdes_map_fabric_lane158.BCM8879X=rx158:tx158 +lane_to_serdes_map_fabric_lane159.BCM8879X=rx159:tx159 + +lane_to_serdes_map_fabric_lane160.BCM8879X=rx160:tx160 +lane_to_serdes_map_fabric_lane161.BCM8879X=rx161:tx161 +lane_to_serdes_map_fabric_lane162.BCM8879X=rx162:tx162 +lane_to_serdes_map_fabric_lane163.BCM8879X=rx163:tx163 + +lane_to_serdes_map_fabric_lane164.BCM8879X=rx164:tx164 +lane_to_serdes_map_fabric_lane165.BCM8879X=rx165:tx165 +lane_to_serdes_map_fabric_lane166.BCM8879X=rx166:tx166 +lane_to_serdes_map_fabric_lane167.BCM8879X=rx167:tx167 + +lane_to_serdes_map_fabric_lane168.BCM8879X=rx168:tx168 +lane_to_serdes_map_fabric_lane169.BCM8879X=rx169:tx169 +lane_to_serdes_map_fabric_lane170.BCM8879X=rx170:tx170 +lane_to_serdes_map_fabric_lane171.BCM8879X=rx171:tx171 + +lane_to_serdes_map_fabric_lane172.BCM8879X=rx172:tx172 +lane_to_serdes_map_fabric_lane173.BCM8879X=rx173:tx173 +lane_to_serdes_map_fabric_lane174.BCM8879X=rx174:tx174 +lane_to_serdes_map_fabric_lane175.BCM8879X=rx175:tx175 + +lane_to_serdes_map_fabric_lane176.BCM8879X=rx176:tx176 +lane_to_serdes_map_fabric_lane177.BCM8879X=rx177:tx177 +lane_to_serdes_map_fabric_lane178.BCM8879X=rx178:tx178 +lane_to_serdes_map_fabric_lane179.BCM8879X=rx179:tx179 + +lane_to_serdes_map_fabric_lane180.BCM8879X=rx180:tx180 +lane_to_serdes_map_fabric_lane181.BCM8879X=rx181:tx181 +lane_to_serdes_map_fabric_lane182.BCM8879X=rx182:tx182 +lane_to_serdes_map_fabric_lane183.BCM8879X=rx183:tx183 + +lane_to_serdes_map_fabric_lane184.BCM8879X=rx184:tx184 +lane_to_serdes_map_fabric_lane185.BCM8879X=rx185:tx185 +lane_to_serdes_map_fabric_lane186.BCM8879X=rx186:tx186 +lane_to_serdes_map_fabric_lane187.BCM8879X=rx187:tx187 + +lane_to_serdes_map_fabric_lane188.BCM8879X=rx188:tx188 +lane_to_serdes_map_fabric_lane189.BCM8879X=rx189:tx189 +lane_to_serdes_map_fabric_lane190.BCM8879X=rx190:tx190 +lane_to_serdes_map_fabric_lane191.BCM8879X=rx191:tx191 + + +phy_rx_polarity_flip_fabric0.BCM8879X=1 +phy_rx_polarity_flip_fabric1.BCM8879X=0 +phy_rx_polarity_flip_fabric2.BCM8879X=1 +phy_rx_polarity_flip_fabric3.BCM8879X=0 + +phy_rx_polarity_flip_fabric4.BCM8879X=1 +phy_rx_polarity_flip_fabric5.BCM8879X=0 +phy_rx_polarity_flip_fabric6.BCM8879X=1 +phy_rx_polarity_flip_fabric7.BCM8879X=0 + +phy_rx_polarity_flip_fabric8.BCM8879X=0 +phy_rx_polarity_flip_fabric9.BCM8879X=1 +phy_rx_polarity_flip_fabric10.BCM8879X=0 +phy_rx_polarity_flip_fabric11.BCM8879X=1 + +phy_rx_polarity_flip_fabric12.BCM8879X=1 +phy_rx_polarity_flip_fabric13.BCM8879X=0 +phy_rx_polarity_flip_fabric14.BCM8879X=1 +phy_rx_polarity_flip_fabric15.BCM8879X=0 + +phy_rx_polarity_flip_fabric16.BCM8879X=1 +phy_rx_polarity_flip_fabric17.BCM8879X=0 +phy_rx_polarity_flip_fabric18.BCM8879X=1 +phy_rx_polarity_flip_fabric19.BCM8879X=0 + +phy_rx_polarity_flip_fabric20.BCM8879X=0 +phy_rx_polarity_flip_fabric21.BCM8879X=1 +phy_rx_polarity_flip_fabric22.BCM8879X=0 +phy_rx_polarity_flip_fabric23.BCM8879X=1 + +phy_rx_polarity_flip_fabric24.BCM8879X=1 +phy_rx_polarity_flip_fabric25.BCM8879X=0 +phy_rx_polarity_flip_fabric26.BCM8879X=1 +phy_rx_polarity_flip_fabric27.BCM8879X=0 + +phy_rx_polarity_flip_fabric28.BCM8879X=1 +phy_rx_polarity_flip_fabric29.BCM8879X=0 +phy_rx_polarity_flip_fabric30.BCM8879X=1 +phy_rx_polarity_flip_fabric31.BCM8879X=0 + +phy_rx_polarity_flip_fabric32.BCM8879X=0 +phy_rx_polarity_flip_fabric33.BCM8879X=1 +phy_rx_polarity_flip_fabric34.BCM8879X=0 +phy_rx_polarity_flip_fabric35.BCM8879X=1 + +phy_rx_polarity_flip_fabric36.BCM8879X=1 +phy_rx_polarity_flip_fabric37.BCM8879X=0 +phy_rx_polarity_flip_fabric38.BCM8879X=1 +phy_rx_polarity_flip_fabric39.BCM8879X=0 + +phy_rx_polarity_flip_fabric40.BCM8879X=0 +phy_rx_polarity_flip_fabric41.BCM8879X=1 +phy_rx_polarity_flip_fabric42.BCM8879X=0 +phy_rx_polarity_flip_fabric43.BCM8879X=1 + +phy_rx_polarity_flip_fabric44.BCM8879X=1 +phy_rx_polarity_flip_fabric45.BCM8879X=0 +phy_rx_polarity_flip_fabric46.BCM8879X=1 +phy_rx_polarity_flip_fabric47.BCM8879X=0 + +phy_rx_polarity_flip_fabric48.BCM8879X=1 +phy_rx_polarity_flip_fabric49.BCM8879X=0 +phy_rx_polarity_flip_fabric50.BCM8879X=1 +phy_rx_polarity_flip_fabric51.BCM8879X=0 + +phy_rx_polarity_flip_fabric52.BCM8879X=0 +phy_rx_polarity_flip_fabric53.BCM8879X=1 +phy_rx_polarity_flip_fabric54.BCM8879X=0 +phy_rx_polarity_flip_fabric55.BCM8879X=1 + +phy_rx_polarity_flip_fabric56.BCM8879X=0 +phy_rx_polarity_flip_fabric57.BCM8879X=1 +phy_rx_polarity_flip_fabric58.BCM8879X=0 +phy_rx_polarity_flip_fabric59.BCM8879X=1 + +phy_rx_polarity_flip_fabric60.BCM8879X=0 +phy_rx_polarity_flip_fabric61.BCM8879X=1 +phy_rx_polarity_flip_fabric62.BCM8879X=0 +phy_rx_polarity_flip_fabric63.BCM8879X=1 + +phy_rx_polarity_flip_fabric64.BCM8879X=0 +phy_rx_polarity_flip_fabric65.BCM8879X=1 +phy_rx_polarity_flip_fabric66.BCM8879X=0 +phy_rx_polarity_flip_fabric67.BCM8879X=1 + +phy_rx_polarity_flip_fabric68.BCM8879X=1 +phy_rx_polarity_flip_fabric69.BCM8879X=0 +phy_rx_polarity_flip_fabric70.BCM8879X=1 +phy_rx_polarity_flip_fabric71.BCM8879X=0 + +phy_rx_polarity_flip_fabric72.BCM8879X=1 +phy_rx_polarity_flip_fabric73.BCM8879X=0 +phy_rx_polarity_flip_fabric74.BCM8879X=1 +phy_rx_polarity_flip_fabric75.BCM8879X=0 + +phy_rx_polarity_flip_fabric76.BCM8879X=0 +phy_rx_polarity_flip_fabric77.BCM8879X=1 +phy_rx_polarity_flip_fabric78.BCM8879X=0 +phy_rx_polarity_flip_fabric79.BCM8879X=1 + +phy_rx_polarity_flip_fabric80.BCM8879X=1 +phy_rx_polarity_flip_fabric81.BCM8879X=0 +phy_rx_polarity_flip_fabric82.BCM8879X=1 +phy_rx_polarity_flip_fabric83.BCM8879X=0 + +phy_rx_polarity_flip_fabric84.BCM8879X=0 +phy_rx_polarity_flip_fabric85.BCM8879X=1 +phy_rx_polarity_flip_fabric86.BCM8879X=0 +phy_rx_polarity_flip_fabric87.BCM8879X=1 + +phy_rx_polarity_flip_fabric88.BCM8879X=1 +phy_rx_polarity_flip_fabric89.BCM8879X=0 +phy_rx_polarity_flip_fabric90.BCM8879X=1 +phy_rx_polarity_flip_fabric91.BCM8879X=0 + +phy_rx_polarity_flip_fabric92.BCM8879X=1 +phy_rx_polarity_flip_fabric93.BCM8879X=0 +phy_rx_polarity_flip_fabric94.BCM8879X=1 +phy_rx_polarity_flip_fabric95.BCM8879X=0 + +phy_rx_polarity_flip_fabric96.BCM8879X=0 +phy_rx_polarity_flip_fabric97.BCM8879X=1 +phy_rx_polarity_flip_fabric98.BCM8879X=0 +phy_rx_polarity_flip_fabric99.BCM8879X=1 + +phy_rx_polarity_flip_fabric100.BCM8879X=1 +phy_rx_polarity_flip_fabric101.BCM8879X=0 +phy_rx_polarity_flip_fabric102.BCM8879X=1 +phy_rx_polarity_flip_fabric103.BCM8879X=0 + +phy_rx_polarity_flip_fabric104.BCM8879X=0 +phy_rx_polarity_flip_fabric105.BCM8879X=1 +phy_rx_polarity_flip_fabric106.BCM8879X=0 +phy_rx_polarity_flip_fabric107.BCM8879X=1 + +phy_rx_polarity_flip_fabric108.BCM8879X=0 +phy_rx_polarity_flip_fabric109.BCM8879X=1 +phy_rx_polarity_flip_fabric110.BCM8879X=0 +phy_rx_polarity_flip_fabric111.BCM8879X=1 + +phy_rx_polarity_flip_fabric112.BCM8879X=1 +phy_rx_polarity_flip_fabric113.BCM8879X=0 +phy_rx_polarity_flip_fabric114.BCM8879X=1 +phy_rx_polarity_flip_fabric115.BCM8879X=0 + +phy_rx_polarity_flip_fabric116.BCM8879X=0 +phy_rx_polarity_flip_fabric117.BCM8879X=1 +phy_rx_polarity_flip_fabric118.BCM8879X=0 +phy_rx_polarity_flip_fabric119.BCM8879X=1 + +phy_rx_polarity_flip_fabric120.BCM8879X=1 +phy_rx_polarity_flip_fabric121.BCM8879X=0 +phy_rx_polarity_flip_fabric122.BCM8879X=1 +phy_rx_polarity_flip_fabric123.BCM8879X=0 + +phy_rx_polarity_flip_fabric124.BCM8879X=1 +phy_rx_polarity_flip_fabric125.BCM8879X=0 +phy_rx_polarity_flip_fabric126.BCM8879X=1 +phy_rx_polarity_flip_fabric127.BCM8879X=0 + +phy_rx_polarity_flip_fabric128.BCM8879X=0 +phy_rx_polarity_flip_fabric129.BCM8879X=1 +phy_rx_polarity_flip_fabric130.BCM8879X=0 +phy_rx_polarity_flip_fabric131.BCM8879X=1 + +phy_rx_polarity_flip_fabric132.BCM8879X=1 +phy_rx_polarity_flip_fabric133.BCM8879X=0 +phy_rx_polarity_flip_fabric134.BCM8879X=1 +phy_rx_polarity_flip_fabric135.BCM8879X=0 + +phy_rx_polarity_flip_fabric136.BCM8879X=0 +phy_rx_polarity_flip_fabric137.BCM8879X=1 +phy_rx_polarity_flip_fabric138.BCM8879X=0 +phy_rx_polarity_flip_fabric139.BCM8879X=1 + +phy_rx_polarity_flip_fabric140.BCM8879X=1 +phy_rx_polarity_flip_fabric141.BCM8879X=0 +phy_rx_polarity_flip_fabric142.BCM8879X=1 +phy_rx_polarity_flip_fabric143.BCM8879X=0 + +phy_rx_polarity_flip_fabric144.BCM8879X=1 +phy_rx_polarity_flip_fabric145.BCM8879X=0 +phy_rx_polarity_flip_fabric146.BCM8879X=1 +phy_rx_polarity_flip_fabric147.BCM8879X=0 + +phy_rx_polarity_flip_fabric148.BCM8879X=0 +phy_rx_polarity_flip_fabric149.BCM8879X=1 +phy_rx_polarity_flip_fabric150.BCM8879X=0 +phy_rx_polarity_flip_fabric151.BCM8879X=1 + +phy_rx_polarity_flip_fabric152.BCM8879X=1 +phy_rx_polarity_flip_fabric153.BCM8879X=0 +phy_rx_polarity_flip_fabric154.BCM8879X=1 +phy_rx_polarity_flip_fabric155.BCM8879X=0 + +phy_rx_polarity_flip_fabric156.BCM8879X=0 +phy_rx_polarity_flip_fabric157.BCM8879X=1 +phy_rx_polarity_flip_fabric158.BCM8879X=0 +phy_rx_polarity_flip_fabric159.BCM8879X=1 + +phy_rx_polarity_flip_fabric160.BCM8879X=1 +phy_rx_polarity_flip_fabric161.BCM8879X=0 +phy_rx_polarity_flip_fabric162.BCM8879X=1 +phy_rx_polarity_flip_fabric163.BCM8879X=0 + +phy_rx_polarity_flip_fabric164.BCM8879X=1 +phy_rx_polarity_flip_fabric165.BCM8879X=0 +phy_rx_polarity_flip_fabric166.BCM8879X=1 +phy_rx_polarity_flip_fabric167.BCM8879X=0 + +phy_rx_polarity_flip_fabric168.BCM8879X=1 +phy_rx_polarity_flip_fabric169.BCM8879X=0 +phy_rx_polarity_flip_fabric170.BCM8879X=1 +phy_rx_polarity_flip_fabric171.BCM8879X=0 + +phy_rx_polarity_flip_fabric172.BCM8879X=0 +phy_rx_polarity_flip_fabric173.BCM8879X=1 +phy_rx_polarity_flip_fabric174.BCM8879X=0 +phy_rx_polarity_flip_fabric175.BCM8879X=1 + +phy_rx_polarity_flip_fabric176.BCM8879X=1 +phy_rx_polarity_flip_fabric177.BCM8879X=0 +phy_rx_polarity_flip_fabric178.BCM8879X=1 +phy_rx_polarity_flip_fabric179.BCM8879X=0 + +phy_rx_polarity_flip_fabric180.BCM8879X=0 +phy_rx_polarity_flip_fabric181.BCM8879X=1 +phy_rx_polarity_flip_fabric182.BCM8879X=0 +phy_rx_polarity_flip_fabric183.BCM8879X=1 + +phy_rx_polarity_flip_fabric184.BCM8879X=1 +phy_rx_polarity_flip_fabric185.BCM8879X=0 +phy_rx_polarity_flip_fabric186.BCM8879X=1 +phy_rx_polarity_flip_fabric187.BCM8879X=0 + +phy_rx_polarity_flip_fabric188.BCM8879X=1 +phy_rx_polarity_flip_fabric189.BCM8879X=0 +phy_rx_polarity_flip_fabric190.BCM8879X=1 +phy_rx_polarity_flip_fabric191.BCM8879X=0 + + +phy_tx_polarity_flip_fabric0.BCM8879X=0 +phy_tx_polarity_flip_fabric1.BCM8879X=1 +phy_tx_polarity_flip_fabric2.BCM8879X=0 +phy_tx_polarity_flip_fabric3.BCM8879X=1 + +phy_tx_polarity_flip_fabric4.BCM8879X=0 +phy_tx_polarity_flip_fabric5.BCM8879X=1 +phy_tx_polarity_flip_fabric6.BCM8879X=0 +phy_tx_polarity_flip_fabric7.BCM8879X=1 + +phy_tx_polarity_flip_fabric8.BCM8879X=1 +phy_tx_polarity_flip_fabric9.BCM8879X=0 +phy_tx_polarity_flip_fabric10.BCM8879X=1 +phy_tx_polarity_flip_fabric11.BCM8879X=0 + +phy_tx_polarity_flip_fabric12.BCM8879X=0 +phy_tx_polarity_flip_fabric13.BCM8879X=1 +phy_tx_polarity_flip_fabric14.BCM8879X=0 +phy_tx_polarity_flip_fabric15.BCM8879X=1 + +phy_tx_polarity_flip_fabric16.BCM8879X=0 +phy_tx_polarity_flip_fabric17.BCM8879X=1 +phy_tx_polarity_flip_fabric18.BCM8879X=0 +phy_tx_polarity_flip_fabric19.BCM8879X=1 + +phy_tx_polarity_flip_fabric20.BCM8879X=1 +phy_tx_polarity_flip_fabric21.BCM8879X=0 +phy_tx_polarity_flip_fabric22.BCM8879X=1 +phy_tx_polarity_flip_fabric23.BCM8879X=0 + +phy_tx_polarity_flip_fabric24.BCM8879X=0 +phy_tx_polarity_flip_fabric25.BCM8879X=1 +phy_tx_polarity_flip_fabric26.BCM8879X=0 +phy_tx_polarity_flip_fabric27.BCM8879X=1 + +phy_tx_polarity_flip_fabric28.BCM8879X=0 +phy_tx_polarity_flip_fabric29.BCM8879X=1 +phy_tx_polarity_flip_fabric30.BCM8879X=0 +phy_tx_polarity_flip_fabric31.BCM8879X=1 + +phy_tx_polarity_flip_fabric32.BCM8879X=1 +phy_tx_polarity_flip_fabric33.BCM8879X=0 +phy_tx_polarity_flip_fabric34.BCM8879X=1 +phy_tx_polarity_flip_fabric35.BCM8879X=0 + +phy_tx_polarity_flip_fabric36.BCM8879X=0 +phy_tx_polarity_flip_fabric37.BCM8879X=1 +phy_tx_polarity_flip_fabric38.BCM8879X=0 +phy_tx_polarity_flip_fabric39.BCM8879X=1 + +phy_tx_polarity_flip_fabric40.BCM8879X=1 +phy_tx_polarity_flip_fabric41.BCM8879X=0 +phy_tx_polarity_flip_fabric42.BCM8879X=1 +phy_tx_polarity_flip_fabric43.BCM8879X=0 + +phy_tx_polarity_flip_fabric44.BCM8879X=0 +phy_tx_polarity_flip_fabric45.BCM8879X=1 +phy_tx_polarity_flip_fabric46.BCM8879X=0 +phy_tx_polarity_flip_fabric47.BCM8879X=1 + +phy_tx_polarity_flip_fabric48.BCM8879X=0 +phy_tx_polarity_flip_fabric49.BCM8879X=1 +phy_tx_polarity_flip_fabric50.BCM8879X=0 +phy_tx_polarity_flip_fabric51.BCM8879X=1 + +phy_tx_polarity_flip_fabric52.BCM8879X=1 +phy_tx_polarity_flip_fabric53.BCM8879X=0 +phy_tx_polarity_flip_fabric54.BCM8879X=1 +phy_tx_polarity_flip_fabric55.BCM8879X=0 + +phy_tx_polarity_flip_fabric56.BCM8879X=1 +phy_tx_polarity_flip_fabric57.BCM8879X=0 +phy_tx_polarity_flip_fabric58.BCM8879X=1 +phy_tx_polarity_flip_fabric59.BCM8879X=0 + +phy_tx_polarity_flip_fabric60.BCM8879X=1 +phy_tx_polarity_flip_fabric61.BCM8879X=0 +phy_tx_polarity_flip_fabric62.BCM8879X=1 +phy_tx_polarity_flip_fabric63.BCM8879X=0 + +phy_tx_polarity_flip_fabric64.BCM8879X=1 +phy_tx_polarity_flip_fabric65.BCM8879X=0 +phy_tx_polarity_flip_fabric66.BCM8879X=1 +phy_tx_polarity_flip_fabric67.BCM8879X=0 + +phy_tx_polarity_flip_fabric68.BCM8879X=0 +phy_tx_polarity_flip_fabric69.BCM8879X=1 +phy_tx_polarity_flip_fabric70.BCM8879X=0 +phy_tx_polarity_flip_fabric71.BCM8879X=1 + +phy_tx_polarity_flip_fabric72.BCM8879X=0 +phy_tx_polarity_flip_fabric73.BCM8879X=1 +phy_tx_polarity_flip_fabric74.BCM8879X=0 +phy_tx_polarity_flip_fabric75.BCM8879X=1 + +phy_tx_polarity_flip_fabric76.BCM8879X=1 +phy_tx_polarity_flip_fabric77.BCM8879X=0 +phy_tx_polarity_flip_fabric78.BCM8879X=1 +phy_tx_polarity_flip_fabric79.BCM8879X=0 + +phy_tx_polarity_flip_fabric80.BCM8879X=0 +phy_tx_polarity_flip_fabric81.BCM8879X=1 +phy_tx_polarity_flip_fabric82.BCM8879X=0 +phy_tx_polarity_flip_fabric83.BCM8879X=1 + +phy_tx_polarity_flip_fabric84.BCM8879X=1 +phy_tx_polarity_flip_fabric85.BCM8879X=0 +phy_tx_polarity_flip_fabric86.BCM8879X=1 +phy_tx_polarity_flip_fabric87.BCM8879X=0 + +phy_tx_polarity_flip_fabric88.BCM8879X=0 +phy_tx_polarity_flip_fabric89.BCM8879X=1 +phy_tx_polarity_flip_fabric90.BCM8879X=0 +phy_tx_polarity_flip_fabric91.BCM8879X=1 + +phy_tx_polarity_flip_fabric92.BCM8879X=0 +phy_tx_polarity_flip_fabric93.BCM8879X=1 +phy_tx_polarity_flip_fabric94.BCM8879X=0 +phy_tx_polarity_flip_fabric95.BCM8879X=1 + +phy_tx_polarity_flip_fabric96.BCM8879X=1 +phy_tx_polarity_flip_fabric97.BCM8879X=0 +phy_tx_polarity_flip_fabric98.BCM8879X=1 +phy_tx_polarity_flip_fabric99.BCM8879X=0 + +phy_tx_polarity_flip_fabric100.BCM8879X=0 +phy_tx_polarity_flip_fabric101.BCM8879X=1 +phy_tx_polarity_flip_fabric102.BCM8879X=0 +phy_tx_polarity_flip_fabric103.BCM8879X=1 + +phy_tx_polarity_flip_fabric104.BCM8879X=1 +phy_tx_polarity_flip_fabric105.BCM8879X=0 +phy_tx_polarity_flip_fabric106.BCM8879X=1 +phy_tx_polarity_flip_fabric107.BCM8879X=0 + +phy_tx_polarity_flip_fabric108.BCM8879X=1 +phy_tx_polarity_flip_fabric109.BCM8879X=0 +phy_tx_polarity_flip_fabric110.BCM8879X=1 +phy_tx_polarity_flip_fabric111.BCM8879X=0 + +phy_tx_polarity_flip_fabric112.BCM8879X=0 +phy_tx_polarity_flip_fabric113.BCM8879X=1 +phy_tx_polarity_flip_fabric114.BCM8879X=0 +phy_tx_polarity_flip_fabric115.BCM8879X=1 + +phy_tx_polarity_flip_fabric116.BCM8879X=1 +phy_tx_polarity_flip_fabric117.BCM8879X=0 +phy_tx_polarity_flip_fabric118.BCM8879X=1 +phy_tx_polarity_flip_fabric119.BCM8879X=0 + +phy_tx_polarity_flip_fabric120.BCM8879X=0 +phy_tx_polarity_flip_fabric121.BCM8879X=1 +phy_tx_polarity_flip_fabric122.BCM8879X=0 +phy_tx_polarity_flip_fabric123.BCM8879X=1 + +phy_tx_polarity_flip_fabric124.BCM8879X=0 +phy_tx_polarity_flip_fabric125.BCM8879X=1 +phy_tx_polarity_flip_fabric126.BCM8879X=0 +phy_tx_polarity_flip_fabric127.BCM8879X=1 + +phy_tx_polarity_flip_fabric128.BCM8879X=1 +phy_tx_polarity_flip_fabric129.BCM8879X=0 +phy_tx_polarity_flip_fabric130.BCM8879X=1 +phy_tx_polarity_flip_fabric131.BCM8879X=0 + +phy_tx_polarity_flip_fabric132.BCM8879X=0 +phy_tx_polarity_flip_fabric133.BCM8879X=1 +phy_tx_polarity_flip_fabric134.BCM8879X=0 +phy_tx_polarity_flip_fabric135.BCM8879X=1 + +phy_tx_polarity_flip_fabric136.BCM8879X=1 +phy_tx_polarity_flip_fabric137.BCM8879X=0 +phy_tx_polarity_flip_fabric138.BCM8879X=1 +phy_tx_polarity_flip_fabric139.BCM8879X=0 + +phy_tx_polarity_flip_fabric140.BCM8879X=0 +phy_tx_polarity_flip_fabric141.BCM8879X=1 +phy_tx_polarity_flip_fabric142.BCM8879X=0 +phy_tx_polarity_flip_fabric143.BCM8879X=1 + +phy_tx_polarity_flip_fabric144.BCM8879X=0 +phy_tx_polarity_flip_fabric145.BCM8879X=1 +phy_tx_polarity_flip_fabric146.BCM8879X=0 +phy_tx_polarity_flip_fabric147.BCM8879X=1 + +phy_tx_polarity_flip_fabric148.BCM8879X=1 +phy_tx_polarity_flip_fabric149.BCM8879X=0 +phy_tx_polarity_flip_fabric150.BCM8879X=1 +phy_tx_polarity_flip_fabric151.BCM8879X=0 + +phy_tx_polarity_flip_fabric152.BCM8879X=0 +phy_tx_polarity_flip_fabric153.BCM8879X=1 +phy_tx_polarity_flip_fabric154.BCM8879X=0 +phy_tx_polarity_flip_fabric155.BCM8879X=1 + +phy_tx_polarity_flip_fabric156.BCM8879X=1 +phy_tx_polarity_flip_fabric157.BCM8879X=0 +phy_tx_polarity_flip_fabric158.BCM8879X=1 +phy_tx_polarity_flip_fabric159.BCM8879X=0 + +phy_tx_polarity_flip_fabric160.BCM8879X=0 +phy_tx_polarity_flip_fabric161.BCM8879X=1 +phy_tx_polarity_flip_fabric162.BCM8879X=0 +phy_tx_polarity_flip_fabric163.BCM8879X=1 + +phy_tx_polarity_flip_fabric164.BCM8879X=0 +phy_tx_polarity_flip_fabric165.BCM8879X=1 +phy_tx_polarity_flip_fabric166.BCM8879X=0 +phy_tx_polarity_flip_fabric167.BCM8879X=1 + +phy_tx_polarity_flip_fabric168.BCM8879X=0 +phy_tx_polarity_flip_fabric169.BCM8879X=1 +phy_tx_polarity_flip_fabric170.BCM8879X=0 +phy_tx_polarity_flip_fabric171.BCM8879X=1 + +phy_tx_polarity_flip_fabric172.BCM8879X=1 +phy_tx_polarity_flip_fabric173.BCM8879X=0 +phy_tx_polarity_flip_fabric174.BCM8879X=1 +phy_tx_polarity_flip_fabric175.BCM8879X=0 + +phy_tx_polarity_flip_fabric176.BCM8879X=0 +phy_tx_polarity_flip_fabric177.BCM8879X=1 +phy_tx_polarity_flip_fabric178.BCM8879X=0 +phy_tx_polarity_flip_fabric179.BCM8879X=1 + +phy_tx_polarity_flip_fabric180.BCM8879X=1 +phy_tx_polarity_flip_fabric181.BCM8879X=0 +phy_tx_polarity_flip_fabric182.BCM8879X=1 +phy_tx_polarity_flip_fabric183.BCM8879X=0 + +phy_tx_polarity_flip_fabric184.BCM8879X=0 +phy_tx_polarity_flip_fabric185.BCM8879X=1 +phy_tx_polarity_flip_fabric186.BCM8879X=0 +phy_tx_polarity_flip_fabric187.BCM8879X=1 + +phy_tx_polarity_flip_fabric188.BCM8879X=0 +phy_tx_polarity_flip_fabric189.BCM8879X=1 +phy_tx_polarity_flip_fabric190.BCM8879X=0 +phy_tx_polarity_flip_fabric191.BCM8879X=1 + +port_init_cl72_0=0 +port_init_cl72_1=0 +port_init_cl72_2=0 +port_init_cl72_3=0 +port_init_cl72_4=0 +port_init_cl72_5=0 +port_init_cl72_6=0 +port_init_cl72_7=0 +port_init_cl72_8=0 +port_init_cl72_9=0 +port_init_cl72_10=0 +port_init_cl72_11=0 +port_init_cl72_12=0 +port_init_cl72_13=0 +port_init_cl72_14=0 +port_init_cl72_15=0 +port_init_cl72_16=0 +port_init_cl72_17=0 +port_init_cl72_18=0 +port_init_cl72_19=0 +port_init_cl72_20=0 +port_init_cl72_21=0 +port_init_cl72_22=0 +port_init_cl72_23=0 +port_init_cl72_24=0 +port_init_cl72_25=0 +port_init_cl72_26=0 +port_init_cl72_27=0 +port_init_cl72_28=0 +port_init_cl72_29=0 +port_init_cl72_30=0 +port_init_cl72_31=0 +port_init_cl72_32=0 +port_init_cl72_33=0 +port_init_cl72_34=0 +port_init_cl72_35=0 +port_init_cl72_36=0 +port_init_cl72_37=0 +port_init_cl72_38=0 +port_init_cl72_39=0 +port_init_cl72_40=0 +port_init_cl72_41=0 +port_init_cl72_42=0 +port_init_cl72_43=0 +port_init_cl72_44=0 +port_init_cl72_45=0 +port_init_cl72_46=0 +port_init_cl72_47=0 +port_init_cl72_48=0 +port_init_cl72_49=0 +port_init_cl72_50=0 +port_init_cl72_51=0 +port_init_cl72_52=0 +port_init_cl72_53=0 +port_init_cl72_54=0 +port_init_cl72_55=0 +port_init_cl72_56=0 +port_init_cl72_57=0 +port_init_cl72_58=0 +port_init_cl72_59=0 +port_init_cl72_60=0 +port_init_cl72_61=0 +port_init_cl72_62=0 +port_init_cl72_63=0 +port_init_cl72_64=0 +port_init_cl72_65=0 +port_init_cl72_66=0 +port_init_cl72_67=0 +port_init_cl72_68=0 +port_init_cl72_69=0 +port_init_cl72_70=0 +port_init_cl72_71=0 +port_init_cl72_72=0 +port_init_cl72_73=0 +port_init_cl72_74=0 +port_init_cl72_75=0 +port_init_cl72_76=0 +port_init_cl72_77=0 +port_init_cl72_78=0 +port_init_cl72_79=0 +port_init_cl72_80=0 +port_init_cl72_81=0 +port_init_cl72_82=0 +port_init_cl72_83=0 +port_init_cl72_84=0 +port_init_cl72_85=0 +port_init_cl72_86=0 +port_init_cl72_87=0 +port_init_cl72_88=0 +port_init_cl72_89=0 +port_init_cl72_90=0 +port_init_cl72_91=0 +port_init_cl72_92=0 +port_init_cl72_93=0 +port_init_cl72_94=0 +port_init_cl72_95=0 +port_init_cl72_96=0 +port_init_cl72_97=0 +port_init_cl72_98=0 +port_init_cl72_99=0 +port_init_cl72_100=0 +port_init_cl72_101=0 +port_init_cl72_102=0 +port_init_cl72_103=0 +port_init_cl72_104=0 +port_init_cl72_105=0 +port_init_cl72_106=0 +port_init_cl72_107=0 +port_init_cl72_108=0 +port_init_cl72_109=0 +port_init_cl72_110=0 +port_init_cl72_111=0 +port_init_cl72_112=0 +port_init_cl72_113=0 +port_init_cl72_114=0 +port_init_cl72_115=0 +port_init_cl72_116=0 +port_init_cl72_117=0 +port_init_cl72_118=0 +port_init_cl72_119=0 +port_init_cl72_120=0 +port_init_cl72_121=0 +port_init_cl72_122=0 +port_init_cl72_123=0 +port_init_cl72_124=0 +port_init_cl72_125=0 +port_init_cl72_126=0 +port_init_cl72_127=0 +port_init_cl72_128=0 +port_init_cl72_129=0 +port_init_cl72_130=0 +port_init_cl72_131=0 +port_init_cl72_132=0 +port_init_cl72_133=0 +port_init_cl72_134=0 +port_init_cl72_135=0 +port_init_cl72_136=0 +port_init_cl72_137=0 +port_init_cl72_138=0 +port_init_cl72_139=0 +port_init_cl72_140=0 +port_init_cl72_141=0 +port_init_cl72_142=0 +port_init_cl72_143=0 +port_init_cl72_144=0 +port_init_cl72_145=0 +port_init_cl72_146=0 +port_init_cl72_147=0 +port_init_cl72_148=0 +port_init_cl72_149=0 +port_init_cl72_150=0 +port_init_cl72_151=0 +port_init_cl72_152=0 +port_init_cl72_153=0 +port_init_cl72_154=0 +port_init_cl72_155=0 +port_init_cl72_156=0 +port_init_cl72_157=0 +port_init_cl72_158=0 +port_init_cl72_159=0 +port_init_cl72_160=0 +port_init_cl72_161=0 +port_init_cl72_162=0 +port_init_cl72_163=0 +port_init_cl72_164=0 +port_init_cl72_165=0 +port_init_cl72_166=0 +port_init_cl72_167=0 +port_init_cl72_168=0 +port_init_cl72_169=0 +port_init_cl72_170=0 +port_init_cl72_171=0 +port_init_cl72_172=0 +port_init_cl72_173=0 +port_init_cl72_174=0 +port_init_cl72_175=0 +port_init_cl72_176=0 +port_init_cl72_177=0 +port_init_cl72_178=0 +port_init_cl72_179=0 +port_init_cl72_180=0 +port_init_cl72_181=0 +port_init_cl72_182=0 +port_init_cl72_183=0 +port_init_cl72_184=0 +port_init_cl72_185=0 +port_init_cl72_186=0 +port_init_cl72_187=0 +port_init_cl72_188=0 +port_init_cl72_189=0 +port_init_cl72_190=0 +port_init_cl72_191=0 + +serdes_tx_taps_0.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_1.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_2.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_3.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_4.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_5.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_6.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_7.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_8.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_9.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_10.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_11.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_12.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_13.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_14.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_15.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_16.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_17.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_18.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_19.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_20.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_21.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_22.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_23.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_24.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_25.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_26.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_27.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_28.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_29.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_30.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_31.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_32.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_33.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_34.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_35.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_36.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_37.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_38.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_39.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_40.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_41.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_42.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_43.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_44.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_45.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_46.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_47.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_48.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_49.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_50.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_51.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_52.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_53.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_54.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_55.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_56.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_57.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_58.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_59.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_60.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_61.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_62.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_63.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_64.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_65.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_66.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_67.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_68.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_69.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_70.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_71.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_72.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_73.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_74.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_75.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_76.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_77.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_78.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_79.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_80.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_81.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_82.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_83.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_84.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_85.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_86.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_87.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_88.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_89.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_90.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_91.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_92.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_93.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_94.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_95.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_96.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_97.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_98.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_99.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_100.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_101.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_102.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_103.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_104.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_105.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_106.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_107.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_108.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_109.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_110.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_111.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_112.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_113.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_114.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_115.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_116.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_117.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_118.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_119.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_120.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_121.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_122.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_123.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_124.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_125.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_126.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_127.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_128.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_129.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_130.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_131.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_132.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_133.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_134.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_135.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_136.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_137.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_138.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_139.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_140.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_141.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_142.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_143.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_144.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_145.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_146.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_147.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_148.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_149.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_150.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_151.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_152.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_153.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_154.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_155.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_156.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_157.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_158.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_159.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_160.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_161.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_162.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_163.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_164.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_165.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_166.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_167.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_168.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_169.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_170.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_171.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_172.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_173.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_174.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_175.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_176.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_177.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_178.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_179.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_180.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_181.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_182.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_183.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_184.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_185.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_186.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_187.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_188.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_189.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_190.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_191.BCM8879X=pam4:-24:132:-12:0:0:0 + +serdes_lane_config_channel_mode_0.0=force_nr +serdes_lane_config_channel_mode_1.0=force_nr +serdes_lane_config_channel_mode_2.0=force_nr +serdes_lane_config_channel_mode_3.0=force_nr +serdes_lane_config_channel_mode_4.0=force_nr +serdes_lane_config_channel_mode_5.0=force_nr +serdes_lane_config_channel_mode_6.0=force_nr +serdes_lane_config_channel_mode_7.0=force_nr +serdes_lane_config_channel_mode_8.0=force_nr +serdes_lane_config_channel_mode_9.0=force_nr +serdes_lane_config_channel_mode_10.0=force_nr +serdes_lane_config_channel_mode_11.0=force_nr +serdes_lane_config_channel_mode_12.0=force_nr +serdes_lane_config_channel_mode_13.0=force_nr +serdes_lane_config_channel_mode_14.0=force_nr +serdes_lane_config_channel_mode_15.0=force_nr +serdes_lane_config_channel_mode_16.0=force_nr +serdes_lane_config_channel_mode_17.0=force_nr +serdes_lane_config_channel_mode_18.0=force_nr +serdes_lane_config_channel_mode_19.0=force_nr +serdes_lane_config_channel_mode_20.0=force_nr +serdes_lane_config_channel_mode_21.0=force_nr +serdes_lane_config_channel_mode_22.0=force_nr +serdes_lane_config_channel_mode_23.0=force_nr +serdes_lane_config_channel_mode_24.0=force_nr +serdes_lane_config_channel_mode_25.0=force_nr +serdes_lane_config_channel_mode_26.0=force_nr +serdes_lane_config_channel_mode_27.0=force_nr +serdes_lane_config_channel_mode_28.0=force_nr +serdes_lane_config_channel_mode_29.0=force_nr +serdes_lane_config_channel_mode_30.0=force_nr +serdes_lane_config_channel_mode_31.0=force_nr +serdes_lane_config_channel_mode_32.0=force_nr +serdes_lane_config_channel_mode_33.0=force_nr +serdes_lane_config_channel_mode_34.0=force_nr +serdes_lane_config_channel_mode_35.0=force_nr +serdes_lane_config_channel_mode_36.0=force_nr +serdes_lane_config_channel_mode_37.0=force_nr +serdes_lane_config_channel_mode_38.0=force_nr +serdes_lane_config_channel_mode_39.0=force_nr +serdes_lane_config_channel_mode_40.0=force_nr +serdes_lane_config_channel_mode_41.0=force_nr +serdes_lane_config_channel_mode_42.0=force_nr +serdes_lane_config_channel_mode_43.0=force_nr +serdes_lane_config_channel_mode_44.0=force_nr +serdes_lane_config_channel_mode_45.0=force_nr +serdes_lane_config_channel_mode_46.0=force_nr +serdes_lane_config_channel_mode_47.0=force_nr +serdes_lane_config_channel_mode_48.0=force_nr +serdes_lane_config_channel_mode_49.0=force_nr +serdes_lane_config_channel_mode_50.0=force_nr +serdes_lane_config_channel_mode_51.0=force_nr +serdes_lane_config_channel_mode_52.0=force_nr +serdes_lane_config_channel_mode_53.0=force_nr +serdes_lane_config_channel_mode_54.0=force_nr +serdes_lane_config_channel_mode_55.0=force_nr +serdes_lane_config_channel_mode_56.0=force_nr +serdes_lane_config_channel_mode_57.0=force_nr +serdes_lane_config_channel_mode_58.0=force_nr +serdes_lane_config_channel_mode_59.0=force_nr +serdes_lane_config_channel_mode_60.0=force_nr +serdes_lane_config_channel_mode_61.0=force_nr +serdes_lane_config_channel_mode_62.0=force_nr +serdes_lane_config_channel_mode_63.0=force_nr +serdes_lane_config_channel_mode_64.0=force_nr +serdes_lane_config_channel_mode_65.0=force_nr +serdes_lane_config_channel_mode_66.0=force_nr +serdes_lane_config_channel_mode_67.0=force_nr +serdes_lane_config_channel_mode_68.0=force_nr +serdes_lane_config_channel_mode_69.0=force_nr +serdes_lane_config_channel_mode_70.0=force_nr +serdes_lane_config_channel_mode_71.0=force_nr +serdes_lane_config_channel_mode_72.0=force_nr +serdes_lane_config_channel_mode_73.0=force_nr +serdes_lane_config_channel_mode_74.0=force_nr +serdes_lane_config_channel_mode_75.0=force_nr +serdes_lane_config_channel_mode_76.0=force_nr +serdes_lane_config_channel_mode_77.0=force_nr +serdes_lane_config_channel_mode_78.0=force_nr +serdes_lane_config_channel_mode_79.0=force_nr +serdes_lane_config_channel_mode_80.0=force_nr +serdes_lane_config_channel_mode_81.0=force_nr +serdes_lane_config_channel_mode_82.0=force_nr +serdes_lane_config_channel_mode_83.0=force_nr +serdes_lane_config_channel_mode_84.0=force_nr +serdes_lane_config_channel_mode_85.0=force_nr +serdes_lane_config_channel_mode_86.0=force_nr +serdes_lane_config_channel_mode_87.0=force_nr +serdes_lane_config_channel_mode_88.0=force_nr +serdes_lane_config_channel_mode_89.0=force_nr +serdes_lane_config_channel_mode_90.0=force_nr +serdes_lane_config_channel_mode_91.0=force_nr +serdes_lane_config_channel_mode_92.0=force_nr +serdes_lane_config_channel_mode_93.0=force_nr +serdes_lane_config_channel_mode_94.0=force_nr +serdes_lane_config_channel_mode_95.0=force_nr +serdes_lane_config_channel_mode_96.0=force_nr +serdes_lane_config_channel_mode_97.0=force_nr +serdes_lane_config_channel_mode_98.0=force_nr +serdes_lane_config_channel_mode_99.0=force_nr +serdes_lane_config_channel_mode_100.0=force_nr +serdes_lane_config_channel_mode_101.0=force_nr +serdes_lane_config_channel_mode_102.0=force_nr +serdes_lane_config_channel_mode_103.0=force_nr +serdes_lane_config_channel_mode_104.0=force_nr +serdes_lane_config_channel_mode_105.0=force_nr +serdes_lane_config_channel_mode_106.0=force_nr +serdes_lane_config_channel_mode_107.0=force_nr +serdes_lane_config_channel_mode_108.0=force_nr +serdes_lane_config_channel_mode_109.0=force_nr +serdes_lane_config_channel_mode_110.0=force_nr +serdes_lane_config_channel_mode_111.0=force_nr +serdes_lane_config_channel_mode_112.0=force_nr +serdes_lane_config_channel_mode_113.0=force_nr +serdes_lane_config_channel_mode_114.0=force_nr +serdes_lane_config_channel_mode_115.0=force_nr +serdes_lane_config_channel_mode_116.0=force_nr +serdes_lane_config_channel_mode_117.0=force_nr +serdes_lane_config_channel_mode_118.0=force_nr +serdes_lane_config_channel_mode_119.0=force_nr +serdes_lane_config_channel_mode_120.0=force_nr +serdes_lane_config_channel_mode_121.0=force_nr +serdes_lane_config_channel_mode_122.0=force_nr +serdes_lane_config_channel_mode_123.0=force_nr +serdes_lane_config_channel_mode_124.0=force_nr +serdes_lane_config_channel_mode_125.0=force_nr +serdes_lane_config_channel_mode_126.0=force_nr +serdes_lane_config_channel_mode_127.0=force_nr +serdes_lane_config_channel_mode_128.0=force_nr +serdes_lane_config_channel_mode_129.0=force_nr +serdes_lane_config_channel_mode_130.0=force_nr +serdes_lane_config_channel_mode_131.0=force_nr +serdes_lane_config_channel_mode_132.0=force_nr +serdes_lane_config_channel_mode_133.0=force_nr +serdes_lane_config_channel_mode_134.0=force_nr +serdes_lane_config_channel_mode_135.0=force_nr +serdes_lane_config_channel_mode_136.0=force_nr +serdes_lane_config_channel_mode_137.0=force_nr +serdes_lane_config_channel_mode_138.0=force_nr +serdes_lane_config_channel_mode_139.0=force_nr +serdes_lane_config_channel_mode_140.0=force_nr +serdes_lane_config_channel_mode_141.0=force_nr +serdes_lane_config_channel_mode_142.0=force_nr +serdes_lane_config_channel_mode_143.0=force_nr +serdes_lane_config_channel_mode_144.0=force_nr +serdes_lane_config_channel_mode_145.0=force_nr +serdes_lane_config_channel_mode_146.0=force_nr +serdes_lane_config_channel_mode_147.0=force_nr +serdes_lane_config_channel_mode_148.0=force_nr +serdes_lane_config_channel_mode_149.0=force_nr +serdes_lane_config_channel_mode_150.0=force_nr +serdes_lane_config_channel_mode_151.0=force_nr +serdes_lane_config_channel_mode_152.0=force_nr +serdes_lane_config_channel_mode_153.0=force_nr +serdes_lane_config_channel_mode_154.0=force_nr +serdes_lane_config_channel_mode_155.0=force_nr +serdes_lane_config_channel_mode_156.0=force_nr +serdes_lane_config_channel_mode_157.0=force_nr +serdes_lane_config_channel_mode_158.0=force_nr +serdes_lane_config_channel_mode_159.0=force_nr +serdes_lane_config_channel_mode_160.0=force_nr +serdes_lane_config_channel_mode_161.0=force_nr +serdes_lane_config_channel_mode_162.0=force_nr +serdes_lane_config_channel_mode_163.0=force_nr +serdes_lane_config_channel_mode_164.0=force_nr +serdes_lane_config_channel_mode_165.0=force_nr +serdes_lane_config_channel_mode_166.0=force_nr +serdes_lane_config_channel_mode_167.0=force_nr +serdes_lane_config_channel_mode_168.0=force_nr +serdes_lane_config_channel_mode_169.0=force_nr +serdes_lane_config_channel_mode_170.0=force_nr +serdes_lane_config_channel_mode_171.0=force_nr +serdes_lane_config_channel_mode_172.0=force_nr +serdes_lane_config_channel_mode_173.0=force_nr +serdes_lane_config_channel_mode_174.0=force_nr +serdes_lane_config_channel_mode_175.0=force_nr +serdes_lane_config_channel_mode_176.0=force_nr +serdes_lane_config_channel_mode_177.0=force_nr +serdes_lane_config_channel_mode_178.0=force_nr +serdes_lane_config_channel_mode_179.0=force_nr +serdes_lane_config_channel_mode_180.0=force_nr +serdes_lane_config_channel_mode_181.0=force_nr +serdes_lane_config_channel_mode_182.0=force_nr +serdes_lane_config_channel_mode_183.0=force_nr +serdes_lane_config_channel_mode_184.0=force_nr +serdes_lane_config_channel_mode_185.0=force_nr +serdes_lane_config_channel_mode_186.0=force_nr +serdes_lane_config_channel_mode_187.0=force_nr +serdes_lane_config_channel_mode_188.0=force_nr +serdes_lane_config_channel_mode_189.0=force_nr +serdes_lane_config_channel_mode_190.0=force_nr +serdes_lane_config_channel_mode_191.0=force_nr + + +serdes_qrtt_active_0.0=1 +serdes_qrtt_active_1.0=1 +serdes_qrtt_active_2.0=1 +serdes_qrtt_active_3.0=1 +serdes_qrtt_active_4.0=1 +serdes_qrtt_active_5.0=1 +serdes_qrtt_active_6.0=1 +serdes_qrtt_active_7.0=1 +serdes_qrtt_active_8.0=1 +serdes_qrtt_active_9.0=1 +serdes_qrtt_active_10.0=1 +serdes_qrtt_active_11.0=1 +serdes_qrtt_active_12.0=1 +serdes_qrtt_active_13.0=1 +serdes_qrtt_active_14.0=1 +serdes_qrtt_active_15.0=1 +serdes_qrtt_active_16.0=1 +serdes_qrtt_active_17.0=1 +serdes_qrtt_active_18.0=1 +serdes_qrtt_active_19.0=1 +serdes_qrtt_active_20.0=1 +serdes_qrtt_active_21.0=1 +serdes_qrtt_active_22.0=1 +serdes_qrtt_active_23.0=1 +serdes_qrtt_active_24.0=1 +serdes_qrtt_active_25.0=1 +serdes_qrtt_active_26.0=1 +serdes_qrtt_active_27.0=1 +serdes_qrtt_active_28.0=1 +serdes_qrtt_active_29.0=1 +serdes_qrtt_active_30.0=1 +serdes_qrtt_active_31.0=1 +serdes_qrtt_active_32.0=1 +serdes_qrtt_active_33.0=1 +serdes_qrtt_active_34.0=1 +serdes_qrtt_active_35.0=1 +serdes_qrtt_active_36.0=1 +serdes_qrtt_active_37.0=1 +serdes_qrtt_active_38.0=1 +serdes_qrtt_active_39.0=1 +serdes_qrtt_active_40.0=1 +serdes_qrtt_active_41.0=1 +serdes_qrtt_active_42.0=1 +serdes_qrtt_active_43.0=1 +serdes_qrtt_active_44.0=1 +serdes_qrtt_active_45.0=1 +serdes_qrtt_active_46.0=1 +serdes_qrtt_active_47.0=1 diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/4/config-ramon-3-0.bcm b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/4/config-ramon-3-0.bcm new file mode 100644 index 000000000000..449076477dd6 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/4/config-ramon-3-0.bcm @@ -0,0 +1,1394 @@ + +appl_enable_intr_init.BCM8879X=0 +appl_param_module_id.BCM8879X=5 +bcm_linkscan_interval.BCM8879X=0 +bcm_stat_interval.BCM8879X=4000000 +bist_enable.BCM8879X=0 +core_clock_speed_khz.BCM8879X=1000000 +custom_feature_access_only.BCM8879X=0 +custom_feature_lane_swap_disable.BCM8879X=0 +dport_map_direct.BCM8879X=1 +fabric_cell_fifo_dma_enable.BCM8879X=0 +fabric_device_mode.BCM8879X=SINGLE_STAGE_FE2 +fabric_load_balancing_mode.BCM8879X=NORMAL_LOAD_BALANCE +fabric_multicast_mode.BCM8879X=DIRECT +fabric_num_pipes.BCM8879X=1 +fabric_pipe_map.BCM8879X=0 +fe_mc_id_range.BCM8879X=128K +load_firmware.BCM8879X=0x102 +mdio_output_delay_ext.BCM8879X=14 +mdio_output_delay_int.BCM8879X=25 +mem_cache_enable_parity.BCM8879X=1 +mm_intr_enable.BCM8879X=0 +mm_timeout_usec.BCM8879X=300000 +polled_irq_delay.BCM8879X=100000 +polled_irq_mode.BCM8879X=1 +port_fec.BCM8879X=7 +port_init_cl72.BCM8879X=0 +port_init_speed.BCM8879X=53125 +rate_ext_mdio_divisor.BCM8879X=14 +rate_int_mdio_divisor.BCM8879X=50 +schan_intr_enable.BCM8879X=0 +schan_timeout_usec.BCM8879X=300000 +serdes_fabric_clk_freq_in.BCM8879X=1 +serdes_fabric_clk_freq_out.BCM8879X=bypass +soc_family.BCM8879X=BCM8879X +srd_tx_drv_hv_disable.BCM8879X=0 +system_contains_multiple_pipe_device.BCM8879X=0 +system_ref_core_clock_khz.BCM8879X=1200000 +table_dma_enable.BCM8879X=0 +tdma_intr_enable.BCM8879X=0 +tdma_timeout_usec.BCM8879X=5000000 +tslam_dma_enable.BCM8879X=0 +tslam_intr_enable.BCM8879X=0 +tslam_timeout_usec.BCM8879X=5000000 + +lane_to_serdes_map_fabric_lane0.BCM8879X=rx0:tx0 +lane_to_serdes_map_fabric_lane1.BCM8879X=rx1:tx1 +lane_to_serdes_map_fabric_lane2.BCM8879X=rx2:tx2 +lane_to_serdes_map_fabric_lane3.BCM8879X=rx3:tx3 + +lane_to_serdes_map_fabric_lane4.BCM8879X=rx4:tx4 +lane_to_serdes_map_fabric_lane5.BCM8879X=rx5:tx5 +lane_to_serdes_map_fabric_lane6.BCM8879X=rx6:tx6 +lane_to_serdes_map_fabric_lane7.BCM8879X=rx7:tx7 + +lane_to_serdes_map_fabric_lane8.BCM8879X=rx8:tx8 +lane_to_serdes_map_fabric_lane9.BCM8879X=rx9:tx9 +lane_to_serdes_map_fabric_lane10.BCM8879X=rx10:tx10 +lane_to_serdes_map_fabric_lane11.BCM8879X=rx11:tx11 + +lane_to_serdes_map_fabric_lane12.BCM8879X=rx12:tx12 +lane_to_serdes_map_fabric_lane13.BCM8879X=rx13:tx13 +lane_to_serdes_map_fabric_lane14.BCM8879X=rx14:tx14 +lane_to_serdes_map_fabric_lane15.BCM8879X=rx15:tx15 + +lane_to_serdes_map_fabric_lane16.BCM8879X=rx16:tx16 +lane_to_serdes_map_fabric_lane17.BCM8879X=rx17:tx17 +lane_to_serdes_map_fabric_lane18.BCM8879X=rx18:tx18 +lane_to_serdes_map_fabric_lane19.BCM8879X=rx19:tx19 + +lane_to_serdes_map_fabric_lane20.BCM8879X=rx20:tx20 +lane_to_serdes_map_fabric_lane21.BCM8879X=rx21:tx21 +lane_to_serdes_map_fabric_lane22.BCM8879X=rx22:tx22 +lane_to_serdes_map_fabric_lane23.BCM8879X=rx23:tx23 + +lane_to_serdes_map_fabric_lane24.BCM8879X=rx24:tx24 +lane_to_serdes_map_fabric_lane25.BCM8879X=rx25:tx25 +lane_to_serdes_map_fabric_lane26.BCM8879X=rx26:tx26 +lane_to_serdes_map_fabric_lane27.BCM8879X=rx27:tx27 + +lane_to_serdes_map_fabric_lane28.BCM8879X=rx28:tx28 +lane_to_serdes_map_fabric_lane29.BCM8879X=rx29:tx29 +lane_to_serdes_map_fabric_lane30.BCM8879X=rx30:tx30 +lane_to_serdes_map_fabric_lane31.BCM8879X=rx31:tx31 + +lane_to_serdes_map_fabric_lane32.BCM8879X=rx32:tx32 +lane_to_serdes_map_fabric_lane33.BCM8879X=rx33:tx33 +lane_to_serdes_map_fabric_lane34.BCM8879X=rx34:tx34 +lane_to_serdes_map_fabric_lane35.BCM8879X=rx35:tx35 + +lane_to_serdes_map_fabric_lane36.BCM8879X=rx36:tx36 +lane_to_serdes_map_fabric_lane37.BCM8879X=rx37:tx37 +lane_to_serdes_map_fabric_lane38.BCM8879X=rx38:tx38 +lane_to_serdes_map_fabric_lane39.BCM8879X=rx39:tx39 + +lane_to_serdes_map_fabric_lane40.BCM8879X=rx40:tx40 +lane_to_serdes_map_fabric_lane41.BCM8879X=rx41:tx41 +lane_to_serdes_map_fabric_lane42.BCM8879X=rx42:tx42 +lane_to_serdes_map_fabric_lane43.BCM8879X=rx43:tx43 + +lane_to_serdes_map_fabric_lane44.BCM8879X=rx44:tx44 +lane_to_serdes_map_fabric_lane45.BCM8879X=rx45:tx45 +lane_to_serdes_map_fabric_lane46.BCM8879X=rx46:tx46 +lane_to_serdes_map_fabric_lane47.BCM8879X=rx47:tx47 + +lane_to_serdes_map_fabric_lane48.BCM8879X=rx48:tx48 +lane_to_serdes_map_fabric_lane49.BCM8879X=rx49:tx49 +lane_to_serdes_map_fabric_lane50.BCM8879X=rx50:tx50 +lane_to_serdes_map_fabric_lane51.BCM8879X=rx51:tx51 + +lane_to_serdes_map_fabric_lane52.BCM8879X=rx52:tx52 +lane_to_serdes_map_fabric_lane53.BCM8879X=rx53:tx53 +lane_to_serdes_map_fabric_lane54.BCM8879X=rx54:tx54 +lane_to_serdes_map_fabric_lane55.BCM8879X=rx55:tx55 + +lane_to_serdes_map_fabric_lane56.BCM8879X=rx56:tx56 +lane_to_serdes_map_fabric_lane57.BCM8879X=rx57:tx57 +lane_to_serdes_map_fabric_lane58.BCM8879X=rx58:tx58 +lane_to_serdes_map_fabric_lane59.BCM8879X=rx59:tx59 + +lane_to_serdes_map_fabric_lane60.BCM8879X=rx60:tx60 +lane_to_serdes_map_fabric_lane61.BCM8879X=rx61:tx61 +lane_to_serdes_map_fabric_lane62.BCM8879X=rx62:tx62 +lane_to_serdes_map_fabric_lane63.BCM8879X=rx63:tx63 + +lane_to_serdes_map_fabric_lane64.BCM8879X=rx64:tx64 +lane_to_serdes_map_fabric_lane65.BCM8879X=rx65:tx65 +lane_to_serdes_map_fabric_lane66.BCM8879X=rx66:tx66 +lane_to_serdes_map_fabric_lane67.BCM8879X=rx67:tx67 + +lane_to_serdes_map_fabric_lane68.BCM8879X=rx68:tx68 +lane_to_serdes_map_fabric_lane69.BCM8879X=rx69:tx69 +lane_to_serdes_map_fabric_lane70.BCM8879X=rx70:tx70 +lane_to_serdes_map_fabric_lane71.BCM8879X=rx71:tx71 + +lane_to_serdes_map_fabric_lane72.BCM8879X=rx72:tx72 +lane_to_serdes_map_fabric_lane73.BCM8879X=rx73:tx73 +lane_to_serdes_map_fabric_lane74.BCM8879X=rx74:tx74 +lane_to_serdes_map_fabric_lane75.BCM8879X=rx75:tx75 + +lane_to_serdes_map_fabric_lane76.BCM8879X=rx76:tx76 +lane_to_serdes_map_fabric_lane77.BCM8879X=rx77:tx77 +lane_to_serdes_map_fabric_lane78.BCM8879X=rx78:tx78 +lane_to_serdes_map_fabric_lane79.BCM8879X=rx79:tx79 + +lane_to_serdes_map_fabric_lane80.BCM8879X=rx80:tx80 +lane_to_serdes_map_fabric_lane81.BCM8879X=rx81:tx81 +lane_to_serdes_map_fabric_lane82.BCM8879X=rx82:tx82 +lane_to_serdes_map_fabric_lane83.BCM8879X=rx83:tx83 + +lane_to_serdes_map_fabric_lane84.BCM8879X=rx84:tx84 +lane_to_serdes_map_fabric_lane85.BCM8879X=rx85:tx85 +lane_to_serdes_map_fabric_lane86.BCM8879X=rx86:tx86 +lane_to_serdes_map_fabric_lane87.BCM8879X=rx87:tx87 + +lane_to_serdes_map_fabric_lane88.BCM8879X=rx88:tx88 +lane_to_serdes_map_fabric_lane89.BCM8879X=rx89:tx89 +lane_to_serdes_map_fabric_lane90.BCM8879X=rx90:tx90 +lane_to_serdes_map_fabric_lane91.BCM8879X=rx91:tx91 + +lane_to_serdes_map_fabric_lane92.BCM8879X=rx92:tx92 +lane_to_serdes_map_fabric_lane93.BCM8879X=rx93:tx93 +lane_to_serdes_map_fabric_lane94.BCM8879X=rx94:tx94 +lane_to_serdes_map_fabric_lane95.BCM8879X=rx95:tx95 + +lane_to_serdes_map_fabric_lane96.BCM8879X=rx96:tx96 +lane_to_serdes_map_fabric_lane97.BCM8879X=rx97:tx97 +lane_to_serdes_map_fabric_lane98.BCM8879X=rx98:tx98 +lane_to_serdes_map_fabric_lane99.BCM8879X=rx99:tx99 + +lane_to_serdes_map_fabric_lane100.BCM8879X=rx100:tx100 +lane_to_serdes_map_fabric_lane101.BCM8879X=rx101:tx101 +lane_to_serdes_map_fabric_lane102.BCM8879X=rx102:tx102 +lane_to_serdes_map_fabric_lane103.BCM8879X=rx103:tx103 + +lane_to_serdes_map_fabric_lane104.BCM8879X=rx104:tx104 +lane_to_serdes_map_fabric_lane105.BCM8879X=rx105:tx105 +lane_to_serdes_map_fabric_lane106.BCM8879X=rx106:tx106 +lane_to_serdes_map_fabric_lane107.BCM8879X=rx107:tx107 + +lane_to_serdes_map_fabric_lane108.BCM8879X=rx108:tx108 +lane_to_serdes_map_fabric_lane109.BCM8879X=rx109:tx109 +lane_to_serdes_map_fabric_lane110.BCM8879X=rx110:tx110 +lane_to_serdes_map_fabric_lane111.BCM8879X=rx111:tx111 + +lane_to_serdes_map_fabric_lane112.BCM8879X=rx112:tx112 +lane_to_serdes_map_fabric_lane113.BCM8879X=rx113:tx113 +lane_to_serdes_map_fabric_lane114.BCM8879X=rx114:tx114 +lane_to_serdes_map_fabric_lane115.BCM8879X=rx115:tx115 + +lane_to_serdes_map_fabric_lane116.BCM8879X=rx116:tx116 +lane_to_serdes_map_fabric_lane117.BCM8879X=rx117:tx117 +lane_to_serdes_map_fabric_lane118.BCM8879X=rx118:tx118 +lane_to_serdes_map_fabric_lane119.BCM8879X=rx119:tx119 + +lane_to_serdes_map_fabric_lane120.BCM8879X=rx120:tx120 +lane_to_serdes_map_fabric_lane121.BCM8879X=rx121:tx121 +lane_to_serdes_map_fabric_lane122.BCM8879X=rx122:tx122 +lane_to_serdes_map_fabric_lane123.BCM8879X=rx123:tx123 + +lane_to_serdes_map_fabric_lane124.BCM8879X=rx124:tx124 +lane_to_serdes_map_fabric_lane125.BCM8879X=rx125:tx125 +lane_to_serdes_map_fabric_lane126.BCM8879X=rx126:tx126 +lane_to_serdes_map_fabric_lane127.BCM8879X=rx127:tx127 + +lane_to_serdes_map_fabric_lane128.BCM8879X=rx128:tx128 +lane_to_serdes_map_fabric_lane129.BCM8879X=rx129:tx129 +lane_to_serdes_map_fabric_lane130.BCM8879X=rx130:tx130 +lane_to_serdes_map_fabric_lane131.BCM8879X=rx131:tx131 + +lane_to_serdes_map_fabric_lane132.BCM8879X=rx132:tx132 +lane_to_serdes_map_fabric_lane133.BCM8879X=rx133:tx133 +lane_to_serdes_map_fabric_lane134.BCM8879X=rx134:tx134 +lane_to_serdes_map_fabric_lane135.BCM8879X=rx135:tx135 + +lane_to_serdes_map_fabric_lane136.BCM8879X=rx136:tx136 +lane_to_serdes_map_fabric_lane137.BCM8879X=rx137:tx137 +lane_to_serdes_map_fabric_lane138.BCM8879X=rx138:tx138 +lane_to_serdes_map_fabric_lane139.BCM8879X=rx139:tx139 + +lane_to_serdes_map_fabric_lane140.BCM8879X=rx140:tx140 +lane_to_serdes_map_fabric_lane141.BCM8879X=rx141:tx141 +lane_to_serdes_map_fabric_lane142.BCM8879X=rx142:tx142 +lane_to_serdes_map_fabric_lane143.BCM8879X=rx143:tx143 + +lane_to_serdes_map_fabric_lane144.BCM8879X=rx144:tx144 +lane_to_serdes_map_fabric_lane145.BCM8879X=rx145:tx145 +lane_to_serdes_map_fabric_lane146.BCM8879X=rx146:tx146 +lane_to_serdes_map_fabric_lane147.BCM8879X=rx147:tx147 + +lane_to_serdes_map_fabric_lane148.BCM8879X=rx148:tx148 +lane_to_serdes_map_fabric_lane149.BCM8879X=rx149:tx149 +lane_to_serdes_map_fabric_lane150.BCM8879X=rx150:tx150 +lane_to_serdes_map_fabric_lane151.BCM8879X=rx151:tx151 + +lane_to_serdes_map_fabric_lane152.BCM8879X=rx152:tx152 +lane_to_serdes_map_fabric_lane153.BCM8879X=rx153:tx153 +lane_to_serdes_map_fabric_lane154.BCM8879X=rx154:tx154 +lane_to_serdes_map_fabric_lane155.BCM8879X=rx155:tx155 + +lane_to_serdes_map_fabric_lane156.BCM8879X=rx156:tx156 +lane_to_serdes_map_fabric_lane157.BCM8879X=rx157:tx157 +lane_to_serdes_map_fabric_lane158.BCM8879X=rx158:tx158 +lane_to_serdes_map_fabric_lane159.BCM8879X=rx159:tx159 + +lane_to_serdes_map_fabric_lane160.BCM8879X=rx160:tx160 +lane_to_serdes_map_fabric_lane161.BCM8879X=rx161:tx161 +lane_to_serdes_map_fabric_lane162.BCM8879X=rx162:tx162 +lane_to_serdes_map_fabric_lane163.BCM8879X=rx163:tx163 + +lane_to_serdes_map_fabric_lane164.BCM8879X=rx164:tx164 +lane_to_serdes_map_fabric_lane165.BCM8879X=rx165:tx165 +lane_to_serdes_map_fabric_lane166.BCM8879X=rx166:tx166 +lane_to_serdes_map_fabric_lane167.BCM8879X=rx167:tx167 + +lane_to_serdes_map_fabric_lane168.BCM8879X=rx168:tx168 +lane_to_serdes_map_fabric_lane169.BCM8879X=rx169:tx169 +lane_to_serdes_map_fabric_lane170.BCM8879X=rx170:tx170 +lane_to_serdes_map_fabric_lane171.BCM8879X=rx171:tx171 + +lane_to_serdes_map_fabric_lane172.BCM8879X=rx172:tx172 +lane_to_serdes_map_fabric_lane173.BCM8879X=rx173:tx173 +lane_to_serdes_map_fabric_lane174.BCM8879X=rx174:tx174 +lane_to_serdes_map_fabric_lane175.BCM8879X=rx175:tx175 + +lane_to_serdes_map_fabric_lane176.BCM8879X=rx176:tx176 +lane_to_serdes_map_fabric_lane177.BCM8879X=rx177:tx177 +lane_to_serdes_map_fabric_lane178.BCM8879X=rx178:tx178 +lane_to_serdes_map_fabric_lane179.BCM8879X=rx179:tx179 + +lane_to_serdes_map_fabric_lane180.BCM8879X=rx180:tx180 +lane_to_serdes_map_fabric_lane181.BCM8879X=rx181:tx181 +lane_to_serdes_map_fabric_lane182.BCM8879X=rx182:tx182 +lane_to_serdes_map_fabric_lane183.BCM8879X=rx183:tx183 + +lane_to_serdes_map_fabric_lane184.BCM8879X=rx184:tx184 +lane_to_serdes_map_fabric_lane185.BCM8879X=rx185:tx185 +lane_to_serdes_map_fabric_lane186.BCM8879X=rx186:tx186 +lane_to_serdes_map_fabric_lane187.BCM8879X=rx187:tx187 + +lane_to_serdes_map_fabric_lane188.BCM8879X=rx188:tx188 +lane_to_serdes_map_fabric_lane189.BCM8879X=rx189:tx189 +lane_to_serdes_map_fabric_lane190.BCM8879X=rx190:tx190 +lane_to_serdes_map_fabric_lane191.BCM8879X=rx191:tx191 + + +phy_rx_polarity_flip_fabric0.BCM8879X=1 +phy_rx_polarity_flip_fabric1.BCM8879X=0 +phy_rx_polarity_flip_fabric2.BCM8879X=1 +phy_rx_polarity_flip_fabric3.BCM8879X=0 + +phy_rx_polarity_flip_fabric4.BCM8879X=0 +phy_rx_polarity_flip_fabric5.BCM8879X=1 +phy_rx_polarity_flip_fabric6.BCM8879X=0 +phy_rx_polarity_flip_fabric7.BCM8879X=1 + +phy_rx_polarity_flip_fabric8.BCM8879X=1 +phy_rx_polarity_flip_fabric9.BCM8879X=0 +phy_rx_polarity_flip_fabric10.BCM8879X=1 +phy_rx_polarity_flip_fabric11.BCM8879X=0 + +phy_rx_polarity_flip_fabric12.BCM8879X=0 +phy_rx_polarity_flip_fabric13.BCM8879X=1 +phy_rx_polarity_flip_fabric14.BCM8879X=0 +phy_rx_polarity_flip_fabric15.BCM8879X=1 + +phy_rx_polarity_flip_fabric16.BCM8879X=1 +phy_rx_polarity_flip_fabric17.BCM8879X=0 +phy_rx_polarity_flip_fabric18.BCM8879X=1 +phy_rx_polarity_flip_fabric19.BCM8879X=0 + +phy_rx_polarity_flip_fabric20.BCM8879X=1 +phy_rx_polarity_flip_fabric21.BCM8879X=0 +phy_rx_polarity_flip_fabric22.BCM8879X=1 +phy_rx_polarity_flip_fabric23.BCM8879X=0 + +phy_rx_polarity_flip_fabric24.BCM8879X=1 +phy_rx_polarity_flip_fabric25.BCM8879X=0 +phy_rx_polarity_flip_fabric26.BCM8879X=1 +phy_rx_polarity_flip_fabric27.BCM8879X=0 + +phy_rx_polarity_flip_fabric28.BCM8879X=0 +phy_rx_polarity_flip_fabric29.BCM8879X=1 +phy_rx_polarity_flip_fabric30.BCM8879X=0 +phy_rx_polarity_flip_fabric31.BCM8879X=1 + +phy_rx_polarity_flip_fabric32.BCM8879X=1 +phy_rx_polarity_flip_fabric33.BCM8879X=0 +phy_rx_polarity_flip_fabric34.BCM8879X=1 +phy_rx_polarity_flip_fabric35.BCM8879X=0 + +phy_rx_polarity_flip_fabric36.BCM8879X=0 +phy_rx_polarity_flip_fabric37.BCM8879X=1 +phy_rx_polarity_flip_fabric38.BCM8879X=0 +phy_rx_polarity_flip_fabric39.BCM8879X=1 + +phy_rx_polarity_flip_fabric40.BCM8879X=1 +phy_rx_polarity_flip_fabric41.BCM8879X=0 +phy_rx_polarity_flip_fabric42.BCM8879X=1 +phy_rx_polarity_flip_fabric43.BCM8879X=0 + +phy_rx_polarity_flip_fabric44.BCM8879X=1 +phy_rx_polarity_flip_fabric45.BCM8879X=0 +phy_rx_polarity_flip_fabric46.BCM8879X=1 +phy_rx_polarity_flip_fabric47.BCM8879X=0 + +phy_rx_polarity_flip_fabric48.BCM8879X=0 +phy_rx_polarity_flip_fabric49.BCM8879X=1 +phy_rx_polarity_flip_fabric50.BCM8879X=0 +phy_rx_polarity_flip_fabric51.BCM8879X=1 + +phy_rx_polarity_flip_fabric52.BCM8879X=1 +phy_rx_polarity_flip_fabric53.BCM8879X=0 +phy_rx_polarity_flip_fabric54.BCM8879X=1 +phy_rx_polarity_flip_fabric55.BCM8879X=0 + +phy_rx_polarity_flip_fabric56.BCM8879X=0 +phy_rx_polarity_flip_fabric57.BCM8879X=1 +phy_rx_polarity_flip_fabric58.BCM8879X=0 +phy_rx_polarity_flip_fabric59.BCM8879X=1 + +phy_rx_polarity_flip_fabric60.BCM8879X=0 +phy_rx_polarity_flip_fabric61.BCM8879X=1 +phy_rx_polarity_flip_fabric62.BCM8879X=0 +phy_rx_polarity_flip_fabric63.BCM8879X=1 + +phy_rx_polarity_flip_fabric64.BCM8879X=1 +phy_rx_polarity_flip_fabric65.BCM8879X=0 +phy_rx_polarity_flip_fabric66.BCM8879X=1 +phy_rx_polarity_flip_fabric67.BCM8879X=0 + +phy_rx_polarity_flip_fabric68.BCM8879X=0 +phy_rx_polarity_flip_fabric69.BCM8879X=1 +phy_rx_polarity_flip_fabric70.BCM8879X=0 +phy_rx_polarity_flip_fabric71.BCM8879X=1 + +phy_rx_polarity_flip_fabric72.BCM8879X=1 +phy_rx_polarity_flip_fabric73.BCM8879X=0 +phy_rx_polarity_flip_fabric74.BCM8879X=1 +phy_rx_polarity_flip_fabric75.BCM8879X=0 + +phy_rx_polarity_flip_fabric76.BCM8879X=1 +phy_rx_polarity_flip_fabric77.BCM8879X=0 +phy_rx_polarity_flip_fabric78.BCM8879X=1 +phy_rx_polarity_flip_fabric79.BCM8879X=0 + +phy_rx_polarity_flip_fabric80.BCM8879X=0 +phy_rx_polarity_flip_fabric81.BCM8879X=1 +phy_rx_polarity_flip_fabric82.BCM8879X=0 +phy_rx_polarity_flip_fabric83.BCM8879X=1 + +phy_rx_polarity_flip_fabric84.BCM8879X=1 +phy_rx_polarity_flip_fabric85.BCM8879X=0 +phy_rx_polarity_flip_fabric86.BCM8879X=1 +phy_rx_polarity_flip_fabric87.BCM8879X=0 + +phy_rx_polarity_flip_fabric88.BCM8879X=0 +phy_rx_polarity_flip_fabric89.BCM8879X=1 +phy_rx_polarity_flip_fabric90.BCM8879X=0 +phy_rx_polarity_flip_fabric91.BCM8879X=1 + +phy_rx_polarity_flip_fabric92.BCM8879X=1 +phy_rx_polarity_flip_fabric93.BCM8879X=0 +phy_rx_polarity_flip_fabric94.BCM8879X=1 +phy_rx_polarity_flip_fabric95.BCM8879X=0 + +phy_rx_polarity_flip_fabric96.BCM8879X=1 +phy_rx_polarity_flip_fabric97.BCM8879X=0 +phy_rx_polarity_flip_fabric98.BCM8879X=1 +phy_rx_polarity_flip_fabric99.BCM8879X=0 + +phy_rx_polarity_flip_fabric100.BCM8879X=0 +phy_rx_polarity_flip_fabric101.BCM8879X=1 +phy_rx_polarity_flip_fabric102.BCM8879X=0 +phy_rx_polarity_flip_fabric103.BCM8879X=1 + +phy_rx_polarity_flip_fabric104.BCM8879X=0 +phy_rx_polarity_flip_fabric105.BCM8879X=1 +phy_rx_polarity_flip_fabric106.BCM8879X=0 +phy_rx_polarity_flip_fabric107.BCM8879X=1 + +phy_rx_polarity_flip_fabric108.BCM8879X=0 +phy_rx_polarity_flip_fabric109.BCM8879X=1 +phy_rx_polarity_flip_fabric110.BCM8879X=0 +phy_rx_polarity_flip_fabric111.BCM8879X=1 + +phy_rx_polarity_flip_fabric112.BCM8879X=0 +phy_rx_polarity_flip_fabric113.BCM8879X=1 +phy_rx_polarity_flip_fabric114.BCM8879X=0 +phy_rx_polarity_flip_fabric115.BCM8879X=1 + +phy_rx_polarity_flip_fabric116.BCM8879X=1 +phy_rx_polarity_flip_fabric117.BCM8879X=0 +phy_rx_polarity_flip_fabric118.BCM8879X=1 +phy_rx_polarity_flip_fabric119.BCM8879X=0 + +phy_rx_polarity_flip_fabric120.BCM8879X=1 +phy_rx_polarity_flip_fabric121.BCM8879X=0 +phy_rx_polarity_flip_fabric122.BCM8879X=1 +phy_rx_polarity_flip_fabric123.BCM8879X=0 + +phy_rx_polarity_flip_fabric124.BCM8879X=0 +phy_rx_polarity_flip_fabric125.BCM8879X=1 +phy_rx_polarity_flip_fabric126.BCM8879X=0 +phy_rx_polarity_flip_fabric127.BCM8879X=1 + +phy_rx_polarity_flip_fabric128.BCM8879X=1 +phy_rx_polarity_flip_fabric129.BCM8879X=0 +phy_rx_polarity_flip_fabric130.BCM8879X=1 +phy_rx_polarity_flip_fabric131.BCM8879X=0 + +phy_rx_polarity_flip_fabric132.BCM8879X=0 +phy_rx_polarity_flip_fabric133.BCM8879X=1 +phy_rx_polarity_flip_fabric134.BCM8879X=0 +phy_rx_polarity_flip_fabric135.BCM8879X=1 + +phy_rx_polarity_flip_fabric136.BCM8879X=1 +phy_rx_polarity_flip_fabric137.BCM8879X=0 +phy_rx_polarity_flip_fabric138.BCM8879X=1 +phy_rx_polarity_flip_fabric139.BCM8879X=0 + +phy_rx_polarity_flip_fabric140.BCM8879X=1 +phy_rx_polarity_flip_fabric141.BCM8879X=0 +phy_rx_polarity_flip_fabric142.BCM8879X=1 +phy_rx_polarity_flip_fabric143.BCM8879X=0 + +phy_rx_polarity_flip_fabric144.BCM8879X=1 +phy_rx_polarity_flip_fabric145.BCM8879X=0 +phy_rx_polarity_flip_fabric146.BCM8879X=1 +phy_rx_polarity_flip_fabric147.BCM8879X=0 + +phy_rx_polarity_flip_fabric148.BCM8879X=1 +phy_rx_polarity_flip_fabric149.BCM8879X=0 +phy_rx_polarity_flip_fabric150.BCM8879X=1 +phy_rx_polarity_flip_fabric151.BCM8879X=0 + +phy_rx_polarity_flip_fabric152.BCM8879X=0 +phy_rx_polarity_flip_fabric153.BCM8879X=1 +phy_rx_polarity_flip_fabric154.BCM8879X=0 +phy_rx_polarity_flip_fabric155.BCM8879X=1 + +phy_rx_polarity_flip_fabric156.BCM8879X=1 +phy_rx_polarity_flip_fabric157.BCM8879X=0 +phy_rx_polarity_flip_fabric158.BCM8879X=1 +phy_rx_polarity_flip_fabric159.BCM8879X=0 + +phy_rx_polarity_flip_fabric160.BCM8879X=1 +phy_rx_polarity_flip_fabric161.BCM8879X=0 +phy_rx_polarity_flip_fabric162.BCM8879X=1 +phy_rx_polarity_flip_fabric163.BCM8879X=0 + +phy_rx_polarity_flip_fabric164.BCM8879X=0 +phy_rx_polarity_flip_fabric165.BCM8879X=1 +phy_rx_polarity_flip_fabric166.BCM8879X=0 +phy_rx_polarity_flip_fabric167.BCM8879X=1 + +phy_rx_polarity_flip_fabric168.BCM8879X=1 +phy_rx_polarity_flip_fabric169.BCM8879X=0 +phy_rx_polarity_flip_fabric170.BCM8879X=1 +phy_rx_polarity_flip_fabric171.BCM8879X=0 + +phy_rx_polarity_flip_fabric172.BCM8879X=1 +phy_rx_polarity_flip_fabric173.BCM8879X=0 +phy_rx_polarity_flip_fabric174.BCM8879X=1 +phy_rx_polarity_flip_fabric175.BCM8879X=0 + +phy_rx_polarity_flip_fabric176.BCM8879X=0 +phy_rx_polarity_flip_fabric177.BCM8879X=1 +phy_rx_polarity_flip_fabric178.BCM8879X=0 +phy_rx_polarity_flip_fabric179.BCM8879X=1 + +phy_rx_polarity_flip_fabric180.BCM8879X=1 +phy_rx_polarity_flip_fabric181.BCM8879X=0 +phy_rx_polarity_flip_fabric182.BCM8879X=1 +phy_rx_polarity_flip_fabric183.BCM8879X=0 + +phy_rx_polarity_flip_fabric184.BCM8879X=0 +phy_rx_polarity_flip_fabric185.BCM8879X=1 +phy_rx_polarity_flip_fabric186.BCM8879X=0 +phy_rx_polarity_flip_fabric187.BCM8879X=1 + +phy_rx_polarity_flip_fabric188.BCM8879X=1 +phy_rx_polarity_flip_fabric189.BCM8879X=0 +phy_rx_polarity_flip_fabric190.BCM8879X=1 +phy_rx_polarity_flip_fabric191.BCM8879X=0 + +phy_tx_polarity_flip_fabric0.BCM8879X=0 +phy_tx_polarity_flip_fabric1.BCM8879X=1 +phy_tx_polarity_flip_fabric2.BCM8879X=0 +phy_tx_polarity_flip_fabric3.BCM8879X=1 + +phy_tx_polarity_flip_fabric4.BCM8879X=1 +phy_tx_polarity_flip_fabric5.BCM8879X=0 +phy_tx_polarity_flip_fabric6.BCM8879X=1 +phy_tx_polarity_flip_fabric7.BCM8879X=0 + +phy_tx_polarity_flip_fabric8.BCM8879X=0 +phy_tx_polarity_flip_fabric9.BCM8879X=1 +phy_tx_polarity_flip_fabric10.BCM8879X=0 +phy_tx_polarity_flip_fabric11.BCM8879X=1 + +phy_tx_polarity_flip_fabric12.BCM8879X=1 +phy_tx_polarity_flip_fabric13.BCM8879X=0 +phy_tx_polarity_flip_fabric14.BCM8879X=1 +phy_tx_polarity_flip_fabric15.BCM8879X=0 + +phy_tx_polarity_flip_fabric16.BCM8879X=0 +phy_tx_polarity_flip_fabric17.BCM8879X=1 +phy_tx_polarity_flip_fabric18.BCM8879X=0 +phy_tx_polarity_flip_fabric19.BCM8879X=1 + +phy_tx_polarity_flip_fabric20.BCM8879X=0 +phy_tx_polarity_flip_fabric21.BCM8879X=1 +phy_tx_polarity_flip_fabric22.BCM8879X=0 +phy_tx_polarity_flip_fabric23.BCM8879X=1 + +phy_tx_polarity_flip_fabric24.BCM8879X=0 +phy_tx_polarity_flip_fabric25.BCM8879X=1 +phy_tx_polarity_flip_fabric26.BCM8879X=0 +phy_tx_polarity_flip_fabric27.BCM8879X=1 + +phy_tx_polarity_flip_fabric28.BCM8879X=1 +phy_tx_polarity_flip_fabric29.BCM8879X=0 +phy_tx_polarity_flip_fabric30.BCM8879X=1 +phy_tx_polarity_flip_fabric31.BCM8879X=0 + +phy_tx_polarity_flip_fabric32.BCM8879X=0 +phy_tx_polarity_flip_fabric33.BCM8879X=1 +phy_tx_polarity_flip_fabric34.BCM8879X=0 +phy_tx_polarity_flip_fabric35.BCM8879X=1 + +phy_tx_polarity_flip_fabric36.BCM8879X=1 +phy_tx_polarity_flip_fabric37.BCM8879X=0 +phy_tx_polarity_flip_fabric38.BCM8879X=1 +phy_tx_polarity_flip_fabric39.BCM8879X=0 + +phy_tx_polarity_flip_fabric40.BCM8879X=0 +phy_tx_polarity_flip_fabric41.BCM8879X=1 +phy_tx_polarity_flip_fabric42.BCM8879X=0 +phy_tx_polarity_flip_fabric43.BCM8879X=1 + +phy_tx_polarity_flip_fabric44.BCM8879X=0 +phy_tx_polarity_flip_fabric45.BCM8879X=1 +phy_tx_polarity_flip_fabric46.BCM8879X=0 +phy_tx_polarity_flip_fabric47.BCM8879X=1 + +phy_tx_polarity_flip_fabric48.BCM8879X=1 +phy_tx_polarity_flip_fabric49.BCM8879X=0 +phy_tx_polarity_flip_fabric50.BCM8879X=1 +phy_tx_polarity_flip_fabric51.BCM8879X=0 + +phy_tx_polarity_flip_fabric52.BCM8879X=0 +phy_tx_polarity_flip_fabric53.BCM8879X=1 +phy_tx_polarity_flip_fabric54.BCM8879X=0 +phy_tx_polarity_flip_fabric55.BCM8879X=1 + +phy_tx_polarity_flip_fabric56.BCM8879X=1 +phy_tx_polarity_flip_fabric57.BCM8879X=0 +phy_tx_polarity_flip_fabric58.BCM8879X=1 +phy_tx_polarity_flip_fabric59.BCM8879X=0 + +phy_tx_polarity_flip_fabric60.BCM8879X=1 +phy_tx_polarity_flip_fabric61.BCM8879X=0 +phy_tx_polarity_flip_fabric62.BCM8879X=1 +phy_tx_polarity_flip_fabric63.BCM8879X=0 + +phy_tx_polarity_flip_fabric64.BCM8879X=0 +phy_tx_polarity_flip_fabric65.BCM8879X=1 +phy_tx_polarity_flip_fabric66.BCM8879X=0 +phy_tx_polarity_flip_fabric67.BCM8879X=1 + +phy_tx_polarity_flip_fabric68.BCM8879X=1 +phy_tx_polarity_flip_fabric69.BCM8879X=0 +phy_tx_polarity_flip_fabric70.BCM8879X=1 +phy_tx_polarity_flip_fabric71.BCM8879X=0 + +phy_tx_polarity_flip_fabric72.BCM8879X=0 +phy_tx_polarity_flip_fabric73.BCM8879X=1 +phy_tx_polarity_flip_fabric74.BCM8879X=0 +phy_tx_polarity_flip_fabric75.BCM8879X=1 + +phy_tx_polarity_flip_fabric76.BCM8879X=0 +phy_tx_polarity_flip_fabric77.BCM8879X=1 +phy_tx_polarity_flip_fabric78.BCM8879X=0 +phy_tx_polarity_flip_fabric79.BCM8879X=1 + +phy_tx_polarity_flip_fabric80.BCM8879X=1 +phy_tx_polarity_flip_fabric81.BCM8879X=0 +phy_tx_polarity_flip_fabric82.BCM8879X=1 +phy_tx_polarity_flip_fabric83.BCM8879X=0 + +phy_tx_polarity_flip_fabric84.BCM8879X=0 +phy_tx_polarity_flip_fabric85.BCM8879X=1 +phy_tx_polarity_flip_fabric86.BCM8879X=0 +phy_tx_polarity_flip_fabric87.BCM8879X=1 + +phy_tx_polarity_flip_fabric88.BCM8879X=1 +phy_tx_polarity_flip_fabric89.BCM8879X=0 +phy_tx_polarity_flip_fabric90.BCM8879X=1 +phy_tx_polarity_flip_fabric91.BCM8879X=0 + +phy_tx_polarity_flip_fabric92.BCM8879X=0 +phy_tx_polarity_flip_fabric93.BCM8879X=1 +phy_tx_polarity_flip_fabric94.BCM8879X=0 +phy_tx_polarity_flip_fabric95.BCM8879X=1 + +phy_tx_polarity_flip_fabric96.BCM8879X=0 +phy_tx_polarity_flip_fabric97.BCM8879X=1 +phy_tx_polarity_flip_fabric98.BCM8879X=0 +phy_tx_polarity_flip_fabric99.BCM8879X=1 + +phy_tx_polarity_flip_fabric100.BCM8879X=1 +phy_tx_polarity_flip_fabric101.BCM8879X=0 +phy_tx_polarity_flip_fabric102.BCM8879X=1 +phy_tx_polarity_flip_fabric103.BCM8879X=0 + +phy_tx_polarity_flip_fabric104.BCM8879X=1 +phy_tx_polarity_flip_fabric105.BCM8879X=0 +phy_tx_polarity_flip_fabric106.BCM8879X=1 +phy_tx_polarity_flip_fabric107.BCM8879X=0 + +phy_tx_polarity_flip_fabric108.BCM8879X=1 +phy_tx_polarity_flip_fabric109.BCM8879X=0 +phy_tx_polarity_flip_fabric110.BCM8879X=1 +phy_tx_polarity_flip_fabric111.BCM8879X=0 + +phy_tx_polarity_flip_fabric112.BCM8879X=1 +phy_tx_polarity_flip_fabric113.BCM8879X=0 +phy_tx_polarity_flip_fabric114.BCM8879X=1 +phy_tx_polarity_flip_fabric115.BCM8879X=0 + +phy_tx_polarity_flip_fabric116.BCM8879X=0 +phy_tx_polarity_flip_fabric117.BCM8879X=1 +phy_tx_polarity_flip_fabric118.BCM8879X=0 +phy_tx_polarity_flip_fabric119.BCM8879X=1 + +phy_tx_polarity_flip_fabric120.BCM8879X=0 +phy_tx_polarity_flip_fabric121.BCM8879X=1 +phy_tx_polarity_flip_fabric122.BCM8879X=0 +phy_tx_polarity_flip_fabric123.BCM8879X=1 + +phy_tx_polarity_flip_fabric124.BCM8879X=1 +phy_tx_polarity_flip_fabric125.BCM8879X=0 +phy_tx_polarity_flip_fabric126.BCM8879X=1 +phy_tx_polarity_flip_fabric127.BCM8879X=0 + +phy_tx_polarity_flip_fabric128.BCM8879X=0 +phy_tx_polarity_flip_fabric129.BCM8879X=1 +phy_tx_polarity_flip_fabric130.BCM8879X=0 +phy_tx_polarity_flip_fabric131.BCM8879X=1 + +phy_tx_polarity_flip_fabric132.BCM8879X=1 +phy_tx_polarity_flip_fabric133.BCM8879X=0 +phy_tx_polarity_flip_fabric134.BCM8879X=1 +phy_tx_polarity_flip_fabric135.BCM8879X=0 + +phy_tx_polarity_flip_fabric136.BCM8879X=0 +phy_tx_polarity_flip_fabric137.BCM8879X=1 +phy_tx_polarity_flip_fabric138.BCM8879X=0 +phy_tx_polarity_flip_fabric139.BCM8879X=1 + +phy_tx_polarity_flip_fabric140.BCM8879X=0 +phy_tx_polarity_flip_fabric141.BCM8879X=1 +phy_tx_polarity_flip_fabric142.BCM8879X=0 +phy_tx_polarity_flip_fabric143.BCM8879X=1 + +phy_tx_polarity_flip_fabric144.BCM8879X=0 +phy_tx_polarity_flip_fabric145.BCM8879X=1 +phy_tx_polarity_flip_fabric146.BCM8879X=0 +phy_tx_polarity_flip_fabric147.BCM8879X=1 + +phy_tx_polarity_flip_fabric148.BCM8879X=0 +phy_tx_polarity_flip_fabric149.BCM8879X=1 +phy_tx_polarity_flip_fabric150.BCM8879X=0 +phy_tx_polarity_flip_fabric151.BCM8879X=1 + +phy_tx_polarity_flip_fabric152.BCM8879X=1 +phy_tx_polarity_flip_fabric153.BCM8879X=0 +phy_tx_polarity_flip_fabric154.BCM8879X=1 +phy_tx_polarity_flip_fabric155.BCM8879X=0 + +phy_tx_polarity_flip_fabric156.BCM8879X=0 +phy_tx_polarity_flip_fabric157.BCM8879X=1 +phy_tx_polarity_flip_fabric158.BCM8879X=0 +phy_tx_polarity_flip_fabric159.BCM8879X=1 + +phy_tx_polarity_flip_fabric160.BCM8879X=0 +phy_tx_polarity_flip_fabric161.BCM8879X=1 +phy_tx_polarity_flip_fabric162.BCM8879X=0 +phy_tx_polarity_flip_fabric163.BCM8879X=1 + +phy_tx_polarity_flip_fabric164.BCM8879X=1 +phy_tx_polarity_flip_fabric165.BCM8879X=0 +phy_tx_polarity_flip_fabric166.BCM8879X=1 +phy_tx_polarity_flip_fabric167.BCM8879X=0 + +phy_tx_polarity_flip_fabric168.BCM8879X=0 +phy_tx_polarity_flip_fabric169.BCM8879X=1 +phy_tx_polarity_flip_fabric170.BCM8879X=0 +phy_tx_polarity_flip_fabric171.BCM8879X=1 + +phy_tx_polarity_flip_fabric172.BCM8879X=0 +phy_tx_polarity_flip_fabric173.BCM8879X=1 +phy_tx_polarity_flip_fabric174.BCM8879X=0 +phy_tx_polarity_flip_fabric175.BCM8879X=1 + +phy_tx_polarity_flip_fabric176.BCM8879X=1 +phy_tx_polarity_flip_fabric177.BCM8879X=0 +phy_tx_polarity_flip_fabric178.BCM8879X=1 +phy_tx_polarity_flip_fabric179.BCM8879X=0 + +phy_tx_polarity_flip_fabric180.BCM8879X=0 +phy_tx_polarity_flip_fabric181.BCM8879X=1 +phy_tx_polarity_flip_fabric182.BCM8879X=0 +phy_tx_polarity_flip_fabric183.BCM8879X=1 + +phy_tx_polarity_flip_fabric184.BCM8879X=1 +phy_tx_polarity_flip_fabric185.BCM8879X=0 +phy_tx_polarity_flip_fabric186.BCM8879X=1 +phy_tx_polarity_flip_fabric187.BCM8879X=0 + +phy_tx_polarity_flip_fabric188.BCM8879X=0 +phy_tx_polarity_flip_fabric189.BCM8879X=1 +phy_tx_polarity_flip_fabric190.BCM8879X=0 +phy_tx_polarity_flip_fabric191.BCM8879X=1 + +port_init_cl72_0=0 +port_init_cl72_1=0 +port_init_cl72_2=0 +port_init_cl72_3=0 +port_init_cl72_4=0 +port_init_cl72_5=0 +port_init_cl72_6=0 +port_init_cl72_7=0 +port_init_cl72_8=0 +port_init_cl72_9=0 +port_init_cl72_10=0 +port_init_cl72_11=0 +port_init_cl72_12=0 +port_init_cl72_13=0 +port_init_cl72_14=0 +port_init_cl72_15=0 +port_init_cl72_16=0 +port_init_cl72_17=0 +port_init_cl72_18=0 +port_init_cl72_19=0 +port_init_cl72_20=0 +port_init_cl72_21=0 +port_init_cl72_22=0 +port_init_cl72_23=0 +port_init_cl72_24=0 +port_init_cl72_25=0 +port_init_cl72_26=0 +port_init_cl72_27=0 +port_init_cl72_28=0 +port_init_cl72_29=0 +port_init_cl72_30=0 +port_init_cl72_31=0 +port_init_cl72_32=0 +port_init_cl72_33=0 +port_init_cl72_34=0 +port_init_cl72_35=0 +port_init_cl72_36=0 +port_init_cl72_37=0 +port_init_cl72_38=0 +port_init_cl72_39=0 +port_init_cl72_40=0 +port_init_cl72_41=0 +port_init_cl72_42=0 +port_init_cl72_43=0 +port_init_cl72_44=0 +port_init_cl72_45=0 +port_init_cl72_46=0 +port_init_cl72_47=0 +port_init_cl72_48=0 +port_init_cl72_49=0 +port_init_cl72_50=0 +port_init_cl72_51=0 +port_init_cl72_52=0 +port_init_cl72_53=0 +port_init_cl72_54=0 +port_init_cl72_55=0 +port_init_cl72_56=0 +port_init_cl72_57=0 +port_init_cl72_58=0 +port_init_cl72_59=0 +port_init_cl72_60=0 +port_init_cl72_61=0 +port_init_cl72_62=0 +port_init_cl72_63=0 +port_init_cl72_64=0 +port_init_cl72_65=0 +port_init_cl72_66=0 +port_init_cl72_67=0 +port_init_cl72_68=0 +port_init_cl72_69=0 +port_init_cl72_70=0 +port_init_cl72_71=0 +port_init_cl72_72=0 +port_init_cl72_73=0 +port_init_cl72_74=0 +port_init_cl72_75=0 +port_init_cl72_76=0 +port_init_cl72_77=0 +port_init_cl72_78=0 +port_init_cl72_79=0 +port_init_cl72_80=0 +port_init_cl72_81=0 +port_init_cl72_82=0 +port_init_cl72_83=0 +port_init_cl72_84=0 +port_init_cl72_85=0 +port_init_cl72_86=0 +port_init_cl72_87=0 +port_init_cl72_88=0 +port_init_cl72_89=0 +port_init_cl72_90=0 +port_init_cl72_91=0 +port_init_cl72_92=0 +port_init_cl72_93=0 +port_init_cl72_94=0 +port_init_cl72_95=0 +port_init_cl72_96=0 +port_init_cl72_97=0 +port_init_cl72_98=0 +port_init_cl72_99=0 +port_init_cl72_100=0 +port_init_cl72_101=0 +port_init_cl72_102=0 +port_init_cl72_103=0 +port_init_cl72_104=0 +port_init_cl72_105=0 +port_init_cl72_106=0 +port_init_cl72_107=0 +port_init_cl72_108=0 +port_init_cl72_109=0 +port_init_cl72_110=0 +port_init_cl72_111=0 +port_init_cl72_112=0 +port_init_cl72_113=0 +port_init_cl72_114=0 +port_init_cl72_115=0 +port_init_cl72_116=0 +port_init_cl72_117=0 +port_init_cl72_118=0 +port_init_cl72_119=0 +port_init_cl72_120=0 +port_init_cl72_121=0 +port_init_cl72_122=0 +port_init_cl72_123=0 +port_init_cl72_124=0 +port_init_cl72_125=0 +port_init_cl72_126=0 +port_init_cl72_127=0 +port_init_cl72_128=0 +port_init_cl72_129=0 +port_init_cl72_130=0 +port_init_cl72_131=0 +port_init_cl72_132=0 +port_init_cl72_133=0 +port_init_cl72_134=0 +port_init_cl72_135=0 +port_init_cl72_136=0 +port_init_cl72_137=0 +port_init_cl72_138=0 +port_init_cl72_139=0 +port_init_cl72_140=0 +port_init_cl72_141=0 +port_init_cl72_142=0 +port_init_cl72_143=0 +port_init_cl72_144=0 +port_init_cl72_145=0 +port_init_cl72_146=0 +port_init_cl72_147=0 +port_init_cl72_148=0 +port_init_cl72_149=0 +port_init_cl72_150=0 +port_init_cl72_151=0 +port_init_cl72_152=0 +port_init_cl72_153=0 +port_init_cl72_154=0 +port_init_cl72_155=0 +port_init_cl72_156=0 +port_init_cl72_157=0 +port_init_cl72_158=0 +port_init_cl72_159=0 +port_init_cl72_160=0 +port_init_cl72_161=0 +port_init_cl72_162=0 +port_init_cl72_163=0 +port_init_cl72_164=0 +port_init_cl72_165=0 +port_init_cl72_166=0 +port_init_cl72_167=0 +port_init_cl72_168=0 +port_init_cl72_169=0 +port_init_cl72_170=0 +port_init_cl72_171=0 +port_init_cl72_172=0 +port_init_cl72_173=0 +port_init_cl72_174=0 +port_init_cl72_175=0 +port_init_cl72_176=0 +port_init_cl72_177=0 +port_init_cl72_178=0 +port_init_cl72_179=0 +port_init_cl72_180=0 +port_init_cl72_181=0 +port_init_cl72_182=0 +port_init_cl72_183=0 +port_init_cl72_184=0 +port_init_cl72_185=0 +port_init_cl72_186=0 +port_init_cl72_187=0 +port_init_cl72_188=0 +port_init_cl72_189=0 +port_init_cl72_190=0 +port_init_cl72_191=0 + +serdes_tx_taps_0.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_1.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_2.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_3.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_4.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_5.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_6.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_7.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_8.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_9.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_10.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_11.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_12.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_13.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_14.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_15.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_16.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_17.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_18.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_19.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_20.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_21.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_22.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_23.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_24.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_25.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_26.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_27.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_28.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_29.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_30.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_31.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_32.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_33.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_34.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_35.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_36.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_37.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_38.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_39.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_40.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_41.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_42.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_43.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_44.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_45.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_46.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_47.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_48.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_49.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_50.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_51.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_52.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_53.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_54.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_55.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_56.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_57.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_58.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_59.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_60.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_61.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_62.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_63.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_64.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_65.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_66.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_67.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_68.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_69.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_70.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_71.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_72.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_73.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_74.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_75.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_76.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_77.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_78.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_79.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_80.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_81.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_82.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_83.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_84.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_85.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_86.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_87.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_88.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_89.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_90.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_91.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_92.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_93.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_94.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_95.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_96.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_97.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_98.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_99.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_100.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_101.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_102.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_103.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_104.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_105.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_106.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_107.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_108.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_109.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_110.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_111.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_112.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_113.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_114.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_115.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_116.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_117.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_118.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_119.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_120.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_121.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_122.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_123.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_124.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_125.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_126.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_127.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_128.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_129.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_130.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_131.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_132.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_133.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_134.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_135.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_136.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_137.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_138.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_139.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_140.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_141.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_142.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_143.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_144.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_145.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_146.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_147.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_148.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_149.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_150.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_151.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_152.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_153.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_154.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_155.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_156.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_157.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_158.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_159.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_160.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_161.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_162.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_163.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_164.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_165.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_166.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_167.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_168.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_169.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_170.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_171.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_172.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_173.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_174.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_175.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_176.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_177.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_178.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_179.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_180.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_181.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_182.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_183.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_184.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_185.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_186.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_187.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_188.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_189.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_190.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_191.BCM8879X=pam4:-24:132:-12:0:0:0 + +serdes_lane_config_channel_mode_0.0=force_nr +serdes_lane_config_channel_mode_1.0=force_nr +serdes_lane_config_channel_mode_2.0=force_nr +serdes_lane_config_channel_mode_3.0=force_nr +serdes_lane_config_channel_mode_4.0=force_nr +serdes_lane_config_channel_mode_5.0=force_nr +serdes_lane_config_channel_mode_6.0=force_nr +serdes_lane_config_channel_mode_7.0=force_nr +serdes_lane_config_channel_mode_8.0=force_nr +serdes_lane_config_channel_mode_9.0=force_nr +serdes_lane_config_channel_mode_10.0=force_nr +serdes_lane_config_channel_mode_11.0=force_nr +serdes_lane_config_channel_mode_12.0=force_nr +serdes_lane_config_channel_mode_13.0=force_nr +serdes_lane_config_channel_mode_14.0=force_nr +serdes_lane_config_channel_mode_15.0=force_nr +serdes_lane_config_channel_mode_16.0=force_nr +serdes_lane_config_channel_mode_17.0=force_nr +serdes_lane_config_channel_mode_18.0=force_nr +serdes_lane_config_channel_mode_19.0=force_nr +serdes_lane_config_channel_mode_20.0=force_nr +serdes_lane_config_channel_mode_21.0=force_nr +serdes_lane_config_channel_mode_22.0=force_nr +serdes_lane_config_channel_mode_23.0=force_nr +serdes_lane_config_channel_mode_24.0=force_nr +serdes_lane_config_channel_mode_25.0=force_nr +serdes_lane_config_channel_mode_26.0=force_nr +serdes_lane_config_channel_mode_27.0=force_nr +serdes_lane_config_channel_mode_28.0=force_nr +serdes_lane_config_channel_mode_29.0=force_nr +serdes_lane_config_channel_mode_30.0=force_nr +serdes_lane_config_channel_mode_31.0=force_nr +serdes_lane_config_channel_mode_32.0=force_nr +serdes_lane_config_channel_mode_33.0=force_nr +serdes_lane_config_channel_mode_34.0=force_nr +serdes_lane_config_channel_mode_35.0=force_nr +serdes_lane_config_channel_mode_36.0=force_nr +serdes_lane_config_channel_mode_37.0=force_nr +serdes_lane_config_channel_mode_38.0=force_nr +serdes_lane_config_channel_mode_39.0=force_nr +serdes_lane_config_channel_mode_40.0=force_nr +serdes_lane_config_channel_mode_41.0=force_nr +serdes_lane_config_channel_mode_42.0=force_nr +serdes_lane_config_channel_mode_43.0=force_nr +serdes_lane_config_channel_mode_44.0=force_nr +serdes_lane_config_channel_mode_45.0=force_nr +serdes_lane_config_channel_mode_46.0=force_nr +serdes_lane_config_channel_mode_47.0=force_nr +serdes_lane_config_channel_mode_48.0=force_nr +serdes_lane_config_channel_mode_49.0=force_nr +serdes_lane_config_channel_mode_50.0=force_nr +serdes_lane_config_channel_mode_51.0=force_nr +serdes_lane_config_channel_mode_52.0=force_nr +serdes_lane_config_channel_mode_53.0=force_nr +serdes_lane_config_channel_mode_54.0=force_nr +serdes_lane_config_channel_mode_55.0=force_nr +serdes_lane_config_channel_mode_56.0=force_nr +serdes_lane_config_channel_mode_57.0=force_nr +serdes_lane_config_channel_mode_58.0=force_nr +serdes_lane_config_channel_mode_59.0=force_nr +serdes_lane_config_channel_mode_60.0=force_nr +serdes_lane_config_channel_mode_61.0=force_nr +serdes_lane_config_channel_mode_62.0=force_nr +serdes_lane_config_channel_mode_63.0=force_nr +serdes_lane_config_channel_mode_64.0=force_nr +serdes_lane_config_channel_mode_65.0=force_nr +serdes_lane_config_channel_mode_66.0=force_nr +serdes_lane_config_channel_mode_67.0=force_nr +serdes_lane_config_channel_mode_68.0=force_nr +serdes_lane_config_channel_mode_69.0=force_nr +serdes_lane_config_channel_mode_70.0=force_nr +serdes_lane_config_channel_mode_71.0=force_nr +serdes_lane_config_channel_mode_72.0=force_nr +serdes_lane_config_channel_mode_73.0=force_nr +serdes_lane_config_channel_mode_74.0=force_nr +serdes_lane_config_channel_mode_75.0=force_nr +serdes_lane_config_channel_mode_76.0=force_nr +serdes_lane_config_channel_mode_77.0=force_nr +serdes_lane_config_channel_mode_78.0=force_nr +serdes_lane_config_channel_mode_79.0=force_nr +serdes_lane_config_channel_mode_80.0=force_nr +serdes_lane_config_channel_mode_81.0=force_nr +serdes_lane_config_channel_mode_82.0=force_nr +serdes_lane_config_channel_mode_83.0=force_nr +serdes_lane_config_channel_mode_84.0=force_nr +serdes_lane_config_channel_mode_85.0=force_nr +serdes_lane_config_channel_mode_86.0=force_nr +serdes_lane_config_channel_mode_87.0=force_nr +serdes_lane_config_channel_mode_88.0=force_nr +serdes_lane_config_channel_mode_89.0=force_nr +serdes_lane_config_channel_mode_90.0=force_nr +serdes_lane_config_channel_mode_91.0=force_nr +serdes_lane_config_channel_mode_92.0=force_nr +serdes_lane_config_channel_mode_93.0=force_nr +serdes_lane_config_channel_mode_94.0=force_nr +serdes_lane_config_channel_mode_95.0=force_nr +serdes_lane_config_channel_mode_96.0=force_nr +serdes_lane_config_channel_mode_97.0=force_nr +serdes_lane_config_channel_mode_98.0=force_nr +serdes_lane_config_channel_mode_99.0=force_nr +serdes_lane_config_channel_mode_100.0=force_nr +serdes_lane_config_channel_mode_101.0=force_nr +serdes_lane_config_channel_mode_102.0=force_nr +serdes_lane_config_channel_mode_103.0=force_nr +serdes_lane_config_channel_mode_104.0=force_nr +serdes_lane_config_channel_mode_105.0=force_nr +serdes_lane_config_channel_mode_106.0=force_nr +serdes_lane_config_channel_mode_107.0=force_nr +serdes_lane_config_channel_mode_108.0=force_nr +serdes_lane_config_channel_mode_109.0=force_nr +serdes_lane_config_channel_mode_110.0=force_nr +serdes_lane_config_channel_mode_111.0=force_nr +serdes_lane_config_channel_mode_112.0=force_nr +serdes_lane_config_channel_mode_113.0=force_nr +serdes_lane_config_channel_mode_114.0=force_nr +serdes_lane_config_channel_mode_115.0=force_nr +serdes_lane_config_channel_mode_116.0=force_nr +serdes_lane_config_channel_mode_117.0=force_nr +serdes_lane_config_channel_mode_118.0=force_nr +serdes_lane_config_channel_mode_119.0=force_nr +serdes_lane_config_channel_mode_120.0=force_nr +serdes_lane_config_channel_mode_121.0=force_nr +serdes_lane_config_channel_mode_122.0=force_nr +serdes_lane_config_channel_mode_123.0=force_nr +serdes_lane_config_channel_mode_124.0=force_nr +serdes_lane_config_channel_mode_125.0=force_nr +serdes_lane_config_channel_mode_126.0=force_nr +serdes_lane_config_channel_mode_127.0=force_nr +serdes_lane_config_channel_mode_128.0=force_nr +serdes_lane_config_channel_mode_129.0=force_nr +serdes_lane_config_channel_mode_130.0=force_nr +serdes_lane_config_channel_mode_131.0=force_nr +serdes_lane_config_channel_mode_132.0=force_nr +serdes_lane_config_channel_mode_133.0=force_nr +serdes_lane_config_channel_mode_134.0=force_nr +serdes_lane_config_channel_mode_135.0=force_nr +serdes_lane_config_channel_mode_136.0=force_nr +serdes_lane_config_channel_mode_137.0=force_nr +serdes_lane_config_channel_mode_138.0=force_nr +serdes_lane_config_channel_mode_139.0=force_nr +serdes_lane_config_channel_mode_140.0=force_nr +serdes_lane_config_channel_mode_141.0=force_nr +serdes_lane_config_channel_mode_142.0=force_nr +serdes_lane_config_channel_mode_143.0=force_nr +serdes_lane_config_channel_mode_144.0=force_nr +serdes_lane_config_channel_mode_145.0=force_nr +serdes_lane_config_channel_mode_146.0=force_nr +serdes_lane_config_channel_mode_147.0=force_nr +serdes_lane_config_channel_mode_148.0=force_nr +serdes_lane_config_channel_mode_149.0=force_nr +serdes_lane_config_channel_mode_150.0=force_nr +serdes_lane_config_channel_mode_151.0=force_nr +serdes_lane_config_channel_mode_152.0=force_nr +serdes_lane_config_channel_mode_153.0=force_nr +serdes_lane_config_channel_mode_154.0=force_nr +serdes_lane_config_channel_mode_155.0=force_nr +serdes_lane_config_channel_mode_156.0=force_nr +serdes_lane_config_channel_mode_157.0=force_nr +serdes_lane_config_channel_mode_158.0=force_nr +serdes_lane_config_channel_mode_159.0=force_nr +serdes_lane_config_channel_mode_160.0=force_nr +serdes_lane_config_channel_mode_161.0=force_nr +serdes_lane_config_channel_mode_162.0=force_nr +serdes_lane_config_channel_mode_163.0=force_nr +serdes_lane_config_channel_mode_164.0=force_nr +serdes_lane_config_channel_mode_165.0=force_nr +serdes_lane_config_channel_mode_166.0=force_nr +serdes_lane_config_channel_mode_167.0=force_nr +serdes_lane_config_channel_mode_168.0=force_nr +serdes_lane_config_channel_mode_169.0=force_nr +serdes_lane_config_channel_mode_170.0=force_nr +serdes_lane_config_channel_mode_171.0=force_nr +serdes_lane_config_channel_mode_172.0=force_nr +serdes_lane_config_channel_mode_173.0=force_nr +serdes_lane_config_channel_mode_174.0=force_nr +serdes_lane_config_channel_mode_175.0=force_nr +serdes_lane_config_channel_mode_176.0=force_nr +serdes_lane_config_channel_mode_177.0=force_nr +serdes_lane_config_channel_mode_178.0=force_nr +serdes_lane_config_channel_mode_179.0=force_nr +serdes_lane_config_channel_mode_180.0=force_nr +serdes_lane_config_channel_mode_181.0=force_nr +serdes_lane_config_channel_mode_182.0=force_nr +serdes_lane_config_channel_mode_183.0=force_nr +serdes_lane_config_channel_mode_184.0=force_nr +serdes_lane_config_channel_mode_185.0=force_nr +serdes_lane_config_channel_mode_186.0=force_nr +serdes_lane_config_channel_mode_187.0=force_nr +serdes_lane_config_channel_mode_188.0=force_nr +serdes_lane_config_channel_mode_189.0=force_nr +serdes_lane_config_channel_mode_190.0=force_nr +serdes_lane_config_channel_mode_191.0=force_nr + + +serdes_qrtt_active_0.0=1 +serdes_qrtt_active_1.0=1 +serdes_qrtt_active_2.0=1 +serdes_qrtt_active_3.0=1 +serdes_qrtt_active_4.0=1 +serdes_qrtt_active_5.0=1 +serdes_qrtt_active_6.0=1 +serdes_qrtt_active_7.0=1 +serdes_qrtt_active_8.0=1 +serdes_qrtt_active_9.0=1 +serdes_qrtt_active_10.0=1 +serdes_qrtt_active_11.0=1 +serdes_qrtt_active_12.0=1 +serdes_qrtt_active_13.0=1 +serdes_qrtt_active_14.0=1 +serdes_qrtt_active_15.0=1 +serdes_qrtt_active_16.0=1 +serdes_qrtt_active_17.0=1 +serdes_qrtt_active_18.0=1 +serdes_qrtt_active_19.0=1 +serdes_qrtt_active_20.0=1 +serdes_qrtt_active_21.0=1 +serdes_qrtt_active_22.0=1 +serdes_qrtt_active_23.0=1 +serdes_qrtt_active_24.0=1 +serdes_qrtt_active_25.0=1 +serdes_qrtt_active_26.0=1 +serdes_qrtt_active_27.0=1 +serdes_qrtt_active_28.0=1 +serdes_qrtt_active_29.0=1 +serdes_qrtt_active_30.0=1 +serdes_qrtt_active_31.0=1 +serdes_qrtt_active_32.0=1 +serdes_qrtt_active_33.0=1 +serdes_qrtt_active_34.0=1 +serdes_qrtt_active_35.0=1 +serdes_qrtt_active_36.0=1 +serdes_qrtt_active_37.0=1 +serdes_qrtt_active_38.0=1 +serdes_qrtt_active_39.0=1 +serdes_qrtt_active_40.0=1 +serdes_qrtt_active_41.0=1 +serdes_qrtt_active_42.0=1 +serdes_qrtt_active_43.0=1 +serdes_qrtt_active_44.0=1 +serdes_qrtt_active_45.0=1 +serdes_qrtt_active_46.0=1 +serdes_qrtt_active_47.0=1 diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/5/config-ramon-3-1.bcm b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/5/config-ramon-3-1.bcm new file mode 100644 index 000000000000..cd94ed157c46 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/5/config-ramon-3-1.bcm @@ -0,0 +1,1395 @@ + +appl_enable_intr_init.BCM8879X=0 +appl_param_module_id.BCM8879X=6 +bcm_linkscan_interval.BCM8879X=0 +bcm_stat_interval.BCM8879X=4000000 +bist_enable.BCM8879X=0 +core_clock_speed_khz.BCM8879X=1000000 +custom_feature_access_only.BCM8879X=0 +custom_feature_lane_swap_disable.BCM8879X=0 +dport_map_direct.BCM8879X=1 +fabric_cell_fifo_dma_enable.BCM8879X=0 +fabric_device_mode.BCM8879X=SINGLE_STAGE_FE2 +fabric_load_balancing_mode.BCM8879X=NORMAL_LOAD_BALANCE +fabric_multicast_mode.BCM8879X=DIRECT +fabric_num_pipes.BCM8879X=1 +fabric_pipe_map.BCM8879X=0 +fe_mc_id_range.BCM8879X=128K +load_firmware.BCM8879X=0x102 +mdio_output_delay_ext.BCM8879X=14 +mdio_output_delay_int.BCM8879X=25 +mem_cache_enable_parity.BCM8879X=1 +mm_intr_enable.BCM8879X=0 +mm_timeout_usec.BCM8879X=300000 +polled_irq_delay.BCM8879X=100000 +polled_irq_mode.BCM8879X=1 +port_fec.BCM8879X=7 +port_init_cl72.BCM8879X=0 +port_init_speed.BCM8879X=53125 +rate_ext_mdio_divisor.BCM8879X=14 +rate_int_mdio_divisor.BCM8879X=50 +schan_intr_enable.BCM8879X=0 +schan_timeout_usec.BCM8879X=300000 +serdes_fabric_clk_freq_in.BCM8879X=1 +serdes_fabric_clk_freq_out.BCM8879X=bypass +soc_family.BCM8879X=BCM8879X +srd_tx_drv_hv_disable.BCM8879X=0 +system_contains_multiple_pipe_device.BCM8879X=0 +system_ref_core_clock_khz.BCM8879X=1200000 +table_dma_enable.BCM8879X=0 +tdma_intr_enable.BCM8879X=0 +tdma_timeout_usec.BCM8879X=5000000 +tslam_dma_enable.BCM8879X=0 +tslam_intr_enable.BCM8879X=0 +tslam_timeout_usec.BCM8879X=5000000 + +lane_to_serdes_map_fabric_lane0.BCM8879X=rx0:tx0 +lane_to_serdes_map_fabric_lane1.BCM8879X=rx1:tx1 +lane_to_serdes_map_fabric_lane2.BCM8879X=rx2:tx2 +lane_to_serdes_map_fabric_lane3.BCM8879X=rx3:tx3 + +lane_to_serdes_map_fabric_lane4.BCM8879X=rx4:tx4 +lane_to_serdes_map_fabric_lane5.BCM8879X=rx5:tx5 +lane_to_serdes_map_fabric_lane6.BCM8879X=rx6:tx6 +lane_to_serdes_map_fabric_lane7.BCM8879X=rx7:tx7 + +lane_to_serdes_map_fabric_lane8.BCM8879X=rx8:tx8 +lane_to_serdes_map_fabric_lane9.BCM8879X=rx9:tx9 +lane_to_serdes_map_fabric_lane10.BCM8879X=rx10:tx10 +lane_to_serdes_map_fabric_lane11.BCM8879X=rx11:tx11 + +lane_to_serdes_map_fabric_lane12.BCM8879X=rx12:tx12 +lane_to_serdes_map_fabric_lane13.BCM8879X=rx13:tx13 +lane_to_serdes_map_fabric_lane14.BCM8879X=rx14:tx14 +lane_to_serdes_map_fabric_lane15.BCM8879X=rx15:tx15 + +lane_to_serdes_map_fabric_lane16.BCM8879X=rx16:tx16 +lane_to_serdes_map_fabric_lane17.BCM8879X=rx17:tx17 +lane_to_serdes_map_fabric_lane18.BCM8879X=rx18:tx18 +lane_to_serdes_map_fabric_lane19.BCM8879X=rx19:tx19 + +lane_to_serdes_map_fabric_lane20.BCM8879X=rx20:tx20 +lane_to_serdes_map_fabric_lane21.BCM8879X=rx21:tx21 +lane_to_serdes_map_fabric_lane22.BCM8879X=rx22:tx22 +lane_to_serdes_map_fabric_lane23.BCM8879X=rx23:tx23 + +lane_to_serdes_map_fabric_lane24.BCM8879X=rx24:tx24 +lane_to_serdes_map_fabric_lane25.BCM8879X=rx25:tx25 +lane_to_serdes_map_fabric_lane26.BCM8879X=rx26:tx26 +lane_to_serdes_map_fabric_lane27.BCM8879X=rx27:tx27 + +lane_to_serdes_map_fabric_lane28.BCM8879X=rx28:tx28 +lane_to_serdes_map_fabric_lane29.BCM8879X=rx29:tx29 +lane_to_serdes_map_fabric_lane30.BCM8879X=rx30:tx30 +lane_to_serdes_map_fabric_lane31.BCM8879X=rx31:tx31 + +lane_to_serdes_map_fabric_lane32.BCM8879X=rx32:tx32 +lane_to_serdes_map_fabric_lane33.BCM8879X=rx33:tx33 +lane_to_serdes_map_fabric_lane34.BCM8879X=rx34:tx34 +lane_to_serdes_map_fabric_lane35.BCM8879X=rx35:tx35 + +lane_to_serdes_map_fabric_lane36.BCM8879X=rx36:tx36 +lane_to_serdes_map_fabric_lane37.BCM8879X=rx37:tx37 +lane_to_serdes_map_fabric_lane38.BCM8879X=rx38:tx38 +lane_to_serdes_map_fabric_lane39.BCM8879X=rx39:tx39 + +lane_to_serdes_map_fabric_lane40.BCM8879X=rx40:tx40 +lane_to_serdes_map_fabric_lane41.BCM8879X=rx41:tx41 +lane_to_serdes_map_fabric_lane42.BCM8879X=rx42:tx42 +lane_to_serdes_map_fabric_lane43.BCM8879X=rx43:tx43 + +lane_to_serdes_map_fabric_lane44.BCM8879X=rx44:tx44 +lane_to_serdes_map_fabric_lane45.BCM8879X=rx45:tx45 +lane_to_serdes_map_fabric_lane46.BCM8879X=rx46:tx46 +lane_to_serdes_map_fabric_lane47.BCM8879X=rx47:tx47 + +lane_to_serdes_map_fabric_lane48.BCM8879X=rx48:tx48 +lane_to_serdes_map_fabric_lane49.BCM8879X=rx49:tx49 +lane_to_serdes_map_fabric_lane50.BCM8879X=rx50:tx50 +lane_to_serdes_map_fabric_lane51.BCM8879X=rx51:tx51 + +lane_to_serdes_map_fabric_lane52.BCM8879X=rx52:tx52 +lane_to_serdes_map_fabric_lane53.BCM8879X=rx53:tx53 +lane_to_serdes_map_fabric_lane54.BCM8879X=rx54:tx54 +lane_to_serdes_map_fabric_lane55.BCM8879X=rx55:tx55 + +lane_to_serdes_map_fabric_lane56.BCM8879X=rx56:tx56 +lane_to_serdes_map_fabric_lane57.BCM8879X=rx57:tx57 +lane_to_serdes_map_fabric_lane58.BCM8879X=rx58:tx58 +lane_to_serdes_map_fabric_lane59.BCM8879X=rx59:tx59 + +lane_to_serdes_map_fabric_lane60.BCM8879X=rx60:tx60 +lane_to_serdes_map_fabric_lane61.BCM8879X=rx61:tx61 +lane_to_serdes_map_fabric_lane62.BCM8879X=rx62:tx62 +lane_to_serdes_map_fabric_lane63.BCM8879X=rx63:tx63 + +lane_to_serdes_map_fabric_lane64.BCM8879X=rx64:tx64 +lane_to_serdes_map_fabric_lane65.BCM8879X=rx65:tx65 +lane_to_serdes_map_fabric_lane66.BCM8879X=rx66:tx66 +lane_to_serdes_map_fabric_lane67.BCM8879X=rx67:tx67 + +lane_to_serdes_map_fabric_lane68.BCM8879X=rx68:tx68 +lane_to_serdes_map_fabric_lane69.BCM8879X=rx69:tx69 +lane_to_serdes_map_fabric_lane70.BCM8879X=rx70:tx70 +lane_to_serdes_map_fabric_lane71.BCM8879X=rx71:tx71 + +lane_to_serdes_map_fabric_lane72.BCM8879X=rx72:tx72 +lane_to_serdes_map_fabric_lane73.BCM8879X=rx73:tx73 +lane_to_serdes_map_fabric_lane74.BCM8879X=rx74:tx74 +lane_to_serdes_map_fabric_lane75.BCM8879X=rx75:tx75 + +lane_to_serdes_map_fabric_lane76.BCM8879X=rx76:tx76 +lane_to_serdes_map_fabric_lane77.BCM8879X=rx77:tx77 +lane_to_serdes_map_fabric_lane78.BCM8879X=rx78:tx78 +lane_to_serdes_map_fabric_lane79.BCM8879X=rx79:tx79 + +lane_to_serdes_map_fabric_lane80.BCM8879X=rx80:tx80 +lane_to_serdes_map_fabric_lane81.BCM8879X=rx81:tx81 +lane_to_serdes_map_fabric_lane82.BCM8879X=rx82:tx82 +lane_to_serdes_map_fabric_lane83.BCM8879X=rx83:tx83 + +lane_to_serdes_map_fabric_lane84.BCM8879X=rx84:tx84 +lane_to_serdes_map_fabric_lane85.BCM8879X=rx85:tx85 +lane_to_serdes_map_fabric_lane86.BCM8879X=rx86:tx86 +lane_to_serdes_map_fabric_lane87.BCM8879X=rx87:tx87 + +lane_to_serdes_map_fabric_lane88.BCM8879X=rx88:tx88 +lane_to_serdes_map_fabric_lane89.BCM8879X=rx89:tx89 +lane_to_serdes_map_fabric_lane90.BCM8879X=rx90:tx90 +lane_to_serdes_map_fabric_lane91.BCM8879X=rx91:tx91 + +lane_to_serdes_map_fabric_lane92.BCM8879X=rx92:tx92 +lane_to_serdes_map_fabric_lane93.BCM8879X=rx93:tx93 +lane_to_serdes_map_fabric_lane94.BCM8879X=rx94:tx94 +lane_to_serdes_map_fabric_lane95.BCM8879X=rx95:tx95 + +lane_to_serdes_map_fabric_lane96.BCM8879X=rx96:tx96 +lane_to_serdes_map_fabric_lane97.BCM8879X=rx97:tx97 +lane_to_serdes_map_fabric_lane98.BCM8879X=rx98:tx98 +lane_to_serdes_map_fabric_lane99.BCM8879X=rx99:tx99 + +lane_to_serdes_map_fabric_lane100.BCM8879X=rx100:tx100 +lane_to_serdes_map_fabric_lane101.BCM8879X=rx101:tx101 +lane_to_serdes_map_fabric_lane102.BCM8879X=rx102:tx102 +lane_to_serdes_map_fabric_lane103.BCM8879X=rx103:tx103 + +lane_to_serdes_map_fabric_lane104.BCM8879X=rx104:tx104 +lane_to_serdes_map_fabric_lane105.BCM8879X=rx105:tx105 +lane_to_serdes_map_fabric_lane106.BCM8879X=rx106:tx106 +lane_to_serdes_map_fabric_lane107.BCM8879X=rx107:tx107 + +lane_to_serdes_map_fabric_lane108.BCM8879X=rx108:tx108 +lane_to_serdes_map_fabric_lane109.BCM8879X=rx109:tx109 +lane_to_serdes_map_fabric_lane110.BCM8879X=rx110:tx110 +lane_to_serdes_map_fabric_lane111.BCM8879X=rx111:tx111 + +lane_to_serdes_map_fabric_lane112.BCM8879X=rx112:tx112 +lane_to_serdes_map_fabric_lane113.BCM8879X=rx113:tx113 +lane_to_serdes_map_fabric_lane114.BCM8879X=rx114:tx114 +lane_to_serdes_map_fabric_lane115.BCM8879X=rx115:tx115 + +lane_to_serdes_map_fabric_lane116.BCM8879X=rx116:tx116 +lane_to_serdes_map_fabric_lane117.BCM8879X=rx117:tx117 +lane_to_serdes_map_fabric_lane118.BCM8879X=rx118:tx118 +lane_to_serdes_map_fabric_lane119.BCM8879X=rx119:tx119 + +lane_to_serdes_map_fabric_lane120.BCM8879X=rx120:tx120 +lane_to_serdes_map_fabric_lane121.BCM8879X=rx121:tx121 +lane_to_serdes_map_fabric_lane122.BCM8879X=rx122:tx122 +lane_to_serdes_map_fabric_lane123.BCM8879X=rx123:tx123 + +lane_to_serdes_map_fabric_lane124.BCM8879X=rx124:tx124 +lane_to_serdes_map_fabric_lane125.BCM8879X=rx125:tx125 +lane_to_serdes_map_fabric_lane126.BCM8879X=rx126:tx126 +lane_to_serdes_map_fabric_lane127.BCM8879X=rx127:tx127 + +lane_to_serdes_map_fabric_lane128.BCM8879X=rx128:tx128 +lane_to_serdes_map_fabric_lane129.BCM8879X=rx129:tx129 +lane_to_serdes_map_fabric_lane130.BCM8879X=rx130:tx130 +lane_to_serdes_map_fabric_lane131.BCM8879X=rx131:tx131 + +lane_to_serdes_map_fabric_lane132.BCM8879X=rx132:tx132 +lane_to_serdes_map_fabric_lane133.BCM8879X=rx133:tx133 +lane_to_serdes_map_fabric_lane134.BCM8879X=rx134:tx134 +lane_to_serdes_map_fabric_lane135.BCM8879X=rx135:tx135 + +lane_to_serdes_map_fabric_lane136.BCM8879X=rx136:tx136 +lane_to_serdes_map_fabric_lane137.BCM8879X=rx137:tx137 +lane_to_serdes_map_fabric_lane138.BCM8879X=rx138:tx138 +lane_to_serdes_map_fabric_lane139.BCM8879X=rx139:tx139 + +lane_to_serdes_map_fabric_lane140.BCM8879X=rx140:tx140 +lane_to_serdes_map_fabric_lane141.BCM8879X=rx141:tx141 +lane_to_serdes_map_fabric_lane142.BCM8879X=rx142:tx142 +lane_to_serdes_map_fabric_lane143.BCM8879X=rx143:tx143 + +lane_to_serdes_map_fabric_lane144.BCM8879X=rx144:tx144 +lane_to_serdes_map_fabric_lane145.BCM8879X=rx145:tx145 +lane_to_serdes_map_fabric_lane146.BCM8879X=rx146:tx146 +lane_to_serdes_map_fabric_lane147.BCM8879X=rx147:tx147 + +lane_to_serdes_map_fabric_lane148.BCM8879X=rx148:tx148 +lane_to_serdes_map_fabric_lane149.BCM8879X=rx149:tx149 +lane_to_serdes_map_fabric_lane150.BCM8879X=rx150:tx150 +lane_to_serdes_map_fabric_lane151.BCM8879X=rx151:tx151 + +lane_to_serdes_map_fabric_lane152.BCM8879X=rx152:tx152 +lane_to_serdes_map_fabric_lane153.BCM8879X=rx153:tx153 +lane_to_serdes_map_fabric_lane154.BCM8879X=rx154:tx154 +lane_to_serdes_map_fabric_lane155.BCM8879X=rx155:tx155 + +lane_to_serdes_map_fabric_lane156.BCM8879X=rx156:tx156 +lane_to_serdes_map_fabric_lane157.BCM8879X=rx157:tx157 +lane_to_serdes_map_fabric_lane158.BCM8879X=rx158:tx158 +lane_to_serdes_map_fabric_lane159.BCM8879X=rx159:tx159 + +lane_to_serdes_map_fabric_lane160.BCM8879X=rx160:tx160 +lane_to_serdes_map_fabric_lane161.BCM8879X=rx161:tx161 +lane_to_serdes_map_fabric_lane162.BCM8879X=rx162:tx162 +lane_to_serdes_map_fabric_lane163.BCM8879X=rx163:tx163 + +lane_to_serdes_map_fabric_lane164.BCM8879X=rx164:tx164 +lane_to_serdes_map_fabric_lane165.BCM8879X=rx165:tx165 +lane_to_serdes_map_fabric_lane166.BCM8879X=rx166:tx166 +lane_to_serdes_map_fabric_lane167.BCM8879X=rx167:tx167 + +lane_to_serdes_map_fabric_lane168.BCM8879X=rx168:tx168 +lane_to_serdes_map_fabric_lane169.BCM8879X=rx169:tx169 +lane_to_serdes_map_fabric_lane170.BCM8879X=rx170:tx170 +lane_to_serdes_map_fabric_lane171.BCM8879X=rx171:tx171 + +lane_to_serdes_map_fabric_lane172.BCM8879X=rx172:tx172 +lane_to_serdes_map_fabric_lane173.BCM8879X=rx173:tx173 +lane_to_serdes_map_fabric_lane174.BCM8879X=rx174:tx174 +lane_to_serdes_map_fabric_lane175.BCM8879X=rx175:tx175 + +lane_to_serdes_map_fabric_lane176.BCM8879X=rx176:tx176 +lane_to_serdes_map_fabric_lane177.BCM8879X=rx177:tx177 +lane_to_serdes_map_fabric_lane178.BCM8879X=rx178:tx178 +lane_to_serdes_map_fabric_lane179.BCM8879X=rx179:tx179 + +lane_to_serdes_map_fabric_lane180.BCM8879X=rx180:tx180 +lane_to_serdes_map_fabric_lane181.BCM8879X=rx181:tx181 +lane_to_serdes_map_fabric_lane182.BCM8879X=rx182:tx182 +lane_to_serdes_map_fabric_lane183.BCM8879X=rx183:tx183 + +lane_to_serdes_map_fabric_lane184.BCM8879X=rx184:tx184 +lane_to_serdes_map_fabric_lane185.BCM8879X=rx185:tx185 +lane_to_serdes_map_fabric_lane186.BCM8879X=rx186:tx186 +lane_to_serdes_map_fabric_lane187.BCM8879X=rx187:tx187 + +lane_to_serdes_map_fabric_lane188.BCM8879X=rx188:tx188 +lane_to_serdes_map_fabric_lane189.BCM8879X=rx189:tx189 +lane_to_serdes_map_fabric_lane190.BCM8879X=rx190:tx190 +lane_to_serdes_map_fabric_lane191.BCM8879X=rx191:tx191 + + +phy_rx_polarity_flip_fabric0.BCM8879X=1 +phy_rx_polarity_flip_fabric1.BCM8879X=0 +phy_rx_polarity_flip_fabric2.BCM8879X=1 +phy_rx_polarity_flip_fabric3.BCM8879X=0 + +phy_rx_polarity_flip_fabric4.BCM8879X=1 +phy_rx_polarity_flip_fabric5.BCM8879X=0 +phy_rx_polarity_flip_fabric6.BCM8879X=1 +phy_rx_polarity_flip_fabric7.BCM8879X=0 + +phy_rx_polarity_flip_fabric8.BCM8879X=0 +phy_rx_polarity_flip_fabric9.BCM8879X=1 +phy_rx_polarity_flip_fabric10.BCM8879X=0 +phy_rx_polarity_flip_fabric11.BCM8879X=1 + +phy_rx_polarity_flip_fabric12.BCM8879X=1 +phy_rx_polarity_flip_fabric13.BCM8879X=0 +phy_rx_polarity_flip_fabric14.BCM8879X=1 +phy_rx_polarity_flip_fabric15.BCM8879X=0 + +phy_rx_polarity_flip_fabric16.BCM8879X=1 +phy_rx_polarity_flip_fabric17.BCM8879X=0 +phy_rx_polarity_flip_fabric18.BCM8879X=1 +phy_rx_polarity_flip_fabric19.BCM8879X=0 + +phy_rx_polarity_flip_fabric20.BCM8879X=0 +phy_rx_polarity_flip_fabric21.BCM8879X=1 +phy_rx_polarity_flip_fabric22.BCM8879X=0 +phy_rx_polarity_flip_fabric23.BCM8879X=1 + +phy_rx_polarity_flip_fabric24.BCM8879X=1 +phy_rx_polarity_flip_fabric25.BCM8879X=0 +phy_rx_polarity_flip_fabric26.BCM8879X=1 +phy_rx_polarity_flip_fabric27.BCM8879X=0 + +phy_rx_polarity_flip_fabric28.BCM8879X=1 +phy_rx_polarity_flip_fabric29.BCM8879X=0 +phy_rx_polarity_flip_fabric30.BCM8879X=1 +phy_rx_polarity_flip_fabric31.BCM8879X=0 + +phy_rx_polarity_flip_fabric32.BCM8879X=0 +phy_rx_polarity_flip_fabric33.BCM8879X=1 +phy_rx_polarity_flip_fabric34.BCM8879X=0 +phy_rx_polarity_flip_fabric35.BCM8879X=1 + +phy_rx_polarity_flip_fabric36.BCM8879X=1 +phy_rx_polarity_flip_fabric37.BCM8879X=0 +phy_rx_polarity_flip_fabric38.BCM8879X=1 +phy_rx_polarity_flip_fabric39.BCM8879X=0 + +phy_rx_polarity_flip_fabric40.BCM8879X=0 +phy_rx_polarity_flip_fabric41.BCM8879X=1 +phy_rx_polarity_flip_fabric42.BCM8879X=0 +phy_rx_polarity_flip_fabric43.BCM8879X=1 + +phy_rx_polarity_flip_fabric44.BCM8879X=1 +phy_rx_polarity_flip_fabric45.BCM8879X=0 +phy_rx_polarity_flip_fabric46.BCM8879X=1 +phy_rx_polarity_flip_fabric47.BCM8879X=0 + +phy_rx_polarity_flip_fabric48.BCM8879X=1 +phy_rx_polarity_flip_fabric49.BCM8879X=0 +phy_rx_polarity_flip_fabric50.BCM8879X=1 +phy_rx_polarity_flip_fabric51.BCM8879X=0 + +phy_rx_polarity_flip_fabric52.BCM8879X=0 +phy_rx_polarity_flip_fabric53.BCM8879X=1 +phy_rx_polarity_flip_fabric54.BCM8879X=0 +phy_rx_polarity_flip_fabric55.BCM8879X=1 + +phy_rx_polarity_flip_fabric56.BCM8879X=0 +phy_rx_polarity_flip_fabric57.BCM8879X=1 +phy_rx_polarity_flip_fabric58.BCM8879X=0 +phy_rx_polarity_flip_fabric59.BCM8879X=1 + +phy_rx_polarity_flip_fabric60.BCM8879X=0 +phy_rx_polarity_flip_fabric61.BCM8879X=1 +phy_rx_polarity_flip_fabric62.BCM8879X=0 +phy_rx_polarity_flip_fabric63.BCM8879X=1 + +phy_rx_polarity_flip_fabric64.BCM8879X=0 +phy_rx_polarity_flip_fabric65.BCM8879X=1 +phy_rx_polarity_flip_fabric66.BCM8879X=0 +phy_rx_polarity_flip_fabric67.BCM8879X=1 + +phy_rx_polarity_flip_fabric68.BCM8879X=1 +phy_rx_polarity_flip_fabric69.BCM8879X=0 +phy_rx_polarity_flip_fabric70.BCM8879X=1 +phy_rx_polarity_flip_fabric71.BCM8879X=0 + +phy_rx_polarity_flip_fabric72.BCM8879X=1 +phy_rx_polarity_flip_fabric73.BCM8879X=0 +phy_rx_polarity_flip_fabric74.BCM8879X=1 +phy_rx_polarity_flip_fabric75.BCM8879X=0 + +phy_rx_polarity_flip_fabric76.BCM8879X=0 +phy_rx_polarity_flip_fabric77.BCM8879X=1 +phy_rx_polarity_flip_fabric78.BCM8879X=0 +phy_rx_polarity_flip_fabric79.BCM8879X=1 + +phy_rx_polarity_flip_fabric80.BCM8879X=1 +phy_rx_polarity_flip_fabric81.BCM8879X=0 +phy_rx_polarity_flip_fabric82.BCM8879X=1 +phy_rx_polarity_flip_fabric83.BCM8879X=0 + +phy_rx_polarity_flip_fabric84.BCM8879X=0 +phy_rx_polarity_flip_fabric85.BCM8879X=1 +phy_rx_polarity_flip_fabric86.BCM8879X=0 +phy_rx_polarity_flip_fabric87.BCM8879X=1 + +phy_rx_polarity_flip_fabric88.BCM8879X=1 +phy_rx_polarity_flip_fabric89.BCM8879X=0 +phy_rx_polarity_flip_fabric90.BCM8879X=1 +phy_rx_polarity_flip_fabric91.BCM8879X=0 + +phy_rx_polarity_flip_fabric92.BCM8879X=1 +phy_rx_polarity_flip_fabric93.BCM8879X=0 +phy_rx_polarity_flip_fabric94.BCM8879X=1 +phy_rx_polarity_flip_fabric95.BCM8879X=0 + +phy_rx_polarity_flip_fabric96.BCM8879X=0 +phy_rx_polarity_flip_fabric97.BCM8879X=1 +phy_rx_polarity_flip_fabric98.BCM8879X=0 +phy_rx_polarity_flip_fabric99.BCM8879X=1 + +phy_rx_polarity_flip_fabric100.BCM8879X=1 +phy_rx_polarity_flip_fabric101.BCM8879X=0 +phy_rx_polarity_flip_fabric102.BCM8879X=1 +phy_rx_polarity_flip_fabric103.BCM8879X=0 + +phy_rx_polarity_flip_fabric104.BCM8879X=0 +phy_rx_polarity_flip_fabric105.BCM8879X=1 +phy_rx_polarity_flip_fabric106.BCM8879X=0 +phy_rx_polarity_flip_fabric107.BCM8879X=1 + +phy_rx_polarity_flip_fabric108.BCM8879X=0 +phy_rx_polarity_flip_fabric109.BCM8879X=1 +phy_rx_polarity_flip_fabric110.BCM8879X=0 +phy_rx_polarity_flip_fabric111.BCM8879X=1 + +phy_rx_polarity_flip_fabric112.BCM8879X=1 +phy_rx_polarity_flip_fabric113.BCM8879X=0 +phy_rx_polarity_flip_fabric114.BCM8879X=1 +phy_rx_polarity_flip_fabric115.BCM8879X=0 + +phy_rx_polarity_flip_fabric116.BCM8879X=0 +phy_rx_polarity_flip_fabric117.BCM8879X=1 +phy_rx_polarity_flip_fabric118.BCM8879X=0 +phy_rx_polarity_flip_fabric119.BCM8879X=1 + +phy_rx_polarity_flip_fabric120.BCM8879X=1 +phy_rx_polarity_flip_fabric121.BCM8879X=0 +phy_rx_polarity_flip_fabric122.BCM8879X=1 +phy_rx_polarity_flip_fabric123.BCM8879X=0 + +phy_rx_polarity_flip_fabric124.BCM8879X=1 +phy_rx_polarity_flip_fabric125.BCM8879X=0 +phy_rx_polarity_flip_fabric126.BCM8879X=1 +phy_rx_polarity_flip_fabric127.BCM8879X=0 + +phy_rx_polarity_flip_fabric128.BCM8879X=0 +phy_rx_polarity_flip_fabric129.BCM8879X=1 +phy_rx_polarity_flip_fabric130.BCM8879X=0 +phy_rx_polarity_flip_fabric131.BCM8879X=1 + +phy_rx_polarity_flip_fabric132.BCM8879X=1 +phy_rx_polarity_flip_fabric133.BCM8879X=0 +phy_rx_polarity_flip_fabric134.BCM8879X=1 +phy_rx_polarity_flip_fabric135.BCM8879X=0 + +phy_rx_polarity_flip_fabric136.BCM8879X=0 +phy_rx_polarity_flip_fabric137.BCM8879X=1 +phy_rx_polarity_flip_fabric138.BCM8879X=0 +phy_rx_polarity_flip_fabric139.BCM8879X=1 + +phy_rx_polarity_flip_fabric140.BCM8879X=1 +phy_rx_polarity_flip_fabric141.BCM8879X=0 +phy_rx_polarity_flip_fabric142.BCM8879X=1 +phy_rx_polarity_flip_fabric143.BCM8879X=0 + +phy_rx_polarity_flip_fabric144.BCM8879X=1 +phy_rx_polarity_flip_fabric145.BCM8879X=0 +phy_rx_polarity_flip_fabric146.BCM8879X=1 +phy_rx_polarity_flip_fabric147.BCM8879X=0 + +phy_rx_polarity_flip_fabric148.BCM8879X=0 +phy_rx_polarity_flip_fabric149.BCM8879X=1 +phy_rx_polarity_flip_fabric150.BCM8879X=0 +phy_rx_polarity_flip_fabric151.BCM8879X=1 + +phy_rx_polarity_flip_fabric152.BCM8879X=1 +phy_rx_polarity_flip_fabric153.BCM8879X=0 +phy_rx_polarity_flip_fabric154.BCM8879X=1 +phy_rx_polarity_flip_fabric155.BCM8879X=0 + +phy_rx_polarity_flip_fabric156.BCM8879X=0 +phy_rx_polarity_flip_fabric157.BCM8879X=1 +phy_rx_polarity_flip_fabric158.BCM8879X=0 +phy_rx_polarity_flip_fabric159.BCM8879X=1 + +phy_rx_polarity_flip_fabric160.BCM8879X=1 +phy_rx_polarity_flip_fabric161.BCM8879X=0 +phy_rx_polarity_flip_fabric162.BCM8879X=1 +phy_rx_polarity_flip_fabric163.BCM8879X=0 + +phy_rx_polarity_flip_fabric164.BCM8879X=1 +phy_rx_polarity_flip_fabric165.BCM8879X=0 +phy_rx_polarity_flip_fabric166.BCM8879X=1 +phy_rx_polarity_flip_fabric167.BCM8879X=0 + +phy_rx_polarity_flip_fabric168.BCM8879X=1 +phy_rx_polarity_flip_fabric169.BCM8879X=0 +phy_rx_polarity_flip_fabric170.BCM8879X=1 +phy_rx_polarity_flip_fabric171.BCM8879X=0 + +phy_rx_polarity_flip_fabric172.BCM8879X=0 +phy_rx_polarity_flip_fabric173.BCM8879X=1 +phy_rx_polarity_flip_fabric174.BCM8879X=0 +phy_rx_polarity_flip_fabric175.BCM8879X=1 + +phy_rx_polarity_flip_fabric176.BCM8879X=1 +phy_rx_polarity_flip_fabric177.BCM8879X=0 +phy_rx_polarity_flip_fabric178.BCM8879X=1 +phy_rx_polarity_flip_fabric179.BCM8879X=0 + +phy_rx_polarity_flip_fabric180.BCM8879X=0 +phy_rx_polarity_flip_fabric181.BCM8879X=1 +phy_rx_polarity_flip_fabric182.BCM8879X=0 +phy_rx_polarity_flip_fabric183.BCM8879X=1 + +phy_rx_polarity_flip_fabric184.BCM8879X=1 +phy_rx_polarity_flip_fabric185.BCM8879X=0 +phy_rx_polarity_flip_fabric186.BCM8879X=1 +phy_rx_polarity_flip_fabric187.BCM8879X=0 + +phy_rx_polarity_flip_fabric188.BCM8879X=1 +phy_rx_polarity_flip_fabric189.BCM8879X=0 +phy_rx_polarity_flip_fabric190.BCM8879X=1 +phy_rx_polarity_flip_fabric191.BCM8879X=0 + + +phy_tx_polarity_flip_fabric0.BCM8879X=0 +phy_tx_polarity_flip_fabric1.BCM8879X=1 +phy_tx_polarity_flip_fabric2.BCM8879X=0 +phy_tx_polarity_flip_fabric3.BCM8879X=1 + +phy_tx_polarity_flip_fabric4.BCM8879X=0 +phy_tx_polarity_flip_fabric5.BCM8879X=1 +phy_tx_polarity_flip_fabric6.BCM8879X=0 +phy_tx_polarity_flip_fabric7.BCM8879X=1 + +phy_tx_polarity_flip_fabric8.BCM8879X=1 +phy_tx_polarity_flip_fabric9.BCM8879X=0 +phy_tx_polarity_flip_fabric10.BCM8879X=1 +phy_tx_polarity_flip_fabric11.BCM8879X=0 + +phy_tx_polarity_flip_fabric12.BCM8879X=0 +phy_tx_polarity_flip_fabric13.BCM8879X=1 +phy_tx_polarity_flip_fabric14.BCM8879X=0 +phy_tx_polarity_flip_fabric15.BCM8879X=1 + +phy_tx_polarity_flip_fabric16.BCM8879X=0 +phy_tx_polarity_flip_fabric17.BCM8879X=1 +phy_tx_polarity_flip_fabric18.BCM8879X=0 +phy_tx_polarity_flip_fabric19.BCM8879X=1 + +phy_tx_polarity_flip_fabric20.BCM8879X=1 +phy_tx_polarity_flip_fabric21.BCM8879X=0 +phy_tx_polarity_flip_fabric22.BCM8879X=1 +phy_tx_polarity_flip_fabric23.BCM8879X=0 + +phy_tx_polarity_flip_fabric24.BCM8879X=0 +phy_tx_polarity_flip_fabric25.BCM8879X=1 +phy_tx_polarity_flip_fabric26.BCM8879X=0 +phy_tx_polarity_flip_fabric27.BCM8879X=1 + +phy_tx_polarity_flip_fabric28.BCM8879X=0 +phy_tx_polarity_flip_fabric29.BCM8879X=1 +phy_tx_polarity_flip_fabric30.BCM8879X=0 +phy_tx_polarity_flip_fabric31.BCM8879X=1 + +phy_tx_polarity_flip_fabric32.BCM8879X=1 +phy_tx_polarity_flip_fabric33.BCM8879X=0 +phy_tx_polarity_flip_fabric34.BCM8879X=1 +phy_tx_polarity_flip_fabric35.BCM8879X=0 + +phy_tx_polarity_flip_fabric36.BCM8879X=0 +phy_tx_polarity_flip_fabric37.BCM8879X=1 +phy_tx_polarity_flip_fabric38.BCM8879X=0 +phy_tx_polarity_flip_fabric39.BCM8879X=1 + +phy_tx_polarity_flip_fabric40.BCM8879X=1 +phy_tx_polarity_flip_fabric41.BCM8879X=0 +phy_tx_polarity_flip_fabric42.BCM8879X=1 +phy_tx_polarity_flip_fabric43.BCM8879X=0 + +phy_tx_polarity_flip_fabric44.BCM8879X=0 +phy_tx_polarity_flip_fabric45.BCM8879X=1 +phy_tx_polarity_flip_fabric46.BCM8879X=0 +phy_tx_polarity_flip_fabric47.BCM8879X=1 + +phy_tx_polarity_flip_fabric48.BCM8879X=0 +phy_tx_polarity_flip_fabric49.BCM8879X=1 +phy_tx_polarity_flip_fabric50.BCM8879X=0 +phy_tx_polarity_flip_fabric51.BCM8879X=1 + +phy_tx_polarity_flip_fabric52.BCM8879X=1 +phy_tx_polarity_flip_fabric53.BCM8879X=0 +phy_tx_polarity_flip_fabric54.BCM8879X=1 +phy_tx_polarity_flip_fabric55.BCM8879X=0 + +phy_tx_polarity_flip_fabric56.BCM8879X=1 +phy_tx_polarity_flip_fabric57.BCM8879X=0 +phy_tx_polarity_flip_fabric58.BCM8879X=1 +phy_tx_polarity_flip_fabric59.BCM8879X=0 + +phy_tx_polarity_flip_fabric60.BCM8879X=1 +phy_tx_polarity_flip_fabric61.BCM8879X=0 +phy_tx_polarity_flip_fabric62.BCM8879X=1 +phy_tx_polarity_flip_fabric63.BCM8879X=0 + +phy_tx_polarity_flip_fabric64.BCM8879X=1 +phy_tx_polarity_flip_fabric65.BCM8879X=0 +phy_tx_polarity_flip_fabric66.BCM8879X=1 +phy_tx_polarity_flip_fabric67.BCM8879X=0 + +phy_tx_polarity_flip_fabric68.BCM8879X=0 +phy_tx_polarity_flip_fabric69.BCM8879X=1 +phy_tx_polarity_flip_fabric70.BCM8879X=0 +phy_tx_polarity_flip_fabric71.BCM8879X=1 + +phy_tx_polarity_flip_fabric72.BCM8879X=0 +phy_tx_polarity_flip_fabric73.BCM8879X=1 +phy_tx_polarity_flip_fabric74.BCM8879X=0 +phy_tx_polarity_flip_fabric75.BCM8879X=1 + +phy_tx_polarity_flip_fabric76.BCM8879X=1 +phy_tx_polarity_flip_fabric77.BCM8879X=0 +phy_tx_polarity_flip_fabric78.BCM8879X=1 +phy_tx_polarity_flip_fabric79.BCM8879X=0 + +phy_tx_polarity_flip_fabric80.BCM8879X=0 +phy_tx_polarity_flip_fabric81.BCM8879X=1 +phy_tx_polarity_flip_fabric82.BCM8879X=0 +phy_tx_polarity_flip_fabric83.BCM8879X=1 + +phy_tx_polarity_flip_fabric84.BCM8879X=1 +phy_tx_polarity_flip_fabric85.BCM8879X=0 +phy_tx_polarity_flip_fabric86.BCM8879X=1 +phy_tx_polarity_flip_fabric87.BCM8879X=0 + +phy_tx_polarity_flip_fabric88.BCM8879X=0 +phy_tx_polarity_flip_fabric89.BCM8879X=1 +phy_tx_polarity_flip_fabric90.BCM8879X=0 +phy_tx_polarity_flip_fabric91.BCM8879X=1 + +phy_tx_polarity_flip_fabric92.BCM8879X=0 +phy_tx_polarity_flip_fabric93.BCM8879X=1 +phy_tx_polarity_flip_fabric94.BCM8879X=0 +phy_tx_polarity_flip_fabric95.BCM8879X=1 + +phy_tx_polarity_flip_fabric96.BCM8879X=1 +phy_tx_polarity_flip_fabric97.BCM8879X=0 +phy_tx_polarity_flip_fabric98.BCM8879X=1 +phy_tx_polarity_flip_fabric99.BCM8879X=0 + +phy_tx_polarity_flip_fabric100.BCM8879X=0 +phy_tx_polarity_flip_fabric101.BCM8879X=1 +phy_tx_polarity_flip_fabric102.BCM8879X=0 +phy_tx_polarity_flip_fabric103.BCM8879X=1 + +phy_tx_polarity_flip_fabric104.BCM8879X=1 +phy_tx_polarity_flip_fabric105.BCM8879X=0 +phy_tx_polarity_flip_fabric106.BCM8879X=1 +phy_tx_polarity_flip_fabric107.BCM8879X=0 + +phy_tx_polarity_flip_fabric108.BCM8879X=1 +phy_tx_polarity_flip_fabric109.BCM8879X=0 +phy_tx_polarity_flip_fabric110.BCM8879X=1 +phy_tx_polarity_flip_fabric111.BCM8879X=0 + +phy_tx_polarity_flip_fabric112.BCM8879X=0 +phy_tx_polarity_flip_fabric113.BCM8879X=1 +phy_tx_polarity_flip_fabric114.BCM8879X=0 +phy_tx_polarity_flip_fabric115.BCM8879X=1 + +phy_tx_polarity_flip_fabric116.BCM8879X=1 +phy_tx_polarity_flip_fabric117.BCM8879X=0 +phy_tx_polarity_flip_fabric118.BCM8879X=1 +phy_tx_polarity_flip_fabric119.BCM8879X=0 + +phy_tx_polarity_flip_fabric120.BCM8879X=0 +phy_tx_polarity_flip_fabric121.BCM8879X=1 +phy_tx_polarity_flip_fabric122.BCM8879X=0 +phy_tx_polarity_flip_fabric123.BCM8879X=1 + +phy_tx_polarity_flip_fabric124.BCM8879X=0 +phy_tx_polarity_flip_fabric125.BCM8879X=1 +phy_tx_polarity_flip_fabric126.BCM8879X=0 +phy_tx_polarity_flip_fabric127.BCM8879X=1 + +phy_tx_polarity_flip_fabric128.BCM8879X=1 +phy_tx_polarity_flip_fabric129.BCM8879X=0 +phy_tx_polarity_flip_fabric130.BCM8879X=1 +phy_tx_polarity_flip_fabric131.BCM8879X=0 + +phy_tx_polarity_flip_fabric132.BCM8879X=0 +phy_tx_polarity_flip_fabric133.BCM8879X=1 +phy_tx_polarity_flip_fabric134.BCM8879X=0 +phy_tx_polarity_flip_fabric135.BCM8879X=1 + +phy_tx_polarity_flip_fabric136.BCM8879X=1 +phy_tx_polarity_flip_fabric137.BCM8879X=0 +phy_tx_polarity_flip_fabric138.BCM8879X=1 +phy_tx_polarity_flip_fabric139.BCM8879X=0 + +phy_tx_polarity_flip_fabric140.BCM8879X=0 +phy_tx_polarity_flip_fabric141.BCM8879X=1 +phy_tx_polarity_flip_fabric142.BCM8879X=0 +phy_tx_polarity_flip_fabric143.BCM8879X=1 + +phy_tx_polarity_flip_fabric144.BCM8879X=0 +phy_tx_polarity_flip_fabric145.BCM8879X=1 +phy_tx_polarity_flip_fabric146.BCM8879X=0 +phy_tx_polarity_flip_fabric147.BCM8879X=1 + +phy_tx_polarity_flip_fabric148.BCM8879X=1 +phy_tx_polarity_flip_fabric149.BCM8879X=0 +phy_tx_polarity_flip_fabric150.BCM8879X=1 +phy_tx_polarity_flip_fabric151.BCM8879X=0 + +phy_tx_polarity_flip_fabric152.BCM8879X=0 +phy_tx_polarity_flip_fabric153.BCM8879X=1 +phy_tx_polarity_flip_fabric154.BCM8879X=0 +phy_tx_polarity_flip_fabric155.BCM8879X=1 + +phy_tx_polarity_flip_fabric156.BCM8879X=1 +phy_tx_polarity_flip_fabric157.BCM8879X=0 +phy_tx_polarity_flip_fabric158.BCM8879X=1 +phy_tx_polarity_flip_fabric159.BCM8879X=0 + +phy_tx_polarity_flip_fabric160.BCM8879X=0 +phy_tx_polarity_flip_fabric161.BCM8879X=1 +phy_tx_polarity_flip_fabric162.BCM8879X=0 +phy_tx_polarity_flip_fabric163.BCM8879X=1 + +phy_tx_polarity_flip_fabric164.BCM8879X=0 +phy_tx_polarity_flip_fabric165.BCM8879X=1 +phy_tx_polarity_flip_fabric166.BCM8879X=0 +phy_tx_polarity_flip_fabric167.BCM8879X=1 + +phy_tx_polarity_flip_fabric168.BCM8879X=0 +phy_tx_polarity_flip_fabric169.BCM8879X=1 +phy_tx_polarity_flip_fabric170.BCM8879X=0 +phy_tx_polarity_flip_fabric171.BCM8879X=1 + +phy_tx_polarity_flip_fabric172.BCM8879X=1 +phy_tx_polarity_flip_fabric173.BCM8879X=0 +phy_tx_polarity_flip_fabric174.BCM8879X=1 +phy_tx_polarity_flip_fabric175.BCM8879X=0 + +phy_tx_polarity_flip_fabric176.BCM8879X=0 +phy_tx_polarity_flip_fabric177.BCM8879X=1 +phy_tx_polarity_flip_fabric178.BCM8879X=0 +phy_tx_polarity_flip_fabric179.BCM8879X=1 + +phy_tx_polarity_flip_fabric180.BCM8879X=1 +phy_tx_polarity_flip_fabric181.BCM8879X=0 +phy_tx_polarity_flip_fabric182.BCM8879X=1 +phy_tx_polarity_flip_fabric183.BCM8879X=0 + +phy_tx_polarity_flip_fabric184.BCM8879X=0 +phy_tx_polarity_flip_fabric185.BCM8879X=1 +phy_tx_polarity_flip_fabric186.BCM8879X=0 +phy_tx_polarity_flip_fabric187.BCM8879X=1 + +phy_tx_polarity_flip_fabric188.BCM8879X=0 +phy_tx_polarity_flip_fabric189.BCM8879X=1 +phy_tx_polarity_flip_fabric190.BCM8879X=0 +phy_tx_polarity_flip_fabric191.BCM8879X=1 + +port_init_cl72_0=0 +port_init_cl72_1=0 +port_init_cl72_2=0 +port_init_cl72_3=0 +port_init_cl72_4=0 +port_init_cl72_5=0 +port_init_cl72_6=0 +port_init_cl72_7=0 +port_init_cl72_8=0 +port_init_cl72_9=0 +port_init_cl72_10=0 +port_init_cl72_11=0 +port_init_cl72_12=0 +port_init_cl72_13=0 +port_init_cl72_14=0 +port_init_cl72_15=0 +port_init_cl72_16=0 +port_init_cl72_17=0 +port_init_cl72_18=0 +port_init_cl72_19=0 +port_init_cl72_20=0 +port_init_cl72_21=0 +port_init_cl72_22=0 +port_init_cl72_23=0 +port_init_cl72_24=0 +port_init_cl72_25=0 +port_init_cl72_26=0 +port_init_cl72_27=0 +port_init_cl72_28=0 +port_init_cl72_29=0 +port_init_cl72_30=0 +port_init_cl72_31=0 +port_init_cl72_32=0 +port_init_cl72_33=0 +port_init_cl72_34=0 +port_init_cl72_35=0 +port_init_cl72_36=0 +port_init_cl72_37=0 +port_init_cl72_38=0 +port_init_cl72_39=0 +port_init_cl72_40=0 +port_init_cl72_41=0 +port_init_cl72_42=0 +port_init_cl72_43=0 +port_init_cl72_44=0 +port_init_cl72_45=0 +port_init_cl72_46=0 +port_init_cl72_47=0 +port_init_cl72_48=0 +port_init_cl72_49=0 +port_init_cl72_50=0 +port_init_cl72_51=0 +port_init_cl72_52=0 +port_init_cl72_53=0 +port_init_cl72_54=0 +port_init_cl72_55=0 +port_init_cl72_56=0 +port_init_cl72_57=0 +port_init_cl72_58=0 +port_init_cl72_59=0 +port_init_cl72_60=0 +port_init_cl72_61=0 +port_init_cl72_62=0 +port_init_cl72_63=0 +port_init_cl72_64=0 +port_init_cl72_65=0 +port_init_cl72_66=0 +port_init_cl72_67=0 +port_init_cl72_68=0 +port_init_cl72_69=0 +port_init_cl72_70=0 +port_init_cl72_71=0 +port_init_cl72_72=0 +port_init_cl72_73=0 +port_init_cl72_74=0 +port_init_cl72_75=0 +port_init_cl72_76=0 +port_init_cl72_77=0 +port_init_cl72_78=0 +port_init_cl72_79=0 +port_init_cl72_80=0 +port_init_cl72_81=0 +port_init_cl72_82=0 +port_init_cl72_83=0 +port_init_cl72_84=0 +port_init_cl72_85=0 +port_init_cl72_86=0 +port_init_cl72_87=0 +port_init_cl72_88=0 +port_init_cl72_89=0 +port_init_cl72_90=0 +port_init_cl72_91=0 +port_init_cl72_92=0 +port_init_cl72_93=0 +port_init_cl72_94=0 +port_init_cl72_95=0 +port_init_cl72_96=0 +port_init_cl72_97=0 +port_init_cl72_98=0 +port_init_cl72_99=0 +port_init_cl72_100=0 +port_init_cl72_101=0 +port_init_cl72_102=0 +port_init_cl72_103=0 +port_init_cl72_104=0 +port_init_cl72_105=0 +port_init_cl72_106=0 +port_init_cl72_107=0 +port_init_cl72_108=0 +port_init_cl72_109=0 +port_init_cl72_110=0 +port_init_cl72_111=0 +port_init_cl72_112=0 +port_init_cl72_113=0 +port_init_cl72_114=0 +port_init_cl72_115=0 +port_init_cl72_116=0 +port_init_cl72_117=0 +port_init_cl72_118=0 +port_init_cl72_119=0 +port_init_cl72_120=0 +port_init_cl72_121=0 +port_init_cl72_122=0 +port_init_cl72_123=0 +port_init_cl72_124=0 +port_init_cl72_125=0 +port_init_cl72_126=0 +port_init_cl72_127=0 +port_init_cl72_128=0 +port_init_cl72_129=0 +port_init_cl72_130=0 +port_init_cl72_131=0 +port_init_cl72_132=0 +port_init_cl72_133=0 +port_init_cl72_134=0 +port_init_cl72_135=0 +port_init_cl72_136=0 +port_init_cl72_137=0 +port_init_cl72_138=0 +port_init_cl72_139=0 +port_init_cl72_140=0 +port_init_cl72_141=0 +port_init_cl72_142=0 +port_init_cl72_143=0 +port_init_cl72_144=0 +port_init_cl72_145=0 +port_init_cl72_146=0 +port_init_cl72_147=0 +port_init_cl72_148=0 +port_init_cl72_149=0 +port_init_cl72_150=0 +port_init_cl72_151=0 +port_init_cl72_152=0 +port_init_cl72_153=0 +port_init_cl72_154=0 +port_init_cl72_155=0 +port_init_cl72_156=0 +port_init_cl72_157=0 +port_init_cl72_158=0 +port_init_cl72_159=0 +port_init_cl72_160=0 +port_init_cl72_161=0 +port_init_cl72_162=0 +port_init_cl72_163=0 +port_init_cl72_164=0 +port_init_cl72_165=0 +port_init_cl72_166=0 +port_init_cl72_167=0 +port_init_cl72_168=0 +port_init_cl72_169=0 +port_init_cl72_170=0 +port_init_cl72_171=0 +port_init_cl72_172=0 +port_init_cl72_173=0 +port_init_cl72_174=0 +port_init_cl72_175=0 +port_init_cl72_176=0 +port_init_cl72_177=0 +port_init_cl72_178=0 +port_init_cl72_179=0 +port_init_cl72_180=0 +port_init_cl72_181=0 +port_init_cl72_182=0 +port_init_cl72_183=0 +port_init_cl72_184=0 +port_init_cl72_185=0 +port_init_cl72_186=0 +port_init_cl72_187=0 +port_init_cl72_188=0 +port_init_cl72_189=0 +port_init_cl72_190=0 +port_init_cl72_191=0 + +serdes_tx_taps_0.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_1.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_2.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_3.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_4.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_5.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_6.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_7.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_8.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_9.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_10.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_11.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_12.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_13.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_14.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_15.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_16.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_17.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_18.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_19.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_20.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_21.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_22.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_23.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_24.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_25.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_26.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_27.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_28.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_29.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_30.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_31.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_32.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_33.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_34.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_35.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_36.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_37.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_38.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_39.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_40.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_41.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_42.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_43.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_44.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_45.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_46.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_47.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_48.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_49.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_50.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_51.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_52.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_53.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_54.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_55.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_56.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_57.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_58.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_59.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_60.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_61.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_62.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_63.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_64.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_65.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_66.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_67.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_68.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_69.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_70.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_71.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_72.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_73.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_74.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_75.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_76.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_77.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_78.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_79.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_80.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_81.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_82.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_83.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_84.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_85.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_86.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_87.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_88.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_89.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_90.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_91.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_92.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_93.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_94.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_95.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_96.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_97.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_98.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_99.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_100.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_101.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_102.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_103.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_104.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_105.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_106.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_107.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_108.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_109.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_110.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_111.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_112.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_113.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_114.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_115.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_116.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_117.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_118.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_119.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_120.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_121.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_122.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_123.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_124.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_125.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_126.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_127.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_128.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_129.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_130.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_131.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_132.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_133.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_134.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_135.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_136.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_137.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_138.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_139.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_140.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_141.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_142.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_143.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_144.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_145.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_146.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_147.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_148.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_149.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_150.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_151.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_152.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_153.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_154.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_155.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_156.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_157.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_158.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_159.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_160.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_161.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_162.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_163.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_164.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_165.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_166.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_167.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_168.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_169.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_170.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_171.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_172.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_173.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_174.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_175.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_176.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_177.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_178.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_179.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_180.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_181.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_182.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_183.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_184.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_185.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_186.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_187.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_188.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_189.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_190.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_191.BCM8879X=pam4:-24:132:-12:0:0:0 + +serdes_lane_config_channel_mode_0.0=force_nr +serdes_lane_config_channel_mode_1.0=force_nr +serdes_lane_config_channel_mode_2.0=force_nr +serdes_lane_config_channel_mode_3.0=force_nr +serdes_lane_config_channel_mode_4.0=force_nr +serdes_lane_config_channel_mode_5.0=force_nr +serdes_lane_config_channel_mode_6.0=force_nr +serdes_lane_config_channel_mode_7.0=force_nr +serdes_lane_config_channel_mode_8.0=force_nr +serdes_lane_config_channel_mode_9.0=force_nr +serdes_lane_config_channel_mode_10.0=force_nr +serdes_lane_config_channel_mode_11.0=force_nr +serdes_lane_config_channel_mode_12.0=force_nr +serdes_lane_config_channel_mode_13.0=force_nr +serdes_lane_config_channel_mode_14.0=force_nr +serdes_lane_config_channel_mode_15.0=force_nr +serdes_lane_config_channel_mode_16.0=force_nr +serdes_lane_config_channel_mode_17.0=force_nr +serdes_lane_config_channel_mode_18.0=force_nr +serdes_lane_config_channel_mode_19.0=force_nr +serdes_lane_config_channel_mode_20.0=force_nr +serdes_lane_config_channel_mode_21.0=force_nr +serdes_lane_config_channel_mode_22.0=force_nr +serdes_lane_config_channel_mode_23.0=force_nr +serdes_lane_config_channel_mode_24.0=force_nr +serdes_lane_config_channel_mode_25.0=force_nr +serdes_lane_config_channel_mode_26.0=force_nr +serdes_lane_config_channel_mode_27.0=force_nr +serdes_lane_config_channel_mode_28.0=force_nr +serdes_lane_config_channel_mode_29.0=force_nr +serdes_lane_config_channel_mode_30.0=force_nr +serdes_lane_config_channel_mode_31.0=force_nr +serdes_lane_config_channel_mode_32.0=force_nr +serdes_lane_config_channel_mode_33.0=force_nr +serdes_lane_config_channel_mode_34.0=force_nr +serdes_lane_config_channel_mode_35.0=force_nr +serdes_lane_config_channel_mode_36.0=force_nr +serdes_lane_config_channel_mode_37.0=force_nr +serdes_lane_config_channel_mode_38.0=force_nr +serdes_lane_config_channel_mode_39.0=force_nr +serdes_lane_config_channel_mode_40.0=force_nr +serdes_lane_config_channel_mode_41.0=force_nr +serdes_lane_config_channel_mode_42.0=force_nr +serdes_lane_config_channel_mode_43.0=force_nr +serdes_lane_config_channel_mode_44.0=force_nr +serdes_lane_config_channel_mode_45.0=force_nr +serdes_lane_config_channel_mode_46.0=force_nr +serdes_lane_config_channel_mode_47.0=force_nr +serdes_lane_config_channel_mode_48.0=force_nr +serdes_lane_config_channel_mode_49.0=force_nr +serdes_lane_config_channel_mode_50.0=force_nr +serdes_lane_config_channel_mode_51.0=force_nr +serdes_lane_config_channel_mode_52.0=force_nr +serdes_lane_config_channel_mode_53.0=force_nr +serdes_lane_config_channel_mode_54.0=force_nr +serdes_lane_config_channel_mode_55.0=force_nr +serdes_lane_config_channel_mode_56.0=force_nr +serdes_lane_config_channel_mode_57.0=force_nr +serdes_lane_config_channel_mode_58.0=force_nr +serdes_lane_config_channel_mode_59.0=force_nr +serdes_lane_config_channel_mode_60.0=force_nr +serdes_lane_config_channel_mode_61.0=force_nr +serdes_lane_config_channel_mode_62.0=force_nr +serdes_lane_config_channel_mode_63.0=force_nr +serdes_lane_config_channel_mode_64.0=force_nr +serdes_lane_config_channel_mode_65.0=force_nr +serdes_lane_config_channel_mode_66.0=force_nr +serdes_lane_config_channel_mode_67.0=force_nr +serdes_lane_config_channel_mode_68.0=force_nr +serdes_lane_config_channel_mode_69.0=force_nr +serdes_lane_config_channel_mode_70.0=force_nr +serdes_lane_config_channel_mode_71.0=force_nr +serdes_lane_config_channel_mode_72.0=force_nr +serdes_lane_config_channel_mode_73.0=force_nr +serdes_lane_config_channel_mode_74.0=force_nr +serdes_lane_config_channel_mode_75.0=force_nr +serdes_lane_config_channel_mode_76.0=force_nr +serdes_lane_config_channel_mode_77.0=force_nr +serdes_lane_config_channel_mode_78.0=force_nr +serdes_lane_config_channel_mode_79.0=force_nr +serdes_lane_config_channel_mode_80.0=force_nr +serdes_lane_config_channel_mode_81.0=force_nr +serdes_lane_config_channel_mode_82.0=force_nr +serdes_lane_config_channel_mode_83.0=force_nr +serdes_lane_config_channel_mode_84.0=force_nr +serdes_lane_config_channel_mode_85.0=force_nr +serdes_lane_config_channel_mode_86.0=force_nr +serdes_lane_config_channel_mode_87.0=force_nr +serdes_lane_config_channel_mode_88.0=force_nr +serdes_lane_config_channel_mode_89.0=force_nr +serdes_lane_config_channel_mode_90.0=force_nr +serdes_lane_config_channel_mode_91.0=force_nr +serdes_lane_config_channel_mode_92.0=force_nr +serdes_lane_config_channel_mode_93.0=force_nr +serdes_lane_config_channel_mode_94.0=force_nr +serdes_lane_config_channel_mode_95.0=force_nr +serdes_lane_config_channel_mode_96.0=force_nr +serdes_lane_config_channel_mode_97.0=force_nr +serdes_lane_config_channel_mode_98.0=force_nr +serdes_lane_config_channel_mode_99.0=force_nr +serdes_lane_config_channel_mode_100.0=force_nr +serdes_lane_config_channel_mode_101.0=force_nr +serdes_lane_config_channel_mode_102.0=force_nr +serdes_lane_config_channel_mode_103.0=force_nr +serdes_lane_config_channel_mode_104.0=force_nr +serdes_lane_config_channel_mode_105.0=force_nr +serdes_lane_config_channel_mode_106.0=force_nr +serdes_lane_config_channel_mode_107.0=force_nr +serdes_lane_config_channel_mode_108.0=force_nr +serdes_lane_config_channel_mode_109.0=force_nr +serdes_lane_config_channel_mode_110.0=force_nr +serdes_lane_config_channel_mode_111.0=force_nr +serdes_lane_config_channel_mode_112.0=force_nr +serdes_lane_config_channel_mode_113.0=force_nr +serdes_lane_config_channel_mode_114.0=force_nr +serdes_lane_config_channel_mode_115.0=force_nr +serdes_lane_config_channel_mode_116.0=force_nr +serdes_lane_config_channel_mode_117.0=force_nr +serdes_lane_config_channel_mode_118.0=force_nr +serdes_lane_config_channel_mode_119.0=force_nr +serdes_lane_config_channel_mode_120.0=force_nr +serdes_lane_config_channel_mode_121.0=force_nr +serdes_lane_config_channel_mode_122.0=force_nr +serdes_lane_config_channel_mode_123.0=force_nr +serdes_lane_config_channel_mode_124.0=force_nr +serdes_lane_config_channel_mode_125.0=force_nr +serdes_lane_config_channel_mode_126.0=force_nr +serdes_lane_config_channel_mode_127.0=force_nr +serdes_lane_config_channel_mode_128.0=force_nr +serdes_lane_config_channel_mode_129.0=force_nr +serdes_lane_config_channel_mode_130.0=force_nr +serdes_lane_config_channel_mode_131.0=force_nr +serdes_lane_config_channel_mode_132.0=force_nr +serdes_lane_config_channel_mode_133.0=force_nr +serdes_lane_config_channel_mode_134.0=force_nr +serdes_lane_config_channel_mode_135.0=force_nr +serdes_lane_config_channel_mode_136.0=force_nr +serdes_lane_config_channel_mode_137.0=force_nr +serdes_lane_config_channel_mode_138.0=force_nr +serdes_lane_config_channel_mode_139.0=force_nr +serdes_lane_config_channel_mode_140.0=force_nr +serdes_lane_config_channel_mode_141.0=force_nr +serdes_lane_config_channel_mode_142.0=force_nr +serdes_lane_config_channel_mode_143.0=force_nr +serdes_lane_config_channel_mode_144.0=force_nr +serdes_lane_config_channel_mode_145.0=force_nr +serdes_lane_config_channel_mode_146.0=force_nr +serdes_lane_config_channel_mode_147.0=force_nr +serdes_lane_config_channel_mode_148.0=force_nr +serdes_lane_config_channel_mode_149.0=force_nr +serdes_lane_config_channel_mode_150.0=force_nr +serdes_lane_config_channel_mode_151.0=force_nr +serdes_lane_config_channel_mode_152.0=force_nr +serdes_lane_config_channel_mode_153.0=force_nr +serdes_lane_config_channel_mode_154.0=force_nr +serdes_lane_config_channel_mode_155.0=force_nr +serdes_lane_config_channel_mode_156.0=force_nr +serdes_lane_config_channel_mode_157.0=force_nr +serdes_lane_config_channel_mode_158.0=force_nr +serdes_lane_config_channel_mode_159.0=force_nr +serdes_lane_config_channel_mode_160.0=force_nr +serdes_lane_config_channel_mode_161.0=force_nr +serdes_lane_config_channel_mode_162.0=force_nr +serdes_lane_config_channel_mode_163.0=force_nr +serdes_lane_config_channel_mode_164.0=force_nr +serdes_lane_config_channel_mode_165.0=force_nr +serdes_lane_config_channel_mode_166.0=force_nr +serdes_lane_config_channel_mode_167.0=force_nr +serdes_lane_config_channel_mode_168.0=force_nr +serdes_lane_config_channel_mode_169.0=force_nr +serdes_lane_config_channel_mode_170.0=force_nr +serdes_lane_config_channel_mode_171.0=force_nr +serdes_lane_config_channel_mode_172.0=force_nr +serdes_lane_config_channel_mode_173.0=force_nr +serdes_lane_config_channel_mode_174.0=force_nr +serdes_lane_config_channel_mode_175.0=force_nr +serdes_lane_config_channel_mode_176.0=force_nr +serdes_lane_config_channel_mode_177.0=force_nr +serdes_lane_config_channel_mode_178.0=force_nr +serdes_lane_config_channel_mode_179.0=force_nr +serdes_lane_config_channel_mode_180.0=force_nr +serdes_lane_config_channel_mode_181.0=force_nr +serdes_lane_config_channel_mode_182.0=force_nr +serdes_lane_config_channel_mode_183.0=force_nr +serdes_lane_config_channel_mode_184.0=force_nr +serdes_lane_config_channel_mode_185.0=force_nr +serdes_lane_config_channel_mode_186.0=force_nr +serdes_lane_config_channel_mode_187.0=force_nr +serdes_lane_config_channel_mode_188.0=force_nr +serdes_lane_config_channel_mode_189.0=force_nr +serdes_lane_config_channel_mode_190.0=force_nr +serdes_lane_config_channel_mode_191.0=force_nr + + +serdes_qrtt_active_0.0=1 +serdes_qrtt_active_1.0=1 +serdes_qrtt_active_2.0=1 +serdes_qrtt_active_3.0=1 +serdes_qrtt_active_4.0=1 +serdes_qrtt_active_5.0=1 +serdes_qrtt_active_6.0=1 +serdes_qrtt_active_7.0=1 +serdes_qrtt_active_8.0=1 +serdes_qrtt_active_9.0=1 +serdes_qrtt_active_10.0=1 +serdes_qrtt_active_11.0=1 +serdes_qrtt_active_12.0=1 +serdes_qrtt_active_13.0=1 +serdes_qrtt_active_14.0=1 +serdes_qrtt_active_15.0=1 +serdes_qrtt_active_16.0=1 +serdes_qrtt_active_17.0=1 +serdes_qrtt_active_18.0=1 +serdes_qrtt_active_19.0=1 +serdes_qrtt_active_20.0=1 +serdes_qrtt_active_21.0=1 +serdes_qrtt_active_22.0=1 +serdes_qrtt_active_23.0=1 +serdes_qrtt_active_24.0=1 +serdes_qrtt_active_25.0=1 +serdes_qrtt_active_26.0=1 +serdes_qrtt_active_27.0=1 +serdes_qrtt_active_28.0=1 +serdes_qrtt_active_29.0=1 +serdes_qrtt_active_30.0=1 +serdes_qrtt_active_31.0=1 +serdes_qrtt_active_32.0=1 +serdes_qrtt_active_33.0=1 +serdes_qrtt_active_34.0=1 +serdes_qrtt_active_35.0=1 +serdes_qrtt_active_36.0=1 +serdes_qrtt_active_37.0=1 +serdes_qrtt_active_38.0=1 +serdes_qrtt_active_39.0=1 +serdes_qrtt_active_40.0=1 +serdes_qrtt_active_41.0=1 +serdes_qrtt_active_42.0=1 +serdes_qrtt_active_43.0=1 +serdes_qrtt_active_44.0=1 +serdes_qrtt_active_45.0=1 +serdes_qrtt_active_46.0=1 +serdes_qrtt_active_47.0=1 diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/6/config-ramon-4-0.bcm b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/6/config-ramon-4-0.bcm new file mode 100644 index 000000000000..017ac5ccd40c --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/6/config-ramon-4-0.bcm @@ -0,0 +1,1394 @@ + +appl_enable_intr_init.BCM8879X=0 +appl_param_module_id.BCM8879X=7 +bcm_linkscan_interval.BCM8879X=0 +bcm_stat_interval.BCM8879X=4000000 +bist_enable.BCM8879X=0 +core_clock_speed_khz.BCM8879X=1000000 +custom_feature_access_only.BCM8879X=0 +custom_feature_lane_swap_disable.BCM8879X=0 +dport_map_direct.BCM8879X=1 +fabric_cell_fifo_dma_enable.BCM8879X=0 +fabric_device_mode.BCM8879X=SINGLE_STAGE_FE2 +fabric_load_balancing_mode.BCM8879X=NORMAL_LOAD_BALANCE +fabric_multicast_mode.BCM8879X=DIRECT +fabric_num_pipes.BCM8879X=1 +fabric_pipe_map.BCM8879X=0 +fe_mc_id_range.BCM8879X=128K +load_firmware.BCM8879X=0x102 +mdio_output_delay_ext.BCM8879X=14 +mdio_output_delay_int.BCM8879X=25 +mem_cache_enable_parity.BCM8879X=1 +mm_intr_enable.BCM8879X=0 +mm_timeout_usec.BCM8879X=300000 +polled_irq_delay.BCM8879X=100000 +polled_irq_mode.BCM8879X=1 +port_fec.BCM8879X=7 +port_init_cl72.BCM8879X=0 +port_init_speed.BCM8879X=53125 +rate_ext_mdio_divisor.BCM8879X=14 +rate_int_mdio_divisor.BCM8879X=50 +schan_intr_enable.BCM8879X=0 +schan_timeout_usec.BCM8879X=300000 +serdes_fabric_clk_freq_in.BCM8879X=1 +serdes_fabric_clk_freq_out.BCM8879X=bypass +soc_family.BCM8879X=BCM8879X +srd_tx_drv_hv_disable.BCM8879X=0 +system_contains_multiple_pipe_device.BCM8879X=0 +system_ref_core_clock_khz.BCM8879X=1200000 +table_dma_enable.BCM8879X=0 +tdma_intr_enable.BCM8879X=0 +tdma_timeout_usec.BCM8879X=5000000 +tslam_dma_enable.BCM8879X=0 +tslam_intr_enable.BCM8879X=0 +tslam_timeout_usec.BCM8879X=5000000 + +lane_to_serdes_map_fabric_lane0.BCM8879X=rx0:tx0 +lane_to_serdes_map_fabric_lane1.BCM8879X=rx1:tx1 +lane_to_serdes_map_fabric_lane2.BCM8879X=rx2:tx2 +lane_to_serdes_map_fabric_lane3.BCM8879X=rx3:tx3 + +lane_to_serdes_map_fabric_lane4.BCM8879X=rx4:tx4 +lane_to_serdes_map_fabric_lane5.BCM8879X=rx5:tx5 +lane_to_serdes_map_fabric_lane6.BCM8879X=rx6:tx6 +lane_to_serdes_map_fabric_lane7.BCM8879X=rx7:tx7 + +lane_to_serdes_map_fabric_lane8.BCM8879X=rx8:tx8 +lane_to_serdes_map_fabric_lane9.BCM8879X=rx9:tx9 +lane_to_serdes_map_fabric_lane10.BCM8879X=rx10:tx10 +lane_to_serdes_map_fabric_lane11.BCM8879X=rx11:tx11 + +lane_to_serdes_map_fabric_lane12.BCM8879X=rx12:tx12 +lane_to_serdes_map_fabric_lane13.BCM8879X=rx13:tx13 +lane_to_serdes_map_fabric_lane14.BCM8879X=rx14:tx14 +lane_to_serdes_map_fabric_lane15.BCM8879X=rx15:tx15 + +lane_to_serdes_map_fabric_lane16.BCM8879X=rx16:tx16 +lane_to_serdes_map_fabric_lane17.BCM8879X=rx17:tx17 +lane_to_serdes_map_fabric_lane18.BCM8879X=rx18:tx18 +lane_to_serdes_map_fabric_lane19.BCM8879X=rx19:tx19 + +lane_to_serdes_map_fabric_lane20.BCM8879X=rx20:tx20 +lane_to_serdes_map_fabric_lane21.BCM8879X=rx21:tx21 +lane_to_serdes_map_fabric_lane22.BCM8879X=rx22:tx22 +lane_to_serdes_map_fabric_lane23.BCM8879X=rx23:tx23 + +lane_to_serdes_map_fabric_lane24.BCM8879X=rx24:tx24 +lane_to_serdes_map_fabric_lane25.BCM8879X=rx25:tx25 +lane_to_serdes_map_fabric_lane26.BCM8879X=rx26:tx26 +lane_to_serdes_map_fabric_lane27.BCM8879X=rx27:tx27 + +lane_to_serdes_map_fabric_lane28.BCM8879X=rx28:tx28 +lane_to_serdes_map_fabric_lane29.BCM8879X=rx29:tx29 +lane_to_serdes_map_fabric_lane30.BCM8879X=rx30:tx30 +lane_to_serdes_map_fabric_lane31.BCM8879X=rx31:tx31 + +lane_to_serdes_map_fabric_lane32.BCM8879X=rx32:tx32 +lane_to_serdes_map_fabric_lane33.BCM8879X=rx33:tx33 +lane_to_serdes_map_fabric_lane34.BCM8879X=rx34:tx34 +lane_to_serdes_map_fabric_lane35.BCM8879X=rx35:tx35 + +lane_to_serdes_map_fabric_lane36.BCM8879X=rx36:tx36 +lane_to_serdes_map_fabric_lane37.BCM8879X=rx37:tx37 +lane_to_serdes_map_fabric_lane38.BCM8879X=rx38:tx38 +lane_to_serdes_map_fabric_lane39.BCM8879X=rx39:tx39 + +lane_to_serdes_map_fabric_lane40.BCM8879X=rx40:tx40 +lane_to_serdes_map_fabric_lane41.BCM8879X=rx41:tx41 +lane_to_serdes_map_fabric_lane42.BCM8879X=rx42:tx42 +lane_to_serdes_map_fabric_lane43.BCM8879X=rx43:tx43 + +lane_to_serdes_map_fabric_lane44.BCM8879X=rx44:tx44 +lane_to_serdes_map_fabric_lane45.BCM8879X=rx45:tx45 +lane_to_serdes_map_fabric_lane46.BCM8879X=rx46:tx46 +lane_to_serdes_map_fabric_lane47.BCM8879X=rx47:tx47 + +lane_to_serdes_map_fabric_lane48.BCM8879X=rx48:tx48 +lane_to_serdes_map_fabric_lane49.BCM8879X=rx49:tx49 +lane_to_serdes_map_fabric_lane50.BCM8879X=rx50:tx50 +lane_to_serdes_map_fabric_lane51.BCM8879X=rx51:tx51 + +lane_to_serdes_map_fabric_lane52.BCM8879X=rx52:tx52 +lane_to_serdes_map_fabric_lane53.BCM8879X=rx53:tx53 +lane_to_serdes_map_fabric_lane54.BCM8879X=rx54:tx54 +lane_to_serdes_map_fabric_lane55.BCM8879X=rx55:tx55 + +lane_to_serdes_map_fabric_lane56.BCM8879X=rx56:tx56 +lane_to_serdes_map_fabric_lane57.BCM8879X=rx57:tx57 +lane_to_serdes_map_fabric_lane58.BCM8879X=rx58:tx58 +lane_to_serdes_map_fabric_lane59.BCM8879X=rx59:tx59 + +lane_to_serdes_map_fabric_lane60.BCM8879X=rx60:tx60 +lane_to_serdes_map_fabric_lane61.BCM8879X=rx61:tx61 +lane_to_serdes_map_fabric_lane62.BCM8879X=rx62:tx62 +lane_to_serdes_map_fabric_lane63.BCM8879X=rx63:tx63 + +lane_to_serdes_map_fabric_lane64.BCM8879X=rx64:tx64 +lane_to_serdes_map_fabric_lane65.BCM8879X=rx65:tx65 +lane_to_serdes_map_fabric_lane66.BCM8879X=rx66:tx66 +lane_to_serdes_map_fabric_lane67.BCM8879X=rx67:tx67 + +lane_to_serdes_map_fabric_lane68.BCM8879X=rx68:tx68 +lane_to_serdes_map_fabric_lane69.BCM8879X=rx69:tx69 +lane_to_serdes_map_fabric_lane70.BCM8879X=rx70:tx70 +lane_to_serdes_map_fabric_lane71.BCM8879X=rx71:tx71 + +lane_to_serdes_map_fabric_lane72.BCM8879X=rx72:tx72 +lane_to_serdes_map_fabric_lane73.BCM8879X=rx73:tx73 +lane_to_serdes_map_fabric_lane74.BCM8879X=rx74:tx74 +lane_to_serdes_map_fabric_lane75.BCM8879X=rx75:tx75 + +lane_to_serdes_map_fabric_lane76.BCM8879X=rx76:tx76 +lane_to_serdes_map_fabric_lane77.BCM8879X=rx77:tx77 +lane_to_serdes_map_fabric_lane78.BCM8879X=rx78:tx78 +lane_to_serdes_map_fabric_lane79.BCM8879X=rx79:tx79 + +lane_to_serdes_map_fabric_lane80.BCM8879X=rx80:tx80 +lane_to_serdes_map_fabric_lane81.BCM8879X=rx81:tx81 +lane_to_serdes_map_fabric_lane82.BCM8879X=rx82:tx82 +lane_to_serdes_map_fabric_lane83.BCM8879X=rx83:tx83 + +lane_to_serdes_map_fabric_lane84.BCM8879X=rx84:tx84 +lane_to_serdes_map_fabric_lane85.BCM8879X=rx85:tx85 +lane_to_serdes_map_fabric_lane86.BCM8879X=rx86:tx86 +lane_to_serdes_map_fabric_lane87.BCM8879X=rx87:tx87 + +lane_to_serdes_map_fabric_lane88.BCM8879X=rx88:tx88 +lane_to_serdes_map_fabric_lane89.BCM8879X=rx89:tx89 +lane_to_serdes_map_fabric_lane90.BCM8879X=rx90:tx90 +lane_to_serdes_map_fabric_lane91.BCM8879X=rx91:tx91 + +lane_to_serdes_map_fabric_lane92.BCM8879X=rx92:tx92 +lane_to_serdes_map_fabric_lane93.BCM8879X=rx93:tx93 +lane_to_serdes_map_fabric_lane94.BCM8879X=rx94:tx94 +lane_to_serdes_map_fabric_lane95.BCM8879X=rx95:tx95 + +lane_to_serdes_map_fabric_lane96.BCM8879X=rx96:tx96 +lane_to_serdes_map_fabric_lane97.BCM8879X=rx97:tx97 +lane_to_serdes_map_fabric_lane98.BCM8879X=rx98:tx98 +lane_to_serdes_map_fabric_lane99.BCM8879X=rx99:tx99 + +lane_to_serdes_map_fabric_lane100.BCM8879X=rx100:tx100 +lane_to_serdes_map_fabric_lane101.BCM8879X=rx101:tx101 +lane_to_serdes_map_fabric_lane102.BCM8879X=rx102:tx102 +lane_to_serdes_map_fabric_lane103.BCM8879X=rx103:tx103 + +lane_to_serdes_map_fabric_lane104.BCM8879X=rx104:tx104 +lane_to_serdes_map_fabric_lane105.BCM8879X=rx105:tx105 +lane_to_serdes_map_fabric_lane106.BCM8879X=rx106:tx106 +lane_to_serdes_map_fabric_lane107.BCM8879X=rx107:tx107 + +lane_to_serdes_map_fabric_lane108.BCM8879X=rx108:tx108 +lane_to_serdes_map_fabric_lane109.BCM8879X=rx109:tx109 +lane_to_serdes_map_fabric_lane110.BCM8879X=rx110:tx110 +lane_to_serdes_map_fabric_lane111.BCM8879X=rx111:tx111 + +lane_to_serdes_map_fabric_lane112.BCM8879X=rx112:tx112 +lane_to_serdes_map_fabric_lane113.BCM8879X=rx113:tx113 +lane_to_serdes_map_fabric_lane114.BCM8879X=rx114:tx114 +lane_to_serdes_map_fabric_lane115.BCM8879X=rx115:tx115 + +lane_to_serdes_map_fabric_lane116.BCM8879X=rx116:tx116 +lane_to_serdes_map_fabric_lane117.BCM8879X=rx117:tx117 +lane_to_serdes_map_fabric_lane118.BCM8879X=rx118:tx118 +lane_to_serdes_map_fabric_lane119.BCM8879X=rx119:tx119 + +lane_to_serdes_map_fabric_lane120.BCM8879X=rx120:tx120 +lane_to_serdes_map_fabric_lane121.BCM8879X=rx121:tx121 +lane_to_serdes_map_fabric_lane122.BCM8879X=rx122:tx122 +lane_to_serdes_map_fabric_lane123.BCM8879X=rx123:tx123 + +lane_to_serdes_map_fabric_lane124.BCM8879X=rx124:tx124 +lane_to_serdes_map_fabric_lane125.BCM8879X=rx125:tx125 +lane_to_serdes_map_fabric_lane126.BCM8879X=rx126:tx126 +lane_to_serdes_map_fabric_lane127.BCM8879X=rx127:tx127 + +lane_to_serdes_map_fabric_lane128.BCM8879X=rx128:tx128 +lane_to_serdes_map_fabric_lane129.BCM8879X=rx129:tx129 +lane_to_serdes_map_fabric_lane130.BCM8879X=rx130:tx130 +lane_to_serdes_map_fabric_lane131.BCM8879X=rx131:tx131 + +lane_to_serdes_map_fabric_lane132.BCM8879X=rx132:tx132 +lane_to_serdes_map_fabric_lane133.BCM8879X=rx133:tx133 +lane_to_serdes_map_fabric_lane134.BCM8879X=rx134:tx134 +lane_to_serdes_map_fabric_lane135.BCM8879X=rx135:tx135 + +lane_to_serdes_map_fabric_lane136.BCM8879X=rx136:tx136 +lane_to_serdes_map_fabric_lane137.BCM8879X=rx137:tx137 +lane_to_serdes_map_fabric_lane138.BCM8879X=rx138:tx138 +lane_to_serdes_map_fabric_lane139.BCM8879X=rx139:tx139 + +lane_to_serdes_map_fabric_lane140.BCM8879X=rx140:tx140 +lane_to_serdes_map_fabric_lane141.BCM8879X=rx141:tx141 +lane_to_serdes_map_fabric_lane142.BCM8879X=rx142:tx142 +lane_to_serdes_map_fabric_lane143.BCM8879X=rx143:tx143 + +lane_to_serdes_map_fabric_lane144.BCM8879X=rx144:tx144 +lane_to_serdes_map_fabric_lane145.BCM8879X=rx145:tx145 +lane_to_serdes_map_fabric_lane146.BCM8879X=rx146:tx146 +lane_to_serdes_map_fabric_lane147.BCM8879X=rx147:tx147 + +lane_to_serdes_map_fabric_lane148.BCM8879X=rx148:tx148 +lane_to_serdes_map_fabric_lane149.BCM8879X=rx149:tx149 +lane_to_serdes_map_fabric_lane150.BCM8879X=rx150:tx150 +lane_to_serdes_map_fabric_lane151.BCM8879X=rx151:tx151 + +lane_to_serdes_map_fabric_lane152.BCM8879X=rx152:tx152 +lane_to_serdes_map_fabric_lane153.BCM8879X=rx153:tx153 +lane_to_serdes_map_fabric_lane154.BCM8879X=rx154:tx154 +lane_to_serdes_map_fabric_lane155.BCM8879X=rx155:tx155 + +lane_to_serdes_map_fabric_lane156.BCM8879X=rx156:tx156 +lane_to_serdes_map_fabric_lane157.BCM8879X=rx157:tx157 +lane_to_serdes_map_fabric_lane158.BCM8879X=rx158:tx158 +lane_to_serdes_map_fabric_lane159.BCM8879X=rx159:tx159 + +lane_to_serdes_map_fabric_lane160.BCM8879X=rx160:tx160 +lane_to_serdes_map_fabric_lane161.BCM8879X=rx161:tx161 +lane_to_serdes_map_fabric_lane162.BCM8879X=rx162:tx162 +lane_to_serdes_map_fabric_lane163.BCM8879X=rx163:tx163 + +lane_to_serdes_map_fabric_lane164.BCM8879X=rx164:tx164 +lane_to_serdes_map_fabric_lane165.BCM8879X=rx165:tx165 +lane_to_serdes_map_fabric_lane166.BCM8879X=rx166:tx166 +lane_to_serdes_map_fabric_lane167.BCM8879X=rx167:tx167 + +lane_to_serdes_map_fabric_lane168.BCM8879X=rx168:tx168 +lane_to_serdes_map_fabric_lane169.BCM8879X=rx169:tx169 +lane_to_serdes_map_fabric_lane170.BCM8879X=rx170:tx170 +lane_to_serdes_map_fabric_lane171.BCM8879X=rx171:tx171 + +lane_to_serdes_map_fabric_lane172.BCM8879X=rx172:tx172 +lane_to_serdes_map_fabric_lane173.BCM8879X=rx173:tx173 +lane_to_serdes_map_fabric_lane174.BCM8879X=rx174:tx174 +lane_to_serdes_map_fabric_lane175.BCM8879X=rx175:tx175 + +lane_to_serdes_map_fabric_lane176.BCM8879X=rx176:tx176 +lane_to_serdes_map_fabric_lane177.BCM8879X=rx177:tx177 +lane_to_serdes_map_fabric_lane178.BCM8879X=rx178:tx178 +lane_to_serdes_map_fabric_lane179.BCM8879X=rx179:tx179 + +lane_to_serdes_map_fabric_lane180.BCM8879X=rx180:tx180 +lane_to_serdes_map_fabric_lane181.BCM8879X=rx181:tx181 +lane_to_serdes_map_fabric_lane182.BCM8879X=rx182:tx182 +lane_to_serdes_map_fabric_lane183.BCM8879X=rx183:tx183 + +lane_to_serdes_map_fabric_lane184.BCM8879X=rx184:tx184 +lane_to_serdes_map_fabric_lane185.BCM8879X=rx185:tx185 +lane_to_serdes_map_fabric_lane186.BCM8879X=rx186:tx186 +lane_to_serdes_map_fabric_lane187.BCM8879X=rx187:tx187 + +lane_to_serdes_map_fabric_lane188.BCM8879X=rx188:tx188 +lane_to_serdes_map_fabric_lane189.BCM8879X=rx189:tx189 +lane_to_serdes_map_fabric_lane190.BCM8879X=rx190:tx190 +lane_to_serdes_map_fabric_lane191.BCM8879X=rx191:tx191 + + +phy_rx_polarity_flip_fabric0.BCM8879X=1 +phy_rx_polarity_flip_fabric1.BCM8879X=0 +phy_rx_polarity_flip_fabric2.BCM8879X=1 +phy_rx_polarity_flip_fabric3.BCM8879X=0 + +phy_rx_polarity_flip_fabric4.BCM8879X=0 +phy_rx_polarity_flip_fabric5.BCM8879X=1 +phy_rx_polarity_flip_fabric6.BCM8879X=0 +phy_rx_polarity_flip_fabric7.BCM8879X=1 + +phy_rx_polarity_flip_fabric8.BCM8879X=1 +phy_rx_polarity_flip_fabric9.BCM8879X=0 +phy_rx_polarity_flip_fabric10.BCM8879X=1 +phy_rx_polarity_flip_fabric11.BCM8879X=0 + +phy_rx_polarity_flip_fabric12.BCM8879X=0 +phy_rx_polarity_flip_fabric13.BCM8879X=1 +phy_rx_polarity_flip_fabric14.BCM8879X=0 +phy_rx_polarity_flip_fabric15.BCM8879X=1 + +phy_rx_polarity_flip_fabric16.BCM8879X=1 +phy_rx_polarity_flip_fabric17.BCM8879X=0 +phy_rx_polarity_flip_fabric18.BCM8879X=1 +phy_rx_polarity_flip_fabric19.BCM8879X=0 + +phy_rx_polarity_flip_fabric20.BCM8879X=1 +phy_rx_polarity_flip_fabric21.BCM8879X=0 +phy_rx_polarity_flip_fabric22.BCM8879X=1 +phy_rx_polarity_flip_fabric23.BCM8879X=0 + +phy_rx_polarity_flip_fabric24.BCM8879X=1 +phy_rx_polarity_flip_fabric25.BCM8879X=0 +phy_rx_polarity_flip_fabric26.BCM8879X=1 +phy_rx_polarity_flip_fabric27.BCM8879X=0 + +phy_rx_polarity_flip_fabric28.BCM8879X=0 +phy_rx_polarity_flip_fabric29.BCM8879X=1 +phy_rx_polarity_flip_fabric30.BCM8879X=0 +phy_rx_polarity_flip_fabric31.BCM8879X=1 + +phy_rx_polarity_flip_fabric32.BCM8879X=1 +phy_rx_polarity_flip_fabric33.BCM8879X=0 +phy_rx_polarity_flip_fabric34.BCM8879X=1 +phy_rx_polarity_flip_fabric35.BCM8879X=0 + +phy_rx_polarity_flip_fabric36.BCM8879X=0 +phy_rx_polarity_flip_fabric37.BCM8879X=1 +phy_rx_polarity_flip_fabric38.BCM8879X=0 +phy_rx_polarity_flip_fabric39.BCM8879X=1 + +phy_rx_polarity_flip_fabric40.BCM8879X=1 +phy_rx_polarity_flip_fabric41.BCM8879X=0 +phy_rx_polarity_flip_fabric42.BCM8879X=1 +phy_rx_polarity_flip_fabric43.BCM8879X=0 + +phy_rx_polarity_flip_fabric44.BCM8879X=1 +phy_rx_polarity_flip_fabric45.BCM8879X=0 +phy_rx_polarity_flip_fabric46.BCM8879X=1 +phy_rx_polarity_flip_fabric47.BCM8879X=0 + +phy_rx_polarity_flip_fabric48.BCM8879X=0 +phy_rx_polarity_flip_fabric49.BCM8879X=1 +phy_rx_polarity_flip_fabric50.BCM8879X=0 +phy_rx_polarity_flip_fabric51.BCM8879X=1 + +phy_rx_polarity_flip_fabric52.BCM8879X=1 +phy_rx_polarity_flip_fabric53.BCM8879X=0 +phy_rx_polarity_flip_fabric54.BCM8879X=1 +phy_rx_polarity_flip_fabric55.BCM8879X=0 + +phy_rx_polarity_flip_fabric56.BCM8879X=0 +phy_rx_polarity_flip_fabric57.BCM8879X=1 +phy_rx_polarity_flip_fabric58.BCM8879X=0 +phy_rx_polarity_flip_fabric59.BCM8879X=1 + +phy_rx_polarity_flip_fabric60.BCM8879X=0 +phy_rx_polarity_flip_fabric61.BCM8879X=1 +phy_rx_polarity_flip_fabric62.BCM8879X=0 +phy_rx_polarity_flip_fabric63.BCM8879X=1 + +phy_rx_polarity_flip_fabric64.BCM8879X=1 +phy_rx_polarity_flip_fabric65.BCM8879X=0 +phy_rx_polarity_flip_fabric66.BCM8879X=1 +phy_rx_polarity_flip_fabric67.BCM8879X=0 + +phy_rx_polarity_flip_fabric68.BCM8879X=0 +phy_rx_polarity_flip_fabric69.BCM8879X=1 +phy_rx_polarity_flip_fabric70.BCM8879X=0 +phy_rx_polarity_flip_fabric71.BCM8879X=1 + +phy_rx_polarity_flip_fabric72.BCM8879X=1 +phy_rx_polarity_flip_fabric73.BCM8879X=0 +phy_rx_polarity_flip_fabric74.BCM8879X=1 +phy_rx_polarity_flip_fabric75.BCM8879X=0 + +phy_rx_polarity_flip_fabric76.BCM8879X=1 +phy_rx_polarity_flip_fabric77.BCM8879X=0 +phy_rx_polarity_flip_fabric78.BCM8879X=1 +phy_rx_polarity_flip_fabric79.BCM8879X=0 + +phy_rx_polarity_flip_fabric80.BCM8879X=0 +phy_rx_polarity_flip_fabric81.BCM8879X=1 +phy_rx_polarity_flip_fabric82.BCM8879X=0 +phy_rx_polarity_flip_fabric83.BCM8879X=1 + +phy_rx_polarity_flip_fabric84.BCM8879X=1 +phy_rx_polarity_flip_fabric85.BCM8879X=0 +phy_rx_polarity_flip_fabric86.BCM8879X=1 +phy_rx_polarity_flip_fabric87.BCM8879X=0 + +phy_rx_polarity_flip_fabric88.BCM8879X=0 +phy_rx_polarity_flip_fabric89.BCM8879X=1 +phy_rx_polarity_flip_fabric90.BCM8879X=0 +phy_rx_polarity_flip_fabric91.BCM8879X=1 + +phy_rx_polarity_flip_fabric92.BCM8879X=1 +phy_rx_polarity_flip_fabric93.BCM8879X=0 +phy_rx_polarity_flip_fabric94.BCM8879X=1 +phy_rx_polarity_flip_fabric95.BCM8879X=0 + +phy_rx_polarity_flip_fabric96.BCM8879X=1 +phy_rx_polarity_flip_fabric97.BCM8879X=0 +phy_rx_polarity_flip_fabric98.BCM8879X=1 +phy_rx_polarity_flip_fabric99.BCM8879X=0 + +phy_rx_polarity_flip_fabric100.BCM8879X=0 +phy_rx_polarity_flip_fabric101.BCM8879X=1 +phy_rx_polarity_flip_fabric102.BCM8879X=0 +phy_rx_polarity_flip_fabric103.BCM8879X=1 + +phy_rx_polarity_flip_fabric104.BCM8879X=0 +phy_rx_polarity_flip_fabric105.BCM8879X=1 +phy_rx_polarity_flip_fabric106.BCM8879X=0 +phy_rx_polarity_flip_fabric107.BCM8879X=1 + +phy_rx_polarity_flip_fabric108.BCM8879X=0 +phy_rx_polarity_flip_fabric109.BCM8879X=1 +phy_rx_polarity_flip_fabric110.BCM8879X=0 +phy_rx_polarity_flip_fabric111.BCM8879X=1 + +phy_rx_polarity_flip_fabric112.BCM8879X=0 +phy_rx_polarity_flip_fabric113.BCM8879X=1 +phy_rx_polarity_flip_fabric114.BCM8879X=0 +phy_rx_polarity_flip_fabric115.BCM8879X=1 + +phy_rx_polarity_flip_fabric116.BCM8879X=1 +phy_rx_polarity_flip_fabric117.BCM8879X=0 +phy_rx_polarity_flip_fabric118.BCM8879X=1 +phy_rx_polarity_flip_fabric119.BCM8879X=0 + +phy_rx_polarity_flip_fabric120.BCM8879X=1 +phy_rx_polarity_flip_fabric121.BCM8879X=0 +phy_rx_polarity_flip_fabric122.BCM8879X=1 +phy_rx_polarity_flip_fabric123.BCM8879X=0 + +phy_rx_polarity_flip_fabric124.BCM8879X=0 +phy_rx_polarity_flip_fabric125.BCM8879X=1 +phy_rx_polarity_flip_fabric126.BCM8879X=0 +phy_rx_polarity_flip_fabric127.BCM8879X=1 + +phy_rx_polarity_flip_fabric128.BCM8879X=1 +phy_rx_polarity_flip_fabric129.BCM8879X=0 +phy_rx_polarity_flip_fabric130.BCM8879X=1 +phy_rx_polarity_flip_fabric131.BCM8879X=0 + +phy_rx_polarity_flip_fabric132.BCM8879X=0 +phy_rx_polarity_flip_fabric133.BCM8879X=1 +phy_rx_polarity_flip_fabric134.BCM8879X=0 +phy_rx_polarity_flip_fabric135.BCM8879X=1 + +phy_rx_polarity_flip_fabric136.BCM8879X=1 +phy_rx_polarity_flip_fabric137.BCM8879X=0 +phy_rx_polarity_flip_fabric138.BCM8879X=1 +phy_rx_polarity_flip_fabric139.BCM8879X=0 + +phy_rx_polarity_flip_fabric140.BCM8879X=1 +phy_rx_polarity_flip_fabric141.BCM8879X=0 +phy_rx_polarity_flip_fabric142.BCM8879X=1 +phy_rx_polarity_flip_fabric143.BCM8879X=0 + +phy_rx_polarity_flip_fabric144.BCM8879X=1 +phy_rx_polarity_flip_fabric145.BCM8879X=0 +phy_rx_polarity_flip_fabric146.BCM8879X=1 +phy_rx_polarity_flip_fabric147.BCM8879X=0 + +phy_rx_polarity_flip_fabric148.BCM8879X=1 +phy_rx_polarity_flip_fabric149.BCM8879X=0 +phy_rx_polarity_flip_fabric150.BCM8879X=1 +phy_rx_polarity_flip_fabric151.BCM8879X=0 + +phy_rx_polarity_flip_fabric152.BCM8879X=0 +phy_rx_polarity_flip_fabric153.BCM8879X=1 +phy_rx_polarity_flip_fabric154.BCM8879X=0 +phy_rx_polarity_flip_fabric155.BCM8879X=1 + +phy_rx_polarity_flip_fabric156.BCM8879X=1 +phy_rx_polarity_flip_fabric157.BCM8879X=0 +phy_rx_polarity_flip_fabric158.BCM8879X=1 +phy_rx_polarity_flip_fabric159.BCM8879X=0 + +phy_rx_polarity_flip_fabric160.BCM8879X=1 +phy_rx_polarity_flip_fabric161.BCM8879X=0 +phy_rx_polarity_flip_fabric162.BCM8879X=1 +phy_rx_polarity_flip_fabric163.BCM8879X=0 + +phy_rx_polarity_flip_fabric164.BCM8879X=0 +phy_rx_polarity_flip_fabric165.BCM8879X=1 +phy_rx_polarity_flip_fabric166.BCM8879X=0 +phy_rx_polarity_flip_fabric167.BCM8879X=1 + +phy_rx_polarity_flip_fabric168.BCM8879X=1 +phy_rx_polarity_flip_fabric169.BCM8879X=0 +phy_rx_polarity_flip_fabric170.BCM8879X=1 +phy_rx_polarity_flip_fabric171.BCM8879X=0 + +phy_rx_polarity_flip_fabric172.BCM8879X=1 +phy_rx_polarity_flip_fabric173.BCM8879X=0 +phy_rx_polarity_flip_fabric174.BCM8879X=1 +phy_rx_polarity_flip_fabric175.BCM8879X=0 + +phy_rx_polarity_flip_fabric176.BCM8879X=0 +phy_rx_polarity_flip_fabric177.BCM8879X=1 +phy_rx_polarity_flip_fabric178.BCM8879X=0 +phy_rx_polarity_flip_fabric179.BCM8879X=1 + +phy_rx_polarity_flip_fabric180.BCM8879X=1 +phy_rx_polarity_flip_fabric181.BCM8879X=0 +phy_rx_polarity_flip_fabric182.BCM8879X=1 +phy_rx_polarity_flip_fabric183.BCM8879X=0 + +phy_rx_polarity_flip_fabric184.BCM8879X=0 +phy_rx_polarity_flip_fabric185.BCM8879X=1 +phy_rx_polarity_flip_fabric186.BCM8879X=0 +phy_rx_polarity_flip_fabric187.BCM8879X=1 + +phy_rx_polarity_flip_fabric188.BCM8879X=1 +phy_rx_polarity_flip_fabric189.BCM8879X=0 +phy_rx_polarity_flip_fabric190.BCM8879X=1 +phy_rx_polarity_flip_fabric191.BCM8879X=0 + +phy_tx_polarity_flip_fabric0.BCM8879X=0 +phy_tx_polarity_flip_fabric1.BCM8879X=1 +phy_tx_polarity_flip_fabric2.BCM8879X=0 +phy_tx_polarity_flip_fabric3.BCM8879X=1 + +phy_tx_polarity_flip_fabric4.BCM8879X=1 +phy_tx_polarity_flip_fabric5.BCM8879X=0 +phy_tx_polarity_flip_fabric6.BCM8879X=1 +phy_tx_polarity_flip_fabric7.BCM8879X=0 + +phy_tx_polarity_flip_fabric8.BCM8879X=0 +phy_tx_polarity_flip_fabric9.BCM8879X=1 +phy_tx_polarity_flip_fabric10.BCM8879X=0 +phy_tx_polarity_flip_fabric11.BCM8879X=1 + +phy_tx_polarity_flip_fabric12.BCM8879X=1 +phy_tx_polarity_flip_fabric13.BCM8879X=0 +phy_tx_polarity_flip_fabric14.BCM8879X=1 +phy_tx_polarity_flip_fabric15.BCM8879X=0 + +phy_tx_polarity_flip_fabric16.BCM8879X=0 +phy_tx_polarity_flip_fabric17.BCM8879X=1 +phy_tx_polarity_flip_fabric18.BCM8879X=0 +phy_tx_polarity_flip_fabric19.BCM8879X=1 + +phy_tx_polarity_flip_fabric20.BCM8879X=0 +phy_tx_polarity_flip_fabric21.BCM8879X=1 +phy_tx_polarity_flip_fabric22.BCM8879X=0 +phy_tx_polarity_flip_fabric23.BCM8879X=1 + +phy_tx_polarity_flip_fabric24.BCM8879X=0 +phy_tx_polarity_flip_fabric25.BCM8879X=1 +phy_tx_polarity_flip_fabric26.BCM8879X=0 +phy_tx_polarity_flip_fabric27.BCM8879X=1 + +phy_tx_polarity_flip_fabric28.BCM8879X=1 +phy_tx_polarity_flip_fabric29.BCM8879X=0 +phy_tx_polarity_flip_fabric30.BCM8879X=1 +phy_tx_polarity_flip_fabric31.BCM8879X=0 + +phy_tx_polarity_flip_fabric32.BCM8879X=0 +phy_tx_polarity_flip_fabric33.BCM8879X=1 +phy_tx_polarity_flip_fabric34.BCM8879X=0 +phy_tx_polarity_flip_fabric35.BCM8879X=1 + +phy_tx_polarity_flip_fabric36.BCM8879X=1 +phy_tx_polarity_flip_fabric37.BCM8879X=0 +phy_tx_polarity_flip_fabric38.BCM8879X=1 +phy_tx_polarity_flip_fabric39.BCM8879X=0 + +phy_tx_polarity_flip_fabric40.BCM8879X=0 +phy_tx_polarity_flip_fabric41.BCM8879X=1 +phy_tx_polarity_flip_fabric42.BCM8879X=0 +phy_tx_polarity_flip_fabric43.BCM8879X=1 + +phy_tx_polarity_flip_fabric44.BCM8879X=0 +phy_tx_polarity_flip_fabric45.BCM8879X=1 +phy_tx_polarity_flip_fabric46.BCM8879X=0 +phy_tx_polarity_flip_fabric47.BCM8879X=1 + +phy_tx_polarity_flip_fabric48.BCM8879X=1 +phy_tx_polarity_flip_fabric49.BCM8879X=0 +phy_tx_polarity_flip_fabric50.BCM8879X=1 +phy_tx_polarity_flip_fabric51.BCM8879X=0 + +phy_tx_polarity_flip_fabric52.BCM8879X=0 +phy_tx_polarity_flip_fabric53.BCM8879X=1 +phy_tx_polarity_flip_fabric54.BCM8879X=0 +phy_tx_polarity_flip_fabric55.BCM8879X=1 + +phy_tx_polarity_flip_fabric56.BCM8879X=1 +phy_tx_polarity_flip_fabric57.BCM8879X=0 +phy_tx_polarity_flip_fabric58.BCM8879X=1 +phy_tx_polarity_flip_fabric59.BCM8879X=0 + +phy_tx_polarity_flip_fabric60.BCM8879X=1 +phy_tx_polarity_flip_fabric61.BCM8879X=0 +phy_tx_polarity_flip_fabric62.BCM8879X=1 +phy_tx_polarity_flip_fabric63.BCM8879X=0 + +phy_tx_polarity_flip_fabric64.BCM8879X=0 +phy_tx_polarity_flip_fabric65.BCM8879X=1 +phy_tx_polarity_flip_fabric66.BCM8879X=0 +phy_tx_polarity_flip_fabric67.BCM8879X=1 + +phy_tx_polarity_flip_fabric68.BCM8879X=1 +phy_tx_polarity_flip_fabric69.BCM8879X=0 +phy_tx_polarity_flip_fabric70.BCM8879X=1 +phy_tx_polarity_flip_fabric71.BCM8879X=0 + +phy_tx_polarity_flip_fabric72.BCM8879X=0 +phy_tx_polarity_flip_fabric73.BCM8879X=1 +phy_tx_polarity_flip_fabric74.BCM8879X=0 +phy_tx_polarity_flip_fabric75.BCM8879X=1 + +phy_tx_polarity_flip_fabric76.BCM8879X=0 +phy_tx_polarity_flip_fabric77.BCM8879X=1 +phy_tx_polarity_flip_fabric78.BCM8879X=0 +phy_tx_polarity_flip_fabric79.BCM8879X=1 + +phy_tx_polarity_flip_fabric80.BCM8879X=1 +phy_tx_polarity_flip_fabric81.BCM8879X=0 +phy_tx_polarity_flip_fabric82.BCM8879X=1 +phy_tx_polarity_flip_fabric83.BCM8879X=0 + +phy_tx_polarity_flip_fabric84.BCM8879X=0 +phy_tx_polarity_flip_fabric85.BCM8879X=1 +phy_tx_polarity_flip_fabric86.BCM8879X=0 +phy_tx_polarity_flip_fabric87.BCM8879X=1 + +phy_tx_polarity_flip_fabric88.BCM8879X=1 +phy_tx_polarity_flip_fabric89.BCM8879X=0 +phy_tx_polarity_flip_fabric90.BCM8879X=1 +phy_tx_polarity_flip_fabric91.BCM8879X=0 + +phy_tx_polarity_flip_fabric92.BCM8879X=0 +phy_tx_polarity_flip_fabric93.BCM8879X=1 +phy_tx_polarity_flip_fabric94.BCM8879X=0 +phy_tx_polarity_flip_fabric95.BCM8879X=1 + +phy_tx_polarity_flip_fabric96.BCM8879X=0 +phy_tx_polarity_flip_fabric97.BCM8879X=1 +phy_tx_polarity_flip_fabric98.BCM8879X=0 +phy_tx_polarity_flip_fabric99.BCM8879X=1 + +phy_tx_polarity_flip_fabric100.BCM8879X=1 +phy_tx_polarity_flip_fabric101.BCM8879X=0 +phy_tx_polarity_flip_fabric102.BCM8879X=1 +phy_tx_polarity_flip_fabric103.BCM8879X=0 + +phy_tx_polarity_flip_fabric104.BCM8879X=1 +phy_tx_polarity_flip_fabric105.BCM8879X=0 +phy_tx_polarity_flip_fabric106.BCM8879X=1 +phy_tx_polarity_flip_fabric107.BCM8879X=0 + +phy_tx_polarity_flip_fabric108.BCM8879X=1 +phy_tx_polarity_flip_fabric109.BCM8879X=0 +phy_tx_polarity_flip_fabric110.BCM8879X=1 +phy_tx_polarity_flip_fabric111.BCM8879X=0 + +phy_tx_polarity_flip_fabric112.BCM8879X=1 +phy_tx_polarity_flip_fabric113.BCM8879X=0 +phy_tx_polarity_flip_fabric114.BCM8879X=1 +phy_tx_polarity_flip_fabric115.BCM8879X=0 + +phy_tx_polarity_flip_fabric116.BCM8879X=0 +phy_tx_polarity_flip_fabric117.BCM8879X=1 +phy_tx_polarity_flip_fabric118.BCM8879X=0 +phy_tx_polarity_flip_fabric119.BCM8879X=1 + +phy_tx_polarity_flip_fabric120.BCM8879X=0 +phy_tx_polarity_flip_fabric121.BCM8879X=1 +phy_tx_polarity_flip_fabric122.BCM8879X=0 +phy_tx_polarity_flip_fabric123.BCM8879X=1 + +phy_tx_polarity_flip_fabric124.BCM8879X=1 +phy_tx_polarity_flip_fabric125.BCM8879X=0 +phy_tx_polarity_flip_fabric126.BCM8879X=1 +phy_tx_polarity_flip_fabric127.BCM8879X=0 + +phy_tx_polarity_flip_fabric128.BCM8879X=0 +phy_tx_polarity_flip_fabric129.BCM8879X=1 +phy_tx_polarity_flip_fabric130.BCM8879X=0 +phy_tx_polarity_flip_fabric131.BCM8879X=1 + +phy_tx_polarity_flip_fabric132.BCM8879X=1 +phy_tx_polarity_flip_fabric133.BCM8879X=0 +phy_tx_polarity_flip_fabric134.BCM8879X=1 +phy_tx_polarity_flip_fabric135.BCM8879X=0 + +phy_tx_polarity_flip_fabric136.BCM8879X=0 +phy_tx_polarity_flip_fabric137.BCM8879X=1 +phy_tx_polarity_flip_fabric138.BCM8879X=0 +phy_tx_polarity_flip_fabric139.BCM8879X=1 + +phy_tx_polarity_flip_fabric140.BCM8879X=0 +phy_tx_polarity_flip_fabric141.BCM8879X=1 +phy_tx_polarity_flip_fabric142.BCM8879X=0 +phy_tx_polarity_flip_fabric143.BCM8879X=1 + +phy_tx_polarity_flip_fabric144.BCM8879X=0 +phy_tx_polarity_flip_fabric145.BCM8879X=1 +phy_tx_polarity_flip_fabric146.BCM8879X=0 +phy_tx_polarity_flip_fabric147.BCM8879X=1 + +phy_tx_polarity_flip_fabric148.BCM8879X=0 +phy_tx_polarity_flip_fabric149.BCM8879X=1 +phy_tx_polarity_flip_fabric150.BCM8879X=0 +phy_tx_polarity_flip_fabric151.BCM8879X=1 + +phy_tx_polarity_flip_fabric152.BCM8879X=1 +phy_tx_polarity_flip_fabric153.BCM8879X=0 +phy_tx_polarity_flip_fabric154.BCM8879X=1 +phy_tx_polarity_flip_fabric155.BCM8879X=0 + +phy_tx_polarity_flip_fabric156.BCM8879X=0 +phy_tx_polarity_flip_fabric157.BCM8879X=1 +phy_tx_polarity_flip_fabric158.BCM8879X=0 +phy_tx_polarity_flip_fabric159.BCM8879X=1 + +phy_tx_polarity_flip_fabric160.BCM8879X=0 +phy_tx_polarity_flip_fabric161.BCM8879X=1 +phy_tx_polarity_flip_fabric162.BCM8879X=0 +phy_tx_polarity_flip_fabric163.BCM8879X=1 + +phy_tx_polarity_flip_fabric164.BCM8879X=1 +phy_tx_polarity_flip_fabric165.BCM8879X=0 +phy_tx_polarity_flip_fabric166.BCM8879X=1 +phy_tx_polarity_flip_fabric167.BCM8879X=0 + +phy_tx_polarity_flip_fabric168.BCM8879X=0 +phy_tx_polarity_flip_fabric169.BCM8879X=1 +phy_tx_polarity_flip_fabric170.BCM8879X=0 +phy_tx_polarity_flip_fabric171.BCM8879X=1 + +phy_tx_polarity_flip_fabric172.BCM8879X=0 +phy_tx_polarity_flip_fabric173.BCM8879X=1 +phy_tx_polarity_flip_fabric174.BCM8879X=0 +phy_tx_polarity_flip_fabric175.BCM8879X=1 + +phy_tx_polarity_flip_fabric176.BCM8879X=1 +phy_tx_polarity_flip_fabric177.BCM8879X=0 +phy_tx_polarity_flip_fabric178.BCM8879X=1 +phy_tx_polarity_flip_fabric179.BCM8879X=0 + +phy_tx_polarity_flip_fabric180.BCM8879X=0 +phy_tx_polarity_flip_fabric181.BCM8879X=1 +phy_tx_polarity_flip_fabric182.BCM8879X=0 +phy_tx_polarity_flip_fabric183.BCM8879X=1 + +phy_tx_polarity_flip_fabric184.BCM8879X=1 +phy_tx_polarity_flip_fabric185.BCM8879X=0 +phy_tx_polarity_flip_fabric186.BCM8879X=1 +phy_tx_polarity_flip_fabric187.BCM8879X=0 + +phy_tx_polarity_flip_fabric188.BCM8879X=0 +phy_tx_polarity_flip_fabric189.BCM8879X=1 +phy_tx_polarity_flip_fabric190.BCM8879X=0 +phy_tx_polarity_flip_fabric191.BCM8879X=1 + +port_init_cl72_0=0 +port_init_cl72_1=0 +port_init_cl72_2=0 +port_init_cl72_3=0 +port_init_cl72_4=0 +port_init_cl72_5=0 +port_init_cl72_6=0 +port_init_cl72_7=0 +port_init_cl72_8=0 +port_init_cl72_9=0 +port_init_cl72_10=0 +port_init_cl72_11=0 +port_init_cl72_12=0 +port_init_cl72_13=0 +port_init_cl72_14=0 +port_init_cl72_15=0 +port_init_cl72_16=0 +port_init_cl72_17=0 +port_init_cl72_18=0 +port_init_cl72_19=0 +port_init_cl72_20=0 +port_init_cl72_21=0 +port_init_cl72_22=0 +port_init_cl72_23=0 +port_init_cl72_24=0 +port_init_cl72_25=0 +port_init_cl72_26=0 +port_init_cl72_27=0 +port_init_cl72_28=0 +port_init_cl72_29=0 +port_init_cl72_30=0 +port_init_cl72_31=0 +port_init_cl72_32=0 +port_init_cl72_33=0 +port_init_cl72_34=0 +port_init_cl72_35=0 +port_init_cl72_36=0 +port_init_cl72_37=0 +port_init_cl72_38=0 +port_init_cl72_39=0 +port_init_cl72_40=0 +port_init_cl72_41=0 +port_init_cl72_42=0 +port_init_cl72_43=0 +port_init_cl72_44=0 +port_init_cl72_45=0 +port_init_cl72_46=0 +port_init_cl72_47=0 +port_init_cl72_48=0 +port_init_cl72_49=0 +port_init_cl72_50=0 +port_init_cl72_51=0 +port_init_cl72_52=0 +port_init_cl72_53=0 +port_init_cl72_54=0 +port_init_cl72_55=0 +port_init_cl72_56=0 +port_init_cl72_57=0 +port_init_cl72_58=0 +port_init_cl72_59=0 +port_init_cl72_60=0 +port_init_cl72_61=0 +port_init_cl72_62=0 +port_init_cl72_63=0 +port_init_cl72_64=0 +port_init_cl72_65=0 +port_init_cl72_66=0 +port_init_cl72_67=0 +port_init_cl72_68=0 +port_init_cl72_69=0 +port_init_cl72_70=0 +port_init_cl72_71=0 +port_init_cl72_72=0 +port_init_cl72_73=0 +port_init_cl72_74=0 +port_init_cl72_75=0 +port_init_cl72_76=0 +port_init_cl72_77=0 +port_init_cl72_78=0 +port_init_cl72_79=0 +port_init_cl72_80=0 +port_init_cl72_81=0 +port_init_cl72_82=0 +port_init_cl72_83=0 +port_init_cl72_84=0 +port_init_cl72_85=0 +port_init_cl72_86=0 +port_init_cl72_87=0 +port_init_cl72_88=0 +port_init_cl72_89=0 +port_init_cl72_90=0 +port_init_cl72_91=0 +port_init_cl72_92=0 +port_init_cl72_93=0 +port_init_cl72_94=0 +port_init_cl72_95=0 +port_init_cl72_96=0 +port_init_cl72_97=0 +port_init_cl72_98=0 +port_init_cl72_99=0 +port_init_cl72_100=0 +port_init_cl72_101=0 +port_init_cl72_102=0 +port_init_cl72_103=0 +port_init_cl72_104=0 +port_init_cl72_105=0 +port_init_cl72_106=0 +port_init_cl72_107=0 +port_init_cl72_108=0 +port_init_cl72_109=0 +port_init_cl72_110=0 +port_init_cl72_111=0 +port_init_cl72_112=0 +port_init_cl72_113=0 +port_init_cl72_114=0 +port_init_cl72_115=0 +port_init_cl72_116=0 +port_init_cl72_117=0 +port_init_cl72_118=0 +port_init_cl72_119=0 +port_init_cl72_120=0 +port_init_cl72_121=0 +port_init_cl72_122=0 +port_init_cl72_123=0 +port_init_cl72_124=0 +port_init_cl72_125=0 +port_init_cl72_126=0 +port_init_cl72_127=0 +port_init_cl72_128=0 +port_init_cl72_129=0 +port_init_cl72_130=0 +port_init_cl72_131=0 +port_init_cl72_132=0 +port_init_cl72_133=0 +port_init_cl72_134=0 +port_init_cl72_135=0 +port_init_cl72_136=0 +port_init_cl72_137=0 +port_init_cl72_138=0 +port_init_cl72_139=0 +port_init_cl72_140=0 +port_init_cl72_141=0 +port_init_cl72_142=0 +port_init_cl72_143=0 +port_init_cl72_144=0 +port_init_cl72_145=0 +port_init_cl72_146=0 +port_init_cl72_147=0 +port_init_cl72_148=0 +port_init_cl72_149=0 +port_init_cl72_150=0 +port_init_cl72_151=0 +port_init_cl72_152=0 +port_init_cl72_153=0 +port_init_cl72_154=0 +port_init_cl72_155=0 +port_init_cl72_156=0 +port_init_cl72_157=0 +port_init_cl72_158=0 +port_init_cl72_159=0 +port_init_cl72_160=0 +port_init_cl72_161=0 +port_init_cl72_162=0 +port_init_cl72_163=0 +port_init_cl72_164=0 +port_init_cl72_165=0 +port_init_cl72_166=0 +port_init_cl72_167=0 +port_init_cl72_168=0 +port_init_cl72_169=0 +port_init_cl72_170=0 +port_init_cl72_171=0 +port_init_cl72_172=0 +port_init_cl72_173=0 +port_init_cl72_174=0 +port_init_cl72_175=0 +port_init_cl72_176=0 +port_init_cl72_177=0 +port_init_cl72_178=0 +port_init_cl72_179=0 +port_init_cl72_180=0 +port_init_cl72_181=0 +port_init_cl72_182=0 +port_init_cl72_183=0 +port_init_cl72_184=0 +port_init_cl72_185=0 +port_init_cl72_186=0 +port_init_cl72_187=0 +port_init_cl72_188=0 +port_init_cl72_189=0 +port_init_cl72_190=0 +port_init_cl72_191=0 + +serdes_tx_taps_0.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_1.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_2.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_3.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_4.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_5.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_6.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_7.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_8.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_9.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_10.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_11.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_12.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_13.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_14.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_15.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_16.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_17.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_18.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_19.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_20.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_21.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_22.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_23.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_24.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_25.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_26.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_27.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_28.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_29.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_30.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_31.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_32.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_33.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_34.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_35.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_36.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_37.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_38.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_39.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_40.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_41.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_42.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_43.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_44.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_45.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_46.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_47.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_48.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_49.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_50.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_51.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_52.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_53.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_54.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_55.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_56.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_57.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_58.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_59.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_60.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_61.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_62.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_63.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_64.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_65.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_66.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_67.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_68.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_69.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_70.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_71.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_72.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_73.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_74.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_75.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_76.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_77.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_78.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_79.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_80.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_81.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_82.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_83.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_84.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_85.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_86.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_87.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_88.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_89.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_90.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_91.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_92.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_93.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_94.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_95.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_96.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_97.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_98.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_99.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_100.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_101.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_102.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_103.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_104.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_105.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_106.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_107.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_108.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_109.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_110.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_111.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_112.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_113.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_114.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_115.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_116.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_117.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_118.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_119.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_120.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_121.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_122.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_123.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_124.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_125.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_126.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_127.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_128.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_129.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_130.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_131.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_132.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_133.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_134.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_135.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_136.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_137.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_138.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_139.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_140.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_141.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_142.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_143.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_144.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_145.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_146.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_147.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_148.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_149.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_150.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_151.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_152.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_153.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_154.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_155.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_156.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_157.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_158.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_159.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_160.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_161.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_162.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_163.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_164.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_165.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_166.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_167.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_168.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_169.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_170.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_171.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_172.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_173.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_174.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_175.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_176.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_177.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_178.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_179.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_180.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_181.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_182.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_183.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_184.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_185.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_186.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_187.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_188.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_189.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_190.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_191.BCM8879X=pam4:-24:132:-12:0:0:0 + +serdes_lane_config_channel_mode_0.0=force_nr +serdes_lane_config_channel_mode_1.0=force_nr +serdes_lane_config_channel_mode_2.0=force_nr +serdes_lane_config_channel_mode_3.0=force_nr +serdes_lane_config_channel_mode_4.0=force_nr +serdes_lane_config_channel_mode_5.0=force_nr +serdes_lane_config_channel_mode_6.0=force_nr +serdes_lane_config_channel_mode_7.0=force_nr +serdes_lane_config_channel_mode_8.0=force_nr +serdes_lane_config_channel_mode_9.0=force_nr +serdes_lane_config_channel_mode_10.0=force_nr +serdes_lane_config_channel_mode_11.0=force_nr +serdes_lane_config_channel_mode_12.0=force_nr +serdes_lane_config_channel_mode_13.0=force_nr +serdes_lane_config_channel_mode_14.0=force_nr +serdes_lane_config_channel_mode_15.0=force_nr +serdes_lane_config_channel_mode_16.0=force_nr +serdes_lane_config_channel_mode_17.0=force_nr +serdes_lane_config_channel_mode_18.0=force_nr +serdes_lane_config_channel_mode_19.0=force_nr +serdes_lane_config_channel_mode_20.0=force_nr +serdes_lane_config_channel_mode_21.0=force_nr +serdes_lane_config_channel_mode_22.0=force_nr +serdes_lane_config_channel_mode_23.0=force_nr +serdes_lane_config_channel_mode_24.0=force_nr +serdes_lane_config_channel_mode_25.0=force_nr +serdes_lane_config_channel_mode_26.0=force_nr +serdes_lane_config_channel_mode_27.0=force_nr +serdes_lane_config_channel_mode_28.0=force_nr +serdes_lane_config_channel_mode_29.0=force_nr +serdes_lane_config_channel_mode_30.0=force_nr +serdes_lane_config_channel_mode_31.0=force_nr +serdes_lane_config_channel_mode_32.0=force_nr +serdes_lane_config_channel_mode_33.0=force_nr +serdes_lane_config_channel_mode_34.0=force_nr +serdes_lane_config_channel_mode_35.0=force_nr +serdes_lane_config_channel_mode_36.0=force_nr +serdes_lane_config_channel_mode_37.0=force_nr +serdes_lane_config_channel_mode_38.0=force_nr +serdes_lane_config_channel_mode_39.0=force_nr +serdes_lane_config_channel_mode_40.0=force_nr +serdes_lane_config_channel_mode_41.0=force_nr +serdes_lane_config_channel_mode_42.0=force_nr +serdes_lane_config_channel_mode_43.0=force_nr +serdes_lane_config_channel_mode_44.0=force_nr +serdes_lane_config_channel_mode_45.0=force_nr +serdes_lane_config_channel_mode_46.0=force_nr +serdes_lane_config_channel_mode_47.0=force_nr +serdes_lane_config_channel_mode_48.0=force_nr +serdes_lane_config_channel_mode_49.0=force_nr +serdes_lane_config_channel_mode_50.0=force_nr +serdes_lane_config_channel_mode_51.0=force_nr +serdes_lane_config_channel_mode_52.0=force_nr +serdes_lane_config_channel_mode_53.0=force_nr +serdes_lane_config_channel_mode_54.0=force_nr +serdes_lane_config_channel_mode_55.0=force_nr +serdes_lane_config_channel_mode_56.0=force_nr +serdes_lane_config_channel_mode_57.0=force_nr +serdes_lane_config_channel_mode_58.0=force_nr +serdes_lane_config_channel_mode_59.0=force_nr +serdes_lane_config_channel_mode_60.0=force_nr +serdes_lane_config_channel_mode_61.0=force_nr +serdes_lane_config_channel_mode_62.0=force_nr +serdes_lane_config_channel_mode_63.0=force_nr +serdes_lane_config_channel_mode_64.0=force_nr +serdes_lane_config_channel_mode_65.0=force_nr +serdes_lane_config_channel_mode_66.0=force_nr +serdes_lane_config_channel_mode_67.0=force_nr +serdes_lane_config_channel_mode_68.0=force_nr +serdes_lane_config_channel_mode_69.0=force_nr +serdes_lane_config_channel_mode_70.0=force_nr +serdes_lane_config_channel_mode_71.0=force_nr +serdes_lane_config_channel_mode_72.0=force_nr +serdes_lane_config_channel_mode_73.0=force_nr +serdes_lane_config_channel_mode_74.0=force_nr +serdes_lane_config_channel_mode_75.0=force_nr +serdes_lane_config_channel_mode_76.0=force_nr +serdes_lane_config_channel_mode_77.0=force_nr +serdes_lane_config_channel_mode_78.0=force_nr +serdes_lane_config_channel_mode_79.0=force_nr +serdes_lane_config_channel_mode_80.0=force_nr +serdes_lane_config_channel_mode_81.0=force_nr +serdes_lane_config_channel_mode_82.0=force_nr +serdes_lane_config_channel_mode_83.0=force_nr +serdes_lane_config_channel_mode_84.0=force_nr +serdes_lane_config_channel_mode_85.0=force_nr +serdes_lane_config_channel_mode_86.0=force_nr +serdes_lane_config_channel_mode_87.0=force_nr +serdes_lane_config_channel_mode_88.0=force_nr +serdes_lane_config_channel_mode_89.0=force_nr +serdes_lane_config_channel_mode_90.0=force_nr +serdes_lane_config_channel_mode_91.0=force_nr +serdes_lane_config_channel_mode_92.0=force_nr +serdes_lane_config_channel_mode_93.0=force_nr +serdes_lane_config_channel_mode_94.0=force_nr +serdes_lane_config_channel_mode_95.0=force_nr +serdes_lane_config_channel_mode_96.0=force_nr +serdes_lane_config_channel_mode_97.0=force_nr +serdes_lane_config_channel_mode_98.0=force_nr +serdes_lane_config_channel_mode_99.0=force_nr +serdes_lane_config_channel_mode_100.0=force_nr +serdes_lane_config_channel_mode_101.0=force_nr +serdes_lane_config_channel_mode_102.0=force_nr +serdes_lane_config_channel_mode_103.0=force_nr +serdes_lane_config_channel_mode_104.0=force_nr +serdes_lane_config_channel_mode_105.0=force_nr +serdes_lane_config_channel_mode_106.0=force_nr +serdes_lane_config_channel_mode_107.0=force_nr +serdes_lane_config_channel_mode_108.0=force_nr +serdes_lane_config_channel_mode_109.0=force_nr +serdes_lane_config_channel_mode_110.0=force_nr +serdes_lane_config_channel_mode_111.0=force_nr +serdes_lane_config_channel_mode_112.0=force_nr +serdes_lane_config_channel_mode_113.0=force_nr +serdes_lane_config_channel_mode_114.0=force_nr +serdes_lane_config_channel_mode_115.0=force_nr +serdes_lane_config_channel_mode_116.0=force_nr +serdes_lane_config_channel_mode_117.0=force_nr +serdes_lane_config_channel_mode_118.0=force_nr +serdes_lane_config_channel_mode_119.0=force_nr +serdes_lane_config_channel_mode_120.0=force_nr +serdes_lane_config_channel_mode_121.0=force_nr +serdes_lane_config_channel_mode_122.0=force_nr +serdes_lane_config_channel_mode_123.0=force_nr +serdes_lane_config_channel_mode_124.0=force_nr +serdes_lane_config_channel_mode_125.0=force_nr +serdes_lane_config_channel_mode_126.0=force_nr +serdes_lane_config_channel_mode_127.0=force_nr +serdes_lane_config_channel_mode_128.0=force_nr +serdes_lane_config_channel_mode_129.0=force_nr +serdes_lane_config_channel_mode_130.0=force_nr +serdes_lane_config_channel_mode_131.0=force_nr +serdes_lane_config_channel_mode_132.0=force_nr +serdes_lane_config_channel_mode_133.0=force_nr +serdes_lane_config_channel_mode_134.0=force_nr +serdes_lane_config_channel_mode_135.0=force_nr +serdes_lane_config_channel_mode_136.0=force_nr +serdes_lane_config_channel_mode_137.0=force_nr +serdes_lane_config_channel_mode_138.0=force_nr +serdes_lane_config_channel_mode_139.0=force_nr +serdes_lane_config_channel_mode_140.0=force_nr +serdes_lane_config_channel_mode_141.0=force_nr +serdes_lane_config_channel_mode_142.0=force_nr +serdes_lane_config_channel_mode_143.0=force_nr +serdes_lane_config_channel_mode_144.0=force_nr +serdes_lane_config_channel_mode_145.0=force_nr +serdes_lane_config_channel_mode_146.0=force_nr +serdes_lane_config_channel_mode_147.0=force_nr +serdes_lane_config_channel_mode_148.0=force_nr +serdes_lane_config_channel_mode_149.0=force_nr +serdes_lane_config_channel_mode_150.0=force_nr +serdes_lane_config_channel_mode_151.0=force_nr +serdes_lane_config_channel_mode_152.0=force_nr +serdes_lane_config_channel_mode_153.0=force_nr +serdes_lane_config_channel_mode_154.0=force_nr +serdes_lane_config_channel_mode_155.0=force_nr +serdes_lane_config_channel_mode_156.0=force_nr +serdes_lane_config_channel_mode_157.0=force_nr +serdes_lane_config_channel_mode_158.0=force_nr +serdes_lane_config_channel_mode_159.0=force_nr +serdes_lane_config_channel_mode_160.0=force_nr +serdes_lane_config_channel_mode_161.0=force_nr +serdes_lane_config_channel_mode_162.0=force_nr +serdes_lane_config_channel_mode_163.0=force_nr +serdes_lane_config_channel_mode_164.0=force_nr +serdes_lane_config_channel_mode_165.0=force_nr +serdes_lane_config_channel_mode_166.0=force_nr +serdes_lane_config_channel_mode_167.0=force_nr +serdes_lane_config_channel_mode_168.0=force_nr +serdes_lane_config_channel_mode_169.0=force_nr +serdes_lane_config_channel_mode_170.0=force_nr +serdes_lane_config_channel_mode_171.0=force_nr +serdes_lane_config_channel_mode_172.0=force_nr +serdes_lane_config_channel_mode_173.0=force_nr +serdes_lane_config_channel_mode_174.0=force_nr +serdes_lane_config_channel_mode_175.0=force_nr +serdes_lane_config_channel_mode_176.0=force_nr +serdes_lane_config_channel_mode_177.0=force_nr +serdes_lane_config_channel_mode_178.0=force_nr +serdes_lane_config_channel_mode_179.0=force_nr +serdes_lane_config_channel_mode_180.0=force_nr +serdes_lane_config_channel_mode_181.0=force_nr +serdes_lane_config_channel_mode_182.0=force_nr +serdes_lane_config_channel_mode_183.0=force_nr +serdes_lane_config_channel_mode_184.0=force_nr +serdes_lane_config_channel_mode_185.0=force_nr +serdes_lane_config_channel_mode_186.0=force_nr +serdes_lane_config_channel_mode_187.0=force_nr +serdes_lane_config_channel_mode_188.0=force_nr +serdes_lane_config_channel_mode_189.0=force_nr +serdes_lane_config_channel_mode_190.0=force_nr +serdes_lane_config_channel_mode_191.0=force_nr + + +serdes_qrtt_active_0.0=1 +serdes_qrtt_active_1.0=1 +serdes_qrtt_active_2.0=1 +serdes_qrtt_active_3.0=1 +serdes_qrtt_active_4.0=1 +serdes_qrtt_active_5.0=1 +serdes_qrtt_active_6.0=1 +serdes_qrtt_active_7.0=1 +serdes_qrtt_active_8.0=1 +serdes_qrtt_active_9.0=1 +serdes_qrtt_active_10.0=1 +serdes_qrtt_active_11.0=1 +serdes_qrtt_active_12.0=1 +serdes_qrtt_active_13.0=1 +serdes_qrtt_active_14.0=1 +serdes_qrtt_active_15.0=1 +serdes_qrtt_active_16.0=1 +serdes_qrtt_active_17.0=1 +serdes_qrtt_active_18.0=1 +serdes_qrtt_active_19.0=1 +serdes_qrtt_active_20.0=1 +serdes_qrtt_active_21.0=1 +serdes_qrtt_active_22.0=1 +serdes_qrtt_active_23.0=1 +serdes_qrtt_active_24.0=1 +serdes_qrtt_active_25.0=1 +serdes_qrtt_active_26.0=1 +serdes_qrtt_active_27.0=1 +serdes_qrtt_active_28.0=1 +serdes_qrtt_active_29.0=1 +serdes_qrtt_active_30.0=1 +serdes_qrtt_active_31.0=1 +serdes_qrtt_active_32.0=1 +serdes_qrtt_active_33.0=1 +serdes_qrtt_active_34.0=1 +serdes_qrtt_active_35.0=1 +serdes_qrtt_active_36.0=1 +serdes_qrtt_active_37.0=1 +serdes_qrtt_active_38.0=1 +serdes_qrtt_active_39.0=1 +serdes_qrtt_active_40.0=1 +serdes_qrtt_active_41.0=1 +serdes_qrtt_active_42.0=1 +serdes_qrtt_active_43.0=1 +serdes_qrtt_active_44.0=1 +serdes_qrtt_active_45.0=1 +serdes_qrtt_active_46.0=1 +serdes_qrtt_active_47.0=1 diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/7/config-ramon-4-1.bcm b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/7/config-ramon-4-1.bcm new file mode 100644 index 000000000000..679e3fa07592 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/7/config-ramon-4-1.bcm @@ -0,0 +1,1395 @@ + +appl_enable_intr_init.BCM8879X=0 +appl_param_module_id.BCM8879X=8 +bcm_linkscan_interval.BCM8879X=0 +bcm_stat_interval.BCM8879X=4000000 +bist_enable.BCM8879X=0 +core_clock_speed_khz.BCM8879X=1000000 +custom_feature_access_only.BCM8879X=0 +custom_feature_lane_swap_disable.BCM8879X=0 +dport_map_direct.BCM8879X=1 +fabric_cell_fifo_dma_enable.BCM8879X=0 +fabric_device_mode.BCM8879X=SINGLE_STAGE_FE2 +fabric_load_balancing_mode.BCM8879X=NORMAL_LOAD_BALANCE +fabric_multicast_mode.BCM8879X=DIRECT +fabric_num_pipes.BCM8879X=1 +fabric_pipe_map.BCM8879X=0 +fe_mc_id_range.BCM8879X=128K +load_firmware.BCM8879X=0x102 +mdio_output_delay_ext.BCM8879X=14 +mdio_output_delay_int.BCM8879X=25 +mem_cache_enable_parity.BCM8879X=1 +mm_intr_enable.BCM8879X=0 +mm_timeout_usec.BCM8879X=300000 +polled_irq_delay.BCM8879X=100000 +polled_irq_mode.BCM8879X=1 +port_fec.BCM8879X=7 +port_init_cl72.BCM8879X=0 +port_init_speed.BCM8879X=53125 +rate_ext_mdio_divisor.BCM8879X=14 +rate_int_mdio_divisor.BCM8879X=50 +schan_intr_enable.BCM8879X=0 +schan_timeout_usec.BCM8879X=300000 +serdes_fabric_clk_freq_in.BCM8879X=1 +serdes_fabric_clk_freq_out.BCM8879X=bypass +soc_family.BCM8879X=BCM8879X +srd_tx_drv_hv_disable.BCM8879X=0 +system_contains_multiple_pipe_device.BCM8879X=0 +system_ref_core_clock_khz.BCM8879X=1200000 +table_dma_enable.BCM8879X=0 +tdma_intr_enable.BCM8879X=0 +tdma_timeout_usec.BCM8879X=5000000 +tslam_dma_enable.BCM8879X=0 +tslam_intr_enable.BCM8879X=0 +tslam_timeout_usec.BCM8879X=5000000 + +lane_to_serdes_map_fabric_lane0.BCM8879X=rx0:tx0 +lane_to_serdes_map_fabric_lane1.BCM8879X=rx1:tx1 +lane_to_serdes_map_fabric_lane2.BCM8879X=rx2:tx2 +lane_to_serdes_map_fabric_lane3.BCM8879X=rx3:tx3 + +lane_to_serdes_map_fabric_lane4.BCM8879X=rx4:tx4 +lane_to_serdes_map_fabric_lane5.BCM8879X=rx5:tx5 +lane_to_serdes_map_fabric_lane6.BCM8879X=rx6:tx6 +lane_to_serdes_map_fabric_lane7.BCM8879X=rx7:tx7 + +lane_to_serdes_map_fabric_lane8.BCM8879X=rx8:tx8 +lane_to_serdes_map_fabric_lane9.BCM8879X=rx9:tx9 +lane_to_serdes_map_fabric_lane10.BCM8879X=rx10:tx10 +lane_to_serdes_map_fabric_lane11.BCM8879X=rx11:tx11 + +lane_to_serdes_map_fabric_lane12.BCM8879X=rx12:tx12 +lane_to_serdes_map_fabric_lane13.BCM8879X=rx13:tx13 +lane_to_serdes_map_fabric_lane14.BCM8879X=rx14:tx14 +lane_to_serdes_map_fabric_lane15.BCM8879X=rx15:tx15 + +lane_to_serdes_map_fabric_lane16.BCM8879X=rx16:tx16 +lane_to_serdes_map_fabric_lane17.BCM8879X=rx17:tx17 +lane_to_serdes_map_fabric_lane18.BCM8879X=rx18:tx18 +lane_to_serdes_map_fabric_lane19.BCM8879X=rx19:tx19 + +lane_to_serdes_map_fabric_lane20.BCM8879X=rx20:tx20 +lane_to_serdes_map_fabric_lane21.BCM8879X=rx21:tx21 +lane_to_serdes_map_fabric_lane22.BCM8879X=rx22:tx22 +lane_to_serdes_map_fabric_lane23.BCM8879X=rx23:tx23 + +lane_to_serdes_map_fabric_lane24.BCM8879X=rx24:tx24 +lane_to_serdes_map_fabric_lane25.BCM8879X=rx25:tx25 +lane_to_serdes_map_fabric_lane26.BCM8879X=rx26:tx26 +lane_to_serdes_map_fabric_lane27.BCM8879X=rx27:tx27 + +lane_to_serdes_map_fabric_lane28.BCM8879X=rx28:tx28 +lane_to_serdes_map_fabric_lane29.BCM8879X=rx29:tx29 +lane_to_serdes_map_fabric_lane30.BCM8879X=rx30:tx30 +lane_to_serdes_map_fabric_lane31.BCM8879X=rx31:tx31 + +lane_to_serdes_map_fabric_lane32.BCM8879X=rx32:tx32 +lane_to_serdes_map_fabric_lane33.BCM8879X=rx33:tx33 +lane_to_serdes_map_fabric_lane34.BCM8879X=rx34:tx34 +lane_to_serdes_map_fabric_lane35.BCM8879X=rx35:tx35 + +lane_to_serdes_map_fabric_lane36.BCM8879X=rx36:tx36 +lane_to_serdes_map_fabric_lane37.BCM8879X=rx37:tx37 +lane_to_serdes_map_fabric_lane38.BCM8879X=rx38:tx38 +lane_to_serdes_map_fabric_lane39.BCM8879X=rx39:tx39 + +lane_to_serdes_map_fabric_lane40.BCM8879X=rx40:tx40 +lane_to_serdes_map_fabric_lane41.BCM8879X=rx41:tx41 +lane_to_serdes_map_fabric_lane42.BCM8879X=rx42:tx42 +lane_to_serdes_map_fabric_lane43.BCM8879X=rx43:tx43 + +lane_to_serdes_map_fabric_lane44.BCM8879X=rx44:tx44 +lane_to_serdes_map_fabric_lane45.BCM8879X=rx45:tx45 +lane_to_serdes_map_fabric_lane46.BCM8879X=rx46:tx46 +lane_to_serdes_map_fabric_lane47.BCM8879X=rx47:tx47 + +lane_to_serdes_map_fabric_lane48.BCM8879X=rx48:tx48 +lane_to_serdes_map_fabric_lane49.BCM8879X=rx49:tx49 +lane_to_serdes_map_fabric_lane50.BCM8879X=rx50:tx50 +lane_to_serdes_map_fabric_lane51.BCM8879X=rx51:tx51 + +lane_to_serdes_map_fabric_lane52.BCM8879X=rx52:tx52 +lane_to_serdes_map_fabric_lane53.BCM8879X=rx53:tx53 +lane_to_serdes_map_fabric_lane54.BCM8879X=rx54:tx54 +lane_to_serdes_map_fabric_lane55.BCM8879X=rx55:tx55 + +lane_to_serdes_map_fabric_lane56.BCM8879X=rx56:tx56 +lane_to_serdes_map_fabric_lane57.BCM8879X=rx57:tx57 +lane_to_serdes_map_fabric_lane58.BCM8879X=rx58:tx58 +lane_to_serdes_map_fabric_lane59.BCM8879X=rx59:tx59 + +lane_to_serdes_map_fabric_lane60.BCM8879X=rx60:tx60 +lane_to_serdes_map_fabric_lane61.BCM8879X=rx61:tx61 +lane_to_serdes_map_fabric_lane62.BCM8879X=rx62:tx62 +lane_to_serdes_map_fabric_lane63.BCM8879X=rx63:tx63 + +lane_to_serdes_map_fabric_lane64.BCM8879X=rx64:tx64 +lane_to_serdes_map_fabric_lane65.BCM8879X=rx65:tx65 +lane_to_serdes_map_fabric_lane66.BCM8879X=rx66:tx66 +lane_to_serdes_map_fabric_lane67.BCM8879X=rx67:tx67 + +lane_to_serdes_map_fabric_lane68.BCM8879X=rx68:tx68 +lane_to_serdes_map_fabric_lane69.BCM8879X=rx69:tx69 +lane_to_serdes_map_fabric_lane70.BCM8879X=rx70:tx70 +lane_to_serdes_map_fabric_lane71.BCM8879X=rx71:tx71 + +lane_to_serdes_map_fabric_lane72.BCM8879X=rx72:tx72 +lane_to_serdes_map_fabric_lane73.BCM8879X=rx73:tx73 +lane_to_serdes_map_fabric_lane74.BCM8879X=rx74:tx74 +lane_to_serdes_map_fabric_lane75.BCM8879X=rx75:tx75 + +lane_to_serdes_map_fabric_lane76.BCM8879X=rx76:tx76 +lane_to_serdes_map_fabric_lane77.BCM8879X=rx77:tx77 +lane_to_serdes_map_fabric_lane78.BCM8879X=rx78:tx78 +lane_to_serdes_map_fabric_lane79.BCM8879X=rx79:tx79 + +lane_to_serdes_map_fabric_lane80.BCM8879X=rx80:tx80 +lane_to_serdes_map_fabric_lane81.BCM8879X=rx81:tx81 +lane_to_serdes_map_fabric_lane82.BCM8879X=rx82:tx82 +lane_to_serdes_map_fabric_lane83.BCM8879X=rx83:tx83 + +lane_to_serdes_map_fabric_lane84.BCM8879X=rx84:tx84 +lane_to_serdes_map_fabric_lane85.BCM8879X=rx85:tx85 +lane_to_serdes_map_fabric_lane86.BCM8879X=rx86:tx86 +lane_to_serdes_map_fabric_lane87.BCM8879X=rx87:tx87 + +lane_to_serdes_map_fabric_lane88.BCM8879X=rx88:tx88 +lane_to_serdes_map_fabric_lane89.BCM8879X=rx89:tx89 +lane_to_serdes_map_fabric_lane90.BCM8879X=rx90:tx90 +lane_to_serdes_map_fabric_lane91.BCM8879X=rx91:tx91 + +lane_to_serdes_map_fabric_lane92.BCM8879X=rx92:tx92 +lane_to_serdes_map_fabric_lane93.BCM8879X=rx93:tx93 +lane_to_serdes_map_fabric_lane94.BCM8879X=rx94:tx94 +lane_to_serdes_map_fabric_lane95.BCM8879X=rx95:tx95 + +lane_to_serdes_map_fabric_lane96.BCM8879X=rx96:tx96 +lane_to_serdes_map_fabric_lane97.BCM8879X=rx97:tx97 +lane_to_serdes_map_fabric_lane98.BCM8879X=rx98:tx98 +lane_to_serdes_map_fabric_lane99.BCM8879X=rx99:tx99 + +lane_to_serdes_map_fabric_lane100.BCM8879X=rx100:tx100 +lane_to_serdes_map_fabric_lane101.BCM8879X=rx101:tx101 +lane_to_serdes_map_fabric_lane102.BCM8879X=rx102:tx102 +lane_to_serdes_map_fabric_lane103.BCM8879X=rx103:tx103 + +lane_to_serdes_map_fabric_lane104.BCM8879X=rx104:tx104 +lane_to_serdes_map_fabric_lane105.BCM8879X=rx105:tx105 +lane_to_serdes_map_fabric_lane106.BCM8879X=rx106:tx106 +lane_to_serdes_map_fabric_lane107.BCM8879X=rx107:tx107 + +lane_to_serdes_map_fabric_lane108.BCM8879X=rx108:tx108 +lane_to_serdes_map_fabric_lane109.BCM8879X=rx109:tx109 +lane_to_serdes_map_fabric_lane110.BCM8879X=rx110:tx110 +lane_to_serdes_map_fabric_lane111.BCM8879X=rx111:tx111 + +lane_to_serdes_map_fabric_lane112.BCM8879X=rx112:tx112 +lane_to_serdes_map_fabric_lane113.BCM8879X=rx113:tx113 +lane_to_serdes_map_fabric_lane114.BCM8879X=rx114:tx114 +lane_to_serdes_map_fabric_lane115.BCM8879X=rx115:tx115 + +lane_to_serdes_map_fabric_lane116.BCM8879X=rx116:tx116 +lane_to_serdes_map_fabric_lane117.BCM8879X=rx117:tx117 +lane_to_serdes_map_fabric_lane118.BCM8879X=rx118:tx118 +lane_to_serdes_map_fabric_lane119.BCM8879X=rx119:tx119 + +lane_to_serdes_map_fabric_lane120.BCM8879X=rx120:tx120 +lane_to_serdes_map_fabric_lane121.BCM8879X=rx121:tx121 +lane_to_serdes_map_fabric_lane122.BCM8879X=rx122:tx122 +lane_to_serdes_map_fabric_lane123.BCM8879X=rx123:tx123 + +lane_to_serdes_map_fabric_lane124.BCM8879X=rx124:tx124 +lane_to_serdes_map_fabric_lane125.BCM8879X=rx125:tx125 +lane_to_serdes_map_fabric_lane126.BCM8879X=rx126:tx126 +lane_to_serdes_map_fabric_lane127.BCM8879X=rx127:tx127 + +lane_to_serdes_map_fabric_lane128.BCM8879X=rx128:tx128 +lane_to_serdes_map_fabric_lane129.BCM8879X=rx129:tx129 +lane_to_serdes_map_fabric_lane130.BCM8879X=rx130:tx130 +lane_to_serdes_map_fabric_lane131.BCM8879X=rx131:tx131 + +lane_to_serdes_map_fabric_lane132.BCM8879X=rx132:tx132 +lane_to_serdes_map_fabric_lane133.BCM8879X=rx133:tx133 +lane_to_serdes_map_fabric_lane134.BCM8879X=rx134:tx134 +lane_to_serdes_map_fabric_lane135.BCM8879X=rx135:tx135 + +lane_to_serdes_map_fabric_lane136.BCM8879X=rx136:tx136 +lane_to_serdes_map_fabric_lane137.BCM8879X=rx137:tx137 +lane_to_serdes_map_fabric_lane138.BCM8879X=rx138:tx138 +lane_to_serdes_map_fabric_lane139.BCM8879X=rx139:tx139 + +lane_to_serdes_map_fabric_lane140.BCM8879X=rx140:tx140 +lane_to_serdes_map_fabric_lane141.BCM8879X=rx141:tx141 +lane_to_serdes_map_fabric_lane142.BCM8879X=rx142:tx142 +lane_to_serdes_map_fabric_lane143.BCM8879X=rx143:tx143 + +lane_to_serdes_map_fabric_lane144.BCM8879X=rx144:tx144 +lane_to_serdes_map_fabric_lane145.BCM8879X=rx145:tx145 +lane_to_serdes_map_fabric_lane146.BCM8879X=rx146:tx146 +lane_to_serdes_map_fabric_lane147.BCM8879X=rx147:tx147 + +lane_to_serdes_map_fabric_lane148.BCM8879X=rx148:tx148 +lane_to_serdes_map_fabric_lane149.BCM8879X=rx149:tx149 +lane_to_serdes_map_fabric_lane150.BCM8879X=rx150:tx150 +lane_to_serdes_map_fabric_lane151.BCM8879X=rx151:tx151 + +lane_to_serdes_map_fabric_lane152.BCM8879X=rx152:tx152 +lane_to_serdes_map_fabric_lane153.BCM8879X=rx153:tx153 +lane_to_serdes_map_fabric_lane154.BCM8879X=rx154:tx154 +lane_to_serdes_map_fabric_lane155.BCM8879X=rx155:tx155 + +lane_to_serdes_map_fabric_lane156.BCM8879X=rx156:tx156 +lane_to_serdes_map_fabric_lane157.BCM8879X=rx157:tx157 +lane_to_serdes_map_fabric_lane158.BCM8879X=rx158:tx158 +lane_to_serdes_map_fabric_lane159.BCM8879X=rx159:tx159 + +lane_to_serdes_map_fabric_lane160.BCM8879X=rx160:tx160 +lane_to_serdes_map_fabric_lane161.BCM8879X=rx161:tx161 +lane_to_serdes_map_fabric_lane162.BCM8879X=rx162:tx162 +lane_to_serdes_map_fabric_lane163.BCM8879X=rx163:tx163 + +lane_to_serdes_map_fabric_lane164.BCM8879X=rx164:tx164 +lane_to_serdes_map_fabric_lane165.BCM8879X=rx165:tx165 +lane_to_serdes_map_fabric_lane166.BCM8879X=rx166:tx166 +lane_to_serdes_map_fabric_lane167.BCM8879X=rx167:tx167 + +lane_to_serdes_map_fabric_lane168.BCM8879X=rx168:tx168 +lane_to_serdes_map_fabric_lane169.BCM8879X=rx169:tx169 +lane_to_serdes_map_fabric_lane170.BCM8879X=rx170:tx170 +lane_to_serdes_map_fabric_lane171.BCM8879X=rx171:tx171 + +lane_to_serdes_map_fabric_lane172.BCM8879X=rx172:tx172 +lane_to_serdes_map_fabric_lane173.BCM8879X=rx173:tx173 +lane_to_serdes_map_fabric_lane174.BCM8879X=rx174:tx174 +lane_to_serdes_map_fabric_lane175.BCM8879X=rx175:tx175 + +lane_to_serdes_map_fabric_lane176.BCM8879X=rx176:tx176 +lane_to_serdes_map_fabric_lane177.BCM8879X=rx177:tx177 +lane_to_serdes_map_fabric_lane178.BCM8879X=rx178:tx178 +lane_to_serdes_map_fabric_lane179.BCM8879X=rx179:tx179 + +lane_to_serdes_map_fabric_lane180.BCM8879X=rx180:tx180 +lane_to_serdes_map_fabric_lane181.BCM8879X=rx181:tx181 +lane_to_serdes_map_fabric_lane182.BCM8879X=rx182:tx182 +lane_to_serdes_map_fabric_lane183.BCM8879X=rx183:tx183 + +lane_to_serdes_map_fabric_lane184.BCM8879X=rx184:tx184 +lane_to_serdes_map_fabric_lane185.BCM8879X=rx185:tx185 +lane_to_serdes_map_fabric_lane186.BCM8879X=rx186:tx186 +lane_to_serdes_map_fabric_lane187.BCM8879X=rx187:tx187 + +lane_to_serdes_map_fabric_lane188.BCM8879X=rx188:tx188 +lane_to_serdes_map_fabric_lane189.BCM8879X=rx189:tx189 +lane_to_serdes_map_fabric_lane190.BCM8879X=rx190:tx190 +lane_to_serdes_map_fabric_lane191.BCM8879X=rx191:tx191 + + +phy_rx_polarity_flip_fabric0.BCM8879X=1 +phy_rx_polarity_flip_fabric1.BCM8879X=0 +phy_rx_polarity_flip_fabric2.BCM8879X=1 +phy_rx_polarity_flip_fabric3.BCM8879X=0 + +phy_rx_polarity_flip_fabric4.BCM8879X=1 +phy_rx_polarity_flip_fabric5.BCM8879X=0 +phy_rx_polarity_flip_fabric6.BCM8879X=1 +phy_rx_polarity_flip_fabric7.BCM8879X=0 + +phy_rx_polarity_flip_fabric8.BCM8879X=0 +phy_rx_polarity_flip_fabric9.BCM8879X=1 +phy_rx_polarity_flip_fabric10.BCM8879X=0 +phy_rx_polarity_flip_fabric11.BCM8879X=1 + +phy_rx_polarity_flip_fabric12.BCM8879X=1 +phy_rx_polarity_flip_fabric13.BCM8879X=0 +phy_rx_polarity_flip_fabric14.BCM8879X=1 +phy_rx_polarity_flip_fabric15.BCM8879X=0 + +phy_rx_polarity_flip_fabric16.BCM8879X=1 +phy_rx_polarity_flip_fabric17.BCM8879X=0 +phy_rx_polarity_flip_fabric18.BCM8879X=1 +phy_rx_polarity_flip_fabric19.BCM8879X=0 + +phy_rx_polarity_flip_fabric20.BCM8879X=0 +phy_rx_polarity_flip_fabric21.BCM8879X=1 +phy_rx_polarity_flip_fabric22.BCM8879X=0 +phy_rx_polarity_flip_fabric23.BCM8879X=1 + +phy_rx_polarity_flip_fabric24.BCM8879X=1 +phy_rx_polarity_flip_fabric25.BCM8879X=0 +phy_rx_polarity_flip_fabric26.BCM8879X=1 +phy_rx_polarity_flip_fabric27.BCM8879X=0 + +phy_rx_polarity_flip_fabric28.BCM8879X=1 +phy_rx_polarity_flip_fabric29.BCM8879X=0 +phy_rx_polarity_flip_fabric30.BCM8879X=1 +phy_rx_polarity_flip_fabric31.BCM8879X=0 + +phy_rx_polarity_flip_fabric32.BCM8879X=0 +phy_rx_polarity_flip_fabric33.BCM8879X=1 +phy_rx_polarity_flip_fabric34.BCM8879X=0 +phy_rx_polarity_flip_fabric35.BCM8879X=1 + +phy_rx_polarity_flip_fabric36.BCM8879X=1 +phy_rx_polarity_flip_fabric37.BCM8879X=0 +phy_rx_polarity_flip_fabric38.BCM8879X=1 +phy_rx_polarity_flip_fabric39.BCM8879X=0 + +phy_rx_polarity_flip_fabric40.BCM8879X=0 +phy_rx_polarity_flip_fabric41.BCM8879X=1 +phy_rx_polarity_flip_fabric42.BCM8879X=0 +phy_rx_polarity_flip_fabric43.BCM8879X=1 + +phy_rx_polarity_flip_fabric44.BCM8879X=1 +phy_rx_polarity_flip_fabric45.BCM8879X=0 +phy_rx_polarity_flip_fabric46.BCM8879X=1 +phy_rx_polarity_flip_fabric47.BCM8879X=0 + +phy_rx_polarity_flip_fabric48.BCM8879X=1 +phy_rx_polarity_flip_fabric49.BCM8879X=0 +phy_rx_polarity_flip_fabric50.BCM8879X=1 +phy_rx_polarity_flip_fabric51.BCM8879X=0 + +phy_rx_polarity_flip_fabric52.BCM8879X=0 +phy_rx_polarity_flip_fabric53.BCM8879X=1 +phy_rx_polarity_flip_fabric54.BCM8879X=0 +phy_rx_polarity_flip_fabric55.BCM8879X=1 + +phy_rx_polarity_flip_fabric56.BCM8879X=0 +phy_rx_polarity_flip_fabric57.BCM8879X=1 +phy_rx_polarity_flip_fabric58.BCM8879X=0 +phy_rx_polarity_flip_fabric59.BCM8879X=1 + +phy_rx_polarity_flip_fabric60.BCM8879X=0 +phy_rx_polarity_flip_fabric61.BCM8879X=1 +phy_rx_polarity_flip_fabric62.BCM8879X=0 +phy_rx_polarity_flip_fabric63.BCM8879X=1 + +phy_rx_polarity_flip_fabric64.BCM8879X=0 +phy_rx_polarity_flip_fabric65.BCM8879X=1 +phy_rx_polarity_flip_fabric66.BCM8879X=0 +phy_rx_polarity_flip_fabric67.BCM8879X=1 + +phy_rx_polarity_flip_fabric68.BCM8879X=1 +phy_rx_polarity_flip_fabric69.BCM8879X=0 +phy_rx_polarity_flip_fabric70.BCM8879X=1 +phy_rx_polarity_flip_fabric71.BCM8879X=0 + +phy_rx_polarity_flip_fabric72.BCM8879X=1 +phy_rx_polarity_flip_fabric73.BCM8879X=0 +phy_rx_polarity_flip_fabric74.BCM8879X=1 +phy_rx_polarity_flip_fabric75.BCM8879X=0 + +phy_rx_polarity_flip_fabric76.BCM8879X=0 +phy_rx_polarity_flip_fabric77.BCM8879X=1 +phy_rx_polarity_flip_fabric78.BCM8879X=0 +phy_rx_polarity_flip_fabric79.BCM8879X=1 + +phy_rx_polarity_flip_fabric80.BCM8879X=1 +phy_rx_polarity_flip_fabric81.BCM8879X=0 +phy_rx_polarity_flip_fabric82.BCM8879X=1 +phy_rx_polarity_flip_fabric83.BCM8879X=0 + +phy_rx_polarity_flip_fabric84.BCM8879X=0 +phy_rx_polarity_flip_fabric85.BCM8879X=1 +phy_rx_polarity_flip_fabric86.BCM8879X=0 +phy_rx_polarity_flip_fabric87.BCM8879X=1 + +phy_rx_polarity_flip_fabric88.BCM8879X=1 +phy_rx_polarity_flip_fabric89.BCM8879X=0 +phy_rx_polarity_flip_fabric90.BCM8879X=1 +phy_rx_polarity_flip_fabric91.BCM8879X=0 + +phy_rx_polarity_flip_fabric92.BCM8879X=1 +phy_rx_polarity_flip_fabric93.BCM8879X=0 +phy_rx_polarity_flip_fabric94.BCM8879X=1 +phy_rx_polarity_flip_fabric95.BCM8879X=0 + +phy_rx_polarity_flip_fabric96.BCM8879X=0 +phy_rx_polarity_flip_fabric97.BCM8879X=1 +phy_rx_polarity_flip_fabric98.BCM8879X=0 +phy_rx_polarity_flip_fabric99.BCM8879X=1 + +phy_rx_polarity_flip_fabric100.BCM8879X=1 +phy_rx_polarity_flip_fabric101.BCM8879X=0 +phy_rx_polarity_flip_fabric102.BCM8879X=1 +phy_rx_polarity_flip_fabric103.BCM8879X=0 + +phy_rx_polarity_flip_fabric104.BCM8879X=0 +phy_rx_polarity_flip_fabric105.BCM8879X=1 +phy_rx_polarity_flip_fabric106.BCM8879X=0 +phy_rx_polarity_flip_fabric107.BCM8879X=1 + +phy_rx_polarity_flip_fabric108.BCM8879X=0 +phy_rx_polarity_flip_fabric109.BCM8879X=1 +phy_rx_polarity_flip_fabric110.BCM8879X=0 +phy_rx_polarity_flip_fabric111.BCM8879X=1 + +phy_rx_polarity_flip_fabric112.BCM8879X=1 +phy_rx_polarity_flip_fabric113.BCM8879X=0 +phy_rx_polarity_flip_fabric114.BCM8879X=1 +phy_rx_polarity_flip_fabric115.BCM8879X=0 + +phy_rx_polarity_flip_fabric116.BCM8879X=0 +phy_rx_polarity_flip_fabric117.BCM8879X=1 +phy_rx_polarity_flip_fabric118.BCM8879X=0 +phy_rx_polarity_flip_fabric119.BCM8879X=1 + +phy_rx_polarity_flip_fabric120.BCM8879X=1 +phy_rx_polarity_flip_fabric121.BCM8879X=0 +phy_rx_polarity_flip_fabric122.BCM8879X=1 +phy_rx_polarity_flip_fabric123.BCM8879X=0 + +phy_rx_polarity_flip_fabric124.BCM8879X=1 +phy_rx_polarity_flip_fabric125.BCM8879X=0 +phy_rx_polarity_flip_fabric126.BCM8879X=1 +phy_rx_polarity_flip_fabric127.BCM8879X=0 + +phy_rx_polarity_flip_fabric128.BCM8879X=0 +phy_rx_polarity_flip_fabric129.BCM8879X=1 +phy_rx_polarity_flip_fabric130.BCM8879X=0 +phy_rx_polarity_flip_fabric131.BCM8879X=1 + +phy_rx_polarity_flip_fabric132.BCM8879X=1 +phy_rx_polarity_flip_fabric133.BCM8879X=0 +phy_rx_polarity_flip_fabric134.BCM8879X=1 +phy_rx_polarity_flip_fabric135.BCM8879X=0 + +phy_rx_polarity_flip_fabric136.BCM8879X=0 +phy_rx_polarity_flip_fabric137.BCM8879X=1 +phy_rx_polarity_flip_fabric138.BCM8879X=0 +phy_rx_polarity_flip_fabric139.BCM8879X=1 + +phy_rx_polarity_flip_fabric140.BCM8879X=1 +phy_rx_polarity_flip_fabric141.BCM8879X=0 +phy_rx_polarity_flip_fabric142.BCM8879X=1 +phy_rx_polarity_flip_fabric143.BCM8879X=0 + +phy_rx_polarity_flip_fabric144.BCM8879X=1 +phy_rx_polarity_flip_fabric145.BCM8879X=0 +phy_rx_polarity_flip_fabric146.BCM8879X=1 +phy_rx_polarity_flip_fabric147.BCM8879X=0 + +phy_rx_polarity_flip_fabric148.BCM8879X=0 +phy_rx_polarity_flip_fabric149.BCM8879X=1 +phy_rx_polarity_flip_fabric150.BCM8879X=0 +phy_rx_polarity_flip_fabric151.BCM8879X=1 + +phy_rx_polarity_flip_fabric152.BCM8879X=1 +phy_rx_polarity_flip_fabric153.BCM8879X=0 +phy_rx_polarity_flip_fabric154.BCM8879X=1 +phy_rx_polarity_flip_fabric155.BCM8879X=0 + +phy_rx_polarity_flip_fabric156.BCM8879X=0 +phy_rx_polarity_flip_fabric157.BCM8879X=1 +phy_rx_polarity_flip_fabric158.BCM8879X=0 +phy_rx_polarity_flip_fabric159.BCM8879X=1 + +phy_rx_polarity_flip_fabric160.BCM8879X=1 +phy_rx_polarity_flip_fabric161.BCM8879X=0 +phy_rx_polarity_flip_fabric162.BCM8879X=1 +phy_rx_polarity_flip_fabric163.BCM8879X=0 + +phy_rx_polarity_flip_fabric164.BCM8879X=1 +phy_rx_polarity_flip_fabric165.BCM8879X=0 +phy_rx_polarity_flip_fabric166.BCM8879X=1 +phy_rx_polarity_flip_fabric167.BCM8879X=0 + +phy_rx_polarity_flip_fabric168.BCM8879X=1 +phy_rx_polarity_flip_fabric169.BCM8879X=0 +phy_rx_polarity_flip_fabric170.BCM8879X=1 +phy_rx_polarity_flip_fabric171.BCM8879X=0 + +phy_rx_polarity_flip_fabric172.BCM8879X=0 +phy_rx_polarity_flip_fabric173.BCM8879X=1 +phy_rx_polarity_flip_fabric174.BCM8879X=0 +phy_rx_polarity_flip_fabric175.BCM8879X=1 + +phy_rx_polarity_flip_fabric176.BCM8879X=1 +phy_rx_polarity_flip_fabric177.BCM8879X=0 +phy_rx_polarity_flip_fabric178.BCM8879X=1 +phy_rx_polarity_flip_fabric179.BCM8879X=0 + +phy_rx_polarity_flip_fabric180.BCM8879X=0 +phy_rx_polarity_flip_fabric181.BCM8879X=1 +phy_rx_polarity_flip_fabric182.BCM8879X=0 +phy_rx_polarity_flip_fabric183.BCM8879X=1 + +phy_rx_polarity_flip_fabric184.BCM8879X=1 +phy_rx_polarity_flip_fabric185.BCM8879X=0 +phy_rx_polarity_flip_fabric186.BCM8879X=1 +phy_rx_polarity_flip_fabric187.BCM8879X=0 + +phy_rx_polarity_flip_fabric188.BCM8879X=1 +phy_rx_polarity_flip_fabric189.BCM8879X=0 +phy_rx_polarity_flip_fabric190.BCM8879X=1 +phy_rx_polarity_flip_fabric191.BCM8879X=0 + + +phy_tx_polarity_flip_fabric0.BCM8879X=0 +phy_tx_polarity_flip_fabric1.BCM8879X=1 +phy_tx_polarity_flip_fabric2.BCM8879X=0 +phy_tx_polarity_flip_fabric3.BCM8879X=1 + +phy_tx_polarity_flip_fabric4.BCM8879X=0 +phy_tx_polarity_flip_fabric5.BCM8879X=1 +phy_tx_polarity_flip_fabric6.BCM8879X=0 +phy_tx_polarity_flip_fabric7.BCM8879X=1 + +phy_tx_polarity_flip_fabric8.BCM8879X=1 +phy_tx_polarity_flip_fabric9.BCM8879X=0 +phy_tx_polarity_flip_fabric10.BCM8879X=1 +phy_tx_polarity_flip_fabric11.BCM8879X=0 + +phy_tx_polarity_flip_fabric12.BCM8879X=0 +phy_tx_polarity_flip_fabric13.BCM8879X=1 +phy_tx_polarity_flip_fabric14.BCM8879X=0 +phy_tx_polarity_flip_fabric15.BCM8879X=1 + +phy_tx_polarity_flip_fabric16.BCM8879X=0 +phy_tx_polarity_flip_fabric17.BCM8879X=1 +phy_tx_polarity_flip_fabric18.BCM8879X=0 +phy_tx_polarity_flip_fabric19.BCM8879X=1 + +phy_tx_polarity_flip_fabric20.BCM8879X=1 +phy_tx_polarity_flip_fabric21.BCM8879X=0 +phy_tx_polarity_flip_fabric22.BCM8879X=1 +phy_tx_polarity_flip_fabric23.BCM8879X=0 + +phy_tx_polarity_flip_fabric24.BCM8879X=0 +phy_tx_polarity_flip_fabric25.BCM8879X=1 +phy_tx_polarity_flip_fabric26.BCM8879X=0 +phy_tx_polarity_flip_fabric27.BCM8879X=1 + +phy_tx_polarity_flip_fabric28.BCM8879X=0 +phy_tx_polarity_flip_fabric29.BCM8879X=1 +phy_tx_polarity_flip_fabric30.BCM8879X=0 +phy_tx_polarity_flip_fabric31.BCM8879X=1 + +phy_tx_polarity_flip_fabric32.BCM8879X=1 +phy_tx_polarity_flip_fabric33.BCM8879X=0 +phy_tx_polarity_flip_fabric34.BCM8879X=1 +phy_tx_polarity_flip_fabric35.BCM8879X=0 + +phy_tx_polarity_flip_fabric36.BCM8879X=0 +phy_tx_polarity_flip_fabric37.BCM8879X=1 +phy_tx_polarity_flip_fabric38.BCM8879X=0 +phy_tx_polarity_flip_fabric39.BCM8879X=1 + +phy_tx_polarity_flip_fabric40.BCM8879X=1 +phy_tx_polarity_flip_fabric41.BCM8879X=0 +phy_tx_polarity_flip_fabric42.BCM8879X=1 +phy_tx_polarity_flip_fabric43.BCM8879X=0 + +phy_tx_polarity_flip_fabric44.BCM8879X=0 +phy_tx_polarity_flip_fabric45.BCM8879X=1 +phy_tx_polarity_flip_fabric46.BCM8879X=0 +phy_tx_polarity_flip_fabric47.BCM8879X=1 + +phy_tx_polarity_flip_fabric48.BCM8879X=0 +phy_tx_polarity_flip_fabric49.BCM8879X=1 +phy_tx_polarity_flip_fabric50.BCM8879X=0 +phy_tx_polarity_flip_fabric51.BCM8879X=1 + +phy_tx_polarity_flip_fabric52.BCM8879X=1 +phy_tx_polarity_flip_fabric53.BCM8879X=0 +phy_tx_polarity_flip_fabric54.BCM8879X=1 +phy_tx_polarity_flip_fabric55.BCM8879X=0 + +phy_tx_polarity_flip_fabric56.BCM8879X=1 +phy_tx_polarity_flip_fabric57.BCM8879X=0 +phy_tx_polarity_flip_fabric58.BCM8879X=1 +phy_tx_polarity_flip_fabric59.BCM8879X=0 + +phy_tx_polarity_flip_fabric60.BCM8879X=1 +phy_tx_polarity_flip_fabric61.BCM8879X=0 +phy_tx_polarity_flip_fabric62.BCM8879X=1 +phy_tx_polarity_flip_fabric63.BCM8879X=0 + +phy_tx_polarity_flip_fabric64.BCM8879X=1 +phy_tx_polarity_flip_fabric65.BCM8879X=0 +phy_tx_polarity_flip_fabric66.BCM8879X=1 +phy_tx_polarity_flip_fabric67.BCM8879X=0 + +phy_tx_polarity_flip_fabric68.BCM8879X=0 +phy_tx_polarity_flip_fabric69.BCM8879X=1 +phy_tx_polarity_flip_fabric70.BCM8879X=0 +phy_tx_polarity_flip_fabric71.BCM8879X=1 + +phy_tx_polarity_flip_fabric72.BCM8879X=0 +phy_tx_polarity_flip_fabric73.BCM8879X=1 +phy_tx_polarity_flip_fabric74.BCM8879X=0 +phy_tx_polarity_flip_fabric75.BCM8879X=1 + +phy_tx_polarity_flip_fabric76.BCM8879X=1 +phy_tx_polarity_flip_fabric77.BCM8879X=0 +phy_tx_polarity_flip_fabric78.BCM8879X=1 +phy_tx_polarity_flip_fabric79.BCM8879X=0 + +phy_tx_polarity_flip_fabric80.BCM8879X=0 +phy_tx_polarity_flip_fabric81.BCM8879X=1 +phy_tx_polarity_flip_fabric82.BCM8879X=0 +phy_tx_polarity_flip_fabric83.BCM8879X=1 + +phy_tx_polarity_flip_fabric84.BCM8879X=1 +phy_tx_polarity_flip_fabric85.BCM8879X=0 +phy_tx_polarity_flip_fabric86.BCM8879X=1 +phy_tx_polarity_flip_fabric87.BCM8879X=0 + +phy_tx_polarity_flip_fabric88.BCM8879X=0 +phy_tx_polarity_flip_fabric89.BCM8879X=1 +phy_tx_polarity_flip_fabric90.BCM8879X=0 +phy_tx_polarity_flip_fabric91.BCM8879X=1 + +phy_tx_polarity_flip_fabric92.BCM8879X=0 +phy_tx_polarity_flip_fabric93.BCM8879X=1 +phy_tx_polarity_flip_fabric94.BCM8879X=0 +phy_tx_polarity_flip_fabric95.BCM8879X=1 + +phy_tx_polarity_flip_fabric96.BCM8879X=1 +phy_tx_polarity_flip_fabric97.BCM8879X=0 +phy_tx_polarity_flip_fabric98.BCM8879X=1 +phy_tx_polarity_flip_fabric99.BCM8879X=0 + +phy_tx_polarity_flip_fabric100.BCM8879X=0 +phy_tx_polarity_flip_fabric101.BCM8879X=1 +phy_tx_polarity_flip_fabric102.BCM8879X=0 +phy_tx_polarity_flip_fabric103.BCM8879X=1 + +phy_tx_polarity_flip_fabric104.BCM8879X=1 +phy_tx_polarity_flip_fabric105.BCM8879X=0 +phy_tx_polarity_flip_fabric106.BCM8879X=1 +phy_tx_polarity_flip_fabric107.BCM8879X=0 + +phy_tx_polarity_flip_fabric108.BCM8879X=1 +phy_tx_polarity_flip_fabric109.BCM8879X=0 +phy_tx_polarity_flip_fabric110.BCM8879X=1 +phy_tx_polarity_flip_fabric111.BCM8879X=0 + +phy_tx_polarity_flip_fabric112.BCM8879X=0 +phy_tx_polarity_flip_fabric113.BCM8879X=1 +phy_tx_polarity_flip_fabric114.BCM8879X=0 +phy_tx_polarity_flip_fabric115.BCM8879X=1 + +phy_tx_polarity_flip_fabric116.BCM8879X=1 +phy_tx_polarity_flip_fabric117.BCM8879X=0 +phy_tx_polarity_flip_fabric118.BCM8879X=1 +phy_tx_polarity_flip_fabric119.BCM8879X=0 + +phy_tx_polarity_flip_fabric120.BCM8879X=0 +phy_tx_polarity_flip_fabric121.BCM8879X=1 +phy_tx_polarity_flip_fabric122.BCM8879X=0 +phy_tx_polarity_flip_fabric123.BCM8879X=1 + +phy_tx_polarity_flip_fabric124.BCM8879X=0 +phy_tx_polarity_flip_fabric125.BCM8879X=1 +phy_tx_polarity_flip_fabric126.BCM8879X=0 +phy_tx_polarity_flip_fabric127.BCM8879X=1 + +phy_tx_polarity_flip_fabric128.BCM8879X=1 +phy_tx_polarity_flip_fabric129.BCM8879X=0 +phy_tx_polarity_flip_fabric130.BCM8879X=1 +phy_tx_polarity_flip_fabric131.BCM8879X=0 + +phy_tx_polarity_flip_fabric132.BCM8879X=0 +phy_tx_polarity_flip_fabric133.BCM8879X=1 +phy_tx_polarity_flip_fabric134.BCM8879X=0 +phy_tx_polarity_flip_fabric135.BCM8879X=1 + +phy_tx_polarity_flip_fabric136.BCM8879X=1 +phy_tx_polarity_flip_fabric137.BCM8879X=0 +phy_tx_polarity_flip_fabric138.BCM8879X=1 +phy_tx_polarity_flip_fabric139.BCM8879X=0 + +phy_tx_polarity_flip_fabric140.BCM8879X=0 +phy_tx_polarity_flip_fabric141.BCM8879X=1 +phy_tx_polarity_flip_fabric142.BCM8879X=0 +phy_tx_polarity_flip_fabric143.BCM8879X=1 + +phy_tx_polarity_flip_fabric144.BCM8879X=0 +phy_tx_polarity_flip_fabric145.BCM8879X=1 +phy_tx_polarity_flip_fabric146.BCM8879X=0 +phy_tx_polarity_flip_fabric147.BCM8879X=1 + +phy_tx_polarity_flip_fabric148.BCM8879X=1 +phy_tx_polarity_flip_fabric149.BCM8879X=0 +phy_tx_polarity_flip_fabric150.BCM8879X=1 +phy_tx_polarity_flip_fabric151.BCM8879X=0 + +phy_tx_polarity_flip_fabric152.BCM8879X=0 +phy_tx_polarity_flip_fabric153.BCM8879X=1 +phy_tx_polarity_flip_fabric154.BCM8879X=0 +phy_tx_polarity_flip_fabric155.BCM8879X=1 + +phy_tx_polarity_flip_fabric156.BCM8879X=1 +phy_tx_polarity_flip_fabric157.BCM8879X=0 +phy_tx_polarity_flip_fabric158.BCM8879X=1 +phy_tx_polarity_flip_fabric159.BCM8879X=0 + +phy_tx_polarity_flip_fabric160.BCM8879X=0 +phy_tx_polarity_flip_fabric161.BCM8879X=1 +phy_tx_polarity_flip_fabric162.BCM8879X=0 +phy_tx_polarity_flip_fabric163.BCM8879X=1 + +phy_tx_polarity_flip_fabric164.BCM8879X=0 +phy_tx_polarity_flip_fabric165.BCM8879X=1 +phy_tx_polarity_flip_fabric166.BCM8879X=0 +phy_tx_polarity_flip_fabric167.BCM8879X=1 + +phy_tx_polarity_flip_fabric168.BCM8879X=0 +phy_tx_polarity_flip_fabric169.BCM8879X=1 +phy_tx_polarity_flip_fabric170.BCM8879X=0 +phy_tx_polarity_flip_fabric171.BCM8879X=1 + +phy_tx_polarity_flip_fabric172.BCM8879X=1 +phy_tx_polarity_flip_fabric173.BCM8879X=0 +phy_tx_polarity_flip_fabric174.BCM8879X=1 +phy_tx_polarity_flip_fabric175.BCM8879X=0 + +phy_tx_polarity_flip_fabric176.BCM8879X=0 +phy_tx_polarity_flip_fabric177.BCM8879X=1 +phy_tx_polarity_flip_fabric178.BCM8879X=0 +phy_tx_polarity_flip_fabric179.BCM8879X=1 + +phy_tx_polarity_flip_fabric180.BCM8879X=1 +phy_tx_polarity_flip_fabric181.BCM8879X=0 +phy_tx_polarity_flip_fabric182.BCM8879X=1 +phy_tx_polarity_flip_fabric183.BCM8879X=0 + +phy_tx_polarity_flip_fabric184.BCM8879X=0 +phy_tx_polarity_flip_fabric185.BCM8879X=1 +phy_tx_polarity_flip_fabric186.BCM8879X=0 +phy_tx_polarity_flip_fabric187.BCM8879X=1 + +phy_tx_polarity_flip_fabric188.BCM8879X=0 +phy_tx_polarity_flip_fabric189.BCM8879X=1 +phy_tx_polarity_flip_fabric190.BCM8879X=0 +phy_tx_polarity_flip_fabric191.BCM8879X=1 + +port_init_cl72_0=0 +port_init_cl72_1=0 +port_init_cl72_2=0 +port_init_cl72_3=0 +port_init_cl72_4=0 +port_init_cl72_5=0 +port_init_cl72_6=0 +port_init_cl72_7=0 +port_init_cl72_8=0 +port_init_cl72_9=0 +port_init_cl72_10=0 +port_init_cl72_11=0 +port_init_cl72_12=0 +port_init_cl72_13=0 +port_init_cl72_14=0 +port_init_cl72_15=0 +port_init_cl72_16=0 +port_init_cl72_17=0 +port_init_cl72_18=0 +port_init_cl72_19=0 +port_init_cl72_20=0 +port_init_cl72_21=0 +port_init_cl72_22=0 +port_init_cl72_23=0 +port_init_cl72_24=0 +port_init_cl72_25=0 +port_init_cl72_26=0 +port_init_cl72_27=0 +port_init_cl72_28=0 +port_init_cl72_29=0 +port_init_cl72_30=0 +port_init_cl72_31=0 +port_init_cl72_32=0 +port_init_cl72_33=0 +port_init_cl72_34=0 +port_init_cl72_35=0 +port_init_cl72_36=0 +port_init_cl72_37=0 +port_init_cl72_38=0 +port_init_cl72_39=0 +port_init_cl72_40=0 +port_init_cl72_41=0 +port_init_cl72_42=0 +port_init_cl72_43=0 +port_init_cl72_44=0 +port_init_cl72_45=0 +port_init_cl72_46=0 +port_init_cl72_47=0 +port_init_cl72_48=0 +port_init_cl72_49=0 +port_init_cl72_50=0 +port_init_cl72_51=0 +port_init_cl72_52=0 +port_init_cl72_53=0 +port_init_cl72_54=0 +port_init_cl72_55=0 +port_init_cl72_56=0 +port_init_cl72_57=0 +port_init_cl72_58=0 +port_init_cl72_59=0 +port_init_cl72_60=0 +port_init_cl72_61=0 +port_init_cl72_62=0 +port_init_cl72_63=0 +port_init_cl72_64=0 +port_init_cl72_65=0 +port_init_cl72_66=0 +port_init_cl72_67=0 +port_init_cl72_68=0 +port_init_cl72_69=0 +port_init_cl72_70=0 +port_init_cl72_71=0 +port_init_cl72_72=0 +port_init_cl72_73=0 +port_init_cl72_74=0 +port_init_cl72_75=0 +port_init_cl72_76=0 +port_init_cl72_77=0 +port_init_cl72_78=0 +port_init_cl72_79=0 +port_init_cl72_80=0 +port_init_cl72_81=0 +port_init_cl72_82=0 +port_init_cl72_83=0 +port_init_cl72_84=0 +port_init_cl72_85=0 +port_init_cl72_86=0 +port_init_cl72_87=0 +port_init_cl72_88=0 +port_init_cl72_89=0 +port_init_cl72_90=0 +port_init_cl72_91=0 +port_init_cl72_92=0 +port_init_cl72_93=0 +port_init_cl72_94=0 +port_init_cl72_95=0 +port_init_cl72_96=0 +port_init_cl72_97=0 +port_init_cl72_98=0 +port_init_cl72_99=0 +port_init_cl72_100=0 +port_init_cl72_101=0 +port_init_cl72_102=0 +port_init_cl72_103=0 +port_init_cl72_104=0 +port_init_cl72_105=0 +port_init_cl72_106=0 +port_init_cl72_107=0 +port_init_cl72_108=0 +port_init_cl72_109=0 +port_init_cl72_110=0 +port_init_cl72_111=0 +port_init_cl72_112=0 +port_init_cl72_113=0 +port_init_cl72_114=0 +port_init_cl72_115=0 +port_init_cl72_116=0 +port_init_cl72_117=0 +port_init_cl72_118=0 +port_init_cl72_119=0 +port_init_cl72_120=0 +port_init_cl72_121=0 +port_init_cl72_122=0 +port_init_cl72_123=0 +port_init_cl72_124=0 +port_init_cl72_125=0 +port_init_cl72_126=0 +port_init_cl72_127=0 +port_init_cl72_128=0 +port_init_cl72_129=0 +port_init_cl72_130=0 +port_init_cl72_131=0 +port_init_cl72_132=0 +port_init_cl72_133=0 +port_init_cl72_134=0 +port_init_cl72_135=0 +port_init_cl72_136=0 +port_init_cl72_137=0 +port_init_cl72_138=0 +port_init_cl72_139=0 +port_init_cl72_140=0 +port_init_cl72_141=0 +port_init_cl72_142=0 +port_init_cl72_143=0 +port_init_cl72_144=0 +port_init_cl72_145=0 +port_init_cl72_146=0 +port_init_cl72_147=0 +port_init_cl72_148=0 +port_init_cl72_149=0 +port_init_cl72_150=0 +port_init_cl72_151=0 +port_init_cl72_152=0 +port_init_cl72_153=0 +port_init_cl72_154=0 +port_init_cl72_155=0 +port_init_cl72_156=0 +port_init_cl72_157=0 +port_init_cl72_158=0 +port_init_cl72_159=0 +port_init_cl72_160=0 +port_init_cl72_161=0 +port_init_cl72_162=0 +port_init_cl72_163=0 +port_init_cl72_164=0 +port_init_cl72_165=0 +port_init_cl72_166=0 +port_init_cl72_167=0 +port_init_cl72_168=0 +port_init_cl72_169=0 +port_init_cl72_170=0 +port_init_cl72_171=0 +port_init_cl72_172=0 +port_init_cl72_173=0 +port_init_cl72_174=0 +port_init_cl72_175=0 +port_init_cl72_176=0 +port_init_cl72_177=0 +port_init_cl72_178=0 +port_init_cl72_179=0 +port_init_cl72_180=0 +port_init_cl72_181=0 +port_init_cl72_182=0 +port_init_cl72_183=0 +port_init_cl72_184=0 +port_init_cl72_185=0 +port_init_cl72_186=0 +port_init_cl72_187=0 +port_init_cl72_188=0 +port_init_cl72_189=0 +port_init_cl72_190=0 +port_init_cl72_191=0 + +serdes_tx_taps_0.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_1.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_2.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_3.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_4.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_5.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_6.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_7.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_8.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_9.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_10.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_11.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_12.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_13.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_14.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_15.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_16.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_17.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_18.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_19.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_20.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_21.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_22.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_23.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_24.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_25.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_26.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_27.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_28.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_29.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_30.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_31.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_32.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_33.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_34.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_35.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_36.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_37.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_38.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_39.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_40.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_41.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_42.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_43.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_44.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_45.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_46.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_47.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_48.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_49.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_50.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_51.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_52.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_53.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_54.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_55.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_56.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_57.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_58.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_59.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_60.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_61.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_62.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_63.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_64.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_65.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_66.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_67.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_68.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_69.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_70.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_71.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_72.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_73.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_74.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_75.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_76.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_77.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_78.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_79.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_80.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_81.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_82.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_83.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_84.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_85.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_86.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_87.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_88.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_89.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_90.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_91.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_92.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_93.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_94.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_95.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_96.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_97.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_98.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_99.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_100.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_101.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_102.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_103.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_104.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_105.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_106.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_107.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_108.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_109.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_110.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_111.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_112.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_113.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_114.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_115.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_116.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_117.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_118.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_119.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_120.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_121.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_122.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_123.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_124.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_125.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_126.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_127.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_128.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_129.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_130.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_131.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_132.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_133.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_134.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_135.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_136.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_137.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_138.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_139.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_140.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_141.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_142.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_143.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_144.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_145.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_146.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_147.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_148.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_149.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_150.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_151.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_152.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_153.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_154.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_155.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_156.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_157.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_158.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_159.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_160.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_161.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_162.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_163.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_164.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_165.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_166.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_167.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_168.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_169.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_170.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_171.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_172.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_173.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_174.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_175.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_176.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_177.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_178.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_179.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_180.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_181.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_182.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_183.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_184.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_185.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_186.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_187.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_188.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_189.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_190.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_191.BCM8879X=pam4:-24:132:-12:0:0:0 + +serdes_lane_config_channel_mode_0.0=force_nr +serdes_lane_config_channel_mode_1.0=force_nr +serdes_lane_config_channel_mode_2.0=force_nr +serdes_lane_config_channel_mode_3.0=force_nr +serdes_lane_config_channel_mode_4.0=force_nr +serdes_lane_config_channel_mode_5.0=force_nr +serdes_lane_config_channel_mode_6.0=force_nr +serdes_lane_config_channel_mode_7.0=force_nr +serdes_lane_config_channel_mode_8.0=force_nr +serdes_lane_config_channel_mode_9.0=force_nr +serdes_lane_config_channel_mode_10.0=force_nr +serdes_lane_config_channel_mode_11.0=force_nr +serdes_lane_config_channel_mode_12.0=force_nr +serdes_lane_config_channel_mode_13.0=force_nr +serdes_lane_config_channel_mode_14.0=force_nr +serdes_lane_config_channel_mode_15.0=force_nr +serdes_lane_config_channel_mode_16.0=force_nr +serdes_lane_config_channel_mode_17.0=force_nr +serdes_lane_config_channel_mode_18.0=force_nr +serdes_lane_config_channel_mode_19.0=force_nr +serdes_lane_config_channel_mode_20.0=force_nr +serdes_lane_config_channel_mode_21.0=force_nr +serdes_lane_config_channel_mode_22.0=force_nr +serdes_lane_config_channel_mode_23.0=force_nr +serdes_lane_config_channel_mode_24.0=force_nr +serdes_lane_config_channel_mode_25.0=force_nr +serdes_lane_config_channel_mode_26.0=force_nr +serdes_lane_config_channel_mode_27.0=force_nr +serdes_lane_config_channel_mode_28.0=force_nr +serdes_lane_config_channel_mode_29.0=force_nr +serdes_lane_config_channel_mode_30.0=force_nr +serdes_lane_config_channel_mode_31.0=force_nr +serdes_lane_config_channel_mode_32.0=force_nr +serdes_lane_config_channel_mode_33.0=force_nr +serdes_lane_config_channel_mode_34.0=force_nr +serdes_lane_config_channel_mode_35.0=force_nr +serdes_lane_config_channel_mode_36.0=force_nr +serdes_lane_config_channel_mode_37.0=force_nr +serdes_lane_config_channel_mode_38.0=force_nr +serdes_lane_config_channel_mode_39.0=force_nr +serdes_lane_config_channel_mode_40.0=force_nr +serdes_lane_config_channel_mode_41.0=force_nr +serdes_lane_config_channel_mode_42.0=force_nr +serdes_lane_config_channel_mode_43.0=force_nr +serdes_lane_config_channel_mode_44.0=force_nr +serdes_lane_config_channel_mode_45.0=force_nr +serdes_lane_config_channel_mode_46.0=force_nr +serdes_lane_config_channel_mode_47.0=force_nr +serdes_lane_config_channel_mode_48.0=force_nr +serdes_lane_config_channel_mode_49.0=force_nr +serdes_lane_config_channel_mode_50.0=force_nr +serdes_lane_config_channel_mode_51.0=force_nr +serdes_lane_config_channel_mode_52.0=force_nr +serdes_lane_config_channel_mode_53.0=force_nr +serdes_lane_config_channel_mode_54.0=force_nr +serdes_lane_config_channel_mode_55.0=force_nr +serdes_lane_config_channel_mode_56.0=force_nr +serdes_lane_config_channel_mode_57.0=force_nr +serdes_lane_config_channel_mode_58.0=force_nr +serdes_lane_config_channel_mode_59.0=force_nr +serdes_lane_config_channel_mode_60.0=force_nr +serdes_lane_config_channel_mode_61.0=force_nr +serdes_lane_config_channel_mode_62.0=force_nr +serdes_lane_config_channel_mode_63.0=force_nr +serdes_lane_config_channel_mode_64.0=force_nr +serdes_lane_config_channel_mode_65.0=force_nr +serdes_lane_config_channel_mode_66.0=force_nr +serdes_lane_config_channel_mode_67.0=force_nr +serdes_lane_config_channel_mode_68.0=force_nr +serdes_lane_config_channel_mode_69.0=force_nr +serdes_lane_config_channel_mode_70.0=force_nr +serdes_lane_config_channel_mode_71.0=force_nr +serdes_lane_config_channel_mode_72.0=force_nr +serdes_lane_config_channel_mode_73.0=force_nr +serdes_lane_config_channel_mode_74.0=force_nr +serdes_lane_config_channel_mode_75.0=force_nr +serdes_lane_config_channel_mode_76.0=force_nr +serdes_lane_config_channel_mode_77.0=force_nr +serdes_lane_config_channel_mode_78.0=force_nr +serdes_lane_config_channel_mode_79.0=force_nr +serdes_lane_config_channel_mode_80.0=force_nr +serdes_lane_config_channel_mode_81.0=force_nr +serdes_lane_config_channel_mode_82.0=force_nr +serdes_lane_config_channel_mode_83.0=force_nr +serdes_lane_config_channel_mode_84.0=force_nr +serdes_lane_config_channel_mode_85.0=force_nr +serdes_lane_config_channel_mode_86.0=force_nr +serdes_lane_config_channel_mode_87.0=force_nr +serdes_lane_config_channel_mode_88.0=force_nr +serdes_lane_config_channel_mode_89.0=force_nr +serdes_lane_config_channel_mode_90.0=force_nr +serdes_lane_config_channel_mode_91.0=force_nr +serdes_lane_config_channel_mode_92.0=force_nr +serdes_lane_config_channel_mode_93.0=force_nr +serdes_lane_config_channel_mode_94.0=force_nr +serdes_lane_config_channel_mode_95.0=force_nr +serdes_lane_config_channel_mode_96.0=force_nr +serdes_lane_config_channel_mode_97.0=force_nr +serdes_lane_config_channel_mode_98.0=force_nr +serdes_lane_config_channel_mode_99.0=force_nr +serdes_lane_config_channel_mode_100.0=force_nr +serdes_lane_config_channel_mode_101.0=force_nr +serdes_lane_config_channel_mode_102.0=force_nr +serdes_lane_config_channel_mode_103.0=force_nr +serdes_lane_config_channel_mode_104.0=force_nr +serdes_lane_config_channel_mode_105.0=force_nr +serdes_lane_config_channel_mode_106.0=force_nr +serdes_lane_config_channel_mode_107.0=force_nr +serdes_lane_config_channel_mode_108.0=force_nr +serdes_lane_config_channel_mode_109.0=force_nr +serdes_lane_config_channel_mode_110.0=force_nr +serdes_lane_config_channel_mode_111.0=force_nr +serdes_lane_config_channel_mode_112.0=force_nr +serdes_lane_config_channel_mode_113.0=force_nr +serdes_lane_config_channel_mode_114.0=force_nr +serdes_lane_config_channel_mode_115.0=force_nr +serdes_lane_config_channel_mode_116.0=force_nr +serdes_lane_config_channel_mode_117.0=force_nr +serdes_lane_config_channel_mode_118.0=force_nr +serdes_lane_config_channel_mode_119.0=force_nr +serdes_lane_config_channel_mode_120.0=force_nr +serdes_lane_config_channel_mode_121.0=force_nr +serdes_lane_config_channel_mode_122.0=force_nr +serdes_lane_config_channel_mode_123.0=force_nr +serdes_lane_config_channel_mode_124.0=force_nr +serdes_lane_config_channel_mode_125.0=force_nr +serdes_lane_config_channel_mode_126.0=force_nr +serdes_lane_config_channel_mode_127.0=force_nr +serdes_lane_config_channel_mode_128.0=force_nr +serdes_lane_config_channel_mode_129.0=force_nr +serdes_lane_config_channel_mode_130.0=force_nr +serdes_lane_config_channel_mode_131.0=force_nr +serdes_lane_config_channel_mode_132.0=force_nr +serdes_lane_config_channel_mode_133.0=force_nr +serdes_lane_config_channel_mode_134.0=force_nr +serdes_lane_config_channel_mode_135.0=force_nr +serdes_lane_config_channel_mode_136.0=force_nr +serdes_lane_config_channel_mode_137.0=force_nr +serdes_lane_config_channel_mode_138.0=force_nr +serdes_lane_config_channel_mode_139.0=force_nr +serdes_lane_config_channel_mode_140.0=force_nr +serdes_lane_config_channel_mode_141.0=force_nr +serdes_lane_config_channel_mode_142.0=force_nr +serdes_lane_config_channel_mode_143.0=force_nr +serdes_lane_config_channel_mode_144.0=force_nr +serdes_lane_config_channel_mode_145.0=force_nr +serdes_lane_config_channel_mode_146.0=force_nr +serdes_lane_config_channel_mode_147.0=force_nr +serdes_lane_config_channel_mode_148.0=force_nr +serdes_lane_config_channel_mode_149.0=force_nr +serdes_lane_config_channel_mode_150.0=force_nr +serdes_lane_config_channel_mode_151.0=force_nr +serdes_lane_config_channel_mode_152.0=force_nr +serdes_lane_config_channel_mode_153.0=force_nr +serdes_lane_config_channel_mode_154.0=force_nr +serdes_lane_config_channel_mode_155.0=force_nr +serdes_lane_config_channel_mode_156.0=force_nr +serdes_lane_config_channel_mode_157.0=force_nr +serdes_lane_config_channel_mode_158.0=force_nr +serdes_lane_config_channel_mode_159.0=force_nr +serdes_lane_config_channel_mode_160.0=force_nr +serdes_lane_config_channel_mode_161.0=force_nr +serdes_lane_config_channel_mode_162.0=force_nr +serdes_lane_config_channel_mode_163.0=force_nr +serdes_lane_config_channel_mode_164.0=force_nr +serdes_lane_config_channel_mode_165.0=force_nr +serdes_lane_config_channel_mode_166.0=force_nr +serdes_lane_config_channel_mode_167.0=force_nr +serdes_lane_config_channel_mode_168.0=force_nr +serdes_lane_config_channel_mode_169.0=force_nr +serdes_lane_config_channel_mode_170.0=force_nr +serdes_lane_config_channel_mode_171.0=force_nr +serdes_lane_config_channel_mode_172.0=force_nr +serdes_lane_config_channel_mode_173.0=force_nr +serdes_lane_config_channel_mode_174.0=force_nr +serdes_lane_config_channel_mode_175.0=force_nr +serdes_lane_config_channel_mode_176.0=force_nr +serdes_lane_config_channel_mode_177.0=force_nr +serdes_lane_config_channel_mode_178.0=force_nr +serdes_lane_config_channel_mode_179.0=force_nr +serdes_lane_config_channel_mode_180.0=force_nr +serdes_lane_config_channel_mode_181.0=force_nr +serdes_lane_config_channel_mode_182.0=force_nr +serdes_lane_config_channel_mode_183.0=force_nr +serdes_lane_config_channel_mode_184.0=force_nr +serdes_lane_config_channel_mode_185.0=force_nr +serdes_lane_config_channel_mode_186.0=force_nr +serdes_lane_config_channel_mode_187.0=force_nr +serdes_lane_config_channel_mode_188.0=force_nr +serdes_lane_config_channel_mode_189.0=force_nr +serdes_lane_config_channel_mode_190.0=force_nr +serdes_lane_config_channel_mode_191.0=force_nr + + +serdes_qrtt_active_0.0=1 +serdes_qrtt_active_1.0=1 +serdes_qrtt_active_2.0=1 +serdes_qrtt_active_3.0=1 +serdes_qrtt_active_4.0=1 +serdes_qrtt_active_5.0=1 +serdes_qrtt_active_6.0=1 +serdes_qrtt_active_7.0=1 +serdes_qrtt_active_8.0=1 +serdes_qrtt_active_9.0=1 +serdes_qrtt_active_10.0=1 +serdes_qrtt_active_11.0=1 +serdes_qrtt_active_12.0=1 +serdes_qrtt_active_13.0=1 +serdes_qrtt_active_14.0=1 +serdes_qrtt_active_15.0=1 +serdes_qrtt_active_16.0=1 +serdes_qrtt_active_17.0=1 +serdes_qrtt_active_18.0=1 +serdes_qrtt_active_19.0=1 +serdes_qrtt_active_20.0=1 +serdes_qrtt_active_21.0=1 +serdes_qrtt_active_22.0=1 +serdes_qrtt_active_23.0=1 +serdes_qrtt_active_24.0=1 +serdes_qrtt_active_25.0=1 +serdes_qrtt_active_26.0=1 +serdes_qrtt_active_27.0=1 +serdes_qrtt_active_28.0=1 +serdes_qrtt_active_29.0=1 +serdes_qrtt_active_30.0=1 +serdes_qrtt_active_31.0=1 +serdes_qrtt_active_32.0=1 +serdes_qrtt_active_33.0=1 +serdes_qrtt_active_34.0=1 +serdes_qrtt_active_35.0=1 +serdes_qrtt_active_36.0=1 +serdes_qrtt_active_37.0=1 +serdes_qrtt_active_38.0=1 +serdes_qrtt_active_39.0=1 +serdes_qrtt_active_40.0=1 +serdes_qrtt_active_41.0=1 +serdes_qrtt_active_42.0=1 +serdes_qrtt_active_43.0=1 +serdes_qrtt_active_44.0=1 +serdes_qrtt_active_45.0=1 +serdes_qrtt_active_46.0=1 +serdes_qrtt_active_47.0=1 diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/8/config-ramon-5-0.bcm b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/8/config-ramon-5-0.bcm new file mode 100644 index 000000000000..4adac068b8eb --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/8/config-ramon-5-0.bcm @@ -0,0 +1,1394 @@ + +appl_enable_intr_init.BCM8879X=0 +appl_param_module_id.BCM8879X=9 +bcm_linkscan_interval.BCM8879X=0 +bcm_stat_interval.BCM8879X=4000000 +bist_enable.BCM8879X=0 +core_clock_speed_khz.BCM8879X=1000000 +custom_feature_access_only.BCM8879X=0 +custom_feature_lane_swap_disable.BCM8879X=0 +dport_map_direct.BCM8879X=1 +fabric_cell_fifo_dma_enable.BCM8879X=0 +fabric_device_mode.BCM8879X=SINGLE_STAGE_FE2 +fabric_load_balancing_mode.BCM8879X=NORMAL_LOAD_BALANCE +fabric_multicast_mode.BCM8879X=DIRECT +fabric_num_pipes.BCM8879X=1 +fabric_pipe_map.BCM8879X=0 +fe_mc_id_range.BCM8879X=128K +load_firmware.BCM8879X=0x102 +mdio_output_delay_ext.BCM8879X=14 +mdio_output_delay_int.BCM8879X=25 +mem_cache_enable_parity.BCM8879X=1 +mm_intr_enable.BCM8879X=0 +mm_timeout_usec.BCM8879X=300000 +polled_irq_delay.BCM8879X=100000 +polled_irq_mode.BCM8879X=1 +port_fec.BCM8879X=7 +port_init_cl72.BCM8879X=0 +port_init_speed.BCM8879X=53125 +rate_ext_mdio_divisor.BCM8879X=14 +rate_int_mdio_divisor.BCM8879X=50 +schan_intr_enable.BCM8879X=0 +schan_timeout_usec.BCM8879X=300000 +serdes_fabric_clk_freq_in.BCM8879X=1 +serdes_fabric_clk_freq_out.BCM8879X=bypass +soc_family.BCM8879X=BCM8879X +srd_tx_drv_hv_disable.BCM8879X=0 +system_contains_multiple_pipe_device.BCM8879X=0 +system_ref_core_clock_khz.BCM8879X=1200000 +table_dma_enable.BCM8879X=0 +tdma_intr_enable.BCM8879X=0 +tdma_timeout_usec.BCM8879X=5000000 +tslam_dma_enable.BCM8879X=0 +tslam_intr_enable.BCM8879X=0 +tslam_timeout_usec.BCM8879X=5000000 + +lane_to_serdes_map_fabric_lane0.BCM8879X=rx0:tx0 +lane_to_serdes_map_fabric_lane1.BCM8879X=rx1:tx1 +lane_to_serdes_map_fabric_lane2.BCM8879X=rx2:tx2 +lane_to_serdes_map_fabric_lane3.BCM8879X=rx3:tx3 + +lane_to_serdes_map_fabric_lane4.BCM8879X=rx4:tx4 +lane_to_serdes_map_fabric_lane5.BCM8879X=rx5:tx5 +lane_to_serdes_map_fabric_lane6.BCM8879X=rx6:tx6 +lane_to_serdes_map_fabric_lane7.BCM8879X=rx7:tx7 + +lane_to_serdes_map_fabric_lane8.BCM8879X=rx8:tx8 +lane_to_serdes_map_fabric_lane9.BCM8879X=rx9:tx9 +lane_to_serdes_map_fabric_lane10.BCM8879X=rx10:tx10 +lane_to_serdes_map_fabric_lane11.BCM8879X=rx11:tx11 + +lane_to_serdes_map_fabric_lane12.BCM8879X=rx12:tx12 +lane_to_serdes_map_fabric_lane13.BCM8879X=rx13:tx13 +lane_to_serdes_map_fabric_lane14.BCM8879X=rx14:tx14 +lane_to_serdes_map_fabric_lane15.BCM8879X=rx15:tx15 + +lane_to_serdes_map_fabric_lane16.BCM8879X=rx16:tx16 +lane_to_serdes_map_fabric_lane17.BCM8879X=rx17:tx17 +lane_to_serdes_map_fabric_lane18.BCM8879X=rx18:tx18 +lane_to_serdes_map_fabric_lane19.BCM8879X=rx19:tx19 + +lane_to_serdes_map_fabric_lane20.BCM8879X=rx20:tx20 +lane_to_serdes_map_fabric_lane21.BCM8879X=rx21:tx21 +lane_to_serdes_map_fabric_lane22.BCM8879X=rx22:tx22 +lane_to_serdes_map_fabric_lane23.BCM8879X=rx23:tx23 + +lane_to_serdes_map_fabric_lane24.BCM8879X=rx24:tx24 +lane_to_serdes_map_fabric_lane25.BCM8879X=rx25:tx25 +lane_to_serdes_map_fabric_lane26.BCM8879X=rx26:tx26 +lane_to_serdes_map_fabric_lane27.BCM8879X=rx27:tx27 + +lane_to_serdes_map_fabric_lane28.BCM8879X=rx28:tx28 +lane_to_serdes_map_fabric_lane29.BCM8879X=rx29:tx29 +lane_to_serdes_map_fabric_lane30.BCM8879X=rx30:tx30 +lane_to_serdes_map_fabric_lane31.BCM8879X=rx31:tx31 + +lane_to_serdes_map_fabric_lane32.BCM8879X=rx32:tx32 +lane_to_serdes_map_fabric_lane33.BCM8879X=rx33:tx33 +lane_to_serdes_map_fabric_lane34.BCM8879X=rx34:tx34 +lane_to_serdes_map_fabric_lane35.BCM8879X=rx35:tx35 + +lane_to_serdes_map_fabric_lane36.BCM8879X=rx36:tx36 +lane_to_serdes_map_fabric_lane37.BCM8879X=rx37:tx37 +lane_to_serdes_map_fabric_lane38.BCM8879X=rx38:tx38 +lane_to_serdes_map_fabric_lane39.BCM8879X=rx39:tx39 + +lane_to_serdes_map_fabric_lane40.BCM8879X=rx40:tx40 +lane_to_serdes_map_fabric_lane41.BCM8879X=rx41:tx41 +lane_to_serdes_map_fabric_lane42.BCM8879X=rx42:tx42 +lane_to_serdes_map_fabric_lane43.BCM8879X=rx43:tx43 + +lane_to_serdes_map_fabric_lane44.BCM8879X=rx44:tx44 +lane_to_serdes_map_fabric_lane45.BCM8879X=rx45:tx45 +lane_to_serdes_map_fabric_lane46.BCM8879X=rx46:tx46 +lane_to_serdes_map_fabric_lane47.BCM8879X=rx47:tx47 + +lane_to_serdes_map_fabric_lane48.BCM8879X=rx48:tx48 +lane_to_serdes_map_fabric_lane49.BCM8879X=rx49:tx49 +lane_to_serdes_map_fabric_lane50.BCM8879X=rx50:tx50 +lane_to_serdes_map_fabric_lane51.BCM8879X=rx51:tx51 + +lane_to_serdes_map_fabric_lane52.BCM8879X=rx52:tx52 +lane_to_serdes_map_fabric_lane53.BCM8879X=rx53:tx53 +lane_to_serdes_map_fabric_lane54.BCM8879X=rx54:tx54 +lane_to_serdes_map_fabric_lane55.BCM8879X=rx55:tx55 + +lane_to_serdes_map_fabric_lane56.BCM8879X=rx56:tx56 +lane_to_serdes_map_fabric_lane57.BCM8879X=rx57:tx57 +lane_to_serdes_map_fabric_lane58.BCM8879X=rx58:tx58 +lane_to_serdes_map_fabric_lane59.BCM8879X=rx59:tx59 + +lane_to_serdes_map_fabric_lane60.BCM8879X=rx60:tx60 +lane_to_serdes_map_fabric_lane61.BCM8879X=rx61:tx61 +lane_to_serdes_map_fabric_lane62.BCM8879X=rx62:tx62 +lane_to_serdes_map_fabric_lane63.BCM8879X=rx63:tx63 + +lane_to_serdes_map_fabric_lane64.BCM8879X=rx64:tx64 +lane_to_serdes_map_fabric_lane65.BCM8879X=rx65:tx65 +lane_to_serdes_map_fabric_lane66.BCM8879X=rx66:tx66 +lane_to_serdes_map_fabric_lane67.BCM8879X=rx67:tx67 + +lane_to_serdes_map_fabric_lane68.BCM8879X=rx68:tx68 +lane_to_serdes_map_fabric_lane69.BCM8879X=rx69:tx69 +lane_to_serdes_map_fabric_lane70.BCM8879X=rx70:tx70 +lane_to_serdes_map_fabric_lane71.BCM8879X=rx71:tx71 + +lane_to_serdes_map_fabric_lane72.BCM8879X=rx72:tx72 +lane_to_serdes_map_fabric_lane73.BCM8879X=rx73:tx73 +lane_to_serdes_map_fabric_lane74.BCM8879X=rx74:tx74 +lane_to_serdes_map_fabric_lane75.BCM8879X=rx75:tx75 + +lane_to_serdes_map_fabric_lane76.BCM8879X=rx76:tx76 +lane_to_serdes_map_fabric_lane77.BCM8879X=rx77:tx77 +lane_to_serdes_map_fabric_lane78.BCM8879X=rx78:tx78 +lane_to_serdes_map_fabric_lane79.BCM8879X=rx79:tx79 + +lane_to_serdes_map_fabric_lane80.BCM8879X=rx80:tx80 +lane_to_serdes_map_fabric_lane81.BCM8879X=rx81:tx81 +lane_to_serdes_map_fabric_lane82.BCM8879X=rx82:tx82 +lane_to_serdes_map_fabric_lane83.BCM8879X=rx83:tx83 + +lane_to_serdes_map_fabric_lane84.BCM8879X=rx84:tx84 +lane_to_serdes_map_fabric_lane85.BCM8879X=rx85:tx85 +lane_to_serdes_map_fabric_lane86.BCM8879X=rx86:tx86 +lane_to_serdes_map_fabric_lane87.BCM8879X=rx87:tx87 + +lane_to_serdes_map_fabric_lane88.BCM8879X=rx88:tx88 +lane_to_serdes_map_fabric_lane89.BCM8879X=rx89:tx89 +lane_to_serdes_map_fabric_lane90.BCM8879X=rx90:tx90 +lane_to_serdes_map_fabric_lane91.BCM8879X=rx91:tx91 + +lane_to_serdes_map_fabric_lane92.BCM8879X=rx92:tx92 +lane_to_serdes_map_fabric_lane93.BCM8879X=rx93:tx93 +lane_to_serdes_map_fabric_lane94.BCM8879X=rx94:tx94 +lane_to_serdes_map_fabric_lane95.BCM8879X=rx95:tx95 + +lane_to_serdes_map_fabric_lane96.BCM8879X=rx96:tx96 +lane_to_serdes_map_fabric_lane97.BCM8879X=rx97:tx97 +lane_to_serdes_map_fabric_lane98.BCM8879X=rx98:tx98 +lane_to_serdes_map_fabric_lane99.BCM8879X=rx99:tx99 + +lane_to_serdes_map_fabric_lane100.BCM8879X=rx100:tx100 +lane_to_serdes_map_fabric_lane101.BCM8879X=rx101:tx101 +lane_to_serdes_map_fabric_lane102.BCM8879X=rx102:tx102 +lane_to_serdes_map_fabric_lane103.BCM8879X=rx103:tx103 + +lane_to_serdes_map_fabric_lane104.BCM8879X=rx104:tx104 +lane_to_serdes_map_fabric_lane105.BCM8879X=rx105:tx105 +lane_to_serdes_map_fabric_lane106.BCM8879X=rx106:tx106 +lane_to_serdes_map_fabric_lane107.BCM8879X=rx107:tx107 + +lane_to_serdes_map_fabric_lane108.BCM8879X=rx108:tx108 +lane_to_serdes_map_fabric_lane109.BCM8879X=rx109:tx109 +lane_to_serdes_map_fabric_lane110.BCM8879X=rx110:tx110 +lane_to_serdes_map_fabric_lane111.BCM8879X=rx111:tx111 + +lane_to_serdes_map_fabric_lane112.BCM8879X=rx112:tx112 +lane_to_serdes_map_fabric_lane113.BCM8879X=rx113:tx113 +lane_to_serdes_map_fabric_lane114.BCM8879X=rx114:tx114 +lane_to_serdes_map_fabric_lane115.BCM8879X=rx115:tx115 + +lane_to_serdes_map_fabric_lane116.BCM8879X=rx116:tx116 +lane_to_serdes_map_fabric_lane117.BCM8879X=rx117:tx117 +lane_to_serdes_map_fabric_lane118.BCM8879X=rx118:tx118 +lane_to_serdes_map_fabric_lane119.BCM8879X=rx119:tx119 + +lane_to_serdes_map_fabric_lane120.BCM8879X=rx120:tx120 +lane_to_serdes_map_fabric_lane121.BCM8879X=rx121:tx121 +lane_to_serdes_map_fabric_lane122.BCM8879X=rx122:tx122 +lane_to_serdes_map_fabric_lane123.BCM8879X=rx123:tx123 + +lane_to_serdes_map_fabric_lane124.BCM8879X=rx124:tx124 +lane_to_serdes_map_fabric_lane125.BCM8879X=rx125:tx125 +lane_to_serdes_map_fabric_lane126.BCM8879X=rx126:tx126 +lane_to_serdes_map_fabric_lane127.BCM8879X=rx127:tx127 + +lane_to_serdes_map_fabric_lane128.BCM8879X=rx128:tx128 +lane_to_serdes_map_fabric_lane129.BCM8879X=rx129:tx129 +lane_to_serdes_map_fabric_lane130.BCM8879X=rx130:tx130 +lane_to_serdes_map_fabric_lane131.BCM8879X=rx131:tx131 + +lane_to_serdes_map_fabric_lane132.BCM8879X=rx132:tx132 +lane_to_serdes_map_fabric_lane133.BCM8879X=rx133:tx133 +lane_to_serdes_map_fabric_lane134.BCM8879X=rx134:tx134 +lane_to_serdes_map_fabric_lane135.BCM8879X=rx135:tx135 + +lane_to_serdes_map_fabric_lane136.BCM8879X=rx136:tx136 +lane_to_serdes_map_fabric_lane137.BCM8879X=rx137:tx137 +lane_to_serdes_map_fabric_lane138.BCM8879X=rx138:tx138 +lane_to_serdes_map_fabric_lane139.BCM8879X=rx139:tx139 + +lane_to_serdes_map_fabric_lane140.BCM8879X=rx140:tx140 +lane_to_serdes_map_fabric_lane141.BCM8879X=rx141:tx141 +lane_to_serdes_map_fabric_lane142.BCM8879X=rx142:tx142 +lane_to_serdes_map_fabric_lane143.BCM8879X=rx143:tx143 + +lane_to_serdes_map_fabric_lane144.BCM8879X=rx144:tx144 +lane_to_serdes_map_fabric_lane145.BCM8879X=rx145:tx145 +lane_to_serdes_map_fabric_lane146.BCM8879X=rx146:tx146 +lane_to_serdes_map_fabric_lane147.BCM8879X=rx147:tx147 + +lane_to_serdes_map_fabric_lane148.BCM8879X=rx148:tx148 +lane_to_serdes_map_fabric_lane149.BCM8879X=rx149:tx149 +lane_to_serdes_map_fabric_lane150.BCM8879X=rx150:tx150 +lane_to_serdes_map_fabric_lane151.BCM8879X=rx151:tx151 + +lane_to_serdes_map_fabric_lane152.BCM8879X=rx152:tx152 +lane_to_serdes_map_fabric_lane153.BCM8879X=rx153:tx153 +lane_to_serdes_map_fabric_lane154.BCM8879X=rx154:tx154 +lane_to_serdes_map_fabric_lane155.BCM8879X=rx155:tx155 + +lane_to_serdes_map_fabric_lane156.BCM8879X=rx156:tx156 +lane_to_serdes_map_fabric_lane157.BCM8879X=rx157:tx157 +lane_to_serdes_map_fabric_lane158.BCM8879X=rx158:tx158 +lane_to_serdes_map_fabric_lane159.BCM8879X=rx159:tx159 + +lane_to_serdes_map_fabric_lane160.BCM8879X=rx160:tx160 +lane_to_serdes_map_fabric_lane161.BCM8879X=rx161:tx161 +lane_to_serdes_map_fabric_lane162.BCM8879X=rx162:tx162 +lane_to_serdes_map_fabric_lane163.BCM8879X=rx163:tx163 + +lane_to_serdes_map_fabric_lane164.BCM8879X=rx164:tx164 +lane_to_serdes_map_fabric_lane165.BCM8879X=rx165:tx165 +lane_to_serdes_map_fabric_lane166.BCM8879X=rx166:tx166 +lane_to_serdes_map_fabric_lane167.BCM8879X=rx167:tx167 + +lane_to_serdes_map_fabric_lane168.BCM8879X=rx168:tx168 +lane_to_serdes_map_fabric_lane169.BCM8879X=rx169:tx169 +lane_to_serdes_map_fabric_lane170.BCM8879X=rx170:tx170 +lane_to_serdes_map_fabric_lane171.BCM8879X=rx171:tx171 + +lane_to_serdes_map_fabric_lane172.BCM8879X=rx172:tx172 +lane_to_serdes_map_fabric_lane173.BCM8879X=rx173:tx173 +lane_to_serdes_map_fabric_lane174.BCM8879X=rx174:tx174 +lane_to_serdes_map_fabric_lane175.BCM8879X=rx175:tx175 + +lane_to_serdes_map_fabric_lane176.BCM8879X=rx176:tx176 +lane_to_serdes_map_fabric_lane177.BCM8879X=rx177:tx177 +lane_to_serdes_map_fabric_lane178.BCM8879X=rx178:tx178 +lane_to_serdes_map_fabric_lane179.BCM8879X=rx179:tx179 + +lane_to_serdes_map_fabric_lane180.BCM8879X=rx180:tx180 +lane_to_serdes_map_fabric_lane181.BCM8879X=rx181:tx181 +lane_to_serdes_map_fabric_lane182.BCM8879X=rx182:tx182 +lane_to_serdes_map_fabric_lane183.BCM8879X=rx183:tx183 + +lane_to_serdes_map_fabric_lane184.BCM8879X=rx184:tx184 +lane_to_serdes_map_fabric_lane185.BCM8879X=rx185:tx185 +lane_to_serdes_map_fabric_lane186.BCM8879X=rx186:tx186 +lane_to_serdes_map_fabric_lane187.BCM8879X=rx187:tx187 + +lane_to_serdes_map_fabric_lane188.BCM8879X=rx188:tx188 +lane_to_serdes_map_fabric_lane189.BCM8879X=rx189:tx189 +lane_to_serdes_map_fabric_lane190.BCM8879X=rx190:tx190 +lane_to_serdes_map_fabric_lane191.BCM8879X=rx191:tx191 + + +phy_rx_polarity_flip_fabric0.BCM8879X=1 +phy_rx_polarity_flip_fabric1.BCM8879X=0 +phy_rx_polarity_flip_fabric2.BCM8879X=1 +phy_rx_polarity_flip_fabric3.BCM8879X=0 + +phy_rx_polarity_flip_fabric4.BCM8879X=0 +phy_rx_polarity_flip_fabric5.BCM8879X=1 +phy_rx_polarity_flip_fabric6.BCM8879X=0 +phy_rx_polarity_flip_fabric7.BCM8879X=1 + +phy_rx_polarity_flip_fabric8.BCM8879X=1 +phy_rx_polarity_flip_fabric9.BCM8879X=0 +phy_rx_polarity_flip_fabric10.BCM8879X=1 +phy_rx_polarity_flip_fabric11.BCM8879X=0 + +phy_rx_polarity_flip_fabric12.BCM8879X=0 +phy_rx_polarity_flip_fabric13.BCM8879X=1 +phy_rx_polarity_flip_fabric14.BCM8879X=0 +phy_rx_polarity_flip_fabric15.BCM8879X=1 + +phy_rx_polarity_flip_fabric16.BCM8879X=1 +phy_rx_polarity_flip_fabric17.BCM8879X=0 +phy_rx_polarity_flip_fabric18.BCM8879X=1 +phy_rx_polarity_flip_fabric19.BCM8879X=0 + +phy_rx_polarity_flip_fabric20.BCM8879X=1 +phy_rx_polarity_flip_fabric21.BCM8879X=0 +phy_rx_polarity_flip_fabric22.BCM8879X=1 +phy_rx_polarity_flip_fabric23.BCM8879X=0 + +phy_rx_polarity_flip_fabric24.BCM8879X=1 +phy_rx_polarity_flip_fabric25.BCM8879X=0 +phy_rx_polarity_flip_fabric26.BCM8879X=1 +phy_rx_polarity_flip_fabric27.BCM8879X=0 + +phy_rx_polarity_flip_fabric28.BCM8879X=0 +phy_rx_polarity_flip_fabric29.BCM8879X=1 +phy_rx_polarity_flip_fabric30.BCM8879X=0 +phy_rx_polarity_flip_fabric31.BCM8879X=1 + +phy_rx_polarity_flip_fabric32.BCM8879X=1 +phy_rx_polarity_flip_fabric33.BCM8879X=0 +phy_rx_polarity_flip_fabric34.BCM8879X=1 +phy_rx_polarity_flip_fabric35.BCM8879X=0 + +phy_rx_polarity_flip_fabric36.BCM8879X=0 +phy_rx_polarity_flip_fabric37.BCM8879X=1 +phy_rx_polarity_flip_fabric38.BCM8879X=0 +phy_rx_polarity_flip_fabric39.BCM8879X=1 + +phy_rx_polarity_flip_fabric40.BCM8879X=1 +phy_rx_polarity_flip_fabric41.BCM8879X=0 +phy_rx_polarity_flip_fabric42.BCM8879X=1 +phy_rx_polarity_flip_fabric43.BCM8879X=0 + +phy_rx_polarity_flip_fabric44.BCM8879X=1 +phy_rx_polarity_flip_fabric45.BCM8879X=0 +phy_rx_polarity_flip_fabric46.BCM8879X=1 +phy_rx_polarity_flip_fabric47.BCM8879X=0 + +phy_rx_polarity_flip_fabric48.BCM8879X=0 +phy_rx_polarity_flip_fabric49.BCM8879X=1 +phy_rx_polarity_flip_fabric50.BCM8879X=0 +phy_rx_polarity_flip_fabric51.BCM8879X=1 + +phy_rx_polarity_flip_fabric52.BCM8879X=1 +phy_rx_polarity_flip_fabric53.BCM8879X=0 +phy_rx_polarity_flip_fabric54.BCM8879X=1 +phy_rx_polarity_flip_fabric55.BCM8879X=0 + +phy_rx_polarity_flip_fabric56.BCM8879X=0 +phy_rx_polarity_flip_fabric57.BCM8879X=1 +phy_rx_polarity_flip_fabric58.BCM8879X=0 +phy_rx_polarity_flip_fabric59.BCM8879X=1 + +phy_rx_polarity_flip_fabric60.BCM8879X=0 +phy_rx_polarity_flip_fabric61.BCM8879X=1 +phy_rx_polarity_flip_fabric62.BCM8879X=0 +phy_rx_polarity_flip_fabric63.BCM8879X=1 + +phy_rx_polarity_flip_fabric64.BCM8879X=1 +phy_rx_polarity_flip_fabric65.BCM8879X=0 +phy_rx_polarity_flip_fabric66.BCM8879X=1 +phy_rx_polarity_flip_fabric67.BCM8879X=0 + +phy_rx_polarity_flip_fabric68.BCM8879X=0 +phy_rx_polarity_flip_fabric69.BCM8879X=1 +phy_rx_polarity_flip_fabric70.BCM8879X=0 +phy_rx_polarity_flip_fabric71.BCM8879X=1 + +phy_rx_polarity_flip_fabric72.BCM8879X=1 +phy_rx_polarity_flip_fabric73.BCM8879X=0 +phy_rx_polarity_flip_fabric74.BCM8879X=1 +phy_rx_polarity_flip_fabric75.BCM8879X=0 + +phy_rx_polarity_flip_fabric76.BCM8879X=1 +phy_rx_polarity_flip_fabric77.BCM8879X=0 +phy_rx_polarity_flip_fabric78.BCM8879X=1 +phy_rx_polarity_flip_fabric79.BCM8879X=0 + +phy_rx_polarity_flip_fabric80.BCM8879X=0 +phy_rx_polarity_flip_fabric81.BCM8879X=1 +phy_rx_polarity_flip_fabric82.BCM8879X=0 +phy_rx_polarity_flip_fabric83.BCM8879X=1 + +phy_rx_polarity_flip_fabric84.BCM8879X=1 +phy_rx_polarity_flip_fabric85.BCM8879X=0 +phy_rx_polarity_flip_fabric86.BCM8879X=1 +phy_rx_polarity_flip_fabric87.BCM8879X=0 + +phy_rx_polarity_flip_fabric88.BCM8879X=0 +phy_rx_polarity_flip_fabric89.BCM8879X=1 +phy_rx_polarity_flip_fabric90.BCM8879X=0 +phy_rx_polarity_flip_fabric91.BCM8879X=1 + +phy_rx_polarity_flip_fabric92.BCM8879X=1 +phy_rx_polarity_flip_fabric93.BCM8879X=0 +phy_rx_polarity_flip_fabric94.BCM8879X=1 +phy_rx_polarity_flip_fabric95.BCM8879X=0 + +phy_rx_polarity_flip_fabric96.BCM8879X=1 +phy_rx_polarity_flip_fabric97.BCM8879X=0 +phy_rx_polarity_flip_fabric98.BCM8879X=1 +phy_rx_polarity_flip_fabric99.BCM8879X=0 + +phy_rx_polarity_flip_fabric100.BCM8879X=0 +phy_rx_polarity_flip_fabric101.BCM8879X=1 +phy_rx_polarity_flip_fabric102.BCM8879X=0 +phy_rx_polarity_flip_fabric103.BCM8879X=1 + +phy_rx_polarity_flip_fabric104.BCM8879X=0 +phy_rx_polarity_flip_fabric105.BCM8879X=1 +phy_rx_polarity_flip_fabric106.BCM8879X=0 +phy_rx_polarity_flip_fabric107.BCM8879X=1 + +phy_rx_polarity_flip_fabric108.BCM8879X=0 +phy_rx_polarity_flip_fabric109.BCM8879X=1 +phy_rx_polarity_flip_fabric110.BCM8879X=0 +phy_rx_polarity_flip_fabric111.BCM8879X=1 + +phy_rx_polarity_flip_fabric112.BCM8879X=0 +phy_rx_polarity_flip_fabric113.BCM8879X=1 +phy_rx_polarity_flip_fabric114.BCM8879X=0 +phy_rx_polarity_flip_fabric115.BCM8879X=1 + +phy_rx_polarity_flip_fabric116.BCM8879X=1 +phy_rx_polarity_flip_fabric117.BCM8879X=0 +phy_rx_polarity_flip_fabric118.BCM8879X=1 +phy_rx_polarity_flip_fabric119.BCM8879X=0 + +phy_rx_polarity_flip_fabric120.BCM8879X=1 +phy_rx_polarity_flip_fabric121.BCM8879X=0 +phy_rx_polarity_flip_fabric122.BCM8879X=1 +phy_rx_polarity_flip_fabric123.BCM8879X=0 + +phy_rx_polarity_flip_fabric124.BCM8879X=0 +phy_rx_polarity_flip_fabric125.BCM8879X=1 +phy_rx_polarity_flip_fabric126.BCM8879X=0 +phy_rx_polarity_flip_fabric127.BCM8879X=1 + +phy_rx_polarity_flip_fabric128.BCM8879X=1 +phy_rx_polarity_flip_fabric129.BCM8879X=0 +phy_rx_polarity_flip_fabric130.BCM8879X=1 +phy_rx_polarity_flip_fabric131.BCM8879X=0 + +phy_rx_polarity_flip_fabric132.BCM8879X=0 +phy_rx_polarity_flip_fabric133.BCM8879X=1 +phy_rx_polarity_flip_fabric134.BCM8879X=0 +phy_rx_polarity_flip_fabric135.BCM8879X=1 + +phy_rx_polarity_flip_fabric136.BCM8879X=1 +phy_rx_polarity_flip_fabric137.BCM8879X=0 +phy_rx_polarity_flip_fabric138.BCM8879X=1 +phy_rx_polarity_flip_fabric139.BCM8879X=0 + +phy_rx_polarity_flip_fabric140.BCM8879X=1 +phy_rx_polarity_flip_fabric141.BCM8879X=0 +phy_rx_polarity_flip_fabric142.BCM8879X=1 +phy_rx_polarity_flip_fabric143.BCM8879X=0 + +phy_rx_polarity_flip_fabric144.BCM8879X=1 +phy_rx_polarity_flip_fabric145.BCM8879X=0 +phy_rx_polarity_flip_fabric146.BCM8879X=1 +phy_rx_polarity_flip_fabric147.BCM8879X=0 + +phy_rx_polarity_flip_fabric148.BCM8879X=1 +phy_rx_polarity_flip_fabric149.BCM8879X=0 +phy_rx_polarity_flip_fabric150.BCM8879X=1 +phy_rx_polarity_flip_fabric151.BCM8879X=0 + +phy_rx_polarity_flip_fabric152.BCM8879X=0 +phy_rx_polarity_flip_fabric153.BCM8879X=1 +phy_rx_polarity_flip_fabric154.BCM8879X=0 +phy_rx_polarity_flip_fabric155.BCM8879X=1 + +phy_rx_polarity_flip_fabric156.BCM8879X=1 +phy_rx_polarity_flip_fabric157.BCM8879X=0 +phy_rx_polarity_flip_fabric158.BCM8879X=1 +phy_rx_polarity_flip_fabric159.BCM8879X=0 + +phy_rx_polarity_flip_fabric160.BCM8879X=1 +phy_rx_polarity_flip_fabric161.BCM8879X=0 +phy_rx_polarity_flip_fabric162.BCM8879X=1 +phy_rx_polarity_flip_fabric163.BCM8879X=0 + +phy_rx_polarity_flip_fabric164.BCM8879X=0 +phy_rx_polarity_flip_fabric165.BCM8879X=1 +phy_rx_polarity_flip_fabric166.BCM8879X=0 +phy_rx_polarity_flip_fabric167.BCM8879X=1 + +phy_rx_polarity_flip_fabric168.BCM8879X=1 +phy_rx_polarity_flip_fabric169.BCM8879X=0 +phy_rx_polarity_flip_fabric170.BCM8879X=1 +phy_rx_polarity_flip_fabric171.BCM8879X=0 + +phy_rx_polarity_flip_fabric172.BCM8879X=1 +phy_rx_polarity_flip_fabric173.BCM8879X=0 +phy_rx_polarity_flip_fabric174.BCM8879X=1 +phy_rx_polarity_flip_fabric175.BCM8879X=0 + +phy_rx_polarity_flip_fabric176.BCM8879X=0 +phy_rx_polarity_flip_fabric177.BCM8879X=1 +phy_rx_polarity_flip_fabric178.BCM8879X=0 +phy_rx_polarity_flip_fabric179.BCM8879X=1 + +phy_rx_polarity_flip_fabric180.BCM8879X=1 +phy_rx_polarity_flip_fabric181.BCM8879X=0 +phy_rx_polarity_flip_fabric182.BCM8879X=1 +phy_rx_polarity_flip_fabric183.BCM8879X=0 + +phy_rx_polarity_flip_fabric184.BCM8879X=0 +phy_rx_polarity_flip_fabric185.BCM8879X=1 +phy_rx_polarity_flip_fabric186.BCM8879X=0 +phy_rx_polarity_flip_fabric187.BCM8879X=1 + +phy_rx_polarity_flip_fabric188.BCM8879X=1 +phy_rx_polarity_flip_fabric189.BCM8879X=0 +phy_rx_polarity_flip_fabric190.BCM8879X=1 +phy_rx_polarity_flip_fabric191.BCM8879X=0 + +phy_tx_polarity_flip_fabric0.BCM8879X=0 +phy_tx_polarity_flip_fabric1.BCM8879X=1 +phy_tx_polarity_flip_fabric2.BCM8879X=0 +phy_tx_polarity_flip_fabric3.BCM8879X=1 + +phy_tx_polarity_flip_fabric4.BCM8879X=1 +phy_tx_polarity_flip_fabric5.BCM8879X=0 +phy_tx_polarity_flip_fabric6.BCM8879X=1 +phy_tx_polarity_flip_fabric7.BCM8879X=0 + +phy_tx_polarity_flip_fabric8.BCM8879X=0 +phy_tx_polarity_flip_fabric9.BCM8879X=1 +phy_tx_polarity_flip_fabric10.BCM8879X=0 +phy_tx_polarity_flip_fabric11.BCM8879X=1 + +phy_tx_polarity_flip_fabric12.BCM8879X=1 +phy_tx_polarity_flip_fabric13.BCM8879X=0 +phy_tx_polarity_flip_fabric14.BCM8879X=1 +phy_tx_polarity_flip_fabric15.BCM8879X=0 + +phy_tx_polarity_flip_fabric16.BCM8879X=0 +phy_tx_polarity_flip_fabric17.BCM8879X=1 +phy_tx_polarity_flip_fabric18.BCM8879X=0 +phy_tx_polarity_flip_fabric19.BCM8879X=1 + +phy_tx_polarity_flip_fabric20.BCM8879X=0 +phy_tx_polarity_flip_fabric21.BCM8879X=1 +phy_tx_polarity_flip_fabric22.BCM8879X=0 +phy_tx_polarity_flip_fabric23.BCM8879X=1 + +phy_tx_polarity_flip_fabric24.BCM8879X=0 +phy_tx_polarity_flip_fabric25.BCM8879X=1 +phy_tx_polarity_flip_fabric26.BCM8879X=0 +phy_tx_polarity_flip_fabric27.BCM8879X=1 + +phy_tx_polarity_flip_fabric28.BCM8879X=1 +phy_tx_polarity_flip_fabric29.BCM8879X=0 +phy_tx_polarity_flip_fabric30.BCM8879X=1 +phy_tx_polarity_flip_fabric31.BCM8879X=0 + +phy_tx_polarity_flip_fabric32.BCM8879X=0 +phy_tx_polarity_flip_fabric33.BCM8879X=1 +phy_tx_polarity_flip_fabric34.BCM8879X=0 +phy_tx_polarity_flip_fabric35.BCM8879X=1 + +phy_tx_polarity_flip_fabric36.BCM8879X=1 +phy_tx_polarity_flip_fabric37.BCM8879X=0 +phy_tx_polarity_flip_fabric38.BCM8879X=1 +phy_tx_polarity_flip_fabric39.BCM8879X=0 + +phy_tx_polarity_flip_fabric40.BCM8879X=0 +phy_tx_polarity_flip_fabric41.BCM8879X=1 +phy_tx_polarity_flip_fabric42.BCM8879X=0 +phy_tx_polarity_flip_fabric43.BCM8879X=1 + +phy_tx_polarity_flip_fabric44.BCM8879X=0 +phy_tx_polarity_flip_fabric45.BCM8879X=1 +phy_tx_polarity_flip_fabric46.BCM8879X=0 +phy_tx_polarity_flip_fabric47.BCM8879X=1 + +phy_tx_polarity_flip_fabric48.BCM8879X=1 +phy_tx_polarity_flip_fabric49.BCM8879X=0 +phy_tx_polarity_flip_fabric50.BCM8879X=1 +phy_tx_polarity_flip_fabric51.BCM8879X=0 + +phy_tx_polarity_flip_fabric52.BCM8879X=0 +phy_tx_polarity_flip_fabric53.BCM8879X=1 +phy_tx_polarity_flip_fabric54.BCM8879X=0 +phy_tx_polarity_flip_fabric55.BCM8879X=1 + +phy_tx_polarity_flip_fabric56.BCM8879X=1 +phy_tx_polarity_flip_fabric57.BCM8879X=0 +phy_tx_polarity_flip_fabric58.BCM8879X=1 +phy_tx_polarity_flip_fabric59.BCM8879X=0 + +phy_tx_polarity_flip_fabric60.BCM8879X=1 +phy_tx_polarity_flip_fabric61.BCM8879X=0 +phy_tx_polarity_flip_fabric62.BCM8879X=1 +phy_tx_polarity_flip_fabric63.BCM8879X=0 + +phy_tx_polarity_flip_fabric64.BCM8879X=0 +phy_tx_polarity_flip_fabric65.BCM8879X=1 +phy_tx_polarity_flip_fabric66.BCM8879X=0 +phy_tx_polarity_flip_fabric67.BCM8879X=1 + +phy_tx_polarity_flip_fabric68.BCM8879X=1 +phy_tx_polarity_flip_fabric69.BCM8879X=0 +phy_tx_polarity_flip_fabric70.BCM8879X=1 +phy_tx_polarity_flip_fabric71.BCM8879X=0 + +phy_tx_polarity_flip_fabric72.BCM8879X=0 +phy_tx_polarity_flip_fabric73.BCM8879X=1 +phy_tx_polarity_flip_fabric74.BCM8879X=0 +phy_tx_polarity_flip_fabric75.BCM8879X=1 + +phy_tx_polarity_flip_fabric76.BCM8879X=0 +phy_tx_polarity_flip_fabric77.BCM8879X=1 +phy_tx_polarity_flip_fabric78.BCM8879X=0 +phy_tx_polarity_flip_fabric79.BCM8879X=1 + +phy_tx_polarity_flip_fabric80.BCM8879X=1 +phy_tx_polarity_flip_fabric81.BCM8879X=0 +phy_tx_polarity_flip_fabric82.BCM8879X=1 +phy_tx_polarity_flip_fabric83.BCM8879X=0 + +phy_tx_polarity_flip_fabric84.BCM8879X=0 +phy_tx_polarity_flip_fabric85.BCM8879X=1 +phy_tx_polarity_flip_fabric86.BCM8879X=0 +phy_tx_polarity_flip_fabric87.BCM8879X=1 + +phy_tx_polarity_flip_fabric88.BCM8879X=1 +phy_tx_polarity_flip_fabric89.BCM8879X=0 +phy_tx_polarity_flip_fabric90.BCM8879X=1 +phy_tx_polarity_flip_fabric91.BCM8879X=0 + +phy_tx_polarity_flip_fabric92.BCM8879X=0 +phy_tx_polarity_flip_fabric93.BCM8879X=1 +phy_tx_polarity_flip_fabric94.BCM8879X=0 +phy_tx_polarity_flip_fabric95.BCM8879X=1 + +phy_tx_polarity_flip_fabric96.BCM8879X=0 +phy_tx_polarity_flip_fabric97.BCM8879X=1 +phy_tx_polarity_flip_fabric98.BCM8879X=0 +phy_tx_polarity_flip_fabric99.BCM8879X=1 + +phy_tx_polarity_flip_fabric100.BCM8879X=1 +phy_tx_polarity_flip_fabric101.BCM8879X=0 +phy_tx_polarity_flip_fabric102.BCM8879X=1 +phy_tx_polarity_flip_fabric103.BCM8879X=0 + +phy_tx_polarity_flip_fabric104.BCM8879X=1 +phy_tx_polarity_flip_fabric105.BCM8879X=0 +phy_tx_polarity_flip_fabric106.BCM8879X=1 +phy_tx_polarity_flip_fabric107.BCM8879X=0 + +phy_tx_polarity_flip_fabric108.BCM8879X=1 +phy_tx_polarity_flip_fabric109.BCM8879X=0 +phy_tx_polarity_flip_fabric110.BCM8879X=1 +phy_tx_polarity_flip_fabric111.BCM8879X=0 + +phy_tx_polarity_flip_fabric112.BCM8879X=1 +phy_tx_polarity_flip_fabric113.BCM8879X=0 +phy_tx_polarity_flip_fabric114.BCM8879X=1 +phy_tx_polarity_flip_fabric115.BCM8879X=0 + +phy_tx_polarity_flip_fabric116.BCM8879X=0 +phy_tx_polarity_flip_fabric117.BCM8879X=1 +phy_tx_polarity_flip_fabric118.BCM8879X=0 +phy_tx_polarity_flip_fabric119.BCM8879X=1 + +phy_tx_polarity_flip_fabric120.BCM8879X=0 +phy_tx_polarity_flip_fabric121.BCM8879X=1 +phy_tx_polarity_flip_fabric122.BCM8879X=0 +phy_tx_polarity_flip_fabric123.BCM8879X=1 + +phy_tx_polarity_flip_fabric124.BCM8879X=1 +phy_tx_polarity_flip_fabric125.BCM8879X=0 +phy_tx_polarity_flip_fabric126.BCM8879X=1 +phy_tx_polarity_flip_fabric127.BCM8879X=0 + +phy_tx_polarity_flip_fabric128.BCM8879X=0 +phy_tx_polarity_flip_fabric129.BCM8879X=1 +phy_tx_polarity_flip_fabric130.BCM8879X=0 +phy_tx_polarity_flip_fabric131.BCM8879X=1 + +phy_tx_polarity_flip_fabric132.BCM8879X=1 +phy_tx_polarity_flip_fabric133.BCM8879X=0 +phy_tx_polarity_flip_fabric134.BCM8879X=1 +phy_tx_polarity_flip_fabric135.BCM8879X=0 + +phy_tx_polarity_flip_fabric136.BCM8879X=0 +phy_tx_polarity_flip_fabric137.BCM8879X=1 +phy_tx_polarity_flip_fabric138.BCM8879X=0 +phy_tx_polarity_flip_fabric139.BCM8879X=1 + +phy_tx_polarity_flip_fabric140.BCM8879X=0 +phy_tx_polarity_flip_fabric141.BCM8879X=1 +phy_tx_polarity_flip_fabric142.BCM8879X=0 +phy_tx_polarity_flip_fabric143.BCM8879X=1 + +phy_tx_polarity_flip_fabric144.BCM8879X=0 +phy_tx_polarity_flip_fabric145.BCM8879X=1 +phy_tx_polarity_flip_fabric146.BCM8879X=0 +phy_tx_polarity_flip_fabric147.BCM8879X=1 + +phy_tx_polarity_flip_fabric148.BCM8879X=0 +phy_tx_polarity_flip_fabric149.BCM8879X=1 +phy_tx_polarity_flip_fabric150.BCM8879X=0 +phy_tx_polarity_flip_fabric151.BCM8879X=1 + +phy_tx_polarity_flip_fabric152.BCM8879X=1 +phy_tx_polarity_flip_fabric153.BCM8879X=0 +phy_tx_polarity_flip_fabric154.BCM8879X=1 +phy_tx_polarity_flip_fabric155.BCM8879X=0 + +phy_tx_polarity_flip_fabric156.BCM8879X=0 +phy_tx_polarity_flip_fabric157.BCM8879X=1 +phy_tx_polarity_flip_fabric158.BCM8879X=0 +phy_tx_polarity_flip_fabric159.BCM8879X=1 + +phy_tx_polarity_flip_fabric160.BCM8879X=0 +phy_tx_polarity_flip_fabric161.BCM8879X=1 +phy_tx_polarity_flip_fabric162.BCM8879X=0 +phy_tx_polarity_flip_fabric163.BCM8879X=1 + +phy_tx_polarity_flip_fabric164.BCM8879X=1 +phy_tx_polarity_flip_fabric165.BCM8879X=0 +phy_tx_polarity_flip_fabric166.BCM8879X=1 +phy_tx_polarity_flip_fabric167.BCM8879X=0 + +phy_tx_polarity_flip_fabric168.BCM8879X=0 +phy_tx_polarity_flip_fabric169.BCM8879X=1 +phy_tx_polarity_flip_fabric170.BCM8879X=0 +phy_tx_polarity_flip_fabric171.BCM8879X=1 + +phy_tx_polarity_flip_fabric172.BCM8879X=0 +phy_tx_polarity_flip_fabric173.BCM8879X=1 +phy_tx_polarity_flip_fabric174.BCM8879X=0 +phy_tx_polarity_flip_fabric175.BCM8879X=1 + +phy_tx_polarity_flip_fabric176.BCM8879X=1 +phy_tx_polarity_flip_fabric177.BCM8879X=0 +phy_tx_polarity_flip_fabric178.BCM8879X=1 +phy_tx_polarity_flip_fabric179.BCM8879X=0 + +phy_tx_polarity_flip_fabric180.BCM8879X=0 +phy_tx_polarity_flip_fabric181.BCM8879X=1 +phy_tx_polarity_flip_fabric182.BCM8879X=0 +phy_tx_polarity_flip_fabric183.BCM8879X=1 + +phy_tx_polarity_flip_fabric184.BCM8879X=1 +phy_tx_polarity_flip_fabric185.BCM8879X=0 +phy_tx_polarity_flip_fabric186.BCM8879X=1 +phy_tx_polarity_flip_fabric187.BCM8879X=0 + +phy_tx_polarity_flip_fabric188.BCM8879X=0 +phy_tx_polarity_flip_fabric189.BCM8879X=1 +phy_tx_polarity_flip_fabric190.BCM8879X=0 +phy_tx_polarity_flip_fabric191.BCM8879X=1 + +port_init_cl72_0=0 +port_init_cl72_1=0 +port_init_cl72_2=0 +port_init_cl72_3=0 +port_init_cl72_4=0 +port_init_cl72_5=0 +port_init_cl72_6=0 +port_init_cl72_7=0 +port_init_cl72_8=0 +port_init_cl72_9=0 +port_init_cl72_10=0 +port_init_cl72_11=0 +port_init_cl72_12=0 +port_init_cl72_13=0 +port_init_cl72_14=0 +port_init_cl72_15=0 +port_init_cl72_16=0 +port_init_cl72_17=0 +port_init_cl72_18=0 +port_init_cl72_19=0 +port_init_cl72_20=0 +port_init_cl72_21=0 +port_init_cl72_22=0 +port_init_cl72_23=0 +port_init_cl72_24=0 +port_init_cl72_25=0 +port_init_cl72_26=0 +port_init_cl72_27=0 +port_init_cl72_28=0 +port_init_cl72_29=0 +port_init_cl72_30=0 +port_init_cl72_31=0 +port_init_cl72_32=0 +port_init_cl72_33=0 +port_init_cl72_34=0 +port_init_cl72_35=0 +port_init_cl72_36=0 +port_init_cl72_37=0 +port_init_cl72_38=0 +port_init_cl72_39=0 +port_init_cl72_40=0 +port_init_cl72_41=0 +port_init_cl72_42=0 +port_init_cl72_43=0 +port_init_cl72_44=0 +port_init_cl72_45=0 +port_init_cl72_46=0 +port_init_cl72_47=0 +port_init_cl72_48=0 +port_init_cl72_49=0 +port_init_cl72_50=0 +port_init_cl72_51=0 +port_init_cl72_52=0 +port_init_cl72_53=0 +port_init_cl72_54=0 +port_init_cl72_55=0 +port_init_cl72_56=0 +port_init_cl72_57=0 +port_init_cl72_58=0 +port_init_cl72_59=0 +port_init_cl72_60=0 +port_init_cl72_61=0 +port_init_cl72_62=0 +port_init_cl72_63=0 +port_init_cl72_64=0 +port_init_cl72_65=0 +port_init_cl72_66=0 +port_init_cl72_67=0 +port_init_cl72_68=0 +port_init_cl72_69=0 +port_init_cl72_70=0 +port_init_cl72_71=0 +port_init_cl72_72=0 +port_init_cl72_73=0 +port_init_cl72_74=0 +port_init_cl72_75=0 +port_init_cl72_76=0 +port_init_cl72_77=0 +port_init_cl72_78=0 +port_init_cl72_79=0 +port_init_cl72_80=0 +port_init_cl72_81=0 +port_init_cl72_82=0 +port_init_cl72_83=0 +port_init_cl72_84=0 +port_init_cl72_85=0 +port_init_cl72_86=0 +port_init_cl72_87=0 +port_init_cl72_88=0 +port_init_cl72_89=0 +port_init_cl72_90=0 +port_init_cl72_91=0 +port_init_cl72_92=0 +port_init_cl72_93=0 +port_init_cl72_94=0 +port_init_cl72_95=0 +port_init_cl72_96=0 +port_init_cl72_97=0 +port_init_cl72_98=0 +port_init_cl72_99=0 +port_init_cl72_100=0 +port_init_cl72_101=0 +port_init_cl72_102=0 +port_init_cl72_103=0 +port_init_cl72_104=0 +port_init_cl72_105=0 +port_init_cl72_106=0 +port_init_cl72_107=0 +port_init_cl72_108=0 +port_init_cl72_109=0 +port_init_cl72_110=0 +port_init_cl72_111=0 +port_init_cl72_112=0 +port_init_cl72_113=0 +port_init_cl72_114=0 +port_init_cl72_115=0 +port_init_cl72_116=0 +port_init_cl72_117=0 +port_init_cl72_118=0 +port_init_cl72_119=0 +port_init_cl72_120=0 +port_init_cl72_121=0 +port_init_cl72_122=0 +port_init_cl72_123=0 +port_init_cl72_124=0 +port_init_cl72_125=0 +port_init_cl72_126=0 +port_init_cl72_127=0 +port_init_cl72_128=0 +port_init_cl72_129=0 +port_init_cl72_130=0 +port_init_cl72_131=0 +port_init_cl72_132=0 +port_init_cl72_133=0 +port_init_cl72_134=0 +port_init_cl72_135=0 +port_init_cl72_136=0 +port_init_cl72_137=0 +port_init_cl72_138=0 +port_init_cl72_139=0 +port_init_cl72_140=0 +port_init_cl72_141=0 +port_init_cl72_142=0 +port_init_cl72_143=0 +port_init_cl72_144=0 +port_init_cl72_145=0 +port_init_cl72_146=0 +port_init_cl72_147=0 +port_init_cl72_148=0 +port_init_cl72_149=0 +port_init_cl72_150=0 +port_init_cl72_151=0 +port_init_cl72_152=0 +port_init_cl72_153=0 +port_init_cl72_154=0 +port_init_cl72_155=0 +port_init_cl72_156=0 +port_init_cl72_157=0 +port_init_cl72_158=0 +port_init_cl72_159=0 +port_init_cl72_160=0 +port_init_cl72_161=0 +port_init_cl72_162=0 +port_init_cl72_163=0 +port_init_cl72_164=0 +port_init_cl72_165=0 +port_init_cl72_166=0 +port_init_cl72_167=0 +port_init_cl72_168=0 +port_init_cl72_169=0 +port_init_cl72_170=0 +port_init_cl72_171=0 +port_init_cl72_172=0 +port_init_cl72_173=0 +port_init_cl72_174=0 +port_init_cl72_175=0 +port_init_cl72_176=0 +port_init_cl72_177=0 +port_init_cl72_178=0 +port_init_cl72_179=0 +port_init_cl72_180=0 +port_init_cl72_181=0 +port_init_cl72_182=0 +port_init_cl72_183=0 +port_init_cl72_184=0 +port_init_cl72_185=0 +port_init_cl72_186=0 +port_init_cl72_187=0 +port_init_cl72_188=0 +port_init_cl72_189=0 +port_init_cl72_190=0 +port_init_cl72_191=0 + +serdes_tx_taps_0.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_1.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_2.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_3.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_4.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_5.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_6.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_7.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_8.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_9.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_10.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_11.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_12.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_13.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_14.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_15.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_16.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_17.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_18.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_19.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_20.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_21.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_22.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_23.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_24.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_25.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_26.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_27.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_28.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_29.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_30.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_31.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_32.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_33.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_34.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_35.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_36.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_37.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_38.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_39.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_40.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_41.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_42.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_43.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_44.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_45.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_46.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_47.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_48.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_49.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_50.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_51.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_52.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_53.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_54.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_55.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_56.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_57.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_58.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_59.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_60.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_61.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_62.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_63.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_64.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_65.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_66.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_67.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_68.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_69.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_70.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_71.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_72.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_73.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_74.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_75.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_76.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_77.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_78.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_79.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_80.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_81.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_82.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_83.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_84.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_85.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_86.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_87.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_88.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_89.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_90.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_91.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_92.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_93.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_94.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_95.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_96.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_97.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_98.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_99.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_100.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_101.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_102.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_103.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_104.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_105.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_106.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_107.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_108.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_109.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_110.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_111.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_112.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_113.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_114.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_115.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_116.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_117.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_118.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_119.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_120.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_121.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_122.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_123.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_124.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_125.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_126.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_127.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_128.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_129.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_130.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_131.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_132.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_133.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_134.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_135.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_136.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_137.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_138.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_139.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_140.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_141.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_142.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_143.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_144.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_145.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_146.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_147.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_148.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_149.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_150.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_151.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_152.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_153.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_154.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_155.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_156.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_157.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_158.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_159.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_160.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_161.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_162.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_163.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_164.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_165.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_166.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_167.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_168.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_169.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_170.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_171.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_172.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_173.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_174.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_175.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_176.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_177.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_178.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_179.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_180.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_181.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_182.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_183.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_184.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_185.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_186.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_187.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_188.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_189.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_190.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_191.BCM8879X=pam4:-24:132:-12:0:0:0 + +serdes_lane_config_channel_mode_0.0=force_nr +serdes_lane_config_channel_mode_1.0=force_nr +serdes_lane_config_channel_mode_2.0=force_nr +serdes_lane_config_channel_mode_3.0=force_nr +serdes_lane_config_channel_mode_4.0=force_nr +serdes_lane_config_channel_mode_5.0=force_nr +serdes_lane_config_channel_mode_6.0=force_nr +serdes_lane_config_channel_mode_7.0=force_nr +serdes_lane_config_channel_mode_8.0=force_nr +serdes_lane_config_channel_mode_9.0=force_nr +serdes_lane_config_channel_mode_10.0=force_nr +serdes_lane_config_channel_mode_11.0=force_nr +serdes_lane_config_channel_mode_12.0=force_nr +serdes_lane_config_channel_mode_13.0=force_nr +serdes_lane_config_channel_mode_14.0=force_nr +serdes_lane_config_channel_mode_15.0=force_nr +serdes_lane_config_channel_mode_16.0=force_nr +serdes_lane_config_channel_mode_17.0=force_nr +serdes_lane_config_channel_mode_18.0=force_nr +serdes_lane_config_channel_mode_19.0=force_nr +serdes_lane_config_channel_mode_20.0=force_nr +serdes_lane_config_channel_mode_21.0=force_nr +serdes_lane_config_channel_mode_22.0=force_nr +serdes_lane_config_channel_mode_23.0=force_nr +serdes_lane_config_channel_mode_24.0=force_nr +serdes_lane_config_channel_mode_25.0=force_nr +serdes_lane_config_channel_mode_26.0=force_nr +serdes_lane_config_channel_mode_27.0=force_nr +serdes_lane_config_channel_mode_28.0=force_nr +serdes_lane_config_channel_mode_29.0=force_nr +serdes_lane_config_channel_mode_30.0=force_nr +serdes_lane_config_channel_mode_31.0=force_nr +serdes_lane_config_channel_mode_32.0=force_nr +serdes_lane_config_channel_mode_33.0=force_nr +serdes_lane_config_channel_mode_34.0=force_nr +serdes_lane_config_channel_mode_35.0=force_nr +serdes_lane_config_channel_mode_36.0=force_nr +serdes_lane_config_channel_mode_37.0=force_nr +serdes_lane_config_channel_mode_38.0=force_nr +serdes_lane_config_channel_mode_39.0=force_nr +serdes_lane_config_channel_mode_40.0=force_nr +serdes_lane_config_channel_mode_41.0=force_nr +serdes_lane_config_channel_mode_42.0=force_nr +serdes_lane_config_channel_mode_43.0=force_nr +serdes_lane_config_channel_mode_44.0=force_nr +serdes_lane_config_channel_mode_45.0=force_nr +serdes_lane_config_channel_mode_46.0=force_nr +serdes_lane_config_channel_mode_47.0=force_nr +serdes_lane_config_channel_mode_48.0=force_nr +serdes_lane_config_channel_mode_49.0=force_nr +serdes_lane_config_channel_mode_50.0=force_nr +serdes_lane_config_channel_mode_51.0=force_nr +serdes_lane_config_channel_mode_52.0=force_nr +serdes_lane_config_channel_mode_53.0=force_nr +serdes_lane_config_channel_mode_54.0=force_nr +serdes_lane_config_channel_mode_55.0=force_nr +serdes_lane_config_channel_mode_56.0=force_nr +serdes_lane_config_channel_mode_57.0=force_nr +serdes_lane_config_channel_mode_58.0=force_nr +serdes_lane_config_channel_mode_59.0=force_nr +serdes_lane_config_channel_mode_60.0=force_nr +serdes_lane_config_channel_mode_61.0=force_nr +serdes_lane_config_channel_mode_62.0=force_nr +serdes_lane_config_channel_mode_63.0=force_nr +serdes_lane_config_channel_mode_64.0=force_nr +serdes_lane_config_channel_mode_65.0=force_nr +serdes_lane_config_channel_mode_66.0=force_nr +serdes_lane_config_channel_mode_67.0=force_nr +serdes_lane_config_channel_mode_68.0=force_nr +serdes_lane_config_channel_mode_69.0=force_nr +serdes_lane_config_channel_mode_70.0=force_nr +serdes_lane_config_channel_mode_71.0=force_nr +serdes_lane_config_channel_mode_72.0=force_nr +serdes_lane_config_channel_mode_73.0=force_nr +serdes_lane_config_channel_mode_74.0=force_nr +serdes_lane_config_channel_mode_75.0=force_nr +serdes_lane_config_channel_mode_76.0=force_nr +serdes_lane_config_channel_mode_77.0=force_nr +serdes_lane_config_channel_mode_78.0=force_nr +serdes_lane_config_channel_mode_79.0=force_nr +serdes_lane_config_channel_mode_80.0=force_nr +serdes_lane_config_channel_mode_81.0=force_nr +serdes_lane_config_channel_mode_82.0=force_nr +serdes_lane_config_channel_mode_83.0=force_nr +serdes_lane_config_channel_mode_84.0=force_nr +serdes_lane_config_channel_mode_85.0=force_nr +serdes_lane_config_channel_mode_86.0=force_nr +serdes_lane_config_channel_mode_87.0=force_nr +serdes_lane_config_channel_mode_88.0=force_nr +serdes_lane_config_channel_mode_89.0=force_nr +serdes_lane_config_channel_mode_90.0=force_nr +serdes_lane_config_channel_mode_91.0=force_nr +serdes_lane_config_channel_mode_92.0=force_nr +serdes_lane_config_channel_mode_93.0=force_nr +serdes_lane_config_channel_mode_94.0=force_nr +serdes_lane_config_channel_mode_95.0=force_nr +serdes_lane_config_channel_mode_96.0=force_nr +serdes_lane_config_channel_mode_97.0=force_nr +serdes_lane_config_channel_mode_98.0=force_nr +serdes_lane_config_channel_mode_99.0=force_nr +serdes_lane_config_channel_mode_100.0=force_nr +serdes_lane_config_channel_mode_101.0=force_nr +serdes_lane_config_channel_mode_102.0=force_nr +serdes_lane_config_channel_mode_103.0=force_nr +serdes_lane_config_channel_mode_104.0=force_nr +serdes_lane_config_channel_mode_105.0=force_nr +serdes_lane_config_channel_mode_106.0=force_nr +serdes_lane_config_channel_mode_107.0=force_nr +serdes_lane_config_channel_mode_108.0=force_nr +serdes_lane_config_channel_mode_109.0=force_nr +serdes_lane_config_channel_mode_110.0=force_nr +serdes_lane_config_channel_mode_111.0=force_nr +serdes_lane_config_channel_mode_112.0=force_nr +serdes_lane_config_channel_mode_113.0=force_nr +serdes_lane_config_channel_mode_114.0=force_nr +serdes_lane_config_channel_mode_115.0=force_nr +serdes_lane_config_channel_mode_116.0=force_nr +serdes_lane_config_channel_mode_117.0=force_nr +serdes_lane_config_channel_mode_118.0=force_nr +serdes_lane_config_channel_mode_119.0=force_nr +serdes_lane_config_channel_mode_120.0=force_nr +serdes_lane_config_channel_mode_121.0=force_nr +serdes_lane_config_channel_mode_122.0=force_nr +serdes_lane_config_channel_mode_123.0=force_nr +serdes_lane_config_channel_mode_124.0=force_nr +serdes_lane_config_channel_mode_125.0=force_nr +serdes_lane_config_channel_mode_126.0=force_nr +serdes_lane_config_channel_mode_127.0=force_nr +serdes_lane_config_channel_mode_128.0=force_nr +serdes_lane_config_channel_mode_129.0=force_nr +serdes_lane_config_channel_mode_130.0=force_nr +serdes_lane_config_channel_mode_131.0=force_nr +serdes_lane_config_channel_mode_132.0=force_nr +serdes_lane_config_channel_mode_133.0=force_nr +serdes_lane_config_channel_mode_134.0=force_nr +serdes_lane_config_channel_mode_135.0=force_nr +serdes_lane_config_channel_mode_136.0=force_nr +serdes_lane_config_channel_mode_137.0=force_nr +serdes_lane_config_channel_mode_138.0=force_nr +serdes_lane_config_channel_mode_139.0=force_nr +serdes_lane_config_channel_mode_140.0=force_nr +serdes_lane_config_channel_mode_141.0=force_nr +serdes_lane_config_channel_mode_142.0=force_nr +serdes_lane_config_channel_mode_143.0=force_nr +serdes_lane_config_channel_mode_144.0=force_nr +serdes_lane_config_channel_mode_145.0=force_nr +serdes_lane_config_channel_mode_146.0=force_nr +serdes_lane_config_channel_mode_147.0=force_nr +serdes_lane_config_channel_mode_148.0=force_nr +serdes_lane_config_channel_mode_149.0=force_nr +serdes_lane_config_channel_mode_150.0=force_nr +serdes_lane_config_channel_mode_151.0=force_nr +serdes_lane_config_channel_mode_152.0=force_nr +serdes_lane_config_channel_mode_153.0=force_nr +serdes_lane_config_channel_mode_154.0=force_nr +serdes_lane_config_channel_mode_155.0=force_nr +serdes_lane_config_channel_mode_156.0=force_nr +serdes_lane_config_channel_mode_157.0=force_nr +serdes_lane_config_channel_mode_158.0=force_nr +serdes_lane_config_channel_mode_159.0=force_nr +serdes_lane_config_channel_mode_160.0=force_nr +serdes_lane_config_channel_mode_161.0=force_nr +serdes_lane_config_channel_mode_162.0=force_nr +serdes_lane_config_channel_mode_163.0=force_nr +serdes_lane_config_channel_mode_164.0=force_nr +serdes_lane_config_channel_mode_165.0=force_nr +serdes_lane_config_channel_mode_166.0=force_nr +serdes_lane_config_channel_mode_167.0=force_nr +serdes_lane_config_channel_mode_168.0=force_nr +serdes_lane_config_channel_mode_169.0=force_nr +serdes_lane_config_channel_mode_170.0=force_nr +serdes_lane_config_channel_mode_171.0=force_nr +serdes_lane_config_channel_mode_172.0=force_nr +serdes_lane_config_channel_mode_173.0=force_nr +serdes_lane_config_channel_mode_174.0=force_nr +serdes_lane_config_channel_mode_175.0=force_nr +serdes_lane_config_channel_mode_176.0=force_nr +serdes_lane_config_channel_mode_177.0=force_nr +serdes_lane_config_channel_mode_178.0=force_nr +serdes_lane_config_channel_mode_179.0=force_nr +serdes_lane_config_channel_mode_180.0=force_nr +serdes_lane_config_channel_mode_181.0=force_nr +serdes_lane_config_channel_mode_182.0=force_nr +serdes_lane_config_channel_mode_183.0=force_nr +serdes_lane_config_channel_mode_184.0=force_nr +serdes_lane_config_channel_mode_185.0=force_nr +serdes_lane_config_channel_mode_186.0=force_nr +serdes_lane_config_channel_mode_187.0=force_nr +serdes_lane_config_channel_mode_188.0=force_nr +serdes_lane_config_channel_mode_189.0=force_nr +serdes_lane_config_channel_mode_190.0=force_nr +serdes_lane_config_channel_mode_191.0=force_nr + + +serdes_qrtt_active_0.0=1 +serdes_qrtt_active_1.0=1 +serdes_qrtt_active_2.0=1 +serdes_qrtt_active_3.0=1 +serdes_qrtt_active_4.0=1 +serdes_qrtt_active_5.0=1 +serdes_qrtt_active_6.0=1 +serdes_qrtt_active_7.0=1 +serdes_qrtt_active_8.0=1 +serdes_qrtt_active_9.0=1 +serdes_qrtt_active_10.0=1 +serdes_qrtt_active_11.0=1 +serdes_qrtt_active_12.0=1 +serdes_qrtt_active_13.0=1 +serdes_qrtt_active_14.0=1 +serdes_qrtt_active_15.0=1 +serdes_qrtt_active_16.0=1 +serdes_qrtt_active_17.0=1 +serdes_qrtt_active_18.0=1 +serdes_qrtt_active_19.0=1 +serdes_qrtt_active_20.0=1 +serdes_qrtt_active_21.0=1 +serdes_qrtt_active_22.0=1 +serdes_qrtt_active_23.0=1 +serdes_qrtt_active_24.0=1 +serdes_qrtt_active_25.0=1 +serdes_qrtt_active_26.0=1 +serdes_qrtt_active_27.0=1 +serdes_qrtt_active_28.0=1 +serdes_qrtt_active_29.0=1 +serdes_qrtt_active_30.0=1 +serdes_qrtt_active_31.0=1 +serdes_qrtt_active_32.0=1 +serdes_qrtt_active_33.0=1 +serdes_qrtt_active_34.0=1 +serdes_qrtt_active_35.0=1 +serdes_qrtt_active_36.0=1 +serdes_qrtt_active_37.0=1 +serdes_qrtt_active_38.0=1 +serdes_qrtt_active_39.0=1 +serdes_qrtt_active_40.0=1 +serdes_qrtt_active_41.0=1 +serdes_qrtt_active_42.0=1 +serdes_qrtt_active_43.0=1 +serdes_qrtt_active_44.0=1 +serdes_qrtt_active_45.0=1 +serdes_qrtt_active_46.0=1 +serdes_qrtt_active_47.0=1 diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/9/config-ramon-5-1.bcm b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/9/config-ramon-5-1.bcm new file mode 100644 index 000000000000..31834cddc4bb --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/9/config-ramon-5-1.bcm @@ -0,0 +1,1395 @@ + +appl_enable_intr_init.BCM8879X=0 +appl_param_module_id.BCM8879X=10 +bcm_linkscan_interval.BCM8879X=0 +bcm_stat_interval.BCM8879X=4000000 +bist_enable.BCM8879X=0 +core_clock_speed_khz.BCM8879X=1000000 +custom_feature_access_only.BCM8879X=0 +custom_feature_lane_swap_disable.BCM8879X=0 +dport_map_direct.BCM8879X=1 +fabric_cell_fifo_dma_enable.BCM8879X=0 +fabric_device_mode.BCM8879X=SINGLE_STAGE_FE2 +fabric_load_balancing_mode.BCM8879X=NORMAL_LOAD_BALANCE +fabric_multicast_mode.BCM8879X=DIRECT +fabric_num_pipes.BCM8879X=1 +fabric_pipe_map.BCM8879X=0 +fe_mc_id_range.BCM8879X=128K +load_firmware.BCM8879X=0x102 +mdio_output_delay_ext.BCM8879X=14 +mdio_output_delay_int.BCM8879X=25 +mem_cache_enable_parity.BCM8879X=1 +mm_intr_enable.BCM8879X=0 +mm_timeout_usec.BCM8879X=300000 +polled_irq_delay.BCM8879X=100000 +polled_irq_mode.BCM8879X=1 +port_fec.BCM8879X=7 +port_init_cl72.BCM8879X=0 +port_init_speed.BCM8879X=53125 +rate_ext_mdio_divisor.BCM8879X=14 +rate_int_mdio_divisor.BCM8879X=50 +schan_intr_enable.BCM8879X=0 +schan_timeout_usec.BCM8879X=300000 +serdes_fabric_clk_freq_in.BCM8879X=1 +serdes_fabric_clk_freq_out.BCM8879X=bypass +soc_family.BCM8879X=BCM8879X +srd_tx_drv_hv_disable.BCM8879X=0 +system_contains_multiple_pipe_device.BCM8879X=0 +system_ref_core_clock_khz.BCM8879X=1200000 +table_dma_enable.BCM8879X=0 +tdma_intr_enable.BCM8879X=0 +tdma_timeout_usec.BCM8879X=5000000 +tslam_dma_enable.BCM8879X=0 +tslam_intr_enable.BCM8879X=0 +tslam_timeout_usec.BCM8879X=5000000 + +lane_to_serdes_map_fabric_lane0.BCM8879X=rx0:tx0 +lane_to_serdes_map_fabric_lane1.BCM8879X=rx1:tx1 +lane_to_serdes_map_fabric_lane2.BCM8879X=rx2:tx2 +lane_to_serdes_map_fabric_lane3.BCM8879X=rx3:tx3 + +lane_to_serdes_map_fabric_lane4.BCM8879X=rx4:tx4 +lane_to_serdes_map_fabric_lane5.BCM8879X=rx5:tx5 +lane_to_serdes_map_fabric_lane6.BCM8879X=rx6:tx6 +lane_to_serdes_map_fabric_lane7.BCM8879X=rx7:tx7 + +lane_to_serdes_map_fabric_lane8.BCM8879X=rx8:tx8 +lane_to_serdes_map_fabric_lane9.BCM8879X=rx9:tx9 +lane_to_serdes_map_fabric_lane10.BCM8879X=rx10:tx10 +lane_to_serdes_map_fabric_lane11.BCM8879X=rx11:tx11 + +lane_to_serdes_map_fabric_lane12.BCM8879X=rx12:tx12 +lane_to_serdes_map_fabric_lane13.BCM8879X=rx13:tx13 +lane_to_serdes_map_fabric_lane14.BCM8879X=rx14:tx14 +lane_to_serdes_map_fabric_lane15.BCM8879X=rx15:tx15 + +lane_to_serdes_map_fabric_lane16.BCM8879X=rx16:tx16 +lane_to_serdes_map_fabric_lane17.BCM8879X=rx17:tx17 +lane_to_serdes_map_fabric_lane18.BCM8879X=rx18:tx18 +lane_to_serdes_map_fabric_lane19.BCM8879X=rx19:tx19 + +lane_to_serdes_map_fabric_lane20.BCM8879X=rx20:tx20 +lane_to_serdes_map_fabric_lane21.BCM8879X=rx21:tx21 +lane_to_serdes_map_fabric_lane22.BCM8879X=rx22:tx22 +lane_to_serdes_map_fabric_lane23.BCM8879X=rx23:tx23 + +lane_to_serdes_map_fabric_lane24.BCM8879X=rx24:tx24 +lane_to_serdes_map_fabric_lane25.BCM8879X=rx25:tx25 +lane_to_serdes_map_fabric_lane26.BCM8879X=rx26:tx26 +lane_to_serdes_map_fabric_lane27.BCM8879X=rx27:tx27 + +lane_to_serdes_map_fabric_lane28.BCM8879X=rx28:tx28 +lane_to_serdes_map_fabric_lane29.BCM8879X=rx29:tx29 +lane_to_serdes_map_fabric_lane30.BCM8879X=rx30:tx30 +lane_to_serdes_map_fabric_lane31.BCM8879X=rx31:tx31 + +lane_to_serdes_map_fabric_lane32.BCM8879X=rx32:tx32 +lane_to_serdes_map_fabric_lane33.BCM8879X=rx33:tx33 +lane_to_serdes_map_fabric_lane34.BCM8879X=rx34:tx34 +lane_to_serdes_map_fabric_lane35.BCM8879X=rx35:tx35 + +lane_to_serdes_map_fabric_lane36.BCM8879X=rx36:tx36 +lane_to_serdes_map_fabric_lane37.BCM8879X=rx37:tx37 +lane_to_serdes_map_fabric_lane38.BCM8879X=rx38:tx38 +lane_to_serdes_map_fabric_lane39.BCM8879X=rx39:tx39 + +lane_to_serdes_map_fabric_lane40.BCM8879X=rx40:tx40 +lane_to_serdes_map_fabric_lane41.BCM8879X=rx41:tx41 +lane_to_serdes_map_fabric_lane42.BCM8879X=rx42:tx42 +lane_to_serdes_map_fabric_lane43.BCM8879X=rx43:tx43 + +lane_to_serdes_map_fabric_lane44.BCM8879X=rx44:tx44 +lane_to_serdes_map_fabric_lane45.BCM8879X=rx45:tx45 +lane_to_serdes_map_fabric_lane46.BCM8879X=rx46:tx46 +lane_to_serdes_map_fabric_lane47.BCM8879X=rx47:tx47 + +lane_to_serdes_map_fabric_lane48.BCM8879X=rx48:tx48 +lane_to_serdes_map_fabric_lane49.BCM8879X=rx49:tx49 +lane_to_serdes_map_fabric_lane50.BCM8879X=rx50:tx50 +lane_to_serdes_map_fabric_lane51.BCM8879X=rx51:tx51 + +lane_to_serdes_map_fabric_lane52.BCM8879X=rx52:tx52 +lane_to_serdes_map_fabric_lane53.BCM8879X=rx53:tx53 +lane_to_serdes_map_fabric_lane54.BCM8879X=rx54:tx54 +lane_to_serdes_map_fabric_lane55.BCM8879X=rx55:tx55 + +lane_to_serdes_map_fabric_lane56.BCM8879X=rx56:tx56 +lane_to_serdes_map_fabric_lane57.BCM8879X=rx57:tx57 +lane_to_serdes_map_fabric_lane58.BCM8879X=rx58:tx58 +lane_to_serdes_map_fabric_lane59.BCM8879X=rx59:tx59 + +lane_to_serdes_map_fabric_lane60.BCM8879X=rx60:tx60 +lane_to_serdes_map_fabric_lane61.BCM8879X=rx61:tx61 +lane_to_serdes_map_fabric_lane62.BCM8879X=rx62:tx62 +lane_to_serdes_map_fabric_lane63.BCM8879X=rx63:tx63 + +lane_to_serdes_map_fabric_lane64.BCM8879X=rx64:tx64 +lane_to_serdes_map_fabric_lane65.BCM8879X=rx65:tx65 +lane_to_serdes_map_fabric_lane66.BCM8879X=rx66:tx66 +lane_to_serdes_map_fabric_lane67.BCM8879X=rx67:tx67 + +lane_to_serdes_map_fabric_lane68.BCM8879X=rx68:tx68 +lane_to_serdes_map_fabric_lane69.BCM8879X=rx69:tx69 +lane_to_serdes_map_fabric_lane70.BCM8879X=rx70:tx70 +lane_to_serdes_map_fabric_lane71.BCM8879X=rx71:tx71 + +lane_to_serdes_map_fabric_lane72.BCM8879X=rx72:tx72 +lane_to_serdes_map_fabric_lane73.BCM8879X=rx73:tx73 +lane_to_serdes_map_fabric_lane74.BCM8879X=rx74:tx74 +lane_to_serdes_map_fabric_lane75.BCM8879X=rx75:tx75 + +lane_to_serdes_map_fabric_lane76.BCM8879X=rx76:tx76 +lane_to_serdes_map_fabric_lane77.BCM8879X=rx77:tx77 +lane_to_serdes_map_fabric_lane78.BCM8879X=rx78:tx78 +lane_to_serdes_map_fabric_lane79.BCM8879X=rx79:tx79 + +lane_to_serdes_map_fabric_lane80.BCM8879X=rx80:tx80 +lane_to_serdes_map_fabric_lane81.BCM8879X=rx81:tx81 +lane_to_serdes_map_fabric_lane82.BCM8879X=rx82:tx82 +lane_to_serdes_map_fabric_lane83.BCM8879X=rx83:tx83 + +lane_to_serdes_map_fabric_lane84.BCM8879X=rx84:tx84 +lane_to_serdes_map_fabric_lane85.BCM8879X=rx85:tx85 +lane_to_serdes_map_fabric_lane86.BCM8879X=rx86:tx86 +lane_to_serdes_map_fabric_lane87.BCM8879X=rx87:tx87 + +lane_to_serdes_map_fabric_lane88.BCM8879X=rx88:tx88 +lane_to_serdes_map_fabric_lane89.BCM8879X=rx89:tx89 +lane_to_serdes_map_fabric_lane90.BCM8879X=rx90:tx90 +lane_to_serdes_map_fabric_lane91.BCM8879X=rx91:tx91 + +lane_to_serdes_map_fabric_lane92.BCM8879X=rx92:tx92 +lane_to_serdes_map_fabric_lane93.BCM8879X=rx93:tx93 +lane_to_serdes_map_fabric_lane94.BCM8879X=rx94:tx94 +lane_to_serdes_map_fabric_lane95.BCM8879X=rx95:tx95 + +lane_to_serdes_map_fabric_lane96.BCM8879X=rx96:tx96 +lane_to_serdes_map_fabric_lane97.BCM8879X=rx97:tx97 +lane_to_serdes_map_fabric_lane98.BCM8879X=rx98:tx98 +lane_to_serdes_map_fabric_lane99.BCM8879X=rx99:tx99 + +lane_to_serdes_map_fabric_lane100.BCM8879X=rx100:tx100 +lane_to_serdes_map_fabric_lane101.BCM8879X=rx101:tx101 +lane_to_serdes_map_fabric_lane102.BCM8879X=rx102:tx102 +lane_to_serdes_map_fabric_lane103.BCM8879X=rx103:tx103 + +lane_to_serdes_map_fabric_lane104.BCM8879X=rx104:tx104 +lane_to_serdes_map_fabric_lane105.BCM8879X=rx105:tx105 +lane_to_serdes_map_fabric_lane106.BCM8879X=rx106:tx106 +lane_to_serdes_map_fabric_lane107.BCM8879X=rx107:tx107 + +lane_to_serdes_map_fabric_lane108.BCM8879X=rx108:tx108 +lane_to_serdes_map_fabric_lane109.BCM8879X=rx109:tx109 +lane_to_serdes_map_fabric_lane110.BCM8879X=rx110:tx110 +lane_to_serdes_map_fabric_lane111.BCM8879X=rx111:tx111 + +lane_to_serdes_map_fabric_lane112.BCM8879X=rx112:tx112 +lane_to_serdes_map_fabric_lane113.BCM8879X=rx113:tx113 +lane_to_serdes_map_fabric_lane114.BCM8879X=rx114:tx114 +lane_to_serdes_map_fabric_lane115.BCM8879X=rx115:tx115 + +lane_to_serdes_map_fabric_lane116.BCM8879X=rx116:tx116 +lane_to_serdes_map_fabric_lane117.BCM8879X=rx117:tx117 +lane_to_serdes_map_fabric_lane118.BCM8879X=rx118:tx118 +lane_to_serdes_map_fabric_lane119.BCM8879X=rx119:tx119 + +lane_to_serdes_map_fabric_lane120.BCM8879X=rx120:tx120 +lane_to_serdes_map_fabric_lane121.BCM8879X=rx121:tx121 +lane_to_serdes_map_fabric_lane122.BCM8879X=rx122:tx122 +lane_to_serdes_map_fabric_lane123.BCM8879X=rx123:tx123 + +lane_to_serdes_map_fabric_lane124.BCM8879X=rx124:tx124 +lane_to_serdes_map_fabric_lane125.BCM8879X=rx125:tx125 +lane_to_serdes_map_fabric_lane126.BCM8879X=rx126:tx126 +lane_to_serdes_map_fabric_lane127.BCM8879X=rx127:tx127 + +lane_to_serdes_map_fabric_lane128.BCM8879X=rx128:tx128 +lane_to_serdes_map_fabric_lane129.BCM8879X=rx129:tx129 +lane_to_serdes_map_fabric_lane130.BCM8879X=rx130:tx130 +lane_to_serdes_map_fabric_lane131.BCM8879X=rx131:tx131 + +lane_to_serdes_map_fabric_lane132.BCM8879X=rx132:tx132 +lane_to_serdes_map_fabric_lane133.BCM8879X=rx133:tx133 +lane_to_serdes_map_fabric_lane134.BCM8879X=rx134:tx134 +lane_to_serdes_map_fabric_lane135.BCM8879X=rx135:tx135 + +lane_to_serdes_map_fabric_lane136.BCM8879X=rx136:tx136 +lane_to_serdes_map_fabric_lane137.BCM8879X=rx137:tx137 +lane_to_serdes_map_fabric_lane138.BCM8879X=rx138:tx138 +lane_to_serdes_map_fabric_lane139.BCM8879X=rx139:tx139 + +lane_to_serdes_map_fabric_lane140.BCM8879X=rx140:tx140 +lane_to_serdes_map_fabric_lane141.BCM8879X=rx141:tx141 +lane_to_serdes_map_fabric_lane142.BCM8879X=rx142:tx142 +lane_to_serdes_map_fabric_lane143.BCM8879X=rx143:tx143 + +lane_to_serdes_map_fabric_lane144.BCM8879X=rx144:tx144 +lane_to_serdes_map_fabric_lane145.BCM8879X=rx145:tx145 +lane_to_serdes_map_fabric_lane146.BCM8879X=rx146:tx146 +lane_to_serdes_map_fabric_lane147.BCM8879X=rx147:tx147 + +lane_to_serdes_map_fabric_lane148.BCM8879X=rx148:tx148 +lane_to_serdes_map_fabric_lane149.BCM8879X=rx149:tx149 +lane_to_serdes_map_fabric_lane150.BCM8879X=rx150:tx150 +lane_to_serdes_map_fabric_lane151.BCM8879X=rx151:tx151 + +lane_to_serdes_map_fabric_lane152.BCM8879X=rx152:tx152 +lane_to_serdes_map_fabric_lane153.BCM8879X=rx153:tx153 +lane_to_serdes_map_fabric_lane154.BCM8879X=rx154:tx154 +lane_to_serdes_map_fabric_lane155.BCM8879X=rx155:tx155 + +lane_to_serdes_map_fabric_lane156.BCM8879X=rx156:tx156 +lane_to_serdes_map_fabric_lane157.BCM8879X=rx157:tx157 +lane_to_serdes_map_fabric_lane158.BCM8879X=rx158:tx158 +lane_to_serdes_map_fabric_lane159.BCM8879X=rx159:tx159 + +lane_to_serdes_map_fabric_lane160.BCM8879X=rx160:tx160 +lane_to_serdes_map_fabric_lane161.BCM8879X=rx161:tx161 +lane_to_serdes_map_fabric_lane162.BCM8879X=rx162:tx162 +lane_to_serdes_map_fabric_lane163.BCM8879X=rx163:tx163 + +lane_to_serdes_map_fabric_lane164.BCM8879X=rx164:tx164 +lane_to_serdes_map_fabric_lane165.BCM8879X=rx165:tx165 +lane_to_serdes_map_fabric_lane166.BCM8879X=rx166:tx166 +lane_to_serdes_map_fabric_lane167.BCM8879X=rx167:tx167 + +lane_to_serdes_map_fabric_lane168.BCM8879X=rx168:tx168 +lane_to_serdes_map_fabric_lane169.BCM8879X=rx169:tx169 +lane_to_serdes_map_fabric_lane170.BCM8879X=rx170:tx170 +lane_to_serdes_map_fabric_lane171.BCM8879X=rx171:tx171 + +lane_to_serdes_map_fabric_lane172.BCM8879X=rx172:tx172 +lane_to_serdes_map_fabric_lane173.BCM8879X=rx173:tx173 +lane_to_serdes_map_fabric_lane174.BCM8879X=rx174:tx174 +lane_to_serdes_map_fabric_lane175.BCM8879X=rx175:tx175 + +lane_to_serdes_map_fabric_lane176.BCM8879X=rx176:tx176 +lane_to_serdes_map_fabric_lane177.BCM8879X=rx177:tx177 +lane_to_serdes_map_fabric_lane178.BCM8879X=rx178:tx178 +lane_to_serdes_map_fabric_lane179.BCM8879X=rx179:tx179 + +lane_to_serdes_map_fabric_lane180.BCM8879X=rx180:tx180 +lane_to_serdes_map_fabric_lane181.BCM8879X=rx181:tx181 +lane_to_serdes_map_fabric_lane182.BCM8879X=rx182:tx182 +lane_to_serdes_map_fabric_lane183.BCM8879X=rx183:tx183 + +lane_to_serdes_map_fabric_lane184.BCM8879X=rx184:tx184 +lane_to_serdes_map_fabric_lane185.BCM8879X=rx185:tx185 +lane_to_serdes_map_fabric_lane186.BCM8879X=rx186:tx186 +lane_to_serdes_map_fabric_lane187.BCM8879X=rx187:tx187 + +lane_to_serdes_map_fabric_lane188.BCM8879X=rx188:tx188 +lane_to_serdes_map_fabric_lane189.BCM8879X=rx189:tx189 +lane_to_serdes_map_fabric_lane190.BCM8879X=rx190:tx190 +lane_to_serdes_map_fabric_lane191.BCM8879X=rx191:tx191 + + +phy_rx_polarity_flip_fabric0.BCM8879X=1 +phy_rx_polarity_flip_fabric1.BCM8879X=0 +phy_rx_polarity_flip_fabric2.BCM8879X=1 +phy_rx_polarity_flip_fabric3.BCM8879X=0 + +phy_rx_polarity_flip_fabric4.BCM8879X=1 +phy_rx_polarity_flip_fabric5.BCM8879X=0 +phy_rx_polarity_flip_fabric6.BCM8879X=1 +phy_rx_polarity_flip_fabric7.BCM8879X=0 + +phy_rx_polarity_flip_fabric8.BCM8879X=0 +phy_rx_polarity_flip_fabric9.BCM8879X=1 +phy_rx_polarity_flip_fabric10.BCM8879X=0 +phy_rx_polarity_flip_fabric11.BCM8879X=1 + +phy_rx_polarity_flip_fabric12.BCM8879X=1 +phy_rx_polarity_flip_fabric13.BCM8879X=0 +phy_rx_polarity_flip_fabric14.BCM8879X=1 +phy_rx_polarity_flip_fabric15.BCM8879X=0 + +phy_rx_polarity_flip_fabric16.BCM8879X=1 +phy_rx_polarity_flip_fabric17.BCM8879X=0 +phy_rx_polarity_flip_fabric18.BCM8879X=1 +phy_rx_polarity_flip_fabric19.BCM8879X=0 + +phy_rx_polarity_flip_fabric20.BCM8879X=0 +phy_rx_polarity_flip_fabric21.BCM8879X=1 +phy_rx_polarity_flip_fabric22.BCM8879X=0 +phy_rx_polarity_flip_fabric23.BCM8879X=1 + +phy_rx_polarity_flip_fabric24.BCM8879X=1 +phy_rx_polarity_flip_fabric25.BCM8879X=0 +phy_rx_polarity_flip_fabric26.BCM8879X=1 +phy_rx_polarity_flip_fabric27.BCM8879X=0 + +phy_rx_polarity_flip_fabric28.BCM8879X=1 +phy_rx_polarity_flip_fabric29.BCM8879X=0 +phy_rx_polarity_flip_fabric30.BCM8879X=1 +phy_rx_polarity_flip_fabric31.BCM8879X=0 + +phy_rx_polarity_flip_fabric32.BCM8879X=0 +phy_rx_polarity_flip_fabric33.BCM8879X=1 +phy_rx_polarity_flip_fabric34.BCM8879X=0 +phy_rx_polarity_flip_fabric35.BCM8879X=1 + +phy_rx_polarity_flip_fabric36.BCM8879X=1 +phy_rx_polarity_flip_fabric37.BCM8879X=0 +phy_rx_polarity_flip_fabric38.BCM8879X=1 +phy_rx_polarity_flip_fabric39.BCM8879X=0 + +phy_rx_polarity_flip_fabric40.BCM8879X=0 +phy_rx_polarity_flip_fabric41.BCM8879X=1 +phy_rx_polarity_flip_fabric42.BCM8879X=0 +phy_rx_polarity_flip_fabric43.BCM8879X=1 + +phy_rx_polarity_flip_fabric44.BCM8879X=1 +phy_rx_polarity_flip_fabric45.BCM8879X=0 +phy_rx_polarity_flip_fabric46.BCM8879X=1 +phy_rx_polarity_flip_fabric47.BCM8879X=0 + +phy_rx_polarity_flip_fabric48.BCM8879X=1 +phy_rx_polarity_flip_fabric49.BCM8879X=0 +phy_rx_polarity_flip_fabric50.BCM8879X=1 +phy_rx_polarity_flip_fabric51.BCM8879X=0 + +phy_rx_polarity_flip_fabric52.BCM8879X=0 +phy_rx_polarity_flip_fabric53.BCM8879X=1 +phy_rx_polarity_flip_fabric54.BCM8879X=0 +phy_rx_polarity_flip_fabric55.BCM8879X=1 + +phy_rx_polarity_flip_fabric56.BCM8879X=0 +phy_rx_polarity_flip_fabric57.BCM8879X=1 +phy_rx_polarity_flip_fabric58.BCM8879X=0 +phy_rx_polarity_flip_fabric59.BCM8879X=1 + +phy_rx_polarity_flip_fabric60.BCM8879X=0 +phy_rx_polarity_flip_fabric61.BCM8879X=1 +phy_rx_polarity_flip_fabric62.BCM8879X=0 +phy_rx_polarity_flip_fabric63.BCM8879X=1 + +phy_rx_polarity_flip_fabric64.BCM8879X=0 +phy_rx_polarity_flip_fabric65.BCM8879X=1 +phy_rx_polarity_flip_fabric66.BCM8879X=0 +phy_rx_polarity_flip_fabric67.BCM8879X=1 + +phy_rx_polarity_flip_fabric68.BCM8879X=1 +phy_rx_polarity_flip_fabric69.BCM8879X=0 +phy_rx_polarity_flip_fabric70.BCM8879X=1 +phy_rx_polarity_flip_fabric71.BCM8879X=0 + +phy_rx_polarity_flip_fabric72.BCM8879X=1 +phy_rx_polarity_flip_fabric73.BCM8879X=0 +phy_rx_polarity_flip_fabric74.BCM8879X=1 +phy_rx_polarity_flip_fabric75.BCM8879X=0 + +phy_rx_polarity_flip_fabric76.BCM8879X=0 +phy_rx_polarity_flip_fabric77.BCM8879X=1 +phy_rx_polarity_flip_fabric78.BCM8879X=0 +phy_rx_polarity_flip_fabric79.BCM8879X=1 + +phy_rx_polarity_flip_fabric80.BCM8879X=1 +phy_rx_polarity_flip_fabric81.BCM8879X=0 +phy_rx_polarity_flip_fabric82.BCM8879X=1 +phy_rx_polarity_flip_fabric83.BCM8879X=0 + +phy_rx_polarity_flip_fabric84.BCM8879X=0 +phy_rx_polarity_flip_fabric85.BCM8879X=1 +phy_rx_polarity_flip_fabric86.BCM8879X=0 +phy_rx_polarity_flip_fabric87.BCM8879X=1 + +phy_rx_polarity_flip_fabric88.BCM8879X=1 +phy_rx_polarity_flip_fabric89.BCM8879X=0 +phy_rx_polarity_flip_fabric90.BCM8879X=1 +phy_rx_polarity_flip_fabric91.BCM8879X=0 + +phy_rx_polarity_flip_fabric92.BCM8879X=1 +phy_rx_polarity_flip_fabric93.BCM8879X=0 +phy_rx_polarity_flip_fabric94.BCM8879X=1 +phy_rx_polarity_flip_fabric95.BCM8879X=0 + +phy_rx_polarity_flip_fabric96.BCM8879X=0 +phy_rx_polarity_flip_fabric97.BCM8879X=1 +phy_rx_polarity_flip_fabric98.BCM8879X=0 +phy_rx_polarity_flip_fabric99.BCM8879X=1 + +phy_rx_polarity_flip_fabric100.BCM8879X=1 +phy_rx_polarity_flip_fabric101.BCM8879X=0 +phy_rx_polarity_flip_fabric102.BCM8879X=1 +phy_rx_polarity_flip_fabric103.BCM8879X=0 + +phy_rx_polarity_flip_fabric104.BCM8879X=0 +phy_rx_polarity_flip_fabric105.BCM8879X=1 +phy_rx_polarity_flip_fabric106.BCM8879X=0 +phy_rx_polarity_flip_fabric107.BCM8879X=1 + +phy_rx_polarity_flip_fabric108.BCM8879X=0 +phy_rx_polarity_flip_fabric109.BCM8879X=1 +phy_rx_polarity_flip_fabric110.BCM8879X=0 +phy_rx_polarity_flip_fabric111.BCM8879X=1 + +phy_rx_polarity_flip_fabric112.BCM8879X=1 +phy_rx_polarity_flip_fabric113.BCM8879X=0 +phy_rx_polarity_flip_fabric114.BCM8879X=1 +phy_rx_polarity_flip_fabric115.BCM8879X=0 + +phy_rx_polarity_flip_fabric116.BCM8879X=0 +phy_rx_polarity_flip_fabric117.BCM8879X=1 +phy_rx_polarity_flip_fabric118.BCM8879X=0 +phy_rx_polarity_flip_fabric119.BCM8879X=1 + +phy_rx_polarity_flip_fabric120.BCM8879X=1 +phy_rx_polarity_flip_fabric121.BCM8879X=0 +phy_rx_polarity_flip_fabric122.BCM8879X=1 +phy_rx_polarity_flip_fabric123.BCM8879X=0 + +phy_rx_polarity_flip_fabric124.BCM8879X=1 +phy_rx_polarity_flip_fabric125.BCM8879X=0 +phy_rx_polarity_flip_fabric126.BCM8879X=1 +phy_rx_polarity_flip_fabric127.BCM8879X=0 + +phy_rx_polarity_flip_fabric128.BCM8879X=0 +phy_rx_polarity_flip_fabric129.BCM8879X=1 +phy_rx_polarity_flip_fabric130.BCM8879X=0 +phy_rx_polarity_flip_fabric131.BCM8879X=1 + +phy_rx_polarity_flip_fabric132.BCM8879X=1 +phy_rx_polarity_flip_fabric133.BCM8879X=0 +phy_rx_polarity_flip_fabric134.BCM8879X=1 +phy_rx_polarity_flip_fabric135.BCM8879X=0 + +phy_rx_polarity_flip_fabric136.BCM8879X=0 +phy_rx_polarity_flip_fabric137.BCM8879X=1 +phy_rx_polarity_flip_fabric138.BCM8879X=0 +phy_rx_polarity_flip_fabric139.BCM8879X=1 + +phy_rx_polarity_flip_fabric140.BCM8879X=1 +phy_rx_polarity_flip_fabric141.BCM8879X=0 +phy_rx_polarity_flip_fabric142.BCM8879X=1 +phy_rx_polarity_flip_fabric143.BCM8879X=0 + +phy_rx_polarity_flip_fabric144.BCM8879X=1 +phy_rx_polarity_flip_fabric145.BCM8879X=0 +phy_rx_polarity_flip_fabric146.BCM8879X=1 +phy_rx_polarity_flip_fabric147.BCM8879X=0 + +phy_rx_polarity_flip_fabric148.BCM8879X=0 +phy_rx_polarity_flip_fabric149.BCM8879X=1 +phy_rx_polarity_flip_fabric150.BCM8879X=0 +phy_rx_polarity_flip_fabric151.BCM8879X=1 + +phy_rx_polarity_flip_fabric152.BCM8879X=1 +phy_rx_polarity_flip_fabric153.BCM8879X=0 +phy_rx_polarity_flip_fabric154.BCM8879X=1 +phy_rx_polarity_flip_fabric155.BCM8879X=0 + +phy_rx_polarity_flip_fabric156.BCM8879X=0 +phy_rx_polarity_flip_fabric157.BCM8879X=1 +phy_rx_polarity_flip_fabric158.BCM8879X=0 +phy_rx_polarity_flip_fabric159.BCM8879X=1 + +phy_rx_polarity_flip_fabric160.BCM8879X=1 +phy_rx_polarity_flip_fabric161.BCM8879X=0 +phy_rx_polarity_flip_fabric162.BCM8879X=1 +phy_rx_polarity_flip_fabric163.BCM8879X=0 + +phy_rx_polarity_flip_fabric164.BCM8879X=1 +phy_rx_polarity_flip_fabric165.BCM8879X=0 +phy_rx_polarity_flip_fabric166.BCM8879X=1 +phy_rx_polarity_flip_fabric167.BCM8879X=0 + +phy_rx_polarity_flip_fabric168.BCM8879X=1 +phy_rx_polarity_flip_fabric169.BCM8879X=0 +phy_rx_polarity_flip_fabric170.BCM8879X=1 +phy_rx_polarity_flip_fabric171.BCM8879X=0 + +phy_rx_polarity_flip_fabric172.BCM8879X=0 +phy_rx_polarity_flip_fabric173.BCM8879X=1 +phy_rx_polarity_flip_fabric174.BCM8879X=0 +phy_rx_polarity_flip_fabric175.BCM8879X=1 + +phy_rx_polarity_flip_fabric176.BCM8879X=1 +phy_rx_polarity_flip_fabric177.BCM8879X=0 +phy_rx_polarity_flip_fabric178.BCM8879X=1 +phy_rx_polarity_flip_fabric179.BCM8879X=0 + +phy_rx_polarity_flip_fabric180.BCM8879X=0 +phy_rx_polarity_flip_fabric181.BCM8879X=1 +phy_rx_polarity_flip_fabric182.BCM8879X=0 +phy_rx_polarity_flip_fabric183.BCM8879X=1 + +phy_rx_polarity_flip_fabric184.BCM8879X=1 +phy_rx_polarity_flip_fabric185.BCM8879X=0 +phy_rx_polarity_flip_fabric186.BCM8879X=1 +phy_rx_polarity_flip_fabric187.BCM8879X=0 + +phy_rx_polarity_flip_fabric188.BCM8879X=1 +phy_rx_polarity_flip_fabric189.BCM8879X=0 +phy_rx_polarity_flip_fabric190.BCM8879X=1 +phy_rx_polarity_flip_fabric191.BCM8879X=0 + + +phy_tx_polarity_flip_fabric0.BCM8879X=0 +phy_tx_polarity_flip_fabric1.BCM8879X=1 +phy_tx_polarity_flip_fabric2.BCM8879X=0 +phy_tx_polarity_flip_fabric3.BCM8879X=1 + +phy_tx_polarity_flip_fabric4.BCM8879X=0 +phy_tx_polarity_flip_fabric5.BCM8879X=1 +phy_tx_polarity_flip_fabric6.BCM8879X=0 +phy_tx_polarity_flip_fabric7.BCM8879X=1 + +phy_tx_polarity_flip_fabric8.BCM8879X=1 +phy_tx_polarity_flip_fabric9.BCM8879X=0 +phy_tx_polarity_flip_fabric10.BCM8879X=1 +phy_tx_polarity_flip_fabric11.BCM8879X=0 + +phy_tx_polarity_flip_fabric12.BCM8879X=0 +phy_tx_polarity_flip_fabric13.BCM8879X=1 +phy_tx_polarity_flip_fabric14.BCM8879X=0 +phy_tx_polarity_flip_fabric15.BCM8879X=1 + +phy_tx_polarity_flip_fabric16.BCM8879X=0 +phy_tx_polarity_flip_fabric17.BCM8879X=1 +phy_tx_polarity_flip_fabric18.BCM8879X=0 +phy_tx_polarity_flip_fabric19.BCM8879X=1 + +phy_tx_polarity_flip_fabric20.BCM8879X=1 +phy_tx_polarity_flip_fabric21.BCM8879X=0 +phy_tx_polarity_flip_fabric22.BCM8879X=1 +phy_tx_polarity_flip_fabric23.BCM8879X=0 + +phy_tx_polarity_flip_fabric24.BCM8879X=0 +phy_tx_polarity_flip_fabric25.BCM8879X=1 +phy_tx_polarity_flip_fabric26.BCM8879X=0 +phy_tx_polarity_flip_fabric27.BCM8879X=1 + +phy_tx_polarity_flip_fabric28.BCM8879X=0 +phy_tx_polarity_flip_fabric29.BCM8879X=1 +phy_tx_polarity_flip_fabric30.BCM8879X=0 +phy_tx_polarity_flip_fabric31.BCM8879X=1 + +phy_tx_polarity_flip_fabric32.BCM8879X=1 +phy_tx_polarity_flip_fabric33.BCM8879X=0 +phy_tx_polarity_flip_fabric34.BCM8879X=1 +phy_tx_polarity_flip_fabric35.BCM8879X=0 + +phy_tx_polarity_flip_fabric36.BCM8879X=0 +phy_tx_polarity_flip_fabric37.BCM8879X=1 +phy_tx_polarity_flip_fabric38.BCM8879X=0 +phy_tx_polarity_flip_fabric39.BCM8879X=1 + +phy_tx_polarity_flip_fabric40.BCM8879X=1 +phy_tx_polarity_flip_fabric41.BCM8879X=0 +phy_tx_polarity_flip_fabric42.BCM8879X=1 +phy_tx_polarity_flip_fabric43.BCM8879X=0 + +phy_tx_polarity_flip_fabric44.BCM8879X=0 +phy_tx_polarity_flip_fabric45.BCM8879X=1 +phy_tx_polarity_flip_fabric46.BCM8879X=0 +phy_tx_polarity_flip_fabric47.BCM8879X=1 + +phy_tx_polarity_flip_fabric48.BCM8879X=0 +phy_tx_polarity_flip_fabric49.BCM8879X=1 +phy_tx_polarity_flip_fabric50.BCM8879X=0 +phy_tx_polarity_flip_fabric51.BCM8879X=1 + +phy_tx_polarity_flip_fabric52.BCM8879X=1 +phy_tx_polarity_flip_fabric53.BCM8879X=0 +phy_tx_polarity_flip_fabric54.BCM8879X=1 +phy_tx_polarity_flip_fabric55.BCM8879X=0 + +phy_tx_polarity_flip_fabric56.BCM8879X=1 +phy_tx_polarity_flip_fabric57.BCM8879X=0 +phy_tx_polarity_flip_fabric58.BCM8879X=1 +phy_tx_polarity_flip_fabric59.BCM8879X=0 + +phy_tx_polarity_flip_fabric60.BCM8879X=1 +phy_tx_polarity_flip_fabric61.BCM8879X=0 +phy_tx_polarity_flip_fabric62.BCM8879X=1 +phy_tx_polarity_flip_fabric63.BCM8879X=0 + +phy_tx_polarity_flip_fabric64.BCM8879X=1 +phy_tx_polarity_flip_fabric65.BCM8879X=0 +phy_tx_polarity_flip_fabric66.BCM8879X=1 +phy_tx_polarity_flip_fabric67.BCM8879X=0 + +phy_tx_polarity_flip_fabric68.BCM8879X=0 +phy_tx_polarity_flip_fabric69.BCM8879X=1 +phy_tx_polarity_flip_fabric70.BCM8879X=0 +phy_tx_polarity_flip_fabric71.BCM8879X=1 + +phy_tx_polarity_flip_fabric72.BCM8879X=0 +phy_tx_polarity_flip_fabric73.BCM8879X=1 +phy_tx_polarity_flip_fabric74.BCM8879X=0 +phy_tx_polarity_flip_fabric75.BCM8879X=1 + +phy_tx_polarity_flip_fabric76.BCM8879X=1 +phy_tx_polarity_flip_fabric77.BCM8879X=0 +phy_tx_polarity_flip_fabric78.BCM8879X=1 +phy_tx_polarity_flip_fabric79.BCM8879X=0 + +phy_tx_polarity_flip_fabric80.BCM8879X=0 +phy_tx_polarity_flip_fabric81.BCM8879X=1 +phy_tx_polarity_flip_fabric82.BCM8879X=0 +phy_tx_polarity_flip_fabric83.BCM8879X=1 + +phy_tx_polarity_flip_fabric84.BCM8879X=1 +phy_tx_polarity_flip_fabric85.BCM8879X=0 +phy_tx_polarity_flip_fabric86.BCM8879X=1 +phy_tx_polarity_flip_fabric87.BCM8879X=0 + +phy_tx_polarity_flip_fabric88.BCM8879X=0 +phy_tx_polarity_flip_fabric89.BCM8879X=1 +phy_tx_polarity_flip_fabric90.BCM8879X=0 +phy_tx_polarity_flip_fabric91.BCM8879X=1 + +phy_tx_polarity_flip_fabric92.BCM8879X=0 +phy_tx_polarity_flip_fabric93.BCM8879X=1 +phy_tx_polarity_flip_fabric94.BCM8879X=0 +phy_tx_polarity_flip_fabric95.BCM8879X=1 + +phy_tx_polarity_flip_fabric96.BCM8879X=1 +phy_tx_polarity_flip_fabric97.BCM8879X=0 +phy_tx_polarity_flip_fabric98.BCM8879X=1 +phy_tx_polarity_flip_fabric99.BCM8879X=0 + +phy_tx_polarity_flip_fabric100.BCM8879X=0 +phy_tx_polarity_flip_fabric101.BCM8879X=1 +phy_tx_polarity_flip_fabric102.BCM8879X=0 +phy_tx_polarity_flip_fabric103.BCM8879X=1 + +phy_tx_polarity_flip_fabric104.BCM8879X=1 +phy_tx_polarity_flip_fabric105.BCM8879X=0 +phy_tx_polarity_flip_fabric106.BCM8879X=1 +phy_tx_polarity_flip_fabric107.BCM8879X=0 + +phy_tx_polarity_flip_fabric108.BCM8879X=1 +phy_tx_polarity_flip_fabric109.BCM8879X=0 +phy_tx_polarity_flip_fabric110.BCM8879X=1 +phy_tx_polarity_flip_fabric111.BCM8879X=0 + +phy_tx_polarity_flip_fabric112.BCM8879X=0 +phy_tx_polarity_flip_fabric113.BCM8879X=1 +phy_tx_polarity_flip_fabric114.BCM8879X=0 +phy_tx_polarity_flip_fabric115.BCM8879X=1 + +phy_tx_polarity_flip_fabric116.BCM8879X=1 +phy_tx_polarity_flip_fabric117.BCM8879X=0 +phy_tx_polarity_flip_fabric118.BCM8879X=1 +phy_tx_polarity_flip_fabric119.BCM8879X=0 + +phy_tx_polarity_flip_fabric120.BCM8879X=0 +phy_tx_polarity_flip_fabric121.BCM8879X=1 +phy_tx_polarity_flip_fabric122.BCM8879X=0 +phy_tx_polarity_flip_fabric123.BCM8879X=1 + +phy_tx_polarity_flip_fabric124.BCM8879X=0 +phy_tx_polarity_flip_fabric125.BCM8879X=1 +phy_tx_polarity_flip_fabric126.BCM8879X=0 +phy_tx_polarity_flip_fabric127.BCM8879X=1 + +phy_tx_polarity_flip_fabric128.BCM8879X=1 +phy_tx_polarity_flip_fabric129.BCM8879X=0 +phy_tx_polarity_flip_fabric130.BCM8879X=1 +phy_tx_polarity_flip_fabric131.BCM8879X=0 + +phy_tx_polarity_flip_fabric132.BCM8879X=0 +phy_tx_polarity_flip_fabric133.BCM8879X=1 +phy_tx_polarity_flip_fabric134.BCM8879X=0 +phy_tx_polarity_flip_fabric135.BCM8879X=1 + +phy_tx_polarity_flip_fabric136.BCM8879X=1 +phy_tx_polarity_flip_fabric137.BCM8879X=0 +phy_tx_polarity_flip_fabric138.BCM8879X=1 +phy_tx_polarity_flip_fabric139.BCM8879X=0 + +phy_tx_polarity_flip_fabric140.BCM8879X=0 +phy_tx_polarity_flip_fabric141.BCM8879X=1 +phy_tx_polarity_flip_fabric142.BCM8879X=0 +phy_tx_polarity_flip_fabric143.BCM8879X=1 + +phy_tx_polarity_flip_fabric144.BCM8879X=0 +phy_tx_polarity_flip_fabric145.BCM8879X=1 +phy_tx_polarity_flip_fabric146.BCM8879X=0 +phy_tx_polarity_flip_fabric147.BCM8879X=1 + +phy_tx_polarity_flip_fabric148.BCM8879X=1 +phy_tx_polarity_flip_fabric149.BCM8879X=0 +phy_tx_polarity_flip_fabric150.BCM8879X=1 +phy_tx_polarity_flip_fabric151.BCM8879X=0 + +phy_tx_polarity_flip_fabric152.BCM8879X=0 +phy_tx_polarity_flip_fabric153.BCM8879X=1 +phy_tx_polarity_flip_fabric154.BCM8879X=0 +phy_tx_polarity_flip_fabric155.BCM8879X=1 + +phy_tx_polarity_flip_fabric156.BCM8879X=1 +phy_tx_polarity_flip_fabric157.BCM8879X=0 +phy_tx_polarity_flip_fabric158.BCM8879X=1 +phy_tx_polarity_flip_fabric159.BCM8879X=0 + +phy_tx_polarity_flip_fabric160.BCM8879X=0 +phy_tx_polarity_flip_fabric161.BCM8879X=1 +phy_tx_polarity_flip_fabric162.BCM8879X=0 +phy_tx_polarity_flip_fabric163.BCM8879X=1 + +phy_tx_polarity_flip_fabric164.BCM8879X=0 +phy_tx_polarity_flip_fabric165.BCM8879X=1 +phy_tx_polarity_flip_fabric166.BCM8879X=0 +phy_tx_polarity_flip_fabric167.BCM8879X=1 + +phy_tx_polarity_flip_fabric168.BCM8879X=0 +phy_tx_polarity_flip_fabric169.BCM8879X=1 +phy_tx_polarity_flip_fabric170.BCM8879X=0 +phy_tx_polarity_flip_fabric171.BCM8879X=1 + +phy_tx_polarity_flip_fabric172.BCM8879X=1 +phy_tx_polarity_flip_fabric173.BCM8879X=0 +phy_tx_polarity_flip_fabric174.BCM8879X=1 +phy_tx_polarity_flip_fabric175.BCM8879X=0 + +phy_tx_polarity_flip_fabric176.BCM8879X=0 +phy_tx_polarity_flip_fabric177.BCM8879X=1 +phy_tx_polarity_flip_fabric178.BCM8879X=0 +phy_tx_polarity_flip_fabric179.BCM8879X=1 + +phy_tx_polarity_flip_fabric180.BCM8879X=1 +phy_tx_polarity_flip_fabric181.BCM8879X=0 +phy_tx_polarity_flip_fabric182.BCM8879X=1 +phy_tx_polarity_flip_fabric183.BCM8879X=0 + +phy_tx_polarity_flip_fabric184.BCM8879X=0 +phy_tx_polarity_flip_fabric185.BCM8879X=1 +phy_tx_polarity_flip_fabric186.BCM8879X=0 +phy_tx_polarity_flip_fabric187.BCM8879X=1 + +phy_tx_polarity_flip_fabric188.BCM8879X=0 +phy_tx_polarity_flip_fabric189.BCM8879X=1 +phy_tx_polarity_flip_fabric190.BCM8879X=0 +phy_tx_polarity_flip_fabric191.BCM8879X=1 + +port_init_cl72_0=0 +port_init_cl72_1=0 +port_init_cl72_2=0 +port_init_cl72_3=0 +port_init_cl72_4=0 +port_init_cl72_5=0 +port_init_cl72_6=0 +port_init_cl72_7=0 +port_init_cl72_8=0 +port_init_cl72_9=0 +port_init_cl72_10=0 +port_init_cl72_11=0 +port_init_cl72_12=0 +port_init_cl72_13=0 +port_init_cl72_14=0 +port_init_cl72_15=0 +port_init_cl72_16=0 +port_init_cl72_17=0 +port_init_cl72_18=0 +port_init_cl72_19=0 +port_init_cl72_20=0 +port_init_cl72_21=0 +port_init_cl72_22=0 +port_init_cl72_23=0 +port_init_cl72_24=0 +port_init_cl72_25=0 +port_init_cl72_26=0 +port_init_cl72_27=0 +port_init_cl72_28=0 +port_init_cl72_29=0 +port_init_cl72_30=0 +port_init_cl72_31=0 +port_init_cl72_32=0 +port_init_cl72_33=0 +port_init_cl72_34=0 +port_init_cl72_35=0 +port_init_cl72_36=0 +port_init_cl72_37=0 +port_init_cl72_38=0 +port_init_cl72_39=0 +port_init_cl72_40=0 +port_init_cl72_41=0 +port_init_cl72_42=0 +port_init_cl72_43=0 +port_init_cl72_44=0 +port_init_cl72_45=0 +port_init_cl72_46=0 +port_init_cl72_47=0 +port_init_cl72_48=0 +port_init_cl72_49=0 +port_init_cl72_50=0 +port_init_cl72_51=0 +port_init_cl72_52=0 +port_init_cl72_53=0 +port_init_cl72_54=0 +port_init_cl72_55=0 +port_init_cl72_56=0 +port_init_cl72_57=0 +port_init_cl72_58=0 +port_init_cl72_59=0 +port_init_cl72_60=0 +port_init_cl72_61=0 +port_init_cl72_62=0 +port_init_cl72_63=0 +port_init_cl72_64=0 +port_init_cl72_65=0 +port_init_cl72_66=0 +port_init_cl72_67=0 +port_init_cl72_68=0 +port_init_cl72_69=0 +port_init_cl72_70=0 +port_init_cl72_71=0 +port_init_cl72_72=0 +port_init_cl72_73=0 +port_init_cl72_74=0 +port_init_cl72_75=0 +port_init_cl72_76=0 +port_init_cl72_77=0 +port_init_cl72_78=0 +port_init_cl72_79=0 +port_init_cl72_80=0 +port_init_cl72_81=0 +port_init_cl72_82=0 +port_init_cl72_83=0 +port_init_cl72_84=0 +port_init_cl72_85=0 +port_init_cl72_86=0 +port_init_cl72_87=0 +port_init_cl72_88=0 +port_init_cl72_89=0 +port_init_cl72_90=0 +port_init_cl72_91=0 +port_init_cl72_92=0 +port_init_cl72_93=0 +port_init_cl72_94=0 +port_init_cl72_95=0 +port_init_cl72_96=0 +port_init_cl72_97=0 +port_init_cl72_98=0 +port_init_cl72_99=0 +port_init_cl72_100=0 +port_init_cl72_101=0 +port_init_cl72_102=0 +port_init_cl72_103=0 +port_init_cl72_104=0 +port_init_cl72_105=0 +port_init_cl72_106=0 +port_init_cl72_107=0 +port_init_cl72_108=0 +port_init_cl72_109=0 +port_init_cl72_110=0 +port_init_cl72_111=0 +port_init_cl72_112=0 +port_init_cl72_113=0 +port_init_cl72_114=0 +port_init_cl72_115=0 +port_init_cl72_116=0 +port_init_cl72_117=0 +port_init_cl72_118=0 +port_init_cl72_119=0 +port_init_cl72_120=0 +port_init_cl72_121=0 +port_init_cl72_122=0 +port_init_cl72_123=0 +port_init_cl72_124=0 +port_init_cl72_125=0 +port_init_cl72_126=0 +port_init_cl72_127=0 +port_init_cl72_128=0 +port_init_cl72_129=0 +port_init_cl72_130=0 +port_init_cl72_131=0 +port_init_cl72_132=0 +port_init_cl72_133=0 +port_init_cl72_134=0 +port_init_cl72_135=0 +port_init_cl72_136=0 +port_init_cl72_137=0 +port_init_cl72_138=0 +port_init_cl72_139=0 +port_init_cl72_140=0 +port_init_cl72_141=0 +port_init_cl72_142=0 +port_init_cl72_143=0 +port_init_cl72_144=0 +port_init_cl72_145=0 +port_init_cl72_146=0 +port_init_cl72_147=0 +port_init_cl72_148=0 +port_init_cl72_149=0 +port_init_cl72_150=0 +port_init_cl72_151=0 +port_init_cl72_152=0 +port_init_cl72_153=0 +port_init_cl72_154=0 +port_init_cl72_155=0 +port_init_cl72_156=0 +port_init_cl72_157=0 +port_init_cl72_158=0 +port_init_cl72_159=0 +port_init_cl72_160=0 +port_init_cl72_161=0 +port_init_cl72_162=0 +port_init_cl72_163=0 +port_init_cl72_164=0 +port_init_cl72_165=0 +port_init_cl72_166=0 +port_init_cl72_167=0 +port_init_cl72_168=0 +port_init_cl72_169=0 +port_init_cl72_170=0 +port_init_cl72_171=0 +port_init_cl72_172=0 +port_init_cl72_173=0 +port_init_cl72_174=0 +port_init_cl72_175=0 +port_init_cl72_176=0 +port_init_cl72_177=0 +port_init_cl72_178=0 +port_init_cl72_179=0 +port_init_cl72_180=0 +port_init_cl72_181=0 +port_init_cl72_182=0 +port_init_cl72_183=0 +port_init_cl72_184=0 +port_init_cl72_185=0 +port_init_cl72_186=0 +port_init_cl72_187=0 +port_init_cl72_188=0 +port_init_cl72_189=0 +port_init_cl72_190=0 +port_init_cl72_191=0 + +serdes_tx_taps_0.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_1.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_2.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_3.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_4.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_5.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_6.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_7.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_8.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_9.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_10.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_11.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_12.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_13.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_14.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_15.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_16.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_17.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_18.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_19.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_20.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_21.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_22.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_23.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_24.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_25.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_26.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_27.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_28.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_29.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_30.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_31.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_32.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_33.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_34.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_35.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_36.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_37.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_38.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_39.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_40.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_41.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_42.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_43.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_44.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_45.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_46.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_47.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_48.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_49.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_50.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_51.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_52.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_53.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_54.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_55.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_56.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_57.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_58.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_59.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_60.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_61.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_62.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_63.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_64.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_65.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_66.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_67.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_68.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_69.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_70.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_71.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_72.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_73.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_74.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_75.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_76.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_77.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_78.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_79.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_80.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_81.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_82.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_83.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_84.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_85.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_86.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_87.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_88.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_89.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_90.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_91.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_92.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_93.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_94.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_95.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_96.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_97.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_98.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_99.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_100.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_101.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_102.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_103.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_104.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_105.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_106.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_107.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_108.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_109.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_110.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_111.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_112.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_113.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_114.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_115.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_116.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_117.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_118.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_119.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_120.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_121.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_122.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_123.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_124.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_125.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_126.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_127.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_128.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_129.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_130.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_131.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_132.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_133.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_134.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_135.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_136.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_137.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_138.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_139.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_140.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_141.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_142.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_143.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_144.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_145.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_146.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_147.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_148.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_149.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_150.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_151.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_152.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_153.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_154.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_155.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_156.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_157.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_158.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_159.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_160.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_161.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_162.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_163.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_164.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_165.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_166.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_167.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_168.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_169.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_170.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_171.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_172.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_173.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_174.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_175.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_176.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_177.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_178.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_179.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_180.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_181.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_182.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_183.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_184.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_185.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_186.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_187.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_188.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_189.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_190.BCM8879X=pam4:-24:132:-12:0:0:0 +serdes_tx_taps_191.BCM8879X=pam4:-24:132:-12:0:0:0 + +serdes_lane_config_channel_mode_0.0=force_nr +serdes_lane_config_channel_mode_1.0=force_nr +serdes_lane_config_channel_mode_2.0=force_nr +serdes_lane_config_channel_mode_3.0=force_nr +serdes_lane_config_channel_mode_4.0=force_nr +serdes_lane_config_channel_mode_5.0=force_nr +serdes_lane_config_channel_mode_6.0=force_nr +serdes_lane_config_channel_mode_7.0=force_nr +serdes_lane_config_channel_mode_8.0=force_nr +serdes_lane_config_channel_mode_9.0=force_nr +serdes_lane_config_channel_mode_10.0=force_nr +serdes_lane_config_channel_mode_11.0=force_nr +serdes_lane_config_channel_mode_12.0=force_nr +serdes_lane_config_channel_mode_13.0=force_nr +serdes_lane_config_channel_mode_14.0=force_nr +serdes_lane_config_channel_mode_15.0=force_nr +serdes_lane_config_channel_mode_16.0=force_nr +serdes_lane_config_channel_mode_17.0=force_nr +serdes_lane_config_channel_mode_18.0=force_nr +serdes_lane_config_channel_mode_19.0=force_nr +serdes_lane_config_channel_mode_20.0=force_nr +serdes_lane_config_channel_mode_21.0=force_nr +serdes_lane_config_channel_mode_22.0=force_nr +serdes_lane_config_channel_mode_23.0=force_nr +serdes_lane_config_channel_mode_24.0=force_nr +serdes_lane_config_channel_mode_25.0=force_nr +serdes_lane_config_channel_mode_26.0=force_nr +serdes_lane_config_channel_mode_27.0=force_nr +serdes_lane_config_channel_mode_28.0=force_nr +serdes_lane_config_channel_mode_29.0=force_nr +serdes_lane_config_channel_mode_30.0=force_nr +serdes_lane_config_channel_mode_31.0=force_nr +serdes_lane_config_channel_mode_32.0=force_nr +serdes_lane_config_channel_mode_33.0=force_nr +serdes_lane_config_channel_mode_34.0=force_nr +serdes_lane_config_channel_mode_35.0=force_nr +serdes_lane_config_channel_mode_36.0=force_nr +serdes_lane_config_channel_mode_37.0=force_nr +serdes_lane_config_channel_mode_38.0=force_nr +serdes_lane_config_channel_mode_39.0=force_nr +serdes_lane_config_channel_mode_40.0=force_nr +serdes_lane_config_channel_mode_41.0=force_nr +serdes_lane_config_channel_mode_42.0=force_nr +serdes_lane_config_channel_mode_43.0=force_nr +serdes_lane_config_channel_mode_44.0=force_nr +serdes_lane_config_channel_mode_45.0=force_nr +serdes_lane_config_channel_mode_46.0=force_nr +serdes_lane_config_channel_mode_47.0=force_nr +serdes_lane_config_channel_mode_48.0=force_nr +serdes_lane_config_channel_mode_49.0=force_nr +serdes_lane_config_channel_mode_50.0=force_nr +serdes_lane_config_channel_mode_51.0=force_nr +serdes_lane_config_channel_mode_52.0=force_nr +serdes_lane_config_channel_mode_53.0=force_nr +serdes_lane_config_channel_mode_54.0=force_nr +serdes_lane_config_channel_mode_55.0=force_nr +serdes_lane_config_channel_mode_56.0=force_nr +serdes_lane_config_channel_mode_57.0=force_nr +serdes_lane_config_channel_mode_58.0=force_nr +serdes_lane_config_channel_mode_59.0=force_nr +serdes_lane_config_channel_mode_60.0=force_nr +serdes_lane_config_channel_mode_61.0=force_nr +serdes_lane_config_channel_mode_62.0=force_nr +serdes_lane_config_channel_mode_63.0=force_nr +serdes_lane_config_channel_mode_64.0=force_nr +serdes_lane_config_channel_mode_65.0=force_nr +serdes_lane_config_channel_mode_66.0=force_nr +serdes_lane_config_channel_mode_67.0=force_nr +serdes_lane_config_channel_mode_68.0=force_nr +serdes_lane_config_channel_mode_69.0=force_nr +serdes_lane_config_channel_mode_70.0=force_nr +serdes_lane_config_channel_mode_71.0=force_nr +serdes_lane_config_channel_mode_72.0=force_nr +serdes_lane_config_channel_mode_73.0=force_nr +serdes_lane_config_channel_mode_74.0=force_nr +serdes_lane_config_channel_mode_75.0=force_nr +serdes_lane_config_channel_mode_76.0=force_nr +serdes_lane_config_channel_mode_77.0=force_nr +serdes_lane_config_channel_mode_78.0=force_nr +serdes_lane_config_channel_mode_79.0=force_nr +serdes_lane_config_channel_mode_80.0=force_nr +serdes_lane_config_channel_mode_81.0=force_nr +serdes_lane_config_channel_mode_82.0=force_nr +serdes_lane_config_channel_mode_83.0=force_nr +serdes_lane_config_channel_mode_84.0=force_nr +serdes_lane_config_channel_mode_85.0=force_nr +serdes_lane_config_channel_mode_86.0=force_nr +serdes_lane_config_channel_mode_87.0=force_nr +serdes_lane_config_channel_mode_88.0=force_nr +serdes_lane_config_channel_mode_89.0=force_nr +serdes_lane_config_channel_mode_90.0=force_nr +serdes_lane_config_channel_mode_91.0=force_nr +serdes_lane_config_channel_mode_92.0=force_nr +serdes_lane_config_channel_mode_93.0=force_nr +serdes_lane_config_channel_mode_94.0=force_nr +serdes_lane_config_channel_mode_95.0=force_nr +serdes_lane_config_channel_mode_96.0=force_nr +serdes_lane_config_channel_mode_97.0=force_nr +serdes_lane_config_channel_mode_98.0=force_nr +serdes_lane_config_channel_mode_99.0=force_nr +serdes_lane_config_channel_mode_100.0=force_nr +serdes_lane_config_channel_mode_101.0=force_nr +serdes_lane_config_channel_mode_102.0=force_nr +serdes_lane_config_channel_mode_103.0=force_nr +serdes_lane_config_channel_mode_104.0=force_nr +serdes_lane_config_channel_mode_105.0=force_nr +serdes_lane_config_channel_mode_106.0=force_nr +serdes_lane_config_channel_mode_107.0=force_nr +serdes_lane_config_channel_mode_108.0=force_nr +serdes_lane_config_channel_mode_109.0=force_nr +serdes_lane_config_channel_mode_110.0=force_nr +serdes_lane_config_channel_mode_111.0=force_nr +serdes_lane_config_channel_mode_112.0=force_nr +serdes_lane_config_channel_mode_113.0=force_nr +serdes_lane_config_channel_mode_114.0=force_nr +serdes_lane_config_channel_mode_115.0=force_nr +serdes_lane_config_channel_mode_116.0=force_nr +serdes_lane_config_channel_mode_117.0=force_nr +serdes_lane_config_channel_mode_118.0=force_nr +serdes_lane_config_channel_mode_119.0=force_nr +serdes_lane_config_channel_mode_120.0=force_nr +serdes_lane_config_channel_mode_121.0=force_nr +serdes_lane_config_channel_mode_122.0=force_nr +serdes_lane_config_channel_mode_123.0=force_nr +serdes_lane_config_channel_mode_124.0=force_nr +serdes_lane_config_channel_mode_125.0=force_nr +serdes_lane_config_channel_mode_126.0=force_nr +serdes_lane_config_channel_mode_127.0=force_nr +serdes_lane_config_channel_mode_128.0=force_nr +serdes_lane_config_channel_mode_129.0=force_nr +serdes_lane_config_channel_mode_130.0=force_nr +serdes_lane_config_channel_mode_131.0=force_nr +serdes_lane_config_channel_mode_132.0=force_nr +serdes_lane_config_channel_mode_133.0=force_nr +serdes_lane_config_channel_mode_134.0=force_nr +serdes_lane_config_channel_mode_135.0=force_nr +serdes_lane_config_channel_mode_136.0=force_nr +serdes_lane_config_channel_mode_137.0=force_nr +serdes_lane_config_channel_mode_138.0=force_nr +serdes_lane_config_channel_mode_139.0=force_nr +serdes_lane_config_channel_mode_140.0=force_nr +serdes_lane_config_channel_mode_141.0=force_nr +serdes_lane_config_channel_mode_142.0=force_nr +serdes_lane_config_channel_mode_143.0=force_nr +serdes_lane_config_channel_mode_144.0=force_nr +serdes_lane_config_channel_mode_145.0=force_nr +serdes_lane_config_channel_mode_146.0=force_nr +serdes_lane_config_channel_mode_147.0=force_nr +serdes_lane_config_channel_mode_148.0=force_nr +serdes_lane_config_channel_mode_149.0=force_nr +serdes_lane_config_channel_mode_150.0=force_nr +serdes_lane_config_channel_mode_151.0=force_nr +serdes_lane_config_channel_mode_152.0=force_nr +serdes_lane_config_channel_mode_153.0=force_nr +serdes_lane_config_channel_mode_154.0=force_nr +serdes_lane_config_channel_mode_155.0=force_nr +serdes_lane_config_channel_mode_156.0=force_nr +serdes_lane_config_channel_mode_157.0=force_nr +serdes_lane_config_channel_mode_158.0=force_nr +serdes_lane_config_channel_mode_159.0=force_nr +serdes_lane_config_channel_mode_160.0=force_nr +serdes_lane_config_channel_mode_161.0=force_nr +serdes_lane_config_channel_mode_162.0=force_nr +serdes_lane_config_channel_mode_163.0=force_nr +serdes_lane_config_channel_mode_164.0=force_nr +serdes_lane_config_channel_mode_165.0=force_nr +serdes_lane_config_channel_mode_166.0=force_nr +serdes_lane_config_channel_mode_167.0=force_nr +serdes_lane_config_channel_mode_168.0=force_nr +serdes_lane_config_channel_mode_169.0=force_nr +serdes_lane_config_channel_mode_170.0=force_nr +serdes_lane_config_channel_mode_171.0=force_nr +serdes_lane_config_channel_mode_172.0=force_nr +serdes_lane_config_channel_mode_173.0=force_nr +serdes_lane_config_channel_mode_174.0=force_nr +serdes_lane_config_channel_mode_175.0=force_nr +serdes_lane_config_channel_mode_176.0=force_nr +serdes_lane_config_channel_mode_177.0=force_nr +serdes_lane_config_channel_mode_178.0=force_nr +serdes_lane_config_channel_mode_179.0=force_nr +serdes_lane_config_channel_mode_180.0=force_nr +serdes_lane_config_channel_mode_181.0=force_nr +serdes_lane_config_channel_mode_182.0=force_nr +serdes_lane_config_channel_mode_183.0=force_nr +serdes_lane_config_channel_mode_184.0=force_nr +serdes_lane_config_channel_mode_185.0=force_nr +serdes_lane_config_channel_mode_186.0=force_nr +serdes_lane_config_channel_mode_187.0=force_nr +serdes_lane_config_channel_mode_188.0=force_nr +serdes_lane_config_channel_mode_189.0=force_nr +serdes_lane_config_channel_mode_190.0=force_nr +serdes_lane_config_channel_mode_191.0=force_nr + + +serdes_qrtt_active_0.0=1 +serdes_qrtt_active_1.0=1 +serdes_qrtt_active_2.0=1 +serdes_qrtt_active_3.0=1 +serdes_qrtt_active_4.0=1 +serdes_qrtt_active_5.0=1 +serdes_qrtt_active_6.0=1 +serdes_qrtt_active_7.0=1 +serdes_qrtt_active_8.0=1 +serdes_qrtt_active_9.0=1 +serdes_qrtt_active_10.0=1 +serdes_qrtt_active_11.0=1 +serdes_qrtt_active_12.0=1 +serdes_qrtt_active_13.0=1 +serdes_qrtt_active_14.0=1 +serdes_qrtt_active_15.0=1 +serdes_qrtt_active_16.0=1 +serdes_qrtt_active_17.0=1 +serdes_qrtt_active_18.0=1 +serdes_qrtt_active_19.0=1 +serdes_qrtt_active_20.0=1 +serdes_qrtt_active_21.0=1 +serdes_qrtt_active_22.0=1 +serdes_qrtt_active_23.0=1 +serdes_qrtt_active_24.0=1 +serdes_qrtt_active_25.0=1 +serdes_qrtt_active_26.0=1 +serdes_qrtt_active_27.0=1 +serdes_qrtt_active_28.0=1 +serdes_qrtt_active_29.0=1 +serdes_qrtt_active_30.0=1 +serdes_qrtt_active_31.0=1 +serdes_qrtt_active_32.0=1 +serdes_qrtt_active_33.0=1 +serdes_qrtt_active_34.0=1 +serdes_qrtt_active_35.0=1 +serdes_qrtt_active_36.0=1 +serdes_qrtt_active_37.0=1 +serdes_qrtt_active_38.0=1 +serdes_qrtt_active_39.0=1 +serdes_qrtt_active_40.0=1 +serdes_qrtt_active_41.0=1 +serdes_qrtt_active_42.0=1 +serdes_qrtt_active_43.0=1 +serdes_qrtt_active_44.0=1 +serdes_qrtt_active_45.0=1 +serdes_qrtt_active_46.0=1 +serdes_qrtt_active_47.0=1 diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/platform.json b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/platform.json index ec96ac39ae09..4e24bb3e8d92 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/platform.json +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/Nokia-IXR7250E-SUP-10/platform.json @@ -9,6 +9,19 @@ "name": "FPGA1" } ], + "watchdog": { + "disarm": false + }, + "get_module_attributes": { + "model": false, + "serial": false, + "base_mac": false, + "system_eeprom_info": false + }, + "thermal_temperature": { + "minimum": 0, + "maximum": 110 + }, "fans": [], "fan_drawers": [ { @@ -16,7 +29,8 @@ "num_fans": 1, "fans": [ { - "name": "Fan0" + "name": "Fan0", + "speed": { "controllable": false } } ] }, @@ -25,7 +39,8 @@ "num_fans": 1, "fans": [ { - "name": "Fan1" + "name": "Fan1", + "speed": { "controllable": false } } ] }, @@ -34,7 +49,8 @@ "num_fans": 1, "fans": [ { - "name": "Fan2" + "name": "Fan2", + "speed": { "controllable": false } } ] }, @@ -43,7 +59,8 @@ "num_fans": 1, "fans": [ { - "name": "Fan3" + "name": "Fan3", + "speed": { "controllable": false } } ] } @@ -113,136 +130,184 @@ ], "thermals": [ { - "name": "temp_1" + "name": "temp_1(fan)", + "controllable": false }, { - "name": "temp_2" + "name": "temp_2", + "controllable": false }, { - "name": "temp_3(fan)" + "name": "temp_3", + "controllable": false }, { - "name": "temp_4(fan)" + "name": "temp_4(fan)", + "controllable": false }, { - "name": "sfm1_1(fan)" + "name": "temp_5(fan)", + "controllable": false }, { - "name": "sfm1_2" + "name": "sfm1_1(fan)", + "controllable": false }, { - "name": "sfm1_3" + "name": "sfm1_2", + "controllable": false }, { - "name": "sfm1_4" + "name": "sfm1_3", + "controllable": false }, { - "name": "sfm1_5" + "name": "sfm1_4(fan)", + "controllable": false }, { - "name": "sfm2_1(fan)" + "name": "sfm1_5(fan)", + "controllable": false }, { - "name": "sfm2_2" + "name": "sfm2_1(fan)", + "controllable": false }, { - "name": "sfm2_3" + "name": "sfm2_2", + "controllable": false }, { - "name": "sfm2_4" + "name": "sfm2_3", + "controllable": false }, { - "name": "sfm2_5" + "name": "sfm2_4(fan)", + "controllable": false }, { - "name": "sfm3_1(fan)" + "name": "sfm2_5(fan)", + "controllable": false }, { - "name": "sfm3_2" + "name": "sfm3_1(fan)", + "controllable": false }, { - "name": "sfm3_3" + "name": "sfm3_2", + "controllable": false }, { - "name": "sfm3_4" + "name": "sfm3_3", + "controllable": false }, { - "name": "sfm3_5" + "name": "sfm3_4(fan)", + "controllable": false }, { - "name": "sfm4_1(fan)" + "name": "sfm3_5(fan)", + "controllable": false }, { - "name": "sfm4_2" + "name": "sfm4_1(fan)", + "controllable": false }, { - "name": "sfm4_3" + "name": "sfm4_2", + "controllable": false }, { - "name": "sfm4_4" + "name": "sfm4_3", + "controllable": false }, { - "name": "sfm4_5" + "name": "sfm4_4(fan)", + "controllable": false }, { - "name": "sfm5_1(fan)" + "name": "sfm4_5(fan)", + "controllable": false }, { - "name": "sfm5_2" + "name": "sfm5_1(fan)", + "controllable": false }, { - "name": "sfm5_3" + "name": "sfm5_2", + "controllable": false }, { - "name": "sfm5_4" + "name": "sfm5_3", + "controllable": false }, { - "name": "sfm5_5" + "name": "sfm5_4(fan)", + "controllable": false }, { - "name": "sfm6_1(fan)" + "name": "sfm5_5(fan)", + "controllable": false }, { - "name": "sfm6_2" + "name": "sfm6_1(fan)", + "controllable": false }, { - "name": "sfm6_3" + "name": "sfm6_2", + "controllable": false }, { - "name": "sfm6_4" + "name": "sfm6_3", + "controllable": false }, { - "name": "sfm6_5" + "name": "sfm6_4(fan)", + "controllable": false }, { - "name": "sfm7_1(fan)" + "name": "sfm6_5(fan)", + "controllable": false }, { - "name": "sfm7_2" + "name": "sfm7_1(fan)", + "controllable": false }, { - "name": "sfm7_3" + "name": "sfm7_2", + "controllable": false }, { - "name": "sfm7_4" + "name": "sfm7_3", + "controllable": false }, { - "name": "sfm7_5" + "name": "sfm7_4(fan)", + "controllable": false }, { - "name": "sfm8_1(fan)" + "name": "sfm7_5(fan)", + "controllable": false }, { - "name": "sfm8_2" + "name": "sfm8_1(fan)", + "controllable": false }, { - "name": "sfm8_3" + "name": "sfm8_2", + "controllable": false + }, + { + "name": "sfm8_3", + "controllable": false }, { - "name": "sfm8_4" + "name": "sfm8_4(fan)", + "controllable": false }, { - "name": "sfm8_5" + "name": "sfm8_5(fan)", + "controllable": false } ], "sfps": [ diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/chassisdb.conf b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/chassisdb.conf index 26fefcd1827f..a2daf40b9fef 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/chassisdb.conf +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/chassisdb.conf @@ -1,4 +1,5 @@ start_chassis_db=1 -chassis_db_address=10.0.5.16 +chassis_db_address=10.6.0.100 lag_id_start=1 lag_id_end=512 +midplane_subnet=10.6.0.0/16 diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/pcie.yaml b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/pcie.yaml index 7d587abbdab8..593c20beee61 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/pcie.yaml +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/pcie.yaml @@ -91,7 +91,7 @@ - bus: '00' dev: '14' fn: '3' - id: 790e' + id: '790e' name: 'ISA bridge: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge (rev 51)' - bus: '00' dev: '18' @@ -130,7 +130,7 @@ name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 6' - bus: '00' dev: '18' - fn: '7 ' + fn: '7' id: '1467' name: 'Host bridge: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 7' - bus: '01' @@ -153,57 +153,57 @@ fn: '1' id: '8454' name: 'Ethernet controller: Broadcom Limited Device 8454 (rev 01)' -- bus: '08' +- bus: '09' dev: '00' fn: '0' id: '145a' name: 'Non-Essential Instrumentation [1300]: Advanced Micro Devices, Inc. [AMD] Zeppelin/Raven/Raven2 PCIe Dummy Function' -- bus: '08' +- bus: '09' dev: '00' fn: '2' id: '1456' name: 'Encryption controller: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Platform Security Processor' -- bus: '08' +- bus: '09' dev: '00' fn: '3' id: '145f' name: 'USB controller: Advanced Micro Devices, Inc. [AMD] Zeppelin USB 3.0 Host controller' -- bus: '09' +- bus: '0a' dev: '00' fn: '0' id: '1455' name: 'Non-Essential Instrumentation [1300]: Advanced Micro Devices, Inc. [AMD] Zeppelin/Renoir PCIe Dummy Function' -- bus: '09' +- bus: '0a' dev: '00' fn: '1' id: '1468' name: 'Encryption controller: Advanced Micro Devices, Inc. [AMD] Zeppelin Cryptographic Coprocessor NTBCCP' -- bus: '09' +- bus: '0a' dev: '00' - fn: '2' + fn: '2' id: '7901' name: 'SATA controller: Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode] (rev 51)' -- bus: '09' +- bus: '0a' dev: '00' fn: '3' id: '1457' name: 'Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) HD Audio Controller' -- bus: '09' +- bus: '0a' dev: '00' fn: '4' id: '1458' name: 'Ethernet controller: Advanced Micro Devices, Inc. [AMD] Device 1458' -- bus: '09' +- bus: '0a' dev: '00' fn: '5' id: '1458' name: 'Ethernet controller: Advanced Micro Devices, Inc. [AMD] Device 1458' -- bus: '09' +- bus: '0a' dev: '00' fn: '6' id: '1459' name: 'Ethernet controller: Advanced Micro Devices, Inc. [AMD] Device 1459' -- bus: '09' +- bus: '0a' dev: '00' fn: '7' id: '1459' diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/platform_asic b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/platform_asic new file mode 100644 index 000000000000..9ba24ca3e753 --- /dev/null +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/platform_asic @@ -0,0 +1 @@ +broadcom-dnx diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/platform_ndk.json b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/platform_ndk.json index db906ccff28a..10a09a91e0e5 100644 --- a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/platform_ndk.json +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/platform_ndk.json @@ -2,7 +2,7 @@ "options": [ { "key": "midplane_subnet", - "stringval": "10.0.5.0" + "stringval": "10.6.0.0/16" }, { "key": "midplane_monitor", diff --git a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/platform_reboot b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/platform_reboot index 65cba5185eb1..c5ff45d1848e 100755 --- a/device/nokia/x86_64-nokia_ixr7250e_sup-r0/platform_reboot +++ b/device/nokia/x86_64-nokia_ixr7250e_sup-r0/platform_reboot @@ -5,5 +5,8 @@ sleep 2 echo "w" > /dev/watchdog kick_date=`date -u` echo "last watchdog kick $kick_date" > /var/log/nokia-watchdog-last.log +rm -f /sys/firmware/efi/efivars/dump-* sync +echo "Rebooting all Linecards" +python3 -c 'import sonic_platform.platform; platform_chassis = sonic_platform.platform.Platform().get_chassis(); platform_chassis.reboot_imms()' /sbin/reboot diff --git a/device/pegatron/x86_64-pegatron_porsche-r0/platform_asic b/device/pegatron/x86_64-pegatron_porsche-r0/platform_asic new file mode 100644 index 000000000000..4211b60b9cea --- /dev/null +++ b/device/pegatron/x86_64-pegatron_porsche-r0/platform_asic @@ -0,0 +1 @@ +nephos diff --git a/device/quanta/x86_64-quanta_ix1b_32x-r0/platform_asic b/device/quanta/x86_64-quanta_ix1b_32x-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix1b_32x-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/quanta/x86_64-quanta_ix1b_rglbmc-r0/platform_asic b/device/quanta/x86_64-quanta_ix1b_rglbmc-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix1b_rglbmc-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/quanta/x86_64-quanta_ix7_bwde-r0/platform_asic b/device/quanta/x86_64-quanta_ix7_bwde-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix7_bwde-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/quanta/x86_64-quanta_ix7_rglbmc-r0/Quanta-IX7-32X/td3-ix7-32x100G.config.bcm b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/Quanta-IX7-32X/td3-ix7-32x100G.config.bcm index 43ccba2a4956..d3ac8bbf1f23 100644 --- a/device/quanta/x86_64-quanta_ix7_rglbmc-r0/Quanta-IX7-32X/td3-ix7-32x100G.config.bcm +++ b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/Quanta-IX7-32X/td3-ix7-32x100G.config.bcm @@ -1,4 +1,4 @@ -sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_issu/b870.6.4.1/ +sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ #polarity/lanemap is using TH2 style. core_clock_frequency=1525 dpp_clock_ratio=2:3 diff --git a/device/quanta/x86_64-quanta_ix7_rglbmc-r0/platform_asic b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/quanta/x86_64-quanta_ix8_rglbmc-r0/Quanta-IX8-56X/td3-ix8-48x25G+8x100G.config.bcm b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/Quanta-IX8-56X/td3-ix8-48x25G+8x100G.config.bcm index 06ff6dc80037..25eaf07dc82a 100644 --- a/device/quanta/x86_64-quanta_ix8_rglbmc-r0/Quanta-IX8-56X/td3-ix8-48x25G+8x100G.config.bcm +++ b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/Quanta-IX8-56X/td3-ix8-48x25G+8x100G.config.bcm @@ -1,4 +1,4 @@ -sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_issu/b870.6.4.1/ +sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ core_clock_frequency=1525 dpp_clock_ratio=2:3 mem_cache_enable=0 diff --git a/device/quanta/x86_64-quanta_ix8_rglbmc-r0/platform_asic b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/quanta/x86_64-quanta_ix8a_bwde-r0/platform_asic b/device/quanta/x86_64-quanta_ix8a_bwde-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix8a_bwde-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/quanta/x86_64-quanta_ix8c_bwde-r0/Quanta-IX8C-56X/td3-ix8c-48x25G+8x100G.config.bcm b/device/quanta/x86_64-quanta_ix8c_bwde-r0/Quanta-IX8C-56X/td3-ix8c-48x25G+8x100G.config.bcm index bf2248fbe443..aa8c6d02c57d 100644 --- a/device/quanta/x86_64-quanta_ix8c_bwde-r0/Quanta-IX8C-56X/td3-ix8c-48x25G+8x100G.config.bcm +++ b/device/quanta/x86_64-quanta_ix8c_bwde-r0/Quanta-IX8C-56X/td3-ix8c-48x25G+8x100G.config.bcm @@ -1,4 +1,4 @@ -sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_issu/b870.6.4.1/ +sai_load_hw_config=/etc/bcm/flex/bcm56870_a0_premium_issu/b870.6.4.1/ bcm_tunnel_term_compatible_mode=1 core_clock_frequency=1525 dpp_clock_ratio=2:3 diff --git a/device/quanta/x86_64-quanta_ix8c_bwde-r0/platform_asic b/device/quanta/x86_64-quanta_ix8c_bwde-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix8c_bwde-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/quanta/x86_64-quanta_ix9_bwde-r0/platform_asic b/device/quanta/x86_64-quanta_ix9_bwde-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix9_bwde-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/RA-B6510-32C/port_config.ini b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/RA-B6510-32C/port_config.ini new file mode 100644 index 000000000000..0c6ea53b4cc8 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/RA-B6510-32C/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias index speed +Ethernet1 5,6,7,8 hundredGigE0/1 0 100000 +Ethernet2 1,2,3,4 hundredGigE0/2 1 100000 +Ethernet3 13,14,15,16 hundredGigE0/3 2 100000 +Ethernet4 9,10,11,12 hundredGigE0/4 3 100000 +Ethernet5 21,22,23,24 hundredGigE0/5 4 100000 +Ethernet6 17,18,19,20 hundredGigE0/6 5 100000 +Ethernet7 29,30,31,32 hundredGigE0/7 6 100000 +Ethernet8 25,26,27,28 hundredGigE0/8 7 100000 +Ethernet9 37,38,39,40 hundredGigE0/9 8 100000 +Ethernet10 33,34,35,36 hundredGigE0/10 9 100000 +Ethernet11 45,46,47,48 hundredGigE0/11 10 100000 +Ethernet12 41,42,43,44 hundredGigE0/12 11 100000 +Ethernet13 53,54,55,56 hundredGigE0/13 12 100000 +Ethernet14 49,50,51,52 hundredGigE0/14 13 100000 +Ethernet15 61,62,63,64 hundredGigE0/15 14 100000 +Ethernet16 57,58,59,60 hundredGigE0/16 15 100000 +Ethernet17 69,70,71,72 hundredGigE0/17 16 100000 +Ethernet18 65,66,67,68 hundredGigE0/18 17 100000 +Ethernet19 77,78,79,80 hundredGigE0/19 18 100000 +Ethernet20 73,74,75,76 hundredGigE0/20 19 100000 +Ethernet21 85,86,87,88 hundredGigE0/21 20 100000 +Ethernet22 81,82,83,84 hundredGigE0/22 21 100000 +Ethernet23 93,94,95,96 hundredGigE0/23 22 100000 +Ethernet24 89,90,91,92 hundredGigE0/24 23 100000 +Ethernet25 101,102,103,104 hundredGigE0/25 24 100000 +Ethernet26 97,98,99,100 hundredGigE0/26 25 100000 +Ethernet27 109,110,111,112 hundredGigE0/27 26 100000 +Ethernet28 105,106,107,108 hundredGigE0/28 27 100000 +Ethernet29 117,118,119,120 hundredGigE0/29 28 100000 +Ethernet30 113,114,115,116 hundredGigE0/30 29 100000 +Ethernet31 125,126,127,128 hundredGigE0/31 30 100000 +Ethernet32 121,122,123,124 hundredGigE0/32 31 100000 diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/RA-B6510-32C/sai.profile b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/RA-B6510-32C/sai.profile new file mode 100644 index 000000000000..af208b17b77b --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/RA-B6510-32C/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td3-ra-b6510-32c-32x100G.config.bcm diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/RA-B6510-32C/td3-ra-b6510-32c-32x100G.config.bcm b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/RA-B6510-32C/td3-ra-b6510-32c-32x100G.config.bcm new file mode 100644 index 000000000000..30780ab6ec71 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/RA-B6510-32C/td3-ra-b6510-32c-32x100G.config.bcm @@ -0,0 +1,453 @@ +cancun_dir=/usr/share/sonic/platform/cancun/sdk_6.5.16/ +l2_mem_entries=32768 +l3_mem_entries=16384 +l3_alpm_enable=2 +ipv6_lpm_128b_enable=0x1 +l2xmsg_mode=0 +l3_max_ecmp_mode=1 +bcm_num_cos=8 +bcm_stat_interval=2000000 +cdma_timeout_usec=3000000 +core_clock_frequency=1525 +dpp_clock_ratio=2:3 +help_cli_enable=1 +ifp_inports_support_enable=1 +#lpm_scaling_enable=1 +max_vp_lags=0 +mem_cache_enable=0 +memlist_enable=1 +miim_intr_enable=0 +module_64ports=1 +oversubscribe_mode=1 +parity_enable=0 +#pbmp_gport_stack.0=0x0000000000000000000000000000000000000000000000000000000000000000 +#pbmp_xport_xe.0=0x00000000000000000000000000000000888ffffffffffff9fffffffffffffffe +pbmp_xport_xe=0xffffffffffffffffffffffffffffffffffffffffe +phy_chain_rx_lane_map_physical{5.0}=0x0123 +phy_chain_rx_lane_map_physical{1.0}=0x0132 +phy_chain_rx_lane_map_physical{13.0}=0x0123 +phy_chain_rx_lane_map_physical{9.0}=0x0132 +phy_chain_rx_lane_map_physical{21.0}=0x0123 +phy_chain_rx_lane_map_physical{17.0}=0x0132 +phy_chain_rx_lane_map_physical{29.0}=0x0123 +phy_chain_rx_lane_map_physical{25.0}=0x0132 +phy_chain_rx_lane_map_physical{37.0}=0x0123 +phy_chain_rx_lane_map_physical{33.0}=0x0132 +phy_chain_rx_lane_map_physical{45.0}=0x0123 +phy_chain_rx_lane_map_physical{41.0}=0x0132 +phy_chain_rx_lane_map_physical{53.0}=0x0123 +phy_chain_rx_lane_map_physical{49.0}=0x0132 +phy_chain_rx_lane_map_physical{61.0}=0x0123 +phy_chain_rx_lane_map_physical{57.0}=0x0132 +phy_chain_rx_lane_map_physical{69.0}=0x2301 +phy_chain_rx_lane_map_physical{65.0}=0x2310 +phy_chain_rx_lane_map_physical{77.0}=0x2301 +phy_chain_rx_lane_map_physical{73.0}=0x2310 +phy_chain_rx_lane_map_physical{85.0}=0x2301 +phy_chain_rx_lane_map_physical{81.0}=0x2310 +phy_chain_rx_lane_map_physical{93.0}=0x2301 +phy_chain_rx_lane_map_physical{89.0}=0x2310 +phy_chain_rx_lane_map_physical{101.0}=0x2301 +phy_chain_rx_lane_map_physical{97.0}=0x2310 +phy_chain_rx_lane_map_physical{109.0}=0x2301 +phy_chain_rx_lane_map_physical{105.0}=0x2310 +phy_chain_rx_lane_map_physical{117.0}=0x2301 +phy_chain_rx_lane_map_physical{113.0}=0x2310 +phy_chain_rx_lane_map_physical{125.0}=0x2301 +phy_chain_rx_lane_map_physical{121.0}=0x2310 + +phy_chain_tx_lane_map_physical{5.0}=0x0123 +phy_chain_tx_lane_map_physical{1.0}=0x2031 +phy_chain_tx_lane_map_physical{13.0}=0x0123 +phy_chain_tx_lane_map_physical{9.0}=0x2031 +phy_chain_tx_lane_map_physical{21.0}=0x0123 +phy_chain_tx_lane_map_physical{17.0}=0x2031 +phy_chain_tx_lane_map_physical{29.0}=0x0123 +phy_chain_tx_lane_map_physical{25.0}=0x2031 +phy_chain_tx_lane_map_physical{37.0}=0x0123 +phy_chain_tx_lane_map_physical{33.0}=0x2031 +phy_chain_tx_lane_map_physical{45.0}=0x0123 +phy_chain_tx_lane_map_physical{41.0}=0x2031 +phy_chain_tx_lane_map_physical{53.0}=0x0123 +phy_chain_tx_lane_map_physical{49.0}=0x2031 +phy_chain_tx_lane_map_physical{61.0}=0x0123 +phy_chain_tx_lane_map_physical{57.0}=0x2031 +phy_chain_tx_lane_map_physical{69.0}=0x2301 +phy_chain_tx_lane_map_physical{65.0}=0x0213 +phy_chain_tx_lane_map_physical{77.0}=0x2301 +phy_chain_tx_lane_map_physical{73.0}=0x0213 +phy_chain_tx_lane_map_physical{85.0}=0x2301 +phy_chain_tx_lane_map_physical{81.0}=0x0213 +phy_chain_tx_lane_map_physical{93.0}=0x2301 +phy_chain_tx_lane_map_physical{89.0}=0x0213 +phy_chain_tx_lane_map_physical{101.0}=0x2301 +phy_chain_tx_lane_map_physical{97.0}=0x0213 +phy_chain_tx_lane_map_physical{109.0}=0x2301 +phy_chain_tx_lane_map_physical{105.0}=0x0213 +phy_chain_tx_lane_map_physical{117.0}=0x2301 +phy_chain_tx_lane_map_physical{113.0}=0x0213 +phy_chain_tx_lane_map_physical{125.0}=0x2301 +phy_chain_tx_lane_map_physical{121.0}=0x0213 + +phy_chain_rx_polarity_flip_physical{5.0}=0x0 +phy_chain_rx_polarity_flip_physical{6.0}=0x1 +phy_chain_rx_polarity_flip_physical{7.0}=0x1 +phy_chain_rx_polarity_flip_physical{8.0}=0x1 +phy_chain_rx_polarity_flip_physical{1.0}=0x0 +phy_chain_rx_polarity_flip_physical{2.0}=0x0 +phy_chain_rx_polarity_flip_physical{3.0}=0x1 +phy_chain_rx_polarity_flip_physical{4.0}=0x1 +phy_chain_rx_polarity_flip_physical{13.0}=0x0 +phy_chain_rx_polarity_flip_physical{14.0}=0x1 +phy_chain_rx_polarity_flip_physical{15.0}=0x1 +phy_chain_rx_polarity_flip_physical{16.0}=0x1 +phy_chain_rx_polarity_flip_physical{9.0}=0x0 +phy_chain_rx_polarity_flip_physical{10.0}=0x0 +phy_chain_rx_polarity_flip_physical{11.0}=0x1 +phy_chain_rx_polarity_flip_physical{12.0}=0x1 +phy_chain_rx_polarity_flip_physical{21.0}=0x0 +phy_chain_rx_polarity_flip_physical{22.0}=0x1 +phy_chain_rx_polarity_flip_physical{23.0}=0x1 +phy_chain_rx_polarity_flip_physical{24.0}=0x1 +phy_chain_rx_polarity_flip_physical{17.0}=0x0 +phy_chain_rx_polarity_flip_physical{18.0}=0x0 +phy_chain_rx_polarity_flip_physical{19.0}=0x1 +phy_chain_rx_polarity_flip_physical{20.0}=0x1 +phy_chain_rx_polarity_flip_physical{29.0}=0x1 +phy_chain_rx_polarity_flip_physical{30.0}=0x0 +phy_chain_rx_polarity_flip_physical{31.0}=0x0 +phy_chain_rx_polarity_flip_physical{32.0}=0x0 +phy_chain_rx_polarity_flip_physical{25.0}=0x1 +phy_chain_rx_polarity_flip_physical{26.0}=0x0 +phy_chain_rx_polarity_flip_physical{27.0}=0x0 +phy_chain_rx_polarity_flip_physical{28.0}=0x0 +phy_chain_rx_polarity_flip_physical{37.0}=0x1 +phy_chain_rx_polarity_flip_physical{38.0}=0x0 +phy_chain_rx_polarity_flip_physical{39.0}=0x0 +phy_chain_rx_polarity_flip_physical{40.0}=0x0 +phy_chain_rx_polarity_flip_physical{33.0}=0x1 +phy_chain_rx_polarity_flip_physical{34.0}=0x1 +phy_chain_rx_polarity_flip_physical{35.0}=0x0 +phy_chain_rx_polarity_flip_physical{36.0}=0x0 +phy_chain_rx_polarity_flip_physical{45.0}=0x1 +phy_chain_rx_polarity_flip_physical{46.0}=0x0 +phy_chain_rx_polarity_flip_physical{47.0}=0x0 +phy_chain_rx_polarity_flip_physical{48.0}=0x0 +phy_chain_rx_polarity_flip_physical{41.0}=0x1 +phy_chain_rx_polarity_flip_physical{42.0}=0x1 +phy_chain_rx_polarity_flip_physical{43.0}=0x0 +phy_chain_rx_polarity_flip_physical{44.0}=0x0 +phy_chain_rx_polarity_flip_physical{53.0}=0x1 +phy_chain_rx_polarity_flip_physical{54.0}=0x0 +phy_chain_rx_polarity_flip_physical{55.0}=0x0 +phy_chain_rx_polarity_flip_physical{56.0}=0x0 +phy_chain_rx_polarity_flip_physical{49.0}=0x1 +phy_chain_rx_polarity_flip_physical{50.0}=0x1 +phy_chain_rx_polarity_flip_physical{51.0}=0x0 +phy_chain_rx_polarity_flip_physical{52.0}=0x0 +phy_chain_rx_polarity_flip_physical{61.0}=0x1 +phy_chain_rx_polarity_flip_physical{62.0}=0x1 +phy_chain_rx_polarity_flip_physical{63.0}=0x0 +phy_chain_rx_polarity_flip_physical{64.0}=0x1 +phy_chain_rx_polarity_flip_physical{57.0}=0x1 +phy_chain_rx_polarity_flip_physical{58.0}=0x1 +phy_chain_rx_polarity_flip_physical{59.0}=0x0 +phy_chain_rx_polarity_flip_physical{60.0}=0x0 +phy_chain_rx_polarity_flip_physical{69.0}=0x1 +phy_chain_rx_polarity_flip_physical{70.0}=0x0 +phy_chain_rx_polarity_flip_physical{71.0}=0x0 +phy_chain_rx_polarity_flip_physical{72.0}=0x0 +phy_chain_rx_polarity_flip_physical{65.0}=0x1 +phy_chain_rx_polarity_flip_physical{66.0}=0x0 +phy_chain_rx_polarity_flip_physical{67.0}=0x0 +phy_chain_rx_polarity_flip_physical{68.0}=0x0 +phy_chain_rx_polarity_flip_physical{77.0}=0x1 +phy_chain_rx_polarity_flip_physical{78.0}=0x0 +phy_chain_rx_polarity_flip_physical{79.0}=0x0 +phy_chain_rx_polarity_flip_physical{80.0}=0x0 +phy_chain_rx_polarity_flip_physical{73.0}=0x1 +phy_chain_rx_polarity_flip_physical{74.0}=0x0 +phy_chain_rx_polarity_flip_physical{75.0}=0x0 +phy_chain_rx_polarity_flip_physical{76.0}=0x0 +phy_chain_rx_polarity_flip_physical{85.0}=0x1 +phy_chain_rx_polarity_flip_physical{86.0}=0x0 +phy_chain_rx_polarity_flip_physical{87.0}=0x0 +phy_chain_rx_polarity_flip_physical{88.0}=0x0 +phy_chain_rx_polarity_flip_physical{81.0}=0x1 +phy_chain_rx_polarity_flip_physical{82.0}=0x0 +phy_chain_rx_polarity_flip_physical{83.0}=0x0 +phy_chain_rx_polarity_flip_physical{84.0}=0x0 +phy_chain_rx_polarity_flip_physical{93.0}=0x1 +phy_chain_rx_polarity_flip_physical{94.0}=0x0 +phy_chain_rx_polarity_flip_physical{95.0}=0x0 +phy_chain_rx_polarity_flip_physical{96.0}=0x0 +phy_chain_rx_polarity_flip_physical{89.0}=0x1 +phy_chain_rx_polarity_flip_physical{90.0}=0x0 +phy_chain_rx_polarity_flip_physical{91.0}=0x0 +phy_chain_rx_polarity_flip_physical{92.0}=0x0 +phy_chain_rx_polarity_flip_physical{101.0}=0x1 +phy_chain_rx_polarity_flip_physical{102.0}=0x0 +phy_chain_rx_polarity_flip_physical{103.0}=0x0 +phy_chain_rx_polarity_flip_physical{104.0}=0x0 +phy_chain_rx_polarity_flip_physical{97.0}=0x1 +phy_chain_rx_polarity_flip_physical{98.0}=0x0 +phy_chain_rx_polarity_flip_physical{99.0}=0x0 +phy_chain_rx_polarity_flip_physical{100.0}=0x0 +phy_chain_rx_polarity_flip_physical{109.0}=0x0 +phy_chain_rx_polarity_flip_physical{110.0}=0x1 +phy_chain_rx_polarity_flip_physical{111.0}=0x1 +phy_chain_rx_polarity_flip_physical{112.0}=0x1 +phy_chain_rx_polarity_flip_physical{105.0}=0x0 +phy_chain_rx_polarity_flip_physical{106.0}=0x1 +phy_chain_rx_polarity_flip_physical{107.0}=0x1 +phy_chain_rx_polarity_flip_physical{108.0}=0x1 +phy_chain_rx_polarity_flip_physical{117.0}=0x0 +phy_chain_rx_polarity_flip_physical{118.0}=0x1 +phy_chain_rx_polarity_flip_physical{119.0}=0x1 +phy_chain_rx_polarity_flip_physical{120.0}=0x1 +phy_chain_rx_polarity_flip_physical{113.0}=0x0 +phy_chain_rx_polarity_flip_physical{114.0}=0x1 +phy_chain_rx_polarity_flip_physical{115.0}=0x1 +phy_chain_rx_polarity_flip_physical{116.0}=0x1 +phy_chain_rx_polarity_flip_physical{125.0}=0x0 +phy_chain_rx_polarity_flip_physical{126.0}=0x1 +phy_chain_rx_polarity_flip_physical{127.0}=0x1 +phy_chain_rx_polarity_flip_physical{128.0}=0x1 +phy_chain_rx_polarity_flip_physical{121.0}=0x0 +phy_chain_rx_polarity_flip_physical{122.0}=0x1 +phy_chain_rx_polarity_flip_physical{123.0}=0x1 +phy_chain_rx_polarity_flip_physical{124.0}=0x1 + +phy_chain_tx_polarity_flip_physical{5.0}=0x1 +phy_chain_tx_polarity_flip_physical{6.0}=0x0 +phy_chain_tx_polarity_flip_physical{7.0}=0x1 +phy_chain_tx_polarity_flip_physical{8.0}=0x0 +phy_chain_tx_polarity_flip_physical{1.0}=0x0 +phy_chain_tx_polarity_flip_physical{2.0}=0x1 +phy_chain_tx_polarity_flip_physical{3.0}=0x1 +phy_chain_tx_polarity_flip_physical{4.0}=0x0 +phy_chain_tx_polarity_flip_physical{13.0}=0x1 +phy_chain_tx_polarity_flip_physical{14.0}=0x0 +phy_chain_tx_polarity_flip_physical{15.0}=0x1 +phy_chain_tx_polarity_flip_physical{16.0}=0x0 +phy_chain_tx_polarity_flip_physical{9.0}=0x0 +phy_chain_tx_polarity_flip_physical{10.0}=0x1 +phy_chain_tx_polarity_flip_physical{11.0}=0x1 +phy_chain_tx_polarity_flip_physical{12.0}=0x0 +phy_chain_tx_polarity_flip_physical{21.0}=0x1 +phy_chain_tx_polarity_flip_physical{22.0}=0x0 +phy_chain_tx_polarity_flip_physical{23.0}=0x1 +phy_chain_tx_polarity_flip_physical{24.0}=0x0 +phy_chain_tx_polarity_flip_physical{17.0}=0x0 +phy_chain_tx_polarity_flip_physical{18.0}=0x1 +phy_chain_tx_polarity_flip_physical{19.0}=0x1 +phy_chain_tx_polarity_flip_physical{20.0}=0x0 +phy_chain_tx_polarity_flip_physical{29.0}=0x1 +phy_chain_tx_polarity_flip_physical{30.0}=0x0 +phy_chain_tx_polarity_flip_physical{31.0}=0x1 +phy_chain_tx_polarity_flip_physical{32.0}=0x0 +phy_chain_tx_polarity_flip_physical{25.0}=0x0 +phy_chain_tx_polarity_flip_physical{26.0}=0x1 +phy_chain_tx_polarity_flip_physical{27.0}=0x1 +phy_chain_tx_polarity_flip_physical{28.0}=0x0 +phy_chain_tx_polarity_flip_physical{37.0}=0x1 +phy_chain_tx_polarity_flip_physical{38.0}=0x0 +phy_chain_tx_polarity_flip_physical{39.0}=0x1 +phy_chain_tx_polarity_flip_physical{40.0}=0x0 +phy_chain_tx_polarity_flip_physical{33.0}=0x0 +phy_chain_tx_polarity_flip_physical{34.0}=0x1 +phy_chain_tx_polarity_flip_physical{35.0}=0x1 +phy_chain_tx_polarity_flip_physical{36.0}=0x0 +phy_chain_tx_polarity_flip_physical{45.0}=0x1 +phy_chain_tx_polarity_flip_physical{46.0}=0x0 +phy_chain_tx_polarity_flip_physical{47.0}=0x1 +phy_chain_tx_polarity_flip_physical{48.0}=0x0 +phy_chain_tx_polarity_flip_physical{41.0}=0x0 +phy_chain_tx_polarity_flip_physical{42.0}=0x1 +phy_chain_tx_polarity_flip_physical{43.0}=0x1 +phy_chain_tx_polarity_flip_physical{44.0}=0x1 +phy_chain_tx_polarity_flip_physical{53.0}=0x0 +phy_chain_tx_polarity_flip_physical{54.0}=0x0 +phy_chain_tx_polarity_flip_physical{55.0}=0x1 +phy_chain_tx_polarity_flip_physical{56.0}=0x1 +phy_chain_tx_polarity_flip_physical{49.0}=0x0 +phy_chain_tx_polarity_flip_physical{50.0}=0x1 +phy_chain_tx_polarity_flip_physical{51.0}=0x1 +phy_chain_tx_polarity_flip_physical{52.0}=0x0 +phy_chain_tx_polarity_flip_physical{61.0}=0x1 +phy_chain_tx_polarity_flip_physical{62.0}=0x0 +phy_chain_tx_polarity_flip_physical{63.0}=0x1 +phy_chain_tx_polarity_flip_physical{64.0}=0x1 +phy_chain_tx_polarity_flip_physical{57.0}=0x0 +phy_chain_tx_polarity_flip_physical{58.0}=0x1 +phy_chain_tx_polarity_flip_physical{59.0}=0x1 +phy_chain_tx_polarity_flip_physical{60.0}=0x0 +phy_chain_tx_polarity_flip_physical{69.0}=0x0 +phy_chain_tx_polarity_flip_physical{70.0}=0x1 +phy_chain_tx_polarity_flip_physical{71.0}=0x0 +phy_chain_tx_polarity_flip_physical{72.0}=0x1 +phy_chain_tx_polarity_flip_physical{65.0}=0x1 +phy_chain_tx_polarity_flip_physical{66.0}=0x0 +phy_chain_tx_polarity_flip_physical{67.0}=0x0 +phy_chain_tx_polarity_flip_physical{68.0}=0x1 +phy_chain_tx_polarity_flip_physical{77.0}=0x0 +phy_chain_tx_polarity_flip_physical{78.0}=0x1 +phy_chain_tx_polarity_flip_physical{79.0}=0x0 +phy_chain_tx_polarity_flip_physical{80.0}=0x1 +phy_chain_tx_polarity_flip_physical{73.0}=0x1 +phy_chain_tx_polarity_flip_physical{74.0}=0x0 +phy_chain_tx_polarity_flip_physical{75.0}=0x0 +phy_chain_tx_polarity_flip_physical{76.0}=0x1 +phy_chain_tx_polarity_flip_physical{85.0}=0x0 +phy_chain_tx_polarity_flip_physical{86.0}=0x1 +phy_chain_tx_polarity_flip_physical{87.0}=0x0 +phy_chain_tx_polarity_flip_physical{88.0}=0x1 +phy_chain_tx_polarity_flip_physical{81.0}=0x1 +phy_chain_tx_polarity_flip_physical{82.0}=0x0 +phy_chain_tx_polarity_flip_physical{83.0}=0x0 +phy_chain_tx_polarity_flip_physical{84.0}=0x1 +phy_chain_tx_polarity_flip_physical{93.0}=0x0 +phy_chain_tx_polarity_flip_physical{94.0}=0x1 +phy_chain_tx_polarity_flip_physical{95.0}=0x0 +phy_chain_tx_polarity_flip_physical{96.0}=0x1 +phy_chain_tx_polarity_flip_physical{89.0}=0x1 +phy_chain_tx_polarity_flip_physical{90.0}=0x0 +phy_chain_tx_polarity_flip_physical{91.0}=0x0 +phy_chain_tx_polarity_flip_physical{92.0}=0x1 +phy_chain_tx_polarity_flip_physical{101.0}=0x0 +phy_chain_tx_polarity_flip_physical{102.0}=0x1 +phy_chain_tx_polarity_flip_physical{103.0}=0x0 +phy_chain_tx_polarity_flip_physical{104.0}=0x1 +phy_chain_tx_polarity_flip_physical{97.0}=0x1 +phy_chain_tx_polarity_flip_physical{98.0}=0x0 +phy_chain_tx_polarity_flip_physical{99.0}=0x0 +phy_chain_tx_polarity_flip_physical{100.0}=0x1 +phy_chain_tx_polarity_flip_physical{109.0}=0x0 +phy_chain_tx_polarity_flip_physical{110.0}=0x1 +phy_chain_tx_polarity_flip_physical{111.0}=0x0 +phy_chain_tx_polarity_flip_physical{112.0}=0x1 +phy_chain_tx_polarity_flip_physical{105.0}=0x1 +phy_chain_tx_polarity_flip_physical{106.0}=0x0 +phy_chain_tx_polarity_flip_physical{107.0}=0x0 +phy_chain_tx_polarity_flip_physical{108.0}=0x1 +phy_chain_tx_polarity_flip_physical{117.0}=0x0 +phy_chain_tx_polarity_flip_physical{118.0}=0x1 +phy_chain_tx_polarity_flip_physical{119.0}=0x0 +phy_chain_tx_polarity_flip_physical{120.0}=0x1 +phy_chain_tx_polarity_flip_physical{113.0}=0x1 +phy_chain_tx_polarity_flip_physical{114.0}=0x0 +phy_chain_tx_polarity_flip_physical{115.0}=0x0 +phy_chain_tx_polarity_flip_physical{116.0}=0x1 +phy_chain_tx_polarity_flip_physical{125.0}=0x0 +phy_chain_tx_polarity_flip_physical{126.0}=0x1 +phy_chain_tx_polarity_flip_physical{127.0}=0x0 +phy_chain_tx_polarity_flip_physical{128.0}=0x1 +phy_chain_tx_polarity_flip_physical{121.0}=0x1 +phy_chain_tx_polarity_flip_physical{122.0}=0x0 +phy_chain_tx_polarity_flip_physical{123.0}=0x0 +phy_chain_tx_polarity_flip_physical{124.0}=0x1 +port_flex_enable=1 +portmap_5=5:100 +portmap_1=1:100 +portmap_13=13:100 +portmap_9=9:100 +portmap_21=21:100 +portmap_17=17:100 +portmap_29=29:100 +portmap_25=25:100 +portmap_37=37:100 +portmap_33=33:100 +portmap_45=45:100 +portmap_41=41:100 +portmap_53=53:100 +portmap_49=49:100 +portmap_61=61:100 +portmap_57=57:100 +portmap_71=69:100 +portmap_67=65:100 +portmap_79=77:100 +portmap_75=73:100 +portmap_87=85:100 +portmap_83=81:100 +portmap_95=93:100 +portmap_91=89:100 +portmap_103=101:100 +portmap_99=97:100 +portmap_111=109:100 +portmap_107=105:100 +portmap_119=117:100 +portmap_115=113:100 +portmap_127=125:100 +portmap_123=121:100 + +dport_map_port_5=1 +dport_map_port_1=2 +dport_map_port_13=3 +dport_map_port_9=4 +dport_map_port_21=5 +dport_map_port_17=6 +dport_map_port_29=7 +dport_map_port_25=8 +dport_map_port_37=9 +dport_map_port_33=10 +dport_map_port_45=11 +dport_map_port_41=12 +dport_map_port_53=13 +dport_map_port_49=14 +dport_map_port_61=15 +dport_map_port_57=16 +dport_map_port_71=17 +dport_map_port_67=18 +dport_map_port_79=19 +dport_map_port_75=20 +dport_map_port_87=21 +dport_map_port_83=22 +dport_map_port_95=23 +dport_map_port_91=24 +dport_map_port_103=25 +dport_map_port_99=26 +dport_map_port_111=27 +dport_map_port_107=28 +dport_map_port_119=29 +dport_map_port_115=30 +dport_map_port_127=31 +dport_map_port_123=32 + +serdes_if_type_5=14 +serdes_if_type_1=14 +serdes_if_type_13=14 +serdes_if_type_9=14 +serdes_if_type_21=14 +serdes_if_type_17=14 +serdes_if_type_29=14 +serdes_if_type_25=14 +serdes_if_type_37=14 +serdes_if_type_33=14 +serdes_if_type_45=14 +serdes_if_type_41=14 +serdes_if_type_53=14 +serdes_if_type_49=14 +serdes_if_type_61=14 +serdes_if_type_57=14 +serdes_if_type_71=14 +serdes_if_type_67=14 +serdes_if_type_79=14 +serdes_if_type_75=14 +serdes_if_type_87=14 +serdes_if_type_83=14 +serdes_if_type_95=14 +serdes_if_type_91=14 +serdes_if_type_103=14 +serdes_if_type_99=14 +serdes_if_type_111=14 +serdes_if_type_107=14 +serdes_if_type_119=14 +serdes_if_type_115=14 +serdes_if_type_127=14 +serdes_if_type_123=14 + +reglist_enable=1 +scache_filename=/tmp/scache +schan_intr_enable=0 +stable_size=0x5500000 +tdma_timeout_usec=3000000 diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/bcm.rc b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/bcm.rc new file mode 100644 index 000000000000..7f69f10d3bda --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/bcm.rc @@ -0,0 +1 @@ +rcload /usr/share/sonic/platform/led_proc_init.soc diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/bcm_pre.rc b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/bcm_pre.rc new file mode 100644 index 000000000000..ff9e51918031 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/bcm_pre.rc @@ -0,0 +1 @@ +m0 load 0 0 /usr/share/sonic/platform/linkscan_led.bin diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.12/bcm56870_a0_cch.pkg b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.12/bcm56870_a0_cch.pkg new file mode 100644 index 000000000000..26c3c437a558 Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.12/bcm56870_a0_cch.pkg differ diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.12/bcm56870_a0_ceh.pkg b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.12/bcm56870_a0_ceh.pkg new file mode 100644 index 000000000000..a429810ef5e6 Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.12/bcm56870_a0_ceh.pkg differ diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.12/bcm56870_a0_cfh.pkg b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.12/bcm56870_a0_cfh.pkg new file mode 100644 index 000000000000..4fc198389bfd Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.12/bcm56870_a0_cfh.pkg differ diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.12/bcm56870_a0_cih.pkg b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.12/bcm56870_a0_cih.pkg new file mode 100644 index 000000000000..4478c1c6905b Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.12/bcm56870_a0_cih.pkg differ diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.12/bcm56870_a0_cmh.pkg b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.12/bcm56870_a0_cmh.pkg new file mode 100644 index 000000000000..3abde95310de Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.12/bcm56870_a0_cmh.pkg differ diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.13/bcm56870_a0_cch.pkg b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.13/bcm56870_a0_cch.pkg new file mode 100644 index 000000000000..f165b122e842 Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.13/bcm56870_a0_cch.pkg differ diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.13/bcm56870_a0_ceh.pkg b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.13/bcm56870_a0_ceh.pkg new file mode 100644 index 000000000000..9f33b76ac51a Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.13/bcm56870_a0_ceh.pkg differ diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.13/bcm56870_a0_cfh.pkg b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.13/bcm56870_a0_cfh.pkg new file mode 100644 index 000000000000..00c3a165f9b1 Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.13/bcm56870_a0_cfh.pkg differ diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.13/bcm56870_a0_cih.pkg b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.13/bcm56870_a0_cih.pkg new file mode 100644 index 000000000000..f1ddf59cc6de Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.13/bcm56870_a0_cih.pkg differ diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.13/bcm56870_a0_cmh.pkg b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.13/bcm56870_a0_cmh.pkg new file mode 100644 index 000000000000..0ad55fd95fed Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.13/bcm56870_a0_cmh.pkg differ diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.14/bcm56870_a0_cch.pkg b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.14/bcm56870_a0_cch.pkg new file mode 100644 index 000000000000..53f595b57e72 Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.14/bcm56870_a0_cch.pkg differ diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.14/bcm56870_a0_ceh.pkg b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.14/bcm56870_a0_ceh.pkg new file mode 100644 index 000000000000..71c48f21a748 Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.14/bcm56870_a0_ceh.pkg differ diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.14/bcm56870_a0_cfh.pkg b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.14/bcm56870_a0_cfh.pkg new file mode 100644 index 000000000000..98d868f76b2d Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.14/bcm56870_a0_cfh.pkg differ diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.14/bcm56870_a0_cih.pkg b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.14/bcm56870_a0_cih.pkg new file mode 100644 index 000000000000..73a0be0e8e3f Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.14/bcm56870_a0_cih.pkg differ diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.14/bcm56870_a0_cmh.pkg b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.14/bcm56870_a0_cmh.pkg new file mode 100644 index 000000000000..b728bfd5a7ab Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.14/bcm56870_a0_cmh.pkg differ diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.16/bcm56870_a0_cch.pkg b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.16/bcm56870_a0_cch.pkg new file mode 100644 index 000000000000..a921132b979a Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.16/bcm56870_a0_cch.pkg differ diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.16/bcm56870_a0_ceh.pkg b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.16/bcm56870_a0_ceh.pkg new file mode 100644 index 000000000000..aaa24ebeecd3 Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.16/bcm56870_a0_ceh.pkg differ diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.16/bcm56870_a0_cfh.pkg b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.16/bcm56870_a0_cfh.pkg new file mode 100644 index 000000000000..c4acd218b0a7 Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.16/bcm56870_a0_cfh.pkg differ diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.16/bcm56870_a0_cih.pkg b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.16/bcm56870_a0_cih.pkg new file mode 100644 index 000000000000..a92ae2cf13fd Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.16/bcm56870_a0_cih.pkg differ diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.16/bcm56870_a0_cmh.pkg b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.16/bcm56870_a0_cmh.pkg new file mode 100644 index 000000000000..74e52b26c944 Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/cancun/sdk_6.5.16/bcm56870_a0_cmh.pkg differ diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/custom_led.bin b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/custom_led.bin new file mode 100644 index 000000000000..2800e7b4ee9f Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/custom_led.bin differ diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/default_sku b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/default_sku new file mode 100644 index 000000000000..0a01812d6b65 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/default_sku @@ -0,0 +1 @@ +RA-B6510-32C t1 diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/dev.xml b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/dev.xml new file mode 100644 index 000000000000..7438d26a39c7 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/dev.xml @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/fantlv.py b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/fantlv.py new file mode 100644 index 000000000000..3eeaeb09485d --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/fantlv.py @@ -0,0 +1,217 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +class FantlvException(Exception): + def __init__(self, message='fantlverror', code=-100): + err = 'errcode: {0} message:{1}'.format(code, message) + Exception.__init__(self, err) + self.code = code + self.message = message + +class fan_tlv(object): + HEAD_INFO = "\x01\x7e\x01\xf1" + VERSION = 0x01 + FLAG = 0x7E + HW_VER = 0X01 + TYPE = 0xf1 + TLV_LEN = 00 + _FAN_TLV_HDR_LEN = 6 + _FAN_TLV_CRC_LEN = 2 + + _FAN_TLV_TYPE_NAME = 0x02 + _FAN_TLV_TYPE_SN = 0x03 + _FAN_TLV_TYPE_HW_INFO = 0x05 + _FAN_TLV_TYPE_DEV_TYPE = 0x06 + + _fandecodetime = 0 + + @property + def dstatus(self): + return self._dstatus + + @property + def typename(self): + return self._typename + + @property + def typesn(self): + return self._typesn + + @property + def typehwinfo(self): + return self._typehwinfo + + @property + def typedevtype(self): + return self._typedevtype + + @property + def fanbus(self): + return self._fanbus + + @property + def fanloc(self): + return self._fanloc + + @property + def fandecodetime(self): + return self._fandecodetime + + def __init__(self): + self._typename = "" + self._typesn = "" + self._typehwinfo = "" + self._typedevtype = "" + self._dstatus = 0 + + def strtoarr(self, string): + s = [] + if not isinstance(string, str): + return s + for index in string: + s.append(index) + return s + + def str_to_hex(self,rest_v): + value = 0 + for index in range(len(rest_v)): + value |= ord(rest_v[index]) << ((len(rest_v) - index - 1) * 8) + return value + + def hex_to_str(self,s): + len_t = len(s) + if len_t % 2 != 0: + return 0 + ret = "" + for t in range(0, int(len_t / 2)): + ret += chr(int(s[2 * t:2 * t + 2], 16)) + return ret + + def generate_fan_value(self): + bin_buffer = [chr(0xff)] * 256 + bin_buffer[0] = chr(self.VERSION) + bin_buffer[1] = chr(self.FLAG) + bin_buffer[2] = chr(self.HW_VER) + bin_buffer[3] = chr(self.TYPE) + + temp_t = "%08x" % self.typedevtype + typedevtype_t = self.hex_to_str(temp_t) + total_len = len(self.typename) + len(self.typesn) + \ + len(self.typehwinfo) + len(typedevtype_t) + 8 + + bin_buffer[4] = chr(total_len >> 8) + bin_buffer[5] = chr(total_len & 0x00FF) + + index_start = 6 + bin_buffer[index_start] = chr(self._FAN_TLV_TYPE_NAME) + bin_buffer[index_start + 1] = chr(len(self.typename)) + bin_buffer[index_start + 2: index_start + 2 + + len(self.typename)] = self.strtoarr(self.typename) + index_start = index_start + 2 + len(self.typename) + + bin_buffer[index_start] = chr(self._FAN_TLV_TYPE_SN) + bin_buffer[index_start + 1] = chr(len(self.typesn)) + bin_buffer[index_start + 2:index_start + 2 + + len(self.typesn)] = self.strtoarr(self.typesn) + index_start = index_start + 2 + len(self.typesn) + + bin_buffer[index_start] = chr(self._FAN_TLV_TYPE_HW_INFO) + bin_buffer[index_start + 1] = chr(len(self.typehwinfo)) + bin_buffer[index_start + 2:index_start + 2 + + len(self.typehwinfo)] = self.strtoarr(self.typehwinfo) + index_start = index_start + 2 + len(self.typehwinfo) + + bin_buffer[index_start] = chr(self._FAN_TLV_TYPE_DEV_TYPE) + bin_buffer[index_start + 1] = chr(len(typedevtype_t)) + bin_buffer[index_start + 2:index_start + 2 + + len(typedevtype_t)] = self.strtoarr(typedevtype_t) + index_start = index_start + 2 + len(typedevtype_t) + + crcs = fan_tlv.fancrc(''.join(bin_buffer[0:index_start])) + bin_buffer[index_start] = chr(crcs >> 8) + bin_buffer[index_start + 1] = chr(crcs & 0x00ff) + # printvalue(bin_buffer) + return bin_buffer + + def encode(self): + pass + + def decode(self, e2): + if e2[0:4] != self.HEAD_INFO: + raise FantlvException("Fan tlv head info error,not fan tlv type", -10) + ret = [] + self.VERSION = ord(e2[0]) + self.FLAG = ord(e2[1]) + self.HW_VER = ord(e2[2]) + self.TYPE = ord(e2[3]) + self.TLV_LEN = (ord(e2[4]) << 8) | ord(e2[5]) + + tlv_index = self._FAN_TLV_HDR_LEN + tlv_end = self._FAN_TLV_HDR_LEN + self.TLV_LEN + + if len(e2) < self._FAN_TLV_HDR_LEN + self.TLV_LEN + 2: + raise FantlvException("Fan tlv eeprom len error!", -2) + sumcrc = fan_tlv.fancrc(e2[0:self._FAN_TLV_HDR_LEN + self.TLV_LEN]) + readcrc = ord(e2[self._FAN_TLV_HDR_LEN + self.TLV_LEN] + ) << 8 | ord(e2[self._FAN_TLV_HDR_LEN + self.TLV_LEN + 1]) + if sumcrc != readcrc: + raise FantlvException("Fan tlv eeprom checksum error!", -1) + else: + self._dstatus = 0 + while (tlv_index + 2) < len(e2) and tlv_index < tlv_end: + s = self.decoder( + e2[tlv_index:tlv_index + 2 + ord(e2[tlv_index + 1])]) + tlv_index += ord(e2[tlv_index + 1]) + 2 + ret.append(s) + # sumcrc = fan_tlv.fancrc(e2[0:self._FAN_TLV_HDR_LEN + self.TLV_LEN]) + + return ret + + @staticmethod + def fancrc(t): + sum = 0 + for index in range(len(t)): + sum += ord(t[index]) + return sum + + def decoder(self, t): + try: + name = "" + value = "" + if ord(t[0]) == self._FAN_TLV_TYPE_NAME: + name = "Product Name" + _len = ord(t[1]) + value = t[2:2 + ord(t[1])] + self._typename = value + elif ord(t[0]) == self._FAN_TLV_TYPE_SN: + name = "serial Number" + _len = ord(t[1]) + value = t[2:2 + ord(t[1])] + self._typesn = value + elif ord(t[0]) == self._FAN_TLV_TYPE_HW_INFO: + name = "hardware info" + _len = ord(t[1]) + value = t[2:2 + ord(t[1])] + self._typehwinfo = value + elif ord(t[0]) == self._FAN_TLV_TYPE_DEV_TYPE: + name = "dev type" + _len = ord(t[1]) + value = "0x" + for c in t[2:2 + ord(t[1])]: + value += "%02X" % (ord(c),) + self._typedevtype = int(value,16) + except Exception as e: + print e + return {"name": name, "code": ord(t[0]), "value": value,"lens": _len} + + def __str__(self): + formatstr = "VERSION : 0x%02x \n" \ + " FLAG : 0x%02x \n" \ + " HW_VER : 0x%02x \n" \ + " TYPE : 0x%02x \n" \ + "typename : %s \n" \ + "typesn : %s \n" \ + "typehwinfo : %s \n" + return formatstr % (self.VERSION, self.FLAG, self.HW_VER, self.TYPE, self.typename, self.typesn, self.typehwinfo) + + diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/fru.py b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/fru.py new file mode 100644 index 000000000000..3f1bef50af25 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/fru.py @@ -0,0 +1,950 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +import collections +from bitarray import bitarray +from datetime import datetime, timedelta +import sys + +__DEBUG__ = "N" + + +class FruException(Exception): + def __init__(self, message='fruerror', code=-100): + err = 'errcode: {0} message:{1}'.format(code, message) + Exception.__init__(self, err) + self.code = code + self.message = message + + +def e_print(err): + print("ERROR: " + err) + + +def d_print(debug_info): + if(__DEBUG__ == "Y"): + print(debug_info) + + +class FruUtil(): + @staticmethod + def decodeLength(value): + a = bitarray(8) + a.setall(True) + a[0:1] = 0 + a[1:2] = 0 + x = ord(a.tobytes()) + return x & ord(value) + + @staticmethod + def minToData(): + starttime = datetime(1996, 1, 1, 0, 0, 0) + endtime = datetime.now() + seconds = (endtime - starttime).total_seconds() + mins = seconds / 60 + m = int(round(mins)) + return m + + @staticmethod + def getTimeFormat(): + return datetime.now().strftime('%Y-%m-%d') + + @staticmethod + def getTypeLength(value): + if value is None: + return 0 + a = bitarray(8) + a.setall(False) + a[0:1] = 1 + a[1:2] = 1 + x = ord(a.tobytes()) + return x | len(value) + + @staticmethod + def checksum(b): + result = 0 + for i in range(len(b)): + result += ord(b[i]) + return (0x100 - (result & 0xff)) & 0xff + + +class BaseArea(object): + SUGGESTED_SIZE_COMMON_HEADER = 8 + SUGGESTED_SIZE_INTERNAL_USE_AREA = 72 + SUGGESTED_SIZE_CHASSIS_INFO_AREA = 32 + SUGGESTED_SIZE_BOARD_INFO_AREA = 80 + SUGGESTED_SIZE_PRODUCT_INFO_AREA = 80 + + INITVALUE = b'\x00' + resultvalue = INITVALUE * 256 + COMMON_HEAD_VERSION = b'\x01' + __childList = None + + def __init__(self, name="", size=0, offset=0): + self.__childList = [] + self._offset = offset + self.name = name + self._size = size + self._isPresent = False + self._data = b'\x00' * size + self.__dataoffset = 0 + + @property + def childList(self): + return self.__childList + + @childList.setter + def childList(self, value): + self.__childList = value + + @property + def offset(self): + return self._offset + + @offset.setter + def offset(self, value): + self._offset = value + + @property + def size(self): + return self._size + + @size.setter + def size(self, value): + self._size = value + + @property + def data(self): + return self._data + + @data.setter + def data(self, value): + self._data = value + + @property + def isPresent(self): + return self._isPresent + + @isPresent.setter + def isPresent(self, value): + self._isPresent = value + + +class InternalUseArea(BaseArea): + pass + + +class ChassisInfoArea(BaseArea): + pass + + +class BoardInfoArea(BaseArea): + _boardTime = None + _fields = None + _mfg_date = None + + def __str__(self): + formatstr = "version : %x\n" \ + "length : %d \n" \ + "language : %x \n" \ + "mfg_date : %s \n" \ + "boardManufacturer : %s \n" \ + "boardProductName : %s \n" \ + "boardSerialNumber : %s \n" \ + "boardPartNumber : %s \n" \ + "fruFileId : %s \n" + + tmpstr = formatstr % (ord(self.boardversion), self.size, + self.language, self.getMfgRealData(), + self.boardManufacturer, self.boardProductName, + self.boardSerialNumber, self.boardPartNumber, + self.fruFileId) + for i in range(1, 11): + valtmp = "boardextra%d" % i + if hasattr(self, valtmp): + valtmpval = getattr(self, valtmp) + tmpstr += "boardextra%d : %s \n" % (i, valtmpval) + else: + break + + return tmpstr + + def todict(self): + dic = collections.OrderedDict() + dic["boardversion"] = ord(self.boardversion) + dic["boardlength"] = self.size + dic["boardlanguage"] = self.language + dic["boardmfg_date"] = self.getMfgRealData() + dic["boardManufacturer"] = self.boardManufacturer + dic["boardProductName"] = self.boardProductName + dic["boardSerialNumber"] = self.boardSerialNumber + dic["boardPartNumber"] = self.boardPartNumber + dic["boardfruFileId"] = self.fruFileId + for i in range(1, 11): + valtmp = "boardextra%d" % i + if hasattr(self, valtmp): + valtmpval = getattr(self, valtmp) + dic[valtmp] = valtmpval + else: + break + return dic + + def decodedata(self): + index = 0 + self.areaversion = self.data[index] + index += 1 + d_print("decode length :%d class size:%d" % + ((ord(self.data[index]) * 8), self.size)) + index += 2 + + timetmp = self.data[index: index + 3] + self.mfg_date = ord(timetmp[0]) | ( + ord(timetmp[1]) << 8) | (ord(timetmp[2]) << 16) + d_print("decode getMfgRealData :%s" % self.getMfgRealData()) + index += 3 + + templen = FruUtil.decodeLength(self.data[index]) + self.boardManufacturer = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode boardManufacturer:%s" % self.boardManufacturer) + + templen = FruUtil.decodeLength(self.data[index]) + self.boardProductName = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode boardProductName:%s" % self.boardProductName) + + templen = FruUtil.decodeLength(self.data[index]) + self.boardSerialNumber = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode boardSerialNumber:%s" % self.boardSerialNumber) + + templen = FruUtil.decodeLength(self.data[index]) + self.boardPartNumber = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode boardPartNumber:%s" % self.boardPartNumber) + + templen = FruUtil.decodeLength(self.data[index]) + self.fruFileId = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode fruFileId:%s" % self.fruFileId) + + + for i in range(1, 11): + valtmp = "boardextra%d" % i + if self.data[index] != chr(0xc1): + templen = FruUtil.decodeLength(self.data[index]) + tmpval = self.data[index + 1: index + templen + 1] + setattr(self, valtmp, tmpval) + index += templen + 1 + d_print("decode boardextra%d:%s" % (i, tmpval)) + else: + break + + def recalcute(self): + d_print("boardInfoArea version:%x" % ord(self.boardversion)) + d_print("boardInfoArea length:%d" % self.size) + d_print("boardInfoArea language:%x" % self.language) + self.mfg_date = FruUtil.minToData() + d_print("boardInfoArea mfg_date:%x" % self.mfg_date) + + self.data = chr(ord(self.boardversion)) + \ + chr(self.size / 8) + chr(self.language) + + self.data += chr(self.mfg_date & 0xFF) + self.data += chr((self.mfg_date >> 8) & 0xFF) + self.data += chr((self.mfg_date >> 16) & 0xFF) + + d_print("boardInfoArea boardManufacturer:%s" % self.boardManufacturer) + typelength = FruUtil.getTypeLength(self.boardManufacturer) + self.data += chr(typelength) + self.data += self.boardManufacturer + + d_print("boardInfoArea boardProductName:%s" % self.boardProductName) + self.data += chr(FruUtil.getTypeLength(self.boardProductName)) + self.data += self.boardProductName + + d_print("boardInfoArea boardSerialNumber:%s" % self.boardSerialNumber) + self.data += chr(FruUtil.getTypeLength(self.boardSerialNumber)) + self.data += self.boardSerialNumber + + d_print("boardInfoArea boardPartNumber:%s" % self.boardPartNumber) + self.data += chr(FruUtil.getTypeLength(self.boardPartNumber)) + self.data += self.boardPartNumber + + d_print("boardInfoArea fruFileId:%s" % self.fruFileId) + self.data += chr(FruUtil.getTypeLength(self.fruFileId)) + self.data += self.fruFileId + + for i in range(1, 11): + valtmp = "boardextra%d" % i + if hasattr(self, valtmp): + valtmpval = getattr(self, valtmp) + d_print("boardInfoArea boardextra%d:%s" % (i, valtmpval)) + self.data += chr(FruUtil.getTypeLength(valtmpval)) + if valtmpval is None: + pass + else: + self.data += valtmpval + else: + break + + self.data += chr(0xc1) + + if len(self.data) > (self.size - 1): + incr = (len(self.data) - self.size) / 8 + 1 + self.size += incr * 8 + + self.data = self.data[0:1] + chr(self.size / 8) + self.data[2:] + d_print("self data:%d" % len(self.data)) + d_print("self size:%d" % self.size) + d_print("adjust size:%d" % (self.size - len(self.data) - 1)) + self.data = self.data.ljust((self.size - 1), self.INITVALUE) + + # checksum + checksum = FruUtil.checksum(self.data) + d_print("board info checksum:%x" % checksum) + self.data += chr(checksum) + + def getMfgRealData(self): + starttime = datetime(1996, 1, 1, 0, 0, 0) + mactime = starttime + timedelta(minutes=self.mfg_date) + return mactime + + @property + def language(self): + self._language = 25 + return self._language + + @property + def mfg_date(self): + return self._mfg_date + + @mfg_date.setter + def mfg_date(self, val): + self._mfg_date = val + + @property + def boardversion(self): + self._boardversion = self.COMMON_HEAD_VERSION + return self._boardversion + + @property + def fruFileId(self): + return self._FRUFileID + + @fruFileId.setter + def fruFileId(self, val): + self._FRUFileID = val + + @property + def boardPartNumber(self): + return self._boardPartNumber + + @boardPartNumber.setter + def boardPartNumber(self, val): + self._boardPartNumber = val + + @property + def boardSerialNumber(self): + return self._boardSerialNumber + + @boardSerialNumber.setter + def boardSerialNumber(self, val): + self._boardSerialNumber = val + + @property + def boardProductName(self): + return self._boradProductName + + @boardProductName.setter + def boardProductName(self, val): + self._boradProductName = val + + @property + def boardManufacturer(self): + return self._boardManufacturer + + @boardManufacturer.setter + def boardManufacturer(self, val): + self._boardManufacturer = val + + @property + def boardTime(self): + return self._boardTime + + @boardTime.setter + def boardTime(self, val): + self._boardTime = val + + @property + def fields(self): + return self._fields + + @fields.setter + def fields(self, val): + self._fields = val + + +class ProductInfoArea(BaseArea): + _productManufacturer = None + _productAssetTag = None + _FRUFileID = None + + def __str__(self): + formatstr = "version : %x\n" \ + "length : %d \n" \ + "language : %x \n" \ + "productManufacturer : %s \n" \ + "productName : %s \n" \ + "productPartModelName: %s \n" \ + "productVersion : %s \n" \ + "productSerialNumber : %s \n" \ + "productAssetTag : %s \n" \ + "fruFileId : %s \n" + + tmpstr = formatstr % (ord(self.areaversion), self.size, + self.language, self.productManufacturer, + self.productName, self.productPartModelName, + self.productVersion, self.productSerialNumber, + self.productAssetTag, self.fruFileId) + + for i in range(1, 11): + valtmp = "productextra%d" % i + if hasattr(self, valtmp): + valtmpval = getattr(self, valtmp) + tmpstr += "productextra%d : %s \n" % (i, valtmpval) + else: + break + + return tmpstr + + def todict(self): + dic = collections.OrderedDict() + dic["productversion"] = ord(self.areaversion) + dic["productlength"] = self.size + dic["productlanguage"] = self.language + dic["productManufacturer"] = self.productManufacturer + dic["productName"] = self.productName + dic["productPartModelName"] = self.productPartModelName + dic["productVersion"] = int(self.productVersion, 16) + dic["productSerialNumber"] = self.productSerialNumber + dic["productAssetTag"] = self.productAssetTag + dic["productfruFileId"] = self.fruFileId + for i in range(1, 11): + valtmp = "productextra%d" % i + if hasattr(self, valtmp): + valtmpval = getattr(self, valtmp) + dic[valtmp] = valtmpval + else: + break + return dic + + def decodedata(self): + index = 0 + self.areaversion = self.data[index] # 0 + index += 1 + d_print("decode length %d" % (ord(self.data[index]) * 8)) + d_print("class size %d" % self.size) + index += 2 + + templen = FruUtil.decodeLength(self.data[index]) + self.productManufacturer = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode productManufacturer:%s" % self.productManufacturer) + + templen = FruUtil.decodeLength(self.data[index]) + self.productName = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode productName:%s" % self.productName) + + templen = FruUtil.decodeLength(self.data[index]) + self.productPartModelName = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode productPartModelName:%s" % self.productPartModelName) + + templen = FruUtil.decodeLength(self.data[index]) + self.productVersion = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode productVersion:%s" % self.productVersion) + + templen = FruUtil.decodeLength(self.data[index]) + self.productSerialNumber = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode productSerialNumber:%s" % self.productSerialNumber) + + templen = FruUtil.decodeLength(self.data[index]) + self.productAssetTag = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode productAssetTag:%s" % self.productAssetTag) + + templen = FruUtil.decodeLength(self.data[index]) + self.fruFileId = self.data[index + 1: index + templen + 1] + index += templen + 1 + d_print("decode fruFileId:%s" % self.fruFileId) + + for i in range(1, 11): + valtmp = "productextra%d" % i + if self.data[index] != chr(0xc1) and index < self.size - 1: + templen = FruUtil.decodeLength(self.data[index]) + if templen == 0: + break + tmpval = self.data[index + 1: index + templen + 1] + d_print("decode boardextra%d:%s" % (i, tmpval)) + setattr(self, valtmp, tmpval) + index += templen + 1 + else: + break + + @property + def productVersion(self): + return self._productVersion + + @productVersion.setter + def productVersion(self, name): + self._productVersion = name + + @property + def areaversion(self): + self._areaversion = self.COMMON_HEAD_VERSION + return self._areaversion + + @areaversion.setter + def areaversion(self, name): + self._areaversion = name + + @property + def language(self): + self._language = 25 + return self._language + + @property + def productManufacturer(self): + return self._productManufacturer + + @productManufacturer.setter + def productManufacturer(self, name): + self._productManufacturer = name + + @property + def productName(self): + return self._productName + + @productName.setter + def productName(self, name): + self._productName = name + + @property + def productPartModelName(self): + return self._productPartModelName + + @productPartModelName.setter + def productPartModelName(self, name): + self._productPartModelName = name + + @property + def productSerialNumber(self): + return self._productSerialNumber + + @productSerialNumber.setter + def productSerialNumber(self, name): + self._productSerialNumber = name + + @property + def productAssetTag(self): + return self._productAssetTag + + @productAssetTag.setter + def productAssetTag(self, name): + self._productAssetTag = name + + @property + def fruFileId(self): + return self._FRUFileID + + @fruFileId.setter + def fruFileId(self, name): + self._FRUFileID = name + + def recalcute(self): + d_print("product version:%x" % ord(self.areaversion)) + d_print("product length:%d" % self.size) + d_print("product language:%x" % self.language) + self.data = chr(ord(self.areaversion)) + \ + chr(self.size / 8) + chr(self.language) + + typelength = FruUtil.getTypeLength(self.productManufacturer) + self.data += chr(typelength) + self.data += self.productManufacturer + + self.data += chr(FruUtil.getTypeLength(self.productName)) + self.data += self.productName + + self.data += chr(FruUtil.getTypeLength(self.productPartModelName)) + self.data += self.productPartModelName + + self.data += chr(FruUtil.getTypeLength(self.productVersion)) + self.data += self.productVersion + + self.data += chr(FruUtil.getTypeLength(self.productSerialNumber)) + self.data += self.productSerialNumber + + self.data += chr(FruUtil.getTypeLength(self.productAssetTag)) + if self.productAssetTag is not None: + self.data += self.productAssetTag + + self.data += chr(FruUtil.getTypeLength(self.fruFileId)) + self.data += self.fruFileId + + for i in range(1, 11): + valtmp = "productextra%d" % i + if hasattr(self, valtmp): + valtmpval = getattr(self, valtmp) + d_print("boardInfoArea productextra%d:%s" % (i, valtmpval)) + self.data += chr(FruUtil.getTypeLength(valtmpval)) + if valtmpval is None: + pass + else: + self.data += valtmpval + else: + break + + self.data += chr(0xc1) + if len(self.data) > (self.size - 1): + incr = (len(self.data) - self.size) / 8 + 1 + self.size += incr * 8 + d_print("self.data:%d" % len(self.data)) + d_print("self.size:%d" % self.size) + + self.data = self.data[0:1] + chr(self.size / 8) + self.data[2:] + self.data = self.data.ljust((self.size - 1), self.INITVALUE) + checksum = FruUtil.checksum(self.data) + d_print("board info checksum:%x" % checksum) + self.data += chr(checksum) + + +class MultiRecordArea(BaseArea): + pass + + +class Field(object): + + def __init__(self, fieldType="ASCII", fieldData=""): + self.fieldData = fieldData + self.fieldType = fieldType + + @property + def data(self): + return self._data + + @property + def fieldType(self): + return self._fieldType + + @property + def fieldData(self): + return self._fieldData + + +class ipmifru(BaseArea): + _BoardInfoArea = None + _ProductInfoArea = None + _InternalUseArea = None + _ChassisInfoArea = None + _multiRecordArea = None + _productinfoAreaOffset = BaseArea.INITVALUE + _boardInfoAreaOffset = BaseArea.INITVALUE + _internalUserAreaOffset = BaseArea.INITVALUE + _chassicInfoAreaOffset = BaseArea.INITVALUE + _multiRecordAreaOffset = BaseArea.INITVALUE + _bindata = None + _bodybin = None + _version = BaseArea.COMMON_HEAD_VERSION + _zeroCheckSum = None + + def __str__(self): + tmpstr = "" + if self.boardInfoArea.isPresent: + tmpstr += "\nboardinfoarea: \n" + tmpstr += self.boardInfoArea.__str__() + if self.productInfoArea.isPresent: + tmpstr += "\nproductinfoarea: \n" + tmpstr += self.productInfoArea.__str__() + return tmpstr + + def decodeBin(self, eeprom): + commonHead = eeprom[0:8] + d_print("decode version %x" % ord(commonHead[0])) + if self.COMMON_HEAD_VERSION != commonHead[0]: + raise FruException("HEAD VERSION error,not Fru format!", -10) + if FruUtil.checksum(commonHead[0:7]) != ord(commonHead[7]): + strtemp = "check header checksum error [cal:%02x data:%02x]" % ( + FruUtil.checksum(commonHead[0:7]), ord(commonHead[7])) + raise FruException(strtemp, -3) + if commonHead[1] != self.INITVALUE: + d_print("Internal Use Area is present") + self.internalUseArea = InternalUseArea( + name="Internal Use Area", size=self.SUGGESTED_SIZE_INTERNAL_USE_AREA) + self.internalUseArea.isPresent = True + self.internalUserAreaOffset = ord(commonHead[1]) + self.internalUseArea.data = eeprom[self.internalUserAreaOffset * 8: ( + self.internalUserAreaOffset * 8 + self.internalUseArea.size)] + if commonHead[2] != self.INITVALUE: + d_print("Chassis Info Area is present") + self.chassisInfoArea = ChassisInfoArea( + name="Chassis Info Area", size=self.SUGGESTED_SIZE_CHASSIS_INFO_AREA) + self.chassisInfoArea.isPresent = True + self.chassicInfoAreaOffset = ord(commonHead[2]) + self.chassisInfoArea.data = eeprom[self.chassicInfoAreaOffset * 8: ( + self.chassicInfoAreaOffset * 8 + self.chassisInfoArea.size)] + if commonHead[3] != self.INITVALUE: + self.boardInfoArea = BoardInfoArea( + name="Board Info Area", size=self.SUGGESTED_SIZE_BOARD_INFO_AREA) + self.boardInfoArea.isPresent = True + self.boardInfoAreaOffset = ord(commonHead[3]) + self.boardInfoArea.size = ord( + eeprom[self.boardInfoAreaOffset * 8 + 1]) * 8 + d_print("Board Info Area is present size:%d" % + (self.boardInfoArea.size)) + self.boardInfoArea.data = eeprom[self.boardInfoAreaOffset * 8: ( + self.boardInfoAreaOffset * 8 + self.boardInfoArea.size)] + if FruUtil.checksum(self.boardInfoArea.data[:-1]) != ord(self.boardInfoArea.data[-1:]): + print "check boardInfoArea checksum error[cal:%02x data:%02x]" % \ + (FruUtil.checksum( + self.boardInfoArea.data[:-1]), ord(self.boardInfoArea.data[-1:])) + sys.exit(-1) + self.boardInfoArea.decodedata() + if commonHead[4] != self.INITVALUE: + d_print("Product Info Area is present") + self.productInfoArea = ProductInfoArea( + name="Product Info Area ", size=self.SUGGESTED_SIZE_PRODUCT_INFO_AREA) + self.productInfoArea.isPresent = True + self.productinfoAreaOffset = ord(commonHead[4]) + d_print("length offset value: %02x" % + ord(eeprom[self.productinfoAreaOffset * 8 + 1])) + self.productInfoArea.size = ord( + eeprom[self.productinfoAreaOffset * 8 + 1]) * 8 + d_print("Product Info Area is present size:%d" % + (self.productInfoArea.size)) + + self.productInfoArea.data = eeprom[self.productinfoAreaOffset * 8: ( + self.productinfoAreaOffset * 8 + self.productInfoArea.size)] + if FruUtil.checksum(self.productInfoArea.data[:-1]) != ord(self.productInfoArea.data[-1:]): + strtmp = "check productInfoArea checksum error [cal:%02x data:%02x]" % ( + FruUtil.checksum(self.productInfoArea.data[:-1]), ord(self.productInfoArea.data[-1:])) + raise FruException(strtmp, -3) + self.productInfoArea.decodedata() + if commonHead[5] != self.INITVALUE: + self.multiRecordArea = MultiRecordArea( + name="MultiRecord record Area ") + d_print("MultiRecord record present") + self.multiRecordArea.isPresent = True + self.multiRecordAreaOffset = ord(commonHead[5]) + self.multiRecordArea.data = eeprom[self.multiRecordAreaOffset * 8: ( + self.multiRecordAreaOffset * 8 + self.multiRecordArea.size)] + + def initDefault(self): + self.version = self.COMMON_HEAD_VERSION + self.internalUserAreaOffset = self.INITVALUE + self.chassicInfoAreaOffset = self.INITVALUE + self.boardInfoAreaOffset = self.INITVALUE + self.productinfoAreaOffset = self.INITVALUE + self.multiRecordAreaOffset = self.INITVALUE + self.PAD = self.INITVALUE + self.zeroCheckSum = self.INITVALUE + self.offset = self.SUGGESTED_SIZE_COMMON_HEADER + self.productInfoArea = None + self.internalUseArea = None + self.boardInfoArea = None + self.chassisInfoArea = None + self.multiRecordArea = None + # self.recalcute() + + @property + def version(self): + return self._version + + @version.setter + def version(self, name): + self._version = name + + @property + def internalUserAreaOffset(self): + return self._internalUserAreaOffset + + @internalUserAreaOffset.setter + def internalUserAreaOffset(self, obj): + self._internalUserAreaOffset = obj + + @property + def chassicInfoAreaOffset(self): + return self._chassicInfoAreaOffset + + @chassicInfoAreaOffset.setter + def chassicInfoAreaOffset(self, obj): + self._chassicInfoAreaOffset = obj + + @property + def productinfoAreaOffset(self): + return self._productinfoAreaOffset + + @productinfoAreaOffset.setter + def productinfoAreaOffset(self, obj): + self._productinfoAreaOffset = obj + + @property + def boardInfoAreaOffset(self): + return self._boardInfoAreaOffset + + @boardInfoAreaOffset.setter + def boardInfoAreaOffset(self, obj): + self._boardInfoAreaOffset = obj + + @property + def multiRecordAreaOffset(self): + return self._multiRecordAreaOffset + + @multiRecordAreaOffset.setter + def multiRecordAreaOffset(self, obj): + self._multiRecordAreaOffset = obj + + @property + def zeroCheckSum(self): + return self._zeroCheckSum + + @zeroCheckSum.setter + def zeroCheckSum(self, obj): + self._zeroCheckSum = obj + + @property + def productInfoArea(self): + return self._ProductInfoArea + + @productInfoArea.setter + def productInfoArea(self, obj): + self._ProductInfoArea = obj + + @property + def internalUseArea(self): + return self._InternalUseArea + + @internalUseArea.setter + def internalUseArea(self, obj): + self.internalUseArea = obj + + @property + def boardInfoArea(self): + return self._BoardInfoArea + + @boardInfoArea.setter + def boardInfoArea(self, obj): + self._BoardInfoArea = obj + + @property + def chassisInfoArea(self): + return self._ChassisInfoArea + + @chassisInfoArea.setter + def chassisInfoArea(self, obj): + self._ChassisInfoArea = obj + + @property + def multiRecordArea(self): + return self._multiRecordArea + + @multiRecordArea.setter + def multiRecordArea(self, obj): + self._multiRecordArea = obj + + @property + def bindata(self): + return self._bindata + + @bindata.setter + def bindata(self, obj): + self._bindata = obj + + @property + def bodybin(self): + return self._bodybin + + @bodybin.setter + def bodybin(self, obj): + self._bodybin = obj + + def recalcuteCommonHead(self): + self.bindata = "" + self.offset = self.SUGGESTED_SIZE_COMMON_HEADER + d_print("common Header %d" % self.offset) + if self.internalUseArea is not None and self.internalUseArea.isPresent: + self.internalUserAreaOffset = self.offset / 8 + self.offset += self.internalUseArea.size + d_print("internalUseArea is present offset:%d" % self.offset) + + if self.chassisInfoArea is not None and self.chassisInfoArea.isPresent: + self.chassicInfoAreaOffset = self.offset / 8 + self.offset += self.chassisInfoArea.size + d_print("chassisInfoArea is present offset:%d" % self.offset) + + if self.boardInfoArea is not None and self.boardInfoArea.isPresent: + self.boardInfoAreaOffset = self.offset / 8 + self.offset += self.boardInfoArea.size + d_print("boardInfoArea is present offset:%d" % self.offset) + d_print("boardInfoArea is present size:%d" % + self.boardInfoArea.size) + + if self.productInfoArea is not None and self.productInfoArea.isPresent: + self.productinfoAreaOffset = self.offset / 8 + self.offset += self.productInfoArea.size + d_print("productInfoArea is present offset:%d" % self.offset) + + if self.multiRecordArea is not None and self.multiRecordArea.isPresent: + self.multiRecordAreaOffset = self.offset / 8 + d_print("multiRecordArea is present offset:%d" % self.offset) + + if self.internalUserAreaOffset == self.INITVALUE: + self.internalUserAreaOffset = 0 + if self.productinfoAreaOffset == self.INITVALUE: + self.productinfoAreaOffset = 0 + if self.chassicInfoAreaOffset == self.INITVALUE: + self.chassicInfoAreaOffset = 0 + if self.boardInfoAreaOffset == self.INITVALUE: + self.boardInfoAreaOffset = 0 + if self.multiRecordAreaOffset == self.INITVALUE: + self.multiRecordAreaOffset = 0 + + self.zeroCheckSum = (0x100 - ord(self.version) - self.internalUserAreaOffset - self.chassicInfoAreaOffset - self.productinfoAreaOffset + - self.boardInfoAreaOffset - self.multiRecordAreaOffset) & 0xff + d_print("zerochecksum:%x" % self.zeroCheckSum) + self.data = self.version + chr(self.internalUserAreaOffset) + chr(self.chassicInfoAreaOffset) + chr( + self.boardInfoAreaOffset) + chr(self.productinfoAreaOffset) + chr(self.multiRecordAreaOffset) + self.INITVALUE + chr(self.zeroCheckSum) + + self.bindata = self.data + self.bodybin + totallen = len(self.bindata) + d_print("totallen %d" % totallen) + if (totallen < 256): + self.bindata = self.bindata.ljust(256, self.INITVALUE) + else: + raise FruException('bin data more than 256', -2) + + def recalcutebin(self): + self.bodybin = "" + if self.internalUseArea is not None and self.internalUseArea.isPresent: + d_print("internalUseArea present") + self.bodybin += self.internalUseArea.data + if self.chassisInfoArea is not None and self.chassisInfoArea.isPresent: + d_print("chassisInfoArea present") + self.bodybin += self.chassisInfoArea.data + if self.boardInfoArea is not None and self.boardInfoArea.isPresent: + d_print("boardInfoArea present") + self.boardInfoArea.recalcute() + self.bodybin += self.boardInfoArea.data + if self.productInfoArea is not None and self.productInfoArea.isPresent: + d_print("productInfoAreapresent") + self.productInfoArea.recalcute() + self.bodybin += self.productInfoArea.data + if self.multiRecordArea is not None and self.multiRecordArea.isPresent: + d_print("multiRecordArea present") + self.bodybin += self.productInfoArea.data + + def recalcute(self): + self.recalcutebin() + self.recalcuteCommonHead() diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/installer.conf b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/installer.conf new file mode 100644 index 000000000000..df846113776d --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/installer.conf @@ -0,0 +1,2 @@ +CONSOLE_SPEED=115200 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="intel_pstate=disable intel_idle.max_cstate=0 modprobe.blacklist=fpga_pcie_i2c" diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/led_proc_init.soc b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/led_proc_init.soc new file mode 100644 index 000000000000..da5105b07f18 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/led_proc_init.soc @@ -0,0 +1,7 @@ +m0 load 0 0x3800 /usr/share/sonic/platform/custom_led.bin + +led auto on + +led start + +linkscan spbm=all force=all interval=250000 diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/linkscan_led.bin b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/linkscan_led.bin new file mode 100644 index 000000000000..e86cdc1ef647 Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/linkscan_led.bin differ diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/minigraph.xml b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/minigraph.xml new file mode 100644 index 000000000000..d33d99d6e76f --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/minigraph.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + switch2 + + + + + + + + + + + + + switch2 + RA-B6510-32C + + + + + + + switch2 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + ErspanDestinationIpv4 + + 2.2.2.2 + + + + + + + switch2 + RA-B6510-32C + diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/monitor.py b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/monitor.py new file mode 100644 index 000000000000..ab4d14ec3daa --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/monitor.py @@ -0,0 +1,315 @@ +#!/usr/bin/python +# -*- coding: UTF-8 -*- +# * onboard temperature sensors +# * FAN trays +# * PSU +# +import os +import xml.etree.ElementTree as ET +import glob +from fru import * +from fantlv import * + + + +MAILBOX_DIR = "/sys/bus/i2c/devices/" +CONFIG_NAME = "dev.xml" + +def getPMCreg(location): + retval = 'ERR' + if (not os.path.isfile(location)): + return "%s %s notfound"% (retval , location) + try: + with open(location, 'r') as fd: + retval = fd.read() + except Exception as error: + pass + + retval = retval.rstrip('\r\n') + retval = retval.lstrip(" ") + return retval +# Get a mailbox register +def get_pmc_register(reg_name): + retval = 'ERR' + mb_reg_file = MAILBOX_DIR + reg_name + filepath = glob.glob(mb_reg_file) + if(len(filepath) == 0): + return "%s %s notfound"% (retval , mb_reg_file) + mb_reg_file = filepath[0] + if (not os.path.isfile(mb_reg_file)): + #print mb_reg_file, 'not found !' + return "%s %s notfound"% (retval , mb_reg_file) + try: + with open(mb_reg_file, 'r') as fd: + retval = fd.read() + except Exception as error: + pass + + retval = retval.rstrip('\r\n') + retval = retval.lstrip(" ") + return retval + +class checktype(): + def __init__(self, test1): + self.test1 = test1 + @staticmethod + def check(name,location, bit, value, tips , err1): + psu_status = int(get_pmc_register(location),16) + val = (psu_status & (1<< bit)) >> bit + if (val != value): + err1["errmsg"] = tips + err1["code"] = -1 + return -1 + else: + err1["errmsg"] = "none" + err1["code"] = 0 + return 0 + @staticmethod + def getValue(location, bit , type): + value_t = get_pmc_register(location) + if value_t.startswith("ERR") : + return value_t + if (type == 1): + return float(value_t)/1000 + elif (type == 2): + return float(value_t)/100 + elif (type == 3): + psu_status = int(value_t,16) + return (psu_status & (1<< bit)) >> bit + elif (type == 4): + return int(value_t,10) + elif (type == 5): + return float(value_t)/1000/1000 + else: + return value_t; +#######temp + @staticmethod + def getTemp(self, name, location , ret_t): + ret2 = self.getValue(location + "temp1_input" ," " ,1); + ret3 = self.getValue(location + "temp1_max" ," ", 1); + ret4 = self.getValue(location + "temp1_max_hyst" ," ", 1); + ret_t["temp1_input"] = ret2 + ret_t["temp1_max"] = ret3 + ret_t["temp1_max_hyst"] = ret4 + @staticmethod + def getLM75(name, location, result): + c1=checktype + r1={} + c1.getTemp(c1, name, location, r1) + result[name] = r1 +##########fanFRU + @staticmethod + def decodeBinByValue(retval): + fru = ipmifru() + fru.decodeBin(retval) + return fru + + @staticmethod + def printbinvalue(b): + index = 0 + print " ", + for width in range(16): + print "%02x " % width, + print "" + for i in range(0, len(b)): + if index % 16 == 0: + print " " + print " %02x " % i, + print "%02x " % ord(b[i]), + index += 1 + print "" + + @staticmethod + def getfruValue(val): + try: + binval = checktype.getValue(val, 0 , 0) + if binval.startswith("ERR"): + return binval + fanpro = {} + ret = checktype.decodeBinByValue(binval) + fanpro['fan_type'] = ret.productInfoArea.productName + fanpro['hw_version'] = ret.productInfoArea.productVersion + fanpro['sn'] = ret.productInfoArea.productSerialNumber + fanpro['fanid'] = ret.productInfoArea.productextra2 + return fanpro + except Exception as error: + return "ERR " + str(error) + + @staticmethod + def getslottlvValue(val): + try: + binval = checktype.getValue(val, 0 , 0) + if binval.startswith("ERR"): + return binval + slotpro = {} + slottlv = fan_tlv() + rets = slottlv.decode(binval) + if len(rets) == 0: + raise Exception("decode fan tlv fail") + slotpro['slot_type'] = slottlv.typename + slotpro['hw_version'] = slottlv.typehwinfo + slotpro['sn'] = slottlv.typesn + slotpro['slotid'] = slottlv.typedevtype + return slotpro + except Exception as error: + return "ERR " + str(error) + + @staticmethod + def getslotfruValue(val): + try: + binval = checktype.getValue(val, 0 , 0) + if binval.startswith("ERR"): + return binval + slotpro = {} + ret = checktype.decodeBinByValue(binval) + slotpro['slot_type'] = ret.boardInfoArea.boardProductName + slotpro['hw_version'] = ret.boardInfoArea.boardextra1 + slotpro['sn'] = ret.boardInfoArea.boardSerialNumber + return slotpro + except Exception as error: + return "ERR " + str(error) + + +class status(): + def __init__(self, productname): + self.productname = productname + + @staticmethod + def getETroot(filename): + tree = ET.parse(filename) + root = tree.getroot() + return root; + + @staticmethod + def getDecodValue(collection, decode): + decodes = collection.find('decode') + testdecode = decodes.find(decode) + test={} + for neighbor in testdecode.iter('code'): + test[neighbor.attrib["key"]]=neighbor.attrib["value"] + return test + @staticmethod + def getfileValue(location): + return checktype.getValue(location," "," ") + @staticmethod + def getETValue(a, filename, tagname): + root = status.getETroot(filename) + for neighbor in root.iter(tagname): + prob_t = {} + prob_t = neighbor.attrib + prob_t['errcode']= 0 + prob_t['errmsg'] = '' + for pros in neighbor.iter("property"): + ret = dict(neighbor.attrib.items() + pros.attrib.items()) + if ret.get('e2type') == 'fru' and ret.get("name") == "fru": + fruval = checktype.getfruValue(ret["location"]) + if isinstance(fruval, str) and fruval.startswith("ERR"): + prob_t['errcode']= -1 + prob_t['errmsg']= fruval + else: + prob_t.update(fruval) + if ret.get("name") == "slot" and ret.get('e2type') == 'tlv': + slotval = checktype.getslottlvValue(ret["location"]) + if isinstance(slotval, str) and slotval.startswith("ERR"): + prob_t['errcode']= -1 + prob_t['errmsg']= slotval + else: + prob_t.update(slotval) + if ret.get("name") == "slot" and ret.get('e2type') == 'fru': + slotval = checktype.getslotfruValue(ret["location"]) + if isinstance(slotval, str) and slotval.startswith("ERR"): + prob_t['errcode']= -1 + prob_t['errmsg']= slotval + else: + prob_t.update(slotval) + + if ('type' not in ret.keys()): + val = "0"; + else: + val = ret["type"] + if ('bit' not in ret.keys()): + bit = "0"; + else: + bit = ret["bit"] + s = checktype.getValue(ret["location"], int(bit),int(val)) + if isinstance(s, str) and s.startswith("ERR"): + prob_t['errcode']= -1 + prob_t['errmsg']= s + if ('default' in ret.keys()): + rt = status.getDecodValue(root,ret['decode']) + prob_t['errmsg']= rt[str(s)] + if str(s) != ret["default"]: + prob_t['errcode']= -1 + break; + else: + if ('decode' in ret.keys()): + rt = status.getDecodValue(root,ret['decode']) + if(ret['decode'] == "psutype" and s.replace("\x00","").rstrip() not in rt.keys()): + prob_t['errcode']= -1 + prob_t['errmsg'] = '%s'% ("Not supported PSU type") + else: + s = rt[str(s).replace("\x00","").rstrip()] + name = ret["name"] + prob_t[name]=str(s) + a.append(prob_t) + @staticmethod + def getCPUValue(a, filename, tagname): + root = status.getETroot(filename) + for neighbor in root.iter(tagname): + location = neighbor.attrib["location"] + L=[] + for dirpath, dirnames, filenames in os.walk(location): + for file in filenames : + if file.endswith("input"): + L.append(os.path.join(dirpath, file)) + L =sorted(L,reverse=False) + for i in range(len(L)): + prob_t = {} + prob_t["name"] = getPMCreg("%s/temp%d_label"%(location,i+1)) + prob_t["temp"] = float(getPMCreg("%s/temp%d_input"%(location,i+1)))/1000 + prob_t["alarm"] = float(getPMCreg("%s/temp%d_crit_alarm"%(location,i+1)))/1000 + prob_t["crit"] = float(getPMCreg("%s/temp%d_crit"%(location,i+1)))/1000 + prob_t["max"] = float(getPMCreg("%s/temp%d_max"%(location,i+1)))/1000 + a.append(prob_t) + + @staticmethod + def getFileName(): + return os.path.dirname(os.path.realpath(__file__)) + "/"+ CONFIG_NAME + @staticmethod + def getFan(ret): + _filename = status.getFileName() + _tagname = "fan" + status.getvalue(ret, _filename, _tagname) + @staticmethod + def checkFan(ret): + _filename = status.getFileName() + # _filename = "/usr/local/bin/" + status.getFileName() + _tagname = "fan" + status.getETValue(ret, _filename, _tagname) + @staticmethod + def getTemp(ret): + _filename = status.getFileName() + #_filename = "/usr/local/bin/" + status.getFileName() + _tagname = "temp" + status.getETValue(ret, _filename, _tagname) + @staticmethod + def getPsu(ret): + _filename = status.getFileName() + # _filename = "/usr/local/bin/" + status.getFileName() + _tagname = "psu" + status.getETValue(ret, _filename, _tagname) + + @staticmethod + def getcputemp(ret): + _filename = status.getFileName() + _tagname = "cpus" + status.getCPUValue(ret, _filename, _tagname) + + @staticmethod + def checkSlot(ret): + _filename = status.getFileName() + # _filename = "/usr/local/bin/" + status.getFileName() + _tagname = "slot" + status.getETValue(ret, _filename, _tagname) + + diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/pddf/pd-plugin.json b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/pddf/pd-plugin.json new file mode 100644 index 000000000000..ffa06ff74303 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/pddf/pd-plugin.json @@ -0,0 +1,67 @@ +{ + "XCVR": { + "xcvr_present": { + "i2c": { + "valmap-SFP28": { + "1": true, + "0": false + }, + "valmap-QSFP28": { + "1": true, + "0": false + } + } + } + }, + + "PSU": { + "psu_present": { + "i2c": { + "valmap": { + "1": true, + "0": false + } + } + }, + + "psu_power_good": { + "i2c": { + "valmap": { + "1": true, + "0": false + } + } + }, + + "psu_fan_dir": { + "i2c": { + "valmap": { + "F2B": "EXHAUST", + "B2F": "INTAKE" + } + } + }, + "PSU_FAN_MAX_SPEED": "18000" + }, + + "FAN": { + "direction": { + "i2c": { + "valmap": { + "1": "INTAKE", + "0": "EXHAUST" + } + } + }, + "present": { + "i2c": { + "valmap": { + "1": true, + "0": false + } + } + }, + "duty_cycle_to_pwm": "lambda dc: dc*255/100", + "pwm_to_duty_cycle": "lambda pwm: pwm*100/255" + } +} diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/pddf/pddf-device.json b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/pddf/pddf-device.json new file mode 100755 index 000000000000..0f337006edad --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/pddf/pddf-device.json @@ -0,0 +1,4471 @@ +{ + "PLATFORM": { + "num_psus": 2, + "num_fantrays": 5, + "num_fans_pertray": 2, + "num_ports": 32, + "num_temps": 5, + "pddf_dev_types": { + "description": "RA-B6510-32C", + "CPLD": [ + "i2c_cpld" + ], + "PSU": [ + "psu_eeprom", + "psu_pmbus" + ], + "FAN": [ + "fan_ctrl", + "fan_cpld", + "fan_eeprom" + ], + "PORT_MODULE": [ + "pddf_xcvr", + "optoe1", + "optoe2" + ] + }, + "std_kos": [ + "i2c-i801", + "i2c_dev", + "rg_i2c_gpio", + "rg_i2c_algo_bit", + "i2c_mux", + "rg_gpio_xeon", + "i2c_mux_pca9641", + "i2c_mux_pca954x force_create_bus=1", + "ragile_common dfd_my_type=0x404b", + "fpga_pcie_i2c ocore_ctl_startbus=2", + "lpc_dbg", + "fpga_i2c_ocores", + "rg_lpc_cpld", + "lm75", + "optoe", + "at24", + "pmbus_core" + ], + "pddf_kos": [ + "pddf_client_module", + "pddf_cpld_module", + "pddf_cpld_driver", + "pddf_mux_module", + "pddf_xcvr_module", + "pddf_xcvr_driver_module", + "pddf_psu_driver_module", + "pddf_psu_module", + "pddf_fan_driver_module", + "pddf_fan_module", + "pddf_sysstatus_module" + ], + "custom_kos": [ + "pddf_custom_psu", + "pddf_custom_led_module" + ] + + }, + + "SYSTEM": { + "dev_info": { + "device_type": "CPU", + "device_name": "ROOT_COMPLEX", + "device_parent": null + }, + "i2c": { + "CONTROLLERS": [{ + "dev_name": "i2c-0", + "dev": "SMBUS0" + }, { + "dev_name": "i2c-1", + "dev": "I2C-GPIO0" + }, { + "dev_name": "i2c-2", + "dev": "FPGA-OCORE0" + }, { + "dev_name": "i2c-3", + "dev": "FPGA-OCORE1" + },{ + "dev_name": "i2c-4", + "dev": "FPGA-OCORE2" + },{ + "dev_name": "i2c-5", + "dev": "FPGA-OCORE3" + },{ + "dev_name": "i2c-6", + "dev": "FPGA-OCORE4" + },{ + "dev_name": "i2c-7", + "dev": "FPGA-OCORE5" + },{ + "dev_name": "i2c-8", + "dev": "FPGA-OCORE6" + },{ + "dev_name": "i2c-9", + "dev": "FPGA-OCORE7" + },{ + "dev_name": "i2c-10", + "dev": "FPGA-OCORE8" + },{ + "dev_name": "i2c-11", + "dev": "FPGA-OCORE9" + },{ + "dev_name": "i2c-12", + "dev": "FPGA-OCORE10" + },{ + "dev_name": "i2c-13", + "dev": "FPGA-OCORE11" + },{ + "dev_name": "i2c-14", + "dev": "FPGA-OCORE12" + },{ + "dev_name": "i2c-15", + "dev": "FPGA-OCORE13" + }] + } + }, + + "SMBUS0": { + "dev_info": { + "device_type": "SMBUS", + "device_name": "SMBUS0", + "device_parent": "SYSTEM" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x0" + }, + "DEVICES": [] + } + }, + + "I2C-GPIO0": { + "dev_info": { + "device_type": "I2C-GPIO", + "device_name": "I2C-GPIO0", + "device_parent": "SYSTEM" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x1" + }, + "DEVICES": [{ + "dev": "EEPROM1" + } + ] + } + }, + + "EEPROM1": { + "dev_info": { + "device_type": "EEPROM", + "device_name": "EEPROM1", + "device_parent": "I2C-GPIO0" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x1", + "dev_addr": "0x56", + "dev_type": "24c02" + }, + "dev_attr": { + "access_mode": "BLOCK" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "FPGA-OCORE0": { + "dev_info": { + "device_type": "FPGA-OCORE", + "device_name": "FPGA-OCORE0", + "device_parent": "SYSTEM" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x2" + }, + "DEVICES": [ + { + "dev": "FAN-CTRL" + }, { + "dev": "MUX0" + } + ] + } + }, + + "FAN-CTRL": { + "dev_info": { + "device_type": "FAN", + "device_name": "FAN-CTRL", + "device_parent": "FPGA-OCORE0" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x2", + "dev_addr": "0x0d", + "dev_type": "fan_cpld" + }, + "dev_attr": { + "num_fantrays": "5" + }, + "attr_list": [{ + "attr_name": "fan1_present", + "attr_offset": "0x30", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan2_present", + "attr_offset": "0x30", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan3_present", + "attr_offset": "0x30", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan4_present", + "attr_offset": "0x30", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan5_present", + "attr_offset": "0x30", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan6_present", + "attr_offset": "0x30", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan7_present", + "attr_offset": "0x30", + "attr_mask": "0x8", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan8_present", + "attr_offset": "0x30", + "attr_mask": "0x8", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan9_present", + "attr_offset": "0x30", + "attr_mask": "0x10", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan10_present", + "attr_offset": "0x30", + "attr_mask": "0x10", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan1_input", + "attr_offset": "0x1b", + "attr_mult": "1", + "attr_len": "2" + }, + { + "attr_name": "fan2_input", + "attr_offset": "0x25", + "attr_mult": "1", + "attr_len": "2" + }, + { + "attr_name": "fan3_input", + "attr_offset": "0x1d", + "attr_mult": "1", + "attr_len": "2" + }, + { + "attr_name": "fan4_input", + "attr_offset": "0x27", + "attr_mult": "1", + "attr_len": "2" + }, + { + "attr_name": "fan5_input", + "attr_offset": "0x1f", + "attr_mult": "1", + "attr_len": "2" + }, + { + "attr_name": "fan6_input", + "attr_offset": "0x29", + "attr_mult": "1", + "attr_len": "2" + }, + { + "attr_name": "fan7_input", + "attr_offset": "0x21", + "attr_mult": "1", + "attr_len": "2" + }, + { + "attr_name": "fan8_input", + "attr_offset": "0x2b", + "attr_mult": "1", + "attr_len": "2" + }, + { + "attr_name": "fan9_input", + "attr_offset": "0x23", + "attr_mult": "1", + "attr_len": "2" + }, + { + "attr_name": "fan10_input", + "attr_offset": "0x2d", + "attr_mult": "1", + "attr_len": "2" + }, + { + "attr_name": "fan1_pwm", + "attr_offset": "0x14", + "attr_mask": "0xff", + "attr_len": "1" + }, + { + "attr_name": "fan2_pwm", + "attr_offset": "0x14", + "attr_mask": "0xff", + "attr_len": "1" + }, + { + "attr_name": "fan3_pwm", + "attr_offset": "0x15", + "attr_mask": "0xff", + "attr_len": "1" + }, + { + "attr_name": "fan4_pwm", + "attr_offset": "0x15", + "attr_mask": "0xff", + "attr_len": "1" + }, + { + "attr_name": "fan5_pwm", + "attr_offset": "0x16", + "attr_mask": "0xff", + "attr_len": "1" + }, + { + "attr_name": "fan6_pwm", + "attr_offset": "0x16", + "attr_mask": "0xff", + "attr_len": "1" + }, + { + "attr_name": "fan7_pwm", + "attr_offset": "0x17", + "attr_mask": "0xff", + "attr_len": "1" + }, + { + "attr_name": "fan8_pwm", + "attr_offset": "0x17", + "attr_mask": "0xff", + "attr_len": "1" + }, + { + "attr_name": "fan9_pwm", + "attr_offset": "0x18", + "attr_mask": "0xff", + "attr_len": "1" + }, + { + "attr_name": "fan10_pwm", + "attr_offset": "0x18", + "attr_mask": "0xff", + "attr_len": "1" + }, + { + "attr_name": "fan1_fault", + "attr_offset": "0x31", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan2_fault", + "attr_offset": "0x31", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan3_fault", + "attr_offset": "0x31", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan4_fault", + "attr_offset": "0x31", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan5_fault", + "attr_offset": "0x31", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan6_fault", + "attr_offset": "0x31", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan7_fault", + "attr_offset": "0x31", + "attr_mask": "0x8", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan8_fault", + "attr_offset": "0x31", + "attr_mask": "0x8", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan9_fault", + "attr_offset": "0x31", + "attr_mask": "0x10", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan10_fault", + "attr_offset": "0x31", + "attr_mask": "0x10", + "attr_cmpval": "0x0", + "attr_len": "1" + } + ] + } + }, + + "MUX0": { + "dev_info": { + "device_type": "MUX", + "device_name": "MUX0", + "device_parent": "FPGA-OCORE0" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x2", + "dev_addr": "0x77", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x10" + }, + "channel": [{ + "chn": "0", + "dev": "FAN1-EEPROM" + }, + { + "chn": "1", + "dev": "FAN2-EEPROM" + }, + { + "chn": "2", + "dev": "FAN3-EEPROM" + }, + { + "chn": "3", + "dev": "FAN4-EEPROM" + }, + { + "chn": "4", + "dev": "FAN5-EEPROM" + } + ] + } + }, + + "FAN1-EEPROM": { + "dev_info": { + "device_type": "EEPROM", + "device_name": "FAN1-EEPROM", + "device_parent": "MUX0" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x10", + "dev_addr": "0x50", + "dev_type": "24c02" + }, + "dev_attr": { + "access_mode": "BLOCK" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "FAN2-EEPROM": { + "dev_info": { + "device_type": "EEPROM", + "device_name": "FAN2-EEPROM", + "device_parent": "MUX0" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x11", + "dev_addr": "0x50", + "dev_type": "24c02" + }, + "dev_attr": { + "access_mode": "BLOCK" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "FAN3-EEPROM": { + "dev_info": { + "device_type": "EEPROM", + "device_name": "FAN3-EEPROM", + "device_parent": "MUX0" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x12", + "dev_addr": "0x50", + "dev_type": "24c02" + }, + "dev_attr": { + "access_mode": "BLOCK" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "FAN4-EEPROM": { + "dev_info": { + "device_type": "EEPROM", + "device_name": "FAN4-EEPROM", + "device_parent": "MUX0" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x13", + "dev_addr": "0x50", + "dev_type": "24c02" + }, + "dev_attr": { + "access_mode": "BLOCK" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "FAN5-EEPROM": { + "dev_info": { + "device_type": "EEPROM", + "device_name": "FAN5-EEPROM", + "device_parent": "MUX0" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x14", + "dev_addr": "0x50", + "dev_type": "24c02" + }, + "dev_attr": { + "access_mode": "BLOCK" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "FPGA-OCORE1": { + "dev_info": { + "device_type": "FPGA-OCORE", + "device_name": "FPGA-OCORE1", + "device_parent": "SYSTEM" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x3" + }, + "DEVICES": [ + { + "dev": "TEMP1" + }, + { + "dev": "TEMP2" + }, + { + "dev": "TEMP3" + }, + { + "dev": "TEMP4" + }, + { + "dev": "TEMP5" + } + ] + } + }, + + "TEMP1": { + "dev_info": { + "device_type": "TEMP_SENSOR", + "device_name": "TEMP-MAC-INLET-R", + "device_parent": "FPGA-OCORE1" + }, + "dev_attr": { + "display_name": "Temp_MAC_INLET_R" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3", + "dev_addr": "0x48", + "dev_type": "lm75" + }, + "attr_list": [{ + "attr_name": "temp1_high_threshold", + "drv_attr_name": "temp1_max" + }, + { + "attr_name": "temp1_max_hyst" + }, + { + "attr_name": "temp1_input" + } + ] + } + }, + + "TEMP2": { + "dev_info": { + "device_type": "TEMP_SENSOR", + "device_name": "TEMP-MAC-INLET-F", + "device_parent": "FPGA-OCORE1" + }, + "dev_attr": { + "display_name": "Temp_MAC_INLET_F" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3", + "dev_addr": "0x49", + "dev_type": "lm75" + }, + "attr_list": [{ + "attr_name": "temp1_high_threshold", + "drv_attr_name": "temp1_max" + }, + { + "attr_name": "temp1_max_hyst" + }, + { + "attr_name": "temp1_input" + } + ] + } + }, + + "TEMP3": { + "dev_info": { + "device_type": "TEMP_SENSOR", + "device_name": "TEMP-MAC-INLET-B", + "device_parent": "FPGA-OCORE1" + }, + "dev_attr": { + "display_name": "Temp_MAC_INLET_B" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3", + "dev_addr": "0x4a", + "dev_type": "lm75" + }, + "attr_list": [{ + "attr_name": "temp1_high_threshold", + "drv_attr_name": "temp1_max" + }, + { + "attr_name": "temp1_max_hyst" + }, + { + "attr_name": "temp1_input" + } + ] + } + }, + + "TEMP4": { + "dev_info": { + "device_type": "TEMP_SENSOR", + "device_name": "TEMP-MAC-INLET-L", + "device_parent": "FPGA-OCORE1" + }, + "dev_attr": { + "display_name": "Temp_MAC_INLET_L" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3", + "dev_addr": "0x4b", + "dev_type": "lm75" + }, + "attr_list": [{ + "attr_name": "temp1_high_threshold", + "drv_attr_name": "temp1_max" + }, + { + "attr_name": "temp1_max_hyst" + }, + { + "attr_name": "temp1_input" + } + ] + } + }, + + "TEMP5": { + "dev_info": { + "device_type": "TEMP_SENSOR", + "device_name": "TEMP-CPU-BOARD", + "device_parent": "FPGA-OCORE1" + }, + "dev_attr": { + "display_name": "Temp_CPU_BOARD" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3", + "dev_addr": "0x4c", + "dev_type": "lm75" + }, + "attr_list": [{ + "attr_name": "temp1_high_threshold", + "drv_attr_name": "temp1_max" + }, + { + "attr_name": "temp1_max_hyst" + }, + { + "attr_name": "temp1_input" + } + ] + } + }, + + "FPGA-OCORE2": { + "dev_info": { + "device_type": "FPGA-OCORE", + "device_name": "FPGA-OCORE2", + "device_parent": "SYSTEM" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x4" + }, + "DEVICES": [ + { + "dev": "MUX1" + } + ] + } + }, + + "MUX1": { + "dev_info": { + "device_type": "MUX", + "device_name": "MUX1", + "device_parent": "FPGA-OCORE2" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x4", + "dev_addr": "0x77", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x18" + }, + "channel": [{ + "chn": "0", + "dev": "PSU1" + }, + { + "chn": "1", + "dev": "PSU2" + } + ] + } + }, + + "PSU1": { + "dev_info": { + "device_type": "PSU", + "device_name": "PSU1", + "device_parent": "MUX1" + }, + "dev_attr": { + "dev_idx": "1", + "num_psu_fans": "1" + }, + "i2c": { + "interface": [{ + "itf": "pmbus", + "dev": "PSU1-PMBUS" + }, + { + "itf": "eeprom", + "dev": "PSU1-EEPROM" + } + ] + } + }, + + "PSU1-PMBUS": { + "dev_info": { + "device_type": "PSU-PMBUS", + "device_name": "PSU1-PMBUS", + "device_parent": "MUX1", + "virt_parent": "PSU1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x18", + "dev_addr": "0x58", + "dev_type": "psu_pmbus" + }, + "attr_list": [{ + "attr_name": "psu_present", + "attr_devtype": "io", + "attr_offset": "0x951", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "psu_model_name", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x9a", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "12" + }, + { + "attr_name": "psu_power_good", + "attr_devtype": "io", + "attr_offset": "0x951", + "attr_mask": "0x2", + "attr_cmpval": "0x2", + "attr_len": "1" + }, + { + "attr_name": "psu_mfr_id", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x99", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "10" + }, + { + "attr_name": "psu_fan_dir", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0xc3", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "5" + }, + { + "attr_name": "psu_v_out", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x8b", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_i_out", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x8c", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_p_out", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x96", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_fan1_speed_rpm", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x90", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_temp1_input", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x8d", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + } + ] + } + }, + + "PSU1-EEPROM": { + "dev_info": { + "device_type": "PSU-EEPROM", + "device_name": "PSU1-EEPROM", + "device_parent": "MUX1", + "virt_parent": "PSU1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x18", + "dev_addr": "0x50", + "dev_type": "psu_eeprom" + }, + "attr_list": [{ + "attr_name": "psu_serial_num", + "attr_devaddr": "0x50", + "attr_devtype": "eeprom", + "attr_offset": "0x38", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "20" + }] + } + }, + + "PSU2": { + "dev_info": { + "device_type": "PSU", + "device_name": "PSU2", + "device_parent": "MUX1" + }, + "dev_attr": { + "dev_idx": "2", + "num_psu_fans": "1" + }, + "i2c": { + "interface": [{ + "itf": "pmbus", + "dev": "PSU2-PMBUS" + }, + { + "itf": "eeprom", + "dev": "PSU2-EEPROM" + } + ] + } + }, + + "PSU2-PMBUS": { + "dev_info": { + "device_type": "PSU-PMBUS", + "device_name": "PSU2-PMBUS", + "device_parent": "MUX1", + "virt_parent": "PSU2" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x19", + "dev_addr": "0x58", + "dev_type": "psu_pmbus" + }, + "attr_list": [{ + "attr_name": "psu_present", + "attr_devtype": "io", + "attr_offset": "0x951", + "attr_mask": "0x10", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "psu_model_name", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x9a", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "12" + }, + { + "attr_name": "psu_power_good", + "attr_devtype": "io", + "attr_offset": "0x951", + "attr_mask": "0x20", + "attr_cmpval": "0x20", + "attr_len": "1" + }, + { + "attr_name": "psu_mfr_id", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x99", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "10" + }, + { + "attr_name": "psu_fan_dir", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0xc3", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "5" + }, + { + "attr_name": "psu_v_out", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x8b", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_i_out", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x8c", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_p_out", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x96", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_fan1_speed_rpm", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x90", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_temp1_input", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x8d", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + } + ] + } + }, + + "PSU2-EEPROM": { + "dev_info": { + "device_type": "PSU-EEPROM", + "device_name": "PSU2-EEPROM", + "device_parent": "MUX1", + "virt_parent": "PSU2" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x19", + "dev_addr": "0x50", + "dev_type": "psu_eeprom" + }, + "attr_list": [{ + "attr_name": "psu_serial_num", + "attr_devaddr": "0x50", + "attr_devtype": "eeprom", + "attr_offset": "0x38", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "20" + }] + } + }, + + "FPGA-OCORE3": { + "dev_info": { + "device_type": "FPGA-OCORE", + "device_name": "FPGA-OCORE3", + "device_parent": "SYSTEM" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x5" + }, + "DEVICES": [ + { + "dev": "EEPROM2" + } + ] + } + }, + + "EEPROM2": { + "dev_info": { + "device_type": "EEPROM", + "device_name": "MAC-EEPROM", + "device_parent": "I2C-GPIO0" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x5", + "dev_addr": "0x51", + "dev_type": "24c02" + }, + "dev_attr": { + "access_mode": "BLOCK" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "FPGA-OCORE4": { + "dev_info": { + "device_type": "FPGA-OCORE", + "device_name": "FPGA-OCORE4", + "device_parent": "SYSTEM" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x6" + }, + "DEVICES": [ + { + "dev": "CPU_BOARD_CPLD" + } + ] + } + }, + + "CPU_BOARD_CPLD": { + "dev_info": { + "device_type": "CPLD", + "device_name": "CPU_BOARD_CPLD", + "device_parent": "FPGA-OCORE4" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x6", + "dev_addr": "0x0d", + "dev_type": "i2c_cpld" + }, + "dev_attr": {} + } + }, + + "FPGA-OCORE5": { + "dev_info": { + "device_type": "FPGA-OCORE", + "device_name": "FPGA-OCORE5", + "device_parent": "SYSTEM" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x7" + }, + "DEVICES": [] + } + }, + + "FPGA-OCORE6": { + "dev_info": { + "device_type": "FPGA-OCORE", + "device_name": "FPGA-OCORE6", + "device_parent": "SYSTEM" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x8" + }, + "DEVICES": [ + { + "dev": "MAC_BOARD_CPLD1" + }, { + "dev": "MAC_BOARD_CPLD2" + } + ] + } + }, + + "MAC_BOARD_CPLD1": { + "dev_info": { + "device_type": "CPLD", + "device_name": "MAC_BOARD_CPLD1", + "device_parent": "FPGA-OCORE6" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x8", + "dev_addr": "0x30", + "dev_type": "i2c_cpld" + }, + "dev_attr": {} + } + }, + + "MAC_BOARD_CPLD2": { + "dev_info": { + "device_type": "CPLD", + "device_name": "MAC_BOARD_CPLD2", + "device_parent": "FPGA-OCORE6" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x8", + "dev_addr": "0x31", + "dev_type": "i2c_cpld" + }, + "dev_attr": {} + } + }, + + "FPGA-OCORE7": { + "dev_info": { + "device_type": "FPGA-OCORE", + "device_name": "FPGA-OCORE7", + "device_parent": "SYSTEM" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x9" + }, + "DEVICES": [] + } + }, + + "FPGA-OCORE8": { + "dev_info": { + "device_type": "FPGA-OCORE", + "device_name": "FPGA-OCORE8", + "device_parent": "SYSTEM" + }, + "i2c": { + "topo_info": { + "dev_addr": "0xa" + }, + "DEVICES": [] + } + }, + + "FPGA-OCORE9": { + "dev_info": { + "device_type": "FPGA-OCORE", + "device_name": "FPGA-OCORE9", + "device_parent": "SYSTEM" + }, + "i2c": { + "topo_info": { + "dev_addr": "0xb" + }, + "DEVICES": [] + } + }, + + "FPGA-OCORE10": { + "dev_info": { + "device_type": "FPGA-OCORE", + "device_name": "FPGA-OCORE10", + "device_parent": "SYSTEM" + }, + "i2c": { + "topo_info": { + "dev_addr": "0xc" + }, + "DEVICES": [ + { + "dev": "PORT-MUX0" + }, + { + "dev": "PORT-MUX1" + }, + { + "dev": "PORT-MUX2" + }, + { + "dev": "PORT-MUX3" + } + ] + } + }, + + "PORT-MUX0": { + "dev_info": { + "device_type": "MUX", + "device_name": "PORT-MUX0", + "device_parent": "FPGA-OCORE10" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xc", + "dev_addr": "0x70", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x20" + }, + "channel": [{ + "chn": "0", + "dev": "PORT1" + }, + { + "chn": "1", + "dev": "PORT2" + }, + { + "chn": "2", + "dev": "PORT3" + }, + { + "chn": "3", + "dev": "PORT4" + }, + { + "chn": "4", + "dev": "PORT5" + }, + { + "chn": "5", + "dev": "PORT6" + }, + { + "chn": "6", + "dev": "PORT7" + }, + { + "chn": "7", + "dev": "PORT8" + } + ] + } + }, + + "PORT-MUX1": { + "dev_info": { + "device_type": "MUX", + "device_name": "PORT-MUX1", + "device_parent": "FPGA-OCORE10" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xc", + "dev_addr": "0x71", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x28" + }, + "channel": [{ + "chn": "0", + "dev": "PORT9" + }, + { + "chn": "1", + "dev": "PORT10" + }, + { + "chn": "2", + "dev": "PORT11" + }, + { + "chn": "3", + "dev": "PORT12" + }, + { + "chn": "4", + "dev": "PORT13" + }, + { + "chn": "5", + "dev": "PORT14" + }, + { + "chn": "6", + "dev": "PORT15" + }, + { + "chn": "7", + "dev": "PORT16" + } + ] + } + }, + + "PORT-MUX2": { + "dev_info": { + "device_type": "MUX", + "device_name": "PORT-MUX2", + "device_parent": "FPGA-OCORE10" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xc", + "dev_addr": "0x72", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x30" + }, + "channel": [{ + "chn": "0", + "dev": "PORT17" + }, + { + "chn": "1", + "dev": "PORT18" + }, + { + "chn": "2", + "dev": "PORT19" + }, + { + "chn": "3", + "dev": "PORT20" + }, + { + "chn": "4", + "dev": "PORT21" + }, + { + "chn": "5", + "dev": "PORT22" + }, + { + "chn": "6", + "dev": "PORT23" + }, + { + "chn": "7", + "dev": "PORT24" + } + ] + } + }, + + "PORT-MUX3": { + "dev_info": { + "device_type": "MUX", + "device_name": "PORT-MUX3", + "device_parent": "FPGA-OCORE10" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xc", + "dev_addr": "0x73", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x38" + }, + "channel": [{ + "chn": "0", + "dev": "PORT25" + }, + { + "chn": "1", + "dev": "PORT26" + }, + { + "chn": "2", + "dev": "PORT27" + }, + { + "chn": "3", + "dev": "PORT28" + }, + { + "chn": "4", + "dev": "PORT29" + }, + { + "chn": "5", + "dev": "PORT30" + }, + { + "chn": "6", + "dev": "PORT31" + }, + { + "chn": "7", + "dev": "PORT32" + } + ] + } + }, + + "PORT1": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT1", + "device_parent": "PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "1" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT1-EEPROM" + }, { + "itf": "control", + "dev": "PORT1-CTRL" + }] + } + }, + + "PORT1-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT1-EEPROM", + "device_parent": "PORT-MUX0", + "virt_parent": "PORT1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x20", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT1-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT1-CTRL", + "device_parent": "PORT-MUX0", + "virt_parent": "PORT1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x20", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT2": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT2", + "device_parent": "PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "2" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT2-EEPROM" + }, { + "itf": "control", + "dev": "PORT2-CTRL" + }] + } + }, + + "PORT2-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT2-EEPROM", + "device_parent": "PORT-MUX0", + "virt_parent": "PORT2" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x21", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT2-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT2-CTRL", + "device_parent": "PORT-MUX0", + "virt_parent": "PORT2" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x21", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT3": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT3", + "device_parent": "PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "3" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT3-EEPROM" + }, { + "itf": "control", + "dev": "PORT3-CTRL" + }] + } + }, + + "PORT3-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT3-EEPROM", + "device_parent": "PORT-MUX0", + "virt_parent": "PORT3" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x22", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT3-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT3-CTRL", + "device_parent": "PORT-MUX0", + "virt_parent": "PORT3" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x22", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + + "PORT4": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT4", + "device_parent": "PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "4" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT4-EEPROM" + }, { + "itf": "control", + "dev": "PORT4-CTRL" + }] + } + }, + + "PORT4-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT4-EEPROM", + "device_parent": "PORT-MUX0", + "virt_parent": "PORT4" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x23", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT4-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT4-CTRL", + "device_parent": "PORT-MUX0", + "virt_parent": "PORT4" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x23", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + + "PORT5": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT5", + "device_parent": "PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "5" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT5-EEPROM" + }, { + "itf": "control", + "dev": "PORT5-CTRL" + }] + } + }, + + "PORT5-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT5-EEPROM", + "device_parent": "PORT-MUX0", + "virt_parent": "PORT5" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x24", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT5-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT5-CTRL", + "device_parent": "PORT-MUX0", + "virt_parent": "PORT5" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x24", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + + "PORT6": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT6", + "device_parent": "PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "6" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT6-EEPROM" + }, { + "itf": "control", + "dev": "PORT6-CTRL" + }] + } + }, + + "PORT6-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT6-EEPROM", + "device_parent": "PORT-MUX0", + "virt_parent": "PORT6" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x25", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT6-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT6-CTRL", + "device_parent": "PORT-MUX0", + "virt_parent": "PORT6" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x25", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT7": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT7", + "device_parent": "PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "7" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT7-EEPROM" + }, { + "itf": "control", + "dev": "PORT7-CTRL" + }] + } + }, + + "PORT7-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT7-EEPROM", + "device_parent": "PORT-MUX0", + "virt_parent": "PORT7" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x26", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT7-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT7-CTRL", + "device_parent": "PORT-MUX0", + "virt_parent": "PORT7" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x26", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x30", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT8": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT8", + "device_parent": "PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "8" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT8-EEPROM" + }, { + "itf": "control", + "dev": "PORT8-CTRL" + }] + } + }, + + "PORT8-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT8-EEPROM", + "device_parent": "PORT-MUX0", + "virt_parent": "PORT8" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x27", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT8-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT8-CTRL", + "device_parent": "PORT-MUX0", + "virt_parent": "PORT8" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x27", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT9": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT9", + "device_parent": "PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "9" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT9-EEPROM" + }, { + "itf": "control", + "dev": "PORT9-CTRL" + }] + } + }, + + "PORT9-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT9-EEPROM", + "device_parent": "PORT-MUX1", + "virt_parent": "PORT9" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x28", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT9-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT9-CTRL", + "device_parent": "PORT-MUX1", + "virt_parent": "PORT9" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x28", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT10": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT10", + "device_parent": "PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "10" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT10-EEPROM" + }, { + "itf": "control", + "dev": "PORT10-CTRL" + }] + } + }, + + "PORT10-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT10-EEPROM", + "device_parent": "PORT-MUX1", + "virt_parent": "PORT10" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x29", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT10-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT10-CTRL", + "device_parent": "PORT-MUX1", + "virt_parent": "PORT10" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x29", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + + "PORT11": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT11", + "device_parent": "PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "11" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT11-EEPROM" + }, { + "itf": "control", + "dev": "PORT11-CTRL" + }] + } + }, + + "PORT11-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT11-EEPROM", + "device_parent": "PORT-MUX1", + "virt_parent": "PORT11" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x2a", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT11-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT11-CTRL", + "device_parent": "PORT-MUX1", + "virt_parent": "PORT11" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x2a", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + + "PORT12": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT12", + "device_parent": "PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "12" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT12-EEPROM" + }, { + "itf": "control", + "dev": "PORT12-CTRL" + }] + } + }, + + "PORT12-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT12-EEPROM", + "device_parent": "PORT-MUX1", + "virt_parent": "PORT12" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x2b", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT12-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT12-CTRL", + "device_parent": "PORT-MUX1", + "virt_parent": "PORT12" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x2b", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + + "PORT13": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT13", + "device_parent": "PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "13" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT13-EEPROM" + }, { + "itf": "control", + "dev": "PORT13-CTRL" + }] + } + }, + + "PORT13-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT13-EEPROM", + "device_parent": "PORT-MUX1", + "virt_parent": "PORT13" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x2c", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT13-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT13-CTRL", + "device_parent": "PORT-MUX1", + "virt_parent": "PORT13" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x2c", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + + "PORT14": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT14", + "device_parent": "PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "14" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT14-EEPROM" + }, { + "itf": "control", + "dev": "PORT14-CTRL" + }] + } + }, + + "PORT14-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT14-EEPROM", + "device_parent": "PORT-MUX1", + "virt_parent": "PORT14" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x2d", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT14-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT14-CTRL", + "device_parent": "PORT-MUX1", + "virt_parent": "PORT14" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x2d", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT15": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT15", + "device_parent": "PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "15" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT15-EEPROM" + }, { + "itf": "control", + "dev": "PORT15-CTRL" + }] + } + }, + + "PORT15-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT15-EEPROM", + "device_parent": "PORT-MUX1", + "virt_parent": "PORT15" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x2e", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT15-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT15-CTRL", + "device_parent": "PORT-MUX1", + "virt_parent": "PORT15" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x2e", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT16": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT16", + "device_parent": "PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "16" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT16-EEPROM" + }, { + "itf": "control", + "dev": "PORT16-CTRL" + }] + } + }, + + "PORT16-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT16-EEPROM", + "device_parent": "PORT-MUX1", + "virt_parent": "PORT16" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x2f", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT16-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT16-CTRL", + "device_parent": "PORT-MUX1", + "virt_parent": "PORT16" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x2f", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT17": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT17", + "device_parent": "PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "17" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT17-EEPROM" + }, { + "itf": "control", + "dev": "PORT17-CTRL" + }] + } + }, + + "PORT17-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT17-EEPROM", + "device_parent": "PORT-MUX2", + "virt_parent": "PORT17" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x30", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT17-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT17-CTRL", + "device_parent": "PORT-MUX2", + "virt_parent": "PORT17" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x30", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT18": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT18", + "device_parent": "PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "18" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT18-EEPROM" + }, { + "itf": "control", + "dev": "PORT18-CTRL" + }] + } + }, + + "PORT18-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT18-EEPROM", + "device_parent": "PORT-MUX2", + "virt_parent": "PORT18" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x31", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT18-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT18-CTRL", + "device_parent": "PORT-MUX2", + "virt_parent": "PORT18" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x31", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + + "PORT19": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT19", + "device_parent": "PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "19" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT19-EEPROM" + }, { + "itf": "control", + "dev": "PORT19-CTRL" + }] + } + }, + + "PORT19-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT19-EEPROM", + "device_parent": "PORT-MUX2", + "virt_parent": "PORT19" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x32", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT19-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT19-CTRL", + "device_parent": "PORT-MUX2", + "virt_parent": "PORT19" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x32", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + + "PORT20": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT20", + "device_parent": "PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "20" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT20-EEPROM" + }, { + "itf": "control", + "dev": "PORT20-CTRL" + }] + } + }, + + "PORT20-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT20-EEPROM", + "device_parent": "PORT-MUX2", + "virt_parent": "PORT20" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x33", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT20-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT20-CTRL", + "device_parent": "PORT-MUX2", + "virt_parent": "PORT20" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x33", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + + "PORT21": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT21", + "device_parent": "PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "21" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT21-EEPROM" + }, { + "itf": "control", + "dev": "PORT21-CTRL" + }] + } + }, + + "PORT21-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT21-EEPROM", + "device_parent": "PORT-MUX2", + "virt_parent": "PORT21" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x34", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT21-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT21-CTRL", + "device_parent": "PORT-MUX2", + "virt_parent": "PORT21" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x34", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + + "PORT22": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT22", + "device_parent": "PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "22" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT22-EEPROM" + }, { + "itf": "control", + "dev": "PORT22-CTRL" + }] + } + }, + + "PORT22-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT22-EEPROM", + "device_parent": "PORT-MUX2", + "virt_parent": "PORT22" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x35", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT22-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT22-CTRL", + "device_parent": "PORT-MUX2", + "virt_parent": "PORT22" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x35", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT23": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT23", + "device_parent": "PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "23" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT23-EEPROM" + }, { + "itf": "control", + "dev": "PORT23-CTRL" + }] + } + }, + + "PORT23-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT23-EEPROM", + "device_parent": "PORT-MUX2", + "virt_parent": "PORT23" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x36", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT23-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT23-CTRL", + "device_parent": "PORT-MUX2", + "virt_parent": "PORT23" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x36", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT24": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT24", + "device_parent": "PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "24" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT24-EEPROM" + }, { + "itf": "control", + "dev": "PORT24-CTRL" + }] + } + }, + + "PORT24-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT24-EEPROM", + "device_parent": "PORT-MUX2", + "virt_parent": "PORT24" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x37", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT24-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT24-CTRL", + "device_parent": "PORT-MUX2", + "virt_parent": "PORT24" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x37", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT25": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT25", + "device_parent": "PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "25" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT25-EEPROM" + }, { + "itf": "control", + "dev": "PORT25-CTRL" + }] + } + }, + + "PORT25-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT25-EEPROM", + "device_parent": "PORT-MUX3", + "virt_parent": "PORT25" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x38", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT25-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT25-CTRL", + "device_parent": "PORT-MUX3", + "virt_parent": "PORT25" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x38", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT26": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT26", + "device_parent": "PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "26" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT26-EEPROM" + }, { + "itf": "control", + "dev": "PORT26-CTRL" + }] + } + }, + + "PORT26-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT26-EEPROM", + "device_parent": "PORT-MUX3", + "virt_parent": "PORT26" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x39", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT26-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT26-CTRL", + "device_parent": "PORT-MUX3", + "virt_parent": "PORT26" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x39", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + + "PORT27": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT27", + "device_parent": "PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "27" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT27-EEPROM" + }, { + "itf": "control", + "dev": "PORT27-CTRL" + }] + } + }, + + "PORT27-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT27-EEPROM", + "device_parent": "PORT-MUX3", + "virt_parent": "PORT27" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3a", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT27-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT27-CTRL", + "device_parent": "PORT-MUX3", + "virt_parent": "PORT27" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3a", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + + "PORT28": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT28", + "device_parent": "PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "28" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT28-EEPROM" + }, { + "itf": "control", + "dev": "PORT28-CTRL" + }] + } + }, + + "PORT28-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT28-EEPROM", + "device_parent": "PORT-MUX3", + "virt_parent": "PORT28" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3b", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT28-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT28-CTRL", + "device_parent": "PORT-MUX3", + "virt_parent": "PORT28" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3b", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + + "PORT29": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT29", + "device_parent": "PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "29" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT29-EEPROM" + }, { + "itf": "control", + "dev": "PORT29-CTRL" + }] + } + }, + + "PORT29-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT29-EEPROM", + "device_parent": "PORT-MUX3", + "virt_parent": "PORT29" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3c", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT29-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT29-CTRL", + "device_parent": "PORT-MUX3", + "virt_parent": "PORT29" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3c", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + + "PORT30": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT30", + "device_parent": "PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "30" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT30-EEPROM" + }, { + "itf": "control", + "dev": "PORT30-CTRL" + }] + } + }, + + "PORT30-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT30-EEPROM", + "device_parent": "PORT-MUX3", + "virt_parent": "PORT30" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3d", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT30-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT30-CTRL", + "device_parent": "PORT-MUX3", + "virt_parent": "PORT30" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3d", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT31": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT31", + "device_parent": "PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "31" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT31-EEPROM" + }, { + "itf": "control", + "dev": "PORT31-CTRL" + }] + } + }, + + "PORT31-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT31-EEPROM", + "device_parent": "PORT-MUX3", + "virt_parent": "PORT31" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3e", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT31-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT31-CTRL", + "device_parent": "PORT-MUX3", + "virt_parent": "PORT31" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3e", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT32": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT32", + "device_parent": "PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "32" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT32-EEPROM" + }, { + "itf": "control", + "dev": "PORT32-CTRL" + }] + } + }, + + "PORT32-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT32-EEPROM", + "device_parent": "PORT-MUX3", + "virt_parent": "PORT32" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3f", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT32-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT32-CTRL", + "device_parent": "PORT-MUX3", + "virt_parent": "PORT32" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3f", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "FPGA-OCORE11": { + "dev_info": { + "device_type": "FPGA-OCORE", + "device_name": "FPGA-OCORE11", + "device_parent": "SYSTEM" + }, + "i2c": { + "topo_info": { + "dev_addr": "0xd" + }, + "DEVICES": [] + } + }, + + "FPGA-OCORE12": { + "dev_info": { + "device_type": "FPGA-OCORE", + "device_name": "FPGA-OCORE12", + "device_parent": "SYSTEM" + }, + "i2c": { + "topo_info": { + "dev_addr": "0xe" + }, + "DEVICES": [] + } + }, + + "FPGA-OCORE13": { + "dev_info": { + "device_type": "FPGA-OCORE", + "device_name": "FPGA-OCORE13", + "device_parent": "SYSTEM" + }, + "i2c": { + "topo_info": { + "dev_addr": "0xf" + }, + "DEVICES": [] + } + }, + + "FRONT_BOARD_CPU_LED": { + "dev_info": { + "device_type": "LED", + "device_name": "SYS_LED" + }, + "dev_attr": { + "index": "0" + }, + "i2c": { + "attr_list": [{ + "attr_name": "STATUS_LED_COLOR_RED", + "descr": "Red", + "bits": "2:0", + "value": "0x2", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x972" + }, + { + "attr_name": "STATUS_LED_COLOR_RED_BLINK", + "descr": "Red Blinking", + "bits": "2:0", + "value": "0x1", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x972" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN", + "descr": "Green", + "bits": "2:0", + "value": "0x4", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x972" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN_BLINK", + "descr": "Green Blinking", + "bits": "2:0", + "value": "0x3", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x972" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER", + "descr": "Amber", + "bits": "2:0", + "value": "0x6", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x972" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER_BLINK", + "descr": "Amber Blinking", + "bits": "2:0", + "value": "0x5", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x972" + }, + { + "attr_name": "STATUS_LED_COLOR_OFF", + "descr": "Off", + "bits": "2:0", + "value": "0x0", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x972" + } + ] + } + }, + + "FRONT_BOARD_PSU_LED": { + "dev_info": { + "device_type": "LED", + "device_name": "LOC_LED" + }, + "dev_attr": { + "index": "0" + }, + "i2c": { + "attr_list": [{ + "attr_name": "STATUS_LED_COLOR_RED", + "descr": "Red", + "bits": "2:0", + "value": "0x2", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x973" + }, + { + "attr_name": "STATUS_LED_COLOR_RED_BLINK", + "descr": "Red Blinking", + "bits": "2:0", + "value": "0x1", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x973" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN", + "descr": "Green", + "bits": "2:0", + "value": "0x4", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x973" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN_BLINK", + "descr": "Green Blinking", + "bits": "2:0", + "value": "0x3", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x973" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER", + "descr": "Amber", + "bits": "2:0", + "value": "0x6", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x973" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER_BLINK", + "descr": "Amber Blinking", + "bits": "2:0", + "value": "0x5", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x973" + }, + { + "attr_name": "STATUS_LED_COLOR_OFF", + "descr": "Off", + "bits": "2:0", + "value": "0x0", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x973" + } + ] + } + }, + + "FRONT_BOARD_FAN_LED": { + "dev_info": { + "device_type": "LED", + "device_name": "FAN_LED" + }, + "dev_attr": { + "index": "0" + }, + "i2c": { + "attr_list": [{ + "attr_name": "STATUS_LED_COLOR_RED", + "descr": "Red", + "bits": "2:0", + "value": "0x2", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x974" + }, + { + "attr_name": "STATUS_LED_COLOR_RED_BLINK", + "descr": "Red Blinking", + "bits": "2:0", + "value": "0x1", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x974" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN", + "descr": "Green", + "bits": "2:0", + "value": "0x4", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x974" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN_BLINK", + "descr": "Green Blinking", + "bits": "2:0", + "value": "0x3", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x974" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER", + "descr": "Amber", + "bits": "2:0", + "value": "0x6", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x974" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER_BLINK", + "descr": "Amber Blinking", + "bits": "2:0", + "value": "0x5", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x974" + }, + { + "attr_name": "STATUS_LED_COLOR_OFF", + "descr": "Off", + "bits": "2:0", + "value": "0x0", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x974" + } + ] + } + }, + + "FANTRAY1_LED": { + "dev_info": { + "device_type": "LED", + "device_name": "FANTRAY_LED" + }, + "dev_attr": { + "index": "0" + }, + "i2c": { + "attr_list": [{ + "attr_name": "STATUS_LED_COLOR_RED", + "descr": "Red", + "bits": "2:0", + "value": "0x2", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3b" + }, + { + "attr_name": "STATUS_LED_COLOR_RED_BLINK", + "descr": "Red Blinking", + "bits": "2:0", + "value": "0x1", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3b" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN", + "descr": "Green", + "bits": "2:0", + "value": "0x4", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3b" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN_BLINK", + "descr": "Green Blinking", + "bits": "2:0", + "value": "0x3", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3b" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER", + "descr": "Amber", + "bits": "2:0", + "value": "0x6", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3b" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER_BLINK", + "descr": "Amber Blinking", + "bits": "2:0", + "value": "0x5", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3b" + }, + { + "attr_name": "STATUS_LED_COLOR_OFF", + "descr": "Off", + "bits": "2:0", + "value": "0x0", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3b" + } + ] + } + }, + + "FANTRAY2_LED": { + "dev_info": { + "device_type": "LED", + "device_name": "FANTRAY_LED" + }, + "dev_attr": { + "index": "1" + }, + "i2c": { + "attr_list": [{ + "attr_name": "STATUS_LED_COLOR_RED", + "descr": "Red", + "bits": "2:0", + "value": "0x2", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3c" + }, + { + "attr_name": "STATUS_LED_COLOR_RED_BLINK", + "descr": "Red Blinking", + "bits": "2:0", + "value": "0x1", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3c" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN", + "descr": "Green", + "bits": "2:0", + "value": "0x4", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3c" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN_BLINK", + "descr": "Green Blinking", + "bits": "2:0", + "value": "0x3", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3c" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER", + "descr": "Amber", + "bits": "2:0", + "value": "0x6", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3c" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER_BLINK", + "descr": "Amber Blinking", + "bits": "2:0", + "value": "0x5", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3c" + }, + { + "attr_name": "STATUS_LED_COLOR_OFF", + "descr": "Off", + "bits": "2:0", + "value": "0x0", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3c" + } + ] + } + }, + + "FANTRAY3_LED": { + "dev_info": { + "device_type": "LED", + "device_name": "FANTRAY_LED" + }, + "dev_attr": { + "index": "2" + }, + "i2c": { + "attr_list": [{ + "attr_name": "STATUS_LED_COLOR_RED", + "descr": "Red", + "bits": "2:0", + "value": "0x2", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3d" + }, + { + "attr_name": "STATUS_LED_COLOR_RED_BLINK", + "descr": "Red Blinking", + "bits": "2:0", + "value": "0x1", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3d" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN", + "descr": "Green", + "bits": "2:0", + "value": "0x4", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3d" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN_BLINK", + "descr": "Green Blinking", + "bits": "2:0", + "value": "0x3", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3d" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER", + "descr": "Amber", + "bits": "2:0", + "value": "0x6", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3d" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER_BLINK", + "descr": "Amber Blinking", + "bits": "2:0", + "value": "0x5", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3d" + }, + { + "attr_name": "STATUS_LED_COLOR_OFF", + "descr": "Off", + "bits": "2:0", + "value": "0x0", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3d" + } + ] + } + }, + + "FANTRAY4_LED": { + "dev_info": { + "device_type": "LED", + "device_name": "FANTRAY_LED" + }, + "dev_attr": { + "index": "3" + }, + "i2c": { + "attr_list": [{ + "attr_name": "STATUS_LED_COLOR_RED", + "descr": "Red", + "bits": "2:0", + "value": "0x2", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3e" + }, + { + "attr_name": "STATUS_LED_COLOR_RED_BLINK", + "descr": "Red Blinking", + "bits": "2:0", + "value": "0x1", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3e" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN", + "descr": "Green", + "bits": "2:0", + "value": "0x4", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3e" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN_BLINK", + "descr": "Green Blinking", + "bits": "2:0", + "value": "0x3", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3e" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER", + "descr": "Amber", + "bits": "2:0", + "value": "0x6", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3e" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER_BLINK", + "descr": "Amber Blinking", + "bits": "2:0", + "value": "0x5", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3e" + }, + { + "attr_name": "STATUS_LED_COLOR_OFF", + "descr": "Off", + "bits": "2:0", + "value": "0x0", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3e" + } + ] + } + }, + + "FANTRAY5_LED": { + "dev_info": { + "device_type": "LED", + "device_name": "FANTRAY_LED" + }, + "dev_attr": { + "index": "4" + }, + "i2c": { + "attr_list": [{ + "attr_name": "STATUS_LED_COLOR_RED", + "descr": "Red", + "bits": "2:0", + "value": "0x2", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3f" + }, + { + "attr_name": "STATUS_LED_COLOR_RED_BLINK", + "descr": "Red Blinking", + "bits": "2:0", + "value": "0x1", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3f" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN", + "descr": "Green", + "bits": "2:0", + "value": "0x4", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3f" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN_BLINK", + "descr": "Green Blinking", + "bits": "2:0", + "value": "0x3", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3f" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER", + "descr": "Amber", + "bits": "2:0", + "value": "0x6", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3f" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER_BLINK", + "descr": "Amber Blinking", + "bits": "2:0", + "value": "0x5", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3f" + }, + { + "attr_name": "STATUS_LED_COLOR_OFF", + "descr": "Off", + "bits": "2:0", + "value": "0x0", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3f" + } + ] + } + } +} diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/pddf_support b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/pddf_support new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/platform_asic b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/plugins/eeprom.py b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/plugins/eeprom.py new file mode 100644 index 000000000000..3384c2cbd693 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/plugins/eeprom.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +try: + from sonic_eeprom import eeprom_tlvinfo +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/1-0056/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/plugins/psuutil.py b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/plugins/psuutil.py new file mode 100644 index 000000000000..6d1ef8710cea --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/plugins/psuutil.py @@ -0,0 +1,63 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + def get_num_psus(self): + return 2 + + def get_psu_status(self, index): + if index != 1 and index != 2: + return False + + psu_path = "/sys/bus/i2c/devices/6-000d/psu_status" + + try: + data = open(psu_path, "rb") + except IOError: + return False + + result = int(data.read(2), 16) + data.close() + + if index == 1 and (result & 0x2): + return True + + if index == 2 and (result & 0x20): + return True + + return False + + def get_psu_presence(self, index): + if index != 1 and index != 2: + return False + + psu_path = "/sys/bus/i2c/devices/6-000d/psu_status" + + try: + data = open(psu_path, "rb") + except IOError: + return False + + result = int(data.read(2), 16) + data.close() + + if index == 1 and (result & 0x1) == 0: + return True + + if index == 2 and (result & 0x10) == 0: + return True + + return False diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/plugins/sfputil.py b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/plugins/sfputil.py new file mode 100644 index 000000000000..51285b5401b7 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/plugins/sfputil.py @@ -0,0 +1,255 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import time + import os + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + PORT_START = 0 + PORT_END = 31 + PORTS_IN_BLOCK = 32 + + EEPROM_OFFSET = 32 + SFP_DEVICE_TYPE = "optoe2" + QSFP_DEVICE_TYPE = "optoe1" + I2C_MAX_ATTEMPT = 3 + + SFP_STATUS_INSERTED = '1' + SFP_STATUS_REMOVED = '0' + + _port_to_eeprom_mapping = {} + port_to_i2cbus_mapping ={} + port_dict = {} + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + for x in range(self.PORT_START, self.PORTS_IN_BLOCK): + self.port_to_i2cbus_mapping[x] = (x + self.EEPROM_OFFSET) + SfpUtilBase.__init__(self) + + def _sfp_read_file_path(self, file_path, offset, num_bytes): + attempts = 0 + while attempts < self.I2C_MAX_ATTEMPT: + try: + file_path.seek(offset) + read_buf = file_path.read(num_bytes) + except Exception: + attempts += 1 + time.sleep(0.05) + else: + return True, read_buf + return False, None + + def _sfp_eeprom_present(self, sysfs_sfp_i2c_client_eeprompath, offset): + """Tries to read the eeprom file to determine if the + device/sfp is present or not. If sfp present, the read returns + valid bytes. If not, read returns error 'Connection timed out""" + + if not os.path.exists(sysfs_sfp_i2c_client_eeprompath): + return False + else: + with open(sysfs_sfp_i2c_client_eeprompath, "rb", buffering=0) as sysfsfile: + rv, buf = self._sfp_read_file_path(sysfsfile, offset, 1) + return rv + + def _add_new_sfp_device(self, sysfs_sfp_i2c_adapter_path, devaddr, devtype): + try: + sysfs_nd_path = "%s/new_device" % sysfs_sfp_i2c_adapter_path + + # Write device address to new_device file + nd_file = open(sysfs_nd_path, "w") + nd_str = "%s %s" % (devtype, hex(devaddr)) + nd_file.write(nd_str) + nd_file.close() + + except Exception as err: + print("Error writing to new device file: %s" % str(err)) + return 1 + else: + return 0 + + def _get_port_eeprom_path(self, port_num, devid): + sysfs_i2c_adapter_base_path = "" + + if port_num in self.port_to_eeprom_mapping.keys(): + sysfs_sfp_i2c_client_eeprom_path = self.port_to_eeprom_mapping[port_num] + else: + sysfs_i2c_adapter_base_path = "/sys/class/i2c-adapter" + + i2c_adapter_id = self._get_port_i2c_adapter_id(port_num) + if i2c_adapter_id is None: + print("Error getting i2c bus num") + return None + + # Get i2c virtual bus path for the sfp + sysfs_sfp_i2c_adapter_path = "%s/i2c-%s" % (sysfs_i2c_adapter_base_path, + str(i2c_adapter_id)) + + # If i2c bus for port does not exist + if not os.path.exists(sysfs_sfp_i2c_adapter_path): + print("Could not find i2c bus %s. Driver not loaded?" % sysfs_sfp_i2c_adapter_path) + return None + + sysfs_sfp_i2c_client_path = "%s/%s-00%s" % (sysfs_sfp_i2c_adapter_path, + str(i2c_adapter_id), + hex(devid)[-2:]) + + # If sfp device is not present on bus, Add it + if not os.path.exists(sysfs_sfp_i2c_client_path): + if port_num in self.qsfp_ports: + ret = self._add_new_sfp_device( + sysfs_sfp_i2c_adapter_path, devid, self.QSFP_DEVICE_TYPE) + else: + ret = self._add_new_sfp_device( + sysfs_sfp_i2c_adapter_path, devid, self.SFP_DEVICE_TYPE) + if ret != 0: + print("Error adding sfp device") + return None + + sysfs_sfp_i2c_client_eeprom_path = "%s/eeprom" % sysfs_sfp_i2c_client_path + + return sysfs_sfp_i2c_client_eeprom_path + + def _read_eeprom_specific_bytes(self, sysfsfile_eeprom, offset, num_bytes): + eeprom_raw = [] + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + rv, raw = self._sfp_read_file_path(sysfsfile_eeprom, offset, num_bytes) + if rv == False: + return None + + try: + for n in range(0, num_bytes): + eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + except Exception: + return None + + return eeprom_raw + + def get_eeprom_dom_raw(self, port_num): + if port_num in self.qsfp_ports: + # QSFP DOM EEPROM is also at addr 0x50 and thus also stored in eeprom_ifraw + return None + else: + # Read dom eeprom at addr 0x51 + return self._read_eeprom_devid(port_num, self.IDENTITY_EEPROM_ADDR, 256) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + if port_num <= 7: + presence_path = "/sys/bus/i2c/devices/8-0030/sfp_presence1" + elif port_num >= 8 and port_num <= 15: + presence_path = "/sys/bus/i2c/devices/8-0030/sfp_presence2" + elif port_num >= 16 and port_num <= 23: + presence_path = "/sys/bus/i2c/devices/8-0031/sfp_presence3" + elif port_num >= 24 and port_num <= 31: + presence_path = "/sys/bus/i2c/devices/8-0031/sfp_presence4" + else: + return False + + try: + data = open(presence_path, "rb") + except IOError: + return False + + presence_data = data.read(2) + if presence_data == "": + return False + result = int(presence_data, 16) + data.close() + + # ModPrsL is active low + if result & (1 << (port_num % 8)) == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + + return True + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + return True + + def get_transceiver_change_event(self, timeout=0): + + start_time = time.time() + currernt_port_dict = {} + forever = False + + if timeout == 0: + forever = True + elif timeout > 0: + timeout = timeout / float(1000) # Convert to secs + else: + print ("get_transceiver_change_event:Invalid timeout value", timeout) + return False, {} + + end_time = start_time + timeout + if start_time > end_time: + print ('get_transceiver_change_event:' \ + 'time wrap / invalid timeout value', timeout) + + return False, {} # Time wrap or possibly incorrect timeout + + while timeout >= 0: + # Check for OIR events and return updated port_dict + for x in range(self.PORT_START, self.PORTS_IN_BLOCK): + if self.get_presence(x): + currernt_port_dict[x] = self.SFP_STATUS_INSERTED + else: + currernt_port_dict[x] = self.SFP_STATUS_REMOVED + if (currernt_port_dict == self.port_dict): + if forever: + time.sleep(1) + else: + timeout = end_time - time.time() + if timeout >= 1: + time.sleep(1) # We poll at 1 second granularity + else: + if timeout > 0: + time.sleep(timeout) + return True, {} + else: + # Update reg value + self.port_dict = currernt_port_dict + return True, self.port_dict + print ("get_transceiver_change_event: Should not reach here.") + return False, {} diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/pmon_daemon_control.json b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/pmon_daemon_control.json new file mode 100644 index 000000000000..94592fa8cebc --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/pmon_daemon_control.json @@ -0,0 +1,3 @@ +{ + "skip_ledd": true +} diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/sensors.conf b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/sensors.conf new file mode 100644 index 000000000000..9b0569d1541d --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/sensors.conf @@ -0,0 +1,21 @@ +# libsensors configuration file +# ---------------------------------------------- +# + +bus "i2c-2" "i2c-0-mux (chan_id 0)" + +chip "lm75-i2c-2-48" + label temp1 "LM75_0 air_inlet" + set temp1_max 80 + set temp1_max_hyst 75 + +chip "lm75-i2c-2-49" + label temp1 "LM75_1 air_outlet" + set temp1_max 80 + set temp1_max_hyst 75 + +chip "lm75-i2c-2-4a" + label temp1 "LM75_2 hottest" + set temp1_max 80 + set temp1_max_hyst 75 + diff --git a/device/ragile/x86_64-ragile_ra-b6510-32c-r0/systest.py b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/systest.py new file mode 100644 index 000000000000..b40bf45b2c19 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-32c-r0/systest.py @@ -0,0 +1,43 @@ +#!/usr/bin/python +# -*- coding: UTF-8 -*- + +# * onboard interval check +# * FAN trays +# * PSU +# * temp +import time +import datetime +from monitor import status + +def doWork(): + a=[]; + ''' + return: [{'status': '1', 'hw_version': '1.00', 'errcode': 0, 'fan_type': 'M6510-FAN-F', 'errmsg': 'OK', 'Speed': '9778', 'id': 'fan1', 'present': '0', 'sn': '1000000000014'}, + {'id': 'fan2', 'errmsg': 'not present', 'errcode': -1}, + {'id': 'fan3', 'errmsg': 'not present', 'errcode': -1}, + {'id': 'fan4', 'errmsg': 'not present', 'errcode': -1} + ] + description: 1.get id + 2.errcode equal 0 : dev normal + not equal 0 : get errmsg + 3.other message add when all check success + ''' + status.checkFan(a) + #status.getTemp(a) + #status.getPsu(a) + + nowTime=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + print nowTime + print a +def run(interval): + while True: + try: + time_remaining = interval - time.time()%interval + time.sleep(time_remaining) + doWork() + except Exception as e: + print(e) + +if __name__ == '__main__': + interval = 1 + run(interval) diff --git a/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/default_sku b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/default_sku index 3f0585c6e5b5..ce572db7c3c9 100644 --- a/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/default_sku +++ b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/default_sku @@ -1 +1 @@ -B6510-48VS8CQ t1 +RA-B6510-48V8C t1 diff --git a/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/platform_asic b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6510-48v8c-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/ragile/x86_64-ragile_ra-b6910-64c-r0/platform_asic b/device/ragile/x86_64-ragile_ra-b6910-64c-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6910-64c-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/RA-B6920-4S/port_config.ini b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/RA-B6920-4S/port_config.ini new file mode 100644 index 000000000000..6a516970cd8b --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/RA-B6920-4S/port_config.ini @@ -0,0 +1,129 @@ +# name lanes alias index speed +Ethernet1 65,66 hundredGigE0/1 0 100000 +Ethernet2 67,68 hundredGigE0/2 1 100000 +Ethernet3 69,70 hundredGigE0/3 2 100000 +Ethernet4 71,72 hundredGigE0/4 3 100000 +Ethernet5 81,82 hundredGigE0/5 4 100000 +Ethernet6 83,84 hundredGigE0/6 5 100000 +Ethernet7 85,86 hundredGigE0/7 6 100000 +Ethernet8 87,88 hundredGigE0/8 7 100000 +Ethernet9 97,98 hundredGigE0/9 8 100000 +Ethernet10 99,100 hundredGigE0/10 9 100000 +Ethernet11 101,102 hundredGigE0/11 10 100000 +Ethernet12 103,104 hundredGigE0/12 11 100000 +Ethernet13 113,114 hundredGigE0/13 12 100000 +Ethernet14 115,116 hundredGigE0/14 13 100000 +Ethernet15 117,118 hundredGigE0/15 14 100000 +Ethernet16 119,120 hundredGigE0/16 15 100000 +Ethernet17 137,138 hundredGigE0/17 16 100000 +Ethernet18 139,140 hundredGigE0/18 17 100000 +Ethernet19 141,142 hundredGigE0/19 18 100000 +Ethernet20 143,144 hundredGigE0/20 19 100000 +Ethernet21 153,154 hundredGigE0/21 20 100000 +Ethernet22 155,156 hundredGigE0/22 21 100000 +Ethernet23 157,158 hundredGigE0/23 22 100000 +Ethernet24 159,160 hundredGigE0/24 23 100000 +Ethernet25 169,170 hundredGigE0/25 24 100000 +Ethernet26 171,172 hundredGigE0/26 25 100000 +Ethernet27 173,174 hundredGigE0/27 26 100000 +Ethernet28 175,176 hundredGigE0/28 27 100000 +Ethernet29 185,186 hundredGigE0/29 28 100000 +Ethernet30 187,188 hundredGigE0/30 29 100000 +Ethernet31 189,190 hundredGigE0/31 30 100000 +Ethernet32 191,192 hundredGigE0/32 31 100000 +Ethernet33 73,74 hundredGigE0/33 32 100000 +Ethernet34 75,76 hundredGigE0/34 33 100000 +Ethernet35 77,78 hundredGigE0/35 34 100000 +Ethernet36 79,80 hundredGigE0/36 35 100000 +Ethernet37 89,90 hundredGigE0/37 36 100000 +Ethernet38 91,92 hundredGigE0/38 37 100000 +Ethernet39 93,94 hundredGigE0/39 38 100000 +Ethernet40 95,96 hundredGigE0/40 39 100000 +Ethernet41 105,106 hundredGigE0/41 40 100000 +Ethernet42 107,108 hundredGigE0/42 41 100000 +Ethernet43 109,110 hundredGigE0/43 42 100000 +Ethernet44 111,112 hundredGigE0/44 43 100000 +Ethernet45 121,122 hundredGigE0/45 44 100000 +Ethernet46 123,124 hundredGigE0/46 45 100000 +Ethernet47 125,126 hundredGigE0/47 46 100000 +Ethernet48 127,128 hundredGigE0/48 47 100000 +Ethernet49 129,130 hundredGigE0/49 48 100000 +Ethernet50 131,132 hundredGigE0/50 49 100000 +Ethernet51 133,134 hundredGigE0/51 50 100000 +Ethernet52 135,136 hundredGigE0/52 51 100000 +Ethernet53 145,146 hundredGigE0/53 52 100000 +Ethernet54 147,148 hundredGigE0/54 53 100000 +Ethernet55 149,150 hundredGigE0/55 54 100000 +Ethernet56 151,152 hundredGigE0/56 55 100000 +Ethernet57 161,162 hundredGigE0/57 56 100000 +Ethernet58 163,164 hundredGigE0/58 57 100000 +Ethernet59 165,166 hundredGigE0/59 58 100000 +Ethernet60 167,168 hundredGigE0/60 59 100000 +Ethernet61 177,178 hundredGigE0/61 60 100000 +Ethernet62 179,180 hundredGigE0/62 61 100000 +Ethernet63 181,182 hundredGigE0/63 62 100000 +Ethernet64 183,184 hundredGigE0/64 63 100000 +Ethernet65 9,10 hundredGigE0/65 64 100000 +Ethernet66 11,12 hundredGigE0/66 65 100000 +Ethernet67 13,14 hundredGigE0/67 66 100000 +Ethernet68 15,16 hundredGigE0/68 67 100000 +Ethernet69 25,26 hundredGigE0/69 68 100000 +Ethernet70 27,28 hundredGigE0/70 69 100000 +Ethernet71 29,30 hundredGigE0/71 70 100000 +Ethernet72 31,32 hundredGigE0/72 71 100000 +Ethernet73 41,42 hundredGigE0/73 72 100000 +Ethernet74 43,44 hundredGigE0/74 73 100000 +Ethernet75 45,46 hundredGigE0/75 74 100000 +Ethernet76 47,48 hundredGigE0/76 75 100000 +Ethernet77 57,58 hundredGigE0/77 76 100000 +Ethernet78 59,60 hundredGigE0/78 77 100000 +Ethernet79 61,62 hundredGigE0/79 78 100000 +Ethernet80 63,64 hundredGigE0/80 79 100000 +Ethernet81 193,194 hundredGigE0/81 80 100000 +Ethernet82 195,196 hundredGigE0/82 81 100000 +Ethernet83 197,198 hundredGigE0/83 82 100000 +Ethernet84 199,200 hundredGigE0/84 83 100000 +Ethernet85 209,210 hundredGigE0/85 84 100000 +Ethernet86 211,212 hundredGigE0/86 85 100000 +Ethernet87 213,214 hundredGigE0/87 86 100000 +Ethernet88 215,216 hundredGigE0/88 87 100000 +Ethernet89 225,226 hundredGigE0/89 88 100000 +Ethernet90 227,228 hundredGigE0/90 89 100000 +Ethernet91 229,230 hundredGigE0/91 90 100000 +Ethernet92 231,232 hundredGigE0/92 91 100000 +Ethernet93 241,242 hundredGigE0/93 92 100000 +Ethernet94 243,244 hundredGigE0/94 93 100000 +Ethernet95 245,246 hundredGigE0/95 94 100000 +Ethernet96 247,248 hundredGigE0/96 95 100000 +Ethernet97 1,2 hundredGigE0/97 96 100000 +Ethernet98 3,4 hundredGigE0/98 97 100000 +Ethernet99 5,6 hundredGigE0/99 98 100000 +Ethernet100 7,8 hundredGigE0/100 99 100000 +Ethernet101 17,18 hundredGigE0/101 100 100000 +Ethernet102 19,20 hundredGigE0/102 101 100000 +Ethernet103 21,22 hundredGigE0/103 102 100000 +Ethernet104 23,24 hundredGigE0/104 103 100000 +Ethernet105 33,34 hundredGigE0/105 104 100000 +Ethernet106 35,36 hundredGigE0/106 105 100000 +Ethernet107 37,38 hundredGigE0/107 106 100000 +Ethernet108 39,40 hundredGigE0/108 107 100000 +Ethernet109 49,50 hundredGigE0/109 108 100000 +Ethernet110 51,52 hundredGigE0/110 109 100000 +Ethernet111 53,54 hundredGigE0/111 110 100000 +Ethernet112 55,56 hundredGigE0/112 111 100000 +Ethernet113 201,202 hundredGigE0/113 112 100000 +Ethernet114 203,204 hundredGigE0/114 113 100000 +Ethernet115 205,206 hundredGigE0/115 114 100000 +Ethernet116 207,208 hundredGigE0/116 115 100000 +Ethernet117 217,218 hundredGigE0/117 116 100000 +Ethernet118 219,220 hundredGigE0/118 117 100000 +Ethernet119 221,222 hundredGigE0/119 118 100000 +Ethernet120 223,224 hundredGigE0/120 119 100000 +Ethernet121 233,234 hundredGigE0/121 120 100000 +Ethernet122 235,236 hundredGigE0/122 121 100000 +Ethernet123 237,238 hundredGigE0/123 122 100000 +Ethernet124 239,240 hundredGigE0/124 123 100000 +Ethernet125 249,250 hundredGigE0/125 124 100000 +Ethernet126 251,252 hundredGigE0/126 125 100000 +Ethernet127 253,254 hundredGigE0/127 126 100000 +Ethernet128 255,256 hundredGigE0/128 127 100000 diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/RA-B6920-4S/sai.profile b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/RA-B6920-4S/sai.profile new file mode 100644 index 000000000000..f59730cc941a --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/RA-B6920-4S/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th3-ra-b6920-4s-128x100G.config.bcm diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/RA-B6920-4S/th3-ra-b6920-4s-128x100G.config.bcm b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/RA-B6920-4S/th3-ra-b6920-4s-128x100G.config.bcm new file mode 100644 index 000000000000..61bb14f547f1 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/RA-B6920-4S/th3-ra-b6920-4s-128x100G.config.bcm @@ -0,0 +1,708 @@ + #This is for a 4slot* 32*100G configuration PAM4 mode (2 lanes per 100G) +#rate_ext_mdio_divisor=100 +port_init_cl72=0 +port_init_autoneg=0 +pcie_file=/usr/share/sonic/platform/pcie.cint +capi_level=1 +port_fec=3 +phy_gearbox_enable.0=1 +phy_pin_compatibility_enable.0=0 +cfg_int_phy_ctrl.0=1 +mmu_port_num_mc_queue=2 +bcm_tunnel_term_compatible_mode=1 +pbmp_xport_xe.0=0x8ffff8ffffcffff8ffff8ffff8ffffcffff9fffe +#serdes_tx_taps_ce=pam4:0:140:0:0:0:0 +ccm_dma_enable=0 +ccmdma_intr_enable=0 +ctr_evict_enable=0 +mem_cache_enable=0 +parity_correction=0 +parity_enable=0 +phy_enable=1 +phy_null=1 +fpem_mem_entries=65536 +pll_bypass=1 +init_all_modules=0 +l3_mem_entries=16384 +l3_alpm_enable=2 +ipv6_lpm_128b_enable=0x1 +l3_max_ecmp_mode=1 + +stand_alone_phy_init=1 +port_phy_addr_1.0=0x220 +port_phy_addr_2.0=0x220 +port_phy_addr_3.0=0x220 +port_phy_addr_4.0=0x220 +port_phy_addr_13.0=0x224 +port_phy_addr_14.0=0x224 +port_phy_addr_15.0=0x224 +port_phy_addr_16.0=0x224 +port_phy_addr_20.0=0x248 +port_phy_addr_21.0=0x248 +port_phy_addr_22.0=0x248 +port_phy_addr_23.0=0x248 +port_phy_addr_32.0=0x22c +port_phy_addr_33.0=0x22c +port_phy_addr_34.0=0x22c +port_phy_addr_35.0=0x22c +port_phy_addr_124.0=0x250 +port_phy_addr_125.0=0x250 +port_phy_addr_126.0=0x250 +port_phy_addr_127.0=0x250 +port_phy_addr_128.0=0x254 +port_phy_addr_129.0=0x254 +port_phy_addr_130.0=0x254 +port_phy_addr_131.0=0x254 +port_phy_addr_144.0=0x278 +port_phy_addr_145.0=0x278 +port_phy_addr_146.0=0x278 +port_phy_addr_147.0=0x278 +port_phy_addr_148.0=0x27c +port_phy_addr_149.0=0x27c +port_phy_addr_150.0=0x27c +port_phy_addr_151.0=0x27c +port_phy_addr_5.0=0x140 +port_phy_addr_6.0=0x140 +port_phy_addr_7.0=0x140 +port_phy_addr_8.0=0x140 +port_phy_addr_9.0=0x144 +port_phy_addr_10.0=0x144 +port_phy_addr_11.0=0x144 +port_phy_addr_12.0=0x144 +port_phy_addr_24.0=0x168 +port_phy_addr_25.0=0x168 +port_phy_addr_26.0=0x168 +port_phy_addr_27.0=0x168 +port_phy_addr_28.0=0x14c +port_phy_addr_29.0=0x14c +port_phy_addr_30.0=0x14c +port_phy_addr_31.0=0x14c +port_phy_addr_120.0=0x170 +port_phy_addr_121.0=0x170 +port_phy_addr_122.0=0x170 +port_phy_addr_123.0=0x170 +port_phy_addr_132.0=0x174 +port_phy_addr_133.0=0x174 +port_phy_addr_134.0=0x174 +port_phy_addr_135.0=0x174 +port_phy_addr_140.0=0x218 +port_phy_addr_141.0=0x218 +port_phy_addr_142.0=0x218 +port_phy_addr_143.0=0x218 +port_phy_addr_152.0=0x21c +port_phy_addr_153.0=0x21c +port_phy_addr_154.0=0x21c +port_phy_addr_155.0=0x21c +port_phy_addr_44.0=0x60 +port_phy_addr_45.0=0x60 +port_phy_addr_46.0=0x60 +port_phy_addr_47.0=0x60 +port_phy_addr_52.0=0x64 +port_phy_addr_53.0=0x64 +port_phy_addr_54.0=0x64 +port_phy_addr_55.0=0x64 +port_phy_addr_64.0=0x108 +port_phy_addr_65.0=0x108 +port_phy_addr_66.0=0x108 +port_phy_addr_67.0=0x108 +port_phy_addr_72.0=0x6c +port_phy_addr_73.0=0x6c +port_phy_addr_74.0=0x6c +port_phy_addr_75.0=0x6c +port_phy_addr_80.0=0x110 +port_phy_addr_81.0=0x110 +port_phy_addr_82.0=0x110 +port_phy_addr_83.0=0x110 +port_phy_addr_88.0=0x114 +port_phy_addr_89.0=0x114 +port_phy_addr_90.0=0x114 +port_phy_addr_91.0=0x114 +port_phy_addr_100.0=0x138 +port_phy_addr_101.0=0x138 +port_phy_addr_102.0=0x138 +port_phy_addr_103.0=0x138 +port_phy_addr_108.0=0x13c +port_phy_addr_109.0=0x13c +port_phy_addr_110.0=0x13c +port_phy_addr_111.0=0x13c +port_phy_addr_40.0=0x0 +port_phy_addr_41.0=0x0 +port_phy_addr_42.0=0x0 +port_phy_addr_43.0=0x0 +port_phy_addr_48.0=0x4 +port_phy_addr_49.0=0x4 +port_phy_addr_50.0=0x4 +port_phy_addr_51.0=0x4 +port_phy_addr_60.0=0x28 +port_phy_addr_61.0=0x28 +port_phy_addr_62.0=0x28 +port_phy_addr_63.0=0x28 +port_phy_addr_68.0=0xc +port_phy_addr_69.0=0xc +port_phy_addr_70.0=0xc +port_phy_addr_71.0=0xc +port_phy_addr_84.0=0x30 +port_phy_addr_85.0=0x30 +port_phy_addr_86.0=0x30 +port_phy_addr_87.0=0x30 +port_phy_addr_92.0=0x34 +port_phy_addr_93.0=0x34 +port_phy_addr_94.0=0x34 +port_phy_addr_95.0=0x34 +port_phy_addr_104.0=0x58 +port_phy_addr_105.0=0x58 +port_phy_addr_106.0=0x58 +port_phy_addr_107.0=0x58 +port_phy_addr_112.0=0x5c +port_phy_addr_113.0=0x5c +port_phy_addr_114.0=0x5c +port_phy_addr_115.0=0x5c + +sap_rx_polarity_flip_1.0=0x2000 +sap_rx_polarity_flip_13.0=0x2000 +sap_rx_polarity_flip_20.0=0x2000 +sap_rx_polarity_flip_32.0=0x2000 +sap_rx_polarity_flip_124.0=0x2000 +sap_rx_polarity_flip_128.0=0x2000 +sap_rx_polarity_flip_144.0=0x2000 +sap_rx_polarity_flip_148.0=0x2000 +sap_rx_polarity_flip_5.0=0x2000 +sap_rx_polarity_flip_9.0=0x2000 +sap_rx_polarity_flip_24.0=0x2000 +sap_rx_polarity_flip_28.0=0x2000 +sap_rx_polarity_flip_120.0=0x2000 +sap_rx_polarity_flip_132.0=0x2000 +sap_rx_polarity_flip_140.0=0x2000 +sap_rx_polarity_flip_152.0=0x2000 +sap_rx_polarity_flip_44.0=0x2000 +sap_rx_polarity_flip_52.0=0x2000 +sap_rx_polarity_flip_64.0=0x2000 +sap_rx_polarity_flip_72.0=0x2000 +sap_rx_polarity_flip_80.0=0x2000 +sap_rx_polarity_flip_88.0=0x2000 +sap_rx_polarity_flip_100.0=0x2000 +sap_rx_polarity_flip_108.0=0x2000 +sap_rx_polarity_flip_40.0=0x2000 +sap_rx_polarity_flip_48.0=0x2000 +sap_rx_polarity_flip_60.0=0x2000 +sap_rx_polarity_flip_68.0=0x2000 +sap_rx_polarity_flip_84.0=0x2000 +sap_rx_polarity_flip_92.0=0x2000 +sap_rx_polarity_flip_104.0=0x2000 +sap_rx_polarity_flip_112.0=0x2000 + +sap_tx_polarity_flip_1.0=0x8414 +sap_tx_polarity_flip_13.0=0x8414 +sap_tx_polarity_flip_20.0=0x8414 +sap_tx_polarity_flip_32.0=0x8414 +sap_tx_polarity_flip_124.0=0x8414 +sap_tx_polarity_flip_128.0=0x8414 +sap_tx_polarity_flip_144.0=0x8414 +sap_tx_polarity_flip_148.0=0x8414 +sap_tx_polarity_flip_5.0=0x8414 +sap_tx_polarity_flip_9.0=0x8414 +sap_tx_polarity_flip_24.0=0x8414 +sap_tx_polarity_flip_28.0=0x8414 +sap_tx_polarity_flip_120.0=0x8414 +sap_tx_polarity_flip_132.0=0x8414 +sap_tx_polarity_flip_140.0=0x8414 +sap_tx_polarity_flip_152.0=0x8414 +sap_tx_polarity_flip_44.0=0x8414 +sap_tx_polarity_flip_52.0=0x8414 +sap_tx_polarity_flip_64.0=0x8414 +sap_tx_polarity_flip_72.0=0x8414 +sap_tx_polarity_flip_80.0=0x8414 +sap_tx_polarity_flip_88.0=0x8414 +sap_tx_polarity_flip_100.0=0x8414 +sap_tx_polarity_flip_108.0=0x8414 +sap_tx_polarity_flip_40.0=0x8414 +sap_tx_polarity_flip_48.0=0x8414 +sap_tx_polarity_flip_60.0=0x8414 +sap_tx_polarity_flip_68.0=0x8414 +sap_tx_polarity_flip_84.0=0x8414 +sap_tx_polarity_flip_92.0=0x8414 +sap_tx_polarity_flip_104.0=0x8414 +sap_tx_polarity_flip_112.0=0x8414 + +sap_mdio_num_1.0=9 +sap_mdio_num_13.0=9 +sap_mdio_num_20.0=10 +sap_mdio_num_32.0=9 +sap_mdio_num_124.0=10 +sap_mdio_num_128.0=10 +sap_mdio_num_144.0=11 +sap_mdio_num_148.0=11 +sap_mdio_num_5.0=6 +sap_mdio_num_9.0=6 +sap_mdio_num_24.0=7 +sap_mdio_num_28.0=6 +sap_mdio_num_120.0=7 +sap_mdio_num_132.0=7 +sap_mdio_num_140.0=8 +sap_mdio_num_152.0=8 +sap_mdio_num_44.0=3 +sap_mdio_num_52.0=3 +sap_mdio_num_64.0=4 +sap_mdio_num_72.0=3 +sap_mdio_num_80.0=4 +sap_mdio_num_88.0=4 +sap_mdio_num_100.0=5 +sap_mdio_num_108.0=5 +sap_mdio_num_40.0=0 +sap_mdio_num_48.0=0 +sap_mdio_num_60.0=1 +sap_mdio_num_68.0=0 +sap_mdio_num_84.0=1 +sap_mdio_num_92.0=1 +sap_mdio_num_104.0=2 +sap_mdio_num_112.0=2 + +#slot 1 bc 8 10 12 14 +portmap_40=65:100 +portmap_41=67:100 +portmap_42=69:100 +portmap_43=71:100 + +portmap_48=81:100 +portmap_49=83:100 +portmap_50=85:100 +portmap_51=87:100 + +portmap_60=97:100 +portmap_61=99:100 +portmap_62=101:100 +portmap_63=103:100 + +portmap_68=113:100 +portmap_69=115:100 +portmap_70=117:100 +portmap_71=119:100 + +#slot 1 bc 17 19 21 23 + +portmap_84=137:100 +portmap_85=139:100 +portmap_86=141:100 +portmap_87=143:100 + +portmap_92=153:100 +portmap_93=155:100 +portmap_94=157:100 +portmap_95=159:100 + +portmap_104=169:100 +portmap_105=171:100 +portmap_106=173:100 +portmap_107=175:100 + +portmap_112=185:100 +portmap_113=187:100 +portmap_114=189:100 +portmap_115=191:100 + +phy_chain_rx_lane_map_physical{65.0}=0x37046215 +phy_chain_tx_lane_map_physical{65.0}=0x75140623 +phy_chain_rx_lane_map_physical{81.0}=0x64301572 +phy_chain_tx_lane_map_physical{81.0}=0x52160374 +phy_chain_rx_lane_map_physical{97.0}=0x21537406 +phy_chain_tx_lane_map_physical{97.0}=0x62137450 +phy_chain_rx_lane_map_physical{113.0}=0x26107543 +phy_chain_tx_lane_map_physical{113.0}=0x61023754 +phy_chain_rx_lane_map_physical{137.0}=0x62130457 +phy_chain_tx_lane_map_physical{137.0}=0x15230746 +phy_chain_rx_lane_map_physical{153.0}=0x60157432 +phy_chain_tx_lane_map_physical{153.0}=0x34012576 +phy_chain_rx_lane_map_physical{169.0}=0x53026714 +phy_chain_tx_lane_map_physical{169.0}=0x34612057 +phy_chain_rx_lane_map_physical{185.0}=0x72456103 +phy_chain_tx_lane_map_physical{185.0}=0x25413076 + +serdes_core_rx_polarity_flip_physical{65}=0x48 +serdes_core_tx_polarity_flip_physical{65}=0xb1 +serdes_core_rx_polarity_flip_physical{81}=0x81 +serdes_core_tx_polarity_flip_physical{81}=0x2f +serdes_core_rx_polarity_flip_physical{97}=0x9c +serdes_core_tx_polarity_flip_physical{97}=0x02 +serdes_core_rx_polarity_flip_physical{113}=0xaf +serdes_core_tx_polarity_flip_physical{113}=0xd2 +serdes_core_rx_polarity_flip_physical{137}=0x2b +serdes_core_tx_polarity_flip_physical{137}=0x26 +serdes_core_rx_polarity_flip_physical{153}=0x0a +serdes_core_tx_polarity_flip_physical{153}=0xb0 +serdes_core_rx_polarity_flip_physical{169}=0x0d +serdes_core_tx_polarity_flip_physical{169}=0x3e +serdes_core_rx_polarity_flip_physical{185}=0xa2 +serdes_core_tx_polarity_flip_physical{185}=0x36 + +#slot 2 bc 9 11 13 15 +portmap_44=73:100 +portmap_45=75:100 +portmap_46=77:100 +portmap_47=79:100 + +portmap_52=89:100 +portmap_53=91:100 +portmap_54=93:100 +portmap_55=95:100 + +portmap_64=105:100 +portmap_65=107:100 +portmap_66=109:100 +portmap_67=111:100 + +portmap_72=121:100 +portmap_73=123:100 +portmap_74=125:100 +portmap_75=127:100 + +#bc 16 18 20 22 + +portmap_80=129:100 +portmap_81=131:100 +portmap_82=133:100 +portmap_83=135:100 + +portmap_88=145:100 +portmap_89=147:100 +portmap_90=149:100 +portmap_91=151:100 + +portmap_100=161:100 +portmap_101=163:100 +portmap_102=165:100 +portmap_103=167:100 + +portmap_108=177:100 +portmap_109=179:100 +portmap_110=181:100 +portmap_111=183:100 + +phy_chain_rx_lane_map_physical{73.0}=0x23760415 +phy_chain_tx_lane_map_physical{73.0}=0x31057624 +phy_chain_rx_lane_map_physical{89.0}=0x13204756 +phy_chain_tx_lane_map_physical{89.0}=0x31056724 +phy_chain_rx_lane_map_physical{105.0}=0x62375401 +phy_chain_tx_lane_map_physical{105.0}=0x54762310 +phy_chain_rx_lane_map_physical{121.0}=0x32107546 +phy_chain_tx_lane_map_physical{121.0}=0x67215340 +phy_chain_rx_lane_map_physical{129.0}=0x01236745 +phy_chain_tx_lane_map_physical{129.0}=0x65347012 +phy_chain_rx_lane_map_physical{145.0}=0x65723401 +phy_chain_tx_lane_map_physical{145.0}=0x47650132 +phy_chain_rx_lane_map_physical{161.0}=0x74532601 +phy_chain_tx_lane_map_physical{161.0}=0x67421350 +phy_chain_rx_lane_map_physical{177.0}=0x07516342 +phy_chain_tx_lane_map_physical{177.0}=0x67403152 + +serdes_core_rx_polarity_flip_physical{73}=0xb6 +serdes_core_tx_polarity_flip_physical{73}=0x25 +serdes_core_rx_polarity_flip_physical{89}=0x73 +serdes_core_tx_polarity_flip_physical{89}=0x27 +serdes_core_rx_polarity_flip_physical{105}=0x88 +serdes_core_tx_polarity_flip_physical{105}=0x9a +serdes_core_rx_polarity_flip_physical{121}=0xfa +serdes_core_tx_polarity_flip_physical{121}=0xe3 +serdes_core_rx_polarity_flip_physical{129}=0xf5 +serdes_core_tx_polarity_flip_physical{129}=0xe6 +serdes_core_rx_polarity_flip_physical{145}=0x3e +serdes_core_tx_polarity_flip_physical{145}=0x96 +serdes_core_rx_polarity_flip_physical{161}=0x0b +serdes_core_tx_polarity_flip_physical{161}=0x7a +serdes_core_rx_polarity_flip_physical{177}=0x8d +serdes_core_tx_polarity_flip_physical{177}=0x5a + +#slot 3 +#bc 1 3 5 7 + +portmap_5=9:100 +portmap_6=11:100 +portmap_7=13:100 +portmap_8=15:100 + +portmap_9=25:100 +portmap_10=27:100 +portmap_11=29:100 +portmap_12=31:100 + +portmap_24=41:100 +portmap_25=43:100 +portmap_26=45:100 +portmap_27=47:100 + +portmap_28=57:100 +portmap_29=59:100 +portmap_30=61:100 +portmap_31=63:100 + +#bc 24 26 28 30 +portmap_120=193:100 +portmap_121=195:100 +portmap_122=197:100 +portmap_123=199:100 + +portmap_132=209:100 +portmap_133=211:100 +portmap_134=213:100 +portmap_135=215:100 + +portmap_140=225:100 +portmap_141=227:100 +portmap_142=229:100 +portmap_143=231:100 + +portmap_152=241:100 +portmap_153=243:100 +portmap_154=245:100 +portmap_155=247:100 + +phy_chain_rx_lane_map_physical{9.0}=0x20541673 +phy_chain_tx_lane_map_physical{9.0}=0x32546107 +phy_chain_rx_lane_map_physical{25.0}=0x32104756 +phy_chain_tx_lane_map_physical{25.0}=0x30214756 +phy_chain_rx_lane_map_physical{41.0}=0x23610457 +phy_chain_tx_lane_map_physical{41.0}=0x57463201 +phy_chain_rx_lane_map_physical{57.0}=0x35671042 +phy_chain_tx_lane_map_physical{57.0}=0x47026351 +phy_chain_rx_lane_map_physical{193.0}=0x46712503 +phy_chain_tx_lane_map_physical{193.0}=0x57063241 +phy_chain_rx_lane_map_physical{209.0}=0x54302761 +phy_chain_tx_lane_map_physical{209.0}=0x50674312 +phy_chain_rx_lane_map_physical{225.0}=0x54762310 +phy_chain_tx_lane_map_physical{225.0}=0x65042371 +phy_chain_rx_lane_map_physical{241.0}=0x51026473 +phy_chain_tx_lane_map_physical{241.0}=0x40167532 + +serdes_core_rx_polarity_flip_physical{9}=0xac +serdes_core_tx_polarity_flip_physical{9}=0xfc +serdes_core_rx_polarity_flip_physical{25}=0xf7 +serdes_core_tx_polarity_flip_physical{25}=0x39 +serdes_core_rx_polarity_flip_physical{41}=0xd3 +serdes_core_tx_polarity_flip_physical{41}=0xb6 +serdes_core_rx_polarity_flip_physical{57}=0xad +serdes_core_tx_polarity_flip_physical{57}=0x61 +serdes_core_rx_polarity_flip_physical{193}=0x74 +serdes_core_tx_polarity_flip_physical{193}=0xd0 +serdes_core_rx_polarity_flip_physical{209}=0x9f +serdes_core_tx_polarity_flip_physical{209}=0x41 +serdes_core_rx_polarity_flip_physical{225}=0xfe +serdes_core_tx_polarity_flip_physical{225}=0x47 +serdes_core_rx_polarity_flip_physical{241}=0x5a +serdes_core_tx_polarity_flip_physical{241}=0xd9 + +#slot 4 +#bc 0 2 4 6 +portmap_1=1:100 +portmap_2=3:100 +portmap_3=5:100 +portmap_4=7:100 + +portmap_13=17:100 +portmap_14=19:100 +portmap_15=21:100 +portmap_16=23:100 + +portmap_20=33:100 +portmap_21=35:100 +portmap_22=37:100 +portmap_23=39:100 + +portmap_32=49:100 +portmap_33=51:100 +portmap_34=53:100 +portmap_35=55:100 + +#bc 25 27 29 31 + +portmap_124=201:100 +portmap_125=203:100 +portmap_126=205:100 +portmap_127=207:100 + +portmap_128=217:100 +portmap_129=219:100 +portmap_130=221:100 +portmap_131=223:100 + +portmap_144=233:100 +portmap_145=235:100 +portmap_146=237:100 +portmap_147=239:100 + +portmap_148=249:100 +portmap_149=251:100 +portmap_150=253:100 +portmap_151=255:100 + +phy_chain_rx_lane_map_physical{1.0}=0x62147035 +phy_chain_tx_lane_map_physical{1.0}=0x35046712 +phy_chain_rx_lane_map_physical{17.0}=0x76345012 +phy_chain_tx_lane_map_physical{17.0}=0x45102367 +phy_chain_rx_lane_map_physical{33.0}=0x12063457 +phy_chain_tx_lane_map_physical{33.0}=0x23607541 +phy_chain_rx_lane_map_physical{49.0}=0x03216745 +phy_chain_tx_lane_map_physical{49.0}=0x14650273 +phy_chain_rx_lane_map_physical{201.0}=0x34105627 +phy_chain_tx_lane_map_physical{201.0}=0x12503467 +phy_chain_rx_lane_map_physical{217.0}=0x02476351 +phy_chain_tx_lane_map_physical{217.0}=0x31524067 +phy_chain_rx_lane_map_physical{233.0}=0x10754623 +phy_chain_tx_lane_map_physical{233.0}=0x02314576 +phy_chain_rx_lane_map_physical{249.0}=0x34762510 +phy_chain_tx_lane_map_physical{249.0}=0x40271653 + +serdes_core_rx_polarity_flip_physical{1}=0xe0 +serdes_core_tx_polarity_flip_physical{1}=0xea +serdes_core_rx_polarity_flip_physical{17}=0x42 +serdes_core_tx_polarity_flip_physical{17}=0x8a +serdes_core_rx_polarity_flip_physical{33}=0xd1 +serdes_core_tx_polarity_flip_physical{33}=0x24 +serdes_core_rx_polarity_flip_physical{49}=0x23 +serdes_core_tx_polarity_flip_physical{49}=0xac +serdes_core_rx_polarity_flip_physical{201}=0xa8 +serdes_core_tx_polarity_flip_physical{201}=0x13 +serdes_core_rx_polarity_flip_physical{217}=0xdf +serdes_core_tx_polarity_flip_physical{217}=0x48 +serdes_core_rx_polarity_flip_physical{233}=0xdf +serdes_core_tx_polarity_flip_physical{233}=0x84 +serdes_core_rx_polarity_flip_physical{249}=0xfb +serdes_core_tx_polarity_flip_physical{249}=0xdc + +dport_map_port_40=1 +dport_map_port_41=2 +dport_map_port_42=3 +dport_map_port_43=4 +dport_map_port_48=5 +dport_map_port_49=6 +dport_map_port_50=7 +dport_map_port_51=8 +dport_map_port_60=9 +dport_map_port_61=10 +dport_map_port_62=11 +dport_map_port_63=12 +dport_map_port_68=13 +dport_map_port_69=14 +dport_map_port_70=15 +dport_map_port_71=16 +dport_map_port_84=17 +dport_map_port_85=18 +dport_map_port_86=19 +dport_map_port_87=20 +dport_map_port_92=21 +dport_map_port_93=22 +dport_map_port_94=23 +dport_map_port_95=24 +dport_map_port_104=25 +dport_map_port_105=26 +dport_map_port_106=27 +dport_map_port_107=28 +dport_map_port_112=29 +dport_map_port_113=30 +dport_map_port_114=31 +dport_map_port_115=32 + +dport_map_port_44=33 +dport_map_port_45=34 +dport_map_port_46=35 +dport_map_port_47=36 +dport_map_port_52=37 +dport_map_port_53=38 +dport_map_port_54=39 +dport_map_port_55=40 +dport_map_port_64=41 +dport_map_port_65=42 +dport_map_port_66=43 +dport_map_port_67=44 +dport_map_port_72=45 +dport_map_port_73=46 +dport_map_port_74=47 +dport_map_port_75=48 +dport_map_port_80=49 +dport_map_port_81=50 +dport_map_port_82=51 +dport_map_port_83=52 +dport_map_port_88=53 +dport_map_port_89=54 +dport_map_port_90=55 +dport_map_port_91=56 +dport_map_port_100=57 +dport_map_port_101=58 +dport_map_port_102=59 +dport_map_port_103=60 +dport_map_port_108=61 +dport_map_port_109=62 +dport_map_port_110=63 +dport_map_port_111=64 + +dport_map_port_5=65 +dport_map_port_6=66 +dport_map_port_7=67 +dport_map_port_8=68 +dport_map_port_9=69 +dport_map_port_10=70 +dport_map_port_11=71 +dport_map_port_12=72 +dport_map_port_24=73 +dport_map_port_25=74 +dport_map_port_26=75 +dport_map_port_27=76 +dport_map_port_28=77 +dport_map_port_29=78 +dport_map_port_30=79 +dport_map_port_31=80 +dport_map_port_120=81 +dport_map_port_121=82 +dport_map_port_122=83 +dport_map_port_123=84 +dport_map_port_132=85 +dport_map_port_133=86 +dport_map_port_134=87 +dport_map_port_135=88 +dport_map_port_140=89 +dport_map_port_141=90 +dport_map_port_142=91 +dport_map_port_143=92 +dport_map_port_152=93 +dport_map_port_153=94 +dport_map_port_154=95 +dport_map_port_155=96 + +dport_map_port_1=97 +dport_map_port_2=98 +dport_map_port_3=99 +dport_map_port_4=100 +dport_map_port_13=101 +dport_map_port_14=102 +dport_map_port_15=103 +dport_map_port_16=104 +dport_map_port_20=105 +dport_map_port_21=106 +dport_map_port_22=107 +dport_map_port_23=108 +dport_map_port_32=109 +dport_map_port_33=110 +dport_map_port_34=111 +dport_map_port_35=112 +dport_map_port_124=113 +dport_map_port_125=114 +dport_map_port_126=115 +dport_map_port_127=116 +dport_map_port_128=117 +dport_map_port_129=118 +dport_map_port_130=119 +dport_map_port_131=120 +dport_map_port_144=121 +dport_map_port_145=122 +dport_map_port_146=123 +dport_map_port_147=124 +dport_map_port_148=125 +dport_map_port_149=126 +dport_map_port_150=127 +dport_map_port_151=128 + +#firmware load, use fast load +load_firmware=0x2 + +core_clock_frequency=1325 +dpr_clock_frequency=1000 +device_clock_frequency=1325 +port_flex_enable=1 diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/bcm.rc b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/bcm.rc new file mode 100644 index 000000000000..7f69f10d3bda --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/bcm.rc @@ -0,0 +1 @@ +rcload /usr/share/sonic/platform/led_proc_init.soc diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/bcm_pre.rc b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/bcm_pre.rc new file mode 100644 index 000000000000..ff9e51918031 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/bcm_pre.rc @@ -0,0 +1 @@ +m0 load 0 0 /usr/share/sonic/platform/linkscan_led.bin diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/custom_led.bin b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/custom_led.bin new file mode 100644 index 000000000000..579e6df5277a Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/custom_led.bin differ diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/default_sku b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/default_sku new file mode 100644 index 000000000000..7945335f27ff --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/default_sku @@ -0,0 +1 @@ +RA-B6920-4S t1 diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/dev.xml b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/dev.xml new file mode 100644 index 000000000000..7243bf77c696 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/dev.xml @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/device_data.json b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/device_data.json new file mode 100644 index 000000000000..6bf7042401b5 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/device_data.json @@ -0,0 +1,3716 @@ +{ + "PLATFORM": { + "fan_info": { + "drawer_num": 6, + "fans_per_drawer": 2, + "MAX_FAN_SPEED": 12300, + "MIN_FAN_SPEED": 3690, + "ALLOW-FAN-TYPES": { + "P2EFAN I-F": "exhaust" + } + }, + "psu_info": { + "psu_num": 4, + "fans_per_psu": 1, + "MAX_PSU_FAN_SPEED": 25100, + "MIN_PSU_FAN_SPEED": 6600, + "ALLOW-PSU-TYPES": { + "DPS-1300AB-6 S": "exhaust" + } + }, + "thermal_info": { + "temp_num": 9 + }, + "component_info": { + "comp_num": 13 + }, + "debug": { + "level": 0 + } + }, + "EEPROM-1": { + "eeprom": { + "codec": { + "name": "TLV", + "attrs": { + "path": "/sys/bus/i2c/devices/1-0056/eeprom" + } + } + } + }, + "THERMAL-1": { + "desc": "INLET TEMP", + "temp": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/29-004f/hwmon/*/temp1_input" + } + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000, + "nearest": 3 + } + } + }, + "h_thd": { + "default": 70 + }, + "h_crit": { + "default": 80 + } + }, + "THERMAL-2": { + "temp": { + "desc": "OUTLET TEMP", + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/28-004b/hwmon/*/temp1_input" + } + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000, + "nearest": 3 + } + } + }, + "h_thd": { + "default": 85 + }, + "h_crit": { + "default": 90 + } + }, + "THERMAL-3": { + "temp": { + "desc": "BOARD TEMP", + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/28-004c/hwmon/*/temp1_input" + } + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000, + "nearest": 3 + } + } + }, + "h_thd": { + "default": 85 + }, + "h_crit": { + "default": 90 + } + }, + "THERMAL-4": { + "desc": "CPU CORE 0", + "temp": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/class/hwmon/hwmon0/temp2_input" + } + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000, + "nearest": 3 + } + } + }, + "h_thd": { + "default": 85 + }, + "h_crit": { + "default": 100 + } + }, + "THERMAL-5": { + "desc": "CPU CORE 1", + "temp": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/class/hwmon/hwmon0/temp3_input" + } + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000, + "nearest": 3 + } + } + }, + "h_thd": { + "default": 85 + }, + "h_crit": { + "default": 100 + } + }, + "THERMAL-6": { + "desc": "CPU CORE 2", + "temp": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/class/hwmon/hwmon0/temp4_input" + } + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000, + "nearest": 3 + } + } + }, + "h_thd": { + "default": 85 + }, + "h_crit": { + "default": 100 + } + }, + "THERMAL-7": { + "desc": "CPU CORE 3", + "temp": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/class/hwmon/hwmon0/temp5_input" + } + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000, + "nearest": 3 + } + } + }, + "h_thd": { + "default": 85 + }, + "h_crit": { + "default": 100 + } + }, + "THERMAL-8": { + "desc": "MAC TEMP1", + "temp": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/28-004c/hwmon/*/temp2_input" + } + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000, + "nearest": 3 + } + } + }, + "h_thd": { + "default": 100 + }, + "h_crit": { + "default": 105 + } + }, + "THERMAL-9": { + "desc": "MAC TEMP2", + "temp": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/29-004c/hwmon/*/temp2_input" + } + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000, + "nearest": 3 + } + } + }, + "h_thd": { + "default": 100 + }, + "h_crit": { + "default": 105 + } + }, + "COMPONENT-1": { + "desc": { + "default": "FAN_CPLD_B" + }, + "version": { + "codec": { + "name": "I2C", + "attrs": { + "bus": "13", + "addr": "0x0d", + "offset": "0x0", + "size": 4 + } + }, + "post_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16, + "sep": "/" + } + } + } + }, + "COMPONENT-2": { + "desc": { + "default": "FAN_CPLD_A" + }, + "version": { + "codec": { + "name": "I2C", + "attrs": { + "bus": "14", + "addr": "0x0d", + "offset": "0x0", + "size": 4 + } + }, + "post_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16, + "sep": "/" + } + } + } + }, + "COMPONENT-3": { + "desc": { + "default": "LC1_CPLD_1" + }, + "version": { + "codec": { + "name": "I2C", + "attrs": { + "bus": "3", + "addr": "0x30", + "offset": "0x0", + "size": 4 + } + }, + "post_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16, + "sep": "/" + } + } + } + }, + "COMPONENT-4": { + "desc": { + "default": "LC1_CPLD_2" + }, + "version": { + "codec": { + "name": "I2C", + "attrs": { + "bus": "3", + "addr": "0x31", + "offset": "0x0", + "size": 4 + } + }, + "post_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16, + "sep": "/" + } + } + } + }, + "COMPONENT-5": { + "desc": { + "default": "LC2_CPLD_1" + }, + "version": { + "codec": { + "name": "I2C", + "attrs": { + "bus": "4", + "addr": "0x30", + "offset": "0x0", + "size": 4 + } + }, + "post_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16, + "sep": "/" + } + } + } + }, + "COMPONENT-6": { + "desc": { + "default": "LC2_CPLD_2" + }, + "version": { + "codec": { + "name": "I2C", + "attrs": { + "bus": "4", + "addr": "0x31", + "offset": "0x0", + "size": 4 + } + }, + "post_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16, + "sep": "/" + } + } + } + }, + "COMPONENT-7": { + "desc": { + "default": "LC3_CPLD_1" + }, + "version": { + "codec": { + "name": "I2C", + "attrs": { + "bus": "5", + "addr": "0x30", + "offset": "0x0", + "size": 4 + } + }, + "post_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16, + "sep": "/" + } + } + } + }, + "COMPONENT-8": { + "desc": { + "default": "LC3_CPLD_2" + }, + "version": { + "codec": { + "name": "I2C", + "attrs": { + "bus": "5", + "addr": "0x31", + "offset": "0x0", + "size": 4 + } + }, + "post_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16, + "sep": "/" + } + } + } + }, + "COMPONENT-9": { + "desc": { + "default": "LC4_CPLD_1" + }, + "version": { + "codec": { + "name": "I2C", + "attrs": { + "bus": "6", + "addr": "0x30", + "offset": "0x0", + "size": 4 + } + }, + "post_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16, + "sep": "/" + } + } + } + }, + "COMPONENT-10": { + "desc": { + "default": "LC4_CPLD_2" + }, + "version": { + "codec": { + "name": "I2C", + "attrs": { + "bus": "6", + "addr": "0x31", + "offset": "0x0", + "size": 4 + } + }, + "post_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16, + "sep": "/" + } + } + } + }, + "COMPONENT-11": { + "desc": { + "default": "X86_CPLD" + }, + "version": { + "codec": { + "name": "IO", + "attrs": { + "offset": "0x700", + "size": 4 + } + }, + "post_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16, + "sep": "/" + } + } + } + }, + "COMPONENT-12": { + "desc": { + "default": "MAC_CPLD_B" + }, + "version": { + "codec": { + "name": "IO", + "attrs": { + "offset": "0x900", + "size": 4 + } + }, + "post_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16, + "sep": "/" + } + } + } + }, + "COMPONENT-13": { + "desc": { + "default": "MAC_CPLD_A" + }, + "version": { + "codec": { + "name": "IO", + "attrs": { + "offset": "0xb00", + "size": 4 + } + }, + "post_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16, + "sep": "/" + } + } + } + }, + "PSU-1": { + "presence": { + "codec": { + "name": "IO", + "attrs": { + "offset": "0xb27", + "size": "1" + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": 0, + "mask": "0x01" + } + } + }, + "status": { + "codec": { + "name": "IO", + "attrs": { + "offset": "0xb27", + "size": "1" + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": "0x02", + "mask": "0x02" + } + } + }, + "max_power_in": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/23-0058/hwmon/*/power1_max" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000000 + } + } + }, + "max_power_out": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/23-0058/hwmon/*/power2_max" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000000 + } + } + }, + "v_in": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/23-0058/hwmon/*/in1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "v_in_h_thd": {}, + "v_in_l_thd": {}, + "i_in": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/23-0058/hwmon/*/curr1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "i_in_h_thd": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/23-0058/hwmon/*/curr1_max" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "i_in_l_thd": {}, + "v_out": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/23-0058/hwmon/*/in2_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "v_out_h_thd": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/23-0058/hwmon/*/in2_crit" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "v_out_l_thd": {}, + "i_out": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/23-0058/hwmon/*/curr2_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "i_out_h_thd": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/23-0058/hwmon/*/curr2_max" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "i_out_l_thd": {}, + "temp": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/23-0058/hwmon/*/temp1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "temp_h_thd": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/23-0058/hwmon/*/temp1_max" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "temp_l_thd": {}, + "power_in": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/23-0058/hwmon/*/power1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000000 + } + } + }, + "power_out": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/23-0058/hwmon/*/power2_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000000 + } + } + }, + "sn": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/23-0050/psu_sn" + } + } + }, + "pn": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/23-0050/psu_type" + } + } + }, + "revision": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/23-0050/psu_hw" + } + } + }, + "led": {}, + "supp": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/23-0050/psu_type" + } + }, + "post": { + "name": "MATCH_LIST", + "attrs": { + "cmpitem": "ALLOW-PSU-TYPES" + } + } + } + }, + "PSU-2": { + "presence": { + "codec": { + "name": "IO", + "attrs": { + "offset": "0xb28", + "size": 1 + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": 0, + "mask": "0x01" + } + } + }, + "status": { + "codec": { + "name": "IO", + "attrs": { + "offset": "0xb28", + "size": 1 + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": "0x02", + "mask": "0x02" + } + } + }, + "max_power_in": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/25-0058/hwmon/*/power1_max" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000000 + } + } + }, + "max_power_out": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/25-0058/hwmon/*/power2_max" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000000 + } + } + }, + "v_in": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/25-0058/hwmon/*/in1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "v_in_h_thd": {}, + "v_in_l_thd": {}, + "i_in": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/25-0058/hwmon/*/curr1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "i_in_h_thd": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/25-0058/hwmon/*/curr1_max" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "i_in_l_thd": {}, + "v_out": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/25-0058/hwmon/*/in2_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "v_out_h_thd": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/25-0058/hwmon/*/in2_crit" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "v_out_l_thd": {}, + "i_out": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/25-0058/hwmon/*/curr2_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "i_out_h_thd": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/25-0058/hwmon/*/curr2_max" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "i_out_l_thd": {}, + "temp": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/25-0058/hwmon/*/temp1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "temp_h_thd": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/25-0058/hwmon/*/temp1_max" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "temp_l_thd": {}, + "power_in": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/25-0058/hwmon/*/power1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000000 + } + } + }, + "power_out": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/25-0058/hwmon/*/power2_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000000 + } + } + }, + "sn": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/25-0050/psu_sn" + } + } + }, + "pn": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/25-0050/psu_type" + } + } + }, + "revision": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/25-0050/psu_hw" + } + } + }, + "led": {}, + "supp": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/25-0050/psu_type" + } + }, + "post": { + "name": "MATCH_LIST", + "attrs": { + "cmpitem": "ALLOW-PSU-TYPES" + } + } + } + }, + "PSU-3": { + "presence": { + "codec": { + "name": "IO", + "attrs": { + "offset": "0xb29", + "size": 1 + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": 0, + "mask": "0x01" + } + } + }, + "status": { + "codec": { + "name": "IO", + "attrs": { + "offset": "0xb29", + "size": 1 + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": "0x02", + "mask": "0x02" + } + } + }, + "max_power_in": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/24-0058/hwmon/*/power1_max" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000000 + } + } + }, + "max_power_out": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/24-0058/hwmon/*/power2_max" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000000 + } + } + }, + "v_in": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/24-0058/hwmon/*/in1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "v_in_h_thd": {}, + "v_in_l_thd": {}, + "i_in": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/24-0058/hwmon/*/curr1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "i_in_h_thd": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/24-0058/hwmon/*/curr1_max" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "i_in_l_thd": {}, + "v_out": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/24-0058/hwmon/*/in2_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "v_out_h_thd": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/24-0058/hwmon/*/in2_crit" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "v_out_l_thd": {}, + "i_out": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/24-0058/hwmon/*/curr2_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "i_out_h_thd": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/24-0058/hwmon/*/curr2_max" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "i_out_l_thd": {}, + "temp": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/24-0058/hwmon/*/temp1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "temp_h_thd": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/24-0058/hwmon/*/temp1_max" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "temp_l_thd": {}, + "power_in": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/24-0058/hwmon/*/power1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000000 + } + } + }, + "power_out": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/24-0058/hwmon/*/power2_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000000 + } + } + }, + "sn": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/24-0050/psu_sn" + } + } + }, + "pn": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/24-0050/psu_type" + } + } + }, + "revision": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/24-0050/psu_hw" + } + } + }, + "led": {}, + "supp": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/24-0050/psu_type" + } + }, + "post": { + "name": "MATCH_LIST", + "attrs": { + "cmpitem": "ALLOW-PSU-TYPES" + } + } + } + }, + "PSU-4": { + "presence": { + "codec": { + "name": "IO", + "attrs": { + "offset": "0xb2a", + "size": 1 + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": 0, + "mask": "0x01" + } + } + }, + "status": { + "codec": { + "name": "IO", + "attrs": { + "offset": "0xb2a", + "size": 1 + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": "0x02", + "mask": "0x02" + } + } + }, + "max_power_in": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/26-0058/hwmon/*/power1_max" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000000 + } + } + }, + "max_power_out": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/26-0058/hwmon/*/power2_max" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000000 + } + } + }, + "v_in": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/26-0058/hwmon/*/in1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "v_in_h_thd": {}, + "v_in_l_thd": {}, + "i_in": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/26-0058/hwmon/*/curr1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "i_in_h_thd": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/26-0058/hwmon/*/curr1_max" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "i_in_l_thd": {}, + "v_out": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/26-0058/hwmon/*/in2_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "v_out_h_thd": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/26-0058/hwmon/*/in2_crit" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "v_out_l_thd": {}, + "i_out": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/26-0058/hwmon/*/curr2_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "i_out_h_thd": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/26-0058/hwmon/*/curr2_max" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "i_out_l_thd": {}, + "temp": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/26-0058/hwmon/*/temp1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "temp_h_thd": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/26-0058/hwmon/*/temp1_max" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000 + } + } + }, + "temp_l_thd": {}, + "power_in": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/26-0058/hwmon/*/power1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000000 + } + } + }, + "power_out": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/26-0058/hwmon/*/power2_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "DIVISION", + "attrs": { + "divisor": 1000000 + } + } + }, + "sn": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/26-0050/psu_sn" + } + } + }, + "pn": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/26-0050/psu_type" + } + } + }, + "revision": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/26-0050/psu_hw" + } + } + }, + "led": {}, + "supp": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/26-0050/psu_type" + } + }, + "post": { + "name": "MATCH_LIST", + "attrs": { + "cmpitem": "ALLOW-PSU-TYPES" + } + } + } + }, + "PSU-FAN-1": { + "presence": { + "codec": { + "name": "IO", + "attrs": { + "offset": "0xb27", + "size": "1" + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": 0, + "mask": "0x01" + } + } + }, + "status": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/23-0058/hwmon/*/fan1_input" + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": 0, + "opt": "GT" + } + } + }, + "speed_rpm": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/23-0058/hwmon/*/fan1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + } + }, + "speed_rpm_h_thd": "MAX_PSU_FAN_SPEED", + "speed_rpm_l_thd": "MIN_PSU_FAN_SPEED", + "speed": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/23-0058/hwmon/*/fan1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": "MAX_PSU_FAN_SPEED" + } + } + }, + "direction": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/23-0050/psu_type" + } + }, + "post": { + "name": "MATCH_DICT", + "attrs": { + "cmpitem": "ALLOW-PSU-TYPES" + } + } + } + }, + "PSU-FAN-2": { + "presence": { + "codec": { + "name": "IO", + "attrs": { + "offset": "0xb28", + "size": 1 + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": 0, + "mask": "0x01" + } + } + }, + "status": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/25-0058/hwmon/*/fan1_input" + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": 0, + "opt": "GT" + } + } + }, + "speed_rpm": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/25-0058/hwmon/*/fan1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + } + }, + "speed_rpm_h_thd": "MAX_PSU_FAN_SPEED", + "speed_rpm_l_thd": "MIN_PSU_FAN_SPEED", + "speed": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/25-0058/hwmon/*/fan1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": "MAX_PSU_FAN_SPEED" + } + } + }, + "direction": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/25-0050/psu_type" + } + }, + "post": { + "name": "MATCH_DICT", + "attrs": { + "cmpitem": "ALLOW-PSU-TYPES" + } + } + } + }, + "PSU-FAN-3": { + "presence": { + "codec": { + "name": "IO", + "attrs": { + "offset": "0xb29", + "size": 1 + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": 0, + "mask": "0x01" + } + } + }, + "status": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/24-0058/hwmon/*/fan1_input" + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": 0, + "opt": "GT" + } + } + }, + "speed_rpm": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/24-0058/hwmon/*/fan1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + } + }, + "speed_rpm_h_thd": "MAX_PSU_FAN_SPEED", + "speed_rpm_l_thd": "MIN_PSU_FAN_SPEED", + "speed": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/24-0058/hwmon/*/fan1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": "MAX_PSU_FAN_SPEED" + } + } + }, + "direction": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/24-0050/psu_type" + } + }, + "post": { + "name": "MATCH_DICT", + "attrs": { + "cmpitem": "ALLOW-PSU-TYPES" + } + } + } + }, + "PSU-FAN-4": { + "presence": { + "codec": { + "name": "IO", + "attrs": { + "offset": "0xb2a", + "size": 1 + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": 0, + "mask": "0x01" + } + } + }, + "status": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/26-0058/hwmon/*/fan1_input" + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": 0, + "opt": "GT" + } + } + }, + "speed_rpm": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/26-0058/hwmon/*/fan1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + } + }, + "speed_rpm_h_thd": "MAX_PSU_FAN_SPEED", + "speed_rpm_l_thd": "MIN_PSU_FAN_SPEED", + "speed": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/26-0058/hwmon/*/fan1_input" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": "MAX_PSU_FAN_SPEED" + } + } + }, + "direction": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/26-0050/psu_type" + } + }, + "post": { + "name": "MATCH_DICT", + "attrs": { + "cmpitem": "ALLOW-PSU-TYPES" + } + } + } + }, + "FAN-DRAWER-1": { + "fans": ["FAN-1", "FAN-2"], + "presence": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan_present" + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": 0, + "mask": "0x01" + } + } + }, + "status": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan_status1" + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": "0x01", + "mask": "0x01" + } + } + }, + "pn": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/63-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.PN" + } + } + }, + "sn": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/63-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.SN" + } + } + }, + "direction": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/63-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.NAME" + } + }, + "post": { + "name": "MATCH_DICT", + "attrs": { + "cmpitem": "ALLOW-FAN-TYPES" + } + } + }, + "led": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan1_led" + } + }, + "post_fmtter": { + "name": "TO_INT", + "attrs": { + "base": 16 + } + }, + "post": { + "name": "LED", + "attrs": { + "led_type": "Type1" + } + } + }, + "supp": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/63-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.NAME" + } + }, + "post": { + "name": "MATCH_LIST", + "attrs": { + "cmpitem": "ALLOW-FAN-TYPES" + } + } + }, + "hw_ver": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/63-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.VERSION" + } + } + } + }, + "FAN-DRAWER-2": { + "fans": ["FAN-3", "FAN-4"], + "presence": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan_present" + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": 0, + "mask": "0x01" + } + } + }, + "status": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan_status1" + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": "0x01", + "mask": "0x01" + } + } + }, + "pn": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/55-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.PN" + } + } + }, + "sn": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/55-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.SN" + } + } + }, + "direction": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/55-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.NAME" + } + }, + "post": { + "name": "MATCH_DICT", + "attrs": { + "cmpitem": "ALLOW-FAN-TYPES" + } + } + }, + "led": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan2_led" + } + }, + "post_fmtter": { + "name": "TO_INT", + "attrs": { + "base": 16 + } + }, + "post": { + "name": "LED", + "attrs": { + "led_type": "Type1" + } + } + }, + "supp": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/55-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.NAME" + } + }, + "post": { + "name": "MATCH_LIST", + "attrs": { + "cmpitem": "ALLOW-FAN-TYPES" + } + } + }, + "hw_ver": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/55-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.VERSION" + } + } + } + }, + "FAN-DRAWER-3": { + "fans": ["FAN-5", "FAN-6"], + "presence": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan_present" + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": 0, + "mask": "0x02" + } + } + }, + "status": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan_status1" + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": "0x02", + "mask": "0x02" + } + } + }, + "pn": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/64-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.PN" + } + } + }, + "sn": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/64-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.SN" + } + } + }, + "direction": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/64-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.NAME" + } + }, + "post": { + "name": "MATCH_DICT", + "attrs": { + "cmpitem": "ALLOW-FAN-TYPES" + } + } + }, + "led": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan3_led" + } + }, + "post_fmtter": { + "name": "TO_INT", + "attrs": { + "base": 16 + } + }, + "post": { + "name": "LED", + "attrs": { + "led_type": "Type1" + } + } + }, + "supp": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/64-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.NAME" + } + }, + "post": { + "name": "MATCH_LIST", + "attrs": { + "cmpitem": "ALLOW-FAN-TYPES" + } + } + }, + "hw_ver": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/64-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.VERSION" + } + } + } + }, + "FAN-DRAWER-4": { + "fans": ["FAN-7", "FAN-8"], + "presence": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan_present" + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": 0, + "mask": "0x02" + } + } + }, + "status": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan_status1" + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": "0x02", + "mask": "0x02" + } + } + }, + "pn": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/56-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.PN" + } + } + }, + "sn": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/56-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.SN" + } + } + }, + "direction": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/56-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.NAME" + } + }, + "post": { + "name": "MATCH_DICT", + "attrs": { + "cmpitem": "ALLOW-FAN-TYPES" + } + } + }, + "led": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan4_led" + } + }, + "post_fmtter": { + "name": "TO_INT", + "attrs": { + "base": 16 + } + }, + "post": { + "name": "LED", + "attrs": { + "led_type": "Type1" + } + } + }, + "supp": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/56-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.NAME" + } + }, + "post": { + "name": "MATCH_LIST", + "attrs": { + "cmpitem": "ALLOW-FAN-TYPES" + } + } + }, + "hw_ver": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/56-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.VERSION" + } + } + } + }, + "FAN-DRAWER-5": { + "fans": ["FAN-9", "FAN-10"], + "presence": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan_present" + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": 0, + "mask": "0x04" + } + } + }, + "status": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan_status1" + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": "0x04", + "mask": "0x04" + } + } + }, + "pn": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/65-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.PN" + } + } + }, + "sn": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/65-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.SN" + } + } + }, + "direction": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/65-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.NAME" + } + }, + "post": { + "name": "MATCH_DICT", + "attrs": { + "cmpitem": "ALLOW-FAN-TYPES" + } + } + }, + "led": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan5_led" + } + }, + "post_fmtter": { + "name": "TO_INT", + "attrs": { + "base": 16 + } + }, + "post": { + "name": "LED", + "attrs": { + "led_type": "Type1" + } + } + }, + "supp": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/65-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.NAME" + } + }, + "post": { + "name": "MATCH_LIST", + "attrs": { + "cmpitem": "ALLOW-FAN-TYPES" + } + } + }, + "hw_ver": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/65-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.VERSION" + } + } + } + }, + "FAN-DRAWER-6": { + "fans": ["FAN-11", "FAN-12"], + "presence": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan_present" + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": 0, + "mask": "0x04" + } + } + }, + "status": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan_status1" + } + }, + "post": { + "name": "CMP", + "attrs": { + "cmpval": "0x04", + "mask": "0x04" + } + } + }, + "pn": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/57-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.PN" + } + } + }, + "sn": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/57-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.SN" + } + } + }, + "direction": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/57-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.NAME" + } + }, + "post": { + "name": "MATCH_DICT", + "attrs": { + "cmpitem": "ALLOW-FAN-TYPES" + } + } + }, + "led": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan6_led" + } + }, + "post_fmtter": { + "name": "TO_INT", + "attrs": { + "base": 16 + } + }, + "post": { + "name": "LED", + "attrs": { + "led_type": "Type1" + } + } + }, + "supp": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/57-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.NAME" + } + }, + "post": { + "name": "MATCH_LIST", + "attrs": { + "cmpitem": "ALLOW-FAN-TYPES" + } + } + }, + "hw_ver": { + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/57-0050/eeprom" + } + }, + "post_fmtter": { + "name": "FRU", + "attrs": { + "field": "PD.VERSION" + } + } + } + }, + "FAN-1": { + "speed_rpm": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan1_1_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + } + }, + "speed_rpm_h_thd": "MAX_FAN_SPEED", + "speed_rpm_l_thd": "MIN_FAN_SPEED", + "speed": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan1_1_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": "MAX_FAN_SPEED" + } + } + }, + "pwm": { + "ro": false, + "pre": { + "name": "PROPORTION", + "attrs": { + "denomi": 100, + "total": 255 + } + }, + "pre_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16 + } + }, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan1_speed_set" + } + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": 255, + "total": 100 + } + }, + "post_fmtter": { + "name": "TO_INT", + "attrs": { + "base": 16 + } + } + }, + "tolerance": 30 + }, + "FAN-2": { + "speed_rpm": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan1_2_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + } + }, + "speed_rpm_h_thd": "MAX_FAN_SPEED", + "speed_rpm_l_thd": "MIN_FAN_SPEED", + "speed": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan1_2_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": "MAX_FAN_SPEED" + } + } + }, + "pwm": { + "ro": false, + "pre": { + "name": "PROPORTION", + "attrs": { + "denomi": 100, + "total": 255 + } + }, + "pre_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16 + } + }, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan1_speed_set" + } + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": 255, + "total": 100 + } + }, + "post_fmtter": { + "name": "TO_INT", + "attrs": { + "base": 16 + } + } + }, + "tolerance": 30 + }, + "FAN-3": { + "speed_rpm": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan2_1_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + } + }, + "speed_rpm_h_thd": "MAX_FAN_SPEED", + "speed_rpm_l_thd": "MIN_FAN_SPEED", + "speed": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan2_1_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": "MAX_FAN_SPEED" + } + } + }, + "pwm": { + "ro": false, + "pre": { + "name": "PROPORTION", + "attrs": { + "denomi": 100, + "total": 255 + } + }, + "pre_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16 + } + }, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan2_speed_set" + } + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": 255, + "total": 100 + } + }, + "post_fmtter": { + "name": "TO_INT", + "attrs": { + "base": 16 + } + } + }, + "tolerance": 30 + }, + "FAN-4": { + "speed_rpm": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan2_2_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + } + }, + "speed_rpm_h_thd": "MAX_FAN_SPEED", + "speed_rpm_l_thd": "MIN_FAN_SPEED", + "speed": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan2_2_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": "MAX_FAN_SPEED" + } + } + }, + "pwm": { + "ro": false, + "pre": { + "name": "PROPORTION", + "attrs": { + "denomi": 100, + "total": 255 + } + }, + "pre_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16 + } + }, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan2_speed_set" + } + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": 255, + "total": 100 + } + }, + "post_fmtter": { + "name": "TO_INT", + "attrs": { + "base": 16 + } + } + }, + "tolerance": 30 + }, + "FAN-5": { + "speed_rpm": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan3_1_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + } + }, + "speed_rpm_h_thd": "MAX_FAN_SPEED", + "speed_rpm_l_thd": "MIN_FAN_SPEED", + "speed": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan3_1_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": "MAX_FAN_SPEED" + } + } + }, + "pwm": { + "ro": false, + "pre": { + "name": "PROPORTION", + "attrs": { + "denomi": 100, + "total": 255 + } + }, + "pre_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16 + } + }, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan3_speed_set" + } + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": 255, + "total": 100 + } + }, + "post_fmtter": { + "name": "TO_INT", + "attrs": { + "base": 16 + } + } + }, + "tolerance": 30 + }, + "FAN-6": { + "speed_rpm": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan3_2_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + } + }, + "speed_rpm_h_thd": "MAX_FAN_SPEED", + "speed_rpm_l_thd": "MIN_FAN_SPEED", + "speed": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan3_2_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": "MAX_FAN_SPEED" + } + } + }, + "pwm": { + "ro": false, + "pre": { + "name": "PROPORTION", + "attrs": { + "denomi": 100, + "total": 255 + } + }, + "pre_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16 + } + }, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan3_speed_set" + } + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": 255, + "total": 100 + } + }, + "post_fmtter": { + "name": "TO_INT", + "attrs": { + "base": 16 + } + } + }, + "tolerance": 30 + }, + "FAN-7": { + "speed_rpm": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan4_1_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + } + }, + "speed_rpm_h_thd": "MAX_FAN_SPEED", + "speed_rpm_l_thd": "MIN_FAN_SPEED", + "speed": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan4_1_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": "MAX_FAN_SPEED" + } + } + }, + "pwm": { + "ro": false, + "pre": { + "name": "PROPORTION", + "attrs": { + "denomi": 100, + "total": 255 + } + }, + "pre_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16 + } + }, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan4_speed_set" + } + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": 255, + "total": 100 + } + }, + "post_fmtter": { + "name": "TO_INT", + "attrs": { + "base": 16 + } + } + }, + "tolerance": 30 + }, + "FAN-8": { + "speed_rpm": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan4_2_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + } + }, + "speed_rpm_h_thd": "MAX_FAN_SPEED", + "speed_rpm_l_thd": "MIN_FAN_SPEED", + "speed": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan4_2_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": "MAX_FAN_SPEED" + } + } + }, + "pwm": { + "ro": false, + "pre": { + "name": "PROPORTION", + "attrs": { + "denomi": 100, + "total": 255 + } + }, + "pre_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16 + } + }, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan4_speed_set" + } + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": 255, + "total": 100 + } + }, + "post_fmtter": { + "name": "TO_INT", + "attrs": { + "base": 16 + } + } + }, + "tolerance": 30 + }, + "FAN-9": { + "speed_rpm": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan5_1_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + } + }, + "speed_rpm_h_thd": "MAX_FAN_SPEED", + "speed_rpm_l_thd": "MIN_FAN_SPEED", + "speed": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan5_1_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": "MAX_FAN_SPEED" + } + } + }, + "pwm": { + "ro": false, + "pre": { + "name": "PROPORTION", + "attrs": { + "denomi": 100, + "total": 255 + } + }, + "pre_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16 + } + }, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan5_speed_set" + } + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": 255, + "total": 100 + } + }, + "post_fmtter": { + "name": "TO_INT", + "attrs": { + "base": 16 + } + } + }, + "tolerance": 30 + }, + "FAN-10": { + "speed_rpm": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan5_2_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + } + }, + "speed_rpm_h_thd": "MAX_FAN_SPEED", + "speed_rpm_l_thd": "MIN_FAN_SPEED", + "speed": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan5_2_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": "MAX_FAN_SPEED" + } + } + }, + "pwm": { + "ro": false, + "pre": { + "name": "PROPORTION", + "attrs": { + "denomi": 100, + "total": 255 + } + }, + "pre_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16 + } + }, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/14-000d/fan5_speed_set" + } + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": 255, + "total": 100 + } + }, + "post_fmtter": { + "name": "TO_INT", + "attrs": { + "base": 16 + } + } + }, + "tolerance": 30 + }, + "FAN-11": { + "speed_rpm": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan6_1_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + } + }, + "speed_rpm_h_thd": "MAX_FAN_SPEED", + "speed_rpm_l_thd": "MIN_FAN_SPEED", + "speed": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan6_1_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": "MAX_FAN_SPEED" + } + } + }, + "pwm": { + "ro": false, + "pre": { + "name": "PROPORTION", + "attrs": { + "denomi": 100, + "total": 255 + } + }, + "pre_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16 + } + }, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan6_speed_set" + } + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": 255, + "total": 100 + } + }, + "post_fmtter": { + "name": "TO_INT", + "attrs": { + "base": 16 + } + } + }, + "tolerance": 30 + }, + "FAN-12": { + "speed_rpm": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan6_2_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + } + }, + "speed_rpm_h_thd": "MAX_FAN_SPEED", + "speed_rpm_l_thd": "MIN_FAN_SPEED", + "speed": { + "default": 0, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan6_2_real_speed" + } + }, + "post_fmtter": { + "name": "TO_INT" + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": "MAX_FAN_SPEED" + } + } + }, + "pwm": { + "ro": false, + "pre": { + "name": "PROPORTION", + "attrs": { + "denomi": 100, + "total": 255 + } + }, + "pre_fmtter": { + "name": "TO_STR", + "attrs": { + "base": 16 + } + }, + "codec": { + "name": "SYSFS", + "attrs": { + "path": "/sys/bus/i2c/devices/13-000d/fan6_speed_set" + } + }, + "post": { + "name": "PROPORTION", + "attrs": { + "denomi": 255, + "total": 100 + } + }, + "post_fmtter": { + "name": "TO_INT", + "attrs": { + "base": 16 + } + } + }, + "tolerance": 30 + } +} diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/installer.conf b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/installer.conf new file mode 100644 index 000000000000..1223b2bef6df --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/installer.conf @@ -0,0 +1,2 @@ +CONSOLE_SPEED=115200 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="intel_pstate=disable intel_idle.max_cstate=0" \ No newline at end of file diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/led_proc_init.soc b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/led_proc_init.soc new file mode 100644 index 000000000000..da5105b07f18 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/led_proc_init.soc @@ -0,0 +1,7 @@ +m0 load 0 0x3800 /usr/share/sonic/platform/custom_led.bin + +led auto on + +led start + +linkscan spbm=all force=all interval=250000 diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/linkscan_led.bin b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/linkscan_led.bin new file mode 100644 index 000000000000..c2fa94a2d8cb Binary files /dev/null and b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/linkscan_led.bin differ diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/minigraph.xml b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/minigraph.xml new file mode 100644 index 000000000000..4aa22016c11a --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/minigraph.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + switch2 + + + + + + + + + + + + + switch2 + RA-B6920-4S + + + + + + + switch2 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + ErspanDestinationIpv4 + + 2.2.2.2 + + + + + + + switch2 + RA-B6920-4S + diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/monitor.py b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/monitor.py new file mode 100644 index 000000000000..3aa8fd3f2901 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/monitor.py @@ -0,0 +1,252 @@ +#!/usr/bin/python +# -*- coding: UTF-8 -*- +# * onboard temperature sensors +# * FAN trays +# * PSU +# +import os +import xml.etree.ElementTree as ET +import glob +from eepromutil.fru import * + +MAILBOX_DIR = "/sys/bus/i2c/devices/" +CONFIG_NAME = "dev.xml" + +def getPMCreg(location): + retval = 'ERR' + if (not os.path.isfile(location)): + return "%s %s notfound"% (retval , location) + try: + with open(location, 'r') as fd: + retval = fd.read() + except Exception as error: + pass + + retval = retval.rstrip('\r\n') + retval = retval.lstrip(" ") + return retval +# Get a mailbox register +def get_pmc_register(reg_name): + retval = 'ERR' + mb_reg_file = reg_name + filepath = glob.glob(mb_reg_file) + if(len(filepath) == 0): + return "%s %s notfound"% (retval , mb_reg_file) + mb_reg_file = filepath[0] + if (not os.path.isfile(mb_reg_file)): + #print mb_reg_file, 'not found !' + return "%s %s notfound"% (retval , mb_reg_file) + try: + with open(mb_reg_file, 'r') as fd: + retval = fd.read() + except Exception as error: + pass + + retval = retval.rstrip('\r\n') + retval = retval.lstrip(" ") + return retval + +class checktype(): + def __init__(self, test1): + self.test1 = test1 + @staticmethod + def check(name,location, bit, value, tips , err1): + psu_status = int(get_pmc_register(location),16) + val = (psu_status & (1<< bit)) >> bit + if (val != value): + err1["errmsg"] = tips + err1["code"] = -1 + return -1 + else: + err1["errmsg"] = "none" + err1["code"] = 0 + return 0 + @staticmethod + def getValue(location, bit , type): + value_t = get_pmc_register(location) + if value_t.startswith("ERR") : + return value_t + if (type == 1): + return float(value_t)/1000 + elif (type == 2): + return float(value_t)/100 + elif (type == 3): + psu_status = int(value_t,16) + return (psu_status & (1<< bit)) >> bit + elif (type == 4): + return int(value_t,10) + else: + return value_t; +#######temp + @staticmethod + def getTemp(self, name, location , ret_t): + ret2 = self.getValue(location + "temp1_input" ," " ,1); + ret3 = self.getValue(location + "temp1_max" ," ", 1); + ret4 = self.getValue(location + "temp1_max_hyst" ," ", 1); + ret_t["temp1_input"] = ret2 + ret_t["temp1_max"] = ret3 + ret_t["temp1_max_hyst"] = ret4 + @staticmethod + def getLM75(name, location, result): + c1=checktype + r1={} + c1.getTemp(c1, name, location, r1) + result[name] = r1 +##########fanFRU + @staticmethod + def decodeBinByValue(retval): + fru = ipmifru() + fru.decodeBin(retval) + return fru + + @staticmethod + def printbinvalue(b): + index = 0 + print " ", + for width in range(16): + print "%02x " % width, + print "" + for i in range(0, len(b)): + if index % 16 == 0: + print " " + print " %02x " % i, + print "%02x " % ord(b[i]), + index += 1 + print "" + + @staticmethod + def getfruValue(val): + binval = checktype.getValue(val, 0 , 0) + fanpro = {} + ret = checktype.decodeBinByValue(binval) + fanpro['fan_type'] = ret.productInfoArea.productName + fanpro['hw_version'] = int(ret.productInfoArea.productVersion, 16) + fanpro['sn'] = ret.productInfoArea.productSerialNumber + fanpro['fanid'] = ret.productInfoArea.productextra2 + return fanpro + + +class status(): + def __init__(self, productname): + self.productname = productname + + @staticmethod + def getETroot(filename): + tree = ET.parse(filename) + root = tree.getroot() + return root; + + @staticmethod + def getDecodValue(collection, decode): + decodes = collection.find('decode') + testdecode = decodes.find(decode) + test={} + for neighbor in testdecode.iter('code'): + test[neighbor.attrib["key"]]=neighbor.attrib["value"] + return test + @staticmethod + def getfileValue(location): + return checktype.getValue(location," "," ") + @staticmethod + def getETValue(a, filename, tagname): + root = status.getETroot(filename) + for neighbor in root.iter(tagname): + prob_t = {} + prob_t = neighbor.attrib + prob_t['errcode']= 0 + prob_t['errmsg'] = '' + for pros in neighbor.iter("property"): + ret = dict(neighbor.attrib.items() + pros.attrib.items()) + if ret.get('e2type') == 'fru' and ret.get("name") == "fru": + fruval = checktype.getfruValue(ret["location"]) + prob_t.update(fruval) + if ('type' not in ret.keys()): + val = "0"; + else: + val = ret["type"] + if ('bit' not in ret.keys()): + bit = "0"; + else: + bit = ret["bit"] + s = checktype.getValue(ret["location"], int(bit),int(val)) + if isinstance(s, str) and s.startswith("ERR"): + prob_t['errcode']= -1 + prob_t['errmsg']= s + if ('default' in ret.keys()): + rt = status.getDecodValue(root,ret['decode']) + prob_t['errmsg']= rt[str(s)] + if str(s) != ret["default"]: + prob_t['errcode']= -1 + break; + else: + if ('decode' in ret.keys()): + rt = status.getDecodValue(root,ret['decode']) + if(ret['decode'] == "psutype" and s.replace("\x00","").rstrip() not in rt.keys()): + prob_t['errcode']= -1 + prob_t['errmsg'] = '%s'% ("Not supported PSU") + else: + s = rt[str(s).replace("\x00","").rstrip()] + name = ret["name"] + prob_t[name]=str(s) + a.append(prob_t) + @staticmethod + def getCPUValue(a, filename, tagname): + root = status.getETroot(filename) + for neighbor in root.iter(tagname): + location = neighbor.attrib["location"] + L=[] + for dirpath, dirnames, filenames in os.walk(location): + for file in filenames : + if file.endswith("input"): + L.append(os.path.join(dirpath, file)) + L =sorted(L,reverse=False) + for i in range(len(L)): + prob_t = {} + prob_t["name"] = getPMCreg("%s/temp%d_label"%(location,i+1)) + prob_t["temp"] = float(getPMCreg("%s/temp%d_input"%(location,i+1)))/1000 + prob_t["alarm"] = float(getPMCreg("%s/temp%d_crit_alarm"%(location,i+1)))/1000 + prob_t["crit"] = float(getPMCreg("%s/temp%d_crit"%(location,i+1)))/1000 + prob_t["max"] = float(getPMCreg("%s/temp%d_max"%(location,i+1)))/1000 + a.append(prob_t) + + @staticmethod + def getFileName(): + return os.path.dirname(os.path.realpath(__file__)) + "/"+ CONFIG_NAME + @staticmethod + def getFan(ret): + _filename = status.getFileName() + _tagname = "fan" + status.getvalue(ret, _filename, _tagname) + @staticmethod + def checkFan(ret): + _filename = status.getFileName() + # _filename = "/usr/local/bin/" + status.getFileName() + _tagname = "fan" + status.getETValue(ret, _filename, _tagname) + @staticmethod + def getTemp(ret): + _filename = status.getFileName() + #_filename = "/usr/local/bin/" + status.getFileName() + _tagname = "temp" + status.getETValue(ret, _filename, _tagname) + @staticmethod + def getPsu(ret): + _filename = status.getFileName() + # _filename = "/usr/local/bin/" + status.getFileName() + _tagname = "psu" + status.getETValue(ret, _filename, _tagname) + + @staticmethod + def getcputemp(ret): + _filename = status.getFileName() + _tagname = "cpus" + status.getCPUValue(ret, _filename, _tagname) + + @staticmethod + def checkSlot(ret): + _filename = status.getFileName() + # _filename = "/usr/local/bin/" + status.getFileName() + _tagname = "slot" + status.getETValue(ret, _filename, _tagname) + + diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/pddf/pd-plugin.json b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/pddf/pd-plugin.json new file mode 100644 index 000000000000..ffa06ff74303 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/pddf/pd-plugin.json @@ -0,0 +1,67 @@ +{ + "XCVR": { + "xcvr_present": { + "i2c": { + "valmap-SFP28": { + "1": true, + "0": false + }, + "valmap-QSFP28": { + "1": true, + "0": false + } + } + } + }, + + "PSU": { + "psu_present": { + "i2c": { + "valmap": { + "1": true, + "0": false + } + } + }, + + "psu_power_good": { + "i2c": { + "valmap": { + "1": true, + "0": false + } + } + }, + + "psu_fan_dir": { + "i2c": { + "valmap": { + "F2B": "EXHAUST", + "B2F": "INTAKE" + } + } + }, + "PSU_FAN_MAX_SPEED": "18000" + }, + + "FAN": { + "direction": { + "i2c": { + "valmap": { + "1": "INTAKE", + "0": "EXHAUST" + } + } + }, + "present": { + "i2c": { + "valmap": { + "1": true, + "0": false + } + } + }, + "duty_cycle_to_pwm": "lambda dc: dc*255/100", + "pwm_to_duty_cycle": "lambda pwm: pwm*100/255" + } +} diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/pddf/pddf-device.json b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/pddf/pddf-device.json new file mode 100755 index 000000000000..9e5c150527cc --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/pddf/pddf-device.json @@ -0,0 +1,13877 @@ +{ + "PLATFORM": { + "num_psus": 4, + "num_fantrays": 6, + "num_fans_pertray": 2, + "num_ports": 128, + "num_temps": 18, + "pddf_dev_types": { + "description": "RA-B6920-4S", + "CPLD": [ + "i2c_cpld" + ], + "PSU": [ + "psu_eeprom", + "psu_pmbus" + ], + "FAN": [ + "fan_ctrl", + "fan_cpld", + "fan_eeprom" + ], + "PORT_MODULE": [ + "pddf_xcvr", + "optoe1", + "optoe2" + ] + }, + "std_kos": [ + "i2c-i801", + "i2c_dev", + "rg_i2c_gpio", + "rg_i2c_algo_bit", + "i2c_mux", + "i2c_mux_pca954x force_create_bus=1", + "lm75", + "tmp401", + "rg_gpio_xeon", + "ragile_common dfd_my_type=0x404d", + "lpc_dbg", + "lpc_cpld_i2c", + "lpc_cpld_i2c_ocores", + "rg_lpc_cpld", + "optoe", + "at24" + ], + "pddf_kos": [ + "pddf_client_module", + "pddf_cpld_module", + "pddf_cpld_driver", + "pddf_mux_module", + "pddf_xcvr_module", + "pddf_xcvr_driver_module", + "pddf_psu_driver_module", + "pddf_psu_module", + "pddf_fan_driver_module", + "pddf_fan_module", + "pddf_sysstatus_module" + ], + "custom_kos": [ + "pddf_custom_fan", + "pddf_custom_psu", + "pddf_custom_xcvr", + "pddf_custom_led_module" + ] + }, + + "SYSTEM": { + "dev_info": { + "device_type": "CPU", + "device_name": "ROOT_COMPLEX", + "device_parent": null + }, + "i2c": { + "CONTROLLERS": [{ + "dev_name": "i2c-0", + "dev": "SMBUS0" + }, { + "dev_name": "i2c-1", + "dev": "I2C-GPIO0" + }, { + "dev_name": "i2c-2", + "dev": "CPLD-OCORE0" + }, { + "dev_name": "i2c-3", + "dev": "CPLD-OCORE1" + },{ + "dev_name": "i2c-4", + "dev": "CPLD-OCORE2" + },{ + "dev_name": "i2c-5", + "dev": "CPLD-OCORE3" + },{ + "dev_name": "i2c-6", + "dev": "CPLD-OCORE4" + }] + } + }, + + "SMBUS0": { + "dev_info": { + "device_type": "SMBUS", + "device_name": "SMBUS0", + "device_parent": "SYSTEM" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x0" + }, + "DEVICES": [] + } + }, + + "I2C-GPIO0": { + "dev_info": { + "device_type": "I2C-GPIO", + "device_name": "I2C-GPIO0", + "device_parent": "SYSTEM" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x1" + }, + "DEVICES": [{ + "dev": "EEPROM1" + } + ] + } + }, + + "EEPROM1": { + "dev_info": { + "device_type": "EEPROM", + "device_name": "EEPROM1", + "device_parent": "I2C-GPIO0" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x1", + "dev_addr": "0x56", + "dev_type": "24c02" + }, + "dev_attr": { + "access_mode": "BLOCK" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "CPLD-OCORE0": { + "dev_info": { + "device_type": "CPLD-OCORE", + "device_name": "CPLD-OCORE0", + "device_parent": "SYSTEM" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x2" + }, + "DEVICES": [{ + "dev": "MUX0" + }, { + "dev": "FAN-CTRL" + } + ] + } + }, + + "MUX0": { + "dev_info": { + "device_type": "MUX", + "device_name": "MUX0", + "device_parent": "CPLD-OCORE0" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x2", + "dev_addr": "0x76", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x07" + }, + "channel": [{ + "chn": "0", + "dev": "MUX1" + }, + { + "chn": "1", + "dev": "MUX2" + }, + { + "chn": "2", + "dev": "MUX3" + }, + { + "chn": "4", + "dev": "MUX4" + }, + { + "chn": "5", + "dev": "MUX5" + }, + { + "chn": "6", + "dev": "V-MUX-CONTROLLER0" + }, + { + "chn": "7", + "dev": "V-MUX-CONTROLLER1" + } + ] + } + }, + + "MUX1": { + "dev_info": { + "device_type": "MUX", + "device_name": "MUX1", + "device_parent": "MUX0" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x7", + "dev_addr": "0x77", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0xf" + }, + "channel": [ + { + "chn": "1", + "dev": "V-CONTROLLER0" + } + ] + } + }, + + "V-CONTROLLER0": { + "dev_info": { + "device_type": "CPU", + "device_name": "V-CONTROLLER0", + "device_parent": "MUX1" + }, + "i2c": { + "CONTROLLERS": [{ + "dev_name": "i2c-16", + "dev": "TEMP-NODE0" + }] + } + }, + + "TEMP-NODE0": { + "dev_info": { + "device_type": "TEMP-NODE", + "device_name": "LC4-TEMP-NODE", + "device_parent": "MUX1" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x10", + "parent_bus": "0x7" + }, + "DEVICES": [{ + "dev": "TEMP1" + },{ + "dev": "TEMP2" + },{ + "dev": "TEMP3" + } + ] + } + }, + + "TEMP1": { + "dev_info": { + "device_type": "TEMP_SENSOR", + "device_name": "LC4-TEMP1", + "device_parent": "MUX1" + }, + "dev_attr": { + "display_name": "LC4-TEMP1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x10", + "dev_addr": "0x48", + "dev_type": "lm75" + }, + "attr_list": [{ + "attr_name": "temp1_high_threshold", + "drv_attr_name": "temp1_max" + }, + { + "attr_name": "temp1_max_hyst" + }, + { + "attr_name": "temp1_input" + } + ] + } + }, + + "TEMP2": { + "dev_info": { + "device_type": "TEMP_SENSOR", + "device_name": "LC4-TEMP2", + "device_parent": "MUX1" + }, + "dev_attr": { + "display_name": "LC4-TEMP2" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x10", + "dev_addr": "0x49", + "dev_type": "lm75" + }, + "attr_list": [{ + "attr_name": "temp1_high_threshold", + "drv_attr_name": "temp1_max" + }, + { + "attr_name": "temp1_max_hyst" + }, + { + "attr_name": "temp1_input" + } + ] + } + }, + + "TEMP3": { + "dev_info": { + "device_type": "TEMP_SENSOR", + "device_name": "LC4-TEMP3", + "device_parent": "MUX1" + }, + "dev_attr": { + "display_name": "LC4-TEMP3" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x10", + "dev_addr": "0x4d", + "dev_type": "lm75" + }, + "attr_list": [{ + "attr_name": "temp1_high_threshold", + "drv_attr_name": "temp1_max" + }, + { + "attr_name": "temp1_max_hyst" + }, + { + "attr_name": "temp1_input" + } + ] + } + }, + + "MUX2": { + "dev_info": { + "device_type": "MUX", + "device_name": "MUX2", + "device_parent": "MUX0" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x8", + "dev_addr": "0x77", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x17" + }, + "channel": [{ + "chn": "0", + "dev": "PSU1" + }, + { + "chn": "1", + "dev": "PSU2" + }, + { + "chn": "2", + "dev": "PSU3" + }, + { + "chn": "3", + "dev": "PSU4" + }, + { + "chn": "5", + "dev": "V-CONTROLLER1" + }, + { + "chn": "6", + "dev": "V-CONTROLLER2" + } + ] + } + }, + + "PSU1": { + "dev_info": { + "device_type": "PSU", + "device_name": "PSU1", + "device_parent": "MUX2" + }, + "dev_attr": { + "dev_idx": "1", + "num_psu_fans": "1" + }, + "i2c": { + "interface": [{ + "itf": "pmbus", + "dev": "PSU1-PMBUS" + }, + { + "itf": "eeprom", + "dev": "PSU1-EEPROM" + } + ] + } + }, + + "PSU1-PMBUS": { + "dev_info": { + "device_type": "PSU-PMBUS", + "device_name": "PSU1-PMBUS", + "device_parent": "MUX2", + "virt_parent": "PSU1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x17", + "dev_addr": "0x58", + "dev_type": "psu_pmbus" + }, + "attr_list": [{ + "attr_name": "psu_present", + "attr_devtype": "io", + "attr_offset": "0xb27", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "psu_model_name", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x9a", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "12" + }, + { + "attr_name": "psu_power_good", + "attr_devtype": "io", + "attr_offset": "0xb27", + "attr_mask": "0x2", + "attr_cmpval": "0x2", + "attr_len": "1" + }, + { + "attr_name": "psu_mfr_id", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x99", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "10" + }, + { + "attr_name": "psu_fan_dir", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0xc3", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "5" + }, + { + "attr_name": "psu_v_out", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x8b", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_i_out", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x8c", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_p_out", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x96", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_fan1_speed_rpm", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x90", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_temp1_input", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x8d", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + } + ] + } + }, + + "PSU1-EEPROM": { + "dev_info": { + "device_type": "PSU-EEPROM", + "device_name": "PSU1-EEPROM", + "device_parent": "MUX2", + "virt_parent": "PSU1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x17", + "dev_addr": "0x50", + "dev_type": "psu_eeprom" + }, + "attr_list": [{ + "attr_name": "psu_serial_num", + "attr_devaddr": "0x50", + "attr_devtype": "eeprom", + "attr_offset": "0x38", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "20" + }] + } + }, + + "PSU2": { + "dev_info": { + "device_type": "PSU", + "device_name": "PSU2", + "device_parent": "MUX2" + }, + "dev_attr": { + "dev_idx": "2", + "num_psu_fans": "1" + }, + "i2c": { + "interface": [{ + "itf": "pmbus", + "dev": "PSU2-PMBUS" + }, + { + "itf": "eeprom", + "dev": "PSU2-EEPROM" + } + ] + } + }, + + "PSU2-PMBUS": { + "dev_info": { + "device_type": "PSU-PMBUS", + "device_name": "PSU2-PMBUS", + "device_parent": "MUX2", + "virt_parent": "PSU2" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x18", + "dev_addr": "0x58", + "dev_type": "psu_pmbus" + }, + "attr_list": [{ + "attr_name": "psu_present", + "attr_devtype": "io", + "attr_offset": "0xb28", + "attr_mask": "0x01", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "psu_model_name", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x9a", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "12" + }, + { + "attr_name": "psu_power_good", + "attr_devtype": "io", + "attr_offset": "0xb28", + "attr_mask": "0x02", + "attr_cmpval": "0x02", + "attr_len": "1" + }, + { + "attr_name": "psu_mfr_id", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x99", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "10" + }, + { + "attr_name": "psu_fan_dir", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0xc3", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "5" + }, + { + "attr_name": "psu_v_out", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x8b", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_i_out", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x8c", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_p_out", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x96", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_fan1_speed_rpm", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x90", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_temp1_input", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x8d", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + } + ] + } + }, + + "PSU2-EEPROM": { + "dev_info": { + "device_type": "PSU-EEPROM", + "device_name": "PSU2-EEPROM", + "device_parent": "MUX2", + "virt_parent": "PSU2" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x18", + "dev_addr": "0x50", + "dev_type": "psu_eeprom" + }, + "attr_list": [{ + "attr_name": "psu_serial_num", + "attr_devaddr": "0x50", + "attr_devtype": "eeprom", + "attr_offset": "0x38", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "20" + }] + } + }, + + "PSU3": { + "dev_info": { + "device_type": "PSU", + "device_name": "PSU3", + "device_parent": "MUX2" + }, + "dev_attr": { + "dev_idx": "3", + "num_psu_fans": "1" + }, + "i2c": { + "interface": [{ + "itf": "pmbus", + "dev": "PSU3-PMBUS" + }, + { + "itf": "eeprom", + "dev": "PSU3-EEPROM" + } + ] + } + }, + + "PSU3-PMBUS": { + "dev_info": { + "device_type": "PSU-PMBUS", + "device_name": "PSU3-PMBUS", + "device_parent": "MUX2", + "virt_parent": "PSU3" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x19", + "dev_addr": "0x58", + "dev_type": "psu_pmbus" + }, + "attr_list": [{ + "attr_name": "psu_present", + "attr_devtype": "io", + "attr_offset": "0xb29", + "attr_mask": "0x01", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "psu_model_name", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x9a", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "12" + }, + { + "attr_name": "psu_power_good", + "attr_devtype": "io", + "attr_offset": "0xb29", + "attr_mask": "0x02", + "attr_cmpval": "0x02", + "attr_len": "1" + }, + { + "attr_name": "psu_mfr_id", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x99", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "10" + }, + { + "attr_name": "psu_fan_dir", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0xc3", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "5" + }, + { + "attr_name": "psu_v_out", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x8b", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_i_out", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x8c", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_p_out", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x96", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_fan1_speed_rpm", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x90", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_temp1_input", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x8d", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + } + ] + } + }, + + "PSU3-EEPROM": { + "dev_info": { + "device_type": "PSU-EEPROM", + "device_name": "PSU3-EEPROM", + "device_parent": "MUX2", + "virt_parent": "PSU3" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x19", + "dev_addr": "0x50", + "dev_type": "psu_eeprom" + }, + "attr_list": [{ + "attr_name": "psu_serial_num", + "attr_devaddr": "0x50", + "attr_devtype": "eeprom", + "attr_offset": "0x38", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "20" + }] + } + }, + + "PSU4": { + "dev_info": { + "device_type": "PSU", + "device_name": "PSU4", + "device_parent": "MUX2" + }, + "dev_attr": { + "dev_idx": "4", + "num_psu_fans": "1" + }, + "i2c": { + "interface": [{ + "itf": "pmbus", + "dev": "PSU4-PMBUS" + }, + { + "itf": "eeprom", + "dev": "PSU4-EEPROM" + } + ] + } + }, + + "PSU4-PMBUS": { + "dev_info": { + "device_type": "PSU-PMBUS", + "device_name": "PSU4-PMBUS", + "device_parent": "MUX2", + "virt_parent": "PSU4" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x1a", + "dev_addr": "0x58", + "dev_type": "psu_pmbus" + }, + "attr_list": [{ + "attr_name": "psu_present", + "attr_devtype": "io", + "attr_offset": "0xb2a", + "attr_mask": "0x01", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "psu_model_name", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x9a", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "12" + }, + { + "attr_name": "psu_power_good", + "attr_devtype": "io", + "attr_offset": "0xb2a", + "attr_mask": "0x02", + "attr_cmpval": "0x02", + "attr_len": "1" + }, + { + "attr_name": "psu_mfr_id", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x99", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "10" + }, + { + "attr_name": "psu_fan_dir", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0xc3", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "5" + }, + { + "attr_name": "psu_v_out", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x8b", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_i_out", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x8c", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_p_out", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x96", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_fan1_speed_rpm", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x90", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + }, + { + "attr_name": "psu_temp1_input", + "attr_devaddr": "0x58", + "attr_devtype": "pmbus", + "attr_offset": "0x8d", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "2" + } + ] + } + }, + + "PSU4-EEPROM": { + "dev_info": { + "device_type": "PSU-EEPROM", + "device_name": "PSU4-EEPROM", + "device_parent": "MUX2", + "virt_parent": "PSU4" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x1a", + "dev_addr": "0x50", + "dev_type": "psu_eeprom" + }, + "attr_list": [{ + "attr_name": "psu_serial_num", + "attr_devaddr": "0x50", + "attr_devtype": "eeprom", + "attr_offset": "0x38", + "attr_mask": "0x0", + "attr_cmpval": "0xff", + "attr_len": "20" + }] + } + }, + + "V-CONTROLLER1": { + "dev_info": { + "device_type": "CPU", + "device_name": "V-CONTROLLER1", + "device_parent": "MUX2" + }, + "i2c": { + "CONTROLLERS": [{ + "dev_name": "i2c-28", + "dev": "TEMP-NODE1" + }] + } + }, + + "TEMP-NODE1": { + "dev_info": { + "device_type": "TEMP-NODE", + "device_name": "MAC-TEMP-NODE0", + "device_parent": "MUX2" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x1c", + "parent_bus": "0x8" + }, + "DEVICES": [{ + "dev": "TEMP4" + } + ] + } + }, + + "TEMP4": { + "dev_info": { + "device_type": "TEMP_SENSOR", + "device_name": "TEMP-MAC-OUTLET", + "device_parent": "MUX2" + }, + "dev_attr": { + "display_name": "Temp_MAC_OUTLET" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x1c", + "dev_addr": "0x4b", + "dev_type": "lm75" + }, + "attr_list": [{ + "attr_name": "temp1_high_threshold", + "drv_attr_name": "temp1_max" + }, + { + "attr_name": "temp1_max_hyst" + }, + { + "attr_name": "temp1_input" + } + ] + } + }, + + "V-CONTROLLER2": { + "dev_info": { + "device_type": "CPU", + "device_name": "V-CONTROLLER2", + "device_parent": "MUX2" + }, + "i2c": { + "CONTROLLERS": [{ + "dev_name": "i2c-29", + "dev": "TEMP-NODE2" + }] + } + }, + + "TEMP-NODE2": { + "dev_info": { + "device_type": "TEMP-NODE", + "device_name": "MAC-TEMP-NODE1", + "device_parent": "MUX2" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x1d", + "parent_bus": "0x8" + }, + "DEVICES": [{ + "dev": "TEMP5" + } + ] + } + }, + + "TEMP5": { + "dev_info": { + "device_type": "TEMP_SENSOR", + "device_name": "TEMP-MAC-INLET", + "device_parent": "MUX2" + }, + "dev_attr": { + "display_name": "Temp_MAC_INLET" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x1d", + "dev_addr": "0x4f", + "dev_type": "lm75" + }, + "attr_list": [{ + "attr_name": "temp1_high_threshold", + "drv_attr_name": "temp1_max" + }, + { + "attr_name": "temp1_max_hyst" + }, + { + "attr_name": "temp1_input" + } + ] + } + }, + + "MUX3": { + "dev_info": { + "device_type": "MUX", + "device_name": "MUX3", + "device_parent": "MUX0" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x9", + "dev_addr": "0x77", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x1f" + }, + "channel": [ + { + "chn": "1", + "dev": "V-CONTROLLER3" + } + ] + } + }, + + "V-CONTROLLER3": { + "dev_info": { + "device_type": "CPU", + "device_name": "V-CONTROLLER3", + "device_parent": "MUX3" + }, + "i2c": { + "CONTROLLERS": [{ + "dev_name": "i2c-32", + "dev": "TEMP-NODE3" + }] + } + }, + + "TEMP-NODE3": { + "dev_info": { + "device_type": "TEMP-NODE", + "device_name": "LC1-TEMP-NODE", + "device_parent": "MUX3" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x20", + "parent_bus": "0x9" + }, + "DEVICES": [{ + "dev": "TEMP6" + },{ + "dev": "TEMP7" + },{ + "dev": "TEMP8" + } + ] + } + }, + + "TEMP6": { + "dev_info": { + "device_type": "TEMP_SENSOR", + "device_name": "LC1-TEMP0", + "device_parent": "MUX3" + }, + "dev_attr": { + "display_name": "Temp_LC1_A" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x20", + "dev_addr": "0x48", + "dev_type": "lm75" + }, + "attr_list": [{ + "attr_name": "temp1_high_threshold", + "drv_attr_name": "temp1_max" + }, + { + "attr_name": "temp1_max_hyst" + }, + { + "attr_name": "temp1_input" + } + ] + } + }, + + "TEMP7": { + "dev_info": { + "device_type": "TEMP_SENSOR", + "device_name": "LC1-TEMP1", + "device_parent": "MUX3" + }, + "dev_attr": { + "display_name": "Temp_LC1_B" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x20", + "dev_addr": "0x49", + "dev_type": "lm75" + }, + "attr_list": [{ + "attr_name": "temp1_high_threshold", + "drv_attr_name": "temp1_max" + }, + { + "attr_name": "temp1_max_hyst" + }, + { + "attr_name": "temp1_input" + } + ] + } + }, + + "TEMP8": { + "dev_info": { + "device_type": "TEMP_SENSOR", + "device_name": "LC1-TEMP2", + "device_parent": "MUX3" + }, + "dev_attr": { + "display_name": "Temp_LC1_C" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x20", + "dev_addr": "0x4d", + "dev_type": "lm75" + }, + "attr_list": [{ + "attr_name": "temp1_high_threshold", + "drv_attr_name": "temp1_max" + }, + { + "attr_name": "temp1_max_hyst" + }, + { + "attr_name": "temp1_input" + } + ] + } + }, + + "MUX4": { + "dev_info": { + "device_type": "MUX", + "device_name": "MUX4", + "device_parent": "MUX0" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xb", + "dev_addr": "0x77", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x27" + }, + "channel": [ + { + "chn": "1", + "dev": "V-CONTROLLER4" + } + ] + } + }, + + "V-CONTROLLER4": { + "dev_info": { + "device_type": "CPU", + "device_name": "V-CONTROLLER4", + "device_parent": "MUX4" + }, + "i2c": { + "CONTROLLERS": [{ + "dev_name": "i2c-40", + "dev": "TEMP-NODE4" + }] + } + }, + + "TEMP-NODE4": { + "dev_info": { + "device_type": "TEMP-NODE", + "device_name": "LC3-TEMP-NODE", + "device_parent": "MUX4" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x28", + "parent_bus": "0xb" + }, + "DEVICES": [{ + "dev": "TEMP9" + },{ + "dev": "TEMP10" + },{ + "dev": "TEMP11" + } + ] + } + }, + + "TEMP9": { + "dev_info": { + "device_type": "TEMP_SENSOR", + "device_name": "LC3-TEMP0", + "device_parent": "MUX4" + }, + "dev_attr": { + "display_name": "Temp_LC3_A" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x28", + "dev_addr": "0x48", + "dev_type": "lm75" + }, + "attr_list": [{ + "attr_name": "temp1_high_threshold", + "drv_attr_name": "temp1_max" + }, + { + "attr_name": "temp1_max_hyst" + }, + { + "attr_name": "temp1_input" + } + ] + } + }, + + "TEMP10": { + "dev_info": { + "device_type": "TEMP_SENSOR", + "device_name": "LC3-TEMP1", + "device_parent": "MUX4" + }, + "dev_attr": { + "display_name": "Temp_LC3_B" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x28", + "dev_addr": "0x49", + "dev_type": "lm75" + }, + "attr_list": [{ + "attr_name": "temp1_high_threshold", + "drv_attr_name": "temp1_max" + }, + { + "attr_name": "temp1_max_hyst" + }, + { + "attr_name": "temp1_input" + } + ] + } + }, + + "TEMP11": { + "dev_info": { + "device_type": "TEMP_SENSOR", + "device_name": "LC3-TEMP2", + "device_parent": "MUX4" + }, + "dev_attr": { + "display_name": "Temp_LC3_C" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x28", + "dev_addr": "0x4d", + "dev_type": "lm75" + }, + "attr_list": [{ + "attr_name": "temp1_high_threshold", + "drv_attr_name": "temp1_max" + }, + { + "attr_name": "temp1_max_hyst" + }, + { + "attr_name": "temp1_input" + } + ] + } + }, + + "MUX5": { + "dev_info": { + "device_type": "MUX", + "device_name": "MUX5", + "device_parent": "MUX0" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xc", + "dev_addr": "0x77", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x2f" + }, + "channel": [ + { + "chn": "1", + "dev": "V-CONTROLLER5" + } + ] + } + }, + + "V-CONTROLLER5": { + "dev_info": { + "device_type": "CPU", + "device_name": "V-CONTROLLER5", + "device_parent": "MUX5" + }, + "i2c": { + "CONTROLLERS": [{ + "dev_name": "i2c-48", + "dev": "TEMP-NODE5" + }] + } + }, + + "TEMP-NODE5": { + "dev_info": { + "device_type": "TEMP-NODE", + "device_name": "LC2-TEMP-NODE", + "device_parent": "MUX5" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x30", + "parent_bus": "0xc" + }, + "DEVICES": [{ + "dev": "TEMP12" + },{ + "dev": "TEMP13" + },{ + "dev": "TEMP14" + } + ] + } + }, + + "TEMP12": { + "dev_info": { + "device_type": "TEMP_SENSOR", + "device_name": "LC2-TEMP0", + "device_parent": "MUX5" + }, + "dev_attr": { + "display_name": "Temp_LC2_A" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x30", + "dev_addr": "0x48", + "dev_type": "lm75" + }, + "attr_list": [{ + "attr_name": "temp1_high_threshold", + "drv_attr_name": "temp1_max" + }, + { + "attr_name": "temp1_max_hyst" + }, + { + "attr_name": "temp1_input" + } + ] + } + }, + + "TEMP13": { + "dev_info": { + "device_type": "TEMP_SENSOR", + "device_name": "LC2-TEMP1", + "device_parent": "MUX5" + }, + "dev_attr": { + "display_name": "Temp_LC2_B" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x30", + "dev_addr": "0x49", + "dev_type": "lm75" + }, + "attr_list": [{ + "attr_name": "temp1_high_threshold", + "drv_attr_name": "temp1_max" + }, + { + "attr_name": "temp1_max_hyst" + }, + { + "attr_name": "temp1_input" + } + ] + } + }, + + "TEMP14": { + "dev_info": { + "device_type": "TEMP_SENSOR", + "device_name": "LC2-TEMP2", + "device_parent": "MUX5" + }, + "dev_attr": { + "display_name": "Temp_LC2_C" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x30", + "dev_addr": "0x4d", + "dev_type": "lm75" + }, + "attr_list": [{ + "attr_name": "temp1_high_threshold", + "drv_attr_name": "temp1_max" + }, + { + "attr_name": "temp1_max_hyst" + }, + { + "attr_name": "temp1_input" + } + ] + } + }, + + "V-MUX-CONTROLLER0": { + "dev_info": { + "device_type": "CPU", + "device_name": "V-MUX-CONTROLLER0", + "device_parent": "MUX1" + }, + "i2c": { + "CONTROLLERS": [{ + "dev_name": "i2c-13", + "dev": "V-NODE0" + }] + } + }, + + "V-NODE0": { + "dev_info": { + "device_type": "NODE", + "device_name": "V-NODE0", + "device_parent": "MUX0" + }, + "i2c": { + "topo_info": { + "dev_addr": "0xd" + }, + "DEVICES": [ + { + "dev": "MUX6" + }, + { + "dev": "FAN-CPLD-B" + } + ] + } + }, + + "MUX6": { + "dev_info": { + "device_type": "MUX", + "device_name": "MUX6", + "device_parent": "MUX0" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xd", + "dev_addr": "0x77", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x37" + }, + "channel": [{ + "chn": "0", + "dev": "FAN2-EEPROM" + }, + { + "chn": "1", + "dev": "FAN4-EEPROM" + }, + { + "chn": "2", + "dev": "FAN6-EEPROM" + }, + { + "chn": "5", + "dev": "V-CONTROLLER6" + } + ] + } + }, + + "FAN2-EEPROM": { + "dev_info": { + "device_type": "EEPROM", + "device_name": "FAN2-EEPROM", + "device_parent": "MUX6" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x37", + "dev_addr": "0x50", + "dev_type": "24c02" + }, + "dev_attr": { + "access_mode": "BLOCK" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "FAN4-EEPROM": { + "dev_info": { + "device_type": "EEPROM", + "device_name": "FAN4-EEPROM", + "device_parent": "MUX6" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x38", + "dev_addr": "0x50", + "dev_type": "24c02" + }, + "dev_attr": { + "access_mode": "BLOCK" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "FAN6-EEPROM": { + "dev_info": { + "device_type": "EEPROM", + "device_name": "FAN4-EEPROM", + "device_parent": "MUX6" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x39", + "dev_addr": "0x50", + "dev_type": "24c02" + }, + "dev_attr": { + "access_mode": "BLOCK" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "V-CONTROLLER6": { + "dev_info": { + "device_type": "CPU", + "device_name": "V-CONTROLLER6", + "device_parent": "MUX6" + }, + "i2c": { + "CONTROLLERS": [{ + "dev_name": "i2c-60", + "dev": "TEMP-NODE6" + }] + } + }, + + "TEMP-NODE6": { + "dev_info": { + "device_type": "TEMP-NODE", + "device_name": "FAN-CONN-TEMP-NODE-B", + "device_parent": "MUX6" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x30", + "parent_bus": "0xd" + }, + "DEVICES": [{ + "dev": "TEMP15" + },{ + "dev": "TEMP16" + } + ] + } + }, + + "TEMP15": { + "dev_info": { + "device_type": "TEMP_SENSOR", + "device_name": "FAN-CONN-B-TEMP0", + "device_parent": "MUX6" + }, + "dev_attr": { + "display_name": "Temp_FAN_CONN_B_0" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3c", + "dev_addr": "0x48", + "dev_type": "lm75" + }, + "attr_list": [{ + "attr_name": "temp1_high_threshold", + "drv_attr_name": "temp1_max" + }, + { + "attr_name": "temp1_max_hyst" + }, + { + "attr_name": "temp1_input" + } + ] + } + }, + + "TEMP16": { + "dev_info": { + "device_type": "TEMP_SENSOR", + "device_name": "FAN-CONN-B-TEMP1", + "device_parent": "MUX6" + }, + "dev_attr": { + "display_name": "Temp_FAN_CONN_B_1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3c", + "dev_addr": "0x49", + "dev_type": "lm75" + }, + "attr_list": [{ + "attr_name": "temp1_high_threshold", + "drv_attr_name": "temp1_max" + }, + { + "attr_name": "temp1_max_hyst" + }, + { + "attr_name": "temp1_input" + } + ] + } + }, + + "FAN-CPLD-B": { + "dev_info": { + "device_type": "CPLD", + "device_name": "FAN-CPLD-B", + "device_parent": "V-CONTROLLER6" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xd", + "dev_addr": "0x0d", + "dev_type": "i2c_cpld" + }, + "dev_attr": {} + } + }, + + "V-MUX-CONTROLLER1": { + "dev_info": { + "device_type": "CPU", + "device_name": "V-MUX-CONTROLLER1", + "device_parent": "MUX1" + }, + "i2c": { + "CONTROLLERS": [{ + "dev_name": "i2c-14", + "dev": "V-NODE1" + }] + } + }, + + "V-NODE1": { + "dev_info": { + "device_type": "NODE", + "device_name": "V-NODE1", + "device_parent": "MUX0" + }, + "i2c": { + "topo_info": { + "dev_addr": "0xe" + }, + "DEVICES": [ + { + "dev": "MUX7" + }, + { + "dev": "FAN-CPLD-A" + } + ] + } + }, + + "MUX7": { + "dev_info": { + "device_type": "MUX", + "device_name": "MUX7", + "device_parent": "MUX0" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xe", + "dev_addr": "0x77", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x3f" + }, + "channel": [{ + "chn": "0", + "dev": "FAN1-EEPROM" + }, + { + "chn": "1", + "dev": "FAN3-EEPROM" + }, + { + "chn": "2", + "dev": "FAN5-EEPROM" + }, + { + "chn": "5", + "dev": "V-CONTROLLER7" + } + ] + } + }, + + "FAN1-EEPROM": { + "dev_info": { + "device_type": "EEPROM", + "device_name": "FAN1-EEPROM", + "device_parent": "MUX7" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3f", + "dev_addr": "0x50", + "dev_type": "24c02" + }, + "dev_attr": { + "access_mode": "BLOCK" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "FAN3-EEPROM": { + "dev_info": { + "device_type": "EEPROM", + "device_name": "FAN3-EEPROM", + "device_parent": "MUX7" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x40", + "dev_addr": "0x50", + "dev_type": "24c02" + }, + "dev_attr": { + "access_mode": "BLOCK" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "FAN5-EEPROM": { + "dev_info": { + "device_type": "EEPROM", + "device_name": "FAN5-EEPROM", + "device_parent": "MUX7" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x41", + "dev_addr": "0x50", + "dev_type": "24c02" + }, + "dev_attr": { + "access_mode": "BLOCK" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "V-CONTROLLER7": { + "dev_info": { + "device_type": "CPU", + "device_name": "V-CONTROLLER7", + "device_parent": "MUX7" + }, + "i2c": { + "CONTROLLERS": [{ + "dev_name": "i2c-68", + "dev": "TEMP-NODE7" + }] + } + }, + + "TEMP-NODE7": { + "dev_info": { + "device_type": "TEMP-NODE", + "device_name": "FAN-CONN-TEMP-NODE-A", + "device_parent": "MUX7" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x44" + }, + "DEVICES": [{ + "dev": "TEMP17" + },{ + "dev": "TEMP18" + } + ] + } + }, + + "TEMP17": { + "dev_info": { + "device_type": "TEMP_SENSOR", + "device_name": "FAN-CONN-A-TEMP0", + "device_parent": "MUX7" + }, + "dev_attr": { + "display_name": "Temp_FAN_CONN_A_0" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x44", + "dev_addr": "0x48", + "dev_type": "lm75" + }, + "attr_list": [{ + "attr_name": "temp1_high_threshold", + "drv_attr_name": "temp1_max" + }, + { + "attr_name": "temp1_max_hyst" + }, + { + "attr_name": "temp1_input" + } + ] + } + }, + + "TEMP18": { + "dev_info": { + "device_type": "TEMP_SENSOR", + "device_name": "FAN-CONN-A-TEMP1", + "device_parent": "MUX7" + }, + "dev_attr": { + "display_name": "Temp_FAN_CONN_A_1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x44", + "dev_addr": "0x49", + "dev_type": "lm75" + }, + "attr_list": [{ + "attr_name": "temp1_high_threshold", + "drv_attr_name": "temp1_max" + }, + { + "attr_name": "temp1_max_hyst" + }, + { + "attr_name": "temp1_input" + } + ] + } + }, + + "FAN-CPLD-A": { + "dev_info": { + "device_type": "CPLD", + "device_name": "FAN-CPLD-A", + "device_parent": "V-CONTROLLER7" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xe", + "dev_addr": "0x0d", + "dev_type": "i2c_cpld" + }, + "dev_attr": {} + } + }, + + "CPLD-OCORE1": { + "dev_info": { + "device_type": "CPLD-OCORE", + "device_name": "CPLD-OCORE1", + "device_parent": "SYSTEM" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x3" + }, + "DEVICES": [ + { + "dev": "LC1-CPLD-A" + }, + { + "dev": "LC1-CPLD-B" + }, + { + "dev": "LC1-EEPROM" + }, + { + "dev": "LC1-TLV-EEPROM" + }, + { + "dev": "LC1-PORT-MUX0" + }, + { + "dev": "LC1-PORT-MUX1" + }, + { + "dev": "LC1-PORT-MUX2" + }, + { + "dev": "LC1-PORT-MUX3" + } + ] + } + }, + + "LC1-CPLD-A": { + "dev_info": { + "device_type": "CPLD", + "device_name": "LC1-CPLD-A", + "device_parent": "CPLD-OCORE1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3", + "dev_addr": "0x30", + "dev_type": "i2c_cpld" + }, + "dev_attr": {} + } + }, + + "LC1-CPLD-B": { + "dev_info": { + "device_type": "CPLD", + "device_name": "LC1-CPLD-B", + "device_parent": "CPLD-OCORE1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3", + "dev_addr": "0x31", + "dev_type": "i2c_cpld" + }, + "dev_attr": {} + } + }, + + "LC1-EEPROM": { + "dev_info": { + "device_type": "EEPROM", + "device_name": "LC1-EEPROM", + "device_parent": "CPLD-OCORE1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3", + "dev_addr": "0x56", + "dev_type": "24c02" + }, + "dev_attr": { + "access_mode": "BLOCK" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "LC1-TLV-EEPROM": { + "dev_info": { + "device_type": "EEPROM", + "device_name": "LC1-TLV-EEPROM", + "device_parent": "CPLD-OCORE1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3", + "dev_addr": "0x57", + "dev_type": "24c02" + }, + "dev_attr": { + "access_mode": "BLOCK" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "LC1-PORT-MUX0": { + "dev_info": { + "device_type": "MUX", + "device_name": "LC1-PORT-MUX0", + "device_parent": "CPLD-OCORE1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3", + "dev_addr": "0x70", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x47" + }, + "channel": [{ + "chn": "0", + "dev": "PORT1" + }, + { + "chn": "1", + "dev": "PORT2" + }, + { + "chn": "2", + "dev": "PORT3" + }, + { + "chn": "3", + "dev": "PORT4" + }, + { + "chn": "4", + "dev": "PORT5" + }, + { + "chn": "5", + "dev": "PORT6" + }, + { + "chn": "6", + "dev": "PORT7" + }, + { + "chn": "7", + "dev": "PORT8" + } + ] + } + }, + + "PORT1": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT1", + "device_parent": "LC1-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "1" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT1-EEPROM" + }, { + "itf": "control", + "dev": "PORT1-CTRL" + }] + } + }, + + "PORT1-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT1-EEPROM", + "device_parent": "LC1-PORT-MUX0", + "virt_parent": "PORT1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x47", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT1-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT1-CTRL", + "device_parent": "LC1-PORT-MUX0", + "virt_parent": "PORT1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x47", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT2": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT2", + "device_parent": "LC1-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "2" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT2-EEPROM" + }, { + "itf": "control", + "dev": "PORT2-CTRL" + }] + } + }, + + "PORT2-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT2-EEPROM", + "device_parent": "LC1-PORT-MUX0", + "virt_parent": "PORT2" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x48", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT2-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT2-CTRL", + "device_parent": "LC1-PORT-MUX0", + "virt_parent": "PORT2" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x48", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT3": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT3", + "device_parent": "LC1-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "3" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT3-EEPROM" + }, { + "itf": "control", + "dev": "PORT3-CTRL" + }] + } + }, + + "PORT3-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT3-EEPROM", + "device_parent": "LC1-PORT-MUX0", + "virt_parent": "PORT3" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x49", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT3-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT3-CTRL", + "device_parent": "LC1-PORT-MUX0", + "virt_parent": "PORT3" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x49", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + + "PORT4": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT4", + "device_parent": "LC1-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "4" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT4-EEPROM" + }, { + "itf": "control", + "dev": "PORT4-CTRL" + }] + } + }, + + "PORT4-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT4-EEPROM", + "device_parent": "LC1-PORT-MUX0", + "virt_parent": "PORT4" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x4a", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT4-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT4-CTRL", + "device_parent": "LC1-PORT-MUX0", + "virt_parent": "PORT4" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x4a", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + + "PORT5": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT5", + "device_parent": "LC1-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "5" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT5-EEPROM" + }, { + "itf": "control", + "dev": "PORT5-CTRL" + }] + } + }, + + "PORT5-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT5-EEPROM", + "device_parent": "LC1-PORT-MUX0", + "virt_parent": "PORT5" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x4b", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT5-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT5-CTRL", + "device_parent": "LC1-PORT-MUX0", + "virt_parent": "PORT5" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x4b", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + + "PORT6": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT6", + "device_parent": "LC1-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "6" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT6-EEPROM" + }, { + "itf": "control", + "dev": "PORT6-CTRL" + }] + } + }, + + "PORT6-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT6-EEPROM", + "device_parent": "LC1-PORT-MUX0", + "virt_parent": "PORT6" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x4c", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT6-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT6-CTRL", + "device_parent": "LC1-PORT-MUX0", + "virt_parent": "PORT6" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x4c", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT7": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT7", + "device_parent": "LC1-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "7" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT7-EEPROM" + }, { + "itf": "control", + "dev": "PORT7-CTRL" + }] + } + }, + + "PORT7-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT7-EEPROM", + "device_parent": "LC1-PORT-MUX0", + "virt_parent": "PORT7" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x4d", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT7-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT7-CTRL", + "device_parent": "LC1-PORT-MUX0", + "virt_parent": "PORT7" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x4d", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT8": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT8", + "device_parent": "LC1-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "8" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT8-EEPROM" + }, { + "itf": "control", + "dev": "PORT8-CTRL" + }] + } + }, + + "PORT8-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT8-EEPROM", + "device_parent": "LC1-PORT-MUX0", + "virt_parent": "PORT8" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x4e", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT8-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT8-CTRL", + "device_parent": "LC1-PORT-MUX0", + "virt_parent": "PORT8" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x4e", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "LC1-PORT-MUX1": { + "dev_info": { + "device_type": "MUX", + "device_name": "LC1-PORT-MUX1", + "device_parent": "CPLD-OCORE1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3", + "dev_addr": "0x71", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x4f" + }, + "channel": [{ + "chn": "0", + "dev": "PORT9" + }, + { + "chn": "1", + "dev": "PORT10" + }, + { + "chn": "2", + "dev": "PORT11" + }, + { + "chn": "3", + "dev": "PORT12" + }, + { + "chn": "4", + "dev": "PORT13" + }, + { + "chn": "5", + "dev": "PORT14" + }, + { + "chn": "6", + "dev": "PORT15" + }, + { + "chn": "7", + "dev": "PORT16" + } + ] + } + }, + + "PORT9": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT9", + "device_parent": "LC1-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "9" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT9-EEPROM" + }, { + "itf": "control", + "dev": "PORT9-CTRL" + }] + } + }, + + "PORT9-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT9-EEPROM", + "device_parent": "LC1-PORT-MUX1", + "virt_parent": "PORT9" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x4f", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT9-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT9-CTRL", + "device_parent": "LC1-PORT-MUX1", + "virt_parent": "PORT9" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x4f", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT10": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT10", + "device_parent": "LC1-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "10" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT10-EEPROM" + }, { + "itf": "control", + "dev": "PORT10-CTRL" + }] + } + }, + + "PORT10-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT10-EEPROM", + "device_parent": "LC1-PORT-MUX1", + "virt_parent": "PORT10" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x50", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT10-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT10-CTRL", + "device_parent": "LC1-PORT-MUX1", + "virt_parent": "PORT10" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x50", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT11": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT11", + "device_parent": "LC1-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "11" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT11-EEPROM" + }, { + "itf": "control", + "dev": "PORT11-CTRL" + }] + } + }, + + "PORT11-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT11-EEPROM", + "device_parent": "LC1-PORT-MUX1", + "virt_parent": "PORT11" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x51", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT11-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT11-CTRL", + "device_parent": "LC1-PORT-MUX1", + "virt_parent": "PORT11" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x51", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT12": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT12", + "device_parent": "LC1-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "12" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT12-EEPROM" + }, { + "itf": "control", + "dev": "PORT12-CTRL" + }] + } + }, + + "PORT12-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT12-EEPROM", + "device_parent": "LC1-PORT-MUX1", + "virt_parent": "PORT12" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x52", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT12-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT12-CTRL", + "device_parent": "LC1-PORT-MUX1", + "virt_parent": "PORT12" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x52", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT13": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT13", + "device_parent": "LC1-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "13" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT13-EEPROM" + }, { + "itf": "control", + "dev": "PORT13-CTRL" + }] + } + }, + + "PORT13-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT13-EEPROM", + "device_parent": "LC1-PORT-MUX1", + "virt_parent": "PORT13" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x53", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT13-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT13-CTRL", + "device_parent": "LC1-PORT-MUX1", + "virt_parent": "PORT13" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x53", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT14": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT14", + "device_parent": "LC1-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "14" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT14-EEPROM" + }, { + "itf": "control", + "dev": "PORT14-CTRL" + }] + } + }, + + "PORT14-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT14-EEPROM", + "device_parent": "LC1-PORT-MUX1", + "virt_parent": "PORT14" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x54", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT14-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT14-CTRL", + "device_parent": "LC1-PORT-MUX1", + "virt_parent": "PORT14" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x54", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT15": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT15", + "device_parent": "LC1-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "15" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT15-EEPROM" + }, { + "itf": "control", + "dev": "PORT15-CTRL" + }] + } + }, + + "PORT15-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT15-EEPROM", + "device_parent": "LC1-PORT-MUX1", + "virt_parent": "PORT15" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x55", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT15-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT15-CTRL", + "device_parent": "LC1-PORT-MUX1", + "virt_parent": "PORT15" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x55", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT16": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT16", + "device_parent": "LC1-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "16" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT16-EEPROM" + }, { + "itf": "control", + "dev": "PORT16-CTRL" + }] + } + }, + + "PORT16-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT16-EEPROM", + "device_parent": "LC1-PORT-MUX1", + "virt_parent": "PORT16" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x56", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT16-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT16-CTRL", + "device_parent": "LC1-PORT-MUX1", + "virt_parent": "PORT16" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x56", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "LC1-PORT-MUX2": { + "dev_info": { + "device_type": "MUX", + "device_name": "LC1-PORT-MUX2", + "device_parent": "CPLD-OCORE1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3", + "dev_addr": "0x72", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x57" + }, + "channel": [{ + "chn": "0", + "dev": "PORT17" + }, + { + "chn": "1", + "dev": "PORT18" + }, + { + "chn": "2", + "dev": "PORT19" + }, + { + "chn": "3", + "dev": "PORT20" + }, + { + "chn": "4", + "dev": "PORT21" + }, + { + "chn": "5", + "dev": "PORT22" + }, + { + "chn": "6", + "dev": "PORT23" + }, + { + "chn": "7", + "dev": "PORT24" + } + ] + } + }, + + "PORT17": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT17", + "device_parent": "LC1-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "17" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT17-EEPROM" + }, { + "itf": "control", + "dev": "PORT17-CTRL" + }] + } + }, + + "PORT17-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT17-EEPROM", + "device_parent": "LC1-PORT-MUX2", + "virt_parent": "PORT17" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x57", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT17-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT17-CTRL", + "device_parent": "LC1-PORT-MUX2", + "virt_parent": "PORT17" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x57", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT18": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT18", + "device_parent": "LC1-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "18" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT18-EEPROM" + }, { + "itf": "control", + "dev": "PORT18-CTRL" + }] + } + }, + + "PORT18-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT18-EEPROM", + "device_parent": "LC1-PORT-MUX2", + "virt_parent": "PORT18" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x58", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT18-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT18-CTRL", + "device_parent": "LC1-PORT-MUX2", + "virt_parent": "PORT18" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x58", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT19": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT19", + "device_parent": "LC1-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "19" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT19-EEPROM" + }, { + "itf": "control", + "dev": "PORT19-CTRL" + }] + } + }, + + "PORT19-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT19-EEPROM", + "device_parent": "LC1-PORT-MUX2", + "virt_parent": "PORT19" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x59", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT19-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT19-CTRL", + "device_parent": "LC1-PORT-MUX2", + "virt_parent": "PORT19" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x59", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT20": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT20", + "device_parent": "LC1-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "20" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT20-EEPROM" + }, { + "itf": "control", + "dev": "PORT20-CTRL" + }] + } + }, + + "PORT20-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT20-EEPROM", + "device_parent": "LC1-PORT-MUX2", + "virt_parent": "PORT20" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x5a", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT20-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT20-CTRL", + "device_parent": "LC1-PORT-MUX2", + "virt_parent": "PORT20" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x5a", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT21": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT21", + "device_parent": "LC1-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "21" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT21-EEPROM" + }, { + "itf": "control", + "dev": "PORT21-CTRL" + }] + } + }, + + "PORT21-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT21-EEPROM", + "device_parent": "LC1-PORT-MUX2", + "virt_parent": "PORT21" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x5b", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT21-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT21-CTRL", + "device_parent": "LC1-PORT-MUX2", + "virt_parent": "PORT21" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x5b", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT22": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT22", + "device_parent": "LC1-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "22" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT22-EEPROM" + }, { + "itf": "control", + "dev": "PORT22-CTRL" + }] + } + }, + + "PORT22-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT22-EEPROM", + "device_parent": "LC1-PORT-MUX2", + "virt_parent": "PORT22" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x5c", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT22-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT22-CTRL", + "device_parent": "LC1-PORT-MUX2", + "virt_parent": "PORT22" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x5c", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT23": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT23", + "device_parent": "LC1-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "23" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT23-EEPROM" + }, { + "itf": "control", + "dev": "PORT23-CTRL" + }] + } + }, + + "PORT23-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT23-EEPROM", + "device_parent": "LC1-PORT-MUX2", + "virt_parent": "PORT23" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x5d", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT23-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT23-CTRL", + "device_parent": "LC1-PORT-MUX2", + "virt_parent": "PORT23" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x5d", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT24": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT24", + "device_parent": "LC1-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "24" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT24-EEPROM" + }, { + "itf": "control", + "dev": "PORT24-CTRL" + }] + } + }, + + "PORT24-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT24-EEPROM", + "device_parent": "LC1-PORT-MUX2", + "virt_parent": "PORT24" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x5e", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT24-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT24-CTRL", + "device_parent": "LC1-PORT-MUX2", + "virt_parent": "PORT24" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x5e", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "LC1-PORT-MUX3": { + "dev_info": { + "device_type": "MUX", + "device_name": "LC1-PORT-MUX3", + "device_parent": "CPLD-OCORE1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x3", + "dev_addr": "0x73", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x5f" + }, + "channel": [{ + "chn": "0", + "dev": "PORT25" + }, + { + "chn": "1", + "dev": "PORT26" + }, + { + "chn": "2", + "dev": "PORT27" + }, + { + "chn": "3", + "dev": "PORT28" + }, + { + "chn": "4", + "dev": "PORT29" + }, + { + "chn": "5", + "dev": "PORT30" + }, + { + "chn": "6", + "dev": "PORT31" + }, + { + "chn": "7", + "dev": "PORT32" + } + ] + } + }, + + "PORT25": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT25", + "device_parent": "LC1-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "25" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT25-EEPROM" + }, { + "itf": "control", + "dev": "PORT25-CTRL" + }] + } + }, + + "PORT25-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT25-EEPROM", + "device_parent": "LC1-PORT-MUX3", + "virt_parent": "PORT25" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x5f", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT25-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT25-CTRL", + "device_parent": "LC1-PORT-MUX3", + "virt_parent": "PORT25" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x5f", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT26": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT26", + "device_parent": "LC1-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "26" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT26-EEPROM" + }, { + "itf": "control", + "dev": "PORT26-CTRL" + }] + } + }, + + "PORT26-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT26-EEPROM", + "device_parent": "LC1-PORT-MUX3", + "virt_parent": "PORT26" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x60", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT26-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT26-CTRL", + "device_parent": "LC1-PORT-MUX3", + "virt_parent": "PORT26" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x60", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT27": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT27", + "device_parent": "LC1-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "27" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT27-EEPROM" + }, { + "itf": "control", + "dev": "PORT27-CTRL" + }] + } + }, + + "PORT27-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT27-EEPROM", + "device_parent": "LC1-PORT-MUX3", + "virt_parent": "PORT27" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x61", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT27-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT27-CTRL", + "device_parent": "LC1-PORT-MUX3", + "virt_parent": "PORT27" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x61", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT28": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT28", + "device_parent": "LC1-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "28" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT28-EEPROM" + }, { + "itf": "control", + "dev": "PORT28-CTRL" + }] + } + }, + + "PORT28-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT28-EEPROM", + "device_parent": "LC1-PORT-MUX3", + "virt_parent": "PORT28" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x62", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT28-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT28-CTRL", + "device_parent": "LC1-PORT-MUX3", + "virt_parent": "PORT28" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x62", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT29": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT29", + "device_parent": "LC1-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "29" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT29-EEPROM" + }, { + "itf": "control", + "dev": "PORT29-CTRL" + }] + } + }, + + "PORT29-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT29-EEPROM", + "device_parent": "LC1-PORT-MUX3", + "virt_parent": "PORT29" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x63", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT29-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT29-CTRL", + "device_parent": "LC1-PORT-MUX3", + "virt_parent": "PORT29" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x63", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT30": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT30", + "device_parent": "LC1-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "30" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT30-EEPROM" + }, { + "itf": "control", + "dev": "PORT30-CTRL" + }] + } + }, + + "PORT30-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT30-EEPROM", + "device_parent": "LC1-PORT-MUX3", + "virt_parent": "PORT30" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x64", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT30-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT30-CTRL", + "device_parent": "LC1-PORT-MUX3", + "virt_parent": "PORT30" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x64", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT31": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT31", + "device_parent": "LC1-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "31" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT31-EEPROM" + }, { + "itf": "control", + "dev": "PORT31-CTRL" + }] + } + }, + + "PORT31-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT31-EEPROM", + "device_parent": "LC1-PORT-MUX3", + "virt_parent": "PORT31" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x65", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT31-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT31-CTRL", + "device_parent": "LC1-PORT-MUX3", + "virt_parent": "PORT31" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x65", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT32": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT32", + "device_parent": "LC1-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "32" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT32-EEPROM" + }, { + "itf": "control", + "dev": "PORT32-CTRL" + }] + } + }, + + "PORT32-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT32-EEPROM", + "device_parent": "LC1-PORT-MUX3", + "virt_parent": "PORT32" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x66", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT32-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT32-CTRL", + "device_parent": "LC1-PORT-MUX3", + "virt_parent": "PORT32" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x66", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC1-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "CPLD-OCORE2": { + "dev_info": { + "device_type": "CPLD-OCORE", + "device_name": "CPLD-OCORE2", + "device_parent": "SYSTEM" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x4" + }, + "DEVICES": [ + { + "dev": "LC2-CPLD-A" + }, + { + "dev": "LC2-CPLD-B" + }, + { + "dev": "LC2-EEPROM" + }, + { + "dev": "LC2-TLV-EEPROM" + }, + { + "dev": "LC2-PORT-MUX0" + }, + { + "dev": "LC2-PORT-MUX1" + }, + { + "dev": "LC2-PORT-MUX2" + }, + { + "dev": "LC2-PORT-MUX3" + } + ] + } + }, + + "LC2-CPLD-A": { + "dev_info": { + "device_type": "CPLD", + "device_name": "LC2-CPLD-A", + "device_parent": "CPLD-OCORE1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x4", + "dev_addr": "0x30", + "dev_type": "i2c_cpld" + }, + "dev_attr": {} + } + }, + + "LC2-CPLD-B": { + "dev_info": { + "device_type": "CPLD", + "device_name": "LC2-CPLD-B", + "device_parent": "CPLD-OCORE1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x4", + "dev_addr": "0x31", + "dev_type": "i2c_cpld" + }, + "dev_attr": {} + } + }, + + "LC2-EEPROM": { + "dev_info": { + "device_type": "EEPROM", + "device_name": "LC2-EEPROM", + "device_parent": "CPLD-OCORE1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x4", + "dev_addr": "0x56", + "dev_type": "24c02" + }, + "dev_attr": { + "access_mode": "BLOCK" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "LC2-TLV-EEPROM": { + "dev_info": { + "device_type": "EEPROM", + "device_name": "LC2-TLV-EEPROM", + "device_parent": "CPLD-OCORE1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x4", + "dev_addr": "0x57", + "dev_type": "24c02" + }, + "dev_attr": { + "access_mode": "BLOCK" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "LC2-PORT-MUX0": { + "dev_info": { + "device_type": "MUX", + "device_name": "LC2-PORT-MUX0", + "device_parent": "CPLD-OCORE2" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x4", + "dev_addr": "0x70", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x67" + }, + "channel": [{ + "chn": "0", + "dev": "PORT33" + }, + { + "chn": "1", + "dev": "PORT34" + }, + { + "chn": "2", + "dev": "PORT35" + }, + { + "chn": "3", + "dev": "PORT36" + }, + { + "chn": "4", + "dev": "PORT37" + }, + { + "chn": "5", + "dev": "PORT38" + }, + { + "chn": "6", + "dev": "PORT39" + }, + { + "chn": "7", + "dev": "PORT40" + } + ] + } + }, + + "PORT33": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT33", + "device_parent": "LC2-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "33" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT33-EEPROM" + }, { + "itf": "control", + "dev": "PORT33-CTRL" + }] + } + }, + + "PORT33-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT33-EEPROM", + "device_parent": "LC2-PORT-MUX0", + "virt_parent": "PORT33" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x67", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT33-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT33-CTRL", + "device_parent": "LC2-PORT-MUX0", + "virt_parent": "PORT33" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x67", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT34": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT34", + "device_parent": "LC2-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "34" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT34-EEPROM" + }, { + "itf": "control", + "dev": "PORT34-CTRL" + }] + } + }, + + "PORT34-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT34-EEPROM", + "device_parent": "LC2-PORT-MUX0", + "virt_parent": "PORT34" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x68", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT34-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT34-CTRL", + "device_parent": "LC2-PORT-MUX0", + "virt_parent": "PORT34" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x68", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT35": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT35", + "device_parent": "LC2-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "35" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT35-EEPROM" + }, { + "itf": "control", + "dev": "PORT35-CTRL" + }] + } + }, + + "PORT35-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT35-EEPROM", + "device_parent": "LC2-PORT-MUX0", + "virt_parent": "PORT35" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x69", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT35-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT35-CTRL", + "device_parent": "LC2-PORT-MUX0", + "virt_parent": "PORT35" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x69", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT36": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT36", + "device_parent": "LC2-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "36" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT36-EEPROM" + }, { + "itf": "control", + "dev": "PORT36-CTRL" + }] + } + }, + + "PORT36-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT36-EEPROM", + "device_parent": "LC2-PORT-MUX0", + "virt_parent": "PORT36" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x6a", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT36-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT36-CTRL", + "device_parent": "LC2-PORT-MUX0", + "virt_parent": "PORT36" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x6a", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT37": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT37", + "device_parent": "LC2-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "37" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT37-EEPROM" + }, { + "itf": "control", + "dev": "PORT37-CTRL" + }] + } + }, + + "PORT37-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT37-EEPROM", + "device_parent": "LC2-PORT-MUX0", + "virt_parent": "PORT37" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x6b", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT37-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT37-CTRL", + "device_parent": "LC2-PORT-MUX0", + "virt_parent": "PORT37" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x6b", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT38": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT38", + "device_parent": "LC2-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "38" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT38-EEPROM" + }, { + "itf": "control", + "dev": "PORT38-CTRL" + }] + } + }, + + "PORT38-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT38-EEPROM", + "device_parent": "LC2-PORT-MUX0", + "virt_parent": "PORT38" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x6c", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT38-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT38-CTRL", + "device_parent": "LC2-PORT-MUX0", + "virt_parent": "PORT38" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x6c", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT39": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT39", + "device_parent": "LC2-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "39" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT39-EEPROM" + }, { + "itf": "control", + "dev": "PORT39-CTRL" + }] + } + }, + + "PORT39-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT39-EEPROM", + "device_parent": "LC2-PORT-MUX0", + "virt_parent": "PORT39" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x6d", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT39-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT39-CTRL", + "device_parent": "LC2-PORT-MUX0", + "virt_parent": "PORT39" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x6d", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT40": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT40", + "device_parent": "LC2-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "40" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT40-EEPROM" + }, { + "itf": "control", + "dev": "PORT40-CTRL" + }] + } + }, + + "PORT40-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT40-EEPROM", + "device_parent": "LC2-PORT-MUX0", + "virt_parent": "PORT40" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x6e", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT40-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT40-CTRL", + "device_parent": "LC2-PORT-MUX0", + "virt_parent": "PORT40" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x6e", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "LC2-PORT-MUX1": { + "dev_info": { + "device_type": "MUX", + "device_name": "LC2-PORT-MUX1", + "device_parent": "CPLD-OCORE2" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x4", + "dev_addr": "0x71", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x6f" + }, + "channel": [{ + "chn": "0", + "dev": "PORT41" + }, + { + "chn": "1", + "dev": "PORT42" + }, + { + "chn": "2", + "dev": "PORT43" + }, + { + "chn": "3", + "dev": "PORT44" + }, + { + "chn": "4", + "dev": "PORT45" + }, + { + "chn": "5", + "dev": "PORT46" + }, + { + "chn": "6", + "dev": "PORT47" + }, + { + "chn": "7", + "dev": "PORT48" + } + ] + } + }, + + "PORT41": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT41", + "device_parent": "LC2-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "41" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT41-EEPROM" + }, { + "itf": "control", + "dev": "PORT41-CTRL" + }] + } + }, + + "PORT41-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT41-EEPROM", + "device_parent": "LC2-PORT-MUX1", + "virt_parent": "PORT41" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x6f", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT41-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT41-CTRL", + "device_parent": "LC2-PORT-MUX1", + "virt_parent": "PORT41" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x6f", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT42": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT42", + "device_parent": "LC2-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "42" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT42-EEPROM" + }, { + "itf": "control", + "dev": "PORT42-CTRL" + }] + } + }, + + "PORT42-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT42-EEPROM", + "device_parent": "LC2-PORT-MUX1", + "virt_parent": "PORT42" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x70", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT42-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT42-CTRL", + "device_parent": "LC2-PORT-MUX1", + "virt_parent": "PORT42" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x70", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT43": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT43", + "device_parent": "LC2-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "43" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT43-EEPROM" + }, { + "itf": "control", + "dev": "PORT43-CTRL" + }] + } + }, + + "PORT43-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT43-EEPROM", + "device_parent": "LC2-PORT-MUX1", + "virt_parent": "PORT43" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x71", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT43-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT43-CTRL", + "device_parent": "LC2-PORT-MUX1", + "virt_parent": "PORT43" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x71", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT44": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT44", + "device_parent": "LC2-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "44" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT44-EEPROM" + }, { + "itf": "control", + "dev": "PORT44-CTRL" + }] + } + }, + + "PORT44-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT44-EEPROM", + "device_parent": "LC2-PORT-MUX1", + "virt_parent": "PORT44" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x72", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT44-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT44-CTRL", + "device_parent": "LC2-PORT-MUX1", + "virt_parent": "PORT44" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x72", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT45": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT45", + "device_parent": "LC2-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "45" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT45-EEPROM" + }, { + "itf": "control", + "dev": "PORT45-CTRL" + }] + } + }, + + "PORT45-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT45-EEPROM", + "device_parent": "LC2-PORT-MUX1", + "virt_parent": "PORT45" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x73", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT45-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT45-CTRL", + "device_parent": "LC2-PORT-MUX1", + "virt_parent": "PORT45" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x73", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT46": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT46", + "device_parent": "LC2-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "46" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT46-EEPROM" + }, { + "itf": "control", + "dev": "PORT46-CTRL" + }] + } + }, + + "PORT46-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT46-EEPROM", + "device_parent": "LC2-PORT-MUX1", + "virt_parent": "PORT46" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x74", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT46-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT46-CTRL", + "device_parent": "LC2-PORT-MUX1", + "virt_parent": "PORT46" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x74", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT47": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT47", + "device_parent": "LC2-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "47" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT47-EEPROM" + }, { + "itf": "control", + "dev": "PORT47-CTRL" + }] + } + }, + + "PORT47-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT47-EEPROM", + "device_parent": "LC2-PORT-MUX1", + "virt_parent": "PORT47" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x75", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT47-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT47-CTRL", + "device_parent": "LC2-PORT-MUX1", + "virt_parent": "PORT47" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x75", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT48": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT48", + "device_parent": "LC2-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "48" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT48-EEPROM" + }, { + "itf": "control", + "dev": "PORT48-CTRL" + }] + } + }, + + "PORT48-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT48-EEPROM", + "device_parent": "LC2-PORT-MUX1", + "virt_parent": "PORT48" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x76", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT48-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT48-CTRL", + "device_parent": "LC2-PORT-MUX1", + "virt_parent": "PORT48" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x76", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "LC2-PORT-MUX2": { + "dev_info": { + "device_type": "MUX", + "device_name": "LC2-PORT-MUX2", + "device_parent": "CPLD-OCORE2" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x4", + "dev_addr": "0x72", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x77" + }, + "channel": [{ + "chn": "0", + "dev": "PORT49" + }, + { + "chn": "1", + "dev": "PORT50" + }, + { + "chn": "2", + "dev": "PORT51" + }, + { + "chn": "3", + "dev": "PORT52" + }, + { + "chn": "4", + "dev": "PORT53" + }, + { + "chn": "5", + "dev": "PORT54" + }, + { + "chn": "6", + "dev": "PORT55" + }, + { + "chn": "7", + "dev": "PORT56" + } + ] + } + }, + + "PORT49": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT49", + "device_parent": "LC2-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "49" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT49-EEPROM" + }, { + "itf": "control", + "dev": "PORT49-CTRL" + }] + } + }, + + "PORT49-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT49-EEPROM", + "device_parent": "LC2-PORT-MUX2", + "virt_parent": "PORT49" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x77", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT49-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT49-CTRL", + "device_parent": "LC2-PORT-MUX2", + "virt_parent": "PORT49" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x77", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT50": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT50", + "device_parent": "LC2-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "50" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT50-EEPROM" + }, { + "itf": "control", + "dev": "PORT50-CTRL" + }] + } + }, + + "PORT50-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT50-EEPROM", + "device_parent": "LC2-PORT-MUX2", + "virt_parent": "PORT50" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x78", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT50-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT50-CTRL", + "device_parent": "LC2-PORT-MUX2", + "virt_parent": "PORT50" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x78", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT51": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT51", + "device_parent": "LC2-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "51" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT51-EEPROM" + }, { + "itf": "control", + "dev": "PORT51-CTRL" + }] + } + }, + + "PORT51-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT51-EEPROM", + "device_parent": "LC2-PORT-MUX2", + "virt_parent": "PORT51" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x79", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT51-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT51-CTRL", + "device_parent": "LC2-PORT-MUX2", + "virt_parent": "PORT51" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x79", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT52": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT52", + "device_parent": "LC2-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "52" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT52-EEPROM" + }, { + "itf": "control", + "dev": "PORT52-CTRL" + }] + } + }, + + "PORT52-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT52-EEPROM", + "device_parent": "LC2-PORT-MUX2", + "virt_parent": "PORT52" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x7a", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT52-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT52-CTRL", + "device_parent": "LC2-PORT-MUX2", + "virt_parent": "PORT52" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x7a", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT53": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT53", + "device_parent": "LC2-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "53" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT53-EEPROM" + }, { + "itf": "control", + "dev": "PORT53-CTRL" + }] + } + }, + + "PORT53-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT53-EEPROM", + "device_parent": "LC2-PORT-MUX2", + "virt_parent": "PORT53" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x7b", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT53-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT53-CTRL", + "device_parent": "LC2-PORT-MUX2", + "virt_parent": "PORT53" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x7b", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT54": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT54", + "device_parent": "LC2-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "54" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT54-EEPROM" + }, { + "itf": "control", + "dev": "PORT54-CTRL" + }] + } + }, + + "PORT54-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT54-EEPROM", + "device_parent": "LC2-PORT-MUX2", + "virt_parent": "PORT54" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x7c", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT54-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT54-CTRL", + "device_parent": "LC2-PORT-MUX2", + "virt_parent": "PORT54" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x7c", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT55": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT55", + "device_parent": "LC2-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "55" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT55-EEPROM" + }, { + "itf": "control", + "dev": "PORT55-CTRL" + }] + } + }, + + "PORT55-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT55-EEPROM", + "device_parent": "LC2-PORT-MUX2", + "virt_parent": "PORT55" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x7d", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT55-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT55-CTRL", + "device_parent": "LC2-PORT-MUX2", + "virt_parent": "PORT55" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x7d", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT56": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT56", + "device_parent": "LC2-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "56" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT56-EEPROM" + }, { + "itf": "control", + "dev": "PORT56-CTRL" + }] + } + }, + + "PORT56-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT56-EEPROM", + "device_parent": "LC2-PORT-MUX2", + "virt_parent": "PORT56" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x7e", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT56-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT56-CTRL", + "device_parent": "LC2-PORT-MUX2", + "virt_parent": "PORT56" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x7e", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "LC2-PORT-MUX3": { + "dev_info": { + "device_type": "MUX", + "device_name": "LC2-PORT-MUX3", + "device_parent": "CPLD-OCORE2" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x4", + "dev_addr": "0x73", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x7f" + }, + "channel": [{ + "chn": "0", + "dev": "PORT57" + }, + { + "chn": "1", + "dev": "PORT58" + }, + { + "chn": "2", + "dev": "PORT59" + }, + { + "chn": "3", + "dev": "PORT60" + }, + { + "chn": "4", + "dev": "PORT61" + }, + { + "chn": "5", + "dev": "PORT62" + }, + { + "chn": "6", + "dev": "PORT63" + }, + { + "chn": "7", + "dev": "PORT64" + } + ] + } + }, + + "PORT57": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT57", + "device_parent": "LC2-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "57" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT57-EEPROM" + }, { + "itf": "control", + "dev": "PORT57-CTRL" + }] + } + }, + + "PORT57-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT57-EEPROM", + "device_parent": "LC2-PORT-MUX3", + "virt_parent": "PORT57" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x7f", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT57-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT57-CTRL", + "device_parent": "LC2-PORT-MUX3", + "virt_parent": "PORT57" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x7f", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT58": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT58", + "device_parent": "LC2-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "58" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT58-EEPROM" + }, { + "itf": "control", + "dev": "PORT58-CTRL" + }] + } + }, + + "PORT58-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT58-EEPROM", + "device_parent": "LC2-PORT-MUX3", + "virt_parent": "PORT58" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x80", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT58-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT58-CTRL", + "device_parent": "LC2-PORT-MUX3", + "virt_parent": "PORT58" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x80", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT59": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT59", + "device_parent": "LC2-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "59" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT59-EEPROM" + }, { + "itf": "control", + "dev": "PORT59-CTRL" + }] + } + }, + + "PORT59-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT59-EEPROM", + "device_parent": "LC2-PORT-MUX3", + "virt_parent": "PORT59" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x81", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT59-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT59-CTRL", + "device_parent": "LC2-PORT-MUX3", + "virt_parent": "PORT59" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x81", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT60": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT60", + "device_parent": "LC2-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "60" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT60-EEPROM" + }, { + "itf": "control", + "dev": "PORT60-CTRL" + }] + } + }, + + "PORT60-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT60-EEPROM", + "device_parent": "LC2-PORT-MUX3", + "virt_parent": "PORT60" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x82", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT60-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT60-CTRL", + "device_parent": "LC2-PORT-MUX3", + "virt_parent": "PORT60" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x82", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT61": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT61", + "device_parent": "LC2-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "61" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT61-EEPROM" + }, { + "itf": "control", + "dev": "PORT61-CTRL" + }] + } + }, + + "PORT61-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT61-EEPROM", + "device_parent": "LC2-PORT-MUX3", + "virt_parent": "PORT61" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x83", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT61-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT61-CTRL", + "device_parent": "LC2-PORT-MUX3", + "virt_parent": "PORT61" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x83", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT62": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT62", + "device_parent": "LC2-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "62" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT62-EEPROM" + }, { + "itf": "control", + "dev": "PORT62-CTRL" + }] + } + }, + + "PORT62-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT62-EEPROM", + "device_parent": "LC2-PORT-MUX3", + "virt_parent": "PORT62" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x84", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT62-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT62-CTRL", + "device_parent": "LC2-PORT-MUX3", + "virt_parent": "PORT62" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x84", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT63": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT63", + "device_parent": "LC2-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "63" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT63-EEPROM" + }, { + "itf": "control", + "dev": "PORT63-CTRL" + }] + } + }, + + "PORT63-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT63-EEPROM", + "device_parent": "LC2-PORT-MUX3", + "virt_parent": "PORT63" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x85", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT63-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT63-CTRL", + "device_parent": "LC2-PORT-MUX3", + "virt_parent": "PORT63" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x85", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT64": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT64", + "device_parent": "LC2-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "64" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT64-EEPROM" + }, { + "itf": "control", + "dev": "PORT64-CTRL" + }] + } + }, + + "PORT64-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT64-EEPROM", + "device_parent": "LC2-PORT-MUX3", + "virt_parent": "PORT64" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x86", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT64-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT64-CTRL", + "device_parent": "LC2-PORT-MUX3", + "virt_parent": "PORT64" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x86", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC2-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "CPLD-OCORE3": { + "dev_info": { + "device_type": "CPLD-OCORE", + "device_name": "CPLD-OCORE3", + "device_parent": "SYSTEM" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x5" + }, + "DEVICES": [ + { + "dev": "LC3-CPLD-A" + }, + { + "dev": "LC3-CPLD-B" + }, + { + "dev": "LC3-EEPROM" + }, + { + "dev": "LC3-TLV-EEPROM" + }, + { + "dev": "LC3-PORT-MUX0" + }, + { + "dev": "LC3-PORT-MUX1" + }, + { + "dev": "LC3-PORT-MUX2" + }, + { + "dev": "LC3-PORT-MUX3" + } + ] + } + }, + + "LC3-CPLD-A": { + "dev_info": { + "device_type": "CPLD", + "device_name": "LC3-CPLD-A", + "device_parent": "CPLD-OCORE1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x5", + "dev_addr": "0x30", + "dev_type": "i2c_cpld" + }, + "dev_attr": {} + } + }, + + "LC3-CPLD-B": { + "dev_info": { + "device_type": "CPLD", + "device_name": "LC3-CPLD-B", + "device_parent": "CPLD-OCORE1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x5", + "dev_addr": "0x31", + "dev_type": "i2c_cpld" + }, + "dev_attr": {} + } + }, + + "LC3-EEPROM": { + "dev_info": { + "device_type": "EEPROM", + "device_name": "LC3-EEPROM", + "device_parent": "CPLD-OCORE1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x5", + "dev_addr": "0x56", + "dev_type": "24c02" + }, + "dev_attr": { + "access_mode": "BLOCK" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "LC3-TLV-EEPROM": { + "dev_info": { + "device_type": "EEPROM", + "device_name": "LC3-TLV-EEPROM", + "device_parent": "CPLD-OCORE1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x5", + "dev_addr": "0x57", + "dev_type": "24c02" + }, + "dev_attr": { + "access_mode": "BLOCK" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "LC3-PORT-MUX0": { + "dev_info": { + "device_type": "MUX", + "device_name": "LC3-PORT-MUX0", + "device_parent": "CPLD-OCORE3" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x5", + "dev_addr": "0x70", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x87" + }, + "channel": [{ + "chn": "0", + "dev": "PORT65" + }, + { + "chn": "1", + "dev": "PORT66" + }, + { + "chn": "2", + "dev": "PORT67" + }, + { + "chn": "3", + "dev": "PORT68" + }, + { + "chn": "4", + "dev": "PORT69" + }, + { + "chn": "5", + "dev": "PORT70" + }, + { + "chn": "6", + "dev": "PORT71" + }, + { + "chn": "7", + "dev": "PORT72" + } + ] + } + }, + + "PORT65": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT65", + "device_parent": "LC3-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "65" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT65-EEPROM" + }, { + "itf": "control", + "dev": "PORT65-CTRL" + }] + } + }, + + "PORT65-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT65-EEPROM", + "device_parent": "LC3-PORT-MUX0", + "virt_parent": "PORT65" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x87", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT65-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT65-CTRL", + "device_parent": "LC3-PORT-MUX0", + "virt_parent": "PORT65" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x87", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT66": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT66", + "device_parent": "LC3-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "66" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT66-EEPROM" + }, { + "itf": "control", + "dev": "PORT66-CTRL" + }] + } + }, + + "PORT66-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT66-EEPROM", + "device_parent": "LC3-PORT-MUX0", + "virt_parent": "PORT66" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x88", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT66-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT66-CTRL", + "device_parent": "LC3-PORT-MUX0", + "virt_parent": "PORT66" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x88", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT67": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT67", + "device_parent": "LC3-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "67" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT67-EEPROM" + }, { + "itf": "control", + "dev": "PORT67-CTRL" + }] + } + }, + + "PORT67-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT67-EEPROM", + "device_parent": "LC3-PORT-MUX0", + "virt_parent": "PORT67" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x89", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT67-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT67-CTRL", + "device_parent": "LC3-PORT-MUX0", + "virt_parent": "PORT67" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x89", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT68": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT68", + "device_parent": "LC3-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "68" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT68-EEPROM" + }, { + "itf": "control", + "dev": "PORT68-CTRL" + }] + } + }, + + "PORT68-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT68-EEPROM", + "device_parent": "LC3-PORT-MUX0", + "virt_parent": "PORT68" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x8a", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT68-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT68-CTRL", + "device_parent": "LC3-PORT-MUX0", + "virt_parent": "PORT68" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x8a", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT69": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT69", + "device_parent": "LC3-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "69" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT69-EEPROM" + }, { + "itf": "control", + "dev": "PORT69-CTRL" + }] + } + }, + + "PORT69-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT69-EEPROM", + "device_parent": "LC3-PORT-MUX0", + "virt_parent": "PORT69" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x8b", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT69-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT69-CTRL", + "device_parent": "LC3-PORT-MUX0", + "virt_parent": "PORT69" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x8b", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT70": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT70", + "device_parent": "LC3-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "70" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT70-EEPROM" + }, { + "itf": "control", + "dev": "PORT70-CTRL" + }] + } + }, + + "PORT70-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT70-EEPROM", + "device_parent": "LC3-PORT-MUX0", + "virt_parent": "PORT70" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x8c", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT70-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT70-CTRL", + "device_parent": "LC3-PORT-MUX0", + "virt_parent": "PORT70" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x8c", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT71": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT71", + "device_parent": "LC3-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "71" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT71-EEPROM" + }, { + "itf": "control", + "dev": "PORT71-CTRL" + }] + } + }, + + "PORT71-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT71-EEPROM", + "device_parent": "LC3-PORT-MUX0", + "virt_parent": "PORT71" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x8d", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT71-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT71-CTRL", + "device_parent": "LC3-PORT-MUX0", + "virt_parent": "PORT71" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x8d", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT72": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT72", + "device_parent": "LC3-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "72" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT72-EEPROM" + }, { + "itf": "control", + "dev": "PORT72-CTRL" + }] + } + }, + + "PORT72-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT72-EEPROM", + "device_parent": "LC3-PORT-MUX0", + "virt_parent": "PORT72" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x8e", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT72-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT72-CTRL", + "device_parent": "LC3-PORT-MUX0", + "virt_parent": "PORT72" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x8e", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "LC3-PORT-MUX1": { + "dev_info": { + "device_type": "MUX", + "device_name": "LC3-PORT-MUX1", + "device_parent": "CPLD-OCORE3" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x5", + "dev_addr": "0x71", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x8f" + }, + "channel": [{ + "chn": "0", + "dev": "PORT73" + }, + { + "chn": "1", + "dev": "PORT74" + }, + { + "chn": "2", + "dev": "PORT75" + }, + { + "chn": "3", + "dev": "PORT76" + }, + { + "chn": "4", + "dev": "PORT77" + }, + { + "chn": "5", + "dev": "PORT78" + }, + { + "chn": "6", + "dev": "PORT79" + }, + { + "chn": "7", + "dev": "PORT80" + } + ] + } + }, + + "PORT73": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT73", + "device_parent": "LC3-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "73" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT73-EEPROM" + }, { + "itf": "control", + "dev": "PORT73-CTRL" + }] + } + }, + + "PORT73-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT73-EEPROM", + "device_parent": "LC3-PORT-MUX1", + "virt_parent": "PORT73" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x8f", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT73-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT73-CTRL", + "device_parent": "LC3-PORT-MUX1", + "virt_parent": "PORT73" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x8f", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT74": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT74", + "device_parent": "LC3-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "74" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT74-EEPROM" + }, { + "itf": "control", + "dev": "PORT74-CTRL" + }] + } + }, + + "PORT74-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT74-EEPROM", + "device_parent": "LC3-PORT-MUX1", + "virt_parent": "PORT74" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x90", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT74-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT74-CTRL", + "device_parent": "LC3-PORT-MUX1", + "virt_parent": "PORT74" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x90", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT75": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT75", + "device_parent": "LC3-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "75" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT75-EEPROM" + }, { + "itf": "control", + "dev": "PORT75-CTRL" + }] + } + }, + + "PORT75-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT75-EEPROM", + "device_parent": "LC3-PORT-MUX1", + "virt_parent": "PORT75" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x91", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT75-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT75-CTRL", + "device_parent": "LC3-PORT-MUX1", + "virt_parent": "PORT75" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x91", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT76": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT76", + "device_parent": "LC3-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "76" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT76-EEPROM" + }, { + "itf": "control", + "dev": "PORT76-CTRL" + }] + } + }, + + "PORT76-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT76-EEPROM", + "device_parent": "LC3-PORT-MUX1", + "virt_parent": "PORT76" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x92", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT76-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT76-CTRL", + "device_parent": "LC3-PORT-MUX1", + "virt_parent": "PORT76" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x92", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT77": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT77", + "device_parent": "LC3-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "77" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT77-EEPROM" + }, { + "itf": "control", + "dev": "PORT77-CTRL" + }] + } + }, + + "PORT77-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT77-EEPROM", + "device_parent": "LC3-PORT-MUX1", + "virt_parent": "PORT77" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x93", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT77-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT77-CTRL", + "device_parent": "LC3-PORT-MUX1", + "virt_parent": "PORT77" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x93", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT78": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT78", + "device_parent": "LC3-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "78" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT78-EEPROM" + }, { + "itf": "control", + "dev": "PORT78-CTRL" + }] + } + }, + + "PORT78-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT78-EEPROM", + "device_parent": "LC3-PORT-MUX1", + "virt_parent": "PORT78" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x94", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT78-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT78-CTRL", + "device_parent": "LC3-PORT-MUX1", + "virt_parent": "PORT78" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x94", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT79": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT79", + "device_parent": "LC3-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "79" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT79-EEPROM" + }, { + "itf": "control", + "dev": "PORT79-CTRL" + }] + } + }, + + "PORT79-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT79-EEPROM", + "device_parent": "LC3-PORT-MUX1", + "virt_parent": "PORT79" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x95", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT79-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT79-CTRL", + "device_parent": "LC3-PORT-MUX1", + "virt_parent": "PORT79" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x95", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT80": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT80", + "device_parent": "LC3-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "80" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT80-EEPROM" + }, { + "itf": "control", + "dev": "PORT80-CTRL" + }] + } + }, + + "PORT80-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT80-EEPROM", + "device_parent": "LC3-PORT-MUX1", + "virt_parent": "PORT80" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x96", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT80-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT80-CTRL", + "device_parent": "LC3-PORT-MUX1", + "virt_parent": "PORT80" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x96", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "LC3-PORT-MUX2": { + "dev_info": { + "device_type": "MUX", + "device_name": "LC3-PORT-MUX2", + "device_parent": "CPLD-OCORE3" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x5", + "dev_addr": "0x72", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x97" + }, + "channel": [{ + "chn": "0", + "dev": "PORT81" + }, + { + "chn": "1", + "dev": "PORT82" + }, + { + "chn": "2", + "dev": "PORT83" + }, + { + "chn": "3", + "dev": "PORT84" + }, + { + "chn": "4", + "dev": "PORT85" + }, + { + "chn": "5", + "dev": "PORT86" + }, + { + "chn": "6", + "dev": "PORT87" + }, + { + "chn": "7", + "dev": "PORT88" + } + ] + } + }, + + "PORT81": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT81", + "device_parent": "LC3-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "81" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT81-EEPROM" + }, { + "itf": "control", + "dev": "PORT81-CTRL" + }] + } + }, + + "PORT81-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT81-EEPROM", + "device_parent": "LC3-PORT-MUX2", + "virt_parent": "PORT81" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x97", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT81-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT81-CTRL", + "device_parent": "LC3-PORT-MUX2", + "virt_parent": "PORT81" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x97", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT82": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT82", + "device_parent": "LC3-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "82" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT82-EEPROM" + }, { + "itf": "control", + "dev": "PORT82-CTRL" + }] + } + }, + + "PORT82-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT82-EEPROM", + "device_parent": "LC3-PORT-MUX2", + "virt_parent": "PORT82" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x98", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT82-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT82-CTRL", + "device_parent": "LC3-PORT-MUX2", + "virt_parent": "PORT82" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x98", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT83": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT83", + "device_parent": "LC3-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "83" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT83-EEPROM" + }, { + "itf": "control", + "dev": "PORT83-CTRL" + }] + } + }, + + "PORT83-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT83-EEPROM", + "device_parent": "LC3-PORT-MUX2", + "virt_parent": "PORT83" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x99", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT83-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT83-CTRL", + "device_parent": "LC3-PORT-MUX2", + "virt_parent": "PORT83" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x99", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT84": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT84", + "device_parent": "LC3-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "84" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT84-EEPROM" + }, { + "itf": "control", + "dev": "PORT84-CTRL" + }] + } + }, + + "PORT84-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT84-EEPROM", + "device_parent": "LC3-PORT-MUX2", + "virt_parent": "PORT84" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x9a", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT84-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT84-CTRL", + "device_parent": "LC3-PORT-MUX2", + "virt_parent": "PORT84" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x9a", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT85": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT85", + "device_parent": "LC3-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "85" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT85-EEPROM" + }, { + "itf": "control", + "dev": "PORT85-CTRL" + }] + } + }, + + "PORT85-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT85-EEPROM", + "device_parent": "LC3-PORT-MUX2", + "virt_parent": "PORT85" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x9b", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT85-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT85-CTRL", + "device_parent": "LC3-PORT-MUX2", + "virt_parent": "PORT85" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x9b", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT86": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT86", + "device_parent": "LC3-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "86" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT86-EEPROM" + }, { + "itf": "control", + "dev": "PORT86-CTRL" + }] + } + }, + + "PORT86-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT86-EEPROM", + "device_parent": "LC3-PORT-MUX2", + "virt_parent": "PORT86" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x9c", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT86-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT86-CTRL", + "device_parent": "LC3-PORT-MUX2", + "virt_parent": "PORT86" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x9c", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT87": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT87", + "device_parent": "LC3-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "87" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT87-EEPROM" + }, { + "itf": "control", + "dev": "PORT87-CTRL" + }] + } + }, + + "PORT87-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT87-EEPROM", + "device_parent": "LC3-PORT-MUX2", + "virt_parent": "PORT87" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x9d", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT87-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT87-CTRL", + "device_parent": "LC3-PORT-MUX2", + "virt_parent": "PORT87" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x9d", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT88": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT88", + "device_parent": "LC3-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "88" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT88-EEPROM" + }, { + "itf": "control", + "dev": "PORT88-CTRL" + }] + } + }, + + "PORT88-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT88-EEPROM", + "device_parent": "LC3-PORT-MUX2", + "virt_parent": "PORT88" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x9e", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT88-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT88-CTRL", + "device_parent": "LC3-PORT-MUX2", + "virt_parent": "PORT88" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x9e", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "LC3-PORT-MUX3": { + "dev_info": { + "device_type": "MUX", + "device_name": "LC3-PORT-MUX3", + "device_parent": "CPLD-OCORE3" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x5", + "dev_addr": "0x73", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0x9f" + }, + "channel": [{ + "chn": "0", + "dev": "PORT89" + }, + { + "chn": "1", + "dev": "PORT90" + }, + { + "chn": "2", + "dev": "PORT91" + }, + { + "chn": "3", + "dev": "PORT92" + }, + { + "chn": "4", + "dev": "PORT93" + }, + { + "chn": "5", + "dev": "PORT94" + }, + { + "chn": "6", + "dev": "PORT95" + }, + { + "chn": "7", + "dev": "PORT96" + } + ] + } + }, + + "PORT89": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT89", + "device_parent": "LC3-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "89" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT89-EEPROM" + }, { + "itf": "control", + "dev": "PORT89-CTRL" + }] + } + }, + + "PORT89-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT89-EEPROM", + "device_parent": "LC3-PORT-MUX3", + "virt_parent": "PORT89" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x9f", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT89-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT89-CTRL", + "device_parent": "LC3-PORT-MUX3", + "virt_parent": "PORT89" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x9f", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT90": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT90", + "device_parent": "LC3-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "90" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT90-EEPROM" + }, { + "itf": "control", + "dev": "PORT90-CTRL" + }] + } + }, + + "PORT90-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT90-EEPROM", + "device_parent": "LC3-PORT-MUX3", + "virt_parent": "PORT90" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xa0", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT90-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT90-CTRL", + "device_parent": "LC3-PORT-MUX3", + "virt_parent": "PORT90" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xa0", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT91": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT91", + "device_parent": "LC3-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "91" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT91-EEPROM" + }, { + "itf": "control", + "dev": "PORT91-CTRL" + }] + } + }, + + "PORT91-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT91-EEPROM", + "device_parent": "LC3-PORT-MUX3", + "virt_parent": "PORT91" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xa1", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT91-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT91-CTRL", + "device_parent": "LC3-PORT-MUX3", + "virt_parent": "PORT91" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xa1", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT92": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT92", + "device_parent": "LC3-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "92" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT92-EEPROM" + }, { + "itf": "control", + "dev": "PORT92-CTRL" + }] + } + }, + + "PORT92-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT92-EEPROM", + "device_parent": "LC3-PORT-MUX3", + "virt_parent": "PORT92" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xa2", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT92-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT92-CTRL", + "device_parent": "LC3-PORT-MUX3", + "virt_parent": "PORT92" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xa2", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT93": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT93", + "device_parent": "LC3-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "93" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT93-EEPROM" + }, { + "itf": "control", + "dev": "PORT93-CTRL" + }] + } + }, + + "PORT93-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT93-EEPROM", + "device_parent": "LC3-PORT-MUX3", + "virt_parent": "PORT93" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xa3", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT93-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT93-CTRL", + "device_parent": "LC3-PORT-MUX3", + "virt_parent": "PORT93" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xa3", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT94": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT94", + "device_parent": "LC3-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "94" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT94-EEPROM" + }, { + "itf": "control", + "dev": "PORT94-CTRL" + }] + } + }, + + "PORT94-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT94-EEPROM", + "device_parent": "LC3-PORT-MUX3", + "virt_parent": "PORT94" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xa4", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT94-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT94-CTRL", + "device_parent": "LC3-PORT-MUX3", + "virt_parent": "PORT94" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xa4", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT95": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT95", + "device_parent": "LC3-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "95" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT95-EEPROM" + }, { + "itf": "control", + "dev": "PORT95-CTRL" + }] + } + }, + + "PORT95-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT95-EEPROM", + "device_parent": "LC3-PORT-MUX3", + "virt_parent": "PORT95" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xa5", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT95-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT95-CTRL", + "device_parent": "LC3-PORT-MUX3", + "virt_parent": "PORT95" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xa5", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT96": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT96", + "device_parent": "LC3-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "96" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT96-EEPROM" + }, { + "itf": "control", + "dev": "PORT96-CTRL" + }] + } + }, + + "PORT96-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT96-EEPROM", + "device_parent": "LC3-PORT-MUX3", + "virt_parent": "PORT96" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xa6", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT96-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT96-CTRL", + "device_parent": "LC3-PORT-MUX3", + "virt_parent": "PORT96" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xa6", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC3-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "CPLD-OCORE4": { + "dev_info": { + "device_type": "CPLD-OCORE", + "device_name": "CPLD-OCORE4", + "device_parent": "SYSTEM" + }, + "i2c": { + "topo_info": { + "dev_addr": "0x6" + }, + "DEVICES": [ + { + "dev": "LC4-CPLD-A" + }, + { + "dev": "LC4-CPLD-B" + }, + { + "dev": "LC4-EEPROM" + }, + { + "dev": "LC4-TLV-EEPROM" + }, + { + "dev": "LC4-PORT-MUX0" + }, + { + "dev": "LC4-PORT-MUX1" + }, + { + "dev": "LC4-PORT-MUX2" + }, + { + "dev": "LC4-PORT-MUX3" + } + ] + } + }, + + "LC4-CPLD-A": { + "dev_info": { + "device_type": "CPLD", + "device_name": "LC4-CPLD-A", + "device_parent": "CPLD-OCORE1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x6", + "dev_addr": "0x30", + "dev_type": "i2c_cpld" + }, + "dev_attr": {} + } + }, + + "LC4-CPLD-B": { + "dev_info": { + "device_type": "CPLD", + "device_name": "LC4-CPLD-B", + "device_parent": "CPLD-OCORE1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x6", + "dev_addr": "0x31", + "dev_type": "i2c_cpld" + }, + "dev_attr": {} + } + }, + + "LC4-EEPROM": { + "dev_info": { + "device_type": "EEPROM", + "device_name": "LC4-EEPROM", + "device_parent": "CPLD-OCORE1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x6", + "dev_addr": "0x56", + "dev_type": "24c02" + }, + "dev_attr": { + "access_mode": "BLOCK" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "LC4-TLV-EEPROM": { + "dev_info": { + "device_type": "EEPROM", + "device_name": "LC4-TLV-EEPROM", + "device_parent": "CPLD-OCORE1" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x6", + "dev_addr": "0x57", + "dev_type": "24c02" + }, + "dev_attr": { + "access_mode": "BLOCK" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "LC4-PORT-MUX0": { + "dev_info": { + "device_type": "MUX", + "device_name": "LC4-PORT-MUX0", + "device_parent": "CPLD-OCORE4" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x6", + "dev_addr": "0x70", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0xa7" + }, + "channel": [{ + "chn": "0", + "dev": "PORT97" + }, + { + "chn": "1", + "dev": "PORT98" + }, + { + "chn": "2", + "dev": "PORT99" + }, + { + "chn": "3", + "dev": "PORT100" + }, + { + "chn": "4", + "dev": "PORT101" + }, + { + "chn": "5", + "dev": "PORT102" + }, + { + "chn": "6", + "dev": "PORT103" + }, + { + "chn": "7", + "dev": "PORT104" + } + ] + } + }, + + "PORT97": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT97", + "device_parent": "LC4-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "97" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT97-EEPROM" + }, { + "itf": "control", + "dev": "PORT97-CTRL" + }] + } + }, + + "PORT97-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT97-EEPROM", + "device_parent": "LC4-PORT-MUX0", + "virt_parent": "PORT97" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xa7", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT97-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT97-CTRL", + "device_parent": "LC4-PORT-MUX0", + "virt_parent": "PORT97" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xa7", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT98": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT98", + "device_parent": "LC4-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "98" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT98-EEPROM" + }, { + "itf": "control", + "dev": "PORT98-CTRL" + }] + } + }, + + "PORT98-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT98-EEPROM", + "device_parent": "LC4-PORT-MUX0", + "virt_parent": "PORT98" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xa8", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT98-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT98-CTRL", + "device_parent": "LC4-PORT-MUX0", + "virt_parent": "PORT98" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xa8", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT99": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT99", + "device_parent": "LC4-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "99" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT99-EEPROM" + }, { + "itf": "control", + "dev": "PORT99-CTRL" + }] + } + }, + + "PORT99-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT99-EEPROM", + "device_parent": "LC4-PORT-MUX0", + "virt_parent": "PORT99" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xa9", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT99-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT99-CTRL", + "device_parent": "LC4-PORT-MUX0", + "virt_parent": "PORT99" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xa9", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT100": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT100", + "device_parent": "LC4-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "100" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT100-EEPROM" + }, { + "itf": "control", + "dev": "PORT100-CTRL" + }] + } + }, + + "PORT100-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT100-EEPROM", + "device_parent": "LC4-PORT-MUX0", + "virt_parent": "PORT100" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xaa", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT100-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT100-CTRL", + "device_parent": "LC4-PORT-MUX0", + "virt_parent": "PORT100" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xaa", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT101": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT101", + "device_parent": "LC4-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "101" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT101-EEPROM" + }, { + "itf": "control", + "dev": "PORT101-CTRL" + }] + } + }, + + "PORT101-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT101-EEPROM", + "device_parent": "LC4-PORT-MUX0", + "virt_parent": "PORT101" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xab", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT101-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT101-CTRL", + "device_parent": "LC4-PORT-MUX0", + "virt_parent": "PORT101" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xab", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT102": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT102", + "device_parent": "LC4-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "102" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT102-EEPROM" + }, { + "itf": "control", + "dev": "PORT102-CTRL" + }] + } + }, + + "PORT102-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT102-EEPROM", + "device_parent": "LC4-PORT-MUX0", + "virt_parent": "PORT102" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xac", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT102-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT102-CTRL", + "device_parent": "LC4-PORT-MUX0", + "virt_parent": "PORT102" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xac", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT103": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT103", + "device_parent": "LC4-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "103" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT103-EEPROM" + }, { + "itf": "control", + "dev": "PORT103-CTRL" + }] + } + }, + + "PORT103-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT103-EEPROM", + "device_parent": "LC4-PORT-MUX0", + "virt_parent": "PORT103" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xad", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT103-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT103-CTRL", + "device_parent": "LC4-PORT-MUX0", + "virt_parent": "PORT103" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xad", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT104": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT104", + "device_parent": "LC4-PORT-MUX0" + }, + "dev_attr": { + "dev_idx": "104" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT104-EEPROM" + }, { + "itf": "control", + "dev": "PORT104-CTRL" + }] + } + }, + + "PORT104-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT104-EEPROM", + "device_parent": "LC4-PORT-MUX0", + "virt_parent": "PORT104" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xae", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT104-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT104-CTRL", + "device_parent": "LC4-PORT-MUX0", + "virt_parent": "PORT104" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xae", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "LC4-PORT-MUX1": { + "dev_info": { + "device_type": "MUX", + "device_name": "LC4-PORT-MUX1", + "device_parent": "CPLD-OCORE4" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x6", + "dev_addr": "0x71", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0xaf" + }, + "channel": [{ + "chn": "0", + "dev": "PORT105" + }, + { + "chn": "1", + "dev": "PORT106" + }, + { + "chn": "2", + "dev": "PORT107" + }, + { + "chn": "3", + "dev": "PORT108" + }, + { + "chn": "4", + "dev": "PORT109" + }, + { + "chn": "5", + "dev": "PORT110" + }, + { + "chn": "6", + "dev": "PORT111" + }, + { + "chn": "7", + "dev": "PORT112" + } + ] + } + }, + + "PORT105": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT105", + "device_parent": "LC4-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "105" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT105-EEPROM" + }, { + "itf": "control", + "dev": "PORT105-CTRL" + }] + } + }, + + "PORT105-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT105-EEPROM", + "device_parent": "LC4-PORT-MUX1", + "virt_parent": "PORT105" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xaf", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT105-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT105-CTRL", + "device_parent": "LC4-PORT-MUX1", + "virt_parent": "PORT105" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xaf", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT106": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT106", + "device_parent": "LC4-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "106" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT106-EEPROM" + }, { + "itf": "control", + "dev": "PORT106-CTRL" + }] + } + }, + + "PORT106-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT106-EEPROM", + "device_parent": "LC4-PORT-MUX1", + "virt_parent": "PORT106" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xb0", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT106-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT106-CTRL", + "device_parent": "LC4-PORT-MUX1", + "virt_parent": "PORT106" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xb0", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT107": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT107", + "device_parent": "LC4-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "107" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT107-EEPROM" + }, { + "itf": "control", + "dev": "PORT107-CTRL" + }] + } + }, + + "PORT107-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT107-EEPROM", + "device_parent": "LC4-PORT-MUX1", + "virt_parent": "PORT107" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xb1", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT107-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT107-CTRL", + "device_parent": "LC4-PORT-MUX1", + "virt_parent": "PORT107" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xb1", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT108": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT108", + "device_parent": "LC4-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "108" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT108-EEPROM" + }, { + "itf": "control", + "dev": "PORT108-CTRL" + }] + } + }, + + "PORT108-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT108-EEPROM", + "device_parent": "LC4-PORT-MUX1", + "virt_parent": "PORT108" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xb2", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT108-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT108-CTRL", + "device_parent": "LC4-PORT-MUX1", + "virt_parent": "PORT108" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xb2", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT109": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT109", + "device_parent": "LC4-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "109" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT109-EEPROM" + }, { + "itf": "control", + "dev": "PORT109-CTRL" + }] + } + }, + + "PORT109-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT109-EEPROM", + "device_parent": "LC4-PORT-MUX1", + "virt_parent": "PORT109" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xb3", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT109-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT109-CTRL", + "device_parent": "LC4-PORT-MUX1", + "virt_parent": "PORT109" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xb3", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT110": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT110", + "device_parent": "LC4-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "110" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT110-EEPROM" + }, { + "itf": "control", + "dev": "PORT110-CTRL" + }] + } + }, + + "PORT110-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT110-EEPROM", + "device_parent": "LC4-PORT-MUX1", + "virt_parent": "PORT110" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xb4", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT110-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT110-CTRL", + "device_parent": "LC4-PORT-MUX1", + "virt_parent": "PORT110" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xb4", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT111": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT111", + "device_parent": "LC4-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "111" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT111-EEPROM" + }, { + "itf": "control", + "dev": "PORT111-CTRL" + }] + } + }, + + "PORT111-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT111-EEPROM", + "device_parent": "LC4-PORT-MUX1", + "virt_parent": "PORT111" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xb5", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT111-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT111-CTRL", + "device_parent": "LC4-PORT-MUX1", + "virt_parent": "PORT111" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xb5", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT112": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT112", + "device_parent": "LC4-PORT-MUX1" + }, + "dev_attr": { + "dev_idx": "112" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT112-EEPROM" + }, { + "itf": "control", + "dev": "PORT112-CTRL" + }] + } + }, + + "PORT112-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT112-EEPROM", + "device_parent": "LC4-PORT-MUX1", + "virt_parent": "PORT112" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xb6", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT112-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT112-CTRL", + "device_parent": "LC4-PORT-MUX1", + "virt_parent": "PORT112" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xb6", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-A", + "attr_devaddr": "0x30", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "LC4-PORT-MUX2": { + "dev_info": { + "device_type": "MUX", + "device_name": "LC4-PORT-MUX2", + "device_parent": "CPLD-OCORE4" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x6", + "dev_addr": "0x72", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0xb7" + }, + "channel": [{ + "chn": "0", + "dev": "PORT113" + }, + { + "chn": "1", + "dev": "PORT114" + }, + { + "chn": "2", + "dev": "PORT115" + }, + { + "chn": "3", + "dev": "PORT116" + }, + { + "chn": "4", + "dev": "PORT117" + }, + { + "chn": "5", + "dev": "PORT118" + }, + { + "chn": "6", + "dev": "PORT119" + }, + { + "chn": "7", + "dev": "PORT120" + } + ] + } + }, + + "PORT113": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT113", + "device_parent": "LC4-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "113" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT113-EEPROM" + }, { + "itf": "control", + "dev": "PORT113-CTRL" + }] + } + }, + + "PORT113-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT113-EEPROM", + "device_parent": "LC4-PORT-MUX2", + "virt_parent": "PORT113" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xb7", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT113-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT113-CTRL", + "device_parent": "LC4-PORT-MUX2", + "virt_parent": "PORT113" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xb7", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT114": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT114", + "device_parent": "LC4-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "114" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT114-EEPROM" + }, { + "itf": "control", + "dev": "PORT114-CTRL" + }] + } + }, + + "PORT114-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT114-EEPROM", + "device_parent": "LC4-PORT-MUX2", + "virt_parent": "PORT114" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xb8", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT114-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT114-CTRL", + "device_parent": "LC4-PORT-MUX2", + "virt_parent": "PORT114" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xb8", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT115": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT115", + "device_parent": "LC4-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "115" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT115-EEPROM" + }, { + "itf": "control", + "dev": "PORT115-CTRL" + }] + } + }, + + "PORT115-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT115-EEPROM", + "device_parent": "LC4-PORT-MUX2", + "virt_parent": "PORT115" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xb9", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT115-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT115-CTRL", + "device_parent": "LC4-PORT-MUX2", + "virt_parent": "PORT115" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xb9", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT116": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT116", + "device_parent": "LC4-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "116" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT116-EEPROM" + }, { + "itf": "control", + "dev": "PORT116-CTRL" + }] + } + }, + + "PORT116-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT116-EEPROM", + "device_parent": "LC4-PORT-MUX2", + "virt_parent": "PORT116" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xba", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT116-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT116-CTRL", + "device_parent": "LC4-PORT-MUX2", + "virt_parent": "PORT116" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xba", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT117": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT117", + "device_parent": "LC4-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "117" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT117-EEPROM" + }, { + "itf": "control", + "dev": "PORT117-CTRL" + }] + } + }, + + "PORT117-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT117-EEPROM", + "device_parent": "LC4-PORT-MUX2", + "virt_parent": "PORT117" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xbb", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT117-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT117-CTRL", + "device_parent": "LC4-PORT-MUX2", + "virt_parent": "PORT117" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xbb", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT118": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT118", + "device_parent": "LC4-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "118" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT118-EEPROM" + }, { + "itf": "control", + "dev": "PORT118-CTRL" + }] + } + }, + + "PORT118-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT118-EEPROM", + "device_parent": "LC4-PORT-MUX2", + "virt_parent": "PORT118" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xbc", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT118-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT118-CTRL", + "device_parent": "LC4-PORT-MUX2", + "virt_parent": "PORT118" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xbc", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT119": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT119", + "device_parent": "LC4-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "119" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT119-EEPROM" + }, { + "itf": "control", + "dev": "PORT119-CTRL" + }] + } + }, + + "PORT119-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT119-EEPROM", + "device_parent": "LC4-PORT-MUX2", + "virt_parent": "PORT119" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xbd", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT119-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT119-CTRL", + "device_parent": "LC4-PORT-MUX2", + "virt_parent": "PORT119" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xbd", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT120": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT120", + "device_parent": "LC4-PORT-MUX2" + }, + "dev_attr": { + "dev_idx": "120" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT120-EEPROM" + }, { + "itf": "control", + "dev": "PORT120-CTRL" + }] + } + }, + + "PORT120-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT120-EEPROM", + "device_parent": "LC4-PORT-MUX2", + "virt_parent": "PORT120" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xbe", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT120-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT120-CTRL", + "device_parent": "LC4-PORT-MUX2", + "virt_parent": "PORT120" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xbe", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x10", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "LC4-PORT-MUX3": { + "dev_info": { + "device_type": "MUX", + "device_name": "LC4-PORT-MUX3", + "device_parent": "CPLD-OCORE4" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x6", + "dev_addr": "0x73", + "dev_type": "pca9548" + }, + "dev_attr": { + "virt_bus": "0xbf" + }, + "channel": [{ + "chn": "0", + "dev": "PORT121" + }, + { + "chn": "1", + "dev": "PORT122" + }, + { + "chn": "2", + "dev": "PORT123" + }, + { + "chn": "3", + "dev": "PORT124" + }, + { + "chn": "4", + "dev": "PORT125" + }, + { + "chn": "5", + "dev": "PORT126" + }, + { + "chn": "6", + "dev": "PORT127" + }, + { + "chn": "7", + "dev": "PORT128" + } + ] + } + }, + + "PORT121": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT121", + "device_parent": "LC4-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "121" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT121-EEPROM" + }, { + "itf": "control", + "dev": "PORT121-CTRL" + }] + } + }, + + "PORT121-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT121-EEPROM", + "device_parent": "LC4-PORT-MUX3", + "virt_parent": "PORT121" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xbf", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT121-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT121-CTRL", + "device_parent": "LC4-PORT-MUX3", + "virt_parent": "PORT121" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xbf", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x0", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT122": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT122", + "device_parent": "LC4-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "122" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT122-EEPROM" + }, { + "itf": "control", + "dev": "PORT122-CTRL" + }] + } + }, + + "PORT122-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT122-EEPROM", + "device_parent": "LC4-PORT-MUX3", + "virt_parent": "PORT122" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xc0", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT122-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT122-CTRL", + "device_parent": "LC4-PORT-MUX3", + "virt_parent": "PORT122" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xc0", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT123": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT123", + "device_parent": "LC4-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "123" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT123-EEPROM" + }, { + "itf": "control", + "dev": "PORT123-CTRL" + }] + } + }, + + "PORT123-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT123-EEPROM", + "device_parent": "LC4-PORT-MUX3", + "virt_parent": "PORT123" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xc1", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT123-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT123-CTRL", + "device_parent": "LC4-PORT-MUX3", + "virt_parent": "PORT123" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xc1", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT124": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT124", + "device_parent": "LC4-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "124" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT124-EEPROM" + }, { + "itf": "control", + "dev": "PORT124-CTRL" + }] + } + }, + + "PORT124-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT124-EEPROM", + "device_parent": "LC4-PORT-MUX3", + "virt_parent": "PORT124" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xc2", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT124-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT124-CTRL", + "device_parent": "LC4-PORT-MUX3", + "virt_parent": "PORT124" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xc2", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x3", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT125": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT125", + "device_parent": "LC4-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "125" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT125-EEPROM" + }, { + "itf": "control", + "dev": "PORT125-CTRL" + }] + } + }, + + "PORT125-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT125-EEPROM", + "device_parent": "LC4-PORT-MUX3", + "virt_parent": "PORT125" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xc3", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT125-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT125-CTRL", + "device_parent": "LC4-PORT-MUX3", + "virt_parent": "PORT125" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xc3", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x4", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT126": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT126", + "device_parent": "LC4-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "126" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT126-EEPROM" + }, { + "itf": "control", + "dev": "PORT126-CTRL" + }] + } + }, + + "PORT126-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT126-EEPROM", + "device_parent": "LC4-PORT-MUX3", + "virt_parent": "PORT126" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xc4", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT126-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT126-CTRL", + "device_parent": "LC4-PORT-MUX3", + "virt_parent": "PORT126" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xc4", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x5", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT127": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT127", + "device_parent": "LC4-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "127" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT127-EEPROM" + }, { + "itf": "control", + "dev": "PORT127-CTRL" + }] + } + }, + + "PORT127-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT127-EEPROM", + "device_parent": "LC4-PORT-MUX3", + "virt_parent": "PORT127" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xc5", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT127-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT127-CTRL", + "device_parent": "LC4-PORT-MUX3", + "virt_parent": "PORT127" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xc5", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x6", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "PORT128": { + "dev_info": { + "device_type": "QSFP", + "device_name": "PORT128", + "device_parent": "LC4-PORT-MUX3" + }, + "dev_attr": { + "dev_idx": "128" + }, + "i2c": { + "interface": [{ + "itf": "eeprom", + "dev": "PORT128-EEPROM" + }, { + "itf": "control", + "dev": "PORT128-CTRL" + }] + } + }, + + "PORT128-EEPROM": { + "dev_info": { + "device_type": "", + "device_name": "PORT128-EEPROM", + "device_parent": "LC4-PORT-MUX3", + "virt_parent": "PORT128" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xc6", + "dev_addr": "0x50", + "dev_type": "optoe1" + }, + "attr_list": [{ + "attr_name": "eeprom" + }] + } + }, + + "PORT128-CTRL": { + "dev_info": { + "device_type": "", + "device_name": "PORT128-CTRL", + "device_parent": "LC4-PORT-MUX3", + "virt_parent": "PORT128" + }, + "i2c": { + "topo_info": { + "parent_bus": "0xc6", + "dev_addr": "0x53", + "dev_type": "pddf_xcvr" + }, + "attr_list": [{ + "attr_name": "xcvr_present", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x11", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }, { + "attr_name": "xcvr_reset", + "attr_devname": "LC4-CPLD-B", + "attr_devaddr": "0x31", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0x7", + "attr_cmpval": "0x0", + "attr_len": "1" + }] + } + }, + + "FAN-CTRL": { + "dev_info": { + "device_type": "FAN", + "device_name": "FAN-CTRL", + "device_parent": "CPLD-OCORE0" + }, + "i2c": { + "topo_info": { + "parent_bus": "0x2", + "dev_addr": "0x20", + "dev_type": "fan_cpld" + }, + "dev_attr": { + "num_fantrays": "5" + }, + "attr_list": [{ + "attr_name": "fan1_present", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x30", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan2_present", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x30", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan3_present", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x30", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan4_present", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x30", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan5_present", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x30", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan6_present", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x30", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan7_present", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x30", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan8_present", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x30", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan9_present", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x30", + "attr_mask": "0x04", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan10_present", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x30", + "attr_mask": "0x04", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan11_present", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x30", + "attr_mask": "0x04", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan12_present", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x30", + "attr_mask": "0x04", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan1_input", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x1b", + "attr_mult": "1", + "attr_len": "2" + }, + { + "attr_name": "fan2_input", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x25", + "attr_mult": "1", + "attr_len": "2" + }, + { + "attr_name": "fan3_input", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x1b", + "attr_mult": "1", + "attr_len": "2" + }, + { + "attr_name": "fan4_input", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x25", + "attr_mult": "1", + "attr_len": "2" + }, + { + "attr_name": "fan5_input", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x1d", + "attr_mult": "1", + "attr_len": "2" + }, + { + "attr_name": "fan6_input", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x27", + "attr_mult": "1", + "attr_len": "2" + }, + { + "attr_name": "fan7_input", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x1d", + "attr_mult": "1", + "attr_len": "2" + }, + { + "attr_name": "fan8_input", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x27", + "attr_mult": "1", + "attr_len": "2" + }, + { + "attr_name": "fan9_input", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x1f", + "attr_mult": "1", + "attr_len": "2" + }, + { + "attr_name": "fan10_input", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x29", + "attr_mult": "1", + "attr_len": "2" + }, + { + "attr_name": "fan11_input", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x1f", + "attr_mult": "1", + "attr_len": "2" + }, + { + "attr_name": "fan12_input", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x29", + "attr_mult": "1", + "attr_len": "2" + }, + { + "attr_name": "fan1_pwm", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0xff", + "attr_len": "1" + }, + { + "attr_name": "fan2_pwm", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0xff", + "attr_len": "1" + }, + { + "attr_name": "fan3_pwm", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0xff", + "attr_len": "1" + }, + { + "attr_name": "fan4_pwm", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x14", + "attr_mask": "0xff", + "attr_len": "1" + }, + { + "attr_name": "fan5_pwm", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0xff", + "attr_len": "1" + }, + { + "attr_name": "fan6_pwm", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0xff", + "attr_len": "1" + }, + { + "attr_name": "fan7_pwm", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0xff", + "attr_len": "1" + }, + { + "attr_name": "fan8_pwm", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x15", + "attr_mask": "0xff", + "attr_len": "1" + }, + { + "attr_name": "fan9_pwm", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x16", + "attr_mask": "0xff", + "attr_len": "1" + }, + { + "attr_name": "fan10_pwm", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x16", + "attr_mask": "0xff", + "attr_len": "1" + }, + { + "attr_name": "fan11_pwm", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x16", + "attr_mask": "0xff", + "attr_len": "1" + }, + { + "attr_name": "fan12_pwm", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x16", + "attr_mask": "0xff", + "attr_len": "1" + }, + { + "attr_name": "fan1_fault", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x1a", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan2_fault", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x1a", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan3_fault", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x1a", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan4_fault", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x1a", + "attr_mask": "0x1", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan5_fault", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x1a", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan6_fault", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x1a", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan7_fault", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x1a", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan8_fault", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x1a", + "attr_mask": "0x2", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan9_fault", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x1a", + "attr_mask": "0x04", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan10_fault", + "attr_devname": "FAN-CPLD-B", + "attr_devtype": "cpld", + "attr_offset": "0x1a", + "attr_mask": "0x04", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan11_fault", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x1a", + "attr_mask": "0x04", + "attr_cmpval": "0x0", + "attr_len": "1" + }, + { + "attr_name": "fan12_fault", + "attr_devname": "FAN-CPLD-A", + "attr_devtype": "cpld", + "attr_offset": "0x1a", + "attr_mask": "0x04", + "attr_cmpval": "0x0", + "attr_len": "1" + } + ] + } + }, + + "FRONT_BOARD_CPU_LED": { + "dev_info": { + "device_type": "LED", + "device_name": "SYS_LED" + }, + "dev_attr": { + "index": "0" + }, + "i2c": { + "attr_list": [{ + "attr_name": "STATUS_LED_COLOR_RED", + "descr": "Red", + "bits": "2:0", + "value": "0x2", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb21" + }, + { + "attr_name": "STATUS_LED_COLOR_RED_BLINK", + "descr": "Red Blinking", + "bits": "2:0", + "value": "0x1", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb21" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN", + "descr": "Green", + "bits": "2:0", + "value": "0x4", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb21" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN_BLINK", + "descr": "Green Blinking", + "bits": "2:0", + "value": "0x3", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb21" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER", + "descr": "Amber", + "bits": "2:0", + "value": "0x6", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb21" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER_BLINK", + "descr": "Amber Blinking", + "bits": "2:0", + "value": "0x5", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb21" + }, + { + "attr_name": "STATUS_LED_COLOR_OFF", + "descr": "Off", + "bits": "2:0", + "value": "0x0", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb21" + }, + { + "attr_name": "STATUS_LED_COLOR_OFF", + "descr": "Off", + "bits": "2:0", + "value": "0xf", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb21" + } + ] + } + }, + + "FRONT_BOARD_PSU_LED": { + "dev_info": { + "device_type": "LED", + "device_name": "SYS_LED" + }, + "dev_attr": { + "index": "1" + }, + "i2c": { + "attr_list": [{ + "attr_name": "STATUS_LED_COLOR_RED", + "descr": "Red", + "bits": "2:0", + "value": "0x2", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb22" + }, + { + "attr_name": "STATUS_LED_COLOR_RED_BLINK", + "descr": "Red Blinking", + "bits": "2:0", + "value": "0x1", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb22" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN", + "descr": "Green", + "bits": "2:0", + "value": "0x4", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb22" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN_BLINK", + "descr": "Green Blinking", + "bits": "2:0", + "value": "0x3", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb22" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER", + "descr": "Amber", + "bits": "2:0", + "value": "0x6", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb22" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER_BLINK", + "descr": "Amber Blinking", + "bits": "2:0", + "value": "0x5", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb22" + }, + { + "attr_name": "STATUS_LED_COLOR_OFF", + "descr": "Off", + "bits": "2:0", + "value": "0x0", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb22" + }, + { + "attr_name": "STATUS_LED_COLOR_OFF", + "descr": "Off", + "bits": "2:0", + "value": "0xf", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb22" + } + ] + } + }, + + "FRONT_BOARD_FAN_LED": { + "dev_info": { + "device_type": "LED", + "device_name": "SYS_LED" + }, + "dev_attr": { + "index": "2" + }, + "i2c": { + "attr_list": [{ + "attr_name": "STATUS_LED_COLOR_RED", + "descr": "Red", + "bits": "2:0", + "value": "0x2", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb23" + }, + { + "attr_name": "STATUS_LED_COLOR_RED_BLINK", + "descr": "Red Blinking", + "bits": "2:0", + "value": "0x1", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb23" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN", + "descr": "Green", + "bits": "2:0", + "value": "0x4", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb23" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN_BLINK", + "descr": "Green Blinking", + "bits": "2:0", + "value": "0x3", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb23" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER", + "descr": "Amber", + "bits": "2:0", + "value": "0x6", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb23" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER_BLINK", + "descr": "Amber Blinking", + "bits": "2:0", + "value": "0x5", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb23" + }, + { + "attr_name": "STATUS_LED_COLOR_OFF", + "descr": "Off", + "bits": "2:0", + "value": "0x0", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb23" + }, + { + "attr_name": "STATUS_LED_COLOR_OFF", + "descr": "Off", + "bits": "2:0", + "value": "0xf", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0xb23" + } + ] + } + }, + + "FANTRAY1_LED": { + "dev_info": { + "device_type": "LED", + "device_name": "FANTRAY_LED" + }, + "dev_attr": { + "index": "0" + }, + "i2c": { + "attr_list": [{ + "attr_name": "STATUS_LED_COLOR_RED", + "descr": "Red", + "bits": "2:0", + "value": "0x2", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3b" + }, + { + "attr_name": "STATUS_LED_COLOR_RED_BLINK", + "descr": "Red Blinking", + "bits": "2:0", + "value": "0x1", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3b" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN", + "descr": "Green", + "bits": "2:0", + "value": "0x4", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3b" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN_BLINK", + "descr": "Green Blinking", + "bits": "2:0", + "value": "0x3", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3b" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER", + "descr": "Amber", + "bits": "2:0", + "value": "0x6", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3b" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER_BLINK", + "descr": "Amber Blinking", + "bits": "2:0", + "value": "0x5", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3b" + }, + { + "attr_name": "STATUS_LED_COLOR_OFF", + "descr": "Off", + "bits": "2:0", + "value": "0x0", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3b" + } + ] + } + }, + + "FANTRAY2_LED": { + "dev_info": { + "device_type": "LED", + "device_name": "FANTRAY_LED" + }, + "dev_attr": { + "index": "1" + }, + "i2c": { + "attr_list": [{ + "attr_name": "STATUS_LED_COLOR_RED", + "descr": "Red", + "bits": "2:0", + "value": "0x2", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3b" + }, + { + "attr_name": "STATUS_LED_COLOR_RED_BLINK", + "descr": "Red Blinking", + "bits": "2:0", + "value": "0x1", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3b" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN", + "descr": "Green", + "bits": "2:0", + "value": "0x4", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3b" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN_BLINK", + "descr": "Green Blinking", + "bits": "2:0", + "value": "0x3", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3b" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER", + "descr": "Amber", + "bits": "2:0", + "value": "0x6", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3b" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER_BLINK", + "descr": "Amber Blinking", + "bits": "2:0", + "value": "0x5", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3b" + }, + { + "attr_name": "STATUS_LED_COLOR_OFF", + "descr": "Off", + "bits": "2:0", + "value": "0x0", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3b" + } + ] + } + }, + + "FANTRAY3_LED": { + "dev_info": { + "device_type": "LED", + "device_name": "FANTRAY_LED" + }, + "dev_attr": { + "index": "2" + }, + "i2c": { + "attr_list": [{ + "attr_name": "STATUS_LED_COLOR_RED", + "descr": "Red", + "bits": "2:0", + "value": "0x2", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3c" + }, + { + "attr_name": "STATUS_LED_COLOR_RED_BLINK", + "descr": "Red Blinking", + "bits": "2:0", + "value": "0x1", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3c" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN", + "descr": "Green", + "bits": "2:0", + "value": "0x4", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3c" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN_BLINK", + "descr": "Green Blinking", + "bits": "2:0", + "value": "0x3", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3c" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER", + "descr": "Amber", + "bits": "2:0", + "value": "0x6", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3c" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER_BLINK", + "descr": "Amber Blinking", + "bits": "2:0", + "value": "0x5", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3c" + }, + { + "attr_name": "STATUS_LED_COLOR_OFF", + "descr": "Off", + "bits": "2:0", + "value": "0x0", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3c" + } + ] + } + }, + + "FANTRAY4_LED": { + "dev_info": { + "device_type": "LED", + "device_name": "FANTRAY_LED" + }, + "dev_attr": { + "index": "3" + }, + "i2c": { + "attr_list": [{ + "attr_name": "STATUS_LED_COLOR_RED", + "descr": "Red", + "bits": "2:0", + "value": "0x2", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3c" + }, + { + "attr_name": "STATUS_LED_COLOR_RED_BLINK", + "descr": "Red Blinking", + "bits": "2:0", + "value": "0x1", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3c" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN", + "descr": "Green", + "bits": "2:0", + "value": "0x4", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3c" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN_BLINK", + "descr": "Green Blinking", + "bits": "2:0", + "value": "0x3", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3c" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER", + "descr": "Amber", + "bits": "2:0", + "value": "0x6", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3c" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER_BLINK", + "descr": "Amber Blinking", + "bits": "2:0", + "value": "0x5", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3c" + }, + { + "attr_name": "STATUS_LED_COLOR_OFF", + "descr": "Off", + "bits": "2:0", + "value": "0x0", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3c" + } + ] + } + }, + + "FANTRAY5_LED": { + "dev_info": { + "device_type": "LED", + "device_name": "FANTRAY_LED" + }, + "dev_attr": { + "index": "4" + }, + "i2c": { + "attr_list": [{ + "attr_name": "STATUS_LED_COLOR_RED", + "descr": "Red", + "bits": "2:0", + "value": "0x2", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3d" + }, + { + "attr_name": "STATUS_LED_COLOR_RED_BLINK", + "descr": "Red Blinking", + "bits": "2:0", + "value": "0x1", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3d" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN", + "descr": "Green", + "bits": "2:0", + "value": "0x4", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3d" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN_BLINK", + "descr": "Green Blinking", + "bits": "2:0", + "value": "0x3", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3d" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER", + "descr": "Amber", + "bits": "2:0", + "value": "0x6", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3d" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER_BLINK", + "descr": "Amber Blinking", + "bits": "2:0", + "value": "0x5", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3d" + }, + { + "attr_name": "STATUS_LED_COLOR_OFF", + "descr": "Off", + "bits": "2:0", + "value": "0x0", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3d" + } + ] + } + }, + + "FANTRAY6_LED": { + "dev_info": { + "device_type": "LED", + "device_name": "FANTRAY_LED" + }, + "dev_attr": { + "index": "5" + }, + "i2c": { + "attr_list": [{ + "attr_name": "STATUS_LED_COLOR_RED", + "descr": "Red", + "bits": "2:0", + "value": "0x2", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3d" + }, + { + "attr_name": "STATUS_LED_COLOR_RED_BLINK", + "descr": "Red Blinking", + "bits": "2:0", + "value": "0x1", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3d" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN", + "descr": "Green", + "bits": "2:0", + "value": "0x4", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3d" + }, + { + "attr_name": "STATUS_LED_COLOR_GREEN_BLINK", + "descr": "Green Blinking", + "bits": "2:0", + "value": "0x3", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3d" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER", + "descr": "Amber", + "bits": "2:0", + "value": "0x6", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3d" + }, + { + "attr_name": "STATUS_LED_COLOR_AMBER_BLINK", + "descr": "Amber Blinking", + "bits": "2:0", + "value": "0x5", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3d" + }, + { + "attr_name": "STATUS_LED_COLOR_OFF", + "descr": "Off", + "bits": "2:0", + "value": "0x0", + "swpld_addr": "0x0d", + "swpld_addr_offset": "0x3d" + } + ] + } + } +} diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/pddf_support b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/pddf_support new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/platform_asic b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/platform_components.json b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/platform_components.json new file mode 100644 index 000000000000..80922c7b07ea --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/platform_components.json @@ -0,0 +1,21 @@ +{ + "chassis": { + "RA-B6510-32C": { + "component": { + "COMPONENT-1": {}, + "COMPONENT-2": {}, + "COMPONENT-3": {}, + "COMPONENT-4": {}, + "COMPONENT-5": {}, + "COMPONENT-6": {}, + "COMPONENT-7": {}, + "COMPONENT-8": {}, + "COMPONENT-9": {}, + "COMPONENT-10": {}, + "COMPONENT-11": {}, + "COMPONENT-12": {}, + "COMPONENT-13": {} + } + } + } +} diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/platform_env.conf b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/platform_env.conf new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/plugins/eeprom.py b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/plugins/eeprom.py new file mode 100644 index 000000000000..3384c2cbd693 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/plugins/eeprom.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +try: + from sonic_eeprom import eeprom_tlvinfo +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/1-0056/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/plugins/psuutil.py b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/plugins/psuutil.py new file mode 100644 index 000000000000..25ec4dd6a947 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/plugins/psuutil.py @@ -0,0 +1,59 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + + def get_num_psus(self): + return 4 + + def get_psu_status(self, index): + if index < 1 or index > 4: + return False + + path_tmp = "/sys/devices/pci0000:00/0000:00:1f.0/psu_status_" + psu_path = "%s%d"%(path_tmp, index) + + try: + data = open(psu_path, "rb") + except IOError: + return False + + result = int(data.read(2), 16) + data.close() + + if (result & 0x2): + return True + + return False + + def get_psu_presence(self, index): + if index < 1 or index > 4: + return False + + path_tmp = "/sys/devices/pci0000:00/0000:00:1f.0/psu_status_" + psu_path = "%s%d"%(path_tmp, index) + + try: + data = open(psu_path, "rb") + except IOError: + return False + + result = int(data.read(2), 16) + data.close() + + if (result & 0x1) == 0: + return True + + return False diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/plugins/sfputil.py b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/plugins/sfputil.py new file mode 100644 index 000000000000..afa98329a25c --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/plugins/sfputil.py @@ -0,0 +1,255 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import time + import os + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + PORT_START = 0 + PORT_END = 127 + PORT_QSFP_START = 0 + PORTS_IN_BLOCK = 128 + + EEPROM_OFFSET = 71 + SFP_DEVICE_TYPE = "optoe2" + QSFP_DEVICE_TYPE = "optoe1" + I2C_MAX_ATTEMPT = 3 + + SFP_STATUS_INSERTED = '1' + SFP_STATUS_REMOVED = '0' + + _port_to_eeprom_mapping = {} + port_to_i2cbus_mapping ={} + port_dict = {} + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(self.PORT_QSFP_START, self.PORTS_IN_BLOCK) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + for x in range(self.PORT_START, self.PORTS_IN_BLOCK): + self.port_to_i2cbus_mapping[x] = (x + self.EEPROM_OFFSET) + if self.get_presence(x): + self.port_dict[x] = self.SFP_STATUS_INSERTED + else: + self.port_dict[x] = self.SFP_STATUS_REMOVED + SfpUtilBase.__init__(self) + + def _sfp_read_file_path(self, file_path, offset, num_bytes): + attempts = 0 + while attempts < self.I2C_MAX_ATTEMPT: + try: + file_path.seek(offset) + read_buf = file_path.read(num_bytes) + except Exception: + attempts += 1 + time.sleep(0.05) + else: + return True, read_buf + return False, None + + def _sfp_eeprom_present(self, sysfs_sfp_i2c_client_eeprompath, offset): + """Tries to read the eeprom file to determine if the + device/sfp is present or not. If sfp present, the read returns + valid bytes. If not, read returns error 'Connection timed out""" + + if not os.path.exists(sysfs_sfp_i2c_client_eeprompath): + return False + else: + with open(sysfs_sfp_i2c_client_eeprompath, "rb", buffering=0) as sysfsfile: + rv, buf = self._sfp_read_file_path(sysfsfile, offset, 1) + return rv + + def _add_new_sfp_device(self, sysfs_sfp_i2c_adapter_path, devaddr, devtype): + try: + sysfs_nd_path = "%s/new_device" % sysfs_sfp_i2c_adapter_path + + # Write device address to new_device file + nd_file = open(sysfs_nd_path, "w") + nd_str = "%s %s" % (devtype, hex(devaddr)) + nd_file.write(nd_str) + nd_file.close() + + except Exception as err: + print("Error writing to new device file: %s" % str(err)) + return 1 + else: + return 0 + + def _get_port_eeprom_path(self, port_num, devid): + sysfs_i2c_adapter_base_path = "" + + if port_num in self.port_to_eeprom_mapping.keys(): + sysfs_sfp_i2c_client_eeprom_path = self.port_to_eeprom_mapping[port_num] + else: + sysfs_i2c_adapter_base_path = "/sys/class/i2c-adapter" + + i2c_adapter_id = self._get_port_i2c_adapter_id(port_num) + if i2c_adapter_id is None: + print("Error getting i2c bus num") + return None + + # Get i2c virtual bus path for the sfp + sysfs_sfp_i2c_adapter_path = "%s/i2c-%s" % (sysfs_i2c_adapter_base_path, + str(i2c_adapter_id)) + + # If i2c bus for port does not exist + if not os.path.exists(sysfs_sfp_i2c_adapter_path): + print("Could not find i2c bus %s. Driver not loaded?" % sysfs_sfp_i2c_adapter_path) + return None + + sysfs_sfp_i2c_client_path = "%s/%s-00%s" % (sysfs_sfp_i2c_adapter_path, + str(i2c_adapter_id), + hex(devid)[-2:]) + + # If sfp device is not present on bus, Add it + if not os.path.exists(sysfs_sfp_i2c_client_path): + if port_num in self.qsfp_ports: + ret = self._add_new_sfp_device( + sysfs_sfp_i2c_adapter_path, devid, self.QSFP_DEVICE_TYPE) + else: + ret = self._add_new_sfp_device( + sysfs_sfp_i2c_adapter_path, devid, self.SFP_DEVICE_TYPE) + if ret != 0: + print("Error adding sfp device") + return None + + sysfs_sfp_i2c_client_eeprom_path = "%s/eeprom" % sysfs_sfp_i2c_client_path + + return sysfs_sfp_i2c_client_eeprom_path + + def _read_eeprom_specific_bytes(self, sysfsfile_eeprom, offset, num_bytes): + eeprom_raw = [] + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + rv, raw = self._sfp_read_file_path(sysfsfile_eeprom, offset, num_bytes) + if rv == False: + return None + + try: + for n in range(0, num_bytes): + eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + except Exception: + return None + + return eeprom_raw + + def get_eeprom_dom_raw(self, port_num): + if port_num in self.qsfp_ports: + # QSFP DOM EEPROM is also at addr 0x50 and thus also stored in eeprom_ifraw + return None + else: + # Read dom eeprom at addr 0x51 + return self._read_eeprom_devid(port_num, self.IDENTITY_EEPROM_ADDR, 256) + + def get_presence(self, port_num): + # Check for invalid port_num + #return True + if port_num < self.port_start or port_num > self.port_end: + return False + + PRESENCE_OFFSET = 3 + presence_path = "/sys/bus/i2c/devices/%d-003%d/sfp_presence%d" % ((PRESENCE_OFFSET + (port_num // 32)), + ((port_num % 32) // 16), (((port_num % 32) // 8) + 1)) + try: + data = open(presence_path, "rb") + except IOError: + return False + + presence_data = data.read(2) + if presence_data != "": + result = int(presence_data, 16) + else : + return False + data.close() + + # ModPrsL is active low + if result & (1 << (port_num % 8)) == 0: + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + + return True + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + return True + + def get_transceiver_change_event(self, timeout=0): + + start_time = time.time() + currernt_port_dict = {} + forever = False + + if timeout == 0: + forever = True + elif timeout > 0: + timeout = timeout / float(1000) # Convert to secs + else: + print ("get_transceiver_change_event:Invalid timeout value", timeout) + return False, {} + + end_time = start_time + timeout + if start_time > end_time: + print ('get_transceiver_change_event:' \ + 'time wrap / invalid timeout value', timeout) + + return False, {} # Time wrap or possibly incorrect timeout + + while timeout >= 0: + # Check for OIR events and return updated port_dict + for x in range(self.PORT_START, self.PORTS_IN_BLOCK): + if self.get_presence(x): + currernt_port_dict[x] = self.SFP_STATUS_INSERTED + else: + currernt_port_dict[x] = self.SFP_STATUS_REMOVED + if (currernt_port_dict == self.port_dict): + if forever: + time.sleep(1) + else: + timeout = end_time - time.time() + if timeout >= 1: + time.sleep(1) # We poll at 1 second granularity + else: + if timeout > 0: + time.sleep(timeout) + return True, {} + else: + # Update reg value + self.port_dict = currernt_port_dict + return True, self.port_dict + print ("get_transceiver_change_event: Should not reach here.") + return False, {} diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/plugins/ssd_util.py b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/plugins/ssd_util.py new file mode 100644 index 000000000000..b6e5d6d3dd46 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/plugins/ssd_util.py @@ -0,0 +1,98 @@ +# +# ssd_health +# + +from sonic_platform_base.sonic_ssd.ssd_base import SsdBase +from subprocess import Popen, PIPE +from re import findall +from os.path import exists + +INNODISK = "iSmart -d {}" +NOT_AVAILABLE = "N/A" + +class SsdUtil(SsdBase): + + def __init__(self, diskdev): + """ + Constructor + Args: + diskdev: Linux device name to get parameters for + """ + if not isinstance(diskdev, str): + raise TypeError("disk dev type wrong {}".format(type(diskdev))) + + if not exists(diskdev): + raise RuntimeError("disk dev {} not found".format(diskdev)) + + self.model = NOT_AVAILABLE + self.serial = NOT_AVAILABLE + self.firmware = NOT_AVAILABLE + self.temperature = NOT_AVAILABLE + self.health = NOT_AVAILABLE + + self.ssd_info = self._execute_shell(INNODISK.format(diskdev)) + + self.model = self._parse_re(r'Model Name:\s*(.+?)\n', self.ssd_info) + self.serial = self._parse_re(r'Serial Number:\s*(.+?)\n', self.ssd_info) + self.firmware = self._parse_re(r'FW Version:\s*(.+?)\n', self.ssd_info) + self.temperature = self._parse_re(r'Temperature\s*\[\s*(.+?)\]', self.ssd_info) + self.health = self._parse_re(r'Health:\s*(.+?)', self.ssd_info) + + def _execute_shell(self, cmd): + process = Popen(cmd.split(), universal_newlines=True, stdout=PIPE) + output, _ = process.communicate() + return output + + def _parse_re(self, pattern, buffer): + res_list = findall(pattern, buffer) + return res_list[0] if res_list else NOT_AVAILABLE + + def get_health(self): + """ + Retrieves current disk health in percentages + Returns: + A float number of current ssd health + e.g. 83.5 + """ + return self.health + + def get_temperature(self): + """ + Retrieves current disk temperature in Celsius + Returns: + A float number of current temperature in Celsius + e.g. 40.1 + """ + return self.temperature + + def get_model(self): + """ + Retrieves model for the given disk device + Returns: + A string holding disk model as provided by the manufacturer + """ + return self.model + + def get_firmware(self): + """ + Retrieves firmware version for the given disk device + Returns: + A string holding disk firmware version as provided by the manufacturer + """ + return self.firmware + + def get_serial(self): + """ + Retrieves serial number for the given disk device + Returns: + A string holding disk serial number as provided by the manufacturer + """ + return self.serial + + def get_vendor_output(self): + """ + Retrieves vendor specific data for the given disk device + Returns: + A string holding some vendor specific disk information + """ + return self.ssd_info diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/pmon_daemon_control.json b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/pmon_daemon_control.json new file mode 100644 index 000000000000..94592fa8cebc --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/pmon_daemon_control.json @@ -0,0 +1,3 @@ +{ + "skip_ledd": true +} diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/sensors.conf b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/sensors.conf new file mode 100644 index 000000000000..56b7eba72536 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/sensors.conf @@ -0,0 +1,14 @@ +chip "rg_cpld-*" + label fan1 "fan1_inlet" + label fan2 "fan1_outlet" + label fan3 "fan2_inlet" + label fan4 "fan2_outlet" + label fan5 "fan3_inlet" + label fan6 "fan3_outlet" + label fan7 "fan4_inlet" + label fan8 "fan4_outlet" + label fan9 "fan5_inlet" + label fan10 "fan5_outlet" + label fan11 "fan6_inlet" + label fan12 "fan6_outlet" + diff --git a/device/ragile/x86_64-ragile_ra-b6920-4s-r0/systest.py b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/systest.py new file mode 100644 index 000000000000..b40bf45b2c19 --- /dev/null +++ b/device/ragile/x86_64-ragile_ra-b6920-4s-r0/systest.py @@ -0,0 +1,43 @@ +#!/usr/bin/python +# -*- coding: UTF-8 -*- + +# * onboard interval check +# * FAN trays +# * PSU +# * temp +import time +import datetime +from monitor import status + +def doWork(): + a=[]; + ''' + return: [{'status': '1', 'hw_version': '1.00', 'errcode': 0, 'fan_type': 'M6510-FAN-F', 'errmsg': 'OK', 'Speed': '9778', 'id': 'fan1', 'present': '0', 'sn': '1000000000014'}, + {'id': 'fan2', 'errmsg': 'not present', 'errcode': -1}, + {'id': 'fan3', 'errmsg': 'not present', 'errcode': -1}, + {'id': 'fan4', 'errmsg': 'not present', 'errcode': -1} + ] + description: 1.get id + 2.errcode equal 0 : dev normal + not equal 0 : get errmsg + 3.other message add when all check success + ''' + status.checkFan(a) + #status.getTemp(a) + #status.getPsu(a) + + nowTime=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + print nowTime + print a +def run(interval): + while True: + try: + time_remaining = interval - time.time()%interval + time.sleep(time_remaining) + doWork() + except Exception as e: + print(e) + +if __name__ == '__main__': + interval = 1 + run(interval) diff --git a/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/platform_asic b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/platform_asic new file mode 100644 index 000000000000..960467652765 --- /dev/null +++ b/device/ruijie/x86_64-ruijie_b6510-48vs8cq-r0/platform_asic @@ -0,0 +1 @@ +broadcom diff --git a/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/buffers.json.j2 b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/buffers.json.j2 new file mode 100644 index 000000000000..b67cf577ab75 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/buffers.json.j2 @@ -0,0 +1,3 @@ +{%- set default_topo = 't1' %} +{%- include 'buffers_config.j2' %} + diff --git a/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/buffers_defaults_def.j2 b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/buffers_defaults_def.j2 new file mode 100644 index 000000000000..e9cbf161dafe --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/buffers_defaults_def.j2 @@ -0,0 +1,45 @@ +{%- set default_cable = '0m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {% for port_idx in range(0,32) %} + {% if PORT_ALL.append("Ethernet%d" % (port_idx + 1)) %}{% endif %} + {% endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "12766208", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "12766208", + "type": "egress", + "mode": "static" + }, + "egress_lossy_pool": { + "size": "7326924", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "static_th":"12766208" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/buffers_defaults_t0.j2 b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..e9cbf161dafe --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/buffers_defaults_t0.j2 @@ -0,0 +1,45 @@ +{%- set default_cable = '0m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {% for port_idx in range(0,32) %} + {% if PORT_ALL.append("Ethernet%d" % (port_idx + 1)) %}{% endif %} + {% endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "12766208", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "12766208", + "type": "egress", + "mode": "static" + }, + "egress_lossy_pool": { + "size": "7326924", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "static_th":"12766208" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/buffers_defaults_t1.j2 b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..e9cbf161dafe --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/buffers_defaults_t1.j2 @@ -0,0 +1,45 @@ +{%- set default_cable = '0m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {% for port_idx in range(0,32) %} + {% if PORT_ALL.append("Ethernet%d" % (port_idx + 1)) %}{% endif %} + {% endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "12766208", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "12766208", + "type": "egress", + "mode": "static" + }, + "egress_lossy_pool": { + "size": "7326924", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_lossless_pool]", + "size":"0", + "static_th":"12766208" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"1518", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/fabriclanemap.ini b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/fabriclanemap.ini new file mode 100644 index 000000000000..20ea8fe3a720 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/fabriclanemap.ini @@ -0,0 +1,16 @@ +fabric1:1 +fabric2:2 +fabric3:3 +fabric4:4 +fabric5:5 +fabric6:6 +fabric7:7 +fabric8:8 +fabric9:9 +fabric10:10 +fabric11:11 +fabric12:12 +fabric13:13 +fabric14:14 +fabric15:15 +fabric16:16 diff --git a/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/lanemap.ini b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/lanemap.ini new file mode 100644 index 000000000000..a42385bd42a9 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/lanemap.ini @@ -0,0 +1,32 @@ +eth1:25,26,27,28 +eth2:29,30,31,32 +eth3:33,34,35,36 +eth4:37,38,39,40 +eth5:45,46,47,48 +eth6:41,42,43,44 +eth7:1,2,3,4 +eth8:5,6,7,8 +eth9:13,14,15,16 +eth10:9,10,11,12 +eth11:17,18,19,20 +eth12:21,22,23,24 +eth13:53,54,55,56 +eth14:49,50,51,52 +eth15:57,58,59,60 +eth16:61,62,63,64 +eth17:69,70,71,72 +eth18:65,66,67,68 +eth19:73,74,75,76 +eth20:77,78,79,80 +eth21:109,110,111,112 +eth22:105,106,107,108 +eth23:113,114,115,116 +eth24:117,118,119,120 +eth25:125,126,127,128 +eth26:121,122,123,124 +eth27:81,82,83,84 +eth28:85,86,87,88 +eth29:93,94,95,96 +eth30:89,90,91,92 +eth31:101,102,103,104 +eth32:97,98,99,100 diff --git a/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/pai.profile b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/pai.profile new file mode 100644 index 000000000000..4c1c2d8c7c75 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/pai.profile @@ -0,0 +1,5 @@ +SAI_VS_SWITCH_TYPE=SAI_VS_SWITCH_TYPE_BCM81724 +SAI_VS_SAI_SWITCH_TYPE=SAI_SWITCH_TYPE_PHY +SAI_VS_HOSTIF_USE_TAP_DEVICE=false +SAI_VS_USE_BCMSIM_LINK_MON=true +SAI_VS_INTERFACE_LANE_MAP_FILE=/usr/share/sonic/hwsku/lanemap.ini diff --git a/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/pg_profile_lookup.ini b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/pg_profile_lookup.ini new file mode 100644 index 000000000000..9f2eacb6fc42 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 10000 5m 56368 18432 55120 -3 2496 + 25000 5m 56368 18432 55120 -3 2496 + 40000 5m 56368 18432 55120 -3 2496 + 50000 5m 56368 18432 55120 -3 2496 + 100000 5m 56368 18432 55120 -3 2496 + 10000 40m 56368 18432 55120 -3 2496 + 25000 40m 56368 18432 55120 -3 2496 + 40000 40m 56368 18432 55120 -3 2496 + 50000 40m 56368 18432 55120 -3 2496 + 100000 40m 56368 18432 55120 -3 2496 + 10000 300m 56368 18432 55120 -3 2496 + 25000 300m 56368 18432 55120 -3 2496 + 40000 300m 56368 18432 55120 -3 2496 + 50000 300m 56368 18432 55120 -3 2496 + 100000 300m 56368 18432 55120 -3 2496 diff --git a/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/port_config.ini b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/port_config.ini new file mode 100644 index 000000000000..cadd9ae608bb --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias index speed +Ethernet1 25,26,27,28 fortyGigE0/0 0 40000 +Ethernet2 29,30,31,32 fortyGigE0/4 1 40000 +Ethernet3 33,34,35,36 fortyGigE0/8 2 40000 +Ethernet4 37,38,39,40 fortyGigE0/12 3 40000 +Ethernet5 45,46,47,48 fortyGigE0/16 4 40000 +Ethernet6 41,42,43,44 fortyGigE0/20 5 40000 +Ethernet7 1,2,3,4 fortyGigE0/24 6 40000 +Ethernet8 5,6,7,8 fortyGigE0/28 7 40000 +Ethernet9 13,14,15,16 fortyGigE0/32 8 40000 +Ethernet10 9,10,11,12 fortyGigE0/36 9 40000 +Ethernet11 17,18,19,20 fortyGigE0/40 10 40000 +Ethernet12 21,22,23,24 fortyGigE0/44 11 40000 +Ethernet13 53,54,55,56 fortyGigE0/48 12 40000 +Ethernet14 49,50,51,52 fortyGigE0/52 13 40000 +Ethernet15 57,58,59,60 fortyGigE0/56 14 40000 +Ethernet16 61,62,63,64 fortyGigE0/60 15 40000 +Ethernet17 69,70,71,72 fortyGigE0/64 16 40000 +Ethernet18 65,66,67,68 fortyGigE0/68 17 40000 +Ethernet19 73,74,75,76 fortyGigE0/72 18 40000 +Ethernet20 77,78,79,80 fortyGigE0/76 19 40000 +Ethernet21 109,110,111,112 fortyGigE0/80 20 40000 +Ethernet22 105,106,107,108 fortyGigE0/84 21 40000 +Ethernet23 113,114,115,116 fortyGigE0/88 22 40000 +Ethernet24 117,118,119,120 fortyGigE0/92 23 40000 +Ethernet25 125,126,127,128 fortyGigE0/96 24 40000 +Ethernet26 121,122,123,124 fortyGigE0/100 25 40000 +Ethernet27 81,82,83,84 fortyGigE0/104 26 40000 +Ethernet28 85,86,87,88 fortyGigE0/108 27 40000 +Ethernet29 93,94,95,96 fortyGigE0/112 28 40000 +Ethernet30 89,90,91,92 fortyGigE0/116 29 40000 +Ethernet31 101,102,103,104 fortyGigE0/120 30 40000 +Ethernet32 97,98,99,100 fortyGigE0/124 31 40000 diff --git a/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/qos.json.j2 b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/qos.json.j2 new file mode 100644 index 000000000000..3e548325ea30 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/qos.json.j2 @@ -0,0 +1 @@ +{%- include 'qos_config.j2' %} diff --git a/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/sai.profile b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/sai.profile new file mode 100644 index 000000000000..ed9dd21bdcb5 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/sai.profile @@ -0,0 +1,5 @@ +SAI_VS_SWITCH_TYPE=SAI_VS_SWITCH_TYPE_BCM56850 +SAI_VS_HOSTIF_USE_TAP_DEVICE=true +SAI_VS_INTERFACE_LANE_MAP_FILE=/usr/share/sonic/hwsku/lanemap.ini +SAI_VS_CORE_PORT_INDEX_MAP_FILE=/usr/share/sonic/hwsku/coreportindexmap.ini +SAI_VS_INTERFACE_FABRIC_LANE_MAP_FILE=/usr/share/sonic/hwsku/fabriclanemap.ini diff --git a/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/sai_mlnx.profile b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/sai_mlnx.profile new file mode 100644 index 000000000000..7b54438c4130 --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/sai_mlnx.profile @@ -0,0 +1,5 @@ +SAI_VS_SWITCH_TYPE=SAI_VS_SWITCH_TYPE_MLNX2700 +SAI_VS_HOSTIF_USE_TAP_DEVICE=true +SAI_VS_INTERFACE_LANE_MAP_FILE=/usr/share/sonic/hwsku/lanemap.ini +SAI_VS_CORE_PORT_INDEX_MAP_FILE=/usr/share/sonic/hwsku/coreportindexmap.ini +SAI_VS_INTERFACE_FABRIC_LANE_MAP_FILE=/usr/share/sonic/hwsku/fabriclanemap.ini diff --git a/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/td2-s6000-32x40G.config.bcm b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/td2-s6000-32x40G.config.bcm new file mode 100644 index 000000000000..2626674d67ca --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/td2-s6000-32x40G.config.bcm @@ -0,0 +1,649 @@ +# Old LPM only configuration +# l2_mem_entries=163840 +# l3_mem_entries=90112 +# l3_alpm_enable=0 +# ipv6_lpm_128b_enable=0 +# +# ALPM enable +l3_alpm_enable=2 +ipv6_lpm_128b_enable=1 +l2_mem_entries=32768 +l3_mem_entries=16384 + +# Disable Counting ACL Drop towards interface RX_DRP counter +sai_adjust_acl_drop_in_rx_drop=1 + +# From old config file +os=unix +higig2_hdr_mode=1 + +# Parity +parity_correction=1 +parity_enable=1 +stat_if_parity_enable=0 + +# +bcm_num_cos=10 +bcm_stat_interval=2000000 +l2xmsg_hostbuf_size=8192 +l2xmsg_mode=1 +lls_num_l2uc=12 +max_vp_lags=0 +miim_intr_enable=0 +mmu_lossless=0 +module_64ports=0 +schan_intr_enable=0 +stable_size=0x2000000 +tdma_timeout_usec=5000000 + +pbmp_oversubscribe=0x000007fffffffffffffffffffffffffe +pbmp_xport_xe=0x000007fffffffffffffffffffffffffe + +# Ports configuration +# xe0 (40G) +portmap_1=25:40 +xgxs_rx_lane_map_1=0x213 +xgxs_tx_lane_map_1=0x2031 +phy_xaui_rx_polarity_flip_1=0xe +phy_xaui_tx_polarity_flip_1=0x2 +serdes_driver_current_lane0_xe0=0x5 +serdes_driver_current_lane1_xe0=0x5 +serdes_driver_current_lane2_xe0=0x5 +serdes_driver_current_lane3_xe0=0x5 +serdes_pre_driver_current_lane0_xe0=0x5 +serdes_pre_driver_current_lane1_xe0=0x5 +serdes_pre_driver_current_lane2_xe0=0x5 +serdes_pre_driver_current_lane3_xe0=0x5 +serdes_preemphasis_lane0_xe0=0xcad0 +serdes_preemphasis_lane1_xe0=0xc6e0 +serdes_preemphasis_lane2_xe0=0xc6e0 +serdes_preemphasis_lane3_xe0=0xd2b0 + +# xe1 (40G) +portmap_2=29:40 +xgxs_rx_lane_map_2=0x213 +xgxs_tx_lane_map_2=0x213 +phy_xaui_rx_polarity_flip_2=0xc +phy_xaui_tx_polarity_flip_2=0x9 +serdes_driver_current_lane0_xe1=0x6 +serdes_driver_current_lane1_xe1=0x7 +serdes_driver_current_lane2_xe1=0x6 +serdes_driver_current_lane3_xe1=0x6 +serdes_pre_driver_current_lane0_xe1=0x6 +serdes_pre_driver_current_lane1_xe1=0x7 +serdes_pre_driver_current_lane2_xe1=0x6 +serdes_pre_driver_current_lane3_xe1=0x6 +serdes_preemphasis_lane0_xe1=0xc2f0 +serdes_preemphasis_lane1_xe1=0xd2b0 +serdes_preemphasis_lane2_xe1=0xc6e0 +serdes_preemphasis_lane3_xe1=0xc2f0 + +# xe2 (40G) +portmap_3=33:40 +xgxs_rx_lane_map_3=0x213 +xgxs_tx_lane_map_3=0x132 +phy_xaui_rx_polarity_flip_3=0xe +phy_xaui_tx_polarity_flip_3=0x2 +serdes_driver_current_lane0_xe2=0x4 +serdes_driver_current_lane1_xe2=0x4 +serdes_driver_current_lane2_xe2=0x4 +serdes_driver_current_lane3_xe2=0x4 +serdes_pre_driver_current_lane0_xe2=0x4 +serdes_pre_driver_current_lane1_xe2=0x4 +serdes_pre_driver_current_lane2_xe2=0x4 +serdes_pre_driver_current_lane3_xe2=0x4 +serdes_preemphasis_lane0_xe2=0xc6e0 +serdes_preemphasis_lane1_xe2=0xc6e0 +serdes_preemphasis_lane2_xe2=0xc6e0 +serdes_preemphasis_lane3_xe2=0xc6e0 + +# xe3 (40G) +portmap_4=37:40 +xgxs_rx_lane_map_4=0x213 +xgxs_tx_lane_map_4=0x1203 +phy_xaui_rx_polarity_flip_4=0x3 +phy_xaui_tx_polarity_flip_4=0xe +serdes_driver_current_lane0_xe3=0x4 +serdes_driver_current_lane1_xe3=0x4 +serdes_driver_current_lane2_xe3=0x4 +serdes_driver_current_lane3_xe3=0x4 +serdes_pre_driver_current_lane0_xe3=0x4 +serdes_pre_driver_current_lane1_xe3=0x4 +serdes_pre_driver_current_lane2_xe3=0x4 +serdes_pre_driver_current_lane3_xe3=0x4 +serdes_preemphasis_lane0_xe3=0xcad0 +serdes_preemphasis_lane1_xe3=0xcad0 +serdes_preemphasis_lane2_xe3=0xc2f0 +serdes_preemphasis_lane3_xe3=0xc2f0 + +# xe4 (40G) +portmap_5=45:40 +xgxs_rx_lane_map_5=0x213 +xgxs_tx_lane_map_5=0x213 +phy_xaui_rx_polarity_flip_5=0xe +phy_xaui_tx_polarity_flip_5=0x8 +serdes_driver_current_lane0_xe4=0x4 +serdes_driver_current_lane1_xe4=0x4 +serdes_driver_current_lane2_xe4=0x4 +serdes_driver_current_lane3_xe4=0x4 +serdes_pre_driver_current_lane0_xe4=0x4 +serdes_pre_driver_current_lane1_xe4=0x4 +serdes_pre_driver_current_lane2_xe4=0x4 +serdes_pre_driver_current_lane3_xe4=0x4 +serdes_preemphasis_lane0_xe4=0xc2f0 +serdes_preemphasis_lane1_xe4=0xc2f0 +serdes_preemphasis_lane2_xe4=0xc2f0 +serdes_preemphasis_lane3_xe4=0xc2f0 + +# xe5 (40G) +portmap_6=41:40 +xgxs_rx_lane_map_6=0x213 +xgxs_tx_lane_map_6=0x3021 +phy_xaui_rx_polarity_flip_6=0x3 +phy_xaui_tx_polarity_flip_6=0xb +serdes_driver_current_lane0_xe5=0x4 +serdes_driver_current_lane1_xe5=0x4 +serdes_driver_current_lane2_xe5=0x4 +serdes_driver_current_lane3_xe5=0x4 +serdes_pre_driver_current_lane0_xe5=0x4 +serdes_pre_driver_current_lane1_xe5=0x4 +serdes_pre_driver_current_lane2_xe5=0x4 +serdes_pre_driver_current_lane3_xe5=0x4 +serdes_preemphasis_lane0_xe5=0xc6e0 +serdes_preemphasis_lane1_xe5=0xc2f0 +serdes_preemphasis_lane2_xe5=0xc2f0 +serdes_preemphasis_lane3_xe5=0xcad0 + +# xe6 (40G) +portmap_7=1:40 +xgxs_rx_lane_map_7=0x213 +xgxs_tx_lane_map_7=0x2031 +phy_xaui_rx_polarity_flip_7=0xe +phy_xaui_tx_polarity_flip_7=0xd +serdes_driver_current_lane0_xe6=0x5 +serdes_driver_current_lane1_xe6=0x5 +serdes_driver_current_lane2_xe6=0x5 +serdes_driver_current_lane3_xe6=0x5 +serdes_pre_driver_current_lane0_xe6=0x5 +serdes_pre_driver_current_lane1_xe6=0x5 +serdes_pre_driver_current_lane2_xe6=0x5 +serdes_pre_driver_current_lane3_xe6=0x5 +serdes_preemphasis_lane0_xe6=0xc6e0 +serdes_preemphasis_lane1_xe6=0xcad0 +serdes_preemphasis_lane2_xe6=0xc6e0 +serdes_preemphasis_lane3_xe6=0xcad0 + +# xe7 (40G) +portmap_8=5:40 +xgxs_rx_lane_map_8=0x213 +xgxs_tx_lane_map_8=0x1203 +phy_xaui_rx_polarity_flip_8=0xc +phy_xaui_tx_polarity_flip_8=0x1 +serdes_driver_current_lane0_xe7=0x4 +serdes_driver_current_lane1_xe7=0x4 +serdes_driver_current_lane2_xe7=0x4 +serdes_driver_current_lane3_xe7=0x4 +serdes_pre_driver_current_lane0_xe7=0x4 +serdes_pre_driver_current_lane1_xe7=0x4 +serdes_pre_driver_current_lane2_xe7=0x4 +serdes_pre_driver_current_lane3_xe7=0x4 +serdes_preemphasis_lane0_xe7=0xc6e0 +serdes_preemphasis_lane1_xe7=0xc6e0 +serdes_preemphasis_lane2_xe7=0xc6e0 +serdes_preemphasis_lane3_xe7=0xc6e0 + +# xe8 (40G) +portmap_9=13:40 +xgxs_rx_lane_map_9=0x213 +xgxs_tx_lane_map_9=0x132 +phy_xaui_rx_polarity_flip_9=0xe +phy_xaui_tx_polarity_flip_9=0x0 +serdes_driver_current_lane0_xe8=0x2 +serdes_driver_current_lane1_xe8=0x3 +serdes_driver_current_lane2_xe8=0x2 +serdes_driver_current_lane3_xe8=0x2 +serdes_pre_driver_current_lane0_xe8=0x2 +serdes_pre_driver_current_lane1_xe8=0x3 +serdes_pre_driver_current_lane2_xe8=0x2 +serdes_pre_driver_current_lane3_xe8=0x2 +serdes_preemphasis_lane0_xe8=0xb270 +serdes_preemphasis_lane1_xe8=0xbb10 +serdes_preemphasis_lane2_xe8=0xb720 +serdes_preemphasis_lane3_xe8=0xb720 + +# xe9 (40G) +portmap_10=9:40 +xgxs_rx_lane_map_10=0x3120 +xgxs_tx_lane_map_10=0x3021 +phy_xaui_rx_polarity_flip_10=0x0 +phy_xaui_tx_polarity_flip_10=0x4 +serdes_driver_current_lane0_xe9=0x3 +serdes_driver_current_lane1_xe9=0x3 +serdes_driver_current_lane2_xe9=0x3 +serdes_driver_current_lane3_xe9=0x3 +serdes_pre_driver_current_lane0_xe9=0x3 +serdes_pre_driver_current_lane1_xe9=0x3 +serdes_pre_driver_current_lane2_xe9=0x3 +serdes_pre_driver_current_lane3_xe9=0x3 +serdes_preemphasis_lane0_xe9=0xc2f0 +serdes_preemphasis_lane1_xe9=0xc6e0 +serdes_preemphasis_lane2_xe9=0xbf00 +serdes_preemphasis_lane3_xe9=0xc2f0 + +# xe10 (40G) +portmap_11=17:40 +xgxs_rx_lane_map_11=0x213 +xgxs_tx_lane_map_11=0x132 +phy_xaui_rx_polarity_flip_11=0xe +phy_xaui_tx_polarity_flip_11=0x0 +serdes_driver_current_lane0_xe10=0x2 +serdes_driver_current_lane1_xe10=0x2 +serdes_driver_current_lane2_xe10=0x2 +serdes_driver_current_lane3_xe10=0x2 +serdes_pre_driver_current_lane0_xe10=0x2 +serdes_pre_driver_current_lane1_xe10=0x2 +serdes_pre_driver_current_lane2_xe10=0x2 +serdes_pre_driver_current_lane3_xe10=0x2 +serdes_preemphasis_lane0_xe10=0xb330 +serdes_preemphasis_lane1_xe10=0xbb10 +serdes_preemphasis_lane2_xe10=0xbb10 +serdes_preemphasis_lane3_xe10=0xbb10 + +# xe11 (40G) +portmap_12=21:40 +xgxs_rx_lane_map_12=0x123 +xgxs_tx_lane_map_12=0x1203 +phy_xaui_rx_polarity_flip_12=0xc +phy_xaui_tx_polarity_flip_12=0xe +serdes_driver_current_lane0_xe11=0x2 +serdes_driver_current_lane1_xe11=0x2 +serdes_driver_current_lane2_xe11=0x2 +serdes_driver_current_lane3_xe11=0x2 +serdes_pre_driver_current_lane0_xe11=0x2 +serdes_pre_driver_current_lane1_xe11=0x2 +serdes_pre_driver_current_lane2_xe11=0x2 +serdes_pre_driver_current_lane3_xe11=0x2 +serdes_preemphasis_lane0_xe11=0xb330 +serdes_preemphasis_lane1_xe11=0xb330 +serdes_preemphasis_lane2_xe11=0xb330 +serdes_preemphasis_lane3_xe11=0xb330 + +# xe12 (40G) +portmap_13=53:40 +xgxs_rx_lane_map_13=0x213 +xgxs_tx_lane_map_13=0x231 +phy_xaui_rx_polarity_flip_13=0x1 +phy_xaui_tx_polarity_flip_13=0x0 +serdes_driver_current_lane0_xe12=0x2 +serdes_driver_current_lane1_xe12=0x2 +serdes_driver_current_lane2_xe12=0x2 +serdes_driver_current_lane3_xe12=0x2 +serdes_pre_driver_current_lane0_xe12=0x2 +serdes_pre_driver_current_lane1_xe12=0x2 +serdes_pre_driver_current_lane2_xe12=0x2 +serdes_pre_driver_current_lane3_xe12=0x2 +serdes_preemphasis_lane0_xe12=0xaf40 +serdes_preemphasis_lane1_xe12=0xaf40 +serdes_preemphasis_lane2_xe12=0xaf40 +serdes_preemphasis_lane3_xe12=0xaf40 + +# xe13 (40G) +portmap_14=49:40 +xgxs_rx_lane_map_14=0x1302 +xgxs_tx_lane_map_14=0x2031 +phy_xaui_rx_polarity_flip_14=0xb +phy_xaui_tx_polarity_flip_14=0x3 +serdes_driver_current_lane0_xe13=0x2 +serdes_driver_current_lane1_xe13=0x2 +serdes_driver_current_lane2_xe13=0x2 +serdes_driver_current_lane3_xe13=0x2 +serdes_pre_driver_current_lane0_xe13=0x2 +serdes_pre_driver_current_lane1_xe13=0x2 +serdes_pre_driver_current_lane2_xe13=0x2 +serdes_pre_driver_current_lane3_xe13=0x2 +serdes_preemphasis_lane0_xe13=0xa760 +serdes_preemphasis_lane1_xe13=0xa760 +serdes_preemphasis_lane2_xe13=0xa760 +serdes_preemphasis_lane3_xe13=0xa760 + +# xe14 (40G) +portmap_15=57:40 +xgxs_rx_lane_map_15=0x213 +xgxs_tx_lane_map_15=0x2031 +phy_xaui_rx_polarity_flip_15=0x1 +phy_xaui_tx_polarity_flip_15=0x0 +serdes_driver_current_lane0_xe14=0x1 +serdes_driver_current_lane1_xe14=0x1 +serdes_driver_current_lane2_xe14=0x1 +serdes_driver_current_lane3_xe14=0x1 +serdes_pre_driver_current_lane0_xe14=0x1 +serdes_pre_driver_current_lane1_xe14=0x1 +serdes_pre_driver_current_lane2_xe14=0x1 +serdes_pre_driver_current_lane3_xe14=0x1 +serdes_preemphasis_lane0_xe14=0xa760 +serdes_preemphasis_lane1_xe14=0xa760 +serdes_preemphasis_lane2_xe14=0xa760 +serdes_preemphasis_lane3_xe14=0xa760 + +# xe15 (40G) +portmap_16=61:40 +xgxs_rx_lane_map_16=0x132 +xgxs_tx_lane_map_16=0x213 +phy_xaui_rx_polarity_flip_16=0x0 +phy_xaui_tx_polarity_flip_16=0x0 +serdes_driver_current_lane0_xe15=0x2 +serdes_driver_current_lane1_xe15=0x2 +serdes_driver_current_lane2_xe15=0x2 +serdes_driver_current_lane3_xe15=0x2 +serdes_pre_driver_current_lane0_xe15=0x2 +serdes_pre_driver_current_lane1_xe15=0x2 +serdes_pre_driver_current_lane2_xe15=0x2 +serdes_pre_driver_current_lane3_xe15=0x2 +serdes_preemphasis_lane0_xe15=0xa760 +serdes_preemphasis_lane1_xe15=0xa760 +serdes_preemphasis_lane2_xe15=0xa760 +serdes_preemphasis_lane3_xe15=0xa760 + +# xe16 (40G) +portmap_17=69:40 +xgxs_rx_lane_map_17=0x213 +xgxs_tx_lane_map_17=0x2130 +phy_xaui_rx_polarity_flip_17=0x1 +phy_xaui_tx_polarity_flip_17=0xf +serdes_driver_current_lane0_xe16=0x1 +serdes_driver_current_lane1_xe16=0x1 +serdes_driver_current_lane2_xe16=0x1 +serdes_driver_current_lane3_xe16=0x1 +serdes_pre_driver_current_lane0_xe16=0x1 +serdes_pre_driver_current_lane1_xe16=0x1 +serdes_pre_driver_current_lane2_xe16=0x1 +serdes_pre_driver_current_lane3_xe16=0x1 +serdes_preemphasis_lane0_xe16=0xa760 +serdes_preemphasis_lane1_xe16=0xa760 +serdes_preemphasis_lane2_xe16=0xa760 +serdes_preemphasis_lane3_xe16=0xa760 + +# xe17 (40G) +portmap_18=65:40 +xgxs_rx_lane_map_18=0x132 +xgxs_tx_lane_map_18=0x2031 +phy_xaui_rx_polarity_flip_18=0x3 +phy_xaui_tx_polarity_flip_18=0x9 +serdes_driver_current_lane0_xe17=0x1 +serdes_driver_current_lane1_xe17=0x1 +serdes_driver_current_lane2_xe17=0x1 +serdes_driver_current_lane3_xe17=0x1 +serdes_pre_driver_current_lane0_xe17=0x1 +serdes_pre_driver_current_lane1_xe17=0x1 +serdes_pre_driver_current_lane2_xe17=0x1 +serdes_pre_driver_current_lane3_xe17=0x1 +serdes_preemphasis_lane0_xe17=0xa370 +serdes_preemphasis_lane1_xe17=0xa370 +serdes_preemphasis_lane2_xe17=0xa370 +serdes_preemphasis_lane3_xe17=0xa370 + +# xe18 (40G) +portmap_19=73:40 +xgxs_rx_lane_map_19=0x213 +xgxs_tx_lane_map_19=0x2031 +phy_xaui_rx_polarity_flip_19=0x1 +phy_xaui_tx_polarity_flip_19=0x0 +serdes_driver_current_lane0_xe18=0x2 +serdes_driver_current_lane1_xe18=0x2 +serdes_driver_current_lane2_xe18=0x2 +serdes_driver_current_lane3_xe18=0x2 +serdes_pre_driver_current_lane0_xe18=0x2 +serdes_pre_driver_current_lane1_xe18=0x2 +serdes_pre_driver_current_lane2_xe18=0x2 +serdes_pre_driver_current_lane3_xe18=0x2 +serdes_preemphasis_lane0_xe18=0xa760 +serdes_preemphasis_lane1_xe18=0xa760 +serdes_preemphasis_lane2_xe18=0xa760 +serdes_preemphasis_lane3_xe18=0xa760 + +# xe19 (40G) +portmap_20=77:40 +xgxs_rx_lane_map_20=0x123 +xgxs_tx_lane_map_20=0x1203 +phy_xaui_rx_polarity_flip_20=0x3 +phy_xaui_tx_polarity_flip_20=0xe +serdes_driver_current_lane0_xe19=0x2 +serdes_driver_current_lane1_xe19=0x2 +serdes_driver_current_lane2_xe19=0x2 +serdes_driver_current_lane3_xe19=0x2 +serdes_pre_driver_current_lane0_xe19=0x2 +serdes_pre_driver_current_lane1_xe19=0x2 +serdes_pre_driver_current_lane2_xe19=0x2 +serdes_pre_driver_current_lane3_xe19=0x2 +serdes_preemphasis_lane0_xe19=0xaf40 +serdes_preemphasis_lane1_xe19=0xaf40 +serdes_preemphasis_lane2_xe19=0xaf40 +serdes_preemphasis_lane3_xe19=0xaf40 + +# xe20 (40G) +portmap_21=109:40 +xgxs_rx_lane_map_21=0x132 +xgxs_tx_lane_map_21=0x132 +phy_xaui_rx_polarity_flip_21=0x8 +phy_xaui_tx_polarity_flip_21=0x0 +serdes_driver_current_lane0_xe20=0x1 +serdes_driver_current_lane1_xe20=0x1 +serdes_driver_current_lane2_xe20=0x1 +serdes_driver_current_lane3_xe20=0x2 +serdes_pre_driver_current_lane0_xe20=0x1 +serdes_pre_driver_current_lane1_xe20=0x1 +serdes_pre_driver_current_lane2_xe20=0x1 +serdes_pre_driver_current_lane3_xe20=0x2 +serdes_preemphasis_lane0_xe20=0xb330 +serdes_preemphasis_lane1_xe20=0xb330 +serdes_preemphasis_lane2_xe20=0xb330 +serdes_preemphasis_lane3_xe20=0xbff0 + +# xe21 (40G) +portmap_22=105:40 +xgxs_rx_lane_map_22=0x1320 +xgxs_tx_lane_map_22=0x3021 +phy_xaui_rx_polarity_flip_22=0xd +phy_xaui_tx_polarity_flip_22=0xb +serdes_driver_current_lane0_xe21=0x1 +serdes_driver_current_lane1_xe21=0x1 +serdes_driver_current_lane2_xe21=0x1 +serdes_driver_current_lane3_xe21=0x1 +serdes_pre_driver_current_lane0_xe21=0x1 +serdes_pre_driver_current_lane1_xe21=0x1 +serdes_pre_driver_current_lane2_xe21=0x1 +serdes_pre_driver_current_lane3_xe21=0x1 +serdes_preemphasis_lane0_xe21=0xb330 +serdes_preemphasis_lane1_xe21=0xb330 +serdes_preemphasis_lane2_xe21=0xb330 +serdes_preemphasis_lane3_xe21=0xb330 + +# xe22 (40G) +portmap_23=113:40 +xgxs_rx_lane_map_23=0x132 +xgxs_tx_lane_map_23=0x132 +phy_xaui_rx_polarity_flip_23=0x8 +phy_xaui_tx_polarity_flip_23=0x0 +serdes_driver_current_lane0_xe22=0x1 +serdes_driver_current_lane1_xe22=0x1 +serdes_driver_current_lane2_xe22=0x1 +serdes_driver_current_lane3_xe22=0x1 +serdes_pre_driver_current_lane0_xe22=0x1 +serdes_pre_driver_current_lane1_xe22=0x1 +serdes_pre_driver_current_lane2_xe22=0x1 +serdes_pre_driver_current_lane3_xe22=0x1 +serdes_preemphasis_lane0_xe22=0xbb10 +serdes_preemphasis_lane1_xe22=0xbb10 +serdes_preemphasis_lane2_xe22=0xbb10 +serdes_preemphasis_lane3_xe22=0xc2f0 + +# xe23 (40G) +portmap_24=117:40 +xgxs_rx_lane_map_24=0x231 +xgxs_tx_lane_map_24=0x1203 +phy_xaui_rx_polarity_flip_24=0x3 +phy_xaui_tx_polarity_flip_24=0xe +serdes_driver_current_lane0_xe23=0x3 +serdes_driver_current_lane1_xe23=0x5 +serdes_driver_current_lane2_xe23=0x3 +serdes_driver_current_lane3_xe23=0x3 +serdes_pre_driver_current_lane0_xe23=0x3 +serdes_pre_driver_current_lane1_xe23=0x5 +serdes_pre_driver_current_lane2_xe23=0x3 +serdes_pre_driver_current_lane3_xe23=0x3 +serdes_preemphasis_lane0_xe23=0xc6e0 +serdes_preemphasis_lane1_xe23=0xc6e0 +serdes_preemphasis_lane2_xe23=0xc6e0 +serdes_preemphasis_lane3_xe23=0xc6e0 + +# xe24 (40G) +portmap_25=125:40 +xgxs_rx_lane_map_25=0x132 +xgxs_tx_lane_map_25=0x132 +phy_xaui_rx_polarity_flip_25=0x8 +phy_xaui_tx_polarity_flip_25=0x0 +serdes_driver_current_lane0_xe24=0x4 +serdes_driver_current_lane1_xe24=0x4 +serdes_driver_current_lane2_xe24=0x4 +serdes_driver_current_lane3_xe24=0x4 +serdes_pre_driver_current_lane0_xe24=0x4 +serdes_pre_driver_current_lane1_xe24=0x4 +serdes_pre_driver_current_lane2_xe24=0x4 +serdes_pre_driver_current_lane3_xe24=0x4 +serdes_preemphasis_lane0_xe24=0xc6e0 +serdes_preemphasis_lane1_xe24=0xc6e0 +serdes_preemphasis_lane2_xe24=0xc6e0 +serdes_preemphasis_lane3_xe24=0xcec0 + +# xe25 (40G) +portmap_26=121:40 +xgxs_rx_lane_map_26=0x1320 +xgxs_tx_lane_map_26=0x3021 +phy_xaui_rx_polarity_flip_26=0xd +phy_xaui_tx_polarity_flip_26=0xb +serdes_driver_current_lane0_xe25=0x4 +serdes_driver_current_lane1_xe25=0x4 +serdes_driver_current_lane2_xe25=0x4 +serdes_driver_current_lane3_xe25=0x4 +serdes_pre_driver_current_lane0_xe25=0x4 +serdes_pre_driver_current_lane1_xe25=0x4 +serdes_pre_driver_current_lane2_xe25=0x4 +serdes_pre_driver_current_lane3_xe25=0x4 +serdes_preemphasis_lane0_xe25=0xc6e0 +serdes_preemphasis_lane1_xe25=0xc6e0 +serdes_preemphasis_lane2_xe25=0xc6e0 +serdes_preemphasis_lane3_xe25=0xc6e0 + +# xe26 (40G) +portmap_27=81:40 +xgxs_rx_lane_map_27=0x1320 +xgxs_tx_lane_map_27=0x2031 +phy_xaui_rx_polarity_flip_27=0x1 +phy_xaui_tx_polarity_flip_27=0x2 +serdes_driver_current_lane0_xe26=0x2 +serdes_driver_current_lane1_xe26=0x2 +serdes_driver_current_lane2_xe26=0x2 +serdes_driver_current_lane3_xe26=0x2 +serdes_pre_driver_current_lane0_xe26=0x2 +serdes_pre_driver_current_lane1_xe26=0x2 +serdes_pre_driver_current_lane2_xe26=0x2 +serdes_pre_driver_current_lane3_xe26=0x2 +serdes_preemphasis_lane0_xe26=0xbb10 +serdes_preemphasis_lane1_xe26=0xbb10 +serdes_preemphasis_lane2_xe26=0xbf00 +serdes_preemphasis_lane3_xe26=0xbb10 + +# xe27 (40G) +portmap_28=85:40 +xgxs_rx_lane_map_28=0x213 +xgxs_tx_lane_map_28=0x1203 +phy_xaui_rx_polarity_flip_28=0xc +phy_xaui_tx_polarity_flip_28=0xe +serdes_driver_current_lane0_xe27=0x4 +serdes_driver_current_lane1_xe27=0x5 +serdes_driver_current_lane2_xe27=0x4 +serdes_driver_current_lane3_xe27=0x5 +serdes_pre_driver_current_lane0_xe27=0x4 +serdes_pre_driver_current_lane1_xe27=0x5 +serdes_pre_driver_current_lane2_xe27=0x4 +serdes_pre_driver_current_lane3_xe27=0x5 +serdes_preemphasis_lane0_xe27=0xc2f0 +serdes_preemphasis_lane1_xe27=0xc6e0 +serdes_preemphasis_lane2_xe27=0xc6e0 +serdes_preemphasis_lane3_xe27=0xc6e0 + +# xe28 (40G) +portmap_29=93:40 +xgxs_rx_lane_map_29=0x1320 +xgxs_tx_lane_map_29=0x2031 +phy_xaui_rx_polarity_flip_29=0x1 +phy_xaui_tx_polarity_flip_29=0x2 +serdes_driver_current_lane0_xe28=0x4 +serdes_driver_current_lane1_xe28=0x4 +serdes_driver_current_lane2_xe28=0x4 +serdes_driver_current_lane3_xe28=0x4 +serdes_pre_driver_current_lane0_xe28=0x4 +serdes_pre_driver_current_lane1_xe28=0x4 +serdes_pre_driver_current_lane2_xe28=0x4 +serdes_pre_driver_current_lane3_xe28=0x4 +serdes_preemphasis_lane0_xe28=0xc2f0 +serdes_preemphasis_lane1_xe28=0xc2f0 +serdes_preemphasis_lane2_xe28=0xc2f0 +serdes_preemphasis_lane3_xe28=0xc2f0 + +# xe29 (40G) +portmap_30=89:40 +xgxs_rx_lane_map_30=0x1320 +xgxs_tx_lane_map_30=0x3021 +phy_xaui_rx_polarity_flip_30=0x2 +phy_xaui_tx_polarity_flip_30=0xb +serdes_driver_current_lane0_xe29=0x4 +serdes_driver_current_lane1_xe29=0x4 +serdes_driver_current_lane2_xe29=0x4 +serdes_driver_current_lane3_xe29=0x4 +serdes_pre_driver_current_lane0_xe29=0x4 +serdes_pre_driver_current_lane1_xe29=0x4 +serdes_pre_driver_current_lane2_xe29=0x4 +serdes_pre_driver_current_lane3_xe29=0x4 +serdes_preemphasis_lane0_xe29=0xcad0 +serdes_preemphasis_lane1_xe29=0xc6e0 +serdes_preemphasis_lane2_xe29=0xc6e0 +serdes_preemphasis_lane3_xe29=0xc6e0 + +# xe30 (40G) +portmap_31=101:40 +xgxs_rx_lane_map_31=0x1320 +xgxs_tx_lane_map_31=0x1203 +phy_xaui_rx_polarity_flip_31=0x1 +phy_xaui_tx_polarity_flip_31=0x6 +serdes_driver_current_lane0_xe30=0x6 +serdes_driver_current_lane1_xe30=0x6 +serdes_driver_current_lane2_xe30=0x6 +serdes_driver_current_lane3_xe30=0x7 +serdes_pre_driver_current_lane0_xe30=0x6 +serdes_pre_driver_current_lane1_xe30=0x6 +serdes_pre_driver_current_lane2_xe30=0x6 +serdes_pre_driver_current_lane3_xe30=0x7 +serdes_preemphasis_lane0_xe30=0xcec0 +serdes_preemphasis_lane1_xe30=0xcec0 +serdes_preemphasis_lane2_xe30=0xcad0 +serdes_preemphasis_lane3_xe30=0xc6e0 + +# xe31 (40G) +portmap_32=97:40 +xgxs_rx_lane_map_32=0x213 +xgxs_tx_lane_map_32=0x2031 +phy_xaui_rx_polarity_flip_32=0xc +phy_xaui_tx_polarity_flip_32=0x3 +serdes_driver_current_lane0_xe31=0x5 +serdes_driver_current_lane1_xe31=0x5 +serdes_driver_current_lane2_xe31=0x5 +serdes_driver_current_lane3_xe31=0x5 +serdes_pre_driver_current_lane0_xe31=0x5 +serdes_pre_driver_current_lane1_xe31=0x5 +serdes_pre_driver_current_lane2_xe31=0x5 +serdes_pre_driver_current_lane3_xe31=0x5 +serdes_preemphasis_lane0_xe31=0xcad0 +serdes_preemphasis_lane1_xe31=0xcad0 +serdes_preemphasis_lane2_xe31=0xcad0 +serdes_preemphasis_lane3_xe31=0xcad0 diff --git a/device/virtual/x86_64-kvm_x86_64-r0/platform_asic b/device/virtual/x86_64-kvm_x86_64-r0/platform_asic new file mode 100644 index 000000000000..12c13a2308cc --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64-r0/platform_asic @@ -0,0 +1 @@ +vs diff --git a/device/virtual/x86_64-kvm_x86_64-r0/pmon_daemon_control.json b/device/virtual/x86_64-kvm_x86_64-r0/pmon_daemon_control.json index 101db0ffea1a..35fd93caadcd 100644 --- a/device/virtual/x86_64-kvm_x86_64-r0/pmon_daemon_control.json +++ b/device/virtual/x86_64-kvm_x86_64-r0/pmon_daemon_control.json @@ -4,5 +4,6 @@ "skip_pcied": true, "skip_psud": true, "skip_syseepromd": true, - "skip_thermalctld": true + "skip_thermalctld": true, + "skip_ycabled": false } diff --git a/device/virtual/x86_64-kvm_x86_64_4_asic-r0/platform_asic b/device/virtual/x86_64-kvm_x86_64_4_asic-r0/platform_asic new file mode 100644 index 000000000000..12c13a2308cc --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64_4_asic-r0/platform_asic @@ -0,0 +1 @@ +vs diff --git a/device/virtual/x86_64-kvm_x86_64_6_asic-r0/platform_asic b/device/virtual/x86_64-kvm_x86_64_6_asic-r0/platform_asic new file mode 100644 index 000000000000..12c13a2308cc --- /dev/null +++ b/device/virtual/x86_64-kvm_x86_64_6_asic-r0/platform_asic @@ -0,0 +1 @@ +vs diff --git a/device/wnc/x86_64-wnc_osw1800-r0/OSW1800-48x6q/switch-tna-sai.conf b/device/wnc/x86_64-wnc_osw1800-r0/OSW1800-48x6q/switch-tna-sai.conf index 7cb3ddc48fc9..03b0924d4339 100644 --- a/device/wnc/x86_64-wnc_osw1800-r0/OSW1800-48x6q/switch-tna-sai.conf +++ b/device/wnc/x86_64-wnc_osw1800-r0/OSW1800-48x6q/switch-tna-sai.conf @@ -1,17 +1,9 @@ { - "instance": 0, "chip_list": [ { - "id": "asic-0", "chip_family": "Tofino", - "instance": 0, - "pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0", - "pcie_domain": 0, - "pcie_bus": 5, - "pcie_fn": 0, - "pcie_dev": 0, - "pcie_int_mode": 1, - "sds_fw_path": "share/tofino_sds_fw/avago/firmware" + "sds_fw_path": "share/tofino_sds_fw/avago/firmware", + "instance": 0 } ], "p4_devices": [ @@ -28,7 +20,6 @@ } ], "program-name": "switch", - "sai": "lib/libsai.so", "bfrt-config": "share/switch/bf-rt.json", "model_json_path" : "share/switch/aug_model.json", "switchapi_port_add": false, @@ -36,5 +27,13 @@ } ] } + ], + "switch_options": [ + { + "device-id": 0, + "model_json_path": "share/switch/aug_model.json", + "non_default_port_ppgs": 5, + "switchapi_port_add": false + } ] } diff --git a/device/wnc/x86_64-wnc_osw1800-r0/platform_asic b/device/wnc/x86_64-wnc_osw1800-r0/platform_asic new file mode 100644 index 000000000000..88d88117928c --- /dev/null +++ b/device/wnc/x86_64-wnc_osw1800-r0/platform_asic @@ -0,0 +1 @@ +barefoot diff --git a/dockers/docker-base-bullseye/Dockerfile.j2 b/dockers/docker-base-bullseye/Dockerfile.j2 new file mode 100644 index 000000000000..cae555174174 --- /dev/null +++ b/dockers/docker-base-bullseye/Dockerfile.j2 @@ -0,0 +1,113 @@ +{% set prefix = DEFAULT_CONTAINER_REGISTRY %} +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} +{% if CONFIGURED_ARCH == "armhf" and MULTIARCH_QEMU_ENVIRON == "y" %} +FROM {{ prefix }}multiarch/debian-debootstrap:armhf-bullseye +{% elif CONFIGURED_ARCH == "arm64" and MULTIARCH_QEMU_ENVIRON == "y" %} +FROM {{ prefix }}multiarch/debian-debootstrap:arm64-bullseye +{% else %} +FROM {{ prefix }}{{DOCKER_BASE_ARCH}}/debian:bullseye +{% endif %} + +# Clean documentation in FROM image +RUN find /usr/share/doc -depth \( -type f -o -type l \) ! -name copyright | xargs rm || true + +# Clean doc directories that are empty or only contain empty directories +RUN while [ -n "$(find /usr/share/doc -depth -type d -empty -print -exec rmdir {} +)" ]; do :; done && \ + rm -rf \ + /usr/share/man/* \ + /usr/share/groff/* \ + /usr/share/info/* \ + /usr/share/lintian/* \ + /usr/share/linda/* \ + /var/cache/man/* \ + /usr/share/locale/* + +# Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +# Configure data sources for apt/dpkg +COPY ["dpkg_01_drop", "/etc/dpkg/dpkg.cfg.d/01_drop"] +{% if CONFIGURED_ARCH == "armhf" %} +COPY ["sources.list.armhf", "/etc/apt/sources.list"] +{% elif CONFIGURED_ARCH == "arm64" %} +COPY ["sources.list.arm64", "/etc/apt/sources.list"] +{% else %} +COPY ["sources.list", "/etc/apt/sources.list"] +{% endif %} +COPY ["no_install_recommend_suggest", "/etc/apt/apt.conf.d"] +COPY ["no-check-valid-until", "/etc/apt/apt.conf.d"] + +# Update apt cache and +# pre-install fundamental packages +RUN apt-get update && \ + apt-get -y install \ + curl \ + less \ + perl \ + procps \ + python3 \ + python3-distutils \ + python3-pip \ + rsyslog \ + vim-tiny \ +# Install redis-tools + redis-tools \ +# common dependencies + libdaemon0 \ + libdbus-1-3 \ + libjansson4 \ +# ip and ifconfig utility missing in docker for arm arch + iproute2 \ + net-tools \ +# for processing/handling json files in bash environment + jq \ +# for sairedis zmq rpc channel + libzmq5 + +# Upgrade pip via PyPI and uninstall the Debian version +RUN pip3 install --upgrade pip +RUN apt-get purge -y python3-pip + +# setuptools and wheel are necessary for installing some Python wheel packages +RUN pip3 install --no-cache-dir setuptools==49.6.00 +RUN pip3 install --no-cache-dir wheel==0.35.1 + +# For templating +RUN pip3 install j2cli + +# Install supervisor +RUN pip3 install supervisor==4.2.1 + +# Add support for supervisord to handle startup dependencies +RUN pip3 install supervisord-dependent-startup==1.4.0 + +RUN mkdir -p /etc/supervisor /var/log/supervisor + +RUN apt-get -y purge \ + exim4 \ + exim4-base \ + exim4-config \ + exim4-daemon-light + +{% if docker_base_bullseye_debs.strip() -%} +# Copy locally-built Debian package dependencies +{{ copy_files("debs/", docker_base_bullseye_debs.split(' '), "/debs/") }} + +# Install built Debian packages and implicitly install their dependencies +{{ install_debian_packages(docker_base_bullseye_debs.split(' ')) }} +{%- endif %} + +# Clean up apt +# Remove /var/lib/apt/lists/*, could be obsoleted for derived images +RUN apt-get clean -y && \ + apt-get autoclean -y && \ + apt-get autoremove -y && \ + rm -rf /var/lib/apt/lists/* /tmp/* ~/.cache + +COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"] +COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"] +COPY ["root/.vimrc", "/root/.vimrc"] + +RUN ln /usr/bin/vim.tiny /usr/bin/vim + +COPY ["etc/supervisor/supervisord.conf", "/etc/supervisor/"] diff --git a/dockers/docker-base-bullseye/LICENSE b/dockers/docker-base-bullseye/LICENSE new file mode 100644 index 000000000000..03d8f31e513c --- /dev/null +++ b/dockers/docker-base-bullseye/LICENSE @@ -0,0 +1,13 @@ +Copyright 2016 Microsoft, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/dockers/docker-base-bullseye/dpkg_01_drop b/dockers/docker-base-bullseye/dpkg_01_drop new file mode 100644 index 000000000000..d238f4049aff --- /dev/null +++ b/dockers/docker-base-bullseye/dpkg_01_drop @@ -0,0 +1,29 @@ +## Drop unnecessary files +## ref: https://wiki.ubuntu.com/ReducingDiskFootprint + +## Documentation +path-exclude /usr/share/doc/* +# we need to keep copyright files for legal reasons +path-include /usr/share/doc/*/copyright +path-exclude /usr/share/man/* +path-exclude /usr/share/groff/* +path-exclude /usr/share/info/* +# lintian stuff is small, but really unnecessary +path-exclude /usr/share/lintian/* +path-exclude /usr/share/linda/* + +## Translations +path-exclude /usr/share/locale/* + +## Landscape +path-exclude /usr/share/pyshared/twisted/test* +path-exclude /usr/lib/python*/dist-packages/twisted/test* +path-exclude /usr/share/pyshared/twisted/*/test* +path-exclude /usr/lib/python*/dist-packages/twisted/*/test* + +## install the configuration file if it’s currently missing +force-confmiss +## combined with confold: overwrite configuration files that you have not modified +force-confdef +## do not modify the current configuration file, the new version is installed with a .dpkg-dist suffix +force-confold diff --git a/dockers/docker-base-bullseye/etc/rsyslog.conf b/dockers/docker-base-bullseye/etc/rsyslog.conf new file mode 100644 index 000000000000..ef249229ab1e --- /dev/null +++ b/dockers/docker-base-bullseye/etc/rsyslog.conf @@ -0,0 +1,76 @@ +# +# /etc/rsyslog.conf Configuration file for rsyslog. +# +# For more information see +# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html + + +################# +#### MODULES #### +################# + +$ModLoad imuxsock # provides support for local system logging + +# +# Set a rate limit on messages from the container +# +$SystemLogRateLimitInterval 300 +$SystemLogRateLimitBurst 20000 + +#$ModLoad imklog # provides kernel logging support +#$ModLoad immark # provides --MARK-- message capability + +# provides UDP syslog reception +#$ModLoad imudp +#$UDPServerRun 514 + +# provides TCP syslog reception +#$ModLoad imtcp +#$InputTCPServerRun 514 + + +########################### +#### GLOBAL DIRECTIVES #### +########################### + +# Set remote syslog server +template (name="ForwardFormatInContainer" type="string" string="<%PRI%>%TIMESTAMP:::date-rfc3339% %HOSTNAME% %syslogtag%%msg:::sp-if-no-1st-sp%%msg%") +*.* action(type="omfwd" target="127.0.0.1" port="514" protocol="udp" Template="ForwardFormatInContainer") + +# +# Use traditional timestamp format. +# To enable high precision timestamps, comment out the following line. +# +#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + +# Define a custom template +$template SONiCFileFormat,"%TIMESTAMP%.%timestamp:::date-subseconds% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" +$ActionFileDefaultTemplate SONiCFileFormat + +# +# Set the default permissions for all log files. +# +$FileOwner root +$FileGroup adm +$FileCreateMode 0640 +$DirCreateMode 0755 +$Umask 0022 + +# +# Where to place spool and state files +# +$WorkDirectory /var/spool/rsyslog + +# +# Include all config files in /etc/rsyslog.d/ +# +$IncludeConfig /etc/rsyslog.d/*.conf + +# +# Suppress duplicate messages and report "message repeated n times" +# +$RepeatedMsgReduction on + +############### +#### RULES #### +############### diff --git a/dockers/docker-base-bullseye/etc/rsyslog.d/supervisor.conf b/dockers/docker-base-bullseye/etc/rsyslog.d/supervisor.conf new file mode 100644 index 000000000000..fde8d8a6c994 --- /dev/null +++ b/dockers/docker-base-bullseye/etc/rsyslog.d/supervisor.conf @@ -0,0 +1,9 @@ +module(load="imfile" mode="inotify") # Ensure "inotify" mode is used +$WorkDirectory /var/log/supervisor +# Start Monitoring the file +input(type="imfile" + File="/var/log/supervisor/supervisord.log" + Tag="supervisord" + Severity="info" + Facility="local0" + PersistStateInterval="1") diff --git a/dockers/docker-base-bullseye/etc/supervisor/supervisord.conf b/dockers/docker-base-bullseye/etc/supervisor/supervisord.conf new file mode 100644 index 000000000000..6d7d7390e854 --- /dev/null +++ b/dockers/docker-base-bullseye/etc/supervisor/supervisord.conf @@ -0,0 +1,29 @@ +; supervisor config file + +[unix_http_server] +file=/var/run/supervisor.sock ; (the path to the socket file) +chmod=0700 ; socket file mode (default 0700) + +[supervisord] +logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) +pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) +childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP) +user=root + +; the below section must remain in the config file for RPC +; (supervisorctl/web interface) to work, additional interfaces may be +; added by defining them in separate rpcinterface: sections +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[supervisorctl] +serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket + +; The [include] section can just contain the "files" setting. This +; setting can list multiple files (separated by whitespace or +; newlines). It can also contain wildcards. The filenames are +; interpreted as relative to this file. Included files *cannot* +; include files themselves. + +[include] +files = /etc/supervisor/conf.d/*.conf diff --git a/dockers/docker-base-bullseye/no-check-valid-until b/dockers/docker-base-bullseye/no-check-valid-until new file mode 100644 index 000000000000..c7c25d017f7f --- /dev/null +++ b/dockers/docker-base-bullseye/no-check-valid-until @@ -0,0 +1,4 @@ +# Instruct apt-get to NOT check the "Valid Until" date in Release files +# Once the Debian team archives a repo, they stop updating this date + +Acquire::Check-Valid-Until "false"; diff --git a/dockers/docker-base-bullseye/no_install_recommend_suggest b/dockers/docker-base-bullseye/no_install_recommend_suggest new file mode 100644 index 000000000000..b5bca577de1e --- /dev/null +++ b/dockers/docker-base-bullseye/no_install_recommend_suggest @@ -0,0 +1,5 @@ +# Instruct apt-get to NOT install "recommended" or "suggested" packages by +# default when installing a package. + +APT::Install-Recommends "false"; +APT::Install-Suggests "false"; diff --git a/dockers/docker-base-bullseye/root/.vimrc b/dockers/docker-base-bullseye/root/.vimrc new file mode 100644 index 000000000000..5c1ba8a04f47 --- /dev/null +++ b/dockers/docker-base-bullseye/root/.vimrc @@ -0,0 +1,2 @@ +" enable vim features +set nocompatible diff --git a/dockers/docker-base-bullseye/sources.list b/dockers/docker-base-bullseye/sources.list new file mode 100644 index 000000000000..4a68761df7c8 --- /dev/null +++ b/dockers/docker-base-bullseye/sources.list @@ -0,0 +1,13 @@ +## Debian mirror on Microsoft Azure +## Ref: http://debian-archive.trafficmanager.net/ + +deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ bullseye main contrib non-free +deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian/ bullseye main contrib non-free +deb [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ bullseye-security main contrib non-free +deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ bullseye-security main contrib non-free +deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ bullseye-backports main contrib non-free + +# Debian mirror supports multiple versions for a package +deb [arch=amd64] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free +deb [arch=amd64] http://packages.trafficmanager.net/debian/debian bullseye-updates main contrib non-free +deb [arch=amd64] http://packages.trafficmanager.net/debian/debian bullseye-backports main contrib non-free diff --git a/dockers/docker-base-bullseye/sources.list.arm64 b/dockers/docker-base-bullseye/sources.list.arm64 new file mode 100644 index 000000000000..5a0652aa3c7e --- /dev/null +++ b/dockers/docker-base-bullseye/sources.list.arm64 @@ -0,0 +1,9 @@ +## Debian mirror for ARM repo + +# ARM repo +deb [arch=arm64] http://deb.debian.org/debian bullseye main contrib non-free +deb [arch=arm64] http://deb.debian.org/debian bullseye-updates main contrib non-free +deb [arch=arm64] http://security.debian.org bullseye-security main contrib non-free +deb [arch=arm64] http://deb.debian.org/debian bullseye-backports main +deb [arch=arm64] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free +deb [arch=arm64] http://packages.trafficmanager.net/debian/debian bullseye-updates main contrib non-free diff --git a/dockers/docker-base-bullseye/sources.list.armhf b/dockers/docker-base-bullseye/sources.list.armhf new file mode 100644 index 000000000000..435f4692de9f --- /dev/null +++ b/dockers/docker-base-bullseye/sources.list.armhf @@ -0,0 +1,9 @@ +## Debian mirror for ARM repo + +# ARM repo +deb [arch=armhf] http://deb.debian.org/debian bullseye main contrib non-free +deb [arch=armhf] http://deb.debian.org/debian bullseye-updates main contrib non-free +deb [arch=armhf] http://security.debian.org bullseye-security main contrib non-free +deb [arch=armhf] http://deb.debian.org/debian bullseye-backports main +deb [arch=armhf] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free +deb [arch=armhf] http://packages.trafficmanager.net/debian/debian bullseye-updates main contrib non-free diff --git a/dockers/docker-base-buster/Dockerfile.j2 b/dockers/docker-base-buster/Dockerfile.j2 index ac3fd7743e77..52c784e9a7fe 100644 --- a/dockers/docker-base-buster/Dockerfile.j2 +++ b/dockers/docker-base-buster/Dockerfile.j2 @@ -1,10 +1,11 @@ +{% set prefix = DEFAULT_CONTAINER_REGISTRY %} {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} {% if CONFIGURED_ARCH == "armhf" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:armhf-buster +FROM {{ prefix }}multiarch/debian-debootstrap:armhf-buster {% elif CONFIGURED_ARCH == "arm64" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:arm64-buster +FROM {{ prefix }}multiarch/debian-debootstrap:arm64-buster {% else %} -FROM {{DOCKER_BASE_ARCH}}/debian:buster +FROM {{ prefix }}{{DOCKER_BASE_ARCH}}/debian:buster {% endif %} # Clean documentation in FROM image @@ -120,7 +121,7 @@ RUN apt-get -y purge \ RUN apt-get clean -y && \ apt-get autoclean -y && \ apt-get autoremove -y && \ - rm -rf /var/lib/apt/lists/* /tmp/* + rm -rf /var/lib/apt/lists/* /tmp/* ~/.cache/ COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"] COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"] diff --git a/dockers/docker-base-stretch/Dockerfile.j2 b/dockers/docker-base-stretch/Dockerfile.j2 index b77814bb2820..5603dc502792 100644 --- a/dockers/docker-base-stretch/Dockerfile.j2 +++ b/dockers/docker-base-stretch/Dockerfile.j2 @@ -1,10 +1,11 @@ +{% set prefix = DEFAULT_CONTAINER_REGISTRY %} {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} {% if CONFIGURED_ARCH == "armhf" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:armhf-stretch +FROM {{ prefix }}multiarch/debian-debootstrap:armhf-stretch {% elif CONFIGURED_ARCH == "arm64" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:arm64-stretch +FROM {{ prefix }}multiarch/debian-debootstrap:arm64-stretch {% else %} -FROM {{DOCKER_BASE_ARCH}}/debian:stretch +FROM {{ prefix }}{{DOCKER_BASE_ARCH}}/debian:stretch {% endif %} # Clean documentation in FROM image diff --git a/dockers/docker-base/Dockerfile.j2 b/dockers/docker-base/Dockerfile.j2 index 616a4cde7aff..15df3fe8a754 100644 --- a/dockers/docker-base/Dockerfile.j2 +++ b/dockers/docker-base/Dockerfile.j2 @@ -1,9 +1,10 @@ +{% set prefix = DEFAULT_CONTAINER_REGISTRY %} {% if CONFIGURED_ARCH == "armhf" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:armhf-jessie +FROM {{ prefix }}multiarch/debian-debootstrap:armhf-jessie {% elif CONFIGURED_ARCH == "arm64" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:arm64-jessie +FROM {{ prefix }}multiarch/debian-debootstrap:arm64-jessie {% else %} -FROM {{DOCKER_BASE_ARCH}}/debian:jessie +FROM {{ prefix }}{{DOCKER_BASE_ARCH}}/debian:jessie {% endif %} ## Remove retired jessie-updates repo diff --git a/dockers/docker-config-engine-bullseye/Dockerfile.j2 b/dockers/docker-config-engine-bullseye/Dockerfile.j2 new file mode 100644 index 000000000000..9d0ca97c7604 --- /dev/null +++ b/dockers/docker-config-engine-bullseye/Dockerfile.j2 @@ -0,0 +1,52 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} +FROM docker-base-bullseye + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && \ + apt-get install -y \ + apt-utils \ + build-essential \ + python3-dev + +{%- if CONFIGURED_ARCH == "armhf" or CONFIGURED_ARCH == "arm64" %} +RUN apt-get install -y \ + libxslt-dev \ + libz-dev +{%- endif %} + +# For sonic-config-engine Python 3 package +# Explicitly install pyangbind here, as pyangbind causes enum34 to be installed. +# enum34 causes Python 're' package to not work properly as it redefines an incompatible enum.py module +# https://github.com/robshakir/pyangbind/issues/232 +RUN pip3 install pyangbind==0.8.1 +RUN pip3 uninstall -y enum34 + +{% if docker_config_engine_bullseye_debs.strip() %} +# Copy locally-built Debian package dependencies +{{ copy_files("debs/", docker_config_engine_bullseye_debs.split(' '), "/debs/") }} + +# Install locally-built Debian packages and implicitly install their dependencies +{{ install_debian_packages(docker_config_engine_bullseye_debs.split(' ')) }} +{% endif %} + +{% if docker_config_engine_bullseye_whls.strip() %} +# Copy locally-built Python wheel dependencies +{{ copy_files("python-wheels/", docker_config_engine_bullseye_whls.split(' '), "/python-wheels/") }} + +# Install locally-built Python wheel dependencies +{{ install_python_wheels(docker_config_engine_bullseye_whls.split(' ')) }} +{% endif %} + +# Copy files +COPY ["files/swss_vars.j2", "/usr/share/sonic/templates/"] + +## Clean up +RUN apt-get purge -y \ + python3-dev \ + build-essential && \ + apt-get clean -y && \ + apt-get autoclean -y && \ + apt-get autoremove -y && \ + rm -rf /debs /python-wheels ~/.cache diff --git a/dockers/docker-config-engine-buster/Dockerfile.j2 b/dockers/docker-config-engine-buster/Dockerfile.j2 index 3022546a068c..1e7a64bfcd36 100644 --- a/dockers/docker-config-engine-buster/Dockerfile.j2 +++ b/dockers/docker-config-engine-buster/Dockerfile.j2 @@ -49,4 +49,4 @@ RUN apt-get purge -y \ apt-get clean -y && \ apt-get autoclean -y && \ apt-get autoremove -y && \ - rm -rf /debs /python-wheels + rm -rf /debs /python-wheels ~/.cache diff --git a/dockers/docker-database/Dockerfile.j2 b/dockers/docker-database/Dockerfile.j2 index aef22e24379c..f75d258222a0 100644 --- a/dockers/docker-database/Dockerfile.j2 +++ b/dockers/docker-database/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-buster +FROM docker-config-engine-bullseye ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf @@ -11,22 +11,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update # Install redis-server -{% if CONFIGURED_ARCH == "armhf" %} -RUN curl -k -o redis-tools_6.0.6-1~bpo10+1_armhf.deb "https://sonicstorage.blob.core.windows.net/packages/redis/redis-tools_6.0.6-1_bpo10+1_armhf.deb?sv=2015-04-05&sr=b&sig=67vHAMxsl%2BS3X1KsqhdYhakJkGdg5FKSPgU8kUiw4as%3D&se=2030-10-24T04%3A22%3A40Z&sp=r" -RUN curl -k -o redis-server_6.0.6-1~bpo10+1_armhf.deb "https://sonicstorage.blob.core.windows.net/packages/redis/redis-server_6.0.6-1_bpo10+1_armhf.deb?sv=2015-04-05&sr=b&sig=xTdayvm0RBguxi9suyv855jKRjU%2FmKQ8nHuct4WSX%2FA%3D&se=2030-10-24T04%3A22%3A05Z&sp=r" -RUN dpkg -i redis-tools_6.0.6-1~bpo10+1_armhf.deb redis-server_6.0.6-1~bpo10+1_armhf.deb || apt-get install -f -RUN rm redis-tools_6.0.6-1~bpo10+1_armhf.deb redis-server_6.0.6-1~bpo10+1_armhf.deb -{% elif CONFIGURED_ARCH == "arm64" %} -RUN curl -o redis-tools_6.0.6-1~bpo10+1_arm64.deb "https://sonicstorage.blob.core.windows.net/packages/redis/redis-tools_6.0.6-1_bpo10+1_arm64.deb?sv=2015-04-05&sr=b&sig=GbkJV2wWln3hoz27zKi5erdk3NDKrAFrQriA97bcRCY%3D&se=2030-10-24T04%3A22%3A21Z&sp=r" -RUN curl -o redis-server_6.0.6-1~bpo10+1_arm64.deb "https://sonicstorage.blob.core.windows.net/packages/redis/redis-server_6.0.6-1_bpo10+1_arm64.deb?sv=2015-04-05&sr=b&sig=622w2KzIKIjAaaA0Bz12MzU%2BUBzY2AiXFIFfuKNoKSk%3D&se=2030-10-24T04%3A21%3A44Z&sp=r" -RUN dpkg -i redis-tools_6.0.6-1~bpo10+1_arm64.deb redis-server_6.0.6-1~bpo10+1_arm64.deb || apt-get install -f -RUN rm redis-tools_6.0.6-1~bpo10+1_arm64.deb redis-server_6.0.6-1~bpo10+1_arm64.deb -{% else %} -RUN curl -o redis-tools_6.0.6-1~bpo10+1_amd64.deb "https://sonicstorage.blob.core.windows.net/packages/redis/redis-tools_6.0.6-1~bpo10+1_amd64.deb?sv=2015-04-05&sr=b&sig=73zbmjkf3pi%2Bn0R8Hy7CWT2EUvOAyzM5aLYJWCLySGM%3D&se=2030-09-06T19%3A44%3A59Z&sp=r" -RUN curl -o redis-server_6.0.6-1~bpo10+1_amd64.deb "https://sonicstorage.blob.core.windows.net/packages/redis/redis-server_6.0.6-1~bpo10+1_amd64.deb?sv=2015-04-05&sr=b&sig=2Ketg7BmkZEaTxR%2FgvAFVmhjn7ywdmkc7l2T2rsL57o%3D&se=2030-09-06T19%3A45%3A20Z&sp=r" -RUN dpkg -i redis-tools_6.0.6-1~bpo10+1_amd64.deb redis-server_6.0.6-1~bpo10+1_amd64.deb || apt-get install -f -RUN rm redis-tools_6.0.6-1~bpo10+1_amd64.deb redis-server_6.0.6-1~bpo10+1_amd64.deb -{% endif %} +RUN apt-get install -y redis-tools redis-server {% if docker_database_debs.strip() -%} # Copy locally-built Debian package dependencies diff --git a/dockers/docker-database/database_config.json.j2 b/dockers/docker-database/database_config.json.j2 index 5ad730f10015..f0807b238375 100644 --- a/dockers/docker-database/database_config.json.j2 +++ b/dockers/docker-database/database_config.json.j2 @@ -66,17 +66,17 @@ }, "GB_ASIC_DB" : { "id" : 9, - "separator": "|", + "separator": ":", "instance" : "redis" }, "GB_COUNTERS_DB" : { "id" : 10, - "separator": "|", + "separator": ":", "instance" : "redis" }, "GB_FLEX_COUNTER_DB" : { "id" : 11, - "separator": "|", + "separator": ":", "instance" : "redis" }, "CHASSIS_APP_DB" : { @@ -88,6 +88,11 @@ "id" : 13, "separator": "|", "instance" : "redis_chassis" + }, + "APPL_STATE_DB" : { + "id" : 14, + "separator": ":", + "instance" : "redis" } }, "VERSION" : "1.0" diff --git a/dockers/docker-dhcp-relay/Dockerfile.j2 b/dockers/docker-dhcp-relay/Dockerfile.j2 index a08e74145fe1..2d2afd922471 100644 --- a/dockers/docker-dhcp-relay/Dockerfile.j2 +++ b/dockers/docker-dhcp-relay/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-buster +FROM docker-config-engine-bullseye ARG docker_container_name ARG image_version diff --git a/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp6relay_counters.py b/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp6relay_counters.py index f640ef1de6ce..501309ddd4d7 100644 --- a/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp6relay_counters.py +++ b/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp6relay_counters.py @@ -20,6 +20,7 @@ expected_counts = """\ Message Type Vlan1000 -------------- ----------- + Unknown Solicit Advertise Request diff --git a/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp_relay.py b/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp_relay.py index 2636a43c7d37..b8219fcc6ad3 100644 --- a/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp_relay.py +++ b/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcp_relay.py @@ -20,9 +20,9 @@ def test_plugin_registration(self): def test_dhcp_relay_column_output(self): ctx = ( - ({'Vlan100': {'dhcp_servers': ['192.0.0.1', '192.168.0.2'], 'dhcpv6_servers': ['fc02:2000::1', 'fc02:2000::2']}}, {}, {}), + ({'Vlan100': {'dhcp_servers': ['192.0.0.1', '192.168.0.2']}}, {}, {}), (), ) - assert show_dhcp_relay.get_dhcp_helper_address(ctx, 'Vlan100') == '192.0.0.1\n192.168.0.2\nfc02:2000::1\nfc02:2000::2' + assert show_dhcp_relay.get_dhcp_helper_address(ctx, 'Vlan100') == '192.0.0.1\n192.168.0.2' diff --git a/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcpv6_helper.py b/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcpv6_helper.py index 1f079c5ac965..fcb15b98082d 100644 --- a/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcpv6_helper.py +++ b/dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcpv6_helper.py @@ -34,7 +34,8 @@ def test_show_dhcpv6_helper(self, test_name, test_data, fs): fs.create_file(DBCONFIG_PATH) MockConfigDb.set_config_db(test_data["config_db"]) runner = CliRunner() - table = MockConfigDb.get_table(self, "DHCP_RELAY") + config_db = MockConfigDb() + table = config_db.get_table("DHCP_RELAY") result = show.get_data(table, "Vlan1000") assert result == expected_table diff --git a/dockers/docker-dhcp-relay/cli/clear/plugins/clear_dhcp6relay_counter.py b/dockers/docker-dhcp-relay/cli/clear/plugins/clear_dhcp6relay_counter.py index 7b0d5097d2ec..048a83901574 100644 --- a/dockers/docker-dhcp-relay/cli/clear/plugins/clear_dhcp6relay_counter.py +++ b/dockers/docker-dhcp-relay/cli/clear/plugins/clear_dhcp6relay_counter.py @@ -1,7 +1,7 @@ import sys import click -sys.path.insert(0, '../../show/plugins/') -from show_dhcp6relay_counters import DHCPv6_Counter +import importlib +importlib.import_module('show.plugins.dhcp-relay') import utilities_common.cli as clicommon @@ -15,7 +15,7 @@ def dhcp6relay_clear(): @click.option('-i', '--interface', required=False) def dhcp6relay_clear_counters(interface): """ Clear dhcp6relay message counts """ - + counter = DHCPv6_Counter() counter_intf = counter.get_interface() diff --git a/dockers/docker-dhcp-relay/cli/show/plugins/show_dhcp_relay.py b/dockers/docker-dhcp-relay/cli/show/plugins/show_dhcp_relay.py index bad1de7d52bd..2e641c4c4233 100644 --- a/dockers/docker-dhcp-relay/cli/show/plugins/show_dhcp_relay.py +++ b/dockers/docker-dhcp-relay/cli/show/plugins/show_dhcp_relay.py @@ -12,7 +12,7 @@ DHCPv6_COUNTER_TABLE = 'DHCPv6_COUNTER_TABLE' # DHCPv6 Counter Messages -messages = ["Solicit", "Advertise", "Request", "Confirm", "Renew", "Rebind", "Reply", "Release", "Decline", "Relay-Forward", "Relay-Reply"] +messages = ["Unknown", "Solicit", "Advertise", "Request", "Confirm", "Renew", "Rebind", "Reply", "Release", "Decline", "Relay-Forward", "Relay-Reply"] # DHCP_RELAY Config Table DHCP_RELAY = 'DHCP_RELAY' @@ -26,9 +26,8 @@ def get_dhcp_helper_address(ctx, vlan): return "" dhcp_helpers = vlan_config.get('dhcp_servers', []) - dhcpv6_helpers = vlan_config.get('dhcpv6_servers', []) - return '\n'.join(natsorted(dhcp_helpers) + natsorted(dhcpv6_helpers)) + return '\n'.join(natsorted(dhcp_helpers)) vlan.VlanBrief.register_column('DHCP Helper Address', get_dhcp_helper_address) diff --git a/dockers/docker-dhcp-relay/start.sh b/dockers/docker-dhcp-relay/start.sh index cb563eb003c3..87a9e5711f2f 100755 --- a/dockers/docker-dhcp-relay/start.sh +++ b/dockers/docker-dhcp-relay/start.sh @@ -10,8 +10,8 @@ then ${CTR_SCRIPT} -f dhcp_relay -o ${RUNTIME_OWNER} -v ${IMAGE_VERSION} fi -# If our supervisor config has entries in the "isc-dhcp-relay" group... -if [ $(supervisorctl status | grep -c "^isc-dhcp-relay:") -gt 0 ]; then +# If our supervisor config has entries in the "dhcp-relay" group... +if [ $(supervisorctl status | grep -c "^dhcp-relay:") -gt 0 ]; then # Wait for all interfaces to come up and be assigned IPv4 addresses before # starting the DHCP relay agent(s). If an interface the relay should listen # on is down, the relay agent will not start. If an interface the relay diff --git a/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 b/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 index 568f128b3772..b224a697b5ba 100644 --- a/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 +++ b/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 @@ -38,3 +38,8 @@ wait_until_iface_ready {{ name }} {{ prefix }} wait_until_iface_ready {{ name }} {{ prefix }} {% endif %} {% endfor %} + +# Wait 10 seconds for the rest of interfaces to get added/populated. +# dhcrelay listens on each of the interfaces (in addition to the port +# channels and vlan interfaces) +sleep 10 diff --git a/dockers/docker-fpm-frr/Dockerfile.j2 b/dockers/docker-fpm-frr/Dockerfile.j2 index 42df1c6f38f8..f392d4d3a7a6 100644 --- a/dockers/docker-fpm-frr/Dockerfile.j2 +++ b/dockers/docker-fpm-frr/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-buster +FROM docker-swss-layer-buster ARG docker_container_name ARG frr_user_uid diff --git a/dockers/docker-fpm-frr/base_image_files/TSA b/dockers/docker-fpm-frr/base_image_files/TSA index e96c76dd67b2..6b2ddb264834 100755 --- a/dockers/docker-fpm-frr/base_image_files/TSA +++ b/dockers/docker-fpm-frr/base_image_files/TSA @@ -1,3 +1,12 @@ #!/bin/bash +# toggle the mux to standby if dualtor and any mux active +if +[[ "$(sonic-cfggen -d -v DEVICE_METADATA.localhost.subtype | tr [:upper:] [:lower:])" == *"dualtor"* ]] && +[[ $(show mux status | grep active | wc -l) > 0 ]]; +then + logger -t TSA -p user.info "Toggle all mux mode to standby" + sudo config mux mode standby all +fi + /usr/bin/TS TSA diff --git a/dockers/docker-fpm-frr/base_image_files/TSB b/dockers/docker-fpm-frr/base_image_files/TSB index 176b10c684c8..3fed7bb644f5 100755 --- a/dockers/docker-fpm-frr/base_image_files/TSB +++ b/dockers/docker-fpm-frr/base_image_files/TSB @@ -1,3 +1,10 @@ #!/bin/bash +# toggle the mux to auto if dualtor +if [[ "$(sonic-cfggen -d -v DEVICE_METADATA.localhost.subtype | tr [:upper:] [:lower:])" == *"dualtor"* ]]; +then + logger -t TSB -p user.info "Toggle all mux mode to auto" + sudo config mux mode auto all +fi + /usr/bin/TS TSB diff --git a/dockers/docker-fpm-frr/base_image_files/TSC b/dockers/docker-fpm-frr/base_image_files/TSC index 09d1409c50c7..12af5d621af7 100755 --- a/dockers/docker-fpm-frr/base_image_files/TSC +++ b/dockers/docker-fpm-frr/base_image_files/TSC @@ -3,3 +3,9 @@ /usr/bin/TS TSC portstat -p 5 + +if [[ "$(sonic-cfggen -d -v DEVICE_METADATA.localhost.subtype | tr [:upper:] [:lower:])" == *"dualtor"* ]] +then + echo + show mux status +fi diff --git a/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 b/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 index 7d6bc4ef04ae..c6643f185742 100644 --- a/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 +++ b/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 @@ -33,7 +33,19 @@ ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq {{ loop.index * 5 }} permit {{ prefi {% if DEVICE_METADATA['localhost']['sub_role'] == 'FrontEnd' or DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} {% set multi_asic = True %} {% endif %} -{% if multi_asic is defined or DEVICE_METADATA['localhost']['switch_type'] == 'voq' %} +{% if multi_asic is defined or DEVICE_METADATA['localhost']['switch_type'] == 'voq' or DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %} +ip prefix-list V4_P2P_IP permit 0.0.0.0/0 ge 31 le 31 +! +ipv6 prefix-list V6_P2P_IP permit ::/0 ge 126 le 126 +! +route-map V4_CONNECTED_ROUTES permit 10 + match ip address prefix-list V4_P2P_IP + call HIDE_INTERNAL +! +route-map V6_CONNECTED_ROUTES permit 10 + match ipv6 address prefix-list V6_P2P_IP + call HIDE_INTERNAL +! route-map HIDE_INTERNAL permit 10 set community no-export {% if constants.bgp.peers is defined and constants.bgp.peers.internal is defined and constants.bgp.peers.internal.community is defined %} @@ -55,7 +67,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} bgp bestpath as-path multipath-relax {% endif %} ! -{% if constants.bgp.graceful_restart.enabled is defined and constants.bgp.graceful_restart.enabled %} +{% if constants.bgp.graceful_restart.enabled is defined and constants.bgp.graceful_restart.enabled and DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} bgp graceful-restart restart-time {{ constants.bgp.graceful_restart.restart_time | default(240) }} bgp graceful-restart bgp graceful-restart preserve-fw-state @@ -63,7 +75,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% endif %} ! {# set router-id #} -{% if DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' or DEVICE_METADATA['localhost']['switch_type'] == 'voq' %} +{% if DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' or DEVICE_METADATA['localhost']['switch_type'] == 'voq' or DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %} bgp router-id {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }} {% else %} bgp router-id {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }} @@ -71,7 +83,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} ! {# advertise loopback #} network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/32 -{% if multi_asic is defined or DEVICE_METADATA['localhost']['switch_type'] == 'voq' %} +{% if ((multi_asic is defined and DEVICE_METADATA['localhost']['switch_type'] != 'chassis-packet') or (DEVICE_METADATA['localhost']['switch_type'] == 'voq')) %} network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}/32 route-map HIDE_INTERNAL {% endif %} ! @@ -80,7 +92,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} network {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/64 exit-address-family {% endif %} -{% if multi_asic is defined or DEVICE_METADATA['localhost']['switch_type'] == 'voq'%} +{% if ((multi_asic is defined and DEVICE_METADATA['localhost']['switch_type'] != 'chassis-packet') or (DEVICE_METADATA['localhost']['switch_type'] == 'voq')) %} {% if get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") != 'None' %} address-family ipv6 network {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}/128 route-map HIDE_INTERNAL @@ -102,12 +114,12 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% endblock vlan_advertisement %} ! ! -{% if DEVICE_METADATA['localhost']['sub_role'] == 'FrontEnd' or DEVICE_METADATA['localhost']['switch_type'] == 'voq' %} +{% if DEVICE_METADATA['localhost']['sub_role'] == 'FrontEnd' or DEVICE_METADATA['localhost']['switch_type'] == 'voq' or DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %} address-family ipv4 - redistribute connected route-map HIDE_INTERNAL + redistribute connected route-map V4_CONNECTED_ROUTES exit-address-family address-family ipv6 - redistribute connected route-map HIDE_INTERNAL + redistribute connected route-map V6_CONNECTED_ROUTES exit-address-family {% endif %} ! diff --git a/dockers/docker-fpm-frr/frr/bgpd/templates/internal/peer-group.conf.j2 b/dockers/docker-fpm-frr/frr/bgpd/templates/internal/peer-group.conf.j2 index c0ee4d99b796..e14094a652e5 100644 --- a/dockers/docker-fpm-frr/frr/bgpd/templates/internal/peer-group.conf.j2 +++ b/dockers/docker-fpm-frr/frr/bgpd/templates/internal/peer-group.conf.j2 @@ -4,7 +4,10 @@ neighbor INTERNAL_PEER_V4 peer-group neighbor INTERNAL_PEER_V6 peer-group address-family ipv4 -{% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} + +{% if CONFIG_DB__DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %} + neighbor INTERNAL_PEER_V4 update-source Loopback4096 +{% elif CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} neighbor INTERNAL_PEER_V4 route-reflector-client {% endif %} neighbor INTERNAL_PEER_V4 soft-reconfiguration inbound @@ -13,7 +16,9 @@ neighbor INTERNAL_PEER_V4 route-map TO_BGP_INTERNAL_PEER_V4 out exit-address-family address-family ipv6 -{% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} +{% if CONFIG_DB__DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %} + neighbor INTERNAL_PEER_V6 update-source Loopback4096 +{% elif CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} neighbor INTERNAL_PEER_V6 route-reflector-client {% endif %} neighbor INTERNAL_PEER_V6 soft-reconfiguration inbound diff --git a/dockers/docker-fpm-frr/frr/bgpd/templates/voq_chassis/instance.conf.j2 b/dockers/docker-fpm-frr/frr/bgpd/templates/voq_chassis/instance.conf.j2 index e4ee9bf2eefd..4f7bde5ddf1a 100644 --- a/dockers/docker-fpm-frr/frr/bgpd/templates/voq_chassis/instance.conf.j2 +++ b/dockers/docker-fpm-frr/frr/bgpd/templates/voq_chassis/instance.conf.j2 @@ -4,14 +4,15 @@ bgp bestpath as-path multipath-relax bgp bestpath peer-type multipath-relax ! - neighbor {{ neighbor_addr }} peer-group VOQ_CHASSIS_PEER +{% if neighbor_addr | ipv4 %} + neighbor {{ neighbor_addr }} peer-group VOQ_CHASSIS_V4_PEER +{% elif neighbor_addr | ipv6 %} + neighbor {{ neighbor_addr }} peer-group VOQ_CHASSIS_V6_PEER +{% endif %} neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }} neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }} -{# set the bgp neighbor timers if they have not default values #} -{% if (bgp_session['keepalive'] is defined and bgp_session['keepalive'] | int != 60) - or (bgp_session['holdtime'] is defined and bgp_session['holdtime'] | int != 180) %} - neighbor {{ neighbor_addr }} timers {{ bgp_session['keepalive'] | default("60") }} {{ bgp_session['holdtime'] | default("180") }} -{% endif %} + neighbor {{ neighbor_addr }} timers 3 10 + neighbor {{ neighbor_addr }} timers connect 10 ! {% if 'admin_status' in bgp_session and bgp_session['admin_status'] == 'down' or 'admin_status' not in bgp_session and 'default_bgp_status' in CONFIG_DB__DEVICE_METADATA['localhost'] and CONFIG_DB__DEVICE_METADATA['localhost']['default_bgp_status'] == 'down' %} neighbor {{ neighbor_addr }} shutdown diff --git a/dockers/docker-fpm-frr/frr/bgpd/templates/voq_chassis/peer-group.conf.j2 b/dockers/docker-fpm-frr/frr/bgpd/templates/voq_chassis/peer-group.conf.j2 index 8266c0c82d7f..ec563b380cc6 100644 --- a/dockers/docker-fpm-frr/frr/bgpd/templates/voq_chassis/peer-group.conf.j2 +++ b/dockers/docker-fpm-frr/frr/bgpd/templates/voq_chassis/peer-group.conf.j2 @@ -1,22 +1,27 @@ ! ! template: bgpd/templates/voq_chassis/peer-group.conf.j2 ! - neighbor VOQ_CHASSIS_PEER peer-group + neighbor VOQ_CHASSIS_V4_PEER peer-group + neighbor VOQ_CHASSIS_V6_PEER peer-group address-family ipv4 {% if CONFIG_DB__DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} - neighbor VOQ_CHASSIS_PEER allowas-in 1 + neighbor VOQ_CHASSIS_V4_PEER allowas-in 1 {% endif %} - neighbor VOQ_CHASSIS_PEER activate - neighbor VOQ_CHASSIS_PEER addpath-tx-all-paths - neighbor VOQ_CHASSIS_PEER soft-reconfiguration inbound + neighbor VOQ_CHASSIS_V4_PEER activate + neighbor VOQ_CHASSIS_V4_PEER addpath-tx-all-paths + neighbor VOQ_CHASSIS_V4_PEER soft-reconfiguration inbound + neighbor VOQ_CHASSIS_V4_PEER route-map FROM_VOQ_CHASSIS_V4_PEER in + neighbor VOQ_CHASSIS_V4_PEER route-map TO_VOQ_CHASSIS_V4_PEER out exit-address-family address-family ipv6 {% if CONFIG_DB__DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} - neighbor VOQ_CHASSIS_PEER allowas-in 1 + neighbor VOQ_CHASSIS_V6_PEER allowas-in 1 {% endif %} - neighbor VOQ_CHASSIS_PEER activate - neighbor VOQ_CHASSIS_PEER addpath-tx-all-paths - neighbor VOQ_CHASSIS_PEER soft-reconfiguration inbound + neighbor VOQ_CHASSIS_V6_PEER activate + neighbor VOQ_CHASSIS_V6_PEER addpath-tx-all-paths + neighbor VOQ_CHASSIS_V6_PEER soft-reconfiguration inbound + neighbor VOQ_CHASSIS_V4_PEER route-map FROM_VOQ_CHASSIS_V6_PEER in + neighbor VOQ_CHASSIS_V4_PEER route-map TO_VOQ_CHASSIS_V6_PEER out exit-address-family ! ! end of template: bgpd/templates/voq_chassis/peer-group.conf.j2 diff --git a/dockers/docker-fpm-frr/frr/bgpd/templates/voq_chassis/policies.conf.j2 b/dockers/docker-fpm-frr/frr/bgpd/templates/voq_chassis/policies.conf.j2 index 4c853d4f3220..c26db7bde241 100644 --- a/dockers/docker-fpm-frr/frr/bgpd/templates/voq_chassis/policies.conf.j2 +++ b/dockers/docker-fpm-frr/frr/bgpd/templates/voq_chassis/policies.conf.j2 @@ -1,7 +1,18 @@ ! ! template: bgpd/templates/voq_chassis/policies.conf.j2 ! +route-map FROM_VOQ_CHASSIS_V4_PEER permit 100 ! +route-map TO_VOQ_CHASSIS_V4_PEER permit 100 +! +! +route-map FROM_VOQ_CHASSIS_V6_PEER permit 1 + set ipv6 next-hop prefer-global + on-match next +! +route-map FROM_VOQ_CHASSIS_V6_PEER permit 100 +! +route-map TO_VOQ_CHASSIS_V6_PEER permit 100 ! ! end of template: bgpd/templates/voq_chassis/policies.conf.j2 ! diff --git a/dockers/docker-fpm-frr/frr/frr.conf.j2 b/dockers/docker-fpm-frr/frr/frr.conf.j2 index 99900790366c..11878f8db9aa 100644 --- a/dockers/docker-fpm-frr/frr/frr.conf.j2 +++ b/dockers/docker-fpm-frr/frr/frr.conf.j2 @@ -13,8 +13,6 @@ agentx ! {% include "zebra/zebra.interfaces.conf.j2" %} ! -{% include "staticd/staticd.default_route.conf.j2" %} -! {% include "staticd/staticd.loopback_route.conf.j2" %} ! {% include "bgpd/bgpd.main.conf.j2" %} diff --git a/dockers/docker-fpm-frr/frr/staticd/staticd.conf.j2 b/dockers/docker-fpm-frr/frr/staticd/staticd.conf.j2 index 4831325276c7..6d00ac6609c7 100644 --- a/dockers/docker-fpm-frr/frr/staticd/staticd.conf.j2 +++ b/dockers/docker-fpm-frr/frr/staticd/staticd.conf.j2 @@ -8,7 +8,5 @@ ! {% include "common/daemons.common.conf.j2" %} ! -{% include "staticd.default_route.conf.j2" %} -! {% include "staticd.loopback_route.conf.j2" %} ! diff --git a/dockers/docker-fpm-frr/frr/staticd/staticd.default_route.conf.j2 b/dockers/docker-fpm-frr/frr/staticd/staticd.default_route.conf.j2 deleted file mode 100644 index 22d61ebbd0ff..000000000000 --- a/dockers/docker-fpm-frr/frr/staticd/staticd.default_route.conf.j2 +++ /dev/null @@ -1,10 +0,0 @@ -! -{% block default_route %} -! set static default route to mgmt gateway as a backup to learned default -{% for (name, prefix) in MGMT_INTERFACE|pfx_filter %} -{% if prefix | ipv4 %} -ip route 0.0.0.0/0 {{ MGMT_INTERFACE[(name, prefix)]['gwaddr'] }} 200 -{% endif %} -{% endfor %} -{% endblock default_route %} -! diff --git a/dockers/docker-iccpd/iccpd.sh b/dockers/docker-iccpd/iccpd.sh index d3b2888344ac..b740ca28f565 100644 --- a/dockers/docker-iccpd/iccpd.sh +++ b/dockers/docker-iccpd/iccpd.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +export platform=$(sonic-cfggen -d -y /etc/sonic/sonic_version.yml --var asic_type) + function start_app { rm -f /var/run/iccpd/* mclagsyncd & diff --git a/dockers/docker-lldp/lldpmgrd b/dockers/docker-lldp/lldpmgrd index a6eb84bcab93..9e85406d4510 100755 --- a/dockers/docker-lldp/lldpmgrd +++ b/dockers/docker-lldp/lldpmgrd @@ -30,6 +30,8 @@ VERSION = "1.0" SYSLOG_IDENTIFIER = "lldpmgrd" PORT_INIT_TIMEOUT = 300 +FAILED_CMD_TIMEOUT = 6 +RETRY_LIMIT = 5 class LldpManager(daemon_base.DaemonBase): @@ -41,7 +43,8 @@ class LldpManager(daemon_base.DaemonBase): state_db: Handle to Redis State database via swsscommon lib config_db: Handle to Redis Config database via swsscommon lib pending_cmds: Dictionary where key is port name, value is pending - LLDP configuration command to run + LLDP configuration command to run + and the last timestamp that this command was failed (used for retry mechanism) """ REDIS_TIMEOUT_MS = 0 @@ -58,6 +61,11 @@ class LldpManager(daemon_base.DaemonBase): self.REDIS_TIMEOUT_MS, False) + # Open a handle to the State database + self.state_db = swsscommon.DBConnector("STATE_DB", + self.REDIS_TIMEOUT_MS, + False) + self.pending_cmds = {} self.hostname = "None" self.mgmt_ip = "None" @@ -66,6 +74,7 @@ class LldpManager(daemon_base.DaemonBase): self.port_table = swsscommon.Table(self.config_db, swsscommon.CFG_PORT_TABLE_NAME) self.mgmt_table = swsscommon.Table(self.config_db, swsscommon.CFG_MGMT_INTERFACE_TABLE_NAME) self.app_port_table = swsscommon.Table(self.appl_db, swsscommon.APP_PORT_TABLE_NAME) + self.state_port_table = swsscommon.Table(self.state_db, swsscommon.STATE_PORT_TABLE_NAME) def update_hostname(self, hostname): cmd = "lldpcli configure system hostname {0}".format(hostname) @@ -99,32 +108,25 @@ class LldpManager(daemon_base.DaemonBase): def is_port_up(self, port_name): """ - Determine if a port is up or down by looking into the oper-status for the port in - PORT TABLE in the Application DB + Determine if a port is up or down by looking into the netdev_oper_status for the port in + PORT TABLE in the State DB """ # Retrieve all entires for this port from the Port table - (status, fvp) = self.app_port_table.get(port_name) + (status, fvp) = self.state_port_table.get(port_name) if status: # Convert list of tuples to a dictionary port_table_dict = dict(fvp) # Get the oper-status for the port - if "oper_status" in port_table_dict: - port_oper_status = port_table_dict.get("oper_status") - self.log_info("Port name {} oper status: {}".format(port_name, port_oper_status)) + if "netdev_oper_status" in port_table_dict: + port_oper_status = port_table_dict.get("netdev_oper_status") return port_oper_status == "up" else: return False else: - # Retrieve PortInitDone entry from the Port table - (init_status, init_fvp) = self.port_table.get("PortInitDone") - # The initialization procedure is done, but don't have this port entry - if init_status: - self.log_error("Port '{}' not found in {} table in App DB".format( - port_name, swsscommon.APP_PORT_TABLE_NAME)) return False - def generate_pending_lldp_config_cmd_for_port(self, port_name): + def generate_pending_lldp_config_cmd_for_port(self, port_name, port_table_dict): """ For port `port_name`, look up the description and alias in the Config database, then form the appropriate lldpcli configuration command and run it. @@ -135,27 +137,16 @@ class LldpManager(daemon_base.DaemonBase): # asic-to-asic communication in VOQ based chassis system. We do not configure LLDP on these. if port_name.startswith(inband_prefix()): return - - # Retrieve all entires for this port from the Port table - (status, fvp) = self.port_table.get(port_name) - if status: - # Convert list of tuples to a dictionary - port_table_dict = dict(fvp) - - # Get the port alias. If None or empty string, use port name instead - port_alias = port_table_dict.get("alias") - if not port_alias: - self.log_info("Unable to retrieve port alias for port '{}'. Using port name instead.".format(port_name)) - port_alias = port_name - - # Get the port description. If None or empty string, we'll skip this configuration - port_desc = port_table_dict.get("description") - - else: - self.log_error("Port '{}' not found in {} table in Config DB. Using port name instead of port alias.".format( - port_name, swsscommon.CFG_PORT_TABLE_NAME)) + + # Get the port alias. If None or empty string, use port name instead + port_alias = port_table_dict.get("alias") + if not port_alias: + self.log_info("Unable to retrieve port alias for port '{}'. Using port name instead.".format(port_name)) port_alias = port_name - + + # Get the port description. If None or empty string, we'll skip this configuration + port_desc = port_table_dict.get("description") + lldpcli_cmd = "lldpcli configure ports {0} lldp portidsubtype local {1}".format(port_name, port_alias) # if there is a description available, also configure that @@ -166,17 +157,25 @@ class LldpManager(daemon_base.DaemonBase): # Add the command to our dictionary of pending commands, overwriting any # previous pending command for this port - self.pending_cmds[port_name] = lldpcli_cmd + self.pending_cmds[port_name] = { 'cmd': lldpcli_cmd, 'failed_count': 0} def process_pending_cmds(self): # List of port names (keys of elements) to delete from self.pending_cmds to_delete = [] - for (port_name, cmd) in self.pending_cmds.items(): - self.log_debug("Running command: '{}'".format(cmd)) + for (port_name, port_item) in self.pending_cmds.items(): + cmd = port_item['cmd'] - rc, stderr = run_cmd(self, cmd) + # check if linux port is up + if not self.is_port_up(port_name): + self.log_info("port %s is not up, continue"%port_name) + continue + + if 'failed_timestamp' in port_item and time.time()-port_item['failed_timestamp']= RETRY_LIMIT: + self.log_error("Command failed '{}': {} - command was failed {} times, disabling retry".format(cmd, stderr, RETRY_LIMIT+1)) + # not retrying again + to_delete.append(port_name) + else: + self.pending_cmds[port_name]['failed_count'] += 1 + self.pending_cmds[port_name]['failed_timestamp'] = time.time() + self.log_info("Command failed '{}': {} - cmd failed {} times, retrying again".format(cmd, stderr, self.pending_cmds[port_name]['failed_count'])) + # Delete all successful commands from self.pending_cmds for port_name in to_delete: self.pending_cmds.pop(port_name, None) @@ -268,10 +274,6 @@ class LldpManager(daemon_base.DaemonBase): sel = swsscommon.Select() - # Subscribe to PORT table notifications in the Config DB - sst_confdb = swsscommon.SubscriberStateTable(self.config_db, swsscommon.CFG_PORT_TABLE_NAME) - sel.addSelectable(sst_confdb) - # Subscribe to PORT table notifications in the App DB sst_appdb = swsscommon.SubscriberStateTable(self.appl_db, swsscommon.APP_PORT_TABLE_NAME) sel.addSelectable(sst_appdb) @@ -289,17 +291,6 @@ class LldpManager(daemon_base.DaemonBase): (state, c) = sel.select(SELECT_TIMEOUT_MS) if state == swsscommon.Select.OBJECT: - (key, op, fvp) = sst_confdb.pop() - if fvp: - fvp_dict = dict(fvp) - - # handle config change - if ("alias" in fvp_dict or "description" in fvp_dict) and (op in ["SET", "DEL"]): - if self.is_port_up(key): - self.generate_pending_lldp_config_cmd_for_port(key) - else: - self.pending_cmds.pop(key, None) - (key, op, fvp) = sst_mgmt_ip_confdb.pop() if key: self.lldp_process_mgmt_info_change(op, dict(fvp), key) @@ -310,15 +301,16 @@ class LldpManager(daemon_base.DaemonBase): (key, op, fvp) = sst_appdb.pop() if (key != "PortInitDone") and (key != "PortConfigDone"): - if fvp: - fvp_dict = dict(fvp) - - # handle port status change - if "oper_status" in fvp_dict: - if "up" in fvp_dict.get("oper_status"): - self.generate_pending_lldp_config_cmd_for_port(key) + if op == "SET": + if fvp: + if "up" in dict(fvp).get("oper_status",""): + self.generate_pending_lldp_config_cmd_for_port(key, dict(fvp)) else: self.pending_cmds.pop(key, None) + elif op == "DEL": + self.pending_cmds.pop(key, None) + else: + self.log_error("unknown operation") elif key == "PortInitDone": port_init_done = True diff --git a/dockers/docker-macsec/Dockerfile.j2 b/dockers/docker-macsec/Dockerfile.j2 index 9bbfd69e8d5b..0239d6529096 100644 --- a/dockers/docker-macsec/Dockerfile.j2 +++ b/dockers/docker-macsec/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-buster +FROM docker-swss-layer-buster ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/dockers/docker-mux/Dockerfile.j2 b/dockers/docker-mux/Dockerfile.j2 new file mode 100755 index 000000000000..66ec315f0809 --- /dev/null +++ b/dockers/docker-mux/Dockerfile.j2 @@ -0,0 +1,36 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} +FROM docker-config-engine-buster + +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && \ + apt-get install -f -y \ + libmnl0 + +{% if docker_mux_debs.strip() -%} +# Copy locally-built Debian package dependencies +{{ copy_files("debs/", docker_mux_debs.split(' '), "/debs/") }} + +# Install locally-built Debian packages and implicitly install their dependencies +{{ install_debian_packages(docker_mux_debs.split(' ')) }} +{%- endif %} + +## Clean up +RUN apt-get clean -y && \ + apt-get autoclean -y && \ + apt-get autoremove -y && \ + rm -rf /debs + +COPY ["docker-init.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] +COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] +COPY ["critical_processes", "/etc/supervisor/"] + +## Copy all Jinja2 template files into the templates folder +COPY ["*.j2", "/usr/share/sonic/templates/"] + +ENTRYPOINT ["/usr/bin/docker-init.sh"] diff --git a/dockers/docker-mux/critical_processes b/dockers/docker-mux/critical_processes new file mode 100644 index 000000000000..eb2568f1ef2b --- /dev/null +++ b/dockers/docker-mux/critical_processes @@ -0,0 +1 @@ +program:linkmgrd diff --git a/dockers/docker-mux/docker-init.sh b/dockers/docker-mux/docker-init.sh new file mode 100755 index 000000000000..bea1686132a1 --- /dev/null +++ b/dockers/docker-mux/docker-init.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +# Generate supervisord config file +mkdir -p /etc/supervisor/conf.d/ + +# The docker container should start this script as PID 1, so now that supervisord is +# properly configured, we exec supervisord so that it runs as PID 1 for the +# duration of the container's lifetime +exec /usr/local/bin/supervisord diff --git a/dockers/docker-mux/supervisord.conf b/dockers/docker-mux/supervisord.conf new file mode 100644 index 000000000000..87903f28e155 --- /dev/null +++ b/dockers/docker-mux/supervisord.conf @@ -0,0 +1,40 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[eventlistener:dependent-startup] +command=python3 -m supervisord_dependent_startup +autostart=true +autorestart=unexpected +startretries=0 +exitcodes=0,3 +events=PROCESS_STATE +buffer_size=100 + +[eventlistener:supervisor-proc-exit-listener] +command=/usr/bin/supervisor-proc-exit-listener --container-name mux +events=PROCESS_STATE_EXITED,PROCESS_STATE_RUNNING +autostart=true +autorestart=unexpected + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n -iNONE +priority=1 +autostart=false +autorestart=unexpected +stdout_logfile=syslog +stderr_logfile=syslog +dependent_startup=true + +[program:linkmgrd] +command=nice -n -20 /usr/sbin/linkmgrd -v warning +priority=2 +autostart=false +autorestart=false +startsecs=0 +startretries=0 +stdout_logfile=syslog +stderr_logfile=syslog +dependent_startup=true +dependent_startup_wait_for=rsyslogd:running diff --git a/dockers/docker-nat/Dockerfile.j2 b/dockers/docker-nat/Dockerfile.j2 index 36a178a68af2..066de0a70ed0 100644 --- a/dockers/docker-nat/Dockerfile.j2 +++ b/dockers/docker-nat/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, copy_files %} -FROM docker-config-engine-buster +FROM docker-swss-layer-buster ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index 2a927b5f2b69..ea4e0abbc2ef 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-buster +FROM docker-swss-layer-buster ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf @@ -19,6 +19,7 @@ RUN apt-get update && \ bridge-utils \ conntrack \ ndppd \ + pciutils \ # Needed for installing netifaces Python package build-essential \ python3-dev @@ -39,7 +40,6 @@ RUN ln -s -f /usr/bin/gcc-8 /usr/bin/aarch64-linux-gnu-gcc # Dependencies of restore_neighbors.py RUN pip3 install \ - scapy==2.4.4 \ pyroute2==0.5.14 \ netifaces==0.10.9 @@ -56,6 +56,14 @@ RUN apt-get remove -y gcc-8 {{ install_debian_packages(docker_orchagent_debs.split(' ')) }} {%- endif %} +{% if docker_orchagent_whls.strip() -%} +# Copy locally-built Python wheel dependencies +{{ copy_files("python-wheels/", docker_orchagent_whls.split(' '), "/python-wheels/") }} + +# Install locally-built Python wheel dependencies +{{ install_python_wheels(docker_orchagent_whls.split(' ')) }} +{% endif %} + # Clean up RUN apt-get purge -y \ build-essential \ @@ -63,16 +71,20 @@ RUN apt-get purge -y \ apt-get clean -y && \ apt-get autoclean -y && \ apt-get autoremove -y && \ - rm -rf /debs + rm -rf /debs ~/.cache COPY ["files/arp_update", "/usr/bin"] COPY ["arp_update.conf", "files/arp_update_vars.j2", "/usr/share/sonic/templates/"] COPY ["ndppd.conf", "/usr/share/sonic/templates/"] -COPY ["enable_counters.py", "/usr/bin"] -COPY ["docker-init.sh", "orchagent.sh", "swssconfig.sh", "buffermgrd.sh", "/usr/bin/"] +COPY ["enable_counters.py", "tunnel_packet_handler.py", "/usr/bin/"] +COPY ["orchagent.sh", "swssconfig.sh", "buffermgrd.sh", "/usr/bin/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] # Copy all Jinja2 template files into the templates folder COPY ["*.j2", "/usr/share/sonic/templates/"] +RUN sonic-cfggen -a "{\"ENABLE_ASAN\":\"{{ENABLE_ASAN}}\"}" -t /usr/share/sonic/templates/docker-init.j2 > /usr/bin/docker-init.sh +RUN rm -f /usr/share/sonic/templates/docker-init.j2 +RUN chmod 755 /usr/bin/docker-init.sh + ENTRYPOINT ["/usr/bin/docker-init.sh"] diff --git a/dockers/docker-orchagent/buffermgrd.sh b/dockers/docker-orchagent/buffermgrd.sh index 1d09cfc7d6ee..b5ddaab7df0e 100755 --- a/dockers/docker-orchagent/buffermgrd.sh +++ b/dockers/docker-orchagent/buffermgrd.sh @@ -3,14 +3,16 @@ BUFFER_CALCULATION_MODE=$(redis-cli -n 4 hget "DEVICE_METADATA|localhost" buffer_model) if [ "$BUFFER_CALCULATION_MODE" == "dynamic" ]; then + BUFFERMGRD_ARGS="-a /etc/sonic/asic_table.json" if [ -f /etc/sonic/peripheral_table.json ]; then - BUFFERMGRD_ARGS="-a /etc/sonic/asic_table.json -p /etc/sonic/peripheral_table.json" - else - BUFFERMGRD_ARGS="-a /etc/sonic/asic_table.json" + BUFFERMGRD_PERIPHERIAL_ARGS=" -p /etc/sonic/peripheral_table.json" + fi + if [ -f /etc/sonic/zero_profiles.json ]; then + BUFFERMGRD_ZERO_PROFILE_ARGS=" -z /etc/sonic/zero_profiles.json" fi else # Should we use the fallback MAC in case it is not found in Device.Metadata BUFFERMGRD_ARGS="-l /usr/share/sonic/hwsku/pg_profile_lookup.ini" fi -exec /usr/bin/buffermgrd ${BUFFERMGRD_ARGS} +exec /usr/bin/buffermgrd ${BUFFERMGRD_ARGS} ${BUFFERMGRD_PERIPHERIAL_ARGS} ${BUFFERMGRD_ZERO_PROFILE_ARGS} diff --git a/dockers/docker-orchagent/docker-init.sh b/dockers/docker-orchagent/docker-init.j2 similarity index 72% rename from dockers/docker-orchagent/docker-init.sh rename to dockers/docker-orchagent/docker-init.j2 index d395f2076e47..5b3850613dac 100755 --- a/dockers/docker-orchagent/docker-init.sh +++ b/dockers/docker-orchagent/docker-init.j2 @@ -6,17 +6,29 @@ mkdir -p /etc/supervisor/conf.d/ CFGGEN_PARAMS=" \ -d \ +{% if ENABLE_ASAN == "y" %} + -a "{\"ENABLE_ASAN\":\"{{ENABLE_ASAN}}\"}" \ +{% endif %} -y /etc/sonic/constants.yml \ -t /usr/share/sonic/templates/switch.json.j2,/etc/swss/config.d/switch.json \ + -t /usr/share/sonic/templates/vxlan.json.j2,/etc/swss/config.d/vxlan.json \ -t /usr/share/sonic/templates/ipinip.json.j2,/etc/swss/config.d/ipinip.json \ -t /usr/share/sonic/templates/ports.json.j2,/etc/swss/config.d/ports.json \ -t /usr/share/sonic/templates/vlan_vars.j2 \ -t /usr/share/sonic/templates/ndppd.conf.j2,/etc/ndppd.conf \ -t /usr/share/sonic/templates/critical_processes.j2,/etc/supervisor/critical_processes \ -t /usr/share/sonic/templates/supervisord.conf.j2,/etc/supervisor/conf.d/supervisord.conf + -t /usr/share/sonic/templates/wait_for_link.sh.j2,/usr/bin/wait_for_link.sh \ " VLAN=$(sonic-cfggen $CFGGEN_PARAMS) +chmod +x /usr/bin/wait_for_link.sh + +# Executed platform specific initialization tasks. +if [ -x /usr/share/sonic/platform/platform-init ]; then + /usr/share/sonic/platform/platform-init +fi + # Executed HWSKU specific initialization tasks. if [ -x /usr/share/sonic/hwsku/hwsku-init ]; then /usr/share/sonic/hwsku/hwsku-init diff --git a/dockers/docker-orchagent/enable_counters.py b/dockers/docker-orchagent/enable_counters.py index d0c855cc61b3..c45a931e0553 100755 --- a/dockers/docker-orchagent/enable_counters.py +++ b/dockers/docker-orchagent/enable_counters.py @@ -29,20 +29,27 @@ def enable_rates(): counters_db.set('COUNTERS_DB', 'RATES:PORT', 'PORT_ALPHA', DEFAULT_ALPHA) counters_db.set('COUNTERS_DB', 'RATES:RIF', 'RIF_SMOOTH_INTERVAL', DEFAULT_SMOOTH_INTERVAL) counters_db.set('COUNTERS_DB', 'RATES:RIF', 'RIF_ALPHA', DEFAULT_ALPHA) + counters_db.set('COUNTERS_DB', 'RATES:TRAP', 'TRAP_SMOOTH_INTERVAL', DEFAULT_SMOOTH_INTERVAL) + counters_db.set('COUNTERS_DB', 'RATES:TRAP', 'TRAP_ALPHA', DEFAULT_ALPHA) + counters_db.set('COUNTERS_DB', 'RATES:TUNNEL', 'TUNNEL_SMOOTH_INTERVAL', DEFAULT_SMOOTH_INTERVAL) + counters_db.set('COUNTERS_DB', 'RATES:TUNNEL', 'TUNNEL_ALPHA', DEFAULT_ALPHA) def enable_counters(): db = swsssdk.ConfigDBConnector() db.connect() - enable_counter_group(db, 'PORT') - enable_counter_group(db, 'RIF') - enable_counter_group(db, 'QUEUE') - enable_counter_group(db, 'PFCWD') - enable_counter_group(db, 'PG_WATERMARK') - enable_counter_group(db, 'PG_DROP') - enable_counter_group(db, 'QUEUE_WATERMARK') - enable_counter_group(db, 'BUFFER_POOL_WATERMARK') - enable_counter_group(db, 'PORT_BUFFER_DROP') + default_enabled_counters = ['PORT', 'RIF', 'QUEUE', 'PFCWD', 'PG_WATERMARK', 'PG_DROP', + 'QUEUE_WATERMARK', 'BUFFER_POOL_WATERMARK', 'PORT_BUFFER_DROP', 'ACL'] + + # Enable those default counters + for key in default_enabled_counters: + enable_counter_group(db, key) + + # Set FLEX_COUNTER_DELAY_STATUS to false for those non-default counters + keys = db.get_keys('FLEX_COUNTER_TABLE') + for key in keys: + if key not in default_enabled_counters: + enable_counter_group(db, key) enable_rates() diff --git a/dockers/docker-orchagent/ndppd.conf b/dockers/docker-orchagent/ndppd.conf index 1e97bf97e313..86297de94a45 100644 --- a/dockers/docker-orchagent/ndppd.conf +++ b/dockers/docker-orchagent/ndppd.conf @@ -1,9 +1,20 @@ [program:ndppd] -command=bash -c "/usr/sbin/ndppd | /usr/bin/logger" +command=/usr/sbin/ndppd priority=7 autostart=false autorestart=unexpected stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true +dependent_startup_wait_for=wait_for_link:exited + +[program:wait_for_link] +command=/usr/bin/wait_for_link.sh +priority=7 +autostart=false +autorestart=false +startsecs=0 +stdout_logfile=syslog +stderr_logfile=syslog +dependent_startup=true dependent_startup_wait_for=swssconfig:exited \ No newline at end of file diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh index aaa047a42036..7585e4896cf4 100755 --- a/dockers/docker-orchagent/orchagent.sh +++ b/dockers/docker-orchagent/orchagent.sh @@ -5,6 +5,7 @@ SWSS_VARS_FILE=/usr/share/sonic/templates/swss_vars.j2 # Retrieve SWSS vars from sonic-cfggen SWSS_VARS=$(sonic-cfggen -d -y /etc/sonic/sonic_version.yml -t $SWSS_VARS_FILE) || exit 1 export platform=$(echo $SWSS_VARS | jq -r '.asic_type') +export sub_platform=$(echo $SWSS_VARS | jq -r '.asic_subtype') MAC_ADDRESS=$(echo $SWSS_VARS | jq -r '.mac') if [ "$MAC_ADDRESS" == "None" ] || [ -z "$MAC_ADDRESS" ]; then diff --git a/dockers/docker-orchagent/supervisord.conf.j2 b/dockers/docker-orchagent/supervisord.conf.j2 index 0ba9b8f48015..7cd31a113223 100644 --- a/dockers/docker-orchagent/supervisord.conf.j2 +++ b/dockers/docker-orchagent/supervisord.conf.j2 @@ -49,6 +49,9 @@ stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true dependent_startup_wait_for=rsyslogd:running +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/gearsyncd-asan.log" +{% endif %} {%- endif %} {% if is_fabric_asic == 0 %} @@ -61,6 +64,9 @@ stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true dependent_startup_wait_for=rsyslogd:running +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/portsyncd-asan.log" +{% endif %} {%- endif %} [program:orchagent] @@ -72,6 +78,9 @@ stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true dependent_startup_wait_for={{ orchagent_dependent_startup_wait_for }} +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/orchagent-asan.log" +{% endif %} [program:swssconfig] command=/usr/bin/swssconfig.sh @@ -84,6 +93,9 @@ stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true dependent_startup_wait_for=orchagent:running +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/swssconfig-asan.log" +{% endif %} {% if is_fabric_asic == 0 %} [program:restore_neighbors] @@ -111,6 +123,9 @@ stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true dependent_startup_wait_for=orchagent:running +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/coppmgrd-asan.log" +{% endif %} {%- endif %} {% if is_fabric_asic == 0 %} @@ -123,6 +138,9 @@ stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true dependent_startup_wait_for=swssconfig:exited +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/neighsyncd-asan.log" +{% endif %} {%- endif %} {% if is_fabric_asic == 0 %} @@ -135,6 +153,9 @@ stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true dependent_startup_wait_for=swssconfig:exited +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/vlanmgrd-asan.log" +{% endif %} {%- endif %} {% if is_fabric_asic == 0 %} @@ -147,6 +168,9 @@ stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true dependent_startup_wait_for=swssconfig:exited +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/intfmgrd-asan.log" +{% endif %} {%- endif %} {% if is_fabric_asic == 0 %} @@ -159,6 +183,9 @@ stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true dependent_startup_wait_for=swssconfig:exited +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/portmgrd-asan.log" +{% endif %} {%- endif %} {% if is_fabric_asic == 0 %} @@ -171,6 +198,9 @@ stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true dependent_startup_wait_for=swssconfig:exited +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/buffermgrd-asan.log" +{% endif %} {%- endif %} {% if is_fabric_asic == 0 %} @@ -183,6 +213,9 @@ stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true dependent_startup_wait_for=swssconfig:exited +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/vrfmgrd-asan.log" +{% endif %} {%- endif %} {% if is_fabric_asic == 0 %} @@ -195,6 +228,9 @@ stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true dependent_startup_wait_for=swssconfig:exited +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/nbrmgrd-asan.log" +{% endif %} {%- endif %} {% if is_fabric_asic == 0 %} @@ -207,6 +243,9 @@ stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true dependent_startup_wait_for=swssconfig:exited +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/vxlanmgrd-asan.log" +{% endif %} {%- endif %} {% if is_fabric_asic == 0 %} @@ -219,6 +258,9 @@ stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true dependent_startup_wait_for=swssconfig:exited +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/tunnelmgrd-asan.log" +{% endif %} {%- endif %} [program:enable_counters] @@ -241,4 +283,19 @@ stdout_logfile=syslog stderr_logfile=syslog dependent_startup=true dependent_startup_wait_for=swssconfig:exited +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/fdbsyncd-asan.log" +{% endif %} +{%- endif %} + +{% if is_fabric_asic == 0 %} +[program:tunnel_packet_handler] +command=/usr/bin/tunnel_packet_handler.py +priority=12 +autostart=false +autorestart=unexpected +stdout_logfile=syslog +stderr_logfile=syslog +dependent_startup=true +dependent_startup_wait_for=swssconfig:exited {%- endif %} diff --git a/dockers/docker-orchagent/switch.json.j2 b/dockers/docker-orchagent/switch.json.j2 index 4d2a0be1b051..30ad703bc2cf 100644 --- a/dockers/docker-orchagent/switch.json.j2 +++ b/dockers/docker-orchagent/switch.json.j2 @@ -3,7 +3,7 @@ {% set hash_seed = 0 %} {% set hash_seed_offset = 0 %} {% if DEVICE_METADATA.localhost.type %} -{% if "ToRRouter" in DEVICE_METADATA.localhost.type %} +{% if "ToRRouter" in DEVICE_METADATA.localhost.type or DEVICE_METADATA.localhost.type in ["EPMS", "MgmtTsToR"] %} {% set hash_seed = 0 %} {% elif "LeafRouter" in DEVICE_METADATA.localhost.type %} {% set hash_seed = 10 %} @@ -20,7 +20,12 @@ "SWITCH_TABLE:switch": { "ecmp_hash_seed": "{{ hash_seed_value }}", "lag_hash_seed": "{{ hash_seed_value }}", - "fdb_aging_time": "600" + "fdb_aging_time": "600", +{% if DEVICE_METADATA.localhost.type and "LeafRouter" in DEVICE_METADATA.localhost.type %} + "ordered_ecmp": "true" +{% else %} + "ordered_ecmp": "false" +{% endif %} }, "OP": "SET" } diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index 0081d074ad60..701d44ca8a3c 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -23,6 +23,12 @@ function fast_reboot { mv -f /default_routes.json /default_routes.json.1 fi + if [[ -f /media_config.json ]]; + then + swssconfig /media_config.json + mv -f /media_config.json /media_config.json.1 + fi + ;; *) ;; @@ -52,7 +58,7 @@ if [[ "$SYSTEM_WARM_START" == "true" ]] || [[ "$SWSS_WARM_START" == "true" ]]; t exit 0 fi -SWSSCONFIG_ARGS="ipinip.json ports.json switch.json " +SWSSCONFIG_ARGS="ipinip.json ports.json switch.json vxlan.json" for file in $SWSSCONFIG_ARGS; do swssconfig /etc/swss/config.d/$file diff --git a/dockers/docker-orchagent/tunnel_packet_handler.py b/dockers/docker-orchagent/tunnel_packet_handler.py new file mode 100755 index 000000000000..682316eb6d49 --- /dev/null +++ b/dockers/docker-orchagent/tunnel_packet_handler.py @@ -0,0 +1,355 @@ +#! /usr/bin/env python3 +""" +Adds neighbor to kernel for undeliverable tunnel packets + +When receiving tunnel packets, if the hardware doesn't contain neighbor +information for the inner packet's destination IP, the entire encapsulated +packet is trapped to the CPU. In this case, we should ping the inner +destination IP to trigger the process of obtaining neighbor information +""" +import subprocess +import time +from datetime import datetime +from ipaddress import ip_interface + +from swsssdk import ConfigDBConnector, SonicV2Connector +from sonic_py_common import logger as log + +from pyroute2 import IPRoute +from scapy.layers.inet import IP +from scapy.layers.inet6 import IPv6 +from scapy.sendrecv import AsyncSniffer + + +logger = log.Logger() + +STATE_DB = 'STATE_DB' +PORTCHANNEL_INTERFACE_TABLE = 'PORTCHANNEL_INTERFACE' +TUNNEL_TABLE = 'TUNNEL' +PEER_SWITCH_TABLE = 'PEER_SWITCH' +INTF_TABLE_TEMPLATE = 'INTERFACE_TABLE|{}|{}' +STATE_KEY = 'state' +TUNNEL_TYPE_KEY = 'tunnel_type' +DST_IP_KEY = 'dst_ip' +ADDRESS_IPV4_KEY = 'address_ipv4' +IPINIP_TUNNEL = 'ipinip' + +RTM_NEWLINK = 'RTM_NEWLINK' + + +class TunnelPacketHandler(object): + """ + This class handles unroutable tunnel packets that are trapped + to the CPU from the ASIC. + """ + + def __init__(self): + self.config_db = ConfigDBConnector() + self.config_db.connect() + self.state_db = SonicV2Connector() + self.state_db.connect(STATE_DB) + self._portchannel_intfs = None + self.up_portchannels = None + self.netlink_api = IPRoute() + self.sniffer = None + self.self_ip = '' + self.packet_filter = '' + self.sniff_intfs = [] + + @property + def portchannel_intfs(self): + """ + Gets all portchannel interfaces and IPv4 addresses in config DB + + Returns: + (list) Tuples of a portchannel interface name (str) and + associated IPv4 address (str) + """ + if self._portchannel_intfs is None: + intf_keys = self.config_db.get_keys(PORTCHANNEL_INTERFACE_TABLE) + portchannel_intfs = [] + + for key in intf_keys: + if isinstance(key, tuple) and len(key) > 1: + if ip_interface(key[1]).version == 4: + portchannel_intfs.append(key) + + self._portchannel_intfs = portchannel_intfs + + return self._portchannel_intfs + + def get_intf_name(self, msg): + """ + Gets the interface name for a netlink msg + + Returns: + (str) The interface name, or the empty string if no interface + name was found + """ + attr_list = msg.get('attrs', list()) + + for attribute, val in attr_list: + if attribute == 'IFLA_IFNAME': + return val + + return '' + + def netlink_msg_is_for_portchannel(self, msg): + """ + Determines if a netlink message is about a PortChannel interface + + Returns: + (list) integers representing kernel indices + """ + ifname = self.get_intf_name(msg) + + return ifname in [name for name, _ in self.portchannel_intfs] + + def get_up_portchannels(self): + """ + Returns the portchannels which are operationally up + + Returns: + (list) of interface names which are up, as strings + """ + portchannel_intf_names = [name for name, _ in self.portchannel_intfs] + link_statuses = [] + for intf in portchannel_intf_names: + status = self.netlink_api.link("get", ifname=intf) + link_statuses.append(status[0]) + up_portchannels = [] + + for status in link_statuses: + if status['state'] == 'up': + up_portchannels.append(self.get_intf_name(status)) + + return up_portchannels + + def all_portchannels_established(self): + """ + Checks if the portchannel interfaces are established + + Note that this status does not indicate operational state + Returns: + (bool) True, if all interfaces are established + False, otherwise + """ + intfs = self.portchannel_intfs + for intf in intfs: + intf_table_name = INTF_TABLE_TEMPLATE.format(intf[0], intf[1]) + intf_state = self.state_db.get( + STATE_DB, + intf_table_name, + STATE_KEY + ) + + if intf_state and intf_state.lower() != 'ok': + return False + + return True + + def wait_for_portchannels(self, interval=5, timeout=60): + """ + Continuosly checks if all portchannel host interfaces are established + + Args: + interval: the interval (in seconds) at which to perform the check + timeout: maximum allowed duration (in seconds) to wait for + interfaces to come up + + Raises: + RuntimeError if the timeout duration is reached and interfaces are + still not up + """ + start = datetime.now() + + while (datetime.now() - start).seconds < timeout: + if self.all_portchannels_established(): + logger.log_info("All portchannel intfs are established") + return None + logger.log_info("Not all portchannel intfs are established") + time.sleep(interval) + + raise RuntimeError('Portchannel intfs were not established ' + 'within {}'.format(timeout)) + + def get_ipinip_tunnel_addrs(self): + """ + Get the IP addresses used for the IPinIP tunnel + + These should be the Loopback0 addresses for this device and the + peer device + + Returns: + ((str) self_loopback_ip, (str) peer_loopback_ip) + or + (None, None) If the tunnel type is not IPinIP + or + if an error is encountered. This most likely means + the host device is not a dual ToR device + """ + try: + peer_switch = self.config_db.get_keys(PEER_SWITCH_TABLE)[0] + tunnel = self.config_db.get_keys(TUNNEL_TABLE)[0] + except IndexError: + logger.log_warning('PEER_SWITCH or TUNNEL table' + 'not found in config DB') + return None, None + + try: + tunnel_table = self.config_db.get_entry(TUNNEL_TABLE, tunnel) + tunnel_type = tunnel_table[TUNNEL_TYPE_KEY].lower() + self_loopback_ip = tunnel_table[DST_IP_KEY] + peer_loopback_ip = self.config_db.get_entry( + PEER_SWITCH_TABLE, peer_switch + )[ADDRESS_IPV4_KEY] + except KeyError as error: + logger.log_warning( + 'PEER_SWITCH or TUNNEL table missing data, ' + 'could not find key {}' + .format(error) + ) + return None, None + + if tunnel_type == IPINIP_TUNNEL: + return self_loopback_ip, peer_loopback_ip + + return None, None + + def get_inner_pkt_type(self, packet): + """ + Get the type of an inner encapsulated packet + + Returns: + (str) 'v4' if the inner packet is IPv4 + (str) 'v6' if the inner packet is IPv6 + (bool) False if `packet` is not an IPinIP packet + """ + if packet.haslayer(IP): + # Determine inner packet type based on IP protocol number + # The outer packet type should always be IPv4 + if packet[IP].proto == 4: + return IP + elif packet[IP].proto == 41: + return IPv6 + return False + + def wait_for_netlink_msgs(self): + """ + Gathers any RTM_NEWLINK messages + + Returns: + (list) containing any received messages + """ + msgs = [] + with IPRoute() as ipr: + ipr.bind() + for msg in ipr.get(): + if msg['event'] == RTM_NEWLINK: + msgs.append(msg) + + return msgs + + def sniffer_restart_required(self, messages): + """ + Determines if the packet sniffer needs to be restarted + + A restart is required if all of the following conditions are met: + 1. A netlink message of type RTM_NEWLINK is received + (this is checked by `wait_for_netlink_msgs`) + 2. The interface index of the message corresponds to a portchannel + interface + 3. The state of the interface in the message is 'up' + Here, we do not care about an interface going down since + the sniffer is able to continue sniffing on the other + interfaces. However, if an interface has gone down and + come back up, we need to restart the sniffer to be able + to sniff traffic on the interface that has come back up. + """ + for msg in messages: + if self.netlink_msg_is_for_portchannel(msg): + if msg['state'] == 'up': + logger.log_info('{} came back up, sniffer restart required' + .format(self.get_intf_name(msg))) + return True + return False + + def start_sniffer(self): + """ + Starts an AsyncSniffer and waits for it to inititalize fully + """ + self.sniffer = AsyncSniffer( + iface=self.sniff_intfs, + filter=self.packet_filter, + prn=self.ping_inner_dst, + store=0 + ) + self.sniffer.start() + + while not hasattr(self.sniffer, 'stop_cb'): + time.sleep(0.1) + + def ping_inner_dst(self, packet): + """ + Pings the inner destination IP for an encapsulated packet + + Args: + packet: The encapsulated packet received + """ + inner_packet_type = self.get_inner_pkt_type(packet) + if inner_packet_type and packet[IP].dst == self.self_ip: + cmds = ['timeout', '0.2', 'ping', '-c1', + '-W1', '-i0', '-n', '-q'] + if inner_packet_type == IPv6: + cmds.append('-6') + dst_ip = packet[IP].payload[inner_packet_type].dst + cmds.append(dst_ip) + logger.log_info("Running command '{}'".format(' '.join(cmds))) + subprocess.run(cmds, stdout=subprocess.DEVNULL) + + def listen_for_tunnel_pkts(self): + """ + Listens for tunnel packets that are trapped to CPU + + These packets may be trapped if there is no neighbor info for the + inner packet destination IP in the hardware. + """ + self.self_ip, peer_ip = self.get_ipinip_tunnel_addrs() + if self.self_ip is None or peer_ip is None: + logger.log_notice('Could not get tunnel addresses from ' + 'config DB, exiting...') + return None + + self.packet_filter = 'host {} and host {}'.format(self.self_ip, peer_ip) + logger.log_notice('Starting tunnel packet handler for {}' + .format(self.packet_filter)) + + self.sniff_intfs = self.get_up_portchannels() + logger.log_info("Listening on interfaces {}".format(self.sniff_intfs)) + + self.start_sniffer() + while True: + msgs = self.wait_for_netlink_msgs() + if self.sniffer_restart_required(msgs): + self.sniffer.stop() + sniff_intfs = self.get_up_portchannels() + logger.log_notice('Restarting tunnel packet handler on ' + 'interfaces {}'.format(sniff_intfs)) + self.start_sniffer() + + def run(self): + """ + Entry point for the TunnelPacketHandler class + """ + self.wait_for_portchannels() + self.listen_for_tunnel_pkts() + + +def main(): + logger.set_min_log_priority_info() + handler = TunnelPacketHandler() + handler.run() + + +if __name__ == "__main__": + main() diff --git a/dockers/docker-orchagent/vxlan.json.j2 b/dockers/docker-orchagent/vxlan.json.j2 new file mode 100644 index 000000000000..f0b73467326c --- /dev/null +++ b/dockers/docker-orchagent/vxlan.json.j2 @@ -0,0 +1,11 @@ +[ + { + "SWITCH_TABLE:switch": { +{% if DEVICE_METADATA.localhost.vxlan_port_range == 'enable' %} + "vxlan_sport": "0xFF00", + "vxlan_mask": "8" +{% endif %} + }, + "OP": "SET" + } +] diff --git a/dockers/docker-orchagent/wait_for_link.sh.j2 b/dockers/docker-orchagent/wait_for_link.sh.j2 new file mode 100644 index 000000000000..980b472b3e0a --- /dev/null +++ b/dockers/docker-orchagent/wait_for_link.sh.j2 @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +VLAN_TABLE_PREFIX="VLAN_TABLE" + +function wait_until_iface_ready +{ + TABLE_PREFIX=$1 + IFACE=$2 + + echo "Waiting until interface $IFACE is ready..." + + # Wait for the interface to come up + # (i.e., interface is present in STATE_DB and state is "ok") + while true; do + RESULT=$(sonic-db-cli STATE_DB HGET "${TABLE_PREFIX}|${IFACE}" "state" 2> /dev/null) + if [ x"$RESULT" == x"ok" ]; then + break + fi + + sleep 1 + done + + echo "Interface ${IFACE} is ready!" +} + + +# Wait for all interfaces to be up and ready +{% for (name, prefix) in VLAN_INTERFACE|pfx_filter %} +wait_until_iface_ready ${VLAN_TABLE_PREFIX} {{ name }} +{% endfor %} diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index d8988b8f6ebe..4f5e941dd92a 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -20,7 +20,6 @@ RUN apt-get update && \ librrd8 \ librrd-dev \ rrdtool \ - python-smbus \ python3-smbus \ dmidecode \ i2c-tools \ @@ -28,24 +27,15 @@ RUN apt-get update && \ python3-jsonschema \ libpci3 -# TODO: Remove these lines once we no longer need Python 2 -RUN apt-get install -f -y python-dev python-pip -RUN pip2 install --upgrade 'pip<21' -RUN apt-get purge -y python-pip -RUN pip2 install 'setuptools==40.8.0' - # On Arista devices, the sonic_platform wheel is not installed in the container. # Instead, the installation directory is mounted from the host OS. However, this method # doesn't ensure all dependencies are installed in the container. So here we # install any dependencies required by the Arista sonic_platform package. # TODO: eliminate the need to install these explicitly. -# NOTE: Only install enum34 for Python 2, as our version of Python 3 is 3.7, which -# contains 'enum' as part of the standard library. Installing enum34 there will -# cause conflicts. -RUN pip2 install enum34 +RUN pip3 install grpcio==1.39.0 \ + grpcio-tools==1.39.0 # Barefoot platform vendors' sonic_platform packages import the Python 'thrift' library -RUN pip2 install thrift==0.13.0 RUN pip3 install thrift==0.13.0 {% if docker_platform_monitor_debs.strip() -%} @@ -73,9 +63,6 @@ RUN pip3 install thrift==0.13.0 {% endif %} -# TODO: Remove this line once we no longer need Python 2 -RUN apt-get purge -y python-dev - # Clean up RUN apt-get purge -y \ build-essential \ diff --git a/dockers/docker-platform-monitor/docker-pmon.supervisord.conf.j2 b/dockers/docker-platform-monitor/docker-pmon.supervisord.conf.j2 index 1bad4ab36731..b93f0cef3cee 100644 --- a/dockers/docker-platform-monitor/docker-pmon.supervisord.conf.j2 +++ b/dockers/docker-platform-monitor/docker-pmon.supervisord.conf.j2 @@ -41,16 +41,18 @@ dependent_startup=true dependent_startup_wait_for=rsyslogd:running {% endif %} +{% if not skip_chassis_db_init %} [program:chassis_db_init] command=/usr/local/bin/chassis_db_init priority=3 autostart=false -autorestart=unexpected +autorestart=false stdout_logfile=syslog stderr_logfile=syslog -startsecs=10 +startsecs=0 dependent_startup=true dependent_startup_wait_for=rsyslogd:running +{% endif %} {% if not skip_sensors and HAVE_SENSORS_CONF == 1 %} [program:lm-sensors] @@ -108,10 +110,29 @@ dependent_startup=true dependent_startup_wait_for=rsyslogd:running {% endif %} +{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %} +{% if not skip_ycabled %} +[program:ycabled] +{% if delay_ycabled %} +command=bash -c "sleep 30 && nice -n -20 python3 /usr/local/bin/ycabled" +{% else %} +command=nice -n -20 python3 /usr/local/bin/ycabled +{% endif %} +priority=7 +autostart=false +autorestart=unexpected +stdout_logfile=syslog +stderr_logfile=syslog +startsecs=10 +dependent_startup=true +dependent_startup_wait_for=rsyslogd:running +{% endif %} +{% endif %} + {% if not skip_psud %} [program:psud] command={% if API_VERSION == 3 and 'psud' not in python2_daemons %}python3 {% else %} python2 {% endif %}/usr/local/bin/psud -priority=7 +priority=8 autostart=false autorestart=unexpected stdout_logfile=syslog @@ -124,7 +145,7 @@ dependent_startup_wait_for=rsyslogd:running {% if not skip_syseepromd %} [program:syseepromd] command={% if API_VERSION == 3 and 'syseepromd' not in python2_daemons %}python3 {% else %} python2 {% endif %}/usr/local/bin/syseepromd -priority=8 +priority=9 autostart=false autorestart=unexpected stdout_logfile=syslog @@ -137,7 +158,7 @@ dependent_startup_wait_for=rsyslogd:running {% if not skip_thermalctld %} [program:thermalctld] command={% if API_VERSION == 3 and 'thermalctld' not in python2_daemons %}python3 {% else %} python2 {% endif %}/usr/local/bin/thermalctld -priority=9 +priority=10 autostart=false autorestart=unexpected stdout_logfile=syslog @@ -151,7 +172,7 @@ dependent_startup_wait_for=rsyslogd:running {% if not skip_pcied %} [program:pcied] command={% if API_VERSION == 3 and 'pcied' not in python2_daemons %}python3 {% else %} python2 {% endif %}/usr/local/bin/pcied -priority=10 +priority=11 autostart=false autorestart=unexpected stdout_logfile=syslog diff --git a/dockers/docker-platform-monitor/docker_init.j2 b/dockers/docker-platform-monitor/docker_init.j2 index 1d22e19b239b..c93d1790bd00 100755 --- a/dockers/docker-platform-monitor/docker_init.j2 +++ b/dockers/docker-platform-monitor/docker_init.j2 @@ -105,9 +105,9 @@ confvar="{\"HAVE_SENSORS_CONF\":$HAVE_SENSORS_CONF, \"HAVE_FANCONTROL_CONF\":$HA if [ -e $PMON_DAEMON_CONTROL_FILE ]; then - sonic-cfggen -j $PMON_DAEMON_CONTROL_FILE -a "$confvar" -t $SUPERVISOR_CONF_TEMPLATE > $SUPERVISOR_CONF_FILE + sonic-cfggen -d -j $PMON_DAEMON_CONTROL_FILE -a "$confvar" -t $SUPERVISOR_CONF_TEMPLATE > $SUPERVISOR_CONF_FILE else - sonic-cfggen -a "$confvar" -t $SUPERVISOR_CONF_TEMPLATE > $SUPERVISOR_CONF_FILE + sonic-cfggen -d -a "$confvar" -t $SUPERVISOR_CONF_TEMPLATE > $SUPERVISOR_CONF_FILE fi exec /usr/local/bin/supervisord diff --git a/dockers/docker-ptf-sai/Dockerfile.j2 b/dockers/docker-ptf-sai/Dockerfile.j2 new file mode 100644 index 000000000000..1e284bd368ea --- /dev/null +++ b/dockers/docker-ptf-sai/Dockerfile.j2 @@ -0,0 +1,41 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} +FROM docker-ptf + +# Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +# Set the apt source, update package cache and install necessary packages +RUN apt-get update \ + && apt-get upgrade -y \ + && apt-get dist-upgrade -y \ + && apt-get install -y \ + python3-pip + +RUN pip3 install crc16 \ + netifaces \ + getmac \ + packet_helper \ + psutil \ + scapy==2.4.4 \ + scapy_helper \ + pysubnettree \ + xmlrunner + +COPY \ +{% for deb in docker_ptf_sai_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg -i \ +{% for deb in docker_ptf_sai_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor %} + +# Remove old ptf package +RUN dpkg -r python-ptf + +# Install new ptf package +RUN git clone https://github.com/p4lang/ptf.git \ + && cd ptf \ + && python3.7 setup.py install --single-version-externally-managed --record /tmp/ptf_install.txt diff --git a/dockers/docker-ptf/Dockerfile.j2 b/dockers/docker-ptf/Dockerfile.j2 index f403054dbb37..d999d01e0026 100644 --- a/dockers/docker-ptf/Dockerfile.j2 +++ b/dockers/docker-ptf/Dockerfile.j2 @@ -1,9 +1,10 @@ +{% set prefix = DEFAULT_CONTAINER_REGISTRY %} {% if CONFIGURED_ARCH == "armhf" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:armhf-stretch +FROM {{ prefix }}multiarch/debian-debootstrap:armhf-stretch {% elif CONFIGURED_ARCH == "arm64" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:arm64-stretch +FROM {{ prefix }}multiarch/debian-debootstrap:arm64-stretch {% else %} -FROM debian:buster +FROM {{ prefix }}debian:buster {% endif %} MAINTAINER Pavel Shirshov @@ -85,6 +86,14 @@ RUN rm -rf /debs \ && make install \ && cd .. \ && rm -fr sflowtool \ + && git clone https://github.com/dyninc/OpenBFDD.git \ + && cd OpenBFDD \ + && ./autogen.sh \ + && ./configure \ + && make \ + && make install \ + && cd .. \ + && rm -fr OpenBFDD \ && wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \ && tar xvfz 1.0.0.tar.gz \ && cd nanomsg-1.0.0 \ diff --git a/dockers/docker-router-advertiser/Dockerfile.j2 b/dockers/docker-router-advertiser/Dockerfile.j2 index 7d225cbd4e79..44e2430077cb 100644 --- a/dockers/docker-router-advertiser/Dockerfile.j2 +++ b/dockers/docker-router-advertiser/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-buster +FROM docker-config-engine-bullseye ARG docker_container_name ARG image_version @@ -15,7 +15,7 @@ ENV IMAGE_VERSION=$image_version RUN apt-get update # Install radvd Debian package -RUN apt-get -y install radvd=1:2.17-2 +RUN apt-get -y install radvd {% if docker_router_advertiser_debs.strip() -%} # Copy built Debian packages diff --git a/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf.j2 b/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf.j2 index 3be84f54fda5..22f33e412195 100644 --- a/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf.j2 +++ b/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf.j2 @@ -45,7 +45,7 @@ dependent_startup_wait_for=rsyslogd:running {%- set vlan_v6 = namespace(count=0) -%} {%- if DEVICE_METADATA.localhost.deployment_id != "8" -%} {%- if DEVICE_METADATA.localhost.type -%} - {%- if "ToRRouter" in DEVICE_METADATA.localhost.type and DEVICE_METADATA.localhost.type != "MgmtToRRouter" -%} + {%- if "ToRRouter" in DEVICE_METADATA.localhost.type or DEVICE_METADATA.localhost.type in ["EPMS", "MgmtTsToR"] -%} {%- if VLAN_INTERFACE -%} {%- for (name, prefix) in VLAN_INTERFACE|pfx_filter -%} {# If this VLAN has an IPv6 address... #} diff --git a/dockers/docker-router-advertiser/radvd.conf.j2 b/dockers/docker-router-advertiser/radvd.conf.j2 index 1d1e9e952f1c..3880ef960760 100644 --- a/dockers/docker-router-advertiser/radvd.conf.j2 +++ b/dockers/docker-router-advertiser/radvd.conf.j2 @@ -10,9 +10,21 @@ {# If our configuration has VLAN interfaces... #} {% if VLAN_INTERFACE %} -{% for (name, prefix) in VLAN_INTERFACE|pfx_filter %} -{# If this VLAN has an IPv6 address... #} +{% set vlan_list = dict() %} +{% for (name,prefix) in VLAN_INTERFACE|pfx_filter %} +{% if name is not in vlan_list and prefix | ipv6 %} +{% set prefix_list = [] %} +{% set _ = vlan_list.update({name: prefix_list}) %} +{% endif %} {% if prefix | ipv6 %} +{# If our configuration has VLAN interfaces... #} +{% set prefix_list = vlan_list.get(name) %} +{% set _ = prefix_list.append(prefix) %} +{% set _ = vlan_list.update({name: prefix_list}) %} +{% endif %} +{% endfor %} +{% endif %} +{% for name, prefixes in vlan_list.items() %} interface {{ name }} { IgnoreIfMissing on; @@ -23,6 +35,7 @@ interface {{ name }} AdvOtherConfigFlag off; AdvLinkMTU 9100; AdvHomeAgentFlag off; +{% for prefix in prefixes %} prefix {{ prefix | network }}/{{ prefix | prefixlen }} { AdvOnLink on; AdvAutonomous off; @@ -30,8 +43,7 @@ interface {{ name }} AdvValidLifetime infinity; AdvPreferredLifetime infinity; }; +{% endfor %} }; -{% endif %} {% endfor %} -{% endif %} diff --git a/dockers/docker-sflow/Dockerfile.j2 b/dockers/docker-sflow/Dockerfile.j2 index 476ff3514ace..c8d0757d5fc5 100644 --- a/dockers/docker-sflow/Dockerfile.j2 +++ b/dockers/docker-sflow/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-buster +FROM docker-swss-layer-buster ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/dockers/docker-snmp/snmpd.conf.j2 b/dockers/docker-snmp/snmpd.conf.j2 index b83fbffda025..585fb5353e5b 100644 --- a/dockers/docker-snmp/snmpd.conf.j2 +++ b/dockers/docker-snmp/snmpd.conf.j2 @@ -82,7 +82,7 @@ sysLocation {{ SNMP.LOCATION.Location }} sysLocation public {% endif %} {% if SNMP is defined and SNMP.CONTACT is defined %} -sysContact {{ SNMP.CONTACT.keys()[0] }} {{ SNMP.CONTACT.values()[0] }} +sysContact {{ SNMP.CONTACT.keys() | first }} {{ SNMP.CONTACT.values() | first }} {% else %} sysContact Azure Cloud Switch vteam {% endif %} diff --git a/dockers/docker-snmp/supervisord.conf b/dockers/docker-snmp/supervisord.conf index 06e11eb5fbed..3d11cc48eafd 100644 --- a/dockers/docker-snmp/supervisord.conf +++ b/dockers/docker-snmp/supervisord.conf @@ -40,7 +40,7 @@ dependent_startup=true dependent_startup_wait_for=rsyslogd:running [program:snmpd] -command=/usr/sbin/snmpd -f -LS4d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable,inetCidrRouteTable,ipCidrRouteTable,ip,disk_hw -p /run/snmpd.pid +command=/usr/sbin/snmpd -f -LS0-2d -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf,ifTable,ifXTable,inetCidrRouteTable,ipCidrRouteTable,ip,disk_hw -p /run/snmpd.pid priority=3 autostart=false autorestart=false diff --git a/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 b/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 index 50854949c893..937c5368483a 100644 --- a/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 @@ -15,7 +15,7 @@ RUN pip3 install connexion==2.7.0 \ certifi==2017.4.17 \ python-dateutil==2.6.0 \ six==1.11.0 \ - urllib3==1.21.1 + urllib3==1.26.5 COPY \ {% for deb in docker_sonic_mgmt_framework_debs.split(' ') -%} @@ -34,10 +34,6 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] RUN apt-get remove -y g++ python3-dev RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /debs - -## TODO: symbolic links will be removed when AAA improvements get merged -RUN ln -sf /host_etc/passwd /etc/passwd -RUN ln -sf /host_etc/group /etc/group +RUN rm -rf /debs ~/.cache ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-sonic-mgmt/Dockerfile.j2 b/dockers/docker-sonic-mgmt/Dockerfile.j2 index ccdcc168bef8..99ad9fa8fb80 100755 --- a/dockers/docker-sonic-mgmt/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt/Dockerfile.j2 @@ -1,4 +1,5 @@ -FROM ubuntu:18.04 +{% set prefix = DEFAULT_CONTAINER_REGISTRY %} +FROM {{ prefix }}ubuntu:18.04 ENV DEBIAN_FRONTEND=noninteractive @@ -21,7 +22,6 @@ RUN apt-get update && apt-get install -y build-essential \ python \ python-dev \ python-scapy \ - python-setuptools \ python-pip \ python3-pip \ python3-venv \ @@ -33,6 +33,7 @@ RUN apt-get update && apt-get install -y build-essential \ telnet \ vim +RUN pip install setuptools==44.1.1 RUN pip install cffi==1.10.0 \ contextlib2==0.6.0.post1 \ cryptography==3.3.2 \ @@ -56,6 +57,7 @@ RUN pip install cffi==1.10.0 \ psutil \ pyasn1==0.1.9 \ pyfiglet \ + lazy-object-proxy==1.6.0 \ pylint==1.8.1 \ pyro4 \ pysnmp==4.2.5 \ @@ -68,10 +70,12 @@ RUN pip install cffi==1.10.0 \ rpyc \ six \ tabulate \ + statistics \ textfsm \ virtualenv \ retry \ thrift==0.11.0 \ + allure-pytest==2.8.22 \ && git clone https://github.com/p4lang/scapy-vxlan.git \ && cd scapy-vxlan \ && python setup.py install \ @@ -89,7 +93,8 @@ RUN pip install cffi==1.10.0 \ && rm -fr nanomsg-1.0.0 \ && rm -f 1.0.0.tar.gz \ && pip install nnpy \ - && pip install dpkt + && pip install dpkt \ + && pip install scapy==2.4.5 --upgrade # Install docker-ce-cli RUN apt-get update \ @@ -174,12 +179,74 @@ RUN python -m virtualenv --system-site-packages env-201811 RUN env-201811/bin/pip install cryptography==3.3.2 ansible==2.0.0.2 RUN python3 -m venv env-python3 -RUN env-python3/bin/pip3 install cryptography==3.3.2 azure-kusto-data azure-kusto-ingest defusedxml pytest aiohttp # NOTE: There is an ordering dependency for pycryptodome. Leaving this at # the end until we figure that out. RUN pip install pycryptodome==3.9.8 -# Install allure-pytest library -RUN pip install --upgrade setuptools \ - && pip install allure-pytest==2.8.22 +# Activating a virtualenv. The virtualenv automatically works for RUN, ENV and CMD. +ENV VIRTUAL_ENV=env-python3 +ARG BACKUP_OF_PATH="$PATH" +ENV PATH="$VIRTUAL_ENV/bin:$PATH" + +ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 PYTHONIOENCODING=UTF-8 + +RUN python3 -m pip install --upgrade --ignore-installed pip setuptools==58.4.0 + +RUN python3 -m pip install setuptools-rust \ + aiohttp \ + defusedxml \ + azure-kusto-ingest \ + azure-kusto-data \ + cffi \ + contextlib2==0.6.0.post1 \ + cryptography==3.3.2 \ + "future>=0.16.0" \ + gitpython \ + ipaddr \ + ipython==5.4.1 \ + ixnetwork-restpy==1.0.64 \ + ixnetwork-open-traffic-generator==0.0.79 \ + snappi[ixnetwork,convergence]==0.5.11 \ + jinja2==2.7.2 \ + jsonpatch \ + lxml \ + natsort \ + netaddr \ + netmiko==2.4.2 \ + paramiko==2.7.1 \ + passlib \ + pexpect \ + prettytable \ + psutil \ + pyasn1==0.4.8 \ + pyfiglet \ + pylint==1.8.1 \ + pyro4 \ + pysnmp==4.4.12 \ + pytest-repeat \ + pytest-html \ + pytest-xdist==1.28.0 \ + pytest \ + redis \ + requests \ + rpyc \ + six \ + tabulate \ + textfsm \ + virtualenv \ + wheel==0.33.6 \ + pysubnettree \ + nnpy \ + dpkt \ + pycryptodome==3.9.8 \ + ansible==2.8.12 \ + pytest-ansible \ + allure-pytest==2.8.22 \ + retry \ + thrift==0.11.0 \ + ptf \ + scapy==2.4.5 + +# Deactivating a virtualenv. +ENV PATH="$BACKUP_OF_PATH" diff --git a/dockers/docker-sonic-p4rt/Dockerfile.j2 b/dockers/docker-sonic-p4rt/Dockerfile.j2 new file mode 100644 index 000000000000..8708518340c8 --- /dev/null +++ b/dockers/docker-sonic-p4rt/Dockerfile.j2 @@ -0,0 +1,31 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} +FROM docker-config-engine-bullseye + +ARG docker_container_name +ARG git_commit +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +{% if docker_sonic_p4rt_debs.strip() -%} +# Copy locally-built Debian package dependencies +{{ copy_files("debs/", docker_sonic_p4rt_debs.split(' '), "/debs/") }} + +# Install locally-built Debian packages and implicitly install their dependencies +{{ install_debian_packages(docker_sonic_p4rt_debs.split(' ')) }} +{%- endif %} + +RUN apt-get clean -y && \ + apt-get autoclean -y && \ + apt-get autoremove -y && \ + rm -rf /debs + +COPY ["start.sh", "p4rt.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] +COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] +COPY ["critical_processes", "/etc/supervisor"] + +ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-sonic-p4rt/critical_processes b/dockers/docker-sonic-p4rt/critical_processes new file mode 100644 index 000000000000..7d1daa799df9 --- /dev/null +++ b/dockers/docker-sonic-p4rt/critical_processes @@ -0,0 +1 @@ +program:p4rt diff --git a/dockers/docker-sonic-p4rt/p4rt.sh b/dockers/docker-sonic-p4rt/p4rt.sh new file mode 100755 index 000000000000..fa9e17f2fca4 --- /dev/null +++ b/dockers/docker-sonic-p4rt/p4rt.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +P4RT_ARGS=" --alsologtostderr --logbuflevel=-1" + +exec /usr/local/bin/p4rt ${P4RT_ARGS} diff --git a/dockers/docker-sonic-p4rt/start.sh b/dockers/docker-sonic-p4rt/start.sh new file mode 100755 index 000000000000..d6722a27fc77 --- /dev/null +++ b/dockers/docker-sonic-p4rt/start.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +mkdir -p /var/sonic +echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status diff --git a/dockers/docker-sonic-p4rt/supervisord.conf b/dockers/docker-sonic-p4rt/supervisord.conf new file mode 100644 index 000000000000..f9383e2adf96 --- /dev/null +++ b/dockers/docker-sonic-p4rt/supervisord.conf @@ -0,0 +1,49 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[eventlistener:dependent-startup] +command=python3 -m supervisord_dependent_startup +autostart=true +autorestart=unexpected +startretries=0 +exitcodes=0,3 +events=PROCESS_STATE +buffer_size=50 + +[eventlistener:supervisor-proc-exit-listener] +command=/usr/bin/supervisor-proc-exit-listener --container-name p4rt +events=PROCESS_STATE_EXITED +autostart=true +autorestart=unexpected + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n -iNONE +priority=1 +autostart=false +autorestart=unexpected +stdout_logfile=syslog +stderr_logfile=syslog +dependent_startup=true + +[program:start] +command=/usr/bin/start.sh +priority=2 +autostart=true +autorestart=false +startsecs=0 +stdout_logfile=syslog +stderr_logfile=syslog +dependent_startup=true +dependent_startup_wait_for=rsyslogd:running + +[program:p4rt] +command=/usr/bin/p4rt.sh +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog +dependent_startup=true +dependent_startup_wait_for=start:exited diff --git a/dockers/docker-sonic-restapi/Dockerfile.j2 b/dockers/docker-sonic-restapi/Dockerfile.j2 index 837796e66d82..43bc86ee6b68 100644 --- a/dockers/docker-sonic-restapi/Dockerfile.j2 +++ b/dockers/docker-sonic-restapi/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-stretch +FROM docker-config-engine-bullseye ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/dockers/docker-sonic-restapi/supervisord.conf b/dockers/docker-sonic-restapi/supervisord.conf index a873ba03d7da..c95b4b6b92d8 100644 --- a/dockers/docker-sonic-restapi/supervisord.conf +++ b/dockers/docker-sonic-restapi/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 @@ -13,7 +13,7 @@ events=PROCESS_STATE buffer_size=1024 [eventlistener:supervisor-proc-exit-listener] -command=python2 /usr/bin/supervisor-proc-exit-listener --container-name restapi +command=/usr/bin/supervisor-proc-exit-listener --container-name restapi events=PROCESS_STATE_EXITED,PROCESS_STATE_RUNNING autostart=true autorestart=false diff --git a/dockers/docker-sonic-telemetry/Dockerfile.j2 b/dockers/docker-sonic-telemetry/Dockerfile.j2 index 88ff94318208..a7a45ab48c22 100644 --- a/dockers/docker-sonic-telemetry/Dockerfile.j2 +++ b/dockers/docker-sonic-telemetry/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-buster +FROM docker-config-engine-bullseye ARG docker_container_name ARG image_version diff --git a/dockers/docker-swss-layer-buster/Dockerfile.j2 b/dockers/docker-swss-layer-buster/Dockerfile.j2 new file mode 100644 index 000000000000..e8dcb9472a26 --- /dev/null +++ b/dockers/docker-swss-layer-buster/Dockerfile.j2 @@ -0,0 +1,22 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} +FROM docker-config-engine-buster + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +{% if docker_swss_layer_buster_debs.strip() -%} +# Copy locally-built Debian package dependencies +{{ copy_files("debs/", docker_swss_layer_buster_debs.split(' '), "/debs/") }} + +# Install locally-built Debian packages and implicitly install their dependencies +{{ install_debian_packages(docker_swss_layer_buster_debs.split(' ')) }} +{%- endif %} + +RUN apt-get clean -y && \ + apt-get autoclean -y && \ + apt-get autoremove -y && \ + rm -rf /debs + +ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index 7f4db2936857..e02000abb1c6 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-buster +FROM docker-swss-layer-buster ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index efbd3d4e8c97..7306c36cfc0c 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -351,7 +351,12 @@ extract_image() { unzip -oq "$swipath" -x boot0 "$dockerfs" -d "$image_path" ## detect rootfs type - rootfs_type=`grep " $target_path " /proc/mounts | cut -d' ' -f3` + local mountstr="$(grep " $target_path " /proc/mounts)" + local rootdev="$(echo $mountstr | cut -f1 -d' ')" + rootfs_type="$(echo $mountstr | cut -d' ' -f3)" + + ## Don't reserve any blocks just for root + tune2fs -m 0 -r 0 $rootdev info "Extracting $dockerfs from swi" ## Unpacking dockerfs delayed @@ -507,6 +512,10 @@ write_platform_specific_cmdline() { flash_size=28000 cmdline_add hugepages=128 fi + if [ "$sid" = "Woodleaf" ]; then + aboot_machine=arista_7170b_64c + cmdline_add hugepages=128 + fi if [ "$sid" = "Lodoga" ]; then aboot_machine=arista_7050cx3_32s fi diff --git a/files/apt/sources.list.amd64 b/files/apt/sources.list.amd64 index 45902be1078c..fb0a1e994932 100644 --- a/files/apt/sources.list.amd64 +++ b/files/apt/sources.list.amd64 @@ -1,13 +1,13 @@ ## Debian mirror on Microsoft Azure ## Ref: http://debian-archive.trafficmanager.net/ -deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ buster main contrib non-free -deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian/ buster main contrib non-free -deb [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ buster/updates main contrib non-free -deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ buster/updates main contrib non-free -deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ buster-backports main contrib non-free -deb [arch=amd64] http://packages.trafficmanager.net/debian/debian buster main contrib non-free -deb-src [arch=amd64] http://packages.trafficmanager.net/debian/debian buster main contrib non-free -deb [arch=amd64] http://packages.trafficmanager.net/debian/debian-security/ buster_updates main contrib non-free -deb-src [arch=amd64] http://packages.trafficmanager.net/debian/debian-security/ buster_updates main contrib non-free -deb [arch=amd64] http://packages.trafficmanager.net/debian/debian buster-backports main contrib non-free +deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ bullseye main contrib non-free +deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian/ bullseye main contrib non-free +deb [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ bullseye-security main contrib non-free +deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ bullseye-security main contrib non-free +deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ bullseye-backports main contrib non-free +deb [arch=amd64] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free +deb-src [arch=amd64] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free +deb [arch=amd64] http://packages.trafficmanager.net/debian/debian-security/ bullseye-security main contrib non-free +deb-src [arch=amd64] http://packages.trafficmanager.net/debian/debian-security/ bullseye-security main contrib non-free +deb [arch=amd64] http://packages.trafficmanager.net/debian/debian bullseye-backports main contrib non-free diff --git a/files/apt/sources.list.arm64 b/files/apt/sources.list.arm64 index 58b84978d023..75bebe1a91d1 100644 --- a/files/apt/sources.list.arm64 +++ b/files/apt/sources.list.arm64 @@ -1,13 +1,13 @@ ## Debian mirror for ARM ## Not the repo mirror site can change in future, and needs to be updated to be in sync -deb [arch=arm64] http://deb.debian.org/debian buster main contrib non-free -deb-src [arch=arm64] http://deb.debian.org/debian buster main contrib non-free -deb [arch=arm64] http://deb.debian.org/debian buster-updates main contrib non-free -deb-src [arch=arm64] http://deb.debian.org/debian buster-updates main contrib non-free -deb [arch=arm64] http://ftp.debian.org/debian buster-backports main -deb [arch=arm64] http://packages.trafficmanager.net/debian/debian buster main contrib non-free -deb-src [arch=arm64] http://packages.trafficmanager.net/debian/debian buster main contrib non-free -deb [arch=arm64] http://packages.trafficmanager.net/debian/debian buster-updates main contrib non-free -deb-src [arch=arm64] http://packages.trafficmanager.net/debian/debian buster-updates main contrib non-free -deb [arch=arm64] http://packages.trafficmanager.net/debian/debian buster-backports main +deb [arch=arm64] http://debian-archive.trafficmanager.net/debian/ bullseye main contrib non-free +deb-src [arch=arm64] http://debian-archive.trafficmanager.net/debian/ bullseye main contrib non-free +deb [arch=arm64] http://debian-archive.trafficmanager.net/debian-security/ bullseye-security main contrib non-free +deb-src [arch=arm64] http://debian-archive.trafficmanager.net/debian-security/ bullseye-security main contrib non-free +deb [arch=arm64] http://debian-archive.trafficmanager.net/debian/ bullseye-backports main contrib non-free +deb [arch=arm64] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free +deb-src [arch=arm64] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free +deb [arch=arm64] http://packages.trafficmanager.net/debian/debian-security/ bullseye-security main contrib non-free +deb-src [arch=arm64] http://packages.trafficmanager.net/debian/debian-security/ bullseye-security main contrib non-free +deb [arch=arm64] http://packages.trafficmanager.net/debian/debian bullseye-backports main contrib non-free diff --git a/files/apt/sources.list.armhf b/files/apt/sources.list.armhf index eb6fe3be6889..4f9d4d0a9020 100644 --- a/files/apt/sources.list.armhf +++ b/files/apt/sources.list.armhf @@ -1,13 +1,18 @@ ## Debian mirror for ARM ## Not the repo mirror site can change in future, and needs to be updated to be in sync -deb [arch=armhf] http://deb.debian.org/debian buster main contrib non-free -deb-src [arch=armhf] http://deb.debian.org/debian buster main contrib non-free -deb [arch=armhf] http://deb.debian.org/debian buster-updates main contrib non-free -deb-src [arch=armhf] http://deb.debian.org/debian buster-updates main contrib non-free -deb [arch=armhf] http://ftp.debian.org/debian buster-backports main -deb [arch=armhf] http://packages.trafficmanager.net/debian/debian buster main contrib non-free -deb-src [arch=armhf] http://packages.trafficmanager.net/debian/debian buster main contrib non-free -deb [arch=armhf] http://packages.trafficmanager.net/debian/debian buster-updates main contrib non-free -deb-src [arch=armhf] http://packages.trafficmanager.net/debian/debian buster-updates main contrib non-free -deb [arch=armhf] http://packages.trafficmanager.net/debian/debian buster-backports main +deb [arch=armhf] http://deb.debian.org/debian bullseye main contrib non-free +deb-src [arch=armhf] http://deb.debian.org/debian bullseye main contrib non-free +deb [arch=armhf] http://security.debian.org bullseye-security main contrib non-free +deb-src [arch=armhf] http://security.debian.org bullseye-security main contrib non-free +deb [arch=armhf] http://deb.debian.org/debian bullseye-backports main contrib non-free +#deb [arch=armhf] http://debian-archive.trafficmanager.net/debian/ bullseye main contrib non-free +#deb-src [arch=armhf] http://debian-archive.trafficmanager.net/debian/ bullseye main contrib non-free +#deb [arch=armhf] http://debian-archive.trafficmanager.net/debian-security/ bullseye-security main contrib non-free +#deb-src [arch=armhf] http://debian-archive.trafficmanager.net/debian-security/ bullseye-security main contrib non-free +#deb [arch=armhf] http://debian-archive.trafficmanager.net/debian/ bullseye-backports main contrib non-free +deb [arch=armhf] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free +deb-src [arch=armhf] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free +deb [arch=armhf] http://packages.trafficmanager.net/debian/debian-security/ bullseye-security main contrib non-free +deb-src [arch=armhf] http://packages.trafficmanager.net/debian/debian-security/ bullseye-security main contrib non-free +deb [arch=armhf] http://packages.trafficmanager.net/debian/debian bullseye-backports main contrib non-free diff --git a/files/build_templates/buffers_config.j2 b/files/build_templates/buffers_config.j2 index 1e551becd4d5..a67316af5f3d 100644 --- a/files/build_templates/buffers_config.j2 +++ b/files/build_templates/buffers_config.j2 @@ -96,20 +96,30 @@ def {%- set PORT_ALL = [] %} {%- if PORT is not defined %} - {%- if defs.generate_port_lists(PORT_ALL) %} {% endif %} + {%- if defs.generate_port_lists is defined %} + {%- if defs.generate_port_lists(PORT_ALL) %} {% endif %} + {%- endif %} {%- else %} {%- for port in PORT %} - {%- if PORT_ALL.append(port) %}{%- endif %} + {%- if not port.startswith('Ethernet-Rec') and not port.startswith('Ethernet-IB') %} + {%- if PORT_ALL.append(port) %}{%- endif %} + {%- endif %} {%- endfor %} {%- endif %} {%- set PORT_ACTIVE = [] %} +{%- set PORT_INACTIVE = [] %} {%- if DEVICE_NEIGHBOR is not defined %} {%- set PORT_ACTIVE = PORT_ALL %} {%- else %} {%- for port in DEVICE_NEIGHBOR.keys() %} {%- if PORT_ACTIVE.append(port) %}{%- endif %} {%- endfor %} + {%- for port in PORT_ALL %} + {%- if port not in DEVICE_NEIGHBOR.keys() %} + {%- if PORT_INACTIVE.append(port) %}{%- endif %} + {%- endif %} + {%- endfor %} {%- endif %} {%- set port_names_list_active = [] %} @@ -118,6 +128,11 @@ def {%- endfor %} {%- set port_names_active = port_names_list_active | join(',') %} +{%- set port_names_list_inactive = [] %} +{%- for port in PORT_INACTIVE %} + {%- if port_names_list_inactive.append(port) %}{%- endif %} +{%- endfor %} +{%- set port_names_inactive = port_names_list_inactive | join(',') %} { "CABLE_LENGTH": { "AZURE": { @@ -131,14 +146,22 @@ def {% if defs.generate_buffer_pool_and_profiles is defined %} {{ defs.generate_buffer_pool_and_profiles() }} +{% elif defs.generate_buffer_pool_and_profiles_with_inactive_ports is defined %} +{{ defs.generate_buffer_pool_and_profiles_with_inactive_ports(port_names_inactive) }} {% endif %} + +{%- if port_names_active|length > 0 or port_names_inactive|length > 0 -%} {%- if defs.generate_profile_lists is defined %} {{ defs.generate_profile_lists(port_names_active) }}, +{% elif defs.generate_profile_lists_with_inactive_ports is defined %} +{{ defs.generate_profile_lists_with_inactive_ports(port_names_active, port_names_inactive) }}, {% endif %} {%- if defs.generate_pg_profils is defined %} {{ defs.generate_pg_profils(port_names_active) }} +{% elif defs.generate_pg_profiles_with_inactive_ports is defined %} +{{ defs.generate_pg_profiles_with_inactive_ports(port_names_active, port_names_inactive) }}, {% else %} "BUFFER_PG": { {% for port in PORT_ACTIVE %} @@ -157,6 +180,8 @@ def {% if defs.generate_queue_buffers is defined %} {{ defs.generate_queue_buffers(port_names_active) }} +{% elif defs.generate_queue_buffers_with_inactive_ports is defined %} +{{ defs.generate_queue_buffers_with_inactive_ports(port_names_active, port_names_inactive) }} {% else %} "BUFFER_QUEUE": { {% for port in PORT_ACTIVE %} @@ -177,8 +202,11 @@ def {% endfor %} } {% endif %} -{% if dynamic_mode is defined %} +{%- if dynamic_mode is defined -%} , +{%- endif -%} +{%- endif -%} +{% if dynamic_mode is defined %} "DEFAULT_LOSSLESS_BUFFER_PARAMETER": { "AZURE": { "default_dynamic_th": "0" diff --git a/files/build_templates/cbf_config.j2 b/files/build_templates/cbf_config.j2 new file mode 100644 index 000000000000..ff465f1ca29d --- /dev/null +++ b/files/build_templates/cbf_config.j2 @@ -0,0 +1,82 @@ +{ + "DSCP_TO_FC_MAP": { + "AZURE": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "2", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "1", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "6", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + } + }, + "EXP_TO_FC_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + } +} diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 99192b4458bd..b139eb570b3a 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -36,8 +36,11 @@ function updateSyslogConf() TARGET_IP=$(docker network inspect bridge --format={{ "'{{(index .IPAM.Config 0).Gateway}}'" }}) CONTAINER_NAME="$DOCKERNAME" TMP_FILE="/tmp/rsyslog.$CONTAINER_NAME.conf" - + {%- if docker_container_name == "database" %} + python -c "import jinja2, os; paths=['/usr/share/sonic/templates']; loader = jinja2.FileSystemLoader(paths); env = jinja2.Environment(loader=loader, trim_blocks=True); template_file='/usr/share/sonic/templates/rsyslog-container.conf.j2'; template = env.get_template(os.path.basename(template_file)); data=template.render({\"target_ip\":\"$TARGET_IP\",\"container_name\":\"$CONTAINER_NAME\"}); print(data)" > $TMP_FILE + {%- else %} sonic-cfggen -t /usr/share/sonic/templates/rsyslog-container.conf.j2 -a "{\"target_ip\": \"$TARGET_IP\", \"container_name\": \"$CONTAINER_NAME\" }" > $TMP_FILE + {%- endif %} docker cp $TMP_FILE ${DOCKERNAME}:/etc/rsyslog.conf rm -rf $TMP_FILE fi @@ -57,7 +60,7 @@ function ebtables_config() function getMountPoint() { - echo $1 | python -c "import sys, json, os; mnts = [x for x in json.load(sys.stdin)[0]['Mounts'] if x['Destination'] == '/usr/share/sonic/hwsku']; print '' if len(mnts) == 0 else os.path.abspath(mnts[0]['Source'])" 2>/dev/null + echo $1 | python -c "import sys, json, os; mnts = [x for x in json.load(sys.stdin)[0]['Mounts'] if x['Destination'] == '/usr/share/sonic/hwsku']; print('' if len(mnts) == 0 else os.path.abspath(mnts[0]['Source']))" 2>/dev/null } function getBootType() @@ -196,6 +199,7 @@ function postStartAction() test -e /host/fast-reboot/fdb.json && docker cp /host/fast-reboot/fdb.json swss$DEV:/ test -e /host/fast-reboot/arp.json && docker cp /host/fast-reboot/arp.json swss$DEV:/ test -e /host/fast-reboot/default_routes.json && docker cp /host/fast-reboot/default_routes.json swss$DEV:/ + test -e /host/fast-reboot/media_config.json && docker cp /host/fast-reboot/media_config.json swss$DEV:/ rm -fr /host/fast-reboot fi docker exec swss$DEV touch /ready # signal swssconfig.sh to go @@ -295,6 +299,13 @@ start() { if [ ! -f /etc/sonic/peripheral_table.json ] && [ -f /usr/share/sonic/device/$PLATFORM/port_peripheral_config.j2 ]; then sonic-cfggen -d -t /usr/share/sonic/device/$PLATFORM/port_peripheral_config.j2 > /etc/sonic/peripheral_table.json fi + if [ ! -f /etc/sonic/zero_profiles.json ] && [ -f /usr/share/sonic/templates/zero_profiles.j2 ]; then + sonic-cfggen -d -t /usr/share/sonic/device/$PLATFORM/zero_profiles.j2 > /etc/sonic/zero_profiles.json + fi + + {%- if enable_asan == "y" %} + mkdir -p /var/log/asan + {%- endif %} {%- endif %} # In Multi ASIC platforms the global database config file database_global.json will exist. @@ -361,6 +372,7 @@ start() { fi {%- if docker_container_name == "database" %} + NET="bridge" DB_OPT=$DB_OPT" -v /var/run/redis$DEV:/var/run/redis:rw " {%- else %} NET="container:database$DEV" @@ -417,6 +429,9 @@ start() { {%- endif %} {%- if docker_container_name == "swss" %} -e ASIC_VENDOR={{ sonic_asic_platform }} \ +{%- if enable_asan == "y" %} + -v /var/log/asan/:/var/log/asan \ +{%- endif -%} {%- endif -%} {%- if docker_container_name == "bgp" %} -v /etc/sonic/frr/$DEV:/etc/frr:rw \ @@ -478,6 +493,8 @@ stop() { {%- elif docker_container_name == "teamd" %} # Longer timeout of 60 sec to wait for Portchannels to be cleaned. /usr/local/bin/container stop -t 60 $DOCKERNAME + {%- elif docker_container_name == "swss" and enable_asan == "y" %} + /usr/local/bin/container stop -t 60 $DOCKERNAME {%- else %} /usr/local/bin/container stop $DOCKERNAME {%- endif %} diff --git a/files/build_templates/gbsyncd-credo.service.j2 b/files/build_templates/gbsyncd-credo.service.j2 deleted file mode 120000 index 69f613b0d892..000000000000 --- a/files/build_templates/gbsyncd-credo.service.j2 +++ /dev/null @@ -1 +0,0 @@ -gbsyncd.service.j2 \ No newline at end of file diff --git a/files/build_templates/gbsyncd.service.j2 b/files/build_templates/gbsyncd.service.j2 deleted file mode 100644 index 732d9c893367..000000000000 --- a/files/build_templates/gbsyncd.service.j2 +++ /dev/null @@ -1,22 +0,0 @@ -[Unit] -Description={{docker_container_name}} service -Requires=database.service updategraph.service -ConditionPathExists=!/usr/share/sonic/hwsku/gearbox_config.json -After=database.service updategraph.service -After=interfaces-config.service -After=swss.service -BindsTo=sonic.target -After=sonic.target -Before=ntp-config.service - -[Service] -User=root -Environment=sonic_asic_platform={{ sonic_asic_platform }} -Environment=gbsyncd_platform={{ docker_container_name }} -ExecCondition=/usr/bin/gbsyncd-platform.sh -ExecStartPre=/usr/local/bin/gbsyncd.sh start -ExecStart=/usr/local/bin/gbsyncd.sh wait -ExecStop=/usr/local/bin/gbsyncd.sh stop - -[Install] -WantedBy=sonic.target diff --git a/files/build_templates/init_cfg.json.j2 b/files/build_templates/init_cfg.json.j2 index 6e0d75518f60..e1320214e02c 100644 --- a/files/build_templates/init_cfg.json.j2 +++ b/files/build_templates/init_cfg.json.j2 @@ -2,6 +2,7 @@ "DEVICE_METADATA": { "localhost": { "buffer_model": {% if default_buffer_model == "dynamic" %}"dynamic"{% else %}"traditional"{% endif %}, + {%- if include_p4rt == "y" %}"synchronous_mode":"enable",{% endif %} "default_bgp_status": {% if shutdown_bgp_on_start == "y" %}"down"{% else %}"up"{% endif %}, "default_pfcwd_status": {% if enable_pfcwd_on_start == "y" %}"enable"{% else %}"disable"{% endif %} } @@ -19,6 +20,13 @@ {% endfor %} } }, + "FLEX_COUNTER_TABLE": { + "ACL": { + "FLEX_COUNTER_STATUS": "enable", + "FLEX_COUNTER_DELAY_STATUS": "true", + "POLL_INTERVAL": "10000" + } + }, {%- set features = [("bgp", "enabled", false, "enabled"), ("database", "always_enabled", false, "always_enabled"), ("lldp", "enabled", false, "enabled"), @@ -32,7 +40,9 @@ {%- if sonic_asic_platform == "vs" %}{% do features.append(("gbsyncd", "enabled", false, "enabled")) %}{% endif %} {%- if include_iccpd == "y" %}{% do features.append(("iccpd", "disabled", false, "enabled")) %}{% endif %} {%- if include_mgmt_framework == "y" %}{% do features.append(("mgmt-framework", "enabled", true, "enabled")) %}{% endif %} +{%- if include_mux == "y" %}{% do features.append(("mux", "{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %}enabled{% else %}always_disabled{% endif %}", false, "enabled")) %}{% endif %} {%- if include_nat == "y" %}{% do features.append(("nat", "disabled", false, "enabled")) %}{% endif %} +{%- if include_p4rt == "y" %}{% do features.append(("p4rt", "enabled", false, "enabled")) %}{% endif %} {%- if include_restapi == "y" %}{% do features.append(("restapi", "enabled", false, "enabled")) %}{% endif %} {%- if include_sflow == "y" %}{% do features.append(("sflow", "disabled", false, "enabled")) %}{% endif %} {%- if include_macsec == "y" %}{% do features.append(("macsec", "disabled", false, "enabled")) %}{% endif %} @@ -53,5 +63,26 @@ "high_mem_alert": "disabled" }{% if not loop.last %},{% endif -%} {% endfor %} + }, + "AUTO_TECHSUPPORT": { + "GLOBAL": { +{%- if enable_auto_tech_support == "y" %} + "state" : "enabled", {% else %} + "state" : "disabled", {% endif %} + "rate_limit_interval" : "180", + "max_techsupport_limit" : "10.0", + "max_core_limit" : "5.0", + "since" : "2 days ago" + } + }, + "AUTO_TECHSUPPORT_FEATURE": { +{%- for feature, _, _, _ in features %} + "{{feature}}": { +{%- if enable_auto_tech_support == "y" %} + "state" : "enabled", {% else %} + "state" : "disabled", {% endif %} + "rate_limit_interval" : "600" + }{%if not loop.last %},{% endif -%} +{% endfor %} } } diff --git a/files/build_templates/macsec.service.j2 b/files/build_templates/macsec.service.j2 deleted file mode 100644 index b8ffbafcbd2c..000000000000 --- a/files/build_templates/macsec.service.j2 +++ /dev/null @@ -1,19 +0,0 @@ -[Unit] -Description=MACsec container -Requires=swss.service -After=swss.service syncd.service -BindsTo=sonic.target -After=sonic.target -StartLimitIntervalSec=1200 -StartLimitBurst=3 - -[Service] -User=root -ExecStartPre=/usr/bin/macsec.sh start -ExecStart=/usr/bin/macsec.sh wait -ExecStop=/usr/bin/macsec.sh stop -Restart=always -RestartSec=30 - -[Install] -WantedBy=sonic.target \ No newline at end of file diff --git a/files/build_templates/manifest.json.j2 b/files/build_templates/manifest.json.j2 index 431b2dd22432..dff92ac21634 100644 --- a/files/build_templates/manifest.json.j2 +++ b/files/build_templates/manifest.json.j2 @@ -1,3 +1,11 @@ +{%- if version_suffix %} +{#- append build metadata suffix to the version #} +{%- if '+' in version %} +{%- set version = version + '.' + version_suffix %} +{%- else %} +{%- set version = version + '+' + version_suffix %} +{%- endif %} +{%- endif %} { "version": "1.0.0", "package": { diff --git a/files/build_templates/mux.service.j2 b/files/build_templates/mux.service.j2 new file mode 100644 index 000000000000..abc04ab30d18 --- /dev/null +++ b/files/build_templates/mux.service.j2 @@ -0,0 +1,22 @@ +[Unit] +Description=MUX Cable Container +Requires=database.service updategraph.service swss.service +After=swss.service +BindsTo=sonic.target +After=sonic.target +StartLimitIntervalSec=1200 +StartLimitBurst=3 + +[Service] +User={{ sonicadmin_user }} +ExecStartPre=/usr/local/bin/write_standby.py +ExecStartPre=/usr/local/bin/mark_dhcp_packet.py +ExecStartPre=/usr/bin/{{docker_container_name}}.sh start +ExecStart=/usr/bin/{{docker_container_name}}.sh wait +ExecStop=/usr/bin/{{docker_container_name}}.sh stop +ExecStopPost=/usr/local/bin/write_standby.py +Restart=always +RestartSec=30 + +[Install] +WantedBy=sonic.target diff --git a/files/build_templates/p4rt.service.j2 b/files/build_templates/p4rt.service.j2 new file mode 100644 index 000000000000..b4adce5332d1 --- /dev/null +++ b/files/build_templates/p4rt.service.j2 @@ -0,0 +1,20 @@ +[Unit] +Description=P4RT App container +Requires=database.service +After=database.service swss.service +BindsTo=sonic.target +After=sonic.target +Before=ntp-config.service +StartLimitIntervalSec=1200 +StartLimitBurst=3 + +[Service] +User={{ sonicadmin_user }} +ExecStartPre=/usr/bin/{{docker_container_name}}.sh start +ExecStart=/usr/bin/{{docker_container_name}}.sh wait +ExecStop=/usr/bin/{{docker_container_name}}.sh stop +Restart=always +RestartSec=30 + +[Install] +WantedBy=sonic.target diff --git a/files/build_templates/per_namespace/bgp.service.j2 b/files/build_templates/per_namespace/bgp.service.j2 index b44902c5d0c8..5ef30a164f69 100644 --- a/files/build_templates/per_namespace/bgp.service.j2 +++ b/files/build_templates/per_namespace/bgp.service.j2 @@ -15,6 +15,7 @@ User={{ sonicadmin_user }} ExecStartPre=/usr/local/bin/{{docker_container_name}}.sh start{% if multi_instance == 'true' %} %i{% endif %} ExecStart=/usr/local/bin/{{docker_container_name}}.sh wait{% if multi_instance == 'true' %} %i{% endif %} ExecStop=/usr/local/bin/{{docker_container_name}}.sh stop{% if multi_instance == 'true' %} %i{% endif %} +ExecStopPost=/usr/local/bin/write_standby.py RestartSec=30 diff --git a/files/build_templates/per_namespace/gbsyncd.service.j2 b/files/build_templates/per_namespace/gbsyncd.service.j2 new file mode 100644 index 000000000000..90a92b7e8506 --- /dev/null +++ b/files/build_templates/per_namespace/gbsyncd.service.j2 @@ -0,0 +1,22 @@ +[Unit] +Description={{docker_container_name}} service +Requires=database{% if multi_instance == 'true' %}@%i{% endif %}.service updategraph.service +ConditionPathExists=!/usr/share/sonic/hwsku/gearbox_config.json +After=database{% if multi_instance == 'true' %}@%i{% endif %}.service updategraph.service +After=interfaces-config.service +After=swss{% if multi_instance == 'true' %}@%i{% endif %}.service +BindsTo=sonic.target +After=sonic.target +Before=ntp-config.service + +[Service] +User=root +Environment=sonic_asic_platform={{ sonic_asic_platform }} +Environment=gbsyncd_platform={{ docker_container_name }} +ExecCondition=/usr/bin/gbsyncd-platform.sh +ExecStartPre=/usr/local/bin/gbsyncd.sh start{% if multi_instance == 'true' %} %i{% endif %} +ExecStart=/usr/local/bin/gbsyncd.sh wait{% if multi_instance == 'true' %} %i{% endif %} +ExecStop=/usr/local/bin/gbsyncd.sh stop{% if multi_instance == 'true' %} %i{% endif %} + +[Install] +WantedBy=sonic.target diff --git a/files/build_templates/per_namespace/macsec.service.j2 b/files/build_templates/per_namespace/macsec.service.j2 new file mode 100644 index 000000000000..fc862241f33f --- /dev/null +++ b/files/build_templates/per_namespace/macsec.service.j2 @@ -0,0 +1,20 @@ +[Unit] +Description=MACsec container +Requires=swss{% if multi_instance == 'true' %}@%i{% endif %}.service +After=swss{% if multi_instance == 'true' %}@%i{% endif %}.service +After=syncd{% if multi_instance == 'true' %}@%i{% endif %}.service +BindsTo=sonic.target +After=sonic.target +StartLimitIntervalSec=1200 +StartLimitBurst=3 + +[Service] +User={{ sonicadmin_user }} +ExecStartPre=/usr/bin/{{docker_container_name}}.sh start{% if multi_instance == 'true' %} %i{% endif %} +ExecStart=/usr/bin/{{docker_container_name}}.sh wait{% if multi_instance == 'true' %} %i{% endif %} +ExecStop=/usr/bin/{{docker_container_name}}.sh stop{% if multi_instance == 'true' %} %i{% endif %} +Restart=always +RestartSec=30 + +[Install] +WantedBy=sonic.target diff --git a/files/build_templates/qos_config.j2 b/files/build_templates/qos_config.j2 index cdfb721a45e3..9df061283034 100644 --- a/files/build_templates/qos_config.j2 +++ b/files/build_templates/qos_config.j2 @@ -1,6 +1,8 @@ {%- set PORT_ALL = [] %} {%- for port in PORT %} - {%- if PORT_ALL.append(port) %}{% endif %} + {%- if not port.startswith('Ethernet-Rec') and not port.startswith('Ethernet-IB') %} + {%- if PORT_ALL.append(port) %}{% endif %} + {%- endif %} {%- endfor %} {%- if PORT_ALL | sort_by_port_index %}{% endif %} @@ -27,9 +29,17 @@ {%- endfor %} {%- set port_names_active = port_names_list_active | join(',') -%} +{%- set port_names_list_extra_queues = [] %} +{%- for port in PORT_ACTIVE %} + {% if (generate_dscp_to_tc_map is defined) and ('type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'LeafRouter' and DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR[port].name in DEVICE_NEIGHBOR_METADATA and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[port].name].type == 'ToRRouter') or + ('subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' and DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR[port].name in DEVICE_NEIGHBOR_METADATA and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[port].name].type == 'LeafRouter') %} + {%- if port_names_list_extra_queues.append(port) %}{%- endif %} + {% endif %} +{%- endfor %} {%- set pfc_to_pg_map_supported_asics = ['mellanox', 'barefoot', 'marvell'] -%} {%- set backend_device_types = ['BackEndToRRouter', 'BackEndLeafRouter'] -%} +{%- set apollo_resource_types = ['DL-NPU-Apollo'] -%} { @@ -61,6 +71,9 @@ "7": "7" } }, +{% if generate_tc_to_queue_map is defined %} + {{- generate_tc_to_queue_map() }} +{% else %} "TC_TO_QUEUE_MAP": { "AZURE": { "0": "0", @@ -73,6 +86,7 @@ "7": "7" } }, +{% endif %} {% if 'type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] in backend_device_types and 'storage_device' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['storage_device'] == 'true' %} "DOT1P_TO_TC_MAP": { "AZURE": { @@ -86,6 +100,8 @@ "7": "7" } }, +{% elif generate_dscp_to_tc_map is defined %} + {{- generate_dscp_to_tc_map() }} {% else %} "DSCP_TO_TC_MAP": { "AZURE": { @@ -156,6 +172,22 @@ } }, {% endif %} +{% if 'resource_type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['resource_type'] in apollo_resource_types %} + "SCHEDULER": { + "scheduler.0": { + "type" : "DWRR", + "weight": "1" + }, + "scheduler.1": { + "type" : "DWRR", + "weight": "1" + }, + "scheduler.2": { + "type" : "DWRR", + "weight": "100" + } + }, +{% else %} "SCHEDULER": { "scheduler.0": { "type" : "DWRR", @@ -166,6 +198,7 @@ "weight": "15" } }, +{% endif %} {% if asic_type in pfc_to_pg_map_supported_asics %} "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { "AZURE": { @@ -188,7 +221,12 @@ {% if asic_type in pfc_to_pg_map_supported_asics %} "pfc_to_pg_map" : "AZURE", {% endif %} - "pfc_enable" : "3,4" +{% if port in port_names_list_extra_queues %} + "pfc_enable" : "2,3,4,6", +{% else %} + "pfc_enable" : "3,4", +{% endif %} + "pfcwd_sw_enable" : "3,4" }{% if not loop.last %},{% endif %} {% endfor %} @@ -221,12 +259,21 @@ "wred_profile": "AZURE_LOSSLESS" }, {% endfor %} +{% if 'resource_type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['resource_type'] in apollo_resource_types %} +{% for port in PORT_ACTIVE %} + "{{ port }}|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, +{% endfor %} +{% else %} {% for port in PORT_ACTIVE %} "{{ port }}|4": { "scheduler" : "scheduler.1", "wred_profile": "AZURE_LOSSLESS" }, {% endfor %} +{% endif %} {% for port in PORT_ACTIVE %} "{{ port }}|0": { "scheduler": "scheduler.0" @@ -239,7 +286,12 @@ {% endfor %} {% for port in PORT_ACTIVE %} "{{ port }}|2": { + {% if port in port_names_list_extra_queues %} + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + {% else %} "scheduler": "scheduler.0" + {% endif %} }, {% endfor %} {% for port in PORT_ACTIVE %} @@ -249,7 +301,12 @@ {% endfor %} {% for port in PORT_ACTIVE %} "{{ port }}|6": { + {% if port in port_names_list_extra_queues %} + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + {% else %} "scheduler": "scheduler.0" + {% endif %} }{% if not loop.last %},{% endif %} {% endfor %} diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 0d5b895cacfe..a49e29406eeb 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -75,12 +75,6 @@ else sudo chroot $FILESYSTEM_ROOT $DOCKER_CTL_SCRIPT start fi -# Apply apt configuration files -sudo cp $IMAGE_CONFIGS/apt/sources.list $FILESYSTEM_ROOT/etc/apt/ -sudo mkdir -p $FILESYSTEM_ROOT/etc/apt/sources.list.d/ -sudo cp -R $IMAGE_CONFIGS/apt/sources.list.d/${CONFIGURED_ARCH}/* $FILESYSTEM_ROOT/etc/apt/sources.list.d/ -cat $IMAGE_CONFIGS/apt/sonic-dev.gpg.key | sudo LANG=C chroot $FILESYSTEM_ROOT apt-key add - - # Update apt's snapshot of its repos sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get update @@ -102,25 +96,19 @@ sudo mkdir -p $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/ifupdown2_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f -# Install ipables (and its dependencies via 'apt-get -y install -f') -sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/iptables_*.deb || \ - sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f - -# Install a more recent version of ntp (and its dependencies via 'apt-get -y install -f') +# Install a patched version of ntp (and its dependencies via 'apt-get -y install -f') sudo dpkg --root=$FILESYSTEM_ROOT --force-confdef --force-confold -i $debs_path/ntp_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y \ -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install -f # Install dependencies for SONiC config engine sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \ - python-dev \ python3-dev # Install j2cli for handling jinja template sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install "j2cli==0.3.10" # Install Python client for Redis -sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install "redis==3.5.3" sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install "redis==3.5.3" # Install redis-dump-load Python 3 package @@ -130,19 +118,18 @@ sudo cp {{redis_dump_load_py3_wheel_path}} $FILESYSTEM_ROOT/$REDIS_DUMP_LOAD_PY3 sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $REDIS_DUMP_LOAD_PY3_WHEEL_NAME sudo rm -rf $FILESYSTEM_ROOT/$REDIS_DUMP_LOAD_PY3_WHEEL_NAME -# Install redis-dump-load Python 2 package -REDIS_DUMP_LOAD_PY2_WHEEL_NAME=$(basename {{redis_dump_load_py2_wheel_path}}) -sudo cp {{redis_dump_load_py2_wheel_path}} $FILESYSTEM_ROOT/$REDIS_DUMP_LOAD_PY2_WHEEL_NAME -sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install $REDIS_DUMP_LOAD_PY2_WHEEL_NAME -sudo rm -rf $FILESYSTEM_ROOT/$REDIS_DUMP_LOAD_PY2_WHEEL_NAME - # Install Python module for psutil sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install psutil # Install Python module for ipaddr -sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install ipaddr sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install ipaddr +# Install Python module for grpcio and grpcio-toole +if [[ $CONFIGURED_ARCH == amd64 ]]; then + sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install "grpcio==1.39.0" + sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install "grpcio-tools==1.39.0" +fi + # Install SwSS SDK Python 3 package # Note: the scripts will be overwritten by corresponding Python 2 package SWSSSDK_PY3_WHEEL_NAME=$(basename {{swsssdk_py3_wheel_path}}) @@ -150,18 +137,6 @@ sudo cp {{swsssdk_py3_wheel_path}} $FILESYSTEM_ROOT/$SWSSSDK_PY3_WHEEL_NAME sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $SWSSSDK_PY3_WHEEL_NAME sudo rm -rf $FILESYSTEM_ROOT/$SWSSSDK_PY3_WHEEL_NAME -# Install SwSS SDK Python 2 package -SWSSSDK_PY2_WHEEL_NAME=$(basename {{swsssdk_py2_wheel_path}}) -sudo cp {{swsssdk_py2_wheel_path}} $FILESYSTEM_ROOT/$SWSSSDK_PY2_WHEEL_NAME -sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install $SWSSSDK_PY2_WHEEL_NAME -sudo rm -rf $FILESYSTEM_ROOT/$SWSSSDK_PY2_WHEEL_NAME - -# Install sonic-py-common Python 2 package -SONIC_PY_COMMON_PY2_WHEEL_NAME=$(basename {{sonic_py_common_py2_wheel_path}}) -sudo cp {{sonic_py_common_py2_wheel_path}} $FILESYSTEM_ROOT/$SONIC_PY_COMMON_PY2_WHEEL_NAME -sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install $SONIC_PY_COMMON_PY2_WHEEL_NAME -sudo rm -rf $FILESYSTEM_ROOT/$SONIC_PY_COMMON_PY2_WHEEL_NAME - # Install sonic-py-common Python 3 package SONIC_PY_COMMON_PY3_WHEEL_NAME=$(basename {{sonic_py_common_py3_wheel_path}}) sudo cp {{sonic_py_common_py3_wheel_path}} $FILESYSTEM_ROOT/$SONIC_PY_COMMON_PY3_WHEEL_NAME @@ -176,7 +151,6 @@ fi # Install sonic-yang-models Python 3 package, install dependencies sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/libyang_*.deb sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/libyang-cpp_*.deb -sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/python2-yang_*.deb sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/python3-yang_*.deb SONIC_YANG_MODEL_PY3_WHEEL_NAME=$(basename {{sonic_yang_models_py3_wheel_path}}) sudo cp {{sonic_yang_models_py3_wheel_path}} $FILESYSTEM_ROOT/$SONIC_YANG_MODEL_PY3_WHEEL_NAME @@ -189,12 +163,6 @@ sudo cp {{sonic_yang_mgmt_py3_wheel_path}} $FILESYSTEM_ROOT/$SONIC_YANG_MGMT_PY3 sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $SONIC_YANG_MGMT_PY3_WHEEL_NAME sudo rm -rf $FILESYSTEM_ROOT/$SONIC_YANG_MGMT_PY3_WHEEL_NAME -# Install SONiC config engine Python 2 package -CONFIG_ENGINE_PY2_WHEEL_NAME=$(basename {{config_engine_py2_wheel_path}}) -sudo cp {{config_engine_py2_wheel_path}} $FILESYSTEM_ROOT/$CONFIG_ENGINE_PY2_WHEEL_NAME -sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install $CONFIG_ENGINE_PY2_WHEEL_NAME -sudo rm -rf $FILESYSTEM_ROOT/$CONFIG_ENGINE_PY2_WHEEL_NAME - # For sonic-config-engine Python 3 package # Install pyangbind here, outside sonic-config-engine dependencies, as pyangbind causes enum34 to be installed. # Then immediately uninstall enum34, as enum34 should not be installed for Python >= 3.4, as it causes a @@ -210,12 +178,6 @@ sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $CONFI sudo rm -rf $FILESYSTEM_ROOT/$CONFIG_ENGINE_PY3_WHEEL_NAME -# Install sonic-platform-common Python 2 package -PLATFORM_COMMON_PY2_WHEEL_NAME=$(basename {{platform_common_py2_wheel_path}}) -sudo cp {{platform_common_py2_wheel_path}} $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY2_WHEEL_NAME -sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install $PLATFORM_COMMON_PY2_WHEEL_NAME -sudo rm -rf $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY2_WHEEL_NAME - # Install sonic-platform-common Python 3 package PLATFORM_COMMON_PY3_WHEEL_NAME=$(basename {{platform_common_py3_wheel_path}}) sudo cp {{platform_common_py3_wheel_path}} $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY3_WHEEL_NAME @@ -223,12 +185,6 @@ sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $PLATF sudo rm -rf $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY3_WHEEL_NAME {% if pddf_support == "y" %} -# Install pddf-platform-api-base Python 2 package -PLATFORM_PDDF_COMMON_PY2_WHEEL_NAME=$(basename {{pddf_platform_api_base_py2_wheel_path}}) -sudo cp {{pddf_platform_api_base_py2_wheel_path}} $FILESYSTEM_ROOT/$PLATFORM_PDDF_COMMON_PY2_WHEEL_NAME -sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install $PLATFORM_PDDF_COMMON_PY2_WHEEL_NAME -sudo rm -rf $FILESYSTEM_ROOT/$PLATFORM_PDDF_COMMON_PY2_WHEEL_NAME - # Install pddf-platform-api-base Python 3 package PLATFORM_PDDF_COMMON_PY3_WHEEL_NAME=$(basename {{pddf_platform_api_base_py3_wheel_path}}) sudo cp {{pddf_platform_api_base_py3_wheel_path}} $FILESYSTEM_ROOT/$PLATFORM_PDDF_COMMON_PY3_WHEEL_NAME @@ -238,7 +194,6 @@ sudo rm -rf $FILESYSTEM_ROOT/$PLATFORM_PDDF_COMMON_PY3_WHEEL_NAME {# Barefoot platform vendors' sonic_platform packages import the Python 'thrift' library #} {% if sonic_asic_platform == "barefoot" %} -sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install thrift==0.13.0 sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install thrift==0.13.0 {% endif %} @@ -265,18 +220,20 @@ sudo rm -rf $FILESYSTEM_ROOT/$SONIC_UTILITIES_PY3_WHEEL_NAME sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-utilities-data_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f +# Install customized bash version to patch bash plugin support. +sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/bash_*.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f + # sonic-utilities-data installs bash-completion as a dependency. However, it is disabled by default # in bash.bashrc, so we copy a version of the file with it enabled here. sudo cp -f $IMAGE_CONFIGS/bash/bash.bashrc $FILESYSTEM_ROOT/etc/ # Install prerequisites needed for installing the dependent Python packages of sonic-host-services # These packages can be uninstalled after installation -sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install libcairo2-dev libdbus-1-dev libgirepository1.0-dev pkg-config -sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y -t $IMAGE_DISTRO-backports install libsystemd-dev +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install libcairo2-dev libdbus-1-dev libgirepository1.0-dev libsystemd-dev pkg-config -# Manually install runtime dependencies to avoid them being auto-removed while uninstalling build dependencies -sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install gir1.2-glib-2.0 libdbus-1-3 libgirepository-1.0-1 -sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y -t $IMAGE_DISTRO-backports install libsystemd0 +# Mark runtime dependencies as manually installed to avoid them being auto-removed while uninstalling build dependencies +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-mark manual gir1.2-glib-2.0 libdbus-1-3 libgirepository-1.0-1 libsystemd0 # Install SONiC host services package SONIC_HOST_SERVICES_PY3_WHEEL_NAME=$(basename {{sonic_host_services_py3_wheel_path}}) @@ -313,6 +270,12 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/libpam-tacplus_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/libnss-tacplus_*.deb || \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f +# Install bash-tacplus +sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/bash-tacplus_*.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f +# Install audisp-tacplus +sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/audisp-tacplus_*.deb || \ + sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f # Disable tacplus by default sudo LANG=C chroot $FILESYSTEM_ROOT pam-auth-update --remove tacplus sudo sed -i -e '/^passwd/s/ tacplus//' $FILESYSTEM_ROOT/etc/nsswitch.conf @@ -330,8 +293,13 @@ sudo sed -i -e '/^passwd/s/ radius//' $FILESYSTEM_ROOT/etc/nsswitch.conf # Install a custom version of kdump-tools (and its dependencies via 'apt-get -y install -f') if [[ $CONFIGURED_ARCH == amd64 ]]; then sudo DEBIAN_FRONTEND=noninteractive dpkg --root=$FILESYSTEM_ROOT -i $debs_path/kdump-tools_*.deb || \ - sudo LANG=C DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true chroot $FILESYSTEM_ROOT apt-get -q --no-install-suggests --no-install-recommends --force-no install + sudo LANG=C DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true chroot $FILESYSTEM_ROOT apt-get -q --no-install-suggests --no-install-recommends install cat $IMAGE_CONFIGS/kdump/kdump-tools | sudo tee -a $FILESYSTEM_ROOT/etc/default/kdump-tools > /dev/null + +for kernel_release in $(ls $FILESYSTEM_ROOT/lib/modules/); do + sudo LANG=C chroot $FILESYSTEM_ROOT /etc/kernel/postinst.d/kdump-tools $kernel_release > /dev/null 2>&1 + sudo LANG=C chroot $FILESYSTEM_ROOT kdump-config symlinks $kernel_release +done fi # Install python-swss-common package and all its dependent packages @@ -355,6 +323,8 @@ sudo chmod 755 $FILESYSTEM_ROOT/usr/bin/memory_checker sudo cp $IMAGE_CONFIGS/monit/restart_service $FILESYSTEM_ROOT/usr/bin/ sudo chmod 755 $FILESYSTEM_ROOT/usr/bin/restart_service +# Install custom-built smartmontools +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install smartmontools=7.2-1 # Install custom-built openssh sshd sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/openssh-server_*.deb @@ -405,6 +375,10 @@ echo "system-health.service" | sudo tee -a $GENERATED_SERVICE_FILE # Copy logrotate.d configuration files sudo cp -f $IMAGE_CONFIGS/logrotate/logrotate.d/* $FILESYSTEM_ROOT/etc/logrotate.d/ +sudo cp $IMAGE_CONFIGS/logrotate/rsyslog.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/ +sudo cp $IMAGE_CONFIGS/logrotate/logrotate-config.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM +sudo cp $IMAGE_CONFIGS/logrotate/logrotate-config.sh $FILESYSTEM_ROOT/usr/bin/ +echo "logrotate-config.service" | sudo tee -a $GENERATED_SERVICE_FILE # Copy systemd-journald configuration files sudo cp -f $IMAGE_CONFIGS/systemd/journald.conf $FILESYSTEM_ROOT/etc/systemd/ @@ -533,6 +507,11 @@ if [ -f platform/{{ sonic_asic_platform }}/peripheral_table.j2 ] then sudo cp platform/{{ sonic_asic_platform }}/peripheral_table.j2 $FILESYSTEM_ROOT/usr/share/sonic/templates/peripheral_table.j2 fi + +if [ -f platform/{{ sonic_asic_platform }}/zero_profiles.j2 ] +then + sudo cp platform/{{ sonic_asic_platform }}/zero_profiles.j2 $FILESYSTEM_ROOT/usr/share/sonic/templates/zero_profiles.j2 +fi {% endif %} # Copy hostname configuration scripts @@ -665,11 +644,13 @@ if [ $MULTIARCH_QEMU_ENVIRON == y ]; then fi {% if installer_images.strip() -%} -clean_proc() { - sudo umount /proc || true -} -trap_push clean_proc -sudo mount proc /proc -t proc +## ensure proc is mounted +sudo mount proc /proc -t proc || true +if [[ $CONFIGURED_ARCH == armhf ]]; then + # A workaround to fix the armhf build hung issue, caused by sonic-platform-nokia-7215_1.0_armhf.deb post installation script + ps -eo pid,cmd | grep python | grep "/etc/entropy.py" | awk '{print $1}' | xargs sudo kill -9 2>/dev/null || true +fi + sudo mkdir $FILESYSTEM_ROOT/target sudo mount --bind target $FILESYSTEM_ROOT/target sudo LANG=C DOCKER_HOST="$DOCKER_HOST" chroot $FILESYSTEM_ROOT docker info @@ -749,7 +730,6 @@ if [ $MULTIARCH_QEMU_ENVIRON == y ]; then else sudo chroot $FILESYSTEM_ROOT $DOCKER_CTL_SCRIPT stop fi -sudo umount /proc || true sudo bash -c "echo { > $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/ctr_image_names.json" {% for entry in feature_vs_image_names.split(' ') -%} @@ -809,6 +789,12 @@ sudo LANG=C cp $SCRIPTS_DIR/asic_status.py $FILESYSTEM_ROOT/usr/local/bin/asic_s # Copy sonic-netns-exec script sudo LANG=C cp $SCRIPTS_DIR/sonic-netns-exec $FILESYSTEM_ROOT/usr/bin/sonic-netns-exec +# Copy write_standby script for mux state +sudo LANG=C cp $SCRIPTS_DIR/write_standby.py $FILESYSTEM_ROOT/usr/local/bin/write_standby.py + +# Copy mark_dhcp_packet script +sudo LANG=C cp $SCRIPTS_DIR/mark_dhcp_packet.py $FILESYSTEM_ROOT/usr/local/bin/mark_dhcp_packet.py + # Copy systemd timer configuration # It implements delayed start of services sudo cp $BUILD_TEMPLATES/snmp.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM @@ -830,7 +816,7 @@ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable sonic.target sudo cp $BUILD_TEMPLATES/sonic-delayed.target $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable sonic-delayed.target -sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get purge -y python-dev python3-dev +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get purge -y python3-dev sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get purge -y build-essential libssl-dev swig sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get purge -y libcairo2-dev libdbus-1-dev libgirepository1.0-dev libsystemd-dev pkg-config sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get clean -y @@ -853,15 +839,10 @@ sudo cp $files_path/$ISSU_VERSION_FILE $FILESYSTEM_ROOT/etc/mlnx/issu-version sudo cp $files_path/$MLNX_FFB_SCRIPT $FILESYSTEM_ROOT/usr/bin/mlnx-ffb.sh sudo cp $files_path/$MLNX_ONIE_FW_UPDATE $FILESYSTEM_ROOT/usr/bin/$MLNX_ONIE_FW_UPDATE sudo cp $files_path/$MLNX_SSD_FW_UPDATE $FILESYSTEM_ROOT/usr/bin/$MLNX_SSD_FW_UPDATE +sudo cp $files_path/$MLNX_INSTALL_PENDING_FW $FILESYSTEM_ROOT/usr/bin/$MLNX_INSTALL_PENDING_FW j2 platform/mellanox/mlnx-fw-upgrade.j2 | sudo tee $FILESYSTEM_ROOT/usr/bin/mlnx-fw-upgrade.sh sudo chmod 755 $FILESYSTEM_ROOT/usr/bin/mlnx-fw-upgrade.sh -# Install mlnx-sonic-platform Python 2 package -MLNX_SONIC_PLATFORM_PY2_WHEEL_NAME=$(basename {{mlnx_platform_api_py2_wheel_path}}) -sudo cp {{mlnx_platform_api_py2_wheel_path}} $FILESYSTEM_ROOT/$MLNX_SONIC_PLATFORM_PY2_WHEEL_NAME -sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install $MLNX_SONIC_PLATFORM_PY2_WHEEL_NAME -sudo rm -rf $FILESYSTEM_ROOT/$MLNX_SONIC_PLATFORM_PY2_WHEEL_NAME - # Install mlnx-sonic-platform Python 3 package MLNX_SONIC_PLATFORM_PY3_WHEEL_NAME=$(basename {{mlnx_platform_api_py3_wheel_path}}) sudo cp {{mlnx_platform_api_py3_wheel_path}} $FILESYSTEM_ROOT/$MLNX_SONIC_PLATFORM_PY3_WHEEL_NAME diff --git a/files/build_templates/sonic_version.yml.j2 b/files/build_templates/sonic_version.yml.j2 index 34486061ea8a..6e3f3acac95a 100644 --- a/files/build_templates/sonic_version.yml.j2 +++ b/files/build_templates/sonic_version.yml.j2 @@ -7,6 +7,9 @@ debian_version: '{{ debian_version }}' kernel_version: '{{ kernel_version }}' {% endif -%} asic_type: {{ asic_type }} +{% if asic_subtype is defined and asic_subtype != '' -%} +asic_subtype: '{{ asic_subtype }}' +{% endif -%} commit_id: '{{ commit_id }}' branch: '{{ branch }}' {% if release is defined and release != '' -%} diff --git a/files/build_templates/swss_vars.j2 b/files/build_templates/swss_vars.j2 index df5e4d038f51..1cd95d16a6d6 100644 --- a/files/build_templates/swss_vars.j2 +++ b/files/build_templates/swss_vars.j2 @@ -1,5 +1,8 @@ { "asic_type": "{{ asic_type }}", + {% if asic_subtype is defined and asic_subtype != '' -%} + "asic_subtype": "{{ asic_subtype }}", + {% endif -%} "asic_id": "{{ DEVICE_METADATA.localhost.asic_id }}", "mac": "{{ DEVICE_METADATA.localhost.mac }}", "resource_type": "{{ DEVICE_METADATA.localhost.resource_type }}", diff --git a/files/image_config/apt/sonic-dev.gpg.key b/files/image_config/apt/sonic-dev.gpg.key deleted file mode 100644 index fb9a37901bc7..000000000000 --- a/files/image_config/apt/sonic-dev.gpg.key +++ /dev/null @@ -1,30 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1 - -mQENBFQ1bTIBCAC7oGfkv/ck0XsLuG8cdcSB2ISqxFAcBvH9BitEtxmpW2uhykKk -xY4rVD/4Uys1s3PF1/64QfPR+hYcewueOwz0ZAcLyFXXk4McICXaPq3NrLiWYKKX -UZLnrPzcrGZoW/kHDDp4OmBiDmT1PGvZlpuimwkMCusUzIr7Cbbp2dIy8MERL5tA -LcgLu3KL6clJ+aTW2jgepI1D7sTepOeGd7eRSb5njKg2M7k/93v/7MipZxiVtyXH -B74YiK6jSbst5JpuYsLa/Dqryvx7Xq3n53oif892pv3euTduo1fYw8Hgh/OOYdeT -c9WCj03KA1jCSFURjdrug0kR8BPlfjqtRLXFABEBAAG0JE1TIE9wZW4gVGVjaCA8 -aW50ZXJvcEBtaWNyb3NvZnQuY29tPokBOAQTAQIAIgUCVDVtMgIbAwYLCQgHAwIG -FQgCCQoLBBYCAwECHgECF4AACgkQsCxG30F6CJO1uAf/cmL68bM8YgF/61hkaY56 -LqrppUTJH/w4fKq47Pf6KfgSLvxfNU6soi2KHYRjIvTRx3tV4vUM5n2plaQg2s8V -/Epg4FeIRTk75YwiHAzLhLnp5cdUaTvC4j4mwxoB6j9Ty+fXJwQ0MvpDhIZb9vM4 -GXw/fEQHCT4f3gx4nReeqE+FB2wVHleX9+Lpodu98JyJTKJRBRHYLqy6S+/lyp2W -aBlsI1LOqBcx1uRK24U7duIpbYwIyrx0cafSruqR2GjVdu+imkhHyUn52VbzYhq1 -af0rqYiZ1VOamVOG0By8+hVyNa1MLc1K2uWGs0o5fDe9F5/swbvLHVXI+M50Vs+m -J7kBDQRUNW0yAQgAu7DkTVj0ZQC4F7bFivAwrdby8gCakTXOl1kcK622hjRJ8nam -aZeW+eADfLRsTmdUmXgZu1YWS5Gn2ZVngC8SGPUBT071+oRETCz4uNB7IimB9QfP -++orI6o2vmnVVsq5wWCbEdNU+TCVv1zjrYev5lwckkKpjHt6o8MNoX2DFuQymSyR -eZKaqhdKmcji4Ke7OIYqwgPjch3wxzE1b5gNOR/iwxWyjjOffZPLr/VhIfIJRs86 -dSXrwjHtEh810SKDLghHM0VAdY34nyC5ZZ61yhts5HtQDFK+9mNpH1mkc4gDBlgG -266pVvknumK6lPNm/osF/cpjWmEw24ypcQIvOQARAQABiQEfBBgBAgAJBQJUNW0y -AhsMAAoJELAsRt9BegiTMBUH/0sZ6gZy7mCTSAYT+NSXLFtGC2zNUVL80SWvfgYm -k9XPVI22MrefZfQ6M01RylyxtWXjRM8UoN8SDKWPpXumzJf831f/7om5zwutaG7b -tjDPYqRKJSbAIFZu2mN+uLrNQ2SV6XK7FoV0dtcrEX9S7RICb6i19D+70+Oh/qgU -R04H1jqS29XBzqAlIzdBoA+sYAwbOIJsSL3YyNQcUv3B5+5yR/bo/L8pnUJt6iuL -nWW+mi7r8gWPHDSrcdYq1TmmlOM7CwZPgWRZzkQPSeZz52Tt7IP47eyGJ09U4PIf -FtMH1ElL2UgHoA/F9Q88e7LkztaTqE59uXWbIYyuSMJVvRU= -=sb3d ------END PGP PUBLIC KEY BLOCK----- diff --git a/files/image_config/apt/sources.list.d/amd64/debian_archive_trafficmanager_net_debian.list b/files/image_config/apt/sources.list.d/amd64/debian_archive_trafficmanager_net_debian.list deleted file mode 100644 index d35c618112bb..000000000000 --- a/files/image_config/apt/sources.list.d/amd64/debian_archive_trafficmanager_net_debian.list +++ /dev/null @@ -1,3 +0,0 @@ -deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ buster main contrib non-free -deb [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ buster/updates main contrib non-free -deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ buster-backports main contrib non-free diff --git a/files/image_config/apt/sources.list.d/arm64/debian_mirror_arm64.list b/files/image_config/apt/sources.list.d/arm64/debian_mirror_arm64.list deleted file mode 100644 index 9e7dec92d39e..000000000000 --- a/files/image_config/apt/sources.list.d/arm64/debian_mirror_arm64.list +++ /dev/null @@ -1,9 +0,0 @@ -deb [arch=arm64] http://deb.debian.org/debian buster main contrib non-free -deb-src [arch=arm64] http://deb.debian.org/debian buster main contrib non-free -deb [arch=arm64] http://deb.debian.org/debian buster-updates main contrib non-free -deb-src [arch=arm64] http://deb.debian.org/debian buster-updates main contrib non-free -deb [arch=arm64] http://security.debian.org buster/updates main contrib non-free -deb-src [arch=arm64] http://security.debian.org buster/updates main contrib non-free -deb [arch=arm64] https://download.docker.com/linux/debian buster stable -deb [arch=arm64] http://ftp.debian.org/debian buster-backports main - diff --git a/files/image_config/apt/sources.list.d/armhf/debian_mirror_armhf.list b/files/image_config/apt/sources.list.d/armhf/debian_mirror_armhf.list deleted file mode 100644 index a7b831ef301c..000000000000 --- a/files/image_config/apt/sources.list.d/armhf/debian_mirror_armhf.list +++ /dev/null @@ -1,9 +0,0 @@ -deb [arch=armhf] http://deb.debian.org/debian buster main contrib non-free -deb-src [arch=armhf] http://deb.debian.org/debian buster main contrib non-free -deb [arch=armhf] http://deb.debian.org/debian buster-updates main contrib non-free -deb-src [arch=armhf] http://deb.debian.org/debian buster-updates main contrib non-free -deb [arch=armhf] http://security.debian.org buster/updates main contrib non-free -deb-src [arch=armhf] http://security.debian.org buster/updates main contrib non-free -deb [arch=armhf] https://download.docker.com/linux/debian buster stable -deb [arch=armhf] http://ftp.debian.org/debian buster-backports main - diff --git a/files/image_config/bash/bash.bashrc b/files/image_config/bash/bash.bashrc index 0f19263ae04a..96f54776f945 100644 --- a/files/image_config/bash/bash.bashrc +++ b/files/image_config/bash/bash.bashrc @@ -55,7 +55,7 @@ if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-no fi # Automatically log out console ttyS* sessions after 15 minutes of inactivity -tty | grep ttyS >/dev/null && TMOUT=900 +tty | egrep -q '^/dev/ttyS[[:digit:]]+$' && TMOUT=900 # if SSH_TARGET_CONSOLE_LINE was set, attach to console line interactive cli directly if [ -n "$SSH_TARGET_CONSOLE_LINE" ]; then diff --git a/files/image_config/copp/copp-config.service b/files/image_config/copp/copp-config.service index 8eed2353eddf..bd15de80bc5f 100644 --- a/files/image_config/copp/copp-config.service +++ b/files/image_config/copp/copp-config.service @@ -2,10 +2,12 @@ Description=Update CoPP configuration Requires=updategraph.service After=updategraph.service +BindsTo=sonic.target +After=sonic.target [Service] Type=oneshot ExecStart=/usr/bin/copp-config.sh [Install] -WantedBy=multi-user.target +WantedBy=sonic.target diff --git a/files/image_config/copp/copp_cfg.j2 b/files/image_config/copp/copp_cfg.j2 index c9b15c1279b5..46d921b82765 100755 --- a/files/image_config/copp/copp_cfg.j2 +++ b/files/image_config/copp/copp_cfg.j2 @@ -13,7 +13,7 @@ "trap_priority":"4", "queue": "4" }, - "queue4_group2": { + "queue4_group2": { "trap_action":"copy", "trap_priority":"4", "queue": "4", @@ -69,11 +69,13 @@ }, "lacp": { "trap_ids": "lacp", - "trap_group": "queue4_group1" + "trap_group": "queue4_group1", + "always_enabled": "true" }, "arp": { "trap_ids": "arp_req,arp_resp,neigh_discovery", - "trap_group": "queue4_group2" + "trap_group": "queue4_group2", + "always_enabled": "true" }, "lldp": { "trap_ids": "lldp", @@ -85,11 +87,13 @@ }, "udld": { "trap_ids": "udld", - "trap_group": "queue4_group3" + "trap_group": "queue4_group3", + "always_enabled": "true" }, "ip2me": { "trap_ids": "ip2me", - "trap_group": "queue1_group1" + "trap_group": "queue1_group1", + "always_enabled": "true" }, "macsec": { "trap_ids": "eapol", diff --git a/files/image_config/interfaces/interfaces-config.sh b/files/image_config/interfaces/interfaces-config.sh index 688b2f8433a5..646fd7a94e71 100755 --- a/files/image_config/interfaces/interfaces-config.sh +++ b/files/image_config/interfaces/interfaces-config.sh @@ -1,6 +1,8 @@ #!/bin/bash -ifdown --force eth0 +if [[ $(ifquery --running eth0) ]]; then + ifdown --force eth0 +fi # Check if ZTP DHCP policy has been installed if [ -e /etc/network/ifupdown2/policy.d/ztp_dhcp.json ]; then @@ -34,6 +36,48 @@ for intf_pid in $(ls -1 /var/run/dhclient*.Ethernet*.pid 2> /dev/null); do [ -f ${intf_pid} ] && kill `cat ${intf_pid}` && rm -f ${intf_pid} done + +# Setup eth1 if we connect to a remote chassis DB. +PLATFORM=${PLATFORM:-`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`} +CHASSISDB_CONF="/usr/share/sonic/device/$PLATFORM/chassisdb.conf" +[ -f $CHASSISDB_CONF ] && source $CHASSISDB_CONF + +ASIC_CONF="/usr/share/sonic/device/$PLATFORM/asic.conf" +[ -f $ASIC_CONF ] && source $ASIC_CONF + +if [[ -n "$midplane_subnet" && ($NUM_ASIC -gt 1) ]]; then + for asic_id in `seq 0 $((NUM_ASIC - 1))`; do + NET_NS="asic$asic_id" + + PIDS=`ip netns pids "$NET_NS" 2>/dev/null` + if [ "$?" -ne "0" ]; then # namespace doesn't exist + continue + fi + + # Use /16 for loopback interface + ip netns exec $NET_NS ip addr add 127.0.0.1/16 dev lo + ip netns exec $NET_NS ip addr del 127.0.0.1/8 dev lo + + # Create eth1 in database instance + ip link add name ns-eth1 link eth1-midplane type ipvlan mode l2 + ip link set dev ns-eth1 netns $NET_NS + ip netns exec $NET_NS ip link set ns-eth1 name eth1 + + # Configure IP address and enable eth1 + lc_slot_id=$(python3 -c 'import sonic_platform.platform; platform_chassis = sonic_platform.platform.Platform().get_chassis(); print(platform_chassis.get_my_slot())' 2>/dev/null) + lc_ip_address=`echo $midplane_subnet | awk -F. '{print $1 "." $2}'`.$lc_slot_id.$((asic_id + 10)) + lc_subnet_mask=${midplane_subnet#*/} + ip netns exec $NET_NS ip addr add $lc_ip_address/$lc_subnet_mask dev eth1 + ip netns exec $NET_NS ip link set dev eth1 up + + # Allow localnet routing on the new interfaces if midplane is using a + # subnet in the 127/8 range. + if [[ "${midplane_subnet#127}" != "$midplane_subnet" ]]; then + ip netns exec $NET_NS bash -c "echo 1 > /proc/sys/net/ipv4/conf/eth1/route_localnet" + fi + done +fi + # Read sysctl conf files again sysctl -p /etc/sysctl.d/90-dhcp6-systcl.conf diff --git a/files/image_config/logrotate/logrotate-config.service b/files/image_config/logrotate/logrotate-config.service new file mode 100644 index 000000000000..b965e4b32425 --- /dev/null +++ b/files/image_config/logrotate/logrotate-config.service @@ -0,0 +1,12 @@ +[Unit] +Description=Update logrotate configuration +Requires=updategraph.service +After=updategraph.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/logrotate-config.sh + +[Install] +WantedBy=multi-user.target + diff --git a/files/image_config/logrotate/logrotate-config.sh b/files/image_config/logrotate/logrotate-config.sh new file mode 100755 index 000000000000..76caec6f035d --- /dev/null +++ b/files/image_config/logrotate/logrotate-config.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +sonic-cfggen -d -t /usr/share/sonic/templates/rsyslog.j2 -a "{\"var_log_kb\":$(df -k /var/log | sed -n 2p | awk '{ print $2 }') }" > /etc/logrotate.d/rsyslog + diff --git a/files/image_config/logrotate/logrotate.d/rsyslog b/files/image_config/logrotate/rsyslog.j2 similarity index 96% rename from files/image_config/logrotate/logrotate.d/rsyslog rename to files/image_config/logrotate/rsyslog.j2 index cbf6e722eb90..28a7d9dd2ee0 100644 --- a/files/image_config/logrotate/logrotate.d/rsyslog +++ b/files/image_config/logrotate/rsyslog.j2 @@ -32,8 +32,13 @@ /var/log/frr/zebra.log /var/log/swss/sairedis*.rec /var/log/swss/swss*.rec +/var/log/swss/responsepublisher.rec { +{% if var_log_kb <= 204800 %} size 1M +{% else %} + size 16M +{% endif %} rotate 5000 missingok notifempty @@ -51,7 +56,7 @@ # should be disabled, just in case they get created and rotated RESERVED_SPACE_KB=4096 - VAR_LOG_SIZE_KB=$(df -k /var/log | sed -n 2p | awk '{ print $2 }') + VAR_LOG_SIZE_KB={{var_log_kb}} # Limit usable space to 90% of the partition minus the reserved space for other logs USABLE_SPACE_KB=$(( (VAR_LOG_SIZE_KB * 90 / 100) - RESERVED_SPACE_KB)) diff --git a/files/image_config/monit/container_checker b/files/image_config/monit/container_checker index 2a000d1e6bb7..a67a96a0c18c 100755 --- a/files/image_config/monit/container_checker +++ b/files/image_config/monit/container_checker @@ -20,7 +20,7 @@ import docker import sys import swsssdk -from sonic_py_common import multi_asic +from sonic_py_common import multi_asic, device_info from swsscommon import swsscommon @@ -32,7 +32,7 @@ def get_expected_running_containers(): value of field 'has_global_scope', the number of ASICs and the value of field 'has_per_asic_scope'. If the device has single ASIC, the container name was put into the list. - @return: A set which contains the expected running containers and a set that has + @return: A set which contains the expected running containers and a set that has containers marked as "always_enabled". """ config_db = swsssdk.ConfigDBConnector() @@ -41,7 +41,7 @@ def get_expected_running_containers(): expected_running_containers = set() always_running_containers = set() - + for container_name in feature_table.keys(): if feature_table[container_name]["state"] not in ["disabled", "always_disabled"]: if multi_asic.is_multi_asic(): @@ -51,14 +51,22 @@ def get_expected_running_containers(): num_asics = multi_asic.get_num_asics() for asic_id in range(num_asics): expected_running_containers.add(container_name + str(asic_id)) - elif feature_table[container_name]["state"] == 'always_enabled': - always_running_containers.add(container_name) else: expected_running_containers.add(container_name) - + if feature_table[container_name]["state"] == 'always_enabled': + if multi_asic.is_multi_asic(): + if feature_table[container_name]["has_global_scope"] == "True": + always_running_containers.add(container_name) + if feature_table[container_name]["has_per_asic_scope"] == "True": + num_asics = multi_asic.get_num_asics() + for asic_id in range(num_asics): + always_running_containers.add(container_name + str(asic_id)) + else: + always_running_containers.add(container_name) + if device_info.is_supervisor(): + always_running_containers.add("database-chassis") return expected_running_containers, always_running_containers - def get_current_running_from_DB(always_running_containers): """ @summary: This function will get the current running container list @@ -74,7 +82,7 @@ def get_current_running_from_DB(always_running_containers): state_db = swsscommon.DBConnector("STATE_DB", 0) tbl = swsscommon.Table(state_db, "FEATURE") if not tbl.getKeys(): - return False, None + return running_containers for name in tbl.getKeys(): data = dict(tbl.get(name)[1]) @@ -93,7 +101,7 @@ def get_current_running_from_DB(always_running_containers): print("Failed to get container '{}'. Error: '{}'".format(name, err)) pass - return True, running_containers + return running_containers def get_current_running_from_dockers(): @@ -120,13 +128,12 @@ def get_current_running_containers(always_running_containers): """ @summary: This function will get the list of currently running containers. If available in STATE-DB, get from DB else from list of dockers. - + @return: A set of currently running containers. """ - ret, current_running_containers = get_current_running_from_DB(always_running_containers) - if not ret: - current_running_containers = get_current_running_from_dockers() + current_running_containers = get_current_running_from_DB(always_running_containers) + current_running_containers.update(get_current_running_from_dockers()) return current_running_containers diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local index 57fd8c4b062b..7043da9fe143 100755 --- a/files/image_config/platform/rc.local +++ b/files/image_config/platform/rc.local @@ -225,11 +225,10 @@ if [ ! -e /host/machine.conf ]; then grub_installation_needed="TRUE" fi + migrate_nos_configuration umount /mnt/onie-boot fi -migrate_nos_configuration - . /host/machine.conf program_console_speed @@ -373,7 +372,7 @@ if [ -f $FIRST_BOOT_FILE ]; then mkdir -p /var/platform # Kdump tools configuration - sed -i -e "s/__PLATFORM__/$platform/g" /etc/default/kdump-tools + [ -f /etc/default/kdump-tools ] && sed -i -e "s/__PLATFORM__/$platform/g" /etc/default/kdump-tools firsttime_exit fi diff --git a/files/image_config/rsyslog/rsyslog-config.sh b/files/image_config/rsyslog/rsyslog-config.sh index f3895302e0f3..83be7ab6cf71 100755 --- a/files/image_config/rsyslog/rsyslog-config.sh +++ b/files/image_config/rsyslog/rsyslog-config.sh @@ -13,7 +13,7 @@ fi # on Single NPU platforms we continue to use loopback adddres if [[ ($NUM_ASIC -gt 1) ]]; then - udp_server_ip=$(ip -j -4 addr list docker0 | jq -r -M '.[0].addr_info[0].local') + udp_server_ip=$(ip -o -4 addr list docker0 | awk '{print $4}' | cut -d/ -f1) else udp_server_ip=$(ip -j -4 addr list lo scope host | jq -r -M '.[0].addr_info[0].local') fi diff --git a/files/image_config/sudoers/sudoers b/files/image_config/sudoers/sudoers index 42dd6d5ec751..fb371c59b8ad 100644 --- a/files/image_config/sudoers/sudoers +++ b/files/image_config/sudoers/sudoers @@ -46,6 +46,10 @@ Cmnd_Alias READ_ONLY_CMDS = /bin/cat /var/log/syslog*, \ Cmnd_Alias PASSWD_CMDS = /usr/local/bin/config tacacs passkey *, \ + /usr/local/bin/config radius passkey *, \ + /usr/local/bin/config snmp community add *, \ + /usr/local/bin/config snmp community del *, \ + /usr/local/bin/config snmp community replace * *, \ /usr/sbin/chpasswd * # User privilege specification @@ -60,6 +64,9 @@ ALL ALL=NOPASSWD: READ_ONLY_CMDS # Prevent password related command into syslog Defaults!PASSWD_CMDS !syslog +# Make sure sudo password prompt times out after 5 mins +Defaults passwd_timeout=5 + # See sudoers(5) for more information on "#include" directives: #includedir /etc/sudoers.d diff --git a/files/initramfs-tools/arista-net b/files/initramfs-tools/arista-net index 8759746458d6..64308630098c 100644 --- a/files/initramfs-tools/arista-net +++ b/files/initramfs-tools/arista-net @@ -95,19 +95,33 @@ fi # Iterate over all the net_maX items found in the cmdline two times. # First time renaming the interfaces to maX. # The second time renaming them to their final name ethX. -if [ -n "$aboot_flag" -a "$platform_flag" == 'rook' ]; then - for item in $items; do - key="${item%=*}" - value="${item#*=}" - arista_net_rename "$value" "$key" eth - done - for item in $items; do - key="${item%=*}" - value="${item#*=}" - index="${key#ma}" - index="$(( $index - 1 ))" - newKey="eth$index" - arista_net_rename "$value" "$newKey" ma - done +if [ -n "$aboot_flag" ]; then + if [ "$platform_flag" = 'rook' -o "$platform_flag" = 'lorikeet' ]; then + # Rename existing ethX interfaces to tmpX + for x in $(ls /sys/class/net/); do + case $x in + eth*) + value="${x#*eth}" + newname="tmp$value" + ip link set $x down + ip link set $x name "$newname" + ;; + *) + esac + done + for item in $items; do + key="${item%=*}" + value="${item#*=}" + arista_net_rename "$value" "$key" tmp + done + for item in $items; do + key="${item%=*}" + value="${item#*=}" + index="${key#ma}" + index="$(( $index - 1 ))" + newKey="eth$index" + arista_net_rename "$value" "$newKey" ma + done + fi fi diff --git a/files/initramfs-tools/union-mount.j2 b/files/initramfs-tools/union-mount.j2 index c680e69300d1..7a64f71d70bb 100644 --- a/files/initramfs-tools/union-mount.j2 +++ b/files/initramfs-tools/union-mount.j2 @@ -132,7 +132,7 @@ case "${ROOT}" in ;; *) ## Mount the raw partition again - mount ${ROOT} ${rootmnt}/host + mount -t ext4 ${ROOT} ${rootmnt}/host ;; esac diff --git a/files/initramfs-tools/varlog b/files/initramfs-tools/varlog index e8063e41a59c..980b24523452 100644 --- a/files/initramfs-tools/varlog +++ b/files/initramfs-tools/varlog @@ -11,17 +11,27 @@ case $1 in ;; esac +logs_inram=false + # Extract kernel parameters set -- $(cat /proc/cmdline) for x in "$@"; do case "$x" in varlog_size=*) varlog_size="${x#varlog_size=}" + ;; + logs_inram=on) + logs_inram=true + ;; esac done [ -z "$varlog_size" ] && exit 0 +# If logs are being stored in memory, then don't bother +# creating the log file just to have it deleted afterwards. +$logs_inram && exit 0 + # exit when the var_log.ext4 exists and the size matches if [ -e "${rootmnt}/host/disk-img/var-log.ext4" ]; then cur_varlog_size=$(ls -l ${rootmnt}/host/disk-img/var-log.ext4 | awk '{print $5}') diff --git a/files/scripts/gbsyncd-platform.sh b/files/scripts/gbsyncd-platform.sh index cb83e0e39e5e..c0db897d652c 100755 --- a/files/scripts/gbsyncd-platform.sh +++ b/files/scripts/gbsyncd-platform.sh @@ -7,17 +7,17 @@ PLATFORM=${PLATFORM:-`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`} DEVPATH="/usr/share/sonic/device" CONFIGFILE="${DEVPATH}/${PLATFORM}/gbsyncd.ini" +# Skip checking the service for vs +[ "$sonic_asic_platform" = vs ] && exit 0 + if [ ! -f "$CONFIGFILE" ]; then - if [ gbsyncd = "$SERVICE" ]; then - exit 0 - fi exit 1 fi while IFS="=" read -r key value; do case "$key" in platform) - if [ "$value" = "$SERVICE" ]; then + if [[ "$value" = "$SERVICE"* ]]; then exit 0 fi ;; diff --git a/files/scripts/mark_dhcp_packet.py b/files/scripts/mark_dhcp_packet.py new file mode 100755 index 000000000000..c80810f0316b --- /dev/null +++ b/files/scripts/mark_dhcp_packet.py @@ -0,0 +1,116 @@ +#!/usr/bin/env python3 + +import subprocess + +from sonic_py_common import logger +from swsscommon import swsscommon + +log = logger.Logger('mark_dhcp_packet') + + +class MarkDhcpPacket(object): + """ + Class used to configure dhcp packet mark in ebtables + """ + + def __init__(self): + self.config_db_connector = None + self.state_db_connector = None + + @property + def config_db(self): + """ + Returns config DB connector. + Initializes the connector during the first call + """ + if self.config_db_connector is None: + self.config_db_connector = swsscommon.ConfigDBConnector() + self.config_db_connector.connect() + + return self.config_db_connector + + @property + def state_db(self): + """ + Returns the state DB connector. + Initializes the connector during the first call + """ + if self.state_db_connector is None: + self.state_db_connector = swsscommon.SonicV2Connector( + host='127.0.0.1' + ) + self.state_db_connector.connect(self.state_db_connector.STATE_DB) + + return self.state_db_connector + + @property + def is_dualtor(self): + """ + Checks if script is running on a dual ToR system + """ + localhost_key = self.config_db.get_keys('DEVICE_METADATA')[0] + metadata = self.config_db.get_entry('DEVICE_METADATA', localhost_key) + + return 'subtype' in metadata and \ + 'dualtor' in metadata['subtype'].lower() + + def get_mux_intfs(self): + """ + Returns a list of mux cable interfaces + """ + mux_cables = self.config_db.get_table('MUX_CABLE') + mux_intfs = [intf for intf in mux_cables] + + return mux_intfs + + def generate_mark_from_index(self, index): + ''' + type: string, format: hexadecimal + Example: 0x67001, 0x67002, ... + ''' + intf_mark = "0x67" + str(index).zfill(3) + + return intf_mark + + def run_command(self, cmd): + subprocess.call(cmd, shell=True) + log.log_info("run command: {}".format(cmd)) + + def clear_dhcp_packet_marks(self): + ''' + Flush the INPUT chain in ebtables upon restart + ''' + self.run_command("sudo ebtables -F INPUT") + + def apply_mark_in_ebtables(self, intf, mark): + self.run_command("sudo ebtables -A INPUT -i {} -j mark --mark-set {}" + .format(intf, mark)) + + def update_mark_in_state_db(self, intf, mark): + self.state_db.set( + self.state_db.STATE_DB, + 'DHCP_PACKET_MARK|' + intf, + 'mark', + mark + ) + + def apply_marks(self): + """ + Writes dhcp packet marks in ebtables + """ + if not self.is_dualtor: + return + + self.clear_dhcp_packet_marks() + + for (index, intf) in enumerate(self.get_mux_intfs(), 1): + mark = self.generate_mark_from_index(index) + self.apply_mark_in_ebtables(intf, mark) + self.update_mark_in_state_db(intf, mark) + + log.log_info("Finish marking dhcp packets in ebtables.") + + +if __name__ == '__main__': + mark_dhcp_packet = MarkDhcpPacket() + mark_dhcp_packet.apply_marks() diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index 775bcc87cd0a..4f8f1b1af054 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -1,16 +1,16 @@ #!/bin/bash -DEPENDENT="radv" -MULTI_INST_DEPENDENT="teamd" +DEV=$2 -# Update dependent list based on other packages requirements -if [[ -f /etc/sonic/${SERVICE}_dependent ]]; then - DEPENDENT="${DEPENDENT} $(cat /etc/sonic/${SERVICE}_dependent)" -fi +SERVICE="swss" +PEER="syncd" +DEBUGLOG="/tmp/swss-syncd-debug$DEV.log" +LOCKFILE="/tmp/swss-syncd-lock$DEV" +NAMESPACE_PREFIX="asic" +ETC_SONIC_PATH="/etc/sonic/" -if [[ -f /etc/sonic/${SERVICE}_multi_inst_dependent ]]; then - MULTI_INST_DEPENDENT="${MULTI_INST_DEPENDENT} cat /etc/sonic/${SERVICE}_multi_inst_dependent" -fi +DEPENDENT="radv" +MULTI_INST_DEPENDENT="teamd" . /usr/local/bin/asic_status.sh @@ -20,6 +20,18 @@ function debug() /bin/echo `date` "- $1" >> ${DEBUGLOG} } +function read_dependent_services() +{ + # Update dependent list based on other packages requirements + if [[ -f ${ETC_SONIC_PATH}/${SERVICE}_dependent ]]; then + DEPENDENT="${DEPENDENT} $(cat ${ETC_SONIC_PATH}/${SERVICE}_dependent)" + fi + + if [[ -f ${ETC_SONIC_PATH}/${SERVICE}_multi_inst_dependent ]]; then + MULTI_INST_DEPENDENT="${MULTI_INST_DEPENDENT} cat ${ETC_SONIC_PATH}/${SERVICE}_multi_inst_dependent" + fi +} + function lock_service_state_change() { debug "Locking ${LOCKFILE} from ${SERVICE}$DEV service" @@ -159,7 +171,9 @@ start() { $SONIC_DB_CLI FLEX_COUNTER_DB FLUSHDB $SONIC_DB_CLI GB_ASIC_DB FLUSHDB $SONIC_DB_CLI GB_COUNTERS_DB FLUSHDB - clean_up_tables STATE_DB "'PORT_TABLE*', 'MGMT_PORT_TABLE*', 'VLAN_TABLE*', 'VLAN_MEMBER_TABLE*', 'LAG_TABLE*', 'LAG_MEMBER_TABLE*', 'INTERFACE_TABLE*', 'MIRROR_SESSION*', 'VRF_TABLE*', 'FDB_TABLE*', 'FG_ROUTE_TABLE*', 'BUFFER_POOL*', 'BUFFER_PROFILE*', 'MUX_CABLE_TABLE*'" + $SONIC_DB_CLI RESTAPI_DB FLUSHDB + clean_up_tables STATE_DB "'PORT_TABLE*', 'MGMT_PORT_TABLE*', 'VLAN_TABLE*', 'VLAN_MEMBER_TABLE*', 'LAG_TABLE*', 'LAG_MEMBER_TABLE*', 'INTERFACE_TABLE*', 'MIRROR_SESSION*', 'VRF_TABLE*', 'FDB_TABLE*', 'FG_ROUTE_TABLE*', 'BUFFER_POOL*', 'BUFFER_PROFILE*', 'MUX_CABLE_TABLE*', 'ADVERTISE_NETWORK_TABLE*'" + $SONIC_DB_CLI APPL_STATE_DB FLUSHDB fi # On supervisor card, skip starting asic related services here. In wait(), @@ -269,13 +283,6 @@ stop() { stop_peer_and_dependent_services } -DEV=$2 - -SERVICE="swss" -PEER="syncd" -DEBUGLOG="/tmp/swss-syncd-debug$DEV.log" -LOCKFILE="/tmp/swss-syncd-lock$DEV" -NAMESPACE_PREFIX="asic" if [ "$DEV" ]; then NET_NS="$NAMESPACE_PREFIX$DEV" #name of the network namespace SONIC_DB_CLI="sonic-db-cli -n $NET_NS" @@ -284,6 +291,8 @@ else SONIC_DB_CLI="sonic-db-cli" fi +read_dependent_services + case "$1" in start|wait|stop) $1 diff --git a/files/scripts/syncd.sh b/files/scripts/syncd.sh index 95c3e3841ba8..889495e8c50a 100755 --- a/files/scripts/syncd.sh +++ b/files/scripts/syncd.sh @@ -28,6 +28,14 @@ function startplatform() { debug "Firmware update procedure ended" fi + if [[ x"$sonic_asic_platform" == x"barefoot" ]]; then + is_usb0=$(ls /sys/class/net | grep usb0) + if [[ "$is_usb0" == "usb0" ]]; then + /usr/bin/ip link set usb0 down + /usr/bin/ip link set usb0 up + fi + fi + if [[ x"$WARM_BOOT" != x"true" ]]; then if [ x$sonic_asic_platform == x'cavium' ]; then /etc/init.d/xpnet.sh start diff --git a/files/scripts/syncd_common.sh b/files/scripts/syncd_common.sh index 3bb7c9fe6b6e..3adfb6cbfcf9 100755 --- a/files/scripts/syncd_common.sh +++ b/files/scripts/syncd_common.sh @@ -48,6 +48,15 @@ function check_warm_boot() fi } +function check_fast_boot() +{ + if [[ $($SONIC_DB_CLI STATE_DB GET "FAST_REBOOT|system") == "1" ]]; then + FAST_BOOT="true" + else + FAST_BOOT="false" + fi +} + function wait_for_database_service() { # Wait for redis server start before database clean @@ -140,10 +149,14 @@ stop() { lock_service_state_change check_warm_boot + check_fast_boot debug "Warm boot flag: ${SERVICE}$DEV ${WARM_BOOT}." + debug "Fast boot flag: ${SERVICE}$DEV ${FAST_BOOT}." if [[ x"$WARM_BOOT" == x"true" ]]; then TYPE=warm + elif [[ x"$FAST_BOOT" == x"true" ]]; then + TYPE=fast else TYPE=cold fi diff --git a/files/scripts/teamd.sh b/files/scripts/teamd.sh index c72048dccc93..4de3f25c4dbd 100755 --- a/files/scripts/teamd.sh +++ b/files/scripts/teamd.sh @@ -5,7 +5,7 @@ function debug() { /usr/bin/logger $1 - /bin/echo `date` "- $1" >> ${DEBUGLOG} + /bin/echo `date` "- $1" >> ${DEBUG_LOG} } function check_warm_boot() @@ -87,26 +87,31 @@ stop() { # Send USR1 signal to all teamd instances to stop them # It will prepare teamd for warm-reboot # Note: We must send USR1 signal before syncd, because it will send the last packet through CPU port - docker exec -i ${SERVICE}$DEV pkill -USR1 ${SERVICE} > /dev/null || [ $? == 1 ] + docker exec -i ${SERVICE}$DEV pkill -USR1 -f ${TEAMD_CMD} > /dev/null || [ $? == 1 ] elif [[ x"$FAST_BOOT" == x"true" ]]; then # Kill teamd processes inside of teamd container with SIGUSR2 to allow them to send last LACP frames # We call `docker kill teamd` to ensure the container stops as quickly as possible, # Note: teamd must be killed before syncd, because it will send the last packet through CPU port - docker exec -i ${SERVICE}$DEV pkill -USR2 ${SERVICE} || [ $? == 1 ] - while docker exec -i ${SERVICE}$DEV pgrep ${SERVICE} > /dev/null; do + docker exec -i ${SERVICE}$DEV pkill -USR2 -f ${TEAMD_CMD} || [ $? == 1 ] + fi + + if [[ x"$WARM_BOOT" == x"true" ]] || [[ x"$FAST_BOOT" == x"true" ]]; then + while docker exec -i ${SERVICE}$DEV pgrep -f ${TEAMD_CMD} > /dev/null; do sleep 0.05 done docker kill ${SERVICE}$DEV &> /dev/null || debug "Docker ${SERVICE}$DEV is not running ($?) ..." + else + /usr/bin/${SERVICE}.sh stop $DEV fi - /usr/bin/${SERVICE}.sh stop $DEV debug "Stopped ${SERVICE}$DEV service..." } DEV=$2 SERVICE="teamd" -DEBUGLOG="/tmp/teamd-debug$DEV.log" +TEAMD_CMD="/usr/bin/teamd" +DEBUG_LOG="/tmp/teamd-debug$DEV.log" NAMESPACE_PREFIX="asic" if [ "$DEV" ]; then NET_NS="$NAMESPACE_PREFIX$DEV" #name of the network namespace diff --git a/files/scripts/write_standby.py b/files/scripts/write_standby.py new file mode 100755 index 000000000000..53cf5265ecde --- /dev/null +++ b/files/scripts/write_standby.py @@ -0,0 +1,135 @@ +#!/usr/bin/env python3 + +import time + +from sonic_py_common import logger as log +from swsscommon.swsscommon import ConfigDBConnector, DBConnector, FieldValuePairs, ProducerStateTable, SonicV2Connector +from swsscommon.swsscommon import APPL_DB + +logger = log.Logger('write_standby') + +REDIS_SOCK_PATH = '/var/run/redis/redis.sock' + + +def create_fvs(**kwargs): + return FieldValuePairs(list(kwargs.items())) + +class MuxStateWriter(object): + """ + Class used to write standby mux state to APP DB + """ + + def __init__(self): + self.config_db_connector = None + self.appl_db_connector = None + self.asic_db_connector = None + + @property + def config_db(self): + """ + Returns config DB connector. + Initializes the connector during the first call + """ + if self.config_db_connector is None: + self.config_db_connector = ConfigDBConnector() + self.config_db_connector.connect() + + return self.config_db_connector + + @property + def appl_db(self): + """ + Returns the app DB connector. + Initializes the connector during the first call + """ + if self.appl_db_connector is None: + self.appl_db_connector = DBConnector(APPL_DB, REDIS_SOCK_PATH, True) + return self.appl_db_connector + + @property + def asic_db(self): + """ + Returns the ASIC DB connector. + Initializes the connector during the first call + """ + if self.asic_db_connector is None: + self.asic_db_connector = SonicV2Connector() + self.asic_db_connector.connect('ASIC_DB') + + return self.asic_db_connector + + @property + def tunnel_name(self): + """ + Returns the name of the IP-in-IP tunnel used for Dual ToR devices + """ + return self.config_db.get_keys('TUNNEL')[0] + + @property + def is_dualtor(self): + """ + Checks if script is running on a dual ToR system + """ + localhost_key = self.config_db.get_keys('DEVICE_METADATA')[0] + metadata = self.config_db.get_entry('DEVICE_METADATA', localhost_key) + + return 'subtype' in metadata and 'dualtor' in metadata['subtype'].lower() + + def get_auto_mux_intfs(self): + """ + Returns a list of all mux cable interfaces that are configured to auto-switch + """ + all_intfs = self.config_db.get_table('MUX_CABLE') + auto_intfs = [intf for intf, status in all_intfs.items() + if status['state'].lower() == 'auto'] + return auto_intfs + + def tunnel_exists(self): + """ + Checks if the IP-in-IP tunnel has been written to ASIC DB + """ + tunnel_key_pattern = 'ASIC_STATE:SAI_OBJECT_TYPE_TUNNEL:*' + return len(self.asic_db.keys('ASIC_DB', tunnel_key_pattern)) > 0 + + def wait_for_tunnel(self, interval=1, timeout=60): + """ + Waits until the IP-in-IP tunnel has been created + + Returns: + (bool) True if the tunnel has been created + False if the timeout period is exceeded + """ + logger.log_info("Waiting for tunnel {} with timeout {} seconds".format(self.tunnel_name, timeout)) + start = time.time() + curr_time = time.time() + + while not self.tunnel_exists() and curr_time - start < timeout: + time.sleep(interval) + curr_time = time.time() + + # If we timed out, return False else return True + return curr_time - start < timeout + + def apply_mux_config(self): + """ + Writes standby mux state to APP DB for all mux interfaces + """ + if not self.is_dualtor: + # If not running on a dual ToR system, take no action + return + intfs = self.get_auto_mux_intfs() + state = 'standby' + if self.wait_for_tunnel(): + logger.log_warning("Applying {} state to interfaces {}".format(state, intfs)) + producer_state_table = ProducerStateTable(self.appl_db, 'MUX_CABLE_TABLE') + fvs = create_fvs(state=state) + + for intf in intfs: + producer_state_table.set(intf, fvs) + else: + logger.log_error("Timed out waiting for tunnel {}, mux state will not be written".format(self.tunnel_name)) + + +if __name__ == '__main__': + mux_writer = MuxStateWriter() + mux_writer.apply_mux_config() diff --git a/install_sonic.py b/install_sonic.py new file mode 100755 index 000000000000..01785393f4eb --- /dev/null +++ b/install_sonic.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 + +import argparse +import pexpect +import sys +import time + + +def main(): + + parser = argparse.ArgumentParser(description='test_login cmdline parser') + parser.add_argument('-p', type=int, default=9000, help='local port') + + args = parser.parse_args() + + #KEY_UP = '\x1b[A' + KEY_DOWN = '\x1b[B' + #KEY_RIGHT = '\x1b[C' + #KEY_LEFT = '\x1b[D' + + grub_selection = "The highlighted entry will be executed" + + i = 0 + while True: + try: + p = pexpect.spawn("telnet 127.0.0.1 {}".format(args.p), timeout=600, logfile=sys.stdout, encoding='utf-8') + break + except Exception as e: + print(str(e)) + i += 1 + if i == 10: + raise + time.sleep(1) + + # select ONIE embed + p.expect(grub_selection) + p.sendline(KEY_DOWN) + + # select ONIE install + p.expect(['ONIE: Install OS']) + p.expect([grub_selection]) + p.sendline() + + # wait for grub, and exit + p.expect([grub_selection]) + + +if __name__ == '__main__': + main() diff --git a/installer/arm64/install.sh b/installer/arm64/install.sh index c1e20b62bf42..249c5b521700 100755 --- a/installer/arm64/install.sh +++ b/installer/arm64/install.sh @@ -64,6 +64,28 @@ VAR_LOG_SIZE=4096 [ -r platforms/$onie_platform ] && . platforms/$onie_platform +# Verify image platform is inside devices list +if [ "$install_env" = "onie" ]; then + if ! grep -Fxq "$onie_platform" platforms_asic; then + echo "The image you're trying to install is of a different ASIC type as the running platform's ASIC" + while true; do + read -r -p "Do you still wish to install this image? [y/n]: " input + case $input in + [Yy]) + echo "Force installing..." + break + ;; + [Nn]) + echo "Exited installation!" + exit 1 + ;; + *) + echo "Error: Invalid input" + ;; + esac + done + fi +fi # If running in ONIE if [ "$install_env" = "onie" ]; then @@ -117,6 +139,11 @@ elif [ "$install_env" = "sonic" ]; then rm -rf $f fi done + + demo_dev=$(findmnt -n -o SOURCE --target /host) + + # Don't reserve any blocks just for root + tune2fs -m 0 -r 0 $demo_dev fi # Create target directory or clean it up if exists diff --git a/installer/armhf/install.sh b/installer/armhf/install.sh index c85170ff256e..8cffa755734f 100755 --- a/installer/armhf/install.sh +++ b/installer/armhf/install.sh @@ -64,6 +64,28 @@ VAR_LOG_SIZE=4096 [ -r platforms/$onie_platform ] && . platforms/$onie_platform +# Verify image platform is inside devices list +if [ "$install_env" = "onie" ]; then + if ! grep -Fxq "$onie_platform" platforms_asic; then + echo "The image you're trying to install is of a different ASIC type as the running platform's ASIC" + while true; do + read -r -p "Do you still wish to install this image? [y/n]: " input + case $input in + [Yy]) + echo "Force installing..." + break + ;; + [Nn]) + echo "Exited installation!" + exit 1 + ;; + *) + echo "Error: Invalid input" + ;; + esac + done + fi +fi # If running in ONIE if [ "$install_env" = "onie" ]; then @@ -117,6 +139,11 @@ elif [ "$install_env" = "sonic" ]; then rm -rf $f fi done + + demo_dev=$(findmnt -n -o SOURCE --target /host) + + # Don't reserve any blocks just for root + tune2fs -m 0 -r 0 $demo_dev fi # Create target directory or clean it up if exists diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index d40dedc9a160..950d765d2418 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -92,6 +92,29 @@ VAR_LOG_SIZE=4096 [ -r platforms/$onie_platform ] && . platforms/$onie_platform +# Verify image platform is inside devices list +if [ "$install_env" = "onie" ]; then + if ! grep -Fxq "$onie_platform" platforms_asic; then + echo "The image you're trying to install is of a different ASIC type as the running platform's ASIC" + while true; do + read -r -p "Do you still wish to install this image? [y/n]: " input + case $input in + [Yy]) + echo "Force installing..." + break + ;; + [Nn]) + echo "Exited installation!" + exit 1 + ;; + *) + echo "Error: Invalid input" + ;; + esac + done + fi +fi + # Pick up console port and speed from install enviroment if not defined yet. # Console port and speed setting in cmdline is like "console=ttyS0,9600n", # so we can use pattern 'console=ttyS[0-9]+,[0-9]+' to match it. @@ -454,6 +477,9 @@ if [ "$install_env" = "onie" ]; then # Make filesystem mkfs.ext4 -L $demo_volume_label $demo_dev + # Don't reserve any blocks just for root + tune2fs -m 0 -r 0 $demo_dev + # Mount demo filesystem demo_mnt=$(${onie_bin} mktemp -d) || { echo "Error: Unable to create file system mount point" @@ -486,12 +512,20 @@ elif [ "$install_env" = "sonic" ]; then rm -rf $f fi done + + demo_dev=$(findmnt -n -o SOURCE --target /host) + + # Don't reserve any blocks just for root + tune2fs -m 0 -r 0 $demo_dev else demo_mnt="build_raw_image_mnt" demo_dev=$cur_wd/"%%OUTPUT_RAW_IMAGE%%" mkfs.ext4 -L $demo_volume_label $demo_dev + # Don't reserve any blocks just for root + tune2fs -m 0 -r 0 $demo_dev + echo "Mounting $demo_dev on $demo_mnt..." mkdir $demo_mnt mount -t auto -o loop $demo_dev $demo_mnt @@ -629,7 +663,7 @@ fi # Note: assume that apparmor is supported in the kernel demo_grub_entry="$demo_volume_revision_label" if [ "$install_env" = "sonic" ]; then - old_sonic_menuentry=$(cat /host/grub/grub.cfg | sed "/$running_sonic_revision/,/}/!d") + old_sonic_menuentry=$(cat /host/grub/grub.cfg | sed "/^menuentry '${demo_volume_label}-${running_sonic_revision}'/,/}/!d") grub_cfg_root=$(echo $old_sonic_menuentry | sed -e "s/.*root\=\(.*\)rw.*/\1/") onie_menuentry=$(cat /host/grub/grub.cfg | sed "/menuentry ONIE/,/}/!d") elif [ "$install_env" = "build" ]; then @@ -651,13 +685,13 @@ menuentry '$demo_grub_entry' { if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_msdos insmod ext2 - linux /$image_dir/boot/vmlinuz-4.19.0-12-2-amd64 root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \ + linux /$image_dir/boot/vmlinuz-5.10.0-8-2-amd64 root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \ net.ifnames=0 biosdevname=0 \ loop=$image_dir/$FILESYSTEM_SQUASHFS loopfstype=squashfs \ systemd.unified_cgroup_hierarchy=0 \ apparmor=1 security=apparmor varlog_size=$VAR_LOG_SIZE usbcore.autosuspend=-1 $ONIE_PLATFORM_EXTRA_CMDLINE_LINUX echo 'Loading $demo_volume_label $demo_type initial ramdisk ...' - initrd /$image_dir/boot/initrd.img-4.19.0-12-2-amd64 + initrd /$image_dir/boot/initrd.img-5.10.0-8-2-amd64 } EOF diff --git a/platform/barefoot/bfn-modules/debian/control b/platform/barefoot/bfn-modules/debian/control index be1f6cc0443a..9023bdd63474 100644 --- a/platform/barefoot/bfn-modules/debian/control +++ b/platform/barefoot/bfn-modules/debian/control @@ -2,11 +2,11 @@ Source: bfn-modules Section: main Priority: extra Maintainer: support -Build-Depends: debhelper (>= 8.0.0), bzip2 +Build-Depends: debhelper (>= 8.0.0), bzip2, python3 Standards-Version: 3.9.3 Package: bfn-modules Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for bfn asic for mmap diff --git a/platform/barefoot/bfn-modules/debian/rules b/platform/barefoot/bfn-modules/debian/rules index c588b075e5e7..ca467222d4a6 100755 --- a/platform/barefoot/bfn-modules/debian/rules +++ b/platform/barefoot/bfn-modules/debian/rules @@ -8,7 +8,7 @@ KERNEL_SRC := /lib/modules/$(KVERSION) MODULE_SRC := $(shell pwd)/modules %: - dh $@ + dh $@ --with python3 override_dh_auto_build: make -C $(KERNEL_SRC)/build M=$(MODULE_SRC) diff --git a/platform/barefoot/bfn-modules/modules/bf_kdrv.c b/platform/barefoot/bfn-modules/modules/bf_kdrv.c index d4c786c56b75..2bddc72cbbf7 100644 --- a/platform/barefoot/bfn-modules/modules/bf_kdrv.c +++ b/platform/barefoot/bfn-modules/modules/bf_kdrv.c @@ -1316,8 +1316,11 @@ static pci_ers_result_t bf_pci_mmio_enabled(struct pci_dev *dev) { struct bf_pci_dev *bfdev = pci_get_drvdata(dev); printk(KERN_ERR "BF pci_mmio_enabled invoked after pci error\n"); - pci_cleanup_aer_uncorrect_error_status(dev); - + #if KERNEL_VERSION(5, 8, 0) <= LINUX_VERSION_CODE + pci_aer_clear_nonfatal_status(dev); + #else + pci_cleanup_aer_uncorrect_error_status(dev); + #endif if (bfdev) { /* send a signal to the user space program of the error */ int minor = bfdev->info.minor; diff --git a/platform/barefoot/bfn-modules/modules/bf_tun.c b/platform/barefoot/bfn-modules/modules/bf_tun.c index a20f5e4db585..2703c54eb107 100644 --- a/platform/barefoot/bfn-modules/modules/bf_tun.c +++ b/platform/barefoot/bfn-modules/modules/bf_tun.c @@ -1,17 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * TUN - Universal TUN/TAP device driver. * Copyright (C) 1999-2002 Maxim Krasnyansky * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * * $Id: tun.c,v 1.15 2002/03/01 02:44:24 maxk Exp $ */ @@ -71,6 +62,7 @@ #include #include #include +#include #include #include #include @@ -86,36 +78,6 @@ static void tun_default_link_ksettings(struct net_device *dev, struct ethtool_link_ksettings *cmd); -/* Uncomment to enable debugging */ -/* #define TUN_DEBUG 1 */ - -#ifdef TUN_DEBUG -static int debug; - -#define tun_debug(level, tun, fmt, args...) \ -do { \ - if (tun->debug) \ - netdev_printk(level, tun->dev, fmt, ##args); \ -} while (0) -#define DBG1(level, fmt, args...) \ -do { \ - if (debug == 2) \ - printk(level fmt, ##args); \ -} while (0) -#else -#define tun_debug(level, tun, fmt, args...) \ -do { \ - if (0) \ - netdev_printk(level, tun->dev, fmt, ##args); \ -} while (0) -#define DBG1(level, fmt, args...) \ -do { \ - if (0) \ - printk(level fmt, ##args); \ -} while (0) -#endif - -#define TUN_HEADROOM 256 #define TUN_RX_PAD (NET_IP_ALIGN + NET_SKB_PAD) /* TUN device flags */ @@ -148,10 +110,10 @@ struct tap_filter { #define TUN_FLOW_EXPIRE (3 * HZ) struct tun_pcpu_stats { - u64 rx_packets; - u64 rx_bytes; - u64 tx_packets; - u64 tx_bytes; + u64_stats_t rx_packets; + u64_stats_t rx_bytes; + u64_stats_t tx_packets; + u64_stats_t tx_bytes; struct u64_stats_sync syncp; u32 rx_dropped; u32 tx_dropped; @@ -172,7 +134,6 @@ struct tun_pcpu_stats { struct tun_file { struct sock sk; struct socket socket; - struct socket_wq wq; struct tun_struct __rcu *tun; struct fasync_struct *fasync; /* only used for fasnyc */ @@ -191,6 +152,11 @@ struct tun_file { struct xdp_rxq_info xdp_rxq; }; +struct tun_page { + struct page *page; + int count; +}; + struct tun_flow_entry { struct hlist_node hash_link; struct rcu_head rcu; @@ -199,7 +165,7 @@ struct tun_flow_entry { u32 rxhash; u32 rps_rxhash; int queue_index; - unsigned long updated; + unsigned long updated ____cacheline_aligned_in_smp; }; #define TUN_NUM_FLOW_ENTRIES 1024 @@ -233,9 +199,7 @@ struct tun_struct { struct sock_fprog fprog; /* protected by rtnl lock */ bool filter_attached; -#ifdef TUN_DEBUG - int debug; -#endif + u32 msg_enable; spinlock_t lock; struct hlist_head flows[TUN_NUM_FLOW_ENTRIES]; struct timer_list flow_gc_timer; @@ -257,24 +221,6 @@ struct veth { __be16 h_vlan_TCI; }; -bool tun_is_xdp_frame(void *ptr) -{ - return (unsigned long)ptr & TUN_XDP_FLAG; -} -EXPORT_SYMBOL(tun_is_xdp_frame); - -void *tun_xdp_to_ptr(void *ptr) -{ - return (void *)((unsigned long)ptr | TUN_XDP_FLAG); -} -EXPORT_SYMBOL(tun_xdp_to_ptr); - -void *tun_ptr_to_xdp(void *ptr) -{ - return (void *)((unsigned long)ptr & ~TUN_XDP_FLAG); -} -EXPORT_SYMBOL(tun_ptr_to_xdp); - static int tun_napi_receive(struct napi_struct *napi, int budget) { struct tun_file *tfile = container_of(napi, struct tun_file, napi); @@ -321,8 +267,8 @@ static void tun_napi_init(struct tun_struct *tun, struct tun_file *tfile, tfile->napi_enabled = napi_en; tfile->napi_frags_enabled = napi_en && napi_frags; if (napi_en) { - netif_napi_add(tun->dev, &tfile->napi, tun_napi_poll, - NAPI_POLL_WEIGHT); + netif_tx_napi_add(tun->dev, &tfile->napi, tun_napi_poll, + NAPI_POLL_WEIGHT); napi_enable(&tfile->napi); } } @@ -431,8 +377,9 @@ static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun, struct tun_flow_entry *e = kmalloc(sizeof(*e), GFP_ATOMIC); if (e) { - tun_debug(KERN_INFO, tun, "create flow: hash %u index %u\n", - rxhash, queue_index); + netif_info(tun, tx_queued, tun->dev, + "create flow: hash %u index %u\n", + rxhash, queue_index); e->updated = jiffies; e->rxhash = rxhash; e->rps_rxhash = 0; @@ -446,8 +393,8 @@ static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun, static void tun_flow_delete(struct tun_struct *tun, struct tun_flow_entry *e) { - tun_debug(KERN_INFO, tun, "delete flow: hash %u index %u\n", - e->rxhash, e->queue_index); + netif_info(tun, tx_queued, tun->dev, "delete flow: hash %u index %u\n", + e->rxhash, e->queue_index); hlist_del_rcu(&e->hash_link); kfree_rcu(e, rcu); --tun->flow_count; @@ -493,8 +440,6 @@ static void tun_flow_cleanup(struct timer_list *t) unsigned long count = 0; int i; - tun_debug(KERN_INFO, tun, "tun_flow_cleanup\n"); - spin_lock(&tun->lock); for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) { struct tun_flow_entry *e; @@ -527,18 +472,17 @@ static void tun_flow_update(struct tun_struct *tun, u32 rxhash, unsigned long delay = tun->ageing_time; u16 queue_index = tfile->queue_index; - if (!rxhash) - return; - else - head = &tun->flows[tun_hashfn(rxhash)]; + head = &tun->flows[tun_hashfn(rxhash)]; rcu_read_lock(); e = tun_flow_find(head, rxhash); if (likely(e)) { /* TODO: keep queueing to old queue until it's empty? */ - e->queue_index = queue_index; - e->updated = jiffies; + if (READ_ONCE(e->queue_index) != queue_index) + WRITE_ONCE(e->queue_index, queue_index); + if (e->updated != jiffies) + e->updated = jiffies; sock_rps_record_flow_hash(e->rps_rxhash); } else { spin_lock_bh(&tun->lock); @@ -555,8 +499,7 @@ static void tun_flow_update(struct tun_struct *tun, u32 rxhash, rcu_read_unlock(); } -/** - * Save the hash received in the stack receive path and update the +/* Save the hash received in the stack receive path and update the * flow_hash table accordingly. */ static inline void tun_flow_save_rps_rxhash(struct tun_flow_entry *e, u32 hash) @@ -565,12 +508,11 @@ static inline void tun_flow_save_rps_rxhash(struct tun_flow_entry *e, u32 hash) e->rps_rxhash = hash; } -/* We try to identify a flow through its rxhash first. The reason that +/* We try to identify a flow through its rxhash. The reason that * we do not check rxq no. is because some cards(e.g 82599), chooses * the rxq based on the txq where the last packet of the flow comes. As * the userspace application move between processors, we may get a - * different rxq no. here. If we could not get rxhash, then we would - * hope the rxq no. may help here. + * different rxq no. here. */ static u16 tun_automq_select_queue(struct tun_struct *tun, struct sk_buff *skb) { @@ -581,18 +523,13 @@ static u16 tun_automq_select_queue(struct tun_struct *tun, struct sk_buff *skb) numqueues = READ_ONCE(tun->numqueues); txq = __skb_get_hash_symmetric(skb); - if (txq) { - e = tun_flow_find(&tun->flows[tun_hashfn(txq)], txq); - if (e) { - tun_flow_save_rps_rxhash(e, txq); - txq = e->queue_index; - } else - /* use multiply and shift instead of expensive divide */ - txq = ((u64)txq * numqueues) >> 32; - } else if (likely(skb_rx_queue_recorded(skb))) { - txq = skb_get_rx_queue(skb); - while (unlikely(txq >= numqueues)) - txq -= numqueues; + e = tun_flow_find(&tun->flows[tun_hashfn(txq)], txq); + if (e) { + tun_flow_save_rps_rxhash(e, txq); + txq = e->queue_index; + } else { + /* use multiply and shift instead of expensive divide */ + txq = ((u64)txq * numqueues) >> 32; } return txq; @@ -616,8 +553,7 @@ static u16 tun_ebpf_select_queue(struct tun_struct *tun, struct sk_buff *skb) } static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb, - struct net_device *sb_dev, - select_queue_fallback_t fallback) + struct net_device *sb_dev) { struct tun_struct *tun = netdev_priv(dev); u16 ret; @@ -803,7 +739,8 @@ static void tun_detach_all(struct net_device *dev) } static int tun_attach(struct tun_struct *tun, struct file *file, - bool skip_filter, bool napi, bool napi_frags) + bool skip_filter, bool napi, bool napi_frags, + bool publish_tun) { struct tun_file *tfile = file->private_data; struct net_device *dev = tun->dev; @@ -875,6 +812,9 @@ static int tun_attach(struct tun_struct *tun, struct file *file, tun_napi_init(tun, tfile, napi, napi_frags); } + if (rtnl_dereference(tun->xdp_prog)) + sock_set_flag(&tfile->sk, SOCK_XDP); + /* device is allowed to go away first, so no need to hold extra * refcnt. */ @@ -883,7 +823,8 @@ static int tun_attach(struct tun_struct *tun, struct file *file, * initialized tfile; otherwise we risk using half-initialized * object. */ - rcu_assign_pointer(tfile->tun, tun); + if (publish_tun) + rcu_assign_pointer(tfile->tun, tun); rcu_assign_pointer(tun->tfiles[tun->numqueues], tfile); tun->numqueues++; tun_set_real_num_queues(tun); @@ -1042,20 +983,17 @@ static int tun_net_close(struct net_device *dev) static void tun_automq_xmit(struct tun_struct *tun, struct sk_buff *skb) { #ifdef CONFIG_RPS - if (tun->numqueues == 1 && static_key_false(&rps_needed)) { + if (tun->numqueues == 1 && static_branch_unlikely(&rps_needed)) { /* Select queue was not called for the skbuff, so we extract the * RPS hash and save it into the flow_table here. */ + struct tun_flow_entry *e; __u32 rxhash; rxhash = __skb_get_hash_symmetric(skb); - if (rxhash) { - struct tun_flow_entry *e; - e = tun_flow_find(&tun->flows[tun_hashfn(rxhash)], - rxhash); - if (e) - tun_flow_save_rps_rxhash(e, rxhash); - } + e = tun_flow_find(&tun->flows[tun_hashfn(rxhash)], rxhash); + if (e) + tun_flow_save_rps_rxhash(e, rxhash); } #endif } @@ -1090,9 +1028,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) if (!rcu_dereference(tun->steering_prog)) tun_automq_xmit(tun, skb); - tun_debug(KERN_INFO, tun, "tun_net_xmit %d\n", skb->len); - - BUG_ON(!tfile); + netif_info(tun, tx_queued, tun->dev, "%s %d\n", __func__, skb->len); /* Drop if the filter does not like it. * This is a noop if the filter is disabled. @@ -1118,7 +1054,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) */ skb_orphan(skb); - nf_reset(skb); + nf_reset_ct(skb); if (ptr_ring_produce(&tfile->tx_ring, skb)) goto drop; @@ -1181,10 +1117,10 @@ tun_net_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) p = per_cpu_ptr(tun->pcpu_stats, i); do { start = u64_stats_fetch_begin(&p->syncp); - rxpackets = p->rx_packets; - rxbytes = p->rx_bytes; - txpackets = p->tx_packets; - txbytes = p->tx_bytes; + rxpackets = u64_stats_read(&p->rx_packets); + rxbytes = u64_stats_read(&p->rx_bytes); + txpackets = u64_stats_read(&p->tx_packets); + txbytes = u64_stats_read(&p->tx_bytes); } while (u64_stats_fetch_retry(&p->syncp, start)); stats->rx_packets += rxpackets; @@ -1206,24 +1142,28 @@ static int tun_xdp_set(struct net_device *dev, struct bpf_prog *prog, struct netlink_ext_ack *extack) { struct tun_struct *tun = netdev_priv(dev); + struct tun_file *tfile; struct bpf_prog *old_prog; + int i; old_prog = rtnl_dereference(tun->xdp_prog); rcu_assign_pointer(tun->xdp_prog, prog); if (old_prog) bpf_prog_put(old_prog); - return 0; -} - -static u32 tun_xdp_query(struct net_device *dev) -{ - struct tun_struct *tun = netdev_priv(dev); - const struct bpf_prog *xdp_prog; - - xdp_prog = rtnl_dereference(tun->xdp_prog); - if (xdp_prog) - return xdp_prog->aux->id; + for (i = 0; i < tun->numqueues; i++) { + tfile = rtnl_dereference(tun->tfiles[i]); + if (prog) + sock_set_flag(&tfile->sk, SOCK_XDP); + else + sock_reset_flag(&tfile->sk, SOCK_XDP); + } + list_for_each_entry(tfile, &tun->disabled, next) { + if (prog) + sock_set_flag(&tfile->sk, SOCK_XDP); + else + sock_reset_flag(&tfile->sk, SOCK_XDP); + } return 0; } @@ -1233,9 +1173,6 @@ static int tun_xdp(struct net_device *dev, struct netdev_bpf *xdp) switch (xdp->command) { case XDP_SETUP_PROG: return tun_xdp_set(dev, xdp->prog, xdp->extack); - case XDP_QUERY_PROG: - xdp->prog_id = tun_xdp_query(dev); - return 0; default: return -EINVAL; } @@ -1244,6 +1181,11 @@ static int tun_xdp(struct net_device *dev, struct netdev_bpf *xdp) static int tun_net_change_carrier(struct net_device *dev, bool new_carrier) { if (new_carrier) { + struct tun_struct *tun = netdev_priv(dev); + + if (!tun->numqueues) + return -EPERM; + netif_carrier_on(dev); } else { netif_carrier_off(dev); @@ -1272,7 +1214,7 @@ static const struct net_device_ops tun_netdev_ops = { .ndo_set_rx_headroom = tun_set_headroom, .ndo_get_stats64 = tun_net_get_stats64, .ndo_change_carrier = tun_net_change_carrier, - .ndo_change_mtu = tun_net_change_mtu, + .ndo_change_mtu = tun_net_change_mtu, }; static void __tun_xdp_flush_tfile(struct tun_file *tfile) @@ -1335,7 +1277,7 @@ static int tun_xdp_xmit(struct net_device *dev, int n, static int tun_xdp_tx(struct net_device *dev, struct xdp_buff *xdp) { - struct xdp_frame *frame = convert_to_xdp_frame(xdp); + struct xdp_frame *frame = xdp_convert_buff_to_frame(xdp); if (unlikely(!frame)) return -EOVERFLOW; @@ -1359,7 +1301,7 @@ static const struct net_device_ops tap_netdev_ops = { .ndo_bpf = tun_xdp, .ndo_xdp_xmit = tun_xdp_xmit, .ndo_change_carrier = tun_net_change_carrier, - .ndo_change_mtu = tun_net_change_mtu, + .ndo_change_mtu = tun_net_change_mtu, }; static void tun_flow_init(struct tun_struct *tun) @@ -1381,9 +1323,6 @@ static void tun_flow_uninit(struct tun_struct *tun) tun_flow_flush(tun); } -#define MIN_MTU 68 -#define MAX_MTU 65535 - /* Initialize net device. */ static void tun_net_init(struct net_device *dev) { @@ -1392,6 +1331,7 @@ static void tun_net_init(struct net_device *dev) switch (tun->flags & TUN_TYPE_MASK) { case IFF_TUN: dev->netdev_ops = &tun_netdev_ops; + dev->header_ops = &ip_tunnel_header_ops; /* Point-to-Point TUN Device */ dev->hard_header_len = 0; @@ -1441,8 +1381,6 @@ static __poll_t tun_chr_poll(struct file *file, poll_table *wait) sk = tfile->socket.sk; - tun_debug(KERN_INFO, tun, "tun_chr_poll\n"); - poll_wait(file, sk_sleep(sk), wait); if (!ptr_ring_empty(&tfile->tx_ring)) @@ -1493,23 +1431,22 @@ static struct sk_buff *tun_napi_alloc_frags(struct tun_file *tfile, skb->truesize += skb->data_len; for (i = 1; i < it->nr_segs; i++) { - struct page_frag *pfrag = ¤t->task_frag; size_t fragsz = it->iov[i].iov_len; + struct page *page; + void *frag; if (fragsz == 0 || fragsz > PAGE_SIZE) { err = -EINVAL; goto free; } - - if (!skb_page_frag_refill(fragsz, pfrag, GFP_KERNEL)) { + frag = netdev_alloc_frag(fragsz); + if (!frag) { err = -ENOMEM; goto free; } - - skb_fill_page_desc(skb, i - 1, pfrag->page, - pfrag->offset, fragsz); - page_ref_inc(pfrag->page); - pfrag->offset += fragsz; + page = virt_to_head_page(frag); + skb_fill_page_desc(skb, i - 1, page, + frag - page_address(page), fragsz); } return skb; @@ -1608,6 +1545,57 @@ static bool tun_can_build_skb(struct tun_struct *tun, struct tun_file *tfile, return true; } +static struct sk_buff *__tun_build_skb(struct tun_file *tfile, + struct page_frag *alloc_frag, char *buf, + int buflen, int len, int pad) +{ + struct sk_buff *skb = build_skb(buf, buflen); + + if (!skb) + return ERR_PTR(-ENOMEM); + + skb_reserve(skb, pad); + skb_put(skb, len); + skb_set_owner_w(skb, tfile->socket.sk); + + get_page(alloc_frag->page); + alloc_frag->offset += buflen; + + return skb; +} + +static int tun_xdp_act(struct tun_struct *tun, struct bpf_prog *xdp_prog, + struct xdp_buff *xdp, u32 act) +{ + int err; + + switch (act) { + case XDP_REDIRECT: + err = xdp_do_redirect(tun->dev, xdp, xdp_prog); + if (err) + return err; + break; + case XDP_TX: + err = tun_xdp_tx(tun->dev, xdp); + if (err < 0) + return err; + break; + case XDP_PASS: + break; + default: + bpf_warn_invalid_xdp_action(act); + fallthrough; + case XDP_ABORTED: + trace_xdp_exception(tun->dev, xdp_prog, act); + fallthrough; + case XDP_DROP: + this_cpu_inc(tun->pcpu_stats->rx_dropped); + break; + } + + return act; +} + static struct sk_buff *tun_build_skb(struct tun_struct *tun, struct tun_file *tfile, struct iov_iter *from, @@ -1615,18 +1603,17 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun, int len, int *skb_xdp) { struct page_frag *alloc_frag = ¤t->task_frag; - struct sk_buff *skb; struct bpf_prog *xdp_prog; int buflen = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); - unsigned int delta = 0; char *buf; size_t copied; - int err, pad = TUN_RX_PAD; + int pad = TUN_RX_PAD; + int err = 0; rcu_read_lock(); xdp_prog = rcu_dereference(tun->xdp_prog); if (xdp_prog) - pad += TUN_HEADROOM; + pad += XDP_PACKET_HEADROOM; buflen += SKB_DATA_ALIGN(len + pad); rcu_read_unlock(); @@ -1645,17 +1632,19 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun, * of xdp_prog above, this should be rare and for simplicity * we do XDP on skb in case the headroom is not enough. */ - if (hdr->gso_type || !xdp_prog) + if (hdr->gso_type || !xdp_prog) { *skb_xdp = 1; - else - *skb_xdp = 0; + return __tun_build_skb(tfile, alloc_frag, buf, buflen, len, + pad); + } + + *skb_xdp = 0; local_bh_disable(); rcu_read_lock(); xdp_prog = rcu_dereference(tun->xdp_prog); - if (xdp_prog && !*skb_xdp) { + if (xdp_prog) { struct xdp_buff xdp; - void *orig_data; u32 act; xdp.data_hard_start = buf; @@ -1663,67 +1652,36 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun, xdp_set_data_meta_invalid(&xdp); xdp.data_end = xdp.data + len; xdp.rxq = &tfile->xdp_rxq; - orig_data = xdp.data; - act = bpf_prog_run_xdp(xdp_prog, &xdp); + xdp.frame_sz = buflen; - switch (act) { - case XDP_REDIRECT: - get_page(alloc_frag->page); - alloc_frag->offset += buflen; - err = xdp_do_redirect(tun->dev, &xdp, xdp_prog); - xdp_do_flush_map(); - if (err) - goto err_redirect; - rcu_read_unlock(); - local_bh_enable(); - return NULL; - case XDP_TX: + act = bpf_prog_run_xdp(xdp_prog, &xdp); + if (act == XDP_REDIRECT || act == XDP_TX) { get_page(alloc_frag->page); alloc_frag->offset += buflen; - if (tun_xdp_tx(tun->dev, &xdp) < 0) - goto err_redirect; - rcu_read_unlock(); - local_bh_enable(); - return NULL; - case XDP_PASS: - delta = orig_data - xdp.data; - len = xdp.data_end - xdp.data; - break; - default: - bpf_warn_invalid_xdp_action(act); - /* fall through */ - case XDP_ABORTED: - trace_xdp_exception(tun->dev, xdp_prog, act); - /* fall through */ - case XDP_DROP: - goto err_xdp; } - } - - skb = build_skb(buf, buflen); - if (!skb) { - rcu_read_unlock(); - local_bh_enable(); - return ERR_PTR(-ENOMEM); - } + err = tun_xdp_act(tun, xdp_prog, &xdp, act); + if (err < 0) { + if (act == XDP_REDIRECT || act == XDP_TX) + put_page(alloc_frag->page); + goto out; + } - skb_reserve(skb, pad - delta); - skb_put(skb, len); - skb_set_owner_w(skb, tfile->socket.sk); - get_page(alloc_frag->page); - alloc_frag->offset += buflen; + if (err == XDP_REDIRECT) + xdp_do_flush(); + if (err != XDP_PASS) + goto out; + pad = xdp.data - xdp.data_hard_start; + len = xdp.data_end - xdp.data; + } rcu_read_unlock(); local_bh_enable(); - return skb; + return __tun_build_skb(tfile, alloc_frag, buf, buflen, len, pad); -err_redirect: - put_page(alloc_frag->page); -err_xdp: +out: rcu_read_unlock(); local_bh_enable(); - this_cpu_inc(tun->pcpu_stats->rx_dropped); return NULL; } @@ -1895,8 +1853,11 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, skb->dev = tun->dev; break; case IFF_TAP: - if (!frags) - skb->protocol = eth_type_trans(skb, tun->dev); + if (frags && !pskb_may_pull(skb, ETH_HLEN)) { + err = -ENOMEM; + goto drop; + } + skb->protocol = eth_type_trans(skb, tun->dev); break; } @@ -1911,7 +1872,8 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, } skb_reset_network_header(skb); - skb_probe_transport_header(skb, 0); + skb_probe_transport_header(skb); + skb_record_rx_queue(skb, tfile->queue_index); if (skb_xdp) { struct bpf_prog *xdp_prog; @@ -1925,6 +1887,10 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, if (ret != XDP_PASS) { rcu_read_unlock(); local_bh_enable(); + if (frags) { + tfile->napi.skb = NULL; + mutex_unlock(&tfile->napi_mutex); + } return total_len; } } @@ -1948,8 +1914,12 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, } if (frags) { + u32 headlen; + /* Exercise flow dissector code path. */ - u32 headlen = eth_get_headlen(skb->data, skb_headlen(skb)); + skb_push(skb, ETH_HLEN); + headlen = eth_get_headlen(tun->dev, skb->data, + skb_headlen(skb)); if (unlikely(headlen > skb_headlen(skb))) { this_cpu_inc(tun->pcpu_stats->rx_dropped); @@ -1986,8 +1956,8 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, stats = get_cpu_ptr(tun->pcpu_stats); u64_stats_update_begin(&stats->syncp); - stats->rx_packets++; - stats->rx_bytes += len; + u64_stats_inc(&stats->rx_packets); + u64_stats_add(&stats->rx_bytes, len); u64_stats_update_end(&stats->syncp); put_cpu_ptr(stats); @@ -2003,12 +1973,15 @@ static ssize_t tun_chr_write_iter(struct kiocb *iocb, struct iov_iter *from) struct tun_file *tfile = file->private_data; struct tun_struct *tun = tun_get(tfile); ssize_t result; + int noblock = 0; if (!tun) return -EBADFD; - result = tun_get_user(tun, tfile, NULL, from, - file->f_flags & O_NONBLOCK, false); + if ((file->f_flags & O_NONBLOCK) || (iocb->ki_flags & IOCB_NOWAIT)) + noblock = 1; + + result = tun_get_user(tun, tfile, NULL, from, noblock, false); tun_put(tun); return result; @@ -2040,8 +2013,8 @@ static ssize_t tun_put_user_xdp(struct tun_struct *tun, stats = get_cpu_ptr(tun->pcpu_stats); u64_stats_update_begin(&stats->syncp); - stats->tx_packets++; - stats->tx_bytes += ret; + u64_stats_inc(&stats->tx_packets); + u64_stats_add(&stats->tx_bytes, ret); u64_stats_update_end(&stats->syncp); put_cpu_ptr(tun->pcpu_stats); @@ -2135,8 +2108,8 @@ static ssize_t tun_put_user(struct tun_struct *tun, /* caller is in process context, */ stats = get_cpu_ptr(tun->pcpu_stats); u64_stats_update_begin(&stats->syncp); - stats->tx_packets++; - stats->tx_bytes += skb->len + vlan_hlen; + u64_stats_inc(&stats->tx_packets); + u64_stats_add(&stats->tx_bytes, skb->len + vlan_hlen); u64_stats_update_end(&stats->syncp); put_cpu_ptr(tun->pcpu_stats); @@ -2157,7 +2130,7 @@ static void *tun_ring_recv(struct tun_file *tfile, int noblock, int *err) goto out; } - add_wait_queue(&tfile->wq.wait, &wait); + add_wait_queue(&tfile->socket.wq.wait, &wait); while (1) { set_current_state(TASK_INTERRUPTIBLE); @@ -2177,7 +2150,7 @@ static void *tun_ring_recv(struct tun_file *tfile, int noblock, int *err) } __set_current_state(TASK_RUNNING); - remove_wait_queue(&tfile->wq.wait, &wait); + remove_wait_queue(&tfile->socket.wq.wait, &wait); out: *err = error; @@ -2191,8 +2164,6 @@ static ssize_t tun_do_read(struct tun_struct *tun, struct tun_file *tfile, ssize_t ret; int err; - tun_debug(KERN_INFO, tun, "tun_do_read\n"); - if (!iov_iter_count(to)) { tun_ptr_free(ptr); return 0; @@ -2229,10 +2200,15 @@ static ssize_t tun_chr_read_iter(struct kiocb *iocb, struct iov_iter *to) struct tun_file *tfile = file->private_data; struct tun_struct *tun = tun_get(tfile); ssize_t len = iov_iter_count(to), ret; + int noblock = 0; if (!tun) return -EBADFD; - ret = tun_do_read(tun, tfile, to, file->f_flags & O_NONBLOCK, NULL); + + if ((file->f_flags & O_NONBLOCK) || (iocb->ki_flags & IOCB_NOWAIT)) + noblock = 1; + + ret = tun_do_read(tun, tfile, to, noblock, NULL); ret = min_t(ssize_t, ret, len); if (ret > 0) iocb->ki_pos = ret; @@ -2278,7 +2254,13 @@ static void tun_free_netdev(struct net_device *dev) struct tun_struct *tun = netdev_priv(dev); BUG_ON(!(list_empty(&tun->disabled))); + free_percpu(tun->pcpu_stats); + /* We clear pcpu_stats so that tun_set_iff() can tell if + * tun_free_netdev() has been called from register_netdevice(). + */ + tun->pcpu_stats = NULL; + tun_flow_uninit(tun); security_tun_dev_free_security(tun->security); __tun_set_ebpf(tun, &tun->steering_prog, NULL); @@ -2394,18 +2376,159 @@ static void tun_sock_write_space(struct sock *sk) kill_fasync(&tfile->fasync, SIGIO, POLL_OUT); } +static void tun_put_page(struct tun_page *tpage) +{ + if (tpage->page) + __page_frag_cache_drain(tpage->page, tpage->count); +} + +static int tun_xdp_one(struct tun_struct *tun, + struct tun_file *tfile, + struct xdp_buff *xdp, int *flush, + struct tun_page *tpage) +{ + unsigned int datasize = xdp->data_end - xdp->data; + struct tun_xdp_hdr *hdr = xdp->data_hard_start; + struct virtio_net_hdr *gso = &hdr->gso; + struct tun_pcpu_stats *stats; + struct bpf_prog *xdp_prog; + struct sk_buff *skb = NULL; + u32 rxhash = 0, act; + int buflen = hdr->buflen; + int err = 0; + bool skb_xdp = false; + struct page *page; + + xdp_prog = rcu_dereference(tun->xdp_prog); + if (xdp_prog) { + if (gso->gso_type) { + skb_xdp = true; + goto build; + } + xdp_set_data_meta_invalid(xdp); + xdp->rxq = &tfile->xdp_rxq; + xdp->frame_sz = buflen; + + act = bpf_prog_run_xdp(xdp_prog, xdp); + err = tun_xdp_act(tun, xdp_prog, xdp, act); + if (err < 0) { + put_page(virt_to_head_page(xdp->data)); + return err; + } + + switch (err) { + case XDP_REDIRECT: + *flush = true; + fallthrough; + case XDP_TX: + return 0; + case XDP_PASS: + break; + default: + page = virt_to_head_page(xdp->data); + if (tpage->page == page) { + ++tpage->count; + } else { + tun_put_page(tpage); + tpage->page = page; + tpage->count = 1; + } + return 0; + } + } + +build: + skb = build_skb(xdp->data_hard_start, buflen); + if (!skb) { + err = -ENOMEM; + goto out; + } + + skb_reserve(skb, xdp->data - xdp->data_hard_start); + skb_put(skb, xdp->data_end - xdp->data); + + if (virtio_net_hdr_to_skb(skb, gso, tun_is_little_endian(tun))) { + this_cpu_inc(tun->pcpu_stats->rx_frame_errors); + kfree_skb(skb); + err = -EINVAL; + goto out; + } + + skb->protocol = eth_type_trans(skb, tun->dev); + skb_reset_network_header(skb); + skb_probe_transport_header(skb); + skb_record_rx_queue(skb, tfile->queue_index); + + if (skb_xdp) { + err = do_xdp_generic(xdp_prog, skb); + if (err != XDP_PASS) + goto out; + } + + if (!rcu_dereference(tun->steering_prog) && tun->numqueues > 1 && + !tfile->detached) + rxhash = __skb_get_hash_symmetric(skb); + + netif_receive_skb(skb); + + /* No need for get_cpu_ptr() here since this function is + * always called with bh disabled + */ + stats = this_cpu_ptr(tun->pcpu_stats); + u64_stats_update_begin(&stats->syncp); + u64_stats_inc(&stats->rx_packets); + u64_stats_add(&stats->rx_bytes, datasize); + u64_stats_update_end(&stats->syncp); + + if (rxhash) + tun_flow_update(tun, rxhash, tfile); + +out: + return err; +} + static int tun_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len) { - int ret; + int ret, i; struct tun_file *tfile = container_of(sock, struct tun_file, socket); struct tun_struct *tun = tun_get(tfile); + struct tun_msg_ctl *ctl = m->msg_control; + struct xdp_buff *xdp; if (!tun) return -EBADFD; - ret = tun_get_user(tun, tfile, m->msg_control, &m->msg_iter, + if (ctl && (ctl->type == TUN_MSG_PTR)) { + struct tun_page tpage; + int n = ctl->num; + int flush = 0; + + memset(&tpage, 0, sizeof(tpage)); + + local_bh_disable(); + rcu_read_lock(); + + for (i = 0; i < n; i++) { + xdp = &((struct xdp_buff *)ctl->ptr)[i]; + tun_xdp_one(tun, tfile, xdp, &flush, &tpage); + } + + if (flush) + xdp_do_flush(); + + rcu_read_unlock(); + local_bh_enable(); + + tun_put_page(&tpage); + + ret = total_len; + goto out; + } + + ret = tun_get_user(tun, tfile, ctl ? ctl->ptr : NULL, &m->msg_iter, m->msg_flags & MSG_DONTWAIT, m->msg_flags & MSG_MORE); +out: tun_put(tun); return ret; } @@ -2580,7 +2703,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) err = tun_attach(tun, file, ifr->ifr_flags & IFF_NOFILTER, ifr->ifr_flags & IFF_NAPI, - ifr->ifr_flags & IFF_NAPI_FRAGS); + ifr->ifr_flags & IFF_NAPI_FRAGS, true); if (err < 0) return err; @@ -2630,9 +2753,6 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) if (!dev) return -ENOMEM; - err = dev_get_valid_name(net, dev, name); - if (err < 0) - goto err_free_dev; dev_net_set(dev, net); dev->rtnl_link_ops = &tun_link_ops; @@ -2679,19 +2799,21 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) INIT_LIST_HEAD(&tun->disabled); err = tun_attach(tun, file, false, ifr->ifr_flags & IFF_NAPI, - ifr->ifr_flags & IFF_NAPI_FRAGS); + ifr->ifr_flags & IFF_NAPI_FRAGS, false); if (err < 0) goto err_free_flow; err = register_netdevice(tun->dev); if (err < 0) goto err_detach; + /* free_netdev() won't check refcnt, to aovid race + * with dev_put() we need publish tun after registration. + */ + rcu_assign_pointer(tfile->tun, tun); } netif_carrier_on(tun->dev); - tun_debug(KERN_INFO, tun, "tun_set_iff\n"); - /* Make sure persistent devices do not get stuck in * xoff state. */ @@ -2703,8 +2825,12 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) err_detach: tun_detach_all(dev); - /* register_netdevice() already called tun_free_netdev() */ - goto err_free_dev; + /* We are here because register_netdevice() has failed. + * If register_netdevice() already called tun_free_netdev() + * while dealing with the error, tun->pcpu_stats has been cleared. + */ + if (!tun->pcpu_stats) + goto err_free_dev; err_free_flow: tun_flow_uninit(tun); @@ -2716,11 +2842,8 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) return err; } -static void tun_get_iff(struct net *net, struct tun_struct *tun, - struct ifreq *ifr) +static void tun_get_iff(struct tun_struct *tun, struct ifreq *ifr) { - tun_debug(KERN_INFO, tun, "tun_get_iff\n"); - strcpy(ifr->ifr_name, tun->dev->name); ifr->ifr_flags = tun_flags(tun); @@ -2829,7 +2952,7 @@ static int tun_set_queue(struct file *file, struct ifreq *ifr) if (ret < 0) goto unlock; ret = tun_attach(tun, file, false, tun->flags & IFF_NAPI, - tun->flags & IFF_NAPI_FRAGS); + tun->flags & IFF_NAPI_FRAGS, true); } else if (ifr->ifr_flags & IFF_DETACH_QUEUE) { tun = rtnl_dereference(tfile->tun); if (!tun || !(tun->flags & IFF_MULTI_QUEUE) || tfile->detached) @@ -2847,7 +2970,7 @@ static int tun_set_queue(struct file *file, struct ifreq *ifr) return ret; } -static int tun_set_ebpf(struct tun_struct *tun, struct tun_prog **prog_p, +static int tun_set_ebpf(struct tun_struct *tun, struct tun_prog __rcu **prog_p, void __user *data) { struct bpf_prog *prog; @@ -2874,12 +2997,12 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, struct net *net = sock_net(&tfile->sk); struct tun_struct *tun; void __user* argp = (void __user*)arg; + unsigned int ifindex, carrier; struct ifreq ifr; kuid_t owner; kgid_t group; int sndbuf; int vnet_hdr_sz; - unsigned int ifindex; int le; int ret; bool do_notify = false; @@ -2944,12 +3067,13 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, if (!tun) goto unlock; - tun_debug(KERN_INFO, tun, "tun_chr_ioctl cmd %u\n", cmd); + netif_info(tun, drv, tun->dev, "tun_chr_ioctl cmd %u\n", cmd); + net = dev_net(tun->dev); ret = 0; switch (cmd) { case TUNGETIFF: - tun_get_iff(current->nsproxy->net_ns, tun, &ifr); + tun_get_iff(tun, &ifr); if (tfile->detached) ifr.ifr_flags |= IFF_DETACH_QUEUE; @@ -2964,8 +3088,8 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, /* Disable/Enable checksum */ /* [unimplemented] */ - tun_debug(KERN_INFO, tun, "ignored: set checksum %s\n", - arg ? "disabled" : "enabled"); + netif_info(tun, drv, tun->dev, "ignored: set checksum %s\n", + arg ? "disabled" : "enabled"); break; case TUNSETPERSIST: @@ -2983,8 +3107,8 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, do_notify = true; } - tun_debug(KERN_INFO, tun, "persist %s\n", - arg ? "enabled" : "disabled"); + netif_info(tun, drv, tun->dev, "persist %s\n", + arg ? "enabled" : "disabled"); break; case TUNSETOWNER: @@ -2996,8 +3120,8 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, } tun->owner = owner; do_notify = true; - tun_debug(KERN_INFO, tun, "owner set to %u\n", - from_kuid(&init_user_ns, tun->owner)); + netif_info(tun, drv, tun->dev, "owner set to %u\n", + from_kuid(&init_user_ns, tun->owner)); break; case TUNSETGROUP: @@ -3009,29 +3133,28 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, } tun->group = group; do_notify = true; - tun_debug(KERN_INFO, tun, "group set to %u\n", - from_kgid(&init_user_ns, tun->group)); + netif_info(tun, drv, tun->dev, "group set to %u\n", + from_kgid(&init_user_ns, tun->group)); break; case TUNSETLINK: /* Only allow setting the type when the interface is down */ if (tun->dev->flags & IFF_UP) { - tun_debug(KERN_INFO, tun, - "Linktype set failed because interface is up\n"); + netif_info(tun, drv, tun->dev, + "Linktype set failed because interface is up\n"); ret = -EBUSY; } else { tun->dev->type = (int) arg; - tun_debug(KERN_INFO, tun, "linktype set to %d\n", - tun->dev->type); + netif_info(tun, drv, tun->dev, "linktype set to %d\n", + tun->dev->type); ret = 0; } break; -#ifdef TUN_DEBUG case TUNSETDEBUG: - tun->debug = arg; + tun->msg_enable = (u32)arg; break; -#endif + case TUNSETOFFLOAD: ret = set_offload(tun, arg); break; @@ -3054,10 +3177,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, case SIOCSIFHWADDR: /* Set hw address */ - tun_debug(KERN_DEBUG, tun, "set hw address: %pM\n", - ifr.ifr_hwaddr.sa_data); - - ret = dev_set_mac_address(tun->dev, &ifr.ifr_hwaddr); + ret = dev_set_mac_address(tun->dev, &ifr.ifr_hwaddr, NULL); break; case TUNGETSNDBUF: @@ -3163,6 +3283,21 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, ret = tun_set_ebpf(tun, &tun->filter_prog, argp); break; + case TUNSETCARRIER: + ret = -EFAULT; + if (copy_from_user(&carrier, argp, sizeof(carrier))) + goto unlock; + + ret = tun_net_change_carrier(tun->dev, (bool)carrier); + break; + + case TUNGETDEVNETNS: + ret = -EPERM; + if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) + goto unlock; + ret = open_related_ns(&net->ns, get_net_ns); + break; + default: ret = -EINVAL; break; @@ -3236,8 +3371,6 @@ static int tun_chr_open(struct inode *inode, struct file * file) struct net *net = current->nsproxy->net_ns; struct tun_file *tfile; - DBG1(KERN_INFO, "tunX: tun_chr_open\n"); - tfile = (struct tun_file *)sk_alloc(net, AF_UNSPEC, GFP_KERNEL, &tun_proto, 0); if (!tfile) @@ -3252,8 +3385,7 @@ static int tun_chr_open(struct inode *inode, struct file * file) tfile->flags = 0; tfile->ifindex = 0; - init_waitqueue_head(&tfile->wq.wait); - RCU_INIT_POINTER(tfile->socket.wq, &tfile->wq); + init_waitqueue_head(&tfile->socket.wq.wait); tfile->socket.file = file; tfile->socket.ops = &tun_socket_ops; @@ -3292,7 +3424,7 @@ static void tun_chr_show_fdinfo(struct seq_file *m, struct file *file) rtnl_lock(); tun = tun_get(tfile); if (tun) - tun_get_iff(current->nsproxy->net_ns, tun, &ifr); + tun_get_iff(tun, &ifr); rtnl_unlock(); if (tun) @@ -3378,20 +3510,16 @@ static void tun_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info static u32 tun_get_msglevel(struct net_device *dev) { -#ifdef TUN_DEBUG struct tun_struct *tun = netdev_priv(dev); - return tun->debug; -#else - return -EOPNOTSUPP; -#endif + + return tun->msg_enable; } static void tun_set_msglevel(struct net_device *dev, u32 value) { -#ifdef TUN_DEBUG struct tun_struct *tun = netdev_priv(dev); - tun->debug = value; -#endif + + tun->msg_enable = value; } static int tun_get_coalesce(struct net_device *dev, @@ -3418,6 +3546,7 @@ static int tun_set_coalesce(struct net_device *dev, } static const struct ethtool_ops tun_ethtool_ops = { + .supported_coalesce_params = ETHTOOL_COALESCE_RX_MAX_FRAMES, .get_drvinfo = tun_get_drvinfo, .get_msglevel = tun_get_msglevel, .set_msglevel = tun_set_msglevel, @@ -3566,4 +3695,4 @@ MODULE_DESCRIPTION(DRV_DESCRIPTION); MODULE_AUTHOR(DRV_COPYRIGHT); MODULE_LICENSE("GPL"); MODULE_ALIAS_MISCDEV(BF_TUN_MINOR); -MODULE_ALIAS("devname:net/bf_tun"); +MODULE_ALIAS("devname:net/bf_tun"); \ No newline at end of file diff --git a/platform/barefoot/bfn-platform.mk b/platform/barefoot/bfn-platform.mk index a34a6c02f18e..7ea4cbcd5cb8 100644 --- a/platform/barefoot/bfn-platform.mk +++ b/platform/barefoot/bfn-platform.mk @@ -1,4 +1,4 @@ -BFN_PLATFORM = bfnplatform_20210811_sai.1.8.1_deb10.deb +BFN_PLATFORM = bfnplatform_20220127_sai_1.9.1_deb10.deb $(BFN_PLATFORM)_URL = "https://github.com/barefootnetworks/sonic-release-pkgs/raw/dev/$(BFN_PLATFORM)" SONIC_ONLINE_DEBS += $(BFN_PLATFORM) diff --git a/platform/barefoot/bfn-sai.mk b/platform/barefoot/bfn-sai.mk index 31aa9115388c..c61abeb0ae5d 100644 --- a/platform/barefoot/bfn-sai.mk +++ b/platform/barefoot/bfn-sai.mk @@ -1,4 +1,4 @@ -BFN_SAI = bfnsdk_20210811_sai.1.8.1_deb10.deb +BFN_SAI = bfnsdk_20220127_sai_1.9.1_deb10.deb $(BFN_SAI)_URL = "https://github.com/barefootnetworks/sonic-release-pkgs/raw/dev/$(BFN_SAI)" $(BFN_SAI)_DEPENDS += $(LIBNL_GENL3_DEV) diff --git a/platform/barefoot/docker-syncd-bfn-rpc.mk b/platform/barefoot/docker-syncd-bfn-rpc.mk index 1203c99aa7a5..a2a741cea1e1 100644 --- a/platform/barefoot/docker-syncd-bfn-rpc.mk +++ b/platform/barefoot/docker-syncd-bfn-rpc.mk @@ -2,7 +2,7 @@ DOCKER_SYNCD_BFN_RPC = docker-syncd-bfn-rpc.gz $(DOCKER_SYNCD_BFN_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-bfn-rpc -$(DOCKER_SYNCD_BFN_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) $(PTF) +$(DOCKER_SYNCD_BFN_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT_0_14_1) $(PTF) $(DOCKER_SYNCD_BFN_RPC)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) ifeq ($(INSTALL_DEBUG_TOOLS), y) $(DOCKER_SYNCD_BFN_RPC)_DEPENDS += $(SYNCD_RPC_DBG) \ @@ -12,12 +12,13 @@ $(DOCKER_SYNCD_BFN_RPC)_DEPENDS += $(SYNCD_RPC_DBG) \ endif $(DOCKER_SYNCD_BFN_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_BFN_RPC) +SONIC_BUSTER_DOCKERS += $(DOCKER_SYNCD_BFN_RPC) ifeq ($(ENABLE_SYNCD_RPC),y) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BFN_RPC) endif $(DOCKER_SYNCD_BFN_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_BFN_RPC)_VERSION = 1.0.0-rpc +$(DOCKER_SYNCD_BFN_RPC)_VERSION = 1.0.0+rpc $(DOCKER_SYNCD_BFN_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_BFN_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_BFN_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/barefoot/docker-syncd-bfn.mk b/platform/barefoot/docker-syncd-bfn.mk index 16b3085aa293..c1cda4e3bef1 100644 --- a/platform/barefoot/docker-syncd-bfn.mk +++ b/platform/barefoot/docker-syncd-bfn.mk @@ -15,3 +15,5 @@ $(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 $(DOCKER_SYNCD_BASE)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot + +SONIC_BUSTER_DOCKERS += $(DOCKER_SYNCD_BASE) diff --git a/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 b/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 index 7071b0c8b51e..e085ef130aed 100755 --- a/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 +++ b/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 @@ -22,6 +22,7 @@ RUN apt-get install -y \ libunwind8-dev \ libpython3.4 \ libc-ares2 \ + libedit2 \ libgoogle-perftools4 RUN dpkg -i \ diff --git a/platform/barefoot/libsaithrift-dev.mk b/platform/barefoot/libsaithrift-dev.mk index 0289a41b2910..0fb5ca0cb81d 100644 --- a/platform/barefoot/libsaithrift-dev.mk +++ b/platform/barefoot/libsaithrift-dev.mk @@ -1,18 +1,23 @@ # libsaithrift-dev package - SAI_VER = 0.9.4 - -LIBSAITHRIFT_DEV = libsaithrift-dev_$(SAI_VER)_amd64.deb +LIBSAITHRIFT_DEV = libsaithrift-dev_$(SAI_VER)_$(CONFIGURED_ARCH).deb $(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI -$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(BFN_SAI) $(BFN_SAI_DEV) -$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT) $(BFN_SAI) +$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT_0_14_1) $(LIBTHRIFT_0_14_1_DEV) \ + $(PYTHON3_THRIFT_0_14_1) $(THRIFT_0_14_1_COMPILER) \ + $(BFN_SAI) + +#$(LIBSAIVS) $(LIBSAIVS_DEV) $(LIBSAIMETADATA) $(LIBSAIMETADATA_DEV) + +# $(LIBSAITHRIFT_DEV)_BUILD_ENV = platform=v + +$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT_0_14_1) $(BFN_SAI) SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV) PYTHON_SAITHRIFT = python-saithrift_$(SAI_VER)_amd64.deb $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(PYTHON_SAITHRIFT))) SAISERVER = saiserver_$(SAI_VER)_amd64.deb -$(SAISERVER)_RDEPENDS += $(LIBTHRIFT) $(BRCM_SAI) +$(SAISERVER)_RDEPENDS += $(LIBTHRIFT_0_14_1) $(BFN_SAI) $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER))) SAISERVER_DBG = saiserver-dbg_$(SAI_VER)_amd64.deb diff --git a/platform/barefoot/one-aboot.mk b/platform/barefoot/one-aboot.mk index a2cdf2ac0391..6e3f3cdb228a 100644 --- a/platform/barefoot/one-aboot.mk +++ b/platform/barefoot/one-aboot.mk @@ -4,12 +4,13 @@ SONIC_ONE_ABOOT_IMAGE = sonic-aboot-barefoot.swi $(SONIC_ONE_ABOOT_IMAGE)_MACHINE = barefoot $(SONIC_ONE_ABOOT_IMAGE)_IMAGE_TYPE = aboot $(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(BFN_MODULE) +$(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(FLASHROM) $(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR) $(SONIC_ONE_ABOOT_IMAGE)_LAZY_INSTALLS += $(BFN_PLATFORM_MODULE) $(SONIC_ONE_ABOOT_IMAGE)_LAZY_INSTALLS += $(BFN_MONTARA_PLATFORM_MODULE) -$(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(ARISTA_PLATFORM_MODULE_DRIVERS) \ - $(ARISTA_PLATFORM_MODULE_PYTHON2) \ - $(ARISTA_PLATFORM_MODULE_PYTHON3) \ +$(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(ARISTA_PLATFORM_MODULE_PYTHON3) \ + $(ARISTA_PLATFORM_MODULE_DRIVERS) \ + $(ARISTA_PLATFORM_MODULE_LIBS) \ $(ARISTA_PLATFORM_MODULE) ifeq ($(INSTALL_DEBUG_TOOLS),y) $(SONIC_ONE_ABOOT_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_DBG_IMAGES) diff --git a/platform/barefoot/one-image.mk b/platform/barefoot/one-image.mk index 8ed212c6f7a8..a4565b47916b 100644 --- a/platform/barefoot/one-image.mk +++ b/platform/barefoot/one-image.mk @@ -12,6 +12,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(BFN_NEWPORT_BF_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(WNC_OSW1800_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(INGRASYS_S9180_32X_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(INGRASYS_S9280_64X_PLATFORM_MODULE) +$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(BFN_MONTARA_QS_PLATFORM_MODULE) ifeq ($(INSTALL_DEBUG_TOOLS),y) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_DBG_IMAGES) $(SONIC_ONE_IMAGE)_DOCKERS += $(filter-out $(patsubst %-$(DBG_IMAGE_MARK).gz,%.gz, $(SONIC_INSTALL_DOCKER_DBG_IMAGES)), $(SONIC_INSTALL_DOCKER_IMAGES)) diff --git a/platform/barefoot/platform-modules-accton.mk b/platform/barefoot/platform-modules-accton.mk new file mode 100644 index 000000000000..077c23d7bfd6 --- /dev/null +++ b/platform/barefoot/platform-modules-accton.mk @@ -0,0 +1,11 @@ +# BFN Platform modules + +BFN_MONTARA_QS_PLATFORM_MODULE_VERSION = 1.1 + +export BFN_MONTARA_QS_PLATFORM_MODULE_VERSION + +BFN_MONTARA_QS_PLATFORM_MODULE = sonic-platform-accton-wedge100bf-32qs_$(BFN_MONTARA_QS_PLATFORM_MODULE_VERSION)_amd64.deb +$(BFN_MONTARA_QS_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-accton +$(BFN_MONTARA_QS_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(BFN_MONTARA_QS_PLATFORM_MODULE)_PLATFORM = x86_64-accton_wedge100bf_32qs-r0 +SONIC_DPKG_DEBS += $(BFN_MONTARA_QS_PLATFORM_MODULE) diff --git a/platform/barefoot/platform-modules-arista.mk b/platform/barefoot/platform-modules-arista.mk index 298bc93d9250..3049e946736e 100644 --- a/platform/barefoot/platform-modules-arista.mk +++ b/platform/barefoot/platform-modules-arista.mk @@ -9,15 +9,16 @@ $(ARISTA_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-ari $(ARISTA_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) SONIC_DPKG_DEBS += $(ARISTA_PLATFORM_MODULE) -ARISTA_PLATFORM_MODULE_PYTHON2 = python-sonic-platform-arista_$(ARISTA_PLATFORM_MODULE_VERSION)_all.deb -$(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODULE_PYTHON2))) - ARISTA_PLATFORM_MODULE_PYTHON3 = python3-sonic-platform-arista_$(ARISTA_PLATFORM_MODULE_VERSION)_all.deb $(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODULE_PYTHON3))) ARISTA_PLATFORM_MODULE_DRIVERS = drivers-sonic-platform-arista_$(ARISTA_PLATFORM_MODULE_VERSION)_amd64.deb $(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODULE_DRIVERS))) -export ARISTA_PLATFORM_MODULE ARISTA_PLATFORM_MODULE_PYTHON2 ARISTA_PLATFORM_MODULE_PYTHON3 ARISTA_PLATFORM_MODULE_DRIVERS +ARISTA_PLATFORM_MODULE_LIBS = sonic-platform-arista-libs_$(ARISTA_PLATFORM_MODULE_VERSION)_amd64.deb +$(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODULE_LIBS))) -export ARISTA_SCD_DRIVER_CONFIG=m +export ARISTA_PLATFORM_MODULE \ + ARISTA_PLATFORM_MODULE_PYTHON3 \ + ARISTA_PLATFORM_MODULE_DRIVERS \ + ARISTA_PLATFORM_MODULE_LIBS diff --git a/platform/barefoot/rules.mk b/platform/barefoot/rules.mk index 98dcef0f7b8a..8e717ba49ec6 100644 --- a/platform/barefoot/rules.mk +++ b/platform/barefoot/rules.mk @@ -1,6 +1,7 @@ include $(PLATFORM_PATH)/platform-modules-arista.mk include $(PLATFORM_PATH)/platform-modules-bfn.mk include $(PLATFORM_PATH)/platform-modules-bfn-montara.mk +include $(PLATFORM_PATH)/platform-modules-accton.mk include $(PLATFORM_PATH)/platform-modules-bfn-newport.mk include $(PLATFORM_PATH)/platform-modules-wnc-osw1800.mk include $(PLATFORM_PATH)/platform-modules-ingrasys.mk @@ -24,7 +25,8 @@ $(SYNCD)_DEPENDS += $(BFN_SAI) $(BFN_INGRASYS_PLATFORM) $(BFN_PLATFORM) $(SYNCD)_UNINSTALLS += $(BFN_SAI) ifeq ($(ENABLE_SYNCD_RPC),y) -$(SYNCD)_DEPENDS += $(LIBSAITHRIFT_DEV) +$(SYNCD)_DEPENDS := $(filter-out $(LIBTHRIFT_DEV),$($(SYNCD)_DEPENDS)) +$(SYNCD)_DEPENDS += $(LIBSAITHRIFT_DEV) $(LIBTHRIFT_0_14_1_DEV) endif # Runtime dependency on sai is set only for syncd diff --git a/platform/barefoot/sonic-platform-modules-accton/debian/changelog b/platform/barefoot/sonic-platform-modules-accton/debian/changelog new file mode 100644 index 000000000000..8cbad8e1f551 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-accton/debian/changelog @@ -0,0 +1,11 @@ +sonic-accton-platform-modules (1.1) unstable; urgency=low + + * Remove bfn asic kernel modules from platform package + + -- Support Mon, 22 Oct 2018 15:40:00 -0800 + +sonic-accton-platform-modules (1.0) unstable; urgency=low + + * Initial release + + -- Support Mon, 11 Nov 2015 11:11:11 -0800 diff --git a/platform/barefoot/sonic-platform-modules-accton/debian/compat b/platform/barefoot/sonic-platform-modules-accton/debian/compat new file mode 100644 index 000000000000..ec635144f600 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-accton/debian/compat @@ -0,0 +1 @@ +9 diff --git a/platform/barefoot/sonic-platform-modules-accton/debian/control b/platform/barefoot/sonic-platform-modules-accton/debian/control new file mode 100644 index 000000000000..ba76bc7cfa3f --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-accton/debian/control @@ -0,0 +1,12 @@ +Source: sonic-accton-platform-modules +Section: main +Priority: extra +Maintainer: Support +Build-Depends: debhelper (>= 9.0.0), bzip2 +Standards-Version: 3.9.3 + +Package: sonic-platform-accton-wedge100bf-32qs +Architecture: amd64 +Depends: linux-image-4.19.0-12-2-amd64-unsigned +Description: kernel modules for platform devices such as fan, led, sfp + diff --git a/platform/barefoot/sonic-platform-modules-accton/debian/rules b/platform/barefoot/sonic-platform-modules-accton/debian/rules new file mode 100755 index 000000000000..35fdb0d5bdbe --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-accton/debian/rules @@ -0,0 +1,110 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +include /usr/share/dpkg/pkg-info.mk + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +export INSTALL_MOD_DIR:=extra + +PYTHON ?= python2 +PYTHON3 ?= python3 + +PACKAGE_PRE_NAME := sonic-platform-accton +KVERSION ?= $(shell uname -r) +KERNEL_SRC := /lib/modules/$(KVERSION) +MOD_SRC_DIR:= $(shell pwd) +MODULE_DIRS := wedge100bf-32qs +MODULE_DIR := modules +UTILS_DIR := utils +SERVICE_DIR := service +CONF_DIR := conf + +%: + dh $@ --with systemd,python2,python3 --buildsystem=pybuild + +clean: + dh_testdir + dh_testroot + dh_clean + +build: + #make modules -C $(KERNEL_SRC)/build M=$(MODULE_SRC) + (for mod in $(MODULE_DIRS); do \ + make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ + $(PYTHON) $${mod}/setup.py build; \ + cd $(MOD_SRC_DIR)/$${mod}; \ + if [ -f sonic_platform_setup.py ]; then \ + $(PYTHON3) sonic_platform_setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}; \ + echo "Finished makig whl package for $$mod"; \ + fi; \ + cd $(MOD_SRC_DIR); \ + done) + +binary: binary-arch binary-indep + # Nothing to do + +binary-arch: + # Nothing to do + +#install: build + #dh_testdir + #dh_testroot + #dh_clean -k + #dh_installdirs + +binary-indep: + dh_testdir + dh_installdirs + + # Custom package commands + (for mod in $(MODULE_DIRS); do \ + if [ -d $${mod}/$(MODULE_DIR) ]; then \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + fi; \ + if [ -d $${mod}/$(UTILS_DIR) ]; then \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} /usr/local/bin; \ + cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \ + fi; \ + if [ -d $${mod}/$(SERVICE_DIR) ]; then \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} /lib/systemd/system; \ + cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \ + fi; \ + if [ -f $${mod}/setup.py ]; then \ + $(PYTHON) $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \ + fi; \ + if [ -f $${mod}/sonic_platform_setup.py ]; then \ + cd $(MOD_SRC_DIR)/$${mod}; \ + $(PYTHON3) sonic_platform_setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \ + echo "Insalled whl package for $$mod"; \ + cd $(MOD_SRC_DIR); \ + fi; \ + if [ $$mod = "wedge100bf-32qs" ]; then \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} etc/network/interfaces.d; \ + cp $(MOD_SRC_DIR)/$${mod}/$(CONF_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/etc/network/interfaces.d; \ + fi; \ + done) + # Resuming debhelper scripts + dh_testroot + dh_install + dh_installchangelogs + dh_installdocs + dh_systemd_enable + dh_installinit + dh_systemd_start + dh_link + dh_fixperms + dh_compress + dh_strip + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb +.PHONY: build binary binary-arch binary-indep clean \ No newline at end of file diff --git a/platform/barefoot/sonic-platform-modules-accton/debian/sonic-platform-accton-wedge100bf-32qs.install b/platform/barefoot/sonic-platform-modules-accton/debian/sonic-platform-accton-wedge100bf-32qs.install new file mode 100644 index 000000000000..8a5e4a4bd64e --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-accton/debian/sonic-platform-accton-wedge100bf-32qs.install @@ -0,0 +1,2 @@ +wedge100bf-32qs/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-accton_wedge100bf_32qs-r0 + diff --git a/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/LICENSE b/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/LICENSE new file mode 100644 index 000000000000..676cdeec726b --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/LICENSE @@ -0,0 +1,15 @@ +Copyright (C) 2016 Microsoft, Inc + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/MAINTAINERS b/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/MAINTAINERS new file mode 100644 index 000000000000..3e69704ff6dd --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/MAINTAINERS @@ -0,0 +1,3 @@ +# This file describes the maintainers for wedge100bf-32qs +# See the SONiC project governance document for more information +Mailinglist = sonicproject@googlegroups.com diff --git a/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/README.md b/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/README.md new file mode 100644 index 000000000000..17d59593fbfb --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/README.md @@ -0,0 +1,2 @@ +# wedge100bf-32qs +Device drivers for support of BFN platform for the SONiC project diff --git a/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/classes/__init__.py b/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/classes/__init__.py new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/conf/usb0 b/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/conf/usb0 new file mode 100644 index 000000000000..f1dd054cc6f6 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/conf/usb0 @@ -0,0 +1,5 @@ +# BMC interface +auto usb0 +allow-hotplug usb0 +iface usb0 inet6 +up ifconfig usb0 txqueuelen 64 diff --git a/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/modules/Makefile b/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/modules/Makefile new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/setup.py b/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/setup.py new file mode 100755 index 000000000000..2c151a8a7bdd --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/setup.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +import os +from setuptools import setup +os.listdir + +setup( + name='wedge100bf-32qs', + version='1.0', + description='Module to initialize Accton wedge100bf-32qs platforms', + + packages=['wedge100bf-32qs'], + package_dir={'wedge100bf-32qs': 'wedge100bf-32qs/classes'}, +) diff --git a/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/sonic_platform b/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/sonic_platform new file mode 120000 index 000000000000..7d33d95d18bc --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/sonic_platform @@ -0,0 +1 @@ +../../sonic-platform-modules-bfn-montara/sonic_platform/ \ No newline at end of file diff --git a/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/sonic_platform_setup.py b/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/sonic_platform_setup.py new file mode 100644 index 000000000000..14e1bb6b6c02 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/sonic_platform_setup.py @@ -0,0 +1,32 @@ +from setuptools import setup + +setup( + name='sonic-platform', + version='1.0', + description='SONiC platform API implementation', + license='Apache 2.0', + author='SONiC Team', + author_email='', + url='https://github.com/Azure/sonic-buildimage', + maintainer='Barefoot', + maintainer_email='', + packages=[ + 'sonic_platform', + 'sonic_platform/pltfm_mgr_rpc', + 'sonic_platform/bfn_extensions', + ], + package_data = {'sonic_platform':['logging.conf']}, + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Environment :: Plugins', + 'Intended Audience :: Developers', + 'Intended Audience :: Information Technology', + 'Intended Audience :: System Administrators', + 'License :: OSI Approved :: Apache Software License', + 'Natural Language :: English', + 'Operating System :: POSIX :: Linux', + 'Programming Language :: Python :: 2.7', + 'Topic :: Utilities', + ], + keywords='sonic SONiC platform PLATFORM', +) diff --git a/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/utils/bf-fancontrol b/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/utils/bf-fancontrol new file mode 100755 index 000000000000..7407c2d7241d --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/utils/bf-fancontrol @@ -0,0 +1,3 @@ +#!/bin/bash + +python3 -m sonic_platform.bfn_extensions.platform_fancontrol "$@" diff --git a/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/utils/sensors b/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/utils/sensors new file mode 100755 index 000000000000..5f06a9c99b05 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-accton/wedge100bf-32qs/utils/sensors @@ -0,0 +1,11 @@ +#!/bin/bash + +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +python3 -m sonic_platform.bfn_extensions.platform_sensors "$@" +docker exec -$DOCKER_EXEC_FLAGS pmon sensors "$@" diff --git a/platform/barefoot/sonic-platform-modules-arista b/platform/barefoot/sonic-platform-modules-arista index 89018d062319..da8370423b07 160000 --- a/platform/barefoot/sonic-platform-modules-arista +++ b/platform/barefoot/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 89018d0623191ecd477c869339ca795f91f6c68c +Subproject commit da8370423b07c9271fad515c9ef1fd6149abbeed diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/debian/control b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/control index a3ea06992dc4..5c5d58b9bd53 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/debian/control +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/control @@ -2,11 +2,11 @@ Source: sonic-platform-modules-bfn-montara Section: main Priority: extra Maintainer: Support -Build-Depends: debhelper (>= 9.0.0), bzip2 +Build-Depends: debhelper (>= 9.0.0), bzip2, python3 Standards-Version: 3.9.3 Package: sonic-platform-modules-bfn-montara Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/debian/rules b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/rules index 32036bb90803..5e14ab42f75d 100755 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/debian/rules +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/debian/rules @@ -8,7 +8,7 @@ BUILD_DIR := $(shell pwd)/build WHEEL_BUILD_DIR := $(BUILD_DIR)/wheel %: - dh $@ + dh $@ --with python3 --buildsystem=pybuild override_dh_auto_build: set -e diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/chassis.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/chassis.py index 319d29ef1727..6d0e8b8c120c 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/chassis.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/chassis.py @@ -1,29 +1,62 @@ #!/usr/bin/env python try: - import sys + import os + import time + import syslog + import logging + import logging.config + import yaml + from sonic_platform_base.chassis_base import ChassisBase - from sonic_platform.sfp import Sfp, sfp_list_get + from sonic_platform.sfp import Sfp from sonic_platform.psu import psu_list_get from sonic_platform.fan_drawer import fan_drawer_list_get from sonic_platform.thermal import thermal_list_get from eeprom import Eeprom + from platform_utils import file_create + + from sonic_platform.platform_thrift_client import pltfm_mgr_ready + from sonic_platform.platform_thrift_client import thrift_try + + from sonic_py_common import device_info + except ImportError as e: raise ImportError(str(e) + "- required module not found") +NUM_COMPONENT = 2 class Chassis(ChassisBase): """ Platform-specific Chassis class """ + + PORT_START = 1 + PORT_END = 0 + PORTS_IN_BLOCK = 0 + QSFP_PORT_START = 1 + QSFP_PORT_END = 0 + QSFP_CHECK_INTERVAL = 4 + def __init__(self): ChassisBase.__init__(self) self.__eeprom = None self.__fan_drawers = None + self.__fan_list = None self.__thermals = None self.__psu_list = None self.__sfp_list = None + self.ready = False + self.phy_port_cur_state = {} + self.qsfp_interval = self.QSFP_CHECK_INTERVAL + self.__initialize_components() + + with open(os.path.dirname(__file__) + "/logging.conf", 'r') as f: + config_dict = yaml.load(f, yaml.SafeLoader) + file_create(config_dict['handlers']['file']['filename'], '646') + logging.config.dictConfig(config_dict) + @property def _eeprom(self): if self.__eeprom is None: @@ -44,6 +77,18 @@ def _fan_drawer_list(self): def _fan_drawer_list(self, value): pass + @property + def _fan_list(self): + if self.__fan_list is None: + self.__fan_list = [] + for fan_drawer in self._fan_drawer_list: + self.__fan_list.extend(fan_drawer._fan_list) + return self.__fan_list + + @_fan_list.setter + def _fan_list(self, value): + pass + @property def _thermal_list(self): if self.__thermals is None: @@ -67,13 +112,40 @@ def _psu_list(self, value): @property def _sfp_list(self): if self.__sfp_list is None: - self.__sfp_list = sfp_list_get() + self.__update_port_info() + self.__sfp_list = [] + for index in range(self.PORT_START, self.PORT_END + 1): + sfp_node = Sfp(index) + self.__sfp_list.append(sfp_node) return self.__sfp_list @_sfp_list.setter def _sfp_list(self, value): pass + def __update_port_info(self): + def qsfp_max_port_get(client): + return client.pltfm_mgr.pltfm_mgr_qsfp_get_max_port() + + if self.QSFP_PORT_END == 0: + platform = device_info.get_platform() + self.QSFP_PORT_END = thrift_try(qsfp_max_port_get) + exclude_cpu_port = [ + "x86_64-accton_as9516_32d-r0", + "x86_64-accton_as9516bf_32d-r0", + "x86_64-accton_wedge100bf_32x-r0" + ] + if platform in exclude_cpu_port: + self.QSFP_PORT_END -= 1 + self.PORT_END = self.QSFP_PORT_END + self.PORTS_IN_BLOCK = self.QSFP_PORT_END + + def __initialize_components(self): + from sonic_platform.component import Components + for index in range(0, NUM_COMPONENT): + component = Components(index) + self._component_list.append(component) + def get_name(self): """ Retrieves the name of the chassis @@ -106,6 +178,14 @@ def get_serial(self): """ return self._eeprom.serial_number_str() + def get_revision(self): + """ + Retrieves the revision number of the chassis (Service tag) + Returns: + string: Revision number of chassis + """ + return self._eeprom.revision_str() + def get_sfp(self, index): """ Retrieves sfp represented by (1-based) index @@ -124,7 +204,7 @@ def get_sfp(self, index): try: sfp = self._sfp_list[index-1] except IndexError: - sys.stderr.write("SFP index {} out of range (1-{})\n".format( + syslog.syslog(syslog.LOG_ERR, "SFP index {} out of range (1-{})\n".format( index, len(self._sfp_list)-1)) return sfp @@ -158,8 +238,60 @@ def get_system_eeprom_info(self): """ return self._eeprom.system_eeprom_info() + def __get_transceiver_change_event(self, timeout=0): + forever = False + if timeout == 0: + forever = True + elif timeout > 0: + timeout = timeout / float(1000) # Convert to secs + else: + syslog.syslog(syslog.LOG_ERR, "Invalid timeout value {}".format(timeout)) + return False, {} + + phy_port_dict = {} if self.ready else {'-1': 'system_not_ready'} + + while forever or timeout > 0: + if not self.ready: + if pltfm_mgr_ready(): + self.ready = True + phy_port_dict = {} + + if self.ready and self.qsfp_interval == 0: + self.qsfp_interval = self.QSFP_CHECK_INTERVAL + + # Get presence of each SFP + for port in range(self.PORT_START, self.PORT_END + 1): + try: + sfp_resent = self.get_sfp(port).get_presence() + except Exception: + sfp_resent = False + sfp_state = '1' if sfp_resent else '0' + + if port in self.phy_port_cur_state: + if self.phy_port_cur_state[port] != sfp_state: + phy_port_dict[port] = sfp_state + else: + phy_port_dict[port] = sfp_state + + # Update port current state + self.phy_port_cur_state[port] = sfp_state + + # Break if tranceiver state has changed + if phy_port_dict: + break + + if timeout: + timeout -= 1 + + if self.qsfp_interval: + self.qsfp_interval -= 1 + + time.sleep(1) + + return self.ready, phy_port_dict + def get_change_event(self, timeout=0): - ready, event_sfp = Sfp.get_transceiver_change_event(timeout) + ready, event_sfp = self.__get_transceiver_change_event(timeout) return ready, { 'sfp': event_sfp } if ready else {} def get_reboot_cause(self): @@ -174,3 +306,48 @@ def get_reboot_cause(self): to pass a description of the reboot cause. """ return self.REBOOT_CAUSE_NON_HARDWARE, '' + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False + + def initizalize_system_led(self): + self.system_led = "" + return True + + def set_status_led(self, color): + """ + Sets the state of the system LED + + Args: + color: A string representing the color with which to set the + system LED + + Returns: + bool: True if system LED state is set successfully, False if not + """ + self.system_led = color + return True + + def get_status_led(self): + """ + Gets the state of the system LED + + Returns: + A string, one of the valid LED color strings which could be vendor + specified. + """ + return self.system_led diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/component.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/component.py new file mode 100644 index 000000000000..47a0993bf3e5 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/component.py @@ -0,0 +1,318 @@ +try: + import os + import subprocess + from sonic_platform_base.component_base import ComponentBase + from platform_thrift_client import thrift_try + import json + from collections import OrderedDict + from sonic_py_common import device_info + +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +def get_bios_version(): + """ + Retrieves the firmware version of the BIOS + Returns: + A string containing the firmware version of the BIOS + """ + try: + cmd = ['dmidecode', '-s', 'bios-version'] + if os.geteuid() != 0: + cmd.insert(0, 'sudo') + return subprocess.check_output(cmd).strip().decode() + except subprocess.CalledProcessError as e: + raise RuntimeError("Failed to get BIOS version") + +def get_bmc_version(): + """ + Retrieves the firmware version of the BMC + Returns: + A string containing the firmware version of the BMC + """ + ver = "N/A" + def bmc_get(client): + return client.pltfm_mgr.pltfm_mgr_chss_mgmt_bmc_ver_get() + try: + ver = thrift_try(bmc_get) + except Exception: + pass + + return ver + +class BFPlatformComponentsParser(object): + """ + BFPlatformComponentsParser + """ + CHASSIS_KEY = "chassis" + MODULE_KEY = "module" + COMPONENT_KEY = "component" + FIRMWARE_KEY = "firmware" + + def __init__(self, platform_components_path): + self.__chassis_component_map = OrderedDict() + self.__component_list = [] + self.__bf_model = "" + self.__parse_platform_components(platform_components_path) + + def __is_str(self, obj): + return isinstance(obj, str) + + def __is_dict(self, obj): + return isinstance(obj, dict) + + def __parser_fail(self, msg): + raise RuntimeError("Failed to parse \"{}\": {}".format(PLATFORM_COMPONENTS_FILE, msg)) + + def __parser_platform_fail(self, msg): + self.__parser_fail("invalid platform schema: {}".format(msg)) + + def __parser_chassis_fail(self, msg): + self.__parser_fail("invalid chassis schema: {}".format(msg)) + + def __parser_component_fail(self, msg): + self.__parser_fail("invalid component schema: {}".format(msg)) + + def __parse_component_section(self, section, component, is_module_component=False): + if not self.__is_dict(component): + self.__parser_component_fail("dictionary is expected: key={}".format(self.COMPONENT_KEY)) + + if not component: + return + + missing_key = None + + for key1, value1 in component.items(): + if not self.__is_dict(value1): + self.__parser_component_fail("dictionary is expected: key={}".format(key1)) + + self.__chassis_component_map[section][key1] = OrderedDict() + + if value1: + if len(value1) < 1 or len(value1) > 3: + self.__parser_component_fail("unexpected number of records: key={}".format(key1)) + + if self.FIRMWARE_KEY not in value1: + missing_key = self.FIRMWARE_KEY + break + + for key2, value2 in value1.items(): + if not self.__is_str(value2): + self.__parser_component_fail("string is expected: key={}".format(key2)) + + self.__chassis_component_map[section][key1] = value1 + + if missing_key is not None: + self.__parser_component_fail("\"{}\" key hasn't been found".format(missing_key)) + + def __parse_chassis_section(self, chassis): + self.__chassis_component_map = OrderedDict() + + if not self.__is_dict(chassis): + self.__parser_chassis_fail("dictionary is expected: key={}".format(self.CHASSIS_KEY)) + + if not chassis: + self.__parser_chassis_fail("dictionary is empty: key={}".format(self.CHASSIS_KEY)) + + if len(chassis) != 1: + self.__parser_chassis_fail("unexpected number of records: key={}".format(self.CHASSIS_KEY)) + + for key, value in chassis.items(): + if not self.__is_dict(value): + self.__parser_chassis_fail("dictionary is expected: key={}".format(key)) + + if not value: + self.__parser_chassis_fail("dictionary is empty: key={}".format(key)) + + if self.COMPONENT_KEY not in value: + self.__parser_chassis_fail("\"{}\" key hasn't been found".format(self.COMPONENT_KEY)) + + if len(value) != 1: + self.__parser_chassis_fail("unexpected number of records: key={}".format(key)) + + self.__chassis_component_map[key] = OrderedDict() + self.__parse_component_section(key, value[self.COMPONENT_KEY]) + + def get_components_list(self): + self.__component_list = [] + for key, value in self.__chassis_component_map[self.__bf_model].items(): + self.__component_list.append(key) + + return self.__component_list + + def get_chassis_component_map(self): + return self.__chassis_component_map + + def __parse_platform_components(self, platform_components_path): + with open(platform_components_path) as platform_components: + data = json.load(platform_components) + kkey, val = list(data[self.CHASSIS_KEY].items())[0] + self.__bf_model = kkey + + if not self.__is_dict(data): + self.__parser_platform_fail("dictionary is expected: key=root") + + if not data: + self.__parser_platform_fail("dictionary is empty: key=root") + + if self.CHASSIS_KEY not in data: + self.__parser_platform_fail("\"{}\" key hasn't been found".format(self.CHASSIS_KEY)) + + if len(data) != 1: + self.__parser_platform_fail("unexpected number of records: key=root") + + self.__parse_chassis_section(data[self.CHASSIS_KEY]) + + chassis_component_map = property(fget=get_chassis_component_map) + +class Components(ComponentBase): + """BFN Montara Platform-specific Component class""" + bf_platform = device_info.get_path_to_platform_dir() + bf_platform_json = "{}/platform_components.json".format(bf_platform.strip()) + bpcp = BFPlatformComponentsParser(bf_platform_json) + + def __init__(self, component_index=0): + try: + self.index = component_index + self.name = "N/A" + self.version = "N/A" + self.description = "N/A" + self.name = self.bpcp.get_components_list()[self.index] + except IndexError as e: + print("Error: No components found in plaform_components.json") + + if (self.name == "BMC"): + self.version = get_bmc_version() + self.description = "Chassis BMC" + elif (self.name == "BIOS"): + self.version = get_bios_version() + self.description = "Chassis BIOS" + + def get_name(self): + """ + Retrieves the name of the component + Returns: + A string containing the name of the component + """ + if not self.name: + return "N/A" + return self.name + + def get_description(self): + """ + Retrieves the description of the component + Returns: + A string containing the description of the component + """ + return self.description + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + Returns: + A string containing the firmware version of the component + """ + return self.version + + def install_firmware(self, image_path): + """ + Installs firmware to the component + Args: + image_path: A string, path to firmware image + Returns: + A boolean, True if install was successful, False if not + """ + return False + + def get_presence(self): + """ + Retrieves the presence of the component + Returns: + bool: True if component is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the component + Returns: + string: Model/part number of component + """ + return 'N/A' + + def get_serial(self): + """ + Retrieves the serial number of the component + Returns: + string: Serial number of component + """ + return 'N/A' + + def get_status(self): + """ + Retrieves the operational status of the component + Returns: + A boolean value, True if component is operating properly, False if not + """ + return True + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this component is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False + + def get_available_firmware_version(self, image_path): + return 'None' + + def get_firmware_update_notification(self, image_path): + """ + Retrieves a notification on what should be done in order to complete + the component firmware update + + Args: + image_path: A string, path to firmware image + + Returns: + A string containing the component firmware update notification if required. + By default 'None' value will be used, which indicates that no actions are required + """ + return 'None' + + def update_firmware(self, image_path): + """ + Updates firmware of the component + + This API performs firmware update: it assumes firmware installation and loading in a single call. + In case platform component requires some extra steps (apart from calling Low Level Utility) + to load the installed firmware (e.g, reboot, power cycle, etc.) - this will be done automatically by API + + Args: + image_path: A string, path to firmware image + + Raises: + RuntimeError: update failed + """ + return False + + def auto_update_firmware(self, image_path, boot_action): + """ + Default handling of attempted automatic update for a component + Will skip the installation if the boot_action is 'warm' or 'fast' and will call update_firmware() + if boot_action is fast. + """ + return 1 diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/eeprom.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/eeprom.py index 00e6e54fb33f..2335c02863d9 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/eeprom.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/eeprom.py @@ -1,11 +1,7 @@ try: import os import sys - import errno import datetime - import logging - import logging.config - import yaml import re sys.path.append(os.path.dirname(__file__)) @@ -17,6 +13,7 @@ from sonic_platform_base.sonic_eeprom import eeprom_base from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo + from platform_utils import file_create from platform_thrift_client import thrift_try except ImportError as e: @@ -24,38 +21,29 @@ _platform_eeprom_map = { - "prod_name" : ("Product Name", "0x21", 12), - "odm_pcba_part_num" : ("Part Number", "0x22", 13), - "prod_ser_num" : ("Serial Number", "0x23", 12), - "ext_mac_addr" : ("Extended MAC Address Base", "0x24", 12), - "sys_mfg_date" : ("System Manufacturing Date", "0x25", 4), - "prod_ver" : ("Product Version", "0x26", 1), - "ext_mac_addr_size" : ("Extende MAC Address Size", "0x2A", 2), - "sys_mfger" : ("Manufacturer", "0x2B", 8) + "prod_name" : ("Product Name", "0x21", 12), + "odm_pcba_part_num" : ("Part Number", "0x22", 13), + "prod_ser_num" : ("Serial Number", "0x23", 12), + "ext_mac_addr" : ("Extended MAC Address Base", "0x24", 12), + "sys_mfg_date" : ("System Manufacturing Date", "0x25", 4), + "prod_ver" : ("Product Version", "0x26", 1), + "ext_mac_addr_size" : ("Extende MAC Address Size", "0x2A", 2), + "sys_mfger" : ("Manufacturer", "0x2B", 8) } -_product_dict = { "Montara" : "Wedge100BF-32X-O-AC-F-BF", - "Lower MAV" : "Wedge100BF-65X-O-AC-F-BF", - "Upper MAV" : "Wedge100BF-65X-O-AC-F-BF" - } +_product_dict = { + "Montara" : "Wedge100BF-32X-O-AC-F-BF", + "Lower MAV" : "Wedge100BF-65X-O-AC-F-BF", + "Upper MAV" : "Wedge100BF-65X-O-AC-F-BF" +} _EEPROM_SYMLINK = "/var/run/platform/eeprom/syseeprom" _EEPROM_STATUS = "/var/run/platform/eeprom/status" class Eeprom(eeprom_tlvinfo.TlvInfoDecoder): def __init__(self): - with open(os.path.dirname(__file__) + "/logging.conf", 'r') as f: - config_dict = yaml.load(f, yaml.SafeLoader) - logging.config.dictConfig(config_dict) - - if not os.path.exists(os.path.dirname(_EEPROM_SYMLINK)): - try: - os.makedirs(os.path.dirname(_EEPROM_SYMLINK)) - except OSError as e: - if e.errno != errno.EEXIST: - raise - - open(_EEPROM_SYMLINK, 'a').close() + file_create(_EEPROM_SYMLINK, '646') + file_create(_EEPROM_STATUS, '646') with open(_EEPROM_STATUS, 'w') as f: f.write("initializing..") @@ -148,3 +136,7 @@ def part_number_str(self): def modelstr(self): return self.__tlv_get(self._TLV_CODE_PRODUCT_NAME) + + def revision_str(self): + return self.__tlv_get(self._TLV_CODE_LABEL_REVISION) + diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/fan.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/fan.py new file mode 100644 index 000000000000..c13382fddb55 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/fan.py @@ -0,0 +1,105 @@ +try: + from sonic_platform.platform_thrift_client import thrift_try + from sonic_platform_base.fan_base import FanBase + from sonic_py_common import device_info +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +def _fan_info_get(fan_num, cb, default=None): + def get_data(client): + return client.pltfm_mgr.pltfm_mgr_fan_info_get(fan_num) + fan_info = thrift_try(get_data) + if fan_num == fan_info.fan_num: + return cb(fan_info) + if default is None: + raise LookupError + return default + +# Fan -> FanBase -> DeviceBase +class Fan(FanBase): + def __init__(self, index, fantrayindex): + self.__index = index + self.__fantrayindex = fantrayindex + + # FanBase interface methods: + # returns speed in percents + def get_speed(self): + def cb(info): return info.percent + return _fan_info_get(self.__index, cb, 0) + + def set_speed(self, percent): + # Fan tray speed controlled by BMC + return False + + # DeviceBase interface methods: + def get_name(self): + return "counter-rotating-fan-{}".format((self.__fantrayindex - 1) * self.__index + self.__index) + + def get_presence(self): + return _fan_info_get(self.__index, lambda _: True, False) + + def get_position_in_parent(self): + return self.__index + + def is_replaceable(self): + return False + + def get_status(self): + return (self.get_presence() and self.get_presence() > 0) + + def get_model(self): + """ + Retrieves the part number of the fan drawer + Returns: + string: Part number of fan drawer + """ + return 'N/A' + + def get_direction(self): + """ + Retrieves the direction of fan + Returns: + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + """ + return 'N/A' + + def get_target_speed(self): + """ + Retrieves the target (expected) speed of the fan + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + """ + return self.get_speed() + + def get_speed_tolerance(self): + """ + Retrieves the speed tolerance of the fan + Returns: + An integer, the percentage of variance from target speed which is + considered tolerable + """ + if device_info.get_platform() in ["x86_64-accton_as9516_32d-r0", "x86_64-accton_as9516bf_32d-r0"]: + return 6 + return 3 + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return 'N/A' + + def set_status_led(self, color): + """ + Sets the state of the fan module status LED + Args: + color: A string representing the color with which to set the + fan module status LED + Returns: + bool: True if status LED state is set successfully, False if not + """ + # Fan tray status LED controlled by BMC + return False diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/fan_drawer.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/fan_drawer.py index b30ea24e0e41..269d3d43b0bf 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/fan_drawer.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/fan_drawer.py @@ -1,71 +1,20 @@ try: - from sonic_platform.platform_thrift_client import thrift_try from sonic_platform_base.fan_drawer_base import FanDrawerBase - from sonic_platform_base.fan_base import FanBase + from sonic_py_common import device_info + from sonic_platform.fan import Fan except ImportError as e: raise ImportError (str(e) + "- required module not found") -_MAX_FAN = 10 - -def _fan_info_get(fan_num, cb, default=None): - def get_data(client): - return client.pltfm_mgr.pltfm_mgr_fan_info_get(fan_num) - fan_info = thrift_try(get_data) - if fan_num == fan_info.fan_num: - return cb(fan_info) - if default is None: - raise LookupError - return default - -def _fan_info_get_all(): - for fan_num in range(1, _MAX_FAN + 1): - def get_data(client, fan_num=fan_num): - return client.pltfm_mgr.pltfm_mgr_fan_info_get(fan_num) - fan_info = thrift_try(get_data) - if fan_info.fan_num == fan_num: - yield fan_info - -# Fan -> FanBase -> DeviceBase -class Fan(FanBase): - def __init__(self, num): - self.__num = num - - # FanBase interface methods: - # returns speed in percents - def get_speed(self): - def cb(info): return info.percent - return _fan_info_get(self.__num, cb, 0) - - def set_speed(self, percent): - def set_fan_speed(client): - return client.pltfm_mgr.pltfm_mgr_fan_speed_set(self.__num, percent) - return thrift_try(set_fan_speed) - - # DeviceBase interface methods: - def get_name(self): - return f"counter-rotating-fan-{self.__num}" - - def get_presence(self): - return _fan_info_get(self.__num, lambda _: True, False) - - def get_position_in_parent(self): - return self.__num - - def is_replaceable(self): - return True - - def get_status(self): - return True - # FanDrawer -> FanDrawerBase -> DeviceBase class FanDrawer(FanDrawerBase): - def __init__(self): + def __init__(self, fantray_index, max_fan): # For now we return only present fans - self._fan_list = [Fan(i.fan_num) for i in _fan_info_get_all()] + self.fantrayindex = fantray_index + self._fan_list = [Fan(i, self.fantrayindex) for i in range(1, max_fan + 1)] # DeviceBase interface methods: def get_name(self): - return 'fantray' + return f"fantray-{self.fantrayindex}" def get_presence(self): return True @@ -73,5 +22,78 @@ def get_presence(self): def get_status(self): return True + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + Returns: + integer: The 1-based relative physical position in parent + device or -1 if cannot determine the position + """ + return self.fantrayindex + + def is_replaceable(self): + """ + Indicate whether this fan drawer is replaceable. + Returns: + bool: True if it is replaceable, False if not + """ + return False + + def get_model(self): + """ + Retrieves the part number of the fan drawer + Returns: + string: Part number of fan drawer + """ + return 'N/A' + + def get_serial(self): + """ + Retrieves the serial number of the fan drawer + Returns: + string: Serial number of the fan drawer + """ + return 'N/A' + + def set_status_led(self, color): + """ + Set led to expected color + Args: + color: A string representing the color with which to set the + fan module status LED + Returns: + bool: True if set success, False if fail. + """ + # Fan tray status LED controlled by BMC + return False + + def get_status_led(self): + """ + Gets the state of the fan drawer LED + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + return "N/A" + + def get_maximum_consumed_power(self): + """ + Retrives the maximum power drawn by Fan Drawer + Returns: + A float, with value of the maximum consumable power of the + component. + """ + return 36.0 + def fan_drawer_list_get(): - return [FanDrawer()] + platform = device_info.get_platform() + if platform in ["x86_64-accton_as9516_32d-r0", "x86_64-accton_as9516bf_32d-r0"]: + max_fantray = 1 + max_fan = 6 + elif platform == "x86_64-accton_wedge100bf_65x-r0": + max_fantray = 2 + max_fan = 5 + else: + max_fantray = 1 + max_fan = 5 + + return [FanDrawer(i, max_fan) for i in range(1, max_fantray + 1)] diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/platform_thrift_client.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/platform_thrift_client.py index 96c0e09ba1c0..dff16577de74 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/platform_thrift_client.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/platform_thrift_client.py @@ -25,9 +25,9 @@ def open(self): self.transport = TTransport.TBufferedTransport(self.transport) bprotocol = TBinaryProtocol.TBinaryProtocol(self.transport) - pltfm_mgr_client_module = importlib.import_module(".".join(["pltfm_mgr_rpc", "pltfm_mgr_rpc"])) + self.pltfm_mgr_module = importlib.import_module(".".join(["pltfm_mgr_rpc", "pltfm_mgr_rpc"])) pltfm_mgr_protocol = TMultiplexedProtocol.TMultiplexedProtocol(bprotocol, "pltfm_mgr_rpc") - self.pltfm_mgr = pltfm_mgr_client_module.Client(pltfm_mgr_protocol) + self.pltfm_mgr = self.pltfm_mgr_module.Client(pltfm_mgr_protocol) self.transport.open() return self @@ -38,6 +38,13 @@ def __enter__(self): def __exit__(self, exc_type, exc_value, tb): self.close() +def pltfm_mgr_ready(): + try: + with ThriftClient(): + return True + except Exception: + return False + def thrift_try(func, attempts=35): for attempt in range(attempts): try: @@ -47,3 +54,12 @@ def thrift_try(func, attempts=35): if attempt + 1 == attempts: raise e time.sleep(1) + +def pltfm_mgr_try(func, default=None, thrift_attempts=35): + def pm_cb_run(client): + try: + return (None, func(client.pltfm_mgr)) + except client.pltfm_mgr_module.InvalidPltfmMgrOperation as ouch: + return (ouch.code, default) + + return thrift_try(pm_cb_run) diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/platform_utils.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/platform_utils.py new file mode 100644 index 000000000000..81e78ee01041 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/platform_utils.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +try: + import os + import subprocess + +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +def file_create(path, mode=None): + def run_cmd(cmd): + if os.geteuid() != 0: + cmd.insert(0, 'sudo') + subprocess.check_output(cmd) + + file_path = os.path.dirname(path) + if not os.path.exists(file_path): + run_cmd(['mkdir', '-p', file_path]) + if not os.path.isfile(path): + run_cmd(['touch', path]) + if (mode is not None): + run_cmd(['chmod', mode, path]) diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/pltfm_mgr_rpc/pltfm_mgr_rpc.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/pltfm_mgr_rpc/pltfm_mgr_rpc.py index b256b6285fc3..0fa03d58b31a 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/pltfm_mgr_rpc/pltfm_mgr_rpc.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/pltfm_mgr_rpc/pltfm_mgr_rpc.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.10.0) +# Autogenerated by Thrift Compiler (0.14.1) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # @@ -8,11 +8,14 @@ from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException from thrift.protocol.TProtocol import TProtocolException +from thrift.TRecursive import fix_spec + import sys import logging from .ttypes import * from thrift.Thrift import TProcessor from thrift.transport import TTransport +all_structs = [] class Iface(object): @@ -20,6 +23,7 @@ def pltfm_mgr_dummy(self, device): """ Parameters: - device + """ pass @@ -33,6 +37,7 @@ def pltfm_mgr_pwr_supply_present_get(self, ps_num): """ Parameters: - ps_num + """ pass @@ -40,6 +45,7 @@ def pltfm_mgr_pwr_supply_info_get(self, ps_num): """ Parameters: - ps_num + """ pass @@ -47,6 +53,7 @@ def pltfm_mgr_pwr_rail_info_get(self, ps_num): """ Parameters: - ps_num + """ pass @@ -55,6 +62,7 @@ def pltfm_mgr_fan_speed_set(self, fan_num, percent): Parameters: - fan_num - percent + """ pass @@ -62,6 +70,27 @@ def pltfm_mgr_fan_info_get(self, fan_num): """ Parameters: - fan_num + + """ + pass + + def pltfm_mgr_qsfp_cached_num_bytes_get(self, port_num, page, offset, length): + """ + Parameters: + - port_num + - page + - offset + - length + + """ + pass + + def pltfm_mgr_qsfp_cached_page_get(self, port_num, page): + """ + Parameters: + - port_num + - page + """ pass @@ -69,6 +98,15 @@ def pltfm_mgr_qsfp_presence_get(self, port_num): """ Parameters: - port_num + + """ + pass + + def pltfm_mgr_qsfp_detect_transceiver(self, port_num): + """ + Parameters: + - port_num + """ pass @@ -76,6 +114,7 @@ def pltfm_mgr_qsfp_info_get(self, port_num): """ Parameters: - port_num + """ pass @@ -87,6 +126,138 @@ def pltfm_mgr_qsfp_reset(self, port_num, reset): Parameters: - port_num - reset + + """ + pass + + def pltfm_mgr_qsfp_reset_get(self, port_num): + """ + Parameters: + - port_num + + """ + pass + + def pltfm_mgr_qsfp_tx_disable(self, port_num, channel_mask, disable): + """ + Parameters: + - port_num + - channel_mask + - disable + + """ + pass + + def pltfm_mgr_qsfp_chan_count_get(self, port_num): + """ + Parameters: + - port_num + + """ + pass + + def pltfm_mgr_qsfp_chan_rx_pwr_get(self, port_num): + """ + Parameters: + - port_num + + """ + pass + + def pltfm_mgr_qsfp_chan_tx_bias_get(self, port_num): + """ + Parameters: + - port_num + + """ + pass + + def pltfm_mgr_qsfp_chan_tx_pwr_get(self, port_num): + """ + Parameters: + - port_num + + """ + pass + + def pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get(self, port_num): + """ + Parameters: + - port_num + + """ + pass + + def pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get(self, port_num): + """ + Parameters: + - port_num + + """ + pass + + def pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get(self, port_num): + """ + Parameters: + - port_num + + """ + pass + + def pltfm_mgr_qsfp_chan_rx_los_get(self, port_num): + """ + Parameters: + - port_num + + """ + pass + + def pltfm_mgr_qsfp_chan_tx_los_get(self, port_num): + """ + Parameters: + - port_num + + """ + pass + + def pltfm_mgr_qsfp_chan_tx_fault_get(self, port_num): + """ + Parameters: + - port_num + + """ + pass + + def pltfm_mgr_qsfp_temperature_get(self, port_num): + """ + Parameters: + - port_num + + """ + pass + + def pltfm_mgr_qsfp_voltage_get(self, port_num): + """ + Parameters: + - port_num + + """ + pass + + def pltfm_mgr_qsfp_thresholds_get(self, port_num): + """ + Parameters: + - port_num + + """ + pass + + def pltfm_mgr_qsfp_tx_is_disabled(self, port_num, channel): + """ + Parameters: + - port_num + - channel + """ pass @@ -94,6 +265,25 @@ def pltfm_mgr_qsfp_lpmode_get(self, port_num): """ Parameters: - port_num + + """ + pass + + def pltfm_mgr_qsfp_pwr_override_get(self, port_num): + """ + Parameters: + - port_num + + """ + pass + + def pltfm_mgr_qsfp_pwr_override_set(self, port_num, power_override, power_set): + """ + Parameters: + - port_num + - power_override + - power_set + """ pass @@ -102,6 +292,7 @@ def pltfm_mgr_qsfp_lpmode_set(self, port_num, lpmode): Parameters: - port_num - lpmode + """ pass @@ -109,9 +300,13 @@ def pltfm_mgr_sensor_info_get(self, options): """ Parameters: - options + """ pass + def pltfm_mgr_chss_mgmt_bmc_ver_get(self): + pass + class Client(Iface): def __init__(self, iprot, oprot=None): @@ -124,6 +319,7 @@ def pltfm_mgr_dummy(self, device): """ Parameters: - device + """ self.send_pltfm_mgr_dummy(device) return self.recv_pltfm_mgr_dummy() @@ -211,6 +407,7 @@ def pltfm_mgr_pwr_supply_present_get(self, ps_num): """ Parameters: - ps_num + """ self.send_pltfm_mgr_pwr_supply_present_get(ps_num) return self.recv_pltfm_mgr_pwr_supply_present_get() @@ -244,6 +441,7 @@ def pltfm_mgr_pwr_supply_info_get(self, ps_num): """ Parameters: - ps_num + """ self.send_pltfm_mgr_pwr_supply_info_get(ps_num) return self.recv_pltfm_mgr_pwr_supply_info_get() @@ -277,6 +475,7 @@ def pltfm_mgr_pwr_rail_info_get(self, ps_num): """ Parameters: - ps_num + """ self.send_pltfm_mgr_pwr_rail_info_get(ps_num) return self.recv_pltfm_mgr_pwr_rail_info_get() @@ -311,6 +510,7 @@ def pltfm_mgr_fan_speed_set(self, fan_num, percent): Parameters: - fan_num - percent + """ self.send_pltfm_mgr_fan_speed_set(fan_num, percent) return self.recv_pltfm_mgr_fan_speed_set() @@ -345,6 +545,7 @@ def pltfm_mgr_fan_info_get(self, fan_num): """ Parameters: - fan_num + """ self.send_pltfm_mgr_fan_info_get(fan_num) return self.recv_pltfm_mgr_fan_info_get() @@ -374,10 +575,87 @@ def recv_pltfm_mgr_fan_info_get(self): raise result.ouch raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_fan_info_get failed: unknown result") + def pltfm_mgr_qsfp_cached_num_bytes_get(self, port_num, page, offset, length): + """ + Parameters: + - port_num + - page + - offset + - length + + """ + self.send_pltfm_mgr_qsfp_cached_num_bytes_get(port_num, page, offset, length) + return self.recv_pltfm_mgr_qsfp_cached_num_bytes_get() + + def send_pltfm_mgr_qsfp_cached_num_bytes_get(self, port_num, page, offset, length): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_cached_num_bytes_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_cached_num_bytes_get_args() + args.port_num = port_num + args.page = page + args.offset = offset + args.length = length + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_pltfm_mgr_qsfp_cached_num_bytes_get(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_qsfp_cached_num_bytes_get_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_cached_num_bytes_get failed: unknown result") + + def pltfm_mgr_qsfp_cached_page_get(self, port_num, page): + """ + Parameters: + - port_num + - page + + """ + self.send_pltfm_mgr_qsfp_cached_page_get(port_num, page) + return self.recv_pltfm_mgr_qsfp_cached_page_get() + + def send_pltfm_mgr_qsfp_cached_page_get(self, port_num, page): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_cached_page_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_cached_page_get_args() + args.port_num = port_num + args.page = page + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_pltfm_mgr_qsfp_cached_page_get(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_qsfp_cached_page_get_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_cached_page_get failed: unknown result") + def pltfm_mgr_qsfp_presence_get(self, port_num): """ Parameters: - port_num + """ self.send_pltfm_mgr_qsfp_presence_get(port_num) return self.recv_pltfm_mgr_qsfp_presence_get() @@ -407,10 +685,45 @@ def recv_pltfm_mgr_qsfp_presence_get(self): raise result.ouch raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_presence_get failed: unknown result") + def pltfm_mgr_qsfp_detect_transceiver(self, port_num): + """ + Parameters: + - port_num + + """ + self.send_pltfm_mgr_qsfp_detect_transceiver(port_num) + return self.recv_pltfm_mgr_qsfp_detect_transceiver() + + def send_pltfm_mgr_qsfp_detect_transceiver(self, port_num): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_detect_transceiver', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_detect_transceiver_args() + args.port_num = port_num + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_pltfm_mgr_qsfp_detect_transceiver(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_qsfp_detect_transceiver_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_detect_transceiver failed: unknown result") + def pltfm_mgr_qsfp_info_get(self, port_num): """ Parameters: - port_num + """ self.send_pltfm_mgr_qsfp_info_get(port_num) return self.recv_pltfm_mgr_qsfp_info_get() @@ -473,6 +786,7 @@ def pltfm_mgr_qsfp_reset(self, port_num, reset): Parameters: - port_num - reset + """ self.send_pltfm_mgr_qsfp_reset(port_num, reset) return self.recv_pltfm_mgr_qsfp_reset() @@ -503,23 +817,24 @@ def recv_pltfm_mgr_qsfp_reset(self): raise result.ouch raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_reset failed: unknown result") - def pltfm_mgr_qsfp_lpmode_get(self, port_num): + def pltfm_mgr_qsfp_reset_get(self, port_num): """ Parameters: - port_num + """ - self.send_pltfm_mgr_qsfp_lpmode_get(port_num) - return self.recv_pltfm_mgr_qsfp_lpmode_get() + self.send_pltfm_mgr_qsfp_reset_get(port_num) + return self.recv_pltfm_mgr_qsfp_reset_get() - def send_pltfm_mgr_qsfp_lpmode_get(self, port_num): - self._oprot.writeMessageBegin('pltfm_mgr_qsfp_lpmode_get', TMessageType.CALL, self._seqid) - args = pltfm_mgr_qsfp_lpmode_get_args() + def send_pltfm_mgr_qsfp_reset_get(self, port_num): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_reset_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_reset_get_args() args.port_num = port_num args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() - def recv_pltfm_mgr_qsfp_lpmode_get(self): + def recv_pltfm_mgr_qsfp_reset_get(self): iprot = self._iprot (fname, mtype, rseqid) = iprot.readMessageBegin() if mtype == TMessageType.EXCEPTION: @@ -527,34 +842,37 @@ def recv_pltfm_mgr_qsfp_lpmode_get(self): x.read(iprot) iprot.readMessageEnd() raise x - result = pltfm_mgr_qsfp_lpmode_get_result() + result = pltfm_mgr_qsfp_reset_get_result() result.read(iprot) iprot.readMessageEnd() if result.success is not None: return result.success if result.ouch is not None: raise result.ouch - raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_lpmode_get failed: unknown result") + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_reset_get failed: unknown result") - def pltfm_mgr_qsfp_lpmode_set(self, port_num, lpmode): + def pltfm_mgr_qsfp_tx_disable(self, port_num, channel_mask, disable): """ Parameters: - port_num - - lpmode + - channel_mask + - disable + """ - self.send_pltfm_mgr_qsfp_lpmode_set(port_num, lpmode) - return self.recv_pltfm_mgr_qsfp_lpmode_set() + self.send_pltfm_mgr_qsfp_tx_disable(port_num, channel_mask, disable) + return self.recv_pltfm_mgr_qsfp_tx_disable() - def send_pltfm_mgr_qsfp_lpmode_set(self, port_num, lpmode): - self._oprot.writeMessageBegin('pltfm_mgr_qsfp_lpmode_set', TMessageType.CALL, self._seqid) - args = pltfm_mgr_qsfp_lpmode_set_args() + def send_pltfm_mgr_qsfp_tx_disable(self, port_num, channel_mask, disable): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_tx_disable', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_tx_disable_args() args.port_num = port_num - args.lpmode = lpmode + args.channel_mask = channel_mask + args.disable = disable args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() - def recv_pltfm_mgr_qsfp_lpmode_set(self): + def recv_pltfm_mgr_qsfp_tx_disable(self): iprot = self._iprot (fname, mtype, rseqid) = iprot.readMessageBegin() if mtype == TMessageType.EXCEPTION: @@ -562,32 +880,33 @@ def recv_pltfm_mgr_qsfp_lpmode_set(self): x.read(iprot) iprot.readMessageEnd() raise x - result = pltfm_mgr_qsfp_lpmode_set_result() + result = pltfm_mgr_qsfp_tx_disable_result() result.read(iprot) iprot.readMessageEnd() if result.success is not None: return result.success if result.ouch is not None: raise result.ouch - raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_lpmode_set failed: unknown result") + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_tx_disable failed: unknown result") - def pltfm_mgr_sensor_info_get(self, options): + def pltfm_mgr_qsfp_chan_count_get(self, port_num): """ Parameters: - - options + - port_num + """ - self.send_pltfm_mgr_sensor_info_get(options) - return self.recv_pltfm_mgr_sensor_info_get() + self.send_pltfm_mgr_qsfp_chan_count_get(port_num) + return self.recv_pltfm_mgr_qsfp_chan_count_get() - def send_pltfm_mgr_sensor_info_get(self, options): - self._oprot.writeMessageBegin('pltfm_mgr_sensor_info_get', TMessageType.CALL, self._seqid) - args = pltfm_mgr_sensor_info_get_args() - args.options = options + def send_pltfm_mgr_qsfp_chan_count_get(self, port_num): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_chan_count_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_chan_count_get_args() + args.port_num = port_num args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() - def recv_pltfm_mgr_sensor_info_get(self): + def recv_pltfm_mgr_qsfp_chan_count_get(self): iprot = self._iprot (fname, mtype, rseqid) = iprot.readMessageBegin() if mtype == TMessageType.EXCEPTION: @@ -595,398 +914,4738 @@ def recv_pltfm_mgr_sensor_info_get(self): x.read(iprot) iprot.readMessageEnd() raise x - result = pltfm_mgr_sensor_info_get_result() + result = pltfm_mgr_qsfp_chan_count_get_result() result.read(iprot) iprot.readMessageEnd() if result.success is not None: return result.success if result.ouch is not None: raise result.ouch - raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_sensor_info_get failed: unknown result") + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_chan_count_get failed: unknown result") + def pltfm_mgr_qsfp_chan_rx_pwr_get(self, port_num): + """ + Parameters: + - port_num -class Processor(Iface, TProcessor): - def __init__(self, handler): - self._handler = handler - self._processMap = {} - self._processMap["pltfm_mgr_dummy"] = Processor.process_pltfm_mgr_dummy - self._processMap["pltfm_mgr_sys_tmp_get"] = Processor.process_pltfm_mgr_sys_tmp_get - self._processMap["pltfm_mgr_sys_eeprom_get"] = Processor.process_pltfm_mgr_sys_eeprom_get - self._processMap["pltfm_mgr_pwr_supply_present_get"] = Processor.process_pltfm_mgr_pwr_supply_present_get - self._processMap["pltfm_mgr_pwr_supply_info_get"] = Processor.process_pltfm_mgr_pwr_supply_info_get - self._processMap["pltfm_mgr_pwr_rail_info_get"] = Processor.process_pltfm_mgr_pwr_rail_info_get - self._processMap["pltfm_mgr_fan_speed_set"] = Processor.process_pltfm_mgr_fan_speed_set - self._processMap["pltfm_mgr_fan_info_get"] = Processor.process_pltfm_mgr_fan_info_get - self._processMap["pltfm_mgr_qsfp_presence_get"] = Processor.process_pltfm_mgr_qsfp_presence_get - self._processMap["pltfm_mgr_qsfp_info_get"] = Processor.process_pltfm_mgr_qsfp_info_get - self._processMap["pltfm_mgr_qsfp_get_max_port"] = Processor.process_pltfm_mgr_qsfp_get_max_port - self._processMap["pltfm_mgr_qsfp_reset"] = Processor.process_pltfm_mgr_qsfp_reset - self._processMap["pltfm_mgr_qsfp_lpmode_get"] = Processor.process_pltfm_mgr_qsfp_lpmode_get - self._processMap["pltfm_mgr_qsfp_lpmode_set"] = Processor.process_pltfm_mgr_qsfp_lpmode_set - self._processMap["pltfm_mgr_sensor_info_get"] = Processor.process_pltfm_mgr_sensor_info_get + """ + self.send_pltfm_mgr_qsfp_chan_rx_pwr_get(port_num) + return self.recv_pltfm_mgr_qsfp_chan_rx_pwr_get() - def process(self, iprot, oprot): - (name, type, seqid) = iprot.readMessageBegin() - if name not in self._processMap: - iprot.skip(TType.STRUCT) - iprot.readMessageEnd() - x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name)) - oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid) - x.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - return - else: - self._processMap[name](self, seqid, iprot, oprot) - return True + def send_pltfm_mgr_qsfp_chan_rx_pwr_get(self, port_num): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_chan_rx_pwr_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_chan_rx_pwr_get_args() + args.port_num = port_num + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() - def process_pltfm_mgr_dummy(self, seqid, iprot, oprot): - args = pltfm_mgr_dummy_args() - args.read(iprot) + def recv_pltfm_mgr_qsfp_chan_rx_pwr_get(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_qsfp_chan_rx_pwr_get_result() + result.read(iprot) iprot.readMessageEnd() - result = pltfm_mgr_dummy_result() - try: - result.success = self._handler.pltfm_mgr_dummy(args.device) - msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): - raise - except Exception as ex: - msg_type = TMessageType.EXCEPTION - logging.exception(ex) - result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') - oprot.writeMessageBegin("pltfm_mgr_dummy", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_chan_rx_pwr_get failed: unknown result") - def process_pltfm_mgr_sys_tmp_get(self, seqid, iprot, oprot): - args = pltfm_mgr_sys_tmp_get_args() - args.read(iprot) - iprot.readMessageEnd() - result = pltfm_mgr_sys_tmp_get_result() - try: - result.success = self._handler.pltfm_mgr_sys_tmp_get() - msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): - raise - except InvalidPltfmMgrOperation as ouch: - msg_type = TMessageType.REPLY - result.ouch = ouch - except Exception as ex: - msg_type = TMessageType.EXCEPTION - logging.exception(ex) - result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') - oprot.writeMessageBegin("pltfm_mgr_sys_tmp_get", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() + def pltfm_mgr_qsfp_chan_tx_bias_get(self, port_num): + """ + Parameters: + - port_num - def process_pltfm_mgr_sys_eeprom_get(self, seqid, iprot, oprot): - args = pltfm_mgr_sys_eeprom_get_args() - args.read(iprot) - iprot.readMessageEnd() - result = pltfm_mgr_sys_eeprom_get_result() - try: - result.success = self._handler.pltfm_mgr_sys_eeprom_get() - msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): - raise - except InvalidPltfmMgrOperation as ouch: - msg_type = TMessageType.REPLY - result.ouch = ouch - except Exception as ex: - msg_type = TMessageType.EXCEPTION - logging.exception(ex) - result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') - oprot.writeMessageBegin("pltfm_mgr_sys_eeprom_get", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() + """ + self.send_pltfm_mgr_qsfp_chan_tx_bias_get(port_num) + return self.recv_pltfm_mgr_qsfp_chan_tx_bias_get() - def process_pltfm_mgr_pwr_supply_present_get(self, seqid, iprot, oprot): - args = pltfm_mgr_pwr_supply_present_get_args() - args.read(iprot) - iprot.readMessageEnd() - result = pltfm_mgr_pwr_supply_present_get_result() - try: - result.success = self._handler.pltfm_mgr_pwr_supply_present_get(args.ps_num) - msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): - raise - except InvalidPltfmMgrOperation as ouch: - msg_type = TMessageType.REPLY - result.ouch = ouch - except Exception as ex: - msg_type = TMessageType.EXCEPTION - logging.exception(ex) - result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') - oprot.writeMessageBegin("pltfm_mgr_pwr_supply_present_get", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() + def send_pltfm_mgr_qsfp_chan_tx_bias_get(self, port_num): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_chan_tx_bias_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_chan_tx_bias_get_args() + args.port_num = port_num + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() - def process_pltfm_mgr_pwr_supply_info_get(self, seqid, iprot, oprot): - args = pltfm_mgr_pwr_supply_info_get_args() - args.read(iprot) + def recv_pltfm_mgr_qsfp_chan_tx_bias_get(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_qsfp_chan_tx_bias_get_result() + result.read(iprot) iprot.readMessageEnd() - result = pltfm_mgr_pwr_supply_info_get_result() - try: - result.success = self._handler.pltfm_mgr_pwr_supply_info_get(args.ps_num) - msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): - raise - except InvalidPltfmMgrOperation as ouch: - msg_type = TMessageType.REPLY - result.ouch = ouch - except Exception as ex: - msg_type = TMessageType.EXCEPTION - logging.exception(ex) - result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') - oprot.writeMessageBegin("pltfm_mgr_pwr_supply_info_get", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_chan_tx_bias_get failed: unknown result") - def process_pltfm_mgr_pwr_rail_info_get(self, seqid, iprot, oprot): - args = pltfm_mgr_pwr_rail_info_get_args() - args.read(iprot) - iprot.readMessageEnd() - result = pltfm_mgr_pwr_rail_info_get_result() - try: - result.success = self._handler.pltfm_mgr_pwr_rail_info_get(args.ps_num) - msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): - raise - except InvalidPltfmMgrOperation as ouch: - msg_type = TMessageType.REPLY - result.ouch = ouch - except Exception as ex: - msg_type = TMessageType.EXCEPTION - logging.exception(ex) - result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') - oprot.writeMessageBegin("pltfm_mgr_pwr_rail_info_get", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() + def pltfm_mgr_qsfp_chan_tx_pwr_get(self, port_num): + """ + Parameters: + - port_num - def process_pltfm_mgr_fan_speed_set(self, seqid, iprot, oprot): - args = pltfm_mgr_fan_speed_set_args() - args.read(iprot) - iprot.readMessageEnd() - result = pltfm_mgr_fan_speed_set_result() - try: - result.success = self._handler.pltfm_mgr_fan_speed_set(args.fan_num, args.percent) - msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): - raise - except InvalidPltfmMgrOperation as ouch: - msg_type = TMessageType.REPLY - result.ouch = ouch - except Exception as ex: - msg_type = TMessageType.EXCEPTION - logging.exception(ex) - result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') - oprot.writeMessageBegin("pltfm_mgr_fan_speed_set", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() + """ + self.send_pltfm_mgr_qsfp_chan_tx_pwr_get(port_num) + return self.recv_pltfm_mgr_qsfp_chan_tx_pwr_get() - def process_pltfm_mgr_fan_info_get(self, seqid, iprot, oprot): - args = pltfm_mgr_fan_info_get_args() - args.read(iprot) - iprot.readMessageEnd() - result = pltfm_mgr_fan_info_get_result() - try: - result.success = self._handler.pltfm_mgr_fan_info_get(args.fan_num) - msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): - raise - except InvalidPltfmMgrOperation as ouch: - msg_type = TMessageType.REPLY - result.ouch = ouch - except Exception as ex: - msg_type = TMessageType.EXCEPTION - logging.exception(ex) - result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') - oprot.writeMessageBegin("pltfm_mgr_fan_info_get", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() + def send_pltfm_mgr_qsfp_chan_tx_pwr_get(self, port_num): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_chan_tx_pwr_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_chan_tx_pwr_get_args() + args.port_num = port_num + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() - def process_pltfm_mgr_qsfp_presence_get(self, seqid, iprot, oprot): - args = pltfm_mgr_qsfp_presence_get_args() - args.read(iprot) - iprot.readMessageEnd() - result = pltfm_mgr_qsfp_presence_get_result() - try: - result.success = self._handler.pltfm_mgr_qsfp_presence_get(args.port_num) - msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): - raise - except InvalidPltfmMgrOperation as ouch: - msg_type = TMessageType.REPLY - result.ouch = ouch - except Exception as ex: - msg_type = TMessageType.EXCEPTION - logging.exception(ex) - result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') - oprot.writeMessageBegin("pltfm_mgr_qsfp_presence_get", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() + def recv_pltfm_mgr_qsfp_chan_tx_pwr_get(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_qsfp_chan_tx_pwr_get_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_chan_tx_pwr_get failed: unknown result") - def process_pltfm_mgr_qsfp_info_get(self, seqid, iprot, oprot): - args = pltfm_mgr_qsfp_info_get_args() - args.read(iprot) + def pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get(self, port_num): + """ + Parameters: + - port_num + + """ + self.send_pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get(port_num) + return self.recv_pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get() + + def send_pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get(self, port_num): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get_args() + args.port_num = port_num + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get_result() + result.read(iprot) iprot.readMessageEnd() - result = pltfm_mgr_qsfp_info_get_result() - try: - result.success = self._handler.pltfm_mgr_qsfp_info_get(args.port_num) - msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): - raise - except InvalidPltfmMgrOperation as ouch: - msg_type = TMessageType.REPLY - result.ouch = ouch - except Exception as ex: - msg_type = TMessageType.EXCEPTION - logging.exception(ex) - result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') - oprot.writeMessageBegin("pltfm_mgr_qsfp_info_get", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get failed: unknown result") - def process_pltfm_mgr_qsfp_get_max_port(self, seqid, iprot, oprot): - args = pltfm_mgr_qsfp_get_max_port_args() - args.read(iprot) + def pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get(self, port_num): + """ + Parameters: + - port_num + + """ + self.send_pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get(port_num) + return self.recv_pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get() + + def send_pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get(self, port_num): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get_args() + args.port_num = port_num + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get_result() + result.read(iprot) iprot.readMessageEnd() - result = pltfm_mgr_qsfp_get_max_port_result() - try: - result.success = self._handler.pltfm_mgr_qsfp_get_max_port() - msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): - raise - except InvalidPltfmMgrOperation as ouch: - msg_type = TMessageType.REPLY - result.ouch = ouch - except Exception as ex: - msg_type = TMessageType.EXCEPTION - logging.exception(ex) - result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') - oprot.writeMessageBegin("pltfm_mgr_qsfp_get_max_port", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get failed: unknown result") + + def pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get(self, port_num): + """ + Parameters: + - port_num + + """ + self.send_pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get(port_num) + return self.recv_pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get() + + def send_pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get(self, port_num): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get_args() + args.port_num = port_num + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get failed: unknown result") + + def pltfm_mgr_qsfp_chan_rx_los_get(self, port_num): + """ + Parameters: + - port_num + + """ + self.send_pltfm_mgr_qsfp_chan_rx_los_get(port_num) + return self.recv_pltfm_mgr_qsfp_chan_rx_los_get() + + def send_pltfm_mgr_qsfp_chan_rx_los_get(self, port_num): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_chan_rx_los_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_chan_rx_los_get_args() + args.port_num = port_num + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_pltfm_mgr_qsfp_chan_rx_los_get(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_qsfp_chan_rx_los_get_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_chan_rx_los_get failed: unknown result") + + def pltfm_mgr_qsfp_chan_tx_los_get(self, port_num): + """ + Parameters: + - port_num + + """ + self.send_pltfm_mgr_qsfp_chan_tx_los_get(port_num) + return self.recv_pltfm_mgr_qsfp_chan_tx_los_get() + + def send_pltfm_mgr_qsfp_chan_tx_los_get(self, port_num): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_chan_tx_los_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_chan_tx_los_get_args() + args.port_num = port_num + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_pltfm_mgr_qsfp_chan_tx_los_get(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_qsfp_chan_tx_los_get_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_chan_tx_los_get failed: unknown result") + + def pltfm_mgr_qsfp_chan_tx_fault_get(self, port_num): + """ + Parameters: + - port_num + + """ + self.send_pltfm_mgr_qsfp_chan_tx_fault_get(port_num) + return self.recv_pltfm_mgr_qsfp_chan_tx_fault_get() + + def send_pltfm_mgr_qsfp_chan_tx_fault_get(self, port_num): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_chan_tx_fault_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_chan_tx_fault_get_args() + args.port_num = port_num + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_pltfm_mgr_qsfp_chan_tx_fault_get(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_qsfp_chan_tx_fault_get_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_chan_tx_fault_get failed: unknown result") + + def pltfm_mgr_qsfp_temperature_get(self, port_num): + """ + Parameters: + - port_num + + """ + self.send_pltfm_mgr_qsfp_temperature_get(port_num) + return self.recv_pltfm_mgr_qsfp_temperature_get() + + def send_pltfm_mgr_qsfp_temperature_get(self, port_num): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_temperature_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_temperature_get_args() + args.port_num = port_num + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_pltfm_mgr_qsfp_temperature_get(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_qsfp_temperature_get_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_temperature_get failed: unknown result") + + def pltfm_mgr_qsfp_voltage_get(self, port_num): + """ + Parameters: + - port_num + + """ + self.send_pltfm_mgr_qsfp_voltage_get(port_num) + return self.recv_pltfm_mgr_qsfp_voltage_get() + + def send_pltfm_mgr_qsfp_voltage_get(self, port_num): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_voltage_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_voltage_get_args() + args.port_num = port_num + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_pltfm_mgr_qsfp_voltage_get(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_qsfp_voltage_get_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_voltage_get failed: unknown result") + + def pltfm_mgr_qsfp_thresholds_get(self, port_num): + """ + Parameters: + - port_num + + """ + self.send_pltfm_mgr_qsfp_thresholds_get(port_num) + return self.recv_pltfm_mgr_qsfp_thresholds_get() + + def send_pltfm_mgr_qsfp_thresholds_get(self, port_num): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_thresholds_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_thresholds_get_args() + args.port_num = port_num + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_pltfm_mgr_qsfp_thresholds_get(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_qsfp_thresholds_get_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_thresholds_get failed: unknown result") + + def pltfm_mgr_qsfp_tx_is_disabled(self, port_num, channel): + """ + Parameters: + - port_num + - channel + + """ + self.send_pltfm_mgr_qsfp_tx_is_disabled(port_num, channel) + return self.recv_pltfm_mgr_qsfp_tx_is_disabled() + + def send_pltfm_mgr_qsfp_tx_is_disabled(self, port_num, channel): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_tx_is_disabled', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_tx_is_disabled_args() + args.port_num = port_num + args.channel = channel + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_pltfm_mgr_qsfp_tx_is_disabled(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_qsfp_tx_is_disabled_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_tx_is_disabled failed: unknown result") + + def pltfm_mgr_qsfp_lpmode_get(self, port_num): + """ + Parameters: + - port_num + + """ + self.send_pltfm_mgr_qsfp_lpmode_get(port_num) + return self.recv_pltfm_mgr_qsfp_lpmode_get() + + def send_pltfm_mgr_qsfp_lpmode_get(self, port_num): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_lpmode_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_lpmode_get_args() + args.port_num = port_num + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_pltfm_mgr_qsfp_lpmode_get(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_qsfp_lpmode_get_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_lpmode_get failed: unknown result") + + def pltfm_mgr_qsfp_pwr_override_get(self, port_num): + """ + Parameters: + - port_num + + """ + self.send_pltfm_mgr_qsfp_pwr_override_get(port_num) + return self.recv_pltfm_mgr_qsfp_pwr_override_get() + + def send_pltfm_mgr_qsfp_pwr_override_get(self, port_num): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_pwr_override_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_pwr_override_get_args() + args.port_num = port_num + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_pltfm_mgr_qsfp_pwr_override_get(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_qsfp_pwr_override_get_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_pwr_override_get failed: unknown result") + + def pltfm_mgr_qsfp_pwr_override_set(self, port_num, power_override, power_set): + """ + Parameters: + - port_num + - power_override + - power_set + + """ + self.send_pltfm_mgr_qsfp_pwr_override_set(port_num, power_override, power_set) + return self.recv_pltfm_mgr_qsfp_pwr_override_set() + + def send_pltfm_mgr_qsfp_pwr_override_set(self, port_num, power_override, power_set): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_pwr_override_set', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_pwr_override_set_args() + args.port_num = port_num + args.power_override = power_override + args.power_set = power_set + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_pltfm_mgr_qsfp_pwr_override_set(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_qsfp_pwr_override_set_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_pwr_override_set failed: unknown result") + + def pltfm_mgr_qsfp_lpmode_set(self, port_num, lpmode): + """ + Parameters: + - port_num + - lpmode + + """ + self.send_pltfm_mgr_qsfp_lpmode_set(port_num, lpmode) + return self.recv_pltfm_mgr_qsfp_lpmode_set() + + def send_pltfm_mgr_qsfp_lpmode_set(self, port_num, lpmode): + self._oprot.writeMessageBegin('pltfm_mgr_qsfp_lpmode_set', TMessageType.CALL, self._seqid) + args = pltfm_mgr_qsfp_lpmode_set_args() + args.port_num = port_num + args.lpmode = lpmode + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_pltfm_mgr_qsfp_lpmode_set(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_qsfp_lpmode_set_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_qsfp_lpmode_set failed: unknown result") + + def pltfm_mgr_sensor_info_get(self, options): + """ + Parameters: + - options + + """ + self.send_pltfm_mgr_sensor_info_get(options) + return self.recv_pltfm_mgr_sensor_info_get() + + def send_pltfm_mgr_sensor_info_get(self, options): + self._oprot.writeMessageBegin('pltfm_mgr_sensor_info_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_sensor_info_get_args() + args.options = options + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_pltfm_mgr_sensor_info_get(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_sensor_info_get_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_sensor_info_get failed: unknown result") + + def pltfm_mgr_chss_mgmt_bmc_ver_get(self): + self.send_pltfm_mgr_chss_mgmt_bmc_ver_get() + return self.recv_pltfm_mgr_chss_mgmt_bmc_ver_get() + + def send_pltfm_mgr_chss_mgmt_bmc_ver_get(self): + self._oprot.writeMessageBegin('pltfm_mgr_chss_mgmt_bmc_ver_get', TMessageType.CALL, self._seqid) + args = pltfm_mgr_chss_mgmt_bmc_ver_get_args() + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_pltfm_mgr_chss_mgmt_bmc_ver_get(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = pltfm_mgr_chss_mgmt_bmc_ver_get_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.ouch is not None: + raise result.ouch + raise TApplicationException(TApplicationException.MISSING_RESULT, "pltfm_mgr_chss_mgmt_bmc_ver_get failed: unknown result") + + +class Processor(Iface, TProcessor): + def __init__(self, handler): + self._handler = handler + self._processMap = {} + self._processMap["pltfm_mgr_dummy"] = Processor.process_pltfm_mgr_dummy + self._processMap["pltfm_mgr_sys_tmp_get"] = Processor.process_pltfm_mgr_sys_tmp_get + self._processMap["pltfm_mgr_sys_eeprom_get"] = Processor.process_pltfm_mgr_sys_eeprom_get + self._processMap["pltfm_mgr_pwr_supply_present_get"] = Processor.process_pltfm_mgr_pwr_supply_present_get + self._processMap["pltfm_mgr_pwr_supply_info_get"] = Processor.process_pltfm_mgr_pwr_supply_info_get + self._processMap["pltfm_mgr_pwr_rail_info_get"] = Processor.process_pltfm_mgr_pwr_rail_info_get + self._processMap["pltfm_mgr_fan_speed_set"] = Processor.process_pltfm_mgr_fan_speed_set + self._processMap["pltfm_mgr_fan_info_get"] = Processor.process_pltfm_mgr_fan_info_get + self._processMap["pltfm_mgr_qsfp_cached_num_bytes_get"] = Processor.process_pltfm_mgr_qsfp_cached_num_bytes_get + self._processMap["pltfm_mgr_qsfp_cached_page_get"] = Processor.process_pltfm_mgr_qsfp_cached_page_get + self._processMap["pltfm_mgr_qsfp_presence_get"] = Processor.process_pltfm_mgr_qsfp_presence_get + self._processMap["pltfm_mgr_qsfp_detect_transceiver"] = Processor.process_pltfm_mgr_qsfp_detect_transceiver + self._processMap["pltfm_mgr_qsfp_info_get"] = Processor.process_pltfm_mgr_qsfp_info_get + self._processMap["pltfm_mgr_qsfp_get_max_port"] = Processor.process_pltfm_mgr_qsfp_get_max_port + self._processMap["pltfm_mgr_qsfp_reset"] = Processor.process_pltfm_mgr_qsfp_reset + self._processMap["pltfm_mgr_qsfp_reset_get"] = Processor.process_pltfm_mgr_qsfp_reset_get + self._processMap["pltfm_mgr_qsfp_tx_disable"] = Processor.process_pltfm_mgr_qsfp_tx_disable + self._processMap["pltfm_mgr_qsfp_chan_count_get"] = Processor.process_pltfm_mgr_qsfp_chan_count_get + self._processMap["pltfm_mgr_qsfp_chan_rx_pwr_get"] = Processor.process_pltfm_mgr_qsfp_chan_rx_pwr_get + self._processMap["pltfm_mgr_qsfp_chan_tx_bias_get"] = Processor.process_pltfm_mgr_qsfp_chan_tx_bias_get + self._processMap["pltfm_mgr_qsfp_chan_tx_pwr_get"] = Processor.process_pltfm_mgr_qsfp_chan_tx_pwr_get + self._processMap["pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get"] = Processor.process_pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get + self._processMap["pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get"] = Processor.process_pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get + self._processMap["pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get"] = Processor.process_pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get + self._processMap["pltfm_mgr_qsfp_chan_rx_los_get"] = Processor.process_pltfm_mgr_qsfp_chan_rx_los_get + self._processMap["pltfm_mgr_qsfp_chan_tx_los_get"] = Processor.process_pltfm_mgr_qsfp_chan_tx_los_get + self._processMap["pltfm_mgr_qsfp_chan_tx_fault_get"] = Processor.process_pltfm_mgr_qsfp_chan_tx_fault_get + self._processMap["pltfm_mgr_qsfp_temperature_get"] = Processor.process_pltfm_mgr_qsfp_temperature_get + self._processMap["pltfm_mgr_qsfp_voltage_get"] = Processor.process_pltfm_mgr_qsfp_voltage_get + self._processMap["pltfm_mgr_qsfp_thresholds_get"] = Processor.process_pltfm_mgr_qsfp_thresholds_get + self._processMap["pltfm_mgr_qsfp_tx_is_disabled"] = Processor.process_pltfm_mgr_qsfp_tx_is_disabled + self._processMap["pltfm_mgr_qsfp_lpmode_get"] = Processor.process_pltfm_mgr_qsfp_lpmode_get + self._processMap["pltfm_mgr_qsfp_pwr_override_get"] = Processor.process_pltfm_mgr_qsfp_pwr_override_get + self._processMap["pltfm_mgr_qsfp_pwr_override_set"] = Processor.process_pltfm_mgr_qsfp_pwr_override_set + self._processMap["pltfm_mgr_qsfp_lpmode_set"] = Processor.process_pltfm_mgr_qsfp_lpmode_set + self._processMap["pltfm_mgr_sensor_info_get"] = Processor.process_pltfm_mgr_sensor_info_get + self._processMap["pltfm_mgr_chss_mgmt_bmc_ver_get"] = Processor.process_pltfm_mgr_chss_mgmt_bmc_ver_get + self._on_message_begin = None + + def on_message_begin(self, func): + self._on_message_begin = func + + def process(self, iprot, oprot): + (name, type, seqid) = iprot.readMessageBegin() + if self._on_message_begin: + self._on_message_begin(name, type, seqid) + if name not in self._processMap: + iprot.skip(TType.STRUCT) + iprot.readMessageEnd() + x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name)) + oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid) + x.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + return + else: + self._processMap[name](self, seqid, iprot, oprot) + return True + + def process_pltfm_mgr_dummy(self, seqid, iprot, oprot): + args = pltfm_mgr_dummy_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_dummy_result() + try: + result.success = self._handler.pltfm_mgr_dummy(args.device) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_dummy", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_sys_tmp_get(self, seqid, iprot, oprot): + args = pltfm_mgr_sys_tmp_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_sys_tmp_get_result() + try: + result.success = self._handler.pltfm_mgr_sys_tmp_get() + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_sys_tmp_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_sys_eeprom_get(self, seqid, iprot, oprot): + args = pltfm_mgr_sys_eeprom_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_sys_eeprom_get_result() + try: + result.success = self._handler.pltfm_mgr_sys_eeprom_get() + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_sys_eeprom_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_pwr_supply_present_get(self, seqid, iprot, oprot): + args = pltfm_mgr_pwr_supply_present_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_pwr_supply_present_get_result() + try: + result.success = self._handler.pltfm_mgr_pwr_supply_present_get(args.ps_num) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_pwr_supply_present_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_pwr_supply_info_get(self, seqid, iprot, oprot): + args = pltfm_mgr_pwr_supply_info_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_pwr_supply_info_get_result() + try: + result.success = self._handler.pltfm_mgr_pwr_supply_info_get(args.ps_num) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_pwr_supply_info_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_pwr_rail_info_get(self, seqid, iprot, oprot): + args = pltfm_mgr_pwr_rail_info_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_pwr_rail_info_get_result() + try: + result.success = self._handler.pltfm_mgr_pwr_rail_info_get(args.ps_num) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_pwr_rail_info_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_fan_speed_set(self, seqid, iprot, oprot): + args = pltfm_mgr_fan_speed_set_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_fan_speed_set_result() + try: + result.success = self._handler.pltfm_mgr_fan_speed_set(args.fan_num, args.percent) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_fan_speed_set", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_fan_info_get(self, seqid, iprot, oprot): + args = pltfm_mgr_fan_info_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_fan_info_get_result() + try: + result.success = self._handler.pltfm_mgr_fan_info_get(args.fan_num) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_fan_info_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_cached_num_bytes_get(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_cached_num_bytes_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_cached_num_bytes_get_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_cached_num_bytes_get(args.port_num, args.page, args.offset, args.length) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_cached_num_bytes_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_cached_page_get(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_cached_page_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_cached_page_get_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_cached_page_get(args.port_num, args.page) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_cached_page_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_presence_get(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_presence_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_presence_get_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_presence_get(args.port_num) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_presence_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_detect_transceiver(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_detect_transceiver_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_detect_transceiver_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_detect_transceiver(args.port_num) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_detect_transceiver", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_info_get(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_info_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_info_get_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_info_get(args.port_num) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_info_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_get_max_port(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_get_max_port_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_get_max_port_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_get_max_port() + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_get_max_port", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_reset(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_reset_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_reset_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_reset(args.port_num, args.reset) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_reset", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_reset_get(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_reset_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_reset_get_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_reset_get(args.port_num) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_reset_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_tx_disable(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_tx_disable_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_tx_disable_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_tx_disable(args.port_num, args.channel_mask, args.disable) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_tx_disable", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_chan_count_get(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_chan_count_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_chan_count_get_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_chan_count_get(args.port_num) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_chan_count_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_chan_rx_pwr_get(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_chan_rx_pwr_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_chan_rx_pwr_get_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_chan_rx_pwr_get(args.port_num) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_chan_rx_pwr_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_chan_tx_bias_get(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_chan_tx_bias_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_chan_tx_bias_get_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_chan_tx_bias_get(args.port_num) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_chan_tx_bias_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_chan_tx_pwr_get(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_chan_tx_pwr_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_chan_tx_pwr_get_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_chan_tx_pwr_get(args.port_num) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_chan_tx_pwr_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get(args.port_num) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get(args.port_num) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get(args.port_num) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_chan_rx_los_get(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_chan_rx_los_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_chan_rx_los_get_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_chan_rx_los_get(args.port_num) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_chan_rx_los_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_chan_tx_los_get(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_chan_tx_los_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_chan_tx_los_get_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_chan_tx_los_get(args.port_num) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_chan_tx_los_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_chan_tx_fault_get(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_chan_tx_fault_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_chan_tx_fault_get_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_chan_tx_fault_get(args.port_num) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_chan_tx_fault_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_temperature_get(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_temperature_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_temperature_get_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_temperature_get(args.port_num) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_temperature_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_voltage_get(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_voltage_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_voltage_get_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_voltage_get(args.port_num) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_voltage_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_thresholds_get(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_thresholds_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_thresholds_get_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_thresholds_get(args.port_num) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_thresholds_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_tx_is_disabled(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_tx_is_disabled_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_tx_is_disabled_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_tx_is_disabled(args.port_num, args.channel) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_tx_is_disabled", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_lpmode_get(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_lpmode_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_lpmode_get_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_lpmode_get(args.port_num) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_lpmode_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_pwr_override_get(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_pwr_override_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_pwr_override_get_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_pwr_override_get(args.port_num) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_pwr_override_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_pwr_override_set(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_pwr_override_set_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_pwr_override_set_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_pwr_override_set(args.port_num, args.power_override, args.power_set) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_pwr_override_set", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_qsfp_lpmode_set(self, seqid, iprot, oprot): + args = pltfm_mgr_qsfp_lpmode_set_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_qsfp_lpmode_set_result() + try: + result.success = self._handler.pltfm_mgr_qsfp_lpmode_set(args.port_num, args.lpmode) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_qsfp_lpmode_set", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_sensor_info_get(self, seqid, iprot, oprot): + args = pltfm_mgr_sensor_info_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_sensor_info_get_result() + try: + result.success = self._handler.pltfm_mgr_sensor_info_get(args.options) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_sensor_info_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_pltfm_mgr_chss_mgmt_bmc_ver_get(self, seqid, iprot, oprot): + args = pltfm_mgr_chss_mgmt_bmc_ver_get_args() + args.read(iprot) + iprot.readMessageEnd() + result = pltfm_mgr_chss_mgmt_bmc_ver_get_result() + try: + result.success = self._handler.pltfm_mgr_chss_mgmt_bmc_ver_get() + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except InvalidPltfmMgrOperation as ouch: + msg_type = TMessageType.REPLY + result.ouch = ouch + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("pltfm_mgr_chss_mgmt_bmc_ver_get", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + +# HELPER FUNCTIONS AND STRUCTURES + + +class pltfm_mgr_dummy_args(object): + """ + Attributes: + - device + + """ + + + def __init__(self, device=None,): + self.device = device + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.BYTE: + self.device = iprot.readByte() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_dummy_args') + if self.device is not None: + oprot.writeFieldBegin('device', TType.BYTE, 1) + oprot.writeByte(self.device) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_dummy_args) +pltfm_mgr_dummy_args.thrift_spec = ( + None, # 0 + (1, TType.BYTE, 'device', None, None, ), # 1 +) + + +class pltfm_mgr_dummy_result(object): + """ + Attributes: + - success + + """ + + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.I32: + self.success = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_dummy_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.I32, 0) + oprot.writeI32(self.success) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_dummy_result) +pltfm_mgr_dummy_result.thrift_spec = ( + (0, TType.I32, 'success', None, None, ), # 0 +) + + +class pltfm_mgr_sys_tmp_get_args(object): + + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_sys_tmp_get_args') + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_sys_tmp_get_args) +pltfm_mgr_sys_tmp_get_args.thrift_spec = ( +) + + +class pltfm_mgr_sys_tmp_get_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = pltfm_mgr_sys_tmp_t() + self.success.read(iprot) + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_sys_tmp_get_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_sys_tmp_get_result) +pltfm_mgr_sys_tmp_get_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [pltfm_mgr_sys_tmp_t, None], None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) + + +class pltfm_mgr_sys_eeprom_get_args(object): + + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_sys_eeprom_get_args') + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_sys_eeprom_get_args) +pltfm_mgr_sys_eeprom_get_args.thrift_spec = ( +) + + +class pltfm_mgr_sys_eeprom_get_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = pltfm_mgr_eeprom_t() + self.success.read(iprot) + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_sys_eeprom_get_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_sys_eeprom_get_result) +pltfm_mgr_sys_eeprom_get_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [pltfm_mgr_eeprom_t, None], None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) + + +class pltfm_mgr_pwr_supply_present_get_args(object): + """ + Attributes: + - ps_num + + """ + + + def __init__(self, ps_num=None,): + self.ps_num = ps_num + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I16: + self.ps_num = iprot.readI16() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_pwr_supply_present_get_args') + if self.ps_num is not None: + oprot.writeFieldBegin('ps_num', TType.I16, 1) + oprot.writeI16(self.ps_num) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_pwr_supply_present_get_args) +pltfm_mgr_pwr_supply_present_get_args.thrift_spec = ( + None, # 0 + (1, TType.I16, 'ps_num', None, None, ), # 1 +) + + +class pltfm_mgr_pwr_supply_present_get_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.BOOL: + self.success = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_pwr_supply_present_get_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.BOOL, 0) + oprot.writeBool(self.success) + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_pwr_supply_present_get_result) +pltfm_mgr_pwr_supply_present_get_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) + + +class pltfm_mgr_pwr_supply_info_get_args(object): + """ + Attributes: + - ps_num + + """ + + + def __init__(self, ps_num=None,): + self.ps_num = ps_num + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I16: + self.ps_num = iprot.readI16() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_pwr_supply_info_get_args') + if self.ps_num is not None: + oprot.writeFieldBegin('ps_num', TType.I16, 1) + oprot.writeI16(self.ps_num) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_pwr_supply_info_get_args) +pltfm_mgr_pwr_supply_info_get_args.thrift_spec = ( + None, # 0 + (1, TType.I16, 'ps_num', None, None, ), # 1 +) + + +class pltfm_mgr_pwr_supply_info_get_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = pltfm_mgr_pwr_supply_info_t() + self.success.read(iprot) + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_pwr_supply_info_get_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_pwr_supply_info_get_result) +pltfm_mgr_pwr_supply_info_get_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [pltfm_mgr_pwr_supply_info_t, None], None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) + + +class pltfm_mgr_pwr_rail_info_get_args(object): + """ + Attributes: + - ps_num + + """ + + + def __init__(self, ps_num=None,): + self.ps_num = ps_num + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I16: + self.ps_num = iprot.readI16() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_pwr_rail_info_get_args') + if self.ps_num is not None: + oprot.writeFieldBegin('ps_num', TType.I16, 1) + oprot.writeI16(self.ps_num) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_pwr_rail_info_get_args) +pltfm_mgr_pwr_rail_info_get_args.thrift_spec = ( + None, # 0 + (1, TType.I16, 'ps_num', None, None, ), # 1 +) + + +class pltfm_mgr_pwr_rail_info_get_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = pltfm_mgr_pwr_rail_info_t() + self.success.read(iprot) + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_pwr_rail_info_get_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_pwr_rail_info_get_result) +pltfm_mgr_pwr_rail_info_get_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [pltfm_mgr_pwr_rail_info_t, None], None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) + + +class pltfm_mgr_fan_speed_set_args(object): + """ + Attributes: + - fan_num + - percent + + """ + + + def __init__(self, fan_num=None, percent=None,): + self.fan_num = fan_num + self.percent = percent + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.fan_num = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I32: + self.percent = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_fan_speed_set_args') + if self.fan_num is not None: + oprot.writeFieldBegin('fan_num', TType.I32, 1) + oprot.writeI32(self.fan_num) + oprot.writeFieldEnd() + if self.percent is not None: + oprot.writeFieldBegin('percent', TType.I32, 2) + oprot.writeI32(self.percent) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_fan_speed_set_args) +pltfm_mgr_fan_speed_set_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'fan_num', None, None, ), # 1 + (2, TType.I32, 'percent', None, None, ), # 2 +) + + +class pltfm_mgr_fan_speed_set_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.I32: + self.success = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_fan_speed_set_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.I32, 0) + oprot.writeI32(self.success) + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_fan_speed_set_result) +pltfm_mgr_fan_speed_set_result.thrift_spec = ( + (0, TType.I32, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) + + +class pltfm_mgr_fan_info_get_args(object): + """ + Attributes: + - fan_num + + """ + + + def __init__(self, fan_num=None,): + self.fan_num = fan_num + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.fan_num = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_fan_info_get_args') + if self.fan_num is not None: + oprot.writeFieldBegin('fan_num', TType.I32, 1) + oprot.writeI32(self.fan_num) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_fan_info_get_args) +pltfm_mgr_fan_info_get_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'fan_num', None, None, ), # 1 +) + + +class pltfm_mgr_fan_info_get_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = pltfm_mgr_fan_info_t() + self.success.read(iprot) + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_fan_info_get_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_fan_info_get_result) +pltfm_mgr_fan_info_get_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [pltfm_mgr_fan_info_t, None], None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) + + +class pltfm_mgr_qsfp_cached_num_bytes_get_args(object): + """ + Attributes: + - port_num + - page + - offset + - length + + """ + + + def __init__(self, port_num=None, page=None, offset=None, length=None,): + self.port_num = port_num + self.page = page + self.offset = offset + self.length = length + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.port_num = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I32: + self.page = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.I32: + self.offset = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.I32: + self.length = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_cached_num_bytes_get_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) + oprot.writeFieldEnd() + if self.page is not None: + oprot.writeFieldBegin('page', TType.I32, 2) + oprot.writeI32(self.page) + oprot.writeFieldEnd() + if self.offset is not None: + oprot.writeFieldBegin('offset', TType.I32, 3) + oprot.writeI32(self.offset) + oprot.writeFieldEnd() + if self.length is not None: + oprot.writeFieldBegin('length', TType.I32, 4) + oprot.writeI32(self.length) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_cached_num_bytes_get_args) +pltfm_mgr_qsfp_cached_num_bytes_get_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 + (2, TType.I32, 'page', None, None, ), # 2 + (3, TType.I32, 'offset', None, None, ), # 3 + (4, TType.I32, 'length', None, None, ), # 4 +) + + +class pltfm_mgr_qsfp_cached_num_bytes_get_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRING: + self.success = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_cached_num_bytes_get_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRING, 0) + oprot.writeString(self.success.encode('utf-8') if sys.version_info[0] == 2 else self.success) + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_cached_num_bytes_get_result) +pltfm_mgr_qsfp_cached_num_bytes_get_result.thrift_spec = ( + (0, TType.STRING, 'success', 'UTF8', None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) + + +class pltfm_mgr_qsfp_cached_page_get_args(object): + """ + Attributes: + - port_num + - page + + """ + + + def __init__(self, port_num=None, page=None,): + self.port_num = port_num + self.page = page + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.port_num = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I32: + self.page = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_cached_page_get_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) + oprot.writeFieldEnd() + if self.page is not None: + oprot.writeFieldBegin('page', TType.I32, 2) + oprot.writeI32(self.page) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_cached_page_get_args) +pltfm_mgr_qsfp_cached_page_get_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 + (2, TType.I32, 'page', None, None, ), # 2 +) + + +class pltfm_mgr_qsfp_cached_page_get_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRING: + self.success = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_cached_page_get_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRING, 0) + oprot.writeString(self.success.encode('utf-8') if sys.version_info[0] == 2 else self.success) + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_cached_page_get_result) +pltfm_mgr_qsfp_cached_page_get_result.thrift_spec = ( + (0, TType.STRING, 'success', 'UTF8', None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) + + +class pltfm_mgr_qsfp_presence_get_args(object): + """ + Attributes: + - port_num + + """ + + + def __init__(self, port_num=None,): + self.port_num = port_num + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.port_num = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_presence_get_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_presence_get_args) +pltfm_mgr_qsfp_presence_get_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 +) + + +class pltfm_mgr_qsfp_presence_get_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.BOOL: + self.success = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_presence_get_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.BOOL, 0) + oprot.writeBool(self.success) + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_presence_get_result) +pltfm_mgr_qsfp_presence_get_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) + + +class pltfm_mgr_qsfp_detect_transceiver_args(object): + """ + Attributes: + - port_num + + """ + + + def __init__(self, port_num=None,): + self.port_num = port_num + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.port_num = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_detect_transceiver_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_detect_transceiver_args) +pltfm_mgr_qsfp_detect_transceiver_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 +) + + +class pltfm_mgr_qsfp_detect_transceiver_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.BOOL: + self.success = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_detect_transceiver_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.BOOL, 0) + oprot.writeBool(self.success) + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_detect_transceiver_result) +pltfm_mgr_qsfp_detect_transceiver_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) + + +class pltfm_mgr_qsfp_info_get_args(object): + """ + Attributes: + - port_num + + """ + + + def __init__(self, port_num=None,): + self.port_num = port_num + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.port_num = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_info_get_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_info_get_args) +pltfm_mgr_qsfp_info_get_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 +) + + +class pltfm_mgr_qsfp_info_get_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRING: + self.success = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_info_get_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRING, 0) + oprot.writeString(self.success.encode('utf-8') if sys.version_info[0] == 2 else self.success) + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_info_get_result) +pltfm_mgr_qsfp_info_get_result.thrift_spec = ( + (0, TType.STRING, 'success', 'UTF8', None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) + + +class pltfm_mgr_qsfp_get_max_port_args(object): + + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_get_max_port_args') + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_get_max_port_args) +pltfm_mgr_qsfp_get_max_port_args.thrift_spec = ( +) + + +class pltfm_mgr_qsfp_get_max_port_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.I32: + self.success = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_get_max_port_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.I32, 0) + oprot.writeI32(self.success) + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_get_max_port_result) +pltfm_mgr_qsfp_get_max_port_result.thrift_spec = ( + (0, TType.I32, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) + + +class pltfm_mgr_qsfp_reset_args(object): + """ + Attributes: + - port_num + - reset + + """ + + + def __init__(self, port_num=None, reset=None,): + self.port_num = port_num + self.reset = reset + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.port_num = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.BOOL: + self.reset = iprot.readBool() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_reset_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) + oprot.writeFieldEnd() + if self.reset is not None: + oprot.writeFieldBegin('reset', TType.BOOL, 2) + oprot.writeBool(self.reset) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_reset_args) +pltfm_mgr_qsfp_reset_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 + (2, TType.BOOL, 'reset', None, None, ), # 2 +) + + +class pltfm_mgr_qsfp_reset_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.I32: + self.success = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_reset_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.I32, 0) + oprot.writeI32(self.success) + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_reset_result) +pltfm_mgr_qsfp_reset_result.thrift_spec = ( + (0, TType.I32, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) + + +class pltfm_mgr_qsfp_reset_get_args(object): + """ + Attributes: + - port_num + + """ + + + def __init__(self, port_num=None,): + self.port_num = port_num + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.port_num = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_reset_get_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_reset_get_args) +pltfm_mgr_qsfp_reset_get_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 +) + + +class pltfm_mgr_qsfp_reset_get_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.BOOL: + self.success = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_reset_get_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.BOOL, 0) + oprot.writeBool(self.success) + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_reset_get_result) +pltfm_mgr_qsfp_reset_get_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) + + +class pltfm_mgr_qsfp_tx_disable_args(object): + """ + Attributes: + - port_num + - channel_mask + - disable + + """ + + + def __init__(self, port_num=None, channel_mask=None, disable=None,): + self.port_num = port_num + self.channel_mask = channel_mask + self.disable = disable + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.port_num = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I32: + self.channel_mask = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.BOOL: + self.disable = iprot.readBool() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_tx_disable_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) + oprot.writeFieldEnd() + if self.channel_mask is not None: + oprot.writeFieldBegin('channel_mask', TType.I32, 2) + oprot.writeI32(self.channel_mask) + oprot.writeFieldEnd() + if self.disable is not None: + oprot.writeFieldBegin('disable', TType.BOOL, 3) + oprot.writeBool(self.disable) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_tx_disable_args) +pltfm_mgr_qsfp_tx_disable_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 + (2, TType.I32, 'channel_mask', None, None, ), # 2 + (3, TType.BOOL, 'disable', None, None, ), # 3 +) + + +class pltfm_mgr_qsfp_tx_disable_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.I32: + self.success = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_tx_disable_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.I32, 0) + oprot.writeI32(self.success) + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_tx_disable_result) +pltfm_mgr_qsfp_tx_disable_result.thrift_spec = ( + (0, TType.I32, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) + + +class pltfm_mgr_qsfp_chan_count_get_args(object): + """ + Attributes: + - port_num + + """ + + + def __init__(self, port_num=None,): + self.port_num = port_num + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.port_num = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_chan_count_get_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_chan_count_get_args) +pltfm_mgr_qsfp_chan_count_get_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 +) + + +class pltfm_mgr_qsfp_chan_count_get_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.I32: + self.success = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_chan_count_get_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.I32, 0) + oprot.writeI32(self.success) + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_chan_count_get_result) +pltfm_mgr_qsfp_chan_count_get_result.thrift_spec = ( + (0, TType.I32, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) + + +class pltfm_mgr_qsfp_chan_rx_pwr_get_args(object): + """ + Attributes: + - port_num + + """ + + + def __init__(self, port_num=None,): + self.port_num = port_num + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.port_num = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_chan_rx_pwr_get_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_chan_rx_pwr_get_args) +pltfm_mgr_qsfp_chan_rx_pwr_get_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 +) + + +class pltfm_mgr_qsfp_chan_rx_pwr_get_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.LIST: + self.success = [] + (_etype3, _size0) = iprot.readListBegin() + for _i4 in range(_size0): + _elem5 = iprot.readDouble() + self.success.append(_elem5) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_chan_rx_pwr_get_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.DOUBLE, len(self.success)) + for iter6 in self.success: + oprot.writeDouble(iter6) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_chan_rx_pwr_get_result) +pltfm_mgr_qsfp_chan_rx_pwr_get_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.DOUBLE, None, False), None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) + + +class pltfm_mgr_qsfp_chan_tx_bias_get_args(object): + """ + Attributes: + - port_num + + """ + + + def __init__(self, port_num=None,): + self.port_num = port_num + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.port_num = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_chan_tx_bias_get_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_chan_tx_bias_get_args) +pltfm_mgr_qsfp_chan_tx_bias_get_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 +) + + +class pltfm_mgr_qsfp_chan_tx_bias_get_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.LIST: + self.success = [] + (_etype10, _size7) = iprot.readListBegin() + for _i11 in range(_size7): + _elem12 = iprot.readDouble() + self.success.append(_elem12) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_chan_tx_bias_get_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.DOUBLE, len(self.success)) + for iter13 in self.success: + oprot.writeDouble(iter13) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_chan_tx_bias_get_result) +pltfm_mgr_qsfp_chan_tx_bias_get_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.DOUBLE, None, False), None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) + + +class pltfm_mgr_qsfp_chan_tx_pwr_get_args(object): + """ + Attributes: + - port_num + + """ + + + def __init__(self, port_num=None,): + self.port_num = port_num + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.port_num = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_chan_tx_pwr_get_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_chan_tx_pwr_get_args) +pltfm_mgr_qsfp_chan_tx_pwr_get_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 +) + + +class pltfm_mgr_qsfp_chan_tx_pwr_get_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.LIST: + self.success = [] + (_etype17, _size14) = iprot.readListBegin() + for _i18 in range(_size14): + _elem19 = iprot.readDouble() + self.success.append(_elem19) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_chan_tx_pwr_get_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.DOUBLE, len(self.success)) + for iter20 in self.success: + oprot.writeDouble(iter20) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_chan_tx_pwr_get_result) +pltfm_mgr_qsfp_chan_tx_pwr_get_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.DOUBLE, None, False), None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) + + +class pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get_args(object): + """ + Attributes: + - port_num + + """ + + + def __init__(self, port_num=None,): + self.port_num = port_num + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.port_num = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get_args) +pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 +) + + +class pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get_result(object): + """ + Attributes: + - success + - ouch + + """ + + + def __init__(self, success=None, ouch=None,): + self.success = success + self.ouch = ouch + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.LIST: + self.success = [] + (_etype24, _size21) = iprot.readListBegin() + for _i25 in range(_size21): + _elem26 = pltfm_mgr_qsfp_alarm_flags_t() + _elem26.read(iprot) + self.success.append(_elem26) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() - def process_pltfm_mgr_qsfp_reset(self, seqid, iprot, oprot): - args = pltfm_mgr_qsfp_reset_args() - args.read(iprot) - iprot.readMessageEnd() - result = pltfm_mgr_qsfp_reset_result() - try: - result.success = self._handler.pltfm_mgr_qsfp_reset(args.port_num, args.reset) - msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): - raise - except InvalidPltfmMgrOperation as ouch: - msg_type = TMessageType.REPLY - result.ouch = ouch - except Exception as ex: - msg_type = TMessageType.EXCEPTION - logging.exception(ex) - result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') - oprot.writeMessageBegin("pltfm_mgr_qsfp_reset", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.STRUCT, len(self.success)) + for iter27 in self.success: + iter27.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() - def process_pltfm_mgr_qsfp_lpmode_get(self, seqid, iprot, oprot): - args = pltfm_mgr_qsfp_lpmode_get_args() - args.read(iprot) - iprot.readMessageEnd() - result = pltfm_mgr_qsfp_lpmode_get_result() - try: - result.success = self._handler.pltfm_mgr_qsfp_lpmode_get(args.port_num) - msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): - raise - except InvalidPltfmMgrOperation as ouch: - msg_type = TMessageType.REPLY - result.ouch = ouch - except Exception as ex: - msg_type = TMessageType.EXCEPTION - logging.exception(ex) - result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') - oprot.writeMessageBegin("pltfm_mgr_qsfp_lpmode_get", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() + def validate(self): + return - def process_pltfm_mgr_qsfp_lpmode_set(self, seqid, iprot, oprot): - args = pltfm_mgr_qsfp_lpmode_set_args() - args.read(iprot) - iprot.readMessageEnd() - result = pltfm_mgr_qsfp_lpmode_set_result() - try: - result.success = self._handler.pltfm_mgr_qsfp_lpmode_set(args.port_num, args.lpmode) - msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): - raise - except InvalidPltfmMgrOperation as ouch: - msg_type = TMessageType.REPLY - result.ouch = ouch - except Exception as ex: - msg_type = TMessageType.EXCEPTION - logging.exception(ex) - result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') - oprot.writeMessageBegin("pltfm_mgr_qsfp_lpmode_set", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) - def process_pltfm_mgr_sensor_info_get(self, seqid, iprot, oprot): - args = pltfm_mgr_sensor_info_get_args() - args.read(iprot) - iprot.readMessageEnd() - result = pltfm_mgr_sensor_info_get_result() - try: - result.success = self._handler.pltfm_mgr_sensor_info_get(args.options) - msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): - raise - except InvalidPltfmMgrOperation as ouch: - msg_type = TMessageType.REPLY - result.ouch = ouch - except Exception as ex: - msg_type = TMessageType.EXCEPTION - logging.exception(ex) - result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') - oprot.writeMessageBegin("pltfm_mgr_sensor_info_get", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ -# HELPER FUNCTIONS AND STRUCTURES + def __ne__(self, other): + return not (self == other) +all_structs.append(pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get_result) +pltfm_mgr_qsfp_chan_rx_pwr_alarm_flags_get_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.STRUCT, [pltfm_mgr_qsfp_alarm_flags_t, None], False), None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) -class pltfm_mgr_dummy_args(object): +class pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get_args(object): """ Attributes: - - device + - port_num + """ - thrift_spec = ( - None, # 0 - (1, TType.BYTE, 'device', None, None, ), # 1 - ) - def __init__(self, device=None,): - self.device = device + def __init__(self, port_num=None,): + self.port_num = port_num def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -994,8 +5653,8 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 1: - if ftype == TType.BYTE: - self.device = iprot.readByte() + if ftype == TType.I32: + self.port_num = iprot.readI32() else: iprot.skip(ftype) else: @@ -1005,12 +5664,12 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_dummy_args') - if self.device is not None: - oprot.writeFieldBegin('device', TType.BYTE, 1) - oprot.writeByte(self.device) + oprot.writeStructBegin('pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -1028,24 +5687,29 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get_args) +pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 +) -class pltfm_mgr_dummy_result(object): +class pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get_result(object): """ Attributes: - success + - ouch + """ - thrift_spec = ( - (0, TType.I32, 'success', None, None, ), # 0 - ) - def __init__(self, success=None,): + def __init__(self, success=None, ouch=None,): self.success = success + self.ouch = ouch def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -1053,8 +5717,19 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 0: - if ftype == TType.I32: - self.success = iprot.readI32() + if ftype == TType.LIST: + self.success = [] + (_etype31, _size28) = iprot.readListBegin() + for _i32 in range(_size28): + _elem33 = pltfm_mgr_qsfp_alarm_flags_t() + _elem33.read(iprot) + self.success.append(_elem33) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -1064,12 +5739,19 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_dummy_result') + oprot.writeStructBegin('pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get_result') if self.success is not None: - oprot.writeFieldBegin('success', TType.I32, 0) - oprot.writeI32(self.success) + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.STRUCT, len(self.success)) + for iter34 in self.success: + iter34.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.ouch is not None: + oprot.writeFieldBegin('ouch', TType.STRUCT, 1) + self.ouch.write(oprot) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -1087,22 +5769,38 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get_result) +pltfm_mgr_qsfp_chan_tx_bias_alarm_flags_get_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.STRUCT, [pltfm_mgr_qsfp_alarm_flags_t, None], False), None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) -class pltfm_mgr_sys_tmp_get_args(object): +class pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get_args(object): + """ + Attributes: + - port_num + + """ - thrift_spec = ( - ) + + def __init__(self, port_num=None,): + self.port_num = port_num def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: break + if fid == 1: + if ftype == TType.I32: + self.port_num = iprot.readI32() + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -1110,9 +5808,13 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_sys_tmp_get_args') + oprot.writeStructBegin('pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -1129,19 +5831,21 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get_args) +pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 +) -class pltfm_mgr_sys_tmp_get_result(object): +class pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get_result(object): """ Attributes: - success - ouch + """ - thrift_spec = ( - (0, TType.STRUCT, 'success', (pltfm_mgr_sys_tmp_t, pltfm_mgr_sys_tmp_t.thrift_spec), None, ), # 0 - (1, TType.STRUCT, 'ouch', (InvalidPltfmMgrOperation, InvalidPltfmMgrOperation.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, ouch=None,): self.success = success @@ -1149,7 +5853,7 @@ def __init__(self, success=None, ouch=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -1157,15 +5861,19 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 0: - if ftype == TType.STRUCT: - self.success = pltfm_mgr_sys_tmp_t() - self.success.read(iprot) + if ftype == TType.LIST: + self.success = [] + (_etype38, _size35) = iprot.readListBegin() + for _i39 in range(_size35): + _elem40 = pltfm_mgr_qsfp_alarm_flags_t() + _elem40.read(iprot) + self.success.append(_elem40) + iprot.readListEnd() else: iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -1175,12 +5883,15 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_sys_tmp_get_result') + oprot.writeStructBegin('pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get_result') if self.success is not None: - oprot.writeFieldBegin('success', TType.STRUCT, 0) - self.success.write(oprot) + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.STRUCT, len(self.success)) + for iter41 in self.success: + iter41.write(oprot) + oprot.writeListEnd() oprot.writeFieldEnd() if self.ouch is not None: oprot.writeFieldBegin('ouch', TType.STRUCT, 1) @@ -1202,22 +5913,38 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get_result) +pltfm_mgr_qsfp_chan_tx_pwr_alarm_flags_get_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.STRUCT, [pltfm_mgr_qsfp_alarm_flags_t, None], False), None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) -class pltfm_mgr_sys_eeprom_get_args(object): +class pltfm_mgr_qsfp_chan_rx_los_get_args(object): + """ + Attributes: + - port_num + + """ + - thrift_spec = ( - ) + def __init__(self, port_num=None,): + self.port_num = port_num def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: break + if fid == 1: + if ftype == TType.I32: + self.port_num = iprot.readI32() + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -1225,9 +5952,13 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_sys_eeprom_get_args') + oprot.writeStructBegin('pltfm_mgr_qsfp_chan_rx_los_get_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -1244,19 +5975,21 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_chan_rx_los_get_args) +pltfm_mgr_qsfp_chan_rx_los_get_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 +) -class pltfm_mgr_sys_eeprom_get_result(object): +class pltfm_mgr_qsfp_chan_rx_los_get_result(object): """ Attributes: - success - ouch + """ - thrift_spec = ( - (0, TType.STRUCT, 'success', (pltfm_mgr_eeprom_t, pltfm_mgr_eeprom_t.thrift_spec), None, ), # 0 - (1, TType.STRUCT, 'ouch', (InvalidPltfmMgrOperation, InvalidPltfmMgrOperation.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, ouch=None,): self.success = success @@ -1264,7 +5997,7 @@ def __init__(self, success=None, ouch=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -1272,15 +6005,18 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 0: - if ftype == TType.STRUCT: - self.success = pltfm_mgr_eeprom_t() - self.success.read(iprot) + if ftype == TType.LIST: + self.success = [] + (_etype45, _size42) = iprot.readListBegin() + for _i46 in range(_size42): + _elem47 = iprot.readBool() + self.success.append(_elem47) + iprot.readListEnd() else: iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -1290,12 +6026,15 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_sys_eeprom_get_result') + oprot.writeStructBegin('pltfm_mgr_qsfp_chan_rx_los_get_result') if self.success is not None: - oprot.writeFieldBegin('success', TType.STRUCT, 0) - self.success.write(oprot) + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.BOOL, len(self.success)) + for iter48 in self.success: + oprot.writeBool(iter48) + oprot.writeListEnd() oprot.writeFieldEnd() if self.ouch is not None: oprot.writeFieldBegin('ouch', TType.STRUCT, 1) @@ -1317,25 +6056,27 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_chan_rx_los_get_result) +pltfm_mgr_qsfp_chan_rx_los_get_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.BOOL, None, False), None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) -class pltfm_mgr_pwr_supply_present_get_args(object): +class pltfm_mgr_qsfp_chan_tx_los_get_args(object): """ Attributes: - - ps_num + - port_num + """ - thrift_spec = ( - None, # 0 - (1, TType.I16, 'ps_num', None, None, ), # 1 - ) - def __init__(self, ps_num=None,): - self.ps_num = ps_num + def __init__(self, port_num=None,): + self.port_num = port_num def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -1343,8 +6084,8 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 1: - if ftype == TType.I16: - self.ps_num = iprot.readI16() + if ftype == TType.I32: + self.port_num = iprot.readI32() else: iprot.skip(ftype) else: @@ -1354,12 +6095,12 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_pwr_supply_present_get_args') - if self.ps_num is not None: - oprot.writeFieldBegin('ps_num', TType.I16, 1) - oprot.writeI16(self.ps_num) + oprot.writeStructBegin('pltfm_mgr_qsfp_chan_tx_los_get_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -1377,19 +6118,21 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_chan_tx_los_get_args) +pltfm_mgr_qsfp_chan_tx_los_get_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 +) -class pltfm_mgr_pwr_supply_present_get_result(object): +class pltfm_mgr_qsfp_chan_tx_los_get_result(object): """ Attributes: - success - ouch + """ - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'ouch', (InvalidPltfmMgrOperation, InvalidPltfmMgrOperation.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, ouch=None,): self.success = success @@ -1397,7 +6140,7 @@ def __init__(self, success=None, ouch=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -1405,14 +6148,18 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 0: - if ftype == TType.BOOL: - self.success = iprot.readBool() + if ftype == TType.LIST: + self.success = [] + (_etype52, _size49) = iprot.readListBegin() + for _i53 in range(_size49): + _elem54 = iprot.readBool() + self.success.append(_elem54) + iprot.readListEnd() else: iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -1422,12 +6169,15 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_pwr_supply_present_get_result') + oprot.writeStructBegin('pltfm_mgr_qsfp_chan_tx_los_get_result') if self.success is not None: - oprot.writeFieldBegin('success', TType.BOOL, 0) - oprot.writeBool(self.success) + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.BOOL, len(self.success)) + for iter55 in self.success: + oprot.writeBool(iter55) + oprot.writeListEnd() oprot.writeFieldEnd() if self.ouch is not None: oprot.writeFieldBegin('ouch', TType.STRUCT, 1) @@ -1449,25 +6199,27 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_chan_tx_los_get_result) +pltfm_mgr_qsfp_chan_tx_los_get_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.BOOL, None, False), None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) -class pltfm_mgr_pwr_supply_info_get_args(object): +class pltfm_mgr_qsfp_chan_tx_fault_get_args(object): """ Attributes: - - ps_num + - port_num + """ - thrift_spec = ( - None, # 0 - (1, TType.I16, 'ps_num', None, None, ), # 1 - ) - def __init__(self, ps_num=None,): - self.ps_num = ps_num + def __init__(self, port_num=None,): + self.port_num = port_num def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -1475,8 +6227,8 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 1: - if ftype == TType.I16: - self.ps_num = iprot.readI16() + if ftype == TType.I32: + self.port_num = iprot.readI32() else: iprot.skip(ftype) else: @@ -1486,12 +6238,12 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_pwr_supply_info_get_args') - if self.ps_num is not None: - oprot.writeFieldBegin('ps_num', TType.I16, 1) - oprot.writeI16(self.ps_num) + oprot.writeStructBegin('pltfm_mgr_qsfp_chan_tx_fault_get_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -1509,19 +6261,21 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_chan_tx_fault_get_args) +pltfm_mgr_qsfp_chan_tx_fault_get_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 +) -class pltfm_mgr_pwr_supply_info_get_result(object): +class pltfm_mgr_qsfp_chan_tx_fault_get_result(object): """ Attributes: - success - ouch + """ - thrift_spec = ( - (0, TType.STRUCT, 'success', (pltfm_mgr_pwr_supply_info_t, pltfm_mgr_pwr_supply_info_t.thrift_spec), None, ), # 0 - (1, TType.STRUCT, 'ouch', (InvalidPltfmMgrOperation, InvalidPltfmMgrOperation.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, ouch=None,): self.success = success @@ -1529,7 +6283,7 @@ def __init__(self, success=None, ouch=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -1537,15 +6291,18 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 0: - if ftype == TType.STRUCT: - self.success = pltfm_mgr_pwr_supply_info_t() - self.success.read(iprot) + if ftype == TType.LIST: + self.success = [] + (_etype59, _size56) = iprot.readListBegin() + for _i60 in range(_size56): + _elem61 = iprot.readBool() + self.success.append(_elem61) + iprot.readListEnd() else: iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -1555,12 +6312,15 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_pwr_supply_info_get_result') + oprot.writeStructBegin('pltfm_mgr_qsfp_chan_tx_fault_get_result') if self.success is not None: - oprot.writeFieldBegin('success', TType.STRUCT, 0) - self.success.write(oprot) + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.BOOL, len(self.success)) + for iter62 in self.success: + oprot.writeBool(iter62) + oprot.writeListEnd() oprot.writeFieldEnd() if self.ouch is not None: oprot.writeFieldBegin('ouch', TType.STRUCT, 1) @@ -1582,25 +6342,27 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_chan_tx_fault_get_result) +pltfm_mgr_qsfp_chan_tx_fault_get_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.BOOL, None, False), None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) -class pltfm_mgr_pwr_rail_info_get_args(object): +class pltfm_mgr_qsfp_temperature_get_args(object): """ Attributes: - - ps_num - """ + - port_num - thrift_spec = ( - None, # 0 - (1, TType.I16, 'ps_num', None, None, ), # 1 - ) + """ - def __init__(self, ps_num=None,): - self.ps_num = ps_num + + def __init__(self, port_num=None,): + self.port_num = port_num def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -1608,8 +6370,8 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 1: - if ftype == TType.I16: - self.ps_num = iprot.readI16() + if ftype == TType.I32: + self.port_num = iprot.readI32() else: iprot.skip(ftype) else: @@ -1619,12 +6381,12 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_pwr_rail_info_get_args') - if self.ps_num is not None: - oprot.writeFieldBegin('ps_num', TType.I16, 1) - oprot.writeI16(self.ps_num) + oprot.writeStructBegin('pltfm_mgr_qsfp_temperature_get_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -1642,19 +6404,21 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_temperature_get_args) +pltfm_mgr_qsfp_temperature_get_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 +) -class pltfm_mgr_pwr_rail_info_get_result(object): +class pltfm_mgr_qsfp_temperature_get_result(object): """ Attributes: - success - ouch + """ - thrift_spec = ( - (0, TType.STRUCT, 'success', (pltfm_mgr_pwr_rail_info_t, pltfm_mgr_pwr_rail_info_t.thrift_spec), None, ), # 0 - (1, TType.STRUCT, 'ouch', (InvalidPltfmMgrOperation, InvalidPltfmMgrOperation.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, ouch=None,): self.success = success @@ -1662,7 +6426,7 @@ def __init__(self, success=None, ouch=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -1670,15 +6434,13 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 0: - if ftype == TType.STRUCT: - self.success = pltfm_mgr_pwr_rail_info_t() - self.success.read(iprot) + if ftype == TType.DOUBLE: + self.success = iprot.readDouble() else: iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -1688,12 +6450,12 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_pwr_rail_info_get_result') + oprot.writeStructBegin('pltfm_mgr_qsfp_temperature_get_result') if self.success is not None: - oprot.writeFieldBegin('success', TType.STRUCT, 0) - self.success.write(oprot) + oprot.writeFieldBegin('success', TType.DOUBLE, 0) + oprot.writeDouble(self.success) oprot.writeFieldEnd() if self.ouch is not None: oprot.writeFieldBegin('ouch', TType.STRUCT, 1) @@ -1715,28 +6477,27 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_temperature_get_result) +pltfm_mgr_qsfp_temperature_get_result.thrift_spec = ( + (0, TType.DOUBLE, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) -class pltfm_mgr_fan_speed_set_args(object): +class pltfm_mgr_qsfp_voltage_get_args(object): """ Attributes: - - fan_num - - percent + - port_num + """ - thrift_spec = ( - None, # 0 - (1, TType.I32, 'fan_num', None, None, ), # 1 - (2, TType.I32, 'percent', None, None, ), # 2 - ) - def __init__(self, fan_num=None, percent=None,): - self.fan_num = fan_num - self.percent = percent + def __init__(self, port_num=None,): + self.port_num = port_num def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -1745,12 +6506,7 @@ def read(self, iprot): break if fid == 1: if ftype == TType.I32: - self.fan_num = iprot.readI32() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.I32: - self.percent = iprot.readI32() + self.port_num = iprot.readI32() else: iprot.skip(ftype) else: @@ -1760,16 +6516,12 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_fan_speed_set_args') - if self.fan_num is not None: - oprot.writeFieldBegin('fan_num', TType.I32, 1) - oprot.writeI32(self.fan_num) - oprot.writeFieldEnd() - if self.percent is not None: - oprot.writeFieldBegin('percent', TType.I32, 2) - oprot.writeI32(self.percent) + oprot.writeStructBegin('pltfm_mgr_qsfp_voltage_get_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -1787,19 +6539,21 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_voltage_get_args) +pltfm_mgr_qsfp_voltage_get_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 +) -class pltfm_mgr_fan_speed_set_result(object): +class pltfm_mgr_qsfp_voltage_get_result(object): """ Attributes: - success - ouch + """ - thrift_spec = ( - (0, TType.I32, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'ouch', (InvalidPltfmMgrOperation, InvalidPltfmMgrOperation.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, ouch=None,): self.success = success @@ -1807,7 +6561,7 @@ def __init__(self, success=None, ouch=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -1815,14 +6569,13 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 0: - if ftype == TType.I32: - self.success = iprot.readI32() + if ftype == TType.DOUBLE: + self.success = iprot.readDouble() else: iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -1832,12 +6585,12 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_fan_speed_set_result') + oprot.writeStructBegin('pltfm_mgr_qsfp_voltage_get_result') if self.success is not None: - oprot.writeFieldBegin('success', TType.I32, 0) - oprot.writeI32(self.success) + oprot.writeFieldBegin('success', TType.DOUBLE, 0) + oprot.writeDouble(self.success) oprot.writeFieldEnd() if self.ouch is not None: oprot.writeFieldBegin('ouch', TType.STRUCT, 1) @@ -1859,25 +6612,27 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_voltage_get_result) +pltfm_mgr_qsfp_voltage_get_result.thrift_spec = ( + (0, TType.DOUBLE, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) -class pltfm_mgr_fan_info_get_args(object): +class pltfm_mgr_qsfp_thresholds_get_args(object): """ Attributes: - - fan_num + - port_num + """ - thrift_spec = ( - None, # 0 - (1, TType.I32, 'fan_num', None, None, ), # 1 - ) - def __init__(self, fan_num=None,): - self.fan_num = fan_num + def __init__(self, port_num=None,): + self.port_num = port_num def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -1886,7 +6641,7 @@ def read(self, iprot): break if fid == 1: if ftype == TType.I32: - self.fan_num = iprot.readI32() + self.port_num = iprot.readI32() else: iprot.skip(ftype) else: @@ -1896,12 +6651,12 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_fan_info_get_args') - if self.fan_num is not None: - oprot.writeFieldBegin('fan_num', TType.I32, 1) - oprot.writeI32(self.fan_num) + oprot.writeStructBegin('pltfm_mgr_qsfp_thresholds_get_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -1919,19 +6674,21 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_thresholds_get_args) +pltfm_mgr_qsfp_thresholds_get_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 +) -class pltfm_mgr_fan_info_get_result(object): +class pltfm_mgr_qsfp_thresholds_get_result(object): """ Attributes: - success - ouch + """ - thrift_spec = ( - (0, TType.STRUCT, 'success', (pltfm_mgr_fan_info_t, pltfm_mgr_fan_info_t.thrift_spec), None, ), # 0 - (1, TType.STRUCT, 'ouch', (InvalidPltfmMgrOperation, InvalidPltfmMgrOperation.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, ouch=None,): self.success = success @@ -1939,7 +6696,7 @@ def __init__(self, success=None, ouch=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -1948,14 +6705,13 @@ def read(self, iprot): break if fid == 0: if ftype == TType.STRUCT: - self.success = pltfm_mgr_fan_info_t() + self.success = pltfm_mgr_qsfp_thresholds_t() self.success.read(iprot) else: iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -1965,9 +6721,9 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_fan_info_get_result') + oprot.writeStructBegin('pltfm_mgr_qsfp_thresholds_get_result') if self.success is not None: oprot.writeFieldBegin('success', TType.STRUCT, 0) self.success.write(oprot) @@ -1992,25 +6748,29 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_thresholds_get_result) +pltfm_mgr_qsfp_thresholds_get_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [pltfm_mgr_qsfp_thresholds_t, None], None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) -class pltfm_mgr_qsfp_presence_get_args(object): +class pltfm_mgr_qsfp_tx_is_disabled_args(object): """ Attributes: - port_num + - channel + """ - thrift_spec = ( - None, # 0 - (1, TType.I32, 'port_num', None, None, ), # 1 - ) - def __init__(self, port_num=None,): + def __init__(self, port_num=None, channel=None,): self.port_num = port_num + self.channel = channel def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2022,6 +6782,11 @@ def read(self, iprot): self.port_num = iprot.readI32() else: iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I32: + self.channel = iprot.readI32() + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -2029,13 +6794,17 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_qsfp_presence_get_args') + oprot.writeStructBegin('pltfm_mgr_qsfp_tx_is_disabled_args') if self.port_num is not None: oprot.writeFieldBegin('port_num', TType.I32, 1) oprot.writeI32(self.port_num) oprot.writeFieldEnd() + if self.channel is not None: + oprot.writeFieldBegin('channel', TType.I32, 2) + oprot.writeI32(self.channel) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -2052,19 +6821,22 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_tx_is_disabled_args) +pltfm_mgr_qsfp_tx_is_disabled_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 + (2, TType.I32, 'channel', None, None, ), # 2 +) -class pltfm_mgr_qsfp_presence_get_result(object): +class pltfm_mgr_qsfp_tx_is_disabled_result(object): """ Attributes: - success - ouch + """ - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'ouch', (InvalidPltfmMgrOperation, InvalidPltfmMgrOperation.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, ouch=None,): self.success = success @@ -2072,7 +6844,7 @@ def __init__(self, success=None, ouch=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2086,8 +6858,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -2097,9 +6868,9 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_qsfp_presence_get_result') + oprot.writeStructBegin('pltfm_mgr_qsfp_tx_is_disabled_result') if self.success is not None: oprot.writeFieldBegin('success', TType.BOOL, 0) oprot.writeBool(self.success) @@ -2124,25 +6895,27 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_tx_is_disabled_result) +pltfm_mgr_qsfp_tx_is_disabled_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) -class pltfm_mgr_qsfp_info_get_args(object): +class pltfm_mgr_qsfp_lpmode_get_args(object): """ Attributes: - port_num + """ - thrift_spec = ( - None, # 0 - (1, TType.I32, 'port_num', None, None, ), # 1 - ) def __init__(self, port_num=None,): self.port_num = port_num def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2161,9 +6934,9 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_qsfp_info_get_args') + oprot.writeStructBegin('pltfm_mgr_qsfp_lpmode_get_args') if self.port_num is not None: oprot.writeFieldBegin('port_num', TType.I32, 1) oprot.writeI32(self.port_num) @@ -2184,19 +6957,21 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_lpmode_get_args) +pltfm_mgr_qsfp_lpmode_get_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 +) -class pltfm_mgr_qsfp_info_get_result(object): +class pltfm_mgr_qsfp_lpmode_get_result(object): """ Attributes: - success - ouch + """ - thrift_spec = ( - (0, TType.STRING, 'success', 'UTF8', None, ), # 0 - (1, TType.STRUCT, 'ouch', (InvalidPltfmMgrOperation, InvalidPltfmMgrOperation.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, ouch=None,): self.success = success @@ -2204,7 +6979,7 @@ def __init__(self, success=None, ouch=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2212,14 +6987,13 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 0: - if ftype == TType.STRING: - self.success = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + if ftype == TType.BOOL: + self.success = iprot.readBool() else: iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -2229,12 +7003,12 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_qsfp_info_get_result') + oprot.writeStructBegin('pltfm_mgr_qsfp_lpmode_get_result') if self.success is not None: - oprot.writeFieldBegin('success', TType.STRING, 0) - oprot.writeString(self.success.encode('utf-8') if sys.version_info[0] == 2 else self.success) + oprot.writeFieldBegin('success', TType.BOOL, 0) + oprot.writeBool(self.success) oprot.writeFieldEnd() if self.ouch is not None: oprot.writeFieldBegin('ouch', TType.STRUCT, 1) @@ -2256,22 +7030,38 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_lpmode_get_result) +pltfm_mgr_qsfp_lpmode_get_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) -class pltfm_mgr_qsfp_get_max_port_args(object): +class pltfm_mgr_qsfp_pwr_override_get_args(object): + """ + Attributes: + - port_num + + """ + - thrift_spec = ( - ) + def __init__(self, port_num=None,): + self.port_num = port_num def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: break + if fid == 1: + if ftype == TType.I32: + self.port_num = iprot.readI32() + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -2279,9 +7069,13 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_qsfp_get_max_port_args') + oprot.writeStructBegin('pltfm_mgr_qsfp_pwr_override_get_args') + if self.port_num is not None: + oprot.writeFieldBegin('port_num', TType.I32, 1) + oprot.writeI32(self.port_num) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -2298,19 +7092,21 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_pwr_override_get_args) +pltfm_mgr_qsfp_pwr_override_get_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 +) -class pltfm_mgr_qsfp_get_max_port_result(object): +class pltfm_mgr_qsfp_pwr_override_get_result(object): """ Attributes: - success - ouch + """ - thrift_spec = ( - (0, TType.I32, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'ouch', (InvalidPltfmMgrOperation, InvalidPltfmMgrOperation.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, ouch=None,): self.success = success @@ -2318,7 +7114,7 @@ def __init__(self, success=None, ouch=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2326,14 +7122,13 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 0: - if ftype == TType.I32: - self.success = iprot.readI32() + if ftype == TType.BOOL: + self.success = iprot.readBool() else: iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -2343,12 +7138,12 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_qsfp_get_max_port_result') + oprot.writeStructBegin('pltfm_mgr_qsfp_pwr_override_get_result') if self.success is not None: - oprot.writeFieldBegin('success', TType.I32, 0) - oprot.writeI32(self.success) + oprot.writeFieldBegin('success', TType.BOOL, 0) + oprot.writeBool(self.success) oprot.writeFieldEnd() if self.ouch is not None: oprot.writeFieldBegin('ouch', TType.STRUCT, 1) @@ -2370,28 +7165,31 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_pwr_override_get_result) +pltfm_mgr_qsfp_pwr_override_get_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) -class pltfm_mgr_qsfp_reset_args(object): +class pltfm_mgr_qsfp_pwr_override_set_args(object): """ Attributes: - port_num - - reset + - power_override + - power_set + """ - thrift_spec = ( - None, # 0 - (1, TType.I32, 'port_num', None, None, ), # 1 - (2, TType.BOOL, 'reset', None, None, ), # 2 - ) - def __init__(self, port_num=None, reset=None,): + def __init__(self, port_num=None, power_override=None, power_set=None,): self.port_num = port_num - self.reset = reset + self.power_override = power_override + self.power_set = power_set def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2405,7 +7203,12 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 2: if ftype == TType.BOOL: - self.reset = iprot.readBool() + self.power_override = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.BOOL: + self.power_set = iprot.readBool() else: iprot.skip(ftype) else: @@ -2415,16 +7218,20 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_qsfp_reset_args') + oprot.writeStructBegin('pltfm_mgr_qsfp_pwr_override_set_args') if self.port_num is not None: oprot.writeFieldBegin('port_num', TType.I32, 1) oprot.writeI32(self.port_num) oprot.writeFieldEnd() - if self.reset is not None: - oprot.writeFieldBegin('reset', TType.BOOL, 2) - oprot.writeBool(self.reset) + if self.power_override is not None: + oprot.writeFieldBegin('power_override', TType.BOOL, 2) + oprot.writeBool(self.power_override) + oprot.writeFieldEnd() + if self.power_set is not None: + oprot.writeFieldBegin('power_set', TType.BOOL, 3) + oprot.writeBool(self.power_set) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -2442,19 +7249,23 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_pwr_override_set_args) +pltfm_mgr_qsfp_pwr_override_set_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 + (2, TType.BOOL, 'power_override', None, None, ), # 2 + (3, TType.BOOL, 'power_set', None, None, ), # 3 +) -class pltfm_mgr_qsfp_reset_result(object): +class pltfm_mgr_qsfp_pwr_override_set_result(object): """ Attributes: - success - ouch + """ - thrift_spec = ( - (0, TType.I32, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'ouch', (InvalidPltfmMgrOperation, InvalidPltfmMgrOperation.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, ouch=None,): self.success = success @@ -2462,7 +7273,7 @@ def __init__(self, success=None, ouch=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2470,14 +7281,13 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 0: - if ftype == TType.I32: - self.success = iprot.readI32() + if ftype == TType.BOOL: + self.success = iprot.readBool() else: iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -2487,12 +7297,12 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_qsfp_reset_result') + oprot.writeStructBegin('pltfm_mgr_qsfp_pwr_override_set_result') if self.success is not None: - oprot.writeFieldBegin('success', TType.I32, 0) - oprot.writeI32(self.success) + oprot.writeFieldBegin('success', TType.BOOL, 0) + oprot.writeBool(self.success) oprot.writeFieldEnd() if self.ouch is not None: oprot.writeFieldBegin('ouch', TType.STRUCT, 1) @@ -2514,25 +7324,29 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_pwr_override_set_result) +pltfm_mgr_qsfp_pwr_override_set_result.thrift_spec = ( + (0, TType.BOOL, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) -class pltfm_mgr_qsfp_lpmode_get_args(object): +class pltfm_mgr_qsfp_lpmode_set_args(object): """ Attributes: - port_num + - lpmode + """ - thrift_spec = ( - None, # 0 - (1, TType.I32, 'port_num', None, None, ), # 1 - ) - def __init__(self, port_num=None,): + def __init__(self, port_num=None, lpmode=None,): self.port_num = port_num + self.lpmode = lpmode def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2544,6 +7358,11 @@ def read(self, iprot): self.port_num = iprot.readI32() else: iprot.skip(ftype) + elif fid == 2: + if ftype == TType.BOOL: + self.lpmode = iprot.readBool() + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -2551,13 +7370,17 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_qsfp_lpmode_get_args') + oprot.writeStructBegin('pltfm_mgr_qsfp_lpmode_set_args') if self.port_num is not None: oprot.writeFieldBegin('port_num', TType.I32, 1) oprot.writeI32(self.port_num) oprot.writeFieldEnd() + if self.lpmode is not None: + oprot.writeFieldBegin('lpmode', TType.BOOL, 2) + oprot.writeBool(self.lpmode) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -2574,19 +7397,22 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_lpmode_set_args) +pltfm_mgr_qsfp_lpmode_set_args.thrift_spec = ( + None, # 0 + (1, TType.I32, 'port_num', None, None, ), # 1 + (2, TType.BOOL, 'lpmode', None, None, ), # 2 +) -class pltfm_mgr_qsfp_lpmode_get_result(object): +class pltfm_mgr_qsfp_lpmode_set_result(object): """ Attributes: - success - ouch + """ - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'ouch', (InvalidPltfmMgrOperation, InvalidPltfmMgrOperation.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, ouch=None,): self.success = success @@ -2594,7 +7420,7 @@ def __init__(self, success=None, ouch=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2602,14 +7428,13 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 0: - if ftype == TType.BOOL: - self.success = iprot.readBool() + if ftype == TType.I32: + self.success = iprot.readI32() else: iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -2619,12 +7444,12 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_qsfp_lpmode_get_result') + oprot.writeStructBegin('pltfm_mgr_qsfp_lpmode_set_result') if self.success is not None: - oprot.writeFieldBegin('success', TType.BOOL, 0) - oprot.writeBool(self.success) + oprot.writeFieldBegin('success', TType.I32, 0) + oprot.writeI32(self.success) oprot.writeFieldEnd() if self.ouch is not None: oprot.writeFieldBegin('ouch', TType.STRUCT, 1) @@ -2646,28 +7471,27 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_qsfp_lpmode_set_result) +pltfm_mgr_qsfp_lpmode_set_result.thrift_spec = ( + (0, TType.I32, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) -class pltfm_mgr_qsfp_lpmode_set_args(object): +class pltfm_mgr_sensor_info_get_args(object): """ Attributes: - - port_num - - lpmode + - options + """ - thrift_spec = ( - None, # 0 - (1, TType.I32, 'port_num', None, None, ), # 1 - (2, TType.BOOL, 'lpmode', None, None, ), # 2 - ) - def __init__(self, port_num=None, lpmode=None,): - self.port_num = port_num - self.lpmode = lpmode + def __init__(self, options=None,): + self.options = options def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2675,13 +7499,8 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 1: - if ftype == TType.I32: - self.port_num = iprot.readI32() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.BOOL: - self.lpmode = iprot.readBool() + if ftype == TType.STRING: + self.options = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) else: @@ -2691,16 +7510,12 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_qsfp_lpmode_set_args') - if self.port_num is not None: - oprot.writeFieldBegin('port_num', TType.I32, 1) - oprot.writeI32(self.port_num) - oprot.writeFieldEnd() - if self.lpmode is not None: - oprot.writeFieldBegin('lpmode', TType.BOOL, 2) - oprot.writeBool(self.lpmode) + oprot.writeStructBegin('pltfm_mgr_sensor_info_get_args') + if self.options is not None: + oprot.writeFieldBegin('options', TType.STRING, 1) + oprot.writeString(self.options.encode('utf-8') if sys.version_info[0] == 2 else self.options) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -2718,19 +7533,21 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_sensor_info_get_args) +pltfm_mgr_sensor_info_get_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'options', 'UTF8', None, ), # 1 +) -class pltfm_mgr_qsfp_lpmode_set_result(object): +class pltfm_mgr_sensor_info_get_result(object): """ Attributes: - success - ouch + """ - thrift_spec = ( - (0, TType.I32, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'ouch', (InvalidPltfmMgrOperation, InvalidPltfmMgrOperation.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, ouch=None,): self.success = success @@ -2738,7 +7555,7 @@ def __init__(self, success=None, ouch=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2746,14 +7563,13 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 0: - if ftype == TType.I32: - self.success = iprot.readI32() + if ftype == TType.STRING: + self.success = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -2763,12 +7579,12 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_qsfp_lpmode_set_result') + oprot.writeStructBegin('pltfm_mgr_sensor_info_get_result') if self.success is not None: - oprot.writeFieldBegin('success', TType.I32, 0) - oprot.writeI32(self.success) + oprot.writeFieldBegin('success', TType.STRING, 0) + oprot.writeString(self.success.encode('utf-8') if sys.version_info[0] == 2 else self.success) oprot.writeFieldEnd() if self.ouch is not None: oprot.writeFieldBegin('ouch', TType.STRUCT, 1) @@ -2790,36 +7606,25 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_sensor_info_get_result) +pltfm_mgr_sensor_info_get_result.thrift_spec = ( + (0, TType.STRING, 'success', 'UTF8', None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) -class pltfm_mgr_sensor_info_get_args(object): - """ - Attributes: - - options - """ - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'options', 'UTF8', None, ), # 1 - ) +class pltfm_mgr_chss_mgmt_bmc_ver_get_args(object): - def __init__(self, options=None,): - self.options = options def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: break - if fid == 1: - if ftype == TType.STRING: - self.options = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - else: - iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -2827,13 +7632,9 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_sensor_info_get_args') - if self.options is not None: - oprot.writeFieldBegin('options', TType.STRING, 1) - oprot.writeString(self.options.encode('utf-8') if sys.version_info[0] == 2 else self.options) - oprot.writeFieldEnd() + oprot.writeStructBegin('pltfm_mgr_chss_mgmt_bmc_ver_get_args') oprot.writeFieldStop() oprot.writeStructEnd() @@ -2850,19 +7651,19 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_chss_mgmt_bmc_ver_get_args) +pltfm_mgr_chss_mgmt_bmc_ver_get_args.thrift_spec = ( +) -class pltfm_mgr_sensor_info_get_result(object): +class pltfm_mgr_chss_mgmt_bmc_ver_get_result(object): """ Attributes: - success - ouch + """ - thrift_spec = ( - (0, TType.STRING, 'success', 'UTF8', None, ), # 0 - (1, TType.STRUCT, 'ouch', (InvalidPltfmMgrOperation, InvalidPltfmMgrOperation.thrift_spec), None, ), # 1 - ) def __init__(self, success=None, ouch=None,): self.success = success @@ -2870,7 +7671,7 @@ def __init__(self, success=None, ouch=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -2879,13 +7680,12 @@ def read(self, iprot): break if fid == 0: if ftype == TType.STRING: - self.success = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.success = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: - self.ouch = InvalidPltfmMgrOperation() - self.ouch.read(iprot) + self.ouch = InvalidPltfmMgrOperation.read(iprot) else: iprot.skip(ftype) else: @@ -2895,9 +7695,9 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('pltfm_mgr_sensor_info_get_result') + oprot.writeStructBegin('pltfm_mgr_chss_mgmt_bmc_ver_get_result') if self.success is not None: oprot.writeFieldBegin('success', TType.STRING, 0) oprot.writeString(self.success.encode('utf-8') if sys.version_info[0] == 2 else self.success) @@ -2922,3 +7722,10 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_chss_mgmt_bmc_ver_get_result) +pltfm_mgr_chss_mgmt_bmc_ver_get_result.thrift_spec = ( + (0, TType.STRING, 'success', 'UTF8', None, ), # 0 + (1, TType.STRUCT, 'ouch', [InvalidPltfmMgrOperation, None], None, ), # 1 +) +fix_spec(all_structs) +del all_structs diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/pltfm_mgr_rpc/ttypes.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/pltfm_mgr_rpc/ttypes.py index ce03e14f8691..501596941664 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/pltfm_mgr_rpc/ttypes.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/pltfm_mgr_rpc/ttypes.py @@ -1,5 +1,5 @@ # -# Autogenerated by Thrift Compiler (0.10.0) +# Autogenerated by Thrift Compiler (0.14.1) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # @@ -8,9 +8,30 @@ from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException from thrift.protocol.TProtocol import TProtocolException +from thrift.TRecursive import fix_spec + import sys from thrift.transport import TTransport +all_structs = [] + + +class qsfp_eeprom_page_t(object): + PAGE0_LOWER = 0 + PAGE0_UPPER = 1 + PAGE3 = 2 + + _VALUES_TO_NAMES = { + 0: "PAGE0_LOWER", + 1: "PAGE0_UPPER", + 2: "PAGE3", + } + + _NAMES_TO_VALUES = { + "PAGE0_LOWER": 0, + "PAGE0_UPPER": 1, + "PAGE3": 2, + } class pltfm_mgr_sys_tmp_t(object): @@ -26,21 +47,9 @@ class pltfm_mgr_sys_tmp_t(object): - tmp8 - tmp9 - tmp10 + """ - thrift_spec = ( - None, # 0 - (1, TType.DOUBLE, 'tmp1', None, None, ), # 1 - (2, TType.DOUBLE, 'tmp2', None, None, ), # 2 - (3, TType.DOUBLE, 'tmp3', None, None, ), # 3 - (4, TType.DOUBLE, 'tmp4', None, None, ), # 4 - (5, TType.DOUBLE, 'tmp5', None, None, ), # 5 - (6, TType.DOUBLE, 'tmp6', None, None, ), # 6 - (7, TType.DOUBLE, 'tmp7', None, None, ), # 7 - (8, TType.DOUBLE, 'tmp8', None, None, ), # 8 - (9, TType.DOUBLE, 'tmp9', None, None, ), # 9 - (10, TType.DOUBLE, 'tmp10', None, None, ), # 10 - ) def __init__(self, tmp1=None, tmp2=None, tmp3=None, tmp4=None, tmp5=None, tmp6=None, tmp7=None, tmp8=None, tmp9=None, tmp10=None,): self.tmp1 = tmp1 @@ -56,7 +65,7 @@ def __init__(self, tmp1=None, tmp2=None, tmp3=None, tmp4=None, tmp5=None, tmp6=N def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -120,7 +129,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('pltfm_mgr_sys_tmp_t') if self.tmp1 is not None: @@ -206,33 +215,9 @@ class pltfm_mgr_eeprom_t(object): - ext_mac_addr_size - location - crc8 + """ - thrift_spec = ( - None, # 0 - (1, TType.I16, 'version', None, None, ), # 1 - (2, TType.STRING, 'prod_name', 'UTF8', None, ), # 2 - (3, TType.STRING, 'prod_part_num', 'UTF8', None, ), # 3 - (4, TType.STRING, 'sys_asm_part_num', 'UTF8', None, ), # 4 - (5, TType.STRING, 'bfn_pcba_part_num', 'UTF8', None, ), # 5 - (6, TType.STRING, 'bfn_pcbb_part_num', 'UTF8', None, ), # 6 - (7, TType.STRING, 'odm_pcba_part_num', 'UTF8', None, ), # 7 - (8, TType.STRING, 'odm_pcba_ser_num', 'UTF8', None, ), # 8 - (9, TType.I16, 'prod_state', None, None, ), # 9 - (10, TType.I16, 'prod_ver', None, None, ), # 10 - (11, TType.I16, 'prod_sub_ver', None, None, ), # 11 - (12, TType.STRING, 'prod_ser_num', 'UTF8', None, ), # 12 - (13, TType.STRING, 'prod_ast_tag', 'UTF8', None, ), # 13 - (14, TType.STRING, 'sys_mfger', 'UTF8', None, ), # 14 - (15, TType.STRING, 'sys_mfg_date', 'UTF8', None, ), # 15 - (16, TType.STRING, 'pcb_mfger', 'UTF8', None, ), # 16 - (17, TType.STRING, 'assembled_at', 'UTF8', None, ), # 17 - (18, TType.STRING, 'loc_mac_addr', 'UTF8', None, ), # 18 - (19, TType.STRING, 'ext_mac_addr', 'UTF8', None, ), # 19 - (20, TType.I32, 'ext_mac_addr_size', None, None, ), # 20 - (21, TType.STRING, 'location', 'UTF8', None, ), # 21 - (22, TType.I16, 'crc8', None, None, ), # 22 - ) def __init__(self, version=None, prod_name=None, prod_part_num=None, sys_asm_part_num=None, bfn_pcba_part_num=None, bfn_pcbb_part_num=None, odm_pcba_part_num=None, odm_pcba_ser_num=None, prod_state=None, prod_ver=None, prod_sub_ver=None, prod_ser_num=None, prod_ast_tag=None, sys_mfger=None, sys_mfg_date=None, pcb_mfger=None, assembled_at=None, loc_mac_addr=None, ext_mac_addr=None, ext_mac_addr_size=None, location=None, crc8=None,): self.version = version @@ -260,7 +245,7 @@ def __init__(self, version=None, prod_name=None, prod_part_num=None, sys_asm_par def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -274,37 +259,37 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 2: if ftype == TType.STRING: - self.prod_name = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.prod_name = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 3: if ftype == TType.STRING: - self.prod_part_num = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.prod_part_num = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 4: if ftype == TType.STRING: - self.sys_asm_part_num = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.sys_asm_part_num = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 5: if ftype == TType.STRING: - self.bfn_pcba_part_num = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.bfn_pcba_part_num = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 6: if ftype == TType.STRING: - self.bfn_pcbb_part_num = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.bfn_pcbb_part_num = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 7: if ftype == TType.STRING: - self.odm_pcba_part_num = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.odm_pcba_part_num = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 8: if ftype == TType.STRING: - self.odm_pcba_ser_num = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.odm_pcba_ser_num = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 9: @@ -324,42 +309,42 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 12: if ftype == TType.STRING: - self.prod_ser_num = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.prod_ser_num = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 13: if ftype == TType.STRING: - self.prod_ast_tag = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.prod_ast_tag = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 14: if ftype == TType.STRING: - self.sys_mfger = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.sys_mfger = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 15: if ftype == TType.STRING: - self.sys_mfg_date = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.sys_mfg_date = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 16: if ftype == TType.STRING: - self.pcb_mfger = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.pcb_mfger = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 17: if ftype == TType.STRING: - self.assembled_at = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.assembled_at = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 18: if ftype == TType.STRING: - self.loc_mac_addr = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.loc_mac_addr = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 19: if ftype == TType.STRING: - self.ext_mac_addr = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.ext_mac_addr = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 20: @@ -369,7 +354,7 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 21: if ftype == TType.STRING: - self.location = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.location = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 22: @@ -384,7 +369,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('pltfm_mgr_eeprom_t') if self.version is not None: @@ -506,21 +491,9 @@ class pltfm_mgr_pwr_supply_info_t(object): - model - serial - rev + """ - thrift_spec = ( - None, # 0 - (1, TType.I32, 'vin', None, None, ), # 1 - (2, TType.I32, 'vout', None, None, ), # 2 - (3, TType.I32, 'iout', None, None, ), # 3 - (4, TType.I32, 'pwr_out', None, None, ), # 4 - (5, TType.I32, 'fspeed', None, None, ), # 5 - (6, TType.BOOL, 'ffault', None, None, ), # 6 - (7, TType.BOOL, 'load_sharing', None, None, ), # 7 - (8, TType.STRING, 'model', 'UTF8', None, ), # 8 - (9, TType.STRING, 'serial', 'UTF8', None, ), # 9 - (10, TType.STRING, 'rev', 'UTF8', None, ), # 10 - ) def __init__(self, vin=None, vout=None, iout=None, pwr_out=None, fspeed=None, ffault=None, load_sharing=None, model=None, serial=None, rev=None,): self.vin = vin @@ -536,7 +509,7 @@ def __init__(self, vin=None, vout=None, iout=None, pwr_out=None, fspeed=None, ff def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -580,17 +553,17 @@ def read(self, iprot): iprot.skip(ftype) elif fid == 8: if ftype == TType.STRING: - self.model = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.model = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 9: if ftype == TType.STRING: - self.serial = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.serial = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) elif fid == 10: if ftype == TType.STRING: - self.rev = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.rev = iprot.readString().decode('utf-8', errors='replace') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) else: @@ -600,7 +573,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('pltfm_mgr_pwr_supply_info_t') if self.vin is not None: @@ -680,27 +653,9 @@ class pltfm_mgr_pwr_rail_info_t(object): - vrail14 - vrail15 - vrail16 + """ - thrift_spec = ( - None, # 0 - (1, TType.I32, 'vrail1', None, None, ), # 1 - (2, TType.I32, 'vrail2', None, None, ), # 2 - (3, TType.I32, 'vrail3', None, None, ), # 3 - (4, TType.I32, 'vrail4', None, None, ), # 4 - (5, TType.I32, 'vrail5', None, None, ), # 5 - (6, TType.I32, 'vrail6', None, None, ), # 6 - (7, TType.I32, 'vrail7', None, None, ), # 7 - (8, TType.I32, 'vrail8', None, None, ), # 8 - (9, TType.I32, 'vrail9', None, None, ), # 9 - (10, TType.I32, 'vrail10', None, None, ), # 10 - (11, TType.I32, 'vrail11', None, None, ), # 11 - (12, TType.I32, 'vrail12', None, None, ), # 12 - (13, TType.I32, 'vrail13', None, None, ), # 13 - (14, TType.I32, 'vrail14', None, None, ), # 14 - (15, TType.I32, 'vrail15', None, None, ), # 15 - (16, TType.I32, 'vrail16', None, None, ), # 16 - ) def __init__(self, vrail1=None, vrail2=None, vrail3=None, vrail4=None, vrail5=None, vrail6=None, vrail7=None, vrail8=None, vrail9=None, vrail10=None, vrail11=None, vrail12=None, vrail13=None, vrail14=None, vrail15=None, vrail16=None,): self.vrail1 = vrail1 @@ -722,7 +677,7 @@ def __init__(self, vrail1=None, vrail2=None, vrail3=None, vrail4=None, vrail5=No def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -816,7 +771,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('pltfm_mgr_pwr_rail_info_t') if self.vrail1 is not None: @@ -908,15 +863,9 @@ class pltfm_mgr_fan_info_t(object): - front_rpm - rear_rpm - percent + """ - thrift_spec = ( - None, # 0 - (1, TType.I32, 'fan_num', None, None, ), # 1 - (2, TType.I32, 'front_rpm', None, None, ), # 2 - (3, TType.I32, 'rear_rpm', None, None, ), # 3 - (4, TType.I32, 'percent', None, None, ), # 4 - ) def __init__(self, fan_num=None, front_rpm=None, rear_rpm=None, percent=None,): self.fan_num = fan_num @@ -926,7 +875,7 @@ def __init__(self, fan_num=None, front_rpm=None, rear_rpm=None, percent=None,): def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() while True: @@ -960,7 +909,7 @@ def read(self, iprot): def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('pltfm_mgr_fan_info_t') if self.fan_num is not None: @@ -997,42 +946,393 @@ def __ne__(self, other): return not (self == other) -class InvalidPltfmMgrOperation(TException): +class pltfm_mgr_qsfp_alarm_flags_t(object): """ Attributes: - - code + - highalarm + - lowalarm + - highwarning + - lowwarning + """ - thrift_spec = ( - None, # 0 - (1, TType.I32, 'code', None, None, ), # 1 - ) - def __init__(self, code=None,): - self.code = code + def __init__(self, highalarm=None, lowalarm=None, highwarning=None, lowwarning=None,): + self.highalarm = highalarm + self.lowalarm = lowalarm + self.highwarning = highwarning + self.lowwarning = lowwarning def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: - iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) return iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.BOOL: + self.highalarm = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.BOOL: + self.lowalarm = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.BOOL: + self.highwarning = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.BOOL: + self.lowwarning = iprot.readBool() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_alarm_flags_t') + if self.highalarm is not None: + oprot.writeFieldBegin('highalarm', TType.BOOL, 1) + oprot.writeBool(self.highalarm) + oprot.writeFieldEnd() + if self.lowalarm is not None: + oprot.writeFieldBegin('lowalarm', TType.BOOL, 2) + oprot.writeBool(self.lowalarm) + oprot.writeFieldEnd() + if self.highwarning is not None: + oprot.writeFieldBegin('highwarning', TType.BOOL, 3) + oprot.writeBool(self.highwarning) + oprot.writeFieldEnd() + if self.lowwarning is not None: + oprot.writeFieldBegin('lowwarning', TType.BOOL, 4) + oprot.writeBool(self.lowwarning) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class pltfm_mgr_qsfp_threshold_t(object): + """ + Attributes: + - highalarm + - lowalarm + - highwarning + - lowwarning + + """ + + + def __init__(self, highalarm=None, lowalarm=None, highwarning=None, lowwarning=None,): + self.highalarm = highalarm + self.lowalarm = lowalarm + self.highwarning = highwarning + self.lowwarning = lowwarning + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.DOUBLE: + self.highalarm = iprot.readDouble() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.DOUBLE: + self.lowalarm = iprot.readDouble() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.DOUBLE: + self.highwarning = iprot.readDouble() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.DOUBLE: + self.lowwarning = iprot.readDouble() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_threshold_t') + if self.highalarm is not None: + oprot.writeFieldBegin('highalarm', TType.DOUBLE, 1) + oprot.writeDouble(self.highalarm) + oprot.writeFieldEnd() + if self.lowalarm is not None: + oprot.writeFieldBegin('lowalarm', TType.DOUBLE, 2) + oprot.writeDouble(self.lowalarm) + oprot.writeFieldEnd() + if self.highwarning is not None: + oprot.writeFieldBegin('highwarning', TType.DOUBLE, 3) + oprot.writeDouble(self.highwarning) + oprot.writeFieldEnd() + if self.lowwarning is not None: + oprot.writeFieldBegin('lowwarning', TType.DOUBLE, 4) + oprot.writeDouble(self.lowwarning) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class pltfm_mgr_qsfp_thresholds_t(object): + """ + Attributes: + - rx_pwr + - temp + - tx_bias + - tx_pwr + - vcc + - rx_pwr_is_set + - temp_is_set + - tx_bias_is_set + - tx_pwr_is_set + - vcc_is_set + + """ + + + def __init__(self, rx_pwr=None, temp=None, tx_bias=None, tx_pwr=None, vcc=None, rx_pwr_is_set=None, temp_is_set=None, tx_bias_is_set=None, tx_pwr_is_set=None, vcc_is_set=None,): + self.rx_pwr = rx_pwr + self.temp = temp + self.tx_bias = tx_bias + self.tx_pwr = tx_pwr + self.vcc = vcc + self.rx_pwr_is_set = rx_pwr_is_set + self.temp_is_set = temp_is_set + self.tx_bias_is_set = tx_bias_is_set + self.tx_pwr_is_set = tx_pwr_is_set + self.vcc_is_set = vcc_is_set + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.rx_pwr = pltfm_mgr_qsfp_threshold_t() + self.rx_pwr.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.temp = pltfm_mgr_qsfp_threshold_t() + self.temp.read(iprot) + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRUCT: + self.tx_bias = pltfm_mgr_qsfp_threshold_t() + self.tx_bias.read(iprot) + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRUCT: + self.tx_pwr = pltfm_mgr_qsfp_threshold_t() + self.tx_pwr.read(iprot) + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.STRUCT: + self.vcc = pltfm_mgr_qsfp_threshold_t() + self.vcc.read(iprot) + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.BOOL: + self.rx_pwr_is_set = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 7: + if ftype == TType.BOOL: + self.temp_is_set = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 8: + if ftype == TType.BOOL: + self.tx_bias_is_set = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 9: + if ftype == TType.BOOL: + self.tx_pwr_is_set = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 10: + if ftype == TType.BOOL: + self.vcc_is_set = iprot.readBool() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('pltfm_mgr_qsfp_thresholds_t') + if self.rx_pwr is not None: + oprot.writeFieldBegin('rx_pwr', TType.STRUCT, 1) + self.rx_pwr.write(oprot) + oprot.writeFieldEnd() + if self.temp is not None: + oprot.writeFieldBegin('temp', TType.STRUCT, 2) + self.temp.write(oprot) + oprot.writeFieldEnd() + if self.tx_bias is not None: + oprot.writeFieldBegin('tx_bias', TType.STRUCT, 3) + self.tx_bias.write(oprot) + oprot.writeFieldEnd() + if self.tx_pwr is not None: + oprot.writeFieldBegin('tx_pwr', TType.STRUCT, 4) + self.tx_pwr.write(oprot) + oprot.writeFieldEnd() + if self.vcc is not None: + oprot.writeFieldBegin('vcc', TType.STRUCT, 5) + self.vcc.write(oprot) + oprot.writeFieldEnd() + if self.rx_pwr_is_set is not None: + oprot.writeFieldBegin('rx_pwr_is_set', TType.BOOL, 6) + oprot.writeBool(self.rx_pwr_is_set) + oprot.writeFieldEnd() + if self.temp_is_set is not None: + oprot.writeFieldBegin('temp_is_set', TType.BOOL, 7) + oprot.writeBool(self.temp_is_set) + oprot.writeFieldEnd() + if self.tx_bias_is_set is not None: + oprot.writeFieldBegin('tx_bias_is_set', TType.BOOL, 8) + oprot.writeBool(self.tx_bias_is_set) + oprot.writeFieldEnd() + if self.tx_pwr_is_set is not None: + oprot.writeFieldBegin('tx_pwr_is_set', TType.BOOL, 9) + oprot.writeBool(self.tx_pwr_is_set) + oprot.writeFieldEnd() + if self.vcc_is_set is not None: + oprot.writeFieldBegin('vcc_is_set', TType.BOOL, 10) + oprot.writeBool(self.vcc_is_set) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class InvalidPltfmMgrOperation(TException): + """ + Attributes: + - code + + """ + + + def __init__(self, code=None,): + super(InvalidPltfmMgrOperation, self).__setattr__('code', code) + + def __setattr__(self, *args): + raise TypeError("can't modify immutable instance") + + def __delattr__(self, *args): + raise TypeError("can't modify immutable instance") + + def __hash__(self): + return hash(self.__class__) ^ hash((self.code, )) + + @classmethod + def read(cls, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and cls.thrift_spec is not None: + return iprot._fast_decode(None, iprot, [cls, cls.thrift_spec]) + iprot.readStructBegin() + code = None while True: (fname, ftype, fid) = iprot.readFieldBegin() if ftype == TType.STOP: break if fid == 1: if ftype == TType.I32: - self.code = iprot.readI32() + code = iprot.readI32() else: iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() iprot.readStructEnd() + return cls( + code=code, + ) def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: - oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return oprot.writeStructBegin('InvalidPltfmMgrOperation') if self.code is not None: @@ -1058,3 +1358,122 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) +all_structs.append(pltfm_mgr_sys_tmp_t) +pltfm_mgr_sys_tmp_t.thrift_spec = ( + None, # 0 + (1, TType.DOUBLE, 'tmp1', None, None, ), # 1 + (2, TType.DOUBLE, 'tmp2', None, None, ), # 2 + (3, TType.DOUBLE, 'tmp3', None, None, ), # 3 + (4, TType.DOUBLE, 'tmp4', None, None, ), # 4 + (5, TType.DOUBLE, 'tmp5', None, None, ), # 5 + (6, TType.DOUBLE, 'tmp6', None, None, ), # 6 + (7, TType.DOUBLE, 'tmp7', None, None, ), # 7 + (8, TType.DOUBLE, 'tmp8', None, None, ), # 8 + (9, TType.DOUBLE, 'tmp9', None, None, ), # 9 + (10, TType.DOUBLE, 'tmp10', None, None, ), # 10 +) +all_structs.append(pltfm_mgr_eeprom_t) +pltfm_mgr_eeprom_t.thrift_spec = ( + None, # 0 + (1, TType.I16, 'version', None, None, ), # 1 + (2, TType.STRING, 'prod_name', 'UTF8', None, ), # 2 + (3, TType.STRING, 'prod_part_num', 'UTF8', None, ), # 3 + (4, TType.STRING, 'sys_asm_part_num', 'UTF8', None, ), # 4 + (5, TType.STRING, 'bfn_pcba_part_num', 'UTF8', None, ), # 5 + (6, TType.STRING, 'bfn_pcbb_part_num', 'UTF8', None, ), # 6 + (7, TType.STRING, 'odm_pcba_part_num', 'UTF8', None, ), # 7 + (8, TType.STRING, 'odm_pcba_ser_num', 'UTF8', None, ), # 8 + (9, TType.I16, 'prod_state', None, None, ), # 9 + (10, TType.I16, 'prod_ver', None, None, ), # 10 + (11, TType.I16, 'prod_sub_ver', None, None, ), # 11 + (12, TType.STRING, 'prod_ser_num', 'UTF8', None, ), # 12 + (13, TType.STRING, 'prod_ast_tag', 'UTF8', None, ), # 13 + (14, TType.STRING, 'sys_mfger', 'UTF8', None, ), # 14 + (15, TType.STRING, 'sys_mfg_date', 'UTF8', None, ), # 15 + (16, TType.STRING, 'pcb_mfger', 'UTF8', None, ), # 16 + (17, TType.STRING, 'assembled_at', 'UTF8', None, ), # 17 + (18, TType.STRING, 'loc_mac_addr', 'UTF8', None, ), # 18 + (19, TType.STRING, 'ext_mac_addr', 'UTF8', None, ), # 19 + (20, TType.I32, 'ext_mac_addr_size', None, None, ), # 20 + (21, TType.STRING, 'location', 'UTF8', None, ), # 21 + (22, TType.I16, 'crc8', None, None, ), # 22 +) +all_structs.append(pltfm_mgr_pwr_supply_info_t) +pltfm_mgr_pwr_supply_info_t.thrift_spec = ( + None, # 0 + (1, TType.I32, 'vin', None, None, ), # 1 + (2, TType.I32, 'vout', None, None, ), # 2 + (3, TType.I32, 'iout', None, None, ), # 3 + (4, TType.I32, 'pwr_out', None, None, ), # 4 + (5, TType.I32, 'fspeed', None, None, ), # 5 + (6, TType.BOOL, 'ffault', None, None, ), # 6 + (7, TType.BOOL, 'load_sharing', None, None, ), # 7 + (8, TType.STRING, 'model', 'UTF8', None, ), # 8 + (9, TType.STRING, 'serial', 'UTF8', None, ), # 9 + (10, TType.STRING, 'rev', 'UTF8', None, ), # 10 +) +all_structs.append(pltfm_mgr_pwr_rail_info_t) +pltfm_mgr_pwr_rail_info_t.thrift_spec = ( + None, # 0 + (1, TType.I32, 'vrail1', None, None, ), # 1 + (2, TType.I32, 'vrail2', None, None, ), # 2 + (3, TType.I32, 'vrail3', None, None, ), # 3 + (4, TType.I32, 'vrail4', None, None, ), # 4 + (5, TType.I32, 'vrail5', None, None, ), # 5 + (6, TType.I32, 'vrail6', None, None, ), # 6 + (7, TType.I32, 'vrail7', None, None, ), # 7 + (8, TType.I32, 'vrail8', None, None, ), # 8 + (9, TType.I32, 'vrail9', None, None, ), # 9 + (10, TType.I32, 'vrail10', None, None, ), # 10 + (11, TType.I32, 'vrail11', None, None, ), # 11 + (12, TType.I32, 'vrail12', None, None, ), # 12 + (13, TType.I32, 'vrail13', None, None, ), # 13 + (14, TType.I32, 'vrail14', None, None, ), # 14 + (15, TType.I32, 'vrail15', None, None, ), # 15 + (16, TType.I32, 'vrail16', None, None, ), # 16 +) +all_structs.append(pltfm_mgr_fan_info_t) +pltfm_mgr_fan_info_t.thrift_spec = ( + None, # 0 + (1, TType.I32, 'fan_num', None, None, ), # 1 + (2, TType.I32, 'front_rpm', None, None, ), # 2 + (3, TType.I32, 'rear_rpm', None, None, ), # 3 + (4, TType.I32, 'percent', None, None, ), # 4 +) +all_structs.append(pltfm_mgr_qsfp_alarm_flags_t) +pltfm_mgr_qsfp_alarm_flags_t.thrift_spec = ( + None, # 0 + (1, TType.BOOL, 'highalarm', None, None, ), # 1 + (2, TType.BOOL, 'lowalarm', None, None, ), # 2 + (3, TType.BOOL, 'highwarning', None, None, ), # 3 + (4, TType.BOOL, 'lowwarning', None, None, ), # 4 +) +all_structs.append(pltfm_mgr_qsfp_threshold_t) +pltfm_mgr_qsfp_threshold_t.thrift_spec = ( + None, # 0 + (1, TType.DOUBLE, 'highalarm', None, None, ), # 1 + (2, TType.DOUBLE, 'lowalarm', None, None, ), # 2 + (3, TType.DOUBLE, 'highwarning', None, None, ), # 3 + (4, TType.DOUBLE, 'lowwarning', None, None, ), # 4 +) +all_structs.append(pltfm_mgr_qsfp_thresholds_t) +pltfm_mgr_qsfp_thresholds_t.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'rx_pwr', [pltfm_mgr_qsfp_threshold_t, None], None, ), # 1 + (2, TType.STRUCT, 'temp', [pltfm_mgr_qsfp_threshold_t, None], None, ), # 2 + (3, TType.STRUCT, 'tx_bias', [pltfm_mgr_qsfp_threshold_t, None], None, ), # 3 + (4, TType.STRUCT, 'tx_pwr', [pltfm_mgr_qsfp_threshold_t, None], None, ), # 4 + (5, TType.STRUCT, 'vcc', [pltfm_mgr_qsfp_threshold_t, None], None, ), # 5 + (6, TType.BOOL, 'rx_pwr_is_set', None, None, ), # 6 + (7, TType.BOOL, 'temp_is_set', None, None, ), # 7 + (8, TType.BOOL, 'tx_bias_is_set', None, None, ), # 8 + (9, TType.BOOL, 'tx_pwr_is_set', None, None, ), # 9 + (10, TType.BOOL, 'vcc_is_set', None, None, ), # 10 +) +all_structs.append(InvalidPltfmMgrOperation) +InvalidPltfmMgrOperation.thrift_spec = ( + None, # 0 + (1, TType.I32, 'code', None, None, ), # 1 +) +fix_spec(all_structs) +del all_structs diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/psu.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/psu.py index c63bb6528dae..fb9bce50e071 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/psu.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/psu.py @@ -3,6 +3,7 @@ try: import os import sys + import time sys.path.append(os.path.dirname(__file__)) @@ -18,6 +19,10 @@ class Psu(PsuBase): def __init__(self, index): PsuBase.__init__(self) self.__index = index + self.__info = None + self.__ts = 0 + # STUB IMPLEMENTATION + self.color = "" ''' Units of returned info object values: @@ -31,7 +36,16 @@ def __info_get(self): def psu_info_get(client): return client.pltfm_mgr.pltfm_mgr_pwr_supply_info_get(self.__index) - return thrift_try(psu_info_get) + # Update cache once per 2 seconds + if self.__ts + 2 < time.time(): + self.__info = None + try: + self.__info = thrift_try(psu_info_get, attempts=1) + finally: + self.__ts = time.time() + return self.__info + return self.__info + @staticmethod def get_num_psus(): @@ -52,6 +66,8 @@ def get_powergood_status(self): :return: Boolean, True if PSU is operating properly, False if PSU is faulty """ info = self.__info_get() + if info is None: + return False return info.ffault == False and info.vout != 0 def get_voltage(self): @@ -62,7 +78,8 @@ def get_voltage(self): A float number, the output voltage in volts, e.g. 12.1 """ - return float(self.__info_get().vout) + info = self.__info_get() + return float(info.vout) if info else 0 def get_current(self): """ @@ -71,7 +88,8 @@ def get_current(self): Returns: A float number, the electric current in amperes, e.g 15.4 """ - return self.__info_get().iout / 1000. + info = self.__info_get() + return info.iout / 1000 if info else 0 def get_power(self): """ @@ -80,7 +98,8 @@ def get_power(self): Returns: A float number, the power in watts, e.g. 302.6 """ - return self.__info_get().pwr_out / 1000. + info = self.__info_get() + return info.pwr_out / 1000 if info else 0 def get_presence(self): """ @@ -92,19 +111,94 @@ def get_presence(self): def psu_present_get(client): return client.pltfm_mgr.pltfm_mgr_pwr_supply_present_get(self.__index) - status = thrift_try(psu_present_get) - return status + status = False + try: + status = thrift_try(psu_present_get) + finally: + return status + + def set_status_led(self, color): + """ + Sets the state of the PSU status LED + + Args: + color: A string representing the color with which to set the + PSU status LED + + Returns: + bool: True if status LED state is set successfully, False if not + """ + # STUB IMPLEMENTATION + self.color = color + return True + + def get_status_led(self): + """ + Gets the state of the PSU status LED + + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + # STUB IMPLEMENTATION + return self.color # DeviceBase iface: def get_serial(self): - return self.__info_get().serial + """ + Retrieves the serial number of the device + + Returns: + string: Serial number of device + """ + info = self.__info_get() + return info.serial if info else "N/A" def get_model(self): - return self.__info_get().model + """ + Retrieves the model number (or part number) of the device + + Returns: + string: Model/part number of device + """ + info = self.__info_get() + return info.model if info else "N/A" def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ return True + def get_revision(self): + """ + Retrieves the hardware revision of the device + + Returns: + string: Revision value of device + """ + info = self.__info_get() + return info.rev if info else "N/A" + + def get_status(self): + """ + Retrieves the operational status of the device + + Returns: + A boolean value, True if device is operating properly, False if not + """ + return self.get_powergood_status() + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.__index + def psu_list_get(): psu_list = [] for i in range(1, Psu.get_num_psus() + 1): diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/sfp.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/sfp.py index 640b1c41948c..f5d800b749c9 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/sfp.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/sfp.py @@ -2,80 +2,47 @@ try: import os - import sys - import time + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase + from sonic_platform.platform_thrift_client import thrift_try + from sonic_platform.platform_thrift_client import pltfm_mgr_try +except ImportError as e: + raise ImportError (str(e) + "- required module not found") - import tempfile - from contextlib import contextmanager - from copy import copy +SFP_TYPE = "SFP" +QSFP_TYPE = "QSFP" +QSFP_DD_TYPE = "QSFP_DD" - sys.path.append(os.path.dirname(__file__)) - from .platform_thrift_client import ThriftClient - from .platform_thrift_client import thrift_try +class Sfp(SfpOptoeBase): + """ + BFN Platform-specific SFP class + """ - from sonic_platform_base.sfp_base import SfpBase - from sonic_platform_base.sonic_sfp.sfputilbase import SfpUtilBase -except ImportError as e: - raise ImportError (str(e) + "- required module not found") + SFP_EEPROM_PATH = "/var/run/platform/sfp/" -class SfpUtil(SfpUtilBase): - """Platform-specific SfpUtil class""" - - PORT_START = 1 - PORT_END = 0 - PORTS_IN_BLOCK = 0 - QSFP_PORT_START = 1 - QSFP_PORT_END = 0 - EEPROM_OFFSET = 0 - QSFP_CHECK_INTERVAL = 4 - - @property - def port_start(self): - self.update_port_info() - return self.PORT_START - - @property - def port_end(self): - self.update_port_info() - return self.PORT_END - - @property - def qsfp_ports(self): - self.update_port_info() - return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1) - - @property - def port_to_eeprom_mapping(self): - print("dependency on sysfs has been removed") - raise Exception() - - def __init__(self): - self.ready = False - self.phy_port_dict = {'-1': 'system_not_ready'} - self.phy_port_cur_state = {} - self.qsfp_interval = self.QSFP_CHECK_INTERVAL - - SfpUtilBase.__init__(self) - - def update_port_info(self): - def qsfp_max_port_get(client): - return client.pltfm_mgr.pltfm_mgr_qsfp_get_max_port(); - - if self.QSFP_PORT_END == 0: - self.QSFP_PORT_END = thrift_try(qsfp_max_port_get) - self.PORT_END = self.QSFP_PORT_END - self.PORTS_IN_BLOCK = self.QSFP_PORT_END - - def get_presence(self, port_num): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False + def __init__(self, port_num): + SfpOptoeBase.__init__(self) + self.index = port_num + self.port_num = port_num + self.sfp_type = QSFP_TYPE + if not os.path.exists(self.SFP_EEPROM_PATH): + try: + os.makedirs(self.SFP_EEPROM_PATH) + except OSError as e: + if e.errno != errno.EEXIST: + raise + + self.eeprom_path = self.SFP_EEPROM_PATH + "sfp{}-eeprom-cache".format(self.index) + + def get_presence(self): + """ + Retrieves the presence of the sfp + """ presence = False def qsfp_presence_get(client): - return client.pltfm_mgr.pltfm_mgr_qsfp_presence_get(port_num) + return client.pltfm_mgr.pltfm_mgr_qsfp_presence_get(self.index) try: presence = thrift_try(qsfp_presence_get) @@ -85,194 +52,156 @@ def qsfp_presence_get(client): return presence - def get_low_power_mode(self, port_num): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - + def get_lpmode(self): + """ + Retrieves the lpmode (low power mode) status of this SFP + """ def qsfp_lpmode_get(client): - return client.pltfm_mgr.pltfm_mgr_qsfp_lpmode_get(port_num) - - lpmode = thrift_try(qsfp_lpmode_get) + return client.pltfm_mgr.pltfm_mgr_qsfp_lpmode_get(self.index) - return lpmode - - def set_low_power_mode(self, port_num, lpmode): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False + return thrift_try(qsfp_lpmode_get) + def set_lpmode(self, lpmode): + """ + Sets the lpmode (low power mode) of SFP + """ def qsfp_lpmode_set(client): - return client.pltfm_mgr.pltfm_mgr_qsfp_lpmode_set(port_num, lpmode) + return client.pltfm_mgr.pltfm_mgr_qsfp_lpmode_set(self.index, lpmode) status = thrift_try(qsfp_lpmode_set) - return (status == 0) - def reset(self, port_num): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: - return False - - def qsfp_reset(client): - client.pltfm_mgr.pltfm_mgr_qsfp_reset(port_num, True) - return client.pltfm_mgr.pltfm_mgr_qsfp_reset(port_num, False) - - err = thrift_try(qsfp_reset) - - return not err - - def check_transceiver_change(self): - if not self.ready: - return - - self.phy_port_dict = {} - - try: - client = ThriftClient().open() - except Exception: - return - - # Get presence of each SFP - for port in range(self.port_start, self.port_end + 1): - try: - sfp_resent = client.pltfm_mgr.pltfm_mgr_qsfp_presence_get(port) - except Exception: - sfp_resent = False - sfp_state = '1' if sfp_resent else '0' - - if port in self.phy_port_cur_state: - if self.phy_port_cur_state[port] != sfp_state: - self.phy_port_dict[port] = sfp_state - else: - self.phy_port_dict[port] = sfp_state - - # Update port current state - self.phy_port_cur_state[port] = sfp_state - - client.close() - - def get_transceiver_change_event(self, timeout=0): - forever = False - if timeout == 0: - forever = True - elif timeout > 0: - timeout = timeout / float(1000) # Convert to secs - else: - print("get_transceiver_change_event:Invalid timeout value", timeout) - return False, {} - - while forever or timeout > 0: - if not self.ready: - try: - with ThriftClient(): pass - except Exception: - pass - else: - self.ready = True - self.phy_port_dict = {} - break - elif self.qsfp_interval == 0: - self.qsfp_interval = self.QSFP_CHECK_INTERVAL - - # Process transceiver plug-in/out event - self.check_transceiver_change() - - # Break if tranceiver state has changed - if bool(self.phy_port_dict): - break - - if timeout: - timeout -= 1 - - if self.qsfp_interval: - self.qsfp_interval -= 1 - - time.sleep(1) - - return self.ready, self.phy_port_dict - - @contextmanager - def eeprom_action(self): - u = copy(self) - with tempfile.NamedTemporaryFile() as f: - u.eeprom_path = f.name - yield u - - def _sfp_eeprom_present(self, client_eeprompath, offset): - return client_eeprompath and super(SfpUtil, self)._sfp_eeprom_present(client_eeprompath, offset) - - def _get_port_eeprom_path(self, port_num, devid): + def get_eeprom_path(self): def qsfp_info_get(client): - return client.pltfm_mgr.pltfm_mgr_qsfp_info_get(port_num) + return client.pltfm_mgr.pltfm_mgr_qsfp_info_get(self.index) - if self.get_presence(port_num): + if self.get_presence(): eeprom_hex = thrift_try(qsfp_info_get) eeprom_raw = bytearray.fromhex(eeprom_hex) - with open(self.eeprom_path, 'wb') as eeprom_cache: - eeprom_cache.write(eeprom_raw) + with open(self.eeprom_path, 'wb') as fp: + fp.write(eeprom_raw) return self.eeprom_path return None -class Sfp(SfpBase): - """Platform-specific Sfp class""" - - sfputil = SfpUtil() - - @staticmethod - def port_start(): - return Sfp.sfputil.port_start - - @staticmethod - def port_end(): - return Sfp.sfputil.port_end - - @staticmethod - def qsfp_ports(): - return Sfp.sfputil.qsfp_ports() - - @staticmethod - def get_transceiver_change_event(timeout=0): - return Sfp.sfputil.get_transceiver_change_event() - - def __init__(self, port_num): - self.port_num = port_num - SfpBase.__init__(self) - - def get_presence(self): - with Sfp.sfputil.eeprom_action() as u: - return u.get_presence(self.port_num) - - def get_lpmode(self): - with Sfp.sfputil.eeprom_action() as u: - return u.get_low_power_mode(self.port_num) - - def set_lpmode(self, lpmode): - with Sfp.sfputil.eeprom_action() as u: - return u.set_low_power_mode(self.port_num, lpmode) + def write_eeprom(self, offset, num_bytes, write_buffer): + # Not supported at the moment + return False + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + return "sfp{}".format(self.index) + + def get_reset_status(self): + """ + Retrieves the reset status of SFP + """ + def get_qsfp_reset(pltfm_mgr): + return pltfm_mgr.pltfm_mgr_qsfp_reset_get(self.index) + _, status = pltfm_mgr_try(get_qsfp_reset, False) + return status def reset(self): - return Sfp.sfputil.reset(self.port_num) - - def get_transceiver_info(self): - with Sfp.sfputil.eeprom_action() as u: - return u.get_transceiver_info_dict(self.port_num) - - def get_transceiver_bulk_status(self): - with Sfp.sfputil.eeprom_action() as u: - return u.get_transceiver_dom_info_dict(self.port_num) + """ + Reset SFP and return all user module settings to their default srate. + """ + def qsfp_reset(client): + client.pltfm_mgr.pltfm_mgr_qsfp_reset(self.index, True) + return client.pltfm_mgr.pltfm_mgr_qsfp_reset(self.index, False) - def get_transceiver_threshold_info(self): - with Sfp.sfputil.eeprom_action() as u: - return u.get_transceiver_dom_threshold_info_dict(self.port_num) + err = thrift_try(qsfp_reset) + return not err - def get_change_event(self, timeout=0): - return Sfp.get_transceiver_change_event(timeout) + def get_status(self): + """ + Retrieves the operational status of the device + """ + reset = self.get_reset_status() -def sfp_list_get(): - sfp_list = [] - for index in range(Sfp.port_start(), Sfp.port_end() + 1): - sfp_node = Sfp(index) - sfp_list.append(sfp_node) - return sfp_list + if reset: + status = False + else: + status = True + + return status + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + Returns: + integer: The 1-based relative physical position in parent + device or -1 if cannot determine the position + """ + return self.index + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True + + def get_error_description(self): + """ + Retrives the error descriptions of the SFP module + Returns: + String that represents the current error descriptions of vendor specific errors + In case there are multiple errors, they should be joined by '|', + like: "Bad EEPROM|Unsupported cable" + """ + if not self.get_presence(): + return self.SFP_STATUS_UNPLUGGED + return self.SFP_STATUS_OK + + def tx_disable(self, tx_disable): + """ + Disable SFP TX for all channels + Args: + tx_disable : A Boolean, True to enable tx_disable mode, False to disable + tx_disable mode. + Returns: + A boolean, True if tx_disable is set successfully, False if not + """ + if self.sfp_type == QSFP_TYPE: + return self.tx_disable_channel(0xF, tx_disable) + return False + + def tx_disable_channel(self, channel, disable): + """ + Sets the tx_disable for specified SFP channels + + Args: + channel : A hex of 4 bits (bit 0 to bit 3) which represent channel 0 to 3, + e.g. 0x5 for channel 0 and channel 2. + disable : A boolean, True to disable TX channels specified in channel, + False to enable + + Returns: + A boolean, True if successful, False if not + """ + def qsfp_tx_disable_channel(client): + return client.pltfm_mgr.pltfm_mgr_qsfp_tx_disable(self.index, channel, disable) + + if self.sfp_type == QSFP_TYPE: + status = thrift_try(qsfp_tx_disable_channel) + return (status == 0) + return False + + def get_power_override(self): + def get_qsfp_power_override(pltfm_mgr): + return pltfm_mgr.pltfm_mgr_qsfp_pwr_override_get(self.index) + _, pwr_override = pltfm_mgr_try(get_qsfp_power_override) + return pwr_override + + def set_power_override(self, power_override, power_set): + def set_qsfp_power_override(pltfm_mgr): + return pltfm_mgr.pltfm_mgr_qsfp_pwr_override_set( + self.index, power_override, power_set + ) + _, status = pltfm_mgr_try(set_qsfp_power_override) + return status diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/thermal.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/thermal.py index 3a39c10a1e1f..e5034f09f558 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/thermal.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/thermal.py @@ -1,8 +1,11 @@ try: import subprocess - - from sonic_platform.bfn_extensions.platform_sensors import platform_sensors_get + from collections import namedtuple + import json + from bfn_extensions.platform_sensors import platform_sensors_get from sonic_platform_base.thermal_base import ThermalBase + from sonic_py_common import device_info + import logging except ImportError as e: raise ImportError (str(e) + "- required module not found") @@ -18,6 +21,8 @@ temp2_input: 37.000 ... ''' +Threshold = namedtuple('Threshold', ['crit', 'max', 'min', 'alarm']) + def _sensors_chip_parsed(data: str): def kv(line): k, v, *_ = [t.strip(': ') for t in line.split(':') if t] + [''] @@ -68,27 +73,99 @@ def _value_get(d: dict, key_prefix, key_suffix=''): # Thermal -> ThermalBase -> DeviceBase class Thermal(ThermalBase): - def __init__(self, chip, label): + _thresholds = dict() + _max_temperature = 100.0 + _min_temperature = 0.0 + _min_high_threshold_temperature = 35.0 + + def __init__(self, chip, label, index = 0): self.__chip = chip self.__label = label self.__name = f"{chip}:{label}".lower().replace(' ', '-') + self.__collect_temp = [] + self.__index = index + self.__high_threshold = None + self.__low_threshold = None + f = None + try: + path = device_info.get_path_to_platform_dir() + '/' + 'thermal_thresholds.json' + f = open(path) + except FileNotFoundError: + logging.warning('can not open the file') + + if f is not None: + self.__get_thresholds(f) + + def __get_thresholds(self, f): + def_threshold_json = json.load(f) + all_data = def_threshold_json["thermals"] + for i in all_data: + for key, value in i.items(): + self._thresholds[key] = Threshold(*value) + + def check_in_range(self, temperature): + temp_f = float(temperature) + return temp_f > self._min_temperature and temp_f <= self._max_temperature + + def check_high_threshold(self, temperature, attr_suffix): + temp_f = float(temperature) + check_range = True + if attr_suffix == 'max': + if temp_f < self._min_high_threshold_temperature: + if self.__name in self._thresholds: + temp = self._thresholds[self.__name].max + self.set_high_threshold(temp) + check_range = False + return check_range def __get(self, attr_prefix, attr_suffix): sensor_data = _sensors_get().get(self.__chip, {}).get(self.__label, {}) value = _value_get(sensor_data, attr_prefix, attr_suffix) - if value is not None: return value - raise NotImplementedError + if value is not None and self.check_in_range(value) and self.check_high_threshold(value, attr_suffix): + return value + elif self.__name in self._thresholds and attr_prefix == 'temp': + if attr_suffix == 'crit': + return self._thresholds[self.__name].crit + elif attr_suffix == 'max': + if self.__high_threshold is None: + return self._thresholds[self.__name].max + else: + return self.__high_threshold + elif attr_suffix == 'min': + if self.__low_threshold is None: + return self._thresholds[self.__name].min + else: + return self.__low_threshold + elif attr_suffix == 'alarm': + return self._thresholds[self.__name].alarm + else: + return 1.0 + else: + return 0.05 # ThermalBase interface methods: def get_temperature(self) -> float: - return float(self.__get('temp', 'input')) + temp = self.__get('temp', 'input') + self.__collect_temp.append(float(temp)) + self.__collect_temp.sort() + if len(self.__collect_temp) == 3: + del self.__collect_temp[1] + return float(temp) def get_high_threshold(self) -> float: - return float(self.__get('temp', 'max')) + if self.__high_threshold is None: + return float(self.__get('temp', 'max')) + return float(self.__high_threshold) def get_high_critical_threshold(self) -> float: return float(self.__get('temp', 'crit')) + def get_low_critical_threshold(self) -> float: + return float(self.__get('temp', 'alarm')) + + def get_model(self): + return f"{self.__label}".lower() + # DeviceBase interface methods: def get_name(self): return self.__name @@ -99,11 +176,51 @@ def get_presence(self): def get_status(self): return True + def is_replaceable(self): + return False + + def get_low_threshold(self) -> float: + if self.__low_threshold is None: + return float(self.__get('temp', 'min')) + return float(self.__low_threshold) + + def get_serial(self): + return 'N/A' + + def get_minimum_recorded(self) -> float: + temp = self.__collect_temp[0] if len(self.__collect_temp) > 0 else self.get_temperature() + temp = temp if temp <= 100.0 else 100.0 + temp = temp if temp > 0.0 else 0.1 + return float(temp) + + def get_maximum_recorded(self) -> float: + temp = self.__collect_temp[-1] if len(self.__collect_temp) > 0 else self.get_temperature() + temp = temp if temp <= 100.0 else 100.0 + temp = temp if temp > 0.0 else 0.1 + return float(temp) + + def get_position_in_parent(self): + return self.__index + + def set_high_threshold(self, temperature): + if self.check_in_range(temperature): + self.__high_threshold = temperature + return True + return False + + def set_low_threshold(self, temperature): + if self.check_in_range(temperature): + self.__low_threshold = temperature + return True + return False + def thermal_list_get(): l = [] + index = 0 for chip, chip_data in _sensors_get().items(): for sensor, sensor_data in chip_data.items(): # add only temperature sensors if _value_get(sensor_data, "temp") is not None: - l.append(Thermal(chip, sensor)) + l.append(Thermal(chip, sensor, index)) + index += 1 return l diff --git a/platform/barefoot/sonic-platform-modules-bfn-newport/debian/control b/platform/barefoot/sonic-platform-modules-bfn-newport/debian/control index d2c37fe8d2b9..9663cc3f644a 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-newport/debian/control +++ b/platform/barefoot/sonic-platform-modules-bfn-newport/debian/control @@ -2,16 +2,16 @@ Source: sonic-platform-modules-bfn-newport Section: main Priority: extra Maintainer: Support -Build-Depends: debhelper (>= 9.0.0), bzip2 +Build-Depends: debhelper (>= 9.0.0), bzip2, python3 Standards-Version: 3.9.3 Package: sonic-platform-modules-bfn-newport-as9516 Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel module for bfn platform fpga and scripts for the devices such as fan, led, sfp Package: sonic-platform-modules-bfn-newport-as9516bf Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel module for bfn platform fpga and scripts for the devices such as fan, led, sfp diff --git a/platform/barefoot/sonic-platform-modules-bfn-newport/debian/rules b/platform/barefoot/sonic-platform-modules-bfn-newport/debian/rules index 9edb45b497ab..540bdcafb6fd 100755 --- a/platform/barefoot/sonic-platform-modules-bfn-newport/debian/rules +++ b/platform/barefoot/sonic-platform-modules-bfn-newport/debian/rules @@ -13,13 +13,13 @@ WHEEL_BUILD_DIR := $(BUILD_DIR)/wheel MODULE_NAMES := as9516 as9516bf %: - dh $@ + dh $@ --with python3 --buildsystem=pybuild override_dh_auto_build: make -C $(KERNEL_SRC)/build M=$(MODULE_SRC) set -e python3 setup.py bdist_wheel -d $(WHEEL_BUILD_DIR) - set +e + set +e override_dh_auto_install: (for mod in $(MODULE_NAMES); do \ @@ -39,8 +39,8 @@ override_dh_pysupport: override_dh_clean: dh_clean - rm -fr $(WHEEL_BUILD_DIR) - rm -fr *.egg-info + rm -fr $(WHEEL_BUILD_DIR) + rm -fr *.egg-info rm -fr $(BUILD) rm -f $(MODULE_SRC)/*.o $(MODULE_SRC)/*.ko $(MODULE_SRC)/*.mod.c $(MODULE_SRC)/.*.cmd rm -f $(MODULE_SRC)/Module.markers $(MODULE_SRC)/Module.symvers $(MODULE_SRC)/modules.order diff --git a/platform/barefoot/sonic-platform-modules-bfn-newport/modules/i2c/bf_fpga_i2c.c b/platform/barefoot/sonic-platform-modules-bfn-newport/modules/i2c/bf_fpga_i2c.c index 1a622e5392d6..c8ebd3e63c6f 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-newport/modules/i2c/bf_fpga_i2c.c +++ b/platform/barefoot/sonic-platform-modules-bfn-newport/modules/i2c/bf_fpga_i2c.c @@ -25,7 +25,7 @@ *******************************************************************************/ #include #include "bf_fpga_i2c_priv_porting.h" -#include +#include "../bf_fpga_ioctl.h" #include "bf_fpga_i2c_priv.h" #include "bf_fpga_i2c.h" #include "bf_fpga_i2c_reg.h" diff --git a/platform/barefoot/sonic-platform-modules-bfn-newport/modules/i2c/bf_fpga_i2c_ctrl.c b/platform/barefoot/sonic-platform-modules-bfn-newport/modules/i2c/bf_fpga_i2c_ctrl.c index a8837ba3b60c..6e3291587a64 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-newport/modules/i2c/bf_fpga_i2c_ctrl.c +++ b/platform/barefoot/sonic-platform-modules-bfn-newport/modules/i2c/bf_fpga_i2c_ctrl.c @@ -25,7 +25,7 @@ *******************************************************************************/ #include #include "bf_fpga_i2c_priv_porting.h" -#include +#include "../bf_fpga_ioctl.h" #include "bf_fpga_i2c.h" #include "bf_fpga_i2c_priv.h" #include "bf_fpga_i2c_reg.h" diff --git a/platform/barefoot/sonic-platform-modules-bfn-newport/modules/i2c/bf_fpga_i2c_porting.c b/platform/barefoot/sonic-platform-modules-bfn-newport/modules/i2c/bf_fpga_i2c_porting.c index 8b126c2e6dce..9cc4ebff91ff 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-newport/modules/i2c/bf_fpga_i2c_porting.c +++ b/platform/barefoot/sonic-platform-modules-bfn-newport/modules/i2c/bf_fpga_i2c_porting.c @@ -29,7 +29,7 @@ #include #include #include "bf_fpga_i2c_priv_porting.h" -#include +#include "../bf_fpga_ioctl.h" #include "bf_fpga_i2c.h" #include "bf_fpga_i2c_priv.h" diff --git a/platform/barefoot/sonic-platform-modules-bfn/debian/control b/platform/barefoot/sonic-platform-modules-bfn/debian/control index 89c597303a78..de1a22fdb1b5 100644 --- a/platform/barefoot/sonic-platform-modules-bfn/debian/control +++ b/platform/barefoot/sonic-platform-modules-bfn/debian/control @@ -2,11 +2,11 @@ Source: sonic-platform-modules-bfn Section: main Priority: extra Maintainer: support -Build-Depends: debhelper (>= 9.0.0), bzip2 +Build-Depends: debhelper (>= 9.0.0), bzip2, python3 Standards-Version: 3.9.3 Package: sonic-platform-modules-bfn Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/barefoot/sonic-platform-modules-bfn/debian/rules b/platform/barefoot/sonic-platform-modules-bfn/debian/rules index e52ae2c95074..7af5c9f8de65 100755 --- a/platform/barefoot/sonic-platform-modules-bfn/debian/rules +++ b/platform/barefoot/sonic-platform-modules-bfn/debian/rules @@ -8,7 +8,7 @@ BUILD_DIR := $(shell pwd)/build WHEEL_BUILD_DIR := $(BUILD_DIR)/wheel %: - dh $@ + dh $@ --with python3 --buildsystem=pybuild override_dh_auto_build: set -e @@ -28,8 +28,8 @@ override_dh_usrlocal: override_dh_pysupport: override_dh_clean: - rm -fr $(WHEEL_BUILD_DIR) - rm -fr *.egg-info + rm -fr $(WHEEL_BUILD_DIR) + rm -fr *.egg-info rm -fr $(BUILD) dh_clean diff --git a/platform/barefoot/sonic-platform-modules-ingrasys/debian/control b/platform/barefoot/sonic-platform-modules-ingrasys/debian/control index a912ed8ace2e..34ef405b8853 100644 --- a/platform/barefoot/sonic-platform-modules-ingrasys/debian/control +++ b/platform/barefoot/sonic-platform-modules-ingrasys/debian/control @@ -2,7 +2,7 @@ Source: platform-driver Section: unknown Priority: optional Maintainer: Wade He -Build-Depends: debhelper (>= 9), dh-systemd +Build-Depends: debhelper (>= 9) Standards-Version: 1.0.0 Package: sonic-platform-ingrasys-s9180-32x diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/control b/platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/control index eab1adcadecd..bed8117da850 100644 --- a/platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/control +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/control @@ -2,11 +2,11 @@ Source: platform-modules-wnc-osw1800 Section: main Priority: extra Maintainer: WNC -Build-Depends: debhelper (>= 8.0.0), bzip2 +Build-Depends: debhelper (>= 8.0.0), bzip2, python3 Standards-Version: 3.9.3 Package: platform-modules-wnc-osw1800 Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/rules b/platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/rules index 644ab1ade433..87a468a2900d 100755 --- a/platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/rules +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/debian/rules @@ -10,7 +10,7 @@ SCRIPT_SRC := $(shell pwd)/scripts SERVICE_SRC := $(shell pwd)/service %: - dh $@ + dh $@ --with python3 override_dh_auto_build: make -C $(KERNEL_SRC)/build M=$(MODULE_SRC) diff --git a/platform/broadcom/docker-saiserver-brcm.mk b/platform/broadcom/docker-saiserver-brcm.mk index d39759ac7f21..f4f9cdd42a49 100644 --- a/platform/broadcom/docker-saiserver-brcm.mk +++ b/platform/broadcom/docker-saiserver-brcm.mk @@ -1,13 +1,16 @@ # docker image for brcm saiserver -DOCKER_SAISERVER_BRCM = docker-saiserver-brcm.gz +DOCKER_SAISERVER_BRCM = docker-saiserver$(SAITHRIFT_VER)-brcm.gz $(DOCKER_SAISERVER_BRCM)_PATH = $(PLATFORM_PATH)/docker-saiserver-brcm $(DOCKER_SAISERVER_BRCM)_DEPENDS += $(SAISERVER) $(DOCKER_SAISERVER_BRCM)_FILES += $(DSSERVE) $(BCMCMD) $(DOCKER_SAISERVER_BRCM)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_BRCM) +SONIC_BUSTER_DOCKERS += $(DOCKER_SAISERVER_BRCM) + +#Support two versions of saiserver +$(DOCKER_SAISERVER_BRCM)_CONTAINER_NAME = saiserver$(SAITHRIFT_VER) -$(DOCKER_SAISERVER_BRCM)_CONTAINER_NAME = saiserver $(DOCKER_SAISERVER_BRCM)_RUN_OPT += --privileged -t $(DOCKER_SAISERVER_BRCM)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SAISERVER_BRCM)_RUN_OPT += -v /var/run/docker-saiserver:/var/run/sswsyncd diff --git a/platform/broadcom/docker-saiserver-brcm/start.sh b/platform/broadcom/docker-saiserver-brcm/start.sh index 494c0e9126c2..81813b57ff9d 100755 --- a/platform/broadcom/docker-saiserver-brcm/start.sh +++ b/platform/broadcom/docker-saiserver-brcm/start.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +HWSKU_DIR=/usr/share/sonic/hwsku start_bcm() { @@ -7,11 +8,37 @@ start_bcm() [ -e /dev/linux-kernel-bde ] || mknod /dev/linux-kernel-bde c 127 0 } +generate_profile() +{ + # There are two ways to specify the contents of the SAI_INIT_CONFIG_FILE and they are mutually exclusive + # via current method (sai.profile.j2) or new method (config.bcm.j2) + # If delta is large, use sai.profile.j2 which basically require the user to select which config file to use + # If delta is small, use config.bcm.j2 where additional SAI INIT config properties are added + # based on specific device metadata requirement + # in this case sai.profile should have been modified to use the path /etc/sai.d/config.bcm + # There is also a possibility that both sai.profile.j2 and config.bcm.j2 are absent. in that cacse just copy + # sai.profile to the new /etc/said directory. + + # Create/Copy the sai.profile to /etc/sai.d/sai.profile + mkdir -p /etc/sai.d/ + + if [ -f $HWSKU_DIR/sai.profile.j2 ]; then + sonic-cfggen -d -t $HWSKU_DIR/sai.profile.j2 > /etc/sai.d/sai.profile + else + if [ -f $HWSKU_DIR/config.bcm.j2 ]; then + sonic-cfggen -d -t $HWSKU_DIR/config.bcm.j2 > /etc/sai.d/config.bcm + fi + if [ -f $HWSKU_DIR/sai.profile ]; then + cp $HWSKU_DIR/sai.profile /etc/sai.d/sai.profile + fi + fi +} rm -f /var/run/rsyslogd.pid supervisorctl start rsyslogd +generate_profile start_bcm supervisorctl start saiserver diff --git a/platform/broadcom/docker-saiserver-brcm/supervisord.conf b/platform/broadcom/docker-saiserver-brcm/supervisord.conf index ccb107b3d1f8..3574cd782b78 100644 --- a/platform/broadcom/docker-saiserver-brcm/supervisord.conf +++ b/platform/broadcom/docker-saiserver-brcm/supervisord.conf @@ -20,7 +20,7 @@ stdout_logfile=syslog stderr_logfile=syslog [program:saiserver] -command=/usr/sbin/saiserver -p /usr/share/sonic/hwsku/sai.profile -f /usr/share/sonic/hwsku/port_config.ini +command=/usr/sbin/saiserver -p /etc/sai.d/sai.profile -f /usr/share/sonic/hwsku/port_config.ini priority=3 autostart=false autorestart=false diff --git a/platform/broadcom/docker-syncd-brcm-dnx-rpc.mk b/platform/broadcom/docker-syncd-brcm-dnx-rpc.mk index c4ccf51f6534..111071128c97 100644 --- a/platform/broadcom/docker-syncd-brcm-dnx-rpc.mk +++ b/platform/broadcom/docker-syncd-brcm-dnx-rpc.mk @@ -18,7 +18,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM_DNX_RPC) endif $(DOCKER_SYNCD_BRCM_DNX_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_BRCM_DNX_RPC)_VERSION = 1.0.0-rpc +$(DOCKER_SYNCD_BRCM_DNX_RPC)_VERSION = 1.0.0+rpc $(DOCKER_SYNCD_BRCM_DNX_RPC)_PACKAGE_NAME = syncd-dnx $(DOCKER_SYNCD_BRCM_DNX_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_BRCM_DNX_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf @@ -29,3 +29,5 @@ $(DOCKER_SYNCD_BRCM_DNX_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_SYNCD_BRCM_DNX_RPC)_BASE_IMAGE_FILES += bcmcmd:/usr/bin/bcmcmd $(DOCKER_SYNCD_BRCM_DNX_RPC)_BASE_IMAGE_FILES += bcmsh:/usr/bin/bcmsh $(DOCKER_SYNCD_BRCM_DNX_RPC)_MACHINE = broadcom-dnx + +SONIC_BUSTER_DOCKERS += $(DOCKER_SYNCD_BRCM_DNX_RPC) diff --git a/platform/broadcom/docker-syncd-brcm-dnx.mk b/platform/broadcom/docker-syncd-brcm-dnx.mk index e08a38d93862..2cf89f18753a 100644 --- a/platform/broadcom/docker-syncd-brcm-dnx.mk +++ b/platform/broadcom/docker-syncd-brcm-dnx.mk @@ -46,3 +46,6 @@ $(DOCKER_SYNCD_DNX_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SYNCD_DNX_BASE)_BASE_IMAGE_FILES += bcmcmd:/usr/bin/bcmcmd $(DOCKER_SYNCD_DNX_BASE)_BASE_IMAGE_FILES += bcmsh:/usr/bin/bcmsh $(DOCKER_SYNCD_DNX_BASE)_BASE_IMAGE_FILES += bcm_common:/usr/bin/bcm_common + +SONIC_BUSTER_DOCKERS += $(DOCKER_SYNCD_DNX_BASE) +SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_SYNCD_DNX_BASE_DBG) diff --git a/platform/broadcom/docker-syncd-brcm-rpc.mk b/platform/broadcom/docker-syncd-brcm-rpc.mk index 554c603e63e4..49c664819f8b 100644 --- a/platform/broadcom/docker-syncd-brcm-rpc.mk +++ b/platform/broadcom/docker-syncd-brcm-rpc.mk @@ -17,7 +17,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_BRCM_RPC) endif $(DOCKER_SYNCD_BRCM_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_BRCM_RPC)_VERSION = 1.0.0-rpc +$(DOCKER_SYNCD_BRCM_RPC)_VERSION = 1.0.0+rpc $(DOCKER_SYNCD_BRCM_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_BRCM_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_BRCM_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf @@ -28,3 +28,5 @@ $(DOCKER_SYNCD_BRCM_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_SYNCD_BRCM_RPC)_BASE_IMAGE_FILES += bcmcmd:/usr/bin/bcmcmd $(DOCKER_SYNCD_BRCM_RPC)_BASE_IMAGE_FILES += bcmsh:/usr/bin/bcmsh $(DOCKER_SYNCD_BRCM_RPC)_MACHINE = broadcom + +SONIC_BUSTER_DOCKERS += $(DOCKER_SYNCD_BRCM_RPC) diff --git a/platform/broadcom/libsaithrift-dev.mk b/platform/broadcom/libsaithrift-dev.mk index 543ea63e7f4e..c1bd9b90de13 100644 --- a/platform/broadcom/libsaithrift-dev.mk +++ b/platform/broadcom/libsaithrift-dev.mk @@ -2,19 +2,28 @@ SAI_VER = 0.9.4 -LIBSAITHRIFT_DEV = libsaithrift-dev_$(SAI_VER)_amd64.deb +LIBSAITHRIFT_DEV = libsaithrift$(SAITHRIFT_VER)-dev_$(SAI_VER)_amd64.deb $(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI -$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(BRCM_SAI) $(BRCM_SAI_DEV) -$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT) $(BRCM_SAI) +#Support two different versions of thrift +ifeq ($(SAITHRIFT_V2),y) +$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT_0_14_1) $(LIBTHRIFT_0_14_1_DEV) $(PYTHON3_THRIFT_0_14_1) $(THRIFT_0_14_1_COMPILER) +$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT_0_14_1) +$(LIBSAITHRIFT_DEV)_BUILD_ENV = SAITHRIFTV2=true SAITHRIFT_VER=v2 +else +$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) +$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT) +endif +$(LIBSAITHRIFT_DEV)_DEPENDS += $(BRCM_SAI) $(BRCM_SAI_DEV) +$(LIBSAITHRIFT_DEV)_RDEPENDS += $(BRCM_SAI) SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV) -PYTHON_SAITHRIFT = python-saithrift_$(SAI_VER)_amd64.deb +PYTHON_SAITHRIFT = python-saithrift$(SAITHRIFT_VER)_$(SAI_VER)_amd64.deb $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(PYTHON_SAITHRIFT))) -SAISERVER = saiserver_$(SAI_VER)_amd64.deb -$(SAISERVER)_RDEPENDS += $(LIBTHRIFT) $(BRCM_SAI) +SAISERVER = saiserver$(SAITHRIFT_VER)_$(SAI_VER)_amd64.deb +$(SAISERVER)_RDEPENDS += $(LIBSAITHRIFT_DEV) $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER))) -SAISERVER_DBG = saiserver-dbg_$(SAI_VER)_amd64.deb +SAISERVER_DBG = saiserver$(SAITHRIFT_VER)-dbg_$(SAI_VER)_amd64.deb $(SAISERVER_DBG)_RDEPENDS += $(SAISERVER) $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER_DBG))) diff --git a/platform/broadcom/one-aboot.mk b/platform/broadcom/one-aboot.mk index f69b3030abde..d8e502ea9828 100644 --- a/platform/broadcom/one-aboot.mk +++ b/platform/broadcom/one-aboot.mk @@ -4,11 +4,14 @@ SONIC_ONE_ABOOT_IMAGE = sonic-aboot-broadcom.swi $(SONIC_ONE_ABOOT_IMAGE)_MACHINE = broadcom $(SONIC_ONE_ABOOT_IMAGE)_DEPENDENT_MACHINE = broadcom-dnx $(SONIC_ONE_ABOOT_IMAGE)_IMAGE_TYPE = aboot -$(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(ARISTA_PLATFORM_MODULE_DRIVERS) $(ARISTA_PLATFORM_MODULE_PYTHON2) $(ARISTA_PLATFORM_MODULE_PYTHON3) $(ARISTA_PLATFORM_MODULE) $(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(PHY_CREDO) $(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(FLASHROM) $(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR) $(SONIC_ONE_ABOOT_IMAGE)_LAZY_BUILD_INSTALLS = $(BRCM_OPENNSL_KERNEL) $(BRCM_DNX_OPENNSL_KERNEL) +$(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(ARISTA_PLATFORM_MODULE_PYTHON3) \ + $(ARISTA_PLATFORM_MODULE_DRIVERS) \ + $(ARISTA_PLATFORM_MODULE_LIBS) \ + $(ARISTA_PLATFORM_MODULE) ifeq ($(INSTALL_DEBUG_TOOLS),y) $(SONIC_ONE_ABOOT_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_DBG_IMAGES) $(SONIC_ONE_ABOOT_IMAGE)_DOCKERS += $(filter-out $(patsubst %-$(DBG_IMAGE_MARK).gz,%.gz, $(SONIC_INSTALL_DOCKER_DBG_IMAGES)), $(SONIC_INSTALL_DOCKER_IMAGES)) diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index aeb3e8dc9cfd..4405070460ad 100644 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -9,6 +9,7 @@ $(SONIC_ONE_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR) $(SONIC_ONE_IMAGE)_INSTALLS += $(FLASHROM) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(DELL_Z9264F_PLATFORM_MODULE) \ + $(DELL_S5212F_PLATFORM_MODULE) \ $(DELL_S5224F_PLATFORM_MODULE) \ $(DELL_S5232F_PLATFORM_MODULE) \ $(DELL_S5248F_PLATFORM_MODULE) \ @@ -65,6 +66,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(MITAC_LY1200_32X_PLATFORM_MODULE) \ $(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE) \ $(ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE) \ + $(ALPHANETWORKS_SNJ60D0_320F_PLATFORM_MODULE) \ $(BRCM_XLR_GTS_PLATFORM_MODULE) \ $(DELTA_AG9032V2A_PLATFORM_MODULE) \ $(JUNIPER_QFX5210_PLATFORM_MODULE) \ @@ -74,6 +76,8 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(RUIJIE_B6510_48VS8CQ_PLATFORM_MODULE) \ $(RAGILE_RA_B6510_48V8C_PLATFORM_MODULE) \ $(RAGILE_RA_B6910_64C_PLATFORM_MODULE) \ + $(RAGILE_RA_B6510_32C_PLATFORM_MODULE) \ + $(RAGILE_RA_B6920_4S_PLATFORM_MODULE) \ $(NOKIA_IXR7250_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_BUILD_INSTALLS = $(BRCM_OPENNSL_KERNEL) $(BRCM_DNX_OPENNSL_KERNEL) ifeq ($(INSTALL_DEBUG_TOOLS),y) diff --git a/platform/broadcom/platform-modules-alphanetworks.mk b/platform/broadcom/platform-modules-alphanetworks.mk index 13e5fc4ff9e2..cdfd4683723e 100644 --- a/platform/broadcom/platform-modules-alphanetworks.mk +++ b/platform/broadcom/platform-modules-alphanetworks.mk @@ -2,9 +2,11 @@ ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE_VERSION = 1.0 ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE_VERSION = 1.0 +ALPHANETWORKS_SNJ60D0_320F_PLATFORM_MODULE_VERSION = 1.0 export ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE_VERSION export ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE_VERSION +export ALPHANETWORKS_SNJ60D0_320F_PLATFORM_MODULE_VERSION ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE = sonic-platform-alphanetworks-snh60a0-320fv2_$(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE_VERSION)_amd64.deb $(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-alphanetworks @@ -16,5 +18,8 @@ ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE = sonic-platform-alphanetworks-snh60b $(ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE)_PLATFORM = x86_64-alphanetworks_snh60b0_640f-r0 $(eval $(call add_extra_package,$(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE),$(ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE))) +ALPHANETWORKS_SNJ60D0_320F_PLATFORM_MODULE = sonic-platform-alphanetworks-snj60d0-320f_$(ALPHANETWORKS_SNJ60D0_320F_PLATFORM_MODULE_VERSION)_amd64.deb +$(ALPHANETWORKS_SNJ60D0_320F_PLATFORM_MODULE)_PLATFORM = x86_64-alphanetworks_snj60d0_320f-r0 +$(eval $(call add_extra_package,$(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE),$(ALPHANETWORKS_SNJ60D0_320F_PLATFORM_MODULE))) diff --git a/platform/broadcom/platform-modules-arista.mk b/platform/broadcom/platform-modules-arista.mk index ac2c65fdf3c5..3049e946736e 100644 --- a/platform/broadcom/platform-modules-arista.mk +++ b/platform/broadcom/platform-modules-arista.mk @@ -9,16 +9,16 @@ $(ARISTA_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-ari $(ARISTA_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) SONIC_DPKG_DEBS += $(ARISTA_PLATFORM_MODULE) -ARISTA_PLATFORM_MODULE_PYTHON2 = python-sonic-platform-arista_$(ARISTA_PLATFORM_MODULE_VERSION)_all.deb -$(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODULE_PYTHON2))) - ARISTA_PLATFORM_MODULE_PYTHON3 = python3-sonic-platform-arista_$(ARISTA_PLATFORM_MODULE_VERSION)_all.deb $(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODULE_PYTHON3))) ARISTA_PLATFORM_MODULE_DRIVERS = drivers-sonic-platform-arista_$(ARISTA_PLATFORM_MODULE_VERSION)_amd64.deb $(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODULE_DRIVERS))) -export ARISTA_PLATFORM_MODULE ARISTA_PLATFORM_MODULE_PYTHON2 ARISTA_PLATFORM_MODULE_PYTHON3 ARISTA_PLATFORM_MODULE_DRIVERS - -export ARISTA_SCD_DRIVER_CONFIG=m +ARISTA_PLATFORM_MODULE_LIBS = sonic-platform-arista-libs_$(ARISTA_PLATFORM_MODULE_VERSION)_amd64.deb +$(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODULE_LIBS))) +export ARISTA_PLATFORM_MODULE \ + ARISTA_PLATFORM_MODULE_PYTHON3 \ + ARISTA_PLATFORM_MODULE_DRIVERS \ + ARISTA_PLATFORM_MODULE_LIBS diff --git a/platform/broadcom/platform-modules-dell.mk b/platform/broadcom/platform-modules-dell.mk index 8348bad14301..3f17b16fbc53 100644 --- a/platform/broadcom/platform-modules-dell.mk +++ b/platform/broadcom/platform-modules-dell.mk @@ -4,6 +4,7 @@ DELL_S6000_PLATFORM_MODULE_VERSION = 1.1 DELL_Z9100_PLATFORM_MODULE_VERSION = 1.1 DELL_S6100_PLATFORM_MODULE_VERSION = 1.1 DELL_Z9264F_PLATFORM_MODULE_VERSION = 1.1 +DELL_S5212F_PLATFORM_MODULE_VERSION = 1.1 DELL_S5224F_PLATFORM_MODULE_VERSION = 1.1 DELL_S5232F_PLATFORM_MODULE_VERSION = 1.1 DELL_Z9332F_PLATFORM_MODULE_VERSION = 1.1 @@ -16,6 +17,7 @@ export DELL_S6000_PLATFORM_MODULE_VERSION export DELL_Z9100_PLATFORM_MODULE_VERSION export DELL_S6100_PLATFORM_MODULE_VERSION export DELL_Z9264F_PLATFORM_MODULE_VERSION +export DELL_S5212F_PLATFORM_MODULE_VERSION export DELL_S5224F_PLATFORM_MODULE_VERSION export DELL_S5232F_PLATFORM_MODULE_VERSION export DELL_Z9332F_PLATFORM_MODULE_VERSION @@ -43,6 +45,10 @@ DELL_S6000_PLATFORM_MODULE = platform-modules-s6000_$(DELL_S6000_PLATFORM_MODULE $(DELL_S6000_PLATFORM_MODULE)_PLATFORM = x86_64-dell_s6000_s1220-r0 $(eval $(call add_extra_package,$(DELL_Z9100_PLATFORM_MODULE),$(DELL_S6000_PLATFORM_MODULE))) +DELL_S5212F_PLATFORM_MODULE = platform-modules-s5212f_$(DELL_S5212F_PLATFORM_MODULE_VERSION)_amd64.deb +$(DELL_S5212F_PLATFORM_MODULE)_PLATFORM = x86_64-dellemc_s5212f_c3538-r0 +$(eval $(call add_extra_package,$(DELL_Z9100_PLATFORM_MODULE),$(DELL_S5212F_PLATFORM_MODULE))) + DELL_S5224F_PLATFORM_MODULE = platform-modules-s5224f_$(DELL_S5224F_PLATFORM_MODULE_VERSION)_amd64.deb $(DELL_S5224F_PLATFORM_MODULE)_PLATFORM = x86_64-dellemc_s5224f_c3538-r0 $(eval $(call add_extra_package,$(DELL_Z9100_PLATFORM_MODULE),$(DELL_S5224F_PLATFORM_MODULE))) diff --git a/platform/broadcom/platform-modules-ragile.mk b/platform/broadcom/platform-modules-ragile.mk index d13b57440740..74ce1b04f475 100644 --- a/platform/broadcom/platform-modules-ragile.mk +++ b/platform/broadcom/platform-modules-ragile.mk @@ -17,3 +17,18 @@ RAGILE_RA_B6910_64C_PLATFORM_MODULE = platform-modules-ragile-ra-b6910-64c_$(RAG $(RAGILE_RA_B6910_64C_PLATFORM_MODULE)_PLATFORM = x86_64-ragile_ra-b6910-64c-r0 $(eval $(call add_extra_package,$(RAGILE_RA_B6510_48V8C_PLATFORM_MODULE),$(RAGILE_RA_B6910_64C_PLATFORM_MODULE))) +## RA-B6510-32C +RAGILE_RA_B6510_32C_PLATFORM_MODULE_VERSION = 1.0 +export RAGILE_RA_B6510_32C_PLATFORM_MODULE_VERSION + +RAGILE_RA_B6510_32C_PLATFORM_MODULE = platform-modules-ragile-ra-b6510-32c_$(RAGILE_RA_B6510_32C_PLATFORM_MODULE_VERSION)_amd64.deb +$(RAGILE_RA_B6510_32C_PLATFORM_MODULE)_PLATFORM = x86_64-ragile_ra-b6510-32c-r0 +$(eval $(call add_extra_package,$(RAGILE_RA_B6510_48V8C_PLATFORM_MODULE),$(RAGILE_RA_B6510_32C_PLATFORM_MODULE))) + +## RA-B6920-4s +RAGILE_RA_B6920_4S_PLATFORM_MODULE_VERSION = 1.0 +export RAGILE_RA_B6920_4S_PLATFORM_MODULE_VERSION + +RAGILE_RA_B6920_4S_PLATFORM_MODULE = platform-modules-ragile-ra-b6920-4s_$(RAGILE_RA_B6920_4S_PLATFORM_MODULE_VERSION)_amd64.deb +$(RAGILE_RA_B6920_4S_PLATFORM_MODULE)_PLATFORM = x86_64-ragile_ra-b6920-4s-r0 +$(eval $(call add_extra_package,$(RAGILE_RA_B6510_48V8C_PLATFORM_MODULE),$(RAGILE_RA_B6920_4S_PLATFORM_MODULE))) diff --git a/platform/broadcom/rules.mk b/platform/broadcom/rules.mk index e890c43e5c5a..5f3172ca0305 100644 --- a/platform/broadcom/rules.mk +++ b/platform/broadcom/rules.mk @@ -3,18 +3,18 @@ include $(PLATFORM_PATH)/sai.mk include $(PLATFORM_PATH)/platform-modules-nokia.mk include $(PLATFORM_PATH)/platform-modules-dell.mk include $(PLATFORM_PATH)/platform-modules-arista.mk -include $(PLATFORM_PATH)/platform-modules-ingrasys.mk +#include $(PLATFORM_PATH)/platform-modules-ingrasys.mk include $(PLATFORM_PATH)/platform-modules-accton.mk -include $(PLATFORM_PATH)/platform-modules-alphanetworks.mk -include $(PLATFORM_PATH)/platform-modules-inventec.mk +#include $(PLATFORM_PATH)/platform-modules-alphanetworks.mk +#include $(PLATFORM_PATH)/platform-modules-inventec.mk include $(PLATFORM_PATH)/platform-modules-cel.mk -include $(PLATFORM_PATH)/platform-modules-delta.mk -include $(PLATFORM_PATH)/platform-modules-quanta.mk -#include $(PLATFORM_PATH)/platform-modules-mitac.mk +#include $(PLATFORM_PATH)/platform-modules-delta.mk +#include $(PLATFORM_PATH)/platform-modules-quanta.mk +##include $(PLATFORM_PATH)/platform-modules-mitac.mk include $(PLATFORM_PATH)/platform-modules-juniper.mk -include $(PLATFORM_PATH)/platform-modules-brcm-xlr-gts.mk -include $(PLATFORM_PATH)/platform-modules-ruijie.mk -include $(PLATFORM_PATH)/platform-modules-ragile.mk +#include $(PLATFORM_PATH)/platform-modules-brcm-xlr-gts.mk +#include $(PLATFORM_PATH)/platform-modules-ruijie.mk +#include $(PLATFORM_PATH)/platform-modules-ragile.mk include $(PLATFORM_PATH)/docker-syncd-brcm.mk include $(PLATFORM_PATH)/docker-syncd-brcm-rpc.mk include $(PLATFORM_PATH)/docker-saiserver-brcm.mk diff --git a/platform/broadcom/sai-modules.mk b/platform/broadcom/sai-modules.mk index cb33b9b46ffe..1236e06d6240 100644 --- a/platform/broadcom/sai-modules.mk +++ b/platform/broadcom/sai-modules.mk @@ -1,6 +1,6 @@ # Broadcom SAI modules -BRCM_OPENNSL_KERNEL_VERSION = 5.0.0.4 +BRCM_OPENNSL_KERNEL_VERSION = 6.1.0.3 BRCM_OPENNSL_KERNEL = opennsl-modules_$(BRCM_OPENNSL_KERNEL_VERSION)_amd64.deb $(BRCM_OPENNSL_KERNEL)_SRC_PATH = $(PLATFORM_PATH)/saibcm-modules @@ -10,7 +10,7 @@ $(BRCM_OPENNSL_KERNEL)_MACHINE = broadcom SONIC_DPKG_DEBS += $(BRCM_OPENNSL_KERNEL) # SAI bcm modules for DNX family ASIC -BRCM_DNX_OPENNSL_KERNEL_VERSION = 5.0.0.4 +BRCM_DNX_OPENNSL_KERNEL_VERSION = 6.1.0.3 BRCM_DNX_OPENNSL_KERNEL = opennsl-modules-dnx_$(BRCM_DNX_OPENNSL_KERNEL_VERSION)_amd64.deb $(BRCM_DNX_OPENNSL_KERNEL)_SRC_PATH = $(PLATFORM_PATH)/saibcm-modules-dnx diff --git a/platform/broadcom/sai.mk b/platform/broadcom/sai.mk index e8d7ed2cb5e3..1ec8d915e5bd 100644 --- a/platform/broadcom/sai.mk +++ b/platform/broadcom/sai.mk @@ -1,12 +1,16 @@ -BRCM_SAI = libsaibcm_5.0.0.8_amd64.deb -$(BRCM_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/5.0/master/libsaibcm_5.0.0.8_amd64.deb?sv=2015-04-05&sr=b&sig=T%2FPesnOIeN9802mClMpgk8XFQbqjFAgCnJbbNHxijHo%3D&se=2035-05-13T21%3A34%3A26Z&sp=r" -BRCM_SAI_DEV = libsaibcm-dev_5.0.0.8_amd64.deb +LIBSAIBCM_VERSION = 6.1.0.3 +LIBSAIBCM_BRANCH_NAME = REL_6.1 +LIBSAIBCM_URL_PREFIX = "https://sonicstorage.blob.core.windows.net/public/sai/bcmsai/$(LIBSAIBCM_BRANCH_NAME)/$(LIBSAIBCM_VERSION)" + +BRCM_SAI = libsaibcm_$(LIBSAIBCM_VERSION)_amd64.deb +$(BRCM_SAI)_URL = "$(LIBSAIBCM_URL_PREFIX)/$(BRCM_SAI)" +BRCM_SAI_DEV = libsaibcm-dev_$(LIBSAIBCM_VERSION)_amd64.deb $(eval $(call add_derived_package,$(BRCM_SAI),$(BRCM_SAI_DEV))) -$(BRCM_SAI_DEV)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/5.0/master/libsaibcm-dev_5.0.0.8_amd64.deb?sv=2015-04-05&sr=b&sig=X33hZLhRI3L6f4a5JFSlhJvoaTj%2B3zrmNBM9IzIA%2Bj4%3D&se=2035-05-13T21%3A35%3A58Z&sp=r" +$(BRCM_SAI_DEV)_URL = "$(LIBSAIBCM_URL_PREFIX)/$(BRCM_SAI_DEV)" # SAI module for DNX Asic family -BRCM_DNX_SAI = libsaibcm_dnx_5.0.0.8_amd64.deb -$(BRCM_DNX_SAI)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmsai/5.0/master/libsaibcm_dnx_5.0.0.8_amd64.deb?sv=2015-04-05&sr=b&sig=uy0OW6ZhWjYntalZunEIIzHUztkOyI7TS3F73Sla9vY%3D&se=2035-05-13T21%3A37%3A06Z&sp=r" +BRCM_DNX_SAI = libsaibcm_dnx_$(LIBSAIBCM_VERSION)_amd64.deb +$(BRCM_DNX_SAI)_URL = "$(LIBSAIBCM_URL_PREFIX)/$(BRCM_DNX_SAI)" SONIC_ONLINE_DEBS += $(BRCM_SAI) SONIC_ONLINE_DEBS += $(BRCM_DNX_SAI) diff --git a/platform/broadcom/saibcm-modules-dnx b/platform/broadcom/saibcm-modules-dnx index 70d0ce29b1cf..6bf58f8310bc 160000 --- a/platform/broadcom/saibcm-modules-dnx +++ b/platform/broadcom/saibcm-modules-dnx @@ -1 +1 @@ -Subproject commit 70d0ce29b1cffce381b55e263649a18e9219f13b +Subproject commit 6bf58f8310bcb29168ae5b2dabed84fc942429fc diff --git a/platform/broadcom/saibcm-modules/debian/changelog b/platform/broadcom/saibcm-modules/debian/changelog index 58468e30e799..0ff357c57279 100644 --- a/platform/broadcom/saibcm-modules/debian/changelog +++ b/platform/broadcom/saibcm-modules/debian/changelog @@ -1,3 +1,21 @@ +opennsl (6.1.0.3) unstable; urgency=medium + + * Update to Broadcom SAI 6.1.0.3 + + -- Tejaswini Chadaga Fri, 24 MAR 2022 12:30:00 +0000 + +opennsl (6.0.0.13) unstable; urgency=medium + + * Update to Broadcom SAI 6.0.0.13 + + -- Judy Joseph Fri, 14 Jan 2022 18:36:38 +0000 + +opennsl (6.0.0.10) unstable; urgency=medium + + * Update to Broadcom SAI 6.0.0.10 + + -- Vineet Mittal Fri, 21 Oct 2021 18:36:38 +0000 + opennsl (5.0.0.4) unstable; urgency=medium * Update to Broadcom SAI 5.0.0.4 diff --git a/platform/broadcom/saibcm-modules/debian/control b/platform/broadcom/saibcm-modules/debian/control index 60bcbafb1b1a..37cf1213432e 100644 --- a/platform/broadcom/saibcm-modules/debian/control +++ b/platform/broadcom/saibcm-modules/debian/control @@ -10,5 +10,5 @@ Standards-Version: 3.9.3 Package: opennsl-modules Architecture: amd64 Section: main -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for broadcom SAI diff --git a/platform/broadcom/saibcm-modules/debian/opennsl-modules.dirs b/platform/broadcom/saibcm-modules/debian/opennsl-modules.dirs index 140d1186059e..2b3124646272 100644 --- a/platform/broadcom/saibcm-modules/debian/opennsl-modules.dirs +++ b/platform/broadcom/saibcm-modules/debian/opennsl-modules.dirs @@ -1 +1 @@ -lib/modules/4.19.0-12-2-amd64/extra +lib/modules/5.10.0-8-2-amd64/extra diff --git a/platform/broadcom/saibcm-modules/debian/opennsl-modules.install b/platform/broadcom/saibcm-modules/debian/opennsl-modules.install index 5e8e70bb189f..59bf020cb22c 100644 --- a/platform/broadcom/saibcm-modules/debian/opennsl-modules.install +++ b/platform/broadcom/saibcm-modules/debian/opennsl-modules.install @@ -1,8 +1,6 @@ -systems/linux/user/x86-smp_generic_64-2_6/linux-bcm-knet.ko lib/modules/4.19.0-12-2-amd64/extra -systems/linux/user/x86-smp_generic_64-2_6/linux-kernel-bde.ko lib/modules/4.19.0-12-2-amd64/extra -systems/linux/user/x86-smp_generic_64-2_6/linux-user-bde.ko lib/modules/4.19.0-12-2-amd64/extra -systems/linux/user/x86-smp_generic_64-2_6/linux-knet-cb.ko lib/modules/4.19.0-12-2-amd64/extra -systems/linux/user/x86-smp_generic_64-2_6/psample.ko lib/modules/4.19.0-12-2-amd64/extra -systems/linux/user/x86-smp_generic_64-2_6/linux-bcm-ptp-clock.ko lib/modules/4.19.0-12-2-amd64/extra +systems/linux/user/x86-smp_generic_64-2_6/linux-bcm-knet.ko lib/modules/5.10.0-8-2-amd64/extra +systems/linux/user/x86-smp_generic_64-2_6/linux-kernel-bde.ko lib/modules/5.10.0-8-2-amd64/extra +systems/linux/user/x86-smp_generic_64-2_6/linux-user-bde.ko lib/modules/5.10.0-8-2-amd64/extra +systems/linux/user/x86-smp_generic_64-2_6/linux-knet-cb.ko lib/modules/5.10.0-8-2-amd64/extra systemd/opennsl-modules.service lib/systemd/system -sdklt/linux/bde/linux_ngbde.ko lib/modules/4.19.0-12-2-amd64/extra +sdklt/linux/bde/linux_ngbde.ko lib/modules/5.10.0-8-2-amd64/extra diff --git a/platform/broadcom/saibcm-modules/debian/rules b/platform/broadcom/saibcm-modules/debian/rules index 509901745e97..b092d3d0c635 100755 --- a/platform/broadcom/saibcm-modules/debian/rules +++ b/platform/broadcom/saibcm-modules/debian/rules @@ -34,8 +34,8 @@ sname:=opennsl PACKAGE=opennsl-modules # modifieable for experiments or debugging m-a MA_DIR ?= /usr/share/modass -KVERSION ?= 4.19.0-12-2-amd64 -KERNVERSION ?= 4.19.0-12-2 +KVERSION ?= 5.10.0-8-2-amd64 +KERNVERSION ?= 5.10.0-8-2 # load generic variable handling -include $(MA_DIR)/include/generic.make @@ -63,11 +63,11 @@ kdist_config: prep-deb-files kdist_clean: clean dh_testdir dh_clean - SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 BUILD_PSAMPLE=1 \ + SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 \ KERNDIR=/usr/src/linux-headers-$(KERNVERSION)-common \ KERNEL_SRC=/usr/src/linux-headers-$(KERNVERSION)-amd64 \ $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean - SDK=$(realpath .) BUILD_KNET_CB=1 BUILD_PSAMPLE=1 \ + SDK=$(realpath .) BUILD_KNET_CB=1 \ KDIR=/usr/src/linux-headers-$(KERNVERSION)-common \ $(MAKE) -C sdklt/ clean # rm -f driver/*.o driver/*.ko @@ -94,16 +94,17 @@ build-arch-stamp: cd /; sudo ln -s /usr/src/linux-headers-$(KERNVERSION)-amd64/ /lib/modules/$(KERNVERSION)-amd64/build cd /; sudo ln -s /usr/src/linux-headers-$(KERNVERSION)-amd64/include/generated/ /usr/src/linux-headers-$(KERNVERSION)-common/include/generated cd /; sudo ln -s /usr/src/linux-headers-$(KERNVERSION)-amd64/arch/x86/include/generated/ /usr/src/linux-headers-$(KERNVERSION)-common/arch/x86/include/generated + cd /; sudo ln -s /usr/src/linux-headers-$(KERNVERSION)-amd64/arch/x86/module.lds /usr/src/linux-headers-$(KERNVERSION)-common/arch/x86/module.lds cd /; sudo ln -s /usr/src/linux-headers-$(KERNVERSION)-amd64/include/config/ /usr/src/linux-headers-$(KERNVERSION)-common/include/config cd /; sudo cp /usr/src/linux-headers-$(KERNVERSION)-amd64/Module.symvers /usr/src/linux-headers-$(KERNVERSION)-common/Module.symvers # Add here command to compile/build the package. - SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 BUILD_PSAMPLE=1 \ + SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 \ KERNDIR=/usr/src/linux-headers-$(KERNVERSION)-common \ KERNEL_SRC=/usr/src/linux-headers-$(KERNVERSION)-amd64 \ $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 - SDK=$(realpath .) BUILD_KNET_CB=1 BUILD_PSAMPLE=1 \ + SDK=$(realpath .) BUILD_KNET_CB=1 \ KDIR=/usr/src/linux-headers-$(KERNVERSION)-common \ $(MAKE) -C sdklt/ kmod @@ -130,12 +131,12 @@ clean: rm -f build-arch-stamp build-indep-stamp configure-stamp # Add here commands to clean up after the build process. - SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 BUILD_PSAMPLE=1 \ + SDK=$(realpath .) LINUX_UAPI_SPLIT=1 DEBIAN_LINUX_HEADER=1 BUILD_KNET_CB=1 \ KERNDIR=/usr/src/linux-headers-$(KERNVERSION)-common \ KERNEL_SRC=/usr/src/linux-headers-$(KERNVERSION)-amd64 \ $(MAKE) -C systems/linux/user/x86-smp_generic_64-2_6 clean - SDK=$(realpath .) BUILD_KNET_CB=1 BUILD_PSAMPLE=1 \ + SDK=$(realpath .) BUILD_KNET_CB=1 \ KDIR=/usr/src/linux-headers-$(KERNVERSION)-common \ $(MAKE) -C sdklt/ clean diff --git a/platform/broadcom/saibcm-modules/include/ibde.h b/platform/broadcom/saibcm-modules/include/ibde.h index fb9d13d1d5fe..d71d487f03e5 100644 --- a/platform/broadcom/saibcm-modules/include/ibde.h +++ b/platform/broadcom/saibcm-modules/include/ibde.h @@ -87,6 +87,8 @@ typedef struct ibde_s { #define BDE_I2C_DEV_TYPE SAL_I2C_DEV_TYPE /* I2C device */ #define BDE_AXI_DEV_TYPE SAL_AXI_DEV_TYPE /* AXI device */ #define BDE_EMMI_DEV_TYPE SAL_EMMI_DEV_TYPE /* EMMI device */ +#define BDE_COMPOSITE_DEV_TYPE SAL_COMPOSITE_DEV_TYPE /* Composite device, composed of sub-devices with buses */ +#define BDE_USER_DEV_TYPE SAL_USER_DEV_TYPE /* The user implements his own method of access to the device */ #define BDE_DEV_BUS_ALT SAL_DEV_BUS_ALT /* Alternate Access */ #define BDE_DEV_BUS_MSI SAL_DEV_BUS_MSI /* Message-signaled interrupts */ @@ -104,6 +106,7 @@ typedef struct ibde_s { #define BDE_128K_REG_SPACE 0x40000000 /* Map 128K (v 64K) */ #define BDE_320K_REG_SPACE 0x80000000 /* Map 256K+64K */ + /* Bus supports only 16bit reads */ #define BDE_DEV_BUS_RD_16BIT SAL_DEV_BUS_RD_16BIT @@ -179,6 +182,10 @@ typedef struct ibde_s { uint32 addr, /* The address to access in the internal device address space */ uint32 value); /* the value to be written. */ + /* 64 bit read/write */ + uint64 (*read64)(int d, uint32 addr); + void (*write64)(int d, uint32 addr, uint64 data); + } ibde_t; diff --git a/platform/broadcom/saibcm-modules/include/kcom.h b/platform/broadcom/saibcm-modules/include/kcom.h index 5129400ca8cd..4771033c6b04 100644 --- a/platform/broadcom/saibcm-modules/include/kcom.h +++ b/platform/broadcom/saibcm-modules/include/kcom.h @@ -58,6 +58,7 @@ #define KCOM_M_ETH_HW_CONFIG 5 /* ETH HW config*/ #define KCOM_M_DETACH 6 /* Detach kernel module */ #define KCOM_M_REPROBE 7 /* Reprobe device */ +#define KCOM_M_HW_INFO 8 /* Send the HW info to kernel module */ #define KCOM_M_NETIF_CREATE 11 /* Create network interface */ #define KCOM_M_NETIF_DESTROY 12 /* Destroy network interface */ #define KCOM_M_NETIF_LIST 13 /* Get list of network interface IDs */ @@ -72,7 +73,7 @@ #define KCOM_M_WB_CLEANUP 51 /* Clean up for warmbooting */ #define KCOM_M_CLOCK_CMD 52 /* Clock Commands */ -#define KCOM_VERSION 12 /* Protocol version */ +#define KCOM_VERSION 13 /* Protocol version */ /* * Message status codes @@ -299,7 +300,7 @@ typedef struct kcom_dma_info_s { void *p; uint8 b[8]; } cookie; - } kcom_dma_info_t; +} kcom_dma_info_t; /* Default channel configuration */ #define KCOM_DMA_TX_CHAN 0 @@ -331,6 +332,18 @@ typedef struct kcom_eth_hw_config_s { uint32 value; } kcom_eth_hw_config_t; +#ifndef KCOM_HW_INFO_OAMP_PORT_MAX +#define KCOM_HW_INFO_OAMP_PORT_MAX 4 +#endif + +/* + * Send the OAMP information to Kernel module. + */ +typedef struct kcom_oamp_info_s { + uint32 oamp_port_number; + uint32 oamp_ports[KCOM_HW_INFO_OAMP_PORT_MAX]; +} kcom_oamp_info_t; + /* * Message types */ @@ -421,6 +434,11 @@ typedef struct kcom_msg_hw_init_s { uint8 no_skip_udh_check; uint8 system_headers_mode; uint8 udh_enable; + /* + * Bitmap of DMA channels reserved for the user mode network driver. + * These channels cannot be used by the kernel network driver (KNET). + */ + uint32 unet_channels; } kcom_msg_hw_init_t; /* @@ -554,6 +572,14 @@ typedef struct kcom_msg_dma_info_s { kcom_dma_info_t dma_info; } kcom_msg_dma_info_t; +/* + * HW info + */ +typedef struct kcom_msg_hw_info_s { + kcom_msg_hdr_t hdr; + kcom_oamp_info_t oamp_info; +} kcom_msg_hw_info_t; + /* * All messages (e.g. for generic receive) */ @@ -564,6 +590,7 @@ typedef union kcom_msg_s { kcom_msg_hw_reset_t hw_reset; kcom_msg_hw_init_t hw_init; kcom_msg_eth_hw_config_t eth_hw_config; + kcom_msg_hw_info_t hw_info; kcom_msg_detach_t detach; kcom_msg_reprobe_t reprobe; kcom_msg_netif_create_t netif_create; diff --git a/platform/broadcom/saibcm-modules/include/soc/devids.h b/platform/broadcom/saibcm-modules/include/soc/devids.h index 89fabac44537..8a67d385d930 100644 --- a/platform/broadcom/saibcm-modules/include/soc/devids.h +++ b/platform/broadcom/saibcm-modules/include/soc/devids.h @@ -25,7 +25,7 @@ * https://www.broadcom.com/products/ethernet-connectivity/software/opennsa */ /* - * Copyright: (c) 2020 Broadcom. + * Copyright: (c) 2021 Broadcom. * All Rights Reserved. */ @@ -846,13 +846,6 @@ #define BCM56746_A0_REV_ID 1 #define BCM56746_A1_REV_ID 2 -#define BCM88732_DEVICE_ID 0x0732 -#define BCM88732_A0_REV_ID 1 -#define BCM88732_A1_REV_ID 2 -#define BCM88732_A2_REV_ID 4 -#define BCM88732_B0_REV_ID 0x11 -#define BCM88732_B1_REV_ID 0x12 -#define BCM88732_B2_REV_ID 0x13 #define BCM56640_DEVICE_ID 0xb640 #define BCM56640_A0_REV_ID 1 @@ -1526,6 +1519,8 @@ #define BCM56472_A0_REV_ID 1 #define BCM56475_DEVICE_ID 0xb475 #define BCM56475_A0_REV_ID 1 +#define BCM56474_DEVICE_ID 0xb474 +#define BCM56474_A0_REV_ID 1 #define BCM53540_DEVICE_ID 0x8540 @@ -1560,10 +1555,6 @@ #define ARAD_A0_REV_ID 0x0000 #define ARAD_B0_REV_ID 0x0011 #define ARAD_B1_REV_ID 0x0012 -#define BCM88650_DEVICE_ID ARAD_DEVICE_ID -#define BCM88650_A0_REV_ID ARAD_A0_REV_ID -#define BCM88650_B0_REV_ID ARAD_B0_REV_ID -#define BCM88650_B1_REV_ID ARAD_B1_REV_ID #define BCM88770_DEVICE_ID 0x8770 #define BCM88770_A1_REV_ID 0x0002 #define BCM88773_DEVICE_ID 0x8773 @@ -1814,8 +1805,10 @@ #define J2P_DEVICE_ID 0x8850 #define J2P_A0_REV_ID DNXC_A0_REV_ID +#define J2P_A1_REV_ID DNXC_A1_REV_ID #define BCM88850_DEVICE_ID J2P_DEVICE_ID #define BCM88850_A0_REV_ID J2P_A0_REV_ID +#define BCM88850_A1_REV_ID J2P_A1_REV_ID #define BCM88851_DEVICE_ID 0x8851 #define BCM88852_DEVICE_ID 0x8852 #define BCM88853_DEVICE_ID 0x8853 @@ -1832,6 +1825,39 @@ #define BCM8885E_DEVICE_ID 0x885E #define BCM8885F_DEVICE_ID 0x885F +#define BCM88840_DEVICE_ID 0x8840 +#define BCM88841_DEVICE_ID 0x8841 +#define BCM88842_DEVICE_ID 0x8842 +#define BCM88843_DEVICE_ID 0x8843 +#define BCM88844_DEVICE_ID 0x8844 +#define BCM88845_DEVICE_ID 0x8845 +#define BCM88846_DEVICE_ID 0x8846 +#define BCM88847_DEVICE_ID 0x8847 +#define BCM88848_DEVICE_ID 0x8848 +#define BCM88849_DEVICE_ID 0x8849 +#define BCM8884A_DEVICE_ID 0x884A +#define BCM8884B_DEVICE_ID 0x884B +#define BCM8884C_DEVICE_ID 0x884C +#define BCM8884D_DEVICE_ID 0x884D +#define BCM8884E_DEVICE_ID 0x884E +#define BCM8884F_DEVICE_ID 0x884F + +#define BCM88831_DEVICE_ID 0x8831 +#define BCM88832_DEVICE_ID 0x8832 +#define BCM88833_DEVICE_ID 0x8833 +#define BCM88834_DEVICE_ID 0x8834 +#define BCM88835_DEVICE_ID 0x8835 +#define BCM88836_DEVICE_ID 0x8836 +#define BCM88837_DEVICE_ID 0x8837 +#define BCM88838_DEVICE_ID 0x8838 +#define BCM88839_DEVICE_ID 0x8839 +#define BCM8883A_DEVICE_ID 0x883A +#define BCM8883B_DEVICE_ID 0x883B +#define BCM8883C_DEVICE_ID 0x883C +#define BCM8883D_DEVICE_ID 0x883D +#define BCM8883E_DEVICE_ID 0x883E +#define BCM8883F_DEVICE_ID 0x883F + #define Q2A_DEVICE_ID 0x8480 #define Q2A_A0_REV_ID DNXC_A0_REV_ID @@ -1875,6 +1901,24 @@ #define BCM8828E_DEVICE_ID 0x828E #define BCM8828F_DEVICE_ID 0x828F +#define Q2N_DEVICE_ID 0x8290 +#define BCM88290_DEVICE_ID Q2N_DEVICE_ID +#define BCM88291_DEVICE_ID 0x8291 +#define BCM88292_DEVICE_ID 0x8292 +#define BCM88293_DEVICE_ID 0x8293 +#define BCM88294_DEVICE_ID 0x8294 +#define BCM88295_DEVICE_ID 0x8295 +#define BCM88296_DEVICE_ID 0x8296 +#define BCM88297_DEVICE_ID 0x8297 +#define BCM88298_DEVICE_ID 0x8298 +#define BCM88299_DEVICE_ID 0x8299 +#define BCM8829A_DEVICE_ID 0x829A +#define BCM8829B_DEVICE_ID 0x829B +#define BCM8829C_DEVICE_ID 0x829C +#define BCM8829D_DEVICE_ID 0x829D +#define BCM8829E_DEVICE_ID 0x829E +#define BCM8829F_DEVICE_ID 0x829F + #define QAX_DEVICE_ID 0x8470 #define QAX_A0_REV_ID 0x0001 #define QAX_B0_REV_ID 0x0011 @@ -1887,8 +1931,9 @@ #define BCM88474H_DEVICE_ID 0x847B #define BCM88476_DEVICE_ID 0x8476 #define BCM88477_DEVICE_ID 0x8477 - - + +#define BCM88479_DEVICE_ID 0x8479 + #define BCM88470_A0_REV_ID QAX_A0_REV_ID @@ -1908,11 +1953,6 @@ #define BCM88278_DEVICE_ID 0x8278 #define BCM88279_DEVICE_ID 0x8279 -#define FLAIR_DEVICE_ID 0xF000 -#define FLAIR_A0_REV_ID 0x0001 -#define BCM8206_DEVICE_ID FLAIR_DEVICE_ID -#define BCM8206_A0_REV_ID FLAIR_A0_REV_ID - #define BCM88360_DEVICE_ID 0x8360 #define BCM88360_A0_REV_ID ARADPLUS_A0_REV_ID #define BCM88361_DEVICE_ID 0x8361 @@ -1949,10 +1989,6 @@ #define BCM88551_B1_REV_ID ARAD_B1_REV_ID #define BCM88552_DEVICE_ID 0x8552 #define BCM88552_B1_REV_ID ARAD_B1_REV_ID -#define BCM88651_DEVICE_ID 0x8651 -#define BCM88651_B1_REV_ID ARAD_B1_REV_ID -#define BCM88654_DEVICE_ID 0x8654 -#define BCM88654_B1_REV_ID ARAD_B1_REV_ID #define BCM88772_DEVICE_ID 0x8772 #define BCM88952_DEVICE_ID 0x8952 @@ -1969,7 +2005,6 @@ #define PLX9056_DEVICE_ID 0x9056 -#ifdef BCM_LTSW_SUPPORT #define BCM56880_DEVICE_ID 0xb880 #define BCM56880_A0_REV_ID 0x0001 #define BCM56880_B0_REV_ID 0x0011 @@ -1979,9 +2014,6 @@ #define BCM56883_DEVICE_ID 0xb883 #define BCM56883_A0_REV_ID 0x0001 #define BCM56883_B0_REV_ID 0x0011 -#define BCM56889_DEVICE_ID 0xb889 -#define BCM56889_A0_REV_ID 0x0001 -#define BCM56889_B0_REV_ID 0x0011 #define BCM56780_DEVICE_ID 0xb780 #define BCM56780_A0_REV_ID 0x0001 @@ -1989,8 +2021,12 @@ #define BCM56782_A0_REV_ID 0x0001 #define BCM56784_DEVICE_ID 0xb784 #define BCM56784_A0_REV_ID 0x0001 +#define BCM56785_DEVICE_ID 0xb785 +#define BCM56785_A0_REV_ID 0x0001 #define BCM56786_DEVICE_ID 0xb786 #define BCM56786_A0_REV_ID 0x0001 +#define BCM56787_DEVICE_ID 0xb787 +#define BCM56787_A0_REV_ID 0x0001 #define BCM56788_DEVICE_ID 0xb788 #define BCM56788_A0_REV_ID 0x0001 #define BCM56789_DEVICE_ID 0xb789 @@ -1998,14 +2034,35 @@ #define BCM56990_DEVICE_ID 0xb990 #define BCM56990_A0_REV_ID 0x0001 + +#ifndef BCM56990_DEVICE_ID +#define BCM56990_DEVICE_ID 0xb990 +#define BCM56990_A0_REV_ID 0x0001 +#endif #define BCM56990_B0_REV_ID 0x0011 +#define BCM56991_DEVICE_ID 0xb991 +#define BCM56991_B0_REV_ID 0x0011 #define BCM56992_DEVICE_ID 0xb992 #define BCM56992_B0_REV_ID 0x0011 +#define BCM56995_DEVICE_ID 0xb995 +#define BCM56995_A0_REV_ID 0x0001 + #define BCM56996_DEVICE_ID 0xb996 #define BCM56996_A0_REV_ID 0x0001 #define BCM56997_DEVICE_ID 0xb997 #define BCM56997_A0_REV_ID 0x0001 -#endif + +#ifndef BCM56996_DEVICE_ID +#define BCM56996_DEVICE_ID 0xb996 +#define BCM56996_A0_REV_ID 0x0001 +#define BCM56997_DEVICE_ID 0xb997 +#endif +#define BCM56996_B0_REV_ID 0x0011 +#define BCM56997_B0_REV_ID 0x0011 + +#define BCM56998_DEVICE_ID 0xb998 +#define BCM56998_A0_REV_ID 0x0001 + #endif diff --git a/platform/broadcom/saibcm-modules/make/Make.config b/platform/broadcom/saibcm-modules/make/Make.config index f5b04b0cdf9e..01869634e295 100644 --- a/platform/broadcom/saibcm-modules/make/Make.config +++ b/platform/broadcom/saibcm-modules/make/Make.config @@ -120,7 +120,12 @@ ifndef SDKBUILD SDKBUILD :=build endif +ifdef SDK_OUTDIR +BLDROOT = ${SDK_OUTDIR}/${SDKBUILD}/$(if ${BLDCONFIG},${BLDCONFIG}/)${target}${all_suffix}${bldroot_suffix} +export DEST_DIR := ${SDK_OUTDIR}/${SDKBUILD}$(if ${BLDCONFIG},/${BLDCONFIG})$(DEST_DIR_SUFFIX) +else BLDROOT = ${SDK}/${SDKBUILD}/$(if ${BLDCONFIG},${BLDCONFIG}/)${target}${all_suffix}${bldroot_suffix} +endif endif # ifeq "$(HOSTTYPE)" "Windows2000PC" @@ -171,7 +176,6 @@ INCFLAGS = -I${INCDIR} -I${SDK}/systems CFLAGS += ${INCFLAGS} CXXFLAGS += ${INCFLAGS} CPPFLAGS += ${INCFLAGS} - CFLAGS += -DSAI_FIXUP -UKCOM_FILTER_MAX -DKCOM_FILTER_MAX=1025 -UKCOM_NETIF_MAX -DKCOM_NETIF_MAX=1056 # Flag to enable multi instance support diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-gts b/platform/broadcom/saibcm-modules/make/Makefile.linux-gts index 726dfdf505bd..609b49c2094a 100644 --- a/platform/broadcom/saibcm-modules/make/Makefile.linux-gts +++ b/platform/broadcom/saibcm-modules/make/Makefile.linux-gts @@ -34,7 +34,6 @@ # Most of this was taken from target x86-smp_generic_64-2_6. # - ############################################################################# # this segment is custom and not sourced from any existing makefile # # (base thanks to http:confluence.broadcom.com/display/NTSWSW/X86+System) # @@ -46,11 +45,11 @@ #endif # some basic path variables for tools and kernel source, etc # -export XLR_TOOLS_BASE = /projects/ntsw-tools/linux/xlr-419 +XLR_TOOLS_BASE = /projects/ntsw-tools/linux/xlr-54 TOOLCHAIN_DIR = $(XLR_TOOLS_BASE)/buildroot/host/usr +KERNDIR = $(XLR_TOOLS_BASE)/kernel/linux # Target machine for EDK-Host defconfig TARGET_MACHINE ?= x86_64 -KERNDIR = $(XLR_TOOLS_BASE)/kernel/linux # set up cross compile prefix, tools dir variables. # export CROSS_COMPILE := x86_64-broadcom-linux-gnu- @@ -70,17 +69,19 @@ export LIBRARY_PATH := $(TOOLCHAIN_DIR)/lib:$(TOOLCHAIN_DIR)/lib64:$(LIBRARY_PAT export PATH := $(TOOLCHAIN_DIR)/bin:$(KERNDIR):$(PATH) # set up SYSINC path # -export SYSINC := $(XLR_TOOLS_BASE)/buildroot/host/usr/lib/gcc/$(TARGET_ARCHITECTURE)/5.4.0/include +CROSS_GCC_VER ?= $(shell $(TOOLCHAIN_DIR)/bin/$(CROSS_COMPILE)gcc -dumpversion) +export SYSINC := $(TOOLCHAIN_DIR)/lib/gcc/$(TARGET_ARCHITECTURE)/$(CROSS_GCC_VER)/include +# Glibc 2.27 or later version doesn't support SVID libm error handling. +# Building tcl 8.3.3 with the new toolchain will occur errors. +export TCL840 := 1 -# CFLAGS/CFGFLAGS # +# Common CFLAGS CFLAGS += -DUSE_LINUX_BDE_MMAP=1 #CFLAGS += -DBDE_LINUX_USE_MSI_INTERRUPT CFLAGS += -Wno-error=unused-value -CFLAGS += -Wno-error=unused-but-set-variable -CFLAGS += -Wno-error=maybe-uninitialized +CFLAGS += -Wno-error=unused-function CFLAGS += -Wno-error=cpp -CFLAGS += -Wno-error=aggressive-loop-optimizations CFLAGS += -Wno-error=array-bounds CFLAGS += -Wno-error=strict-overflow CFLAGS += -L$(TOOLCHAIN_DIR)/lib @@ -88,13 +89,46 @@ CFLAGS += -L$(TOOLCHAIN_DIR)/lib64 #CFLAGS += -Wl,--rpath=/lib64 # may need to set rpath and dynamic-linker path here (and possibly in KLFAGS below) in the future, # #CFLAGS += -Wl,--dynamic-linker=/lib64/ld-linux-x86-64.so.2 # if we want to build the target executable to be used with shared libs # +# Compiler-specific CFLAGS +ifeq (1,$(USE_CLANG)) # CLANG-specific CFLAGS +CFLAGS += -Wno-strlcpy-strlcat-size +CFLAGS += -Wno-strncat-size +else # GCC-specific CFLAGS +CFLAGS += -Wno-error=unused-but-set-variable +CFLAGS += -Wno-error=maybe-uninitialized +CFLAGS += -Wno-error=aggressive-loop-optimizations +CFLAGS += -Wno-error=sizeof-pointer-div #SDK-233830 +CFLAGS += -Wno-error=memset-elt-size #SDK-232626 +ifeq "$(shell expr `echo $(CROSS_GCC_VER) | cut -f1 -d.` \>= 8)" "1" + CFLAGS += -Wno-stringop-overflow + CFLAGS += -Wno-stringop-truncation + CFLAGS += -Wno-error=restrict +endif +ifeq "$(shell expr `echo $(CROSS_GCC_VER) | cut -f1 -d.` \>= 9)" "1" + CFLAGS += -Wno-address-of-packed-member +endif +ifeq "$(shell expr `echo $(CROSS_GCC_VER) | cut -f1 -d.` \== 10)" "1" + #There might be a bug in GCC10 that cannot detect initialization correctly. + CFLAGS += -Wno-error=uninitialized + CFLAGS += -Wno-error=format-overflow + CFLAGS += -fcommon +endif +endif # Compiler-specific CFLAGS + #XLDK-568 fix inline references CFGFLAGS += -fgnu89-inline +#XLR-54 +CFLAGS += -Wno-unused-variable #SDK-232993 +CFLAGS += -Wno-deprecated-declarations #SDK-233174 + +#CFLAGS += -Wno-unused-function +#CFLAGS += -Wno-aggressive-loop-optimizations +#CFLAGS += -Wno-maybe-uninitialized # set up KFLAGS appropriately. # ifeq (,$(KFLAGS)) -KFLAGS := -L$(TOOLCHAIN_DIR)/lib -L$(TOOLCHAIN_DIR)/lib64 -I$(KERNDIR) -lc -nostdinc -isystem $(SYSINC) -Iinclude -I$(KERNDIR)/arch/x86/include -I$(KERNDIR)/arch/x86/include/generated -I$(KERNDIR)/arch/x86/include/generated/uapi -I$(KERNDIR)/arch/x86/include/uapi -I$(KERNDIR)/include -I$(KERNDIR)/include/generated -I$(KERNDIR)/include/generated/uapi -I$(KERNDIR)/include/uapi -include $(KERNDIR)/include/generated/autoconf.h -D__KERNEL__ -DNDEBUG -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Wno-format-security -fno-delete-null-pointer-checks -O2 -m64 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -fstack-protector -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -Wframe-larger-than=1024 -fno-omit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-dwarf2-cfi-asm -fconserve-stack +KFLAGS := -L$(TOOLCHAIN_DIR)/lib -L$(TOOLCHAIN_DIR)/lib64 -I$(KERNDIR) -lc -nostdinc -isystem $(SYSINC) -Iinclude -I$(KERNDIR)/arch/x86/include -I$(KERNDIR)/arch/x86/include/generated -I$(KERNDIR)/arch/x86/include/generated/uapi -I$(KERNDIR)/arch/x86/include/uapi -I$(KERNDIR)/include -I$(KERNDIR)/include/generated -I$(KERNDIR)/include/generated/uapi -I$(KERNDIR)/include/uapi -include $(KERNDIR)/include/generated/autoconf.h -D__KERNEL__ -DNDEBUG -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Wno-format-security -fno-delete-null-pointer-checks -Os -mno-sse -m64 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -fstack-protector -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -fno-omit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-dwarf2-cfi-asm -fconserve-stack endif @@ -103,6 +137,7 @@ endif ###################################################################### CFGFLAGS += -DLONGS_ARE_64BITS CFGFLAGS += -DPTRS_ARE_64BITS +CFGFLAGS += -DPHYS_ADDRS_ARE_64BITS CFGFLAGS += -DSAL_SPL_LOCK_ON_IRQ @@ -155,6 +190,11 @@ export SYSTEM_INTERFACE export EXTRA_SYSTEM_INTERFACES endif +ifneq (, $(EDKHOST)) +# Default open source target build +OPENSRC_BUILD ?= fed21-x86_64 +endif + ifneq ($(targetplat),user) # By default we exclude -Werror from x86 kernel builds BCM_CFLAGS = -Wall diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-iproc b/platform/broadcom/saibcm-modules/make/Makefile.linux-iproc index fa4911185aa8..9b08d0b2a3d4 100644 --- a/platform/broadcom/saibcm-modules/make/Makefile.linux-iproc +++ b/platform/broadcom/saibcm-modules/make/Makefile.linux-iproc @@ -41,13 +41,15 @@ ifeq (BE,$(ENDIAN_MODE)) #While BE mode is supported, it's use is very limited. We had a specific customer #request for BE support but don't currently mainstream it. So a 5.1.0 version #has not been built. Continue using 5.0.3 for any BE support -TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk50-be/XLDK32 +TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk61-be/XLDK32 +KERN_BASE_DIR ?= $(TOOLCHAIN_BASE_DIR) TARGET_ARCHITECTURE:=armeb-broadcom-linux-uclibcgnueabi KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux else -TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk51/XLDK32 +TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/XLDK_GCC10/XLDK32 +KERN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk61/XLDK32 TARGET_ARCHITECTURE:= arm-broadcom-linux-uclibcgnueabi -KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux +KERNDIR ?= $(KERN_BASE_DIR)/kernel/linux endif ifeq (,$(CROSS_COMPILE)) @@ -61,6 +63,7 @@ LD_LIBRARY_PATH=$(TOOLCHAIN_BASE_DIR)/buildroot/host/usr/lib export TOOLCHAIN_BIN_DIR LD_LIBRARY_PATH CROSS_GCC_VER ?= $(shell $(TOOLCHAIN_BIN_DIR)/$(CROSS_COMPILE)gcc -dumpversion) +CROSS_GCC_VER_MAJOR := $(shell echo $(CROSS_GCC_VER) | cut -f1 -d.) # Default Linux include directory ifeq (,$(LINUX_INCLUDE)) @@ -79,13 +82,29 @@ CFLAGS += -fno-aggressive-loop-optimizations CFLAGS += -Wno-error=maybe-uninitialized CFLAGS += -Wno-error=array-bounds CFLAGS += -fgnu89-inline -ifeq "$(shell expr `echo $(CROSS_GCC_VER) | cut -f1 -d.` \>= 7)" "1" - CFLAGS += -Wno-error=bool-operation +ifeq "$(shell expr $(CROSS_GCC_VER_MAJOR) \>= 8)" "1" + CFLAGS += -Wno-stringop-overflow + CFLAGS += -Wno-stringop-truncation + CFLAGS += -Wno-error=restrict +endif +ifeq "$(shell expr $(CROSS_GCC_VER_MAJOR) \>= 9)" "1" + CFLAGS += -Wno-address-of-packed-member +endif +ifeq "$(shell expr $(CROSS_GCC_VER_MAJOR) \== 10)" "1" + #There might be a bug in GCC10 that cannot detect initialization correctly. + CFLAGS += -Wno-error=uninitialized + CFLAGS += -Wno-error=format-overflow + CFLAGS += -fcommon endif CFGFLAGS += -D$(ENDIAN) -DIPROC_CMICD CFGFLAGS += -DBCM_PLATFORM_STRING=\"IPROC_CMICD\" +#XLR-54 +CFLAGS += -Wno-error=memset-elt-size #SDK-232626 +CFLAGS += -Wno-error=unused-function +CFLAGS += -Wno-error=unused-variable +CFLAGS += -Wno-error=unused-const-variable ARCH = arm KBUILD_VERBOSE = 1 @@ -108,6 +127,11 @@ KFLAG_INCLD ?= $(LD_LIBRARY_PATH)/gcc/$(TARGET_ARCHITECTURE)/$(CROSS_GCC_VER)/in ifeq (,$(KFLAGS)) KFLAGS := -D__LINUX_ARM_ARCH__=7 -D__KERNEL__ -nostdinc -isystem $(KFLAG_INCLD) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/generated/autoconf.h -I$(KERNDIR)/arch/arm/include -I$(KERNDIR)/arch/arm/include/generated -I$(KERNDIR)/arch/arm/mach-iproc/include -Wall -Wstrict-prototypes -Wno-trigraphs -Os -fno-strict-aliasing -fno-common -marm -mabi=aapcs-linux -fno-pic -pipe -msoft-float -ffreestanding -march=armv7-a -mfpu=vfp -mfloat-abi=softfp -fomit-frame-pointer -g -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -mlong-calls KFLAGS += -I$(LINUX_INCLUDE)/uapi -I$(LINUX_INCLUDE)/generated/uapi -I$(KERNDIR)/arch/arm/include/uapi -I$(KERNDIR)/arch/arm/include/generated/uapi + +ifeq "$(shell expr $(CROSS_GCC_VER_MAJOR) \== 10)" "1" + # WAR: Disable the following optimizations because they will fail the installation of kernel modules + KFLAGS += -fno-expensive-optimizations -fno-gcse +endif endif ifneq ($(targetplat),user) diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-iproc_64 b/platform/broadcom/saibcm-modules/make/Makefile.linux-iproc_64 index 247da7386370..bfb6cd48dda8 100644 --- a/platform/broadcom/saibcm-modules/make/Makefile.linux-iproc_64 +++ b/platform/broadcom/saibcm-modules/make/Makefile.linux-iproc_64 @@ -40,13 +40,15 @@ endif ifeq (BE,$(ENDIAN_MODE)) #We've never actually built a 64 BE executable. Just here for any future #customer requirements. -TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk51-be/XLDK64 +TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk61-be/XLDK64 +KERN_BASE_DIR ?= $(TOOLCHAIN_BASE_DIR) TARGET_ARCHITECTURE ?= aarch64_be-broadcom-linux-uclibc -KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux +KERNDIR ?= $(KERN_BASE_DIR)/kernel/linux else -TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk51/XLDK64 +TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/XLDK_GCC10/XLDK64 +KERN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk61/XLDK64 TARGET_ARCHITECTURE ?= aarch64-broadcom-linux-uclibc -KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux +KERNDIR ?= $(KERN_BASE_DIR)/kernel/linux endif ifeq (,$(CROSS_COMPILE)) @@ -78,12 +80,24 @@ CFLAGS += -DPTRS_ARE_64BITS -DLONGS_ARE_64BITS CFLAGS += -DPHYS_ADDRS_ARE_64BITS CFLAGS += -fno-aggressive-loop-optimizations -fno-strict-overflow CFLAGS += -Wno-error=maybe-uninitialized +CFLAGS += -Wno-error=unused-function CFLAGS += -Wno-error=array-bounds +CFLAGS += -Wno-error=format-overflow CFLAGS += -fgnu89-inline -ifeq "$(shell expr `echo $(CROSS_GCC_VER) | cut -f1 -d.` \>= 7)" "1" - CFLAGS += -Wno-error=bool-operation +ifeq "$(shell expr `echo $(CROSS_GCC_VER) | cut -f1 -d.` \>= 8)" "1" + CFLAGS += -Wno-stringop-overflow + CFLAGS += -Wno-stringop-truncation + CFLAGS += -Wno-error=restrict +endif +ifeq "$(shell expr `echo $(CROSS_GCC_VER) | cut -f1 -d.` \>= 9)" "1" + CFLAGS += -Wno-address-of-packed-member +endif +ifeq "$(shell expr `echo $(CROSS_GCC_VER) | cut -f1 -d.` \== 10)" "1" + #There might be a bug in GCC10 that cannot detect initialization correctly. + CFLAGS += -Wno-error=uninitialized + CFLAGS += -Wno-error=format-overflow + CFLAGS += -fcommon endif - CFGFLAGS += -D$(ENDIAN) -DIPROC_CMICD CFGFLAGS += -DBCM_PLATFORM_STRING=\"IPROC_CMICD\" @@ -109,7 +123,7 @@ modname_flags = $(if $(filter 1,$(words $(modname))),\ KFLAG_INCLD ?= $(LD_LIBRARY_PATH)/gcc/$(TARGET_ARCHITECTURE)/$(CROSS_GCC_VER)/include ifeq (,$(KFLAGS)) -KFLAGS := -D__LINUX_ARM_ARCH__=8 -D__KERNEL__ -DPTRS_ARE_64BITS -DLONGS_ARE_64BITS -nostdinc -isystem $(KFLAG_INCLD) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/generated/autoconf.h -I$(KERNDIR)/arch/arm64/include -I$(KERNDIR)/arch/arm64/include/generated -I$(KERNDIR)/arch/arm64/include/generated/uapi -I$(KERNDIR)/arch/arm64/include/generated/asm -I$(KERNDIR)/include/uapi -I$(KERNDIR)/include/generated/uapi -I$(KERNDIR)/arch/arm64/include/uapi -Wall -Wstrict-prototypes -Wno-trigraphs -Os -fno-strict-aliasing -fno-common -fno-pic -pipe -ffreestanding -fomit-frame-pointer -g -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -mcmodel=large +KFLAGS := -D__LINUX_ARM_ARCH__=8 -D__KERNEL__ -DPTRS_ARE_64BITS -DLONGS_ARE_64BITS -nostdinc -isystem $(KFLAG_INCLD) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/generated/autoconf.h -I$(KERNDIR)/arch/arm64/include -I$(KERNDIR)/arch/arm64/include/generated -I$(KERNDIR)/arch/arm64/include/generated/uapi -I$(KERNDIR)/arch/arm64/include/generated/asm -I$(KERNDIR)/include/uapi -I$(KERNDIR)/include/generated/uapi -I$(KERNDIR)/arch/arm64/include/uapi -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fno-pic -pipe -ffreestanding -fomit-frame-pointer -g -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -mcmodel=large endif ifneq ($(targetplat),user) diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-kernel-2_6 b/platform/broadcom/saibcm-modules/make/Makefile.linux-kernel-2_6 index 08461e4c4b7c..431bf808f044 100644 --- a/platform/broadcom/saibcm-modules/make/Makefile.linux-kernel-2_6 +++ b/platform/broadcom/saibcm-modules/make/Makefile.linux-kernel-2_6 @@ -40,6 +40,11 @@ FEATURE_EXCLUDE_LIST = $(sort $(_FEATURE_EXCLUDE_LIST)) # Conditionally Replaces DEFAULT var ifeq ($(origin CC),default) CC = $(LSRUN) $(CROSS_COMPILE)gcc +else +# If using CLANG then revert the CC to default gcc tool +ifeq ($(USE_CLANG),1) +CC = $(LSRUN) $(CROSS_COMPILE)gcc +endif endif ifeq ($(origin CXX),default) diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-slk b/platform/broadcom/saibcm-modules/make/Makefile.linux-slk index 656835019a05..de6322fceb74 100644 --- a/platform/broadcom/saibcm-modules/make/Makefile.linux-slk +++ b/platform/broadcom/saibcm-modules/make/Makefile.linux-slk @@ -131,7 +131,9 @@ basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" modname_flags = $(if $(filter 1,$(words $(modname))),\ -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") -KFLAG_INCLD = $(TOOLCHAIN_BASE_DIR)/lib/gcc/$(TARGET_ARCHITECTURE)/4.9.2/include +CROSS_GCC_VER ?= $(shell $(TOOLCHAIN_BIN_DIR)/$(CROSS_COMPILE)gcc -dumpversion) + +KFLAG_INCLD = $(TOOLCHAIN_BASE_DIR)/lib/gcc/$(TARGET_ARCHITECTURE)/$(CROSS_GCC_VER)/include ifeq (,$(KFLAGS)) KFLAGS := -D__LINUX_ARM_ARCH__=8 -D__KERNEL__ -DPTRS_ARE_64BITS -DLONGS_ARE_64BITS -nostdinc -isystem $(KFLAG_INCLD) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/generated/autoconf.h -I$(KERNDIR)/arch/arm64/include -I$(KERNDIR)/arch/arm64/include/generated -I$(KERNDIR)/arch/arm64/include/generated/asm -I$(KERNDIR)/include/uapi -I$(KERNDIR)/include/generated/uapi -I$(KERNDIR)/arch/arm64/include/uapi -Wall -Wstrict-prototypes -Wno-trigraphs -Os -fno-strict-aliasing -fno-common -fno-pic -pipe -ffreestanding -fomit-frame-pointer -g -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign @@ -156,6 +158,14 @@ endif export SYSTEM_INTERFACE endif +ifneq (, $(EDKHOST)) +ifeq (BE,$(ENDIAN_MODE)) +OPENSRC_BUILD ?= linaro_arm64_be +else +OPENSRC_BUILD ?= linaro_arm64_le +endif +endif + ifneq ($(targetplat),user) include ${SDK}/make/Makefile.linux-kernel-3_6 endif diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-x86-smp_generic_64-2_6 b/platform/broadcom/saibcm-modules/make/Makefile.linux-x86-smp_generic_64-2_6 index 9df0bee5a774..2f6b54f1b994 100644 --- a/platform/broadcom/saibcm-modules/make/Makefile.linux-x86-smp_generic_64-2_6 +++ b/platform/broadcom/saibcm-modules/make/Makefile.linux-x86-smp_generic_64-2_6 @@ -39,11 +39,6 @@ ifeq (,$(KFLAGS)) KFLAGS := -nostdinc -isystem $(SYSINC) -I$(KERNDIR)/include -I$(KERNDIR)/arch/x86/include -include $(AUTOCONF) -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -m64 -mtune=generic -mno-red-zone -fno-pie -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-stack-protector -fomit-frame-pointer -g -Wdeclaration-after-statement -Wno-pointer-sign endif -ifeq ($(LINUX_MAKE_SHARED_LIB), 1) - KFLAGS += -fPIC -mcmodel=small -else - KFLAGS += -fno-pie -mcmodel=kernel -endif LINUX_UAPI = $(LINUX_INCLUDE)/uapi ifneq (,$(shell ls $(LINUX_UAPI) 2>/dev/null)) @@ -69,4 +64,9 @@ endif export SYSTEM_INTERFACE endif +ifneq (, $(EDKHOST)) +# Default open source target build +OPENSRC_BUILD ?= x86_64 +endif + include ${SDK}/make/Makefile.linux-x86-common-2_6 diff --git a/platform/broadcom/saibcm-modules/make/Makefile.linux-xlr b/platform/broadcom/saibcm-modules/make/Makefile.linux-xlr index 726dfdf505bd..609b49c2094a 100644 --- a/platform/broadcom/saibcm-modules/make/Makefile.linux-xlr +++ b/platform/broadcom/saibcm-modules/make/Makefile.linux-xlr @@ -34,7 +34,6 @@ # Most of this was taken from target x86-smp_generic_64-2_6. # - ############################################################################# # this segment is custom and not sourced from any existing makefile # # (base thanks to http:confluence.broadcom.com/display/NTSWSW/X86+System) # @@ -46,11 +45,11 @@ #endif # some basic path variables for tools and kernel source, etc # -export XLR_TOOLS_BASE = /projects/ntsw-tools/linux/xlr-419 +XLR_TOOLS_BASE = /projects/ntsw-tools/linux/xlr-54 TOOLCHAIN_DIR = $(XLR_TOOLS_BASE)/buildroot/host/usr +KERNDIR = $(XLR_TOOLS_BASE)/kernel/linux # Target machine for EDK-Host defconfig TARGET_MACHINE ?= x86_64 -KERNDIR = $(XLR_TOOLS_BASE)/kernel/linux # set up cross compile prefix, tools dir variables. # export CROSS_COMPILE := x86_64-broadcom-linux-gnu- @@ -70,17 +69,19 @@ export LIBRARY_PATH := $(TOOLCHAIN_DIR)/lib:$(TOOLCHAIN_DIR)/lib64:$(LIBRARY_PAT export PATH := $(TOOLCHAIN_DIR)/bin:$(KERNDIR):$(PATH) # set up SYSINC path # -export SYSINC := $(XLR_TOOLS_BASE)/buildroot/host/usr/lib/gcc/$(TARGET_ARCHITECTURE)/5.4.0/include +CROSS_GCC_VER ?= $(shell $(TOOLCHAIN_DIR)/bin/$(CROSS_COMPILE)gcc -dumpversion) +export SYSINC := $(TOOLCHAIN_DIR)/lib/gcc/$(TARGET_ARCHITECTURE)/$(CROSS_GCC_VER)/include +# Glibc 2.27 or later version doesn't support SVID libm error handling. +# Building tcl 8.3.3 with the new toolchain will occur errors. +export TCL840 := 1 -# CFLAGS/CFGFLAGS # +# Common CFLAGS CFLAGS += -DUSE_LINUX_BDE_MMAP=1 #CFLAGS += -DBDE_LINUX_USE_MSI_INTERRUPT CFLAGS += -Wno-error=unused-value -CFLAGS += -Wno-error=unused-but-set-variable -CFLAGS += -Wno-error=maybe-uninitialized +CFLAGS += -Wno-error=unused-function CFLAGS += -Wno-error=cpp -CFLAGS += -Wno-error=aggressive-loop-optimizations CFLAGS += -Wno-error=array-bounds CFLAGS += -Wno-error=strict-overflow CFLAGS += -L$(TOOLCHAIN_DIR)/lib @@ -88,13 +89,46 @@ CFLAGS += -L$(TOOLCHAIN_DIR)/lib64 #CFLAGS += -Wl,--rpath=/lib64 # may need to set rpath and dynamic-linker path here (and possibly in KLFAGS below) in the future, # #CFLAGS += -Wl,--dynamic-linker=/lib64/ld-linux-x86-64.so.2 # if we want to build the target executable to be used with shared libs # +# Compiler-specific CFLAGS +ifeq (1,$(USE_CLANG)) # CLANG-specific CFLAGS +CFLAGS += -Wno-strlcpy-strlcat-size +CFLAGS += -Wno-strncat-size +else # GCC-specific CFLAGS +CFLAGS += -Wno-error=unused-but-set-variable +CFLAGS += -Wno-error=maybe-uninitialized +CFLAGS += -Wno-error=aggressive-loop-optimizations +CFLAGS += -Wno-error=sizeof-pointer-div #SDK-233830 +CFLAGS += -Wno-error=memset-elt-size #SDK-232626 +ifeq "$(shell expr `echo $(CROSS_GCC_VER) | cut -f1 -d.` \>= 8)" "1" + CFLAGS += -Wno-stringop-overflow + CFLAGS += -Wno-stringop-truncation + CFLAGS += -Wno-error=restrict +endif +ifeq "$(shell expr `echo $(CROSS_GCC_VER) | cut -f1 -d.` \>= 9)" "1" + CFLAGS += -Wno-address-of-packed-member +endif +ifeq "$(shell expr `echo $(CROSS_GCC_VER) | cut -f1 -d.` \== 10)" "1" + #There might be a bug in GCC10 that cannot detect initialization correctly. + CFLAGS += -Wno-error=uninitialized + CFLAGS += -Wno-error=format-overflow + CFLAGS += -fcommon +endif +endif # Compiler-specific CFLAGS + #XLDK-568 fix inline references CFGFLAGS += -fgnu89-inline +#XLR-54 +CFLAGS += -Wno-unused-variable #SDK-232993 +CFLAGS += -Wno-deprecated-declarations #SDK-233174 + +#CFLAGS += -Wno-unused-function +#CFLAGS += -Wno-aggressive-loop-optimizations +#CFLAGS += -Wno-maybe-uninitialized # set up KFLAGS appropriately. # ifeq (,$(KFLAGS)) -KFLAGS := -L$(TOOLCHAIN_DIR)/lib -L$(TOOLCHAIN_DIR)/lib64 -I$(KERNDIR) -lc -nostdinc -isystem $(SYSINC) -Iinclude -I$(KERNDIR)/arch/x86/include -I$(KERNDIR)/arch/x86/include/generated -I$(KERNDIR)/arch/x86/include/generated/uapi -I$(KERNDIR)/arch/x86/include/uapi -I$(KERNDIR)/include -I$(KERNDIR)/include/generated -I$(KERNDIR)/include/generated/uapi -I$(KERNDIR)/include/uapi -include $(KERNDIR)/include/generated/autoconf.h -D__KERNEL__ -DNDEBUG -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Wno-format-security -fno-delete-null-pointer-checks -O2 -m64 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -fstack-protector -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -Wframe-larger-than=1024 -fno-omit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-dwarf2-cfi-asm -fconserve-stack +KFLAGS := -L$(TOOLCHAIN_DIR)/lib -L$(TOOLCHAIN_DIR)/lib64 -I$(KERNDIR) -lc -nostdinc -isystem $(SYSINC) -Iinclude -I$(KERNDIR)/arch/x86/include -I$(KERNDIR)/arch/x86/include/generated -I$(KERNDIR)/arch/x86/include/generated/uapi -I$(KERNDIR)/arch/x86/include/uapi -I$(KERNDIR)/include -I$(KERNDIR)/include/generated -I$(KERNDIR)/include/generated/uapi -I$(KERNDIR)/include/uapi -include $(KERNDIR)/include/generated/autoconf.h -D__KERNEL__ -DNDEBUG -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Wno-format-security -fno-delete-null-pointer-checks -Os -mno-sse -m64 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -fstack-protector -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -fno-omit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-dwarf2-cfi-asm -fconserve-stack endif @@ -103,6 +137,7 @@ endif ###################################################################### CFGFLAGS += -DLONGS_ARE_64BITS CFGFLAGS += -DPTRS_ARE_64BITS +CFGFLAGS += -DPHYS_ADDRS_ARE_64BITS CFGFLAGS += -DSAL_SPL_LOCK_ON_IRQ @@ -155,6 +190,11 @@ export SYSTEM_INTERFACE export EXTRA_SYSTEM_INTERFACES endif +ifneq (, $(EDKHOST)) +# Default open source target build +OPENSRC_BUILD ?= fed21-x86_64 +endif + ifneq ($(targetplat),user) # By default we exclude -Werror from x86 kernel builds BCM_CFLAGS = -Wall diff --git a/platform/broadcom/saibcm-modules/sdklt/Makefile b/platform/broadcom/saibcm-modules/sdklt/Makefile index d6f358c55283..83a77ebcd1e0 100644 --- a/platform/broadcom/saibcm-modules/sdklt/Makefile +++ b/platform/broadcom/saibcm-modules/sdklt/Makefile @@ -1,5 +1,5 @@ # -# $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. +# $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. # # This program is free software; you can redistribute it and/or diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56780_a0/bcm56780_a0_pdma_attach.c b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56780_a0/bcm56780_a0_pdma_attach.c index e06dcb68bfc8..dfdb504d87c6 100644 --- a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56780_a0/bcm56780_a0_pdma_attach.c +++ b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56780_a0/bcm56780_a0_pdma_attach.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56880_a0/bcm56880_a0_pdma_attach.c b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56880_a0/bcm56880_a0_pdma_attach.c index 9a2152e99ac0..9dc9195cc209 100644 --- a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56880_a0/bcm56880_a0_pdma_attach.c +++ b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56880_a0/bcm56880_a0_pdma_attach.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56990_a0/bcm56990_a0_pdma_attach.c b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56990_a0/bcm56990_a0_pdma_attach.c index 7827ef25de3d..2e02369c958b 100644 --- a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56990_a0/bcm56990_a0_pdma_attach.c +++ b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56990_a0/bcm56990_a0_pdma_attach.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56990_b0/bcm56990_b0_pdma_attach.c b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56990_b0/bcm56990_b0_pdma_attach.c index e34ae1f0b45c..1acf4b41bffd 100644 --- a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56990_b0/bcm56990_b0_pdma_attach.c +++ b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56990_b0/bcm56990_b0_pdma_attach.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56995_a0/bcm56995_a0_pdma_attach.c b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56995_a0/bcm56995_a0_pdma_attach.c new file mode 100644 index 000000000000..08419f1d3a1e --- /dev/null +++ b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56995_a0/bcm56995_a0_pdma_attach.c @@ -0,0 +1,38 @@ +/*! \file bcm56995_a0_pdma_attach.c + * + * Initialize PDMA driver resources. + * + */ +/* + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. + * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * A copy of the GNU General Public License version 2 (GPLv2) can + * be found in the LICENSES folder.$ + */ + +#include +#include +#include + +int +bcm56995_a0_cnet_pdma_attach(struct pdma_dev *dev) +{ + return bcmcnet_cmicx_pdma_driver_attach(dev); +} + +int +bcm56995_a0_cnet_pdma_detach(struct pdma_dev *dev) +{ + return bcmcnet_cmicx_pdma_driver_detach(dev); +} + diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56996_a0/bcm56996_a0_pdma_attach.c b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56996_a0/bcm56996_a0_pdma_attach.c index aab5822f68b7..2fca51ce9788 100644 --- a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56996_a0/bcm56996_a0_pdma_attach.c +++ b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56996_a0/bcm56996_a0_pdma_attach.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56996_b0/bcm56996_b0_pdma_attach.c b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56996_b0/bcm56996_b0_pdma_attach.c new file mode 100644 index 000000000000..06e22a8a28a0 --- /dev/null +++ b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56996_b0/bcm56996_b0_pdma_attach.c @@ -0,0 +1,38 @@ +/*! \file bcm56996_b0_pdma_attach.c + * + * Initialize PDMA driver resources. + * + */ +/* + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. + * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * A copy of the GNU General Public License version 2 (GPLv2) can + * be found in the LICENSES folder.$ + */ + +#include +#include +#include + +int +bcm56996_b0_cnet_pdma_attach(struct pdma_dev *dev) +{ + return bcmcnet_cmicx_pdma_driver_attach(dev); +} + +int +bcm56996_b0_cnet_pdma_detach(struct pdma_dev *dev) +{ + return bcmcnet_cmicx_pdma_driver_detach(dev); +} + diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56998_a0/bcm56998_a0_pdma_attach.c b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56998_a0/bcm56998_a0_pdma_attach.c new file mode 100644 index 000000000000..1c5e0b2846a5 --- /dev/null +++ b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/chip/bcm56998_a0/bcm56998_a0_pdma_attach.c @@ -0,0 +1,38 @@ +/*! \file bcm56998_a0_pdma_attach.c + * + * Initialize PDMA driver resources. + * + */ +/* + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. + * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * A copy of the GNU General Public License version 2 (GPLv2) can + * be found in the LICENSES folder.$ + */ + +#include +#include +#include + +int +bcm56998_a0_cnet_pdma_attach(struct pdma_dev *dev) +{ + return bcmcnet_cmicx_pdma_driver_attach(dev); +} + +int +bcm56998_a0_cnet_pdma_detach(struct pdma_dev *dev) +{ + return bcmcnet_cmicx_pdma_driver_detach(dev); +} + diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/hmi/cmicd/bcmcnet_cmicd_pdma_hw.c b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/hmi/cmicd/bcmcnet_cmicd_pdma_hw.c index 83ce4d11b97f..e1eac2488497 100644 --- a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/hmi/cmicd/bcmcnet_cmicd_pdma_hw.c +++ b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/hmi/cmicd/bcmcnet_cmicd_pdma_hw.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -88,6 +88,17 @@ cmicd_pdma_hw_init(struct pdma_hw *hw) hw->dev->mode = DEV_MODE_UNET; } + /* + * FIXME: SDKLT-27954 SDKLT-27956 + * + * credit release is invoked by cmic_edb_credit_refresh() in + * bcmtm_internal_port_up(). + * + * But, bcmtm_internal_port_up() is missed in bcm56960_a0. + * + * Need to remove credit release once all CMICd chipsets are fixed. + */ + /* Release credits to EP. Only do this once when HW is initialized. */ hw->hdls.reg_rd32(hw, CMICD_EPINTF_RELEASE_CREDITS, &val); if (!val) { diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/hmi/cmicd/bcmcnet_cmicd_pdma_rxtx.c b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/hmi/cmicd/bcmcnet_cmicd_pdma_rxtx.c index c4a10e160db9..711a037510dc 100644 --- a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/hmi/cmicd/bcmcnet_cmicd_pdma_rxtx.c +++ b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/hmi/cmicd/bcmcnet_cmicd_pdma_rxtx.c @@ -38,7 +38,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -354,17 +354,26 @@ cmicd_pdma_rx_ring_refill(struct pdma_hw *hw, struct pdma_rx_queue *rxq) int unused = cmicd_pdma_rx_ring_unused(rxq); dma_addr_t addr; uint32_t halt; + int retry; int rv; for (halt = rxq->halt; halt < rxq->halt + unused; halt++) { pbuf = &rxq->pbuf[halt % rxq->nb_desc]; /* Allocate a new pktbuf */ if (!bm->rx_buf_avail(dev, rxq, pbuf)) { - rv = bm->rx_buf_alloc(dev, rxq, pbuf); - if (SHR_FAILURE(rv)) { - rxq->halt = halt % rxq->nb_desc; + retry = 5000000; + do { + rv = bm->rx_buf_alloc(dev, rxq, pbuf); + if (SHR_SUCCESS(rv)) { + break; + } rxq->stats.nomems++; - goto fail; + sal_usleep(1); + } while (retry--); + if (retry <= 0) { + CNET_PR("Fatal error: Rx buffer has not been allocated for 5 seconds\n"); + rxq->halt = halt % rxq->nb_desc; + return rv; } } /* Setup the new descriptor */ @@ -385,11 +394,6 @@ cmicd_pdma_rx_ring_refill(struct pdma_hw *hw, struct pdma_rx_queue *rxq) sal_spinlock_unlock(rxq->lock); return SHR_E_NONE; - -fail: - CNET_PR("RX: Failed to allocate mem\n"); - - return SHR_E_MEMORY; } /*! @@ -413,6 +417,7 @@ cmicd_pdma_rx_ring_clean(struct pdma_hw *hw, struct pdma_rx_queue *rxq, int budg dma_addr_t addr; uint32_t stat, curr; int len, done = 0; + int retry; int rv; curr = rxq->curr; @@ -438,7 +443,7 @@ cmicd_pdma_rx_ring_clean(struct pdma_hw *hw, struct pdma_rx_queue *rxq, int budg pkh = bm->rx_buf_get(dev, rxq, pbuf, len); if (!pkh) { rxq->stats.nomems++; - goto fail; + return SHR_E_MEMORY; } /* Setup packet header */ @@ -446,7 +451,7 @@ cmicd_pdma_rx_ring_clean(struct pdma_hw *hw, struct pdma_rx_queue *rxq, int budg pkh->meta_len = pbuf->adj; pkh->queue_id = rxq->queue_id; pkh->attrs = CMICD_DESC_STAT_FLAGS(stat); - sal_memcpy(&pbuf->pkb->data, &ring[curr].md, sizeof(struct rx_metadata)); + sal_memcpy(pkh + 1, &ring[curr].md, sizeof(struct rx_metadata)); /* Send up the packet */ rv = dev->pkt_recv(dev, rxq->queue_id, (void *)pbuf->skb); @@ -484,10 +489,18 @@ cmicd_pdma_rx_ring_clean(struct pdma_hw *hw, struct pdma_rx_queue *rxq, int budg /* Setup the new descriptor */ if (!(rxq->state & PDMA_RX_BATCH_REFILL)) { if (!bm->rx_buf_avail(dev, rxq, pbuf)) { - rv = bm->rx_buf_alloc(dev, rxq, pbuf); - if (SHR_FAILURE(rv)) { + retry = 5000000; + do { + rv = bm->rx_buf_alloc(dev, rxq, pbuf); + if (SHR_SUCCESS(rv)) { + break; + } rxq->stats.nomems++; - goto fail; + sal_usleep(1); + } while (retry--); + if (retry <= 0) { + CNET_PR("Fatal error: Rx buffer has not been allocated for 5 seconds\n"); + return done; } } bm->rx_buf_dma(dev, rxq, pbuf, &addr); @@ -553,11 +566,6 @@ cmicd_pdma_rx_ring_clean(struct pdma_hw *hw, struct pdma_rx_queue *rxq, int budg } } - return done; - -fail: - CNET_PR("RX: Failed to allocate mem\n"); - return done; } @@ -663,7 +671,9 @@ cmicd_pdma_tx_ring_clean(struct pdma_hw *hw, struct pdma_tx_queue *txq, int budg /* Resume Tx if any */ sal_spinlock_lock(txq->lock); - if (cmicd_pdma_tx_ring_unused(txq) && txq->state & PDMA_TX_QUEUE_XOFF) { + if (txq->state & PDMA_TX_QUEUE_XOFF && + txq->state & PDMA_TX_QUEUE_ACTIVE && + cmicd_pdma_tx_ring_unused(txq)) { txq->state &= ~PDMA_TX_QUEUE_XOFF; sal_spinlock_unlock(txq->lock); if (dev->tx_resume) { @@ -803,14 +813,14 @@ cmicd_pdma_pkt_xmit(struct pdma_hw *hw, struct pdma_tx_queue *txq, void *buf) int retry = 5000000; int rv; - if (!(txq->state & PDMA_TX_QUEUE_ACTIVE)) { - return SHR_E_UNAVAIL; - } - if (dev->tx_suspend) { sal_spinlock_lock(txq->mutex); } else { - sal_sem_take(txq->sem, SAL_SEM_FOREVER); + rv = sal_sem_take(txq->sem, BCMCNET_TX_RSRC_WAIT_USEC); + if (rv == -1) { + CNET_PR("Timeout waiting for Tx resources\n"); + return SHR_E_TIMEOUT; + } } /* Check Tx resource */ @@ -856,7 +866,7 @@ cmicd_pdma_pkt_xmit(struct pdma_hw *hw, struct pdma_tx_queue *txq, void *buf) flags |= pkh->attrs & PDMA_TX_PURGE_PKT ? CMICD_DESC_TX_PURGE_PKT : 0; cmicd_tx_desc_config(&ring[curr], addr, pbuf->len, flags); if (pkh->meta_len) { - sal_memcpy(&ring[curr].md, &pbuf->pkb->data, sizeof(ring->md.data)); + sal_memcpy(&ring[curr].md, pkh + 1, sizeof(ring->md.data)); } } @@ -923,7 +933,8 @@ cmicd_pdma_pkt_xmit(struct pdma_hw *hw, struct pdma_tx_queue *txq, void *buf) /* In polling mode, must wait till the ring is available */ do { cmicd_pdma_tx_ring_clean(hw, txq, txq->free_thresh); - if (!(txq->state & PDMA_TX_QUEUE_XOFF)) { + if (!(txq->state & PDMA_TX_QUEUE_XOFF) || + !(txq->state & PDMA_TX_QUEUE_ACTIVE)) { break; } sal_usleep(1); diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/hmi/cmicx/bcmcnet_cmicx_pdma_hw.c b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/hmi/cmicx/bcmcnet_cmicx_pdma_hw.c index 6dc77c4b7c04..471e65f70682 100644 --- a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/hmi/cmicx/bcmcnet_cmicx_pdma_hw.c +++ b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/hmi/cmicx/bcmcnet_cmicx_pdma_hw.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -103,36 +103,6 @@ cmicx_pdma_intr_disable(struct pdma_hw *hw, int cmc, int chan, uint32_t mask) hw->dev->ctrl.grp[cmc].irq_mask = irq_mask; } -/*! - * Release Packet DMA credits to EP. - */ -static int -cmicx_pdma_credits_release(struct pdma_hw *hw) -{ - int credits; - uint32_t val; - - /* - * Since only 6 bits of iproc_cmic_to_ep_credits[5:0] are being used, - * so we have to set the max credits value twice in order to release - * 64 credits to EP. - * Only do this once when HW is initialized. - */ - hw->hdls.reg_rd32(hw, CMICX_EPINTF_RELEASE_CREDITS, &val); - if (!val) { - credits = 63; - hw->hdls.reg_wr32(hw, CMICX_EPINTF_MAX_CREDITS, (0x1 << 8) | credits); - hw->hdls.reg_wr32(hw, CMICX_EPINTF_RELEASE_CREDITS, 1); - - hw->hdls.reg_wr32(hw, CMICX_EPINTF_RELEASE_CREDITS, 0); - credits = 1; - hw->hdls.reg_wr32(hw, CMICX_EPINTF_MAX_CREDITS, (0x1 << 8) | credits); - hw->hdls.reg_wr32(hw, CMICX_EPINTF_RELEASE_CREDITS, 1); - } - - return SHR_E_NONE; -} - /*! * Initialize HW */ @@ -148,9 +118,6 @@ cmicx_pdma_hw_init(struct pdma_hw *hw) hw->dev->mode = DEV_MODE_UNET; } - /* Release Packet DMA credits to EP. */ - cmicx_pdma_credits_release(hw); - hw->info.name = CMICX_DEV_NAME; hw->info.dev_id = hw->dev->dev_id; hw->info.num_cmcs = CMICX_PDMA_CMC_MAX; @@ -240,12 +207,13 @@ cmicx_pdma_hw_config(struct pdma_hw *hw) hw->hdls.reg_wr32(hw, CMICX_PDMA_CTRL(grp, que), val); } + hw->hdls.reg_rd32(hw, CMICX_TOP_CONFIG, &val); if (ip_if_hdr_endian == 1) { - hw->hdls.reg_rd32(hw, CMICX_TOP_CONFIG, &val); val |= 0x80; - hw->hdls.reg_wr32(hw, CMICX_TOP_CONFIG, val); + } else { + val &= ~0x80; } - + hw->hdls.reg_wr32(hw, CMICX_TOP_CONFIG, val); return SHR_E_NONE; } diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/hmi/cmicx/bcmcnet_cmicx_pdma_rxtx.c b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/hmi/cmicx/bcmcnet_cmicx_pdma_rxtx.c index 651728465d56..9ea7489b5471 100644 --- a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/hmi/cmicx/bcmcnet_cmicx_pdma_rxtx.c +++ b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/hmi/cmicx/bcmcnet_cmicx_pdma_rxtx.c @@ -38,7 +38,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -394,17 +394,26 @@ cmicx_pdma_rx_ring_refill(struct pdma_hw *hw, struct pdma_rx_queue *rxq) int unused = cmicx_pdma_rx_ring_unused(rxq); dma_addr_t addr; uint32_t halt; + int retry; int rv; for (halt = rxq->halt; halt < rxq->halt + unused; halt++) { pbuf = &rxq->pbuf[halt % rxq->nb_desc]; /* Allocate a new pktbuf */ if (!bm->rx_buf_avail(dev, rxq, pbuf)) { - rv = bm->rx_buf_alloc(dev, rxq, pbuf); - if (SHR_FAILURE(rv)) { - rxq->halt = halt % rxq->nb_desc; + retry = 5000000; + do { + rv = bm->rx_buf_alloc(dev, rxq, pbuf); + if (SHR_SUCCESS(rv)) { + break; + } rxq->stats.nomems++; - goto fail; + sal_usleep(1); + } while (retry--); + if (retry <= 0) { + CNET_PR("Fatal error: Rx buffer has not been allocated for 5 seconds\n"); + rxq->halt = halt % rxq->nb_desc; + return rv; } } /* Setup the new descriptor */ @@ -425,11 +434,6 @@ cmicx_pdma_rx_ring_refill(struct pdma_hw *hw, struct pdma_rx_queue *rxq) sal_spinlock_unlock(rxq->lock); return SHR_E_NONE; - -fail: - CNET_PR("RX: Failed to allocate mem\n"); - - return SHR_E_MEMORY; } /*! @@ -453,6 +457,7 @@ cmicx_pdma_rx_ring_clean(struct pdma_hw *hw, struct pdma_rx_queue *rxq, int budg dma_addr_t addr; uint32_t stat, curr; int len, done = 0; + int retry; int rv; curr = rxq->curr; @@ -478,7 +483,7 @@ cmicx_pdma_rx_ring_clean(struct pdma_hw *hw, struct pdma_rx_queue *rxq, int budg pkh = bm->rx_buf_get(dev, rxq, pbuf, len); if (!pkh) { rxq->stats.nomems++; - goto fail; + return SHR_E_MEMORY; } /* Setup packet header */ @@ -520,10 +525,18 @@ cmicx_pdma_rx_ring_clean(struct pdma_hw *hw, struct pdma_rx_queue *rxq, int budg /* Setup the new descriptor */ if (!(rxq->state & PDMA_RX_BATCH_REFILL)) { if (!bm->rx_buf_avail(dev, rxq, pbuf)) { - rv = bm->rx_buf_alloc(dev, rxq, pbuf); - if (SHR_FAILURE(rv)) { + retry = 5000000; + do { + rv = bm->rx_buf_alloc(dev, rxq, pbuf); + if (SHR_SUCCESS(rv)) { + break; + } rxq->stats.nomems++; - goto fail; + sal_usleep(1); + } while (retry--); + if (retry <= 0) { + CNET_PR("Fatal error: Rx buffer has not been allocated for 5 seconds\n"); + return done; } } bm->rx_buf_dma(dev, rxq, pbuf, &addr); @@ -589,11 +602,6 @@ cmicx_pdma_rx_ring_clean(struct pdma_hw *hw, struct pdma_rx_queue *rxq, int budg } } - return done; - -fail: - CNET_PR("RX: Failed to allocate mem\n"); - return done; } @@ -699,7 +707,9 @@ cmicx_pdma_tx_ring_clean(struct pdma_hw *hw, struct pdma_tx_queue *txq, int budg /* Resume Tx if any */ sal_spinlock_lock(txq->lock); - if (cmicx_pdma_tx_ring_unused(txq) && txq->state & PDMA_TX_QUEUE_XOFF) { + if (txq->state & PDMA_TX_QUEUE_XOFF && + txq->state & PDMA_TX_QUEUE_ACTIVE && + cmicx_pdma_tx_ring_unused(txq)) { txq->state &= ~PDMA_TX_QUEUE_XOFF; sal_spinlock_unlock(txq->lock); if (dev->tx_resume) { @@ -839,14 +849,14 @@ cmicx_pdma_pkt_xmit(struct pdma_hw *hw, struct pdma_tx_queue *txq, void *buf) int retry = 5000000; int rv; - if (!(txq->state & PDMA_TX_QUEUE_ACTIVE)) { - return SHR_E_UNAVAIL; - } - if (dev->tx_suspend) { sal_spinlock_lock(txq->mutex); } else { - sal_sem_take(txq->sem, SAL_SEM_FOREVER); + rv = sal_sem_take(txq->sem, BCMCNET_TX_RSRC_WAIT_USEC); + if (rv == -1) { + CNET_PR("Timeout waiting for Tx resources\n"); + return SHR_E_TIMEOUT; + } } /* Check Tx resource */ @@ -955,7 +965,8 @@ cmicx_pdma_pkt_xmit(struct pdma_hw *hw, struct pdma_tx_queue *txq, void *buf) /* In polling mode, must wait till the ring is available */ do { cmicx_pdma_tx_ring_clean(hw, txq, txq->free_thresh); - if (!(txq->state & PDMA_TX_QUEUE_XOFF)) { + if (!(txq->state & PDMA_TX_QUEUE_XOFF) || + !(txq->state & PDMA_TX_QUEUE_ACTIVE)) { break; } sal_usleep(1); diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_cmicd.h b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_cmicd.h index ef9717923e70..3e6ccd035c0f 100644 --- a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_cmicd.h +++ b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_cmicd.h @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_cmicx.h b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_cmicx.h index a8657c8b46a9..9d5369784776 100644 --- a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_cmicx.h +++ b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_cmicx.h @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_core.h b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_core.h index 13db809dda36..e421afd0f35a 100644 --- a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_core.h +++ b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_core.h @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -66,8 +66,10 @@ struct pkt_hdr { #define PDMA_TX_BIND_QUE (1 << 3) /*! Tx cookded header */ #define PDMA_TX_HDR_COOKED (1 << 4) + /*! Tx no pad */ +#define PDMA_TX_NO_PAD (1 << 5) /*! Tx to HNET */ -#define PDMA_TX_TO_HNET (1 << 5) +#define PDMA_TX_TO_HNET (1 << 6) /*! Rx to VNET */ #define PDMA_RX_TO_VNET (1 << 10) /*! Rx strip vlan tag */ @@ -208,16 +210,16 @@ struct dev_ctrl { struct queue_group grp[NUM_GRP_MAX]; /*! Pointers to Rx queues */ - void *rx_queue[NUM_QUE_MAX]; + void *rx_queue[NUM_Q_MAX]; /*! Pointers to Tx queues */ - void *tx_queue[NUM_QUE_MAX]; + void *tx_queue[NUM_Q_MAX]; /*! Pointers to virtual Rx queues */ - void *vnet_rxq[NUM_QUE_MAX]; + void *vnet_rxq[NUM_Q_MAX]; /*! Pointers to virtual Tx queues */ - void *vnet_txq[NUM_QUE_MAX]; + void *vnet_txq[NUM_Q_MAX]; /*! Pointer to buffer manager */ void *buf_mngr; @@ -742,10 +744,10 @@ typedef void (*sys_tx_resume_f)(struct pdma_dev *dev, int queue); * \param [in] group Channel group number. * \param [in] chan Channel number. * \param [in] reg Interrupt enable register. - * \param [in] mask Interrupt mask. + * \param [in] val Interrupt enable register value. */ typedef void (*sys_intr_unmask_f)(struct pdma_dev *dev, int group, int chan, - uint32_t reg, uint32_t mask); + uint32_t reg, uint32_t val); /*! * Disable interrupts. @@ -753,11 +755,11 @@ typedef void (*sys_intr_unmask_f)(struct pdma_dev *dev, int group, int chan, * \param [in] dev Pointer to device structure. * \param [in] group Channel group number. * \param [in] chan Channel number. - * \param [in] reg Interrupt enable register. - * \param [in] mask Interrupt mask. + * \param [in] reg Interrupt disable register. + * \param [in] val Interrupt disable register value. */ typedef void (*sys_intr_mask_f)(struct pdma_dev *dev, int group, int chan, - uint32_t reg, uint32_t mask); + uint32_t reg, uint32_t val); /*! * Wait for notification from the other side. @@ -893,6 +895,8 @@ struct pdma_dev { #define PDMA_DESC_PREFETCH (1 << 4) /*! VNET is docked */ #define PDMA_VNET_DOCKED (1 << 5) + /*! Abort PDMA mode for suspend and resume */ +#define PDMA_ABORT (1 << 6) /*! Device mode */ dev_mode_t mode; @@ -900,6 +904,9 @@ struct pdma_dev { /*! Device is started */ int started; + /*! Device is started but suspended */ + int suspended; + /*! Device is initialized and HMI driver is attached */ int attached; }; @@ -1261,10 +1268,10 @@ bcmcnet_group_intr_ack(struct pdma_dev *dev, int group); * \param [in] dev Device structure point. * \param [in] group Group number. * - * \retval SHR_E_NONE No errors. - * \retval SHR_E_XXXX Operation failed. + * \retval true Interrupt is active. + * \retval false Interrupt is not active. */ -extern int +extern bool bcmcnet_group_intr_check(struct pdma_dev *dev, int group); /*! diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_dev.h b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_dev.h index bc3367b34fae..aa1d47876b95 100644 --- a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_dev.h +++ b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_dev.h @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_internal.h b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_internal.h index e4b2051a34bc..f3602e07c098 100644 --- a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_internal.h +++ b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_internal.h @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -31,6 +31,9 @@ /*! CMICX name */ #define CMICX_DEV_NAME "cmicx" +/*! CMICR name */ +#define CMICR_DEV_NAME "cmicr" + /*! * \brief Allocate descriptor ring buffer. * @@ -83,10 +86,11 @@ typedef void (*rx_buf_dma_f)(struct pdma_dev *dev, struct pdma_rx_queue *rxq, * \param [in] rxq Pointer to Rx queue struture. * \param [in] pbuf Pointer to packet buffer structure. * - * \retval Ture Buffer is available or FALSE. + * \retval true Buffer is available. + * \retval false Buffer is not available. */ -typedef int (*rx_buf_avail_f)(struct pdma_dev *dev, struct pdma_rx_queue *rxq, - struct pdma_rx_buf *pbuf); +typedef bool (*rx_buf_avail_f)(struct pdma_dev *dev, struct pdma_rx_queue *rxq, + struct pdma_rx_buf *pbuf); /*! * \brief Get Rx packet buffer. diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_rxtx.h b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_rxtx.h index eb5834d895b0..197378108c35 100644 --- a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_rxtx.h +++ b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_rxtx.h @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -23,10 +23,15 @@ #ifndef BCMCNET_RXTX_H #define BCMCNET_RXTX_H -/*! Default descriptor number in each ring */ +/*! Default timeout value (us) to wait for Tx resource. */ +#ifndef BCMCNET_TX_RSRC_WAIT_USEC +#define BCMCNET_TX_RSRC_WAIT_USEC 1000000 +#endif + +/*! Default descriptor number in each ring. */ #define NUM_RING_DESC 64 -/*! Maximum number of packets to be handled in one poll call */ +/*! Maximum number of packets to be handled in one poll call. */ #define NUM_RXTX_BUDGET 64 /*! diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_types.h b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_types.h index 42bd9240828b..8992634097c5 100644 --- a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_types.h +++ b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_types.h @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -32,10 +32,10 @@ #define NUM_GRP_MAX 4 /*! Maximum number of queues supported each group */ -#define NUM_Q_PER_GRP 8 +#define NUM_Q_PER_GRP 16 /*! Maximum number of queues supported each device */ -#define NUM_QUE_MAX (NUM_GRP_MAX * NUM_Q_PER_GRP) +#define NUM_Q_MAX (NUM_GRP_MAX * NUM_Q_PER_GRP) /*! Maximum length of jumbo frame */ #define JUMBO_FRAME_LEN_MAX 0xffff @@ -113,13 +113,13 @@ typedef struct bcmcnet_dev_info { uint32_t nb_desc_dflt; /*! Rx buffer size per queue */ - uint32_t rx_buf_size[NUM_QUE_MAX]; + uint32_t rx_buf_size[NUM_Q_MAX]; /*! Number of Rx descriptors per queue */ - uint32_t nb_rx_desc[NUM_QUE_MAX]; + uint32_t nb_rx_desc[NUM_Q_MAX]; /*! Number of Tx descriptors per queue */ - uint32_t nb_tx_desc[NUM_QUE_MAX]; + uint32_t nb_tx_desc[NUM_Q_MAX]; } bcmcnet_dev_info_t; /*! @@ -169,43 +169,43 @@ typedef struct bcmcnet_dev_stats { uint64_t intrs; /*! Number of successfully received packets per queue */ - uint64_t rxq_packets[NUM_QUE_MAX]; + uint64_t rxq_packets[NUM_Q_MAX]; /*! Number of successfully received bytes per queue */ - uint64_t rxq_bytes[NUM_QUE_MAX]; + uint64_t rxq_bytes[NUM_Q_MAX]; /*! Number of dropped packets per queue */ - uint64_t rxq_dropped[NUM_QUE_MAX]; + uint64_t rxq_dropped[NUM_Q_MAX]; /*! Number of erroneous received packets per queue */ - uint64_t rxq_errors[NUM_QUE_MAX]; + uint64_t rxq_errors[NUM_Q_MAX]; /*! Number of error head packets per queue */ - uint64_t rxq_head_errors[NUM_QUE_MAX]; + uint64_t rxq_head_errors[NUM_Q_MAX]; /*! Number of error data packets per queue */ - uint64_t rxq_data_errors[NUM_QUE_MAX]; + uint64_t rxq_data_errors[NUM_Q_MAX]; /*! Number of error cell packets per queue */ - uint64_t rxq_cell_errors[NUM_QUE_MAX]; + uint64_t rxq_cell_errors[NUM_Q_MAX]; /*! Number of RX pktbuf allocation failures per queue */ - uint64_t rxq_nomems[NUM_QUE_MAX]; + uint64_t rxq_nomems[NUM_Q_MAX]; /*! Number of successfully transmitted bytes per queue */ - uint64_t txq_packets[NUM_QUE_MAX]; + uint64_t txq_packets[NUM_Q_MAX]; /*! Number of successfully transmitted bytes per queue */ - uint64_t txq_bytes[NUM_QUE_MAX]; + uint64_t txq_bytes[NUM_Q_MAX]; /*! Number of dropped packets per queue */ - uint64_t txq_dropped[NUM_QUE_MAX]; + uint64_t txq_dropped[NUM_Q_MAX]; /*! Number of failed transmitted packets per queue */ - uint64_t txq_errors[NUM_QUE_MAX]; + uint64_t txq_errors[NUM_Q_MAX]; /*! Number of suspended transmission per queue */ - uint64_t txq_xoffs[NUM_QUE_MAX]; + uint64_t txq_xoffs[NUM_Q_MAX]; } bcmcnet_dev_stats_t; /*! @@ -247,16 +247,16 @@ typedef enum dev_mode_e { */ typedef struct vnet_sync_s { /*! Rx ring address */ - uint64_t rx_ring_addr[NUM_QUE_MAX]; + uint64_t rx_ring_addr[NUM_Q_MAX]; /*! Rx ring size */ - uint32_t rx_ring_size[NUM_QUE_MAX]; + uint32_t rx_ring_size[NUM_Q_MAX]; /*! Tx ring address */ - uint64_t tx_ring_addr[NUM_QUE_MAX]; + uint64_t tx_ring_addr[NUM_Q_MAX]; /*! Tx ring size */ - uint32_t tx_ring_size[NUM_QUE_MAX]; + uint32_t tx_ring_size[NUM_Q_MAX]; } vnet_sync_t; #endif /* BCMCNET_TYPES_H */ diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/main/bcmcnet_core.c b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/main/bcmcnet_core.c index ef4aca7da49e..fec920a935c1 100644 --- a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/main/bcmcnet_core.c +++ b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/main/bcmcnet_core.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -151,11 +151,33 @@ bcmcnet_pdma_dev_stop(struct pdma_dev *dev) int bcmcnet_pdma_dev_suspend(struct pdma_dev *dev) { + struct dev_ctrl *ctrl = &dev->ctrl; + uint32_t qi; + int rv; + if (!dev->attached) { return SHR_E_UNAVAIL; } - return dev->ops->dev_suspend(dev); + rv = dev->ops->dev_suspend(dev); + if (SHR_FAILURE(rv)) { + return rv; + } + + dev->suspended = true; + + if (dev->flags & PDMA_ABORT) { + /* Abort all the Tx queues */ + for (qi = 0; qi < ctrl->nb_txq; qi++) { + dev->ops->tx_queue_stop(dev, qi); + } + /* Abort all the Rx queues */ + for (qi = 0; qi < ctrl->nb_rxq; qi++) { + dev->ops->rx_queue_stop(dev, qi);; + } + } + + return SHR_E_NONE; } /*! @@ -164,11 +186,46 @@ bcmcnet_pdma_dev_suspend(struct pdma_dev *dev) int bcmcnet_pdma_dev_resume(struct pdma_dev *dev) { + struct dev_ctrl *ctrl = &dev->ctrl; + uint32_t qi; + int rv; + if (!dev->attached) { return SHR_E_UNAVAIL; } - return dev->ops->dev_resume(dev); + if (dev->flags & PDMA_ABORT) { + /* + * H/W configuration of Packet DMA is gone in the FFB apply phase, + * so we need to program it again. + */ + dev->ops->dev_config(dev, ctrl->bm_rxq, ctrl->bm_txq); + + /* Restart all the Rx queues */ + for (qi = 0; qi < ctrl->nb_rxq; qi++) { + dev->ops->rx_queue_release(dev, qi); + dev->ops->rx_queue_setup(dev, qi); + dev->ops->rx_queue_intr_enable(dev, qi); + dev->ops->rx_queue_start(dev, qi); + } + /* Restart all the Tx queues */ + for (qi = 0; qi < ctrl->nb_txq; qi++) { + dev->ops->tx_queue_release(dev, qi); + dev->ops->tx_queue_setup(dev, qi); + dev->ops->tx_queue_intr_enable(dev, qi); + dev->ops->tx_queue_start(dev, qi); + } + dev->flags &= ~PDMA_ABORT; + } + + rv = dev->ops->dev_resume(dev); + if (SHR_FAILURE(rv)) { + return rv; + } + + dev->suspended = false; + + return rv; } /*! @@ -614,7 +671,7 @@ bcmcnet_group_intr_ack(struct pdma_dev *dev, int group) /*! * Check interrupt for a queue group */ -int +bool bcmcnet_group_intr_check(struct pdma_dev *dev, int group) { struct dev_ctrl *ctrl = &dev->ctrl; @@ -623,14 +680,14 @@ bcmcnet_group_intr_check(struct pdma_dev *dev, int group) int i; if (!dev->ops) { - return SHR_E_INTERNAL; + return false; } for (i = 0; i < dev->grp_queues; i++) { if (1 << i & grp->bm_rxq) { dev->ops->dev_pq_to_lq(dev, i + group * dev->grp_queues, &queue, &dir); if (dev->ops->rx_queue_intr_check(dev, queue)) { - return TRUE; + return true; } } } @@ -639,12 +696,12 @@ bcmcnet_group_intr_check(struct pdma_dev *dev, int group) if (1 << i & grp->bm_txq) { dev->ops->dev_pq_to_lq(dev, i + group * dev->grp_queues, &queue, &dir); if (dev->ops->tx_queue_intr_check(dev, queue)) { - return TRUE; + return true; } } } - return FALSE; + return false; } /*! @@ -653,6 +710,10 @@ bcmcnet_group_intr_check(struct pdma_dev *dev, int group) int bcmcnet_rx_queue_poll(struct pdma_dev *dev, int queue, int budget) { + if (dev->started == 0) { + return SHR_E_NONE; + } + if (!dev->ops || !dev->ops->rx_queue_poll) { return SHR_E_INTERNAL; } @@ -666,6 +727,10 @@ bcmcnet_rx_queue_poll(struct pdma_dev *dev, int queue, int budget) int bcmcnet_tx_queue_poll(struct pdma_dev *dev, int queue, int budget) { + if (dev->started == 0) { + return SHR_E_NONE; + } + if (!dev->ops || !dev->ops->tx_queue_poll) { return SHR_E_INTERNAL; } @@ -679,6 +744,10 @@ bcmcnet_tx_queue_poll(struct pdma_dev *dev, int queue, int budget) int bcmcnet_queue_poll(struct pdma_dev *dev, struct intr_handle *hdl, int budget) { + if (dev->started == 0) { + return SHR_E_NONE; + } + if (hdl->dir == PDMA_Q_RX) { return bcmcnet_rx_queue_poll(dev, hdl->queue, budget); } else { @@ -692,6 +761,10 @@ bcmcnet_queue_poll(struct pdma_dev *dev, struct intr_handle *hdl, int budget) int bcmcnet_group_poll(struct pdma_dev *dev, int group, int budget) { + if (dev->started == 0) { + return SHR_E_NONE; + } + if (!dev->ops || !dev->ops->group_poll) { return SHR_E_INTERNAL; } diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/main/bcmcnet_dev.c b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/main/bcmcnet_dev.c index 1f39515a7a62..7b0344e83c30 100644 --- a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/main/bcmcnet_dev.c +++ b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/main/bcmcnet_dev.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -110,6 +110,9 @@ bcn_tx_queues_free(struct pdma_dev *dev) if (!txq) { continue; } + if (txq->sem) { + sal_sem_destroy(txq->sem); + } sal_free(txq); ctrl->grp[gi].tx_queue[qi] = NULL; if (dev->mode == DEV_MODE_HNET && ctrl->grp[gi].vnet_txq[qi]) { @@ -140,6 +143,10 @@ bcn_tx_queues_alloc(struct pdma_dev *dev) txq->group_id = gi; txq->chan_id = qi + gi * dev->grp_queues; txq->ctrl = ctrl; + txq->sem = sal_sem_create("bcmcnetTxMutexSem", SAL_SEM_BINARY, 0); + if (!txq->sem) { + goto error; + } ctrl->grp[gi].tx_queue[qi] = txq; if (dev->mode == DEV_MODE_HNET) { vtxq = sal_alloc(sizeof(*vtxq), "bcmcnetVnetTxQueue"); @@ -610,6 +617,10 @@ bcmcnet_pdma_lq_to_pq(struct pdma_dev *dev, int queue, int dir, int *chan) struct pdma_rx_queue *rxq = NULL; struct pdma_tx_queue *txq = NULL; + if ((uint32_t)queue >= NUM_Q_MAX) { + return SHR_E_PARAM; + } + if (dir == PDMA_Q_RX) { rxq = (struct pdma_rx_queue *)ctrl->rx_queue[queue]; if (rxq->state & PDMA_RX_QUEUE_USED) { @@ -664,8 +675,13 @@ bcmcnet_pdma_rx_queue_start(struct pdma_dev *dev, int queue) struct pdma_hw *hw = (struct pdma_hw *)ctrl->hw; struct pdma_rx_queue *rxq = NULL; + if ((uint32_t)queue >= NUM_Q_MAX) { + return SHR_E_PARAM; + } + rxq = (struct pdma_rx_queue *)ctrl->rx_queue[queue]; rxq->state |= PDMA_RX_QUEUE_ACTIVE; + rxq->state &= ~PDMA_RX_QUEUE_XOFF; return hw->hdls.chan_start(hw, rxq->chan_id); } @@ -680,8 +696,13 @@ bcmcnet_pdma_rx_queue_stop(struct pdma_dev *dev, int queue) struct pdma_hw *hw = (struct pdma_hw *)ctrl->hw; struct pdma_rx_queue *rxq = NULL; + if ((uint32_t)queue >= NUM_Q_MAX) { + return SHR_E_PARAM; + } + rxq = (struct pdma_rx_queue *)ctrl->rx_queue[queue]; rxq->state &= ~PDMA_RX_QUEUE_ACTIVE; + rxq->state |= PDMA_RX_QUEUE_XOFF; return hw->hdls.chan_stop(hw, rxq->chan_id); } @@ -696,8 +717,13 @@ bcmcnet_pdma_tx_queue_start(struct pdma_dev *dev, int queue) struct pdma_hw *hw = (struct pdma_hw *)ctrl->hw; struct pdma_tx_queue *txq = NULL; + if ((uint32_t)queue >= NUM_Q_MAX) { + return SHR_E_PARAM; + } + txq = (struct pdma_tx_queue *)ctrl->tx_queue[queue]; txq->state |= PDMA_TX_QUEUE_ACTIVE; + txq->state &= ~PDMA_TX_QUEUE_XOFF; return dev->flags & PDMA_CHAIN_MODE ? SHR_E_NONE : hw->hdls.chan_start(hw, txq->chan_id); @@ -713,8 +739,13 @@ bcmcnet_pdma_tx_queue_stop(struct pdma_dev *dev, int queue) struct pdma_hw *hw = (struct pdma_hw *)ctrl->hw; struct pdma_tx_queue *txq = NULL; + if ((uint32_t)queue >= NUM_Q_MAX) { + return SHR_E_PARAM; + } + txq = (struct pdma_tx_queue *)ctrl->tx_queue[queue]; txq->state &= ~PDMA_TX_QUEUE_ACTIVE; + txq->state |= PDMA_TX_QUEUE_XOFF; return hw->hdls.chan_stop(hw, txq->chan_id); } @@ -729,6 +760,10 @@ bcmcnet_pdma_rx_queue_intr_enable(struct pdma_dev *dev, int queue) struct pdma_hw *hw = (struct pdma_hw *)ctrl->hw; struct pdma_rx_queue *rxq = NULL; + if ((uint32_t)queue >= NUM_Q_MAX) { + return SHR_E_PARAM; + } + rxq = (struct pdma_rx_queue *)ctrl->rx_queue[queue]; return hw->hdls.chan_intr_enable(hw, rxq->chan_id); @@ -744,6 +779,10 @@ bcmcnet_pdma_rx_queue_intr_disable(struct pdma_dev *dev, int queue) struct pdma_hw *hw = (struct pdma_hw *)ctrl->hw; struct pdma_rx_queue *rxq = NULL; + if ((uint32_t)queue >= NUM_Q_MAX) { + return SHR_E_PARAM; + } + rxq = (struct pdma_rx_queue *)ctrl->rx_queue[queue]; return hw->hdls.chan_intr_disable(hw, rxq->chan_id); @@ -759,6 +798,10 @@ bcmcnet_pdma_rx_queue_intr_ack(struct pdma_dev *dev, int queue) struct pdma_hw *hw = (struct pdma_hw *)ctrl->hw; struct pdma_rx_queue *rxq = NULL; + if ((uint32_t)queue >= NUM_Q_MAX) { + return SHR_E_PARAM; + } + rxq = (struct pdma_rx_queue *)ctrl->rx_queue[queue]; return hw->hdls.chan_clear(hw, rxq->chan_id); @@ -774,6 +817,10 @@ bcmcnet_pdma_rx_queue_intr_query(struct pdma_dev *dev, int queue) struct pdma_hw *hw = (struct pdma_hw *)ctrl->hw; struct pdma_rx_queue *rxq = NULL; + if ((uint32_t)queue >= NUM_Q_MAX) { + return SHR_E_PARAM; + } + rxq = (struct pdma_rx_queue *)ctrl->rx_queue[queue]; return hw->hdls.chan_intr_query(hw, rxq->chan_id); @@ -789,6 +836,10 @@ bcmcnet_pdma_rx_queue_intr_check(struct pdma_dev *dev, int queue) struct pdma_hw *hw = (struct pdma_hw *)ctrl->hw; struct pdma_rx_queue *rxq = NULL; + if ((uint32_t)queue >= NUM_Q_MAX) { + return SHR_E_PARAM; + } + rxq = (struct pdma_rx_queue *)ctrl->rx_queue[queue]; return hw->hdls.chan_intr_check(hw, rxq->chan_id); @@ -987,7 +1038,8 @@ bcmcnet_pdma_rx_queue_int_coalesce(struct pdma_dev *dev, int queue, int count, i struct pdma_hw *hw = (struct pdma_hw *)ctrl->hw; struct pdma_rx_queue *rxq = NULL; - if ((uint32_t)queue >= ctrl->nb_rxq) { + if ((uint32_t)queue >= NUM_Q_MAX || + (uint32_t)queue >= ctrl->nb_rxq) { return SHR_E_PARAM; } @@ -1008,7 +1060,8 @@ bcmcnet_pdma_tx_queue_int_coalesce(struct pdma_dev *dev, int queue, int count, i struct pdma_hw *hw = (struct pdma_hw *)ctrl->hw; struct pdma_tx_queue *txq = NULL; - if ((uint32_t)queue >= ctrl->nb_txq) { + if ((uint32_t)queue >= NUM_Q_MAX || + (uint32_t)queue >= ctrl->nb_txq) { return SHR_E_PARAM; } @@ -1029,7 +1082,8 @@ bcmcnet_pdma_rx_queue_reg_dump(struct pdma_dev *dev, int queue) struct pdma_hw *hw = (struct pdma_hw *)ctrl->hw; struct pdma_rx_queue *rxq = NULL; - if ((uint32_t)queue >= ctrl->nb_rxq) { + if ((uint32_t)queue >= NUM_Q_MAX || + (uint32_t)queue >= ctrl->nb_rxq) { return SHR_E_PARAM; } @@ -1048,7 +1102,8 @@ bcmcnet_pdma_tx_queue_reg_dump(struct pdma_dev *dev, int queue) struct pdma_hw *hw = (struct pdma_hw *)ctrl->hw; struct pdma_tx_queue *txq = NULL; - if ((uint32_t)queue >= ctrl->nb_txq) { + if ((uint32_t)queue >= NUM_Q_MAX || + (uint32_t)queue >= ctrl->nb_txq) { return SHR_E_PARAM; } diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/main/bcmcnet_rxtx.c b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/main/bcmcnet_rxtx.c index cfabe9d95d56..41504949876b 100644 --- a/platform/broadcom/saibcm-modules/sdklt/bcmcnet/main/bcmcnet_rxtx.c +++ b/platform/broadcom/saibcm-modules/sdklt/bcmcnet/main/bcmcnet_rxtx.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -97,11 +97,6 @@ bcn_tx_ring_free(struct pdma_tx_queue *txq) struct dev_ctrl *ctrl = txq->ctrl; struct pdma_buf_mngr *bm = (struct pdma_buf_mngr *)ctrl->buf_mngr; - if (txq->sem) { - sal_sem_destroy(txq->sem); - txq->sem = NULL; - } - if (txq->mutex) { sal_spinlock_destroy(txq->mutex); txq->mutex = NULL; @@ -158,11 +153,6 @@ bcn_tx_ring_alloc(struct pdma_tx_queue *txq) goto cleanup; } - txq->sem = sal_sem_create("bcmcnetTxMutexSem", SAL_SEM_BINARY, 0); - if (!txq->sem) { - goto cleanup; - } - return SHR_E_NONE; cleanup: @@ -546,8 +536,8 @@ bcmcnet_pdma_tx_queue_xmit(struct pdma_dev *dev, int queue, void *buf) struct pdma_tx_queue *txq = NULL; txq = (struct pdma_tx_queue *)ctrl->tx_queue[queue]; - if (!txq || !(txq->state & PDMA_TX_QUEUE_ACTIVE)) { - return SHR_E_UNAVAIL; + if (!txq || (!(txq->state & PDMA_TX_QUEUE_ACTIVE) && !dev->suspended)) { + return SHR_E_DISABLED; } return hw->dops.pkt_xmit(hw, txq, buf); diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmdrd/include/bcmdrd/bcmdrd_devlist.h b/platform/broadcom/saibcm-modules/sdklt/bcmdrd/include/bcmdrd/bcmdrd_devlist.h index 675b9426ea01..4a2384760820 100644 --- a/platform/broadcom/saibcm-modules/sdklt/bcmdrd/include/bcmdrd/bcmdrd_devlist.h +++ b/platform/broadcom/saibcm-modules/sdklt/bcmdrd/include/bcmdrd/bcmdrd_devlist.h @@ -4,7 +4,7 @@ * Edits to this file will be lost when it is regenerated. * Tool: INTERNAL/drd/instpkgs.pl * - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -52,11 +52,21 @@ #define BCM56784_DEVICE_ID 0xb784 #define BCM56784_REV_A0 0x01 +/* BCM56785 */ +#define BCM56785_VENDOR_ID 0x14e4 +#define BCM56785_DEVICE_ID 0xb785 +#define BCM56785_REV_A0 0x01 + /* BCM56786 */ #define BCM56786_VENDOR_ID 0x14e4 #define BCM56786_DEVICE_ID 0xb786 #define BCM56786_REV_A0 0x01 +/* BCM56787 */ +#define BCM56787_VENDOR_ID 0x14e4 +#define BCM56787_DEVICE_ID 0xb787 +#define BCM56787_REV_A0 0x01 + /* BCM56788 */ #define BCM56788_VENDOR_ID 0x14e4 #define BCM56788_DEVICE_ID 0xb788 @@ -85,32 +95,43 @@ #define BCM56883_REV_A0 0x01 #define BCM56883_REV_B0 0x11 -/* BCM56889 */ -#define BCM56889_VENDOR_ID 0x14e4 -#define BCM56889_DEVICE_ID 0xb889 -#define BCM56889_REV_A0 0x01 -#define BCM56889_REV_B0 0x11 - /* BCM56990 */ #define BCM56990_VENDOR_ID 0x14e4 #define BCM56990_DEVICE_ID 0xb990 #define BCM56990_REV_A0 0x01 #define BCM56990_REV_B0 0x11 +/* BCM56991 */ +#define BCM56991_VENDOR_ID 0x14e4 +#define BCM56991_DEVICE_ID 0xb991 +#define BCM56991_REV_B0 0x11 + /* BCM56992 */ #define BCM56992_VENDOR_ID 0x14e4 #define BCM56992_DEVICE_ID 0xb992 #define BCM56992_REV_B0 0x11 +/* BCM56995 */ +#define BCM56995_VENDOR_ID 0x14e4 +#define BCM56995_DEVICE_ID 0xb995 +#define BCM56995_REV_A0 0x01 + /* BCM56996 */ #define BCM56996_VENDOR_ID 0x14e4 #define BCM56996_DEVICE_ID 0xb996 #define BCM56996_REV_A0 0x01 +#define BCM56996_REV_B0 0x11 /* BCM56997 */ #define BCM56997_VENDOR_ID 0x14e4 #define BCM56997_DEVICE_ID 0xb997 #define BCM56997_REV_A0 0x01 +#define BCM56997_REV_B0 0x11 + +/* BCM56998 */ +#define BCM56998_VENDOR_ID 0x14e4 +#define BCM56998_DEVICE_ID 0xb998 +#define BCM56998_REV_A0 0x01 /* * End of Supported Devices and Revisions @@ -173,6 +194,16 @@ BCMDRD_DEVLIST_ENTRY(BCM56784, BCM56784_VENDOR_ID, BCM56784_DEVICE_ID, BCM56784_ #endif #endif +#if BCMDRD_CONFIG_INCLUDE_BCM56785_A0 == 1 || defined(BCMDRD_DEVLIST_OVERRIDE) +#ifdef BCMDRD_DEVLIST_INCLUDE_ALL +BCMDRD_DEVLIST_ENTRY(BCM56785, BCM56785_VENDOR_ID, BCM56785_DEVICE_ID, BCM56785_REV_A0, \ + 0, 0, \ + bcm56780_a0, bcm56785_a0, bcm56785_a0, \ + "Trident4-X9", "BCM56780", \ + "5.6 Tb/s 96x50G-PAM4/32x35G-NRZ Programmable Switch w/SmartToR", 0, 0) +#endif +#endif + #if BCMDRD_CONFIG_INCLUDE_BCM56786_A0 == 1 || defined(BCMDRD_DEVLIST_OVERRIDE) #ifdef BCMDRD_DEVLIST_INCLUDE_ALL BCMDRD_DEVLIST_ENTRY(BCM56786, BCM56786_VENDOR_ID, BCM56786_DEVICE_ID, BCM56786_REV_A0, \ @@ -183,13 +214,23 @@ BCMDRD_DEVLIST_ENTRY(BCM56786, BCM56786_VENDOR_ID, BCM56786_DEVICE_ID, BCM56786_ #endif #endif +#if BCMDRD_CONFIG_INCLUDE_BCM56787_A0 == 1 || defined(BCMDRD_DEVLIST_OVERRIDE) +#ifdef BCMDRD_DEVLIST_INCLUDE_ALL +BCMDRD_DEVLIST_ENTRY(BCM56787, BCM56787_VENDOR_ID, BCM56787_DEVICE_ID, BCM56787_REV_A0, \ + 0, 0, \ + bcm56780_a0, bcm56787_a0, bcm56787_a0, \ + "Trident4-X9", "BCM56780", \ + "5.6 Tb/s 96x50G-PAM4/32x35G-NRZ Programmable Switch w/MACsec w/SmartToR", 0, 0) +#endif +#endif + #if BCMDRD_CONFIG_INCLUDE_BCM56788_A0 == 1 || defined(BCMDRD_DEVLIST_OVERRIDE) #ifdef BCMDRD_DEVLIST_INCLUDE_ALL BCMDRD_DEVLIST_ENTRY(BCM56788, BCM56788_VENDOR_ID, BCM56788_DEVICE_ID, BCM56788_REV_A0, \ 0, 0, \ bcm56780_a0, bcm56788_a0, bcm56788_a0, \ "Trident4-X9", "BCM56780", \ - "8 Tb/s 160x50G-PAM4 Programmable Switch w/MACsec w/MTop", 0, 0) + "8 Tb/s 160x50G-PAM4 Programmable Switch w/MACsec w/SmartToR", 0, 0) #endif #endif @@ -199,7 +240,7 @@ BCMDRD_DEVLIST_ENTRY(BCM56789, BCM56789_VENDOR_ID, BCM56789_DEVICE_ID, BCM56789_ 0, 0, \ bcm56780_a0, bcm56789_a0, bcm56789_a0, \ "Trident4-X9", "BCM56780", \ - "8 Tb/s 160x50G-PAM4 Programmable Switch w/MTop", 0, 0) + "8 Tb/s 160x50G-PAM4 Programmable Switch w/SmartToR", 0, 0) #endif #endif @@ -261,26 +302,6 @@ BCMDRD_DEVLIST_ENTRY(BCM56883, BCM56883_VENDOR_ID, BCM56883_DEVICE_ID, BCM56883_ #endif #endif -#if BCMDRD_CONFIG_INCLUDE_BCM56889_A0 == 1 || defined(BCMDRD_DEVLIST_OVERRIDE) -#ifdef BCMDRD_DEVLIST_INCLUDE_ALL -BCMDRD_DEVLIST_ENTRY(BCM56889, BCM56889_VENDOR_ID, BCM56889_DEVICE_ID, BCM56889_REV_A0, \ - 0, 0, \ - bcm56880_a0, bcm56889_a0, bcm56889_a0, \ - "Trident4", "BCM56880", \ - "12.8 Tb/s Switch Fabric 128x100G/64x200G/32x400G Multilayer Switch", 0, 0) -#endif -#endif - -#if BCMDRD_CONFIG_INCLUDE_BCM56889_B0 == 1 || defined(BCMDRD_DEVLIST_OVERRIDE) -#ifdef BCMDRD_DEVLIST_INCLUDE_ALL -BCMDRD_DEVLIST_ENTRY(BCM56889, BCM56889_VENDOR_ID, BCM56889_DEVICE_ID, BCM56889_REV_B0, \ - 0, 0, \ - bcm56880_a0, bcm56889_a0, bcm56889_b0, \ - "Trident4", "BCM56880", \ - "12.8 Tb/s Switch Fabric 128x100G/64x200G/32x400G Multilayer Switch", 0, 0) -#endif -#endif - #if BCMDRD_CONFIG_INCLUDE_BCM56990_A0 == 1 || defined(BCMDRD_DEVLIST_OVERRIDE) BCMDRD_DEVLIST_ENTRY(BCM56990, BCM56990_VENDOR_ID, BCM56990_DEVICE_ID, BCM56990_REV_A0, \ 0, 0, \ @@ -297,6 +318,16 @@ BCMDRD_DEVLIST_ENTRY(BCM56990, BCM56990_VENDOR_ID, BCM56990_DEVICE_ID, BCM56990_ "25.6 Tbps Multilayer Switch", 0, 0) #endif +#if BCMDRD_CONFIG_INCLUDE_BCM56991_B0 == 1 || defined(BCMDRD_DEVLIST_OVERRIDE) +#ifdef BCMDRD_DEVLIST_INCLUDE_ALL +BCMDRD_DEVLIST_ENTRY(BCM56991, BCM56991_VENDOR_ID, BCM56991_DEVICE_ID, BCM56991_REV_B0, \ + 0, 0, \ + bcm56990_b0, bcm56991_b0, bcm56991_b0, \ + "Tomahawk4", "BCM56990", \ + "25.6 Tbps Multilayer Switch", 0, 0) +#endif +#endif + #if BCMDRD_CONFIG_INCLUDE_BCM56992_B0 == 1 || defined(BCMDRD_DEVLIST_OVERRIDE) #ifdef BCMDRD_DEVLIST_INCLUDE_ALL BCMDRD_DEVLIST_ENTRY(BCM56992, BCM56992_VENDOR_ID, BCM56992_DEVICE_ID, BCM56992_REV_B0, \ @@ -307,6 +338,14 @@ BCMDRD_DEVLIST_ENTRY(BCM56992, BCM56992_VENDOR_ID, BCM56992_DEVICE_ID, BCM56992_ #endif #endif +#if BCMDRD_CONFIG_INCLUDE_BCM56995_A0 == 1 || defined(BCMDRD_DEVLIST_OVERRIDE) +BCMDRD_DEVLIST_ENTRY(BCM56995, BCM56995_VENDOR_ID, BCM56995_DEVICE_ID, BCM56995_REV_A0, \ + 0, 0, \ + bcm56995_a0, bcm56995_a0, bcm56995_a0, \ + "Tomahawk4D", "BCM56995", \ + "25.6 Tbps Multilayer Switch", 0, 0) +#endif + #if BCMDRD_CONFIG_INCLUDE_BCM56996_A0 == 1 || defined(BCMDRD_DEVLIST_OVERRIDE) BCMDRD_DEVLIST_ENTRY(BCM56996, BCM56996_VENDOR_ID, BCM56996_DEVICE_ID, BCM56996_REV_A0, \ 0, 0, \ @@ -315,6 +354,14 @@ BCMDRD_DEVLIST_ENTRY(BCM56996, BCM56996_VENDOR_ID, BCM56996_DEVICE_ID, BCM56996_ "25.6 Tbps Multilayer Switch", 0, 0) #endif +#if BCMDRD_CONFIG_INCLUDE_BCM56996_B0 == 1 || defined(BCMDRD_DEVLIST_OVERRIDE) +BCMDRD_DEVLIST_ENTRY(BCM56996, BCM56996_VENDOR_ID, BCM56996_DEVICE_ID, BCM56996_REV_B0, \ + 0, 0, \ + bcm56996_b0, bcm56996_b0, bcm56996_b0, \ + "Tomahawk4G", "BCM56996", \ + "25.6 Tbps Multilayer Switch", 0, 0) +#endif + #if BCMDRD_CONFIG_INCLUDE_BCM56997_A0 == 1 || defined(BCMDRD_DEVLIST_OVERRIDE) #ifdef BCMDRD_DEVLIST_INCLUDE_ALL BCMDRD_DEVLIST_ENTRY(BCM56997, BCM56997_VENDOR_ID, BCM56997_DEVICE_ID, BCM56997_REV_A0, \ @@ -325,6 +372,24 @@ BCMDRD_DEVLIST_ENTRY(BCM56997, BCM56997_VENDOR_ID, BCM56997_DEVICE_ID, BCM56997_ #endif #endif +#if BCMDRD_CONFIG_INCLUDE_BCM56997_B0 == 1 || defined(BCMDRD_DEVLIST_OVERRIDE) +#ifdef BCMDRD_DEVLIST_INCLUDE_ALL +BCMDRD_DEVLIST_ENTRY(BCM56997, BCM56997_VENDOR_ID, BCM56997_DEVICE_ID, BCM56997_REV_B0, \ + 0, 0, \ + bcm56996_b0, bcm56997_b0, bcm56997_b0, \ + "Tomahawk4G", "BCM56996", \ + "12.8 Tbps Multilayer Switch", 0, 0) +#endif +#endif + +#if BCMDRD_CONFIG_INCLUDE_BCM56998_A0 == 1 || defined(BCMDRD_DEVLIST_OVERRIDE) +BCMDRD_DEVLIST_ENTRY(BCM56998, BCM56998_VENDOR_ID, BCM56998_DEVICE_ID, BCM56998_REV_A0, \ + 0, 0, \ + bcm56998_a0, bcm56998_a0, bcm56998_a0, \ + "Tomahawk4GT", "BCM56998", \ + "12.8 Tbps Multilayer Switch", 0, 0) +#endif + /* End BCMDRD_DEVLIST_ENTRY Macros */ #ifdef BCMDRD_DEVLIST_INCLUDE_ALL diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmdrd/include/bcmdrd_config.h b/platform/broadcom/saibcm-modules/sdklt/bcmdrd/include/bcmdrd_config.h index 68e5a0891098..42b1d5619aee 100644 --- a/platform/broadcom/saibcm-modules/sdklt/bcmdrd/include/bcmdrd_config.h +++ b/platform/broadcom/saibcm-modules/sdklt/bcmdrd/include/bcmdrd_config.h @@ -1,5 +1,5 @@ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -67,7 +67,7 @@ /* Maximum number of ports per chip supported */ #ifndef BCMDRD_CONFIG_MAX_PORTS -#define BCMDRD_CONFIG_MAX_PORTS 576 +#define BCMDRD_CONFIG_MAX_PORTS 848 #endif /* Maximum number of SCHAN polls */ diff --git a/platform/broadcom/saibcm-modules/sdklt/bcmdrd/include/bcmdrd_config_chips.h b/platform/broadcom/saibcm-modules/sdklt/bcmdrd/include/bcmdrd_config_chips.h index 5b45879c90e9..41fb6c64a141 100644 --- a/platform/broadcom/saibcm-modules/sdklt/bcmdrd/include/bcmdrd_config_chips.h +++ b/platform/broadcom/saibcm-modules/sdklt/bcmdrd/include/bcmdrd_config_chips.h @@ -4,7 +4,7 @@ * Edits to this file will be lost when it is regenerated. * Tool: INTERNAL/drd/instpkgs.pl * - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -130,6 +130,34 @@ #endif +/* + * BCM56785 + */ + +/* Sets the default include state if it was not given */ +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56785 +#define BCMDRD_CONFIG_INCLUDE_BCM56785 BCMDRD_CONFIG_INCLUDE_CHIP_DEFAULT +#endif +/* Resolve revision dependencies */ +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56785_Ax +#define BCMDRD_CONFIG_INCLUDE_BCM56785_Ax BCMDRD_CONFIG_INCLUDE_BCM56785 +#endif +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56785_A0 +#define BCMDRD_CONFIG_INCLUDE_BCM56785_A0 BCMDRD_CONFIG_INCLUDE_BCM56785_Ax +#endif +/* Resolve all interchip dependencies */ +#if BCMDRD_CONFIG_INCLUDE_BCM56785_A0 == 1 +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56780_A0 +#define BCMDRD_CONFIG_INCLUDE_BCM56780_A0 BCMDRD_CONFIG_INCLUDE_CHIP_DEFAULT +#endif +#if BCMDRD_CONFIG_INCLUDE_BCM56780_A0 != 1 +#undef BCMDRD_CONFIG_INCLUDE_BCM56780_A0 +#define BCMDRD_CONFIG_INCLUDE_BCM56780_A0 1 +#define BCMDRD_CONFIG_INCLUDE_BCM56780_A0_IMPLIED 1 +#endif +#endif + + /* * BCM56786 */ @@ -158,6 +186,34 @@ #endif +/* + * BCM56787 + */ + +/* Sets the default include state if it was not given */ +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56787 +#define BCMDRD_CONFIG_INCLUDE_BCM56787 BCMDRD_CONFIG_INCLUDE_CHIP_DEFAULT +#endif +/* Resolve revision dependencies */ +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56787_Ax +#define BCMDRD_CONFIG_INCLUDE_BCM56787_Ax BCMDRD_CONFIG_INCLUDE_BCM56787 +#endif +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56787_A0 +#define BCMDRD_CONFIG_INCLUDE_BCM56787_A0 BCMDRD_CONFIG_INCLUDE_BCM56787_Ax +#endif +/* Resolve all interchip dependencies */ +#if BCMDRD_CONFIG_INCLUDE_BCM56787_A0 == 1 +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56780_A0 +#define BCMDRD_CONFIG_INCLUDE_BCM56780_A0 BCMDRD_CONFIG_INCLUDE_CHIP_DEFAULT +#endif +#if BCMDRD_CONFIG_INCLUDE_BCM56780_A0 != 1 +#undef BCMDRD_CONFIG_INCLUDE_BCM56780_A0 +#define BCMDRD_CONFIG_INCLUDE_BCM56780_A0 1 +#define BCMDRD_CONFIG_INCLUDE_BCM56780_A0_IMPLIED 1 +#endif +#endif + + /* * BCM56788 */ @@ -331,66 +387,53 @@ /* - * BCM56889 + * BCM56990 */ /* Sets the default include state if it was not given */ -#ifndef BCMDRD_CONFIG_INCLUDE_BCM56889 -#define BCMDRD_CONFIG_INCLUDE_BCM56889 BCMDRD_CONFIG_INCLUDE_CHIP_DEFAULT +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56990 +#define BCMDRD_CONFIG_INCLUDE_BCM56990 BCMDRD_CONFIG_INCLUDE_CHIP_DEFAULT #endif /* Resolve revision dependencies */ -#ifndef BCMDRD_CONFIG_INCLUDE_BCM56889_Ax -#define BCMDRD_CONFIG_INCLUDE_BCM56889_Ax BCMDRD_CONFIG_INCLUDE_BCM56889 -#endif -#ifndef BCMDRD_CONFIG_INCLUDE_BCM56889_A0 -#define BCMDRD_CONFIG_INCLUDE_BCM56889_A0 BCMDRD_CONFIG_INCLUDE_BCM56889_Ax -#endif -#ifndef BCMDRD_CONFIG_INCLUDE_BCM56889_Bx -#define BCMDRD_CONFIG_INCLUDE_BCM56889_Bx BCMDRD_CONFIG_INCLUDE_BCM56889 -#endif -#ifndef BCMDRD_CONFIG_INCLUDE_BCM56889_B0 -#define BCMDRD_CONFIG_INCLUDE_BCM56889_B0 BCMDRD_CONFIG_INCLUDE_BCM56889_Bx -#endif -/* Resolve all interchip dependencies */ -#if BCMDRD_CONFIG_INCLUDE_BCM56889_A0 == 1 -#ifndef BCMDRD_CONFIG_INCLUDE_BCM56880_A0 -#define BCMDRD_CONFIG_INCLUDE_BCM56880_A0 BCMDRD_CONFIG_INCLUDE_CHIP_DEFAULT -#endif -#if BCMDRD_CONFIG_INCLUDE_BCM56880_A0 != 1 -#undef BCMDRD_CONFIG_INCLUDE_BCM56880_A0 -#define BCMDRD_CONFIG_INCLUDE_BCM56880_A0 1 -#define BCMDRD_CONFIG_INCLUDE_BCM56880_A0_IMPLIED 1 +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56990_Ax +#define BCMDRD_CONFIG_INCLUDE_BCM56990_Ax BCMDRD_CONFIG_INCLUDE_BCM56990 #endif +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56990_A0 +#define BCMDRD_CONFIG_INCLUDE_BCM56990_A0 BCMDRD_CONFIG_INCLUDE_BCM56990_Ax #endif -#if BCMDRD_CONFIG_INCLUDE_BCM56889_B0 == 1 -#if BCMDRD_CONFIG_INCLUDE_BCM56880_A0 != 1 -#undef BCMDRD_CONFIG_INCLUDE_BCM56880_A0 -#define BCMDRD_CONFIG_INCLUDE_BCM56880_A0 1 -#define BCMDRD_CONFIG_INCLUDE_BCM56880_A0_IMPLIED 1 +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56990_Bx +#define BCMDRD_CONFIG_INCLUDE_BCM56990_Bx BCMDRD_CONFIG_INCLUDE_BCM56990 #endif +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56990_B0 +#define BCMDRD_CONFIG_INCLUDE_BCM56990_B0 BCMDRD_CONFIG_INCLUDE_BCM56990_Bx #endif /* - * BCM56990 + * BCM56991 */ /* Sets the default include state if it was not given */ -#ifndef BCMDRD_CONFIG_INCLUDE_BCM56990 -#define BCMDRD_CONFIG_INCLUDE_BCM56990 BCMDRD_CONFIG_INCLUDE_CHIP_DEFAULT +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56991 +#define BCMDRD_CONFIG_INCLUDE_BCM56991 BCMDRD_CONFIG_INCLUDE_CHIP_DEFAULT #endif /* Resolve revision dependencies */ -#ifndef BCMDRD_CONFIG_INCLUDE_BCM56990_Ax -#define BCMDRD_CONFIG_INCLUDE_BCM56990_Ax BCMDRD_CONFIG_INCLUDE_BCM56990 +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56991_Bx +#define BCMDRD_CONFIG_INCLUDE_BCM56991_Bx BCMDRD_CONFIG_INCLUDE_BCM56991 #endif -#ifndef BCMDRD_CONFIG_INCLUDE_BCM56990_A0 -#define BCMDRD_CONFIG_INCLUDE_BCM56990_A0 BCMDRD_CONFIG_INCLUDE_BCM56990_Ax -#endif -#ifndef BCMDRD_CONFIG_INCLUDE_BCM56990_Bx -#define BCMDRD_CONFIG_INCLUDE_BCM56990_Bx BCMDRD_CONFIG_INCLUDE_BCM56990 +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56991_B0 +#define BCMDRD_CONFIG_INCLUDE_BCM56991_B0 BCMDRD_CONFIG_INCLUDE_BCM56991_Bx #endif +/* Resolve all interchip dependencies */ +#if BCMDRD_CONFIG_INCLUDE_BCM56991_B0 == 1 #ifndef BCMDRD_CONFIG_INCLUDE_BCM56990_B0 -#define BCMDRD_CONFIG_INCLUDE_BCM56990_B0 BCMDRD_CONFIG_INCLUDE_BCM56990_Bx +#define BCMDRD_CONFIG_INCLUDE_BCM56990_B0 BCMDRD_CONFIG_INCLUDE_CHIP_DEFAULT +#endif +#if BCMDRD_CONFIG_INCLUDE_BCM56990_B0 != 1 +#undef BCMDRD_CONFIG_INCLUDE_BCM56990_B0 +#define BCMDRD_CONFIG_INCLUDE_BCM56990_B0 1 +#define BCMDRD_CONFIG_INCLUDE_BCM56990_B0_IMPLIED 1 +#endif #endif @@ -422,6 +465,23 @@ #endif +/* + * BCM56995 + */ + +/* Sets the default include state if it was not given */ +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56995 +#define BCMDRD_CONFIG_INCLUDE_BCM56995 BCMDRD_CONFIG_INCLUDE_CHIP_DEFAULT +#endif +/* Resolve revision dependencies */ +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56995_Ax +#define BCMDRD_CONFIG_INCLUDE_BCM56995_Ax BCMDRD_CONFIG_INCLUDE_BCM56995 +#endif +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56995_A0 +#define BCMDRD_CONFIG_INCLUDE_BCM56995_A0 BCMDRD_CONFIG_INCLUDE_BCM56995_Ax +#endif + + /* * BCM56996 */ @@ -437,6 +497,12 @@ #ifndef BCMDRD_CONFIG_INCLUDE_BCM56996_A0 #define BCMDRD_CONFIG_INCLUDE_BCM56996_A0 BCMDRD_CONFIG_INCLUDE_BCM56996_Ax #endif +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56996_Bx +#define BCMDRD_CONFIG_INCLUDE_BCM56996_Bx BCMDRD_CONFIG_INCLUDE_BCM56996 +#endif +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56996_B0 +#define BCMDRD_CONFIG_INCLUDE_BCM56996_B0 BCMDRD_CONFIG_INCLUDE_BCM56996_Bx +#endif /* @@ -454,6 +520,12 @@ #ifndef BCMDRD_CONFIG_INCLUDE_BCM56997_A0 #define BCMDRD_CONFIG_INCLUDE_BCM56997_A0 BCMDRD_CONFIG_INCLUDE_BCM56997_Ax #endif +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56997_Bx +#define BCMDRD_CONFIG_INCLUDE_BCM56997_Bx BCMDRD_CONFIG_INCLUDE_BCM56997 +#endif +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56997_B0 +#define BCMDRD_CONFIG_INCLUDE_BCM56997_B0 BCMDRD_CONFIG_INCLUDE_BCM56997_Bx +#endif /* Resolve all interchip dependencies */ #if BCMDRD_CONFIG_INCLUDE_BCM56997_A0 == 1 #ifndef BCMDRD_CONFIG_INCLUDE_BCM56996_A0 @@ -465,6 +537,33 @@ #define BCMDRD_CONFIG_INCLUDE_BCM56996_A0_IMPLIED 1 #endif #endif +#if BCMDRD_CONFIG_INCLUDE_BCM56997_B0 == 1 +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56996_B0 +#define BCMDRD_CONFIG_INCLUDE_BCM56996_B0 BCMDRD_CONFIG_INCLUDE_CHIP_DEFAULT +#endif +#if BCMDRD_CONFIG_INCLUDE_BCM56996_B0 != 1 +#undef BCMDRD_CONFIG_INCLUDE_BCM56996_B0 +#define BCMDRD_CONFIG_INCLUDE_BCM56996_B0 1 +#define BCMDRD_CONFIG_INCLUDE_BCM56996_B0_IMPLIED 1 +#endif +#endif + + +/* + * BCM56998 + */ + +/* Sets the default include state if it was not given */ +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56998 +#define BCMDRD_CONFIG_INCLUDE_BCM56998 BCMDRD_CONFIG_INCLUDE_CHIP_DEFAULT +#endif +/* Resolve revision dependencies */ +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56998_Ax +#define BCMDRD_CONFIG_INCLUDE_BCM56998_Ax BCMDRD_CONFIG_INCLUDE_BCM56998 +#endif +#ifndef BCMDRD_CONFIG_INCLUDE_BCM56998_A0 +#define BCMDRD_CONFIG_INCLUDE_BCM56998_A0 BCMDRD_CONFIG_INCLUDE_BCM56998_Ax +#endif #endif /* BCMDRD_CONFIG_CHIPS_H */ @@ -486,9 +585,15 @@ CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56782_A0) CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56784) CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56784_Ax) CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56784_A0) +CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56785) +CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56785_Ax) +CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56785_A0) CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56786) CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56786_Ax) CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56786_A0) +CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56787) +CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56787_Ax) +CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56787_A0) CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56788) CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56788_Ax) CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56788_A0) @@ -513,11 +618,6 @@ CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56883_Ax) CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56883_A0) CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56883_Bx) CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56883_B0) -CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56889) -CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56889_Ax) -CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56889_A0) -CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56889_Bx) -CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56889_B0) CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56990) CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56990_Ax) CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56990_A0) @@ -529,17 +629,39 @@ CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56990_A0_IMPLIED) #ifdef BCMDRD_CONFIG_INCLUDE_BCM56990_B0_IMPLIED CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56990_B0_IMPLIED) #endif +CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56991) +CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56991_Bx) +CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56991_B0) CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56992) CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56992_Bx) CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56992_B0) +CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56995) +CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56995_Ax) +CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56995_A0) +#ifdef BCMDRD_CONFIG_INCLUDE_BCM56995_A0_IMPLIED +CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56995_A0_IMPLIED) +#endif CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56996) CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56996_Ax) CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56996_A0) +CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56996_Bx) +CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56996_B0) #ifdef BCMDRD_CONFIG_INCLUDE_BCM56996_A0_IMPLIED CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56996_A0_IMPLIED) #endif +#ifdef BCMDRD_CONFIG_INCLUDE_BCM56996_B0_IMPLIED +CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56996_B0_IMPLIED) +#endif CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56997) CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56997_Ax) CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56997_A0) +CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56997_Bx) +CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56997_B0) +CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56998) +CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56998_Ax) +CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56998_A0) +#ifdef BCMDRD_CONFIG_INCLUDE_BCM56998_A0_IMPLIED +CONFIG_OPTION(BCMDRD_CONFIG_INCLUDE_BCM56998_A0_IMPLIED) +#endif #undef CONFIG_OPTION #endif /* #ifdef CONFIG_OPTION */ diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/bde/Kbuild b/platform/broadcom/saibcm-modules/sdklt/linux/bde/Kbuild index 76581c02eed2..928ecdf49b7c 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/bde/Kbuild +++ b/platform/broadcom/saibcm-modules/sdklt/linux/bde/Kbuild @@ -2,7 +2,7 @@ # # Linux kernel BDE module. # -# $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. +# $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. # # This program is free software; you can redistribute it and/or @@ -31,6 +31,7 @@ linux_ngbde-y := ngbde_main.o \ ngbde_procfs.o \ ngbde_pio.o \ ngbde_iio.o \ + ngbde_paxb.o \ ngbde_dma.o \ ngbde_intr.o \ ngbde_pgmem.o \ diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/bde/Makefile b/platform/broadcom/saibcm-modules/sdklt/linux/bde/Makefile index 590f4132306f..a20346e4b50b 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/bde/Makefile +++ b/platform/broadcom/saibcm-modules/sdklt/linux/bde/Makefile @@ -2,7 +2,7 @@ # # Linux kernel BDE module. # -# $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. +# $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. # # This program is free software; you can redistribute it and/or diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde.h b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde.h index 56e925f7098d..ad1f71031cbe 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde.h +++ b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde.h @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -116,9 +116,15 @@ typedef struct ngbde_irq_reg_s { /*! Interrupt status register corresponding to the mask register. */ uint32_t status_reg; + /*! Interrupt status register is a bitwise AND of mask and raw status. */ + bool status_is_masked; + /*! Shared interrupt mask register. */ uint32_t mask_reg; + /*! Mask register is of type "write 1 to clear". */ + bool mask_w1tc; + /*! Mask identifying the register bits owned by the kernel mode driver. */ uint32_t kmask; @@ -213,6 +219,12 @@ typedef struct ngbde_intr_ctrl_s { /*! Context for primary interrupt handler. */ void *isr_data; + /*! Secondary interrupt handler. */ + ngbde_isr_f isr2_func; + + /*! Context for secondary interrupt handler. */ + void *isr2_data; + } ngbde_intr_ctrl_t; /*! Convenience macro for 1 kilobyte. */ @@ -366,6 +378,13 @@ struct ngbde_dev_s { /*! DMA memory pools. */ struct ngbde_dmapool_s dmapool[NGBDE_NUM_DMAPOOL_MAX]; + + /*! KNET handler. */ + knet_func_f knet_func; + + /*! Context for KNET handler. */ + void *knet_data; + }; /*! @@ -817,6 +836,35 @@ ngbde_paxb_unmap(void *devh); extern void ngbde_paxb_cleanup(void); +/*! + * \brief Write a memory-mapped PCI bridge register. + * + * Write a 32-bit register using I/O memory previously mapped via \ref + * ngbde_paxb_map. + * + * \param [in] devh Device handle (\ref ngbde_dev_s). + * \param [in] offs Register address offset. + * \param [in] val Value to write to register. + * + * \return Nothing. + */ +extern void +ngbde_paxb_write32(void *devh, uint32_t offs, uint32_t val); + +/*! + * \brief Read a memory-mapped PCI bridge register. + * + * Read a 32-bit register using I/O memory previously mapped via \ref + * ngbde_paxb_map. + * + * \param [in] devh Device handle (\ref ngbde_dev_s). + * \param [in] offs Register address offset. + * + * \return Value read from register. + */ +extern uint32_t +ngbde_paxb_read32(void *devh, uint32_t offs); + /*! * \brief Probe for Broadcom switch devices on IPROC internal bus. * diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_dma.c b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_dma.c index 9cc2b191f48c..848664af046e 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_dma.c +++ b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_dma.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_iio.c b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_iio.c index e97f1fcea730..744cf2442fbd 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_iio.c +++ b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_iio.c @@ -5,7 +5,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -36,7 +36,7 @@ ngbde_iio_map(void *devh, phys_addr_t addr, phys_addr_t size) ngbde_iio_unmap(devh); } - sd->iio_mem = ioremap_nocache(addr, size); + sd->iio_mem = ioremap(addr, size); if (sd->iio_mem) { /* Save mapped resources */ @@ -92,52 +92,3 @@ ngbde_iio_read32(void *devh, uint32_t offs) } return 0; } - -void * -ngbde_paxb_map(void *devh, phys_addr_t addr, phys_addr_t size) -{ - struct ngbde_dev_s *sd = (struct ngbde_dev_s *)devh; - - if (sd->paxb_mem) { - if (addr == sd->paxb_win.addr && size == sd->paxb_win.size) { - /* Already mapped */ - return sd->paxb_mem; - } - iounmap(sd->paxb_mem); - } - - sd->paxb_mem = ioremap_nocache(addr, size); - - if (sd->paxb_mem) { - /* Save mapped resources */ - sd->paxb_win.addr = addr; - sd->paxb_win.size = size; - } - - return sd->paxb_mem; -} - -void -ngbde_paxb_unmap(void *devh) -{ - struct ngbde_dev_s *sd = (struct ngbde_dev_s *)devh; - - if (sd->paxb_mem) { - iounmap(sd->paxb_mem); - sd->paxb_mem = NULL; - } -} - -void -ngbde_paxb_cleanup(void) -{ - struct ngbde_dev_s *swdev, *sd; - unsigned int num_swdev, idx; - - ngbde_swdev_get_all(&swdev, &num_swdev); - - for (idx = 0; idx < num_swdev; idx++) { - sd = ngbde_swdev_get(idx); - ngbde_paxb_unmap(sd); - } -} diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_intr.c b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_intr.c index acec7da100f7..bc343a7e223e 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_intr.c +++ b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_intr.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -96,9 +96,12 @@ ngbde_user_isr(ngbde_intr_ctrl_t *ic) kmask = ir->kmask; stat = NGBDE_IOREAD32(&ic->iomem[ir->status_reg]); - mask = NGBDE_IOREAD32(&ic->iomem[ir->mask_reg]); - - if (stat & mask & ~kmask) { + if (!ir->status_is_masked) { + /* Get enabled interrupts by applying mask register */ + mask = NGBDE_IOREAD32(&ic->iomem[ir->mask_reg]); + stat &= mask; + } + if (stat & ~kmask) { active_interrupts = 1; break; } @@ -119,7 +122,13 @@ ngbde_user_isr(ngbde_intr_ctrl_t *ic) if (kmask == 0xffffffff) { /* Kernel driver owns all interrupts in this register */ continue; - } else if (kmask) { + } + if (ir->mask_w1tc) { + /* Clear all interrupt bits which are not in kmask */ + NGBDE_IOWRITE32(~kmask, &ic->iomem[ir->mask_reg]); + continue; + } + if (kmask) { /* Synchronized write */ struct ngbde_dev_s *sd = ngbde_swdev_get(ic->kdev); if (ngbde_intr_shared_write32(sd, ic, ir->mask_reg, 0, ~kmask) < 0) { @@ -159,6 +168,25 @@ ngbde_kernel_isr(ngbde_intr_ctrl_t *ic) return 0; } +/*! + * \brief Interrupt handler for kernel driver. + * + * Typically used by the EDK driver. + * + * \param [in] ic Interrupt control information. + * + * \retval 1 One or more kernel mode interrupts occurred. + * \retval 0 No kernel mode interrupts occurred. + */ +static int +ngbde_kernel_isr2(ngbde_intr_ctrl_t *ic) +{ + if (ic->isr2_func) { + return ic->isr2_func(ic->isr2_data); + } + return 0; +} + /*! * \brief Acknowledge interrupt * @@ -174,9 +202,9 @@ ngbde_intr_ack(ngbde_intr_ctrl_t *ic) if (sd->use_msi) { if (ar->flags & NGBDE_INTR_ACK_F_PAXB) { - NGBDE_IOWRITE32(ar->ack_val, &sd->paxb_mem[ar->ack_reg]); + ngbde_paxb_write32(sd, ar->ack_reg, ar->ack_val); } else { - NGBDE_IOWRITE32(ar->ack_val, &sd->pio_mem[ar->ack_reg]); + ngbde_pio_write32(sd, ar->ack_reg, ar->ack_val); } } @@ -203,6 +231,9 @@ ngbde_isr(int irq_num, void *data) ngbde_intr_ack(ic); + if (ngbde_kernel_isr2(ic)) { + rv = IRQ_HANDLED; + } if (ngbde_user_isr(ic)) { rv = IRQ_HANDLED; } diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_ioctl.c b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_ioctl.c index ccd0b7ee01d0..4eeeb2438306 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_ioctl.c +++ b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_ioctl.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -157,6 +157,14 @@ ngbde_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ireg.status_reg = ioc.op.irq_reg_add.status_reg; ireg.mask_reg = ioc.op.irq_reg_add.mask_reg; ireg.kmask = ioc.op.irq_reg_add.kmask; + ireg.status_is_masked = false; + if (ioc.op.irq_reg_add.flags & NGBDE_DEV_IRQ_REG_F_MASKED) { + ireg.status_is_masked = true; + } + ireg.mask_w1tc = false; + if (ioc.op.irq_reg_add.flags & NGBDE_DEV_IRQ_REG_F_W1TC) { + ireg.mask_w1tc = true; + } if (ngbde_intr_reg_add(ioc.devid, irq_num, &ireg) < 0) { printk(KERN_WARNING "%s: Unable to add interrupt register\n", diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_iproc_probe.c b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_iproc_probe.c index 63b02a4075a3..218fd8262a65 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_iproc_probe.c +++ b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_iproc_probe.c @@ -8,7 +8,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -65,7 +65,7 @@ iproc_cmicd_probe(struct platform_device *pldev) (void *)memres->start, (void *)memres->end); } - base_address = ioremap_nocache(memres->start, size); + base_address = ioremap(memres->start, size); if (!base_address) { printk(KERN_WARNING "Error mapping iProc CMIC registers"); return -1; diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_kapi.c b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_kapi.c index 340e7b057d44..7775100d952b 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_kapi.c +++ b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_kapi.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -108,6 +108,24 @@ ngbde_kapi_dma_virt_to_bus(int kdev, void *vaddr) EXPORT_SYMBOL(ngbde_kapi_dma_virt_to_bus); /*! \endcond */ +void * +ngbde_kapi_dma_alloc(size_t size) +{ + return ngbde_pgmem_alloc(size, GFP_KERNEL | GFP_DMA32); +} +/*! \cond */ +EXPORT_SYMBOL(ngbde_kapi_dma_alloc); +/*! \endcond */ + +int +ngbde_kapi_dma_free(void *ptr) +{ + return ngbde_pgmem_free(ptr); +} +/*! \cond */ +EXPORT_SYMBOL(ngbde_kapi_dma_free); +/*! \endcond */ + void ngbde_kapi_pio_write32(int kdev, uint32_t offs, uint32_t val) { @@ -154,6 +172,98 @@ ngbde_kapi_pio_membase(int kdev) EXPORT_SYMBOL(ngbde_kapi_pio_membase); /*! \endcond */ +void +ngbde_kapi_iio_write32(int kdev, uint32_t offs, uint32_t val) +{ + struct ngbde_dev_s *sd; + + sd = ngbde_swdev_get(kdev); + if (sd) { + return ngbde_iio_write32(sd, offs, val); + } +} +/*! \cond */ +EXPORT_SYMBOL(ngbde_kapi_iio_write32); +/*! \endcond */ + +uint32_t +ngbde_kapi_iio_read32(int kdev, uint32_t offs) +{ + struct ngbde_dev_s *sd; + + sd = ngbde_swdev_get(kdev); + if (sd) { + return ngbde_iio_read32(sd, offs); + } + + return (uint32_t)-1; +} +/*! \cond */ +EXPORT_SYMBOL(ngbde_kapi_iio_read32); +/*! \endcond */ + +void * +ngbde_kapi_iio_membase(int kdev) +{ + struct ngbde_dev_s *sd; + + sd = ngbde_swdev_get(kdev); + if (!sd) { + return NULL; + } + + return sd->iio_mem; +} +/*! \cond */ +EXPORT_SYMBOL(ngbde_kapi_iio_membase); +/*! \endcond */ + +void +ngbde_kapi_paxb_write32(int kdev, uint32_t offs, uint32_t val) +{ + struct ngbde_dev_s *sd; + + sd = ngbde_swdev_get(kdev); + if (sd) { + return ngbde_paxb_write32(sd, offs, val); + } +} +/*! \cond */ +EXPORT_SYMBOL(ngbde_kapi_paxb_write32); +/*! \endcond */ + +uint32_t +ngbde_kapi_paxb_read32(int kdev, uint32_t offs) +{ + struct ngbde_dev_s *sd; + + sd = ngbde_swdev_get(kdev); + if (sd) { + return ngbde_paxb_read32(sd, offs); + } + + return (uint32_t)-1; +} +/*! \cond */ +EXPORT_SYMBOL(ngbde_kapi_paxb_read32); +/*! \endcond */ + +void * +ngbde_kapi_paxb_membase(int kdev) +{ + struct ngbde_dev_s *sd; + + sd = ngbde_swdev_get(kdev); + if (!sd) { + return NULL; + } + + return sd->paxb_mem; +} +/*! \cond */ +EXPORT_SYMBOL(ngbde_kapi_paxb_membase); +/*! \endcond */ + int ngbde_kapi_intr_connect(int kdev, unsigned int irq_num, int (*isr_func)(void *), void *isr_data) @@ -205,6 +315,57 @@ ngbde_kapi_intr_disconnect(int kdev, unsigned int irq_num) EXPORT_SYMBOL(ngbde_kapi_intr_disconnect); /*! \endcond */ +int +ngbde_kapi_intr2_connect(int kdev, unsigned int irq_num, + int (*isr_func)(void *), void *isr_data) +{ + struct ngbde_dev_s *sd; + struct ngbde_intr_ctrl_s *ic; + + sd = ngbde_swdev_get(kdev); + if (!sd) { + return -1; + } + + if (irq_num >= NGBDE_NUM_IRQS_MAX) { + return -1; + } + + ic = &sd->intr_ctrl[irq_num]; + ic->isr2_func = isr_func; + ic->isr2_data = isr_data; + + return 0; +} +/*! \cond */ +EXPORT_SYMBOL(ngbde_kapi_intr2_connect); +/*! \endcond */ + +int +ngbde_kapi_intr2_disconnect(int kdev, unsigned int irq_num) +{ + struct ngbde_dev_s *sd; + struct ngbde_intr_ctrl_s *ic; + + sd = ngbde_swdev_get(kdev); + if (!sd) { + return -1; + } + + if (irq_num >= NGBDE_NUM_IRQS_MAX) { + return -1; + } + + ic = &sd->intr_ctrl[irq_num]; + ic->isr2_func = NULL; + ic->isr2_data = NULL; + + return 0; +} +/*! \cond */ +EXPORT_SYMBOL(ngbde_kapi_intr2_disconnect); +/*! \endcond */ + int ngbde_kapi_intr_mask_write(int kdev, unsigned int irq_num, uint32_t status_reg, uint32_t mask_val) @@ -214,3 +375,40 @@ ngbde_kapi_intr_mask_write(int kdev, unsigned int irq_num, /*! \cond */ EXPORT_SYMBOL(ngbde_kapi_intr_mask_write); /*! \endcond */ + +int +ngbde_kapi_knet_connect(int kdev, knet_func_f knet_func, void *knet_data) +{ + struct ngbde_dev_s *sd; + + sd = ngbde_swdev_get(kdev); + if (!sd) { + return -1; + } + sd->knet_func = knet_func; + sd->knet_data = knet_data; + + return 0; +} +/*! \cond */ +EXPORT_SYMBOL(ngbde_kapi_knet_connect); +/*! \endcond */ + +int +ngbde_kapi_knet_disconnect(int kdev) +{ + struct ngbde_dev_s *sd; + + sd = ngbde_swdev_get(kdev); + if (!sd) { + return -1; + } + sd->knet_func = NULL; + sd->knet_data = NULL; + + return 0; +} +/*! \cond */ +EXPORT_SYMBOL(ngbde_kapi_knet_disconnect); +/*! \endcond */ + diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_main.c b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_main.c index 5ce48ebc5134..697412cf5b97 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_main.c +++ b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_main.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -240,7 +240,7 @@ static struct file_operations fops = { * \return Nothing. */ void __exit -cleanup_module(void) +ngbde_exit_module(void) { ngbde_intr_cleanup(); ngbde_iio_cleanup(); @@ -260,7 +260,7 @@ cleanup_module(void) * \return Nothing. */ int __init -init_module(void) +ngbde_init_module(void) { int rv; @@ -295,3 +295,6 @@ init_module(void) printk(KERN_INFO "Broadcom NGBDE loaded successfully\n"); return 0; } + +module_exit(ngbde_exit_module); +module_init(ngbde_init_module); diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_paxb.c b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_paxb.c new file mode 100644 index 000000000000..7b8cdda58b59 --- /dev/null +++ b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_paxb.c @@ -0,0 +1,94 @@ +/*! \file ngbde_paxb.c + * + * API for managing and accessing memory-mapped I/O for PCI-AXI bridge + * registers. + * + */ +/* + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. + * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * A copy of the GNU General Public License version 2 (GPLv2) can + * be found in the LICENSES folder.$ + */ + +#include + +void * +ngbde_paxb_map(void *devh, phys_addr_t addr, phys_addr_t size) +{ + struct ngbde_dev_s *sd = (struct ngbde_dev_s *)devh; + + if (sd->paxb_mem) { + if (addr == sd->paxb_win.addr && size == sd->paxb_win.size) { + /* Already mapped */ + return sd->paxb_mem; + } + iounmap(sd->paxb_mem); + } + + sd->paxb_mem = ioremap(addr, size); + + if (sd->paxb_mem) { + /* Save mapped resources */ + sd->paxb_win.addr = addr; + sd->paxb_win.size = size; + } + + return sd->paxb_mem; +} + +void +ngbde_paxb_unmap(void *devh) +{ + struct ngbde_dev_s *sd = (struct ngbde_dev_s *)devh; + + if (sd->paxb_mem) { + iounmap(sd->paxb_mem); + sd->paxb_mem = NULL; + } +} + +void +ngbde_paxb_cleanup(void) +{ + struct ngbde_dev_s *swdev, *sd; + unsigned int num_swdev, idx; + + ngbde_swdev_get_all(&swdev, &num_swdev); + + for (idx = 0; idx < num_swdev; idx++) { + sd = ngbde_swdev_get(idx); + ngbde_paxb_unmap(sd); + } +} + +void +ngbde_paxb_write32(void *devh, uint32_t offs, uint32_t val) +{ + struct ngbde_dev_s *sd = (struct ngbde_dev_s *)devh; + + if (sd->paxb_mem) { + NGBDE_IOWRITE32(val, sd->paxb_mem + offs); + } +} + +uint32_t +ngbde_paxb_read32(void *devh, uint32_t offs) +{ + struct ngbde_dev_s *sd = (struct ngbde_dev_s *)devh; + + if (sd->paxb_mem) { + return NGBDE_IOREAD32(sd->paxb_mem + offs); + } + return 0; +} diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_pci_probe.c b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_pci_probe.c index 37da39cd38a7..f444f04fa9f5 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_pci_probe.c +++ b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_pci_probe.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -52,6 +52,7 @@ static struct pci_device_id pci_id_table[] = { { BROADCOM_VENDOR_ID, 0xb684, PCI_ANY_ID, PCI_ANY_ID }, { 0, 0, 0, 0 } }; +MODULE_DEVICE_TABLE(pci, pci_id_table); static int pci_probe(struct pci_dev *pci_dev, const struct pci_device_id *ent) @@ -169,6 +170,10 @@ pci_remove(struct pci_dev* pci_dev) ngbde_swdev_get_all(&swdev, &num_swdev); for (idx = 0; idx < num_swdev; idx++) { + if (swdev[idx].knet_func) { + swdev[idx].knet_func(idx, NGBDE_EVENT_DEV_REMOVE, + swdev->knet_data); + } if (swdev[idx].bus_no == bus_no && swdev[idx].slot_no == slot_no) { if (swdev[idx].inactive) { diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_pgmem.c b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_pgmem.c index e473f0c545cb..1283b66e1e19 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_pgmem.c +++ b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_pgmem.c @@ -31,7 +31,7 @@ * likely these requests are to succeed. */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_pio.c b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_pio.c index cab094a2feca..13dde9de98e7 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_pio.c +++ b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_pio.c @@ -5,7 +5,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -36,7 +36,7 @@ ngbde_pio_map(void *devh, phys_addr_t addr, phys_addr_t size) ngbde_pio_unmap(devh); } - sd->pio_mem = ioremap_nocache(addr, size); + sd->pio_mem = ioremap(addr, size); if (sd->pio_mem) { /* Save mapped resources */ diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_procfs.c b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_procfs.c index f99339a5b0dc..883b5a8ea7d1 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_procfs.c +++ b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_procfs.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -88,6 +88,7 @@ proc_release(struct inode *inode, struct file *file) return single_release(inode, file); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) static struct file_operations proc_fops = { owner: THIS_MODULE, open: proc_open, @@ -95,6 +96,14 @@ static struct file_operations proc_fops = { llseek: seq_lseek, release: proc_release, }; +#else +static struct proc_ops proc_fops = { + proc_open: proc_open, + proc_read: seq_read, + proc_lseek: seq_lseek, + proc_release: proc_release, +}; +#endif int ngbde_procfs_init(void) diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_swdev.c b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_swdev.c index 60d328ad2526..b8d67382f450 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_swdev.c +++ b/platform/broadcom/saibcm-modules/sdklt/linux/bde/ngbde_swdev.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/include/lkm/lkm.h b/platform/broadcom/saibcm-modules/sdklt/linux/include/lkm/lkm.h index c0ba0a319767..f35550922fed 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/include/lkm/lkm.h +++ b/platform/broadcom/saibcm-modules/sdklt/linux/include/lkm/lkm.h @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/include/lkm/ngbde_ioctl.h b/platform/broadcom/saibcm-modules/sdklt/linux/include/lkm/ngbde_ioctl.h index b90486ce06f2..84088fb391f7 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/include/lkm/ngbde_ioctl.h +++ b/platform/broadcom/saibcm-modules/sdklt/linux/include/lkm/ngbde_ioctl.h @@ -9,7 +9,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -225,6 +225,21 @@ struct ngbde_ioc_intr_ctrl_s { __u32 cmd; }; +/*! + * \name Interrupt register access flags. + * \anchor NGBDE_DEV_IRQ_REG_F_xxx + */ + +/*! \{ */ + +/*! IRQ register is of type "write 1 to clear". */ +#define NGBDE_DEV_IRQ_REG_F_W1TC (1 << 0) + +/*! IRQ status register is a bitwise AND of mask and raw status. */ +#define NGBDE_DEV_IRQ_REG_F_MASKED (1 << 1) + +/*! \} */ + /*! Add interrupt register information. */ struct ngbde_ioc_irq_reg_add_s { @@ -240,7 +255,7 @@ struct ngbde_ioc_irq_reg_add_s { /*! Interrupt mask for interrupts handled by the kernel. */ __u32 kmask; - /*! Reserved for future use. */ + /*! Flags for special handling (\ref NGBDE_DEV_IRQ_REG_F_xxx). */ __u32 flags; }; diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/include/lkm/ngbde_kapi.h b/platform/broadcom/saibcm-modules/sdklt/linux/include/lkm/ngbde_kapi.h index 142aa63b572c..2d908da1f544 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/include/lkm/ngbde_kapi.h +++ b/platform/broadcom/saibcm-modules/sdklt/linux/include/lkm/ngbde_kapi.h @@ -6,7 +6,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -32,6 +32,21 @@ #define NGBDE_NUM_SWDEV_MAX 16 #endif +/*! Device has been removed. */ +#define NGBDE_EVENT_DEV_REMOVE 1 + +/*! + * \brief KNET handler. + * + * The KNET handler with the Linux kernel. + * + * \param [in] kdev Switch device number. + * \param [in] event PCI event, see NGBDE_EVENT_xxx for event definitions. + * \param [in] data KNET handler context. + * + */ +typedef int (*knet_func_f)(int kdev, int event, void *data); + /*! * \brief Get Linux PCI device handle for a switch device. * @@ -64,7 +79,7 @@ ngbde_kapi_dma_dev_get(int kdev); * * \return Virtual kernel address or NULL on error. */ -void * +extern void * ngbde_kapi_dma_bus_to_virt(int kdev, dma_addr_t baddr); /*! @@ -79,11 +94,46 @@ ngbde_kapi_dma_bus_to_virt(int kdev, dma_addr_t baddr); * * \return Physical DMA bus address for this device or 0 on error. */ -dma_addr_t +extern dma_addr_t ngbde_kapi_dma_virt_to_bus(int kdev, void *vaddr); /*! - * \brief Write a memory-mapped register from kernel driver. + * \brief Allocate physically continguous memory. + * + * This function can be used to allocate a large physically contiguous + * block of memory suitable for DMA operations. + * + * Use the kernel API dma_map_single to map the memory to a physical + * device. A suitable DMA device for this operation can be obtained + * via \ref ngbde_kapi_dma_dev_get. + * + * Memory should be freed via \ref ngbde_kapi_dma_free. + * + * \param [in] size Number of bytes to allocate. + * + * \return Pointer to allocated memory or NULL on error. + */ +extern void * +ngbde_kapi_dma_alloc(size_t size); + +/*! + * \brief Free physically continguous memory. + * + * Free memory previously allocated via \ref ngbde_kapi_dma_alloc. + * + * If the memory has been used for DMA operation, then it must first + * be unmapped via the kernel API dma_unmap_single. + * + * \param [in] ptr Pointer to memory to be freed. + * + * \retval 0 No errors. + * \retval -1 Invalid memory pointer. + */ +extern int +ngbde_kapi_dma_free(void *ptr); + +/*! + * \brief Write a memory-mapped register in kernel driver. * * \param [in] kdev Device number. * \param [in] offs Register address offset. @@ -95,7 +145,7 @@ extern void ngbde_kapi_pio_write32(int kdev, uint32_t offs, uint32_t val); /*! - * \brief Read a memory-mapped register from kernel driver. + * \brief Read a memory-mapped register in kernel driver. * * \param [in] kdev Device number. * \param [in] offs Register address offset. @@ -106,9 +156,9 @@ extern uint32_t ngbde_kapi_pio_read32(int kdev, uint32_t offs); /*! - * \brief Get base address fo memory-mapped I/O memory. + * \brief Get base address of memory-mapped I/O memory. * - * The lgical base address returned can be used with ioread32, etc. + * The logical base address returned can be used with ioread32, etc. * * \param [in] kdev Device number. * @@ -117,11 +167,81 @@ ngbde_kapi_pio_read32(int kdev, uint32_t offs); extern void * ngbde_kapi_pio_membase(int kdev); +/*! + * \brief Write a memory-mapped interrupt controller register. + * + * \param [in] kdev Device number. + * \param [in] offs Register address offset. + * \param [in] val Value to write to register. + * + * \return Nothing. + */ +extern void +ngbde_kapi_iio_write32(int kdev, uint32_t offs, uint32_t val); + +/*! + * \brief Read a memory-mapped interrupt controller register. + * + * \param [in] kdev Device number. + * \param [in] offs Register address offset. + * + * \return Value read from register. + */ +extern uint32_t +ngbde_kapi_iio_read32(int kdev, uint32_t offs); + +/*! + * \brief Get base address of memory-mapped interrupt controller memory. + * + * The logical base address returned can be used with ioread32, etc. + * + * \param [in] kdev Device number. + * + * \return Logical base address or NULL if unavailable. + */ +extern void * +ngbde_kapi_iio_membase(int kdev); + +/*! + * \brief Write a memory-mapped PCI bridge register. + * + * \param [in] kdev Device number. + * \param [in] offs Register address offset. + * \param [in] val Value to write to register. + * + * \return Nothing. + */ +extern void +ngbde_kapi_paxb_write32(int kdev, uint32_t offs, uint32_t val); + +/*! + * \brief Read a memory-mapped PCI bridge register. + * + * \param [in] kdev Device number. + * \param [in] offs Register address offset. + * + * \return Value read from register. + */ +extern uint32_t +ngbde_kapi_paxb_read32(int kdev, uint32_t offs); + +/*! + * \brief Get base address of memory-mapped PCI bridge memory. + * + * The logical base address returned can be used with ioread32, etc. + * + * \param [in] kdev Device number. + * + * \return Logical base address or NULL if unavailable. + */ +extern void * +ngbde_kapi_paxb_membase(int kdev); + /*! * \brief Install kernel mode interrupt handler. * * \param [in] kdev Device number. - * \param [in] irq_num MSI interrupt number. + * \param [in] irq_num Interrupt number (MSI vector). * \param [in] isr_func Interrupt handler function. * \param [in] isr_data Interrupt handler context. * @@ -135,13 +255,41 @@ ngbde_kapi_intr_connect(int kdev, unsigned int irq_num, * \brief Uninstall kernel mode interrupt handler. * * \param [in] kdev Device number. - * \param [in] irq_num MSI interrupt number. + * \param [in] irq_num Interrupt number (MSI vector). * * \retval 0 No errors */ extern int ngbde_kapi_intr_disconnect(int kdev, unsigned int irq_num); +/*! + * \brief Install secondary interrupt handler. + * + * Optionally allow a different process to handle one or more user + * mode interrupts. + * + * \param [in] kdev Device number. + * \param [in] irq_num Interrupt number (MSI vector). + * \param [in] isr_func Interrupt handler function. + * \param [in] isr_data Interrupt handler context. + * + * \retval 0 No errors + */ +extern int +ngbde_kapi_intr2_connect(int kdev, unsigned int irq_num, + int (*isr_func)(void *), void *isr_data); + +/*! + * \brief Uninstall secondary interrupt handler. + * + * \param [in] kdev Device number. + * \param [in] irq_num Interrupt number (MSI vector). + * + * \retval 0 No errors + */ +extern int +ngbde_kapi_intr2_disconnect(int kdev, unsigned int irq_num); + /*! * \brief Write shared interrupt mask register. * @@ -166,4 +314,28 @@ extern int ngbde_kapi_intr_mask_write(int kdev, unsigned int irq_num, uint32_t status_reg, uint32_t mask_val); +/*! + * \brief Install KNET callback handler. + * + * Register a callback function to handle BDE events on KNET. + * + * \param [in] kdev Device number. + * \param [in] knet_func KNET callback function. + * \param [in] knet_data Context of KNET callback function. + * + * \retval 0 No errors + */ +extern int +ngbde_kapi_knet_connect(int kdev, knet_func_f knet_func, void *knet_data); + +/*! + * \brief Uninstall KNET callback handler. + * + * \param [in] kdev Device number. + * + * \retval 0 No errors + */ +extern int +ngbde_kapi_knet_disconnect(int kdev); + #endif /* NGBDE_KAPI_H */ diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/include/lkm/ngedk_ioctl.h b/platform/broadcom/saibcm-modules/sdklt/linux/include/lkm/ngedk_ioctl.h new file mode 100644 index 000000000000..7a4c7b5d24a1 --- /dev/null +++ b/platform/broadcom/saibcm-modules/sdklt/linux/include/lkm/ngedk_ioctl.h @@ -0,0 +1,183 @@ +/*! \file ngedk_ioctl.h + * + * NGEDK device I/O control definitions. + * + * This file is intended for use in both kernel mode and user mode. + * + * IMPORTANT! + * All shared structures must be properly 64-bit aligned. + * + */ +/* + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. + * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * A copy of the GNU General Public License version 2 (GPLv2) can + * be found in the LICENSES folder.$ + */ + +#ifndef NGEDK_IOCTL_H +#define NGEDK_IOCTL_H + +#include +#include + +/*! Module information */ +#define NGEDK_MODULE_NAME "linux_ngedk" +#define NGEDK_MODULE_MAJOR 119 + +/*! Must be updated if backward compatibility is broken. */ +#define NGEDK_IOC_VERSION 1 + +/*! LUEDK IOCTL command magic. */ +#define NGEDK_IOC_MAGIC 'L' + +/*! Maximum number of mHosts supported per switch device. */ +#ifndef MCS_NUM_UC +#define MCS_NUM_UC 4 +#endif + +/*! + * \name IOCTL commands for the NGEDK kernel module. + * \anchor NGEDK_IOC_xxx + * + * Note that we use __u64 for the IOCTL parameter size because + * sizeof(void *) is different between 32-bit and 64-bit code, and we + * need a 32-bit user mode application to generate the same IOCTL + * command codes as a 64-bit kernel when using the _IOW macro. + */ + +/*! \{ */ + +/*! Get kernel module information. */ +#define NGEDK_IOC_MOD_INFO _IOW(NGEDK_IOC_MAGIC, 0, __u64) + +/*! Attach EDK instance. */ +#define NGEDK_IOC_ATTACH_INST _IOW(NGEDK_IOC_MAGIC, 1, __u64) + +/*! Get EDK DMA memory information. */ +#define NGEDK_IOC_GET_DMA_INFO _IOW(NGEDK_IOC_MAGIC, 2, __u64) + +/*! Enable EDK interrupts in this unit. */ +#define NGEDK_IOC_INTR_ENABLE _IOW(NGEDK_IOC_MAGIC, 3, __u64) + +/*! Disable EDK interrupts in this unit. */ +#define NGEDK_IOC_INTR_DISABLE _IOW(NGEDK_IOC_MAGIC, 4, __u64) + +/*! Set Interrupt registers and mask values used by the EDK. */ +#define NGEDK_IOC_INTR_SET _IOW(NGEDK_IOC_MAGIC, 5, __u64) + +/*! Wait for an EDK interrupt. */ +#define NGEDK_IOC_INTR_WAIT _IOW(NGEDK_IOC_MAGIC, 6, __u64) + +/*! Handle EDK software interrupt. */ +#define NGEDK_IOC_SW_INTR _IOW(NGEDK_IOC_MAGIC, 7, __u64) + +/*! \} */ + +/*! IOCTL command return code for success. */ +#define NGEDK_IOC_SUCCESS 0 + +/*! IOCTL command return code for failure. */ +#define NGEDK_IOC_FAIL ((__u32)-1) + +/*! Kernel module information. */ +struct ngedk_ioc_mod_info_s { + + /*! IOCTL version used by kernel module. */ + __u16 version; +}; + +/*! Attach EDK Instance */ +struct ngedk_ioc_attach_inst_s { + + /*! HostRAM size for this instance. */ + __u32 size_mb; +}; + +/*! Get EDK DMA information */ +struct ngedk_ioc_dma_info_s { + + /*! Virtual address */ + __u64 vaddr; + + /*! Physical address */ + __u64 paddr; + + /*! Bus address as maped by IOMMU */ + __u64 baddr; + + /*! DMA pool size */ + __u32 size; +}; + +/* Set details of interrupts handled by EDK */ +struct ngedk_ioc_intr_s { + + /*! Active cores */ + __u32 active_bmp; + + /*! Timer interrupts status offset */ + __u32 timer_intrc_stat_reg; + + /*! Timer interrupts enable offset */ + __u32 timer_intrc_enable_reg; + + /*! Timer interrupts mask */ + __u32 timer_intrc_mask_val; + + /*! Bitmap of cores that triggered SW interrupt. */ + __u32 sw_intr_cores; +}; + +/*! IOCTL operation data. */ +struct ngedk_ioc_sw_intr_s { + + /*! mHost core number corresponding to this SW interrupt */ + __u32 uc; + +}; + +/*! IOCTL operation data. */ +union ngedk_ioc_op_s { + + /*! Get kernel module information. */ + struct ngedk_ioc_mod_info_s mod_info; + + /*! Attach EDK Instance */ + struct ngedk_ioc_attach_inst_s attach_inst; + + /*! EDK DMA information */ + struct ngedk_ioc_dma_info_s dma_info; + + /*! EDK Interrupt setting */ + struct ngedk_ioc_intr_s edk_intr; + + /*! EDK software interrupt */ + struct ngedk_ioc_sw_intr_s sw_intr; +}; + +/*! IOCTL command message. */ +typedef struct ngedk_ioc_cmd_s { + + /*! Device handle. */ + __u32 devid; + + /*! Return code (0 means success). */ + __u32 rc; + + /*! IOCTL operation. */ + union ngedk_ioc_op_s op; + +} ngedk_ioc_cmd_t; + +#endif /* NGEDK_IOCTL_H */ diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/include/lkm/ngknet_dev.h b/platform/broadcom/saibcm-modules/sdklt/linux/include/lkm/ngknet_dev.h index 74d3d5b350b0..baef36109a4b 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/include/lkm/ngknet_dev.h +++ b/platform/broadcom/saibcm-modules/sdklt/linux/include/lkm/ngknet_dev.h @@ -9,7 +9,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -168,6 +168,9 @@ typedef struct ngknet_netif_s { * NGKNET_FILTER_DEST_T_VNET * Packet is sent to VNET in user space. * + * NGKNET_FILTER_DEST_T_CB + * Packet is sent to kernel filter call-back function for further filtering. + * * Filter flags: * * NGKNET_FILTER_F_ANY_DATA @@ -198,8 +201,8 @@ typedef struct ngknet_netif_s { #define NGKNET_FILTER_DEST_T_NETIF 1 /*! Send packet to VNET */ #define NGKNET_FILTER_DEST_T_VNET 2 -/*! Send packet to kernel callback function (BCMPKT_DEST_T_CALLBACK) */ -#define NGKNET_FILTER_DEST_T_CB 3 +/*! Send packet to kernel filter call-back function */ +#define NGKNET_FILTER_DEST_T_CB 3 /*! Match any data */ #define NGKNET_FILTER_F_ANY_DATA (1U << 0) @@ -291,6 +294,9 @@ typedef struct ngknet_dev_cfg_s { /*! Device type string */ char type_str[NGKNET_DEV_NAME_MAX]; + /*! Variant string */ + char var_str[NGKNET_DEV_NAME_MAX]; + /*! Device ID */ uint32_t dev_id; @@ -403,6 +409,8 @@ struct ngknet_rcpu_hdr { #define RCPU_FLAG_MODHDR (1 << 2) /*! RCPU bind queue flag */ #define RCPU_FLAG_BIND_QUE (1 << 3) +/*! RCPU no pad flag */ +#define RCPU_FLAG_NO_PAD (1 << 4) #endif /* NGKNET_DEV_H */ diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/include/lkm/ngknet_ioctl.h b/platform/broadcom/saibcm-modules/sdklt/linux/include/lkm/ngknet_ioctl.h index 6da52c778191..42533787f927 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/include/lkm/ngknet_ioctl.h +++ b/platform/broadcom/saibcm-modules/sdklt/linux/include/lkm/ngknet_ioctl.h @@ -9,7 +9,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/Kbuild b/platform/broadcom/saibcm-modules/sdklt/linux/knet/Kbuild index fe5d5c5bfefc..1f543b8e2ccf 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/knet/Kbuild +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/Kbuild @@ -2,7 +2,7 @@ # # Linux KNET module. # -# $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. +# $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. # # This program is free software; you can redistribute it and/or diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/Makefile b/platform/broadcom/saibcm-modules/sdklt/linux/knet/Makefile index 785b81fadb17..2142857ad387 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/knet/Makefile +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/Makefile @@ -2,7 +2,7 @@ # # Linux KNET module. # -# $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. +# $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. # # This program is free software; you can redistribute it and/or @@ -75,9 +75,12 @@ mklinks: -ln -s $(SRCIDIR)/bcmcnet_rxtx.h $(DSTIDIR) $(R) -ln -s $(SRCIDIR)/bcmcnet_cmicd.h $(DSTIDIR) $(R) -ln -s $(SRCIDIR)/bcmcnet_cmicx.h $(DSTIDIR) $(R) + -ln -s $(SRCIDIR)/bcmcnet_cmicr.h $(DSTIDIR) $(R) + -ln -s $(SRCIDIR)/bcmcnet_cmicr_acc.h $(DSTIDIR) $(R) -ln -s $(CNETDIR)/chip/*/*attach.c $(KNETDIR) $(R) -ln -s $(CNETDIR)/hmi/cmicd/*.c $(KNETDIR) $(R) -ln -s $(CNETDIR)/hmi/cmicx/*.c $(KNETDIR) $(R) + -ln -s $(CNETDIR)/hmi/cmicr/*.c $(KNETDIR) $(R) -ln -s $(CNETDIR)/main/bcmcnet_core.c $(KNETDIR) $(R) -ln -s $(CNETDIR)/main/bcmcnet_dev.c $(KNETDIR) $(R) -ln -s $(CNETDIR)/main/bcmcnet_rxtx.c $(KNETDIR) $(R) diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_buff.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_buff.h new file mode 120000 index 000000000000..b4bc2b7ffe74 --- /dev/null +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_buff.h @@ -0,0 +1 @@ +/sonic/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_buff.h \ No newline at end of file diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_cmicd.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_cmicd.h new file mode 120000 index 000000000000..cface69c6365 --- /dev/null +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_cmicd.h @@ -0,0 +1 @@ +/sonic/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_cmicd.h \ No newline at end of file diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_cmicx.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_cmicx.h new file mode 120000 index 000000000000..ee9f52060eae --- /dev/null +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_cmicx.h @@ -0,0 +1 @@ +/sonic/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_cmicx.h \ No newline at end of file diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_core.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_core.h new file mode 120000 index 000000000000..83e0769b2b5e --- /dev/null +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_core.h @@ -0,0 +1 @@ +/sonic/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_core.h \ No newline at end of file diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_dep.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_dep.h new file mode 120000 index 000000000000..8a9a6c6f6582 --- /dev/null +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_dep.h @@ -0,0 +1 @@ +/sonic/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_dep.h \ No newline at end of file diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_dev.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_dev.h new file mode 120000 index 000000000000..4ba5f9aefbaa --- /dev/null +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_dev.h @@ -0,0 +1 @@ +/sonic/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_dev.h \ No newline at end of file diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_internal.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_internal.h new file mode 120000 index 000000000000..e9c65317d643 --- /dev/null +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_internal.h @@ -0,0 +1 @@ +/sonic/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_internal.h \ No newline at end of file diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_rxtx.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_rxtx.h new file mode 120000 index 000000000000..7bfe68f89882 --- /dev/null +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_rxtx.h @@ -0,0 +1 @@ +/sonic/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_rxtx.h \ No newline at end of file diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_types.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_types.h new file mode 120000 index 000000000000..f2e6649cd0da --- /dev/null +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/include/bcmcnet/bcmcnet_types.h @@ -0,0 +1 @@ +/sonic/platform/broadcom/saibcm-modules/sdklt/bcmcnet/include/bcmcnet/bcmcnet_types.h \ No newline at end of file diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_buff.c b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_buff.c index 750fff69caf3..5d92ed016b49 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_buff.c +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_buff.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -109,7 +109,7 @@ bcmcnet_rx_buf_dma(struct pdma_dev *dev, struct pdma_rx_queue *rxq, /*! * Check Rx buffer */ -static int +static bool bcmcnet_rx_buf_avail(struct pdma_dev *dev, struct pdma_rx_queue *rxq, struct pdma_rx_buf *pbuf) { @@ -117,7 +117,7 @@ bcmcnet_rx_buf_avail(struct pdma_dev *dev, struct pdma_rx_queue *rxq, pbuf->skb = NULL; } - return pbuf->dma != 0; + return (pbuf->dma != 0); } /*! @@ -184,6 +184,10 @@ bcmcnet_rx_buf_put(struct pdma_dev *dev, struct pdma_rx_queue *rxq, dev_kfree_skb_any(pbuf->skb); } else { skb = pbuf->skb; + if (pbuf->pkb != (struct pkt_buf *)skb->data) { + dev_kfree_skb_any(skb); + return SHR_E_NONE; + } dma = dma_map_single(kdev->dev, &pbuf->pkb->data + pbuf->adj, rxq->buf_size, DMA_FROM_DEVICE); if (unlikely(dma_mapping_error(kdev->dev, dma))) { diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_buff.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_buff.h index 54768e826917..948815c48304 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_buff.h +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_buff.h @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_callback.c b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_callback.c index 21512a51fbd2..8f4ea5aa3f8f 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_callback.c +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_callback.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -34,14 +34,30 @@ ngknet_callback_control_get(struct ngknet_callback_ctrl **cbc) /*! * Call-back interfaces for other Linux kernel drivers. - * - * The Rx call-back allows an external module to modify packet contents - * before it is handed off to the Linux network stack. - * - * The Tx call-back allows an external module to modify packet contents - * before it is injected into the switch. */ +int +ngknet_dev_init_cb_register(ngknet_dev_init_cb_f dev_init_cb) +{ + if (callback_ctrl.dev_init_cb != NULL) { + return -1; + } + callback_ctrl.dev_init_cb = dev_init_cb; + + return 0; +} + +int +ngknet_dev_init_cb_unregister(ngknet_dev_init_cb_f dev_init_cb) +{ + if (dev_init_cb == NULL || callback_ctrl.dev_init_cb != dev_init_cb) { + return -1; + } + callback_ctrl.dev_init_cb = NULL; + + return 0; +} + int ngknet_rx_cb_register(ngknet_rx_cb_f rx_cb) { @@ -86,6 +102,28 @@ ngknet_tx_cb_unregister(ngknet_tx_cb_f tx_cb) return 0; } +int +ngknet_filter_cb_register(ngknet_filter_cb_f filter_cb) +{ + if (callback_ctrl.filter_cb != NULL) { + return -1; + } + callback_ctrl.filter_cb = filter_cb; + + return 0; +} + +int +ngknet_filter_cb_unregister(ngknet_filter_cb_f filter_cb) +{ + if (filter_cb == NULL || callback_ctrl.filter_cb != filter_cb) { + return -1; + } + callback_ctrl.filter_cb = NULL; + + return 0; +} + int ngknet_ptp_rx_config_set_cb_register(ngknet_ptp_config_set_cb_f ptp_rx_config_set_cb) { @@ -291,10 +329,14 @@ ngknet_netif_destroy_cb_unregister(ngknet_netif_cb_f netif_cb) return 0; } +EXPORT_SYMBOL(ngknet_dev_init_cb_register); +EXPORT_SYMBOL(ngknet_dev_init_cb_unregister); EXPORT_SYMBOL(ngknet_rx_cb_register); EXPORT_SYMBOL(ngknet_rx_cb_unregister); EXPORT_SYMBOL(ngknet_tx_cb_register); EXPORT_SYMBOL(ngknet_tx_cb_unregister); +EXPORT_SYMBOL(ngknet_filter_cb_register); +EXPORT_SYMBOL(ngknet_filter_cb_unregister); EXPORT_SYMBOL(ngknet_ptp_rx_config_set_cb_register); EXPORT_SYMBOL(ngknet_ptp_rx_config_set_cb_unregister); EXPORT_SYMBOL(ngknet_ptp_tx_config_set_cb_register); diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_callback.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_callback.h index 54583adffa36..abc78aa1874f 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_callback.h +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_callback.h @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -53,13 +53,14 @@ struct ngknet_callback_desc { /*! Packet data length */ int pkt_len; - - /*! Matched callback filter */ - struct ngknet_filter_s *filt_cb; }; #define NGKNET_SKB_CB(_skb) ((struct ngknet_callback_desc *)_skb->cb) +/*! TX/RX callback init */ +typedef void +(*ngknet_dev_init_cb_f)(const struct ngknet_dev *dev); + /*! Handle Rx packet */ typedef struct sk_buff * (*ngknet_rx_cb_f)(struct sk_buff *skb); @@ -68,6 +69,10 @@ typedef struct sk_buff * typedef struct sk_buff * (*ngknet_tx_cb_f)(struct sk_buff *skb); +/*! Handle Filter callback */ +typedef struct sk_buff * +(*ngknet_filter_cb_f)(struct sk_buff *skb, ngknet_filter_t **filt); + /*! PTP Rx/Tx config set */ typedef int (*ngknet_ptp_config_set_cb_f)(struct ngknet_private *priv, int *value); @@ -96,12 +101,18 @@ typedef int * \brief NGKNET callback control. */ struct ngknet_callback_ctrl { + /*! Handle TX/RX callback initialization. */ + ngknet_dev_init_cb_f dev_init_cb; + /*! Handle Rx packet */ ngknet_rx_cb_f rx_cb; /*! Handle Tx packet */ ngknet_tx_cb_f tx_cb; + /*! Handle filter callback */ + ngknet_filter_cb_f filter_cb; + /*! PTP Rx config set */ ngknet_ptp_config_set_cb_f ptp_rx_config_set_cb; @@ -140,6 +151,36 @@ struct ngknet_callback_ctrl { extern int ngknet_callback_control_get(struct ngknet_callback_ctrl **cbc); +/*! + * \brief Register TX/RX callback device initialization callback function. + * + * The device initialization callback allows an external module to + * perform device-specific initialization in preparation for Tx and Rx + * packet processing. + * + * \param [in] dev_init_cb TX/RX callback device initialization callback + * function. + * + * \retval SHR_E_NONE No errors. + */ +extern int +ngknet_dev_init_cb_register(ngknet_dev_init_cb_f dev_init_cb); + +/*! + * \brief Unegister TX/RX callback device initialization callback function. + * + * The device initialization callback allows an external module to + * perform device-specific initialization in preparation for Tx and Rx + * packet processing. + * + * \param [in] dev_init_cb TX/RX callback device initialization callback + * function. + * + * \retval SHR_E_NONE No errors. + */ +extern int +ngknet_dev_init_cb_unregister(ngknet_dev_init_cb_f dev_init_cb); + /*! * \brief Register Rx callback. * @@ -180,6 +221,26 @@ ngknet_tx_cb_register(ngknet_tx_cb_f tx_cb); extern int ngknet_tx_cb_unregister(ngknet_tx_cb_f tx_cb); +/*! + * \brief Register filter callback. + * + * \param [in] filter_cb Filter callback function. + * + * \retval SHR_E_NONE No errors. + */ +extern int +ngknet_filter_cb_register(ngknet_filter_cb_f filter_cb); + +/*! + * \brief Unregister filter callback. + * + * \param [in] filter_cb Filter callback function. + * + * \retval SHR_E_NONE No errors. + */ +extern int +ngknet_filter_cb_unregister(ngknet_filter_cb_f filter_cb); + /*! * \brief Register PTP Rx config set callback. * diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_dep.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_dep.h index 919dd6450340..4590a7a6f402 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_dep.h +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_dep.h @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -26,13 +26,6 @@ #include #include -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif - /*! Memorry barrier */ #define MEMORY_BARRIER smp_mb() diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_extra.c b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_extra.c index 00fdb3da8849..2124cd16f6fd 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_extra.c +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_extra.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -50,6 +50,9 @@ #include "ngknet_extra.h" #include "ngknet_callback.h" +/*! Defalut Rx tick for Rx rate limit control. */ +#define NGKNET_EXTRA_RATE_LIMIT_DEFAULT_RX_TICK 10 + static struct ngknet_rl_ctrl rl_ctrl; int @@ -72,7 +75,7 @@ ngknet_filter_create(struct ngknet_dev *dev, ngknet_filter_t *filter) case NGKNET_FILTER_DEST_T_NULL: case NGKNET_FILTER_DEST_T_NETIF: case NGKNET_FILTER_DEST_T_VNET: - case NGKNET_FILTER_DEST_T_CB: /* SDKLT-26907: support NGKNET_FILTER_DEST_T_CB */ + case NGKNET_FILTER_DEST_T_CB: break; default: return SHR_E_UNAVAIL; @@ -260,10 +263,13 @@ ngknet_rx_pkt_filter(struct ngknet_dev *dev, struct sk_buff *skb, struct net_dev unsigned long flags; int wsize; int chan_id; - int idx, match = 0, match_cb = 0; + int rv, idx, match = 0, match_cb = 0; - bcmcnet_pdma_dev_queue_to_chan(&dev->pdma_dev, pkb->pkh.queue_id, - PDMA_Q_RX, &chan_id); + rv = bcmcnet_pdma_dev_queue_to_chan(&dev->pdma_dev, pkb->pkh.queue_id, + PDMA_Q_RX, &chan_id); + if (SHR_FAILURE(rv)) { + return rv; + } spin_lock_irqsave(&dev->lock, flags); @@ -317,6 +323,26 @@ ngknet_rx_pkt_filter(struct ngknet_dev *dev, struct sk_buff *skb, struct net_dev if (match) { fc->hits++; + if (filt->dest_type == NGKNET_FILTER_DEST_T_CB) { + struct ngknet_callback_desc *cbd = NGKNET_SKB_CB(skb); + struct pkt_hdr *pkh = (struct pkt_hdr *)skb->data; + if (!dev->cbc->filter_cb) { + spin_unlock_irqrestore(&dev->lock, flags); + return SHR_E_UNAVAIL; + } + cbd->dev_no = dev->dev_no; + cbd->dev_id = dev->pdma_dev.dev_id; + cbd->type_str = dev->type_str; + cbd->pmd = skb->data + PKT_HDR_SIZE; + cbd->pmd_len = pkh->meta_len; + cbd->pkt_len = pkh->data_len; + cbd->filt = filt; + skb = dev->cbc->filter_cb(skb, &filt); + if (!skb || !filt) { + spin_unlock_irqrestore(&dev->lock, flags); + return SHR_E_UNAVAIL; + } + } switch (filt->dest_type) { case NGKNET_FILTER_DEST_T_NETIF: if (filt->dest_id == 0) { @@ -369,8 +395,8 @@ ngknet_rx_pkt_filter(struct ngknet_dev *dev, struct sk_buff *skb, struct net_dev NGKNET_SKB_CB(skb)->filt = filt; /* Add callback filter if matched */ - if (match_cb) { - NGKNET_SKB_CB(skb)->filt_cb = filt_cb; + if (priv) { + priv->filt_cb = match_cb? filt_cb : NULL; } } @@ -431,7 +457,7 @@ void ngknet_rx_rate_limit_init(struct ngknet_dev *devs) { sal_memset(&rl_ctrl, 0, sizeof(rl_ctrl)); - rl_ctrl.rx_ticks = 10; + rl_ctrl.rx_ticks = NGKNET_EXTRA_RATE_LIMIT_DEFAULT_RX_TICK; setup_timer(&rl_ctrl.timer, ngknet_rl_process, (timer_context_t)&rl_ctrl); spin_lock_init(&rl_ctrl.lock); rl_ctrl.devs = devs; @@ -480,6 +506,13 @@ ngknet_rx_rate_limit(struct ngknet_dev *dev, int limit) { unsigned long flags; + /* To support lower rate, we should use smaller tick (larger interval). */ + if (limit < 1000) { + rl_ctrl.rx_ticks = (limit + 99) / 100; + } else { + rl_ctrl.rx_ticks = NGKNET_EXTRA_RATE_LIMIT_DEFAULT_RX_TICK; + } + spin_lock_irqsave(&rl_ctrl.lock, flags); if ((++rl_ctrl.rx_pkts + rl_ctrl.rx_overruns > limit / rl_ctrl.rx_ticks) && !rl_ctrl.dev_paused[dev->dev_no] && rl_ctrl.dev_active[dev->dev_no]) { diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_extra.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_extra.h index 27dea9e368e7..f9ef71f118d9 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_extra.h +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_extra.h @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_linux.c b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_linux.c index 0162ae5b96c1..0f1ec3348c71 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_linux.c +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_linux.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -39,11 +39,19 @@ unsigned long sal_time_usecs(void) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) struct timeval tv; kal_time_val_get(&tv); return tv.tv_sec * 1000000 + tv.tv_usec; +#else + struct timespec64 tv; + + kal_time_val_get(&tv); + + return tv.tv_sec * 1000000 + tv.tv_nsec / 1000; +#endif } void diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_linux.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_linux.h index 686aac8f5571..faed6d1f8db8 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_linux.h +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_linux.h @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -113,7 +113,7 @@ kal_time_val_get(struct timeval *tv) { do_gettimeofday(tv); } -#else +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) static inline void kal_time_val_get(struct timeval *tv) { @@ -122,6 +122,12 @@ kal_time_val_get(struct timeval *tv) tv->tv_sec = ts.tv_sec; tv->tv_usec = ts.tv_nsec / 1000; } +#else +static inline void +kal_time_val_get(struct timespec64 *tv) +{ + ktime_get_real_ts64(tv); +} #endif /* KERNEL_VERSION(3,17,0) */ static inline unsigned long diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_main.c b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_main.c index b8af31d85ff2..cc40fd76d224 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_main.c +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_main.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -66,6 +66,7 @@ #include #include #include +#include #include #include #include @@ -193,7 +194,7 @@ struct ngknet_intr_handle { int napi_pending; }; -static struct ngknet_intr_handle priv_hdl[NUM_PDMA_DEV_MAX][NUM_QUE_MAX]; +static struct ngknet_intr_handle priv_hdl[NUM_PDMA_DEV_MAX][NUM_Q_MAX]; /*! * Dump packet content for debug @@ -233,26 +234,52 @@ ngknet_pkt_dump(uint8_t *data, int len) static void ngknet_pkt_stats(struct pdma_dev *pdev, int dir) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) static struct timeval tv0[2], tv1[2]; +#else + static struct timespec64 tv0[2], tv1[2]; +#endif static uint32_t pkts[2] = {0}, prts[2] = {0}; static uint64_t intrs = 0; + uint32_t iv_time; + uint32_t pps; + uint32_t boudary; + + if (rx_rate_limit == -1 || rx_rate_limit >= 100000) { + /* Dump every 100K packets */ + boudary = 100000; + } else if (rx_rate_limit >= 10000) { + /* Dump every 10K packets */ + boudary = 10000; + } else { + /* Dump every 1K packets */ + boudary = 1000; + } if (pkts[dir] == 0) { kal_time_val_get(&tv0[dir]); intrs = pdev->stats.intrs; } - if (++pkts[dir] >= 100000) { - uint32_t iv_time; - uint32_t pps; + if (++pkts[dir] >= boudary) { kal_time_val_get(&tv1[dir]); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) iv_time = (tv1[dir].tv_sec - tv0[dir].tv_sec) * 1000000 + (tv1[dir].tv_usec - tv0[dir].tv_usec); - pps = 100000 * 1000 / (iv_time / 1000); +#else + iv_time = (tv1[dir].tv_sec - tv0[dir].tv_sec) * 1000000 + + (tv1[dir].tv_nsec - tv0[dir].tv_nsec) / 1000; +#endif + pps = boudary * 1000 / (iv_time / 1000); prts[dir]++; - if (pps <= 100000 || prts[dir] * 100000 >= pps) { - printk(KERN_CRIT "%s -- limit: %d pps, 100K pkts time: %d usec, rate: %d pps, intrs: %llu\n", + /* pdev->stats.intrs is reset and re-count from 0. */ + if (intrs > pdev->stats.intrs) { + intrs = 0; + } + if (pps <= boudary || prts[dir] * boudary >= pps) { + printk(KERN_CRIT "%s - limit: %d pps, %dK pkts time: %d usec, " + "rate: %d pps, intrs: %llu\n", dir == PDMA_Q_RX ? "Rx" : "Tx", - dir == PDMA_Q_RX ? rx_rate_limit : -1, + dir == PDMA_Q_RX ? rx_rate_limit : -1, (boudary / 1000), iv_time, pps, pdev->stats.intrs - intrs); prts[dir] = 0; } @@ -357,12 +384,15 @@ ngknet_rx_frame_process(struct net_device *ndev, struct sk_buff **oskb) skb_pull(skb, PKT_HDR_SIZE + meta_len); } + /* Check to ensure ngknet_callback_desc struct fits in sk_buff->cb */ + BUILD_BUG_ON(sizeof(struct ngknet_callback_desc) > sizeof(skb->cb)); + /* Optional callback handle */ if (dev->cbc->rx_cb) { struct ngknet_callback_desc *cbd = NGKNET_SKB_CB(skb); cbd->dev_no = dev->dev_no; cbd->dev_id = dev->pdma_dev.dev_id; - cbd->type_str = drv_ops[dev->pdma_dev.dev_type]->drv_desc; + cbd->type_str = dev->type_str; cbd->priv = priv; if (priv->flags & NGKNET_NETIF_F_RCPU_ENCAP) { cbd->pmd = skb->data + PKT_HDR_SIZE; @@ -409,7 +439,7 @@ ngknet_netif_recv(struct net_device *ndev, struct sk_buff *skb) struct pkt_hdr *pkh = (struct pkt_hdr *)skb->data; struct napi_struct *napi = NULL; uint16_t proto; - int chan, gi, qi; + int chan_id, gi, qi, skb_len; int rv; /* Handle one incoming packet */ @@ -449,19 +479,26 @@ ngknet_netif_recv(struct net_device *ndev, struct sk_buff *skb) skb_record_rx_queue(skb, pkh->queue_id); - bcmcnet_pdma_dev_queue_to_chan(pdev, pkh->queue_id, PDMA_Q_RX, &chan); - gi = chan / pdev->grp_queues; + rv = bcmcnet_pdma_dev_queue_to_chan(pdev, pkh->queue_id, PDMA_Q_RX, &chan_id); + if (SHR_FAILURE(rv)) { + return rv; + } + + gi = chan_id / pdev->grp_queues; if (pdev->flags & PDMA_GROUP_INTR) { napi = (struct napi_struct *)pdev->ctrl.grp[gi].intr_hdl[0].priv; } else { qi = pkh->queue_id; napi = (struct napi_struct *)pdev->ctrl.grp[gi].intr_hdl[qi].priv; } + + /* FIXME: File CSP on KASAN warning on use-after-free in ngknet_netif_recv */ + skb_len = skb->len; napi_gro_receive(napi, skb); /* Update accounting */ priv->stats.rx_packets++; - priv->stats.rx_bytes += skb->len; + priv->stats.rx_bytes += skb_len; /* Rate limit */ if (rx_rate_limit >= 0) { @@ -500,6 +537,8 @@ ngknet_frame_recv(struct pdma_dev *pdev, int queue, void *buf) ngknet_pkt_dump(skb->data, skb->len); } + DBG_NDEV(("Valid virtual network devices: %ld.\n", (long)dev->vdev[0])); + /* Go through the filters */ rv = ngknet_rx_pkt_filter(dev, skb, &ndev, &mndev, &mskb); if (SHR_FAILURE(rv) || !ndev) { @@ -640,7 +679,7 @@ ngknet_tx_frame_process(struct net_device *ndev, struct sk_buff **oskb) struct pkt_hdr *pkh = (struct pkt_hdr *)skb->data; struct sk_buff *nskb = NULL; char *data = NULL; - uint32_t copy_len, meta_len, data_len, pkt_len, tag_len; + uint32_t copy_len, meta_len, data_len, pkt_len, tag_len, pad_len; uint16_t tpid; /* Set up packet header */ @@ -649,13 +688,13 @@ ngknet_tx_frame_process(struct net_device *ndev, struct sk_buff **oskb) data_len = pkh->attrs & PDMA_TX_HDR_COOKED ? pkh->data_len - ETH_FCS_LEN : ntohs(rch->data_len); pkt_len = PKT_HDR_SIZE + rch->meta_len + data_len; - if (skb->len != pkt_len || skb->len < (PKT_HDR_SIZE + 14)) { - DBG_WARN(("Tx drop: Invalid RCPU encapsulation\n")); - return SHR_E_FAIL; + if (skb->len != pkt_len || skb->len < (PKT_HDR_SIZE + ETH_HLEN)) { + DBG_WARN(("Tx drop: Invalid packet length\n")); + return SHR_E_PARAM; } if (dev->rcpu_ctrl.pkt_sig && dev->rcpu_ctrl.pkt_sig != ntohs(rch->pkt_sig)) { - DBG_WARN(("Tx drop: Invalid RCPU signature\n")); - return SHR_E_FAIL; + DBG_WARN(("Tx drop: Invalid packet signature\n")); + return SHR_E_PARAM; } if (pkh->attrs & PDMA_TX_HDR_COOKED) { /* Resumed packet */ @@ -676,6 +715,9 @@ ngknet_tx_frame_process(struct net_device *ndev, struct sk_buff **oskb) if (rch->flags & RCPU_FLAG_BIND_QUE) { pkh->attrs |= PDMA_TX_BIND_QUE; } + if (rch->flags & RCPU_FLAG_NO_PAD) { + pkh->attrs |= PDMA_TX_NO_PAD; + } } else { /* Non-RCPU encapsulation packet */ data_len = pkh->data_len - ETH_FCS_LEN; @@ -756,7 +798,7 @@ ngknet_tx_frame_process(struct net_device *ndev, struct sk_buff **oskb) struct ngknet_callback_desc *cbd = NGKNET_SKB_CB(skb); cbd->dev_no = dev->dev_no; cbd->dev_id = dev->pdma_dev.dev_id; - cbd->type_str = drv_ops[dev->pdma_dev.dev_type]->drv_desc; + cbd->type_str = dev->type_str; cbd->priv = priv; cbd->pmd = skb->data + PKT_HDR_SIZE; cbd->pmd_len = pkh->meta_len; @@ -773,9 +815,10 @@ ngknet_tx_frame_process(struct net_device *ndev, struct sk_buff **oskb) } /* Pad packet if needed */ - if (pkh->data_len < (64 + tag_len)) { - pkh->data_len = 64 + tag_len; - if (skb_padto(skb, PKT_HDR_SIZE + pkh->meta_len + pkh->data_len - ETH_FCS_LEN)) { + pad_len = ETH_ZLEN + ETH_FCS_LEN + tag_len; + if (pkh->data_len < pad_len && !(pkh->attrs & PDMA_TX_NO_PAD)) { + pkh->data_len = pad_len; + if (skb_padto(skb, PKT_HDR_SIZE + pkh->meta_len + pkh->data_len)) { if (!nskb) { *oskb = NULL; } @@ -847,10 +890,13 @@ ngknet_tx_resume(struct pdma_dev *pdev, int queue) */ static void ngknet_intr_enable(struct pdma_dev *pdev, int cmc, int chan, - uint32_t reg, uint32_t mask) + uint32_t reg, uint32_t val) { - pdev->ctrl.grp[cmc].irq_mask |= mask; - ngbde_kapi_intr_mask_write(pdev->unit, 0, reg, pdev->ctrl.grp[cmc].irq_mask); + if (val) { + ngbde_kapi_iio_write32(pdev->unit, reg, val); + } else { + ngbde_kapi_intr_mask_write(pdev->unit, 0, reg, pdev->ctrl.grp[cmc].irq_mask); + } } /*! @@ -858,10 +904,13 @@ ngknet_intr_enable(struct pdma_dev *pdev, int cmc, int chan, */ static void ngknet_intr_disable(struct pdma_dev *pdev, int cmc, int chan, - uint32_t reg, uint32_t mask) + uint32_t reg, uint32_t val) { - pdev->ctrl.grp[cmc].irq_mask &= ~mask; - ngbde_kapi_intr_mask_write(pdev->unit, 0, reg, pdev->ctrl.grp[cmc].irq_mask); + if (val) { + ngbde_kapi_iio_write32(pdev->unit, reg, val); + } else { + ngbde_kapi_intr_mask_write(pdev->unit, 0, reg, pdev->ctrl.grp[cmc].irq_mask); + } } /*! @@ -1277,23 +1326,22 @@ ngknet_start_xmit(struct sk_buff *skb, struct net_device *ndev) rv = pdev->pkt_xmit(pdev, queue, skb); - if (rv == SHR_E_UNAVAIL) { - DBG_WARN(("Tx drop: DMA device not ready\n")); - priv->stats.tx_dropped++; - if (skb != bskb) { - dev_kfree_skb_any(skb); - } - dev_kfree_skb_any(bskb); - return NETDEV_TX_OK; - } - if (rv == SHR_E_BUSY) { - DBG_WARN(("Tx suspend: No DMA resources\n")); + DBG_WARN(("Tx suspend: DMA device is busy and temporarily " + "unavailable.\n")); priv->stats.tx_fifo_errors++; if (skb != bskb) { dev_kfree_skb_any(skb); } return NETDEV_TX_BUSY; + } else if (rv != SHR_E_NONE) { + DBG_WARN(("Tx drop: DMA device not ready or not supported.\n")); + priv->stats.tx_dropped++; + if (skb != bskb) { + dev_kfree_skb_any(skb); + } + dev_kfree_skb_any(bskb); + return NETDEV_TX_OK; } else { if (skb != bskb) { dev_kfree_skb_any(bskb); @@ -1351,7 +1399,7 @@ ngknet_change_mtu(struct net_device *ndev, int new_mtu) { int frame_size = new_mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN; - if (frame_size < 68 || frame_size > rx_buffer_size) { + if (frame_size < (ETH_ZLEN + ETH_FCS_LEN) || frame_size > rx_buffer_size) { return -EINVAL; } @@ -1536,7 +1584,7 @@ ngknet_ndev_init(ngknet_netif_t *netif, struct net_device **nd) return SHR_E_PARAM; } - ndev = alloc_etherdev_mq(sizeof(struct ngknet_private), NUM_QUE_MAX); + ndev = alloc_etherdev_mq(sizeof(struct ngknet_private), NUM_Q_MAX); if (!ndev) { DBG_WARN(("Error allocating network device.\n")); return SHR_E_MEMORY; @@ -1596,6 +1644,22 @@ ngknet_ndev_init(ngknet_netif_t *netif, struct net_device **nd) return SHR_E_NONE; } +static int +ngknet_dev_remove(int dn); + +static int +ngknet_bde_event_handler(int kdev, int event, void *data) +{ + DBG_VERB(("%s: callback from BDE with kdev(%d) event(%d).\n", + __FUNCTION__, kdev, event)); + + if (event == NGBDE_EVENT_DEV_REMOVE) { + ngknet_dev_remove(kdev); + } + + return SHR_E_NONE; +} + /*! * \brief Initialize Packet DMA device. * @@ -1678,6 +1742,9 @@ ngknet_dev_info_get(int dn) } dev->dev_no = dn; + strlcpy(dev->type_str, + drv_ops[dev->pdma_dev.dev_type]->drv_desc, + sizeof(dev->type_str)); return SHR_E_NONE; } @@ -1730,6 +1797,11 @@ ngknet_dev_probe(int dn, ngknet_netif_t *netif) } } + if (netif->chan >= NUM_Q_MAX) { + DBG_WARN(("Exceed max number of queues : %d.\n", netif->chan)); + return SHR_E_PARAM; + } + rv = ngknet_ndev_init(netif, &ndev); if (SHR_FAILURE(rv)) { bcmcnet_pdma_dev_cleanup(pdev); @@ -1810,6 +1882,9 @@ ngknet_dev_probe(int dn, ngknet_netif_t *netif) DBG_NDEV(("MAC: %pM\n", ndev->dev_addr)); DBG_NDEV(("Running with NAPI enabled\n")); + /* Register handler for BDE events. */ + ngbde_kapi_knet_connect(dn, ngknet_bde_event_handler, dev); + return SHR_E_NONE; } @@ -1835,6 +1910,7 @@ ngknet_dev_remove(int dn) int rv; if (!(dev->flags & NGKNET_DEV_ACTIVE)) { + ngbde_kapi_knet_disconnect(dn); return SHR_E_NONE; } @@ -1873,7 +1949,7 @@ ngknet_dev_remove(int dn) unregister_netdev(ndev); free_netdev(ndev); - for (qi = 0; qi < NUM_QUE_MAX; qi++) { + for (qi = 0; qi < NUM_Q_MAX; qi++) { dev->bdev[qi] = NULL; } @@ -1899,6 +1975,7 @@ ngknet_dev_remove(int dn) if (SHR_FAILURE(rv)) { DBG_WARN(("Detach DMA driver failed.\n")); } + ngbde_kapi_knet_disconnect(dn); return rv; } @@ -1937,6 +2014,11 @@ ngknet_netif_create(struct ngknet_dev *dev, ngknet_netif_t *netif) } } + if (netif->chan >= NUM_Q_MAX) { + DBG_WARN(("Exceed max number of queues : %d.\n", netif->chan)); + return SHR_E_PARAM; + } + rv = ngknet_ndev_init(netif, &ndev); if (SHR_FAILURE(rv)) { return rv; @@ -2262,6 +2344,7 @@ ngknet_ioctl(struct file *file, unsigned int cmd, unsigned long arg) } if (!strcasecmp(dev_cfg->type_str, drv_ops[dt]->drv_desc)) { pdev->dev_type = dt; + strlcpy(dev->var_str, dev_cfg->var_str, sizeof(dev->var_str)); break; } } @@ -2288,6 +2371,10 @@ ngknet_ioctl(struct file *file, unsigned int cmd, unsigned long arg) if (SHR_FAILURE((int)ioc.rc)) { break; } + if (dev->cbc->dev_init_cb) { + dev->cbc->dev_init_cb(dev); + } + if (kal_copy_to_user((void *)(unsigned long)ioc.op.data.buf, dev_cfg, ioc.op.data.len, sizeof(*dev_cfg))) { return -EFAULT; @@ -2380,7 +2467,13 @@ ngknet_ioctl(struct file *file, unsigned int cmd, unsigned long arg) if (rx_rate_limit >= 0) { ngknet_rx_rate_limit_stop(dev); } - ioc.rc = bcmcnet_pdma_dev_suspend(pdev); + if (ioc.iarg[0]) { + /* Graceful suspend */ + ioc.rc = bcmcnet_pdma_dev_suspend(pdev); + } else { + pdev->flags |= PDMA_ABORT; + ioc.rc = bcmcnet_pdma_dev_suspend(pdev); + } break; case NGKNET_DEV_RESUME: DBG_CMD(("NGKNET_DEV_RESUME\n")); diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_main.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_main.h index fb38f1b9abc3..71ea0fb84fdf 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_main.h +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_main.h @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -68,6 +68,12 @@ * Device description */ struct ngknet_dev { + /*! Device type string */ + char type_str[NGKNET_DEV_NAME_MAX]; + + /*! Device type string */ + char var_str[NGKNET_DEV_NAME_MAX]; + /*! Base address for PCI register access */ volatile void *base_addr; @@ -86,11 +92,11 @@ struct ngknet_dev { /*! Device number (from BDE) */ int dev_no; - /*! Vitual network devices, 0 is reserved */ + /*! Virtual network devices, 0 is reserved for valid number of devices. */ struct net_device *vdev[NUM_VDEV_MAX + 1]; - /*! Vitual network devices bound to queue */ - struct net_device *bdev[NUM_QUE_MAX]; + /*! Virtual network devices bound to queue */ + struct net_device *bdev[NUM_Q_MAX]; /*! Filter list */ struct list_head filt_list; @@ -191,6 +197,9 @@ struct ngknet_private { /*! HW timestamp Tx type */ int hwts_tx_type; + + /*! Matched callback filter */ + struct ngknet_filter_s *filt_cb; }; /*! diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_procfs.c b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_procfs.c index 85edaa26abb9..60b59c0761d6 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_procfs.c +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_procfs.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or @@ -88,6 +88,7 @@ proc_debug_level_release(struct inode *inode, struct file *file) return single_release(inode, file); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) static struct file_operations proc_debug_level_fops = { owner: THIS_MODULE, open: proc_debug_level_open, @@ -96,6 +97,15 @@ static struct file_operations proc_debug_level_fops = { llseek: seq_lseek, release: proc_debug_level_release, }; +#else +static struct proc_ops proc_debug_level_fops = { + proc_open: proc_debug_level_open, + proc_read: seq_read, + proc_write: proc_debug_level_write, + proc_lseek: seq_lseek, + proc_release: proc_debug_level_release, +}; +#endif static int proc_device_info_show(struct seq_file *m, void *v) @@ -168,6 +178,7 @@ proc_device_info_release(struct inode *inode, struct file *file) return single_release(inode, file); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) static struct file_operations proc_device_info_fops = { owner: THIS_MODULE, open: proc_device_info_open, @@ -175,6 +186,14 @@ static struct file_operations proc_device_info_fops = { llseek: seq_lseek, release: proc_device_info_release, }; +#else +static struct proc_ops proc_device_info_fops = { + proc_open: proc_device_info_open, + proc_read: seq_read, + proc_lseek: seq_lseek, + proc_release: proc_device_info_release, +}; +#endif static int proc_filter_info_show(struct seq_file *m, void *v) @@ -250,6 +269,7 @@ proc_filter_info_release(struct inode *inode, struct file *file) return single_release(inode, file); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) static struct file_operations proc_filter_info_fops = { owner: THIS_MODULE, open: proc_filter_info_open, @@ -257,6 +277,14 @@ static struct file_operations proc_filter_info_fops = { llseek: seq_lseek, release: proc_filter_info_release, }; +#else +static struct proc_ops proc_filter_info_fops = { + proc_open: proc_filter_info_open, + proc_read: seq_read, + proc_lseek: seq_lseek, + proc_release: proc_filter_info_release, +}; +#endif static int proc_netif_info_show(struct seq_file *m, void *v) @@ -342,6 +370,7 @@ proc_netif_info_release(struct inode *inode, struct file *file) return single_release(inode, file); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) static struct file_operations proc_netif_info_fops = { owner: THIS_MODULE, open: proc_netif_info_open, @@ -349,6 +378,14 @@ static struct file_operations proc_netif_info_fops = { llseek: seq_lseek, release: proc_netif_info_release, }; +#else +static struct proc_ops proc_netif_info_fops = { + proc_open: proc_netif_info_open, + proc_read: seq_read, + proc_lseek: seq_lseek, + proc_release: proc_netif_info_release, +}; +#endif static int proc_pkt_stats_show(struct seq_file *m, void *v) @@ -380,6 +417,9 @@ proc_pkt_stats_show(struct seq_file *m, void *v) } seq_printf(m, "rx_dropped: %llu\n", (unsigned long long)stats->rx_dropped); seq_printf(m, "rx_errors: %llu\n", (unsigned long long)stats->rx_errors); + seq_printf(m, "rx_head_errors: %llu\n", (unsigned long long)stats->rx_head_errors); + seq_printf(m, "rx_data_errors: %llu\n", (unsigned long long)stats->rx_data_errors); + seq_printf(m, "rx_cell_errors: %llu\n", (unsigned long long)stats->rx_cell_errors); seq_printf(m, "rx_nomems: %llu\n", (unsigned long long)stats->rx_nomems); seq_printf(m, "tx_packets: %llu\n", (unsigned long long)stats->tx_packets); seq_printf(m, "tx_bytes: %llu\n", (unsigned long long)stats->tx_bytes); @@ -415,6 +455,7 @@ proc_pkt_stats_release(struct inode *inode, struct file *file) return single_release(inode, file); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) static struct file_operations proc_pkt_stats_fops = { owner: THIS_MODULE, open: proc_pkt_stats_open, @@ -422,6 +463,14 @@ static struct file_operations proc_pkt_stats_fops = { llseek: seq_lseek, release: proc_pkt_stats_release, }; +#else +static struct proc_ops proc_pkt_stats_fops = { + proc_open: proc_pkt_stats_open, + proc_read: seq_read, + proc_lseek: seq_lseek, + proc_release: proc_pkt_stats_release, +}; +#endif static int proc_rate_limit_show(struct seq_file *m, void *v) @@ -461,6 +510,7 @@ proc_rate_limit_release(struct inode *inode, struct file *file) return single_release(inode, file); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) static struct file_operations proc_rate_limit_fops = { owner: THIS_MODULE, open: proc_rate_limit_open, @@ -469,6 +519,15 @@ static struct file_operations proc_rate_limit_fops = { llseek: seq_lseek, release: proc_rate_limit_release, }; +#else +static struct proc_ops proc_rate_limit_fops = { + proc_open: proc_rate_limit_open, + proc_read: seq_read, + proc_write: proc_rate_limit_write, + proc_lseek: seq_lseek, + proc_release: proc_rate_limit_release, +}; +#endif static int proc_reg_status_show(struct seq_file *m, void *v) @@ -512,6 +571,7 @@ proc_reg_status_release(struct inode *inode, struct file *file) return single_release(inode, file); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) static struct file_operations proc_reg_status_fops = { owner: THIS_MODULE, open: proc_reg_status_open, @@ -519,6 +579,14 @@ static struct file_operations proc_reg_status_fops = { llseek: seq_lseek, release: proc_reg_status_release, }; +#else +static struct proc_ops proc_reg_status_fops = { + proc_open: proc_reg_status_open, + proc_read: seq_read, + proc_lseek: seq_lseek, + proc_release: proc_reg_status_release, +}; +#endif static int proc_ring_status_show(struct seq_file *m, void *v) @@ -566,6 +634,7 @@ proc_ring_status_release(struct inode *inode, struct file *file) return single_release(inode, file); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) static struct file_operations proc_ring_status_fops = { owner: THIS_MODULE, open: proc_ring_status_open, @@ -573,6 +642,14 @@ static struct file_operations proc_ring_status_fops = { llseek: seq_lseek, release: proc_ring_status_release, }; +#else +static struct proc_ops proc_ring_status_fops = { + proc_open: proc_ring_status_open, + proc_read: seq_read, + proc_lseek: seq_lseek, + proc_release: proc_ring_status_release, +}; +#endif int ngknet_procfs_init(void) diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_procfs.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_procfs.h index 3c1938121ebb..99e1ce93c48d 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_procfs.h +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_procfs.h @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_ptp.c b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_ptp.c index 13579208eab0..75e22bc43f17 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_ptp.c +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_ptp.c @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_ptp.h b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_ptp.h index 86dcb6c4904a..e881c77b5273 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_ptp.h +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knet/ngknet_ptp.h @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knetcb/Kbuild b/platform/broadcom/saibcm-modules/sdklt/linux/knetcb/Kbuild index 2ce66edb3c63..6a60777e9c48 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/knetcb/Kbuild +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knetcb/Kbuild @@ -2,7 +2,7 @@ # # Linux KNET Callback module. # -# $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. +# $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. # # This program is free software; you can redistribute it and/or @@ -24,13 +24,17 @@ endif obj-m := linux_ngknetcb.o -ccflags-y := $(LKM_CFLAGS) \ - -I$(SDK)/shr/include \ - -I$(SDK)/bcmdrd/include \ - -I$(SDK)/linux/include \ - -I$(SDK)/linux/knet/include \ - -I$(SDK)/linux/knet \ - $(PSAMPLE_CFLAGS) +ccflags-y := $(KNETCB_CPPFLAGS) $(LKM_CFLAGS) \ + $(SDK_PMD_KFLAGS) \ + -I$(SDK)/shr/include \ + -I$(SDK)/bcmdrd/include \ + -I$(SDK)/bcmltd/include \ + -I$(SDK)/bcmlrd/include \ + -I$(SDK)/linux/include \ + -I$(SDK)/linux/knet/include \ + -I$(SDK)/linux/knetcb \ + -I$(SDK)/linux/knet \ + $(PSAMPLE_CFLAGS) -linux_ngknetcb-y := ngknetcb_main.o \ +linux_ngknetcb-y := $(SDK_PMD_KOBJS) ngknetcb_main.o \ $(PSAMPLE_CB_OBJS) diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knetcb/Makefile b/platform/broadcom/saibcm-modules/sdklt/linux/knetcb/Makefile index e2acfed49d6c..4698183db035 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/knetcb/Makefile +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knetcb/Makefile @@ -2,7 +2,7 @@ # # Linux KNET Callback module. # -# $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. +# $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. # # This program is free software; you can redistribute it and/or @@ -18,6 +18,24 @@ # be found in the LICENSES folder.$ # +ifdef KPMD + +BCMPKTDIR = $(SDK)/bcmpkt +KPMDDIR = $(SDK)/linux/knetcb +SHRDIR = $(SDK)/shr + +.PHONY: mklinks rmlinks + +knetcb: mklinks + $(MAKE) all + +# SDK make helper for stand-alone PMD kernel module +include $(SDK)/make/kpmd.mk + +distclean: rmlinks + +endif #KPMD + include Kbuild ifeq ($(KERNELRELEASE),) diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knetcb/ngknetcb_main.c b/platform/broadcom/saibcm-modules/sdklt/linux/knetcb/ngknetcb_main.c index aa248dafce52..c456ebbdf73e 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/knetcb/ngknetcb_main.c +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knetcb/ngknetcb_main.c @@ -73,20 +73,23 @@ strip_vlan_tag(struct sk_buff *skb) * -1 = Unsupported type */ static int -get_tag_status(uint32_t dev_type, void *meta) +get_tag_status(uint32_t dev_type, uint32_t variant, void *meta) { uint32_t *valptr; uint32_t fd_index; uint32_t outer_l2_hdr; int tag_status = -1; + uint32_t match_id_minbit = 1; + uint32_t outer_tag_match = 0x10; if ((dev_type == 0xb880) || (dev_type == 0xb780)) { /* Field BCM_PKTIO_RXPMD_MATCH_ID_LO has tag status in RX PMD */ fd_index = 2; valptr = (uint32_t *)meta; - outer_l2_hdr = (valptr[fd_index] >> ((dev_type == 0xb780) ? 2 : 1) & 0xFF); - + match_id_minbit = (dev_type == 0xb780) ? 2 : 1; + outer_l2_hdr = (valptr[fd_index] >> match_id_minbit & 0xFF); + outer_tag_match = ((dev_type == 0xb780 && variant == 1) ? 0x8 : 0x10); if (outer_l2_hdr & 0x1) { #ifdef KNET_CB_DEBUG if (debug & 0x1) { @@ -102,7 +105,7 @@ get_tag_status(uint32_t dev_type, void *meta) #endif tag_status = 0; } - if (outer_l2_hdr & 0x10) { + if (outer_l2_hdr & outer_tag_match) { #ifdef KNET_CB_DEBUG if (debug & 0x1) { printk(" Outer Tagged\n"); @@ -122,7 +125,7 @@ get_tag_status(uint32_t dev_type, void *meta) #ifdef KNET_CB_DEBUG if (debug & 0x1) { printk(" Inner Tagged\n"); - } + } #endif tag_status = 1; } @@ -188,7 +191,7 @@ dump_buffer(uint8_t * data, int size) buffer_ptr = buffer; printk(KERN_INFO "%04X %s\n", addr, buffer); addr = i + 1; - } + } } } @@ -205,9 +208,9 @@ static void show_mac(uint8_t *pkt) { if (debug & 0x1) { - printk("DMAC=%02X:%02X:%02X:%02X:%02X:%02X\n", - pkt[0], pkt[1], pkt[2], pkt[3], pkt[4], pkt[5]); - } + printk("DMAC=%02X:%02X:%02X:%02X:%02X:%02X\n", + pkt[0], pkt[1], pkt[2], pkt[3], pkt[4], pkt[5]); +} } #endif @@ -231,10 +234,10 @@ strip_tag_rx_cb(struct sk_buff *skb) cbd->dev_no, cbd->dev_id, cbd->type_str, rcpu_mode ? "yes" : "no"); printk(KERN_INFO " pkt_len=%4d; pmd_len=%2d; SKB len: %4d\n", cbd->pkt_len, cbd->pmd_len, skb->len); - if (cbd->filt) { + if (cbd->filt) { printk(KERN_INFO "Filter user data: 0x%08x\n", *(uint32_t *) cbd->filt->user_data); - } + } printk(KERN_INFO "Before SKB (%d bytes):\n", skb->len); dump_buffer(skb->data, skb->len); printk("rx_cb for dev %d: id 0x%x, %s\n", cbd->dev_no, cbd->dev_id, cbd->type_str); @@ -256,7 +259,7 @@ strip_tag_rx_cb(struct sk_buff *skb) if ((!rcpu_mode) && (cbd->filt)) { if (FILTER_TAG_ORIGINAL == cbd->filt->user_data[0]) { - tag_status = get_tag_status(cbd->dev_id, (void *)cbd->pmd); + tag_status = get_tag_status(cbd->dev_id, cbd->filt->user_data[1],(void *)cbd->pmd); if (tag_status < 0) { strip_stats.skipped++; goto _strip_tag_rx_cb_exit; @@ -267,6 +270,10 @@ strip_tag_rx_cb(struct sk_buff *skb) strip_vlan_tag(skb); } } + if (FILTER_TAG_STRIP == cbd->filt->user_data[0]) { + strip_stats.stripped++; + strip_vlan_tag(skb); + } } _strip_tag_rx_cb_exit: #ifdef KNET_CB_DEBUG @@ -288,7 +295,7 @@ strip_tag_tx_cb(struct sk_buff *skb) struct ngknet_callback_desc *cbd = NGKNET_SKB_CB(skb); if (debug & 0x1) { - printk("tx_cb for dev %d: %s\n", cbd->dev_no, cbd->type_str); + printk("tx_cb for dev %d: %s\n", cbd->dev_no, cbd->type_str); } show_pmd(cbd->pmd, cbd->pmd_len); show_mac(cbd->pmd + cbd->pmd_len); @@ -391,6 +398,17 @@ static struct file_operations ngknetcb_fops = { .mmap = ngknetcb_mmap, }; +static struct proc_ops ngknetcb_proc_ops = { + .proc_open = ngknetcb_open, + .proc_read = seq_read, + .proc_write = ngknetcb_write, + .proc_lseek = seq_lseek, + .proc_release = ngknetcb_release, + .proc_ioctl = ngknetcb_ioctl, + .proc_compat_ioctl = ngknetcb_ioctl, + .proc_mmap = ngknetcb_mmap, +}; + static int __init ngknetcb_init_module(void) { @@ -404,7 +422,7 @@ ngknetcb_init_module(void) return rv; } - PROC_CREATE(entry, NGKNETCB_MODULE_NAME, 0666, NULL, &ngknetcb_fops); + PROC_CREATE(entry, NGKNETCB_MODULE_NAME, 0666, NULL, &ngknetcb_proc_ops); if (entry == NULL) { printk(KERN_ERR "%s: proc_mkdir failed\n", NGKNETCB_MODULE_NAME); diff --git a/platform/broadcom/saibcm-modules/sdklt/linux/knetcb/psample-cb.c b/platform/broadcom/saibcm-modules/sdklt/linux/knetcb/psample-cb.c index be34430218d3..a35c21cf37f4 100644 --- a/platform/broadcom/saibcm-modules/sdklt/linux/knetcb/psample-cb.c +++ b/platform/broadcom/saibcm-modules/sdklt/linux/knetcb/psample-cb.c @@ -302,7 +302,7 @@ psample_rx_cb(struct sk_buff *skb) cbd = NGKNET_SKB_CB(skb); netif = cbd->priv; filt_src = cbd->filt; - filt = cbd->filt_cb; + filt = netif->filt_cb; if (!cbd || !netif || !filt_src) { printk("%s: cbd(0x%p) or priv(0x%p) or filter src(0x%p) is NULL\n", @@ -429,8 +429,9 @@ psample_rx_cb(struct sk_buff *skb) PSAMPLE_FILTER_CB_PKT_HANDLED: /* if sample reason only, consume pkt. else pass through */ rv = psample_meta_sample_reason(skb->data, cbd->pmd); - if (rv) { + if (PSAMPLE_PKT_HANDLED == rv) { g_psample_stats.pkts_f_handled++; + dev_kfree_skb_any(skb); return NULL; } g_psample_stats.pkts_f_pass_through++; @@ -462,8 +463,12 @@ psample_netif_create_cb(struct net_device *dev) psample_netif->dev = dev; psample_netif->id = netif->id; - /* FIXME: port is not saved in ngknet_private, need to get from metadata?? */ - //psample_netif->port = netif->port; + /*Application has encoded the port in netif user data 0 & 1 */ + if (netif->type == NGKNET_NETIF_T_PORT) + { + psample_netif->port = netif->user_data[0]; + psample_netif->port |= netif->user_data[1] << 8; + } psample_netif->vlan = netif->vlan; psample_netif->sample_rate = PSAMPLE_RATE_DFLT; psample_netif->sample_size = PSAMPLE_SIZE_DFLT; @@ -623,13 +628,12 @@ psample_proc_rate_write(struct file *file, const char *buf, return count; } -struct file_operations psample_proc_rate_file_ops = { - owner: THIS_MODULE, - open: psample_proc_rate_open, - read: seq_read, - llseek: seq_lseek, - write: psample_proc_rate_write, - release: single_release, +struct proc_ops psample_proc_rate_file_ops = { + proc_open: psample_proc_rate_open, + proc_read: seq_read, + proc_lseek: seq_lseek, + proc_write: psample_proc_rate_write, + proc_release: single_release, }; /* @@ -722,13 +726,12 @@ psample_proc_size_write(struct file *file, const char *buf, return count; } -struct file_operations psample_proc_size_file_ops = { - owner: THIS_MODULE, - open: psample_proc_size_open, - read: seq_read, - llseek: seq_lseek, - write: psample_proc_size_write, - release: single_release, +struct proc_ops psample_proc_size_file_ops = { + proc_open: psample_proc_size_open, + proc_read: seq_read, + proc_lseek: seq_lseek, + proc_write: psample_proc_size_write, + proc_release: single_release, }; /* @@ -763,13 +766,12 @@ psample_proc_map_open(struct inode * inode, struct file * file) return single_open(file, psample_proc_map_show, NULL); } -struct file_operations psample_proc_map_file_ops = { - owner: THIS_MODULE, - open: psample_proc_map_open, - read: seq_read, - llseek: seq_lseek, - write: NULL, - release: single_release, +struct proc_ops psample_proc_map_file_ops = { + proc_open: psample_proc_map_open, + proc_read: seq_read, + proc_lseek: seq_lseek, + proc_write: NULL, + proc_release: single_release, }; /* @@ -829,13 +831,12 @@ psample_proc_debug_write(struct file *file, const char *buf, return count; } -struct file_operations psample_proc_debug_file_ops = { - owner: THIS_MODULE, - open: psample_proc_debug_open, - read: seq_read, - llseek: seq_lseek, - write: psample_proc_debug_write, - release: single_release, +struct proc_ops psample_proc_debug_file_ops = { + proc_open: psample_proc_debug_open, + proc_read: seq_read, + proc_lseek: seq_lseek, + proc_write: psample_proc_debug_write, + proc_release: single_release, }; static int @@ -891,13 +892,12 @@ psample_proc_stats_write(struct file *file, const char *buf, return count; } -struct file_operations psample_proc_stats_file_ops = { - owner: THIS_MODULE, - open: psample_proc_stats_open, - read: seq_read, - llseek: seq_lseek, - write: psample_proc_stats_write, - release: single_release, +struct proc_ops psample_proc_stats_file_ops = { + proc_open: psample_proc_stats_open, + proc_read: seq_read, + proc_lseek: seq_lseek, + proc_write: psample_proc_stats_write, + proc_release: single_release, }; int psample_cleanup(void) diff --git a/platform/broadcom/saibcm-modules/sdklt/make/lkm.mk b/platform/broadcom/saibcm-modules/sdklt/make/lkm.mk index c3d2a4d40b50..803154e54c68 100644 --- a/platform/broadcom/saibcm-modules/sdklt/make/lkm.mk +++ b/platform/broadcom/saibcm-modules/sdklt/make/lkm.mk @@ -1,5 +1,5 @@ # -# $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. +# $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. # # This program is free software; you can redistribute it and/or @@ -35,42 +35,39 @@ ifneq ($(LKM_BLDDIR),) # Note that the KBUILD_OUTPUT variable cannot be used to redirect the # output as we want it. # -MDIR = $(LKM_BLDDIR) -MSRCS = $(patsubst %.o,%.c,$($(MOD_NAME)-y)) +MDIR := $(LKM_BLDDIR) +MSRCS := $(patsubst %.o,%.c,$($(MOD_NAME)-y)) MSRCS += Makefile Kbuild -BSRCS = $(addprefix $(PWD)/,$(MSRCS)) +BSRCS := $(addprefix $(PWD)/,$(MSRCS)) else # # Build in current directory by default. # -MDIR = $(PWD) +MDIR := $(PWD) endif -all: +all: mlinks $(Q)echo Building kernel module $(MOD_NAME) -ifneq ($(LKM_BLDDIR),) -ifneq ($(LKM_BLDDIR),$(PWD)) - $(Q)mkdir -p $(MDIR) - (cd $(MDIR); \ - rm -rf *.c Makefile Kbuild; \ - for f in $(BSRCS); do \ - ln -s $$f; \ - done) -endif -endif $(MAKE) -C $(KDIR) M=$(MDIR) -clean:: +clean:: mlinks $(Q)echo Cleaning kernel module $(MOD_NAME) $(MAKE) -C $(KDIR) M=$(MDIR) clean -ifneq ($(LKM_BLDDIR),) -ifneq ($(LKM_BLDDIR),$(PWD)) -# Remove all files except for Makefile (needed by 'make clean') - rm -f $(LKM_BLDDIR)/*[cdors] +ifneq ($(MDIR),$(PWD)) + rm -rf $(MDIR) endif + +mlinks: +ifneq ($(MDIR),$(PWD)) + $(Q)mkdir -p $(MDIR) + (cd $(MDIR); \ + rm -rf $(MSRCS); \ + for f in $(BSRCS); do \ + ln -s $$f; \ + done) endif -.PHONY: all clean +.PHONY: all mlinks clean # Standard documentation targets -include $(SDK)/make/doc.mk diff --git a/platform/broadcom/saibcm-modules/sdklt/shr/include/shr/shr_error.h b/platform/broadcom/saibcm-modules/sdklt/shr/include/shr/shr_error.h index 1924d600de53..a51dc11392b2 100644 --- a/platform/broadcom/saibcm-modules/sdklt/shr/include/shr/shr_error.h +++ b/platform/broadcom/saibcm-modules/sdklt/shr/include/shr/shr_error.h @@ -4,7 +4,7 @@ * */ /* - * $Copyright: Copyright 2018-2020 Broadcom. All rights reserved. + * $Copyright: Copyright 2018-2021 Broadcom. All rights reserved. * The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. * * This program is free software; you can redistribute it and/or diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/include/linux_dma.h b/platform/broadcom/saibcm-modules/systems/bde/linux/include/linux_dma.h index 23eb3fa33e9e..c2730c140b6e 100644 --- a/platform/broadcom/saibcm-modules/systems/bde/linux/include/linux_dma.h +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/include/linux_dma.h @@ -45,13 +45,6 @@ #define KMALLOC(size, flags) kmalloc(size, flags) #endif -#if defined(CONFIG_IDT_79EB334) || defined(CONFIG_BCM4702) -/* ioremap is broken in kernel */ -#define IOREMAP(addr, size) ((void *)KSEG1ADDR(addr)) -#else -#define IOREMAP(addr, size) ioremap_nocache(addr, size) -#endif - #if defined (__mips__) #if defined(CONFIG_NONCOHERENT_IO) || defined(CONFIG_DMA_NONCOHERENT) /* Use flush/invalidate for cached memory */ @@ -69,7 +62,8 @@ #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) #endif -extern void _dma_init(int dev_index); +extern void _dma_init(void); +extern void _dma_per_device_init(int dev_index); extern int _dma_cleanup(void); extern void _dma_pprint(struct seq_file *m); extern uint32_t *_salloc(int d, int size, const char *name); diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/Makefile b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/Makefile index 2aa3bec11d73..bc7b6fef5f15 100644 --- a/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/Makefile +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/Makefile @@ -66,16 +66,16 @@ THIS_MOD_NAME := linux-kernel-bde MODULE = $(LIBDIR)/$(THIS_MOD_NAME).o KMODULE = $(LIBDIR)/$(THIS_MOD_NAME).ko -build: kernel_libs module $(KMODULE) +build: $(KMODULE) else MODULE = $(LIBDIR)/linux-kernel-bde.o -build: kernel_libs module +build: module endif -module: kernel_libs $(MODULE) +module: $(MODULE) -$(MODULE): $(BLDDIR)/.tree $(BOBJS) +$(MODULE): $(BLDDIR)/.tree $(BOBJS) kernel_libs mkdir -p $(@D) $(LD) $(MODULE_LDFLAGS) -r -d $(BOBJS) $(LIBS) -o $@ ifneq ($(kernel_version),2_4) diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux-kernel-bde.c b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux-kernel-bde.c index 9029b3b51477..be5b6282396d 100644 --- a/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux-kernel-bde.c +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux-kernel-bde.c @@ -33,16 +33,15 @@ #define MEMCPY memcpy #ifdef CONFIG_X86_64 -#if (defined(__GNUC__) && (__GNUC__ == 8)) +#if (defined(__GNUC__) && (__GNUC__ >= 8)) /* - * Prevent gcc 8.1.10 using a compiler inline memcpy even if using -fno-builtin or - * -fno-builtin-memcpy . - * __inline_memcpy and __memcpy are kernel functions that may be used instead, - * for either an inline or non-inline implementations of the function + * Prevent gcc from using a compiler builtin memcpy even if using -fno-builtin or + * -fno-builtin-memcpy. + * Use __memcpy kernel function in x86 Linux instead. */ #undef MEMCPY #define MEMCPY __memcpy -#endif /* (defined(__GNUC__) && (__GNUC__ == 8)) */ +#endif /* (defined(__GNUC__) && (__GNUC__ >= 8)) */ #endif /* CONFIG_X86_64 */ @@ -167,14 +166,6 @@ MODULE_PARM_DESC(spifreq, #endif -/* Compatibility */ -#ifdef LKM_2_4 -#define _ISR_RET void -#define _ISR_PARAMS(_i,_d,_r) int _i, void *_d, struct pt_regs *_r -#define IRQ_NONE -#define IRQ_HANDLED -#define SYNC_IRQ(_i) synchronize_irq() -#else /* LKM_2_6 */ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)) #define _ISR_RET irqreturn_t #else @@ -208,7 +199,6 @@ char * strtok(char * s,const char * ct) } LKM_EXPORT_SYM(___strtok); LKM_EXPORT_SYM(strtok); -#endif /* LKM_2_x */ /* PCIe capabilities */ #ifndef PCI_CAP_ID_EXP @@ -344,7 +334,7 @@ typedef struct bde_ctrl_s { static bde_ctrl_t _devices[LINUX_BDE_MAX_DEVICES]; -/* information stored per SDK instance, curently the devices it manages */ +/* information stored per SDK instance, currently the devices it manages */ typedef struct { linux_bde_device_bitmap_t devices; /* The devices controlled by this instance */ } lkbde_inst_info_t; @@ -469,6 +459,7 @@ static uint32_t _read(int d, uint32_t addr); #ifdef BCM_ICS #else +#ifdef CONFIG_PCI /* Used to determine overall memory limits across all devices */ static uint32_t _pci_mem_start = 0xFFFFFFFF; static uint32_t _pci_mem_end = 0; @@ -476,6 +467,7 @@ static uint32_t _pci_mem_end = 0; /* Used to control MSI interrupts */ static int use_msi = 0; #endif +#endif #ifdef BCM_PLX9656_LOCAL_BUS @@ -517,6 +509,9 @@ static void _bde_add_device(void) { int add_switch_device = 0; + if (_ndevices >= LINUX_BDE_MAX_DEVICES) { + gprintk("Error: added too many devices\n"); + } if (_devices[_ndevices].dev_type & BDE_SWITCH_DEV_TYPE) { _switch_ndevices++; add_switch_device = 1; @@ -552,7 +547,7 @@ _bde_add_device(void) _devices[i] = tmp_dev; } - _dma_init(_switch_ndevices-1); + _dma_per_device_init(_switch_ndevices-1); } /* Initialize device locks */ @@ -581,7 +576,7 @@ _eb_device_create(resource_size_t paddr, int irq, int rd_hw, int wr_hw) } /* Map in the device */ - ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(paddr, 0x10000); + ctrl->bde_dev.base_address = (sal_vaddr_t)ioremap(paddr, 0x10000); ctrl->iowin[0].addr = paddr; ctrl->iowin[0].size = 0x10000; @@ -618,7 +613,7 @@ sand_device_create(void) ctrl->pci_device = NULL; /* No PCI bus */ /* Map in the device */ /* FIX_ME: not realy map anything */ - ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(0x40000000, 0x100000); + ctrl->bde_dev.base_address = (sal_vaddr_t)ioremap(0x40000000, 0x100000); ctrl->iowin[0].addr = 0x40000000; ctrl->iowin[0].size = 0x100000; @@ -632,17 +627,17 @@ sand_device_create(void) /* Map CPU regs */ #ifdef __DUNE_WRX_BCM_CPU__ - cpu_address = IOREMAP(0x18000000, 0x4000000); + cpu_address = ioremap(0x18000000, 0x4000000); #elif defined(__DUNE_GTO_BCM_CPU__) - cpu_address = IOREMAP(0xe0000000, 0x100000); + cpu_address = ioremap(0xe0000000, 0x100000); #endif - if ((ctrl->bde_dev.device == PCP_PCI_DEVICE_ID)) { + if (ctrl->bde_dev.device == PCP_PCI_DEVICE_ID) { ctrl->bde_dev.device = GEDI_DEVICE_ID; ctrl->bde_dev.rev = GEDI_REV_ID; } - if ((ctrl->bde_dev.device == ACP_PCI_DEVICE_ID)) { + if (ctrl->bde_dev.device == ACP_PCI_DEVICE_ID) { ctrl->dev_type |= BDE_PCI_DEV_TYPE | BDE_SWITCH_DEV_TYPE; } @@ -720,7 +715,7 @@ iproc_cmicd_probe(struct platform_device *pldev) ctrl->pci_device = NULL; /* No PCI bus */ /* Map CMIC block in the AXI memory space into CPU address space */ - ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(memres->start, size); + ctrl->bde_dev.base_address = (sal_vaddr_t)ioremap(memres->start, size); if (!ctrl->bde_dev.base_address) { gprintk("Error mapping iProc CMIC registers"); return -1; @@ -731,7 +726,7 @@ iproc_cmicd_probe(struct platform_device *pldev) #ifdef CONFIG_OF if (of_find_compatible_node(NULL, NULL, IPROC_CMICX_COMPATIBLE)) { uint32 *icfg_chip_id; - icfg_chip_id = (uint32 *)IOREMAP(ICFG_CHIP_ID_REG, 2 * sizeof(uint32)); + icfg_chip_id = (uint32 *)ioremap(ICFG_CHIP_ID_REG, 2 * sizeof(uint32)); if (icfg_chip_id == NULL) { gprintk("Error mapping ICFG_CHIP_ID_REG\n"); return -1; @@ -742,12 +737,12 @@ iproc_cmicd_probe(struct platform_device *pldev) /* Map GICD block in the AXI memory space into CPU address space */ memres = iproc_platform_get_resource(pldev, IORESOURCE_MEM, 1); if (memres) { - ctrl->bde_dev.base_address1 = (sal_vaddr_t)IOREMAP(memres->start, memres->end - memres->start + 1); + ctrl->bde_dev.base_address1 = (sal_vaddr_t)ioremap(memres->start, memres->end - memres->start + 1); ctrl->iowin[1].addr = memres->start; ctrl->iowin[1].size = memres->end - memres->start + 1; } else { /* Use default address if not available in DTB */ - ctrl->bde_dev.base_address1 = (sal_vaddr_t)IOREMAP(IHOST_GICD_REG_ADDR, IHOST_GICD_REG_REMAP_LEN); + ctrl->bde_dev.base_address1 = (sal_vaddr_t)ioremap(IHOST_GICD_REG_ADDR, IHOST_GICD_REG_REMAP_LEN); ctrl->iowin[1].addr = IHOST_GICD_REG_ADDR; ctrl->iowin[1].size = IHOST_GICD_REG_REMAP_LEN; } @@ -759,6 +754,9 @@ iproc_cmicd_probe(struct platform_device *pldev) } else { gprintk("Error mapping ihost GICD registers\n"); } + if (dma_set_mask_and_coherent(&pldev->dev, DMA_BIT_MASK(64))) { + gprintk("Unable to set 64-bit dma mask\n"); + } } else #endif { @@ -905,24 +903,15 @@ static int iproc_has_cmicd(void) { void *iproc_cca_base; - uint32 cca_cid; /* Read ChipcommonA chip id register to identify current SOC */ - iproc_cca_base = IOREMAP(IPROC_CHIPCOMMONA_BASE, 0x3000); + iproc_cca_base = ioremap(IPROC_CHIPCOMMONA_BASE, 0x3000); if (iproc_cca_base == NULL) { - gprintk("iproc_has_cmicd: ioremap of ChipcommonA registers failed"); + gprintk("iproc_has_cmicd: ioremap of ChipcommonA registers failed"); return 0; } - cca_cid = readl((uint32 *)iproc_cca_base); - cca_cid &= 0xffff; iounmap(iproc_cca_base); - /* Only allowed accessing CMICD module if the SOC has it */ - switch (cca_cid) { - default: - break; - } - /* Device has CMIC */ return 1; } @@ -971,12 +960,12 @@ iproc_cmicd_get_memregion(struct resource *res_mem) uint8_t size_type = 0; bool is_compident_a = 1; /* 1: CompidentA; o/w: CompidentB */ - erom_ptr_oft = IOREMAP(IPROC_CHIPCOMMONA_EROM_PTR_OFFSET, 0x100); + erom_ptr_oft = ioremap(IPROC_CHIPCOMMONA_EROM_PTR_OFFSET, 0x100); erom_phy_addr = readl((uint32 *)(erom_ptr_oft)); iounmap(erom_ptr_oft); - erom_base = IOREMAP(erom_phy_addr, EROM_MAX_SIZE); + erom_base = ioremap(erom_phy_addr, EROM_MAX_SIZE); while (1) { word = readl((uint32 *)(erom_base + i)); @@ -1073,7 +1062,7 @@ _ics_bde_create(void) /* Map in the device */ paddr = BCM_ICS_CMIC_BASE; - ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(paddr, 0x10000); + ctrl->bde_dev.base_address = (sal_vaddr_t)ioremap(paddr, 0x10000); ctrl->iowin[0].addr = paddr; ctrl->iowin[0].size = 0x10000; @@ -1095,6 +1084,7 @@ _ics_bde_create(void) #else /* !BCM_ICS */ +#ifdef CONFIG_PCI extern struct pci_bus *pci_find_bus(int domain, int busnr); /* @@ -1251,7 +1241,6 @@ static const struct pci_device_id _id_table[] = { { BROADCOM_VENDOR_ID, BCM56321_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM56132_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM56134_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, - { BROADCOM_VENDOR_ID, BCM88732_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM56140_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM56142_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM56143_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, @@ -1462,7 +1451,6 @@ static const struct pci_device_id _id_table[] = { { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9056, PCI_ANY_ID, PCI_ANY_ID }, { BCM53000_VENDOR_ID, BCM53000PCIE_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, #ifdef BCM_PETRA_SUPPORT - { BROADCOM_VENDOR_ID, BCM88650_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM88350_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM88351_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM88450_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, @@ -1470,8 +1458,6 @@ static const struct pci_device_id _id_table[] = { { BROADCOM_VENDOR_ID, BCM88550_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM88551_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM88552_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, - { BROADCOM_VENDOR_ID, BCM88651_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, - { BROADCOM_VENDOR_ID, BCM88654_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { PCP_PCI_VENDOR_ID, PCP_PCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { ACP_PCI_VENDOR_ID, ACP_PCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM88660_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, @@ -1500,6 +1486,7 @@ static const struct pci_device_id _id_table[] = { { BROADCOM_VENDOR_ID, BCM88474H_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM88476_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM88477_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88479_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM88270_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, @@ -1511,8 +1498,6 @@ static const struct pci_device_id _id_table[] = { { BROADCOM_VENDOR_ID, BCM88278_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM88279_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, - { BROADCOM_VENDOR_ID, BCM8206_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, - { BROADCOM_VENDOR_ID, BCM88376_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM88376M_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM88377_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, @@ -1620,6 +1605,22 @@ static const struct pci_device_id _id_table[] = { { BROADCOM_VENDOR_ID, BCM8828D_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM8828E_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM8828F_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88290_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88291_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88292_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88293_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88294_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88295_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88296_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88297_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88298_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88299_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8829A_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8829B_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8829C_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8829D_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8829E_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8829F_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM88850_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM88851_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM88852_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, @@ -1636,6 +1637,37 @@ static const struct pci_device_id _id_table[] = { { BROADCOM_VENDOR_ID, BCM8885D_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM8885E_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM8885F_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88840_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88841_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88842_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88843_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88844_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88845_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88846_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88847_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88848_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88849_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8884A_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8884B_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8884C_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8884D_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8884E_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8884F_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88831_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88832_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88833_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88834_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88835_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88836_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88837_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88838_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM88839_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8883A_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8883B_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8883C_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8883D_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8883E_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM8883F_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, #endif /* BCM_DNX_SUPPORT */ #ifdef BCM_DFE_SUPPORT { BROADCOM_VENDOR_ID, BCM88770_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, @@ -1719,6 +1751,7 @@ static const struct pci_device_id _id_table[] = { { BROADCOM_VENDOR_ID, BCM56471_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM56472_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { BROADCOM_VENDOR_ID, BCM56475_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, + { BROADCOM_VENDOR_ID, BCM56474_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID }, { 0, 0, 0, 0 } };; @@ -2045,7 +2078,7 @@ _plx_las_bar_get(struct pci_dev *dev) void *local_config_addr; int bar = -1; - local_config_addr = IOREMAP(pci_resource_start(dev, PLX_MMAP_PCIBAR0), + local_config_addr = ioremap(pci_resource_start(dev, PLX_MMAP_PCIBAR0), pci_resource_len(dev, PLX_MMAP_PCIBAR0)); if (local_config_addr) { uint32 las_remap_reg; @@ -2551,7 +2584,7 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) * system performance. This change significantly reduces the * number of PCI retries from other devices on the PCI bus. */ - void * _mc_vbase = IOREMAP(BCM4704_MEMC_BASE, 0x1000); + void * _mc_vbase = ioremap(BCM4704_MEMC_BASE, 0x1000); int priorinv = 0x80; static int done = 0; if (!done) { @@ -2699,7 +2732,7 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) break; } - ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(paddr, bar_len); + ctrl->bde_dev.base_address = (sal_vaddr_t)ioremap(paddr, bar_len); ctrl->iowin[0].addr = paddr; ctrl->iowin[0].size = bar_len; @@ -2722,9 +2755,9 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) ) { paddr = pci_resource_start(dev, 0); bar_len = pci_resource_len(dev, 0); - ctrl->bde_dev.base_address1 = (sal_vaddr_t)IOREMAP(paddr, bar_len); + ctrl->bde_dev.base_address1 = (sal_vaddr_t)ioremap(paddr, bar_len); ctrl->iowin[1].addr = paddr; - ctrl->iowin[1].size = bar_len; + ctrl->iowin[1].size = PAGE_ALIGN(bar_len); if (debug >= 3) { gprintk("BAR 0: kernel addr:0x%lx phys addr:0x%lx length:%lx\n", (unsigned long)ctrl->bde_dev.base_address1, (unsigned long)paddr, (unsigned long)bar_len); @@ -2804,6 +2837,10 @@ _pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) (unsigned long)ctrl->bde_dev.base_address, (unsigned long)ctrl->bde_dev.base_address1); } + if (rescan) { /* map IOMMU for re-probed devices */ + _dma_per_device_init(rescan_idx); + } + if (add_dev) { _bde_add_device(); } @@ -2856,6 +2893,7 @@ _pci_remove(struct pci_dev* dev) /* Free our interrupt handler, if we have one */ if (ctrl->isr || ctrl->isr2) { +#ifdef CONFIG_PCI_MSI #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84)) if (ctrl->use_msi >= PCI_USE_INT_MSIX) { int i; @@ -2863,6 +2901,7 @@ _pci_remove(struct pci_dev* dev) free_irq(ctrl->entries[i].vector, ctrl); } else +#endif #endif { free_irq(ctrl->iLine, ctrl); @@ -2884,6 +2923,7 @@ static struct pci_driver _device_driver = { .id_table = _id_table, /* The rest are dynamic */ }; +#endif /* CONFIG_PCI */ static void _spi_device_setup(void) { @@ -2925,7 +2965,7 @@ map_local_bus(uint64_t addr, uint32_t size) ctrl->pci_device = NULL; /* No PCI bus */ /* Map in the device */ - ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(addr, size); + ctrl->bde_dev.base_address = (sal_vaddr_t)ioremap(addr, size); ctrl->iowin[0].addr = addr; ctrl->iowin[0].size = size; @@ -2939,10 +2979,8 @@ map_local_bus(uint64_t addr, uint32_t size) #ifdef BCM_PLX9656_LOCAL_BUS -#if 1 #define DEV_REG_BASE_OFFSET PL0_OFFSET /* Polaris register base */ #define DEV_REG_DEVID 0 /* Device ID is first register */ -#endif /* * The difference at map_local_bus2: @@ -2974,9 +3012,7 @@ map_local_bus2(bde_ctrl_t *plx_ctrl, uint32_t dev_base, uint32_t size) ctrl->iowin[0].addr = plx_ctrl->iowin[0].addr + (resource_size_t)dev_base; ctrl->iowin[0].size = size; -#if 1 addr = (uint8_t *)ctrl->bde_dev.base_address + PL0_REVISION_REG; -#endif dev_rev_id = readl(addr); ctrl->bde_dev.device = dev_rev_id >> 16; ctrl->bde_dev.rev = (dev_rev_id & 0xFF); @@ -3019,9 +3055,7 @@ probe_plx_local_bus(void) addr = (uint8_t *)plx_ctrl.bde_dev.base_address + CPLD_OFFSET + CPLD_RESET_REG; writel(CPLD_RESET_NONE, addr); #endif -#if 1 ctrl = map_local_bus2(&plx_ctrl, PL0_OFFSET, PL0_SIZE); -#endif if (ctrl == 0) return -1; @@ -3038,6 +3072,7 @@ probe_plx_local_bus(void) + /* * Generic module functions */ @@ -3057,12 +3092,17 @@ static int _init(void) { unsigned i; + + /* allocate and init the DMA buffer pool */ + _dma_init(); #ifdef IPROC_CMICD +#ifdef CONFIG_PCI /* * Adjust the PCI driver name to prevent our device file from * getting removed when the module is unloaded. */ _device_driver.name = LINUX_KERNEL_BDE_NAME ".iproc"; +#endif #ifdef CONFIG_OF if (of_find_compatible_node(NULL, NULL, IPROC_CMICX_COMPATIBLE)) { iproc_platform_driver_register(&iproc_cmicd_driver); @@ -3070,6 +3110,7 @@ _init(void) #endif if (iproc_has_cmicd()) { iproc_cmicd_get_memregion(&iproc_cmicd_resources[IPROC_CMICD_RES_MEM]); + /* PCIe device will be added here */ iproc_platform_driver_register(&iproc_cmicd_driver); #ifdef CONFIG_OF if (!of_find_compatible_node(NULL, NULL, IPROC_CMICD_COMPATIBLE)) @@ -3085,6 +3126,7 @@ _init(void) _ics_bde_create(); #else /* PCI */ +#ifdef CONFIG_PCI /* Configure MSI interrupt support */ use_msi = usemsi; @@ -3113,16 +3155,23 @@ _init(void) if (unlikely(debug >= 1)) gprintk("%s(%d):use_msi = %d\n", __func__, __LINE__, use_msi); +#endif /* CONFIG_PCI */ + if (spi_devid) { _spi_device_setup(); } else { +#ifdef CONFIG_PCI + /* PCIe devices will be probed here */ if (pci_register_driver(&_device_driver) < 0) { return -ENODEV; } +#endif } +#ifdef CONFIG_PCI /* Note: PCI-PCI bridge uses results from pci_register_driver */ p2p_bridge(); +#endif #ifdef BCM_METROCORE_LOCAL_BUS if (probe_metrocore_local_bus()) { @@ -3159,6 +3208,7 @@ _init(void) } } + for (i = 0; i < LINUX_BDE_MAX_DEVICES; ++i) { _devices[i].inst_id = BDE_DEV_INST_ID_INVALID; } @@ -3219,7 +3269,9 @@ _cleanup(void) #ifdef BCM_ICS #else +#ifdef CONFIG_PCI pci_unregister_driver(&_device_driver); +#endif #endif /* BCM_ICS */ return 0; } @@ -3265,6 +3317,7 @@ _pprint(struct seq_file *m) pprintf(m, "\t%d (?) : ", i); } + if (ctrl->dev_state == BDE_DEV_STATE_REMOVED) { pprintf(m, "PCI device 0x%x:0x%x:%d REMOVED\n", ctrl->pci_device->vendor, @@ -3308,16 +3361,15 @@ _pprint(struct seq_file *m) ctrl->bde_dev.rev); } if (debug >= 1) { - pprintf(m, "\t\timask:imask2:fmask 0x%x:0x%x:0x%x\n", + pprintf(m, "\t\timask:imask2:fmask 0x%x:0x%x:0x%x unique_id=0x%x inst_id ", ctrl->imask, ctrl->imask2, - ctrl->fmask); - } - if (debug >= 1) { + ctrl->fmask, + ctrl->bde_dev.dev_unique_id); if (ctrl->inst_id == BDE_DEV_INST_ID_INVALID) { - pprintf(m, "\t\tinst_id INVALID\n"); + pprintf(m, "INVALID\n"); } else { - pprintf(m, "\t\tinst_id %u%s\n", + pprintf(m, "%u%s\n", ctrl->inst_id, ctrl->inst_id < LINUX_BDE_MAX_DEVICES ? "":"(Illegal)"); } @@ -3378,12 +3430,12 @@ _bde_mmap(struct file *filp, struct vm_area_struct *vma) static char _modname[] = LINUX_KERNEL_BDE_NAME; static gmodule_t _gmodule = { - name: LINUX_KERNEL_BDE_NAME, - major: LINUX_KERNEL_BDE_MAJOR, - init: _init, - cleanup: _cleanup, - pprint: _pprint, - mmap: _bde_mmap, + .name = LINUX_KERNEL_BDE_NAME, + .major = LINUX_KERNEL_BDE_MAJOR, + .init = _init, + .cleanup = _cleanup, + .pprint = _pprint, + .mmap = _bde_mmap, }; gmodule_t * @@ -3674,7 +3726,6 @@ _interrupt_connect(int d, if(ret != 0) goto msi_exit; } -#endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84)) if (ctrl->use_msi == PCI_USE_INT_MSIX) { int i; @@ -3696,6 +3747,7 @@ _interrupt_connect(int d, } } else +#endif #endif { #if defined(IPROC_CMICD) && defined(CONFIG_OF) @@ -3812,6 +3864,7 @@ _interrupt_disconnect(int d) } if (isr_active) { +#ifdef CONFIG_PCI_MSI #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,84)) if (ctrl->use_msi >= PCI_USE_INT_MSIX) { int i; @@ -3825,6 +3878,7 @@ _interrupt_disconnect(int d) } else #endif +#endif #if defined(IPROC_CMICD) && defined(CONFIG_OF) if (of_find_compatible_node(NULL, NULL, IPROC_CMICX_COMPATIBLE)) { int i; @@ -3858,7 +3912,7 @@ _iproc_ihost_read(int d, uint32_t addr) { uint32_t *mapaddr; uint32_t reg_val; - mapaddr = IOREMAP(addr, sizeof(uint32_t)); + mapaddr = ioremap(addr, sizeof(uint32_t)); if (mapaddr == NULL) { return -1; } @@ -3871,7 +3925,7 @@ static int _iproc_ihost_write(int d, uint32_t addr, uint32_t data) { uint32_t *mapaddr; - mapaddr = IOREMAP(addr, sizeof(uint32_t)); + mapaddr = ioremap(addr, sizeof(uint32_t)); if (mapaddr == NULL) { return -1; } @@ -4060,7 +4114,6 @@ lkbde_cpu_pci_register(int d) case BCM88772_DEVICE_ID: case BCM88952_DEVICE_ID: case ACP_PCI_DEVICE_ID: - case BCM88650_DEVICE_ID: case BCM88670_DEVICE_ID: case BCM88671_DEVICE_ID: @@ -4102,6 +4155,7 @@ lkbde_cpu_pci_register(int d) case BCM88474H_DEVICE_ID: case BCM88476_DEVICE_ID: case BCM88477_DEVICE_ID: + case BCM88479_DEVICE_ID: case BCM88270_DEVICE_ID: case BCM88271_DEVICE_ID: case BCM88272_DEVICE_ID: @@ -4109,7 +4163,6 @@ lkbde_cpu_pci_register(int d) case BCM88274_DEVICE_ID: case BCM88276_DEVICE_ID: case BCM88278_DEVICE_ID: - case BCM8206_DEVICE_ID: case BCM88350_DEVICE_ID: case BCM88351_DEVICE_ID: case BCM88450_DEVICE_ID: @@ -4117,8 +4170,6 @@ lkbde_cpu_pci_register(int d) case BCM88550_DEVICE_ID: case BCM88551_DEVICE_ID: case BCM88552_DEVICE_ID: - case BCM88651_DEVICE_ID: - case BCM88654_DEVICE_ID: case BCM88660_DEVICE_ID: case BCM88360_DEVICE_ID: case BCM88361_DEVICE_ID: @@ -4154,6 +4205,7 @@ lkbde_cpu_pci_register(int d) case J2C_2ND_DEVICE_ID: case Q2A_DEVICE_ID: case Q2U_DEVICE_ID: + case Q2N_DEVICE_ID: case J2P_DEVICE_ID: #endif #ifdef BCM_DNXF_SUPPORT @@ -4173,7 +4225,7 @@ lkbde_cpu_pci_register(int d) if (ctrl->bde_dev.base_address) { iounmap((void *)ctrl->bde_dev.base_address); } - ctrl->bde_dev.base_address = (sal_vaddr_t)IOREMAP(ctrl->iowin[0].addr, 0x1000000); + ctrl->bde_dev.base_address = (sal_vaddr_t)ioremap(ctrl->iowin[0].addr, 0x1000000); if (debug >= 1) { gprintk("%s, %s(): info:\n", __FILE__, __FUNCTION__); @@ -4225,29 +4277,29 @@ LKM_EXPORT_SYM(lkbde_mem_read); #endif /* BCM_SAND_SUPPORT */ static ibde_t _ibde = { - name: _name, - num_devices: _num_devices, - get_dev: _get_dev, - get_dev_type: _get_dev_type, - pci_conf_read: _pci_conf_read, - pci_conf_write: _pci_conf_write, - pci_bus_features: _pci_bus_features, - read: _read, - write: _write, - salloc: _salloc, - sfree: _sfree, - sinval: _sinval, - sflush: _sflush, - interrupt_connect: _interrupt_connect, - interrupt_disconnect: _interrupt_disconnect, - l2p: _l2p, - p2l: _p2l, + .name = _name, + .num_devices = _num_devices, + .get_dev = _get_dev, + .get_dev_type = _get_dev_type, + .pci_conf_read = _pci_conf_read, + .pci_conf_write = _pci_conf_write, + .pci_bus_features = _pci_bus_features, + .read = _read, + .write = _write, + .salloc = _salloc, + .sfree = _sfree, + .sinval = _sinval, + .sflush = _sflush, + .interrupt_connect = _interrupt_connect, + .interrupt_disconnect = _interrupt_disconnect, + .l2p = _l2p, + .p2l = _p2l, NULL, NULL, - iproc_read: _iproc_read, - iproc_write: _iproc_write, - get_cmic_ver: _get_cmic_ver, + .iproc_read = _iproc_read, + .iproc_write = _iproc_write, + .get_cmic_ver = _get_cmic_ver, }; /* diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux_dma.c b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux_dma.c index 52711964a533..be46282e7f8d 100644 --- a/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux_dma.c +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/kernel/linux_dma.c @@ -89,6 +89,7 @@ /* allocation types/methods for the DMA memory pool */ #define ALLOC_TYPE_CHUNK 0 /* use small allocations and join them */ #define ALLOC_TYPE_API 1 /* use one allocation */ +#define ALLOC_TYPE_HIMEM 2 /* use high memory */ #if _SIMPLE_MEMORY_ALLOCATION_ #include @@ -167,6 +168,47 @@ static int mem_flags = GFP_ATOMIC | GFP_DMA; #endif #endif +#ifdef IPROC_CMICD +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0) +#ifndef COHERENT_ALLOC_USE_DMA_TO_PHYS +#define COHERENT_ALLOC_USE_DMA_TO_PHYS 1 +#endif +#else +#ifndef COHERENT_ALLOC_PHYS_IS_DMA_ADDR +#define COHERENT_ALLOC_PHYS_IS_DMA_ADDR 1 +#endif +#endif +#endif /* IPROC_CMICD */ + +/* + * Macros that can be used by the build to control the technique of + * setting the physical address for dma_alloc_coherent() + */ +#ifndef COHERENT_ALLOC_USE_DMA_TO_PHYS +#define COHERENT_ALLOC_USE_DMA_TO_PHYS 0 +#endif +#ifndef COHERENT_ALLOC_PHYS_IS_DMA_ADDR +#define COHERENT_ALLOC_PHYS_IS_DMA_ADDR 0 +#endif + +#if COHERENT_ALLOC_USE_DMA_TO_PHYS +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,16,0)) +#include +#else +#include +#endif +#endif + +/* Macro to get the host physical address when using dma_alloc_coherent() */ +#if COHERENT_ALLOC_USE_DMA_TO_PHYS +#define HOST_PHYS_ADDR(_dev, _dma_a, _kvirt_a) \ + ((_dev) ? dma_to_phys((_dev), (_dma_a)) : virt_to_phys(_kvirt_a)) +#elif COHERENT_ALLOC_PHYS_IS_DMA_ADDR +#define HOST_PHYS_ADDR(_dev, _dma_a, _kvirt_a) (_dma_a) +#else +#define HOST_PHYS_ADDR(_dev, _dma_a, _kvirt_a) (virt_to_phys(_kvirt_a)) +#endif + /* Debug output */ static int dma_debug = 0; module_param(dma_debug, int, 0); @@ -238,19 +280,42 @@ typedef struct _dma_segment { static unsigned int _dma_mem_size = DMA_MEM_DEFAULT; static mpool_handle_t _dma_pool = NULL; +/* kernel virtual address of the DMA buffer pool */ static void __iomem *_dma_vbase = NULL; -/* cpu physical address for mmap */ +/* CPU physical address of the DMA buffer pool, used for mmap */ static phys_addr_t _cpu_pbase = 0; /* - * DMA bus address, it is either identical to cpu physical address - * or another address(IOVA) translated by IOMMU. + * DMA buffer poool PCIe bus address, it is either identical to the CPU + * physical address or another address(IOVA) translated by IOMMU. */ static phys_addr_t _dma_pbase = 0; + +/* states of the DMA pool: */ + +/* not initialized */ +#define DNA_POOL_INVALID 0 +/* initialized and not yet mapped */ +#define DMA_POOL_INITIALIZED 1 +/* initialized and mapped */ +#define DMA_POOL_MAPPED 2 +/* initialization failed */ +#define DMA_POOL_FAILED 3 + +/* Was the DMA buffer pool allocation attempted? */ +static int _dma_pool_alloc_state = DNA_POOL_INVALID; + static int _use_himem = 0; static unsigned long _himemaddr = 0; +/* None-zero if the DMA buffer pool is not mapped to the bus address by the + allocation, and needs to be mapped per device. */ static int _use_dma_mapping = 0; static LIST_HEAD(_dma_seg); +extern int nodevices; +#if _SIMPLE_MEMORY_ALLOCATION_ +static struct device *_dma_alloc_coherent_device = NULL; +#endif /* _SIMPLE_MEMORY_ALLOCATION_ */ + #define DMA_DEV_INDEX 0 /* Device index to allocate memory pool */ #define DMA_DEV(n) lkbde_get_dma_dev(n) #define BDE_NUM_DEVICES(t) lkbde_get_num_devices(t) @@ -651,7 +716,7 @@ _edk_mpool_alloc(int dev_id, size_t size) dma_pbase = pbase; #ifdef REMAP_DMA_NONCACHED - _dma_vbase = IOREMAP(dma_pbase, size); + _dma_vbase = ioremap(dma_pbase, size); #endif _edk_dma_pool[dev_id].cpu_pbase = cpu_pbase; _edk_dma_pool[dev_id].dma_pbase = dma_pbase; @@ -707,7 +772,7 @@ _edk_vm_is_valid(struct file *filp, struct vm_area_struct *vma) * Function: _mpool_free * * Purpose: - * Free all memory allocated by _mpool_alloc + * Free the DMA buffer pool and stop using it. * Parameters: * None * Returns: @@ -716,26 +781,45 @@ _edk_vm_is_valid(struct file *filp, struct vm_area_struct *vma) static void _mpool_free(void) { + if (dma_debug >= 1) { + gprintk("Freeing DMA buffer pool kernel_virt:0x%lx size:0x%x dmaalloc:%d ndevices=%d\n", + (unsigned long)_dma_vbase, _dma_mem_size, dmaalloc, BDE_NUM_DEVICES(BDE_SWITCH_DEVICES)); + } + + /* unmap bus address for all devices */ + /* TODO SDK-235729 skip removed devices */ + if (_use_dma_mapping) { + int i, ndevices; + ndevices = BDE_NUM_DEVICES(BDE_SWITCH_DEVICES); + for (i = 0; i < ndevices && DMA_DEV(i); i ++) { + dma_unmap_single(DMA_DEV(i), (dma_addr_t)_dma_pbase, _dma_mem_size, DMA_BIDIRECTIONAL); + } + _use_dma_mapping = 0; + } + +#ifndef REMAP_DMA_NONCACHED + if (_use_himem) +#endif + { + iounmap(_dma_vbase); + } + switch (dmaalloc) { #if _SIMPLE_MEMORY_ALLOCATION_ case ALLOC_TYPE_API: if (_dma_vbase) { - if (dma_debug >= 1) gprintk("freeing v=%p p=0x%lx size=0x%lx\n", _dma_vbase,(unsigned long) _dma_pbase, (unsigned long)_dma_mem_size); - dma_free_coherent(DMA_DEV(DMA_DEV_INDEX), _dma_mem_size, _dma_vbase, _dma_pbase); + if (dma_debug >= 1) gprintk("freeing v=0x%lx p=0x%lx size=0x%lx\n", (unsigned long)_dma_vbase,(unsigned long) _dma_pbase, (unsigned long)_dma_mem_size); + if (_dma_alloc_coherent_device != NULL) { + dma_free_coherent(_dma_alloc_coherent_device, _dma_mem_size, _dma_vbase, _dma_pbase); + _dma_alloc_coherent_device = NULL; + } } break; #endif /* _SIMPLE_MEMORY_ALLOCATION_ */ case ALLOC_TYPE_CHUNK: { struct list_head *pos, *tmp; - int i, ndevices; - if (_use_dma_mapping) { - ndevices = BDE_NUM_DEVICES(BDE_SWITCH_DEVICES); - for (i = 0; i < ndevices && DMA_DEV(i); i ++) { - dma_unmap_single(DMA_DEV(i), (dma_addr_t)_dma_pbase, _dma_mem_size, DMA_BIDIRECTIONAL); - } - _use_dma_mapping = 0; - } + list_for_each_safe(pos, tmp, &_dma_seg) { dma_segment_t *dseg = list_entry(pos, dma_segment_t, list); list_del(&dseg->list); @@ -744,9 +828,15 @@ _mpool_free(void) break; } + case ALLOC_TYPE_HIMEM: + break; + default: - gprintk("DMA memory allocation method dmaalloc=%d is not supported\n", dmaalloc); + gprintk("_mpool_free:DMA memory allocation method dmaalloc=%d is not supported\n", dmaalloc); } + _dma_vbase = NULL; + _cpu_pbase = 0; + _dma_pbase = 0; } /* @@ -759,6 +849,8 @@ _mpool_free(void) * Returns: * Nothing. * Notes: + * The DMA buffer pool is allocated if the selected memory allocation + * method does not also map it to PCIe bus addresses. * If set up to use high memory, we simply map the memory into * kernel space. * It is assumed there is only one pool. @@ -767,15 +859,10 @@ static void _mpool_alloc(size_t size) { unsigned long pbase = 0; - struct device *dev = DMA_DEV(DMA_DEV_INDEX); - int dma64_support = 0; -#if defined(IPROC_CMICD) && defined(CONFIG_OF) - if (of_find_compatible_node(NULL, NULL, "brcm,iproc-cmicx")) { - dma64_support = 1; + if (dma_debug >= 1) { + gprintk("Allocating DMA memory using method dmaalloc=%d\n", dmaalloc); } -#endif - #if defined(__arm__) && !defined(CONFIG_HIGHMEM) if (_use_himem) { gprintk("DMA in high memory requires CONFIG_HIGHMEM on ARM CPUs.\n"); @@ -783,62 +870,34 @@ _mpool_alloc(size_t size) } #endif + if (size == 0) return; + if (_use_himem) { /* Use high memory for DMA */ if (_himemaddr) { pbase = _himemaddr; } else { - pbase = virt_to_bus(high_memory); - } - if (((pbase + (size - 1)) >> 16) > DMA_BIT_MASK(16)) { - gprintk("DMA in high memory at 0x%lx size 0x%lx is beyond the 4GB limit and not supported.\n", pbase, (unsigned long)size); - return; + pbase = virt_to_phys(high_memory); } _cpu_pbase = pbase; - if (dev) { - /* Use dma_map_single to obtain DMA bus address or I/O virtual address, if - IOMMU is present. */ - pbase = dma_map_single(dev, bus_to_virt(_cpu_pbase), size, DMA_BIDIRECTIONAL); - if (BDE_DMA_MAPPING_ERROR(dev, pbase)) { - gprintk("Error !! Failed to map memory at phys base 0x%lx\n", - (unsigned long)_cpu_pbase); - _cpu_pbase = 0; - return; - } - _use_dma_mapping = 1; - } else { - pbase = _cpu_pbase; - } - _dma_pbase = pbase; - _dma_vbase = IOREMAP(_dma_pbase, size); + _dma_vbase = phys_to_virt(pbase); + _use_dma_mapping = 1; } else { - /* Get DMA memory from kernel */ - if (dma_debug >= 1) { - gprintk("Allocating DMA memory using method dmaalloc=%d\n", dmaalloc); - } switch (dmaalloc) { #if _SIMPLE_MEMORY_ALLOCATION_ case ALLOC_TYPE_API: { - size_t alloc_size = size; /* size of memory allocated in current iteration */ - if (alloc_size > DMA_MAX_ALLOC_SIZE) { - alloc_size = DMA_MAX_ALLOC_SIZE; - } - /* get a memory allocation from the kernel */ - { - dma_addr_t dma_handle; - _dma_vbase = dma_alloc_coherent(dev, alloc_size, &dma_handle, GFP_KERNEL); - if (!_dma_vbase || !dma_handle) { - gprintk("Failed to allocate coherent memory pool of size 0x%lx\n", (unsigned long)alloc_size); - return; - } - _cpu_pbase = pbase = dma_handle; + /* The allocation will be performed together with the mapping to the first device */ + if (size > DMA_MAX_ALLOC_SIZE) { + gprintk("Will allocate 0x%lx bytes instead of 0x%lx bytes.\n", + (unsigned long)DMA_MAX_ALLOC_SIZE, (unsigned long)size); + _dma_mem_size = DMA_MAX_ALLOC_SIZE; } - - if (alloc_size != size) { - gprintk("allocated 0x%lx bytes instead of 0x%lx bytes.\n", - (unsigned long)alloc_size, (unsigned long)size); + if (nodevices == 1) { + /* With no devices, allocate immediately mapping to the null device */ + _dma_pool_alloc_state = DMA_POOL_INITIALIZED; + _dma_per_device_init(0); + return; } - size = _dma_mem_size = alloc_size; break; } #endif /* _SIMPLE_MEMORY_ALLOCATION_ */ @@ -849,20 +908,8 @@ _mpool_alloc(size_t size) gprintk("Failed to allocate memory pool of size 0x%lx\n", (unsigned long)size); return; } - _cpu_pbase = virt_to_bus(_dma_vbase); - /* Use dma_map_single to obtain DMA bus address or IOVA if IOMMU is present. */ - if (dev) { - pbase = dma_map_single(dev, _dma_vbase, size, DMA_BIDIRECTIONAL); - if (BDE_DMA_MAPPING_ERROR(dev, pbase)) { - gprintk("Failed to map memory at %p\n", _dma_vbase); - _mpool_free(); - _dma_vbase = NULL; - return; - } - _use_dma_mapping = 1; - } else { - pbase = _cpu_pbase; - } + _cpu_pbase = virt_to_phys(_dma_vbase); + _use_dma_mapping = 1; break; default: _dma_vbase = NULL; @@ -870,24 +917,12 @@ _mpool_alloc(size_t size) return; } - _dma_pbase = pbase; - - if (!dma64_support && ((pbase + (size - 1)) >> 16) > DMA_BIT_MASK(16)) { - gprintk("DMA memory allocated at 0x%lx size 0x%lx is beyond the 4GB limit and not supported.\n", pbase, (unsigned long)size); - _mpool_free(); - _dma_vbase = NULL; - _dma_pbase = 0; - return; - } + } -#ifdef REMAP_DMA_NONCACHED - _dma_vbase = IOREMAP(_dma_pbase, size); -#endif - if (dma_debug >= 1) { - gprintk("_use_dma_mapping:%d _dma_vbase:%p _dma_pbase:%lx _cpu_pbase:%lx allocated:%lx dmaalloc:%d, dma64_support:%d\n", - _use_dma_mapping, _dma_vbase, (unsigned long)_dma_pbase, - (unsigned long)_cpu_pbase, (unsigned long)size, dmaalloc, dma64_support); - } + _dma_pool_alloc_state = DMA_POOL_INITIALIZED; + if (_use_dma_mapping && dma_debug >= 1) { + gprintk("DMA buffer pool before mapping kernel_virt:0x%lx physical:0x%lx size:0x%lx dmaalloc:%d\n", + (unsigned long)_dma_vbase, (unsigned long)_cpu_pbase, (unsigned long)size, dmaalloc); } } @@ -909,51 +944,139 @@ _dma_cleanup(void) #endif if (_dma_vbase) { mpool_destroy(_dma_pool); - if (_use_himem) { - int i, ndevices; - iounmap(_dma_vbase); - if (_use_dma_mapping) { - ndevices = BDE_NUM_DEVICES(BDE_SWITCH_DEVICES); - for (i = 0; i < ndevices && DMA_DEV(i); i ++) { - dma_unmap_single(DMA_DEV(i), (dma_addr_t)_dma_pbase, _dma_mem_size, - DMA_BIDIRECTIONAL); - } - _use_dma_mapping = 0; - } - } else { -#ifdef REMAP_DMA_NONCACHED - iounmap(_dma_vbase); -#endif - _mpool_free(); - } - _dma_vbase = NULL; - _dma_pbase = 0; - _cpu_pbase = 0; + _mpool_free(); } + /* In case support will be added to re-allocate the DMA buffer pool */ + _dma_pool_alloc_state = DNA_POOL_INVALID; return 0; } -void _dma_init(int dev_index) +/* + * DMA initialization for a device. Called later than _dma_init(). + * Perform the IOMMU mapping for the specified device. + */ +void _dma_per_device_init(int dev_index) { - unsigned long pbase; + dma_addr_t dma_addr; + struct device *dev; + int performed_initial_pool_mapping = 0; + int dma64_support = 0; + + if (dma_debug >= 2) { + gprintk("_dma_per_device_init dev_index:%d _use_dma_mapping:%d kernel_virt:0x%lx physical:0x%lx size:0x%x dmaalloc:%d\n", + dev_index, _use_dma_mapping, (unsigned long)_dma_vbase, + (unsigned long)_cpu_pbase, _dma_mem_size, dmaalloc); + } +#if _SIMPLE_MEMORY_ALLOCATION_ + if (nodevices == 1 && _dma_pool_alloc_state == DMA_POOL_INITIALIZED && dmaalloc == ALLOC_TYPE_API) { + dev = NULL; /* Map to a null device */ + } else +#endif /* _SIMPLE_MEMORY_ALLOCATION_ */ + if ( dev_index < 0 || (dev = DMA_DEV(dev_index)) == NULL) { + return; + } - if (dev_index > DMA_DEV_INDEX) { - if (_use_dma_mapping && DMA_DEV(dev_index) && _dma_vbase) { - pbase = dma_map_single(DMA_DEV(dev_index), _dma_vbase, _dma_mem_size, DMA_BIDIRECTIONAL); - if (BDE_DMA_MAPPING_ERROR(DMA_DEV(dev_index), pbase)) { - gprintk("Failed to map memory for device %d at %p\n", dev_index, _dma_vbase); +#if _SIMPLE_MEMORY_ALLOCATION_ + if (_dma_pool_alloc_state == DMA_POOL_INITIALIZED && dmaalloc == ALLOC_TYPE_API) { + /* allocate the DMA buffer pool and map it to the device, uses CMA */ + _dma_vbase = dma_alloc_coherent(dev, _dma_mem_size, &dma_addr, GFP_KERNEL); + if (!_dma_vbase) { + _dma_pool_alloc_state = DMA_POOL_FAILED; + gprintk("Failed to allocate coherent memory pool of size 0x%x\n", _dma_mem_size); + return; + } + _dma_alloc_coherent_device = dev; + performed_initial_pool_mapping = 1; + /* Set the host physical address of the DMA buffer pool */ + _cpu_pbase = HOST_PHYS_ADDR(dev, dma_addr, _dma_vbase); + + } else +#endif /* _SIMPLE_MEMORY_ALLOCATION_ */ + + /* IF the DMA buffer pool required mapping to the device, perform it */ + if (_use_dma_mapping && _dma_vbase && (_dma_pool_alloc_state == DMA_POOL_INITIALIZED || + _dma_pool_alloc_state == DMA_POOL_MAPPED)) { + /* Map RAM virtual address space for DMA usage and obtain DMA bus address or IOVA if iommu is present. */ + dma_addr = dma_map_single(dev, _dma_vbase, _dma_mem_size, DMA_BIDIRECTIONAL); + if (BDE_DMA_MAPPING_ERROR(dev, dma_addr)) { + gprintk("Failed to map DMA buffer pool for device %d at kernel_virt:0x%lx\n", dev_index, (unsigned long)_dma_vbase); + if (_dma_pool_alloc_state == DMA_POOL_INITIALIZED) { + _mpool_free(); + _dma_pool_alloc_state = DMA_POOL_FAILED; + } return; } - if (pbase != (unsigned long)_dma_pbase) { - /* Bus address/IOVA must be identical for all devices. */ - gprintk("Device %d has different pbase: %lx (should be %lx)\n", - dev_index, pbase, (unsigned long)_dma_pbase); + if (_dma_pool_alloc_state == DMA_POOL_INITIALIZED) { + performed_initial_pool_mapping = 1; + } else { + if (dma_addr != (dma_addr_t)_dma_pbase) { + /* Bus address/IOVA must be identical for all devices. */ + gprintk("Device %d has different PCIe bus address:0x%lx (should be 0x%lx)\n", + dev_index, (unsigned long)dma_addr, (unsigned long)_dma_pbase); + } + return; + } + } + + + /* On the first mapping of the DMA buffer pool, check the mapped address and mark it as mapped */ + if (performed_initial_pool_mapping) { +#if defined(IPROC_CMICD) && defined(CONFIG_OF) + if (of_find_compatible_node(NULL, NULL, "brcm,iproc-cmicx")) { + dma64_support = 1; + } +#endif + + if (!dma64_support && ((dma_addr + (_dma_mem_size - 1)) >> 16) > DMA_BIT_MASK(16)) { + gprintk("DMA memory allocated at dma_bus:0x%lx size 0x%x is beyond the 4GB limit and not supported.\n", (unsigned long)dma_addr, _dma_mem_size); + _mpool_free(); + _dma_pool_alloc_state = DMA_POOL_FAILED; + return; + } + _dma_pbase = dma_addr; + _dma_pool_alloc_state = DMA_POOL_MAPPED; + +#ifndef REMAP_DMA_NONCACHED + if (_use_himem) +#endif + { + if (dma_debug >= 2) { + gprintk("remapping DMA buffer pool from physical:0x%lx original kernel_virt:0x%lx\n", + (unsigned long)_dma_pbase, (unsigned long)_dma_vbase); } + _dma_vbase = ioremap(_dma_pbase, _dma_mem_size); } + + if (dma_debug >= 1) { + gprintk("Mapped DMA buffer pool _use_dma_mapping:%d kernel_virt:0x%lx dma_bus:0x%lx physical:0x%lx size:0x%x dmaalloc:%d, dma64_support:%d\n", + _use_dma_mapping, (unsigned long)_dma_vbase, (unsigned long)_dma_pbase, + (unsigned long)_cpu_pbase, _dma_mem_size, dmaalloc, dma64_support); + } + + /* DMA buffer pool initialization */ + mpool_init(); + _dma_pool = mpool_create(_dma_vbase, _dma_mem_size); + } + return; +} + +/* + * If this is the first time the function is called, * allocate the DMA + * buffer pool. + * Use kernel module arguments for pool size and allocation methods. + */ +void _dma_init(void) +{ + /* + * If DMA buffer pool allocation was already attempted and failed, + * do not attempt again. + */ + if (_dma_pool_alloc_state != DNA_POOL_INVALID || _dma_vbase != NULL) { return; } + _dma_pool_alloc_state = DMA_POOL_FAILED; - /* DMA Setup */ + /* dmasize, himem and himemaddr kernel module argument parsing */ if (dmasize) { if ((dmasize[strlen(dmasize)-1] & ~0x20) == 'M') { _dma_mem_size = simple_strtoul(dmasize, NULL, 0); @@ -970,6 +1093,7 @@ void _dma_init(int dev_index) if (himem) { if ((himem[0] & ~0x20) == 'Y' || himem[0] == '1') { _use_himem = 1; + dmaalloc = ALLOC_TYPE_HIMEM; } else if ((himem[0] & ~0x20) == 'N' || himem[0] == '0') { _use_himem = 0; } @@ -987,13 +1111,12 @@ void _dma_init(int dev_index) } } + /* DMA buffer pool allocation and initialization that can be done without mapping to DMA */ if (_dma_mem_size) { + /* Allocate the DMA buffer pool */ _mpool_alloc(_dma_mem_size); - if (_dma_vbase == NULL) { + if (_dma_pool_alloc_state != DMA_POOL_INITIALIZED) { gprintk("no DMA memory available\n"); - } else { - mpool_init(); - _dma_pool = mpool_create(_dma_vbase, _dma_mem_size); } } } @@ -1028,7 +1151,7 @@ int _dma_mmap(struct file *filp, struct vm_area_struct *vma) #ifdef USE_DMA_MMAP_COHERENT if (dmaalloc == ALLOC_TYPE_API) { vma->vm_pgoff = 0; - return dma_mmap_coherent(DMA_DEV(DMA_DEV_INDEX), vma, (void *)_dma_vbase, phys_addr, size); + return dma_mmap_coherent(_dma_alloc_coherent_device, vma, (void *)_dma_vbase, phys_addr, size); } #endif @@ -1073,6 +1196,7 @@ _l2p(int d, void *vaddr) } return 0; } + /* TODO will not work with IOMMU */ return ((sal_paddr_t)virt_to_bus(vaddr)); } @@ -1088,6 +1212,7 @@ _p2l(int d, sal_paddr_t paddr) } return (void *)(vaddr + (sal_vaddr_t)(paddr - _dma_pbase)); } + /* TODO will not work with IOMMU */ return bus_to_virt(paddr); } @@ -1145,12 +1270,8 @@ _sinval(int d, void *ptr, int length) #if defined(dma_cache_wback_inv) dma_cache_wback_inv((unsigned long)ptr, length); #else -#if defined(IPROC_CMICD) || defined(BCM958525) /* FIXME: need proper function to replace dma_cache_sync */ dma_sync_single_for_cpu(NULL, (unsigned long)ptr, length, DMA_BIDIRECTIONAL); -#else - dma_cache_sync(NULL, ptr, length, DMA_BIDIRECTIONAL); -#endif #endif return 0; } @@ -1161,12 +1282,8 @@ _sflush(int d, void *ptr, int length) #if defined(dma_cache_wback_inv) dma_cache_wback_inv((unsigned long)ptr, length); #else -#if defined(IPROC_CMICD) || defined(BCM958525) /* FIXME: need proper function to replace dma_cache_sync */ dma_sync_single_for_cpu(NULL, (unsigned long)ptr, length, DMA_BIDIRECTIONAL); -#else - dma_cache_sync(NULL, ptr, length, DMA_BIDIRECTIONAL); -#endif #endif return 0; @@ -1179,7 +1296,6 @@ lkbde_get_dma_info(phys_addr_t* cpu_pbase, phys_addr_t* dma_pbase, ssize_t* size if (_dma_mem_size == 0) { _dma_mem_size = DMA_MEM_DEFAULT; } - _mpool_alloc(_dma_mem_size); } *cpu_pbase = _cpu_pbase; *dma_pbase = _dma_pbase; diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/Makefile b/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/Makefile index 2cc96df02d0a..633475c2590e 100644 --- a/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/Makefile +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/Makefile @@ -64,7 +64,7 @@ $(KMODULE): $(MODULE) mkdir $(BLDDIR)/$(KERNEL_MODULE_DIR) cp ${SDK}/make/Makefile.linux-kmodule $(BLDDIR)/$(KERNEL_MODULE_DIR)/Makefile cat ${KBUILD_EXTRA_SYMBOLS} > $(BLDDIR)/$(KERNEL_MODULE_DIR)/Module.symvers - MOD_NAME=$(THIS_MOD_NAME) $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko + MOD_NAME=$(THIS_MOD_NAME) KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko endif kernel_libs: diff --git a/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.c b/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.c index 4e6186e2d80d..7677aa5d4394 100644 --- a/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.c +++ b/platform/broadcom/saibcm-modules/systems/bde/linux/user/kernel/linux-user-bde.c @@ -71,6 +71,7 @@ MODULE_LICENSE("GPL"); /* CMICX defines */ #define INTC_INTR_REG_NUM (8) #define PAXB_INTRCLR_DELAY_REG_NUM (16) + /* TODO:HX5 The INTR base address values are changed for HX5, @@ -109,6 +110,29 @@ be made. #define INTC_INTR_STATUS_BASE (INTC_INTR_STATUS_REG0) #define INTC_INTR_RAW_STATUS_BASE (INTC_INTR_RAW_STATUS_REG0) +/** CMICX Gen2 defines*/ +#define CMICX_GEN2_INTC_INTR_REG_NUM (10) +#define CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_0 (0x0292C3A0) +#define CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_1 (0x0292C3A4) +#define CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_MODE_0 (0x0292C3A8) +#define CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_MODE_1 (0x0292C3AC) +#define CMICX_GEN2_PAXB_0_PAXB_INTR_STATUS (0x0292CF38) +#define CMICX_GEN2_PAXB_0_PAXB_IC_INTR_PACING_CTRL (0x0292C398) +#define CMICX_GEN2_PAXB_0_PAXB_INTRCLR_DELAY_UNIT (0x0292C39c) +#define CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_DELAY_REG0 (0x0292C3b0) +#define CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_DELAY_BASE (CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_DELAY_REG0) +#define CMICX_GEN2_PAXB_0_PCIE_ERROR_STATUS (0x0292C024) +#define CMICX_GEN2_PAXB_0_INTC_INTR_ENABLE_REG0 (0x0292D100) +#define CMICX_GEN2_PAXB_0_INTC_INTR_STATUS_REG0 (0x0292D1A0) +#define CMICX_GEN2_PAXB_0_INTC_INTR_RAW_STATUS_REG0 (0x0292D178) +#define CMICX_GEN2_PAXB_0_INTC_INTR_ENABLE_BASE (CMICX_GEN2_PAXB_0_INTC_INTR_ENABLE_REG0) +#define CMICX_GEN2_PAXB_0_INTC_INTR_STATUS_BASE (CMICX_GEN2_PAXB_0_INTC_INTR_STATUS_REG0) +#define CMICX_GEN2_PAXB_0_INTC_INTR_RAW_STATUS_BASE (CMICX_GEN2_PAXB_0_INTC_INTR_RAW_STATUS_REG0) +#define CMICX_GEN2_INTC_PDMA_INTR_REG_IND_0 5 +#define CMICX_GEN2_INTC_PDMA_INTR_REG_IND_1 6 + + + #define HX5_INTC_INTR_ENABLE_REG0 (0x102310f0) #define HX5_INTC_INTR_STATUS_REG0 (0x10231190) #define HX5_INTC_INTR_RAW_STATUS_REG0 (0x10231140) @@ -117,8 +141,6 @@ be made. #define HX5_INTC_INTR_STATUS_BASE (HX5_INTC_INTR_STATUS_REG0) #define HX5_INTC_INTR_RAW_STATUS_BASE (HX5_INTC_INTR_RAW_STATUS_REG0) -#define IOREMAP(addr, size) ioremap_nocache(addr, size) - #define HX5_IHOST_GICD_ISENABLERN_0 (0x10781100) #define HX5_IHOST_GICD_ISENABLERN_1 (0x10781104) #define HX5_IHOST_GICD_ICENABLERN_1 (0x10781184) @@ -205,6 +227,7 @@ typedef struct _intr_regs_s { uint32 intc_intr_clear_delay_unit; uint32 intc_intr_clear_delay_base; uint32 intc_intr_pcie_err_status; + uint32 intc_intr_nof_regs; } _intr_regs_t; typedef struct bde_ctrl_s { @@ -351,7 +374,7 @@ dump_interrupt_regs(bde_ctrl_t *ctrl , int dev) if (debug >= 2) { gprintk("Interrupt timeout count = %lu\n", intr_timeout_count); gprintk("Interrupt count = %lu\n", intr_count); - for (ind = 0; ind < INTC_INTR_REG_NUM; ind++) { + for (ind = 0; ind < ctrl->intr_regs.intc_intr_nof_regs; ind++) { IPROC_READ(dev, ctrl->intr_regs.intc_intr_status_base + 4 * ind, val); gprintk("INTC_INTR_STATUS_REG_%d = 0x%x\n", ind, val); IPROC_READ(dev, ctrl->intr_regs.intc_intr_raw_status_base + 4 * ind, val); @@ -375,7 +398,7 @@ dump_interrupt_regs(bde_ctrl_t *ctrl , int dev) } } /* Clear interrupt enable registers */ - for (ind = 0; ind < INTC_INTR_REG_NUM; ind++) { + for (ind = 0; ind < ctrl->intr_regs.intc_intr_nof_regs; ind++) { IPROC_WRITE(dev, ctrl->intr_regs.intc_intr_enable_base + 4 * ind, 0); } } @@ -385,7 +408,7 @@ static int _cmicx_edk_interrupt_check(bde_ctrl_t *ctrl, int d) { bde_inst_resource_t *res; - uint32 stat, mask = 0, bitmap = 0; + uint32 stat, mask = 0, bitmap = 0, reg; int idx; res = &_bde_inst_resource[ctrl->inst]; @@ -403,14 +426,36 @@ _cmicx_edk_interrupt_check(bde_ctrl_t *ctrl, int d) } bitmap = (bitmap >> 1); } - if (mask) + if (mask) { + /* Explicitly reading status to clear the interrupt status on read + * as it is clear that it is EDK's interrupt */ + IPROC_READ(d, ctrl->intr_regs.intc_intr_raw_status_base + + (res->edk_irqs.sw_intr_intrc_offset * 4), stat); + if (stat == res->edk_irqs.sw_intr_intrc_mask) { + IPROC_READ(d, ctrl->intr_regs.intc_intr_status_base + + (res->edk_irqs.sw_intr_intrc_offset * 4), stat); + } + /* Disable SWI and return */ + reg = ctrl->intr_regs.intc_intr_enable_base + + (res->edk_irqs.sw_intr_intrc_offset * 4); + IPROC_READ(d, reg, stat); + stat &= ~res->edk_irqs.sw_intr_intrc_mask; + IPROC_WRITE(d, reg, stat); return 1; + } } - /* EDK uses timer interrupt as watchdog to indicate the the firmware has crashed */ + /* EDK uses timer interrupt as watchdog to indicate the + * firmware has crashed */ IPROC_READ(d, ctrl->intr_regs.intc_intr_raw_status_base + (res->edk_irqs.timer_intrc_offset * 4), stat); if (stat & res->edk_irqs.timer_intrc_mask) { + /* Disable WD timer interrupt and return */ + reg = ctrl->intr_regs.intc_intr_enable_base + + (res->edk_irqs.timer_intrc_offset * 4); + IPROC_READ(d, reg, stat); + stat &= ~res->edk_irqs.timer_intrc_mask; + IPROC_WRITE(d, reg, stat); return 1; } return 0; @@ -422,9 +467,20 @@ _cmicx_interrupt_prepare(bde_ctrl_t *ctrl) { int d, ind, ret = 0; uint32 stat, iena, mask, fmask; + uint32 intrs = 0; d = (((uint8 *)ctrl - (uint8 *)_devices) / sizeof (bde_ctrl_t)); +#ifdef BDE_EDK_SUPPORT + /* Check for interrupts meant for EDK and return without wasting time */ + if (ctrl->edk_irq_enabled) { + ret = _cmicx_edk_interrupt_check(ctrl, d); + if (ret) { + return ret; + } + } +#endif + if (ctrl->dev_type & BDE_PCI_DEV_TYPE) { IPROC_READ(d, ctrl->intr_regs.intc_intr_clear_mode_0, stat); /* Clear MSI interrupts immediately to prevent spurious interrupts */ @@ -444,7 +500,8 @@ _cmicx_interrupt_prepare(bde_ctrl_t *ctrl) IPROC_READ(d, ctrl->intr_regs.intc_intr_status_base + 4 * INTC_PDMA_INTR_REG_IND, stat); IPROC_READ(d, ctrl->intr_regs.intc_intr_enable_base + 4 * INTC_PDMA_INTR_REG_IND, iena); } - if (stat & iena) { + intrs = stat & iena; + if (intrs && (intrs == (intrs & fmask))) { if (ctrl->dev_type & BDE_AXI_DEV_TYPE) { IHOST_WRITE_INTR(d, ihost_intr_enable_base + INTC_PDMA_INTR_REG_IND + HX5_IHOST_IRQ_MASK_OFFSET, ~0); @@ -488,13 +545,9 @@ _cmicx_interrupt_prepare(bde_ctrl_t *ctrl) * So as to avoid getting new interrupts until the user level driver * enumerates the interrupts to be serviced */ -#ifdef BDE_EDK_SUPPORT - if (ctrl->edk_irq_enabled) - ret = _cmicx_edk_interrupt_check(ctrl, d); -#endif for (ind = 0; ind < INTC_INTR_REG_NUM; ind++) { - if (fmask && ind == INTC_PDMA_INTR_REG_IND) { + if (fmask && (intrs == (intrs & fmask)) && ind == INTC_PDMA_INTR_REG_IND) { continue; } if (ctrl->dev_type & BDE_AXI_DEV_TYPE) { @@ -550,6 +603,85 @@ _cmicx_interrupt(bde_ctrl_t *ctrl) } } +#ifdef NEED_CMICX_GEN2_INTERRUPT +static void +_cmicx_gen2_interrupt(bde_ctrl_t *ctrl) +{ + int d, ind ; + uint32 stat, iena, mask, fmask; + int active_interrupts = 0; + bde_inst_resource_t *res; + + intr_count++; + d = (((uint8 *)ctrl - (uint8 *)_devices) / sizeof (bde_ctrl_t)); + res = &_bde_inst_resource[ctrl->inst]; + + /** Get MSI clear mode, auto clear or SW clear, must be configure same for 64 MSI/MSIx vectors */ + IPROC_READ(d, ctrl->intr_regs.intc_intr_clear_mode_0, stat); + /* Clear MSI interrupts immediately to prevent spurious interrupts */ + if (stat == 0) { + IPROC_WRITE(d, ctrl->intr_regs.intc_intr_clear_0, 0xFFFFFFFF); + IPROC_WRITE(d, ctrl->intr_regs.intc_intr_clear_1, 0xFFFFFFFF); + } + + lkbde_irq_mask_get(d, &mask, &fmask); + for (ind = 0; ind < CMICX_GEN2_INTC_INTR_REG_NUM; ind++) { + IPROC_READ(d, ctrl->intr_regs.intc_intr_status_base + 4 * ind, stat); + if (stat == 0) { + continue; + } + + if (fmask) { + /** Packet DMA 8 - 31 bits on IPROC_IRQ_BASE5 */ + if ((ind == CMICX_GEN2_INTC_PDMA_INTR_REG_IND_0) && !(stat & 0xFF)) { + continue; + } else if ((ind == CMICX_GEN2_INTC_PDMA_INTR_REG_IND_1) && !(stat & 0xFFFFFF00)) { + /** Packet DMA 0 - 7 bits on IPROC_IRQ_BASE6 */ + continue; + } + } + IPROC_READ(d, ctrl->intr_regs.intc_intr_enable_base + 4 * ind, iena); + if (stat & iena) { + active_interrupts = 1; + break; + } + } + + /* No active interrupts to service */ + if (!active_interrupts) { + return; + } + + /* Disable all interrupts.. Re-enable unserviced interrupts later + * So as to avoid getting new interrupts until the user level driver + * enumerates the interrupts to be serviced + */ + for (ind = 0; ind < CMICX_GEN2_INTC_INTR_REG_NUM; ind++) { + if (fmask) { + /** TODO? change by KNET */ + if (ind == CMICX_GEN2_INTC_PDMA_INTR_REG_IND_0) { + IPROC_READ(d, ctrl->intr_regs.intc_intr_enable_base + 4 * ind, iena); + IPROC_WRITE(d, ctrl->intr_regs.intc_intr_enable_base + (4 * ind), iena & ((fmask & 0xFFFFFF) << 8)); + continue; + } else if (ind == CMICX_GEN2_INTC_PDMA_INTR_REG_IND_1) { + IPROC_READ(d, ctrl->intr_regs.intc_intr_enable_base + 4 * ind, iena); + IPROC_WRITE(d, ctrl->intr_regs.intc_intr_enable_base + (4 * ind), iena & ((fmask & 0xFF) << 24)); + continue; + } + } + IPROC_WRITE(d, ctrl->intr_regs.intc_intr_enable_base + (4 * ind), 0); + } + + /* Notify */ + atomic_set(&res->intr, 1); +#ifdef BDE_LINUX_NON_INTERRUPTIBLE + wake_up(&res->intr_wq); +#else + wake_up_interruptible(&res->intr_wq); +#endif +} +#endif /* NEED_CMICX_GEN2_INTERRUPT */ + static void _cmicm_interrupt(bde_ctrl_t *ctrl) { @@ -895,9 +1027,9 @@ _intr_mode_str(void *isr) } static void -_intr_regs_init(bde_ctrl_t *ctrl, int hx5_intr) +_intr_regs_init(bde_ctrl_t *ctrl, int flag) { - if (hx5_intr) { + if (flag == 1) { ctrl->intr_regs.intc_intr_status_base = HX5_INTC_INTR_STATUS_BASE; ctrl->intr_regs.intc_intr_enable_base = HX5_INTC_INTR_ENABLE_BASE; ctrl->intr_regs.intc_intr_raw_status_base = HX5_INTC_INTR_RAW_STATUS_BASE; @@ -910,7 +1042,21 @@ _intr_regs_init(bde_ctrl_t *ctrl, int hx5_intr) ctrl->intr_regs.intc_intr_clear_delay_unit = HX5_PAXB_0_PAXB_INTRCLR_DELAY_UNIT; ctrl->intr_regs.intc_intr_clear_delay_base = HX5_PAXB_0_PAXB_IC_INTRCLR_DELAY_BASE; ctrl->intr_regs.intc_intr_pcie_err_status = HX5_PAXB_0_PCIE_ERROR_STATUS; - + ctrl->intr_regs.intc_intr_nof_regs = INTC_INTR_REG_NUM; + } else if (flag == 2){ + ctrl->intr_regs.intc_intr_status_base = CMICX_GEN2_PAXB_0_INTC_INTR_STATUS_BASE; + ctrl->intr_regs.intc_intr_raw_status_base = CMICX_GEN2_PAXB_0_INTC_INTR_RAW_STATUS_BASE; + ctrl->intr_regs.intc_intr_enable_base = CMICX_GEN2_PAXB_0_INTC_INTR_ENABLE_BASE; + ctrl->intr_regs.intc_intr_clear_0 = CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_0; + ctrl->intr_regs.intc_intr_clear_1 = CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_1; + ctrl->intr_regs.intc_intr_clear_mode_0 = CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_MODE_0; + ctrl->intr_regs.intc_intr_clear_mode_1 = CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_MODE_1; + ctrl->intr_regs.intc_intr_status = CMICX_GEN2_PAXB_0_PAXB_INTR_STATUS; + ctrl->intr_regs.intc_intr_pacing_ctrl = CMICX_GEN2_PAXB_0_PAXB_IC_INTR_PACING_CTRL; + ctrl->intr_regs.intc_intr_clear_delay_unit = CMICX_GEN2_PAXB_0_PAXB_INTRCLR_DELAY_UNIT; + ctrl->intr_regs.intc_intr_clear_delay_base = CMICX_GEN2_PAXB_0_PAXB_IC_INTRCLR_DELAY_BASE; + ctrl->intr_regs.intc_intr_pcie_err_status = CMICX_GEN2_PAXB_0_PCIE_ERROR_STATUS; + ctrl->intr_regs.intc_intr_nof_regs = CMICX_GEN2_INTC_INTR_REG_NUM; } else { ctrl->intr_regs.intc_intr_status_base = INTC_INTR_STATUS_BASE; ctrl->intr_regs.intc_intr_raw_status_base = INTC_INTR_RAW_STATUS_BASE; @@ -924,7 +1070,7 @@ _intr_regs_init(bde_ctrl_t *ctrl, int hx5_intr) ctrl->intr_regs.intc_intr_clear_delay_unit = PAXB_0_PAXB_INTRCLR_DELAY_UNIT; ctrl->intr_regs.intc_intr_clear_delay_base = PAXB_0_PAXB_IC_INTRCLR_DELAY_BASE; ctrl->intr_regs.intc_intr_pcie_err_status = PAXB_0_PCIE_ERROR_STATUS; - + ctrl->intr_regs.intc_intr_nof_regs = INTC_INTR_REG_NUM; } } @@ -1005,13 +1151,13 @@ _devices_init(int d) case BCM88474H_DEVICE_ID: case BCM88476_DEVICE_ID: case BCM88477_DEVICE_ID: + case BCM88479_DEVICE_ID: case BCM88270_DEVICE_ID: case BCM88272_DEVICE_ID: case BCM88273_DEVICE_ID: case BCM88274_DEVICE_ID: case BCM88278_DEVICE_ID: case BCM88279_DEVICE_ID: - case BCM8206_DEVICE_ID: case BCM88950_DEVICE_ID: case BCM88953_DEVICE_ID: case BCM88954_DEVICE_ID: @@ -1044,11 +1190,11 @@ _devices_init(int d) ctrl->isr = (isr_f)_cmicx_interrupt; if (ctrl->dev_type & BDE_AXI_DEV_TYPE) { if (!ihost_intr_enable_base) { - ihost_intr_enable_base = (uint32_t *)IOREMAP(HX5_IHOST_GICD_ISENABLERN_1, + ihost_intr_enable_base = (uint32_t *)ioremap(HX5_IHOST_GICD_ISENABLERN_1, HX5_IHOST_INTR_MAP_NUM); } if (!ihost_intr_status_base) { - ihost_intr_status_base = (uint32_t *)IOREMAP(HX5_INTC_INTR_RAW_STATUS_REG0, + ihost_intr_status_base = (uint32_t *)ioremap(HX5_INTC_INTR_RAW_STATUS_REG0, HX5_IHOST_INTR_STATUS_MAP_NUM); } } @@ -1092,6 +1238,7 @@ _devices_init(int d) case J2C_2ND_DEVICE_ID: case Q2A_DEVICE_ID: case Q2U_DEVICE_ID: + case Q2N_DEVICE_ID: case J2P_DEVICE_ID: #endif #ifdef BCM_DNXF_SUPPORT @@ -1100,6 +1247,7 @@ _devices_init(int d) ctrl->isr = (isr_f)_cmicx_interrupt; _intr_regs_init(ctrl, 0); break; + } #endif /* defined(BCM_DNXF_SUPPORT) || defined(BCM_DNX_SUPPORT) */ @@ -1303,13 +1451,16 @@ _dma_resource_get(unsigned inst_id, phys_addr_t *cpu_pbase, phys_addr_t *dma_pba unsigned int dma_size = 0, dma_offset = 0; bde_inst_resource_t *res; + spin_lock(&bde_resource_lock); if (inst_id >= user_bde->num_devices(BDE_ALL_DEVICES)) { gprintk("ERROR: requested DMA resources for an instance number out of range: %u\n", inst_id); + spin_unlock(&bde_resource_lock); return -1; } res = &_bde_inst_resource[inst_id]; dma_size = res->dma_size; dma_offset = res->dma_offset; + spin_unlock(&bde_resource_lock); *cpu_pbase = _dma_pool.cpu_pbase + dma_offset * ONE_MB; *dma_pbase = _dma_pool.dma_pbase + dma_offset * ONE_MB; @@ -1339,7 +1490,7 @@ _instance_validate(unsigned int inst_id, unsigned int dmasize, linux_bde_device_ } if (res->is_active == 0) { - /* FIXME SDK-225233 check that the devices are not used by another active instance */ + /* FIXME SDK-250746 check that the devices are not used by another active instance */ return LUBDE_SUCCESS; } @@ -1432,7 +1583,6 @@ _instance_attach(unsigned int inst_id, unsigned int dma_size, linux_bde_device_b res->is_active = 1; res->dma_offset = dma_offset; res->dma_size = dma_size; -#ifdef SAI_FIXUP /* SDK-240875 */ /* skip instance 0, WQ for instance 0 has been initialized in user_bde init, see _init() */ if (inst_id != 0) { init_waitqueue_head(&res->intr_wq); @@ -1440,8 +1590,7 @@ _instance_attach(unsigned int inst_id, unsigned int dma_size, linux_bde_device_b atomic_set(&res->intr, 0); atomic_set(&res->edk_intr, 0); } -#endif - memcpy(*lkbde_get_inst_devs(inst_id), inst_devices, sizeof(linux_bde_device_bitmap_t)); /* SDK-225233 */ + memcpy(*lkbde_get_inst_devs(inst_id), inst_devices, sizeof(linux_bde_device_bitmap_t)); /* store the resource/instance index in _bde_inst_resource for every device in the instance */ for (i = 0; i < user_bde->num_devices(BDE_ALL_DEVICES); i++) { @@ -1597,6 +1746,18 @@ _ioctl(unsigned int cmd, unsigned long arg) if (!VALID_DEVICE(io.dev)) { return -EINVAL; } + /* + * Disable interrupt in case already enabled + * This is to handle the use case where userspace + * application gets killed abruptly. + */ + if (_devices[io.dev].enabled) { + if (debug >= 1) { + gprintk("Interrupts already enabled, disable to cleanup\n"); + } + user_bde->interrupt_disconnect(io.dev); + _devices[io.dev].enabled = 0; + } if (_devices[io.dev].dev_type & BDE_SWITCH_DEV_TYPE) { if (_devices[io.dev].isr && !_devices[io.dev].enabled) { user_bde->interrupt_connect(io.dev, @@ -1757,7 +1918,12 @@ _ioctl(unsigned int cmd, unsigned long arg) case LUBDE_SEM_OP: return -EINVAL; case LUBDE_WRITE_IRQ_MASK: - io.rc = lkbde_irq_mask_set(io.dev, io.d0, io.d1, 0); + /* CMICx device */ + if (_devices[io.dev].isr == (isr_f)_cmicx_interrupt) { + io.rc = lkbde_irq_mask_set(io.dev + LKBDE_IPROC_REG, io.d0, io.d1, 0); + } else { + io.rc = lkbde_irq_mask_set(io.dev, io.d0, io.d1, 0); + } break; case LUBDE_SPI_READ_REG: if (user_bde->spi_read(io.dev, io.d0, io.dx.buf, io.d1) == -1) { @@ -1818,7 +1984,7 @@ _ioctl(unsigned int cmd, unsigned long arg) return -EINVAL; } if (_devices[io.dev].dev_type & BDE_AXI_DEV_TYPE) { - mapaddr = IOREMAP(io.d0, sizeof(uint32_t)); + mapaddr = ioremap(io.d0, sizeof(uint32_t)); if (mapaddr == NULL) { io.rc = LUBDE_FAIL; return -1; @@ -1871,12 +2037,12 @@ static char _modname[] = LINUX_USER_BDE_NAME; static gmodule_t _gmodule = { - name: LINUX_USER_BDE_NAME, - major: LINUX_USER_BDE_MAJOR, - init: _init, - cleanup: _cleanup, - pprint: _pprint, - ioctl: _ioctl, + .name = LINUX_USER_BDE_NAME, + .major = LINUX_USER_BDE_MAJOR, + .init = _init, + .cleanup = _cleanup, + .pprint = _pprint, + .ioctl = _ioctl, }; gmodule_t* diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/Makefile b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/Makefile index 9879be69b0b6..56b83fb0da33 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/Makefile +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/Makefile @@ -59,7 +59,7 @@ $(KMODULE): $(MODULE) mkdir $(BLDDIR)/$(KERNEL_MODULE_DIR) cp ${SDK}/make/Makefile.linux-kmodule $(BLDDIR)/$(KERNEL_MODULE_DIR)/Makefile cat ${KBUILD_EXTRA_SYMBOLS} > $(BLDDIR)/$(KERNEL_MODULE_DIR)/Module.symvers - MOD_NAME=$(THIS_MOD_NAME) $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko + MOD_NAME=$(THIS_MOD_NAME) KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko endif # Make.depend is before clean:: so that Make.depend's clean:: runs first. diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c index 43edc056beff..b93f1e913fd9 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c @@ -163,6 +163,13 @@ LKM_MOD_PARAM(basedev_suspend, "i", int, 0); MODULE_PARM_DESC(basedev_suspend, "Pause traffic till base device is up (enabled by default in NAPI mode)"); +static int mirror_local = 1; +LKM_MOD_PARAM(mirror_local, "i", int, 0); +MODULE_PARM_DESC(mirror_local, +"Encapasulate packets based on mirror_to interface configuration, e.g. " +"encapsulate non-RCPU packets when mirrored to an RCPU interface " +"(default 1)."); + /* * Force to add one layer of VLAN tag to untagged packets on Dune devices */ @@ -195,7 +202,6 @@ LKM_MOD_PARAM(ft_vid, "i", int, 0); MODULE_PARM_DESC(ft_vid, "VLAN ID (VID) indicates the VLAN to which a frame belongs (default 0)"); - /* Debug levels */ #define DBG_LVL_VERB 0x1 #define DBG_LVL_DCB 0x2 @@ -524,6 +530,7 @@ static inline void bkn_skb_tx_timestamp(struct sk_buff *skb) #define RCPU_TX_META_SIZE 32 #define RCPU_TX_ENCAP_SIZE (RCPU_HDR_SIZE + RCPU_TX_META_SIZE) #define RCPU_RX_META_SIZE 64 +#define RCPU_RX_META_SIZE_MAX 256 #define RCPU_RX_ENCAP_SIZE (RCPU_HDR_SIZE + RCPU_RX_META_SIZE) #define PKT_TX_HDR_SIZE 16 @@ -582,13 +589,15 @@ typedef struct bkn_switch_info_s { uint32_t rxticks; /* Rx rate control debug counter */ uint32_t interrupts; /* Total number of interrupts */ spinlock_t lock; /* Main lock for device */ + int cfg_api_locked; /* Block configuration API when main lock is + temporary released for calling kernel APIs. */ int dev_no; /* Device number (from BDE) */ int cpu_no; /* Cpu number. 1 for iHost(AXI),0 for others */ int dcb_type; /* DCB type */ int dcb_wsize; /* DCB size (in 32-bit words) */ int pkt_hdr_size; /* Packet header size */ - uint32_t ftmh_lb_key_ext_size; /* FTMH LB-Key Extension existence/size */ - uint32_t ftmh_stacking_ext_size; /* FTMH Stacking extension existence/size */ + uint32_t ftmh_lb_key_ext_size; /* FTMH LB-Key Extension existence/size */ + uint32_t ftmh_stacking_ext_size;/* FTMH Stacking extension existence/size */ uint32_t pph_base_size; /* Size of PPH base */ uint32_t pph_lif_ext_size[8]; /* Size of PPH Lif extension header */ uint32_t udh_length_type[4]; /* Size of UDH header per type */ @@ -597,6 +606,8 @@ typedef struct bkn_switch_info_s { uint8_t no_skip_udh_check; /* Indicates UDH won't be skipped */ uint8_t system_headers_mode; /* Indicates system header mode */ uint8_t udh_enable; /* Indicates UDH existence */ + uint8_t oamp_port_number; /* Indicates number of OAMP system port number */ + uint32_t oamp_ports[KCOM_HW_INFO_OAMP_PORT_MAX]; /* OAMP system port array */ int rx_chans; /* Number of Rx channels */ uint32_t dma_hi; /* DMA higher address */ uint32_t cmic_type; /* CMIC type (CMICe or CMICm) */ @@ -604,7 +615,8 @@ typedef struct bkn_switch_info_s { uint32_t napi_poll_mode; /* NAPI is in polling mode */ uint32_t napi_not_done; /* NAPI poll did not process all packets */ uint32_t napi_poll_again; /* Used if DCB chain is restarted */ - uint32_t tx_yield; /* Tx schedule for Continuous DMA and Non-NAPI mode */ + uint32_t tx_yield; /* Tx schedule for Continuous DMA and Non-NAPI + mode. */ void *dcb_mem; /* Logical pointer to DCB memory */ uint64_t dcb_dma; /* Physical bus address for DCB memory */ int dcb_mem_size; /* Total size of allocated DCB memory */ @@ -613,6 +625,7 @@ typedef struct bkn_switch_info_s { uint64_t halt_addr[NUM_DMA_CHAN]; /* DMA halt address */ uint32_t cdma_channels; /* Active channels for Continuous DMA mode */ uint32_t poll_channels; /* Channels for polling */ + uint32_t unet_channels; /* User network channels */ uint32_t inst_id; /* Instance id of this device */ int evt_idx; /* Event queue index for this device*/ int basedev_suspended; /* Base device suspended */ @@ -685,8 +698,10 @@ typedef struct bkn_switch_info_s { /* ITMH */ #define BKN_DNX_ITMH_SIZE 5 /* Modlue Header */ -#define BKN_DNX_MODULE_HEADER_SIZE 20 +#define BKN_DNX_MODULE_HEADER_SIZE 16 /* FTMH */ +#define BKN_DNX_FTMH_TC_MSB 14 +#define BKN_DNX_FTMH_TC_NOF_BITS 3 #define BKN_DNX_FTMH_SRC_SYS_PORT_AGGREGATE_MSB 17 #define BKN_DNX_FTMH_SRC_SYS_PORT_AGGREGATE_NOF_BITS 16 #define BKN_DNX_FTMH_PP_DSP_MSB 33 @@ -711,6 +726,16 @@ typedef struct bkn_switch_info_s { #define BKN_DNX_FTMH_TM_DST_EXT_SIZE 3 #define BKN_DNX_FTMH_FLOW_ID_EXT_SIZE 3 #define BKN_DNX_FTMH_APP_SPECIFIC_EXT_SIZE 6 +#define BKN_DNX_SYSPORTS_PER_DEVICE_MASK 0x3FF +/*ASE*/ +#define BKN_DNX_FTMH_ASE_OAM_SUB_TYPE_MSB 0 +#define BKN_DNX_FTMH_ASE_OAM_SUB_TYPE_NOF_BITS 4 +#define BKN_DNX_FTMH_ASE_OAM_SUB_TYPE_DM_1588 2 +#define BKN_DNX_FTMH_ASE_OAM_SUB_TYPE_DM_NTP 3 +#define BKN_DNX_FTMH_ASE_TYPE_MSB 47 +#define BKN_DNX_FTMH_ASE_TYPE_NOF_BITS 1 +#define BKN_DNX_FTMH_ASE_TYPE_OAM 0 + /* TSH */ #define BKN_DNX_TSH_SIZE 4 /* PPH */ @@ -768,6 +793,9 @@ typedef struct bkn_switch_info_s { #define BKN_DNX_UDH_DATA_TYPE_3_NOF_BITS 2 #define BKN_DNX_UDH_BASE_SIZE 1 +/* TOD SECOND header */ +#define BKN_DNX_TOD_SECOND_SIZE 4 + #define BKN_DPP_HDR_MAX_SIZE 40 /* PTCH_2 */ #define BKN_DPP_PTCH_2_SIZE 2 @@ -787,6 +815,8 @@ typedef struct bkn_switch_info_s { #define BKN_DPP_FTMH_TC_NOF_BITS 3 #define BKN_DPP_FTMH_SRC_SYS_PORT_MSB 17 #define BKN_DPP_FTMH_SRC_SYS_PORT_NOF_BITS 16 +#define BKN_DPP_FTMH_PP_DSP_MSB 33 +#define BKN_DPP_FTMH_PP_DSP_NOF_BITS 8 #define BKN_DPP_FTMH_EXT_DSP_EXIST_MSB 68 #define BKN_DPP_FTMH_EXT_DSP_EXIST_NOF_BITS 1 #define BKN_DPP_FTMH_EXT_MSB 45 @@ -927,11 +957,13 @@ typedef struct bkn_priv_s { uint32_t vlan; uint32_t flags; uint32_t cb_user_data; - uint8_t system_headers[27]; + uint8_t system_headers[KCOM_NETIF_SYSTEM_HEADERS_SIZE_MAX]; uint32_t system_headers_size; int tx_hwts; /* HW timestamp for Tx */ int rx_hwts; /* HW timestamp for Rx */ int phys_port; + u32 ptp_stats_tx; + u32 ptp_stats_rx; struct ethtool_link_settings link_settings; } bkn_priv_t; @@ -979,6 +1011,7 @@ static knet_hw_tstamp_tx_time_get_cb_f knet_hw_tstamp_tx_time_get_cb = NULL; static knet_hw_tstamp_tx_meta_get_cb_f knet_hw_tstamp_tx_meta_get_cb = NULL; static knet_hw_tstamp_ptp_clock_index_cb_f knet_hw_tstamp_ptp_clock_index_cb = NULL; static knet_hw_tstamp_rx_time_upscale_cb_f knet_hw_tstamp_rx_time_upscale_cb = NULL; +static knet_hw_tstamp_rx_pre_process_cb_f knet_hw_tstamp_rx_pre_process_cb = NULL; static knet_hw_tstamp_ioctl_cmd_cb_f knet_hw_tstamp_ioctl_cmd_cb = NULL; static knet_netif_cb_f knet_netif_create_cb = NULL; static knet_netif_cb_f knet_netif_destroy_cb = NULL; @@ -1073,6 +1106,9 @@ bkn_sleep(int clicks) #define DEV_IS_CMIC(_sinfo) ((_sinfo)->cmic_type != 0) #define CDMA_CH(_d, _ch) ((_d)->cdma_channels & (1 << (_ch))) +/* Unet channel */ +#define UNET_CH(_d, _ch) ((_d)->unet_channels & (1 << (_ch))) + /* * DMA_STAT: control bits * @@ -1123,6 +1159,15 @@ bkn_sleep(int clicks) #define CMICX_DC_CMC_CTRLD_INT (0x00000080) #define CMICX_DC_CMC_CONTINUOUS (0x00000100) +/* Minimum packet header size for protect underflow. */ +#define CMICX_PKT_HDR_SIZE_MIN 8 +/* CMICX minimum packet header size for protect underflow. */ +#define CMICX_DCB_SIZE_MIN 16 +/* Minimum packet header size for protect underflow. */ +#define DCB_SIZE_MIN 20 +/* Maximum packet raw data size for filter validation. */ +#define KNET_FILTER_RAW_MAX 256 + /* * Per-channel operations. * These are the basis for the TX/RX functions @@ -1606,28 +1651,49 @@ xgsx_dma_chan_abort(bkn_switch_info_t *sinfo, int chan, int polls) return -1; } +static inline void +xgsx_irq_fmask_get(bkn_switch_info_t *sinfo, uint32_t *fmask) +{ + int chan, bits = 4, base = 0; + + if (fmask == NULL) { + return; + } + + *fmask = CMICX_TXRX_IRQ_MASK; + + for (chan = 0; chan < sinfo->rx_chans; chan++) { + if (UNET_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + *fmask &= ~(((0x1 << bits) - 1) << ((XGS_DMA_RX_CHAN + chan) * bits + base)); + } + } + return; +} + static inline void xgsx_irq_mask_set(bkn_switch_info_t *sinfo, uint32_t mask) { uint32_t irq_mask_reg = CMICX_IRQ_ENABr; uint32_t irq_mask, irq_fmask, disable_mask; + uint32_t fmask = CMICX_TXRX_IRQ_MASK; if (sinfo->napi_poll_mode) { mask = 0; } + xgsx_irq_fmask_get(sinfo, &fmask); if (sinfo->cpu_no == 1) { lkbde_irq_mask_get(sinfo->dev_no, &irq_mask, &irq_fmask); disable_mask = ~mask & (irq_mask & irq_fmask); if (disable_mask) { lkbde_irq_mask_set(sinfo->dev_no | LKBDE_ISR2_DEV | LKBDE_IPROC_REG, - IHOST_GIC_GIC400_GICD_ICENABLERN_5r, disable_mask, CMICX_TXRX_IRQ_MASK); + IHOST_GIC_GIC400_GICD_ICENABLERN_5r, disable_mask, fmask); } irq_mask_reg = IHOST_GIC_GIC400_GICD_ISENABLERN_5r; } lkbde_irq_mask_set(sinfo->dev_no | LKBDE_ISR2_DEV | LKBDE_IPROC_REG, - irq_mask_reg, mask, CMICX_TXRX_IRQ_MASK); + irq_mask_reg, mask, fmask); } static inline void @@ -2385,6 +2451,9 @@ bkn_dma_init(bkn_switch_info_t *sinfo) } for (chan = 0; chan < sinfo->rx_chans; chan++) { + if (UNET_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + continue; + } dev_dma_chan_init(sinfo, XGS_DMA_RX_CHAN + chan, 0); bkn_rx_refill(sinfo, chan); bkn_rx_restart(sinfo, chan); @@ -2457,13 +2526,16 @@ bkn_dma_abort(bkn_switch_info_t *sinfo) bkn_dma_abort_tx(sinfo); for (chan = 0; chan < sinfo->rx_chans; chan++) { + if (UNET_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + continue; + } bkn_dma_abort_rx(sinfo, chan); } return 0; } -static int +static inline int device_is_dpp(bkn_switch_info_t *sinfo) { int is_dpp = 0; @@ -2472,7 +2544,7 @@ device_is_dpp(bkn_switch_info_t *sinfo) return is_dpp; } -static int +static inline int device_is_dnx(bkn_switch_info_t *sinfo) { int is_dnx = 0; @@ -2482,15 +2554,16 @@ device_is_dnx(bkn_switch_info_t *sinfo) } /* is DPP or is DNX*/ -static int +static inline int device_is_sand(bkn_switch_info_t *sinfo) { - int is_sand = 0; + int is_dpp = 0; + int is_dnx = 0; - if (device_is_dpp(sinfo) || device_is_dnx(sinfo)) { - is_sand = 1; - } - return is_sand; + is_dpp = (sinfo->dcb_type == 28) ? 1 : 0; + is_dnx = (sinfo->dcb_type == 39) ? 1 : 0; + + return (is_dpp | is_dnx); } static bkn_filter_t * @@ -2507,6 +2580,9 @@ bkn_match_rx_pkt(bkn_switch_info_t *sinfo, uint8_t *pkt, int pktlen, list_for_each(list, &sinfo->rxpf_list) { filter = (bkn_filter_t *)list; kf = &filter->kf; + if (kf->pkt_data_offset + kf->pkt_data_size > pktlen) { + continue; + } memcpy(&scratch.data.b[0], &oob[kf->oob_data_offset], kf->oob_data_size); memcpy(&scratch.data.b[kf->oob_data_size], @@ -2620,20 +2696,21 @@ bkn_netif_lookup(bkn_switch_info_t *sinfo, int id) static int bkn_hw_tstamp_rx_set(bkn_switch_info_t *sinfo, int phys_port, struct sk_buff *skb, uint32 *meta) { - struct skb_shared_hwtstamps *shhwtstamps = skb_hwtstamps(skb); + int ret = -1; uint64_t ts = 0; + struct skb_shared_hwtstamps *shhwtstamps = skb_hwtstamps(skb); if (knet_hw_tstamp_rx_time_upscale_cb) { - if (knet_hw_tstamp_rx_time_upscale_cb(sinfo->dev_no, phys_port, skb, meta, &ts) < 0) { - return -1; + if (knet_hw_tstamp_rx_time_upscale_cb(sinfo->dev_no, phys_port, skb, meta, &ts) >= 0) { + ret = 0; } } memset(shhwtstamps, 0, sizeof(*shhwtstamps)); shhwtstamps->hwtstamp = ns_to_ktime(ts); - return 0; + return ret; } static int @@ -2645,9 +2722,12 @@ bkn_add_rcpu_encap(bkn_switch_info_t *sinfo, struct sk_buff *skb, void *meta, in /* Add and clear RCPU encapsulation */ if (device_is_sand(sinfo)) { - psize = RCPU_RX_ENCAP_SIZE; + /* + * len is the length of Dune system headers + */ + psize = RCPU_HDR_SIZE + len; skb_push(skb, psize); - memset(skb->data, 0, RCPU_RX_ENCAP_SIZE); + memset(skb->data, 0, psize); } else if (sinfo->cmic_type == 'x') { psize = RCPU_HDR_SIZE + sinfo->pkt_hdr_size; skb_push(skb, psize); @@ -2677,13 +2757,17 @@ bkn_add_rcpu_encap(bkn_switch_info_t *sinfo, struct sk_buff *skb, void *meta, in skb->data[21] = RCPU_F_MODHDR; skb->data[24] = pktlen >> 8; skb->data[25] = pktlen & 0xff; + if (device_is_sand(sinfo)) { + /* RCPU.meta_len records length of Dune system headers */ + skb->data[28] = len & 0xff; + } /* Meta data */ dmeta = (uint32_t *)&skb->data[RCPU_HDR_SIZE]; if (device_is_sand(sinfo)) { - /* Copy at most 64 bytes system headers */ - len = len > RCPU_RX_META_SIZE ? RCPU_RX_META_SIZE : len; + /* Copy at most 256 bytes system headers */ + len = len > RCPU_RX_META_SIZE_MAX ? RCPU_RX_META_SIZE_MAX : len; memcpy(&skb->data[RCPU_HDR_SIZE], (uint8_t *)meta, len); } else { smeta = sinfo->cmic_type == 'x' ? (uint32_t *)meta : (uint32_t *)meta + 2; @@ -3133,7 +3217,8 @@ bkn_dnx_packet_parse_ftmh( uint32_t buf_len, bkn_dune_system_header_info_t *packet_info, uint8_t *is_tsh_en, - uint8_t *is_inter_hdr_en) + uint8_t *is_inter_hdr_en, + uint8_t *is_oam_dm_tod_second_en) { uint32_t fld_val; uint32_t pkt_offset = packet_info->system_header_size; @@ -3236,6 +3321,23 @@ bkn_dnx_packet_parse_ftmh( /* FTMH Application Specific Extension */ if (app_specific_ext_size > 0) { + bkn_bitstream_get_field( + &buf[pkt_offset], + BKN_DNX_FTMH_ASE_TYPE_MSB, + BKN_DNX_FTMH_ASE_TYPE_NOF_BITS, + &fld_val); + if (fld_val == BKN_DNX_FTMH_ASE_TYPE_OAM) { + /* ASE: OAM_SUB_TYPE */ + bkn_bitstream_get_field( + &buf[pkt_offset], + BKN_DNX_FTMH_ASE_OAM_SUB_TYPE_MSB, + BKN_DNX_FTMH_ASE_OAM_SUB_TYPE_NOF_BITS, + &fld_val); + if ((fld_val == BKN_DNX_FTMH_ASE_OAM_SUB_TYPE_DM_1588) || + (fld_val == BKN_DNX_FTMH_ASE_OAM_SUB_TYPE_DM_NTP)) { + *is_oam_dm_tod_second_en = TRUE; + } + } pkt_offset += BKN_DNX_FTMH_APP_SPECIFIC_EXT_SIZE; DBG_DUNE(("FTMH Application Specific Extension(6-%u) is present\n", pkt_offset)); } @@ -3425,17 +3527,20 @@ bkn_dnx_packet_header_parse( uint32_t buff_len, bkn_dune_system_header_info_t *packet_info) { + uint8_t is_oam_dm_tod_second_en = FALSE; uint8_t is_inter_hdr_en = FALSE; uint8_t is_tsh_en = FALSE; uint8_t is_oamp_punted = FALSE; uint8_t is_trapped = FALSE; + uint8_t idx = 0; if ((sinfo == NULL) || (buff == NULL) || (packet_info == NULL)) { return -1; } /* FTMH */ - bkn_dnx_packet_parse_ftmh(sinfo, buff, buff_len, packet_info, &is_tsh_en, &is_inter_hdr_en); + bkn_dnx_packet_parse_ftmh(sinfo, buff, buff_len, packet_info, + &is_tsh_en, &is_inter_hdr_en, &is_oam_dm_tod_second_en); /* Time-Stamp */ if (is_tsh_en == TRUE) @@ -3445,10 +3550,12 @@ bkn_dnx_packet_header_parse( } /* Check if packet was punted to CPU by OAMP */ - if ((packet_info->ftmh.source_sys_port_aggregate == 232) - || (packet_info->ftmh.source_sys_port_aggregate == 233)) + for (idx = 0; idx < sinfo->oamp_port_number; idx++) { - is_oamp_punted = TRUE; + if (packet_info->ftmh.source_sys_port_aggregate == sinfo->oamp_ports[idx]) + { + is_oamp_punted = TRUE; + } } /* Internal */ @@ -3456,16 +3563,24 @@ bkn_dnx_packet_header_parse( { bkn_dnx_packet_parse_internal(sinfo, buff, buff_len, packet_info, is_oamp_punted, &is_trapped); } + /* OAM DMM/DMR TOD second header */ + if (is_oam_dm_tod_second_en == TRUE) + { + packet_info->system_header_size += BKN_DNX_TOD_SECOND_SIZE; + DBG_DUNE(("TOD second Header(4-%u) is present\n", packet_info->system_header_size)); + } if (is_oamp_punted) { + is_oam_dm_tod_second_en = FALSE; is_inter_hdr_en = FALSE; is_tsh_en = FALSE; is_oamp_punted = FALSE; is_trapped = FALSE; /* FTMH */ - bkn_dnx_packet_parse_ftmh(sinfo, buff, buff_len, packet_info, &is_tsh_en, &is_inter_hdr_en); + bkn_dnx_packet_parse_ftmh(sinfo, buff, buff_len, packet_info, + &is_tsh_en, &is_inter_hdr_en, &is_oam_dm_tod_second_en); /* Time-Stamp */ if (is_tsh_en == TRUE) { @@ -3477,13 +3592,17 @@ bkn_dnx_packet_header_parse( { bkn_dnx_packet_parse_internal(sinfo, buff, buff_len, packet_info, is_oamp_punted, &is_trapped); } + if (is_oam_dm_tod_second_en == TRUE) + { + /* DO NOT have 4Bytes TOD second header. */ + } } DBG_DUNE(("Total length of headers is %u\n", packet_info->system_header_size)); return 0; } - + static int bkn_packet_header_parse(bkn_switch_info_t *sinfo, uint8_t *buf, uint32_t buf_len, bkn_dune_system_header_info_t *packet_info) { @@ -3514,14 +3633,14 @@ bkn_do_api_rx(bkn_switch_info_t *sinfo, int chan, int budget) bkn_dcb_chain_t *dcb_chain; struct sk_buff *skb; bkn_filter_t cbf; - bkn_filter_t *filter; + bkn_filter_t *filter = NULL; uint32_t err_woff; - uint32_t *dcb, *meta; + uint32_t *dcb, *meta, *match_data; uint8_t *pkt; uint64_t pkt_dma; int drop_api; int ethertype; - int pktlen; + int pktlen, pkt_hdr_size; int idx; int dcbs_done = 0; bkn_dune_system_header_info_t packet_info; @@ -3568,11 +3687,17 @@ bkn_do_api_rx(bkn_switch_info_t *sinfo, int chan, int budget) pkt_dma = dcb[0]; } pkt = (uint8_t *)kernel_bde->p2l(sinfo->dev_no, (sal_paddr_t)pkt_dma); + pktlen = dcb[sinfo->dcb_wsize-1] & SOC_DCB_KNET_COUNT_MASK; + bkn_dump_pkt(pkt, pktlen, XGS_DMA_RX_CHAN); if (device_is_sand(sinfo)) { err_woff = BKN_SAND_SCRATCH_DATA_SIZE - 1; sand_scratch_data[err_woff] = dcb[sinfo->dcb_wsize-1]; meta = (uint32_t *)pkt; + memset(&packet_info, 0, sizeof(bkn_dune_system_header_info_t)); + /* Decode system headers and fill sratch data */ + bkn_packet_header_parse(sinfo, pkt, (uint32_t)pktlen, &packet_info); + pkt_hdr_size = packet_info.system_header_size; } else { if (sinfo->cmic_type == 'x') { meta = (uint32_t *)pkt; @@ -3582,71 +3707,81 @@ bkn_do_api_rx(bkn_switch_info_t *sinfo, int chan, int budget) meta = dcb; err_woff = sinfo->dcb_wsize - 1; } + pkt_hdr_size = sinfo->pkt_hdr_size; } - pktlen = dcb[sinfo->dcb_wsize-1] & SOC_DCB_KNET_COUNT_MASK; - bkn_dump_pkt(pkt, pktlen, XGS_DMA_RX_CHAN); - - if (device_is_sand(sinfo)) { - memset(&packet_info, 0, sizeof(bkn_dune_system_header_info_t)); - /* decode system headers and fill sratch data */ - bkn_packet_header_parse(sinfo, pkt, (uint32_t)pktlen, &packet_info); - bkn_bitstream_set_field(sand_scratch_data, 0, 16, packet_info.internal.trap_id); - bkn_bitstream_set_field(sand_scratch_data, 16, 16, packet_info.internal.trap_qualifier); - bkn_bitstream_set_field(sand_scratch_data, 32, 16, packet_info.ftmh.source_sys_port_aggregate); - bkn_bitstream_set_field(sand_scratch_data, 48, 16, packet_info.internal.forward_domain); - bkn_bitstream_set_field(sand_scratch_data, 64, 2, packet_info.ftmh.action_type); - - if (force_tagged) { - uint8_t *eth_hdr = pkt + packet_info.system_header_size; - uint16_t tpid = 0; - - tpid = PKT_U16_GET(eth_hdr, 12); - if (packet_is_untagged(tpid)) { - int raw_packet_len = pktlen - packet_info.system_header_size; - uint32_t vid = 0; - - if ((pktlen + 4) < rx_buffer_size) { - for (idx = (raw_packet_len - 1); idx >= 12; idx--) { - eth_hdr[idx+4] = eth_hdr[idx]; - } - if (ft_vid) { - vid = ft_vid; - } - else if (packet_info.internal.forward_domain) { - vid = packet_info.internal.forward_domain & 0xfff; - } - else { - vid = 1; + /* Minimun size: header_size + MACs + VLAN + ETH_TYPE */ + if (pktlen > pkt_hdr_size + 18) { + if (device_is_sand(sinfo)) { + bkn_bitstream_set_field(sand_scratch_data, 0, 16, + packet_info.internal.trap_id); + bkn_bitstream_set_field(sand_scratch_data, 16, 16, + packet_info.internal.trap_qualifier); + bkn_bitstream_set_field(sand_scratch_data, 32, 16, + packet_info.ftmh.source_sys_port_aggregate); + bkn_bitstream_set_field(sand_scratch_data, 48, 16, + packet_info.internal.forward_domain); + bkn_bitstream_set_field(sand_scratch_data, 64, 2, + packet_info.ftmh.action_type); + + if (force_tagged) { + uint8_t *eth_hdr = pkt + pkt_hdr_size; + uint16_t tpid = 0; + + tpid = PKT_U16_GET(eth_hdr, 12); + if (packet_is_untagged(tpid)) { + int raw_packet_len = pktlen - pkt_hdr_size; + uint32_t vid = 0; + + if ((pktlen + 4) < rx_buffer_size) { + for (idx = (raw_packet_len - 1); idx >= 12; idx--) { + eth_hdr[idx+4] = eth_hdr[idx]; + } + if (ft_vid) { + vid = ft_vid; + } + else if (packet_info.internal.forward_domain) { + vid = packet_info.internal.forward_domain & + 0xfff; + } + else { + vid = 1; + } + DBG_DUNE(("add vlan tag (%d) to untagged packets\n", + vid)); + + eth_hdr[12] = (ft_tpid >> 8) & 0xff; + eth_hdr[13] = ft_tpid & 0xff; + eth_hdr[14] = (((ft_pri & 0x7) << 5) | + ((ft_cfi & 0x1) << 4) | + ((vid >> 8) & 0xf)) & 0xff; + eth_hdr[15] = vid & 0xff; + /* Reset packet length in DCB */ + pktlen += 4; + bkn_dump_pkt(pkt, pktlen, XGS_DMA_RX_CHAN); + dcb[sinfo->dcb_wsize-1] &= ~SOC_DCB_KNET_COUNT_MASK; + dcb[sinfo->dcb_wsize-1] |= pktlen & + SOC_DCB_KNET_COUNT_MASK; } - DBG_DUNE(("add vlan tag (%d) to untagged packets\n", vid)); - - eth_hdr[12] = (ft_tpid >> 8) & 0xff; - eth_hdr[13] = ft_tpid & 0xff; - eth_hdr[14] = (((ft_pri & 0x7) << 5) | ((ft_cfi & 0x1) << 4) | ((vid >> 8) & 0xf)) & 0xff; - eth_hdr[15] = vid & 0xff; - /* reset packet length in DCB */ - pktlen += 4; - bkn_dump_pkt(pkt, pktlen, XGS_DMA_RX_CHAN); - dcb[sinfo->dcb_wsize-1] &= ~SOC_DCB_KNET_COUNT_MASK; - dcb[sinfo->dcb_wsize-1] |= pktlen & SOC_DCB_KNET_COUNT_MASK; } } } - } - if (device_is_sand(sinfo)) { - filter = bkn_match_rx_pkt(sinfo, pkt + packet_info.system_header_size, - pktlen - packet_info.system_header_size, sand_scratch_data, chan, &cbf); - } else { - filter = bkn_match_rx_pkt(sinfo, pkt + sinfo->pkt_hdr_size, - pktlen - sinfo->pkt_hdr_size, meta, chan, &cbf); - } - if ((dcb[sinfo->dcb_wsize-1] & 0xf0000) != 0x30000) { - /* Fragment or error */ - if (filter && filter->kf.mask.w[err_woff] == 0) { - /* Drop unless DCB status is part of filter */ - filter = NULL; + if (device_is_sand(sinfo)) { + match_data = sand_scratch_data; + } else { + match_data = meta; + } + filter = bkn_match_rx_pkt(sinfo, pkt + pkt_hdr_size, + pktlen - pkt_hdr_size, match_data, + chan, &cbf); + + if ((dcb[sinfo->dcb_wsize-1] & 0xf0000) != 0x30000) { + /* Fragment or error */ + if (filter && filter->kf.mask.w[err_woff] == 0) { + /* Drop unless DCB status is part of filter */ + filter = NULL; + } } } drop_api = 1; @@ -3667,21 +3802,25 @@ bkn_do_api_rx(bkn_switch_info_t *sinfo, int chan, int budget) break; } - if (device_is_sand(sinfo)) { - pkt += packet_info.system_header_size; - pktlen -= packet_info.system_header_size; - } else if (sinfo->cmic_type == 'x') { - pkt += sinfo->pkt_hdr_size; - pktlen -= sinfo->pkt_hdr_size; - } + pkt += pkt_hdr_size; + pktlen -= pkt_hdr_size; /* Add 2 bytes for IP header alignment (see below) */ - skb = dev_alloc_skb(pktlen + RCPU_RX_ENCAP_SIZE + 2); - if (skb == NULL) { - sinfo->rx[chan].pkts_d_no_skb++; - break; + if (device_is_sand(sinfo)) { + skb = dev_alloc_skb(pktlen + RCPU_HDR_SIZE + pkt_hdr_size + 2); + if (skb == NULL) { + sinfo->rx[chan].pkts_d_no_skb++; + break; + } + skb_reserve(skb, RCPU_HDR_SIZE + pkt_hdr_size); + } else { + skb = dev_alloc_skb(pktlen + RCPU_RX_ENCAP_SIZE + 2); + if (skb == NULL) { + sinfo->rx[chan].pkts_d_no_skb++; + break; + } + skb_reserve(skb, RCPU_RX_ENCAP_SIZE); } - skb_reserve(skb, RCPU_RX_ENCAP_SIZE); DBG_FLTR(("Send to netif %d (%s)\n", priv->id, priv->dev->name)); @@ -3742,7 +3881,8 @@ bkn_do_api_rx(bkn_switch_info_t *sinfo, int chan, int budget) KNET_SKB_CB(skb)->netif_user_data = priv->cb_user_data; KNET_SKB_CB(skb)->filter_user_data = filter->kf.cb_user_data; if (device_is_sand(sinfo)) { - skb = knet_rx_cb(skb, sinfo->dev_no, sand_scratch_data); + skb = knet_rx_cb(skb, sinfo->dev_no, + sand_scratch_data); } else { skb = knet_rx_cb(skb, sinfo->dev_no, meta); @@ -3760,9 +3900,10 @@ bkn_do_api_rx(bkn_switch_info_t *sinfo, int chan, int budget) } if (priv->flags & KCOM_NETIF_F_RCPU_ENCAP) { - bkn_add_rcpu_encap(sinfo, skb, meta, packet_info.system_header_size); + bkn_add_rcpu_encap(sinfo, skb, meta, pkt_hdr_size); DBG_PDMP(("After add RCPU ENCAP\n")); - bkn_dump_pkt(skb->data, pktlen + RCPU_RX_ENCAP_SIZE, XGS_DMA_RX_CHAN); + bkn_dump_pkt(skb->data, pktlen + RCPU_RX_ENCAP_SIZE, + XGS_DMA_RX_CHAN); } skb->protocol = eth_type_trans(skb, skb->dev); if (filter->kf.dest_proto) { @@ -3771,8 +3912,12 @@ bkn_do_api_rx(bkn_switch_info_t *sinfo, int chan, int budget) if (priv->flags & KCOM_NETIF_F_RCPU_ENCAP) { bkn_eth_type_update(skb, ethertype); } - DBG_DUNE(("skb protocol 0x%04x\n",skb->protocol)); + DBG_DUNE(("skb protocol 0x%04x\n", skb->protocol)); + /* + * Disable configuration API while the spinlock is released. + */ + sinfo->cfg_api_locked = 1; /* Unlock while calling up network stack */ spin_unlock(&sinfo->lock); if (use_napi) { @@ -3781,6 +3926,8 @@ bkn_do_api_rx(bkn_switch_info_t *sinfo, int chan, int budget) netif_rx(skb); } spin_lock(&sinfo->lock); + /* Re-enable configuration API once spinlock is regained. */ + sinfo->cfg_api_locked = 0; if (filter->kf.mirror_type == KCOM_DEST_T_API || dbg_pkt_enable) { @@ -3817,6 +3964,84 @@ bkn_do_api_rx(bkn_switch_info_t *sinfo, int chan, int budget) return dcbs_done; } +/* + * Process skb to netif. + * Caller need to make sure dest_id is the valid net interface. + */ +static int +bkn_skb_rx_netif_process(bkn_switch_info_t *sinfo, int dest_id, int chan, + struct sk_buff *skb, bkn_filter_t *filter, + uint32 *rx_cb_meta, uint32 *meta, + int pkt_hdr_size, int pktlen, int ethertype) +{ + bkn_priv_t *priv; + + DBG_VERB(("Process SKB to netif %d\n", dest_id)); + priv = bkn_netif_lookup(sinfo, dest_id); + + if ((priv->flags & KCOM_NETIF_F_KEEP_RX_TAG) == 0) { + uint16_t vlan_proto; + + vlan_proto = PKT_U16_GET(skb->data, 12); + if ((filter->kf.flags & KCOM_FILTER_F_STRIP_TAG) == 0) { + /* + * Mark packet as VLAN-tagged, otherwise newer + * kernels will strip the tag. + */ + uint16_t tci = PKT_U16_GET(skb->data, 14); + + if (priv->flags & KCOM_NETIF_F_RCPU_ENCAP) { + bkn_vlan_hwaccel_put_tag(skb, ETH_P_8021Q, tci); + } else { + if (vlan_proto == ETH_P_8021AD) { + bkn_vlan_hwaccel_put_tag + (skb, ETH_P_8021AD, tci); + } else { + bkn_vlan_hwaccel_put_tag + (skb, ETH_P_8021Q, tci); + } + } + } + } + + priv->stats.rx_packets++; + priv->stats.rx_bytes += skb->len; + skb->dev = priv->dev; + + if (knet_rx_cb != NULL) { + KNET_SKB_CB(skb)->netif_user_data = priv->cb_user_data; + KNET_SKB_CB(skb)->filter_user_data = filter->kf.cb_user_data; + skb = knet_rx_cb(skb, sinfo->dev_no, rx_cb_meta); + if (skb == NULL) { + /* Consumed by call-back */ + sinfo->rx[chan].pkts_d_callback++; + priv->stats.rx_dropped++; + return -1; + } + } + + if (priv->flags & KCOM_NETIF_F_RCPU_ENCAP) { + bkn_add_rcpu_encap(sinfo, skb, meta, pkt_hdr_size); + DBG_PDMP(("After add RCPU ENCAP\n")); + bkn_dump_pkt(skb->data, pktlen + RCPU_RX_ENCAP_SIZE, + XGS_DMA_RX_CHAN); + } + skb->protocol = eth_type_trans(skb, skb->dev); + if (filter->kf.dest_proto) { + skb->protocol = filter->kf.dest_proto; + } + if (priv->flags & KCOM_NETIF_F_RCPU_ENCAP) { + bkn_eth_type_update(skb, ethertype); + } + DBG_DUNE(("skb protocol 0x%04x\n",skb->protocol)); + if (filter->kf.mirror_type == KCOM_DEST_T_NETIF && + filter->kf.mirror_proto) { + skb->protocol = filter->kf.mirror_proto; + } + + return 0; +} + static int bkn_do_skb_rx(bkn_switch_info_t *sinfo, int chan, int budget) { @@ -3824,17 +4049,21 @@ bkn_do_skb_rx(bkn_switch_info_t *sinfo, int chan, int budget) bkn_desc_info_t *desc; struct sk_buff *skb; bkn_filter_t cbf; - bkn_filter_t *filter; + bkn_filter_t *filter = NULL; uint32_t err_woff; - uint32_t *dcb, *meta; - int ethertype; - int pktlen; + uint32_t *dcb, *meta, *match_data; + int pktlen, pkt_hdr_size; + uint8_t skip_hdrlen = 0; + uint8_t eth_offset = 0; int idx; int dcbs_done = 0; bkn_dune_system_header_info_t packet_info = {0}; uint32_t sand_scratch_data[BKN_SAND_SCRATCH_DATA_SIZE] = {0}; - uint8_t sand_system_headers[RCPU_RX_META_SIZE] = {0}; + uint8_t sand_system_headers[RCPU_RX_META_SIZE_MAX] = {0}; uint8_t *pkt = NULL; + bkn_priv_t *mpriv; + struct sk_buff *mskb = NULL; + uint32_t *rx_cb_meta; if (!sinfo->rx[chan].running) { /* Rx not ready */ @@ -3872,11 +4101,39 @@ bkn_do_skb_rx(bkn_switch_info_t *sinfo, int chan, int budget) BKN_DMA_FROMDEV); desc->skb_dma = 0; + pktlen = dcb[sinfo->dcb_wsize-1] & 0xffff; + priv = netdev_priv(sinfo->dev); + bkn_dump_pkt(skb->data, pktlen, XGS_DMA_RX_CHAN); + if (device_is_sand(sinfo)) { err_woff = BKN_SAND_SCRATCH_DATA_SIZE - 1; sand_scratch_data[err_woff] = dcb[sinfo->dcb_wsize-1]; meta = (uint32_t *)skb->data; pkt = skb->data; + memset(&packet_info, 0, sizeof(bkn_dune_system_header_info_t)); + /* Decode system headers and fill sratch data */ + bkn_packet_header_parse(sinfo, pkt, (uint32_t)pktlen, &packet_info); + pkt_hdr_size = packet_info.system_header_size; + + + if (knet_hw_tstamp_rx_pre_process_cb) { + if ((knet_hw_tstamp_rx_pre_process_cb(sinfo->dev_no, pkt, packet_info.ftmh.source_sys_port_aggregate, NULL)) >= 0) { + skip_hdrlen = pkt_hdr_size; + sand_scratch_data[err_woff] = (pktlen - skip_hdrlen); + + meta = (uint32_t *)(skb->data + skip_hdrlen); + pkt = (skb->data + skip_hdrlen); + memset(&packet_info, 0, sizeof(bkn_dune_system_header_info_t)); + + /* Decode system headers and fill sratch data */ + bkn_packet_header_parse(sinfo, pkt, (uint32_t)(pktlen - skip_hdrlen), &packet_info); + pkt_hdr_size = packet_info.system_header_size; + + knet_hw_tstamp_rx_pre_process_cb(sinfo->dev_no, pkt + pkt_hdr_size, + packet_info.ftmh.source_sys_port_aggregate, (int *)ð_offset); + } + } + } else { if (sinfo->cmic_type == 'x') { meta = (uint32_t *)skb->data; @@ -3886,73 +4143,86 @@ bkn_do_skb_rx(bkn_switch_info_t *sinfo, int chan, int budget) meta = dcb; err_woff = sinfo->dcb_wsize - 1; } + pkt_hdr_size = sinfo->pkt_hdr_size; } - pktlen = dcb[sinfo->dcb_wsize-1] & 0xffff; - priv = netdev_priv(sinfo->dev); - bkn_dump_pkt(skb->data, pktlen, XGS_DMA_RX_CHAN); - - if (device_is_sand(sinfo)) { - memset(&packet_info, 0, sizeof(bkn_dune_system_header_info_t)); - /* decode system headers and fill sratch data */ - bkn_packet_header_parse(sinfo, pkt, (uint32_t)pktlen, &packet_info); - bkn_bitstream_set_field(sand_scratch_data, 0, 16, packet_info.internal.trap_id); - bkn_bitstream_set_field(sand_scratch_data, 16, 16, packet_info.internal.trap_qualifier); - bkn_bitstream_set_field(sand_scratch_data, 32, 16, packet_info.ftmh.source_sys_port_aggregate); - bkn_bitstream_set_field(sand_scratch_data, 48, 16, packet_info.internal.forward_domain); - bkn_bitstream_set_field(sand_scratch_data, 64, 2, packet_info.ftmh.action_type); - memcpy(sand_system_headers, pkt, - ((packet_info.system_header_size > RCPU_RX_META_SIZE) ? RCPU_RX_META_SIZE : packet_info.system_header_size)); - meta = (uint32_t *)sand_system_headers; - if (force_tagged) { - uint8_t *eth_hdr = pkt + packet_info.system_header_size; - uint16_t tpid = 0; - - tpid = PKT_U16_GET(eth_hdr, 12); - if (packet_is_untagged(tpid)) { - int raw_packet_len = pktlen - packet_info.system_header_size; - uint32_t vid = 0; - - if ((pktlen + 4) < rx_buffer_size) { - for (idx = (raw_packet_len - 1); idx >= 12; idx--) { - eth_hdr[idx+4] = eth_hdr[idx]; - } - if (ft_vid) { - vid = ft_vid; - } - else if (packet_info.internal.forward_domain) { - vid = packet_info.internal.forward_domain & 0xfff; - } - else { - vid = 1; + /* Minimun size: header_size + MACs + VLAN + ETH_TYPE */ + if (pktlen > pkt_hdr_size + 18) { + if (device_is_sand(sinfo)) { + bkn_bitstream_set_field(sand_scratch_data, 0, 16, + packet_info.internal.trap_id); + bkn_bitstream_set_field(sand_scratch_data, 16, 16, + packet_info.internal.trap_qualifier); + bkn_bitstream_set_field(sand_scratch_data, 32, 16, + packet_info.ftmh.source_sys_port_aggregate); + bkn_bitstream_set_field(sand_scratch_data, 48, 16, + packet_info.internal.forward_domain); + bkn_bitstream_set_field(sand_scratch_data, 64, 2, + packet_info.ftmh.action_type); + memcpy(sand_system_headers, pkt, + ((pkt_hdr_size > RCPU_RX_META_SIZE_MAX) ? + RCPU_RX_META_SIZE_MAX : pkt_hdr_size)); + meta = (uint32_t *)sand_system_headers; + if (force_tagged) { + uint8_t *eth_hdr = pkt + pkt_hdr_size; + uint16_t tpid = 0; + + if (skip_hdrlen > 0) { + eth_hdr += eth_offset; + } + tpid = PKT_U16_GET(eth_hdr, 12); + if (packet_is_untagged(tpid)) { + int raw_packet_len = pktlen - pkt_hdr_size; + uint32_t vid = 0; + + if ((pktlen + 4) < rx_buffer_size) { + for (idx = (raw_packet_len - 1); idx >= 12; idx--) { + eth_hdr[idx+4] = eth_hdr[idx]; + } + if (ft_vid) { + vid = ft_vid; + } + else if (packet_info.internal.forward_domain) { + vid = packet_info.internal.forward_domain & + 0xfff; + } + else { + vid = 1; + } + DBG_DUNE(("add vlan tag (%d) to untagged packets\n", + vid)); + eth_hdr[12] = (ft_tpid >> 8) & 0xff; + eth_hdr[13] = ft_tpid & 0xff; + eth_hdr[14] = (((ft_pri & 0x7) << 5) | + ((ft_cfi & 0x1) << 4) | + ((vid >> 8) & 0xf)) & 0xff; + eth_hdr[15] = vid & 0xff; + /* reset packet length in DCB */ + pktlen += 4; + bkn_dump_pkt(pkt, pktlen, XGS_DMA_RX_CHAN); + dcb[sinfo->dcb_wsize-1] &= ~SOC_DCB_KNET_COUNT_MASK; + dcb[sinfo->dcb_wsize-1] |= pktlen & + SOC_DCB_KNET_COUNT_MASK; } - DBG_DUNE(("add vlan tag (%d) to untagged packets\n", vid)); - eth_hdr[12] = (ft_tpid >> 8) & 0xff; - eth_hdr[13] = ft_tpid & 0xff; - eth_hdr[14] = (((ft_pri & 0x7) << 5) | ((ft_cfi & 0x1) << 4) | ((vid >> 8) & 0xf)) & 0xff; - eth_hdr[15] = vid & 0xff; - /* reset packet length in DCB */ - pktlen += 4; - bkn_dump_pkt(pkt, pktlen, XGS_DMA_RX_CHAN); - dcb[sinfo->dcb_wsize-1] &= ~SOC_DCB_KNET_COUNT_MASK; - dcb[sinfo->dcb_wsize-1] |= pktlen & SOC_DCB_KNET_COUNT_MASK; } } } - } - if (device_is_sand(sinfo)) { - filter = bkn_match_rx_pkt(sinfo, skb->data + packet_info.system_header_size, - pktlen - packet_info.system_header_size, sand_scratch_data, chan, &cbf); - } else { - filter = bkn_match_rx_pkt(sinfo, skb->data + sinfo->pkt_hdr_size, - pktlen - sinfo->pkt_hdr_size, meta, chan, &cbf); - } - if ((dcb[sinfo->dcb_wsize-1] & 0xf0000) != 0x30000) { - /* Fragment or error */ - priv->stats.rx_errors++; - if (filter && filter->kf.mask.w[err_woff] == 0) { - /* Drop unless DCB status is part of filter */ - filter = NULL; + if (device_is_sand(sinfo)) { + match_data = sand_scratch_data; + } else { + match_data = meta; + } + filter = bkn_match_rx_pkt(sinfo, skb->data + pkt_hdr_size + skip_hdrlen, + pktlen - pkt_hdr_size, match_data, + chan, &cbf); + + if ((dcb[sinfo->dcb_wsize-1] & 0xf0000) != 0x30000) { + /* Fragment or error */ + priv->stats.rx_errors++; + if (filter && filter->kf.mask.w[err_woff] == 0) { + /* Drop unless DCB status is part of filter */ + filter = NULL; + } } } DBG_PKT(("Rx packet (%d bytes).\n", pktlen)); @@ -3967,6 +4237,8 @@ bkn_do_skb_rx(bkn_switch_info_t *sinfo, int chan, int budget) case KCOM_DEST_T_NETIF: priv = bkn_netif_lookup(sinfo, filter->kf.dest_id); if (priv) { + int ethertype; + /* Check that software link is up */ if (!netif_carrier_ok(priv->dev)) { sinfo->rx[chan].pkts_d_no_link++; @@ -3976,9 +4248,11 @@ bkn_do_skb_rx(bkn_switch_info_t *sinfo, int chan, int budget) priv->id, priv->dev->name)); sinfo->rx[chan].pkts_f_netif++; - if ((filter->kf.mirror_type == KCOM_DEST_T_API) || dbg_pkt_enable) { + if ((filter->kf.mirror_type == KCOM_DEST_T_API) || + dbg_pkt_enable) { sinfo->rx[chan].pkts_m_api++; - bkn_api_rx_copy_from_skb(sinfo, chan, desc, priv->rx_hwts); + bkn_api_rx_copy_from_skb(sinfo, chan, desc, + priv->rx_hwts); } if (device_is_sand(sinfo)) { @@ -3988,17 +4262,18 @@ bkn_do_skb_rx(bkn_switch_info_t *sinfo, int chan, int budget) skb_put(skb, pktlen - 4); /* Strip CRC */ } - if (device_is_sand(sinfo)) { - skb_pull(skb, packet_info.system_header_size); - } else if (sinfo->cmic_type == 'x') { - skb_pull(skb, sinfo->pkt_hdr_size); - } + skb_pull(skb, (pkt_hdr_size + skip_hdrlen)); /* Optional SKB updates */ KNET_SKB_CB(skb)->dcb_type = sinfo->dcb_type & 0xFFFF; /* Do Rx timestamping */ if (priv->rx_hwts) { - bkn_hw_tstamp_rx_set(sinfo, priv->phys_port, skb, meta); + if ((bkn_hw_tstamp_rx_set(sinfo, priv->phys_port, skb, + meta)) >= 0) { + + /* Increment ptp rx counters. */ + priv->ptp_stats_rx++; + } } /* Save for RCPU before stripping tag */ @@ -4017,103 +4292,115 @@ bkn_do_skb_rx(bkn_switch_info_t *sinfo, int chan, int budget) ((u32*)skb->data)[1] = ((u32*)skb->data)[0]; skb_pull(skb, 4); if (device_is_sand(sinfo)) { - for (idx = packet_info.system_header_size; idx >= 4; idx--) { + for (idx = pkt_hdr_size; idx >= 4; idx--) { pkt[idx] = pkt[idx - 4]; } } else if (sinfo->cmic_type == 'x') { - for (idx = sinfo->pkt_hdr_size / sizeof(uint32_t); idx; idx--) { + for (idx = pkt_hdr_size / sizeof(uint32_t); + idx; idx--) { meta[idx] = meta[idx - 1]; } meta++; } } - } else { - /* - * Mark packet as VLAN-tagged, otherwise newer - * kernels will strip the tag. - */ - uint16_t tci = PKT_U16_GET(skb->data, 14); + } + } + if (device_is_sand(sinfo)) { + rx_cb_meta = sand_scratch_data; + } else { + rx_cb_meta = meta; + } - if (priv->flags & KCOM_NETIF_F_RCPU_ENCAP) { - bkn_vlan_hwaccel_put_tag(skb, ETH_P_8021Q, tci); - } else { - if (vlan_proto == ETH_P_8021AD) { - bkn_vlan_hwaccel_put_tag - (skb, ETH_P_8021AD, tci); - } else { - bkn_vlan_hwaccel_put_tag - (skb, ETH_P_8021Q, tci); + if (mirror_local) { + /* Clone skb before processing netif specific config. */ + if (filter->kf.mirror_type == KCOM_DEST_T_NETIF) { + mpriv = bkn_netif_lookup(sinfo, filter->kf.mirror_id); + /* Clone skb for mirror_to netinf */ + if (mpriv && netif_carrier_ok(mpriv->dev)) { + mskb = skb_clone(skb, GFP_ATOMIC); + if (mskb == NULL) { + sinfo->rx[chan].pkts_d_no_skb++; } } } } - priv->stats.rx_packets++; - priv->stats.rx_bytes += skb->len; - skb->dev = priv->dev; - - if (knet_rx_cb != NULL) { - KNET_SKB_CB(skb)->netif_user_data = priv->cb_user_data; - KNET_SKB_CB(skb)->filter_user_data = filter->kf.cb_user_data; - if (device_is_sand(sinfo)) { - skb = knet_rx_cb(skb, sinfo->dev_no, sand_scratch_data); - } - else { - skb = knet_rx_cb(skb, sinfo->dev_no, meta); - } - if (skb == NULL) { - /* Consumed by call-back */ - sinfo->rx[chan].pkts_d_callback++; - priv->stats.rx_dropped++; - desc->skb = NULL; - break; - } + /* Process original netif specific config. */ + if (bkn_skb_rx_netif_process(sinfo, filter->kf.dest_id, + chan, skb, filter, rx_cb_meta, + meta, pkt_hdr_size, pktlen, + ethertype)) { + desc->skb = NULL; + break; } - if (priv->flags & KCOM_NETIF_F_RCPU_ENCAP) { - bkn_add_rcpu_encap(sinfo, skb, meta, packet_info.system_header_size); - DBG_PDMP(("After add RCPU ENCAP\n")); - bkn_dump_pkt(skb->data, pktlen + RCPU_RX_ENCAP_SIZE, XGS_DMA_RX_CHAN); - } - skb->protocol = eth_type_trans(skb, skb->dev); - if (filter->kf.dest_proto) { - skb->protocol = filter->kf.dest_proto; - } - if (priv->flags & KCOM_NETIF_F_RCPU_ENCAP) { - bkn_eth_type_update(skb, ethertype); - } - DBG_DUNE(("skb protocol 0x%04x\n",skb->protocol)); - - if (filter->kf.mirror_type == KCOM_DEST_T_NETIF) { - bkn_priv_t *mpriv; - struct sk_buff *mskb; - mpriv = bkn_netif_lookup(sinfo, filter->kf.mirror_id); - if (mpriv && netif_carrier_ok(mpriv->dev)) { - mskb = skb_clone(skb, GFP_ATOMIC); - if (mskb == NULL) { - sinfo->rx[chan].pkts_d_no_skb++; - } else { - sinfo->rx[chan].pkts_m_netif++; - mpriv->stats.rx_packets++; - mpriv->stats.rx_bytes += mskb->len; - skb->dev = mpriv->dev; - if (filter->kf.mirror_proto) { - skb->protocol = filter->kf.mirror_proto; - } - /* Unlock while calling up network stack */ - spin_unlock(&sinfo->lock); - if (use_napi) { - netif_receive_skb(mskb); + if (mirror_local) { + if (mskb) { + /* Process mirorr_to netif specific config. */ + if (bkn_skb_rx_netif_process(sinfo, + filter->kf.mirror_id, + chan, mskb, filter, + rx_cb_meta, meta, + pkt_hdr_size, + pktlen, ethertype)){ + desc->skb = NULL; + break; + } + } + } else { + /* + * Clone skb processed with original netif specific + * config. + */ + /* Clone skb for mirror_to netinf */ + if (filter->kf.mirror_type == KCOM_DEST_T_NETIF) { + mpriv = bkn_netif_lookup(sinfo, filter->kf.mirror_id); + if (mpriv && netif_carrier_ok(mpriv->dev)) { + mskb = skb_clone(skb, GFP_ATOMIC); + if (mskb == NULL) { + sinfo->rx[chan].pkts_d_no_skb++; } else { - netif_rx(mskb); + mpriv->stats.rx_packets++; + mpriv->stats.rx_bytes += mskb->len; + mskb->dev = mpriv->dev; + if (filter->kf.mirror_proto) { + mskb->protocol = filter->kf.mirror_proto; + } } - spin_lock(&sinfo->lock); } } } + if (mskb) { + /* Send up to mirror_to netif */ + sinfo->rx[chan].pkts_m_netif++; + /* + * Disable configuration API while the spinlock + * is released. + */ + sinfo->cfg_api_locked = 1; + + /* Unlock while calling up network stack */ + spin_unlock(&sinfo->lock); + if (use_napi) { + netif_receive_skb(mskb); + } else { + netif_rx(mskb); + } + spin_lock(&sinfo->lock); + /* + * Re-enable configuration API once the spinlock + * is regained. + */ + sinfo->cfg_api_locked = 0; + } /* Ensure that we reallocate SKB for this DCB */ desc->skb = NULL; + /* + * Disable configuration API while the spinlock + * is released. + */ + sinfo->cfg_api_locked = 1; /* Unlock while calling up network stack */ spin_unlock(&sinfo->lock); @@ -4123,7 +4410,11 @@ bkn_do_skb_rx(bkn_switch_info_t *sinfo, int chan, int budget) netif_rx(skb); } spin_lock(&sinfo->lock); - + /* + * Re-enable configuration API once the spinlock + * is regained. + */ + sinfo->cfg_api_locked = 0; } else { DBG_FLTR(("Unknown netif %d\n", filter->kf.dest_id)); @@ -4336,7 +4627,7 @@ bkn_hw_tstamp_tx_work(struct work_struct *work) DBG_PTP(("2Step TX Timestamp fetch took long time %lld us\n", ktime_us_delta(now, skb->tstamp))); } -#else +#else DBG_PTP(("2Step TX Timestamp has not been taken for the current skb\n")); #endif } @@ -4375,7 +4666,7 @@ bkn_do_tx(bkn_switch_info_t *sinfo) (bkn_skb_tx_flags(desc->skb) & SKBTX_IN_PROGRESS)) { if (bkn_hw_tstamp_tx_set(sinfo, desc->skb) < 0) { - gprintk("Timestamp has not been taken for the current skb.\n"); + DBG_PTP(("1Step timestamp has not been taken for the current skb.\n")); } bkn_skb_tx_flags(desc->skb) &= ~SKBTX_IN_PROGRESS; } @@ -4649,6 +4940,9 @@ bkn_schedule_napi_poll(bkn_switch_info_t *sinfo) DBG_NAPI(("Schedule NAPI poll on %s.\n", sinfo->dev->name)); /* Disable interrupts until poll job is complete */ sinfo->napi_poll_mode = 1; + + /* Disable configuration API while the spinlock is released. */ + sinfo->cfg_api_locked = 1; /* Unlock while calling up network stack */ spin_unlock(&sinfo->lock); if (bkn_napi_schedule_prep(sinfo->dev, &sinfo->napi)) { @@ -4659,15 +4953,21 @@ bkn_schedule_napi_poll(bkn_switch_info_t *sinfo) gprintk("Warning: Unable to schedule NAPI - base device not up?\n"); } spin_lock(&sinfo->lock); + /* Re-enable configuration API once spinlock is regained. */ + sinfo->cfg_api_locked = 0; } static void bkn_napi_poll_complete(bkn_switch_info_t *sinfo) { + /* Disable configuration API while the spinlock is released. */ + sinfo->cfg_api_locked = 1; /* Unlock while calling up network stack */ spin_unlock(&sinfo->lock); bkn_napi_complete(sinfo->dev, &sinfo->napi); spin_lock(&sinfo->lock); + /* Re-enable configuration API once spinlock is regained. */ + sinfo->cfg_api_locked = 0; /* Re-enable interrupts */ sinfo->napi_poll_mode = 0; dev_irq_mask_set(sinfo, sinfo->irq_mask); @@ -4680,10 +4980,15 @@ xgs_do_dma(bkn_switch_info_t *sinfo, int budget) int chan_done, budget_chans = 0; uint32_t dma_stat; int chan; + int unet_chans = 0; DEV_READ32(sinfo, CMIC_DMA_STATr, &dma_stat); for (chan = 0; chan < sinfo->rx_chans; chan++) { + if (UNET_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + unet_chans++; + continue; + } if (dma_stat & DS_DESC_DONE_TST(XGS_DMA_RX_CHAN + chan)) { xgs_dma_desc_clear(sinfo, XGS_DMA_RX_CHAN + chan); sinfo->poll_channels |= 1 << chan; @@ -4691,7 +4996,10 @@ xgs_do_dma(bkn_switch_info_t *sinfo, int budget) } if (!sinfo->poll_channels) { sinfo->poll_channels = (uint32_t)(1 << sinfo->rx_chans) - 1; - budget_chans = budget / sinfo->rx_chans; + sinfo->poll_channels &= ~(sinfo->unet_channels >> 1); + if (sinfo->rx_chans > unet_chans) { + budget_chans = budget / (sinfo->rx_chans - unet_chans); + } } else { for (chan = 0; chan < sinfo->rx_chans; chan++) { if (1 << chan & sinfo->poll_channels) { @@ -4712,6 +5020,9 @@ xgs_do_dma(bkn_switch_info_t *sinfo, int budget) } if (dma_stat & DS_CHAIN_DONE_TST(XGS_DMA_RX_CHAN + chan)) { + if (UNET_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + continue; + } xgs_dma_chain_clear(sinfo, XGS_DMA_RX_CHAN + chan); bkn_rx_chain_done(sinfo, chan); } @@ -4733,6 +5044,7 @@ xgsm_do_dma(bkn_switch_info_t *sinfo, int budget) int chan_done, budget_chans = 0; uint32_t dma_stat, irq_stat = 0; int chan; + int unet_chans = 0; /* Get Controlled interrupt states for Continuous DMA mode */ if (sinfo->cdma_channels) { @@ -4742,6 +5054,10 @@ xgsm_do_dma(bkn_switch_info_t *sinfo, int budget) DEV_READ32(sinfo, CMICM_DMA_STATr, &dma_stat); for (chan = 0; chan < sinfo->rx_chans; chan++) { + if (UNET_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + unet_chans++; + continue; + } if (dma_stat & (0x10 << (XGS_DMA_RX_CHAN + chan)) || irq_stat & (0x08000000 << (XGS_DMA_RX_CHAN + chan))) { xgsm_dma_desc_clear(sinfo, XGS_DMA_RX_CHAN + chan); @@ -4750,7 +5066,10 @@ xgsm_do_dma(bkn_switch_info_t *sinfo, int budget) } if (!sinfo->poll_channels) { sinfo->poll_channels = (uint32_t)(1 << sinfo->rx_chans) - 1; - budget_chans = budget / sinfo->rx_chans; + sinfo->poll_channels &= ~(sinfo->unet_channels >> 1); + if (sinfo->rx_chans > unet_chans) { + budget_chans = budget / (sinfo->rx_chans - unet_chans); + } } else { for (chan = 0; chan < sinfo->rx_chans; chan++) { if (1 << chan & sinfo->poll_channels) { @@ -4775,6 +5094,9 @@ xgsm_do_dma(bkn_switch_info_t *sinfo, int budget) } if (dma_stat & (0x1 << (XGS_DMA_RX_CHAN + chan))) { + if (UNET_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + continue; + } xgsm_dma_chain_clear(sinfo, XGS_DMA_RX_CHAN + chan); bkn_rx_chain_done(sinfo, chan); } @@ -4801,16 +5123,24 @@ xgsx_do_dma(bkn_switch_info_t *sinfo, int budget) int chan_done, budget_chans = 0; uint32_t irq_stat, tx_dma_stat, rx_dma_stat[NUM_CMICX_RX_CHAN]; int chan; + int unet_chans = 0; DEV_READ32(sinfo, CMICX_IRQ_STATr, &irq_stat); DEV_READ32(sinfo, CMICX_DMA_STATr + 0x80 * XGS_DMA_TX_CHAN, &tx_dma_stat); for (chan = 0; chan < sinfo->rx_chans; chan++) { + if (UNET_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + unet_chans++; + continue; + } DEV_READ32(sinfo, CMICX_DMA_STATr + 0x80 * (XGS_DMA_RX_CHAN + chan), &rx_dma_stat[chan]); } for (chan = 0; chan < sinfo->rx_chans; chan++) { + if (UNET_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + continue; + } if ((irq_stat & CMICX_DS_CMC_CTRLD_INT(XGS_DMA_RX_CHAN + chan)) || (irq_stat & CMICX_DS_CMC_DESC_DONE(XGS_DMA_RX_CHAN + chan))) { xgsx_dma_desc_clear(sinfo, XGS_DMA_RX_CHAN + chan); @@ -4819,14 +5149,19 @@ xgsx_do_dma(bkn_switch_info_t *sinfo, int budget) } if (!sinfo->poll_channels) { sinfo->poll_channels = (uint32_t)(1 << sinfo->rx_chans) - 1; - budget_chans = budget / sinfo->rx_chans; + sinfo->poll_channels &= ~(sinfo->unet_channels >> 1); + if (sinfo->rx_chans > unet_chans) { + budget_chans = budget / (sinfo->rx_chans - unet_chans); + } } else { for (chan = 0; chan < sinfo->rx_chans; chan++) { if (1 << chan & sinfo->poll_channels) { budget_chans++; } } - budget_chans = budget / budget_chans; + if (budget_chans) { + budget_chans = budget / budget_chans; + } } for (chan = 0; chan < sinfo->rx_chans; chan++) { @@ -4844,6 +5179,9 @@ xgsx_do_dma(bkn_switch_info_t *sinfo, int budget) } if (rx_dma_stat[chan] & CMICX_DS_CMC_DMA_CHAIN_DONE) { + if (UNET_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + continue; + } xgsx_dma_chain_clear(sinfo, XGS_DMA_RX_CHAN + chan); bkn_rx_chain_done(sinfo, chan); } @@ -5044,6 +5382,9 @@ bkn_resume_rx(bkn_switch_info_t *sinfo) /* Resume Rx DMA on all channels */ for (chan = 0; chan < sinfo->rx_chans; chan++) { + if (UNET_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + continue; + } if (sinfo->rx[chan].use_rx_skb) { cdma_running = 0; bkn_api_rx_restart(sinfo, chan); @@ -5132,17 +5473,32 @@ bkn_set_mac_address(struct net_device *dev, void *addr) static int bkn_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { - bkn_priv_t *priv = netdev_priv(dev); - bkn_switch_info_t *sinfo = priv->sinfo; + bkn_priv_t *priv; + bkn_switch_info_t *sinfo; struct hwtstamp_config config; + DBG_PTP(("bkn_ioctl: module_initialized:%d\n", module_initialized)); + + if (!module_initialized) { + return -EINVAL; + } + + if (!dev) + return -EINVAL; + + priv = netdev_priv(dev); + + if (!priv) + return -EINVAL; + + sinfo = priv->sinfo; + if (cmd == SIOCSHWTSTAMP) { if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) { return -EFAULT; } - if (!knet_hw_tstamp_enable_cb || !knet_hw_tstamp_disable_cb || - priv->type != KCOM_NETIF_T_PORT) { + if (!knet_hw_tstamp_enable_cb || !knet_hw_tstamp_disable_cb) { return -ENOSYS; } @@ -5345,6 +5701,8 @@ bkn_hw_tstamp_tx_config(bkn_switch_info_t *sinfo, } switch (sinfo->dcb_type) { + case 28: /* dpp */ + break; case 26: case 32: case 33: @@ -5380,7 +5738,7 @@ bkn_tx(struct sk_buff *skb, struct net_device *dev) uint16_t tpid; uint32_t *metadata; unsigned long flags; - uint32_t cpu_channel = 0; + uint8_t cpu_channel = 0; int headroom, tailroom; DBG_VERB(("Netif Tx: Len=%d priv->id=%d\n", skb->len, priv->id)); @@ -5417,6 +5775,14 @@ bkn_tx(struct sk_buff *skb, struct net_device *dev) if (device_is_sand(sinfo)) { hdrlen = priv->system_headers_size; + + /* Account for extra OAM-TS header. */ + if ((bkn_skb_tx_flags(skb) & SKBTX_HW_TSTAMP) && + (hdrlen > (BKN_DNX_PTCH_2_SIZE))) { + /* T_LOCAL_PORT intf will use PTCH_2 + ITMH */ + hdrlen += BKN_DPP_OTSH_SIZE_BYTE; + } + } else { hdrlen = (sinfo->cmic_type == 'x' ) ? PKT_TX_HDR_SIZE : 0; @@ -5447,8 +5813,8 @@ bkn_tx(struct sk_buff *skb, struct net_device *dev) if (device_is_sand(sinfo)) { /* Dune devices don't use meta data */ sop = 0; - /* Get CPU channel from rcpu_hdr_t.reserved */ - cpu_channel = (skb->data[28] << 24) | (skb->data[29] << 16) | (skb->data[30] << 8) | (skb->data[31]); + /* Get CPU channel from RCPU.cpu_channel */ + cpu_channel = skb->data[29]; /* System headers are supposed to be set by users in RCPU mode. */ hdrlen = 0; } else if (skb->data[21] & RCPU_F_MODHDR) { @@ -5468,6 +5834,14 @@ bkn_tx(struct sk_buff *skb, struct net_device *dev) return 0; } if (sinfo->cmic_type != 'x') { + if (skb->len < (rcpulen + RCPU_TX_META_SIZE + 14)) { + DBG_WARN(("Tx drop: Invalid RCPU encapsulation\n")); + priv->stats.tx_dropped++; + sinfo->tx.pkts_d_rcpu_encap++; + dev_kfree_skb_any(skb); + spin_unlock_irqrestore(&sinfo->lock, flags); + return 0; + } rcpulen += RCPU_TX_META_SIZE; } } @@ -5847,7 +6221,7 @@ bkn_tx(struct sk_buff *skb, struct net_device *dev) if ((priv->port >= 0) && (priv->tx_hwts & HWTSTAMP_TX_ON)) { /* TwoStep Processing of ptp-packets */ KNET_SKB_CB(skb)->port = priv->phys_port; - bkn_hw_tstamp_tx_config(sinfo, priv->tx_hwts, PKT_TX_HDR_SIZE, skb, meta); + bkn_hw_tstamp_tx_config(sinfo, priv->tx_hwts, hdrlen, skb, meta); bkn_skb_tx_flags(skb) |= SKBTX_IN_PROGRESS; bkn_skb_tx_timestamp(skb); @@ -5857,7 +6231,7 @@ bkn_tx(struct sk_buff *skb, struct net_device *dev) /* OneStep Processing of ptp-packets */ KNET_SKB_CB(skb)->port = priv->phys_port; KNET_SKB_CB(skb)->ts = 0; - bkn_hw_tstamp_tx_config(sinfo, priv->tx_hwts, PKT_TX_HDR_SIZE, skb, + bkn_hw_tstamp_tx_config(sinfo, priv->tx_hwts, hdrlen, skb, ((priv->port >= 0) ? meta : NULL)); if (KNET_SKB_CB(skb)->ts != 0) { @@ -5866,6 +6240,9 @@ bkn_tx(struct sk_buff *skb, struct net_device *dev) } } + + /* Increment ptp tx counters. */ + priv->ptp_stats_tx++; } /* Prepare for DMA */ @@ -5954,6 +6331,9 @@ bkn_timer_func(bkn_switch_info_t *sinfo) restart_timer = 0; for (chan = 0; chan < sinfo->rx_chans; chan++) { + if (UNET_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + continue; + } /* Restart channel if not running */ if (sinfo->rx[chan].running == 0) { bkn_rx_refill(sinfo, chan); @@ -6037,6 +6417,9 @@ bkn_rxtick_func(bkn_switch_info_t *sinfo) /* For debug purposes we maintain a rough actual packet rate */ if (++sinfo->rxticks >= sinfo->rxticks_per_sec) { for (chan = 0; chan < sinfo->rx_chans; chan++) { + if (UNET_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + continue; + } pkt_diff = sinfo->rx[chan].pkts - sinfo->rx[chan].pkts_ref; cur_jif = jiffies; ticks = cur_jif - sinfo->rx[chan].rate_jif; @@ -6049,6 +6432,9 @@ bkn_rxtick_func(bkn_switch_info_t *sinfo) /* Update tokens for Rx rate control */ for (chan = 0; chan < sinfo->rx_chans; chan++) { + if (UNET_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + continue; + } if (sinfo->rx[chan].tokens < sinfo->rx[chan].burst_max) { bkn_rx_add_tokens(sinfo, chan); } @@ -6154,6 +6540,8 @@ bkn_create_sinfo(int dev_no) sinfo->inst_id = INVALID_INSTANCE_ID; sinfo->evt_idx = -1; + /* Allow configuration process to get lock. */ + sinfo->cfg_api_locked = 0; spin_lock_init(&sinfo->lock); skb_queue_head_init(&sinfo->tx_ptp_queue); INIT_WORK(&sinfo->tx_ptp_work, bkn_hw_tstamp_tx_work); @@ -6226,6 +6614,12 @@ static const struct net_device_ops bkn_netdev_ops = { static void bkn_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo) { + DBG_PTP(("bkn_get_drv_info: module_initialized:%d\n", module_initialized)); + + if (!module_initialized) { + return; + } + strlcpy(drvinfo->driver, "bcm-knet", sizeof(drvinfo->driver)); snprintf(drvinfo->version, sizeof(drvinfo->version), "%d", KCOM_VERSION); strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); @@ -6236,10 +6630,30 @@ bkn_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo) static int bkn_get_ts_info(struct net_device *dev, struct ethtool_ts_info *info) { - bkn_priv_t *priv = netdev_priv(dev); - bkn_switch_info_t *sinfo = priv->sinfo; + bkn_priv_t *priv; + bkn_switch_info_t *sinfo; + + DBG_PTP(("bkn_get_ts_info: module_initialized:%d\n", module_initialized)); + + if (!module_initialized) { + return -EINVAL; + } + + if (!dev) + return -EINVAL; + + priv = netdev_priv(dev); + + if (!priv) + return -EINVAL; + + sinfo = priv->sinfo; + + if (!sinfo) + return -EINVAL; switch (sinfo->dcb_type) { + case 28: /* dpp */ case 26: case 32: case 33: @@ -6340,7 +6754,6 @@ bkn_init_ndev(u8 *mac, char *name) if (dev->mtu == 0) { dev->mtu = rx_buffer_size; } - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) dev->min_mtu = 68; dev->max_mtu = rx_buffer_size; @@ -6494,13 +6907,13 @@ bkn_proc_link_write(struct file *file, const char *buf, return count; } -struct file_operations bkn_proc_link_file_ops = { - owner: THIS_MODULE, - open: bkn_proc_link_open, - read: seq_read, - llseek: seq_lseek, - write: bkn_proc_link_write, - release: single_release, +struct proc_ops bkn_proc_link_file_ops = { + PROC_OWNER(THIS_MODULE) + .proc_open = bkn_proc_link_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = bkn_proc_link_write, + .proc_release = single_release, }; /* @@ -6519,6 +6932,9 @@ bkn_proc_rate_show(struct seq_file *m, void *v) seq_printf(m, "Rate control (unit %d):\n", unit); for (chan = 0; chan < sinfo->rx_chans; chan++) { + if (UNET_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + continue; + } seq_printf(m, " Rx%d max rate %8u\n", chan, sinfo->rx[chan].rate_max); seq_printf(m, " Rx%d max burst %8u\n", @@ -6601,13 +7017,13 @@ bkn_proc_rate_write(struct file *file, const char *buf, return count; } -struct file_operations bkn_proc_rate_file_ops = { - owner: THIS_MODULE, - open: bkn_proc_rate_open, - read: seq_read, - llseek: seq_lseek, - write: bkn_proc_rate_write, - release: single_release, +struct proc_ops bkn_proc_rate_file_ops = { + PROC_OWNER(THIS_MODULE) + .proc_open = bkn_proc_rate_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = bkn_proc_rate_write, + .proc_release = single_release, }; /* @@ -6851,12 +7267,12 @@ bkn_seq_dma_open(struct inode *inode, struct file *file) return seq_open(file, &bkn_seq_dma_ops); }; -static struct file_operations bkn_seq_dma_file_ops = { - .owner = THIS_MODULE, - .open = bkn_seq_dma_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release +static struct proc_ops bkn_seq_dma_file_ops = { + PROC_OWNER(THIS_MODULE) + .proc_open = bkn_seq_dma_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_release = seq_release }; /* @@ -6961,6 +7377,7 @@ bkn_proc_debug_show(struct seq_file *m, void *v) seq_printf(m, " pkt_hdr_size: %d\n", sinfo->pkt_hdr_size); seq_printf(m, " rx_chans: %d\n", sinfo->rx_chans); seq_printf(m, " cdma_chans: 0x%x\n", sinfo->cdma_channels); + seq_printf(m, " unet_chans: 0x%x\n", sinfo->unet_channels); seq_printf(m, " irq_mask: 0x%x\n", sinfo->irq_mask); seq_printf(m, " dma_events: 0x%x\n", sinfo->dma_events); seq_printf(m, " dcb_dma: 0x%p\n", (void *)(sal_paddr_t)sinfo->dcb_dma); @@ -6969,6 +7386,12 @@ bkn_proc_debug_show(struct seq_file *m, void *v) seq_printf(m, " napi_poll_mode: %d\n", sinfo->napi_poll_mode); seq_printf(m, " inst_id: 0x%x\n", sinfo->inst_id); seq_printf(m, " evt_queue: %d\n", sinfo->evt_idx); + seq_printf(m, " oamp_port_num: %d {%d, %d, %d, %d}\n", + sinfo->oamp_port_number, + sinfo->oamp_ports[0], + sinfo->oamp_ports[1], + sinfo->oamp_ports[2], + sinfo->oamp_ports[3]); unit++; } @@ -6981,13 +7404,13 @@ static int bkn_proc_debug_open(struct inode * inode, struct file * file) return single_open(file, bkn_proc_debug_show, NULL); } -struct file_operations bkn_proc_debug_file_ops = { - owner: THIS_MODULE, - open: bkn_proc_debug_open, - read: seq_read, - llseek: seq_lseek, - write: bkn_proc_debug_write, - release: single_release, +struct proc_ops bkn_proc_debug_file_ops = { + PROC_OWNER(THIS_MODULE) + .proc_open = bkn_proc_debug_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = bkn_proc_debug_write, + .proc_release = single_release, }; /* @@ -7110,15 +7533,16 @@ bkn_proc_stats_write(struct file *file, const char *buf, return count; } -struct file_operations bkn_proc_stats_file_ops = { - owner: THIS_MODULE, - open: bkn_proc_stats_open, - read: seq_read, - llseek: seq_lseek, - write: bkn_proc_stats_write, - release: single_release, +struct proc_ops bkn_proc_stats_file_ops = { + PROC_OWNER(THIS_MODULE) + .proc_open = bkn_proc_stats_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = bkn_proc_stats_write, + .proc_release = single_release, }; + /* * Device Debug Statistics Proc Entry */ @@ -7286,15 +7710,124 @@ bkn_proc_dstats_write(struct file *file, const char *buf, return count; } -struct file_operations bkn_proc_dstats_file_ops = { - owner: THIS_MODULE, - open: bkn_proc_dstats_open, - read: seq_read, - llseek: seq_lseek, - write: bkn_proc_dstats_write, - release: single_release, +struct proc_ops bkn_proc_dstats_file_ops = { + PROC_OWNER(THIS_MODULE) + .proc_open = bkn_proc_dstats_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = bkn_proc_dstats_write, + .proc_release = single_release, +}; + +/* + * PTP Statistics Proc Entry + */ +static int +bkn_proc_ptp_stats_show(struct seq_file *m, void *v) +{ + int unit = 0; + struct list_head *list, *dlist; + bkn_switch_info_t *sinfo; + bkn_priv_t *priv; + struct net_device *dev; + int print_hdr_done = 0; + + + list_for_each(list, &_sinfo_list) { + sinfo = (bkn_switch_info_t *)list; + list_for_each(dlist, &sinfo->ndev_list) { + priv = (bkn_priv_t *)dlist; + dev = priv->dev; + if (dev) { + if (priv->tx_hwts || priv->rx_hwts) { + if (!print_hdr_done) { + seq_printf(m, "PTP message stats (unit %d):\n", unit); + seq_printf(m, " %-10s| %8s| %12s| %12s| %8s| %8s\n", + "intf", "phc_type", "tx_pkts", "rx_pkts", "tx_hwts", "rx_hwts"); + seq_printf(m, "======================================================================\n"); + print_hdr_done = 1; + } + seq_printf(m, " %-10s| %8s| %12d| %12d| %8d| %8d\n", + dev->name, (priv->tx_hwts & HWTSTAMP_TX_ONESTEP_SYNC ? "1-step": "2-step"), + priv->ptp_stats_tx, priv->ptp_stats_rx, + priv->tx_hwts, priv->rx_hwts); + } + } + } + + unit++; + } + return 0; +} + +static int bkn_proc_ptp_stats_open(struct inode * inode, struct file * file) +{ + return single_open(file, bkn_proc_ptp_stats_show, NULL); +} + +/* + * PTP Statistics Proc Write Entry + * + * Where corresponds to the debug module parameter. + * + * Examples: + * clear + */ +static ssize_t +bkn_proc_ptp_stats_write(struct file *file, const char *buf, size_t count, loff_t *loff) +{ + struct list_head *list, *dlist; + bkn_switch_info_t *sinfo; + bkn_priv_t *priv; + struct net_device *dev; + char debug_str[40]; + char *ptr; + int clear_mask; + + if (count > sizeof(debug_str)) { + count = sizeof(debug_str) - 1; + debug_str[count] = '\0'; + } + if (copy_from_user(debug_str, buf, count)) { + return -EFAULT; + } + + clear_mask = 0; + if ((ptr = strstr(debug_str, "clear")) != NULL) { + clear_mask = ~0; + } else { + gprintk("Warning: unknown configuration setting\n"); + } + + if (clear_mask) { + + list_for_each(list, &_sinfo_list) { + sinfo = (bkn_switch_info_t *)list; + list_for_each(dlist, &sinfo->ndev_list) { + priv = (bkn_priv_t *)dlist; + dev = priv->dev; + if (dev) { + priv->ptp_stats_rx = 0; + priv->ptp_stats_tx = 0; + } + } + + } + } + + return count; +} + +struct proc_ops bkn_proc_ptp_stats_file_ops = { + PROC_OWNER(THIS_MODULE) + .proc_open = bkn_proc_ptp_stats_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = bkn_proc_ptp_stats_write, + .proc_release = single_release, }; + static int bkn_proc_init(void) { @@ -7324,6 +7857,10 @@ bkn_proc_init(void) if (entry == NULL) { return -1; } + PROC_CREATE(entry, "ptp_stats", 0666, bkn_proc_root, &bkn_proc_ptp_stats_file_ops); + if (entry == NULL) { + return -1; + } return 0; } @@ -7337,6 +7874,7 @@ bkn_proc_cleanup(void) remove_proc_entry("debug", bkn_proc_root); remove_proc_entry("stats", bkn_proc_root); remove_proc_entry("dstats", bkn_proc_root); + remove_proc_entry("ptp_stats", bkn_proc_root); return 0; } @@ -7370,6 +7908,11 @@ bkn_knet_dma_info(kcom_msg_dma_info_t *kmsg, int len) return sizeof(kcom_msg_hdr_t); } + if (kmsg->dma_info.cnt < 1 || kmsg->dma_info.data.dcb_start == 0) { + kmsg->hdr.status = KCOM_E_PARAM; + return sizeof(kcom_msg_hdr_t); + } + dcb_chain = kmalloc(sizeof(*dcb_chain), GFP_KERNEL); if (dcb_chain == NULL) { gprintk("Fatal error: No memory for dcb_chain\n"); @@ -7435,7 +7978,7 @@ bkn_knet_dma_info(kcom_msg_dma_info_t *kmsg, int len) spin_lock_irqsave(&sinfo->lock, flags); chan = kmsg->dma_info.chan - 1; - if ((chan < 0) || (chan > sinfo->rx_chans)) { + if ((chan < 0) || (chan > sinfo->rx_chans) || UNET_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { gprintk("Invalid RX DMA channel specified: %d\n", kmsg->dma_info.chan); kmsg->hdr.status = KCOM_E_PARAM; @@ -7621,6 +8164,30 @@ bkn_knet_version(kcom_msg_version_t *kmsg, int len) return sizeof(kcom_msg_version_t); } +/* + * Get lock when sinfo->cfg_api_locked is not set. + * This is used for protecting the resource which should not be freed/destroyed + * when KNET functions temporarily release lock for calling outside functions. + */ +static inline void +cfg_api_lock(bkn_switch_info_t *sinfo, unsigned long *flags) +{ + spin_lock_irqsave(&sinfo->lock, *flags); + while (sinfo->cfg_api_locked) { + spin_unlock_irqrestore(&sinfo->lock, *flags); + while (sinfo->cfg_api_locked) { + schedule(); + } + spin_lock_irqsave(&sinfo->lock, *flags); + } +} + +static inline void +cfg_api_unlock(bkn_switch_info_t *sinfo, unsigned long *flags) +{ + spin_unlock_irqrestore(&sinfo->lock, *flags); +} + static int bkn_knet_hw_reset(kcom_msg_hw_reset_t *kmsg, int len) { @@ -7636,7 +8203,7 @@ bkn_knet_hw_reset(kcom_msg_hw_reset_t *kmsg, int len) return sizeof(kcom_msg_hdr_t); } - spin_lock_irqsave(&sinfo->lock, flags); + cfg_api_lock(sinfo, &flags); if (kmsg->channels == 0) { /* Clean all if no channels specified */ @@ -7650,6 +8217,9 @@ bkn_knet_hw_reset(kcom_msg_hw_reset_t *kmsg, int len) skb_queue_purge(&sinfo->tx_ptp_queue); } for (chan = 0; chan < sinfo->rx_chans; chan++) { + if (UNET_CH(sinfo, XGS_DMA_RX_CHAN + chan)) { + continue; + } if (kmsg->channels & (1 << (XGS_DMA_RX_CHAN + chan))) { bkn_dma_abort_rx(sinfo, chan); bkn_clean_rx_dcbs(sinfo, chan); @@ -7657,7 +8227,7 @@ bkn_knet_hw_reset(kcom_msg_hw_reset_t *kmsg, int len) } } - spin_unlock_irqrestore(&sinfo->lock, flags); + cfg_api_unlock(sinfo, &flags); return sizeof(kcom_msg_hdr_t); } @@ -7679,7 +8249,14 @@ bkn_knet_hw_init(kcom_msg_hw_init_t *kmsg, int len) return sizeof(kcom_msg_hdr_t); } - spin_lock_irqsave(&sinfo->lock, flags); + if ((kmsg->cmic_type == 'x' && kmsg->dcb_size < CMICX_DCB_SIZE_MIN) || + (kmsg->cmic_type != 'x' && kmsg->dcb_size < DCB_SIZE_MIN) || + (kmsg->dcb_type != 39 && kmsg->cmic_type == 'x' && kmsg->pkt_hdr_size < CMICX_PKT_HDR_SIZE_MIN)) { + kmsg->hdr.status = KCOM_E_PARAM; + return sizeof(kcom_msg_hdr_t); + } + + cfg_api_lock(sinfo, &flags); sinfo->cmic_type = kmsg->cmic_type; sinfo->dcb_type = kmsg->dcb_type; @@ -7695,14 +8272,18 @@ bkn_knet_hw_init(kcom_msg_hw_init_t *kmsg, int len) sinfo->cmic_type, sinfo->dcb_type, sinfo->dcb_wsize, sinfo->dma_hi, sinfo->pkt_hdr_size)); + /* Config user network channels */ + sinfo->unet_channels = kmsg->unet_channels & ~(~0 << (sinfo->rx_chans + 1)); + /* Config Continuous DMA mode */ sinfo->cdma_channels = kmsg->cdma_channels & ~(~0 << (sinfo->rx_chans + 1)); + sinfo->cdma_channels = sinfo->cdma_channels & ~(sinfo->unet_channels); /* Ensure 32-bit PCI DMA is mapped properly on 64-bit platforms */ dev_type = kernel_bde->get_dev_type(sinfo->dev_no); if (dev_type & BDE_PCI_DEV_TYPE && sinfo->cmic_type != 'x') { if (pci_set_dma_mask(sinfo->pdev, 0xffffffff)) { - spin_unlock_irqrestore(&sinfo->lock, flags); + cfg_api_unlock(sinfo, &flags); gprintk("No suitable DMA available for SKBs\n"); kmsg->hdr.status = KCOM_E_RESOURCE; return sizeof(kcom_msg_hdr_t); @@ -7712,7 +8293,7 @@ bkn_knet_hw_init(kcom_msg_hw_init_t *kmsg, int len) /* First time called we need to allocate DCBs */ if (sinfo->dcb_mem == NULL) { if (bkn_alloc_dcbs(sinfo) < 0) { - spin_unlock_irqrestore(&sinfo->lock, flags); + cfg_api_unlock(sinfo, &flags); kmsg->hdr.status = KCOM_E_RESOURCE; return sizeof(kcom_msg_hdr_t); } @@ -7761,7 +8342,57 @@ bkn_knet_hw_init(kcom_msg_hw_init_t *kmsg, int len) bkn_dma_init(sinfo); - spin_unlock_irqrestore(&sinfo->lock, flags); + cfg_api_unlock(sinfo, &flags); + + return sizeof(kcom_msg_hdr_t); +} + +static int +bkn_knet_hw_info(kcom_msg_hw_info_t *kmsg, int len) +{ + bkn_switch_info_t *sinfo; + unsigned long flags; + int idx = 0; + + kmsg->hdr.type = KCOM_MSG_TYPE_RSP; + + DBG_KCOM(("HW INFO:-OAMP: %d {%d, %d, %d, %d}\n", + kmsg->oamp_info.oamp_port_number, + kmsg->oamp_info.oamp_ports[0], + kmsg->oamp_info.oamp_ports[1], + kmsg->oamp_info.oamp_ports[2], + kmsg->oamp_info.oamp_ports[3])); + + sinfo = bkn_sinfo_from_unit(kmsg->hdr.unit); + if (sinfo == NULL) { + kmsg->hdr.status = KCOM_E_PARAM; + return sizeof(kcom_msg_hdr_t); + } + + cfg_api_lock(sinfo, &flags); + + if (device_is_sand(sinfo)) { + if (kmsg->oamp_info.oamp_port_number > KCOM_HW_INFO_OAMP_PORT_MAX) + { + cfg_api_unlock(sinfo, &flags); + gprintk("Number of OAMP ports(%d) is greater than the maximum value allowed(%d)\n", + kmsg->oamp_info.oamp_port_number, + KCOM_HW_INFO_OAMP_PORT_MAX); + kmsg->hdr.status = KCOM_E_PARAM; + return sizeof(kcom_msg_hdr_t); + } + sinfo->oamp_port_number = kmsg->oamp_info.oamp_port_number; + for (idx = 0; idx < sinfo->oamp_port_number; idx++) { + sinfo->oamp_ports[idx] = kmsg->oamp_info.oamp_ports[idx]; + } + + for (idx = 0; idx < sinfo->oamp_port_number; idx++) { + DBG_DUNE(("DNX OAMP ports [%d/%d]: %d\n", + idx, sinfo->oamp_port_number, sinfo->oamp_ports[idx])); + } + } + + cfg_api_unlock(sinfo, &flags); return sizeof(kcom_msg_hdr_t); } @@ -7780,7 +8411,7 @@ bkn_knet_detach(kcom_msg_detach_t *kmsg, int len) return sizeof(kcom_msg_hdr_t); } - spin_lock_irqsave(&sinfo->lock, flags); + cfg_api_lock(sinfo, &flags); if (sinfo->evt_idx != -1) { /* Create dummy event to unblock pending IOCTL */ sinfo->dma_events |= KCOM_DMA_INFO_F_TX_DONE; @@ -7788,7 +8419,7 @@ bkn_knet_detach(kcom_msg_detach_t *kmsg, int len) evt->evt_wq_put++; wake_up_interruptible(&evt->evt_wq); } - spin_unlock_irqrestore(&sinfo->lock, flags); + cfg_api_unlock(sinfo, &flags); /* Ensure that we return a valid unit number */ kmsg->hdr.unit = sinfo->dev_no; @@ -7838,6 +8469,15 @@ bkn_knet_netif_create(kcom_msg_netif_create_t *kmsg, int len) kmsg->hdr.status = KCOM_E_PARAM; return sizeof(kcom_msg_hdr_t); } + if (device_is_sand(sinfo) && + kmsg->netif.system_headers_size > KCOM_NETIF_SYSTEM_HEADERS_SIZE_MAX) { + DBG_WARN(("The system_headers_size %d is beyond the maximum size %d. n", + kmsg->netif.system_headers_size, + KCOM_NETIF_SYSTEM_HEADERS_SIZE_MAX)); + kmsg->hdr.status = KCOM_E_PARAM; + return sizeof(kcom_msg_hdr_t); + } + ma = kmsg->netif.macaddr; if ((ma[0] | ma[1] | ma[2] | ma[3] | ma[4] | ma[5]) == 0) { bkn_dev_mac[5]++; @@ -7855,11 +8495,11 @@ bkn_knet_netif_create(kcom_msg_netif_create_t *kmsg, int len) /* System headers are prepared at BCM API for Dune headers */ if (device_is_sand(sinfo)) { int idx = 0; - for (idx = 0; idx < KCOM_NETIF_SYSTEM_HEADERS_SIZE_MAX; idx++) + priv->system_headers_size = kmsg->netif.system_headers_size; + for (idx = 0; idx < priv->system_headers_size; idx++) { priv->system_headers[idx] = kmsg->netif.system_headers[idx]; } - priv->system_headers_size = kmsg->netif.system_headers_size; } if (priv->type == KCOM_NETIF_T_PORT) { priv->port = kmsg->netif.port; @@ -7953,7 +8593,8 @@ bkn_knet_netif_create(kcom_msg_netif_create_t *kmsg, int len) if (device_is_sand(sinfo)) { int idx = 0; for (idx = 0; idx < priv->system_headers_size; idx++) { - DBG_DUNE(("System Header[%d]: 0x%02x\n", idx, priv->system_headers[idx])); + DBG_DUNE(("System Header[%d]: 0x%02x\n", idx, + priv->system_headers[idx])); } } @@ -7978,7 +8619,7 @@ bkn_knet_netif_destroy(kcom_msg_netif_destroy_t *kmsg, int len) return sizeof(kcom_msg_hdr_t); } - spin_lock_irqsave(&sinfo->lock, flags); + cfg_api_lock(sinfo, &flags); found = 0; list_for_each(list, &sinfo->ndev_list) { @@ -7990,7 +8631,7 @@ bkn_knet_netif_destroy(kcom_msg_netif_destroy_t *kmsg, int len) } if (!found) { - spin_unlock_irqrestore(&sinfo->lock, flags); + cfg_api_unlock(sinfo, &flags); kmsg->hdr.status = KCOM_E_NOT_FOUND; return sizeof(kcom_msg_hdr_t); } @@ -8008,7 +8649,7 @@ bkn_knet_netif_destroy(kcom_msg_netif_destroy_t *kmsg, int len) sinfo->ndevs[priv->id] = NULL; } - spin_unlock_irqrestore(&sinfo->lock, flags); + cfg_api_unlock(sinfo, &flags); dev = priv->dev; DBG_VERB(("Removing virtual Ethernet device %s (%d).\n", @@ -8109,6 +8750,7 @@ bkn_knet_filter_create(kcom_msg_filter_create_t *kmsg, int len) bkn_filter_t *filter, *lfilter; unsigned long flags; int found, id; + int oob_offset_max; kmsg->hdr.type = KCOM_MSG_TYPE_RSP; @@ -8126,6 +8768,25 @@ bkn_knet_filter_create(kcom_msg_filter_create_t *kmsg, int len) return sizeof(kcom_msg_hdr_t); } + if (device_is_sand(sinfo)) { + oob_offset_max = BKN_SAND_SCRATCH_DATA_SIZE * 4; + } else if (sinfo->cmic_type == 'x') { + oob_offset_max = sinfo->pkt_hdr_size; + } else { + oob_offset_max = sinfo->dcb_wsize * 4; + } + + /* Validate filter data offsets and sizes. */ + if (kmsg->filter.oob_data_size + + kmsg->filter.pkt_data_size > KCOM_FILTER_BYTES_MAX || + kmsg->filter.oob_data_size + + kmsg->filter.oob_data_offset > oob_offset_max || + kmsg->filter.pkt_data_size + + kmsg->filter.pkt_data_offset > KNET_FILTER_RAW_MAX) { + kmsg->hdr.status = KCOM_E_PARAM; + return sizeof(kcom_msg_hdr_t); + } + spin_lock_irqsave(&sinfo->lock, flags); /* @@ -8182,15 +8843,20 @@ bkn_knet_filter_create(kcom_msg_filter_create_t *kmsg, int len) if (device_is_sand(sinfo)) { int idx, wsize; wsize = BYTES2WORDS(filter->kf.oob_data_size + filter->kf.pkt_data_size); - DBG_DUNE(("Filter: oob_data_size = %d pkt_data_size=%d wsize %d\n", filter->kf.oob_data_size, filter->kf.pkt_data_size, wsize)); + DBG_DUNE(("Filter: oob_data_size = %d pkt_data_size=%d wsize %d\n", + filter->kf.oob_data_size, filter->kf.pkt_data_size, wsize)); for (idx = 0; idx < wsize; idx++) { - DBG_DUNE(("OOB[%d]: 0x%08x [0x%08x]\n", idx, filter->kf.data.w[idx], filter->kf.mask.w[idx])); + DBG_DUNE(("OOB[%d]: 0x%08x [0x%08x]\n", idx, filter->kf.data.w[idx], + filter->kf.mask.w[idx])); } DBG_DUNE(("DNX system headers parameters:LB_KEY_EXT %d, STK_EXT %d, PPH_BASE %d, LIF_EXT %d %d %d, UDH_ENA %d, %d %d %d %d\n", - sinfo->ftmh_lb_key_ext_size, sinfo->ftmh_stacking_ext_size, sinfo->pph_base_size, - sinfo->pph_lif_ext_size[1],sinfo->pph_lif_ext_size[2], sinfo->pph_lif_ext_size[3], - sinfo->udh_enable, sinfo->udh_length_type[0], sinfo->udh_length_type[1], sinfo->udh_length_type[2], sinfo->udh_length_type[3])); + sinfo->ftmh_lb_key_ext_size, sinfo->ftmh_stacking_ext_size, + sinfo->pph_base_size, sinfo->pph_lif_ext_size[1], + sinfo->pph_lif_ext_size[2], sinfo->pph_lif_ext_size[3], + sinfo->udh_enable, sinfo->udh_length_type[0], + sinfo->udh_length_type[1], sinfo->udh_length_type[2], + sinfo->udh_length_type[3])); } return len; } @@ -8212,7 +8878,7 @@ bkn_knet_filter_destroy(kcom_msg_filter_destroy_t *kmsg, int len) return sizeof(kcom_msg_hdr_t); } - spin_lock_irqsave(&sinfo->lock, flags); + cfg_api_lock(sinfo, &flags); found = 0; list_for_each(list, &sinfo->rxpf_list) { @@ -8224,14 +8890,14 @@ bkn_knet_filter_destroy(kcom_msg_filter_destroy_t *kmsg, int len) } if (!found) { - spin_unlock_irqrestore(&sinfo->lock, flags); + cfg_api_unlock(sinfo, &flags); kmsg->hdr.status = KCOM_E_NOT_FOUND; return sizeof(kcom_msg_hdr_t); } list_del(&filter->list); - spin_unlock_irqrestore(&sinfo->lock, flags); + cfg_api_unlock(sinfo, &flags); DBG_VERB(("Removing filter ID %d.\n", filter->kf.id)); kfree(filter); @@ -8346,7 +9012,7 @@ bkn_knet_wb_cleanup(kcom_msg_wb_cleanup_t *kmsg, int len) return sizeof(kcom_msg_hdr_t); } - spin_lock_irqsave(&sinfo->lock, flags); + cfg_api_lock(sinfo, &flags); for (chan = 0; chan < sinfo->rx_chans; chan++) { if (sinfo->rx[chan].api_dcb_chain) { @@ -8365,7 +9031,7 @@ bkn_knet_wb_cleanup(kcom_msg_wb_cleanup_t *kmsg, int len) sinfo->rx[chan].api_active = 0; } - spin_unlock_irqrestore(&sinfo->lock, flags); + cfg_api_unlock(sinfo, &flags); return sizeof(kcom_msg_hdr_t); } @@ -8405,6 +9071,11 @@ bkn_handle_cmd_req(kcom_msg_t *kmsg, int len) /* Initialize DMA */ len = bkn_knet_hw_init(&kmsg->hw_init, len); break; + case KCOM_M_HW_INFO: + DBG_CMD(("KCOM_M_HW_INFO\n")); + /* Initialize HW info DB */ + len = bkn_knet_hw_info(&kmsg->hw_info, len); + break; case KCOM_M_DETACH: DBG_CMD(("KCOM_M_DETACH\n")); /* Detach kernel module */ @@ -8594,12 +9265,12 @@ _cleanup(void) del_timer_sync(&sinfo->timer); del_timer_sync(&sinfo->rxtick); - spin_lock_irqsave(&sinfo->lock, flags); + cfg_api_lock(sinfo, &flags); if (DEV_IS_CMIC(sinfo)) { bkn_dma_abort(sinfo); dev_irq_mask_set(sinfo, 0); } - spin_unlock_irqrestore(&sinfo->lock, flags); + cfg_api_unlock(sinfo, &flags); DBG_IRQ(("Unregister ISR.\n")); kernel_bde->interrupt_disconnect(sinfo->dev_no | LKBDE_ISR2_DEV); @@ -8610,10 +9281,10 @@ _cleanup(void) } } - spin_lock_irqsave(&sinfo->lock, flags); + cfg_api_lock(sinfo, &flags); bkn_clean_dcbs(sinfo); skb_queue_purge(&sinfo->tx_ptp_queue); - spin_unlock_irqrestore(&sinfo->lock, flags); + cfg_api_unlock(sinfo, &flags); } /* Destroy all switch devices */ @@ -8668,11 +9339,11 @@ bkn_knet_dev_reinit(int d) DBG_VERB(("%s dev %d dev_state %d\n",__FUNCTION__, d, dev_state)); if (dev_state == BDE_DEV_STATE_CHANGED) { sinfo = bkn_sinfo_from_unit(d); - spin_lock_irqsave(&sinfo->lock, flags); + cfg_api_lock(sinfo, &flags); sinfo->base_addr = lkbde_get_dev_virt(d); sinfo->dma_dev = lkbde_get_dma_dev(d); sinfo->pdev = lkbde_get_hw_dev(d); - spin_unlock_irqrestore(&sinfo->lock, flags); + cfg_api_unlock(sinfo, &flags); dev_state = 0; lkbde_dev_state_set(d, dev_state); @@ -9170,6 +9841,28 @@ bkn_hw_tstamp_rx_time_upscale_cb_unregister(knet_hw_tstamp_rx_time_upscale_cb_f return 0; } +int +bkn_hw_tstamp_rx_pre_process_cb_register(knet_hw_tstamp_rx_pre_process_cb_f hw_tstamp_rx_pre_process_cb) +{ + if (knet_hw_tstamp_rx_pre_process_cb != NULL) { + return -1; + } + knet_hw_tstamp_rx_pre_process_cb = hw_tstamp_rx_pre_process_cb; + return 0; +} + +int +bkn_hw_tstamp_rx_pre_process_cb_unregister(knet_hw_tstamp_rx_pre_process_cb_f hw_tstamp_rx_pre_process_cb) +{ + if (hw_tstamp_rx_pre_process_cb == NULL || + knet_hw_tstamp_rx_pre_process_cb != hw_tstamp_rx_pre_process_cb) { + return -1; + } + knet_hw_tstamp_rx_pre_process_cb = NULL; + return 0; +} + + int bkn_hw_tstamp_ioctl_cmd_cb_register(knet_hw_tstamp_ioctl_cmd_cb_f hw_tstamp_ioctl_cmd_cb) { @@ -9209,6 +9902,8 @@ LKM_EXPORT_SYM(bkn_hw_tstamp_ptp_clock_index_cb_register); LKM_EXPORT_SYM(bkn_hw_tstamp_ptp_clock_index_cb_unregister); LKM_EXPORT_SYM(bkn_hw_tstamp_rx_time_upscale_cb_register); LKM_EXPORT_SYM(bkn_hw_tstamp_rx_time_upscale_cb_unregister); +LKM_EXPORT_SYM(bkn_hw_tstamp_rx_pre_process_cb_register); +LKM_EXPORT_SYM(bkn_hw_tstamp_rx_pre_process_cb_unregister); LKM_EXPORT_SYM(bkn_hw_info_get); LKM_EXPORT_SYM(bkn_netif_create_cb_register); LKM_EXPORT_SYM(bkn_netif_create_cb_unregister); diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-ptp-clock/Makefile b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-ptp-clock/Makefile index 9aa3be686851..743eb741732b 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-ptp-clock/Makefile +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-ptp-clock/Makefile @@ -36,7 +36,7 @@ KMODULE = $(LIBDIR)/$(THIS_MOD_NAME).ko build: $(MODULE) $(KMODULE) endif -#KBUILD_EXTRA_SYMBOLS := ${BLDDIR}/../../../../bde/linux/kernel/kernel_module/Module.symvers +KBUILD_EXTRA_SYMBOLS := ${BLDDIR}/../../../../bde/linux/kernel/kernel_module/Module.symvers KBUILD_EXTRA_SYMBOLS += ${BLDDIR}/../bcm-knet/kernel_module/Module.symvers # BCM PTP Clock Device @@ -49,7 +49,7 @@ $(KMODULE): $(MODULE) mkdir $(BLDDIR)/$(KERNEL_MODULE_DIR) cp ${SDK}/make/Makefile.linux-kmodule $(BLDDIR)/$(KERNEL_MODULE_DIR)/Makefile cat ${KBUILD_EXTRA_SYMBOLS} > $(BLDDIR)/$(KERNEL_MODULE_DIR)/Module.symvers - MOD_NAME=$(THIS_MOD_NAME) $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko + MOD_NAME=$(THIS_MOD_NAME) KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko endif # Make.depend is before clean:: so that Make.depend's clean:: runs first. diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-ptp-clock/bcm-ptp-clock.c b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-ptp-clock/bcm-ptp-clock.c index edc4a38c741c..7c88fae97d62 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-ptp-clock/bcm-ptp-clock.c +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-ptp-clock/bcm-ptp-clock.c @@ -1594,13 +1594,12 @@ bksync_proc_txts_write(struct file *file, const char *buf, return count; } -struct file_operations bksync_proc_txts_file_ops = { - owner: THIS_MODULE, - open: bksync_proc_txts_open, - read: seq_read, - llseek: seq_lseek, - write: bksync_proc_txts_write, - release: seq_release, +struct proc_ops bksync_proc_txts_file_ops = { + proc_open: bksync_proc_txts_open, + proc_read: seq_read, + proc_lseek: seq_lseek, + proc_write: bksync_proc_txts_write, + proc_release: seq_release, }; /* @@ -1641,13 +1640,12 @@ static int bksync_proc_debug_open(struct inode * inode, struct file * file) } -struct file_operations bksync_proc_debug_file_ops = { - owner: THIS_MODULE, - open: bksync_proc_debug_open, - read: seq_read, - llseek: seq_lseek, - write: bksync_proc_debug_write, - release: single_release, +struct proc_ops bksync_proc_debug_file_ops = { + proc_open: bksync_proc_debug_open, + proc_read: seq_read, + proc_lseek: seq_lseek, + proc_write: bksync_proc_debug_write, + proc_release: single_release, }; diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/bcm-knet.h b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/bcm-knet.h index 8d710869824f..2f15c83c6b17 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/bcm-knet.h +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/bcm-knet.h @@ -83,6 +83,9 @@ typedef int typedef int (*knet_hw_tstamp_ptp_clock_index_cb_f)(int dev_no); +typedef int +(*knet_hw_tstamp_rx_pre_process_cb_f)(int dev_no, uint8_t *pkt, uint32_t sspa, int *pkt_offset); + typedef int (*knet_hw_tstamp_rx_time_upscale_cb_f)(int dev_no, int phys_port, struct sk_buff *skb, uint32_t *meta, uint64_t *ts); @@ -137,6 +140,12 @@ bkn_hw_tstamp_ptp_clock_index_cb_register(knet_hw_tstamp_ptp_clock_index_cb_f hw extern int bkn_hw_tstamp_ptp_clock_index_cb_unregister(knet_hw_tstamp_ptp_clock_index_cb_f hw_tstamp_ptp_clock_index_cb); +extern int +bkn_hw_tstamp_rx_pre_process_cb_register(knet_hw_tstamp_rx_pre_process_cb_f hw_tstamp_rx_pre_process_cb); + +extern int +bkn_hw_tstamp_rx_pre_process_cb_unregister(knet_hw_tstamp_rx_pre_process_cb_f hw_tstamp_rx_pre_process_cb); + extern int bkn_hw_tstamp_rx_time_upscale_cb_register(knet_hw_tstamp_rx_time_upscale_cb_f hw_tstamp_rx_time_upscale_cb); diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/lkm.h b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/lkm.h index 9ea8fc5896d8..3d66635977b2 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/lkm.h +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/include/lkm.h @@ -42,8 +42,8 @@ #include #include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) -#include +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) +#error Kernel too old #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) /* The version kconfig.h became available in. */ @@ -63,11 +63,7 @@ #include /* Helper defines for multi-version kernel support */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) -#define LKM_2_4 -#else #define LKM_2_6 -#endif #include /* printk() */ #include /* everything... */ @@ -96,24 +92,11 @@ /* Compatibility Macros */ -#ifdef LKM_2_4 - -#include -#include -#define LKM_MOD_PARAM(n,ot,nt,d) MODULE_PARM(n,ot) -#define LKM_MOD_PARAM_ARRAY(n,ot,nt,c,d) MODULE_PARM(n,ot) -#define LKM_EXPORT_SYM(s) -#define _free_netdev kfree - -#else /* LKM_2_6 */ - #define LKM_MOD_PARAM(n,ot,nt,d) module_param(n,nt,d) #define LKM_MOD_PARAM_ARRAY(n,ot,nt,c,d) module_param_array(n,nt,c,d) #define LKM_EXPORT_SYM(s) EXPORT_SYMBOL(s) #define _free_netdev free_netdev -#endif /* LKM_2_x */ - #ifndef list_for_each_safe #define list_for_each_safe(l,t,i) t = 0; list_for_each((l),(i)) #endif @@ -162,6 +145,18 @@ #define CONFIG_BMW #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0) +#define PROC_OWNER(_m) +#else +#define PROC_OWNER(_m) .owner = _m, +#define proc_ops file_operations +#define proc_open open +#define proc_read read +#define proc_write write +#define proc_lseek llseek +#define proc_release release +#endif + #if PROC_INTERFACE_KERN_VER_3_10 #define PROC_CREATE(_entry, _name, _acc, _path, _fops) \ do { \ diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/Makefile b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/Makefile index b8697731dd4e..d888820fafba 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/Makefile +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/Makefile @@ -61,8 +61,11 @@ $(KMODULE): $(MODULE) rm -fr $(BLDDIR)/$(KERNEL_MODULE_DIR) mkdir $(BLDDIR)/$(KERNEL_MODULE_DIR) cp ${SDK}/make/Makefile.linux-kmodule $(BLDDIR)/$(KERNEL_MODULE_DIR)/Makefile +ifeq ($(BUILD_PSAMPLE),1) + sed -i 's/0x......../0x00000000/' ${BLDDIR}/../psample/kernel_module/Module.symvers +endif cat ${KBUILD_EXTRA_SYMBOLS} > $(BLDDIR)/$(KERNEL_MODULE_DIR)/Module.symvers - MOD_NAME=$(THIS_MOD_NAME) $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko + MOD_NAME=$(THIS_MOD_NAME) KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko endif # Make.depend is before clean:: so that Make.depend's clean:: runs first. diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/knet-cb.c b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/knet-cb.c index 650a4ced1d7a..297ef7a1e478 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/knet-cb.c +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/knet-cb.c @@ -328,16 +328,50 @@ strip_tag_filter_cb(uint8_t * pkt, int size, int dev_no, void *meta, return 0; } +#ifdef BCM_DNX_SUPPORT static int knet_filter_cb(uint8_t * pkt, int size, int dev_no, void *meta, int chan, kcom_filter_t *kf) { /* check for filter callback handler */ - #ifdef PSAMPLE_SUPPORT +#ifdef PSAMPLE_SUPPORT + if (strncmp(kf->desc, PSAMPLE_CB_NAME, strlen(PSAMPLE_CB_NAME)) == 0) { + return psample_filter_cb (pkt, size, dev_no, meta, chan, kf); + } +#endif + return strip_tag_filter_cb (pkt, size, dev_no, meta, chan, kf); +} + +static int +knet_netif_create_cb(int unit, kcom_netif_t *netif, uint16 spa, struct net_device *dev) +{ + int retv = 0; +#ifdef PSAMPLE_SUPPORT + retv = psample_netif_create_cb(unit, netif, spa, dev); +#endif + return retv; +} + +static int +knet_netif_destroy_cb(int unit, kcom_netif_t *netif, uint16 spa, struct net_device *dev) +{ + int retv = 0; +#ifdef PSAMPLE_SUPPORT + retv = psample_netif_destroy_cb(unit, netif, spa, dev); +#endif + return retv; +} +#else +static int +knet_filter_cb(uint8_t * pkt, int size, int dev_no, void *meta, + int chan, kcom_filter_t *kf) +{ + /* check for filter callback handler */ +#ifdef PSAMPLE_SUPPORT if (strncmp(kf->desc, PSAMPLE_CB_NAME, KCOM_FILTER_DESC_MAX) == 0) { return psample_filter_cb (pkt, size, dev_no, meta, chan, kf); } - #endif +#endif return strip_tag_filter_cb (pkt, size, dev_no, meta, chan, kf); } @@ -360,6 +394,7 @@ knet_netif_destroy_cb(int unit, kcom_netif_t *netif, struct net_device *dev) #endif return retv; } +#endif /* * Get statistics. @@ -395,7 +430,6 @@ _cleanup(void) #ifdef PSAMPLE_SUPPORT psample_cleanup(); #endif - return 0; } @@ -411,11 +445,9 @@ _init(void) bkn_tx_skb_cb_register(strip_tag_tx_cb); } - #ifdef PSAMPLE_SUPPORT +#ifdef PSAMPLE_SUPPORT psample_init(); - #endif - - +#endif bkn_filter_cb_register(knet_filter_cb); bkn_netif_create_cb_register(knet_netif_create_cb); bkn_netif_destroy_cb_register(knet_netif_destroy_cb); diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/psample-cb.c b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/psample-cb.c index 755955b20fdd..e67f9191d45e 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/psample-cb.c +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/knet-cb/psample-cb.c @@ -714,13 +714,13 @@ psample_proc_rate_write(struct file *file, const char *buf, return count; } -struct file_operations psample_proc_rate_file_ops = { - owner: THIS_MODULE, - open: psample_proc_rate_open, - read: seq_read, - llseek: seq_lseek, - write: psample_proc_rate_write, - release: single_release, +struct proc_ops psample_proc_rate_file_ops = { + PROC_OWNER(THIS_MODULE) + .proc_open = psample_proc_rate_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = psample_proc_rate_write, + .proc_release = single_release, }; /* @@ -813,13 +813,13 @@ psample_proc_size_write(struct file *file, const char *buf, return count; } -struct file_operations psample_proc_size_file_ops = { - owner: THIS_MODULE, - open: psample_proc_size_open, - read: seq_read, - llseek: seq_lseek, - write: psample_proc_size_write, - release: single_release, +struct proc_ops psample_proc_size_file_ops = { + PROC_OWNER(THIS_MODULE) + .proc_open = psample_proc_size_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = psample_proc_size_write, + .proc_release = single_release, }; /* @@ -854,13 +854,13 @@ psample_proc_map_open(struct inode * inode, struct file * file) return single_open(file, psample_proc_map_show, NULL); } -struct file_operations psample_proc_map_file_ops = { - owner: THIS_MODULE, - open: psample_proc_map_open, - read: seq_read, - llseek: seq_lseek, - write: NULL, - release: single_release, +struct proc_ops psample_proc_map_file_ops = { + PROC_OWNER(THIS_MODULE) + .proc_open = psample_proc_map_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = NULL, + .proc_release = single_release, }; /* @@ -924,13 +924,13 @@ psample_proc_debug_write(struct file *file, const char *buf, return count; } -struct file_operations psample_proc_debug_file_ops = { - owner: THIS_MODULE, - open: psample_proc_debug_open, - read: seq_read, - llseek: seq_lseek, - write: psample_proc_debug_write, - release: single_release, +struct proc_ops psample_proc_debug_file_ops = { + PROC_OWNER(THIS_MODULE) + .proc_open = psample_proc_debug_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = psample_proc_debug_write, + .proc_release = single_release, }; static int @@ -984,13 +984,13 @@ psample_proc_stats_write(struct file *file, const char *buf, return count; } -struct file_operations psample_proc_stats_file_ops = { - owner: THIS_MODULE, - open: psample_proc_stats_open, - read: seq_read, - llseek: seq_lseek, - write: psample_proc_stats_write, - release: single_release, +struct proc_ops psample_proc_stats_file_ops = { + PROC_OWNER(THIS_MODULE) + .proc_open = psample_proc_stats_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = psample_proc_stats_write, + .proc_release = single_release, }; int psample_cleanup(void) diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/psample/Makefile b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/psample/Makefile index 631590104cd8..53293a7ac93b 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/psample/Makefile +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/psample/Makefile @@ -48,7 +48,7 @@ $(KMODULE): $(MODULE) mkdir $(BLDDIR)/$(KERNEL_MODULE_DIR) cp ${SDK}/make/Makefile.linux-kmodule $(BLDDIR)/$(KERNEL_MODULE_DIR)/Makefile cat ${KBUILD_EXTRA_SYMBOLS} > $(BLDDIR)/$(KERNEL_MODULE_DIR)/Module.symvers - MOD_NAME=$(THIS_MOD_NAME) $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko + MOD_NAME=$(THIS_MOD_NAME) KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" $(MAKE) -C $(BLDDIR)/$(KERNEL_MODULE_DIR) $(THIS_MOD_NAME).ko endif # Make.depend is before clean:: so that Make.depend's clean:: runs first. diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/gmodule.c b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/gmodule.c index 3ef000961837..df6e2d6bb681 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/gmodule.c +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/gmodule.c @@ -41,16 +41,6 @@ static gmodule_t* _gmodule = NULL; -/* Allow DEVFS Support on 2.4 Kernels */ -#if defined(LKM_2_4) && defined(CONFIG_DEVFS_FS) -#define GMODULE_CONFIG_DEVFS_FS -#endif - - -#ifdef GMODULE_CONFIG_DEVFS_FS -devfs_handle_t devfs_handle = NULL; -#endif - /* FIXME: support dynamic debugging */ static int _dbg_enable = 0; @@ -149,13 +139,13 @@ static int _gmodule_proc_release(struct inode * inode, struct file * file) { return single_release(inode, file); } -struct file_operations _gmodule_proc_fops = { - owner: THIS_MODULE, - open: _gmodule_proc_open, - read: seq_read, - llseek: seq_lseek, - write: _gmodule_proc_write, - release: _gmodule_proc_release, +struct proc_ops _gmodule_proc_fops = { + PROC_OWNER(THIS_MODULE) + .proc_open = _gmodule_proc_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_write = _gmodule_proc_write, + .proc_release = _gmodule_proc_release, }; #else int @@ -271,7 +261,6 @@ _gmodule_release(struct inode *inode, struct file *filp) return 0; } -#ifdef HAVE_UNLOCKED_IOCTL static long _gmodule_unlocked_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) @@ -282,20 +271,7 @@ _gmodule_unlocked_ioctl(struct file *filp, return -1; } } -#else -static int -_gmodule_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - if(_gmodule->ioctl) { - return _gmodule->ioctl(cmd, arg); - } else { - return -1; - } -} -#endif -#ifdef HAVE_COMPAT_IOCTL static long _gmodule_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { @@ -305,7 +281,6 @@ _gmodule_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return -1; } } -#endif static int @@ -334,17 +309,11 @@ _gmodule_mmap(struct file *filp, struct vm_area_struct *vma) /* FILE OPERATIONS */ struct file_operations _gmodule_fops = { -#ifdef HAVE_UNLOCKED_IOCTL - unlocked_ioctl: _gmodule_unlocked_ioctl, -#else - ioctl: _gmodule_ioctl, -#endif - open: _gmodule_open, - release: _gmodule_release, - mmap: _gmodule_mmap, -#ifdef HAVE_COMPAT_IOCTL - compat_ioctl: _gmodule_compat_ioctl, -#endif + .unlocked_ioctl = _gmodule_unlocked_ioctl, + .open = _gmodule_open, + .release = _gmodule_release, + .mmap = _gmodule_mmap, + .compat_ioctl = _gmodule_compat_ioctl, }; @@ -364,11 +333,7 @@ cleanup_module(void) } /* Finally, remove ourselves from the universe */ -#ifdef GMODULE_CONFIG_DEVFS_FS - if(devfs_handle) devfs_unregister(devfs_handle); -#else unregister_chrdev(_gmodule->major, _gmodule->name); -#endif } int __init @@ -382,21 +347,6 @@ init_module(void) /* Register ourselves */ -#ifdef GMODULE_CONFIG_DEVFS_FS - devfs_handle = devfs_register(NULL, - _gmodule->name, - DEVFS_FL_NONE, - _gmodule->major, - _gmodule->minor, - S_IFCHR | S_IRUGO | S_IWUGO, - &_gmodule_fops, - NULL); - if(!devfs_handle) { - printk(KERN_WARNING "%s: can't register device with devfs", - _gmodule->name); - } - rc = 0; -#else rc = register_chrdev(_gmodule->major, _gmodule->name, &_gmodule_fops); @@ -409,17 +359,12 @@ init_module(void) if(_gmodule->major == 0) { _gmodule->major = rc; } -#endif /* Specific module Initialization */ if(_gmodule->init) { int rc; if((rc = _gmodule->init()) < 0) { -#ifdef GMODULE_CONFIG_DEVFS_FS - if(devfs_handle) devfs_unregister(devfs_handle); -#else unregister_chrdev(_gmodule->major, _gmodule->name); -#endif return rc; } } diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/ksal.c b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/ksal.c index 7f90c59c3a39..2161b287f687 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/ksal.c +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/shared/ksal.c @@ -191,9 +191,15 @@ sal_sem_give(sal_sem_t b) uint32 sal_time_usecs(void) { +#if !defined(SAI_FIXUP) struct timeval ltv; do_gettimeofday(<v); return (ltv.tv_sec * SECOND_USEC + ltv.tv_usec); +#else + /* ktime_to_us and ktime_get_real_ns return 64-bit integets, but this */ + /* function is returning a 32-bit integer. This should be fine until 2038. */ + return ktime_to_us(ktime_get_real_ns()); +#endif } void diff --git a/platform/broadcom/saibcm-modules/systems/linux/user/common/Makefile b/platform/broadcom/saibcm-modules/systems/linux/user/common/Makefile index 8f59a763e314..7a342f6ef60e 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/user/common/Makefile +++ b/platform/broadcom/saibcm-modules/systems/linux/user/common/Makefile @@ -69,8 +69,12 @@ kernel-override=linux-$(platform) ifdef BLDCONFIG KERN_BLDROOT=${SDK}/${SDKBUILD}/${BLDCONFIG}/$(kernel-override)$(bldroot_suffix) else +ifdef SDK_OUTDIR +KERN_BLDROOT=${SDK_OUTDIR}/${SDKBUILD}/$(kernel-override)$(bldroot_suffix) +else KERN_BLDROOT=${SDK}/${SDKBUILD}/$(kernel-override)$(bldroot_suffix) endif +endif ifeq (,$(kernel_version)) kernel_version=2_4 @@ -105,9 +109,6 @@ BCM_KNET=$(DEST_DIR)/$(BCM_KNET_LOCAL) PSAMPLE_LOCAL := psample.$(KOBJ) PSAMPLE := $(DEST_DIR)/$(PSAMPLE_LOCAL) -BCM_LPTP_LOCAL :=linux-bcm-ptp-clock.$(KOBJ) -BCM_LPTP=$(DEST_DIR)/$(BCM_LPTP_LOCAL) - ifeq (,$(findstring DELIVER,$(MAKECMDGOALS))) .DEFAULT_GOAL := all all_targets := kernel_modules $(KERNEL_BDE) $(USER_BDE) @@ -125,12 +126,6 @@ ifndef BUILD_KNET BUILD_KNET = 1 endif -# Remove this when LinuxPTP support becomes optional. -ifndef BUILD_LPTP -BUILD_LPTP = 1 -BUILD_KNETSYNC = 1 -endif - ifeq ($(BUILD_KNET),1) # Kernel network support all_targets += $(BCM_KNET) @@ -152,30 +147,7 @@ endif ifdef BUILD_PSAMPLE all_targets += $(PSAMPLE) ADD_TO_CFLAGS += -DPSAMPLE_SUPPORT - -# KnetSync support -ifdef BUILD_KNETSYNC - -KERNEL_TARGETS += $(BCM_PTP_CLOCK) -LOCAL_KERNEL_TARGETS += $(patsubst %,$(realpath ..)/$(platform)/%,$(BCM_PTP_CLOCK_LOCAL)) - -endif # BUILD_KNETSYNC - -ifeq ($(NO_LOCAL_TARGETS),) - LOCAL_TARGETS +=$(patsubst %,../$(platform)/%,$(PSAMPLE_LOCAL)) - all_targets +=$(LOCAL_TARGETS) -endif endif - -ifdef BUILD_LPTP - all_targets += $(BCM_LPTP) - -ifeq ($(NO_LOCAL_TARGETS),) - LOCAL_TARGETS +=$(patsubst %,../$(platform)/%,$(BCM_LPTP_LOCAL)) - all_targets +=$(LOCAL_TARGETS) -endif -endif - ADD_TO_CFLAGS += -I$(SDK)/systems/linux/kernel/modules/include COND_KNET_LIBS = libuser.$(libext) endif @@ -200,11 +172,6 @@ CFLAGS += $(ADD_TO_CFLAGS) #SAI_FIXUP CFLAGS:=$(filter-out -fPIC, $(CFLAGS)) -# KnetSync Support -ifdef BUILD_KNETSYNC - knetsync_subdirs = bcm-ptp-clock -endif # BUILD_KNETSYNC - kernel_modules: $(MAKE) -C $(SDK)/systems/bde/linux/kernel kernel_version=$(kernel_version) $(MAKE) -C $(SDK)/systems/bde/linux/user/kernel kernel_version=$(kernel_version) @@ -219,10 +186,6 @@ ifdef BUILD_KNET_CB $(MAKE) -C $(SDK)/systems/linux/kernel/modules kernel_version=$(kernel_version) \ subdirs="knet-cb" override-target=linux-$(platform) CFLAGS="$(CFLAGS)" endif -ifdef BUILD_LPTP - $(MAKE) -C $(SDK)/systems/linux/kernel/modules kernel_version=$(kernel_version) \ - subdirs="bcm-ptp-clock" override-target=linux-$(platform) CFLAGS="$(CFLAGS)" -endif endif $(KERNEL_BDE): $(KERN_BLDROOT)/linux-kernel-bde.$(KOBJ) @@ -241,8 +204,7 @@ $(KNET_CB): $(KERN_BLDROOT)/linux-knet-cb.$(KOBJ) $(PSAMPLE): $(KERN_BLDROOT)/psample.$(KOBJ) $(OBJCOPY) --strip-debug $< $@ -$(BCM_LPTP): $(KERN_BLDROOT)/linux-bcm-ptp-clock.$(KOBJ) - $(OBJCOPY) --strip-debug $< $@ + ifeq ($(NO_LOCAL_TARGETS),) $(foreach targ,$(LOCAL_TARGETS),$(eval $(call LOCAL_TARGET_DEF,$(targ)))) @@ -252,10 +214,10 @@ clean:: $(MAKE) -C $(SDK)/systems/bde/linux/kernel $@ $(MAKE) -C $(SDK)/systems/bde/linux/user/kernel $@ $(MAKE) -C $(SDK)/systems/linux/kernel/modules \ - subdirs="shared bcm-knet knet-cb psample bcm-ptp-clock" \ + subdirs="shared bcm-knet knet-cb psample" \ override-target=linux-$(platform) $@ $(RM) $(KERNEL_BDE) $(USER_BDE) - $(RM) $(BCM_KNET) $(KNET_CB) $(PSAMPLE) $(BCM_LPTP) + $(RM) $(BCM_KNET) $(KNET_CB) $(PSAMPLE) $(RM) $(KERN_BLDROOT)/linux-kernel-bde.$(KOBJ) $(RM) $(KERN_BLDROOT)/linux-user-bde.$(KOBJ) $(RM) $(KERN_BLDROOT)/linux-bcm-knet.$(KOBJ) diff --git a/platform/broadcom/saibcm-modules/systems/linux/user/gts/Makefile b/platform/broadcom/saibcm-modules/systems/linux/user/gts/Makefile index 5acaeab271cc..d02c97e3f906 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/user/gts/Makefile +++ b/platform/broadcom/saibcm-modules/systems/linux/user/gts/Makefile @@ -62,8 +62,9 @@ endif export SDK -override kernel_version=4_19 +override kernel_version=5_4 platform=gts + LINUX_MAKE_USER=1 export LINKER_RELAX = 1 export ADD_TO_CFLAGS diff --git a/platform/broadcom/saibcm-modules/systems/linux/user/iproc/Makefile b/platform/broadcom/saibcm-modules/systems/linux/user/iproc/Makefile index f10c5c37a082..7f2c7bc6e247 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/user/iproc/Makefile +++ b/platform/broadcom/saibcm-modules/systems/linux/user/iproc/Makefile @@ -55,7 +55,7 @@ endif export SDK -override kernel_version=4_14 +override kernel_version=5_4 platform=iproc IPROC_BUILD=1 diff --git a/platform/broadcom/saibcm-modules/systems/linux/user/iproc_64/Makefile b/platform/broadcom/saibcm-modules/systems/linux/user/iproc_64/Makefile index 983b3abbced7..3f0a819d86f0 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/user/iproc_64/Makefile +++ b/platform/broadcom/saibcm-modules/systems/linux/user/iproc_64/Makefile @@ -55,7 +55,7 @@ endif export SDK -override kernel_version=4_14 +override kernel_version=5_4 platform=iproc_64 IPROC_BUILD=1 diff --git a/platform/broadcom/saibcm-modules/systems/linux/user/xlr/Makefile b/platform/broadcom/saibcm-modules/systems/linux/user/xlr/Makefile index e19eeff4aef2..377cf43ab68b 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/user/xlr/Makefile +++ b/platform/broadcom/saibcm-modules/systems/linux/user/xlr/Makefile @@ -62,8 +62,9 @@ endif export SDK -override kernel_version=4_19 +override kernel_version=5_4 platform=xlr + LINUX_MAKE_USER=1 export LINKER_RELAX = 1 export ADD_TO_CFLAGS diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/classes/fanutil.py index d046834ecf33..fc678ff9ffd9 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/classes/fanutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/classes/fanutil.py @@ -20,9 +20,7 @@ # ------------------------------------------------------------------ try: - import time import logging - from collections import namedtuple except ImportError as e: raise ImportError('%s - required module not found' % str(e)) @@ -82,24 +80,24 @@ def _get_fan_node_val(self, fan_num, node_num): device_path = self.get_fan_device_path(fan_num, node_num) - try: - val_file = open(device_path, 'r') - except IOError as e: - logging.error('GET. unable to open file: %s', str(e)) - return None - - content = val_file.readline().rstrip() - if content == '': - logging.debug('GET. content is NULL. device_path:%s', device_path) - return None - - try: - val_file.close() - except: - logging.debug('GET. unable to close file. device_path:%s', device_path) - return None - - return int(content) + try: + val_file = open(device_path, 'r') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + content = val_file.readline().rstrip() + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + try: + val_file.close() + except IOError as e: + logging.debug('GET. unable to close file: %s. device_path:%s', str(e), device_path) + return None + + return int(content) def _set_fan_node_val(self, fan_num, node_num, val): if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: @@ -125,9 +123,9 @@ def _set_fan_node_val(self, fan_num, node_num, val): val_file.write(content) try: - val_file.close() - except: - logging.debug('GET. unable to close file. device_path:%s', device_path) + val_file.close() + except IOError as e: + logging.debug('GET. unable to close file: %s. device_path:%s', str(e), device_path) return None return True @@ -158,7 +156,7 @@ def get_fan_duty_cycle(self): try: val_file = open(self.FAN_DUTY_PATH) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() @@ -170,7 +168,7 @@ def set_fan_duty_cycle(self, val): try: fan_file = open(self.FAN_DUTY_PATH, 'r+') except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False fan_file.write(str(val)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/classes/thermalutil.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/classes/thermalutil.py index bd5530fd9035..182b95f8eaeb 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/classes/thermalutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/classes/thermalutil.py @@ -24,7 +24,7 @@ import time import logging import glob - import commands + import subprocess from collections import namedtuple except ImportError as e: raise ImportError('%s - required module not found' % str(e)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/Makefile old mode 100755 new mode 100644 index f845f2e17d86..41953f866b6c --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/Makefile @@ -4,10 +4,7 @@ obj-m:= x86-64-accton-as4630-54pe-cpld.o x86-64-accton-as4630-54pe-psu.o \ else ifeq (,$(KERNEL_SRC)) -#$(error KERNEL_SRC is not defined) -KVERSION=3.16.0-8-amd64 -KERNEL_DIR = /usr/src/linux-headers-$(KVERSION)/ -KERNELDIR:=$(KERNEL_DIR) +$(error KERNEL_SRC is not defined) else KERNELDIR:=$(KERNEL_SRC) endif diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/x86-64-accton-as4630-54pe-cpld.c b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/x86-64-accton-as4630-54pe-cpld.c old mode 100755 new mode 100644 index f7a438feed7f..0e9fc11aca81 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/x86-64-accton-as4630-54pe-cpld.c +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/x86-64-accton-as4630-54pe-cpld.c @@ -47,7 +47,6 @@ #define FAN_REG_VAL_TO_SPEED_RPM_STEP 114 // R.P.M value = read value x3.79*60/2 #define NUM_THERMAL_SENSORS (3) /* Get sum of this number of sensors.*/ -#define THERMAL_SENSORS_DRIVER "lm75" #define THERMAL_SENSORS_ADDRS {0x48, 0x4a, 0x4b} static LIST_HEAD(cpld_client_list); @@ -168,7 +167,6 @@ static struct as4630_54pe_cpld_data *as4630_54pe_fan_update_device(struct device static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf); static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, const char *buf, size_t count); -static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, char *buf); /* transceiver attributes */ #define DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(index) \ @@ -212,10 +210,6 @@ static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, cha static SENSOR_DEVICE_ATTR(fan_duty_cycle_percentage, S_IWUSR | S_IRUGO, fan_show_value, set_duty_cycle, FAN_DUTY_CYCLE_PERCENTAGE); #define DECLARE_FAN_DUTY_CYCLE_ATTR(index) &sensor_dev_attr_fan_duty_cycle_percentage.dev_attr.attr -#define DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR() \ - static SENSOR_DEVICE_ATTR(sys_temp, S_IRUGO, get_sys_temp, NULL, FAN_DUTY_CYCLE_PERCENTAGE) - -#define DECLARE_FAN_SYSTEM_TEMP_ATTR() &sensor_dev_attr_sys_temp.dev_attr.attr static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, NULL, CPLD_VERSION); static SENSOR_DEVICE_ATTR(access, S_IWUSR, NULL, access, ACCESS); @@ -571,7 +565,7 @@ static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, static u8 reg_val_to_direction(u8 reg_val, enum fan_id id) { - u8 mask = (1 << id); + u8 mask = (1 << (id+4)); reg_val &= mask; @@ -604,268 +598,6 @@ static u8 is_fan_fault(struct as4630_54pe_cpld_data *data, enum fan_id id) return ret; } -/* Due to this struct is declared at lm75.c, it cannot be include - * under Sonic environment. I duplicate it from lm75.c. - */ -struct lm75_data { - struct i2c_client *client; - struct device *hwmon_dev; - struct thermal_zone_device *tz; - struct mutex update_lock; - u8 orig_conf; - u8 resolution; /* In bits, between 9 and 12 */ - u8 resolution_limits; - char valid; /* !=0 if registers are valid */ - unsigned long last_updated; /* In jiffies */ - unsigned long sample_time; /* In jiffies */ - s16 temp[3]; /* Register values, - 0 = input - 1 = max - 2 = hyst */ -}; - -/*Copied from lm75.c*/ -static inline long lm75_reg_to_mc(s16 temp, u8 resolution) -{ - return ((temp >> (16 - resolution)) * 1000) >> (resolution - 8); -} - -/*Get hwmon_dev from i2c_client, set hwmon_dev = NULL is failed.*/ -static struct device * get_hwmon_dev( - struct i2c_client *client) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - if(data) - { - if( data->valid == 1 && data->hwmon_dev) - { - return data->hwmon_dev; - } - - } - return NULL; -} - -/* To find hwmon index by opening hwmon under that i2c address. - */ -static int find_hwmon_index_by_FileOpen( - int bus_nr, - unsigned short addr, - int *index) -{ -#define MAX_HWMON_DEVICE (10) /* Find hwmon device in 0~10*/ - struct file *sfd; - char client_name[96]; - int i=0; - - do { - snprintf(client_name, sizeof(client_name), - "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", - bus_nr, addr, i); - - sfd = filp_open(client_name, O_RDONLY, 0); - i++; - } while( IS_ERR(sfd) && i < MAX_HWMON_DEVICE); - - if (IS_ERR(sfd)) { - pr_err("Failed to open file(%s)#%d\r\n", client_name, __LINE__); - return -ENOENT; - } - filp_close(sfd, 0); - *index = i - 1; - return 0; - -#undef MAX_HWMON_DEVICE -} - -static int get_temp_file_path( - int bus_nr, unsigned short addr, - struct device *hwmon_dev - ,char *path, int max_len) -{ - - if(hwmon_dev && strlen(dev_name(hwmon_dev))) - { - snprintf(path, max_len, - "/sys/bus/i2c/devices/%d-%04x/hwmon/%s/temp1_input", - bus_nr, addr, dev_name(hwmon_dev)); - } - else - { - int i=0; - if(find_hwmon_index_by_FileOpen( bus_nr, addr, &i)) - { - return -EIO; - } - snprintf(path, max_len, - "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", - bus_nr, addr, i); - } - - return 0; -} - -/*File read the dev file at user space.*/ -static int read_devfile_temp1_input( - struct device *dev, - int bus_nr, - unsigned short addr, - struct device *hwmon_dev, - int *miniCelsius) -{ - struct file *sfd; - char buffer[96]; - char devfile[96]; - int rc, status; - int rdlen, value; - mm_segment_t old_fs; - - rc = 0; - get_temp_file_path(bus_nr, addr, hwmon_dev, devfile, sizeof(devfile)); - sfd = filp_open(devfile, O_RDONLY, 0); - if (IS_ERR(sfd)) { - pr_err("Failed to open file(%s)#%d\r\n", devfile, __LINE__); - return -ENOENT; - } - dev_dbg(dev, "Found device:%s\n",devfile); - - if(!(sfd->f_op) || !(sfd->f_op->read) ) { - pr_err("file %s cann't readable ?\n",devfile); - return -ENOENT; - } - - old_fs = get_fs(); - set_fs(KERNEL_DS); - rdlen = sfd->f_op->read(sfd, buffer, sizeof(buffer), &sfd->f_pos); - if (rdlen == 0) { - pr_err( "File(%s) empty!\n", devfile); - rc = -EIO; - goto exit; - } - status = sscanf(buffer, "%d", &value); - if (status != 1) { - rc = -EIO; - goto exit; - } - *miniCelsius = value; - dev_dbg(dev,"found sensors: %d @i2c %d-%04x\n", value, bus_nr, addr); - -exit: - set_fs(old_fs); - filp_close(sfd, 0); - return rc; -} - -static u8 is_lm75_data_due(struct i2c_client *client) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - if (time_after(jiffies, data->last_updated + data->sample_time)) - { - return 1; - } - return 0; -} -static int get_lm75_temp(struct i2c_client *client, int *miniCelsius) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - *miniCelsius = lm75_reg_to_mc(data->temp[0], data->resolution); - - return 0; -} - -static bool lm75_addr_mached(unsigned short addr) -{ - int i; - unsigned short addrs[] = THERMAL_SENSORS_ADDRS; - - for (i = 0; i < ARRAY_SIZE(addrs); i++) - { - if( addr == addrs[i]) - return 1; - } - return 0; -} - -static int _find_lm75_device(struct device *dev, void *data) -{ - struct device_driver *driver; - struct as4630_54pe_cpld_data *prv = data; - char *driver_name = THERMAL_SENSORS_DRIVER; - - driver = dev->driver; - if (driver && driver->name && - strcmp(driver->name, driver_name) == 0) - { - struct i2c_client *client; - client = to_i2c_client(dev); - if (client) - { - /*cannot use "struct i2c_adapter *adap = to_i2c_adapter(dev);"*/ - struct i2c_adapter *adap = client->adapter; - int miniCelsius = 0; - - if (! lm75_addr_mached(client->addr)) - { - return 0; - } - - if (!adap) { - return -ENXIO; - } - - /* If the data is not updated, read them from devfile - to drive them updateing data from chip.*/ - if (is_lm75_data_due(client)) - { - struct device *hwmon_dev; - - hwmon_dev = get_hwmon_dev(client); - if(0 == read_devfile_temp1_input(dev, adap->nr, - client->addr, hwmon_dev, &miniCelsius)) - { - prv->system_temp += miniCelsius; - prv->sensors_found++; - } - - } - else - { - get_lm75_temp(client, &miniCelsius); - prv->system_temp += miniCelsius; - prv->sensors_found++; - - } - } - } - return 0; -} - -/*Find all lm75 devices and return sum of temperatures.*/ -static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, - char *buf) -{ - ssize_t ret = 0; - struct as4630_54pe_cpld_data *data = as4630_54pe_fan_update_device(dev); - - data->system_temp=0; - data->sensors_found=0; - i2c_for_each_dev(data, _find_lm75_device); - if (NUM_THERMAL_SENSORS != data->sensors_found) - { - dev_dbg(dev,"only %d of %d temps are found\n", - data->sensors_found, NUM_THERMAL_SENSORS); - data->system_temp = INT_MAX; - } - ret = sprintf(buf, "%d\n",data->system_temp); - return ret; -} - static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf) { diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/x86-64-accton-as4630-54pe-leds.c b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/x86-64-accton-as4630-54pe-leds.c old mode 100755 new mode 100644 index 34c22fd82aa1..e758dd5cc47b --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/x86-64-accton-as4630-54pe-leds.c +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/x86-64-accton-as4630-54pe-leds.c @@ -64,7 +64,7 @@ static struct accton_as4630_54pe_led_data *ledctl = NULL; #define LED_TYPE_POE_REG_MASK (0x2|0x1) #define LED_MODE_POE_GREEN_VALUE 0x1 #define LED_MODE_POE_AMBER_VALUE 0x2 -#define LED_MODE_POE_OFF_VALUE 0x0 +#define LED_MODE_POE_OFF_VALUE 0x3 #define LED_TYPE_STK1_REG_MASK 0x20 #define LED_MODE_STK1_GREEN_VALUE 0x0 @@ -74,20 +74,20 @@ static struct accton_as4630_54pe_led_data *ledctl = NULL; #define LED_MODE_STK2_GREEN_VALUE 0x0 #define LED_MODE_STK2_OFF_VALUE 0x10 -#define LED_TYPE_FAN_REG_MASK (0x20|0x10) -#define LED_MODE_FAN_AMBER_VALUE 0x20 -#define LED_MODE_FAN_GREEN_VALUE 0x10 -#define LED_MODE_FAN_OFF_VALUE (0x0) +#define LED_TYPE_FAN_REG_MASK (0x8|0x4) +#define LED_MODE_FAN_AMBER_VALUE 0x8 +#define LED_MODE_FAN_GREEN_VALUE 0x4 +#define LED_MODE_FAN_OFF_VALUE (0xC) -#define LED_TYPE_PSU2_REG_MASK (0x8|0x4) -#define LED_MODE_PSU2_AMBER_VALUE 0x8 -#define LED_MODE_PSU2_GREEN_VALUE 0x4 -#define LED_MODE_PSU2_OFF_VALUE (0x0) +#define LED_TYPE_PSU2_REG_MASK (0x80|0x40) +#define LED_MODE_PSU2_AMBER_VALUE 0x80 +#define LED_MODE_PSU2_GREEN_VALUE 0x40 +#define LED_MODE_PSU2_OFF_VALUE (0xC0) #define LED_TYPE_PSU1_REG_MASK (0x2|0x1) #define LED_MODE_PSU1_AMBER_VALUE 0x2 #define LED_MODE_PSU1_GREEN_VALUE 0x1 -#define LED_MODE_PSU1_OFF_VALUE (0x0) +#define LED_MODE_PSU1_OFF_VALUE (0x3) enum led_type { LED_TYPE_DIAG, @@ -106,8 +106,8 @@ struct led_reg { }; static const struct led_reg led_reg_map[] = { - {(1<reg_val[0]); + return led_reg_val_to_light_mode(LED_TYPE_FAN, ledctl->reg_val[1]); } static void accton_as4630_54pe_led_psu1_set(struct led_classdev *led_cdev, @@ -395,7 +395,7 @@ static void accton_as4630_54pe_led_psu2_set(struct led_classdev *led_cdev, static enum led_brightness accton_as4630_54pe_led_psu2_get(struct led_classdev *cdev) { accton_as4630_54pe_led_update(); - return led_reg_val_to_light_mode(LED_TYPE_PSU2, ledctl->reg_val[0]); + return led_reg_val_to_light_mode(LED_TYPE_PSU2, ledctl->reg_val[1]); } static struct led_classdev accton_as4630_54pe_leds[] = { @@ -405,7 +405,7 @@ static struct led_classdev accton_as4630_54pe_leds[] = { .brightness_set = accton_as4630_54pe_led_diag_set, .brightness_get = accton_as4630_54pe_led_diag_get, .flags = LED_CORE_SUSPENDRESUME, - .max_brightness = LED_MODE_GREEN, + .max_brightness = LED_MODE_GREEN_BLINK, }, [LED_TYPE_PRI] = { .name = "pri", diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/x86-64-accton-as4630-54pe-psu.c b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/x86-64-accton-as4630-54pe-psu.c old mode 100755 new mode 100644 diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/as4630-54pe-platform-handle-mgmt-interface.service b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/as4630-54pe-platform-handle-mgmt-interface.service new file mode 100644 index 000000000000..d978b1fe6845 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/as4630-54pe-platform-handle-mgmt-interface.service @@ -0,0 +1,11 @@ +[Unit] +Description=Accton AS4630-54PE Platform handle management interface service +After=sysinit.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/local/bin/handle_mgmt_interface.sh + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/pddf-platform-init.service b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/pddf-platform-init.service new file mode 120000 index 000000000000..0fd9f25b6c5e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/pddf-platform-init.service @@ -0,0 +1 @@ +../../../../pddf/i2c/service/pddf-platform-init.service \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/__init__.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/__init__.py new file mode 100644 index 000000000000..f0201e717796 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/__init__.py @@ -0,0 +1,3 @@ +# All the derived classes for PDDF +__all__ = ["platform", "chassis", "sfp", "psu", "thermal"] +from . import platform diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/chassis.py new file mode 100644 index 000000000000..1dfca24ab32b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/chassis.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python + +############################################################################# +# PDDF +# Module contains an implementation of SONiC Chassis API +# +############################################################################# + +try: + import sys + from sonic_platform_pddf_base.pddf_chassis import PddfChassis + from .event import SfpEvent +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +NUM_COMPONENT = 2 + +class Chassis(PddfChassis): + """ + PDDF Platform-specific Chassis class + """ + + SYSLED_DEV_NAME = "SYS_LED" + + def __init__(self, pddf_data=None, pddf_plugin_data=None): + PddfChassis.__init__(self, pddf_data, pddf_plugin_data) + self.__initialize_components() + self._sfpevent = SfpEvent(self.get_all_sfps()) + + def __initialize_components(self): + from sonic_platform.component import Component + for index in range(NUM_COMPONENT): + component = Component(index) + self._component_list.append(component) + + # Provide the functions/variables below for which implementation is to be overwritten + def get_change_event(self, timeout=0): + return self._sfpevent.get_sfp_event(timeout) + + def get_sfp(self, index): + """ + Retrieves sfp represented by (1-based) index + + Args: + index: An integer, the index (1-based) of the sfp to retrieve. + The index should be the sequence of a physical port in a chassis, + starting from 1. + For example, 1 for Ethernet0, 2 for Ethernet4 and so on. + + Returns: + An object derived from SfpBase representing the specified sfp + """ + sfp = None + + try: + # The index will start from 1 + sfp = self._sfp_list[index-1] + except IndexError: + sys.stderr.write("SFP index {} out of range (1-{})\n".format( + index, len(self._sfp_list))) + return sfp + + def initizalize_system_led(self): + return + + def get_status_led(self): + return self.get_system_led(self.SYSLED_DEV_NAME) + + def set_status_led(self, color): + return self.set_system_led(self.SYSLED_DEV_NAME, color) diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/component.py new file mode 100644 index 000000000000..22696341523d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/component.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python + +############################################################################# +# +# Module contains an implementation of SONiC Platform Base API and +# provides the component information (such as CPLD, FPGA, BIOS etc) which are available in the platform +# +############################################################################# + +try: + import subprocess + from sonic_platform_base.component_base import ComponentBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version" +#COMPONENT_NAME_LIST = ["CPLD1"] +COMPONENT_LIST = [ + ("CPLD1", "CPLD 1"), + ("BIOS", "Basic Input/Output System") +] + +class Component(ComponentBase): + """Platform-specific Component class""" + + + def __init__(self, component_index): + self.index = component_index + self.name = self.get_name() + self.cpld_mapping = { + 0: ['3', '0x60'] + } + + + def get_name(self): + """ + Retrieves the name of the component + Returns: + A string containing the name of the component + """ + return COMPONENT_LIST[self.index][0] + + def get_description(self): + """ + Retrieves the description of the component + Returns: + A string containing the description of the component + """ + return COMPONENT_LIST[self.index][1] + + def __get_bios_version(self): + # Retrieves the BIOS firmware version + try: + with open(BIOS_VERSION_PATH, 'r') as fd: + bios_version = fd.read() + return bios_version.strip() + except Exception as e: + return None + + def get_firmware_version(self): + """ + Retrieves the firmware version of module + Returns: + string: The firmware versions of the module + """ + fw_version = None + if self.name == "BIOS": + fw_version = self.__get_bios_version() + elif "CPLD" in self.name: + cmd = "i2cget -f -y {0} {1} 0x1".format(self.cpld_mapping[self.index][0], self.cpld_mapping[self.index][1]) + status, value = subprocess.getstatusoutput(cmd) + if not status: + fw_version = value.rstrip() + + return fw_version + + def install_firmware(self, image_path): + """ + Install firmware to module + Args: + image_path: A string, path to firmware image + Returns: + A boolean, True if install successfully, False if not + """ + raise NotImplementedError diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/eeprom.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/eeprom.py new file mode 100644 index 000000000000..a87ecc9f6feb --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/eeprom.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +try: + from sonic_platform_pddf_base.pddf_eeprom import PddfEeprom +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Eeprom(PddfEeprom): + + def __init__(self, pddf_data=None, pddf_plugin_data=None): + PddfEeprom.__init__(self, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/event.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/event.py new file mode 100644 index 000000000000..d5dac6d7f7e0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/event.py @@ -0,0 +1,60 @@ +try: + import time + from sonic_py_common.logger import Logger +except ImportError as e: + raise ImportError(repr(e) + " - required module not found") + +POLL_INTERVAL_IN_SEC = 1 + +class SfpEvent: + ''' Listen to insert/remove sfp events ''' + + def __init__(self, sfp_list): + self._sfp_list = sfp_list + self._logger = Logger() + self._sfp_change_event_data = {'present': 0} + + def get_presence_bitmap(self): + bitmap = 0 + for sfp in self._sfp_list: + modpres = sfp.get_presence() + i=sfp.get_position_in_parent() - 1 + if modpres: + bitmap = bitmap | (1 << i) + return bitmap + + def get_sfp_event(self, timeout=2000): + port_dict = {} + change_dict = {} + change_dict['sfp'] = port_dict + + if timeout < 1000: + cd_ms = 1000 + else: + cd_ms = timeout + + while cd_ms > 0: + bitmap = self.get_presence_bitmap() + changed_ports = self._sfp_change_event_data['present'] ^ bitmap + if changed_ports != 0: + break + time.sleep(POLL_INTERVAL_IN_SEC) + # timeout=0 means wait for event forever + if timeout != 0: + cd_ms = cd_ms - POLL_INTERVAL_IN_SEC * 1000 + + if changed_ports != 0: + for sfp in self._sfp_list: + i=sfp.get_position_in_parent() - 1 + if (changed_ports & (1 << i)): + if (bitmap & (1 << i)) == 0: + port_dict[i+1] = '0' + else: + port_dict[i+1] = '1' + + + # Update the cache dict + self._sfp_change_event_data['present'] = bitmap + return True, change_dict + else: + return True, change_dict diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/fan.py new file mode 100644 index 000000000000..ef8deaffb6fa --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/fan.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python + + +try: + from sonic_platform_pddf_base.pddf_fan import PddfFan +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Fan(PddfFan): + """PDDF Platform-Specific Fan class""" + + def __init__(self, tray_idx, fan_idx=0, pddf_data=None, pddf_plugin_data=None, is_psu_fan=False, psu_index=0): + # idx is 0-based + PddfFan.__init__(self, tray_idx, fan_idx, pddf_data, pddf_plugin_data, is_psu_fan, psu_index) + + # Provide the functions/variables below for which implementation is to be overwritten + # Since AS4630 psu_fan airflow direction cant be read from sysfs, it is fixed as 'F2B' or 'Exhaust' + def get_direction(self): + """ + Retrieves the direction of fan + + Returns: + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + """ + if self.is_psu_fan: + direction = self.FAN_DIRECTION_EXHAUST + + else: + idx = (self.fantray_index-1)*self.platform['num_fans_pertray'] + self.fan_index + attr = "fan" + str(idx) + "_direction" + output = self.pddf_obj.get_attr_name_output("FAN-CTRL", attr) + if not output: + return False + + mode = output['mode'] + val = output['status'] + + val = val.rstrip() + vmap = self.plugin_data['FAN']['direction'][mode]['valmap'] + if val in vmap: + direction = vmap[val] + else: + direction = val + + return direction + diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..3b9bb607f632 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/fan_drawer.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python + + +try: + from sonic_platform_pddf_base.pddf_fan_drawer import PddfFanDrawer +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class FanDrawer(PddfFanDrawer): + """PDDF Platform-Specific Fan-Drawer class""" + + def __init__(self, tray_idx, pddf_data=None, pddf_plugin_data=None): + # idx is 0-based + PddfFanDrawer.__init__(self, tray_idx, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/platform.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/platform.py new file mode 100644 index 000000000000..406b1179ae1b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/platform.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +############################################################################# +# PDDF +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + + +try: + from sonic_platform_pddf_base.pddf_platform import PddfPlatform +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PddfPlatform): + """ + PDDF Platform-Specific Platform Class + """ + + def __init__(self): + PddfPlatform.__init__(self) + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/psu.py new file mode 100644 index 000000000000..f002f5e0394a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/psu.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# + + +try: + from sonic_platform_pddf_base.pddf_psu import PddfPsu +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + + +class Psu(PddfPsu): + """PDDF Platform-Specific PSU class""" + + PLATFORM_PSU_CAPACITY = 1200 + + def __init__(self, index, pddf_data=None, pddf_plugin_data=None): + PddfPsu.__init__(self, index, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten + def get_capacity(self): + """ + Gets the capacity (maximum output power) of the PSU in watts + + Returns: + An integer, the capacity of PSU + """ + return (self.PLATFORM_PSU_CAPACITY) + + def get_type(self): + """ + Gets the type of the PSU + + Returns: + A string, the type of PSU (AC/DC) + """ + ptype = "AC" + # Currently the platform supports only AC type of PSUs + #try: + #import sonic_platform.platform + #ch=sonic_platform.platform.Platform().get_chassis() + #e=ch.sys_eeprom.read_eeprom() + #ret, prod_name = ch.sys_eeprom.get_tlv_field(e,0x21) + #if ret: + #prod_name = prod_name[2] + ##print("Product name is {}".format(prod_name)) + #if '48V' in prod_name: + #ptype = 'DC' + #except Exception as e: + #print("Error while trying to read syseeprom to get PSU type") + + return ptype diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/sfp.py new file mode 100644 index 000000000000..c9fb07d6364f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/sfp.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +try: + from sonic_platform_pddf_base.pddf_sfp import PddfSfp +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + + +class Sfp(PddfSfp): + """ + PDDF Platform-Specific Sfp class + """ + + def __init__(self, index, pddf_data=None, pddf_plugin_data=None): + PddfSfp.__init__(self, index, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten + def get_position_in_parent(self): + """Retrieves 1-based relative physical position in parent device.""" + return self.port_index diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/thermal.py new file mode 100644 index 000000000000..77d6ec7ae886 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/thermal.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python + + +try: + from sonic_platform_pddf_base.pddf_thermal import PddfThermal +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + + +class Thermal(PddfThermal): + """PDDF Platform-Specific Thermal class""" + + def __init__(self, index, pddf_data=None, pddf_plugin_data=None, is_psu_thermal=False, psu_index=0): + PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data, is_psu_thermal, psu_index) + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/watchdog.py new file mode 100644 index 000000000000..fe8554f6ec73 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform/watchdog.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +############################################################################# +# +# Module contains an implementation of platform specific watchdog API's +# +############################################################################# + +try: + from sonic_platform_pddf_base.pddf_watchdog import PddfWatchdog +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Watchdog(PddfWatchdog): + """ + PDDF Platform-specific Chassis class + """ + + def __init__(self): + PddfWatchdog.__init__(self) + self.timeout = 180 + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform_setup.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform_setup.py new file mode 100644 index 000000000000..59dad237f3b4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/sonic_platform_setup.py @@ -0,0 +1,25 @@ +from setuptools import setup + +setup( + name='sonic-platform', + version='1.0', + description='SONiC platform API implementation on Accton Platforms using PDDF', + license='Apache 2.0', + author='SONiC Team', + author_email='linuxnetdev@microsoft.com', + url='https://github.com/Azure/sonic-buildimage', + packages=['sonic_platform'], + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Environment :: Plugins', + 'Intended Audience :: Developers', + 'Intended Audience :: Information Technology', + 'Intended Audience :: System Administrators', + 'License :: OSI Approved :: Apache Software License', + 'Natural Language :: English', + 'Operating System :: POSIX :: Linux', + 'Programming Language :: Python :: 3.7', + 'Topic :: Utilities', + ], + keywords='sonic SONiC platform PLATFORM', +) diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor.py index 8913233366e2..b074177133aa 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor.py @@ -26,7 +26,7 @@ import logging.config import logging.handlers import time - import commands + import subprocess from as4630_54pe.fanutil import FanUtil from as4630_54pe.thermalutil import ThermalUtil except ImportError as e: @@ -200,7 +200,7 @@ def manage_fans(self): logging.critical('Alarm-Critical for temperature critical is detected, reset DUT') cmd_str="i2cset -y -f 3 0x60 0x4 0xE4" time.sleep(2); - status, output = commands.getstatusoutput(cmd_str) + status, output = subprocess.getstatusoutput(cmd_str) #logging.debug('ori_state=%d, current_state=%d, temp_val=%d\n\n',ori_state, fan_policy_state, temp_val) @@ -225,11 +225,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdlt:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG @@ -238,7 +238,7 @@ def main(argv): if sys.argv[1]== '-t': if len(sys.argv)!=5: - print "temp test, need input three temp" + print("temp test, need input three temp") return 0 i=0 @@ -247,11 +247,11 @@ def main(argv): i=i+1 test_temp = 1 log_level = logging.DEBUG - print test_temp_list + print(test_temp_list) fan = FanUtil() fan.set_fan_duty_cycle(50) - print "set default fan speed to 50%" + print("set default fan speed to 50%") monitor = device_monitor(log_file, log_level) # Loop forever, doing something useful hopefully: while True: diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor_fan.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor_fan.py index c775e86874b8..9e9645485bba 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor_fan.py +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor_fan.py @@ -124,7 +124,7 @@ def manage_fan(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -143,7 +143,7 @@ def manage_fan(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -165,11 +165,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor_psu.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor_psu.py index 02f4541127a7..8a5993f58240 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor_psu.py +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor_psu.py @@ -96,7 +96,7 @@ def manage_psu(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -117,7 +117,7 @@ def manage_psu(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -143,11 +143,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_pddf_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_pddf_monitor.py new file mode 100755 index 000000000000..d9299b96a3b2 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_pddf_monitor.py @@ -0,0 +1,332 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -* +# Copyright (c) 2019 Edgecore Networks Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT +# LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS +# FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. +# +# See the Apache Version 2.0 License for specific language governing +# permissions and limitations under the License. +# +# HISTORY: +# mm/dd/yyyy (A.D.)# +# 10/24/2019:Jostar create for as4630_54pe thermal plan +# ------------------------------------------------------------------ + +try: + import os + import sys + import getopt + import subprocess + import logging + import logging.handlers + import time + from sonic_platform import platform +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + +# Deafults +VERSION = '1.0' +FUNCTION_NAME = '/usr/local/bin/accton_as4630_54pe_pddf_monitor' + + + + + +# Temperature Policy +# If any fan fail , please set fan speed register to 16 +# The max value of fan speed register is 14 +# LM77(48)+LM75(4B)+LM75(4A) > 140, Set 10 +# LM77(48)+LM75(4B)+LM75(4A) > 150, Set 12 +# LM77(48)+LM75(4B)+LM75(4A) > 160, Set 14 +# LM77(48)+LM75(4B)+LM75(4A) < 140, Set 8 +# LM77(48)+LM75(4B)+LM75(4A) < 150, Set 10 +# LM77(48)+LM75(4B)+LM75(4A) < 160, Set 12 +# Reset DUT:LM77(48)>=70C +# +class switch(object): + def __init__(self, value): + self.value = value + self.fall = False + + def __iter__(self): + """Return the match method once, then stop""" + yield self.match + raise StopIteration + + def match(self, *args): + """Indicate whether or not to enter a case suite""" + if self.fall or not args: + return True + elif self.value in args: # changed for v1.5, see below + self.fall = True + return True + else: + return False + + +def as4630_54pe_set_fan_speed(pwm): + # This platform has 2 fans controlled by one register on CPLD and 3rd fan by another register + # Hence, we need to change the speed for all + if pwm < 0 or pwm > 100: + print("Error: Wrong duty cycle value %d" % (pwm)) + platform_chassis.get_fan(0).set_speed(pwm) + platform_chassis.get_fan(2).set_speed(pwm) + + return 0 + + +fan_policy_state = 0 +fan_fail = 0 +fan_fail_list = [0, 0, 0] +alarm_state = 0 # 0->default or clear, 1-->alarm detect +test_temp = 0 +simulate_temp_decline = 0 +test_temp_list = [0, 0, 0] +temp_test_data = 0 +test_temp_revert = 0 +platform_chassis = None +# Make a class we can use to capture stdout and sterr in the log + + +class device_monitor(object): + # static temp var + temp = 0 + new_pwm = 0 + pwm = 0 + ori_pwm = 0 + default_pwm = 0x4 + + def __init__(self, log_file, log_level): + """Needs a logger and a logger level.""" + # set up logging to file + logging.basicConfig( + filename=log_file, + filemode='w', + level=log_level, + format='[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s', + datefmt='%H:%M:%S' + ) + # set up logging to console + if log_level == logging.DEBUG: + console = logging.StreamHandler() + console.setLevel(log_level) + formatter = logging.Formatter('%(asctime)-15s %(name)-12s: %(levelname)-8s %(message)s') + console.setFormatter(formatter) + logging.getLogger('').addHandler(console) + + sys_handler = logging.handlers.SysLogHandler(address='/dev/log') + sys_handler.setLevel(logging.WARNING) + logging.getLogger('').addHandler(sys_handler) + + def get_state_from_fan_policy(self, temp, policy): + state = 0 + for i in range(0, len(policy)): + if (temp > policy[i][2]): # temp_down + if temp <= policy[i][3]: # temp_up + state = i + + return state + + def manage_fans(self): + global fan_policy_state + global fan_fail + global fan_fail_list + global test_temp + global simulate_temp_decline + global test_temp_list + global alarm_state + global temp_test_data + global test_temp_revert + global platform_chassis + NUM_FANS = 3 + LEVEL_FAN_MIN = 0 + LEVEL_FAN_NORMAL = 1 + LEVEL_FAN_MID = 2 + LEVEL_FAN_HIGH = 3 + LEVEL_TEMP_CRITICAL = 4 + fan_policy = { + LEVEL_FAN_MIN: [50, 8, 0, 140000], + LEVEL_FAN_NORMAL: [62, 10, 140000, 150000], + LEVEL_FAN_MID: [75, 12, 150000, 160000], + LEVEL_FAN_HIGH: [88, 14, 160000, 240000], + LEVEL_TEMP_CRITICAL: [100, 16, 240000, 300000], + } + temp = [0, 0, 0] + + #thermal = ThermalUtil() + #fan = FanUtil() + # Supposedly all the fans are set with same duty cycle + ori_duty_cycle = platform_chassis.get_fan(0).get_speed() + new_duty_cycle = 0 + + if test_temp == 0: + for i in range(0, 3): + temp[i] = platform_chassis.get_thermal(i).get_temperature() + if temp[i] == 0.0 or temp[i] is None: + + logging.warning("Get temp-%d fail", i) + return False + temp[i] = int(temp[i]*1000) + else: + if test_temp_revert == 0: + temp_test_data = temp_test_data+2000 + else: + if temp_test_data > 0: + temp_test_data = temp_test_data-2000 + else: + # Stop the simulation + sys.exit('Simulation Ends !') + + for i in range(0, 3): + temp[i] = test_temp_list[i]+temp_test_data + fan_fail = 0 + + temp_val = 0 + for i in range(0, 3): + if temp[i] is None: + break + temp_val += temp[i] + + # Check Fan status + for i in range(NUM_FANS): + if not platform_chassis.get_fan(i).get_status(): + if test_temp == 0: + fan_fail = 1 + if fan_fail_list[i] == 0: + fan_fail_list[i] = 1 + else: + if fan_fail_list[i] == 1: + fan_fail_list[i] = 0 + + if sum(fan_fail_list) == NUM_FANS: + # Critical: Either all the fans are faulty or they are removed, shutdown the system + logging.critical('Alarm for all fan faulty/absent is detected') + logging.critical("Alarm for all fan faulty/absent is detected, reset DUT") + cmd_str = "i2cset -y -f 3 0x60 0x4 0xE4" + time.sleep(2) + subprocess.getstatusoutput('sync; sync; sync') + subprocess.getstatusoutput(cmd_str) + elif sum(fan_fail_list) != 0: + # Set the 100% speed only for first fan failure detection + logging.warning('Fan_{} failed, set remaining fan speed to 100%'.format( + ' Fan_'.join(str(item+1) for item, val in enumerate(fan_fail_list) if val == 1))) + new_pwm = 100 + as4630_54pe_set_fan_speed(new_pwm) + else: + fan_fail = 0 + + ori_state = fan_policy_state + fan_policy_state = self.get_state_from_fan_policy(temp_val, fan_policy) + + if fan_policy_state > LEVEL_TEMP_CRITICAL or fan_policy_state < LEVEL_FAN_MIN: + logging.error("Get error fan current_state\n") + return 0 + + # Decision : Decide new fan pwm percent. + if fan_fail == 0 and ori_duty_cycle != fan_policy[fan_policy_state][0]: + new_duty_cycle = fan_policy[fan_policy_state][0] + as4630_54pe_set_fan_speed(new_duty_cycle) + if test_temp == 1: + time.sleep(3) + status, output = subprocess.getstatusoutput('pddf_fanutil getspeed') + logging.debug('\n%s\n', output) + + if temp[0] >= 70000: # LM77-48 + # critical case*/ + logging.critical('Alarm for temperature critical is detected') + logging.critical("Alarm-Critical for temperature critical is detected, reset DUT") + # Update the reboot cause file to reflect that critical temperature + # has been crossed. Upon next boot, the contents of this file will + # be used to determine the cause of the previous reboot + status, output = subprocess.getstatusoutput( + 'echo "Thermal Overload: Other" > /host/reboot-cause/reboot-cause.txt') + status, output = subprocess.getstatusoutput( + 'echo "System rebooted because alarm for critical temperature (70 C) is detected [Time: $(eval date)]" >> /host/reboot-cause/reboot-cause.txt') + if status: + logging.warning('Reboot cause file not updated. {}'.format(output)) + + cmd_str = "i2cset -y -f 3 0x60 0x4 0xE4" + subprocess.getstatusoutput('sync; sync; sync') + time.sleep(3) + subprocess.getstatusoutput(cmd_str) + + logging.debug('ori_state=%d, current_state=%d, temp_val=%d\n\n', ori_state, fan_policy_state, temp_val) + + if ori_state < LEVEL_FAN_HIGH: + if fan_policy_state >= LEVEL_FAN_HIGH: + if alarm_state == 0: + logging.warning('Alarm for temperature high is detected') + alarm_state = 1 + # Add a mechanism to decrease the test_temp values + if simulate_temp_decline == 1: + logging.info('Temperature decline simulation is ON. Testing temperature will decrease now') + test_temp_revert = 1 + + if fan_policy_state < LEVEL_FAN_MID: + if alarm_state == 1: + logging.warning('Alarm for temperature high is cleared') + alarm_state = 0 + + return True + + +def main(argv): + # Check if PDDF mode is enabled + if not os.path.exists('/usr/share/sonic/platform/pddf_support'): + print("PDDF mode is not enabled") + return 0 + + log_file = '%s.log' % FUNCTION_NAME + log_level = logging.INFO + global test_temp + global simulate_temp_decline + if len(sys.argv) != 1: + try: + opts, args = getopt.getopt(argv, 'hdlt:', ['lfile=']) + except getopt.GetoptError: + print('Usage: %s [-d] [-l ]' % sys.argv[0]) + return 0 + for opt, arg in opts: + if opt == '-h': + print('Usage: %s [-d] [-l ]' % sys.argv[0]) + return 0 + elif opt in ('-d', '--debug'): + log_level = logging.DEBUG + elif opt in ('-l', '--lfile'): + log_file = arg + + if sys.argv[1] == '-t': + if len(sys.argv) != 6: + print("temp test, need input temp decline option and three temp values") + return 0 + + i = 0 + simulate_temp_decline = int(sys.argv[2]) + for x in range(3, 6): + test_temp_list[i] = int(sys.argv[x])*1000 + i = i+1 + test_temp = 1 + log_level = logging.DEBUG + print(test_temp_list) + + global platform_chassis + platform_chassis = platform.Platform().get_chassis() + + as4630_54pe_set_fan_speed(50) + + monitor = device_monitor(log_file, log_level) + # Loop forever, doing something useful hopefully: + while True: + monitor.manage_fans() + time.sleep(10) # 10sec + + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_util.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_util.py index 80dfd497c2d9..b954da8726d2 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_util.py @@ -30,6 +30,7 @@ import sys import logging import time +import os PROJECT_NAME = 'as4630_54pe' version = '0.0.1' @@ -118,13 +119,16 @@ def main(): elif opt in ('-f', '--force'): FORCE = 1 else: - print("TEST") logging.info('no option') for arg in args: if arg == 'install': do_install() elif arg == 'clean': do_uninstall() + elif arg == 'api': + do_sonic_platform_install() + elif arg == 'api_clean': + do_sonic_platform_clean() else: show_help() @@ -167,6 +171,8 @@ def driver_inserted(): kos = [ 'depmod -ae', 'modprobe i2c_dev', +'modprobe i2c_i801', +'modprobe i2c_ismt', 'modprobe i2c_mux_pca954x force_deselect_on_exit=1', 'modprobe ym2651y', 'modprobe x86_64_accton_as4630_54pe_cpld', @@ -176,17 +182,7 @@ def driver_inserted(): def driver_install(): global FORCE - - ret=log_os_system("lsmod|grep i2c_ismt",1) - my_log("rmmond i2cismt") - log_os_system("rmmod i2c_ismt", 1) - log_os_system("rmmod i2c_i801", 1) - log_os_system("modprobe i2c-i801", 1) - time.sleep(1) - log_os_system("modprobe i2c-ismt", 1) - - - + for i in range(0,len(kos)): status, output = log_os_system(kos[i], 1) if status: @@ -226,6 +222,13 @@ def device_install(): if FORCE == 0: return status + # set all pca954x idle_disconnect + cmd = 'echo -2 | tee /sys/bus/i2c/drivers/pca954x/*-00*/idle_state' + status, output = log_os_system(cmd, 1) + if status: + print(output) + if FORCE == 0: + return status for i in range(0,len(sfp_map)): if(i < 4): opt='optoe2' @@ -287,6 +290,44 @@ def system_ready(): return False return True +PLATFORM_ROOT_PATH = '/usr/share/sonic/device' +PLATFORM_API2_WHL_FILE_PY3 ='sonic_platform-1.0-py3-none-any.whl' +def do_sonic_platform_install(): + device_path = "{}{}{}{}".format(PLATFORM_ROOT_PATH, '/x86_64-accton_', PROJECT_NAME, '-r0') + SONIC_PLATFORM_BSP_WHL_PKG_PY3 = "/".join([device_path, PLATFORM_API2_WHL_FILE_PY3]) + + #Check API2.0 on py whl file + status, output = log_os_system("pip3 show sonic-platform > /dev/null 2>&1", 0) + if status: + if os.path.exists(SONIC_PLATFORM_BSP_WHL_PKG_PY3): + status, output = log_os_system("pip3 install "+ SONIC_PLATFORM_BSP_WHL_PKG_PY3, 1) + if status: + print ("Error: Failed to install {}".format(PLATFORM_API2_WHL_FILE_PY3)) + return status + else: + print("Successfully installed {} package".format(PLATFORM_API2_WHL_FILE_PY3)) + else: + print('{} is not found'.format(PLATFORM_API2_WHL_FILE_PY3)) + else: + print('{} has installed'.format(PLATFORM_API2_WHL_FILE_PY3)) + + return + +def do_sonic_platform_clean(): + status, output = log_os_system("pip3 show sonic-platform > /dev/null 2>&1", 0) + if status: + print('{} does not install, not need to uninstall'.format(PLATFORM_API2_WHL_FILE_PY2)) + + else: + status, output = log_os_system("pip3 uninstall sonic-platform -y", 0) + if status: + print('Error: Failed to uninstall {}'.format(PLATFORM_API2_WHL_FILE_PY3)) + return status + else: + print('{} is uninstalled'.format(PLATFORM_API2_WHL_FILE_PY3)) + + return + def do_install(): if driver_inserted() == False: status = driver_install() @@ -308,6 +349,9 @@ def do_install(): if status: if FORCE == 0: return status + + do_sonic_platform_install() + return def do_uninstall(): @@ -329,6 +373,8 @@ def do_uninstall(): if FORCE == 0: return status + do_sonic_platform_clean() + return def device_exist(): diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/handle_mgmt_interface.sh b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/handle_mgmt_interface.sh new file mode 100755 index 000000000000..e1acd16a0161 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/handle_mgmt_interface.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +#Due to the hardware design, as4630-54pe use "eth2" instead of "eth0" as management interface. +#Rename netdev "eth0" and "eth2" to swap original "eth2" to "eth0". + +ifconfig eth0 down +ip link set eth0 name eth3 +ip link set eth2 name eth0 +ifconfig eth0 up diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/pddf_post_device_create.sh b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/pddf_post_device_create.sh new file mode 100755 index 000000000000..d820352ac7e0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/pddf_post_device_create.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +echo "Setting LED MAC Mode.." +i2cset -y -f 3 0x60 0x2a 0xff +i2cset -y -f 3 0x60 0x2b 0xff +i2cset -y -f 3 0x60 0x86 0x89 +echo "Setting LED MAC Mode..DONE" +# Turn off STK1 and STK2 LED. Bit5:4 to 0x11 +#i2cset -y -f 3 0x60 0xb5 +stk_val=$(i2cget -y -f 3 0x60 0x31) +new_val=$((${stk_val}|0x30)) +i2cset -y -f 3 0x60 0x31 ${new_val} +echo "STK LEDs are turned off successfully" + diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/pddf_switch_svc.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/pddf_switch_svc.py new file mode 100755 index 000000000000..5a505e19f19b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/pddf_switch_svc.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python +# Script to stop and start the respective platforms default services. +# This will be used while switching the pddf->non-pddf mode and vice versa + +import commands + +def check_pddf_support(): + return True + +def stop_platform_svc(): + status, output = commands.getstatusoutput("systemctl disable as4630-54pe-platform-monitor-fan.service") + if status: + print "Disable as4630-54pe-platform-monitor-fan.service failed %d"%status + return False + status, output = commands.getstatusoutput("systemctl stop as4630-54pe-platform-monitor-fan.service") + if status: + print "Stop as4630-54pe-platform-monitor-fan.service failed %d"%status + return False + + status, output = commands.getstatusoutput("systemctl disable as4630-54pe-platform-monitor-psu.service") + if status: + print "Disable as4630-54pe-platform-monitor-psu.service failed %d"%status + return False + status, output = commands.getstatusoutput("systemctl stop as4630-54pe-platform-monitor-psu.service") + if status: + print "Stop as4630-54pe-platform-monitor-psu.service failed %d"%status + return False + + status, output = commands.getstatusoutput("systemctl disable as4630-54pe-platform-monitor.service") + if status: + print "Disable as4630-54pe-platform-monitor.service failed %d"%status + return False + status, output = commands.getstatusoutput("systemctl stop as4630-54pe-platform-monitor.service") + if status: + print "Stop as4630-54pe-platform-monitor.service failed %d"%status + return False + + status, output = commands.getstatusoutput("/usr/local/bin/accton_as4630_54pe_util.py clean") + if status: + print "accton_as4630_54pe_util.py clean command failed %d"%status + return False + + # HACK , stop the pddf-platform-init service if it is active + status, output = commands.getstatusoutput("systemctl stop pddf-platform-init.service") + if status: + print "Stop pddf-platform-init.service along with other platform serives failed %d"%status + return False + status, output = commands.getstatusoutput("systemctl stop as4630-54pe-pddf-platform-monitor.service") + if status: + print "Stop as4630-54pe-pddf-platform-monitor.service along with other platform serives failed %d"%status + return False + + return True + +def start_platform_svc(): + status, output = commands.getstatusoutput("/usr/local/bin/accton_as4630_54pe_util.py install") + if status: + print "accton_as4630_54pe_util.py install command failed %d"%status + return False + + status, output = commands.getstatusoutput("systemctl enable as4630-54pe-platform-monitor-fan.service") + if status: + print "Enable as4630-54pe-platform-monitor-fan.service failed %d"%status + return False + status, output = commands.getstatusoutput("systemctl start as4630-54pe-platform-monitor-fan.service") + if status: + print "Start as4630-54pe-platform-monitor-fan.service failed %d"%status + return False + + status, output = commands.getstatusoutput("systemctl enable as4630-54pe-platform-monitor-psu.service") + if status: + print "Enable as4630-54pe-platform-monitor-psu.service failed %d"%status + return False + status, output = commands.getstatusoutput("systemctl start as4630-54pe-platform-monitor-psu.service") + if status: + print "Start as4630-54pe-platform-monitor-psu.service failed %d"%status + return False + + status, output = commands.getstatusoutput("systemctl enable as4630-54pe-platform-monitor.service") + if status: + print "Enable as4630-54pe-platform-monitor.service failed %d"%status + return False + status, output = commands.getstatusoutput("systemctl start as4630-54pe-platform-monitor.service") + if status: + print "Start as4630-54pe-platform-monitor.service failed %d"%status + return False + + return True + +def start_platform_pddf(): + status, output = commands.getstatusoutput("systemctl start pddf-platform-init.service") + if status: + print "Start pddf-platform-init.service failed %d"%status + return False + status, output = commands.getstatusoutput("systemctl start as4630-54pe-pddf-platform-monitor.service") + if status: + print "Start as4630-54pe-pddf-platform-monitor.service failed %d"%status + return False + + return True + +def stop_platform_pddf(): + status, output = commands.getstatusoutput("systemctl stop pddf-platform-init.service") + if status: + print "Stop pddf-platform-init.service failed %d"%status + return False + status, output = commands.getstatusoutput("systemctl stop as4630-54pe-pddf-platform-monitor.service") + if status: + print "Stop as4630-54pe-pddf-platform-monitor.service failed %d"%status + return False + + return True + +def main(): + pass + +if __name__ == "__main__": + main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/classes/fanutil.py index 121b8409a585..ced84e191a75 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/classes/fanutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/classes/fanutil.py @@ -165,7 +165,7 @@ def get_fan_duty_cycle(self): try: val_file = open(self.FAN_DUTY_PATH) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() @@ -177,7 +177,7 @@ def set_fan_duty_cycle(self, val): try: fan_file = open(self.FAN_DUTY_PATH, 'r+') except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False fan_file.write(str(val)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-cpld.c b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-cpld.c index 98b855329c64..317eac3a4cbb 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-cpld.c +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-cpld.c @@ -97,13 +97,16 @@ static const struct i2c_device_id as4630_54te_cpld_id[] = { MODULE_DEVICE_TABLE(i2c, as4630_54te_cpld_id); #define TRANSCEIVER_PRESENT_ATTR_ID(index) MODULE_PRESENT_##index +#define TRANSCEIVER_RESET_ATTR_ID(index) MODULE_RESET_##index +#define TRANSCEIVER_LPMODE_ATTR_ID(index) MODULE_LPMODE_##index +#define TRANSCEIVER_PRESENT_ATTR_ID(index) MODULE_PRESENT_##index #define TRANSCEIVER_TXDISABLE_ATTR_ID(index) MODULE_TXDISABLE_##index -#define TRANSCEIVER_RXLOS_ATTR_ID(index) MODULE_RXLOS_##index -#define TRANSCEIVER_TXFAULT_ATTR_ID(index) MODULE_TXFAULT_##index +#define TRANSCEIVER_RXLOS_ATTR_ID(index) MODULE_RXLOS_##index +#define TRANSCEIVER_TXFAULT_ATTR_ID(index) MODULE_TXFAULT_##index #define FAN_SPEED_RPM_ATTR_ID(index) FAN_SPEED_RPM_##index -#define FAN_DIRECTION_ID(index) FAN_DIRECTION_##index +#define FAN_DIRECTION_ID(index) FAN_DIRECTION_##index #define FAN_PRESENT_ATTR_ID(index) FAN_PRESENT_##index -#define FAN_FAULT_ATTR_ID(index) FAN_FAULT_##index +#define FAN_FAULT_ATTR_ID(index) FAN_FAULT_##index enum as4630_54te_cpld_sysfs_attributes { CPLD_VERSION, @@ -123,6 +126,10 @@ enum as4630_54te_cpld_sysfs_attributes { TRANSCEIVER_PRESENT_ATTR_ID(52), TRANSCEIVER_PRESENT_ATTR_ID(53), TRANSCEIVER_PRESENT_ATTR_ID(54), + TRANSCEIVER_RESET_ATTR_ID(53), + TRANSCEIVER_RESET_ATTR_ID(54), + TRANSCEIVER_LPMODE_ATTR_ID(53), + TRANSCEIVER_LPMODE_ATTR_ID(54), TRANSCEIVER_TXDISABLE_ATTR_ID(49), TRANSCEIVER_TXDISABLE_ATTR_ID(50), TRANSCEIVER_TXDISABLE_ATTR_ID(51), @@ -148,6 +155,8 @@ static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf); static ssize_t set_tx_disable(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t set_qsfp(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); static ssize_t access(struct device *dev, struct device_attribute *da, const char *buf, size_t count); static ssize_t show_version(struct device *dev, struct device_attribute *da, @@ -160,11 +169,6 @@ static struct as4630_54te_cpld_data *as4630_54te_fan_update_device(struct device static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf); static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, const char *buf, size_t count); -static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, char *buf); -//static ssize_t show_power(struct device *dev, struct device_attribute *da, - // char *buf); - - /* transceiver attributes */ #define DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(index) \ @@ -180,9 +184,13 @@ static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, cha &sensor_dev_attr_module_tx_fault_##index.dev_attr.attr #define DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_lpmode_##index, S_IRUGO | S_IWUSR, show_status, set_qsfp, MODULE_LPMODE_##index); \ + static SENSOR_DEVICE_ATTR(module_reset_##index, S_IRUGO | S_IWUSR, show_status, set_qsfp, MODULE_RESET_##index); \ static SENSOR_DEVICE_ATTR(module_present_##index, S_IRUGO, show_status, NULL, MODULE_PRESENT_##index); #define DECLARE_QSFP_TRANSCEIVER_ATTR(index) \ + &sensor_dev_attr_module_lpmode_##index.dev_attr.attr, \ + &sensor_dev_attr_module_reset_##index.dev_attr.attr, \ &sensor_dev_attr_module_present_##index.dev_attr.attr @@ -204,10 +212,7 @@ static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, cha static SENSOR_DEVICE_ATTR(fan_duty_cycle_percentage, S_IWUSR | S_IRUGO, fan_show_value, set_duty_cycle, FAN_DUTY_CYCLE_PERCENTAGE); #define DECLARE_FAN_DUTY_CYCLE_ATTR(index) &sensor_dev_attr_fan_duty_cycle_percentage.dev_attr.attr -#define DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR() \ - static SENSOR_DEVICE_ATTR(sys_temp, S_IRUGO, get_sys_temp, NULL, FAN_DUTY_CYCLE_PERCENTAGE) -#define DECLARE_FAN_SYSTEM_TEMP_ATTR() &sensor_dev_attr_sys_temp.dev_attr.attr static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, NULL, CPLD_VERSION); static SENSOR_DEVICE_ATTR(access, S_IWUSR, NULL, access, ACCESS); @@ -273,7 +278,7 @@ static ssize_t show_status(struct device *dev, struct device_attribute *da, break; case MODULE_TXDISABLE_49 ... MODULE_TXDISABLE_50: reg=0x5; - mask=0x1 << (attr->index==MODULE_TXFAULT_49?7:3); + mask=0x1 << (attr->index==MODULE_TXDISABLE_49?7:3); break; case MODULE_RXLOS_51 ... MODULE_RXLOS_52: @@ -290,12 +295,22 @@ static ssize_t show_status(struct device *dev, struct device_attribute *da, break; case MODULE_TXDISABLE_51 ... MODULE_TXDISABLE_52: reg=0x6; - mask=0x1 << (attr->index==MODULE_TXFAULT_51?7:3); + mask=0x1 << (attr->index==MODULE_TXDISABLE_51?7:3); break; case MODULE_PRESENT_53 ... MODULE_PRESENT_54: reg=0x21; mask=0x1 << (attr->index==MODULE_PRESENT_53?0:4); break; + case MODULE_RESET_53 ... MODULE_RESET_54: + reg=0x21; + mask=0x1 << (attr->index==MODULE_RESET_53?3:7); + revert = 1; + break; + case MODULE_LPMODE_53 ... MODULE_LPMODE_54: + reg = 0x21; + mask = 0x1 << (attr->index==MODULE_LPMODE_53?2:6); + revert = 0; + break; default: return 0; } @@ -319,6 +334,61 @@ static ssize_t show_status(struct device *dev, struct device_attribute *da, return status; } +static ssize_t set_qsfp(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as4630_54te_cpld_data *data = i2c_get_clientdata(client); + long disable; + int status; + u8 reg = 0, mask = 0, revert = 0; + + status = kstrtol(buf, 10, &disable); + if (status) { + return status; + } + reg = 0x21; + switch (attr->index) + { + case MODULE_RESET_53 ... MODULE_RESET_54: + mask=0x1 << (attr->index==MODULE_RESET_53?3:7); + revert = 1; + break; + case MODULE_LPMODE_53 ... MODULE_LPMODE_54: + mask=0x1 << (attr->index==MODULE_LPMODE_53?2:6); + revert = 0; + break; + default: + return 0; + } + + disable = revert ? disable : !disable; + /* Read current status */ + mutex_lock(&data->update_lock); + status = as4630_54te_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + if (disable) { + status &= ~mask; + } + else { + status |= mask; + } + status = as4630_54te_cpld_write_internal(client, reg, status); + if (unlikely(status < 0)) { + goto exit; + } + + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + static ssize_t set_tx_disable(struct device *dev, struct device_attribute *da, const char *buf, size_t count) { @@ -338,7 +408,7 @@ static ssize_t set_tx_disable(struct device *dev, struct device_attribute *da, { case MODULE_TXDISABLE_49 ... MODULE_TXDISABLE_50: reg=0x5; - mask=0x1 << (attr->index==MODULE_TXFAULT_49?7:3); + mask=0x1 << (attr->index==MODULE_TXDISABLE_49?7:3); break; case MODULE_TXDISABLE_51 ... MODULE_TXDISABLE_52: reg=0x6; @@ -357,10 +427,10 @@ static ssize_t set_tx_disable(struct device *dev, struct device_attribute *da, } /* Update tx_disable status */ if (disable) { - status &= ~mask; + status |= mask; } else { - status |= mask; + status &= ~mask; } status = as4630_54te_cpld_write_internal(client, reg, status); if (unlikely(status < 0)) { @@ -498,7 +568,7 @@ static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, static u8 reg_val_to_direction(u8 reg_val, enum fan_id id) { - u8 mask = (1 << id); + u8 mask = (1 << id+4); reg_val &= mask; @@ -531,268 +601,6 @@ static u8 is_fan_fault(struct as4630_54te_cpld_data *data, enum fan_id id) return ret; } -/* Due to this struct is declared at lm75.c, it cannot be include - * under Sonic environment. I duplicate it from lm75.c. - */ -struct lm75_data { - struct i2c_client *client; - struct device *hwmon_dev; - struct thermal_zone_device *tz; - struct mutex update_lock; - u8 orig_conf; - u8 resolution; /* In bits, between 9 and 12 */ - u8 resolution_limits; - char valid; /* !=0 if registers are valid */ - unsigned long last_updated; /* In jiffies */ - unsigned long sample_time; /* In jiffies */ - s16 temp[3]; /* Register values, - 0 = input - 1 = max - 2 = hyst */ -}; - -/*Copied from lm75.c*/ -static inline long lm75_reg_to_mc(s16 temp, u8 resolution) -{ - return ((temp >> (16 - resolution)) * 1000) >> (resolution - 8); -} - -/*Get hwmon_dev from i2c_client, set hwmon_dev = NULL is failed.*/ -static struct device * get_hwmon_dev( - struct i2c_client *client) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - if(data) - { - if( data->valid == 1 && data->hwmon_dev) - { - return data->hwmon_dev; - } - - } - return NULL; -} - -/* To find hwmon index by opening hwmon under that i2c address. - */ -static int find_hwmon_index_by_FileOpen( - int bus_nr, - unsigned short addr, - int *index) -{ -#define MAX_HWMON_DEVICE (10) /* Find hwmon device in 0~10*/ - struct file *sfd; - char client_name[96]; - int i=0; - - do { - snprintf(client_name, sizeof(client_name), - "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", - bus_nr, addr, i); - - sfd = filp_open(client_name, O_RDONLY, 0); - i++; - } while( IS_ERR(sfd) && i < MAX_HWMON_DEVICE); - - if (IS_ERR(sfd)) { - pr_err("Failed to open file(%s)#%d\r\n", client_name, __LINE__); - return -ENOENT; - } - filp_close(sfd, 0); - *index = i - 1; - return 0; - -#undef MAX_HWMON_DEVICE -} - -static int get_temp_file_path( - int bus_nr, unsigned short addr, - struct device *hwmon_dev - ,char *path, int max_len) -{ - - if(hwmon_dev && strlen(dev_name(hwmon_dev))) - { - snprintf(path, max_len, - "/sys/bus/i2c/devices/%d-%04x/hwmon/%s/temp1_input", - bus_nr, addr, dev_name(hwmon_dev)); - } - else - { - int i=0; - if(find_hwmon_index_by_FileOpen( bus_nr, addr, &i)) - { - return -EIO; - } - snprintf(path, max_len, - "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", - bus_nr, addr, i); - } - - return 0; -} - -/*File read the dev file at user space.*/ -static int read_devfile_temp1_input( - struct device *dev, - int bus_nr, - unsigned short addr, - struct device *hwmon_dev, - int *miniCelsius) -{ - struct file *sfd; - char buffer[96]; - char devfile[96]; - int rc, status; - int rdlen, value; - mm_segment_t old_fs; - - rc = 0; - get_temp_file_path(bus_nr, addr, hwmon_dev, devfile, sizeof(devfile)); - sfd = filp_open(devfile, O_RDONLY, 0); - if (IS_ERR(sfd)) { - pr_err("Failed to open file(%s)#%d\r\n", devfile, __LINE__); - return -ENOENT; - } - dev_dbg(dev, "Found device:%s\n",devfile); - - if(!(sfd->f_op) || !(sfd->f_op->read) ) { - pr_err("file %s cann't readable ?\n",devfile); - return -ENOENT; - } - - old_fs = get_fs(); - set_fs(KERNEL_DS); - rdlen = sfd->f_op->read(sfd, buffer, sizeof(buffer), &sfd->f_pos); - if (rdlen == 0) { - pr_err( "File(%s) empty!\n", devfile); - rc = -EIO; - goto exit; - } - status = sscanf(buffer, "%d", &value); - if (status != 1) { - rc = -EIO; - goto exit; - } - *miniCelsius = value; - dev_dbg(dev,"found sensors: %d @i2c %d-%04x\n", value, bus_nr, addr); - -exit: - set_fs(old_fs); - filp_close(sfd, 0); - return rc; -} - -static u8 is_lm75_data_due(struct i2c_client *client) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - if (time_after(jiffies, data->last_updated + data->sample_time)) - { - return 1; - } - return 0; -} -static int get_lm75_temp(struct i2c_client *client, int *miniCelsius) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - *miniCelsius = lm75_reg_to_mc(data->temp[0], data->resolution); - - return 0; -} - -static bool lm75_addr_mached(unsigned short addr) -{ - int i; - unsigned short addrs[] = THERMAL_SENSORS_ADDRS; - - for (i = 0; i < ARRAY_SIZE(addrs); i++) - { - if( addr == addrs[i]) - return 1; - } - return 0; -} - -static int _find_lm75_device(struct device *dev, void *data) -{ - struct device_driver *driver; - struct as4630_54te_cpld_data *prv = data; - char *driver_name = THERMAL_SENSORS_DRIVER; - - driver = dev->driver; - if (driver && driver->name && - strcmp(driver->name, driver_name) == 0) - { - struct i2c_client *client; - client = to_i2c_client(dev); - if (client) - { - /*cannot use "struct i2c_adapter *adap = to_i2c_adapter(dev);"*/ - struct i2c_adapter *adap = client->adapter; - int miniCelsius = 0; - - if (! lm75_addr_mached(client->addr)) - { - return 0; - } - - if (!adap) { - return -ENXIO; - } - - /* If the data is not updated, read them from devfile - to drive them updateing data from chip.*/ - if (is_lm75_data_due(client)) - { - struct device *hwmon_dev; - - hwmon_dev = get_hwmon_dev(client); - if(0 == read_devfile_temp1_input(dev, adap->nr, - client->addr, hwmon_dev, &miniCelsius)) - { - prv->system_temp += miniCelsius; - prv->sensors_found++; - } - - } - else - { - get_lm75_temp(client, &miniCelsius); - prv->system_temp += miniCelsius; - prv->sensors_found++; - - } - } - } - return 0; -} - -/*Find all lm75 devices and return sum of temperatures.*/ -static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, - char *buf) -{ - ssize_t ret = 0; - struct as4630_54te_cpld_data *data = as4630_54te_fan_update_device(dev); - - data->system_temp=0; - data->sensors_found=0; - i2c_for_each_dev(data, _find_lm75_device); - if (NUM_THERMAL_SENSORS != data->sensors_found) - { - dev_dbg(dev,"only %d of %d temps are found\n", - data->sensors_found, NUM_THERMAL_SENSORS); - data->system_temp = INT_MAX; - } - ret = sprintf(buf, "%d\n",data->system_temp); - return ret; -} - static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf) { diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor.py index 8c704ac60e86..d3c2b2c86094 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor.py @@ -223,11 +223,11 @@ def main(argv): try: opts, args = getopt.getopt(argv, 'hdlt:', ['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG @@ -236,7 +236,7 @@ def main(argv): if sys.argv[1] == '-t': if len(sys.argv) != 5: - print "temp test, need input three temp" + print("temp test, need input three temp") return 0 i = 0 @@ -245,11 +245,11 @@ def main(argv): i = i + 1 test_temp = 1 log_level = logging.DEBUG - print test_temp_list + print(test_temp_list) fan = FanUtil() fan.set_fan_duty_cycle(50) - print "set default fan speed to 50%" + print("set default fan speed to 50%") monitor = device_monitor(log_file, log_level) # Loop forever, doing something useful hopefully: while True: diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor_fan.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor_fan.py index 6d8ab0ea3c95..635e27ecbe38 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor_fan.py +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor_fan.py @@ -122,7 +122,7 @@ def manage_fan(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -142,7 +142,7 @@ def manage_fan(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -166,11 +166,11 @@ def main(argv): try: opts, args = getopt.getopt(argv, 'hdl:', ['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor_psu.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor_psu.py index 9bff640434bf..98b26ee10b72 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor_psu.py +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor_psu.py @@ -96,7 +96,7 @@ def manage_psu(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -120,7 +120,7 @@ def manage_psu(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -147,11 +147,11 @@ def main(argv): try: opts, args = getopt.getopt(argv, 'hdl:', ['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_util.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_util.py index 172a9842a8bf..7e325ed429c0 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_util.py @@ -29,7 +29,7 @@ set : change board setting with fan|led|sfp """ -import commands +import subprocess import getopt import sys import logging @@ -165,8 +165,8 @@ def main(): global FORCE if DEBUG: - print(sys.argv[0]) - print('ARGV : %s' % sys.argv[1:]) + print((sys.argv[0])) + print(('ARGV : %s' % sys.argv[1:])) if len(sys.argv) < 2: show_help() @@ -176,9 +176,9 @@ def main(): 'force', ]) if DEBUG: - print options - print args - print len(sys.argv) + print(options) + print(args) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -189,7 +189,7 @@ def main(): elif opt in ('-f', '--force'): FORCE = 1 else: - print "TEST" + print("TEST") logging.info('no option') for arg in args: if arg == 'install': @@ -223,42 +223,42 @@ def main(): def show_help(): - print __doc__ % {'scriptName': sys.argv[0].split("/")[-1]} + print(__doc__ % {'scriptName': sys.argv[0].split("/")[-1]}) sys.exit(0) def show_set_help(): cmd = sys.argv[0].split("/")[-1] + " " + args[0] - print cmd + " [led|sfp|fan]" - print " use \"" + cmd + " led 0-4 \" to set led color" - print " use \"" + cmd + " fan 0-100\" to set fan duty percetage" - print " use \"" + cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable" + print(cmd + " [led|sfp|fan]") + print(" use \"" + cmd + " led 0-4 \" to set led color") + print(" use \"" + cmd + " fan 0-100\" to set fan duty percetage") + print(" use \"" + cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable") sys.exit(0) def show_eeprom_help(): cmd = sys.argv[0].split("/")[-1] + " " + args[0] - print " use \"" + cmd + " 1-32 \" to dump sfp# eeprom" + print(" use \"" + cmd + " 1-32 \" to dump sfp# eeprom") sys.exit(0) def my_log(txt): if DEBUG: - print "[ACCTON DBG]: " + txt + print("[ACCTON DBG]: " + txt) return def log_os_system(cmd, show): logging.info('Run :' + cmd) output = "" - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) my_log(cmd + "with result:" + str(status)) my_log("cmd:" + cmd) my_log(" output:" + output) if status: logging.info('Failed :' + cmd) if show: - print('Failed :' + cmd) + print(('Failed :' + cmd)) return status, output @@ -274,7 +274,7 @@ def driver_inserted(): kos = [ 'depmod -ae', 'modprobe i2c_dev', - 'modprobe i2c_mux_pca954x force_deselect_on_exit=1', + 'modprobe i2c_mux_pca954x', 'modprobe ym2651y', 'modprobe x86_64_accton_as4630_54te_cpld', 'modprobe x86_64_accton_as4630_54te_leds', @@ -306,7 +306,7 @@ def driver_uninstall(): for i in range(0, len(kos)): rm = kos[-(i + 1)].replace("modprobe", "modprobe -rq") lst = rm.split(" ") - print "lst=%s" % lst + print("lst=%s" % lst) if len(lst) > 3: del(lst[3]) rm = " ".join(lst) @@ -327,9 +327,18 @@ def device_install(): status, output = log_os_system(mknod[i], 1) if status: - print output + print(output) if FORCE == 0: return status + + # set all pca954x idle_disconnect + cmd = 'echo -2 | tee /sys/bus/i2c/drivers/pca954x/*-00*/idle_state' + status, output = log_os_system(cmd, 1) + if status: + print(output) + if FORCE == 0: + return status + print("Check SFP") for i in range(0, len(sfp_map)): if(i < 4): @@ -342,7 +351,7 @@ def device_install(): str(sfp_map[i]) + "/new_device", 1) if status: - print output + print(output) if FORCE == 0: return status @@ -353,7 +362,7 @@ def device_install(): str(sfp_map[i]) + "-0050/port_name", 1) if status: - print output + print(output) if FORCE == 0: return status @@ -368,7 +377,7 @@ def device_uninstall(): str(sfp_map[i]) + "/delete_device" status, output = log_os_system("echo 0x50 > " + target, 1) if status: - print output + print(output) if FORCE == 0: return status @@ -381,7 +390,7 @@ def device_uninstall(): temp[-1] = temp[-1].replace('new_device', 'delete_device') status, output = log_os_system(" ".join(temp), 1) if status: - print output + print(output) if FORCE == 0: return status @@ -392,7 +401,7 @@ def system_ready(): if driver_inserted() == False: return False if not device_exist(): - print "not device_exist()" + print("not device_exist()") return False return True @@ -408,29 +417,29 @@ def do_sonic_platform_install(): if os.path.exists(SONIC_PLATFORM_BSP_WHL_PKG_PY3): status, output = log_os_system("pip3 install "+ SONIC_PLATFORM_BSP_WHL_PKG_PY3, 1) if status: - print "Error: Failed to install {}".format(PLATFORM_API2_WHL_FILE_PY3) + print("Error: Failed to install {}".format(PLATFORM_API2_WHL_FILE_PY3)) return status else: - print "Successfully installed {} package".format(PLATFORM_API2_WHL_FILE_PY3) + print("Successfully installed {} package".format(PLATFORM_API2_WHL_FILE_PY3)) else: - print('{} is not found'.format(PLATFORM_API2_WHL_FILE_PY3)) + print(('{} is not found'.format(PLATFORM_API2_WHL_FILE_PY3))) else: - print('{} has installed'.format(PLATFORM_API2_WHL_FILE_PY3)) + print(('{} has installed'.format(PLATFORM_API2_WHL_FILE_PY3))) return def do_sonic_platform_clean(): status, output = log_os_system("pip3 show sonic-platform > /dev/null 2>&1", 0) if status: - print('{} does not install, not need to uninstall'.format(PLATFORM_API2_WHL_FILE_PY3)) + print(('{} does not install, not need to uninstall'.format(PLATFORM_API2_WHL_FILE_PY3))) else: status, output = log_os_system("pip3 uninstall sonic-platform -y", 0) if status: - print('Error: Failed to uninstall {}'.format(PLATFORM_API2_WHL_FILE_PY3)) + print(('Error: Failed to uninstall {}'.format(PLATFORM_API2_WHL_FILE_PY3))) return status else: - print('{} is uninstalled'.format(PLATFORM_API2_WHL_FILE_PY3)) + print(('{} is uninstalled'.format(PLATFORM_API2_WHL_FILE_PY3))) return @@ -442,14 +451,14 @@ def do_install(): if FORCE == 0: return status else: - print PROJECT_NAME.upper() + " drivers detected...." + print(PROJECT_NAME.upper() + " drivers detected....") if not device_exist(): status = device_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper() + " devices detected...." + print(PROJECT_NAME.upper() + " devices detected....") for i in range(len(cpld_set)): status, output = log_os_system(cpld_set[i], 1) @@ -464,18 +473,18 @@ def do_install(): def do_uninstall(): if not device_exist(): - print PROJECT_NAME.upper() + " has no device installed...." + print(PROJECT_NAME.upper() + " has no device installed....") else: - print "Removing device...." + print("Removing device....") status = device_uninstall() if status: if FORCE == 0: return status if driver_inserted() == False: - print PROJECT_NAME.upper() + " has no driver installed...." + print(PROJECT_NAME.upper() + " has no driver installed....") else: - print "Removing installed driver...." + print("Removing installed driver....") status = driver_uninstall() if status: if FORCE == 0: @@ -533,11 +542,11 @@ def devices_info(): # show dict all in the order if DEBUG: for i in sorted(ALL_DEVICE.keys()): - print(i + ": ") + print((i + ": ")) for j in sorted(ALL_DEVICE[i].keys()): - print(" " + j) + print((" " + j)) for k in (ALL_DEVICE[i][j]): - print(" " + " " + k) + print((" " + " " + k)) return @@ -561,15 +570,15 @@ def show_eeprom(index): else: log = 'Failed : no hexdump cmd!!' logging.info(log) - print log + print(log) return 1 - print "node=%s" % node - print node + ":" + print("node=%s" % node) + print(node + ":") ret, log = log_os_system("cat " + node + "| " + hex_cmd + " -C", 1) if ret == 0: - print log + print(log) else: - print "**********device no found**********" + print("**********device no found**********") return @@ -604,10 +613,10 @@ def set_device(args): node = node.replace(node.split("/")[-1], 'fan1_duty_cycle_percentage') ret, log = log_os_system("cat " + node, 1) if ret == 0: - print ("Previous fan duty: " + log.strip() + "%") + print(("Previous fan duty: " + log.strip() + "%")) ret, log = log_os_system("echo " + args[1] + " >" + node, 1) if ret == 0: - print ("Current fan duty: " + args[1] + "%") + print(("Current fan duty: " + args[1] + "%")) return ret elif args[0] == 'sfp': if int(args[1]) > DEVICE_NO[args[0]] or int(args[1]) == 0: @@ -650,24 +659,24 @@ def device_traversal(): devices_info() for i in sorted(ALL_DEVICE.keys()): print("============================================") - print(i.upper() + ": ") + print((i.upper() + ": ")) print("============================================") - for j in sorted(ALL_DEVICE[i].keys(), key=get_value): - print " " + j + ":", + for j in sorted(list(ALL_DEVICE[i].keys()), key=get_value): + print(" " + j + ":", end=' ') for k in (ALL_DEVICE[i][j]): ret, log = log_os_system("cat " + k, 0) func = k.split("/")[-1].strip() func = re.sub(j + '_', '', func, 1) func = re.sub(i.lower() + '_', '', func, 1) if ret == 0: - print func + "=" + log + " ", + print(func + "=" + log + " ", end=' ') else: - print func + "=" + "X" + " ", - print + print(func + "=" + "X" + " ", end=' ') + print() print("----------------------------------------------------------------") - print + print() return diff --git a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_monitor.py index f032088dc525..cd35e9af9018 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_monitor.py @@ -173,11 +173,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_util.py b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_util.py index ed9667da8c99..cfdd5acadccb 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_util.py @@ -30,7 +30,7 @@ """ import os -import commands +import subprocess import getopt import sys import logging @@ -145,8 +145,8 @@ if DEBUG == True: - print sys.argv[0] - print 'ARGV :', sys.argv[1:] + print(sys.argv[0]) + print('ARGV :', sys.argv[1:]) def main(): @@ -162,9 +162,9 @@ def main(): 'force', ]) if DEBUG == True: - print options - print args - print len(sys.argv) + print(options) + print(args) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -204,39 +204,39 @@ def main(): return 0 def show_help(): - print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + print(__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) def show_set_help(): cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print cmd +" [led|sfp|fan]" - print " use \""+ cmd + " led 0-4 \" to set led color" - print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" - print " use \""+ cmd + " sfp 1-48 {0|1}\" to set sfp# tx_disable" + print(cmd +" [led|sfp|fan]") + print(" use \""+ cmd + " led 0-4 \" to set led color") + print(" use \""+ cmd + " fan 0-100\" to set fan duty percetage") + print(" use \""+ cmd + " sfp 1-48 {0|1}\" to set sfp# tx_disable") sys.exit(0) def show_eeprom_help(): cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print " use \""+ cmd + " 1-54 \" to dump sfp# eeprom" + print(" use \""+ cmd + " 1-54 \" to dump sfp# eeprom") sys.exit(0) def my_log(txt): if DEBUG == True: - print "[ACCTON DBG]: "+txt + print("[ACCTON DBG]: "+txt) return def log_os_system(cmd, show): logging.info('Run :'+cmd) status = 1 output = "" - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) my_log (cmd +"with result:" + str(status)) my_log ("cmd:" + cmd) my_log (" output:"+output) if status: logging.info('Failed :'+cmd) if show: - print('Failed :'+cmd) + print(('Failed :'+cmd)) return status, output def driver_inserted(): @@ -318,7 +318,7 @@ def device_install(): status, output = log_os_system(mknod2[i], 1) if status: - print output + print(output) if FORCE == 0: return status else: @@ -329,7 +329,7 @@ def device_install(): status, output = log_os_system(mknod[i], 1) if status: - print output + print(output) if FORCE == 0: return status @@ -339,12 +339,12 @@ def device_install(): else: status, output =log_os_system("echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) if status: - print output + print(output) if FORCE == 0: return status status, output =log_os_system("echo port"+str(i)+" > /sys/bus/i2c/devices/"+str(sfp_map[i])+"-0050/port_name", 1) if status: - print output + print(output) if FORCE == 0: return status @@ -357,7 +357,7 @@ def device_uninstall(): target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device" status, output =log_os_system("echo 0x50 > "+ target, 1) if status: - print output + print(output) if FORCE == 0: return status @@ -374,7 +374,7 @@ def device_uninstall(): temp[-1] = temp[-1].replace('new_device', 'delete_device') status, output = log_os_system(" ".join(temp), 1) if status: - print output + print(output) if FORCE == 0: return status @@ -388,40 +388,40 @@ def system_ready(): return True def do_install(): - print "Checking system...." + print("Checking system....") if driver_inserted() == False: - print "No driver, installing...." + print("No driver, installing....") status = driver_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" drivers detected...." + print(PROJECT_NAME.upper()+" drivers detected....") if not device_exist(): - print "No device, installing...." + print("No device, installing....") status = device_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" devices detected...." + print(PROJECT_NAME.upper()+" devices detected....") return def do_uninstall(): - print "Checking system...." + print("Checking system....") if not device_exist(): - print PROJECT_NAME.upper() +" has no device installed...." + print(PROJECT_NAME.upper() +" has no device installed....") else: - print "Removing device...." + print("Removing device....") status = device_uninstall() if status: if FORCE == 0: return status if driver_inserted()== False : - print PROJECT_NAME.upper() +" has no driver installed...." + print(PROJECT_NAME.upper() +" has no driver installed....") else: - print "Removing installed driver...." + print("Removing installed driver....") status = driver_uninstall() if status: if FORCE == 0: @@ -474,11 +474,11 @@ def devices_info(): #show dict all in the order if DEBUG == True: for i in sorted(ALL_DEVICE.keys()): - print(i+": ") + print((i+": ")) for j in sorted(ALL_DEVICE[i].keys()): - print(" "+j) + print((" "+j)) for k in (ALL_DEVICE[i][j]): - print(" "+" "+k) + print((" "+" "+k)) return def show_eeprom(index): @@ -501,15 +501,15 @@ def show_eeprom(index): else: log = 'Failed : no hexdump cmd!!' logging.info(log) - print log + print(log) return 1 - print node + ":" + print(node + ":") ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) if ret==0: - print log + print(log) else: - print "**********device no found**********" + print("**********device no found**********") return @@ -576,10 +576,10 @@ def set_device(args): node = node.replace(node.split("/")[-1], 'fan1_duty_cycle_percentage') ret, log = log_os_system("cat "+ node, 1) if ret==0: - print ("Previous fan duty: " + log.strip() +"%") + print(("Previous fan duty: " + log.strip() +"%")) ret, log = log_os_system("echo "+args[1]+" >"+node, 1) if ret==0: - print ("Current fan duty: " + args[1] +"%") + print(("Current fan duty: " + args[1] +"%")) return ret elif args[0]=='sfp': #if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: @@ -630,36 +630,36 @@ def device_traversal(): devices_info() for i in sorted(ALL_DEVICE.keys()): print("============================================") - print(i.upper()+": ") + print((i.upper()+": ")) print("============================================") - for j in sorted(ALL_DEVICE[i].keys(), key=get_value): - print " "+j+":", + for j in sorted(list(ALL_DEVICE[i].keys()), key=get_value): + print(" "+j+":", end=' ') if i == 'sfp': - port_index = int(filter(str.isdigit, j)) + port_index = int(list(filter(str.isdigit, j))) for k in (ALL_DEVICE[i][j]): if k.find('tx_disable')!= -1: ret, k = get_path_sfp_tx_dis(port_index) if ret == False: continue log = print_1_device_traversal(i, j, k) - print log, + print(log, end=' ') if k.find('present')!= -1: ret, k = get_path_sfp_presence(port_index) if ret == False: continue log = print_1_device_traversal(i, j, k) - print log, + print(log, end=' ') else: for k in (ALL_DEVICE[i][j]): log = print_1_device_traversal(i, j, k) - print log, - print + print(log, end=' ') + print() print("----------------------------------------------------------------") - print + print() return def device_exist(): diff --git a/platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/accton_as5812_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/accton_as5812_monitor.py index 6f55e703d7d1..d241ad777521 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/accton_as5812_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/accton_as5812_monitor.py @@ -181,11 +181,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl') except getopt.GetoptError: - print 'Usage: %s [-d] [-l]' % sys.argv[0] + print('Usage: %s [-d] [-l]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l]' % sys.argv[0] + print('Usage: %s [-d] [-l]' % sys.argv[0]) return 0 elif opt in ('-d'): log_console = 1 diff --git a/platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/accton_as5812_util.py b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/accton_as5812_util.py index 3859c3279c45..3a6e7c5d9acc 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/accton_as5812_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/accton_as5812_util.py @@ -30,7 +30,7 @@ set : change board setting with fan|led|sfp """ -import commands +import subprocess import getopt import sys import logging @@ -53,8 +53,8 @@ if DEBUG == True: - print sys.argv[0] - print 'ARGV :', sys.argv[1:] + print(sys.argv[0]) + print('ARGV :', sys.argv[1:]) def main(): @@ -70,9 +70,9 @@ def main(): 'force', ]) if DEBUG == True: - print options - print args - print len(sys.argv) + print(options) + print(args) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -112,36 +112,36 @@ def main(): return 0 def show_help(): - print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + print(__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) def show_set_help(): cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print cmd +" [led|sfp|fan]" - print " use \""+ cmd + " led 0-4 \" to set led color" - print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" - print " use \""+ cmd + " sfp 1-6 {0|1}\" to set sfp# tx_disable" + print(cmd +" [led|sfp|fan]") + print(" use \""+ cmd + " led 0-4 \" to set led color") + print(" use \""+ cmd + " fan 0-100\" to set fan duty percetage") + print(" use \""+ cmd + " sfp 1-6 {0|1}\" to set sfp# tx_disable") sys.exit(0) def show_eeprom_help(): cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print " use \""+ cmd + " 1-32 \" to dump sfp# eeprom" + print(" use \""+ cmd + " 1-32 \" to dump sfp# eeprom") sys.exit(0) def my_log(txt): if DEBUG == True: - print "[ROY]"+txt + print("[ROY]"+txt) return def log_os_system(cmd, show): logging.info('Run :'+cmd) - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) my_log (cmd +"with result:" + str(status)) my_log (" output:"+output) if status: logging.info('Failed :'+cmd) if show: - print('Failed :'+cmd) + print(('Failed :'+cmd)) return status, output def driver_check(): @@ -270,7 +270,7 @@ def device_install(): status, output = log_os_system(mknod2[i], 1) if status: - print output + print(output) if FORCE == 0: return status else: @@ -281,13 +281,13 @@ def device_install(): status, output = log_os_system(mknod[i], 1) if status: - print output + print(output) if FORCE == 0: return status for i in range(0,len(sfp_map)): status, output =log_os_system("echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) if status: - print output + print(output) if FORCE == 0: return status return @@ -305,7 +305,7 @@ def device_uninstall(): target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device" status, output =log_os_system("echo 0x50 > "+ target, 1) if status: - print output + print(output) if FORCE == 0: return status @@ -321,7 +321,7 @@ def device_uninstall(): temp[-1] = temp[-1].replace('new_device', 'delete_device') status, output = log_os_system(" ".join(temp), 1) if status: - print output + print(output) if FORCE == 0: return status @@ -335,40 +335,40 @@ def system_ready(): return True def do_install(): - print "Checking system...." + print("Checking system....") if driver_check() == False: - print "No driver, installing...." + print("No driver, installing....") status = driver_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" drivers detected...." + print(PROJECT_NAME.upper()+" drivers detected....") if not device_exist(): - print "No device, installing...." + print("No device, installing....") status = device_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" devices detected...." + print(PROJECT_NAME.upper()+" devices detected....") return def do_uninstall(): - print "Checking system...." + print("Checking system....") if not device_exist(): - print PROJECT_NAME.upper() +" has no device installed...." + print(PROJECT_NAME.upper() +" has no device installed....") else: - print "Removing device...." + print("Removing device....") status = device_uninstall() if status: if FORCE == 0: return status if driver_check()== False : - print PROJECT_NAME.upper() +" has no driver installed...." + print(PROJECT_NAME.upper() +" has no driver installed....") else: - print "Removing installed driver...." + print("Removing installed driver....") status = driver_uninstall() if status: if FORCE == 0: @@ -421,11 +421,11 @@ def devices_info(): #show dict all in the order if DEBUG == True: for i in sorted(ALL_DEVICE.keys()): - print(i+": ") + print((i+": ")) for j in sorted(ALL_DEVICE[i].keys()): - print(" "+j) + print((" "+j)) for k in (ALL_DEVICE[i][j]): - print(" "+" "+k) + print((" "+" "+k)) return def show_eeprom(index): @@ -448,15 +448,15 @@ def show_eeprom(index): else: log = 'Failed : no hexdump cmd!!' logging.info(log) - print log + print(log) return 1 - print node + ":" + print(node + ":") ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) if ret==0: - print log + print(log) else: - print "**********device no found**********" + print("**********device no found**********") return def set_device(args): @@ -490,10 +490,10 @@ def set_device(args): node = node.replace(node.split("/")[-1], 'fan_duty_cycle_percentage') ret, log = log_os_system("cat "+ node, 1) if ret==0: - print ("Previous fan duty: " + log.strip() +"%") + print(("Previous fan duty: " + log.strip() +"%")) ret, log = log_os_system("echo "+args[1]+" >"+node, 1) if ret==0: - print ("Current fan duty: " + args[1] +"%") + print(("Current fan duty: " + args[1] +"%")) return ret elif args[0]=='sfp': if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: @@ -533,25 +533,25 @@ def device_traversal(): devices_info() for i in sorted(ALL_DEVICE.keys()): print("============================================") - print(i.upper()+": ") + print((i.upper()+": ")) print("============================================") - for j in sorted(ALL_DEVICE[i].keys(), key=get_value): - print " "+j+":", + for j in sorted(list(ALL_DEVICE[i].keys()), key=get_value): + print(" "+j+":", end=' ') for k in (ALL_DEVICE[i][j]): ret, log = log_os_system("cat "+k, 0) func = k.split("/")[-1].strip() func = re.sub(j+'_','',func,1) func = re.sub(i.lower()+'_','',func,1) if ret==0: - print func+"="+log+" ", + print(func+"="+log+" ", end=' ') else: - print func+"="+"X"+" ", - print + print(func+"="+"X"+" ", end=' ') + print() print("----------------------------------------------------------------") - print + print() return def device_exist(): diff --git a/platform/broadcom/sonic-platform-modules-accton/as5812-54x/utils/accton_as5812_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as5812-54x/utils/accton_as5812_monitor.py index 5e3b368659cc..f0fada64563a 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5812-54x/utils/accton_as5812_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5812-54x/utils/accton_as5812_monitor.py @@ -181,11 +181,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl') except getopt.GetoptError: - print 'Usage: %s [-d] [-l]' % sys.argv[0] + print('Usage: %s [-d] [-l]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l]' % sys.argv[0] + print('Usage: %s [-d] [-l]' % sys.argv[0]) return 0 elif opt in ('-d'): log_console = 1 diff --git a/platform/broadcom/sonic-platform-modules-accton/as5812-54x/utils/accton_as5812_util.py b/platform/broadcom/sonic-platform-modules-accton/as5812-54x/utils/accton_as5812_util.py index 464c85745f90..05ebcb420698 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5812-54x/utils/accton_as5812_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5812-54x/utils/accton_as5812_util.py @@ -30,7 +30,7 @@ """ import os -import commands +import subprocess import getopt import sys import logging @@ -145,8 +145,8 @@ if DEBUG == True: - print sys.argv[0] - print 'ARGV :', sys.argv[1:] + print(sys.argv[0]) + print('ARGV :', sys.argv[1:]) def main(): @@ -162,9 +162,9 @@ def main(): 'force', ]) if DEBUG == True: - print options - print args - print len(sys.argv) + print(options) + print(args) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -204,39 +204,39 @@ def main(): return 0 def show_help(): - print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + print(__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) def show_set_help(): cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print cmd +" [led|sfp|fan]" - print " use \""+ cmd + " led 0-4 \" to set led color" - print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" - print " use \""+ cmd + " sfp 1-48 {0|1}\" to set sfp# tx_disable" + print(cmd +" [led|sfp|fan]") + print(" use \""+ cmd + " led 0-4 \" to set led color") + print(" use \""+ cmd + " fan 0-100\" to set fan duty percetage") + print(" use \""+ cmd + " sfp 1-48 {0|1}\" to set sfp# tx_disable") sys.exit(0) def show_eeprom_help(): cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print " use \""+ cmd + " 1-54 \" to dump sfp# eeprom" + print(" use \""+ cmd + " 1-54 \" to dump sfp# eeprom") sys.exit(0) def my_log(txt): if DEBUG == True: - print "[ACCTON DBG]: "+txt + print("[ACCTON DBG]: "+txt) return def log_os_system(cmd, show): logging.info('Run :'+cmd) status = 1 output = "" - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) my_log (cmd +"with result:" + str(status)) my_log ("cmd:" + cmd) my_log (" output:"+output) if status: logging.info('Failed :'+cmd) if show: - print('Failed :'+cmd) + print(('Failed :'+cmd)) return status, output def driver_inserted(): @@ -320,7 +320,7 @@ def device_install(): status, output = log_os_system(mknod2[i], 1) if status: - print output + print(output) if FORCE == 0: return status else: @@ -331,7 +331,7 @@ def device_install(): status, output = log_os_system(mknod[i], 1) if status: - print output + print(output) if FORCE == 0: return status @@ -341,12 +341,12 @@ def device_install(): else: status, output =log_os_system("echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) if status: - print output + print(output) if FORCE == 0: return status status, output =log_os_system("echo port"+str(i)+" > /sys/bus/i2c/devices/"+str(sfp_map[i])+"-0050/port_name", 1) if status: - print output + print(output) if FORCE == 0: return status @@ -359,7 +359,7 @@ def device_uninstall(): target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device" status, output =log_os_system("echo 0x50 > "+ target, 1) if status: - print output + print(output) if FORCE == 0: return status @@ -376,7 +376,7 @@ def device_uninstall(): temp[-1] = temp[-1].replace('new_device', 'delete_device') status, output = log_os_system(" ".join(temp), 1) if status: - print output + print(output) if FORCE == 0: return status @@ -390,40 +390,40 @@ def system_ready(): return True def do_install(): - print "Checking system...." + print("Checking system....") if driver_inserted() == False: - print "No driver, installing...." + print("No driver, installing....") status = driver_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" drivers detected...." + print(PROJECT_NAME.upper()+" drivers detected....") if not device_exist(): - print "No device, installing...." + print("No device, installing....") status = device_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" devices detected...." + print(PROJECT_NAME.upper()+" devices detected....") return def do_uninstall(): - print "Checking system...." + print("Checking system....") if not device_exist(): - print PROJECT_NAME.upper() +" has no device installed...." + print(PROJECT_NAME.upper() +" has no device installed....") else: - print "Removing device...." + print("Removing device....") status = device_uninstall() if status: if FORCE == 0: return status if driver_inserted()== False : - print PROJECT_NAME.upper() +" has no driver installed...." + print(PROJECT_NAME.upper() +" has no driver installed....") else: - print "Removing installed driver...." + print("Removing installed driver....") status = driver_uninstall() if status: if FORCE == 0: @@ -476,11 +476,11 @@ def devices_info(): #show dict all in the order if DEBUG == True: for i in sorted(ALL_DEVICE.keys()): - print(i+": ") + print((i+": ")) for j in sorted(ALL_DEVICE[i].keys()): - print(" "+j) + print((" "+j)) for k in (ALL_DEVICE[i][j]): - print(" "+" "+k) + print((" "+" "+k)) return def show_eeprom(index): @@ -503,15 +503,15 @@ def show_eeprom(index): else: log = 'Failed : no hexdump cmd!!' logging.info(log) - print log + print(log) return 1 - print node + ":" + print(node + ":") ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) if ret==0: - print log + print(log) else: - print "**********device no found**********" + print("**********device no found**********") return @@ -578,10 +578,10 @@ def set_device(args): node = node.replace(node.split("/")[-1], 'fan1_duty_cycle_percentage') ret, log = log_os_system("cat "+ node, 1) if ret==0: - print ("Previous fan duty: " + log.strip() +"%") + print(("Previous fan duty: " + log.strip() +"%")) ret, log = log_os_system("echo "+args[1]+" >"+node, 1) if ret==0: - print ("Current fan duty: " + args[1] +"%") + print(("Current fan duty: " + args[1] +"%")) return ret elif args[0]=='sfp': #if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: @@ -632,36 +632,36 @@ def device_traversal(): devices_info() for i in sorted(ALL_DEVICE.keys()): print("============================================") - print(i.upper()+": ") + print((i.upper()+": ")) print("============================================") - for j in sorted(ALL_DEVICE[i].keys(), key=get_value): - print " "+j+":", + for j in sorted(list(ALL_DEVICE[i].keys()), key=get_value): + print(" "+j+":", end=' ') if i == 'sfp': - port_index = int(filter(str.isdigit, j)) + port_index = int(list(filter(str.isdigit, j))) for k in (ALL_DEVICE[i][j]): if k.find('tx_disable')!= -1: ret, k = get_path_sfp_tx_dis(port_index) if ret == False: continue log = print_1_device_traversal(i, j, k) - print log, + print(log, end=' ') if k.find('present')!= -1: ret, k = get_path_sfp_presence(port_index) if ret == False: continue log = print_1_device_traversal(i, j, k) - print log, + print(log, end=' ') else: for k in (ALL_DEVICE[i][j]): log = print_1_device_traversal(i, j, k) - print log, - print + print(log, end=' ') + print() print("----------------------------------------------------------------") - print + print() return def device_exist(): diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54t/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54t/classes/fanutil.py index c741ebfd7246..e60236c9c781 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54t/classes/fanutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54t/classes/fanutil.py @@ -185,7 +185,7 @@ def get_fan_duty_cycle(self): try: val_file = open(self.FAN_DUTY_PATH) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() @@ -197,7 +197,7 @@ def set_fan_duty_cycle(self, val): try: fan_file = open(self.FAN_DUTY_PATH, 'r+') except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False fan_file.write(str(val)) fan_file.close() diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54t/classes/thermalutil.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54t/classes/thermalutil.py index 1dc97cfe276d..00e5bfa25683 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54t/classes/thermalutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54t/classes/thermalutil.py @@ -26,7 +26,7 @@ import time import logging import glob - import commands + import subprocess from collections import namedtuple except ImportError as e: raise ImportError('%s - required module not found' % str(e)) @@ -83,7 +83,7 @@ def _get_thermal_val(self, thermal_num): return int(content) else: - print "No such device_path=%s"%device_path + print("No such device_path=%s"%device_path) return 0 def get_num_thermals(self): @@ -115,10 +115,10 @@ def get_thermal_temp(self): def main(): thermal = ThermalUtil() - print "termal1=%d" %thermal._get_thermal_val(1) - print "termal2=%d" %thermal._get_thermal_val(2) - print "termal3=%d" %thermal._get_thermal_val(3) - print "termal4=%d" %thermal._get_thermal_val(4) + print("termal1=%d" %thermal._get_thermal_val(1)) + print("termal2=%d" %thermal._get_thermal_val(2)) + print("termal3=%d" %thermal._get_thermal_val(3)) + print("termal4=%d" %thermal._get_thermal_val(4)) # # print 'get_size_node_map : %d' % thermal.get_size_node_map() # print 'get_size_path_map : %d' % thermal.get_size_path_map() diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor.py index ceea8e12f852..397a816c9ea7 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor.py @@ -176,11 +176,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor_fan.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor_fan.py index 7978012b0da0..30f9ccd9e8ba 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor_fan.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor_fan.py @@ -132,7 +132,7 @@ def manage_fan(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -151,7 +151,7 @@ def manage_fan(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -173,11 +173,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor_psu.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor_psu.py index 9be72fda9993..40483e064dfc 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor_psu.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor_psu.py @@ -117,7 +117,7 @@ def manage_psu(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -138,7 +138,7 @@ def manage_psu(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -164,11 +164,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_util.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_util.py index 48e49cbaba13..7e51658e9fb6 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_util.py @@ -30,7 +30,7 @@ set : change board setting with fan|led|sfp """ -import commands +import subprocess import getopt import sys import logging @@ -53,8 +53,8 @@ if DEBUG == True: - print sys.argv[0] - print 'ARGV :', sys.argv[1:] + print(sys.argv[0]) + print('ARGV :', sys.argv[1:]) def main(): @@ -70,9 +70,9 @@ def main(): 'force', ]) if DEBUG == True: - print options - print args - print len(sys.argv) + print(options) + print(args) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -112,36 +112,36 @@ def main(): return 0 def show_help(): - print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + print(__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) def show_set_help(): cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print cmd +" [led|sfp|fan]" - print " use \""+ cmd + " led 0-4 \" to set led color" - print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" - print " use \""+ cmd + " sfp 49-54 {0|1}\" to set sfp# tx_disable" + print(cmd +" [led|sfp|fan]") + print(" use \""+ cmd + " led 0-4 \" to set led color") + print(" use \""+ cmd + " fan 0-100\" to set fan duty percetage") + print(" use \""+ cmd + " sfp 49-54 {0|1}\" to set sfp# tx_disable") sys.exit(0) def show_eeprom_help(): cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print " use \""+ cmd + " 1-54 \" to dump sfp# eeprom" + print(" use \""+ cmd + " 1-54 \" to dump sfp# eeprom") sys.exit(0) def my_log(txt): if DEBUG == True: - print "[Debug]"+txt + print("[Debug]"+txt) return def log_os_system(cmd, show): logging.info('Run :'+cmd) - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) my_log (cmd +"with result:" + str(status)) my_log (" output:"+output) if status: logging.info('Failed :'+cmd) if show: - print('Failed :'+cmd) + print(('Failed :'+cmd)) return status, output def driver_check(): @@ -277,7 +277,7 @@ def device_install(): status, output = log_os_system(mknod2[i], 1) time.sleep(0.01) if status: - print output + print(output) if FORCE == 0: return status else: @@ -288,7 +288,7 @@ def device_install(): status, output = log_os_system(mknod[i], 1) if status: - print output + print(output) if FORCE == 0: return status for i in range(49, 55): #Set qsfp port to normal state @@ -297,13 +297,13 @@ def device_install(): for i in range(0,len(sfp_map)): status, output =log_os_system("echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) if status: - print output + print(output) if FORCE == 0: return status path = "/sys/bus/i2c/devices/{0}-0050/port_name" status, output =log_os_system("echo port{0} > ".format(i+49)+path.format(sfp_map[i]), 1) if status: - print output + print(output) if FORCE == 0: return status return @@ -321,7 +321,7 @@ def device_uninstall(): target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device" status, output =log_os_system("echo 0x50 > "+ target, 1) if status: - print output + print(output) if FORCE == 0: return status @@ -337,7 +337,7 @@ def device_uninstall(): temp[-1] = temp[-1].replace('new_device', 'delete_device') status, output = log_os_system(" ".join(temp), 1) if status: - print output + print(output) if FORCE == 0: return status @@ -351,40 +351,40 @@ def system_ready(): return True def do_install(): - print "Checking system...." + print("Checking system....") if driver_check() == False: - print "No driver, installing...." + print("No driver, installing....") status = driver_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" drivers detected...." + print(PROJECT_NAME.upper()+" drivers detected....") if not device_exist(): - print "No device, installing...." + print("No device, installing....") status = device_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" devices detected...." + print(PROJECT_NAME.upper()+" devices detected....") return def do_uninstall(): - print "Checking system...." + print("Checking system....") if not device_exist(): - print PROJECT_NAME.upper() +" has no device installed...." + print(PROJECT_NAME.upper() +" has no device installed....") else: - print "Removing device...." + print("Removing device....") status = device_uninstall() if status: if FORCE == 0: return status if driver_check()== False : - print PROJECT_NAME.upper() +" has no driver installed...." + print(PROJECT_NAME.upper() +" has no driver installed....") else: - print "Removing installed driver...." + print("Removing installed driver....") status = driver_uninstall() if status: if FORCE == 0: @@ -437,11 +437,11 @@ def devices_info(): #show dict all in the order if DEBUG == True: for i in sorted(ALL_DEVICE.keys()): - print(i+": ") + print((i+": ")) for j in sorted(ALL_DEVICE[i].keys()): - print(" "+j) + print((" "+j)) for k in (ALL_DEVICE[i][j]): - print(" "+" "+k) + print((" "+" "+k)) return def show_eeprom(index): @@ -464,15 +464,15 @@ def show_eeprom(index): else: log = 'Failed : no hexdump cmd!!' logging.info(log) - print log + print(log) return 1 - print node + ":" + print(node + ":") ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) if ret==0: - print log + print(log) else: - print "**********device no found**********" + print("**********device no found**********") return def set_device(args): @@ -506,10 +506,10 @@ def set_device(args): node = node.replace(node.split("/")[-1], 'fan_duty_cycle_percentage') ret, log = log_os_system("cat "+ node, 1) if ret==0: - print ("Previous fan duty: " + log.strip() +"%") + print(("Previous fan duty: " + log.strip() +"%")) ret, log = log_os_system("echo "+args[1]+" >"+node, 1) if ret==0: - print ("Current fan duty: " + args[1] +"%") + print(("Current fan duty: " + args[1] +"%")) return ret elif args[0]=='sfp': if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: @@ -549,25 +549,25 @@ def device_traversal(): devices_info() for i in sorted(ALL_DEVICE.keys()): print("============================================") - print(i.upper()+": ") + print((i.upper()+": ")) print("============================================") - for j in sorted(ALL_DEVICE[i].keys(), key=get_value): - print " "+j+":", + for j in sorted(list(ALL_DEVICE[i].keys()), key=get_value): + print(" "+j+":", end=' ') for k in (ALL_DEVICE[i][j]): ret, log = log_os_system("cat "+k, 0) func = k.split("/")[-1].strip() func = re.sub(j+'_','',func,1) func = re.sub(i.lower()+'_','',func,1) if ret==0: - print func+"="+log+" ", + print(func+"="+log+" ", end=' ') else: - print func+"="+"X"+" ", - print + print(func+"="+"X"+" ", end=' ') + print() print("----------------------------------------------------------------") - print + print() return def device_exist(): diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/classes/fanutil.py index c741ebfd7246..b8b4820f9e4a 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/classes/fanutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/classes/fanutil.py @@ -104,7 +104,7 @@ def _get_fan_node_val(self, fan_num, node_num): return None try: - val_file.close() + val_file.close() except: logging.debug('GET. unable to close file. device_path:%s', device_path) return None @@ -135,7 +135,7 @@ def _set_fan_node_val(self, fan_num, node_num, val): val_file.write(content) try: - val_file.close() + val_file.close() except: logging.debug('GET. unable to close file. device_path:%s', device_path) return None @@ -185,7 +185,7 @@ def get_fan_duty_cycle(self): try: val_file = open(self.FAN_DUTY_PATH) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() @@ -197,7 +197,7 @@ def set_fan_duty_cycle(self, val): try: fan_file = open(self.FAN_DUTY_PATH, 'r+') except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False fan_file.write(str(val)) fan_file.close() @@ -224,14 +224,3 @@ def get_fan_status(self, fan_num): return True -#def main(): -# fan = FanUtil() -# -# print 'get_size_node_map : %d' % fan.get_size_node_map() -# print 'get_size_path_map : %d' % fan.get_size_path_map() -# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1): -# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1): -# print fan.get_fan_to_device_path(x, y) -# -#if __name__ == '__main__': -# main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/classes/thermalutil.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/classes/thermalutil.py index ce903db35487..4e8ef9adcbe7 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/classes/thermalutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/classes/thermalutil.py @@ -22,11 +22,10 @@ # ------------------------------------------------------------------ try: - import os import time import logging import glob - import commands + import subprocess from collections import namedtuple except ImportError as e: raise ImportError('%s - required module not found' % str(e)) @@ -34,7 +33,7 @@ class ThermalUtil(object): """Platform-specific ThermalUtil class""" THERMAL_NUM_MAX = 4 - THERMAL_NUM_1_IDX = 1 # 1_ON_CPU_BROAD. LM75 + THERMAL_NUM_1_IDX = 1 # 1_ON_CPU_BROAD. LM75 THERMAL_NUM_2_IDX = 2 # 2_ON_MAIN_BROAD. LM75 THERMAL_NUM_3_IDX = 3 # 3_ON_MAIN_BROAD. LM75 THERMAL_NUM_4_IDX = 4 # 4_ON_MAIN_BROAD. LM75 @@ -42,88 +41,52 @@ class ThermalUtil(object): """ Dictionary where key1 = thermal id index (integer) starting from 1 value = path to fan device file (string) """ - #_thermal_to_device_path_mapping = {} - - _thermal_to_device_node_mapping = { - THERMAL_NUM_1_IDX: ['18', '4b'], - THERMAL_NUM_2_IDX: ['19', '4c'], - THERMAL_NUM_3_IDX: ['20', '49'], - THERMAL_NUM_4_IDX: ['21', '4a'], - } + thermal_sysfspath ={ - THERMAL_NUM_1_IDX: ["/sys/bus/i2c/devices/18-004b/hwmon/hwmon3/temp1_input"], - THERMAL_NUM_2_IDX: ["/sys/bus/i2c/devices/19-004c/hwmon/hwmon4/temp1_input"], - THERMAL_NUM_3_IDX: ["/sys/bus/i2c/devices/20-0049/hwmon/hwmon5/temp1_input"], - THERMAL_NUM_4_IDX: ["/sys/bus/i2c/devices/21-004a/hwmon/hwmon6/temp1_input"], + THERMAL_NUM_1_IDX: ["/sys/bus/i2c/devices/18-004b/hwmon/hwmon*/temp1_input"], + THERMAL_NUM_2_IDX: ["/sys/bus/i2c/devices/19-004c/hwmon/hwmon*/temp1_input"], + THERMAL_NUM_3_IDX: ["/sys/bus/i2c/devices/20-0049/hwmon/hwmon*/temp1_input"], + THERMAL_NUM_4_IDX: ["/sys/bus/i2c/devices/21-004a/hwmon/hwmon*/temp1_input"], } - #def __init__(self): - def _get_thermal_val(self, thermal_num): + def get_thermal_val(self, thermal_num): if thermal_num < self.THERMAL_NUM_1_IDX or thermal_num > self.THERMAL_NUM_MAX: logging.debug('GET. Parameter error. thermal_num, %d', thermal_num) return None - device_path = self.get_thermal_to_device_path(thermal_num) - if(os.path.isfile(device_path)): - for filename in glob.glob(device_path): - try: - val_file = open(filename, 'r') - except IOError as e: - logging.error('GET. unable to open file: %s', str(e)) - return None + device_path = self.get_thermal_path(thermal_num) + for filename in glob.glob(device_path): + try: + val_file = open(filename, 'r') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None content = val_file.readline().rstrip() if content == '': logging.debug('GET. content is NULL. device_path:%s', device_path) return None try: - val_file.close() + val_file.close() except: logging.debug('GET. unable to close file. device_path:%s', device_path) return None return int(content) - - else: - print "No such device_path=%s"%device_path - return 0 + + return 0 def get_num_thermals(self): return self.THERMAL_NUM_MAX - - def get_idx_thermal_start(self): - return self.THERMAL_NUM_1_IDX - - def get_size_node_map(self): - return len(self._thermal_to_device_node_mapping) - - def get_size_path_map(self): - return len(self.thermal_sysfspath) - - def get_thermal_to_device_path(self, thermal_num): + + def get_thermal_path(self, thermal_num): return self.thermal_sysfspath[thermal_num][0] - def get_thermal_1_val(self): - return self._get_thermal_val(self.THERMAL_NUM_1_IDX) - - def get_thermal_2_val(self): - return self._get_thermal_val(self.THERMAL_NUM_2_IDX) - - def get_thermal_3_val(self): - return self._get_thermal_val(self.THERMAL_NUM_3_IDX) - - def get_thermal_temp(self): - return (self._get_thermal_val(self.THERMAL_NUM_1_IDX) + self._get_thermal_val(self.THERMAL_NUM_2_IDX) +self._get_thermal_val(self.THERMAL_NUM_3_IDX)) - def main(): thermal = ThermalUtil() - print "termal1=%d" %thermal._get_thermal_val(1) - print "termal2=%d" %thermal._get_thermal_val(2) - print "termal3=%d" %thermal._get_thermal_val(3) - print "termal4=%d" %thermal._get_thermal_val(4) -# -# print 'get_size_node_map : %d' % thermal.get_size_node_map() -# print 'get_size_path_map : %d' % thermal.get_size_path_map() -# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1): -# print thermal.get_thermal_to_device_path(x) -# + logging.basicConfig(level=logging.DEBUG) + logging.debug('thermal1=%d', thermal.get_thermal_val(1)) + logging.debug('thermal2=%d', thermal.get_thermal_val(2)) + logging.debug('thermal3=%d', thermal.get_thermal_val(3)) + logging.debug('thermal4=%d', thermal.get_thermal_val(4)) + if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor.py index 9c5e955ce17d..49a12cd51ece 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor.py @@ -91,11 +91,11 @@ def manage_fans(self): thermal = ThermalUtil() fan = FanUtil() - temp2 = thermal.get_thermal_2_val() + temp2 = thermal.get_thermal_val(2) if temp2 is None: return False - temp3 = thermal.get_thermal_3_val() + temp3 = thermal.get_thermal_val(3) if temp3 is None: return False @@ -175,11 +175,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor_fan.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor_fan.py index dec1e036142d..842e76ce3748 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor_fan.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor_fan.py @@ -132,7 +132,7 @@ def manage_fan(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -151,7 +151,7 @@ def manage_fan(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -173,11 +173,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor_psu.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor_psu.py index f994d635239a..1dbd85cb6487 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor_psu.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor_psu.py @@ -117,7 +117,7 @@ def manage_psu(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -138,7 +138,7 @@ def manage_psu(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -164,11 +164,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_util.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_util.py index d2573b6f5aec..5292d1ec3b18 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_util.py @@ -128,6 +128,8 @@ def driver_check(): kos = [ 'modprobe i2c_dev', +'modprobe i2c_i801', +'modprobe i2c_ismt', 'modprobe i2c_mux_pca954x force_deselect_on_exit=1', 'modprobe accton_as5835_54x_cpld' , 'modprobe ym2651y' , @@ -282,9 +284,21 @@ def device_install(): print(output) if FORCE == 0: return status + + # set all pca954x idle_disconnect + cmd = 'echo -2 | tee /sys/bus/i2c/drivers/pca954x/*-00*/idle_state' + status, output = log_os_system(cmd, 1) + if status: + print(output) + if FORCE == 0: + return status for i in range(49, 55): #Set qsfp port to normal state log_os_system("echo 0 > /sys/bus/i2c/devices/3-0062/module_reset_" + str(i), 1) + for i in range(1, 39): #Set disable tx_disable to sfp port + log_os_system("echo 0 > /sys/bus/i2c/devices/3-0061/module_tx_disable_" + str(i), 1) + for i in range(39, 49): #Set disable tx_disable to sfp port + log_os_system("echo 0 > /sys/bus/i2c/devices/3-0062/module_tx_disable_" + str(i), 1) for i in range(0,len(sfp_map)): if i < qsfp_start: @@ -372,8 +386,6 @@ def do_sonic_platform_clean(): else: print('{} is uninstalled'.format(PLATFORM_API2_WHL_FILE_PY3)) - return - def do_install(): print("Checking system....") if driver_check() == False: diff --git a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/classes/fanutil.py index 73d020acccce..20d604ab4a3a 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/classes/fanutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/classes/fanutil.py @@ -193,7 +193,7 @@ def get_fan_duty_cycle(self): try: val_file = open(self.FAN_DUTY_PATH) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() @@ -212,7 +212,7 @@ def set_fan_duty_cycle(self, val): try: fan_file = open(self.FAN_DUTY_PATH, 'r+') except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False #val = ((val + 1 ) * 625 +75 ) / 100 fan_file.write(str(val)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_monitor.py index 07e40f6b7fb4..1bc78f8184de 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_monitor.py @@ -180,11 +180,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_util.py b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_util.py index 10cdac787309..fdaf22689639 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_util.py @@ -37,7 +37,7 @@ set : change board setting with fan|led|sfp """ -import commands +import subprocess import getopt import sys import logging @@ -153,8 +153,8 @@ if DEBUG == True: - print sys.argv[0] - print 'ARGV :', sys.argv[1:] + print(sys.argv[0]) + print('ARGV :', sys.argv[1:]) def main(): @@ -170,9 +170,9 @@ def main(): 'force', ]) if DEBUG == True: - print options - print args - print len(sys.argv) + print(options) + print(args) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -213,39 +213,39 @@ def main(): return 0 def show_help(): - print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + print(__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) def show_set_help(): cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print cmd +" [led|sfp|fan]" - print " use \""+ cmd + " led 0-4 \" to set led color" - print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" - print " use \""+ cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable" + print(cmd +" [led|sfp|fan]") + print(" use \""+ cmd + " led 0-4 \" to set led color") + print(" use \""+ cmd + " fan 0-100\" to set fan duty percetage") + print(" use \""+ cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable") sys.exit(0) def show_eeprom_help(): cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print " use \""+ cmd + " 1-54 \" to dump sfp# eeprom" + print(" use \""+ cmd + " 1-54 \" to dump sfp# eeprom") sys.exit(0) def my_log(txt): if DEBUG == True: - print "[ACCTON DBG]: "+txt + print("[ACCTON DBG]: "+txt) return def log_os_system(cmd, show): logging.info('Run :'+cmd) status = 1 output = "" - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) my_log (cmd +"with result:" + str(status)) my_log ("cmd:" + cmd) my_log (" output:"+output) if status: logging.info('Failed :'+cmd) if show: - print('Failed :'+cmd) + print(('Failed :'+cmd)) return status, output def driver_inserted(): @@ -332,7 +332,7 @@ def device_install(): status, output = log_os_system(mknod2[i], 1) if status: - print output + print(output) if FORCE == 0: return status else: @@ -343,19 +343,19 @@ def device_install(): status, output = log_os_system(mknod[i], 1) if status: - print output + print(output) if FORCE == 0: return status for i in range(0,len(sfp_map)): status, output =log_os_system("echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) if status: - print output + print(output) if FORCE == 0: return status status, output =log_os_system("echo port"+str(i)+" > /sys/bus/i2c/devices/"+str(sfp_map[i])+"-0050/port_name", 1) if status: - print output + print(output) if FORCE == 0: return status @@ -374,7 +374,7 @@ def device_uninstall(): target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device" status, output =log_os_system("echo 0x50 > "+ target, 1) if status: - print output + print(output) if FORCE == 0: return status @@ -390,7 +390,7 @@ def device_uninstall(): temp[-1] = temp[-1].replace('new_device', 'delete_device') status, output = log_os_system(" ".join(temp), 1) if status: - print output + print(output) if FORCE == 0: return status @@ -404,40 +404,40 @@ def system_ready(): return True def do_install(): - print "Checking system...." + print("Checking system....") if driver_inserted() == False: - print "No driver, installing...." + print("No driver, installing....") status = driver_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" drivers detected...." + print(PROJECT_NAME.upper()+" drivers detected....") if not device_exist(): - print "No device, installing...." + print("No device, installing....") status = device_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" devices detected...." + print(PROJECT_NAME.upper()+" devices detected....") return def do_uninstall(): - print "Checking system...." + print("Checking system....") if not device_exist(): - print PROJECT_NAME.upper() +" has no device installed...." + print(PROJECT_NAME.upper() +" has no device installed....") else: - print "Removing device...." + print("Removing device....") status = device_uninstall() if status: if FORCE == 0: return status if driver_inserted()== False : - print PROJECT_NAME.upper() +" has no driver installed...." + print(PROJECT_NAME.upper() +" has no driver installed....") else: - print "Removing installed driver...." + print("Removing installed driver....") status = driver_uninstall() if status: if FORCE == 0: @@ -494,11 +494,11 @@ def devices_info(): #show dict all in the order if DEBUG == True: for i in sorted(ALL_DEVICE.keys()): - print(i+": ") + print((i+": ")) for j in sorted(ALL_DEVICE[i].keys()): - print(" "+j) + print((" "+j)) for k in (ALL_DEVICE[i][j]): - print(" "+" "+k) + print((" "+" "+k)) return def show_eeprom(index): @@ -521,15 +521,15 @@ def show_eeprom(index): else: log = 'Failed : no hexdump cmd!!' logging.info(log) - print log + print(log) return 1 - print node + ":" + print(node + ":") ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) if ret==0: - print log + print(log) else: - print "**********device no found**********" + print("**********device no found**********") return def set_device(args): @@ -563,10 +563,10 @@ def set_device(args): node = node.replace(node.split("/")[-1], 'fan1_duty_cycle_percentage') ret, log = log_os_system("cat "+ node, 1) if ret==0: - print ("Previous fan duty: " + log.strip() +"%") + print(("Previous fan duty: " + log.strip() +"%")) ret, log = log_os_system("echo "+args[1]+" >"+node, 1) if ret==0: - print ("Current fan duty: " + args[1] +"%") + print(("Current fan duty: " + args[1] +"%")) return ret elif args[0]=='sfp': if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: @@ -606,25 +606,25 @@ def device_traversal(): devices_info() for i in sorted(ALL_DEVICE.keys()): print("============================================") - print(i.upper()+": ") + print((i.upper()+": ")) print("============================================") - for j in sorted(ALL_DEVICE[i].keys(), key=get_value): - print " "+j+":", + for j in sorted(list(ALL_DEVICE[i].keys()), key=get_value): + print(" "+j+":", end=' ') for k in (ALL_DEVICE[i][j]): ret, log = log_os_system("cat "+k, 0) func = k.split("/")[-1].strip() func = re.sub(j+'_','',func,1) func = re.sub(i.lower()+'_','',func,1) if ret==0: - print func+"="+log+" ", + print(func+"="+log+" ", end=' ') else: - print func+"="+"X"+" ", - print + print(func+"="+"X"+" ", end=' ') + print() print("----------------------------------------------------------------") - print + print() return def device_exist(): diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/classes/fanutil.py index 92e79da72746..9b34ce560821 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/classes/fanutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/classes/fanutil.py @@ -179,7 +179,7 @@ def get_fan_duty_cycle(self): with open(self.FAN_DUTY_PATH) as val_file: content = val_file.readline().rstrip() except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False return int(content) @@ -188,7 +188,7 @@ def set_fan_duty_cycle(self, val): with open(self.FAN_DUTY_PATH, 'r+') as val_file: val_file.write(str(val)) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False return True diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_as7312_54x_fan.c b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_as7312_54x_fan.c index 8764ec8a3176..9e7be492b734 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_as7312_54x_fan.c +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/modules/accton_as7312_54x_fan.c @@ -48,7 +48,7 @@ static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, static ssize_t get_enable(struct device *dev, struct device_attribute *da, char *buf); static ssize_t set_enable(struct device *dev, struct device_attribute *da, const char *buf, size_t count); -static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, char *buf); + extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); extern int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); @@ -150,11 +150,6 @@ enum sysfs_fan_attributes { &sensor_dev_attr_pwm##index.dev_attr.attr, \ &sensor_dev_attr_pwm##index##_enable.dev_attr.attr -#define DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR() \ - static SENSOR_DEVICE_ATTR(sys_temp, S_IRUGO, get_sys_temp, NULL, FAN_DUTY_CYCLE_PERCENTAGE) - -#define DECLARE_FAN_SYSTEM_TEMP_ATTR() &sensor_dev_attr_sys_temp.dev_attr.attr - #define DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(index) \ static SENSOR_DEVICE_ATTR(fan##index##_present, S_IRUGO, fan_show_value, NULL, FAN##index##_PRESENT) @@ -200,8 +195,6 @@ DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(5); DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(6); /* 1 fan duty cycle attribute in this platform */ DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(1); -/* System temperature for fancontrol */ -DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR(); static struct attribute *as7312_54x_fan_attributes[] = { /* fan related attributes */ @@ -230,7 +223,6 @@ static struct attribute *as7312_54x_fan_attributes[] = { DECLARE_FAN_DIRECTION_ATTR(5), DECLARE_FAN_DIRECTION_ATTR(6), DECLARE_FAN_DUTY_CYCLE_ATTR(1), - DECLARE_FAN_SYSTEM_TEMP_ATTR(), NULL }; @@ -348,267 +340,6 @@ static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, return count; } -/* Due to this struct is declared at lm75.c, it cannot be include - * under Sonic environment. I duplicate it from lm75.c. - */ -struct lm75_data { - struct i2c_client *client; - struct device *hwmon_dev; - struct thermal_zone_device *tz; - struct mutex update_lock; - u8 orig_conf; - u8 resolution; /* In bits, between 9 and 12 */ - u8 resolution_limits; - char valid; /* !=0 if registers are valid */ - unsigned long last_updated; /* In jiffies */ - unsigned long sample_time; /* In jiffies */ - s16 temp[3]; /* Register values, - 0 = input - 1 = max - 2 = hyst */ -}; - -/*Copied from lm75.c*/ -static inline long lm75_reg_to_mc(s16 temp, u8 resolution) -{ - return ((temp >> (16 - resolution)) * 1000) >> (resolution - 8); -} - -/*Get hwmon_dev from i2c_client, set hwmon_dev = NULL is failed.*/ -static struct device * get_hwmon_dev( - struct i2c_client *client) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - if(data) - { - if( data->valid == 1 && data->hwmon_dev) - { - return data->hwmon_dev; - } - - } - return NULL; -} - -/* To find hwmon index by opening hwmon under that i2c address. - */ -static int find_hwmon_index_by_FileOpen( - int bus_nr, - unsigned short addr, - OUT int *index) -{ -#define MAX_HWMON_DEVICE (10) /* Find hwmon device in 0~10*/ - struct file *sfd; - char client_name[96]; - int i=0; - - do { - snprintf(client_name, sizeof(client_name), - "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", - bus_nr, addr, i); - - sfd = filp_open(client_name, O_RDONLY, 0); - i++; - } while( IS_ERR(sfd) && i < MAX_HWMON_DEVICE); - - if (IS_ERR(sfd)) { - pr_err("Failed to open file(%s)#%d\r\n", client_name, __LINE__); - return -ENOENT; - } - filp_close(sfd, 0); - *index = i - 1; - return 0; - -#undef MAX_HWMON_DEVICE -} - -static int get_temp_file_path( - int bus_nr, unsigned short addr, - struct device *hwmon_dev - ,char *path, int max_len) -{ - - if(hwmon_dev && strlen(dev_name(hwmon_dev))) - { - snprintf(path, max_len, - "/sys/bus/i2c/devices/%d-%04x/hwmon/%s/temp1_input", - bus_nr, addr, dev_name(hwmon_dev)); - } - else - { - int i=0; - if(find_hwmon_index_by_FileOpen( bus_nr, addr, &i)) - { - return -EIO; - } - snprintf(path, max_len, - "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", - bus_nr, addr, i); - } - return 0; -} - -/*File read the dev file at user space.*/ -static int read_devfile_temp1_input( - struct device *dev, - int bus_nr, - unsigned short addr, - struct device *hwmon_dev, - int *miniCelsius) -{ - struct file *sfd; - char buffer[96]; - char devfile[96]; - int rc, status; - int rdlen, value; - mm_segment_t old_fs; - - rc = 0; - get_temp_file_path(bus_nr, addr, hwmon_dev, devfile, sizeof(devfile)); - sfd = filp_open(devfile, O_RDONLY, 0); - if (IS_ERR(sfd)) { - pr_err("Failed to open file(%s)#%d\r\n", devfile, __LINE__); - return -ENOENT; - } - dev_dbg(dev, "Found device:%s\n",devfile); - - if(!(sfd->f_op) || !(sfd->f_op->read) ) { - pr_err("file %s cann't readable ?\n",devfile); - return -ENOENT; - } - - old_fs = get_fs(); - set_fs(KERNEL_DS); - rdlen = sfd->f_op->read(sfd, buffer, sizeof(buffer), &sfd->f_pos); - if (rdlen == 0) { - pr_err( "File(%s) empty!\n", devfile); - rc = -EIO; - goto exit; - } - status = sscanf(buffer, "%d", &value); - if (status != 1) { - rc = -EIO; - goto exit; - } - *miniCelsius = value; - dev_dbg(dev,"found sensors: %d @i2c %d-%04x\n", value, bus_nr, addr); - -exit: - set_fs(old_fs); - filp_close(sfd, 0); - return rc; -} - -static u8 is_lm75_data_due(struct i2c_client *client) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - if (time_after(jiffies, data->last_updated + data->sample_time)) - { - return 1; - } - return 0; -} -static int get_lm75_temp(struct i2c_client *client, int *miniCelsius) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - *miniCelsius = lm75_reg_to_mc(data->temp[0], data->resolution); - - return 0; -} - -static bool lm75_addr_mached(unsigned short addr) -{ - int i; - unsigned short addrs[] = THERMAL_SENSORS_ADDRS; - - for (i = 0; i < ARRAY_SIZE(addrs); i++) - { - if( addr == addrs[i]) - return 1; - } - return 0; -} - -static int _find_lm75_device(struct device *dev, void *data) -{ - struct device_driver *driver; - struct as7312_54x_fan_data *prv = data; - char *driver_name = THERMAL_SENSORS_DRIVER; - - driver = dev->driver; - if (driver && driver->name && - strcmp(driver->name, driver_name) == 0) - { - struct i2c_client *client; - client = to_i2c_client(dev); - if (client) - { - /*cannot use "struct i2c_adapter *adap = to_i2c_adapter(dev);"*/ - struct i2c_adapter *adap = client->adapter; - int miniCelsius = 0; - - if (! lm75_addr_mached(client->addr)) - { - return 0; - } - - if (!adap) { - return -ENXIO; - } - - /* If the data is not updated, read them from devfile - to drive them updateing data from chip.*/ - if (is_lm75_data_due(client)) - { - struct device *hwmon_dev; - - hwmon_dev = get_hwmon_dev(client); - if(0 == read_devfile_temp1_input(dev, adap->nr, - client->addr, hwmon_dev, &miniCelsius)) - { - prv->system_temp += miniCelsius; - prv->sensors_found++; - } - - } - else - { - get_lm75_temp(client, &miniCelsius); - prv->system_temp += miniCelsius; - prv->sensors_found++; - - } - } - } - return 0; -} - -/*Find all lm75 devices and return sum of temperatures.*/ -static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, - char *buf) -{ - ssize_t ret = 0; - struct as7312_54x_fan_data *data = as7312_54x_fan_update_device(dev); - - data->system_temp=0; - data->sensors_found=0; - i2c_for_each_dev(data, _find_lm75_device); - if (NUM_THERMAL_SENSORS != data->sensors_found) - { - dev_dbg(dev,"only %d of %d temps are found\n", - data->sensors_found, NUM_THERMAL_SENSORS); - data->system_temp = INT_MAX; - } - ret = sprintf(buf, "%d\n",data->system_temp); - return ret; -} - static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf) { diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_monitor.py index 2f87c3f58736..c63bdab2fa0a 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_monitor.py @@ -192,11 +192,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_util.py b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_util.py index e2f058b4e37a..4897945368ab 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_util.py @@ -29,7 +29,7 @@ set : change board setting with fan|led|sfp """ -import commands +import subprocess import getopt import sys import logging @@ -56,8 +56,8 @@ # logging.basicConfig(level=logging.INFO) if DEBUG == True: - print sys.argv[0] - print 'ARGV :', sys.argv[1:] + print(sys.argv[0]) + print('ARGV :', sys.argv[1:]) def main(): @@ -71,9 +71,9 @@ def main(): (options, ARGS) = getopt.getopt(sys.argv[1:], 'hdf', ['help','debug', 'force']) if DEBUG == True: - print options - print ARGS - print len(sys.argv) + print(options) + print(ARGS) + print(len(sys.argv)) for (opt, arg) in options: if opt in ('-h', '--help'): @@ -116,40 +116,40 @@ def main(): def show_help(): - print __doc__ % {'scriptName': sys.argv[0].split('/')[-1]} + print(__doc__ % {'scriptName': sys.argv[0].split('/')[-1]}) sys.exit(0) def show_set_help(): cmd = sys.argv[0].split('/')[-1] + ' ' + ARGS[0] - print cmd + ' [led|sfp|fan]' - print ' use "' + cmd + ' led 0-4 " to set led color' - print ' use "' + cmd + ' fan 0-100" to set fan duty percetage' - print ' use "' + cmd + ' sfp 1-48 {0|1}" to set sfp# tx_disable' + print(cmd + ' [led|sfp|fan]') + print(' use "' + cmd + ' led 0-4 " to set led color') + print(' use "' + cmd + ' fan 0-100" to set fan duty percetage') + print(' use "' + cmd + ' sfp 1-48 {0|1}" to set sfp# tx_disable') sys.exit(0) def show_eeprom_help(): cmd = sys.argv[0].split('/')[-1] + ' ' + ARGS[0] - print ' use "' + cmd + ' 1-54 " to dump sfp# eeprom' + print(' use "' + cmd + ' 1-54 " to dump sfp# eeprom') sys.exit(0) def my_log(txt): if DEBUG == True: - print '[DBG]' + txt + print('[DBG]' + txt) return def log_os_system(cmd, show): logging.info('Run :' + cmd) - (status, output) = commands.getstatusoutput(cmd) + (status, output) = subprocess.getstatusoutput(cmd) my_log(cmd + 'with result:' + str(status)) my_log(' output:' + output) if status: logging.info('Failed :' + cmd) if show: - print 'Failed :' + cmd + print('Failed :' + cmd) return (status, output) @@ -164,7 +164,7 @@ def driver_check(): kos = [ 'modprobe i2c_dev', - 'modprobe i2c_mux_pca954x force_deselect_on_exit=1', + 'modprobe i2c_mux_pca954x', 'modprobe accton_i2c_cpld', 'modprobe ym2651y', 'modprobe accton_as7312_54x_fan', @@ -294,7 +294,7 @@ def device_install(): (status, output) = log_os_system(mknod2[i], 1) if status: - print output + print(output) if FORCE == 0: return status else: @@ -305,9 +305,18 @@ def device_install(): (status, output) = log_os_system(mknod[i], 1) if status: - print output + print(output) if FORCE == 0: return status + + # set all pca954x idle_disconnect + cmd = 'echo -2 | tee /sys/bus/i2c/drivers/pca954x/*-00*/idle_state' + status, output = log_os_system(cmd, 1) + if status: + print(output) + if FORCE == 0: + return status + for i in range(0, len(sfp_map)): if i < qsfp_start: (status, output) = \ @@ -318,7 +327,7 @@ def device_install(): log_os_system('echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-' + str(sfp_map[i]) + '/new_device', 1) if status: - print output + print(output) if FORCE == 0: return status return @@ -331,7 +340,7 @@ def device_uninstall(): + '/delete_device' (status, output) = log_os_system('echo 0x50 > ' + target, 1) if status: - print output + print(output) if FORCE == 0: return status @@ -348,7 +357,7 @@ def device_uninstall(): temp[-1] = temp[-1].replace('new_device', 'delete_device') (status, output) = log_os_system(' '.join(temp), 1) if status: - print output + print(output) if FORCE == 0: return status @@ -374,69 +383,69 @@ def do_sonic_platform_install(): if os.path.exists(SONIC_PLATFORM_BSP_WHL_PKG_PY3): status, output = log_os_system("pip3 install "+ SONIC_PLATFORM_BSP_WHL_PKG_PY3, 1) if status: - print "Error: Failed to install {}".format(PLATFORM_API2_WHL_FILE_PY3) + print("Error: Failed to install {}".format(PLATFORM_API2_WHL_FILE_PY3)) return status else: - print "Successfully installed {} package".format(PLATFORM_API2_WHL_FILE_PY3) + print("Successfully installed {} package".format(PLATFORM_API2_WHL_FILE_PY3)) else: - print('{} is not found'.format(PLATFORM_API2_WHL_FILE_PY3)) + print(('{} is not found'.format(PLATFORM_API2_WHL_FILE_PY3))) else: - print('{} has installed'.format(PLATFORM_API2_WHL_FILE_PY3)) + print(('{} has installed'.format(PLATFORM_API2_WHL_FILE_PY3))) return def do_sonic_platform_clean(): status, output = log_os_system("pip3 show sonic-platform > /dev/null 2>&1", 0) if status: - print('{} does not install, not need to uninstall'.format(PLATFORM_API2_WHL_FILE_PY3)) + print(('{} does not install, not need to uninstall'.format(PLATFORM_API2_WHL_FILE_PY3))) else: status, output = log_os_system("pip3 uninstall sonic-platform -y", 0) if status: - print('Error: Failed to uninstall {}'.format(PLATFORM_API2_WHL_FILE_PY3)) + print(('Error: Failed to uninstall {}'.format(PLATFORM_API2_WHL_FILE_PY3))) return status else: - print('{} is uninstalled'.format(PLATFORM_API2_WHL_FILE_PY3)) + print(('{} is uninstalled'.format(PLATFORM_API2_WHL_FILE_PY3))) return def do_install(): - print 'Checking system....' + print('Checking system....') if driver_check() is False: - print 'No driver, installing....' + print('No driver, installing....') status = driver_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper() + ' drivers detected....' + print(PROJECT_NAME.upper() + ' drivers detected....') if not device_exist(): - print 'No device, installing....' + print('No device, installing....') status = device_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper() + ' devices detected....' + print(PROJECT_NAME.upper() + ' devices detected....') do_sonic_platform_install() return def do_uninstall(): - print 'Checking system....' + print('Checking system....') if not device_exist(): - print PROJECT_NAME.upper() + ' has no device installed....' + print(PROJECT_NAME.upper() + ' has no device installed....') else: - print 'Removing device....' + print('Removing device....') status = device_uninstall() if status and FORCE == 0: return status if driver_check() is False: - print PROJECT_NAME.upper() + ' has no driver installed....' + print(PROJECT_NAME.upper() + ' has no driver installed....') else: - print 'Removing installed driver....' + print('Removing installed driver....') status = driver_uninstall() if status and FORCE == 0: return status @@ -496,11 +505,11 @@ def devices_info(): # show dict all in the order if DEBUG == True: for i in sorted(ALL_DEVICE.keys()): - print i + ': ' + print(i + ': ') for j in sorted(ALL_DEVICE[i].keys()): - print ' ' + j + print(' ' + j) for k in ALL_DEVICE[i][j]: - print ' ' + ' ' + k + print(' ' + ' ' + k) return @@ -525,14 +534,14 @@ def show_eeprom(index): else: log = 'Failed : no hexdump cmd!!' logging.info(log) - print log + print(log) return 1 - print node + ':' + print(node + ':') (ret, log) = log_os_system('cat ' + node + '| ' + hex_cmd + ' -C', 1) if ret == 0: - print log + print(log) else: print( '**********device no found**********') return @@ -573,10 +582,10 @@ def set_device(args): 'fan_duty_cycle_percentage') (ret, log) = log_os_system('cat ' + node, 1) if ret == 0: - print 'Previous fan duty: ' + log.strip() + '%' + print('Previous fan duty: ' + log.strip() + '%') ret = log_os_system('echo ' + args[1] + ' >' + node, 1) if ret[0] == 0: - print 'Current fan duty: ' + args[1] + '%' + print('Current fan duty: ' + args[1] + '%') return ret elif args[0] == 'sfp': if int(args[1]) > qsfp_start or int(args[1]) == 0: @@ -611,30 +620,30 @@ def get_value(i): def device_traversal(): if system_ready() is False: - print "System is not ready." - print 'Please install first!' + print("System is not ready.") + print('Please install first!') return if not ALL_DEVICE: devices_info() for i in sorted(ALL_DEVICE.keys()): - print '============================================' - print i.upper() + ': ' - print '============================================' - for j in sorted(ALL_DEVICE[i].keys(), key=get_value): - print ' ' + j + ':', + print('============================================') + print(i.upper() + ': ') + print('============================================') + for j in sorted(list(ALL_DEVICE[i].keys()), key=get_value): + print(' ' + j + ':', end=' ') for k in ALL_DEVICE[i][j]: (ret, log) = log_os_system('cat ' + k, 0) func = k.split('/')[-1].strip() func = re.sub(j + '_', '', func, 1) func = re.sub(i.lower() + '_', '', func, 1) if ret == 0: - print func + '=' + log + ' ', + print(func + '=' + log + ' ', end=' ') else: - print func + '=' + 'X' + ' ', - print - print '----------------------------------------------------------------' - print + print(func + '=' + 'X' + ' ', end=' ') + print() + print('----------------------------------------------------------------') + print() return diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/classes/fanutil.py index 18802c803638..22424c74c5c6 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/classes/fanutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/classes/fanutil.py @@ -200,7 +200,7 @@ def get_fan_duty_cycle(self): try: val_file = open(self.FAN_DUTY_PATH) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() @@ -219,7 +219,7 @@ def set_fan_duty_cycle(self, val): try: fan_file = open(self.FAN_DUTY_PATH, 'r+') except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False #val = ((val + 1 ) * 625 +75 ) / 100 fan_file.write(str(val)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/modules/accton_as7312_54x_fan.c b/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/modules/accton_as7312_54x_fan.c index 8764ec8a3176..1a32c57f28e9 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/modules/accton_as7312_54x_fan.c +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/modules/accton_as7312_54x_fan.c @@ -35,7 +35,6 @@ #define DRVNAME "as7312_54x_fan" #define NUM_THERMAL_SENSORS (3) /* Get sum of this number of sensors.*/ -#define THERMAL_SENSORS_DRIVER "lm75" #define THERMAL_SENSORS_ADDRS {0x48, 0x49, 0x4a} #define IN @@ -48,7 +47,6 @@ static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, static ssize_t get_enable(struct device *dev, struct device_attribute *da, char *buf); static ssize_t set_enable(struct device *dev, struct device_attribute *da, const char *buf, size_t count); -static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, char *buf); extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); extern int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); @@ -150,11 +148,6 @@ enum sysfs_fan_attributes { &sensor_dev_attr_pwm##index.dev_attr.attr, \ &sensor_dev_attr_pwm##index##_enable.dev_attr.attr -#define DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR() \ - static SENSOR_DEVICE_ATTR(sys_temp, S_IRUGO, get_sys_temp, NULL, FAN_DUTY_CYCLE_PERCENTAGE) - -#define DECLARE_FAN_SYSTEM_TEMP_ATTR() &sensor_dev_attr_sys_temp.dev_attr.attr - #define DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(index) \ static SENSOR_DEVICE_ATTR(fan##index##_present, S_IRUGO, fan_show_value, NULL, FAN##index##_PRESENT) @@ -200,8 +193,6 @@ DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(5); DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(6); /* 1 fan duty cycle attribute in this platform */ DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(1); -/* System temperature for fancontrol */ -DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR(); static struct attribute *as7312_54x_fan_attributes[] = { /* fan related attributes */ @@ -230,7 +221,6 @@ static struct attribute *as7312_54x_fan_attributes[] = { DECLARE_FAN_DIRECTION_ATTR(5), DECLARE_FAN_DIRECTION_ATTR(6), DECLARE_FAN_DUTY_CYCLE_ATTR(1), - DECLARE_FAN_SYSTEM_TEMP_ATTR(), NULL }; @@ -348,267 +338,6 @@ static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, return count; } -/* Due to this struct is declared at lm75.c, it cannot be include - * under Sonic environment. I duplicate it from lm75.c. - */ -struct lm75_data { - struct i2c_client *client; - struct device *hwmon_dev; - struct thermal_zone_device *tz; - struct mutex update_lock; - u8 orig_conf; - u8 resolution; /* In bits, between 9 and 12 */ - u8 resolution_limits; - char valid; /* !=0 if registers are valid */ - unsigned long last_updated; /* In jiffies */ - unsigned long sample_time; /* In jiffies */ - s16 temp[3]; /* Register values, - 0 = input - 1 = max - 2 = hyst */ -}; - -/*Copied from lm75.c*/ -static inline long lm75_reg_to_mc(s16 temp, u8 resolution) -{ - return ((temp >> (16 - resolution)) * 1000) >> (resolution - 8); -} - -/*Get hwmon_dev from i2c_client, set hwmon_dev = NULL is failed.*/ -static struct device * get_hwmon_dev( - struct i2c_client *client) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - if(data) - { - if( data->valid == 1 && data->hwmon_dev) - { - return data->hwmon_dev; - } - - } - return NULL; -} - -/* To find hwmon index by opening hwmon under that i2c address. - */ -static int find_hwmon_index_by_FileOpen( - int bus_nr, - unsigned short addr, - OUT int *index) -{ -#define MAX_HWMON_DEVICE (10) /* Find hwmon device in 0~10*/ - struct file *sfd; - char client_name[96]; - int i=0; - - do { - snprintf(client_name, sizeof(client_name), - "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", - bus_nr, addr, i); - - sfd = filp_open(client_name, O_RDONLY, 0); - i++; - } while( IS_ERR(sfd) && i < MAX_HWMON_DEVICE); - - if (IS_ERR(sfd)) { - pr_err("Failed to open file(%s)#%d\r\n", client_name, __LINE__); - return -ENOENT; - } - filp_close(sfd, 0); - *index = i - 1; - return 0; - -#undef MAX_HWMON_DEVICE -} - -static int get_temp_file_path( - int bus_nr, unsigned short addr, - struct device *hwmon_dev - ,char *path, int max_len) -{ - - if(hwmon_dev && strlen(dev_name(hwmon_dev))) - { - snprintf(path, max_len, - "/sys/bus/i2c/devices/%d-%04x/hwmon/%s/temp1_input", - bus_nr, addr, dev_name(hwmon_dev)); - } - else - { - int i=0; - if(find_hwmon_index_by_FileOpen( bus_nr, addr, &i)) - { - return -EIO; - } - snprintf(path, max_len, - "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", - bus_nr, addr, i); - } - return 0; -} - -/*File read the dev file at user space.*/ -static int read_devfile_temp1_input( - struct device *dev, - int bus_nr, - unsigned short addr, - struct device *hwmon_dev, - int *miniCelsius) -{ - struct file *sfd; - char buffer[96]; - char devfile[96]; - int rc, status; - int rdlen, value; - mm_segment_t old_fs; - - rc = 0; - get_temp_file_path(bus_nr, addr, hwmon_dev, devfile, sizeof(devfile)); - sfd = filp_open(devfile, O_RDONLY, 0); - if (IS_ERR(sfd)) { - pr_err("Failed to open file(%s)#%d\r\n", devfile, __LINE__); - return -ENOENT; - } - dev_dbg(dev, "Found device:%s\n",devfile); - - if(!(sfd->f_op) || !(sfd->f_op->read) ) { - pr_err("file %s cann't readable ?\n",devfile); - return -ENOENT; - } - - old_fs = get_fs(); - set_fs(KERNEL_DS); - rdlen = sfd->f_op->read(sfd, buffer, sizeof(buffer), &sfd->f_pos); - if (rdlen == 0) { - pr_err( "File(%s) empty!\n", devfile); - rc = -EIO; - goto exit; - } - status = sscanf(buffer, "%d", &value); - if (status != 1) { - rc = -EIO; - goto exit; - } - *miniCelsius = value; - dev_dbg(dev,"found sensors: %d @i2c %d-%04x\n", value, bus_nr, addr); - -exit: - set_fs(old_fs); - filp_close(sfd, 0); - return rc; -} - -static u8 is_lm75_data_due(struct i2c_client *client) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - if (time_after(jiffies, data->last_updated + data->sample_time)) - { - return 1; - } - return 0; -} -static int get_lm75_temp(struct i2c_client *client, int *miniCelsius) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - *miniCelsius = lm75_reg_to_mc(data->temp[0], data->resolution); - - return 0; -} - -static bool lm75_addr_mached(unsigned short addr) -{ - int i; - unsigned short addrs[] = THERMAL_SENSORS_ADDRS; - - for (i = 0; i < ARRAY_SIZE(addrs); i++) - { - if( addr == addrs[i]) - return 1; - } - return 0; -} - -static int _find_lm75_device(struct device *dev, void *data) -{ - struct device_driver *driver; - struct as7312_54x_fan_data *prv = data; - char *driver_name = THERMAL_SENSORS_DRIVER; - - driver = dev->driver; - if (driver && driver->name && - strcmp(driver->name, driver_name) == 0) - { - struct i2c_client *client; - client = to_i2c_client(dev); - if (client) - { - /*cannot use "struct i2c_adapter *adap = to_i2c_adapter(dev);"*/ - struct i2c_adapter *adap = client->adapter; - int miniCelsius = 0; - - if (! lm75_addr_mached(client->addr)) - { - return 0; - } - - if (!adap) { - return -ENXIO; - } - - /* If the data is not updated, read them from devfile - to drive them updateing data from chip.*/ - if (is_lm75_data_due(client)) - { - struct device *hwmon_dev; - - hwmon_dev = get_hwmon_dev(client); - if(0 == read_devfile_temp1_input(dev, adap->nr, - client->addr, hwmon_dev, &miniCelsius)) - { - prv->system_temp += miniCelsius; - prv->sensors_found++; - } - - } - else - { - get_lm75_temp(client, &miniCelsius); - prv->system_temp += miniCelsius; - prv->sensors_found++; - - } - } - } - return 0; -} - -/*Find all lm75 devices and return sum of temperatures.*/ -static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, - char *buf) -{ - ssize_t ret = 0; - struct as7312_54x_fan_data *data = as7312_54x_fan_update_device(dev); - - data->system_temp=0; - data->sensors_found=0; - i2c_for_each_dev(data, _find_lm75_device); - if (NUM_THERMAL_SENSORS != data->sensors_found) - { - dev_dbg(dev,"only %d of %d temps are found\n", - data->sensors_found, NUM_THERMAL_SENSORS); - data->system_temp = INT_MAX; - } - ret = sprintf(buf, "%d\n",data->system_temp); - return ret; -} - static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf) { diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/utils/accton_as7312_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/utils/accton_as7312_monitor.py index 58ffe1923a85..58940c6636ec 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/utils/accton_as7312_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/utils/accton_as7312_monitor.py @@ -193,11 +193,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl') except getopt.GetoptError: - print 'Usage: %s [-d]' % sys.argv[0] + print('Usage: %s [-d]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l]' % sys.argv[0] + print('Usage: %s [-d] [-l]' % sys.argv[0]) return 0 elif opt in ('-d'): log_console = 1 diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/utils/accton_as7312_util.py b/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/utils/accton_as7312_util.py index f6a21bdd3df9..88d40521ebf0 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/utils/accton_as7312_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/utils/accton_as7312_util.py @@ -30,7 +30,7 @@ set : change board setting with fan|led|sfp """ -import commands +import subprocess import getopt import sys import logging @@ -53,8 +53,8 @@ if DEBUG == True: - print sys.argv[0] - print 'ARGV :', sys.argv[1:] + print(sys.argv[0]) + print('ARGV :', sys.argv[1:]) def main(): @@ -70,9 +70,9 @@ def main(): 'force', ]) if DEBUG == True: - print options - print args - print len(sys.argv) + print(options) + print(args) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -112,36 +112,36 @@ def main(): return 0 def show_help(): - print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + print(__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) def show_set_help(): cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print cmd +" [led|sfp|fan]" - print " use \""+ cmd + " led 0-4 \" to set led color" - print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" - print " use \""+ cmd + " sfp 1-54 {0|1}\" to set sfp# tx_disable" + print(cmd +" [led|sfp|fan]") + print(" use \""+ cmd + " led 0-4 \" to set led color") + print(" use \""+ cmd + " fan 0-100\" to set fan duty percetage") + print(" use \""+ cmd + " sfp 1-54 {0|1}\" to set sfp# tx_disable") sys.exit(0) def show_eeprom_help(): cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print " use \""+ cmd + " 1-54 \" to dump sfp# eeprom" + print(" use \""+ cmd + " 1-54 \" to dump sfp# eeprom") sys.exit(0) def my_log(txt): if DEBUG == True: - print "[ROY]"+txt + print("[ROY]"+txt) return def log_os_system(cmd, show): logging.info('Run :'+cmd) - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) my_log (cmd +"with result:" + str(status)) my_log (" output:"+output) if status: logging.info('Failed :'+cmd) if show: - print('Failed :'+cmd) + print(('Failed :'+cmd)) return status, output def driver_check(): @@ -292,7 +292,7 @@ def device_install(): status, output = log_os_system(mknod2[i], 1) if status: - print output + print(output) if FORCE == 0: return status else: @@ -303,7 +303,7 @@ def device_install(): status, output = log_os_system(mknod[i], 1) if status: - print output + print(output) if FORCE == 0: return status for i in range(0,len(sfp_map)): @@ -312,7 +312,7 @@ def device_install(): else: status, output =log_os_system("echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) if status: - print output + print(output) if FORCE == 0: return status return @@ -330,7 +330,7 @@ def device_uninstall(): target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device" status, output =log_os_system("echo 0x50 > "+ target, 1) if status: - print output + print(output) if FORCE == 0: return status @@ -346,7 +346,7 @@ def device_uninstall(): temp[-1] = temp[-1].replace('new_device', 'delete_device') status, output = log_os_system(" ".join(temp), 1) if status: - print output + print(output) if FORCE == 0: return status @@ -360,40 +360,40 @@ def system_ready(): return True def do_install(): - print "Checking system...." + print("Checking system....") if driver_check() == False: - print "No driver, installing...." + print("No driver, installing....") status = driver_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" drivers detected...." + print(PROJECT_NAME.upper()+" drivers detected....") if not device_exist(): - print "No device, installing...." + print("No device, installing....") status = device_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" devices detected...." + print(PROJECT_NAME.upper()+" devices detected....") return def do_uninstall(): - print "Checking system...." + print("Checking system....") if not device_exist(): - print PROJECT_NAME.upper() +" has no device installed...." + print(PROJECT_NAME.upper() +" has no device installed....") else: - print "Removing device...." + print("Removing device....") status = device_uninstall() if status: if FORCE == 0: return status if driver_check()== False : - print PROJECT_NAME.upper() +" has no driver installed...." + print(PROJECT_NAME.upper() +" has no driver installed....") else: - print "Removing installed driver...." + print("Removing installed driver....") status = driver_uninstall() if status: if FORCE == 0: @@ -446,11 +446,11 @@ def devices_info(): #show dict all in the order if DEBUG == True: for i in sorted(ALL_DEVICE.keys()): - print(i+": ") + print((i+": ")) for j in sorted(ALL_DEVICE[i].keys()): - print(" "+j) + print((" "+j)) for k in (ALL_DEVICE[i][j]): - print(" "+" "+k) + print((" "+" "+k)) return def show_eeprom(index): @@ -473,15 +473,15 @@ def show_eeprom(index): else: log = 'Failed : no hexdump cmd!!' logging.info(log) - print log + print(log) return 1 - print node + ":" + print(node + ":") ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) if ret==0: - print log + print(log) else: - print "**********device no found**********" + print("**********device no found**********") return def set_device(args): @@ -515,10 +515,10 @@ def set_device(args): node = node.replace(node.split("/")[-1], 'fan_duty_cycle_percentage') ret, log = log_os_system("cat "+ node, 1) if ret==0: - print ("Previous fan duty: " + log.strip() +"%") + print(("Previous fan duty: " + log.strip() +"%")) ret, log = log_os_system("echo "+args[1]+" >"+node, 1) if ret==0: - print ("Current fan duty: " + args[1] +"%") + print(("Current fan duty: " + args[1] +"%")) return ret elif args[0]=='sfp': if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: @@ -558,25 +558,25 @@ def device_traversal(): devices_info() for i in sorted(ALL_DEVICE.keys()): print("============================================") - print(i.upper()+": ") + print((i.upper()+": ")) print("============================================") - for j in sorted(ALL_DEVICE[i].keys(), key=get_value): - print " "+j+":", + for j in sorted(list(ALL_DEVICE[i].keys()), key=get_value): + print(" "+j+":", end=' ') for k in (ALL_DEVICE[i][j]): ret, log = log_os_system("cat "+k, 0) func = k.split("/")[-1].strip() func = re.sub(j+'_','',func,1) func = re.sub(i.lower()+'_','',func,1) if ret==0: - print func+"="+log+" ", + print(func+"="+log+" ", end=' ') else: - print func+"="+"X"+" ", - print + print(func+"="+"X"+" ", end=' ') + print() print("----------------------------------------------------------------") - print + print() return def device_exist(): diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/classes/fanutil.py index 0e7b06bbd287..31697f7c644e 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/classes/fanutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/classes/fanutil.py @@ -27,6 +27,7 @@ import time import logging from collections import namedtuple + import subprocess except ImportError as e: raise ImportError('%s - required module not found' % str(e)) @@ -44,8 +45,11 @@ class FanUtil(object): #FAN_NODE_DUTY_IDX_OF_MAP = 4 #FANR_NODE_FAULT_IDX_OF_MAP = 5 - BASE_VAL_PATH = '/sys/bus/i2c/devices/50-0066/{0}' - FAN_DUTY_PATH = '/sys/bus/i2c/devices/50-0066/fan{0}_pwm' + I2CADDR_CANDIDATES = ((9, 66), # for R0C HW and later + (50, 66)) # for R0A, R0B HW + PATH_PREFIX = '/sys/bus/i2c/devices/{}-00{}/' + BASE_VAL_PATH = '{0}' + FAN_DUTY_PATH = 'fan{0}_pwm' #logfile = '' #loglevel = self.logger.INFO @@ -59,6 +63,21 @@ class FanUtil(object): node_postfix = ["fault", "direction"] def _get_fan_to_device_node(self, fan_num, node_num): return "fan{0}_{1}".format(fan_num, self.node_postfix[node_num-1]) + + def _get_fan_i2c_bus_addr(self): + cmd_template = 'i2cget -f -y {} 0x{} 0' + for bus_no, dev_addr in self.I2CADDR_CANDIDATES: + cmd = cmd_template.format(bus_no, dev_addr) + if subprocess.getstatusoutput(cmd)[0] == 0: + return bus_no, dev_addr + raise IOError('Unable to reach fan CPLD via I2C') + + def _init_fnode_basepath(self): + '''format BASE_VAL_PATH and FAN_DUTY_PATH ''' + bus, addr = self._get_fan_i2c_bus_addr() + self.PATH_PREFIX = self.PATH_PREFIX.format(bus, addr) + self.BASE_VAL_PATH = self.PATH_PREFIX + self.BASE_VAL_PATH + self.FAN_DUTY_PATH = self.PATH_PREFIX + self.FAN_DUTY_PATH def _get_fan_node_val(self, fan_num, node_num): if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_TOTAL_NUM: @@ -84,7 +103,7 @@ def _get_fan_node_val(self, fan_num, node_num): return None try: - val_file.close() + val_file.close() except: self.logger.debug('GET. unable to close file. device_path:%s', device_path) return None @@ -115,7 +134,7 @@ def _set_fan_node_val(self, fan_num, node_num, val): val_file.write(content) try: - val_file.close() + val_file.close() except: self.logger.debug('GET. unable to close file. device_path:%s', device_path) return None @@ -128,6 +147,7 @@ def __init__(self, log_level=logging.DEBUG): ch.setLevel(log_level) self.logger.addHandler(ch) + self._init_fnode_basepath() fan_path = self.BASE_VAL_PATH for fan_num in range(self.FAN_NUM_1_IDX, self.FAN_TOTAL_NUM+1): for node_num in range(1, self.FAN_NODE_NUM+1): @@ -168,7 +188,7 @@ def get_fan_duty_cycle(self): try: val_file = open(self.FAN_DUTY_PATH.format(1)) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() @@ -180,7 +200,7 @@ def set_fan_duty_cycle(self, val): try: fan_file = open(self.FAN_DUTY_PATH.format(fan_num), 'r+') except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False fan_file.write(str(val)) fan_file.close() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/Makefile index a1bf8335378c..9ef6485f5677 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/Makefile @@ -1,2 +1,2 @@ obj-m:= accton_as7315_27xb_fan.o x86-64-accton-as7315-27xb-cpld.o x86-64-accton-as7315-27xb-psu.o \ - at24_as7315_27xb.o x86-64-accton-as7315-27xb-led.o ym2651y.o + x86-64-accton-as7315-27xb-led.o ym2651y.o diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/at24_as7315_27xb.c b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/at24_as7315_27xb.c deleted file mode 100755 index 8d8c7601a71d..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/at24_as7315_27xb.c +++ /dev/null @@ -1,695 +0,0 @@ -/* - * at24_as7315_27xb.c - handle most I2C EEPROMs for ethernet switch, as7315_27xb. - * - * Copyright (C) 2005-2007 David Brownell - * Copyright (C) 2008 Wolfram Sang, Pengutronix - * Copyright (C) 2019 Roy Lee, EdgeCore network. - * Revised to support specially I2C transactions, pure READ and WRITE. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -/* - * I2C EEPROMs from most vendors are inexpensive and mostly interchangeable. - * Differences between different vendor product lines (like Atmel AT24C or - * MicroChip 24LC, etc) won't much matter for typical read/write access. - * There are also I2C RAM chips, likewise interchangeable. One example - * would be the PCF8570, which acts like a 24c02 EEPROM (256 bytes). - * - * However, misconfiguration can lose data. "Set 16-bit memory address" - * to a part with 8-bit addressing will overwrite data. Writing with too - * big a page size also loses data. And it's not safe to assume that the - * conventional addresses 0x50..0x57 only hold eeproms; a PCF8563 RTC - * uses 0x51, for just one example. - * - * Accordingly, explicit board-specific configuration data should be used - * in almost all cases. (One partial exception is an SMBus used to access - * "SPD" data for DRAM sticks. Those only use 24c02 EEPROMs.) - * - * So this driver uses "new style" I2C driver binding, expecting to be - * told what devices exist. That may be in arch/X/mach-Y/board-Z.c or - * similar kernel-resident tables; or, configuration data coming from - * a bootloader. - * - * Other than binding model, current differences from "eeprom" driver are - * that this one handles write access and isn't restricted to 24c02 devices. - * It also handles larger devices (32 kbit and up) with two-byte addresses, - * which won't work on pure SMBus systems. - */ - -struct at24_data { - struct at24_platform_data chip; - int use_smbus; - int use_smbus_write; - - ssize_t (*read_func)(struct at24_data *, char *, unsigned int, size_t); - ssize_t (*write_func)(struct at24_data *, - const char *, unsigned int, size_t); - - /* - * Lock protects against activities from other Linux tasks, - * but not from changes by other I2C masters. - */ - struct mutex lock; - - u8 *writebuf; - unsigned write_max; - unsigned num_addresses; - - struct nvmem_config nvmem_config; - struct nvmem_device *nvmem; - - /* - * Some chips tie up multiple I2C addresses; dummy devices reserve - * them for us, and we'll use them with SMBus calls. - */ - struct i2c_client *client[]; -}; - -/* - * This parameter is to help this driver avoid blocking other drivers out - * of I2C for potentially troublesome amounts of time. With a 100 kHz I2C - * clock, one 256 byte read takes about 1/43 second which is excessive; - * but the 1/170 second it takes at 400 kHz may be quite reasonable; and - * at 1 MHz (Fm+) a 1/430 second delay could easily be invisible. - * - * This value is forced to be a power of two so that writes align on pages. - */ -static unsigned io_limit = 128; -module_param(io_limit, uint, 0); -MODULE_PARM_DESC(io_limit, "Maximum bytes per I/O (default 128)"); - -/* - * Specs often allow 5 msec for a page write, sometimes 20 msec; - * it's important to recover from write timeouts. - */ -static unsigned write_timeout = 25; -module_param(write_timeout, uint, 0); -MODULE_PARM_DESC(write_timeout, "Time (in ms) to try writes (default 25)"); - -#define AT24_SIZE_BYTELEN 5 -#define AT24_SIZE_FLAGS 8 - -#define AT24_BITMASK(x) (BIT(x) - 1) - -/* create non-zero magic value for given eeprom parameters */ -#define AT24_DEVICE_MAGIC(_len, _flags) \ - ((1 << AT24_SIZE_FLAGS | (_flags)) \ - << AT24_SIZE_BYTELEN | ilog2(_len)) - -/* - * Both reads and writes fail if the previous write didn't complete yet. This - * macro loops a few times waiting at least long enough for one entire page - * write to work while making sure that at least one iteration is run before - * checking the break condition. - * - * It takes two parameters: a variable in which the future timeout in jiffies - * will be stored and a temporary variable holding the time of the last - * iteration of processing the request. Both should be unsigned integers - * holding at least 32 bits. - */ -#define loop_until_timeout(tout, op_time) \ - for (tout = jiffies + msecs_to_jiffies(write_timeout), op_time = 0; \ - op_time ? time_before(op_time, tout) : true; \ - usleep_range(1000, 1500), op_time = jiffies) - -static const struct i2c_device_id at24_ids[] = { - { "24cxb04", AT24_DEVICE_MAGIC(4096 / 8, AT24_FLAG_ADDR16) }, - { "24cxb08", AT24_DEVICE_MAGIC(8192 / 8, AT24_FLAG_ADDR16) }, - { "24cxb16", AT24_DEVICE_MAGIC(16384 / 8, AT24_FLAG_ADDR16) }, - { "24cxb32", AT24_DEVICE_MAGIC(32768 / 8, AT24_FLAG_ADDR16) }, - { "24cxb64", AT24_DEVICE_MAGIC(65536 / 8, AT24_FLAG_ADDR16) }, - { "at24", 0 }, - { /* END OF LIST */ } -}; -MODULE_DEVICE_TABLE(i2c, at24_ids); - -static const struct acpi_device_id at24_acpi_ids[] = { - { "INT3499", AT24_DEVICE_MAGIC(8192 / 8, 0) }, - { } -}; -MODULE_DEVICE_TABLE(acpi, at24_acpi_ids); - -/*-------------------------------------------------------------------------*/ - -/* - * This routine supports chips which consume multiple I2C addresses. It - * computes the addressing information to be used for a given r/w request. - * Assumes that sanity checks for offset happened at sysfs-layer. - * - * Slave address and byte offset derive from the offset. Always - * set the byte address; on a multi-master board, another master - * may have changed the chip's "current" address pointer. - * - * REVISIT some multi-address chips don't rollover page reads to - * the next slave address, so we may need to truncate the count. - * Those chips might need another quirk flag. - * - * If the real hardware used four adjacent 24c02 chips and that - * were misconfigured as one 24c08, that would be a similar effect: - * one "eeprom" file not four, but larger reads would fail when - * they crossed certain pages. - */ -static struct i2c_client *at24_translate_offset(struct at24_data *at24, - unsigned int *offset) -{ - unsigned i; - - /*Always AT24_FLAG_ADDR16*/ - i = *offset >> 16; - *offset &= 0xffff; - - return at24->client[i]; -} - -static ssize_t at24_eeprom_read_smbus(struct at24_data *at24, char *buf, - unsigned int offset, size_t count) -{ - unsigned long timeout, read_time; - struct i2c_client *client; - int status; - client = at24_translate_offset(at24, &offset); - - if (count > io_limit) - count = io_limit; - - loop_until_timeout(timeout, read_time) { -/* - status = i2c_smbus_read_i2c_block_data_or_emulated(client, - offset, - count, buf); - - dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n", - count, offset, status, jiffies); -*/ - int i=0; - - /*Write 2-byte offset*/ - unsigned char bb = offset&0xff; - status = i2c_smbus_write_i2c_block_data(client, offset>>8, 1, &bb); - if (status < 0) { - return status; - } - - while (i < count) { - status = i2c_smbus_read_byte(client); - if (status < 0) { - return status; - } - buf[i] = status; - i++; - } - - - if (i == count) - return count; - } - - return -ETIMEDOUT; -} - -/* - * Note that if the hardware write-protect pin is pulled high, the whole - * chip is normally write protected. But there are plenty of product - * variants here, including OTP fuses and partial chip protect. - * - * We only use page mode writes; the alternative is sloooow. These routines - * write at most one page. - */ - -static size_t at24_adjust_write_count(struct at24_data *at24, - unsigned int offset, size_t count) -{ - unsigned next_page; - - /* write_max is at most a page */ - if (count > at24->write_max) - count = at24->write_max; - - /* Never roll over backwards, to the start of this page */ - next_page = roundup(offset + 1, at24->chip.page_size); - if (offset + count > next_page) - count = next_page - offset; - - return count; -} - -static ssize_t at24_eeprom_write_smbus_block(struct at24_data *at24, - const char *buf, - unsigned int offset, size_t count) -{ - unsigned long timeout, write_time; - struct i2c_client *client; - ssize_t status = 0; - - client = at24_translate_offset(at24, &offset); - count = at24_adjust_write_count(at24, offset, count); - - loop_until_timeout(timeout, write_time) { - status = i2c_smbus_write_i2c_block_data(client, - offset, count, buf); - if (status == 0) - status = count; - - dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", - count, offset, status, jiffies); - - if (status == count) - return count; - } - - return -ETIMEDOUT; -} - -static ssize_t at24_eeprom_write_smbus_byte(struct at24_data *at24, - const char *buf, - unsigned int offset, size_t count) -{ - unsigned long timeout, write_time; - struct i2c_client *client; - ssize_t status = 0; - - client = at24_translate_offset(at24, &offset); - - loop_until_timeout(timeout, write_time) { - status = i2c_smbus_write_byte_data(client, offset, buf[0]); - if (status == 0) - status = count; - - dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", - count, offset, status, jiffies); - - if (status == count) - return count; - } - - return -ETIMEDOUT; -} - -static ssize_t at24_eeprom_write_i2c(struct at24_data *at24, const char *buf, - unsigned int offset, size_t count) -{ - unsigned long timeout, write_time; - struct i2c_client *client; - struct i2c_msg msg; - ssize_t status = 0; - int i = 0; - - client = at24_translate_offset(at24, &offset); - count = at24_adjust_write_count(at24, offset, count); - - msg.addr = client->addr; - msg.flags = 0; - - /* msg.buf is u8 and casts will mask the values */ - msg.buf = at24->writebuf; - if (at24->chip.flags & AT24_FLAG_ADDR16) - msg.buf[i++] = offset >> 8; - - msg.buf[i++] = offset; - memcpy(&msg.buf[i], buf, count); - msg.len = i + count; - - loop_until_timeout(timeout, write_time) { - status = i2c_transfer(client->adapter, &msg, 1); - if (status == 1) - status = count; - - dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", - count, offset, status, jiffies); - - if (status == count) - return count; - } - - return -ETIMEDOUT; -} - -static int at24_read(void *priv, unsigned int off, void *val, size_t count) -{ - struct at24_data *at24 = priv; - char *buf = val; - - - - if (unlikely(!count)) - return count; - - if (off + count > at24->chip.byte_len) - return -EINVAL; - - /* - * Read data from chip, protecting against concurrent updates - * from this host, but not from other I2C masters. - */ - mutex_lock(&at24->lock); - - while (count) { - int status; - - status = at24->read_func(at24, buf, off, count); - if (status < 0) { - mutex_unlock(&at24->lock); - return status; - } - buf += status; - off += status; - count -= status; - } - - mutex_unlock(&at24->lock); - - return 0; -} - -static int at24_write(void *priv, unsigned int off, void *val, size_t count) -{ - struct at24_data *at24 = priv; - char *buf = val; - - if (unlikely(!count)) - return -EINVAL; - - if (off + count > at24->chip.byte_len) - return -EINVAL; - - /* - * Write data to chip, protecting against concurrent updates - * from this host, but not from other I2C masters. - */ - mutex_lock(&at24->lock); - - while (count) { - int status; - - status = at24->write_func(at24, buf, off, count); - if (status < 0) { - mutex_unlock(&at24->lock); - return status; - } - buf += status; - off += status; - count -= status; - } - - mutex_unlock(&at24->lock); - - return 0; -} - -#ifdef CONFIG_OF -static void at24_get_ofdata(struct i2c_client *client, - struct at24_platform_data *chip) -{ - const __be32 *val; - struct device_node *node = client->dev.of_node; - - if (node) { - if (of_get_property(node, "read-only", NULL)) - chip->flags |= AT24_FLAG_READONLY; - val = of_get_property(node, "pagesize", NULL); - if (val) - chip->page_size = be32_to_cpup(val); - } -} -#else -static void at24_get_ofdata(struct i2c_client *client, - struct at24_platform_data *chip) -{ } -#endif /* CONFIG_OF */ - -static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) -{ - struct at24_platform_data chip; - kernel_ulong_t magic = 0; - bool writable; - int use_smbus = 0; - int use_smbus_write = 0; - struct at24_data *at24; - int err; - unsigned i, num_addresses; - - if (client->dev.platform_data) { - chip = *(struct at24_platform_data *)client->dev.platform_data; - } else { - if (id) { - magic = id->driver_data; - } else { - const struct acpi_device_id *aid; - - aid = acpi_match_device(at24_acpi_ids, &client->dev); - if (aid) - magic = aid->driver_data; - } - if (!magic) - return -ENODEV; - - chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN)); - magic >>= AT24_SIZE_BYTELEN; - chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS); - /* - * This is slow, but we can't know all eeproms, so we better - * play safe. Specifying custom eeprom-types via platform_data - * is recommended anyhow. - */ - chip.page_size = 1; - - /* update chipdata if OF is present */ - at24_get_ofdata(client, &chip); - - chip.setup = NULL; - chip.context = NULL; - } - - if (!is_power_of_2(chip.byte_len)) - dev_warn(&client->dev, - "byte_len looks suspicious (no power of 2)!\n"); - if (!chip.page_size) { - dev_err(&client->dev, "page_size must not be 0!\n"); - return -EINVAL; - } - if (!is_power_of_2(chip.page_size)) - dev_warn(&client->dev, - "page_size looks suspicious (no power of 2)!\n"); - - /* - * REVISIT: the size of the EUI-48 byte array is 6 in at24mac402, while - * the call to ilog2() in AT24_DEVICE_MAGIC() rounds it down to 4. - * - * Eventually we'll get rid of the magic values altoghether in favor of - * real structs, but for now just manually set the right size. - */ - if (chip.flags & AT24_FLAG_MAC && chip.byte_len == 4) - chip.byte_len = 6; - - /* Use I2C operations unless we're stuck with SMBus extensions. */ - if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { - /*if (chip.flags & AT24_FLAG_ADDR16){ - return -EPFNOSUPPORT; - }*/ - if (i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { - use_smbus = I2C_SMBUS_I2C_BLOCK_DATA; - } else if (i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_READ_WORD_DATA)) { - use_smbus = I2C_SMBUS_WORD_DATA; - } else if (i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_READ_BYTE_DATA)) { - use_smbus = I2C_SMBUS_BYTE_DATA; - } else { - return -EPFNOSUPPORT; - } - - if (i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) { - use_smbus_write = I2C_SMBUS_I2C_BLOCK_DATA; - } else if (i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { - use_smbus_write = I2C_SMBUS_BYTE_DATA; - chip.page_size = 1; - } - } - - if (chip.flags & AT24_FLAG_TAKE8ADDR) - num_addresses = 8; - else - num_addresses = DIV_ROUND_UP(chip.byte_len, - (chip.flags & AT24_FLAG_ADDR16) ? 65536 : 256); - - at24 = devm_kzalloc(&client->dev, sizeof(struct at24_data) + - num_addresses * sizeof(struct i2c_client *), GFP_KERNEL); - if (!at24) - return -ENOMEM; - - mutex_init(&at24->lock); - at24->use_smbus = use_smbus; - at24->use_smbus_write = use_smbus_write; - at24->chip = chip; - at24->num_addresses = num_addresses; - - if ((chip.flags & AT24_FLAG_SERIAL) && (chip.flags & AT24_FLAG_MAC)) { - dev_err(&client->dev, - "invalid device data - cannot have both AT24_FLAG_SERIAL & AT24_FLAG_MAC."); - return -EINVAL; - } - at24->read_func = at24_eeprom_read_smbus; - - if (at24->use_smbus) { - if (at24->use_smbus_write == I2C_SMBUS_I2C_BLOCK_DATA) - at24->write_func = at24_eeprom_write_smbus_block; - else - at24->write_func = at24_eeprom_write_smbus_byte; - } else { - at24->write_func = at24_eeprom_write_i2c; - } - - writable = !(chip.flags & AT24_FLAG_READONLY); - if (writable) { - if (!use_smbus || use_smbus_write) { - - unsigned write_max = chip.page_size; - - if (write_max > io_limit) - write_max = io_limit; - if (use_smbus && write_max > I2C_SMBUS_BLOCK_MAX) - write_max = I2C_SMBUS_BLOCK_MAX; - at24->write_max = write_max; - - /* buffer (data + address at the beginning) */ - at24->writebuf = devm_kzalloc(&client->dev, - write_max + 2, GFP_KERNEL); - if (!at24->writebuf) - return -ENOMEM; - } else { - dev_warn(&client->dev, - "cannot write due to controller restrictions."); - } - } - - at24->client[0] = client; - - /* use dummy devices for multiple-address chips */ - for (i = 1; i < num_addresses; i++) { - at24->client[i] = i2c_new_dummy(client->adapter, - client->addr + i); - if (!at24->client[i]) { - dev_err(&client->dev, "address 0x%02x unavailable\n", - client->addr + i); - err = -EADDRINUSE; - goto err_clients; - } - } - - i2c_set_clientdata(client, at24); - at24->nvmem_config.name = dev_name(&client->dev); - at24->nvmem_config.dev = &client->dev; - at24->nvmem_config.read_only = !writable; - at24->nvmem_config.root_only = true; - at24->nvmem_config.owner = THIS_MODULE; - at24->nvmem_config.compat = true; - at24->nvmem_config.base_dev = &client->dev; - at24->nvmem_config.reg_read = at24_read; - at24->nvmem_config.reg_write = at24_write; - at24->nvmem_config.priv = at24; - at24->nvmem_config.stride = 1; - at24->nvmem_config.word_size = 1; - at24->nvmem_config.size = chip.byte_len; - - at24->nvmem = nvmem_register(&at24->nvmem_config); - - if (IS_ERR(at24->nvmem)) { - err = PTR_ERR(at24->nvmem); - goto err_clients; - } - - dev_info(&client->dev, "%u byte %s EEPROM, %s, %u bytes/write\n", - chip.byte_len, client->name, - writable ? "writable" : "read-only", at24->write_max); - if (use_smbus == I2C_SMBUS_WORD_DATA || - use_smbus == I2C_SMBUS_BYTE_DATA) { - dev_notice(&client->dev, "Falling back to %s reads, " - "performance will suffer\n", use_smbus == - I2C_SMBUS_WORD_DATA ? "word" : "byte"); - } - - /* export data to kernel code */ - if (chip.setup) - chip.setup(at24->nvmem, chip.context); - - return 0; - -err_clients: - for (i = 1; i < num_addresses; i++) - if (at24->client[i]) - i2c_unregister_device(at24->client[i]); - - return err; -} - -static int at24_remove(struct i2c_client *client) -{ - struct at24_data *at24; - int i; - - at24 = i2c_get_clientdata(client); - - nvmem_unregister(at24->nvmem); - - for (i = 1; i < at24->num_addresses; i++) - i2c_unregister_device(at24->client[i]); - - return 0; -} - -/*-------------------------------------------------------------------------*/ - -static struct i2c_driver at24_as7315_27xb_driver = { - .driver = { - .name = "at24_as7315_27xb", - .acpi_match_table = ACPI_PTR(at24_acpi_ids), - }, - .probe = at24_probe, - .remove = at24_remove, - .id_table = at24_ids, -}; - -static int __init at24_as7315_27xb_init(void) -{ - if (!io_limit) { - pr_err("at24_as7315_27xb: io_limit must not be 0!\n"); - return -EINVAL; - } - - io_limit = rounddown_pow_of_two(io_limit); - return i2c_add_driver(&at24_as7315_27xb_driver); -} -module_init(at24_as7315_27xb_init); - -static void __exit at24_as7315_27xb_exit(void) -{ - i2c_del_driver(&at24_as7315_27xb_driver); -} -module_exit(at24_as7315_27xb_exit); - -MODULE_DESCRIPTION("Driver for I2C EEPROMs on accton switch, as7315_27xb"); -MODULE_AUTHOR("Roy Lee"); -MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/accton_as7315_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/accton_as7315_monitor.py index d5b868255f4a..26ebec649ea7 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/accton_as7315_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/accton_as7315_monitor.py @@ -138,11 +138,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl') except getopt.GetoptError: - print 'Usage: %s [-d] [-l]' % sys.argv[0] + print('Usage: %s [-d] [-l]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l]' % sys.argv[0] + print('Usage: %s [-d] [-l]' % sys.argv[0]) return 0 elif opt in ('-d'): log_console = 1 diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/accton_as7315_util.py b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/accton_as7315_util.py index e3810e42102e..d013b993da27 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/accton_as7315_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/accton_as7315_util.py @@ -30,7 +30,7 @@ set : change board setting with fan|led|sfp """ -import commands +import subprocess import getopt import sys import logging @@ -55,8 +55,8 @@ if DEBUG == True: - print sys.argv[0] - print 'ARGV :', sys.argv[1:] + print(sys.argv[0]) + print('ARGV :', sys.argv[1:]) def main(): @@ -72,9 +72,9 @@ def main(): 'force', ]) if DEBUG == True: - print options - print args - print len(sys.argv) + print(options) + print(args) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -114,36 +114,36 @@ def main(): return 0 def show_help(): - print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + print(__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) def show_set_help(): cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print cmd +" [led|sfp|fan]" - print " use \""+ cmd + " led 0-1 \" to set led color" - print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" - print " use \""+ cmd + " sfp 1-27 {0|1}\" to set sfp# tx_disable" + print(cmd +" [led|sfp|fan]") + print(" use \""+ cmd + " led 0-1 \" to set led color") + print(" use \""+ cmd + " fan 0-100\" to set fan duty percetage") + print(" use \""+ cmd + " sfp 1-27 {0|1}\" to set sfp# tx_disable") sys.exit(0) def show_eeprom_help(): cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print " use \""+ cmd + " 1-27 \" to dump sfp# eeprom" + print(" use \""+ cmd + " 1-27 \" to dump sfp# eeprom") sys.exit(0) def my_log(txt): if DEBUG == True: - print "[ROY]"+txt + print("[ROY]"+txt) return def log_os_system(cmd, show): logging.info('Run :'+cmd) - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) my_log (cmd +"with result:" + str(status)) my_log (" output:"+output) if status: logging.info('Failed :'+cmd) if show: - print('Failed :'+cmd) + print(('Failed :'+cmd)) return status, output def driver_check(): @@ -158,11 +158,12 @@ def driver_check(): kos = [ 'modprobe i2c_dev', -'modprobe i2c_mux_pca954x force_deselect_on_exit=1', +'modprobe i2c_mux_pca954x', +'modprobe i2c_ismt', +'modprobe i2c_i801', 'modprobe optoe', 'modprobe ym2651y', 'modprobe accton_as7315_27xb_fan', -'modprobe at24_as7315_27xb', 'modprobe x86-64-accton-as7315_27xb-cpld', 'modprobe x86-64-accton-as7315_27xb-led', 'modprobe x86-64-accton-as7315_27xb-psu' ] @@ -227,12 +228,13 @@ def driver_uninstall(): 'echo as7315_cpld1 0x63 > /sys/bus/i2c/devices/i2c-8/new_device', 'echo as7315_cpld2 0x64 > /sys/bus/i2c/devices/i2c-7/new_device', -'echo 24cxb04 0x57 > /sys/bus/i2c/devices/i2c-4/new_device', +'echo 24c32 0x57 > /sys/bus/i2c/devices/i2c-4/new_device', 'echo as7315_27xb_psu2 0x50 > /sys/bus/i2c/devices/i2c-12/new_device', 'echo ym2401 0x58 > /sys/bus/i2c/devices/i2c-12/new_device', 'echo as7315_27xb_psu1 0x53 > /sys/bus/i2c/devices/i2c-13/new_device', 'echo ym2401 0x5b > /sys/bus/i2c/devices/i2c-13/new_device', -'echo as7315_fan 0x66 > /sys/bus/i2c/devices/i2c-50/new_device', +'echo as7315_fan 0x66 > /sys/bus/i2c/devices/i2c-50/new_device', # for R0A, R0B HW +'echo as7315_fan 0x66 > /sys/bus/i2c/devices/i2c-9/new_device', # for R0C HW and later 'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-51/new_device', 'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-52/new_device', 'echo lm75 0x4c > /sys/bus/i2c/devices/i2c-53/new_device', @@ -240,7 +242,7 @@ def driver_uninstall(): def i2c_order_check(): return 0 - + def device_install(): global FORCE @@ -251,10 +253,18 @@ def device_install(): status, output = log_os_system(mknod[i], 1) if status: - print output + print(output) if FORCE == 0: return status + # set all pca954x idle_disconnect + cmd = 'echo -2 | tee /sys/bus/i2c/drivers/pca954x/*-00*/idle_state' + status, output = log_os_system(cmd, 1) + if status: + print(output) + if FORCE == 0: + return status + for i in range(0,len(sfp_map)): path = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device" if 1 >= qsfp_start_index: @@ -262,7 +272,7 @@ def device_install(): else: status, output =log_os_system("echo optoe2 0x50 > " + path, 1) if status: - print output + print(output) if FORCE == 0: return status return @@ -276,7 +286,7 @@ def device_uninstall(): target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device" status, output =log_os_system("echo 0x50 > "+ target, 1) if status: - print output + print(output) if FORCE == 0: return status @@ -289,7 +299,7 @@ def device_uninstall(): temp[-1] = temp[-1].replace('new_device', 'delete_device') status, output = log_os_system(" ".join(temp), 1) if status: - print output + print(output) if FORCE == 0: return status @@ -303,41 +313,41 @@ def system_ready(): return True def do_install(): - print "Checking system...." + print("Checking system....") if driver_check() == False: - print "No driver, installing...." + print("No driver, installing....") status = driver_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" drivers detected...." + print(PROJECT_NAME.upper()+" drivers detected....") if not device_exist(): - print "No device, installing...." + print("No device, installing....") status = device_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" devices detected...." + print(PROJECT_NAME.upper()+" devices detected....") return def do_uninstall(): - print "Checking system...." + print("Checking system....") if not device_exist(): - print PROJECT_NAME.upper() +" has no device installed...." + print(PROJECT_NAME.upper() +" has no device installed....") else: - print "Removing device...." + print("Removing device....") status = device_uninstall() if status: if FORCE == 0: return status if driver_check()== False : - print PROJECT_NAME.upper() +" has no driver installed...." + print(PROJECT_NAME.upper() +" has no driver installed....") else: - print "Removing installed driver...." + print("Removing installed driver....") status = driver_uninstall() if status: if FORCE == 0: @@ -395,11 +405,11 @@ def devices_info(): #show dict all in the order if DEBUG == True: for i in sorted(ALL_DEVICE.keys()): - print(i+": ") + print((i+": ")) for j in sorted(ALL_DEVICE[i].keys()): - print(" "+j) + print((" "+j)) for k in (ALL_DEVICE[i][j]): - print(" "+" "+k) + print((" "+" "+k)) return def show_eeprom(index): @@ -420,15 +430,15 @@ def show_eeprom(index): else: log = 'Failed : no hexdump cmd!!' logging.info(log) - print log + print(log) return 1 - print node + ":" + print(node + ":") ret, log = log_os_system(hex_cmd +" -C "+node, 1) if ret==0: - print log + print(log) else: - print "**********device no found**********" + print("**********device no found**********") return def set_device(args): @@ -462,10 +472,10 @@ def set_device(args): node = node.replace(node.split("/")[-1], 'fan_duty_cycle_percentage') ret, log = log_os_system("cat "+ node, 1) if ret==0: - print ("Previous fan duty: " + log.strip() +"%") + print(("Previous fan duty: " + log.strip() +"%")) ret, log = log_os_system("echo "+args[1]+" >"+node, 1) if ret==0: - print ("Current fan duty: " + args[1] +"%") + print(("Current fan duty: " + args[1] +"%")) return ret elif args[0]=='sfp': if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: @@ -505,25 +515,25 @@ def device_traversal(): devices_info() for i in sorted(ALL_DEVICE.keys()): print("============================================") - print(i.upper()+": ") + print((i.upper()+": ")) print("============================================") - for j in sorted(ALL_DEVICE[i].keys(), key=get_value): - print " "+j+":", + for j in sorted(list(ALL_DEVICE[i].keys()), key=get_value): + print(" "+j+":", end=' ') for k in (ALL_DEVICE[i][j]): ret, log = log_os_system("cat "+k, 0) func = k.split("/")[-1].strip() func = re.sub(j+'_','',func,1) func = re.sub(i.lower()+'_','',func,1) if ret==0: - print func+"="+log+" ", + print(func+"="+log+" ", end=' ') else: - print func+"="+"X"+" ", - print + print(func+"="+"X"+" ", end=' ') + print() print("----------------------------------------------------------------") - print + print() return def device_exist(): diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/fanutil.py index 91ca21aa528e..7c994864318c 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/fanutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/fanutil.py @@ -112,7 +112,7 @@ def _get_fan_node_val(self, fan_num, node_num): return None try: - val_file.close() + val_file.close() except: logging.debug('GET. unable to close file. device_path:%s', device_path) return None @@ -143,7 +143,7 @@ def _set_fan_node_val(self, fan_num, node_num, val): val_file.write(content) try: - val_file.close() + val_file.close() except: logging.debug('GET. unable to close file. device_path:%s', device_path) return None @@ -193,7 +193,7 @@ def get_fan_duty_cycle(self): try: val_file = open(self.FAN_DUTY_PATH) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() @@ -212,7 +212,7 @@ def set_fan_duty_cycle(self, val): try: fan_file = open(self.FAN_DUTY_PATH, 'r+') except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False fan_file.write(str(val)) fan_file.close() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/thermalutil.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/thermalutil.py index 9087ff1c38f4..5cf9c6fdd3f5 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/thermalutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/thermalutil.py @@ -27,7 +27,7 @@ import time import logging import glob - import commands + import subprocess from collections import namedtuple except ImportError as e: raise ImportError('%s - required module not found' % str(e)) @@ -37,14 +37,14 @@ def log_os_system(cmd, show): logging.info('Run :'+cmd) status = 1 output = "" - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) if show: - print "ACC: " + str(cmd) + " , result:"+ str(status) + print("ACC: " + str(cmd) + " , result:"+ str(status)) if status: logging.info('Failed :'+cmd) if show: - print('Failed :'+cmd) + print(('Failed :'+cmd)) return status, output @@ -116,7 +116,7 @@ def _get_thermal_val(self, thermal_num): try: check_file = open(file_path) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return 0 file_str = check_file.read() search_str="average current temperature is" diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/Makefile index 85c066571c2f..6789630def0b 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/Makefile @@ -1,7 +1,12 @@ ifneq ($(KERNELRELEASE),) obj-m:= accton_i2c_cpld.o \ accton_as7326_56x_fan.o accton_as7326_56x_leds.o \ - accton_as7326_56x_psu.o ym2651y.o + accton_as7326_56x_psu.o ym2651y.o \ + pddf_custom_psu.o + + +CFLAGS_pddf_custom_psu.o := -I$(M)/../../../../pddf/i2c/modules/include +KBUILD_EXTRA_SYMBOLS := $(M)/../../../../pddf/i2c/Module.symvers.PDDF else ifeq (,$(KERNEL_SRC)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_fan.c b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_fan.c index 606019f3ea44..6120760fa941 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_fan.c +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_fan.c @@ -48,7 +48,7 @@ static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, static ssize_t get_enable(struct device *dev, struct device_attribute *da, char *buf); static ssize_t set_enable(struct device *dev, struct device_attribute *da, const char *buf, size_t count); -static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, char *buf); + extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); extern int accton_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); @@ -150,12 +150,6 @@ enum sysfs_fan_attributes { &sensor_dev_attr_pwm##index.dev_attr.attr, \ &sensor_dev_attr_pwm##index##_enable.dev_attr.attr -#define DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR() \ - static SENSOR_DEVICE_ATTR(sys_temp, S_IRUGO, get_sys_temp, NULL, FAN_DUTY_CYCLE_PERCENTAGE) - -#define DECLARE_FAN_SYSTEM_TEMP_ATTR() &sensor_dev_attr_sys_temp.dev_attr.attr - - #define DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(index) \ static SENSOR_DEVICE_ATTR(fan##index##_present, S_IRUGO, fan_show_value, NULL, FAN##index##_PRESENT) #define DECLARE_FAN_PRESENT_ATTR(index) &sensor_dev_attr_fan##index##_present.dev_attr.attr @@ -200,8 +194,6 @@ DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(5); DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(6); /* 1 fan duty cycle attribute in this platform */ DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(1); -/* System temperature for fancontrol */ -DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR(); static struct attribute *as7326_56x_fan_attributes[] = { /* fan related attributes */ @@ -230,7 +222,6 @@ static struct attribute *as7326_56x_fan_attributes[] = { DECLARE_FAN_DIRECTION_ATTR(5), DECLARE_FAN_DIRECTION_ATTR(6), DECLARE_FAN_DUTY_CYCLE_ATTR(1), - DECLARE_FAN_SYSTEM_TEMP_ATTR(), NULL }; @@ -348,267 +339,6 @@ static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, return count; } -/* Due to this struct is declared at lm75.c, it cannot be include - * under Sonic environment. I duplicate it from lm75.c. - */ -struct lm75_data { - struct i2c_client *client; - struct device *hwmon_dev; - struct thermal_zone_device *tz; - struct mutex update_lock; - u8 orig_conf; - u8 resolution; /* In bits, between 9 and 12 */ - u8 resolution_limits; - char valid; /* !=0 if registers are valid */ - unsigned long last_updated; /* In jiffies */ - unsigned long sample_time; /* In jiffies */ - s16 temp[3]; /* Register values, - 0 = input - 1 = max - 2 = hyst */ -}; - -/*Copied from lm75.c*/ -static inline long lm75_reg_to_mc(s16 temp, u8 resolution) -{ - return ((temp >> (16 - resolution)) * 1000) >> (resolution - 8); -} - -/*Get hwmon_dev from i2c_client, set hwmon_dev = NULL is failed.*/ -static struct device * get_hwmon_dev( - struct i2c_client *client) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - if(data) - { - if( data->valid == 1 && data->hwmon_dev) - { - return data->hwmon_dev; - } - - } - return NULL; -} - -/* To find hwmon index by opening hwmon under that i2c address. - */ -static int find_hwmon_index_by_FileOpen( - int bus_nr, - unsigned short addr, - OUT int *index) -{ -#define MAX_HWMON_DEVICE (10) /* Find hwmon device in 0~10*/ - struct file *sfd; - char client_name[96]; - int i=0; - - do { - snprintf(client_name, sizeof(client_name), - "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", - bus_nr, addr, i); - - sfd = filp_open(client_name, O_RDONLY, 0); - i++; - } while( IS_ERR(sfd) && i < MAX_HWMON_DEVICE); - - if (IS_ERR(sfd)) { - pr_err("Failed to open file(%s)#%d\r\n", client_name, __LINE__); - return -ENOENT; - } - filp_close(sfd, 0); - *index = i - 1; - return 0; - -#undef MAX_HWMON_DEVICE -} - -static int get_temp_file_path( - int bus_nr, unsigned short addr, - struct device *hwmon_dev - ,char *path, int max_len) -{ - - if(hwmon_dev && strlen(dev_name(hwmon_dev))) - { - snprintf(path, max_len, - "/sys/bus/i2c/devices/%d-%04x/hwmon/%s/temp1_input", - bus_nr, addr, dev_name(hwmon_dev)); - } - else - { - int i=0; - if(find_hwmon_index_by_FileOpen( bus_nr, addr, &i)) - { - return -EIO; - } - snprintf(path, max_len, - "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", - bus_nr, addr, i); - } - return 0; -} - -/*File read the dev file at user space.*/ -static int read_devfile_temp1_input( - struct device *dev, - int bus_nr, - unsigned short addr, - struct device *hwmon_dev, - int *miniCelsius) -{ - struct file *sfd; - char buffer[96]; - char devfile[96]; - int rc, status; - int rdlen, value; - mm_segment_t old_fs; - - rc = 0; - get_temp_file_path(bus_nr, addr, hwmon_dev, devfile, sizeof(devfile)); - sfd = filp_open(devfile, O_RDONLY, 0); - if (IS_ERR(sfd)) { - pr_err("Failed to open file(%s)#%d\r\n", devfile, __LINE__); - return -ENOENT; - } - dev_dbg(dev, "Found device:%s\n",devfile); - - if(!(sfd->f_op) || !(sfd->f_op->read) ) { - pr_err("file %s cann't readable ?\n",devfile); - return -ENOENT; - } - - old_fs = get_fs(); - set_fs(KERNEL_DS); - rdlen = sfd->f_op->read(sfd, buffer, sizeof(buffer), &sfd->f_pos); - if (rdlen == 0) { - pr_err( "File(%s) empty!\n", devfile); - rc = -EIO; - goto exit; - } - status = sscanf(buffer, "%d", &value); - if (status != 1) { - rc = -EIO; - goto exit; - } - *miniCelsius = value; - dev_dbg(dev,"found sensors: %d @i2c %d-%04x\n", value, bus_nr, addr); - -exit: - set_fs(old_fs); - filp_close(sfd, 0); - return rc; -} - -static u8 is_lm75_data_due(struct i2c_client *client) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - if (time_after(jiffies, data->last_updated + data->sample_time)) - { - return 1; - } - return 0; -} -static int get_lm75_temp(struct i2c_client *client, int *miniCelsius) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - *miniCelsius = lm75_reg_to_mc(data->temp[0], data->resolution); - - return 0; -} - -static bool lm75_addr_mached(unsigned short addr) -{ - int i; - unsigned short addrs[] = THERMAL_SENSORS_ADDRS; - - for (i = 0; i < ARRAY_SIZE(addrs); i++) - { - if( addr == addrs[i]) - return 1; - } - return 0; -} - -static int _find_lm75_device(struct device *dev, void *data) -{ - struct device_driver *driver; - struct as7326_56x_fan_data *prv = data; - char *driver_name = THERMAL_SENSORS_DRIVER; - - driver = dev->driver; - if (driver && driver->name && - strcmp(driver->name, driver_name) == 0) - { - struct i2c_client *client; - client = to_i2c_client(dev); - if (client) - { - /*cannot use "struct i2c_adapter *adap = to_i2c_adapter(dev);"*/ - struct i2c_adapter *adap = client->adapter; - int miniCelsius = 0; - - if (! lm75_addr_mached(client->addr)) - { - return 0; - } - - if (!adap) { - return -ENXIO; - } - - /* If the data is not updated, read them from devfile - to drive them updateing data from chip.*/ - if (is_lm75_data_due(client)) - { - struct device *hwmon_dev; - - hwmon_dev = get_hwmon_dev(client); - if(0 == read_devfile_temp1_input(dev, adap->nr, - client->addr, hwmon_dev, &miniCelsius)) - { - prv->system_temp += miniCelsius; - prv->sensors_found++; - } - - } - else - { - get_lm75_temp(client, &miniCelsius); - prv->system_temp += miniCelsius; - prv->sensors_found++; - - } - } - } - return 0; -} - -/*Find all lm75 devices and return sum of temperatures.*/ -static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, - char *buf) -{ - ssize_t ret = 0; - struct as7326_56x_fan_data *data = as7326_56x_fan_update_device(dev); - - data->system_temp=0; - data->sensors_found=0; - i2c_for_each_dev(data, _find_lm75_device); - if (NUM_THERMAL_SENSORS != data->sensors_found) - { - dev_dbg(dev,"only %d of %d temps are found\n", - data->sensors_found, NUM_THERMAL_SENSORS); - data->system_temp = INT_MAX; - } - ret = sprintf(buf, "%d\n",data->system_temp); - return ret; -} - static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf) { diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_leds.c b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_leds.c index 7214ae55d3f9..035f9ad82ec8 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_leds.c +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_leds.c @@ -146,7 +146,7 @@ static int accton_getLedReg(enum led_type type, u8 *reg) int i; for (i = 0; i < ARRAY_SIZE(led_reg_map); i++) { - if(led_reg_map[i].types ==type)) { + if (led_reg_map[i].types ==type) { *reg = led_reg_map[i].reg_addr; return 0; } diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/pddf_custom_psu.c b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/pddf_custom_psu.c new file mode 100644 index 000000000000..18c3edf72a8c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/pddf_custom_psu.c @@ -0,0 +1,206 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "pddf_psu_defs.h" + +ssize_t pddf_get_custom_psu_model_name(struct device *dev, struct device_attribute *da, char *buf); +ssize_t pddf_get_custom_psu_serial_num(struct device *dev, struct device_attribute *da, char *buf); +extern PSU_SYSFS_ATTR_DATA access_psu_model_name; +extern PSU_SYSFS_ATTR_DATA access_psu_serial_num; + +#define MAX_MODEL_NAME 16 +#define MAX_SERIAL_NUMBER 19 + +enum psu_type { + PSU_TYPE_AC_110V, + PSU_TYPE_DC_48V, + PSU_TYPE_DC_12V, + PSU_TYPE_AC_ACBEL_FSF019, + PSU_TYPE_AC_ACBEL_FSF045 +}; + +struct model_name_info { + enum psu_type type; + u8 offset; + u8 length; + u8 chk_length; + char* model_name; +}; + +struct serial_number_info { + enum psu_type type; + u8 offset; + u8 length; + u8 chk_length; + char* serial_number; +}; + +struct model_name_info models[] = { +{PSU_TYPE_AC_110V, 0x20, 8, 8, "YM-2651Y"}, +{PSU_TYPE_DC_48V, 0x20, 8, 8, "YM-2651V"}, +{PSU_TYPE_DC_12V, 0x00, 11, 11, "PSU-12V-750"}, +{PSU_TYPE_AC_ACBEL_FSF019, 0x15, 10, 7, "FSF019-"}, +{PSU_TYPE_AC_ACBEL_FSF045, 0x15, 10, 7, "FSF045-"} + +}; + +struct serial_number_info serials[] = { +{PSU_TYPE_AC_110V, 0x2e, 18, 18, "YM-2651Y"}, +{PSU_TYPE_DC_48V, 0x2e, 18, 18, "YM-2651V"}, +{PSU_TYPE_DC_12V, 0x2e, 18, 18, "PSU-12V-750"}, +{PSU_TYPE_AC_ACBEL_FSF019, 0x2e, 16, 16, "FSF019-"}, +{PSU_TYPE_AC_ACBEL_FSF019, 0x2e, 16, 16, "FSF045-"} + +}; + +struct pddf_psu_data { + char model_name[MAX_MODEL_NAME+1]; + char serial_number[MAX_SERIAL_NUMBER+1]; +}; + + +static int pddf_psu_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int result = 0; + int retry_count = 10; + + while (retry_count) { + retry_count--; + + result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + + if (unlikely(result < 0)) { + msleep(10); + continue; + } + + if (unlikely(result != data_len)) { + result = -EIO; + msleep(10); + continue; + } + + result = 0; + break; + } + + return result; +} + +ssize_t pddf_get_custom_psu_serial_num(struct device *dev, struct device_attribute *da, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct pddf_psu_data data; + int i, status; + + for (i = 0; i < ARRAY_SIZE(models); i++) { + memset(data.serial_number, 0, sizeof(data.serial_number)); + + status = pddf_psu_read_block(client, models[i].offset, + data.model_name, models[i].length); + if (status < 0) { + data.model_name[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x%x)\n", + client->addr, models[i].offset); + return status; + } + else { + data.model_name[models[i].length] = '\0'; + } + + /* Determine if the model name is known, if not, read next index + */ + if (strncmp(data.model_name, models[i].model_name, models[i].chk_length) == 0) { + status = pddf_psu_read_block(client, serials[i].offset, + data.serial_number, serials[i].length); + + if (status < 0) { + data.serial_number[0] = '\0'; + dev_dbg(&client->dev, "unable to read serial num from (0x%x) offset(0x%x)\n", + client->addr, serials[i].offset); + return status; + } + else { + data.serial_number[serials[i].length] = '\0'; + return sprintf(buf, "%s\n", data.serial_number); + } + + return 0; + } + else { + data.serial_number[0] = '\0'; + } + } + + return -ENODATA; + + +} + +ssize_t pddf_get_custom_psu_model_name(struct device *dev, struct device_attribute *da, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct pddf_psu_data data; + int i, status; + + for (i = 0; i < ARRAY_SIZE(models); i++) { + memset(data.model_name, 0, sizeof(data.model_name)); + + status = pddf_psu_read_block(client, models[i].offset, + data.model_name, models[i].length); + if (status < 0) { + data.model_name[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x%x)\n", + client->addr, models[i].offset); + return status; + } + else { + data.model_name[models[i].length] = '\0'; + } + + /* Determine if the model name is known, if not, read next index + */ + if (strncmp(data.model_name, models[i].model_name, models[i].chk_length) == 0) { + return sprintf(buf, "%s\n", data.model_name); + } + else { + data.model_name[0] = '\0'; + } + } + + return -ENODATA; + +} + +static int __init pddf_custom_psu_init(void) +{ + access_psu_serial_num.show = pddf_get_custom_psu_serial_num; + access_psu_serial_num.do_get = NULL; + + access_psu_model_name.show = pddf_get_custom_psu_model_name; + access_psu_model_name.do_get = NULL; + + return 0; +} + +static void __exit pddf_custom_psu_exit(void) +{ + return; +} + +MODULE_AUTHOR("Broadcom"); +MODULE_DESCRIPTION("pddf custom psu api"); +MODULE_LICENSE("GPL"); + +module_init(pddf_custom_psu_init); +module_exit(pddf_custom_psu_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-platform-handle_mac.service b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-platform-handle_mac.service index ac196c219b91..3d03ec4f1540 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-platform-handle_mac.service +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-platform-handle_mac.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS7326-56X Platform MAC handle service -Before=opennsl-modules.service pddf-platform-init.service +Before=opennsl-modules.service After=local-fs.target [Service] diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..3b9bb607f632 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/fan_drawer.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python + + +try: + from sonic_platform_pddf_base.pddf_fan_drawer import PddfFanDrawer +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class FanDrawer(PddfFanDrawer): + """PDDF Platform-Specific Fan-Drawer class""" + + def __init__(self, tray_idx, pddf_data=None, pddf_plugin_data=None): + # idx is 0-based + PddfFanDrawer.__init__(self, tray_idx, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/thermal.py index 5b829fc26caa..77d6ec7ae886 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/thermal.py @@ -11,7 +11,7 @@ class Thermal(PddfThermal): """PDDF Platform-Specific Thermal class""" - def __init__(self, index, pddf_data=None, pddf_plugin_data=None): - PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data) + def __init__(self, index, pddf_data=None, pddf_plugin_data=None, is_psu_thermal=False, psu_index=0): + PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data, is_psu_thermal, psu_index) # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py index 07ec446ab88e..ec3a4c133cdd 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py @@ -166,14 +166,14 @@ def manage_fans(self): thermal = ThermalUtil() fan = FanUtil() - fan_dir=fan.get_fan_dir(1) - if fan_dir > 1: - fan_dri=1 #something wrong, set fan_dir to default val - if fan_dir < 0: - fan_dri=1 #something wrong, set fan_dir to default val + #fan_dir=fan.get_fan_dir(1) + #if fan_dir > 1: + # fan_dri=1 #something wrong, set fan_dir to default val + #if fan_dir < 0: + # fan_dri=1 #something wrong, set fan_dir to default val ori_pwm=fan.get_fan_duty_cycle() new_pwm=0 - logging.debug('fan_dir=%d, ori_pwm=%d', fan_dir, ori_pwm) + #logging.debug('fan_dir=%d, ori_pwm=%d', fan_dir, ori_pwm) logging.debug('test_temp=%d', test_temp) if test_temp==0: temp1 = thermal._get_thermal_val(1) @@ -282,11 +282,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdlt:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG @@ -295,7 +295,7 @@ def main(argv): if sys.argv[1]== '-t': if len(sys.argv)!=8: - print "temp test, need input six temp" + print("temp test, need input six temp") return 0 i=0 @@ -304,11 +304,11 @@ def main(argv): i=i+1 test_temp = 1 log_level = logging.DEBUG - print test_temp_list + print(test_temp_list) fan = FanUtil() fan.set_fan_duty_cycle(38) - print "set default fan speed to 37.5%" + print("set default fan speed to 37.5%") monitor = device_monitor(log_file, log_level) # Loop forever, doing something useful hopefully: while True: diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor_fan.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor_fan.py index b52ada307698..905bd837d393 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor_fan.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor_fan.py @@ -133,7 +133,7 @@ def manage_fan(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -152,7 +152,7 @@ def manage_fan(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -174,11 +174,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor_psu.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor_psu.py index cb897b942aeb..56b7ee30c41d 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor_psu.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor_psu.py @@ -117,7 +117,7 @@ def manage_psu(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -138,7 +138,7 @@ def manage_psu(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -164,11 +164,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_pddf_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_pddf_monitor.py index 1e9b2c7d35e5..faa4f7d48b15 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_pddf_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_pddf_monitor.py @@ -268,11 +268,11 @@ def main(argv): try: opts, args = getopt.getopt(argv, 'hdlt:', ['lfile=']) except getopt.GetoptError: - print('Usage: %s [-d] [-l ]' % sys.argv[0]) + print(('Usage: %s [-d] [-l ]' % sys.argv[0])) return 0 for opt, arg in opts: if opt == '-h': - print('Usage: %s [-d] [-l ]' % sys.argv[0]) + print(('Usage: %s [-d] [-l ]' % sys.argv[0])) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py index c5d047e9d4e0..c3e1c50366b7 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2016 Accton Networks, Inc. # @@ -14,15 +14,6 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# -# -# Description: -# Due to adoption of optoe drivers, sideband signals of SFPs are moved -# into cpld drivers. Add a new dict, cpld_of_module, for mapping this -# attributes to corresponding cpld nodes. -# - - """ Usage: %(scriptName)s [options] command object @@ -34,18 +25,14 @@ command: install : install drivers and generate related sysfs nodes clean : uninstall drivers and remove related sysfs nodes - show : show all systen status - sff : dump SFP eeprom - set : change board setting with fan|led|sfp """ - -import commands +import subprocess import getopt import sys import logging import re import time - +import os @@ -62,8 +49,8 @@ if DEBUG == True: - print sys.argv[0] - print 'ARGV :', sys.argv[1:] + print(sys.argv[0]) + print('ARGV :', sys.argv[1:]) def main(): @@ -79,9 +66,9 @@ def main(): 'force', ]) if DEBUG == True: - print options - print args - print len(sys.argv) + print(options) + print(args) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -96,53 +83,33 @@ def main(): for arg in args: if arg == 'install': do_install() + elif arg == 'api': + do_sonic_platform_install() + elif arg == 'api_clean': + do_sonic_platform_clean() elif arg == 'clean': do_uninstall() - elif arg == 'show': - device_traversal() - elif arg == 'sff': - if len(args)!=2: - show_eeprom_help() - elif int(args[1]) ==0 or int(args[1]) > DEVICE_NO['sfp']: - show_eeprom_help() - else: - show_eeprom(args[1]) - return - elif arg == 'set': - if len(args)<3: - show_set_help() - else: - set_device(args[1:]) - return else: show_help() - - return 0 def show_help(): - print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + print(__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) -def show_set_help(): - cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print cmd +" [led|sfp|fan]" - print " use \""+ cmd + " led 0-4 \" to set led color" - print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" - print " use \""+ cmd + " sfp 1-56 {0|1}\" to set sfp# tx_disable" - sys.exit(0) + def dis_i2c_ir3570a(addr): cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) return status def ir3570_check(): cmd = "i2cdump -y 0 0x42 s 0x9a" try: - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) lines = output.split('\n') hn = re.findall(r'\w+', lines[-1]) version = int(hn[1], 16) @@ -151,24 +118,19 @@ def ir3570_check(): else: ret = 0 except Exception as e: - print "Error on ir3570_check() e:" + str(e) + print("Error on ir3570_check() e:" + str(e)) return -1 return ret -def show_eeprom_help(): - cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print " use \""+ cmd + " 1-56 \" to dump sfp# eeprom" - sys.exit(0) - def my_log(txt): if DEBUG == True: - print "[ROY]"+txt + print("[ROY]"+txt) return def log_os_system(cmd, show): logging.info('Run :'+cmd) - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) my_log (cmd +"with result:" + str(status)) my_log (" output:"+output) if status: @@ -189,7 +151,7 @@ def driver_check(): kos = [ 'modprobe i2c_dev', -'modprobe i2c_mux_pca954x force_deselect_on_exit=1', +'modprobe i2c_mux_pca954x', 'modprobe accton_i2c_cpld' , 'modprobe ym2651y' , 'modprobe accton_as7326_56x_fan' , @@ -207,6 +169,8 @@ def driver_install(): if status: if FORCE == 0: return status + print("Done driver_install") + return 0 def driver_uninstall(): @@ -224,12 +188,8 @@ def driver_uninstall(): return status return 0 -led_prefix ='/sys/class/leds/accton_'+PROJECT_NAME+'_led::' -hwmon_types = {'led': ['diag','fan','loc','psu1','psu2']} -hwmon_nodes = {'led': ['brightness'] } -hwmon_prefix ={'led': led_prefix} - i2c_prefix = '/sys/bus/i2c/devices/' +''' i2c_bus = {'fan': ['11-0066'] , 'thermal': ['15-0048','15-0049', '15-004a', '15-004b'] , 'psu': ['17-0051','13-0053'], @@ -238,7 +198,7 @@ def driver_uninstall(): 'thermal': ['hwmon/hwmon*/temp1_input'] , 'psu': ['psu_present ', 'psu_power_good'] , 'sfp': ['module_present_', 'module_tx_disable_']} - +''' sfp_map = [ 42,41,44,43,47,45,46,50, 48,49,52,51,53,56,55,54, @@ -268,7 +228,6 @@ def driver_uninstall(): 'echo pca9548 0x74 > /sys/bus/i2c/devices/i2c-36/new_device', 'echo pca9548 0x75 > /sys/bus/i2c/devices/i2c-37/new_device', 'echo pca9548 0x76 > /sys/bus/i2c/devices/i2c-38/new_device', -'echo 24c04 0x56 > /sys/bus/i2c/devices/i2c-0/new_device', 'echo as7326_56x_fan 0x66 > /sys/bus/i2c/devices/i2c-11/new_device ', 'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-15/new_device', @@ -286,12 +245,22 @@ def driver_uninstall(): mknod2 =[ ] +#EERPOM +eeprom_mknod =[ +'echo 24c04 0x56 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo 24c02 0x57 > /sys/bus/i2c/devices/i2c-0/new_device' +] def i2c_order_check(): # This project has only 1 i2c bus. return 0 +def eeprom_check(): + cmd = "i2cget -y -f 0 0x56" + status, output = subprocess.getstatusoutput(cmd) + return status + def device_install(): global FORCE @@ -306,7 +275,7 @@ def device_install(): status, output = log_os_system(mknod2[i], 1) if status: - print output + print(output) if FORCE == 0: return status else: @@ -317,18 +286,43 @@ def device_install(): status, output = log_os_system(mknod[i], 1) if status: - print output + print(output) if FORCE == 0: return status + + # set all pca954x idle_disconnect + cmd = 'echo -2 | tee /sys/bus/i2c/drivers/pca954x/*-00*/idle_state' + status, output = log_os_system(cmd, 1) + if status: + print(output) + if FORCE == 0: + return status + + # initiate IDPROM + # Close 0x77 mux to make sure if the I2C address of IDPROM is 0x56 or 0x57 + log_os_system("i2cset -f -y 0 0x77 0 ", 1) + ret=eeprom_check() + if ret==0: + log_os_system(eeprom_mknod[0], 1) #old board, 0x56 eeprom + time.sleep(0.2) + exists = os.path.isfile('/sys/bus/i2c/devices/0-0056/eeprom') + if (exists is False): + subprocess.call('echo 0x56 > /sys/bus/i2c/devices/i2c-0/delete_device', shell=True) + log_os_system(eeprom_mknod[1], 1) + else: + log_os_system(eeprom_mknod[1], 1) #new board, 0x57 eeprom + + for i in range(0,len(sfp_map)): if i < qsfp_start or i >= qsfp_end: status, output =log_os_system("echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) else: status, output =log_os_system("echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) if status: - print output + print(output) if FORCE == 0: return status + print("Done device_install") return def device_uninstall(): @@ -344,7 +338,7 @@ def device_uninstall(): target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device" status, output =log_os_system("echo 0x50 > "+ target, 1) if status: - print output + print(output) if FORCE == 0: return status @@ -360,10 +354,27 @@ def device_uninstall(): temp[-1] = temp[-1].replace('new_device', 'delete_device') status, output = log_os_system(" ".join(temp), 1) if status: - print output + print(output) if FORCE == 0: return status + #Deal with for del 0x56 or 0x57 sysfs device + exists = os.path.isfile('/sys/bus/i2c/devices/0-0056/eeprom') + + if (exists is True): + target = eeprom_mknod[0] #0x56 + else: + target = eeprom_mknod[1] #0x57 + + temp = target.split() + del temp[1] + temp[-1] = temp[-1].replace('new_device', 'delete_device') + status, output = log_os_system(" ".join(temp), 1) + if status: + print(output) + if FORCE == 0: + return status + return def system_ready(): @@ -372,229 +383,93 @@ def system_ready(): if not device_exist(): return False return True +PLATFORM_ROOT_PATH = '/usr/share/sonic/device' +PLATFORM_API2_WHL_FILE_PY3 ='sonic_platform-1.0-py3-none-any.whl' +def do_sonic_platform_install(): + device_path = "{}{}{}{}".format(PLATFORM_ROOT_PATH, '/x86_64-accton_', PROJECT_NAME, '-r0') + SONIC_PLATFORM_BSP_WHL_PKG_PY3 = "/".join([device_path, PLATFORM_API2_WHL_FILE_PY3]) + + #Check API2.0 on py whl file + status, output = log_os_system("pip3 show sonic-platform > /dev/null 2>&1", 0) + if status: + if os.path.exists(SONIC_PLATFORM_BSP_WHL_PKG_PY3): + status, output = log_os_system("pip3 install "+ SONIC_PLATFORM_BSP_WHL_PKG_PY3, 1) + if status: + print("Error: Failed to install {}".format(PLATFORM_API2_WHL_FILE_PY3)) + return status + else: + print("Successfully installed {} package".format(PLATFORM_API2_WHL_FILE_PY3)) + else: + print('{} is not found'.format(PLATFORM_API2_WHL_FILE_PY3)) + else: + print('{} has installed'.format(PLATFORM_API2_WHL_FILE_PY3)) + + return + +def do_sonic_platform_clean(): + status, output = log_os_system("pip3 show sonic-platform > /dev/null 2>&1", 0) + if status: + print('{} does not install, not need to uninstall'.format(PLATFORM_API2_WHL_FILE_PY3)) + + else: + status, output = log_os_system("pip3 uninstall sonic-platform -y", 0) + if status: + print('Error: Failed to uninstall {}'.format(PLATFORM_API2_WHL_FILE_PY3)) + return status + else: + print('{} is uninstalled'.format(PLATFORM_API2_WHL_FILE_PY3)) + + + return def do_install(): - print "Checking system...." + print("Checking system....") if driver_check() == False: - print "No driver, installing...." + print("No driver, installing....") status = driver_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" drivers detected...." + print(PROJECT_NAME.upper()+" drivers detected....") ir3570_check() if not device_exist(): - print "No device, installing...." + print("No device, installing....") status = device_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" devices detected...." + print(PROJECT_NAME.upper()+" devices detected....") + + do_sonic_platform_install() + return def do_uninstall(): - print "Checking system...." + print("Checking system....") if not device_exist(): - print PROJECT_NAME.upper() +" has no device installed...." + print(PROJECT_NAME.upper() +" has no device installed....") else: - print "Removing device...." + print("Removing device....") status = device_uninstall() if status: if FORCE == 0: return status if driver_check()== False : - print PROJECT_NAME.upper() +" has no driver installed...." + print(PROJECT_NAME.upper() +" has no driver installed....") else: - print "Removing installed driver...." + print("Removing installed driver....") status = driver_uninstall() if status: if FORCE == 0: return status - return - -def devices_info(): - global DEVICE_NO - global ALL_DEVICE - global i2c_bus, hwmon_types - for key in DEVICE_NO: - ALL_DEVICE[key]= {} - for i in range(0,DEVICE_NO[key]): - ALL_DEVICE[key][key+str(i+1)] = [] - - for key in i2c_bus: - buses = i2c_bus[key] - nodes = i2c_nodes[key] - for i in range(0,len(buses)): - for j in range(0,len(nodes)): - if 'fan' == key: - for k in range(0,DEVICE_NO[key]): - node = key+str(k+1) - path = i2c_prefix+ buses[i]+"/fan"+str(k+1)+"_"+ nodes[j] - my_log(node+": "+ path) - ALL_DEVICE[key][node].append(path) - elif 'sfp' == key: - for k in range(0,DEVICE_NO[key]): - for lk in cpld_of_module: - if k in cpld_of_module[lk]: - cpld_str = lk - node = key+str(k+1) - path = i2c_prefix+ lk + "/"+ nodes[j] + str(k+1) - my_log(node+": "+ path) - ALL_DEVICE[key][node].append(path) - else: - node = key+str(i+1) - path = i2c_prefix+ buses[i]+"/"+ nodes[j] - my_log(node+": "+ path) - ALL_DEVICE[key][node].append(path) - - for key in hwmon_types: - itypes = hwmon_types[key] - nodes = hwmon_nodes[key] - for i in range(0,len(itypes)): - for j in range(0,len(nodes)): - node = key+"_"+itypes[i] - path = hwmon_prefix[key]+ itypes[i]+"/"+ nodes[j] - my_log(node+": "+ path) - ALL_DEVICE[key][ key+str(i+1)].append(path) - - #show dict all in the order - if DEBUG == True: - for i in sorted(ALL_DEVICE.keys()): - print(i+": ") - for j in sorted(ALL_DEVICE[i].keys()): - print(" "+j) - for k in (ALL_DEVICE[i][j]): - print(" "+" "+k) - return - -def show_eeprom(index): - if system_ready()==False: - print("System's not ready.") - print("Please install first!") - return - - if len(ALL_DEVICE)==0: - devices_info() - node = ALL_DEVICE['sfp'] ['sfp'+str(index)][0] - node = node.replace(node.split("/")[-1], 'eeprom') - # check if got hexdump command in current environment - ret, log = log_os_system("which hexdump", 0) - ret, log2 = log_os_system("which busybox hexdump", 0) - if len(log): - hex_cmd = 'hexdump' - elif len(log2): - hex_cmd = ' busybox hexdump' - else: - log = 'Failed : no hexdump cmd!!' - logging.info(log) - print log - return 1 - - print node + ":" - ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) - if ret==0: - print log - else: - print "**********device no found**********" - return - -def set_device(args): - global DEVICE_NO - global ALL_DEVICE - if system_ready()==False: - print("System's not ready.") - print("Please install first!") - return - - if len(ALL_DEVICE)==0: - devices_info() - - if args[0]=='led': - if int(args[1])>4: - show_set_help() - return - #print ALL_DEVICE['led'] - for i in range(0,len(ALL_DEVICE['led'])): - for k in (ALL_DEVICE['led']['led'+str(i+1)]): - ret, log = log_os_system("echo "+args[1]+" >"+k, 1) - if ret: - return ret - elif args[0]=='fan': - if int(args[1])>100: - show_set_help() - return - #print ALL_DEVICE['fan'] - #fan1~6 is all fine, all fan share same setting - node = ALL_DEVICE['fan'] ['fan1'][0] - node = node.replace(node.split("/")[-1], 'fan_duty_cycle_percentage') - ret, log = log_os_system("cat "+ node, 1) - if ret==0: - print ("Previous fan duty: " + log.strip() +"%") - ret, log = log_os_system("echo "+args[1]+" >"+node, 1) - if ret==0: - print ("Current fan duty: " + args[1] +"%") - return ret - elif args[0]=='sfp': - if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: - show_set_help() - return - if len(args)<2: - show_set_help() - return - - if int(args[2])>1: - show_set_help() - return - - #print ALL_DEVICE[args[0]] - for i in range(0,len(ALL_DEVICE[args[0]])): - for j in ALL_DEVICE[args[0]][args[0]+str(args[1])]: - if j.find('tx_disable')!= -1: - ret, log = log_os_system("echo "+args[2]+" >"+ j, 1) - if ret: - return ret - return + do_sonic_platform_clean() -#get digits inside a string. -#Ex: 31 for "sfp31" -def get_value(input): - digit = re.findall('\d+', input) - return int(digit[0]) - -def device_traversal(): - if system_ready()==False: - print("System's not ready.") - print("Please install first!") - return - - if len(ALL_DEVICE)==0: - devices_info() - for i in sorted(ALL_DEVICE.keys()): - print("============================================") - print(i.upper()+": ") - print("============================================") - - for j in sorted(ALL_DEVICE[i].keys(), key=get_value): - print " "+j+":", - for k in (ALL_DEVICE[i][j]): - ret, log = log_os_system("cat "+k, 0) - func = k.split("/")[-1].strip() - func = re.sub(j+'_','',func,1) - func = re.sub(i.lower()+'_','',func,1) - if ret==0: - print func+"="+log+" ", - else: - print func+"="+"X"+" ", - print - print("----------------------------------------------------------------") - - print return def device_exist(): diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pddf_post_device_create.sh b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pddf_post_device_create.sh new file mode 100755 index 000000000000..bfa545595338 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pddf_post_device_create.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set_pca_mux_idle_disconnect() +{ + echo -2 | tee /sys/bus/i2c/drivers/pca954x/*-00*/idle_state >& /dev/null + if [ $? -ne 0 ]; then + echo Fail to set pca954x mux idle disconnect + exit 2 + fi +} + +set_pca_mux_idle_disconnect diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pddf_post_driver_install.sh b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pddf_post_driver_install.sh new file mode 100755 index 000000000000..b2dc4ded1f6d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pddf_post_driver_install.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +dis_i2c_ir3570a() +{ + local addr=$1 + + i2cset -y -a 0 $addr 0xE5 0x01 &>/dev/null + i2cset -y -a 0 $addr 0x12 0x02 &>/dev/null +} + + +ir3570_check() +{ + dump=`i2cdump -y 0 0x42 s 0x9a |awk 'END {print $2}'` + if [ $dump -eq 24 ]; then + echo "Disabling i2c function of ir3570a" + dis_i2c_ir3570a 0x4 + fi +} + +ir3570_check + +echo "AS7326 post PDDF driver install completed" diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pddf_switch_svc.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pddf_switch_svc.py index ad492cfaf56f..1b5f46ef0e1d 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pddf_switch_svc.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pddf_switch_svc.py @@ -2,91 +2,91 @@ # Script to stop and start the respective platforms default services. # This will be used while switching the pddf->non-pddf mode and vice versa -import commands +import subprocess def check_pddf_support(): return True def stop_platform_svc(): - status, output = commands.getstatusoutput("systemctl stop as7326-platform-monitor-fan.service") + status, output = subprocess.getstatusoutput("systemctl stop as7326-platform-monitor-fan.service") if status: - print "Stop as7326-platform-fan.service failed %d"%status + print("Stop as7326-platform-fan.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl stop as7326-platform-monitor-psu.service") + status, output = subprocess.getstatusoutput("systemctl stop as7326-platform-monitor-psu.service") if status: - print "Stop as7326-platform-psu.service failed %d"%status + print("Stop as7326-platform-psu.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl stop as7326-platform-monitor.service") + status, output = subprocess.getstatusoutput("systemctl stop as7326-platform-monitor.service") if status: - print "Stop as7326-platform-init.service failed %d"%status + print("Stop as7326-platform-init.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl disable as7326-platform-monitor.service") + status, output = subprocess.getstatusoutput("systemctl disable as7326-platform-monitor.service") if status: - print "Disable as7326-platform-monitor.service failed %d"%status + print("Disable as7326-platform-monitor.service failed %d"%status) return False - status, output = commands.getstatusoutput("/usr/local/bin/accton_as7326_util.py clean") + status, output = subprocess.getstatusoutput("/usr/local/bin/accton_as7326_util.py clean") if status: - print "accton_as7326_util.py clean command failed %d"%status + print("accton_as7326_util.py clean command failed %d"%status) return False # HACK , stop the pddf-platform-init service if it is active - status, output = commands.getstatusoutput("systemctl stop pddf-platform-init.service") + status, output = subprocess.getstatusoutput("systemctl stop pddf-platform-init.service") if status: - print "Stop pddf-platform-init.service along with other platform serives failed %d"%status + print("Stop pddf-platform-init.service along with other platform serives failed %d"%status) return False return True def start_platform_svc(): - status, output = commands.getstatusoutput("/usr/local/bin/accton_as7326_util.py install") + status, output = subprocess.getstatusoutput("/usr/local/bin/accton_as7326_util.py install") if status: - print "accton_as7326_util.py install command failed %d"%status + print("accton_as7326_util.py install command failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl enable as7326-platform-monitor.service") + status, output = subprocess.getstatusoutput("systemctl enable as7326-platform-monitor.service") if status: - print "Enable as7326-platform-monitor.service failed %d"%status + print("Enable as7326-platform-monitor.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl start as7326-platform-monitor-fan.service") + status, output = subprocess.getstatusoutput("systemctl start as7326-platform-monitor-fan.service") if status: - print "Start as7326-platform-monitor-fan.service failed %d"%status + print("Start as7326-platform-monitor-fan.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl start as7326-platform-monitor-psu.service") + status, output = subprocess.getstatusoutput("systemctl start as7326-platform-monitor-psu.service") if status: - print "Start as7326-platform-monitor-psu.service failed %d"%status + print("Start as7326-platform-monitor-psu.service failed %d"%status) return False return True def start_platform_pddf(): - status, output = commands.getstatusoutput("systemctl start pddf-platform-init.service") + status, output = subprocess.getstatusoutput("systemctl start pddf-platform-init.service") if status: - print "Start pddf-platform-init.service failed %d"%status + print("Start pddf-platform-init.service failed %d"%status) return False return True def stop_platform_pddf(): - status, output = commands.getstatusoutput("systemctl stop pddf-platform-init.service") + status, output = subprocess.getstatusoutput("systemctl stop pddf-platform-init.service") if status: - print "Stop pddf-platform-init.service failed %d"%status + print("Stop pddf-platform-init.service failed %d"%status) return False return True def main(): - print"stop_platform_svc" + print("stop_platform_svc") stop_platform_svc() #print"start_platform_svc" #start_platform_svc() #print"start_platform_pddf" #start_platform_pddf() - print"stop_platform_pddf" + print("stop_platform_pddf") stop_platform_pddf() #pass diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pre_pddf_init.sh b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pre_pddf_init.sh new file mode 100755 index 000000000000..8b8c45ef54e7 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pre_pddf_init.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Steps to check syseeprom i2c address +modprobe i2c-i801 +modprobe i2c-dev +use_57_eeprom=true +i2cget -y -f 0 0x56 0x0 +if [ $? -eq 0 ]; then + use_57_eeprom=false + echo "The board has system EEPROM at I2C address 0x56." +fi + +if $use_57_eeprom ; then + echo "The board has system EEPROM at I2C address 0x57." + # syseeprom is at the i2c address 0x57. Change the PDDF JSON file + if [ -f /usr/share/sonic/device/x86_64-accton_as7326_56x-r0/pddf_support ] && \ + [ -f /usr/share/sonic/device/x86_64-accton_as7326_56x-r0/pddf/pddf-device.json ]; then + sed -i 's@"topo_info": {"parent_bus": "0x0", "dev_addr": "0x56", "dev_type": "24c04"},@\ + "topo_info": {"parent_bus": "0x0", "dev_addr": "0x57", "dev_type": "24c02"},@g' \ + /usr/share/sonic/device/x86_64-accton_as7326_56x-r0/pddf/pddf-device.json + sync + fi +fi diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/service/as7712-pddf-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/service/as7712-pddf-platform-monitor.service new file mode 100644 index 000000000000..d0bd9940a348 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/service/as7712-pddf-platform-monitor.service @@ -0,0 +1,16 @@ +[Unit] +Description=Accton AS7712 Platform Monitoring service +Before=pmon.service +After=pddf-platform-init.service +DefaultDependencies=no + +[Service] +ExecStart=/usr/local/bin/accton_as7712_pddf_monitor.py +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/service/pddf-platform-init.service b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/service/pddf-platform-init.service new file mode 120000 index 000000000000..0fd9f25b6c5e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/service/pddf-platform-init.service @@ -0,0 +1 @@ +../../../../pddf/i2c/service/pddf-platform-init.service \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/__init__.py b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/__init__.py new file mode 100644 index 000000000000..f0201e717796 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/__init__.py @@ -0,0 +1,3 @@ +# All the derived classes for PDDF +__all__ = ["platform", "chassis", "sfp", "psu", "thermal"] +from . import platform diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/chassis.py new file mode 100644 index 000000000000..d2edce411665 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/chassis.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python + +############################################################################# +# PDDF +# Module contains an implementation of SONiC Chassis API +# +############################################################################# + +try: + import sys + from sonic_platform_pddf_base.pddf_chassis import PddfChassis + from .event import SfpEvent +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +NUM_COMPONENT = 4 + +class Chassis(PddfChassis): + """ + PDDF Platform-specific Chassis class + """ + + def __init__(self, pddf_data=None, pddf_plugin_data=None): + PddfChassis.__init__(self, pddf_data, pddf_plugin_data) + self.__initialize_components() + self._sfpevent = SfpEvent(self.get_all_sfps()) + + def __initialize_components(self): + from sonic_platform.component import Component + for index in range(NUM_COMPONENT): + component = Component(index) + self._component_list.append(component) + + # Provide the functions/variables below for which implementation is to be overwritten + def get_change_event(self, timeout=0): + return self._sfpevent.get_sfp_event(timeout) + + def get_sfp(self, index): + """ + Retrieves sfp represented by (1-based) index + + Args: + index: An integer, the index (1-based) of the sfp to retrieve. + The index should be the sequence of a physical port in a chassis, + starting from 1. + For example, 1 for Ethernet0, 2 for Ethernet4 and so on. + + Returns: + An object derived from SfpBase representing the specified sfp + """ + sfp = None + + try: + # The index will start from 1 + sfp = self._sfp_list[index-1] + except IndexError: + sys.stderr.write("SFP index {} out of range (1-{})\n".format( + index, len(self._sfp_list))) + return sfp diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/component.py new file mode 100644 index 000000000000..148584216fca --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/component.py @@ -0,0 +1,115 @@ +############################################################################# +# +# Component contains an implementation of SONiC Platform Base API and +# provides the components firmware management function +# +############################################################################# + +try: + import subprocess + from sonic_platform_base.component_base import ComponentBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CPLD_ADDR_MAPPING = { + "CPLD1": ['4', '0x60'], + "CPLD2": ['5', '0x62'], + "CPLD3": ['6', '0x64'] +} +SYSFS_PATH = "/sys/bus/i2c/devices/" +BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version" +COMPONENT_LIST= [ + ("CPLD1", "CPLD 1"), + ("CPLD2", "CPLD 2"), + ("CPLD3", "CPLD 3"), + ("BIOS", "Basic Input/Output System") + +] + +class Component(ComponentBase): + """Platform-specific Component class""" + + DEVICE_TYPE = "component" + + def __init__(self, component_index=0): + self.index = component_index + self.name = self.get_name() + + def __run_command(self, command): + # Run bash command and print output to stdout + try: + process = subprocess.Popen( + shlex.split(command), stdout=subprocess.PIPE) + while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + rc = process.poll() + if rc != 0: + return False + except Exception: + return False + return True + + def __get_bios_version(self): + # Retrieves the BIOS firmware version + try: + with open(BIOS_VERSION_PATH, 'r') as fd: + bios_version = fd.read() + return bios_version.strip() + except Exception as e: + return None + + def __get_cpld_version(self): + # Retrieves the CPLD firmware version + cpld_version = dict() + for cpld_name in CPLD_ADDR_MAPPING: + cmd = "i2cget -f -y {0} {1} 0x1".format(CPLD_ADDR_MAPPING[cpld_name][0], CPLD_ADDR_MAPPING[cpld_name][1]) + status, value = subprocess.getstatusoutput(cmd) + if not status: + cpld_version_raw = value.rstrip() + cpld_version[cpld_name] = "{}".format(int(cpld_version_raw,16)) + + return cpld_version + + def get_name(self): + """ + Retrieves the name of the component + Returns: + A string containing the name of the component + """ + return COMPONENT_LIST[self.index][0] + + def get_description(self): + """ + Retrieves the description of the component + Returns: + A string containing the description of the component + """ + return COMPONENT_LIST[self.index][1] + + def get_firmware_version(self): + """ + Retrieves the firmware version of module + Returns: + string: The firmware versions of the module + """ + fw_version = None + + if self.name == "BIOS": + fw_version = self.__get_bios_version() + elif "CPLD" in self.name: + cpld_version = self.__get_cpld_version() + fw_version = cpld_version.get(self.name) + + return fw_version + + def install_firmware(self, image_path): + """ + Install firmware to module + Args: + image_path: A string, path to firmware image + Returns: + A boolean, True if install successfully, False if not + """ + raise NotImplementedError diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/eeprom.py b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/eeprom.py new file mode 100644 index 000000000000..a87ecc9f6feb --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/eeprom.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +try: + from sonic_platform_pddf_base.pddf_eeprom import PddfEeprom +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Eeprom(PddfEeprom): + + def __init__(self, pddf_data=None, pddf_plugin_data=None): + PddfEeprom.__init__(self, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/event.py b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/event.py new file mode 100644 index 000000000000..d5dac6d7f7e0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/event.py @@ -0,0 +1,60 @@ +try: + import time + from sonic_py_common.logger import Logger +except ImportError as e: + raise ImportError(repr(e) + " - required module not found") + +POLL_INTERVAL_IN_SEC = 1 + +class SfpEvent: + ''' Listen to insert/remove sfp events ''' + + def __init__(self, sfp_list): + self._sfp_list = sfp_list + self._logger = Logger() + self._sfp_change_event_data = {'present': 0} + + def get_presence_bitmap(self): + bitmap = 0 + for sfp in self._sfp_list: + modpres = sfp.get_presence() + i=sfp.get_position_in_parent() - 1 + if modpres: + bitmap = bitmap | (1 << i) + return bitmap + + def get_sfp_event(self, timeout=2000): + port_dict = {} + change_dict = {} + change_dict['sfp'] = port_dict + + if timeout < 1000: + cd_ms = 1000 + else: + cd_ms = timeout + + while cd_ms > 0: + bitmap = self.get_presence_bitmap() + changed_ports = self._sfp_change_event_data['present'] ^ bitmap + if changed_ports != 0: + break + time.sleep(POLL_INTERVAL_IN_SEC) + # timeout=0 means wait for event forever + if timeout != 0: + cd_ms = cd_ms - POLL_INTERVAL_IN_SEC * 1000 + + if changed_ports != 0: + for sfp in self._sfp_list: + i=sfp.get_position_in_parent() - 1 + if (changed_ports & (1 << i)): + if (bitmap & (1 << i)) == 0: + port_dict[i+1] = '0' + else: + port_dict[i+1] = '1' + + + # Update the cache dict + self._sfp_change_event_data['present'] = bitmap + return True, change_dict + else: + return True, change_dict diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/fan.py new file mode 100644 index 000000000000..34019ac99188 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/fan.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + + +try: + from sonic_platform_pddf_base.pddf_fan import PddfFan +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Fan(PddfFan): + """PDDF Platform-Specific Fan class""" + + def __init__(self, tray_idx, fan_idx=0, pddf_data=None, pddf_plugin_data=None, is_psu_fan=False, psu_index=0): + # idx is 0-based + PddfFan.__init__(self, tray_idx, fan_idx, pddf_data, pddf_plugin_data, is_psu_fan, psu_index) + + # Provide the functions/variables below for which implementation is to be overwritten e.g. + #def get_name(self): + ## Since AS7712 has two fans in a tray, modifying this function to return proper name + #if self.is_psu_fan: + #return "PSU_FAN{}".format(self.fan_index) + #else: + #return "Fantray{}_{}".format(self.fantray_index, {1:'Front', 2:'Rear'}.get(self.fan_index,'none')) + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..3b9bb607f632 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/fan_drawer.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python + + +try: + from sonic_platform_pddf_base.pddf_fan_drawer import PddfFanDrawer +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class FanDrawer(PddfFanDrawer): + """PDDF Platform-Specific Fan-Drawer class""" + + def __init__(self, tray_idx, pddf_data=None, pddf_plugin_data=None): + # idx is 0-based + PddfFanDrawer.__init__(self, tray_idx, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/platform.py b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/platform.py new file mode 100644 index 000000000000..406b1179ae1b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/platform.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +############################################################################# +# PDDF +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + + +try: + from sonic_platform_pddf_base.pddf_platform import PddfPlatform +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PddfPlatform): + """ + PDDF Platform-Specific Platform Class + """ + + def __init__(self): + PddfPlatform.__init__(self) + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/psu.py new file mode 100644 index 000000000000..2450957e256b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/psu.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# + + +try: + from sonic_platform_pddf_base.pddf_psu import PddfPsu +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + + +class Psu(PddfPsu): + """PDDF Platform-Specific PSU class""" + + PLATFORM_PSU_CAPACITY = 650 + + def __init__(self, index, pddf_data=None, pddf_plugin_data=None): + PddfPsu.__init__(self, index, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten + def get_capacity(self): + """ + Gets the capacity (maximum output power) of the PSU in watts + + Returns: + An integer, the capacity of PSU + """ + return (self.PLATFORM_PSU_CAPACITY) + + def get_type(self): + """ + Gets the type of the PSU + + Returns: + A string, the type of PSU (AC/DC) + """ + ptype = "AC" + # Currently the platform supports only AC type of PSUs + try: + import sonic_platform.platform + ch=sonic_platform.platform.Platform().get_chassis() + e=ch.sys_eeprom.read_eeprom() + ret, prod_name = ch.sys_eeprom.get_tlv_field(e,0x21) + if ret: + prod_name = prod_name[2].decode('ascii') + #print "Product name is {}".format(prod_name) + if '48V' in prod_name: + ptype = 'DC' + except Exception as e: + print("Error while trying to read syseeprom to get PSU type - {}".format(repr(e))) + + return ptype diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/sfp.py new file mode 100644 index 000000000000..c9fb07d6364f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/sfp.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +try: + from sonic_platform_pddf_base.pddf_sfp import PddfSfp +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + + +class Sfp(PddfSfp): + """ + PDDF Platform-Specific Sfp class + """ + + def __init__(self, index, pddf_data=None, pddf_plugin_data=None): + PddfSfp.__init__(self, index, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten + def get_position_in_parent(self): + """Retrieves 1-based relative physical position in parent device.""" + return self.port_index diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/thermal.py new file mode 100644 index 000000000000..77d6ec7ae886 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/thermal.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python + + +try: + from sonic_platform_pddf_base.pddf_thermal import PddfThermal +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + + +class Thermal(PddfThermal): + """PDDF Platform-Specific Thermal class""" + + def __init__(self, index, pddf_data=None, pddf_plugin_data=None, is_psu_thermal=False, psu_index=0): + PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data, is_psu_thermal, psu_index) + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/watchdog.py new file mode 100644 index 000000000000..fe8554f6ec73 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform/watchdog.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +############################################################################# +# +# Module contains an implementation of platform specific watchdog API's +# +############################################################################# + +try: + from sonic_platform_pddf_base.pddf_watchdog import PddfWatchdog +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Watchdog(PddfWatchdog): + """ + PDDF Platform-specific Chassis class + """ + + def __init__(self): + PddfWatchdog.__init__(self) + self.timeout = 180 + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform_setup.py b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform_setup.py new file mode 100644 index 000000000000..59dad237f3b4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/sonic_platform_setup.py @@ -0,0 +1,25 @@ +from setuptools import setup + +setup( + name='sonic-platform', + version='1.0', + description='SONiC platform API implementation on Accton Platforms using PDDF', + license='Apache 2.0', + author='SONiC Team', + author_email='linuxnetdev@microsoft.com', + url='https://github.com/Azure/sonic-buildimage', + packages=['sonic_platform'], + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Environment :: Plugins', + 'Intended Audience :: Developers', + 'Intended Audience :: Information Technology', + 'Intended Audience :: System Administrators', + 'License :: OSI Approved :: Apache Software License', + 'Natural Language :: English', + 'Operating System :: POSIX :: Linux', + 'Programming Language :: Python :: 3.7', + 'Topic :: Utilities', + ], + keywords='sonic SONiC platform PLATFORM', +) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/accton_as7712_pddf_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/accton_as7712_pddf_monitor.py new file mode 100755 index 000000000000..34d74876d87d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/accton_as7712_pddf_monitor.py @@ -0,0 +1,264 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2017 Accton Technology Corporation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 11/13/2017: Polly Hsu, Create +# ------------------------------------------------------------------ + +try: + import sys + import getopt + import logging + import logging.config + import logging.handlers + import signal + import time # this is only being used as part of the example + import subprocess + from sonic_platform import platform +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + +# Deafults +VERSION = '1.0' +FUNCTION_NAME = 'accton_as7712_monitor' +DUTY_MAX = 100 + +fan_state = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] # init state=2, insert=1, remove=0 +# For AC power Front to Back : +# If any fan fail, please fan speed register to 15 +# The max value of Fan speed register is 9 +# [LM75(48) + LM75(49) + LM75(4A)] > 174 => set Fan speed value from 4 to 5 +# [LM75(48) + LM75(49) + LM75(4A)] > 182 => set Fan speed value from 5 to 7 +# [LM75(48) + LM75(49) + LM75(4A)] > 190 => set Fan speed value from 7 to 9 +# +# [LM75(48) + LM75(49) + LM75(4A)] < 170 => set Fan speed value from 5 to 4 +# [LM75(48) + LM75(49) + LM75(4A)] < 178 => set Fan speed value from 7 to 5 +# [LM75(48) + LM75(49) + LM75(4A)] < 186 => set Fan speed value from 9 to 7 +# +# +# For AC power Back to Front : +# If any fan fail, please fan speed register to 15 +# The max value of Fan speed register is 10 +# [LM75(48) + LM75(49) + LM75(4A)] > 140 => set Fan speed value from 4 to 5 +# [LM75(48) + LM75(49) + LM75(4A)] > 150 => set Fan speed value from 5 to 7 +# [LM75(48) + LM75(49) + LM75(4A)] > 160 => set Fan speed value from 7 to 10 +# +# [LM75(48) + LM75(49) + LM75(4A)] < 135 => set Fan speed value from 5 to 4 +# [LM75(48) + LM75(49) + LM75(4A)] < 145 => set Fan speed value from 7 to 5 +# [LM75(48) + LM75(49) + LM75(4A)] < 155 => set Fan speed value from 10 to 7 +# + +# 2.If no matched fan speed is found from the policy, +# use FAN_DUTY_CYCLE_MIN as default speed +# Get current temperature +# 4.Decision 3: Decide new fan speed depend on fan direction/current fan speed/temperature + + +def as7712_set_fan_duty_cycle(dc): + # PWM register is same for all the FANs + if dc < 0 or dc > 100: + print("Error: Wrong duty cycle value %d" % (dc)) + return -1 + + platform_chassis.get_fan(0).set_speed(dc) + + return 0 + + +# Make a class we can use to capture stdout and sterr in the log +platform_chassis = None + + +class accton_as7712_monitor(object): + # static temp var + _ori_temp = 0 + _new_perc = 0 + _ori_perc = 0 + + llog = logging.getLogger("["+FUNCTION_NAME+"]") + + def __init__(self, log_console, log_file): + """Needs a logger and a logger level.""" + + formatter = logging.Formatter('%(name)s %(message)s') + sys_handler = logging.handlers.SysLogHandler(address='/dev/log') + sys_handler.setFormatter(formatter) + sys_handler.ident = 'common' + sys_handler.setLevel(logging.WARNING) # only fatal for syslog + self.llog.addHandler(sys_handler) + self.llog.setLevel(logging.DEBUG) + + if log_file: + fh = logging.FileHandler(log_file) + fh.setLevel(logging.INFO) + formatter = logging.Formatter('%(asctime)-15s %(name)s %(message)s') + fh.setFormatter(formatter) + self.llog.addHandler(fh) + + # set up logging to console + if log_console: + console = logging.StreamHandler() + console.setLevel(logging.DEBUG) # For debugging + formatter = logging.Formatter('%(asctime)-15s %(name)s %(message)s') + console.setFormatter(formatter) + self.llog.addHandler(console) + + def manage_fans(self): + fan_policy_f2b = { + 0: [32, 0, 174000], + 1: [38, 170000, 182000], + 2: [50, 178000, 190000], + 3: [63, 186000, 0], + } + fan_policy_b2f = { + 0: [32, 0, 140000], + 1: [38, 135000, 150000], + 2: [50, 145000, 160000], + 3: [69, 155000, 0], + } + + global fan_state + global platform_chassis + FAN_STATE_REMOVE = 0 + FAN_STATE_INSERT = 1 + + get_temp = 0 + for t in range(0, 3): + get_temp = get_temp + platform_chassis.get_thermal(t).get_temperature()*1000 + + cur_duty_cycle = 0 + + for x in range(platform_chassis.get_num_fans()): + fan_status = platform_chassis.get_fan(x).get_status() + fan_present = platform_chassis.get_fan(x).get_presence() + + if fan_present == 1: + if fan_state[x] != 1: + fan_state[x] = FAN_STATE_INSERT + #self.llog.debug("FAN-%d present is detected", x) + else: + if fan_state[x] != 0: + fan_state[x] = FAN_STATE_REMOVE + self.llog.warning("Alarm for FAN-%d absent is detected", x) + + if fan_status is None: + self.llog.warning('SET new_perc to %d (FAN stauts is None. fan_num:%d)', DUTY_MAX, x) + as7712_set_fan_duty_cycle(DUTY_MAX) + + if fan_status is False: + self.llog.warning('SET new_perc to %d (FAN fault. fan_num:%d)', DUTY_MAX, x) + as7712_set_fan_duty_cycle(DUTY_MAX) + + #self.llog.debug('INFO. fan_status is True (fan_num:%d)', x) + + # Determine the current fan duty cycle from a working fan + if not cur_duty_cycle: + cur_duty_cycle = platform_chassis.get_fan(x).get_speed() + + if fan_status is not None and fan_status is not False: + # Assuming all the fans have the same direction + fan_dir = platform_chassis.get_fan(0).get_direction() + if fan_dir == 1: + policy = fan_policy_f2b + else: + policy = fan_policy_b2f + + new_duty_cycle = cur_duty_cycle + + for x in range(0, 4): + if x == 4: + as7712_set_fan_duty_cycle(policy[0][0]) + break + + if get_temp > policy[x][2] and x != 3: + new_duty_cycle = policy[x+1][0] + self.llog.debug('THERMAL temp UP, temp %d > %d , new_duty_cycle=%d', + get_temp, policy[x][2], new_duty_cycle) + elif get_temp < policy[x][1]: + new_duty_cycle = policy[x-1][0] + self.llog.debug('THERMAL temp down, temp %d < %d , new_duty_cycle=%d', + get_temp, policy[x][1], new_duty_cycle) + break + + if new_duty_cycle == cur_duty_cycle: + return True + else: + if (new_duty_cycle == policy[3][0]) and (cur_duty_cycle < policy[3][0]): + self.llog.warning('Alarm for temperature high is detected') + elif (new_duty_cycle < policy[3][0]) and (cur_duty_cycle == policy[3][0]): + self.llog.warning('Alarm for temperature high is cleared') + else: + pass + + self.llog.debug('set new_duty_cycle=%d (old dc: %d)', new_duty_cycle, cur_duty_cycle) + as7712_set_fan_duty_cycle(new_duty_cycle) + + return True + + +def sig_handler(signum, frame): + logging.critical('INFO:Cause signal %d, set fan speed max.', signum) + as7712_set_fan_duty_cycle(DUTY_MAX) + sys.exit(0) + + +def main(argv): + + log_console = 0 + log_file = "" + + if len(sys.argv) != 1: + try: + opts, args = getopt.getopt(argv, 'hdl') + except getopt.GetoptError: + print('Usage: %s [-d] [-l]' % sys.argv[0]) + return 0 + for opt, arg in opts: + if opt == '-h': + print('Usage: %s [-d] [-l]' % sys.argv[0]) + return 0 + elif opt in ('-d'): + log_console = 1 + elif opt in ('-l'): + log_file = '%s.log' % sys.argv[0] + + signal.signal(signal.SIGINT, sig_handler) + signal.signal(signal.SIGTERM, sig_handler) + + global platform_chassis + platform_chassis = platform.Platform().get_chassis() + + # Disable the fan watchdog + status, output = subprocess.getstatusoutput('i2cset -f -y 2 0x66 0x33 0x0') + if status: + print("Error: Unable to disable fan speed watchdog") + + # Set any smaple speed of 100% + as7712_set_fan_duty_cycle(100) + + # Start the monitoring + monitor = accton_as7712_monitor(log_console, log_file) + # Loop forever, doing something useful hopefully: + while True: + monitor.manage_fans() + time.sleep(10) + + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/accton_as7712_util.py b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/accton_as7712_util.py index 8ebc39e6c9c1..c519525d6dd1 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/accton_as7712_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/accton_as7712_util.py @@ -30,7 +30,7 @@ set : change board setting with fan|led|sfp """ -import commands +import subprocess import getopt import sys import logging @@ -53,8 +53,8 @@ if DEBUG == True: - print sys.argv[0] - print 'ARGV :', sys.argv[1:] + print(sys.argv[0]) + print('ARGV :', sys.argv[1:]) def main(): @@ -70,9 +70,9 @@ def main(): 'force', ]) if DEBUG == True: - print options - print args - print len(sys.argv) + print(options) + print(args) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -112,36 +112,36 @@ def main(): return 0 def show_help(): - print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + print(__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) def show_set_help(): cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print cmd +" [led|sfp|fan]" - print " use \""+ cmd + " led 0-4 \" to set led color" - print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" - print " use \""+ cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable" + print(cmd +" [led|sfp|fan]") + print(" use \""+ cmd + " led 0-4 \" to set led color") + print(" use \""+ cmd + " fan 0-100\" to set fan duty percetage") + print(" use \""+ cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable") sys.exit(0) def show_eeprom_help(): cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print " use \""+ cmd + " 1-32 \" to dump sfp# eeprom" + print(" use \""+ cmd + " 1-32 \" to dump sfp# eeprom") sys.exit(0) def my_log(txt): if DEBUG == True: - print "[ROY]"+txt + print("[ROY]"+txt) return def log_os_system(cmd, show): logging.info('Run :'+cmd) - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) my_log (cmd +"with result:" + str(status)) my_log (" output:"+output) if status: logging.info('Failed :'+cmd) if show: - print('Failed :'+cmd) + print(('Failed :'+cmd)) return status, output def driver_check(): @@ -276,7 +276,7 @@ def device_install(): status, output = log_os_system(mknod2[i], 1) if status: - print output + print(output) if FORCE == 0: return status else: @@ -287,13 +287,13 @@ def device_install(): status, output = log_os_system(mknod[i], 1) if status: - print output + print(output) if FORCE == 0: return status for i in range(0,len(sfp_map)): status, output =log_os_system("echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) if status: - print output + print(output) if FORCE == 0: return status return @@ -311,7 +311,7 @@ def device_uninstall(): target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device" status, output =log_os_system("echo 0x50 > "+ target, 1) if status: - print output + print(output) if FORCE == 0: return status @@ -327,7 +327,7 @@ def device_uninstall(): temp[-1] = temp[-1].replace('new_device', 'delete_device') status, output = log_os_system(" ".join(temp), 1) if status: - print output + print(output) if FORCE == 0: return status @@ -341,40 +341,40 @@ def system_ready(): return True def do_install(): - print "Checking system...." + print("Checking system....") if driver_check() == False: - print "No driver, installing...." + print("No driver, installing....") status = driver_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" drivers detected...." + print(PROJECT_NAME.upper()+" drivers detected....") if not device_exist(): - print "No device, installing...." + print("No device, installing....") status = device_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" devices detected...." + print(PROJECT_NAME.upper()+" devices detected....") return def do_uninstall(): - print "Checking system...." + print("Checking system....") if not device_exist(): - print PROJECT_NAME.upper() +" has no device installed...." + print(PROJECT_NAME.upper() +" has no device installed....") else: - print "Removing device...." + print("Removing device....") status = device_uninstall() if status: if FORCE == 0: return status if driver_check()== False : - print PROJECT_NAME.upper() +" has no driver installed...." + print(PROJECT_NAME.upper() +" has no driver installed....") else: - print "Removing installed driver...." + print("Removing installed driver....") status = driver_uninstall() if status: if FORCE == 0: @@ -427,11 +427,11 @@ def devices_info(): #show dict all in the order if DEBUG == True: for i in sorted(ALL_DEVICE.keys()): - print(i+": ") + print((i+": ")) for j in sorted(ALL_DEVICE[i].keys()): - print(" "+j) + print((" "+j)) for k in (ALL_DEVICE[i][j]): - print(" "+" "+k) + print((" "+" "+k)) return def show_eeprom(index): @@ -454,15 +454,15 @@ def show_eeprom(index): else: log = 'Failed : no hexdump cmd!!' logging.info(log) - print log + print(log) return 1 - print node + ":" + print(node + ":") ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) if ret==0: - print log + print(log) else: - print "**********device no found**********" + print("**********device no found**********") return def set_device(args): @@ -496,10 +496,10 @@ def set_device(args): node = node.replace(node.split("/")[-1], 'fan_duty_cycle_percentage') ret, log = log_os_system("cat "+ node, 1) if ret==0: - print ("Previous fan duty: " + log.strip() +"%") + print(("Previous fan duty: " + log.strip() +"%")) ret, log = log_os_system("echo "+args[1]+" >"+node, 1) if ret==0: - print ("Current fan duty: " + args[1] +"%") + print(("Current fan duty: " + args[1] +"%")) return ret elif args[0]=='sfp': if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: @@ -539,25 +539,25 @@ def device_traversal(): devices_info() for i in sorted(ALL_DEVICE.keys()): print("============================================") - print(i.upper()+": ") + print((i.upper()+": ")) print("============================================") - for j in sorted(ALL_DEVICE[i].keys(), key=get_value): - print " "+j+":", + for j in sorted(list(ALL_DEVICE[i].keys()), key=get_value): + print(" "+j+":", end=' ') for k in (ALL_DEVICE[i][j]): ret, log = log_os_system("cat "+k, 0) func = k.split("/")[-1].strip() func = re.sub(j+'_','',func,1) func = re.sub(i.lower()+'_','',func,1) if ret==0: - print func+"="+log+" ", + print(func+"="+log+" ", end=' ') else: - print func+"="+"X"+" ", - print + print(func+"="+"X"+" ", end=' ') + print() print("----------------------------------------------------------------") - print + print() return def device_exist(): diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/pddf_switch_svc.py b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/pddf_switch_svc.py new file mode 100755 index 000000000000..3ed3f7604e73 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/pddf_switch_svc.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python +# Script to stop and start the respective platforms default services. +# This will be used while switching the pddf->non-pddf mode and vice versa +import commands + +def check_pddf_support(): + return True + +def stop_platform_svc(): + status, output = commands.getstatusoutput("systemctl stop as7712-platform-init.service") + if status: + print("Stop as7712-platform-init.service failed %d"%status) + return False + status, output = commands.getstatusoutput("systemctl disable as7712-platform-init.service") + if status: + print("Disable as7712-platform-init.service failed %d"%status) + return False + + status, output = commands.getstatusoutput("/usr/local/bin/accton_as7712_util.py clean") + if status: + print("accton_as7712_util.py clean command failed %d"%status) + return False + + # HACK , stop the pddf-platform-init service if it is active + status, output = commands.getstatusoutput("systemctl stop pddf-platform-init.service") + if status: + print("Stop pddf-platform-init.service along with other platform serives failed %d"%status) + return False + + return True + +def start_platform_svc(): + status, output = commands.getstatusoutput("/usr/local/bin/accton_as7712_util.py install") + if status: + print("accton_as7712_util.py install command failed %d"%status) + return False + + status, output = commands.getstatusoutput("systemctl enable as7712-platform-init.service") + if status: + print("Enable as7712-platform-init.service failed %d"%status) + return False + status, output = commands.getstatusoutput("systemctl start as7712-platform-init.service") + if status: + print("Start as7712-platform-init.service failed %d"%status) + return False + + return True + +def start_platform_pddf(): + status, output = commands.getstatusoutput("systemctl start pddf-platform-init.service") + if status: + print("Start pddf-platform-init.service failed %d"%status) + return False + + return True + +def stop_platform_pddf(): + status, output = commands.getstatusoutput("systemctl stop pddf-platform-init.service") + if status: + print("Stop pddf-platform-init.service failed %d"%status) + return False + + return True + +def main(): + pass + +if __name__ == "__main__": + main() + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/classes/fanutil.py index 9a69f6e1d537..469b2fbfb4c3 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/classes/fanutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/classes/fanutil.py @@ -194,7 +194,7 @@ def get_fan_duty_cycle(self): try: val_file = open(self.FAN_DUTY_PATH) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() @@ -213,7 +213,7 @@ def set_fan_duty_cycle(self, val): try: fan_file = open(self.FAN_DUTY_PATH, 'r+') except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False #val = ((val + 1 ) * 625 +75 ) / 100 fan_file.write(str(val)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_monitor.py index c423cc441d92..f9686f846efb 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_monitor.py @@ -179,11 +179,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_util.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_util.py index 142ce754a5c7..6322aac6bbd7 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_util.py @@ -30,7 +30,7 @@ set : change board setting with fan|led|sfp """ -import commands +import subprocess import getopt import sys import logging @@ -149,8 +149,8 @@ if DEBUG == True: - print sys.argv[0] - print 'ARGV :', sys.argv[1:] + print(sys.argv[0]) + print('ARGV :', sys.argv[1:]) def main(): @@ -166,9 +166,9 @@ def main(): 'force', ]) if DEBUG == True: - print options - print args - print len(sys.argv) + print(options) + print(args) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -208,28 +208,28 @@ def main(): return 0 def show_help(): - print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + print(__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) def show_set_help(): cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print cmd +" [led|sfp|fan]" - print " use \""+ cmd + " led 0-4 \" to set led color" - print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" - print " use \""+ cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable" + print(cmd +" [led|sfp|fan]") + print(" use \""+ cmd + " led 0-4 \" to set led color") + print(" use \""+ cmd + " fan 0-100\" to set fan duty percetage") + print(" use \""+ cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable") sys.exit(0) def dis_i2c_ir3570a(addr): cmd = "i2cset -y 0 0x%x 0xE5 0x01" % addr - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) cmd = "i2cset -y 0 0x%x 0x12 0x02" % addr - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) return status def ir3570_check(): cmd = "i2cdump -y 0 0x42 s 0x9a" try: - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) lines = output.split('\n') hn = re.findall(r'\w+', lines[-1]) version = int(hn[1], 16) @@ -238,32 +238,32 @@ def ir3570_check(): else: ret = 0 except Exception as e: - print "Error on ir3570_check() e:" + str(e) + print("Error on ir3570_check() e:" + str(e)) return -1 return ret def show_eeprom_help(): cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print " use \""+ cmd + " 1-32 \" to dump sfp# eeprom" + print(" use \""+ cmd + " 1-32 \" to dump sfp# eeprom") sys.exit(0) def my_log(txt): if DEBUG == True: - print "[ACCTON DBG]: "+txt + print("[ACCTON DBG]: "+txt) return def log_os_system(cmd, show): logging.info('Run :'+cmd) status = 1 output = "" - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) my_log (cmd +"with result:" + str(status)) my_log ("cmd:" + cmd) my_log (" output:"+output) if status: logging.info('Failed :'+cmd) if show: - print('Failed :'+cmd) + print(('Failed :'+cmd)) return status, output def driver_inserted(): @@ -341,19 +341,19 @@ def device_install(): status, output = log_os_system(mknod[i], 1) if status: - print output + print(output) if FORCE == 0: return status for i in range(0,len(sfp_map)): status, output =log_os_system("echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) if status: - print output + print(output) if FORCE == 0: return status status, output =log_os_system("echo port"+str(i)+" > /sys/bus/i2c/devices/"+str(sfp_map[i])+"-0050/port_name", 1) if status: - print output + print(output) if FORCE == 0: return status return @@ -371,7 +371,7 @@ def device_uninstall(): target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device" status, output =log_os_system("echo 0x50 > "+ target, 1) if status: - print output + print(output) if FORCE == 0: return status @@ -387,7 +387,7 @@ def device_uninstall(): temp[-1] = temp[-1].replace('new_device', 'delete_device') status, output = log_os_system(" ".join(temp), 1) if status: - print output + print(output) if FORCE == 0: return status @@ -397,7 +397,7 @@ def system_ready(): if driver_inserted() == False: return False if not device_exist(): - print "not device_exist()" + print("not device_exist()") return False return True @@ -408,7 +408,7 @@ def do_install(): if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" drivers detected...." + print(PROJECT_NAME.upper()+" drivers detected....") ir3570_check() @@ -418,23 +418,23 @@ def do_install(): if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" devices detected...." + print(PROJECT_NAME.upper()+" devices detected....") return def do_uninstall(): if not device_exist(): - print PROJECT_NAME.upper() +" has no device installed...." + print(PROJECT_NAME.upper() +" has no device installed....") else: - print "Removing device...." + print("Removing device....") status = device_uninstall() if status: if FORCE == 0: return status if driver_inserted()== False : - print PROJECT_NAME.upper() +" has no driver installed...." + print(PROJECT_NAME.upper() +" has no driver installed....") else: - print "Removing installed driver...." + print("Removing installed driver....") status = driver_uninstall() if status: if FORCE == 0: @@ -487,11 +487,11 @@ def devices_info(): #show dict all in the order if DEBUG == True: for i in sorted(ALL_DEVICE.keys()): - print(i+": ") + print((i+": ")) for j in sorted(ALL_DEVICE[i].keys()): - print(" "+j) + print((" "+j)) for k in (ALL_DEVICE[i][j]): - print(" "+" "+k) + print((" "+" "+k)) return def show_eeprom(index): @@ -514,15 +514,15 @@ def show_eeprom(index): else: log = 'Failed : no hexdump cmd!!' logging.info(log) - print log + print(log) return 1 - print node + ":" + print(node + ":") ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) if ret==0: - print log + print(log) else: - print "**********device no found**********" + print("**********device no found**********") return def set_device(args): @@ -556,10 +556,10 @@ def set_device(args): node = node.replace(node.split("/")[-1], 'fan1_duty_cycle_percentage') ret, log = log_os_system("cat "+ node, 1) if ret==0: - print ("Previous fan duty: " + log.strip() +"%") + print(("Previous fan duty: " + log.strip() +"%")) ret, log = log_os_system("echo "+args[1]+" >"+node, 1) if ret==0: - print ("Current fan duty: " + args[1] +"%") + print(("Current fan duty: " + args[1] +"%")) return ret elif args[0]=='sfp': if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: @@ -599,25 +599,25 @@ def device_traversal(): devices_info() for i in sorted(ALL_DEVICE.keys()): print("============================================") - print(i.upper()+": ") + print((i.upper()+": ")) print("============================================") - for j in sorted(ALL_DEVICE[i].keys(), key=get_value): - print " "+j+":", + for j in sorted(list(ALL_DEVICE[i].keys()), key=get_value): + print(" "+j+":", end=' ') for k in (ALL_DEVICE[i][j]): ret, log = log_os_system("cat "+k, 0) func = k.split("/")[-1].strip() func = re.sub(j+'_','',func,1) func = re.sub(i.lower()+'_','',func,1) if ret==0: - print func+"="+log+" ", + print(func+"="+log+" ", end=' ') else: - print func+"="+"X"+" ", - print + print(func+"="+"X"+" ", end=' ') + print() print("----------------------------------------------------------------") - print + print() return def device_exist(): diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/classes/fanutil.py index e001e94092c7..381b787e0d80 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/classes/fanutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/classes/fanutil.py @@ -202,7 +202,7 @@ def get_fan_duty_cycle(self): try: val_file = open(self.FAN_DUTY_PATH) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() @@ -221,7 +221,7 @@ def set_fan_duty_cycle(self, val): try: fan_file = open(self.FAN_DUTY_PATH, 'r+') except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False #val = ((val + 1 ) * 625 +75 ) / 100 fan_file.write(str(val)) @@ -237,7 +237,7 @@ def get_fanr_speed(self, fan_num): def get_fan_status(self, fan_num): if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: logging.debug('GET. Parameter error. fan_num, %d', fan_num) - print "fan %d return none" %fan_num + print("fan %d return none" %fan_num) return None if self.get_fan_fault(fan_num) is not None and self.get_fan_fault(fan_num) > 0: diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_drv_handler.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_drv_handler.py index ed5af4818de3..83e26c03a4e5 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_drv_handler.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_drv_handler.py @@ -27,7 +27,7 @@ import logging import logging.config import time # this is only being used as part of the example - import commands + import subprocess except ImportError as e: raise ImportError('%s - required module not found' % str(e)) @@ -41,25 +41,25 @@ def my_log(txt): if DEBUG == True: - print "[ACCTON DBG]: "+txt + print("[ACCTON DBG]: "+txt) return def log_os_system(cmd, show): logging.info('Run :'+cmd) status = 1 output = "" - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) if DEBUG == True: my_log (cmd +" , result:" + str(status)) else: if show: - print "ACC: " + str(cmd) + " , result:"+ str(status) + print("ACC: " + str(cmd) + " , result:"+ str(status)) #my_log ("cmd:" + cmd) #my_log (" output:"+output) if status: logging.info('Failed :'+cmd) if show: - print('Failed :'+cmd) + print(('Failed :'+cmd)) return status, output @@ -120,7 +120,7 @@ def __init__(self, log_file, log_level): def manage_ipmi_qsfp(self): logging.debug ("drv hanlder-manage_ipmi_qsfp") - print "drv hanlder" + print("drv hanlder") #Handle QSFP case ipmi_cmd = self.IPMI_CMD_QSFP + " 0x10 > " +self.QSFP_PRESENT_FILE log_os_system(ipmi_cmd, 0) @@ -129,7 +129,7 @@ def manage_ipmi_qsfp(self): try: check_file = open(file_path) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) line = check_file.readline() pres_line= line.rstrip().replace(" ","") while line: @@ -158,7 +158,7 @@ def manage_ipmi_qsfp(self): try: check_file = open(file_path) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) line = check_file.readline() str_line= line.rstrip().replace(" ","") while line: @@ -170,7 +170,7 @@ def manage_ipmi_qsfp(self): try: check_file = open(file_path) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) line = check_file.readline() str_line+= line.rstrip().replace(" ","") @@ -209,7 +209,7 @@ def manage_ipmi_thermal(self): try: check_file = open(file_path) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) line = check_file.readline() str_line= line.rstrip().replace(" ","") while line: @@ -244,7 +244,7 @@ def manage_ipmi_fan(self): try: check_file = open(file_path) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) line = check_file.readline() str_line= line.rstrip().replace(" ","") while line: @@ -293,7 +293,7 @@ def manage_ipmi_psu(self): try: check_file = open(file_path) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) line = check_file.readline() str_line= line.rstrip().replace(" ","") while line: @@ -366,7 +366,7 @@ def manage_ipmi_sys(self): try: check_file = open(file_path) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) line = check_file.readline() str_line= line.rstrip().replace(" ","") while line: @@ -379,7 +379,7 @@ def manage_ipmi_sys(self): try: check_file = open(file_path) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) line = check_file.readline() str_line+= line.rstrip().replace(" ","") while line: @@ -401,11 +401,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_monitor.py index 86b4f1852066..ccaa6e574141 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_monitor.py @@ -199,11 +199,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_util.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_util.py index 3a31d253f633..bb1343f68433 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_util.py @@ -30,7 +30,7 @@ set : change board setting with fan|led|sfp """ -import commands +import subprocess import getopt import sys import logging @@ -145,8 +145,8 @@ if DEBUG == True: - print sys.argv[0] - print 'ARGV :', sys.argv[1:] + print(sys.argv[0]) + print('ARGV :', sys.argv[1:]) def main(): @@ -162,9 +162,9 @@ def main(): 'force', ]) if DEBUG == True: - print options - print args - print len(sys.argv) + print(options) + print(args) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -204,39 +204,39 @@ def main(): return 0 def show_help(): - print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + print(__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) def show_set_help(): cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print cmd +" [led|sfp|fan]" - print " use \""+ cmd + " led 0-4 \" to set led color" - print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" - print " use \""+ cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable" + print(cmd +" [led|sfp|fan]") + print(" use \""+ cmd + " led 0-4 \" to set led color") + print(" use \""+ cmd + " fan 0-100\" to set fan duty percetage") + print(" use \""+ cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable") sys.exit(0) def show_eeprom_help(): cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print " use \""+ cmd + " 1-32 \" to dump sfp# eeprom" + print(" use \""+ cmd + " 1-32 \" to dump sfp# eeprom") sys.exit(0) def my_log(txt): if DEBUG == True: - print "[ACCTON DBG]: "+txt + print("[ACCTON DBG]: "+txt) return def log_os_system(cmd, show): logging.info('Run :'+cmd) status = 1 output = "" - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) my_log (cmd +"with result:" + str(status)) my_log ("cmd:" + cmd) my_log (" output:"+output) if status: logging.info('Failed :'+cmd) if show: - print('Failed :'+cmd) + print(('Failed :'+cmd)) return status, output def driver_inserted(): @@ -316,22 +316,22 @@ def device_install(): # if FORCE == 0: # return status #else: - print "Prepar to create instance.............." + print("Prepar to create instance..............") for i in range(0,len(mknod_xb)): - print "Beginn to create instance.............." + print("Beginn to create instance..............") status, output = log_os_system(mknod_xb[i], 1) - print "status=%s" %status - print "output=%s" %output + print("status=%s" %status) + print("output=%s" %output) if status: - print output + print(output) if FORCE == 0: return status #time.sleep (50.0 / 1000.0) - print "Create sfp instance.............." + print("Create sfp instance..............") for i in range(0,len(sfp_map)): status, output =log_os_system("echo as7716_32xb_oom 0x"+str(sfp_map[i])+ " > /sys/bus/i2c/devices/i2c-0/new_device", 1) if status: - print output + print(output) if FORCE == 0: return status #status, output =log_os_system("echo port"+str(i)+" > /sys/bus/i2c/devices/0-000"+str(sfp_map[i])+"/port_name", 1) @@ -349,7 +349,7 @@ def device_uninstall(): print(target) status, output =log_os_system(target, 1) if status: - print output + print(output) if FORCE == 0: return status @@ -362,7 +362,7 @@ def device_uninstall(): temp[-1] = temp[-1].replace('new_device', 'delete_device') status, output = log_os_system(" ".join(temp), 1) if status: - print output + print(output) if FORCE == 0: return status @@ -370,48 +370,48 @@ def device_uninstall(): def system_ready(): if driver_inserted() == False: - print "driver_inserted() == False" + print("driver_inserted() == False") return False if not device_exist(): - print "not device_exist()" + print("not device_exist()") return False return True def do_install(): - print "Checking system...." + print("Checking system....") if driver_inserted() == False: - print "No driver, installing.1..." + print("No driver, installing.1...") status = driver_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" drivers detected...." + print(PROJECT_NAME.upper()+" drivers detected....") if not device_exist(): - print "No device, installing..2.." + print("No device, installing..2..") status = device_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" devices detected...." + print(PROJECT_NAME.upper()+" devices detected....") return def do_uninstall(): - print "Checking systemm...." + print("Checking systemm....") if not device_exist(): - print PROJECT_NAME.upper() +" has no device installed...." + print(PROJECT_NAME.upper() +" has no device installed....") else: - print "Removing device...." + print("Removing device....") status = device_uninstall() if status: if FORCE == 0: return status if driver_inserted()== False : - print PROJECT_NAME.upper() +" has no driver installed...." + print(PROJECT_NAME.upper() +" has no driver installed....") else: - print "Removing installed driver...." + print("Removing installed driver....") status = driver_uninstall() if status: if FORCE == 0: @@ -443,13 +443,13 @@ def devices_info(): for k in range(0,DEVICE_NO[key]): node = key+str(k+1) path = i2c_prefix+ str(sfp_map[k])+ buses[i]+"/"+ nodes[j] - print "path= %s" %path - print "i=%d" %i - print "k=%d" %k - print "j= %d" %j - print "sfp_map[k]=%s" %sfp_map[k] - print " buses[i]=%s" %buses[i] - print "nodes[j]=%s" %nodes[j] + print("path= %s" %path) + print("i=%d" %i) + print("k=%d" %k) + print("j= %d" %j) + print("sfp_map[k]=%s" %sfp_map[k]) + print(" buses[i]=%s" %buses[i]) + print("nodes[j]=%s" %nodes[j]) my_log(node+": "+ path) ALL_DEVICE[key][node].append(path) else: @@ -471,11 +471,11 @@ def devices_info(): #show dict all in the order if DEBUG == True: for i in sorted(ALL_DEVICE.keys()): - print(i+": ") + print((i+": ")) for j in sorted(ALL_DEVICE[i].keys()): - print(" "+j) + print((" "+j)) for k in (ALL_DEVICE[i][j]): - print(" "+" "+k) + print((" "+" "+k)) return def show_eeprom(index): @@ -498,15 +498,15 @@ def show_eeprom(index): else: log = 'Failed : no hexdump cmd!!' logging.info(log) - print log + print(log) return 1 - print node + ":" + print(node + ":") ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) if ret==0: - print log + print(log) else: - print "**********device no found**********" + print("**********device no found**********") return def set_device(args): @@ -540,10 +540,10 @@ def set_device(args): node = node.replace(node.split("/")[-1], 'fan1_duty_cycle_percentage') ret, log = log_os_system("cat "+ node, 1) if ret==0: - print ("Previous fan duty: " + log.strip() +"%") + print(("Previous fan duty: " + log.strip() +"%")) ret, log = log_os_system("echo "+args[1]+" >"+node, 1) if ret==0: - print ("Current fan duty: " + args[1] +"%") + print(("Current fan duty: " + args[1] +"%")) return ret elif args[0]=='sfp': if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: @@ -583,25 +583,25 @@ def device_traversal(): devices_info() for i in sorted(ALL_DEVICE.keys()): print("============================================") - print(i.upper()+": ") + print((i.upper()+": ")) print("============================================") - for j in sorted(ALL_DEVICE[i].keys(), key=get_value): - print " "+j+":", + for j in sorted(list(ALL_DEVICE[i].keys()), key=get_value): + print(" "+j+":", end=' ') for k in (ALL_DEVICE[i][j]): ret, log = log_os_system("cat "+k, 0) func = k.split("/")[-1].strip() func = re.sub(j+'_','',func,1) func = re.sub(i.lower()+'_','',func,1) if ret==0: - print func+"="+log+" ", + print(func+"="+log+" ", end=' ') else: - print func+"="+"X"+" ", - print + print(func+"="+"X"+" ", end=' ') + print() print("----------------------------------------------------------------") - print + print() return def device_exist(): diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/classes/fanutil.py index ca0f3f9da1e3..164bdc22b81d 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/classes/fanutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/classes/fanutil.py @@ -191,7 +191,7 @@ def get_fan_duty_cycle(self): try: val_file = open(self.FAN_DUTY_PATH) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() @@ -210,7 +210,7 @@ def set_fan_duty_cycle(self, val): try: fan_file = open(self.FAN_DUTY_PATH, 'r+') except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False #val = ((val + 1 ) * 625 +75 ) / 100 fan_file.write(str(val)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/classes/thermalutil.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/classes/thermalutil.py index 35ccf7efdd1e..66f5455e11ba 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/classes/thermalutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/classes/thermalutil.py @@ -28,7 +28,7 @@ import time import logging import glob - import commands + import subprocess from collections import namedtuple except ImportError as e: raise ImportError('%s - required module not found' % str(e)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/Makefile index 5b5e6912c56a..f591a9157a62 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/Makefile @@ -1,7 +1,11 @@ ifneq ($(KERNELRELEASE),) obj-m:= accton_as7726_32x_cpld.o accton_as7726_32x_fan.o \ - accton_as7726_32x_leds.o accton_as7726_32x_psu.o ym2651y.o - + accton_as7726_32x_leds.o accton_as7726_32x_psu.o ym2651y.o \ + pddf_custom_psu.o + +CFLAGS_pddf_custom_psu.o := -I$(M)/../../../../pddf/i2c/modules/include +KBUILD_EXTRA_SYMBOLS := $(M)/../../../../pddf/i2c/Module.symvers.PDDF + else ifeq (,$(KERNEL_SRC)) #$(error KERNEL_SRC is not defined) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/accton_as7726_32x_fan.c b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/accton_as7726_32x_fan.c index beb58804ac94..0341b3802b0f 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/accton_as7726_32x_fan.c +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/accton_as7726_32x_fan.c @@ -74,7 +74,6 @@ struct as7726_32x_fan_data { char valid; /* != 0 if registers are valid */ unsigned long last_updated; /* In jiffies */ u8 reg_val[ARRAY_SIZE(fan_reg)]; /* Register value */ - int system_temp; /*In unit of mini-Celsius*/ int sensors_found; }; @@ -141,11 +140,6 @@ enum sysfs_fan_attributes { static SENSOR_DEVICE_ATTR(fan##index##_duty_cycle_percentage, S_IWUSR | S_IRUGO, fan_show_value, set_duty_cycle, FAN##index##_DUTY_CYCLE_PERCENTAGE) #define DECLARE_FAN_DUTY_CYCLE_ATTR(index) &sensor_dev_attr_fan##index##_duty_cycle_percentage.dev_attr.attr -#define DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR() \ - static SENSOR_DEVICE_ATTR(sys_temp, S_IRUGO, get_sys_temp, NULL, FAN_DUTY_CYCLE_PERCENTAGE) - -#define DECLARE_FAN_SYSTEM_TEMP_ATTR() &sensor_dev_attr_sys_temp.dev_attr.attr - #define DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(index) \ static SENSOR_DEVICE_ATTR(fan##index##_present, S_IRUGO, fan_show_value, NULL, FAN##index##_PRESENT) #define DECLARE_FAN_PRESENT_ATTR(index) &sensor_dev_attr_fan##index##_present.dev_attr.attr @@ -191,8 +185,6 @@ DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(5); DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(6); /* 1 fan duty cycle attribute in this platform */ DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(); -/* System temperature for fancontrol */ -DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR(); static struct attribute *as7726_32x_fan_attributes[] = { /* fan related attributes */ @@ -221,7 +213,6 @@ static struct attribute *as7726_32x_fan_attributes[] = { DECLARE_FAN_DIRECTION_ATTR(5), DECLARE_FAN_DIRECTION_ATTR(6), DECLARE_FAN_DUTY_CYCLE_ATTR(), - DECLARE_FAN_SYSTEM_TEMP_ATTR(), NULL }; @@ -308,267 +299,6 @@ static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, return count; } -/* Due to this struct is declared at lm75.c, it cannot be include - * under Sonic environment. I duplicate it from lm75.c. - */ -struct lm75_data { - struct i2c_client *client; - struct device *hwmon_dev; - struct thermal_zone_device *tz; - struct mutex update_lock; - u8 orig_conf; - u8 resolution; /* In bits, between 9 and 12 */ - u8 resolution_limits; - char valid; /* !=0 if registers are valid */ - unsigned long last_updated; /* In jiffies */ - unsigned long sample_time; /* In jiffies */ - s16 temp[3]; /* Register values, - 0 = input - 1 = max - 2 = hyst */ -}; - -/*Copied from lm75.c*/ -static inline long lm75_reg_to_mc(s16 temp, u8 resolution) -{ - return ((temp >> (16 - resolution)) * 1000) >> (resolution - 8); -} - -/*Get hwmon_dev from i2c_client, set hwmon_dev = NULL is failed.*/ -static struct device * get_hwmon_dev( - struct i2c_client *client) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - if(data) - { - if( data->valid == 1 && data->hwmon_dev) - { - return data->hwmon_dev; - } - - } - return NULL; -} - -/* To find hwmon index by opening hwmon under that i2c address. - */ -static int find_hwmon_index_by_FileOpen( - int bus_nr, - unsigned short addr, - OUT int *index) -{ -#define MAX_HWMON_DEVICE (10) /* Find hwmon device in 0~10*/ - struct file *sfd; - char client_name[96]; - int i=0; - - do { - snprintf(client_name, sizeof(client_name), - "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", - bus_nr, addr, i); - - sfd = filp_open(client_name, O_RDONLY, 0); - i++; - } while( IS_ERR(sfd) && i < MAX_HWMON_DEVICE); - - if (IS_ERR(sfd)) { - pr_err("Failed to open file(%s)#%d\r\n", client_name, __LINE__); - return -ENOENT; - } - filp_close(sfd, 0); - *index = i - 1; - return 0; - -#undef MAX_HWMON_DEVICE -} - -static int get_temp_file_path( - int bus_nr, unsigned short addr, - struct device *hwmon_dev - ,char *path, int max_len) -{ - - if(hwmon_dev && strlen(dev_name(hwmon_dev))) - { - snprintf(path, max_len, - "/sys/bus/i2c/devices/%d-%04x/hwmon/%s/temp1_input", - bus_nr, addr, dev_name(hwmon_dev)); - } - else - { - int i=0; - if(find_hwmon_index_by_FileOpen( bus_nr, addr, &i)) - { - return -EIO; - } - snprintf(path, max_len, - "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", - bus_nr, addr, i); - } - - return 0; -} - -/*File read the dev file at user space.*/ -static int read_devfile_temp1_input( - struct device *dev, - int bus_nr, - unsigned short addr, - struct device *hwmon_dev, - int *miniCelsius) -{ - struct file *sfd; - char buffer[96]; - char devfile[96]; - int rc, status; - int rdlen, value; - mm_segment_t old_fs; - - rc = 0; - get_temp_file_path(bus_nr, addr, hwmon_dev, devfile, sizeof(devfile)); - sfd = filp_open(devfile, O_RDONLY, 0); - if (IS_ERR(sfd)) { - pr_err("Failed to open file(%s)#%d\r\n", devfile, __LINE__); - return -ENOENT; - } - dev_dbg(dev, "Found device:%s\n",devfile); - - if(!(sfd->f_op) || !(sfd->f_op->read) ) { - pr_err("file %s cann't readable ?\n",devfile); - return -ENOENT; - } - - old_fs = get_fs(); - set_fs(KERNEL_DS); - rdlen = sfd->f_op->read(sfd, buffer, sizeof(buffer), &sfd->f_pos); - if (rdlen == 0) { - pr_err( "File(%s) empty!\n", devfile); - rc = -EIO; - goto exit; - } - status = sscanf(buffer, "%d", &value); - if (status != 1) { - rc = -EIO; - goto exit; - } - *miniCelsius = value; - dev_dbg(dev,"found sensors: %d @i2c %d-%04x\n", value, bus_nr, addr); - -exit: - set_fs(old_fs); - filp_close(sfd, 0); - return rc; -} - -static u8 is_lm75_data_due(struct i2c_client *client) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - if (time_after(jiffies, data->last_updated + data->sample_time)) - { - return 1; - } - return 0; -} -static int get_lm75_temp(struct i2c_client *client, int *miniCelsius) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - *miniCelsius = lm75_reg_to_mc(data->temp[0], data->resolution); - - return 0; -} - -static bool lm75_addr_mached(unsigned short addr) -{ - int i; - unsigned short addrs[] = THERMAL_SENSORS_ADDRS; - - for (i = 0; i < ARRAY_SIZE(addrs); i++) - { - if( addr == addrs[i]) - return 1; - } - return 0; -} - -static int _find_lm75_device(struct device *dev, void *data) -{ - struct device_driver *driver; - struct as7726_32x_fan_data *prv = data; - char *driver_name = THERMAL_SENSORS_DRIVER; - - driver = dev->driver; - if (driver && driver->name && - strcmp(driver->name, driver_name) == 0) - { - struct i2c_client *client; - client = to_i2c_client(dev); - if (client) - { - /*cannot use "struct i2c_adapter *adap = to_i2c_adapter(dev);"*/ - struct i2c_adapter *adap = client->adapter; - int miniCelsius = 0; - - if (! lm75_addr_mached(client->addr)) - { - return 0; - } - - if (!adap) { - return -ENXIO; - } - - /* If the data is not updated, read them from devfile - to drive them updateing data from chip.*/ - if (is_lm75_data_due(client)) - { - struct device *hwmon_dev; - - hwmon_dev = get_hwmon_dev(client); - if(0 == read_devfile_temp1_input(dev, adap->nr, - client->addr, hwmon_dev, &miniCelsius)) - { - prv->system_temp += miniCelsius; - prv->sensors_found++; - } - - } - else - { - get_lm75_temp(client, &miniCelsius); - prv->system_temp += miniCelsius; - prv->sensors_found++; - - } - } - } - return 0; -} - -/*Find all lm75 devices and return sum of temperatures.*/ -static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, - char *buf) -{ - ssize_t ret = 0; - struct as7726_32x_fan_data *data = as7726_32x_fan_update_device(dev); - - data->system_temp=0; - data->sensors_found=0; - i2c_for_each_dev(data, _find_lm75_device); - if (NUM_THERMAL_SENSORS != data->sensors_found) - { - dev_dbg(dev,"only %d of %d temps are found\n", - data->sensors_found, NUM_THERMAL_SENSORS); - data->system_temp = INT_MAX; - } - ret = sprintf(buf, "%d\n",data->system_temp); - return ret; -} static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/pddf_custom_psu.c b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/pddf_custom_psu.c new file mode 100644 index 000000000000..bf94146167a2 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/pddf_custom_psu.c @@ -0,0 +1,207 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "pddf_psu_defs.h" + +ssize_t pddf_get_custom_psu_model_name(struct device *dev, struct device_attribute *da, char *buf); +ssize_t pddf_get_custom_psu_serial_num(struct device *dev, struct device_attribute *da, char *buf); +extern PSU_SYSFS_ATTR_DATA access_psu_model_name; +extern PSU_SYSFS_ATTR_DATA access_psu_serial_num; + +#define MAX_MODEL_NAME 16 +#define MAX_SERIAL_NUMBER 19 + +enum psu_type { + PSU_TYPE_AC_110V, + PSU_TYPE_DC_48V, + PSU_TYPE_DC_12V, + PSU_TYPE_AC_ACBEL_FSF019, + PSU_TYPE_AC_ACBEL_FSF045 +}; + +struct model_name_info { + enum psu_type type; + u8 offset; + u8 length; + u8 chk_length; + char* model_name; +}; + +struct serial_number_info { + enum psu_type type; + u8 offset; + u8 length; + u8 chk_length; + char* serial_number; +}; + +struct model_name_info models[] = { +{PSU_TYPE_AC_110V, 0x20, 8, 8, "YM-2651Y"}, +{PSU_TYPE_DC_48V, 0x20, 8, 8, "YM-2651V"}, +{PSU_TYPE_DC_12V, 0x00, 11, 11, "PSU-12V-750"}, +{PSU_TYPE_AC_ACBEL_FSF019, 0x15, 10, 7, "FSF019-"}, +{PSU_TYPE_AC_ACBEL_FSF045, 0x15, 10, 7, "FSF045-"} + +}; + +struct serial_number_info serials[] = { +{PSU_TYPE_AC_110V, 0x2e, 18, 18, "YM-2651Y"}, +{PSU_TYPE_DC_48V, 0x2e, 18, 18, "YM-2651V"}, +{PSU_TYPE_DC_12V, 0x2e, 18, 18, "PSU-12V-750"}, +{PSU_TYPE_AC_ACBEL_FSF019, 0x2e, 16, 16, "FSF019-"}, +{PSU_TYPE_AC_ACBEL_FSF019, 0x2e, 16, 16, "FSF045-"} + +}; + +struct pddf_psu_data { + char model_name[MAX_MODEL_NAME+1]; + char serial_number[MAX_SERIAL_NUMBER+1]; +}; + + +static int pddf_psu_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int result = 0; + int retry_count = 10; + + while (retry_count) { + retry_count--; + + result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + + if (unlikely(result < 0)) { + msleep(10); + continue; + } + + if (unlikely(result != data_len)) { + result = -EIO; + msleep(10); + continue; + } + + result = 0; + break; + } + + return result; +} + +ssize_t pddf_get_custom_psu_serial_num(struct device *dev, struct device_attribute *da, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct pddf_psu_data data; + int i, status; + + for (i = 0; i < ARRAY_SIZE(models); i++) { + memset(data.serial_number, 0, sizeof(data.serial_number)); + + status = pddf_psu_read_block(client, models[i].offset, + data.model_name, models[i].length); + if (status < 0) { + data.model_name[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x%x)\n", + client->addr, models[i].offset); + return status; + } + else { + data.model_name[models[i].length] = '\0'; + } + + /* Determine if the model name is known, if not, read next index + */ + if (strncmp(data.model_name, models[i].model_name, models[i].chk_length) == 0) { + + status = pddf_psu_read_block(client, serials[i].offset, + data.serial_number, serials[i].length); + if (status < 0) { + data.serial_number[0] = '\0'; + dev_dbg(&client->dev, "unable to read serial num from (0x%x) offset(0x%x)\n", + client->addr, serials[i].offset); + return status; + } + else { + data.serial_number[serials[i].length] = '\0'; + return sprintf(buf, "%s\n", data.serial_number); + } + + return 0; + } + else { + data.serial_number[0] = '\0'; + } + } + + return -ENODATA; + + +} + +ssize_t pddf_get_custom_psu_model_name(struct device *dev, struct device_attribute *da, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct pddf_psu_data data; + int i, status; + + for (i = 0; i < ARRAY_SIZE(models); i++) { + memset(data.model_name, 0, sizeof(data.model_name)); + + status = pddf_psu_read_block(client, models[i].offset, + data.model_name, models[i].length); + if (status < 0) { + data.model_name[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x%x)\n", + client->addr, models[i].offset); + return status; + } + else { + data.model_name[models[i].length] = '\0'; + } + + /* Determine if the model name is known, if not, read next index + */ + if (strncmp(data.model_name, models[i].model_name, models[i].chk_length) == 0) { + return sprintf(buf, "%s\n", data.model_name); + } + else { + data.model_name[0] = '\0'; + } + } + + return -ENODATA; + +} + +static int __init pddf_custom_psu_init(void) +{ + access_psu_serial_num.show = pddf_get_custom_psu_serial_num; + access_psu_serial_num.do_get = NULL; + + access_psu_model_name.show = pddf_get_custom_psu_model_name; + access_psu_model_name.do_get = NULL; + + return 0; +} + +static void __exit pddf_custom_psu_exit(void) +{ + printk(KERN_ERR "pddf_custom_psu_exit\n"); + return; +} + +MODULE_AUTHOR("Broadcom"); +MODULE_DESCRIPTION("pddf custom psu api"); +MODULE_LICENSE("GPL"); + +module_init(pddf_custom_psu_init); +module_exit(pddf_custom_psu_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..3b9bb607f632 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/fan_drawer.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python + + +try: + from sonic_platform_pddf_base.pddf_fan_drawer import PddfFanDrawer +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class FanDrawer(PddfFanDrawer): + """PDDF Platform-Specific Fan-Drawer class""" + + def __init__(self, tray_idx, pddf_data=None, pddf_plugin_data=None): + # idx is 0-based + PddfFanDrawer.__init__(self, tray_idx, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/thermal.py index 5b829fc26caa..77d6ec7ae886 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/thermal.py @@ -11,7 +11,7 @@ class Thermal(PddfThermal): """PDDF Platform-Specific Thermal class""" - def __init__(self, index, pddf_data=None, pddf_plugin_data=None): - PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data) + def __init__(self, index, pddf_data=None, pddf_plugin_data=None, is_psu_thermal=False, psu_index=0): + PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data, is_psu_thermal, psu_index) # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor.py index aada6ba5c507..f506b72f83ab 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor.py @@ -291,11 +291,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdlt:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG @@ -304,7 +304,7 @@ def main(argv): if sys.argv[1]== '-t': if len(sys.argv)!=7: - print "temp test, need input six temp" + print("temp test, need input six temp") return 0 i=0 @@ -313,11 +313,11 @@ def main(argv): i=i+1 test_temp = 1 log_level = logging.DEBUG - print test_temp_list + print(test_temp_list) fan = FanUtil() fan.set_fan_duty_cycle(38) - print "set default fan speed to 37.5%" + print("set default fan speed to 37.5%") monitor = device_monitor(log_file, log_level) # Loop forever, doing something useful hopefully: while True: diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor_fan.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor_fan.py index a2139341150c..cf86a14adc3d 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor_fan.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor_fan.py @@ -130,7 +130,7 @@ def manage_fan(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -149,7 +149,7 @@ def manage_fan(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -171,11 +171,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor_psu.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor_psu.py index d139e3f3f1c8..8527df743dae 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor_psu.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor_psu.py @@ -96,7 +96,7 @@ def manage_psu(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -117,7 +117,7 @@ def manage_psu(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -143,11 +143,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_pddf_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_pddf_monitor.py index fd3f55995878..fd283cd6cc2b 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_pddf_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_pddf_monitor.py @@ -279,11 +279,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdlt:',['lfile=']) except getopt.GetoptError: - print('Usage: %s [-d] [-l ]' % sys.argv[0]) + print(('Usage: %s [-d] [-l ]' % sys.argv[0])) return 0 for opt, arg in opts: if opt == '-h': - print('Usage: %s [-d] [-l ]' % sys.argv[0]) + print(('Usage: %s [-d] [-l ]' % sys.argv[0])) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_util.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_util.py index b6d3c02935e0..bee413fe0655 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_util.py @@ -100,8 +100,8 @@ if DEBUG == True: - print(sys.argv[0]) - print('ARGV :', sys.argv[1:]) + print((sys.argv[0])) + print(('ARGV :', sys.argv[1:])) def main(): @@ -119,7 +119,7 @@ def main(): if DEBUG == True: print(options) print(args) - print(len(sys.argv)) + print((len(sys.argv))) for opt, arg in options: if opt in ('-h', '--help'): @@ -143,7 +143,7 @@ def main(): return 0 def show_help(): - print( __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) + print(( __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]})) sys.exit(0) def dis_i2c_ir3570a(addr): @@ -165,14 +165,14 @@ def ir3570_check(): else: ret = 0 except Exception as e: - print( "Error on ir3570_check() e:" + str(e)) + print(( "Error on ir3570_check() e:" + str(e))) return -1 return ret def my_log(txt): if DEBUG == True: - print("[ACCTON DBG]: ",txt) + print(("[ACCTON DBG]: ",txt)) return def log_os_system(cmd, show): @@ -186,7 +186,7 @@ def log_os_system(cmd, show): if status: logging.info('Failed :'+cmd) if show: - print('Failed :'+cmd) + print(('Failed :'+cmd)) return status, output def driver_inserted(): @@ -325,7 +325,7 @@ def do_install(): if FORCE == 0: return status else: - print(PROJECT_NAME.upper()+" drivers detected....") + print((PROJECT_NAME.upper()+" drivers detected....")) ir3570_check() @@ -335,12 +335,12 @@ def do_install(): if FORCE == 0: return status else: - print(PROJECT_NAME.upper()+" devices detected....") + print((PROJECT_NAME.upper()+" devices detected....")) return def do_uninstall(): if not device_exist(): - print(PROJECT_NAME.upper()+" has no device installed....") + print((PROJECT_NAME.upper()+" has no device installed....")) else: print("Removing device....") status = device_uninstall() @@ -349,7 +349,7 @@ def do_uninstall(): return status if driver_inserted()== False : - print(PROJECT_NAME.upper()+" has no driver installed....") + print((PROJECT_NAME.upper()+" has no driver installed....")) else: print("Removing installed driver....") status = driver_uninstall() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/pddf_post_device_create.sh b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/pddf_post_device_create.sh new file mode 100755 index 000000000000..bfa545595338 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/pddf_post_device_create.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set_pca_mux_idle_disconnect() +{ + echo -2 | tee /sys/bus/i2c/drivers/pca954x/*-00*/idle_state >& /dev/null + if [ $? -ne 0 ]; then + echo Fail to set pca954x mux idle disconnect + exit 2 + fi +} + +set_pca_mux_idle_disconnect diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/pddf_post_driver_install.sh b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/pddf_post_driver_install.sh index c33f0b0c9797..484e5c976b4c 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/pddf_post_driver_install.sh +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/pddf_post_driver_install.sh @@ -4,8 +4,8 @@ dis_i2c_ir3570a() { local addr=$1 - i2cset -y 0 $addr 0xE5 0x01 &>/dev/null - i2cset -y 0 $addr 0x12 0x02 &>/dev/null + i2cset -y -a 0 $addr 0xE5 0x01 &>/dev/null + i2cset -y -a 0 $addr 0x12 0x02 &>/dev/null } diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/pddf_switch_svc.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/pddf_switch_svc.py index 9022132859f3..9664d21b6c36 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/pddf_switch_svc.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/pddf_switch_svc.py @@ -2,95 +2,95 @@ # Script to stop and start the respective platforms default services. # This will be used while switching the pddf->non-pddf mode and vice versa -import commands +import subprocess def check_pddf_support(): return True def stop_platform_svc(): - status, output = commands.getstatusoutput("systemctl stop as7726-32x-platform-monitor-fan.service") + status, output = subprocess.getstatusoutput("systemctl stop as7726-32x-platform-monitor-fan.service") if status: - print "Stop as7726-32x-platform-monitor-fan.service failed %d"%status + print("Stop as7726-32x-platform-monitor-fan.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl disable as7726-32x-platform-monitor-fan.service") + status, output = subprocess.getstatusoutput("systemctl disable as7726-32x-platform-monitor-fan.service") if status: - print "Disable as7726-32x-platform-monitor-fan.service failed %d"%status + print("Disable as7726-32x-platform-monitor-fan.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl stop as7726-32x-platform-monitor-psu.service") + status, output = subprocess.getstatusoutput("systemctl stop as7726-32x-platform-monitor-psu.service") if status: - print "Stop as7726-32x-platform-monitor-psu.service failed %d"%status + print("Stop as7726-32x-platform-monitor-psu.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl disable as7726-32x-platform-monitor-psu.service") + status, output = subprocess.getstatusoutput("systemctl disable as7726-32x-platform-monitor-psu.service") if status: - print "Disable as7726-32x-platform-monitor-psu.service failed %d"%status + print("Disable as7726-32x-platform-monitor-psu.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl stop as7726-32x-platform-monitor.service") + status, output = subprocess.getstatusoutput("systemctl stop as7726-32x-platform-monitor.service") if status: - print "Stop as7726-32x-platform-monitor.service failed %d"%status + print("Stop as7726-32x-platform-monitor.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl disable as7726-32x-platform-monitor.service") + status, output = subprocess.getstatusoutput("systemctl disable as7726-32x-platform-monitor.service") if status: - print "Disable as7726-32x-platform-monitor.service failed %d"%status + print("Disable as7726-32x-platform-monitor.service failed %d"%status) return False - status, output = commands.getstatusoutput("/usr/local/bin/accton_as7726_32x_util.py clean") + status, output = subprocess.getstatusoutput("/usr/local/bin/accton_as7726_32x_util.py clean") if status: - print "accton_as7726_32x_util.py clean command failed %d"%status + print("accton_as7726_32x_util.py clean command failed %d"%status) return False # HACK , stop the pddf-platform-init service if it is active - status, output = commands.getstatusoutput("systemctl stop pddf-platform-init.service") + status, output = subprocess.getstatusoutput("systemctl stop pddf-platform-init.service") if status: - print "Stop pddf-platform-init.service along with other platform serives failed %d"%status + print("Stop pddf-platform-init.service along with other platform serives failed %d"%status) return False return True def start_platform_svc(): - status, output = commands.getstatusoutput("/usr/local/bin/accton_as7726_32x_util.py install") + status, output = subprocess.getstatusoutput("/usr/local/bin/accton_as7726_32x_util.py install") if status: - print "accton_as7726_32x_util.py install command failed %d"%status + print("accton_as7726_32x_util.py install command failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl enable as7726-32x-platform-monitor-fan.service") + status, output = subprocess.getstatusoutput("systemctl enable as7726-32x-platform-monitor-fan.service") if status: - print "Enable as7726-32x-platform-monitor-fan.service failed %d"%status + print("Enable as7726-32x-platform-monitor-fan.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl start as7726-32x-platform-monitor-fan.service") + status, output = subprocess.getstatusoutput("systemctl start as7726-32x-platform-monitor-fan.service") if status: - print "Start as7726-32x-platform-monitor-fan.service failed %d"%status + print("Start as7726-32x-platform-monitor-fan.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl enable as7726-32x-platform-monitor-psu.service") + status, output = subprocess.getstatusoutput("systemctl enable as7726-32x-platform-monitor-psu.service") if status: - print "Enable as7726-32x-platform-monitor-psu.service failed %d"%status + print("Enable as7726-32x-platform-monitor-psu.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl start as7726-32x-platform-monitor-psu.service") + status, output = subprocess.getstatusoutput("systemctl start as7726-32x-platform-monitor-psu.service") if status: - print "Start as7726-32x-platform-monitor-psu.service failed %d"%status + print("Start as7726-32x-platform-monitor-psu.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl enable as7726-32x-platform-monitor.service") + status, output = subprocess.getstatusoutput("systemctl enable as7726-32x-platform-monitor.service") if status: - print "Enable as7726-32x-platform-monitor.service failed %d"%status + print("Enable as7726-32x-platform-monitor.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl start as7726-32x-platform-monitor.service") + status, output = subprocess.getstatusoutput("systemctl start as7726-32x-platform-monitor.service") if status: - print "Start as7726-32x-platform-monitor.service failed %d"%status + print("Start as7726-32x-platform-monitor.service failed %d"%status) return False return True def start_platform_pddf(): - status, output = commands.getstatusoutput("systemctl start pddf-platform-init.service") + status, output = subprocess.getstatusoutput("systemctl start pddf-platform-init.service") if status: - print "Start pddf-platform-init.service failed %d"%status + print("Start pddf-platform-init.service failed %d"%status) return False return True def stop_platform_pddf(): - status, output = commands.getstatusoutput("systemctl stop pddf-platform-init.service") + status, output = subprocess.getstatusoutput("systemctl stop pddf-platform-init.service") if status: - print "Stop pddf-platform-init.service failed %d"%status + print("Stop pddf-platform-init.service failed %d"%status) return False return True diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/fanutil.py index 42ccb17eaa06..519aaa76749d 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/fanutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/fanutil.py @@ -104,7 +104,7 @@ def _get_fan_node_val(self, fan_num, node_num): return None try: - val_file.close() + val_file.close() except: logging.debug('GET. unable to close file. device_path:%s', device_path) return None @@ -135,7 +135,7 @@ def _set_fan_node_val(self, fan_num, node_num, val): val_file.write(content) try: - val_file.close() + val_file.close() except: logging.debug('GET. unable to close file. device_path:%s', device_path) return None @@ -185,7 +185,7 @@ def get_fan_duty_cycle(self): try: val_file = open(self.FAN_DUTY_PATH) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() @@ -204,7 +204,7 @@ def set_fan_duty_cycle(self, val): try: fan_file = open(self.FAN_DUTY_PATH, 'r+') except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False fan_file.write(str(val)) fan_file.close() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/thermalutil.py b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/thermalutil.py index 65e872c6beb8..2a4afca9b7e0 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/thermalutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/classes/thermalutil.py @@ -81,11 +81,11 @@ def _get_thermal_node_val(self, thermal_num): return None try: - val_file.close() + val_file.close() except: logging.debug('GET. unable to close file. device_path:%s', device_path) return None - + return int(content) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/Makefile index 906b595883f6..3e3a9ac38a3e 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/Makefile @@ -1,2 +1,6 @@ -obj-m:=x86-64-accton-as7816-64x-fan.o x86-64-accton-as7816-64x-sfp.o x86-64-accton-as7816-64x-leds.o \ +obj-m:=x86-64-accton-as7816-64x-fan.o x86-64-accton-as7816-64x-leds.o \ x86-64-accton-as7816-64x-psu.o accton_i2c_cpld.o ym2651y.o pddf_custom_fan.o + +CFLAGS_pddf_custom_fan.o := -I$(M)/../../../../pddf/i2c/modules/include +KBUILD_EXTRA_SYMBOLS := $(M)/../../../../pddf/i2c/Module.symvers.PDDF + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/pddf_custom_fan.c b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/pddf_custom_fan.c index 2e738d685d75..accd79e1c8a2 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/pddf_custom_fan.c +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/modules/pddf_custom_fan.c @@ -9,8 +9,8 @@ #include #include #include -#include "../../../../pddf/i2c/modules/include/pddf_fan_defs.h" -#include "../../../../pddf/i2c/modules/include/pddf_fan_driver.h" +#include "pddf_fan_defs.h" +#include "pddf_fan_driver.h" extern FAN_SYSFS_ATTR_DATA data_fan1_input; extern FAN_SYSFS_ATTR_DATA data_fan2_input; diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-64x-platform-init.service b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-64x-platform-init.service new file mode 100644 index 000000000000..7f3b7d87f99f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-64x-platform-init.service @@ -0,0 +1,17 @@ +[Unit] +Description=Accton AS7816-64X Platform initialization service +Before=pmon.service determine-reboot-cause.service +After=sysinit.target +DefaultDependencies=no + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/local/bin/accton_as7816_64x_util.py install +ExecStop=/usr/local/bin/accton_as7816_64x_util.py clean + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-64x-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-64x-platform-monitor.service new file mode 100644 index 000000000000..f361642e69fc --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-64x-platform-monitor.service @@ -0,0 +1,17 @@ +[Unit] +Description=Accton AS7816-64X Platform Monitoring service +Before=pmon.service +After=as7816-64x-platform-init.service +Requires=as7816-64x-platform-init.service +DefaultDependencies=no + +[Service] +ExecStart=/usr/local/bin/accton_as7816_64x_monitor.py +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-platform-init.service b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-platform-init.service deleted file mode 100755 index 486ed74f8243..000000000000 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-platform-init.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Accton AS7816-64X Platform initialization service -Before=pmon.service -After=sysinit.target -DefaultDependencies=no - -[Service] -ExecStartPre=/usr/local/bin/accton_as7816_util.py install -ExecStart=/usr/local/bin/accton_as7816_monitor.py -RemainAfterExit=yes - -[Install] -WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..3b9bb607f632 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/sonic_platform/fan_drawer.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python + + +try: + from sonic_platform_pddf_base.pddf_fan_drawer import PddfFanDrawer +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class FanDrawer(PddfFanDrawer): + """PDDF Platform-Specific Fan-Drawer class""" + + def __init__(self, tray_idx, pddf_data=None, pddf_plugin_data=None): + # idx is 0-based + PddfFanDrawer.__init__(self, tray_idx, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/sonic_platform/thermal.py index 5b829fc26caa..77d6ec7ae886 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/sonic_platform/thermal.py @@ -11,7 +11,7 @@ class Thermal(PddfThermal): """PDDF Platform-Specific Thermal class""" - def __init__(self, index, pddf_data=None, pddf_plugin_data=None): - PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data) + def __init__(self, index, pddf_data=None, pddf_plugin_data=None, is_psu_thermal=False, psu_index=0): + PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data, is_psu_thermal, psu_index) # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_64x_monitor.py similarity index 97% rename from platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_monitor.py rename to platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_64x_monitor.py index 217351ad2a3c..f3ed87398bc1 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_64x_monitor.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2017 Accton Technology Corporation # @@ -136,11 +136,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_util.py b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_64x_util.py similarity index 85% rename from platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_util.py rename to platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_64x_util.py index 0d3a47b8ba76..1e9314fb824e 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_64x_util.py @@ -81,9 +81,14 @@ def main(): logging.info('no option') for arg in args: if arg == 'install': - do_install() + do_install() elif arg == 'clean': - do_uninstall() + do_uninstall() + elif arg == 'api': + do_sonic_platform_install() + elif arg == 'api_clean': + do_sonic_platform_clean() + else: show_help() @@ -298,7 +303,44 @@ def system_ready(): if not device_exist(): return False return True - + +PLATFORM_ROOT_PATH = '/usr/share/sonic/device' +PLATFORM_API2_WHL_FILE_PY3 ='sonic_platform-1.0-py3-none-any.whl' +def do_sonic_platform_install(): + device_path = "{}{}{}{}".format(PLATFORM_ROOT_PATH, '/x86_64-accton_', PROJECT_NAME, '-r0') + SONIC_PLATFORM_BSP_WHL_PKG_PY3 = "/".join([device_path, PLATFORM_API2_WHL_FILE_PY3]) + + #Check API2.0 on py whl file + status, output = log_os_system("pip3 show sonic-platform > /dev/null 2>&1", 0) + if status: + if os.path.exists(SONIC_PLATFORM_BSP_WHL_PKG_PY3): + status, output = log_os_system("pip3 install "+ SONIC_PLATFORM_BSP_WHL_PKG_PY3, 1) + if status: + print("Error: Failed to install {}".format(PLATFORM_API2_WHL_FILE_PY3)) + return status + else: + print("Successfully installed {} package".format(PLATFORM_API2_WHL_FILE_PY3)) + else: + print('{} is not found'.format(PLATFORM_API2_WHL_FILE_PY3)) + else: + print('{} has installed'.format(PLATFORM_API2_WHL_FILE_PY3)) + + return + +def do_sonic_platform_clean(): + status, output = log_os_system("pip3 show sonic-platform > /dev/null 2>&1", 0) + if status: + print('{} does not install, not need to uninstall'.format(PLATFORM_API2_WHL_FILE_PY3)) + + else: + status, output = log_os_system("pip3 uninstall sonic-platform -y", 0) + if status: + print('Error: Failed to uninstall {}'.format(PLATFORM_API2_WHL_FILE_PY3)) + return status + else: + print('{} is uninstalled'.format(PLATFORM_API2_WHL_FILE_PY3)) + + return def do_install(): print("Checking system....") if driver_check() == False: @@ -320,6 +362,8 @@ def do_install(): return status else: print(PROJECT_NAME.upper()+" devices detected....") + do_sonic_platform_install() + return def do_uninstall(): @@ -342,6 +386,8 @@ def do_uninstall(): if FORCE == 0: return status + do_sonic_platform_clean() + return def device_exist(): diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_pddf_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_pddf_monitor.py index a7fc6df09966..8d64cc961706 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_pddf_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_pddf_monitor.py @@ -167,11 +167,11 @@ def main(argv): try: opts, args = getopt.getopt(argv, 'hdlt:', ['lfile=']) except getopt.GetoptError: - print("Usage: %s [-d] [-l ]" % sys.argv[0]) + print(("Usage: %s [-d] [-l ]" % sys.argv[0])) return 0 for opt, arg in opts: if opt == '-h': - print("Usage: %s [-d] [-l ]" % sys.argv[0]) + print(("Usage: %s [-d] [-l ]" % sys.argv[0])) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/pddf_post_device_create.sh b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/pddf_post_device_create.sh new file mode 100755 index 000000000000..bfa545595338 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/pddf_post_device_create.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set_pca_mux_idle_disconnect() +{ + echo -2 | tee /sys/bus/i2c/drivers/pca954x/*-00*/idle_state >& /dev/null + if [ $? -ne 0 ]; then + echo Fail to set pca954x mux idle disconnect + exit 2 + fi +} + +set_pca_mux_idle_disconnect diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/pddf_post_driver_install.sh b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/pddf_post_driver_install.sh new file mode 100755 index 000000000000..9783c323b606 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/pddf_post_driver_install.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +dis_i2c_ir3570a() +{ + local addr=$1 + + i2cset -y -a 0 $addr 0xE5 0x01 &>/dev/null + i2cset -y -a 0 $addr 0x12 0x02 &>/dev/null +} + + +ir3570_check() +{ + dump=`i2cdump -y 0 0x42 s 0x9a |awk 'END {print $2}'` + if [ $dump -eq 24 ]; then + echo "Disabling i2c function of ir3570a" + dis_i2c_ir3570a 0x4 + fi +} + +ir3570_check + +echo "AS7816 post PDDF driver install completed" diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/pddf_switch_svc.py b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/pddf_switch_svc.py index 0c9508f76104..98bf05eca115 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/pddf_switch_svc.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/pddf_switch_svc.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # Script to stop and start the respective platforms default services. # This will be used while switching the pddf->non-pddf mode and vice versa -import commands +import subprocess def check_pddf_support(): @@ -10,56 +10,56 @@ def check_pddf_support(): def stop_platform_svc(): - status, output = commands.getstatusoutput("systemctl stop as7816-platform-init.service") + status, output = subprocess.getstatusoutput("systemctl stop as7816-platform-init.service") if status: - print("Stop as7816-platform-init.service failed %d" % status) + print(("Stop as7816-platform-init.service failed %d" % status)) return False - status, output = commands.getstatusoutput("systemctl disable as7816-platform-init.service") + status, output = subprocess.getstatusoutput("systemctl disable as7816-platform-init.service") if status: - print("Disable as7816-platform-init.service failed %d" % status) + print(("Disable as7816-platform-init.service failed %d" % status)) return False - status, output = commands.getstatusoutput("/usr/local/bin/accton_as7816_util.py clean") + status, output = subprocess.getstatusoutput("/usr/local/bin/accton_as7816_util.py clean") if status: - print("accton_as7816_util.py clean command failed %d" % status) + print(("accton_as7816_util.py clean command failed %d" % status)) return False # HACK , stop the pddf-platform-init service if it is active - status, output = commands.getstatusoutput("systemctl stop pddf-platform-init.service") + status, output = subprocess.getstatusoutput("systemctl stop pddf-platform-init.service") if status: - print("Stop pddf-platform-init.service along with other platform serives failed %d" % status) + print(("Stop pddf-platform-init.service along with other platform serives failed %d" % status)) return False return True def start_platform_svc(): - status, output = commands.getstatusoutput("/usr/local/bin/accton_as7816_util.py install") + status, output = subprocess.getstatusoutput("/usr/local/bin/accton_as7816_util.py install") if status: - print("accton_as7816_util.py install command failed %d" % status) + print(("accton_as7816_util.py install command failed %d" % status)) return False - status, output = commands.getstatusoutput("systemctl enable as7816-platform-init.service") + status, output = subprocess.getstatusoutput("systemctl enable as7816-platform-init.service") if status: - print("Enable as7816-platform-init.service failed %d" % status) + print(("Enable as7816-platform-init.service failed %d" % status)) return False return True def start_platform_pddf(): - status, output = commands.getstatusoutput("systemctl start pddf-platform-init.service") + status, output = subprocess.getstatusoutput("systemctl start pddf-platform-init.service") if status: - print("Start pddf-platform-init.service failed %d" % status) + print(("Start pddf-platform-init.service failed %d" % status)) return False return True def stop_platform_pddf(): - status, output = commands.getstatusoutput("systemctl stop pddf-platform-init.service") + status, output = subprocess.getstatusoutput("systemctl stop pddf-platform-init.service") if status: - print("Stop pddf-platform-init.service failed %d" % status) + print(("Stop pddf-platform-init.service failed %d" % status)) return False return True diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/pre_pddf_init.sh b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/pre_pddf_init.sh new file mode 100755 index 000000000000..b13c90f84781 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/pre_pddf_init.sh @@ -0,0 +1,151 @@ +#!/bin/bash + +# Steps to check syseeprom i2c address +modprobe i2c-i801 +modprobe i2c-dev +at_id=false + +(i2cset -y -f 0 0x77 0x1) > /dev/null 2>&1 +(i2cset -y -f 0 0x76 0x4) > /dev/null 2>&1 + + +(i2cget -y -f 0 0x60 0xfd) > /dev/null 2>&1 +if [ $? -eq 0 ]; then + echo "get at_id" + + at_1=$(i2cget -y -f 0 0x60 0xfd) + + if [[ ${at_1} -eq 0x41 ]]; then + echo "get at_1 is 0x41" + at_2=$(i2cget -y -f 0 0x60 0xfe) + + if [[ ${at_2} -eq 0x54 ]]; then + echo "get at_2 is 0x54" + at_id=true + fi + else + cpld_id=$(i2cget -y -f 0 0x60 0x1) #This CPD version that not support to record at_id + if [[ ${cpld_id} -eq 0x5 ]]; then + at_id=true + fi + + fi +fi + +if $at_id ; then + echo "This CPLD is for AT used PSU" + echo "PSU-1 pmbus use parent_bus:0x9, dev_addr:0x58" + echo "PSU-1 eeprom use parent_bus:0x9, dev_addr:0x50" + echo "PSU-2 pmbus use parent_bus:0xa, dev_addr:0x5b" + echo "PSU-2 eeprom use parent_bus:0xa, dev_addr:0x53" + + if [ -f /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf_support ] && \ + [ -f /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json ]; then + #Change the PDDF JSON file + sed -i 's@{ "chn":"0", "dev":"PSU2"},@\ + { "chn":"0", "dev":"PSU1" },@g' \ + /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json + sync + sed -i 's@{ "chn":"1", "dev":"PSU1"}@\ + { "chn":"1", "dev":"PSU2" }@g' \ + /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json + sync + + sed -i 's@"topo_info":{ "parent_bus":"0xa", "dev_addr":"0x5b", "dev_type":"psu_pmbus"},@\ + "topo_info": {"parent_bus":"0x9", "dev_addr":"0x58" , "dev_type": "psu_pmbus" },@g' \ + /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json + sync + sed -i 's@{ "attr_name":"psu_model_name", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10"},@\ + { "attr_name":"psu_model_name", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" },@g' \ + /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json + sync + sed -i 's@{ "attr_name":"psu_mfr_id", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10"},@\ + { "attr_name":"psu_mfr_id", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" },@g' \ + /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json + sync + sed -i 's@{ "attr_name":"psu_fan_dir", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"},@\ + { "attr_name":"psu_fan_dir", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5" },@g' \ + /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json + sync + sed -i 's@{ "attr_name":"psu_v_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ + { "attr_name":"psu_v_out", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ + /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json + sync + sed -i 's@{ "attr_name":"psu_i_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ + { "attr_name":"psu_i_out", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ + /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json + sync + sed -i 's@{ "attr_name":"psu_p_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ + { "attr_name":"psu_p_out", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ + /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json + sync + sed -i 's@{ "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ + { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ + /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json + sync + sed -i 's@{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}@\ + { "attr_name":"psu_temp1_input", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" }@g' \ + /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json + sync + + sed -i 's@"topo_info":{ "parent_bus":"0xa", "dev_addr":"0x53", "dev_type":"psu_eeprom"},@\ + "topo_info": {"parent_bus":"0x9", "dev_addr":"0x50" , "dev_type": "psu_eeprom" },@g' \ + /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json + sync + + + sed -i 's@"topo_info": { "parent_bus":"0x9", "dev_addr":"0x58", "dev_type":"psu_pmbus"},@\ + "topo_info": {"parent_bus":"0xa", "dev_addr":"0x5b", "dev_type": "psu_pmbus" },@g' \ + /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json + sync + + sed -i 's@{ "attr_name":"psu_model_name", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10"},@\ + { "attr_name":"psu_model_name", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" },@g' \ + /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json + sync + + sed -i 's@{ "attr_name":"psu_mfr_id", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10"},@\ + { "attr_name":"psu_mfr_id", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" },@g' \ + /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json + sync + sed -i 's@{ "attr_name":"psu_fan_dir", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"},@\ + { "attr_name":"psu_fan_dir", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5" },@g' \ + /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json + sync + sed -i 's@{ "attr_name":"psu_v_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ + { "attr_name":"psu_v_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ + /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json + sync + sed -i 's@{ "attr_name":"psu_i_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ + { "attr_name":"psu_i_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ + /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json + sync + sed -i 's@{ "attr_name":"psu_p_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ + { "attr_name":"psu_p_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ + /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json + sync + sed -i 's@{ "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ + { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ + /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json + sync + sed -i 's@{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}@\ + { "attr_name":"psu_temp1_input", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" }@g' \ + /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json + sync + + sed -i 's@"topo_info":{ "parent_bus":"0x9", "dev_addr":"0x50", "dev_type":"psu_eeprom"},@\ + "topo_info": {"parent_bus":"0xa", "dev_addr":"0x53", "dev_type": "psu_eeprom" },@g' \ + /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json + sync + fi +fi + +(i2cset -y -f 0 0x76 0x0) > /dev/null 2>&1 +(i2cset -y -f 0 0x77 0x0) > /dev/null 2>&1 +echo "Pre PDDF init steps completed successully" + +#For others, psu i2c bus use below, +#PSU-1 pmbus use "parent_bus":"0xa", "dev_addr":"0x5b" +#PSU-1 eeprom use "parent_bus":"0xa", "dev_addr":"0x53" +#PSU-2 pmbus use "parent_bus":"0x9", "dev_addr":"0x58" +#PSU-2 eeprom use "parent_bus":"0x9", "dev_addr":"0x50" diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/classes/fanutil.py index 52889cd5895d..2afbf905a390 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/classes/fanutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/classes/fanutil.py @@ -184,7 +184,7 @@ def get_fan_duty_cycle(self): try: val_file = open(self.FAN_DUTY_PATH) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() @@ -196,7 +196,7 @@ def set_fan_duty_cycle(self, val): try: fan_file = open(self.FAN_DUTY_PATH, 'r+') except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False fan_file.write(str(val)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/classes/thermalutil.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/classes/thermalutil.py index abbc5e819a8a..5f6af3811f01 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/classes/thermalutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/classes/thermalutil.py @@ -24,7 +24,7 @@ import time import logging import glob - import commands + import subprocess from collections import namedtuple except ImportError as e: raise ImportError('%s - required module not found' % str(e)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/Makefile index 7bb532a1f531..6ac9d418a3d2 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/Makefile @@ -1,8 +1,11 @@ ifneq ($(KERNELRELEASE),) obj-m:= accton_as9716_32d_cpld.o accton_as9716_32d_fan.o \ accton_as9716_32d_leds.o accton_as9716_32d_psu.o accton_i2c_psu.o \ - pddf_custom_psu.o + pddf_custom_psu.o +CFLAGS_pddf_custom_psu.o := -I$(M)/../../../../pddf/i2c/modules/include +KBUILD_EXTRA_SYMBOLS := $(M)/../../../../pddf/i2c/Module.symvers.PDDF + else ifeq (,$(KERNEL_SRC)) #$(error KERNEL_SRC is not defined) diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/accton_as9716_32d_fan.c b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/accton_as9716_32d_fan.c index 4d2433e7981e..b586a47ed007 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/accton_as9716_32d_fan.c +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/accton_as9716_32d_fan.c @@ -42,7 +42,6 @@ static struct as9716_32d_fan_data *as9716_32d_fan_update_device(struct device *d static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf); static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, const char *buf, size_t count); -static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, char *buf); /* fan related data, the index should match sysfs_fan_attributes */ @@ -138,10 +137,6 @@ enum sysfs_fan_attributes { static SENSOR_DEVICE_ATTR(fan##index##_duty_cycle_percentage, S_IWUSR | S_IRUGO, fan_show_value, set_duty_cycle, FAN##index##_DUTY_CYCLE_PERCENTAGE) #define DECLARE_FAN_DUTY_CYCLE_ATTR(index) &sensor_dev_attr_fan##index##_duty_cycle_percentage.dev_attr.attr -#define DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR() \ - static SENSOR_DEVICE_ATTR(sys_temp, S_IRUGO, get_sys_temp, NULL, FAN_DUTY_CYCLE_PERCENTAGE) - -#define DECLARE_FAN_SYSTEM_TEMP_ATTR() &sensor_dev_attr_sys_temp.dev_attr.attr #define DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(index) \ static SENSOR_DEVICE_ATTR(fan##index##_present, S_IRUGO, fan_show_value, NULL, FAN##index##_PRESENT) @@ -189,7 +184,6 @@ DECLARE_FAN_DIRECTION_SENSOR_DEV_ATTR(6); /* 1 fan duty cycle attribute in this platform */ DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(); /* System temperature for fancontrol */ -DECLARE_FAN_SYSTEM_TEMP_SENSOR_DEV_ATTR(); static struct attribute *as9716_32d_fan_attributes[] = { /* fan related attributes */ @@ -217,8 +211,7 @@ static struct attribute *as9716_32d_fan_attributes[] = { DECLARE_FAN_DIRECTION_ATTR(4), DECLARE_FAN_DIRECTION_ATTR(5), DECLARE_FAN_DIRECTION_ATTR(6), - DECLARE_FAN_DUTY_CYCLE_ATTR(), - DECLARE_FAN_SYSTEM_TEMP_ATTR(), + DECLARE_FAN_DUTY_CYCLE_ATTR(), NULL }; @@ -305,267 +298,6 @@ static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, return count; } -/* Due to this struct is declared at lm75.c, it cannot be include - * under Sonic environment. I duplicate it from lm75.c. - */ -struct lm75_data { - struct i2c_client *client; - struct device *hwmon_dev; - struct thermal_zone_device *tz; - struct mutex update_lock; - u8 orig_conf; - u8 resolution; /* In bits, between 9 and 12 */ - u8 resolution_limits; - char valid; /* !=0 if registers are valid */ - unsigned long last_updated; /* In jiffies */ - unsigned long sample_time; /* In jiffies */ - s16 temp[3]; /* Register values, - 0 = input - 1 = max - 2 = hyst */ -}; - -/*Copied from lm75.c*/ -static inline long lm75_reg_to_mc(s16 temp, u8 resolution) -{ - return ((temp >> (16 - resolution)) * 1000) >> (resolution - 8); -} - -/*Get hwmon_dev from i2c_client, set hwmon_dev = NULL is failed.*/ -static struct device * get_hwmon_dev( - struct i2c_client *client) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - if(data) - { - if( data->valid == 1 && data->hwmon_dev) - { - return data->hwmon_dev; - } - - } - return NULL; -} - -/* To find hwmon index by opening hwmon under that i2c address. - */ -static int find_hwmon_index_by_FileOpen( - int bus_nr, - unsigned short addr, - int *index) -{ -#define MAX_HWMON_DEVICE (10) /* Find hwmon device in 0~10*/ - struct file *sfd; - char client_name[96]; - int i=0; - - do { - snprintf(client_name, sizeof(client_name), - "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", - bus_nr, addr, i); - - sfd = filp_open(client_name, O_RDONLY, 0); - i++; - } while( IS_ERR(sfd) && i < MAX_HWMON_DEVICE); - - if (IS_ERR(sfd)) { - pr_err("Failed to open file(%s)#%d\r\n", client_name, __LINE__); - return -ENOENT; - } - filp_close(sfd, 0); - *index = i - 1; - return 0; - -#undef MAX_HWMON_DEVICE -} - -static int get_temp_file_path( - int bus_nr, unsigned short addr, - struct device *hwmon_dev - ,char *path, int max_len) -{ - - if(hwmon_dev && strlen(dev_name(hwmon_dev))) - { - snprintf(path, max_len, - "/sys/bus/i2c/devices/%d-%04x/hwmon/%s/temp1_input", - bus_nr, addr, dev_name(hwmon_dev)); - } - else - { - int i=0; - if(find_hwmon_index_by_FileOpen( bus_nr, addr, &i)) - { - return -EIO; - } - snprintf(path, max_len, - "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", - bus_nr, addr, i); - } - - return 0; -} - -/*File read the dev file at user space.*/ -static int read_devfile_temp1_input( - struct device *dev, - int bus_nr, - unsigned short addr, - struct device *hwmon_dev, - int *miniCelsius) -{ - struct file *sfd; - char buffer[96]; - char devfile[96]; - int rc, status; - int rdlen, value; - mm_segment_t old_fs; - - rc = 0; - get_temp_file_path(bus_nr, addr, hwmon_dev, devfile, sizeof(devfile)); - sfd = filp_open(devfile, O_RDONLY, 0); - if (IS_ERR(sfd)) { - pr_err("Failed to open file(%s)#%d\r\n", devfile, __LINE__); - return -ENOENT; - } - dev_dbg(dev, "Found device:%s\n",devfile); - - if(!(sfd->f_op) || !(sfd->f_op->read) ) { - pr_err("file %s cann't readable ?\n",devfile); - return -ENOENT; - } - - old_fs = get_fs(); - set_fs(KERNEL_DS); - rdlen = sfd->f_op->read(sfd, buffer, sizeof(buffer), &sfd->f_pos); - if (rdlen == 0) { - pr_err( "File(%s) empty!\n", devfile); - rc = -EIO; - goto exit; - } - status = sscanf(buffer, "%d", &value); - if (status != 1) { - rc = -EIO; - goto exit; - } - *miniCelsius = value; - dev_dbg(dev,"found sensors: %d @i2c %d-%04x\n", value, bus_nr, addr); - -exit: - set_fs(old_fs); - filp_close(sfd, 0); - return rc; -} - -static u8 is_lm75_data_due(struct i2c_client *client) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - if (time_after(jiffies, data->last_updated + data->sample_time)) - { - return 1; - } - return 0; -} -static int get_lm75_temp(struct i2c_client *client, int *miniCelsius) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - *miniCelsius = lm75_reg_to_mc(data->temp[0], data->resolution); - - return 0; -} - -static bool lm75_addr_mached(unsigned short addr) -{ - int i; - unsigned short addrs[] = THERMAL_SENSORS_ADDRS; - - for (i = 0; i < ARRAY_SIZE(addrs); i++) - { - if( addr == addrs[i]) - return 1; - } - return 0; -} - -static int _find_lm75_device(struct device *dev, void *data) -{ - struct device_driver *driver; - struct as9716_32d_fan_data *prv = data; - char *driver_name = THERMAL_SENSORS_DRIVER; - - driver = dev->driver; - if (driver && driver->name && - strcmp(driver->name, driver_name) == 0) - { - struct i2c_client *client; - client = to_i2c_client(dev); - if (client) - { - /*cannot use "struct i2c_adapter *adap = to_i2c_adapter(dev);"*/ - struct i2c_adapter *adap = client->adapter; - int miniCelsius = 0; - - if (! lm75_addr_mached(client->addr)) - { - return 0; - } - - if (!adap) { - return -ENXIO; - } - - /* If the data is not updated, read them from devfile - to drive them updateing data from chip.*/ - if (is_lm75_data_due(client)) - { - struct device *hwmon_dev; - - hwmon_dev = get_hwmon_dev(client); - if(0 == read_devfile_temp1_input(dev, adap->nr, - client->addr, hwmon_dev, &miniCelsius)) - { - prv->system_temp += miniCelsius; - prv->sensors_found++; - } - - } - else - { - get_lm75_temp(client, &miniCelsius); - prv->system_temp += miniCelsius; - prv->sensors_found++; - - } - } - } - return 0; -} - -/*Find all lm75 devices and return sum of temperatures.*/ -static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, - char *buf) -{ - ssize_t ret = 0; - struct as9716_32d_fan_data *data = as9716_32d_fan_update_device(dev); - - data->system_temp=0; - data->sensors_found=0; - i2c_for_each_dev(data, _find_lm75_device); - if (NUM_THERMAL_SENSORS != data->sensors_found) - { - dev_dbg(dev,"only %d of %d temps are found\n", - data->sensors_found, NUM_THERMAL_SENSORS); - data->system_temp = INT_MAX; - } - ret = sprintf(buf, "%d\n",data->system_temp); - return ret; -} static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf) diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/pddf_custom_psu.c b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/pddf_custom_psu.c index 9c4dd7f66131..05f27f6fed97 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/pddf_custom_psu.c +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/pddf_custom_psu.c @@ -9,7 +9,7 @@ #include #include #include -#include "../../../../pddf/i2c/modules/include/pddf_psu_defs.h" +#include "pddf_psu_defs.h" ssize_t pddf_show_custom_psu_v_out(struct device *dev, struct device_attribute *da, char *buf); extern PSU_SYSFS_ATTR_DATA access_psu_v_out; @@ -22,13 +22,9 @@ extern PSU_SYSFS_ATTR_DATA access_psu_serial_num; #define MAX_SERIAL_NUMBER 19 enum psu_type { - PSU_TYPE_AC_110V, - PSU_TYPE_DC_48V, - PSU_TYPE_DC_12V, PSU_TYPE_AC_ACBEL_FSF019, PSU_TYPE_AC_ACBEL_FSH082, PSU_TYPE_YESM1300 - }; struct model_name_info { @@ -48,23 +44,15 @@ struct serial_number_info { }; struct model_name_info models[] = { -{PSU_TYPE_AC_110V, 0x20, 8, 8, "YM-2651Y"}, -{PSU_TYPE_DC_48V, 0x20, 8, 8, "YM-2651V"}, -{PSU_TYPE_DC_12V, 0x00, 11, 11, "PSU-12V-750"}, {PSU_TYPE_AC_ACBEL_FSF019, 0x15, 10, 7, "FSF019-"}, {PSU_TYPE_AC_ACBEL_FSH082, 0x20, 10, 7, "FSH082-"}, {PSU_TYPE_YESM1300, 0x20, 11, 8, "YESM1300"}, - }; struct serial_number_info serials[] = { -{PSU_TYPE_AC_110V, 0x2e, 18, 18, "YM-2651Y"}, -{PSU_TYPE_DC_48V, 0x2e, 18, 18, "YM-2651V"}, -{PSU_TYPE_DC_12V, 0x2e, 18, 18, "PSU-12V-750"}, {PSU_TYPE_AC_ACBEL_FSF019, 0x2e, 16, 16, "FSF019-"}, {PSU_TYPE_AC_ACBEL_FSH082, 0x35, 18, 18, "FSH082-"}, {PSU_TYPE_YESM1300, 0x35, 20, 19, "YESM1300"}, - }; struct pddf_psu_data { diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..3b9bb607f632 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/fan_drawer.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python + + +try: + from sonic_platform_pddf_base.pddf_fan_drawer import PddfFanDrawer +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class FanDrawer(PddfFanDrawer): + """PDDF Platform-Specific Fan-Drawer class""" + + def __init__(self, tray_idx, pddf_data=None, pddf_plugin_data=None): + # idx is 0-based + PddfFanDrawer.__init__(self, tray_idx, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/thermal.py index 5b829fc26caa..77d6ec7ae886 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/thermal.py @@ -11,7 +11,7 @@ class Thermal(PddfThermal): """PDDF Platform-Specific Thermal class""" - def __init__(self, index, pddf_data=None, pddf_plugin_data=None): - PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data) + def __init__(self, index, pddf_data=None, pddf_plugin_data=None, is_psu_thermal=False, psu_index=0): + PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data, is_psu_thermal, psu_index) # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor.py index 1cc35e577b8d..f0eb95d97f88 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor.py @@ -20,7 +20,7 @@ # ------------------------------------------------------------------ try: - import commands + import subprocess import getopt, sys import logging import logging.config @@ -184,7 +184,7 @@ def match(self, *args): def power_off_dut(): cmd_str="i2cset -y -f 19 0x60 0x60 0x10" - status, output = commands.getstatusoutput(cmd_str) + status, output = subprocess.getstatusoutput(cmd_str) return status #If only one PSU insert(or one of PSU pwoer fail), and watt >800w. Must let DUT fan pwm >= 75% in AFO. @@ -493,11 +493,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdlt:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG @@ -506,7 +506,7 @@ def main(argv): if sys.argv[1]== '-t': if len(sys.argv)!=10: - print "temp test, need input 8 temp" + print("temp test, need input 8 temp") return 0 i=0 for x in range(2, 10): @@ -514,7 +514,7 @@ def main(argv): i=i+1 test_temp = 1 log_level = logging.DEBUG - print test_temp_list + print(test_temp_list) fan = FanUtil() fan.set_fan_duty_cycle(100) diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor_fan.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor_fan.py index b22dd5d7984d..8c2b79ac3d6d 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor_fan.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor_fan.py @@ -130,7 +130,7 @@ def manage_fan(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -149,7 +149,7 @@ def manage_fan(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -171,11 +171,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor_psu.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor_psu.py index a3c8a0be65b3..d8327d9a97eb 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor_psu.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor_psu.py @@ -96,7 +96,7 @@ def manage_psu(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -117,7 +117,7 @@ def manage_psu(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -143,11 +143,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_pddf_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_pddf_monitor.py index dff2d5ffe812..fa08071045f5 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_pddf_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_pddf_monitor.py @@ -178,7 +178,7 @@ def match(self, *args): def as9716_32d_set_fan_speed(pwm): if pwm < 0 or pwm > 100: - print("Error: Wrong duty cycle value %d" % (pwm)) + print(("Error: Wrong duty cycle value %d" % (pwm))) return -1 platform_chassis.get_fan(0).set_speed(pwm) time.sleep(1) @@ -477,11 +477,11 @@ def main(argv): try: opts, args = getopt.getopt(argv, 'hdlt:', ['lfile=']) except getopt.GetoptError: - print("Usage: %s [-d] [-l ]" % sys.argv[0]) + print(("Usage: %s [-d] [-l ]" % sys.argv[0])) return 0 for opt, arg in opts: if opt == '-h': - print("Usage: %s [-d] [-l ]" % sys.argv[0]) + print(("Usage: %s [-d] [-l ]" % sys.argv[0])) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_util.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_util.py index 8eabc233fb2d..647e26e07d2c 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_util.py @@ -106,8 +106,8 @@ if DEBUG == True: - print(sys.argv[0]) - print('ARGV :', sys.argv[1:]) + print((sys.argv[0])) + print(('ARGV :', sys.argv[1:])) def main(): @@ -125,7 +125,7 @@ def main(): if DEBUG == True: print(options) print(args) - print(len(sys.argv)) + print((len(sys.argv))) for opt, arg in options: if opt in ('-h', '--help'): @@ -149,7 +149,7 @@ def main(): return 0 def show_help(): - print( __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) + print(( __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]})) sys.exit(0) def dis_i2c_ir3570a(addr): @@ -171,14 +171,14 @@ def ir3570_check(): else: ret = 0 except Exception as e: - print( "Error on ir3570_check() e:" + str(e)) + print(( "Error on ir3570_check() e:" + str(e))) return -1 return ret def my_log(txt): if DEBUG == True: - print("[ACCTON DBG]: "+txt) + print(("[ACCTON DBG]: "+txt)) return def log_os_system(cmd, show): @@ -192,7 +192,7 @@ def log_os_system(cmd, show): if status: logging.info('Failed :'+cmd) if show: - print('Failed :'+cmd) + print(('Failed :'+cmd)) return status, output def driver_inserted(): @@ -345,7 +345,7 @@ def do_install(): if FORCE == 0: return status else: - print(PROJECT_NAME.upper()+" drivers detected....") + print((PROJECT_NAME.upper()+" drivers detected....")) ir3570_check() @@ -355,12 +355,12 @@ def do_install(): if FORCE == 0: return status else: - print(PROJECT_NAME.upper()+" devices detected....") + print((PROJECT_NAME.upper()+" devices detected....")) return def do_uninstall(): if not device_exist(): - print(PROJECT_NAME.upper()+" has no device installed....") + print((PROJECT_NAME.upper()+" has no device installed....")) else: print("Removing device....") status = device_uninstall() @@ -369,7 +369,7 @@ def do_uninstall(): return status if driver_inserted()== False : - print(PROJECT_NAME.upper()+" has no driver installed....") + print((PROJECT_NAME.upper()+" has no driver installed....")) else: print("Removing installed driver....") status = driver_uninstall() diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/pddf_post_device_create.sh b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/pddf_post_device_create.sh new file mode 100755 index 000000000000..bfa545595338 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/pddf_post_device_create.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set_pca_mux_idle_disconnect() +{ + echo -2 | tee /sys/bus/i2c/drivers/pca954x/*-00*/idle_state >& /dev/null + if [ $? -ne 0 ]; then + echo Fail to set pca954x mux idle disconnect + exit 2 + fi +} + +set_pca_mux_idle_disconnect diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/pddf_post_driver_install.sh b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/pddf_post_driver_install.sh index 7fbd7f97d03a..61eb4c0fd5c7 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/pddf_post_driver_install.sh +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/pddf_post_driver_install.sh @@ -4,8 +4,8 @@ dis_i2c_ir3570a() { local addr=$1 - i2cset -y 0 $addr 0xE5 0x01 &>/dev/null - i2cset -y 0 $addr 0x12 0x02 &>/dev/null + i2cset -y -a 0 $addr 0xE5 0x01 &>/dev/null + i2cset -y -a 0 $addr 0x12 0x02 &>/dev/null } @@ -18,6 +18,52 @@ ir3570_check() fi } +# Some initializations +#============================================================ +# cpld_reset_stop +#i2cset -y 0 0x65 0x3 0x0 + +# Select the mux channels +i2cset -y 0 0x77 0x1 +i2cset -y 0 0x76 0x4 + +# Diag LED: Boot successfully (SOLID GREEN) --- DO THIS STEP IN POST DEVICE CREATION +# i2cset -y 0 0x60 0x64 4 + +# 10G Merlin Ports +# SetModeXFI() +echo "Set Mux(retimer) to 2x10G XFI." +i2cset -y 0 0x76 0x20 +i2cset -y 0 0x18 0x7 0x3 +i2cset -y 0 0x19 0x7 0x3 +i2cset -y 0 0x1a 0x7 0x3 +i2cset -y 0 0x1b 0x7 0x3 + + +# SetVOD() +#set channel B +i2cset -y 0 0x18 0xff 0x05 +i2cset -y 0 0x19 0xff 0x05 +#write output voltage to 800mV +i2cset -y 0 0x18 0x2d 0x82 +i2cset -y 0 0x19 0x2d 0x82 +#write de-emphasis to -3.5dB +i2cset -y 0 0x18 0x15 0x12 +i2cset -y 0 0x19 0x15 0x12 +#read output voltage +#i2cget -y 0 0x18 0x2d +#i2cget -y 0 0x19 0x2d +#read de-emphasis +#i2cget -y 0 0x18 0x15 +#i2cget -y 0 0x19 0x15 +#clr channel B +i2cset -y 0 0x18 0xff 0x00 +i2cset -y 0 0x19 0xff 0x00 + +# De-select the mux channels which were selected for above configs +i2cset -y 0 0x76 0x0 +i2cset -y 0 0x77 0x0 + ir3570_check echo "AS9716 post PDDF driver install completed" diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/pddf_switch_svc.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/pddf_switch_svc.py index 3e684a42daca..95e42b5c8971 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/pddf_switch_svc.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/pddf_switch_svc.py @@ -1,81 +1,81 @@ #!/usr/bin/env python # Script to stop and start the respective platforms default services. # This will be used while switching the pddf->non-pddf mode and vice versa -import commands +import subprocess def check_pddf_support(): return True def stop_platform_svc(): - status, output = commands.getstatusoutput("systemctl stop as9716-32d-platform-monitor-fan.service") + status, output = subprocess.getstatusoutput("systemctl stop as9716-32d-platform-monitor-fan.service") if status: - print "Stop as9716-32d-platform-fan.service failed %d"%status + print("Stop as9716-32d-platform-fan.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl stop as9716-32d-platform-monitor-psu.service") + status, output = subprocess.getstatusoutput("systemctl stop as9716-32d-platform-monitor-psu.service") if status: - print "Stop as9716-32d-platform-psu.service failed %d"%status + print("Stop as9716-32d-platform-psu.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl stop as9716-32d-platform-monitor.service") + status, output = subprocess.getstatusoutput("systemctl stop as9716-32d-platform-monitor.service") if status: - print "Stop as9716-32d-platform-init.service failed %d"%status + print("Stop as9716-32d-platform-init.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl disable as9716-32d-platform-monitor.service") + status, output = subprocess.getstatusoutput("systemctl disable as9716-32d-platform-monitor.service") if status: - print "Disable as9716-32d-platform-monitor.service failed %d"%status + print("Disable as9716-32d-platform-monitor.service failed %d"%status) return False - status, output = commands.getstatusoutput("/usr/local/bin/accton_as9716_32d_util.py clean") + status, output = subprocess.getstatusoutput("/usr/local/bin/accton_as9716_32d_util.py clean") if status: - print "accton_as9716_32d_util.py clean command failed %d"%status + print("accton_as9716_32d_util.py clean command failed %d"%status) return False # HACK , stop the pddf-platform-init service if it is active - status, output = commands.getstatusoutput("systemctl stop pddf-platform-init.service") + status, output = subprocess.getstatusoutput("systemctl stop pddf-platform-init.service") if status: - print "Stop pddf-platform-init.service along with other platform serives failed %d"%status + print("Stop pddf-platform-init.service along with other platform serives failed %d"%status) return False return True def start_platform_svc(): - status, output = commands.getstatusoutput("/usr/local/bin/accton_as9716_32d_util.py install") + status, output = subprocess.getstatusoutput("/usr/local/bin/accton_as9716_32d_util.py install") if status: - print "accton_as9716_32d_util.py install command failed %d"%status + print("accton_as9716_32d_util.py install command failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl enable as9716-32d-platform-monitor.service") + status, output = subprocess.getstatusoutput("systemctl enable as9716-32d-platform-monitor.service") if status: - print "Enable as9716-32d-platform-monitor.service failed %d"%status + print("Enable as9716-32d-platform-monitor.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl start as9716-32d-platform-monitor-fan.service") + status, output = subprocess.getstatusoutput("systemctl start as9716-32d-platform-monitor-fan.service") if status: - print "Start as9716-32d-platform-monitor-fan.service failed %d"%status + print("Start as9716-32d-platform-monitor-fan.service failed %d"%status) return False - status, output = commands.getstatusoutput("systemctl start as9716-32d-platform-monitor-psu.service") + status, output = subprocess.getstatusoutput("systemctl start as9716-32d-platform-monitor-psu.service") if status: - print "Start as9716-32d-platform-monitor-psu.service failed %d"%status + print("Start as9716-32d-platform-monitor-psu.service failed %d"%status) return False return True def start_platform_pddf(): - status, output = commands.getstatusoutput("systemctl start pddf-platform-init.service") + status, output = subprocess.getstatusoutput("systemctl start pddf-platform-init.service") if status: - print "Start pddf-platform-init.service failed %d"%status + print("Start pddf-platform-init.service failed %d"%status) return False return True def stop_platform_pddf(): - status, output = commands.getstatusoutput("systemctl stop pddf-platform-init.service") + status, output = subprocess.getstatusoutput("systemctl stop pddf-platform-init.service") if status: - print "Stop pddf-platform-init.service failed %d"%status + print("Stop pddf-platform-init.service failed %d"%status) return False return True diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/pre_pddf_init.sh b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/pre_pddf_init.sh new file mode 100755 index 000000000000..7fe01e294f08 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/pre_pddf_init.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Steps to check syseeprom i2c address +modprobe i2c-i801 +modprobe i2c-dev +use_57_eeprom=false +(i2cget -y -f 0 0x57 0x0) > /dev/null 2>&1 +if [ $? -eq 0 ]; then + use_57_eeprom=true +fi + +if $use_57_eeprom ; then + echo "The board has system EEPROM at I2C address 0x57" + if [ -f /usr/share/sonic/device/x86_64-accton_as9716_32d-r0/pddf_support ] && \ + [ -f /usr/share/sonic/device/x86_64-accton_as9716_32d-r0/pddf/pddf-device.json ]; then + # syseeprom is at the i2c address 0x57. Change the PDDF JSON file + sed -i 's@"topo_info": {"parent_bus": "0x0", "dev_addr": "0x56", "dev_type": "24c02"},@\ + "topo_info": {"parent_bus": "0x0", "dev_addr": "0x57", "dev_type": "24c02"},@g' \ + /usr/share/sonic/device/x86_64-accton_as9716_32d-r0/pddf/pddf-device.json + sync + fi +fi diff --git a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/classes/fanutil.py index 1231b458801e..4d6e177edc83 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/classes/fanutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/classes/fanutil.py @@ -182,7 +182,7 @@ def get_fan_duty_cycle(self): try: val_file = open(self.FAN_DUTY_PATH) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() @@ -194,7 +194,7 @@ def set_fan_duty_cycle(self, val): try: fan_file = open(self.FAN_DUTY_PATH, 'r+') except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False fan_file.write(str(val)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/modules/x86-64-accton-as9726-32d-fan.c b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/modules/x86-64-accton-as9726-32d-fan.c index faf1e84acc37..67a015f01c62 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/modules/x86-64-accton-as9726-32d-fan.c +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/modules/x86-64-accton-as9726-32d-fan.c @@ -358,172 +358,6 @@ static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, return count; } -/* Due to this struct is declared at lm75.c, it cannot be include - * under Sonic environment. I duplicate it from lm75.c. - */ -struct lm75_data { - struct i2c_client *client; - struct device *hwmon_dev; - struct thermal_zone_device *tz; - struct mutex update_lock; - u8 orig_conf; - u8 resolution; /* In bits, between 9 and 12 */ - u8 resolution_limits; - char valid; /* !=0 if registers are valid */ - unsigned long last_updated; /* In jiffies */ - unsigned long sample_time; /* In jiffies */ - s16 temp[3]; /* Register values, - 0 = input - 1 = max - 2 = hyst */ -}; - -/*Copied from lm75.c*/ -static inline long lm75_reg_to_mc(s16 temp, u8 resolution) -{ - return ((temp >> (16 - resolution)) * 1000) >> (resolution - 8); -} - -/*Get hwmon_dev from i2c_client, set hwmon_dev = NULL is failed.*/ -static struct device * get_hwmon_dev( - struct i2c_client *client) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - if(data) - { - if( data->valid == 1 && data->hwmon_dev) - { - return data->hwmon_dev; - } - - } - return NULL; -} - -/* To find hwmon index by opening hwmon under that i2c address. - */ -static int find_hwmon_index_by_FileOpen( - int bus_nr, - unsigned short addr, - int *index) -{ -#define MAX_HWMON_DEVICE (10) /* Find hwmon device in 0~10*/ - struct file *sfd; - char client_name[96]; - int i=0; - - do { - snprintf(client_name, sizeof(client_name), - "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", - bus_nr, addr, i); - - sfd = filp_open(client_name, O_RDONLY, 0); - i++; - } while( IS_ERR(sfd) && i < MAX_HWMON_DEVICE); - - if (IS_ERR(sfd)) { - pr_err("Failed to open file(%s)#%d\r\n", client_name, __LINE__); - return -ENOENT; - } - filp_close(sfd, 0); - *index = i - 1; - return 0; - -#undef MAX_HWMON_DEVICE -} - -static int get_temp_file_path( - int bus_nr, unsigned short addr, - struct device *hwmon_dev - ,char *path, int max_len) -{ - - if(hwmon_dev && strlen(dev_name(hwmon_dev))) - { - snprintf(path, max_len, - "/sys/bus/i2c/devices/%d-%04x/hwmon/%s/temp1_input", - bus_nr, addr, dev_name(hwmon_dev)); - } - else - { - int i=0; - if(find_hwmon_index_by_FileOpen( bus_nr, addr, &i)) - { - return -EIO; - } - snprintf(path, max_len, - "/sys/bus/i2c/devices/%d-%04x/hwmon/hwmon%d/temp1_input", - bus_nr, addr, i); - } - - return 0; -} - -/*File read the dev file at user space.*/ -static int read_devfile_temp1_input( - struct device *dev, - int bus_nr, - unsigned short addr, - struct device *hwmon_dev, - int *miniCelsius) -{ - struct file *sfd; - char buffer[96]; - char devfile[96]; - int rc, status; - int rdlen, value; - mm_segment_t old_fs; - - rc = 0; - get_temp_file_path(bus_nr, addr, hwmon_dev, devfile, sizeof(devfile)); - sfd = filp_open(devfile, O_RDONLY, 0); - if (IS_ERR(sfd)) { - pr_err("Failed to open file(%s)#%d\r\n", devfile, __LINE__); - return -ENOENT; - } - dev_dbg(dev, "Found device:%s\n",devfile); - - if(!(sfd->f_op) || !(sfd->f_op->read) ) { - pr_err("file %s cann't readable ?\n",devfile); - return -ENOENT; - } - - old_fs = get_fs(); - set_fs(KERNEL_DS); - rdlen = sfd->f_op->read(sfd, buffer, sizeof(buffer), &sfd->f_pos); - if (rdlen == 0) { - pr_err( "File(%s) empty!\n", devfile); - rc = -EIO; - goto exit; - } - status = sscanf(buffer, "%d", &value); - if (status != 1) { - rc = -EIO; - goto exit; - } - *miniCelsius = value; - dev_dbg(dev,"found sensors: %d @i2c %d-%04x\n", value, bus_nr, addr); - -exit: - set_fs(old_fs); - filp_close(sfd, 0); - return rc; -} - -static u8 is_lm75_data_due(struct i2c_client *client) -{ - struct lm75_data *data = NULL; - - data = i2c_get_clientdata(client); - if (time_after(jiffies, data->last_updated + data->sample_time)) - { - return 1; - } - return 0; -} - static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf) { diff --git a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_monitor.py index 9d91e942baa2..da399becbafb 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_monitor.py @@ -20,7 +20,7 @@ # ------------------------------------------------------------------ try: - import commands + import subprocess import getopt import sys import logging @@ -205,7 +205,7 @@ def match(self, *args): def power_off_dut(): cmd_str="i2cset -y -f 1 0x60 0x60 0x10" - status, output = commands.getstatusoutput(cmd_str) + status, output = subprocess.getstatusoutput(cmd_str) return status #If only one PSU insert(or one of PSU pwoer fail), and watt >800w. Must let DUT fan pwm >= 75% in AFO. @@ -530,11 +530,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdlt:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG @@ -543,7 +543,7 @@ def main(argv): if sys.argv[1]== '-t': if len(sys.argv)!=9: - print "temp test, need input 7 temp" + print("temp test, need input 7 temp") return 0 i=0 for x in range(2, 9): @@ -551,7 +551,7 @@ def main(argv): i=i+1 test_temp = 1 log_level = logging.DEBUG - print test_temp_list + print(test_temp_list) fan = FanUtil() fan.set_fan_duty_cycle(100) diff --git a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_monitor_fan.py b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_monitor_fan.py index 0e3d8ee08a63..7f49be002f0d 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_monitor_fan.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_monitor_fan.py @@ -126,7 +126,7 @@ def manage_fan(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -145,7 +145,7 @@ def manage_fan(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -167,11 +167,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_monitor_psu.py b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_monitor_psu.py index d9159c38bcf1..aa32d64bcb32 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_monitor_psu.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_monitor_psu.py @@ -92,7 +92,7 @@ def manage_psu(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -113,7 +113,7 @@ def manage_psu(self): try: val_file = open(node) except IOError as e: - print "Error: unable to open file: %s" % str(e) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() val_file.close() @@ -139,11 +139,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdl:',['lfile=']) except getopt.GetoptError: - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'Usage: %s [-d] [-l ]' % sys.argv[0] + print('Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG diff --git a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_util.py b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_util.py index d686a77b91c5..1dd3c0b467d0 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/utils/accton_as9726_32d_util.py @@ -29,7 +29,7 @@ set : change board setting with fan|sfp """ -import commands +import subprocess import getopt import sys import logging @@ -180,9 +180,9 @@ def main(): 'force', ]) if DEBUG: - print options - print args - print len(sys.argv) + print(options) + print(args) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -193,7 +193,7 @@ def main(): elif opt in ('-f', '--force'): FORCE = 1 else: - print "TEST" + print("TEST") logging.info('no option') for arg in args: if arg == 'install': @@ -227,41 +227,41 @@ def main(): def show_help(): - print __doc__ % {'scriptName': sys.argv[0].split("/")[-1]} + print(__doc__ % {'scriptName': sys.argv[0].split("/")[-1]}) sys.exit(0) def show_set_help(): cmd = sys.argv[0].split("/")[-1] + " " + args[0] - print cmd + " [sfp|fan]" - print " use \"" + cmd + " fan 0-100\" to set fan duty percetage" - print " use \"" + cmd + " sfp 33-34 {0|1}\" to set sfp# tx_disable" + print(cmd + " [sfp|fan]") + print(" use \"" + cmd + " fan 0-100\" to set fan duty percetage") + print(" use \"" + cmd + " sfp 33-34 {0|1}\" to set sfp# tx_disable") sys.exit(0) def show_eeprom_help(): cmd = sys.argv[0].split("/")[-1] + " " + args[0] - print " use \"" + cmd + " 1-32 \" to dump sfp# eeprom" + print(" use \"" + cmd + " 1-32 \" to dump sfp# eeprom") sys.exit(0) def my_log(txt): if DEBUG: - print "[ACCTON DBG]: " + txt + print("[ACCTON DBG]: " + txt) return def log_os_system(cmd, show): logging.info('Run :' + cmd) output = "" - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) my_log(cmd + "with result:" + str(status)) my_log("cmd:" + cmd) my_log(" output:" + output) if status: logging.info('Failed :' + cmd) if show: - print('Failed :' + cmd) + print(('Failed :' + cmd)) return status, output @@ -277,7 +277,7 @@ def driver_inserted(): kos = [ 'depmod -ae', 'modprobe i2c_dev', - 'modprobe i2c_mux_pca954x force_deselect_on_exit=1', + 'modprobe i2c_mux_pca954x', 'modprobe ym2651y', 'modprobe x86-64-accton-as9726-32d_cpld', 'modprobe x86-64-accton-as9726-32d_fan', @@ -302,7 +302,7 @@ def driver_uninstall(): for i in range(0, len(kos)): rm = kos[-(i + 1)].replace("modprobe", "modprobe -rq") lst = rm.split(" ") - print "lst=%s" % lst + print("lst=%s" % lst) if len(lst) > 3: del(lst[3]) rm = " ".join(lst) @@ -323,9 +323,18 @@ def device_install(): status, output = log_os_system(mknod[i], 1) if status: - print output + print(output) if FORCE == 0: return status + + # set all pca954x idle_disconnect + cmd = 'echo -2 | tee /sys/bus/i2c/drivers/pca954x/*-00*/idle_state' + status, output = log_os_system(cmd, 1) + if status: + print(output) + if FORCE == 0: + return status + print("Check SFP") for i in range(0, len(sfp_map)): if(i >= (len(sfp_map)-2)): @@ -338,7 +347,7 @@ def device_install(): str(sfp_map[i]) + "/new_device", 1) if status: - print output + print(output) if FORCE == 0: return status @@ -348,7 +357,7 @@ def device_install(): str(sfp_map[i]) + "-0050/port_name", 1) if status: - print output + print(output) if FORCE == 0: return status @@ -363,7 +372,7 @@ def device_uninstall(): str(sfp_map[i]) + "/delete_device" status, output = log_os_system("echo 0x50 > " + target, 1) if status: - print output + print(output) if FORCE == 0: return status @@ -376,7 +385,7 @@ def device_uninstall(): temp[-1] = temp[-1].replace('new_device', 'delete_device') status, output = log_os_system(" ".join(temp), 1) if status: - print output + print(output) if FORCE == 0: return status @@ -387,7 +396,7 @@ def system_ready(): if driver_inserted() == False: return False if not device_exist(): - print "not device_exist()" + print("not device_exist()") return False return True @@ -403,29 +412,29 @@ def do_sonic_platform_install(): if os.path.exists(SONIC_PLATFORM_BSP_WHL_PKG_PY3): status, output = log_os_system("pip3 install "+ SONIC_PLATFORM_BSP_WHL_PKG_PY3, 1) if status: - print "Error: Failed to install {}".format(PLATFORM_API2_WHL_FILE_PY3) + print("Error: Failed to install {}".format(PLATFORM_API2_WHL_FILE_PY3)) return status else: - print "Successfully installed {} package".format(PLATFORM_API2_WHL_FILE_PY3) + print("Successfully installed {} package".format(PLATFORM_API2_WHL_FILE_PY3)) else: - print('{} is not found'.format(PLATFORM_API2_WHL_FILE_PY3)) + print(('{} is not found'.format(PLATFORM_API2_WHL_FILE_PY3))) else: - print('{} has installed'.format(PLATFORM_API2_WHL_FILE_PY3)) + print(('{} has installed'.format(PLATFORM_API2_WHL_FILE_PY3))) return def do_sonic_platform_clean(): status, output = log_os_system("pip3 show sonic-platform > /dev/null 2>&1", 0) if status: - print('{} does not install, not need to uninstall'.format(PLATFORM_API2_WHL_FILE_PY3)) + print(('{} does not install, not need to uninstall'.format(PLATFORM_API2_WHL_FILE_PY3))) else: status, output = log_os_system("pip3 uninstall sonic-platform -y", 0) if status: - print('Error: Failed to uninstall {}'.format(PLATFORM_API2_WHL_FILE_PY3)) + print(('Error: Failed to uninstall {}'.format(PLATFORM_API2_WHL_FILE_PY3))) return status else: - print('{} is uninstalled'.format(PLATFORM_API2_WHL_FILE_PY3)) + print(('{} is uninstalled'.format(PLATFORM_API2_WHL_FILE_PY3))) return @@ -437,14 +446,14 @@ def do_install(): if FORCE == 0: return status else: - print PROJECT_NAME.upper() + " drivers detected...." + print(PROJECT_NAME.upper() + " drivers detected....") if not device_exist(): status = device_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper() + " devices detected...." + print(PROJECT_NAME.upper() + " devices detected....") # for i in range(len(cpld_set)): # status, output = log_os_system(cpld_set[i], 1) @@ -459,18 +468,18 @@ def do_install(): def do_uninstall(): if not device_exist(): - print PROJECT_NAME.upper() + " has no device installed...." + print(PROJECT_NAME.upper() + " has no device installed....") else: - print "Removing device...." + print("Removing device....") status = device_uninstall() if status: if FORCE == 0: return status if driver_inserted() == False: - print PROJECT_NAME.upper() + " has no driver installed...." + print(PROJECT_NAME.upper() + " has no driver installed....") else: - print "Removing installed driver...." + print("Removing installed driver....") status = driver_uninstall() if status: if FORCE == 0: @@ -539,11 +548,11 @@ def devices_info(): # show dict all in the order if DEBUG: for i in sorted(ALL_DEVICE.keys()): - print(i + ": ") + print((i + ": ")) for j in sorted(ALL_DEVICE[i].keys()): - print(" " + j) + print((" " + j)) for k in (ALL_DEVICE[i][j]): - print(" " + " " + k) + print((" " + " " + k)) return @@ -569,15 +578,15 @@ def show_eeprom(index): else: log = 'Failed : no hexdump cmd!!' logging.info(log) - print log + print(log) return 1 - print "node=%s" % node - print node + ":" + print("node=%s" % node) + print(node + ":") ret, log = log_os_system("cat " + node + "| " + hex_cmd + " -C", 1) if ret == 0: - print log + print(log) else: - print "**********device no found**********" + print("**********device no found**********") return @@ -602,10 +611,10 @@ def set_device(args): node = node.replace(node.split("/")[-1], 'fan_duty_cycle_percentage') ret, log = log_os_system("cat " + node, 1) if ret == 0: - print ("Previous fan duty: " + log.strip() + "%") + print(("Previous fan duty: " + log.strip() + "%")) ret, log = log_os_system("echo " + args[1] + " >" + node, 1) if ret == 0: - print ("Current fan duty: " + args[1] + "%") + print(("Current fan duty: " + args[1] + "%")) return ret elif args[0] == 'sfp': if int(args[1]) > DEVICE_NO[args[0]] or int(args[1]) < DEVICE_NO[args[0]]-1: #33-34 @@ -649,24 +658,24 @@ def device_traversal(): devices_info() for i in sorted(ALL_DEVICE.keys()): print("============================================") - print(i.upper() + ": ") + print((i.upper() + ": ")) print("============================================") - for j in sorted(ALL_DEVICE[i].keys(), key=get_value): - print " " + j + ":", + for j in sorted(list(ALL_DEVICE[i].keys()), key=get_value): + print(" " + j + ":", end=' ') for k in (ALL_DEVICE[i][j]): ret, log = log_os_system("cat " + k, 0) func = k.split("/")[-1].strip() func = re.sub(j + '_', '', func, 1) func = re.sub(i.lower() + '_', '', func, 1) if ret == 0: - print func + "=" + log + " ", + print(func + "=" + log + " ", end=' ') else: - print func + "=" + "X" + " ", - print + print(func + "=" + "X" + " ", end=' ') + print() print("----------------------------------------------------------------") - print + print() return diff --git a/platform/broadcom/sonic-platform-modules-accton/common/modules/ym2651y.c b/platform/broadcom/sonic-platform-modules-accton/common/modules/ym2651y.c index 5834b1d4ef8b..20cef5d61a38 100755 --- a/platform/broadcom/sonic-platform-modules-accton/common/modules/ym2651y.c +++ b/platform/broadcom/sonic-platform-modules-accton/common/modules/ym2651y.c @@ -42,7 +42,8 @@ enum chips { YM2651, YM2401, YM2851, - YPEB1200AM + YM1401A, + YPEB1200AM }; /* Each client has this additional data @@ -66,8 +67,9 @@ struct ym2651y_data { u16 fan_duty_cycle[2]; /* Register value */ u8 fan_dir[4]; /* Register value */ u8 pmbus_revision; /* Register value */ + u8 mfr_serial[21]; /* Register value */ u8 mfr_id[10]; /* Register value */ - u8 mfr_model[10]; /* Register value */ + u8 mfr_model[16]; /* Register value */ u8 mfr_revsion[3]; /* Register value */ u16 mfr_vin_min; /* Register value */ u16 mfr_vin_max; /* Register value */ @@ -113,9 +115,11 @@ enum ym2651y_sysfs_attributes { PSU_FAN1_SPEED, PSU_FAN1_DUTY_CYCLE, PSU_PMBUS_REVISION, + PSU_SERIAL_NUM, PSU_MFR_ID, PSU_MFR_MODEL, PSU_MFR_REVISION, + PSU_MFR_SERIAL, PSU_MFR_VIN_MIN, PSU_MFR_VIN_MAX, PSU_MFR_VOUT_MIN, @@ -141,9 +145,11 @@ static SENSOR_DEVICE_ATTR(psu_fan1_speed_rpm, S_IRUGO, show_linear, NULL, PSU_FA static SENSOR_DEVICE_ATTR(psu_fan1_duty_cycle_percentage, S_IWUSR | S_IRUGO, show_linear, set_fan_duty_cycle, PSU_FAN1_DUTY_CYCLE); static SENSOR_DEVICE_ATTR(psu_fan_dir, S_IRUGO, show_ascii, NULL, PSU_FAN_DIRECTION); static SENSOR_DEVICE_ATTR(psu_pmbus_revision, S_IRUGO, show_byte, NULL, PSU_PMBUS_REVISION); +static SENSOR_DEVICE_ATTR(psu_serial_num, S_IRUGO, show_ascii, NULL, PSU_SERIAL_NUM); static SENSOR_DEVICE_ATTR(psu_mfr_id, S_IRUGO, show_ascii, NULL, PSU_MFR_ID); static SENSOR_DEVICE_ATTR(psu_mfr_model, S_IRUGO, show_ascii, NULL, PSU_MFR_MODEL); static SENSOR_DEVICE_ATTR(psu_mfr_revision, S_IRUGO, show_ascii, NULL, PSU_MFR_REVISION); +static SENSOR_DEVICE_ATTR(psu_mfr_serial, S_IRUGO, show_ascii, NULL, PSU_MFR_SERIAL); static SENSOR_DEVICE_ATTR(psu_mfr_vin_min, S_IRUGO, show_linear, NULL, PSU_MFR_VIN_MIN); static SENSOR_DEVICE_ATTR(psu_mfr_vin_max, S_IRUGO, show_linear, NULL, PSU_MFR_VIN_MAX); static SENSOR_DEVICE_ATTR(psu_mfr_vout_min, S_IRUGO, show_linear, NULL, PSU_MFR_VOUT_MIN); @@ -175,9 +181,11 @@ static struct attribute *ym2651y_attributes[] = { &sensor_dev_attr_psu_fan1_duty_cycle_percentage.dev_attr.attr, &sensor_dev_attr_psu_fan_dir.dev_attr.attr, &sensor_dev_attr_psu_pmbus_revision.dev_attr.attr, + &sensor_dev_attr_psu_serial_num.dev_attr.attr, &sensor_dev_attr_psu_mfr_id.dev_attr.attr, &sensor_dev_attr_psu_mfr_model.dev_attr.attr, &sensor_dev_attr_psu_mfr_revision.dev_attr.attr, + &sensor_dev_attr_psu_mfr_serial.dev_attr.attr, &sensor_dev_attr_psu_mfr_vin_min.dev_attr.attr, &sensor_dev_attr_psu_mfr_vin_max.dev_attr.attr, &sensor_dev_attr_psu_mfr_pout_max.dev_attr.attr, @@ -362,14 +370,17 @@ static ssize_t show_ascii(struct device *dev, struct device_attribute *da, } ptr = data->fan_dir; break; + case PSU_MFR_SERIAL: /* psu_mfr_serial */ + ptr = data->mfr_serial+1; /* The first byte is the count byte of string. */ + break; case PSU_MFR_ID: /* psu_mfr_id */ - ptr = data->mfr_id; + ptr = data->mfr_id+1; /* The first byte is the count byte of string. */ break; case PSU_MFR_MODEL: /* psu_mfr_model */ - ptr = data->mfr_model; + ptr = data->mfr_model+1; /* The first byte is the count byte of string. */ break; case PSU_MFR_REVISION: /* psu_mfr_revision */ - ptr = data->mfr_revsion; + ptr = data->mfr_revsion+1; break; default: return 0; @@ -415,7 +426,7 @@ static ssize_t show_vout(struct device *dev, struct device_attribute *da, struct i2c_client *client = to_i2c_client(dev); struct ym2651y_data *data = i2c_get_clientdata(client); - if (data->chip == YM2401) { + if (data->chip == YM2401 || data->chip==YM1401A) { return show_vout_by_mode(dev, da, buf); } else { @@ -493,6 +504,7 @@ static const struct i2c_device_id ym2651y_id[] = { { "ym2651", YM2651 }, { "ym2401", YM2401 }, { "ym2851", YM2851 }, + { "ym1401a",YM1401A}, { "ype1200am", YPEB1200AM }, {} }; @@ -561,8 +573,8 @@ static struct ym2651y_data *ym2651y_update_device(struct device *dev) if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || !data->valid) { - int i, status; - u8 command; + int i, status, length; + u8 command, buf; u8 fan_dir[5] = {0}; struct reg_data_byte regs_byte[] = { {0x19, &data->capability}, {0x20, &data->vout_mode}, @@ -599,6 +611,7 @@ static struct ym2651y_data *ym2651y_update_device(struct device *dev) dev_dbg(&client->dev, "reg %d, err %d\n", regs_byte[i].reg, status); *(regs_byte[i].value) = 0; + goto exit; } else { *(regs_byte[i].value) = status; @@ -614,6 +627,7 @@ static struct ym2651y_data *ym2651y_update_device(struct device *dev) dev_dbg(&client->dev, "reg %d, err %d\n", regs_word[i].reg, status); *(regs_word[i].value) = 0; + goto exit; } else { *(regs_word[i].value) = status; @@ -626,6 +640,7 @@ static struct ym2651y_data *ym2651y_update_device(struct device *dev) if (status < 0) { dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + goto exit; } strncpy(data->fan_dir, fan_dir+1, ARRAY_SIZE(data->fan_dir)-1); @@ -642,12 +657,61 @@ static struct ym2651y_data *ym2651y_update_device(struct device *dev) /* Read mfr_model */ command = 0x9a; - status = ym2651y_read_block(client, command, data->mfr_model, - ARRAY_SIZE(data->mfr_model)-1); - data->mfr_model[ARRAY_SIZE(data->mfr_model)-1] = '\0'; + length = 1; + /* Read first byte to determine the length of data */ + status = ym2651y_read_block(client, command, &buf, length); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + goto exit; + } + status = ym2651y_read_block(client, command, data->mfr_model, buf+1); + + if ((buf+1) >= (ARRAY_SIZE(data->mfr_model)-1)) + { + data->mfr_model[ARRAY_SIZE(data->mfr_model)-1] = '\0'; + } + else + data->mfr_model[buf+1] = '\0'; if (status < 0) + { dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + goto exit; + } + + /*YM-1401A PSU doens't support to get serial_num, so ignore it. + *It's vout doesn't support linear, so let it use show_vout_by_mode(). + */ + if(!strncmp("YM-1401A", data->mfr_model+1, strlen("YM-1401A"))) + { + data->chip=YM1401A; + } + else + { + /* Read mfr_serial */ + command = 0x9e; + length = 1; + /* Read first byte to determine the length of data */ + status = ym2651y_read_block(client, command, &buf, length); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + goto exit; + } + status = ym2651y_read_block(client, command, data->mfr_serial, buf+1); + + if ((buf+1) >= (ARRAY_SIZE(data->mfr_serial)-1)) + { + data->mfr_serial[ARRAY_SIZE(data->mfr_serial)-1] = '\0'; + } + else + data->mfr_serial[buf+1] = '\0'; + + if (status < 0) + { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + goto exit; + } + } /* Read mfr_revsion */ command = 0x9b; @@ -656,12 +720,16 @@ static struct ym2651y_data *ym2651y_update_device(struct device *dev) data->mfr_revsion[ARRAY_SIZE(data->mfr_revsion)-1] = '\0'; if (status < 0) + { dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + goto exit; + } data->last_updated = jiffies; data->valid = 1; } + exit: mutex_unlock(&data->update_lock); return data; diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/rules b/platform/broadcom/sonic-platform-modules-accton/debian/rules index 826a3217dc86..8cd7611bb6e3 100755 --- a/platform/broadcom/sonic-platform-modules-accton/debian/rules +++ b/platform/broadcom/sonic-platform-modules-accton/debian/rules @@ -13,7 +13,6 @@ include /usr/share/dpkg/pkg-info.mk export INSTALL_MOD_DIR:=extra -PYTHON ?= python2 PYTHON3 ?= python3 PACKAGE_PRE_NAME := sonic-platform-accton @@ -29,7 +28,7 @@ SERVICE_DIR := service CONF_DIR := conf %: - dh $@ --with systemd,python2,python3 --buildsystem=pybuild + dh $@ --with systemd,python3 --buildsystem=pybuild clean: dh_testdir @@ -40,7 +39,7 @@ build: #make modules -C $(KERNEL_SRC)/build M=$(MODULE_SRC) (for mod in $(MODULE_DIRS); do \ make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ - $(PYTHON) $${mod}/setup.py build; \ + $(PYTHON3) $${mod}/setup.py build; \ cd $(MOD_SRC_DIR)/$${mod}; \ if [ -f sonic_platform_setup.py ]; then \ $(PYTHON3) sonic_platform_setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}; \ @@ -73,7 +72,7 @@ binary-indep: cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \ cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \ - $(PYTHON) $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \ + $(PYTHON3) $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \ done) # Resuming debhelper scripts dh_testroot diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.install b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.install new file mode 100644 index 000000000000..4ba26bed2625 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.install @@ -0,0 +1 @@ +as4630-54pe/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-accton_as4630_54pe-r0/pddf diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.postinst b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.postinst new file mode 100644 index 000000000000..23bebd3b295c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.postinst @@ -0,0 +1,8 @@ +# Special arrangement to make PDDF mode default +# Disable monitor, monitor-fan, monitor-psu (not enabling them would imply they will be disabled by default) +# Enable pddf-platform-monitor +depmod -a +systemctl enable pddf-platform-init.service +systemctl start pddf-platform-init.service +systemctl enable as4630-54pe-pddf-platform-monitor.service +systemctl start as4630-54pe-pddf-platform-monitor.service diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7326-56x.postinst b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7326-56x.postinst index 94fd9cf67df8..035f07e57165 100644 --- a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7326-56x.postinst +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7326-56x.postinst @@ -2,24 +2,6 @@ # Disable monitor, monitor-fan, monitor-psu (not enabling them would imply they will be disabled by default) # Enable pddf-platform-monitor -# Steps to check syseeprom i2c address -modprobe i2c-i801 -modprobe i2c-dev -use_57_eeprom=true -(i2cget -y -f 0 0x56 0x0) > /dev/null 2>&1 -if [ $? -eq 0 ]; then - use_57_eeprom=false -fi - -if $use_57_eeprom ; then - echo "The board has system EEPROM at I2C address 0x57" - # syseeprom is at the i2c address 0x57. Change the PDDF JSON file - sed -i 's@"topo_info": {"parent_bus": "0x0", "dev_addr": "0x56", "dev_type": "24c04"},@\ - "topo_info": {"parent_bus": "0x0", "dev_addr": "0x57", "dev_type": "24c02"},@g' \ - /usr/share/sonic/device/x86_64-accton_as7326_56x-r0/pddf/pddf-device.json - sync -fi - depmod -a systemctl enable as7326-platform-handle_mac.service systemctl start as7326-platform-handle_mac.service diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7712-32x.install b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7712-32x.install new file mode 100644 index 000000000000..7236da0e9aec --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7712-32x.install @@ -0,0 +1 @@ +as7712-32x/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-accton_as7712_32x-r0/pddf diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7712-32x.postinst b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7712-32x.postinst new file mode 100644 index 000000000000..4a393ec7035a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7712-32x.postinst @@ -0,0 +1,8 @@ +# Special arrangement to make PDDF mode default +# Disable monitor, monitor-fan, monitor-psu (not enabling them would imply they will be disabled by default) +# Enable pddf-platform-monitor +depmod -a +systemctl enable pddf-platform-init.service +systemctl start pddf-platform-init.service +systemctl enable as7712-pddf-platform-monitor.service +systemctl start as7712-pddf-platform-monitor.service diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7726-32x.postinst b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7726-32x.postinst index efe159144770..b1c403623c95 100644 --- a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7726-32x.postinst +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7726-32x.postinst @@ -2,6 +2,8 @@ # Disable monitor, monitor-fan, monitor-psu (not enabling them would imply they will be disabled by default) # Enable pddf-platform-monitor depmod -a +systemctl enable as7726-32x-platform-handle_mac.service +systemctl start as7726-32x-platform-handle_mac.service systemctl enable pddf-platform-init.service systemctl start pddf-platform-init.service systemctl enable as7726-32x-pddf-platform-monitor.service diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7816-64x.postinst b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7816-64x.postinst index 4757a3cce27c..872ef60f26f5 100644 --- a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7816-64x.postinst +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7816-64x.postinst @@ -2,153 +2,6 @@ # Disable monitor, monitor-fan, monitor-psu (not enabling them would imply they will be disabled by default) # Enable pddf-platform-monitor -# Steps to check syseeprom i2c address -modprobe i2c-i801 -modprobe i2c-dev -at_id=false - -(i2cset -y -f 0 0x77 0x1) > /dev/null 2>&1 -(i2cset -y -f 0 0x76 0x4) > /dev/null 2>&1 - - -(i2cget -y -f 0 0x60 0xfd) > /dev/null 2>&1 -if [ $? -eq 0 ]; then - echo "get at_id" - - at_1=$(i2cget -y -f 0 0x60 0xfd) - - if [ ${at_1} = '0x41' ]; then - echo "get at_1 is 0x41" - at_2=$(i2cget -y -f 0 0x60 0xfe) - - if [ ${at_2} = '0x54' ]; then - echo "get at_2 is 0x54" - at_id=true - fi - fi - -else - cpld_id=$(i2cget -y -f 1 0x60 0x1) #This CPD version that not support to record at_id - if [ ${cpld_id} = '0x5' ]; then - at_id=true - fi -fi - -if $at_id ; then - echo "This CPLD is for AT used PSU" - echo "PSU-1 pmbus use parent_bus:0x9, dev_addr:0x58" - echo "PSU-1 eeprom use parent_bus:0x9, dev_addr:0x50" - echo "PSU-2 pmbus use parent_bus:0xa, dev_addr:0x5b" - echo "PSU-2 eeprom use parent_bus:0xa, dev_addr:0x53" - - #Change the PDDF JSON file - sed -i 's@{ "chn":"0", "dev":"PSU2"},@\ - { "chn":"0", "dev":"PSU1" },@g' \ - /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json - sync - sed -i 's@{ "chn":"1", "dev":"PSU1"}@\ - { "chn":"1", "dev":"PSU2" }@g' \ - /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json - sync - - sed -i 's@"topo_info":{ "parent_bus":"0xa", "dev_addr":"0x5b", "dev_type":"psu_pmbus"},@\ - "topo_info": {"parent_bus":"0x9", "dev_addr":"0x58" , "dev_type": "psu_pmbus" },@g' \ - /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json - sync - sed -i 's@{ "attr_name":"psu_model_name", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10"},@\ - { "attr_name":"psu_model_name", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" },@g' \ - /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json - sync - sed -i 's@{ "attr_name":"psu_mfr_id", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10"},@\ - { "attr_name":"psu_mfr_id", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" },@g' \ - /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json - sync - sed -i 's@{ "attr_name":"psu_fan_dir", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"},@\ - { "attr_name":"psu_fan_dir", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5" },@g' \ - /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json - sync - sed -i 's@{ "attr_name":"psu_v_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ - { "attr_name":"psu_v_out", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ - /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json - sync - sed -i 's@{ "attr_name":"psu_i_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ - { "attr_name":"psu_i_out", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ - /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json - sync - sed -i 's@{ "attr_name":"psu_p_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ - { "attr_name":"psu_p_out", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ - /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json - sync - sed -i 's@{ "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ - { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ - /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json - sync - sed -i 's@{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}@\ - { "attr_name":"psu_temp1_input", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" }@g' \ - /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json - sync - - sed -i 's@"topo_info":{ "parent_bus":"0xa", "dev_addr":"0x53", "dev_type":"psu_eeprom"},@\ - "topo_info": {"parent_bus":"0x9", "dev_addr":"0x50" , "dev_type": "psu_pmbus" },@g' \ - /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json - sync - - - sed -i 's@"topo_info": { "parent_bus":"0x9", "dev_addr":"0x58", "dev_type":"psu_pmbus"},@\ - "topo_info": {"parent_bus":"0xa", "dev_addr":"0x5b", "dev_type": "psu_pmbus" },@g' \ - /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json - sync - - sed -i 's@{ "attr_name":"psu_model_name", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10"},@\ - { "attr_name":"psu_model_name", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" },@g' \ - /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json - sync - - sed -i 's@{ "attr_name":"psu_mfr_id", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10"},@\ - { "attr_name":"psu_mfr_id", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" },@g' \ - /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json - sync - sed -i 's@{ "attr_name":"psu_fan_dir", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"},@\ - { "attr_name":"psu_fan_dir", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5" },@g' \ - /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json - sync - sed -i 's@{ "attr_name":"psu_v_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ - { "attr_name":"psu_v_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ - /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json - sync - sed -i 's@{ "attr_name":"psu_i_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ - { "attr_name":"psu_i_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ - /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json - sync - sed -i 's@{ "attr_name":"psu_p_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ - { "attr_name":"psu_p_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ - /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json - sync - sed -i 's@{ "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\ - { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \ - /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json - sync - sed -i 's@{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}@\ - { "attr_name":"psu_temp1_input", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" }@g' \ - /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json - sync - - sed -i 's@"topo_info":{ "parent_bus":"0x9", "dev_addr":"0x50", "dev_type":"psu_eeprom"},@\ - "topo_info": {"parent_bus":"0xa", "dev_addr":"0x53", "dev_type": "psu_pmbus" },@g' \ - /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json - sync -fi - -(i2cset -y -f 0 0x76 0x0) > /dev/null 2>&1 -(i2cset -y -f 0 0x77 0x0) > /dev/null 2>&1 - - -#For other CPLD that use below -#PSU-1 pmbus use "parent_bus":"0x21", "dev_addr":"0x5b" -#PSU-1 eeprom use "parent_bus":"0x21", "dev_addr":"0x53" -#PSU-2 pmbus use "parent_bus":"0x20", "dev_addr":"0x58" -#PSU-2 eeprom use "parent_bus":"0x20", "dev_addr":"0x50" - depmod -a systemctl enable pddf-platform-init.service systemctl start pddf-platform-init.service diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as9716-32d.postinst b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as9716-32d.postinst index 7c3d8822693e..e0905718a849 100644 --- a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as9716-32d.postinst +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as9716-32d.postinst @@ -2,25 +2,8 @@ # Disable monitor, monitor-fan, monitor-psu (not enabling them would imply they will be disabled by default) # Enable pddf-platform-monitor -# Steps to check syseeprom i2c address -modprobe i2c-i801 -modprobe i2c-dev -use_57_eeprom=false -(i2cget -y -f 0 0x57 0x0) > /dev/null 2>&1 -if [ $? -eq 0 ]; then - use_57_eeprom=true -fi - -if $use_57_eeprom ; then - echo "The board has system EEPROM at I2C address 0x57" - # syseeprom is at the i2c address 0x57. Change the PDDF JSON file - sed -i 's@"topo_info": {"parent_bus": "0x0", "dev_addr": "0x56", "dev_type": "24c02"},@\ - "topo_info": {"parent_bus": "0x0", "dev_addr": "0x57", "dev_type": "24c02"},@g' \ - /usr/share/sonic/device/x86_64-accton_as9716_32d-r0/pddf/pddf-device.json - sync -fi - depmod -a +#systemctl daemon-reload systemctl enable pddf-platform-init.service systemctl start pddf-platform-init.service systemctl enable as9716-32d-pddf-platform-monitor.service diff --git a/platform/broadcom/sonic-platform-modules-accton/minipack/classes/pimutil.py b/platform/broadcom/sonic-platform-modules-accton/minipack/classes/pimutil.py index 778ff76afd19..05b68202be3c 100755 --- a/platform/broadcom/sonic-platform-modules-accton/minipack/classes/pimutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/minipack/classes/pimutil.py @@ -176,9 +176,9 @@ def show_qsfp_present_status(pim_num): interrupt = fpga_io(dom_base[pim_num]+dom["qsfp_present_intr"]) mask = fpga_io(dom_base[pim_num]+dom["qsfp_present_intr_mask"]) - print + print() print(" (0x48) (0x50) (0x58)") - print(" 0x%08X 0x%08X 0x%08X" %(status, interrupt, mask)) + print((" 0x%08X 0x%08X 0x%08X" %(status, interrupt, mask))) print(" Status Interrupt Mask") for row in range(8): output_str = str() @@ -188,11 +188,11 @@ def show_qsfp_present_status(pim_num): interrupt_right = bool(interrupt & (0x2 << row*2)) mask_left = bool(mask & (0x1 << row*2)) mask_right = bool(mask & (0x2 << row*2)) - print("%2d: %d %d %d %d %d %d" % \ + print(("%2d: %d %d %d %d %d %d" % \ (row*2+1, status_left, status_right, \ interrupt_left, interrupt_right, \ - mask_left, mask_right)) - print + mask_left, mask_right))) + print() @@ -319,13 +319,13 @@ def get_pim_change_event(self, timeout=0): elif timeout > 0: timeout = timeout / float(1000) # Convert to secs else: - print "get_transceiver_change_event:Invalid timeout value", timeout + print("get_transceiver_change_event:Invalid timeout value", timeout) return False, {} end_time = start_time + timeout if start_time > end_time: - print 'get_transceiver_change_event:' \ - 'time wrap / invalid timeout value', timeout + print('get_transceiver_change_event:' \ + 'time wrap / invalid timeout value', timeout) return False, {} # Time wrap or possibly incorrect timeout @@ -361,7 +361,7 @@ def get_pim_change_event(self, timeout=0): if timeout > 0: time.sleep(timeout) return True, {} - print "get_evt_change_event: Should not reach here." + print("get_evt_change_event: Should not reach here.") return False, {} @@ -382,7 +382,7 @@ def set_pim_led(self, pim_num, color, control): elif color==0: led_val = (led_val & ( ~ 0x8000)) | 0x4000 #amber else: - print "Set RGB control to Green1" + print("Set RGB control to Green1") led_val = led_val & (~ 0x4000) led_val = led_val & (~ 0xfff) led_val = led_val | 0x0f0 #B.G.R Birghtness, set to Green @@ -547,30 +547,30 @@ def get_port_led(self, port_num): elif color==0x1C: color=4 #green - print "color=%d, control=%d"%(color, control) + print("color=%d, control=%d"%(color, control)) return color, control def main(argv): init_resources() pim=PimUtil() - print "Test Board ID" + print("Test Board ID") for x in range(0,8): val=pim.get_pim_board_id(x) - print "pim=%d"%x + print("pim=%d"%x) if val==0: - print "100G board" + print("100G board") else: - print "400G board" + print("400G board") - print "Test pim presence" + print("Test pim presence") for x in range(0,8): pres=pim.get_pim_presence(x) - print "pim=%d, presence=%d"%(x, pres) + print("pim=%d, presence=%d"%(x, pres)) - print "Test pim status" + print("Test pim status") for x in range(0,8): power_status=pim.get_pim_status(x) - print "pim=%d power_status=0x%x"%(x, power_status) + print("pim=%d power_status=0x%x"%(x, power_status)) release_resources() diff --git a/platform/broadcom/sonic-platform-modules-accton/minipack/utils/accton_minipack_util.py b/platform/broadcom/sonic-platform-modules-accton/minipack/utils/accton_minipack_util.py index 25979963bb30..7e512ac4c60b 100755 --- a/platform/broadcom/sonic-platform-modules-accton/minipack/utils/accton_minipack_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/minipack/utils/accton_minipack_util.py @@ -37,7 +37,7 @@ set : change board setting with led|sfp """ -import commands +import subprocess import getopt import sys import logging @@ -86,8 +86,8 @@ if DEBUG == True: - print sys.argv[0] - print 'ARGV :', sys.argv[1:] + print(sys.argv[0]) + print('ARGV :', sys.argv[1:]) def main(): @@ -103,9 +103,9 @@ def main(): 'force', ]) if DEBUG == True: - print options - print args - print len(sys.argv) + print(options) + print(args) + print(len(sys.argv)) for opt, arg in options: if opt in ('-h', '--help'): @@ -146,38 +146,38 @@ def main(): return 0 def show_help(): - print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + print(__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) sys.exit(0) def show_set_help(): cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print cmd +" [led|sfp]" - print " use \""+ cmd + " led 0-4 \" to set led color" - print " use \""+ cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable" + print(cmd +" [led|sfp]") + print(" use \""+ cmd + " led 0-4 \" to set led color") + print(" use \""+ cmd + " sfp 1-32 {0|1}\" to set sfp# tx_disable") sys.exit(0) def show_eeprom_help(): cmd = sys.argv[0].split("/")[-1]+ " " + args[0] - print " use \""+ cmd + " 1-54 \" to dump sfp# eeprom" + print(" use \""+ cmd + " 1-54 \" to dump sfp# eeprom") sys.exit(0) def my_log(txt): if DEBUG == True: - print "[ACCTON DBG]: "+txt + print("[ACCTON DBG]: "+txt) return def log_os_system(cmd, show): logging.info('Run :'+cmd) status = 1 output = "" - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) my_log (cmd +"with result:" + str(status)) my_log ("cmd:" + cmd) my_log (" output:"+output) if status: logging.info('Failed :'+cmd) if show: - print('Failed :'+cmd) + print(('Failed :'+cmd)) return status, output def driver_inserted(): @@ -243,7 +243,7 @@ def device_install(): status, output = log_os_system(mknod[i], 1) if status: - print output + print(output) if FORCE == 0: return status @@ -263,7 +263,7 @@ def device_uninstall(): temp[-1] = temp[-1].replace('new_device', 'delete_device') status, output = log_os_system(" ".join(temp), 1) if status: - print output + print(output) if FORCE == 0: return status @@ -277,40 +277,40 @@ def system_ready(): return True def do_install(): - print "Checking system...." + print("Checking system....") if driver_inserted() == False: - print "No driver, installing...." + print("No driver, installing....") status = driver_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" drivers detected...." + print(PROJECT_NAME.upper()+" drivers detected....") if not device_exist(): - print "No device, installing...." + print("No device, installing....") status = device_install() if status: if FORCE == 0: return status else: - print PROJECT_NAME.upper()+" devices detected...." + print(PROJECT_NAME.upper()+" devices detected....") return def do_uninstall(): - print "Checking system...." + print("Checking system....") if not device_exist(): - print PROJECT_NAME.upper() +" has no device installed...." + print(PROJECT_NAME.upper() +" has no device installed....") else: - print "Removing device...." + print("Removing device....") status = device_uninstall() if status: if FORCE == 0: return status if driver_inserted()== False : - print PROJECT_NAME.upper() +" has no driver installed...." + print(PROJECT_NAME.upper() +" has no driver installed....") else: - print "Removing installed driver...." + print("Removing installed driver....") status = driver_uninstall() if status: if FORCE == 0: @@ -358,11 +358,11 @@ def devices_info(): #show dict all in the order if DEBUG == True: for i in sorted(ALL_DEVICE.keys()): - print(i+": ") + print((i+": ")) for j in sorted(ALL_DEVICE[i].keys()): - print(" "+j) + print((" "+j)) for k in (ALL_DEVICE[i][j]): - print(" "+" "+k) + print((" "+" "+k)) return def show_eeprom(index): @@ -385,15 +385,15 @@ def show_eeprom(index): else: log = 'Failed : no hexdump cmd!!' logging.info(log) - print log + print(log) return 1 - print node + ":" + print(node + ":") ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) if ret==0: - print log + print(log) else: - print "**********device no found**********" + print("**********device no found**********") return def set_device(args): @@ -455,25 +455,25 @@ def device_traversal(): devices_info() for i in sorted(ALL_DEVICE.keys()): print("============================================") - print(i.upper()+": ") + print((i.upper()+": ")) print("============================================") - for j in sorted(ALL_DEVICE[i].keys(), key=get_value): - print " "+j+":", + for j in sorted(list(ALL_DEVICE[i].keys()), key=get_value): + print(" "+j+":", end=' ') for k in (ALL_DEVICE[i][j]): ret, log = log_os_system("cat "+k, 0) func = k.split("/")[-1].strip() func = re.sub(j+'_','',func,1) func = re.sub(i.lower()+'_','',func,1) if ret==0: - print func+"="+log+" ", + print(func+"="+log+" ", end=' ') else: - print func+"="+"X"+" ", - print + print(func+"="+"X"+" ", end=' ') + print() print("----------------------------------------------------------------") - print + print() return def device_exist(): diff --git a/platform/broadcom/sonic-platform-modules-accton/minipack/utils/setup_qsfp_eeprom.py b/platform/broadcom/sonic-platform-modules-accton/minipack/utils/setup_qsfp_eeprom.py index 257bc1cd90e6..5ef6a4107e35 100755 --- a/platform/broadcom/sonic-platform-modules-accton/minipack/utils/setup_qsfp_eeprom.py +++ b/platform/broadcom/sonic-platform-modules-accton/minipack/utils/setup_qsfp_eeprom.py @@ -21,13 +21,9 @@ # ------------------------------------------------------------------ try: - import os import getopt import sys import subprocess - import click - import imp - import commands import logging import logging.config import logging.handlers @@ -72,14 +68,14 @@ def my_log(txt): if DEBUG == True: - print "[ACCTON DBG]: "+txt + print("[ACCTON DBG]: "+txt) return def log_os_system(cmd): logging.info('Run :'+cmd) status = 1 output = "" - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) if status: logging.info('Failed :'+cmd) return status, output @@ -123,7 +119,7 @@ def qsfp_eeprom_sys(pim_idx, i2c_bus_order, create): status, output =log_os_system( "echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-"+str(bus)+"/new_device") if status: - print output + print(output) return 1 status, output =log_os_system( "echo port"+str(k+1)+" > /sys/bus/i2c/devices/"+str(bus)+"-0050/port_name") @@ -131,13 +127,13 @@ def qsfp_eeprom_sys(pim_idx, i2c_bus_order, create): status, output =log_os_system( "ln -s -f /sys/bus/i2c/devices/"+str(bus)+"-0050/eeprom" + " /usr/local/bin/minipack_qsfp/port" + str(k) + "_eeprom") if status: - print output + print(output) return 1 else: status, output =log_os_system( "echo 0x50 > /sys/bus/i2c/devices/i2c-"+str(bus)+"/delete_device") if status: - print output + print(output) k=k+1 @@ -146,7 +142,7 @@ def qsfp_eeprom_sys(pim_idx, i2c_bus_order, create): def check_pca_active( i2c_addr, bus): cmd = "i2cget -y -f %d 0x%x 0x0" cmd = cmd %(bus, i2c_addr) - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) return status def set_pim_port_use_bus(pim_idx): @@ -178,11 +174,11 @@ def device_remove(): #if ret==0: cmdm= cmd1 % (0x72, bus) - status, output = commands.getstatusoutput(cmdm) - print "Remove %d-0072 i2c device"%bus + status, output = subprocess.getstatusoutput(cmdm) + print("Remove %d-0072 i2c device"%bus) cmdm= cmd1 % (0x71, bus) - status, output = commands.getstatusoutput(cmdm) - print "Remove %d-0071 i2c device"%bus + status, output = subprocess.getstatusoutput(cmdm) + print("Remove %d-0071 i2c device"%bus) cmd="rm -f /usr/local/bin/minipack_qsfp/port*" status, output=log_os_system(cmd) @@ -262,7 +258,7 @@ def manage_pim(self): pim_state[pim_idx]=self.PIM_STATE_INSERT logging.info("pim_state[%d] PIM_STATE_INSERT", pim_idx); else: - print "retry check 100 times for check pca addr" + print("retry check 100 times for check pca addr") del_pim_port_use_bus(pim_idx) else: if pim_state[pim_idx]==self.PIM_STATE_INSERT: @@ -280,11 +276,11 @@ def main(argv): try: opts, args = getopt.getopt(argv,'hdlr',['lfile=']) except getopt.GetoptError: - print 'A:Usage: %s [-d] [-l ]' % sys.argv[0] + print('A:Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 for opt, arg in opts: if opt == '-h': - print 'B:Usage: %s [-d] [-l ]' % sys.argv[0] + print('B:Usage: %s [-d] [-l ]' % sys.argv[0]) return 0 elif opt in ('-d', '--debug'): log_level = logging.DEBUG @@ -305,7 +301,7 @@ def main(argv): time.sleep(0.5) if status==0: cpu_pca_i2c_ready=1 - print "Make sure CPU pca i2c device is ready" + print("Make sure CPU pca i2c device is ready") break while True: diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/debian/changelog b/platform/broadcom/sonic-platform-modules-alphanetworks/debian/changelog index 2742b7c6a416..5088e8217a2c 100644 --- a/platform/broadcom/sonic-platform-modules-alphanetworks/debian/changelog +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/debian/changelog @@ -1,6 +1,6 @@ sonic-alphanetworks-platform-modules (1.0) unstable; urgency=low - * Add support for SNH60A0-320FV2 and SNH60B0_640F. + * Add support for SNH60A0-320FV2, SNH60B0_640F, and SNJ60D0_320F. - -- Alphanetworks Tue, 19 Dec 2017 09:35:58 +0800 + -- Alphanetworks Tue, 14 Sep 2021 14:50:08 +0800 diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/debian/control b/platform/broadcom/sonic-platform-modules-alphanetworks/debian/control index 6535dbb88bb8..0daf71e1dade 100644 --- a/platform/broadcom/sonic-platform-modules-alphanetworks/debian/control +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/debian/control @@ -15,3 +15,8 @@ Architecture: amd64 Depends: linux-image-4.19.0-12-2-amd64-unsigned Description: kernel modules for platform devices such as fan, led, sfp +Package: sonic-platform-alphanetworks-snj60d0-320f +Architecture: amd64 +Depends: linux-image-4.19.0-12-2-amd64-unsigned +Description: kernel modules for platform devices such as fan, led, sfp + diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/debian/rules b/platform/broadcom/sonic-platform-modules-alphanetworks/debian/rules old mode 100755 new mode 100644 index 0d1a588db6bd..d863ef137736 --- a/platform/broadcom/sonic-platform-modules-alphanetworks/debian/rules +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/debian/rules @@ -19,7 +19,7 @@ PACKAGE_PRE_NAME := sonic-platform-alphanetworks KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= snh60a0-320fv2 snh60b0-640f +MODULE_DIRS:= snh60a0-320fv2 snh60b0-640f snj60d0-320f MODULE_DIR := modules UTILS_DIR := utils SERVICE_DIR := service @@ -38,7 +38,14 @@ build: #make modules -C $(KERNEL_SRC)/build M=$(MODULE_SRC) (for mod in $(MODULE_DIRS); do \ make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ - $(PYTHON) $${mod}/setup.py build; \ + cd $(MOD_SRC_DIR)/$${mod}; \ + $(PYTHON) setup.py build; \ + $(PYTHON) setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/utils; \ + if [ $$mod = "snj60d0-320f" ]; then \ + python3 setup.py build; \ + python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/utils; \ + fi; \ + cd $(MOD_SRC_DIR); \ done) binary: binary-arch binary-indep @@ -59,13 +66,21 @@ binary-indep: # Custom package commands (for mod in $(MODULE_DIRS); do \ - dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ - dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin; \ - dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system; \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} usr/local/bin; \ + platform_name=`echo $${mod} | sed "s/-/_/g"`; \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} usr/share/sonic/device/x86_64-alphanetworks_$${platform_name}-r0; \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} lib/systemd/system; \ cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ - cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \ + cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/*.py debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \ + cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/*.whl debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/share/sonic/device/x86_64-alphanetworks_$${platform_name}-r0; \ cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \ - $(PYTHON) $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \ + cd $(MOD_SRC_DIR)/$${mod}; \ + $(PYTHON) setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \ + if [ $$mod = "snj60d0-320f" ]; then \ + python3 setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \ + fi; \ + cd $(MOD_SRC_DIR); \ done) # Resuming debhelper scripts dh_testroot diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/modules/Makefile b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/modules/Makefile new file mode 100644 index 000000000000..cfc4eac8966d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/modules/Makefile @@ -0,0 +1,8 @@ +# obj-m:=accton_as7712_32x_fan.o accton_as7712_32x_sfp.o leds-accton_as7712_32x.o \ +# goreme_system_cpld.o ym2651y.o optoe.o + +obj-m:=snj60d0-320f_i2c_mux_cpld.o snj60d0-320f_fpga.o snj60d0-320f_onie_eeprom.o yesm1300am.o + + +# obj-m:=accton_as7712_32x_fan.o accton_as7712_32x_sfp.o leds-accton_as7712_32x.o \ +# accton_as7712_32x_psu.o accton_i2c_cpld.o ym2651y.o optoe.o diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/modules/snj60d0-320f_fpga.c b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/modules/snj60d0-320f_fpga.c new file mode 100644 index 000000000000..3c80fb61de2d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/modules/snj60d0-320f_fpga.c @@ -0,0 +1,943 @@ +/* + * A hwmon driver for the alphanetworks_snj60d0_320f_fpga + * + * Copyright (C) 2020 Alphanetworks Technology Corporation. + * Robin Chen + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * see + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define DRIVER_NAME "snj60d0_fpga" +#define PSU1_STATUS_REG 0x2 +#define PSU2_STATUS_REG 0x3 +#define FAN_PWM_REG 0x18 + +#define PSU_PRESENT_BIT 0x10 +#define PSU_POWER_BIT 0x20 +#define FAN_DIRECTION_BIT 0x1 +#define FAN_PRESENT_BIT 0x2 +#define FPGA_REVISION_BIT 0xF + +#define FPGA_REVISION_REG 0x0 +#define SYS_LED_REG 0x2D +#define SYS2_LED_REG 0x2E +#define FAN12_LED_REG 0x30 +#define FAN34_LED_REG 0x31 +#define FAN56_LED_REG 0x32 + +#define FAN1_STATUS_REG 0x5 +#define FAN2_STATUS_REG 0x6 +#define FAN3_STATUS_REG 0x7 +#define FAN4_STATUS_REG 0x8 +#define FAN5_STATUS_REG 0x9 +#define FAN6_STATUS_REG 0xA + +#define SYS_RESET1_REG 0x1C +#define SYS_RESET2_REG 0x1D +#define SYS_RESET3_REG 0x1E +//#define SWI_CTRL_REG 0x4 + +#define SYS_LOCATOR_LED_BITS 0x07 +#define SYS_PWR_LED_BITS 0x38 +#define PORT_LED_DISABLE_BITS 0x40 +#define SYS_STATUS_LED_BITS 0x07 +#define SYS_FAN_LED_BITS 0x38 +#define FAN135_LED_BITS 0x07 +#define FAN246_LED_BITS 0x38 +#define REST_BUTTON_BITS 0x0 + +#define SFP_TX_FAULT_REG 0x25 +#define SFP_TX_FAULT_MASK_REG 0x26 +#define SFP_TX_DISABLE_REG 0x27 +#define SFP_PRESENT_REG 0x28 +#define SFP_PRESENT_MASK_REG 0x29 +#define SFP_RX_LOSS_REG 0x2A +#define SFP_RX_LOSS_MASK_REG 0x2B +//#define SWI_CTRL_REG 0x34 + + + + +static ssize_t psu_show_status(struct device *dev, struct device_attribute *attr, char *buf); +static ssize_t fan_pwm_show(struct device *dev, struct device_attribute *attr, char *buf); +static ssize_t set_fan_pwm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); +static ssize_t fpga_version_show(struct device *dev, struct device_attribute *attr, char *buf); + +static ssize_t fan_show_status(struct device *dev, struct device_attribute *attr, char *buf); +static ssize_t fan_show_status_reg(struct device *dev, struct device_attribute *attr, char *buf); + +static ssize_t sys_sfp_read(struct device *dev, struct device_attribute *attr, char *buf); +static ssize_t sys_sfp_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); + +static ssize_t sys_led_read(struct device *dev, struct device_attribute *attr, char *buf); +static ssize_t sys_led_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); + +static LIST_HEAD(fpga_client_list); +static struct mutex list_lock; + +struct fpga_client_node { + struct i2c_client *client; + struct list_head list; +}; + +/* Addresses scanned for alphanetworks_snj60d0_320f_fpga */ +static const unsigned short normal_i2c[] = { 0x5E, I2C_CLIENT_END }; + +struct alphanetworks_snj60d0_320f_pwr_fpga_data { + struct device *hwmon_dev; + struct mutex update_lock; + char model_name[9]; /* Model name, read from eeprom */ +}; + + +enum sysfs_fpga_attributes { + PSU1_PRESENT, + PSU2_PRESENT, + PSU1_POWER_GOOD, + PSU2_POWER_GOOD, + FAN_PWM, + FAN1_PRESENT=0x05, + FAN2_PRESENT, + FAN3_PRESENT, + FAN4_PRESENT, + FAN5_PRESENT, + FAN6_PRESENT, + FAN1_FRONT_SPEED_RPM=0x0b, + FAN1_REAR_SPEED_RPM, + FAN2_FRONT_SPEED_RPM, + FAN2_REAR_SPEED_RPM, + FAN3_FRONT_SPEED_RPM, + FAN3_REAR_SPEED_RPM, + FAN4_FRONT_SPEED_RPM, + FAN4_REAR_SPEED_RPM, + FAN5_FRONT_SPEED_RPM, + FAN5_REAR_SPEED_RPM, + FAN6_FRONT_SPEED_RPM, + FAN6_REAR_SPEED_RPM, + FAN1_FAULT, + FAN2_FAULT, + FAN3_FAULT, + FAN4_FAULT, + FAN5_FAULT, + FAN6_FAULT, + SYS_STATUS, + SYS_PWR, + SYS_FAN, + SYS_LOCATOR, + SFP_TX_FAULT, + SFP_TX_FAULT_MASK, + SFP_TX_DISABLE, + SFP_PRESENT, + SFP_PRESENT_MASK, + SFP_RX_LOSS, + SFP_RX_LOSS_MASK, + FAN1_LED, + FAN2_LED, + FAN3_LED, + FAN4_LED, + FAN5_LED, + FAN6_LED, + SYS_RESET1, + SYS_RESET2, + SYS_RESET3, + PORT_LED_DISABLE, + FAN1_DIRECTION, + FAN2_DIRECTION, + FAN3_DIRECTION, + FAN4_DIRECTION, + FAN5_DIRECTION, + FAN6_DIRECTION, + FPGA_REVISION, +}; + + + + + + +static SENSOR_DEVICE_ATTR(psu1_present, S_IRUGO, psu_show_status, NULL, PSU1_PRESENT); +static SENSOR_DEVICE_ATTR(psu2_present, S_IRUGO, psu_show_status, NULL, PSU2_PRESENT); +static SENSOR_DEVICE_ATTR(psu1_power_good, S_IRUGO, psu_show_status, NULL, PSU1_POWER_GOOD); +static SENSOR_DEVICE_ATTR(psu2_power_good, S_IRUGO, psu_show_status, NULL, PSU2_POWER_GOOD); +static SENSOR_DEVICE_ATTR(fan_pwm, (0660), fan_pwm_show, set_fan_pwm, FAN_PWM); +static SENSOR_DEVICE_ATTR(fpga_revision, (0660), fpga_version_show, NULL, FPGA_REVISION); +static SENSOR_DEVICE_ATTR(fan1_present, S_IRUGO, fan_show_status_reg, NULL, FAN1_PRESENT); +static SENSOR_DEVICE_ATTR(fan2_present, S_IRUGO, fan_show_status_reg, NULL, FAN2_PRESENT); +static SENSOR_DEVICE_ATTR(fan3_present, S_IRUGO, fan_show_status_reg, NULL, FAN3_PRESENT); +static SENSOR_DEVICE_ATTR(fan4_present, S_IRUGO, fan_show_status_reg, NULL, FAN4_PRESENT); +static SENSOR_DEVICE_ATTR(fan5_present, S_IRUGO, fan_show_status_reg, NULL, FAN5_PRESENT); +static SENSOR_DEVICE_ATTR(fan6_present, S_IRUGO, fan_show_status_reg, NULL, FAN6_PRESENT); +static SENSOR_DEVICE_ATTR(fan1_direction, S_IRUGO, fan_show_status_reg, NULL, FAN1_DIRECTION); +static SENSOR_DEVICE_ATTR(fan2_direction, S_IRUGO, fan_show_status_reg, NULL, FAN2_DIRECTION); +static SENSOR_DEVICE_ATTR(fan3_direction, S_IRUGO, fan_show_status_reg, NULL, FAN3_DIRECTION); +static SENSOR_DEVICE_ATTR(fan4_direction, S_IRUGO, fan_show_status_reg, NULL, FAN4_DIRECTION); +static SENSOR_DEVICE_ATTR(fan5_direction, S_IRUGO, fan_show_status_reg, NULL, FAN5_DIRECTION); +static SENSOR_DEVICE_ATTR(fan6_direction, S_IRUGO, fan_show_status_reg, NULL, FAN6_DIRECTION); +static SENSOR_DEVICE_ATTR(fan1_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN1_FRONT_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan2_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN2_FRONT_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan3_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN3_FRONT_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan4_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN4_FRONT_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan5_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN5_FRONT_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan6_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN6_FRONT_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan1_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN1_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan2_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN2_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan3_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN3_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan4_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN4_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan5_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN5_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan6_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN6_REAR_SPEED_RPM); + +static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, fan_show_status, NULL, FAN1_FAULT); static SENSOR_DEVICE_ATTR(fan11_fault, S_IRUGO, fan_show_status, NULL, FAN1_FAULT); +static SENSOR_DEVICE_ATTR(fan2_fault, S_IRUGO, fan_show_status, NULL, FAN2_FAULT); static SENSOR_DEVICE_ATTR(fan12_fault, S_IRUGO, fan_show_status, NULL, FAN2_FAULT); +static SENSOR_DEVICE_ATTR(fan3_fault, S_IRUGO, fan_show_status, NULL, FAN3_FAULT); static SENSOR_DEVICE_ATTR(fan13_fault, S_IRUGO, fan_show_status, NULL, FAN3_FAULT); +static SENSOR_DEVICE_ATTR(fan4_fault, S_IRUGO, fan_show_status, NULL, FAN4_FAULT); static SENSOR_DEVICE_ATTR(fan14_fault, S_IRUGO, fan_show_status, NULL, FAN4_FAULT); +static SENSOR_DEVICE_ATTR(fan5_fault, S_IRUGO, fan_show_status, NULL, FAN5_FAULT); static SENSOR_DEVICE_ATTR(fan15_fault, S_IRUGO, fan_show_status, NULL, FAN5_FAULT); +static SENSOR_DEVICE_ATTR(fan6_fault, S_IRUGO, fan_show_status, NULL, FAN6_FAULT); static SENSOR_DEVICE_ATTR(fan16_fault, S_IRUGO, fan_show_status, NULL, FAN6_FAULT); +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, fan_show_status, NULL, FAN1_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan11_input, S_IRUGO, fan_show_status, NULL, FAN1_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, fan_show_status, NULL, FAN2_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan12_input, S_IRUGO, fan_show_status, NULL, FAN2_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, fan_show_status, NULL, FAN3_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan13_input, S_IRUGO, fan_show_status, NULL, FAN3_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, fan_show_status, NULL, FAN4_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan14_input, S_IRUGO, fan_show_status, NULL, FAN4_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO, fan_show_status, NULL, FAN5_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan15_input, S_IRUGO, fan_show_status, NULL, FAN5_REAR_SPEED_RPM); +static SENSOR_DEVICE_ATTR(fan6_input, S_IRUGO, fan_show_status, NULL, FAN6_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan16_input, S_IRUGO, fan_show_status, NULL, FAN6_REAR_SPEED_RPM); + +static SENSOR_DEVICE_ATTR(sys_status, (0600), sys_led_read, sys_led_write, SYS_STATUS); +static SENSOR_DEVICE_ATTR(port_led_disable, (0660), sys_led_read, sys_led_write, PORT_LED_DISABLE); +static SENSOR_DEVICE_ATTR(sys_pwr, (0660), sys_led_read, sys_led_write, SYS_PWR); +static SENSOR_DEVICE_ATTR(sys_locator, (0660), sys_led_read, sys_led_write, SYS_LOCATOR); +static SENSOR_DEVICE_ATTR(fan1_led, (0660), sys_led_read, sys_led_write, FAN1_LED); +static SENSOR_DEVICE_ATTR(fan2_led, (0660), sys_led_read, sys_led_write, FAN2_LED); +static SENSOR_DEVICE_ATTR(fan3_led, (0660), sys_led_read, sys_led_write, FAN3_LED); +static SENSOR_DEVICE_ATTR(fan4_led, (0660), sys_led_read, sys_led_write, FAN4_LED); +static SENSOR_DEVICE_ATTR(fan5_led, (0660), sys_led_read, sys_led_write, FAN5_LED); +static SENSOR_DEVICE_ATTR(fan6_led, (0660), sys_led_read, sys_led_write, FAN6_LED); +static SENSOR_DEVICE_ATTR(sys_reset1, (0660), sys_led_read, sys_led_write, SYS_RESET1); +static SENSOR_DEVICE_ATTR(sys_reset2, (0660), sys_led_read, sys_led_write, SYS_RESET2); +static SENSOR_DEVICE_ATTR(sys_reset3, (0660), sys_led_read, sys_led_write, SYS_RESET3); + +static SENSOR_DEVICE_ATTR(sfp_tx_fault, (0660), sys_sfp_read, sys_sfp_write, SFP_TX_FAULT); +static SENSOR_DEVICE_ATTR(sfp_tx_fault_mask, (0660), sys_sfp_read, sys_sfp_write, SFP_TX_FAULT_MASK); +static SENSOR_DEVICE_ATTR(sfp_tx_disable, (0660), sys_sfp_read, sys_sfp_write, SFP_TX_DISABLE); +static SENSOR_DEVICE_ATTR(sfp_present, (0660), sys_sfp_read, sys_sfp_write, SFP_PRESENT); +static SENSOR_DEVICE_ATTR(sfp_present_mask, (0660), sys_sfp_read, sys_sfp_write, SFP_PRESENT_MASK); +static SENSOR_DEVICE_ATTR(sfp_rx_loss, (0660), sys_sfp_read, sys_sfp_write, SFP_RX_LOSS); +static SENSOR_DEVICE_ATTR(sfp_rx_loss_mask, (0660), sys_sfp_read, sys_sfp_write, SFP_RX_LOSS_MASK); + + +static struct attribute *alphanetworks_snj60d0_320f_fpga_attributes[] = { + &sensor_dev_attr_psu1_present.dev_attr.attr, + &sensor_dev_attr_psu2_present.dev_attr.attr, + &sensor_dev_attr_psu1_power_good.dev_attr.attr, + &sensor_dev_attr_psu2_power_good.dev_attr.attr, + &sensor_dev_attr_fan_pwm.dev_attr.attr, + &sensor_dev_attr_fan1_present.dev_attr.attr, + &sensor_dev_attr_fan2_present.dev_attr.attr, + &sensor_dev_attr_fan3_present.dev_attr.attr, + &sensor_dev_attr_fan4_present.dev_attr.attr, + &sensor_dev_attr_fan5_present.dev_attr.attr, + &sensor_dev_attr_fan6_present.dev_attr.attr, + &sensor_dev_attr_fan1_front_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan2_front_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan3_front_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan4_front_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan5_front_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan6_front_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan1_rear_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan2_rear_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan3_rear_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan4_rear_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan5_rear_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan6_rear_speed_rpm.dev_attr.attr, + &sensor_dev_attr_fan1_fault.dev_attr.attr, &sensor_dev_attr_fan11_fault.dev_attr.attr, + &sensor_dev_attr_fan2_fault.dev_attr.attr, &sensor_dev_attr_fan12_fault.dev_attr.attr, + &sensor_dev_attr_fan3_fault.dev_attr.attr, &sensor_dev_attr_fan13_fault.dev_attr.attr, + &sensor_dev_attr_fan4_fault.dev_attr.attr, &sensor_dev_attr_fan14_fault.dev_attr.attr, + &sensor_dev_attr_fan5_fault.dev_attr.attr, &sensor_dev_attr_fan15_fault.dev_attr.attr, + &sensor_dev_attr_fan6_fault.dev_attr.attr, &sensor_dev_attr_fan16_fault.dev_attr.attr, + &sensor_dev_attr_fan1_input.dev_attr.attr, &sensor_dev_attr_fan11_input.dev_attr.attr, + &sensor_dev_attr_fan2_input.dev_attr.attr, &sensor_dev_attr_fan12_input.dev_attr.attr, + &sensor_dev_attr_fan3_input.dev_attr.attr, &sensor_dev_attr_fan13_input.dev_attr.attr, + &sensor_dev_attr_fan4_input.dev_attr.attr, &sensor_dev_attr_fan14_input.dev_attr.attr, + &sensor_dev_attr_fan5_input.dev_attr.attr, &sensor_dev_attr_fan15_input.dev_attr.attr, + &sensor_dev_attr_fan6_input.dev_attr.attr, &sensor_dev_attr_fan16_input.dev_attr.attr, + &sensor_dev_attr_sys_status.dev_attr.attr, + &sensor_dev_attr_sys_pwr.dev_attr.attr, + &sensor_dev_attr_fan1_led.dev_attr.attr, + &sensor_dev_attr_fan2_led.dev_attr.attr, + &sensor_dev_attr_fan3_led.dev_attr.attr, + &sensor_dev_attr_fan4_led.dev_attr.attr, + &sensor_dev_attr_fan5_led.dev_attr.attr, + &sensor_dev_attr_fan6_led.dev_attr.attr, + &sensor_dev_attr_sys_reset1.dev_attr.attr, + &sensor_dev_attr_sys_reset2.dev_attr.attr, + &sensor_dev_attr_sys_reset3.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault_mask.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable.dev_attr.attr, + &sensor_dev_attr_sfp_present.dev_attr.attr, + &sensor_dev_attr_sfp_present_mask.dev_attr.attr, + &sensor_dev_attr_sfp_rx_loss.dev_attr.attr, + &sensor_dev_attr_sfp_rx_loss_mask.dev_attr.attr, + &sensor_dev_attr_sys_locator.dev_attr.attr, + &sensor_dev_attr_port_led_disable.dev_attr.attr, + &sensor_dev_attr_fan1_direction.dev_attr.attr, + &sensor_dev_attr_fan2_direction.dev_attr.attr, + &sensor_dev_attr_fan3_direction.dev_attr.attr, + &sensor_dev_attr_fan4_direction.dev_attr.attr, + &sensor_dev_attr_fan5_direction.dev_attr.attr, + &sensor_dev_attr_fan6_direction.dev_attr.attr, + &sensor_dev_attr_fpga_revision.dev_attr.attr, + NULL +}; + +static const struct attribute_group alphanetworks_snj60d0_320f_fpga_group = { + .attrs = alphanetworks_snj60d0_320f_fpga_attributes, +}; + + +static ssize_t psu_show_status(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val = 0, res = 0; + u8 command; + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *sda = to_sensor_dev_attr(attr); + + switch(sda->index) { + case PSU1_PRESENT: + case PSU1_POWER_GOOD: + command = PSU1_STATUS_REG; + break; + case PSU2_PRESENT: + case PSU2_POWER_GOOD: + command = PSU2_STATUS_REG; + break; + } + + val = i2c_smbus_read_byte_data(client, command); + if (val < 0) { + dev_dbg(&client->dev, "fpga(0x%x) reg(0x1) err %d\n", client->addr, val); + } + + switch(sda->index) { + case PSU1_PRESENT: + case PSU2_PRESENT: + res = (val & PSU_PRESENT_BIT ? 0 : 1 ); + break; + case PSU1_POWER_GOOD: + case PSU2_POWER_GOOD: + res = (val & PSU_POWER_BIT ? 1 : 0 ); + break; + } + + return sprintf(buf, "%d\n", res); +} + +static ssize_t fan_pwm_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val = 0; + struct i2c_client *client = to_i2c_client(dev); + + val = i2c_smbus_read_byte_data(client, FAN_PWM_REG); + + if (val < 0) { + dev_dbg(&client->dev, "fpga(0x%x) reg(0x1) err %d\n", client->addr, val); + } + + return sprintf(buf, "%d", val); +} + +static ssize_t set_fan_pwm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + int error, value; + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < 0 || value > 0xFF) + return -EINVAL; + + i2c_smbus_write_byte_data(client, FAN_PWM_REG, value); + + return count; +} + +static ssize_t fpga_version_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val = 0; + struct i2c_client *client = to_i2c_client(dev); + + val = i2c_smbus_read_byte_data(client, FPGA_REVISION_REG); + + if (val < 0) { + dev_dbg(&client->dev, "fpga(0x%x) reg(0x1) err %d\n", client->addr, val); + } + + return sprintf(buf, "%d\n", (val & FPGA_REVISION_BIT)); +} + +static ssize_t fan_show_status(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct sensor_device_attribute *sda = to_sensor_dev_attr(attr); + struct i2c_client *client = to_i2c_client(dev); + // struct as7712_32x_fan_data *data = as7712_32x_fan_update_device(dev); + ssize_t ret = 0; + int val, val2; + + switch (sda->index) { + /* case FAN_DUTY_CYCLE_PERCENTAGE: */ + /* { */ + /* u32 duty_cycle = reg_val_to_duty_cycle(data->reg_val[FAN_DUTY_CYCLE_PERCENTAGE]); */ + /* ret = sprintf(buf, "%u\n", duty_cycle); */ + /* break; */ + /* } */ + case FAN1_FRONT_SPEED_RPM: + case FAN2_FRONT_SPEED_RPM: + case FAN3_FRONT_SPEED_RPM: + case FAN4_FRONT_SPEED_RPM: + case FAN5_FRONT_SPEED_RPM: + case FAN6_FRONT_SPEED_RPM: + case FAN1_REAR_SPEED_RPM: + case FAN2_REAR_SPEED_RPM: + case FAN3_REAR_SPEED_RPM: + case FAN4_REAR_SPEED_RPM: + case FAN5_REAR_SPEED_RPM: + case FAN6_REAR_SPEED_RPM: + val = i2c_smbus_read_byte_data(client, sda->index); + ret = sprintf(buf, "%d\n", val * 150); + break; + case FAN1_FAULT: + case FAN2_FAULT: + case FAN3_FAULT: + case FAN4_FAULT: + case FAN5_FAULT: + case FAN6_FAULT: + val = i2c_smbus_read_byte_data(client, (sda->index - FAN1_FAULT)*2 + FAN1_FRONT_SPEED_RPM); + val2 = i2c_smbus_read_byte_data(client, (sda->index - FAN1_FAULT)*2 + FAN1_REAR_SPEED_RPM); + ret = sprintf(buf, "%d\n", (val|val2) ? 0 : 1); + break; + default: + break; + } + + return ret; +} + +static ssize_t fan_show_status_reg(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct sensor_device_attribute *sda = to_sensor_dev_attr(attr); + struct i2c_client *client = to_i2c_client(dev); + ssize_t ret = 0; + int val; + u8 fan_status_offset = 0; + + switch (sda->index) { + + case FAN1_PRESENT: + case FAN1_DIRECTION: + fan_status_offset = FAN1_STATUS_REG; + break; + case FAN2_PRESENT: + case FAN2_DIRECTION: + fan_status_offset = FAN2_STATUS_REG; + break; + case FAN3_PRESENT: + case FAN3_DIRECTION: + fan_status_offset = FAN3_STATUS_REG; + break; + case FAN4_PRESENT: + case FAN4_DIRECTION: + fan_status_offset = FAN4_STATUS_REG; + break; + case FAN5_PRESENT: + case FAN5_DIRECTION: + fan_status_offset = FAN5_STATUS_REG; + break; + case FAN6_PRESENT: + case FAN6_DIRECTION: + fan_status_offset = FAN6_STATUS_REG; + break; + default: + break; + } + + switch (sda->index) { + + case FAN1_PRESENT: + case FAN2_PRESENT: + case FAN3_PRESENT: + case FAN4_PRESENT: + case FAN5_PRESENT: + case FAN6_PRESENT: + val = i2c_smbus_read_byte_data(client, fan_status_offset); + /* Debug Msg + printk(KERN_ERR "%s: Present: fan_status_offset: %d, Value: %d \n", __FUNCTION__, fan_status_offset, val); + */ + ret = sprintf(buf, "%d\n", (val & FAN_PRESENT_BIT) ? 1 : 0); + break; + case FAN1_DIRECTION: + case FAN2_DIRECTION: + case FAN3_DIRECTION: + case FAN4_DIRECTION: + case FAN5_DIRECTION: + case FAN6_DIRECTION: + val = i2c_smbus_read_byte_data(client, fan_status_offset); + /* Debug Msg + printk(KERN_ERR "%s: Direction: fan_status_offset: %d, Value: %d \n", __FUNCTION__, fan_status_offset, val); + */ + ret = sprintf(buf, "%d\n", (val & FAN_DIRECTION_BIT) ? 1 : 0); + break; + default: + break; + } + + return ret; +} + +static ssize_t sys_led_read(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val = 0, res = 0; + u8 command; + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *sda = to_sensor_dev_attr(attr); + + switch(sda->index) { + case SYS_LOCATOR: + case SYS_PWR: + case PORT_LED_DISABLE: + command = SYS_LED_REG; + break; + case SYS_STATUS: + case FAN1_LED: + case FAN2_LED: + case FAN3_LED: + case FAN4_LED: + case FAN5_LED: + case FAN6_LED: + command = SYS2_LED_REG; + break; + case SYS_RESET1: + command = SYS_RESET1_REG; + break; + case SYS_RESET2: + command = SYS_RESET2_REG; + break; + case SYS_RESET3: + command = SYS_RESET3_REG; + break; + } + + val = i2c_smbus_read_byte_data(client, command); + if (val < 0) { + dev_dbg(&client->dev, "fpga(0x%x) reg(0x1) err %d\n", client->addr, val); + } + + switch(sda->index) { + case SYS_LOCATOR: + res = (val & SYS_LOCATOR_LED_BITS) >> 0; + break; + case SYS_PWR: + res = (val & SYS_PWR_LED_BITS) >> 3; + break; + case PORT_LED_DISABLE: + res = (val & PORT_LED_DISABLE_BITS) >> 6; + break; + case SYS_STATUS: + res = (val & SYS_STATUS_LED_BITS) >> 0; + break; + case FAN1_LED: + case FAN3_LED: + case FAN5_LED: + case FAN2_LED: + case FAN4_LED: + case FAN6_LED: + res = (val & SYS_FAN_LED_BITS) >> 3; + break; + case SYS_RESET1: + res = val; + break; + case SYS_RESET2: + res = val; + break; + case SYS_RESET3: + res = val; + break; + } + + return sprintf(buf, "%d\n", res); +} + +static ssize_t sys_led_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *sda = to_sensor_dev_attr(attr); + int error, write, command, read; + + error = kstrtoint(buf, 10, &write); + if (error) + return error; + + + switch(sda->index) { + case SYS_LOCATOR: + case SYS_PWR: + case PORT_LED_DISABLE: + if(write < 0 || write > 7) + return -EINVAL; + command = SYS_LED_REG; + break; + case SYS_STATUS: + if (write < 0 || write > 7) + return -EINVAL; + command = SYS2_LED_REG; + break; + case FAN1_LED: + case FAN2_LED: + case FAN3_LED: + case FAN4_LED: + case FAN5_LED: + case FAN6_LED: + if (write < 0 || write > 7) + return -EINVAL; + command = SYS2_LED_REG; + break; + case SYS_RESET1: + if (write < 0 || write > 255) + return -EINVAL; + command = SYS_RESET1_REG; + break; + case SYS_RESET2: + if (write < 0 || write > 255) + return -EINVAL; + command = SYS_RESET2_REG; + break; + case SYS_RESET3: + if (write < 0 || write > 255) + return -EINVAL; + command = SYS_RESET3_REG; + break; + } + + read = i2c_smbus_read_byte_data(client, command); + if (read < 0) { + dev_dbg(&client->dev, "fpga(0x%x) reg(0x1) err %d\n", client->addr, read); + } + + switch(sda->index) { + case SYS_LOCATOR: + read &= ~SYS_LOCATOR_LED_BITS; + read |= write << 0; + break; + case SYS_PWR: + read &= ~SYS_PWR_LED_BITS; + read |= write << 3; + break; + case PORT_LED_DISABLE: + read &= ~PORT_LED_DISABLE_BITS; + read |= write << 6; + break; + case SYS_STATUS: + read &= ~SYS_STATUS_LED_BITS; + read |= write << 0; + break; + case FAN1_LED: + case FAN3_LED: + case FAN5_LED: + case FAN2_LED: + case FAN4_LED: + case FAN6_LED: + read &= ~SYS_FAN_LED_BITS; + read |= write << 3; + break; + case SYS_RESET1: + read = write; + break; + case SYS_RESET2: + read = write; + break; + case SYS_RESET3: + read = write; + break; + } + + i2c_smbus_write_byte_data(client, command, read); + + return count; +} + +static ssize_t sys_sfp_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *sda = to_sensor_dev_attr(attr); + int error, write, command; + + error = kstrtoint(buf, 10, &write); + if (error) + return error; + + switch(sda->index) { + case SFP_TX_FAULT: + command = SFP_TX_FAULT_MASK_REG; + break; + case SFP_TX_DISABLE: + command = SFP_TX_DISABLE_REG; + break; + case SFP_PRESENT: + command = SFP_PRESENT_MASK_REG; + case SFP_RX_LOSS: + command = SFP_RX_LOSS_MASK_REG; + break; + default: + return 0; + } + + i2c_smbus_write_byte_data(client, command, write); + + return count; + +} + +static ssize_t sys_sfp_read(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val = 0, res = 0; + u8 command; + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *sda = to_sensor_dev_attr(attr); + + switch(sda->index) { + case SFP_TX_FAULT: + command = SFP_TX_FAULT_REG; + break; + case SFP_TX_DISABLE: + command = SFP_TX_DISABLE_REG; + break; + case SFP_PRESENT: + command = SFP_PRESENT_REG; + break; + case SFP_RX_LOSS: + command = SFP_RX_LOSS_REG; + break; + } + + val = i2c_smbus_read_byte_data(client, command); + if (val < 0) { + dev_dbg(&client->dev, "fpga(0x%x) reg(0x1) err %d\n", client->addr, val); + } + + res = val; + + return sprintf(buf, "%d\n", res); + +} + + +static void alpha_i2c_fpga_add_client(struct i2c_client *client) +{ + struct fpga_client_node *node = kzalloc(sizeof(struct fpga_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate fpga_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &fpga_client_list); + mutex_unlock(&list_lock); +} + +static void alpha_i2c_fpga_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct fpga_client_node *fpga_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &fpga_client_list) + { + fpga_node = list_entry(list_node, struct fpga_client_node, list); + + if (fpga_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(fpga_node); + } + + mutex_unlock(&list_lock); +} + +static int alpha_i2c_fpga_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int status; + struct alphanetworks_snj60d0_320f_pwr_fpga_data* data; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_dbg(&client->dev, "i2c_check_functionality failed (0x%x)\n", client->addr); + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct alphanetworks_snj60d0_320f_pwr_fpga_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + status = sysfs_create_group(&client->dev.kobj, &alphanetworks_snj60d0_320f_fpga_group); + if (status) { + goto exit; + } + + dev_info(&client->dev, "chip found\n"); + alpha_i2c_fpga_add_client(client); + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit; + } + + dev_info(&client->dev, "%s: pwr_fpga '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit: + return status; +} + +static int alpha_i2c_fpga_remove(struct i2c_client *client) +{ + struct alphanetworks_snj60d0_320f_pwr_fpga_data *data = i2c_get_clientdata(client); + sysfs_remove_group(&client->dev.kobj, &alphanetworks_snj60d0_320f_fpga_group); + alpha_i2c_fpga_remove_client(client); + kfree(data); + + return 0; +} + +static const struct i2c_device_id alpha_i2c_fpga_id[] = { + { DRIVER_NAME, 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, alpha_i2c_fpga_id); + +static struct i2c_driver alpha_i2c_fpga_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = DRIVER_NAME, + }, + .probe = alpha_i2c_fpga_probe, + .remove = alpha_i2c_fpga_remove, + .id_table = alpha_i2c_fpga_id, + .address_list = normal_i2c, +}; + +int alpha_i2c_fpga_read(unsigned short fpga_addr, u8 reg) +{ + struct list_head *list_node = NULL; + struct fpga_client_node *fpga_node = NULL; + int ret = -EPERM; + + mutex_lock(&list_lock); + + list_for_each(list_node, &fpga_client_list) + { + fpga_node = list_entry(list_node, struct fpga_client_node, list); + + if (fpga_node->client->addr == fpga_addr) { + ret = i2c_smbus_read_byte_data(fpga_node->client, reg); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(alpha_i2c_fpga_read); + +int alpha_i2c_fpga_write(unsigned short fpga_addr, u8 reg, u8 value) +{ + struct list_head *list_node = NULL; + struct fpga_client_node *fpga_node = NULL; + int ret = -EIO; + + mutex_lock(&list_lock); + + list_for_each(list_node, &fpga_client_list) + { + fpga_node = list_entry(list_node, struct fpga_client_node, list); + + if (fpga_node->client->addr == fpga_addr) { + ret = i2c_smbus_write_byte_data(fpga_node->client, reg, value); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(alpha_i2c_fpga_write); + +static int __init alpha_i2c_fpga_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&alpha_i2c_fpga_driver); +} + +static void __exit alpha_i2c_fpga_exit(void) +{ + i2c_del_driver(&alpha_i2c_fpga_driver); +} + +MODULE_AUTHOR("Alpha-SID6"); +MODULE_DESCRIPTION("alpha fpga driver"); +MODULE_LICENSE("GPL"); + +module_init(alpha_i2c_fpga_init); +module_exit(alpha_i2c_fpga_exit); diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/modules/snj60d0-320f_i2c_mux_cpld.c b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/modules/snj60d0-320f_i2c_mux_cpld.c new file mode 100644 index 000000000000..904644f9d84b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/modules/snj60d0-320f_i2c_mux_cpld.c @@ -0,0 +1,1306 @@ +/* + * An I2C multiplexer dirver for alphanetworks snj60d0-320f CPLD + * + * Copyright (C) 2021 Alphanetworks Technology Corporation. + * Fillmore Chen + * + * Based on: + * + * Copyright (C) 2015 Accton Technology Corporation. + * Brandon Chuang + * + * Based on: + * pca954x.c from Kumar Gala + * Copyright (C) 2006 + * + * Based on: + * pca954x.c from Ken Harrenstien + * Copyright (C) 2004 Google, Inc. (Ken Harrenstien) + * + * Based on: + * i2c-virtual_cb.c from Brian Kuschak + * and + * pca9540.c from Jean Delvare . + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_NAME "snj60d0_i2c_mux_cpld" +#define I2C_RW_RETRY_COUNT 10 +#define I2C_RW_RETRY_INTERVAL 60 /* ms */ + +#define NUM_OF_CPLD1_CHANS 0x8 +#define NUM_OF_CPLD2_CHANS 0x8 +#define NUM_OF_CPLD3_CHANS 0x8 +#define NUM_OF_CPLD4_CHANS 0x8 + +#define CPLD_CHANNEL_SELECT_REG 0x06 +#define CPLD_DESELECT_CHANNEL 0x00 + +#define CPLD_REG_ADDR_REVISION 0x00 +#define CPLD_REG_ADDR_INTR 0x01 +#define CPLD_REG_ADDR_PRESENT 0x03 +#define CPLD_REG_ADDR_RESET 0x04 +#define CPLD_REG_ADDR_LOWPOWERMODE 0x05 +#define CPLD_REG_ADDR_MODSELECT 0x06 +#define CPLD_REG_ADDR_PORT_LED_CONTROL 0x07 + +#define DEBUG_MODE 1 + +static unsigned int debug = 0; +module_param(debug, uint, S_IRUGO); +MODULE_PARM_DESC(debug, "Set DEBUG mode. Default is disabled."); + + +#define DEBUG_PRINT(fmt, args...) \ + if (debug == 1) \ + printk (KERN_INFO "[%s,%d]: " fmt "\r\n", __FUNCTION__, __LINE__, ##args) + +static LIST_HEAD(cpld_client_list); +static struct mutex list_lock; + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +enum cpld_mux_type { + snj60d0_320f_cpld1, + snj60d0_320f_cpld2, + snj60d0_320f_cpld3, + snj60d0_320f_cpld4 +}; + +struct snj60d0_320f_cpld_data { + enum cpld_mux_type type; + struct i2c_client *client; + u8 last_chan; /* last register value */ + + struct device *hwmon_dev; + struct mutex update_lock; +}; + +struct chip_desc { + u8 nchans; + u8 deselectChan; +}; + +/* Provide specs for the PCA954x types we know about */ +static const struct chip_desc chips[] = { + [snj60d0_320f_cpld1] = { + .nchans = NUM_OF_CPLD1_CHANS, + .deselectChan = CPLD_DESELECT_CHANNEL, + }, + [snj60d0_320f_cpld2] = { + .nchans = NUM_OF_CPLD2_CHANS, + .deselectChan = CPLD_DESELECT_CHANNEL, + }, + [snj60d0_320f_cpld3] = { + .nchans = NUM_OF_CPLD3_CHANS, + .deselectChan = CPLD_DESELECT_CHANNEL, + }, + [snj60d0_320f_cpld4] = { + .nchans = NUM_OF_CPLD4_CHANS, + .deselectChan = CPLD_DESELECT_CHANNEL, + } +}; + +static const struct i2c_device_id snj60d0_320f_cpld_mux_id[] = { + { "snj60d0_320f_cpld1", snj60d0_320f_cpld1 }, + { "snj60d0_320f_cpld2", snj60d0_320f_cpld2 }, + { "snj60d0_320f_cpld3", snj60d0_320f_cpld3 }, + { "snj60d0_320f_cpld4", snj60d0_320f_cpld4 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, snj60d0_320f_cpld_mux_id); + +#define TRANSCEIVER_PRESENT_ATTR_ID(index) MODULE_PRESENT_##index +#define TRANSCEIVER_LPMODE_ATTR_ID(index) MODULE_LPMODE_##index +#define TRANSCEIVER_RESET_ATTR_ID(index) MODULE_RESET_##index +#define CPLD_INTR_ATTR_ID(index) CPLD_INTR_##index +#define CPLD_PORT_LED_ENABLE_ATTR_ID(index) CPLD_PORT_LED_ENABLE_##index + +enum snj60d0_320f_cpld_sysfs_attributes { + CPLD_VERSION, + ACCESS, + MODULE_PRESENT_ALL, + /* transceiver attributes */ + TRANSCEIVER_PRESENT_ATTR_ID(1), + TRANSCEIVER_PRESENT_ATTR_ID(2), + TRANSCEIVER_PRESENT_ATTR_ID(3), + TRANSCEIVER_PRESENT_ATTR_ID(4), + TRANSCEIVER_PRESENT_ATTR_ID(5), + TRANSCEIVER_PRESENT_ATTR_ID(6), + TRANSCEIVER_PRESENT_ATTR_ID(7), + TRANSCEIVER_PRESENT_ATTR_ID(8), + TRANSCEIVER_PRESENT_ATTR_ID(9), + TRANSCEIVER_PRESENT_ATTR_ID(10), + TRANSCEIVER_PRESENT_ATTR_ID(11), + TRANSCEIVER_PRESENT_ATTR_ID(12), + TRANSCEIVER_PRESENT_ATTR_ID(13), + TRANSCEIVER_PRESENT_ATTR_ID(14), + TRANSCEIVER_PRESENT_ATTR_ID(15), + TRANSCEIVER_PRESENT_ATTR_ID(16), + TRANSCEIVER_PRESENT_ATTR_ID(17), + TRANSCEIVER_PRESENT_ATTR_ID(18), + TRANSCEIVER_PRESENT_ATTR_ID(19), + TRANSCEIVER_PRESENT_ATTR_ID(20), + TRANSCEIVER_PRESENT_ATTR_ID(21), + TRANSCEIVER_PRESENT_ATTR_ID(22), + TRANSCEIVER_PRESENT_ATTR_ID(23), + TRANSCEIVER_PRESENT_ATTR_ID(24), + TRANSCEIVER_PRESENT_ATTR_ID(25), + TRANSCEIVER_PRESENT_ATTR_ID(26), + TRANSCEIVER_PRESENT_ATTR_ID(27), + TRANSCEIVER_PRESENT_ATTR_ID(28), + TRANSCEIVER_PRESENT_ATTR_ID(29), + TRANSCEIVER_PRESENT_ATTR_ID(30), + TRANSCEIVER_PRESENT_ATTR_ID(31), + TRANSCEIVER_PRESENT_ATTR_ID(32), + + TRANSCEIVER_LPMODE_ATTR_ID(1), + TRANSCEIVER_LPMODE_ATTR_ID(2), + TRANSCEIVER_LPMODE_ATTR_ID(3), + TRANSCEIVER_LPMODE_ATTR_ID(4), + TRANSCEIVER_LPMODE_ATTR_ID(5), + TRANSCEIVER_LPMODE_ATTR_ID(6), + TRANSCEIVER_LPMODE_ATTR_ID(7), + TRANSCEIVER_LPMODE_ATTR_ID(8), + TRANSCEIVER_LPMODE_ATTR_ID(9), + TRANSCEIVER_LPMODE_ATTR_ID(10), + TRANSCEIVER_LPMODE_ATTR_ID(11), + TRANSCEIVER_LPMODE_ATTR_ID(12), + TRANSCEIVER_LPMODE_ATTR_ID(13), + TRANSCEIVER_LPMODE_ATTR_ID(14), + TRANSCEIVER_LPMODE_ATTR_ID(15), + TRANSCEIVER_LPMODE_ATTR_ID(16), + TRANSCEIVER_LPMODE_ATTR_ID(17), + TRANSCEIVER_LPMODE_ATTR_ID(18), + TRANSCEIVER_LPMODE_ATTR_ID(19), + TRANSCEIVER_LPMODE_ATTR_ID(20), + TRANSCEIVER_LPMODE_ATTR_ID(21), + TRANSCEIVER_LPMODE_ATTR_ID(22), + TRANSCEIVER_LPMODE_ATTR_ID(23), + TRANSCEIVER_LPMODE_ATTR_ID(24), + TRANSCEIVER_LPMODE_ATTR_ID(25), + TRANSCEIVER_LPMODE_ATTR_ID(26), + TRANSCEIVER_LPMODE_ATTR_ID(27), + TRANSCEIVER_LPMODE_ATTR_ID(28), + TRANSCEIVER_LPMODE_ATTR_ID(29), + TRANSCEIVER_LPMODE_ATTR_ID(30), + TRANSCEIVER_LPMODE_ATTR_ID(31), + TRANSCEIVER_LPMODE_ATTR_ID(32), + TRANSCEIVER_RESET_ATTR_ID(1), + TRANSCEIVER_RESET_ATTR_ID(2), + TRANSCEIVER_RESET_ATTR_ID(3), + TRANSCEIVER_RESET_ATTR_ID(4), + TRANSCEIVER_RESET_ATTR_ID(5), + TRANSCEIVER_RESET_ATTR_ID(6), + TRANSCEIVER_RESET_ATTR_ID(7), + TRANSCEIVER_RESET_ATTR_ID(8), + TRANSCEIVER_RESET_ATTR_ID(9), + TRANSCEIVER_RESET_ATTR_ID(10), + TRANSCEIVER_RESET_ATTR_ID(11), + TRANSCEIVER_RESET_ATTR_ID(12), + TRANSCEIVER_RESET_ATTR_ID(13), + TRANSCEIVER_RESET_ATTR_ID(14), + TRANSCEIVER_RESET_ATTR_ID(15), + TRANSCEIVER_RESET_ATTR_ID(16), + TRANSCEIVER_RESET_ATTR_ID(17), + TRANSCEIVER_RESET_ATTR_ID(18), + TRANSCEIVER_RESET_ATTR_ID(19), + TRANSCEIVER_RESET_ATTR_ID(20), + TRANSCEIVER_RESET_ATTR_ID(21), + TRANSCEIVER_RESET_ATTR_ID(22), + TRANSCEIVER_RESET_ATTR_ID(23), + TRANSCEIVER_RESET_ATTR_ID(24), + TRANSCEIVER_RESET_ATTR_ID(25), + TRANSCEIVER_RESET_ATTR_ID(26), + TRANSCEIVER_RESET_ATTR_ID(27), + TRANSCEIVER_RESET_ATTR_ID(28), + TRANSCEIVER_RESET_ATTR_ID(29), + TRANSCEIVER_RESET_ATTR_ID(30), + TRANSCEIVER_RESET_ATTR_ID(31), + TRANSCEIVER_RESET_ATTR_ID(32), + CPLD_INTR_ATTR_ID(1), + CPLD_INTR_ATTR_ID(2), + CPLD_INTR_ATTR_ID(3), + CPLD_INTR_ATTR_ID(4), + CPLD_PORT_LED_ENABLE_ATTR_ID(1), + CPLD_PORT_LED_ENABLE_ATTR_ID(2), + CPLD_PORT_LED_ENABLE_ATTR_ID(3), + CPLD_PORT_LED_ENABLE_ATTR_ID(4), +}; +/* sysfs attributes for hwmon + */ +static ssize_t show_led_control(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_interrupt(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_present_all(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t set_led_control(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t set_lp_mode(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t access(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t show_version(struct device *dev, struct device_attribute *da, + char *buf); +static int snj60d0_320f_cpld_read_internal(struct i2c_client *client, u8 reg); +static int snj60d0_320f_cpld_write_internal(struct i2c_client *client, u8 reg, u8 value); + +/* transceiver attributes */ +#define DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_present_##index, S_IRUGO, show_status, NULL, MODULE_PRESENT_##index) +#define DECLARE_TRANSCEIVER_PRESENT_ATTR(index) &sensor_dev_attr_module_present_##index.dev_attr.attr + +#define DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_lp_mode_##index, S_IRUGO | S_IWUSR, show_status, set_lp_mode, MODULE_LPMODE_##index); \ + static SENSOR_DEVICE_ATTR(module_reset_##index, S_IRUGO | S_IWUSR, show_status, set_mode_reset, MODULE_RESET_##index) + +#define DECLARE_QSFP_TRANSCEIVER_ATTR(index) \ + &sensor_dev_attr_module_lp_mode_##index.dev_attr.attr, \ + &sensor_dev_attr_module_reset_##index.dev_attr.attr + +/* cpld interrupt */ +#define DECLARE_CPLD_INTR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(cpld_intr_##index, S_IRUGO, show_interrupt, NULL, CPLD_INTR_##index) +#define DECLARE_CPLD_INTR_ATTR(index) &sensor_dev_attr_cpld_intr_##index.dev_attr.attr + +/* cpld port_led_control */ +#define DECLARE_CPLD_PORT_LED_ENABLE_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(cpld_port_led_enable_##index, S_IRUGO | S_IWUSR, show_led_control, set_led_control, CPLD_PORT_LED_ENABLE_##index) +#define DECLARE_CPLD_PORT_LED_ENABLE_ATTR(index) &sensor_dev_attr_cpld_port_led_enable_##index.dev_attr.attr + +static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, NULL, CPLD_VERSION); +static SENSOR_DEVICE_ATTR(access, S_IWUSR, NULL, access, ACCESS); +/* transceiver attributes */ +static SENSOR_DEVICE_ATTR(module_present_all, S_IRUGO, show_present_all, NULL, MODULE_PRESENT_ALL); + +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(1); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(2); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(3); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(4); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(5); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(6); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(7); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(8); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(9); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(10); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(11); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(12); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(13); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(14); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(15); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(16); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(17); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(18); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(19); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(20); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(21); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(22); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(23); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(24); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(25); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(26); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(27); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(28); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(29); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(30); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(31); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(32); + +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(1); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(2); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(3); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(4); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(5); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(6); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(7); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(8); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(9); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(10); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(11); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(12); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(13); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(14); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(15); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(16); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(17); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(18); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(19); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(20); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(21); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(22); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(23); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(24); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(25); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(26); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(27); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(28); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(29); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(30); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(31); +DECLARE_QSFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(32); +DECLARE_CPLD_INTR_DEVICE_ATTR(1); +DECLARE_CPLD_INTR_DEVICE_ATTR(2); +DECLARE_CPLD_INTR_DEVICE_ATTR(3); +DECLARE_CPLD_INTR_DEVICE_ATTR(4); +DECLARE_CPLD_PORT_LED_ENABLE_DEVICE_ATTR(1); +DECLARE_CPLD_PORT_LED_ENABLE_DEVICE_ATTR(2); +DECLARE_CPLD_PORT_LED_ENABLE_DEVICE_ATTR(3); +DECLARE_CPLD_PORT_LED_ENABLE_DEVICE_ATTR(4); + +static struct attribute *snj60d0_320f_cpld1_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_access.dev_attr.attr, + /* transceiver attributes */ + &sensor_dev_attr_module_present_all.dev_attr.attr, + DECLARE_TRANSCEIVER_PRESENT_ATTR(1), + DECLARE_TRANSCEIVER_PRESENT_ATTR(2), + DECLARE_TRANSCEIVER_PRESENT_ATTR(3), + DECLARE_TRANSCEIVER_PRESENT_ATTR(4), + DECLARE_TRANSCEIVER_PRESENT_ATTR(5), + DECLARE_TRANSCEIVER_PRESENT_ATTR(6), + DECLARE_TRANSCEIVER_PRESENT_ATTR(7), + DECLARE_TRANSCEIVER_PRESENT_ATTR(8), + DECLARE_QSFP_TRANSCEIVER_ATTR(1), + DECLARE_QSFP_TRANSCEIVER_ATTR(2), + DECLARE_QSFP_TRANSCEIVER_ATTR(3), + DECLARE_QSFP_TRANSCEIVER_ATTR(4), + DECLARE_QSFP_TRANSCEIVER_ATTR(5), + DECLARE_QSFP_TRANSCEIVER_ATTR(6), + DECLARE_QSFP_TRANSCEIVER_ATTR(7), + DECLARE_QSFP_TRANSCEIVER_ATTR(8), + DECLARE_CPLD_INTR_ATTR(1), + DECLARE_CPLD_PORT_LED_ENABLE_ATTR(1), + NULL +}; + +static const struct attribute_group snj60d0_320f_cpld1_group = { + .attrs = snj60d0_320f_cpld1_attributes, +}; + +static struct attribute *snj60d0_320f_cpld2_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_access.dev_attr.attr, + /* transceiver attributes */ + &sensor_dev_attr_module_present_all.dev_attr.attr, + DECLARE_TRANSCEIVER_PRESENT_ATTR(9), + DECLARE_TRANSCEIVER_PRESENT_ATTR(10), + DECLARE_TRANSCEIVER_PRESENT_ATTR(11), + DECLARE_TRANSCEIVER_PRESENT_ATTR(12), + DECLARE_TRANSCEIVER_PRESENT_ATTR(13), + DECLARE_TRANSCEIVER_PRESENT_ATTR(14), + DECLARE_TRANSCEIVER_PRESENT_ATTR(15), + DECLARE_TRANSCEIVER_PRESENT_ATTR(16), + DECLARE_QSFP_TRANSCEIVER_ATTR(9), + DECLARE_QSFP_TRANSCEIVER_ATTR(10), + DECLARE_QSFP_TRANSCEIVER_ATTR(11), + DECLARE_QSFP_TRANSCEIVER_ATTR(12), + DECLARE_QSFP_TRANSCEIVER_ATTR(13), + DECLARE_QSFP_TRANSCEIVER_ATTR(14), + DECLARE_QSFP_TRANSCEIVER_ATTR(15), + DECLARE_QSFP_TRANSCEIVER_ATTR(16), + DECLARE_CPLD_INTR_ATTR(2), + DECLARE_CPLD_PORT_LED_ENABLE_ATTR(2), + NULL +}; + +static const struct attribute_group snj60d0_320f_cpld2_group = { + .attrs = snj60d0_320f_cpld2_attributes, +}; + +static struct attribute *snj60d0_320f_cpld3_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_access.dev_attr.attr, + /* transceiver attributes */ + &sensor_dev_attr_module_present_all.dev_attr.attr, + DECLARE_TRANSCEIVER_PRESENT_ATTR(17), + DECLARE_TRANSCEIVER_PRESENT_ATTR(18), + DECLARE_TRANSCEIVER_PRESENT_ATTR(19), + DECLARE_TRANSCEIVER_PRESENT_ATTR(20), + DECLARE_TRANSCEIVER_PRESENT_ATTR(21), + DECLARE_TRANSCEIVER_PRESENT_ATTR(22), + DECLARE_TRANSCEIVER_PRESENT_ATTR(23), + DECLARE_TRANSCEIVER_PRESENT_ATTR(24), + DECLARE_QSFP_TRANSCEIVER_ATTR(17), + DECLARE_QSFP_TRANSCEIVER_ATTR(18), + DECLARE_QSFP_TRANSCEIVER_ATTR(19), + DECLARE_QSFP_TRANSCEIVER_ATTR(20), + DECLARE_QSFP_TRANSCEIVER_ATTR(21), + DECLARE_QSFP_TRANSCEIVER_ATTR(22), + DECLARE_QSFP_TRANSCEIVER_ATTR(23), + DECLARE_QSFP_TRANSCEIVER_ATTR(24), + DECLARE_CPLD_INTR_ATTR(3), + DECLARE_CPLD_PORT_LED_ENABLE_ATTR(3), + NULL +}; + +static const struct attribute_group snj60d0_320f_cpld3_group = { + .attrs = snj60d0_320f_cpld3_attributes, +}; + +static struct attribute *snj60d0_320f_cpld4_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_access.dev_attr.attr, + /* transceiver attributes */ + &sensor_dev_attr_module_present_all.dev_attr.attr, + DECLARE_TRANSCEIVER_PRESENT_ATTR(25), + DECLARE_TRANSCEIVER_PRESENT_ATTR(26), + DECLARE_TRANSCEIVER_PRESENT_ATTR(27), + DECLARE_TRANSCEIVER_PRESENT_ATTR(28), + DECLARE_TRANSCEIVER_PRESENT_ATTR(29), + DECLARE_TRANSCEIVER_PRESENT_ATTR(30), + DECLARE_TRANSCEIVER_PRESENT_ATTR(31), + DECLARE_TRANSCEIVER_PRESENT_ATTR(32), + DECLARE_QSFP_TRANSCEIVER_ATTR(25), + DECLARE_QSFP_TRANSCEIVER_ATTR(26), + DECLARE_QSFP_TRANSCEIVER_ATTR(27), + DECLARE_QSFP_TRANSCEIVER_ATTR(28), + DECLARE_QSFP_TRANSCEIVER_ATTR(29), + DECLARE_QSFP_TRANSCEIVER_ATTR(30), + DECLARE_QSFP_TRANSCEIVER_ATTR(31), + DECLARE_QSFP_TRANSCEIVER_ATTR(32), + DECLARE_CPLD_INTR_ATTR(4), + DECLARE_CPLD_PORT_LED_ENABLE_ATTR(4), + NULL +}; + +static const struct attribute_group snj60d0_320f_cpld4_group = { + .attrs = snj60d0_320f_cpld4_attributes, +}; + +static ssize_t show_present_all(struct device *dev, struct device_attribute *da, + char *buf) +{ + int i, status, num_regs = 0; + u8 values[4] = {0}; + u8 regs[] = {CPLD_REG_ADDR_PRESENT}; + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct snj60d0_320f_cpld_data *data = i2c_mux_priv(muxc); + + mutex_lock(&data->update_lock); + + num_regs = 1; + + for (i = 0; i < num_regs; i++) { + status = snj60d0_320f_cpld_read_internal(client, regs[i]); + + if (status < 0) { + goto exit; + } + + values[i] = (u8)status; + } + + mutex_unlock(&data->update_lock); + + /* Return values 1 -> 8 in order */ + status = sprintf(buf, "%.2x\n", values[0]); + + return status; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t show_led_control(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct snj60d0_320f_cpld_data *data = i2c_mux_priv(muxc); + int status = 0; + u8 reg = 0, mask = 0, revert = 1; + + switch (attr->index) + { + case CPLD_PORT_LED_ENABLE_1: + reg = CPLD_REG_ADDR_PORT_LED_CONTROL; + mask = 0x1; + break; + case CPLD_PORT_LED_ENABLE_2: + reg = CPLD_REG_ADDR_PORT_LED_CONTROL; + mask = 0x1; + break; + case CPLD_PORT_LED_ENABLE_3: + reg = CPLD_REG_ADDR_PORT_LED_CONTROL; + mask = 0x1; + break; + case CPLD_PORT_LED_ENABLE_4: + reg = CPLD_REG_ADDR_PORT_LED_CONTROL; + mask = 0x1; + break; + default: + return -ENODEV; + } + + mutex_lock(&data->update_lock); + status = snj60d0_320f_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", revert ? !(status & mask) : !!(status & mask)); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t show_interrupt(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct snj60d0_320f_cpld_data *data = i2c_mux_priv(muxc); + int status = 0; + u8 reg = 0; + + switch (attr->index) + { + case CPLD_INTR_1: + reg = CPLD_REG_ADDR_INTR; + break; + case CPLD_INTR_2: + reg = CPLD_REG_ADDR_INTR; + break; + case CPLD_INTR_3: + reg = CPLD_REG_ADDR_INTR; + break; + case CPLD_INTR_4: + reg = CPLD_REG_ADDR_INTR; + break; + default: + return -ENODEV; + } + + mutex_lock(&data->update_lock); + status = snj60d0_320f_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + + return sprintf(buf, "0x%x\n", status); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct snj60d0_320f_cpld_data *data = i2c_mux_priv(muxc); + int status = 0; + u8 reg = 0, mask = 0; + + switch (attr->index) { + case MODULE_PRESENT_1 ... MODULE_PRESENT_8: + reg = CPLD_REG_ADDR_PRESENT; + mask = 0x1 << (attr->index - MODULE_PRESENT_1); + break; + case MODULE_PRESENT_9 ... MODULE_PRESENT_16: + reg = CPLD_REG_ADDR_PRESENT; + mask = 0x1 << (attr->index - MODULE_PRESENT_9); + break; + case MODULE_PRESENT_17 ... MODULE_PRESENT_24: + reg = CPLD_REG_ADDR_PRESENT; + mask = 0x1 << (attr->index - MODULE_PRESENT_17); + break; + case MODULE_PRESENT_25 ... MODULE_PRESENT_32: + reg = CPLD_REG_ADDR_PRESENT; + mask = 0x1 << (attr->index - MODULE_PRESENT_25); + break; + case MODULE_LPMODE_1 ... MODULE_LPMODE_8: + reg = CPLD_REG_ADDR_LOWPOWERMODE; + mask = 0x1 << (attr->index - MODULE_LPMODE_1); + break; + case MODULE_LPMODE_9 ... MODULE_LPMODE_16: + reg = CPLD_REG_ADDR_LOWPOWERMODE; + mask = 0x1 << (attr->index - MODULE_LPMODE_9); + break; + case MODULE_LPMODE_17 ... MODULE_LPMODE_24: + reg = CPLD_REG_ADDR_LOWPOWERMODE; + mask = 0x1 << (attr->index - MODULE_LPMODE_17); + break; + case MODULE_LPMODE_25 ... MODULE_LPMODE_32: + reg = CPLD_REG_ADDR_LOWPOWERMODE; + mask = 0x1 << (attr->index - MODULE_LPMODE_25); + break; + case MODULE_RESET_1 ... MODULE_RESET_8: + reg = CPLD_REG_ADDR_RESET; + mask = 0x1 << (attr->index - MODULE_RESET_1); + break; + case MODULE_RESET_9 ... MODULE_RESET_16: + reg = CPLD_REG_ADDR_RESET; + mask = 0x1 << (attr->index - MODULE_RESET_9); + break; + case MODULE_RESET_17 ... MODULE_RESET_24: + reg = CPLD_REG_ADDR_RESET; + mask = 0x1 << (attr->index - MODULE_RESET_17); + break; + case MODULE_RESET_25 ... MODULE_RESET_32: + reg = CPLD_REG_ADDR_RESET; + mask = 0x1 << (attr->index - MODULE_RESET_25); + break; + default: + return 0; + } + + mutex_lock(&data->update_lock); + status = snj60d0_320f_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", !!(status & mask)); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t set_led_control(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct snj60d0_320f_cpld_data *data = i2c_mux_priv(muxc); + + long on; + int status= -ENOENT; + u8 reg = 0, mask = 0; + + if(attr->index < CPLD_PORT_LED_ENABLE_1 || attr->index > CPLD_PORT_LED_ENABLE_4) + return status; + + status = kstrtol(buf, 10, &on); + if (status) { + return status; + } + + if ((on != 1) && (on != 0)) + return -EINVAL; + + switch (attr->index) + { + case CPLD_PORT_LED_ENABLE_1: + reg = CPLD_REG_ADDR_PORT_LED_CONTROL; + mask = 0x1; + break; + case CPLD_PORT_LED_ENABLE_2: + reg = CPLD_REG_ADDR_PORT_LED_CONTROL; + mask = 0x1; + break; + case CPLD_PORT_LED_ENABLE_3: + reg = CPLD_REG_ADDR_PORT_LED_CONTROL; + mask = 0x1; + break; + case CPLD_PORT_LED_ENABLE_4: + reg = CPLD_REG_ADDR_PORT_LED_CONTROL; + mask = 0x1; + break; + default: + return -ENODEV; + } + + /* Read current status */ + mutex_lock(&data->update_lock); + status = snj60d0_320f_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + + /* Update led_control status */ + if (on) { + status &= ~mask; + } + else { + status |= mask; + } + + status = snj60d0_320f_cpld_write_internal(client, reg, status); + if (unlikely(status < 0)) { + goto exit; + } + + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; + +} + +static ssize_t set_lp_mode(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct snj60d0_320f_cpld_data *data = i2c_mux_priv(muxc); + + long on; + int status= -ENOENT; + u8 reg = 0, mask = 0; + + if(attr->index < MODULE_LPMODE_1 || attr->index > MODULE_LPMODE_32) + return status; + + status = kstrtol(buf, 10, &on); + if (status) { + return status; + } + + if ((on != 1) && (on != 0)) + return -EINVAL; + + switch (attr->index) { + case MODULE_LPMODE_1 ... MODULE_LPMODE_8: + reg = CPLD_REG_ADDR_LOWPOWERMODE; + mask = 0x1 << (attr->index - MODULE_LPMODE_1); + break; + case MODULE_LPMODE_9 ... MODULE_LPMODE_16: + reg = CPLD_REG_ADDR_LOWPOWERMODE; + mask = 0x1 << (attr->index - MODULE_LPMODE_9); + break; + case MODULE_LPMODE_17 ... MODULE_LPMODE_24: + reg = CPLD_REG_ADDR_LOWPOWERMODE; + mask = 0x1 << (attr->index - MODULE_LPMODE_17); + break; + case MODULE_LPMODE_25 ... MODULE_LPMODE_32: + reg = CPLD_REG_ADDR_LOWPOWERMODE; + mask = 0x1 << (attr->index - MODULE_LPMODE_25); + break; + default: + return 0; + } + + /* Read current status */ + mutex_lock(&data->update_lock); + status = snj60d0_320f_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + + /* Update lp_mode status */ + if (on) { + status |= mask; + } + else { + status &= ~mask; + } + + status = snj60d0_320f_cpld_write_internal(client, reg, status); + if (unlikely(status < 0)) { + goto exit; + } + + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; + +} + +static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct snj60d0_320f_cpld_data *data = i2c_mux_priv(muxc); + + long on; + int status= -ENOENT; + u8 reg = 0, mask = 0; + + if(attr->index < MODULE_RESET_1 || attr->index > MODULE_RESET_32) + return status; + + status = kstrtol(buf, 10, &on); + if (status) { + return status; + } + + if ((on != 1) && (on != 0)) + return -EINVAL; + + switch (attr->index) { + case MODULE_RESET_1 ... MODULE_RESET_8: + reg = CPLD_REG_ADDR_RESET; + mask = 0x1 << (attr->index - MODULE_RESET_1); + break; + case MODULE_RESET_9 ... MODULE_RESET_16: + reg = CPLD_REG_ADDR_RESET; + mask = 0x1 << (attr->index - MODULE_RESET_9); + break; + case MODULE_RESET_17 ... MODULE_RESET_24: + reg = CPLD_REG_ADDR_RESET; + mask = 0x1 << (attr->index - MODULE_RESET_17); + break; + case MODULE_RESET_25 ... MODULE_RESET_32: + reg = CPLD_REG_ADDR_RESET; + mask = 0x1 << (attr->index - MODULE_RESET_25); + break; + default: + return 0; + } + + /* Read current status */ + mutex_lock(&data->update_lock); + status = snj60d0_320f_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + + /* Update reset status */ + if (on) { + status |= mask; + } + else { + status &= ~mask; + } + + status = snj60d0_320f_cpld_write_internal(client, reg, status); + if (unlikely(status < 0)) { + goto exit; + } + + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; + +} + +static ssize_t access(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct snj60d0_320f_cpld_data *data = i2c_mux_priv(muxc); + int status; + u32 addr, val; + + if (sscanf(buf, "0x%x 0x%x", &addr, &val) != 2) { + return -EINVAL; + } + + if (addr > 0xFF || val > 0xFF) { + return -EINVAL; + } + + mutex_lock(&data->update_lock); + status = snj60d0_320f_cpld_write_internal(client, addr, val); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +/* Write to mux register. Don't use i2c_transfer()/i2c_smbus_xfer() + for this as they will try to lock adapter a second time */ +static int snj60d0_320f_cpld_mux_reg_write(struct i2c_adapter *adap, + struct i2c_client *client, u8 val) +{ + unsigned long orig_jiffies; + unsigned short flags; + union i2c_smbus_data data; + int try; + s32 res = -EIO; + + data.byte = val; + flags = client->flags; + flags &= I2C_M_TEN | I2C_CLIENT_PEC; + + if (adap->algo->smbus_xfer) { + /* Retry automatically on arbitration loss */ + orig_jiffies = jiffies; + for (res = 0, try = 0; try <= adap->retries; try++) { + res = adap->algo->smbus_xfer(adap, client->addr, flags, + I2C_SMBUS_WRITE, CPLD_CHANNEL_SELECT_REG, + I2C_SMBUS_BYTE_DATA, &data); + if (res != -EAGAIN) + break; + if (time_after(jiffies, + orig_jiffies + adap->timeout)) + break; + } + } + DEBUG_PRINT("snj60d0_320f_cpld_mux_reg_write: val:0x%x, res:0x%x", val, res); + return res; +} + +static int snj60d0_320f_cpld_mux_select_chan(struct i2c_mux_core *muxc, + u32 chan) +{ + struct snj60d0_320f_cpld_data *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + u8 regval; + int ret = 0; + + DEBUG_PRINT("snj60d0_320f_cpld_mux_select_chan: chan:%d", chan); + regval = 0x1 << chan; + /* Only select the channel if its different from the last channel */ + if (data->last_chan != regval) { + ret = snj60d0_320f_cpld_mux_reg_write(muxc->parent, client, regval); + data->last_chan = ret < 0 ? 0 : regval; + } + DEBUG_PRINT("snj60d0_320f_cpld_mux_select_chan: regval:0x%x , ret:0x%x", regval, ret); + return ret; +} + +static int snj60d0_320f_cpld_mux_deselect_mux(struct i2c_mux_core *muxc, + u32 chan) +{ + struct snj60d0_320f_cpld_data *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + + /* Deselect active channel */ + data->last_chan = chips[data->type].deselectChan; + DEBUG_PRINT("snj60d0_320f_cpld_mux_deselect_mux: data->last_chan:%d", data->last_chan); + return snj60d0_320f_cpld_mux_reg_write(muxc->parent, client, data->last_chan); +} + +static void snj60d0_320f_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +static void snj60d0_320f_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); +} + +static ssize_t show_version(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val = 0; + struct i2c_client *client = to_i2c_client(dev); + + val = i2c_smbus_read_byte_data(client, CPLD_REG_ADDR_REVISION); + + if (val < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(CPLD_REG_ADDR_REVISION) err %d\n", client->addr, val); + } + + return sprintf(buf, "%d", val); +} + +/* + * I2C init/probing/exit functions + */ +static int snj60d0_320f_cpld_mux_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); + int num, force, class; + struct i2c_mux_core *muxc; + struct snj60d0_320f_cpld_data *data; + int ret = 0; + const struct attribute_group *group = NULL; + + if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE)) + return -ENODEV; + + muxc = i2c_mux_alloc(adap, &client->dev, + chips[id->driver_data].nchans, sizeof(*data), 0, + snj60d0_320f_cpld_mux_select_chan, snj60d0_320f_cpld_mux_deselect_mux); + if (!muxc) + return -ENOMEM; + + i2c_set_clientdata(client, muxc); + data = i2c_mux_priv(muxc); + data->client = client; + data->type = id->driver_data; + data->last_chan = chips[data->type].deselectChan; /* force the first selection */ + mutex_init(&data->update_lock); + + /* Now create an adapter for each channel */ + for (num = 0; num < chips[data->type].nchans; num++) { + force = 0; /* dynamic adap number */ + class = 0; /* no class by default */ + + ret = i2c_mux_add_adapter(muxc, force, num, class); + + if (ret) { + dev_err(&client->dev, + "failed to register multiplexed adapter" + " %d as bus %d\n", num, force); + goto add_mux_failed; + } + } + + /* Register sysfs hooks */ + switch (data->type) { + case snj60d0_320f_cpld1: + group = &snj60d0_320f_cpld1_group; + /* Bring QSFPs out of reset */ + snj60d0_320f_cpld_write_internal(client, CPLD_REG_ADDR_RESET, 0x0); + break; + case snj60d0_320f_cpld2: + group = &snj60d0_320f_cpld2_group; + /* Bring QSFPs out of reset */ + snj60d0_320f_cpld_write_internal(client, CPLD_REG_ADDR_RESET, 0x0); + break; + case snj60d0_320f_cpld3: + group = &snj60d0_320f_cpld3_group; + /* Bring QSFPs out of reset */ + snj60d0_320f_cpld_write_internal(client, CPLD_REG_ADDR_RESET, 0x0); + + + + break; + case snj60d0_320f_cpld4: + group = &snj60d0_320f_cpld4_group; + /* Bring QSFPs out of reset */ + snj60d0_320f_cpld_write_internal(client, CPLD_REG_ADDR_RESET, 0x0); + break; + default: + break; + } + + if (group) { + ret = sysfs_create_group(&client->dev.kobj, group); + if (ret) { + goto add_mux_failed; + } + } + + if (chips[data->type].nchans) { + dev_info(&client->dev, + "registered %d multiplexed busses for I2C %s\n", + num, client->name); + } + else { + dev_info(&client->dev, + "device %s registered\n", client->name); + } + + snj60d0_320f_cpld_add_client(client); + + return 0; + +add_mux_failed: + i2c_mux_del_adapters(muxc); + return ret; +} + +static int snj60d0_320f_cpld_mux_remove(struct i2c_client *client) +{ + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct snj60d0_320f_cpld_data *data = i2c_mux_priv(muxc); + const struct attribute_group *group = NULL; + + snj60d0_320f_cpld_remove_client(client); + + /* Remove sysfs hooks */ + switch (data->type) { + case snj60d0_320f_cpld1: + group = &snj60d0_320f_cpld1_group; + break; + case snj60d0_320f_cpld2: + group = &snj60d0_320f_cpld2_group; + break; + case snj60d0_320f_cpld3: + group = &snj60d0_320f_cpld3_group; + break; + case snj60d0_320f_cpld4: + group = &snj60d0_320f_cpld4_group; + break; + default: + break; + } + + if (group) { + sysfs_remove_group(&client->dev.kobj, group); + } + + i2c_mux_del_adapters(muxc); + + return 0; +} + +static int snj60d0_320f_cpld_read_internal(struct i2c_client *client, u8 reg) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_read_byte_data(client, reg); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + DEBUG_PRINT("snj60d0_320f_cpld_read_internal: reg:0x%x, status:0x%x", reg, status); + return status; +} + +static int snj60d0_320f_cpld_write_internal(struct i2c_client *client, u8 reg, u8 value) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_write_byte_data(client, reg, value); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + DEBUG_PRINT("snj60d0_320f_cpld_write_internal: reg:0x%x, val:0x%x , status:0x%x", reg, value, status); + return status; +} + +int snj60d0_320f_cpld_read(unsigned short cpld_addr, u8 reg) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EPERM; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = snj60d0_320f_cpld_read_internal(cpld_node->client, reg); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(snj60d0_320f_cpld_read); + +int snj60d0_320f_cpld_write(unsigned short cpld_addr, u8 reg, u8 value) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EIO; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = snj60d0_320f_cpld_write_internal(cpld_node->client, reg, value); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(snj60d0_320f_cpld_write); + +static struct i2c_driver snj60d0_320f_cpld_mux_driver = { + .driver = { + .name = DRIVER_NAME, + .owner = THIS_MODULE, + }, + .probe = snj60d0_320f_cpld_mux_probe, + .remove = snj60d0_320f_cpld_mux_remove, + .id_table = snj60d0_320f_cpld_mux_id, +}; + +static int __init snj60d0_320f_cpld_mux_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&snj60d0_320f_cpld_mux_driver); +} + +static void __exit snj60d0_320f_cpld_mux_exit(void) +{ + i2c_del_driver(&snj60d0_320f_cpld_mux_driver); +} + +MODULE_AUTHOR("Fillmore Chen "); +MODULE_DESCRIPTION("Alphanetworks snj60d0_320f CPLD driver"); +MODULE_LICENSE("GPL"); + +module_init(snj60d0_320f_cpld_mux_init); +module_exit(snj60d0_320f_cpld_mux_exit); + diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/modules/snj60d0-320f_onie_eeprom.c b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/modules/snj60d0-320f_onie_eeprom.c new file mode 100644 index 000000000000..2a9f7fe016ae --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/modules/snj60d0-320f_onie_eeprom.c @@ -0,0 +1,209 @@ +/* + * A driver for alphanetworks_snj60d0_320f ONIE EEPROM + * + * Copyright (C) 2020 Alphanetworks Technology Corporation. + * Robin Chen + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * see + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include + +#define EEPROM_SIZE 256 + +static ssize_t onie_read(struct device *dev, struct device_attribute *attr, char *buf); +static ssize_t onie_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); + +/* Each client has this additional data + */ + +struct snj60d0_320f_onie_eeprom_data +{ + struct mutex update_lock; + unsigned char onie_eeprom[EEPROM_SIZE]; +}; + + +/* Addresses scanned for snj60d0-320f_onie_eeprom */ +static const unsigned short normal_i2c[] = { 0x56, I2C_CLIENT_END }; + +enum snj60d0_320f_onie_eeprom_sysfs_attributes { + ONIE_RW, +}; + +static SENSOR_DEVICE_ATTR(eeprom, (0660), onie_read, onie_write, ONIE_RW); + +static struct attribute *snj60d0_onie_attributes[] = { + &sensor_dev_attr_eeprom.dev_attr.attr, + NULL +}; + +static const struct attribute_group snj60d0_onie_group = { + .attrs = snj60d0_onie_attributes, +}; + + +static ssize_t onie_read(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val = 0, res = 0; + u8 command; + __u8 read_write; + unsigned short offset = 0; + union i2c_smbus_data temp; + struct i2c_client *client = to_i2c_client(dev); + struct snj60d0_320f_onie_eeprom_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + read_write = I2C_SMBUS_WRITE; + offset = offset & 0x3fff; + temp.byte = (u8)offset; + res = i2c_smbus_xfer(client->adapter, client->addr, client->flags=0, + read_write, 0, 2, &temp); + res = i2c_smbus_xfer(client->adapter, client->addr, client->flags=0, + read_write, 0, 2, &temp); + for( offset=0 ; offset < EEPROM_SIZE ; ++offset ) + { + read_write = I2C_SMBUS_READ; + res = i2c_smbus_xfer(client->adapter, client->addr, client->flags=0, + read_write, 0, 1, &temp); + if (!res) + { + data->onie_eeprom[offset] = temp.byte; + } + } + memcpy(buf, data->onie_eeprom, EEPROM_SIZE); + + mutex_unlock(&data->update_lock); + + return EEPROM_SIZE; +} + +static ssize_t onie_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + int error, write, command, read; + + error = kstrtoint(buf, 10, &write); + if (error) + return error; + + if (write < 0 || write > 255) + return -EINVAL; + + /* Not support yet */ + + return count; +} + +static int onie_eeprom_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct snj60d0_320f_onie_eeprom_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_dbg(&client->dev, "i2c_check_functionality failed (0x%x)\n", client->addr); + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct snj60d0_320f_onie_eeprom_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &snj60d0_onie_group); + if (status) { + goto exit_free; + } + + return 0; + +exit_free: + kfree(data); +exit: + return status; +} + +static int onie_eeprom_remove(struct i2c_client *client) +{ + struct snj60d0_320f_onie_eeprom_data *data = i2c_get_clientdata(client); + sysfs_remove_group(&client->dev.kobj, &snj60d0_onie_group); + kfree(data); + + return 0; +} + +static const struct i2c_device_id onie_eeprom_id[] = { + { "snj60d0_onie_eeprom", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, onie_eeprom_id); + +static struct i2c_driver onie_eeprom_driver = { + .driver = { + .name = "snj60d0_onie_eeprom", + }, + .probe = onie_eeprom_probe, + .remove = onie_eeprom_remove, + .id_table = onie_eeprom_id, + .address_list = normal_i2c, +}; + + +static int __init onie_eeprom_init(void) +{ + return i2c_add_driver(&onie_eeprom_driver); +} + +static void __exit onie_eeprom_exit(void) + +{ + i2c_del_driver(&onie_eeprom_driver); +} + +module_init(onie_eeprom_init); +module_exit(onie_eeprom_exit); + +MODULE_AUTHOR("Alpha-SID6"); +MODULE_DESCRIPTION("ONIE EEPROM Driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/modules/snj60d0-320f_sfp.c b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/modules/snj60d0-320f_sfp.c new file mode 100644 index 000000000000..beaac02d72fc --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/modules/snj60d0-320f_sfp.c @@ -0,0 +1,1327 @@ +/* + * SFP driver for alphanetworks snj60d0-320f sfp + * + * Copyright (C) 2019 Alphanetworks Technology Corporation. + * Philip Wang + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * see + * + * Copyright (C) Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_NAME "snj60d0-320f_sfp" + +#define DEBUG_MODE 0 + +#if (DEBUG_MODE == 1) + #define DEBUG_PRINT(fmt, args...) \ + printk (KERN_INFO "[%s,%d]: " fmt "\r\n", __FUNCTION__, __LINE__, ##args) +#else + #define DEBUG_PRINT(fmt, args...) +#endif + +#define NUM_OF_SFP_PORT 32 +#define EEPROM_NAME "sfp_eeprom" +#define EEPROM_SIZE 256 /* 256 byte eeprom */ +#define BIT_INDEX(i) (1ULL << (i)) +#define USE_I2C_BLOCK_READ 1 +#define I2C_RW_RETRY_COUNT 3 +#define I2C_RW_RETRY_INTERVAL 100 /* ms */ + +#define SFP_CPLD_I2C_ADDR 0x5F +#define SFP_EEPROM_A0_I2C_ADDR 0x50 +#define SFP_EEPROM_A2_I2C_ADDR 0x68 + +#define SFPPLUS_1_PORT_NUMBER 32 + +#define SFPPLUS_PRESENT_ADDRESS 0x28 + +#define SFP_CPLD_REG_ADDR_REVISION 0x00 +#define SFP_CPLD_REG_ADDR_PRESENT 0x03 +#define SFP_CPLD_REG_ADDR_RESET 0x04 +#define SFP_CPLD_REG_ADDR_LOWPOWERMODE 0x05 +#define SFP_CPLD_REG_ADDR_MODSELECT 0x06 +#define SFP_CPLD_REG_ADDR_LED 0x07 + +#define SFP_CPLD_REVISION_BIT 0xF + +u8 portCPLDID_0[]={13,14,15,16}; +u8 portCPLDID_1[]={14,15,16,17}; +u8 *portCPLDID; + + +#define SFF8024_PHYSICAL_DEVICE_ID_ADDR 0x0 +#define SFF8024_DEVICE_ID_SFP 0x3 +#define SFF8024_DEVICE_ID_QSFP 0xC +#define SFF8024_DEVICE_ID_QSFP_PLUS 0xD +#define SFF8024_DEVICE_ID_QSFP28 0x11 +#define SFF8024_DEVICE_ID_QSFPDD 0x18 + +#define SFF8472_DIAG_MON_TYPE_ADDR 92 +#define SFF8472_DIAG_MON_TYPE_DDM_MASK 0x40 +#define SFF8472_10G_ETH_COMPLIANCE_ADDR 0x3 +#define SFF8472_10G_BASE_MASK 0xF0 + +static ssize_t sfp_eeprom_read(struct i2c_client *, u8, u8 *,int); +static ssize_t sfp_eeprom_write(struct i2c_client *, u8 , const char *,int); + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { SFP_EEPROM_A0_I2C_ADDR, SFP_EEPROM_A2_I2C_ADDR, SFP_CPLD_I2C_ADDR, I2C_CLIENT_END }; + +#define CPLD_PORT_TO_FRONT_PORT(port) (port+1) + +enum port_numbers { +sfp1, sfp2, sfp3, sfp4, sfp5, sfp6, sfp7, sfp8, +sfp9, sfp10, sfp11, sfp12, sfp13, sfp14, sfp15, sfp16, +sfp17, sfp18, sfp19, sfp20, sfp21, sfp22, sfp23, sfp24, +sfp25, sfp26, sfp27, sfp28, sfp29, sfp30, sfp31, sfp32 +}; + +static const struct i2c_device_id qsfp_device_id[] = { +{ "sfpcpld1", sfp1 }, { "sfpcpld2", sfp2 }, { "sfpcpld3", sfp3 }, { "sfpcpld4", sfp4 }, +{ "sfpcpld5", sfp5 }, { "sfpcpld6", sfp6 }, { "sfpcpld7", sfp7 }, { "sfpcpld8", sfp8 }, +{ "sfpcpld9", sfp9 }, { "sfpcpld10", sfp10 }, { "sfpcpld11", sfp11 }, { "sfpcpld12", sfp12 }, +{ "sfpcpld13", sfp13 }, { "sfpcpld14", sfp14 }, { "sfpcpld15", sfp15 }, { "sfpcpld16", sfp16 }, +{ "sfpcpld17", sfp17 }, { "sfpcpld18", sfp18 }, { "sfpcpld19", sfp19 }, { "sfpcpld20", sfp20 }, +{ "sfpcpld21", sfp21 }, { "sfpcpld22", sfp22 }, { "sfpcpld23", sfp23 }, { "sfpcpld24", sfp24 }, +{ "sfpcpld25", sfp25 }, { "sfpcpld26", sfp26 }, { "sfpcpld27", sfp27 }, { "sfpcpld28", sfp28 }, +{ "sfpcpld29", sfp29 }, { "sfpcpld30", sfp30 }, { "sfpcpld31", sfp31 }, { "sfpcpld32", sfp32 }, +{} +}; +MODULE_DEVICE_TABLE(i2c, qsfp_device_id); + +/* + * list of valid port types + * note OOM_PORT_TYPE_NOT_PRESENT to indicate no + * module is present in this port + */ +typedef enum oom_driver_port_type_e { + OOM_DRIVER_PORT_TYPE_INVALID, + OOM_DRIVER_PORT_TYPE_NOT_PRESENT, + OOM_DRIVER_PORT_TYPE_SFP, + OOM_DRIVER_PORT_TYPE_SFP_PLUS, + OOM_DRIVER_PORT_TYPE_QSFP, + OOM_DRIVER_PORT_TYPE_QSFP_PLUS, + OOM_DRIVER_PORT_TYPE_QSFP28, + OOM_DRIVER_PORT_TYPE_QSFPDD +} oom_driver_port_type_t; + +enum driver_type_e { + DRIVER_TYPE_SFP_MSA, + DRIVER_TYPE_SFP_DDM, + DRIVER_TYPE_QSFP +}; + +/* Each client has this additional data + */ +struct eeprom_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + struct bin_attribute bin; /* eeprom data */ +}; + +struct sfp_msa_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u64 status[2]; /* index 0 => device id + 1 => 10G Ethernet Compliance Codes + to distinguish SFP or SFP+ + 2 => DIAGNOSTIC MONITORING TYPE */ + struct eeprom_data eeprom; +}; + +struct sfp_ddm_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u64 status[3]; /* bit0:port0, bit1:port1 and so on */ + /* index 0 => tx_fail + 1 => tx_disable + 2 => rx_loss */ + struct eeprom_data eeprom; +}; + +struct qsfp_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 status[2]; /* bit0:port0, bit1:port1 and so on */ + /* index 0 => reset + 1 => low power mode */ + + u8 device_id; + struct eeprom_data eeprom; +}; + +struct sfp_port_data { + struct mutex update_lock; + enum driver_type_e driver_type; + int port; /* CPLD port index */ + oom_driver_port_type_t port_type; + u64 present; /* present status, bit0:port0, bit1:port1 and so on */ + u64 port_reset; /* reset status, bit0:port0, bit1:port1 and so on */ + u64 port_lpmode; /* lpmode status, bit0:port0, bit1:port1 and so on */ + u64 port_led; /* port led status, bit0:port0, bit1:port1 and so on */ + + struct sfp_msa_data *msa; + struct sfp_ddm_data *ddm; + struct qsfp_data *qsfp; + + struct i2c_client *client; +}; + +enum sfp_sysfs_port_num_attributes { + PORT1_NUMBER, + PORT2_NUMBER, + PORT3_NUMBER, + PORT4_NUMBER, + PORT5_NUMBER, + PORT6_NUMBER, + PORT7_NUMBER, + PORT8_NUMBER, + PORT_NUMBER_MAX +}; + +enum sfp_sysfs_present_attributes { + PORT1_PRESENT, + PORT2_PRESENT, + PORT3_PRESENT, + PORT4_PRESENT, + PORT5_PRESENT, + PORT6_PRESENT, + PORT7_PRESENT, + PORT8_PRESENT, + PORT1_PRESENT_ALL, + PORT2_PRESENT_ALL, + PORT3_PRESENT_ALL, + PORT4_PRESENT_ALL, + PORT5_PRESENT_ALL, + PORT6_PRESENT_ALL, + PORT7_PRESENT_ALL, + PORT8_PRESENT_ALL, + PORT_PRESENT_MAX +}; + +enum sfp_sysfs_type_attributes { + PORT1_TYPE, + PORT2_TYPE, + PORT3_TYPE, + PORT4_TYPE, + PORT5_TYPE, + PORT6_TYPE, + PORT7_TYPE, + PORT8_TYPE, + PORT_TYPE_MAX +}; + +enum sfp_sysfs_reset_attributes { + PORT1_RESET, + PORT2_RESET, + PORT3_RESET, + PORT4_RESET, + PORT5_RESET, + PORT6_RESET, + PORT7_RESET, + PORT8_RESET, + PORT_RESET_MAX +}; + +enum sfp_sysfs_lpmode_attributes { + PORT1_LPMODE, + PORT2_LPMODE, + PORT3_LPMODE, + PORT4_LPMODE, + PORT5_LPMODE, + PORT6_LPMODE, + PORT7_LPMODE, + PORT8_LPMODE, + PORT_LPMODE_MAX +}; + +enum sfp_sysfs_eeprom_attributes { + PORT1_EEPROM, + PORT2_EEPROM, + PORT3_EEPROM, + PORT4_EEPROM, + PORT5_EEPROM, + PORT6_EEPROM, + PORT7_EEPROM, + PORT8_EEPROM, + PORT_EEPROM_MAX +}; + +enum sfp_sysfs_ddm_implemented_attributes { + PORT1_DDM_IMPLEMENTED, + PORT2_DDM_IMPLEMENTED, + PORT3_DDM_IMPLEMENTED, + PORT4_DDM_IMPLEMENTED, + PORT5_DDM_IMPLEMENTED, + PORT6_DDM_IMPLEMENTED, + PORT7_DDM_IMPLEMENTED, + PORT8_DDM_IMPLEMENTED, + PORT_DDM_IMPLEMENTED_MAX +}; + +enum sfp_sysfs_port_led_attributes { + PORT_LED, + PORT_LED_MAX +}; + +enum sfp_sysfs_cpld_revision_attributes { + CPLD_REVISION, + CPLD_REVISION_MAX +}; + +static ssize_t show_cpld_version(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val = 0; + struct i2c_client *client = to_i2c_client(dev); + + if (client->addr == SFP_CPLD_I2C_ADDR) + { + val = i2c_smbus_read_byte_data(client, SFP_CPLD_REG_ADDR_REVISION); + + if (val < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x0) err %d\n", client->addr, val); + } + } + + return sprintf(buf, "%d\n", (val & SFP_CPLD_REVISION_BIT)); +} + +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + DEBUG_PRINT("show_port_number port number:%d", data->port + attr->index); + return sprintf(buf, "%d\n", CPLD_PORT_TO_FRONT_PORT(data->port + attr->index)); +} + +static struct sfp_port_data *qsfp_update_present(struct i2c_client *client) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + int i = 0; + int status = -1; + u8 regs[] = {SFP_CPLD_REG_ADDR_PRESENT}; + + DEBUG_PRINT("Starting qsfp present status update"); + mutex_lock(&data->update_lock); + + /* Read present status of port 1~32 */ + data->present = 0; + + for (i = 0; i < ARRAY_SIZE(regs); i++) { + status = i2c_smbus_read_byte_data(client, regs[i]); + + if (status < 0) { + DEBUG_PRINT("cpld(%d) reg(0x%x) err %d", SFP_CPLD_I2C_ADDR, regs[i], status); + goto exit; + } + DEBUG_PRINT("Present status = 0x%x", status); + + data->present |= (u64)status << (i*8); + DEBUG_PRINT("Present status = 0x%llx", data->present); + } + + DEBUG_PRINT("Present status = 0x%llx", data->present); +exit: + mutex_unlock(&data->update_lock); + return data; +} + +static int qsfp_is_port_present(struct i2c_client *client, int port) +{ + struct sfp_port_data *data = qsfp_update_present(client); + + DEBUG_PRINT("present data: %llu, port:%d\n", data->present, port); + return (data->present & BIT_INDEX(port)) ? 1 : 0; +} + +static ssize_t show_qsfp_present(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + + /* PRESENT */ + return sprintf(buf, "%d\n", qsfp_is_port_present(client, attr->index)); +} + +static struct sfp_port_data *sfp_update_port_type(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + u8 buf = 0; + int status; + + mutex_lock(&data->update_lock); + + switch (data->driver_type) { + case DRIVER_TYPE_SFP_MSA: + { + status = sfp_eeprom_read(data->client, SFF8024_PHYSICAL_DEVICE_ID_ADDR, &buf, sizeof(buf)); + if (status < 0) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + if (buf != SFF8024_DEVICE_ID_SFP) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + status = sfp_eeprom_read(data->client, SFF8472_10G_ETH_COMPLIANCE_ADDR, &buf, sizeof(buf)); + if (status < 0) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + DEBUG_PRINT("sfp port type (0x3) data = (0x%x)", buf); + data->port_type = buf & SFF8472_10G_BASE_MASK ? OOM_DRIVER_PORT_TYPE_SFP_PLUS : OOM_DRIVER_PORT_TYPE_SFP; + break; + } + case DRIVER_TYPE_QSFP: + { + status = sfp_eeprom_read(data->client, SFF8024_PHYSICAL_DEVICE_ID_ADDR, &buf, sizeof(buf)); + if (status < 0) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + DEBUG_PRINT("qsfp port type (0x0) buf = (0x%x)", buf); + switch (buf) { + case SFF8024_DEVICE_ID_QSFP: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP; + break; + case SFF8024_DEVICE_ID_QSFP_PLUS: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP_PLUS; + break; + case SFF8024_DEVICE_ID_QSFP28: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP28; + break; + case SFF8024_DEVICE_ID_QSFPDD: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFPDD; + break; + default: + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + break; + } + default: + break; + } + + mutex_unlock(&data->update_lock); + return data; +} + +static ssize_t show_qsfp_port_type(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (!qsfp_is_port_present(client, attr->index)) { + return sprintf(buf, "%d\n", OOM_DRIVER_PORT_TYPE_NOT_PRESENT); + } + + sfp_update_port_type(dev); + return sprintf(buf, "%d\n", data->port_type); +} + +static struct sfp_port_data *qsfp_update_port_reset(struct i2c_client *client) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + int i = 0; + int status = -1; + u8 regs[] = {SFP_CPLD_REG_ADDR_RESET}; + + mutex_lock(&data->update_lock); + + /* Read reset status of port 1~32 */ + data->port_reset = 0; + + for (i = 0; i < ARRAY_SIZE(regs); i++) { + status = i2c_smbus_read_byte_data(client, regs[i]); + + if (status < 0) { + DEBUG_PRINT("cpld(0x%x) reg(0x%x) err %d", SFP_CPLD_REG_ADDR_RESET, regs[i], status); + goto exit; + } + + DEBUG_PRINT("reset status = 0x%x", status); + data->port_reset |= (u64)status << (i*8); + } + + DEBUG_PRINT("reset status = 0x%llx", data->port_reset); +exit: + mutex_unlock(&data->update_lock); + return data; +} + +static ssize_t show_port_reset(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + int is_reset = 0; + + if (!qsfp_is_port_present(client, attr->index)) { + return sprintf(buf, "%d\n", OOM_DRIVER_PORT_TYPE_NOT_PRESENT); + } + + qsfp_update_port_reset(client); + is_reset = (data->port_reset & BIT_INDEX(attr->index)); + + return sprintf(buf, "%d\n", is_reset); +} + +static ssize_t qsfp_set_port_reset(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + u8 cpld_reg = 0, cpld_val = 0; /*, cpld_bit = 0; //remove unused variable */ + long is_reset; + int error; + + error = kstrtol(buf, 10, &is_reset); + if (error) { + return error; + } + + mutex_lock(&data->update_lock); + + cpld_reg = SFP_CPLD_REG_ADDR_RESET; + + cpld_val = i2c_smbus_read_byte_data(client, cpld_reg); + + DEBUG_PRINT("current cpld reg = 0x%x value = 0x%x", cpld_reg, cpld_val); + + /* Update reset status. CPLD defined 0 is reset state, 1 is normal state. + * is_reset: 0 is not reset. 1 is reset. + */ + if (is_reset == 1) { + cpld_val |= BIT_INDEX(attr->index); + } + else { + cpld_val &= ~BIT_INDEX(attr->index); + } + + i2c_smbus_write_byte_data(client, cpld_reg, cpld_val); + DEBUG_PRINT("write cpld reg = 0x%x value = 0x%x", cpld_reg, cpld_val); + + mutex_unlock(&data->update_lock); + + return count; +} + +static struct sfp_port_data *qsfp_update_port_led(struct i2c_client *client) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + int status = -1; + u8 reg = SFP_CPLD_REG_ADDR_LED; + + mutex_lock(&data->update_lock); + + /* Read led status of port 1~32 */ + data->port_led = 0; + + status = i2c_smbus_read_byte_data(client, reg); + + if (status < 0) { + DEBUG_PRINT("cpld reg(0x%x) err %d", reg, status); + goto exit; + } + + data->port_led = status; + + DEBUG_PRINT("led status = %llu", data->port_led); +exit: + mutex_unlock(&data->update_lock); + return data; +} + +static ssize_t qsfp_show_port_led(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + data = qsfp_update_port_led(client); + + return sprintf(buf, "%llu", data->port_led); +} + +static ssize_t qsfp_set_port_led(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + u8 cpld_reg = 0, cpld_val = 0; /*, cpld_bit = 0; //remove unused variable */ + long led_state; + int error; + int result; + + error = kstrtol(buf, 10, &led_state); + if (error) { + return error; + } + + mutex_lock(&data->update_lock); + + cpld_reg = SFP_CPLD_REG_ADDR_LED; + + cpld_val = i2c_smbus_read_byte_data(client, cpld_reg); + + DEBUG_PRINT("current cpld reg = 0x%x value = 0x%x", cpld_reg, cpld_val); + + /* Update led status. CPLD defined 0 is LED enable, 1 is LED disable. + * led_state: 0 is LED enable. 1 is LED disable. + */ + if (cpld_val != led_state){ + data->port_led = led_state; + + result = i2c_smbus_write_byte_data(client, cpld_reg, led_state); + if (result < 0) { + dev_info(&client->dev, "%s, i2c_smbus_write_byte_data fail(%d)", __FUNCTION__, result); + } + DEBUG_PRINT("write cpld reg = 0x%x value = %lu", cpld_reg, led_state); + } + + mutex_unlock(&data->update_lock); + + return count; +} + +static struct sfp_port_data *qsfp_update_port_lpmode(struct i2c_client *client) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + int i = 0; + int status = -1; + u8 regs[] = {SFP_CPLD_REG_ADDR_LOWPOWERMODE}; + + mutex_lock(&data->update_lock); + + /* Read lpmode status of port 1~32 */ + data->port_lpmode = 0; + + for (i = 0; i < ARRAY_SIZE(regs); i++) { + status = i2c_smbus_read_byte_data(client, regs[i]); + + if (status < 0) { + DEBUG_PRINT("cpld reg(0x%x) err %d", regs[i], status); + goto exit; + } + + DEBUG_PRINT("lpmode status = 0x%x", status); + data->port_lpmode |= (u64)status << (i*8); + } + + DEBUG_PRINT("lpmode status = 0x%llx", data->port_lpmode); +exit: + mutex_unlock(&data->update_lock); + return data; +} + +static ssize_t qsfp_show_port_lpmode(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + int is_lpmode = 0; + + qsfp_update_port_lpmode(client); + is_lpmode = (data->port_lpmode & BIT_INDEX(attr->index))?1:0; + + return sprintf(buf, "%d\n", is_lpmode); +} + +static ssize_t qsfp_set_port_lpmode(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + u8 cpld_reg = 0, cpld_val = 0; + long is_lpmode; + int error; + + error = kstrtol(buf, 10, &is_lpmode); + if (error) { + return error; + } + + mutex_lock(&data->update_lock); + + cpld_reg = SFP_CPLD_REG_ADDR_LOWPOWERMODE; + + cpld_val = i2c_smbus_read_byte_data(client, cpld_reg); + + DEBUG_PRINT("current cpld reg = 0x%x value = 0x%x", cpld_reg, cpld_val); + + /* Update lpmode status. CPLD defined 0 is normal mode, 1 is Low Power mode. + * is_lpmode: 0 is normal mode. 1 is Low Power mode. + */ + if (is_lpmode == 1) { + cpld_val |= BIT_INDEX(attr->index); + } + else { + cpld_val &= ~BIT_INDEX(attr->index); + } + + i2c_smbus_write_byte_data(client, cpld_reg, cpld_val); + DEBUG_PRINT("write cpld reg = 0x%x value = 0x%x", cpld_reg, cpld_val); + + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t sfp_show_eeprom(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + char devfile[96]; + struct file *sfd; + int i2c_index = 0; + int result; + int offset[] = {SFP_CPLD_REG_ADDR_MODSELECT}; + int rdlen, rc; + mm_segment_t old_fs; + char buffer[256]; + + if (!qsfp_is_port_present(client, attr->index)) { + return 0; + } + + snprintf(devfile, sizeof(devfile), "/sys/bus/i2c/devices/0-0070/name"); + + /* Read SFP EEPROM */ + sfd = filp_open(devfile, O_RDONLY, 0); + if (IS_ERR(sfd)) { + dev_info(&client->dev, "Failed to open file(%s)#%d", devfile, __LINE__); + portCPLDID = portCPLDID_1; + } + else{ + portCPLDID = portCPLDID_0; + } + + if(strcmp(client->name, "sfpcpld1") == 0) + i2c_index = portCPLDID[0]; + else if(strcmp(client->name, "sfpcpld9") == 0) + i2c_index = portCPLDID[1]; + else if(strcmp(client->name, "sfpcpld17") == 0) + i2c_index = portCPLDID[2]; + else if(strcmp(client->name, "sfpcpld25") == 0) + i2c_index = portCPLDID[3]; + /* Port number is 1-8 */ + result = i2c_smbus_write_byte_data(client, offset[0], BIT_INDEX(attr->index)); + if (result < 0) { + dev_info(&client->dev, "%s, i2c_smbus_write_byte_data fail(%d)", __FUNCTION__, result); + } + + snprintf(devfile, sizeof(devfile), "/sys/bus/i2c/devices/%d-0050/sfp_eeprom", i2c_index); + + /* Read SFP EEPROM */ + sfd = filp_open(devfile, O_RDONLY, 0); + if (IS_ERR(sfd)) { + dev_info(&client->dev, "Failed to open file(%s)#%d", devfile, __LINE__); + return 0; + } + + if(!(sfd->f_op) || !(sfd->f_op->read) ) { + dev_info(&client->dev, "file %s cann't readable ?\n", devfile); + return 0; + } + + old_fs = get_fs(); + set_fs(KERNEL_DS); + rdlen = sfd->f_op->read(sfd, buffer, sizeof(buffer), &sfd->f_pos); + if (rdlen == 0) { + dev_info(&client->dev, "File(%s) empty!\n", devfile); + rc = 0; + goto exit; + } + + rc = sizeof(buffer); + memcpy(buf, buffer, rc); + + /* Reset module select register */ + if(strcmp(client->name, "sfpcpld33") != 0){ + /* Port number is 1-8 */ + result = i2c_smbus_write_byte_data(client, offset[0], 0); + if (result < 0) { + dev_info(&client->dev, "%s, i2c_smbus_write_byte_data fail(%d)", __FUNCTION__, result); + } + } + +exit: + set_fs(old_fs); + filp_close(sfd, 0); + + return rc; +} + +/* SFP/QSFP common attributes for sysfs */ +#define DECLARE_PORT_NUMBER_SENSOR_DEVICE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT1##_NUMBER); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT2##_NUMBER); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT3##_NUMBER); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT4##_NUMBER); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT5##_NUMBER); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT6##_NUMBER); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT7##_NUMBER); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_port_number, S_IRUGO, show_port_number, NULL, PORT##PORT8##_NUMBER); +#define DECLARE_PORT_NUMBER_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + &sensor_dev_attr_sfp##PORT1##_port_number.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_port_number.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_port_number.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_port_number.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_port_number.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_port_number.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_port_number.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_port_number.dev_attr.attr, +DECLARE_PORT_NUMBER_SENSOR_DEVICE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + +#define DECLARE_PORT_IS_PRESENT_SENSOR_DEVICE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_is_present, S_IRUGO, show_qsfp_present, NULL, PORT##PORT1##_PRESENT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_is_present, S_IRUGO, show_qsfp_present, NULL, PORT##PORT2##_PRESENT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_is_present, S_IRUGO, show_qsfp_present, NULL, PORT##PORT3##_PRESENT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_is_present, S_IRUGO, show_qsfp_present, NULL, PORT##PORT4##_PRESENT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_is_present, S_IRUGO, show_qsfp_present, NULL, PORT##PORT5##_PRESENT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_is_present, S_IRUGO, show_qsfp_present, NULL, PORT##PORT6##_PRESENT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_is_present, S_IRUGO, show_qsfp_present, NULL, PORT##PORT7##_PRESENT); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_is_present, S_IRUGO, show_qsfp_present, NULL, PORT##PORT8##_PRESENT); +#define DECLARE_PORT_IS_PRESENT_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + &sensor_dev_attr_sfp##PORT1##_is_present.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_is_present.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_is_present.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_is_present.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_is_present.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_is_present.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_is_present.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_is_present.dev_attr.attr, +DECLARE_PORT_IS_PRESENT_SENSOR_DEVICE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + +#define DECLARE_PORT_TYPE_SENSOR_DEVICE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_port_type, S_IRUGO, show_qsfp_port_type, NULL, PORT##PORT1##_TYPE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_port_type, S_IRUGO, show_qsfp_port_type, NULL, PORT##PORT2##_TYPE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_port_type, S_IRUGO, show_qsfp_port_type, NULL, PORT##PORT3##_TYPE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_port_type, S_IRUGO, show_qsfp_port_type, NULL, PORT##PORT4##_TYPE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_port_type, S_IRUGO, show_qsfp_port_type, NULL, PORT##PORT5##_TYPE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_port_type, S_IRUGO, show_qsfp_port_type, NULL, PORT##PORT6##_TYPE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_port_type, S_IRUGO, show_qsfp_port_type, NULL, PORT##PORT7##_TYPE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_port_type, S_IRUGO, show_qsfp_port_type, NULL, PORT##PORT8##_TYPE); +#define DECLARE_PORT_TYPE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) &sensor_dev_attr_sfp##PORT1##_port_type.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_port_type.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_port_type.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_port_type.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_port_type.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_port_type.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_port_type.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_port_type.dev_attr.attr, +DECLARE_PORT_TYPE_SENSOR_DEVICE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + +#define DECLARE_PORT_RESET_SENSOR_DEVICE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, qsfp_set_port_reset, PORT##PORT1##_RESET); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, qsfp_set_port_reset, PORT##PORT2##_RESET); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, qsfp_set_port_reset, PORT##PORT3##_RESET); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, qsfp_set_port_reset, PORT##PORT4##_RESET); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, qsfp_set_port_reset, PORT##PORT5##_RESET); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, qsfp_set_port_reset, PORT##PORT6##_RESET); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, qsfp_set_port_reset, PORT##PORT7##_RESET); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_port_reset, S_IWUSR | S_IRUGO, show_port_reset, qsfp_set_port_reset, PORT##PORT8##_RESET); +#define DECLARE_PORT_RESET_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + &sensor_dev_attr_sfp##PORT1##_port_reset.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_port_reset.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_port_reset.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_port_reset.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_port_reset.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_port_reset.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_port_reset.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_port_reset.dev_attr.attr, +DECLARE_PORT_RESET_SENSOR_DEVICE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + +#define DECLARE_PORT_LED_DEVICE_ATTR() \ + static SENSOR_DEVICE_ATTR(sfp_led_disable, S_IWUSR | S_IRUGO, qsfp_show_port_led, qsfp_set_port_led, PORT_LED); +#define DECLARE_PORT_LED_ATTR() \ + &sensor_dev_attr_sfp_led_disable.dev_attr.attr, +DECLARE_PORT_LED_DEVICE_ATTR() + +#define DECLARE_PORT_EEPROM_SENSOR_DEVICE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_eeprom, S_IRUGO, sfp_show_eeprom, NULL, PORT##PORT1##_EEPROM); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_eeprom, S_IRUGO, sfp_show_eeprom, NULL, PORT##PORT2##_EEPROM); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_eeprom, S_IRUGO, sfp_show_eeprom, NULL, PORT##PORT3##_EEPROM); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_eeprom, S_IRUGO, sfp_show_eeprom, NULL, PORT##PORT4##_EEPROM); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_eeprom, S_IRUGO, sfp_show_eeprom, NULL, PORT##PORT5##_EEPROM); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_eeprom, S_IRUGO, sfp_show_eeprom, NULL, PORT##PORT6##_EEPROM); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_eeprom, S_IRUGO, sfp_show_eeprom, NULL, PORT##PORT7##_EEPROM); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_eeprom, S_IRUGO, sfp_show_eeprom, NULL, PORT##PORT8##_EEPROM); +#define DECLARE_PORT_EEPROMT_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + &sensor_dev_attr_sfp##PORT1##_eeprom.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_eeprom.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_eeprom.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_eeprom.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_eeprom.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_eeprom.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_eeprom.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_eeprom.dev_attr.attr, +DECLARE_PORT_EEPROM_SENSOR_DEVICE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + +#define DECLARE_PORT_LPMODE_SENSOR_DEVICE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + static SENSOR_DEVICE_ATTR(sfp##PORT1##_lpmode, S_IWUSR | S_IRUGO, qsfp_show_port_lpmode, qsfp_set_port_lpmode, PORT##PORT1##_LPMODE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT2##_lpmode, S_IWUSR | S_IRUGO, qsfp_show_port_lpmode, qsfp_set_port_lpmode, PORT##PORT2##_LPMODE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT3##_lpmode, S_IWUSR | S_IRUGO, qsfp_show_port_lpmode, qsfp_set_port_lpmode, PORT##PORT3##_LPMODE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT4##_lpmode, S_IWUSR | S_IRUGO, qsfp_show_port_lpmode, qsfp_set_port_lpmode, PORT##PORT4##_LPMODE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT5##_lpmode, S_IWUSR | S_IRUGO, qsfp_show_port_lpmode, qsfp_set_port_lpmode, PORT##PORT5##_LPMODE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT6##_lpmode, S_IWUSR | S_IRUGO, qsfp_show_port_lpmode, qsfp_set_port_lpmode, PORT##PORT6##_LPMODE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT7##_lpmode, S_IWUSR | S_IRUGO, qsfp_show_port_lpmode, qsfp_set_port_lpmode, PORT##PORT7##_LPMODE); \ + static SENSOR_DEVICE_ATTR(sfp##PORT8##_lpmode, S_IWUSR | S_IRUGO, qsfp_show_port_lpmode, qsfp_set_port_lpmode, PORT##PORT8##_LPMODE); +#define DECLARE_PORT_LPMODE_ATTR(PORT1, PORT2, PORT3, PORT4, PORT5, PORT6, PORT7, PORT8) \ + &sensor_dev_attr_sfp##PORT1##_lpmode.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT2##_lpmode.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT3##_lpmode.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT4##_lpmode.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT5##_lpmode.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT6##_lpmode.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT7##_lpmode.dev_attr.attr, \ + &sensor_dev_attr_sfp##PORT8##_lpmode.dev_attr.attr, +DECLARE_PORT_LPMODE_SENSOR_DEVICE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + +#define DECLARE_PORT_CPLD_REVISION() \ + static SENSOR_DEVICE_ATTR(cpld_revision, (0660), show_cpld_version, NULL, CPLD_REVISION); +#define DECLARE_PORT_CPLD_REVISION_ATTR() \ + &sensor_dev_attr_cpld_revision.dev_attr.attr, +DECLARE_PORT_CPLD_REVISION() + +static struct attribute *qsfp_attributes[] = { + DECLARE_PORT_NUMBER_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_TYPE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_IS_PRESENT_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_RESET_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_LPMODE_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_LED_ATTR() + DECLARE_PORT_EEPROMT_ATTR(1, 2, 3, 4, 5, 6, 7, 8) + DECLARE_PORT_CPLD_REVISION_ATTR() + NULL +}; + +static ssize_t sfp_eeprom_write(struct i2c_client *client, u8 command, const char *data, + int data_len) +{ +#if USE_I2C_BLOCK_READ + int result, retry = I2C_RW_RETRY_COUNT; + + if (data_len > I2C_SMBUS_BLOCK_MAX) { + data_len = I2C_SMBUS_BLOCK_MAX; + } + + while (retry) { + result = i2c_smbus_write_i2c_block_data(client, command, data_len, data); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) { + return result; + } + + return data_len; +#else + int result, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + result = i2c_smbus_write_byte_data(client, command, *data); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) { + return result; + } + + return 1; +#endif +} + +static ssize_t sfp_port_write(struct sfp_port_data *data, + const char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) { + return count; + } + + /* + * Write data to chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&data->update_lock); + + while (count) { + ssize_t status; + + status = sfp_eeprom_write(data->client, off, buf, count); + if (status <= 0) { + if (retval == 0) { + retval = status; + } + break; + } + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&data->update_lock); + return retval; +} + +static ssize_t sfp_bin_write(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct sfp_port_data *data; + DEBUG_PRINT("offset = (%d), count = (%d)", (int)off, (int)count); + data = dev_get_drvdata(container_of(kobj, struct device, kobj)); + return sfp_port_write(data, buf, off, count); +} + +static ssize_t sfp_eeprom_read(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ +#if USE_I2C_BLOCK_READ + int result, retry = I2C_RW_RETRY_COUNT; + + if (data_len > I2C_SMBUS_BLOCK_MAX) { + data_len = I2C_SMBUS_BLOCK_MAX; + } + + while (retry) { + result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) + goto abort; + if (unlikely(result != data_len)) { + result = -EIO; + goto abort; + } + + /* result = data_len; */ + +abort: + return result; +#else + int result, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + result = i2c_smbus_read_byte_data(client, command); + if (result < 0) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(result < 0)) { + dev_dbg(&client->dev, "sfp read byte data failed, command(0x%2x), data(0x%2x)\r\n", command, result); + goto abort; + } + + *data = (u8)result; + result = 1; + +abort: + return result; +#endif +} + +static ssize_t sfp_port_read(struct sfp_port_data *data, + char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) { + DEBUG_PRINT("Count = 0, return"); + return count; + } + + /* + * Read data from chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&data->update_lock); + + while (count) { + ssize_t status; + + status = sfp_eeprom_read(data->client, off, buf, count); + if (status <= 0) { + if (retval == 0) { + retval = status; + } + break; + } + + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&data->update_lock); + return retval; + +} + +static ssize_t sfp_bin_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct sfp_port_data *data; + DEBUG_PRINT("offset = (%d), count = (%d)", (int)off, (int)count); + data = dev_get_drvdata(container_of(kobj, struct device, kobj)); + return sfp_port_read(data, buf, off, count); +} + +static int sfp_sysfs_eeprom_init(struct kobject *kobj, struct bin_attribute *eeprom) +{ + int err; + + sysfs_bin_attr_init(eeprom); + eeprom->attr.name = EEPROM_NAME; + eeprom->attr.mode = S_IWUSR | S_IRUGO; + eeprom->read = sfp_bin_read; + eeprom->write = sfp_bin_write; + eeprom->size = EEPROM_SIZE; + + /* Create eeprom file */ + err = sysfs_create_bin_file(kobj, eeprom); + if (err) { + return err; + } + + return 0; +} + +static int sfp_sysfs_eeprom_cleanup(struct kobject *kobj, struct bin_attribute *eeprom) +{ + sysfs_remove_bin_file(kobj, eeprom); + return 0; +} + +static int sfp_i2c_check_functionality(struct i2c_client *client) +{ +#if USE_I2C_BLOCK_READ + return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK); +#else + return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA); +#endif +} + +static const struct attribute_group qsfp_group = { + .attrs = qsfp_attributes, +}; + +static int qsfp_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct qsfp_data **data) +{ + int status; + struct qsfp_data *qsfp; + struct sfp_port_data *port_data = i2c_get_clientdata(client); + + + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } + + qsfp = kzalloc(sizeof(struct qsfp_data), GFP_KERNEL); + if (!qsfp) { + status = -ENOMEM; + goto exit; + } + + DEBUG_PRINT("port: %d, address: %04x\n", port_data->port, client->addr); + /* Register sysfs hooks */ + if ((port_data->port < SFPPLUS_1_PORT_NUMBER) && (client->addr == SFP_CPLD_I2C_ADDR)) + { + status = sysfs_create_group(&client->dev.kobj, &qsfp_group); + if (status) { + goto exit_free; + } + } + + if (client->addr == SFP_EEPROM_A0_I2C_ADDR){ + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &qsfp->eeprom.bin); + if (status) { + goto exit_remove; + } + } + + /* Bring QSFPs out of reset */ + + *data = qsfp; + dev_info(&client->dev, "qsfp '%s'\n", client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &qsfp_group); +exit_free: + kfree(qsfp); +exit: + + return status; +} + +static int qsfp_device_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct sfp_port_data *data = NULL; + + data = kzalloc(sizeof(struct sfp_port_data), GFP_KERNEL); + if (!data) { + return -ENOMEM; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->port = dev_id->driver_data; + data->client = client; + + if (client->addr == SFP_CPLD_I2C_ADDR){ + if(data->port >= SFPPLUS_1_PORT_NUMBER){ + DEBUG_PRINT("client->addr:0x%0x\n", client->addr); + return -ENODEV; + } + } + + DEBUG_PRINT("data->port:%d client->addr:0x%0x\n", data->port, client->addr); + if(data->port < SFPPLUS_1_PORT_NUMBER){ + /* QSFP port probe */ + data->driver_type = DRIVER_TYPE_QSFP; + return qsfp_probe(client, dev_id, &data->qsfp); + } + + return 0; +} + +static int qsfp_remove(struct i2c_client *client, struct qsfp_data *data) +{ + if (client->addr == SFP_EEPROM_A0_I2C_ADDR) + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + if ((client->addr == SFP_CPLD_I2C_ADDR) || (client->addr == SFP_EEPROM_A0_I2C_ADDR)) + sysfs_remove_group(&client->dev.kobj, &qsfp_group); + kfree(data); + return 0; +} + +static int qsfp_device_remove(struct i2c_client *client) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + + if (data->driver_type == DRIVER_TYPE_QSFP) + return qsfp_remove(client, data->qsfp); + + return 0; +} + +static struct i2c_driver qsfp_driver = { + .driver = { + .name = DRIVER_NAME, + }, + .probe = qsfp_device_probe, + .remove = qsfp_device_remove, + .id_table = qsfp_device_id, + .address_list = normal_i2c, +}; + +static int __init sfp_init(void) +{ + return i2c_add_driver(&qsfp_driver); +} + +static void __exit sfp_exit(void) +{ + i2c_del_driver(&qsfp_driver); +} + +MODULE_AUTHOR("Philip Wang "); +MODULE_DESCRIPTION("alphanetworks snj60d0-320f driver"); +MODULE_LICENSE("GPL"); + +module_init(sfp_init); +module_exit(sfp_exit); + diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/modules/yesm1300am.c b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/modules/yesm1300am.c new file mode 100644 index 000000000000..aaba94a77eca --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/modules/yesm1300am.c @@ -0,0 +1,459 @@ +/* + * An hwmon driver for the 3Y Power YESM1300AM Power Module + * + * Copyright (C) 2014 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* PMBus Protocol. */ +#define PSU_REG_VOUT_MODE 0x20 +#define PSU_REG_READ_VIN 0x88 +#define PSU_REG_READ_IIN 0x89 +#define PSU_REG_READ_VOUT 0x8B +#define PSU_REG_READ_IOUT 0x8C +#define PSU_REG_READ_TEMPERATURE_1 0x8D +#define PSU_REG_READ_FAN_SPEED_1 0x90 +#define PSU_REG_READ_POUT 0x96 +#define PSU_REG_READ_PIN 0x97 +#define PSU_REG_MFR_ID 0x99 +#define PSU_REG_MFR_MODEL 0x9A +#define PSU_REG_MFR_POUT_MAX 0xA7 + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = {0x58, 0x59, I2C_CLIENT_END}; + +/* Each client has this additional data + */ +struct yesm1300am_data +{ + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 vout_mode; /* Register value */ + u16 v_in; /* Register value */ + u16 v_out; /* Register value */ + u16 i_in; /* Register value */ + u16 i_out; /* Register value */ + u16 p_in; /* Register value */ + u16 p_out; /* Register value */ + u16 temp1_input; /* Register value */ + u16 fan_speed; /* Register value */ + u8 mfr_id[10]; /* Register value */ + u8 mfr_model[12]; /* Register value */ + u16 mfr_pout_max; /* Register value */ +}; + +static ssize_t show_vout_by_mode(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_linear(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_ascii(struct device *dev, struct device_attribute *da, char *buf); +static struct yesm1300am_data *yesm1300am_update_device(struct device *dev); + +enum yesm1300am_sysfs_attributes +{ + PSU_V_IN, + PSU_V_OUT, + PSU_I_IN, + PSU_I_OUT, + PSU_P_IN, + PSU_P_OUT_UW, + PSU_P_OUT, + PSU_TEMP1_INPUT, + PSU_FAN1_SPEED, + PSU_MFR_ID, + PSU_MODEL_NAME, + PSU_MFR_POUT_MAX +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_v_in, S_IRUGO, show_linear, NULL, PSU_V_IN); +static SENSOR_DEVICE_ATTR(psu_v_out, S_IRUGO, show_vout_by_mode, NULL, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(psu_i_in, S_IRUGO, show_linear, NULL, PSU_I_IN); +static SENSOR_DEVICE_ATTR(psu_i_out, S_IRUGO, show_linear, NULL, PSU_I_OUT); +static SENSOR_DEVICE_ATTR(psu_p_in, S_IRUGO, show_linear, NULL, PSU_P_IN); +static SENSOR_DEVICE_ATTR(psu_p_out, S_IRUGO, show_linear, NULL, PSU_P_OUT); +static SENSOR_DEVICE_ATTR(psu_temp1_input, S_IRUGO, show_linear, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(psu_fan1_speed_rpm, S_IRUGO, show_linear, NULL, PSU_FAN1_SPEED); +static SENSOR_DEVICE_ATTR(psu_mfr_id, S_IRUGO, show_ascii, NULL, PSU_MFR_ID); +static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_ascii, NULL, PSU_MODEL_NAME); +static SENSOR_DEVICE_ATTR(psu_mfr_pout_max, S_IRUGO, show_linear, NULL, PSU_MFR_POUT_MAX); + +/*Duplicate nodes for lm-sensors.*/ +static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_vout_by_mode, NULL, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(curr2_input, S_IRUGO, show_linear, NULL, PSU_I_OUT); +static SENSOR_DEVICE_ATTR(power2_input, S_IRUGO, show_linear, NULL, PSU_P_OUT_UW); +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_linear, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_linear, NULL, PSU_FAN1_SPEED); + +static struct attribute *yesm1300am_attributes[] = { + &sensor_dev_attr_psu_v_in.dev_attr.attr, + &sensor_dev_attr_psu_v_out.dev_attr.attr, + &sensor_dev_attr_psu_i_in.dev_attr.attr, + &sensor_dev_attr_psu_i_out.dev_attr.attr, + &sensor_dev_attr_psu_p_in.dev_attr.attr, + &sensor_dev_attr_psu_p_out.dev_attr.attr, + &sensor_dev_attr_psu_temp1_input.dev_attr.attr, + &sensor_dev_attr_psu_fan1_speed_rpm.dev_attr.attr, + &sensor_dev_attr_psu_mfr_id.dev_attr.attr, + &sensor_dev_attr_psu_model_name.dev_attr.attr, + &sensor_dev_attr_psu_mfr_pout_max.dev_attr.attr, + /*Duplicate nodes for lm-sensors.*/ + &sensor_dev_attr_curr2_input.dev_attr.attr, + &sensor_dev_attr_in3_input.dev_attr.attr, + &sensor_dev_attr_power2_input.dev_attr.attr, + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_fan1_input.dev_attr.attr, + NULL}; + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + +static ssize_t show_linear(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct yesm1300am_data *data = yesm1300am_update_device(dev); + + u16 value = 0; + int exponent, mantissa; + int multiplier = 1000; + + switch (attr->index) + { + case PSU_V_IN: + value = data->v_in; + break; + case PSU_I_IN: + value = data->i_in; + break; + case PSU_I_OUT: + value = data->i_out; + break; + case PSU_P_IN: + value = data->p_in; + break; + case PSU_P_OUT: + value = data->p_out; + break; + case PSU_P_OUT_UW: + value = data->p_out; + multiplier = 1000000; + break; + case PSU_TEMP1_INPUT: + value = data->temp1_input; + break; + case PSU_FAN1_SPEED: + value = data->fan_speed; + multiplier = 1; + break; + case PSU_MFR_POUT_MAX: + value = data->mfr_pout_max; + break; + } + + exponent = two_complement_to_int(value >> 11, 5, 0x1f); + mantissa = two_complement_to_int(value & 0x7ff, 11, 0x7ff); + return (exponent >= 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) : sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static ssize_t show_ascii(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct yesm1300am_data *data = yesm1300am_update_device(dev); + u8 *ptr = NULL; + + switch (attr->index) + { + case PSU_MFR_ID: /* psu_mfr_id */ + ptr = data->mfr_id; + break; + case PSU_MODEL_NAME: /* psu_mfr_model */ + ptr = data->mfr_model; + break; + default: + return 0; + } + + return sprintf(buf, "%s\n", ptr); +} + +static ssize_t show_vout_by_mode(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct yesm1300am_data *data = yesm1300am_update_device(dev); + int exponent, mantissa; + int multiplier = 1000; + + if (!data->valid) + { + return 0; + } + + exponent = two_complement_to_int(data->vout_mode, 5, 0x1f); + switch (attr->index) + { + case PSU_V_OUT: + mantissa = data->v_out; + break; + default: + return 0; + } + + return (exponent > 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) : sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static const struct attribute_group yesm1300am_group = { + .attrs = yesm1300am_attributes, +}; + +static int yesm1300am_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct yesm1300am_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA | + I2C_FUNC_SMBUS_I2C_BLOCK)) + { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct yesm1300am_data), GFP_KERNEL); + if (!data) + { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &yesm1300am_group); + if (status) + { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) + { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &yesm1300am_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int yesm1300am_remove(struct i2c_client *client) +{ + struct yesm1300am_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &yesm1300am_group); + kfree(data); + + return 0; +} + +static const struct i2c_device_id yesm1300am_id[] = { + {"yesm1300am", 0}, + {} +}; +MODULE_DEVICE_TABLE(i2c, yesm1300am_id); + +static struct i2c_driver yesm1300am_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "yesm1300am", + }, + .probe = yesm1300am_probe, + .remove = yesm1300am_remove, + .id_table = yesm1300am_id, + .address_list = normal_i2c, +}; + +static int yesm1300am_read_byte(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int yesm1300am_read_word(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_word_data(client, reg); +} + +static int yesm1300am_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + + if (unlikely(result < 0)) + goto abort; + if (unlikely(result != data_len)) + { + result = -EIO; + goto abort; + } + + result = 0; + +abort: + return result; +} + +struct reg_data_byte +{ + u8 reg; + u8 *value; +}; + +struct reg_data_word +{ + u8 reg; + u16 *value; +}; + +static struct yesm1300am_data *yesm1300am_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct yesm1300am_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || !data->valid) + { + int i, status; + u8 command; + struct reg_data_byte regs_byte[] = {{PSU_REG_VOUT_MODE, &data->vout_mode}}; + struct reg_data_word regs_word[] = {{PSU_REG_READ_VIN, &data->v_in}, + {PSU_REG_READ_VOUT, &data->v_out}, + {PSU_REG_READ_IIN, &data->i_in}, + {PSU_REG_READ_IOUT, &data->i_out}, + {PSU_REG_READ_PIN, &data->p_in}, + {PSU_REG_READ_POUT, &data->p_out}, + {PSU_REG_READ_TEMPERATURE_1, &data->temp1_input}, + {PSU_REG_READ_FAN_SPEED_1, &data->fan_speed}, + {PSU_REG_MFR_POUT_MAX, &data->mfr_pout_max}}; + + dev_dbg(&client->dev, "Starting yesm1300am update\n"); + + /* Read byte data */ + for (i = 0; i < ARRAY_SIZE(regs_byte); i++) + { + status = yesm1300am_read_byte(client, regs_byte[i].reg); + + if (status < 0) + { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_byte[i].reg, status); + *(regs_byte[i].value) = 0; + } + else + { + *(regs_byte[i].value) = status; + } + } + + /* Read word data */ + for (i = 0; i < ARRAY_SIZE(regs_word); i++) + { + status = yesm1300am_read_word(client, regs_word[i].reg); + + if (status < 0) + { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_word[i].reg, status); + *(regs_word[i].value) = 0; + } + else + { + *(regs_word[i].value) = status; + } + } + + /* Read mfr_id */ + command = PSU_REG_MFR_ID; + status = yesm1300am_read_block(client, command, data->mfr_id, + ARRAY_SIZE(data->mfr_id) - 1); + data->mfr_id[ARRAY_SIZE(data->mfr_id) - 1] = '\0'; + strncpy(data->mfr_id, (u8 *)&data->mfr_id + 1, ARRAY_SIZE(data->mfr_id) - 1); + + if (status < 0) + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + + /* Read mfr_model */ + command = PSU_REG_MFR_MODEL; + status = yesm1300am_read_block(client, command, data->mfr_model, + ARRAY_SIZE(data->mfr_model) - 1); + data->mfr_model[ARRAY_SIZE(data->mfr_model) - 1] = '\0'; + strncpy(data->mfr_model, (u8 *)&data->mfr_model + 1, ARRAY_SIZE(data->mfr_model) - 1); + + if (status < 0) + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +module_i2c_driver(yesm1300am_driver); + +MODULE_AUTHOR("Alpha-SID6"); +MODULE_DESCRIPTION("3Y Power yesm1300am driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/service/snj60d0-platform-init.service b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/service/snj60d0-platform-init.service new file mode 100644 index 000000000000..3ab40121cc43 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/service/snj60d0-platform-init.service @@ -0,0 +1,13 @@ +[Unit] +Description=Alphanetworks SNJ60D0-320F Platform initialization service +Before=pmon.service +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/alphanetworks_snj60d0_util.py -f install +ExecStop=/usr/local/bin/alphanetworks_snj60d0_util.py clean +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/setup.py b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/setup.py new file mode 100644 index 000000000000..a44dd8f4cb01 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/setup.py @@ -0,0 +1,12 @@ +import os +from setuptools import setup +os.listdir + +setup( + name='sonic-platform', + version='1.0', + description='Module to initialize Alphanetworks SNJ60D0-320F platforms', + + packages=['sonic_platform'], +) + diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/__init__.py b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/__init__.py new file mode 100644 index 000000000000..43435472a423 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/__init__.py @@ -0,0 +1,2 @@ +__all__ = ['chassis', 'eeprom', 'platform', 'psu', 'sfp', 'thermal', 'fan'] +from . import platform diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/chassis.py new file mode 100644 index 000000000000..c5d69eb79a50 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/chassis.py @@ -0,0 +1,265 @@ +############################################################################# +# Alphanetworks +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Chassis information which are available in the platform +# +############################################################################# + +import time + +try: + from sonic_platform_base.chassis_base import ChassisBase + from sonic_platform.fan import Fan + from sonic_platform.psu import Psu + from sonic_platform.sfp import Sfp + from sonic_platform.eeprom import Eeprom + from sonic_platform.thermal import Thermal + from sonic_platform.fan_drawer import FanDrawer + from sonic_platform.led import FanLed + from sonic_platform.led import PsuLed +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Chassis(ChassisBase): + NUM_THERMAL = 3 + NUM_FANDRAWER = 6 + NUM_FANSPERDRAWER = 2 + NUM_FAN = NUM_FANDRAWER * NUM_FANSPERDRAWER + NUM_PSU = 2 + NUM_SFP = 34 + HOST_REBOOT_CAUSE_PATH = "/host/reboot-cause/" + PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" + REBOOT_CAUSE_FILE = "reboot-cause.txt" + PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" + HOST_CHK_CMD = "docker > /dev/null 2>&1" + + def __init__(self): + ChassisBase.__init__(self) + # initialize thermals + for index in range(0, Chassis.NUM_THERMAL): + thermal = Thermal(index) + self._thermal_list.append(thermal) + + # initialize fans + for index in range(0, Chassis.NUM_FANDRAWER): + fan_drawer = FanDrawer(index) + for i in range(0, Chassis.NUM_FANSPERDRAWER): + fan_index = Chassis.NUM_FANSPERDRAWER * index + i + fan = Fan(fan_index, False) + fan_drawer._fan_list.append(fan) + self._fan_list.append(fan) + self._fan_drawer_list.append(fan_drawer) + + # initialize fan led + self.fan_led = FanLed.get_fanLed() + self.fan_led.set_fans(self._fan_list) + + # initialize psus + for index in range(0, Chassis.NUM_PSU): + psu = Psu(index) + self._psu_list.append(psu) + + # initialize psu led + self.psu_led = PsuLed.get_psuLed() + self.psu_led.set_psus(self._psu_list) + + # initialize sfps + self.sfp_state = [] + for index in range(0, Chassis.NUM_SFP): + if (index < Chassis.NUM_SFP-2): + sfp = Sfp(index, 'QSFP') + else: + sfp = Sfp(index, 'SFP') + self._sfp_list.append(sfp) + + # initialize eeprom + self._eeprom = Eeprom() + + def get_change_event(self, timeout=0): + """ + Returns a nested dictionary containing all devices which have + experienced a change at chassis level + + Args: + timeout: Timeout in milliseconds (optional). If timeout == 0, + this method will block until a change is detected. + + Returns: + (bool, dict): + - True if call successful, False if not; + - A nested dictionary where key is a device type, + value is a dictionary with key:value pairs in the format of + {'device_id':'device_event'}, + where device_id is the device ID for this device and + device_event, + status='1' represents device inserted, + status='0' represents device removed. + Ex. {'fan':{'0':'0', '2':'1'}, 'sfp':{'11':'0'}} + indicates that fan 0 has been removed, fan 2 + has been inserted and sfp 11 has been removed. + Specifically for SFP event, besides SFP plug in and plug out, + there are some other error event could be raised from SFP, when + these error happened, SFP eeprom will not be avalaible, XCVRD shall + stop to read eeprom before SFP recovered from error status. + status='2' I2C bus stuck, + status='3' Bad eeprom, + status='4' Unsupported cable, + status='5' High Temperature, + status='6' Bad cable. + """ + change_event_dict = {"sfp": {}} + sfp_status, sfp_change_dict = self.get_transceiver_change_event(timeout) + change_event_dict["sfp"] = sfp_change_dict + if sfp_status is True: + return True, change_event_dict + + return False, {} + + def get_transceiver_change_event(self, timeout=0): + start_time = time.time() + # SFP status definition from xcvrd + SFP_STATUS_INSERTED = '1' + SFP_STATUS_REMOVED = '0' + + timeout = (timeout/1000) + end_time = start_time + timeout + while (timeout >= 0): + new_sfp_state = [] + change_dict = {} + for index in range(self.get_num_sfps()): + # get current status + state = self._sfp_list[index].get_presence() + new_sfp_state.append(state) + + if self.sfp_state == []: + change_dict[index] = SFP_STATUS_INSERTED if state == True else SFP_STATUS_REMOVED + elif state != self.sfp_state[index]: + change_dict[index] = SFP_STATUS_INSERTED if state == True else SFP_STATUS_REMOVED + + self.sfp_state = new_sfp_state + current_time = time.time() + + if bool(change_dict): + return True, change_dict + elif timeout == 0 or current_time < end_time: + time.sleep(1) + continue + else: + return True, {} + + return False, {} + + def get_thermal_manager(self): + from sonic_platform.thermal_manager import ThermalManager + return ThermalManager + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + return self._eeprom.modelstr() + + def get_model(self): + """ + Retrieves the model number (or part number) of the chassis + Returns: + string: Model/part number of chassis + """ + return self._eeprom.part_number_str() + + def get_serial(self): + """ + Retrieves the serial number of the device + + Returns: + string: Serial number of device + """ + return self._eeprom.serial_number_str() + + def get_system_eeprom_info(self): + """ + Retrieves the full content of system EEPROM information for the chassis + + Returns: + A dictionary where keys are the type code defined in + OCP ONIE TlvInfo EEPROM format and values are their corresponding + values. + """ + return self._eeprom.get_system_eeprom_info() + + def initizalize_system_led(self): + from .led import SystemLed + self._status_led = SystemLed.get_systemLed() + + def set_status_led(self, color): + """ + Sets the state of the system LED + + Args: + color: A string representing the color with which to set the + system LED + + Returns: + bool: True if system LED state is set successfully, False if not + """ + if self._status_led is None: + self.initizalize_system_led() + + return self._status_led.set_status(color) + + def get_status_led(self): + """ + Gets the state of the system LED + + Returns: + A string, one of the valid LED color strings which could be vendor + specified. + """ + if self._status_led is None: + self.initizalize_system_led() + + return self._status_led.get_status() + + def get_watchdog(self): + """ + Retreives hardware watchdog device on this chassis + + Returns: + An object derived from WatchdogBase representing the hardware + watchdog device + """ + try: + if self._watchdog is None: + from sonic_platform.watchdog import Watchdog + # Create the watchdog Instance + self._watchdog = Watchdog() + + except Exception as e: + syslog.syslog(syslog.LOG_ERR, "Fail to load watchdog due to {}".format(e)) + return self._watchdog + + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + + Returns: + A tuple (string, string) where the first element is a string + containing the cause of the previous reboot. This string must be + one of the predefined strings in this class. If the first string + is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used + to pass a description of the reboot cause. + """ + + reboot_cause_path = (Chassis.HOST_REBOOT_CAUSE_PATH + Chassis.REBOOT_CAUSE_FILE) + sw_reboot_cause = "Unknown" + try: + with open(reboot_cause_path, 'r') as fd: + sw_reboot_cause = fd.read().strip() + except IOError: + pass + + return ('REBOOT_CAUSE_NON_HARDWARE', sw_reboot_cause) diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/eeprom.py b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/eeprom.py new file mode 100644 index 000000000000..78dc2d1fe999 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/eeprom.py @@ -0,0 +1,124 @@ +############################################################################# +# Alphanetworks +# +# Module contains an implementation of SONiC Platform Base API and +# provides the eeprom information which are available in the platform +# +############################################################################# +import sys + +if sys.version_info.major == 3: + from io import StringIO +else: + from cStringIO import StringIO + +try: + from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CACHE_ROOT = '/var/cache/sonic/decode-syseeprom' +CACHE_FILE = 'syseeprom_cache' + +class Eeprom(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_DISPLAY_VENDOR_EXT = True + EEPROM_DECODE_HEADLINES = 6 + + def __init__(self): + self.eeprom_path = "/sys/bus/i2c/devices/1-0056/eeprom" + super(Eeprom, self).__init__(self.eeprom_path, 0, '', True) + self.eeprom_tlv_dict = dict() + try: + self.eeprom_data = self.read_eeprom() + except Exception as e: + self.eeprom_data = "N/A" + print("eeprom_data {}".format(self.eeprom_data)) + else: + eeprom = self.eeprom_data + + if not self.is_valid_tlvinfo_header(eeprom): + return + + total_length = ((eeprom[9]) << 8) | (eeprom[10]) + tlv_index = self._TLV_INFO_HDR_LEN + tlv_end = self._TLV_INFO_HDR_LEN + total_length + + while (tlv_index + 2) < len(eeprom) and tlv_index < tlv_end: + if not self.is_valid_tlv(eeprom[tlv_index:]): + break + + tlv = eeprom[tlv_index:tlv_index + 2 + + (eeprom[tlv_index + 1])] + code = "0x%02X" % ((tlv[0])) + + if (tlv[0]) == self._TLV_CODE_VENDOR_EXT: + value = str(((tlv[2]) << 24) | ((tlv[3]) << 16) | + ((tlv[4]) << 8) | (tlv[5])) + value += str(tlv[6:6 + (tlv[1])]) + else: + name, value = self.decoder(None, tlv) + + self.eeprom_tlv_dict[code] = value + if (eeprom[tlv_index]) == self._TLV_CODE_CRC_32: + break + + tlv_index += (eeprom[tlv_index+1]) + 2 + + def serial_number_str(self): + (is_valid, results) = self.get_tlv_field(self.eeprom_data, self._TLV_CODE_SERIAL_NUMBER) + if not is_valid: + return "N/A" + return results[2].decode('ascii') + + def base_mac_addr(self): + (is_valid, t) = self.get_tlv_field(self.eeprom_data, self._TLV_CODE_MAC_BASE) + if not is_valid or t[1] != 6: + return super(TlvInfoDecoder, self).switchaddrstr(e) + + return ":".join(["{:02x}".format(T) for T in t[2]]).upper() + + def modelstr(self): + (is_valid, results) = self.get_tlv_field(self.eeprom_data, self._TLV_CODE_PRODUCT_NAME) + if not is_valid: + return "N/A" + + return results[2].decode('ascii') + + def platformstr(self): + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_PLATFORM_NAME) + if not is_valid: + return "N/A" + + return results[2].decode('ascii') + + + def part_number_str(self): + (is_valid, results) = self.get_tlv_field(self.eeprom_data, self._TLV_CODE_PART_NUMBER) + if not is_valid: + return "N/A" + + return results[2].decode('ascii') + + def serial_str(self): + (is_valid, results) = self.get_tlv_field(self.eeprom_data, self._TLV_CODE_SERVICE_TAG) + if not is_valid: + return "N/A" + + return results[2].decode('ascii') + + def revision_str(self): + (is_valid, results) = self.get_tlv_field(self.eeprom_data, self._TLV_CODE_DEVICE_VERSION) + if not is_valid: + return "N/A" + + return results[2].decode('ascii') + + def system_eeprom_info(self): + """ + Returns a dictionary, where keys are the type code defined in + ONIE EEPROM format and values are their corresponding values + found in the system EEPROM. + """ + return self.eeprom_tlv_dict + diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/fan.py new file mode 100644 index 000000000000..5baf4c5725d8 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/fan.py @@ -0,0 +1,261 @@ +############################################################################# +# Alphanetworks +# +# Module contains an implementation of SONiC Platform Base API and +# provides the fan status which are available in the platform +# +############################################################################# + +try: + from sonic_platform_base.fan_base import FanBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +class Fan(FanBase): + """Platform-specific Fan class""" + + FAN_FRONT_RPM_MAX = 21000 + FAN_REAR_RPM_MAX = 19000 + PSU_FAN_RPM_MAX = 27000 + FAN_SPEED_TOLERANCE_PERCENTAGE = 20 + NUM_FANTRAYS = 6 + FANS_PERTRAY = 2 + + def __init__(self, fan_index, is_psu_fan): + self.index = fan_index + 1 + self.is_psu_fan = is_psu_fan + FanBase.__init__(self) + base_path = "/sys/bus/i2c/devices/" + + if self.is_psu_fan: + psu_bus_num = [10, 11] + psu_pmbus_address = [58, 59] + self.psu_pmbus_path = base_path +"{}-00{}".format(psu_bus_num[self.index-1], psu_pmbus_address[self.index-1]) + # driver attribute + self.psu_fan_rpm = "/psu_fan1_speed_rpm" + else: + self.fan_path = base_path + '1-005e' + self.fantray_index = int((fan_index)/self.FANS_PERTRAY) + 1 + self.fan_index_intray = self.index - ((self.fantray_index-1)*self.FANS_PERTRAY) + self.fan_index_intray_str = 'front' if (self.fan_index_intray==1) else 'rear' + # driver attribute + self.fan_present = '/fan{}_present'.format(self.fantray_index) + self.fan_direction = '/fan{}_direction'.format(self.fantray_index) + self.fan_speed_rpm = '/fan{}_{}_speed_rpm'.format(self.fantray_index, self.fan_index_intray_str) + self.fan_speed_pwm = '/fan_pwm' + + def get_name(self): + """ + Retrieves the name of the device + + Returns: + string: The name of the device + """ + if self.is_psu_fan: + # each PSU has 1 Fan + return "PSU{}-FAN{}".format(self.index, 1) + else: + return "Fantray{}_{}".format(self.fantray_index, self.fan_index_intray) + + def get_status(self): + """ + Retrieves the operational status of the device + + Returns: + A boolean value, True if device is operating properly, False if not + """ + speed = self.get_speed_rpm() + status = True if (speed != 0) else False + return status + + def get_presence(self): + """ + Retrieves the presence of the device + + Returns: + bool: True if device is present, False if not + """ + if self.is_psu_fan: + return True + else: + status = 0 + node = self.fan_path + self.fan_present + try: + with open(node, 'r') as presence_status: + status = int(presence_status.read()) + except IOError as e: + return False + return status == 1 + + def get_direction(self): + """ + Retrieves the direction of fan + + Returns: + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + """ + direction = "" + if self.is_psu_fan: + direction = self.FAN_DIRECTION_EXHAUST + else: + node = self.fan_path + self.fan_direction + try: + with open(node, 'r') as fan_dir: + val = int(fan_dir.read()) + except IOError as e: + return direction + if val == 1: + direction = self.FAN_DIRECTION_INTAKE + else: + direction = self.FAN_DIRECTION_EXHAUST + + return direction + + def get_speed(self): + """ + Retrieves the speed of fan as a percentage of full speed + + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + """ + speed = 0 + if self.is_psu_fan: + rpm = self.get_speed_rpm() + speed = int((rpm * 100) / self.PSU_FAN_RPM_MAX) + + else: + frpm = 0 + node = self.fan_path + self.fan_speed_rpm + try: + with open(node, 'r') as speed: + frpm = int(speed.read()) + except IOError as e: + return 0 + + if self.fan_index_intray == 1: + speed = int((frpm * 100) / self.FAN_FRONT_RPM_MAX) + else: + speed = int((frpm * 100) / self.FAN_REAR_RPM_MAX) + + if speed > 100: + speed = 100 + + return speed + + def get_speed_rpm(self): + """ + Retrieves the speed of fan in RPM + + Returns: + An integer, representing speed of the FAN in rpm + """ + frpm = 0 + if self.is_psu_fan: + node = self.psu_pmbus_path + self.psu_fan_rpm + else: + node = self.fan_path + self.fan_speed_rpm + try: + with open(node, 'r') as speed: + frpm = int(speed.read()) + except IOError as e: + return 0 + + return frpm + + def get_target_speed(self): + """ + Retrieves the target (expected) speed of the fan + + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + """ + duty = 0 + if self.is_psu_fan: + # Target speed not supported for PSU fans + duty = 0 + else: + node = self.fan_path + self.fan_speed_pwm + try: + with open(node, 'r') as fan_duty: + duty = int(fan_duty.read()) + duty = int(duty * 100 / 255) + except IOError: + duty = 0 + return duty + + def set_speed(self, speed): + """ + Sets the fan speed + + Args: + speed: An integer, the percentage of full fan speed to set fan to, + in the range 0 (off) to 100 (full speed) + + Returns: + A boolean, True if speed is set successfully, False if not + """ + if self.is_psu_fan: + print("Setting PSU fan speed is not allowed") + return False + else: + if speed < 0 or speed > 100: + return False + + node = self.fan_path + self.fan_speed_pwm + speed = int(round(speed * 255.0 / 100)) + try: + with open(node, 'w') as fan_duty: + fan_duty.write(str(speed)) + except IOError: + return False + return True + + def get_speed_tolerance(self): + """ + Retrieves the speed tolerance of the fan + + Returns: + An integer, the percentage of variance from target speed which is + considered tolerable + """ + return self.FAN_SPEED_TOLERANCE_PERCENTAGE + + def set_status_led(self, color): + """ + Sets the state of the fan module status LED + + Args: + color: A string representing the color with which to set the + fan module status LED + + Returns: + bool: True if status LED state is set successfully, False if not + """ + if self.is_psu_fan: + # Usually there is no led for psu_fan + return True + else: + from .led import FanLed + fanled = FanLed.get_fanLed() + return fanled.update_status() + + def get_status_led(self): + """ + Gets the state of the fan status LED + + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + if self.is_psu_fan: + # Usually no led for psu_fan hence implement a generic scheme + if self.get_status(): + return self.STATUS_LED_COLOR_GREEN + else: + return self.STATUS_LED_COLOR_OFF + else: + from .led import FanLed + fanled = FanLed.get_fanLed() + return fanled.get_status() diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..53de17bd5890 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/fan_drawer.py @@ -0,0 +1,71 @@ +############################################################################# +# Alphanetworks +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Fan Drawer status which are available in the platform +# +############################################################################# + +try: + from sonic_platform_base.fan_drawer_base import FanDrawerBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class FanDrawer(FanDrawerBase): + def __init__(self, index): + FanDrawerBase.__init__(self) + self.index = index + 1 + + def get_name(self): + """ + Retrieves the name of the device + + Returns: + string: The name of the device + """ + + return "drawer{}".format(self.index) + + def get_num_fans(self): + """ + Retrieves the number of fans available on this fan drawer + + Returns: + An integer, the number of fan modules available on this fan drawer + """ + return len(self._fan_list) + + def get_all_fans(self): + """ + Retrieves all fan modules available on this fan drawer + + Returns: + A list of objects derived from FanBase representing all fan + modules available on this fan drawer + """ + return self._fan_list + + def set_status_led(self, color): + """ + Sets the state of the fan drawer status LED + + Args: + color: A string representing the color with which to set the + fan drawer status LED + + Returns: + bool: True if status LED state is set successfully, False if not + """ + # fan_drawer led not support + return True + + def get_status_led(self, color): + """ + Gets the state of the fan drawer LED + + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + # fan_drawer led not support + return True diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/led.py b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/led.py new file mode 100644 index 000000000000..1a7a9a8a160f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/led.py @@ -0,0 +1,124 @@ +class Led(object): + STATUS_LED_COLOR_GREEN = "green" + STATUS_LED_COLOR_AMBER_BLINK = "amber_blink" + STATUS_LED_COLOR_OFF = "off" + + value_map = { + "on": 1, + "off": 0, + "blink": 4 + } + color_map = { + 0: STATUS_LED_COLOR_OFF, + 1: STATUS_LED_COLOR_GREEN, + 4: STATUS_LED_COLOR_AMBER_BLINK + } + + @staticmethod + def get_path(): + path = "/sys/bus/i2c/devices/1-005e/" + return path + + def set_value(self, value): + try: + with open(self.led_path, 'w') as led: + led.write(str(value)) + except IOError: + return False + + return True + + def get_status(self): + status = 0 + try: + with open(self.led_path, 'r') as led: + status = int(led.read()) + except IOError: + return False + + return self.color_map[status] + + +class SystemLed(Led): + _systemLed = None + + @staticmethod + def get_systemLed(): + if SystemLed._systemLed is None: + SystemLed() + return SystemLed._systemLed + + def __init__(self): + if SystemLed._systemLed is not None: + raise Exception('only one SystemLed can exist') + else: + self.led_path = self.get_path() + "sys_status" + SystemLed._systemLed = self + + def set_status(self, color): + if color == Led.STATUS_LED_COLOR_GREEN: + return self.set_value(Led.value_map["on"]) + if color == Led.STATUS_LED_COLOR_AMBER_BLINK: + return self.set_value(Led.value_map["blink"]) + if color == Led.STATUS_LED_COLOR_OFF: + return self.set_value(Led.value_map["off"]) + return False + +class PsuLed(Led): + _psuLed = None + + @staticmethod + def get_psuLed(): + if PsuLed._psuLed is None: + PsuLed() + return PsuLed._psuLed + + def __init__(self): + if PsuLed._psuLed is not None: + raise Exception('only one psuLed can exist') + else: + self.led_path = self.get_path() + "sys_pwr" + PsuLed._psuLed = self + + def set_psus(self, psu_list): + self._psu_list = psu_list + + def update_status(self): + is_power_all_OK = True + for psu in self._psu_list: + if not psu.get_presence() or not psu.get_status(): + is_power_all_OK = False + + status = self.value_map["on"] if is_power_all_OK else self.value_map["blink"] + # update led status + return self.set_value(status) + + +class FanLed(Led): + _fanLed = None + + @staticmethod + def get_fanLed(): + if FanLed._fanLed is None: + FanLed() + return FanLed._fanLed + + def __init__(self): + if FanLed._fanLed is not None: + raise Exception('only one fanLed can exist') + else: + self.led_path = self.get_path() + "fan1_led" + FanLed._fanLed = self + + def set_fans(self, fan_lsit): + self._fan_list = fan_lsit + + def update_status(self): + is_fan_all_OK = True + for fan in self._fan_list: + if not fan.get_status(): + is_fan_all_OK = False + + status = self.value_map["on"] if is_fan_all_OK else self.value_map["blink"] + # update led status + return self.set_value(status) diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/platform.py b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/platform.py new file mode 100644 index 000000000000..d7bc95e2aa10 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/platform.py @@ -0,0 +1,19 @@ +############################################################################# +# Alphanetworks +# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + +try: + from sonic_platform_base.platform_base import PlatformBase + from sonic_platform.chassis import Chassis +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +class Platform(PlatformBase): + def __init__(self): + PlatformBase.__init__(self) + # initialize chassis + self._chassis = Chassis() diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/psu.py new file mode 100644 index 000000000000..22613ea5e654 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/psu.py @@ -0,0 +1,328 @@ +############################################################################# +# Alphanetworks +# +# Module contains an implementation of SONiC Platform Base API and +# provides the PSU status which are available in the platform +# +############################################################################# + +try: + from sonic_platform_base.psu_base import PsuBase + from sonic_platform.fan import Fan + from sonic_eeprom import eeprom_base +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +class Psu(PsuBase): + """Platform-specific PSU class""" + + def __init__(self, psu_index): + PsuBase.__init__(self) + # initialize PSU Fan + fan = Fan(psu_index, True) + self._fan_list.append(fan) + self.index = psu_index + 1 + + self.pus_type = "AC" + # driver attribute + self.psu_presence = "/psu{}_present".format(psu_index+1) + self.psu_oper_status = "/psu{}_power_good".format(psu_index+1) + self.psu_model_name = "/psu_model_name" + self.psu_mfr_id = "/psu_mfr_id" + self.psu_v_in = "/psu_v_in" + self.psu_v_out = "/psu_v_out" + self.psu_i_in = "/psu_i_in" + self.psu_i_out = "/psu_i_out" + self.psu_p_in = "/psu_p_in" + self.psu_p_out = "/psu_p_out" + self.psu_temp1_input = "/psu_temp1_input" + self.psu_mfr_pout_max = "/psu_mfr_pout_max" + self.psu_serial_num = "/eeprom" + + # psu eeprom info + self._PSU_EEPROM_SERIAL_NUM_OFFSET = 0x35 + self._PSU_EEPROM_SERIAL_NUM_LENGTH = 19 + + # driver path + psu_bus_num = [10, 11] + psu_eeprom_address = [50, 51] + psu_pmbus_address = [58, 59] + psu_path = "/sys/bus/i2c/devices/" + self.psu_mapping = psu_path + "1-005e" + self.psu_eeprom = psu_path + "{}-00{}".format(psu_bus_num[psu_index], psu_eeprom_address[psu_index]) + self.psu_pmbus = psu_path +"{}-00{}".format(psu_bus_num[psu_index], psu_pmbus_address[psu_index]) + + + def get_name(self): + """ + Retrieves the name of the device + + Returns: + string: The name of the device + """ + return "PSU{}".format(self.index) + + def get_presence(self): + """ + Retrieves the presence of the device + + Returns: + bool: True if device is present, False if not + """ + status = 0 + node = self.psu_mapping + self.psu_presence + try: + with open(node, 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + return status == 1 + + def get_status(self): + """ + Retrieves the operational status of the device + + Returns: + A boolean value, True if device is operating properly, False if not + """ + status = 0 + node = self.psu_mapping + self.psu_oper_status + try: + with open(node, 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + return status == 1 + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + + Returns: + string: Model/part number of device + """ + model = "" + node = self.psu_pmbus + self.psu_model_name + try: + with open(node, 'r') as model_name: + model = model_name.read() + except IOError: + return None + return model.rstrip() + + def get_mfr_id(self): + """ + Retrieves the manufacturer's name (or id) of the device + + Returns: + string: Manufacturer's id of device + """ + mfr = "" + node = self.psu_pmbus + self.psu_mfr_id + try: + with open(node, 'r') as mfr_id: + mfr = mfr_id.read() + except IOError: + return None + return mfr.rstrip() + + def get_serial(self): + """ + Retrieves the serial number of the device + + Returns: + string: Serial number of device + """ + serial = "" + node = self.psu_eeprom + self.psu_serial_num + try: + psu_eeprom = eeprom_base.EepromDecoder(node, None, 0, '', True) + serial = psu_eeprom.read_eeprom_bytes(self._PSU_EEPROM_SERIAL_NUM_LENGTH, self._PSU_EEPROM_SERIAL_NUM_OFFSET) + if len(serial) != self._PSU_EEPROM_SERIAL_NUM_LENGTH: + return None + except IOError: + return None + return serial.decode("utf-8") + + def get_voltage(self): + """ + Retrieves current PSU voltage output + + Returns: + A float number, the output voltage in volts, + e.g. 12.1 + """ + vout = 0.0 + node = self.psu_pmbus + self.psu_v_out + try: + with open(node, 'r') as v_out: + vout = int(v_out.read()) + except IOError: + return vout + return float(vout) / 1000 + + def get_current(self): + """ + Retrieves present electric current supplied by PSU + + Returns: + A float number, the electric current in amperes, e.g 15.4 + """ + iout = 0.0 + node = self.psu_pmbus + self.psu_i_out + try: + with open(node, 'r') as i_out: + iout = int(i_out.read()) + except IOError: + return iout + return float(iout) / 1000 + + def get_power(self): + """ + Retrieves current energy supplied by PSU + + Returns: + A float number, the power in watts, e.g. 302.6 + """ + pout = 0.0 + node = self.psu_pmbus + self.psu_p_out + try: + with open(node, 'r') as p_out: + pout = int(p_out.read()) + except IOError: + return pout + return float(pout) / 1000 + + def get_powergood_status(self): + """ + Retrieves the powergood status of PSU + + Returns: + A boolean, True if PSU has stablized its output voltages and passed all + its internal self-tests, False if not. + """ + status = 0 + node = self.psu_mapping + self.psu_oper_status + try: + with open(node, 'r') as powergood_status: + status = int(powergood_status.read()) + except IOError: + return False + return status == 1 + + + def set_status_led(self, color): + """ + Sets the state of the PSU status LED + + Args: + color: A string representing the color with which to set the + PSU status LED + + Returns: + bool: True if status LED state is set successfully, False if not + """ + from .led import PsuLed + psuled = PsuLed.get_psuLed() + return psuled.update_status() + + def get_status_led(self): + """ + Gets the state of the PSU status LED + + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + from .led import PsuLed + psuled = PsuLed.get_psuLed() + return psuled.get_status() + + def get_input_voltage(self): + """ + Retrieves current input voltage to the PSU + + Returns: + A float number, the input voltage in volts, + e.g. 20.3 + """ + vin = 0.0 + node = self.psu_pmbus + self.psu_v_in + try: + with open(node, 'r') as v_in: + vin = int(v_in.read()) + except IOError: + return vin + return float(vin) / 1000 + + + def get_input_current(self): + """ + Retrieves present electric current supplied to the PSU + + Returns: + A float number, the electric current in amperes, e.g 13.7 + """ + iin = 0.0 + node = self.psu_pmbus + self.psu_i_in + try: + with open(node, 'r') as i_in: + iin = int(i_in.read()) + except IOError: + return iin + return float(iin) / 1000 + + def get_input_power(self): + """ + Retrieves current energy supplied to the PSU + Returns: + A float number, the power in watts, e.g. 302.6 + """ + pin = 0.0 + node = self.psu_pmbus + self.psu_p_in + try: + with open(node, 'r') as p_in: + pin = int(p_in.read()) + except IOError: + return pin + return float(pin) / 1000 + + def get_temperature(self): + """ + Retrieves current temperature reading from PSU + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + temp1in = 0.0 + node = self.psu_pmbus + self.psu_temp1_input + try: + with open(node, 'r') as temp1_in: + temp1in = int(temp1_in.read()) + except IOError: + return temp1in + return float(temp1in) / 1000 + + def get_type(self): + """ + Gets the type of the PSU + + Returns: + A string, the type of PSU (AC/DC) + """ + return self.pus_type + + def get_capacity(self): + """ + Gets the capacity (maximum output power) of the PSU in watts + + Returns: + An integer, the capacity of PSU + """ + poutmax = 0 + node = self.psu_pmbus + self.psu_mfr_pout_max + try: + with open(node, 'r') as pout_max: + poutmax = int(pout_max.read()) + except IOError: + return poutmax + return int(float(poutmax) / 1000) diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/sfp.py new file mode 100644 index 000000000000..45f4c562e1d7 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/sfp.py @@ -0,0 +1,2166 @@ +#!/usr/bin/env python + +############################################################################# +# Quanta +# +# Sfp contains an implementation of SONiC Platform Base API and +# provides the sfp device status which are available in the platform +# +############################################################################# + +import time +from ctypes import create_string_buffer + +try: + from sonic_platform_base.sfp_base import SfpBase + from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId + from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom + from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId + from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom + from sonic_platform_base.sonic_sfp.inf8628 import inf8628InterfaceId + from sonic_platform_base.sonic_sfp.qsfp_dd import qsfp_dd_InterfaceId + from sonic_platform_base.sonic_sfp.qsfp_dd import qsfp_dd_Dom + from sonic_py_common.logger import Logger + from sonic_py_common import device_info + from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +# definitions of the offset and width for values in XCVR info eeprom +XCVR_INTFACE_BULK_OFFSET = 0 +XCVR_INTFACE_BULK_WIDTH_QSFP = 20 +XCVR_INTFACE_BULK_WIDTH_SFP = 21 +XCVR_TYPE_OFFSET = 0 +XCVR_TYPE_WIDTH = 1 +XCVR_EXT_TYPE_OFFSET = 1 +XCVR_EXT_TYPE_WIDTH = 1 +XCVR_CONNECTOR_OFFSET = 2 +XCVR_CONNECTOR_WIDTH = 1 +XCVR_COMPLIANCE_CODE_OFFSET = 3 +XCVR_COMPLIANCE_CODE_WIDTH = 8 +XCVR_ENCODING_OFFSET = 11 +XCVR_ENCODING_WIDTH = 1 +XCVR_NBR_OFFSET = 12 +XCVR_NBR_WIDTH = 1 +XCVR_EXT_RATE_SEL_OFFSET = 13 +XCVR_EXT_RATE_SEL_WIDTH = 1 +XCVR_CABLE_LENGTH_OFFSET = 14 +XCVR_CABLE_LENGTH_WIDTH_QSFP = 5 +XCVR_CABLE_LENGTH_WIDTH_SFP = 6 +XCVR_VENDOR_NAME_OFFSET = 20 +XCVR_VENDOR_NAME_WIDTH = 16 +XCVR_VENDOR_OUI_OFFSET = 37 +XCVR_VENDOR_OUI_WIDTH = 3 +XCVR_VENDOR_PN_OFFSET = 40 +XCVR_VENDOR_PN_WIDTH = 16 +XCVR_HW_REV_OFFSET = 56 +XCVR_HW_REV_WIDTH_OSFP = 2 +XCVR_HW_REV_WIDTH_QSFP = 2 +XCVR_HW_REV_WIDTH_SFP = 4 +XCVR_EXT_SPECIFICATION_COMPLIANCE_OFFSET = 64 +XCVR_EXT_SPECIFICATION_COMPLIANCE_WIDTH = 1 +XCVR_VENDOR_SN_OFFSET = 68 +XCVR_VENDOR_SN_WIDTH = 16 +XCVR_VENDOR_DATE_OFFSET = 84 +XCVR_VENDOR_DATE_WIDTH = 8 +XCVR_DOM_CAPABILITY_OFFSET = 92 +XCVR_DOM_CAPABILITY_WIDTH = 2 + +# definitions of the offset and width for values in XCVR_QSFP_DD info eeprom +XCVR_EXT_TYPE_OFFSET_QSFP_DD = 72 +XCVR_EXT_TYPE_WIDTH_QSFP_DD = 2 +XCVR_CONNECTOR_OFFSET_QSFP_DD = 75 +XCVR_CONNECTOR_WIDTH_QSFP_DD = 1 +XCVR_CABLE_LENGTH_OFFSET_QSFP_DD = 74 +XCVR_CABLE_LENGTH_WIDTH_QSFP_DD = 1 +XCVR_HW_REV_OFFSET_QSFP_DD = 36 +XCVR_HW_REV_WIDTH_QSFP_DD = 2 +XCVR_VENDOR_DATE_OFFSET_QSFP_DD = 54 +XCVR_VENDOR_DATE_WIDTH_QSFP_DD = 8 +XCVR_DOM_CAPABILITY_OFFSET_QSFP_DD = 2 +XCVR_DOM_CAPABILITY_WIDTH_QSFP_DD = 1 +XCVR_MEDIA_TYPE_OFFSET_QSFP_DD = 85 +XCVR_MEDIA_TYPE_WIDTH_QSFP_DD = 1 +XCVR_FIRST_APPLICATION_LIST_OFFSET_QSFP_DD = 86 +XCVR_FIRST_APPLICATION_LIST_WIDTH_QSFP_DD = 32 +XCVR_SECOND_APPLICATION_LIST_OFFSET_QSFP_DD = 351 +XCVR_SECOND_APPLICATION_LIST_WIDTH_QSFP_DD = 28 + +# to improve performance we retrieve all eeprom data via a single ethtool command +# in function get_transceiver_info and get_transceiver_bulk_status +# XCVR_INTERFACE_DATA_SIZE stands for the max size to be read +# this variable is only used by get_transceiver_info. +# please be noted that each time some new value added to the function +# we should make sure that it falls into the area +# [XCVR_INTERFACE_DATA_START, XCVR_INTERFACE_DATA_SIZE] or +# adjust XCVR_INTERFACE_MAX_SIZE to contain the new data +# It's same for [QSFP_DOM_BULK_DATA_START, QSFP_DOM_BULK_DATA_SIZE] and +# [SFP_DOM_BULK_DATA_START, SFP_DOM_BULK_DATA_SIZE] which are used by +# get_transceiver_bulk_status +XCVR_INTERFACE_DATA_START = 0 +XCVR_INTERFACE_DATA_SIZE = 92 +SFP_MODULE_ADDRA2_OFFSET = 256 +SFP_MODULE_THRESHOLD_OFFSET = 0 +SFP_MODULE_THRESHOLD_WIDTH = 56 + +QSFP_DOM_BULK_DATA_START = 22 +QSFP_DOM_BULK_DATA_SIZE = 36 +SFP_DOM_BULK_DATA_START = 96 +SFP_DOM_BULK_DATA_SIZE = 10 + +QSFP_DD_DOM_BULK_DATA_START = 14 +QSFP_DD_DOM_BULK_DATA_SIZE = 4 + +# definitions of the offset for values in OSFP info eeprom +OSFP_TYPE_OFFSET = 0 +OSFP_VENDOR_NAME_OFFSET = 129 +OSFP_VENDOR_PN_OFFSET = 148 +OSFP_HW_REV_OFFSET = 164 +OSFP_VENDOR_SN_OFFSET = 166 + +# definitions of the offset for values in QSFP_DD info eeprom +QSFP_DD_TYPE_OFFSET = 0 +QSFP_DD_VENDOR_NAME_OFFSET = 1 +QSFP_DD_VENDOR_PN_OFFSET = 20 +QSFP_DD_VENDOR_SN_OFFSET = 38 +QSFP_DD_VENDOR_OUI_OFFSET = 17 + +#definitions of the offset and width for values in DOM info eeprom +QSFP_DOM_REV_OFFSET = 1 +QSFP_DOM_REV_WIDTH = 1 +QSFP_TEMPE_OFFSET = 22 +QSFP_TEMPE_WIDTH = 2 +QSFP_VOLT_OFFSET = 26 +QSFP_VOLT_WIDTH = 2 +QSFP_VERSION_COMPLIANCE_OFFSET = 1 +QSFP_VERSION_COMPLIANCE_WIDTH = 2 +QSFP_CHANNL_MON_OFFSET = 34 +QSFP_CHANNL_MON_WIDTH = 16 +QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH = 24 +QSFP_CHANNL_DISABLE_STATUS_OFFSET = 86 +QSFP_CHANNL_DISABLE_STATUS_WIDTH = 1 +QSFP_CHANNL_RX_LOS_STATUS_OFFSET = 3 +QSFP_CHANNL_RX_LOS_STATUS_WIDTH = 1 +QSFP_CHANNL_TX_FAULT_STATUS_OFFSET = 4 +QSFP_CHANNL_TX_FAULT_STATUS_WIDTH = 1 +QSFP_CONTROL_OFFSET = 86 +QSFP_CONTROL_WIDTH = 8 +QSFP_MODULE_MONITOR_OFFSET = 0 +QSFP_MODULE_MONITOR_WIDTH = 9 +QSFP_POWEROVERRIDE_OFFSET = 93 +QSFP_POWEROVERRIDE_WIDTH = 1 +QSFP_POWEROVERRIDE_BIT = 0 +QSFP_POWERSET_BIT = 1 +QSFP_OPTION_VALUE_OFFSET = 192 +QSFP_OPTION_VALUE_WIDTH = 4 + +QSFP_MODULE_UPPER_PAGE3_START = 384 +QSFP_MODULE_THRESHOLD_OFFSET = 128 +QSFP_MODULE_THRESHOLD_WIDTH = 24 +QSFP_CHANNL_THRESHOLD_OFFSET = 176 +QSFP_CHANNL_THRESHOLD_WIDTH = 24 + +SFP_TEMPE_OFFSET = 96 +SFP_TEMPE_WIDTH = 2 +SFP_VOLT_OFFSET = 98 +SFP_VOLT_WIDTH = 2 +SFP_CHANNL_MON_OFFSET = 100 +SFP_CHANNL_MON_WIDTH = 6 + + +SFP_CHANNL_STATUS_OFFSET = 110 +SFP_CHANNL_STATUS_WIDTH = 1 + +SFP_CHANNL_THRESHOLD_OFFSET = 112 +SFP_CHANNL_THRESHOLD_WIDTH = 2 +SFP_STATUS_CONTROL_OFFSET = 110 +SFP_STATUS_CONTROL_WIDTH = 1 +SFP_TX_DISABLE_HARD_BIT = 7 +SFP_TX_DISABLE_SOFT_BIT = 6 + +QSFP_DD_TEMPE_OFFSET = 14 +QSFP_DD_TEMPE_WIDTH = 2 +QSFP_DD_VOLT_OFFSET = 16 +QSFP_DD_VOLT_WIDTH = 2 +QSFP_DD_TX_BIAS_OFFSET = 42 +QSFP_DD_TX_BIAS_WIDTH = 16 +QSFP_DD_RX_POWER_OFFSET = 58 +QSFP_DD_RX_POWER_WIDTH = 16 +QSFP_DD_TX_POWER_OFFSET = 26 +QSFP_DD_TX_POWER_WIDTH = 16 +QSFP_DD_CHANNL_MON_OFFSET = 26 +QSFP_DD_CHANNL_MON_WIDTH = 48 +QSFP_DD_CHANNL_DISABLE_STATUS_OFFSET = 86 +QSFP_DD_CHANNL_DISABLE_STATUS_WIDTH = 1 +QSFP_DD_CHANNL_RX_LOS_STATUS_OFFSET = 19 +QSFP_DD_CHANNL_RX_LOS_STATUS_WIDTH = 1 +QSFP_DD_CHANNL_TX_FAULT_STATUS_OFFSET = 7 +QSFP_DD_CHANNL_TX_FAULT_STATUS_WIDTH = 1 +QSFP_DD_MODULE_THRESHOLD_OFFSET = 0 +QSFP_DD_MODULE_THRESHOLD_WIDTH = 72 +QSFP_DD_CHANNL_STATUS_OFFSET = 26 +QSFP_DD_CHANNL_STATUS_WIDTH = 1 + +# identifier value of xSFP module which is in the first byte of the EEPROM +# if the identifier value falls into SFP_TYPE_CODE_LIST the module is treated as a SFP module and parsed according to 8472 +# for QSFP_TYPE_CODE_LIST the module is treated as a QSFP module and parsed according to 8436/8636 +# Originally the type (SFP/QSFP) of each module is determined according to the SKU dictionary +# where the type of each FP port is defined. The content of EEPROM is parsed according to its type. +# However, sometimes the SFP module can be fit in an adapter and then pluged into a QSFP port. +# In this case the EEPROM content is in format of SFP but parsed as QSFP, causing failure. +# To resolve that issue the type field of the xSFP module is also fetched so that we can know exectly what type the +# module is. Currently only the following types are recognized as SFP/QSFP module. +# Meanwhile, if the a module's identifier value can't be recognized, it will be parsed according to the SKU dictionary. +# This is because in the future it's possible that some new identifier value which is not regonized but backward compatible +# with the current format and by doing so it can be parsed as much as possible. +SFP_TYPE_CODE_LIST = [ + '03' # SFP/SFP+/SFP28 +] +QSFP_TYPE_CODE_LIST = [ + '0d', # QSFP+ or later + '11' # QSFP28 or later +] +QSFP_DD_TYPE_CODE_LIST = [ + '18' # QSFP-DD Double Density 8X Pluggable Transceiver +] + +qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)', + 'Length OM2(m)', 'Length OM1(m)', + 'Length Cable Assembly(m)') + +sfp_cable_length_tup = ('LengthSMFkm-UnitsOfKm', 'LengthSMF(UnitsOf100m)', + 'Length50um(UnitsOf10m)', 'Length62.5um(UnitsOfm)', + 'LengthCable(UnitsOfm)', 'LengthOM3(UnitsOf10m)') + +sfp_compliance_code_tup = ('10GEthernetComplianceCode', 'InfinibandComplianceCode', + 'ESCONComplianceCodes', 'SONETComplianceCodes', + 'EthernetComplianceCodes','FibreChannelLinkLength', + 'FibreChannelTechnology', 'SFP+CableTechnology', + 'FibreChannelTransmissionMedia','FibreChannelSpeed') + +qsfp_compliance_code_tup = ('10/40G Ethernet Compliance Code', 'SONET Compliance codes', + 'SAS/SATA compliance codes', 'Gigabit Ethernet Compliant codes', + 'Fibre Channel link length/Transmitter Technology', + 'Fibre Channel transmission media', 'Fibre Channel Speed') + +SFP_TYPE = "SFP" +QSFP_TYPE = "QSFP" +OSFP_TYPE = "OSFP" +QSFP_DD_TYPE = "QSFP_DD" + +# Global logger class instance +logger = Logger() + +class Sfp(SfpBase): + """Platform-specific Sfp class""" + CPLD_PORT_NUM = 8 + dom_supported = True + dom_temp_supported = True + dom_volt_supported = True + dom_rx_power_supported = True + dom_tx_power_supported = True + dom_tx_disable_supported = True + calibration = 1 + + def __init__(self, sfp_index, sfp_type): + # Init index + self.index = sfp_index + #self.dom_supported = False + self.sfp_type = sfp_type + self.cpld_index = int(self.index / self.CPLD_PORT_NUM) + 1 + self.cpld_subindex = (self.index % self.CPLD_PORT_NUM) + 1 + + port_cpld_to_i2c_mapping = { + 1 : 14, + 2 : 15, + 3 : 16, + 4 : 17, + } + port_eeprom_to_i2c_mapping = { + 0 : 22, + 1 : 23, + 2 : 24, + 3 : 25, + 4 : 26, + 5 : 27, + 6 : 28, + 7 : 29, + 8 : 30, + 9 : 31, + 10 : 32, + 11 : 33, + 12 : 34, + 13 : 35, + 14 : 36, + 15 : 37, + 16 : 38, + 17 : 39, + 18 : 40, + 19 : 41, + 20 : 42, + 21 : 43, + 22 : 44, + 23 : 45, + 24 : 46, + 25 : 47, + 26 : 48, + 27 : 49, + 28 : 50, + 29 : 51, + 30 : 52, + 31 : 53, + 32 : 13, + 33 : 12, + } + + port_mask = { + 32 : 0x2, + 33 : 0x1 + } + + sfpplus_path = "/sys/bus/i2c/devices/1-005e" + qsfpdd_path = "/sys/bus/i2c/devices/{}-005f" + if self.sfp_type == SFP_TYPE: + self.sfp_path = sfpplus_path + self.sfp_mask = port_mask[self.index] + # driver attribute + self.sfp_present = "/sfp_present" + self.sfp_rx_loss = "/sfp_rx_loss" + self.sfp_tx_disable = "/sfp_tx_disable" + self.sfp_tx_fault = "/sfp_tx_fault" + self.sfp_reset = None + self.sfp_lpmode = None + else: + self.sfp_path = qsfpdd_path.format(port_cpld_to_i2c_mapping[self.cpld_index]) + # driver attribute + self.sfp_present = "/module_present_{}".format(self.index + 1) + self.sfp_reset = "/module_reset_{}".format(self.index + 1) + self.sfp_lpmode = "/module_lp_mode_{}".format(self.index + 1) + self.sfp_rx_loss = None + self.sfp_tx_disable = None + self.sfp_tx_fault = None + # port eeprom path + self.eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom'.format(port_eeprom_to_i2c_mapping[self.index]) + + self._detect_sfp_type(sfp_type) + self._dom_capability_detect() + + self.info_dict_keys = ['type', 'vendor_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', + 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', 'vendor_date', + 'vendor_oui', 'application_advertisement', 'type_abbrv_name'] + + SfpBase.__init__(self) + + + def _convert_string_to_num(self, value_str): + if "-inf" in value_str: + return 'N/A' + elif "Unknown" in value_str: + return 'N/A' + elif 'dBm' in value_str: + t_str = value_str.rstrip('dBm') + return float(t_str) + elif 'mA' in value_str: + t_str = value_str.rstrip('mA') + return float(t_str) + elif 'C' in value_str: + t_str = value_str.rstrip('C') + return float(t_str) + elif 'Volts' in value_str: + t_str = value_str.rstrip('Volts') + return float(t_str) + else: + return 'N/A' + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + data = fd.read() + return data.strip() + except IOError: + pass + return "" + + def __get_path_to_port_config_file(self): + hwsku_path = device_info.get_path_to_platform_dir() + return "/".join([hwsku_path, "platform.json"]) + + def get_presence(self): + """ + Retrieves the presence of the SFP module + Returns: + bool: True if SFP module is present, False if not + """ + status = 0 + node = self.sfp_path + self.sfp_present + try: + with open(node, 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + if self.sfp_type == SFP_TYPE: + status = status & self.sfp_mask + # SFP+ 0 is present, 1 is not present + return status == 0 + else: + return status == 1 + + def _read_eeprom_specific_bytes(self, offset, num_bytes): + sysfsfile_eeprom = None + eeprom_raw = [] + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + try: + sysfsfile_eeprom = open(self.eeprom_path, mode="rb", buffering=0) + sysfsfile_eeprom.seek(offset) + raw = sysfsfile_eeprom.read(num_bytes) + for n in range(0, num_bytes): + eeprom_raw[n] = hex(raw[n])[2:].zfill(2) + except Exception: + eeprom_raw = None + finally: + if sysfsfile_eeprom: + sysfsfile_eeprom.close() + + return eeprom_raw + + def _detect_sfp_type(self, sfp_type): + eeprom_raw = [] + eeprom_raw = self._read_eeprom_specific_bytes(XCVR_TYPE_OFFSET, XCVR_TYPE_WIDTH) + if eeprom_raw: + if eeprom_raw[0] in SFP_TYPE_CODE_LIST: + self.sfp_type = SFP_TYPE + elif eeprom_raw[0] in QSFP_TYPE_CODE_LIST: + self.sfp_type = QSFP_TYPE + elif eeprom_raw[0] in QSFP_DD_TYPE_CODE_LIST: + self.sfp_type = QSFP_DD_TYPE + else: + # we don't regonize this identifier value, treat the xSFP module as the default type + self.sfp_type = sfp_type + logger.log_info("Identifier value of {} module {} is {} which isn't regonized and will be treated as default type ({})".format( + sfp_type, self.index, eeprom_raw[0], sfp_type + )) + else: + # eeprom_raw being None indicates the module is not present. + # in this case we treat it as the default type according to the SKU + self.sfp_type = sfp_type + + def __convert_string_to_num(self, value_str): + if "-inf" in value_str: + return 'N/A' + elif "Unknown" in value_str: + return 'N/A' + elif 'dBm' in value_str: + t_str = value_str.rstrip('dBm') + return float(t_str) + elif 'mA' in value_str: + t_str = value_str.rstrip('mA') + return float(t_str) + elif 'C' in value_str: + t_str = value_str.rstrip('C') + return float(t_str) + elif 'Volts' in value_str: + t_str = value_str.rstrip('Volts') + return float(t_str) + else: + return 'N/A' + + def _dom_capability_detect(self): + if not self.get_presence(): + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_bias_power_supported = False + self.dom_tx_power_supported = False + self.dom_thresholds_supported = False + self.dom_rx_tx_power_bias_supported = False + self.calibration = 0 + return + + if self.sfp_type == QSFP_TYPE: + self.calibration = 1 + sfpi_obj = sff8436InterfaceId() + if sfpi_obj is None: + self.dom_supported = False + offset = 128 + + # QSFP capability byte parse, through this byte can know whether it support tx_power or not. + # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, + # need to add more code for determining the capability and version compliance + # in SFF-8636 dom capability definitions evolving with the versions. + qsfp_dom_capability_raw = self._read_eeprom_specific_bytes((offset + XCVR_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH) + if qsfp_dom_capability_raw is not None: + qsfp_version_compliance_raw = self._read_eeprom_specific_bytes(QSFP_VERSION_COMPLIANCE_OFFSET, QSFP_VERSION_COMPLIANCE_WIDTH) + qsfp_version_compliance = int(qsfp_version_compliance_raw[0], 16) + dom_capability = sfpi_obj.parse_dom_capability(qsfp_dom_capability_raw, 0) + if qsfp_version_compliance >= 0x08: + self.dom_temp_supported = dom_capability['data']['Temp_support']['value'] == 'On' + self.dom_volt_supported = dom_capability['data']['Voltage_support']['value'] == 'On' + self.dom_rx_power_supported = dom_capability['data']['Rx_power_support']['value'] == 'On' + self.dom_tx_power_supported = dom_capability['data']['Tx_power_support']['value'] == 'On' + else: + self.dom_temp_supported = True + self.dom_volt_supported = True + self.dom_rx_power_supported = dom_capability['data']['Rx_power_support']['value'] == 'On' + self.dom_tx_power_supported = True + self.dom_supported = True + self.calibration = 1 + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + qsfp_option_value_raw = self._read_eeprom_specific_bytes(QSFP_OPTION_VALUE_OFFSET, QSFP_OPTION_VALUE_WIDTH) + if qsfp_option_value_raw is not None: + optional_capability = sfpd_obj.parse_option_params(qsfp_option_value_raw, 0) + self.dom_tx_disable_supported = optional_capability['data']['TxDisable']['value'] == 'On' + dom_status_indicator = sfpd_obj.parse_dom_status_indicator(qsfp_version_compliance_raw, 1) + self.qsfp_page3_available = dom_status_indicator['data']['FlatMem']['value'] == 'Off' + else: + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.calibration = 0 + self.qsfp_page3_available = False + + elif self.sfp_type == QSFP_DD_TYPE: + sfpi_obj = qsfp_dd_InterfaceId() + if sfpi_obj is None: + self.dom_supported = False + + offset = 0 + # two types of QSFP-DD cable types supported: Copper and Optical. + qsfp_dom_capability_raw = self._read_eeprom_specific_bytes((offset + XCVR_DOM_CAPABILITY_OFFSET_QSFP_DD), XCVR_DOM_CAPABILITY_WIDTH_QSFP_DD) + if qsfp_dom_capability_raw is not None: + self.dom_temp_supported = True + self.dom_volt_supported = True + dom_capability = sfpi_obj.parse_dom_capability(qsfp_dom_capability_raw, 0) + if dom_capability['data']['Flat_MEM']['value'] == 'Off': + self.dom_supported = True + self.second_application_list = True + self.dom_rx_power_supported = True + self.dom_tx_power_supported = True + self.dom_tx_bias_power_supported = True + self.dom_thresholds_supported = True + self.dom_rx_tx_power_bias_supported = True + else: + self.dom_supported = False + self.second_application_list = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.dom_tx_bias_power_supported = False + self.dom_thresholds_supported = False + self.dom_rx_tx_power_bias_supported = False + else: + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.dom_tx_bias_power_supported = False + self.dom_thresholds_supported = False + self.dom_rx_tx_power_bias_supported = False + + elif self.sfp_type == SFP_TYPE: + sfpi_obj = sff8472InterfaceId() + if sfpi_obj is None: + return None + sfp_dom_capability_raw = self._read_eeprom_specific_bytes(XCVR_DOM_CAPABILITY_OFFSET, XCVR_DOM_CAPABILITY_WIDTH) + if sfp_dom_capability_raw is not None: + sfp_dom_capability = int(sfp_dom_capability_raw[0], 16) + self.dom_supported = (sfp_dom_capability & 0x40 != 0) + if self.dom_supported: + self.dom_temp_supported = True + self.dom_volt_supported = True + self.dom_rx_power_supported = True + self.dom_tx_power_supported = True + if sfp_dom_capability & 0x20 != 0: + self.calibration = 1 + elif sfp_dom_capability & 0x10 != 0: + self.calibration = 2 + else: + self.calibration = 0 + else: + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.calibration = 0 + self.dom_tx_disable_supported = (int(sfp_dom_capability_raw[1], 16) & 0x40 != 0) + else: + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + + def get_transceiver_info(self): + """ + Retrieves transceiver info of this SFP + + Returns: + A dict which contains following keys/values : + ================================================================================ + keys |Value Format |Information + ---------------------------|---------------|---------------------------- + type |1*255VCHAR |type of SFP + vendor_rev |1*255VCHAR |vendor revision of SFP + serial |1*255VCHAR |serial number of the SFP + manufacturer |1*255VCHAR |SFP vendor name + model |1*255VCHAR |SFP model name + connector |1*255VCHAR |connector information + encoding |1*255VCHAR |encoding information + ext_identifier |1*255VCHAR |extend identifier + ext_rateselect_compliance |1*255VCHAR |extended rateSelect compliance + cable_length |INT |cable length in m + nominal_bit_rate |INT |nominal bit rate by 100Mbs + specification_compliance |1*255VCHAR |specification compliance + vendor_date |1*255VCHAR |vendor date + vendor_oui |1*255VCHAR |vendor OUI + application_advertisement |1*255VCHAR |supported applications advertisement + ================================================================================ + """ + + transceiver_info_dict = {} + compliance_code_dict = {} + transceiver_info_dict = dict.fromkeys(self.info_dict_keys, 'N/A') + transceiver_info_dict['specification_compliance'] = '{}' + if not self.get_presence(): + return transceiver_info_dict + + self._detect_sfp_type(self.sfp_type) + self._dom_capability_detect() + + transceiver_info_dict = {} + compliance_code_dict = {} + + # ToDo: OSFP tranceiver info parsing not fully supported. + # in inf8628.py lack of some memory map definition + # will be implemented when the inf8628 memory map ready + if self.sfp_type == OSFP_TYPE: + offset = 0 + vendor_rev_width = XCVR_HW_REV_WIDTH_OSFP + + sfpi_obj = inf8628InterfaceId() + if sfpi_obj is None: + return None + + sfp_type_raw = self._read_eeprom_specific_bytes((offset + OSFP_TYPE_OFFSET), XCVR_TYPE_WIDTH) + if sfp_type_raw is not None: + sfp_type_data = sfpi_obj.parse_sfp_type(sfp_type_raw, 0) + sfp_type_abbrv_name_data = sfpi_obj.parse_sfp_type_abbrv_name(sfp_type_raw, 0) + else: + return None + + sfp_vendor_name_raw = self._read_eeprom_specific_bytes((offset + OSFP_VENDOR_NAME_OFFSET), XCVR_VENDOR_NAME_WIDTH) + if sfp_vendor_name_raw is not None: + sfp_vendor_name_data = sfpi_obj.parse_vendor_name(sfp_vendor_name_raw, 0) + else: + return None + + sfp_vendor_pn_raw = self._read_eeprom_specific_bytes((offset + OSFP_VENDOR_PN_OFFSET), XCVR_VENDOR_PN_WIDTH) + if sfp_vendor_pn_raw is not None: + sfp_vendor_pn_data = sfpi_obj.parse_vendor_pn(sfp_vendor_pn_raw, 0) + else: + return None + + sfp_vendor_rev_raw = self._read_eeprom_specific_bytes((offset + OSFP_HW_REV_OFFSET), vendor_rev_width) + if sfp_vendor_rev_raw is not None: + sfp_vendor_rev_data = sfpi_obj.parse_vendor_rev(sfp_vendor_rev_raw, 0) + else: + return None + + sfp_vendor_sn_raw = self._read_eeprom_specific_bytes((offset + OSFP_VENDOR_SN_OFFSET), XCVR_VENDOR_SN_WIDTH) + if sfp_vendor_sn_raw is not None: + sfp_vendor_sn_data = sfpi_obj.parse_vendor_sn(sfp_vendor_sn_raw, 0) + else: + return None + + transceiver_info_dict['type'] = sfp_type_data['data']['type']['value'] + transceiver_info_dict['type_abbrv_name'] = sfp_type_abbrv_name_data['data']['type_abbrv_name']['value'] + transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] + transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] + transceiver_info_dict['vendor_oui'] = 'N/A' + transceiver_info_dict['vendor_date'] = 'N/A' + transceiver_info_dict['connector'] = 'N/A' + transceiver_info_dict['encoding'] = 'N/A' + transceiver_info_dict['ext_identifier'] = 'N/A' + transceiver_info_dict['ext_rateselect_compliance'] = 'N/A' + transceiver_info_dict['cable_type'] = 'N/A' + transceiver_info_dict['cable_length'] = 'N/A' + transceiver_info_dict['specification_compliance'] = 'N/A' + transceiver_info_dict['nominal_bit_rate'] = 'N/A' + transceiver_info_dict['application_advertisement'] = 'N/A' + + elif self.sfp_type == QSFP_TYPE: + offset = 128 + vendor_rev_width = XCVR_HW_REV_WIDTH_QSFP + interface_info_bulk_width = XCVR_INTFACE_BULK_WIDTH_QSFP + + sfpi_obj = sff8436InterfaceId() + if sfpi_obj is None: + print("Error: sfp_object open failed") + return None + + elif self.sfp_type == QSFP_DD_TYPE: + offset = 128 + + sfpi_obj = qsfp_dd_InterfaceId() + if sfpi_obj is None: + print("Error: sfp_object open failed") + return None + + sfp_type_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_TYPE_OFFSET), XCVR_TYPE_WIDTH) + if sfp_type_raw is not None: + sfp_type_data = sfpi_obj.parse_sfp_type(sfp_type_raw, 0) + sfp_type_abbrv_name_data = sfpi_obj.parse_sfp_type_abbrv_name(sfp_type_raw, 0) + else: + return None + + sfp_vendor_name_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_VENDOR_NAME_OFFSET), XCVR_VENDOR_NAME_WIDTH) + if sfp_vendor_name_raw is not None: + sfp_vendor_name_data = sfpi_obj.parse_vendor_name(sfp_vendor_name_raw, 0) + else: + return None + + sfp_vendor_pn_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_VENDOR_PN_OFFSET), XCVR_VENDOR_PN_WIDTH) + if sfp_vendor_pn_raw is not None: + sfp_vendor_pn_data = sfpi_obj.parse_vendor_pn(sfp_vendor_pn_raw, 0) + else: + return None + + sfp_vendor_rev_raw = self._read_eeprom_specific_bytes((offset + XCVR_HW_REV_OFFSET_QSFP_DD), XCVR_HW_REV_WIDTH_QSFP_DD) + if sfp_vendor_rev_raw is not None: + sfp_vendor_rev_data = sfpi_obj.parse_vendor_rev(sfp_vendor_rev_raw, 0) + else: + return None + + sfp_vendor_sn_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_VENDOR_SN_OFFSET), XCVR_VENDOR_SN_WIDTH) + if sfp_vendor_sn_raw is not None: + sfp_vendor_sn_data = sfpi_obj.parse_vendor_sn(sfp_vendor_sn_raw, 0) + else: + return None + + sfp_vendor_oui_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_VENDOR_OUI_OFFSET), XCVR_VENDOR_OUI_WIDTH) + if sfp_vendor_oui_raw is not None: + sfp_vendor_oui_data = sfpi_obj.parse_vendor_oui(sfp_vendor_oui_raw, 0) + else: + return None + + sfp_vendor_date_raw = self._read_eeprom_specific_bytes((offset + XCVR_VENDOR_DATE_OFFSET_QSFP_DD), XCVR_VENDOR_DATE_WIDTH_QSFP_DD) + if sfp_vendor_date_raw is not None: + sfp_vendor_date_data = sfpi_obj.parse_vendor_date(sfp_vendor_date_raw, 0) + else: + return None + + sfp_connector_raw = self._read_eeprom_specific_bytes((offset + XCVR_CONNECTOR_OFFSET_QSFP_DD), XCVR_CONNECTOR_WIDTH_QSFP_DD) + if sfp_connector_raw is not None: + sfp_connector_data = sfpi_obj.parse_connector(sfp_connector_raw, 0) + else: + return None + + sfp_ext_identifier_raw = self._read_eeprom_specific_bytes((offset + XCVR_EXT_TYPE_OFFSET_QSFP_DD), XCVR_EXT_TYPE_WIDTH_QSFP_DD) + if sfp_ext_identifier_raw is not None: + sfp_ext_identifier_data = sfpi_obj.parse_ext_iden(sfp_ext_identifier_raw, 0) + else: + return None + + sfp_cable_len_raw = self._read_eeprom_specific_bytes((offset + XCVR_CABLE_LENGTH_OFFSET_QSFP_DD), XCVR_CABLE_LENGTH_WIDTH_QSFP_DD) + if sfp_cable_len_raw is not None: + sfp_cable_len_data = sfpi_obj.parse_cable_len(sfp_cable_len_raw, 0) + else: + return None + + sfp_media_type_raw = self._read_eeprom_specific_bytes(XCVR_MEDIA_TYPE_OFFSET_QSFP_DD, XCVR_MEDIA_TYPE_WIDTH_QSFP_DD) + if sfp_media_type_raw is not None: + sfp_media_type_dict = sfpi_obj.parse_media_type(sfp_media_type_raw, 0) + if sfp_media_type_dict is None: + return None + + host_media_list = "" + sfp_application_type_first_list = self._read_eeprom_specific_bytes((XCVR_FIRST_APPLICATION_LIST_OFFSET_QSFP_DD), XCVR_FIRST_APPLICATION_LIST_WIDTH_QSFP_DD) + if self.second_application_list: + possible_application_count = 15 + sfp_application_type_second_list = self._read_eeprom_specific_bytes((XCVR_SECOND_APPLICATION_LIST_OFFSET_QSFP_DD), XCVR_SECOND_APPLICATION_LIST_WIDTH_QSFP_DD) + if sfp_application_type_first_list is not None and sfp_application_type_second_list is not None: + sfp_application_type_list = sfp_application_type_first_list + sfp_application_type_second_list + else: + return None + else: + possible_application_count = 8 + if sfp_application_type_first_list is not None: + sfp_application_type_list = sfp_application_type_first_list + else: + return None + + for i in range(0, possible_application_count): + if sfp_application_type_list[i * 4] == 'ff': + break + host_electrical, media_interface = sfpi_obj.parse_application(sfp_media_type_dict, sfp_application_type_list[i * 4], sfp_application_type_list[i * 4 + 1]) + host_media_list = host_media_list + host_electrical + ' - ' + media_interface + '\n\t\t\t\t ' + else: + return None + + transceiver_info_dict['type'] = str(sfp_type_data['data']['type']['value']) + transceiver_info_dict['type_abbrv_name'] = str(sfp_type_abbrv_name_data['data']['type_abbrv_name']['value']) + transceiver_info_dict['manufacturer'] = str(sfp_vendor_name_data['data']['Vendor Name']['value']) + transceiver_info_dict['model'] = str(sfp_vendor_pn_data['data']['Vendor PN']['value']) + transceiver_info_dict['vendor_rev'] = str(sfp_vendor_rev_data['data']['Vendor Rev']['value']) + transceiver_info_dict['serial'] = str(sfp_vendor_sn_data['data']['Vendor SN']['value']) + transceiver_info_dict['vendor_oui'] = str(sfp_vendor_oui_data['data']['Vendor OUI']['value']) + transceiver_info_dict['vendor_date'] = str(sfp_vendor_date_data['data']['VendorDataCode(YYYY-MM-DD Lot)']['value']) + transceiver_info_dict['connector'] = str(sfp_connector_data['data']['Connector']['value']) + transceiver_info_dict['encoding'] = 'N/A' + transceiver_info_dict['ext_identifier'] = str(sfp_ext_identifier_data['data']['Extended Identifier']['value']) + transceiver_info_dict['ext_rateselect_compliance'] = 'N/A' + transceiver_info_dict['specification_compliance'] = 'N/A' + transceiver_info_dict['cable_type'] = "Length Cable Assembly(m)" + transceiver_info_dict['cable_length'] = str(sfp_cable_len_data['data']['Length Cable Assembly(m)']['value']) + transceiver_info_dict['nominal_bit_rate'] = 'N/A' + transceiver_info_dict['application_advertisement'] = host_media_list + + else: + offset = 0 + vendor_rev_width = XCVR_HW_REV_WIDTH_SFP + interface_info_bulk_width = XCVR_INTFACE_BULK_WIDTH_SFP + + sfpi_obj = sff8472InterfaceId() + if sfpi_obj is None: + print("Error: sfp_object open failed") + return None + + if self.sfp_type != QSFP_DD_TYPE: + # Add retry for xcvr eeprom to get ready + max_retry = 10 + for i in range(0,max_retry): + sfp_interface_bulk_raw = self._read_eeprom_specific_bytes( + offset + XCVR_INTERFACE_DATA_START, XCVR_INTERFACE_DATA_SIZE) + if sfp_interface_bulk_raw is not None: + break + else: + if not self.get_presence(): + return transceiver_info_dict + elif i == max_retry-1: + pass + else: + time.sleep(0.5) + + if sfp_interface_bulk_raw is None: + return transceiver_info_dict + + start = XCVR_INTFACE_BULK_OFFSET - XCVR_INTERFACE_DATA_START + end = start + interface_info_bulk_width + sfp_interface_bulk_data = sfpi_obj.parse_sfp_info_bulk(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_VENDOR_NAME_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_NAME_WIDTH + sfp_vendor_name_data = sfpi_obj.parse_vendor_name(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_VENDOR_PN_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_PN_WIDTH + sfp_vendor_pn_data = sfpi_obj.parse_vendor_pn(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_HW_REV_OFFSET - XCVR_INTERFACE_DATA_START + end = start + vendor_rev_width + sfp_vendor_rev_data = sfpi_obj.parse_vendor_rev(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_VENDOR_SN_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_SN_WIDTH + sfp_vendor_sn_data = sfpi_obj.parse_vendor_sn(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_VENDOR_OUI_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_OUI_WIDTH + sfp_vendor_oui_data = sfpi_obj.parse_vendor_oui(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_VENDOR_DATE_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_DATE_WIDTH + sfp_vendor_date_data = sfpi_obj.parse_vendor_date(sfp_interface_bulk_raw[start : end], 0) + + transceiver_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value'] + transceiver_info_dict['type_abbrv_name'] = sfp_interface_bulk_data['data']['type_abbrv_name']['value'] + transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] + transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] + transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] + transceiver_info_dict['vendor_date'] = sfp_vendor_date_data['data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] + transceiver_info_dict['connector'] = sfp_interface_bulk_data['data']['Connector']['value'] + transceiver_info_dict['encoding'] = sfp_interface_bulk_data['data']['EncodingCodes']['value'] + transceiver_info_dict['ext_identifier'] = sfp_interface_bulk_data['data']['Extended Identifier']['value'] + transceiver_info_dict['ext_rateselect_compliance'] = sfp_interface_bulk_data['data']['RateIdentifier']['value'] + transceiver_info_dict['application_advertisement'] = 'N/A' + + if self.sfp_type == QSFP_TYPE: + for key in qsfp_cable_length_tup: + if key in sfp_interface_bulk_data['data']: + transceiver_info_dict['cable_type'] = key + transceiver_info_dict['cable_length'] = str(sfp_interface_bulk_data['data'][key]['value']) + + for key in qsfp_compliance_code_tup: + if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: + compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value'] + sfp_ext_specification_compliance_raw = self._read_eeprom_specific_bytes(offset + XCVR_EXT_SPECIFICATION_COMPLIANCE_OFFSET, XCVR_EXT_SPECIFICATION_COMPLIANCE_WIDTH) + if sfp_ext_specification_compliance_raw is not None: + sfp_ext_specification_compliance_data = sfpi_obj.parse_ext_specification_compliance(sfp_ext_specification_compliance_raw[0 : 1], 0) + if sfp_ext_specification_compliance_data['data']['Extended Specification compliance']['value'] != "Unspecified": + compliance_code_dict['Extended Specification compliance'] = sfp_ext_specification_compliance_data['data']['Extended Specification compliance']['value'] + transceiver_info_dict['specification_compliance'] = str(compliance_code_dict) + + transceiver_info_dict['nominal_bit_rate'] = str(sfp_interface_bulk_data['data']['Nominal Bit Rate(100Mbs)']['value']) + else: + for key in sfp_cable_length_tup: + if key in sfp_interface_bulk_data['data']: + transceiver_info_dict['cable_type'] = key + transceiver_info_dict['cable_length'] = str(sfp_interface_bulk_data['data'][key]['value']) + + for key in sfp_compliance_code_tup: + if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: + compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value'] + transceiver_info_dict['specification_compliance'] = str(compliance_code_dict) + + transceiver_info_dict['nominal_bit_rate'] = str(sfp_interface_bulk_data['data']['NominalSignallingRate(UnitsOf100Mbd)']['value']) + + return transceiver_info_dict + + def get_transceiver_bulk_status(self): + """ + Retrieves transceiver bulk status of this SFP + + Returns: + A dict which contains following keys/values : + ======================================================================== + keys |Value Format |Information + ---------------------------|---------------|---------------------------- + rx_los |BOOLEAN |RX loss-of-signal status, True if has RX los, False if not. + tx_fault |BOOLEAN |TX fault status, True if has TX fault, False if not. + reset_status |BOOLEAN |reset status, True if SFP in reset, False if not. + lp_mode |BOOLEAN |low power mode status, True in lp mode, False if not. + tx_disable |BOOLEAN |TX disable status, True TX disabled, False if not. + tx_disabled_channel |HEX |disabled TX channels in hex, bits 0 to 3 represent channel 0 + | |to channel 3. + temperature |INT |module temperature in Celsius + voltage |INT |supply voltage in mV + txbias |INT |TX Bias Current in mA, n is the channel number, + | |for example, tx2bias stands for tx bias of channel 2. + rxpower |INT |received optical power in mW, n is the channel number, + | |for example, rx2power stands for rx power of channel 2. + txpower |INT |TX output power in mW, n is the channel number, + | |for example, tx2power stands for tx power of channel 2. + ======================================================================== + """ + transceiver_dom_info_dict = {} + + dom_info_dict_keys = ['temperature', 'voltage', + 'rx1power', 'rx2power', + 'rx3power', 'rx4power', + 'rx5power', 'rx6power', + 'rx7power', 'rx8power', + 'tx1bias', 'tx2bias', + 'tx3bias', 'tx4bias', + 'tx5bias', 'tx6bias', + 'tx7bias', 'tx8bias', + 'tx1power', 'tx2power', + 'tx3power', 'tx4power', + 'tx5power', 'tx6power', + 'tx7power', 'tx8power' + ] + transceiver_dom_info_dict = dict.fromkeys(dom_info_dict_keys, 'N/A') + + if not self.get_presence(): + return {} + + self._dom_capability_detect() + + if self.sfp_type == OSFP_TYPE: + pass + + elif self.sfp_type == QSFP_TYPE: + if not self.dom_supported: + return transceiver_dom_info_dict + + offset = 0 + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return transceiver_dom_info_dict + + dom_data_raw = self._read_eeprom_specific_bytes((offset + QSFP_DOM_BULK_DATA_START), QSFP_DOM_BULK_DATA_SIZE) + if dom_data_raw is None: + return transceiver_dom_info_dict + + if self.dom_temp_supported: + start = QSFP_TEMPE_OFFSET - QSFP_DOM_BULK_DATA_START + end = start + QSFP_TEMPE_WIDTH + dom_temperature_data = sfpd_obj.parse_temperature(dom_data_raw[start : end], 0) + temp = self._convert_string_to_num(dom_temperature_data['data']['Temperature']['value']) + if temp is not None: + transceiver_dom_info_dict['temperature'] = temp + + if self.dom_volt_supported: + start = QSFP_VOLT_OFFSET - QSFP_DOM_BULK_DATA_START + end = start + QSFP_VOLT_WIDTH + dom_voltage_data = sfpd_obj.parse_voltage(dom_data_raw[start : end], 0) + volt = self._convert_string_to_num(dom_voltage_data['data']['Vcc']['value']) + if volt is not None: + transceiver_dom_info_dict['voltage'] = volt + + start = QSFP_CHANNL_MON_OFFSET - QSFP_DOM_BULK_DATA_START + end = start + QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power(dom_data_raw[start : end], 0) + + if self.dom_tx_power_supported: + transceiver_dom_info_dict['tx1power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['TX1Power']['value']) + transceiver_dom_info_dict['tx2power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['TX2Power']['value']) + transceiver_dom_info_dict['tx3power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['TX3Power']['value']) + transceiver_dom_info_dict['tx4power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['TX4Power']['value']) + + if self.dom_rx_power_supported: + transceiver_dom_info_dict['rx1power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['RX1Power']['value']) + transceiver_dom_info_dict['rx2power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['RX2Power']['value']) + transceiver_dom_info_dict['rx3power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['RX3Power']['value']) + transceiver_dom_info_dict['rx4power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['RX4Power']['value']) + + transceiver_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TX1Bias']['value'] + transceiver_dom_info_dict['tx2bias'] = dom_channel_monitor_data['data']['TX2Bias']['value'] + transceiver_dom_info_dict['tx3bias'] = dom_channel_monitor_data['data']['TX3Bias']['value'] + transceiver_dom_info_dict['tx4bias'] = dom_channel_monitor_data['data']['TX4Bias']['value'] + + elif self.sfp_type == QSFP_DD_TYPE: + + offset = 0 + sfpd_obj = qsfp_dd_Dom() + if sfpd_obj is None: + return transceiver_dom_info_dict + + dom_data_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_DOM_BULK_DATA_START), QSFP_DD_DOM_BULK_DATA_SIZE) + if dom_data_raw is None: + return transceiver_dom_info_dict + + if self.dom_temp_supported: + start = QSFP_DD_TEMPE_OFFSET - QSFP_DD_DOM_BULK_DATA_START + end = start + QSFP_DD_TEMPE_WIDTH + dom_temperature_data = sfpd_obj.parse_temperature(dom_data_raw[start : end], 0) + temp = self._convert_string_to_num(dom_temperature_data['data']['Temperature']['value']) + if temp is not None: + transceiver_dom_info_dict['temperature'] = temp + + if self.dom_volt_supported: + start = QSFP_DD_VOLT_OFFSET - QSFP_DD_DOM_BULK_DATA_START + end = start + QSFP_DD_VOLT_WIDTH + dom_voltage_data = sfpd_obj.parse_voltage(dom_data_raw[start : end], 0) + volt = self._convert_string_to_num(dom_voltage_data['data']['Vcc']['value']) + if volt is not None: + transceiver_dom_info_dict['voltage'] = volt + + if self.dom_rx_tx_power_bias_supported: + # page 11h + offset = 512 + dom_data_raw = self._read_eeprom_specific_bytes(offset + QSFP_DD_CHANNL_MON_OFFSET, QSFP_DD_CHANNL_MON_WIDTH) + if dom_data_raw is None: + return transceiver_dom_info_dict + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params(dom_data_raw, 0) + + if self.dom_tx_power_supported: + transceiver_dom_info_dict['tx1power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['TX1Power']['value'])) + transceiver_dom_info_dict['tx2power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['TX2Power']['value'])) + transceiver_dom_info_dict['tx3power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['TX3Power']['value'])) + transceiver_dom_info_dict['tx4power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['TX4Power']['value'])) + transceiver_dom_info_dict['tx5power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['TX5Power']['value'])) + transceiver_dom_info_dict['tx6power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['TX6Power']['value'])) + transceiver_dom_info_dict['tx7power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['TX7Power']['value'])) + transceiver_dom_info_dict['tx8power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['TX8Power']['value'])) + + if self.dom_rx_power_supported: + transceiver_dom_info_dict['rx1power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['RX1Power']['value'])) + transceiver_dom_info_dict['rx2power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['RX2Power']['value'])) + transceiver_dom_info_dict['rx3power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['RX3Power']['value'])) + transceiver_dom_info_dict['rx4power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['RX4Power']['value'])) + transceiver_dom_info_dict['rx5power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['RX5Power']['value'])) + transceiver_dom_info_dict['rx6power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['RX6Power']['value'])) + transceiver_dom_info_dict['rx7power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['RX7Power']['value'])) + transceiver_dom_info_dict['rx8power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['RX8Power']['value'])) + + if self.dom_tx_bias_power_supported: + transceiver_dom_info_dict['tx1bias'] = str(dom_channel_monitor_data['data']['TX1Bias']['value']) + transceiver_dom_info_dict['tx2bias'] = str(dom_channel_monitor_data['data']['TX2Bias']['value']) + transceiver_dom_info_dict['tx3bias'] = str(dom_channel_monitor_data['data']['TX3Bias']['value']) + transceiver_dom_info_dict['tx4bias'] = str(dom_channel_monitor_data['data']['TX4Bias']['value']) + transceiver_dom_info_dict['tx5bias'] = str(dom_channel_monitor_data['data']['TX5Bias']['value']) + transceiver_dom_info_dict['tx6bias'] = str(dom_channel_monitor_data['data']['TX6Bias']['value']) + transceiver_dom_info_dict['tx7bias'] = str(dom_channel_monitor_data['data']['TX7Bias']['value']) + transceiver_dom_info_dict['tx8bias'] = str(dom_channel_monitor_data['data']['TX8Bias']['value']) + + return transceiver_dom_info_dict + + else: + if not self.dom_supported: + return transceiver_dom_info_dict + + offset = 256 + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return transceiver_dom_info_dict + sfpd_obj._calibration_type = self.calibration + + dom_data_raw = self._read_eeprom_specific_bytes((offset + SFP_DOM_BULK_DATA_START), SFP_DOM_BULK_DATA_SIZE) + + start = SFP_TEMPE_OFFSET - SFP_DOM_BULK_DATA_START + end = start + SFP_TEMPE_WIDTH + dom_temperature_data = sfpd_obj.parse_temperature(dom_data_raw[start: end], 0) + + start = SFP_VOLT_OFFSET - SFP_DOM_BULK_DATA_START + end = start + SFP_VOLT_WIDTH + dom_voltage_data = sfpd_obj.parse_voltage(dom_data_raw[start: end], 0) + + start = SFP_CHANNL_MON_OFFSET - SFP_DOM_BULK_DATA_START + end = start + SFP_CHANNL_MON_WIDTH + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params(dom_data_raw[start: end], 0) + + transceiver_dom_info_dict['temperature'] = self._convert_string_to_num(dom_temperature_data['data']['Temperature']['value']) + transceiver_dom_info_dict['voltage'] = self._convert_string_to_num(dom_voltage_data['data']['Vcc']['value']) + transceiver_dom_info_dict['rx1power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['RXPower']['value']) + transceiver_dom_info_dict['tx1bias'] = self._convert_string_to_num(dom_channel_monitor_data['data']['TXBias']['value']) + transceiver_dom_info_dict['tx1power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['TXPower']['value']) + + return transceiver_dom_info_dict + + def get_transceiver_threshold_info(self): + """ + Retrieves transceiver threshold info of this SFP + + Returns: + A dict which contains following keys/values : + ======================================================================== + keys |Value Format |Information + ---------------------------|---------------|---------------------------- + temphighalarm |FLOAT |High Alarm Threshold value of temperature in Celsius. + templowalarm |FLOAT |Low Alarm Threshold value of temperature in Celsius. + temphighwarning |FLOAT |High Warning Threshold value of temperature in Celsius. + templowwarning |FLOAT |Low Warning Threshold value of temperature in Celsius. + vcchighalarm |FLOAT |High Alarm Threshold value of supply voltage in mV. + vcclowalarm |FLOAT |Low Alarm Threshold value of supply voltage in mV. + vcchighwarning |FLOAT |High Warning Threshold value of supply voltage in mV. + vcclowwarning |FLOAT |Low Warning Threshold value of supply voltage in mV. + rxpowerhighalarm |FLOAT |High Alarm Threshold value of received power in dBm. + rxpowerlowalarm |FLOAT |Low Alarm Threshold value of received power in dBm. + rxpowerhighwarning |FLOAT |High Warning Threshold value of received power in dBm. + rxpowerlowwarning |FLOAT |Low Warning Threshold value of received power in dBm. + txpowerhighalarm |FLOAT |High Alarm Threshold value of transmit power in dBm. + txpowerlowalarm |FLOAT |Low Alarm Threshold value of transmit power in dBm. + txpowerhighwarning |FLOAT |High Warning Threshold value of transmit power in dBm. + txpowerlowwarning |FLOAT |Low Warning Threshold value of transmit power in dBm. + txbiashighalarm |FLOAT |High Alarm Threshold value of tx Bias Current in mA. + txbiaslowalarm |FLOAT |Low Alarm Threshold value of tx Bias Current in mA. + txbiashighwarning |FLOAT |High Warning Threshold value of tx Bias Current in mA. + txbiaslowwarning |FLOAT |Low Warning Threshold value of tx Bias Current in mA. + ======================================================================== + """ + transceiver_dom_threshold_info_dict = {} + + dom_info_dict_keys = ['temphighalarm', 'temphighwarning', + 'templowalarm', 'templowwarning', + 'vcchighalarm', 'vcchighwarning', + 'vcclowalarm', 'vcclowwarning', + 'rxpowerhighalarm', 'rxpowerhighwarning', + 'rxpowerlowalarm', 'rxpowerlowwarning', + 'txpowerhighalarm', 'txpowerhighwarning', + 'txpowerlowalarm', 'txpowerlowwarning', + 'txbiashighalarm', 'txbiashighwarning', + 'txbiaslowalarm', 'txbiaslowwarning' + ] + transceiver_dom_threshold_info_dict = dict.fromkeys(dom_info_dict_keys, 'N/A') + + if self.sfp_type == OSFP_TYPE: + pass + + elif self.sfp_type == QSFP_TYPE: + if not self.dom_supported or not self.qsfp_page3_available: + return transceiver_dom_threshold_info_dict + + # Dom Threshold data starts from offset 384 + # Revert offset back to 0 once data is retrieved + offset = QSFP_MODULE_UPPER_PAGE3_START + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return transceiver_dom_threshold_info_dict + + dom_module_threshold_raw = self._read_eeprom_specific_bytes((offset + QSFP_MODULE_THRESHOLD_OFFSET), QSFP_MODULE_THRESHOLD_WIDTH) + if dom_module_threshold_raw is None: + return transceiver_dom_threshold_info_dict + + dom_module_threshold_data = sfpd_obj.parse_module_threshold_values(dom_module_threshold_raw, 0) + + dom_channel_threshold_raw = self._read_eeprom_specific_bytes((offset + QSFP_CHANNL_THRESHOLD_OFFSET), + QSFP_CHANNL_THRESHOLD_WIDTH) + if dom_channel_threshold_raw is None: + return transceiver_dom_threshold_info_dict + dom_channel_threshold_data = sfpd_obj.parse_channel_threshold_values(dom_channel_threshold_raw, 0) + + # Threshold Data + transceiver_dom_threshold_info_dict['temphighalarm'] = dom_module_threshold_data['data']['TempHighAlarm']['value'] + transceiver_dom_threshold_info_dict['temphighwarning'] = dom_module_threshold_data['data']['TempHighWarning']['value'] + transceiver_dom_threshold_info_dict['templowalarm'] = dom_module_threshold_data['data']['TempLowAlarm']['value'] + transceiver_dom_threshold_info_dict['templowwarning'] = dom_module_threshold_data['data']['TempLowWarning']['value'] + transceiver_dom_threshold_info_dict['vcchighalarm'] = dom_module_threshold_data['data']['VccHighAlarm']['value'] + transceiver_dom_threshold_info_dict['vcchighwarning'] = dom_module_threshold_data['data']['VccHighWarning']['value'] + transceiver_dom_threshold_info_dict['vcclowalarm'] = dom_module_threshold_data['data']['VccLowAlarm']['value'] + transceiver_dom_threshold_info_dict['vcclowwarning'] = dom_module_threshold_data['data']['VccLowWarning']['value'] + transceiver_dom_threshold_info_dict['rxpowerhighalarm'] = dom_channel_threshold_data['data']['RxPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerhighwarning'] = dom_channel_threshold_data['data']['RxPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowalarm'] = dom_channel_threshold_data['data']['RxPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_channel_threshold_data['data']['RxPowerLowWarning']['value'] + transceiver_dom_threshold_info_dict['txbiashighalarm'] = dom_channel_threshold_data['data']['TxBiasHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiashighwarning'] = dom_channel_threshold_data['data']['TxBiasHighWarning']['value'] + transceiver_dom_threshold_info_dict['txbiaslowalarm'] = dom_channel_threshold_data['data']['TxBiasLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiaslowwarning'] = dom_channel_threshold_data['data']['TxBiasLowWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerhighalarm'] = dom_channel_threshold_data['data']['TxPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerhighwarning'] = dom_channel_threshold_data['data']['TxPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerlowalarm'] = dom_channel_threshold_data['data']['TxPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerlowwarning'] = dom_channel_threshold_data['data']['TxPowerLowWarning']['value'] + + elif self.sfp_type == QSFP_DD_TYPE: + if not self.dom_supported: + return transceiver_dom_threshold_info_dict + + if not self.dom_thresholds_supported: + return transceiver_dom_threshold_info_dict + + sfpd_obj = qsfp_dd_Dom() + if sfpd_obj is None: + return transceiver_dom_threshold_info_dict + + # page 02 + offset = 384 + dom_module_threshold_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_MODULE_THRESHOLD_OFFSET), QSFP_DD_MODULE_THRESHOLD_WIDTH) + if dom_module_threshold_raw is None: + return transceiver_dom_threshold_info_dict + + dom_module_threshold_data = sfpd_obj.parse_module_threshold_values(dom_module_threshold_raw, 0) + + # Threshold Data + transceiver_dom_threshold_info_dict['temphighalarm'] = dom_module_threshold_data['data']['TempHighAlarm']['value'] + transceiver_dom_threshold_info_dict['temphighwarning'] = dom_module_threshold_data['data']['TempHighWarning']['value'] + transceiver_dom_threshold_info_dict['templowalarm'] = dom_module_threshold_data['data']['TempLowAlarm']['value'] + transceiver_dom_threshold_info_dict['templowwarning'] = dom_module_threshold_data['data']['TempLowWarning']['value'] + transceiver_dom_threshold_info_dict['vcchighalarm'] = dom_module_threshold_data['data']['VccHighAlarm']['value'] + transceiver_dom_threshold_info_dict['vcchighwarning'] = dom_module_threshold_data['data']['VccHighWarning']['value'] + transceiver_dom_threshold_info_dict['vcclowalarm'] = dom_module_threshold_data['data']['VccLowAlarm']['value'] + transceiver_dom_threshold_info_dict['vcclowwarning'] = dom_module_threshold_data['data']['VccLowWarning']['value'] + transceiver_dom_threshold_info_dict['rxpowerhighalarm'] = dom_module_threshold_data['data']['RxPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerhighwarning'] = dom_module_threshold_data['data']['RxPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowalarm'] = dom_module_threshold_data['data']['RxPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_module_threshold_data['data']['RxPowerLowWarning']['value'] + transceiver_dom_threshold_info_dict['txbiashighalarm'] = dom_module_threshold_data['data']['TxBiasHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiashighwarning'] = dom_module_threshold_data['data']['TxBiasHighWarning']['value'] + transceiver_dom_threshold_info_dict['txbiaslowalarm'] = dom_module_threshold_data['data']['TxBiasLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiaslowwarning'] = dom_module_threshold_data['data']['TxBiasLowWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerhighalarm'] = dom_module_threshold_data['data']['TxPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerhighwarning'] = dom_module_threshold_data['data']['TxPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerlowalarm'] = dom_module_threshold_data['data']['TxPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerlowwarning'] = dom_module_threshold_data['data']['TxPowerLowWarning']['value'] + + else: + offset = SFP_MODULE_ADDRA2_OFFSET + + if not self.dom_supported: + return transceiver_dom_threshold_info_dict + + sfpd_obj = sff8472Dom(None, self.calibration) + if sfpd_obj is None: + return transceiver_dom_threshold_info_dict + + dom_module_threshold_raw = self._read_eeprom_specific_bytes((offset + SFP_MODULE_THRESHOLD_OFFSET), + SFP_MODULE_THRESHOLD_WIDTH) + if dom_module_threshold_raw is not None: + dom_module_threshold_data = sfpd_obj.parse_alarm_warning_threshold(dom_module_threshold_raw, 0) + else: + return transceiver_dom_threshold_info_dict + + # Threshold Data + transceiver_dom_threshold_info_dict['temphighalarm'] = dom_module_threshold_data['data']['TempHighAlarm']['value'] + transceiver_dom_threshold_info_dict['templowalarm'] = dom_module_threshold_data['data']['TempLowAlarm']['value'] + transceiver_dom_threshold_info_dict['temphighwarning'] = dom_module_threshold_data['data']['TempHighWarning']['value'] + transceiver_dom_threshold_info_dict['templowwarning'] = dom_module_threshold_data['data']['TempLowWarning']['value'] + transceiver_dom_threshold_info_dict['vcchighalarm'] = dom_module_threshold_data['data']['VoltageHighAlarm']['value'] + transceiver_dom_threshold_info_dict['vcclowalarm'] = dom_module_threshold_data['data']['VoltageLowAlarm']['value'] + transceiver_dom_threshold_info_dict['vcchighwarning'] = dom_module_threshold_data['data']['VoltageHighWarning']['value'] + transceiver_dom_threshold_info_dict['vcclowwarning'] = dom_module_threshold_data['data']['VoltageLowWarning']['value'] + transceiver_dom_threshold_info_dict['txbiashighalarm'] = dom_module_threshold_data['data']['BiasHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiaslowalarm'] = dom_module_threshold_data['data']['BiasLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiashighwarning'] = dom_module_threshold_data['data']['BiasHighWarning']['value'] + transceiver_dom_threshold_info_dict['txbiaslowwarning'] = dom_module_threshold_data['data']['BiasLowWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerhighalarm'] = dom_module_threshold_data['data']['TXPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerlowalarm'] = dom_module_threshold_data['data']['TXPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerhighwarning'] = dom_module_threshold_data['data']['TXPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerlowwarning'] = dom_module_threshold_data['data']['TXPowerLowWarning']['value'] + transceiver_dom_threshold_info_dict['rxpowerhighalarm'] = dom_module_threshold_data['data']['RXPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowalarm'] = dom_module_threshold_data['data']['RXPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerhighwarning'] = dom_module_threshold_data['data']['RXPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_module_threshold_data['data']['RXPowerLowWarning']['value'] + + return transceiver_dom_threshold_info_dict + + def get_reset_status(self): + """ + Retrieves the reset status of SFP + Returns: + A Boolean, True if reset enabled, False if disabled + """ + # SFP doesn't support this feature + if self.sfp_type == SFP_TYPE: + return False + elif self.sfp_type == QSFP_TYPE: + return False + elif self.sfp_type == OSFP_TYPE or self.sfp_type == QSFP_DD_TYPE: + status = 0 + node = self.sfp_path + self.sfp_reset + try: + with open(node, 'r') as val: + status = int(val.read()) + except IOError: + return False + + return status == 1 + + def get_rx_los(self): + """ + Retrieves the RX LOS (lost-of-signal) status of SFP + + Returns: + A Boolean, True if SFP has RX LOS, False if not. + Note : RX LOS status is latched until a call to get_rx_los or a reset. + """ + rx_los_list = [] + + if self.sfp_rx_loss is not None: + status = 0 + node = self.sfp_path + self.sfp_rx_loss + try: + with open(node, 'r') as val: + status = int(val.read()) + status = status & self.sfp_mask + except IOError: + return False + rx_los_list.append(status == self.sfp_mask) + elif self.sfp_type == OSFP_TYPE: + return None + elif self.sfp_type == QSFP_TYPE: + offset = 0 + dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_CHANNL_RX_LOS_STATUS_OFFSET), QSFP_CHANNL_RX_LOS_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + rx_los_data = int(dom_channel_monitor_raw[0], 16) + rx_los_list.append(rx_los_data & 0x01 != 0) + rx_los_list.append(rx_los_data & 0x02 != 0) + rx_los_list.append(rx_los_data & 0x04 != 0) + rx_los_list.append(rx_los_data & 0x08 != 0) + elif self.sfp_type == QSFP_DD_TYPE: + # page 11h + if self.dom_rx_tx_power_bias_supported: + offset = 512 + rx_los_list = [] + dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_CHANNL_RX_LOS_STATUS_OFFSET), QSFP_DD_CHANNL_RX_LOS_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + rx_los_data = int(dom_channel_monitor_raw[0], 8) + rx_los_list.append(rx_los_data & 0x01 != 0) + rx_los_list.append(rx_los_data & 0x02 != 0) + rx_los_list.append(rx_los_data & 0x04 != 0) + rx_los_list.append(rx_los_data & 0x08 != 0) + rx_los_list.append(rx_los_data & 0x10 != 0) + rx_los_list.append(rx_los_data & 0x20 != 0) + rx_los_list.append(rx_los_data & 0x40 != 0) + rx_los_list.append(rx_los_data & 0x80 != 0) + else: + offset = 256 + dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + SFP_CHANNL_STATUS_OFFSET), SFP_CHANNL_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + rx_los_data = int(dom_channel_monitor_raw[0], 16) + rx_los_list.append(rx_los_data & 0x02 != 0) + else: + return None + return rx_los_list + + def get_tx_fault(self): + """ + Retrieves the TX fault status of SFP + + Returns: + A Boolean, True if SFP has TX fault, False if not + Note : TX fault status is lached until a call to get_tx_fault or a reset. + """ + tx_fault_list = [] + + if self.sfp_tx_fault is not None: + status = 0 + node = self.sfp_path + self.sfp_tx_fault + try: + with open(node, 'r') as val: + status = int(val.read()) + status = status & self.sfp_mask + except IOError: + return False + tx_fault_list.append(status == self.sfp_mask) + elif self.sfp_type == OSFP_TYPE: + return None + elif self.sfp_type == QSFP_TYPE: + offset = 0 + dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_CHANNL_TX_FAULT_STATUS_OFFSET), QSFP_CHANNL_TX_FAULT_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + tx_fault_data = int(dom_channel_monitor_raw[0], 16) + tx_fault_list.append(tx_fault_data & 0x01 != 0) + tx_fault_list.append(tx_fault_data & 0x02 != 0) + tx_fault_list.append(tx_fault_data & 0x04 != 0) + tx_fault_list.append(tx_fault_data & 0x08 != 0) + elif self.sfp_type == QSFP_DD_TYPE: + # page 11h + if self.dom_rx_tx_power_bias_supported: + offset = 512 + dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_CHANNL_TX_FAULT_STATUS_OFFSET), QSFP_DD_CHANNL_TX_FAULT_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + tx_fault_data = int(dom_channel_monitor_raw[0], 8) + tx_fault_list.append(tx_fault_data & 0x01 != 0) + tx_fault_list.append(tx_fault_data & 0x02 != 0) + tx_fault_list.append(tx_fault_data & 0x04 != 0) + tx_fault_list.append(tx_fault_data & 0x08 != 0) + tx_fault_list.append(tx_fault_data & 0x10 != 0) + tx_fault_list.append(tx_fault_data & 0x20 != 0) + tx_fault_list.append(tx_fault_data & 0x40 != 0) + tx_fault_list.append(tx_fault_data & 0x80 != 0) + else: + offset = 256 + dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + SFP_CHANNL_STATUS_OFFSET), SFP_CHANNL_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + tx_fault_data = int(dom_channel_monitor_raw[0], 16) + tx_fault_list.append(tx_fault_data & 0x04 != 0) + else: + return None + return tx_fault_list + + def get_tx_disable(self): + """ + Retrieves the tx_disable status of this SFP + + Returns: + A Boolean, True if tx_disable is enabled, False if disabled + + for QSFP, the disable states of each channel which are the lower 4 bits in byte 85 page a0 + for SFP, the TX Disable State and Soft TX Disable Select is ORed as the tx_disable status returned + These two bits are bit 7 & 6 in byte 110 page a2 respectively + """ + tx_disable_list = [] + + if self.sfp_tx_disable is not None: + status = 0 + node = self.sfp_path + self.sfp_tx_disable + try: + with open(node, 'r') as val: + status = int(val.read()) + status = status & self.sfp_mask + except IOError: + return False + tx_disable_list.append(status == self.sfp_mask) + + elif self.sfp_type == OSFP_TYPE: + return None + elif self.sfp_type == QSFP_TYPE: + offset = 0 + dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_CHANNL_DISABLE_STATUS_OFFSET), QSFP_CHANNL_DISABLE_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + tx_disable_data = int(dom_channel_monitor_raw[0], 16) + tx_disable_list.append(tx_disable_data & 0x01 != 0) + tx_disable_list.append(tx_disable_data & 0x02 != 0) + tx_disable_list.append(tx_disable_data & 0x04 != 0) + tx_disable_list.append(tx_disable_data & 0x08 != 0) + + elif self.sfp_type == QSFP_DD_TYPE: + if self.dom_rx_tx_power_bias_supported: + offset = 128 + dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_CHANNL_DISABLE_STATUS_OFFSET), QSFP_DD_CHANNL_DISABLE_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + tx_disable_data = int(dom_channel_monitor_raw[0], 16) + tx_disable_list.append(tx_disable_data & 0x01 != 0) + tx_disable_list.append(tx_disable_data & 0x02 != 0) + tx_disable_list.append(tx_disable_data & 0x04 != 0) + tx_disable_list.append(tx_disable_data & 0x08 != 0) + tx_disable_list.append(tx_disable_data & 0x10 != 0) + tx_disable_list.append(tx_disable_data & 0x20 != 0) + tx_disable_list.append(tx_disable_data & 0x40 != 0) + tx_disable_list.append(tx_disable_data & 0x80 != 0) + else: + offset = 256 + dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + SFP_CHANNL_STATUS_OFFSET), SFP_CHANNL_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + tx_disable_data = int(dom_channel_monitor_raw[0], 16) + tx_disable_list.append(tx_disable_data & 0xC0 != 0) + else: + return None + return tx_disable_list + + def get_tx_disable_channel(self): + """ + Retrieves the TX disabled channels in this SFP + Returns: + A hex of 4 bits (bit 0 to bit 3 as channel 0 to channel 3) to represent + TX channels which have been disabled in this SFP. + As an example, a returned value of 0x5 indicates that channel 0 + and channel 2 have been disabled. + """ + # SFP doesn't support this feature + if self.sfp_type == SFP_TYPE: + return 0 + elif self.sfp_type == QSFP_TYPE: + tx_disable_list = self.get_tx_disable() + if tx_disable_list is None: + return 0 + tx_disabled = 0 + for i in range(len(tx_disable_list)): + if tx_disable_list[i]: + tx_disabled |= 1 << i + else: + return None + + return tx_disabled + + def get_lpmode(self): + """ + Retrieves the lpmode (low power mode) status of this QSFP module + Returns: + A Boolean, True if lpmode is enabled, False if disabled + """ + # SFP doesn't support this feature + if self.sfp_type == SFP_TYPE: + return False + elif self.sfp_type == QSFP_TYPE: + return False + elif self.sfp_type == OSFP_TYPE or self.sfp_type == QSFP_DD_TYPE: + status = 0 + node = self.sfp_path + self.sfp_lpmode + try: + with open(node, 'r') as val: + status = int(val.read()) + except IOError: + return False + return status == 1 + else: + return None + + def get_power_override(self): + """ + Retrieves the power-override status of this SFP + Returns: + A Boolean, True if power-override is enabled, False if disabled + """ + # SFP doesn't support this feature + if self.sfp_type == SFP_TYPE: + return False + elif self.sfp_type == QSFP_TYPE: + offset = 0 + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return False + + dom_control_raw = self._read_eeprom_specific_bytes( + (offset + QSFP_POWEROVERRIDE_OFFSET), QSFP_POWEROVERRIDE_WIDTH) + if dom_control_raw is not None: + if int(dom_control_raw[0],16) & (0x01 << QSFP_POWEROVERRIDE_BIT): + return True + else: + return False + else: + return None + + def get_temperature(self): + """ + Retrieves the temperature of this SFP + + Returns: + An integer number of current temperature in Celsius + """ + if not self.dom_supported: + return None + if self.sfp_type == QSFP_TYPE: + offset = 0 + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + if self.dom_temp_supported: + dom_temperature_raw = self._read_eeprom_specific_bytes((offset + QSFP_TEMPE_OFFSET), QSFP_TEMPE_WIDTH) + if dom_temperature_raw is not None: + dom_temperature_data = sfpd_obj.parse_temperature(dom_temperature_raw, 0) + temp = self._convert_string_to_num(dom_temperature_data['data']['Temperature']['value']) + return temp + else: + return None + else: + return None + + elif self.sfp_type == QSFP_DD_TYPE: + offset = 0 + + sfpd_obj = qsfp_dd_Dom() + if sfpd_obj is None: + return None + + if self.dom_temp_supported: + dom_temperature_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_TEMPE_OFFSET), QSFP_DD_TEMPE_WIDTH) + if dom_temperature_raw is not None: + dom_temperature_data = sfpd_obj.parse_temperature(dom_temperature_raw, 0) + temp = self._convert_string_to_num(dom_temperature_data['data']['Temperature']['value']) + return temp + return None + + else: + offset = 256 + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return None + sfpd_obj._calibration_type = 1 + + dom_temperature_raw = self._read_eeprom_specific_bytes((offset + SFP_TEMPE_OFFSET), SFP_TEMPE_WIDTH) + if dom_temperature_raw is not None: + dom_temperature_data = sfpd_obj.parse_temperature(dom_temperature_raw, 0) + temp = self._convert_string_to_num(dom_temperature_data['data']['Temperature']['value']) + return temp + else: + return None + + def get_voltage(self): + """ + Retrieves the supply voltage of this SFP + + Returns: + An integer number of supply voltage in mV + """ + if not self.dom_supported: + return None + if self.sfp_type == QSFP_TYPE: + offset = 0 + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + if self.dom_volt_supported: + dom_voltage_raw = self._read_eeprom_specific_bytes((offset + QSFP_VOLT_OFFSET), QSFP_VOLT_WIDTH) + if dom_voltage_raw is not None: + dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) + voltage = self._convert_string_to_num(dom_voltage_data['data']['Vcc']['value']) + return voltage + else: + return None + return None + + if self.sfp_type == QSFP_DD_TYPE: + offset = 128 + + sfpd_obj = qsfp_dd_Dom() + if sfpd_obj is None: + return None + + if self.dom_volt_supported: + dom_voltage_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_VOLT_OFFSET), QSFP_DD_VOLT_WIDTH) + if dom_voltage_raw is not None: + dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) + voltage = self._convert_string_to_num(dom_voltage_data['data']['Vcc']['value']) + return voltage + return None + + else: + offset = 256 + + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return None + + sfpd_obj._calibration_type = self.calibration + + dom_voltage_raw = self._read_eeprom_specific_bytes((offset + SFP_VOLT_OFFSET), SFP_VOLT_WIDTH) + if dom_voltage_raw is not None: + dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) + voltage = self._convert_string_to_num(dom_voltage_data['data']['Vcc']['value']) + return voltage + else: + return None + + def get_tx_bias(self): + """ + Retrieves the TX bias current of this SFP + + Returns: + A list of four integer numbers, representing TX bias in mA + for channel 0 to channel 4. + Ex. ['110.09', '111.12', '108.21', '112.09'] + """ + tx_bias_list = [] + if self.sfp_type == QSFP_TYPE: + offset = 0 + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power(dom_channel_monitor_raw, 0) + tx_bias_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX1Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX2Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX3Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX4Bias']['value'])) + + elif self.sfp_type == QSFP_DD_TYPE: + # page 11h + if self.dom_rx_tx_power_bias_supported: + offset = 512 + sfpd_obj = qsfp_dd_Dom() + if sfpd_obj is None: + return None + + if self.dom_tx_bias_power_supported: + dom_tx_bias_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_TX_BIAS_OFFSET), QSFP_DD_TX_BIAS_WIDTH) + if dom_tx_bias_raw is not None: + dom_tx_bias_data = sfpd_obj.parse_dom_tx_bias(dom_tx_bias_raw, 0) + tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX1Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX2Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX3Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX4Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX5Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX6Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX7Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX8Bias']['value'])) + + else: + offset = 256 + + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return None + sfpd_obj._calibration_type = self.calibration + + if self.dom_supported: + dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params(dom_channel_monitor_raw, 0) + tx_bias_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TXBias']['value'])) + else: + return None + else: + return None + + return tx_bias_list + + def get_rx_power(self): + """ + Retrieves the received optical power for this SFP + + Returns: + A list of four integer numbers, representing received optical + power in mW for channel 0 to channel 4. + Ex. ['1.77', '1.71', '1.68', '1.70'] + """ + rx_power_list = [] + if self.sfp_type == OSFP_TYPE: + # OSFP not supported on our platform yet. + return None + + elif self.sfp_type == QSFP_TYPE: + offset = 0 + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + if self.dom_rx_power_supported: + dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power(dom_channel_monitor_raw, 0) + rx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['RX1Power']['value'])) + rx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['RX2Power']['value'])) + rx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['RX3Power']['value'])) + rx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['RX4Power']['value'])) + else: + return None + else: + return None + + elif self.sfp_type == QSFP_DD_TYPE: + # page 11 + if self.dom_rx_tx_power_bias_supported: + offset = 512 + sfpd_obj = qsfp_dd_Dom() + if sfpd_obj is None: + return None + + if self.dom_rx_power_supported: + dom_rx_power_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_RX_POWER_OFFSET), QSFP_DD_RX_POWER_WIDTH) + if dom_rx_power_raw is not None: + dom_rx_power_data = sfpd_obj.parse_dom_rx_power(dom_rx_power_raw, 0) + rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX1Power']['value'])) + rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX2Power']['value'])) + rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX3Power']['value'])) + rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX4Power']['value'])) + rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX5Power']['value'])) + rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX6Power']['value'])) + rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX7Power']['value'])) + rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX8Power']['value'])) + + else: + offset = 256 + + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return None + + if self.dom_supported: + sfpd_obj._calibration_type = self.calibration + + dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params(dom_channel_monitor_raw, 0) + rx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['RXPower']['value'])) + else: + return None + else: + return None + return rx_power_list + + def get_tx_power(self): + """ + Retrieves the TX power of this SFP + + Returns: + A list of four integer numbers, representing TX power in mW + for channel 0 to channel 4. + Ex. ['1.86', '1.86', '1.86', '1.86'] + """ + tx_power_list = [] + if self.sfp_type == OSFP_TYPE: + # OSFP not supported on our platform yet. + return None + + elif self.sfp_type == QSFP_TYPE: + offset = 0 + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + if self.dom_tx_power_supported: + dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power(dom_channel_monitor_raw, 0) + tx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX1Power']['value'])) + tx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX2Power']['value'])) + tx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX3Power']['value'])) + tx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX4Power']['value'])) + else: + return None + else: + return None + + elif self.sfp_type == QSFP_DD_TYPE: + # page 11 + if self.dom_rx_tx_power_bias_supported: + offset = 512 + sfpd_obj = qsfp_dd_Dom() + if sfpd_obj is None: + return None + + if self.dom_tx_power_supported: + dom_tx_power_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_TX_POWER_OFFSET), QSFP_DD_TX_POWER_WIDTH) + if dom_tx_power_raw is not None: + dom_tx_power_data = sfpd_obj.parse_dom_tx_power(dom_tx_power_raw, 0) + tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX1Power']['value'])) + tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX2Power']['value'])) + tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX3Power']['value'])) + tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX4Power']['value'])) + tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX5Power']['value'])) + tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX6Power']['value'])) + tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX7Power']['value'])) + tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX8Power']['value'])) + + else: + offset = 256 + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return None + + if self.dom_supported: + sfpd_obj._calibration_type = self.calibration + + dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params(dom_channel_monitor_raw, 0) + tx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TXPower']['value'])) + else: + return None + else: + return None + return tx_power_list + + def reset(self): + """ + Reset SFP and return all user module settings to their default state. + Returns: + A boolean, True if successful, False if not + """ + status = False + if not self.get_presence(): + return False + + # SFP doesn't support this feature + if self.sfp_type == SFP_TYPE: + return False + elif self.sfp_type == QSFP_TYPE: + return False + elif self.sfp_type == OSFP_TYPE or self.sfp_type == QSFP_DD_TYPE: + node = self.sfp_path + self.sfp_reset + try: + f = open(node, 'r+') + except IOError as e: + return False + + try: + f.seek(0) + f.write('1') + time.sleep(1) + f.seek(0) + f.write('0') + + f.close() + status = True + except IOError as e: + status = False + + return status + + def tx_disable(self, tx_disable): + """ + Disable SFP TX for all channels + Args: + tx_disable : A Boolean, True to enable tx_disable mode, False to disable + tx_disable mode. + Returns: + A boolean, True if tx_disable is set successfully, False if not + """ + if not self.get_presence(): + return False + + if self.sfp_tx_disable != None: + node = self.sfp_path + self.sfp_tx_disable + try: + f = open(node, 'r+') + except IOError as e: + return False + try: + if tx_disable: + f.write('1') + else: + f.write('0') + f.close() + return True + except IOError as e: + return False + elif self.sfp_type == SFP_TYPE: + if self.dom_tx_disable_supported: + offset = 256 + status_control_raw = self._read_eeprom_specific_bytes( + (offset + SFP_STATUS_CONTROL_OFFSET), SFP_STATUS_CONTROL_WIDTH) + if status_control_raw is not None: + # Set bit 6 for Soft TX Disable Select + # 01000000 = 64 and 10111111 = 191 + tx_disable_bit = 64 if tx_disable else 191 + status_control = int(status_control_raw[0], 16) + tx_disable_ctl = (status_control | tx_disable_bit) if tx_disable else ( + status_control & tx_disable_bit) + try: + sysfsfile_eeprom = open(self.eeprom_path, mode="r+b", buffering=0) + buffer = create_string_buffer(1) + buffer[0] = chr(tx_disable_ctl) + # Write to eeprom + sysfsfile_eeprom.seek(offset + SFP_STATUS_CONTROL_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + finally: + if sysfsfile_eeprom: + sysfsfile_eeprom.close() + time.sleep(0.01) + return True + return False + else: + return False + elif self.sfp_type == QSFP_TYPE: + if self.dom_tx_disable_supported: + channel_mask = 0x0f + if tx_disable: + return self.tx_disable_channel(channel_mask, True) + else: + return self.tx_disable_channel(channel_mask, False) + else: + return False + else: + return None + + def tx_disable_channel(self, channel, disable): + """ + Sets the tx_disable for specified SFP channels + Args: + channel : A hex of 4 bits (bit 0 to bit 3) which represent channel 0 to 3, + e.g. 0x5 for channel 0 and channel 2. + disable : A boolean, True to disable TX channels specified in channel, + False to enable + Returns: + A boolean, True if successful, False if not + """ + if not self.get_presence(): + return False + # SFP doesn't support this feature + if self.sfp_type == SFP_TYPE: + return False + elif self.sfp_type == QSFP_TYPE: + if self.dom_tx_disable_supported: + sysfsfile_eeprom = None + try: + channel_state = self.get_tx_disable_channel() + if disable: + tx_disable_ctl = channel_state | channel + else: + tx_disable_ctl = channel_state & (~channel) + buffer = create_string_buffer(1) + buffer[0] = chr(tx_disable_ctl) + # Write to eeprom + sysfsfile_eeprom = open(self.eeprom_path, "r+b") + sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print ("Error: unable to open file: %s" % str(e)) + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + return True + else: + return False + else: + return None + + def set_lpmode(self, lpmode): + """ + Sets the lpmode (low power mode) of SFP + Args: + lpmode: A Boolean, True to enable lpmode, False to disable it + Note : lpmode can be overridden by set_power_override + Returns: + A boolean, True if lpmode is set successfully, False if not + """ + if not self.get_presence(): + return False + # SFP doesn't support this feature + if self.sfp_lpmode is not None: + node = self.sfp_path + self.sfp_lpmode + try: + f = open(node, 'r+') + except IOError as e: + return False + try: + if lpmode: + f.write('1') + else: + f.write('0') + f.close() + return True + except IOError as e: + return False + elif self.sfp_type == SFP_TYPE: + return False + elif self.sfp_type == QSFP_TYPE: + return False + elif self.sfp_type == OSFP_TYPE or self.sfp_type == QSFP_DD_TYPE: + try: + reg_file = open(self.lpmode_path, "r+") + except IOError as e: + print ("Error: unable to open file: %s" % str(e)) + return False + + # LPMode is active high; set or clear the bit accordingly + if lpmode: + reg_value = 1 + else: + reg_value = 0 + + reg_file.write(hex(reg_value)) + reg_file.close() + else: + return None + + return True + + def set_power_override(self, power_override, power_set): + """ + Sets SFP power level using power_override and power_set + Args: + power_override : + A Boolean, True to override set_lpmode and use power_set + to control SFP power, False to disable SFP power control + through power_override/power_set and use set_lpmode + to control SFP power. + power_set : + Only valid when power_override is True. + A Boolean, True to set SFP to low power mode, False to set + SFP to high power mode. + Returns: + A boolean, True if power-override and power_set are set successfully, + False if not + """ + # SFP doesn't support this feature + if not self.get_presence(): + return False + + if self.sfp_type == SFP_TYPE: + return False + elif self.sfp_type == QSFP_TYPE: + try: + power_override_bit = 0 + if power_override: + power_override_bit |= 1 << 0 + + power_set_bit = 0 + if power_set: + power_set_bit |= 1 << 1 + + buffer = create_string_buffer(1) + buffer[0] = chr(power_override_bit | power_set_bit) + # Write to eeprom + sysfsfile_eeprom = open(self.eeprom_path, "r+b") + sysfsfile_eeprom.seek(QSFP_POWEROVERRIDE_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print ("Error: unable to open file: %s" % str(e)) + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + else: + return None + + return True + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + sfputil_helper = SfpUtilHelper() + sfputil_helper.read_porttab_mappings(self.__get_path_to_port_config_file()) + name = sfputil_helper.get_physical_to_logical(self.index) + return name + diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/thermal.py new file mode 100644 index 000000000000..7c68903ebea8 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/thermal.py @@ -0,0 +1,136 @@ +############################################################################# +# Alphanetworks +# +# Module contains an implementation of SONiC Platform Base API and +# provides the thermal status which are available in the platform +# +############################################################################# + +import glob +import os.path + +try: + from sonic_platform_base.thermal_base import ThermalBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +class Thermal(ThermalBase): + """Platform-specific Thermal class""" + + def __init__(self, thermal_index): + ThermalBase.__init__(self) + self.index = thermal_index + # driver path + tmp_bus_num = [1, 4, 5] + tmp_address = ["4f", "4d", "4c"] + + self.tmp_node = "/sys/bus/i2c/devices/{}-00{}/hwmon/".format(tmp_bus_num[self.index], tmp_address[self.index]) + + def get_name(self): + """ + Retrieves the name of the device + + Returns: + string: The name of the device + """ + return "TMP75#{}".format(self.index + 1) + + def get_status(self): + """ + Retrieves the operational status of the device + + Returns: + A boolean value, True if device is operating properly, False if not + """ + if (self.get_temperature() != None): + return True + else: + return False + + def get_presence(self): + """ + Retrieves the presence of the device + + Returns: + bool: True if device is present, False if not + """ + node = glob.glob(self.tmp_node + "hwmon*") + if len(node) == 0: + return False + node = node[0] + "/temp1_input" + if os.path.exists(node): + return True + return False + + def get_temperature(self): + """ + Retrieves current temperature reading from thermal + + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + temp = 0 + node = glob.glob(self.tmp_node + "hwmon*") + if len(node) == 0: + return None + node = node[0] + "/temp1_input" + try: + with open(node, 'r') as fp: + temp = float(fp.read()) / 1000 + except IOError: + return None + return temp + + def get_high_threshold(self): + """ + Retrieves the high threshold temperature of thermal + + Returns: + A float number, the high threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + temp = 0 + node = glob.glob(self.tmp_node + "hwmon*") + if len(node) == 0: + return None + node = node[0] + "/temp1_max" + try: + with open(node, 'r') as fp: + temp = float(fp.read()) / 1000 + except IOError: + return None + return temp + + def set_high_threshold(self, temperature): + """ + Sets the high threshold temperature of thermal + + Args : + temperature: A float number up to nearest thousandth of one degree Celsius, + e.g. 30.125 + + Returns: + A boolean, True if threshold is set successfully, False if not + """ + temp = temperature * 1000 + node = glob.glob(self.tmp_node + "hwmon*") + if len(node) == 0: + return None + node = node[0] + "/temp1_max" + try: + with open(node, 'w') as fp: + fp.write(str(temp)) + except IOError: + return False + return True + + def get_high_critical_threshold(self): + """ + Retrieves the high critical threshold temperature of thermal + + Returns: + A float number, the high critical threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + return None diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/thermal_actions.py b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/thermal_actions.py new file mode 100644 index 000000000000..cb4e376da346 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/thermal_actions.py @@ -0,0 +1,95 @@ +from sonic_platform_base.sonic_thermal_control.thermal_action_base import ThermalPolicyActionBase +from sonic_platform_base.sonic_thermal_control.thermal_json_object import thermal_json_object +from sonic_py_common.logger import Logger + +logger = Logger() + +class SetFanSpeedAction(): + """ + Base thermal action class to set speed for fans + """ + DEFAULT_SPEED = 50 + MAX_SPEED = 100 + + @classmethod + def set_all_fan_speed(cls, thermal_info_dict, speed): + from .thermal_infos import FanInfo + if FanInfo.INFO_NAME in thermal_info_dict and isinstance(thermal_info_dict[FanInfo.INFO_NAME], FanInfo): + fan_info_obj = thermal_info_dict[FanInfo.INFO_NAME] + for fan in fan_info_obj.get_presence_fans(): + fan.set_speed(speed) + + @classmethod + def set_all_fan_speed_default(cls, thermal_info_dict): + cls.set_all_fan_speed(thermal_info_dict, cls.DEFAULT_SPEED) + + @classmethod + def set_all_fan_speed_max(cls, thermal_info_dict): + cls.set_all_fan_speed(thermal_info_dict, cls.MAX_SPEED) + + +@thermal_json_object('fan.all.set_speed_max') +class SetAllFanSpeedMaxAction(ThermalPolicyActionBase): + """ + Action to set max speed for all fans + """ + def execute(self, thermal_info_dict): + """ + Set max speed for all fans + :param thermal_info_dict: A dictionary stores all thermal information. + :return: + """ + SetFanSpeedAction.set_all_fan_speed_max(thermal_info_dict) + +@thermal_json_object('fan.all.set_speed_default') +class SetAllFanSpeedDefaultAction(ThermalPolicyActionBase): + """ + Action to set default speed for all fans + """ + def execute(self, thermal_info_dict): + """ + Set default speed for all fans + :param thermal_info_dict: A dictionary stores all thermal information. + :return: + """ + SetFanSpeedAction.set_all_fan_speed_default(thermal_info_dict) + + +@thermal_json_object('thermal.temp_check_and_set_all_fan_speed') +class ThermalRecoverAction(ThermalPolicyActionBase): + """ + Action to check thermal sensor temperature change status and set speed for all fans + """ + def execute(self, thermal_info_dict): + """ + Check thermal sensor temperature change status and set speed for all fans + :param thermal_info_dict: A dictionary stores all thermal information. + :return: + """ + from .thermal_infos import ThermalInfo + if ThermalInfo.INFO_NAME in thermal_info_dict and isinstance(thermal_info_dict[ThermalInfo.INFO_NAME], ThermalInfo): + thermal_info_obj = thermal_info_dict[ThermalInfo.INFO_NAME] + if thermal_info_obj.is_below_low_threshold(): + SetFanSpeedAction.set_all_fan_speed_default(thermal_info_dict) + elif thermal_info_obj.is_over_high_threshold(): + SetFanSpeedAction.set_all_fan_speed_max(thermal_info_dict) + elif thermal_info_obj.is_warm_up(): + SetFanSpeedAction.set_all_fan_speed_default(thermal_info_dict) + elif thermal_info_obj.is_cool_down(): + SetFanSpeedAction.set_all_fan_speed_max(thermal_info_dict) + + +@thermal_json_object('switch.shutdown') +class SwitchShutdownAction(ThermalPolicyActionBase): + """ + Action to shutdown switch. + """ + def execute(self, thermal_info_dict): + """ + Take action when thermal sensor temperature over high critical threshold. Shut + down the switch. + """ + + logger.log_warning("Alarm for temperature critical is detected, reboot DUT") + # import os + # os.system('reboot') diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/thermal_conditions.py b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/thermal_conditions.py new file mode 100644 index 000000000000..49172e1ef17e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/thermal_conditions.py @@ -0,0 +1,54 @@ +from sonic_platform_base.sonic_thermal_control.thermal_condition_base import ThermalPolicyConditionBase +from sonic_platform_base.sonic_thermal_control.thermal_json_object import thermal_json_object + +class FanCondition(ThermalPolicyConditionBase): + def get_fan_info(self, thermal_info_dict): + from .thermal_infos import FanInfo + if FanInfo.INFO_NAME in thermal_info_dict and isinstance(thermal_info_dict[FanInfo.INFO_NAME], FanInfo): + return thermal_info_dict[FanInfo.INFO_NAME] + else: + return None + + +@thermal_json_object('fan.any.absence') +class AnyFanAbsenceCondition(FanCondition): + def is_match(self, thermal_info_dict): + fan_info_obj = self.get_fan_info(thermal_info_dict) + return len(fan_info_obj.get_absence_fans()) > 0 if fan_info_obj else False + + +@thermal_json_object('fan.all.presence') +class AllFanPresenceCondition(FanCondition): + def is_match(self, thermal_info_dict): + fan_info_obj = self.get_fan_info(thermal_info_dict) + return len(fan_info_obj.get_absence_fans()) == 0 if fan_info_obj else False + + +@thermal_json_object('fan.any.fault') +class AnyFanFaultCondition(FanCondition): + def is_match(self, thermal_info_dict): + fan_info_obj = self.get_fan_info(thermal_info_dict) + return len(fan_info_obj.get_fault_fans()) > 0 if fan_info_obj else False + + +@thermal_json_object('fan.all.good') +class AllFanGoodCondition(FanCondition): + def is_match(self, thermal_info_dict): + fan_info_obj = self.get_fan_info(thermal_info_dict) + return len(fan_info_obj.get_fault_fans()) == 0 if fan_info_obj else False + + +class ThermalCondition(ThermalPolicyConditionBase): + def get_thermal_info(self, thermal_info_dict): + from .thermal_infos import ThermalInfo + if ThermalInfo.INFO_NAME in thermal_info_dict and isinstance(thermal_info_dict[ThermalInfo.INFO_NAME], ThermalInfo): + return thermal_info_dict[ThermalInfo.INFO_NAME] + else: + return None + + +@thermal_json_object('thermal.over.high_critical_threshold') +class ThermalOverHighCriticalCondition(ThermalCondition): + def is_match(self, thermal_info_dict): + thermal_info_obj = self.get_thermal_info(thermal_info_dict) + return thermal_info_obj.is_over_high_critical_threshold() if thermal_info_obj else False diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/thermal_infos.py b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/thermal_infos.py new file mode 100644 index 000000000000..fd8bb23aa06a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/thermal_infos.py @@ -0,0 +1,200 @@ +from sonic_platform_base.sonic_thermal_control.thermal_info_base import ThermalPolicyInfoBase +from sonic_platform_base.sonic_thermal_control.thermal_json_object import thermal_json_object + +@thermal_json_object('fan_info') +class FanInfo(ThermalPolicyInfoBase): + """ + Fan information needed by thermal policy + """ + + # Fan information name + INFO_NAME = 'fan_info' + + def __init__(self): + self._absence_fans = set() + self._presence_fans = set() + self._fault_fans = set() + self._presence_changed = False + self._status_changed = False + + def collect(self, chassis): + """ + Collect absence and presence fans. + :param chassis: The chassis object + :return: + """ + self._presence_changed = False + self._status_changed = False + for fan in chassis.get_all_fans(): + presence = fan.get_presence() + status = fan.get_status() + if presence and fan not in self._presence_fans: + self._presence_fans.add(fan) + self._presence_changed = True + if fan in self._absence_fans: + self._absence_fans.remove(fan) + elif not presence and fan not in self._absence_fans: + self._absence_fans.add(fan) + self._presence_changed = True + if fan in self._presence_fans: + self._presence_fans.remove(fan) + + if not status and fan not in self._fault_fans: + self._fault_fans.add(fan) + self._status_changed = True + elif status and fan in self._fault_fans: + self._fault_fans.remove(fan) + self._status_changed = True + + + def get_absence_fans(self): + """ + Retrieves absence fans + :return: A set of absence fans + """ + return self._absence_fans + + def get_presence_fans(self): + """ + Retrieves presence fans + :return: A set of presence fans + """ + return self._presence_fans + + def get_fault_fans(self): + """ + Retrieves fault fans + :return: A set of fault fans + """ + return self._fault_fans + + def is_presence_changed(self): + """ + Retrieves if the presence status of fan information changed + :return: True if status changed else False + """ + return self._presence_changed + + +@thermal_json_object('thermal_info') +class ThermalInfo(ThermalPolicyInfoBase): + """ + Thermal information needed by thermal policy + """ + INFO_NAME = 'thermal_info' + + def __init__(self): + + self.init = False + self._old_avg_temp = 0 + self._current_avg_temp = 0 + self._high_crital_threshold = 75 + self._high_threshold = 60 + self._low_threshold = 50 + self._thermal_0x4d_index = 1 + self._temp_scale = 0.5 + + def collect(self, chassis): + """ + Collect thermal sensor temperature change status + :param chassis: The chassis object + :return: + """ + + self._temps = [] + self._over_high_critical_threshold = False + self._over_high_threshold = False + self._below_low_threshold = False + self._warm_up = False + self._cool_down = False + + temp = 0 + num_of_thermals = chassis.get_num_thermals() + for index in range(num_of_thermals): + self._temps.insert(index, chassis.get_thermal(index).get_temperature()) + temp += self._temps[index] + + self._current_avg_temp = temp / num_of_thermals + if self.init == False: + self._old_avg_temp = self._current_avg_temp + self.init = True + + if self._current_avg_temp >= self._high_threshold: + self._over_high_threshold = True + + if self._current_avg_temp <= self._low_threshold: + self._below_low_threshold = True + + temp_tolerance = self._temp_scale/num_of_thermals + temp_diff = abs(self._current_avg_temp - self._old_avg_temp) + if self._current_avg_temp > self._old_avg_temp and temp_diff > temp_tolerance: + self._warm_up = True + + if self._current_avg_temp < self._old_avg_temp and temp_diff > temp_tolerance: + self._cool_down = True + + if self._temps[self._thermal_0x4d_index] >= self._high_crital_threshold: + self._over_high_critical_threshold = True + + self._old_avg_temp = self._current_avg_temp + + def is_warm_up(self): + """ + Retrieves if the temperature is warm up + :return: True if the temperature is warm up else False + """ + return self._warm_up + + def is_over_high_threshold(self): + """ + Retrieves if the temperature is over high threshold + :return: True if the temperature is over high threshold else False + """ + return self._over_high_threshold + + def is_cool_down(self): + """ + Retrieves if the temperature is cood down + :return: True if the temperature is cood down else False + """ + return self._cool_down + + def is_below_low_threshold(self): + """ + Retrieves if the temperature is below low threshold + :return: True if the temperature is below low threshold else False + """ + return self._below_low_threshold + + def is_over_high_critical_threshold(self): + """ + Retrieves if the temperature is over high critical threshold + :return: True if the temperature is over high critical threshold else False + """ + return self._over_high_critical_threshold + + +@thermal_json_object('chassis_info') +class ChassisInfo(ThermalPolicyInfoBase): + """ + Chassis information needed by thermal policy + """ + INFO_NAME = 'chassis_info' + + def __init__(self): + self._chassis = None + + def collect(self, chassis): + """ + Collect platform chassis. + :param chassis: The chassis object + :return: + """ + self._chassis = chassis + + def get_chassis(self): + """ + Retrieves platform chassis object + :return: A platform chassis object. + """ + return self._chassis diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/thermal_manager.py b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/thermal_manager.py new file mode 100644 index 000000000000..7e72eee30f39 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/thermal_manager.py @@ -0,0 +1,23 @@ +from sonic_platform_base.sonic_thermal_control.thermal_manager_base import ThermalManagerBase +from .thermal_infos import * +from .thermal_conditions import * +from .thermal_actions import * + +class ThermalManager(ThermalManagerBase): + @classmethod + def initialize(cls): + """ + Initialize thermal manager, including register thermal condition types and thermal action types + and any other vendor specific initialization. + :return: + """ + return True + + @classmethod + def deinitialize(cls): + """ + Destroy thermal manager, including any vendor specific cleanup. The default behavior of this function + is a no-op. + :return: + """ + return True diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/watchdog.py new file mode 100644 index 000000000000..83b598205986 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/sonic_platform/watchdog.py @@ -0,0 +1,237 @@ +############################################################################# +# +# Watchdog contains an implementation of SONiC Platform Base Watchdog API +# +############################################################################# +import fcntl +import os +import array + +try: + from sonic_platform_base.watchdog_base import WatchdogBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +""" ioctl constants """ +IO_WRITE = 0x40000000 +IO_READ = 0x80000000 +IO_READ_WRITE = 0xC0000000 +IO_SIZE_INT = 0x00040000 +IO_SIZE_40 = 0x00280000 +IO_TYPE_WATCHDOG = ord('W') << 8 + +WDR_INT = IO_READ | IO_SIZE_INT | IO_TYPE_WATCHDOG +WDR_40 = IO_READ | IO_SIZE_40 | IO_TYPE_WATCHDOG +WDWR_INT = IO_READ_WRITE | IO_SIZE_INT | IO_TYPE_WATCHDOG + +""" Watchdog ioctl commands """ +WDIOC_GETSUPPORT = 0 | WDR_40 +WDIOC_GETSTATUS = 1 | WDR_INT +WDIOC_GETBOOTSTATUS = 2 | WDR_INT +WDIOC_GETTEMP = 3 | WDR_INT +WDIOC_SETOPTIONS = 4 | WDR_INT +WDIOC_KEEPALIVE = 5 | WDR_INT +WDIOC_SETTIMEOUT = 6 | WDWR_INT +WDIOC_GETTIMEOUT = 7 | WDR_INT +WDIOC_SETPRETIMEOUT = 8 | WDWR_INT +WDIOC_GETPRETIMEOUT = 9 | WDR_INT +WDIOC_GETTIMELEFT = 10 | WDR_INT + +""" Watchdog status constants """ +WDIOS_DISABLECARD = 0x0001 +WDIOS_ENABLECARD = 0x0002 + +WDT_COMMON_ERROR = -1 +WD_MAIN_IDENTITY = "iTCO_wdt" +WDT_SYSFS_PATH = "/sys/class/watchdog/" + +DEFAULT_TIMEOUT=180 +watchdog = 0 + +class Watchdog(WatchdogBase): + + def __init__(self): + + self.watchdog, self.wdt_main_dev_name = self._get_wdt() + if self.wdt_main_dev_name is None: + raise Exception("Watchdog device is not instantiated") + + self.status_path = "/sys/class/watchdog/%s/status" % self.wdt_main_dev_name + self.state_path = "/sys/class/watchdog/%s/state" % self.wdt_main_dev_name + self.timeout_path = "/sys/class/watchdog/%s/timeout" % self.wdt_main_dev_name + # Set default value + self._disable() + self.armed = False + self.timeout = DEFAULT_TIMEOUT + + def _is_wd_main(self, dev): + """ + Checks watchdog identity + """ + identity = self._read_file( + "{}/{}/identity".format(WDT_SYSFS_PATH, dev)) + return identity == WD_MAIN_IDENTITY + + def _get_wdt(self): + """ + Retrieves watchdog device + """ + global watchdog + wdt_main_dev_list = [dev for dev in os.listdir( + "/dev/") if dev.startswith("watchdog") and self._is_wd_main(dev)] + if not wdt_main_dev_list: + return (None, None) + wdt_main_dev_name = wdt_main_dev_list[0] + watchdog_device_path = "/dev/{}".format(wdt_main_dev_name) + if not watchdog: + watchdog = os.open(watchdog_device_path, os.O_RDWR) + return watchdog, wdt_main_dev_name + + def _read_file(self, file_path): + """ + Read text file + """ + try: + with open(file_path, "r") as fd: + txt = fd.read() + except IOError: + return WDT_COMMON_ERROR + return txt.strip() + + def _enable(self): + """ + Turn on the watchdog timer + """ + req = array.array('h', [WDIOS_ENABLECARD]) + fcntl.ioctl(self.watchdog, WDIOC_SETOPTIONS, req, False) + + def _disable(self): + """ + Turn off the watchdog timer + """ + req = array.array('h', [WDIOS_DISABLECARD]) + fcntl.ioctl(self.watchdog, WDIOC_SETOPTIONS, req, False) + + def _keepalive(self): + """ + Keep alive watchdog timer + """ + fcntl.ioctl(self.watchdog, WDIOC_KEEPALIVE) + + def _settimeout(self, seconds): + """ + Set watchdog timer timeout + @param seconds - timeout in seconds + @return is the actual set timeout + """ + req = array.array('I', [seconds]) + fcntl.ioctl(self.watchdog, WDIOC_SETTIMEOUT, req, True) + return int(req[0]) + + def _gettimeout(self, timeout_path): + """ + Get watchdog timeout + @return watchdog timeout + """ + req = array.array('I', [0]) + fcntl.ioctl(self.watchdog, WDIOC_GETTIMEOUT, req, True) + + return int(req[0]) + + def _gettimeleft(self): + """ + Get time left before watchdog timer expires + @return time left in seconds + """ + req = array.array('I', [0]) + fcntl.ioctl(self.watchdog, WDIOC_GETTIMELEFT, req, True) + + return int(req[0]) + + ################################################################# + + def arm(self, seconds): + """ + Arm the hardware watchdog with a timeout of seconds. + If the watchdog is currently armed, calling this function will + simply reset the timer to the provided value. If the underlying + hardware does not support the value provided in , this + method should arm the watchdog with the *next greater* available + value. + Returns: + An integer specifying the *actual* number of seconds the watchdog + was armed with. On failure returns -1. + """ + + ret = WDT_COMMON_ERROR + if seconds < 0: + return ret + + try: + if self.timeout != seconds: + self.timeout = self._settimeout(seconds) + if self.armed: + self._keepalive() + else: + self._settimeout(seconds) + self._enable() + self.armed = True + ret = self.timeout + except IOError as e: + pass + + return ret + + def disarm(self): + """ + Disarm the hardware watchdog + Returns: + A boolean, True if watchdog is disarmed successfully, False if not + """ + disarmed = False + if self.is_armed(): + try: + self._disable() + self.armed = False + disarmed = True + except IOError: + pass + + return disarmed + + def is_armed(self): + """ + Retrieves the armed state of the hardware watchdog. + Returns: + A boolean, True if watchdog is armed, False if not + """ + + return self.armed + + def get_remaining_time(self): + """ + If the watchdog is armed, retrieve the number of seconds remaining on + the watchdog timer + Returns: + An integer specifying the number of seconds remaining on thei + watchdog timer. If the watchdog is not armed, returns -1. + """ + + timeleft = WDT_COMMON_ERROR + + if self.armed: + try: + timeleft = self._gettimeleft() + except IOError: + pass + + return timeleft + + def __del__(self): + """ + Close watchdog + """ + + if self.watchdog is not None : + os.close(self.watchdog) + diff --git a/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/utils/alphanetworks_snj60d0_util.py b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/utils/alphanetworks_snj60d0_util.py new file mode 100755 index 000000000000..4787c6e5224c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-alphanetworks/snj60d0-320f/utils/alphanetworks_snj60d0_util.py @@ -0,0 +1,358 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2019 Alphanetworks Technology Corporation. +# Robin Chen +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# see +# +# Copyright (C) 2016 Accton Networks, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes +""" + +import subprocess +import sys, getopt +import logging +import time + +PROJECT_NAME = 'snj60d0-320f' +DRIVER_NAME = 'snj60d0_320f' +version = '0.1.0' +verbose = False +DEBUG = False +args = [] +FORCE = 0 + +if DEBUG == True: + print(sys.argv[0]) + print('ARGV :', sys.argv[1:]) + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print(options) + print(args) + print(len(sys.argv)) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + elif arg == 'clean': + do_uninstall() + else: + show_help() + + return 0 + +def show_help(): + print(__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]}) + sys.exit(0) + +def show_log(txt): + if DEBUG == True: + print(PROJECT_NAME.upper()+": "+txt) + return + +def log_os_system(cmd, show): + logging.info('Run :'+cmd) + status, output = subprocess.getstatusoutput(cmd) + show_log(cmd +" with result: " + str(status)) + show_log(" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +def driver_check(): + ret, lsmod = log_os_system("lsmod | grep " + DRIVER_NAME, 0) + logging.info('mods:'+lsmod) + if len(lsmod) ==0: + return False + return True + + +kos = [ +'modprobe i2c_ismt', +'modprobe i2c_i801', +'modprobe i2c_dev', +'modprobe i2c_mux_pca954x', +'modprobe optoe', +'modprobe yesm1300am', +'modprobe '+PROJECT_NAME+'_fpga' , +'modprobe '+PROJECT_NAME+'_onie_eeprom' , +'modprobe '+PROJECT_NAME+'_i2c_mux_cpld' ] + +def driver_install(): + global FORCE + #remove default drivers to avoid modprobe order conflicts + log_os_system("echo 'blacklist i2c-ismt' > /etc/modprobe.d/blacklist.conf", 1) + time.sleep(1) + log_os_system("modprobe -r i2c-ismt ", 1) + log_os_system("modprobe -r i2c-i801 ", 1) + #setup driver dependency + status, output = log_os_system("depmod", 1) + if status: + if FORCE == 0: + return status + for i in range(0,len(kos)): + if kos[i].find('pca954') != -1: + status, output = log_os_system(kos[i]+ " force_deselect_on_exit=1", 1) + else: + status, output = log_os_system(kos[i], 1) + if status: + if FORCE == 0: + return status + return 0 + +def driver_uninstall(): + global FORCE + for i in range(0,len(kos)): + rm = kos[-(i+1)].replace("modprobe", "modprobe -rq") + rm = rm.replace("insmod", "rmmod") + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + + +i2c_prefix = '/sys/bus/i2c/devices/' + +sfp_map = [ 22,23,24,25,26,27,28,29, + 30,31,32,33,34,35,36,37, + 38,39,40,41,42,43,44,45, + 46,47,48,49,50,51,52,53] + +mknod =[ +'echo snj60d0_onie_eeprom 0x56 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo lm75 0x4F > /sys/bus/i2c/devices/i2c-1/new_device', +'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo snj60d0_fpga 0x5e > /sys/bus/i2c/devices/i2c-1/new_device', +'echo lm75 0x4D > /sys/bus/i2c/devices/i2c-4/new_device', +'echo lm75 0x4C > /sys/bus/i2c/devices/i2c-5/new_device', +'echo pca9545 0x71 > /sys/bus/i2c/devices/i2c-6/new_device', +'echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-8/new_device', +'echo 24c02 0x50 > /sys/bus/i2c/devices/i2c-10/new_device', +'echo yesm1300am 0x58 > /sys/bus/i2c/devices/i2c-10/new_device', +'echo 24c02 0x51 > /sys/bus/i2c/devices/i2c-11/new_device', +'echo yesm1300am 0x59 > /sys/bus/i2c/devices/i2c-11/new_device', +'echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-12/new_device', +'echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-13/new_device', +'echo snj60d0_320f_cpld1 0x5f > /sys/bus/i2c/devices/i2c-14/new_device', +'echo snj60d0_320f_cpld2 0x5f > /sys/bus/i2c/devices/i2c-15/new_device', +'echo snj60d0_320f_cpld3 0x5f > /sys/bus/i2c/devices/i2c-16/new_device', +'echo snj60d0_320f_cpld4 0x5f > /sys/bus/i2c/devices/i2c-17/new_device', ] + +port_led_disable= 'echo {value} > /sys/bus/i2c/devices/1-005e/port_led_disable' + +cpld_port_led_enable=[ +'echo {value} > /sys/bus/i2c/devices/14-005f/cpld_port_led_enable_1', +'echo {value} > /sys/bus/i2c/devices/15-005f/cpld_port_led_enable_2', +'echo {value} > /sys/bus/i2c/devices/16-005f/cpld_port_led_enable_3', +'echo {value} > /sys/bus/i2c/devices/17-005f/cpld_port_led_enable_4', ] + +def device_install(): + global FORCE + + for i in range(0,len(mknod)): + #for pca954x need times to built new i2c buses + if mknod[i].find('pca954') != -1: + time.sleep(1) + + if mknod[i].find('lm75') != -1: + time.sleep(1) + + status, output = log_os_system(mknod[i], 1) + if status: + print(output) + if FORCE == 0: + return status + + for port in range(len(sfp_map)): + cmd = 'echo optoe3 0x50 > /sys/bus/i2c/devices/i2c-{}/new_device'.format(sfp_map[port]) + status, output =log_os_system(cmd, 1) + if status: + print(output) + if FORCE == 0: + return status + + cmd = "echo 0 > /sys/bus/i2c/devices/1-005e/sys_reset1" + status, output =log_os_system(cmd, 1) + if status: + print(output) + if FORCE == 0: + return status + + cmd = "echo 4 > /sys/bus/i2c/devices/1-005e/sys_reset2" + status, output =log_os_system(cmd, 1) + if status: + print(output) + if FORCE == 0: + return status + + # Front port LED enable + cmd = port_led_disable.format(value=0) + status, output =log_os_system(cmd, 1) + if status: + print(output) + if FORCE == 0: + return status + + for i in range(len(cpld_port_led_enable)): + cmd = cpld_port_led_enable[i].format(value=1) + status, output =log_os_system(cmd, 1) + if status: + print(output) + if FORCE == 0: + return status + + return + +def device_uninstall(): + global FORCE + + # Front port LED disable + cmd = port_led_disable.format(value=1) + status, output =log_os_system(cmd, 1) + if status: + print(output) + if FORCE == 0: + return status + + for i in range(len(cpld_port_led_enable)): + cmd = cpld_port_led_enable[i].format(value=0) + status, output =log_os_system(cmd, 1) + if status: + print(output) + if FORCE == 0: + return status + + for port in range(len(sfp_map)): + cmd = 'echo 0x50 > /sys/bus/i2c/devices/i2c-{}/delete_device'.format(sfp_map[port]) + status, output =log_os_system(cmd, 1) + if status: + print(output) + if FORCE == 0: + return status + + nodelist = mknod + for i in range(len(nodelist)): + target = nodelist[-(i+1)] + temp = target.split() + del temp[1] + temp[-1] = temp[-1].replace('new_device', 'delete_device') + status, output = log_os_system(" ".join(temp), 1) + if status: + print(output) + if FORCE == 0: + return status + return + +def system_ready(): + if driver_check() == False: + return False + if not device_exist(): + return False + return True + +def do_install(): + print("Checking system....") + if driver_check() == False: + print("No driver, installing....") + status = driver_install() + if status: + if FORCE == 0: + return status + else: + print(PROJECT_NAME.upper() + " drivers detected....") + if not device_exist(): + print("No device, installing....") + status = device_install() + if status: + if FORCE == 0: + return status + else: + print(PROJECT_NAME.upper() + " devices detected....") + return + +def do_uninstall(): + print("Checking system....") + if not device_exist(): + print(PROJECT_NAME.upper() + " has no device installed....") + else: + print("Removing device....") + status = device_uninstall() + if status: + if FORCE == 0: + return status + + if driver_check()== False : + print(PROJECT_NAME.upper() + " has no driver installed....") + else: + print("Removing installed driver....") + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + return + +def device_exist(): + ret1, log = log_os_system("ls " + i2c_prefix + "*0070", 0) + ret2, log = log_os_system("ls " + i2c_prefix + "i2c-2", 0) + return not(ret1 or ret2) + +if __name__ == "__main__": + main() diff --git a/platform/broadcom/sonic-platform-modules-arista b/platform/broadcom/sonic-platform-modules-arista index 89018d062319..da8370423b07 160000 --- a/platform/broadcom/sonic-platform-modules-arista +++ b/platform/broadcom/sonic-platform-modules-arista @@ -1 +1 @@ -Subproject commit 89018d0623191ecd477c869339ca795f91f6c68c +Subproject commit da8370423b07c9271fad515c9ef1fd6149abbeed diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/control b/platform/broadcom/sonic-platform-modules-cel/debian/control index a41f92ab54e9..48ae0ed83735 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/control +++ b/platform/broadcom/sonic-platform-modules-cel/debian/control @@ -7,21 +7,21 @@ Standards-Version: 3.9.3 Package: platform-modules-dx010 Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-haliburton Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-seastone2 Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as led, sfp Package: platform-modules-silverstone Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as led, sfp. diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.install b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.install index 98c17e55a980..4698507c6b9d 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.install +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-dx010.install @@ -4,6 +4,5 @@ dx010/systemd/platform-modules-dx010.service lib/systemd/system dx010/scripts/fancontrol.sh etc/init.d dx010/scripts/fancontrol.service lib/systemd/system services/fancontrol/fancontrol usr/local/bin -dx010/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-cel_seastone-r0 dx010/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-cel_seastone-r0 services/platform_api/platform_api_mgnt.sh usr/local/bin diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.install b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.install index 8788480d9399..6c58afe6d55e 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.install +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.install @@ -3,10 +3,9 @@ haliburton/systemd/platform-modules-haliburton.service lib/systemd/system haliburton/script/fancontrol.sh etc/init.d haliburton/script/fancontrol.service lib/systemd/system services/fancontrol/fancontrol usr/local/bin -haliburton/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-cel_e1031-r0 haliburton/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-cel_e1031-r0 services/platform_api/platform_api_mgnt.sh usr/local/bin haliburton/script/popmsg.sh usr/local/bin haliburton/script/udev_prefix.sh usr/local/bin haliburton/script/reload_udev.sh usr/local/bin -haliburton/script/50-ttyUSB-C0.rules etc/udev/rules.d \ No newline at end of file +haliburton/script/50-ttyUSB-C0.rules etc/udev/rules.d diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-seastone2.install b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-seastone2.install index 41a381eeb0ce..31fc4fd3bd6d 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-seastone2.install +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-seastone2.install @@ -1,4 +1,4 @@ seastone2/cfg/seastone2-modules.conf etc/modules-load.d seastone2/systemd/platform-modules-seastone2.service lib/systemd/system -seastone2/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-cel_seastone_2-r0 -services/platform_api/platform_api_mgnt.sh usr/local/bin \ No newline at end of file +seastone2/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-cel_seastone_2-r0 +services/platform_api/platform_api_mgnt.sh usr/local/bin diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-silverstone.install b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-silverstone.install index 67b433ced85f..73fa4b90a4fc 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-silverstone.install +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-silverstone.install @@ -2,5 +2,5 @@ silverstone/scripts/sensors usr/bin silverstone/scripts/platform_sensors.py usr/local/bin silverstone/cfg/silverstone-modules.conf etc/modules-load.d silverstone/systemd/platform-modules-silverstone.service lib/systemd/system -silverstone/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-cel_silverstone-r0 +silverstone/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-cel_silverstone-r0 services/platform_api/platform_api_mgnt.sh usr/local/bin diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/rules b/platform/broadcom/sonic-platform-modules-cel/debian/rules index efb5aa47b437..97d383fcfa28 100755 --- a/platform/broadcom/sonic-platform-modules-cel/debian/rules +++ b/platform/broadcom/sonic-platform-modules-cel/debian/rules @@ -14,13 +14,11 @@ override_dh_auto_build: (for mod in $(MODULE_DIRS); do \ make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ if [ $$mod = "seastone2" ]; then \ - cd services/platform_api; \ - python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ + cd $(MOD_SRC_DIR)/services/platform_api; \ python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ continue; \ fi; \ cd $(MOD_SRC_DIR)/$${mod}; \ - python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ done) diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/leds-dx010.c b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/leds-dx010.c index fac8322f06b0..c1693a37e3c1 100644 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/leds-dx010.c +++ b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/leds-dx010.c @@ -18,6 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include #include #include diff --git a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/mc24lc64t.c b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/mc24lc64t.c index a391056d09a7..002172f587e8 100644 --- a/platform/broadcom/sonic-platform-modules-cel/dx010/modules/mc24lc64t.c +++ b/platform/broadcom/sonic-platform-modules-cel/dx010/modules/mc24lc64t.c @@ -94,7 +94,7 @@ static int mc24lc64t_probe(struct i2c_client *client, sizeof(struct mc24lc64t_data), GFP_KERNEL))) return -ENOMEM; - drvdata->fake_client = i2c_new_dummy(client->adapter, client->addr + 1); + drvdata->fake_client = i2c_new_dummy_device(client->adapter, client->addr + 1); if (!drvdata->fake_client) return -ENOMEM; diff --git a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/mc24lc64t.c b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/mc24lc64t.c index a391056d09a7..002172f587e8 100644 --- a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/mc24lc64t.c +++ b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/mc24lc64t.c @@ -94,7 +94,7 @@ static int mc24lc64t_probe(struct i2c_client *client, sizeof(struct mc24lc64t_data), GFP_KERNEL))) return -ENOMEM; - drvdata->fake_client = i2c_new_dummy(client->adapter, client->addr + 1); + drvdata->fake_client = i2c_new_dummy_device(client->adapter, client->addr + 1); if (!drvdata->fake_client) return -ENOMEM; diff --git a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/smc.c b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/smc.c index 7ec9753066b3..b38b8ea68f1e 100644 --- a/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/smc.c +++ b/platform/broadcom/sonic-platform-modules-cel/haliburton/modules/smc.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/platform/broadcom/sonic-platform-modules-cel/seastone2/modules/switchboard_fpga.c b/platform/broadcom/sonic-platform-modules-cel/seastone2/modules/switchboard_fpga.c index 5918d27f3911..a30265616e6e 100644 --- a/platform/broadcom/sonic-platform-modules-cel/seastone2/modules/switchboard_fpga.c +++ b/platform/broadcom/sonic-platform-modules-cel/seastone2/modules/switchboard_fpga.c @@ -1870,7 +1870,7 @@ static struct i2c_adapter * seastone2_i2c_init(struct platform_device *pdev, if (!new_data) { printk(KERN_ALERT "Cannot alloc i2c data for %s", fpga_i2c_bus_dev[portid].calling_name); - kzfree(new_adapter); + kfree_sensitive(new_adapter); return NULL; } @@ -1889,8 +1889,8 @@ static struct i2c_adapter * seastone2_i2c_init(struct platform_device *pdev, error = i2c_add_numbered_adapter(new_adapter); if (error < 0) { printk(KERN_ALERT "Cannot add i2c adapter %s", new_data->pca9548.calling_name); - kzfree(new_adapter); - kzfree(new_data); + kfree_sensitive(new_adapter); + kfree_sensitive(new_data); return NULL; } @@ -1936,7 +1936,7 @@ static int seastone2_drv_probe(struct platform_device *pdev) fpga = kobject_create_and_add("FPGA", &pdev->dev.kobj); if (!fpga) { - kzfree(fpga_data); + kfree_sensitive(fpga_data); return -ENOMEM; } @@ -1944,7 +1944,7 @@ static int seastone2_drv_probe(struct platform_device *pdev) if (ret != 0) { printk(KERN_ERR "Cannot create FPGA sysfs attributes\n"); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return ret; } @@ -1952,7 +1952,7 @@ static int seastone2_drv_probe(struct platform_device *pdev) if (!cpld1) { sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return -ENOMEM; } ret = sysfs_create_group(cpld1, &cpld1_attr_grp); @@ -1961,7 +1961,7 @@ static int seastone2_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return ret; } @@ -1971,7 +1971,7 @@ static int seastone2_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return -ENOMEM; } ret = sysfs_create_group(cpld2, &cpld2_attr_grp); @@ -1982,7 +1982,7 @@ static int seastone2_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return ret; } @@ -1995,7 +1995,7 @@ static int seastone2_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return PTR_ERR(sff_dev); } @@ -2009,7 +2009,7 @@ static int seastone2_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return ret; } @@ -2023,7 +2023,7 @@ static int seastone2_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return ret; } @@ -2040,9 +2040,9 @@ static int seastone2_drv_probe(struct platform_device *pdev) sff_data = dev_get_drvdata(fpga_data->sff_devices[portid_count]); BUG_ON(sff_data == NULL); if ( sff_data->port_type == QSFP ) { - fpga_data->sff_i2c_clients[portid_count] = i2c_new_device(i2c_adap, &sff8436_eeprom_info[0]); + fpga_data->sff_i2c_clients[portid_count] = i2c_new_client_device(i2c_adap, &sff8436_eeprom_info[0]); } else { - fpga_data->sff_i2c_clients[portid_count] = i2c_new_device(i2c_adap, &sff8436_eeprom_info[1]); + fpga_data->sff_i2c_clients[portid_count] = i2c_new_client_device(i2c_adap, &sff8436_eeprom_info[1]); } sff_data = NULL; sysfs_create_link(&fpga_data->sff_devices[portid_count]->kobj, @@ -2362,4 +2362,4 @@ module_exit(seastone2_exit); MODULE_AUTHOR("Pradchaya P. "); MODULE_DESCRIPTION("Celestica Seastone2 switchboard driver"); MODULE_VERSION(MOD_VERSION); -MODULE_LICENSE("GPL"); \ No newline at end of file +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-cel/services/platform_api/platform_api_mgnt.sh b/platform/broadcom/sonic-platform-modules-cel/services/platform_api/platform_api_mgnt.sh index 208c8696c4b3..7515b81784b4 100755 --- a/platform/broadcom/sonic-platform-modules-cel/services/platform_api/platform_api_mgnt.sh +++ b/platform/broadcom/sonic-platform-modules-cel/services/platform_api/platform_api_mgnt.sh @@ -4,20 +4,13 @@ PREV_REBOOT_CAUSE="/host/reboot-cause/" DEVICE="/usr/share/sonic/device" PLATFORM=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) FILES=$DEVICE/$PLATFORM/api_files -PY2_PACK=$DEVICE/$PLATFORM/sonic_platform-1.0-py2-none-any.whl PY3_PACK=$DEVICE/$PLATFORM/sonic_platform-1.0-py3-none-any.whl install() { - # Install python2.7 sonic-platform package - if [ -e $PY2_PACK ]; then - pip install $PY2_PACK - fi - # Install python3 sonic-platform package if [ -e $PY3_PACK ]; then pip3 install $PY3_PACK fi - } init() { diff --git a/platform/broadcom/sonic-platform-modules-cel/services/platform_api/sonic_platform/eeprom.py b/platform/broadcom/sonic-platform-modules-cel/services/platform_api/sonic_platform/eeprom.py index 7756c0f2f839..1e06e7b80e62 100644 --- a/platform/broadcom/sonic-platform-modules-cel/services/platform_api/sonic_platform/eeprom.py +++ b/platform/broadcom/sonic-platform-modules-cel/services/platform_api/sonic_platform/eeprom.py @@ -45,7 +45,7 @@ def _parse_output(self, decode_output): for line in lines: try: match = re.search( - '(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)([\S]+)', line) + '(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)(.*$)', line) if match is not None: idx = match.group(1) value = match.group(3).rstrip('\0') diff --git a/platform/broadcom/sonic-platform-modules-cel/services/platform_api/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-cel/services/platform_api/sonic_platform/sfp.py index 07eac37d8d82..b0c0a63d5a42 100644 --- a/platform/broadcom/sonic-platform-modules-cel/services/platform_api/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-cel/services/platform_api/sonic_platform/sfp.py @@ -528,7 +528,7 @@ def get_transceiver_info(self): keys |Value Format |Information ---------------------------|---------------|---------------------------- type |1*255VCHAR |type of SFP - hardware_rev |1*255VCHAR |hardware version of SFP + vendor_rev |1*255VCHAR |vendor revision of SFP serial |1*255VCHAR |serial number of the SFP manufacturer |1*255VCHAR |SFP vendor name model |1*255VCHAR |SFP model name @@ -603,7 +603,7 @@ def get_transceiver_info(self): transceiver_info_dict['type'] = sfp_type_data['data']['type']['value'] transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] elif self.sfp_type == QSFP_TYPE: @@ -746,7 +746,7 @@ def get_transceiver_info(self): sfp_vendor_name_data['data']['Vendor Name']['value']) transceiver_info_dict['model'] = str( sfp_vendor_pn_data['data']['Vendor PN']['value']) - transceiver_info_dict['hardware_rev'] = str( + transceiver_info_dict['vendor_rev'] = str( sfp_vendor_rev_data['data']['Vendor Rev']['value']) transceiver_info_dict['serial'] = str( sfp_vendor_sn_data['data']['Vendor SN']['value']) @@ -821,7 +821,7 @@ def get_transceiver_info(self): transceiver_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value'] transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] transceiver_info_dict['vendor_date'] = sfp_vendor_date_data[ diff --git a/platform/broadcom/sonic-platform-modules-cel/silverstone/modules/switchboard.c b/platform/broadcom/sonic-platform-modules-cel/silverstone/modules/switchboard.c index 2ee6c858a8b6..e41b64badefc 100644 --- a/platform/broadcom/sonic-platform-modules-cel/silverstone/modules/switchboard.c +++ b/platform/broadcom/sonic-platform-modules-cel/silverstone/modules/switchboard.c @@ -1604,7 +1604,7 @@ static struct i2c_adapter * silverstone_i2c_init(struct platform_device *pdev, i new_data = kzalloc(sizeof(*new_data), GFP_KERNEL); if (!new_data) { printk(KERN_ALERT "Cannot alloc i2c data for %s", fpga_i2c_bus_dev[portid].calling_name); - kzfree(new_adapter); + kfree_sensitive(new_adapter); return NULL; } @@ -1623,8 +1623,8 @@ static struct i2c_adapter * silverstone_i2c_init(struct platform_device *pdev, i error = i2c_add_numbered_adapter(new_adapter); if (error < 0) { printk(KERN_ALERT "Cannot add i2c adapter %s", new_data->pca9548.calling_name); - kzfree(new_adapter); - kzfree(new_data); + kfree_sensitive(new_adapter); + kfree_sensitive(new_data); return NULL; } @@ -1685,7 +1685,7 @@ static int silverstone_drv_probe(struct platform_device *pdev) fpga = kobject_create_and_add("FPGA", &pdev->dev.kobj); if (!fpga) { - kzfree(fpga_data); + kfree_sensitive(fpga_data); return -ENOMEM; } @@ -1693,7 +1693,7 @@ static int silverstone_drv_probe(struct platform_device *pdev) if (ret != 0) { printk(KERN_ERR "Cannot create FPGA sysfs attributes\n"); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return ret; } @@ -1701,7 +1701,7 @@ static int silverstone_drv_probe(struct platform_device *pdev) if (!cpld1) { sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return -ENOMEM; } ret = sysfs_create_group(cpld1, &cpld1_attr_grp); @@ -1710,7 +1710,7 @@ static int silverstone_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return ret; } @@ -1720,7 +1720,7 @@ static int silverstone_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return -ENOMEM; } ret = sysfs_create_group(cpld2, &cpld2_attr_grp); @@ -1731,7 +1731,7 @@ static int silverstone_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return ret; } @@ -1744,7 +1744,7 @@ static int silverstone_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return PTR_ERR(sff_dev); } @@ -1758,7 +1758,7 @@ static int silverstone_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return ret; } @@ -1772,7 +1772,7 @@ static int silverstone_drv_probe(struct platform_device *pdev) kobject_put(cpld1); sysfs_remove_group(fpga, &fpga_attr_grp); kobject_put(fpga); - kzfree(fpga_data); + kfree_sensitive(fpga_data); return ret; } @@ -1788,9 +1788,9 @@ static int silverstone_drv_probe(struct platform_device *pdev) sff_data = dev_get_drvdata(fpga_data->sff_devices[portid_count]); BUG_ON(sff_data == NULL); if ( sff_data->port_type == QSFP ) { - fpga_data->sff_i2c_clients[portid_count] = i2c_new_device(i2c_adap, &sff8436_eeprom_info[0]); + fpga_data->sff_i2c_clients[portid_count] = i2c_new_client_device(i2c_adap, &sff8436_eeprom_info[0]); } else { - fpga_data->sff_i2c_clients[portid_count] = i2c_new_device(i2c_adap, &sff8436_eeprom_info[1]); + fpga_data->sff_i2c_clients[portid_count] = i2c_new_client_device(i2c_adap, &sff8436_eeprom_info[1]); } sff_data = NULL; sysfs_create_link(&fpga_data->sff_devices[portid_count]->kobj, @@ -2103,4 +2103,4 @@ module_exit(silverstone_exit); MODULE_AUTHOR("Celestica Inc."); MODULE_DESCRIPTION("Celestica Silverstone platform driver"); MODULE_VERSION(MOD_VERSION); -MODULE_LICENSE("GPL"); \ No newline at end of file +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-dell/common/ipmihelper.py b/platform/broadcom/sonic-platform-modules-dell/common/ipmihelper.py index d95329c40de2..3908f90bdad4 100644 --- a/platform/broadcom/sonic-platform-modules-dell/common/ipmihelper.py +++ b/platform/broadcom/sonic-platform-modules-dell/common/ipmihelper.py @@ -90,7 +90,10 @@ def get_twos_complement(val, bits): R_exp = get_twos_complement((factors[6] & 0xF0) >> 4, 4) B_exp = get_twos_complement(factors[6] & 0x0F, 4) - converted_reading = ((M * raw_value) + (B * 10**B_exp)) * 10**R_exp + if R_exp < 0: + converted_reading = ((M * raw_value) + (B * 10**B_exp)) / 10**(-R_exp) + else: + converted_reading = ((M * raw_value) + (B * 10**B_exp)) * 10**R_exp return True, converted_reading diff --git a/platform/broadcom/sonic-platform-modules-dell/common/onie_stage_fwpkg b/platform/broadcom/sonic-platform-modules-dell/common/onie_stage_fwpkg new file mode 100755 index 000000000000..dcc74a09a91e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/common/onie_stage_fwpkg @@ -0,0 +1,70 @@ +#!/bin/bash + +ONIE_PATH="/mnt/onie-boot" +ONIE_PENDING_DIR="${ONIE_PATH}/onie/update/pending" + +unset FWPKG + +function stage_fwpkg() +{ + local name=$(basename ${FWPKG}) + local pending="${ONIE_PENDING_DIR}/$name" + + # Exit if not superuser + if [[ "$EUID" -ne 0 ]]; then + echo "ERROR: This command must be run as root" >&2 + exit 1 + fi + + # Mount ONIE partition if not already mounted + if ! grep -qs ${ONIE_PATH} /proc/mounts; then + mkdir -p ${ONIE_PATH} + mount LABEL=ONIE-BOOT ${ONIE_PATH} || { + echo "ERROR: Failed to mount ONIE partition" + exit 1 + } + fi + + [ -f "$pending" ] && { + echo "INFO: Firmware update package ${name} is already staged" + exit 2 + } + + ${ONIE_PATH}/onie/tools/bin/onie-fwpkg add ${FWPKG} || { + echo "ERROR: onie-fwpkg add for ${name} failed" + exit 1 + } +} + +SCRIPT=$0 + +function show_help_and_exit() +{ + echo "Usage ${SCRIPT} [options]" + echo " This script will stage ONIE firmware update package." + echo " " + echo " Available options:" + echo " -h, -? : getting this help" + echo " -a [fwpkg] : stages the firmware update package" + + exit 0 +} + + +function parse_options() +{ + while getopts ":h?a:" opt; do + case $opt in + a ) + FWPKG=$(realpath $OPTARG) + stage_fwpkg + ;; + h|\? ) + show_help_and_exit + ;; + esac + done +} + +parse_options $@ +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-dell/common/sonic_platform/hwaccess.py b/platform/broadcom/sonic-platform-modules-dell/common/sonic_platform/hwaccess.py index 373f71bdd5bf..642a6ddc6fc8 100644 --- a/platform/broadcom/sonic-platform-modules-dell/common/sonic_platform/hwaccess.py +++ b/platform/broadcom/sonic-platform-modules-dell/common/sonic_platform/hwaccess.py @@ -39,7 +39,10 @@ def pci_set_value(resource, val, offset): # Read I2C device def i2c_get(bus, i2caddr, ofs): - return int(subprocess.check_output(['/usr/sbin/i2cget', '-y', str(bus), str(i2caddr), str(ofs)]), 16) + try: + return int(subprocess.check_output(['/usr/sbin/i2cget', '-y', str(bus), str(i2caddr), str(ofs)]), 16) + except (FileNotFoundError, subprocess.CalledProcessError): + return -1 def io_reg_read(io_resource, offset): fd = os.open(io_resource, os.O_RDONLY) diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/control b/platform/broadcom/sonic-platform-modules-dell/debian/control index e7258e5a6666..da3f2da58625 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/control +++ b/platform/broadcom/sonic-platform-modules-dell/debian/control @@ -7,55 +7,60 @@ Standards-Version: 3.9.3 Package: platform-modules-s6000 Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-z9100 Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-s6100 Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-z9264f Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned +Description: kernel modules for platform devices such as fan, led, sfp + +Package: platform-modules-s5212f +Architecture: amd64 +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-s5224f Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-s5232f Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-s5248f Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-n3248te Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-z9332f Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-n3248pxe Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-s5296f Architecture: amd64 -Depends: linux-image-4.9.0-9-2-amd64 +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s5212f.init b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s5212f.init new file mode 100755 index 000000000000..2c5def7587f2 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s5212f.init @@ -0,0 +1,40 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup S5212f board. +### END INIT INFO + +case "$1" in +start) + echo -n "Setting up board... " + + # /usr/local/bin/iom_power_on.sh + /usr/local/bin/s5212f_platform.sh init + + echo "done." + ;; + +stop) + /usr/local/bin/s5212f_platform.sh deinit + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/platform-modules-s5212f.init {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s5212f.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s5212f.install new file mode 100644 index 000000000000..a8e051ff72b9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s5212f.install @@ -0,0 +1,13 @@ +s5212f/scripts/s5212f_platform.sh usr/local/bin +s5212f/scripts/check_qsfp.sh usr/local/bin +s5212f/scripts/platform_sensors.py usr/local/bin +s5212f/scripts/sensors usr/bin +s5212f/scripts/qsfp_irq_enable.py usr/bin +s5212f/cfg/s5212f-modules.conf etc/modules-load.d +s5212f/systemd/platform-modules-s5212f.service etc/systemd/system +s5212f/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-dellemc_s5212f_c3538-r0 +common/platform_reboot usr/share/sonic/device/x86_64-dellemc_s5212f_c3538-r0 +common/fw-updater usr/local/bin +common/onie_mode_set usr/local/bin +s5212f/scripts/pcisysfs.py usr/bin +s5212f/cfg/s5212f-params.conf etc/modprobe.d diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s5212f.postinst b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s5212f.postinst new file mode 100644 index 000000000000..f260f79fbf29 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s5212f.postinst @@ -0,0 +1,10 @@ +# postinst script for S5212f + +# Enable Dell-S5212f-platform-service +depmod -a +systemctl enable platform-modules-s5212f.service +systemctl start platform-modules-s5212f.service + + +#DEBHELPER# + diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s5232f.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s5232f.install index 25d2b84ad4ac..a6003d1273c1 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s5232f.install +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s5232f.install @@ -5,7 +5,6 @@ s5232f/scripts/sensors usr/bin s5232f/scripts/qsfp_irq_enable.py usr/bin s5232f/cfg/s5232f-modules.conf etc/modules-load.d s5232f/systemd/platform-modules-s5232f.service etc/systemd/system -s5232f/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dellemc_s5232f_c3538-r0 s5232f/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-dellemc_s5232f_c3538-r0 common/platform_reboot usr/share/sonic/device/x86_64-dellemc_s5232f_c3538-r0 common/fw-updater usr/local/bin diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install index 2311ea0b578a..7db4c9c620f2 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.install @@ -1,14 +1,11 @@ s6000/scripts/s6000_platform.sh usr/local/bin s6000/scripts/reset-qsfp usr/local/bin s6000/scripts/set-fan-speed usr/local/bin -s6000/scripts/fancontrol.sh usr/local/bin s6000/scripts/hw-management-generate-dump.sh usr/bin s6000/systemd/platform-modules-s6000.service etc/systemd/system -s6000/systemd/fancontrol.service etc/systemd/system common/io_rd_wr.py usr/local/bin common/actions.sh usr/share/sonic/device/x86_64-dell_s6000_s1220-r0 s6000/scripts/platform_reboot_override usr/share/sonic/device/x86_64-dell_s6000_s1220-r0 s6000/scripts/platform_update_reboot_cause usr/share/sonic/device/x86_64-dell_s6000_s1220-r0 s6000/scripts/override.conf /etc/systemd/system/systemd-reboot.service.d -s6000/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dell_s6000_s1220-r0 s6000/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-dell_s6000_s1220-r0 diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.postinst b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.postinst index 052e5a6f574e..9326d7633521 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.postinst +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6000.postinst @@ -5,8 +5,4 @@ depmod -a systemctl enable platform-modules-s6000.service systemctl start platform-modules-s6000.service -systemctl enable fancontrol.service -systemctl start fancontrol.service - - #DEBHELPER# diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install index bf95a7ec8961..4770ac7c2caf 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install @@ -1,6 +1,6 @@ s6100/scripts/iom_power_*.sh usr/local/bin s6100/scripts/s6100_platform.sh usr/local/bin -s6100/scripts/s6100_i2c_enumeration.sh usr/local/bin +s6100/scripts/s6100_platform_startup.sh usr/local/bin s6100/scripts/s6100_bitbang_reset.sh usr/local/bin s6100/scripts/pcisysfs.py usr/bin common/dell_i2c_utils.sh usr/local/bin @@ -14,6 +14,7 @@ s6100/scripts/soft-reboot_plugin usr/share/sonic/device/x86_64-dell_s6100_c2538- s6100/scripts/reboot_plugin usr/share/sonic/device/x86_64-dell_s6100_c2538-r0 s6100/scripts/ssd-fw-upgrade usr/share/sonic/device/x86_64-dell_s6100_c2538-r0 s6100/scripts/override.conf /etc/systemd/system/systemd-reboot.service.d +s6100/scripts/platform_fw_au_reboot_handle usr/share/sonic/device/x86_64-dell_s6100_c2538-r0 common/dell_lpc_mon.sh usr/local/bin s6100/scripts/s6100_ssd_mon.sh usr/local/bin s6100/scripts/s6100_ssd_upgrade_status.sh usr/local/bin @@ -21,7 +22,6 @@ common/actions.sh usr/share/sonic/device/x86_64-dell_s6100_c2538-r0 s6100/scripts/platform_sensors.py usr/local/bin s6100/scripts/platform_reboot_pre_check usr/share/sonic/device/x86_64-dell_s6100_c2538-r0 s6100/scripts/hw-management-generate-dump.sh usr/bin -s6100/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dell_s6100_c2538-r0 s6100/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-dell_s6100_c2538-r0 s6100/scripts/platform_watchdog_enable.sh usr/local/bin s6100/scripts/platform_watchdog_disable.sh usr/local/bin @@ -33,7 +33,7 @@ s6100/systemd/s6100-ssd-monitor.service etc/systemd/system s6100/systemd/s6100-ssd-monitor.timer etc/systemd/system s6100/systemd/s6100-ssd-upgrade-status.service etc/systemd/system s6100/systemd/s6100-reboot-cause.service etc/systemd/system -s6100/systemd/s6100-i2c-enumerate.service etc/systemd/system +s6100/systemd/s6100-platform-startup.service etc/systemd/system s6100/scripts/s6100_serial_getty_monitor etc/monit/conf.d common/fw-updater usr/local/bin common/onie_mode_set usr/local/bin diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install index 28d77243d639..a4176c3c12cb 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9100.install @@ -7,7 +7,6 @@ z9100/scripts/platform_reboot_override usr/share/sonic/device/x86_64-dell_z9100_ z9100/scripts/override.conf /etc/systemd/system/systemd-reboot.service.d z9100/scripts/platform_sensors.py usr/local/bin z9100/scripts/sensors usr/bin -z9100/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dell_z9100_c2538-r0 z9100/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-dell_z9100_c2538-r0 z9100/cfg/z9100-modules.conf etc/modules-load.d z9100/systemd/platform-modules-z9100.service etc/systemd/system diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9264f.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9264f.install index 9aa3793f5d29..4d08b3e98116 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9264f.install +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9264f.install @@ -5,7 +5,6 @@ z9264f/scripts/sensors usr/bin z9264f/scripts/port_irq_enable.py usr/bin z9264f/cfg/z9264f-modules.conf etc/modules-load.d z9264f/systemd/platform-modules-z9264f.service etc/systemd/system -z9264f/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dellemc_z9264f_c3538-r0 z9264f/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-dellemc_z9264f_c3538-r0 common/platform_reboot usr/share/sonic/device/x86_64-dellemc_z9264f_c3538-r0 common/fw-updater usr/local/bin diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9332f.install b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9332f.install index 9915b08b72ee..d668116c7445 100644 --- a/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9332f.install +++ b/platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-z9332f.install @@ -3,9 +3,10 @@ z9332f/scripts/platform_sensors.py usr/local/bin z9332f/scripts/sensors usr/bin z9332f/cfg/z9332f-modules.conf etc/modules-load.d z9332f/systemd/platform-modules-z9332f.service etc/systemd/system -z9332f/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dellemc_z9332f_d1508-r0 z9332f/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-dellemc_z9332f_d1508-r0 common/platform_reboot usr/share/sonic/device/x86_64-dellemc_z9332f_d1508-r0 common/pcisysfs.py usr/bin +common/io_rd_wr.py usr/local/bin common/fw-updater usr/local/bin common/onie_mode_set usr/local/bin +common/onie_stage_fwpkg usr/local/bin diff --git a/platform/broadcom/sonic-platform-modules-dell/debian/rules b/platform/broadcom/sonic-platform-modules-dell/debian/rules index d2ea5fba32e3..8baafa14076a 100755 --- a/platform/broadcom/sonic-platform-modules-dell/debian/rules +++ b/platform/broadcom/sonic-platform-modules-dell/debian/rules @@ -5,7 +5,7 @@ export INSTALL_MOD_DIR:=extra KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= s6000 z9100 s6100 z9264f s5224f s5232f s5248f z9332f s5296f n3248pxe n3248te +MODULE_DIRS:= s6000 z9100 s6100 z9264f s5212f s5224f s5232f s5248f z9332f s5296f n3248pxe n3248te COMMON_DIR := common %: @@ -18,25 +18,26 @@ override_dh_auto_build: cp $(COMMON_DIR)/dell_pmc.c $(MOD_SRC_DIR)/$${mod}/modules/dell_s6100_lpc.c; \ cp $(COMMON_DIR)/dell_ich.c $(MOD_SRC_DIR)/$${mod}/modules/dell_ich.c; \ cd $(MOD_SRC_DIR)/$${mod}; \ - python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ cd $(MOD_SRC_DIR); \ elif [ $$mod = "z9100" ]; then \ cp $(COMMON_DIR)/dell_pmc.c $(MOD_SRC_DIR)/$${mod}/modules/dell_mailbox.c; \ cp $(COMMON_DIR)/dell_ich.c $(MOD_SRC_DIR)/$${mod}/modules/dell_ich.c; \ cd $(MOD_SRC_DIR)/$${mod}; \ - python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ cd $(MOD_SRC_DIR); \ elif [ $$mod = "s6000" ]; then \ cd $(MOD_SRC_DIR)/$${mod}; \ - python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ cd $(MOD_SRC_DIR); \ elif [ $$mod = "z9264f" ]; then \ cp $(COMMON_DIR)/ipmihelper.py $(MOD_SRC_DIR)/$${mod}/sonic_platform/ipmihelper.py; \ cd $(MOD_SRC_DIR)/$${mod}; \ - python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ + python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ + cd $(MOD_SRC_DIR); \ + elif [ $$mod = "s5212f" ]; then \ + cp $(COMMON_DIR)/ipmihelper.py $(MOD_SRC_DIR)/$${mod}/sonic_platform/ipmihelper.py; \ + cd $(MOD_SRC_DIR)/$${mod}; \ python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ cd $(MOD_SRC_DIR); \ elif [ $$mod = "s5224f" ]; then \ @@ -47,7 +48,6 @@ override_dh_auto_build: elif [ $$mod = "s5232f" ]; then \ cp $(COMMON_DIR)/ipmihelper.py $(MOD_SRC_DIR)/$${mod}/sonic_platform/ipmihelper.py; \ cd $(MOD_SRC_DIR)/$${mod}; \ - python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ cd $(MOD_SRC_DIR); \ elif [ $$mod = "s5248f" ]; then \ @@ -56,20 +56,16 @@ override_dh_auto_build: python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ cd $(MOD_SRC_DIR); \ elif [ $$mod = "n3248te" ]; then \ - cp $(COMMON_DIR)/ipmihelper.py $(MOD_SRC_DIR)/$${mod}/sonic_platform/ipmihelper.py; \ cd $(MOD_SRC_DIR)/$${mod}; \ python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ cd $(MOD_SRC_DIR); \ elif [ $$mod = "z9332f" ]; then \ cp $(COMMON_DIR)/ipmihelper.py $(MOD_SRC_DIR)/$${mod}/sonic_platform/ipmihelper.py; \ cd $(MOD_SRC_DIR)/$${mod}; \ - python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ cd $(MOD_SRC_DIR); \ elif [ $$mod = "n3248pxe" ]; then \ - cp $(COMMON_DIR)/ipmihelper.py $(MOD_SRC_DIR)/$${mod}/sonic_platform/ipmihelper.py; \ cd $(MOD_SRC_DIR)/$${mod}; \ - python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ cd $(MOD_SRC_DIR); \ fi; \ @@ -119,6 +115,11 @@ override_dh_clean: rm -f $(MOD_SRC_DIR)/$${mod}/modules/*.whl; \ rm -rf $(MOD_SRC_DIR)/$${mod}/build; \ rm -rf $(MOD_SRC_DIR)/$${mod}/build/*.egg-info; \ + elif [ $$mod = "s5212f" ]; then \ + rm -f $(MOD_SRC_DIR)/$${mod}/sonic_platform/ipmihelper.py; \ + rm -f $(MOD_SRC_DIR)/$${mod}/modules/*.whl; \ + rm -rf $(MOD_SRC_DIR)/$${mod}/build; \ + rm -rf $(MOD_SRC_DIR)/$${mod}/build/*.egg-info; \ elif [ $$mod = "s5224f" ]; then \ rm -f $(MOD_SRC_DIR)/$${mod}/sonic_platform/ipmihelper.py; \ rm -f $(MOD_SRC_DIR)/$${mod}/modules/*.whl; \ diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/modules/dell_n3248pxe_platform.c b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/modules/dell_n3248pxe_platform.c index 34f62a39e45b..5fb106f186b3 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/modules/dell_n3248pxe_platform.c +++ b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/modules/dell_n3248pxe_platform.c @@ -853,6 +853,41 @@ static ssize_t fan_led_store(struct device *dev, struct device_attribute *devatt return count; } +static ssize_t watchdog_show(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + s32 ret; + u8 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[cpu_cpld].client, 0x7); + if (ret < 0) + return sprintf(buf, "read error"); + data = ret; + + return sprintf(buf, "%x\n", data); +} + +static ssize_t watchdog_store(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + s32 ret, err; + unsigned long val; + u8 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 10, &val); + if (err) + return err; + + if (data) + { + ret = i2c_smbus_write_byte_data(pdata[cpu_cpld].client, 0x7, data); + if (ret < 0) + return ret; + } + + return count; +} static ssize_t power_good_show(struct device *dev, struct device_attribute *devattr, char *buf) @@ -947,6 +982,7 @@ static DEVICE_ATTR_RO(psu1_prs); static DEVICE_ATTR_RO(psu0_status); static DEVICE_ATTR_RO(psu1_status); static DEVICE_ATTR_RW(system_led); +static DEVICE_ATTR_RW(watchdog); static DEVICE_ATTR_RW(locator_led); static DEVICE_ATTR_RW(power_led); static DEVICE_ATTR_RW(master_led); @@ -988,6 +1024,7 @@ static struct attribute *n3248pxe_cpld_attrs[] = { &dev_attr_psu0_status.attr, &dev_attr_psu1_status.attr, &dev_attr_system_led.attr, + &dev_attr_watchdog.attr, &dev_attr_locator_led.attr, &dev_attr_power_led.attr, &dev_attr_master_led.attr, @@ -1052,7 +1089,7 @@ static int __init cpld_probe(struct platform_device *pdev) return -ENODEV; } for (i = 0; i < CPLD_DEVICE_NUM; i++) { - pdata[i].client = i2c_new_dummy(parent, pdata[i].reg_addr); + pdata[i].client = i2c_new_dummy_device(parent, pdata[i].reg_addr); if (!pdata[i].client) { printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[i].reg_addr); goto error; @@ -1135,7 +1172,7 @@ static int __init dell_n3248pxe_platform_init(void) } sys_i2c_adap = i2c_get_adapter(sys_i2c_bus); - mux_i2c_cli = i2c_new_device(sys_i2c_adap, sys_board_mux); + mux_i2c_cli = i2c_new_client_device(sys_i2c_adap, sys_board_mux); if (!mux_i2c_cli) return PTR_ERR_OR_ZERO(mux_i2c_cli); diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/scripts/n3248pxe_platform.sh b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/scripts/n3248pxe_platform.sh index c049826608b1..3b50982497f3 100755 --- a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/scripts/n3248pxe_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/scripts/n3248pxe_platform.sh @@ -89,8 +89,6 @@ install_python_api_package() { } remove_python_api_package() { - rv=$(pip show sonic-platform > /dev/null 2>/dev/null) - rv=$(pip3 show sonic-platform > /dev/null 2>/dev/null) if [ $? -eq 0 ]; then rv=$(pip3 uninstall -y sonic-platform > /dev/null 2>/dev/null) @@ -112,7 +110,7 @@ get_reboot_cause() { if [[ "$1" == "init" ]]; then modprobe i2c-dev - modprobe i2c-mux-pca954x force_deselect_on_exit=1 + modprobe i2c-mux-pca954x modprobe pmbus modprobe emc2305 modprobe dps200 @@ -124,12 +122,12 @@ if [[ "$1" == "init" ]]; then echo 0xf0 > /sys/devices/platform/dell-n3248pxe-cpld.0/sfp_txdis install_python_api_package platform_firmware_versions + echo -2 > /sys/class/i2c-adapter/i2c-0/0-0071/idle_state elif [[ "$1" == "deinit" ]]; then switch_board_sfp "delete_device" sysdevices "delete_device" modprobe -r dell_n3248pxe_platform - modprobe -r dps200 modprobe -r emc2305 modprobe -r pmbus diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/ipmihelper.py b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/ipmihelper.py deleted file mode 100644 index d95329c40de2..000000000000 --- a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/ipmihelper.py +++ /dev/null @@ -1,269 +0,0 @@ -#!/usr/bin/python3 - -######################################################################## -# DellEMC -# -# Module contains implementation of IpmiSensor and IpmiFru classes that -# provide Sensor's and FRU's information respectively. -# -######################################################################## - -import subprocess -import re - -# IPMI Request Network Function Codes -NetFn_SensorEvent = 0x04 -NetFn_Storage = 0x0A - -# IPMI Sensor Device Commands -Cmd_GetSensorReadingFactors = 0x23 -Cmd_GetSensorThreshold = 0x27 -Cmd_GetSensorReading = 0x2D - -# IPMI FRU Device Commands -Cmd_ReadFRUData = 0x11 - -def get_ipmitool_raw_output(args): - """ - Returns a list the elements of which are the individual bytes of - ipmitool raw command output. - """ - result_bytes = list() - result = "" - command = "ipmitool raw {}".format(args) - try: - proc = subprocess.Popen(command.split(), stdout=subprocess.PIPE, - universal_newlines=True, stderr=subprocess.STDOUT) - stdout = proc.communicate()[0] - proc.wait() - if not proc.returncode: - result = stdout.rstrip('\n') - except EnvironmentError: - pass - - for i in result.split(): - result_bytes.append(int(i, 16)) - - return result_bytes - -class IpmiSensor(object): - - # Sensor Threshold types and their respective bit masks - THRESHOLD_BIT_MASK = { - "LowerNonCritical" : 0, - "LowerCritical" : 1, - "LowerNonRecoverable" : 2, - "UpperNonCritical" : 3, - "UpperCritical" : 4, - "UpperNonRecoverable" : 5 - } - - def __init__(self, sensor_id, is_discrete=False): - self.id = sensor_id - self.is_discrete = is_discrete - - def _get_converted_sensor_reading(self, raw_value): - """ - Returns a 2 element tuple(bool, int) in which first element - provides the validity of the reading and the second element is - the converted sensor reading - """ - # Get Sensor Reading Factors - cmd_args = "{} {} {} {}".format(NetFn_SensorEvent, - Cmd_GetSensorReadingFactors, - self.id, raw_value) - factors = get_ipmitool_raw_output(cmd_args) - - if len(factors) != 7: - return False, 0 - - # Compute Twos complement - def get_twos_complement(val, bits): - if val & (1 << (bits - 1)): - val = val - (1 << bits) - return val - - # Calculate actual sensor value from the raw sensor value - # using the sensor reading factors. - M = get_twos_complement(((factors[2] & 0xC0) << 8) | factors[1], 10) - B = get_twos_complement(((factors[4] & 0xC0) << 8) | factors[3], 10) - R_exp = get_twos_complement((factors[6] & 0xF0) >> 4, 4) - B_exp = get_twos_complement(factors[6] & 0x0F, 4) - - converted_reading = ((M * raw_value) + (B * 10**B_exp)) * 10**R_exp - - return True, converted_reading - - def get_reading(self): - """ - For Threshold sensors, returns the sensor reading. - For Discrete sensors, returns the state value. - - Returns: - A tuple (bool, int) where the first element provides the - validity of the reading and the second element provides the - sensor reading/state value. - """ - # Get Sensor Reading - cmd_args = "{} {} {}".format(NetFn_SensorEvent, Cmd_GetSensorReading, - self.id) - output = get_ipmitool_raw_output(cmd_args) - if len(output) != 4: - return False, 0 - - # Check reading/state unavailable - if output[1] & 0x20: - return False, 0 - - if self.is_discrete: - state = ((output[3] & 0x7F) << 8) | output[2] - return True, state - else: - return self._get_converted_sensor_reading(output[0]) - - def get_threshold(self, threshold_type): - """ - Returns the sensor's threshold value for a given threshold type. - - Args: - threshold_type (str) - one of the below mentioned - threshold type strings - - "LowerNonCritical" - "LowerCritical" - "LowerNonRecoverable" - "UpperNonCritical" - "UpperCritical" - "UpperNonRecoverable" - Returns: - A tuple (bool, int) where the first element provides the - validity of that threshold and second element provides the - threshold value. - """ - # Thresholds are not valid for discrete sensors - if self.is_discrete: - raise TypeError("Threshold is not applicable for Discrete Sensor") - - if threshold_type not in list(self.THRESHOLD_BIT_MASK.keys()): - raise ValueError("Invalid threshold type {} provided. Valid types " - "are {}".format(threshold_type, - list(self.THRESHOLD_BIT_MASK.keys()))) - - bit_mask = self.THRESHOLD_BIT_MASK[threshold_type] - - # Get Sensor Threshold - cmd_args = "{} {} {}".format(NetFn_SensorEvent, Cmd_GetSensorThreshold, - self.id) - thresholds = get_ipmitool_raw_output(cmd_args) - if len(thresholds) != 7: - return False, 0 - - valid_thresholds = thresholds.pop(0) - # Check whether particular threshold is readable - if valid_thresholds & (1 << bit_mask): - return self._get_converted_sensor_reading(thresholds[bit_mask]) - else: - return False, 0 - -class IpmiFru(object): - - def __init__(self, fru_id): - self.id = fru_id - - def _get_ipmitool_fru_print(self): - result = "" - command = "ipmitool fru print {}".format(self.id) - try: - proc = subprocess.Popen(command.split(), stdout=subprocess.PIPE, - universal_newlines=True, stderr=subprocess.STDOUT) - stdout = proc.communicate()[0] - proc.wait() - if not proc.returncode: - result = stdout.rstrip('\n') - except EnvironmentError: - pass - - return result - - def _get_from_fru(self, info): - """ - Returns a string containing the info from FRU - """ - fru_output = self._get_ipmitool_fru_print() - if not fru_output: - return "NA" - - info_req = re.search(r"%s\s*:(.*)" % info, fru_output) - if not info_req: - return "NA" - - return info_req.group(1).strip() - - def get_board_serial(self): - """ - Returns a string containing the Serial Number of the device. - """ - return self._get_from_fru('Board Serial') - - def get_board_part_number(self): - """ - Returns a string containing the Part Number of the device. - """ - return self._get_from_fru('Board Part Number') - - def get_board_mfr_id(self): - """ - Returns a string containing the manufacturer id of the FRU. - """ - return self._get_from_fru('Board Mfg') - - def get_board_product(self): - """ - Returns a string containing the manufacturer id of the FRU. - """ - return self._get_from_fru('Board Product') - - def get_fru_data(self, offset, count=1): - """ - Reads and returns the FRU data at the provided offset. - - Args: - offset (int) - FRU offset to read - count (int) - Number of bytes to read [optional, default = 1] - Returns: - A tuple (bool, list(int)) where the first element provides - the validity of the data read and the second element is a - list, the elements of which are the individual bytes of the - FRU data read. - """ - result_bytes = list() - is_valid = True - result = "" - - offset_LSB = offset & 0xFF - offset_MSB = offset & 0xFF00 - command = "ipmitool raw {} {} {} {} {} {}".format(NetFn_Storage, - Cmd_ReadFRUData, - self.id, offset_LSB, - offset_MSB, count) - try: - proc = subprocess.Popen(command.split(), stdout=subprocess.PIPE, - universal_newlines=True, stderr=subprocess.STDOUT) - stdout = proc.communicate()[0] - proc.wait() - if not proc.returncode: - result = stdout.rstrip('\n') - except EnvironmentError: - is_valid = False - - if (not result) or (not is_valid): - return False, result_bytes - - for i in result.split(): - result_bytes.append(int(i, 16)) - - read_count = result_bytes.pop(0) - if read_count != count: - return False, result_bytes - else: - return True, result_bytes diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/sfp.py index 9674b6a7b1a4..be1260986347 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/sfp.py @@ -12,164 +12,28 @@ import os import struct import mmap - from sonic_platform_base.sfp_base import SfpBase - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom - from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId - from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase except ImportError as e: raise ImportError(str(e) + "- required module not found") -PAGE_OFFSET = 0 -KEY_OFFSET = 1 -KEY_WIDTH = 2 -FUNC_NAME = 3 - -QSFP_INFO_OFFSET = 128 -QSFP_DOM_OFFSET = 0 -QSFP_DOM_OFFSET1 = 384 - -SFP_PORT_START = 49 -SFP_PORT_END = 54 - -SFP_INFO_OFFSET = 0 -SFP_DOM_OFFSET = 256 - -SFP_STATUS_CONTROL_OFFSET = 110 -SFP_STATUS_CONTROL_WIDTH = 7 -SFP_TX_DISABLE_HARD_BIT = 7 -SFP_TX_DISABLE_SOFT_BIT = 6 - -qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)', 'Length OM2(m)', - 'Length OM1(m)', 'Length Cable Assembly(m)') - -qsfp_compliance_code_tup = ( - '10/40G Ethernet Compliance Code', - 'SONET Compliance codes', - 'SAS/SATA compliance codes', - 'Gigabit Ethernet Compliant codes', - 'Fibre Channel link length/Transmitter Technology', - 'Fibre Channel transmission media', - 'Fibre Channel Speed') - -sfp_cable_length_tup = ('LengthSMFkm-UnitsOfKm', 'LengthSMF(UnitsOf100m)', - 'Length50um(UnitsOf10m)', 'Length62.5um(UnitsOfm)', - 'LengthOM3(UnitsOf10m)', 'LengthCable(UnitsOfm)') - -sfp_compliance_code_tup = ('10GEthernetComplianceCode', 'InfinibandComplianceCode', - 'ESCONComplianceCodes', 'SONETComplianceCodes', - 'EthernetComplianceCodes', 'FibreChannelLinkLength', - 'FibreChannelTechnology', 'SFP+CableTechnology', - 'FibreChannelTransmissionMedia', 'FibreChannelSpeed') - -info_dict_keys = ['type', 'hardware_rev', 'serial', - 'manufacturer', 'model', 'connector', - 'encoding', 'ext_identifier', 'ext_rateselect_compliance', - 'cable_type', 'cable_length', 'nominal_bit_rate', - 'specification_compliance', 'type_abbrv_name','vendor_date', 'vendor_oui'] - -dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', - 'power_lpmode', 'tx_disable', 'tx_disable_channel', - 'temperature', 'voltage', 'rx1power', - 'rx2power', 'rx3power', 'rx4power', - 'tx1bias', 'tx2bias', 'tx3bias', - 'tx4bias', 'tx1power', 'tx2power', - 'tx3power', 'tx4power'] - -threshold_dict_keys = ['temphighalarm', 'temphighwarning', - 'templowalarm', 'templowwarning', - 'vcchighalarm', 'vcchighwarning', - 'vcclowalarm', 'vcclowwarning', - 'rxpowerhighalarm', 'rxpowerhighwarning', - 'rxpowerlowalarm', 'rxpowerlowwarning', - 'txpowerhighalarm', 'txpowerhighwarning', - 'txpowerlowalarm', 'txpowerlowwarning', - 'txbiashighalarm', 'txbiashighwarning', - 'txbiaslowalarm', 'txbiaslowwarning'] - -sff8436_parser = { - 'reset_status': [QSFP_DOM_OFFSET, 2, 1, 'parse_dom_status_indicator'], - 'rx_los': [QSFP_DOM_OFFSET, 3, 1, 'parse_dom_tx_rx_los'], - 'tx_fault': [QSFP_DOM_OFFSET, 4, 1, 'parse_dom_tx_fault'], - 'tx_disable': [QSFP_DOM_OFFSET, 86, 1, 'parse_dom_tx_disable'], - 'power_lpmode': [QSFP_DOM_OFFSET, 93, 1, 'parse_dom_power_control'], - 'power_override': [QSFP_DOM_OFFSET, 93, 1, 'parse_dom_power_control'], - 'Temperature': [QSFP_DOM_OFFSET, 22, 2, 'parse_temperature'], - 'Voltage': [QSFP_DOM_OFFSET, 26, 2, 'parse_voltage'], - 'ChannelMonitor': [QSFP_DOM_OFFSET, 34, 16, 'parse_channel_monitor_params'], - 'ChannelMonitor_TxPower': - [QSFP_DOM_OFFSET, 34, 24, 'parse_channel_monitor_params_with_tx_power'], - - 'cable_type': [QSFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'cable_length': [QSFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'connector': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'type': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'encoding': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'ext_identifier': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'ext_rateselect_compliance': - [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'nominal_bit_rate': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'specification_compliance': - [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'type_abbrv_name': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'manufacturer': [QSFP_INFO_OFFSET, 20, 16, 'parse_vendor_name'], - 'vendor_oui': [QSFP_INFO_OFFSET, 37, 3, 'parse_vendor_oui'], - 'model': [QSFP_INFO_OFFSET, 40, 16, 'parse_vendor_pn'], - 'hardware_rev': [QSFP_INFO_OFFSET, 56, 2, 'parse_vendor_rev'], - 'serial': [QSFP_INFO_OFFSET, 68, 16, 'parse_vendor_sn'], - 'vendor_date': [QSFP_INFO_OFFSET, 84, 8, 'parse_vendor_date'], - 'dom_capability': [QSFP_INFO_OFFSET, 92, 1, 'parse_qsfp_dom_capability'], - 'dom_rev': [QSFP_DOM_OFFSET, 1, 1, 'parse_sfp_dom_rev'], - 'ModuleThreshold': [QSFP_DOM_OFFSET1, 128, 24, 'parse_module_threshold_values'], - 'ChannelThreshold': [QSFP_DOM_OFFSET1, 176, 16, 'parse_channel_threshold_values'], -} - -sff8472_parser = { - 'Temperature': [SFP_DOM_OFFSET, 96, 2, 'parse_temperature'], - 'Voltage': [SFP_DOM_OFFSET, 98, 2, 'parse_voltage'], - 'ChannelMonitor': [SFP_DOM_OFFSET, 100, 6, 'parse_channel_monitor_params'], - - 'cable_type': [SFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'cable_length': [SFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'connector': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'type': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'encoding': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'ext_identifier': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'ext_rateselect_compliance': - [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'nominal_bit_rate': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'specification_compliance': - [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'type_abbrv_name': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'manufacturer': [SFP_INFO_OFFSET, 20, 16, 'parse_vendor_name'], - 'vendor_oui': [SFP_INFO_OFFSET, 37, 3, 'parse_vendor_oui'], - 'model': [SFP_INFO_OFFSET, 40, 16, 'parse_vendor_pn'], - 'hardware_rev': [SFP_INFO_OFFSET, 56, 4, 'parse_vendor_rev'], - 'serial': [SFP_INFO_OFFSET, 68, 16, 'parse_vendor_sn'], - 'vendor_date': [SFP_INFO_OFFSET, 84, 8, 'parse_vendor_date'], - 'ModuleThreshold': [SFP_DOM_OFFSET, 0, 56, 'parse_alarm_warning_threshold'], -} - - -class Sfp(SfpBase): +class Sfp(SfpOptoeBase): """ DELLEMC Platform-specific Sfp class """ def __init__(self, index, sfp_type, eeprom_path): - SfpBase.__init__(self) + SfpOptoeBase.__init__(self) self.sfp_type = sfp_type self.index = index self.eeprom_path = eeprom_path - self.qsfpInfo = sff8436InterfaceId() - self.qsfpDomInfo = sff8436Dom() - self.sfpInfo = sff8472InterfaceId() - self.sfpDomInfo = sff8472Dom(None,1) - def get_eeprom_sysfs_path(self): + def get_eeprom_path(self): return self.eeprom_path + def get_name(self): + return "SFP/SFP+/SFP28" + def pci_mem_read(self, mm, offset): mm.seek(offset) read_data_stream = mm.read(4) @@ -199,321 +63,6 @@ def pci_get_value(self, resource, offset): os.close(fd) return val - def _read_eeprom_bytes(self, eeprom_path, offset, num_bytes): - eeprom_raw = [] - print(eeprom_path, num_bytes) - try: - eeprom = open(eeprom_path, mode="rb", buffering=0) - except IOError: - return None - - for i in range(0, num_bytes): - eeprom_raw.append("0x00") - - try: - eeprom.seek(offset) - raw = eeprom.read(num_bytes) - except IOError: - eeprom.close() - return None - - raw = bytearray(raw) - - try: - for n in range(0, num_bytes): - eeprom_raw[n] = hex((raw[n]))[2:].zfill(2) - except BaseException: - eeprom.close() - return None - - eeprom.close() - return eeprom_raw - - def _get_eeprom_data(self, eeprom_key): - eeprom_data = None - page_offset = None - - if(self.sfp_type == 'QSFP'): - page_offset = sff8436_parser[eeprom_key][PAGE_OFFSET] - eeprom_data_raw = self._read_eeprom_bytes( - self.eeprom_path, - (sff8436_parser[eeprom_key][PAGE_OFFSET] + - sff8436_parser[eeprom_key][KEY_OFFSET]), - sff8436_parser[eeprom_key][KEY_WIDTH]) - if (eeprom_data_raw is not None): - # Offset 128 is used to retrieve sff8436InterfaceId Info - # Offset 0 is used to retrieve sff8436Dom Info - if (page_offset == 128): - if ( self.qsfpInfo is None): - return None - eeprom_data = getattr( - self.qsfpInfo, sff8436_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - if ( self.qsfpDomInfo is None): - return None - eeprom_data = getattr( - self.qsfpDomInfo, sff8436_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - page_offset = sff8472_parser[eeprom_key][PAGE_OFFSET] - eeprom_data_raw = self._read_eeprom_bytes( - self.eeprom_path, - (sff8472_parser[eeprom_key][PAGE_OFFSET] + - sff8472_parser[eeprom_key][KEY_OFFSET]), - sff8472_parser[eeprom_key][KEY_WIDTH]) - if (eeprom_data_raw is not None): - # Offset 0 is used to retrieve sff8472InterfaceId Info - # Offset 256 is used to retrieve sff8472Dom Info - if (page_offset == 0): - if ( self.sfpInfo is None): - return None - eeprom_data = getattr( - self.sfpInfo, sff8472_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - if ( self.sfpDomInfo is None): - return None - eeprom_data = getattr( - self.sfpDomInfo, sff8472_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - - return eeprom_data - - def get_transceiver_info(self): - """ - Retrieves transceiver info of this SFP - """ - transceiver_info_dict = {} - compliance_code_dict = {} - transceiver_info_dict = dict.fromkeys(info_dict_keys, 'N/A') - # BaseInformation - try: - iface_data = self._get_eeprom_data('type') - connector = iface_data['data']['Connector']['value'] - encoding = iface_data['data']['EncodingCodes']['value'] - ext_id = iface_data['data']['Extended Identifier']['value'] - rate_identifier = iface_data['data']['RateIdentifier']['value'] - identifier = iface_data['data']['type']['value'] - type_abbrv_name=iface_data['data']['type_abbrv_name']['value'] - if(self.sfp_type == 'QSFP'): - bit_rate = str( - iface_data['data']['Nominal Bit Rate(100Mbs)']['value']) - for key in qsfp_compliance_code_tup: - if key in iface_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = iface_data['data']['Specification compliance']['value'][key]['value'] - for key in qsfp_cable_length_tup: - if key in iface_data['data']: - cable_type = key - cable_length = str(iface_data['data'][key]['value']) - else: - bit_rate = str( - iface_data['data']['NominalSignallingRate(UnitsOf100Mbd)']['value']) - for key in sfp_compliance_code_tup: - if key in iface_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = iface_data['data']['Specification compliance']['value'][key]['value'] - for key in sfp_cable_length_tup: - if key in iface_data['data']: - cable_type = key - cable_length = str(iface_data['data'][key]['value']) - - transceiver_info_dict['type_abbrv_name']=type_abbrv_name - transceiver_info_dict['type'] = identifier - transceiver_info_dict['connector'] = connector - transceiver_info_dict['encoding'] = encoding - transceiver_info_dict['ext_identifier'] = ext_id - transceiver_info_dict['ext_rateselect_compliance'] = rate_identifier - transceiver_info_dict['cable_type'] = cable_type - transceiver_info_dict['cable_length'] = cable_length - transceiver_info_dict['nominal_bit_rate'] = bit_rate - transceiver_info_dict['specification_compliance'] = str(compliance_code_dict) - except (ValueError, TypeError) : pass - - # Vendor Date - try: - vendor_date_data = self._get_eeprom_data('vendor_date') - vendor_date = vendor_date_data['data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] - transceiver_info_dict['vendor_date'] = vendor_date - except (ValueError, TypeError) : pass - - # Vendor Name - try: - vendor_name_data = self._get_eeprom_data('manufacturer') - vendor_name = vendor_name_data['data']['Vendor Name']['value'] - transceiver_info_dict['manufacturer'] = vendor_name - except (ValueError, TypeError) : pass - - # Vendor OUI - try: - vendor_oui_data = self._get_eeprom_data('vendor_oui') - vendor_oui = vendor_oui_data['data']['Vendor OUI']['value'] - transceiver_info_dict['vendor_oui'] = vendor_oui - except (ValueError, TypeError) : pass - - # Vendor PN - try: - vendor_pn_data = self._get_eeprom_data('model') - vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['model'] = vendor_pn - except (ValueError, TypeError) : pass - - # Vendor Revision - try: - vendor_rev_data = self._get_eeprom_data('hardware_rev') - vendor_rev = vendor_rev_data['data']['Vendor Rev']['value'] - transceiver_info_dict['hardware_rev'] = vendor_rev - except (ValueError, TypeError) : pass - - # Vendor Serial Number - try: - vendor_sn_data = self._get_eeprom_data('serial') - vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] - transceiver_info_dict['serial'] = vendor_sn - except (ValueError, TypeError) : pass - - return transceiver_info_dict - - def get_transceiver_threshold_info(self): - """ - Retrieves transceiver threshold info of this SFP - """ - transceiver_dom_threshold_dict = {} - transceiver_dom_threshold_dict = dict.fromkeys( - threshold_dict_keys, 'N/A') - - try: - # Module Threshold - module_threshold_data = self._get_eeprom_data('ModuleThreshold') - if (self.sfp_type == 'QSFP'): - transceiver_dom_threshold_dict['temphighalarm'] = module_threshold_data['data']['TempHighAlarm']['value'] - transceiver_dom_threshold_dict['temphighwarning'] = module_threshold_data['data']['TempHighWarning']['value'] - transceiver_dom_threshold_dict['templowalarm'] = module_threshold_data['data']['TempLowAlarm']['value'] - transceiver_dom_threshold_dict['templowwarning'] = module_threshold_data['data']['TempLowWarning']['value'] - transceiver_dom_threshold_dict['vcchighalarm'] = module_threshold_data['data']['VccHighAlarm']['value'] - transceiver_dom_threshold_dict['vcchighwarning'] = module_threshold_data['data']['VccHighWarning']['value'] - transceiver_dom_threshold_dict['vcclowalarm'] = module_threshold_data['data']['VccLowAlarm']['value'] - transceiver_dom_threshold_dict['vcclowwarning'] = module_threshold_data['data']['VccLowWarning']['value'] - else: #SFP - transceiver_dom_threshold_dict['temphighalarm'] = module_threshold_data['data']['TempHighAlarm']['value'] - transceiver_dom_threshold_dict['templowalarm'] = module_threshold_data['data']['TempLowAlarm']['value'] - transceiver_dom_threshold_dict['temphighwarning'] = module_threshold_data['data']['TempHighWarning']['value'] - transceiver_dom_threshold_dict['templowwarning'] = module_threshold_data['data']['TempLowWarning']['value'] - transceiver_dom_threshold_dict['vcchighalarm'] = module_threshold_data['data']['VoltageHighAlarm']['value'] - transceiver_dom_threshold_dict['vcclowalarm'] = module_threshold_data['data']['VoltageLowAlarm']['value'] - transceiver_dom_threshold_dict['vcchighwarning'] = module_threshold_data['data']['VoltageHighWarning']['value'] - transceiver_dom_threshold_dict['vcclowwarning'] = module_threshold_data['data']['VoltageLowWarning']['value'] - transceiver_dom_threshold_dict['txbiashighalarm'] = module_threshold_data['data']['BiasHighAlarm']['value'] - transceiver_dom_threshold_dict['txbiaslowalarm'] = module_threshold_data['data']['BiasLowAlarm']['value'] - transceiver_dom_threshold_dict['txbiashighwarning'] = module_threshold_data['data']['BiasHighWarning']['value'] - transceiver_dom_threshold_dict['txbiaslowwarning'] = module_threshold_data['data']['BiasLowWarning']['value'] - transceiver_dom_threshold_dict['txpowerhighalarm'] = module_threshold_data['data']['TXPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['txpowerlowalarm'] = module_threshold_data['data']['TXPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['txpowerhighwarning'] = module_threshold_data['data']['TXPowerHighWarning']['value'] - transceiver_dom_threshold_dict['txpowerlowwarning'] = module_threshold_data['data']['TXPowerLowWarning']['value'] - transceiver_dom_threshold_dict['rxpowerhighalarm'] = module_threshold_data['data']['RXPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerlowalarm'] = module_threshold_data['data']['RXPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerhighwarning'] = module_threshold_data['data']['RXPowerHighWarning']['value'] - transceiver_dom_threshold_dict['rxpowerlowwarning'] = module_threshold_data['data']['RXPowerLowWarning']['value'] - except (ValueError, TypeError) : pass - - try: - if (self.sfp_type == 'QSFP'): - channel_threshold_data = self._get_eeprom_data('ChannelThreshold') - transceiver_dom_threshold_dict['rxpowerhighalarm'] = channel_threshold_data['data']['RxPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerhighwarning'] = channel_threshold_data['data']['RxPowerHighWarning']['value'] - transceiver_dom_threshold_dict['rxpowerlowalarm'] = channel_threshold_data['data']['RxPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerlowwarning'] = channel_threshold_data['data']['RxPowerLowWarning']['value'] - transceiver_dom_threshold_dict['txbiashighalarm'] = channel_threshold_data['data']['TxBiasHighAlarm']['value'] - transceiver_dom_threshold_dict['txbiashighwarning'] = channel_threshold_data['data']['TxBiasHighWarning']['value'] - transceiver_dom_threshold_dict['txbiaslowalarm'] = channel_threshold_data['data']['TxBiasLowAlarm']['value'] - transceiver_dom_threshold_dict['txbiaslowwarning'] = channel_threshold_data['data']['TxBiasLowWarning']['value'] - - except (ValueError, TypeError) : pass - return transceiver_dom_threshold_dict - - def get_transceiver_bulk_status(self): - """ - Retrieves transceiver bulk status of this SFP - """ - tx_bias_list = [] - rx_power_list = [] - transceiver_dom_dict = {} - transceiver_dom_dict = dict.fromkeys(dom_dict_keys, 'N/A') - - # RxLos - rx_los = self.get_rx_los() - - # TxFault - tx_fault = self.get_tx_fault() - - # ResetStatus - reset_state = self.get_reset_status() - - # LowPower Mode - lp_mode = self.get_lpmode() - - # TxDisable - tx_disable = self.get_tx_disable() - - # TxDisable Channel - tx_disable_channel = self.get_tx_disable_channel() - - # Temperature - temperature = self.get_temperature() - - # Voltage - voltage = self.get_voltage() - - # Channel Monitor - tx_power_list = self.get_tx_power() - - # tx bias - tx_bias_list = self.get_tx_bias() - - # rx power - rx_power_list = self.get_rx_power() - - if tx_bias_list is not None: - transceiver_dom_dict['tx1bias'] = tx_bias_list[0] - transceiver_dom_dict['tx2bias'] = tx_bias_list[1] - transceiver_dom_dict['tx3bias'] = tx_bias_list[2] - transceiver_dom_dict['tx4bias'] = tx_bias_list[3] - - if rx_power_list is not None: - transceiver_dom_dict['rx1power'] = rx_power_list[0] - transceiver_dom_dict['rx2power'] = rx_power_list[1] - transceiver_dom_dict['rx3power'] = rx_power_list[2] - transceiver_dom_dict['rx4power'] = rx_power_list[3] - - if tx_power_list is not None: - transceiver_dom_dict['tx1power'] = tx_power_list[0] - transceiver_dom_dict['tx2power'] = tx_power_list[1] - transceiver_dom_dict['tx3power'] = tx_power_list[2] - transceiver_dom_dict['tx4power'] = tx_power_list[3] - - transceiver_dom_dict['rx_los'] = rx_los - transceiver_dom_dict['tx_fault'] = tx_fault - transceiver_dom_dict['reset_status'] = reset_state - transceiver_dom_dict['power_lpmode'] = lp_mode - transceiver_dom_dict['tx_disable'] = tx_disable - transceiver_dom_dict['tx_disable_channel'] = tx_disable_channel - transceiver_dom_dict['temperature'] = temperature - transceiver_dom_dict['voltage'] = voltage - - return transceiver_dom_dict - - def get_name(self): - """ - Retrieves the name of the sfp - Returns : QSFP or QSFP+ or QSFP28 - """ - try: - iface_data = self._get_eeprom_data('type') - identifier = iface_data['data']['type']['value'] - except (TypeError, ValueError): - return 'N/A' - return identifier - def _get_cpld_register(self, reg): reg_file = '/sys/devices/platform/dell-n3248pxe-cpld.0/' + reg try: @@ -538,31 +87,6 @@ def get_presence(self): pass return presence - - def get_model(self): - """ - Retrieves the model number (or part number) of the sfp - """ - try: - vendor_pn_data = self._get_eeprom_data('model') - vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] - except (TypeError, ValueError): - return 'N/A' - - return vendor_pn - - def get_serial(self): - """ - Retrieves the serial number of the sfp - """ - try: - vendor_sn_data = self._get_eeprom_data('serial') - vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] - except (TypeError, ValueError): - return 'N/A' - - return vendor_sn - def get_reset_status(self): """ Retrives the reset status of SFP @@ -753,24 +277,6 @@ def set_lpmode(self, lpmode): """ return True - def tx_disable(self, tx_disable): - """ - Disable SFP TX for all channels - """ - return False - - def tx_disable_channel(self, channel, disable): - """ - Sets the tx_disable for specified SFP channels - """ - return False - - def set_power_override(self, power_override, power_set): - """ - Sets SFP power level using power_override and power_set - """ - return False - def get_status(self): """ Retrieves the operational status of the device diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/watchdog.py index 876aa4beda51..00277c2872f6 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/watchdog.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/watchdog.py @@ -11,7 +11,6 @@ try: import ctypes - import subprocess from sonic_platform_base.watchdog_base import WatchdogBase except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -29,43 +28,53 @@ class Watchdog(WatchdogBase): Abstract base class for interfacing with a hardware watchdog module """ - TIMERS = [15,20,30,40,50,60,65,70] + TIMERS = [15,20,30,40,50,60,65,70,80,100,120,140,160,180,210,240] armed_time = 0 timeout = 0 CLOCK_MONOTONIC = 1 def __init__(self): + WatchdogBase.__init__(self) self._librt = ctypes.CDLL('librt.so.1', use_errno=True) self._clock_gettime = self._librt.clock_gettime self._clock_gettime.argtypes=[ctypes.c_int, ctypes.POINTER(_timespec)] + self.watchdog_reg = "watchdog" - def _get_command_result(self, cmdline): + def _get_cpld_register(self, reg_name): + # On successful read, returns the value read from given + # reg name and on failure rethrns 'ERR' + cpld_dir = "/sys/devices/platform/dell-n3248pxe-cpld.0/" + cpld_reg_file = cpld_dir + '/' + reg_name try: - proc = subprocess.Popen(cmdline.split(), stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) - stdout = proc.communicate()[0] - proc.wait() - result = stdout.rstrip('\n') - except OSError: - result = None + with open(cpld_reg_file, 'r') as fd: + rv = fd.read() + except IOError : return 'ERR' + return rv.strip('\r\n').lstrip(' ') - return result + def _set_cpld_register(self, reg_name, value): + # On successful write, returns the value will be written on + # reg_name and on failure returns 'ERR' + + cpld_dir = "/sys/devices/platform/dell-n3248pxe-cpld.0/" + cpld_reg_file = cpld_dir + '/' + reg_name + + try: + with open(cpld_reg_file, 'w') as fd: + rv = fd.write(str(value)) + except Exception: + rv = 'ERR' + + return rv def _get_reg_val(self): - # 0x31 = CPLD I2C Base Address - # 0x07 = Watchdog Function Register - value = self._get_command_result("/usr/sbin/i2cget -y 601 0x31 0x07") - if not value: - return None - else: - return int(value, 16) + value = self._get_cpld_register(self.watchdog_reg).strip() + if value == 'ERR': return False + + return int(value,16) def _set_reg_val(self,val): - # 0x31 = CPLD I2C Base Address - # 0x07 = Watchdog Function Register - value = self._get_command_result("/usr/sbin/i2cset -y 601 0x31 0x07 %s" - % (val)) + value = self._set_cpld_register(self.watchdog_reg, val) return value def _get_time(self): @@ -93,7 +102,7 @@ def arm(self, seconds): """ timer_offset = -1 for key,timer_seconds in enumerate(self.TIMERS): - if seconds <= timer_seconds: + if seconds > 0 and seconds <= timer_seconds: timer_offset = key seconds = timer_seconds break @@ -101,40 +110,29 @@ def arm(self, seconds): if timer_offset == -1: return -1 - # Extracting 5th to 7th bits for WD timer values - # 000 - 15 sec - # 001 - 20 sec - # 010 - 30 sec - # 011 - 40 sec - # 100 - 50 sec - # 101 - 60 sec - # 110 - 65 sec - # 111 - 70 sec + # Extracting 5th to 8th bits for WD timer values reg_val = self._get_reg_val() - wd_timer_offset = (reg_val >> 4) & 0x7 + wd_timer_offset = (reg_val >> 4) & 0xF if wd_timer_offset != timer_offset: - # Setting 5th to 7th bits + # Setting 5th to 8th bits # value from timer_offset self.disarm() - self._set_reg_val(reg_val | (timer_offset << 4)) + self._set_reg_val((reg_val & 0x0F) | (timer_offset << 4)) if self.is_armed(): # Setting last bit to WD Timer punch # Last bit = WD Timer punch self._set_reg_val(reg_val & 0xFE) - self.armed_time = self._get_time() - self.timeout = seconds else: # Setting 4th bit to enable WD # 4th bit = Enable WD reg_val = self._get_reg_val() self._set_reg_val(reg_val | 0x8) - self.armed_time = self._get_time() - self.timeout = seconds - + self.armed_time = self._get_time() + self.timeout = seconds return seconds def disarm(self): @@ -207,4 +205,3 @@ def get_remaining_time(self): return self.timeout - diff_time return 0 - diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248te/modules/dell_n3248te_platform.c b/platform/broadcom/sonic-platform-modules-dell/n3248te/modules/dell_n3248te_platform.c index aa6a6672b552..92ee30af312f 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248te/modules/dell_n3248te_platform.c +++ b/platform/broadcom/sonic-platform-modules-dell/n3248te/modules/dell_n3248te_platform.c @@ -572,7 +572,7 @@ static ssize_t system_led_show(struct device *dev, struct device_attribute *deva if (ret < 0) return sprintf(buf, "read error"); - data = (u8)(ret & 0x30) >> 5; + data = (u8)(ret & 0x30) >> 4; switch (data) { @@ -878,6 +878,42 @@ static ssize_t fan_led_store(struct device *dev, struct device_attribute *devatt return count; } +static ssize_t watchdog_show(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + s32 ret; + u8 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + ret = i2c_smbus_read_byte_data(pdata[cpu_cpld].client, 0x7); + if (ret < 0) + return sprintf(buf, "read error"); + data = ret; + + return sprintf(buf, "%x\n", data); +} + +static ssize_t watchdog_store(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + s32 ret, err; + unsigned long val; + u8 data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 10, &val); + if (err) + return err; + + data = (u8) val; + if (data) + { + ret = i2c_smbus_write_byte_data(pdata[cpu_cpld].client, 0x7, data); + if (ret < 0) + return ret; + } + + return count; +} static ssize_t power_good_show(struct device *dev, struct device_attribute *devattr, char *buf) @@ -974,6 +1010,7 @@ static DEVICE_ATTR_RO(psu1_prs); static DEVICE_ATTR_RO(psu0_status); static DEVICE_ATTR_RO(psu1_status); static DEVICE_ATTR_RW(system_led); +static DEVICE_ATTR_RW(watchdog); static DEVICE_ATTR_RW(locator_led); static DEVICE_ATTR_RW(power_led); static DEVICE_ATTR_RW(master_led); @@ -1017,6 +1054,7 @@ static struct attribute *n3248te_cpld_attrs[] = { &dev_attr_psu0_status.attr, &dev_attr_psu1_status.attr, &dev_attr_system_led.attr, + &dev_attr_watchdog.attr, &dev_attr_locator_led.attr, &dev_attr_power_led.attr, &dev_attr_master_led.attr, @@ -1081,7 +1119,7 @@ static int __init cpld_probe(struct platform_device *pdev) return -ENODEV; } for (i = 0; i < CPLD_DEVICE_NUM; i++) { - pdata[i].client = i2c_new_dummy(parent, pdata[i].reg_addr); + pdata[i].client = i2c_new_dummy_device(parent, pdata[i].reg_addr); if (!pdata[i].client) { printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[i].reg_addr); goto error; @@ -1164,7 +1202,7 @@ static int __init dell_n3248te_platform_init(void) } sys_i2c_adap = i2c_get_adapter(sys_i2c_bus); - mux_i2c_cli = i2c_new_device(sys_i2c_adap, sys_board_mux); + mux_i2c_cli = i2c_new_client_device(sys_i2c_adap, sys_board_mux); if (!mux_i2c_cli) return PTR_ERR_OR_ZERO(mux_i2c_cli); diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248te/scripts/n3248te_platform.sh b/platform/broadcom/sonic-platform-modules-dell/n3248te/scripts/n3248te_platform.sh index e4c0734b1fd9..14c233f6a5af 100755 --- a/platform/broadcom/sonic-platform-modules-dell/n3248te/scripts/n3248te_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/n3248te/scripts/n3248te_platform.sh @@ -114,7 +114,7 @@ get_reboot_cause() { if [[ "$1" == "init" ]]; then modprobe i2c-dev - modprobe i2c-mux-pca954x force_deselect_on_exit=1 + modprobe i2c-mux-pca954x modprobe pmbus modprobe emc2305 modprobe dps200 @@ -126,12 +126,12 @@ if [[ "$1" == "init" ]]; then echo 0xf0 > /sys/devices/platform/dell-n3248te-cpld.0/sfp_txdis install_python_api_package platform_firmware_versions + echo -2 > /sys/class/i2c-adapter/i2c-0/0-0071/idle_state elif [[ "$1" == "deinit" ]]; then switch_board_sfp "delete_device" sysdevices "delete_device" modprobe -r dell_n3248te_platform - modprobe -r dps200 modprobe -r emc2305 modprobe -r pmbus diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/chassis.py index 9686892f6f2a..ddc254881ca3 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/chassis.py @@ -19,7 +19,6 @@ from sonic_platform.psu import Psu from sonic_platform.thermal import Thermal from sonic_platform.watchdog import Watchdog - from sonic_platform.fan import Fan from sonic_platform.fan_drawer import FanDrawer except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -62,6 +61,12 @@ class Chassis(ChassisBase): 53: 24, 54: 25, } + SYSTEM_LED_COLORS = { + "green", + "blink_green", + "yellow", + "blink_yellow" + } def __init__(self): ChassisBase.__init__(self) @@ -89,8 +94,6 @@ def __init__(self): self._watchdog = Watchdog() self._num_sfps = 54 self._num_fans = MAX_N3248TE_FANTRAY * MAX_N3248TE_FAN - self._fan_list = [Fan(i, j) for i in range(MAX_N3248TE_FANTRAY) \ - for j in range(MAX_N3248TE_FAN)] for k in range(MAX_N3248TE_FANTRAY): fandrawer = FanDrawer(k) self._fan_drawer_list.append(fandrawer) @@ -105,6 +108,7 @@ def __init__(self): self._global_port_pres_dict[port_num] = '1' if presence else '0' self._watchdog = Watchdog() + self.status_led_reg = "system_led" self.locator_led_reg = "locator_led" self.LOCATOR_LED_ON = "blink_blue" self.LOCATOR_LED_OFF = self.STATUS_LED_COLOR_OFF @@ -114,7 +118,8 @@ def _get_cpld_register(self, reg_name): # reg name and on failure rethrns 'ERR' cpld_reg_file = self.CPLD_DIR + '/' + reg_name try: - rv = open(cpld_reg_file, 'r').read() + with open(cpld_reg_file, 'r') as fd: + rv = fd.read() except IOError : return 'ERR' return rv.strip('\r\n').lstrip(' ') @@ -125,7 +130,6 @@ def _set_cpld_register(self, reg_name, value): cpld_reg_file = self.CPLD_DIR + '/' + reg_name if (not os.path.isfile(cpld_reg_file)): - #print "open error" return rv try: @@ -136,6 +140,40 @@ def _set_cpld_register(self, reg_name, value): return rv + def get_status_led(self): + """ + Gets the current system LED color + + Returns: + A string that represents the supported color + """ + + color = self._get_cpld_register(self.status_led_reg) + + if color not in list(self.SYSTEM_LED_COLORS): + return self.sys_ledcolor + + return color + + def initizalize_system_led(self): + self.sys_ledcolor = "green" + + def set_status_led(self,color): + """ + Set system LED status based on the color type passed in the argument. + Argument: Color to be set + Returns: + bool: True is specified color is set, Otherwise return False + """ + + if color not in list(self.SYSTEM_LED_COLORS): + return False + if(not self._set_cpld_register(self.status_led_reg, color)): + return False + + self.sys_ledcolor = color + return True + # check for this event change for sfp / do we need to handle timeout/sleep def get_change_event(self, timeout=0): @@ -193,7 +231,7 @@ def get_name(self): Returns: string: The name of the chassis """ - return self._eeprom.modelstr().decode() + return self._eeprom.modelstr() def get_presence(self): """ @@ -348,3 +386,28 @@ def get_locator_led(self): return self.LOCATOR_LED_OFF else: return self.LOCATOR_LED_OFF + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + Returns: + integer: The 1-based relative physical position in parent + device or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether Chassis is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False + def get_revision(self): + """ + Retrives the hardware revision of the device + + Returns: + string: Revision value of device + """ + return self._eeprom.revision_str() diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/component.py index ec0dba2ab5b9..ccf90f881b0b 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/component.py @@ -80,3 +80,52 @@ def install_firmware(self, image_path): A boolean, True if install was successful, False if not """ return False + + def get_presence(self): + """ + Retrieves the presence of the component + Returns: + bool: True if present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the part number of the component + Returns: + string: Part number of component + """ + return 'NA' + + def get_serial(self): + """ + Retrieves the serial number of the component + Returns: + string: Serial number of component + """ + return 'NA' + + def get_status(self): + """ + Retrieves the operational status of the component + Returns: + bool: True if component is operating properly, False if not + """ + return True + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + Returns: + integer: The 1-based relative physical position in parent + device or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether component is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/eeprom.py b/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/eeprom.py index 75584cbc80b0..1c1c5c6df07a 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/eeprom.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/eeprom.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# -# DellEmc Z9332F +# DellEmc N3248TE # # Platform and model specific eeprom subclass, inherits from the base class, # and provides the followings: @@ -11,7 +11,6 @@ try: import os.path from sonic_eeprom import eeprom_tlvinfo - import binascii except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -75,9 +74,9 @@ def base_mac_addr(self, e): (is_valid, t) = self.get_tlv_field( self.eeprom_data, self._TLV_CODE_MAC_BASE) if not is_valid or t[1] != 6: - return super(eeprom_tlvinfo.TlvInfoDecoder, self).switchaddrstr(t) + return super(TlvInfoDecoder, self).switchaddrstr(e) - return ":".join([binascii.b2a_hex(T) for T in t[2]]) + return ":".join(["{:02x}".format(T) for T in t[2]]).upper() def modelstr(self): """ @@ -88,7 +87,7 @@ def modelstr(self): if not is_valid: return "N/A" - return results[2] + return results[2].decode('ascii') def part_number_str(self): """ @@ -99,7 +98,7 @@ def part_number_str(self): if not is_valid: return "N/A" - return results[2] + return results[2].decode('ascii') def serial_str(self): """ @@ -110,7 +109,7 @@ def serial_str(self): if not is_valid: return "N/A" - return results[2] + return results[2].decode('ascii') def revision_str(self): """ @@ -121,7 +120,7 @@ def revision_str(self): if not is_valid: return "N/A" - return results[2] + return results[2].decode('ascii') def system_eeprom_info(self): """ @@ -130,5 +129,3 @@ def system_eeprom_info(self): found in the system EEPROM. """ return self.eeprom_tlv_dict - - diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/fan.py index 873ae4163a84..e82dc91cc686 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/fan.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ######################################################################## -# DellEMC Z9332F +# DellEMC N3248TE # # Module contains an implementation of SONiC Platform Base API and # provides the Fans' information which are available in the platform. @@ -26,15 +26,19 @@ def __init__(self, fantray_index=0, fan_index=0, psu_fan=False, dependency=None) self.presence_reg = "fan{}_prs".format(fantray_index) self.dir_reg = "fan{}_dir".format(fantray_index) self.rpm_file = "/sys/bus/i2c/devices/7-002c/fan{}_input".format(fantray_index+1) + self.status_file = "/sys/bus/i2c/devices/7-002c/fan{}_fault".format(fantray_index+1) self.eeprom = "/sys/bus/i2c/devices/{}-0050/eeprom".format(15 + fantray_index) self.fantray_index = fantray_index + self.fan_index = fan_index else: - self.presence_reg = "psu{}_prs".format(fantray_index) - self.psu_index = fantray_index + self.psu_index = fan_index - 1 self.dependancy = dependency + self.presence_reg = "psu{}_prs".format(self.psu_index) + self.status_reg = "psu{}_status".format(self.psu_index) self.dir_reg = "" - self.dps_hwmon = "/sys/bus/i2c/devices/{}-005e/hwmon/".format(fantray_index+10) - self.eeprom = "/sys/bus/i2c/devices/{}-0056/eeprom".format(10 + fantray_index) + self.dps_hwmon = "/sys/bus/i2c/devices/{}-005e/hwmon/".format(self.psu_index + 10) + self.eeprom = "/sys/bus/i2c/devices/{}-0056/eeprom".format(self.psu_index + 10) + self.fan_index = fan_index self.max_speed = 0 def _get_cpld_register(self, reg_name): @@ -43,7 +47,8 @@ def _get_cpld_register(self, reg_name): cpld_dir = "/sys/devices/platform/dell-n3248te-cpld.0/" cpld_reg_file = cpld_dir + '/' + reg_name try: - buf = open(cpld_reg_file, 'r').read() + with open(cpld_reg_file, 'r')as fd: + buf = fd.read() except (IOError, AttributeError): return 'ERR' return buf.strip('\r\n').lstrip(' ') @@ -55,9 +60,9 @@ def get_name(self): String: The name of the device """ if self.is_psu_fan: - return "PSU{} Fan".format(self.psu_index) + return "PSU{} Fan".format(self.psu_index+1) else: - return "Fan{}".format(self.fantray_index+1) + return "FanTray{}-Fan{}".format(self.fantray_index+1, self.fan_index+1) def get_model(self): """ @@ -95,6 +100,8 @@ def get_presence(self): return False if int(presence,0) == 1: return True + else: + return False def get_status(self): """ @@ -102,7 +109,20 @@ def get_status(self): Returns: bool: True if FAN is operating properly, False if not """ - return True + if not self.is_psu_fan: + status = open(self.status_file, "rb").read() + if int(status, 0) == 1: + return False + else: + return True + else: + status = self._get_cpld_register(self.status_reg) + if status == 'ERR': + return False + if int(status, 0) == 1: + return True + else: + return False def get_direction(self): """ @@ -118,7 +138,7 @@ def get_direction(self): """ if not self.is_psu_fan: val = self._get_cpld_register(self.dir_reg) - direction = 'Exhaust' if val == 'F2B' else 'Intake' + direction = 'exhaust' if val == 'F2B' else 'intake' if direction == 'ERR': return None else: @@ -126,7 +146,7 @@ def get_direction(self): val = open(self.eeprom, "rb").read()[0xe1:0xe8] except Exception: return None - direction = 'Exhaust' if val == 'FORWARD' else 'Intake' + direction = 'exhaust' if val == 'FORWARD' else 'intake' return direction def get_speed(self): @@ -167,3 +187,68 @@ def get_speed_rpm(self): except Exception: return None return fan_speed + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + Returns: + integer: The 1-based relative physical position in parent + device or -1 if cannot determine the position + """ + return self.fan_index + + def is_replaceable(self): + """ + Indicate whether Fan is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False + + def get_speed_tolerance(self): + """ + Retrieves the speed tolerance of the fan + Returns: + An integer, the percentage of variance from target speed which is + considered tolerable + """ + if self.get_presence(): + # The tolerance value is fixed as 20% for all the DellEMC platforms + tolerance = 20 + else: + tolerance = 0 + + return tolerance + + def set_status_led(self, color): + """ + Set led to expected color + Args: + color: A string representing the color with which to set the + fan status LED + Returns: + bool: True if set success, False if fail. + """ + # N3248TE has led only on FanTray and not available for seperate fans + return True + + def get_status_led(self): + """ + Gets the current system LED color + + Returns: + A string that represents the supported color + """ + + return None + + def get_target_speed(self): + """ + Retrieves the target (expected) speed of the fan + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + """ + # Return current speed to avoid false thermalctld alarm. + return self.get_speed() + diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/fan_drawer.py index 5142827554db..1812f427cc33 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/fan_drawer.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/fan_drawer.py @@ -14,20 +14,51 @@ except ImportError as e: raise ImportError(str(e) + "- required module not found") -N3248TE_FANS_PER_FANTRAY = 2 +N3248TE_FANS_PER_FANTRAY = 1 class FanDrawer(FanDrawerBase): """DellEMC Platform-specific Fan class""" + FANTRAY_LED_COLORS = { + "off", + "green", + "yellow" + } + def __init__(self, fantray_index): FanDrawerBase.__init__(self) # FanTray is 1-based in DellEMC platforms + self.fantray_led_reg = "fan{}_led".format(fantray_index) self.fantrayindex = fantray_index + 1 for i in range(N3248TE_FANS_PER_FANTRAY): self._fan_list.append(Fan(fantray_index, i)) + def _get_cpld_register(self, reg_name): + # On successful read, returns the value read from given + # reg name and on failure rethrns 'ERR' + cpld_dir = "/sys/devices/platform/dell-n3248te-cpld.0/" + cpld_reg_file = cpld_dir + '/' + reg_name + try: + rv = open(cpld_reg_file, 'r').read() + except IOError : return 'ERR' + return rv.strip('\r\n').lstrip(' ') + + def _set_cpld_register(self, reg_name, value): + # On successful write, returns the value will be written on + # reg_name and on failure returns 'ERR' + cpld_dir = "/sys/devices/platform/dell-n3248te-cpld.0/" + cpld_reg_file = cpld_dir + '/' + reg_name + + try: + with open(cpld_reg_file, 'w') as fd: + rv = fd.write(str(value)) + except Exception: + rv = 'ERR' + + return rv + def get_name(self): """ Retrieves the fan drawer name @@ -35,3 +66,93 @@ def get_name(self): string: The name of the device """ return "FanTray{}".format(self.fantrayindex) + + def get_status_led(self): + """ + Gets the current system LED color + + Returns: + A string that represents the supported color + """ + + color = self._get_cpld_register(self.fantray_led_reg) + + #if color not in list(self.FANTRAY_LED_COLORS): + # return self.sys_ledcolor + + return color + + def set_status_led(self,color): + """ + Set system LED status based on the color type passed in the argument. + Argument: Color to be set + Returns: + bool: True is specified color is set, Otherwise return False + """ + + if color not in list(self.FANTRAY_LED_COLORS): + return False + + if(not self._set_cpld_register(self.fantray_led_reg, color)): + return False + + return True + + def get_presence(self): + """ + Retrives the presence of the fan drawer + Returns: + bool: True if fan_tray is present, False if not + """ + return self.get_fan(0).get_presence() + + def get_model(self): + """ + Retrieves the part number of the fan drawer + Returns: + string: Part number of fan drawer + """ + return "NA" + + def get_serial(self): + """ + Retrieves the serial number of the fan drawer + Returns: + string: Serial number of the fan drawer + """ + return "NA" + + def get_status(self): + """ + Retrieves the operational status of the fan drawer + Returns: + bool: True if fan drawer is operating properly, False if not + """ + return True + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + Returns: + integer: The 1-based relative physical position in parent + device or -1 if cannot determine the position + """ + return self.fantrayindex + + def is_replaceable(self): + """ + Indicate whether this fan drawer is replaceable. + Returns: + bool: True if it is replaceable, False if not + """ + return True + + def get_maximum_consumed_power(self): + """ + Retrives the maximum power drawn by Fan Drawer + + Returns: + A float, with value of the maximum consumable power of the + component. + """ + return 0.0 diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/psu.py index 30d4f2bd6c2a..b2f06785f0dc 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/psu.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ######################################################################## -# DellEMC Z9332F +# DellEMC N3248TE # # Module contains an implementation of SONiC Platform Base API and # provides the PSUs' information which are available in the platform @@ -38,7 +38,8 @@ def _get_cpld_register(self, reg_name): cpld_dir = "/sys/devices/platform/dell-n3248te-cpld.0/" cpld_reg_file = cpld_dir + '/' + reg_name try: - rv = open(cpld_reg_file, 'r').read() + with open(cpld_reg_file, 'r') as fd: + rv = fd.read() except IOError : return 'ERR' return rv.strip('\r\n').lstrip(' ') @@ -46,7 +47,8 @@ def _get_dps_register(self, reg_name): try : dps_dir = self.dps_hwmon + '/' + os.listdir(self.dps_hwmon)[0] dps_reg_file = dps_dir + '/' + reg_name - rv = open(dps_reg_file, 'r').read() + with open(dps_reg_file, 'r') as fd: + rv = fd.read() except (IOError, OSError) : return 'ERR' return rv @@ -91,7 +93,9 @@ def get_presence(self): self.dps_hwmon_exist = os.path.exists(self.dps_hwmon) if not self.dps_hwmon_exist: self._reload_dps_module() - return int(presence, 0) + if int(presence, 0) == 1: + return True + return False def get_model(self): """ @@ -103,7 +107,7 @@ def get_model(self): try: val = open(self.eeprom, "rb").read()[0x50:0x62] except Exception: val = None - return val.decode() + return val.decode('ascii') def get_serial(self): """ @@ -115,7 +119,22 @@ def get_serial(self): try: val = open(self.eeprom, "rb").read()[0xc4:0xd9] except Exception: val = None - return val.decode() + return val.decode('ascii') + + def get_revision(self): + """ + Retrieves the serial number of the PSU + + Returns: + string: Serial number of PSU + """ + try: val = open(self.eeprom, "rb").read()[0xc4:0xd9] + except Exception: + val = None + if val != "NA" and len(val) == 23: + return val[-3:] + else: + return "NA" def get_status(self): """ @@ -126,7 +145,9 @@ def get_status(self): """ status = self._get_cpld_register(self.psu_status).strip() if status == 'ERR' : return False - return int(status, 0) + if int(status, 0) == 1: + return True + return False def get_voltage(self): """ @@ -141,7 +162,7 @@ def get_voltage(self): voltage = int(volt_reading)/1000 except Exception: return None - return "{:.1f}".format(voltage) + return float(voltage) def get_current(self): """ @@ -156,7 +177,7 @@ def get_current(self): current = int(curr_reading)/1000 except Exception: return None - return "{:.1f}".format(current) + return float(current) def get_power(self): """ @@ -168,10 +189,10 @@ def get_power(self): """ power_reading = self._get_dps_register(self.psu_power_reg) try: - power = int(power_reading)/1000 + power = int(power_reading)/(1000*1000) except Exception: return None - return "{:.1f}".format(power) + return float(power) def get_powergood_status(self): """ @@ -204,4 +225,21 @@ def get_type(self): try: val = open(self.eeprom, "rb").read()[0xe8:0xea] except Exception: return None - return val + return val.decode() + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + Returns: + integer: The 1-based relative physical position in parent + device or -1 if cannot determine the position + """ + return self.index + + def is_replaceable(self): + """ + Indicate whether this PSU is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True + diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/sfp.py index be10fd7d35b0..3a6b0a4cd4cc 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/sfp.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# -# DELLEMC S5248F +# DELLEMC N3248TE # # Module contains an implementation of SONiC Platform Base API and # provides the platform information @@ -12,164 +12,47 @@ import os import struct import mmap - from sonic_platform_base.sfp_base import SfpBase - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom - from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId - from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase except ImportError as e: raise ImportError(str(e) + "- required module not found") -PAGE_OFFSET = 0 -KEY_OFFSET = 1 -KEY_WIDTH = 2 -FUNC_NAME = 3 - -QSFP_INFO_OFFSET = 128 -QSFP_DOM_OFFSET = 0 -QSFP_DOM_OFFSET1 = 384 - SFP_PORT_START = 49 SFP_PORT_END = 54 +QSFP_INFO_OFFSET = 128 SFP_INFO_OFFSET = 0 -SFP_DOM_OFFSET = 256 - -SFP_STATUS_CONTROL_OFFSET = 110 -SFP_STATUS_CONTROL_WIDTH = 7 -SFP_TX_DISABLE_HARD_BIT = 7 -SFP_TX_DISABLE_SOFT_BIT = 6 - -qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)', 'Length OM2(m)', - 'Length OM1(m)', 'Length Cable Assembly(m)') - -qsfp_compliance_code_tup = ( - '10/40G Ethernet Compliance Code', - 'SONET Compliance codes', - 'SAS/SATA compliance codes', - 'Gigabit Ethernet Compliant codes', - 'Fibre Channel link length/Transmitter Technology', - 'Fibre Channel transmission media', - 'Fibre Channel Speed') - -sfp_cable_length_tup = ('LengthSMFkm-UnitsOfKm', 'LengthSMF(UnitsOf100m)', - 'Length50um(UnitsOf10m)', 'Length62.5um(UnitsOfm)', - 'LengthOM3(UnitsOf10m)', 'LengthCable(UnitsOfm)') - -sfp_compliance_code_tup = ('10GEthernetComplianceCode', 'InfinibandComplianceCode', - 'ESCONComplianceCodes', 'SONETComplianceCodes', - 'EthernetComplianceCodes', 'FibreChannelLinkLength', - 'FibreChannelTechnology', 'SFP+CableTechnology', - 'FibreChannelTransmissionMedia', 'FibreChannelSpeed') - -info_dict_keys = ['type', 'hardware_rev', 'serial', - 'manufacturer', 'model', 'connector', - 'encoding', 'ext_identifier', 'ext_rateselect_compliance', - 'cable_type', 'cable_length', 'nominal_bit_rate', - 'specification_compliance', 'type_abbrv_name','vendor_date', 'vendor_oui'] - -dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', - 'power_lpmode', 'tx_disable', 'tx_disable_channel', - 'temperature', 'voltage', 'rx1power', - 'rx2power', 'rx3power', 'rx4power', - 'tx1bias', 'tx2bias', 'tx3bias', - 'tx4bias', 'tx1power', 'tx2power', - 'tx3power', 'tx4power'] - -threshold_dict_keys = ['temphighalarm', 'temphighwarning', - 'templowalarm', 'templowwarning', - 'vcchighalarm', 'vcchighwarning', - 'vcclowalarm', 'vcclowwarning', - 'rxpowerhighalarm', 'rxpowerhighwarning', - 'rxpowerlowalarm', 'rxpowerlowwarning', - 'txpowerhighalarm', 'txpowerhighwarning', - 'txpowerlowalarm', 'txpowerlowwarning', - 'txbiashighalarm', 'txbiashighwarning', - 'txbiaslowalarm', 'txbiaslowwarning'] - -sff8436_parser = { - 'reset_status': [QSFP_DOM_OFFSET, 2, 1, 'parse_dom_status_indicator'], - 'rx_los': [QSFP_DOM_OFFSET, 3, 1, 'parse_dom_tx_rx_los'], - 'tx_fault': [QSFP_DOM_OFFSET, 4, 1, 'parse_dom_tx_fault'], - 'tx_disable': [QSFP_DOM_OFFSET, 86, 1, 'parse_dom_tx_disable'], - 'power_lpmode': [QSFP_DOM_OFFSET, 93, 1, 'parse_dom_power_control'], - 'power_override': [QSFP_DOM_OFFSET, 93, 1, 'parse_dom_power_control'], - 'Temperature': [QSFP_DOM_OFFSET, 22, 2, 'parse_temperature'], - 'Voltage': [QSFP_DOM_OFFSET, 26, 2, 'parse_voltage'], - 'ChannelMonitor': [QSFP_DOM_OFFSET, 34, 16, 'parse_channel_monitor_params'], - 'ChannelMonitor_TxPower': - [QSFP_DOM_OFFSET, 34, 24, 'parse_channel_monitor_params_with_tx_power'], - - 'cable_type': [QSFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'cable_length': [QSFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'connector': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'type': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'encoding': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'ext_identifier': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'ext_rateselect_compliance': - [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'nominal_bit_rate': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'specification_compliance': - [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'type_abbrv_name': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'manufacturer': [QSFP_INFO_OFFSET, 20, 16, 'parse_vendor_name'], - 'vendor_oui': [QSFP_INFO_OFFSET, 37, 3, 'parse_vendor_oui'], - 'model': [QSFP_INFO_OFFSET, 40, 16, 'parse_vendor_pn'], - 'hardware_rev': [QSFP_INFO_OFFSET, 56, 2, 'parse_vendor_rev'], - 'serial': [QSFP_INFO_OFFSET, 68, 16, 'parse_vendor_sn'], - 'vendor_date': [QSFP_INFO_OFFSET, 84, 8, 'parse_vendor_date'], - 'dom_capability': [QSFP_INFO_OFFSET, 92, 1, 'parse_qsfp_dom_capability'], - 'dom_rev': [QSFP_DOM_OFFSET, 1, 1, 'parse_sfp_dom_rev'], - 'ModuleThreshold': [QSFP_DOM_OFFSET1, 128, 24, 'parse_module_threshold_values'], - 'ChannelThreshold': [QSFP_DOM_OFFSET1, 176, 16, 'parse_channel_threshold_values'], -} - -sff8472_parser = { - 'Temperature': [SFP_DOM_OFFSET, 96, 2, 'parse_temperature'], - 'Voltage': [SFP_DOM_OFFSET, 98, 2, 'parse_voltage'], - 'ChannelMonitor': [SFP_DOM_OFFSET, 100, 6, 'parse_channel_monitor_params'], - - 'cable_type': [SFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'cable_length': [SFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'connector': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'type': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'encoding': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'ext_identifier': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'ext_rateselect_compliance': - [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'nominal_bit_rate': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'specification_compliance': - [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'type_abbrv_name': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'manufacturer': [SFP_INFO_OFFSET, 20, 16, 'parse_vendor_name'], - 'vendor_oui': [SFP_INFO_OFFSET, 37, 3, 'parse_vendor_oui'], - 'model': [SFP_INFO_OFFSET, 40, 16, 'parse_vendor_pn'], - 'hardware_rev': [SFP_INFO_OFFSET, 56, 4, 'parse_vendor_rev'], - 'serial': [SFP_INFO_OFFSET, 68, 16, 'parse_vendor_sn'], - 'vendor_date': [SFP_INFO_OFFSET, 84, 8, 'parse_vendor_date'], - 'ModuleThreshold': [SFP_DOM_OFFSET, 0, 56, 'parse_alarm_warning_threshold'], -} - - -class Sfp(SfpBase): +QSFP_DD_PAGE0 = 0 + +SFP_TYPE_LIST = [ + '0x3' # SFP/SFP+/SFP28 and later +] +QSFP_TYPE_LIST = [ + '0xc', # QSFP + '0xd', # QSFP+ or later + '0x11' # QSFP28 or later +] +QSFP_DD_TYPE_LIST = [ + '0x18' #QSFP_DD Type +] + +class Sfp(SfpOptoeBase): """ DELLEMC Platform-specific Sfp class """ def __init__(self, index, sfp_type, eeprom_path): - SfpBase.__init__(self) + SfpOptoeBase.__init__(self) self.sfp_type = sfp_type self.index = index self.eeprom_path = eeprom_path - self.qsfpInfo = sff8436InterfaceId() - self.qsfpDomInfo = sff8436Dom() - self.sfpInfo = sff8472InterfaceId() - self.sfpDomInfo = sff8472Dom(None,1) - def get_eeprom_sysfs_path(self): + def get_eeprom_path(self): return self.eeprom_path + def get_name(self): + return "SFP/SFP+/SFP28" if self.index < 53 else "QSFP+ or later" + def pci_mem_read(self, mm, offset): mm.seek(offset) read_data_stream = mm.read(4) @@ -199,324 +82,12 @@ def pci_get_value(self, resource, offset): os.close(fd) return val - def _read_eeprom_bytes(self, eeprom_path, offset, num_bytes): - eeprom_raw = [] - try: - eeprom = open(eeprom_path, mode="rb", buffering=0) - except IOError: - return None - - for i in range(0, num_bytes): - eeprom_raw.append("0x00") - - try: - eeprom.seek(offset) - raw = eeprom.read(num_bytes) - except IOError: - eeprom.close() - return None - - raw = bytearray(raw) - - try: - for n in range(0, num_bytes): - eeprom_raw[n] = hex((raw[n]))[2:].zfill(2) - except BaseException: - eeprom.close() - return None - - eeprom.close() - return eeprom_raw - - def _get_eeprom_data(self, eeprom_key): - eeprom_data = None - page_offset = None - - if(self.sfp_type == 'QSFP'): - page_offset = sff8436_parser[eeprom_key][PAGE_OFFSET] - eeprom_data_raw = self._read_eeprom_bytes( - self.eeprom_path, - (sff8436_parser[eeprom_key][PAGE_OFFSET] + - sff8436_parser[eeprom_key][KEY_OFFSET]), - sff8436_parser[eeprom_key][KEY_WIDTH]) - if (eeprom_data_raw is not None): - # Offset 128 is used to retrieve sff8436InterfaceId Info - # Offset 0 is used to retrieve sff8436Dom Info - if (page_offset == 128): - if ( self.qsfpInfo is None): - return None - eeprom_data = getattr( - self.qsfpInfo, sff8436_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - if ( self.qsfpDomInfo is None): - return None - eeprom_data = getattr( - self.qsfpDomInfo, sff8436_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - page_offset = sff8472_parser[eeprom_key][PAGE_OFFSET] - eeprom_data_raw = self._read_eeprom_bytes( - self.eeprom_path, - (sff8472_parser[eeprom_key][PAGE_OFFSET] + - sff8472_parser[eeprom_key][KEY_OFFSET]), - sff8472_parser[eeprom_key][KEY_WIDTH]) - if (eeprom_data_raw is not None): - # Offset 0 is used to retrieve sff8472InterfaceId Info - # Offset 256 is used to retrieve sff8472Dom Info - if (page_offset == 0): - if ( self.sfpInfo is None): - return None - eeprom_data = getattr( - self.sfpInfo, sff8472_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - if ( self.sfpDomInfo is None): - return None - eeprom_data = getattr( - self.sfpDomInfo, sff8472_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - - return eeprom_data - - def get_transceiver_info(self): - """ - Retrieves transceiver info of this SFP - """ - transceiver_info_dict = {} - compliance_code_dict = {} - transceiver_info_dict = dict.fromkeys(info_dict_keys, 'N/A') - # BaseInformation - try: - iface_data = self._get_eeprom_data('type') - connector = iface_data['data']['Connector']['value'] - encoding = iface_data['data']['EncodingCodes']['value'] - ext_id = iface_data['data']['Extended Identifier']['value'] - rate_identifier = iface_data['data']['RateIdentifier']['value'] - identifier = iface_data['data']['type']['value'] - type_abbrv_name=iface_data['data']['type_abbrv_name']['value'] - if(self.sfp_type == 'QSFP'): - bit_rate = str( - iface_data['data']['Nominal Bit Rate(100Mbs)']['value']) - for key in qsfp_compliance_code_tup: - if key in iface_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = iface_data['data']['Specification compliance']['value'][key]['value'] - for key in qsfp_cable_length_tup: - if key in iface_data['data']: - cable_type = key - cable_length = str(iface_data['data'][key]['value']) - else: - bit_rate = str( - iface_data['data']['NominalSignallingRate(UnitsOf100Mbd)']['value']) - for key in sfp_compliance_code_tup: - if key in iface_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = iface_data['data']['Specification compliance']['value'][key]['value'] - for key in sfp_cable_length_tup: - if key in iface_data['data']: - cable_type = key - cable_length = str(iface_data['data'][key]['value']) - - transceiver_info_dict['type_abbrv_name']=type_abbrv_name - transceiver_info_dict['type'] = identifier - transceiver_info_dict['connector'] = connector - transceiver_info_dict['encoding'] = encoding - transceiver_info_dict['ext_identifier'] = ext_id - transceiver_info_dict['ext_rateselect_compliance'] = rate_identifier - transceiver_info_dict['cable_type'] = cable_type - transceiver_info_dict['cable_length'] = cable_length - transceiver_info_dict['nominal_bit_rate'] = bit_rate - transceiver_info_dict['specification_compliance'] = str(compliance_code_dict) - except (ValueError, TypeError) : pass - - # Vendor Date - try: - vendor_date_data = self._get_eeprom_data('vendor_date') - vendor_date = vendor_date_data['data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] - transceiver_info_dict['vendor_date'] = vendor_date - except (ValueError, TypeError) : pass - - # Vendor Name - try: - vendor_name_data = self._get_eeprom_data('manufacturer') - vendor_name = vendor_name_data['data']['Vendor Name']['value'] - transceiver_info_dict['manufacturer'] = vendor_name - except (ValueError, TypeError) : pass - - # Vendor OUI - try: - vendor_oui_data = self._get_eeprom_data('vendor_oui') - vendor_oui = vendor_oui_data['data']['Vendor OUI']['value'] - transceiver_info_dict['vendor_oui'] = vendor_oui - except (ValueError, TypeError) : pass - - # Vendor PN - try: - vendor_pn_data = self._get_eeprom_data('model') - vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['model'] = vendor_pn - except (ValueError, TypeError) : pass - - # Vendor Revision - try: - vendor_rev_data = self._get_eeprom_data('hardware_rev') - vendor_rev = vendor_rev_data['data']['Vendor Rev']['value'] - transceiver_info_dict['hardware_rev'] = vendor_rev - except (ValueError, TypeError) : pass - - # Vendor Serial Number - try: - vendor_sn_data = self._get_eeprom_data('serial') - vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] - transceiver_info_dict['serial'] = vendor_sn - except (ValueError, TypeError) : pass - - return transceiver_info_dict - - def get_transceiver_threshold_info(self): - """ - Retrieves transceiver threshold info of this SFP - """ - transceiver_dom_threshold_dict = {} - transceiver_dom_threshold_dict = dict.fromkeys( - threshold_dict_keys, 'N/A') - - try: - # Module Threshold - module_threshold_data = self._get_eeprom_data('ModuleThreshold') - if (self.sfp_type == 'QSFP'): - transceiver_dom_threshold_dict['temphighalarm'] = module_threshold_data['data']['TempHighAlarm']['value'] - transceiver_dom_threshold_dict['temphighwarning'] = module_threshold_data['data']['TempHighWarning']['value'] - transceiver_dom_threshold_dict['templowalarm'] = module_threshold_data['data']['TempLowAlarm']['value'] - transceiver_dom_threshold_dict['templowwarning'] = module_threshold_data['data']['TempLowWarning']['value'] - transceiver_dom_threshold_dict['vcchighalarm'] = module_threshold_data['data']['VccHighAlarm']['value'] - transceiver_dom_threshold_dict['vcchighwarning'] = module_threshold_data['data']['VccHighWarning']['value'] - transceiver_dom_threshold_dict['vcclowalarm'] = module_threshold_data['data']['VccLowAlarm']['value'] - transceiver_dom_threshold_dict['vcclowwarning'] = module_threshold_data['data']['VccLowWarning']['value'] - else: #SFP - transceiver_dom_threshold_dict['temphighalarm'] = module_threshold_data['data']['TempHighAlarm']['value'] - transceiver_dom_threshold_dict['templowalarm'] = module_threshold_data['data']['TempLowAlarm']['value'] - transceiver_dom_threshold_dict['temphighwarning'] = module_threshold_data['data']['TempHighWarning']['value'] - transceiver_dom_threshold_dict['templowwarning'] = module_threshold_data['data']['TempLowWarning']['value'] - transceiver_dom_threshold_dict['vcchighalarm'] = module_threshold_data['data']['VoltageHighAlarm']['value'] - transceiver_dom_threshold_dict['vcclowalarm'] = module_threshold_data['data']['VoltageLowAlarm']['value'] - transceiver_dom_threshold_dict['vcchighwarning'] = module_threshold_data['data']['VoltageHighWarning']['value'] - transceiver_dom_threshold_dict['vcclowwarning'] = module_threshold_data['data']['VoltageLowWarning']['value'] - transceiver_dom_threshold_dict['txbiashighalarm'] = module_threshold_data['data']['BiasHighAlarm']['value'] - transceiver_dom_threshold_dict['txbiaslowalarm'] = module_threshold_data['data']['BiasLowAlarm']['value'] - transceiver_dom_threshold_dict['txbiashighwarning'] = module_threshold_data['data']['BiasHighWarning']['value'] - transceiver_dom_threshold_dict['txbiaslowwarning'] = module_threshold_data['data']['BiasLowWarning']['value'] - transceiver_dom_threshold_dict['txpowerhighalarm'] = module_threshold_data['data']['TXPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['txpowerlowalarm'] = module_threshold_data['data']['TXPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['txpowerhighwarning'] = module_threshold_data['data']['TXPowerHighWarning']['value'] - transceiver_dom_threshold_dict['txpowerlowwarning'] = module_threshold_data['data']['TXPowerLowWarning']['value'] - transceiver_dom_threshold_dict['rxpowerhighalarm'] = module_threshold_data['data']['RXPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerlowalarm'] = module_threshold_data['data']['RXPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerhighwarning'] = module_threshold_data['data']['RXPowerHighWarning']['value'] - transceiver_dom_threshold_dict['rxpowerlowwarning'] = module_threshold_data['data']['RXPowerLowWarning']['value'] - except (ValueError, TypeError) : pass - - try: - if (self.sfp_type == 'QSFP'): - channel_threshold_data = self._get_eeprom_data('ChannelThreshold') - transceiver_dom_threshold_dict['rxpowerhighalarm'] = channel_threshold_data['data']['RxPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerhighwarning'] = channel_threshold_data['data']['RxPowerHighWarning']['value'] - transceiver_dom_threshold_dict['rxpowerlowalarm'] = channel_threshold_data['data']['RxPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerlowwarning'] = channel_threshold_data['data']['RxPowerLowWarning']['value'] - transceiver_dom_threshold_dict['txbiashighalarm'] = channel_threshold_data['data']['TxBiasHighAlarm']['value'] - transceiver_dom_threshold_dict['txbiashighwarning'] = channel_threshold_data['data']['TxBiasHighWarning']['value'] - transceiver_dom_threshold_dict['txbiaslowalarm'] = channel_threshold_data['data']['TxBiasLowAlarm']['value'] - transceiver_dom_threshold_dict['txbiaslowwarning'] = channel_threshold_data['data']['TxBiasLowWarning']['value'] - - except (ValueError, TypeError) : pass - return transceiver_dom_threshold_dict - - def get_transceiver_bulk_status(self): - """ - Retrieves transceiver bulk status of this SFP - """ - tx_bias_list = [] - rx_power_list = [] - transceiver_dom_dict = {} - transceiver_dom_dict = dict.fromkeys(dom_dict_keys, 'N/A') - - # RxLos - rx_los = self.get_rx_los() - - # TxFault - tx_fault = self.get_tx_fault() - - # ResetStatus - reset_state = self.get_reset_status() - - # LowPower Mode - lp_mode = self.get_lpmode() - - # TxDisable - tx_disable = self.get_tx_disable() - - # TxDisable Channel - tx_disable_channel = self.get_tx_disable_channel() - - # Temperature - temperature = self.get_temperature() - - # Voltage - voltage = self.get_voltage() - - # Channel Monitor - tx_power_list = self.get_tx_power() - - # tx bias - tx_bias_list = self.get_tx_bias() - - # rx power - rx_power_list = self.get_rx_power() - - if tx_bias_list is not None: - transceiver_dom_dict['tx1bias'] = tx_bias_list[0] - transceiver_dom_dict['tx2bias'] = tx_bias_list[1] - transceiver_dom_dict['tx3bias'] = tx_bias_list[2] - transceiver_dom_dict['tx4bias'] = tx_bias_list[3] - - if rx_power_list is not None: - transceiver_dom_dict['rx1power'] = rx_power_list[0] - transceiver_dom_dict['rx2power'] = rx_power_list[1] - transceiver_dom_dict['rx3power'] = rx_power_list[2] - transceiver_dom_dict['rx4power'] = rx_power_list[3] - - if tx_power_list is not None: - transceiver_dom_dict['tx1power'] = tx_power_list[0] - transceiver_dom_dict['tx2power'] = tx_power_list[1] - transceiver_dom_dict['tx3power'] = tx_power_list[2] - transceiver_dom_dict['tx4power'] = tx_power_list[3] - - transceiver_dom_dict['rx_los'] = rx_los - transceiver_dom_dict['tx_fault'] = tx_fault - transceiver_dom_dict['reset_status'] = reset_state - transceiver_dom_dict['power_lpmode'] = lp_mode - transceiver_dom_dict['tx_disable'] = tx_disable - transceiver_dom_dict['tx_disable_channel'] = tx_disable_channel - transceiver_dom_dict['temperature'] = temperature - transceiver_dom_dict['voltage'] = voltage - - return transceiver_dom_dict - - def get_name(self): - """ - Retrieves the name of the sfp - Returns : QSFP or QSFP+ or QSFP28 - """ - try: - iface_data = self._get_eeprom_data('type') - identifier = iface_data['data']['type']['value'] - except (TypeError, ValueError): - return 'N/A' - return identifier def _get_cpld_register(self, reg): reg_file = '/sys/devices/platform/dell-n3248te-cpld.0/' + reg try: - rv = open(reg_file, 'r').read() + with open(reg_file, 'r') as fd: + rv = fd.read() except IOError : return 'ERR' return rv.strip('\r\n').lstrip(' ') @@ -537,30 +108,6 @@ def get_presence(self): pass return presence - def get_model(self): - """ - Retrieves the model number (or part number) of the sfp - """ - try: - vendor_pn_data = self._get_eeprom_data('model') - vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] - except (TypeError, ValueError): - return 'N/A' - - return vendor_pn - - def get_serial(self): - """ - Retrieves the serial number of the sfp - """ - try: - vendor_sn_data = self._get_eeprom_data('serial') - vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] - except (TypeError, ValueError): - return 'N/A' - - return vendor_sn - def get_reset_status(self): """ Retrives the reset status of SFP @@ -568,66 +115,6 @@ def get_reset_status(self): reset_status = False return reset_status - def get_rx_los(self): - """ - Retrieves the RX LOS (lost-of-signal) status of SFP - """ - rx_los = False - if not (self.index >= SFP_PORT_START and self.index <= SFP_PORT_END): return rx_los - bit_mask = 1 << (self.index - SFP_PORT_START) - try: - sfp_rxlos = self._get_cpld_register('sfp_rxlos') - if sfp_rxlos == 'ERR' : return rx_los - rx_los = ((int(sfp_rxlos, 16) & bit_mask) != 0) - except Exception: - pass - return rx_los - - def get_tx_fault(self): - """ - Retrieves the TX fault status of SFP - """ - tx_fault = False - if not (self.index >= SFP_PORT_START and self.index <= SFP_PORT_END): return tx_fault - bit_mask = 1 << (self.index - SFP_PORT_START) - try: - sfp_txfault = self._get_cpld_register('sfp_txfault') - if sfp_txfault == 'ERR' : return tx_fault - tx_fault = ((int(sfp_txfault, 16) & bit_mask) != 0) - except Exception: - pass - return tx_fault - - def get_tx_disable(self): - """ - Retrieves the tx_disable status of this SFP - """ - tx_disable = False - if not (self.index >= SFP_PORT_START and self.index <= SFP_PORT_END): return tx_disable - bit_mask = 1 << (self.index - SFP_PORT_START) - try: - sfp_txdisable = self._get_cpld_register('sfp_txdis') - if sfp_txdisable == 'ERR' : return tx_disable - tx_disable = ((int(sfp_txdisable, 16) & bit_mask) != 0) - except Exception: - pass - return tx_disable - - def get_tx_disable_channel(self): - """ - Retrieves the TX disabled channels in this SFP - """ - tx_disable_channel = 0 - try: - if (self.sfp_type == 'QSFP'): - tx_disable_data = self._get_eeprom_data('tx_disable') - for tx_disable_id in ('Tx1Disable', 'Tx2Disable', 'Tx3Disable', 'Tx4Disable'): - tx_disable_channel <<= 1 - tx_disable_channel |= (tx_disable_data['data']['Tx1Disable']['value'] is 'On') - except (TypeError, ValueError): - return 'N/A' - return tx_disable_channel - def get_lpmode(self): """ Retrieves the lpmode(low power mode) of this SFP @@ -635,115 +122,11 @@ def get_lpmode(self): lpmode_state = False return lpmode_state - def get_power_override(self): - """ - Retrieves the power-override status of this SFP - """ - power_override_state = False - - try: - if (self.sfp_type == 'QSFP'): - power_override_data = self._get_eeprom_data('power_override') - power_override = power_override_data['data']['PowerOverRide']['value'] - power_override_state = (power_override is 'On') - except (TypeError, ValueError): pass - return power_override_state - - def get_temperature(self): - """ - Retrieves the temperature of this SFP - """ - try : - temperature_data = self._get_eeprom_data('Temperature') - temperature = temperature_data['data']['Temperature']['value'] - except (TypeError, ValueError): - return 'N/A' - return temperature - - def get_voltage(self): - """ - Retrieves the supply voltage of this SFP - """ - try: - voltage_data = self._get_eeprom_data('Voltage') - voltage = voltage_data['data']['Vcc']['value'] - except (TypeError, ValueError): - return 'N/A' - return voltage - - def get_tx_bias(self): - """ - Retrieves the TX bias current of this SFP - """ - tx_bias_list = [] - try: - tx_bias_data = self._get_eeprom_data('ChannelMonitor') - if (self.sfp_type == 'QSFP'): - for tx_bias_id in ('TX1Bias', 'TX2Bias', 'TX3Bias', 'TX4Bias') : - tx_bias = tx_bias_data['data'][tx_bias_id]['value'] - tx_bias_list.append(tx_bias) - else: - tx1_bias = tx_bias_data['data']['TXBias']['value'] - tx_bias_list = [tx1_bias, "N/A", "N/A", "N/A"] - except (TypeError, ValueError): - return None - return tx_bias_list - - def get_rx_power(self): - """ - Retrieves the received optical power for this SFP - """ - rx_power_list = [] - try: - rx_power_data = self._get_eeprom_data('ChannelMonitor') - if (self.sfp_type == 'QSFP'): - for rx_power_id in ('RX1Power', 'RX2Power', 'RX3Power', 'RX4Power'): - rx_power = rx_power_data['data'][rx_power_id]['value'] - rx_power_list.append(rx_power) - else: - rx1_pw = rx_power_data['data']['RXPower']['value'] - rx_power_list = [rx1_pw, "N/A", "N/A", "N/A"] - except (TypeError, ValueError): - return None - return rx_power_list - - def get_tx_power(self): - """ - Retrieves the TX power of this SFP - """ - tx_power_list = [] - try: - if(self.sfp_type == 'QSFP'): - # QSFP capability byte parse, through this byte can know whether it support tx_power or not. - # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, - # need to add more code for determining the capability and version compliance - # in SFF-8636 dom capability definitions evolving with the versions. - qspf_dom_capability_data = self._get_eeprom_data('dom_capability') - qsfp_dom_rev_data = self._get_eeprom_data('dom_rev') - qsfp_dom_rev = qsfp_dom_rev_data['data']['dom_rev']['value'] - qsfp_tx_power_support = qspf_dom_capability_data['data']['Tx_power_support']['value'] - - # The tx_power monitoring is only available on QSFP which compliant with SFF-8636 - # and claimed that it support tx_power with one indicator bit. - if (qsfp_dom_rev[0:8] != 'SFF-8636' or (qsfp_dom_rev[0:8] == 'SFF-8636' and qsfp_tx_power_support != 'on')): - return None - channel_monitor_data = self._get_eeprom_data('ChannelMonitor_TxPower') - for tx_power_id in ('TX1Power', 'TX2Power', 'TX3Power', 'TX4Power'): - tx_pw = channel_monitor_data['data'][tx_power_id]['value'] - tx_power_list.append(tx_pw) - else: - channel_monitor_data = self._get_eeprom_data('ChannelMonitor') - tx1_pw = channel_monitor_data['data']['TXPower']['value'] - tx_power_list = [tx1_pw, 'N/A', 'N/A', 'N/A'] - except (TypeError, ValueError): - return None - return tx_power_list - def reset(self): """ Reset the SFP and returns all user settings to their default state """ - return True + return False def set_lpmode(self, lpmode): """ @@ -751,24 +134,6 @@ def set_lpmode(self, lpmode): """ return True - def tx_disable(self, tx_disable): - """ - Disable SFP TX for all channels - """ - return False - - def tx_disable_channel(self, channel, disable): - """ - Sets the tx_disable for specified SFP channels - """ - return False - - def set_power_override(self, power_override, power_set): - """ - Sets SFP power level using power_override and power_set - """ - return False - def get_status(self): """ Retrieves the operational status of the device @@ -780,4 +145,42 @@ def get_max_port_power(self): """ Retrieves the maximumum power allowed on the port in watts """ - return 2.5 + return 5.0 if self.sfp_type == 'QSFP' else 2.5 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True + + def get_error_description(self): + """ + Retrives the error descriptions of the SFP module + Returns: + String that represents the current error descriptions of vendor specific errors + In case there are multiple errors, they should be joined by '|', + like: "Bad EEPROM|Unsupported cable" + """ + if not self.get_presence(): + return self.SFP_STATUS_UNPLUGGED + else: + if not os.path.isfile(self.eeprom_path): + return "EEPROM driver is not attached" + + if self.sfp_type == 'SFP': + offset = SFP_INFO_OFFSET + elif self.sfp_type == 'QSFP': + offset = QSFP_INFO_OFFSET + elif self.sfp_type == 'QSFP_DD': + offset = QSFP_DD_PAGE0 + + try: + with open(self.eeprom_path, mode="rb", buffering=0) as eeprom: + eeprom.seek(offset) + eeprom.read(1) + except OSError as e: + return "EEPROM read failed ({})".format(e.strerror) + + return self.SFP_STATUS_OK diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/thermal.py index 96edda7c14d4..b07eb5d075e1 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/thermal.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ######################################################################## -# DellEMC Z9332F +# DellEMC N3248TE # # Module contains an implementation of SONiC Platform Base API and # provides the Thermals' information which are available in the platform @@ -144,3 +144,20 @@ def set_low_threshold(self, temperature): """ # Thermal threshold values are pre-defined based on HW. return False + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + Returns: + integer: The 1-based relative physical position in parent + device or -1 if cannot determine the position + """ + return self.index + + def is_replaceable(self): + """ + Indicate whether this Thermal is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/watchdog.py index ebd4706b4215..1e077e45d122 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/watchdog.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248te/sonic_platform/watchdog.py @@ -11,7 +11,6 @@ try: import ctypes - import subprocess from sonic_platform_base.watchdog_base import WatchdogBase except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -29,43 +28,53 @@ class Watchdog(WatchdogBase): Abstract base class for interfacing with a hardware watchdog module """ - TIMERS = [15,20,30,40,50,60,65,70] + TIMERS = [15,20,30,40,50,60,65,70,80,100,120,140,160,180,210,240] armed_time = 0 timeout = 0 CLOCK_MONOTONIC = 1 def __init__(self): + WatchdogBase.__init__(self) self._librt = ctypes.CDLL('librt.so.1', use_errno=True) self._clock_gettime = self._librt.clock_gettime self._clock_gettime.argtypes=[ctypes.c_int, ctypes.POINTER(_timespec)] + self.watchdog_reg = "watchdog" - def _get_command_result(self, cmdline): + def _get_cpld_register(self, reg_name): + # On successful read, returns the value read from given + # reg name and on failure rethrns 'ERR' + cpld_dir = "/sys/devices/platform/dell-n3248te-cpld.0/" + cpld_reg_file = cpld_dir + '/' + reg_name try: - proc = subprocess.Popen(cmdline.split(), stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) - stdout = proc.communicate()[0] - proc.wait() - result = stdout.rstrip('\n') - except OSError: - result = None + with open(cpld_reg_file, 'r') as fd: + rv = fd.read() + except IOError : return 'ERR' + return rv.strip('\r\n').lstrip(' ') - return result + def _set_cpld_register(self, reg_name, value): + # On successful write, returns the value will be written on + # reg_name and on failure returns 'ERR' + + cpld_dir = "/sys/devices/platform/dell-n3248te-cpld.0/" + cpld_reg_file = cpld_dir + '/' + reg_name + + try: + with open(cpld_reg_file, 'w') as fd: + rv = fd.write(str(value)) + except Exception: + rv = 'ERR' + + return rv def _get_reg_val(self): - # 0x31 = CPLD I2C Base Address - # 0x07 = Watchdog Function Register - value = self._get_command_result("/usr/sbin/i2cget -y 601 0x31 0x07") - if not value: - return None - else: - return int(value, 16) + value = self._get_cpld_register(self.watchdog_reg).strip() + if value == 'ERR': return False + + return int(value,16) def _set_reg_val(self,val): - # 0x31 = CPLD I2C Base Address - # 0x07 = Watchdog Function Register - value = self._get_command_result("/usr/sbin/i2cset -y 601 0x31 0x07 %s" - % (val)) + value = self._set_cpld_register(self.watchdog_reg, val) return value def _get_time(self): @@ -93,7 +102,7 @@ def arm(self, seconds): """ timer_offset = -1 for key,timer_seconds in enumerate(self.TIMERS): - if seconds <= timer_seconds: + if seconds > 0 and seconds <= timer_seconds: timer_offset = key seconds = timer_seconds break @@ -101,41 +110,30 @@ def arm(self, seconds): if timer_offset == -1: return -1 - # Extracting 5th to 7th bits for WD timer values - # 000 - 15 sec - # 001 - 20 sec - # 010 - 30 sec - # 011 - 40 sec - # 100 - 50 sec - # 101 - 60 sec - # 110 - 65 sec - # 111 - 70 sec + # Extracting 5th to 8th bits for WD timer values reg_val = self._get_reg_val() - wd_timer_offset = (reg_val >> 4) & 0x7 + wd_timer_offset = (reg_val >> 4) & 0xF if wd_timer_offset != timer_offset: - # Setting 5th to 7th bits + # Setting 5th to 8th bits # value from timer_offset self.disarm() - self._set_reg_val(reg_val | (timer_offset << 4)) + self._set_reg_val((reg_val & 0x0F) | (timer_offset << 4)) if self.is_armed(): # Setting last bit to WD Timer punch # Last bit = WD Timer punch self._set_reg_val(reg_val & 0xFE) - self.armed_time = self._get_time() - self.timeout = seconds - return seconds else: # Setting 4th bit to enable WD # 4th bit = Enable WD reg_val = self._get_reg_val() self._set_reg_val(reg_val | 0x8) - self.armed_time = self._get_time() - self.timeout = seconds - return seconds + self.armed_time = self._get_time() + self.timeout = seconds + return seconds def disarm(self): """ @@ -183,7 +181,7 @@ def get_remaining_time(self): their watchdog timer. If the watchdog is not armed, returns -1. - S5232 doesnot have hardware support to show remaining time. + N3248PXE doesnot have hardware support to show remaining time. Due to this limitation, this API is implemented in software. This API would return correct software time difference if it is called from the process which armed the watchdog timer. @@ -207,4 +205,3 @@ def get_remaining_time(self): return self.timeout - diff_time return 0 - diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/cfg/s5212f-modules.conf b/platform/broadcom/sonic-platform-modules-dell/s5212f/cfg/s5212f-modules.conf new file mode 100644 index 000000000000..9f49d40600d7 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/cfg/s5212f-modules.conf @@ -0,0 +1,19 @@ +# /etc/modules: kernel modules to load at boot time. +# +# This file contains the names of kernel modules that should be loaded +# at boot time, one per line. Lines beginning with "#" are ignored. + +i2c-i801 +i2c-isch +i2c-ismt +i2c-dev +i2c-mux +i2c-smbus + +i2c-mux-gpio +i2c-mux-pca954x + +ipmi_devintf +ipmi_si +dell_s5212f_fpga_ocores +i2c_ocores diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/cfg/s5212f-params.conf b/platform/broadcom/sonic-platform-modules-dell/s5212f/cfg/s5212f-params.conf new file mode 100644 index 000000000000..55c1c0303d80 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/cfg/s5212f-params.conf @@ -0,0 +1,2 @@ +options ipmi_si kipmid_max_busy_us=1000 + diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/modules/Makefile b/platform/broadcom/sonic-platform-modules-dell/s5212f/modules/Makefile new file mode 100644 index 000000000000..f63aac47ef04 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/modules/Makefile @@ -0,0 +1,2 @@ +obj-m := dell_s5212f_fpga_ocores.o + diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/modules/dell_s5212f_fpga_ocores.c b/platform/broadcom/sonic-platform-modules-dell/s5212f/modules/dell_s5212f_fpga_ocores.c new file mode 100644 index 000000000000..b3d9e8dbab3a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/modules/dell_s5212f_fpga_ocores.c @@ -0,0 +1,1626 @@ +/* +* Copyright (C) 2018 Dell Inc +* +* Licensed under the GNU General Public License Version 2 +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ + +/** +* @file fpga_i2ccore.c +* @brief This is a driver to interface with Linux Open Cores drivber for FPGA i2c access +* +************************************************************************/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include //siginfo +#include //rcu_read_lock +#include //kernel_version +#include +#include +#include +#include +#include + + +void __iomem * fpga_base_addr = NULL; +void __iomem * fpga_ctl_addr = NULL; + +#define DRIVER_NAME "fpgapci" +#define PCI_NUM_BARS 4 + +#ifdef DEBUG +# define PRINT(fmt, ...) printk(fmt, ##__VA_ARGS__) +#else +# define PRINT(fmt, ...) +#endif + +/* Maximum size of driver buffer (allocated with kalloc()). + * Needed to copy data from user to kernel space, among other + * things. */ +static const size_t BUF_SIZE = PAGE_SIZE; + +/* Device data used by this driver. */ +struct fpgapci_dev { + /* the kernel pci device data structure */ + struct pci_dev *pci_dev; + + /* upstream root node */ + struct pci_dev *upstream; + + /* kernels virtual addr. for the mapped BARs */ + void * __iomem bar[PCI_NUM_BARS]; + + /* length of each memory region. Used for error checking. */ + size_t bar_length[PCI_NUM_BARS]; + + /* Debug data */ + /* number of hw interrupts handled. */ + int num_handled_interrupts; + int num_undelivered_signals; + int pci_gen; + int pci_num_lanes; + + unsigned int irq_first; + unsigned int irq_length; + unsigned int irq_assigned; + unsigned int xcvr_intr_count; +}; + +static int use_irq = 0; +module_param(use_irq, int, 0644); +MODULE_PARM_DESC(use_irq, "Get an use_irq value from user...\n"); + +static uint32_t num_bus = 0; +module_param(num_bus, int, 0); +MODULE_PARM_DESC(num_bus, + "Number of i2c busses supported by the FPGA on this platform."); + + +/* Xilinx FPGA PCIE info: */ +/* Non-VGA unclassified device: Xilinx Corporation Device 7021*/ +/* Subsystem: Xilinx Corporation Device 0007 */ +//#define VENDOR 0x10EE +#define DEVICE 0x7021 +static phys_addr_t fpga_phys_addr; + +typedef signed char s8; +typedef unsigned char u8; + +typedef signed short s16; +typedef unsigned short u16; + +typedef signed int s32; +typedef unsigned int u32; + +typedef signed long long s64; +typedef unsigned long long u64; + + +/* struct to hold data related to the pcie device */ +struct pci_data_struct{ + struct pci_dev* dev; + unsigned long long phy_addr_bar0; + unsigned long long phy_len_bar0; + unsigned long long phy_flags_bar0; + unsigned int irq_first; + unsigned int irq_length; + unsigned int irq_assigned; + void * kvirt_addr_bar0; +}; + +/* global variable declarations */ + +/* Static function declarations */ +static int fpgapci_probe(struct pci_dev *dev, const struct pci_device_id *id); +static void fpgapci_remove(struct pci_dev *dev); + +static int scan_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev); +static int map_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev); +static void free_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev); + + +struct fpgalogic_i2c { + void __iomem *base; + u32 reg_shift; + u32 reg_io_width; + wait_queue_head_t wait; + struct i2c_msg *msg; + int pos; + int nmsgs; + int state; /* see STATE_ */ + int ip_clock_khz; + int bus_clock_khz; + void (*reg_set)(struct fpgalogic_i2c *i2c, int reg, u8 value); + u8 (*reg_get)(struct fpgalogic_i2c *i2c, int reg); + u32 timeout; + struct mutex lock; +}; +/* registers */ +#define FPGAI2C_REG_PRELOW 0 +#define FPGAI2C_REG_PREHIGH 1 +#define FPGAI2C_REG_CONTROL 2 +#define FPGAI2C_REG_DATA 3 +#define FPGAI2C_REG_CMD 4 /* write only */ +#define FPGAI2C_REG_STATUS 4 /* read only, same address as FPGAI2C_REG_CMD */ +#define FPGAI2C_REG_VER 5 + + + +#define FPGAI2C_REG_CTRL_IEN 0x40 +#define FPGAI2C_REG_CTRL_EN 0x80 + +#define FPGAI2C_REG_CMD_START 0x91 +#define FPGAI2C_REG_CMD_STOP 0x41 +#define FPGAI2C_REG_CMD_READ 0x21 +#define FPGAI2C_REG_CMD_WRITE 0x11 +#define FPGAI2C_REG_CMD_READ_ACK 0x21 +#define FPGAI2C_REG_CMD_READ_NACK 0x29 +#define FPGAI2C_REG_CMD_IACK 0x01 + +#define FPGAI2C_REG_STAT_IF 0x01 +#define FPGAI2C_REG_STAT_TIP 0x02 +#define FPGAI2C_REG_STAT_ARBLOST 0x20 +#define FPGAI2C_REG_STAT_BUSY 0x40 +#define FPGAI2C_REG_STAT_NACK 0x80 + +/* SR[7:0] - Status register */ +#define FPGAI2C_REG_SR_RXACK (1 << 7) /* Receive acknowledge from slave .1. = No acknowledge received*/ +#define FPGAI2C_REG_SR_BUSY (1 << 6) /* Busy, I2C bus busy (as defined by start / stop bits) */ +#define FPGAI2C_REG_SR_AL (1 << 5) /* Arbitration lost - fpga i2c logic lost arbitration */ +#define FPGAI2C_REG_SR_TIP (1 << 1) /* Transfer in progress */ +#define FPGAI2C_REG_SR_IF (1 << 0) /* Interrupt flag */ + +enum { + STATE_DONE = 0, + STATE_INIT, + STATE_ADDR, + STATE_ADDR10, + STATE_START, + STATE_WRITE, + STATE_READ, + STATE_STOP, + STATE_ERROR, +}; + +#define TYPE_FPGALOGIC 0 +#define TYPE_GRLIB 1 + +/*I2C_CH1 Offset address from PCIE BAR 0*/ +#define FPGALOGIC_I2C_BASE 0x00006000 +#define FPGALOGIC_CH_OFFSET 0x10 + +#define i2c_bus_controller_numb 1 +#define I2C_PCI_MAX_BUS (16) +#define I2C_PCI_MAX_BUS_REV00 (7) +#define DELL_I2C_CLOCK_LEGACY 0 +#define DELL_I2C_CLOCK_PRESERVE (~0U) +#define I2C_PCI_BUS_NUM_5 5 +#define I2C_PCI_BUS_NUM_7 7 +#define I2C_PCI_BUS_NUM_8 8 +#define I2C_PCI_BUS_NUM_10 10 +#define I2C_PCI_BUS_NUM_12 12 +#define I2C_PCI_BUS_NUM_16 16 + +#define IRQ_LTCH_STS 0x20 +#define PRSNT_LTCH_STS 0x10 + +#define PORT_CTRL_OFFSET 0x4000 +#define PORT_STS_OFFSET 0x4004 +#define PORT_IRQ_STS_OFFSET 0x4008 +#define PORT_IRQ_EN_OFFSET 0x400C +#define MB_BRD_REV_TYPE 0x0008 +#define MB_BRD_REV_MASK 0x00f0 +#define MB_BRD_REV_00 0x0000 +#define MB_BRD_REV_01 0x0010 +#define MB_BRD_REV_02 0x0020 +#define MB_BRD_REV_03 0x0030 +#define MB_BRD_TYPE_MASK 0x000f +#define BRD_TYPE_Z9232_NON_NEBS 0x0 +#define BRD_TYPE_Z9232_NEBS 0x1 +#define BRD_TYPE_Z9264_NON_NEBS 0x2 +#define BRD_TYPE_Z9264_NEBS 0x3 +#define BRD_TYPE_S5212_NON_NEBS 0x4 +#define BRD_TYPE_S5212_NEBS 0x5 +#define BRD_TYPE_S5224_NON_NEBS 0x6 +#define BRD_TYPE_S5224_NEBS 0x7 +#define BRD_TYPE_S5248_NON_NEBS 0x8 +#define BRD_TYPE_S5248_NEBS 0x9 +#define BRD_TYPE_S5296_NON_NEBS 0xa +#define BRD_TYPE_S5296_NEBS 0xb +#define BRD_TYPE_S5232_NON_NEBS 0xc +#define BRD_TYPE_S5232_NEBS 0xd + +#define FPGA_CTL_REG_SIZE 0x6000 +#define MSI_VECTOR_MAP_MASK 0x1f +#define MSI_VECTOR_MAP1 0x58 +#define I2C_CH1_MSI_MAP_VECT_8 0x00000008 +#define I2C_CH2_MSI_MAP_VECT_9 0x00000120 +#define I2C_CH3_MSI_MAP_VECT_10 0x00002800 +#define I2C_CH4_MSI_MAP_VECT_11 0x00058000 +#define I2C_CH5_MSI_MAP_VECT_12 0x00c00000 +#define I2C_CH6_MSI_MAP_VECT_13 0x15000000 +#define MSI_VECTOR_MAP2 0x5c +#define I2C_CH7_MSI_MAP_VECT_14 0x0000000e +#define MSI_VECTOR_MAP3 0x9c +#define I2C_CH8_MSI_MAP_VECT_8 0x00800000 +#define I2C_CH8_MSI_MAP_VECT_16 0x01100000 +#define I2C_CH9_MSI_MAP_VECT_9 0x12000000 +#define I2C_CH9_MSI_MAP_VECT_17 0x24000000 +#define MSI_VECTOR_MAP4 0xa0 +#define I2C_CH10_MSI_MAP_VECT_10 0x0000000a +#define I2C_CH10_MSI_MAP_VECT_18 0x00000012 +#define I2C_CH11_MSI_MAP_VECT_11 0x00000120 +#define I2C_CH11_MSI_MAP_VECT_19 0x00000260 +#define I2C_CH12_MSI_MAP_VECT_12 0x00002800 +#define I2C_CH12_MSI_MAP_VECT_20 0x00005000 +#define I2C_CH13_MSI_MAP_VECT_13 0x00058000 +#define I2C_CH13_MSI_MAP_VECT_21 0x000a8000 +#define I2C_CH14_MSI_MAP_VECT_14 0x00c00000 +#define I2C_CH14_MSI_MAP_VECT_22 0x01600000 +#define I2C_CH15_MSI_MAP_VECT_8 0x10000000 +#define I2C_CH15_MSI_MAP_VECT_23 0x2e000000 +#define MSI_VECTOR_MAP5 0xa4 +#define I2C_CH16_MSI_MAP_VECT_9 0x00000009 +#define I2C_CH16_MSI_MAP_VECT_24 0x00000018 + +#define MSI_VECTOR_REV_00 16 +#define MSI_VECTOR_REV_01 32 + +#define FPGA_MSI_VECTOR_ID_4 4 +#define FPGA_MSI_VECTOR_ID_5 5 +#define FPGA_MSI_VECTOR_ID_8 8 +#define FPGA_MSI_VECTOR_ID_9 9 +#define FPGA_MSI_VECTOR_ID_10 10 +#define FPGA_MSI_VECTOR_ID_11 11 +#define FPGA_MSI_VECTOR_ID_12 12 +#define FPGA_MSI_VECTOR_ID_13 13 +#define FPGA_MSI_VECTOR_ID_14 14 +#define FPGA_MSI_VECTOR_ID_15 15 /*Note: this is external MSI vector id */ +#define FPGA_MSI_VECTOR_ID_16 16 +#define FPGA_MSI_VECTOR_ID_17 17 +#define FPGA_MSI_VECTOR_ID_18 18 +#define FPGA_MSI_VECTOR_ID_19 19 +#define FPGA_MSI_VECTOR_ID_20 20 +#define FPGA_MSI_VECTOR_ID_21 21 +#define FPGA_MSI_VECTOR_ID_22 22 +#define FPGA_MSI_VECTOR_ID_23 23 +#define FPGA_MSI_VECTOR_ID_24 24 + + + +static int total_i2c_pci_bus = 0; +static uint32_t board_rev_type = 0; +static struct fpgalogic_i2c fpgalogic_i2c[I2C_PCI_MAX_BUS]; +static struct i2c_adapter i2c_pci_adap[I2C_PCI_MAX_BUS]; +static struct mutex i2c_xfer_lock[I2C_PCI_MAX_BUS]; + +static void fpgai2c_reg_set_8(struct fpgalogic_i2c *i2c, int reg, u8 value) +{ + iowrite8(value, i2c->base + (reg << i2c->reg_shift)); +} + +static void fpgai2c_reg_set_16(struct fpgalogic_i2c *i2c, int reg, u8 value) +{ + iowrite16(value, i2c->base + (reg << i2c->reg_shift)); +} + +static void fpgai2c_reg_set_32(struct fpgalogic_i2c *i2c, int reg, u8 value) +{ + iowrite32(value, i2c->base + (reg << i2c->reg_shift)); +} + +static void fpgai2c_reg_set_16be(struct fpgalogic_i2c *i2c, int reg, u8 value) +{ + iowrite16be(value, i2c->base + (reg << i2c->reg_shift)); +} + +static void fpgai2c_reg_set_32be(struct fpgalogic_i2c *i2c, int reg, u8 value) +{ + iowrite32be(value, i2c->base + (reg << i2c->reg_shift)); +} + +static inline u8 fpgai2c_reg_get_8(struct fpgalogic_i2c *i2c, int reg) +{ + return ioread8(i2c->base + (reg << i2c->reg_shift)); +} + +static inline u8 fpgai2c_reg_get_16(struct fpgalogic_i2c *i2c, int reg) +{ + return ioread16(i2c->base + (reg << i2c->reg_shift)); +} + +static inline u8 fpgai2c_reg_get_32(struct fpgalogic_i2c *i2c, int reg) +{ + return ioread32(i2c->base + (reg << i2c->reg_shift)); +} + +static inline u8 fpgai2c_reg_get_16be(struct fpgalogic_i2c *i2c, int reg) +{ + return ioread16be(i2c->base + (reg << i2c->reg_shift)); +} + +static inline u8 fpgai2c_reg_get_32be(struct fpgalogic_i2c *i2c, int reg) +{ + return ioread32be(i2c->base + (reg << i2c->reg_shift)); +} + +static inline void fpgai2c_reg_set(struct fpgalogic_i2c *i2c, int reg, u8 value) +{ + i2c->reg_set(i2c, reg, value); + udelay(100); +} + +static inline u8 fpgai2c_reg_get(struct fpgalogic_i2c *i2c, int reg) +{ + udelay(100); + return i2c->reg_get(i2c, reg); +} + +static void fpgai2c_dump(struct fpgalogic_i2c *i2c) +{ + u8 tmp; + + PRINT("Logic register dump:\n"); + + tmp = fpgai2c_reg_get(i2c, FPGAI2C_REG_PRELOW); + PRINT("FPGAI2C_REG_PRELOW (%d) = 0x%x\n",FPGAI2C_REG_PRELOW,tmp); + + tmp = fpgai2c_reg_get(i2c, FPGAI2C_REG_PREHIGH); + PRINT("FPGAI2C_REG_PREHIGH(%d) = 0x%x\n",FPGAI2C_REG_PREHIGH,tmp); + + tmp = fpgai2c_reg_get(i2c, FPGAI2C_REG_CONTROL); + PRINT("FPGAI2C_REG_CONTROL(%d) = 0x%x\n",FPGAI2C_REG_CONTROL,tmp); + + tmp = fpgai2c_reg_get(i2c, FPGAI2C_REG_DATA); + PRINT("FPGAI2C_REG_DATA (%d) = 0x%x\n",FPGAI2C_REG_DATA,tmp); + + tmp = fpgai2c_reg_get(i2c, FPGAI2C_REG_CMD); + PRINT("FPGAI2C_REG_CMD (%d) = 0x%x\n",FPGAI2C_REG_CMD,tmp); +} + +static void fpgai2c_stop(struct fpgalogic_i2c *i2c) +{ + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_STOP); +} + +/* + * dell_get_mutex must be called prior to calling this function. + */ +static int fpgai2c_poll(struct fpgalogic_i2c *i2c) +{ + u8 stat = fpgai2c_reg_get(i2c, FPGAI2C_REG_STATUS); + struct i2c_msg *msg = i2c->msg; + u8 addr; + + /* Ready? */ + if (stat & FPGAI2C_REG_STAT_TIP) + return -EBUSY; + + if (i2c->state == STATE_DONE || i2c->state == STATE_ERROR) { + /* Stop has been sent */ + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_IACK); + if (i2c->state == STATE_ERROR) + return -EIO; + return 0; + } + + /* Error? */ + if (stat & FPGAI2C_REG_STAT_ARBLOST) { + i2c->state = STATE_ERROR; + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_STOP); + return -EAGAIN; + } + + if (i2c->state == STATE_INIT) { + if (stat & FPGAI2C_REG_STAT_BUSY) + return -EBUSY; + + i2c->state = STATE_ADDR; + } + + if (i2c->state == STATE_ADDR) { + /* 10 bit address? */ + if (i2c->msg->flags & I2C_M_TEN) { + addr = 0xf0 | ((i2c->msg->addr >> 7) & 0x6); + i2c->state = STATE_ADDR10; + } else { + addr = (i2c->msg->addr << 1); + i2c->state = STATE_START; + } + + /* Set read bit if necessary */ + addr |= (i2c->msg->flags & I2C_M_RD) ? 1 : 0; + + fpgai2c_reg_set(i2c, FPGAI2C_REG_DATA, addr); + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_START); + + return 0; + } + + /* Second part of 10 bit addressing */ + if (i2c->state == STATE_ADDR10) { + fpgai2c_reg_set(i2c, FPGAI2C_REG_DATA, i2c->msg->addr & 0xff); + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_WRITE); + + i2c->state = STATE_START; + return 0; + } + + if (i2c->state == STATE_START || i2c->state == STATE_WRITE) { + i2c->state = (msg->flags & I2C_M_RD) ? STATE_READ : STATE_WRITE; + + if (stat & FPGAI2C_REG_STAT_NACK) { + i2c->state = STATE_ERROR; + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_STOP); + return -ENXIO; + } + } else { + msg->buf[i2c->pos++] = fpgai2c_reg_get(i2c, FPGAI2C_REG_DATA); + } + + if (i2c->pos >= msg->len) { + i2c->nmsgs--; + i2c->msg++; + i2c->pos = 0; + msg = i2c->msg; + + if (i2c->nmsgs) { + if (!(msg->flags & I2C_M_NOSTART)) { + i2c->state = STATE_ADDR; + return 0; + } else { + i2c->state = (msg->flags & I2C_M_RD) + ? STATE_READ : STATE_WRITE; + } + } else { + i2c->state = STATE_DONE; + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_STOP); + return 0; + } + } + + if (i2c->state == STATE_READ) { + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, i2c->pos == (msg->len - 1) ? + FPGAI2C_REG_CMD_READ_NACK : FPGAI2C_REG_CMD_READ_ACK); + } else { + fpgai2c_reg_set(i2c, FPGAI2C_REG_DATA, msg->buf[i2c->pos++]); + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_WRITE); + } + + return 0; +} + +static ssize_t get_mod_msi(struct device *dev, struct device_attribute *devattr, char *buf) +{ + int ind = 0, port_status=0, port_irq_status=0; + struct fpgapci_dev *fpgapci = (struct fpgapci_dev*) dev_get_drvdata(dev); + PRINT("%s:xcvr_intr_count:%u\n", __FUNCTION__, fpgapci->xcvr_intr_count); + for(ind=0;ind<64;ind++) + { + port_status = ioread32(fpga_ctl_addr + PORT_STS_OFFSET + (ind*16)); + port_irq_status = ioread32(fpga_ctl_addr + PORT_IRQ_STS_OFFSET + (ind*16)); + PRINT("%s:port:%d, port_status:%#x, port_irq_status:%#x\n", __FUNCTION__, ind, port_status, port_irq_status); + } + return sprintf(buf,"0x%04x\n",fpgapci->xcvr_intr_count); +} +static DEVICE_ATTR(port_msi, S_IRUGO, get_mod_msi, NULL); + +static struct attribute *port_attrs[] = { + &dev_attr_port_msi.attr, + NULL, +}; + +static struct attribute_group port_attr_grp = { + .attrs = port_attrs, +}; + + +static irqreturn_t fpgaport_1_32_isr(int irq, void *dev) +{ + struct pci_dev *pdev = dev; + struct fpgapci_dev *fpgapci = (struct fpgapci_dev*) dev_get_drvdata(&pdev->dev); + int ind = 0, port_status=0, port_irq_status=0; + for(ind=0;ind<32;ind++) + { + port_irq_status = ioread32(fpga_ctl_addr + PORT_IRQ_STS_OFFSET + (ind*16)); + if(port_irq_status&(IRQ_LTCH_STS|PRSNT_LTCH_STS)) + { + PRINT("%s:port:%d, port_status:%#x, port_irq_status:%#x\n", __FUNCTION__, ind, port_status, port_irq_status); + //write on clear + iowrite32( IRQ_LTCH_STS|PRSNT_LTCH_STS,fpga_ctl_addr + PORT_IRQ_STS_OFFSET + (ind*16)); + } + } + fpgapci->xcvr_intr_count++; + PRINT("%s: xcvr_intr_count:%u\n", __FUNCTION__, fpgapci->xcvr_intr_count); + sysfs_notify(&pdev->dev.kobj, NULL, "port_msi"); + return IRQ_HANDLED; +} + +static irqreturn_t fpgaport_33_64_isr(int irq, void *dev) +{ + struct pci_dev *pdev = dev; + struct fpgapci_dev *fpgapci = (struct fpgapci_dev*) dev_get_drvdata(&pdev->dev); + int ind = 0, port_status=0, port_irq_status=0; + for(ind=32;ind<64;ind++) + { + port_irq_status = ioread32(fpga_ctl_addr + PORT_IRQ_STS_OFFSET + (ind*16)); + if(port_irq_status| (IRQ_LTCH_STS|PRSNT_LTCH_STS)) + { + PRINT("%s:port:%d, port_status:%#x, port_irq_status:%#x\n", __FUNCTION__, ind, port_status, port_irq_status); + iowrite32( IRQ_LTCH_STS|PRSNT_LTCH_STS,fpga_ctl_addr + PORT_IRQ_STS_OFFSET + (ind*16)); + } + } + fpgapci->xcvr_intr_count++; + PRINT("%s: xcvr_intr_count:%u\n", __FUNCTION__, fpgapci->xcvr_intr_count); + sysfs_notify(&pdev->dev.kobj, NULL, "port_msi"); + return IRQ_HANDLED; +} + +static void fpgai2c_process(struct fpgalogic_i2c *i2c) +{ + struct i2c_msg *msg = i2c->msg; + u8 stat = fpgai2c_reg_get(i2c, FPGAI2C_REG_STATUS); + + PRINT("fpgai2c_process in. status reg :0x%x\n", stat); + + if ((i2c->state == STATE_STOP) || (i2c->state == STATE_ERROR)) { + /* stop has been sent */ + PRINT("fpgai2c_process FPGAI2C_REG_CMD_IACK stat = 0x%x Set FPGAI2C_REG_CMD(0%x) FPGAI2C_REG_CMD_IACK = 0x%x\n" \ + ,stat, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_IACK); + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_IACK); + if(i2c->state == STATE_STOP) { + i2c->state = STATE_DONE; + } + wake_up(&i2c->wait); + return; + } + + + /* error? */ + if (stat & FPGAI2C_REG_STAT_ARBLOST) { + i2c->state = STATE_ERROR; + PRINT("fpgai2c_process FPGAI2C_REG_STAT_ARBLOST FPGAI2C_REG_CMD_STOP\n"); + fpgai2c_stop(i2c); + return; + } + + if ((i2c->state == STATE_START) || (i2c->state == STATE_WRITE)) { + i2c->state = + (msg->flags & I2C_M_RD) ? STATE_READ : STATE_WRITE; + + if (stat & FPGAI2C_REG_STAT_NACK) { + i2c->state = STATE_ERROR; + fpgai2c_stop(i2c); + return; + } + } else + { + msg->buf[i2c->pos++] = fpgai2c_reg_get(i2c, FPGAI2C_REG_DATA); + } + + /* end of msg? */ + if (i2c->pos == msg->len) { + i2c->nmsgs--; + i2c->msg++; + i2c->pos = 0; + msg = i2c->msg; + + if (i2c->nmsgs) { /* end? */ + /* send start? */ + if (!(msg->flags & I2C_M_NOSTART)) { + + u8 addr = (msg->addr << 1); + + if (msg->flags & I2C_M_RD) + addr |= 1; + + i2c->state = STATE_START; + fpgai2c_reg_set(i2c, FPGAI2C_REG_DATA, addr); + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_START); + return; + } else + { + i2c->state = (msg->flags & I2C_M_RD) + ? STATE_READ : STATE_WRITE; + } + } else { + i2c->state = STATE_STOP; + fpgai2c_stop(i2c); + return; + } + } + + if (i2c->state == STATE_READ) { + PRINT("fpgai2c_poll STATE_READ i2c->pos=%d msg->len-1 = 0x%x set FPGAI2C_REG_CMD = 0x%x\n",i2c->pos, msg->len-1, + i2c->pos == (msg->len-1) ? FPGAI2C_REG_CMD_READ_NACK : FPGAI2C_REG_CMD_READ_ACK); + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, i2c->pos == (msg->len-1) ? + FPGAI2C_REG_CMD_READ_NACK : FPGAI2C_REG_CMD_READ_ACK); + } else { + PRINT("fpgai2c_process set FPGAI2C_REG_DATA(0x%x)\n",FPGAI2C_REG_DATA); + fpgai2c_reg_set(i2c, FPGAI2C_REG_DATA, msg->buf[i2c->pos++]); + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_WRITE); + } +} + +static irqreturn_t fpgai2c_isr(int irq, void *dev_id) +{ + struct fpgalogic_i2c *i2c = dev_id; + fpgai2c_process(i2c); + + return IRQ_HANDLED; +} +void dell_get_mutex(struct fpgalogic_i2c *i2c) +{ + mutex_lock(&i2c->lock); +} + +/** + * dell_release_mutex - release mutex + */ +void dell_release_mutex(struct fpgalogic_i2c *i2c) +{ + mutex_unlock(&i2c->lock); +} + +static int fpgai2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) +{ + struct fpgalogic_i2c *i2c = i2c_get_adapdata(adap); + int ret; + unsigned long timeout = jiffies + msecs_to_jiffies(1000); + + i2c->msg = msgs; + i2c->pos = 0; + i2c->nmsgs = num; + i2c->state = (use_irq == 1) ? STATE_START : STATE_INIT; + + PRINT("i2c->msg->addr = 0x%x i2c->msg->flags = 0x%x\n",i2c->msg->addr,i2c->msg->flags); + PRINT("I2C_M_RD = 0x%x i2c->msg->addr << 1 = 0x%x\n",I2C_M_RD,i2c->msg->addr << 1); + + if (!use_irq) { + /* Handle the transfer */ + while (time_before(jiffies, timeout)) { + dell_get_mutex(i2c); + ret = fpgai2c_poll(i2c); + dell_release_mutex(i2c); + + if (i2c->state == STATE_DONE || i2c->state == STATE_ERROR) + return (i2c->state == STATE_DONE) ? num : ret; + + if (ret == 0) + timeout = jiffies + HZ; + + usleep_range(5, 15); + } + + i2c->state = STATE_ERROR; + + return -ETIMEDOUT; + + + } else { + ret = -ETIMEDOUT; + PRINT("Set FPGAI2C_REG_DATA(0%x) val = 0x%x\n",FPGAI2C_REG_DATA, + (i2c->msg->addr << 1) | ((i2c->msg->flags & I2C_M_RD) ? 1:0)); + + fpgai2c_reg_set(i2c, FPGAI2C_REG_DATA, + (i2c->msg->addr << 1) | + ((i2c->msg->flags & I2C_M_RD) ? 1:0)); + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_START); + + /* Interrupt mode */ + if (wait_event_timeout(i2c->wait, (i2c->state == STATE_ERROR) || + (i2c->state == STATE_DONE), HZ)) + ret = (i2c->state == STATE_DONE) ? num : -EIO; + return ret; + } +} + +static int fpgai2c_init(struct fpgalogic_i2c *i2c) +{ + int prescale; + int diff; + u8 ctrl; + + if (i2c->reg_io_width == 0) + i2c->reg_io_width = 1; /* Set to default value */ + + if (!i2c->reg_set || !i2c->reg_get) { + bool be = 0; //1:big_endian 0:little_endian + + switch (i2c->reg_io_width) { + case 1: + i2c->reg_set = fpgai2c_reg_set_8; + i2c->reg_get = fpgai2c_reg_get_8; + break; + + case 2: + i2c->reg_set = be ? fpgai2c_reg_set_16be : fpgai2c_reg_set_16; + i2c->reg_get = be ? fpgai2c_reg_get_16be : fpgai2c_reg_get_16; + break; + + case 4: + i2c->reg_set = be ? fpgai2c_reg_set_32be : fpgai2c_reg_set_32; + i2c->reg_get = be ? fpgai2c_reg_get_32be : fpgai2c_reg_get_32; + break; + + default: + PRINT("Unsupported I/O width (%d)\n", + i2c->reg_io_width); + return -EINVAL; + } + } + + ctrl = fpgai2c_reg_get(i2c, FPGAI2C_REG_CONTROL); + + PRINT("%s(), line:%d\n", __func__, __LINE__); + PRINT("i2c->base = 0x%p\n",i2c->base); + + PRINT("ctrl = 0x%x\n",ctrl); + PRINT("set ctrl = 0x%x\n",ctrl & ~(FPGAI2C_REG_CTRL_EN|FPGAI2C_REG_CTRL_IEN)); + + /* make sure the device is disabled */ + fpgai2c_reg_set(i2c, FPGAI2C_REG_CONTROL, ctrl & ~(FPGAI2C_REG_CTRL_EN|FPGAI2C_REG_CTRL_IEN)); + + /* + * I2C Frequency depends on host clock + * input clock of 100MHz + * prescale to 100MHz / ( 5*100kHz) -1 = 199 = 0x4F 100000/(5*100)-1=199=0xc7 + */ + prescale = (i2c->ip_clock_khz / (5 * i2c->bus_clock_khz)) - 1; + prescale = clamp(prescale, 0, 0xffff); + + diff = i2c->ip_clock_khz / (5 * (prescale + 1)) - i2c->bus_clock_khz; + if (abs(diff) > i2c->bus_clock_khz / 10) { + PRINT("Unsupported clock settings: core: %d KHz, bus: %d KHz\n", + i2c->ip_clock_khz, i2c->bus_clock_khz); + return -EINVAL; + } + + fpgai2c_reg_set(i2c, FPGAI2C_REG_PRELOW, prescale & 0xff); + fpgai2c_reg_set(i2c, FPGAI2C_REG_PREHIGH, prescale >> 8); + + /* Init the device */ + fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_IACK); + if (!use_irq) + fpgai2c_reg_set(i2c, FPGAI2C_REG_CONTROL, ctrl | FPGAI2C_REG_CTRL_EN); + else + fpgai2c_reg_set(i2c, FPGAI2C_REG_CONTROL, ctrl | FPGAI2C_REG_CTRL_IEN | FPGAI2C_REG_CTRL_EN); + + fpgai2c_dump(i2c); + + /* Initialize interrupt handlers if not already done */ + init_waitqueue_head(&i2c->wait); + + return 0; +} + + +static u32 fpgai2c_func(struct i2c_adapter *adap) +{ + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; +} + +static const struct i2c_algorithm fpgai2c_algorithm = { + .master_xfer = fpgai2c_xfer, + .functionality = fpgai2c_func, +}; + +static int i2c_pci_add_bus (struct i2c_adapter *adap) +{ + int ret = 0; + /* Register new adapter */ + adap->algo = &fpgai2c_algorithm; + ret = i2c_add_numbered_adapter(adap); + return ret; +} + +static int i2c_init_internal_data(void) +{ + int i; + PRINT("%s(), line:%d\n", __func__, __LINE__); + + for( i = 0; i < total_i2c_pci_bus; i++ ) + { + fpgalogic_i2c[i].reg_shift = 0; /* 8 bit registers */ + fpgalogic_i2c[i].reg_io_width = 1; /* 8 bit read/write */ + fpgalogic_i2c[i].timeout = 500;//1000;//1ms + fpgalogic_i2c[i].ip_clock_khz = 100000;//100000;/* input clock of 100MHz */ + fpgalogic_i2c[i].bus_clock_khz = 100; + fpgalogic_i2c[i].base = fpga_base_addr + i*FPGALOGIC_CH_OFFSET; + mutex_init(&fpgalogic_i2c[i].lock); + fpgai2c_init(&fpgalogic_i2c[i]); + } + + return 0; +} + + +static int i2c_pci_init (void) +{ + int i; + + if (num_bus == 0) { + board_rev_type = ioread32(fpga_ctl_addr + MB_BRD_REV_TYPE); + + if ((board_rev_type & MB_BRD_REV_MASK) == MB_BRD_REV_00) { + num_bus = I2C_PCI_MAX_BUS_REV00; + } else if (((board_rev_type & MB_BRD_REV_MASK) == MB_BRD_REV_01) || + ((board_rev_type & MB_BRD_REV_MASK) == MB_BRD_REV_02) || + ((board_rev_type & MB_BRD_REV_MASK) == MB_BRD_REV_03)) { + switch (board_rev_type & MB_BRD_TYPE_MASK){ + case BRD_TYPE_S5212_NON_NEBS: + case BRD_TYPE_S5212_NEBS: + num_bus = I2C_PCI_BUS_NUM_5; + break; + case BRD_TYPE_S5224_NON_NEBS: + case BRD_TYPE_S5224_NEBS: + num_bus = I2C_PCI_BUS_NUM_7; + break; + case BRD_TYPE_Z9232_NON_NEBS: + case BRD_TYPE_Z9232_NEBS: + case BRD_TYPE_S5232_NON_NEBS: + case BRD_TYPE_S5232_NEBS: + num_bus = I2C_PCI_BUS_NUM_8; + break; + case BRD_TYPE_S5248_NON_NEBS: + case BRD_TYPE_S5248_NEBS: + num_bus = I2C_PCI_BUS_NUM_10; + break; + case BRD_TYPE_Z9264_NON_NEBS: + case BRD_TYPE_Z9264_NEBS: + num_bus = I2C_PCI_BUS_NUM_12; + break; + case BRD_TYPE_S5296_NON_NEBS: + case BRD_TYPE_S5296_NEBS: + num_bus = I2C_PCI_BUS_NUM_16; + break; + default: + num_bus = I2C_PCI_BUS_NUM_16; + printk("Wrong BRD_TYPE: 0x%x\n", board_rev_type); + break; + } + } else { + printk("unknown board_rev_type 0x%x\n", board_rev_type); + num_bus = I2C_PCI_BUS_NUM_8; + } + } + + printk("board_rev_type 0x%x, num_bus 0x%x\n", board_rev_type, num_bus); + total_i2c_pci_bus = num_bus; + + memset (&i2c_pci_adap, 0, sizeof(i2c_pci_adap)); + memset (&fpgalogic_i2c, 0, sizeof(fpgalogic_i2c)); + for(i=0; i < i2c_bus_controller_numb; i++) + mutex_init(&i2c_xfer_lock[i]); + + /* Initialize driver's itnernal data structures */ + i2c_init_internal_data(); + + for (i = 0 ; i < total_i2c_pci_bus; i ++) { + + i2c_pci_adap[i].owner = THIS_MODULE; + i2c_pci_adap[i].class = I2C_CLASS_HWMON | I2C_CLASS_SPD; + + i2c_pci_adap[i].algo_data = &fpgalogic_i2c[i]; + /* /dev/i2c-600 ~ /dev/i2c-615 for FPGA LOGIC I2C channel controller 1-7 */ + i2c_pci_adap[i].nr = i+600; + sprintf( i2c_pci_adap[ i ].name, "i2c-pci-%d", i ); + /* Add the bus via the algorithm code */ + if( i2c_pci_add_bus( &i2c_pci_adap[ i ] ) != 0 ) + { + PRINT("Cannot add bus %d to algorithm layer\n", i ); + return( -ENODEV ); + } + i2c_set_adapdata(&i2c_pci_adap[i], &fpgalogic_i2c[i]); + + PRINT( "Registered bus id: %s\n", kobject_name(&i2c_pci_adap[ i ].dev.kobj)); + } + + return 0; +} + +static void i2c_pci_deinit(void) +{ + int i; + for( i = 0; i < total_i2c_pci_bus; i++ ){ + i2c_del_adapter(&i2c_pci_adap[i]); + } + +} + +/* Find upstream PCIe root node. + * Used for re-training and disabling AER. */ +static struct pci_dev* find_upstream_dev (struct pci_dev *dev) +{ + struct pci_bus *bus = 0; + struct pci_dev *bridge = 0; + struct pci_dev *cur = 0; + int found_dev = 0; + + bus = dev->bus; + if (bus == 0) { + PRINT ( "Device doesn't have an associated bus!\n"); + return 0; + } + + bridge = bus->self; + if (bridge == 0) { + PRINT ( "Can't get the bridge for the bus!\n"); + return 0; + } + + PRINT ( "Upstream device %x/%x, bus:slot.func %02x:%02x.%02x\n", + bridge->vendor, bridge->device, + bridge->bus->number, PCI_SLOT(bridge->devfn), PCI_FUNC(bridge->devfn)); + + PRINT ( "List of downstream devices:"); + list_for_each_entry (cur, &bus->devices, bus_list) { + if (cur != 0) { + PRINT ( " %x/%x", cur->vendor, cur->device); + if (cur == dev) { + found_dev = 1; + } + } + } + PRINT ( "\n"); + if (found_dev) { + return bridge; + } else { + PRINT ( "Couldn't find upstream device!\n"); + return 0; + } +} + + +static int scan_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev) +{ + int i; + + for (i = 0; i < PCI_NUM_BARS; i++) { + unsigned long bar_start = pci_resource_start(dev, i); + if (bar_start) { + unsigned long bar_end = pci_resource_end(dev, i); + unsigned long bar_flags = pci_resource_flags(dev, i); + PRINT ( "BAR[%d] 0x%08lx-0x%08lx flags 0x%08lx", + i, bar_start, bar_end, bar_flags); + } + } + + return 0; +} + + +/** + * Map the device memory regions into kernel virtual address space + * after verifying their sizes respect the minimum sizes needed, given + * by the bar_min_len[] array. + */ +static int map_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev) +{ + int i; + + for (i = 0; i < PCI_NUM_BARS; i++){ + phys_addr_t bar_start = pci_resource_start(dev, i); + phys_addr_t bar_end = pci_resource_end(dev, i); + unsigned long bar_length = bar_end - bar_start + 1; + fpgapci->bar_length[i] = bar_length; + + + if (!bar_start || !bar_end) { + fpgapci->bar_length[i] = 0; + continue; + } + + if (bar_length < 1) { + PRINT ( "BAR #%d length is less than 1 byte\n", i); + continue; + } + + PRINT ( "bar_start=%llx, bar_end=%llx, bar_length=%lx, flag=%lx\n", bar_start, + bar_end, bar_length, pci_resource_flags(dev, i)); + + /* map the device memory or IO region into kernel virtual + * address space */ + fpgapci->bar[i] = ioremap(bar_start + FPGALOGIC_I2C_BASE, I2C_PCI_MAX_BUS * FPGALOGIC_CH_OFFSET); + + if (!fpgapci->bar[i]) { + PRINT ( "Could not map BAR #%d.\n", i); + return -1; + } + + PRINT ( "BAR[%d] mapped at 0x%p with length %lu.", i, + fpgapci->bar[i], bar_length); + + if(i == 0) //FPGA register is in the BAR[0] + { + + fpga_phys_addr = bar_start; + fpga_ctl_addr = ioremap(bar_start, FPGA_CTL_REG_SIZE); + fpga_base_addr = fpgapci->bar[i]; + } + + PRINT ( "BAR[%d] mapped at 0x%p with length %lu.\n", i, + fpgapci->bar[i], bar_length); + } + return 0; +} + +static void free_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev) +{ + int i; + + for (i = 0; i < PCI_NUM_BARS; i++) { + if (fpgapci->bar[i]) { + pci_iounmap(dev, fpgapci->bar[i]); + fpgapci->bar[i] = NULL; + } + } +} + +#define FPGA_PCI_NAME "FPGA_PCI" + +/** + * @brief Register specific function with msi interrupt line + * @param dev Pointer to pci-device, which should be allocated + * @param int interrupt number relative to global interrupt number + * @return Returns error code or zero if success + * */ +static int register_intr_handler(struct pci_dev *dev, int irq_num_id) +{ + int err = 0; + struct fpgapci_dev *fpgapci = 0; + + fpgapci = (struct fpgapci_dev*) dev_get_drvdata(&dev->dev); + if (fpgapci == 0) { + PRINT ( ": fpgapci_dev is 0\n"); + return err; + } + + if ((board_rev_type & MB_BRD_REV_MASK) == MB_BRD_REV_00) { + /* Request interrupt line for unique function + * alternatively function will be called from free_irq as well + * with flag IRQF_SHARED */ + switch(irq_num_id) { + /* Currently we only support test vector 2 for FPGA Logic I2C channel + * controller 1-7 interrupt*/ + case FPGA_MSI_VECTOR_ID_4: + err = request_irq(dev->irq + irq_num_id, fpgaport_1_32_isr, IRQF_EARLY_RESUME, + FPGA_PCI_NAME, dev); + PRINT ( "%d: fpgapci_dev: irq: %d, %d\n", __LINE__, dev->irq, irq_num_id); + fpgapci->irq_assigned++; + break; + case FPGA_MSI_VECTOR_ID_5: + err = request_irq(dev->irq + irq_num_id, fpgaport_33_64_isr, IRQF_EARLY_RESUME, + FPGA_PCI_NAME, dev); + PRINT ( "%d: fpgapci_dev: irq: %d, %d\n", __LINE__, dev->irq, irq_num_id); + fpgapci->irq_assigned++; + break; + case FPGA_MSI_VECTOR_ID_8: + err = request_irq(dev->irq + irq_num_id, fpgai2c_isr, IRQF_EARLY_RESUME, + FPGA_PCI_NAME, &fpgalogic_i2c[0]); + fpgapci->irq_assigned++; + break; + case FPGA_MSI_VECTOR_ID_9: + err = request_irq(dev->irq + irq_num_id, fpgai2c_isr, IRQF_EARLY_RESUME, + FPGA_PCI_NAME, &fpgalogic_i2c[1]); + fpgapci->irq_assigned++; + break; + case FPGA_MSI_VECTOR_ID_10: + err = request_irq(dev->irq + irq_num_id, fpgai2c_isr, IRQF_EARLY_RESUME, + FPGA_PCI_NAME, &fpgalogic_i2c[2]); + fpgapci->irq_assigned++; + break; + case FPGA_MSI_VECTOR_ID_11: + err = request_irq(dev->irq + irq_num_id, fpgai2c_isr, IRQF_EARLY_RESUME, + FPGA_PCI_NAME, &fpgalogic_i2c[3]); + fpgapci->irq_assigned++; + break; + case FPGA_MSI_VECTOR_ID_12: + err = request_irq(dev->irq + irq_num_id, fpgai2c_isr, IRQF_EARLY_RESUME, + FPGA_PCI_NAME, &fpgalogic_i2c[4]); + fpgapci->irq_assigned++; + break; + case FPGA_MSI_VECTOR_ID_13: + err = request_irq(dev->irq + irq_num_id, fpgai2c_isr, IRQF_EARLY_RESUME, + FPGA_PCI_NAME, &fpgalogic_i2c[5]); + fpgapci->irq_assigned++; + break; + case FPGA_MSI_VECTOR_ID_14: + err = request_irq(dev->irq + irq_num_id, fpgai2c_isr, IRQF_EARLY_RESUME, + FPGA_PCI_NAME, &fpgalogic_i2c[6]); + fpgapci->irq_assigned++; + break; + + default: + PRINT("No more interrupt handler for number (%d)\n", + dev->irq + irq_num_id); + break; + } + } else if (((board_rev_type & MB_BRD_REV_MASK) == MB_BRD_REV_01) || + ((board_rev_type & MB_BRD_REV_MASK) == MB_BRD_REV_02) || + ((board_rev_type & MB_BRD_REV_MASK) == MB_BRD_REV_03)) { + /* FPGA SPEC 4.3.1.34, First i2c channel mapped to vector 8 */ + switch (irq_num_id) { + case FPGA_MSI_VECTOR_ID_4: + err = request_irq(dev->irq + irq_num_id, fpgaport_1_32_isr, IRQF_EARLY_RESUME, + FPGA_PCI_NAME, dev); + PRINT ( "%d: fpgapci_dev: irq: %d, %d\n", __LINE__, dev->irq, irq_num_id); + fpgapci->irq_assigned++; + break; + case FPGA_MSI_VECTOR_ID_5: + err = request_irq(dev->irq + irq_num_id, fpgaport_33_64_isr, IRQF_EARLY_RESUME, + FPGA_PCI_NAME, dev); + PRINT ( "%d: fpgapci_dev: irq: %d, %d\n", __LINE__, dev->irq, irq_num_id); + fpgapci->irq_assigned++; + break; + case FPGA_MSI_VECTOR_ID_8: + err = request_irq(dev->irq + irq_num_id, fpgai2c_isr, IRQF_EARLY_RESUME, + FPGA_PCI_NAME, &fpgalogic_i2c[0]); + fpgapci->irq_assigned++; + break; + case FPGA_MSI_VECTOR_ID_9: + err = request_irq(dev->irq + irq_num_id, fpgai2c_isr, IRQF_EARLY_RESUME, + FPGA_PCI_NAME, &fpgalogic_i2c[1]); + fpgapci->irq_assigned++; + break; + case FPGA_MSI_VECTOR_ID_10: + err = request_irq(dev->irq + irq_num_id, fpgai2c_isr, IRQF_EARLY_RESUME, + FPGA_PCI_NAME, &fpgalogic_i2c[2]); + fpgapci->irq_assigned++; + break; + case FPGA_MSI_VECTOR_ID_11: + err = request_irq(dev->irq + irq_num_id, fpgai2c_isr, IRQF_EARLY_RESUME, + FPGA_PCI_NAME, &fpgalogic_i2c[3]); + fpgapci->irq_assigned++; + break; + case FPGA_MSI_VECTOR_ID_12: + err = request_irq(dev->irq + irq_num_id, fpgai2c_isr, IRQF_EARLY_RESUME, + FPGA_PCI_NAME, &fpgalogic_i2c[4]); + fpgapci->irq_assigned++; + break; + case FPGA_MSI_VECTOR_ID_13: + if (total_i2c_pci_bus > I2C_PCI_BUS_NUM_5) { + err = request_irq(dev->irq + irq_num_id, fpgai2c_isr, + IRQF_EARLY_RESUME, FPGA_PCI_NAME, &fpgalogic_i2c[5]); + fpgapci->irq_assigned++; + } + break; + case FPGA_MSI_VECTOR_ID_14: + if (total_i2c_pci_bus > I2C_PCI_BUS_NUM_5) { + err = request_irq(dev->irq + irq_num_id, fpgai2c_isr, + IRQF_EARLY_RESUME, FPGA_PCI_NAME, &fpgalogic_i2c[6]); + fpgapci->irq_assigned++; + } + break; + case FPGA_MSI_VECTOR_ID_15: + /*it is an external interrupt number. Ignore this case */ + break; + case FPGA_MSI_VECTOR_ID_16: + if (total_i2c_pci_bus > I2C_PCI_BUS_NUM_7) { + err = request_irq(dev->irq + irq_num_id, fpgai2c_isr, + IRQF_EARLY_RESUME, FPGA_PCI_NAME, &fpgalogic_i2c[7]); + fpgapci->irq_assigned++; + } + break; + case FPGA_MSI_VECTOR_ID_17: + if (total_i2c_pci_bus > I2C_PCI_BUS_NUM_8) { + err = request_irq(dev->irq + irq_num_id, fpgai2c_isr, + IRQF_EARLY_RESUME, FPGA_PCI_NAME, &fpgalogic_i2c[8]); + fpgapci->irq_assigned++; + } + break; + case FPGA_MSI_VECTOR_ID_18: + if (total_i2c_pci_bus > I2C_PCI_BUS_NUM_8) { + err = request_irq(dev->irq + irq_num_id, fpgai2c_isr, + IRQF_EARLY_RESUME, FPGA_PCI_NAME, &fpgalogic_i2c[9]); + fpgapci->irq_assigned++; + } + break; + case FPGA_MSI_VECTOR_ID_19: + if (total_i2c_pci_bus > I2C_PCI_BUS_NUM_10) { + err = request_irq(dev->irq + irq_num_id, fpgai2c_isr, + IRQF_EARLY_RESUME, FPGA_PCI_NAME, &fpgalogic_i2c[10]); + fpgapci->irq_assigned++; + } + break; + case FPGA_MSI_VECTOR_ID_20: + if (total_i2c_pci_bus > I2C_PCI_BUS_NUM_10) { + err = request_irq(dev->irq + irq_num_id, fpgai2c_isr, + IRQF_EARLY_RESUME, FPGA_PCI_NAME, &fpgalogic_i2c[11]); + fpgapci->irq_assigned++; + } + break; + case FPGA_MSI_VECTOR_ID_21: + if (total_i2c_pci_bus > I2C_PCI_BUS_NUM_12) { + err = request_irq(dev->irq + irq_num_id, fpgai2c_isr, + IRQF_EARLY_RESUME, FPGA_PCI_NAME, &fpgalogic_i2c[12]); + fpgapci->irq_assigned++; + } + break; + case FPGA_MSI_VECTOR_ID_22: + if (total_i2c_pci_bus > I2C_PCI_BUS_NUM_12) { + err = request_irq(dev->irq + irq_num_id, fpgai2c_isr, + IRQF_EARLY_RESUME, FPGA_PCI_NAME, &fpgalogic_i2c[13]); + fpgapci->irq_assigned++; + } + break; + case FPGA_MSI_VECTOR_ID_23: + if (total_i2c_pci_bus > I2C_PCI_BUS_NUM_12) { + err = request_irq(dev->irq + irq_num_id, fpgai2c_isr, + IRQF_EARLY_RESUME, FPGA_PCI_NAME, &fpgalogic_i2c[14]); + fpgapci->irq_assigned++; + } + break; + case FPGA_MSI_VECTOR_ID_24: + if (total_i2c_pci_bus > I2C_PCI_BUS_NUM_12) { + err = request_irq(dev->irq + irq_num_id, fpgai2c_isr, + IRQF_EARLY_RESUME, FPGA_PCI_NAME, &fpgalogic_i2c[15]); + fpgapci->irq_assigned++; + } + break; + + default: + PRINT("No more interrupt handler for number (%d)\n", + dev->irq + irq_num_id); + break; + } + } + + return err; +} +/* Mask for MSI Multi message enable bits */ +#define MSI_MME 0x70 +/** + * These enums define the type of interrupt scheme that the overall + * system uses. + */ +enum fpga_irq_type { + INT_MSI_SINGLE, + INT_MSI_MULTI, + INT_MSIX, + INT_NONE, + INT_FENCE /* Last item to guard from loop run-overs */ +}; +/** + * @def PCI_DEVICE_STATUS + * define the offset for STS register + * from the start of PCI config space as specified in the + * NVME_Comliance 1.0b. offset 06h:STS - Device status. + * This register has error status for NVME PCI Exress + * Card. After reading data from this reagister, the driver + * will identify if any error is set during the operation and + * report as kernel alert message. + */ +#define PCI_DEVICE_STATUS 0x6 +/** + * @def NEXT_MASK + * This indicates the location of the next capability item + * in the list. + */ +#define NEXT_MASK 0xFF00 +/** + * @def MSIXCAP_ID + * This bit indicates if the pointer leading to this position + * is a capability. + */ +#define MSIXCAP_ID 0x11 +/** + * @def MSICAP_ID + * This bit indicates if the pointer leading to this position + * is a capability. + */ +#define MSICAP_ID 0x5 + +/** + * @def CL_MASK + * This bit position indicates Capabilities List of the controller + * The controller should support the PCI Power Management cap as a + * minimum. + */ +#define CL_MASK 0x0010 + +/** + * @def CAP_REG + * Set to offset defined in NVME Spec 1.0b. + */ +#define CAP_REG 0x34 +static void msi_set_enable(struct pci_dev *dev, int enable) +{ + int pos,maxvec; + u16 control; + int request_private_bits = 4; + + pos = pci_find_capability(dev, PCI_CAP_ID_MSI); + + if (pos) { + pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &control); + maxvec = 1 << ((control & PCI_MSI_FLAGS_QMASK) >> 1); + PRINT("control = 0x%x maxvec = 0x%x\n", control, maxvec); + control &= ~PCI_MSI_FLAGS_ENABLE; + + + /* + * The PCI 2.3 spec mandates that there are at most 32 + * interrupts. If this device asks for more, only give it one. + */ + if (request_private_bits > 5) { + request_private_bits = 0; + } + + /* Update the number of IRQs the device has available to it */ + control &= ~PCI_MSI_FLAGS_QSIZE; + control |= (request_private_bits << 4); + + pci_write_config_word(dev, pos + PCI_MSI_FLAGS, control); + } +} +/** + * @brief Enables pcie-device and claims/remaps neccessary bar resources + * @param dev Pointer to pci-device, which should be allocated + * @return Returns error code or zero if success + * */ +static int fpgapci_setup_device(struct fpgapci_dev *fpgapci,struct pci_dev *dev) +{ + int err = 0; + + /* wake up the pci device */ + err = pci_enable_device(dev); + if(err) { + PRINT("failed to enable pci device %d\n", err); + goto error_pci_en; + } + + /* on platforms with buggy ACPI, pdev->msi_enabled may be set to + * allow pci_enable_device to work. This indicates INTx was not routed + * and only MSI should be used + */ + + pci_set_master(dev); + + /* Setup the BAR memory regions */ + err = pci_request_regions(dev, DRIVER_NAME); + if (err) { + PRINT("failed to enable pci device %d\n", err); + goto error_pci_req; + } + + scan_bars(fpgapci, dev); + + if (map_bars(fpgapci, dev)) { + goto fail_map_bars; + } + + i2c_pci_init(); + + return 0; + /* ERROR HANDLING */ +fail_map_bars: + pci_release_regions(dev); +error_pci_req: + pci_disable_device(dev); +error_pci_en: + return -ENODEV; +} + +static int fpgapci_configure_msi(struct fpgapci_dev *fpgapci,struct pci_dev *dev) +{ + int err = 0, i; + int request_vec; + + msi_set_enable(dev,1); + PRINT("Check MSI capability after msi_set_enable\n"); + + + /*Above 4.1.12*/ + request_vec = total_i2c_pci_bus; + err = pci_alloc_irq_vectors(dev, request_vec, pci_msi_vec_count(dev), + PCI_IRQ_MSI);//PCI_IRQ_AFFINITY | PCI_IRQ_MSI); + + if (err <= 0) { + PRINT("Cannot set MSI vector (%d)\n", err); + goto error_no_msi; + } else { + PRINT("Got %d MSI vectors starting at %d\n", err, dev->irq); + if ((board_rev_type & MB_BRD_REV_MASK) == MB_BRD_REV_00) { + if (err < MSI_VECTOR_REV_00) { + goto error_disable_msi; + } + } else if (((board_rev_type & MB_BRD_REV_MASK) == MB_BRD_REV_01) || + ((board_rev_type & MB_BRD_REV_MASK) == MB_BRD_REV_02) || + ((board_rev_type & MB_BRD_REV_MASK) == MB_BRD_REV_03)) { + if (err < MSI_VECTOR_REV_01) { + goto error_disable_msi; + } + } + } + fpgapci->irq_first = dev->irq; + fpgapci->irq_length = err; + fpgapci->irq_assigned = 0; + + + for(i = 0; i < fpgapci->irq_length; i++) { + err = register_intr_handler(dev, i); + if (err) { + PRINT("Cannot request Interrupt number %d\n", i); + goto error_pci_req_irq; + } + } + + return 0; + +error_pci_req_irq: + for(i = 0; i < fpgapci->irq_assigned; i++) + { + PRINT("free_irq %d i =%d\n",fpgapci->irq_first + i,i); + if (i < 7) + free_irq(fpgapci->irq_first + 8 + i, &fpgalogic_i2c[i]); + else + free_irq(fpgapci->irq_first + 8 + i + 1, &fpgalogic_i2c[i]); + } +error_disable_msi: + pci_disable_msi(fpgapci->pci_dev); +error_no_msi: + return -ENOSPC; +} + +static int fpgapci_probe(struct pci_dev *dev, const struct pci_device_id *id) +{ + struct fpgapci_dev *fpgapci = 0; + +#ifdef TEST + PRINT ( " vendor = 0x%x, device = 0x%x, class = 0x%x, bus:slot.func = %02x:%02x.%02x\n", + dev->vendor, dev->device, dev->class, + dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); +#endif + fpgapci = kzalloc(sizeof(struct fpgapci_dev), GFP_KERNEL); + + if (!fpgapci) { + PRINT( "Couldn't allocate memory!\n"); + goto fail_kzalloc; + } + + fpgapci->pci_dev = dev; + dev_set_drvdata(&dev->dev, (void*)fpgapci); + + + fpgapci->upstream = find_upstream_dev (dev); + + if(fpgapci_setup_device(fpgapci,dev)) { + goto error_no_device; + } + + printk("%s:MSI-irq disabled \n", __FUNCTION__); + + if (use_irq) { + printk("%s:MSI-irq enabled\n", __FUNCTION__); + if(fpgapci_configure_msi(fpgapci,dev)) { + goto error_cannot_configure; + } + } + + + return 0; + /* ERROR HANDLING */ +error_cannot_configure: + printk("error_cannot_configure\n"); + free_bars (fpgapci, dev); + pci_release_regions(dev); + pci_disable_device(dev); +error_no_device: + i2c_pci_deinit(); + printk("error_no_device\n"); +fail_kzalloc: + return -1; + + +} + +static void fpgapci_remove(struct pci_dev *dev) +{ + struct fpgapci_dev *fpgapci = 0; + int i; + PRINT (": dev is %p\n", dev); + + if (dev == 0) { + PRINT ( ": dev is 0\n"); + return; + } + + fpgapci = (struct fpgapci_dev*) dev_get_drvdata(&dev->dev); + if (fpgapci == 0) { + PRINT ( ": fpgapci_dev is 0\n"); + return; + } + i2c_pci_deinit(); + // + if (use_irq) + { + for(i = 0; i < fpgapci->irq_assigned; i++) + { + PRINT("free_irq %d i =%d\n",fpgapci->irq_first + i,i); + if (i < 7) + free_irq(fpgapci->irq_first + 8 + i, &fpgalogic_i2c[i]); + else + free_irq(fpgapci->irq_first + 8 + i + 1, &fpgalogic_i2c[i]); + } + } + pci_disable_msi(fpgapci->pci_dev); + free_bars (fpgapci, dev); + pci_disable_device(dev); + pci_release_regions(dev); + + kfree (fpgapci); +} + +static const struct pci_device_id fpgapci_ids[] = { + {PCI_DEVICE(PCI_VENDOR_ID_XILINX, DEVICE)}, + {0, }, +}; + +MODULE_DEVICE_TABLE(pci, fpgapci_ids); + +static struct pci_driver fpgapci_driver = { + .name = DRIVER_NAME, + .id_table = fpgapci_ids, + .probe = fpgapci_probe, + .remove = fpgapci_remove, + /* resume, suspend are optional */ +}; + +/* Initialize the driver module (but not any device) and register + * the module with the kernel PCI subsystem. */ +static int __init fpgapci_init(void) +{ + + if (pci_register_driver(&fpgapci_driver)) { + PRINT("pci_unregister_driver\n"); + pci_unregister_driver(&fpgapci_driver); + return -ENODEV; + } + + return 0; +} + +static void __exit fpgapci_exit(void) +{ + PRINT ("fpgapci_exit"); + + /* unregister this driver from the PCI bus driver */ + pci_unregister_driver(&fpgapci_driver); + +} + + +module_init (fpgapci_init); +module_exit (fpgapci_exit); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("joyce_yu@dell.com"); +MODULE_DESCRIPTION ("Driver for FPGA Logic I2C bus"); +MODULE_SUPPORTED_DEVICE ("FPGA Logic I2C bus"); + diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/check_qsfp.sh b/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/check_qsfp.sh new file mode 100755 index 000000000000..e3628b234c13 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/check_qsfp.sh @@ -0,0 +1,3 @@ +# Temporary dummy file for s5212f. +# Will be updated soon. + diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/pcisysfs.py b/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/pcisysfs.py new file mode 100755 index 000000000000..1ca22db926f5 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/pcisysfs.py @@ -0,0 +1,102 @@ +#!/usr/bin/python +# Copyright (c) 2015 Dell Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT +# LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS +# FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. +# +# See the Apache Version 2.0 License for specific language governing +# permissions and limitations under the License. + +import struct +import sys +import getopt +from os import * +from mmap import * + +def usage(): + ''' This is the Usage Method ''' + + print('\t\t pcisysfs.py --get --offset --res ') + print('\t\t pcisysfs.py --set --val --offset --res ') + sys.exit(1) + +def pci_mem_read(mm,offset): + mm.seek(offset) + read_data_stream=mm.read(4) + print("") + reg_val=struct.unpack('I',read_data_stream) + print("reg_val read:%x"%reg_val) + return reg_val + +def pci_mem_write(mm,offset,data): + mm.seek(offset) + print("data to write:%x"%data) + mm.write(struct.pack('I',data)) + +def pci_set_value(resource,val,offset): + fd=open(resource,O_RDWR) + mm=mmap(fd,0) + pci_mem_write(mm,offset,val) + +def pci_get_value(resource,offset): + fd=open(resource,O_RDWR) + mm=mmap(fd,0) + pci_mem_read(mm,offset) + +def main(argv): + + ''' The main function will read the user input from the + command line argument and process the request ''' + + opts = '' + val = '' + choice = '' + resource = '' + offset = '' + + try: + opts, args = getopt.getopt(argv, "hgsv:" , \ + ["val=","res=","offset=","help", "get", "set"]) + + except getopt.GetoptError: + usage() + + for opt,arg in opts: + + if opt in ('-h','--help'): + choice = 'help' + + elif opt in ('-g', '--get'): + choice = 'get' + + elif opt in ('-s', '--set'): + choice = 'set' + + elif opt == '--res': + resource = arg + + elif opt == '--val': + val = int(arg,16) + + elif opt == '--offset': + offset = int(arg,16) + + if choice == 'set' and val != '' and offset !='' and resource !='': + pci_set_value(resource,val,offset) + + elif choice == 'get' and offset != '' and resource !='': + pci_get_value(resource,offset) + + else: + usage() + +#Calling the main method +if __name__ == "__main__": + main(sys.argv[1:]) + diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/platform_sensors.py b/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/platform_sensors.py new file mode 100755 index 000000000000..0fc484be2f07 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/platform_sensors.py @@ -0,0 +1,125 @@ +#!/usr/bin/python +# On S5212F, the BaseBoard Management Controller is an +# autonomous subsystem provides monitoring and management +# facility independent of the host CPU. IPMI standard +# protocol is used with ipmitool to fetch sensor details. +# Current script support X00 board only. X01 support will +# be added soon. This provies support for the +# following objects: +# * Onboard temperature sensors +# * FAN trays +# * PSU + + +import sys +import logging +import commands + +S5212F_MAX_FAN_TRAYS = 4 +IPMI_SENSOR_DATA = "ipmitool sdr list" + +switch_sku = { + "0K6MG9":(' AC', ' Exhaust'), + "0GKK8W":(' AC', ' Intake'), + "0VK93C":(' AC', ' Exhaust'), + "05JHDM":(' AC', ' Intake'), + "0D72R7":(' AC', ' Exhaust'), + "02PC9F":(' AC', ' Exhaust'), + "0JM5DX":(' AC', ' Intake'), + "0TPDP8":(' AC', ' Exhaust'), + "0WND1V":(' AC', ' Exhaust'), + "05672M":(' DC', ' Intake'), + "0CJV4K":(' DC', ' Intake'), + "0X41RN":(' AC', ' Exhaust'), + "0Y3N82":(' AC', ' Intake'), + "0W4CMG":(' DC', ' Exhaust'), + "04T94Y":(' DC', ' Intake') +} + +ipmi_status, ipmi_sdr_list = commands.getstatusoutput(IPMI_SENSOR_DATA) + +def get_pmc_register(reg_name): + if ipmi_status: + logging.error('Failed to execute:' + ipmi_sdr_list) + sys.exit(0) + for line in ipmi_sdr_list.splitlines(): + sdr = line.split('|') + if reg_name in sdr[0] : return sdr[1] + print('\nFailed to fetch: ' + reg_name + ' sensor ') + sys.exit(0) + + +# Print the information for temperature sensors + + +def print_temperature_sensors(): + + print("\nOnboard Temperature Sensors:") + + print ' PT_Left_temp: ',\ + (get_pmc_register('PT_Left_temp')) + print ' PT_Mid_temp: ',\ + (get_pmc_register('PT_Mid_temp')) + print ' PT_Right_temp: ',\ + (get_pmc_register('PT_Right_temp')) + print ' Broadcom Temp: ',\ + (get_pmc_register('NPU_Near_temp')) + print ' Inlet Airflow Temp: ',\ + (get_pmc_register('ILET_AF_temp')) + print ' CPU Temp: ',\ + (get_pmc_register('CPU_temp')) + +def get_switch_details(): + status, ipmi_fru = commands.getstatusoutput('/usr/bin/ipmitool fru') + for line in ipmi_fru.splitlines(): + info = line.split(':') + if 'Board Part Number' in info[0] : + partno = info[1][1:-3] + if (partno in switch_sku): return switch_sku[partno] + return None + +commands.getstatusoutput('echo 0 > /sys/module/ipmi_si/parameters/kipmid_max_busy_us') +print_temperature_sensors() + +# Print the information for 1 Fan Tray + + +def print_fan_tray(tray): + + print ' Fan Tray ' + str(tray) + ':' + + if (tray == 1): + print ' Fan1 Speed: ',\ + get_pmc_register('FAN1_Front_rpm') + print ' Fan2 Speed: ',\ + get_pmc_register('FAN1_Rear_rpm') + + elif (tray == 2): + print ' Fan1 Speed: ',\ + get_pmc_register('FAN2_Front_rpm') + print ' Fan2 Speed: ',\ + get_pmc_register('FAN2_Rear_rpm') + + elif (tray == 3): + print ' Fan1 Speed: ',\ + get_pmc_register('FAN3_Front_rpm') + print ' Fan2 Speed: ',\ + get_pmc_register('FAN3_Rear_rpm') + + elif (tray == 4): + print ' Fan1 Speed: ',\ + get_pmc_register('FAN4_Front_rpm') + print ' Fan2 Speed: ',\ + get_pmc_register('FAN4_Rear_rpm') + +type, dir = get_switch_details() +print('\nFan Trays(Fixed):') +print ' Fan Tray Direction: ', dir +for tray in range(1, S5212F_MAX_FAN_TRAYS + 1): + print_fan_tray(tray) + +print('\nPSU Tray(Fixed):') +print ' PSU Tray Direction: ', dir +print ' PSU Tray Type: ', type + +ret_status, ipmi_cmd_ret = commands.getstatusoutput('echo 1000 > /sys/module/ipmi_si/parameters/kipmid_max_busy_us') diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/qsfp_irq_enable.py b/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/qsfp_irq_enable.py new file mode 100755 index 000000000000..83b253512514 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/qsfp_irq_enable.py @@ -0,0 +1,30 @@ +#!/usr/bin/python + +try: + import struct + from os import * + from mmap import * + +except ImportError as e: + raise ImportError("%s - required module no found" % str(e)) + +BASE_RES_PATH = "/sys/bus/pci/devices/0000:04:00.0/resource0" +PORT_START = 0 +PORT_END = 15 + + +def pci_mem_write(mm, offset, data): + mm.seek(offset) + mm.write(struct.pack('I', data)) + + +def pci_set_value(resource, val, offset): + fd = open(resource, O_RDWR) + mm = mmap(fd, 0) + pci_mem_write(mm, offset, val) + mm.close() + close(fd) + +for port_num in range(PORT_START, PORT_END+1): + port_offset = 0x400c + ((port_num) * 16) + pci_set_value(BASE_RES_PATH, 0x30, port_offset) diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/s5212f_platform.sh b/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/s5212f_platform.sh new file mode 100755 index 000000000000..d98c144ab621 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/s5212f_platform.sh @@ -0,0 +1,210 @@ +#!/bin/bash + +init_devnum() { + found=0 + for devnum in 0 1; do + devname=`cat /sys/bus/i2c/devices/i2c-${devnum}/name` + # iSMT adapter can be at either dffd0000 or dfff0000 + if [[ $devname == 'SMBus iSMT adapter at '* ]]; then + found=1 + break + fi + done + + [ $found -eq 0 ] && echo "cannot find iSMT" && exit 1 +} + +# Attach/Detach syseeprom on CPU board +sys_eeprom() { + case $1 in + "new_device") echo 24c16 0x50 > /sys/bus/i2c/devices/i2c-${devnum}/$1 + ;; + "delete_device") echo 0x50 > /sys/bus/i2c/devices/i2c-${devnum}/$1 + ;; + *) echo "s5212f_platform: sys_eeprom : invalid command !" + ;; + esac +} + +#Attach/Detach the MUX connecting all QSFPs +switch_board_qsfp_mux() { + case $1 in + "new_device") + for ((i=603;i<=604;i++)); + do + echo "Attaching PCA9548 @ 0x74" + echo pca9548 0x74 > /sys/bus/i2c/devices/i2c-$i/$1 + done + + ;; + "delete_device") + for ((i=603;i<=604;i++)); + do + echo "Detaching PCA9548 @ 0x74" + echo 0x74 > /sys/bus/i2c/devices/i2c-$i/$1 + done + + ;; + *) echo "s5212f_platform: switch_board_qsfp_mux: invalid command !" + ;; + esac + sleep 2 +} + +#Attach/Detach 64 instances of EEPROM driver QSFP ports +#eeprom can dump data using below command +switch_board_qsfp() { + case $1 in + "new_device") + for ((i=14;i<=16;i++)); + do + echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-$i/$1 + done + ;; + + "delete_device") + for ((i=14;i<=16;i++)); + do + echo 0x50 > /sys/bus/i2c/devices/i2c-$i/$1 + done + ;; + + *) echo "s5212f_platform: switch_board_qsfp: invalid command !" + ;; + esac +} + +#Attach/Detach 2 instances of EEPROM driver SFP+ ports. Use optoe2 (dual address devices) +#eeprom can dump data using below command +switch_board_sfp() { + case $1 in + "new_device") + for ((i=2;i<=13;i++)); + do + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-$i/$1 + done + ;; + + "delete_device") + for ((i=2;i<=13;i++)); + do + echo 0x50 > /sys/bus/i2c/devices/i2c-$i/$1 + done + ;; + + *) echo "s5212f_platform: switch_board_sfp: invalid command !" + ;; + esac +} + +#Modsel 3 ports to applicable QSFP type modules +#This enables the adapter to respond for i2c commands +switch_board_modsel() { + resource="/sys/bus/pci/devices/0000:03:00.0/resource0" + for ((i=1;i<=15;i++)); + do + port_addr=$(( 16384 + ((i - 1) * 16))) + hex=$( printf "0x%x" $port_addr ) + python /usr/bin/pcisysfs.py --set --offset $hex --val 0x10 --res $resource > /dev/null 2>&1 + done +} + +#This enables the led control for CPU and default states +switch_board_led_default() { + resource="/sys/bus/pci/devices/0000:03:00.0/resource0" + python /usr/bin/pcisysfs.py --set --offset 0x24 --val 0x194 --res $resource > /dev/null 2>&1 +} + +# Readout firmware version of the system and +# store in /var/log/firmware_versions +platform_firmware_versions() { + FIRMWARE_VERSION_FILE=/var/log/firmware_versions + rm -rf ${FIRMWARE_VERSION_FILE} + echo "BIOS: `dmidecode -s system-version `" > $FIRMWARE_VERSION_FILE + ## Get FPGA version + r=`/usr/bin/pcisysfs.py --get --offset 0x00 --res /sys/bus/pci/devices/0000\:03\:00.0/resource0 | sed '1d; s/.*\(....\)$/\1/; s/\(..\{1\}\)/\1./'` + r_min=$(echo $r | sed 's/.*\(..\)$/0x\1/') + r_maj=$(echo $r | sed 's/^\(..\).*/0x\1/') + echo "FPGA: $((r_maj)).$((r_min))" >> $FIRMWARE_VERSION_FILE + + ## Get BMC Firmware Revision + r=`cat /sys/class/ipmi/ipmi0/device/bmc/firmware_revision` + echo "BMC: $r" >> $FIRMWARE_VERSION_FILE + + #System CPLD 0x31 on i2c bus 601 ( physical FPGA I2C-2) + r_min=`/usr/sbin/i2cget -y 601 0x31 0x0 | sed ' s/.*\(0x..\)$/\1/'` + r_maj=`/usr/sbin/i2cget -y 601 0x31 0x1 | sed ' s/.*\(0x..\)$/\1/'` + echo "System CPLD: $((r_maj)).$((r_min))" >> $FIRMWARE_VERSION_FILE + + #Slave CPLD 1 0x30 on i2c bus 600 ( physical FPGA I2C-1) + r_min=`/usr/sbin/i2cget -y 600 0x30 0x0 | sed ' s/.*\(0x..\)$/\1/'` + r_maj=`/usr/sbin/i2cget -y 600 0x30 0x1 | sed ' s/.*\(0x..\)$/\1/'` + echo "Slave CPLD 1: $((r_maj)).$((r_min))" >> $FIRMWARE_VERSION_FILE +} + +install_python_api_package() { + device="/usr/share/sonic/device" + platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) + + rv=$(pip3 install $device/$platform/sonic_platform-1.0-py3-none-any.whl) +} + +remove_python_api_package() { + rv=$(pip3 show sonic-platform > /dev/null 2>/dev/null) + if [ $? -eq 0 ]; then + rv=$(pip3 uninstall -y sonic-platform > /dev/null 2>/dev/null) + fi +} + +get_reboot_cause() { + REBOOT_REASON_FILE="/host/reboot-cause/platform/reboot_reason" + resource="/sys/bus/pci/devices/0000:03:00.0/resource0" + + mkdir -p $(dirname $REBOOT_REASON_FILE) + + # Handle First Boot into software version with reboot cause determination support + if [[ ! -e $REBOOT_REASON_FILE ]]; then + echo "0" > $REBOOT_REASON_FILE + else + /usr/bin/pcisysfs.py --get --offset 0x18 --res $resource | sed '1d; s/.*:\(.*\)$/\1/;' > $REBOOT_REASON_FILE + fi + /usr/bin/pcisysfs.py --set --val 0x0 --offset 0x18 --res $resource +} + +init_devnum + +if [ "$1" == "init" ]; then + modprobe i2c-dev + modprobe i2c-mux-pca954x + modprobe ipmi_devintf + modprobe ipmi_si kipmid_max_busy_us=1000 + modprobe i2c_ocores + modprobe dell_s5212f_fpga_ocores + sys_eeprom "new_device" + get_reboot_cause + switch_board_qsfp_mux "new_device" + switch_board_qsfp "new_device" + switch_board_sfp "new_device" + switch_board_modsel + switch_board_led_default + install_python_api_package + platform_firmware_versions + echo -2 > /sys/bus/i2c/drivers/pca954x/603-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/604-0074/idle_state +elif [ "$1" == "deinit" ]; then + sys_eeprom "delete_device" + switch_board_qsfp "delete_device" + switch_board_sfp "delete_device" + switch_board_qsfp_mux "delete_device" + + modprobe -r dell_s5212f_fpga_ocores + modprobe -r i2c_ocores + modprobe -r acpi_ipmi + modprobe -r ipmi_si + modprobe -r ipmi_devintf + modprobe -r i2c-mux-pca954x + modprobe -r i2c-dev + remove_python_api_package +else + echo "s5212f_platform : Invalid option !" +fi diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/sensors b/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/sensors new file mode 100755 index 000000000000..ee53f2b0f325 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/scripts/sensors @@ -0,0 +1,8 @@ +#!/bin/bash +docker exec -i pmon sensors "$@" +docker exec -i pmon /usr/bin/platform_sensors.py "$@" + +#To probe sensors not part of lm-sensors +#if [ -r /usr/local/bin/platform_sensors.py ]; then +# python /usr/local/bin/platform_sensors.py +#fi diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/setup.py b/platform/broadcom/sonic-platform-modules-dell/s5212f/setup.py new file mode 120000 index 000000000000..4f6de9941d96 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/setup.py @@ -0,0 +1 @@ +../s6100/setup.py \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/__init__.py b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/__init__.py new file mode 100644 index 000000000000..46033347299f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/__init__.py @@ -0,0 +1,3 @@ +__all__ = ["platform", "chassis", "sfp", "eeprom", "component", "thermal", "psu", "fan","fan_drawer"] +from sonic_platform import * + diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/chassis.py new file mode 100644 index 000000000000..629f4e73f7b7 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/chassis.py @@ -0,0 +1,327 @@ +#!/usr/bin/env python + +############################################################################# +# DELLEMC 5212F +# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + +try: + import os + import time + import sys + from sonic_platform_base.chassis_base import ChassisBase + from sonic_platform.sfp import Sfp + from sonic_platform.eeprom import Eeprom + from sonic_platform.component import Component + from sonic_platform.psu import Psu + from sonic_platform.thermal import Thermal + from sonic_platform.fan_drawer import FanDrawer + from sonic_platform.watchdog import Watchdog + from sonic_platform.fan import Fan +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +MAX_S5212F_COMPONENT = 5 # BIOS,BMC,FPGA,SYSTEM CPLD,SLAVE CPLD +MAX_S5212F_FANTRAY =4 +MAX_S5212F_FAN = 2 +MAX_S5212F_PSU = 2 +MAX_S5212F_THERMAL = 6 + +media_part_num_list = set([ \ +"8T47V","XTY28","MHVPK","GF76J","J6FGD","F1KMV","9DN5J","H4DHD","6MCNV","0WRX0","X7F70","5R2PT","WTRD1","WTRD1","WTRD1","WTRD1","5250G","WTRD1","C5RNH","C5RNH","FTLX8571D3BCL-FC", +"C5RNH","5250G","N8TDR","7D64H","7D64H","RN84N","RN84N","HMTNW","6K3Y6","6K3Y6","TY5FM","50M0R","PGYJT","WP2PP","85Y13","1HCGH","FP9R1","FYD0M","C6Y7M","C6Y7M","V250M","V250M", +"5CWK6","5CWK6","53HVN","53HVN","358VV","358VV","MV799","MV799","YJF03","P9GND","T1KCN","1DXKP","MT7R2","K0T7R","W5G04","7TCDN","7TCDN","7TCDN","7TCDN","7TCDN","V3XJK","0MV31", +"5FVP7","N6KM9","C41MF","77KC3","XW7J0","V4NJV","2XJHY","H93DH","H93DH","F8CG0","F8CG0","F8CG0","119N6","WFMF5","794RX","288F6","1M31V","1M31V","5NP8R","5NP8R","4TC09","4TC09", +"FC6KV","FC6KV","J90VN","J90VN","05RH0","05RH0","YDN52","0C2YV","YDN52","0C2YV","9JT65","D7M6H","6GW14","FYVFW","0VF5H","P4YPY","P4YPY","TCPM2","TCPM2","JNPF8","JNPF8","27GG5", +"27GG5","P8T4W","P8T4W","JR54Y","M6N0J","XJYD0","K44H9","035KG","P7C7N","76V43","3CC35","FN4FC","26FN3","YFNDD","YFNDD","7R9N9","035KG","P7C7N","76V43","3CC35","PLRXPLSCS43811", +"FN4FC","26FN3","YFNDD","YFNDD","7R9N9","G86YJ","V407F","V407F","9KH6T","G86YJ","V407F","9KH6T","2JVDD","D0R73","VXFJY","9X8JP","2JVDD","D0R73","VXFJY","9X8JP","2JVDD","D0R73","VXFJY", +"9X8JP","GMFC5","GMFC5","GMFC5","D7P80","3MFXG","3MFXG","0GWXJ","THPF3","THPF3","THPF3","THPF3","THPF3","PJ62G","3XCX1","JJYKG","RRRTK","16K56","86JM2","K5R6C","7MG2C","WTPPN","9HTT2", +"NKM4F","VXGGG","JC9W6","6MR8M","RP3GV","M5PPJ","XKY55","TKCXT","05J8P","5WGKD","XFDRT","NW8DM","YPKH3","5WGKD","XFDRT","NW8DM","YPKH3","71XXK","MVCX6","0XYP6","HPPVW","3GHRT","71XXK", +"MVCX6","0XYP6","HPPVW","3GHRT","2X5T6","135V2","KD5MV","2X5T6","KD5MV","HHFK0","3YWG7","5CMT2","RCVP5","X5DH4","HHFK0","3YWG7","5CMT2","RCVP5","X5DH4","3YWG7","5CMT2","RCVP5","X5DH4", +"4WJ41","4WJ41","14NV5","14NV5","14NV5","4WGYD","YKMH7","X7CCC","X7CCC","0X9CT","0CY8V","P7D7R","W4GPP","W4GPP","W4GPP","HHHCHC","07RN7","07RN7","0YR96","0YR96","JCYM9","FTLX8571D3BCL", +"DDW0X","VPFDJ","229KM","9FC7D","DDW0X","VPFDJ","6FMR5","J7K20","N3K9W","6FMR5","8R4VM","7VN5T","D9YM8","8R4VM","VYXPW","87TPX","WY6FK","VYXPW","87TPX","WY6FK","WG8C4","N8K82","2DV6Y", +"77C3C","RC0HM","77C3C","RC0HM","JHXTN","3P3PG","92YVM","4VX5M","4VX5M","6RRGD","W4JWV","22V6R","XR11M","9GMDY","JMCWK","TP2F0","6MGDY","78RHK", "C0TP5","0WDNV","FCLF8522P2BTL"\ +]) + +class Chassis(ChassisBase): + """ + DELLEMC Platform-specific Chassis class + """ + + REBOOT_CAUSE_PATH = "/host/reboot-cause/platform/reboot_reason" + OIR_FD_PATH = "/sys/bus/pci/devices/0000:03:00.0/port_msi" + + oir_fd = -1 + epoll = -1 + + _global_port_pres_dict = {} + + def __init__(self): + ChassisBase.__init__(self) + # sfp.py will read eeprom contents and retrive the eeprom data. + # We pass the eeprom path from chassis.py + self.PORT_START = 1 + self.PORT_END = 15 + PORTS_IN_BLOCK = (self.PORT_END + 1) + _qsfp_port = range(13, self.PORT_END + 1) + eeprom_base = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + + for index in range(self.PORT_START, PORTS_IN_BLOCK): + port_num = index + 1 + eeprom_path = eeprom_base.format(port_num) + if index in _qsfp_port: + sfp_node = Sfp(index, 'QSFP', eeprom_path) + else: + sfp_node = Sfp(index, 'SFP', eeprom_path) + self._sfp_list.append(sfp_node) + + self._eeprom = Eeprom() + + for i in range(MAX_S5212F_THERMAL): + thermal = Thermal(i) + self._thermal_list.append(thermal) + + for i in range(MAX_S5212F_COMPONENT): + component = Component(i) + self._component_list.append(component) + + for i in range(MAX_S5212F_PSU): + psu = Psu(i) + self._psu_list.append(psu) + + + for i in range(MAX_S5212F_FANTRAY): + for j in range(MAX_S5212F_FAN): + fan = Fan(i,j) + self._fan_list.append(fan) + + for i in range(MAX_S5212F_FANTRAY): + fandrawer = FanDrawer(i) + self._fan_drawer_list.append(fandrawer) + self._fan_list.extend(fandrawer._fan_list) + + for port_num in range(self.PORT_START, (self.PORT_END + 1)): + # sfp get uses zero-indexing, but port numbers start from 1 + presence = self.get_sfp(port_num).get_presence() + if presence: + self._global_port_pres_dict[port_num] = '1' + else: + self._global_port_pres_dict[port_num] = '0' + + self._watchdog = Watchdog() + + def __del__(self): + if self.oir_fd != -1: + self.epoll.unregister(self.oir_fd.fileno()) + self.epoll.close() + self.oir_fd.close() + +# not needed /delete after validation + + def _get_register(self, reg_file): + retval = 'ERR' + if (not os.path.isfile(reg_file)): + print(reg_file, 'not found !') + return retval + + try: + with os.fdopen(os.open(reg_file, os.O_RDONLY)) as fd: + retval = fd.read() + except Exception: + pass + retval = retval.rstrip('\r\n') + retval = retval.lstrip(" ") + return retval + +# not needed /delete after validation + + def _check_interrupts(self, port_dict): + retval = 0 + is_port_dict_updated = False + for port_num in range(self.PORT_START, (self.PORT_END + 1)): + # sfp get uses zero-indexing, but port numbers start from 1 + sfp = self.get_sfp(port_num-1) + presence = sfp.get_presence() + if(presence and (self._global_port_pres_dict[port_num] == '0')): + is_port_dict_updated = True + self._global_port_pres_dict[port_num] = '1' + port_dict[port_num] = '1' + elif(not presence and (self._global_port_pres_dict[port_num] == '1')): + is_port_dict_updated = True + self._global_port_pres_dict[port_num] = '0' + port_dict[port_num] = '0' + return retval, is_port_dict_updated + +# check for this event change for sfp / do we need to handle timeout/sleep + + def get_change_event(self, timeout=0): + """ + Returns a nested dictionary containing all devices which have + experienced a change at chassis level + """ + start_ms = time.time() * 1000 + port_dict = {} + change_dict = {} + change_dict['sfp'] = port_dict + while True: + time.sleep(0.5) + for port_num in range(self.PORT_START, (self.PORT_END + 1)): + presence = self.get_sfp(port_num-1).get_presence() + if(presence and self._global_port_pres_dict[port_num] == '0'): + self._global_port_pres_dict[port_num] = '1' + port_dict[port_num] = '1' + self.get_sfp(port_num-1)._initialize_media(delay=True) + elif(not presence and + self._global_port_pres_dict[port_num] == '1'): + self._global_port_pres_dict[port_num] = '0' + port_dict[port_num] = '0' + + if(len(port_dict) > 0): + return True, change_dict + + if timeout: + now_ms = time.time() * 1000 + if (now_ms - start_ms >= timeout): + return True, change_dict + + + def get_sfp(self, index): + """ + Retrieves sfp represented by (0-based) index + + Args: + index: An integer, the index (0-based) of the sfp to retrieve. + The index should be the sequence of a physical port in a chassis, + starting from 0. + For example, 0 for Ethernet0, 1 for Ethernet4 and so on. + + Returns: + An object dervied from SfpBase representing the specified sfp + """ + sfp = None + + try: + # The index will start from 0 + sfp = self._sfp_list[index-1] + except IndexError: + sys.stderr.write("SFP index {} out of range (0-{})\n".format( + index, len(self._sfp_list)-1)) + return sfp + + def get_name(self): + """ + Retrieves the name of the chassis + Returns: + string: The name of the chassis + """ + return self._eeprom.modelstr() + + def get_presence(self): + """ + Retrieves the presence of the chassis + Returns: + bool: True if chassis is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the chassis + Returns: + string: Model/part number of chassis + """ + return self._eeprom.part_number_str() + + def get_serial(self): + """ + Retrieves the serial number of the chassis (Service tag) + Returns: + string: Serial number of chassis + """ + return self._eeprom.serial_str() + + def get_revision(self): + """ + Retrieves the revision number of the chassis (Service tag) + Returns: + string: Revision number of chassis + """ + return self._eeprom.revision_str() + + def get_status(self): + """ + Retrieves the operational status of the chassis + Returns: + bool: A boolean value, True if chassis is operating properly + False if not + """ + return True + + def get_base_mac(self): + """ + Retrieves the base MAC address for the chassis + Returns: + A string containing the MAC address in the format + 'XX:XX:XX:XX:XX:XX' + """ + return self._eeprom.base_mac_addr('') + + def get_serial_number(self): + """ + Retrieves the hardware serial number for the chassis + Returns: + A string containing the hardware serial number for this chassis. + """ + return self._eeprom.serial_number_str() + + def get_system_eeprom_info(self): + """ + Retrieves the full content of system EEPROM information for the chassis + Returns: + A dictionary where keys are the type code defined in + OCP ONIE TlvInfo EEPROM format and values are their corresponding + values. + """ + return self._eeprom.system_eeprom_info() + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + Returns: + A tuple (string, string) where the first element is a string + containing the cause of the previous reboot. This string must be + one of the predefined strings in this class. If the first string + is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used + to pass a description of the reboot cause. + """ + try: + with open(self.REBOOT_CAUSE_PATH) as fd: + reboot_cause = int(fd.read(), 16) + except Exception: + return (self.REBOOT_CAUSE_NON_HARDWARE, None) + + if reboot_cause & 0x1: + return (self.REBOOT_CAUSE_POWER_LOSS, "Power on reset") + elif reboot_cause & 0x2: + return (self.REBOOT_CAUSE_NON_HARDWARE, None) + elif reboot_cause & 0x4: + return (self.REBOOT_CAUSE_HARDWARE_OTHER, "PSU Shutdown") + elif reboot_cause & 0x8: + return (self.REBOOT_CAUSE_THERMAL_OVERLOAD_CPU, "Thermal overload") + elif reboot_cause & 0x10: + return (self.REBOOT_CAUSE_WATCHDOG, "Watchdog reset") + elif reboot_cause & 0x20: + return (self.REBOOT_CAUSE_HARDWARE_OTHER, "BMC Shutdown") + elif reboot_cause & 0x40: + return (self.REBOOT_CAUSE_HARDWARE_OTHER, "Hot-Swap Shutdown") + elif reboot_cause & 0x80: + return (self.REBOOT_CAUSE_HARDWARE_OTHER, "Reset Button Shutdown") + elif reboot_cause & 0x100: + return (self.REBOOT_CAUSE_HARDWARE_OTHER, "Reset Button Cold Reboot") + else: + return (self.REBOOT_CAUSE_NON_HARDWARE, None) + + def get_qualified_media_list(self): + return media_part_num_list diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/component.py new file mode 100644 index 000000000000..a1bba0c9d372 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/component.py @@ -0,0 +1,113 @@ +#!/usr/bin/env python + +######################################################################## +# DELLEMC S5212F +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Components' (e.g., BIOS, CPLD, FPGA, BMC etc.) available in +# the platform +# +######################################################################## + +try: + import subprocess + from sonic_platform_base.component_base import ComponentBase + import sonic_platform.hwaccess as hwaccess + +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +def get_bios_version(): + return subprocess.check_output(['dmidecode', '-s', 'system-version']).strip() + +def get_fpga_version(): + val = hwaccess.pci_get_value('/sys/bus/pci/devices/0000:03:00.0/resource0', 0) + return '{}.{}'.format((val >> 8) & 0xff, val & 0xff) + +def get_bmc_version(): + return subprocess.check_output( + ['cat', '/sys/class/ipmi/ipmi0/device/bmc/firmware_revision'] + ).strip() + +def get_cpld_version(bus, i2caddr): + return '{}.{}'.format(hwaccess.i2c_get(bus, i2caddr, 1), + hwaccess.i2c_get(bus, i2caddr, 0) + ) + +def get_cpld0_version(): + return get_cpld_version(601, 0x31) + +def get_cpld1_version(): + return get_cpld_version(600, 0x30) + + +class Component(ComponentBase): + """DellEMC Platform-specific Component class""" + + CHASSIS_COMPONENTS = [ + ['BIOS', + 'Performs initialization of hardware components during booting', + get_bios_version + ], + + ['FPGA', + 'Used for managing the system LEDs', + get_fpga_version + ], + + ['BMC', + 'Platform management controller for on-board temperature monitoring, in-chassis power, Fan and LED control', + get_bmc_version + ], + + ['System CPLD', + 'Used for managing the CPU power sequence and CPU states', + get_cpld0_version + ], + + ['Slave CPLD 1', + 'Used for managing SFP28/QSFP28 port transceivers (SFP28 1-24, QSFP28 1-4)', + get_cpld1_version + ] + ] + + def __init__(self, component_index = 0): + self.index = component_index + self.name = self.CHASSIS_COMPONENTS[self.index][0] + self.description = self.CHASSIS_COMPONENTS[self.index][1] + self.version = self.CHASSIS_COMPONENTS[self.index][2]() + + def get_name(self): + """ + Retrieves the name of the component + Returns: + A string containing the name of the component + """ + return self.name + + def get_description(self): + """ + Retrieves the description of the component + Returns: + A string containing the description of the component + """ + return self.description + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + Returns: + A string containing the firmware version of the component + """ + return self.version + + def install_firmware(self, image_path): + """ + Installs firmware to the component + Args: + image_path: A string, path to firmware image + Returns: + A boolean, True if install was successful, False if not + """ + return False diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/eeprom.py b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/eeprom.py new file mode 100644 index 000000000000..d8293704e678 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/eeprom.py @@ -0,0 +1,139 @@ +#!/usr/bin/env python + +############################################################################# +# DellEmc S5212F +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + import os.path + from sonic_eeprom import eeprom_tlvinfo + import binascii +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Eeprom(eeprom_tlvinfo.TlvInfoDecoder): + + def __init__(self): + self.eeprom_path = None + for b in (0, 1): + f = '/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom'.format(b) + if os.path.exists(f): + self.eeprom_path = f + break + if self.eeprom_path is None: + return + super(Eeprom, self).__init__(self.eeprom_path, 0, '', True) + self.eeprom_tlv_dict = dict() + try: + self.eeprom_data = self.read_eeprom() + except: + self.eeprom_data = "N/A" + raise RuntimeError("Eeprom is not Programmed") + else: + eeprom = self.eeprom_data + + if not self.is_valid_tlvinfo_header(eeprom): + return + + total_length = eeprom[9] << 8 | eeprom[10] + tlv_index = self._TLV_INFO_HDR_LEN + tlv_end = self._TLV_INFO_HDR_LEN + total_length + + while (tlv_index + 2) < len(eeprom) and tlv_index < tlv_end: + if not self.is_valid_tlv(eeprom[tlv_index:]): + break + + tlv = eeprom[tlv_index:tlv_index + 2 + + eeprom[tlv_index + 1]] + code = "0x%02X" % tlv[0] + + name, value = self.decoder(None, tlv) + + self.eeprom_tlv_dict[code] = value + if eeprom[tlv_index] == self._TLV_CODE_CRC_32: + break + + tlv_index += eeprom[tlv_index+1] + 2 + + def serial_number_str(self): + """ + Returns the serial number + """ + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_SERIAL_NUMBER) + if not is_valid: + return "N/A" + return results[2].decode('ascii') + + def base_mac_addr(self, e=None): + """ + Returns the base mac address found in the system EEPROM + """ + (is_valid, t) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_MAC_BASE) + if not is_valid or t[1] != 6: + return super(TlvInfoDecoder, self).switchaddrstr(e) + + return ":".join([binascii.b2a_hex(T) for T in t[2]]) + + def modelstr(self): + """ + Returns the Model name + """ + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_PRODUCT_NAME) + if not is_valid: + return "N/A" + + return results[2].decode('ascii') + + def part_number_str(self): + """ + Returns the part number + """ + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_PART_NUMBER) + if not is_valid: + return "N/A" + + return results[2].decode('ascii') + + def serial_str(self): + """ + Returns the servicetag number + """ + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_SERVICE_TAG) + if not is_valid: + return "N/A" + + return results[2].decode('ascii') + + def revision_str(self): + """ + Returns the device revision + """ + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_DEVICE_VERSION) + if not is_valid: + return "N/A" + + return (binascii.b2a_hex(results[2])).decode('ascii') + + def system_eeprom_info(self): + """ + Returns a dictionary, where keys are the type code defined in + ONIE EEPROM format and values are their corresponding values + found in the system EEPROM. + """ + return self.eeprom_tlv_dict + + + + diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/fan.py new file mode 100644 index 000000000000..3b3e5e3e58a8 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/fan.py @@ -0,0 +1,181 @@ +#!/usr/bin/env python + +######################################################################## +# DellEMC SS5212F +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Fans' information which are available in the platform. +# +######################################################################## + +try: + from sonic_platform_base.fan_base import FanBase + from sonic_platform.ipmihelper import IpmiSensor, IpmiFru +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +FAN1_MAX_SPEED_OFFSET = 71 +FAN2_MAX_SPEED_OFFSET = 73 +PSU_FAN_MAX_SPEED_OFFSET = 50 +FAN_DIRECTION_OFFSET = 69 +PSU_FAN_DIRECTION_OFFSET = 47 + +switch_sku = { + "0K6MG9":('AC', 'exhaust'), + "0GKK8W":('AC', 'intake'), + "0VK93C":('AC', 'exhaust'), + "05JHDM":('AC', 'intake'), + "0D72R7":('AC', 'exhaust'), + "02PC9F":('AC', 'exhaust'), + "0JM5DX":('AC', 'intake'), + "0TPDP8":('AC', 'exhaust'), + "0WND1V":('AC', 'exhaust'), + "05672M":('DC', 'intake'), + "0CJV4K":('DC', 'intake'), + "0X41RN":('AC', 'exhaust'), + "0Y3N82":('AC', 'intake'), + "0W4CMG":('DC', 'exhaust'), + "04T94Y":('DC', 'intake') +} + + +class Fan(FanBase): + """DellEMC Platform-specific Fan class""" + # { FAN-ID: { Sensor-Name: Sensor-ID } } + FAN_SENSOR_MAPPING = { 1: {"Prsnt": 0x57, "State": 0x57, "Speed": 0x24}, + 2: {"Prsnt": 0x5b, "State": 0x5b, "Speed": 0x20}, + 3: {"Prsnt": 0x58, "State": 0x58, "Speed": 0x25}, + 4: {"Prsnt": 0x5c, "State": 0x5c, "Speed": 0x21}, + 5: {"Prsnt": 0x59, "State": 0x59, "Speed": 0x26}, + 6: {"Prsnt": 0x5d, "State": 0x5d, "Speed": 0x22}, + 7: {"Prsnt": 0x5a, "State": 0x5a, "Speed": 0x27}, + 8: {"Prsnt": 0x5e, "State": 0x5e, "Speed": 0x23} } + PSU_FAN_SENSOR_MAPPING = { 1: {"State": 0x31, "Speed": 0x2e}, + 2: {"State": 0x32, "Speed": 0x2f} } + + # { FANTRAY-ID: FRU-ID } + FAN_FRU_MAPPING = { 1: 0, 2: 0, 3: 0, 4: 0 } + PSU_FRU_MAPPING = { 1: 0, 2: 0 } + + def __init__(self, fantray_index=1, fan_index=1, psu_fan=False, + dependency=None): + self.is_psu_fan = psu_fan + if not self.is_psu_fan: + # API index is starting from 0, DellEMC platform index is + # starting from 1 + self.fantrayindex = fantray_index + 1 + self.fanindex = fan_index + 1 + if (self.fanindex == 1): + self.max_speed_offset = FAN1_MAX_SPEED_OFFSET + else: + self.max_speed_offset = FAN2_MAX_SPEED_OFFSET + self.index = (self.fantrayindex - 1) * 2 + self.fanindex + self.prsnt_sensor = IpmiSensor(self.FAN_SENSOR_MAPPING[self.index]["Prsnt"], + is_discrete=True) + self.state_sensor = IpmiSensor(self.FAN_SENSOR_MAPPING[self.index]["State"], + is_discrete=True) + self.speed_sensor = IpmiSensor(self.FAN_SENSOR_MAPPING[self.index]["Speed"]) + self.fru = IpmiFru(self.FAN_FRU_MAPPING[self.fantrayindex]) + else: + self.dependency = dependency + self.fanindex = fan_index + self.state_sensor = IpmiSensor(self.PSU_FAN_SENSOR_MAPPING[self.fanindex]["State"], + is_discrete=True) + self.speed_sensor = IpmiSensor(self.PSU_FAN_SENSOR_MAPPING[self.fanindex]["Speed"]) + self.fru = IpmiFru(self.PSU_FRU_MAPPING[self.fanindex]) + self.max_speed_offset = PSU_FAN_MAX_SPEED_OFFSET + self.max_speed = 16000 + + def get_name(self): + """ + Retrieves the name of the device + Returns: + String: The name of the device + """ + if self.is_psu_fan: + return "PSU{} Fan".format(self.fanindex) + else: + return "FanTray{}-Fan{}".format(self.fantrayindex, self.fanindex) + + def get_model(self): + """ + Retrieves the part number of the FAN + Returns: + String: Part number of FAN + """ + return self.fru.get_board_part_number() + + def get_serial(self): + """ + Retrieves the serial number of the FAN + Returns: + String: Serial number of FAN + """ + return self.fru.get_board_serial() + + def get_presence(self): + """ + Retrieves the presence of the FAN + Returns: + bool: True if fan is present, False if not + """ + return True + + def get_status(self): + """ + Retrieves the operational status of the FAN + Returns: + bool: True if FAN is operating properly, False if not + """ + status = False + is_valid, state = self.state_sensor.get_reading() + if is_valid: + if (state == 0x00): + status = True + return status + + def get_direction(self): + """ + Retrieves the fan airfow direction + Returns: + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + + Notes: + In DellEMC platforms, + - Forward/Exhaust : Air flows from Port side to Fan side. + - Reverse/Intake : Air flows from Fan side to Port side. + """ + board_info = self.fru.get_board_part_number() + if board_info is not None : + board_part_no = board_info[0:6] + if board_part_no in switch_sku: + return switch_sku[board_part_no][1] + return None + + def get_speed(self): + """ + Retrieves the speed of the fan + Returns: + int: percentage of the max fan speed + """ + speed = None + if not self.is_psu_fan : + if self.max_speed == 0: + self.max_speed = self.fru.get_fru_data(self.max_speed_offset,2)[1] + self.max_speed = self.max_speed[1] << 8 | self.max_speed[0] + is_valid, fan_speed = self.speed_sensor.get_reading() + if is_valid and self.max_speed > 0: + speed = (100 * fan_speed)/self.max_speed + return speed + + def get_speed_rpm(self): + """ + Retrieves the speed of the fan + Returns: + int: percentage of the max fan speed + """ + fan_speed = None + if not self.is_psu_fan : + is_valid, fan_speed = self.speed_sensor.get_reading() + return fan_speed diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..3f3c18fe0a93 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/fan_drawer.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python + +######################################################################## +# DellEMC S5212F +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Fan-Drawers' information available in the platform. +# +######################################################################## + +try: + from sonic_platform_base.fan_drawer_base import FanDrawerBase + from sonic_platform.fan import Fan +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +S5212F_FANS_PER_FANTRAY = 2 + + +class FanDrawer(FanDrawerBase): + """DellEMC Platform-specific Fan class""" + + def __init__(self, fantray_index): + + FanDrawerBase.__init__(self) + # FanTray is 1-based in DellEMC platforms + self.fantrayindex = fantray_index + 1 + for i in range(S5212F_FANS_PER_FANTRAY): + self._fan_list.append(Fan(fantray_index, i)) + + def get_name(self): + """ + Retrieves the fan drawer name + Returns: + string: The name of the device + """ + return "FanTray{}".format(self.fantrayindex) diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/hwaccess.py b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/hwaccess.py new file mode 120000 index 000000000000..e8fa340a444d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/hwaccess.py @@ -0,0 +1 @@ +../../common/sonic_platform/hwaccess.py \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/media_settings_plugin.py b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/media_settings_plugin.py new file mode 100644 index 000000000000..3b7667846eda --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/media_settings_plugin.py @@ -0,0 +1,13 @@ +# Media settings key plugin +# +# Generate keys used for lookup in media_settings,json + +def get_media_settings_key(physical_port, transceiver_dict): + d = transceiver_dict[physical_port] + media_interface = d['media_interface'] + generic_key = '{}-{}'.format(d['form_factor'], media_interface) + if media_interface == 'CR': + generic_key = '{}-{}'.format(generic_key, d['cable_length_detailed']) + return ['{}-{}'.format(d['manufacturename'], d['modelname']), + generic_key + ] diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/platform.py b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/platform.py new file mode 100644 index 000000000000..996d94cf5a6e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/platform.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +############################################################################# +# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + +try: + from sonic_platform_base.platform_base import PlatformBase + from sonic_platform.chassis import Chassis +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PlatformBase): + """ + DELLEMC Platform-specific class + """ + + def __init__(self): + PlatformBase.__init__(self) + self._chassis = Chassis() diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/psu.py new file mode 100644 index 000000000000..9ef5625dea31 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/psu.py @@ -0,0 +1,180 @@ +#!/usr/bin/env python + +######################################################################## +# DellEMC S5212F +# +# Module contains an implementation of SONiC Platform Base API and +# provides the PSUs' information which are available in the platform +# +######################################################################## + + +try: + from sonic_platform_base.psu_base import PsuBase + from sonic_platform.ipmihelper import IpmiSensor, IpmiFru + from sonic_platform.fan import Fan +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +switch_sku = { + "0K6MG9":('AC', 'exhaust'), + "0GKK8W":('AC', 'intake'), + "0VK93C":('AC', 'exhaust'), + "05JHDM":('AC', 'intake'), + "0D72R7":('AC', 'exhaust'), + "02PC9F":('AC', 'exhaust'), + "0JM5DX":('AC', 'intake'), + "0TPDP8":('AC', 'exhaust'), + "0WND1V":('AC', 'exhaust'), + "05672M":('DC', 'intake'), + "0CJV4K":('DC', 'intake'), + "0X41RN":('AC', 'exhaust'), + "0Y3N82":('AC', 'intake'), + "0W4CMG":('DC', 'exhaust'), + "04T94Y":('DC', 'intake') +} + +class Psu(PsuBase): + """DellEMC Platform-specific PSU class""" + + # { PSU-ID: { Sensor-Name: Sensor-ID } } + SENSOR_MAPPING = { 1: { "State": 0x31, "Current": 0x39, + "Power": 0x37, "Voltage": 0x38 }, + 2: { "State": 0x32, "Current": 0x3F, + "Power": 0x3D, "Voltage": 0x3E } } + # ( PSU-ID: FRU-ID } + FRU_MAPPING = { 1: 0, 2: 0 } + + def __init__(self, psu_index): + PsuBase.__init__(self) + # PSU is 1-based in DellEMC platforms + self.index = psu_index + 1 + self.state_sensor = IpmiSensor(self.SENSOR_MAPPING[self.index]["State"], + is_discrete=True) + self.voltage_sensor = IpmiSensor(self.SENSOR_MAPPING[self.index]["Voltage"]) + self.current_sensor = IpmiSensor(self.SENSOR_MAPPING[self.index]["Current"]) + self.power_sensor = IpmiSensor(self.SENSOR_MAPPING[self.index]["Power"]) + self.fru = IpmiFru(self.FRU_MAPPING[self.index]) + + self._fan_list.append(Fan(fan_index=self.index, psu_fan=True, + dependency=self)) + + def get_name(self): + """ + Retrieves the name of the device + + Returns: + string: The name of the device + """ + return "PSU{}".format(self.index) + + def get_presence(self): + """ + Retrieves the presence of the Power Supply Unit (PSU) + + Returns: + bool: True if PSU is present, False if not + """ + presence = False + is_valid, state = self.state_sensor.get_reading() + if is_valid: + if (state & 0b1) == 1: + presence = True + + return presence + + def get_model(self): + """ + Retrieves the part number of the PSU + + Returns: + string: Part number of PSU + """ + return self.fru.get_board_part_number() + + def get_serial(self): + """ + Retrieves the serial number of the PSU + + Returns: + string: Serial number of PSU + """ + return self.fru.get_board_serial() + + def get_status(self): + """ + Retrieves the operational status of the PSU + + Returns: + bool: True if PSU is operating properly, False if not + """ + status = False + is_valid, state = self.state_sensor.get_reading() + if is_valid: + if (state == 0x01): + status = True + + return status + + def get_voltage(self): + """ + Retrieves current PSU voltage output + + Returns: + A float number, the output voltage in volts, + e.g. 12.1 + """ + return None + + def get_current(self): + """ + Retrieves present electric current supplied by PSU + + Returns: + A float number, electric current in amperes, + e.g. 15.4 + """ + return None + + def get_power(self): + """ + Retrieves current energy supplied by PSU + + Returns: + A float number, the power in watts, + e.g. 302.6 + """ + return None + + def get_powergood_status(self): + """ + Retrieves the powergood status of PSU + + Returns: + A boolean, True if PSU has stablized its output voltages and + passed all its internal self-tests, False if not. + """ + status = False + is_valid, state = self.state_sensor.get_reading() + if is_valid: + if (state == 0x01): + status = True + + return status + + def get_type(self): + """ + Retrives the Power Type of PSU + + Returns : + A string, PSU power type + """ + board_info = self.fru.get_board_part_number() + if board_info is not None : + board_part_no = board_info[0:6] + if board_part_no in switch_sku: + return switch_sku[board_part_no][0] + return None + + def get_mfr_id(self): + return self.fru.get_board_mfr_id() diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/sfp.py new file mode 100644 index 000000000000..e08c2655277a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/sfp.py @@ -0,0 +1,313 @@ +#!/usr/bin/env python + +############################################################################# +# DELLEMC S5212F +# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + +try: + import os + import time + import struct + import mmap + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase + +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +SFP_TYPE_LIST = [ + '0x3' # SFP/SFP+/SFP28 and later +] +QSFP_TYPE_LIST = [ + '0xc', # QSFP + '0xd', # QSFP+ or later + '0x11' # QSFP28 or later +] +QSFP_DD_TYPE_LIST = [ + '0x18' #QSFP-DD Type +] + +class Sfp(SfpOptoeBase): + """ + DELLEMC Platform-specific Sfp class + """ + BASE_RES_PATH = "/sys/bus/pci/devices/0000:03:00.0/resource0" + + def __init__(self, index, sfp_type, eeprom_path): + SfpOptoeBase.__init__(self) + self.sfp_type = sfp_type + self.index = index + self.eeprom_path = eeprom_path + self._initialize_media(delay=False) + + def get_eeprom_path(self): + return self.eeprom_path + + def get_name(self): + return "SFP/SFP+/SFP28" if self.index < 13 else "QSFP28 or later" + + def pci_mem_read(self, mm, offset): + mm.seek(offset) + read_data_stream = mm.read(4) + reg_val = struct.unpack('I', read_data_stream) + mem_val = str(reg_val)[1:-2] + # print "reg_val read:%x"%reg_val + return mem_val + + def pci_mem_write(self, mm, offset, data): + mm.seek(offset) + # print "data to write:%x"%data + mm.write(struct.pack('I', data)) + + def pci_set_value(self, resource, val, offset): + fd = os.open(resource, os.O_RDWR) + mm = mmap.mmap(fd, 0) + val = self.pci_mem_write(mm, offset, val) + mm.close() + os.close(fd) + return val + + def pci_get_value(self, resource, offset): + fd = os.open(resource, os.O_RDWR) + mm = mmap.mmap(fd, 0) + val = self.pci_mem_read(mm, offset) + mm.close() + os.close(fd) + return val + + def _initialize_media(self,delay=False): + """ + Initialize the media type and eeprom driver for SFP + """ + if delay: + time.sleep(1) + self._xcvr_api = None + self.get_xcvr_api() + + self.set_media_type() + self.reinit_sfp_driver() + + def get_presence(self): + """ + Retrieves the presence of the sfp + Returns : True if sfp is present and false if it is absent + """ + # Check for invalid port_num + mask = {'QSFP' : (1 << 4), 'SFP' : (1 << 0)} + # Port offset starts with 0x4004 + port_offset = 16388 + ((self.index-1) * 16) + + try: + status = self.pci_get_value(self.BASE_RES_PATH, port_offset) + reg_value = int(status) + # ModPrsL is active low + if reg_value & mask[self.port_type] == 0: + return True + except ValueError: + pass + + return False + + def get_reset_status(self): + """ + Retrives the reset status of SFP + """ + reset_status = False + if (self.port_type == 'QSFP'): + # Port offset starts with 0x4000 + port_offset = 16384 + ((self.index-1) * 16) + + status = self.pci_get_value(self.BASE_RES_PATH, port_offset) + reg_value = int(status) + + # Absence of status throws error + if (reg_value == ""): + return reset_status + + # Mask off 4th bit for reset status + mask = (1 << 4) + + if ((reg_value & mask) == 0): + reset_status = True + else: + reset_status = False + + return reset_status + + def get_lpmode(self): + """ + Retrieves the lpmode(low power mode) of this SFP + """ + lpmode_state = False + if (self.port_type == 'QSFP'): + + # Port offset starts with 0x4000 + port_offset = 16384 + ((self.index-1) * 16) + + status = self.pci_get_value(self.BASE_RES_PATH, port_offset) + reg_value = int(status) + + # Absence of status throws error + if (reg_value == ""): + return lpmode_state + + # Mask off 6th bit for lpmode + mask = (1 << 6) + + # LPMode is active high + if reg_value & mask == 0: + lpmode_state = False + else: + lpmode_state = True + + return lpmode_state + + def reset(self): + """ + Reset the SFP and returns all user settings to their default state + """ + if (self.port_type == 'QSFP'): + # Port offset starts with 0x4000 + port_offset = 16384 + ((self.index-1) * 16) + + status = self.pci_get_value(self.BASE_RES_PATH, port_offset) + reg_value = int(status) + + # Absence of status throws error + if (reg_value == ""): + return False + + # Mask off 4th bit for reset + mask = (1 << 4) + + # ResetL is active low + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset) + + # Sleep 1 second to allow it to settle + time.sleep(1) + + reg_value = reg_value | mask + + # Convert our register value back to a hex string and write back + self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset) + + return True + + else: + return False + + def set_lpmode(self, lpmode): + """ + Sets the lpmode(low power mode) of this SFP + """ + if (self.port_type == 'QSFP'): + # Port offset starts with 0x4000 + port_offset = 16384 + ((self.index-1) * 16) + + status = self.pci_get_value(self.BASE_RES_PATH, port_offset) + reg_value = int(status) + + # Absence of status throws error + if (reg_value == ""): + return False + + # Mask off 6th bit for lowpower mode + mask = (1 << 6) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = reg_value | mask + else: + reg_value = reg_value & ~mask + + # Convert our register value back to a hex string and write back + self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset) + + return True + + else: + return False + + def get_status(self): + """ + Retrieves the operational status of the device + """ + reset = self.get_reset_status() + + if (reset == True): + status = False + else: + status = True + + return status + + def set_media_type(self): + """ + Reads optic eeprom byte to determine media type inserted + """ + eeprom_raw = [] + eeprom_raw = self._xcvr_api_factory._get_id() + if eeprom_raw is not None: + eeprom_raw = hex(eeprom_raw) + if eeprom_raw in SFP_TYPE_LIST: + self.sfp_type = 'SFP' + elif eeprom_raw in QSFP_TYPE_LIST: + self.sfp_type = 'QSFP' + elif eeprom_raw in QSFP_DD_TYPE_LIST: + self.sfp_type = 'QSFP_DD' + else: + #Set native port type if EEPROM type is not recognized/readable + self.sfp_type = self.port_type + else: + self.sfp_type = self.port_type + + return self.sfp_type + + def reinit_sfp_driver(self): + """ + Changes the driver based on media type detected + """ + del_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/delete_device".format(self.index+1) + new_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/new_device".format(self.index+1) + driver_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/name".format(self.index+1) + delete_device = "echo 0x50 >" + del_sfp_path + + if not os.path.isfile(driver_path): + print(driver_path, "does not exist") + return False + + try: + with os.fdopen(os.open(driver_path, os.O_RDONLY)) as fd: + driver_name = fd.read() + driver_name = driver_name.rstrip('\r\n') + driver_name = driver_name.lstrip(" ") + + #Avoid re-initialization of the QSFP/SFP optic on QSFP/SFP port. + if self.sfp_type == 'SFP' and driver_name in ['optoe1', 'optoe3']: + subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + time.sleep(0.2) + new_device = "echo optoe2 0x50 >" + new_sfp_path + subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + time.sleep(2) + elif self.sfp_type == 'QSFP' and driver_name in ['optoe2', 'optoe3']: + subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + time.sleep(0.2) + new_device = "echo optoe1 0x50 >" + new_sfp_path + subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + time.sleep(2) + elif self.sfp_type == 'QSFP_DD' and driver_name in ['optoe1', 'optoe2']: + subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + time.sleep(0.2) + new_device = "echo optoe3 0x50 >" + new_sfp_path + subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + time.sleep(2) + + except IOError as e: + print("Error: Unable to open file: %s" % str(e)) + return False diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/thermal.py new file mode 100644 index 000000000000..b1dc553d499f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/thermal.py @@ -0,0 +1,168 @@ +#!/usr/bin/env python + +######################################################################## +# DellEMC S5212F +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Thermals' information which are available in the platform +# +######################################################################## + + +try: + from sonic_platform_base.thermal_base import ThermalBase + from sonic_platform.ipmihelper import IpmiSensor +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Thermal(ThermalBase): + """DellEMC Platform-specific Thermal class""" + + # [ Sensor-Name, Sensor-ID ] + SENSOR_MAPPING = [ + ['Port Mid', 0x1], + ['NPU Near', 0x2], + ['Port Left', 0x3], + ['Port Right', 0x4], + ['Inlet Airflow Sensor', 0x5], + ['CPU', 0xe], + ] + + def __init__(self, thermal_index): + ThermalBase.__init__(self) + self.index = thermal_index + 1 + self.sensor = IpmiSensor(self.SENSOR_MAPPING[self.index - 1][1]) + + def get_name(self): + """ + Retrieves the name of the thermal + + Returns: + string: The name of the thermal + """ + return self.SENSOR_MAPPING[self.index - 1][0] + + def get_presence(self): + """ + Retrieves the presence of the thermal + + Returns: + bool: True if thermal is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the Thermal + + Returns: + string: Model/part number of Thermal + """ + return 'NA' + + def get_serial(self): + """ + Retrieves the serial number of the Thermal + + Returns: + string: Serial number of Thermal + """ + return 'NA' + + def get_status(self): + """ + Retrieves the operational status of the thermal + + Returns: + A boolean value, True if thermal is operating properly, + False if not + """ + return True + + def get_temperature(self): + """ + Retrieves current temperature reading from thermal + + Returns: + A float number of current temperature in Celsius up to + nearest thousandth of one degree Celsius, e.g. 30.125 + """ + is_valid, temperature = self.sensor.get_reading() + if not is_valid: + temperature = 0 + + return "{:.3f}".format(temperature) + + def get_high_threshold(self): + """ + Retrieves the high threshold temperature of thermal + + Returns: + A float number, the high threshold temperature of thermal in + Celsius up to nearest thousandth of one degree Celsius, + e.g. 30.125 + """ + is_valid, high_threshold = self.sensor.get_threshold("UpperNonCritical") + if not is_valid: + high_threshold = 0 + + return "{:.3f}".format(high_threshold) + + def get_high_critical_threshold(self): + """ + Retrieves the high critical threshold temperature of thermal + + Returns: + A float number, the high critical threshold temperature of thermal in + Celsius up to nearest thousandth of one degree Celsius, + e.g. 30.125 + """ + is_valid, high_crit_threshold = self.sensor.get_threshold("UpperCritical") + if not is_valid: + high_crit_threshold = 0 + + return "{:.3f}".format(high_crit_threshold) + + def get_low_threshold(self): + """ + Retrieves the low threshold temperature of thermal + + Returns: + A float number, the low threshold temperature of thermal in + Celsius up to nearest thousandth of one degree Celsius, + e.g. 30.125 + """ + is_valid, low_threshold = self.sensor.get_threshold("LowerNonRecoverable") + if not is_valid: + low_threshold = 0 + + return "{:.3f}".format(low_threshold) + + def set_high_threshold(self, temperature): + """ + Sets the high threshold temperature of thermal + + Args : + temperature: A float number up to nearest thousandth of one + degree Celsius, e.g. 30.125 + Returns: + A boolean, True if threshold is set successfully, False if + not + """ + # Thermal threshold values are pre-defined based on HW. + return False + + def set_low_threshold(self, temperature): + """ + Sets the low threshold temperature of thermal + + Args : + temperature: A float number up to nearest thousandth of one + degree Celsius, e.g. 30.125 + Returns: + A boolean, True if threshold is set successfully, False if + not + """ + # Thermal threshold values are pre-defined based on HW. + return False diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/watchdog.py new file mode 100644 index 000000000000..fd3ace892387 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/watchdog.py @@ -0,0 +1,212 @@ +#!/usr/bin/env python + +######################################################################## +# +# DELLEMC S5212f +# +# Abstract base class for implementing a platform-specific class with +# which to interact with a hardware watchdog module in SONiC +# +######################################################################## + +try: + import ctypes + import subprocess + import syslog + import sonic_platform.component as Component + from sonic_platform_base.watchdog_base import WatchdogBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class _timespec(ctypes.Structure): + _fields_ = [ + ('tv_sec', ctypes.c_long), + ('tv_nsec', ctypes.c_long) + ] + + +class Watchdog(WatchdogBase): + """ + Abstract base class for interfacing with a hardware watchdog module + """ + + TIMERS = [15,20,30,40,50,60,65,70,80,100,120,140,160,180,210,240] + + armed_time = 0 + timeout = 0 + CLOCK_MONOTONIC = 1 + + def __init__(self): + self._librt = ctypes.CDLL('librt.so.1', use_errno=True) + self._clock_gettime = self._librt.clock_gettime + self._clock_gettime.argtypes=[ctypes.c_int, ctypes.POINTER(_timespec)] + + def _get_command_result(self, cmdline): + try: + proc = subprocess.Popen(cmdline.split(), stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + stdout = proc.communicate()[0] + proc.wait() + result = stdout.rstrip('\n') + except OSError: + result = None + + return result + + def _get_reg_val(self): + # 0x31 = CPLD I2C Base Address + # 0x07 = Watchdog Function Register + value = self._get_command_result("/usr/sbin/i2cget -y 601 0x31 0x07") + if not value: + return None + else: + return int(value, 16) + + def _set_reg_val(self,val): + # 0x31 = CPLD I2C Base Address + # 0x07 = Watchdog Function Register + value = self._get_command_result("/usr/sbin/i2cset -y 601 0x31 0x07 %s" + % (val)) + return value + + def _get_time(self): + """ + To get clock monotonic time + """ + ts = _timespec() + if self._clock_gettime(self.CLOCK_MONOTONIC, ctypes.pointer(ts)) != 0: + self._errno = ctypes.get_errno() + return 0 + return ts.tv_sec + ts.tv_nsec * 1e-9 + + def arm(self, seconds): + """ + Arm the hardware watchdog with a timeout of seconds. + If the watchdog is currently armed, calling this function will + simply reset the timer to the provided value. If the underlying + hardware does not support the value provided in , this + method should arm the watchdog with the *next greater* + available value. + + Returns: + An integer specifying the *actual* number of seconds the + watchdog was armed with. On failure returns -1. + """ + timer_offset = -1 + for key,timer_seconds in enumerate(self.TIMERS): + if seconds <= timer_seconds: + timer_offset = key + seconds = timer_seconds + break + + if timer_offset == -1: + return -1 + + cpld_version = Component.get_cpld0_version() + wd_enabled_version = "0.8" + + if cpld_version < wd_enabled_version: + syslog.syslog(syslog.LOG_ERR, + 'Older System CPLD ver, Update to 0.8 to support watchdog ') + return -1 + + # Extracting 5th to 8th bits for WD timer values + reg_val = self._get_reg_val() + wd_timer_offset = (reg_val >> 4) & 0xf + + if wd_timer_offset != timer_offset: + # Setting 5th to 7th bits + # value from timer_offset + self.disarm() + self._set_reg_val((reg_val & 0x07) | (timer_offset << 4)) + + if self.is_armed(): + # Setting last bit to WD Timer punch + # Last bit = WD Timer punch + self._set_reg_val(reg_val & 0xFE) + + self.armed_time = self._get_time() + self.timeout = seconds + return seconds + else: + # Setting 4th bit to enable WD + # 4th bit = Enable WD + reg_val = self._get_reg_val() + self._set_reg_val(reg_val | 0x8) + + self.armed_time = self._get_time() + self.timeout = seconds + return seconds + + def disarm(self): + """ + Disarm the hardware watchdog + + Returns: + A boolean, True if watchdog is disarmed successfully, False + if not + """ + if self.is_armed(): + # Setting 4th bit to disable WD + # 4th bit = Disable WD + reg_val = self._get_reg_val() + self._set_reg_val(reg_val & 0xF7) + + self.armed_time = 0 + self.timeout = 0 + return True + + return False + + def is_armed(self): + """ + Retrieves the armed state of the hardware watchdog. + + Returns: + A boolean, True if watchdog is armed, False if not + """ + + # Extracting 4th bit to get WD Enable/Disable status + # 0 - Disabled WD + # 1 - Enabled WD + reg_val = self._get_reg_val() + wd_offset = (reg_val >> 3) & 1 + + return bool(wd_offset) + + def get_remaining_time(self): + """ + If the watchdog is armed, retrieve the number of seconds + remaining on the watchdog timer + + Returns: + An integer specifying the number of seconds remaining on + their watchdog timer. If the watchdog is not armed, returns + -1. + + S5212f doesnot have hardware support to show remaining time. + Due to this limitation, this API is implemented in software. + This API would return correct software time difference if it + is called from the process which armed the watchdog timer. + If this API called from any other process, it would return + 0. If the watchdog is not armed, this API would return -1. + """ + if not self.is_armed(): + return -1 + + if self.armed_time > 0 and self.timeout != 0: + cur_time = self._get_time() + + if cur_time <= 0: + return 0 + + diff_time = int(cur_time - self.armed_time) + + if diff_time > self.timeout: + return self.timeout + else: + return self.timeout - diff_time + + return 0 + diff --git a/platform/broadcom/sonic-platform-modules-dell/s5212f/systemd/platform-modules-s5212f.service b/platform/broadcom/sonic-platform-modules-dell/s5212f/systemd/platform-modules-s5212f.service new file mode 100644 index 000000000000..a1ac9707d1a0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s5212f/systemd/platform-modules-s5212f.service @@ -0,0 +1,13 @@ +[Unit] +Description=Dell S5212f Platform modules +Before=pmon.service +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/s5212f_platform.sh init +ExecStop=/usr/local/bin/s5212f_platform.sh deinit +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-dell/s5224f/modules/dell_s5224f_fpga_ocores.c b/platform/broadcom/sonic-platform-modules-dell/s5224f/modules/dell_s5224f_fpga_ocores.c index c0923719c527..eb1faf4fc718 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5224f/modules/dell_s5224f_fpga_ocores.c +++ b/platform/broadcom/sonic-platform-modules-dell/s5224f/modules/dell_s5224f_fpga_ocores.c @@ -1047,7 +1047,7 @@ static int map_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev) /* map the device memory or IO region into kernel virtual * address space */ - fpgapci->bar[i] = ioremap_nocache (bar_start + FPGALOGIC_I2C_BASE, I2C_PCI_MAX_BUS * FPGALOGIC_CH_OFFSET); + fpgapci->bar[i] = ioremap (bar_start + FPGALOGIC_I2C_BASE, I2C_PCI_MAX_BUS * FPGALOGIC_CH_OFFSET); if (!fpgapci->bar[i]) { PRINT ( "Could not map BAR #%d.\n", i); @@ -1061,7 +1061,7 @@ static int map_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev) { fpga_phys_addr = bar_start; - fpga_ctl_addr = ioremap_nocache (bar_start, FPGA_CTL_REG_SIZE); + fpga_ctl_addr = ioremap (bar_start, FPGA_CTL_REG_SIZE); fpga_base_addr = fpgapci->bar[i]; } diff --git a/platform/broadcom/sonic-platform-modules-dell/s5224f/scripts/pcisysfs.py b/platform/broadcom/sonic-platform-modules-dell/s5224f/scripts/pcisysfs.py index 347d1bd7fb33..45669199a383 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5224f/scripts/pcisysfs.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5224f/scripts/pcisysfs.py @@ -22,21 +22,21 @@ def usage(): ''' This is the Usage Method ''' - print '\t\t pcisysfs.py --get --offset --res ' - print '\t\t pcisysfs.py --set --val --offset --res ' + print('\t\t pcisysfs.py --get --offset --res ') + print('\t\t pcisysfs.py --set --val --offset --res ') sys.exit(1) def pci_mem_read(mm,offset): mm.seek(offset) read_data_stream=mm.read(4) - print "" + print("") reg_val=struct.unpack('I',read_data_stream) - print "reg_val read:%x"%reg_val + print("reg_val read:%x"%reg_val) return reg_val def pci_mem_write(mm,offset,data): mm.seek(offset) - print "data to write:%x"%data + print("data to write:%x"%data) mm.write(struct.pack('I',data)) def pci_set_value(resource,val,offset): diff --git a/platform/broadcom/sonic-platform-modules-dell/s5224f/scripts/s5224f_platform.sh b/platform/broadcom/sonic-platform-modules-dell/s5224f/scripts/s5224f_platform.sh index bbb0a49ba842..e68fce7a70d0 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s5224f/scripts/s5224f_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/s5224f/scripts/s5224f_platform.sh @@ -172,7 +172,7 @@ init_devnum if [ "$1" == "init" ]; then modprobe i2c-dev - modprobe i2c-mux-pca954x force_deselect_on_exit=1 + modprobe i2c-mux-pca954x modprobe ipmi_devintf modprobe ipmi_si kipmid_max_busy_us=1000 modprobe i2c_ocores @@ -186,17 +186,23 @@ if [ "$1" == "init" ]; then install_python_api_package #python /usr/bin/qsfp_irq_enable.py platform_firmware_versions - + echo -2 > /sys/bus/i2c/drivers/pca954x/603-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/604-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/605-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/606-0074/idle_state elif [ "$1" == "deinit" ]; then sys_eeprom "delete_device" switch_board_qsfp "delete_device" switch_board_qsfp_mux "delete_device" + modprobe -r dell_s5224f_fpga_ocores + modprobe -r i2c_ocores + modprobe -r acpi_ipmi + modprobe -r ipmi_si + modprobe -r ipmi_devintf modprobe -r i2c-mux-pca954x modprobe -r i2c-dev remove_python_api_package - modprobe -r ipmi_devintf - modprobe -r ipmi_si else echo "s5224f_platform : Invalid option !" fi diff --git a/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/chassis.py index 1b241512ecdb..1f85dd80b259 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/chassis.py @@ -133,6 +133,7 @@ def get_change_event(self, timeout=0): if(presence and self._global_port_pres_dict[port_num] == '0'): self._global_port_pres_dict[port_num] = '1' port_dict[port_num] = '1' + self.get_sfp(port_num-1)._initialize_media(delay=True) elif(not presence and self._global_port_pres_dict[port_num] == '1'): self._global_port_pres_dict[port_num] = '0' @@ -261,6 +262,7 @@ def get_num_sfps(self): An integer represences the number of SFPs on the chassis. """ return self._num_sfps + def get_reboot_cause(self): """ Retrieves the cause of the previous reboot @@ -278,15 +280,15 @@ def get_reboot_cause(self): return (self.REBOOT_CAUSE_NON_HARDWARE, None) if reboot_cause & 0x1: - return (self.REBOOT_CAUSE_POWER_LOSS, None) + return (self.REBOOT_CAUSE_POWER_LOSS, "Power on reset") elif reboot_cause & 0x2: return (self.REBOOT_CAUSE_NON_HARDWARE, None) elif reboot_cause & 0x4: return (self.REBOOT_CAUSE_HARDWARE_OTHER, "PSU Shutdown") elif reboot_cause & 0x8: - return (self.REBOOT_CAUSE_THERMAL_OVERLOAD_CPU, None) + return (self.REBOOT_CAUSE_THERMAL_OVERLOAD_CPU, "Thermal overload") elif reboot_cause & 0x10: - return (self.REBOOT_CAUSE_WATCHDOG, None) + return (self.REBOOT_CAUSE_WATCHDOG, "Watchdog reset") elif reboot_cause & 0x20: return (self.REBOOT_CAUSE_HARDWARE_OTHER, "BMC Shutdown") elif reboot_cause & 0x40: diff --git a/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/ipmihelper.py b/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/ipmihelper.py deleted file mode 100644 index d95329c40de2..000000000000 --- a/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/ipmihelper.py +++ /dev/null @@ -1,269 +0,0 @@ -#!/usr/bin/python3 - -######################################################################## -# DellEMC -# -# Module contains implementation of IpmiSensor and IpmiFru classes that -# provide Sensor's and FRU's information respectively. -# -######################################################################## - -import subprocess -import re - -# IPMI Request Network Function Codes -NetFn_SensorEvent = 0x04 -NetFn_Storage = 0x0A - -# IPMI Sensor Device Commands -Cmd_GetSensorReadingFactors = 0x23 -Cmd_GetSensorThreshold = 0x27 -Cmd_GetSensorReading = 0x2D - -# IPMI FRU Device Commands -Cmd_ReadFRUData = 0x11 - -def get_ipmitool_raw_output(args): - """ - Returns a list the elements of which are the individual bytes of - ipmitool raw command output. - """ - result_bytes = list() - result = "" - command = "ipmitool raw {}".format(args) - try: - proc = subprocess.Popen(command.split(), stdout=subprocess.PIPE, - universal_newlines=True, stderr=subprocess.STDOUT) - stdout = proc.communicate()[0] - proc.wait() - if not proc.returncode: - result = stdout.rstrip('\n') - except EnvironmentError: - pass - - for i in result.split(): - result_bytes.append(int(i, 16)) - - return result_bytes - -class IpmiSensor(object): - - # Sensor Threshold types and their respective bit masks - THRESHOLD_BIT_MASK = { - "LowerNonCritical" : 0, - "LowerCritical" : 1, - "LowerNonRecoverable" : 2, - "UpperNonCritical" : 3, - "UpperCritical" : 4, - "UpperNonRecoverable" : 5 - } - - def __init__(self, sensor_id, is_discrete=False): - self.id = sensor_id - self.is_discrete = is_discrete - - def _get_converted_sensor_reading(self, raw_value): - """ - Returns a 2 element tuple(bool, int) in which first element - provides the validity of the reading and the second element is - the converted sensor reading - """ - # Get Sensor Reading Factors - cmd_args = "{} {} {} {}".format(NetFn_SensorEvent, - Cmd_GetSensorReadingFactors, - self.id, raw_value) - factors = get_ipmitool_raw_output(cmd_args) - - if len(factors) != 7: - return False, 0 - - # Compute Twos complement - def get_twos_complement(val, bits): - if val & (1 << (bits - 1)): - val = val - (1 << bits) - return val - - # Calculate actual sensor value from the raw sensor value - # using the sensor reading factors. - M = get_twos_complement(((factors[2] & 0xC0) << 8) | factors[1], 10) - B = get_twos_complement(((factors[4] & 0xC0) << 8) | factors[3], 10) - R_exp = get_twos_complement((factors[6] & 0xF0) >> 4, 4) - B_exp = get_twos_complement(factors[6] & 0x0F, 4) - - converted_reading = ((M * raw_value) + (B * 10**B_exp)) * 10**R_exp - - return True, converted_reading - - def get_reading(self): - """ - For Threshold sensors, returns the sensor reading. - For Discrete sensors, returns the state value. - - Returns: - A tuple (bool, int) where the first element provides the - validity of the reading and the second element provides the - sensor reading/state value. - """ - # Get Sensor Reading - cmd_args = "{} {} {}".format(NetFn_SensorEvent, Cmd_GetSensorReading, - self.id) - output = get_ipmitool_raw_output(cmd_args) - if len(output) != 4: - return False, 0 - - # Check reading/state unavailable - if output[1] & 0x20: - return False, 0 - - if self.is_discrete: - state = ((output[3] & 0x7F) << 8) | output[2] - return True, state - else: - return self._get_converted_sensor_reading(output[0]) - - def get_threshold(self, threshold_type): - """ - Returns the sensor's threshold value for a given threshold type. - - Args: - threshold_type (str) - one of the below mentioned - threshold type strings - - "LowerNonCritical" - "LowerCritical" - "LowerNonRecoverable" - "UpperNonCritical" - "UpperCritical" - "UpperNonRecoverable" - Returns: - A tuple (bool, int) where the first element provides the - validity of that threshold and second element provides the - threshold value. - """ - # Thresholds are not valid for discrete sensors - if self.is_discrete: - raise TypeError("Threshold is not applicable for Discrete Sensor") - - if threshold_type not in list(self.THRESHOLD_BIT_MASK.keys()): - raise ValueError("Invalid threshold type {} provided. Valid types " - "are {}".format(threshold_type, - list(self.THRESHOLD_BIT_MASK.keys()))) - - bit_mask = self.THRESHOLD_BIT_MASK[threshold_type] - - # Get Sensor Threshold - cmd_args = "{} {} {}".format(NetFn_SensorEvent, Cmd_GetSensorThreshold, - self.id) - thresholds = get_ipmitool_raw_output(cmd_args) - if len(thresholds) != 7: - return False, 0 - - valid_thresholds = thresholds.pop(0) - # Check whether particular threshold is readable - if valid_thresholds & (1 << bit_mask): - return self._get_converted_sensor_reading(thresholds[bit_mask]) - else: - return False, 0 - -class IpmiFru(object): - - def __init__(self, fru_id): - self.id = fru_id - - def _get_ipmitool_fru_print(self): - result = "" - command = "ipmitool fru print {}".format(self.id) - try: - proc = subprocess.Popen(command.split(), stdout=subprocess.PIPE, - universal_newlines=True, stderr=subprocess.STDOUT) - stdout = proc.communicate()[0] - proc.wait() - if not proc.returncode: - result = stdout.rstrip('\n') - except EnvironmentError: - pass - - return result - - def _get_from_fru(self, info): - """ - Returns a string containing the info from FRU - """ - fru_output = self._get_ipmitool_fru_print() - if not fru_output: - return "NA" - - info_req = re.search(r"%s\s*:(.*)" % info, fru_output) - if not info_req: - return "NA" - - return info_req.group(1).strip() - - def get_board_serial(self): - """ - Returns a string containing the Serial Number of the device. - """ - return self._get_from_fru('Board Serial') - - def get_board_part_number(self): - """ - Returns a string containing the Part Number of the device. - """ - return self._get_from_fru('Board Part Number') - - def get_board_mfr_id(self): - """ - Returns a string containing the manufacturer id of the FRU. - """ - return self._get_from_fru('Board Mfg') - - def get_board_product(self): - """ - Returns a string containing the manufacturer id of the FRU. - """ - return self._get_from_fru('Board Product') - - def get_fru_data(self, offset, count=1): - """ - Reads and returns the FRU data at the provided offset. - - Args: - offset (int) - FRU offset to read - count (int) - Number of bytes to read [optional, default = 1] - Returns: - A tuple (bool, list(int)) where the first element provides - the validity of the data read and the second element is a - list, the elements of which are the individual bytes of the - FRU data read. - """ - result_bytes = list() - is_valid = True - result = "" - - offset_LSB = offset & 0xFF - offset_MSB = offset & 0xFF00 - command = "ipmitool raw {} {} {} {} {} {}".format(NetFn_Storage, - Cmd_ReadFRUData, - self.id, offset_LSB, - offset_MSB, count) - try: - proc = subprocess.Popen(command.split(), stdout=subprocess.PIPE, - universal_newlines=True, stderr=subprocess.STDOUT) - stdout = proc.communicate()[0] - proc.wait() - if not proc.returncode: - result = stdout.rstrip('\n') - except EnvironmentError: - is_valid = False - - if (not result) or (not is_valid): - return False, result_bytes - - for i in result.split(): - result_bytes.append(int(i, 16)) - - read_count = result_bytes.pop(0) - if read_count != count: - return False, result_bytes - else: - return True, result_bytes diff --git a/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/sfp.py index e56ab85b3f01..5598f060a95d 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/sfp.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# -# DELLEMC +# DELLEMC S5224F # # Module contains an implementation of SONiC Platform Base API and # provides the platform information @@ -13,159 +13,41 @@ import time import struct import mmap - from sonic_platform_base.sfp_base import SfpBase - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom - from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId - from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom - from sonic_platform_base.sonic_sfp.sff8472 import sffbase + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase except ImportError as e: raise ImportError(str(e) + "- required module not found") -PAGE_OFFSET = 0 -KEY_OFFSET = 1 -KEY_WIDTH = 2 -FUNC_NAME = 3 - -QSFP_INFO_OFFSET = 128 -QSFP_DOM_OFFSET = 0 -QSFP_DOM_OFFSET1 = 384 - -SFP_INFO_OFFSET = 0 -SFP_DOM_OFFSET = 256 - -SFP_STATUS_CONTROL_OFFSET = 110 -SFP_STATUS_CONTROL_WIDTH = 7 -SFP_TX_DISABLE_HARD_BIT = 7 -SFP_TX_DISABLE_SOFT_BIT = 6 - -qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)', 'Length OM2(m)', - 'Length OM1(m)', 'Length Cable Assembly(m)') - -qsfp_compliance_code_tup = ( - '10/40G Ethernet Compliance Code', - 'SONET Compliance codes', - 'SAS/SATA compliance codes', - 'Gigabit Ethernet Compliant codes', - 'Fibre Channel link length/Transmitter Technology', - 'Fibre Channel transmission media', - 'Fibre Channel Speed') - -sfp_cable_length_tup = ('LengthSMFkm-UnitsOfKm', 'LengthSMF(UnitsOf100m)', - 'Length50um(UnitsOf10m)', 'Length62.5um(UnitsOfm)', - 'LengthOM3(UnitsOf10m)', 'LengthCable(UnitsOfm)') - -sfp_compliance_code_tup = ('10GEthernetComplianceCode', 'InfinibandComplianceCode', - 'ESCONComplianceCodes', 'SONETComplianceCodes', - 'EthernetComplianceCodes', 'FibreChannelLinkLength', - 'FibreChannelTechnology', 'SFP+CableTechnology', - 'FibreChannelTransmissionMedia', 'FibreChannelSpeed') - -info_dict_keys = ['type', 'hardware_rev', 'serial', - 'manufacturer', 'model', 'connector', - 'encoding', 'ext_identifier', 'ext_rateselect_compliance', - 'cable_type', 'cable_length', 'nominal_bit_rate', - 'specification_compliance', 'type_abbrv_name','vendor_date', 'vendor_oui'] - -dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', - 'power_lpmode', 'tx_disable', 'tx_disable_channel', - 'temperature', 'voltage', 'rx1power', - 'rx2power', 'rx3power', 'rx4power', - 'tx1bias', 'tx2bias', 'tx3bias', - 'tx4bias', 'tx1power', 'tx2power', - 'tx3power', 'tx4power'] - -threshold_dict_keys = ['temphighalarm', 'temphighwarning', - 'templowalarm', 'templowwarning', - 'vcchighalarm', 'vcchighwarning', - 'vcclowalarm', 'vcclowwarning', - 'rxpowerhighalarm', 'rxpowerhighwarning', - 'rxpowerlowalarm', 'rxpowerlowwarning', - 'txpowerhighalarm', 'txpowerhighwarning', - 'txpowerlowalarm', 'txpowerlowwarning', - 'txbiashighalarm', 'txbiashighwarning', - 'txbiaslowalarm', 'txbiaslowwarning'] - -sff8436_parser = { - 'reset_status': [QSFP_DOM_OFFSET, 2, 1, 'parse_dom_status_indicator'], - 'rx_los': [QSFP_DOM_OFFSET, 3, 1, 'parse_dom_tx_rx_los'], - 'tx_fault': [QSFP_DOM_OFFSET, 4, 1, 'parse_dom_tx_fault'], - 'tx_disable': [QSFP_DOM_OFFSET, 86, 1, 'parse_dom_tx_disable'], - 'power_lpmode': [QSFP_DOM_OFFSET, 93, 1, 'parse_dom_power_control'], - 'power_override': [QSFP_DOM_OFFSET, 93, 1, 'parse_dom_power_control'], - 'Temperature': [QSFP_DOM_OFFSET, 22, 2, 'parse_temperature'], - 'Voltage': [QSFP_DOM_OFFSET, 26, 2, 'parse_voltage'], - 'ChannelMonitor': [QSFP_DOM_OFFSET, 34, 16, 'parse_channel_monitor_params'], - 'ChannelMonitor_TxPower': - [QSFP_DOM_OFFSET, 34, 24, 'parse_channel_monitor_params_with_tx_power'], - - 'cable_type': [QSFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'cable_length': [QSFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'connector': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'type': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'encoding': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'ext_identifier': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'ext_rateselect_compliance': - [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'nominal_bit_rate': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'specification_compliance': - [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'type_abbrv_name': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'manufacturer': [QSFP_INFO_OFFSET, 20, 16, 'parse_vendor_name'], - 'vendor_oui': [QSFP_INFO_OFFSET, 37, 3, 'parse_vendor_oui'], - 'model': [QSFP_INFO_OFFSET, 40, 16, 'parse_vendor_pn'], - 'hardware_rev': [QSFP_INFO_OFFSET, 56, 2, 'parse_vendor_rev'], - 'serial': [QSFP_INFO_OFFSET, 68, 16, 'parse_vendor_sn'], - 'vendor_date': [QSFP_INFO_OFFSET, 84, 8, 'parse_vendor_date'], - 'dom_capability': [QSFP_INFO_OFFSET, 92, 1, 'parse_dom_capability'], - 'dom_rev': [QSFP_DOM_OFFSET, 1, 1, 'parse_sfp_dom_rev'], - 'ModuleThreshold': [QSFP_DOM_OFFSET1, 128, 24, 'parse_module_threshold_values'], - 'ChannelThreshold': [QSFP_DOM_OFFSET1, 176, 16, 'parse_channel_threshold_values'], -} - -sff8472_parser = { - 'Temperature': [SFP_DOM_OFFSET, 96, 2, 'parse_temperature'], - 'Voltage': [SFP_DOM_OFFSET, 98, 2, 'parse_voltage'], - 'ChannelMonitor': [SFP_DOM_OFFSET, 100, 6, 'parse_channel_monitor_params'], - - 'cable_type': [SFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'cable_length': [SFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'connector': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'type': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'encoding': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'ext_identifier': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'ext_rateselect_compliance': - [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'nominal_bit_rate': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'specification_compliance': - [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'type_abbrv_name': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'manufacturer': [SFP_INFO_OFFSET, 20, 16, 'parse_vendor_name'], - 'vendor_oui': [SFP_INFO_OFFSET, 37, 3, 'parse_vendor_oui'], - 'model': [SFP_INFO_OFFSET, 40, 16, 'parse_vendor_pn'], - 'hardware_rev': [SFP_INFO_OFFSET, 56, 4, 'parse_vendor_rev'], - 'serial': [SFP_INFO_OFFSET, 68, 16, 'parse_vendor_sn'], - 'vendor_date': [SFP_INFO_OFFSET, 84, 8, 'parse_vendor_date'], - 'ModuleThreshold': [SFP_DOM_OFFSET, 0, 56, 'parse_alarm_warning_threshold'], -} - - -class Sfp(SfpBase): +SFP_TYPE_LIST = [ + '0x3' # SFP/SFP+/SFP28 and later +] +QSFP_TYPE_LIST = [ + '0xc', # QSFP + '0xd', # QSFP+ or later + '0x11' # QSFP28 or later +] +QSFP_DD_TYPE_LIST = [ + '0x18' #QSFP-DD Type +] + +class Sfp(SfpOptoeBase): """ DELLEMC Platform-specific Sfp class """ BASE_RES_PATH = "/sys/bus/pci/devices/0000:04:00.0/resource0" - def __init__(self, index=0, sfp_type=0, eeprom_path=''): - SfpBase.__init__(self) + def __init__(self, index, sfp_type, eeprom_path): + SfpOptoeBase.__init__(self) self.sfp_type = sfp_type self.index = index self.eeprom_path = eeprom_path - self.qsfpInfo = sff8436InterfaceId() - self.qsfpDomInfo = sff8436Dom() - self.sfpInfo = sff8472InterfaceId() - self.sfpDomInfo = sff8472Dom(None,1) + self._initialize_media(delay=False) + + def get_eeprom_path(self): + return self.eeprom_path + + def get_name(self): + return "SFP/SFP+/SFP28" if self.index < 25 else "QSFP28 or later" def pci_mem_read(self, mm, offset): mm.seek(offset) @@ -196,337 +78,17 @@ def pci_get_value(self, resource, offset): os.close(fd) return val - def _read_eeprom_bytes(self, eeprom_path, offset, num_bytes): - eeprom_raw = [] - try: - eeprom = open(eeprom_path, mode="rb", buffering=0) - except IOError: - return None - - for i in range(0, num_bytes): - eeprom_raw.append("0x00") - - try: - eeprom.seek(offset) - raw = eeprom.read(num_bytes) - except IOError: - eeprom.close() - return None - - try: - if isinstance(raw , str): - for n in range(0, num_bytes): - eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) - else: - for n in range(0, num_bytes): - eeprom_raw[n] = hex(raw[n])[2:].zfill(2) - - except BaseException: - eeprom.close() - return None - - eeprom.close() - return eeprom_raw - - def _get_eeprom_data(self, eeprom_key): - eeprom_data = None - page_offset = None - - if(self.sfp_type == 'QSFP'): - page_offset = sff8436_parser[eeprom_key][PAGE_OFFSET] - eeprom_data_raw = self._read_eeprom_bytes( - self.eeprom_path, - (sff8436_parser[eeprom_key][PAGE_OFFSET] + - sff8436_parser[eeprom_key][KEY_OFFSET]), - sff8436_parser[eeprom_key][KEY_WIDTH]) - if (eeprom_data_raw is not None): - # Offset 128 is used to retrieve sff8436InterfaceId Info - # Offset 0 is used to retrieve sff8436Dom Info - if (page_offset == 128): - if ( self.qsfpInfo is None): - return None - eeprom_data = getattr( - self.qsfpInfo, sff8436_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - if ( self.qsfpDomInfo is None): - return None - eeprom_data = getattr( - self.qsfpDomInfo, sff8436_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - page_offset = sff8472_parser[eeprom_key][PAGE_OFFSET] - eeprom_data_raw = self._read_eeprom_bytes( - self.eeprom_path, - (sff8472_parser[eeprom_key][PAGE_OFFSET] + - sff8472_parser[eeprom_key][KEY_OFFSET]), - sff8472_parser[eeprom_key][KEY_WIDTH]) - if (eeprom_data_raw is not None): - # Offset 0 is used to retrieve sff8472InterfaceId Info - # Offset 256 is used to retrieve sff8472Dom Info - if (page_offset == 0): - if ( self.sfpInfo is None): - return None - eeprom_data = getattr( - self.sfpInfo, sff8472_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - if ( self.sfpDomInfo is None): - return None - eeprom_data = getattr( - self.sfpDomInfo, sff8472_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - - return eeprom_data - - def get_transceiver_info(self): - """ - Retrieves transceiver info of this SFP - """ - transceiver_info_dict = {} - compliance_code_dict = {} - transceiver_info_dict = dict.fromkeys(info_dict_keys, 'N/A') - # BaseInformation - iface_data = self._get_eeprom_data('type') - if (iface_data is not None): - connector = iface_data['data']['Connector']['value'] - encoding = iface_data['data']['EncodingCodes']['value'] - ext_id = iface_data['data']['Extended Identifier']['value'] - rate_identifier = iface_data['data']['RateIdentifier']['value'] - identifier = iface_data['data']['type']['value'] - type_abbrv_name=iface_data['data']['type_abbrv_name']['value'] - if(self.sfp_type == 'QSFP'): - bit_rate = str( - iface_data['data']['Nominal Bit Rate(100Mbs)']['value']) - for key in qsfp_compliance_code_tup: - if key in iface_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = iface_data['data']['Specification compliance']['value'][key]['value'] - for key in qsfp_cable_length_tup: - if key in iface_data['data']: - cable_type = key - cable_length = str(iface_data['data'][key]['value']) - else: - bit_rate = str( - iface_data['data']['NominalSignallingRate(UnitsOf100Mbd)']['value']) - for key in sfp_compliance_code_tup: - if key in iface_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = iface_data['data']['Specification compliance']['value'][key]['value'] - for key in sfp_cable_length_tup: - if key in iface_data['data']: - cable_type = key - cable_length = str(iface_data['data'][key]['value']) - else: - return transceiver_info_dict - - # Vendor Date - vendor_date_data = self._get_eeprom_data('vendor_date') - if (vendor_date_data is not None): - vendor_date = vendor_date_data['data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] - else: - return transceiver_info_dict - - # Vendor Name - vendor_name_data = self._get_eeprom_data('manufacturer') - if (vendor_name_data is not None): - vendor_name = vendor_name_data['data']['Vendor Name']['value'] - else: - return transceiver_info_dict - - # Vendor OUI - vendor_oui_data = self._get_eeprom_data('vendor_oui') - if (vendor_oui_data is not None): - vendor_oui = vendor_oui_data['data']['Vendor OUI']['value'] - else: - return transceiver_info_dict - - # Vendor PN - vendor_pn_data = self._get_eeprom_data('model') - if (vendor_pn_data is not None): - vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] - else: - return transceiver_info_dict - - # Vendor Revision - vendor_rev_data = self._get_eeprom_data('hardware_rev') - if (vendor_rev_data is not None): - vendor_rev = vendor_rev_data['data']['Vendor Rev']['value'] - else: - return transceiver_info_dict - - # Vendor Serial Number - vendor_sn_data = self._get_eeprom_data('serial') - if (vendor_sn_data is not None): - vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] - else: - return transceiver_info_dict - - # Fill The Dictionary and return - transceiver_info_dict['type'] = identifier - transceiver_info_dict['hardware_rev'] = vendor_rev - transceiver_info_dict['serial'] = vendor_sn - transceiver_info_dict['manufacturer'] = vendor_name - transceiver_info_dict['model'] = vendor_pn - transceiver_info_dict['connector'] = connector - transceiver_info_dict['encoding'] = encoding - transceiver_info_dict['ext_identifier'] = ext_id - transceiver_info_dict['ext_rateselect_compliance'] = rate_identifier - transceiver_info_dict['cable_type'] = cable_type - transceiver_info_dict['cable_length'] = cable_length - transceiver_info_dict['nominal_bit_rate'] = bit_rate - transceiver_info_dict['specification_compliance'] = str(compliance_code_dict) - transceiver_info_dict['vendor_date'] = vendor_date - transceiver_info_dict['vendor_oui'] = vendor_oui - transceiver_info_dict['type_abbrv_name']=type_abbrv_name - - return transceiver_info_dict - - def get_transceiver_threshold_info(self): - """ - Retrieves transceiver threshold info of this SFP - """ - transceiver_dom_threshold_dict = {} - transceiver_dom_threshold_dict = dict.fromkeys( - threshold_dict_keys, 'N/A') - - # Module Threshold - module_threshold_data = self._get_eeprom_data('ModuleThreshold') - if (self.sfp_type == 'QSFP'): - # Channel Threshold - channel_threshold_data = self._get_eeprom_data('ChannelThreshold') - - if (channel_threshold_data is not None and module_threshold_data is not None): - transceiver_dom_threshold_dict['temphighalarm'] = module_threshold_data['data']['TempHighAlarm']['value'] - transceiver_dom_threshold_dict['temphighwarning'] = module_threshold_data['data']['TempHighWarning']['value'] - transceiver_dom_threshold_dict['templowalarm'] = module_threshold_data['data']['TempLowAlarm']['value'] - transceiver_dom_threshold_dict['templowwarning'] = module_threshold_data['data']['TempLowWarning']['value'] - transceiver_dom_threshold_dict['vcchighalarm'] = module_threshold_data['data']['VccHighAlarm']['value'] - transceiver_dom_threshold_dict['vcchighwarning'] = module_threshold_data['data']['VccHighWarning']['value'] - transceiver_dom_threshold_dict['vcclowalarm'] = module_threshold_data['data']['VccLowAlarm']['value'] - transceiver_dom_threshold_dict['vcclowwarning'] = module_threshold_data['data']['VccLowWarning']['value'] - transceiver_dom_threshold_dict['rxpowerhighalarm'] = channel_threshold_data['data']['RxPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerhighwarning'] = channel_threshold_data['data']['RxPowerHighWarning']['value'] - transceiver_dom_threshold_dict['rxpowerlowalarm'] = channel_threshold_data['data']['RxPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerlowwarning'] = channel_threshold_data['data']['RxPowerLowWarning']['value'] - transceiver_dom_threshold_dict['txbiashighalarm'] = channel_threshold_data['data']['TxBiasHighAlarm']['value'] - transceiver_dom_threshold_dict['txbiashighwarning'] = channel_threshold_data['data']['TxBiasHighWarning']['value'] - transceiver_dom_threshold_dict['txbiaslowalarm'] = channel_threshold_data['data']['TxBiasLowAlarm']['value'] - transceiver_dom_threshold_dict['txbiaslowwarning'] = channel_threshold_data['data']['TxBiasLowWarning']['value'] - - else: - return transceiver_dom_threshold_dict - else: - #SFP - if (module_threshold_data is not None): - #Threshold Data - transceiver_dom_threshold_dict['temphighalarm'] = module_threshold_data['data']['TempHighAlarm']['value'] - transceiver_dom_threshold_dict['templowalarm'] = module_threshold_data['data']['TempLowAlarm']['value'] - transceiver_dom_threshold_dict['temphighwarning'] = module_threshold_data['data']['TempHighWarning']['value'] - transceiver_dom_threshold_dict['templowwarning'] = module_threshold_data['data']['TempLowWarning']['value'] - transceiver_dom_threshold_dict['vcchighalarm'] = module_threshold_data['data']['VoltageHighAlarm']['value'] - transceiver_dom_threshold_dict['vcclowalarm'] = module_threshold_data['data']['VoltageLowAlarm']['value'] - transceiver_dom_threshold_dict['vcchighwarning'] = module_threshold_data['data']['VoltageHighWarning']['value'] - transceiver_dom_threshold_dict['vcclowwarning'] = module_threshold_data['data']['VoltageLowWarning']['value'] - transceiver_dom_threshold_dict['txbiashighalarm'] = module_threshold_data['data']['BiasHighAlarm']['value'] - transceiver_dom_threshold_dict['txbiaslowalarm'] = module_threshold_data['data']['BiasLowAlarm']['value'] - transceiver_dom_threshold_dict['txbiashighwarning'] = module_threshold_data['data']['BiasHighWarning']['value'] - transceiver_dom_threshold_dict['txbiaslowwarning'] = module_threshold_data['data']['BiasLowWarning']['value'] - transceiver_dom_threshold_dict['txpowerhighalarm'] = module_threshold_data['data']['TXPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['txpowerlowalarm'] = module_threshold_data['data']['TXPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['txpowerhighwarning'] = module_threshold_data['data']['TXPowerHighWarning']['value'] - transceiver_dom_threshold_dict['txpowerlowwarning'] = module_threshold_data['data']['TXPowerLowWarning']['value'] - transceiver_dom_threshold_dict['rxpowerhighalarm'] = module_threshold_data['data']['RXPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerlowalarm'] = module_threshold_data['data']['RXPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerhighwarning'] = module_threshold_data['data']['RXPowerHighWarning']['value'] - transceiver_dom_threshold_dict['rxpowerlowwarning'] = module_threshold_data['data']['RXPowerLowWarning']['value'] - else: - return transceiver_dom_threshold_dict - - return transceiver_dom_threshold_dict - - def get_transceiver_bulk_status(self): - """ - Retrieves transceiver bulk status of this SFP - """ - tx_bias_list = [] - rx_power_list = [] - transceiver_dom_dict = {} - transceiver_dom_dict = dict.fromkeys(dom_dict_keys, 'N/A') - - # RxLos - rx_los = self.get_rx_los() - - # TxFault - tx_fault = self.get_tx_fault() - - # ResetStatus - reset_state = self.get_reset_status() - - # LowPower Mode - lp_mode = self.get_lpmode() - - # TxDisable - tx_disable = self.get_tx_disable() - - # TxDisable Channel - tx_disable_channel = self.get_tx_disable_channel() - - # Temperature - temperature = self.get_temperature() - - # Voltage - voltage = self.get_voltage() - - # Channel Monitor - tx_power_list = self.get_tx_power() - - # tx bias - tx_bias_list = self.get_tx_bias() - - # rx power - rx_power_list = self.get_rx_power() - - if (len(tx_bias_list) != 0): - transceiver_dom_dict['tx1bias'] = tx_bias_list[0] - transceiver_dom_dict['tx2bias'] = tx_bias_list[1] - transceiver_dom_dict['tx3bias'] = tx_bias_list[2] - transceiver_dom_dict['tx4bias'] = tx_bias_list[3] - - if (len(rx_power_list) != 0): - transceiver_dom_dict['rx1power'] = rx_power_list[0] - transceiver_dom_dict['rx2power'] = rx_power_list[1] - transceiver_dom_dict['rx3power'] = rx_power_list[2] - transceiver_dom_dict['rx4power'] = rx_power_list[3] - - if (len(tx_power_list) != 0): - transceiver_dom_dict['tx1power'] = tx_power_list[0] - transceiver_dom_dict['tx2power'] = tx_power_list[1] - transceiver_dom_dict['tx3power'] = tx_power_list[2] - transceiver_dom_dict['tx4power'] = tx_power_list[3] - - transceiver_dom_dict['rx_los'] = rx_los - transceiver_dom_dict['tx_fault'] = tx_fault - transceiver_dom_dict['reset_status'] = reset_state - transceiver_dom_dict['power_lpmode'] = lp_mode - transceiver_dom_dict['tx_disable'] = tx_disable - transceiver_dom_dict['tx_disable_channel'] = tx_disable_channel - transceiver_dom_dict['temperature'] = temperature - transceiver_dom_dict['voltage'] = voltage - - return transceiver_dom_dict - - def get_name(self): + def _initialize_media(self,delay=False): """ - Retrieves the name of the sfp - Returns : QSFP or QSFP+ or QSFP28 + Initialize the media type and eeprom driver for SFP """ + if delay: + time.sleep(1) + self._xcvr_api = None + self.get_xcvr_api() - iface_data = self._get_eeprom_data('type') - if (iface_data is not None): - identifier = iface_data['data']['type']['value'] - else: - return None - - return identifier + self.set_media_type() + self.reinit_sfp_driver() def get_presence(self): """ @@ -534,60 +96,27 @@ def get_presence(self): Returns : True if sfp is present and false if it is absent """ # Check for invalid port_num - + mask = {'QSFP' : (1 << 4), 'SFP' : (1 << 0)} # Port offset starts with 0x4004 port_offset = 16388 + ((self.index-1) * 16) - status = self.pci_get_value(self.BASE_RES_PATH, port_offset) - reg_value = int(status) - - # Absence of status throws error - if (reg_value == ""): - return False - - # Mask off 4th bit for presence - if(self.sfp_type == 'QSFP'): - mask = (1 << 4) - - # Mask off 1st bit for presence 65,66 - if (self.sfp_type == 'SFP'): - mask = (1 << 0) - # ModPrsL is active low - if reg_value & mask == 0: - return True + try: + status = self.pci_get_value(self.BASE_RES_PATH, port_offset) + reg_value = int(status) + # ModPrsL is active low + if reg_value & mask[self.port_type] == 0: + return True + except ValueError: + pass return False - def get_model(self): - """ - Retrieves the model number (or part number) of the sfp - """ - vendor_pn_data = self._get_eeprom_data('model') - if (vendor_pn_data is not None): - vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] - else: - return None - - return vendor_pn - - def get_serial(self): - """ - Retrieves the serial number of the sfp - """ - vendor_sn_data = self._get_eeprom_data('serial') - if (vendor_sn_data is not None): - vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] - else: - return None - - return vendor_sn - def get_reset_status(self): """ Retrives the reset status of SFP """ reset_status = False - if (self.sfp_type == 'QSFP'): + if (self.port_type == 'QSFP'): # Port offset starts with 0x4000 port_offset = 16384 + ((self.index-1) * 16) @@ -608,187 +137,12 @@ def get_reset_status(self): return reset_status - def get_rx_los(self): - """ - Retrieves the RX LOS (lost-of-signal) status of SFP - """ - rx_los = None - rx_los_list = [] - if (self.sfp_type == 'QSFP'): - rx_los_data = self._get_eeprom_data('rx_los') - if (rx_los_data is not None): - rx_los = rx_los_data['data']['Rx1LOS']['value'] - if (rx_los is 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - rx_los = rx_los_data['data']['Rx2LOS']['value'] - if (rx_los is 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - rx_los = rx_los_data['data']['Rx3LOS']['value'] - if (rx_los is 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - rx_los = rx_los_data['data']['Rx4LOS']['value'] - if (rx_los is 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - - if (rx_los_list[0] and rx_los_list[1] - and rx_los_list[2] and rx_los_list[3]): - rx_los = True - else: - rx_los = False - else: - rx_los_data = self._read_eeprom_bytes(self.eeprom_path, SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - if (rx_los_data is not None): - data = int(rx_los_data[0], 16) - rx_los = (sffbase().test_bit(data, 1) != 0) - - return rx_los - - def get_tx_fault(self): - """ - Retrieves the TX fault status of SFP - """ - tx_fault = None - tx_fault_list = [] - if (self.sfp_type == 'QSFP'): - tx_fault_data = self._get_eeprom_data('tx_fault') - if (tx_fault_data is not None): - tx_fault = tx_fault_data['data']['Tx1Fault']['value'] - if (tx_fault is 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - tx_fault = tx_fault_data['data']['Tx2Fault']['value'] - if (tx_fault is 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - tx_fault = tx_fault_data['data']['Tx3Fault']['value'] - if (tx_fault is 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - tx_fault = tx_fault_data['data']['Tx4Fault']['value'] - if (tx_fault is 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - - if (tx_fault_list[0] and tx_fault_list[1] - and tx_fault_list[2] and tx_fault_list[3]): - tx_fault = True - else: - tx_fault = False - - else: - tx_fault_data = self._read_eeprom_bytes(self.eeprom_path, SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - if (tx_fault_data is not None): - data = int(tx_fault_data[0], 16) - tx_fault = (sffbase().test_bit(data, 2) != 0) - - return tx_fault - - def get_tx_disable(self): - """ - Retrieves the tx_disable status of this SFP - """ - tx_disable = None - tx_disable_list = [] - if (self.sfp_type == 'QSFP'): - tx_disable_data = self._get_eeprom_data('tx_disable') - if (tx_disable_data is not None): - tx_disable = tx_disable_data['data']['Tx1Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - tx_disable = tx_disable_data['data']['Tx2Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - tx_disable = tx_disable_data['data']['Tx3Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - tx_disable = tx_disable_data['data']['Tx4Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - - if (tx_disable_list[0] and tx_disable_list[1] - and tx_disable_list[2] and tx_disable_list[3]): - tx_disable = True - else: - tx_disable = False - - else: - tx_disable_data = self._read_eeprom_bytes(self.eeprom_path, SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - if (tx_disable_data is not None): - data = int(tx_disable_data[0], 16) - tx_disable_hard = (sffbase().test_bit(data, SFP_TX_DISABLE_HARD_BIT) != 0) - tx_disable_soft = (sffbase().test_bit(data, SFP_TX_DISABLE_SOFT_BIT) != 0) - tx_disable = tx_disable_hard | tx_disable_soft - - - return tx_disable - - def get_tx_disable_channel(self): - """ - Retrieves the TX disabled channels in this SFP - """ - tx_disable = None - tx_disable_list = [] - tx_disable_channel = 0 - - if (self.sfp_type == 'QSFP'): - tx_disable_data = self._get_eeprom_data('tx_disable') - if (tx_disable_data is not None): - tx_disable = tx_disable_data['data']['Tx1Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(1) - else: - tx_disable_list.append(0) - tx_disable = tx_disable_data['data']['Tx2Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(1) - else: - tx_disable_list.append(0) - tx_disable = tx_disable_data['data']['Tx3Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(1) - else: - tx_disable_list.append(0) - tx_disable = tx_disable_data['data']['Tx4Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(1) - else: - tx_disable_list.append(0) - - bit4 = int(tx_disable_list[3]) * 8 - bit3 = int(tx_disable_list[2]) * 4 - bit2 = int(tx_disable_list[1]) * 2 - bit1 = int(tx_disable_list[0]) * 1 - - tx_disable_channel = hex(bit4 + bit3 + bit2 + bit1) - - return tx_disable_channel - def get_lpmode(self): """ Retrieves the lpmode(low power mode) of this SFP """ lpmode_state = False - if (self.sfp_type == 'QSFP'): + if (self.port_type == 'QSFP'): # Port offset starts with 0x4000 port_offset = 16384 + ((self.index-1) * 16) @@ -811,149 +165,11 @@ def get_lpmode(self): return lpmode_state - def get_power_override(self): - """ - Retrieves the power-override status of this SFP - """ - power_override_state = False - - if (self.sfp_type == 'QSFP'): - power_override_data = self._get_eeprom_data('power_override') - if (power_override_data is not None): - power_override = power_override_data['data']['PowerOverRide']['value'] - if (power_override is 'On'): - power_override_state = True - else: - power_override_state = False - - return power_override_state - - def get_temperature(self): - """ - Retrieves the temperature of this SFP - """ - temperature = None - - temperature_data = self._get_eeprom_data('Temperature') - if (temperature_data is not None): - temperature = temperature_data['data']['Temperature']['value'] - - return temperature - - def get_voltage(self): - """ - Retrieves the supply voltage of this SFP - """ - voltage = None - - voltage_data = self._get_eeprom_data('Voltage') - if (voltage_data is not None): - voltage = voltage_data['data']['Vcc']['value'] - - return voltage - - def get_tx_bias(self): - """ - Retrieves the TX bias current of this SFP - """ - tx_bias = None - tx_bias_list = [] - - tx_bias_data = self._get_eeprom_data('ChannelMonitor') - if (tx_bias_data is not None): - if (self.sfp_type == 'QSFP'): - tx_bias = tx_bias_data['data']['TX1Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = tx_bias_data['data']['TX2Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = tx_bias_data['data']['TX3Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = tx_bias_data['data']['TX4Bias']['value'] - tx_bias_list.append(tx_bias) - else: - tx1_bias = tx_bias_data['data']['TXBias']['value'] - return [tx1_bias, "N/A", "N/A", "N/A"] - - return tx_bias_list - - def get_rx_power(self): - """ - Retrieves the received optical power for this SFP - """ - rx_power = None - rx_power_list = [] - - rx_power_data = self._get_eeprom_data('ChannelMonitor') - if (rx_power_data is not None): - if (self.sfp_type == 'QSFP'): - rx_power = rx_power_data['data']['RX1Power']['value'] - rx_power_list.append(rx_power) - rx_power = rx_power_data['data']['RX2Power']['value'] - rx_power_list.append(rx_power) - rx_power = rx_power_data['data']['RX3Power']['value'] - rx_power_list.append(rx_power) - rx_power = rx_power_data['data']['RX4Power']['value'] - rx_power_list.append(rx_power) - else: - rx1_pw = rx_power_data['data']['RXPower']['value'] - return [rx1_pw, "N/A", "N/A", "N/A"] - - return rx_power_list - - def get_tx_power(self): - """ - Retrieves the TX power of this SFP - """ - tx_power_list = [] - if(self.sfp_type == 'QSFP'): - # QSFP capability byte parse, through this byte can know whether it support tx_power or not. - # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, - # need to add more code for determining the capability and version compliance - # in SFF-8636 dom capability definitions evolving with the versions. - qspf_dom_capability_data = self._get_eeprom_data('dom_capability') - qsfp_dom_rev_data = self._get_eeprom_data('dom_rev') - if (qspf_dom_capability_data is not None and qsfp_dom_rev_data is not None): - qsfp_dom_rev = qsfp_dom_rev_data['data']['dom_rev']['value'] - qsfp_tx_power_support = qspf_dom_capability_data['data']['Tx_power_support']['value'] - else: - return tx_power_list - - # The tx_power monitoring is only available on QSFP which compliant with SFF-8636 - # and claimed that it support tx_power with one indicator bit. - if (qsfp_dom_rev[0:8] != 'SFF-8636' or (qsfp_dom_rev[0:8] == 'SFF-8636' and qsfp_tx_power_support != 'on')): - return tx_power_list - else: - channel_monitor_data = self._get_eeprom_data('ChannelMonitor_TxPower') - if (channel_monitor_data is not None): - tx1_pw = channel_monitor_data['data']['TX1Power']['value'] - tx2_pw = channel_monitor_data['data']['TX2Power']['value'] - tx3_pw = channel_monitor_data['data']['TX3Power']['value'] - tx4_pw = channel_monitor_data['data']['TX4Power']['value'] - else: - return tx_power_list - - else: - channel_monitor_data = self._get_eeprom_data('ChannelMonitor') - if (channel_monitor_data is not None): - tx1_pw = channel_monitor_data['data']['TXPower']['value'] - tx2_pw = 'N/A' - tx3_pw = 'N/A' - tx4_pw = 'N/A' - else: - return tx_power_list - - tx_power_list.append(tx1_pw) - tx_power_list.append(tx2_pw) - tx_power_list.append(tx3_pw) - tx_power_list.append(tx4_pw) - - return tx_power_list - def reset(self): """ Reset the SFP and returns all user settings to their default state """ - if (self.sfp_type == 'QSFP'): + if (self.port_type == 'QSFP'): # Port offset starts with 0x4000 port_offset = 16384 + ((self.index-1) * 16) @@ -990,7 +206,7 @@ def set_lpmode(self, lpmode): """ Sets the lpmode(low power mode) of this SFP """ - if (self.sfp_type == 'QSFP'): + if (self.port_type == 'QSFP'): # Port offset starts with 0x4000 port_offset = 16384 + ((self.index-1) * 16) @@ -1018,24 +234,6 @@ def set_lpmode(self, lpmode): else: return False - def tx_disable(self, tx_disable): - """ - Disable SFP TX for all channels - """ - return False - - def tx_disable_channel(self, channel, disable): - """ - Sets the tx_disable for specified SFP channels - """ - return False - - def set_power_override(self, power_override, power_set): - """ - Sets SFP power level using power_override and power_set - """ - return False - def get_status(self): """ Retrieves the operational status of the device @@ -1048,3 +246,68 @@ def get_status(self): status = True return status + + def set_media_type(self): + """ + Reads optic eeprom byte to determine media type inserted + """ + eeprom_raw = [] + eeprom_raw = self._xcvr_api_factory._get_id() + if eeprom_raw is not None: + eeprom_raw = hex(eeprom_raw) + if eeprom_raw in SFP_TYPE_LIST: + self.sfp_type = 'SFP' + elif eeprom_raw in QSFP_TYPE_LIST: + self.sfp_type = 'QSFP' + elif eeprom_raw in QSFP_DD_TYPE_LIST: + self.sfp_type = 'QSFP_DD' + else: + #Set native port type if EEPROM type is not recognized/readable + self.sfp_type = self.port_type + else: + self.sfp_type = self.port_type + + return self.sfp_type + + def reinit_sfp_driver(self): + """ + Changes the driver based on media type detected + """ + del_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/delete_device".format(self.index+1) + new_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/new_device".format(self.index+1) + driver_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/name".format(self.index+1) + delete_device = "echo 0x50 >" + del_sfp_path + + if not os.path.isfile(driver_path): + print(driver_path, "does not exist") + return False + + try: + with os.fdopen(os.open(driver_path, os.O_RDONLY)) as fd: + driver_name = fd.read() + driver_name = driver_name.rstrip('\r\n') + driver_name = driver_name.lstrip(" ") + + #Avoid re-initialization of the QSFP/SFP optic on QSFP/SFP port. + if self.sfp_type == 'SFP' and driver_name in ['optoe1', 'optoe3']: + subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + time.sleep(0.2) + new_device = "echo optoe2 0x50 >" + new_sfp_path + subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + time.sleep(2) + elif self.sfp_type == 'QSFP' and driver_name in ['optoe2', 'optoe3']: + subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + time.sleep(0.2) + new_device = "echo optoe1 0x50 >" + new_sfp_path + subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + time.sleep(2) + elif self.sfp_type == 'QSFP_DD' and driver_name in ['optoe1', 'optoe2']: + subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + time.sleep(0.2) + new_device = "echo optoe3 0x50 >" + new_sfp_path + subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + time.sleep(2) + + except IOError as e: + print("Error: Unable to open file: %s" % str(e)) + return False diff --git a/platform/broadcom/sonic-platform-modules-dell/s5232f/modules/dell_s5232f_fpga_ocores.c b/platform/broadcom/sonic-platform-modules-dell/s5232f/modules/dell_s5232f_fpga_ocores.c index 1565d4f5c645..7e1fb1ab4643 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5232f/modules/dell_s5232f_fpga_ocores.c +++ b/platform/broadcom/sonic-platform-modules-dell/s5232f/modules/dell_s5232f_fpga_ocores.c @@ -971,7 +971,7 @@ static int map_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev) /* map the device memory or IO region into kernel virtual * address space */ - fpgapci->bar[i] = ioremap_nocache (bar_start + FPGALOGIC_I2C_BASE, I2C_PCI_MAX_BUS * FPGALOGIC_CH_OFFSET); + fpgapci->bar[i] = ioremap (bar_start + FPGALOGIC_I2C_BASE, I2C_PCI_MAX_BUS * FPGALOGIC_CH_OFFSET); if (!fpgapci->bar[i]) { PRINT ( "Could not map BAR #%d.\n", i); @@ -985,7 +985,7 @@ static int map_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev) { fpga_phys_addr = bar_start; - fpga_ctl_addr = ioremap_nocache (bar_start, FPGA_CTL_REG_SIZE); + fpga_ctl_addr = ioremap (bar_start, FPGA_CTL_REG_SIZE); fpga_base_addr = fpgapci->bar[i]; } diff --git a/platform/broadcom/sonic-platform-modules-dell/s5232f/scripts/s5232f_platform.sh b/platform/broadcom/sonic-platform-modules-dell/s5232f/scripts/s5232f_platform.sh index cdb3412b7899..893dcfafaa26 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s5232f/scripts/s5232f_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/s5232f/scripts/s5232f_platform.sh @@ -150,17 +150,10 @@ platform_firmware_versions() { install_python_api_package() { device="/usr/share/sonic/device" platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) - - rv=$(pip install $device/$platform/sonic_platform-1.0-py2-none-any.whl) rv=$(pip3 install $device/$platform/sonic_platform-1.0-py3-none-any.whl) } remove_python_api_package() { - rv=$(pip show sonic-platform > /dev/null 2>/dev/null) - if [ $? -eq 0 ]; then - rv=$(pip uninstall -y sonic-platform > /dev/null 2>/dev/null) - fi - rv=$(pip3 show sonic-platform > /dev/null 2>/dev/null) if [ $? -eq 0 ]; then rv=$(pip3 uninstall -y sonic-platform > /dev/null 2>/dev/null) @@ -201,7 +194,7 @@ init_devnum if [ "$1" == "init" ]; then modprobe i2c-dev - modprobe i2c-mux-pca954x force_deselect_on_exit=1 + modprobe i2c-mux-pca954x modprobe ipmi_devintf modprobe ipmi_si kipmid_max_busy_us=1000 modprobe i2c_ocores @@ -217,17 +210,26 @@ if [ "$1" == "init" ]; then /usr/bin/qsfp_irq_enable.py platform_firmware_versions echo 1000 > /sys/module/ipmi_si/parameters/kipmid_max_busy_us + echo -2 > /sys/bus/i2c/drivers/pca954x/603-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/604-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/605-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/606-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/607-0074/idle_state elif [ "$1" == "deinit" ]; then sys_eeprom "delete_device" switch_board_qsfp "delete_device" switch_board_sfp "delete_device" switch_board_qsfp_mux "delete_device" + + modprobe -r dell_s5232f_fpga_ocores + modprobe -r i2c_ocores + modprobe -r acpi_ipmi + modprobe -r ipmi_si + modprobe -r ipmi_devintf modprobe -r i2c-mux-pca954x modprobe -r i2c-dev - remove_python_api_package - modprobe -r ipmi_devintf - modprobe -r ipmi_si + remove_python_api_package else echo "s5232f_platform : Invalid option !" fi diff --git a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/chassis.py index 1be2186fac76..41f985a173f9 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/chassis.py @@ -39,6 +39,7 @@ class Chassis(ChassisBase): oir_fd = -1 epoll = -1 + REBOOT_CAUSE_PATH = "/host/reboot-cause/platform/reboot_reason" pci_res = "/sys/bus/pci/devices/0000:04:00.0/resource0" sysled_offset = 0x0024 SYSLED_COLOR_TO_REG = { @@ -118,6 +119,7 @@ def get_change_event(self, timeout=0): if(presence and self._global_port_pres_dict[port_num] == '0'): self._global_port_pres_dict[port_num] = '1' port_dict[port_num] = '1' + self.get_sfp(port_num)._initialize_media(delay=True) elif(not presence and self._global_port_pres_dict[port_num] == '1'): self._global_port_pres_dict[port_num] = '0' @@ -289,15 +291,15 @@ def get_reboot_cause(self): return (self.REBOOT_CAUSE_NON_HARDWARE, None) if reboot_cause & 0x1: - return (self.REBOOT_CAUSE_POWER_LOSS, None) + return (self.REBOOT_CAUSE_POWER_LOSS, "Power on reset") elif reboot_cause & 0x2: return (self.REBOOT_CAUSE_NON_HARDWARE, None) elif reboot_cause & 0x4: return (self.REBOOT_CAUSE_HARDWARE_OTHER, "PSU Shutdown") elif reboot_cause & 0x8: - return (self.REBOOT_CAUSE_THERMAL_OVERLOAD_CPU, None) + return (self.REBOOT_CAUSE_THERMAL_OVERLOAD_CPU, "Thermal overload") elif reboot_cause & 0x10: - return (self.REBOOT_CAUSE_WATCHDOG, None) + return (self.REBOOT_CAUSE_WATCHDOG, "Watchdog reset") elif reboot_cause & 0x20: return (self.REBOOT_CAUSE_HARDWARE_OTHER, "BMC Shutdown") elif reboot_cause & 0x40: diff --git a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/sfp.py index eed6dc7b03da..955e39d64297 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/sfp.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# -# DELLEMC +# DELLEMC S5232F # # Module contains an implementation of SONiC Platform Base API and # provides the platform information @@ -13,159 +13,41 @@ import time import struct import mmap - from sonic_platform_base.sfp_base import SfpBase - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom - from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId - from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom - from sonic_platform_base.sonic_sfp.sff8472 import sffbase + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase except ImportError as e: raise ImportError(str(e) + "- required module not found") -PAGE_OFFSET = 0 -KEY_OFFSET = 1 -KEY_WIDTH = 2 -FUNC_NAME = 3 - -QSFP_INFO_OFFSET = 128 -QSFP_DOM_OFFSET = 0 -QSFP_DOM_OFFSET1 = 384 - -SFP_INFO_OFFSET = 0 -SFP_DOM_OFFSET = 256 - -SFP_STATUS_CONTROL_OFFSET = 110 -SFP_STATUS_CONTROL_WIDTH = 7 -SFP_TX_DISABLE_HARD_BIT = 7 -SFP_TX_DISABLE_SOFT_BIT = 6 - -qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)', 'Length OM2(m)', - 'Length OM1(m)', 'Length Cable Assembly(m)') - -qsfp_compliance_code_tup = ( - '10/40G Ethernet Compliance Code', - 'SONET Compliance codes', - 'SAS/SATA compliance codes', - 'Gigabit Ethernet Compliant codes', - 'Fibre Channel link length/Transmitter Technology', - 'Fibre Channel transmission media', - 'Fibre Channel Speed') - -sfp_cable_length_tup = ('LengthSMFkm-UnitsOfKm', 'LengthSMF(UnitsOf100m)', - 'Length50um(UnitsOf10m)', 'Length62.5um(UnitsOfm)', - 'LengthOM3(UnitsOf10m)', 'LengthCable(UnitsOfm)') - -sfp_compliance_code_tup = ('10GEthernetComplianceCode', 'InfinibandComplianceCode', - 'ESCONComplianceCodes', 'SONETComplianceCodes', - 'EthernetComplianceCodes', 'FibreChannelLinkLength', - 'FibreChannelTechnology', 'SFP+CableTechnology', - 'FibreChannelTransmissionMedia', 'FibreChannelSpeed') - -info_dict_keys = ['type', 'hardware_rev', 'serial', - 'manufacturer', 'model', 'connector', - 'encoding', 'ext_identifier', 'ext_rateselect_compliance', - 'cable_type', 'cable_length', 'nominal_bit_rate', - 'specification_compliance', 'type_abbrv_name','vendor_date', 'vendor_oui'] - -dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', - 'power_lpmode', 'tx_disable', 'tx_disable_channel', - 'temperature', 'voltage', 'rx1power', - 'rx2power', 'rx3power', 'rx4power', - 'tx1bias', 'tx2bias', 'tx3bias', - 'tx4bias', 'tx1power', 'tx2power', - 'tx3power', 'tx4power'] - -threshold_dict_keys = ['temphighalarm', 'temphighwarning', - 'templowalarm', 'templowwarning', - 'vcchighalarm', 'vcchighwarning', - 'vcclowalarm', 'vcclowwarning', - 'rxpowerhighalarm', 'rxpowerhighwarning', - 'rxpowerlowalarm', 'rxpowerlowwarning', - 'txpowerhighalarm', 'txpowerhighwarning', - 'txpowerlowalarm', 'txpowerlowwarning', - 'txbiashighalarm', 'txbiashighwarning', - 'txbiaslowalarm', 'txbiaslowwarning'] - -sff8436_parser = { - 'reset_status': [QSFP_DOM_OFFSET, 2, 1, 'parse_dom_status_indicator'], - 'rx_los': [QSFP_DOM_OFFSET, 3, 1, 'parse_dom_tx_rx_los'], - 'tx_fault': [QSFP_DOM_OFFSET, 4, 1, 'parse_dom_tx_fault'], - 'tx_disable': [QSFP_DOM_OFFSET, 86, 1, 'parse_dom_tx_disable'], - 'power_lpmode': [QSFP_DOM_OFFSET, 93, 1, 'parse_dom_power_control'], - 'power_override': [QSFP_DOM_OFFSET, 93, 1, 'parse_dom_power_control'], - 'Temperature': [QSFP_DOM_OFFSET, 22, 2, 'parse_temperature'], - 'Voltage': [QSFP_DOM_OFFSET, 26, 2, 'parse_voltage'], - 'ChannelMonitor': [QSFP_DOM_OFFSET, 34, 16, 'parse_channel_monitor_params'], - 'ChannelMonitor_TxPower': - [QSFP_DOM_OFFSET, 34, 24, 'parse_channel_monitor_params_with_tx_power'], - - 'cable_type': [QSFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'cable_length': [QSFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'connector': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'type': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'encoding': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'ext_identifier': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'ext_rateselect_compliance': - [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'nominal_bit_rate': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'specification_compliance': - [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'type_abbrv_name': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'manufacturer': [QSFP_INFO_OFFSET, 20, 16, 'parse_vendor_name'], - 'vendor_oui': [QSFP_INFO_OFFSET, 37, 3, 'parse_vendor_oui'], - 'model': [QSFP_INFO_OFFSET, 40, 16, 'parse_vendor_pn'], - 'hardware_rev': [QSFP_INFO_OFFSET, 56, 2, 'parse_vendor_rev'], - 'serial': [QSFP_INFO_OFFSET, 68, 16, 'parse_vendor_sn'], - 'vendor_date': [QSFP_INFO_OFFSET, 84, 8, 'parse_vendor_date'], - 'dom_capability': [QSFP_INFO_OFFSET, 92, 1, 'parse_dom_capability'], - 'dom_rev': [QSFP_DOM_OFFSET, 1, 1, 'parse_sfp_dom_rev'], - 'ModuleThreshold': [QSFP_DOM_OFFSET1, 128, 24, 'parse_module_threshold_values'], - 'ChannelThreshold': [QSFP_DOM_OFFSET1, 176, 16, 'parse_channel_threshold_values'], -} - -sff8472_parser = { - 'Temperature': [SFP_DOM_OFFSET, 96, 2, 'parse_temperature'], - 'Voltage': [SFP_DOM_OFFSET, 98, 2, 'parse_voltage'], - 'ChannelMonitor': [SFP_DOM_OFFSET, 100, 6, 'parse_channel_monitor_params'], - - 'cable_type': [SFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'cable_length': [SFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'connector': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'type': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'encoding': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'ext_identifier': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'ext_rateselect_compliance': - [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'nominal_bit_rate': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'specification_compliance': - [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'type_abbrv_name': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'manufacturer': [SFP_INFO_OFFSET, 20, 16, 'parse_vendor_name'], - 'vendor_oui': [SFP_INFO_OFFSET, 37, 3, 'parse_vendor_oui'], - 'model': [SFP_INFO_OFFSET, 40, 16, 'parse_vendor_pn'], - 'hardware_rev': [SFP_INFO_OFFSET, 56, 4, 'parse_vendor_rev'], - 'serial': [SFP_INFO_OFFSET, 68, 16, 'parse_vendor_sn'], - 'vendor_date': [SFP_INFO_OFFSET, 84, 8, 'parse_vendor_date'], - 'ModuleThreshold': [SFP_DOM_OFFSET, 0, 56, 'parse_alarm_warning_threshold'], -} - - -class Sfp(SfpBase): +SFP_TYPE_LIST = [ + '0x3' # SFP/SFP+/SFP28 and later +] +QSFP_TYPE_LIST = [ + '0xc', # QSFP + '0xd', # QSFP+ or later + '0x11' # QSFP28 or later +] +QSFP_DD_TYPE_LIST = [ + '0x18' #QSFP-DD Type +] + +class Sfp(SfpOptoeBase): """ DELLEMC Platform-specific Sfp class """ BASE_RES_PATH = "/sys/bus/pci/devices/0000:04:00.0/resource0" - def __init__(self, index=0, sfp_type=0, eeprom_path=''): - SfpBase.__init__(self) + def __init__(self, index, sfp_type, eeprom_path): + SfpOptoeBase.__init__(self) self.sfp_type = sfp_type self.index = index self.eeprom_path = eeprom_path - self.qsfpInfo = sff8436InterfaceId() - self.qsfpDomInfo = sff8436Dom() - self.sfpInfo = sff8472InterfaceId() - self.sfpDomInfo = sff8472Dom(None,1) + self._initialize_media(delay=False) + + def get_eeprom_path(self): + return self.eeprom_path + + def get_name(self): + return "QSFP28 or later" if self.index < 33 else "SFP/SFP+/SFP28" def pci_mem_read(self, mm, offset): mm.seek(offset) @@ -196,337 +78,17 @@ def pci_get_value(self, resource, offset): os.close(fd) return val - def _read_eeprom_bytes(self, eeprom_path, offset, num_bytes): - eeprom_raw = [] - try: - eeprom = open(eeprom_path, mode="rb", buffering=0) - except IOError: - return None - - for i in range(0, num_bytes): - eeprom_raw.append("0x00") - - try: - eeprom.seek(offset) - raw = eeprom.read(num_bytes) - except IOError: - eeprom.close() - return None - - try: - if isinstance(raw , str): - for n in range(0, num_bytes): - eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) - else: - for n in range(0, num_bytes): - eeprom_raw[n] = hex(raw[n])[2:].zfill(2) - - except BaseException: - eeprom.close() - return None - - eeprom.close() - return eeprom_raw - - def _get_eeprom_data(self, eeprom_key): - eeprom_data = None - page_offset = None - - if(self.sfp_type == 'QSFP'): - page_offset = sff8436_parser[eeprom_key][PAGE_OFFSET] - eeprom_data_raw = self._read_eeprom_bytes( - self.eeprom_path, - (sff8436_parser[eeprom_key][PAGE_OFFSET] + - sff8436_parser[eeprom_key][KEY_OFFSET]), - sff8436_parser[eeprom_key][KEY_WIDTH]) - if (eeprom_data_raw is not None): - # Offset 128 is used to retrieve sff8436InterfaceId Info - # Offset 0 is used to retrieve sff8436Dom Info - if (page_offset == 128): - if ( self.qsfpInfo is None): - return None - eeprom_data = getattr( - self.qsfpInfo, sff8436_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - if ( self.qsfpDomInfo is None): - return None - eeprom_data = getattr( - self.qsfpDomInfo, sff8436_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - page_offset = sff8472_parser[eeprom_key][PAGE_OFFSET] - eeprom_data_raw = self._read_eeprom_bytes( - self.eeprom_path, - (sff8472_parser[eeprom_key][PAGE_OFFSET] + - sff8472_parser[eeprom_key][KEY_OFFSET]), - sff8472_parser[eeprom_key][KEY_WIDTH]) - if (eeprom_data_raw is not None): - # Offset 0 is used to retrieve sff8472InterfaceId Info - # Offset 256 is used to retrieve sff8472Dom Info - if (page_offset == 0): - if ( self.sfpInfo is None): - return None - eeprom_data = getattr( - self.sfpInfo, sff8472_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - if ( self.sfpDomInfo is None): - return None - eeprom_data = getattr( - self.sfpDomInfo, sff8472_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - - return eeprom_data - - def get_transceiver_info(self): + def _initialize_media(self,delay=False): """ - Retrieves transceiver info of this SFP + Initialize the media type and eeprom driver for SFP """ - transceiver_info_dict = {} - compliance_code_dict = {} - transceiver_info_dict = dict.fromkeys(info_dict_keys, 'N/A') - # BaseInformation - iface_data = self._get_eeprom_data('type') - if (iface_data is not None): - connector = iface_data['data']['Connector']['value'] - encoding = iface_data['data']['EncodingCodes']['value'] - ext_id = iface_data['data']['Extended Identifier']['value'] - rate_identifier = iface_data['data']['RateIdentifier']['value'] - identifier = iface_data['data']['type']['value'] - type_abbrv_name=iface_data['data']['type_abbrv_name']['value'] - if(self.sfp_type == 'QSFP'): - bit_rate = str( - iface_data['data']['Nominal Bit Rate(100Mbs)']['value']) - for key in qsfp_compliance_code_tup: - if key in iface_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = iface_data['data']['Specification compliance']['value'][key]['value'] - for key in qsfp_cable_length_tup: - if key in iface_data['data']: - cable_type = key - cable_length = str(iface_data['data'][key]['value']) - else: - bit_rate = str( - iface_data['data']['NominalSignallingRate(UnitsOf100Mbd)']['value']) - for key in sfp_compliance_code_tup: - if key in iface_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = iface_data['data']['Specification compliance']['value'][key]['value'] - for key in sfp_cable_length_tup: - if key in iface_data['data']: - cable_type = key - cable_length = str(iface_data['data'][key]['value']) - else: - return transceiver_info_dict - - # Vendor Date - vendor_date_data = self._get_eeprom_data('vendor_date') - if (vendor_date_data is not None): - vendor_date = vendor_date_data['data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] - else: - return transceiver_info_dict - - # Vendor Name - vendor_name_data = self._get_eeprom_data('manufacturer') - if (vendor_name_data is not None): - vendor_name = vendor_name_data['data']['Vendor Name']['value'] - else: - return transceiver_info_dict - - # Vendor OUI - vendor_oui_data = self._get_eeprom_data('vendor_oui') - if (vendor_oui_data is not None): - vendor_oui = vendor_oui_data['data']['Vendor OUI']['value'] - else: - return transceiver_info_dict - - # Vendor PN - vendor_pn_data = self._get_eeprom_data('model') - if (vendor_pn_data is not None): - vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] - else: - return transceiver_info_dict - - # Vendor Revision - vendor_rev_data = self._get_eeprom_data('hardware_rev') - if (vendor_rev_data is not None): - vendor_rev = vendor_rev_data['data']['Vendor Rev']['value'] - else: - return transceiver_info_dict - - # Vendor Serial Number - vendor_sn_data = self._get_eeprom_data('serial') - if (vendor_sn_data is not None): - vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] - else: - return transceiver_info_dict - - # Fill The Dictionary and return - transceiver_info_dict['type'] = identifier - transceiver_info_dict['hardware_rev'] = vendor_rev - transceiver_info_dict['serial'] = vendor_sn - transceiver_info_dict['manufacturer'] = vendor_name - transceiver_info_dict['model'] = vendor_pn - transceiver_info_dict['connector'] = connector - transceiver_info_dict['encoding'] = encoding - transceiver_info_dict['ext_identifier'] = ext_id - transceiver_info_dict['ext_rateselect_compliance'] = rate_identifier - transceiver_info_dict['cable_type'] = cable_type - transceiver_info_dict['cable_length'] = cable_length - transceiver_info_dict['nominal_bit_rate'] = bit_rate - transceiver_info_dict['specification_compliance'] = str(compliance_code_dict) - transceiver_info_dict['vendor_date'] = vendor_date - transceiver_info_dict['vendor_oui'] = vendor_oui - transceiver_info_dict['type_abbrv_name']=type_abbrv_name - - return transceiver_info_dict - - def get_transceiver_threshold_info(self): - """ - Retrieves transceiver threshold info of this SFP - """ - transceiver_dom_threshold_dict = {} - transceiver_dom_threshold_dict = dict.fromkeys( - threshold_dict_keys, 'N/A') - - # Module Threshold - module_threshold_data = self._get_eeprom_data('ModuleThreshold') - if (self.sfp_type == 'QSFP'): - # Channel Threshold - channel_threshold_data = self._get_eeprom_data('ChannelThreshold') - - if (channel_threshold_data is not None and module_threshold_data is not None): - transceiver_dom_threshold_dict['temphighalarm'] = module_threshold_data['data']['TempHighAlarm']['value'] - transceiver_dom_threshold_dict['temphighwarning'] = module_threshold_data['data']['TempHighWarning']['value'] - transceiver_dom_threshold_dict['templowalarm'] = module_threshold_data['data']['TempLowAlarm']['value'] - transceiver_dom_threshold_dict['templowwarning'] = module_threshold_data['data']['TempLowWarning']['value'] - transceiver_dom_threshold_dict['vcchighalarm'] = module_threshold_data['data']['VccHighAlarm']['value'] - transceiver_dom_threshold_dict['vcchighwarning'] = module_threshold_data['data']['VccHighWarning']['value'] - transceiver_dom_threshold_dict['vcclowalarm'] = module_threshold_data['data']['VccLowAlarm']['value'] - transceiver_dom_threshold_dict['vcclowwarning'] = module_threshold_data['data']['VccLowWarning']['value'] - transceiver_dom_threshold_dict['rxpowerhighalarm'] = channel_threshold_data['data']['RxPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerhighwarning'] = channel_threshold_data['data']['RxPowerHighWarning']['value'] - transceiver_dom_threshold_dict['rxpowerlowalarm'] = channel_threshold_data['data']['RxPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerlowwarning'] = channel_threshold_data['data']['RxPowerLowWarning']['value'] - transceiver_dom_threshold_dict['txbiashighalarm'] = channel_threshold_data['data']['TxBiasHighAlarm']['value'] - transceiver_dom_threshold_dict['txbiashighwarning'] = channel_threshold_data['data']['TxBiasHighWarning']['value'] - transceiver_dom_threshold_dict['txbiaslowalarm'] = channel_threshold_data['data']['TxBiasLowAlarm']['value'] - transceiver_dom_threshold_dict['txbiaslowwarning'] = channel_threshold_data['data']['TxBiasLowWarning']['value'] - - else: - return transceiver_dom_threshold_dict - else: - #SFP - if (module_threshold_data is not None): - #Threshold Data - transceiver_dom_threshold_dict['temphighalarm'] = module_threshold_data['data']['TempHighAlarm']['value'] - transceiver_dom_threshold_dict['templowalarm'] = module_threshold_data['data']['TempLowAlarm']['value'] - transceiver_dom_threshold_dict['temphighwarning'] = module_threshold_data['data']['TempHighWarning']['value'] - transceiver_dom_threshold_dict['templowwarning'] = module_threshold_data['data']['TempLowWarning']['value'] - transceiver_dom_threshold_dict['vcchighalarm'] = module_threshold_data['data']['VoltageHighAlarm']['value'] - transceiver_dom_threshold_dict['vcclowalarm'] = module_threshold_data['data']['VoltageLowAlarm']['value'] - transceiver_dom_threshold_dict['vcchighwarning'] = module_threshold_data['data']['VoltageHighWarning']['value'] - transceiver_dom_threshold_dict['vcclowwarning'] = module_threshold_data['data']['VoltageLowWarning']['value'] - transceiver_dom_threshold_dict['txbiashighalarm'] = module_threshold_data['data']['BiasHighAlarm']['value'] - transceiver_dom_threshold_dict['txbiaslowalarm'] = module_threshold_data['data']['BiasLowAlarm']['value'] - transceiver_dom_threshold_dict['txbiashighwarning'] = module_threshold_data['data']['BiasHighWarning']['value'] - transceiver_dom_threshold_dict['txbiaslowwarning'] = module_threshold_data['data']['BiasLowWarning']['value'] - transceiver_dom_threshold_dict['txpowerhighalarm'] = module_threshold_data['data']['TXPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['txpowerlowalarm'] = module_threshold_data['data']['TXPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['txpowerhighwarning'] = module_threshold_data['data']['TXPowerHighWarning']['value'] - transceiver_dom_threshold_dict['txpowerlowwarning'] = module_threshold_data['data']['TXPowerLowWarning']['value'] - transceiver_dom_threshold_dict['rxpowerhighalarm'] = module_threshold_data['data']['RXPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerlowalarm'] = module_threshold_data['data']['RXPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerhighwarning'] = module_threshold_data['data']['RXPowerHighWarning']['value'] - transceiver_dom_threshold_dict['rxpowerlowwarning'] = module_threshold_data['data']['RXPowerLowWarning']['value'] - else: - return transceiver_dom_threshold_dict - - return transceiver_dom_threshold_dict - - def get_transceiver_bulk_status(self): - """ - Retrieves transceiver bulk status of this SFP - """ - tx_bias_list = [] - rx_power_list = [] - transceiver_dom_dict = {} - transceiver_dom_dict = dict.fromkeys(dom_dict_keys, 'N/A') - - # RxLos - rx_los = self.get_rx_los() - - # TxFault - tx_fault = self.get_tx_fault() - - # ResetStatus - reset_state = self.get_reset_status() - - # LowPower Mode - lp_mode = self.get_lpmode() - - # TxDisable - tx_disable = self.get_tx_disable() - - # TxDisable Channel - tx_disable_channel = self.get_tx_disable_channel() - - # Temperature - temperature = self.get_temperature() - - # Voltage - voltage = self.get_voltage() - - # Channel Monitor - tx_power_list = self.get_tx_power() - - # tx bias - tx_bias_list = self.get_tx_bias() - - # rx power - rx_power_list = self.get_rx_power() - - if (len(tx_bias_list) != 0): - transceiver_dom_dict['tx1bias'] = tx_bias_list[0] - transceiver_dom_dict['tx2bias'] = tx_bias_list[1] - transceiver_dom_dict['tx3bias'] = tx_bias_list[2] - transceiver_dom_dict['tx4bias'] = tx_bias_list[3] - - if (len(rx_power_list) != 0): - transceiver_dom_dict['rx1power'] = rx_power_list[0] - transceiver_dom_dict['rx2power'] = rx_power_list[1] - transceiver_dom_dict['rx3power'] = rx_power_list[2] - transceiver_dom_dict['rx4power'] = rx_power_list[3] - - if (len(tx_power_list) != 0): - transceiver_dom_dict['tx1power'] = tx_power_list[0] - transceiver_dom_dict['tx2power'] = tx_power_list[1] - transceiver_dom_dict['tx3power'] = tx_power_list[2] - transceiver_dom_dict['tx4power'] = tx_power_list[3] - - transceiver_dom_dict['rx_los'] = rx_los - transceiver_dom_dict['tx_fault'] = tx_fault - transceiver_dom_dict['reset_status'] = reset_state - transceiver_dom_dict['power_lpmode'] = lp_mode - transceiver_dom_dict['tx_disable'] = tx_disable - transceiver_dom_dict['tx_disable_channel'] = tx_disable_channel - transceiver_dom_dict['temperature'] = temperature - transceiver_dom_dict['voltage'] = voltage - - return transceiver_dom_dict - - def get_name(self): - """ - Retrieves the name of the sfp - Returns : QSFP or QSFP+ or QSFP28 - """ - - iface_data = self._get_eeprom_data('type') - if (iface_data is not None): - identifier = iface_data['data']['type']['value'] - else: - return None + if delay: + time.sleep(1) + self._xcvr_api = None + self.get_xcvr_api() - return identifier + self.set_media_type() + self.reinit_sfp_driver() def get_presence(self): """ @@ -534,60 +96,27 @@ def get_presence(self): Returns : True if sfp is present and false if it is absent """ # Check for invalid port_num - + mask = {'QSFP' : (1 << 4), 'SFP' : (1 << 0)} # Port offset starts with 0x4004 port_offset = 16388 + ((self.index-1) * 16) - status = self.pci_get_value(self.BASE_RES_PATH, port_offset) - reg_value = int(status) - - # Absence of status throws error - if (reg_value == ""): - return False - - # Mask off 4th bit for presence - if(self.sfp_type == 'QSFP'): - mask = (1 << 4) - - # Mask off 1st bit for presence 65,66 - if (self.sfp_type == 'SFP'): - mask = (1 << 0) - # ModPrsL is active low - if reg_value & mask == 0: - return True + try: + status = self.pci_get_value(self.BASE_RES_PATH, port_offset) + reg_value = int(status) + # ModPrsL is active low + if reg_value & mask[self.port_type] == 0: + return True + except ValueError: + pass return False - def get_model(self): - """ - Retrieves the model number (or part number) of the sfp - """ - vendor_pn_data = self._get_eeprom_data('model') - if (vendor_pn_data is not None): - vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] - else: - return None - - return vendor_pn - - def get_serial(self): - """ - Retrieves the serial number of the sfp - """ - vendor_sn_data = self._get_eeprom_data('serial') - if (vendor_sn_data is not None): - vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] - else: - return None - - return vendor_sn - def get_reset_status(self): """ Retrives the reset status of SFP """ reset_status = False - if (self.sfp_type == 'QSFP'): + if (self.port_type == 'QSFP'): # Port offset starts with 0x4000 port_offset = 16384 + ((self.index-1) * 16) @@ -608,187 +137,12 @@ def get_reset_status(self): return reset_status - def get_rx_los(self): - """ - Retrieves the RX LOS (lost-of-signal) status of SFP - """ - rx_los = None - rx_los_list = [] - if (self.sfp_type == 'QSFP'): - rx_los_data = self._get_eeprom_data('rx_los') - if (rx_los_data is not None): - rx_los = rx_los_data['data']['Rx1LOS']['value'] - if (rx_los is 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - rx_los = rx_los_data['data']['Rx2LOS']['value'] - if (rx_los is 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - rx_los = rx_los_data['data']['Rx3LOS']['value'] - if (rx_los is 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - rx_los = rx_los_data['data']['Rx4LOS']['value'] - if (rx_los is 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - - if (rx_los_list[0] and rx_los_list[1] - and rx_los_list[2] and rx_los_list[3]): - rx_los = True - else: - rx_los = False - else: - rx_los_data = self._read_eeprom_bytes(self.eeprom_path, SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - if (rx_los_data is not None): - data = int(rx_los_data[0], 16) - rx_los = (sffbase().test_bit(data, 1) != 0) - - return rx_los - - def get_tx_fault(self): - """ - Retrieves the TX fault status of SFP - """ - tx_fault = None - tx_fault_list = [] - if (self.sfp_type == 'QSFP'): - tx_fault_data = self._get_eeprom_data('tx_fault') - if (tx_fault_data is not None): - tx_fault = tx_fault_data['data']['Tx1Fault']['value'] - if (tx_fault is 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - tx_fault = tx_fault_data['data']['Tx2Fault']['value'] - if (tx_fault is 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - tx_fault = tx_fault_data['data']['Tx3Fault']['value'] - if (tx_fault is 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - tx_fault = tx_fault_data['data']['Tx4Fault']['value'] - if (tx_fault is 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - - if (tx_fault_list[0] and tx_fault_list[1] - and tx_fault_list[2] and tx_fault_list[3]): - tx_fault = True - else: - tx_fault = False - - else: - tx_fault_data = self._read_eeprom_bytes(self.eeprom_path, SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - if (tx_fault_data is not None): - data = int(tx_fault_data[0], 16) - tx_fault = (sffbase().test_bit(data, 2) != 0) - - return tx_fault - - def get_tx_disable(self): - """ - Retrieves the tx_disable status of this SFP - """ - tx_disable = None - tx_disable_list = [] - if (self.sfp_type == 'QSFP'): - tx_disable_data = self._get_eeprom_data('tx_disable') - if (tx_disable_data is not None): - tx_disable = tx_disable_data['data']['Tx1Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - tx_disable = tx_disable_data['data']['Tx2Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - tx_disable = tx_disable_data['data']['Tx3Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - tx_disable = tx_disable_data['data']['Tx4Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - - if (tx_disable_list[0] and tx_disable_list[1] - and tx_disable_list[2] and tx_disable_list[3]): - tx_disable = True - else: - tx_disable = False - - else: - tx_disable_data = self._read_eeprom_bytes(self.eeprom_path, SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - if (tx_disable_data is not None): - data = int(tx_disable_data[0], 16) - tx_disable_hard = (sffbase().test_bit(data, SFP_TX_DISABLE_HARD_BIT) != 0) - tx_disable_soft = (sffbase().test_bit(data, SFP_TX_DISABLE_SOFT_BIT) != 0) - tx_disable = tx_disable_hard | tx_disable_soft - - - return tx_disable - - def get_tx_disable_channel(self): - """ - Retrieves the TX disabled channels in this SFP - """ - tx_disable = None - tx_disable_list = [] - tx_disable_channel = 0 - - if (self.sfp_type == 'QSFP'): - tx_disable_data = self._get_eeprom_data('tx_disable') - if (tx_disable_data is not None): - tx_disable = tx_disable_data['data']['Tx1Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(1) - else: - tx_disable_list.append(0) - tx_disable = tx_disable_data['data']['Tx2Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(1) - else: - tx_disable_list.append(0) - tx_disable = tx_disable_data['data']['Tx3Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(1) - else: - tx_disable_list.append(0) - tx_disable = tx_disable_data['data']['Tx4Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(1) - else: - tx_disable_list.append(0) - - bit4 = int(tx_disable_list[3]) * 8 - bit3 = int(tx_disable_list[2]) * 4 - bit2 = int(tx_disable_list[1]) * 2 - bit1 = int(tx_disable_list[0]) * 1 - - tx_disable_channel = hex(bit4 + bit3 + bit2 + bit1) - - return tx_disable_channel - def get_lpmode(self): """ Retrieves the lpmode(low power mode) of this SFP """ lpmode_state = False - if (self.sfp_type == 'QSFP'): + if (self.port_type == 'QSFP'): # Port offset starts with 0x4000 port_offset = 16384 + ((self.index-1) * 16) @@ -811,149 +165,11 @@ def get_lpmode(self): return lpmode_state - def get_power_override(self): - """ - Retrieves the power-override status of this SFP - """ - power_override_state = False - - if (self.sfp_type == 'QSFP'): - power_override_data = self._get_eeprom_data('power_override') - if (power_override_data is not None): - power_override = power_override_data['data']['PowerOverRide']['value'] - if (power_override is 'On'): - power_override_state = True - else: - power_override_state = False - - return power_override_state - - def get_temperature(self): - """ - Retrieves the temperature of this SFP - """ - temperature = None - - temperature_data = self._get_eeprom_data('Temperature') - if (temperature_data is not None): - temperature = temperature_data['data']['Temperature']['value'] - - return temperature - - def get_voltage(self): - """ - Retrieves the supply voltage of this SFP - """ - voltage = None - - voltage_data = self._get_eeprom_data('Voltage') - if (voltage_data is not None): - voltage = voltage_data['data']['Vcc']['value'] - - return voltage - - def get_tx_bias(self): - """ - Retrieves the TX bias current of this SFP - """ - tx_bias = None - tx_bias_list = [] - - tx_bias_data = self._get_eeprom_data('ChannelMonitor') - if (tx_bias_data is not None): - if (self.sfp_type == 'QSFP'): - tx_bias = tx_bias_data['data']['TX1Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = tx_bias_data['data']['TX2Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = tx_bias_data['data']['TX3Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = tx_bias_data['data']['TX4Bias']['value'] - tx_bias_list.append(tx_bias) - else: - tx1_bias = tx_bias_data['data']['TXBias']['value'] - return [tx1_bias, "N/A", "N/A", "N/A"] - - return tx_bias_list - - def get_rx_power(self): - """ - Retrieves the received optical power for this SFP - """ - rx_power = None - rx_power_list = [] - - rx_power_data = self._get_eeprom_data('ChannelMonitor') - if (rx_power_data is not None): - if (self.sfp_type == 'QSFP'): - rx_power = rx_power_data['data']['RX1Power']['value'] - rx_power_list.append(rx_power) - rx_power = rx_power_data['data']['RX2Power']['value'] - rx_power_list.append(rx_power) - rx_power = rx_power_data['data']['RX3Power']['value'] - rx_power_list.append(rx_power) - rx_power = rx_power_data['data']['RX4Power']['value'] - rx_power_list.append(rx_power) - else: - rx1_pw = rx_power_data['data']['RXPower']['value'] - return [rx1_pw, "N/A", "N/A", "N/A"] - - return rx_power_list - - def get_tx_power(self): - """ - Retrieves the TX power of this SFP - """ - tx_power_list = [] - if(self.sfp_type == 'QSFP'): - # QSFP capability byte parse, through this byte can know whether it support tx_power or not. - # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, - # need to add more code for determining the capability and version compliance - # in SFF-8636 dom capability definitions evolving with the versions. - qspf_dom_capability_data = self._get_eeprom_data('dom_capability') - qsfp_dom_rev_data = self._get_eeprom_data('dom_rev') - if (qspf_dom_capability_data is not None and qsfp_dom_rev_data is not None): - qsfp_dom_rev = qsfp_dom_rev_data['data']['dom_rev']['value'] - qsfp_tx_power_support = qspf_dom_capability_data['data']['Tx_power_support']['value'] - else: - return tx_power_list - - # The tx_power monitoring is only available on QSFP which compliant with SFF-8636 - # and claimed that it support tx_power with one indicator bit. - if (qsfp_dom_rev[0:8] != 'SFF-8636' or (qsfp_dom_rev[0:8] == 'SFF-8636' and qsfp_tx_power_support != 'on')): - return tx_power_list - else: - channel_monitor_data = self._get_eeprom_data('ChannelMonitor_TxPower') - if (channel_monitor_data is not None): - tx1_pw = channel_monitor_data['data']['TX1Power']['value'] - tx2_pw = channel_monitor_data['data']['TX2Power']['value'] - tx3_pw = channel_monitor_data['data']['TX3Power']['value'] - tx4_pw = channel_monitor_data['data']['TX4Power']['value'] - else: - return tx_power_list - - else: - channel_monitor_data = self._get_eeprom_data('ChannelMonitor') - if (channel_monitor_data is not None): - tx1_pw = channel_monitor_data['data']['TXPower']['value'] - tx2_pw = 'N/A' - tx3_pw = 'N/A' - tx4_pw = 'N/A' - else: - return tx_power_list - - tx_power_list.append(tx1_pw) - tx_power_list.append(tx2_pw) - tx_power_list.append(tx3_pw) - tx_power_list.append(tx4_pw) - - return tx_power_list - def reset(self): """ Reset the SFP and returns all user settings to their default state """ - if (self.sfp_type == 'QSFP'): + if (self.port_type == 'QSFP'): # Port offset starts with 0x4000 port_offset = 16384 + ((self.index-1) * 16) @@ -990,7 +206,7 @@ def set_lpmode(self, lpmode): """ Sets the lpmode(low power mode) of this SFP """ - if (self.sfp_type == 'QSFP'): + if (self.port_type == 'QSFP'): # Port offset starts with 0x4000 port_offset = 16384 + ((self.index-1) * 16) @@ -1018,24 +234,6 @@ def set_lpmode(self, lpmode): else: return False - def tx_disable(self, tx_disable): - """ - Disable SFP TX for all channels - """ - return False - - def tx_disable_channel(self, channel, disable): - """ - Sets the tx_disable for specified SFP channels - """ - return False - - def set_power_override(self, power_override, power_set): - """ - Sets SFP power level using power_override and power_set - """ - return False - def get_status(self): """ Retrieves the operational status of the device @@ -1048,3 +246,68 @@ def get_status(self): status = True return status + + def set_media_type(self): + """ + Reads optic eeprom byte to determine media type inserted + """ + eeprom_raw = [] + eeprom_raw = self._xcvr_api_factory._get_id() + if eeprom_raw is not None: + eeprom_raw = hex(eeprom_raw) + if eeprom_raw in SFP_TYPE_LIST: + self.sfp_type = 'SFP' + elif eeprom_raw in QSFP_TYPE_LIST: + self.sfp_type = 'QSFP' + elif eeprom_raw in QSFP_DD_TYPE_LIST: + self.sfp_type = 'QSFP_DD' + else: + #Set native port type if EEPROM type is not recognized/readable + self.sfp_type = self.port_type + else: + self.sfp_type = self.port_type + + return self.sfp_type + + def reinit_sfp_driver(self): + """ + Changes the driver based on media type detected + """ + del_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/delete_device".format(self.index+1) + new_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/new_device".format(self.index+1) + driver_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/name".format(self.index+1) + delete_device = "echo 0x50 >" + del_sfp_path + + if not os.path.isfile(driver_path): + print(driver_path, "does not exist") + return False + + try: + with os.fdopen(os.open(driver_path, os.O_RDONLY)) as fd: + driver_name = fd.read() + driver_name = driver_name.rstrip('\r\n') + driver_name = driver_name.lstrip(" ") + + #Avoid re-initialization of the QSFP/SFP optic on QSFP/SFP port. + if self.sfp_type == 'SFP' and driver_name in ['optoe1', 'optoe3']: + subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + time.sleep(0.2) + new_device = "echo optoe2 0x50 >" + new_sfp_path + subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + time.sleep(2) + elif self.sfp_type == 'QSFP' and driver_name in ['optoe2', 'optoe3']: + subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + time.sleep(0.2) + new_device = "echo optoe1 0x50 >" + new_sfp_path + subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + time.sleep(2) + elif self.sfp_type == 'QSFP_DD' and driver_name in ['optoe1', 'optoe2']: + subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + time.sleep(0.2) + new_device = "echo optoe3 0x50 >" + new_sfp_path + subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + time.sleep(2) + + except IOError as e: + print("Error: Unable to open file: %s" % str(e)) + return False diff --git a/platform/broadcom/sonic-platform-modules-dell/s5248f/modules/dell_s5248f_fpga_ocores.c b/platform/broadcom/sonic-platform-modules-dell/s5248f/modules/dell_s5248f_fpga_ocores.c index b9a50c69b225..0673d6e9d0ac 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5248f/modules/dell_s5248f_fpga_ocores.c +++ b/platform/broadcom/sonic-platform-modules-dell/s5248f/modules/dell_s5248f_fpga_ocores.c @@ -1046,7 +1046,7 @@ static int map_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev) /* map the device memory or IO region into kernel virtual * address space */ - fpgapci->bar[i] = ioremap_nocache (bar_start + FPGALOGIC_I2C_BASE, I2C_PCI_MAX_BUS * FPGALOGIC_CH_OFFSET); + fpgapci->bar[i] = ioremap (bar_start + FPGALOGIC_I2C_BASE, I2C_PCI_MAX_BUS * FPGALOGIC_CH_OFFSET); if (!fpgapci->bar[i]) { PRINT ( "Could not map BAR #%d.\n", i); @@ -1060,7 +1060,7 @@ static int map_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev) { fpga_phys_addr = bar_start; - fpga_ctl_addr = ioremap_nocache (bar_start, FPGA_CTL_REG_SIZE); + fpga_ctl_addr = ioremap (bar_start, FPGA_CTL_REG_SIZE); fpga_base_addr = fpgapci->bar[i]; } diff --git a/platform/broadcom/sonic-platform-modules-dell/s5248f/scripts/s5248f_platform.sh b/platform/broadcom/sonic-platform-modules-dell/s5248f/scripts/s5248f_platform.sh index 692a6a602b0f..84f236366702 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s5248f/scripts/s5248f_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/s5248f/scripts/s5248f_platform.sh @@ -149,7 +149,7 @@ init_devnum if [ "$1" == "init" ]; then modprobe i2c-dev - modprobe i2c-mux-pca954x force_deselect_on_exit=1 + modprobe i2c-mux-pca954x modprobe ipmi_devintf modprobe ipmi_si modprobe i2c_ocores @@ -162,15 +162,28 @@ if [ "$1" == "init" ]; then #/usr/bin/qsfp_irq_enable.py install_python_api_package platform_firmware_versions + echo -2 > /sys/bus/i2c/drivers/pca954x/603-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/604-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/605-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/606-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/607-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/608-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/609-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/610-0074/idle_state elif [ "$1" == "deinit" ]; then sys_eeprom "delete_device" switch_board_qsfp "delete_device" switch_board_qsfp_mux "delete_device" - remove_python_api_package + modprobe -r dell_s5248f_fpga_ocores + modprobe -r i2c_ocores + modprobe -r acpi_ipmi + modprobe -r ipmi_si + modprobe -r ipmi_devintf modprobe -r i2c-mux-pca954x modprobe -r i2c-dev + remove_python_api_package else echo "s5248f_platform : Invalid option !" fi diff --git a/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/chassis.py index 089ef3e0e39d..b047ec0c96f6 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/chassis.py @@ -181,6 +181,7 @@ def get_change_event(self, timeout=0): if(presence and self._global_port_pres_dict[port_num] == '0'): self._global_port_pres_dict[port_num] = '1' port_dict[port_num] = '1' + self.get_sfp(port_num-1)._initialize_media(delay=True) elif(not presence and self._global_port_pres_dict[port_num] == '1'): self._global_port_pres_dict[port_num] = '0' diff --git a/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/ipmihelper.py b/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/ipmihelper.py deleted file mode 100644 index d95329c40de2..000000000000 --- a/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/ipmihelper.py +++ /dev/null @@ -1,269 +0,0 @@ -#!/usr/bin/python3 - -######################################################################## -# DellEMC -# -# Module contains implementation of IpmiSensor and IpmiFru classes that -# provide Sensor's and FRU's information respectively. -# -######################################################################## - -import subprocess -import re - -# IPMI Request Network Function Codes -NetFn_SensorEvent = 0x04 -NetFn_Storage = 0x0A - -# IPMI Sensor Device Commands -Cmd_GetSensorReadingFactors = 0x23 -Cmd_GetSensorThreshold = 0x27 -Cmd_GetSensorReading = 0x2D - -# IPMI FRU Device Commands -Cmd_ReadFRUData = 0x11 - -def get_ipmitool_raw_output(args): - """ - Returns a list the elements of which are the individual bytes of - ipmitool raw command output. - """ - result_bytes = list() - result = "" - command = "ipmitool raw {}".format(args) - try: - proc = subprocess.Popen(command.split(), stdout=subprocess.PIPE, - universal_newlines=True, stderr=subprocess.STDOUT) - stdout = proc.communicate()[0] - proc.wait() - if not proc.returncode: - result = stdout.rstrip('\n') - except EnvironmentError: - pass - - for i in result.split(): - result_bytes.append(int(i, 16)) - - return result_bytes - -class IpmiSensor(object): - - # Sensor Threshold types and their respective bit masks - THRESHOLD_BIT_MASK = { - "LowerNonCritical" : 0, - "LowerCritical" : 1, - "LowerNonRecoverable" : 2, - "UpperNonCritical" : 3, - "UpperCritical" : 4, - "UpperNonRecoverable" : 5 - } - - def __init__(self, sensor_id, is_discrete=False): - self.id = sensor_id - self.is_discrete = is_discrete - - def _get_converted_sensor_reading(self, raw_value): - """ - Returns a 2 element tuple(bool, int) in which first element - provides the validity of the reading and the second element is - the converted sensor reading - """ - # Get Sensor Reading Factors - cmd_args = "{} {} {} {}".format(NetFn_SensorEvent, - Cmd_GetSensorReadingFactors, - self.id, raw_value) - factors = get_ipmitool_raw_output(cmd_args) - - if len(factors) != 7: - return False, 0 - - # Compute Twos complement - def get_twos_complement(val, bits): - if val & (1 << (bits - 1)): - val = val - (1 << bits) - return val - - # Calculate actual sensor value from the raw sensor value - # using the sensor reading factors. - M = get_twos_complement(((factors[2] & 0xC0) << 8) | factors[1], 10) - B = get_twos_complement(((factors[4] & 0xC0) << 8) | factors[3], 10) - R_exp = get_twos_complement((factors[6] & 0xF0) >> 4, 4) - B_exp = get_twos_complement(factors[6] & 0x0F, 4) - - converted_reading = ((M * raw_value) + (B * 10**B_exp)) * 10**R_exp - - return True, converted_reading - - def get_reading(self): - """ - For Threshold sensors, returns the sensor reading. - For Discrete sensors, returns the state value. - - Returns: - A tuple (bool, int) where the first element provides the - validity of the reading and the second element provides the - sensor reading/state value. - """ - # Get Sensor Reading - cmd_args = "{} {} {}".format(NetFn_SensorEvent, Cmd_GetSensorReading, - self.id) - output = get_ipmitool_raw_output(cmd_args) - if len(output) != 4: - return False, 0 - - # Check reading/state unavailable - if output[1] & 0x20: - return False, 0 - - if self.is_discrete: - state = ((output[3] & 0x7F) << 8) | output[2] - return True, state - else: - return self._get_converted_sensor_reading(output[0]) - - def get_threshold(self, threshold_type): - """ - Returns the sensor's threshold value for a given threshold type. - - Args: - threshold_type (str) - one of the below mentioned - threshold type strings - - "LowerNonCritical" - "LowerCritical" - "LowerNonRecoverable" - "UpperNonCritical" - "UpperCritical" - "UpperNonRecoverable" - Returns: - A tuple (bool, int) where the first element provides the - validity of that threshold and second element provides the - threshold value. - """ - # Thresholds are not valid for discrete sensors - if self.is_discrete: - raise TypeError("Threshold is not applicable for Discrete Sensor") - - if threshold_type not in list(self.THRESHOLD_BIT_MASK.keys()): - raise ValueError("Invalid threshold type {} provided. Valid types " - "are {}".format(threshold_type, - list(self.THRESHOLD_BIT_MASK.keys()))) - - bit_mask = self.THRESHOLD_BIT_MASK[threshold_type] - - # Get Sensor Threshold - cmd_args = "{} {} {}".format(NetFn_SensorEvent, Cmd_GetSensorThreshold, - self.id) - thresholds = get_ipmitool_raw_output(cmd_args) - if len(thresholds) != 7: - return False, 0 - - valid_thresholds = thresholds.pop(0) - # Check whether particular threshold is readable - if valid_thresholds & (1 << bit_mask): - return self._get_converted_sensor_reading(thresholds[bit_mask]) - else: - return False, 0 - -class IpmiFru(object): - - def __init__(self, fru_id): - self.id = fru_id - - def _get_ipmitool_fru_print(self): - result = "" - command = "ipmitool fru print {}".format(self.id) - try: - proc = subprocess.Popen(command.split(), stdout=subprocess.PIPE, - universal_newlines=True, stderr=subprocess.STDOUT) - stdout = proc.communicate()[0] - proc.wait() - if not proc.returncode: - result = stdout.rstrip('\n') - except EnvironmentError: - pass - - return result - - def _get_from_fru(self, info): - """ - Returns a string containing the info from FRU - """ - fru_output = self._get_ipmitool_fru_print() - if not fru_output: - return "NA" - - info_req = re.search(r"%s\s*:(.*)" % info, fru_output) - if not info_req: - return "NA" - - return info_req.group(1).strip() - - def get_board_serial(self): - """ - Returns a string containing the Serial Number of the device. - """ - return self._get_from_fru('Board Serial') - - def get_board_part_number(self): - """ - Returns a string containing the Part Number of the device. - """ - return self._get_from_fru('Board Part Number') - - def get_board_mfr_id(self): - """ - Returns a string containing the manufacturer id of the FRU. - """ - return self._get_from_fru('Board Mfg') - - def get_board_product(self): - """ - Returns a string containing the manufacturer id of the FRU. - """ - return self._get_from_fru('Board Product') - - def get_fru_data(self, offset, count=1): - """ - Reads and returns the FRU data at the provided offset. - - Args: - offset (int) - FRU offset to read - count (int) - Number of bytes to read [optional, default = 1] - Returns: - A tuple (bool, list(int)) where the first element provides - the validity of the data read and the second element is a - list, the elements of which are the individual bytes of the - FRU data read. - """ - result_bytes = list() - is_valid = True - result = "" - - offset_LSB = offset & 0xFF - offset_MSB = offset & 0xFF00 - command = "ipmitool raw {} {} {} {} {} {}".format(NetFn_Storage, - Cmd_ReadFRUData, - self.id, offset_LSB, - offset_MSB, count) - try: - proc = subprocess.Popen(command.split(), stdout=subprocess.PIPE, - universal_newlines=True, stderr=subprocess.STDOUT) - stdout = proc.communicate()[0] - proc.wait() - if not proc.returncode: - result = stdout.rstrip('\n') - except EnvironmentError: - is_valid = False - - if (not result) or (not is_valid): - return False, result_bytes - - for i in result.split(): - result_bytes.append(int(i, 16)) - - read_count = result_bytes.pop(0) - if read_count != count: - return False, result_bytes - else: - return True, result_bytes diff --git a/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/sfp.py index eed6dc7b03da..bc7f2bce9094 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/sfp.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# -# DELLEMC +# DELLEMC S5248F # # Module contains an implementation of SONiC Platform Base API and # provides the platform information @@ -13,159 +13,41 @@ import time import struct import mmap - from sonic_platform_base.sfp_base import SfpBase - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom - from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId - from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom - from sonic_platform_base.sonic_sfp.sff8472 import sffbase + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase except ImportError as e: raise ImportError(str(e) + "- required module not found") -PAGE_OFFSET = 0 -KEY_OFFSET = 1 -KEY_WIDTH = 2 -FUNC_NAME = 3 - -QSFP_INFO_OFFSET = 128 -QSFP_DOM_OFFSET = 0 -QSFP_DOM_OFFSET1 = 384 - -SFP_INFO_OFFSET = 0 -SFP_DOM_OFFSET = 256 - -SFP_STATUS_CONTROL_OFFSET = 110 -SFP_STATUS_CONTROL_WIDTH = 7 -SFP_TX_DISABLE_HARD_BIT = 7 -SFP_TX_DISABLE_SOFT_BIT = 6 - -qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)', 'Length OM2(m)', - 'Length OM1(m)', 'Length Cable Assembly(m)') - -qsfp_compliance_code_tup = ( - '10/40G Ethernet Compliance Code', - 'SONET Compliance codes', - 'SAS/SATA compliance codes', - 'Gigabit Ethernet Compliant codes', - 'Fibre Channel link length/Transmitter Technology', - 'Fibre Channel transmission media', - 'Fibre Channel Speed') - -sfp_cable_length_tup = ('LengthSMFkm-UnitsOfKm', 'LengthSMF(UnitsOf100m)', - 'Length50um(UnitsOf10m)', 'Length62.5um(UnitsOfm)', - 'LengthOM3(UnitsOf10m)', 'LengthCable(UnitsOfm)') - -sfp_compliance_code_tup = ('10GEthernetComplianceCode', 'InfinibandComplianceCode', - 'ESCONComplianceCodes', 'SONETComplianceCodes', - 'EthernetComplianceCodes', 'FibreChannelLinkLength', - 'FibreChannelTechnology', 'SFP+CableTechnology', - 'FibreChannelTransmissionMedia', 'FibreChannelSpeed') - -info_dict_keys = ['type', 'hardware_rev', 'serial', - 'manufacturer', 'model', 'connector', - 'encoding', 'ext_identifier', 'ext_rateselect_compliance', - 'cable_type', 'cable_length', 'nominal_bit_rate', - 'specification_compliance', 'type_abbrv_name','vendor_date', 'vendor_oui'] - -dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', - 'power_lpmode', 'tx_disable', 'tx_disable_channel', - 'temperature', 'voltage', 'rx1power', - 'rx2power', 'rx3power', 'rx4power', - 'tx1bias', 'tx2bias', 'tx3bias', - 'tx4bias', 'tx1power', 'tx2power', - 'tx3power', 'tx4power'] - -threshold_dict_keys = ['temphighalarm', 'temphighwarning', - 'templowalarm', 'templowwarning', - 'vcchighalarm', 'vcchighwarning', - 'vcclowalarm', 'vcclowwarning', - 'rxpowerhighalarm', 'rxpowerhighwarning', - 'rxpowerlowalarm', 'rxpowerlowwarning', - 'txpowerhighalarm', 'txpowerhighwarning', - 'txpowerlowalarm', 'txpowerlowwarning', - 'txbiashighalarm', 'txbiashighwarning', - 'txbiaslowalarm', 'txbiaslowwarning'] - -sff8436_parser = { - 'reset_status': [QSFP_DOM_OFFSET, 2, 1, 'parse_dom_status_indicator'], - 'rx_los': [QSFP_DOM_OFFSET, 3, 1, 'parse_dom_tx_rx_los'], - 'tx_fault': [QSFP_DOM_OFFSET, 4, 1, 'parse_dom_tx_fault'], - 'tx_disable': [QSFP_DOM_OFFSET, 86, 1, 'parse_dom_tx_disable'], - 'power_lpmode': [QSFP_DOM_OFFSET, 93, 1, 'parse_dom_power_control'], - 'power_override': [QSFP_DOM_OFFSET, 93, 1, 'parse_dom_power_control'], - 'Temperature': [QSFP_DOM_OFFSET, 22, 2, 'parse_temperature'], - 'Voltage': [QSFP_DOM_OFFSET, 26, 2, 'parse_voltage'], - 'ChannelMonitor': [QSFP_DOM_OFFSET, 34, 16, 'parse_channel_monitor_params'], - 'ChannelMonitor_TxPower': - [QSFP_DOM_OFFSET, 34, 24, 'parse_channel_monitor_params_with_tx_power'], - - 'cable_type': [QSFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'cable_length': [QSFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'connector': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'type': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'encoding': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'ext_identifier': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'ext_rateselect_compliance': - [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'nominal_bit_rate': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'specification_compliance': - [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'type_abbrv_name': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'manufacturer': [QSFP_INFO_OFFSET, 20, 16, 'parse_vendor_name'], - 'vendor_oui': [QSFP_INFO_OFFSET, 37, 3, 'parse_vendor_oui'], - 'model': [QSFP_INFO_OFFSET, 40, 16, 'parse_vendor_pn'], - 'hardware_rev': [QSFP_INFO_OFFSET, 56, 2, 'parse_vendor_rev'], - 'serial': [QSFP_INFO_OFFSET, 68, 16, 'parse_vendor_sn'], - 'vendor_date': [QSFP_INFO_OFFSET, 84, 8, 'parse_vendor_date'], - 'dom_capability': [QSFP_INFO_OFFSET, 92, 1, 'parse_dom_capability'], - 'dom_rev': [QSFP_DOM_OFFSET, 1, 1, 'parse_sfp_dom_rev'], - 'ModuleThreshold': [QSFP_DOM_OFFSET1, 128, 24, 'parse_module_threshold_values'], - 'ChannelThreshold': [QSFP_DOM_OFFSET1, 176, 16, 'parse_channel_threshold_values'], -} - -sff8472_parser = { - 'Temperature': [SFP_DOM_OFFSET, 96, 2, 'parse_temperature'], - 'Voltage': [SFP_DOM_OFFSET, 98, 2, 'parse_voltage'], - 'ChannelMonitor': [SFP_DOM_OFFSET, 100, 6, 'parse_channel_monitor_params'], - - 'cable_type': [SFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'cable_length': [SFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'connector': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'type': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'encoding': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'ext_identifier': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'ext_rateselect_compliance': - [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'nominal_bit_rate': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'specification_compliance': - [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'type_abbrv_name': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'manufacturer': [SFP_INFO_OFFSET, 20, 16, 'parse_vendor_name'], - 'vendor_oui': [SFP_INFO_OFFSET, 37, 3, 'parse_vendor_oui'], - 'model': [SFP_INFO_OFFSET, 40, 16, 'parse_vendor_pn'], - 'hardware_rev': [SFP_INFO_OFFSET, 56, 4, 'parse_vendor_rev'], - 'serial': [SFP_INFO_OFFSET, 68, 16, 'parse_vendor_sn'], - 'vendor_date': [SFP_INFO_OFFSET, 84, 8, 'parse_vendor_date'], - 'ModuleThreshold': [SFP_DOM_OFFSET, 0, 56, 'parse_alarm_warning_threshold'], -} - - -class Sfp(SfpBase): +SFP_TYPE_LIST = [ + '0x3' # SFP/SFP+/SFP28 and later +] +QSFP_TYPE_LIST = [ + '0xc', # QSFP + '0xd', # QSFP+ or later + '0x11' # QSFP28 or later +] +QSFP_DD_TYPE_LIST = [ + '0x18' #QSFP-DD Type +] + +class Sfp(SfpOptoeBase): """ DELLEMC Platform-specific Sfp class """ BASE_RES_PATH = "/sys/bus/pci/devices/0000:04:00.0/resource0" - def __init__(self, index=0, sfp_type=0, eeprom_path=''): - SfpBase.__init__(self) + def __init__(self, index, sfp_type, eeprom_path): + SfpOptoeBase.__init__(self) self.sfp_type = sfp_type self.index = index self.eeprom_path = eeprom_path - self.qsfpInfo = sff8436InterfaceId() - self.qsfpDomInfo = sff8436Dom() - self.sfpInfo = sff8472InterfaceId() - self.sfpDomInfo = sff8472Dom(None,1) + self._initialize_media(delay=False) + + def get_eeprom_path(self): + return self.eeprom_path + + def get_name(self): + return "SFP/SFP+/SFP28" if self.index < 49 else "QSFP28 or later" def pci_mem_read(self, mm, offset): mm.seek(offset) @@ -196,337 +78,17 @@ def pci_get_value(self, resource, offset): os.close(fd) return val - def _read_eeprom_bytes(self, eeprom_path, offset, num_bytes): - eeprom_raw = [] - try: - eeprom = open(eeprom_path, mode="rb", buffering=0) - except IOError: - return None - - for i in range(0, num_bytes): - eeprom_raw.append("0x00") - - try: - eeprom.seek(offset) - raw = eeprom.read(num_bytes) - except IOError: - eeprom.close() - return None - - try: - if isinstance(raw , str): - for n in range(0, num_bytes): - eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) - else: - for n in range(0, num_bytes): - eeprom_raw[n] = hex(raw[n])[2:].zfill(2) - - except BaseException: - eeprom.close() - return None - - eeprom.close() - return eeprom_raw - - def _get_eeprom_data(self, eeprom_key): - eeprom_data = None - page_offset = None - - if(self.sfp_type == 'QSFP'): - page_offset = sff8436_parser[eeprom_key][PAGE_OFFSET] - eeprom_data_raw = self._read_eeprom_bytes( - self.eeprom_path, - (sff8436_parser[eeprom_key][PAGE_OFFSET] + - sff8436_parser[eeprom_key][KEY_OFFSET]), - sff8436_parser[eeprom_key][KEY_WIDTH]) - if (eeprom_data_raw is not None): - # Offset 128 is used to retrieve sff8436InterfaceId Info - # Offset 0 is used to retrieve sff8436Dom Info - if (page_offset == 128): - if ( self.qsfpInfo is None): - return None - eeprom_data = getattr( - self.qsfpInfo, sff8436_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - if ( self.qsfpDomInfo is None): - return None - eeprom_data = getattr( - self.qsfpDomInfo, sff8436_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - page_offset = sff8472_parser[eeprom_key][PAGE_OFFSET] - eeprom_data_raw = self._read_eeprom_bytes( - self.eeprom_path, - (sff8472_parser[eeprom_key][PAGE_OFFSET] + - sff8472_parser[eeprom_key][KEY_OFFSET]), - sff8472_parser[eeprom_key][KEY_WIDTH]) - if (eeprom_data_raw is not None): - # Offset 0 is used to retrieve sff8472InterfaceId Info - # Offset 256 is used to retrieve sff8472Dom Info - if (page_offset == 0): - if ( self.sfpInfo is None): - return None - eeprom_data = getattr( - self.sfpInfo, sff8472_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - if ( self.sfpDomInfo is None): - return None - eeprom_data = getattr( - self.sfpDomInfo, sff8472_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - - return eeprom_data - - def get_transceiver_info(self): + def _initialize_media(self,delay=False): """ - Retrieves transceiver info of this SFP + Initialize the media type and eeprom driver for SFP """ - transceiver_info_dict = {} - compliance_code_dict = {} - transceiver_info_dict = dict.fromkeys(info_dict_keys, 'N/A') - # BaseInformation - iface_data = self._get_eeprom_data('type') - if (iface_data is not None): - connector = iface_data['data']['Connector']['value'] - encoding = iface_data['data']['EncodingCodes']['value'] - ext_id = iface_data['data']['Extended Identifier']['value'] - rate_identifier = iface_data['data']['RateIdentifier']['value'] - identifier = iface_data['data']['type']['value'] - type_abbrv_name=iface_data['data']['type_abbrv_name']['value'] - if(self.sfp_type == 'QSFP'): - bit_rate = str( - iface_data['data']['Nominal Bit Rate(100Mbs)']['value']) - for key in qsfp_compliance_code_tup: - if key in iface_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = iface_data['data']['Specification compliance']['value'][key]['value'] - for key in qsfp_cable_length_tup: - if key in iface_data['data']: - cable_type = key - cable_length = str(iface_data['data'][key]['value']) - else: - bit_rate = str( - iface_data['data']['NominalSignallingRate(UnitsOf100Mbd)']['value']) - for key in sfp_compliance_code_tup: - if key in iface_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = iface_data['data']['Specification compliance']['value'][key]['value'] - for key in sfp_cable_length_tup: - if key in iface_data['data']: - cable_type = key - cable_length = str(iface_data['data'][key]['value']) - else: - return transceiver_info_dict - - # Vendor Date - vendor_date_data = self._get_eeprom_data('vendor_date') - if (vendor_date_data is not None): - vendor_date = vendor_date_data['data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] - else: - return transceiver_info_dict - - # Vendor Name - vendor_name_data = self._get_eeprom_data('manufacturer') - if (vendor_name_data is not None): - vendor_name = vendor_name_data['data']['Vendor Name']['value'] - else: - return transceiver_info_dict - - # Vendor OUI - vendor_oui_data = self._get_eeprom_data('vendor_oui') - if (vendor_oui_data is not None): - vendor_oui = vendor_oui_data['data']['Vendor OUI']['value'] - else: - return transceiver_info_dict - - # Vendor PN - vendor_pn_data = self._get_eeprom_data('model') - if (vendor_pn_data is not None): - vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] - else: - return transceiver_info_dict - - # Vendor Revision - vendor_rev_data = self._get_eeprom_data('hardware_rev') - if (vendor_rev_data is not None): - vendor_rev = vendor_rev_data['data']['Vendor Rev']['value'] - else: - return transceiver_info_dict - - # Vendor Serial Number - vendor_sn_data = self._get_eeprom_data('serial') - if (vendor_sn_data is not None): - vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] - else: - return transceiver_info_dict - - # Fill The Dictionary and return - transceiver_info_dict['type'] = identifier - transceiver_info_dict['hardware_rev'] = vendor_rev - transceiver_info_dict['serial'] = vendor_sn - transceiver_info_dict['manufacturer'] = vendor_name - transceiver_info_dict['model'] = vendor_pn - transceiver_info_dict['connector'] = connector - transceiver_info_dict['encoding'] = encoding - transceiver_info_dict['ext_identifier'] = ext_id - transceiver_info_dict['ext_rateselect_compliance'] = rate_identifier - transceiver_info_dict['cable_type'] = cable_type - transceiver_info_dict['cable_length'] = cable_length - transceiver_info_dict['nominal_bit_rate'] = bit_rate - transceiver_info_dict['specification_compliance'] = str(compliance_code_dict) - transceiver_info_dict['vendor_date'] = vendor_date - transceiver_info_dict['vendor_oui'] = vendor_oui - transceiver_info_dict['type_abbrv_name']=type_abbrv_name - - return transceiver_info_dict - - def get_transceiver_threshold_info(self): - """ - Retrieves transceiver threshold info of this SFP - """ - transceiver_dom_threshold_dict = {} - transceiver_dom_threshold_dict = dict.fromkeys( - threshold_dict_keys, 'N/A') - - # Module Threshold - module_threshold_data = self._get_eeprom_data('ModuleThreshold') - if (self.sfp_type == 'QSFP'): - # Channel Threshold - channel_threshold_data = self._get_eeprom_data('ChannelThreshold') - - if (channel_threshold_data is not None and module_threshold_data is not None): - transceiver_dom_threshold_dict['temphighalarm'] = module_threshold_data['data']['TempHighAlarm']['value'] - transceiver_dom_threshold_dict['temphighwarning'] = module_threshold_data['data']['TempHighWarning']['value'] - transceiver_dom_threshold_dict['templowalarm'] = module_threshold_data['data']['TempLowAlarm']['value'] - transceiver_dom_threshold_dict['templowwarning'] = module_threshold_data['data']['TempLowWarning']['value'] - transceiver_dom_threshold_dict['vcchighalarm'] = module_threshold_data['data']['VccHighAlarm']['value'] - transceiver_dom_threshold_dict['vcchighwarning'] = module_threshold_data['data']['VccHighWarning']['value'] - transceiver_dom_threshold_dict['vcclowalarm'] = module_threshold_data['data']['VccLowAlarm']['value'] - transceiver_dom_threshold_dict['vcclowwarning'] = module_threshold_data['data']['VccLowWarning']['value'] - transceiver_dom_threshold_dict['rxpowerhighalarm'] = channel_threshold_data['data']['RxPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerhighwarning'] = channel_threshold_data['data']['RxPowerHighWarning']['value'] - transceiver_dom_threshold_dict['rxpowerlowalarm'] = channel_threshold_data['data']['RxPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerlowwarning'] = channel_threshold_data['data']['RxPowerLowWarning']['value'] - transceiver_dom_threshold_dict['txbiashighalarm'] = channel_threshold_data['data']['TxBiasHighAlarm']['value'] - transceiver_dom_threshold_dict['txbiashighwarning'] = channel_threshold_data['data']['TxBiasHighWarning']['value'] - transceiver_dom_threshold_dict['txbiaslowalarm'] = channel_threshold_data['data']['TxBiasLowAlarm']['value'] - transceiver_dom_threshold_dict['txbiaslowwarning'] = channel_threshold_data['data']['TxBiasLowWarning']['value'] - - else: - return transceiver_dom_threshold_dict - else: - #SFP - if (module_threshold_data is not None): - #Threshold Data - transceiver_dom_threshold_dict['temphighalarm'] = module_threshold_data['data']['TempHighAlarm']['value'] - transceiver_dom_threshold_dict['templowalarm'] = module_threshold_data['data']['TempLowAlarm']['value'] - transceiver_dom_threshold_dict['temphighwarning'] = module_threshold_data['data']['TempHighWarning']['value'] - transceiver_dom_threshold_dict['templowwarning'] = module_threshold_data['data']['TempLowWarning']['value'] - transceiver_dom_threshold_dict['vcchighalarm'] = module_threshold_data['data']['VoltageHighAlarm']['value'] - transceiver_dom_threshold_dict['vcclowalarm'] = module_threshold_data['data']['VoltageLowAlarm']['value'] - transceiver_dom_threshold_dict['vcchighwarning'] = module_threshold_data['data']['VoltageHighWarning']['value'] - transceiver_dom_threshold_dict['vcclowwarning'] = module_threshold_data['data']['VoltageLowWarning']['value'] - transceiver_dom_threshold_dict['txbiashighalarm'] = module_threshold_data['data']['BiasHighAlarm']['value'] - transceiver_dom_threshold_dict['txbiaslowalarm'] = module_threshold_data['data']['BiasLowAlarm']['value'] - transceiver_dom_threshold_dict['txbiashighwarning'] = module_threshold_data['data']['BiasHighWarning']['value'] - transceiver_dom_threshold_dict['txbiaslowwarning'] = module_threshold_data['data']['BiasLowWarning']['value'] - transceiver_dom_threshold_dict['txpowerhighalarm'] = module_threshold_data['data']['TXPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['txpowerlowalarm'] = module_threshold_data['data']['TXPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['txpowerhighwarning'] = module_threshold_data['data']['TXPowerHighWarning']['value'] - transceiver_dom_threshold_dict['txpowerlowwarning'] = module_threshold_data['data']['TXPowerLowWarning']['value'] - transceiver_dom_threshold_dict['rxpowerhighalarm'] = module_threshold_data['data']['RXPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerlowalarm'] = module_threshold_data['data']['RXPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerhighwarning'] = module_threshold_data['data']['RXPowerHighWarning']['value'] - transceiver_dom_threshold_dict['rxpowerlowwarning'] = module_threshold_data['data']['RXPowerLowWarning']['value'] - else: - return transceiver_dom_threshold_dict - - return transceiver_dom_threshold_dict - - def get_transceiver_bulk_status(self): - """ - Retrieves transceiver bulk status of this SFP - """ - tx_bias_list = [] - rx_power_list = [] - transceiver_dom_dict = {} - transceiver_dom_dict = dict.fromkeys(dom_dict_keys, 'N/A') - - # RxLos - rx_los = self.get_rx_los() - - # TxFault - tx_fault = self.get_tx_fault() - - # ResetStatus - reset_state = self.get_reset_status() - - # LowPower Mode - lp_mode = self.get_lpmode() - - # TxDisable - tx_disable = self.get_tx_disable() - - # TxDisable Channel - tx_disable_channel = self.get_tx_disable_channel() - - # Temperature - temperature = self.get_temperature() - - # Voltage - voltage = self.get_voltage() - - # Channel Monitor - tx_power_list = self.get_tx_power() - - # tx bias - tx_bias_list = self.get_tx_bias() - - # rx power - rx_power_list = self.get_rx_power() - - if (len(tx_bias_list) != 0): - transceiver_dom_dict['tx1bias'] = tx_bias_list[0] - transceiver_dom_dict['tx2bias'] = tx_bias_list[1] - transceiver_dom_dict['tx3bias'] = tx_bias_list[2] - transceiver_dom_dict['tx4bias'] = tx_bias_list[3] - - if (len(rx_power_list) != 0): - transceiver_dom_dict['rx1power'] = rx_power_list[0] - transceiver_dom_dict['rx2power'] = rx_power_list[1] - transceiver_dom_dict['rx3power'] = rx_power_list[2] - transceiver_dom_dict['rx4power'] = rx_power_list[3] - - if (len(tx_power_list) != 0): - transceiver_dom_dict['tx1power'] = tx_power_list[0] - transceiver_dom_dict['tx2power'] = tx_power_list[1] - transceiver_dom_dict['tx3power'] = tx_power_list[2] - transceiver_dom_dict['tx4power'] = tx_power_list[3] - - transceiver_dom_dict['rx_los'] = rx_los - transceiver_dom_dict['tx_fault'] = tx_fault - transceiver_dom_dict['reset_status'] = reset_state - transceiver_dom_dict['power_lpmode'] = lp_mode - transceiver_dom_dict['tx_disable'] = tx_disable - transceiver_dom_dict['tx_disable_channel'] = tx_disable_channel - transceiver_dom_dict['temperature'] = temperature - transceiver_dom_dict['voltage'] = voltage - - return transceiver_dom_dict - - def get_name(self): - """ - Retrieves the name of the sfp - Returns : QSFP or QSFP+ or QSFP28 - """ - - iface_data = self._get_eeprom_data('type') - if (iface_data is not None): - identifier = iface_data['data']['type']['value'] - else: - return None + if delay: + time.sleep(1) + self._xcvr_api = None + self.get_xcvr_api() - return identifier + self.set_media_type() + self.reinit_sfp_driver() def get_presence(self): """ @@ -534,60 +96,27 @@ def get_presence(self): Returns : True if sfp is present and false if it is absent """ # Check for invalid port_num - + mask = {'QSFP' : (1 << 4), 'SFP' : (1 << 0)} # Port offset starts with 0x4004 port_offset = 16388 + ((self.index-1) * 16) - status = self.pci_get_value(self.BASE_RES_PATH, port_offset) - reg_value = int(status) - - # Absence of status throws error - if (reg_value == ""): - return False - - # Mask off 4th bit for presence - if(self.sfp_type == 'QSFP'): - mask = (1 << 4) - - # Mask off 1st bit for presence 65,66 - if (self.sfp_type == 'SFP'): - mask = (1 << 0) - # ModPrsL is active low - if reg_value & mask == 0: - return True + try: + status = self.pci_get_value(self.BASE_RES_PATH, port_offset) + reg_value = int(status) + # ModPrsL is active low + if reg_value & mask[self.port_type] == 0: + return True + except ValueError: + pass return False - def get_model(self): - """ - Retrieves the model number (or part number) of the sfp - """ - vendor_pn_data = self._get_eeprom_data('model') - if (vendor_pn_data is not None): - vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] - else: - return None - - return vendor_pn - - def get_serial(self): - """ - Retrieves the serial number of the sfp - """ - vendor_sn_data = self._get_eeprom_data('serial') - if (vendor_sn_data is not None): - vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] - else: - return None - - return vendor_sn - def get_reset_status(self): """ Retrives the reset status of SFP """ reset_status = False - if (self.sfp_type == 'QSFP'): + if (self.port_type == 'QSFP'): # Port offset starts with 0x4000 port_offset = 16384 + ((self.index-1) * 16) @@ -608,187 +137,12 @@ def get_reset_status(self): return reset_status - def get_rx_los(self): - """ - Retrieves the RX LOS (lost-of-signal) status of SFP - """ - rx_los = None - rx_los_list = [] - if (self.sfp_type == 'QSFP'): - rx_los_data = self._get_eeprom_data('rx_los') - if (rx_los_data is not None): - rx_los = rx_los_data['data']['Rx1LOS']['value'] - if (rx_los is 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - rx_los = rx_los_data['data']['Rx2LOS']['value'] - if (rx_los is 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - rx_los = rx_los_data['data']['Rx3LOS']['value'] - if (rx_los is 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - rx_los = rx_los_data['data']['Rx4LOS']['value'] - if (rx_los is 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - - if (rx_los_list[0] and rx_los_list[1] - and rx_los_list[2] and rx_los_list[3]): - rx_los = True - else: - rx_los = False - else: - rx_los_data = self._read_eeprom_bytes(self.eeprom_path, SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - if (rx_los_data is not None): - data = int(rx_los_data[0], 16) - rx_los = (sffbase().test_bit(data, 1) != 0) - - return rx_los - - def get_tx_fault(self): - """ - Retrieves the TX fault status of SFP - """ - tx_fault = None - tx_fault_list = [] - if (self.sfp_type == 'QSFP'): - tx_fault_data = self._get_eeprom_data('tx_fault') - if (tx_fault_data is not None): - tx_fault = tx_fault_data['data']['Tx1Fault']['value'] - if (tx_fault is 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - tx_fault = tx_fault_data['data']['Tx2Fault']['value'] - if (tx_fault is 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - tx_fault = tx_fault_data['data']['Tx3Fault']['value'] - if (tx_fault is 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - tx_fault = tx_fault_data['data']['Tx4Fault']['value'] - if (tx_fault is 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - - if (tx_fault_list[0] and tx_fault_list[1] - and tx_fault_list[2] and tx_fault_list[3]): - tx_fault = True - else: - tx_fault = False - - else: - tx_fault_data = self._read_eeprom_bytes(self.eeprom_path, SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - if (tx_fault_data is not None): - data = int(tx_fault_data[0], 16) - tx_fault = (sffbase().test_bit(data, 2) != 0) - - return tx_fault - - def get_tx_disable(self): - """ - Retrieves the tx_disable status of this SFP - """ - tx_disable = None - tx_disable_list = [] - if (self.sfp_type == 'QSFP'): - tx_disable_data = self._get_eeprom_data('tx_disable') - if (tx_disable_data is not None): - tx_disable = tx_disable_data['data']['Tx1Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - tx_disable = tx_disable_data['data']['Tx2Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - tx_disable = tx_disable_data['data']['Tx3Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - tx_disable = tx_disable_data['data']['Tx4Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - - if (tx_disable_list[0] and tx_disable_list[1] - and tx_disable_list[2] and tx_disable_list[3]): - tx_disable = True - else: - tx_disable = False - - else: - tx_disable_data = self._read_eeprom_bytes(self.eeprom_path, SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - if (tx_disable_data is not None): - data = int(tx_disable_data[0], 16) - tx_disable_hard = (sffbase().test_bit(data, SFP_TX_DISABLE_HARD_BIT) != 0) - tx_disable_soft = (sffbase().test_bit(data, SFP_TX_DISABLE_SOFT_BIT) != 0) - tx_disable = tx_disable_hard | tx_disable_soft - - - return tx_disable - - def get_tx_disable_channel(self): - """ - Retrieves the TX disabled channels in this SFP - """ - tx_disable = None - tx_disable_list = [] - tx_disable_channel = 0 - - if (self.sfp_type == 'QSFP'): - tx_disable_data = self._get_eeprom_data('tx_disable') - if (tx_disable_data is not None): - tx_disable = tx_disable_data['data']['Tx1Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(1) - else: - tx_disable_list.append(0) - tx_disable = tx_disable_data['data']['Tx2Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(1) - else: - tx_disable_list.append(0) - tx_disable = tx_disable_data['data']['Tx3Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(1) - else: - tx_disable_list.append(0) - tx_disable = tx_disable_data['data']['Tx4Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(1) - else: - tx_disable_list.append(0) - - bit4 = int(tx_disable_list[3]) * 8 - bit3 = int(tx_disable_list[2]) * 4 - bit2 = int(tx_disable_list[1]) * 2 - bit1 = int(tx_disable_list[0]) * 1 - - tx_disable_channel = hex(bit4 + bit3 + bit2 + bit1) - - return tx_disable_channel - def get_lpmode(self): """ Retrieves the lpmode(low power mode) of this SFP """ lpmode_state = False - if (self.sfp_type == 'QSFP'): + if (self.port_type == 'QSFP'): # Port offset starts with 0x4000 port_offset = 16384 + ((self.index-1) * 16) @@ -811,149 +165,11 @@ def get_lpmode(self): return lpmode_state - def get_power_override(self): - """ - Retrieves the power-override status of this SFP - """ - power_override_state = False - - if (self.sfp_type == 'QSFP'): - power_override_data = self._get_eeprom_data('power_override') - if (power_override_data is not None): - power_override = power_override_data['data']['PowerOverRide']['value'] - if (power_override is 'On'): - power_override_state = True - else: - power_override_state = False - - return power_override_state - - def get_temperature(self): - """ - Retrieves the temperature of this SFP - """ - temperature = None - - temperature_data = self._get_eeprom_data('Temperature') - if (temperature_data is not None): - temperature = temperature_data['data']['Temperature']['value'] - - return temperature - - def get_voltage(self): - """ - Retrieves the supply voltage of this SFP - """ - voltage = None - - voltage_data = self._get_eeprom_data('Voltage') - if (voltage_data is not None): - voltage = voltage_data['data']['Vcc']['value'] - - return voltage - - def get_tx_bias(self): - """ - Retrieves the TX bias current of this SFP - """ - tx_bias = None - tx_bias_list = [] - - tx_bias_data = self._get_eeprom_data('ChannelMonitor') - if (tx_bias_data is not None): - if (self.sfp_type == 'QSFP'): - tx_bias = tx_bias_data['data']['TX1Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = tx_bias_data['data']['TX2Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = tx_bias_data['data']['TX3Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = tx_bias_data['data']['TX4Bias']['value'] - tx_bias_list.append(tx_bias) - else: - tx1_bias = tx_bias_data['data']['TXBias']['value'] - return [tx1_bias, "N/A", "N/A", "N/A"] - - return tx_bias_list - - def get_rx_power(self): - """ - Retrieves the received optical power for this SFP - """ - rx_power = None - rx_power_list = [] - - rx_power_data = self._get_eeprom_data('ChannelMonitor') - if (rx_power_data is not None): - if (self.sfp_type == 'QSFP'): - rx_power = rx_power_data['data']['RX1Power']['value'] - rx_power_list.append(rx_power) - rx_power = rx_power_data['data']['RX2Power']['value'] - rx_power_list.append(rx_power) - rx_power = rx_power_data['data']['RX3Power']['value'] - rx_power_list.append(rx_power) - rx_power = rx_power_data['data']['RX4Power']['value'] - rx_power_list.append(rx_power) - else: - rx1_pw = rx_power_data['data']['RXPower']['value'] - return [rx1_pw, "N/A", "N/A", "N/A"] - - return rx_power_list - - def get_tx_power(self): - """ - Retrieves the TX power of this SFP - """ - tx_power_list = [] - if(self.sfp_type == 'QSFP'): - # QSFP capability byte parse, through this byte can know whether it support tx_power or not. - # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, - # need to add more code for determining the capability and version compliance - # in SFF-8636 dom capability definitions evolving with the versions. - qspf_dom_capability_data = self._get_eeprom_data('dom_capability') - qsfp_dom_rev_data = self._get_eeprom_data('dom_rev') - if (qspf_dom_capability_data is not None and qsfp_dom_rev_data is not None): - qsfp_dom_rev = qsfp_dom_rev_data['data']['dom_rev']['value'] - qsfp_tx_power_support = qspf_dom_capability_data['data']['Tx_power_support']['value'] - else: - return tx_power_list - - # The tx_power monitoring is only available on QSFP which compliant with SFF-8636 - # and claimed that it support tx_power with one indicator bit. - if (qsfp_dom_rev[0:8] != 'SFF-8636' or (qsfp_dom_rev[0:8] == 'SFF-8636' and qsfp_tx_power_support != 'on')): - return tx_power_list - else: - channel_monitor_data = self._get_eeprom_data('ChannelMonitor_TxPower') - if (channel_monitor_data is not None): - tx1_pw = channel_monitor_data['data']['TX1Power']['value'] - tx2_pw = channel_monitor_data['data']['TX2Power']['value'] - tx3_pw = channel_monitor_data['data']['TX3Power']['value'] - tx4_pw = channel_monitor_data['data']['TX4Power']['value'] - else: - return tx_power_list - - else: - channel_monitor_data = self._get_eeprom_data('ChannelMonitor') - if (channel_monitor_data is not None): - tx1_pw = channel_monitor_data['data']['TXPower']['value'] - tx2_pw = 'N/A' - tx3_pw = 'N/A' - tx4_pw = 'N/A' - else: - return tx_power_list - - tx_power_list.append(tx1_pw) - tx_power_list.append(tx2_pw) - tx_power_list.append(tx3_pw) - tx_power_list.append(tx4_pw) - - return tx_power_list - def reset(self): """ Reset the SFP and returns all user settings to their default state """ - if (self.sfp_type == 'QSFP'): + if (self.port_type == 'QSFP'): # Port offset starts with 0x4000 port_offset = 16384 + ((self.index-1) * 16) @@ -990,7 +206,7 @@ def set_lpmode(self, lpmode): """ Sets the lpmode(low power mode) of this SFP """ - if (self.sfp_type == 'QSFP'): + if (self.port_type == 'QSFP'): # Port offset starts with 0x4000 port_offset = 16384 + ((self.index-1) * 16) @@ -1018,24 +234,6 @@ def set_lpmode(self, lpmode): else: return False - def tx_disable(self, tx_disable): - """ - Disable SFP TX for all channels - """ - return False - - def tx_disable_channel(self, channel, disable): - """ - Sets the tx_disable for specified SFP channels - """ - return False - - def set_power_override(self, power_override, power_set): - """ - Sets SFP power level using power_override and power_set - """ - return False - def get_status(self): """ Retrieves the operational status of the device @@ -1048,3 +246,68 @@ def get_status(self): status = True return status + + def set_media_type(self): + """ + Reads optic eeprom byte to determine media type inserted + """ + eeprom_raw = [] + eeprom_raw = self._xcvr_api_factory._get_id() + if eeprom_raw is not None: + eeprom_raw = hex(eeprom_raw) + if eeprom_raw in SFP_TYPE_LIST: + self.sfp_type = 'SFP' + elif eeprom_raw in QSFP_TYPE_LIST: + self.sfp_type = 'QSFP' + elif eeprom_raw in QSFP_DD_TYPE_LIST: + self.sfp_type = 'QSFP_DD' + else: + #Set native port type if EEPROM type is not recognized/readable + self.sfp_type = self.port_type + else: + self.sfp_type = self.port_type + + return self.sfp_type + + def reinit_sfp_driver(self): + """ + Changes the driver based on media type detected + """ + del_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/delete_device".format(self.index+1) + new_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/new_device".format(self.index+1) + driver_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/name".format(self.index+1) + delete_device = "echo 0x50 >" + del_sfp_path + + if not os.path.isfile(driver_path): + print(driver_path, "does not exist") + return False + + try: + with os.fdopen(os.open(driver_path, os.O_RDONLY)) as fd: + driver_name = fd.read() + driver_name = driver_name.rstrip('\r\n') + driver_name = driver_name.lstrip(" ") + + #Avoid re-initialization of the QSFP/SFP optic on QSFP/SFP port. + if self.sfp_type == 'SFP' and driver_name in ['optoe1', 'optoe3']: + subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + time.sleep(0.2) + new_device = "echo optoe2 0x50 >" + new_sfp_path + subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + time.sleep(2) + elif self.sfp_type == 'QSFP' and driver_name in ['optoe2', 'optoe3']: + subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + time.sleep(0.2) + new_device = "echo optoe1 0x50 >" + new_sfp_path + subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + time.sleep(2) + elif self.sfp_type == 'QSFP_DD' and driver_name in ['optoe1', 'optoe2']: + subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + time.sleep(0.2) + new_device = "echo optoe3 0x50 >" + new_sfp_path + subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + time.sleep(2) + + except IOError as e: + print("Error: Unable to open file: %s" % str(e)) + return False diff --git a/platform/broadcom/sonic-platform-modules-dell/s5296f/modules/dell_s5296f_fpga_ocores.c b/platform/broadcom/sonic-platform-modules-dell/s5296f/modules/dell_s5296f_fpga_ocores.c index b9a50c69b225..0673d6e9d0ac 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5296f/modules/dell_s5296f_fpga_ocores.c +++ b/platform/broadcom/sonic-platform-modules-dell/s5296f/modules/dell_s5296f_fpga_ocores.c @@ -1046,7 +1046,7 @@ static int map_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev) /* map the device memory or IO region into kernel virtual * address space */ - fpgapci->bar[i] = ioremap_nocache (bar_start + FPGALOGIC_I2C_BASE, I2C_PCI_MAX_BUS * FPGALOGIC_CH_OFFSET); + fpgapci->bar[i] = ioremap (bar_start + FPGALOGIC_I2C_BASE, I2C_PCI_MAX_BUS * FPGALOGIC_CH_OFFSET); if (!fpgapci->bar[i]) { PRINT ( "Could not map BAR #%d.\n", i); @@ -1060,7 +1060,7 @@ static int map_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev) { fpga_phys_addr = bar_start; - fpga_ctl_addr = ioremap_nocache (bar_start, FPGA_CTL_REG_SIZE); + fpga_ctl_addr = ioremap (bar_start, FPGA_CTL_REG_SIZE); fpga_base_addr = fpgapci->bar[i]; } diff --git a/platform/broadcom/sonic-platform-modules-dell/s5296f/scripts/pcisysfs.py b/platform/broadcom/sonic-platform-modules-dell/s5296f/scripts/pcisysfs.py index 047618e057c8..45669199a383 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s5296f/scripts/pcisysfs.py +++ b/platform/broadcom/sonic-platform-modules-dell/s5296f/scripts/pcisysfs.py @@ -20,23 +20,23 @@ from mmap import * def usage(): - ''' This is the Usage Method ''' + ''' This is the Usage Method ''' - print '\t\t pcisysfs.py --get --offset --res ' - print '\t\t pcisysfs.py --set --val --offset --res ' - sys.exit(1) + print('\t\t pcisysfs.py --get --offset --res ') + print('\t\t pcisysfs.py --set --val --offset --res ') + sys.exit(1) def pci_mem_read(mm,offset): mm.seek(offset) read_data_stream=mm.read(4) - print "" + print("") reg_val=struct.unpack('I',read_data_stream) - print "reg_val read:%x"%reg_val + print("reg_val read:%x"%reg_val) return reg_val def pci_mem_write(mm,offset,data): mm.seek(offset) - print "data to write:%x"%data + print("data to write:%x"%data) mm.write(struct.pack('I',data)) def pci_set_value(resource,val,offset): @@ -63,7 +63,7 @@ def main(argv): try: opts, args = getopt.getopt(argv, "hgsv:" , \ ["val=","res=","offset=","help", "get", "set"]) - + except getopt.GetoptError: usage() diff --git a/platform/broadcom/sonic-platform-modules-dell/s5296f/scripts/s5296f_platform.sh b/platform/broadcom/sonic-platform-modules-dell/s5296f/scripts/s5296f_platform.sh index f69470756001..2bf64fa736c6 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s5296f/scripts/s5296f_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/s5296f/scripts/s5296f_platform.sh @@ -150,7 +150,7 @@ init_devnum if [ "$1" == "init" ]; then modprobe i2c-dev - modprobe i2c-mux-pca954x force_deselect_on_exit=1 + modprobe i2c-mux-pca954x modprobe ipmi_devintf modprobe ipmi_si modprobe i2c_ocores @@ -162,14 +162,33 @@ if [ "$1" == "init" ]; then switch_board_led_default #python /usr/bin/qsfp_irq_enable.py platform_firmware_versions + echo -2 > /sys/bus/i2c/drivers/pca954x/603-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/604-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/605-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/606-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/607-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/608-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/609-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/610-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/611-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/612-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/613-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/614-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/615-0074/idle_state elif [ "$1" == "deinit" ]; then sys_eeprom "delete_device" switch_board_qsfp "delete_device" switch_board_qsfp_mux "delete_device" + modprobe -r dell_s5296f_fpga_ocores + modprobe -r i2c_ocores + modprobe -r acpi_ipmi + modprobe -r ipmi_si + modprobe -r ipmi_devintf modprobe -r i2c-mux-pca954x modprobe -r i2c-dev + remove_python_api_package else echo "s5296f_platform : Invalid option !" fi diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/modules/dell_s6000_platform.c b/platform/broadcom/sonic-platform-modules-dell/s6000/modules/dell_s6000_platform.c index cbf506940ac9..ed63e28e16f6 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/modules/dell_s6000_platform.c +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/modules/dell_s6000_platform.c @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include #define S6000_MUX_BASE_NR 10 @@ -47,15 +49,23 @@ static struct i2c_mux_gpio_platform_data s6000_mux_platform_data = { .base_nr = S6000_MUX_BASE_NR, .values = s6000_mux_values, .n_values = ARRAY_SIZE(s6000_mux_values), - .gpios = s6000_mux_gpios, - .n_gpios = ARRAY_SIZE(s6000_mux_gpios), .idle = 0, }; +static struct gpiod_lookup_table dell_gpio_desc = { + .dev_id = "i2c-mux-gpio", + .table = { + GPIO_LOOKUP_IDX("sch_gpio.3168", 1, "mux", 0, GPIO_ACTIVE_HIGH ), + GPIO_LOOKUP_IDX("sch_gpio.3168", 2, "mux", 1, GPIO_ACTIVE_HIGH ), + { }, + }, +}; + static struct platform_device s6000_mux = { .name = "i2c-mux-gpio", .id = 0, .dev = { + .init_name = "i2c-mux-gpio", .platform_data = &s6000_mux_platform_data, .release = device_release }, @@ -312,6 +322,25 @@ static ssize_t get_modsel(struct device *dev, struct device_attribute *devattr, return sprintf(buf, "0x%08x\n", data); } +static ssize_t set_modsel(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) +{ + int err; + unsigned long data = 0; + struct cpld_platform_data *pdata = dev->platform_data; + + err = kstrtoul(buf, 16, &data); + if (err) + return err; + + dell_i2c_smbus_write_byte_data(pdata[slave_cpld].client, 0x0, (u8)(data & 0xff)); + dell_i2c_smbus_write_byte_data(pdata[slave_cpld].client, 0x1, (u8)((data >> 8) & 0xff)); + dell_i2c_smbus_write_byte_data(pdata[master_cpld].client, 0xa, (u8)((data >> 16) & 0xff)); + dell_i2c_smbus_write_byte_data(pdata[master_cpld].client, 0xb, (u8)((data >> 24) & 0xff)); + + msleep(2); // As per HW spec + return count; +} + static ssize_t get_lpmode(struct device *dev, struct device_attribute *devattr, char *buf) { int ret; @@ -1128,7 +1157,7 @@ static ssize_t get_reboot_reason(struct device *dev, return sprintf(buf, "0x%x\n", data); } -static DEVICE_ATTR(qsfp_modsel, S_IRUGO, get_modsel, NULL); +static DEVICE_ATTR(qsfp_modsel, S_IRUGO | S_IWUSR, get_modsel, set_modsel); static DEVICE_ATTR(qsfp_modprs, S_IRUGO, get_modprs, NULL); static DEVICE_ATTR(qsfp_lpmode, S_IRUGO | S_IWUSR, get_lpmode, set_lpmode); static DEVICE_ATTR(qsfp_reset, S_IRUGO | S_IWUSR, get_reset, set_reset); @@ -1204,7 +1233,7 @@ static int __init cpld_probe(struct platform_device *pdev) } for (i = 0; i < CPLD_DEVICE_NUM; i++) { - pdata[i].client = i2c_new_dummy(parent, pdata[i].reg_addr); + pdata[i].client = i2c_new_dummy_device(parent, pdata[i].reg_addr); if (!pdata[i].client) { printk(KERN_WARNING "Fail to create dummy i2c client for addr %d\n", pdata[i].reg_addr); goto error; @@ -1274,7 +1303,6 @@ static int __init dell_s6000_platform_init(void) bool gpio_allocated = false; printk("dell_s6000_platform module initialization\n"); - ret = gpio_request(GPIO_I2C_MUX_PIN, "gpio10"); if(ret < 0) { printk(KERN_WARNING "Failed to request gpio 10"); @@ -1294,6 +1322,7 @@ static int __init dell_s6000_platform_init(void) goto error_gpio_init; } + gpiod_add_lookup_table(&dell_gpio_desc); ret = platform_driver_register(&cpld_driver); if (ret) { printk(KERN_WARNING "Fail to register cpld driver\n"); @@ -1361,7 +1390,7 @@ static int __init dell_s6000_platform_init(void) static void __exit dell_s6000_platform_exit(void) { int i; - + gpiod_remove_lookup_table(&dell_gpio_desc); for (i = 0; i < MUX_CHANNEL_NUM; i++) platform_device_unregister(&s6000_qsfp_mux[i]); platform_device_unregister(&s6000_cpld); diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/fancontrol.sh b/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/fancontrol.sh deleted file mode 100755 index 665d5494b6b7..000000000000 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/fancontrol.sh +++ /dev/null @@ -1,253 +0,0 @@ -#!/bin/bash -trap 'cleanup' 0 1 2 3 6 9 10 11 13 15 - -LEVEL=99 -INTERVAL=5 -FAULTY_FANTRAY1=1 -FAULTY_FANTRAY2=1 -FAULTY_FANTRAY3=1 - -# FAN RPM Speed -IDLE=7000 -LEVEL1=10000 -LEVEL2=13000 -LEVEL3=16000 -LEVEL4=19000 -LEVEL5=19000 - -LRR_FILE="/host/reboot-cause/reboot-cause.txt" -I2C_ADAPTER="/sys/class/i2c-adapter/i2c-2/i2c-11" - -SENSOR1="$I2C_ADAPTER/11-004c/hwmon/hwmon*/temp1_input" -SENSOR2="$I2C_ADAPTER/11-004d/hwmon/hwmon*/temp1_input" -SENSOR3="$I2C_ADAPTER/11-004e/hwmon/hwmon*/temp1_input" - -SENSOR1_MAX="$I2C_ADAPTER/11-004c/hwmon/hwmon*/temp1_max" -SENSOR2_MAX="$I2C_ADAPTER/11-004d/hwmon/hwmon*/temp1_max" -SENSOR3_MAX="$I2C_ADAPTER/11-004e/hwmon/hwmon*/temp1_max" - -SENSOR1_MAX_VAL=$(cat $SENSOR1_MAX) -SENSOR2_MAX_VAL=$(cat $SENSOR2_MAX) -SENSOR3_MAX_VAL=$(cat $SENSOR3_MAX) - -# Reducing by 63 to differentiate this temperature settings -# from pmon sensors configuration settings -SENSOR1_NEW_MAX=$(expr `echo $SENSOR1_MAX_VAL` + 5000 - 63) -SENSOR2_NEW_MAX=$(expr `echo $SENSOR2_MAX_VAL` + 5000 - 63) -SENSOR3_NEW_MAX=$(expr `echo $SENSOR3_MAX_VAL` + 5000 - 63) - -# Three fan trays with each contains two separate fans -# fan1-fan4 fan2-fan5 fan3-fan6 -FANTRAY1_FAN1=$I2C_ADAPTER/11-0029/fan1_target -FANTRAY1_FAN2=$I2C_ADAPTER/11-0029/fan2_target -FANTRAY2_FAN1=$I2C_ADAPTER/11-0029/fan3_target -FANTRAY2_FAN2=$I2C_ADAPTER/11-0029/fan4_target -FANTRAY3_FAN1=$I2C_ADAPTER/11-002a/fan1_target -FANTRAY3_FAN2=$I2C_ADAPTER/11-002a/fan2_target - -FANTRAY1_FAN1_RPM=$I2C_ADAPTER/11-0029/fan1_input -FANTRAY1_FAN2_RPM=$I2C_ADAPTER/11-0029/fan2_input -FANTRAY2_FAN1_RPM=$I2C_ADAPTER/11-0029/fan3_input -FANTRAY2_FAN2_RPM=$I2C_ADAPTER/11-0029/fan4_input -FANTRAY3_FAN1_RPM=$I2C_ADAPTER/11-002a/fan1_input -FANTRAY3_FAN2_RPM=$I2C_ADAPTER/11-002a/fan2_input - -function check_module -{ - MODULE=$1 - lsmod | grep "$MODULE" > /dev/null - ret=$? - if [[ $ret = "1" ]]; then - echo "$MODULE is not loaded!" - exit 1 - fi -} - -function cleanup -{ - echo $SENSOR1_MAX_VAL > $SENSOR1_MAX - echo $SENSOR2_MAX_VAL > $SENSOR2_MAX - echo $SENSOR3_MAX_VAL > $SENSOR3_MAX - exit 1 -} - -function check_faulty_fan -{ - - # Assume fans in FanTray spins less than 1000 RPM is faulty. - # To Maintain temperature assign max speed 16200 RPM to all other fans. - # This RPM speed handle temperature upto 75C degrees - - fan1=$(cat $FANTRAY1_FAN1_RPM) - fan2=$(cat $FANTRAY1_FAN2_RPM) - fan3=$(cat $FANTRAY2_FAN1_RPM) - fan4=$(cat $FANTRAY2_FAN2_RPM) - fan5=$(cat $FANTRAY3_FAN1_RPM) - fan6=$(cat $FANTRAY3_FAN2_RPM) - - # FanTray1 - if [ "$fan1" -le "1000" ] || [ "$fan2" -le "1000" ]; then - - # First time detecting failure - if [ $FAULTY_FANTRAY1 -lt "2" ]; then - FAULTY_FANTRAY1=2 - /usr/local/bin/set-fan-speed 16200 2 > /dev/null - logger "Faulty Fans in Fantray1 $fan1 $fan2 Please check." - fi - - elif [ "$fan1" -ge "1000" ] || [ "$fan2" -ge "1000" ]; then - FAULTY_FANTRAY1=0 - fi - - - # FanTray2 - if [ "$fan3" -le "1000" ] || [ "$fan4" -le "1000" ]; then - - # First time detecting failure - if [ $FAULTY_FANTRAY2 -lt "2" ]; then - - FAULTY_FANTRAY2=2 - /usr/local/bin/set-fan-speed 16200 2 > /dev/null - logger "Faulty Fans in FanTray2: $fan3 $fan4. Please check." - fi - - elif [ "$fan3" -ge "1000" ] || [ "$fan4" -ge "1000" ]; then - FAULTY_FANTRAY2=0 - fi - - # FanTray3 - if [ "$fan5" -le "1000" ] || [ "$fan6" -le "1000" ]; then - - # First time detecting failure - if [ $FAULTY_FANTRAY3 -lt "2" ]; then - - FAULTY_FANTRAY3=2 - /usr/local/bin/set-fan-speed 16200 2 > /dev/null - logger "FanTray3 Fans are Faulty.. $fan5 $fan6. Please check." - fi - - elif [ "$fan5" -ge "1000" ] || [ "$fan6" -ge "1000" ]; then - - FAULTY_FANTRAY3=0 - fi - -} - -function update_fan_speed -{ - local fan_speed=$1 - - echo $fan_speed > $FANTRAY1_FAN1 - echo $fan_speed > $FANTRAY1_FAN2 - echo $fan_speed > $FANTRAY2_FAN1 - echo $fan_speed > $FANTRAY2_FAN2 - echo $fan_speed > $FANTRAY3_FAN1 - echo $fan_speed > $FANTRAY3_FAN2 - -} - -function monitor_temp_sensors -{ - SENSOR1_CUR_MAX_VAL=$(cat $SENSOR1_MAX) - SENSOR2_CUR_MAX_VAL=$(cat $SENSOR2_MAX) - SENSOR3_CUR_MAX_VAL=$(cat $SENSOR3_MAX) - if [ "$SENSOR1_CUR_MAX_VAL" -ne "$SENSOR1_NEW_MAX" ] - then - SENSOR1_NEW_MAX=$(expr `echo $SENSOR1_CUR_MAX_VAL` + 5000 - 63) - SENSOR1_MAX_VAL=$SENSOR1_CUR_MAX_VAL - echo $SENSOR1_NEW_MAX > $SENSOR1_MAX - fi - if [ "$SENSOR2_CUR_MAX_VAL" -ne "$SENSOR2_NEW_MAX" ] - then - SENSOR2_NEW_MAX=$(expr `echo $SENSOR2_CUR_MAX_VAL` + 5000 - 63) - SENSOR2_MAX_VAL=$SENSOR2_CUR_MAX_VAL - echo $SENSOR2_NEW_MAX > $SENSOR2_MAX - fi - if [ "$SENSOR3_CUR_MAX_VAL" -ne "$SENSOR3_NEW_MAX" ] - then - SENSOR3_NEW_MAX=$(expr `echo $SENSOR3_CUR_MAX_VAL` + 5000 - 63) - SENSOR3_MAX_VAL=$SENSOR3_CUR_MAX_VAL - echo $SENSOR3_NEW_MAX > $SENSOR3_MAX - fi - - # go through all temp sensor outputs - sensor1=$(expr `echo $(cat $SENSOR1)` / 1000) - sensor2=$(expr `echo $(cat $SENSOR2)` / 1000) - sensor3=$(expr `echo $(cat $SENSOR3)` / 1000) - # All sensors output in 1000's - s1=$(cat $SENSOR1) - s2=$(cat $SENSOR2) - s3=$(cat $SENSOR3) - - if [ "$s1" -ge "$SENSOR1_MAX_VAL" ] || [ "$s2" -ge "$SENSOR2_MAX_VAL" ] || [ "$s3" -ge "$SENSOR3_MAX_VAL" ] - then - # Thermal trip is about to happen - echo "Thermal Overload $sensor1 $sensor2 $sensor3" > $LRR_FILE - logger "Shutting down due to over temperature ($sensor1 degree, $sensor2 degree, $sensor3 degree)" - sync - sleep 1 # Give time to send logger message to server - # Assigning the original max values back in sensors - echo $SENSOR1_MAX_VAL > $SENSOR1_MAX - echo $SENSOR2_MAX_VAL > $SENSOR2_MAX - echo $SENSOR3_MAX_VAL > $SENSOR3_MAX - - ### Not Reached ### - # In case if HW fails to shutdown - /sbin/shutdown -P now - fi - sum=$(($sensor1 + $sensor2 + $sensor3)) - sensor_temp=$(($sum/3)) - - if [ "$sensor_temp" -le "25" ] && [ "$LEVEL" -ne "0" ] - then - # Set Fan Speed to 7000 RPM" - LEVEL=0 - update_fan_speed $IDLE - logger "Adjusted FAN Speed to $IDLE RPM against $sensor_temp Temperature" - - elif [ "$sensor_temp" -ge "26" ] && [ "$sensor_temp" -le "44" ] && [ "$LEVEL" -ne "1" ] - then - # Set Fan Speed to 10000 RPM" - LEVEL=1 - update_fan_speed $LEVEL1 - logger "Adjusted FAN Speed to $IDLE RPM against $sensor_temp Temperature" - - elif [ "$sensor_temp" -ge "45" ] && [ "$sensor_temp" -le "59" ] && [ "$LEVEL" -ne "2" ] - then - # Set Fan Speed to 13000 RPM" - LEVEL=2 - update_fan_speed $LEVEL2 - logger "Adjusted FAN Speed to $IDLE RPM against $sensor_temp Temperature" - - elif [ "$sensor_temp" -ge "60" ] && [ "$sensor_temp" -le "79" ] && [ "$LEVEL" -ne "3" ] - then - # Set Fan Speed to 16000 RPM" - LEVEL=3 - update_fan_speed $LEVEL3 - logger "Adjusted FAN Speed to $IDLE RPM against $sensor_temp Temperature" - - elif [ "$sensor_temp" -ge "80" ] && [ "$LEVEL" -ne "4" ] - then - # Set Fan Speed to 19000 RPM" - LEVEL=4 - update_fan_speed $LEVEL4 - logger "Adjusted FAN Speed to $IDLE RPM against $sensor_temp Temperature" - fi - - # Check for faulty fan - check_faulty_fan - -} - -# Check drivers for sysfs attributes -check_module "dell_s6000_platform" -check_module "max6620" - -# main loop calling the main function at specified intervals -while true -do - monitor_temp_sensors - # Sleep while still handling signals - sleep $INTERVAL & - wait -done diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/s6000_platform.sh b/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/s6000_platform.sh index a30c72e7d030..32578e40b0d3 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/s6000_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/s6000_platform.sh @@ -125,20 +125,33 @@ switch_board_qsfp_lpmode() { echo $value > /sys/bus/platform/devices/dell-s6000-cpld.0/qsfp_lpmode } +set_max6620_dynamic_reg() { + DEVICE1=/sys/class/i2c-adapter/i2c-11/11-0029/hwmon/hwmon*/fan1_div + DEVICE2=/sys/class/i2c-adapter/i2c-11/11-002a/hwmon/hwmon*/fan1_div + + # Retry three times + for count in `seq 1 3`; do + if [ -w $DEVICE1 -o -w $DEVICE2 ]; then + for i in `seq 1 4`; do + echo $1 > /sys/class/i2c-adapter/i2c-11/11-0029/hwmon/hwmon*/fan${i}_div + done + for i in `seq 1 2`; do + echo $1 > /sys/class/i2c-adapter/i2c-11/11-002a/hwmon/hwmon*/fan${i}_div + done + return + fi + # Sleep for 3 seconds to wait for device tree to be ready + sleep 3 + done +} + install_python_api_package() { device="/usr/share/sonic/device" platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) - rv=$(pip install $device/$platform/sonic_platform-1.0-py2-none-any.whl) rv=$(pip3 install $device/$platform/sonic_platform-1.0-py3-none-any.whl) - } remove_python_api_package() { - rv=$(pip show sonic-platform > /dev/null 2>/dev/null) - if [ $? -eq 0 ]; then - rv=$(pip uninstall -y sonic-platform > /dev/null 2>/dev/null) - fi - rv=$(pip3 show sonic-platform > /dev/null 2>/dev/null) if [ $? -eq 0 ]; then rv=$(pip3 uninstall -y sonic-platform > /dev/null 2>/dev/null) @@ -148,6 +161,10 @@ remove_python_api_package() { # read SONiC immutable variables [ -f /etc/sonic/sonic-environment ] && . /etc/sonic/sonic-environment +if [ ! -e /etc/sonic/sfp_lock ]; then + touch /etc/sonic/sfp_lock +fi + if [[ "$1" == "init" ]]; then depmod -a modprobe nvram @@ -157,7 +174,7 @@ if [[ "$1" == "init" ]]; then #Use 1 for PCIe Gen1, 2 for PCIe Gen2 change_pcie_speed 1 add_i2c_devices - + set_max6620_dynamic_reg 4 /usr/local/bin/set-fan-speed 15000 switch_board_qsfp_lpmode "disable" /usr/local/bin/reset-qsfp diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/set-fan-speed b/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/set-fan-speed index 00c738f23a8d..cbcc0ba29764 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/set-fan-speed +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/scripts/set-fan-speed @@ -21,12 +21,12 @@ PSU_FAN2=/sys/class/i2c-adapter/i2c-1/1-0059/fan1_target # Three fan trays with each contains two separate fans # fan1-fan4 fan2-fan5 fan3-fan6 -FAN1=/sys/class/i2c-adapter/i2c-11/11-0029/fan1_target -FAN2=/sys/class/i2c-adapter/i2c-11/11-0029/fan2_target -FAN3=/sys/class/i2c-adapter/i2c-11/11-0029/fan3_target -FAN4=/sys/class/i2c-adapter/i2c-11/11-0029/fan4_target -FAN5=/sys/class/i2c-adapter/i2c-11/11-002a/fan1_target -FAN6=/sys/class/i2c-adapter/i2c-11/11-002a/fan2_target +FAN1=/sys/class/i2c-adapter/i2c-11/11-0029/hwmon/hwmon*/fan1_target +FAN2=/sys/class/i2c-adapter/i2c-11/11-0029/hwmon/hwmon*/fan2_target +FAN3=/sys/class/i2c-adapter/i2c-11/11-0029/hwmon/hwmon*/fan3_target +FAN4=/sys/class/i2c-adapter/i2c-11/11-0029/hwmon/hwmon*/fan4_target +FAN5=/sys/class/i2c-adapter/i2c-11/11-002a/hwmon/hwmon*/fan1_target +FAN6=/sys/class/i2c-adapter/i2c-11/11-002a/hwmon/hwmon*/fan2_target speed=$1 logger -t platform-modules "Trying to set fan speed to $speed" diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/chassis.py index 08c128d678bc..6ae79ffadb00 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/chassis.py @@ -10,6 +10,7 @@ try: import os import time + import subprocess import struct from sonic_platform_base.chassis_base import ChassisBase from sonic_platform.sfp import Sfp @@ -27,6 +28,14 @@ MAX_S6000_THERMAL = 6 MAX_S6000_COMPONENT = 4 +HYST_RANGE = 5 +LEVEL0_THRESHOLD = 25 +LEVEL1_THRESHOLD = 30 +LEVEL2_THRESHOLD = 45 +LEVEL3_THRESHOLD = 60 +LEVEL4_THRESHOLD = 80 +LEVEL5_THRESHOLD = 85 + class Chassis(ChassisBase): """ @@ -42,6 +51,11 @@ class Chassis(ChassisBase): reset_reason_dict[0x6] = ChassisBase.REBOOT_CAUSE_NON_HARDWARE reset_reason_dict[0x7] = ChassisBase.REBOOT_CAUSE_THERMAL_OVERLOAD_OTHER + _num_monitor_thermals = 3 + _monitor_thermal_list = [] + _is_fan_control_enabled = False + _fan_control_initialised = False + def __init__(self): ChassisBase.__init__(self) self.status_led_reg = "system_led" @@ -142,20 +156,12 @@ def _nvram_write(self, offset, val): return os.close(fd) - def _get_thermal_reset(self): - reset_file = "/host/reboot-cause/reboot-cause.txt" - if (not os.path.isfile(reset_file)): - return False - try: - with open(reset_file, 'r') as fd: - rv = fd.read() - except Exception as error: - return False + def _init_fan_control(self): - if "Thermal Overload" in rv: - return True - - return False + if not self._fan_control_initialised: + for i in range(self._num_monitor_thermals): + self._monitor_thermal_list.append(Thermal(i)) + self._fan_control_initialised = True def get_name(self): """ @@ -225,6 +231,15 @@ def get_base_mac(self): """ return self._eeprom.get_base_mac() + def get_revision(self): + """ + Retrieves the hardware revision of the device + + Returns: + string: Revision value of device + """ + return self._eeprom.get_revision() + def get_system_eeprom_info(self): """ Retrieves the full content of system EEPROM information for the @@ -245,9 +260,6 @@ def get_reboot_cause(self): # NVRAM. Only Warmboot and Coldboot reason are supported here. # Since it does not support any hardware reason, we return # non_hardware as default - if self._get_thermal_reset() == True: - self._nvram_write(0x49, 0x7) - lrr = self._get_cpld_register('last_reboot_reason') if (lrr != 'ERR'): reset_reason = int(lrr, base=16) @@ -382,3 +394,77 @@ def get_status_led(self): return status_led else: return None + + def get_thermal_manager(self): + """ + Retrieves thermal manager class on this chassis + + Returns: + A class derived from ThermalManagerBase representing the + specified thermal manager + """ + from .thermal_manager import ThermalManager + return ThermalManager + + def set_fan_control_status(self, enable): + + if enable and not self._is_fan_control_enabled: + self._init_fan_control() + for thermal in self._monitor_thermal_list: + thermal.set_high_threshold(LEVEL5_THRESHOLD, force=True) + self._is_fan_control_enabled = True + elif not enable and self._is_fan_control_enabled: + for thermal in self._monitor_thermal_list: + thermal.set_high_threshold(LEVEL4_THRESHOLD, force=True) + self._is_fan_control_enabled = False + + def get_monitor_thermals(self): + return self._monitor_thermal_list + + def thermal_shutdown(self): + # Update reboot cause + self._nvram_write(0x49, 0x7) + + subprocess.call('sync') + time.sleep(1) + for thermal in self._monitor_thermal_list: + thermal.set_high_threshold(LEVEL4_THRESHOLD, force=True) + + @staticmethod + def get_system_thermal_level(curr_thermal_level, system_temperature): + + def get_level_in_hystersis(curr_level, level1, level2): + if curr_level != level1 and curr_level != level2: + return level1 if abs(curr_level - level1) < abs(curr_level - level2) else level2 + else: + return curr_level + + if system_temperature < LEVEL0_THRESHOLD: + curr_thermal_level = 0 + elif LEVEL0_THRESHOLD <= system_temperature < LEVEL1_THRESHOLD: + curr_thermal_level = get_level_in_hystersis(curr_thermal_level, 0, 1) + elif LEVEL1_THRESHOLD <= system_temperature <= (LEVEL2_THRESHOLD - HYST_RANGE): + curr_thermal_level = 1 + elif (LEVEL2_THRESHOLD - HYST_RANGE) < system_temperature < LEVEL2_THRESHOLD: + curr_thermal_level = get_level_in_hystersis(curr_thermal_level, 1, 2) + elif LEVEL2_THRESHOLD <= system_temperature <= (LEVEL3_THRESHOLD - HYST_RANGE): + curr_thermal_level = 2 + elif (LEVEL3_THRESHOLD - HYST_RANGE) < system_temperature < LEVEL3_THRESHOLD: + curr_thermal_level = get_level_in_hystersis(curr_thermal_level, 2, 3) + elif LEVEL3_THRESHOLD <= system_temperature < LEVEL4_THRESHOLD: + curr_thermal_level = 3 + else: + curr_thermal_level = 4 + + return curr_thermal_level + + @staticmethod + def is_over_temperature(temperature_list): + + over_temperature = False + for temperature in temperature_list: + if temperature > LEVEL4_THRESHOLD: + over_temperature = True + break + + return over_temperature diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/eeprom.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/eeprom.py index 5afe0112441b..12b3cfae5606 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/eeprom.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/eeprom.py @@ -105,6 +105,7 @@ def _load_system_eeprom(self): self.part_number = 'NA' self.model_str = 'NA' self.serial = 'NA' + self.revision = 'NA' return total_length = (eeprom[9] << 8) | (eeprom[10]) @@ -142,6 +143,8 @@ def _load_system_eeprom(self): "0x%X" % (self._TLV_CODE_PRODUCT_NAME), 'NA') self.serial = self.eeprom_tlv_dict.get( "0x%X" % (self._TLV_CODE_SERVICE_TAG), 'NA') + self.revision = self.eeprom_tlv_dict.get( + "0x%X" % (self._TLV_CODE_LABEL_REVISION), 'NA') def _load_device_eeprom(self): """ @@ -154,6 +157,7 @@ def _load_device_eeprom(self): except: self.serial_number = 'NA' self.part_number = 'NA' + self.revision = 'NA' if self.is_psu_eeprom: self.psu_type = 'NA' else: @@ -167,9 +171,13 @@ def _load_device_eeprom(self): + "-" + ppid[16:]) (valid, data) = self._get_eeprom_field("DPN Rev") if valid: + self.revision = data self.serial_number += "-" + data + else: + self.revision = 'NA' else: self.serial_number = 'NA' + self.revision = 'NA' (valid, data) = self._get_eeprom_field("Part Number") if valid: @@ -219,6 +227,12 @@ def get_part_number(self): """ return self.part_number + def get_revision(self): + """ + Returns the hardware revision. + """ + return self.revision + def airflow_fan_type(self): """ Returns the airflow fan type. @@ -449,7 +463,7 @@ def get_part_number(self): (valid, data) = self._get_eeprom_field(self.eeprom_data, self._BLK_CODE_MFG, "Part Number") if valid: - return data + return data.rstrip('\x00') else: return 'NA' @@ -475,6 +489,17 @@ def get_serial_number(self): else: return 'NA' + def get_revision(self): + """ + Returns the hardware revision. + """ + (valid, data) = self._get_eeprom_field(self.eeprom_data, + self._BLK_CODE_MFG, "DPN Rev") + if valid: + return data + else: + return 'NA' + # EEPROM Plugin specific methods def is_checksum_valid(self, e): # Checksum is already calculated before diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/fan.py index 940c70cebede..68328a12a74f 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/fan.py @@ -16,9 +16,14 @@ except ImportError as e: raise ImportError(str(e) + "- required module not found") - MAX_S6000_PSU_FAN_SPEED = 18000 MAX_S6000_FAN_SPEED = 19000 +MAX_S6000_FAN_TARGET_SPEED = 18900 + +# Each element corresponds to required speed (in RPM) +# for a given system thermal level +THERMAL_LEVEL_PSU_FAN_SPEED = (7200, 10800, 14400, 16200, 18000) +THERMAL_LEVEL_FAN_SPEED = (7000, 10000, 13000, 16000, 19000) class Fan(FanBase): @@ -34,6 +39,7 @@ class Fan(FanBase): def __init__(self, fantray_index=1, fan_index=1, psu_index=1, psu_fan=False, dependency=None): FanBase.__init__(self) + self._target_speed = None self.is_psu_fan = psu_fan self.is_driver_initialized = True @@ -42,11 +48,18 @@ def __init__(self, fantray_index=1, fan_index=1, self.fantray_index = fantray_index self.index = fan_index self.dependency = dependency - self.get_fan_speed_reg = self.I2C_DIR +\ - "{}/fan{}_input".format(*self.FAN_DEV_MAPPING[fantray_index][fan_index]) - self.set_fan_speed_reg = self.I2C_DIR +\ - "{}/fan{}_target".format(*self.FAN_DEV_MAPPING[fantray_index][fan_index]) + + hwmon_dir = self.I2C_DIR +\ + "{}/hwmon/".format(self.FAN_DEV_MAPPING[fantray_index][fan_index][0]) + hwmon_node = os.listdir(hwmon_dir)[0] + self.fan_status_reg = hwmon_dir + hwmon_node +\ + "/fan{}_alarm".format(self.FAN_DEV_MAPPING[fantray_index][fan_index][1]) + self.get_fan_speed_reg = hwmon_dir + hwmon_node +\ + "/fan{}_input".format(self.FAN_DEV_MAPPING[fantray_index][fan_index][1]) + self.set_fan_speed_reg = hwmon_dir + hwmon_node +\ + "/fan{}_target".format(self.FAN_DEV_MAPPING[fantray_index][fan_index][1]) self.max_fan_speed = MAX_S6000_FAN_SPEED + self.thermal_level_to_speed = THERMAL_LEVEL_FAN_SPEED else: self.psu_index = psu_index self.index = 1 @@ -64,6 +77,7 @@ def __init__(self, fantray_index=1, fan_index=1, self.get_fan_speed_reg = hwmon_dir + hwmon_node + '/fan1_input' self.max_fan_speed = MAX_S6000_PSU_FAN_SPEED + self.thermal_level_to_speed = THERMAL_LEVEL_PSU_FAN_SPEED def _get_i2c_register(self, reg_file): # On successful read, returns the value read from given @@ -114,6 +128,31 @@ def _get_sysfs_path(self): self.get_fan_speed_reg = fan_speed_reg[0] self.is_driver_initialized = True + def _get_speed_to_percentage(self, speed): + speed_percent = (100 * speed) // self.max_fan_speed + return speed_percent if speed_percent <= 100 else 100 + + def _get_target_speed_rpm(self): + target_speed_rpm = self._get_i2c_register(self.set_fan_speed_reg) + if (target_speed_rpm != 'ERR') and self.get_presence(): + target_speed_rpm = int(target_speed_rpm, 10) + else: + target_speed_rpm = 0 + + return target_speed_rpm + + def _set_speed_rpm(self, speed): + if not self.is_psu_fan: + if speed > MAX_S6000_FAN_TARGET_SPEED: + speed = MAX_S6000_FAN_TARGET_SPEED + self._target_speed = speed + + rv = self._set_i2c_register(self.set_fan_speed_reg, speed) + if (rv != 'ERR'): + return True + else: + return False + def get_name(self): """ Retrieves the name of the Fan @@ -159,10 +198,17 @@ def get_status(self): bool: True if Fan is operating properly, False if not """ status = False - fan_speed = self._get_i2c_register(self.get_fan_speed_reg) - if (fan_speed != 'ERR'): - if (int(fan_speed) > 1000): - status = True + if self.is_psu_fan: + fan_speed = self._get_i2c_register(self.get_fan_speed_reg) + if (fan_speed != 'ERR'): + if (int(fan_speed) > 1000): + status = True + else: + fan_status = self._get_i2c_register(self.fan_status_reg) + if (fan_status != 'ERR'): + fan_status = int(fan_status, 10) + if ~fan_status & 0b1: + status = True return status @@ -214,8 +260,7 @@ def get_speed(self): """ fan_speed = self._get_i2c_register(self.get_fan_speed_reg) if (fan_speed != 'ERR') and self.get_presence(): - speed_in_rpm = int(fan_speed, 10) - speed = (100 * speed_in_rpm)//self.max_fan_speed + speed = self._get_speed_to_percentage(int(fan_speed, 10)) else: speed = 0 @@ -247,11 +292,7 @@ def set_speed(self, speed): bool: True if set success, False if fail. """ fan_set = (speed * self.max_fan_speed) // 100 - rv = self._set_i2c_register(self.set_fan_speed_reg, fan_set) - if (rv != 'ERR'): - return True - else: - return False + return self._set_speed_rpm(fan_set) def set_status_led(self, color): """ @@ -284,5 +325,26 @@ def get_target_speed(self): An integer, the percentage of full fan speed, in the range 0 (off) to 100 (full speed) """ - # Fan speeds are controlled by fancontrol.sh - return self.get_speed() + target_speed_rpm = self._get_target_speed_rpm() + + if not self.is_psu_fan and self._target_speed: + # Handle max6620 driver approximation + max6620_conv_factor = (60 * 8192 * 4) / 2 + expected_speed_rpm = max6620_conv_factor // (max6620_conv_factor // self._target_speed) + + if expected_speed_rpm == target_speed_rpm: + if self._target_speed >= MAX_S6000_FAN_TARGET_SPEED: + return 100 + else: + return self._get_speed_to_percentage(self._target_speed) + + return self._get_speed_to_percentage(target_speed_rpm) + + def set_speed_for_thermal_level(self, thermal_level): + + req_speed_rpm = self.thermal_level_to_speed[thermal_level] + req_speed = self._get_speed_to_percentage(req_speed_rpm) + target_speed = self.get_target_speed() + + if req_speed != target_speed: + self._set_speed_rpm(req_speed_rpm) diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/fan_drawer.py index 2e5e3446cd80..90298fdad015 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/fan_drawer.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/fan_drawer.py @@ -182,3 +182,13 @@ def get_status_led(self): return fantray_led else: return self.STATUS_LED_COLOR_OFF + + def get_maximum_consumed_power(self): + """ + Retrives the maximum power drawn by Fan Drawer + + Returns: + A float, with value of the maximum consumable power of the + component. + """ + return 18.0 diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/psu.py index e217c0a08c40..c7dea7dade94 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/psu.py @@ -161,6 +161,15 @@ def get_serial(self): # Sample Serial number format "US-01234D-54321-25A-0123-A00" return self.eeprom.get_serial_number() + def get_revision(self): + """ + Retrieves the hardware revision of the device + + Returns: + string: Revision value of device + """ + return self.eeprom.get_revision() + def get_status(self): """ Retrieves the operational status of the PSU @@ -248,6 +257,21 @@ def get_power(self): return psu_power + def get_maximum_supplied_power(self): + """ + Retrieves the maximum supplied power by PSU + + Returns: + A float number, the maximum power output in Watts. + e.g. 1200.1 + """ + if self.get_presence(): + psu_maxpower = 460.0 + else: + psu_maxpower = 0.0 + + return psu_maxpower + def get_powergood_status(self): """ Retrieves the powergood status of PSU diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/sfp.py index b66cb31ec96b..5a5439910dc3 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/sfp.py @@ -9,420 +9,86 @@ ############################################################################# try: - import re - import struct + import fcntl + import os import time - from sonic_platform_base.sfp_base import SfpBase - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase except ImportError as e: raise ImportError(str(e) + "- required module not found") +QSFP_INFO_OFFSET = 128 +SFP_LOCK_FILE="/etc/sonic/sfp_lock" -PAGE_OFFSET = 0 -KEY_OFFSET = 1 -KEY_WIDTH = 2 -FUNC_NAME = 3 - -INFO_OFFSET = 128 -DOM_OFFSET = 0 -DOM_OFFSET1 = 384 - -QSFP_CONTROL_OFFSET = 86 -QSFP_POWEROVERRIDE_OFFSET = 93 - -cable_length_tup = ('Length(km)', 'Length OM3(2m)', 'Length OM2(m)', - 'Length OM1(m)', 'Length Cable Assembly(m)') - -compliance_code_tup = ( - '10/40G Ethernet Compliance Code', - 'SONET Compliance codes', - 'SAS/SATA compliance codes', - 'Gigabit Ethernet Compliant codes', - 'Fibre Channel link length/Transmitter Technology', - 'Fibre Channel transmission media', - 'Fibre Channel Speed') - -info_dict_keys = ['type', 'hardware_rev', 'serial', - 'manufacturer', 'model', 'connector', - 'encoding', 'ext_identifier', 'ext_rateselect_compliance', - 'cable_type', 'cable_length', 'nominal_bit_rate', - 'specification_compliance', 'type_abbrv_name', 'vendor_date', - 'vendor_oui', 'application_advertisement'] - -dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', - 'power_lpmode', 'tx_disable', 'tx_disable_channel', - 'temperature', 'voltage', 'rx1power', - 'rx2power', 'rx3power', 'rx4power', - 'tx1bias', 'tx2bias', 'tx3bias', - 'tx4bias', 'tx1power', 'tx2power', - 'tx3power', 'tx4power'] - -threshold_dict_keys = ['temphighalarm', 'temphighwarning', - 'templowalarm', 'templowwarning', - 'vcchighalarm', 'vcchighwarning', - 'vcclowalarm', 'vcclowwarning', - 'rxpowerhighalarm', 'rxpowerhighwarning', - 'rxpowerlowalarm', 'rxpowerlowwarning', - 'txpowerhighalarm', 'txpowerhighwarning', - 'txpowerlowalarm', 'txpowerlowwarning', - 'txbiashighalarm', 'txbiashighwarning', - 'txbiaslowalarm', 'txbiaslowwarning'] - -sff8436_parser = { - 'reset_status': [DOM_OFFSET, 2, 1, 'parse_dom_status_indicator'], - 'rx_los': [DOM_OFFSET, 3, 1, 'parse_dom_tx_rx_los'], - 'tx_fault': [DOM_OFFSET, 4, 1, 'parse_dom_tx_fault'], - 'tx_disable': [DOM_OFFSET, 86, 1, 'parse_dom_tx_disable'], - 'power_lpmode': [DOM_OFFSET, 93, 1, 'parse_dom_power_control'], - 'power_override': [DOM_OFFSET, 93, 1, 'parse_dom_power_control'], - 'Temperature': [DOM_OFFSET, 22, 2, 'parse_temperature'], - 'Voltage': [DOM_OFFSET, 26, 2, 'parse_voltage'], - 'ChannelMonitor': [DOM_OFFSET, 34, 16, 'parse_channel_monitor_params'], - - 'cable_type': [INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'cable_length': [INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'connector': [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'type': [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'encoding': [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'ext_identifier': [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'ext_rateselect_compliance': - [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'nominal_bit_rate': [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'specification_compliance': - [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'type_abbrv_name': [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'manufacturer': [INFO_OFFSET, 20, 16, 'parse_vendor_name'], - 'vendor_oui': [INFO_OFFSET, 37, 3, 'parse_vendor_oui'], - 'model': [INFO_OFFSET, 40, 16, 'parse_vendor_pn'], - 'hardware_rev': [INFO_OFFSET, 56, 2, 'parse_vendor_rev'], - 'serial': [INFO_OFFSET, 68, 16, 'parse_vendor_sn'], - 'vendor_date': [INFO_OFFSET, 84, 8, 'parse_vendor_date'], - 'ModuleThreshold': [DOM_OFFSET1, 128, 24, 'parse_module_threshold_values'], - 'ChannelThreshold': [DOM_OFFSET1, 176, 16, 'parse_channel_threshold_values'], -} - - -class Sfp(SfpBase): + +class Sfp(SfpOptoeBase): """ DELLEMC Platform-specific Sfp class """ def __init__(self, index, sfp_type, eeprom_path, sfp_control, sfp_ctrl_idx): - SfpBase.__init__(self) + SfpOptoeBase.__init__(self) self.sfp_type = sfp_type self.index = index + 1 self.eeprom_path = eeprom_path self.sfp_control = sfp_control self.sfp_ctrl_idx = sfp_ctrl_idx - self.sfpInfo = sff8436InterfaceId() - self.sfpDomInfo = sff8436Dom() - def _read_eeprom_bytes(self, eeprom_path, offset, num_bytes): - eeprom_raw = [] - try: - eeprom = open(eeprom_path, mode="rb", buffering=0) - except IOError: - return None + def get_eeprom_path(self): + return self.eeprom_path - for i in range(0, num_bytes): - eeprom_raw.append("0x00") + def get_name(self): + return "QSFP+ or later" + def read_eeprom(self, offset, num_bytes): try: - eeprom.seek(offset) - raw = eeprom.read(num_bytes) - except IOError: - eeprom.close() + fd = open(SFP_LOCK_FILE, "r") + except IOError as e: + print("Error: unable to open file: %s" % str(e)) return None - - raw = bytearray(raw) try: - for n in range(0, num_bytes): - eeprom_raw[n] = hex(raw[n])[2:].zfill(2) - except BaseException: - eeprom.close() - return None - - eeprom.close() - return eeprom_raw - - def _get_eeprom_data(self, eeprom_key): - eeprom_data = None - page_offset = None - - if (self.sfpInfo is None): - return None - - page_offset = sff8436_parser[eeprom_key][PAGE_OFFSET] - eeprom_data_raw = self._read_eeprom_bytes( - self.eeprom_path, - (sff8436_parser[eeprom_key][PAGE_OFFSET] + - sff8436_parser[eeprom_key][KEY_OFFSET]), - sff8436_parser[eeprom_key][KEY_WIDTH]) - if (eeprom_data_raw is not None): - # Offset 128 is used to retrieve sff8436InterfaceId Info - # Offset 0 is used to retrieve sff8436Dom Info - if (page_offset == 128): - eeprom_data = getattr( - self.sfpInfo, sff8436_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - eeprom_data = getattr( - self.sfpDomInfo, sff8436_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - - return eeprom_data - - def _strip_unit_from_str(self, value_str): - match = re.match(r'(.*)C$|(.*)Volts$|(.*)mA$|(.*)dBm$', value_str) - if match: - for value in match.groups(): - if value is not None: - return float(value) - - return None - - def get_transceiver_info(self): - """ - Retrieves transceiver info of this SFP - """ - transceiver_info_dict = {} - compliance_code_dict = {} - transceiver_info_dict = dict.fromkeys(info_dict_keys, 'N/A') - - # BaseInformation - iface_data = self._get_eeprom_data('type') - if (iface_data is not None): - connector = iface_data['data']['Connector']['value'] - encoding = iface_data['data']['EncodingCodes']['value'] - ext_id = iface_data['data']['Extended Identifier']['value'] - rate_identifier = iface_data['data']['RateIdentifier']['value'] - identifier = iface_data['data']['type']['value'] - type_abbrv_name=iface_data['data']['type_abbrv_name']['value'] - bit_rate = str( - iface_data['data']['Nominal Bit Rate(100Mbs)']['value']) - - for key in compliance_code_tup: - if key in iface_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = iface_data['data']['Specification compliance']['value'][key]['value'] - for key in cable_length_tup: - if key in iface_data['data']: - cable_type = key - cable_length = str(iface_data['data'][key]['value']) - else: - return transceiver_info_dict - - # Vendor Date - vendor_date_data = self._get_eeprom_data('vendor_date') - if (vendor_date_data is not None): - vendor_date = vendor_date_data['data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] - else: + with open(self.get_eeprom_path(), mode='rb', buffering=0) as f: + fcntl.flock(fd, fcntl.LOCK_EX) + self.set_modsel() + f.seek(offset) + read_bytes=f.read(num_bytes) + fcntl.flock(fd, fcntl.LOCK_UN) + return bytearray(read_bytes) + except (OSError, IOError): return None - # Vendor Name - vendor_name_data = self._get_eeprom_data('manufacturer') - if (vendor_name_data is not None): - vendor_name = vendor_name_data['data']['Vendor Name']['value'] - else: - return transceiver_info_dict - - # Vendor OUI - vendor_oui_data = self._get_eeprom_data('vendor_oui') - if (vendor_oui_data is not None): - vendor_oui = vendor_oui_data['data']['Vendor OUI']['value'] - else: - return transceiver_info_dict - - # Vendor PN - vendor_pn_data = self._get_eeprom_data('model') - if (vendor_pn_data is not None): - vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] - else: - return transceiver_info_dict - - # Vendor Revision - vendor_rev_data = self._get_eeprom_data('hardware_rev') - if (vendor_rev_data is not None): - vendor_rev = vendor_rev_data['data']['Vendor Rev']['value'] - else: - return transceiver_info_dict - - # Vendor Serial Number - vendor_sn_data = self._get_eeprom_data('serial') - if (vendor_sn_data is not None): - vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] - else: - return transceiver_info_dict - - # Fill The Dictionary and return - transceiver_info_dict['type'] = identifier - transceiver_info_dict['hardware_rev'] = vendor_rev - transceiver_info_dict['serial'] = vendor_sn - transceiver_info_dict['manufacturer'] = vendor_name - transceiver_info_dict['model'] = vendor_pn - transceiver_info_dict['connector'] = connector - transceiver_info_dict['encoding'] = encoding - transceiver_info_dict['ext_identifier'] = ext_id - transceiver_info_dict['ext_rateselect_compliance'] = rate_identifier - transceiver_info_dict['cable_type'] = cable_type - transceiver_info_dict['cable_length'] = cable_length - transceiver_info_dict['nominal_bit_rate'] = bit_rate - transceiver_info_dict['specification_compliance'] = str( - compliance_code_dict) - transceiver_info_dict['vendor_date'] = vendor_date - transceiver_info_dict['vendor_oui'] = vendor_oui - transceiver_info_dict['type_abbrv_name'] = type_abbrv_name - - return transceiver_info_dict - - def get_transceiver_threshold_info(self): - """ - Retrieves transceiver threshold info of this SFP - """ - transceiver_dom_threshold_dict = {} - transceiver_dom_threshold_dict = dict.fromkeys( - threshold_dict_keys, 'N/A') - - # Module Threshold - module_threshold_data = self._get_eeprom_data('ModuleThreshold') - if (module_threshold_data is not None): - tempHighAlarm = module_threshold_data['data']['TempHighAlarm']['value'] - tempLowAlarm = module_threshold_data['data']['TempLowAlarm']['value'] - tempHighWarn = module_threshold_data['data']['TempHighWarning']['value'] - tempLowWarn = module_threshold_data['data']['TempLowWarning']['value'] - vccHighAlarm = module_threshold_data['data']['VccHighAlarm']['value'] - vccLowAlarm = module_threshold_data['data']['VccLowAlarm']['value'] - vccHighWarn = module_threshold_data['data']['VccHighWarning']['value'] - vccLowWarn = module_threshold_data['data']['VccLowWarning']['value'] - else: - return transceiver_dom_threshold_dict - - # Channel Threshold - channel_threshold_data = self._get_eeprom_data('ChannelThreshold') - if (channel_threshold_data is not None): - rxPowerHighAlarm = channel_threshold_data['data']['RxPowerHighAlarm']['value'] - rxPowerLowAlarm = channel_threshold_data['data']['RxPowerLowAlarm']['value'] - rxPowerHighWarn = channel_threshold_data['data']['RxPowerHighWarning']['value'] - rxPowerLowWarn = channel_threshold_data['data']['RxPowerLowWarning']['value'] - txBiasHighAlarm = channel_threshold_data['data']['TxBiasHighAlarm']['value'] - txBiasLowAlarm = channel_threshold_data['data']['TxBiasLowAlarm']['value'] - txBiasHighWarn = channel_threshold_data['data']['TxBiasHighWarning']['value'] - txBiasLowWarn = channel_threshold_data['data']['TxBiasLowWarning']['value'] - else: - return transceiver_dom_threshold_dict - - transceiver_dom_threshold_dict['temphighalarm'] = tempHighAlarm - transceiver_dom_threshold_dict['templowalarm'] = tempLowAlarm - transceiver_dom_threshold_dict['temphighwarning'] = tempHighWarn - transceiver_dom_threshold_dict['templowwarning'] = tempLowWarn - transceiver_dom_threshold_dict['vcchighalarm'] = vccHighAlarm - transceiver_dom_threshold_dict['vcclowalarm'] = vccLowAlarm - transceiver_dom_threshold_dict['vcchighwarning'] = vccHighWarn - transceiver_dom_threshold_dict['vcclowwarning'] = vccLowWarn - transceiver_dom_threshold_dict['rxpowerhighalarm'] = rxPowerHighAlarm - transceiver_dom_threshold_dict['rxpowerlowalarm'] = rxPowerLowAlarm - transceiver_dom_threshold_dict['rxpowerhighwarning'] = rxPowerHighWarn - transceiver_dom_threshold_dict['rxpowerlowwarning'] = rxPowerLowWarn - transceiver_dom_threshold_dict['txbiashighalarm'] = txBiasHighAlarm - transceiver_dom_threshold_dict['txbiaslowalarm'] = txBiasLowAlarm - transceiver_dom_threshold_dict['txbiashighwarning'] = txBiasHighWarn - transceiver_dom_threshold_dict['txbiaslowwarning'] = txBiasLowWarn - - return transceiver_dom_threshold_dict - - def get_transceiver_bulk_status(self): - """ - Retrieves transceiver bulk status of this SFP - """ - tx_bias_list = [] - rx_power_list = [] - transceiver_dom_dict = {} - transceiver_dom_dict = dict.fromkeys(dom_dict_keys, 'N/A') - - # RxLos - rx_los = self.get_rx_los() - - # TxFault - tx_fault = self.get_tx_fault() - - # ResetStatus - reset_state = self.get_reset_status() - - # LowPower Mode - lp_mode = self.get_lpmode() - - # TxDisable - tx_disable = self.get_tx_disable() - - # TxDisable Channel - tx_disable_channel = self.get_tx_disable_channel() - - # Temperature - temperature = self.get_temperature() - - # Voltage - voltage = self.get_voltage() - - # Channel Monitor - channel_monitor_data = self._get_eeprom_data('ChannelMonitor') - if (channel_monitor_data is not None): - tx_bias = channel_monitor_data['data']['TX1Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = channel_monitor_data['data']['TX2Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = channel_monitor_data['data']['TX3Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = channel_monitor_data['data']['TX4Bias']['value'] - tx_bias_list.append(tx_bias) - rx_power = channel_monitor_data['data']['RX1Power']['value'] - rx_power_list.append(rx_power) - rx_power = channel_monitor_data['data']['RX2Power']['value'] - rx_power_list.append(rx_power) - rx_power = channel_monitor_data['data']['RX3Power']['value'] - rx_power_list.append(rx_power) - rx_power = channel_monitor_data['data']['RX4Power']['value'] - rx_power_list.append(rx_power) - else: - return transceiver_dom_dict - - transceiver_dom_dict['rx_los'] = rx_los - transceiver_dom_dict['tx_fault'] = tx_fault - transceiver_dom_dict['reset_status'] = reset_state - transceiver_dom_dict['power_lpmode'] = lp_mode - transceiver_dom_dict['tx_disable'] = tx_disable - transceiver_dom_dict['tx_disable_channel'] = tx_disable_channel - transceiver_dom_dict['temperature'] = temperature - transceiver_dom_dict['voltage'] = voltage - transceiver_dom_dict['tx1bias'] = tx_bias_list[0] - transceiver_dom_dict['tx2bias'] = tx_bias_list[1] - transceiver_dom_dict['tx3bias'] = tx_bias_list[2] - transceiver_dom_dict['tx4bias'] = tx_bias_list[3] - transceiver_dom_dict['rx1power'] = rx_power_list[0] - transceiver_dom_dict['rx2power'] = rx_power_list[1] - transceiver_dom_dict['rx3power'] = rx_power_list[2] - transceiver_dom_dict['rx4power'] = rx_power_list[3] - - return transceiver_dom_dict - - def get_name(self): - """ - Retrieves the name of the sfp - Returns : QSFP or QSFP+ or QSFP28 - """ - iface_data = self._get_eeprom_data('type') - if (iface_data is not None): - identifier = iface_data['data']['type']['value'] - else: + def write_eeprom(self, offset, num_bytes, write_buffer): + try: + fd = open(SFP_LOCK_FILE, "r") + except IOError as e: + print("Error: unable to open file: %s" % str(e)) return None - return identifier + try: + with open(self.get_eeprom_path(), mode='r+b', buffering=0) as f: + fcntl.flock(fd, fcntl.LOCK_EX) + self.set_modsel() + f.seek(offset) + f.write(write_buffer[0:num_bytes]) + fcntl.flock(fd, fcntl.LOCK_UN) + except (OSError, IOError): + return False + return True def get_presence(self): """ Retrieves the presence of the sfp """ presence_ctrl = self.sfp_control + 'qsfp_modprs' + + try: + fd = open(SFP_LOCK_FILE, "r") + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + fcntl.flock(fd, fcntl.LOCK_EX) + self.set_modsel() + try: reg_file = open(presence_ctrl) except IOError as e: @@ -437,35 +103,68 @@ def get_presence(self): # Mask off the bit corresponding to our port mask = (1 << self.sfp_ctrl_idx) + fcntl.flock(fd, fcntl.LOCK_UN) + # ModPrsL is active low if ((reg_value & mask) == 0): return True return False - def get_model(self): - """ - Retrieves the model number (or part number) of the sfp - """ - vendor_pn_data = self._get_eeprom_data('model') - if (vendor_pn_data is not None): - vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] - else: - return None + def get_modsel(self): + modsel_ctrl = self.sfp_control + 'qsfp_modsel' + try: + reg_file = open(modsel_ctrl, "r+") + except IOError as e: + return False - return vendor_pn + reg_hex = reg_file.readline().rstrip() - def get_serial(self): - """ - Retrieves the serial number of the sfp - """ - vendor_sn_data = self._get_eeprom_data('serial') - if (vendor_sn_data is not None): - vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] + # content is a string containing the hex + # representation of the register + reg_value = int(reg_hex, 16) + + # Mask off the bit corresponding to our port + index = self.sfp_ctrl_idx + + mask = (1 << index) + + if ((reg_value & mask) == 1): + modsel_state = False else: - return None + modsel_state = True + + return modsel_state + + def set_modsel(self): + modsel_ctrl = self.sfp_control + 'qsfp_modsel' + try: + reg_file = open(modsel_ctrl, "r+") + except IOError as e: + return False + + reg_hex = reg_file.readline().rstrip() + + # content is a string containing the hex + # representation of the register + reg_value = int(reg_hex, 16) + + # Mask off the bit corresponding to our port + index = self.sfp_ctrl_idx + + reg_value = reg_value | int("0xffffffff", 16) + mask = (1 << index) - return vendor_sn + reg_value = (reg_value & ~mask) + + # Convert our register value back to a hex string and write back + content = hex(reg_value) + + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True def get_reset_status(self): """ @@ -496,112 +195,6 @@ def get_reset_status(self): return reset_status - def get_rx_los(self): - """ - Retrieves the RX LOS (lost-of-signal) status of SFP - """ - rx_los_list = [] - - rx_los_data = self._get_eeprom_data('rx_los') - if (rx_los_data is not None): - rx_los = rx_los_data['data']['Rx1LOS']['value'] - if (rx_los == 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - rx_los = rx_los_data['data']['Rx2LOS']['value'] - if (rx_los == 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - rx_los = rx_los_data['data']['Rx3LOS']['value'] - if (rx_los == 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - rx_los = rx_los_data['data']['Rx4LOS']['value'] - if (rx_los == 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - - return rx_los_list - - def get_tx_fault(self): - """ - Retrieves the TX fault status of SFP - """ - tx_fault_list = [] - - tx_fault_data = self._get_eeprom_data('tx_fault') - if (tx_fault_data is not None): - tx_fault = tx_fault_data['data']['Tx1Fault']['value'] - if (tx_fault == 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - tx_fault = tx_fault_data['data']['Tx2Fault']['value'] - if (tx_fault == 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - tx_fault = tx_fault_data['data']['Tx3Fault']['value'] - if (tx_fault == 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - tx_fault = tx_fault_data['data']['Tx4Fault']['value'] - if (tx_fault == 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - - return tx_fault_list - - def get_tx_disable(self): - """ - Retrieves the tx_disable status of this SFP - """ - tx_disable_list = [] - - tx_disable_data = self._get_eeprom_data('tx_disable') - if (tx_disable_data is not None): - tx_disable = tx_disable_data['data']['Tx1Disable']['value'] - if (tx_disable == 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - tx_disable = tx_disable_data['data']['Tx2Disable']['value'] - if (tx_disable == 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - tx_disable = tx_disable_data['data']['Tx3Disable']['value'] - if (tx_disable == 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - tx_disable = tx_disable_data['data']['Tx4Disable']['value'] - if (tx_disable == 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - - return tx_disable_list - - def get_tx_disable_channel(self): - """ - Retrieves the TX disabled channels in this SFP - """ - tx_disable_channel = 0 - - tx_disable = self.get_tx_disable() - for channel, disable in enumerate(tx_disable): - if disable: - tx_disable_channel |= 1 << channel - - return tx_disable_channel - def get_lpmode(self): """ Retrieves the lpmode (low power mode) status of this SFP @@ -630,90 +223,6 @@ def get_lpmode(self): return lpmode_state - def get_power_override(self): - """ - Retrieves the power-override status of this SFP - """ - power_override_state = None - - # Reset Status - power_override_data = self._get_eeprom_data('power_override') - if (power_override_data is not None): - power_override = power_override_data['data']['PowerOverRide']['value'] - if (power_override == 'On'): - power_override_state = True - else: - power_override_state = False - - return power_override_state - - def get_temperature(self): - """ - Retrieves the temperature of this SFP - """ - temperature = None - - temperature_data = self._get_eeprom_data('Temperature') - if (temperature_data is not None): - temperature = self._strip_unit_from_str(temperature_data['data']['Temperature']['value']) - - return temperature - - def get_voltage(self): - """ - Retrieves the supply voltage of this SFP - """ - voltage = None - - voltage_data = self._get_eeprom_data('Voltage') - if (voltage_data is not None): - voltage = self._strip_unit_from_str(voltage_data['data']['Vcc']['value']) - - return voltage - - def get_tx_bias(self): - """ - Retrieves the TX bias current of this SFP - """ - tx_bias_list = [] - - tx_bias_data = self._get_eeprom_data('ChannelMonitor') - if (tx_bias_data is not None): - tx_bias_list.append(self._strip_unit_from_str(tx_bias_data['data']['TX1Bias']['value'])) - tx_bias_list.append(self._strip_unit_from_str(tx_bias_data['data']['TX2Bias']['value'])) - tx_bias_list.append(self._strip_unit_from_str(tx_bias_data['data']['TX3Bias']['value'])) - tx_bias_list.append(self._strip_unit_from_str(tx_bias_data['data']['TX4Bias']['value'])) - - return tx_bias_list - - def get_rx_power(self): - """ - Retrieves the received optical power for this SFP - """ - rx_power_list = [] - - rx_power_data = self._get_eeprom_data('ChannelMonitor') - if (rx_power_data is not None): - rx_power_list.append(self._strip_unit_from_str(rx_power_data['data']['RX1Power']['value'])) - rx_power_list.append(self._strip_unit_from_str(rx_power_data['data']['RX2Power']['value'])) - rx_power_list.append(self._strip_unit_from_str(rx_power_data['data']['RX3Power']['value'])) - rx_power_list.append(self._strip_unit_from_str(rx_power_data['data']['RX4Power']['value'])) - - return rx_power_list - - def get_tx_power(self): - """ - Retrieves the TX power of this SFP - """ - tx_power_list = [] - - tx_power_list.append(float('-inf')) - tx_power_list.append(float('-inf')) - tx_power_list.append(float('-inf')) - tx_power_list.append(float('-inf')) - - return tx_power_list - def reset(self): """ Reset SFP and return all user module settings to their default srate. @@ -796,73 +305,6 @@ def set_lpmode(self, lpmode): return True - def tx_disable(self, tx_disable): - """ - Disable SFP TX for all channels - """ - eeprom = None - tx_disable_value = 0xf if tx_disable else 0x0 - - try: - eeprom = open(self.eeprom_path, "r+b") - eeprom.seek(QSFP_CONTROL_OFFSET) - eeprom.write(struct.pack('B', tx_disable_value)) - except IOError: - return False - finally: - if eeprom is not None: - eeprom.close() - time.sleep(0.01) - - return True - - def tx_disable_channel(self, channel, disable): - """ - Sets the tx_disable for specified SFP channels - """ - eeprom = None - current_state = self.get_tx_disable_channel() - - if disable: - tx_disable_value = current_state | channel - else: - tx_disable_value = current_state & (~channel) - - try: - eeprom = open(self.eeprom_path, "r+b") - eeprom.seek(QSFP_CONTROL_OFFSET) - eeprom.write(struct.pack('B', tx_disable_value)) - except IOError: - return False - finally: - if eeprom is not None: - eeprom.close() - time.sleep(0.01) - - return True - - def set_power_override(self, power_override, power_set): - """ - Sets SFP power level using power_override and power_set - """ - eeprom = None - power_override_bit = 0x1 if power_override else 0 - power_set_bit = 0x2 if power_set else 0 - value = power_override_bit | power_set_bit - - try: - eeprom = open(self.eeprom_path, "r+b") - eeprom.seek(QSFP_POWEROVERRIDE_OFFSET) - eeprom.write(struct.pack('B', value)) - except IOError: - return False - finally: - if eeprom is not None: - eeprom.close() - time.sleep(0.01) - - return True - def get_status(self): """ Retrieves the operational status of the device @@ -892,3 +334,27 @@ def is_replaceable(self): bool: True if it is replaceable. """ return True + + def get_error_description(self): + """ + Retrives the error descriptions of the SFP module + + Returns: + String that represents the current error descriptions of vendor specific errors + In case there are multiple errors, they should be joined by '|', + like: "Bad EEPROM|Unsupported cable" + """ + if not self.get_presence(): + return self.SFP_STATUS_UNPLUGGED + else: + if not os.path.isfile(self.eeprom_path): + return "EEPROM driver is not attached" + + try: + with open(self.eeprom_path, mode="rb", buffering=0) as eeprom: + eeprom.seek(QSFP_INFO_OFFSET) + eeprom.read(1) + except OSError as e: + return "EEPROM read failed ({})".format(e.strerror) + + return self.SFP_STATUS_OK diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/thermal.py index bfb1385a9f05..bc275d729a62 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/thermal.py @@ -101,13 +101,27 @@ def _read_sysfs_file(self, sysfs_file): try: with open(sysfs_file, 'r') as fd: rv = fd.read() - except: + except Exception: rv = 'ERR' rv = rv.rstrip('\r\n') rv = rv.lstrip(" ") return rv + def _write_sysfs_file(self, sysfs_file, value): + rv = 'ERR' + + if (not os.path.isfile(sysfs_file)): + return rv + + try: + with open(sysfs_file, 'w') as fd: + rv = fd.write(str(value)) + except Exception as e: + rv = 'ERR' + + return rv + def _get_sysfs_path(self): temperature_path = glob.glob(self.thermal_temperature_file) high_threshold_path = glob.glob(self.thermal_high_threshold_file) @@ -243,18 +257,28 @@ def get_low_threshold(self): return thermal_low_threshold / 1000.0 - def set_high_threshold(self, temperature): + def set_high_threshold(self, temperature, force=False): """ Sets the high threshold temperature of thermal Args : temperature: A float number up to nearest thousandth of one degree Celsius, e.g. 30.125 + force (optional): A boolean, True if set threshold. Only to + be used via thermal Manager. Returns: A boolean, True if threshold is set successfully, False if not """ # Thermal threshold values are pre-defined based on HW. + # Only to be used by Thermal Manager + if force and self.index <= 3 and (80 <= temperature <=85): + high_threshold = temperature * 1000 + result = self._write_sysfs_file(self.thermal_high_threshold_file, + high_threshold) + if result != 'ERR': + return True + return False def set_low_threshold(self, temperature): diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/thermal_action.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/thermal_action.py new file mode 100644 index 000000000000..c4ea4023ac32 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/thermal_action.py @@ -0,0 +1,105 @@ +from sonic_platform_base.sonic_thermal_control.thermal_action_base import ThermalPolicyActionBase +from sonic_platform_base.sonic_thermal_control.thermal_json_object import thermal_json_object +from sonic_py_common.logger import Logger + +logger = Logger() + +class ThermalPolicyAction(ThermalPolicyActionBase): + + @staticmethod + def get_chassis_info(thermal_info_dict): + from .thermal_info import ChassisInfo + + chassis_info = thermal_info_dict.get(ChassisInfo.INFO_NAME) + return chassis_info if isinstance(chassis_info, ChassisInfo) else None + + @staticmethod + def get_fandrawer_info(thermal_info_dict): + from .thermal_info import FanDrawerInfo + + fandrawer_info = thermal_info_dict.get(FanDrawerInfo.INFO_NAME) + return fandrawer_info if isinstance(fandrawer_info, FanDrawerInfo) else None + + @staticmethod + def get_psu_fan_info(thermal_info_dict): + from .thermal_info import PsuFanInfo + + psu_fan_info = thermal_info_dict.get(PsuFanInfo.INFO_NAME) + return psu_fan_info if isinstance(psu_fan_info, PsuFanInfo) else None + +@thermal_json_object('fandrawer.fault.set_status_led') +class SetFanDrawerFaultStatusLed(ThermalPolicyAction): + + def execute(self, thermal_info_dict): + fandrawer_info = self.get_fandrawer_info(thermal_info_dict) + if fandrawer_info and fandrawer_info.is_status_changed: + for fandrawer in fandrawer_info.fault_fandrawers: + if fandrawer.get_status_led() != 'amber': + fandrawer.set_status_led('amber') + + +@thermal_json_object('fandrawer.normal.set_status_led') +class SetFanDrawerNormalStatusLed(ThermalPolicyAction): + + def execute(self, thermal_info_dict): + fandrawer_info = self.get_fandrawer_info(thermal_info_dict) + if fandrawer_info and fandrawer_info.is_status_changed: + for fandrawer in fandrawer_info.non_fault_fandrawers: + if fandrawer.get_status_led() != 'green': + fandrawer.set_status_led('green') + + +@thermal_json_object('fan.all.set_max_speed') +class SetAllFanMaxSpeedAction(ThermalPolicyAction): + def execute(self, thermal_info_dict): + fandrawer_info = self.get_fandrawer_info(thermal_info_dict) + psu_fan_info = self.get_psu_fan_info(thermal_info_dict) + + if fandrawer_info: + if fandrawer_info.is_status_changed and fandrawer_info.is_new_fault: + logger.log_warning("Fandrawer fault detected. Setting all fans to maximum speed") + + for fan in fandrawer_info.non_fault_fans: + fan.set_speed(100) + + if psu_fan_info: + for fan in psu_fan_info.present_fans: + fan.set_speed(100) + + +@thermal_json_object('fan.all.set_thermal_level_speed') +class SetAllFanThermalLevelSpeedAction(ThermalPolicyAction): + def execute(self, thermal_info_dict): + + chassis_info = self.get_chassis_info(thermal_info_dict) + fandrawer_info = self.get_fandrawer_info(thermal_info_dict) + psu_fan_info = self.get_psu_fan_info(thermal_info_dict) + + if chassis_info: + if chassis_info.is_status_changed: + if chassis_info.initial_run: + logger.log_notice("System thermal level is at LEVEL{}".format(chassis_info.system_thermal_level)) + else: + logger.log_notice("System thermal level changed to LEVEL{}".format(chassis_info.system_thermal_level)) + + if fandrawer_info: + if fandrawer_info.is_status_changed and not chassis_info.initial_run: + logger.log_notice("All fandrawers back to normal") + + for fan in fandrawer_info.non_fault_fans: + fan.set_speed_for_thermal_level(chassis_info.system_thermal_level) + + if psu_fan_info: + for fan in psu_fan_info.present_fans: + fan.set_speed_for_thermal_level(chassis_info.system_thermal_level) + + +@thermal_json_object('chassis.thermal_shutdown') +class ThermalShutdownAction(ThermalPolicyAction): + def execute(self, thermal_info_dict): + + chassis_info = self.get_chassis_info(thermal_info_dict) + if chassis_info: + logger.log_warning("Shutting down due to over temperature - " + + ",".join("{} C".format(i) for i in chassis_info.temperature_list)) + chassis_info.chassis.thermal_shutdown() diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/thermal_condition.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/thermal_condition.py new file mode 100644 index 000000000000..fd54eee28801 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/thermal_condition.py @@ -0,0 +1,35 @@ +from sonic_platform_base.sonic_thermal_control.thermal_condition_base import ThermalPolicyConditionBase +from sonic_platform_base.sonic_thermal_control.thermal_json_object import thermal_json_object + + +class FanDrawerCondition(ThermalPolicyConditionBase): + + @staticmethod + def get_fandrawer_info(thermal_info_dict): + from .thermal_info import FanDrawerInfo + + fandrawer_info = thermal_info_dict.get(FanDrawerInfo.INFO_NAME) + return fandrawer_info if isinstance(fandrawer_info, FanDrawerInfo) else None + + +@thermal_json_object('fandrawer.any.fault') +class AnyFanDrawerAbsentOrFaultCondition(FanDrawerCondition): + def is_match(self, thermal_info_dict): + fandrawer_info = self.get_fandrawer_info(thermal_info_dict) + return fandrawer_info.fault if fandrawer_info else False + +@thermal_json_object('fandrawer.all.normal') +class AllFanDrawerGoodCondition(FanDrawerCondition): + def is_match(self, thermal_info_dict): + fandrawer_info = self.get_fandrawer_info(thermal_info_dict) + return not fandrawer_info.fault if fandrawer_info else False + +@thermal_json_object('chassis.over_temperature') +class OverTemperatureCondition(ThermalPolicyConditionBase): + + @staticmethod + def is_match(thermal_info_dict): + from .thermal_info import ChassisInfo + + chassis_info = thermal_info_dict.get(ChassisInfo.INFO_NAME) + return chassis_info.is_over_temperature if isinstance(chassis_info, ChassisInfo) else False diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/thermal_info.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/thermal_info.py new file mode 100644 index 000000000000..1ea7b1637bf6 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/thermal_info.py @@ -0,0 +1,189 @@ +from sonic_platform_base.sonic_thermal_control.thermal_info_base import ThermalPolicyInfoBase +from sonic_platform_base.sonic_thermal_control.thermal_json_object import thermal_json_object + + +@thermal_json_object('chassis_info') +class ChassisInfo(ThermalPolicyInfoBase): + """ + Chassis information needed by thermal policy + """ + INFO_NAME = 'chassis_info' + + def __init__(self): + self._chassis = None + self._temperature_list = [] + self._thermal_list = [] + self._system_thermal_level = 0 + self._initial_run = False + self._is_over_temperature = False + self._is_status_changed = False + + def collect(self, chassis): + """ + Collect platform chassis. + :param chassis: The chassis object + :return: + """ + self._initial_run = False + self._is_status_changed = False + self._temperature_list = [] + + if not self._chassis: + self._initial_run = True + self._chassis = chassis + self._thermal_list = chassis.get_monitor_thermals() + + for thermal in self._thermal_list: + self._temperature_list.append(thermal.get_temperature()) + + system_temperature = sum(self._temperature_list) / len(self._temperature_list) + curr_level = chassis.get_system_thermal_level(self._system_thermal_level, + system_temperature) + if curr_level != self._system_thermal_level: + self._is_status_changed = True + self._system_thermal_level = curr_level + + self._is_over_temperature = chassis.is_over_temperature(self._temperature_list) + + @property + def chassis(self): + return self._chassis + + @property + def initial_run(self): + return self._initial_run + + @property + def is_over_temperature(self): + return self._is_over_temperature + + @property + def is_status_changed(self): + return self._is_status_changed + + @property + def system_thermal_level(self): + return self._system_thermal_level + + @property + def temperature_list(self): + return self._temperature_list + + +@thermal_json_object('fandrawer_info') +class FanDrawerInfo(ThermalPolicyInfoBase): + + INFO_NAME = 'fandrawer_info' + + def __init__(self): + self._fault_fandrawers = set() + self._present_fandrawers = set() + self._fault_fans = set() + self._present_fans = set() + self._fault = False + self._is_new_fault = False + self._is_status_changed = False + + def collect(self, chassis): + """ + Collect fan information for thermal policy. + :param chassis: The chassis object. + :return: + """ + fault = False + self._is_new_fault = False + self._is_status_changed = False + for fandrawer in chassis.get_all_fan_drawers(): + presence = fandrawer.get_presence() + + if presence and (fandrawer not in self._present_fandrawers): + self._is_status_changed = True + self._present_fandrawers.add(fandrawer) + self._present_fans.update(fandrawer.get_all_fans()) + elif not presence and (fandrawer in self._present_fandrawers): + self._is_status_changed = True + self._present_fandrawers.discard(fandrawer) + self._present_fans.difference_update(fandrawer.get_all_fans()) + + fan_fault = False + for fan in fandrawer.get_all_fans(): + status = fan.get_status() + fan_fault |= not status + + if status and (fan in self._fault_fans): + self._is_status_changed = True + self._fault_fans.discard(fan) + elif not status and (fan not in self._fault_fans): + self._is_status_changed = True + self._fault_fans.add(fan) + + if self._is_status_changed: + if fan_fault and (fandrawer not in self._fault_fandrawers): + self._fault_fandrawers.add(fandrawer) + elif not fan_fault: + self._fault_fandrawers.discard(fandrawer) + + if self._fault_fans or (chassis.get_num_fans() != len(self._present_fans)): + fault = True + + if self._is_status_changed: + if fault and not self._fault: + self._is_new_fault = True + + self._fault = fault + + @property + def fault_fans(self): + return self._present_fans.intersection(self._fault_fans) + + @property + def non_fault_fans(self): + return self._present_fans.difference(self._fault_fans) + + @property + def fault_fandrawers(self): + return self._present_fandrawers.intersection(self._fault_fandrawers) + + @property + def non_fault_fandrawers(self): + return self._present_fandrawers.difference(self._fault_fandrawers) + + @property + def fault(self): + return self._fault + + @property + def is_new_fault(self): + return self._is_new_fault + + @property + def is_status_changed(self): + return self._is_status_changed + + +@thermal_json_object('psu_fan_info') +class PsuFanInfo(ThermalPolicyInfoBase): + + INFO_NAME = 'psu_fan_info' + + def __init__(self): + self._present_fans = set() + + def collect(self, chassis): + """ + Collect fan information for thermal policy. + :param chassis: The chassis object. + :return: + """ + for psu in chassis.get_all_psus(): + for fan in psu.get_all_fans(): + presence = fan.get_presence() + + if presence and (fan not in self._present_fans): + self._present_fans.add(fan) + elif not presence and (fan in self._present_fans): + self._present_fans.discard(fan) + + @property + def present_fans(self): + return self._present_fans diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/thermal_manager.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/thermal_manager.py new file mode 100644 index 000000000000..de292da7f2ca --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/thermal_manager.py @@ -0,0 +1,63 @@ +from sonic_platform_base.sonic_thermal_control.thermal_manager_base import ThermalManagerBase + +from .thermal_action import ( + SetAllFanMaxSpeedAction, SetAllFanThermalLevelSpeedAction, + SetFanDrawerFaultStatusLed, SetFanDrawerNormalStatusLed, + ThermalShutdownAction +) +from .thermal_condition import ( + AllFanDrawerGoodCondition, AnyFanDrawerAbsentOrFaultCondition, + OverTemperatureCondition +) +from .thermal_info import ChassisInfo, FanDrawerInfo, PsuFanInfo + + +class ThermalManager(ThermalManagerBase): + + _chassis = None + _fan_speed_default = 80 + + @classmethod + def deinitialize(cls): + """ + Destroy thermal manager, including any vendor specific cleanup. + :return: + """ + cls.stop_thermal_algorithm() + + @classmethod + def init_thermal_algorithm(cls, chassis): + """ + Initialize thermal algorithm according to policy file. + :param chassis: The chassis object. + :return: + """ + if cls._chassis is None: + cls._chassis = chassis + + cls.start_thermal_algorithm() + + @classmethod + def start_thermal_algorithm(cls): + """ + Start vendor specific thermal control algorithm. + :return: + """ + if cls._chassis: + cls._chassis.set_fan_control_status(True) + + @classmethod + def stop_thermal_algorithm(cls): + """ + Stop vendor specific thermal control algorithm. + :return: + """ + if cls._chassis: + cls._chassis.set_fan_control_status(False) + + for fan in cls._chassis.get_all_fans(): + fan.set_speed(cls._fan_speed_default) + + for psu in cls._chassis.get_all_psus(): + for fan in psu.get_all_fans(): + fan.set_speed(cls._fan_speed_default) diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/systemd/fancontrol.service b/platform/broadcom/sonic-platform-modules-dell/s6000/systemd/fancontrol.service deleted file mode 100644 index 75cc977b9935..000000000000 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/systemd/fancontrol.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Dell S6000 fan speed regulator -After=platform-modules-s6000.service -Before=pmon.service - -[Service] -ExecStart=-/usr/local/bin/fancontrol.sh -Restart=always -RestartSec=30 - -[Install] -WantedBy=multi-user.target - diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/fast-reboot_plugin b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/fast-reboot_plugin index 683dcc6733ae..20a5d8cf5ac2 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/fast-reboot_plugin +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/fast-reboot_plugin @@ -8,4 +8,4 @@ fi io_rd_wr.py --set --val 40 --offset 0x131 io_rd_wr.py --set --val 06 --offset 210; io_rd_wr.py --set --val 0B --offset 211; io_rd_wr.py --set --val aa --offset 213 -/usr/local/bin/s6100_i2c_enumeration.sh deinit & > /dev/null +/usr/local/bin/s6100_platform_startup.sh deinit & > /dev/null diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_fw_au_reboot_handle b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_fw_au_reboot_handle new file mode 100755 index 000000000000..438674d2428a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_fw_au_reboot_handle @@ -0,0 +1,61 @@ +#!/bin/bash + +DEVPATH="/usr/share/sonic/device/x86_64-dell_s6100_c2538-r0" + +BIOS_FW_UPGRADE="$DEVPATH/bios-fw-upgrade" +FPGA_FW_UPGRADE="$DEVPATH/smf-fw-upgrade" +CPLD_FW_UPGRADE="$DEVPATH/cpld-fw-upgrade" +SSD_FW_UPGRADE="$DEVPATH/ssd-fw-upgrade" + +execute_upgrade() { + case $1 in + BIOS) + if [ -x ${BIOS_FW_UPGRADE} ];then + ${BIOS_FW_UPGRADE} $BOOT + fi + ;; + FPGA) + if [ -x ${SMF_FW_UPGRADE} ];then + ${SMF_FW_UPGRADE} $BOOT + fi + ;; + CPLD) + if [ -x ${CPLD_FW_UPGRADE} ];then + ${CPLD_FW_UPGRADE} $BOOT + fi + ;; + SSD) + if [ -x ${SSD_FW_UPGRADE} ];then + ${SSD_FW_UPGRADE} $BOOT + fi + ;; + *) + esac +} + + +parse() { + if [ -f ${TASK_FILE} ];then + while IFS= read -r line; do + execute_upgrade $line + done < $TASK_FILE + fi +} + +case "$1" in + fast-reboot) + TASK_FILE="/tmp/firmwareupdate/fast_fw_au_task" + ;; + warm-reboot) + TASK_FILE="/tmp/firmwareupdate/warm_fw_au_task" + ;; + reboot) + TASK_FILE="/tmp/firmwareupdate/cold_fw_au_task" + ;; + *) + echo "Usage: $0 {fast-reboot|warm-reboot|reboot}" >&2 + exit 2 +esac +BOOT=$1 +parse + diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/reboot_plugin b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/reboot_plugin index 4ccfecdfe2af..84b525fe6bac 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/reboot_plugin +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/reboot_plugin @@ -5,4 +5,4 @@ if [[ -d /sys/devices/platform/SMF.512/hwmon/ ]]; then echo 0xcc > mb_poweron_reason fi -/usr/local/bin/s6100_i2c_enumeration.sh deinit & > /dev/null +/usr/local/bin/s6100_platform_startup.sh deinit & > /dev/null diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh index 39c9074d5f52..15763bbc9e36 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform.sh @@ -2,32 +2,11 @@ #platform init script for Dell S6100 -install_python_api_package() { - device="/usr/share/sonic/device" - platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) - - rv=$(pip install $device/$platform/sonic_platform-1.0-py2-none-any.whl) - rv=$(pip3 install $device/$platform/sonic_platform-1.0-py3-none-any.whl) -} - -remove_python_api_package() { - rv=$(pip show sonic-platform > /dev/null 2>/dev/null) - if [ $? -eq 0 ]; then - rv=$(pip uninstall -y sonic-platform > /dev/null 2>/dev/null) - fi - - rv=$(pip3 show sonic-platform > /dev/null 2>/dev/null) - if [ $? -eq 0 ]; then - rv=$(pip3 uninstall -y sonic-platform > /dev/null 2>/dev/null) - fi -} - - if [[ "$1" == "init" ]]; then pericom="/sys/bus/pci/devices/0000:08:00.0" modprobe i2c-dev - modprobe i2c-mux-pca954x force_deselect_on_exit=1 + modprobe i2c-mux-pca954x modprobe dell_ich modprobe dell_s6100_iom_cpld modprobe dell_s6100_lpc @@ -45,19 +24,31 @@ if [[ "$1" == "init" ]]; then systemctl start --no-block s6100-ssd-upgrade-status.service - is_fast_warm=$(cat /proc/cmdline | grep SONIC_BOOT_TYPE | wc -l) - - if [[ "$is_fast_warm" == "1" ]]; then - systemctl start --no-block s6100-i2c-enumerate.service + case "$(cat /proc/cmdline)" in + *SONIC_BOOT_TYPE=warm*) + TYPE='warm' + ;; + *SONIC_BOOT_TYPE=fastfast*) + TYPE='fastfast' + ;; + *SONIC_BOOT_TYPE=fast*|*fast-reboot*) + TYPE='fast' + ;; + *SONIC_BOOT_TYPE=soft*) + TYPE='soft' + ;; + *) + TYPE='cold' + esac + + if [[ "$TYPE" == "cold" ]]; then + systemctl start s6100-platform-startup.service else - systemctl start s6100-i2c-enumerate.service + systemctl start --no-block s6100-platform-startup.service fi - install_python_api_package - monit reload - elif [[ "$1" == "deinit" ]]; then - /usr/local/bin/s6100_i2c_enumeration.sh deinit + /usr/local/bin/s6100_platform_startup.sh deinit modprobe -r dell_s6100_lpc modprobe -r dell_s6100_iom_cpld @@ -65,7 +56,6 @@ elif [[ "$1" == "deinit" ]]; then modprobe -r i2c-dev modprobe -r dell_ich modprobe -r nvram - remove_python_api_package else echo "s6100_platform : Invalid option !" fi diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_i2c_enumeration.sh b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform_startup.sh similarity index 89% rename from platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_i2c_enumeration.sh rename to platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform_startup.sh index d00fec233eaa..d6f6d74cf290 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_i2c_enumeration.sh +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/s6100_platform_startup.sh @@ -1,9 +1,22 @@ #!/bin/bash -### DellEMC S6100 I2C MUX Enumeration script +### DellEMC S6100 Platform Startup script source dell_i2c_utils.sh +install_python_api_package() { + device="/usr/share/sonic/device" + platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) + rv=$(pip3 install $device/$platform/sonic_platform-1.0-py3-none-any.whl) +} + +remove_python_api_package() { + rv=$(pip3 show sonic-platform > /dev/null 2>/dev/null) + if [ $? -eq 0 ]; then + rv=$(pip3 uninstall -y sonic-platform > /dev/null 2>/dev/null) + fi +} + init_devnum() { found=0 for devnum in 0 1; do @@ -292,6 +305,20 @@ if [[ "$1" == "init" ]]; then switch_board_qsfp_lpmode "disable" /usr/local/bin/s6100_bitbang_reset.sh xcvr_presence_interrupts "enable" + + echo -2 > /sys/bus/i2c/drivers/pca954x/0-0070/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/4-0071/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/6-0071/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/6-0072/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/7-0071/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/7-0072/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/8-0071/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/8-0072/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/9-0071/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/9-0072/idle_state + + install_python_api_package + monit reload elif [[ "$1" == "deinit" ]]; then xcvr_presence_interrupts "disable" switch_board_sfp "delete_device" @@ -302,4 +329,6 @@ elif [[ "$1" == "deinit" ]]; then switch_board_qsfp "delete_device" switch_board_qsfp_mux "delete_device" cpu_board_mux "delete_device" + + remove_python_api_package fi diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/track_reboot_reason.sh b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/track_reboot_reason.sh index 691b63a4a7e9..5dbb3e4c9e90 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/track_reboot_reason.sh +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/scripts/track_reboot_reason.sh @@ -15,6 +15,7 @@ MAILBOX_POWERON_REASON=/sys/devices/platform/SMF.512/hwmon/*/mb_poweron_reason NVRAM_DEVICE_FILE=/dev/nvram RESET_REASON_FILE=/host/reboot-cause/platform/reset_reason SMF_DIR=/sys/devices/platform/SMF.512/hwmon/ +TCO_RESET_NVRAM_OFFSET=0x59 while [[ ! -d $SMF_DIR ]] do @@ -27,6 +28,7 @@ do done SMF_RESET=$(cat $SMF_RESET_REASON) +TCO_WD_RESET=0 if [[ -d /host/reboot-cause/platform ]]; then reboot_dir_found=true @@ -80,6 +82,18 @@ _get_smf_reset_register(){ echo "Fourth reset - $fourth_reset" >> $RESET_REASON_FILE fi logger -p user.info -t DELL_S6100_REBOOT_CAUSE "RST value in NVRAM: $first_reset, $second_reset, $third_reset, $fourth_reset" + + if [[ $BIOS_VERSION_MINOR -gt 8 ]]; then + # Retrieve TCO reset status + tco_nvram=$((16#$(nvram_rd_wr.py --get --offset $TCO_RESET_NVRAM_OFFSET | cut -d " " -f 2))) + TCO_WD_RESET=$(($tco_nvram & 1)) + logger -p user.info -t DELL_S6100_REBOOT_CAUSE "TCO status value in NVRAM: $TCO_WD_RESET" + + # Clear TCO reset status in NVRAM + tco_nvram=$(printf "%x" $(($tco_nvram & 0xfe))) + nvram_rd_wr.py --set --val $tco_nvram --offset $TCO_RESET_NVRAM_OFFSET + fi + # Clearing NVRAM values to holding next reset values nvram_rd_wr.py --set --val 0xee --offset 0x58 nvram_rd_wr.py --set --val 0xee --offset 0x5c @@ -183,7 +197,9 @@ update_mailbox_register(){ && [[ $SMF_MSS_VERSION_MAJOR -ge 2 ]] && [[ $SMF_MSS_VERSION_MINOR -ge 7 ]] \ && [[ $SMF_FPGA_VERSION_MAJOR -ge 1 ]] && [[ $SMF_FPGA_VERSION_MINOR -ge 4 ]]; then - if [[ $reason = "cc" ]]; then + if [[ $TCO_WD_RESET = 1 ]]; then + echo 0xdd > $MAILBOX_POWERON_REASON + elif [[ $reason = "cc" ]]; then _is_software_reboot elif [[ $SMF_RESET = "11" ]]; then echo 0xee > $MAILBOX_POWERON_REASON @@ -206,6 +222,8 @@ update_mailbox_register(){ echo 0xee > $MAILBOX_POWERON_REASON elif [[ $is_wd_reboot = 1 ]] && [[ $reason != "cc" ]]; then echo 0xdd > $MAILBOX_POWERON_REASON + elif [[ $TCO_WD_RESET = 1 ]]; then + echo 0xdd > $MAILBOX_POWERON_REASON elif [[ $reason = "cc" ]]; then _is_software_reboot else diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py index 7f07739e7df0..47e63f52a17d 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py @@ -10,16 +10,17 @@ try: import os + import re + import time from sonic_platform_base.chassis_base import ChassisBase - from sonic_platform.sfp import Sfp - from sonic_platform.psu import Psu + from sonic_platform.component import Component + from sonic_platform.eeprom import Eeprom from sonic_platform.fan_drawer import FanDrawer from sonic_platform.module import Module + from sonic_platform.psu import Psu from sonic_platform.thermal import Thermal - from sonic_platform.component import Component - from sonic_platform.watchdog import Watchdog - from sonic_platform.eeprom import Eeprom - import time + from sonic_platform.watchdog import Watchdog, WatchdogTCO + from sonic_platform.sfp import Sfp except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -27,7 +28,7 @@ MAX_S6100_FANTRAY = 4 MAX_S6100_PSU = 2 MAX_S6100_THERMAL = 10 -MAX_S6100_COMPONENT = 3 +MAX_S6100_COMPONENT = 4 class Chassis(ChassisBase): @@ -76,6 +77,15 @@ def __init__(self): self._module_list.append(module) self._sfp_list.extend(module._sfp_list) + #SFP ports + sfp_port = 11 + for index in range(64,66): + eeprom_path = "/sys/bus/i2c/devices/i2c-{0}/{0}-0050/eeprom".format(sfp_port) + sfp_control = "" + sfp_node = Sfp(index, 'SFP', eeprom_path, sfp_control, index) + self._sfp_list.append(sfp_node) + sfp_port = sfp_port + 1 + for i in range(MAX_S6100_FANTRAY): fandrawer = FanDrawer(i) self._fan_drawer_list.append(fandrawer) @@ -93,7 +103,13 @@ def __init__(self): component = Component(i) self._component_list.append(component) - self._watchdog = Watchdog() + bios_ver = self.get_component(0).get_firmware_version() + bios_minor_ver = bios_ver.split("-")[-1] + if bios_minor_ver.isdigit() and (int(bios_minor_ver) >= 9): + self._watchdog = WatchdogTCO() + else: + self._watchdog = Watchdog() + self._transceiver_presence = self._get_transceiver_presence() def _get_reboot_reason_smf_register(self): @@ -229,6 +245,15 @@ def get_base_mac(self): """ return self._eeprom.base_mac_addr() + def get_revision(self): + """ + Retrieves the hardware revision of the device + + Returns: + string: Revision value of device + """ + return self._eeprom.revision_str() + def get_system_eeprom_info(self): """ Retrieves the full content of system EEPROM information for the chassis @@ -239,6 +264,19 @@ def get_system_eeprom_info(self): """ return self._eeprom.system_eeprom_info() + def get_module_index(self, module_name): + """ + Retrieves module index from the module name + + Args: + module_name: A string, prefixed by SUPERVISOR, LINE-CARD or FABRIC-CARD + Ex. SUPERVISOR0, LINE-CARD1, FABRIC-CARD5 + Returns: + An integer, the index of the ModuleBase object in the module_list + """ + module_index = re.match(r'IOM([1-4])', module_name).group(1) + return int(module_index) - 1 + def get_reboot_cause(self): """ Retrieves the cause of the previous reboot diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/component.py index 2e916488123d..a50028d3cb5a 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/component.py @@ -10,13 +10,19 @@ ######################################################################## try: + import json import os + import re import subprocess + import tarfile from sonic_platform_base.component_base import ComponentBase except ImportError as e: raise ImportError(str(e) + "- required module not found") BIOS_QUERY_VERSION_COMMAND = "dmidecode -s system-version" +SSD_VERSION_COMMAND = "ssdutil -v" +SSD_UPGRADE_SCHEDULE = "/usr/local/bin/ssd_upgrade_schedule" +PCI_VERSION_COMMAND = "lspci -s 0:0.0" class Component(ComponentBase): @@ -29,9 +35,10 @@ class Component(ComponentBase): CHASSIS_COMPONENTS = [ ["BIOS", ("Performs initialization of hardware components during " "booting")], - ["CPLD", "Used for managing IO modules, SFP+ modules and system LEDs"], ["FPGA", ("Platform management controller for on-board temperature " - "monitoring, in-chassis power, Fan and LED control")] + "monitoring, in-chassis power, Fan and LED control")], + ["CPLD", "Used for managing IO modules, SFP+ modules and system LEDs"], + ["SSD", "Solid State Drive that stores data persistently"] ] MODULE_COMPONENT = [ "IOM{}-CPLD", @@ -125,6 +132,38 @@ def _get_fpga_version(self): else: return 'NA' + def _get_ssd_version(self): + rv = 'NA' + ssd_ver = self._get_command_result(SSD_VERSION_COMMAND) + if not ssd_ver: + return rv + else: + version = re.search(r'Firmware\s*:(.*)',ssd_ver) + if version: + rv = version.group(1).strip() + return rv + + def _get_available_firmware_version(self, image_path): + if not os.path.isfile(image_path): + return False, "ERROR: File not found" + + try: + updater = tarfile.open(image_path, "r") + except tarfile.ReadError: + return False, "ERROR: Unable to extract firmware updater" + + try: + ver_info_fd = updater.extractfile("fw-component-version") + except KeyError: + updater.close() + return False, "ERROR: Version info not available" + + ver_info = json.load(ver_info_fd) + ver_info_fd.close() + updater.close() + + return True, ver_info + def get_name(self): """ Retrieves the name of the component @@ -216,10 +255,53 @@ def get_firmware_version(self): else: return bios_ver - elif self.index == 1: # SwitchCard CPLD - return self._get_cpld_version() - elif self.index == 2: # FPGA + elif self.index == 1: # FPGA return self._get_fpga_version() + elif self.index == 2: # SwitchCard CPLD + return self._get_cpld_version() + elif self.index == 3: #SSD + return self._get_ssd_version() + + def get_available_firmware_version(self, image_path): + """ + Retrieves the available firmware version of the component + + Note: the firmware version will be read from image + + Args: + image_path: A string, path to firmware image + + Returns: + A string containing the available firmware version of the component + """ + avail_ver = None + if self.index == 2: # SwitchCard CPLD + valid, version = self._get_available_firmware_version(image_path) + pci_ver = self._get_command_result(PCI_VERSION_COMMAND) + if valid: + if pci_ver: + board_ver = re.search(r"\(rev ([0-9]{2})\)$", pci_ver) + if board_ver: + board_ver = board_ver.group(1).strip() + board_type = 'B0' if board_ver == '02' else 'C0' + cpld_ver = self._get_cpld_version() + avail_ver = version.get(board_type) if board_type == 'B0' else cpld_ver + else: + print(version) + + elif self.index == 3: # SSD + valid, version = self._get_available_firmware_version(image_path) + ssd_ver = self._get_command_result(SSD_VERSION_COMMAND) + if valid: + if ssd_ver: + ssd_model = re.search(r'Device Model\s*:.*(3IE[3]{0,1})', ssd_ver) + if ssd_model: + ssd_model = ssd_model.group(1).strip() + avail_ver = version.get(ssd_model) + else: + print(version) + + return avail_ver if avail_ver else "NA" def install_firmware(self, image_path): """ diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/eeprom.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/eeprom.py index 288c1a2ccfcf..ab3bb174e62b 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/eeprom.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/eeprom.py @@ -123,7 +123,7 @@ def serial_str(self): def revision_str(self): (is_valid, results) = self.get_tlv_field( - self.eeprom_data, self._TLV_CODE_DEVICE_VERSION) + self.eeprom_data, self._TLV_CODE_LABEL_REVISION) if not is_valid: return "N/A" diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/fan_drawer.py index 41e870a63971..2f38be9cd574 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/fan_drawer.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/fan_drawer.py @@ -159,3 +159,13 @@ def get_status_led(self): return self.STATUS_LED_COLOR_AMBER else: return self.STATUS_LED_COLOR_OFF + + def get_maximum_consumed_power(self): + """ + Retrives the maximum power drawn by Fan Drawer + + Returns: + A float, with value of the maximum consumable power of the + component. + """ + return 54.0 diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/module.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/module.py index 923bb5c0550a..163a0ab3981c 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/module.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/module.py @@ -198,3 +198,48 @@ def get_system_eeprom_info(self): ‘0x26’:’01’, ‘0x27’:’REV01’, ‘0x28’:’AG9064-C2358-16G’} """ return self._eeprom.system_eeprom_info() + + def get_description(self): + """ + Retrieves the platform vendor's product description of the module + + Returns: + A string, providing the vendor's product description of the module. + """ + return self._eeprom.modelstr() + + def get_slot(self): + """ + Retrieves the platform vendor's slot number of the module + + Returns: + An integer, indicating the slot number in the chassis + """ + return self.index + + def get_oper_status(self): + """ + Retrieves the operational status of the module + + Returns: + A string, the operational status of the module from one of the + predefined status values: MODULE_STATUS_EMPTY, MODULE_STATUS_OFFLINE, + MODULE_STATUS_FAULT, MODULE_STATUS_PRESENT or MODULE_STATUS_ONLINE + """ + if self.get_presence(): + if self.get_status(): + return self.MODULE_STATUS_ONLINE + else: + return self.MODULE_STATUS_PRESENT + else: + return self.MODULE_STATUS_EMPTY + + def get_maximum_consumed_power(self): + """ + Retrives the maximum power drawn by this module + + Returns: + A float, with value of the maximum consumable power of the + module. + """ + return 97.23 diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/psu.py index 4e528b679e4a..8bfc0ddf2b77 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/psu.py @@ -34,11 +34,13 @@ def __init__(self, psu_index): self.psu_voltage_reg = "in30_input" self.psu_current_reg = "curr602_input" self.psu_power_reg = "power2_input" + self.psu_maxpower_reg = "power2_max" self.psu_temperature_reg = "temp14_input" elif self.index == 2: self.psu_voltage_reg = "in32_input" self.psu_current_reg = "curr702_input" self.psu_power_reg = "power4_input" + self.psu_maxpower_reg = "power4_max" self.psu_temperature_reg = "temp15_input" # Passing True to specify it is a PSU fan @@ -124,6 +126,19 @@ def get_serial(self): return psu_serialno + def get_revision(self): + """ + Retrieves the hardware revision of the device + + Returns: + string: Revision value of device + """ + serial = self.get_serial() + if serial != "NA" and len(serial) == 28: + return serial[-3:] + else: + return "NA" + def get_status(self): """ Retrieves the operational status of the PSU @@ -195,6 +210,24 @@ def get_power(self): return psu_power + def get_maximum_supplied_power(self): + """ + Retrieves the maximum supplied power by PSU + + Returns: + A float number, the maximum power output in Watts. + e.g. 1200.1 + """ + psu_maxpower = self._get_pmc_register(self.psu_maxpower_reg) + if (psu_maxpower != 'ERR') and self.get_presence(): + # Converting the value returned by driver which is in + # microwatts to watts + psu_maxpower = float(psu_maxpower) / 1000000 + else: + psu_maxpower = 0.0 + + return psu_maxpower + def get_powergood_status(self): """ Retrieves the powergood status of PSU diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/sfp.py index 0b242ab74d71..fa8e4d9a05c0 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/sfp.py @@ -9,872 +9,223 @@ ############################################################################# try: - import re - import struct + import os + import syslog import time - from sonic_platform_base.sfp_base import SfpBase - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase except ImportError as e: raise ImportError(str(e) + "- required module not found") +QSFP_INFO_OFFSET = 128 -PAGE_OFFSET = 0 -KEY_OFFSET = 1 -KEY_WIDTH = 2 -FUNC_NAME = 3 - -INFO_OFFSET = 128 -DOM_OFFSET = 0 -DOM_OFFSET1 = 384 - -QSFP_CONTROL_OFFSET = 86 -QSFP_POWEROVERRIDE_OFFSET = 93 - -cable_length_tup = ('Length(km)', 'Length OM3(2m)', 'Length OM2(m)', - 'Length OM1(m)', 'Length Cable Assembly(m)') - -compliance_code_tup = ( - '10/40G Ethernet Compliance Code', - 'SONET Compliance codes', - 'SAS/SATA compliance codes', - 'Gigabit Ethernet Compliant codes', - 'Fibre Channel link length/Transmitter Technology', - 'Fibre Channel transmission media', - 'Fibre Channel Speed') - -info_dict_keys = ['type', 'hardware_rev', 'serial', - 'manufacturer', 'model', 'connector', - 'encoding', 'ext_identifier', 'ext_rateselect_compliance', - 'cable_type', 'cable_length', 'nominal_bit_rate', - 'specification_compliance', 'vendor_date', 'vendor_oui', - 'application_advertisement'] - -dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', - 'power_lpmode', 'tx_disable', 'tx_disable_channel', - 'temperature', 'voltage', 'rx1power', - 'rx2power', 'rx3power', 'rx4power', - 'tx1bias', 'tx2bias', 'tx3bias', - 'tx4bias', 'tx1power', 'tx2power', - 'tx3power', 'tx4power'] - -threshold_dict_keys = ['temphighalarm', 'temphighwarning', - 'templowalarm', 'templowwarning', - 'vcchighalarm', 'vcchighwarning', - 'vcclowalarm', 'vcclowwarning', - 'rxpowerhighalarm', 'rxpowerhighwarning', - 'rxpowerlowalarm', 'rxpowerlowwarning', - 'txpowerhighalarm', 'txpowerhighwarning', - 'txpowerlowalarm', 'txpowerlowwarning', - 'txbiashighalarm', 'txbiashighwarning', - 'txbiaslowalarm', 'txbiaslowwarning'] - -sff8436_parser = { - 'reset_status': [DOM_OFFSET, 2, 1, 'parse_dom_status_indicator'], - 'rx_los': [DOM_OFFSET, 3, 1, 'parse_dom_tx_rx_los'], - 'tx_fault': [DOM_OFFSET, 4, 1, 'parse_dom_tx_fault'], - 'tx_disable': [DOM_OFFSET, 86, 1, 'parse_dom_tx_disable'], - 'power_lpmode': [DOM_OFFSET, 93, 1, 'parse_dom_power_control'], - 'power_override': [DOM_OFFSET, 93, 1, 'parse_dom_power_control'], - 'Temperature': [DOM_OFFSET, 22, 2, 'parse_temperature'], - 'Voltage': [DOM_OFFSET, 26, 2, 'parse_voltage'], - 'ChannelMonitor': [DOM_OFFSET, 34, 16, 'parse_channel_monitor_params'], - - 'cable_type': [INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'cable_length': [INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'connector': [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'type': [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'encoding': [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'ext_identifier': [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'ext_rateselect_compliance': - [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'nominal_bit_rate': [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'specification_compliance': - [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'manufacturer': [INFO_OFFSET, 20, 16, 'parse_vendor_name'], - 'vendor_oui': [INFO_OFFSET, 37, 3, 'parse_vendor_oui'], - 'model': [INFO_OFFSET, 40, 16, 'parse_vendor_pn'], - 'hardware_rev': [INFO_OFFSET, 56, 2, 'parse_vendor_rev'], - 'serial': [INFO_OFFSET, 68, 16, 'parse_vendor_sn'], - 'vendor_date': [INFO_OFFSET, 84, 8, 'parse_vendor_date'], - 'ModuleThreshold': [DOM_OFFSET1, 128, 24, 'parse_module_threshold_values'], - 'ChannelThreshold': [DOM_OFFSET1, 176, 16, 'parse_channel_threshold_values'], -} - - -class Sfp(SfpBase): + +class Sfp(SfpOptoeBase): """ DELLEMC Platform-specific Sfp class """ def __init__(self, index, sfp_type, eeprom_path, sfp_control, sfp_ctrl_idx): - SfpBase.__init__(self) + SfpOptoeBase.__init__(self) self.sfp_type = sfp_type self.index = index + 1 self.eeprom_path = eeprom_path self.sfp_control = sfp_control self.sfp_ctrl_idx = sfp_ctrl_idx - self.sfpInfo = sff8436InterfaceId() - self.sfpDomInfo = sff8436Dom() - - def _read_eeprom_bytes(self, eeprom_path, offset, num_bytes): - eeprom_raw = [] - try: - eeprom = open(eeprom_path, mode="rb", buffering=0) - except IOError: - return None - - for i in range(0, num_bytes): - eeprom_raw.append("0x00") - - try: - eeprom.seek(offset) - raw = eeprom.read(num_bytes) - except IOError: - eeprom.close() - return None - - raw = bytearray(raw) - try: - for n in range(0, num_bytes): - eeprom_raw[n] = hex(raw[n])[2:].zfill(2) - except BaseException: - eeprom.close() - return None - - eeprom.close() - return eeprom_raw - - def _get_eeprom_data(self, eeprom_key): - eeprom_data = None - page_offset = None - - if (self.sfpInfo is None): - return None - - page_offset = sff8436_parser[eeprom_key][PAGE_OFFSET] - eeprom_data_raw = self._read_eeprom_bytes( - self.eeprom_path, - (sff8436_parser[eeprom_key][PAGE_OFFSET] + - sff8436_parser[eeprom_key][KEY_OFFSET]), - sff8436_parser[eeprom_key][KEY_WIDTH]) - if (eeprom_data_raw is not None): - # Offset 128 is used to retrieve sff8436InterfaceId Info - # Offset 0 is used to retrieve sff8436Dom Info - if (page_offset == 128): - eeprom_data = getattr( - self.sfpInfo, sff8436_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - eeprom_data = getattr( - self.sfpDomInfo, sff8436_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - - return eeprom_data - - def _strip_unit_from_str(self, value_str): - match = re.match(r'(.*)C$|(.*)Volts$|(.*)mA$|(.*)dBm$', value_str) - if match: - for value in match.groups(): - if value is not None: - return float(value) - - return None - - def get_transceiver_info(self): - """ - Retrieves transceiver info of this SFP - """ - transceiver_info_dict = {} - compliance_code_dict = {} - transceiver_info_dict = dict.fromkeys(info_dict_keys, 'N/A') - - # BaseInformation - iface_data = self._get_eeprom_data('type') - if (iface_data is not None): - connector = iface_data['data']['Connector']['value'] - encoding = iface_data['data']['EncodingCodes']['value'] - ext_id = iface_data['data']['Extended Identifier']['value'] - rate_identifier = iface_data['data']['RateIdentifier']['value'] - identifier = iface_data['data']['type']['value'] - bit_rate = str( - iface_data['data']['Nominal Bit Rate(100Mbs)']['value']) - - for key in compliance_code_tup: - if key in iface_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = iface_data['data']['Specification compliance']['value'][key]['value'] - for key in cable_length_tup: - if key in iface_data['data']: - cable_type = key - cable_length = str(iface_data['data'][key]['value']) - else: - return transceiver_info_dict - - # Vendor Date - vendor_date_data = self._get_eeprom_data('vendor_date') - if (vendor_date_data is not None): - vendor_date = vendor_date_data['data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] - else: - return transceiver_info_dict - - # Vendor Name - vendor_name_data = self._get_eeprom_data('manufacturer') - if (vendor_name_data is not None): - vendor_name = vendor_name_data['data']['Vendor Name']['value'] - else: - return transceiver_info_dict - - # Vendor OUI - vendor_oui_data = self._get_eeprom_data('vendor_oui') - if (vendor_oui_data is not None): - vendor_oui = vendor_oui_data['data']['Vendor OUI']['value'] - else: - return transceiver_info_dict - - # Vendor PN - vendor_pn_data = self._get_eeprom_data('model') - if (vendor_pn_data is not None): - vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] - else: - return transceiver_info_dict - # Vendor Revision - vendor_rev_data = self._get_eeprom_data('hardware_rev') - if (vendor_rev_data is not None): - vendor_rev = vendor_rev_data['data']['Vendor Rev']['value'] - else: - return transceiver_info_dict - - # Vendor Serial Number - vendor_sn_data = self._get_eeprom_data('serial') - if (vendor_sn_data is not None): - vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] - else: - return transceiver_info_dict - - # Fill The Dictionary and return - transceiver_info_dict['type'] = identifier - transceiver_info_dict['hardware_rev'] = vendor_rev - transceiver_info_dict['serial'] = vendor_sn - transceiver_info_dict['manufacturer'] = vendor_name - transceiver_info_dict['model'] = vendor_pn - transceiver_info_dict['connector'] = connector - transceiver_info_dict['encoding'] = encoding - transceiver_info_dict['ext_identifier'] = ext_id - transceiver_info_dict['ext_rateselect_compliance'] = rate_identifier - transceiver_info_dict['cable_type'] = cable_type - transceiver_info_dict['cable_length'] = cable_length - transceiver_info_dict['nominal_bit_rate'] = bit_rate - transceiver_info_dict['specification_compliance'] = str( - compliance_code_dict) - transceiver_info_dict['vendor_date'] = vendor_date - transceiver_info_dict['vendor_oui'] = vendor_oui - - return transceiver_info_dict - - def get_transceiver_threshold_info(self): - """ - Retrieves transceiver threshold info of this SFP - """ - transceiver_dom_threshold_dict = {} - transceiver_dom_threshold_dict = dict.fromkeys( - threshold_dict_keys, 'N/A') - - # Module Threshold - module_threshold_data = self._get_eeprom_data('ModuleThreshold') - if (module_threshold_data is not None): - tempHighAlarm = module_threshold_data['data']['TempHighAlarm']['value'] - tempLowAlarm = module_threshold_data['data']['TempLowAlarm']['value'] - tempHighWarn = module_threshold_data['data']['TempHighWarning']['value'] - tempLowWarn = module_threshold_data['data']['TempLowWarning']['value'] - vccHighAlarm = module_threshold_data['data']['VccHighAlarm']['value'] - vccLowAlarm = module_threshold_data['data']['VccLowAlarm']['value'] - vccHighWarn = module_threshold_data['data']['VccHighWarning']['value'] - vccLowWarn = module_threshold_data['data']['VccLowWarning']['value'] - else: - return transceiver_dom_threshold_dict - - # Channel Threshold - channel_threshold_data = self._get_eeprom_data('ChannelThreshold') - if (channel_threshold_data is not None): - rxPowerHighAlarm = channel_threshold_data['data']['RxPowerHighAlarm']['value'] - rxPowerLowAlarm = channel_threshold_data['data']['RxPowerLowAlarm']['value'] - rxPowerHighWarn = channel_threshold_data['data']['RxPowerHighWarning']['value'] - rxPowerLowWarn = channel_threshold_data['data']['RxPowerLowWarning']['value'] - txBiasHighAlarm = channel_threshold_data['data']['TxBiasHighAlarm']['value'] - txBiasLowAlarm = channel_threshold_data['data']['TxBiasLowAlarm']['value'] - txBiasHighWarn = channel_threshold_data['data']['TxBiasHighWarning']['value'] - txBiasLowWarn = channel_threshold_data['data']['TxBiasLowWarning']['value'] - else: - return transceiver_dom_threshold_dict - - transceiver_dom_threshold_dict['temphighalarm'] = tempHighAlarm - transceiver_dom_threshold_dict['templowalarm'] = tempLowAlarm - transceiver_dom_threshold_dict['temphighwarning'] = tempHighWarn - transceiver_dom_threshold_dict['templowwarning'] = tempLowWarn - transceiver_dom_threshold_dict['vcchighalarm'] = vccHighAlarm - transceiver_dom_threshold_dict['vcclowalarm'] = vccLowAlarm - transceiver_dom_threshold_dict['vcchighwarning'] = vccHighWarn - transceiver_dom_threshold_dict['vcclowwarning'] = vccLowWarn - transceiver_dom_threshold_dict['rxpowerhighalarm'] = rxPowerHighAlarm - transceiver_dom_threshold_dict['rxpowerlowalarm'] = rxPowerLowAlarm - transceiver_dom_threshold_dict['rxpowerhighwarning'] = rxPowerHighWarn - transceiver_dom_threshold_dict['rxpowerlowwarning'] = rxPowerLowWarn - transceiver_dom_threshold_dict['txbiashighalarm'] = txBiasHighAlarm - transceiver_dom_threshold_dict['txbiaslowalarm'] = txBiasLowAlarm - transceiver_dom_threshold_dict['txbiashighwarning'] = txBiasHighWarn - transceiver_dom_threshold_dict['txbiaslowwarning'] = txBiasLowWarn - - return transceiver_dom_threshold_dict - - def get_transceiver_bulk_status(self): - """ - Retrieves transceiver bulk status of this SFP - """ - tx_bias_list = [] - rx_power_list = [] - transceiver_dom_dict = {} - transceiver_dom_dict = dict.fromkeys(dom_dict_keys, 'N/A') - - # RxLos - rx_los = self.get_rx_los() - - # TxFault - tx_fault = self.get_tx_fault() - - # ResetStatus - reset_state = self.get_reset_status() - - # LowPower Mode - lp_mode = self.get_lpmode() - - # TxDisable - tx_disable = self.get_tx_disable() - - # TxDisable Channel - tx_disable_channel = self.get_tx_disable_channel() - - # Temperature - temperature = self.get_temperature() - - # Voltage - voltage = self.get_voltage() - - # Channel Monitor - channel_monitor_data = self._get_eeprom_data('ChannelMonitor') - if (channel_monitor_data is not None): - tx_bias = channel_monitor_data['data']['TX1Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = channel_monitor_data['data']['TX2Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = channel_monitor_data['data']['TX3Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = channel_monitor_data['data']['TX4Bias']['value'] - tx_bias_list.append(tx_bias) - rx_power = channel_monitor_data['data']['RX1Power']['value'] - rx_power_list.append(rx_power) - rx_power = channel_monitor_data['data']['RX2Power']['value'] - rx_power_list.append(rx_power) - rx_power = channel_monitor_data['data']['RX3Power']['value'] - rx_power_list.append(rx_power) - rx_power = channel_monitor_data['data']['RX4Power']['value'] - rx_power_list.append(rx_power) - else: - return transceiver_dom_dict - - transceiver_dom_dict['rx_los'] = rx_los - transceiver_dom_dict['tx_fault'] = tx_fault - transceiver_dom_dict['reset_status'] = reset_state - transceiver_dom_dict['power_lpmode'] = lp_mode - transceiver_dom_dict['tx_disable'] = tx_disable - transceiver_dom_dict['tx_disable_channel'] = tx_disable_channel - transceiver_dom_dict['temperature'] = temperature - transceiver_dom_dict['voltage'] = voltage - transceiver_dom_dict['tx1bias'] = tx_bias_list[0] - transceiver_dom_dict['tx2bias'] = tx_bias_list[1] - transceiver_dom_dict['tx3bias'] = tx_bias_list[2] - transceiver_dom_dict['tx4bias'] = tx_bias_list[3] - transceiver_dom_dict['rx1power'] = rx_power_list[0] - transceiver_dom_dict['rx2power'] = rx_power_list[1] - transceiver_dom_dict['rx3power'] = rx_power_list[2] - transceiver_dom_dict['rx4power'] = rx_power_list[3] - - return transceiver_dom_dict + def get_eeprom_path(self): + return self.eeprom_path def get_name(self): - """ - Retrieves the name of the sfp - Returns : QSFP or QSFP+ or QSFP28 - """ - iface_data = self._get_eeprom_data('type') - if (iface_data is not None): - identifier = iface_data['data']['type']['value'] - else: - return None - - return identifier + return "QSFP+ or later" def get_presence(self): """ Retrieves the presence of the sfp """ + if self.index > 64: + return False + presence_ctrl = self.sfp_control + 'qsfp_modprs' try: reg_file = open(presence_ctrl) - except IOError as e: - return False - - reg_hex = reg_file.readline().rstrip() - - # content is a string containing the hex - # representation of the register - reg_value = int(reg_hex, 16) - - # Mask off the bit corresponding to our port - if (self.sfp_ctrl_idx > 15): - index = self.sfp_ctrl_idx % 16 - else: - index = self.sfp_ctrl_idx - - # Mask off the bit corresponding to our port - mask = (1 << index) - - # ModPrsL is active low - if ((reg_value & mask) == 0): - return True + reg_hex = reg_file.readline().rstrip() + # content is a string containing the hex + # representation of the register + reg_value = int(reg_hex, 16) + # Mask off the bit corresponding to our port + if (self.sfp_ctrl_idx > 15): + index = self.sfp_ctrl_idx % 16 + else: + index = self.sfp_ctrl_idx + + # Mask off the bit corresponding to our port + mask = (1 << index) + # ModPrsL is active low + if ((reg_value & mask) == 0): + return True + except (IOError, ValueError) as err: + syslog.syslog(syslog.LOG_ERR, str(err)) return False - def get_model(self): - """ - Retrieves the model number (or part number) of the sfp - """ - vendor_pn_data = self._get_eeprom_data('model') - if (vendor_pn_data is not None): - vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] - else: - return None - - return vendor_pn - - def get_serial(self): - """ - Retrieves the serial number of the sfp - """ - vendor_sn_data = self._get_eeprom_data('serial') - if (vendor_sn_data is not None): - vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] - else: - return None - - return vendor_sn - def get_reset_status(self): """ Retrieves the reset status of SFP """ + if self.index > 64: + return False + reset_status = None reset_ctrl = self.sfp_control + 'qsfp_reset' try: reg_file = open(reset_ctrl, "r+") - except IOError as e: - return False - - reg_hex = reg_file.readline().rstrip() - - # content is a string containing the hex - # representation of the register - reg_value = int(reg_hex, 16) - - # Mask off the bit corresponding to our port - if (self.sfp_ctrl_idx > 15): - index = self.sfp_ctrl_idx % 16 - else: - index = self.sfp_ctrl_idx - - mask = (1 << index) - if ((reg_value & mask) == 0): - reset_status = True - else: - reset_status = False - - return reset_status - - def get_rx_los(self): - """ - Retrieves the RX LOS (lost-of-signal) status of SFP - """ - rx_los_list = [] - - rx_los_data = self._get_eeprom_data('rx_los') - if (rx_los_data is not None): - rx_los = rx_los_data['data']['Rx1LOS']['value'] - if (rx_los == 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - rx_los = rx_los_data['data']['Rx2LOS']['value'] - if (rx_los == 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - rx_los = rx_los_data['data']['Rx3LOS']['value'] - if (rx_los == 'On'): - rx_los_list.append(True) + reg_hex = reg_file.readline().rstrip() + # content is a string containing the hex + # representation of the register + reg_value = int(reg_hex, 16) + # Mask off the bit corresponding to our port + if (self.sfp_ctrl_idx > 15): + index = self.sfp_ctrl_idx % 16 else: - rx_los_list.append(False) - rx_los = rx_los_data['data']['Rx4LOS']['value'] - if (rx_los == 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - - return rx_los_list + index = self.sfp_ctrl_idx - def get_tx_fault(self): - """ - Retrieves the TX fault status of SFP - """ - tx_fault_list = [] + mask = (1 << index) - tx_fault_data = self._get_eeprom_data('tx_fault') - if (tx_fault_data is not None): - tx_fault = tx_fault_data['data']['Tx1Fault']['value'] - if (tx_fault == 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - tx_fault = tx_fault_data['data']['Tx2Fault']['value'] - if (tx_fault == 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - tx_fault = tx_fault_data['data']['Tx3Fault']['value'] - if (tx_fault == 'On'): - tx_fault_list.append(True) + if ((reg_value & mask) == 0): + reset_status = True else: - tx_fault_list.append(False) - tx_fault = tx_fault_data['data']['Tx4Fault']['value'] - if (tx_fault == 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - - return tx_fault_list - - def get_tx_disable(self): - """ - Retrieves the tx_disable status of this SFP - """ - tx_disable_list = [] - - tx_disable_data = self._get_eeprom_data('tx_disable') - if (tx_disable_data is not None): - tx_disable = tx_disable_data['data']['Tx1Disable']['value'] - if (tx_disable == 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - tx_disable = tx_disable_data['data']['Tx2Disable']['value'] - if (tx_disable == 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - tx_disable = tx_disable_data['data']['Tx3Disable']['value'] - if (tx_disable == 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - tx_disable = tx_disable_data['data']['Tx4Disable']['value'] - if (tx_disable == 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - - return tx_disable_list - - def get_tx_disable_channel(self): - """ - Retrieves the TX disabled channels in this SFP - """ - tx_disable_channel = 0 + reset_status = False - tx_disable = self.get_tx_disable() - for channel, disable in enumerate(tx_disable): - if disable: - tx_disable_channel |= 1 << channel - - return tx_disable_channel + except (IOError, ValueError) as err: + syslog.syslog(syslog.LOG_ERR, str(err)) + return False + return reset_status def get_lpmode(self): """ Retrieves the lpmode (low power mode) status of this SFP """ + if self.index > 64: + return False + lpmode_ctrl = self.sfp_control + 'qsfp_lpmode' try: reg_file = open(lpmode_ctrl, "r+") - except IOError as e: - return False - - reg_hex = reg_file.readline().rstrip() - - # content is a string containing the hex - # representation of the register - reg_value = int(reg_hex, 16) - - # Mask off the bit corresponding to our port - if (self.sfp_ctrl_idx > 15): - index = self.sfp_ctrl_idx % 16 - else: - index = self.sfp_ctrl_idx - - mask = (1 << index) - - if ((reg_value & mask) == 0): - lpmode_state = False - else: - lpmode_state = True - - return lpmode_state - - def get_power_override(self): - """ - Retrieves the power-override status of this SFP - """ - power_override_state = None - - # Reset Status - power_override_data = self._get_eeprom_data('power_override') - if (power_override_data is not None): - power_override = power_override_data['data']['PowerOverRide']['value'] - if (power_override == 'On'): - power_override_state = True - else: - power_override_state = False - - return power_override_state - - def get_temperature(self): - """ - Retrieves the temperature of this SFP - """ - temperature = None - - temperature_data = self._get_eeprom_data('Temperature') - if (temperature_data is not None): - temperature = self._strip_unit_from_str(temperature_data['data']['Temperature']['value']) - return temperature + reg_hex = reg_file.readline().rstrip() - def get_voltage(self): - """ - Retrieves the supply voltage of this SFP - """ - voltage = None - - voltage_data = self._get_eeprom_data('Voltage') - if (voltage_data is not None): - voltage = self._strip_unit_from_str(voltage_data['data']['Vcc']['value']) - - return voltage - - def get_tx_bias(self): - """ - Retrieves the TX bias current of this SFP - """ - tx_bias_list = [] - - tx_bias_data = self._get_eeprom_data('ChannelMonitor') - if (tx_bias_data is not None): - tx_bias_list.append(self._strip_unit_from_str(tx_bias_data['data']['TX1Bias']['value'])) - tx_bias_list.append(self._strip_unit_from_str(tx_bias_data['data']['TX2Bias']['value'])) - tx_bias_list.append(self._strip_unit_from_str(tx_bias_data['data']['TX3Bias']['value'])) - tx_bias_list.append(self._strip_unit_from_str(tx_bias_data['data']['TX4Bias']['value'])) - - return tx_bias_list - - def get_rx_power(self): - """ - Retrieves the received optical power for this SFP - """ - rx_power_list = [] + # content is a string containing the hex + # representation of the register + reg_value = int(reg_hex, 16) - rx_power_data = self._get_eeprom_data('ChannelMonitor') - if (rx_power_data is not None): - rx_power_list.append(self._strip_unit_from_str(rx_power_data['data']['RX1Power']['value'])) - rx_power_list.append(self._strip_unit_from_str(rx_power_data['data']['RX2Power']['value'])) - rx_power_list.append(self._strip_unit_from_str(rx_power_data['data']['RX3Power']['value'])) - rx_power_list.append(self._strip_unit_from_str(rx_power_data['data']['RX4Power']['value'])) + # Mask off the bit corresponding to our port + if (self.sfp_ctrl_idx > 15): + index = self.sfp_ctrl_idx % 16 + else: + index = self.sfp_ctrl_idx - return rx_power_list + mask = (1 << index) - def get_tx_power(self): - """ - Retrieves the TX power of this SFP - """ - tx_power_list = [] + if ((reg_value & mask) == 0): + lpmode_state = False + else: + lpmode_state = True - tx_power_list.append(float('-inf')) - tx_power_list.append(float('-inf')) - tx_power_list.append(float('-inf')) - tx_power_list.append(float('-inf')) + except (IOError, ValueError) as err: + syslog.syslog(syslog.LOG_ERR, str(err)) + return False - return tx_power_list + return lpmode_state def reset(self): """ Reset SFP and return all user module settings to their default srate. """ + if self.index > 64: + return False + reset_ctrl = self.sfp_control + 'qsfp_reset' try: # Open reset_ctrl in both read & write mode reg_file = open(reset_ctrl, "r+") - except IOError as e: - return False - - reg_hex = reg_file.readline().rstrip() - reg_value = int(reg_hex, 16) - - # Mask off the bit corresponding to our port - if (self.sfp_ctrl_idx > 15): - index = self.sfp_ctrl_idx % 16 - else: - index = self.sfp_ctrl_idx - # Mask off the bit corresponding to our port - mask = (1 << index) + reg_hex = reg_file.readline().rstrip() + reg_value = int(reg_hex, 16) + # Mask off the bit corresponding to our port + if (self.sfp_ctrl_idx > 15): + index = self.sfp_ctrl_idx % 16 + else: + index = self.sfp_ctrl_idx - # ResetL is active low - reg_value = (reg_value & ~mask) + # Mask off the bit corresponding to our port + mask = (1 << index) - # Convert our register value back to a - # hex string and write back - reg_file.seek(0) - reg_file.write(hex(reg_value)) - reg_file.close() + # ResetL is active low + reg_value = (reg_value & ~mask) - # Sleep 1 second to allow it to settle - time.sleep(1) + # Convert our register value back to a + # hex string and write back + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() - # Flip the bit back high and write back to the - # register to take port out of reset - try: + # Sleep 1 second to allow it to settle + time.sleep(1) + # Flip the bit back high and write back to the + # register to take port out of reset reg_file = open(reset_ctrl, "w") - except IOError as e: - return False - reg_value = reg_value | mask - reg_file.seek(0) - reg_file.write(hex(reg_value)) - reg_file.close() + reg_value = reg_value | mask + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + except (IOError, ValueError) as err: + syslog.syslog(syslog.LOG_ERR, str(err)) + return False return True def set_lpmode(self, lpmode): """ Sets the lpmode (low power mode) of SFP """ - lpmode_ctrl = self.sfp_control + 'qsfp_lpmode' - try: - reg_file = open(lpmode_ctrl, "r+") - except IOError as e: + if self.index > 64: return False - reg_hex = reg_file.readline().rstrip() - - # content is a string containing the hex - # representation of the register - reg_value = int(reg_hex, 16) - - # Mask off the bit corresponding to our port - if (self.sfp_ctrl_idx > 15): - index = self.sfp_ctrl_idx % 16 - else: - index = self.sfp_ctrl_idx - - mask = (1 << index) - - # LPMode is active high; set or clear the bit accordingly - if lpmode is True: - reg_value = (reg_value | mask) - else: - reg_value = (reg_value & ~mask) - - # Convert our register value back to a hex string and write back - content = hex(reg_value) - - reg_file.seek(0) - reg_file.write(content) - reg_file.close() - - return True - - def tx_disable(self, tx_disable): - """ - Disable SFP TX for all channels - """ - eeprom = None - tx_disable_value = 0xf if tx_disable else 0x0 - + lpmode_ctrl = self.sfp_control + 'qsfp_lpmode' try: - eeprom = open(self.eeprom_path, "r+b") - eeprom.seek(QSFP_CONTROL_OFFSET) - eeprom.write(struct.pack('B', tx_disable_value)) - except IOError: - return False - finally: - if eeprom is not None: - eeprom.close() - time.sleep(0.01) + reg_file = open(lpmode_ctrl, "r+") - return True + reg_hex = reg_file.readline().rstrip() + # content is a string containing the hex + # representation of the register + reg_value = int(reg_hex, 16) - def tx_disable_channel(self, channel, disable): - """ - Sets the tx_disable for specified SFP channels - """ - eeprom = None - current_state = self.get_tx_disable_channel() + # Mask off the bit corresponding to our port + if (self.sfp_ctrl_idx > 15): + index = self.sfp_ctrl_idx % 16 + else: + index = self.sfp_ctrl_idx - if disable: - tx_disable_value = current_state | channel - else: - tx_disable_value = current_state & (~channel) + mask = (1 << index) - try: - eeprom = open(self.eeprom_path, "r+b") - eeprom.seek(QSFP_CONTROL_OFFSET) - eeprom.write(struct.pack('B', tx_disable_value)) - except IOError: - return False - finally: - if eeprom is not None: - eeprom.close() - time.sleep(0.01) + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = (reg_value | mask) + else: + reg_value = (reg_value & ~mask) - return True + # Convert our register value back to a hex string and write back + content = hex(reg_value) - def set_power_override(self, power_override, power_set): - """ - Sets SFP power level using power_override and power_set - """ - eeprom = None - power_override_bit = 0x1 if power_override else 0 - power_set_bit = 0x2 if power_set else 0 - value = power_override_bit | power_set_bit - - try: - eeprom = open(self.eeprom_path, "r+b") - eeprom.seek(QSFP_POWEROVERRIDE_OFFSET) - eeprom.write(struct.pack('B', value)) - except IOError: + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + except (IOError, ValueError) as err: + syslog.syslog(syslog.LOG_ERR, str(err)) return False - finally: - if eeprom is not None: - eeprom.close() - time.sleep(0.01) return True @@ -907,3 +258,27 @@ def is_replaceable(self): bool: True if it is replaceable. """ return True + + def get_error_description(self): + """ + Retrives the error descriptions of the SFP module + + Returns: + String that represents the current error descriptions of vendor specific errors + In case there are multiple errors, they should be joined by '|', + like: "Bad EEPROM|Unsupported cable" + """ + if not self.get_presence(): + return self.SFP_STATUS_UNPLUGGED + else: + if not os.path.isfile(self.eeprom_path): + return "EEPROM driver is not attached" + + try: + with open(self.eeprom_path, mode="rb", buffering=0) as eeprom: + eeprom.seek(QSFP_INFO_OFFSET) + eeprom.read(1) + except OSError as e: + return "EEPROM read failed ({})".format(e.strerror) + + return self.SFP_STATUS_OK diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/watchdog.py index 177315ef1805..7090539baf97 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/watchdog.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/watchdog.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - ######################################################################## # # DELLEMC S6100 @@ -10,13 +8,30 @@ ######################################################################## try: + import array + import ctypes + import fcntl + import glob import os import struct - import ctypes from sonic_platform_base.watchdog_base import WatchdogBase except ImportError as e: raise ImportError(str(e) + "- required module not found") +# ioctl constants +IOC_WRITE = 0x40000000 +IOC_READ = 0x80000000 +IOC_SIZE_INT = 0x00040000 + +WATCHDOG_IOCTL_BASE = ord('W') + +WDIOC_SETOPTIONS = IOC_READ | IOC_SIZE_INT | (WATCHDOG_IOCTL_BASE << 8) | 4 +WDIOC_KEEPALIVE = IOC_READ | IOC_SIZE_INT | (WATCHDOG_IOCTL_BASE << 8) | 5 +WDIOC_SETTIMEOUT = IOC_READ | IOC_WRITE | IOC_SIZE_INT | (WATCHDOG_IOCTL_BASE << 8) | 6 + +WDIOS_DISABLECARD = 0x0001 +WDIOS_ENABLECARD = 0x0002 + class _timespec(ctypes.Structure): _fields_ = [ @@ -24,6 +39,7 @@ class _timespec(ctypes.Structure): ('tv_nsec', ctypes.c_long) ] + class Watchdog(WatchdogBase): """ Abstract base class for interfacing with a hardware watchdog module @@ -226,3 +242,142 @@ def get_remaining_time(self): return 0 + +class WatchdogTCO(WatchdogBase): + """ + Watchdog class for interfacing with iTCO watchdog + """ + + IDENTITY = "iTCO_wdt" + + def __init__(self): + + self.dev = None + self.dev_name = None + wd_sysfs_path = "/sys/class/watchdog" + + for dev_file in glob.glob("/dev/watchdog*"): + dev = os.path.basename(dev_file) + dev_identity = self._read_file("{}/{}/identity".format(wd_sysfs_path, dev)) + if dev_identity == self.IDENTITY: + self.dev_name = dev + break + + if self.dev_name is None: + raise RuntimeError("{} is not initialized".format(self.IDENTITY)) + + self.state_file = "{}/{}/state".format(wd_sysfs_path, self.dev_name) + self.timeout_file = "{}/{}/timeout".format(wd_sysfs_path, self.dev_name) + self.timeleft_file = "{}/{}/timeleft".format(wd_sysfs_path, self.dev_name) + + def __del__(self): + if self.dev is not None: + os.close(self.dev) + + def _ioctl(self, request, arg=0, mutate_flag=True): + """ + Perform ioctl on watchdog device + """ + self._open_wd_dev() + fcntl.ioctl(self.dev, request, arg, mutate_flag) + + def _open_wd_dev(self): + """ + Open watchdog device file + """ + if self.dev is None: + wd_dev = "/dev/{}".format(self.dev_name) + self.dev = os.open(wd_dev, os.O_RDWR) + + @staticmethod + def _read_file(file_path): + """ + Read a file + """ + try: + with open(file_path, "r") as fd: + read_str = fd.read() + except OSError: + return -1 + + return read_str.strip() + + def arm(self, seconds): + """ + Arm the hardware watchdog with a timeout of seconds. + If the watchdog is currently armed, calling this function will + simply reset the timer to the provided value. If the underlying + hardware does not support the value provided in , this + method should arm the watchdog with the *next greater* + available value. + + Returns: + An integer specifying the *actual* number of seconds the + watchdog was armed with. On failure returns -1. + """ + if seconds < 0 or seconds > 0x3ff: + return -1 + if seconds < 4: + seconds = 4 + + try: + timeout = int(self._read_file(self.timeout_file)) + if timeout != seconds: + buf = array.array('I', [seconds]) + self._ioctl(WDIOC_SETTIMEOUT, buf) + timeout = int(buf[0]) + + if self.is_armed(): + self._ioctl(WDIOC_KEEPALIVE) + else: + buf = array.array('h', [WDIOS_ENABLECARD]) + self._ioctl(WDIOC_SETOPTIONS, buf, False) + except OSError: + return -1 + else: + return timeout + + def disarm(self): + """ + Disarm the hardware watchdog + + Returns: + A boolean, True if watchdog is disarmed successfully, False + if not + """ + disarmed = True + if self.is_armed(): + try: + buf = array.array('h', [WDIOS_DISABLECARD]) + self._ioctl(WDIOC_SETOPTIONS, buf, False) + except OSError: + disarmed = False + + return disarmed + + def is_armed(self): + """ + Retrieves the armed state of the hardware watchdog. + + Returns: + A boolean, True if watchdog is armed, False if not + """ + state = self._read_file(self.state_file) + return state == "active" + + def get_remaining_time(self): + """ + If the watchdog is armed, retrieve the number of seconds + remaining on the watchdog timer + + Returns: + An integer specifying the number of seconds remaining on + their watchdog timer. If the watchdog is not armed, returns + -1. + + """ + timeleft = -1 + if self.is_armed(): + timeleft = int(self._read_file(self.timeleft_file)) + + return timeleft diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/systemd/s6100-i2c-enumerate.service b/platform/broadcom/sonic-platform-modules-dell/s6100/systemd/s6100-i2c-enumerate.service deleted file mode 100644 index c63482831940..000000000000 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/systemd/s6100-i2c-enumerate.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Dell S6100 I2C MUX Enumeration -Before=pmon.service -DefaultDependencies=no - -[Service] -Type=oneshot -ExecStart=/usr/local/bin/s6100_i2c_enumeration.sh init -RemainAfterExit=no - -[Install] -WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/systemd/s6100-platform-startup.service b/platform/broadcom/sonic-platform-modules-dell/s6100/systemd/s6100-platform-startup.service new file mode 100644 index 000000000000..d7a40f43033c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/systemd/s6100-platform-startup.service @@ -0,0 +1,12 @@ +[Unit] +Description=Dell S6100 Platform Startup Service +Before=pmon.service determine-reboot-cause.service +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/s6100_platform_startup.sh init +RemainAfterExit=no + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh index 8d564c6c2cd5..b6ef6581e8e8 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/scripts/z9100_platform.sh @@ -203,17 +203,10 @@ init_switch_port_led() { install_python_api_package() { device="/usr/share/sonic/device" platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) - - rv=$(pip install $device/$platform/sonic_platform-1.0-py2-none-any.whl) rv=$(pip3 install $device/$platform/sonic_platform-1.0-py3-none-any.whl) } remove_python_api_package() { - rv=$(pip show sonic-platform > /dev/null 2>/dev/null) - if [ $? -eq 0 ]; then - rv = $(pip uninstall -y sonic-platform > /dev/null 2>/dev/null) - fi - rv=$(pip3 show sonic-platform > /dev/null 2>/dev/null) if [ $? -eq 0 ]; then rv=$(pip3 uninstall -y sonic-platform > /dev/null 2>/dev/null) @@ -224,7 +217,7 @@ init_devnum if [[ "$1" == "init" ]]; then modprobe i2c-dev - modprobe i2c-mux-pca954x force_deselect_on_exit=1 + modprobe i2c-mux-pca954x modprobe dell_ich modprobe dell_mailbox modprobe dell_z9100_cpld diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/sfp.py index 7abe73c2be3d..59e6df1317c7 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/sfp.py @@ -11,398 +11,27 @@ try: import os import time - from sonic_platform_base.chassis_base import ChassisBase - from sonic_platform_base.sfp_base import SfpBase - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase except ImportError as e: raise ImportError(str(e) + "- required module not found") -PAGE_OFFSET = 0 -KEY_OFFSET = 1 -KEY_WIDTH = 2 -FUNC_NAME = 3 - -INFO_OFFSET = 128 -DOM_OFFSET = 0 -DOM_OFFSET1 = 384 - -cable_length_tup = ('Length(km)', 'Length OM3(2m)', 'Length OM2(m)', - 'Length OM1(m)', 'Length Cable Assembly(m)') - -compliance_code_tup = ( - '10/40G Ethernet Compliance Code', - 'SONET Compliance codes', - 'SAS/SATA compliance codes', - 'Gigabit Ethernet Compliant codes', - 'Fibre Channel link length/Transmitter Technology', - 'Fibre Channel transmission media', - 'Fibre Channel Speed') - -info_dict_keys = ['type', 'hardware_rev', 'serial', - 'manufacturer', 'model', 'connector', - 'encoding', 'ext_identifier', 'ext_rateselect_compliance', - 'cable_type', 'cable_length', 'nominal_bit_rate', - 'specification_compliance','type_abbrv_name','vendor_date', 'vendor_oui'] - -dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', - 'power_lpmode', 'tx_disable', 'tx_disable_channel', - 'temperature', 'voltage', 'rx1power', - 'rx2power', 'rx3power', 'rx4power', - 'tx1bias', 'tx2bias', 'tx3bias', - 'tx4bias', 'tx1power', 'tx2power', - 'tx3power', 'tx4power'] - -threshold_dict_keys = ['temphighalarm', 'temphighwarning', - 'templowalarm', 'templowwarning', - 'vcchighalarm', 'vcchighwarning', - 'vcclowalarm', 'vcclowwarning', - 'rxpowerhighalarm', 'rxpowerhighwarning', - 'rxpowerlowalarm', 'rxpowerlowwarning', - 'txpowerhighalarm', 'txpowerhighwarning', - 'txpowerlowalarm', 'txpowerlowwarning', - 'txbiashighalarm', 'txbiashighwarning', - 'txbiaslowalarm', 'txbiaslowwarning'] - -sff8436_parser = { - 'reset_status': [DOM_OFFSET, 2, 1, 'parse_dom_status_indicator'], - 'rx_los': [DOM_OFFSET, 3, 1, 'parse_dom_tx_rx_los'], - 'tx_fault': [DOM_OFFSET, 4, 1, 'parse_dom_tx_fault'], - 'tx_disable': [DOM_OFFSET, 86, 1, 'parse_dom_tx_disable'], - 'power_lpmode': [DOM_OFFSET, 93, 1, 'parse_dom_power_control'], - 'power_override': [DOM_OFFSET, 93, 1, 'parse_dom_power_control'], - 'Temperature': [DOM_OFFSET, 22, 2, 'parse_temperature'], - 'Voltage': [DOM_OFFSET, 26, 2, 'parse_voltage'], - 'ChannelMonitor': [DOM_OFFSET, 34, 16, 'parse_channel_monitor_params'], - - 'cable_type': [INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'cable_length': [INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'connector': [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'type': [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'encoding': [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'ext_identifier': [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'ext_rateselect_compliance': - [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'nominal_bit_rate': [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'specification_compliance': - [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'type_abbrv_name': [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'manufacturer': [INFO_OFFSET, 20, 16, 'parse_vendor_name'], - 'vendor_oui': [INFO_OFFSET, 37, 3, 'parse_vendor_oui'], - 'model': [INFO_OFFSET, 40, 16, 'parse_vendor_pn'], - 'hardware_rev': [INFO_OFFSET, 56, 2, 'parse_vendor_rev'], - 'serial': [INFO_OFFSET, 68, 16, 'parse_vendor_sn'], - 'vendor_date': [INFO_OFFSET, 84, 8, 'parse_vendor_date'], - 'ModuleThreshold': [DOM_OFFSET1, 128, 24, 'parse_module_threshold_values'], - 'ChannelThreshold': [DOM_OFFSET1, 176, 16, 'parse_channel_threshold_values'], -} - - -class Sfp(SfpBase): +class Sfp(SfpOptoeBase): """ DELLEMC Platform-specific Sfp class """ def __init__(self, index, sfp_type, eeprom_path, sfp_control, sfp_ctrl_idx): - SfpBase.__init__(self) + SfpOptoeBase.__init__(self) self.sfp_type = sfp_type self.index = index self.eeprom_path = eeprom_path self.sfp_control = sfp_control self.sfp_ctrl_idx = sfp_ctrl_idx - self.sfpInfo = sff8436InterfaceId() - self.sfpDomInfo = sff8436Dom() - def _read_eeprom_bytes(self, eeprom_path, offset, num_bytes): - eeprom_raw = [] - try: - eeprom = open(eeprom_path, mode="rb", buffering=0) - except IOError: - return None - - for i in range(0, num_bytes): - eeprom_raw.append("0x00") - - try: - eeprom.seek(offset) - raw = eeprom.read(num_bytes) - except IOError: - eeprom.close() - return None - - try: - for n in range(0, num_bytes): - eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) - except BaseException: - eeprom.close() - return None - - eeprom.close() - return eeprom_raw - - def _get_eeprom_data(self, eeprom_key): - eeprom_data = None - page_offset = None - - if (self.sfpInfo is None): - return None - - page_offset = sff8436_parser[eeprom_key][PAGE_OFFSET] - eeprom_data_raw = self._read_eeprom_bytes( - self.eeprom_path, - (sff8436_parser[eeprom_key][PAGE_OFFSET] + - sff8436_parser[eeprom_key][KEY_OFFSET]), - sff8436_parser[eeprom_key][KEY_WIDTH]) - if (eeprom_data_raw is not None): - # Offset 128 is used to retrieve sff8436InterfaceId Info - # Offset 0 is used to retrieve sff8436Dom Info - if (page_offset == 128): - eeprom_data = getattr( - self.sfpInfo, sff8436_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - eeprom_data = getattr( - self.sfpDomInfo, sff8436_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - - return eeprom_data - - def get_transceiver_info(self): - """ - Retrieves transceiver info of this SFP - """ - transceiver_info_dict = {} - compliance_code_dict = {} - transceiver_info_dict = dict.fromkeys(info_dict_keys, 'N/A') - - # BaseInformation - iface_data = self._get_eeprom_data('type') - if (iface_data is not None): - connector = iface_data['data']['Connector']['value'] - encoding = iface_data['data']['EncodingCodes']['value'] - ext_id = iface_data['data']['Extended Identifier']['value'] - rate_identifier = iface_data['data']['RateIdentifier']['value'] - identifier = iface_data['data']['type']['value'] - bit_rate = str( - iface_data['data']['Nominal Bit Rate(100Mbs)']['value']) - type_abbrv_name=iface_data['data']['type_abbrv_name']['value'] - - for key in compliance_code_tup: - if key in iface_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = iface_data['data']['Specification compliance']['value'][key]['value'] - for key in cable_length_tup: - if key in iface_data['data']: - cable_type = key - cable_length = str(iface_data['data'][key]['value']) - else: - return transceiver_info_dict - - # Vendor Date - vendor_date_data = self._get_eeprom_data('vendor_date') - if (vendor_date_data is not None): - vendor_date = vendor_date_data['data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] - else: - return transceiver_info_dict - - # Vendor Name - vendor_name_data = self._get_eeprom_data('manufacturer') - if (vendor_name_data is not None): - vendor_name = vendor_name_data['data']['Vendor Name']['value'] - else: - return transceiver_info_dict - - # Vendor OUI - vendor_oui_data = self._get_eeprom_data('vendor_oui') - if (vendor_oui_data is not None): - vendor_oui = vendor_oui_data['data']['Vendor OUI']['value'] - else: - return transceiver_info_dict - - # Vendor PN - vendor_pn_data = self._get_eeprom_data('model') - if (vendor_pn_data is not None): - vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] - else: - return transceiver_info_dict - - # Vendor Revision - vendor_rev_data = self._get_eeprom_data('hardware_rev') - if (vendor_rev_data is not None): - vendor_rev = vendor_rev_data['data']['Vendor Rev']['value'] - else: - return transceiver_info_dict - - # Vendor Serial Number - vendor_sn_data = self._get_eeprom_data('serial') - if (vendor_sn_data is not None): - vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] - else: - return transceiver_info_dict - - # Fill The Dictionary and return - transceiver_info_dict['type'] = identifier - transceiver_info_dict['hardware_rev'] = vendor_rev - transceiver_info_dict['serial'] = vendor_sn - transceiver_info_dict['manufacturer'] = vendor_name - transceiver_info_dict['model'] = vendor_pn - transceiver_info_dict['connector'] = connector - transceiver_info_dict['encoding'] = encoding - transceiver_info_dict['ext_identifier'] = ext_id - transceiver_info_dict['ext_rateselect_compliance'] = rate_identifier - transceiver_info_dict['cable_type'] = cable_type - transceiver_info_dict['cable_length'] = cable_length - transceiver_info_dict['nominal_bit_rate'] = bit_rate - transceiver_info_dict['specification_compliance'] = str( - compliance_code_dict) - transceiver_info_dict['vendor_date'] = vendor_date - transceiver_info_dict['vendor_oui'] = vendor_oui - transceiver_info_dict['type_abbrv_name'] = type_abbrv_name - - return transceiver_info_dict - - def get_transceiver_threshold_info(self): - """ - Retrieves transceiver threshold info of this SFP - """ - transceiver_dom_threshold_dict = {} - transceiver_dom_threshold_dict = dict.fromkeys( - threshold_dict_keys, 'N/A') - - # Module Threshold - module_threshold_data = self._get_eeprom_data('ModuleThreshold') - if (module_threshold_data is not None): - tempHighAlarm = module_threshold_data['data']['TempHighAlarm']['value'] - tempLowAlarm = module_threshold_data['data']['TempLowAlarm']['value'] - tempHighWarn = module_threshold_data['data']['TempHighWarning']['value'] - tempLowWarn = module_threshold_data['data']['TempLowWarning']['value'] - vccHighAlarm = module_threshold_data['data']['VccHighAlarm']['value'] - vccLowAlarm = module_threshold_data['data']['VccLowAlarm']['value'] - vccHighWarn = module_threshold_data['data']['VccHighWarning']['value'] - vccLowWarn = module_threshold_data['data']['VccLowWarning']['value'] - else: - return transceiver_dom_threshold_dict - - # Channel Threshold - channel_threshold_data = self._get_eeprom_data('ChannelThreshold') - if (channel_threshold_data is not None): - rxPowerHighAlarm = channel_threshold_data['data']['RxPowerHighAlarm']['value'] - rxPowerLowAlarm = channel_threshold_data['data']['RxPowerLowAlarm']['value'] - rxPowerHighWarn = channel_threshold_data['data']['RxPowerHighWarning']['value'] - rxPowerLowWarn = channel_threshold_data['data']['RxPowerLowWarning']['value'] - txBiasHighAlarm = channel_threshold_data['data']['TxBiasHighAlarm']['value'] - txBiasLowAlarm = channel_threshold_data['data']['TxBiasLowAlarm']['value'] - txBiasHighWarn = channel_threshold_data['data']['TxBiasHighWarning']['value'] - txBiasLowWarn = channel_threshold_data['data']['TxBiasLowWarning']['value'] - else: - return transceiver_dom_threshold_dict - - transceiver_dom_threshold_dict['temphighalarm'] = tempHighAlarm - transceiver_dom_threshold_dict['templowalarm'] = tempLowAlarm - transceiver_dom_threshold_dict['temphighwarning'] = tempHighWarn - transceiver_dom_threshold_dict['templowwarning'] = tempLowWarn - transceiver_dom_threshold_dict['vcchighalarm'] = vccHighAlarm - transceiver_dom_threshold_dict['vcclowalarm'] = vccLowAlarm - transceiver_dom_threshold_dict['vcchighwarning'] = vccHighWarn - transceiver_dom_threshold_dict['vcclowwarning'] = vccLowWarn - transceiver_dom_threshold_dict['rxpowerhighalarm'] = rxPowerHighAlarm - transceiver_dom_threshold_dict['rxpowerlowalarm'] = rxPowerLowAlarm - transceiver_dom_threshold_dict['rxpowerhighwarning'] = rxPowerHighWarn - transceiver_dom_threshold_dict['rxpowerlowwarning'] = rxPowerLowWarn - transceiver_dom_threshold_dict['txbiashighalarm'] = txBiasHighAlarm - transceiver_dom_threshold_dict['txbiaslowalarm'] = txBiasLowAlarm - transceiver_dom_threshold_dict['txbiashighwarning'] = txBiasHighWarn - transceiver_dom_threshold_dict['txbiaslowwarning'] = txBiasLowWarn - - return transceiver_dom_threshold_dict - - def get_transceiver_bulk_status(self): - """ - Retrieves transceiver bulk status of this SFP - """ - tx_bias_list = [] - rx_power_list = [] - transceiver_dom_dict = {} - transceiver_dom_dict = dict.fromkeys(dom_dict_keys, 'N/A') - - # RxLos - rx_los = self.get_rx_los() - - # TxFault - tx_fault = self.get_tx_fault() - - # ResetStatus - reset_state = self.get_reset_status() - - # LowPower Mode - lp_mode = self.get_lpmode() - - # TxDisable - tx_disable = self.get_tx_disable() - - # TxDisable Channel - tx_disable_channel = self.get_tx_disable_channel() - - # Temperature - temperature = self.get_temperature() - - # Voltage - voltage = self.get_voltage() - - # Channel Monitor - channel_monitor_data = self._get_eeprom_data('ChannelMonitor') - if (channel_monitor_data is not None): - tx_bias = channel_monitor_data['data']['TX1Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = channel_monitor_data['data']['TX2Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = channel_monitor_data['data']['TX3Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = channel_monitor_data['data']['TX4Bias']['value'] - tx_bias_list.append(tx_bias) - rx_power = channel_monitor_data['data']['RX1Power']['value'] - rx_power_list.append(rx_power) - rx_power = channel_monitor_data['data']['RX2Power']['value'] - rx_power_list.append(rx_power) - rx_power = channel_monitor_data['data']['RX3Power']['value'] - rx_power_list.append(rx_power) - rx_power = channel_monitor_data['data']['RX4Power']['value'] - rx_power_list.append(rx_power) - else: - return transceiver_dom_dict - - transceiver_dom_dict['rx_los'] = rx_los - transceiver_dom_dict['tx_fault'] = tx_fault - transceiver_dom_dict['reset_status'] = reset_state - transceiver_dom_dict['power_lpmode'] = lp_mode - transceiver_dom_dict['tx_disable'] = tx_disable - transceiver_dom_dict['tx_disable_channel'] = tx_disable_channel - transceiver_dom_dict['temperature'] = temperature - transceiver_dom_dict['voltage'] = voltage - transceiver_dom_dict['tx1bias'] = tx_bias_list[0] - transceiver_dom_dict['tx2bias'] = tx_bias_list[1] - transceiver_dom_dict['tx3bias'] = tx_bias_list[2] - transceiver_dom_dict['tx4bias'] = tx_bias_list[3] - transceiver_dom_dict['rx1power'] = rx_power_list[0] - transceiver_dom_dict['rx2power'] = rx_power_list[1] - transceiver_dom_dict['rx3power'] = rx_power_list[2] - transceiver_dom_dict['rx4power'] = rx_power_list[3] - - return transceiver_dom_dict - - def get_name(self): - """ - Retrieves the name of the sfp - Returns : QSFP or QSFP+ or QSFP28 - """ - iface_data = self._get_eeprom_data('type') - if (iface_data is not None): - identifier = iface_data['data']['type']['value'] - else: - return None - - return identifier + def get_eeprom_path(self): + return self.eeprom_path def get_presence(self): """ @@ -432,30 +61,6 @@ def get_presence(self): return False - def get_model(self): - """ - Retrieves the model number (or part number) of the sfp - """ - vendor_pn_data = self._get_eeprom_data('model') - if (vendor_pn_data is not None): - vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] - else: - return None - - return vendor_pn - - def get_serial(self): - """ - Retrieves the serial number of the sfp - """ - vendor_sn_data = self._get_eeprom_data('serial') - if (vendor_sn_data is not None): - vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] - else: - return None - - return vendor_sn - def get_reset_status(self): """ Retrieves the reset status of SFP @@ -485,159 +90,6 @@ def get_reset_status(self): return reset_status - def get_rx_los(self): - """ - Retrieves the RX LOS (lost-of-signal) status of SFP - """ - rx_los = None - rx_los_list = [] - - rx_los_data = self._get_eeprom_data('rx_los') - if (rx_los_data is not None): - rx_los = rx_los_data['data']['Rx1LOS']['value'] - if (rx_los is 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - rx_los = rx_los_data['data']['Rx2LOS']['value'] - if (rx_los is 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - rx_los = rx_los_data['data']['Rx3LOS']['value'] - if (rx_los is 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - rx_los = rx_los_data['data']['Rx4LOS']['value'] - if (rx_los is 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - - if (rx_los_list[0] and rx_los_list[1] - and rx_los_list[2] and rx_los_list[3]): - rx_los = True - else: - rx_los = False - - return rx_los - - def get_tx_fault(self): - """ - Retrieves the TX fault status of SFP - """ - tx_fault = None - tx_fault_list = [] - - tx_fault_data = self._get_eeprom_data('tx_fault') - if (tx_fault_data is not None): - tx_fault = tx_fault_data['data']['Tx1Fault']['value'] - if (tx_fault is 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - tx_fault = tx_fault_data['data']['Tx2Fault']['value'] - if (tx_fault is 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - tx_fault = tx_fault_data['data']['Tx3Fault']['value'] - if (tx_fault is 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - tx_fault = tx_fault_data['data']['Tx4Fault']['value'] - if (tx_fault is 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - - if (tx_fault_list[0] and tx_fault_list[1] - and tx_fault_list[2] and tx_fault_list[3]): - tx_fault = True - else: - tx_fault = False - - return tx_fault - - def get_tx_disable(self): - """ - Retrieves the tx_disable status of this SFP - """ - tx_disable = None - tx_disable_list = [] - - tx_disable_data = self._get_eeprom_data('tx_disable') - if (tx_disable_data is not None): - tx_disable = tx_disable_data['data']['Tx1Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - tx_disable = tx_disable_data['data']['Tx2Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - tx_disable = tx_disable_data['data']['Tx3Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - tx_disable = tx_disable_data['data']['Tx4Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - - if (tx_disable_list[0] and tx_disable_list[1] - and tx_disable_list[2] and tx_disable_list[3]): - tx_disable = True - else: - tx_disable = False - - return tx_disable - - def get_tx_disable_channel(self): - """ - Retrieves the TX disabled channels in this SFP - """ - tx_disable = None - tx_disable_list = [] - - tx_disable_data = self._get_eeprom_data('tx_disable') - if (tx_disable_data is not None): - tx_disable = tx_disable_data['data']['Tx1Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(1) - else: - tx_disable_list.append(0) - tx_disable = tx_disable_data['data']['Tx2Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(1) - else: - tx_disable_list.append(0) - tx_disable = tx_disable_data['data']['Tx3Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(1) - else: - tx_disable_list.append(0) - tx_disable = tx_disable_data['data']['Tx4Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(1) - else: - tx_disable_list.append(0) - - bit4 = int(tx_disable_list[3]) * 8 - bit3 = int(tx_disable_list[2]) * 4 - bit2 = int(tx_disable_list[1]) * 2 - bit1 = int(tx_disable_list[0]) * 1 - - tx_disable_channel = hex(bit4 + bit3 + bit2 + bit1) - - return tx_disable_channel - def get_lpmode(self): """ Retrieves the lpmode (low power mode) status of this SFP @@ -666,101 +118,6 @@ def get_lpmode(self): return lpmode_state - def get_power_override(self): - """ - Retrieves the power-override status of this SFP - """ - power_override_state = None - - # Reset Status - power_override_data = self._get_eeprom_data('power_override') - if (power_override_data is not None): - power_override = power_override_data['data']['PowerOverRide']['value'] - if (power_override is 'On'): - power_override_state = True - else: - power_override_state = False - - return power_override_state - - def get_temperature(self): - """ - Retrieves the temperature of this SFP - """ - temperature = None - - temperature_data = self._get_eeprom_data('Temperature') - if (temperature_data is not None): - temperature = temperature_data['data']['Temperature']['value'] - - return temperature - - def get_voltage(self): - """ - Retrieves the supply voltage of this SFP - """ - voltage = None - - voltage_data = self._get_eeprom_data('Voltage') - if (voltage_data is not None): - voltage = voltage_data['data']['Vcc']['value'] - - return voltage - - def get_tx_bias(self): - """ - Retrieves the TX bias current of this SFP - """ - tx_bias = None - tx_bias_list = [] - - tx_bias_data = self._get_eeprom_data('ChannelMonitor') - if (tx_bias_data is not None): - tx_bias = tx_bias_data['data']['TX1Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = tx_bias_data['data']['TX2Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = tx_bias_data['data']['TX3Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = tx_bias_data['data']['TX4Bias']['value'] - tx_bias_list.append(tx_bias) - - return tx_bias_list - - def get_rx_power(self): - """ - Retrieves the received optical power for this SFP - """ - rx_power = None - rx_power_list = [] - - rx_power_data = self._get_eeprom_data('ChannelMonitor') - if (rx_power_data is not None): - rx_power = rx_power_data['data']['RX1Power']['value'] - rx_power_list.append(rx_power) - rx_power = rx_power_data['data']['RX2Power']['value'] - rx_power_list.append(rx_power) - rx_power = rx_power_data['data']['RX3Power']['value'] - rx_power_list.append(rx_power) - rx_power = rx_power_data['data']['RX4Power']['value'] - rx_power_list.append(rx_power) - - return rx_power_list - - - def get_tx_power(self): - """ - Retrieves the TX power of this SFP - """ - tx_power = None - tx_power_list = [] - - tx_power_list.append('-infdBm') - tx_power_list.append('-infdBm') - tx_power_list.append('-infdBm') - tx_power_list.append('-infdBm') - - return tx_power_list def reset(self): """ @@ -843,40 +200,3 @@ def set_lpmode(self, lpmode): reg_file.close() return True - - def tx_disable(self, tx_disable): - """ - Disable SFP TX for all channels - """ - return False - - def tx_disable_channel(self, channel, disable): - """ - Sets the tx_disable for specified SFP channels - """ - return False - - def tx_disable_channel(self, channel, disable): - """ - Sets the tx_disable for specified SFP channels - """ - return False - - def set_power_override(self, power_override, power_set): - """ - Sets SFP power level using power_override and power_set - """ - return False - - def get_status(self): - """ - Retrieves the operational status of the device - """ - reset = self.get_reset_status() - - if (reset == True): - status = False - else: - status = True - - return status diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/modules/dell_z9264f_fpga_ocores.c b/platform/broadcom/sonic-platform-modules-dell/z9264f/modules/dell_z9264f_fpga_ocores.c index c3bd78131e87..8287f67c34f0 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9264f/modules/dell_z9264f_fpga_ocores.c +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/modules/dell_z9264f_fpga_ocores.c @@ -1072,7 +1072,7 @@ static int map_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev) /* map the device memory or IO region into kernel virtual * address space */ - fpgapci->bar[i] = ioremap_nocache (bar_start + FPGALOGIC_I2C_BASE, I2C_PCI_MAX_BUS * FPGALOGIC_CH_OFFSET); + fpgapci->bar[i] = ioremap (bar_start + FPGALOGIC_I2C_BASE, I2C_PCI_MAX_BUS * FPGALOGIC_CH_OFFSET); if (!fpgapci->bar[i]) { PRINT ( "Could not map BAR #%d.\n", i); @@ -1086,7 +1086,7 @@ static int map_bars(struct fpgapci_dev *fpgapci, struct pci_dev *dev) { fpga_phys_addr = bar_start; - fpga_ctl_addr = ioremap_nocache (bar_start, FPGA_CTL_REG_SIZE); + fpga_ctl_addr = ioremap (bar_start, FPGA_CTL_REG_SIZE); fpga_base_addr = fpgapci->bar[i]; } diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/z9264f_platform.sh b/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/z9264f_platform.sh index 8469b844757b..8974f174fac4 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/z9264f_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/scripts/z9264f_platform.sh @@ -140,17 +140,10 @@ init_switch_port_led() { install_python_api_package() { device="/usr/share/sonic/device" platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) - - rv=$(pip install $device/$platform/sonic_platform-1.0-py2-none-any.whl) rv=$(pip3 install $device/$platform/sonic_platform-1.0-py3-none-any.whl) } remove_python_api_package() { - rv=$(pip show sonic-platform > /dev/null 2>/dev/null) - if [ $? -eq 0 ]; then - rv=$(pip uninstall -y sonic-platform > /dev/null 2>/dev/null) - fi - rv=$(pip3 show sonic-platform > /dev/null 2>/dev/null) if [ $? -eq 0 ]; then rv=$(pip3 uninstall -y sonic-platform > /dev/null 2>/dev/null) @@ -218,9 +211,9 @@ init_devnum if [ "$1" == "init" ]; then modprobe i2c-dev - modprobe i2c-mux-pca954x force_deselect_on_exit=1 + modprobe i2c-mux-pca954x modprobe ipmi_devintf - modprobe ipmi_si + modprobe ipmi_si kipmid_max_busy_us=3000 modprobe i2c_ocores modprobe dell_z9264f_fpga_ocores sys_eeprom "new_device" @@ -233,13 +226,27 @@ if [ "$1" == "init" ]; then install_python_api_package /usr/bin/port_irq_enable.py platform_firmware_versions - + echo -2 > /sys/bus/i2c/drivers/pca954x/603-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/604-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/605-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/606-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/607-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/608-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/609-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/610-0074/idle_state + echo -2 > /sys/bus/i2c/drivers/pca954x/611-0074/idle_state elif [ "$1" == "deinit" ]; then sys_eeprom "delete_device" switch_board_qsfp "delete_device" switch_board_qsfp_mux "delete_device" switch_board_sfp "delete_device" + + modprobe -r dell_z9264f_fpga_ocores + modprobe -r i2c_ocores + modprobe -r acpi_ipmi + modprobe -r ipmi_si + modprobe -r ipmi_devintf modprobe -r i2c-mux-pca954x modprobe -r i2c-dev remove_python_api_package diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/chassis.py index 78e8dea999c8..9430f918f963 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/chassis.py @@ -120,6 +120,7 @@ def _check_interrupts(self, port_dict): is_port_dict_updated = True self._global_port_pres_dict[port_num] = '1' port_dict[port_num] = '1' + self.get_sfp(port_num)._initialize_media(delay=True) elif(not presence and (self._global_port_pres_dict[port_num] == '1')): is_port_dict_updated = True self._global_port_pres_dict[port_num] = '0' diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/sfp.py index d6d3e59b5891..2e20fa9e0e0e 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/sfp.py @@ -13,145 +13,27 @@ import time import struct import mmap - from sonic_platform_base.sfp_base import SfpBase - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom - from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId - from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom - from sonic_platform_base.sonic_sfp.sff8472 import sffbase + import subprocess + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase except ImportError as e: raise ImportError(str(e) + "- required module not found") -PAGE_OFFSET = 0 -KEY_OFFSET = 1 -KEY_WIDTH = 2 -FUNC_NAME = 3 +SFP_TYPE_LIST = [ + '0x3' # SFP/SFP+/SFP28 and later +] -QSFP_INFO_OFFSET = 128 -QSFP_DOM_OFFSET = 0 -QSFP_DOM_OFFSET1 = 384 +QSFP_TYPE_LIST = [ + '0xc', # QSFP + '0xd', # QSFP+ or later + '0x11' # QSFP28 or later +] -SFP_INFO_OFFSET = 0 -SFP_DOM_OFFSET = 256 +QSFP_DD_TYPE_LIST = [ + '0x18' #QSFP-DD Type +] -SFP_STATUS_CONTROL_OFFSET = 110 -SFP_STATUS_CONTROL_WIDTH = 7 -SFP_TX_DISABLE_HARD_BIT = 7 -SFP_TX_DISABLE_SOFT_BIT = 6 - -qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)', 'Length OM2(m)', - 'Length OM1(m)', 'Length Cable Assembly(m)') - -qsfp_compliance_code_tup = ( - '10/40G Ethernet Compliance Code', - 'SONET Compliance codes', - 'SAS/SATA compliance codes', - 'Gigabit Ethernet Compliant codes', - 'Fibre Channel link length/Transmitter Technology', - 'Fibre Channel transmission media', - 'Fibre Channel Speed') - -sfp_cable_length_tup = ('LengthSMFkm-UnitsOfKm', 'LengthSMF(UnitsOf100m)', - 'Length50um(UnitsOf10m)', 'Length62.5um(UnitsOfm)', - 'LengthOM3(UnitsOf10m)', 'LengthCable(UnitsOfm)') - -sfp_compliance_code_tup = ('10GEthernetComplianceCode', 'InfinibandComplianceCode', - 'ESCONComplianceCodes', 'SONETComplianceCodes', - 'EthernetComplianceCodes', 'FibreChannelLinkLength', - 'FibreChannelTechnology', 'SFP+CableTechnology', - 'FibreChannelTransmissionMedia', 'FibreChannelSpeed') - -info_dict_keys = ['type', 'hardware_rev', 'serial', - 'manufacturer', 'model', 'connector', - 'encoding', 'ext_identifier', 'ext_rateselect_compliance', - 'cable_type', 'cable_length', 'nominal_bit_rate', - 'specification_compliance', 'type_abbrv_name','vendor_date', 'vendor_oui'] - -dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', - 'power_lpmode', 'tx_disable', 'tx_disable_channel', - 'temperature', 'voltage', 'rx1power', - 'rx2power', 'rx3power', 'rx4power', - 'tx1bias', 'tx2bias', 'tx3bias', - 'tx4bias', 'tx1power', 'tx2power', - 'tx3power', 'tx4power'] - -threshold_dict_keys = ['temphighalarm', 'temphighwarning', - 'templowalarm', 'templowwarning', - 'vcchighalarm', 'vcchighwarning', - 'vcclowalarm', 'vcclowwarning', - 'rxpowerhighalarm', 'rxpowerhighwarning', - 'rxpowerlowalarm', 'rxpowerlowwarning', - 'txpowerhighalarm', 'txpowerhighwarning', - 'txpowerlowalarm', 'txpowerlowwarning', - 'txbiashighalarm', 'txbiashighwarning', - 'txbiaslowalarm', 'txbiaslowwarning'] - -sff8436_parser = { - 'reset_status': [QSFP_DOM_OFFSET, 2, 1, 'parse_dom_status_indicator'], - 'rx_los': [QSFP_DOM_OFFSET, 3, 1, 'parse_dom_tx_rx_los'], - 'tx_fault': [QSFP_DOM_OFFSET, 4, 1, 'parse_dom_tx_fault'], - 'tx_disable': [QSFP_DOM_OFFSET, 86, 1, 'parse_dom_tx_disable'], - 'power_lpmode': [QSFP_DOM_OFFSET, 93, 1, 'parse_dom_power_control'], - 'power_override': [QSFP_DOM_OFFSET, 93, 1, 'parse_dom_power_control'], - 'Temperature': [QSFP_DOM_OFFSET, 22, 2, 'parse_temperature'], - 'Voltage': [QSFP_DOM_OFFSET, 26, 2, 'parse_voltage'], - 'ChannelMonitor': [QSFP_DOM_OFFSET, 34, 16, 'parse_channel_monitor_params'], - 'ChannelMonitor_TxPower': - [QSFP_DOM_OFFSET, 34, 24, 'parse_channel_monitor_params_with_tx_power'], - - 'cable_type': [QSFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'cable_length': [QSFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'connector': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'type': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'encoding': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'ext_identifier': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'ext_rateselect_compliance': - [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'nominal_bit_rate': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'specification_compliance': - [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'type_abbrv_name': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'manufacturer': [QSFP_INFO_OFFSET, 20, 16, 'parse_vendor_name'], - 'vendor_oui': [QSFP_INFO_OFFSET, 37, 3, 'parse_vendor_oui'], - 'model': [QSFP_INFO_OFFSET, 40, 16, 'parse_vendor_pn'], - 'hardware_rev': [QSFP_INFO_OFFSET, 56, 2, 'parse_vendor_rev'], - 'serial': [QSFP_INFO_OFFSET, 68, 16, 'parse_vendor_sn'], - 'vendor_date': [QSFP_INFO_OFFSET, 84, 8, 'parse_vendor_date'], - 'dom_capability': [QSFP_INFO_OFFSET, 92, 1, 'parse_dom_capability'], - 'dom_rev': [QSFP_DOM_OFFSET, 1, 1, 'parse_sfp_dom_rev'], - 'ModuleThreshold': [QSFP_DOM_OFFSET1, 128, 24, 'parse_module_threshold_values'], - 'ChannelThreshold': [QSFP_DOM_OFFSET1, 176, 16, 'parse_channel_threshold_values'], -} - -sff8472_parser = { - 'Temperature': [SFP_DOM_OFFSET, 96, 2, 'parse_temperature'], - 'Voltage': [SFP_DOM_OFFSET, 98, 2, 'parse_voltage'], - 'ChannelMonitor': [SFP_DOM_OFFSET, 100, 6, 'parse_channel_monitor_params'], - - 'cable_type': [SFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'cable_length': [SFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'connector': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'type': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'encoding': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'ext_identifier': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'ext_rateselect_compliance': - [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'nominal_bit_rate': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'specification_compliance': - [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'type_abbrv_name': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'manufacturer': [SFP_INFO_OFFSET, 20, 16, 'parse_vendor_name'], - 'vendor_oui': [SFP_INFO_OFFSET, 37, 3, 'parse_vendor_oui'], - 'model': [SFP_INFO_OFFSET, 40, 16, 'parse_vendor_pn'], - 'hardware_rev': [SFP_INFO_OFFSET, 56, 4, 'parse_vendor_rev'], - 'serial': [SFP_INFO_OFFSET, 68, 16, 'parse_vendor_sn'], - 'vendor_date': [SFP_INFO_OFFSET, 84, 8, 'parse_vendor_date'], - 'ModuleThreshold': [SFP_DOM_OFFSET, 0, 56, 'parse_alarm_warning_threshold'], -} - - -class Sfp(SfpBase): +class Sfp(SfpOptoeBase): """ DELLEMC Platform-specific Sfp class """ @@ -159,14 +41,17 @@ class Sfp(SfpBase): OIR_FD_PATH = "/sys/bus/pci/devices/0000:04:00.0/port_msi" def __init__(self, index, sfp_type, eeprom_path): - SfpBase.__init__(self) + SfpOptoeBase.__init__(self) self.sfp_type = sfp_type self.index = index self.eeprom_path = eeprom_path - self.qsfpInfo = sff8436InterfaceId() - self.qsfpDomInfo = sff8436Dom() - self.sfpInfo = sff8472InterfaceId() - self.sfpDomInfo = sff8472Dom(None,1) + self._initialize_media(delay=False) + + def get_eeprom_path(self): + return self.eeprom_path + + def get_name(self): + return "QSFP28 or later" if self.index < 65 else "SFP/SFP+/SFP28" def pci_mem_read(self, mm, offset): mm.seek(offset) @@ -197,337 +82,17 @@ def pci_get_value(self, resource, offset): os.close(fd) return val - def _read_eeprom_bytes(self, eeprom_path, offset, num_bytes): - eeprom_raw = [] - try: - eeprom = open(eeprom_path, mode="rb", buffering=0) - except IOError: - return None - - for i in range(0, num_bytes): - eeprom_raw.append("0x00") - - try: - eeprom.seek(offset) - raw = eeprom.read(num_bytes) - except IOError: - eeprom.close() - return None - - try: - if isinstance(raw , str): - for n in range(0, num_bytes): - eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) - else: - for n in range(0, num_bytes): - eeprom_raw[n] = hex(raw[n])[2:].zfill(2) - - except BaseException: - eeprom.close() - return None - - eeprom.close() - return eeprom_raw - - def _get_eeprom_data(self, eeprom_key): - eeprom_data = None - page_offset = None - - if(self.sfp_type == 'QSFP'): - page_offset = sff8436_parser[eeprom_key][PAGE_OFFSET] - eeprom_data_raw = self._read_eeprom_bytes( - self.eeprom_path, - (sff8436_parser[eeprom_key][PAGE_OFFSET] + - sff8436_parser[eeprom_key][KEY_OFFSET]), - sff8436_parser[eeprom_key][KEY_WIDTH]) - if (eeprom_data_raw is not None): - # Offset 128 is used to retrieve sff8436InterfaceId Info - # Offset 0 is used to retrieve sff8436Dom Info - if (page_offset == 128): - if ( self.qsfpInfo is None): - return None - eeprom_data = getattr( - self.qsfpInfo, sff8436_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - if ( self.qsfpDomInfo is None): - return None - eeprom_data = getattr( - self.qsfpDomInfo, sff8436_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - page_offset = sff8472_parser[eeprom_key][PAGE_OFFSET] - eeprom_data_raw = self._read_eeprom_bytes( - self.eeprom_path, - (sff8472_parser[eeprom_key][PAGE_OFFSET] + - sff8472_parser[eeprom_key][KEY_OFFSET]), - sff8472_parser[eeprom_key][KEY_WIDTH]) - if (eeprom_data_raw is not None): - # Offset 0 is used to retrieve sff8472InterfaceId Info - # Offset 256 is used to retrieve sff8472Dom Info - if (page_offset == 0): - if ( self.sfpInfo is None): - return None - eeprom_data = getattr( - self.sfpInfo, sff8472_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - if ( self.sfpDomInfo is None): - return None - eeprom_data = getattr( - self.sfpDomInfo, sff8472_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - - return eeprom_data - - def get_transceiver_info(self): - """ - Retrieves transceiver info of this SFP - """ - transceiver_info_dict = {} - compliance_code_dict = {} - transceiver_info_dict = dict.fromkeys(info_dict_keys, 'N/A') - # BaseInformation - iface_data = self._get_eeprom_data('type') - if (iface_data is not None): - connector = iface_data['data']['Connector']['value'] - encoding = iface_data['data']['EncodingCodes']['value'] - ext_id = iface_data['data']['Extended Identifier']['value'] - rate_identifier = iface_data['data']['RateIdentifier']['value'] - identifier = iface_data['data']['type']['value'] - type_abbrv_name=iface_data['data']['type_abbrv_name']['value'] - if(self.sfp_type == 'QSFP'): - bit_rate = str( - iface_data['data']['Nominal Bit Rate(100Mbs)']['value']) - for key in qsfp_compliance_code_tup: - if key in iface_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = iface_data['data']['Specification compliance']['value'][key]['value'] - for key in qsfp_cable_length_tup: - if key in iface_data['data']: - cable_type = key - cable_length = str(iface_data['data'][key]['value']) - else: - bit_rate = str( - iface_data['data']['NominalSignallingRate(UnitsOf100Mbd)']['value']) - for key in sfp_compliance_code_tup: - if key in iface_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = iface_data['data']['Specification compliance']['value'][key]['value'] - for key in sfp_cable_length_tup: - if key in iface_data['data']: - cable_type = key - cable_length = str(iface_data['data'][key]['value']) - else: - return transceiver_info_dict - - # Vendor Date - vendor_date_data = self._get_eeprom_data('vendor_date') - if (vendor_date_data is not None): - vendor_date = vendor_date_data['data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] - else: - return transceiver_info_dict - - # Vendor Name - vendor_name_data = self._get_eeprom_data('manufacturer') - if (vendor_name_data is not None): - vendor_name = vendor_name_data['data']['Vendor Name']['value'] - else: - return transceiver_info_dict - - # Vendor OUI - vendor_oui_data = self._get_eeprom_data('vendor_oui') - if (vendor_oui_data is not None): - vendor_oui = vendor_oui_data['data']['Vendor OUI']['value'] - else: - return transceiver_info_dict - - # Vendor PN - vendor_pn_data = self._get_eeprom_data('model') - if (vendor_pn_data is not None): - vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] - else: - return transceiver_info_dict - - # Vendor Revision - vendor_rev_data = self._get_eeprom_data('hardware_rev') - if (vendor_rev_data is not None): - vendor_rev = vendor_rev_data['data']['Vendor Rev']['value'] - else: - return transceiver_info_dict - - # Vendor Serial Number - vendor_sn_data = self._get_eeprom_data('serial') - if (vendor_sn_data is not None): - vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] - else: - return transceiver_info_dict - - # Fill The Dictionary and return - transceiver_info_dict['type'] = identifier - transceiver_info_dict['hardware_rev'] = vendor_rev - transceiver_info_dict['serial'] = vendor_sn - transceiver_info_dict['manufacturer'] = vendor_name - transceiver_info_dict['model'] = vendor_pn - transceiver_info_dict['connector'] = connector - transceiver_info_dict['encoding'] = encoding - transceiver_info_dict['ext_identifier'] = ext_id - transceiver_info_dict['ext_rateselect_compliance'] = rate_identifier - transceiver_info_dict['cable_type'] = cable_type - transceiver_info_dict['cable_length'] = cable_length - transceiver_info_dict['nominal_bit_rate'] = bit_rate - transceiver_info_dict['specification_compliance'] = str(compliance_code_dict) - transceiver_info_dict['vendor_date'] = vendor_date - transceiver_info_dict['vendor_oui'] = vendor_oui - transceiver_info_dict['type_abbrv_name']=type_abbrv_name - - return transceiver_info_dict - - def get_transceiver_threshold_info(self): + def _initialize_media(self,delay=False): """ - Retrieves transceiver threshold info of this SFP + Initialize the media type and eeprom driver for SFP """ - transceiver_dom_threshold_dict = {} - transceiver_dom_threshold_dict = dict.fromkeys( - threshold_dict_keys, 'N/A') - - # Module Threshold - module_threshold_data = self._get_eeprom_data('ModuleThreshold') - if (self.sfp_type == 'QSFP'): - # Channel Threshold - channel_threshold_data = self._get_eeprom_data('ChannelThreshold') - - if (channel_threshold_data is not None and module_threshold_data is not None): - transceiver_dom_threshold_dict['temphighalarm'] = module_threshold_data['data']['TempHighAlarm']['value'] - transceiver_dom_threshold_dict['temphighwarning'] = module_threshold_data['data']['TempHighWarning']['value'] - transceiver_dom_threshold_dict['templowalarm'] = module_threshold_data['data']['TempLowAlarm']['value'] - transceiver_dom_threshold_dict['templowwarning'] = module_threshold_data['data']['TempLowWarning']['value'] - transceiver_dom_threshold_dict['vcchighalarm'] = module_threshold_data['data']['VccHighAlarm']['value'] - transceiver_dom_threshold_dict['vcchighwarning'] = module_threshold_data['data']['VccHighWarning']['value'] - transceiver_dom_threshold_dict['vcclowalarm'] = module_threshold_data['data']['VccLowAlarm']['value'] - transceiver_dom_threshold_dict['vcclowwarning'] = module_threshold_data['data']['VccLowWarning']['value'] - transceiver_dom_threshold_dict['rxpowerhighalarm'] = channel_threshold_data['data']['RxPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerhighwarning'] = channel_threshold_data['data']['RxPowerHighWarning']['value'] - transceiver_dom_threshold_dict['rxpowerlowalarm'] = channel_threshold_data['data']['RxPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerlowwarning'] = channel_threshold_data['data']['RxPowerLowWarning']['value'] - transceiver_dom_threshold_dict['txbiashighalarm'] = channel_threshold_data['data']['TxBiasHighAlarm']['value'] - transceiver_dom_threshold_dict['txbiashighwarning'] = channel_threshold_data['data']['TxBiasHighWarning']['value'] - transceiver_dom_threshold_dict['txbiaslowalarm'] = channel_threshold_data['data']['TxBiasLowAlarm']['value'] - transceiver_dom_threshold_dict['txbiaslowwarning'] = channel_threshold_data['data']['TxBiasLowWarning']['value'] - - else: - return transceiver_dom_threshold_dict - else: - #SFP - if (module_threshold_data is not None): - #Threshold Data - transceiver_dom_threshold_dict['temphighalarm'] = module_threshold_data['data']['TempHighAlarm']['value'] - transceiver_dom_threshold_dict['templowalarm'] = module_threshold_data['data']['TempLowAlarm']['value'] - transceiver_dom_threshold_dict['temphighwarning'] = module_threshold_data['data']['TempHighWarning']['value'] - transceiver_dom_threshold_dict['templowwarning'] = module_threshold_data['data']['TempLowWarning']['value'] - transceiver_dom_threshold_dict['vcchighalarm'] = module_threshold_data['data']['VoltageHighAlarm']['value'] - transceiver_dom_threshold_dict['vcclowalarm'] = module_threshold_data['data']['VoltageLowAlarm']['value'] - transceiver_dom_threshold_dict['vcchighwarning'] = module_threshold_data['data']['VoltageHighWarning']['value'] - transceiver_dom_threshold_dict['vcclowwarning'] = module_threshold_data['data']['VoltageLowWarning']['value'] - transceiver_dom_threshold_dict['txbiashighalarm'] = module_threshold_data['data']['BiasHighAlarm']['value'] - transceiver_dom_threshold_dict['txbiaslowalarm'] = module_threshold_data['data']['BiasLowAlarm']['value'] - transceiver_dom_threshold_dict['txbiashighwarning'] = module_threshold_data['data']['BiasHighWarning']['value'] - transceiver_dom_threshold_dict['txbiaslowwarning'] = module_threshold_data['data']['BiasLowWarning']['value'] - transceiver_dom_threshold_dict['txpowerhighalarm'] = module_threshold_data['data']['TXPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['txpowerlowalarm'] = module_threshold_data['data']['TXPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['txpowerhighwarning'] = module_threshold_data['data']['TXPowerHighWarning']['value'] - transceiver_dom_threshold_dict['txpowerlowwarning'] = module_threshold_data['data']['TXPowerLowWarning']['value'] - transceiver_dom_threshold_dict['rxpowerhighalarm'] = module_threshold_data['data']['RXPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerlowalarm'] = module_threshold_data['data']['RXPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerhighwarning'] = module_threshold_data['data']['RXPowerHighWarning']['value'] - transceiver_dom_threshold_dict['rxpowerlowwarning'] = module_threshold_data['data']['RXPowerLowWarning']['value'] - else: - return transceiver_dom_threshold_dict - - return transceiver_dom_threshold_dict - - def get_transceiver_bulk_status(self): - """ - Retrieves transceiver bulk status of this SFP - """ - tx_bias_list = [] - rx_power_list = [] - transceiver_dom_dict = {} - transceiver_dom_dict = dict.fromkeys(dom_dict_keys, 'N/A') - - # RxLos - rx_los = self.get_rx_los() - - # TxFault - tx_fault = self.get_tx_fault() - - # ResetStatus - reset_state = self.get_reset_status() - - # LowPower Mode - lp_mode = self.get_lpmode() - - # TxDisable - tx_disable = self.get_tx_disable() - - # TxDisable Channel - tx_disable_channel = self.get_tx_disable_channel() - - # Temperature - temperature = self.get_temperature() - - # Voltage - voltage = self.get_voltage() - - # Channel Monitor - tx_power_list = self.get_tx_power() - - # tx bias - tx_bias_list = self.get_tx_bias() - - # rx power - rx_power_list = self.get_rx_power() - - if (len(tx_bias_list) != 0): - transceiver_dom_dict['tx1bias'] = tx_bias_list[0] - transceiver_dom_dict['tx2bias'] = tx_bias_list[1] - transceiver_dom_dict['tx3bias'] = tx_bias_list[2] - transceiver_dom_dict['tx4bias'] = tx_bias_list[3] - - if (len(rx_power_list) != 0): - transceiver_dom_dict['rx1power'] = rx_power_list[0] - transceiver_dom_dict['rx2power'] = rx_power_list[1] - transceiver_dom_dict['rx3power'] = rx_power_list[2] - transceiver_dom_dict['rx4power'] = rx_power_list[3] - - if (len(tx_power_list) != 0): - transceiver_dom_dict['tx1power'] = tx_power_list[0] - transceiver_dom_dict['tx2power'] = tx_power_list[1] - transceiver_dom_dict['tx3power'] = tx_power_list[2] - transceiver_dom_dict['tx4power'] = tx_power_list[3] - - transceiver_dom_dict['rx_los'] = rx_los - transceiver_dom_dict['tx_fault'] = tx_fault - transceiver_dom_dict['reset_status'] = reset_state - transceiver_dom_dict['power_lpmode'] = lp_mode - transceiver_dom_dict['tx_disable'] = tx_disable - transceiver_dom_dict['tx_disable_channel'] = tx_disable_channel - transceiver_dom_dict['temperature'] = temperature - transceiver_dom_dict['voltage'] = voltage - - return transceiver_dom_dict - - def get_name(self): - """ - Retrieves the name of the sfp - Returns : QSFP or QSFP+ or QSFP28 - """ - - iface_data = self._get_eeprom_data('type') - if (iface_data is not None): - identifier = iface_data['data']['type']['value'] - else: - return None + if delay: + time.sleep(1) + self._xcvr_api = None + self.get_xcvr_api() - return identifier + self.set_media_type() + self.reinit_sfp_driver() def get_presence(self): """ @@ -535,60 +100,27 @@ def get_presence(self): Returns : True if sfp is present and false if it is absent """ # Check for invalid port_num - + mask = {'QSFP' : (1 << 4), 'SFP' : (1 << 0)} # Port offset starts with 0x4004 port_offset = 16388 + ((self.index-1) * 16) - status = self.pci_get_value(self.BASE_RES_PATH, port_offset) - reg_value = int(status) - - # Absence of status throws error - if (reg_value == ""): - return False - - # Mask off 4th bit for presence - if(self.sfp_type == 'QSFP'): - mask = (1 << 4) - - # Mask off 1st bit for presence 65,66 - if (self.sfp_type == 'SFP'): - mask = (1 << 0) - # ModPrsL is active low - if reg_value & mask == 0: - return True + try: + status = self.pci_get_value(self.BASE_RES_PATH, port_offset) + reg_value = int(status) + # ModPrsL is active low + if reg_value & mask[self.port_type] == 0: + return True + except ValueError: + pass return False - def get_model(self): - """ - Retrieves the model number (or part number) of the sfp - """ - vendor_pn_data = self._get_eeprom_data('model') - if (vendor_pn_data is not None): - vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] - else: - return None - - return vendor_pn - - def get_serial(self): - """ - Retrieves the serial number of the sfp - """ - vendor_sn_data = self._get_eeprom_data('serial') - if (vendor_sn_data is not None): - vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] - else: - return None - - return vendor_sn - def get_reset_status(self): """ Retrives the reset status of SFP """ reset_status = False - if (self.sfp_type == 'QSFP'): + if (self.port_type == 'QSFP'): # Port offset starts with 0x4000 port_offset = 16384 + ((self.index-1) * 16) @@ -609,187 +141,12 @@ def get_reset_status(self): return reset_status - def get_rx_los(self): - """ - Retrieves the RX LOS (lost-of-signal) status of SFP - """ - rx_los = None - rx_los_list = [] - if (self.sfp_type == 'QSFP'): - rx_los_data = self._get_eeprom_data('rx_los') - if (rx_los_data is not None): - rx_los = rx_los_data['data']['Rx1LOS']['value'] - if (rx_los is 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - rx_los = rx_los_data['data']['Rx2LOS']['value'] - if (rx_los is 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - rx_los = rx_los_data['data']['Rx3LOS']['value'] - if (rx_los is 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - rx_los = rx_los_data['data']['Rx4LOS']['value'] - if (rx_los is 'On'): - rx_los_list.append(True) - else: - rx_los_list.append(False) - - if (rx_los_list[0] and rx_los_list[1] - and rx_los_list[2] and rx_los_list[3]): - rx_los = True - else: - rx_los = False - else: - rx_los_data = self._read_eeprom_bytes(self.eeprom_path, SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - if (rx_los_data is not None): - data = int(rx_los_data[0], 16) - rx_los = (sffbase().test_bit(data, 1) != 0) - - return rx_los - - def get_tx_fault(self): - """ - Retrieves the TX fault status of SFP - """ - tx_fault = None - tx_fault_list = [] - if (self.sfp_type == 'QSFP'): - tx_fault_data = self._get_eeprom_data('tx_fault') - if (tx_fault_data is not None): - tx_fault = tx_fault_data['data']['Tx1Fault']['value'] - if (tx_fault is 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - tx_fault = tx_fault_data['data']['Tx2Fault']['value'] - if (tx_fault is 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - tx_fault = tx_fault_data['data']['Tx3Fault']['value'] - if (tx_fault is 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - tx_fault = tx_fault_data['data']['Tx4Fault']['value'] - if (tx_fault is 'On'): - tx_fault_list.append(True) - else: - tx_fault_list.append(False) - - if (tx_fault_list[0] and tx_fault_list[1] - and tx_fault_list[2] and tx_fault_list[3]): - tx_fault = True - else: - tx_fault = False - - else: - tx_fault_data = self._read_eeprom_bytes(self.eeprom_path, SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - if (tx_fault_data is not None): - data = int(tx_fault_data[0], 16) - tx_fault = (sffbase().test_bit(data, 2) != 0) - - return tx_fault - - def get_tx_disable(self): - """ - Retrieves the tx_disable status of this SFP - """ - tx_disable = None - tx_disable_list = [] - if (self.sfp_type == 'QSFP'): - tx_disable_data = self._get_eeprom_data('tx_disable') - if (tx_disable_data is not None): - tx_disable = tx_disable_data['data']['Tx1Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - tx_disable = tx_disable_data['data']['Tx2Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - tx_disable = tx_disable_data['data']['Tx3Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - tx_disable = tx_disable_data['data']['Tx4Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(True) - else: - tx_disable_list.append(False) - - if (tx_disable_list[0] and tx_disable_list[1] - and tx_disable_list[2] and tx_disable_list[3]): - tx_disable = True - else: - tx_disable = False - - else: - tx_disable_data = self._read_eeprom_bytes(self.eeprom_path, SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - if (tx_disable_data is not None): - data = int(tx_disable_data[0], 16) - tx_disable_hard = (sffbase().test_bit(data, SFP_TX_DISABLE_HARD_BIT) != 0) - tx_disable_soft = (sffbase().test_bit(data, SFP_TX_DISABLE_SOFT_BIT) != 0) - tx_disable = tx_disable_hard | tx_disable_soft - - - return tx_disable - - def get_tx_disable_channel(self): - """ - Retrieves the TX disabled channels in this SFP - """ - tx_disable = None - tx_disable_list = [] - tx_disable_channel = 0 - - if (self.sfp_type == 'QSFP'): - tx_disable_data = self._get_eeprom_data('tx_disable') - if (tx_disable_data is not None): - tx_disable = tx_disable_data['data']['Tx1Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(1) - else: - tx_disable_list.append(0) - tx_disable = tx_disable_data['data']['Tx2Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(1) - else: - tx_disable_list.append(0) - tx_disable = tx_disable_data['data']['Tx3Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(1) - else: - tx_disable_list.append(0) - tx_disable = tx_disable_data['data']['Tx4Disable']['value'] - if (tx_disable is 'On'): - tx_disable_list.append(1) - else: - tx_disable_list.append(0) - - bit4 = int(tx_disable_list[3]) * 8 - bit3 = int(tx_disable_list[2]) * 4 - bit2 = int(tx_disable_list[1]) * 2 - bit1 = int(tx_disable_list[0]) * 1 - - tx_disable_channel = hex(bit4 + bit3 + bit2 + bit1) - - return tx_disable_channel - def get_lpmode(self): """ Retrieves the lpmode(low power mode) of this SFP """ lpmode_state = False - if (self.sfp_type == 'QSFP'): + if (self.port_type == 'QSFP'): # Port offset starts with 0x4000 port_offset = 16384 + ((self.index-1) * 16) @@ -812,149 +169,11 @@ def get_lpmode(self): return lpmode_state - def get_power_override(self): - """ - Retrieves the power-override status of this SFP - """ - power_override_state = False - - if (self.sfp_type == 'QSFP'): - power_override_data = self._get_eeprom_data('power_override') - if (power_override_data is not None): - power_override = power_override_data['data']['PowerOverRide']['value'] - if (power_override is 'On'): - power_override_state = True - else: - power_override_state = False - - return power_override_state - - def get_temperature(self): - """ - Retrieves the temperature of this SFP - """ - temperature = None - - temperature_data = self._get_eeprom_data('Temperature') - if (temperature_data is not None): - temperature = temperature_data['data']['Temperature']['value'] - - return temperature - - def get_voltage(self): - """ - Retrieves the supply voltage of this SFP - """ - voltage = None - - voltage_data = self._get_eeprom_data('Voltage') - if (voltage_data is not None): - voltage = voltage_data['data']['Vcc']['value'] - - return voltage - - def get_tx_bias(self): - """ - Retrieves the TX bias current of this SFP - """ - tx_bias = None - tx_bias_list = [] - - tx_bias_data = self._get_eeprom_data('ChannelMonitor') - if (tx_bias_data is not None): - if (self.sfp_type == 'QSFP'): - tx_bias = tx_bias_data['data']['TX1Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = tx_bias_data['data']['TX2Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = tx_bias_data['data']['TX3Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = tx_bias_data['data']['TX4Bias']['value'] - tx_bias_list.append(tx_bias) - else: - tx1_bias = tx_bias_data['data']['TXBias']['value'] - return [tx1_bias, "N/A", "N/A", "N/A"] - - return tx_bias_list - - def get_rx_power(self): - """ - Retrieves the received optical power for this SFP - """ - rx_power = None - rx_power_list = [] - - rx_power_data = self._get_eeprom_data('ChannelMonitor') - if (rx_power_data is not None): - if (self.sfp_type == 'QSFP'): - rx_power = rx_power_data['data']['RX1Power']['value'] - rx_power_list.append(rx_power) - rx_power = rx_power_data['data']['RX2Power']['value'] - rx_power_list.append(rx_power) - rx_power = rx_power_data['data']['RX3Power']['value'] - rx_power_list.append(rx_power) - rx_power = rx_power_data['data']['RX4Power']['value'] - rx_power_list.append(rx_power) - else: - rx1_pw = rx_power_data['data']['RXPower']['value'] - return [rx1_pw, "N/A", "N/A", "N/A"] - - return rx_power_list - - def get_tx_power(self): - """ - Retrieves the TX power of this SFP - """ - tx_power_list = [] - if(self.sfp_type == 'QSFP'): - # QSFP capability byte parse, through this byte can know whether it support tx_power or not. - # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, - # need to add more code for determining the capability and version compliance - # in SFF-8636 dom capability definitions evolving with the versions. - qspf_dom_capability_data = self._get_eeprom_data('dom_capability') - qsfp_dom_rev_data = self._get_eeprom_data('dom_rev') - if (qspf_dom_capability_data is not None and qsfp_dom_rev_data is not None): - qsfp_dom_rev = qsfp_dom_rev_data['data']['dom_rev']['value'] - qsfp_tx_power_support = qspf_dom_capability_data['data']['Tx_power_support']['value'] - else: - return tx_power_list - - # The tx_power monitoring is only available on QSFP which compliant with SFF-8636 - # and claimed that it support tx_power with one indicator bit. - if (qsfp_dom_rev[0:8] != 'SFF-8636' or (qsfp_dom_rev[0:8] == 'SFF-8636' and qsfp_tx_power_support != 'on')): - return tx_power_list - else: - channel_monitor_data = self._get_eeprom_data('ChannelMonitor_TxPower') - if (channel_monitor_data is not None): - tx1_pw = channel_monitor_data['data']['TX1Power']['value'] - tx2_pw = channel_monitor_data['data']['TX2Power']['value'] - tx3_pw = channel_monitor_data['data']['TX3Power']['value'] - tx4_pw = channel_monitor_data['data']['TX4Power']['value'] - else: - return tx_power_list - - else: - channel_monitor_data = self._get_eeprom_data('ChannelMonitor') - if (channel_monitor_data is not None): - tx1_pw = channel_monitor_data['data']['TXPower']['value'] - tx2_pw = 'N/A' - tx3_pw = 'N/A' - tx4_pw = 'N/A' - else: - return tx_power_list - - tx_power_list.append(tx1_pw) - tx_power_list.append(tx2_pw) - tx_power_list.append(tx3_pw) - tx_power_list.append(tx4_pw) - - return tx_power_list - def reset(self): """ Reset the SFP and returns all user settings to their default state """ - if (self.sfp_type == 'QSFP'): + if (self.port_type == 'QSFP'): # Port offset starts with 0x4000 port_offset = 16384 + ((self.index-1) * 16) @@ -991,7 +210,7 @@ def set_lpmode(self, lpmode): """ Sets the lpmode(low power mode) of this SFP """ - if (self.sfp_type == 'QSFP'): + if (self.port_type == 'QSFP'): # Port offset starts with 0x4000 port_offset = 16384 + ((self.index-1) * 16) @@ -1019,24 +238,6 @@ def set_lpmode(self, lpmode): else: return False - def tx_disable(self, tx_disable): - """ - Disable SFP TX for all channels - """ - return False - - def tx_disable_channel(self, channel, disable): - """ - Sets the tx_disable for specified SFP channels - """ - return False - - def set_power_override(self, power_override, power_set): - """ - Sets SFP power level using power_override and power_set - """ - return False - def get_status(self): """ Retrieves the operational status of the device @@ -1049,3 +250,70 @@ def get_status(self): status = True return status + + def set_media_type(self): + """ + Reads optic eeprom byte to determine media type inserted + """ + eeprom_raw = [] + eeprom_raw = self._xcvr_api_factory._get_id() + if eeprom_raw is not None: + eeprom_raw = hex(eeprom_raw) + if eeprom_raw in SFP_TYPE_LIST: + self.sfp_type = 'SFP' + elif eeprom_raw in QSFP_TYPE_LIST: + self.sfp_type = 'QSFP' + elif eeprom_raw in QSFP_DD_TYPE_LIST: + self.sfp_type = 'QSFP_DD' + else: + #Set native port type if EEPROM type is not recognized/readable + self.sfp_type = self.port_type + else: + self.sfp_type = self.port_type + + return self.sfp_type + + def reinit_sfp_driver(self): + """ + Changes the driver based on media type detected + """ + del_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/delete_device".format(self.index+1) + new_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/new_device".format(self.index+1) + driver_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/name".format(self.index+1) + delete_device = "echo 0x50 >" + del_sfp_path + + if not os.path.isfile(driver_path): + print(driver_path, "does not exist") + return False + + try: + with os.fdopen(os.open(driver_path, os.O_RDONLY)) as fd: + driver_name = fd.read() + driver_name = driver_name.rstrip('\r\n') + driver_name = driver_name.lstrip(" ") + + #Avoid re-initialization of the QSFP/SFP optic on QSFP/SFP port. + if self.sfp_type == 'SFP' and driver_name in ['optoe1', 'optoe3']: + subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + time.sleep(0.2) + new_device = "echo optoe2 0x50 >" + new_sfp_path + subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + time.sleep(2) + elif self.sfp_type == 'QSFP' and driver_name in ['optoe2', 'optoe3']: + subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + time.sleep(0.2) + new_device = "echo optoe1 0x50 >" + new_sfp_path + subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + time.sleep(2) + elif self.sfp_type == 'QSFP_DD' and driver_name in ['optoe1', 'optoe2']: + subprocess.Popen(delete_device, shell=True, stdout=subprocess.PIPE) + time.sleep(0.2) + new_device = "echo optoe3 0x50 >" + new_sfp_path + subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) + time.sleep(2) + + except IOError as e: + print("Error: Unable to open file: %s" % str(e)) + return False + + return True diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/modules/Makefile b/platform/broadcom/sonic-platform-modules-dell/z9332f/modules/Makefile index bb71bb0d9185..d83845f5748c 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/modules/Makefile @@ -1,4 +1,5 @@ obj-m += cls-switchboard.o obj-m += cls-i2c-ocore.o +obj-m += cls-i2c-mux-pca954x.o obj-m += mc24lc64t.o diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/modules/cls-i2c-mux-pca954x.c b/platform/broadcom/sonic-platform-modules-dell/z9332f/modules/cls-i2c-mux-pca954x.c new file mode 100644 index 000000000000..71b635f32645 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/modules/cls-i2c-mux-pca954x.c @@ -0,0 +1,579 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * I2C multiplexer + * + * Copyright (c) 2008-2009 Rodolfo Giometti + * Copyright (c) 2008-2009 Eurotech S.p.A. + * + * This module supports the PCA954x and PCA984x series of I2C multiplexer/switch + * chips made by NXP Semiconductors. + * This includes the: + * PCA9540, PCA9542, PCA9543, PCA9544, PCA9545, PCA9546, PCA9547, + * PCA9548, PCA9846, PCA9847, PCA9848 and PCA9849. + * + * These chips are all controlled via the I2C bus itself, and all have a + * single 8-bit register. The upstream "parent" bus fans out to two, + * four, or eight downstream busses or channels; which of these + * are selected is determined by the chip type and register contents. A + * mux can select only one sub-bus at a time; a switch can select any + * combination simultaneously. + * + * Based on: + * pca954x.c from Kumar Gala + * Copyright (C) 2006 + * + * Based on: + * pca954x.c from Ken Harrenstien + * Copyright (C) 2004 Google, Inc. (Ken Harrenstien) + * + * Based on: + * i2c-virtual_cb.c from Brian Kuschak + * and + * pca9540.c from Jean Delvare . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "cls-pca954x.h" + +#define PCA954X_MAX_NCHANS 8 + +#define PCA954X_IRQ_OFFSET 4 + +enum pca_type { + pca_9540, + pca_9542, + pca_9543, + pca_9544, + pca_9545, + pca_9546, + pca_9547, + pca_9548, + pca_9846, + pca_9847, + pca_9848, + pca_9849, +}; + +struct chip_desc { + u8 nchans; + u8 enable; /* used for muxes only */ + u8 has_irq; + enum muxtype { + pca954x_ismux = 0, + pca954x_isswi + } muxtype; + struct i2c_device_identity id; +}; + +struct pca954x { + const struct chip_desc *chip; + + u8 last_chan; /* last register value */ + /* MUX_IDLE_AS_IS, MUX_IDLE_DISCONNECT or >= 0 for channel */ + s32 idle_state; + + struct i2c_client *client; + + struct irq_domain *irq; + unsigned int irq_mask; + raw_spinlock_t lock; +}; + +/* Provide specs for the PCA954x types we know about */ +static const struct chip_desc chips[] = { + [pca_9540] = { + .nchans = 2, + .enable = 0x4, + .muxtype = pca954x_ismux, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9542] = { + .nchans = 2, + .enable = 0x4, + .has_irq = 1, + .muxtype = pca954x_ismux, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9543] = { + .nchans = 2, + .has_irq = 1, + .muxtype = pca954x_isswi, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9544] = { + .nchans = 4, + .enable = 0x4, + .has_irq = 1, + .muxtype = pca954x_ismux, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9545] = { + .nchans = 4, + .has_irq = 1, + .muxtype = pca954x_isswi, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9546] = { + .nchans = 4, + .muxtype = pca954x_isswi, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9547] = { + .nchans = 8, + .enable = 0x8, + .muxtype = pca954x_ismux, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9548] = { + .nchans = 8, + .muxtype = pca954x_isswi, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9846] = { + .nchans = 4, + .muxtype = pca954x_isswi, + .id = { + .manufacturer_id = I2C_DEVICE_ID_NXP_SEMICONDUCTORS, + .part_id = 0x10b, + }, + }, + [pca_9847] = { + .nchans = 8, + .enable = 0x8, + .muxtype = pca954x_ismux, + .id = { + .manufacturer_id = I2C_DEVICE_ID_NXP_SEMICONDUCTORS, + .part_id = 0x108, + }, + }, + [pca_9848] = { + .nchans = 8, + .muxtype = pca954x_isswi, + .id = { + .manufacturer_id = I2C_DEVICE_ID_NXP_SEMICONDUCTORS, + .part_id = 0x10a, + }, + }, + [pca_9849] = { + .nchans = 4, + .enable = 0x4, + .muxtype = pca954x_ismux, + .id = { + .manufacturer_id = I2C_DEVICE_ID_NXP_SEMICONDUCTORS, + .part_id = 0x109, + }, + }, +}; + +static const struct i2c_device_id pca954x_id[] = { + { "cls_pca9540", pca_9540 }, + { "cls_pca9542", pca_9542 }, + { "cls_pca9543", pca_9543 }, + { "cls_pca9544", pca_9544 }, + { "cls_pca9545", pca_9545 }, + { "cls_pca9546", pca_9546 }, + { "cls_pca9547", pca_9547 }, + { "cls_pca9548", pca_9548 }, + { "cls_pca9846", pca_9846 }, + { "cls_pca9847", pca_9847 }, + { "cls_pca9848", pca_9848 }, + { "cls_pca9849", pca_9849 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, pca954x_id); + +static const struct of_device_id pca954x_of_match[] = { + { .compatible = "nxp,cls_pca9540", .data = &chips[pca_9540] }, + { .compatible = "nxp,cls_pca9542", .data = &chips[pca_9542] }, + { .compatible = "nxp,cls_pca9543", .data = &chips[pca_9543] }, + { .compatible = "nxp,cls_pca9544", .data = &chips[pca_9544] }, + { .compatible = "nxp,cls_pca9545", .data = &chips[pca_9545] }, + { .compatible = "nxp,cls_pca9546", .data = &chips[pca_9546] }, + { .compatible = "nxp,cls_pca9547", .data = &chips[pca_9547] }, + { .compatible = "nxp,cls_pca9548", .data = &chips[pca_9548] }, + { .compatible = "nxp,cls_pca9846", .data = &chips[pca_9846] }, + { .compatible = "nxp,cls_pca9847", .data = &chips[pca_9847] }, + { .compatible = "nxp,cls_pca9848", .data = &chips[pca_9848] }, + { .compatible = "nxp,cls_pca9849", .data = &chips[pca_9849] }, + {} +}; +MODULE_DEVICE_TABLE(of, pca954x_of_match); + +/* Write to mux register. Don't use i2c_transfer()/i2c_smbus_xfer() + for this as they will try to lock adapter a second time */ +static int pca954x_reg_write(struct i2c_adapter *adap, + struct i2c_client *client, u8 val) +{ + union i2c_smbus_data dummy; + + return __i2c_smbus_xfer(adap, client->addr, client->flags, + I2C_SMBUS_WRITE, val, + I2C_SMBUS_BYTE, &dummy); +} + +static u8 pca954x_regval(struct pca954x *data, u8 chan) +{ + /* We make switches look like muxes, not sure how to be smarter. */ + if (data->chip->muxtype == pca954x_ismux) + return chan | data->chip->enable; + else + return 1 << chan; +} + +static int pca954x_select_chan(struct i2c_mux_core *muxc, u32 chan) +{ + struct pca954x *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + u8 regval; + int ret = 0; + + regval = pca954x_regval(data, chan); + /* Only select the channel if its different from the last channel */ + if (data->last_chan != regval) { + ret = pca954x_reg_write(muxc->parent, client, regval); + data->last_chan = ret < 0 ? 0 : regval; + } + + return ret; +} + +static int pca954x_deselect_mux(struct i2c_mux_core *muxc, u32 chan) +{ + struct pca954x *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + s32 idle_state; + + idle_state = READ_ONCE(data->idle_state); + if (idle_state >= 0) + /* Set the mux back to a predetermined channel */ + return pca954x_select_chan(muxc, idle_state); + + if (idle_state == MUX_IDLE_DISCONNECT) { + /* Deselect active channel */ + data->last_chan = 0; + return pca954x_reg_write(muxc->parent, client, + data->last_chan); + } + + /* otherwise leave as-is */ + + return 0; +} + +static ssize_t idle_state_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct pca954x *data = i2c_mux_priv(muxc); + + return sprintf(buf, "%d\n", READ_ONCE(data->idle_state)); +} + +static ssize_t idle_state_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct pca954x *data = i2c_mux_priv(muxc); + int val; + int ret; + + ret = kstrtoint(buf, 0, &val); + if (ret < 0) + return ret; + + if (val != MUX_IDLE_AS_IS && val != MUX_IDLE_DISCONNECT && + (val < 0 || val >= data->chip->nchans)) + return -EINVAL; + + i2c_lock_bus(muxc->parent, I2C_LOCK_SEGMENT); + + WRITE_ONCE(data->idle_state, val); + /* + * Set the mux into a state consistent with the new + * idle_state. + */ + if (data->last_chan || val != MUX_IDLE_DISCONNECT) + ret = pca954x_deselect_mux(muxc, 0); + + i2c_unlock_bus(muxc->parent, I2C_LOCK_SEGMENT); + + return ret < 0 ? ret : count; +} + +static DEVICE_ATTR_RW(idle_state); + +static irqreturn_t pca954x_irq_handler(int irq, void *dev_id) +{ + struct pca954x *data = dev_id; + unsigned long pending; + int ret, i; + + ret = i2c_smbus_read_byte(data->client); + if (ret < 0) + return IRQ_NONE; + + pending = (ret >> PCA954X_IRQ_OFFSET) & (BIT(data->chip->nchans) - 1); + for_each_set_bit(i, &pending, data->chip->nchans) + handle_nested_irq(irq_linear_revmap(data->irq, i)); + + return IRQ_RETVAL(pending); +} + +static int pca954x_irq_set_type(struct irq_data *idata, unsigned int type) +{ + if ((type & IRQ_TYPE_SENSE_MASK) != IRQ_TYPE_LEVEL_LOW) + return -EINVAL; + return 0; +} + +static struct irq_chip pca954x_irq_chip = { + .name = "i2c-mux-pca954x", + .irq_set_type = pca954x_irq_set_type, +}; + +static int pca954x_irq_setup(struct i2c_mux_core *muxc) +{ + struct pca954x *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + int c, irq; + + if (!data->chip->has_irq || client->irq <= 0) + return 0; + + raw_spin_lock_init(&data->lock); + + data->irq = irq_domain_add_linear(client->dev.of_node, + data->chip->nchans, + &irq_domain_simple_ops, data); + if (!data->irq) + return -ENODEV; + + for (c = 0; c < data->chip->nchans; c++) { + irq = irq_create_mapping(data->irq, c); + if (!irq) { + dev_err(&client->dev, "failed irq create map\n"); + return -EINVAL; + } + irq_set_chip_data(irq, data); + irq_set_chip_and_handler(irq, &pca954x_irq_chip, + handle_simple_irq); + } + + return 0; +} + +static void pca954x_cleanup(struct i2c_mux_core *muxc) +{ + struct pca954x *data = i2c_mux_priv(muxc); + int c, irq; + + if (data->irq) { + for (c = 0; c < data->chip->nchans; c++) { + irq = irq_find_mapping(data->irq, c); + irq_dispose_mapping(irq); + } + irq_domain_remove(data->irq); + } + i2c_mux_del_adapters(muxc); +} + +static int pca954x_init(struct i2c_client *client, struct pca954x *data) +{ + int ret; + + if (data->idle_state >= 0) + data->last_chan = pca954x_regval(data, data->idle_state); + else + data->last_chan = 0; /* Disconnect multiplexer */ + + ret = i2c_smbus_write_byte(client, data->last_chan); + if (ret < 0) + data->last_chan = 0; + + return ret; +} + +/* + * I2C init/probing/exit functions + */ +static int pca954x_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct i2c_adapter *adap = client->adapter; + struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev); + struct device *dev = &client->dev; + struct gpio_desc *gpio; + struct i2c_mux_core *muxc; + struct pca954x *data; + int num, force; + int ret; + + if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE)) + return -ENODEV; + + muxc = i2c_mux_alloc(adap, dev, PCA954X_MAX_NCHANS, sizeof(*data), 0, + pca954x_select_chan, pca954x_deselect_mux); + if (!muxc) + return -ENOMEM; + data = i2c_mux_priv(muxc); + + i2c_set_clientdata(client, muxc); + data->client = client; + + /* Reset the mux if a reset GPIO is specified. */ + gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(gpio)) + return PTR_ERR(gpio); + if (gpio) { + udelay(1); + gpiod_set_value_cansleep(gpio, 0); + /* Give the chip some time to recover. */ + udelay(1); + } + + data->chip = device_get_match_data(dev); + if (!data->chip) + data->chip = &chips[id->driver_data]; + + if (data->chip->id.manufacturer_id != I2C_DEVICE_ID_NONE) { + struct i2c_device_identity id; + + ret = i2c_get_device_id(client, &id); + if (ret && ret != -EOPNOTSUPP) + return ret; + + if (!ret && + (id.manufacturer_id != data->chip->id.manufacturer_id || + id.part_id != data->chip->id.part_id)) { + dev_warn(dev, "unexpected device id %03x-%03x-%x\n", + id.manufacturer_id, id.part_id, + id.die_revision); + return -ENODEV; + } + } + + data->idle_state = MUX_IDLE_AS_IS; + if (device_property_read_u32(dev, "idle-state", &data->idle_state)) { + if (device_property_read_bool(dev, "i2c-mux-idle-disconnect")) + data->idle_state = MUX_IDLE_DISCONNECT; + } + + /* + * Write the mux register at addr to verify + * that the mux is in fact present. This also + * initializes the mux to a channel + * or disconnected state. + */ + ret = pca954x_init(client, data); + if (ret < 0) { + dev_warn(dev, "probe failed\n"); + return -ENODEV; + } + + ret = pca954x_irq_setup(muxc); + if (ret) + goto fail_cleanup; + + /* Now create an adapter for each channel */ + for (num = 0; num < data->chip->nchans; num++) { + force = 0; /* dynamic adap number */ + if (pdata) { + if (num < pdata->num_modes) { + /* force static number */ + force = pdata->modes[num].adap_id; + } else + /* discard unconfigured channels */ + break; + } + + ret = i2c_mux_add_adapter(muxc, force, num, 0); + if (ret) + goto fail_cleanup; + } + + if (data->irq) { + ret = devm_request_threaded_irq(dev, data->client->irq, + NULL, pca954x_irq_handler, + IRQF_ONESHOT | IRQF_SHARED, + "pca954x", data); + if (ret) + goto fail_cleanup; + } + + /* + * The attr probably isn't going to be needed in most cases, + * so don't fail completely on error. + */ + device_create_file(dev, &dev_attr_idle_state); + + dev_info(dev, "registered %d multiplexed busses for I2C %s %s\n", + num, data->chip->muxtype == pca954x_ismux + ? "mux" : "switch", client->name); + + return 0; + +fail_cleanup: + pca954x_cleanup(muxc); + return ret; +} + +static int pca954x_remove(struct i2c_client *client) +{ + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + + device_remove_file(&client->dev, &dev_attr_idle_state); + + pca954x_cleanup(muxc); + return 0; +} + +#ifdef CONFIG_PM_SLEEP +static int pca954x_resume(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct pca954x *data = i2c_mux_priv(muxc); + int ret; + + ret = pca954x_init(client, data); + if (ret < 0) + dev_err(&client->dev, "failed to verify mux presence\n"); + + return ret; +} +#endif + +static SIMPLE_DEV_PM_OPS(pca954x_pm, NULL, pca954x_resume); + +static struct i2c_driver pca954x_driver = { + .driver = { + .name = "cls_pca954x", + .pm = &pca954x_pm, + .of_match_table = pca954x_of_match, + }, + .probe = pca954x_probe, + .remove = pca954x_remove, + .id_table = pca954x_id, +}; + +module_i2c_driver(pca954x_driver); + +MODULE_AUTHOR("Rodolfo Giometti "); +MODULE_DESCRIPTION("PCA954x I2C mux/switch driver"); +MODULE_LICENSE("GPL v2"); diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/modules/cls-i2c-ocore.c b/platform/broadcom/sonic-platform-modules-dell/z9332f/modules/cls-i2c-ocore.c index c80757e6619d..fe3c241f6702 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/modules/cls-i2c-ocore.c +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/modules/cls-i2c-ocore.c @@ -722,7 +722,7 @@ static int ocores_i2c_probe(struct platform_device *pdev) init_waitqueue_head(&i2c->wait); - irq = platform_get_irq(pdev, 0); + irq = platform_get_irq_optional(pdev, 0); if (irq == -ENXIO) { i2c->flags |= OCORES_FLAG_POLL; } else { @@ -758,7 +758,7 @@ static int ocores_i2c_probe(struct platform_device *pdev) /* add in known devices to the bus */ if (pdata) { for (i = 0; i < pdata->num_devices; i++) - i2c_new_device(&i2c->adap, pdata->devices + i); + i2c_new_client_device(&i2c->adap, pdata->devices + i); } return 0; diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/modules/cls-pca954x.h b/platform/broadcom/sonic-platform-modules-dell/z9332f/modules/cls-pca954x.h new file mode 100644 index 000000000000..15b9fe414677 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/modules/cls-pca954x.h @@ -0,0 +1,44 @@ +/* + * + * cls-pca954x.h - I2C multiplexer/switch support + * + * Copyright (c) 2008-2009 Rodolfo Giometti + * Copyright (c) 2008-2009 Eurotech S.p.A. + * Michael Lawnick + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#ifndef _LINUX_I2C_PCA954X_H +#define _LINUX_I2C_PCA954X_H + +/* Platform data for the PCA954x I2C multiplexers */ + +/* Per channel initialisation data: + * @adap_id: bus number for the adapter. 0 = don't care + * + */ +struct pca954x_platform_mode { + int adap_id; +}; + +/* Per mux/switch data, used with i2c_register_board_info */ +struct pca954x_platform_data { + struct pca954x_platform_mode *modes; + int num_modes; +}; + +#endif /* _LINUX_I2C_PCA954X_H */ \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/modules/cls-switchboard.c b/platform/broadcom/sonic-platform-modules-dell/z9332f/modules/cls-switchboard.c index dc1cf8874e39..80d0ef9021d8 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/modules/cls-switchboard.c +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/modules/cls-switchboard.c @@ -21,14 +21,14 @@ #include #include #include -#include #include "cls-i2c-ocore.h" +#include "cls-pca954x.h" -#define MOD_VERSION "2.1.0-1" +#define MOD_VERSION "2.2.0" #define DRV_NAME "cls-switchboard" -#define I2C_MUX_CHANNEL(_ch, _adap_id, _deselect) \ - [_ch] = { .adap_id = _adap_id, .deselect_on_exit = _deselect } +#define I2C_MUX_CHANNEL(_ch, _adap_id) \ + [_ch] = { .adap_id = _adap_id } #define FPGA_PCIE_DEVICE_ID 0x7021 #define MMIO_BAR 0 @@ -72,47 +72,47 @@ struct switchbrd_priv { // NOTE: Silverstone i2c channel mapping is very wierd!!! /* PCA9548 channel config on MASTER BUS 3 */ static struct pca954x_platform_mode i2c_mux_70_modes[] = { - I2C_MUX_CHANNEL(5, I2C_BUS_OFS + 23, true), - I2C_MUX_CHANNEL(6, I2C_BUS_OFS + 26, true), - I2C_MUX_CHANNEL(0, I2C_BUS_OFS + 27, true), - I2C_MUX_CHANNEL(7, I2C_BUS_OFS + 28, true), - I2C_MUX_CHANNEL(2, I2C_BUS_OFS + 29, true), - I2C_MUX_CHANNEL(4, I2C_BUS_OFS + 30, true), - I2C_MUX_CHANNEL(3, I2C_BUS_OFS + 31, true), - I2C_MUX_CHANNEL(1, I2C_BUS_OFS + 32, true), + I2C_MUX_CHANNEL(5, I2C_BUS_OFS + 23), + I2C_MUX_CHANNEL(6, I2C_BUS_OFS + 26), + I2C_MUX_CHANNEL(0, I2C_BUS_OFS + 27), + I2C_MUX_CHANNEL(7, I2C_BUS_OFS + 28), + I2C_MUX_CHANNEL(2, I2C_BUS_OFS + 29), + I2C_MUX_CHANNEL(4, I2C_BUS_OFS + 30), + I2C_MUX_CHANNEL(3, I2C_BUS_OFS + 31), + I2C_MUX_CHANNEL(1, I2C_BUS_OFS + 32), }; static struct pca954x_platform_mode i2c_mux_71_modes[] = { - I2C_MUX_CHANNEL(2, I2C_BUS_OFS + 1, true), - I2C_MUX_CHANNEL(3, I2C_BUS_OFS + 2, true), - I2C_MUX_CHANNEL(0, I2C_BUS_OFS + 3, true), - I2C_MUX_CHANNEL(1, I2C_BUS_OFS + 4, true), - I2C_MUX_CHANNEL(6, I2C_BUS_OFS + 5, true), - I2C_MUX_CHANNEL(5, I2C_BUS_OFS + 6, true), - I2C_MUX_CHANNEL(7, I2C_BUS_OFS + 15, true), - I2C_MUX_CHANNEL(4, I2C_BUS_OFS + 8, true), + I2C_MUX_CHANNEL(2, I2C_BUS_OFS + 1), + I2C_MUX_CHANNEL(3, I2C_BUS_OFS + 2), + I2C_MUX_CHANNEL(0, I2C_BUS_OFS + 3), + I2C_MUX_CHANNEL(1, I2C_BUS_OFS + 4), + I2C_MUX_CHANNEL(6, I2C_BUS_OFS + 5), + I2C_MUX_CHANNEL(5, I2C_BUS_OFS + 6), + I2C_MUX_CHANNEL(7, I2C_BUS_OFS + 15), + I2C_MUX_CHANNEL(4, I2C_BUS_OFS + 8), }; static struct pca954x_platform_mode i2c_mux_72_modes[] = { - I2C_MUX_CHANNEL(1, I2C_BUS_OFS + 17, true), - I2C_MUX_CHANNEL(7, I2C_BUS_OFS + 18, true), - I2C_MUX_CHANNEL(4, I2C_BUS_OFS + 19, true), - I2C_MUX_CHANNEL(0, I2C_BUS_OFS + 20, true), - I2C_MUX_CHANNEL(5, I2C_BUS_OFS + 21, true), - I2C_MUX_CHANNEL(2, I2C_BUS_OFS + 22, true), - I2C_MUX_CHANNEL(3, I2C_BUS_OFS + 25, true), - I2C_MUX_CHANNEL(6, I2C_BUS_OFS + 24, true), + I2C_MUX_CHANNEL(1, I2C_BUS_OFS + 17), + I2C_MUX_CHANNEL(7, I2C_BUS_OFS + 18), + I2C_MUX_CHANNEL(4, I2C_BUS_OFS + 19), + I2C_MUX_CHANNEL(0, I2C_BUS_OFS + 20), + I2C_MUX_CHANNEL(5, I2C_BUS_OFS + 21), + I2C_MUX_CHANNEL(2, I2C_BUS_OFS + 22), + I2C_MUX_CHANNEL(3, I2C_BUS_OFS + 25), + I2C_MUX_CHANNEL(6, I2C_BUS_OFS + 24), }; static struct pca954x_platform_mode i2c_mux_73_modes[] = { - I2C_MUX_CHANNEL(4, I2C_BUS_OFS + 9, true), - I2C_MUX_CHANNEL(3, I2C_BUS_OFS + 10, true), - I2C_MUX_CHANNEL(6, I2C_BUS_OFS + 11, true), - I2C_MUX_CHANNEL(2, I2C_BUS_OFS + 12, true), - I2C_MUX_CHANNEL(1, I2C_BUS_OFS + 13, true), - I2C_MUX_CHANNEL(5, I2C_BUS_OFS + 14, true), - I2C_MUX_CHANNEL(7, I2C_BUS_OFS + 7, true), - I2C_MUX_CHANNEL(0, I2C_BUS_OFS + 16, true), + I2C_MUX_CHANNEL(4, I2C_BUS_OFS + 9), + I2C_MUX_CHANNEL(3, I2C_BUS_OFS + 10), + I2C_MUX_CHANNEL(6, I2C_BUS_OFS + 11), + I2C_MUX_CHANNEL(2, I2C_BUS_OFS + 12), + I2C_MUX_CHANNEL(1, I2C_BUS_OFS + 13), + I2C_MUX_CHANNEL(5, I2C_BUS_OFS + 14), + I2C_MUX_CHANNEL(7, I2C_BUS_OFS + 7), + I2C_MUX_CHANNEL(0, I2C_BUS_OFS + 16), }; static struct pca954x_platform_data om_muxes[] = { @@ -137,19 +137,19 @@ static struct pca954x_platform_data om_muxes[] = { /* Optical Module bus 3 i2c muxes info */ static struct i2c_board_info i2c_info_3[] = { { - I2C_BOARD_INFO("pca9548", 0x70), + I2C_BOARD_INFO("cls_pca9548", 0x70), .platform_data = &om_muxes[0], }, { - I2C_BOARD_INFO("pca9548", 0x71), + I2C_BOARD_INFO("cls_pca9548", 0x71), .platform_data = &om_muxes[1], }, { - I2C_BOARD_INFO("pca9548", 0x72), + I2C_BOARD_INFO("cls_pca9548", 0x72), .platform_data = &om_muxes[2], }, { - I2C_BOARD_INFO("pca9548", 0x73), + I2C_BOARD_INFO("cls_pca9548", 0x73), .platform_data = &om_muxes[3], }, }; diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/modules/mc24lc64t.c b/platform/broadcom/sonic-platform-modules-dell/z9332f/modules/mc24lc64t.c index a391056d09a7..002172f587e8 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/modules/mc24lc64t.c +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/modules/mc24lc64t.c @@ -94,7 +94,7 @@ static int mc24lc64t_probe(struct i2c_client *client, sizeof(struct mc24lc64t_data), GFP_KERNEL))) return -ENOMEM; - drvdata->fake_client = i2c_new_dummy(client->adapter, client->addr + 1); + drvdata->fake_client = i2c_new_dummy_device(client->adapter, client->addr + 1); if (!drvdata->fake_client) return -ENOMEM; diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/scripts/z9332f_platform.sh b/platform/broadcom/sonic-platform-modules-dell/z9332f/scripts/z9332f_platform.sh index a5f8a2e6d62e..dddca98ad086 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/scripts/z9332f_platform.sh +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/scripts/z9332f_platform.sh @@ -56,14 +56,14 @@ switch_board_qsfp_mux() { switch_board_qsfp() { case $1 in "new_device") - for ((i=4;i<=35;i++)); + for ((i=10;i<=41;i++)); do echo optoe3 0x50 > /sys/bus/i2c/devices/i2c-$i/$1 done ;; "delete_device") - for ((i=4;i<=35;i++)); + for ((i=10;i<=41;i++)); do echo 0x50 > /sys/bus/i2c/devices/i2c-$i/$1 done @@ -112,7 +112,7 @@ switch_board_modsel() { #This enables the led control for CPU and default states switch_board_led_default() { - /usr/sbin/i2cset -y 37 0x0d 0x62 0xd0 + /usr/sbin/i2cset -y 5 0x0d 0x62 0xd0 } # Readout firmware version of the system and @@ -135,15 +135,15 @@ platform_firmware_versions() { echo "BMC: $r" >> $FIRMWARE_VERSION_FILE #BaseBoard CPLD 0x0d on i2c bus 5 ( physical FPGA I2C-5) - ver=`/usr/sbin/i2cget -y 37 0x0d 0x0` + ver=`/usr/sbin/i2cget -y 5 0x0d 0x0` echo "Baseboard CPLD: $((ver))" >> $FIRMWARE_VERSION_FILE #Switch CPLD 1 0x30 on i2c bus 4 ( physical FPGA I2C-4) - ver=`/usr/sbin/i2cget -y 36 0x30 0x0` + ver=`/usr/sbin/i2cget -y 4 0x30 0x0` echo "Switch CPLD 1: $((ver))" >> $FIRMWARE_VERSION_FILE #Switch CPLD 1 0x30 on i2c bus 4 ( physical FPGA I2C-4) - ver=`/usr/sbin/i2cget -y 36 0x31 0x0` + ver=`/usr/sbin/i2cget -y 4 0x31 0x0` echo "Switch CPLD 2: $((ver))" >> $FIRMWARE_VERSION_FILE } @@ -151,16 +151,10 @@ install_python_api_package() { device="/usr/share/sonic/device" platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) - rv=$(pip install $device/$platform/sonic_platform-1.0-py2-none-any.whl) rv=$(pip3 install $device/$platform/sonic_platform-1.0-py3-none-any.whl) } remove_python_api_package() { - rv=$(pip show sonic-platform > /dev/null 2>/dev/null) - if [ $? -eq 0 ]; then - rv=$(pip uninstall -y sonic-platform > /dev/null 2>/dev/null) - fi - rv=$(pip3 show sonic-platform > /dev/null 2>/dev/null) if [ $? -eq 0 ]; then rv=$(pip3 uninstall -y sonic-platform > /dev/null 2>/dev/null) @@ -176,7 +170,7 @@ get_reboot_cause() { if [[ ! -e $REBOOT_REASON_FILE ]]; then echo "0" > $REBOOT_REASON_FILE else - /usr/sbin/i2cget -y 37 0x0d 0x06 > $REBOOT_REASON_FILE + /usr/sbin/i2cget -y 5 0x0d 0x06 > $REBOOT_REASON_FILE fi } @@ -185,9 +179,9 @@ init_devnum if [ "$1" == "init" ]; then modprobe i2c-dev - modprobe i2c-mux-pca954x force_deselect_on_exit=1 + modprobe cls-i2c-mux-pca954x modprobe ipmi_devintf - modprobe ipmi_si kipmid_max_busy_us=1000 + modprobe ipmi_si kipmid_max_busy_us=2500 modprobe cls-i2c-ocore modprobe cls-switchboard modprobe mc24lc64t @@ -200,19 +194,26 @@ if [ "$1" == "init" ]; then # /usr/bin/qsfp_irq_enable.py platform_firmware_versions get_reboot_cause - echo 1000 > /sys/module/ipmi_si/parameters/kipmid_max_busy_us + echo 2500 > /sys/module/ipmi_si/parameters/kipmid_max_busy_us + # Set the PCA9548 mux behavior + echo -2 > /sys/bus/i2c/drivers/cls_pca954x/3-0070/idle_state + echo -2 > /sys/bus/i2c/drivers/cls_pca954x/3-0071/idle_state + echo -2 > /sys/bus/i2c/drivers/cls_pca954x/3-0072/idle_state + echo -2 > /sys/bus/i2c/drivers/cls_pca954x/3-0073/idle_state elif [ "$1" == "deinit" ]; then sys_eeprom "delete_device" switch_board_qsfp "delete_device" switch_board_sfp "delete_device" - modprobe -r i2c-mux-pca954x - modprobe -r i2c-dev - modprobe -r ipmi_devintf - modprobe -r ipmi_si + + modprobe -r mc24lc64t + modprobe -r cls-switchboard modprobe -r cls-i2c-ocore - modprobe -r cls-switchboard - modprobe -r mc24lc64t + modprobe -r acpi_ipmi + modprobe -r ipmi_si + modprobe -r ipmi_devintf + modprobe -r cls-i2c-mux-pca954x + modprobe -r i2c-dev remove_python_api_package else echo "z9332f_platform : Invalid option !" diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/chassis.py index fac058f45207..451a51f7b611 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/chassis.py @@ -28,7 +28,7 @@ MAX_Z9332F_FAN = 2 MAX_Z9332F_PSU = 2 MAX_Z9332F_THERMAL = 14 -MAX_Z9332F_COMPONENT = 6 # BIOS,FPGA,BMC,BB CPLD and 2 Switch CPLDs +MAX_Z9332F_COMPONENT = 8 # BIOS,FPGA,BMC,BB CPLD,2 Switch CPLDs,SSD and PCIe media_part_num_list = set([ \ "8T47V","XTY28","MHVPK","GF76J","J6FGD","F1KMV","9DN5J","H4DHD","6MCNV","0WRX0","X7F70","5R2PT","WTRD1","WTRD1","WTRD1","WTRD1","5250G","WTRD1","C5RNH","C5RNH","FTLX8571D3BCL-FC", @@ -59,56 +59,56 @@ class Chassis(ChassisBase): SYSLED_COLOR_TO_REG = { "green": 0xd0, "yellow": 0xe0, - "flash_green": 0xd2, - "flash_yellow": 0xe2 + "flashing green": 0xd2, + "flashing yellow": 0xe2 } REG_TO_SYSLED_COLOR = { 0xd0 : "green", 0xe0 : "yellow", - 0xd2 : "flash_green", - 0xd1 : "flash_green", - 0xe2 : "flash_yellow", - 0xe1 : "flash_yellow" + 0xd2 : "flashing green", + 0xd1 : "flashing green", + 0xe2 : "flashing yellow", + 0xe1 : "flashing yellow" } _global_port_pres_dict = {} _port_to_i2c_mapping = { - 1: 4, - 2: 5, - 3: 6, - 4: 7, - 5: 8, - 6: 9, - 7: 10, - 8: 11, - 9: 12, - 10: 13, - 11: 14, - 12: 15, - 13: 16, - 14: 17, - 15: 18, - 16: 19, - 17: 20, - 18: 21, - 19: 22, - 20: 23, - 21: 24, - 22: 25, - 23: 26, - 24: 27, - 25: 28, - 26: 29, - 27: 30, - 28: 31, - 29: 32, - 30: 33, - 31: 34, - 32: 35, - 33: 1, - 34: 2, - } + 1: 10, + 2: 11, + 3: 12, + 4: 13, + 5: 14, + 6: 15, + 7: 16, + 8: 17, + 9: 18, + 10: 19, + 11: 20, + 12: 21, + 13: 22, + 14: 23, + 15: 24, + 16: 25, + 17: 26, + 18: 27, + 19: 28, + 20: 29, + 21: 30, + 22: 31, + 23: 32, + 24: 33, + 25: 34, + 26: 35, + 27: 36, + 28: 37, + 29: 38, + 30: 39, + 31: 40, + 32: 41, + 33: 1, + 34: 2 + } reboot_reason_dict = { 0x11: (ChassisBase.REBOOT_CAUSE_POWER_LOSS, "Power on reset"), 0x22: (ChassisBase.REBOOT_CAUSE_HARDWARE_OTHER, "Soft-set CPU warm reset"), @@ -175,6 +175,7 @@ def get_change_event(self, timeout=0): if(presence and self._global_port_pres_dict[port_num] == '0'): self._global_port_pres_dict[port_num] = '1' port_dict[port_num] = '1' + self.get_sfp(port_num)._initialize_media(delay=True) elif(not presence and self._global_port_pres_dict[port_num] == '1'): self._global_port_pres_dict[port_num] = '0' diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py index 01bcdeffe688..214467f8c35d 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py @@ -10,39 +10,86 @@ ######################################################################## try: + import json + import os + import re import subprocess + import tarfile + import tempfile from sonic_platform_base.component_base import ComponentBase import sonic_platform.hwaccess as hwaccess - except ImportError as e: raise ImportError(str(e) + "- required module not found") def get_bios_version(): - return subprocess.check_output( - ['dmidecode', '-s', 'bios-version']).decode('utf-8').strip() + try: + return subprocess.check_output(['dmidecode', '-s', 'bios-version'], + text=True).strip() + except (FileNotFoundError, subprocess.CalledProcessError): + return 'NA' def get_fpga_version(): val = hwaccess.pci_get_value('/sys/bus/pci/devices/0000:09:00.0/resource0', 0) - return '{}.{}'.format((val >> 8) & 0xff, val & 0xff) - + return '{}.{}'.format((val >> 16) & 0xffff, val & 0xffff) + def get_bmc_version(): - return subprocess.check_output( - ['cat', '/sys/class/ipmi/ipmi0/device/bmc/firmware_revision'] - ).decode('utf-8').strip() + val = 'NA' + try: + bmc_ver = subprocess.check_output(['ipmitool', 'mc', 'info'], + stderr=subprocess.STDOUT, text=True) + except (FileNotFoundError, subprocess.CalledProcessError): + pass + else: + version = re.search(r'Firmware Revision\s*:\s(.*)', bmc_ver) + if version: + val = version.group(1).strip() + + return val def get_cpld_version(bus, i2caddr): - return '{}'.format(hwaccess.i2c_get(bus, i2caddr, 0)) + val = hwaccess.i2c_get(bus, i2caddr, 0) + if val != -1: + return '{:x}.{:x}'.format((val >> 4) & 0xf, val & 0xf) + else: + return 'NA' def get_cpld0_version(): - return get_cpld_version(37, 0x0d) + return get_cpld_version(5, 0x0d) def get_cpld1_version(): - return get_cpld_version(36, 0x30) + return get_cpld_version(4, 0x30) def get_cpld2_version(): - return get_cpld_version(36, 0x31) + return get_cpld_version(4, 0x31) + +def get_ssd_version(): + val = 'NA' + try: + ssd_ver = subprocess.check_output(['ssdutil', '-v'], + stderr=subprocess.STDOUT, text=True) + except (FileNotFoundError, subprocess.CalledProcessError): + pass + else: + version = re.search(r'Firmware\s*:(.*)',ssd_ver) + if version: + val = version.group(1).strip() + return val + +def get_pciephy_version(): + val = 'NA' + try: + pcie_ver = subprocess.check_output(['bcmcmd', 'pciephy fw version'], + stderr=subprocess.STDOUT, text=True) + except (FileNotFoundError, subprocess.CalledProcessError): + pass + else: + version = re.search(r'PCIe FW version:\s(.*)', pcie_ver) + if version: + val = version.group(1).strip() + + return val class Component(ComponentBase): @@ -77,17 +124,91 @@ class Component(ComponentBase): ['Switch CPLD 2', 'Used for managing QSFP-DD/QSFP28/SFP port transceivers', get_cpld2_version - ] + ], + + ['SSD', + 'Solid State Drive that stores data persistently', + get_ssd_version + ], + ['PCIe', + 'ASIC PCIe firmware', + get_pciephy_version + ] ] - def __init__(self, component_index = 0): + def __init__(self, component_index=0): ComponentBase.__init__(self) self.index = component_index self.name = self.CHASSIS_COMPONENTS[self.index][0] self.description = self.CHASSIS_COMPONENTS[self.index][1] self.version = self.CHASSIS_COMPONENTS[self.index][2]() + @staticmethod + def _get_available_firmware_version(image_path): + if not os.path.isfile(image_path): + return False, "ERROR: File not found" + + with tempfile.TemporaryDirectory() as tmpdir: + cmd = "sed -e '1,/^exit_marker$/d' {} | tar -x -C {} installer/onie-update.tar.xz".format(image_path, tmpdir) + try: + subprocess.check_call(cmd, stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, shell=True) + except subprocess.CalledProcessError: + return False, "ERROR: Unable to extract firmware updater" + + try: + updater = tarfile.open(os.path.join(tmpdir, "installer/onie-update.tar.xz"), "r") + except tarfile.ReadError: + return False, "ERROR: Unable to extract firmware updater" + + try: + ver_info_fd = updater.extractfile("firmware/fw-component-version") + except KeyError: + updater.close() + return False, "ERROR: Version info not available" + + ver_info = json.load(ver_info_fd) + ver_info_fd.close() + updater.close() + + ver_info = ver_info.get("x86_64-dellemc_z9332f_d1508-r0") + if ver_info: + components = list(ver_info.keys()) + for component in components: + if "CPLD" in component and ver_info[component].get('version'): + val = ver_info.pop(component) + ver = int(val['version'], 16) + val['version'] = "{:x}.{:x}".format((ver >> 4) & 0xf, ver & 0xf) + ver_info[component.replace("-", " ")] = val + + return True, ver_info + else: + return False, "ERROR: Version info not available" + + @staticmethod + def _stage_firmware_package(image_path): + stage_msg = None + cmd = "onie_stage_fwpkg -a {}".format(image_path) + try: + subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT, text=True) + except subprocess.CalledProcessError as e: + if e.returncode != 2: + return False, e.output.strip() + else: + stage_msg = e.output.strip() + + cmd = "onie_mode_set -o update" + try: + subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT, text=True) + except subprocess.CalledProcessError as e: + return False, e.output.strip() + + if stage_msg: + return True, stage_msg + else: + return True, "INFO: Firmware upgrade staged" + def get_name(self): """ Retrieves the name of the component @@ -112,16 +233,6 @@ def get_firmware_version(self): """ return self.version - def install_firmware(self, image_path): - """ - Installs firmware to the component - Args: - image_path: A string, path to firmware image - Returns: - A boolean, True if install was successful, False if not - """ - return False - def get_presence(self): """ Retrieves the presence of the component @@ -170,3 +281,171 @@ def is_replaceable(self): bool: True if it is replaceable. """ return False + + def get_available_firmware_version(self, image_path): + """ + Retrieves the available firmware version of the component + + Note: the firmware version will be read from image + + Args: + image_path: A string, path to firmware image + + Returns: + A string containing the available firmware version of the component + """ + avail_ver = None + valid, version = self._get_available_firmware_version(image_path) + if valid: + avail_ver = version.get(self.name) + if avail_ver: + avail_ver = avail_ver.get("version") + else: + print(version) + + return avail_ver if avail_ver else "NA" + + def get_firmware_update_notification(self, image_path): + """ + Retrieves a notification on what should be done in order to complete + the component firmware update + + Args: + image_path: A string, path to firmware image + + Returns: + A string containing the component firmware update notification if required. + By default 'None' value will be used, which indicates that no actions are required + """ + valid, version = self._get_available_firmware_version(image_path) + if valid: + avail_ver = version.get(self.name) + if avail_ver: + avail_ver = avail_ver.get("version") + if avail_ver and avail_ver != self.get_firmware_version(): + return "Cold reboot is required to perform firmware upgrade" + else: + print(version) + + return None + + def install_firmware(self, image_path): + """ + Installs firmware to the component + + This API performs firmware installation only: this may/may not be the same as firmware update. + In case platform component requires some extra steps (apart from calling Low Level Utility) + to load the installed firmware (e.g, reboot, power cycle, etc.) - this must be done manually by user + + Note: in case immediate actions are required to complete the component firmware update + (e.g., reboot, power cycle, etc.) - will be done automatically by API and no return value provided + + Args: + image_path: A string, path to firmware image + + Returns: + A boolean, True if install was successful, False if not + """ + valid, version = self._get_available_firmware_version(image_path) + if valid: + avail_ver = version.get(self.name) + if avail_ver: + avail_ver = avail_ver.get("version") + if avail_ver and avail_ver != self.get_firmware_version(): + status, msg = self._stage_firmware_package(image_path) + print(msg) + if status: + return True + else: + return False + + print("INFO: Firmware version up-to-date") + return True + else: + print(version) + + return False + + def update_firmware(self, image_path): + """ + Updates firmware of the component + + This API performs firmware update: it assumes firmware installation and loading in a single call. + In case platform component requires some extra steps (apart from calling Low Level Utility) + to load the installed firmware (e.g, reboot, power cycle, etc.) - this will be done automatically by API + + Args: + image_path: A string, path to firmware image + + Raises: + RuntimeError: update failed + """ + valid, version = self._get_available_firmware_version(image_path) + if valid: + avail_ver = version.get(self.name) + if avail_ver: + avail_ver = avail_ver.get("version") + if avail_ver and avail_ver != self.get_firmware_version(): + status, msg = self._stage_firmware_package(image_path) + if status: + print(msg) + subprocess.call("reboot") + else: + raise RuntimeError(msg) + + print("INFO: Firmware version up-to-date") + return None + else: + raise RuntimeError(version) + + def auto_update_firmware(self, image_path, boot_type): + """ + Updates firmware of the component + + This API performs firmware update automatically based on boot_type: it assumes firmware installation + and/or creating a loading task during the reboot, if needed, in a single call. + In case platform component requires some extra steps (apart from calling Low Level Utility) + to load the installed firmware (e.g, reboot, power cycle, etc.) - this will be done automatically during the reboot. + The loading task will be created by API. + + Args: + image_path: A string, path to firmware image + boot_type: A string, reboot type following the upgrade + - none/fast/warm/cold + + Returns: + Output: A return code + return_code: An integer number, status of component firmware auto-update + - return code of a positive number indicates successful auto-update + - status_installed = 1 + - status_updated = 2 + - status_scheduled = 3 + - return_code of a negative number indicates failed auto-update + - status_err_boot_type = -1 + - status_err_image = -2 + - status_err_unknown = -3 + + Raises: + RuntimeError: auto-update failure cause + """ + valid, version = self._get_available_firmware_version(image_path) + if valid: + avail_ver = version.get(self.name) + if avail_ver: + avail_ver = avail_ver.get("version") + if avail_ver and avail_ver != self.get_firmware_version(): + if boot_type != "cold": + return -1 + + status, msg = self._stage_firmware_package(image_path) + if status: + print(msg) + return 3 + else: + raise RuntimeError(msg) + + print("INFO: Firmware version up-to-date") + return 1 + else: + print(version) + return -2 diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/sfp.py index 744f47236208..693c83743ec1 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/sfp.py @@ -1,5 +1,5 @@ #!/usr/bin/env python - +""" ############################################################################# # DELLEMC Z9332F # @@ -7,833 +7,152 @@ # provides the platform information # ############################################################################# +""" try: import os - import re import time import subprocess - import struct import mmap - from sonic_platform_base.sfp_base import SfpBase - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom - from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId - from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom - from sonic_platform_base.sonic_sfp.sff8472 import sffbase - from sonic_platform_base.sonic_sfp.qsfp_dd import qsfp_dd_InterfaceId - from sonic_platform_base.sonic_sfp.sff8024 import type_of_media_interface - from sonic_platform_base.sonic_sfp.qsfp_dd import qsfp_dd_Dom - -except ImportError as e: - raise ImportError(str(e) + "- required module not found") + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase -PAGE_OFFSET = 0 -KEY_OFFSET = 1 -KEY_WIDTH = 2 -FUNC_NAME = 3 - -QSFP_DD_PAGE0 = 0 -QSFP_DD_PAGE1 = 128 -QSFP_DD_PAGE2 = 256 -QSFP_DD_PAGE3 = 384 -QSFP_DD_PAGE17 = 2176 -QSFP_DD_DOM_CAPABILITY_OFFSET = 2 -QSFP_DD_DOM_CAPABILITY_WIDTH = 1 -QSFP_DD_TEMP_OFFSET = 14 -QSFP_DD_TEMP_WIDTH = 2 -QSFP_DD_VOLT_OFFSET = 16 -QSFP_DD_VOLT_WIDTH = 2 -QSFP_DD_TXBIAS_OFFSET = 170 -QSFP_DD_TXBIAS_WIDTH = 16 -QSFP_DD_TXPOWER_OFFSET = 154 -QSFP_DD_TXPOWER_WIDTH = 16 -QSFP_DD_RXPOWER_OFFSET = 186 -QSFP_DD_RXPOWER_WIDTH = 16 -QSFP_DD_RXLOS_OFFSET = 19 -QSFP_DD_RXLOS_WIDTH = 1 -QSFP_DD_TX_DISABLE_OFFSET = 86 -QSFP_DD_TX_DISABLE_WIDTH = 1 -QSFP_DD_MEDIA_TYPE_OFFSET = 85 -QSFP_DD_MEDIA_TYPE_WIDTH = 1 -QSFP_DD_APP1_ADV_OFFSET = 86 -QSFP_DD_APP1_ADV_WIDTH = 32 -QSFP_DD_APP2_ADV_OFFSET = 351 -QSFP_DD_APP2_ADV_WIDTH = 28 +except ImportError as err: + raise ImportError(str(err) + "- required module not found") QSFP_INFO_OFFSET = 128 -QSFP_DOM_OFFSET = 0 -QSFP_DOM_OFFSET1 = 384 - SFP_INFO_OFFSET = 0 -SFP_DOM_OFFSET = 256 - -SFP_STATUS_CONTROL_OFFSET = 110 -SFP_STATUS_CONTROL_WIDTH = 7 -SFP_TX_DISABLE_HARD_BIT = 7 -SFP_TX_DISABLE_SOFT_BIT = 6 - -qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)', 'Length OM2(m)', - 'Length OM1(m)', 'Length Cable Assembly(m)') - -qsfp_compliance_code_tup = ( - '10/40G Ethernet Compliance Code', - 'SONET Compliance codes', - 'SAS/SATA compliance codes', - 'Gigabit Ethernet Compliant codes', - 'Fibre Channel link length/Transmitter Technology', - 'Fibre Channel transmission media', - 'Fibre Channel Speed') - -sfp_cable_length_tup = ('LengthSMFkm-UnitsOfKm', 'LengthSMF(UnitsOf100m)', - 'Length50um(UnitsOf10m)', 'Length62.5um(UnitsOfm)', - 'LengthOM3(UnitsOf10m)', 'LengthCable(UnitsOfm)') - -sfp_compliance_code_tup = ('10GEthernetComplianceCode', 'InfinibandComplianceCode', - 'ESCONComplianceCodes', 'SONETComplianceCodes', - 'EthernetComplianceCodes', 'FibreChannelLinkLength', - 'FibreChannelTechnology', 'SFP+CableTechnology', - 'FibreChannelTransmissionMedia', 'FibreChannelSpeed') - -info_dict_keys = ['type', 'hardware_rev', 'serial', - 'manufacturer', 'model', 'connector', - 'encoding', 'ext_identifier', 'ext_rateselect_compliance', - 'cable_type', 'cable_length', 'nominal_bit_rate', - 'specification_compliance', 'type_abbrv_name', 'vendor_date', - 'vendor_oui', 'application_advertisement'] - -dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', - 'power_lpmode', 'tx_disable', 'tx_disable_channel', - 'temperature', 'voltage', 'rx1power', - 'rx2power', 'rx3power', 'rx4power', - 'rx5power', 'rx6power', 'rx7power', - 'rx8power', 'tx1bias', 'tx2bias', - 'tx3bias', 'tx4bias', 'tx5bias', - 'tx6bias', 'tx7bias', 'tx8bias', - 'tx1power', 'tx2power', 'tx3power', - 'tx4power', 'tx5power', 'tx6power', - 'tx7power', 'tx8power'] - -threshold_dict_keys = ['temphighalarm', 'temphighwarning', - 'templowalarm', 'templowwarning', - 'vcchighalarm', 'vcchighwarning', - 'vcclowalarm', 'vcclowwarning', - 'rxpowerhighalarm', 'rxpowerhighwarning', - 'rxpowerlowalarm', 'rxpowerlowwarning', - 'txpowerhighalarm', 'txpowerhighwarning', - 'txpowerlowalarm', 'txpowerlowwarning', - 'txbiashighalarm', 'txbiashighwarning', - 'txbiaslowalarm', 'txbiaslowwarning'] -qsfp_dd_parser = { - 'ChannelThreshold': [QSFP_DD_PAGE3, 0, 72, 'parse_module_threshold_values'], - 'cable_length': [QSFP_DD_PAGE1, 74, 1, 'parse_cable_len'], - 'connector': [QSFP_DD_PAGE1, 75, 1, 'parse_connector'], - 'type': [QSFP_DD_PAGE1, 0, 1, 'parse_sfp_type'], - 'ext_identifier': [QSFP_DD_PAGE1, 72, 2, 'parse_ext_iden'], - 'type_abbrv_name': [QSFP_DD_PAGE1, 0, 21, 'parse_sfp_type_abbrv_name'], - 'manufacturer': [QSFP_DD_PAGE1, 1, 16, 'parse_vendor_name'], - 'vendor_oui': [QSFP_DD_PAGE1, 17, 3, 'parse_vendor_oui'], - 'model': [QSFP_DD_PAGE1, 20, 16, 'parse_vendor_pn'], - 'hardware_rev': [QSFP_DD_PAGE1, 36, 2, 'parse_vendor_rev'], - 'serial': [QSFP_DD_PAGE1, 38, 16, 'parse_vendor_sn'], - 'vendor_date': [QSFP_DD_PAGE1, 54, 8, 'parse_vendor_date'], - 'ModuleThreshold': [QSFP_DD_PAGE3, 0, 72, 'parse_module_threshold_values'], - 'dom_capability': [QSFP_DD_PAGE0, 2 , 1, 'parse_dom_capability'], -} - -sff8436_parser = { - 'reset_status': [QSFP_DOM_OFFSET, 2, 1, 'parse_dom_status_indicator'], - 'rx_los': [QSFP_DOM_OFFSET, 3, 1, 'parse_dom_tx_rx_los'], - 'tx_fault': [QSFP_DOM_OFFSET, 4, 1, 'parse_dom_tx_fault'], - 'tx_disable': [QSFP_DOM_OFFSET, 86, 1, 'parse_dom_tx_disable'], - 'power_lpmode': [QSFP_DOM_OFFSET, 93, 1, 'parse_dom_power_control'], - 'power_override': [QSFP_DOM_OFFSET, 93, 1, 'parse_dom_power_control'], - 'Temperature': [QSFP_DOM_OFFSET, 22, 2, 'parse_temperature'], - 'Voltage': [QSFP_DOM_OFFSET, 26, 2, 'parse_voltage'], - 'ChannelMonitor': [QSFP_DOM_OFFSET, 34, 16, 'parse_channel_monitor_params'], - 'ChannelMonitor_TxPower': - [QSFP_DOM_OFFSET, 34, 24, 'parse_channel_monitor_params_with_tx_power'], - 'cable_type': [QSFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'cable_length': [QSFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'connector': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'type': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'encoding': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'ext_identifier': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'ext_rateselect_compliance': - [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'nominal_bit_rate': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'specification_compliance': - [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'type_abbrv_name': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'manufacturer': [QSFP_INFO_OFFSET, 20, 16, 'parse_vendor_name'], - 'vendor_oui': [QSFP_INFO_OFFSET, 37, 3, 'parse_vendor_oui'], - 'model': [QSFP_INFO_OFFSET, 40, 16, 'parse_vendor_pn'], - 'hardware_rev': [QSFP_INFO_OFFSET, 56, 2, 'parse_vendor_rev'], - 'serial': [QSFP_INFO_OFFSET, 68, 16, 'parse_vendor_sn'], - 'vendor_date': [QSFP_INFO_OFFSET, 84, 8, 'parse_vendor_date'], - 'dom_capability': [QSFP_INFO_OFFSET, 92, 1, 'parse_dom_capability'], - 'dom_rev': [QSFP_DOM_OFFSET, 1, 1, 'parse_sfp_dom_rev'], - 'ModuleThreshold': [QSFP_DOM_OFFSET1, 128, 24, 'parse_module_threshold_values'], - 'ChannelThreshold': [QSFP_DOM_OFFSET1, 176, 16, 'parse_channel_threshold_values'], -} - -sff8472_parser = { - 'Temperature': [SFP_DOM_OFFSET, 96, 2, 'parse_temperature'], - 'Voltage': [SFP_DOM_OFFSET, 98, 2, 'parse_voltage'], - 'ChannelMonitor': [SFP_DOM_OFFSET, 100, 6, 'parse_channel_monitor_params'], - - 'cable_type': [SFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'cable_length': [SFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'connector': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'type': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'encoding': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'ext_identifier': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'ext_rateselect_compliance': - [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'nominal_bit_rate': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'specification_compliance': - [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'type_abbrv_name': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'manufacturer': [SFP_INFO_OFFSET, 20, 16, 'parse_vendor_name'], - 'vendor_oui': [SFP_INFO_OFFSET, 37, 3, 'parse_vendor_oui'], - 'model': [SFP_INFO_OFFSET, 40, 16, 'parse_vendor_pn'], - 'hardware_rev': [SFP_INFO_OFFSET, 56, 4, 'parse_vendor_rev'], - 'serial': [SFP_INFO_OFFSET, 68, 16, 'parse_vendor_sn'], - 'vendor_date': [SFP_INFO_OFFSET, 84, 8, 'parse_vendor_date'], - 'ModuleThreshold': [SFP_DOM_OFFSET, 0, 56, 'parse_alarm_warning_threshold'], -} -MEDIA_TYPE_OFFSET = 0 -MEDIA_TYPE_WIDTH = 1 +QSFP_DD_PAGE0 = 0 SFP_TYPE_LIST = [ - '03' # SFP/SFP+/SFP28 and later + '0x3' # SFP/SFP+/SFP28 and later ] QSFP_TYPE_LIST = [ - '0c', # QSFP - '0d', # QSFP+ or later - '11' # QSFP28 or later + '0xc', # QSFP + '0xd', # QSFP+ or later + '0x11' # QSFP28 or later ] QSFP_DD_TYPE_LIST = [ - '18' #QSFP_DD Type -] -OSFP_TYPE_LIST=[ - '19' # OSFP 8X Type + '0x18' #QSFP_DD Type ] - - -class Sfp(SfpBase): +class Sfp(SfpOptoeBase): """ DELLEMC Platform-specific Sfp class """ BASE_RES_PATH = "/sys/bus/pci/devices/0000:09:00.0/resource0" + _port_to_i2c_mapping = { - 1: 4, - 2: 5, - 3: 6, - 4: 7, - 5: 8, - 6: 9, - 7: 10, - 8: 11, - 9: 12, - 10: 13, - 11: 14, - 12: 15, - 13: 16, - 14: 17, - 15: 18, - 16: 19, - 17: 20, - 18: 21, - 19: 22, - 20: 23, - 21: 24, - 22: 25, - 23: 26, - 24: 27, - 25: 28, - 26: 29, - 27: 30, - 28: 31, - 29: 32, - 30: 33, - 31: 34, - 32: 35, - 33: 1, - 34: 2 - } + 1: 10, + 2: 11, + 3: 12, + 4: 13, + 5: 14, + 6: 15, + 7: 16, + 8: 17, + 9: 18, + 10: 19, + 11: 20, + 12: 21, + 13: 22, + 14: 23, + 15: 24, + 16: 25, + 17: 26, + 18: 27, + 19: 28, + 20: 29, + 21: 30, + 22: 31, + 23: 32, + 24: 33, + 25: 34, + 26: 35, + 27: 36, + 28: 37, + 29: 38, + 30: 39, + 31: 40, + 32: 41, + 33: 1, + 34: 2 + } def __init__(self, index, sfp_type, eeprom_path): - SfpBase.__init__(self) + """ + SFP Dunder init + """ + SfpOptoeBase.__init__(self) self.index = index self.eeprom_path = eeprom_path #port_type is the native port type and sfp_type is the transceiver type #sfp_type will be detected in get_transceiver_info self.port_type = sfp_type self.sfp_type = self.port_type - self.qsfpInfo = sff8436InterfaceId() - self.qsfpDomInfo = sff8436Dom() - self.sfpInfo = sff8472InterfaceId() - self.sfpDomInfo = sff8472Dom(None,1) - self.qsfp_dd_Info = qsfp_dd_InterfaceId() - self.qsfp_dd_DomInfo = qsfp_dd_Dom() - self.qsfp_dd_app2_list = False - self.qsfp_dd_rxpower_supported = False - self.qsfp_dd_txpower_supported = False - self.qsfp_dd_txbias_supported = False + self._initialize_media(delay=False) - def get_eeprom_sysfs_path(self): + def get_eeprom_path(self): + """ + Returns SFP eeprom path + """ return self.eeprom_path - def detect_dom_capability(self): - if self.sfp_type == 'QSFP_DD': - offset = 0 - qsfp_dom_capability_raw = self._read_eeprom_bytes( - self.eeprom_path, offset + QSFP_DD_DOM_CAPABILITY_OFFSET, QSFP_DD_DOM_CAPABILITY_WIDTH) - if qsfp_dom_capability_raw is not None: - if self.qsfp_dd_Info is None: - return None - dom_capability = self.qsfp_dd_Info.parse_dom_capability(qsfp_dom_capability_raw, 0) - if dom_capability['data']['Flat_MEM']['value'] == 'Off': - self.qsfp_dd_app2_list = True - self.qsfp_dd_rxpower_supported = True - self.qsfp_dd_txpower_supported = True - self.qsfp_dd_txbias_supported = True - - def _strip_unit_from_str(self, value_str): - match = re.match(r'(.*)C$|(.*)Volts$|(.*)mA$|(.*)dBm$', value_str) - if match: - for value in match.groups(): - if value is not None: - return float(value) - return None + def get_name(self): + """ + Returns native transceiver type + """ + return "QSFP-DD Double Density 8X Pluggable Transceiver" if self.index < 33 else "SFP/SFP+/SFP28" - def pci_mem_read(self, mm, offset): - mm.seek(offset) - read_data_stream = mm.read(4) - reg_val = struct.unpack('I', read_data_stream) - mem_val = str(reg_val)[1:-2] - # print "reg_val read:%x"%reg_val - return mem_val + @staticmethod + def pci_mem_read(mem, offset): + """ + Returns the desired byte in PCI memory space + """ + mem.seek(offset) + return mem.read_byte() - def pci_mem_write(self, mm, offset, data): - mm.seek(offset) + @staticmethod + def pci_mem_write(mem, offset, data): + """ + Writes the desired byte in PCI memory space + """ + mem.seek(offset) # print "data to write:%x"%data - mm.write(struct.pack('I', data)) + mem.write_byte(data) def pci_set_value(self, resource, val, offset): - fd = os.open(resource, os.O_RDWR) - mm = mmap.mmap(fd, 0) - val = self.pci_mem_write(mm, offset, val) - mm.close() - os.close(fd) - return val - - def pci_get_value(self, resource, offset): - fd = os.open(resource, os.O_RDWR) - mm = mmap.mmap(fd, 0) - val = self.pci_mem_read(mm, offset) - mm.close() - os.close(fd) - return val - - def _read_eeprom_bytes(self, eeprom_path, offset, num_bytes): - eeprom_raw = [] - try: - eeprom = open(eeprom_path, mode="rb", buffering=0) - except IOError: - return None - - for i in range(0, num_bytes): - eeprom_raw.append("0x00") - - try: - eeprom.seek(offset) - raw = eeprom.read(num_bytes) - except IOError: - eeprom.close() - return None - - try: - if isinstance(raw , str): - for n in range(0, num_bytes): - eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) - else: - for n in range(0, num_bytes): - eeprom_raw[n] = hex(raw[n])[2:].zfill(2) - - except BaseException: - eeprom.close() - return None - - eeprom.close() - return eeprom_raw - - def _get_eeprom_data(self, eeprom_key): - eeprom_data = None - page_offset = None - - if self.sfp_type == 'QSFP_DD': - page_offset = qsfp_dd_parser[eeprom_key][PAGE_OFFSET] - eeprom_data_raw = self._read_eeprom_bytes( - self.eeprom_path, - (qsfp_dd_parser[eeprom_key][PAGE_OFFSET] + - qsfp_dd_parser[eeprom_key][KEY_OFFSET]), - qsfp_dd_parser[eeprom_key][KEY_WIDTH]) - if eeprom_data_raw is not None: - # Offset 128 is used to retrieve qsfpDD_InterfaceId Info - # Offset 0 is used to retrieve QsfpDD_Dom Info - if page_offset <= 128: - if self.qsfp_dd_Info is None: - return None - eeprom_data = getattr( - self.qsfp_dd_Info, qsfp_dd_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - if self.qsfp_dd_DomInfo is None: - return None - eeprom_data = getattr( - self.qsfp_dd_DomInfo, qsfp_dd_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - elif self.sfp_type == 'QSFP': - page_offset = sff8436_parser[eeprom_key][PAGE_OFFSET] - eeprom_data_raw = self._read_eeprom_bytes( - self.eeprom_path, - (sff8436_parser[eeprom_key][PAGE_OFFSET] + - sff8436_parser[eeprom_key][KEY_OFFSET]), - sff8436_parser[eeprom_key][KEY_WIDTH]) - if eeprom_data_raw is not None: - # Offset 128 is used to retrieve sff8436InterfaceId Info - # Offset 0 is used to retrieve sff8436Dom Info - if page_offset == 128: - if self.qsfpInfo is None: - return None - eeprom_data = getattr( - self.qsfpInfo, sff8436_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - if self.qsfpDomInfo is None: - return None - eeprom_data = getattr( - self.qsfpDomInfo, sff8436_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - page_offset = sff8472_parser[eeprom_key][PAGE_OFFSET] - eeprom_data_raw = self._read_eeprom_bytes( - self.eeprom_path, - (sff8472_parser[eeprom_key][PAGE_OFFSET] + - sff8472_parser[eeprom_key][KEY_OFFSET]), - sff8472_parser[eeprom_key][KEY_WIDTH]) - if eeprom_data_raw is not None: - # Offset 0 is used to retrieve sff8472InterfaceId Info - # Offset 256 is used to retrieve sff8472Dom Info - if page_offset == 0: - if self.sfpInfo is None: - return None - eeprom_data = getattr( - self.sfpInfo, sff8472_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - else: - if self.sfpDomInfo is None: - return None - eeprom_data = getattr( - self.sfpDomInfo, sff8472_parser[eeprom_key][FUNC_NAME])( - eeprom_data_raw, 0) - - return eeprom_data - - def get_transceiver_info(self): """ - Retrieves transceiver info of this SFP + Sets the value in PCI memory space """ - transceiver_info_dict = {} - compliance_code_dict = {} - transceiver_info_dict = dict.fromkeys(info_dict_keys, 'N/A') - if not self.get_presence(): - return transceiver_info_dict - - self.sfp_type = self.set_media_type() - if self.reinit_sfp_driver() is False: - return transceiver_info_dict - - self.detect_dom_capability() - - # BaseInformation - if self.sfp_type != 'QSFP_DD': - iface_data = self._get_eeprom_data('type') - connector = iface_data['data']['Connector']['value'] - encoding = iface_data['data']['EncodingCodes']['value'] - ext_id = iface_data['data']['Extended Identifier']['value'] - rate_identifier = iface_data['data']['RateIdentifier']['value'] - identifier = iface_data['data']['type']['value'] - type_abbrv_name=iface_data['data']['type_abbrv_name']['value'] - if self.sfp_type == 'QSFP': - bit_rate = str(iface_data['data']['Nominal Bit Rate(100Mbs)']['value']) - for key in qsfp_compliance_code_tup: - if key in iface_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = iface_data['data']['Specification compliance']['value'][key]['value'] - for key in qsfp_cable_length_tup: - if key in iface_data['data']: - cable_type = key - cable_length = str(iface_data['data'][key]['value']) - else: - bit_rate = str( - iface_data['data']['NominalSignallingRate(UnitsOf100Mbd)']['value']) - for key in sfp_compliance_code_tup: - if key in iface_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = iface_data['data']['Specification compliance']['value'][key]['value'] - for key in sfp_cable_length_tup: - if key in iface_data['data']: - cable_type = key - cable_length = str(iface_data['data'][key]['value']) - - transceiver_info_dict['type_abbrv_name'] = type_abbrv_name - transceiver_info_dict['type'] = identifier - transceiver_info_dict['connector'] = connector - transceiver_info_dict['encoding'] = encoding - transceiver_info_dict['ext_identifier'] = ext_id - transceiver_info_dict['ext_rateselect_compliance'] = rate_identifier - transceiver_info_dict['cable_type'] = cable_type - transceiver_info_dict['cable_length'] = str(float(cable_length)) - transceiver_info_dict['nominal_bit_rate'] = bit_rate - transceiver_info_dict['specification_compliance'] = str(compliance_code_dict) - - vendor_date_data = self._get_eeprom_data('vendor_date') - if vendor_date_data is not None: - vendor_date = vendor_date_data['data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] - transceiver_info_dict['vendor_date'] = vendor_date - - vendor_name_data = self._get_eeprom_data('manufacturer') - if vendor_name_data is not None: - vendor_name = vendor_name_data['data']['Vendor Name']['value'] - transceiver_info_dict['manufacturer'] = vendor_name - - vendor_oui_data = self._get_eeprom_data('vendor_oui') - if vendor_oui_data is not None: - vendor_oui = vendor_oui_data['data']['Vendor OUI']['value'] - transceiver_info_dict['vendor_oui'] = vendor_oui - - vendor_pn_data = self._get_eeprom_data('model') - if vendor_pn_data is not None: - vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['model'] = vendor_pn - - vendor_rev_data = self._get_eeprom_data('hardware_rev') - if vendor_rev_data is not None: - vendor_rev = vendor_rev_data['data']['Vendor Rev']['value'] - transceiver_info_dict['hardware_rev'] = vendor_rev - - vendor_sn_data = self._get_eeprom_data('serial') - if vendor_sn_data is not None: - vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] - transceiver_info_dict['serial'] = vendor_sn - - else: - #QSFP_DD - type_abbrv_name = self._get_eeprom_data('type_abbrv_name') - if type_abbrv_name is not None: - transceiver_info_dict['type_abbrv_name'] = type_abbrv_name['data']['type_abbrv_name']['value'] - - identifier = self._get_eeprom_data('type') - if identifier is not None: - transceiver_info_dict['type'] = identifier['data']['type']['value'] - - connector = self._get_eeprom_data('connector') - if connector is not None: - transceiver_info_dict['connector'] = connector['data']['Connector']['value'] - - ext_id = self._get_eeprom_data('ext_identifier') - if ext_id is not None: - transceiver_info_dict['ext_identifier'] = ext_id['data']['Extended Identifier']['value'] - - cable_length = self._get_eeprom_data('cable_length') - if cable_length is not None: - #Since the cable length field can be returned as decimal and float in M,converting it to float as common type. - #If the currentreturn type persists, cable length has to defined twice for the same length(e.g. 1 and 1.0M) - transceiver_info_dict['cable_length'] = str(float(cable_length['data']['Length Cable Assembly(m)']['value'])) - - transceiver_info_dict['encoding'] = "Not supported" - transceiver_info_dict['nominal_bit_rate'] = "Not supported" - transceiver_info_dict['ext_rateselect_compliance'] = "Not supported" - - eeprom_raw = [] - eeprom_raw = self._read_eeprom_bytes(self.eeprom_path, QSFP_DD_MEDIA_TYPE_OFFSET, - QSFP_DD_MEDIA_TYPE_WIDTH) - if eeprom_raw is not None: - transceiver_info_dict['specification_compliance'] = type_of_media_interface[eeprom_raw[0]] - - transceiver_info_dict['cable_type'] = "Length Cable Assembly(m)" - - vendor_date = self._get_eeprom_data('vendor_date') - if vendor_date is not None: - transceiver_info_dict['vendor_date'] = vendor_date['data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] - - vendor_name = self._get_eeprom_data('manufacturer') - if vendor_name is not None: - transceiver_info_dict['manufacturer'] = vendor_name['data']['Vendor Name']['value'] - - vendor_oui = self._get_eeprom_data('vendor_oui') - if vendor_oui is not None: - transceiver_info_dict['vendor_oui'] = vendor_oui['data']['Vendor OUI']['value'] - - vendor_pn = self._get_eeprom_data('model') - if vendor_pn is not None: - transceiver_info_dict['model'] = vendor_pn['data']['Vendor PN']['value'] - - vendor_rev = self._get_eeprom_data('hardware_rev') - if vendor_rev is not None: - transceiver_info_dict['hardware_rev'] = vendor_rev['data']['Vendor Rev']['value'] - - vendor_sn = self._get_eeprom_data('serial') - if vendor_sn is not None: - transceiver_info_dict['serial'] = vendor_sn['data']['Vendor SN']['value'] - - if self.qsfp_dd_Info is None: - return None - - sfp_media_type_raw = self._read_eeprom_bytes(self.eeprom_path, QSFP_DD_MEDIA_TYPE_OFFSET, - QSFP_DD_MEDIA_TYPE_WIDTH) - if sfp_media_type_raw is not None: - sfp_media_type_dict = self.qsfp_dd_Info.parse_media_type(sfp_media_type_raw, 0) - if sfp_media_type_dict is None: - return None - - host_media_list = "" - if self.qsfp_dd_Info is None: - return None - qsfp_dd_app1_list = self._read_eeprom_bytes(self.eeprom_path, QSFP_DD_APP1_ADV_OFFSET, - QSFP_DD_APP1_ADV_WIDTH) - if self.qsfp_dd_app2_list: - possible_application_count = 15 - #Additional application advertisement - qsfp_dd_app2_list = self._read_eeprom_bytes(self.eeprom_path, QSFP_DD_APP2_ADV_OFFSET, - QSFP_DD_APP2_ADV_WIDTH) - if qsfp_dd_app1_list is not None and qsfp_dd_app2_list is not None: - sfp_application_type_list = qsfp_dd_app1_list + qsfp_dd_app2_list - else: - return None - else: - possible_application_count = 8 - if qsfp_dd_app1_list is not None: - sfp_application_type_list = qsfp_dd_app1_list - else: - return None - - for i in range(0, possible_application_count): - if sfp_application_type_list[i * 4] == 'ff': - break - host_electrical, media_interface = self.qsfp_dd_Info.parse_application(sfp_media_type_dict, - sfp_application_type_list[i * 4], sfp_application_type_list[i * 4 + 1]) - host_media_list = host_media_list + host_electrical + ' - ' + media_interface + ' ' - transceiver_info_dict['application_advertisement'] = host_media_list - - return transceiver_info_dict + filed = os.open(resource, os.O_RDWR) + mem = mmap.mmap(filed, 0) + self.pci_mem_write(mem, offset, val) + mem.close() + os.close(filed) + return val - def get_transceiver_threshold_info(self): + def pci_get_value(self, resource, offset): """ - Retrieves transceiver threshold info of this SFP + Retrieves the value from PCI memory space """ - transceiver_dom_threshold_dict = {} - transceiver_dom_threshold_dict = dict.fromkeys( - threshold_dict_keys, 'N/A') - - try: - module_threshold_data = self._get_eeprom_data('ModuleThreshold') - if self.sfp_type == 'QSFP_DD': - transceiver_dom_threshold_dict['temphighalarm'] = module_threshold_data['data']['TempHighAlarm']['value'] - transceiver_dom_threshold_dict['temphighwarning'] = module_threshold_data['data']['TempHighWarning']['value'] - transceiver_dom_threshold_dict['templowalarm'] = module_threshold_data['data']['TempLowAlarm']['value'] - transceiver_dom_threshold_dict['templowwarning'] = module_threshold_data['data']['TempLowWarning']['value'] - transceiver_dom_threshold_dict['vcchighalarm'] = module_threshold_data['data']['VccHighAlarm']['value'] - transceiver_dom_threshold_dict['vcchighwarning'] = module_threshold_data['data']['VccHighWarning']['value'] - transceiver_dom_threshold_dict['vcclowalarm'] = module_threshold_data['data']['VccLowAlarm']['value'] - transceiver_dom_threshold_dict['vcclowwarning'] = module_threshold_data['data']['VccLowWarning']['value'] - transceiver_dom_threshold_dict['rxpowerhighalarm'] = module_threshold_data['data']['RxPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerhighwarning'] = module_threshold_data['data']['RxPowerHighWarning']['value'] - transceiver_dom_threshold_dict['rxpowerlowalarm'] = module_threshold_data['data']['RxPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerlowwarning'] = module_threshold_data['data']['RxPowerLowWarning']['value'] - transceiver_dom_threshold_dict['txbiashighalarm'] = module_threshold_data['data']['TxBiasHighAlarm']['value'] - transceiver_dom_threshold_dict['txbiashighwarning'] = module_threshold_data['data']['TxBiasHighWarning']['value'] - transceiver_dom_threshold_dict['txbiaslowalarm'] = module_threshold_data['data']['TxBiasLowAlarm']['value'] - transceiver_dom_threshold_dict['txbiaslowwarning'] = module_threshold_data['data']['TxBiasLowWarning']['value'] - transceiver_dom_threshold_dict['txpowerhighalarm'] = module_threshold_data['data']['TxPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['txpowerhighwarning'] = module_threshold_data['data']['TxPowerHighWarning']['value'] - transceiver_dom_threshold_dict['txpowerlowalarm'] = module_threshold_data['data']['TxPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['txpowerlowwarning'] = module_threshold_data['data']['TxPowerLowWarning']['value'] - elif self.sfp_type == 'QSFP': - transceiver_dom_threshold_dict['temphighalarm'] = module_threshold_data['data']['TempHighAlarm']['value'] - transceiver_dom_threshold_dict['temphighwarning'] = module_threshold_data['data']['TempHighWarning']['value'] - transceiver_dom_threshold_dict['templowalarm'] = module_threshold_data['data']['TempLowAlarm']['value'] - transceiver_dom_threshold_dict['templowwarning'] = module_threshold_data['data']['TempLowWarning']['value'] - transceiver_dom_threshold_dict['vcchighalarm'] = module_threshold_data['data']['VccHighAlarm']['value'] - transceiver_dom_threshold_dict['vcchighwarning'] = module_threshold_data['data']['VccHighWarning']['value'] - transceiver_dom_threshold_dict['vcclowalarm'] = module_threshold_data['data']['VccLowAlarm']['value'] - transceiver_dom_threshold_dict['vcclowwarning'] = module_threshold_data['data']['VccLowWarning']['value'] - else: #SFP - transceiver_dom_threshold_dict['temphighalarm'] = module_threshold_data['data']['TempHighAlarm']['value'] - transceiver_dom_threshold_dict['templowalarm'] = module_threshold_data['data']['TempLowAlarm']['value'] - transceiver_dom_threshold_dict['temphighwarning'] = module_threshold_data['data']['TempHighWarning']['value'] - transceiver_dom_threshold_dict['templowwarning'] = module_threshold_data['data']['TempLowWarning']['value'] - transceiver_dom_threshold_dict['vcchighalarm'] = module_threshold_data['data']['VoltageHighAlarm']['value'] - transceiver_dom_threshold_dict['vcclowalarm'] = module_threshold_data['data']['VoltageLowAlarm']['value'] - transceiver_dom_threshold_dict['vcchighwarning'] = module_threshold_data['data']['VoltageHighWarning']['value'] - transceiver_dom_threshold_dict['vcclowwarning'] = module_threshold_data['data']['VoltageLowWarning']['value'] - transceiver_dom_threshold_dict['txbiashighalarm'] = module_threshold_data['data']['BiasHighAlarm']['value'] - transceiver_dom_threshold_dict['txbiaslowalarm'] = module_threshold_data['data']['BiasLowAlarm']['value'] - transceiver_dom_threshold_dict['txbiashighwarning'] = module_threshold_data['data']['BiasHighWarning']['value'] - transceiver_dom_threshold_dict['txbiaslowwarning'] = module_threshold_data['data']['BiasLowWarning']['value'] - transceiver_dom_threshold_dict['txpowerhighalarm'] = module_threshold_data['data']['TXPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['txpowerlowalarm'] = module_threshold_data['data']['TXPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['txpowerhighwarning'] = module_threshold_data['data']['TXPowerHighWarning']['value'] - transceiver_dom_threshold_dict['txpowerlowwarning'] = module_threshold_data['data']['TXPowerLowWarning']['value'] - transceiver_dom_threshold_dict['rxpowerhighalarm'] = module_threshold_data['data']['RXPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerlowalarm'] = module_threshold_data['data']['RXPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerhighwarning'] = module_threshold_data['data']['RXPowerHighWarning']['value'] - transceiver_dom_threshold_dict['rxpowerlowwarning'] = module_threshold_data['data']['RXPowerLowWarning']['value'] - except (ValueError, TypeError) : pass - - try: - if self.sfp_type == 'QSFP': - channel_threshold_data = self._get_eeprom_data('ChannelThreshold') - transceiver_dom_threshold_dict['rxpowerhighalarm'] = channel_threshold_data['data']['RxPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerhighwarning'] = channel_threshold_data['data']['RxPowerHighWarning']['value'] - transceiver_dom_threshold_dict['rxpowerlowalarm'] = channel_threshold_data['data']['RxPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerlowwarning'] = channel_threshold_data['data']['RxPowerLowWarning']['value'] - transceiver_dom_threshold_dict['txbiashighalarm'] = channel_threshold_data['data']['TxBiasHighAlarm']['value'] - transceiver_dom_threshold_dict['txbiashighwarning'] = channel_threshold_data['data']['TxBiasHighWarning']['value'] - transceiver_dom_threshold_dict['txbiaslowalarm'] = channel_threshold_data['data']['TxBiasLowAlarm']['value'] - transceiver_dom_threshold_dict['txbiaslowwarning'] = channel_threshold_data['data']['TxBiasLowWarning']['value'] - - except (ValueError, TypeError) : pass - return transceiver_dom_threshold_dict + filed = os.open(resource, os.O_RDWR) + mem = mmap.mmap(filed, 0) + val = self.pci_mem_read(mem, offset) + mem.close() + os.close(filed) + return val - def get_transceiver_bulk_status(self): + def _initialize_media(self, delay=False): """ - Retrieves transceiver bulk status of this SFP + Initialize the media type and eeprom driver for SFP """ - tx_bias_list = [] - tx_power_list = [] - rx_power_list = [] - transceiver_dom_dict = {} - transceiver_dom_dict = dict.fromkeys(dom_dict_keys, 'N/A') - - # RxLos - rx_los = self.get_rx_los() - - # TxFault - tx_fault = self.get_tx_fault() - - # ResetStatus - reset_state = self.get_reset_status() - - # LowPower Mode - lp_mode = self.get_lpmode() - - # TxDisable - tx_disable = self.get_tx_disable() - - # TxDisable Channel - tx_disable_channel = self.get_tx_disable_channel() - - # Temperature - temperature = self.get_temperature() - - # Voltage - voltage = self.get_voltage() - - # Channel Monitor - tx_power_list = self.get_tx_power() - - # tx bias - tx_bias_list = self.get_tx_bias() + if delay: + time.sleep(1) + self._xcvr_api = None + self.get_xcvr_api() - # rx power - rx_power_list = self.get_rx_power() - - if self.sfp_type == 'QSFP_DD': - if tx_bias_list: - transceiver_dom_dict['tx1bias'] = tx_bias_list[0] - transceiver_dom_dict['tx2bias'] = tx_bias_list[1] - transceiver_dom_dict['tx3bias'] = tx_bias_list[2] - transceiver_dom_dict['tx4bias'] = tx_bias_list[3] - transceiver_dom_dict['tx5bias'] = tx_bias_list[4] - transceiver_dom_dict['tx6bias'] = tx_bias_list[5] - transceiver_dom_dict['tx7bias'] = tx_bias_list[6] - transceiver_dom_dict['tx8bias'] = tx_bias_list[7] - - elif self.sfp_type == 'QSFP': - if tx_bias_list: - transceiver_dom_dict['tx1bias'] = tx_bias_list[0] - transceiver_dom_dict['tx2bias'] = tx_bias_list[1] - transceiver_dom_dict['tx3bias'] = tx_bias_list[2] - transceiver_dom_dict['tx4bias'] = tx_bias_list[3] - else: - if tx_bias_list: - transceiver_dom_dict['tx1bias'] = tx_bias_list[0] - - if self.sfp_type == 'QSFP_DD': - if rx_power_list: - transceiver_dom_dict['rx1power'] = rx_power_list[0] - transceiver_dom_dict['rx2power'] = rx_power_list[1] - transceiver_dom_dict['rx3power'] = rx_power_list[2] - transceiver_dom_dict['rx4power'] = rx_power_list[3] - transceiver_dom_dict['rx5power'] = rx_power_list[4] - transceiver_dom_dict['rx6power'] = rx_power_list[5] - transceiver_dom_dict['rx7power'] = rx_power_list[6] - transceiver_dom_dict['rx8power'] = rx_power_list[7] - - elif self.sfp_type == 'QSFP': - if rx_power_list: - transceiver_dom_dict['rx1power'] = rx_power_list[0] - transceiver_dom_dict['rx2power'] = rx_power_list[1] - transceiver_dom_dict['rx3power'] = rx_power_list[2] - transceiver_dom_dict['rx4power'] = rx_power_list[3] - else: - if rx_power_list: - transceiver_dom_dict['rx1power'] = rx_power_list[0] - - if self.sfp_type == 'QSFP_DD': - if tx_power_list: - transceiver_dom_dict['tx1power'] = tx_power_list[0] - transceiver_dom_dict['tx2power'] = tx_power_list[1] - transceiver_dom_dict['tx3power'] = tx_power_list[2] - transceiver_dom_dict['tx4power'] = tx_power_list[3] - transceiver_dom_dict['tx5power'] = tx_power_list[4] - transceiver_dom_dict['tx6power'] = tx_power_list[5] - transceiver_dom_dict['tx7power'] = tx_power_list[6] - transceiver_dom_dict['tx8power'] = tx_power_list[7] - elif self.sfp_type == 'QSFP': - if tx_power_list: - transceiver_dom_dict['tx1power'] = tx_power_list[0] - transceiver_dom_dict['tx2power'] = tx_power_list[1] - transceiver_dom_dict['tx3power'] = tx_power_list[2] - transceiver_dom_dict['tx4power'] = tx_power_list[3] - else: - if tx_power_list: - transceiver_dom_dict['tx1power'] = tx_power_list[0] - transceiver_dom_dict['rx_los'] = rx_los - transceiver_dom_dict['tx_fault'] = tx_fault - transceiver_dom_dict['reset_status'] = reset_state - transceiver_dom_dict['power_lpmode'] = lp_mode - transceiver_dom_dict['tx_disable'] = tx_disable - transceiver_dom_dict['tx_disable_channel'] = tx_disable_channel - transceiver_dom_dict['temperature'] = temperature - transceiver_dom_dict['voltage'] = voltage - - return transceiver_dom_dict - - def get_name(self): - """ - Retrieves the name of the sfp - Returns : QSFP or QSFP+ or QSFP28 - """ - try: - iface_data = self._get_eeprom_data('type') - identifier = iface_data['data']['type']['value'] - except (TypeError, ValueError): - return 'N/A' - return identifier + self.set_media_type() + self.reinit_sfp_driver() def get_presence(self): """ @@ -841,7 +160,7 @@ def get_presence(self): Returns : True if sfp is present and false if it is absent """ # Check for invalid port_num - mask = {'QSFP_DD' : (1 << 4), 'SFP' : (1 << 0)} + mask = {'QSFP_DD' : (1 << 4), 'SFP' : (1 << 0)} # Port offset starts with 0x4004 port_offset = 16388 + ((self.index-1) * 16) @@ -851,34 +170,11 @@ def get_presence(self): # ModPrsL is active low if reg_value & mask[self.port_type] == 0: return True - except ValueError: pass + except ValueError: + pass return False - def get_model(self): - """ - Retrieves the model number (or part number) of the sfp - """ - try: - vendor_pn_data = self._get_eeprom_data('model') - vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] - except (TypeError, ValueError): - return 'N/A' - - return vendor_pn - - def get_serial(self): - """ - Retrieves the serial number of the sfp - """ - try: - vendor_sn_data = self._get_eeprom_data('serial') - vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] - except (TypeError, ValueError): - return 'N/A' - - return vendor_sn - def get_reset_status(self): """ Retrives the reset status of SFP @@ -895,106 +191,20 @@ def get_reset_status(self): # Mask off 4th bit for reset status mask = (1 << 4) reset_status = not (reg_value & mask) - except ValueError: pass + except ValueError: + pass return reset_status - def get_rx_los(self): - """ - Retrieves the RX LOS (lost-of-signal) status of SFP - """ - rx_los_list = [] - try: - if self.sfp_type == 'QSFP_DD': - offset = 512 - rx_los_mask = [ 0x01, 0x02, 0x04, 0x08 ,0x10, 0x20, 0x40, 0x80 ] - dom_channel_monitor_raw = self._read_eeprom_bytes(self.eeprom_path, - offset + QSFP_DD_RXLOS_OFFSET, QSFP_DD_RXLOS_WIDTH) - if dom_channel_monitor_raw is not None: - rx_los_data = int(dom_channel_monitor_raw[0], 8) - for mask in rx_los_mask: - rx_los_list.append(rx_los_data & mask != 0) - - elif self.sfp_type == 'QSFP': - rx_los_data = self._get_eeprom_data('rx_los') - # As the function expects a single boolean, if any one channel experience LOS, - # is considered LOS for QSFP - for rx_los_id in ('Rx1LOS', 'Rx2LOS', 'Rx3LOS', 'Rx4LOS') : - rx_los_list.append(rx_los_data['data'][rx_los_id]['value'] == 'On') - else: - rx_los_data = self._read_eeprom_bytes(self.eeprom_path, SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - data = int(rx_los_data[0], 16) - rx_los_list.append(sffbase().test_bit(data, 1) != 0) - except (TypeError, ValueError): - return 'N/A' - return rx_los_list - - def get_tx_fault(self): - """ - Retrieves the TX fault status of SFP - """ - tx_fault_list = [] - try: - if self.sfp_type == 'QSFP_DD': - tx_fault_list.append(False) - elif self.sfp_type == 'QSFP': - tx_fault_data = self._get_eeprom_data('tx_fault') - for tx_fault_id in ('Tx1Fault', 'Tx2Fault', 'Tx3Fault', 'Tx4Fault') : - tx_fault_list.append(tx_fault_data['data'][tx_fault_id]['value'] == 'On') - else: - tx_fault_data = self._read_eeprom_bytes(self.eeprom_path, SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - data = int(tx_fault_data[0], 16) - tx_fault_list.append(sffbase().test_bit(data, 2) != 0) - except (TypeError, ValueError): - return 'N/A' - return tx_fault_list - - def get_tx_disable(self): - """ - Retrieves the tx_disable status of this SFP - """ - tx_disable_list = [] - try: - if self.sfp_type == 'QSFP_DD': - return False - elif self.sfp_type == 'QSFP': - tx_disable_data = self._get_eeprom_data('tx_disable') - for tx_disable_id in ('Tx1Disable', 'Tx2Disable', 'Tx3Disable', 'Tx4Disable'): - tx_disable_list.append(tx_disable_data['data'][tx_disable_id]['value'] == 'On') - else: - tx_disable_data = self._read_eeprom_bytes(self.eeprom_path, SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - data = int(tx_disable_data[0], 16) - tx_disable_hard = (sffbase().test_bit(data, SFP_TX_DISABLE_HARD_BIT) != 0) - tx_disable_soft = (sffbase().test_bit(data, SFP_TX_DISABLE_SOFT_BIT) != 0) - tx_disable_list.append(tx_disable_hard | tx_disable_soft) - except (TypeError, ValueError): - return 'N/A' - return tx_disable_list - - def get_tx_disable_channel(self): - """ - Retrieves the TX disabled channels in this SFP - """ - tx_disable_channel = 0 - try: - if self.sfp_type == 'QSFP_DD': - tx_disable_channel = 0 - elif self.sfp_type == 'QSFP': - tx_disable_data = self._get_eeprom_data('tx_disable') - for tx_disable_id in ('Tx1Disable', 'Tx2Disable', 'Tx3Disable', 'Tx4Disable'): - tx_disable_channel <<= 1 - tx_disable_channel |= (tx_disable_data['data']['Tx1Disable']['value'] == 'On') - except (TypeError, ValueError): - return 'N/A' - return tx_disable_channel - def get_lpmode(self): """ Retrieves the lpmode(low power mode) of this SFP """ lpmode_state = False try: - if self.sfp_type.startswith('QSFP'): + if self.sfp_type == 'QSFP_DD': + return SfpOptoeBase.get_lpmode(self) + else: # Port offset starts with 0x4000 port_offset = 16384 + ((self.index-1) * 16) @@ -1005,192 +215,9 @@ def get_lpmode(self): mask = (1 << 6) lpmode_state = (reg_value & mask) - except ValueError: pass - return lpmode_state - - def get_power_override(self): - """ - Retrieves the power-override status of this SFP - """ - power_override_state = False - - try: - if self.sfp_type.startswith('QSFP'): - power_override_data = self._get_eeprom_data('power_override') - power_override = power_override_data['data']['PowerOverRide']['value'] - power_override_state = (power_override is 'On') - except (TypeError, ValueError): pass - return power_override_state - - def get_temperature(self): - """ - Retrieves the temperature of this SFP - """ - temperature = 0.0 - try: - if self.sfp_type == 'QSFP_DD': - if self.qsfp_dd_DomInfo is None: - return None - dom_data_raw = self._read_eeprom_bytes(self.eeprom_path, QSFP_DD_TEMP_OFFSET, QSFP_DD_TEMP_WIDTH) - if dom_data_raw is None: - return None - temperature_data = self.qsfp_dd_DomInfo.parse_temperature(dom_data_raw, 0) - - else: - temperature_data = self._get_eeprom_data('Temperature') - if temperature_data is not None: - temperature = self._strip_unit_from_str(temperature_data['data']['Temperature']['value']) - except (TypeError, ValueError): - return None - return temperature - - def get_voltage(self): - """ - Retrieves the supply voltage of this SFP - """ - voltage = 0.0 - try: - if self.sfp_type == 'QSFP_DD': - if self.qsfp_dd_DomInfo is None: - return None - dom_data_raw = self._read_eeprom_bytes(self.eeprom_path, QSFP_DD_VOLT_OFFSET, QSFP_DD_VOLT_WIDTH) - if dom_data_raw is None: - return None - voltage_data = self.qsfp_dd_DomInfo.parse_voltage(dom_data_raw, 0) - - else: - voltage_data = self._get_eeprom_data('Voltage') - if voltage_data is not None: - voltage = self._strip_unit_from_str(voltage_data['data']['Vcc']['value']) - except (TypeError, ValueError): - return None - return voltage - - def get_tx_bias(self): - """ - Retrieves the TX bias current of this SFP - """ - tx_bias_list = [] - try: - offset = QSFP_DD_PAGE17 - if self.sfp_type == 'QSFP_DD': - if self.qsfp_dd_DomInfo is None: - return None - if not self.qsfp_dd_txbias_supported: - for lane in range(0, 8): - tx_bias_list.append("N/A") - return tx_bias_list - - tx_bias_data_raw = self._read_eeprom_bytes(self.eeprom_path, offset + QSFP_DD_TXBIAS_OFFSET, QSFP_DD_TXBIAS_WIDTH) - tx_bias_data = self.qsfp_dd_DomInfo.parse_dom_tx_bias(tx_bias_data_raw, 0) - - for tx_bias_id in ('TX1Bias', 'TX2Bias', 'TX3Bias', 'TX4Bias', - 'TX5Bias', 'TX6Bias', 'TX7Bias', 'TX8Bias'): - tx_bias = self._strip_unit_from_str(tx_bias_data['data'][tx_bias_id]['value']) - tx_bias_list.append(tx_bias) - - elif self.sfp_type == 'QSFP': - tx_bias_data = self._get_eeprom_data('ChannelMonitor') - for tx_bias_id in ('TX1Bias', 'TX2Bias', 'TX3Bias', 'TX4Bias'): - tx_bias = self._strip_unit_from_str(tx_bias_data['data'][tx_bias_id]['value']) - tx_bias_list.append(tx_bias) - else: - tx_bias_data = self._get_eeprom_data('ChannelMonitor') - if tx_bias_data is not None: - tx1_bias = self._strip_unit_from_str(tx_bias_data['data']['TXBias']['value']) - tx_bias_list.append(tx1_bias) - - except (TypeError, ValueError): - return None - return tx_bias_list - - def get_rx_power(self): - """ - Retrieves the received optical power for this SFP - """ - rx_power_list = [] - try: - if self.sfp_type == 'QSFP_DD': - if self.qsfp_dd_DomInfo is None: - return None - if not self.qsfp_dd_rxpower_supported: - for lane in range(0, 8): - rx_power_list.append("N/A") - return rx_power_list - - offset = QSFP_DD_PAGE17 - rx_power_data_raw = self._read_eeprom_bytes(self.eeprom_path, offset + QSFP_DD_RXPOWER_OFFSET, QSFP_DD_TXPOWER_WIDTH) - rx_power_data = self.qsfp_dd_DomInfo.parse_dom_rx_power(rx_power_data_raw, 0) - - for rx_power_id in ('RX1Power', 'RX2Power', 'RX3Power', 'RX4Power', - 'RX5Power', 'RX6Power', 'RX7Power', 'RX8Power'): - rx_power = self._strip_unit_from_str(rx_power_data['data'][rx_power_id]['value']) - rx_power_list.append(rx_power) - - elif self.sfp_type == 'QSFP': - rx_power_data = self._get_eeprom_data('ChannelMonitor') - for rx_power_id in ('RX1Power', 'RX2Power', 'RX3Power', 'RX4Power'): - rx_power = rx_power_data['data'][rx_power_id]['value'] - rx_power_list.append(rx_power) - else: - rx_power_data = self._get_eeprom_data('ChannelMonitor') - if rx_power_data is not None: - rx1_pw = self._strip_unit_from_str(rx_power_data['data']['RXPower']['value']) - rx_power_list.append(rx1_pw) - except (TypeError, ValueError): - return None - return rx_power_list - - def get_tx_power(self): - """ - Retrieves the TX power of this SFP - """ - tx_power_list = [] - try: - if self.sfp_type == 'QSFP_DD': - if self.qsfp_dd_DomInfo is None: - return None - if not self.qsfp_dd_txpower_supported: - for lane in range(0, 8): - tx_power_list.append("N/A") - return tx_power_list - - offset = QSFP_DD_PAGE17 - tx_power_data_raw = self._read_eeprom_bytes(self.eeprom_path, offset + QSFP_DD_TXPOWER_OFFSET, - QSFP_DD_TXPOWER_WIDTH) - tx_power_data = self.qsfp_dd_DomInfo.parse_dom_tx_power(tx_power_data_raw, 0) - - for tx_power_id in ('TX1Power', 'TX2Power', 'TX3Power', 'TX4Power', - 'TX5Power', 'TX6Power', 'TX7Power', 'TX8Power'): - tx_pw = self._strip_unit_from_str(tx_power_data['data'][tx_power_id]['value']) - tx_power_list.append(tx_pw) - - elif self.sfp_type == 'QSFP': - # QSFP capability byte parse, through this byte can know whether it support tx_power or not. - # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, - # need to add more code for determining the capability and version compliance - # in SFF-8636 dom capability definitions evolving with the versions. - qspf_dom_capability_data = self._get_eeprom_data('dom_capability') - qsfp_dom_rev_data = self._get_eeprom_data('dom_rev') - qsfp_dom_rev = qsfp_dom_rev_data['data']['dom_rev']['value'] - qsfp_tx_power_support = qspf_dom_capability_data['data']['Tx_power_support']['value'] - - # The tx_power monitoring is only available on QSFP which compliant with SFF-8636 - # and claimed that it support tx_power with one indicator bit. - if (qsfp_dom_rev[0:8] != 'SFF-8636' or (qsfp_dom_rev[0:8] == 'SFF-8636' and qsfp_tx_power_support != 'on')): - return None - channel_monitor_data = self._get_eeprom_data('ChannelMonitor_TxPower') - for tx_power_id in ('TX1Power', 'TX2Power', 'TX3Power', 'TX4Power'): - tx_pw = self._strip_unit_from_str(channel_monitor_data['data'][tx_power_id]['value']) - tx_power_list.append(tx_pw) - else: - channel_monitor_data = self._get_eeprom_data('ChannelMonitor') - if channel_monitor_data is not None: - tx1_pw = self._strip_unit_from_str(channel_monitor_data['data']['TXPower']['value']) - tx_power_list.append(tx1_pw) - except (TypeError, ValueError): - return None - return tx_power_list + except ValueError: + pass + return bool(lpmode_state) def reset(self): """ @@ -1222,8 +249,8 @@ def reset(self): self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset) else: return False - except ValueError: - return False + except ValueError: + return False return True def set_lpmode(self, lpmode): @@ -1231,7 +258,9 @@ def set_lpmode(self, lpmode): Sets the lpmode(low power mode) of this SFP """ try: - if self.port_type == 'QSFP_DD': + if self.sfp_type == 'QSFP_DD': + return SfpOptoeBase.set_lpmode(self, lpmode) + else: # Port offset starts with 0x4000 port_offset = 16384 + ((self.index-1) * 16) @@ -1249,7 +278,7 @@ def set_lpmode(self, lpmode): # Convert our register value back to a hex string and write back self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset) - except ValueError: + except ValueError: return False return True @@ -1270,62 +299,23 @@ def get_intl_state(self): mask = (1 << 4) intl_state = (reg_value & mask) - except ValueError: pass + except ValueError: + pass return intl_state - def tx_disable(self, tx_disable): - """ - Disable SFP TX for all channels - """ - return False - - def tx_disable_channel(self, channel, disable): - """ - Sets the tx_disable for specified SFP channels - """ - return False - - def set_power_override(self, power_override, power_set): - """ - Sets SFP power level using power_override and power_set - """ - return False - - def get_status(self): - """ - Retrieves the operational status of the device - """ - reset = self.get_reset_status() - return (not reset) - - def get_port_form_factor(self): - """ - Retrieves the native port type - """ - return self.port_type - - def get_max_port_power(self): - """ - Retrieves the maximum power allowed on the port in watts - *** - This method of fetching power values is not ideal. - TODO: enhance by placing power limits in config file - *** - """ - return 12.0 if self.port_type == 'QSFP_DD' else 2.5 - def set_media_type(self): """ Reads optic eeprom byte to determine media type inserted """ eeprom_raw = [] - eeprom_raw = self._read_eeprom_bytes(self.eeprom_path, MEDIA_TYPE_OFFSET, MEDIA_TYPE_WIDTH) + eeprom_raw = self._xcvr_api_factory._get_id() if eeprom_raw is not None: - if eeprom_raw[0] in SFP_TYPE_LIST: + eeprom_raw = hex(eeprom_raw) + if eeprom_raw in SFP_TYPE_LIST: self.sfp_type = 'SFP' - elif eeprom_raw[0] in QSFP_TYPE_LIST: + elif eeprom_raw in QSFP_TYPE_LIST: self.sfp_type = 'QSFP' - elif eeprom_raw[0] in QSFP_DD_TYPE_LIST: + elif eeprom_raw in QSFP_DD_TYPE_LIST: self.sfp_type = 'QSFP_DD' else: #Set native port type if EEPROM type is not recognized/readable @@ -1339,9 +329,12 @@ def reinit_sfp_driver(self): """ Changes the driver based on media type detected """ - del_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/delete_device".format(self._port_to_i2c_mapping[self.index]) - new_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/new_device".format(self._port_to_i2c_mapping[self.index]) - driver_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/name".format(self._port_to_i2c_mapping[self.index]) + del_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/delete_device".format( + self._port_to_i2c_mapping[self.index]) + new_sfp_path = "/sys/class/i2c-adapter/i2c-{0}/new_device".format( + self._port_to_i2c_mapping[self.index]) + driver_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/name".format( + self._port_to_i2c_mapping[self.index]) delete_device = "echo 0x50 >" + del_sfp_path if not os.path.isfile(driver_path): @@ -1349,8 +342,8 @@ def reinit_sfp_driver(self): return False try: - with os.fdopen(os.open(driver_path, os.O_RDONLY)) as fd: - driver_name = fd.read() + with os.fdopen(os.open(driver_path, os.O_RDONLY)) as filed: + driver_name = filed.read() driver_name = driver_name.rstrip('\r\n') driver_name = driver_name.lstrip(" ") @@ -1374,8 +367,8 @@ def reinit_sfp_driver(self): subprocess.Popen(new_device, shell=True, stdout=subprocess.PIPE) time.sleep(2) - except IOError as e: - print("Error: Unable to open file: %s" % str(e)) + except IOError as err: + print("Error: Unable to open file: %s" %str(err)) return False return True @@ -1389,10 +382,42 @@ def get_position_in_parent(self): """ return self.index - def is_replaceable(self): + @staticmethod + def is_replaceable(): """ Indicate whether this device is replaceable. Returns: bool: True if it is replaceable. """ return True + + def get_error_description(self): + """ + Retrives the error descriptions of the SFP module + + Returns: + String that represents the current error descriptions of vendor specific errors + In case there are multiple errors, they should be joined by '|', + like: "Bad EEPROM|Unsupported cable" + """ + if not self.get_presence(): + return self.SFP_STATUS_UNPLUGGED + else: + if not os.path.isfile(self.eeprom_path): + return "EEPROM driver is not attached" + + if self.sfp_type == 'SFP': + offset = SFP_INFO_OFFSET + elif self.sfp_type == 'QSFP': + offset = QSFP_INFO_OFFSET + elif self.sfp_type == 'QSFP_DD': + offset = QSFP_DD_PAGE0 + + try: + with open(self.eeprom_path, mode="rb", buffering=0) as eeprom: + eeprom.seek(offset) + eeprom.read(1) + except OSError as e: + return "EEPROM read failed ({})".format(e.strerror) + + return self.SFP_STATUS_OK diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6332/sonic_platform/qsfp.py b/platform/broadcom/sonic-platform-modules-inventec/d6332/sonic_platform/qsfp.py index 17763cd1264f..b1f8799ab593 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/d6332/sonic_platform/qsfp.py +++ b/platform/broadcom/sonic-platform-modules-inventec/d6332/sonic_platform/qsfp.py @@ -362,7 +362,7 @@ def get_transceiver_info(self): transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] if sfp_vendor_name_data else 'N/A' transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] if sfp_vendor_pn_data else 'N/A' - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] if sfp_vendor_rev_data else 'N/A' + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] if sfp_vendor_rev_data else 'N/A' transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] if sfp_vendor_sn_data else 'N/A' transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] if sfp_vendor_oui_data else 'N/A' transceiver_info_dict['vendor_date'] = sfp_vendor_date_data['data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] if sfp_vendor_date_data else 'N/A' diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6356/sonic_platform/qsfp.py b/platform/broadcom/sonic-platform-modules-inventec/d6356/sonic_platform/qsfp.py index 2cc4b6ca593a..fccde46df4c5 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/d6356/sonic_platform/qsfp.py +++ b/platform/broadcom/sonic-platform-modules-inventec/d6356/sonic_platform/qsfp.py @@ -240,7 +240,7 @@ def get_transceiver_info(self): keys |Value Format |Information ---------------------------|---------------|---------------------------- type |1*255VCHAR |type of SFP - hardware_rev |1*255VCHAR |hardware version of SFP + vendor_rev |1*255VCHAR |vendor revision of SFP serial |1*255VCHAR |serial number of the SFP manufacturer |1*255VCHAR |SFP vendor name model |1*255VCHAR |SFP model name @@ -256,7 +256,7 @@ def get_transceiver_info(self): ======================================================================== """ - transceiver_info_dict_keys = ['type', 'hardware_rev', + transceiver_info_dict_keys = ['type', 'vendor_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', @@ -314,7 +314,7 @@ def get_transceiver_info(self): transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] if sfp_vendor_name_data else 'N/A' transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] if sfp_vendor_pn_data else 'N/A' - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] if sfp_vendor_rev_data else 'N/A' + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] if sfp_vendor_rev_data else 'N/A' transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] if sfp_vendor_sn_data else 'N/A' transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] if sfp_vendor_oui_data else 'N/A' transceiver_info_dict['vendor_date'] = sfp_vendor_date_data['data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] if sfp_vendor_date_data else 'N/A' diff --git a/platform/broadcom/sonic-platform-modules-inventec/d6356/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-inventec/d6356/sonic_platform/sfp.py index 8c432dc19764..5c75a8749a46 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/d6356/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-inventec/d6356/sonic_platform/sfp.py @@ -227,7 +227,7 @@ def get_transceiver_info(self): keys |Value Format |Information ---------------------------|---------------|---------------------------- type |1*255VCHAR |type of SFP - hardware_rev |1*255VCHAR |hardware version of SFP + vendor_rev |1*255VCHAR |vendor revision of SFP serial |1*255VCHAR |serial number of the SFP manufacturer |1*255VCHAR |SFP vendor name model |1*255VCHAR |SFP model name @@ -243,7 +243,7 @@ def get_transceiver_info(self): ======================================================================== """ - transceiver_info_dict_keys = ['type', 'hardware_rev', + transceiver_info_dict_keys = ['type', 'vendor_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', @@ -303,7 +303,7 @@ def get_transceiver_info(self): transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] if sfp_vendor_name_data else 'N/A' transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] if sfp_vendor_pn_data else 'N/A' - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] if sfp_vendor_rev_data else 'N/A' + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] if sfp_vendor_rev_data else 'N/A' transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] if sfp_vendor_sn_data else 'N/A' transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] if sfp_vendor_oui_data else 'N/A' transceiver_info_dict['vendor_date'] = sfp_vendor_date_data['data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] if sfp_vendor_date_data else 'N/A' diff --git a/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/sonic_platform/sfp.py index a18d98d502f5..9d6337195d5d 100644 --- a/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-inventec/d7054q28b/sonic_platform/sfp.py @@ -231,7 +231,7 @@ def __init__(self, sfp_index, sfp_type): port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) self.port_to_eeprom_mapping[x] = port_eeprom_path - self.info_dict_keys = ['type', 'hardware_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', + self.info_dict_keys = ['type', 'vendor_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', 'vendor_date', 'vendor_oui'] self.dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', 'power_lpmode', 'tx_disable', 'tx_disable_channel', 'temperature', 'voltage', @@ -425,7 +425,7 @@ def get_transceiver_info(self): keys |Value Format |Information ---------------------------|---------------|---------------------------- type |1*255VCHAR |type of SFP - hardware_rev |1*255VCHAR |hardware version of SFP + vendor_rev |1*255VCHAR |vendor revision of SFP serial |1*255VCHAR |serial number of the SFP manufacturer |1*255VCHAR |SFP vendor name model |1*255VCHAR |SFP model name @@ -487,7 +487,7 @@ def get_transceiver_info(self): transceiver_info_dict['type'] = sfp_type_data['data']['type']['value'] transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] transceiver_info_dict['vendor_oui'] = 'N/A' transceiver_info_dict['vendor_date'] = 'N/A' @@ -558,7 +558,7 @@ def get_transceiver_info(self): transceiver_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value'] transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] transceiver_info_dict['vendor_date'] = sfp_vendor_date_data['data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] diff --git a/platform/broadcom/sonic-platform-modules-juniper/common/modules/gpio-tmc.c b/platform/broadcom/sonic-platform-modules-juniper/common/modules/gpio-tmc.c index 7b02e8a5bc74..35de9e007b46 100644 --- a/platform/broadcom/sonic-platform-modules-juniper/common/modules/gpio-tmc.c +++ b/platform/broadcom/sonic-platform-modules-juniper/common/modules/gpio-tmc.c @@ -609,7 +609,7 @@ static int tmc_gpio_probe(struct platform_device *pdev) dev_info(dev, "TMC GPIO resource 0x%llx, %llu\n", res->start, resource_size(res)); - chip->base = devm_ioremap_nocache(dev, res->start, resource_size(res)); + chip->base = devm_ioremap(dev, res->start, resource_size(res)); if (!chip->base) return -ENOMEM; diff --git a/platform/broadcom/sonic-platform-modules-juniper/common/modules/i2c-tmc.c b/platform/broadcom/sonic-platform-modules-juniper/common/modules/i2c-tmc.c index afd0311dc130..15e7334434c6 100644 --- a/platform/broadcom/sonic-platform-modules-juniper/common/modules/i2c-tmc.c +++ b/platform/broadcom/sonic-platform-modules-juniper/common/modules/i2c-tmc.c @@ -1029,7 +1029,7 @@ static int tmc_i2c_probe(struct platform_device *pdev) dev_info(dev, "Tmc I2C Accel resource 0x%llx, %llu\n", res->start, resource_size(res)); - tmc->membase = devm_ioremap_nocache(dev, res->start, + tmc->membase = devm_ioremap(dev, res->start, resource_size(res)); if (!tmc->membase) return -ENOMEM; @@ -1041,7 +1041,7 @@ static int tmc_i2c_probe(struct platform_device *pdev) dev_info(dev, "Tmc I2C Mem resource 0x%llx, %llu\n", res->start, resource_size(res)); - tmc->dpmbase = devm_ioremap_nocache(dev, res->start, + tmc->dpmbase = devm_ioremap(dev, res->start, resource_size(res)); if (!tmc->dpmbase) return -ENOMEM; diff --git a/platform/broadcom/sonic-platform-modules-juniper/common/modules/jnx-refpga-tmc.c b/platform/broadcom/sonic-platform-modules-juniper/common/modules/jnx-refpga-tmc.c index ef36bca72e9d..f291a9c73e55 100644 --- a/platform/broadcom/sonic-platform-modules-juniper/common/modules/jnx-refpga-tmc.c +++ b/platform/broadcom/sonic-platform-modules-juniper/common/modules/jnx-refpga-tmc.c @@ -529,7 +529,7 @@ static int jnx_refpga_tmc_probe(struct platform_device *pdev) return -ENODEV; } - tmc_membase = devm_ioremap_nocache(dev, res->start, resource_size(res)); + tmc_membase = devm_ioremap(dev, res->start, resource_size(res)); if (!tmc_membase) { dev_err(dev, "ioremap failed\n"); return -ENOMEM; diff --git a/platform/broadcom/sonic-platform-modules-juniper/debian/rules b/platform/broadcom/sonic-platform-modules-juniper/debian/rules index 1a781912a544..d672bbdf220f 100755 --- a/platform/broadcom/sonic-platform-modules-juniper/debian/rules +++ b/platform/broadcom/sonic-platform-modules-juniper/debian/rules @@ -13,7 +13,7 @@ include /usr/share/dpkg/pkg-info.mk export INSTALL_MOD_DIR:=extra -PYTHON ?= python2 +PYTHON ?= python3 PACKAGE_PRE_NAME := sonic-platform-juniper KVERSION ?= $(shell uname -r) diff --git a/platform/broadcom/sonic-platform-modules-juniper/qfx5200/modules/jnx-tmc-psu.c b/platform/broadcom/sonic-platform-modules-juniper/qfx5200/modules/jnx-tmc-psu.c index 86eeb6f88e45..1b30327bd8f3 100644 --- a/platform/broadcom/sonic-platform-modules-juniper/qfx5200/modules/jnx-tmc-psu.c +++ b/platform/broadcom/sonic-platform-modules-juniper/qfx5200/modules/jnx-tmc-psu.c @@ -109,7 +109,7 @@ static int tmc_psu_probe(struct platform_device *pdev) return -ENODEV; } - addr = devm_ioremap_nocache(dev, res->start, resource_size(res)); + addr = devm_ioremap(dev, res->start, resource_size(res)); if (!addr) { dev_err(dev, "ioremap failed\n"); return -ENOMEM; diff --git a/platform/broadcom/sonic-platform-modules-juniper/qfx5200/modules/leds-jnx-tmc.c b/platform/broadcom/sonic-platform-modules-juniper/qfx5200/modules/leds-jnx-tmc.c index 134faefd70a3..9b1ea4d11ce1 100644 --- a/platform/broadcom/sonic-platform-modules-juniper/qfx5200/modules/leds-jnx-tmc.c +++ b/platform/broadcom/sonic-platform-modules-juniper/qfx5200/modules/leds-jnx-tmc.c @@ -121,7 +121,7 @@ static int jnx_tmc_leds_init(struct device *dev, struct tmc_led_data *ild, return -ENODEV; } - addr = devm_ioremap_nocache(dev, res->start, resource_size(res)); + addr = devm_ioremap(dev, res->start, resource_size(res)); if (!addr) { dev_err(dev, "ioremap failed\n"); return -ENOMEM; diff --git a/platform/broadcom/sonic-platform-modules-juniper/sonic_platform/__init__.py b/platform/broadcom/sonic-platform-modules-juniper/sonic_platform/__init__.py index 9e1b2e56b1c4..aafda353d2ce 100755 --- a/platform/broadcom/sonic-platform-modules-juniper/sonic_platform/__init__.py +++ b/platform/broadcom/sonic-platform-modules-juniper/sonic_platform/__init__.py @@ -1 +1 @@ -import platform +from . import platform diff --git a/platform/broadcom/sonic-platform-modules-juniper/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-juniper/sonic_platform/chassis.py index 4f673ab086ba..9eb9b07a618f 100755 --- a/platform/broadcom/sonic-platform-modules-juniper/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-juniper/sonic_platform/chassis.py @@ -36,7 +36,7 @@ try: import os - import commands + import subprocess import sys import time import syslog @@ -65,7 +65,7 @@ def get_parameter_value(self,parameter_name): return content[1:] return "False" except IOError: - print "Error: File not found" + print("Error: File not found") return "False" def get_product_name(self): @@ -242,7 +242,7 @@ def get_reboot_cause(self): log_info("Juniper Platform name: {} and {}".format(self.get_platform_name(), platform_name)) if str(platform_name) == "x86_64-juniper_networks_qfx5210-r0": log_info("Juniper Platform QFX5210 ") - status, last_reboot_reason = commands.getstatusoutput("i2cget -f -y 0 0x65 0x24") + status, last_reboot_reason = subprocess.getstatusoutput("i2cget -f -y 0 0x65 0x24") if (status == 0): if last_reboot_reason == "0x80": return (ChassisBase.REBOOT_CAUSE_NON_HARDWARE, None) @@ -256,7 +256,7 @@ def get_reboot_cause(self): return (ChassisBase.REBOOT_CAUSE_HARDWARE_OTHER, "Unknown reason") else: time.sleep(3) - status, last_reboot_reason = commands.getstatusoutput("i2cget -f -y 0 0x65 0x24") + status, last_reboot_reason = subprocess.getstatusoutput("i2cget -f -y 0 0x65 0x24") if last_reboot_reason == "0x80": return (ChassisBase.REBOOT_CAUSE_NON_HARDWARE, None) elif last_reboot_reason == "0x40" or last_reboot_reason == "0x08": @@ -270,9 +270,9 @@ def get_reboot_cause(self): elif str(platform_name) == "x86_64-juniper_networks_qfx5200-r0" : log_info("Juniper Platform QFX5200 ") - status, major_version = commands.getstatusoutput("busybox devmem 0xFED50000 8") - status, minor_version = commands.getstatusoutput("busybox devmem 0xFED50001 8") - status, last_reboot_reason = commands.getstatusoutput("busybox devmem 0xFED50004 8") + status, major_version = subprocess.getstatusoutput("busybox devmem 0xFED50000 8") + status, minor_version = subprocess.getstatusoutput("busybox devmem 0xFED50001 8") + status, last_reboot_reason = subprocess.getstatusoutput("busybox devmem 0xFED50004 8") if (status == 0): if (major_version == "0x31") and (minor_version == "0x03") and (last_reboot_reason == "0x80"): return (ChassisBase.REBOOT_CAUSE_NON_HARDWARE, None) @@ -288,9 +288,9 @@ def get_reboot_cause(self): return (ChassisBase.REBOOT_CAUSE_HARDWARE_OTHER, "Unknown reason") else: time.sleep(3) - status, major_version = commands.getstatusoutput("busybox devmem 0xFED50000 8") - status, minor_version = commands.getstatusoutput("busybox devmem 0xFED50001 8") - status, last_reboot_reason = commands.getstatusoutput("busybox devmem 0xFED50004 8") + status, major_version = subprocess.getstatusoutput("busybox devmem 0xFED50000 8") + status, minor_version = subprocess.getstatusoutput("busybox devmem 0xFED50001 8") + status, last_reboot_reason = subprocess.getstatusoutput("busybox devmem 0xFED50004 8") if (status == 0): if (major_version == "0x31") and (minor_version == "0x03") and (last_reboot_reason == "0x80"): return (ChassisBase.REBOOT_CAUSE_NON_HARDWARE, None) diff --git a/platform/broadcom/sonic-platform-modules-nokia b/platform/broadcom/sonic-platform-modules-nokia index 90afc22977b4..b67d4795e691 160000 --- a/platform/broadcom/sonic-platform-modules-nokia +++ b/platform/broadcom/sonic-platform-modules-nokia @@ -1 +1 @@ -Subproject commit 90afc22977b481e4511953904e3d66c68d039537 +Subproject commit b67d4795e691cccd4321b196ba92942f5e8fe395 diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/sfp.py index c97e91d74a75..a00fc8f2977c 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/sonic_platform/sfp.py @@ -221,7 +221,7 @@ def __init__(self, sfp_index, sfp_type): port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) self.port_to_eeprom_mapping[x] = port_eeprom_path - self.info_dict_keys = ['type', 'hardware_rev', 'serial', 'manufacturer', + self.info_dict_keys = ['type', 'vendor_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', 'vendor_date', @@ -447,7 +447,7 @@ def get_transceiver_info(self): keys |Value Format |Information ---------------------------|---------------|---------------------------- type |1*255VCHAR |type of SFP - hardware_rev |1*255VCHAR |hardware version of SFP + vendor_rev |1*255VCHAR |vendor revision of SFP serial |1*255VCHAR |serial number of the SFP manufacturer |1*255VCHAR |SFP vendor name model |1*255VCHAR |SFP model name @@ -544,7 +544,7 @@ def get_transceiver_info(self): ['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data \ ['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data \ + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data \ ['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data \ ['data']['Vendor SN']['value'] diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/sfp.py index d06ae5cabed7..759fa99a4bea 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-bwde-32x/sonic_platform/sfp.py @@ -221,7 +221,7 @@ def __init__(self, sfp_index, sfp_type): port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) self.port_to_eeprom_mapping[x] = port_eeprom_path - self.info_dict_keys = ['type', 'hardware_rev', 'serial', 'manufacturer', + self.info_dict_keys = ['type', 'vendor_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', 'vendor_date', @@ -447,7 +447,7 @@ def get_transceiver_info(self): keys |Value Format |Information ---------------------------|---------------|---------------------------- type |1*255VCHAR |type of SFP - hardware_rev |1*255VCHAR |hardware version of SFP + vendor_rev |1*255VCHAR |vendor revision of SFP serial |1*255VCHAR |serial number of the SFP manufacturer |1*255VCHAR |SFP vendor name model |1*255VCHAR |SFP model name @@ -544,7 +544,7 @@ def get_transceiver_info(self): ['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data \ ['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data \ + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data \ ['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data \ ['data']['Vendor SN']['value'] diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/sfp.py index 6679e96a7eb2..a1a3d92f8c2d 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/sonic_platform/sfp.py @@ -243,7 +243,7 @@ def __init__(self, sfp_index, sfp_type): port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) self.port_to_eeprom_mapping[x] = port_eeprom_path - self.info_dict_keys = ['type', 'hardware_rev', 'serial', 'manufacturer', + self.info_dict_keys = ['type', 'vendor_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', 'vendor_date', @@ -477,7 +477,7 @@ def get_transceiver_info(self): keys |Value Format |Information ---------------------------|---------------|---------------------------- type |1*255VCHAR |type of SFP - hardware_rev |1*255VCHAR |hardware version of SFP + vendor_rev |1*255VCHAR |vendor revision of SFP serial |1*255VCHAR |serial number of the SFP manufacturer |1*255VCHAR |SFP vendor name model |1*255VCHAR |SFP model name @@ -574,7 +574,7 @@ def get_transceiver_info(self): ['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data \ ['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data \ + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data \ ['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data \ ['data']['Vendor SN']['value'] diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/sfp.py index 3b75b6927578..bd7692be168b 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8a-bwde-56x/sonic_platform/sfp.py @@ -243,7 +243,7 @@ def __init__(self, sfp_index, sfp_type): port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) self.port_to_eeprom_mapping[x] = port_eeprom_path - self.info_dict_keys = ['type', 'hardware_rev', 'serial', 'manufacturer', + self.info_dict_keys = ['type', 'vendor_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', 'vendor_date', @@ -477,7 +477,7 @@ def get_transceiver_info(self): keys |Value Format |Information ---------------------------|---------------|---------------------------- type |1*255VCHAR |type of SFP - hardware_rev |1*255VCHAR |hardware version of SFP + vendor_rev |1*255VCHAR |vendor revision of SFP serial |1*255VCHAR |serial number of the SFP manufacturer |1*255VCHAR |SFP vendor name model |1*255VCHAR |SFP model name @@ -574,7 +574,7 @@ def get_transceiver_info(self): ['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data \ ['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data \ + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data \ ['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data \ ['data']['Vendor SN']['value'] diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/sfp.py index a85b225afec8..e7d0146b5504 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8c-56x/sonic_platform/sfp.py @@ -243,7 +243,7 @@ def __init__(self, sfp_index, sfp_type): port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) self.port_to_eeprom_mapping[x] = port_eeprom_path - self.info_dict_keys = ['type', 'hardware_rev', 'serialnum', 'manufacturer', + self.info_dict_keys = ['type', 'vendor_rev', 'serialnum', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', 'vendor_date', @@ -477,7 +477,7 @@ def get_transceiver_info(self): keys |Value Format |Information ---------------------------|---------------|---------------------------- type |1*255VCHAR |type of SFP - hardware_rev |1*255VCHAR |hardware version of SFP + vendor_rev |1*255VCHAR |vendor revision of SFP serialnum |1*255VCHAR |serial number of the SFP manufacturer |1*255VCHAR |SFP vendor name model |1*255VCHAR |SFP model name @@ -574,7 +574,7 @@ def get_transceiver_info(self): ['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data \ ['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data \ + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data \ ['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data \ ['data']['Vendor SN']['value'] diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/sfp.py index e4505f509a10..726e18b23153 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-quanta/ix9-32x/sonic_platform/sfp.py @@ -326,7 +326,7 @@ def __init__(self, sfp_index, sfp_type): self._detect_sfp_type(sfp_type) - self.info_dict_keys = ['type', 'hardware_rev', 'serial', 'manufacturer', + self.info_dict_keys = ['type', 'vendor_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', 'vendor_date', 'vendor_oui', 'application_advertisement'] @@ -595,7 +595,7 @@ def get_transceiver_info(self): keys |Value Format |Information ---------------------------|---------------|---------------------------- type |1*255VCHAR |type of SFP - hardware_rev |1*255VCHAR |hardware version of SFP + vendor_rev |1*255VCHAR |vendor revision of SFP serial |1*255VCHAR |serial number of the SFP manufacturer |1*255VCHAR |SFP vendor name model |1*255VCHAR |SFP model name @@ -668,7 +668,7 @@ def get_transceiver_info(self): transceiver_info_dict['type'] = sfp_type_data['data']['type']['value'] transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] transceiver_info_dict['vendor_oui'] = 'N/A' transceiver_info_dict['vendor_date'] = 'N/A' @@ -793,7 +793,7 @@ def get_transceiver_info(self): transceiver_info_dict['type'] = str(sfp_type_data['data']['type']['value']) transceiver_info_dict['manufacturer'] = str(sfp_vendor_name_data['data']['Vendor Name']['value']) transceiver_info_dict['model'] = str(sfp_vendor_pn_data['data']['Vendor PN']['value']) - transceiver_info_dict['hardware_rev'] = str(sfp_vendor_rev_data['data']['Vendor Rev']['value']) + transceiver_info_dict['vendor_rev'] = str(sfp_vendor_rev_data['data']['Vendor Rev']['value']) transceiver_info_dict['serial'] = str(sfp_vendor_sn_data['data']['Vendor SN']['value']) transceiver_info_dict['vendor_oui'] = str(sfp_vendor_oui_data['data']['Vendor OUI']['value']) transceiver_info_dict['vendor_date'] = str(sfp_vendor_date_data['data']['VendorDataCode(YYYY-MM-DD Lot)']['value']) @@ -867,7 +867,7 @@ def get_transceiver_info(self): transceiver_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value'] transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] transceiver_info_dict['vendor_date'] = sfp_vendor_date_data['data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/Makefile b/platform/broadcom/sonic-platform-modules-ragile/common/modules/Makefile index ab97718992e6..f7204c8684d9 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/Makefile @@ -5,3 +5,11 @@ obj-m += ragile_platform.o obj-m += i2c-mux-pca9641.o obj-m += i2c-mux-pca954x.o obj-m += csu550.o +ragile_common-objs := ragile_common_module.o +obj-m += ragile_common.o +obj-m += fpga_pcie_i2c.o +obj-m += fpga_i2c_ocores.o +obj-m += lpc_dbg.o +obj-m += lpc_cpld_i2c_ocores.o +obj-m += rg-i2c-algo-bit.o +obj-m += rg-i2c-gpio.o diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_i2c_ocores.c b/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_i2c_ocores.c new file mode 100755 index 000000000000..81068a14029e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_i2c_ocores.c @@ -0,0 +1,906 @@ +/* + * i2c-ocores.c: I2C bus driver for OpenCores I2C controller + * (http://www.opencores.org/projects.cgi/web/i2c/overview). + * + * Peter Korsgaard + * + * Support for the GRLIB port of the controller by + * Andreas Larsson + * + * This file is licensed under the terms of the GNU General Public License + * version 2. This program is licensed "as is" without any warranty of any + * kind, whether express or implied. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +struct ocores_i2c { + void __iomem *base; + u32 reg_shift; + u32 reg_io_width; + wait_queue_head_t wait; + struct i2c_adapter adap; + struct i2c_msg *msg; + int pos; + int nmsgs; + int state; /* see STATE_ */ + spinlock_t process_lock; + struct mutex xfer_lock; + int clock_khz; + void (*setreg)(struct ocores_i2c *i2c, int reg, u8 value); + u8 (*getreg)(struct ocores_i2c *i2c, int reg); +}; + +/* registers */ +#define OCI2C_PRELOW 0x0 +#define OCI2C_PREHIGH 0x4 +#define OCI2C_CONTROL 0x8 +#define OCI2C_DATA 0xc +#define OCI2C_CMD 0x10 /* write only */ +#define OCI2C_STATUS 0x10 /* read only, same address as OCI2C_CMD */ + +#define OCI2C_TRAN_REV 0x14 +#define OCI2C_CMD_REV 0x18 + + +#define OCI2C_CTRL_IEN 0x40 +#define OCI2C_CTRL_EN 0x80 + +#define OCI2C_CMD_START 0x91 +#define OCI2C_CMD_STOP 0x41 +#define OCI2C_CMD_READ 0x21 +#define OCI2C_CMD_WRITE 0x11 +#define OCI2C_CMD_READ_ACK 0x21 +#define OCI2C_CMD_READ_NACK 0x29 +#define OCI2C_CMD_IACK 0x01 + +#define OCI2C_STAT_IF 0x01 +#define OCI2C_STAT_TIP 0x02 +#define OCI2C_STAT_ARBLOST 0x20 +#define OCI2C_STAT_BUSY 0x40 +#define OCI2C_STAT_NACK 0x80 + +#define STATE_DONE 0 +#define STATE_START 1 +#define STATE_WRITE 2 +#define STATE_READ 3 +#define STATE_ERROR 4 + +#define TYPE_OCORES 0 +#define TYPE_GRLIB 1 + +#define BUF_SIZE 256 +#define DEFAULT_I2C_SCL 100 +#define DEFAULT_I2C_PRE 0xF9 + +int g_fpga_i2c_debug = 0; +int g_fpga_i2c_irq = 0; +int g_fpga_i2c_error = 0; +int g_irq_dump_debug = 0; +int g_irq_invalid_cnt = 0; +int g_fpga_debug = 0; + +module_param(g_fpga_i2c_debug, int, S_IRUGO | S_IWUSR); +module_param(g_fpga_i2c_error, int, S_IRUGO | S_IWUSR); +module_param(g_fpga_i2c_irq, int, S_IRUGO | S_IWUSR); +module_param(g_irq_dump_debug, int, S_IRUGO | S_IWUSR); +module_param(g_irq_invalid_cnt, int, S_IRUGO | S_IWUSR); +module_param(g_fpga_debug, int, S_IRUGO | S_IWUSR); + +#define FPGA_I2C_DEBUG(fmt, args...) do { \ + if (g_fpga_debug) { \ + printk(KERN_DEBUG ""fmt, ## args); \ + } \ +} while (0) + +#define FPGA_I2C_DEBUG_DUMP(fmt, args...) do { \ + if (g_irq_dump_debug) { \ + printk(KERN_ERR ""fmt, ## args); \ + } \ +} while (0) + +#define FPGA_I2C_DEBUG_XFER(fmt, args...) do { \ + if (g_fpga_i2c_irq) { \ + printk(KERN_ERR "[FPGA_I2C][XFER][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ + } \ +} while (0) + +#define FPGA_I2C_DEBUG_VERBOSE(fmt, args...) do { \ + if (g_fpga_i2c_debug) { \ + printk(KERN_ERR "[FPGA_I2C][VER][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ + } \ +} while (0) + +#define FPGA_I2C_DEBUG_ERROR(fmt, args...) do { \ + if (g_fpga_i2c_error) { \ + printk(KERN_ERR "[FPGA_I2C][ERR][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ + } \ +} while (0) + +static int check_ocores_i2c(struct i2c_msg *msgs, int num); +static void oc_debug_dump_reg(struct ocores_i2c *i2c); +static void oc_debug_dump_reg_dump(struct ocores_i2c *i2c); +static int oc_set_scl_clk(struct ocores_i2c *i2c, int val); + +static void oc_setreg_8(struct ocores_i2c *i2c, int reg, u8 value) +{ + iowrite8(value, i2c->base + (reg << i2c->reg_shift)); +} + +static void oc_setreg_16(struct ocores_i2c *i2c, int reg, u8 value) +{ + iowrite16(value, i2c->base + (reg << i2c->reg_shift)); +} + +static void oc_setreg_32(struct ocores_i2c *i2c, int reg, u8 value) +{ + iowrite32(value, i2c->base + (reg << i2c->reg_shift)); +} + +static inline u8 oc_getreg_8(struct ocores_i2c *i2c, int reg) +{ + return ioread8(i2c->base + (reg << i2c->reg_shift)); +} + +static inline u8 oc_getreg_16(struct ocores_i2c *i2c, int reg) +{ + return ioread16(i2c->base + (reg << i2c->reg_shift)); +} + +static inline u8 oc_getreg_32(struct ocores_i2c *i2c, int reg) +{ + return ioread32(i2c->base + (reg << i2c->reg_shift)); +} + +static inline void oc_setreg(struct ocores_i2c *i2c, int reg, u8 value) +{ + i2c->setreg(i2c, reg, value); +} + +static inline u8 oc_getreg(struct ocores_i2c *i2c, int reg) +{ + return i2c->getreg(i2c, reg); +} + +#define FPGA_I2C_SPIN_LOCK(lock, flags) spin_lock_irqsave(&(lock), (flags)) +#define FPGA_I2C_SPIN_UNLOCK(lock, flags) spin_unlock_irqrestore(&(lock), (flags)) +#define FPGA_I2C_MUTEX_LOCK(lock) mutex_lock(&(lock)) +#define FPGA_I2C_MUTEX_UNLOCK(lock) mutex_unlock(&(lock)) + +static void ocores_process(struct ocores_i2c *i2c, u8 stat) +{ + struct i2c_msg *msg = i2c->msg; + + FPGA_I2C_DEBUG_XFER("Enter nr %d.\n", i2c->adap.nr); + if ((i2c->state == STATE_DONE) || (i2c->state == STATE_ERROR)) { + /* stop has been sent */ + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_IACK); + wake_up(&i2c->wait); + FPGA_I2C_DEBUG_XFER("stop has been sent, exit.\n"); + goto out; + } + + FPGA_I2C_DEBUG_XFER("Enter 111.\n"); + + /* error */ + if (stat & OCI2C_STAT_ARBLOST) { + i2c->state = STATE_ERROR; + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_STOP); + FPGA_I2C_DEBUG_XFER("error, exit.\n"); + goto out; + } + + FPGA_I2C_DEBUG_XFER("Enter 222.\n"); + + if (check_ocores_i2c(i2c->msg, i2c->nmsgs) != 0) { + FPGA_I2C_DEBUG("i2c->msg->buf is null, i2c->state:%d exit.\n", i2c->state); + oc_debug_dump_reg_dump(i2c); + i2c->state = STATE_ERROR; + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_STOP); + goto out; + } + + if ((i2c->state == STATE_START) || (i2c->state == STATE_WRITE)) { + i2c->state = + (msg->flags & I2C_M_RD) ? STATE_READ : STATE_WRITE; + + if (stat & OCI2C_STAT_NACK) { + i2c->state = STATE_ERROR; + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_STOP); + FPGA_I2C_DEBUG_XFER("OCI2C_STAT_NACK, exit.\n"); + goto out; + } + } else { + msg->buf[i2c->pos++] = oc_getreg(i2c, OCI2C_DATA); + } + FPGA_I2C_DEBUG_XFER("Enter 333.\n"); + + /* end of msg? */ + if (i2c->pos == msg->len) { + FPGA_I2C_DEBUG_XFER("Enter end of msg.\n"); + i2c->nmsgs--; + i2c->msg++; + i2c->pos = 0; + msg = i2c->msg; + + if (i2c->nmsgs) { /* end? */ + /* send start? */ + if (!(msg->flags & I2C_M_NOSTART)) { + u8 addr = (msg->addr << 1); + + if (msg->flags & I2C_M_RD) + addr |= 1; + + i2c->state = STATE_START; + + oc_setreg(i2c, OCI2C_DATA, addr); + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_START); + FPGA_I2C_DEBUG_XFER("send start, exit.\n"); + goto out; + } + + i2c->state = (msg->flags & I2C_M_RD) + ? STATE_READ : STATE_WRITE; + } else { + i2c->state = STATE_DONE; + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_STOP); + FPGA_I2C_DEBUG_XFER("send OCI2C_CMD_STOP, exit.\n"); + goto out; + } + } + + if (i2c->state == STATE_READ) { + oc_setreg(i2c, OCI2C_CMD, i2c->pos == (msg->len-1) ? + OCI2C_CMD_READ_NACK : OCI2C_CMD_READ_ACK); + } else { + oc_setreg(i2c, OCI2C_DATA, msg->buf[i2c->pos++]); + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_WRITE); + } + +out: + FPGA_I2C_DEBUG_XFER("normal, exit nr %d.\n", i2c->adap.nr); +} + +static irqreturn_t ocores_isr(int irq, void *dev_id) +{ + struct ocores_i2c *i2c = dev_id; + unsigned long flags; + u8 stat; + + if (!i2c) { + return IRQ_NONE; + } + /* + * If we spin here is because we are in timeout, so we are going + * to be in STATE_ERROR. See ocores_process_timeout() + */ + FPGA_I2C_SPIN_LOCK(i2c->process_lock, flags); + stat = oc_getreg(i2c, OCI2C_STATUS); + if (!(stat & OCI2C_STAT_IF)) { + g_irq_invalid_cnt++; + FPGA_I2C_SPIN_UNLOCK(i2c->process_lock, flags); + return IRQ_NONE; + } + + FPGA_I2C_DEBUG_XFER("Enter, irq %d nr %d addr 0x%x.\n", irq, i2c->adap.nr, (!i2c->msg)?0:i2c->msg->addr); + ocores_process(i2c, stat); + FPGA_I2C_DEBUG_XFER("Leave, irq %d nr %d addr 0x%x.\n", irq, i2c->adap.nr, (!i2c->msg)?0:i2c->msg->addr); + + FPGA_I2C_SPIN_UNLOCK(i2c->process_lock, flags); + return IRQ_HANDLED; +} + +/** + * Process timeout event + * @i2c: ocores I2C device instance + */ +static void ocores_process_timeout(struct ocores_i2c *i2c) +{ + unsigned long flags; + + FPGA_I2C_SPIN_LOCK(i2c->process_lock, flags); + FPGA_I2C_DEBUG_ERROR("wait_event_timeout i2c->state %d.\n", i2c->state); + oc_debug_dump_reg(i2c); + i2c->state = STATE_ERROR; + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_STOP); + mdelay(1); + FPGA_I2C_SPIN_UNLOCK(i2c->process_lock, flags); +} + +static int check_ocores_i2c(struct i2c_msg *msgs, int num) +{ + int i; + if (!msgs) { + return -1; + } + for (i = 0; i < num; ++i) { + if (!msgs[i].buf) { + return -1; + } + } + return 0; +} + +static int ocores_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) +{ + struct ocores_i2c *i2c; + int ret; + unsigned long flags; + int xfer_ret; + + if (!adap || check_ocores_i2c(msgs, num) != 0) { + FPGA_I2C_DEBUG("msgs: %p , num:%d exit.\n", msgs, num); + return -EINVAL; + } + i2c = i2c_get_adapdata(adap); + + FPGA_I2C_MUTEX_LOCK(i2c->xfer_lock); + FPGA_I2C_SPIN_LOCK(i2c->process_lock, flags); + i2c->msg = msgs; + i2c->pos = 0; + i2c->nmsgs = num; + i2c->state = STATE_START; + FPGA_I2C_DEBUG_XFER("Enter, nr %d addr 0x%x num %d.\n", adap->nr, i2c->msg->addr, num); + + oc_setreg(i2c, OCI2C_DATA, + (i2c->msg->addr << 1) | + ((i2c->msg->flags & I2C_M_RD) ? 1:0)); + + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_START); + FPGA_I2C_DEBUG_XFER("After, oc_setreg OCI2C_CMD.\n"); + FPGA_I2C_SPIN_UNLOCK(i2c->process_lock, flags); + + ret = wait_event_timeout(i2c->wait, (i2c->state == STATE_ERROR) || + (i2c->state == STATE_DONE), HZ); + + if (ret == 0) { + ocores_process_timeout(i2c); + FPGA_I2C_MUTEX_UNLOCK(i2c->xfer_lock); + return -ETIMEDOUT; + } + xfer_ret = i2c->state; + FPGA_I2C_MUTEX_UNLOCK(i2c->xfer_lock); + return (xfer_ret == STATE_DONE) ? num : -EIO; +} + +static void ocores_init(struct ocores_i2c *i2c) +{ + int prescale; + u8 ctrl = oc_getreg(i2c, OCI2C_CONTROL); + + mutex_init(&i2c->xfer_lock); + spin_lock_init(&i2c->process_lock); + + /* make sure the device is disabled */ + oc_setreg(i2c, OCI2C_CONTROL, ctrl & ~(OCI2C_CTRL_EN|OCI2C_CTRL_IEN)); + + prescale = oc_set_scl_clk(i2c, DEFAULT_I2C_SCL); + FPGA_I2C_DEBUG_VERBOSE("i2c->base 0x%p, i2c->clock_khz %d, prescale 0x%x.\n", i2c->base, i2c->clock_khz, prescale); + + /* Init the device */ + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_IACK); + oc_setreg(i2c, OCI2C_CONTROL, ctrl | OCI2C_CTRL_IEN | OCI2C_CTRL_EN); +} + + +static u32 ocores_func(struct i2c_adapter *adap) +{ + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; +} + +static const struct i2c_algorithm ocores_algorithm = { + .master_xfer = ocores_xfer, + .functionality = ocores_func, +}; + +static struct i2c_adapter ocores_adapter = { + .owner = THIS_MODULE, + .name = "rg-i2c-ocores", + .class = I2C_CLASS_HWMON | I2C_CLASS_SPD | I2C_CLASS_DEPRECATED, + .algo = &ocores_algorithm, +}; + +static const struct of_device_id ocores_i2c_match[] = { + { + .compatible = "opencores,rg-i2c-ocores", + .data = (void *)TYPE_OCORES, + }, + { + .compatible = "aeroflexgaisler,i2cmst", + .data = (void *)TYPE_GRLIB, + }, + {}, +}; +MODULE_DEVICE_TABLE(of, ocores_i2c_match); + +#ifdef CONFIG_OF +/* Read and write functions for the GRLIB port of the controller. Registers are + * 32-bit big endian and the PRELOW and PREHIGH registers are merged into one + * register. The subsequent registers has their offset decreased accordingly. */ +static u8 oc_getreg_grlib(struct ocores_i2c *i2c, int reg) +{ + u32 rd; + int rreg = reg; + if (reg != OCI2C_PRELOW) + rreg--; + rd = ioread32be(i2c->base + (rreg << i2c->reg_shift)); + if (reg == OCI2C_PREHIGH) + return (u8)(rd >> 8); + else + return (u8)rd; +} + +static void oc_setreg_grlib(struct ocores_i2c *i2c, int reg, u8 value) +{ + u32 curr, wr; + int rreg = reg; + if (reg != OCI2C_PRELOW) + rreg--; + if (reg == OCI2C_PRELOW || reg == OCI2C_PREHIGH) { + curr = ioread32be(i2c->base + (rreg << i2c->reg_shift)); + if (reg == OCI2C_PRELOW) + wr = (curr & 0xff00) | value; + else + wr = (((u32)value) << 8) | (curr & 0xff); + } else { + wr = value; + } + iowrite32be(wr, i2c->base + (rreg << i2c->reg_shift)); +} + +static int ocores_i2c_of_probe(struct platform_device *pdev, + struct ocores_i2c *i2c) +{ + struct device_node *np = pdev->dev.of_node; + const struct of_device_id *match; + u32 val; + + if (of_property_read_u32(np, "reg-shift", &i2c->reg_shift)) { + /* no 'reg-shift', check for deprecated 'regstep' */ + if (!of_property_read_u32(np, "regstep", &val)) { + if (!is_power_of_2(val)) { + dev_err(&pdev->dev, "invalid regstep %d\n", + val); + return -EINVAL; + } + i2c->reg_shift = ilog2(val); + dev_warn(&pdev->dev, + "regstep property deprecated, use reg-shift\n"); + } + } + + if (of_property_read_u32(np, "clock-frequency", &val)) { + dev_err(&pdev->dev, + "Missing required parameter 'clock-frequency'\n"); + return -ENODEV; + } + i2c->clock_khz = val / 1000; + + of_property_read_u32(pdev->dev.of_node, "reg-io-width", + &i2c->reg_io_width); + + match = of_match_node(ocores_i2c_match, pdev->dev.of_node); + if (match && (long)match->data == TYPE_GRLIB) { + dev_dbg(&pdev->dev, "GRLIB variant of i2c-ocores\n"); + i2c->setreg = oc_setreg_grlib; + i2c->getreg = oc_getreg_grlib; + } + + return 0; +} +#else +#define ocores_i2c_of_probe(pdev,i2c) -ENODEV +#endif + + +static void oc_debug_dump_reg_dump(struct ocores_i2c *i2c) +{ + if (i2c) { + FPGA_I2C_DEBUG("base: %p.\n", i2c->base); + FPGA_I2C_DEBUG("reg_shift: %d.\n", i2c->reg_shift); + FPGA_I2C_DEBUG("reg_io_width: %d.\n", i2c->reg_io_width); + FPGA_I2C_DEBUG("adap.nr: %d.\n", i2c->adap.nr); + FPGA_I2C_DEBUG("msg: %p.\n", i2c->msg); + if (i2c->msg) { + FPGA_I2C_DEBUG("msg->buf: %p.\n", i2c->msg->buf); + FPGA_I2C_DEBUG("msg->addr: 0x%x.\n", i2c->msg->addr); + FPGA_I2C_DEBUG("msg->flags: 0x%x.\n", i2c->msg->flags); + FPGA_I2C_DEBUG("msg->len: %d.\n", i2c->msg->len); + } else { + FPGA_I2C_DEBUG("msg: %p is null.\n", i2c->msg); + } + + FPGA_I2C_DEBUG("pos: %d.\n", i2c->pos); + FPGA_I2C_DEBUG("nmsgs: %d.\n", i2c->nmsgs); + FPGA_I2C_DEBUG("state: %d.\n", i2c->state); + FPGA_I2C_DEBUG("clock_khz: %d.\n", i2c->clock_khz); + FPGA_I2C_DEBUG("setreg: %p.\n", i2c->setreg); + FPGA_I2C_DEBUG("getreg: %p.\n", i2c->getreg); + if (i2c->getreg) { + FPGA_I2C_DEBUG("OCI2C_PRELOW: 0x%02x.\n", oc_getreg(i2c, OCI2C_PRELOW)); + FPGA_I2C_DEBUG("OCI2C_PREHIGH: 0x%02x.\n", oc_getreg(i2c, OCI2C_PREHIGH)); + FPGA_I2C_DEBUG("OCI2C_CONTROL: 0x%02x.\n", oc_getreg(i2c, OCI2C_CONTROL)); + FPGA_I2C_DEBUG("OCI2C_DATA: 0x%02x.\n", oc_getreg(i2c, OCI2C_DATA)); + FPGA_I2C_DEBUG("OCI2C_CMD: 0x%02x.\n", oc_getreg(i2c, OCI2C_CMD)); + FPGA_I2C_DEBUG("OCI2C_STATUS: 0x%02x.\n", oc_getreg(i2c, OCI2C_STATUS)); + } else { + FPGA_I2C_DEBUG("getreg: %p is null.\n", i2c->getreg); + } + } else { + FPGA_I2C_DEBUG("i2c %p is null.\n", i2c); + } +} + + +static void oc_debug_dump_reg(struct ocores_i2c *i2c) +{ + if (i2c) { + FPGA_I2C_DEBUG_DUMP("base: %p.\n", i2c->base); + FPGA_I2C_DEBUG_DUMP("reg_shift: %d.\n", i2c->reg_shift); + FPGA_I2C_DEBUG_DUMP("reg_io_width: %d.\n", i2c->reg_io_width); + FPGA_I2C_DEBUG_DUMP("adap.nr: %d.\n", i2c->adap.nr); + FPGA_I2C_DEBUG_DUMP("msg: %p.\n", i2c->msg); + if (i2c->msg) { + FPGA_I2C_DEBUG_DUMP("msg->buf: %p.\n", i2c->msg->buf); + FPGA_I2C_DEBUG_DUMP("msg->addr: 0x%x.\n", i2c->msg->addr); + FPGA_I2C_DEBUG_DUMP("msg->flags: 0x%x.\n", i2c->msg->flags); + FPGA_I2C_DEBUG_DUMP("msg->len: %d.\n", i2c->msg->len); + } else { + FPGA_I2C_DEBUG_DUMP("msg: %p is null.\n", i2c->msg); + } + + FPGA_I2C_DEBUG_DUMP("pos: %d.\n", i2c->pos); + FPGA_I2C_DEBUG_DUMP("nmsgs: %d.\n", i2c->nmsgs); + FPGA_I2C_DEBUG_DUMP("state: %d.\n", i2c->state); + FPGA_I2C_DEBUG_DUMP("clock_khz: %d.\n", i2c->clock_khz); + FPGA_I2C_DEBUG_DUMP("setreg: %p.\n", i2c->setreg); + FPGA_I2C_DEBUG_DUMP("getreg: %p.\n", i2c->getreg); + if (i2c->getreg) { + FPGA_I2C_DEBUG_DUMP("OCI2C_PRELOW: 0x%02x.\n", oc_getreg(i2c, OCI2C_PRELOW)); + FPGA_I2C_DEBUG_DUMP("OCI2C_PREHIGH: 0x%02x.\n", oc_getreg(i2c, OCI2C_PREHIGH)); + FPGA_I2C_DEBUG_DUMP("OCI2C_CONTROL: 0x%02x.\n", oc_getreg(i2c, OCI2C_CONTROL)); + FPGA_I2C_DEBUG_DUMP("OCI2C_DATA: 0x%02x.\n", oc_getreg(i2c, OCI2C_DATA)); + FPGA_I2C_DEBUG_DUMP("OCI2C_CMD: 0x%02x.\n", oc_getreg(i2c, OCI2C_CMD)); + FPGA_I2C_DEBUG_DUMP("OCI2C_STATUS: 0x%02x.\n", oc_getreg(i2c, OCI2C_STATUS)); + } else { + FPGA_I2C_DEBUG_DUMP("getreg: %p is null.\n", i2c->getreg); + } + } else { + FPGA_I2C_DEBUG_DUMP("i2c %p is null.\n", i2c); + } +} + +void oc_debug_dump_reg_exception(void) +{ + int bus_beg, bus_end, bus; + struct i2c_adapter *adap; + struct ocores_i2c *adap_data; + + bus_beg = 1; + bus_end = 14; + for (bus = bus_beg; bus <= bus_end; bus++) { + adap = i2c_get_adapter(bus); + if (adap) { + adap_data = (struct ocores_i2c *)i2c_get_adapdata(adap); + if (adap_data) { + FPGA_I2C_DEBUG_DUMP("bus %d call oc_debug_dump_reg begin.\n", bus); + oc_debug_dump_reg(adap_data); + FPGA_I2C_DEBUG_DUMP("bus %d call oc_debug_dump_reg end.\n", bus); + } else { + FPGA_I2C_DEBUG_DUMP("bus %d i2c_get_adapdata null.\n", bus); + } + i2c_put_adapter(adap); + } else { + FPGA_I2C_DEBUG_DUMP("bus %d i2c_get_adapter null.\n", bus); + } + } +} + +static int oc_calculate_prescale(struct ocores_i2c *i2c, int val) { + if (val <= 0) { + FPGA_I2C_DEBUG_ERROR("input scl clock error, set to default clock: %d.\n", val); + val = DEFAULT_I2C_SCL; + } + return (i2c->clock_khz / (5 * val)) - 1; +} + +static int oc_calculate_scl_clk(struct ocores_i2c *i2c, int prescale) { + if (prescale <= -1) { + FPGA_I2C_DEBUG_ERROR("input prescale error, set to default prescale: %d.\n", prescale); + prescale = DEFAULT_I2C_PRE; + } + return (i2c->clock_khz / (prescale + 1)) / 5; +} + +static int oc_set_scl_clk(struct ocores_i2c *i2c, int val) { + int prescale; + + prescale = oc_calculate_prescale(i2c, val); + oc_setreg(i2c, OCI2C_PRELOW, prescale & 0xff); + oc_setreg(i2c, OCI2C_PREHIGH, prescale >> 8); + return prescale; +} + +static int oc_get_scl_clk(struct ocores_i2c *i2c) { + int prescale, prescale_high, prescale_low; + + prescale_low = oc_getreg(i2c, OCI2C_PRELOW); + prescale_high = oc_getreg(i2c, OCI2C_PREHIGH); + prescale = (prescale_high << 8) + (prescale_low & 0xff); + + return oc_calculate_scl_clk(i2c, prescale); +} + +static ssize_t oc_sysfs_show_scl_clk(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct i2c_adapter *adapter; + struct ocores_i2c *i2c; + int scl_clk; + + adapter = to_i2c_adapter(dev); + i2c = (struct ocores_i2c *)i2c_get_adapdata(adapter); + scl_clk = oc_get_scl_clk(i2c); + return snprintf(buf, BUF_SIZE, "%d\n", scl_clk); +} + +static ssize_t oc_sysfs_set_scl_clk(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) +{ + struct i2c_adapter *adapter; + struct ocores_i2c *i2c; + int val; + int ret; + int prescale; + + adapter = to_i2c_adapter(dev); + i2c = (struct ocores_i2c *)i2c_get_adapdata(adapter); + ret = kstrtoint(buf, 0, &val); + if (ret) { + return ret; + } + FPGA_I2C_MUTEX_LOCK(i2c->xfer_lock); + prescale = oc_set_scl_clk(i2c, val); + FPGA_I2C_DEBUG_VERBOSE("i2c->base 0x%p, i2c->clock_khz %d, scl clk 0x%x.\n", i2c->base, i2c->clock_khz, prescale); + FPGA_I2C_MUTEX_UNLOCK(i2c->xfer_lock); + return count; +} +static ssize_t show_oc_debug_value(struct device *dev, struct device_attribute *da, char *buf) +{ + oc_debug_dump_reg_exception(); + return 0; +} + +static SENSOR_DEVICE_ATTR(oc_debug, S_IRUGO | S_IWUSR, show_oc_debug_value, NULL, 0x15); +static SENSOR_DEVICE_ATTR(oc_scl_clk, S_IRUGO | S_IWUSR, oc_sysfs_show_scl_clk, oc_sysfs_set_scl_clk, 0); + +static struct attribute *oc_debug_sysfs_attrs[] = { + &sensor_dev_attr_oc_debug.dev_attr.attr, + NULL +}; + +static struct attribute *oc_scl_clk_sysfs_attrs[] = { + &sensor_dev_attr_oc_scl_clk.dev_attr.attr, + NULL +}; + +static const struct attribute_group oc_debug_sysfs_group = { + .attrs = oc_debug_sysfs_attrs, +}; + +static const struct attribute_group oc_scl_clk_sysfs_group = { + .attrs = oc_scl_clk_sysfs_attrs, +}; + +static void oc_scl_clk_sysfs_init(struct i2c_adapter *adap) +{ + int ret; + + ret = sysfs_create_group(&adap->dev.kobj, &oc_scl_clk_sysfs_group); + FPGA_I2C_DEBUG_VERBOSE("sysfs_create_group ret %d.\n", ret); + return; +} + +static void oc_scl_clk_sysfs_exit(struct i2c_adapter *adap) +{ + sysfs_remove_group(&adap->dev.kobj, (const struct attribute_group *)&oc_scl_clk_sysfs_group); + FPGA_I2C_DEBUG_VERBOSE("sysfs_remove_group.\n"); + return; +} + +static void oc_debug_sysfs_init(struct platform_device *pdev) +{ + int ret; + + ret = sysfs_create_group(&pdev->dev.kobj, &oc_debug_sysfs_group); + FPGA_I2C_DEBUG_VERBOSE("sysfs_create_group ret %d.\n", ret); + return; +} + +static void oc_debug_sysfs_exit(struct platform_device *pdev) +{ + sysfs_remove_group(&pdev->dev.kobj, (const struct attribute_group *)&oc_debug_sysfs_group); + FPGA_I2C_DEBUG_VERBOSE("sysfs_remove_group.\n"); + return; +} + +static int rg_ocores_i2c_probe(struct platform_device *pdev) +{ + struct ocores_i2c *i2c; + struct rg_ocores_i2c_platform_data *pdata; + struct resource *res; + int irq; + int ret; + int i; + + FPGA_I2C_DEBUG_VERBOSE("Enter.\n"); + irq = platform_get_irq(pdev, 0); + if (irq < 0) { + FPGA_I2C_DEBUG_ERROR("platform_get_irq failed irq %d.\n", irq); + return irq; + } + + i2c = devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL); + if (!i2c) { + FPGA_I2C_DEBUG_ERROR("devm_kzalloc failed.\n"); + return -ENOMEM; + } + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + i2c->base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(i2c->base)) { + FPGA_I2C_DEBUG_ERROR("devm_ioremap_resource failed.\n"); + return PTR_ERR(i2c->base); + } + + pdata = dev_get_platdata(&pdev->dev); + if (pdata) { + i2c->reg_shift = pdata->reg_shift; + i2c->reg_io_width = pdata->reg_io_width; + i2c->clock_khz = pdata->clock_khz; + } else { + ret = ocores_i2c_of_probe(pdev, i2c); + if (ret) + return ret; + } + + if (i2c->reg_io_width == 0) + i2c->reg_io_width = 1; /* Set to default value */ + + + if (!i2c->setreg || !i2c->getreg) { + switch (i2c->reg_io_width) { + case 1: + i2c->setreg = oc_setreg_8; + i2c->getreg = oc_getreg_8; + break; + + case 2: + i2c->setreg = oc_setreg_16; + i2c->getreg = oc_getreg_16; + break; + + case 4: + i2c->setreg = oc_setreg_32; + i2c->getreg = oc_getreg_32; + break; + + default: + dev_err(&pdev->dev, "Unsupported I/O width (%d)\n", + i2c->reg_io_width); + return -EINVAL; + } + } + + ocores_init(i2c); + + init_waitqueue_head(&i2c->wait); + ret = devm_request_irq(&pdev->dev, irq, ocores_isr, 0, + pdev->name, i2c); + if (ret) { + dev_err(&pdev->dev, "Cannot claim IRQ\n"); + return ret; + } + + /* hook up driver to tree */ + platform_set_drvdata(pdev, i2c); + i2c->adap = ocores_adapter; + if (pdata->nr) { + i2c->adap.nr = pdata->nr; + dev_info(&pdev->dev, "fpga ocores nr is (%d), irq %d \n", i2c->adap.nr, irq); + } + i2c_set_adapdata(&i2c->adap, i2c); + i2c->adap.dev.parent = &pdev->dev; + i2c->adap.dev.of_node = pdev->dev.of_node; + + /* add i2c adapter to i2c tree */ + ret = i2c_add_numbered_adapter(&i2c->adap); + if (ret) { + dev_err(&pdev->dev, "Failed to add adapter\n"); + return ret; + } + + /* add in known devices to the bus */ + if (pdata) { + for (i = 0; i < pdata->num_devices; i++) + i2c_new_device(&i2c->adap, pdata->devices + i); + } + + oc_debug_sysfs_init(pdev); + oc_scl_clk_sysfs_init(&i2c->adap); + return 0; +} + +static int rg_ocores_i2c_remove(struct platform_device *pdev) +{ + struct ocores_i2c *i2c = platform_get_drvdata(pdev); + + /* disable i2c logic */ + oc_setreg(i2c, OCI2C_CONTROL, oc_getreg(i2c, OCI2C_CONTROL) + & ~(OCI2C_CTRL_EN|OCI2C_CTRL_IEN)); + + /* remove adapter & data */ + oc_scl_clk_sysfs_exit(&i2c->adap); + i2c_del_adapter(&i2c->adap); + oc_debug_sysfs_exit(pdev); + + return 0; +} + +#ifdef CONFIG_PM_SLEEP +static int ocores_i2c_suspend(struct device *dev) +{ + struct ocores_i2c *i2c = dev_get_drvdata(dev); + u8 ctrl = oc_getreg(i2c, OCI2C_CONTROL); + + /* make sure the device is disabled */ + oc_setreg(i2c, OCI2C_CONTROL, ctrl & ~(OCI2C_CTRL_EN|OCI2C_CTRL_IEN)); + + return 0; +} + +static int ocores_i2c_resume(struct device *dev) +{ + struct ocores_i2c *i2c = dev_get_drvdata(dev); + + ocores_init(i2c); + + return 0; +} + +static SIMPLE_DEV_PM_OPS(ocores_i2c_pm, ocores_i2c_suspend, ocores_i2c_resume); +#define OCORES_I2C_PM (&ocores_i2c_pm) +#else +#define OCORES_I2C_PM NULL +#endif + +static struct platform_driver ocores_i2c_driver = { + .probe = rg_ocores_i2c_probe, + .remove = rg_ocores_i2c_remove, + .driver = { + .owner = THIS_MODULE, + .name = "rg-i2c-ocores", + .of_match_table = ocores_i2c_match, + .pm = OCORES_I2C_PM, + }, +}; + +module_platform_driver(ocores_i2c_driver); + +MODULE_AUTHOR("Peter Korsgaard "); +MODULE_DESCRIPTION("OpenCores I2C bus driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:ocores-i2c"); diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_i2c_ocores.h b/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_i2c_ocores.h new file mode 100755 index 000000000000..1aedd7793c77 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_i2c_ocores.h @@ -0,0 +1,13 @@ +#ifndef _FPGA_I2C_OCORES_H +#define _FPGA_I2C_OCORES_H + +struct rg_ocores_i2c_platform_data { + u32 reg_shift; /* register offset shift value */ + u32 reg_io_width; /* register io read/write width */ + u32 clock_khz; /* input clock in kHz */ + u8 num_devices; /* number of devices in the devices list */ + struct i2c_board_info const *devices; /* devices connected to the bus */ + int nr; /* i2c bus num */ +}; + +#endif /* _FPGA_I2C_OCORES_H */ diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_pcie_i2c.c b/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_pcie_i2c.c new file mode 100755 index 000000000000..82ae9f558f50 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_pcie_i2c.c @@ -0,0 +1,1144 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#if LINUX_VERSION_CODE > KERNEL_VERSION(4, 15, 0) +#include +#else +#include +#endif +#include +#include +#include + + +#ifdef FPGA_PCIE_I2C_DEBUG +#include +#include +#include +#include +#include + +char *enum_log="/home/pciuio-log"; + +void filewrite(char* filename, char* data) +{ + struct file *filp; + mm_segment_t fs; + filp = filp_open(filename, O_RDWR|O_APPEND|O_CREAT, 0644); + if(IS_ERR(filp)) + { + printk("<0>""open file error...\n"); + return; + } + + fs=get_fs(); + set_fs(KERNEL_DS); + filp->f_op->write(filp, data, strlen(data),&filp->f_pos); + set_fs(fs); + filp_close(filp,NULL); +} + +void enum_time_log(char *log) +{ + struct timex txc; + struct rtc_time tm; + char time_str[64]; + int ret = 0; + + do_gettimeofday(&(txc.time)); + rtc_time_to_tm(txc.time.tv_sec,&tm); + memset(time_str, 0x0, 64); + ret = sprintf(time_str, "UTC time:%d-%d-%d %d:%d:%d ", + tm.tm_year+1900, tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); + + filewrite(enum_log, time_str); + filewrite(enum_log, log); +} + +void enum_notime_log(char *log) +{ + filewrite(enum_log, log); +} +#else +void enum_time_log(char *log) +{ + return; +} +void enum_notime_log(char *log) +{ + return; +} +#endif + + +static void __iomem *g_fpga_pcie_mem_base = NULL; + +int g_fpga_pcie_debug = 0; +int g_fpga_pcie_error = 0; +int g_fpga_pcie_reset_en = 0; +int ocore_ctl_startbus = 1; +int ocore_ctl_numbers = 14; +module_param(g_fpga_pcie_reset_en, int, S_IRUGO | S_IWUSR); +module_param(g_fpga_pcie_debug, int, S_IRUGO | S_IWUSR); +module_param(g_fpga_pcie_error, int, S_IRUGO | S_IWUSR); +module_param(ocore_ctl_startbus, int, S_IRUGO | S_IWUSR); +module_param(ocore_ctl_numbers, int, S_IRUGO | S_IWUSR); + + +#define FPGA_PCIE_DEBUG_VERBOSE(fmt, args...) do { \ + if (g_fpga_pcie_debug) { \ + printk(KERN_ERR "[FPGA_PCIE][VER][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ + } \ +} while (0) + +#define FPGA_PCIE_DEBUG_ERROR(fmt, args...) do { \ + if (g_fpga_pcie_error) { \ + printk(KERN_ERR "[FPGA_PCIE][ERR][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ + } \ +} while (0) + +#define FPGA_MSI_IRQ_NUM (ocore_ctl_numbers) +#define FPGA_MSI_IRQ_BEGIN (0) +#define FPGA_MSI_IRQ_END ((FPGA_MSI_IRQ_BEGIN) + (FPGA_MSI_IRQ_NUM)) +#define FPGA_I2C_OCORE_START_BASE (0x800) +#define FPGA_I2C_OCORE_END_BASE (0x81f) +#define FPGA_I2C_OCORE_CTRL_SIZE (0x20) +#define FPGA_I2C_OCORE_CTRL_START(id) ((FPGA_I2C_OCORE_START_BASE) + (id) * (FPGA_I2C_OCORE_CTRL_SIZE)) +#define FPGA_I2C_OCORE_CTRL_END(id) ((FPGA_I2C_OCORE_END_BASE) + (id) * (FPGA_I2C_OCORE_CTRL_SIZE)) +#define FPGA_I2C_OCORE_CTRL_IRQ(id) (id) + + +#define DEFINE_FPGA_PCIE_OCORE_DATA(_id) \ + static struct rg_ocores_i2c_platform_data rg_i2c_ocore_pdata_##_id = { \ + .reg_shift = 0, \ + .reg_io_width = 4, \ + .clock_khz = 125000, \ + .num_devices = 0, \ + }; + +DEFINE_FPGA_PCIE_OCORE_DATA(0); +DEFINE_FPGA_PCIE_OCORE_DATA(1); +DEFINE_FPGA_PCIE_OCORE_DATA(2); +DEFINE_FPGA_PCIE_OCORE_DATA(3); +DEFINE_FPGA_PCIE_OCORE_DATA(4); +DEFINE_FPGA_PCIE_OCORE_DATA(5); +DEFINE_FPGA_PCIE_OCORE_DATA(6); +DEFINE_FPGA_PCIE_OCORE_DATA(7); +DEFINE_FPGA_PCIE_OCORE_DATA(8); +DEFINE_FPGA_PCIE_OCORE_DATA(9); +DEFINE_FPGA_PCIE_OCORE_DATA(10); +DEFINE_FPGA_PCIE_OCORE_DATA(11); +DEFINE_FPGA_PCIE_OCORE_DATA(12); +DEFINE_FPGA_PCIE_OCORE_DATA(13); +DEFINE_FPGA_PCIE_OCORE_DATA(14); +DEFINE_FPGA_PCIE_OCORE_DATA(15); +DEFINE_FPGA_PCIE_OCORE_DATA(16); +DEFINE_FPGA_PCIE_OCORE_DATA(17); +DEFINE_FPGA_PCIE_OCORE_DATA(18); +DEFINE_FPGA_PCIE_OCORE_DATA(19); +DEFINE_FPGA_PCIE_OCORE_DATA(20); +DEFINE_FPGA_PCIE_OCORE_DATA(21); +DEFINE_FPGA_PCIE_OCORE_DATA(22); +DEFINE_FPGA_PCIE_OCORE_DATA(23); +DEFINE_FPGA_PCIE_OCORE_DATA(24); +DEFINE_FPGA_PCIE_OCORE_DATA(25); +DEFINE_FPGA_PCIE_OCORE_DATA(26); +DEFINE_FPGA_PCIE_OCORE_DATA(27); + +#define DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(_id) \ + static const struct resource fpga_pcie_i2c_ocores_resources_##_id[] = { \ + { \ + .start = FPGA_I2C_OCORE_CTRL_START(_id), \ + .end = FPGA_I2C_OCORE_CTRL_END(_id), \ + .flags = IORESOURCE_MEM, \ + }, \ + { \ + .start = FPGA_I2C_OCORE_CTRL_IRQ(_id), \ + .end = FPGA_I2C_OCORE_CTRL_IRQ(_id), \ + .flags = IORESOURCE_IRQ, \ + }, \ + } + +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(0); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(1); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(2); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(3); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(4); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(5); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(6); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(7); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(8); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(9); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(10); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(11); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(12); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(13); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(14); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(15); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(16); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(17); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(18); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(19); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(20); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(21); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(22); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(23); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(24); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(25); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(26); +DEFINE_FPGA_PCIE_I2C_OCORE_RESOURCES(27); + +#define DEFINE_FPGA_PCIE_MFD_CELL_CFG(_id) \ +{ \ + .name = "rg-i2c-ocores", \ + .id = (_id), \ + .num_resources = ARRAY_SIZE(fpga_pcie_i2c_ocores_resources_##_id), \ + .resources = fpga_pcie_i2c_ocores_resources_##_id, \ + .platform_data = &rg_i2c_ocore_pdata_##_id, \ + .pdata_size = sizeof(rg_i2c_ocore_pdata_##_id), \ +} + + +static const struct mfd_cell fpga_pcie_cells_bar0_cfg0[] = { + DEFINE_FPGA_PCIE_MFD_CELL_CFG(0), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(1), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(2), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(3), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(4), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(5), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(6), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(7), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(8), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(9), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(10), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(11), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(12), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(13), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(14), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(15), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(16), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(17), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(18), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(19), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(20), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(21), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(22), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(23), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(24), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(25), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(26), + DEFINE_FPGA_PCIE_MFD_CELL_CFG(27), +}; + +struct rgde_dev { + struct uio_info info; + struct pci_dev *pdev; + struct list_head list; + enum xdk_intr_mode mode; +}; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,36) +/* XXX taken from uio.c, just for dumping */ +struct uio_device { + struct module *owner; + struct device *dev; + int minor; + atomic_t event; + struct fasync_struct *async_queue; + wait_queue_head_t wait; + struct uio_info *info; + struct kobject *map_dir; + struct kobject *portio_dir; +}; +#else +/* do noting add tjm */ +#endif + + +static char *intr_mode; +static enum xdk_intr_mode intr_mode_preferred = XDK_INTR_MODE_MSIX; + + +static struct list_head rgde_dev_que; + +static int rgde_dev_list_dump(void) +{ + char str[256]; + struct rgde_dev *node, *tmp; + struct uio_device *udev; + + list_for_each_entry_safe(node, tmp, &rgde_dev_que, list) { + udev = node->info.uio_dev; + memset(str, 0x0, 256); + sprintf(str, "pciuio device minor:%d\n", udev->minor); + enum_notime_log(str); + } + return 0; +} + +void rgde_dev_que_add(struct rgde_dev *uiodev) +{ + struct rgde_dev *node, *tmp; + + if (uiodev == NULL) { + return; + } + + if (list_empty(&rgde_dev_que)) { + list_add(&uiodev->list, &rgde_dev_que); + return; + } + + list_for_each_entry_safe(node, tmp, &rgde_dev_que, list) { + if (((node->info).uio_dev)->minor > ((uiodev->info).uio_dev)->minor) { + break; + } + } + list_add_tail(&uiodev->list, &node->list); + + return; +} + + +void rgde_dev_que_del(struct rgde_dev *uiodev) +{ + struct rgde_dev *node, *tmp; + + if (uiodev == NULL) { + return; + } + + list_for_each_entry_safe(node, tmp, &rgde_dev_que, list) { + if (((node->info).uio_dev)->minor == ((uiodev->info).uio_dev)->minor) { + list_del(&node->list); + break; + } + } + + return; +} + + +struct pci_dev *rgde_to_pci_device(int minor) +{ + + struct rgde_dev *node, *tmp; + + list_for_each_entry_safe(node, tmp, &rgde_dev_que, list) { + if (node->info.uio_dev->minor == minor) { + return node->pdev; + } + + if (node->info.uio_dev->minor < minor) { + return NULL; + } + } + + return NULL; +} +EXPORT_SYMBOL(rgde_to_pci_device); + +int pkt_get_mod(int logic_dev, int *mod) +{ + *mod = 0; + return 0; +} +EXPORT_SYMBOL(pkt_get_mod); + +int pkt_get_port(int logic_dev, int *port) +{ + *port = 1; + return 0; +} +EXPORT_SYMBOL(pkt_get_port); + +static int rgde_intr_mode_config(char *intr_str) +{ +#if 0 + /* default intr mode : msix */ + if (!intr_str) { + return 0; + } + + if (!strcmp(intr_str, INTR_MODE_MSIX_NAME)) { + intr_mode_preferred = XDK_INTR_MODE_MSIX; + return 0; + } + + if (!strcmp(intr_str, INTR_MODE_LEGACY_NAME)) { + intr_mode_preferred = XDK_INTR_MODE_LEGACY; + return 0; + } + + /* For now, msix & legacy mode supported only. */ + printk("<0>""Error: bad parameter - %s\n", intr_str); + return -EINVAL; +#else + intr_mode_preferred = XDK_INTR_MODE_LEGACY; + return 0; +#endif +} + +/* Remap pci resources described by bar #pci_bar in uio resource n. */ +static int rgde_setup_iomem(struct pci_dev *dev, struct uio_info *info, + int n, int pci_bar, const char *name) +{ + unsigned long addr, len; + void *internal_addr; + + if (n >= ARRAY_SIZE(info->mem)) { + return -EINVAL; + } + + addr = pci_resource_start(dev, pci_bar); + FPGA_PCIE_DEBUG_VERBOSE("iomem phys addr:%lx\n", addr); + len = pci_resource_len(dev, pci_bar); + if (addr == 0 || len == 0) { + return -1; + } + + + internal_addr = ioremap(addr, len); + FPGA_PCIE_DEBUG_VERBOSE("iomem phys addr:0x%lx, len 0x%lx, internal_addr %p.\n", addr, len, internal_addr); + + if (internal_addr == NULL) { + return -1; + } + + FPGA_PCIE_DEBUG_VERBOSE("iomem internal_addr:%p\n", internal_addr); + if (pci_bar == 0) { + + g_fpga_pcie_mem_base = internal_addr; + FPGA_PCIE_DEBUG_VERBOSE("pci_bar %d, set g_fpga_pcie_mem_base %p\n", pci_bar, g_fpga_pcie_mem_base); + } + info->mem[n].name = name; + info->mem[n].addr = addr; + info->mem[n].internal_addr = internal_addr; + info->mem[n].size = len; + info->mem[n].memtype = UIO_MEM_PHYS; + + return 0; +} + +/* Unmap previously ioremap'd resources */ +static void rgde_release_iomem(struct uio_info *info) +{ + int i; + + for (i = 0; i < MAX_UIO_MAPS; i++) { + if (info->mem[i].internal_addr) { + iounmap(info->mem[i].internal_addr); + } + } +} + +/* Get pci port io resources described by bar #pci_bar in uio resource n. */ +static int rgde_setup_ioport(struct pci_dev *dev, struct uio_info *info, + int n, int pci_bar, const char *name) +{ + unsigned long addr, len; + + if (n >= ARRAY_SIZE(info->port)) { + return -EINVAL; + } + + addr = pci_resource_start(dev, pci_bar); + len = pci_resource_len(dev, pci_bar); + if (addr == 0 || len == 0) { + return -EINVAL; + } + + info->port[n].name = name; + info->port[n].start = addr; + info->port[n].size = len; + /* skl : FIX me */ + info->port[n].porttype = UIO_PORT_X86; + + return 0; +} + +static int rgde_setup_bars(struct pci_dev *dev, struct uio_info *info) +{ + int i, iom, iop, ret; + unsigned long flags; + static const char *bar_names[PCI_STD_RESOURCE_END + 1] = { + "BAR0", "BAR1", "BAR2", "BAR3", "BAR4", "BAR5", + }; + iom = 0; + iop = 0; + + for (i = 0; i < ARRAY_SIZE(bar_names); i++) { + if (pci_resource_len(dev, i) != 0 && pci_resource_start(dev, i) != 0) { + + flags = pci_resource_flags(dev, i); + FPGA_PCIE_DEBUG_VERBOSE("flags:%lx\n", flags); + if (flags & IORESOURCE_MEM) { + ret = rgde_setup_iomem(dev, info, iom, i, bar_names[i]); + if (ret != 0) { + return ret; + } + iom++; + } else if (flags & IORESOURCE_IO) { + ret = rgde_setup_ioport(dev, info, iop, i, bar_names[i]); + if (ret != 0) { + return ret; + } + iop++; + } + } + } + + return (iom != 0 || iop != 0) ? ret : -ENOENT; +} + +/** + * This is interrupt handler which will check if the interrupt is for the right device. + * If yes, disable it here and will be enable later. + */ +static irqreturn_t rgde_irqhandler(int irq, struct uio_info *info) +{ + struct rgde_dev *udev = info->priv; + + if (udev->mode == XDK_INTR_MODE_LEGACY /*&& !pci_check_and_mask_intx(udev->pdev)*/) { + return IRQ_NONE; + } + + return IRQ_HANDLED; +} + +/* + * It masks the msix on/off of generating MSI-X messages. + */ +static void rgde_msix_mask_irq(struct msi_desc *desc, int32_t state) +{ + u32 mask_bits = desc->masked; + unsigned offset = desc->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_VECTOR_CTRL; + + if (state != 0) { + mask_bits &= ~PCI_MSIX_ENTRY_CTRL_MASKBIT; + } else { + mask_bits |= PCI_MSIX_ENTRY_CTRL_MASKBIT; + } + + if (mask_bits != desc->masked) { + writel(mask_bits, desc->mask_base + offset); + readl(desc->mask_base); + desc->masked = mask_bits; + } +} + +/** + * This is the irqcontrol callback to be registered to uio_info. + * It can be used to disable/enable interrupt from user space processes. + * + * @param info + * pointer to uio_info. + * @param irq_state + * state value. 1 to enable interrupt, 0 to disable interrupt. + * + * @return + * - On success, 0. + * - On failure, a negative value. + */ +static int rgde_irqcontrol(struct uio_info *info, s32 irq_state) +{ + struct rgde_dev *udev = info->priv; + struct pci_dev *pdev = udev->pdev; + + /* pci_cfg_access_lock(pdev); */ + + if (udev->mode == XDK_INTR_MODE_LEGACY) { + pci_intx(pdev, !!irq_state); + } else if (udev->mode == XDK_INTR_MODE_MSIX) { + struct msi_desc *desc; +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)) + list_for_each_entry(desc, &pdev->msi_list, list) { + rgde_msix_mask_irq(desc, irq_state); + } +#else + list_for_each_entry(desc, &pdev->dev.msi_list, list) { + rgde_msix_mask_irq(desc, irq_state); + } +#endif + } + + //pci_cfg_access_unlock(pdev); + + return 0; +} + +int rgde_reg32_read(int minor, uint64_t offset, uint32_t *data) +{ + struct rgde_dev *node, *tmp; + struct rgde_dev *uiodev; + + FPGA_PCIE_DEBUG_VERBOSE("enter rgde_reg32_read\n"); + uiodev = NULL; + list_for_each_entry_safe(node, tmp, &rgde_dev_que, list) { + if (((node->info).uio_dev)->minor == minor) { + uiodev = node; + break; + } + } + + if (uiodev == NULL) { + return -1; + } + + if (uiodev->info.mem[0].internal_addr == NULL) { + return -1; + } + +#if 0 + FPGA_PCIE_DEBUG_VERBOSE("internal_addr:%x\n", uiodev->info.mem[0].internal_addr); + + memcpy(ioval, (uint8_t *)uiodev->info.mem[0].internal_addr + offset, sizeof(ioval)); + for (i = 0; i < sizeof(ioval); i++) { + FPGA_PCIE_DEBUG_VERBOSE("mem[%x]:%02x\n", (uint32_t)(offset + i), ioval[i]); + } +#endif + + *data = (*((uint32_t *)((uint8_t *)(uiodev->info.mem[0].internal_addr) + offset))); + return 0; +} +EXPORT_SYMBOL(rgde_reg32_read); + +int rgde_reg32_write(int minor, uint64_t offset, uint32_t data) +{ + struct rgde_dev *node, *tmp; + struct rgde_dev *uiodev; + + uiodev = NULL; + list_for_each_entry_safe(node, tmp, &rgde_dev_que, list) { + if (((node->info).uio_dev)->minor == minor) { + uiodev = node; + break; + } + } + + if (uiodev == NULL) { + return -1; + } + + if (uiodev->info.mem[0].internal_addr == NULL) { + return -1; + } + + FPGA_PCIE_DEBUG_VERBOSE("enter rgde_reg32_write\n"); + FPGA_PCIE_DEBUG_VERBOSE("internal_addr:%p,offset:%llx,data:%x\n", uiodev->info.mem[0].internal_addr, offset, data); + + *((uint32_t *)((uint8_t *)(uiodev->info.mem[0].internal_addr) + offset)) = (data); + FPGA_PCIE_DEBUG_VERBOSE("rgde_reg32_write ok!\n"); + return 0; +} +EXPORT_SYMBOL(rgde_reg32_write); + +#if 0 +static void rgde_dump_global_regs(int minor) +{ + struct rgde_dev *node, *tmp; + struct rgde_dev *uiodev; + uint8_t ioval[4]; + int i, j; + + + uiodev = NULL; + list_for_each_entry_safe(node, tmp, &rgde_dev_que, list) { + if (((node->info).uio_dev)->minor == minor) { + uiodev = node; + break; + } + } + + if (uiodev == NULL) { + return ; + } + + if (uiodev->info.mem[0].internal_addr == NULL) { + return ; + } + + FPGA_PCIE_DEBUG_VERBOSE("internal_addr:%p\n", uiodev->info.mem[0].internal_addr); + for (j = 0; j < sizeof(uint32_t) * 6; j += sizeof(uint32_t)) { + memcpy(ioval, (uint8_t *)uiodev->info.mem[0].internal_addr + j, sizeof(ioval)); + for (i = 0; i < sizeof(ioval); i++) { + FPGA_PCIE_DEBUG_VERBOSE("mem[%d]:%02x\n", (uint32_t)(j + i), ioval[i]); + } + } + + return; +} +#endif + +#if 1 + +#define FPGA_PCIE_TEST_REG (0x08) +#define FPGA_PCIE_TEST_VAL (0x5A) + +#define FPGA_PCIE_RESET_PCA9548_BASE (0x20) +#define FPGA_PCIE_RESET_PCA9548_NUM (0x4) +#define FPGA_PCIE_RESET_OCORE_BASE (0x100) +#define FPGA_PCIE_RESET_OCORE_NUM (ocore_ctl_numbers) + +#define FPGA_PCIE_RESET_CPLD_I2C_BASE (0x40) +#define FPGA_PCIE_RESET_CPLD_I2C_NUM (0x4) + + +#define FPGA_PCIE_REG_STEP (0x4) + +#define DFD_CPLD_I2C_RETRY_TIMES 3 +#define DFD_CPLD_I2C_RETRY_DELAY 100 /* ms */ + +#define PCA9548_MAX_CPLD_NUM (32) + +typedef struct fpga_pcie_pca9548_cfg_info_s { + int pca9548_bus; + int pca9548_addr; + int cfg_offset; +} fpga_pcie_pca9548_cfg_info_t; + +typedef struct fpga_pcie_card_info_s { + int dev_type; + fpga_pcie_pca9548_cfg_info_t pca9548_cfg_info[PCA9548_MAX_CPLD_NUM]; +} fpga_pcie_card_info_t; + +static fpga_pcie_card_info_t g_fpga_pcie_card_info[] = { + { + /* RA-B6510-32C */ + .dev_type = 0x404b, + .pca9548_cfg_info = { + { + .pca9548_bus = 12, + .pca9548_addr = 0x70, + .cfg_offset = 0x20, + }, + { + .pca9548_bus = 12, + .pca9548_addr = 0x71, + .cfg_offset = 0x20, + }, + { + .pca9548_bus = 12, + .pca9548_addr = 0x72, + .cfg_offset = 0x20, + }, + { + .pca9548_bus = 12, + .pca9548_addr = 0x73, + .cfg_offset = 0x20, + }, + }, + }, +}; + +extern void pca954x_hw_do_reset_func_register(void* func); +extern int dfd_get_my_card_type(void); + +static void fpga_pcie_setreg_32(int offset, u32 data) +{ + if (g_fpga_pcie_mem_base) { + *((uint32_t *)((uint8_t *)(g_fpga_pcie_mem_base) + offset)) = (data); + } else { + FPGA_PCIE_DEBUG_ERROR("g_fpga_pcie_mem_base is null.\n"); + } + return; +} + + +static inline u32 fpga_pcie_getreg_32(int offset) +{ + u32 data = 0; + + if (g_fpga_pcie_mem_base) { + data = (*((uint32_t *)((uint8_t *)(g_fpga_pcie_mem_base) + offset))); + } else { + FPGA_PCIE_DEBUG_ERROR("g_fpga_pcie_mem_base is null.\n"); + } + return data; +} + +static void fpga_do_cpld_i2c_ctrl(int en) +{ +#if 0 + int i; + int offset; + + for (i = 0; i < FPGA_PCIE_RESET_CPLD_I2C_NUM; i++) { + offset = FPGA_PCIE_RESET_CPLD_I2C_BASE + i * FPGA_PCIE_REG_STEP; + FPGA_PCIE_DEBUG_VERBOSE("offset 0x%x, write en 0x%x.\n", offset, en); + fpga_pcie_setreg_32(offset, en); + } +#endif + return; +} + + +static void fpga_do_ocore_ctrl(int en) +{ + int i; + int offset; + + for (i = 0; i < FPGA_PCIE_RESET_OCORE_NUM; i++) { + offset = FPGA_PCIE_RESET_OCORE_BASE + i * FPGA_PCIE_REG_STEP; + FPGA_PCIE_DEBUG_VERBOSE("offset 0x%x, write en 0x%x.\n", offset, en); + fpga_pcie_setreg_32(offset, en); + } +} + +static void fpga_do_9548_ctrl(int en) +{ + int i; + int offset; + + for (i = 0; i < FPGA_PCIE_RESET_PCA9548_NUM; i++) { + offset = FPGA_PCIE_RESET_PCA9548_BASE + i * FPGA_PCIE_REG_STEP; + FPGA_PCIE_DEBUG_VERBOSE("offset 0x%x, write en 0x%x.\n", offset, en); + fpga_pcie_setreg_32(offset, en); + } + +} + +static void fpga_reset_ocore_i2c(void) +{ + u32 data; + + + if (g_fpga_pcie_reset_en == 0) { + FPGA_PCIE_DEBUG_VERBOSE("g_fpga_pcie_reset_en is 0, do nothing.\n"); + return; + } + + data = fpga_pcie_getreg_32(FPGA_PCIE_TEST_REG); + FPGA_PCIE_DEBUG_VERBOSE("BEGIN FPGA_PCIE_TEST_REG=[0x%x], write 0x%x.\n", data, FPGA_PCIE_TEST_VAL); + fpga_pcie_setreg_32(FPGA_PCIE_TEST_REG, FPGA_PCIE_TEST_VAL); + data = fpga_pcie_getreg_32(FPGA_PCIE_TEST_REG); + FPGA_PCIE_DEBUG_VERBOSE("END FPGA_PCIE_TEST_REG=[0x%x].\n", data); + + + + fpga_do_9548_ctrl(0); + fpga_do_ocore_ctrl(0); + fpga_do_cpld_i2c_ctrl(0); + + mdelay(500); + + + fpga_do_9548_ctrl(1); + fpga_do_ocore_ctrl(1); + fpga_do_cpld_i2c_ctrl(1); + + return; +} + +static void fpga_do_pca9548_reset_ctrl(int offset, int en) +{ + FPGA_PCIE_DEBUG_VERBOSE("offset 0x%x, write en 0x%x.\n", offset, en); + fpga_pcie_setreg_32(offset, en); +} + +fpga_pcie_card_info_t* fpga_pcie_get_card_info(int dev_type) +{ + int i; + int size; + + size = ARRAY_SIZE(g_fpga_pcie_card_info); + + FPGA_PCIE_DEBUG_VERBOSE("Enter dev_type 0x%x size %d.\n", dev_type, size); + for (i = 0; i < size; i++) { + if (g_fpga_pcie_card_info[i].dev_type == dev_type) { + FPGA_PCIE_DEBUG_VERBOSE("match dev_type 0x%x.\n", dev_type); + return &g_fpga_pcie_card_info[i]; + } + } + + FPGA_PCIE_DEBUG_VERBOSE("dismatch dev_type 0x%x.\n", dev_type); + return NULL; +} + +fpga_pcie_pca9548_cfg_info_t* fpga_pcie_get_pca9548_cfg_info(int bus, int addr) +{ + int dev_type; + fpga_pcie_card_info_t *info; + fpga_pcie_pca9548_cfg_info_t *pca9548_cfg_info; + int i; + int size; + + dev_type = dfd_get_my_card_type(); + if (dev_type < 0) { + FPGA_PCIE_DEBUG_ERROR("drv_get_my_dev_type failed ret %d.\n", dev_type); + return NULL; + } + + info = fpga_pcie_get_card_info(dev_type); + if (info == NULL) { + FPGA_PCIE_DEBUG_ERROR("fpga_pcie_get_card_info dev_type %d failed.\n", dev_type); + return NULL; + } + + size = PCA9548_MAX_CPLD_NUM; + for (i = 0; i < size; i++) { + pca9548_cfg_info = &(info->pca9548_cfg_info[i]); + if ((pca9548_cfg_info->pca9548_bus == bus) && (pca9548_cfg_info->pca9548_addr == addr)) { + FPGA_PCIE_DEBUG_VERBOSE("match dev_type 0x%x bus %d addr 0x%x.\n", dev_type, bus, addr); + return pca9548_cfg_info; + } + } + + FPGA_PCIE_DEBUG_VERBOSE("dismatch dev_type 0x%x bus %d addr 0x%x.\n", dev_type, bus, addr); + return NULL; +} + + +void fpga_do_pca954x_reset_func(int bus, int addr) +{ + fpga_pcie_pca9548_cfg_info_t *cfg_info; + + cfg_info = fpga_pcie_get_pca9548_cfg_info(bus, addr); + if (cfg_info == NULL) { + FPGA_PCIE_DEBUG_VERBOSE("fpga_do_pca954x_reset_func do nothing.\n"); + return; + } + + FPGA_PCIE_DEBUG_VERBOSE("bus %d addr 0x%x, cfg_info.offset:0x%x.\n", bus, addr, cfg_info->cfg_offset); + + fpga_do_pca9548_reset_ctrl(cfg_info->cfg_offset, 0); + mdelay(250); + fpga_do_pca9548_reset_ctrl(cfg_info->cfg_offset, 1); +} + +static void fpga_do_pca954x_reset_func_reg(void) +{ + pca954x_hw_do_reset_func_register(fpga_do_pca954x_reset_func); +} + +#endif + + +static int fpga_i2c_ocore_device_init(struct pci_dev *pdev, const struct pci_device_id *id) +{ + int ret, index; + struct rg_ocores_i2c_platform_data *init_nr_ocores; + + for (index = 0 ; index < ARRAY_SIZE(fpga_pcie_cells_bar0_cfg0); index++) { + init_nr_ocores = fpga_pcie_cells_bar0_cfg0[index].platform_data; + init_nr_ocores->nr = ocore_ctl_startbus + index; + } + FPGA_PCIE_DEBUG_VERBOSE("Enter.\n"); + FPGA_PCIE_DEBUG_VERBOSE("Begin mfd_add_devices.\n"); + ret = mfd_add_devices(&pdev->dev, 0, + fpga_pcie_cells_bar0_cfg0, + ocore_ctl_numbers > ARRAY_SIZE(fpga_pcie_cells_bar0_cfg0) ? ARRAY_SIZE(fpga_pcie_cells_bar0_cfg0) : ocore_ctl_numbers , + &pdev->resource[0], pdev->irq, NULL); + FPGA_PCIE_DEBUG_VERBOSE("End mfd_add_devices ret %d.\n", ret); + if (ret) { + dev_err(&pdev->dev, "mfd_add_devices failed: %d\n", ret); + return -1; + } + + fpga_do_pca954x_reset_func_reg(); + FPGA_PCIE_DEBUG_VERBOSE("Call fpga_do_pca954x_reset_func_reg.\n"); + return 0; +} + +static void fpga_pcie_recover(struct pci_dev *pdev, const struct pci_device_id *id) +{ + struct resource *mem_base; + u32 bar0_val; + int ret; + + mem_base = &pdev->resource[0]; + ret = pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &bar0_val); + if (ret) { + FPGA_PCIE_DEBUG_ERROR("pci_read_config_dword failed ret %d.\n", ret); + return; + } + FPGA_PCIE_DEBUG_VERBOSE("mem_base->start[0x%llx], bar0_val[0x%x], ret %d.\n", + mem_base->start, bar0_val, ret); + + if (bar0_val != mem_base->start) { + ret = pci_write_config_dword(pdev, PCI_BASE_ADDRESS_0, mem_base->start); + if (ret) { + FPGA_PCIE_DEBUG_ERROR("pci_write_config_dword mem_base->start[0x%llx], failed ret %d.\n", mem_base->start, ret); + return; + } + FPGA_PCIE_DEBUG_VERBOSE("pci_write_config_dword mem_base->start[0x%llx] success.\n", mem_base->start); + } else { + FPGA_PCIE_DEBUG_VERBOSE("mem_base->start[0x%llx], bar0_val[0x%x], do nothing.\n", + mem_base->start, bar0_val); + } +} + +static int fpga_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) +{ + int err; + struct rgde_dev *rdev = NULL; + + FPGA_PCIE_DEBUG_VERBOSE("Enter vendor 0x%x, subsystem_vendor 0x%x.\n", pdev->vendor, pdev->subsystem_vendor); + + /* skl : FIX me */ + /* + if ((pdev->vendor != ) || (pdev->subsystem_vendor != )) { + err = -ENODEV; + goto dev_suppport_err:; + }*/ + + + fpga_pcie_recover(pdev, id); + + /* enable device: ask low-level code to enable I/O and memory */ + FPGA_PCIE_DEBUG_VERBOSE("start pci_enable_device!\n"); + err = pci_enable_device(pdev); + if (err) { + FPGA_PCIE_DEBUG_ERROR("pci_enable_device failed: %d\n", err); + goto dev_ebable_err; + } + + FPGA_PCIE_DEBUG_VERBOSE("start pci_set_master!\n"); + pci_set_master(pdev); + + rdev = kzalloc(sizeof(struct rgde_dev), GFP_KERNEL); + if (!rdev) { + err = -ENOMEM; + goto kzalloc_err; + } + + + FPGA_PCIE_DEBUG_VERBOSE("start rgde_setup_bars!\n"); + err = rgde_setup_bars(pdev, &rdev->info); + if (err != 0) { + goto setup_bars_err; + } + + rdev->info.name = "fpga_pcie"; + rdev->info.version = "0.1"; + rdev->info.handler = rgde_irqhandler; + rdev->info.irqcontrol = rgde_irqcontrol; + rdev->info.priv = rdev; + rdev->pdev = pdev; + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) + err = pci_alloc_irq_vectors(pdev,FPGA_MSI_IRQ_BEGIN + 1, ocore_ctl_numbers, PCI_IRQ_MSI); +#else + err = pci_enable_msi_range(pdev, FPGA_MSI_IRQ_BEGIN + 1, ocore_ctl_numbers); +#endif + if (err != ocore_ctl_numbers) { + FPGA_PCIE_DEBUG_ERROR("pci_enable_msi_block err %d FPGA_MSI_IRQ_NUM %d.\n", err, + ocore_ctl_numbers); + goto uio_register_err; + } + + FPGA_PCIE_DEBUG_VERBOSE("before pci_set_drvdata.\n"); + + pci_set_drvdata(pdev, rdev); + FPGA_PCIE_DEBUG_VERBOSE("after pci_set_drvdata.\n"); + enum_time_log("rgde_dev_que_add\n"); + + mdelay(100); + + fpga_reset_ocore_i2c(); + + fpga_i2c_ocore_device_init(pdev, id); + return 0; + +uio_register_err: + /* udev_irq_err: */ +setup_bars_err: + rgde_release_iomem(&rdev->info); + pci_disable_msi(rdev->pdev); + pci_release_regions(pdev); + kfree(rdev); +kzalloc_err: + /* request_region_err: */ + pci_disable_device(pdev); +dev_ebable_err: + /* dev_suppport_err: */ + return err; +} + +static void fpga_pcie_remove(struct pci_dev *pdev) +{ + struct rgde_dev *rdev = pci_get_drvdata(pdev); + + FPGA_PCIE_DEBUG_VERBOSE("fpga_pcie_remove.\n"); +#if 0 + enum_time_log("rgde_dev_que_del\n"); + printk("<0>""uio device %d del.\n", rdev->info.uio_dev->minor); +#endif + rgde_dev_que_del(rdev); + rgde_dev_list_dump(); +#if 0 + uio_unregister_device(&rdev->info); +#endif + mfd_remove_devices(&pdev->dev); + rgde_release_iomem(&rdev->info); + pci_disable_msi(rdev->pdev); + //pci_release_regions(pdev); + pci_disable_device(pdev); + kfree(rdev); +} + +/* static DEFINE_PCI_DEVICE_TABLE(fpga_pci_ids) = { */ + +static const struct pci_device_id fpga_pci_ids[] = { + { PCI_DEVICE(0x10ee, 0x7022)}, + {0} +}; +MODULE_DEVICE_TABLE(pci, fpga_pci_ids); + + +static struct pci_driver fpga_pcie_driver = { + .name = "fpga_pcie", + .id_table = fpga_pci_ids,/* only dynamic id's */ + .probe = fpga_pcie_probe, + .remove = fpga_pcie_remove, +}; + +static int __init fpga_pcie_init(void) +{ + int ret; + + FPGA_PCIE_DEBUG_VERBOSE("fpga_pcie_init enter!\n"); + ret = rgde_intr_mode_config(intr_mode); + if (ret < 0) { + return ret; + } + + INIT_LIST_HEAD(&rgde_dev_que); + + return pci_register_driver(&fpga_pcie_driver); +} + +static void __exit fpga_pcie_exit(void) +{ + FPGA_PCIE_DEBUG_VERBOSE("fpga_pcie_exit enter!\n"); + pci_unregister_driver(&fpga_pcie_driver); +} + +module_init(fpga_pcie_init); +module_exit(fpga_pcie_exit); +module_param(intr_mode, charp, S_IRUGO); +MODULE_PARM_DESC(intr_mode, + "pci_uio interrupt mode (default=msix):\n" + " " INTR_MODE_MSIX_NAME " Use MSIX interrupt\n" + " " INTR_MODE_LEGACY_NAME " Use Legacy interrupt\n" + "\n"); +MODULE_DESCRIPTION("UIO Driver for PCI Devices"); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("support "); diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_pcie_i2c.h b/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_pcie_i2c.h new file mode 100755 index 000000000000..1ea970cc2206 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_pcie_i2c.h @@ -0,0 +1,107 @@ +#ifndef _FPGA_PCIE_I2C_H_ +#define _FPGA_PCIE_I2C_H_ + +#ifdef __KERNEL__ +#include +#else +#include +#endif + +#define ENUM_MAX_DEVS (255) + +typedef enum { + CHIP_NONE, + CHIP_PC, +} chiptype_t; + +/* bitmap for ports, 256 ports for now. */ +typedef struct portbitmap_s { + uint8_t bit[32]; +} portbitmap_t; + +typedef struct pc_info_s { + uint8_t ntables; /* number of flow tables */ + uint8_t ncores; /* number of cores */ + uint8_t npipelines; /* number of pipelines */ + uint8_t nports; /* number of ports */ + portbitmap_t pbm_caui; /* bitmap for CAUI ports */ + portbitmap_t pbm_ge; /* bitmap for GE ports */ +} pc_info_t; + +/** + * A structure describing a PCI resource. + */ +struct pci_resource { + uint64_t phys_addr; /**< Physical address, 0 if no resource. */ + uint64_t len; /**< Length of the resource. */ + void *addr; /**< Virtual address, NULL when not mapped. */ +}; + +/** Maximum number of PCI resources. */ +#define PCI_MAX_RESOURCE 6 + +/** Nb. of values in PCI resource format. */ +#define PCI_RESOURCE_FMT_NVAL 3 + +#if 0 +/** IO resource type: memory address space */ +#define IORESOURCE_MEM 0x00000200 +#endif + +typedef struct chipinfo_s { + /* PCI ID */ + uint16_t vendor; + uint16_t dev; + uint8_t rev; + + /* chip properties */ + chiptype_t type; + pc_info_t pc_info; /* if type == CHIP_PC */ +} chipinfo_t; + +typedef struct devinfo_s { + /* static info */ + chipinfo_t chipinfo; + + /* running states */ + uint32_t uiono; /* the "X" in /dev/uioX */ + char *pci_conf_file; /* /sys/devices/ */ + char *dev_file; /* /dev/uioX */ + + struct pci_resource mem_resource[PCI_MAX_RESOURCE]; /**< PCI Memory Resource */ + + uint32_t n_mems; /* no of mem-mapped regions, MUST BE 1 for now */ + uint32_t n_ports;/* no of port-maped regions, MUST BE 0 for now */ +} devinfo_t; + + +#ifdef __KERNEL__ +#include + +struct pci_dev *rgde_to_pci_device(int index); + +int rgde_reg32_read(int minor, uint64_t offset, uint32_t *data); + +int rgde_reg32_write(int minor, uint64_t offset, uint32_t data); + +int pkt_get_mod(int logic_dev, int *mod); + +int pkt_get_port(int logic_dev, int *port); + +/* interrupt mode */ +enum xdk_intr_mode { + XDK_INTR_MODE_NONE = 0, + XDK_INTR_MODE_LEGACY, + XDK_INTR_MODE_MSI, + XDK_INTR_MODE_MSIX +}; + +#define INTR_MODE_NONE_NAME "none" +#define INTR_MODE_LEGACY_NAME "legacy" +#define INTR_MODE_MSI_NAME "msi" +#define INTR_MODE_MSIX_NAME "msix" + +#endif /*__KERNEL__ */ + + +#endif /* _FPGA_PCIE_I2C_H_ */ diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_reg_defs.h b/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_reg_defs.h new file mode 100755 index 000000000000..f80c6318564c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/fpga_reg_defs.h @@ -0,0 +1,174 @@ +#ifndef _FPGA_REG_DEFS_H_ +#define _FPGA_REG_DEFS_H_ + +/** Define Registers */ +/* Global Registers */ +#define RGDE_REG_GLOBAL_BASE 0x00000000 +#define RGDE_REG_VERSION (RGDE_REG_GLOBAL_BASE + 0x00) +#define RGDE_REG_DATE (RGDE_REG_GLOBAL_BASE + 0x04) +#define RGDE_REG_TEST (RGDE_REG_GLOBAL_BASE + 0x08) +#define RGDE_REG_INT_ENABLE (RGDE_REG_GLOBAL_BASE + 0x10) +#define RGDE_REG_INT_STATUS (RGDE_REG_GLOBAL_BASE + 0x14) + +/* MDIO Registers */ +#define RGDE_REG_MDIO_BASE 0x00000100 +#define RGDE_REG_MDIO_CFG_DT (RGDE_REG_MDIO_BASE + 0x00) +#define RGDE_REG_MDIO_CFG_SPEED (RGDE_REG_MDIO_BASE + 0x04) +#define RGDE_REG_MDIO_CFG_START (RGDE_REG_MDIO_BASE + 0x08) +#define RGDE_REG_MDIO_RDAT (RGDE_REG_MDIO_BASE + 0x10) +#define RGDE_REG_MDIO_STATUS (RGDE_REG_MDIO_BASE + 0x14) + +/* GE0 PORT Registers */ +#define RGDE_REG_GE0_PORT_BASE 0x00001000 +#define RGDE_REG_GE0_PORT_CTL (RGDE_REG_GE0_PORT_BASE + 0x00) +#define RGDE_REG_GE0_PORT_STA (RGDE_REG_GE0_PORT_BASE + 0x04) +#define RGDE_REG_GE0_PORT_MTU (RGDE_REG_GE0_PORT_BASE + 0x08) +#define RGDE_REG_GE0_PORT_RXPKTS (RGDE_REG_GE0_PORT_BASE + 0x10) +#define RGDE_REG_GE0_PORT_RXBYTE (RGDE_REG_GE0_PORT_BASE + 0x18) +#define RGDE_REG_GE0_PORT_RXERR (RGDE_REG_GE0_PORT_BASE + 0x20) +#define RGDE_REG_GE0_PORT_RXDROP (RGDE_REG_GE0_PORT_BASE + 0x28) +#define RGDE_REG_GE0_PORT_RXMULTI (RGDE_REG_GE0_PORT_BASE + 0x30) +#define RGDE_REG_GE0_PORT_RXBRO (RGDE_REG_GE0_PORT_BASE + 0x38) +#define RGDE_REG_GE0_PORT_TXPKTS (RGDE_REG_GE0_PORT_BASE + 0x40) +#define RGDE_REG_GE0_PORT_TXBYTE (RGDE_REG_GE0_PORT_BASE + 0x48) +#define RGDE_REG_GE0_PORT_TXERR (RGDE_REG_GE0_PORT_BASE + 0x50) +#define RGDE_REG_GE0_PORT_TXDROP (RGDE_REG_GE0_PORT_BASE + 0x58) +#define RGDE_REG_GE0_PORT_TXMULT (RGDE_REG_GE0_PORT_BASE + 0x60) +#define RGDE_REG_GE0_PORT_TXBRO (RGDE_REG_GE0_PORT_BASE + 0x68) + +/* GE1 PORT Registers */ +#define RGDE_REG_GE1_PORT_BASE 0x00001100 +#define RGDE_REG_GE1_PORT_CTL (RGDE_REG_GE1_PORT_BASE + 0x00) +#define RGDE_REG_GE1_PORT_STA (RGDE_REG_GE1_PORT_BASE + 0x04) +#define RGDE_REG_GE1_PORT_MTU (RGDE_REG_GE1_PORT_BASE + 0x08) +#define RGDE_REG_GE1_PORT_RXPKTS (RGDE_REG_GE1_PORT_BASE + 0x10) +#define RGDE_REG_GE1_PORT_RXBYTE (RGDE_REG_GE1_PORT_BASE + 0x18) +#define RGDE_REG_GE1_PORT_RXERR (RGDE_REG_GE1_PORT_BASE + 0x20) +#define RGDE_REG_GE1_PORT_RXDROP (RGDE_REG_GE1_PORT_BASE + 0x28) +#define RGDE_REG_GE1_PORT_RXMULTI (RGDE_REG_GE1_PORT_BASE + 0x30) +#define RGDE_REG_GE1_PORT_RXBRO (RGDE_REG_GE1_PORT_BASE + 0x38) +#define RGDE_REG_GE1_PORT_TXPKTS (RGDE_REG_GE1_PORT_BASE + 0x40) +#define RGDE_REG_GE1_PORT_TXBYTE (RGDE_REG_GE1_PORT_BASE + 0x48) +#define RGDE_REG_GE1_PORT_TXERR (RGDE_REG_GE1_PORT_BASE + 0x50) +#define RGDE_REG_GE1_PORT_TXDROP (RGDE_REG_GE1_PORT_BASE + 0x58) +#define RGDE_REG_GE1_PORT_TXMULT (RGDE_REG_GE1_PORT_BASE + 0x60) +#define RGDE_REG_GE1_PORT_TXBRO (RGDE_REG_GE1_PORT_BASE + 0x68) + +/* GE2 PORT Registers */ +#define RGDE_REG_GE2_PORT_BASE 0x00001200 +#define RGDE_REG_GE2_PORT_CTL (RGDE_REG_GE2_PORT_BASE + 0x00) +#define RGDE_REG_GE2_PORT_STA (RGDE_REG_GE2_PORT_BASE + 0x04) +#define RGDE_REG_GE2_PORT_MTU (RGDE_REG_GE2_PORT_BASE + 0x08) +#define RGDE_REG_GE2_PORT_RXPKTS (RGDE_REG_GE2_PORT_BASE + 0x10) +#define RGDE_REG_GE2_PORT_RXBYTE (RGDE_REG_GE2_PORT_BASE + 0x18) +#define RGDE_REG_GE2_PORT_RXERR (RGDE_REG_GE2_PORT_BASE + 0x20) +#define RGDE_REG_GE2_PORT_RXDROP (RGDE_REG_GE2_PORT_BASE + 0x28) +#define RGDE_REG_GE2_PORT_RXMULTI (RGDE_REG_GE2_PORT_BASE + 0x30) +#define RGDE_REG_GE2_PORT_RXBRO (RGDE_REG_GE2_PORT_BASE + 0x38) +#define RGDE_REG_GE2_PORT_TXPKTS (RGDE_REG_GE2_PORT_BASE + 0x40) +#define RGDE_REG_GE2_PORT_TXBYTE (RGDE_REG_GE2_PORT_BASE + 0x48) +#define RGDE_REG_GE2_PORT_TXERR (RGDE_REG_GE2_PORT_BASE + 0x50) +#define RGDE_REG_GE2_PORT_TXDROP (RGDE_REG_GE2_PORT_BASE + 0x58) +#define RGDE_REG_GE2_PORT_TXMULT (RGDE_REG_GE2_PORT_BASE + 0x60) +#define RGDE_REG_GE2_PORT_TXBRO (RGDE_REG_GE2_PORT_BASE + 0x68) + +/* GE3 PORT Registers */ +#define RGDE_REG_GE3_PORT_BASE 0x00001300 +#define RGDE_REG_GE3_PORT_CTL (RGDE_REG_GE3_PORT_BASE + 0x00) +#define RGDE_REG_GE3_PORT_STA (RGDE_REG_GE3_PORT_BASE + 0x04) +#define RGDE_REG_GE3_PORT_MTU (RGDE_REG_GE3_PORT_BASE + 0x08) +#define RGDE_REG_GE3_PORT_RXPKTS (RGDE_REG_GE3_PORT_BASE + 0x10) +#define RGDE_REG_GE3_PORT_RXBYTE (RGDE_REG_GE3_PORT_BASE + 0x18) +#define RGDE_REG_GE3_PORT_RXERR (RGDE_REG_GE3_PORT_BASE + 0x20) +#define RGDE_REG_GE3_PORT_RXDROP (RGDE_REG_GE3_PORT_BASE + 0x28) +#define RGDE_REG_GE3_PORT_RXMULTI (RGDE_REG_GE3_PORT_BASE + 0x30) +#define RGDE_REG_GE3_PORT_RXBRO (RGDE_REG_GE3_PORT_BASE + 0x38) +#define RGDE_REG_GE3_PORT_TXPKTS (RGDE_REG_GE3_PORT_BASE + 0x40) +#define RGDE_REG_GE3_PORT_TXBYTE (RGDE_REG_GE3_PORT_BASE + 0x48) +#define RGDE_REG_GE3_PORT_TXERR (RGDE_REG_GE3_PORT_BASE + 0x50) +#define RGDE_REG_GE3_PORT_TXDROP (RGDE_REG_GE3_PORT_BASE + 0x58) +#define RGDE_REG_GE3_PORT_TXMULT (RGDE_REG_GE3_PORT_BASE + 0x60) +#define RGDE_REG_GE3_PORT_TXBRO (RGDE_REG_GE3_PORT_BASE + 0x68) + +/* GE4 PORT Registers */ +#define RGDE_REG_XGE0_PORT_BASE 0x00001400 +#define RGDE_REG_XGE0_PORT_CTL (RGDE_REG_XGE0_PORT_BASE + 0x00) +#define RGDE_REG_XGE0_PORT_STA (RGDE_REG_XGE0_PORT_BASE + 0x04) +#define RGDE_REG_XGE0_PORT_MTU (RGDE_REG_XGE0_PORT_BASE + 0x08) +#define RGDE_REG_XGE0_PORT_RXPKTS (RGDE_REG_XGE0_PORT_BASE + 0x10) +#define RGDE_REG_XGE0_PORT_RXBYTE (RGDE_REG_XGE0_PORT_BASE + 0x18) +#define RGDE_REG_XGE0_PORT_RXERR (RGDE_REG_XGE0_PORT_BASE + 0x20) +#define RGDE_REG_XGE0_PORT_RXDROP (RGDE_REG_XGE0_PORT_BASE + 0x28) +#define RGDE_REG_XGE0_PORT_RXMULTI (RGDE_REG_XGE0_PORT_BASE + 0x30) +#define RGDE_REG_XGE0_PORT_RXBRO (RGDE_REG_XGE0_PORT_BASE + 0x38) +#define RGDE_REG_XGE0_PORT_TXPKTS (RGDE_REG_XGE0_PORT_BASE + 0x40) +#define RGDE_REG_XGE0_PORT_TXBYTE (RGDE_REG_XGE0_PORT_BASE + 0x48) +#define RGDE_REG_XGE0_PORT_TXERR (RGDE_REG_XGE0_PORT_BASE + 0x50) +#define RGDE_REG_XGE0_PORT_TXDROP (RGDE_REG_XGE0_PORT_BASE + 0x58) +#define RGDE_REG_XGE0_PORT_TXMULT (RGDE_REG_XGE0_PORT_BASE + 0x60) +#define RGDE_REG_XGE0_PORT_TXBRO (RGDE_REG_XGE0_PORT_BASE + 0x68) + +/* GE5 PORT Registers */ +#define RGDE_REG_XGE1_PORT_BASE 0x00001500 +#define RGDE_REG_XGE1_PORT_CTL (RGDE_REG_XGE1_PORT_BASE + 0x00) +#define RGDE_REG_XGE1_PORT_STA (RGDE_REG_XGE1_PORT_BASE + 0x04) +#define RGDE_REG_XGE1_PORT_MTU (RGDE_REG_XGE1_PORT_BASE + 0x08) +#define RGDE_REG_XGE1_PORT_RXPKTS (RGDE_REG_XGE1_PORT_BASE + 0x10) +#define RGDE_REG_XGE1_PORT_RXBYTE (RGDE_REG_XGE1_PORT_BASE + 0x18) +#define RGDE_REG_XGE1_PORT_RXERR (RGDE_REG_XGE1_PORT_BASE + 0x20) +#define RGDE_REG_XGE1_PORT_RXDROP (RGDE_REG_XGE1_PORT_BASE + 0x28) +#define RGDE_REG_XGE1_PORT_RXMULTI (RGDE_REG_XGE1_PORT_BASE + 0x30) +#define RGDE_REG_XGE1_PORT_RXBRO (RGDE_REG_XGE1_PORT_BASE + 0x38) +#define RGDE_REG_XGE1_PORT_TXPKTS (RGDE_REG_XGE1_PORT_BASE + 0x40) +#define RGDE_REG_XGE1_PORT_TXBYTE (RGDE_REG_XGE1_PORT_BASE + 0x48) +#define RGDE_REG_XGE1_PORT_TXERR (RGDE_REG_XGE1_PORT_BASE + 0x50) +#define RGDE_REG_XGE1_PORT_TXDROP (RGDE_REG_XGE1_PORT_BASE + 0x58) +#define RGDE_REG_XGE1_PORT_TXMULT (RGDE_REG_XGE1_PORT_BASE + 0x60) +#define RGDE_REG_XGE1_PORT_TXBRO (RGDE_REG_XGE1_PORT_BASE + 0x68) + +#define RGDE_REG_CPU_BASE 0x00002100 +#define RGDE_REG_PCIE_ENDIAN_CNTR (RGDE_REG_CPU_BASE + 0x08) + +/* DMA Registers */ +#define RGDE_REG_DMA_BASE 0x00004000 +#define RGDE_REG_BD_WR_OVERTIME (RGDE_REG_DMA_BASE + 0x00) +#define RGDE_REG_BD_DEEP (RGDE_REG_DMA_BASE + 0x04) + +/* TX0 Registers */ +#define RGDE_REG_TX0_BASE 0x00005000 +#define RGDE_REG_TX0_CHN_EN (RGDE_REG_TX0_BASE + 0x00) +#define RGDE_REG_TX0_BD_BASE (RGDE_REG_TX0_BASE + 0x04) +#define RGDE_REG_TX0_BD_TAIL (RGDE_REG_TX0_BASE + 0x08) +#define RGDE_REG_TX0_BD_READY_NUM (RGDE_REG_TX0_BASE + 0x0c) +#define RGDE_REG_TX0_CPU2FPGA_BD_NUM (RGDE_REG_TX0_BASE + 0x30) +#define RGDE_REG_TX0_FPGA2CPU_BD_NUM (RGDE_REG_TX0_BASE + 0x34) + +/* TX1 Registers */ +#define RGDE_REG_TX1_BASE 0x00005100 +#define RGDE_REG_TX1_CHN_EN (RGDE_REG_TX1_BASE + 0x00) +#define RGDE_REG_TX1_BD_BASE (RGDE_REG_TX1_BASE + 0x04) +#define RGDE_REG_TX1_BD_TAIL (RGDE_REG_TX1_BASE + 0x08) +#define RGDE_REG_TX1_BD_READY_NUM (RGDE_REG_TX1_BASE + 0x0c) +#define RGDE_REG_TX1_CPU2FPGA_BD_NUM (RGDE_REG_TX1_BASE + 0x30) +#define RGDE_REG_TX1_FPGA2CPU_BD_NUM (RGDE_REG_TX1_BASE + 0x34) + +/* RX0 Registers */ +#define RGDE_REG_RX0_BASE 0x00006400 +#define RGDE_REG_RX0_CHN_EN (RGDE_REG_RX0_BASE + 0x00) +#define RGDE_REG_RX0_BD_BASE (RGDE_REG_RX0_BASE + 0x04) +#define RGDE_REG_RX0_BD_TAIL (RGDE_REG_RX0_BASE + 0x08) +#define RGDE_REG_RX0_BD_READY_NUM (RGDE_REG_RX0_BASE + 0x0c) +#define RGDE_REG_RX0_CPU2FPGA_BD_NUM (RGDE_REG_RX0_BASE + 0x30) +#define RGDE_REG_RX0_FPGA2CPU_BD_NUM (RGDE_REG_RX0_BASE + 0x34) + +/* RX1 Registers */ +#define RGDE_REG_RX1_BASE 0x00006500 +#define RGDE_REG_RX1_CHN_EN (RGDE_REG_RX1_BASE + 0x00) +#define RGDE_REG_RX1_BD_BASE (RGDE_REG_RX1_BASE + 0x04) +#define RGDE_REG_RX1_BD_TAIL (RGDE_REG_RX1_BASE + 0x08) +#define RGDE_REG_RX1_BD_READY_NUM (RGDE_REG_RX1_BASE + 0x0c) +#define RGDE_REG_RX1_CPU2FPGA_BD_NUM (RGDE_REG_RX1_BASE + 0x30) +#define RGDE_REG_RX1_FPGA2CPU_BD_NUM (RGDE_REG_RX1_BASE + 0x34) + + +#endif /* _FPGA_REG_DEFS_H_ */ diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/i2c-mux-pca954x.c b/platform/broadcom/sonic-platform-modules-ragile/common/modules/i2c-mux-pca954x.c index 8c7054fbb9f2..f7b6bb952bf9 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/modules/i2c-mux-pca954x.c +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/i2c-mux-pca954x.c @@ -8,8 +8,8 @@ * This module supports the PCA954x series of I2C multiplexer/switch chips * made by Philips Semiconductors. * This includes the: - * PCA9540, PCA9542, PCA9543, PCA9544, PCA9545, PCA9546, PCA9547 - * and PCA9548. + * PCA9540, PCA9542, PCA9543, PCA9544, PCA9545, PCA9546, PCA9547 + * and PCA9548. * * These chips are all controlled via the I2C bus itself, and all have a * single 8-bit register. The upstream "parent" bus fans out to two, @@ -19,17 +19,17 @@ * combination simultaneously. * * Based on: - * pca954x.c from Kumar Gala + * pca954x.c from Kumar Gala * Copyright (C) 2006 * * Based on: - * pca954x.c from Ken Harrenstien + * pca954x.c from Ken Harrenstien * Copyright (C) 2004 Google, Inc. (Ken Harrenstien) * * Based on: - * i2c-virtual_cb.c from Brian Kuschak + * i2c-virtual_cb.c from Brian Kuschak * and - * pca9540.c from Jean Delvare . + * pca9540.c from Jean Delvare . * * This file is licensed under the terms of the GNU General Public * License version 2. This program is licensed "as is" without any @@ -66,109 +66,109 @@ int force_create_bus = 0; module_param(force_create_bus, int, S_IRUGO | S_IWUSR); enum pca_type { - pca_9540, - pca_9542, - pca_9543, - pca_9544, - pca_9545, - pca_9546, - pca_9547, - pca_9548, + pca_9540, + pca_9542, + pca_9543, + pca_9544, + pca_9545, + pca_9546, + pca_9547, + pca_9548, }; struct chip_desc { - u8 nchans; - u8 enable; /* used for muxes only */ - u8 has_irq; - enum muxtype { - pca954x_ismux = 0, - pca954x_isswi - } muxtype; + u8 nchans; + u8 enable; /* used for muxes only */ + u8 has_irq; + enum muxtype { + pca954x_ismux = 0, + pca954x_isswi + } muxtype; }; struct pca954x { - const struct chip_desc *chip; + const struct chip_desc *chip; - u8 last_chan; /* last register value */ - u8 deselect; - struct i2c_client *client; + u8 last_chan; /* last register value */ + u8 deselect; + struct i2c_client *client; - struct irq_domain *irq; - unsigned int irq_mask; - raw_spinlock_t lock; + struct irq_domain *irq; + unsigned int irq_mask; + raw_spinlock_t lock; }; /* Provide specs for the PCA954x types we know about */ static const struct chip_desc chips[] = { - [pca_9540] = { - .nchans = 2, - .enable = 0x4, - .muxtype = pca954x_ismux, - }, - [pca_9542] = { - .nchans = 2, - .enable = 0x4, - .has_irq = 1, - .muxtype = pca954x_ismux, - }, - [pca_9543] = { - .nchans = 2, - .has_irq = 1, - .muxtype = pca954x_isswi, - }, - [pca_9544] = { - .nchans = 4, - .enable = 0x4, - .has_irq = 1, - .muxtype = pca954x_ismux, - }, - [pca_9545] = { - .nchans = 4, - .has_irq = 1, - .muxtype = pca954x_isswi, - }, - [pca_9546] = { - .nchans = 4, - .muxtype = pca954x_isswi, - }, - [pca_9547] = { - .nchans = 8, - .enable = 0x8, - .muxtype = pca954x_ismux, - }, - [pca_9548] = { - .nchans = 8, - .muxtype = pca954x_isswi, - }, + [pca_9540] = { + .nchans = 2, + .enable = 0x4, + .muxtype = pca954x_ismux, + }, + [pca_9542] = { + .nchans = 2, + .enable = 0x4, + .has_irq = 1, + .muxtype = pca954x_ismux, + }, + [pca_9543] = { + .nchans = 2, + .has_irq = 1, + .muxtype = pca954x_isswi, + }, + [pca_9544] = { + .nchans = 4, + .enable = 0x4, + .has_irq = 1, + .muxtype = pca954x_ismux, + }, + [pca_9545] = { + .nchans = 4, + .has_irq = 1, + .muxtype = pca954x_isswi, + }, + [pca_9546] = { + .nchans = 4, + .muxtype = pca954x_isswi, + }, + [pca_9547] = { + .nchans = 8, + .enable = 0x8, + .muxtype = pca954x_ismux, + }, + [pca_9548] = { + .nchans = 8, + .muxtype = pca954x_isswi, + }, }; static const struct i2c_device_id pca954x_id[] = { - { "pca9540", pca_9540 }, - { "pca9542", pca_9542 }, - { "pca9543", pca_9543 }, - { "pca9544", pca_9544 }, - { "pca9545", pca_9545 }, - { "pca9546", pca_9546 }, - { "pca9547", pca_9547 }, - { "pca9548", pca_9548 }, - { } + { "pca9540", pca_9540 }, + { "pca9542", pca_9542 }, + { "pca9543", pca_9543 }, + { "pca9544", pca_9544 }, + { "pca9545", pca_9545 }, + { "pca9546", pca_9546 }, + { "pca9547", pca_9547 }, + { "pca9548", pca_9548 }, + { } }; MODULE_DEVICE_TABLE(i2c, pca954x_id); #ifdef CONFIG_OF static const struct of_device_id pca954x_of_match[] = { - { .compatible = "nxp,pca9540", .data = &chips[pca_9540] }, - { .compatible = "nxp,pca9542", .data = &chips[pca_9542] }, - { .compatible = "nxp,pca9543", .data = &chips[pca_9543] }, - { .compatible = "nxp,pca9544", .data = &chips[pca_9544] }, - { .compatible = "nxp,pca9545", .data = &chips[pca_9545] }, - { .compatible = "nxp,pca9546", .data = &chips[pca_9546] }, - { .compatible = "nxp,pca9547", .data = &chips[pca_9547] }, - { .compatible = "nxp,pca9548", .data = &chips[pca_9548] }, - {} + { .compatible = "nxp,pca9540", .data = &chips[pca_9540] }, + { .compatible = "nxp,pca9542", .data = &chips[pca_9542] }, + { .compatible = "nxp,pca9543", .data = &chips[pca_9543] }, + { .compatible = "nxp,pca9544", .data = &chips[pca_9544] }, + { .compatible = "nxp,pca9545", .data = &chips[pca_9545] }, + { .compatible = "nxp,pca9546", .data = &chips[pca_9546] }, + { .compatible = "nxp,pca9547", .data = &chips[pca_9547] }, + { .compatible = "nxp,pca9548", .data = &chips[pca_9548] }, + {} }; MODULE_DEVICE_TABLE(of, pca954x_of_match); #endif @@ -176,63 +176,63 @@ MODULE_DEVICE_TABLE(of, pca954x_of_match); /* Write to mux register. Don't use i2c_transfer()/i2c_smbus_xfer() for this as they will try to lock adapter a second time */ static int pca954x_reg_write(struct i2c_adapter *adap, - struct i2c_client *client, u8 val) + struct i2c_client *client, u8 val) { - int ret = -ENODEV; - - if (adap->algo->master_xfer) { - struct i2c_msg msg; - char buf[1]; - - msg.addr = client->addr; - msg.flags = 0; - msg.len = 1; - buf[0] = val; - msg.buf = buf; - ret = __i2c_transfer(adap, &msg, 1); - - if (ret >= 0 && ret != 1) - ret = -EREMOTEIO; - } else { - union i2c_smbus_data data; - ret = adap->algo->smbus_xfer(adap, client->addr, - client->flags, - I2C_SMBUS_WRITE, - val, I2C_SMBUS_BYTE, &data); - } - - return ret; + int ret = -ENODEV; + + if (adap->algo->master_xfer) { + struct i2c_msg msg; + char buf[1]; + + msg.addr = client->addr; + msg.flags = 0; + msg.len = 1; + buf[0] = val; + msg.buf = buf; + ret = __i2c_transfer(adap, &msg, 1); + + if (ret >= 0 && ret != 1) + ret = -EREMOTEIO; + } else { + union i2c_smbus_data data; + ret = adap->algo->smbus_xfer(adap, client->addr, + client->flags, + I2C_SMBUS_WRITE, + val, I2C_SMBUS_BYTE, &data); + } + + return ret; } - static int pca954x_setmuxflag(struct i2c_client *client, int flag) - { - struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); - pca9641_setmuxflag(adap->nr, flag); - return 0; - } +static int pca954x_setmuxflag(struct i2c_client *client, int flag) +{ + struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); + pca9641_setmuxflag(adap->nr, flag); + return 0; +} static int pca954x_select_chan(struct i2c_mux_core *muxc, u32 chan) { - struct pca954x *data = i2c_mux_priv(muxc); - struct i2c_client *client = data->client; - const struct chip_desc *chip = data->chip; - u8 regval; - int ret = 0; - - /* we make switches look like muxes, not sure how to be smarter */ - if (chip->muxtype == pca954x_ismux) - regval = chan | chip->enable; - else - regval = 1 << chan; - - /* Only select the channel if its different from the last channel */ - if (data->last_chan != regval) { - pca954x_setmuxflag(client, 0); - ret = pca954x_reg_write(muxc->parent, client, regval); - data->last_chan = ret < 0 ? 0 : regval; - } - - return ret; + struct pca954x *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + const struct chip_desc *chip = data->chip; + u8 regval; + int ret = 0; + + /* we make switches look like muxes, not sure how to be smarter */ + if (chip->muxtype == pca954x_ismux) + regval = chan | chip->enable; + else + regval = 1 << chan; + + /* Only select the channel if its different from the last channel */ + if (data->last_chan != regval) { + pca954x_setmuxflag(client, 0); + ret = pca954x_reg_write(muxc->parent, client, regval); + data->last_chan = ret < 0 ? 0 : regval; + } + + return ret; } @@ -326,7 +326,7 @@ typedef struct fpga_pcie_card_info_s { static pca9548_card_info_t g_pca9548_card_info[] = { { - .dev_type = {0x404a,0x4061,0x4071}, /*RA-B6510-48V8C*/ + .dev_type = {0x404a}, /* RA-B6510-48V8C */ .pca9548_cfg_info = { /* psu fan */ { @@ -451,6 +451,7 @@ static pca9548_card_info_t g_pca9548_card_info[] = { }, }, { + /*RA-B6910-64C*/ .dev_type = {0x404c}, .pca9548_cfg_info = { /* psu fan */ @@ -591,348 +592,8 @@ static pca9548_card_info_t g_pca9548_card_info[] = { }, }, { - .dev_type = {0x4044,0x4072,0x4048}, - .pca9548_cfg_info = { - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 2, - .pca9548_addr = 0x76, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0x936, -1}, - .func_attr.umask = {BIT(4), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 8, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0x917, -1}, - .func_attr.umask = {BIT(4), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 9, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0x917, -1}, - .func_attr.umask = {BIT(0), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 12, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0x917, -1}, - .func_attr.umask = {BIT(1), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 11, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0x917, -1}, - .func_attr.umask = {BIT(2), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 7, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0x917, -1}, - .func_attr.umask = {BIT(3), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 14, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb10, -1}, - .func_attr.umask = {BIT(5), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 13, - .pca9548_addr = 0x77, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb10, -1}, - .func_attr.umask = {BIT(7), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 3, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(0), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 3, - .pca9548_addr = 0x71, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(0), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 3, - .pca9548_addr = 0x72, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(0), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 3, - .pca9548_addr = 0x73, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(0), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 4, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(1), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 4, - .pca9548_addr = 0x71, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(1), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 4, - .pca9548_addr = 0x72, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(1), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 4, - .pca9548_addr = 0x73, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(1), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 5, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(2), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 5, - .pca9548_addr = 0x71, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(2), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 5, - .pca9548_addr = 0x72, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(2), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 5, - .pca9548_addr = 0x73, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(2), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 6, - .pca9548_addr = 0x70, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(3), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 6, - .pca9548_addr = 0x71, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(3), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 6, - .pca9548_addr = 0x72, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(3), -1}, - }, - }, - { - .pca9548_reset_type = PCA9548_RESET_FUNC, - .pca9548_bus = 6, - .pca9548_addr = 0x73, - .rst_delay_b = 0, - .rst_delay = 1000, - .rst_delay_a = 1000, - .attr = { - .func_attr.reset_func = pca954x_hw_do_reset_by_lpc, - .func_attr.get_umask_func = pca954x_get_umask_by_lpc, - .func_attr.cfg_offset = {0xb17, -1}, - .func_attr.umask = {BIT(3), -1}, - }, - }, - }, - }, - { - .dev_type = {0x404b,0x4073}, + /* RA-B6510-32C */ + .dev_type = {0x404b}, .pca9548_cfg_info = { /* psu */ { @@ -998,7 +659,8 @@ static int dfd_get_my_dev_type_by_file(void) /* set_fs(KERNEL_DS); */ memset(buf, 0, DFD_PID_BUF_LEN); pos = 0; - kernel_read(fp, pos, buf, DFD_PRODUCT_ID_LENGTH + 1 ); + kernel_read(fp, buf, DFD_PRODUCT_ID_LENGTH + 1, &pos); + // kernel_read(fp, pos, buf, DFD_PRODUCT_ID_LENGTH + 1 ); if (pos < 0) { PCA954X_DEBUG("read file fail!\r\n"); goto exit; @@ -1104,9 +766,10 @@ static void pca9548_gpio_free(gpio_attr_t *gpio_attr) } static int pca954x_do_gpio_reset(pca9548_cfg_info_t *cfg_info, struct i2c_adapter *adap, - struct i2c_client *client, u32 chan) + struct i2c_client *client, u32 chan) { - struct pca954x *data = i2c_get_clientdata(client); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct pca954x *data = i2c_mux_priv(muxc); int ret = -1; gpio_attr_t *tmp_gpio_attr; int timeout; @@ -1171,9 +834,10 @@ static int pca954x_do_gpio_reset(pca9548_cfg_info_t *cfg_info, struct i2c_adapte } static int pca954x_do_func_reset(pca9548_cfg_info_t *cfg_info, struct i2c_adapter *adap, - struct i2c_client *client, u32 chan) + struct i2c_client *client, u32 chan) { - struct pca954x *data = i2c_get_clientdata(client); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct pca954x *data = i2c_mux_priv(muxc); int ret = -1; func_attr_t *tmp_func_attr; int timeout; @@ -1198,10 +862,10 @@ static int pca954x_do_func_reset(pca9548_cfg_info_t *cfg_info, struct i2c_adapte } for(i = 0; (i < PCA9548_MAX_CPLD_LAYER) && (tmp_func_attr->cfg_offset[i] != -1) - && (tmp_func_attr->umask[i] != -1); i++) { + && (tmp_func_attr->umask[i] != -1); i++) { old_value = (*tmp_func_attr->get_umask_func)(tmp_func_attr->cfg_offset[i]); PCA954X_DEBUG("cfg info: offset:0x%x umask:0x%x, old_value:0x%x\n", - tmp_func_attr->cfg_offset[i], tmp_func_attr->umask[i],old_value); + tmp_func_attr->cfg_offset[i], tmp_func_attr->umask[i],old_value); (*tmp_func_attr->reset_func)(tmp_func_attr->cfg_offset[i], old_value & ~tmp_func_attr->umask[i]); udelay(cfg_info->rst_delay); (*tmp_func_attr->reset_func)(tmp_func_attr->cfg_offset[i], old_value | tmp_func_attr->umask[i]); @@ -1245,7 +909,7 @@ static int pca954x_do_func_reset(pca9548_cfg_info_t *cfg_info, struct i2c_adapte } static int pca9548_reset_ctrl(pca9548_cfg_info_t *cfg_info, struct i2c_adapter *adap, - struct i2c_client *client, u32 chan) + struct i2c_client *client, u32 chan) { int ret = -1; @@ -1267,7 +931,7 @@ static int pca9548_reset_ctrl(pca9548_cfg_info_t *cfg_info, struct i2c_adapter * } static int pca954x_reset_i2c_read(uint32_t bus, uint32_t addr, uint32_t offset_addr, - unsigned char *buf, uint32_t size) + unsigned char *buf, uint32_t size) { struct file *fp; /* mm_segment_t fs; */ @@ -1298,9 +962,9 @@ static int pca954x_reset_i2c_read(uint32_t bus, uint32_t addr, uint32_t offset_a goto out; } continue; - } - *(buf + j) = (unsigned char)rv; - break; + } + *(buf + j) = (unsigned char)rv; + break; } } out: @@ -1310,7 +974,7 @@ static int pca954x_reset_i2c_read(uint32_t bus, uint32_t addr, uint32_t offset_a } static int pca954x_reset_i2c_write(uint32_t bus, uint32_t dev_addr, uint32_t offset_addr, - uint8_t write_buf) + uint8_t write_buf) { struct file *fp; /* mm_segment_t fs; */ @@ -1414,7 +1078,7 @@ u8 pca954x_get_umask_by_i2c(int addr) void pca954x_hw_do_reset_by_lpc(int io_port, u8 value) { PCA954X_DEBUG("write lpc offset[0x%x], value[%d]\n", (u16)io_port, value); - outb(value, (u16)io_port); + outb(value, (u16)io_port); } u8 pca954x_get_umask_by_lpc(int io_port) @@ -1428,7 +1092,7 @@ u8 pca954x_get_umask_by_lpc(int io_port) } int pca954x_hw_do_reset_new(struct i2c_adapter *adap, - struct i2c_client *client, u32 chan) + struct i2c_client *client, u32 chan) { pca9548_cfg_info_t *cfg_info; int ret = -1; @@ -1451,7 +1115,7 @@ int pca954x_hw_do_reset_new(struct i2c_adapter *adap, /******************************end 9548 reset***********************************/ static int pca954x_do_reset(struct i2c_adapter *adap, - void *client, u32 chan) + void *client, u32 chan) { struct i2c_client *new_client; int ret = -1; @@ -1470,15 +1134,15 @@ static int pca954x_do_reset(struct i2c_adapter *adap, } static int pca954x_deselect_mux(struct i2c_mux_core *muxc, u32 chan) { - struct pca954x *data = i2c_mux_priv(muxc); - struct i2c_client *client = data->client; - int ret, rv; - struct i2c_client * new_client; + struct pca954x *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + int ret, rv; + struct i2c_client * new_client; - /* Deselect active channel */ - data->last_chan = 0; + /* Deselect active channel */ + data->last_chan = 0; - ret = pca954x_reg_write(muxc->parent, client, data->last_chan); + ret = pca954x_reg_write(muxc->parent, client, data->last_chan); if (ret < 0) { new_client =(struct i2c_client *) client; dev_warn(&new_client->dev, "pca954x close chn failed, do reset.\n"); @@ -1491,255 +1155,255 @@ static int pca954x_deselect_mux(struct i2c_mux_core *muxc, u32 chan) pca954x_setmuxflag(client, 1); (void)pca954x_reg_write(muxc->parent, client, data->last_chan); - return ret; + return ret; } static irqreturn_t pca954x_irq_handler(int irq, void *dev_id) { - struct pca954x *data = dev_id; - unsigned int child_irq; - int ret, i, handled = 0; - - ret = i2c_smbus_read_byte(data->client); - if (ret < 0) - return IRQ_NONE; - - for (i = 0; i < data->chip->nchans; i++) { - if (ret & BIT(PCA954X_IRQ_OFFSET + i)) { - child_irq = irq_linear_revmap(data->irq, i); - handle_nested_irq(child_irq); - handled++; - } - } - return handled ? IRQ_HANDLED : IRQ_NONE; + struct pca954x *data = dev_id; + unsigned int child_irq; + int ret, i, handled = 0; + + ret = i2c_smbus_read_byte(data->client); + if (ret < 0) + return IRQ_NONE; + + for (i = 0; i < data->chip->nchans; i++) { + if (ret & BIT(PCA954X_IRQ_OFFSET + i)) { + child_irq = irq_linear_revmap(data->irq, i); + handle_nested_irq(child_irq); + handled++; + } + } + return handled ? IRQ_HANDLED : IRQ_NONE; } static void pca954x_irq_mask(struct irq_data *idata) { - struct pca954x *data = irq_data_get_irq_chip_data(idata); - unsigned int pos = idata->hwirq; - unsigned long flags; + struct pca954x *data = irq_data_get_irq_chip_data(idata); + unsigned int pos = idata->hwirq; + unsigned long flags; - raw_spin_lock_irqsave(&data->lock, flags); + raw_spin_lock_irqsave(&data->lock, flags); - data->irq_mask &= ~BIT(pos); - if (!data->irq_mask) - disable_irq(data->client->irq); + data->irq_mask &= ~BIT(pos); + if (!data->irq_mask) + disable_irq(data->client->irq); - raw_spin_unlock_irqrestore(&data->lock, flags); + raw_spin_unlock_irqrestore(&data->lock, flags); } static void pca954x_irq_unmask(struct irq_data *idata) { - struct pca954x *data = irq_data_get_irq_chip_data(idata); - unsigned int pos = idata->hwirq; - unsigned long flags; + struct pca954x *data = irq_data_get_irq_chip_data(idata); + unsigned int pos = idata->hwirq; + unsigned long flags; - raw_spin_lock_irqsave(&data->lock, flags); + raw_spin_lock_irqsave(&data->lock, flags); - if (!data->irq_mask) - enable_irq(data->client->irq); - data->irq_mask |= BIT(pos); + if (!data->irq_mask) + enable_irq(data->client->irq); + data->irq_mask |= BIT(pos); - raw_spin_unlock_irqrestore(&data->lock, flags); + raw_spin_unlock_irqrestore(&data->lock, flags); } static int pca954x_irq_set_type(struct irq_data *idata, unsigned int type) { - if ((type & IRQ_TYPE_SENSE_MASK) != IRQ_TYPE_LEVEL_LOW) - return -EINVAL; - return 0; + if ((type & IRQ_TYPE_SENSE_MASK) != IRQ_TYPE_LEVEL_LOW) + return -EINVAL; + return 0; } static struct irq_chip pca954x_irq_chip = { - .name = "i2c-mux-pca954x", - .irq_mask = pca954x_irq_mask, - .irq_unmask = pca954x_irq_unmask, - .irq_set_type = pca954x_irq_set_type, + .name = "i2c-mux-pca954x", + .irq_mask = pca954x_irq_mask, + .irq_unmask = pca954x_irq_unmask, + .irq_set_type = pca954x_irq_set_type, }; static int pca954x_irq_setup(struct i2c_mux_core *muxc) { - struct pca954x *data = i2c_mux_priv(muxc); - struct i2c_client *client = data->client; - int c, err, irq; - - if (!data->chip->has_irq || client->irq <= 0) - return 0; - - raw_spin_lock_init(&data->lock); - - data->irq = irq_domain_add_linear(client->dev.of_node, - data->chip->nchans, - &irq_domain_simple_ops, data); - if (!data->irq) - return -ENODEV; - - for (c = 0; c < data->chip->nchans; c++) { - irq = irq_create_mapping(data->irq, c); - irq_set_chip_data(irq, data); - irq_set_chip_and_handler(irq, &pca954x_irq_chip, - handle_simple_irq); - } - - err = devm_request_threaded_irq(&client->dev, data->client->irq, NULL, - pca954x_irq_handler, - IRQF_ONESHOT | IRQF_SHARED, - "pca954x", data); - if (err) - goto err_req_irq; - - disable_irq(data->client->irq); - - return 0; + struct pca954x *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + int c, err, irq; + + if (!data->chip->has_irq || client->irq <= 0) + return 0; + + raw_spin_lock_init(&data->lock); + + data->irq = irq_domain_add_linear(client->dev.of_node, + data->chip->nchans, + &irq_domain_simple_ops, data); + if (!data->irq) + return -ENODEV; + + for (c = 0; c < data->chip->nchans; c++) { + irq = irq_create_mapping(data->irq, c); + irq_set_chip_data(irq, data); + irq_set_chip_and_handler(irq, &pca954x_irq_chip, + handle_simple_irq); + } + + err = devm_request_threaded_irq(&client->dev, data->client->irq, NULL, + pca954x_irq_handler, + IRQF_ONESHOT | IRQF_SHARED, + "pca954x", data); + if (err) + goto err_req_irq; + + disable_irq(data->client->irq); + + return 0; err_req_irq: - for (c = 0; c < data->chip->nchans; c++) { - irq = irq_find_mapping(data->irq, c); - irq_dispose_mapping(irq); - } - irq_domain_remove(data->irq); + for (c = 0; c < data->chip->nchans; c++) { + irq = irq_find_mapping(data->irq, c); + irq_dispose_mapping(irq); + } + irq_domain_remove(data->irq); - return err; + return err; } /* * I2C init/probing/exit functions */ static int pca954x_probe(struct i2c_client *client, - const struct i2c_device_id *id) + const struct i2c_device_id *id) { - struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); - struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev); - struct device_node *of_node = client->dev.of_node; - bool idle_disconnect_dt; - struct gpio_desc *gpio; - int num, force, class; - struct i2c_mux_core *muxc; - struct pca954x *data; - const struct of_device_id *match; - int ret; - - - if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE)) - return -ENODEV; - - muxc = i2c_mux_alloc(adap, &client->dev, - PCA954X_MAX_NCHANS, sizeof(*data), 0, - pca954x_select_chan, pca954x_deselect_mux); - if (!muxc) - return -ENOMEM; - data = i2c_mux_priv(muxc); - - i2c_set_clientdata(client, muxc); - data->client = client; - - /* Get the mux out of reset if a reset GPIO is specified. */ - gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW); - if (IS_ERR(gpio)) - return PTR_ERR(gpio); - - /* Write the mux register at addr to verify - * that the mux is in fact present. This also - * initializes the mux to disconnected state. - */ - if ((i2c_smbus_write_byte(client, 0) < 0) && (force_create_bus == 0)) { - dev_warn(&client->dev, "probe failed\n"); - return -ENODEV; - } - - match = of_match_device(of_match_ptr(pca954x_of_match), &client->dev); - if (match) - data->chip = of_device_get_match_data(&client->dev); - else - data->chip = &chips[id->driver_data]; - - data->last_chan = 0; /* force the first selection */ - - idle_disconnect_dt = of_node && - of_property_read_bool(of_node, "i2c-mux-idle-disconnect"); - - ret = pca954x_irq_setup(muxc); - if (ret) - goto fail_del_adapters; - - /* Now create an adapter for each channel */ - for (num = 0; num < data->chip->nchans; num++) { - bool idle_disconnect_pd = false; - - force = 0; /* dynamic adap number */ - class = 0; /* no class by default */ - if (pdata) { - if (num < pdata->num_modes) { - /* force static number */ - force = pdata->modes[num].adap_id; - class = pdata->modes[num].class; - } else - /* discard unconfigured channels */ - break; - idle_disconnect_pd = pdata->modes[num].deselect_on_exit; - } - data->deselect |= (idle_disconnect_pd || - idle_disconnect_dt) << num; - - ret = i2c_mux_add_adapter(muxc, force, num, class); - if (ret) - goto fail_del_adapters; - } - - dev_info(&client->dev, - "registered %d multiplexed busses for I2C %s %s\n", - num, data->chip->muxtype == pca954x_ismux - ? "mux" : "switch", client->name); - - return 0; + struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); + struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev); + struct device_node *of_node = client->dev.of_node; + bool idle_disconnect_dt; + struct gpio_desc *gpio; + int num, force, class; + struct i2c_mux_core *muxc; + struct pca954x *data; + const struct of_device_id *match; + int ret; + + + if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE)) + return -ENODEV; + + muxc = i2c_mux_alloc(adap, &client->dev, + PCA954X_MAX_NCHANS, sizeof(*data), 0, + pca954x_select_chan, pca954x_deselect_mux); + if (!muxc) + return -ENOMEM; + data = i2c_mux_priv(muxc); + + i2c_set_clientdata(client, muxc); + data->client = client; + + /* Get the mux out of reset if a reset GPIO is specified. */ + gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW); + if (IS_ERR(gpio)) + return PTR_ERR(gpio); + + /* Write the mux register at addr to verify + * that the mux is in fact present. This also + * initializes the mux to disconnected state. + */ + if ((i2c_smbus_write_byte(client, 0) < 0) && (force_create_bus == 0)) { + dev_warn(&client->dev, "probe failed\n"); + return -ENODEV; + } + + match = of_match_device(of_match_ptr(pca954x_of_match), &client->dev); + if (match) + data->chip = of_device_get_match_data(&client->dev); + else + data->chip = &chips[id->driver_data]; + + data->last_chan = 0; /* force the first selection */ + + idle_disconnect_dt = of_node && + of_property_read_bool(of_node, "i2c-mux-idle-disconnect"); + + ret = pca954x_irq_setup(muxc); + if (ret) + goto fail_del_adapters; + + /* Now create an adapter for each channel */ + for (num = 0; num < data->chip->nchans; num++) { + bool idle_disconnect_pd = false; + + force = 0; /* dynamic adap number */ + class = 0; /* no class by default */ + if (pdata) { + if (num < pdata->num_modes) { + /* force static number */ + force = pdata->modes[num].adap_id; + class = pdata->modes[num].class; + } else + /* discard unconfigured channels */ + break; + idle_disconnect_pd = pdata->modes[num].deselect_on_exit; + } + data->deselect |= (idle_disconnect_pd || + idle_disconnect_dt) << num; + + ret = i2c_mux_add_adapter(muxc, force, num, class); + if (ret) + goto fail_del_adapters; + } + + dev_info(&client->dev, + "registered %d multiplexed busses for I2C %s %s\n", + num, data->chip->muxtype == pca954x_ismux + ? "mux" : "switch", client->name); + + return 0; fail_del_adapters: - i2c_mux_del_adapters(muxc); - return ret; + i2c_mux_del_adapters(muxc); + return ret; } static int pca954x_remove(struct i2c_client *client) { - struct i2c_mux_core *muxc = i2c_get_clientdata(client); - struct pca954x *data = i2c_mux_priv(muxc); - int c, irq; - - if (data->irq) { - for (c = 0; c < data->chip->nchans; c++) { - irq = irq_find_mapping(data->irq, c); - irq_dispose_mapping(irq); - } - irq_domain_remove(data->irq); - } - - i2c_mux_del_adapters(muxc); - return 0; + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct pca954x *data = i2c_mux_priv(muxc); + int c, irq; + + if (data->irq) { + for (c = 0; c < data->chip->nchans; c++) { + irq = irq_find_mapping(data->irq, c); + irq_dispose_mapping(irq); + } + irq_domain_remove(data->irq); + } + + i2c_mux_del_adapters(muxc); + return 0; } #ifdef CONFIG_PM_SLEEP static int pca954x_resume(struct device *dev) { - struct i2c_client *client = to_i2c_client(dev); - struct i2c_mux_core *muxc = i2c_get_clientdata(client); - struct pca954x *data = i2c_mux_priv(muxc); + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct pca954x *data = i2c_mux_priv(muxc); - data->last_chan = 0; - return i2c_smbus_write_byte(client, 0); + data->last_chan = 0; + return i2c_smbus_write_byte(client, 0); } #endif static SIMPLE_DEV_PM_OPS(pca954x_pm, NULL, pca954x_resume); static struct i2c_driver pca954x_driver = { - .driver = { - .name = "pca954x", - .pm = &pca954x_pm, - .of_match_table = of_match_ptr(pca954x_of_match), - }, - .probe = pca954x_probe, - .remove = pca954x_remove, - .id_table = pca954x_id, + .driver = { + .name = "pca954x", + .pm = &pca954x_pm, + .of_match_table = of_match_ptr(pca954x_of_match), + }, + .probe = pca954x_probe, + .remove = pca954x_remove, + .id_table = pca954x_id, }; module_i2c_driver(pca954x_driver); diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/i2c-mux-pca9641.c b/platform/broadcom/sonic-platform-modules-ragile/common/modules/i2c-mux-pca9641.c index 02759ef062d9..501cfef8a91b 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/modules/i2c-mux-pca9641.c +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/i2c-mux-pca9641.c @@ -40,22 +40,22 @@ * that only one of the masters is instantiated at any given time. */ -#define PCA9541_CONTROL 0x01 -#define PCA9541_ISTAT 0x02 - -#define PCA9541_CTL_MYBUS (1 << 0) -#define PCA9541_CTL_NMYBUS (1 << 1) -#define PCA9541_CTL_BUSON (1 << 2) -#define PCA9541_CTL_NBUSON (1 << 3) -#define PCA9541_CTL_BUSINIT (1 << 4) -#define PCA9541_CTL_TESTON (1 << 6) -#define PCA9541_CTL_NTESTON (1 << 7) -#define PCA9541_ISTAT_INTIN (1 << 0) -#define PCA9541_ISTAT_BUSINIT (1 << 1) -#define PCA9541_ISTAT_BUSOK (1 << 2) -#define PCA9541_ISTAT_BUSLOST (1 << 3) -#define PCA9541_ISTAT_MYTEST (1 << 6) -#define PCA9541_ISTAT_NMYTEST (1 << 7) +#define PCA9541_CONTROL 0x01 +#define PCA9541_ISTAT 0x02 + +#define PCA9541_CTL_MYBUS (1 << 0) +#define PCA9541_CTL_NMYBUS (1 << 1) +#define PCA9541_CTL_BUSON (1 << 2) +#define PCA9541_CTL_NBUSON (1 << 3) +#define PCA9541_CTL_BUSINIT (1 << 4) +#define PCA9541_CTL_TESTON (1 << 6) +#define PCA9541_CTL_NTESTON (1 << 7) +#define PCA9541_ISTAT_INTIN (1 << 0) +#define PCA9541_ISTAT_BUSINIT (1 << 1) +#define PCA9541_ISTAT_BUSOK (1 << 2) +#define PCA9541_ISTAT_BUSLOST (1 << 3) +#define PCA9541_ISTAT_MYTEST (1 << 6) +#define PCA9541_ISTAT_NMYTEST (1 << 7) #define PCA9641_ID 0x00 #define PCA9641_ID_MAGIC 0x38 #define PCA9641_CONTROL 0x01 @@ -78,12 +78,12 @@ #define PCA9641_STS_SCL_IO BIT(6) #define PCA9641_STS_SDA_IO BIT(7) #define PCA9641_RES_TIME 0x03 -#define BUSON (PCA9541_CTL_BUSON | PCA9541_CTL_NBUSON) -#define MYBUS (PCA9541_CTL_MYBUS | PCA9541_CTL_NMYBUS) -#define mybus(x) (!((x) & MYBUS) || ((x) & MYBUS) == MYBUS) -#define busoff(x) (!((x) & BUSON) || ((x) & BUSON) == BUSON) +#define BUSON (PCA9541_CTL_BUSON | PCA9541_CTL_NBUSON) +#define MYBUS (PCA9541_CTL_MYBUS | PCA9541_CTL_NMYBUS) +#define mybus(x) (!((x) & MYBUS) || ((x) & MYBUS) == MYBUS) +#define busoff(x) (!((x) & BUSON) || ((x) & BUSON) == BUSON) #define BUSOFF(x, y) (!((x) & PCA9641_CTL_LOCK_GRANT) && \ - !((y) & PCA9641_STS_OTHER_LOCK)) + !((y) & PCA9641_STS_OTHER_LOCK)) #define other_lock(x) ((x) & PCA9641_STS_OTHER_LOCK) #define lock_grant(x) ((x) & PCA9641_CTL_LOCK_GRANT) @@ -91,22 +91,22 @@ typedef struct i2c_muxs_struct_flag { - int nr; - char name[48]; - struct mutex update_lock; - int flag; + int nr; + char name[48]; + struct mutex update_lock; + int flag; }i2c_mux_flag; i2c_mux_flag pca_flag = { - .flag = -1, + .flag = -1, }; int pca9641_setmuxflag(int nr, int flag) { - if (pca_flag.nr == nr) { - pca_flag.flag = flag; - } - return 0; + if (pca_flag.nr == nr) { + pca_flag.flag = flag; + } + return 0; } EXPORT_SYMBOL(pca9641_setmuxflag); @@ -121,23 +121,23 @@ module_param(g_debug, int, S_IRUGO | S_IWUSR); /* arbitration timeouts, in jiffies */ -#define ARB_TIMEOUT (HZ / 8) /* 125 ms until forcing bus ownership */ -#define ARB2_TIMEOUT (HZ / 4) /* 250 ms until acquisition failure */ +#define ARB_TIMEOUT (HZ / 8) /* 125 ms until forcing bus ownership */ +#define ARB2_TIMEOUT (HZ / 4) /* 250 ms until acquisition failure */ /* arbitration retry delays, in us */ -#define SELECT_DELAY_SHORT 50 -#define SELECT_DELAY_LONG 1000 +#define SELECT_DELAY_SHORT 50 +#define SELECT_DELAY_LONG 1000 struct pca9541 { - struct i2c_client *client; - unsigned long select_timeout; - unsigned long arb_timeout; + struct i2c_client *client; + unsigned long select_timeout; + unsigned long arb_timeout; }; static const struct i2c_device_id pca9541_id[] = { - {"pca9541", 0}, - {"pca9641", 1}, - {} + {"pca9541", 0}, + {"pca9641", 1}, + {} }; MODULE_DEVICE_TABLE(i2c, pca9541_id); @@ -158,32 +158,32 @@ MODULE_DEVICE_TABLE(of, pca9541_of_match); */ static int pca9541_reg_write(struct i2c_client *client, u8 command, u8 val) { - struct i2c_adapter *adap = client->adapter; - int ret; - - if (adap->algo->master_xfer) { - struct i2c_msg msg; - char buf[2]; - - msg.addr = client->addr; - msg.flags = 0; - msg.len = 2; - buf[0] = command; - buf[1] = val; - msg.buf = buf; - ret = __i2c_transfer(adap, &msg, 1); - } else { - union i2c_smbus_data data; - - data.byte = val; - ret = adap->algo->smbus_xfer(adap, client->addr, - client->flags, - I2C_SMBUS_WRITE, - command, - I2C_SMBUS_BYTE_DATA, &data); - } - - return ret; + struct i2c_adapter *adap = client->adapter; + int ret; + + if (adap->algo->master_xfer) { + struct i2c_msg msg; + char buf[2]; + + msg.addr = client->addr; + msg.flags = 0; + msg.len = 2; + buf[0] = command; + buf[1] = val; + msg.buf = buf; + ret = __i2c_transfer(adap, &msg, 1); + } else { + union i2c_smbus_data data; + + data.byte = val; + ret = adap->algo->smbus_xfer(adap, client->addr, + client->flags, + I2C_SMBUS_WRITE, + command, + I2C_SMBUS_BYTE_DATA, &data); + } + + return ret; } /* @@ -192,42 +192,42 @@ static int pca9541_reg_write(struct i2c_client *client, u8 command, u8 val) */ static int pca9541_reg_read(struct i2c_client *client, u8 command) { - struct i2c_adapter *adap = client->adapter; - int ret; - u8 val; - - if (adap->algo->master_xfer) { - struct i2c_msg msg[2] = { - { - .addr = client->addr, - .flags = 0, - .len = 1, - .buf = &command - }, - { - .addr = client->addr, - .flags = I2C_M_RD, - .len = 1, - .buf = &val - } - }; - ret = __i2c_transfer(adap, msg, 2); - if (ret == 2) - ret = val; - else if (ret >= 0) - ret = -EIO; - } else { - union i2c_smbus_data data; - - ret = adap->algo->smbus_xfer(adap, client->addr, - client->flags, - I2C_SMBUS_READ, - command, - I2C_SMBUS_BYTE_DATA, &data); - if (!ret) - ret = data.byte; - } - return ret; + struct i2c_adapter *adap = client->adapter; + int ret; + u8 val; + + if (adap->algo->master_xfer) { + struct i2c_msg msg[2] = { + { + .addr = client->addr, + .flags = 0, + .len = 1, + .buf = &command + }, + { + .addr = client->addr, + .flags = I2C_M_RD, + .len = 1, + .buf = &val + } + }; + ret = __i2c_transfer(adap, msg, 2); + if (ret == 2) + ret = val; + else if (ret >= 0) + ret = -EIO; + } else { + union i2c_smbus_data data; + + ret = adap->algo->smbus_xfer(adap, client->addr, + client->flags, + I2C_SMBUS_READ, + command, + I2C_SMBUS_BYTE_DATA, &data); + if (!ret) + ret = data.byte; + } + return ret; } /* @@ -237,12 +237,12 @@ static int pca9541_reg_read(struct i2c_client *client, u8 command) /* Release bus. Also reset NTESTON and BUSINIT if it was set. */ static void pca9541_release_bus(struct i2c_client *client) { - int reg; + int reg; - reg = pca9541_reg_read(client, PCA9541_CONTROL); - if (reg >= 0 && !busoff(reg) && mybus(reg)) - pca9541_reg_write(client, PCA9541_CONTROL, - (reg & PCA9541_CTL_NBUSON) >> 1); + reg = pca9541_reg_read(client, PCA9541_CONTROL); + if (reg >= 0 && !busoff(reg) && mybus(reg)) + pca9541_reg_write(client, PCA9541_CONTROL, + (reg & PCA9541_CTL_NBUSON) >> 1); } /* @@ -251,16 +251,16 @@ static void pca9541_release_bus(struct i2c_client *client) * This multi-step process ensures that access contention is resolved * gracefully. * - * Bus Ownership Other master Action - * state requested access + * Bus Ownership Other master Action + * state requested access * ---------------------------------------------------- - * off - yes wait for arbitration timeout or - * for other master to drop request - * off no no take ownership - * off yes no turn on bus - * on yes - done - * on no - wait for arbitration timeout or - * for other master to release bus + * off - yes wait for arbitration timeout or + * for other master to drop request + * off no no take ownership + * off yes no turn on bus + * on yes - done + * on no - wait for arbitration timeout or + * for other master to release bus * * The main contention point occurs if the slave bus is off and both masters * request ownership at the same time. In this case, one master will turn on @@ -271,7 +271,7 @@ static void pca9541_release_bus(struct i2c_client *client) /* Control commands per PCA9541 datasheet */ static const u8 pca9541_control[16] = { - 4, 0, 1, 5, 4, 4, 5, 5, 0, 0, 1, 1, 0, 4, 5, 1 + 4, 0, 1, 5, 4, 4, 5, 5, 0, 0, 1, 1, 0, 4, 5, 1 }; /* @@ -284,187 +284,187 @@ static const u8 pca9541_control[16] = { */ static int pca9541_arbitrate(struct i2c_client *client) { - struct i2c_mux_core *muxc = i2c_get_clientdata(client); - struct pca9541 *data = i2c_mux_priv(muxc); - int reg; - - reg = pca9541_reg_read(client, PCA9541_CONTROL); - if (reg < 0) - return reg; - - if (busoff(reg)) { - int istat; - /* - * Bus is off. Request ownership or turn it on unless - * other master requested ownership. - */ - istat = pca9541_reg_read(client, PCA9541_ISTAT); - if (!(istat & PCA9541_ISTAT_NMYTEST) - || time_is_before_eq_jiffies(data->arb_timeout)) { - /* - * Other master did not request ownership, - * or arbitration timeout expired. Take the bus. - */ - pca9541_reg_write(client, - PCA9541_CONTROL, - pca9541_control[reg & 0x0f] - | PCA9541_CTL_NTESTON); - data->select_timeout = SELECT_DELAY_SHORT; - } else { - /* - * Other master requested ownership. - * Set extra long timeout to give it time to acquire it. - */ - data->select_timeout = SELECT_DELAY_LONG * 2; - } - } else if (mybus(reg)) { - /* - * Bus is on, and we own it. We are done with acquisition. - * Reset NTESTON and BUSINIT, then return success. - */ - if (reg & (PCA9541_CTL_NTESTON | PCA9541_CTL_BUSINIT)) - pca9541_reg_write(client, - PCA9541_CONTROL, - reg & ~(PCA9541_CTL_NTESTON - | PCA9541_CTL_BUSINIT)); - return 1; - } else { - /* - * Other master owns the bus. - * If arbitration timeout has expired, force ownership. - * Otherwise request it. - */ - data->select_timeout = SELECT_DELAY_LONG; - if (time_is_before_eq_jiffies(data->arb_timeout)) { - /* Time is up, take the bus and reset it. */ - pca9541_reg_write(client, - PCA9541_CONTROL, - pca9541_control[reg & 0x0f] - | PCA9541_CTL_BUSINIT - | PCA9541_CTL_NTESTON); - } else { - /* Request bus ownership if needed */ - if (!(reg & PCA9541_CTL_NTESTON)) - pca9541_reg_write(client, - PCA9541_CONTROL, - reg | PCA9541_CTL_NTESTON); - } - } - return 0; + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct pca9541 *data = i2c_mux_priv(muxc); + int reg; + + reg = pca9541_reg_read(client, PCA9541_CONTROL); + if (reg < 0) + return reg; + + if (busoff(reg)) { + int istat; + /* + * Bus is off. Request ownership or turn it on unless + * other master requested ownership. + */ + istat = pca9541_reg_read(client, PCA9541_ISTAT); + if (!(istat & PCA9541_ISTAT_NMYTEST) + || time_is_before_eq_jiffies(data->arb_timeout)) { + /* + * Other master did not request ownership, + * or arbitration timeout expired. Take the bus. + */ + pca9541_reg_write(client, + PCA9541_CONTROL, + pca9541_control[reg & 0x0f] + | PCA9541_CTL_NTESTON); + data->select_timeout = SELECT_DELAY_SHORT; + } else { + /* + * Other master requested ownership. + * Set extra long timeout to give it time to acquire it. + */ + data->select_timeout = SELECT_DELAY_LONG * 2; + } + } else if (mybus(reg)) { + /* + * Bus is on, and we own it. We are done with acquisition. + * Reset NTESTON and BUSINIT, then return success. + */ + if (reg & (PCA9541_CTL_NTESTON | PCA9541_CTL_BUSINIT)) + pca9541_reg_write(client, + PCA9541_CONTROL, + reg & ~(PCA9541_CTL_NTESTON + | PCA9541_CTL_BUSINIT)); + return 1; + } else { + /* + * Other master owns the bus. + * If arbitration timeout has expired, force ownership. + * Otherwise request it. + */ + data->select_timeout = SELECT_DELAY_LONG; + if (time_is_before_eq_jiffies(data->arb_timeout)) { + /* Time is up, take the bus and reset it. */ + pca9541_reg_write(client, + PCA9541_CONTROL, + pca9541_control[reg & 0x0f] + | PCA9541_CTL_BUSINIT + | PCA9541_CTL_NTESTON); + } else { + /* Request bus ownership if needed */ + if (!(reg & PCA9541_CTL_NTESTON)) + pca9541_reg_write(client, + PCA9541_CONTROL, + reg | PCA9541_CTL_NTESTON); + } + } + return 0; } static int pca9541_select_chan(struct i2c_mux_core *muxc, u32 chan) { - struct pca9541 *data = i2c_mux_priv(muxc); - struct i2c_client *client = data->client; - int ret; - unsigned long timeout = jiffies + ARB2_TIMEOUT; - /* give up after this time */ - - data->arb_timeout = jiffies + ARB_TIMEOUT; - /* force bus ownership after this time */ - - do { - ret = pca9541_arbitrate(client); - if (ret) - return ret < 0 ? ret : 0; - - if (data->select_timeout == SELECT_DELAY_SHORT) - udelay(data->select_timeout); - else - msleep(data->select_timeout / 1000); - } while (time_is_after_eq_jiffies(timeout)); - - return -ETIMEDOUT; + struct pca9541 *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + int ret; + unsigned long timeout = jiffies + ARB2_TIMEOUT; + /* give up after this time */ + + data->arb_timeout = jiffies + ARB_TIMEOUT; + /* force bus ownership after this time */ + + do { + ret = pca9541_arbitrate(client); + if (ret) + return ret < 0 ? ret : 0; + + if (data->select_timeout == SELECT_DELAY_SHORT) + udelay(data->select_timeout); + else + msleep(data->select_timeout / 1000); + } while (time_is_after_eq_jiffies(timeout)); + + return -ETIMEDOUT; } static int pca9541_release_chan(struct i2c_mux_core *muxc, u32 chan) { struct pca9541 *data = i2c_mux_priv(muxc); - struct i2c_client *client = data->client; - pca9541_release_bus(client); - return 0; + struct i2c_client *client = data->client; + pca9541_release_bus(client); + return 0; } /* -* Arbitration management functions -*/ + * Arbitration management functions + */ static void pca9641_release_bus(struct i2c_client *client) { - pca9541_reg_write(client, PCA9641_CONTROL, 0x80); //master 0x80 + pca9541_reg_write(client, PCA9641_CONTROL, 0x80); //master 0x80 } /* -* Channel arbitration -* -* Return values: -* <0: error -* 0 : bus not acquired -* 1 : bus acquired -*/ + * Channel arbitration + * + * Return values: + * <0: error + * 0 : bus not acquired + * 1 : bus acquired + */ static int pca9641_arbitrate(struct i2c_client *client) { - struct i2c_mux_core *muxc = i2c_get_clientdata(client); - struct pca9541 *data = i2c_mux_priv(muxc); - int reg_ctl, reg_sts; - - reg_ctl = pca9541_reg_read(client, PCA9641_CONTROL); - if (reg_ctl < 0) - return reg_ctl; - reg_sts = pca9541_reg_read(client, PCA9641_STATUS); - - if (BUSOFF(reg_ctl, reg_sts)) { - /* - * Bus is off. Request ownership or turn it on unless - * other master requested ownership. - */ - reg_ctl |= PCA9641_CTL_LOCK_REQ; - pca9541_reg_write(client, PCA9641_CONTROL, reg_ctl); - reg_ctl = pca9541_reg_read(client, PCA9641_CONTROL); - - if (lock_grant(reg_ctl)) { - /* - * Other master did not request ownership, - * or arbitration timeout expired. Take the bus. - */ - reg_ctl |= PCA9641_CTL_BUS_CONNECT - | PCA9641_CTL_LOCK_REQ; - pca9541_reg_write(client, PCA9641_CONTROL, reg_ctl); - data->select_timeout = SELECT_DELAY_SHORT; - - return 1; - } else { - /* - * Other master requested ownership. - * Set extra long timeout to give it time to acquire it. - */ - data->select_timeout = SELECT_DELAY_LONG * 2; - } - } else if (lock_grant(reg_ctl)) { - /* - * Bus is on, and we own it. We are done with acquisition. - */ - reg_ctl |= PCA9641_CTL_BUS_CONNECT | PCA9641_CTL_LOCK_REQ; - pca9541_reg_write(client, PCA9641_CONTROL, reg_ctl); - - return 1; - } else if (other_lock(reg_sts)) { - /* - * Other master owns the bus. - * If arbitration timeout has expired, force ownership. - * Otherwise request it. - */ - data->select_timeout = SELECT_DELAY_LONG; - reg_ctl |= PCA9641_CTL_LOCK_REQ; - pca9541_reg_write(client, PCA9641_CONTROL, reg_ctl); - } - return 0; + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct pca9541 *data = i2c_mux_priv(muxc); + int reg_ctl, reg_sts; + + reg_ctl = pca9541_reg_read(client, PCA9641_CONTROL); + if (reg_ctl < 0) + return reg_ctl; + reg_sts = pca9541_reg_read(client, PCA9641_STATUS); + + if (BUSOFF(reg_ctl, reg_sts)) { + /* + * Bus is off. Request ownership or turn it on unless + * other master requested ownership. + */ + reg_ctl |= PCA9641_CTL_LOCK_REQ; + pca9541_reg_write(client, PCA9641_CONTROL, reg_ctl); + reg_ctl = pca9541_reg_read(client, PCA9641_CONTROL); + + if (lock_grant(reg_ctl)) { + /* + * Other master did not request ownership, + * or arbitration timeout expired. Take the bus. + */ + reg_ctl |= PCA9641_CTL_BUS_CONNECT + | PCA9641_CTL_LOCK_REQ; + pca9541_reg_write(client, PCA9641_CONTROL, reg_ctl); + data->select_timeout = SELECT_DELAY_SHORT; + + return 1; + } else { + /* + * Other master requested ownership. + * Set extra long timeout to give it time to acquire it. + */ + data->select_timeout = SELECT_DELAY_LONG * 2; + } + } else if (lock_grant(reg_ctl)) { + /* + * Bus is on, and we own it. We are done with acquisition. + */ + reg_ctl |= PCA9641_CTL_BUS_CONNECT | PCA9641_CTL_LOCK_REQ; + pca9541_reg_write(client, PCA9641_CONTROL, reg_ctl); + + return 1; + } else if (other_lock(reg_sts)) { + /* + * Other master owns the bus. + * If arbitration timeout has expired, force ownership. + * Otherwise request it. + */ + data->select_timeout = SELECT_DELAY_LONG; + reg_ctl |= PCA9641_CTL_LOCK_REQ; + pca9541_reg_write(client, PCA9641_CONTROL, reg_ctl); + } + return 0; } int pca9641_select_chan(struct i2c_mux_core *muxc, u32 chan) { - struct pca9541 *data = i2c_mux_priv(muxc); + struct pca9541 *data = i2c_mux_priv(muxc); struct i2c_client *client = data->client; int ret; int result; @@ -472,42 +472,42 @@ int pca9641_select_chan(struct i2c_mux_core *muxc, u32 chan) /* give up after this time */ data->arb_timeout = jiffies + ARB_TIMEOUT; /* force bus ownership after this time */ - for (result = 0 ; result < PCA9641_RETRY_TIME ; result ++) { - do { - ret = pca9641_arbitrate(client); - if (ret == 1) { - return 0; - } - if (data->select_timeout == SELECT_DELAY_SHORT) - udelay(data->select_timeout); - else - msleep(data->select_timeout / 1000); - } while (time_is_after_eq_jiffies(timeout)); - timeout = jiffies + ARB2_TIMEOUT; - } + for (result = 0 ; result < PCA9641_RETRY_TIME ; result ++) { + do { + ret = pca9641_arbitrate(client); + if (ret == 1) { + return 0; + } + if (data->select_timeout == SELECT_DELAY_SHORT) + udelay(data->select_timeout); + else + msleep(data->select_timeout / 1000); + } while (time_is_after_eq_jiffies(timeout)); + timeout = jiffies + ARB2_TIMEOUT; + } return -ETIMEDOUT; } EXPORT_SYMBOL(pca9641_select_chan); static int pca9641_release_chan(struct i2c_mux_core *muxc, u32 chan) { - struct pca9541 *data = i2c_mux_priv(muxc); - struct i2c_client *client = data->client; - if (pca_flag.flag) { - pca9641_release_bus(client); - } - return 0; + struct pca9541 *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + if (pca_flag.flag) { + pca9641_release_bus(client); + } + return 0; } static int pca9641_detect_id(struct i2c_client *client) { - int reg; + int reg; - reg = pca9541_reg_read(client, PCA9641_ID); - if (reg == PCA9641_ID_MAGIC) - return 1; - else - return 0; + reg = pca9541_reg_read(client, PCA9641_ID); + if (reg == PCA9641_ID_MAGIC) + return 1; + else + return 0; } @@ -517,51 +517,51 @@ static int pca9641_recordflag(struct i2c_adapter *adap) { return -1 ; } pca_flag.nr = adap->nr; - PCA_DEBUG(" adap->nr:%d\n", adap->nr); - snprintf(pca_flag.name, sizeof(pca_flag.name),adap->name); + PCA_DEBUG(" adap->nr:%d\n", adap->nr); + snprintf(pca_flag.name, sizeof(pca_flag.name),adap->name); return 0; } static void i2c_lock_adapter(struct i2c_adapter *adapter){ - struct i2c_adapter *parent = i2c_parent_is_i2c_adapter(adapter); - if (parent) - i2c_lock_adapter(parent); - else - rt_mutex_lock(&adapter->bus_lock); + struct i2c_adapter *parent = i2c_parent_is_i2c_adapter(adapter); + if (parent) + i2c_lock_adapter(parent); + else + rt_mutex_lock(&adapter->bus_lock); } void i2c_unlock_adapter(struct i2c_adapter *adapter) { - struct i2c_adapter *parent = i2c_parent_is_i2c_adapter(adapter); + struct i2c_adapter *parent = i2c_parent_is_i2c_adapter(adapter); - if (parent) - i2c_unlock_adapter(parent); - else - rt_mutex_unlock(&adapter->bus_lock); + if (parent) + i2c_unlock_adapter(parent); + else + rt_mutex_unlock(&adapter->bus_lock); } /* * I2C init/probing/exit functions */ static int pca9541_probe(struct i2c_client *client, - const struct i2c_device_id *id) + const struct i2c_device_id *id) { - struct i2c_adapter *adap = client->adapter; - struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev); + struct i2c_adapter *adap = client->adapter; + struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev); struct i2c_mux_core *muxc; - struct pca9541 *data; - int force; - int ret = -ENODEV; + struct pca9541 *data; + int force; + int ret = -ENODEV; int detect_id; - if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE_DATA)) - return -ENODEV; + if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE_DATA)) + return -ENODEV; detect_id = pca9641_detect_id(client); - /* - * I2C accesses are unprotected here. - * We have to lock the adapter before releasing the bus. - */ + /* + * I2C accesses are unprotected here. + * We have to lock the adapter before releasing the bus. + */ if (detect_id == 0) { i2c_lock_adapter(adap); pca9541_release_bus(client); @@ -572,68 +572,68 @@ static int pca9541_probe(struct i2c_client *client, i2c_unlock_adapter(adap); } - /* Create mux adapter */ + /* Create mux adapter */ - force = 0; - if (pdata) - force = pdata->modes[0].adap_id; + force = 0; + if (pdata) + force = pdata->modes[0].adap_id; if (detect_id == 0) { muxc = i2c_mux_alloc(adap, &client->dev, 1, sizeof(*data), - I2C_MUX_ARBITRATOR, - pca9541_select_chan, pca9541_release_chan); - if (!muxc) - return -ENOMEM; + I2C_MUX_ARBITRATOR, + pca9541_select_chan, pca9541_release_chan); + if (!muxc) + return -ENOMEM; - data = i2c_mux_priv(muxc); - data->client = client; + data = i2c_mux_priv(muxc); + data->client = client; - i2c_set_clientdata(client, muxc); + i2c_set_clientdata(client, muxc); - ret = i2c_mux_add_adapter(muxc, force, 0, 0); - if (ret) - return ret; + ret = i2c_mux_add_adapter(muxc, force, 0, 0); + if (ret) + return ret; } else { - muxc = i2c_mux_alloc(adap, &client->dev, 1, sizeof(*data), - I2C_MUX_ARBITRATOR, - pca9641_select_chan, pca9641_release_chan); - if (!muxc) - return -ENOMEM; + muxc = i2c_mux_alloc(adap, &client->dev, 1, sizeof(*data), + I2C_MUX_ARBITRATOR, + pca9641_select_chan, pca9641_release_chan); + if (!muxc) + return -ENOMEM; - data = i2c_mux_priv(muxc); - data->client = client; + data = i2c_mux_priv(muxc); + data->client = client; - i2c_set_clientdata(client, muxc); + i2c_set_clientdata(client, muxc); - ret = i2c_mux_add_adapter(muxc, force, 0, 0); - if (ret) - return ret; + ret = i2c_mux_add_adapter(muxc, force, 0, 0); + if (ret) + return ret; } - pca9641_recordflag(muxc->adapter[0]); + pca9641_recordflag(muxc->adapter[0]); - dev_info(&client->dev, "registered master selector for I2C %s\n", - client->name); + dev_info(&client->dev, "registered master selector for I2C %s\n", + client->name); - return 0; + return 0; } static int pca9541_remove(struct i2c_client *client) { - struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); - i2c_mux_del_adapters(muxc); - return 0; + i2c_mux_del_adapters(muxc); + return 0; } static struct i2c_driver pca9641_driver = { - .driver = { - .name = "pca9641", - .of_match_table = of_match_ptr(pca9541_of_match), - }, - .probe = pca9541_probe, - .remove = pca9541_remove, - .id_table = pca9541_id, + .driver = { + .name = "pca9641", + .of_match_table = of_match_ptr(pca9541_of_match), + }, + .probe = pca9541_probe, + .remove = pca9541_remove, + .id_table = pca9541_id, }; module_i2c_driver(pca9641_driver); diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/lpc_cpld_i2c_ocores.c b/platform/broadcom/sonic-platform-modules-ragile/common/modules/lpc_cpld_i2c_ocores.c new file mode 100755 index 000000000000..7115fdabec1d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/lpc_cpld_i2c_ocores.c @@ -0,0 +1,837 @@ +/* + * i2c-ocores.c: I2C bus driver for OpenCores I2C controller + * (http://www.opencores.org/projects.cgi/web/i2c/overview). + * + * Peter Korsgaard + * + * Support for the GRLIB port of the controller by + * Andreas Larsson + * + * This file is licensed under the terms of the GNU General Public License + * version 2. This program is licensed "as is" without any warranty of any + * kind, whether express or implied. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define OCORES_FLAG_POLL BIT(0) + +struct ocores_i2c { + void __iomem *base; + u32 reg_shift; + u32 reg_io_width; + unsigned long flags; + wait_queue_head_t wait; + struct i2c_adapter adap; + struct i2c_msg *msg; + int pos; + int nmsgs; + int state; /* see STATE_ */ + spinlock_t process_lock; + int clock_khz; + void (*setreg)(struct ocores_i2c *i2c, int reg, u8 value); + u8 (*getreg)(struct ocores_i2c *i2c, int reg); +}; + +/* registers */ +#define OCI2C_PRELOW 0x0 +#define OCI2C_PREHIGH 0x1 +#define OCI2C_CONTROL 0x2 +#define OCI2C_DATA 0x3 +#define OCI2C_CMD 0x4 /* write only */ +#define OCI2C_STATUS 0x4 /* read only, same address as OCI2C_CMD */ + +#define OCI2C_TRAN_REV 0x14 +#define OCI2C_CMD_REV 0x18 + + +#define OCI2C_CTRL_IEN 0x40 +#define OCI2C_CTRL_EN 0x80 + +#define OCI2C_CMD_START 0x91 +#define OCI2C_CMD_STOP 0x41 +#define OCI2C_CMD_READ 0x21 +#define OCI2C_CMD_WRITE 0x11 +#define OCI2C_CMD_READ_ACK 0x21 +#define OCI2C_CMD_READ_NACK 0x29 +#define OCI2C_CMD_IACK 0x01 + +#define OCI2C_STAT_IF 0x01 +#define OCI2C_STAT_TIP 0x02 +#define OCI2C_STAT_ARBLOST 0x20 +#define OCI2C_STAT_BUSY 0x40 +#define OCI2C_STAT_NACK 0x80 + +#define STATE_DONE 0 +#define STATE_START 1 +#define STATE_WRITE 2 +#define STATE_READ 3 +#define STATE_ERROR 4 + +#define TYPE_OCORES 0 +#define TYPE_GRLIB 1 +#define OCI2C_WAIT_SLEEP 40 + +int g_lpc_cpld_i2c_debug = 0; +int g_lpc_cpld_i2c_irq = 0; +int g_lpc_cpld_i2c_error = 0; + +module_param(g_lpc_cpld_i2c_debug, int, S_IRUGO | S_IWUSR); +module_param(g_lpc_cpld_i2c_error, int, S_IRUGO | S_IWUSR); +module_param(g_lpc_cpld_i2c_irq, int, S_IRUGO | S_IWUSR); + +int g_irq_dump_debug = 0; +module_param(g_irq_dump_debug, int, S_IRUGO | S_IWUSR); +#define LPC_CPLD_I2C_DEBUG_DUMP(fmt, args...) do { \ + if (g_irq_dump_debug) { \ + printk(KERN_ERR ""fmt, ## args); \ + } \ +} while (0) +int g_irq_invalid_cnt = 0; +module_param(g_irq_invalid_cnt, int, S_IRUGO | S_IWUSR); +#define LPC_CPLD_I2C_DEBUG_XFER(fmt, args...) do { \ + if (g_lpc_cpld_i2c_irq) { \ + printk(KERN_ERR "[LPC_CPLD_I2C_OCORES][XFER][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ + } \ +} while (0) + +#define LPC_CPLD_I2C_DEBUG_VERBOSE(fmt, args...) do { \ + if (g_lpc_cpld_i2c_debug) { \ + printk(KERN_ERR "[LPC_CPLD_I2C_OCORES][VER][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ + } \ +} while (0) + +#define LPC_CPLD_I2C_DEBUG_ERROR(fmt, args...) do { \ + if (g_lpc_cpld_i2c_error) { \ + printk(KERN_ERR "[LPC_CPLD_I2C_OCORES][ERR][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ + } \ +} while (0) + +static int g_lpc_cpld_i2c_irq_flag = 1; + +module_param(g_lpc_cpld_i2c_irq_flag, int, S_IRUGO | S_IWUSR); + +static void oc_debug_dump_reg(struct ocores_i2c *i2c); +static void oc_setreg_8(struct ocores_i2c *i2c, int reg, u8 value) +{ + u64 base = (u64)i2c->base; + + outb(value, (u16)base + reg); +} + +static inline u8 oc_getreg_8(struct ocores_i2c *i2c, int reg) +{ + u64 base = (u64)i2c->base; + + return inb((u16)base + reg); +} + +static inline void oc_setreg(struct ocores_i2c *i2c, int reg, u8 value) +{ + i2c->setreg(i2c, reg, value); +} + +static inline u8 oc_getreg(struct ocores_i2c *i2c, int reg) +{ + u8 status; + + status = i2c->getreg(i2c, reg); + return status; +} + +#define LPC_CPLD_I2C_SPIN_LOCK(lock, flags) spin_lock_irqsave(&(lock), (flags)) +#define LPC_CPLD_I2C_SPIN_UNLOCK(lock, flags) spin_unlock_irqrestore(&(lock), (flags)) + +static void ocores_process(struct ocores_i2c *i2c, u8 stat) +{ + struct i2c_msg *msg = i2c->msg; + + LPC_CPLD_I2C_DEBUG_XFER("Enter nr %d.\n", i2c->adap.nr); + + /* + * If we spin here is because we are in timeout, so we are going + * to be in STATE_ERROR. See ocores_process_timeout() + */ + if ((i2c->state == STATE_DONE) || (i2c->state == STATE_ERROR)) { + /* stop has been sent */ + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_IACK); + wake_up(&i2c->wait); + LPC_CPLD_I2C_DEBUG_XFER("stop has been sent, exit.\n"); + goto out; + } + + /* error */ + if (stat & OCI2C_STAT_ARBLOST) { + i2c->state = STATE_ERROR; + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_STOP); + LPC_CPLD_I2C_DEBUG_XFER("error, exit.\n"); + goto out; + } + + if ((i2c->state == STATE_START) || (i2c->state == STATE_WRITE)) { + i2c->state = + (msg->flags & I2C_M_RD) ? STATE_READ : STATE_WRITE; + + if (stat & OCI2C_STAT_NACK) { + i2c->state = STATE_ERROR; + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_STOP); + LPC_CPLD_I2C_DEBUG_XFER("OCI2C_STAT_NACK, exit.\n"); + goto out; + } + } else + msg->buf[i2c->pos++] = oc_getreg(i2c, OCI2C_DATA); + + /* end of msg */ + if (i2c->pos == msg->len) { + LPC_CPLD_I2C_DEBUG_XFER("Enter end of msg.\n"); + i2c->nmsgs--; + i2c->msg++; + i2c->pos = 0; + msg = i2c->msg; + + if (i2c->nmsgs) { /* end? */ + /* send start */ + if (!(msg->flags & I2C_M_NOSTART)) { + u8 addr = (msg->addr << 1); + + if (msg->flags & I2C_M_RD) + addr |= 1; + + i2c->state = STATE_START; + + oc_setreg(i2c, OCI2C_DATA, addr); + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_START); + LPC_CPLD_I2C_DEBUG_XFER("send start, exit.\n"); + goto out; + } + + i2c->state = (msg->flags & I2C_M_RD) + ? STATE_READ : STATE_WRITE; + } else { + i2c->state = STATE_DONE; + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_STOP); + LPC_CPLD_I2C_DEBUG_XFER("send OCI2C_CMD_STOP, exit.\n"); + goto out; + } + } + + if (i2c->state == STATE_READ) { + oc_setreg(i2c, OCI2C_CMD, i2c->pos == (msg->len-1) ? + OCI2C_CMD_READ_NACK : OCI2C_CMD_READ_ACK); + } else { + oc_setreg(i2c, OCI2C_DATA, msg->buf[i2c->pos++]); + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_WRITE); + } + +out: + LPC_CPLD_I2C_DEBUG_XFER("normal, exit nr %d.\n", i2c->adap.nr); +} + +static irqreturn_t ocores_isr(int irq, void *dev_id) +{ + struct ocores_i2c *i2c = dev_id; + unsigned long flags; + u8 stat; + if (!i2c) { + return IRQ_NONE; + } + + LPC_CPLD_I2C_SPIN_LOCK(i2c->process_lock, flags); + stat = oc_getreg(i2c, OCI2C_STATUS); + + if (!(stat & OCI2C_STAT_IF)) { + g_irq_invalid_cnt++; + LPC_CPLD_I2C_SPIN_UNLOCK(i2c->process_lock, flags); + return IRQ_NONE; + } + + LPC_CPLD_I2C_DEBUG_XFER("Enter, irq %d nr %d addr 0x%x.\n", irq, i2c->adap.nr, i2c->msg->addr); + ocores_process(i2c, stat); + LPC_CPLD_I2C_DEBUG_XFER("Leave, irq %d nr %d addr 0x%x.\n", irq, i2c->adap.nr, i2c->msg->addr); + LPC_CPLD_I2C_SPIN_UNLOCK(i2c->process_lock, flags); + + return IRQ_HANDLED; +} + +/** + * Process timeout event + * @i2c: ocores I2C device instance + */ +static void ocores_process_timeout(struct ocores_i2c *i2c) +{ + unsigned long flags; + + LPC_CPLD_I2C_SPIN_LOCK(i2c->process_lock, flags); + i2c->state = STATE_ERROR; + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_STOP); + mdelay(1); + LPC_CPLD_I2C_SPIN_UNLOCK(i2c->process_lock, flags); + +} + +/** + * Wait until something change in a given register + * @i2c: ocores I2C device instance + * @reg: register to query + * @mask: bitmask to apply on register value + * @val: expected result + * @timeout: timeout in jiffies + * + * Timeout is necessary to avoid to stay here forever when the chip + * does not answer correctly. + * + * Return: 0 on success, -ETIMEDOUT on timeout + */ +static int ocores_wait(struct ocores_i2c *i2c, + int reg, u8 mask, u8 val, + const unsigned long timeout) +{ + u8 status; + unsigned long j, jiffies_tmp; + unsigned int usleep; + usleep = OCI2C_WAIT_SLEEP; + j = jiffies + timeout; + while (1) { + jiffies_tmp = jiffies; + status = oc_getreg(i2c, reg); + + if ((status & mask) == val) + break; + + if (time_after(jiffies_tmp, j)) { + LPC_CPLD_I2C_DEBUG_XFER("STATUS timeout, mask[0x%x] val[0x%x] status[0x%x]\n", mask, val, status); + return -ETIMEDOUT; + } + usleep_range(usleep,usleep + 1); + } + return 0; +} + +/** + * Wait until is possible to process some data + * @i2c: ocores I2C device instance + * + * Used when the device is in polling mode (interrupts disabled). + * + * Return: 0 on success, -ETIMEDOUT on timeout + */ +static int ocores_poll_wait(struct ocores_i2c *i2c) +{ + u8 mask; + int err; + + if (i2c->state == STATE_DONE || i2c->state == STATE_ERROR) { + /* transfer is over */ + mask = OCI2C_STAT_BUSY; + } else { + /* on going transfer */ + mask = OCI2C_STAT_TIP; + udelay((8 * 1000) / i2c->clock_khz); + } + + /* + * once we are here we expect to get the expected result immediately + * so if after 1ms we timeout then something is broken. + */ + err = ocores_wait(i2c, OCI2C_STATUS, mask, 0, msecs_to_jiffies(100)); + if (err) { + LPC_CPLD_I2C_DEBUG_XFER("STATUS timeout, bit 0x%x did not clear in 1ms, err %d\n", mask, err); + } + + return err; +} + + +/** + * It handles an IRQ-less transfer + * @i2c: ocores I2C device instance + * + * Even if IRQ are disabled, the I2C OpenCore IP behavior is exactly the same + * (only that IRQ are not produced). This means that we can re-use entirely + * ocores_isr(), we just add our polling code around it. + * + * It can run in atomic context + */ +static int ocores_process_polling(struct ocores_i2c *i2c) +{ + irqreturn_t ret; + int err; + while (1) { + err = ocores_poll_wait(i2c); + if (err) { + i2c->state = STATE_ERROR; + break; /* timeout */ + } + + ret = ocores_isr(-1, i2c); + if (ret == IRQ_NONE) + break; /* all messages have been transfered */ + } + return err; +} + +static int ocores_xfer_core(struct ocores_i2c *i2c, + struct i2c_msg *msgs, int num, + bool polling) +{ + int ret; + unsigned long flags; + u8 ctrl; + + LPC_CPLD_I2C_DEBUG_XFER("Enter.polling %d\n", polling); + LPC_CPLD_I2C_SPIN_LOCK(i2c->process_lock, flags); + ctrl = oc_getreg(i2c, OCI2C_CONTROL); + if (polling) + oc_setreg(i2c, OCI2C_CONTROL, ctrl & ~OCI2C_CTRL_IEN); + else + oc_setreg(i2c, OCI2C_CONTROL, ctrl | OCI2C_CTRL_IEN); + + i2c->msg = msgs; + i2c->pos = 0; + i2c->nmsgs = num; + i2c->state = STATE_START; + + oc_setreg(i2c, OCI2C_DATA, + (i2c->msg->addr << 1) | + ((i2c->msg->flags & I2C_M_RD) ? 1:0)); + + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_START); + LPC_CPLD_I2C_SPIN_UNLOCK(i2c->process_lock, flags); + + if (polling) { + ret = ocores_process_polling(i2c); + if (ret) { /* timeout */ + ocores_process_timeout(i2c); + return -ETIMEDOUT; + } + } else { + ret = wait_event_timeout(i2c->wait, + (i2c->state == STATE_ERROR) || + (i2c->state == STATE_DONE), HZ); + if (ret == 0) { + ocores_process_timeout(i2c); + return -ETIMEDOUT; + } + } + + return (i2c->state == STATE_DONE) ? num : -EIO; +} + +static int ocores_xfer_polling(struct i2c_adapter *adap, + struct i2c_msg *msgs, int num) +{ + LPC_CPLD_I2C_DEBUG_XFER("Enter.\n"); + return ocores_xfer_core(i2c_get_adapdata(adap), msgs, num, true); +} + +static int ocores_xfer(struct i2c_adapter *adap, + struct i2c_msg *msgs, int num) +{ + struct ocores_i2c *i2c = i2c_get_adapdata(adap); + + if (i2c->flags & OCORES_FLAG_POLL) + return ocores_xfer_polling(adap, msgs, num); + return ocores_xfer_core(i2c, msgs, num, false); +} + +static void ocores_init(struct ocores_i2c *i2c) +{ + int prescale; + u8 ctrl = oc_getreg(i2c, OCI2C_CONTROL); + + LPC_CPLD_I2C_DEBUG_XFER("Enter.\n"); + spin_lock_init(&i2c->process_lock); + + /* make sure the device is disabled */ + oc_setreg(i2c, OCI2C_CONTROL, ctrl & ~(OCI2C_CTRL_EN|OCI2C_CTRL_IEN)); + + prescale = (i2c->clock_khz / (5*100)) - 1; + oc_setreg(i2c, OCI2C_PRELOW, prescale & 0xff); + oc_setreg(i2c, OCI2C_PREHIGH, prescale >> 8); + LPC_CPLD_I2C_DEBUG_VERBOSE("i2c->base 0x%p, i2c->clock_khz %d, prescale 0x%x.\n", i2c->base, i2c->clock_khz, prescale); + + /* Init the device */ + oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_IACK); + oc_setreg(i2c, OCI2C_CONTROL, ctrl | OCI2C_CTRL_EN); +} + + +static u32 ocores_func(struct i2c_adapter *adap) +{ + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; +} + +static const struct i2c_algorithm ocores_algorithm = { + .master_xfer = ocores_xfer, + .functionality = ocores_func, +}; + +static struct i2c_adapter ocores_adapter = { + .owner = THIS_MODULE, + .name = "rg-cpld-ocrore-i2c", + .class = I2C_CLASS_HWMON | I2C_CLASS_SPD | I2C_CLASS_DEPRECATED, + .algo = &ocores_algorithm, +}; + +static const struct of_device_id ocores_i2c_match[] = { + { + .compatible = "opencores,rg-cpld-ocrore-i2c", + .data = (void *)TYPE_OCORES, + }, + {}, +}; +MODULE_DEVICE_TABLE(of, ocores_i2c_match); + +#ifdef CONFIG_OF +/* Read and write functions for the GRLIB port of the controller. Registers are + * 32-bit big endian and the PRELOW and PREHIGH registers are merged into one + * register. The subsequent registers has their offset decreased accordingly. */ +static u8 oc_getreg_grlib(struct ocores_i2c *i2c, int reg) +{ + u32 rd; + int rreg = reg; + if (reg != OCI2C_PRELOW) + rreg--; + rd = ioread32be(i2c->base + (rreg << i2c->reg_shift)); + if (reg == OCI2C_PREHIGH) + return (u8)(rd >> 8); + else + return (u8)rd; +} + +static void oc_setreg_grlib(struct ocores_i2c *i2c, int reg, u8 value) +{ + u32 curr, wr; + int rreg = reg; + if (reg != OCI2C_PRELOW) + rreg--; + if (reg == OCI2C_PRELOW || reg == OCI2C_PREHIGH) { + curr = ioread32be(i2c->base + (rreg << i2c->reg_shift)); + if (reg == OCI2C_PRELOW) + wr = (curr & 0xff00) | value; + else + wr = (((u32)value) << 8) | (curr & 0xff); + } else { + wr = value; + } + iowrite32be(wr, i2c->base + (rreg << i2c->reg_shift)); +} + +static int ocores_i2c_of_probe(struct platform_device *pdev, + struct ocores_i2c *i2c) +{ + struct device_node *np = pdev->dev.of_node; + const struct of_device_id *match; + u32 val; + + LPC_CPLD_I2C_DEBUG_VERBOSE("Enter ocores_i2c_of_probe.\n"); + if (of_property_read_u32(np, "reg-shift", &i2c->reg_shift)) { + /* no 'reg-shift', check for deprecated 'regstep' */ + if (!of_property_read_u32(np, "regstep", &val)) { + if (!is_power_of_2(val)) { + dev_err(&pdev->dev, "invalid regstep %d\n", + val); + return -EINVAL; + } + i2c->reg_shift = ilog2(val); + dev_warn(&pdev->dev, + "regstep property deprecated, use reg-shift\n"); + } + } + + if (of_property_read_u32(np, "clock-frequency", &val)) { + dev_err(&pdev->dev, + "Missing required parameter 'clock-frequency'\n"); + return -ENODEV; + } + i2c->clock_khz = val / 1000; + + of_property_read_u32(pdev->dev.of_node, "reg-io-width", + &i2c->reg_io_width); + + match = of_match_node(ocores_i2c_match, pdev->dev.of_node); + if (match && (long)match->data == TYPE_GRLIB) { + dev_dbg(&pdev->dev, "GRLIB variant of i2c-ocores\n"); + i2c->setreg = oc_setreg_grlib; + i2c->getreg = oc_getreg_grlib; + } + + return 0; +} +#else +#define ocores_i2c_of_probe(pdev,i2c) -ENODEV +#endif + +static void oc_debug_dump_reg(struct ocores_i2c *i2c) +{ + if (i2c) { + LPC_CPLD_I2C_DEBUG_DUMP("base: %p.\n", i2c->base); + LPC_CPLD_I2C_DEBUG_DUMP("reg_shift: %d.\n", i2c->reg_shift); + LPC_CPLD_I2C_DEBUG_DUMP("reg_io_width: %d.\n", i2c->reg_io_width); + LPC_CPLD_I2C_DEBUG_DUMP("adap.nr: %d.\n", i2c->adap.nr); + LPC_CPLD_I2C_DEBUG_DUMP("msg: %p.\n", i2c->msg); + if (i2c->msg) { + LPC_CPLD_I2C_DEBUG_DUMP("msg->buf: %p.\n", i2c->msg->buf); + LPC_CPLD_I2C_DEBUG_DUMP("msg->addr: 0x%x.\n", i2c->msg->addr); + LPC_CPLD_I2C_DEBUG_DUMP("msg->flags: 0x%x.\n", i2c->msg->flags); + LPC_CPLD_I2C_DEBUG_DUMP("msg->len: %d.\n", i2c->msg->len); + } else { + LPC_CPLD_I2C_DEBUG_DUMP("msg: %p is null.\n", i2c->msg); + } + + LPC_CPLD_I2C_DEBUG_DUMP("pos: %d.\n", i2c->pos); + LPC_CPLD_I2C_DEBUG_DUMP("nmsgs: %d.\n", i2c->nmsgs); + LPC_CPLD_I2C_DEBUG_DUMP("state: %d.\n", i2c->state); + LPC_CPLD_I2C_DEBUG_DUMP("clock_khz: %d.\n", i2c->clock_khz); + LPC_CPLD_I2C_DEBUG_DUMP("setreg: %p.\n", i2c->setreg); + LPC_CPLD_I2C_DEBUG_DUMP("getreg: %p.\n", i2c->getreg); + if (i2c->getreg) { + LPC_CPLD_I2C_DEBUG_DUMP("OCI2C_PRELOW: 0x%02x.\n", oc_getreg(i2c, OCI2C_PRELOW)); + LPC_CPLD_I2C_DEBUG_DUMP("OCI2C_PREHIGH: 0x%02x.\n", oc_getreg(i2c, OCI2C_PREHIGH)); + LPC_CPLD_I2C_DEBUG_DUMP("OCI2C_CONTROL: 0x%02x.\n", oc_getreg(i2c, OCI2C_CONTROL)); + LPC_CPLD_I2C_DEBUG_DUMP("OCI2C_DATA: 0x%02x.\n", oc_getreg(i2c, OCI2C_DATA)); + LPC_CPLD_I2C_DEBUG_DUMP("OCI2C_CMD: 0x%02x.\n", oc_getreg(i2c, OCI2C_CMD)); + LPC_CPLD_I2C_DEBUG_DUMP("OCI2C_STATUS: 0x%02x.\n", oc_getreg(i2c, OCI2C_STATUS)); + } else { + LPC_CPLD_I2C_DEBUG_DUMP("getreg: %p is null.\n", i2c->getreg); + } + } else { + LPC_CPLD_I2C_DEBUG_DUMP("i2c %p is null.\n", i2c); + } +} + +void oc_debug_dump_reg_exception(void) +{ + int bus_beg, bus_end, bus; + struct i2c_adapter *adap; + struct ocores_i2c *adap_data; + + bus_beg = 1; + bus_end = 14; + for (bus = bus_beg; bus <= bus_end; bus++) { + adap = i2c_get_adapter(bus); + if (adap) { + adap_data = (struct ocores_i2c *)i2c_get_adapdata(adap); + if (adap_data) { + LPC_CPLD_I2C_DEBUG_DUMP("bus %d call oc_debug_dump_reg begin.\n", bus); + oc_debug_dump_reg(adap_data); + LPC_CPLD_I2C_DEBUG_DUMP("bus %d call oc_debug_dump_reg end.\n", bus); + } else { + LPC_CPLD_I2C_DEBUG_DUMP("bus %d i2c_get_adapdata null.\n", bus); + } + i2c_put_adapter(adap); + } else { + LPC_CPLD_I2C_DEBUG_DUMP("bus %d i2c_get_adapter null.\n", bus); + } + } +} + +static ssize_t show_oc_debug_value(struct device *dev, struct device_attribute *da, char *buf) +{ + oc_debug_dump_reg_exception(); + return 0; +} + +static SENSOR_DEVICE_ATTR(oc_debug, S_IRUGO | S_IWUSR, show_oc_debug_value, NULL, 0x15); + +static struct attribute *oc_debug_sysfs_attrs[] = { + &sensor_dev_attr_oc_debug.dev_attr.attr, + NULL +}; + +static const struct attribute_group oc_debug_sysfs_group = { + .attrs = oc_debug_sysfs_attrs, +}; + +static void oc_debug_sysfs_init(struct platform_device *pdev) +{ + int ret; + + ret = sysfs_create_group(&pdev->dev.kobj, &oc_debug_sysfs_group); + LPC_CPLD_I2C_DEBUG_VERBOSE("sysfs_create_group ret %d.\n", ret); + return; +} + +static void oc_debug_sysfs_exit(struct platform_device *pdev) +{ + sysfs_remove_group(&pdev->dev.kobj, (const struct attribute_group *)&oc_debug_sysfs_group); + LPC_CPLD_I2C_DEBUG_VERBOSE("sysfs_remove_group.\n"); + return; +} + +static int rg_ocores_i2c_probe(struct platform_device *pdev) +{ + struct ocores_i2c *i2c; + struct rg_ocores_cpld_i2c_platform_data *pdata; + struct resource *res; + int irq; + int ret; + int i; + + LPC_CPLD_I2C_DEBUG_VERBOSE("Enter.\n"); + + i2c = devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL); + if (!i2c) { + LPC_CPLD_I2C_DEBUG_ERROR("devm_kzalloc failed.\n"); + return -ENOMEM; + } + res = platform_get_resource(pdev, IORESOURCE_IO, 0); + if (!res) { + LPC_CPLD_I2C_DEBUG_ERROR("can't fetch device resource info\n"); + return -ENOMEM; + } + + i2c->base = (void __iomem *)res->start; + LPC_CPLD_I2C_DEBUG_VERBOSE("i2c->base is %p., res->end[%d]\n", i2c->base, (int)res->end); + + pdata = dev_get_platdata(&pdev->dev); + if (pdata) { + i2c->reg_shift = pdata->reg_shift; + i2c->reg_io_width = pdata->reg_io_width; + i2c->clock_khz = pdata->clock_khz; + } else { + ret = ocores_i2c_of_probe(pdev, i2c); + if (ret) + return ret; + } + + LPC_CPLD_I2C_DEBUG_VERBOSE("data: shift[%d], width[%d], clock_khz[%d] i2c_irq_flag=%d\n", + pdata->reg_shift, pdata->reg_io_width, pdata->clock_khz, pdata->i2c_irq_flag); + + if (i2c->reg_io_width == 0) + i2c->reg_io_width = 1; /* Set to default value */ + + + if (!i2c->setreg || !i2c->getreg) { + switch (i2c->reg_io_width) { + case 1: + i2c->setreg = oc_setreg_8; + i2c->getreg = oc_getreg_8; + break; + default: + dev_err(&pdev->dev, "Unsupported I/O width (%d)\n", + i2c->reg_io_width); + return -EINVAL; + } + } + + init_waitqueue_head(&i2c->wait); + + irq = platform_get_irq(pdev, 0); + LPC_CPLD_I2C_DEBUG_VERBOSE("get irq %d, ENXIO[%d]", irq, ENXIO); + if (irq == -ENXIO) { + i2c->flags |= OCORES_FLAG_POLL; + } else if(g_lpc_cpld_i2c_irq_flag){ + ret = devm_request_irq(&pdev->dev, irq, ocores_isr, 0, + pdev->name, i2c); + if (ret) { + dev_err(&pdev->dev, "Cannot claim IRQ\n"); + } + + if(pdata->i2c_irq_flag) { + g_lpc_cpld_i2c_irq_flag = 0; + } + } + + ocores_init(i2c); + + /* hook up driver to tree */ + platform_set_drvdata(pdev, i2c); + i2c->adap = ocores_adapter; + i2c_set_adapdata(&i2c->adap, i2c); + i2c->adap.dev.parent = &pdev->dev; + i2c->adap.dev.of_node = pdev->dev.of_node; + + /* add i2c adapter to i2c tree */ + ret = i2c_add_adapter(&i2c->adap); + if (ret) { + dev_err(&pdev->dev, "Failed to add adapter\n"); + return ret; + } + + /* add in known devices to the bus */ + if (pdata) { + LPC_CPLD_I2C_DEBUG_VERBOSE("i2c device %d.\n", pdata->num_devices); + for (i = 0; i < pdata->num_devices; i++) + i2c_new_device(&i2c->adap, pdata->devices + i); + } + + oc_debug_sysfs_init(pdev); + return 0; +} + +static int rg_ocores_i2c_remove(struct platform_device *pdev) +{ + struct ocores_i2c *i2c = platform_get_drvdata(pdev); + + /* disable i2c logic */ + oc_setreg(i2c, OCI2C_CONTROL, oc_getreg(i2c, OCI2C_CONTROL) + & ~(OCI2C_CTRL_EN|OCI2C_CTRL_IEN)); + + /* remove adapter & data */ + i2c_del_adapter(&i2c->adap); + oc_debug_sysfs_exit(pdev); + + return 0; +} + +#ifdef CONFIG_PM_SLEEP +static int ocores_i2c_suspend(struct device *dev) +{ + struct ocores_i2c *i2c = dev_get_drvdata(dev); + u8 ctrl = oc_getreg(i2c, OCI2C_CONTROL); + + /* make sure the device is disabled */ + oc_setreg(i2c, OCI2C_CONTROL, ctrl & ~(OCI2C_CTRL_EN|OCI2C_CTRL_IEN)); + + return 0; +} + +static int ocores_i2c_resume(struct device *dev) +{ + struct ocores_i2c *i2c = dev_get_drvdata(dev); + + ocores_init(i2c); + + return 0; +} + +static SIMPLE_DEV_PM_OPS(ocores_i2c_pm, ocores_i2c_suspend, ocores_i2c_resume); +#define OCORES_I2C_PM (&ocores_i2c_pm) +#else +#define OCORES_I2C_PM NULL +#endif + +static struct platform_driver ocores_i2c_driver = { + .probe = rg_ocores_i2c_probe, + .remove = rg_ocores_i2c_remove, + .driver = { + .owner = THIS_MODULE, + .name = "rg-cpld-ocrore-i2c", + .of_match_table = ocores_i2c_match, + .pm = OCORES_I2C_PM, + }, +}; + +module_platform_driver(ocores_i2c_driver); + +MODULE_AUTHOR("Peter Korsgaard "); +MODULE_DESCRIPTION("OpenCores I2C bus driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:ocores-i2c"); diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/lpc_cpld_i2c_ocores.h b/platform/broadcom/sonic-platform-modules-ragile/common/modules/lpc_cpld_i2c_ocores.h new file mode 100755 index 000000000000..baf6a916b11a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/lpc_cpld_i2c_ocores.h @@ -0,0 +1,13 @@ +#ifndef _LPC_CPLD_I2C_OCORES_H +#define _LPC_CPLD_I2C_OCORES_H + +struct rg_ocores_cpld_i2c_platform_data { + u32 reg_shift; /* register offset shift value */ + u32 reg_io_width; /* register io read/write width */ + u32 clock_khz; /* input clock in kHz */ + u8 num_devices; /* number of devices in the devices list */ + u8 i2c_irq_flag; + struct i2c_board_info const *devices; /* devices connected to the bus */ +}; + +#endif /* _LPC_CPLD_I2C_OCORES_H */ diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/lpc_dbg.c b/platform/broadcom/sonic-platform-modules-ragile/common/modules/lpc_dbg.c new file mode 100755 index 000000000000..9c43bcee5c4a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/lpc_dbg.c @@ -0,0 +1,534 @@ +#include +#if LINUX_VERSION_CODE > KERNEL_VERSION(4, 19, 0) +#include +#endif + +#include +#include /* Wd're doing kernel work */ +#include /* specifically, a module */ +#include +#include /* Need for the macros */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "lpc_dbg.h" + +typedef struct rg_lpc_device_s { + u16 base; + u16 size; + u8 type; + u8 id; + u8 lpc_pci_addr; +} rg_lpc_device_t; + +typedef enum rg_lpc_dev_type_s { + LPC_DEVICE_CPLD = 1, + LPC_DEVICE_FPGA = 2, +} rg_lpc_dev_type_t; + +#define MAX_LPC_DEV_NUM (4) +#define LPC_PCI_CFG_BASE(__lgir) ((0x84) + ((__lgir) * 4)) +#define MAX_CPLD_REG_SIZE (0x100) +#define MAX_FPGA_REG_SIZE (0x100) //# fix compile actual value 0x10000 +#define LPC_GET_CPLD_ID(addr) ((addr >> 16) & 0xff) +#define LPC_GET_CPLD_OFFSET(addr) ((addr) & 0xff) + +int lpc_dbg_verbose = 0; +int lpc_dbg_error = 0; +int lpc_dbg_info = 0; +module_param(lpc_dbg_verbose, int, S_IRUGO | S_IWUSR); +module_param(lpc_dbg_error, int, S_IRUGO | S_IWUSR); +module_param(lpc_dbg_info, int, S_IRUGO | S_IWUSR); + + +#define LPC_DBG_VERBOSE(fmt, args...) do { \ + if (lpc_dbg_verbose) { \ + printk(KERN_ERR "[LPC_DBG][VERBOSE][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ + } \ +} while (0) + +#define LPC_DBG_ERROR(fmt, args...) do { \ + if (lpc_dbg_error) { \ + printk(KERN_ERR "[LPC_DBG][ERROR][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ + } \ +} while (0) + +#define LPC_DBG_INFO(fmt, args...) do { \ + if (lpc_dbg_info) { \ + printk(KERN_ERR ""fmt, ## args); \ + } \ +} while (0) + +static rg_lpc_device_t g_rg_lpc_dev_default[] = { + {.base = 0x700, .size = MAX_CPLD_REG_SIZE, .type = LPC_DEVICE_CPLD, .id = 0, .lpc_pci_addr = 0x84}, + {.base = 0x900, .size = MAX_CPLD_REG_SIZE, .type = LPC_DEVICE_CPLD, .id = 1, .lpc_pci_addr = 0x88}, + {.base = 0xb00, .size = MAX_CPLD_REG_SIZE, .type = LPC_DEVICE_CPLD, .id = 2, .lpc_pci_addr = 0x90}, +}; + +static rg_lpc_device_t *g_rg_lpc_dev = g_rg_lpc_dev_default; + +static rg_lpc_device_t* lpc_get_device_info(int type, int id) +{ + int i; + int size; + + size = ARRAY_SIZE(g_rg_lpc_dev_default); + for (i = 0; i < size; i++) { + if ((g_rg_lpc_dev[i].type == type) && (g_rg_lpc_dev[i].id == id)) { + return &g_rg_lpc_dev[i]; + } + } + + return NULL; +} + + +int lpc_cpld_read(int address, u8 *val) +{ + int cpld_id; + rg_lpc_device_t *info; + + cpld_id = LPC_GET_CPLD_ID(address); + info = lpc_get_device_info(LPC_DEVICE_CPLD, cpld_id); + if (info == NULL) { + LPC_DBG_ERROR("lpc_get_device_info addr 0x%x id %d failed.\r\n", address, cpld_id); + return -1; + } + + *val = inb(info->base + LPC_GET_CPLD_OFFSET(address)); + LPC_DBG_VERBOSE("Leave info->base 0x%x, addr 0x%x, cpld_id %d, val 0x%x.\r\n", info->base, address, cpld_id, *val); + return 0; +} + +int lpc_cpld_write(int address, u8 reg_val) +{ + int cpld_id; + rg_lpc_device_t *info; + + cpld_id = LPC_GET_CPLD_ID(address); + info = lpc_get_device_info(LPC_DEVICE_CPLD, cpld_id); + if (info == NULL) { + LPC_DBG_ERROR("lpc_get_device_info addr 0x%x id %d failed.\r\n", address, cpld_id); + return -1; + } + + outb(reg_val, info->base + LPC_GET_CPLD_OFFSET(address)); + LPC_DBG_VERBOSE("Leave info->base 0x%x, addr 0x%x, cpld_id %d, val 0x%x.\r\n", info->base, address, cpld_id, reg_val); + return 0; +} + +int lpc_fpga_read(int address, u8 *val) +{ + return -1; +} + +int lpc_fpga_write(int address, u8 reg_val) +{ + return -1; +} + +static ssize_t lpc_misc_cpld_dev_read (struct file *file, char __user *buf, size_t count, + loff_t *offset) +{ + int ret; + u8 value8[MAX_CPLD_REG_SIZE]; + int i; + + if ((count > MAX_CPLD_REG_SIZE) + || ((LPC_GET_CPLD_OFFSET(file->f_pos) + count) > MAX_CPLD_REG_SIZE)) { + return -EFAULT; + } + + for (i = 0; i < count; i++) { + ret = lpc_cpld_read((int)(file->f_pos + i), &value8[i]); + if (ret) { + LPC_DBG_ERROR("lpc_cpld_read i %d addr 0x%x failed ret %d.\n", + i, ((unsigned int)file->f_pos + i), ret); + return i; + } + } + + if (copy_to_user(buf, value8, count)) { + return -EFAULT; + } + + return count; +} + + +static ssize_t lpc_misc_cpld_dev_write (struct file *file, const char __user *buf, size_t count, + loff_t *offset) +{ + u8 value8[MAX_CPLD_REG_SIZE]; + int i; + int ret; + + if ((count > MAX_CPLD_REG_SIZE) + || ((LPC_GET_CPLD_OFFSET(file->f_pos) + count) > MAX_CPLD_REG_SIZE)) { + return -EFAULT; + } + + if (copy_from_user(value8, buf, count)) { + return -EFAULT; + } + + for (i = 0; i < count; i++) { + ret = lpc_cpld_write((int)(file->f_pos + i), value8[i]); + if (ret) { + LPC_DBG_ERROR("lpc_cpld_write i %d addr 0x%x value 0x%x failed ret %d.\n", + i, (unsigned int)file->f_pos + i, value8[i], ret); + return i; + } + } + + return count; +} + + +static loff_t lpc_misc_cpld_dev_llseek(struct file *file, loff_t offset, int origin) +{ + loff_t ret; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,36) + mutex_lock(&file->f_path.dentry->d_inode->i_mutex); +#else + /* do noting add tjm */ + inode_lock(file_inode(file)); +#endif + + switch (origin) { + case 0: + file->f_pos = offset; + ret = file->f_pos; + break; + case 1: + file->f_pos += offset; + ret = file->f_pos; + break; + default: + ret = -EINVAL; + } + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,36) + mutex_unlock(&file->f_path.dentry->d_inode->i_mutex); +#else + /* do noting add tjm */ + inode_unlock(file_inode(file)); +#endif + + + return ret; +} + + +static long lpc_misc_cpld_dev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + return -1; +} + +static int lpc_misc_cpld_dev_open(struct inode *inode, struct file *file) +{ + file->private_data = NULL; + file->f_pos = 0; + return 0; + +} + +static int lpc_misc_cpld_dev_release(struct inode *inode, struct file *file) +{ + file->private_data = NULL; + file->f_pos = 0; + return 0; +} + +static const struct file_operations lpc_misc_cpld_dev_fops = { + .owner = THIS_MODULE, + .llseek = lpc_misc_cpld_dev_llseek, + .read = lpc_misc_cpld_dev_read, + .write = lpc_misc_cpld_dev_write, + .unlocked_ioctl = lpc_misc_cpld_dev_ioctl, + .open = lpc_misc_cpld_dev_open, + .release = lpc_misc_cpld_dev_release, +}; + +static ssize_t lpc_misc_fpga_dev_read (struct file *file, char __user *buf, size_t count, + loff_t *offset) +{ + int ret; + u8 value8[MAX_FPGA_REG_SIZE]; + int i; + + if ((count > MAX_FPGA_REG_SIZE) || ((file->f_pos + count) > MAX_FPGA_REG_SIZE)) { + return -EFAULT; + } + + for (i = 0; i < count; i++) { + ret = lpc_fpga_read((int)(file->f_pos + i), &value8[i]); + if (ret) { + LPC_DBG_ERROR("lpc_fpga_read i %d addr 0x%x failed ret %d.\n", + i, ((unsigned int)file->f_pos + i), ret); + return i; + } + + } + + if (copy_to_user(buf, value8, count)) { + return -EFAULT; + } + + return count; +} + + +static ssize_t lpc_misc_fpga_dev_write (struct file *file, const char __user *buf, size_t count, + loff_t *offset) +{ + int ret; + u8 value8[MAX_FPGA_REG_SIZE]; + int i; + + if ((count > MAX_FPGA_REG_SIZE) || ((file->f_pos + count) > MAX_FPGA_REG_SIZE)) { + return -EFAULT; + } + + if (copy_from_user(value8, buf, count)) { + return -EFAULT; + } + + for (i = 0; i < count; i++) { + ret = lpc_fpga_write((int)(file->f_pos + i), value8[i]); + if (ret) { + LPC_DBG_ERROR("lpc_fpga_write i %d addr 0x%x value 0x%x failed ret %d.\n", + i, (int)(file->f_pos + i), value8[i], ret); + return i; + } + } + + return count; +} + + +static loff_t lpc_misc_fpga_dev_llseek(struct file *file, loff_t offset, int origin) +{ + loff_t ret; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,36) + mutex_lock(&file->f_path.dentry->d_inode->i_mutex); +#else + /* do noting add tjm */ + inode_lock(file_inode(file)); +#endif + + switch (origin) { + case 0: + file->f_pos = offset; + ret = file->f_pos; + break; + case 1: + file->f_pos += offset; + ret = file->f_pos; + break; + default: + ret = -EINVAL; + } + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,36) + mutex_unlock(&file->f_path.dentry->d_inode->i_mutex); +#else + /* do noting add tjm */ + inode_unlock(file_inode(file)); +#endif + + + return ret; +} + + +static long lpc_misc_fpga_dev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + return -1; +} + +static int lpc_misc_fpga_dev_open(struct inode *inode, struct file *file) +{ + file->private_data = NULL; + file->f_pos = 0; + return 0; + +} + +static int lpc_misc_fpga_dev_release(struct inode *inode, struct file *file) +{ + file->private_data = NULL; + file->f_pos = 0; + return 0; +} + +static const struct file_operations lpc_misc_fpga_dev_fops = { + .owner = THIS_MODULE, + .llseek = lpc_misc_fpga_dev_llseek, + .read = lpc_misc_fpga_dev_read, + .write = lpc_misc_fpga_dev_write, + .unlocked_ioctl = lpc_misc_fpga_dev_ioctl, + .open = lpc_misc_fpga_dev_open, + .release = lpc_misc_fpga_dev_release, +}; + +static struct miscdevice lpc_misc_cpld_dev = { + .minor = MISC_DYNAMIC_MINOR, + .name = "lpc_cpld", + .fops = &lpc_misc_cpld_dev_fops, +}; + +static struct miscdevice lpc_misc_fpga_dev = { + .minor = MISC_DYNAMIC_MINOR, + .name = "lpc_fpga", + .fops = &lpc_misc_fpga_dev_fops, +}; + +static int lpc_misc_drv_init(void) +{ + if (misc_register(&lpc_misc_cpld_dev) != 0) { + LPC_DBG_ERROR("Register %s failed.\r\n", lpc_misc_cpld_dev.name); + return -ENXIO; + } + + if (misc_register(&lpc_misc_fpga_dev) != 0) { + LPC_DBG_ERROR("Register %s failed.\r\n", lpc_misc_fpga_dev.name); + return -ENXIO; + } + return 0; +} + +static void lpc_misc_drv_exit(void) +{ + misc_deregister(&lpc_misc_cpld_dev); + misc_deregister(&lpc_misc_fpga_dev); +} + +#define LPC_MAKE_PCI_IO_RANGE(__base) ((0xfc0001) | ((__base) & (0xFFFC))) + +static int lpc_pci_cfg_init(struct pci_dev *pdev, + const struct pci_device_id *id) +{ + int i; + int size; + + size = ARRAY_SIZE(g_rg_lpc_dev_default); + + for (i = 0; i < size; i++) { + pci_write_config_dword(pdev, g_rg_lpc_dev[i].lpc_pci_addr, LPC_MAKE_PCI_IO_RANGE(g_rg_lpc_dev[i].base)); + LPC_DBG_VERBOSE("set lpc pci cfg[addr: 0x%x, value:0x%x].\n", LPC_PCI_CFG_BASE(i), LPC_MAKE_PCI_IO_RANGE(g_rg_lpc_dev[i].base)); + if (!request_region(g_rg_lpc_dev[i].base, g_rg_lpc_dev[i].size, "rg_lpc")) { + LPC_DBG_ERROR("request_region [0x%x][0x%x] failed!\n", g_rg_lpc_dev[i].base, g_rg_lpc_dev[i].size); + return -EBUSY; + } + } + + return 0; +} + +static void lpc_pci_cfg_exit(void) +{ + int i; + int size; + + size = ARRAY_SIZE(g_rg_lpc_dev_default); + for (i = 0; i < size; i++) { + release_region(g_rg_lpc_dev[i].base, g_rg_lpc_dev[i].size); + } + return; +} + +static int rg_lpc_cpld_probe(struct pci_dev *pdev, + const struct pci_device_id *id) +{ + int ret; + + LPC_DBG_VERBOSE("Enter.\n"); + ret = lpc_pci_cfg_init(pdev, id); + if (ret) { + LPC_DBG_ERROR("lpc_pci_cfg_init failed ret %d.\n", ret); + return ret; + } + + ret = lpc_misc_drv_init(); + if (ret) { + LPC_DBG_ERROR("lpc_misc_drv_init failed ret %d.\n", ret); + return ret; + } + LPC_DBG_VERBOSE("Leave success\n"); + + return 0; +} + +static void rg_lpc_cpld_remove(struct pci_dev *pdev) +{ + LPC_DBG_VERBOSE("Enter.\n"); + lpc_misc_drv_exit(); + lpc_pci_cfg_exit(); + LPC_DBG_VERBOSE("Leave.\n"); +} + + +#define PCI_VENDOR_ID_D1527_LPC (0x8c54) +#define PCI_VENDOR_ID_C3000_LPC (0x19dc) + +#if 0 +static const struct pci_device_id rg_lpc_cpld_pcidev_id[] = { + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_VENDOR_ID_C3000_LPC) }, + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_VENDOR_ID_D1527_LPC) }, + { 0, } +}; +MODULE_DEVICE_TABLE(pci, rg_lpc_cpld_pcidev_id); + +static struct pci_driver rg_lpc_driver = { + .name = "rg_lpc", + .id_table = rg_lpc_cpld_pcidev_id, + .probe = rg_lpc_cpld_probe, + .remove = rg_lpc_cpld_remove, +}; + +module_pci_driver(rg_lpc_driver); +#else +static int __init lpc_dbg_init(void) +{ + struct pci_dev *pdev = NULL; + int ret; + + LPC_DBG_VERBOSE("Enter.\n"); + + pdev = pci_get_device(PCI_VENDOR_ID_INTEL, PCI_VENDOR_ID_D1527_LPC, pdev); + if (!pdev) { + LPC_DBG_ERROR("pci_get_device(0x8086, 0x8c54) failed!\n"); + return 0; + } + + ret = rg_lpc_cpld_probe(pdev, NULL); + LPC_DBG_VERBOSE("Leave ret %d.\n", ret); + return ret; +} + +static void __exit lpc_dbg_exit(void) +{ + LPC_DBG_VERBOSE("Enter.\n"); + rg_lpc_cpld_remove(NULL); + LPC_DBG_VERBOSE("Leave.\n"); +} + + + +module_init(lpc_dbg_init); +module_exit(lpc_dbg_exit); + +#endif +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("support "); + diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/lpc_dbg.h b/platform/broadcom/sonic-platform-modules-ragile/common/modules/lpc_dbg.h new file mode 100755 index 000000000000..d1aad9c90751 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/lpc_dbg.h @@ -0,0 +1,39 @@ +#ifndef __ETH_CMD_TYPES_H__ +#define __ETH_CMD_TYPES_H__ + +typedef enum { + ETH_START = 1, + ETH_SHOW, + ETH_SET, + ETH_TEST, + ETH_MAC_REG, + ETH_PHY_REG, +} ether_dbg_top_cmd_t; + +typedef enum { + ETH_MAC_REG_READ = 1, + ETH_MAC_REG_WRITE, + ETH_MAC_REG_CHECK, + ETH_MAC_REG_DUMP_ALL, + ETH_MAC_REG_DUMP_PCI_CFG_ALL, +} ether_mac_reg_cmd_t; + + +#define ETH_DBG_TYPE(cmd1, cmd2, cmd3, cmd4) \ + ((cmd1) | ((cmd2) << 8) | ((cmd3) << 16) | ((cmd4) << 24)) +#define ETH_DBG_PARSE_TYPE(type, cmd1, cmd2, cmd3, cmd4) \ + do {\ + (cmd1) = (type) & 0xff;\ + (cmd2) = ((type) >> 8) & 0xff;\ + (cmd3) = ((type) >> 16) & 0xff;\ + (cmd4) = ((type) >> 24) & 0xff;\ + } while (0) + +typedef struct { + int type; + int length; + unsigned char value[128]; +} ether_msg_t; + + +#endif /* __ETH_CMD_TYPES_H__ */ diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/pmbus.h b/platform/broadcom/sonic-platform-modules-ragile/common/modules/pmbus.h index 869a8d1558a4..39b778a4734b 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/modules/pmbus.h +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/pmbus.h @@ -130,26 +130,26 @@ enum pmbus_regs { PMBUS_MFR_DATE = 0x9D, PMBUS_MFR_SERIAL = 0x9E, -/* - * Virtual registers. - * Useful to support attributes which are not supported by standard PMBus - * registers but exist as manufacturer specific registers on individual chips. - * Must be mapped to real registers in device specific code. - * - * Semantics: - * Virtual registers are all word size. - * READ registers are read-only; writes are either ignored or return an error. - * RESET registers are read/write. Reading reset registers returns zero - * (used for detection), writing any value causes the associated history to be - * reset. - * Virtual registers have to be handled in device specific driver code. Chip - * driver code returns non-negative register values if a virtual register is - * supported, or a negative error code if not. The chip driver may return - * -ENODATA or any other error code in this case, though an error code other - * than -ENODATA is handled more efficiently and thus preferred. Either case, - * the calling PMBus core code will abort if the chip driver returns an error - * code when reading or writing virtual registers. - */ + /* + * Virtual registers. + * Useful to support attributes which are not supported by standard PMBus + * registers but exist as manufacturer specific registers on individual chips. + * Must be mapped to real registers in device specific code. + * + * Semantics: + * Virtual registers are all word size. + * READ registers are read-only; writes are either ignored or return an error. + * RESET registers are read/write. Reading reset registers returns zero + * (used for detection), writing any value causes the associated history to be + * reset. + * Virtual registers have to be handled in device specific driver code. Chip + * driver code returns non-negative register values if a virtual register is + * supported, or a negative error code if not. The chip driver may return + * -ENODATA or any other error code in this case, though an error code other + * than -ENODATA is handled more efficiently and thus preferred. Either case, + * the calling PMBus core code will abort if the chip driver returns an error + * code when reading or writing virtual registers. + */ PMBUS_VIRT_BASE = 0x100, PMBUS_VIRT_READ_TEMP_AVG, PMBUS_VIRT_READ_TEMP_MIN, @@ -190,6 +190,33 @@ enum pmbus_regs { PMBUS_VIRT_VMON_UV_FAULT_LIMIT, PMBUS_VIRT_VMON_OV_FAULT_LIMIT, PMBUS_VIRT_STATUS_VMON, + + /* + * RPM and PWM Fan control + * + * Drivers wanting to expose PWM control must define the behaviour of + * PMBUS_VIRT_PWM_[1-4] and PMBUS_VIRT_PWM_ENABLE_[1-4] in the + * {read,write}_word_data callback. + * + * pmbus core provides a default implementation for + * PMBUS_VIRT_FAN_TARGET_[1-4]. + * + * TARGET, PWM and PWM_ENABLE members must be defined sequentially; + * pmbus core uses the difference between the provided register and + * it's _1 counterpart to calculate the FAN/PWM ID. + */ + PMBUS_VIRT_FAN_TARGET_1, + PMBUS_VIRT_FAN_TARGET_2, + PMBUS_VIRT_FAN_TARGET_3, + PMBUS_VIRT_FAN_TARGET_4, + PMBUS_VIRT_PWM_1, + PMBUS_VIRT_PWM_2, + PMBUS_VIRT_PWM_3, + PMBUS_VIRT_PWM_4, + PMBUS_VIRT_PWM_ENABLE_1, + PMBUS_VIRT_PWM_ENABLE_2, + PMBUS_VIRT_PWM_ENABLE_3, + PMBUS_VIRT_PWM_ENABLE_4, }; /* @@ -223,6 +250,8 @@ enum pmbus_regs { #define PB_FAN_1_RPM BIT(6) #define PB_FAN_1_INSTALLED BIT(7) +enum pmbus_fan_mode { percent = 0, rpm }; + /* * STATUS_BYTE, STATUS_WORD (lower) */ @@ -313,6 +342,7 @@ enum pmbus_sensor_classes { PSC_POWER, PSC_TEMPERATURE, PSC_FAN, + PSC_PWM, PSC_NUM_CLASSES /* Number of power sensor classes */ }; @@ -339,6 +369,10 @@ enum pmbus_sensor_classes { #define PMBUS_HAVE_STATUS_FAN34 BIT(17) #define PMBUS_HAVE_VMON BIT(18) #define PMBUS_HAVE_STATUS_VMON BIT(19) +#define PMBUS_HAVE_PWM12 BIT(20) +#define PMBUS_HAVE_PWM34 BIT(21) + +#define PMBUS_PAGE_VIRTUAL BIT(31) enum pmbus_data_format { linear = 0, direct, vid }; enum vrm_version { vr11 = 0, vr12, vr13 }; @@ -370,7 +404,7 @@ struct pmbus_driver_info { int (*read_byte_data)(struct i2c_client *client, int page, int reg); int (*read_word_data)(struct i2c_client *client, int page, int reg); int (*write_word_data)(struct i2c_client *client, int page, int reg, - u16 word); + u16 word); int (*write_byte)(struct i2c_client *client, int page, u8 value); /* * The identify function determines supported PMBus functionality. @@ -404,21 +438,29 @@ extern const struct regulator_ops pmbus_regulator_ops; /* Function declarations */ void pmbus_clear_cache(struct i2c_client *client); -int pmbus_set_page(struct i2c_client *client, u8 page); -int pmbus_read_word_data(struct i2c_client *client, u8 page, u8 reg); -int pmbus_write_word_data(struct i2c_client *client, u8 page, u8 reg, u16 word); +int pmbus_set_page(struct i2c_client *client, int page); +int pmbus_read_word_data(struct i2c_client *client, int page, u8 reg); +int pmbus_write_word_data(struct i2c_client *client, int page, u8 reg, u16 word); int pmbus_read_byte_data(struct i2c_client *client, int page, u8 reg); int pmbus_write_byte(struct i2c_client *client, int page, u8 value); int pmbus_write_byte_data(struct i2c_client *client, int page, u8 reg, - u8 value); + u8 value); int pmbus_update_byte_data(struct i2c_client *client, int page, u8 reg, - u8 mask, u8 value); + u8 mask, u8 value); void pmbus_clear_faults(struct i2c_client *client); bool pmbus_check_byte_register(struct i2c_client *client, int page, int reg); bool pmbus_check_word_register(struct i2c_client *client, int page, int reg); int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id, - struct pmbus_driver_info *info); + struct pmbus_driver_info *info); int pmbus_do_remove(struct i2c_client *client); const struct pmbus_driver_info *pmbus_get_driver_info(struct i2c_client - *client); + *client); +int pmbus_get_fan_rate_device(struct i2c_client *client, int page, int id, + enum pmbus_fan_mode mode); +int pmbus_get_fan_rate_cached(struct i2c_client *client, int page, int id, + enum pmbus_fan_mode mode); +int pmbus_update_fan(struct i2c_client *client, int page, int id, + u8 config, u8 mask, u16 command); +struct dentry *pmbus_get_debugfs_dir(struct i2c_client *client); + #endif /* PMBUS_H */ diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/ragile_common_module.c b/platform/broadcom/sonic-platform-modules-ragile/common/modules/ragile_common_module.c new file mode 100755 index 000000000000..e4fc735643dd --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/ragile_common_module.c @@ -0,0 +1,79 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static int dfd_my_type = 0; +module_param(dfd_my_type, int, S_IRUGO | S_IWUSR); + +int g_common_debug_error = 0; +module_param(g_common_debug_error, int, S_IRUGO | S_IWUSR); + +int g_common_debug_verbose = 0; +module_param(g_common_debug_verbose, int, S_IRUGO | S_IWUSR); + +#define RAGILE_COMMON_DEBUG_VERBOSE(fmt, args...) do { \ + if (g_common_debug_verbose) { \ + printk(KERN_ERR "[RAGILE_COMMON][VER][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ + } \ +} while (0) + +#define RAGILE_COMMON_DEBUG_ERROR(fmt, args...) do { \ + if (g_common_debug_error) { \ + printk(KERN_ERR "[RAGILE_COMMON][ERROR][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ + } \ +} while (0) + + +int dfd_get_my_card_type(void) +{ + int type; + int cnt; + + if (dfd_my_type != 0) { + RAGILE_COMMON_DEBUG_VERBOSE("my_type = 0x%x\r\n", dfd_my_type); + return dfd_my_type; + } + + return -1; +} +EXPORT_SYMBOL(dfd_get_my_card_type); + +static int __init ragile_common_init(void) +{ + int ret; + + RAGILE_COMMON_DEBUG_VERBOSE("Enter.\n"); + ret = dfd_get_my_card_type(); + if (ret <= 0) { + RAGILE_COMMON_DEBUG_ERROR("dfd_get_my_card_type failed, ret %d.\n", ret); + printk(KERN_ERR "Warning: Device type get failed, please check the TLV-EEPROM!\n"); + return -1; + } + + RAGILE_COMMON_DEBUG_VERBOSE("Leave success type 0x%x.\n", ret); + return 0; +} + +static void __exit ragile_common_exit(void) +{ + RAGILE_COMMON_DEBUG_VERBOSE("Exit.\n"); +} + +module_init(ragile_common_init); +module_exit(ragile_common_exit); + +MODULE_DESCRIPTION("ragile Platform Support"); +MODULE_AUTHOR("support "); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/rg-gpio-xeon.c b/platform/broadcom/sonic-platform-modules-ragile/common/modules/rg-gpio-xeon.c index ecfd61c39c1c..84b62c50ab0b 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/modules/rg-gpio-xeon.c +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/rg-gpio-xeon.c @@ -62,11 +62,11 @@ static DEFINE_SPINLOCK(sio_lock); /****************** i2c adapter with gpio ***********************/ static struct i2c_gpio_platform_data i2c_pdata = { - .timeout = 200, - .udelay = 10, - .scl_is_output_only = 0, - .sda_is_open_drain = 0, - .scl_is_open_drain = 0, + .timeout = 200, + .udelay = 10, + .scl_is_output_only = 0, + .sda_is_open_drain = 0, + .scl_is_open_drain = 0, }; static struct gpiod_lookup_table rg_gpio_lookup_table = { @@ -81,272 +81,272 @@ static struct gpiod_lookup_table rg_gpio_lookup_table = { static void i2c_gpio_release(struct device *dev) { - return; + return; } static struct platform_device i2c_gpio = { - .name = "i2c-gpio", - .num_resources = 0, - .id = -1, - - .dev = { - .platform_data = &i2c_pdata, - .release = i2c_gpio_release, - } + .name = "i2c-gpio", + .num_resources = 0, + .id = -1, + + .dev = { + .platform_data = &i2c_pdata, + .release = i2c_gpio_release, + } }; static int xeon_gpio_get(struct gpio_chip *gc, unsigned gpio_num) { - unsigned int data; - unsigned int bank, offset; - unsigned long flags; + unsigned int data; + unsigned int bank, offset; + unsigned long flags; data = 0; - bank = gpio_num / BANKSIZE; - offset = gpio_num % BANKSIZE; - - GPIO_XEON_SPIN_LOCK(sio_lock, flags); - if (bank == 0) { - data = inl(GP_LVL) & (1 << offset); - if (data) { - data = 1; - } - } else if (bank == 1) { - data = inl(GP_LVL2) & (1 << offset); - if (data) { - data = 1; - } - } else if (bank == 2) { - data = inl(GP_LVL3) & (1 << offset); - if (data) { - data = 1; - } - } - GPIO_XEON_SPIN_UNLOCK(sio_lock, flags); - - return data; + bank = gpio_num / BANKSIZE; + offset = gpio_num % BANKSIZE; + + GPIO_XEON_SPIN_LOCK(sio_lock, flags); + if (bank == 0) { + data = inl(GP_LVL) & (1 << offset); + if (data) { + data = 1; + } + } else if (bank == 1) { + data = inl(GP_LVL2) & (1 << offset); + if (data) { + data = 1; + } + } else if (bank == 2) { + data = inl(GP_LVL3) & (1 << offset); + if (data) { + data = 1; + } + } + GPIO_XEON_SPIN_UNLOCK(sio_lock, flags); + + return data; } static int xeon_gpio_direction_in(struct gpio_chip *gc, unsigned gpio_num) { - unsigned int data; - unsigned int bank, offset; - unsigned long flags; - - bank = gpio_num / BANKSIZE; - offset = gpio_num % BANKSIZE; - - GPIO_XEON_SPIN_LOCK(sio_lock, flags); - if (bank == 0) { - data = inl(GP_IO_SEL); - data = data | (1 << offset); - outl(data, GP_IO_SEL); - } else if (bank == 1) { - data = inl(GP_IO_SEL2); - data = data | (1 << offset); - outl(data, GP_IO_SEL2); - } else if (bank == 2) { - data = inl(GP_IO_SEL3); - data = data | (1 << offset); - outl(data, GP_IO_SEL3); - } - GPIO_XEON_SPIN_UNLOCK(sio_lock, flags); - - return 0; + unsigned int data; + unsigned int bank, offset; + unsigned long flags; + + bank = gpio_num / BANKSIZE; + offset = gpio_num % BANKSIZE; + + GPIO_XEON_SPIN_LOCK(sio_lock, flags); + if (bank == 0) { + data = inl(GP_IO_SEL); + data = data | (1 << offset); + outl(data, GP_IO_SEL); + } else if (bank == 1) { + data = inl(GP_IO_SEL2); + data = data | (1 << offset); + outl(data, GP_IO_SEL2); + } else if (bank == 2) { + data = inl(GP_IO_SEL3); + data = data | (1 << offset); + outl(data, GP_IO_SEL3); + } + GPIO_XEON_SPIN_UNLOCK(sio_lock, flags); + + return 0; } static void xeon_gpio_set(struct gpio_chip *gc, - unsigned gpio_num, int val) + unsigned gpio_num, int val) { - unsigned int data; - unsigned int bank, offset; - unsigned long flags; - - bank = gpio_num / BANKSIZE; - offset = gpio_num % BANKSIZE; - - GPIO_XEON_SPIN_LOCK(sio_lock, flags); - if (bank == 0) { - data = inl(GP_LVL); - if (val) { - data = data | (1 << offset); - } else { - data = data & ~(1 << offset); - } - outl(data, GP_LVL); - } else if (bank == 1) { - data = inl(GP_LVL2); - if (val) { - data = data | (1 << offset); - } else { - data = data & ~(1 << offset); - } - outl(data, GP_LVL2); - } else if (bank == 2) { - data = inl(GP_LVL3); - if (val) { - data = data | (1 << offset); - } else { - data = data & ~(1 << offset); - } - outl(data, GP_LVL3); - } - GPIO_XEON_SPIN_UNLOCK(sio_lock, flags); + unsigned int data; + unsigned int bank, offset; + unsigned long flags; + + bank = gpio_num / BANKSIZE; + offset = gpio_num % BANKSIZE; + + GPIO_XEON_SPIN_LOCK(sio_lock, flags); + if (bank == 0) { + data = inl(GP_LVL); + if (val) { + data = data | (1 << offset); + } else { + data = data & ~(1 << offset); + } + outl(data, GP_LVL); + } else if (bank == 1) { + data = inl(GP_LVL2); + if (val) { + data = data | (1 << offset); + } else { + data = data & ~(1 << offset); + } + outl(data, GP_LVL2); + } else if (bank == 2) { + data = inl(GP_LVL3); + if (val) { + data = data | (1 << offset); + } else { + data = data & ~(1 << offset); + } + outl(data, GP_LVL3); + } + GPIO_XEON_SPIN_UNLOCK(sio_lock, flags); } static int xeon_gpio_direction_out(struct gpio_chip *gc, - unsigned gpio_num, int val) + unsigned gpio_num, int val) { - unsigned int data; - unsigned int bank, offset; - unsigned long flags; - - bank = gpio_num / BANKSIZE; - offset = gpio_num % BANKSIZE; - - GPIO_XEON_SPIN_LOCK(sio_lock, flags); - if (bank == 0) { - data = inl(GP_IO_SEL); - data = data & ~(1 << offset); - outl(data, GP_IO_SEL); - - data = inl(GP_LVL); - if (val) { - data = data | (1 << offset); - } else { - data = data & ~(1 << offset); - } - outl(data, GP_LVL); - } else if (bank == 1) { - data = inl(GP_IO_SEL2); - data = data & ~(1 << offset); - outl(data, GP_IO_SEL2); - - data = inl(GP_LVL2); - if (val) { - data = data | (1 << offset); - } else { - data = data & ~(1 << offset); - } - outl(data, GP_LVL2); - } else if (bank == 2) { - data = inl(GP_IO_SEL3); - data = data & ~(1 << offset); - outl(data, GP_IO_SEL3); - - data = inl(GP_LVL3); - if (val) { - data = data | (1 << offset); - } else { - data = data & ~(1 << offset); - } - outl(data, GP_LVL3); - } - GPIO_XEON_SPIN_UNLOCK(sio_lock, flags); - - return 0; + unsigned int data; + unsigned int bank, offset; + unsigned long flags; + + bank = gpio_num / BANKSIZE; + offset = gpio_num % BANKSIZE; + + GPIO_XEON_SPIN_LOCK(sio_lock, flags); + if (bank == 0) { + data = inl(GP_IO_SEL); + data = data & ~(1 << offset); + outl(data, GP_IO_SEL); + + data = inl(GP_LVL); + if (val) { + data = data | (1 << offset); + } else { + data = data & ~(1 << offset); + } + outl(data, GP_LVL); + } else if (bank == 1) { + data = inl(GP_IO_SEL2); + data = data & ~(1 << offset); + outl(data, GP_IO_SEL2); + + data = inl(GP_LVL2); + if (val) { + data = data | (1 << offset); + } else { + data = data & ~(1 << offset); + } + outl(data, GP_LVL2); + } else if (bank == 2) { + data = inl(GP_IO_SEL3); + data = data & ~(1 << offset); + outl(data, GP_IO_SEL3); + + data = inl(GP_LVL3); + if (val) { + data = data | (1 << offset); + } else { + data = data & ~(1 << offset); + } + outl(data, GP_LVL3); + } + GPIO_XEON_SPIN_UNLOCK(sio_lock, flags); + + return 0; } static int xeon_gpio_request(struct gpio_chip *chip, unsigned int offset) { - unsigned int data; - unsigned int bank, tmp_offset; - unsigned long flags; - - bank = offset / BANKSIZE; - tmp_offset = offset % BANKSIZE; - - GPIO_XEON_SPIN_LOCK(sio_lock, flags); - if (bank == 0) { - data = inl(GPIO_USE_SEL); - data = data | (1 << tmp_offset); - outl(data, GPIO_USE_SEL); - } else if (bank == 1) { - data = inl(GPIO_USE_SEL2); - data = data | (1 << tmp_offset); - outl(data, GPIO_USE_SEL2); - } else if (bank == 2) { - data = inl(GPIO_USE_SEL3); - data = data | (1 << tmp_offset); - outl(data, GPIO_USE_SEL3); - } - GPIO_XEON_SPIN_UNLOCK(sio_lock, flags); - return 0; + unsigned int data; + unsigned int bank, tmp_offset; + unsigned long flags; + + bank = offset / BANKSIZE; + tmp_offset = offset % BANKSIZE; + + GPIO_XEON_SPIN_LOCK(sio_lock, flags); + if (bank == 0) { + data = inl(GPIO_USE_SEL); + data = data | (1 << tmp_offset); + outl(data, GPIO_USE_SEL); + } else if (bank == 1) { + data = inl(GPIO_USE_SEL2); + data = data | (1 << tmp_offset); + outl(data, GPIO_USE_SEL2); + } else if (bank == 2) { + data = inl(GPIO_USE_SEL3); + data = data | (1 << tmp_offset); + outl(data, GPIO_USE_SEL3); + } + GPIO_XEON_SPIN_UNLOCK(sio_lock, flags); + return 0; } static void xeon_gpio_free(struct gpio_chip *chip, unsigned int offset) { - unsigned int data; - unsigned int bank, tmp_offset; - unsigned long flags; - - bank = offset / BANKSIZE; - tmp_offset = offset % BANKSIZE; - - GPIO_XEON_SPIN_LOCK(sio_lock, flags); - if (bank == 0) { - data = inl(GPIO_USE_SEL); - data = data & ~(1 << tmp_offset); - outl(data, GPIO_USE_SEL); - } else if (bank == 1) { - data = inl(GPIO_USE_SEL2); - data = data & ~(1 << tmp_offset); - outl(data, GPIO_USE_SEL2); - } else if (bank == 2) { - data = inl(GPIO_USE_SEL3); - data = data & ~(1 << tmp_offset); - outl(data, GPIO_USE_SEL3); - } - GPIO_XEON_SPIN_UNLOCK(sio_lock, flags); + unsigned int data; + unsigned int bank, tmp_offset; + unsigned long flags; + + bank = offset / BANKSIZE; + tmp_offset = offset % BANKSIZE; + + GPIO_XEON_SPIN_LOCK(sio_lock, flags); + if (bank == 0) { + data = inl(GPIO_USE_SEL); + data = data & ~(1 << tmp_offset); + outl(data, GPIO_USE_SEL); + } else if (bank == 1) { + data = inl(GPIO_USE_SEL2); + data = data & ~(1 << tmp_offset); + outl(data, GPIO_USE_SEL2); + } else if (bank == 2) { + data = inl(GPIO_USE_SEL3); + data = data & ~(1 << tmp_offset); + outl(data, GPIO_USE_SEL3); + } + GPIO_XEON_SPIN_UNLOCK(sio_lock, flags); } static struct gpio_chip xeon_gpio_chip = { - .label = GPIO_NAME, - .owner = THIS_MODULE, - .get = xeon_gpio_get, - .direction_input = xeon_gpio_direction_in, - .set = xeon_gpio_set, - .direction_output = xeon_gpio_direction_out, - .request = xeon_gpio_request, - .free = xeon_gpio_free, + .label = GPIO_NAME, + .owner = THIS_MODULE, + .get = xeon_gpio_get, + .direction_input = xeon_gpio_direction_in, + .set = xeon_gpio_set, + .direction_output = xeon_gpio_direction_out, + .request = xeon_gpio_request, + .free = xeon_gpio_free, }; static int __init xeon_gpio_init(void) { - int err; - if (!request_region(GPIO_BASE, GPIO_IOSIZE, GPIO_NAME)) - return -EBUSY; - - xeon_gpio_chip.base = GPIO_BASE_ID; - xeon_gpio_chip.ngpio = 96; - - err = gpiochip_add_data(&xeon_gpio_chip, NULL); - if (err < 0) - goto gpiochip_add_err; - gpiod_add_lookup_table(&rg_gpio_lookup_table); - err = platform_device_register(&i2c_gpio); - if (err < 0) { - goto i2c_get_adapter_err; - } - return 0; + int err; + if (!request_region(GPIO_BASE, GPIO_IOSIZE, GPIO_NAME)) + return -EBUSY; + + xeon_gpio_chip.base = GPIO_BASE_ID; + xeon_gpio_chip.ngpio = 96; + + err = gpiochip_add_data(&xeon_gpio_chip, NULL); + if (err < 0) + goto gpiochip_add_err; + gpiod_add_lookup_table(&rg_gpio_lookup_table); + err = platform_device_register(&i2c_gpio); + if (err < 0) { + goto i2c_get_adapter_err; + } + return 0; i2c_get_adapter_err: - gpiod_remove_lookup_table(&rg_gpio_lookup_table); - platform_device_unregister(&i2c_gpio); - gpiochip_remove(&xeon_gpio_chip); + gpiod_remove_lookup_table(&rg_gpio_lookup_table); + platform_device_unregister(&i2c_gpio); + gpiochip_remove(&xeon_gpio_chip); gpiochip_add_err: - release_region(GPIO_BASE, GPIO_IOSIZE); - return -1; + release_region(GPIO_BASE, GPIO_IOSIZE); + return -1; } static void __exit xeon_gpio_exit(void) { - gpiod_remove_lookup_table(&rg_gpio_lookup_table); - platform_device_unregister(&i2c_gpio); - mdelay(100); - gpiochip_remove(&xeon_gpio_chip); - release_region(GPIO_BASE, GPIO_IOSIZE); + gpiod_remove_lookup_table(&rg_gpio_lookup_table); + platform_device_unregister(&i2c_gpio); + mdelay(100); + gpiochip_remove(&xeon_gpio_chip); + release_region(GPIO_BASE, GPIO_IOSIZE); } module_init(xeon_gpio_init); diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/rg-i2c-algo-bit.c b/platform/broadcom/sonic-platform-modules-ragile/common/modules/rg-i2c-algo-bit.c new file mode 100644 index 000000000000..5e8f2c29d2a0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/rg-i2c-algo-bit.c @@ -0,0 +1,734 @@ +/* ------------------------------------------------------------------------- + * i2c-algo-bit.c i2c driver algorithms for bit-shift adapters + * ------------------------------------------------------------------------- + * Copyright (C) 1995-2000 Simon G. Vogl + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + * ------------------------------------------------------------------------- */ + +/* With some changes from Frodo Looijaard , Kyösti Mälkki + and Jean Delvare */ + +#include +#include +#include +#include +#include +#include +#include + + +/* ----- global defines ----------------------------------------------- */ + +#ifdef DEBUG +#define bit_dbg(level, dev, format, args...) \ + do { \ + if (i2c_debug >= level) \ + dev_dbg(dev, format, ##args); \ + } while (0) +#else +#define bit_dbg(level, dev, format, args...) \ + do {} while (0) +#endif /* DEBUG */ + +/* ----- global variables --------------------------------------------- */ + +static int bit_test; /* see if the line-setting functions work */ +module_param(bit_test, int, S_IRUGO); +MODULE_PARM_DESC(bit_test, "lines testing - 0 off; 1 report; 2 fail if stuck"); + +#ifdef DEBUG +static int i2c_debug = 1; +module_param(i2c_debug, int, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(i2c_debug, + "debug level - 0 off; 1 normal; 2 verbose; 3 very verbose"); +#endif + +/* --- setting states on the bus with the right timing: --------------- */ + +#define setsda(adap, val) adap->setsda(adap->data, val) +#define setscl(adap, val) adap->setscl(adap->data, val) +#define getsda(adap) adap->getsda(adap->data) +#define getscl(adap) adap->getscl(adap->data) + +static inline void sdalo(struct i2c_algo_bit_data *adap) +{ + setsda(adap, 0); + udelay((adap->udelay + 1) / 2); +} + +static inline void sdahi(struct i2c_algo_bit_data *adap) +{ + setsda(adap, 1); + udelay((adap->udelay + 1) / 2); +} + +static inline void scllo(struct i2c_algo_bit_data *adap) +{ + setscl(adap, 0); + udelay(adap->udelay / 2); +} + +/* + * Raise scl line, and do checking for delays. This is necessary for slower + * devices. + */ +static int sclhi(struct i2c_algo_bit_data *adap) +{ + unsigned long start; + + setscl(adap, 1); + + /* Not all adapters have scl sense line... */ + if (!adap->getscl) + goto done; + + start = jiffies; + while (!getscl(adap)) { + /* This hw knows how to read the clock line, so we wait + * until it actually gets high. This is safer as some + * chips may hold it low ("clock stretching") while they + * are processing data internally. + */ + if (time_after(jiffies, start + adap->timeout)) { + /* Test one last time, as we may have been preempted + * between last check and timeout test. + */ + if (getscl(adap)) + break; + return -ETIMEDOUT; + } + cpu_relax(); + } +#ifdef DEBUG + if (jiffies != start && i2c_debug >= 3) + pr_debug("i2c-algo-bit: needed %ld jiffies for SCL to go high\n", + jiffies - start); +#endif + +done: + udelay(adap->udelay); + return 0; +} + + +/* --- other auxiliary functions -------------------------------------- */ +static void i2c_start(struct i2c_algo_bit_data *adap) +{ + /* assert: scl, sda are high */ + setsda(adap, 0); + udelay(adap->udelay); + scllo(adap); +} + +static void i2c_repstart(struct i2c_algo_bit_data *adap) +{ + /* assert: scl is low */ + sdahi(adap); + sclhi(adap); + setsda(adap, 0); + udelay(adap->udelay); + scllo(adap); +} + + +static void i2c_stop(struct i2c_algo_bit_data *adap) +{ + /* assert: scl is low */ + sdalo(adap); + sclhi(adap); + setsda(adap, 1); + udelay(adap->udelay); +} + + + +/* send a byte without start cond., look for arbitration, + check ackn. from slave */ +/* returns: + * 1 if the device acknowledged + * 0 if the device did not ack + * -ETIMEDOUT if an error occurred (while raising the scl line) + */ +static int i2c_outb(struct i2c_adapter *i2c_adap, unsigned char c) +{ + int i; + int sb; + int ack; + struct i2c_algo_bit_data *adap = i2c_adap->algo_data; + + /* assert: scl is low */ + for (i = 7; i >= 0; i--) { + sb = (c >> i) & 1; + setsda(adap, sb); + udelay((adap->udelay + 1) / 2); + if (sclhi(adap) < 0) { /* timed out */ + bit_dbg(1, &i2c_adap->dev, + "i2c_outb: 0x%02x, timeout at bit #%d\n", + (int)c, i); + return -ETIMEDOUT; + } + /* FIXME do arbitration here: + * if (sb && !getsda(adap)) -> ouch! Get out of here. + * + * Report a unique code, so higher level code can retry + * the whole (combined) message and *NOT* issue STOP. + */ + scllo(adap); + } + sdahi(adap); + if (sclhi(adap) < 0) { /* timeout */ + bit_dbg(1, &i2c_adap->dev, + "i2c_outb: 0x%02x, timeout at ack\n", (int)c); + return -ETIMEDOUT; + } + + /* read ack: SDA should be pulled down by slave, or it may + * NAK (usually to report problems with the data we wrote). + */ + ack = !getsda(adap); /* ack: sda is pulled low -> success */ + bit_dbg(2, &i2c_adap->dev, "i2c_outb: 0x%02x %s\n", (int)c, + ack ? "A" : "NA"); + + scllo(adap); + return ack; + /* assert: scl is low (sda undef) */ +} + + +static int i2c_inb(struct i2c_adapter *i2c_adap) +{ + /* read byte via i2c port, without start/stop sequence */ + /* acknowledge is sent in i2c_read. */ + int i; + unsigned char indata = 0; + struct i2c_algo_bit_data *adap = i2c_adap->algo_data; + + /* assert: scl is low */ + sdahi(adap); + for (i = 0; i < 8; i++) { + if (sclhi(adap) < 0) { /* timeout */ + bit_dbg(1, &i2c_adap->dev, + "i2c_inb: timeout at bit #%d\n", + 7 - i); + return -ETIMEDOUT; + } + indata *= 2; + if (getsda(adap)) + indata |= 0x01; + setscl(adap, 0); + udelay(i == 7 ? adap->udelay / 2 : adap->udelay); + } + /* assert: scl is low */ + return indata; +} + +/* + * Sanity check for the adapter hardware - check the reaction of + * the bus lines only if it seems to be idle. + */ +static int test_bus(struct i2c_adapter *i2c_adap) +{ + struct i2c_algo_bit_data *adap = i2c_adap->algo_data; + const char *name = i2c_adap->name; + int scl, sda, ret; + + if (adap->pre_xfer) { + ret = adap->pre_xfer(i2c_adap); + if (ret < 0) + return -ENODEV; + } + + if (adap->getscl == NULL) + pr_info("%s: Testing SDA only, SCL is not readable\n", name); + + sda = getsda(adap); + scl = (adap->getscl == NULL) ? 1 : getscl(adap); + if (!scl || !sda) { + printk(KERN_WARNING + "%s: bus seems to be busy (scl=%d, sda=%d)\n", + name, scl, sda); + goto bailout; + } + + sdalo(adap); + sda = getsda(adap); + scl = (adap->getscl == NULL) ? 1 : getscl(adap); + if (sda) { + printk(KERN_WARNING "%s: SDA stuck high!\n", name); + goto bailout; + } + if (!scl) { + printk(KERN_WARNING + "%s: SCL unexpected low while pulling SDA low!\n", + name); + goto bailout; + } + + sdahi(adap); + sda = getsda(adap); + scl = (adap->getscl == NULL) ? 1 : getscl(adap); + if (!sda) { + printk(KERN_WARNING "%s: SDA stuck low!\n", name); + goto bailout; + } + if (!scl) { + printk(KERN_WARNING + "%s: SCL unexpected low while pulling SDA high!\n", + name); + goto bailout; + } + + scllo(adap); + sda = getsda(adap); + scl = (adap->getscl == NULL) ? 0 : getscl(adap); + if (scl) { + printk(KERN_WARNING "%s: SCL stuck high!\n", name); + goto bailout; + } + if (!sda) { + printk(KERN_WARNING + "%s: SDA unexpected low while pulling SCL low!\n", + name); + goto bailout; + } + + sclhi(adap); + sda = getsda(adap); + scl = (adap->getscl == NULL) ? 1 : getscl(adap); + if (!scl) { + printk(KERN_WARNING "%s: SCL stuck low!\n", name); + goto bailout; + } + if (!sda) { + printk(KERN_WARNING + "%s: SDA unexpected low while pulling SCL high!\n", + name); + goto bailout; + } + + if (adap->post_xfer) + adap->post_xfer(i2c_adap); + + pr_info("%s: Test OK\n", name); + return 0; +bailout: + sdahi(adap); + sclhi(adap); + + if (adap->post_xfer) + adap->post_xfer(i2c_adap); + + return -ENODEV; +} + +/* ----- Utility functions +*/ + +/* try_address tries to contact a chip for a number of + * times before it gives up. + * return values: + * 1 chip answered + * 0 chip did not answer + * -x transmission error + */ +static int try_address(struct i2c_adapter *i2c_adap, + unsigned char addr, int retries) +{ + struct i2c_algo_bit_data *adap = i2c_adap->algo_data; + int i, ret = 0; + + for (i = 0; i <= retries; i++) { + ret = i2c_outb(i2c_adap, addr); + if (ret == 1 || i == retries) + break; + bit_dbg(3, &i2c_adap->dev, "emitting stop condition\n"); + i2c_stop(adap); + udelay(adap->udelay); + yield(); + bit_dbg(3, &i2c_adap->dev, "emitting start condition\n"); + i2c_start(adap); + } + if (i && ret) + bit_dbg(1, &i2c_adap->dev, + "Used %d tries to %s client at 0x%02x: %s\n", i + 1, + addr & 1 ? "read from" : "write to", addr >> 1, + ret == 1 ? "success" : "failed, timeout?"); + return ret; +} + +static int sendbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) +{ + const unsigned char *temp = msg->buf; + int count = msg->len; + unsigned short nak_ok = msg->flags & I2C_M_IGNORE_NAK; + int retval; + int wrcount = 0; + + while (count > 0) { + retval = i2c_outb(i2c_adap, *temp); + + /* OK/ACK; or ignored NAK */ + if ((retval > 0) || (nak_ok && (retval == 0))) { + count--; + temp++; + wrcount++; + + /* A slave NAKing the master means the slave didn't like + * something about the data it saw. For example, maybe + * the SMBus PEC was wrong. + */ + } else if (retval == 0) { + dev_err(&i2c_adap->dev, "sendbytes: NAK bailout.\n"); + return -EIO; + + /* Timeout; or (someday) lost arbitration + * + * FIXME Lost ARB implies retrying the transaction from + * the first message, after the "winning" master issues + * its STOP. As a rule, upper layer code has no reason + * to know or care about this ... it is *NOT* an error. + */ + } else { + dev_err(&i2c_adap->dev, "sendbytes: error %d\n", + retval); + return retval; + } + } + return wrcount; +} + +static int acknak(struct i2c_adapter *i2c_adap, int is_ack) +{ + struct i2c_algo_bit_data *adap = i2c_adap->algo_data; + + /* assert: sda is high */ + if (is_ack) /* send ack */ + setsda(adap, 0); + udelay((adap->udelay + 1) / 2); + if (sclhi(adap) < 0) { /* timeout */ + dev_err(&i2c_adap->dev, "readbytes: ack/nak timeout\n"); + return -ETIMEDOUT; + } + scllo(adap); + return 0; +} + +static int readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) +{ + int inval; + int rdcount = 0; /* counts bytes read */ + unsigned char *temp = msg->buf; + int count = msg->len; + const unsigned flags = msg->flags; + + while (count > 0) { + inval = i2c_inb(i2c_adap); + if (inval >= 0) { + *temp = inval; + rdcount++; + } else { /* read timed out */ + break; + } + + temp++; + count--; + + /* Some SMBus transactions require that we receive the + transaction length as the first read byte. */ + if (rdcount == 1 && (flags & I2C_M_RECV_LEN)) { + if (inval <= 0 || inval > I2C_SMBUS_BLOCK_MAX) { + if (!(flags & I2C_M_NO_RD_ACK)) + acknak(i2c_adap, 0); + dev_err(&i2c_adap->dev, + "readbytes: invalid block length (%d)\n", + inval); + return -EPROTO; + } + /* The original count value accounts for the extra + bytes, that is, either 1 for a regular transaction, + or 2 for a PEC transaction. */ + count += inval; + msg->len += inval; + } + + bit_dbg(2, &i2c_adap->dev, "readbytes: 0x%02x %s\n", + inval, + (flags & I2C_M_NO_RD_ACK) + ? "(no ack/nak)" + : (count ? "A" : "NA")); + + if (!(flags & I2C_M_NO_RD_ACK)) { + inval = acknak(i2c_adap, count); + if (inval < 0) + return inval; + } + } + return rdcount; +} + +/* doAddress initiates the transfer by generating the start condition (in + * try_address) and transmits the address in the necessary format to handle + * reads, writes as well as 10bit-addresses. + * returns: + * 0 everything went okay, the chip ack'ed, or IGNORE_NAK flag was set + * -x an error occurred (like: -ENXIO if the device did not answer, or + * -ETIMEDOUT, for example if the lines are stuck...) + */ +static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) +{ + unsigned short flags = msg->flags; + unsigned short nak_ok = msg->flags & I2C_M_IGNORE_NAK; + struct i2c_algo_bit_data *adap = i2c_adap->algo_data; + + unsigned char addr; + int ret, retries; + + retries = nak_ok ? 0 : i2c_adap->retries; + + if (flags & I2C_M_TEN) { + /* a ten bit address */ + addr = 0xf0 | ((msg->addr >> 7) & 0x06); + bit_dbg(2, &i2c_adap->dev, "addr0: %d\n", addr); + /* try extended address code...*/ + ret = try_address(i2c_adap, addr, retries); + if ((ret != 1) && !nak_ok) { + dev_err(&i2c_adap->dev, + "died at extended address code\n"); + return -ENXIO; + } + /* the remaining 8 bit address */ + ret = i2c_outb(i2c_adap, msg->addr & 0xff); + if ((ret != 1) && !nak_ok) { + /* the chip did not ack / xmission error occurred */ + dev_err(&i2c_adap->dev, "died at 2nd address code\n"); + return -ENXIO; + } + if (flags & I2C_M_RD) { + bit_dbg(3, &i2c_adap->dev, + "emitting repeated start condition\n"); + i2c_repstart(adap); + /* okay, now switch into reading mode */ + addr |= 0x01; + ret = try_address(i2c_adap, addr, retries); + if ((ret != 1) && !nak_ok) { + dev_err(&i2c_adap->dev, + "died at repeated address code\n"); + return -EIO; + } + } + } else { /* normal 7bit address */ + addr = i2c_8bit_addr_from_msg(msg); + if (flags & I2C_M_REV_DIR_ADDR) + addr ^= 1; + ret = try_address(i2c_adap, addr, retries); + if ((ret != 1) && !nak_ok) + return -ENXIO; + } + + return 0; +} + +static void bit_i2c_unblock(struct i2c_adapter *i2c_adap) +{ + int i; + struct i2c_algo_bit_data *adap = i2c_adap->algo_data; + + for (i = 0; i < 9; i++) { + setscl(adap, 0); + udelay(5); + setscl(adap, 1); + udelay(5); + } + setscl(adap, 0); + setsda(adap, 0); + udelay(5); + setscl(adap, 1); + udelay(5); + setsda(adap, 1); +} + +static int check_bit_i2c_unblock(struct i2c_adapter *i2c_adap) +{ + struct i2c_algo_bit_data *adap = i2c_adap->algo_data; + int sda, scl; + + sda = getsda(adap); + scl = getscl(adap); + if ((sda == 0) && scl) { + // I2C_ALGO_BIT_ERROR("SCL is high and SDA is low, send 9 clock to device.\n"); + bit_i2c_unblock(i2c_adap); + } + + sda = getsda(adap); + scl = getscl(adap); + if (sda && scl) { + // I2C_ALGO_BIT_DEBUG("SCL and SDA are both high, i2c level check ok.\n"); + return 0; + } + dev_warn(&i2c_adap->dev, "Check i2c level failed, SCL %s, SDA %s.\n", scl ? "high" : "low", sda ? "high" : "low"); + return -EIO; +} + +static int bit_xfer(struct i2c_adapter *i2c_adap, + struct i2c_msg msgs[], int num) +{ + struct i2c_msg *pmsg; + struct i2c_algo_bit_data *adap = i2c_adap->algo_data; + int i, ret; + unsigned short nak_ok; + + if (adap->pre_xfer) { + ret = adap->pre_xfer(i2c_adap); + if (ret < 0) + return ret; + } + + if (check_bit_i2c_unblock(i2c_adap) < 0) { + // I2C_ALGO_BIT_ERROR("check i2c is block.\n"); + return -EIO; + } + + bit_dbg(3, &i2c_adap->dev, "emitting start condition\n"); + i2c_start(adap); + for (i = 0; i < num; i++) { + pmsg = &msgs[i]; + nak_ok = pmsg->flags & I2C_M_IGNORE_NAK; + if (!(pmsg->flags & I2C_M_NOSTART)) { + if (i) { + if (msgs[i - 1].flags & I2C_M_STOP) { + bit_dbg(3, &i2c_adap->dev, + "emitting enforced stop/start condition\n"); + i2c_stop(adap); + i2c_start(adap); + } else { + bit_dbg(3, &i2c_adap->dev, + "emitting repeated start condition\n"); + i2c_repstart(adap); + } + } + ret = bit_doAddress(i2c_adap, pmsg); + if ((ret != 0) && !nak_ok) { + bit_dbg(1, &i2c_adap->dev, + "NAK from device addr 0x%02x msg #%d\n", + msgs[i].addr, i); + goto bailout; + } + } + if (pmsg->flags & I2C_M_RD) { + /* read bytes into buffer*/ + ret = readbytes(i2c_adap, pmsg); + if (ret >= 1) + bit_dbg(2, &i2c_adap->dev, "read %d byte%s\n", + ret, ret == 1 ? "" : "s"); + if (ret < pmsg->len) { + if (ret >= 0) + ret = -EIO; + goto bailout; + } + } else { + /* write bytes from buffer */ + ret = sendbytes(i2c_adap, pmsg); + if (ret >= 1) + bit_dbg(2, &i2c_adap->dev, "wrote %d byte%s\n", + ret, ret == 1 ? "" : "s"); + if (ret < pmsg->len) { + if (ret >= 0) + ret = -EIO; + goto bailout; + } + } + } + ret = i; + +bailout: + bit_dbg(3, &i2c_adap->dev, "emitting stop condition\n"); + i2c_stop(adap); + + if (adap->post_xfer) + adap->post_xfer(i2c_adap); + return ret; +} + +static u32 bit_func(struct i2c_adapter *adap) +{ + return I2C_FUNC_I2C | I2C_FUNC_NOSTART | I2C_FUNC_SMBUS_EMUL | + I2C_FUNC_SMBUS_READ_BLOCK_DATA | + I2C_FUNC_SMBUS_BLOCK_PROC_CALL | + I2C_FUNC_10BIT_ADDR | I2C_FUNC_PROTOCOL_MANGLING; +} + + +/* -----exported algorithm data: ------------------------------------- */ + +const struct i2c_algorithm rg_i2c_bit_algo = { + .master_xfer = bit_xfer, + .functionality = bit_func, +}; +EXPORT_SYMBOL(rg_i2c_bit_algo); + +static const struct i2c_adapter_quirks i2c_bit_quirk_no_clk_stretch = { + .flags = I2C_AQ_NO_CLK_STRETCH, +}; + +/* + * registering functions to load algorithms at runtime + */ +static int __i2c_bit_add_bus(struct i2c_adapter *adap, + int (*add_adapter)(struct i2c_adapter *)) +{ + struct i2c_algo_bit_data *bit_adap = adap->algo_data; + int ret; + + if (bit_test) { + ret = test_bus(adap); + if (bit_test >= 2 && ret < 0) + return -ENODEV; + } + + /* register new adapter to i2c module... */ + adap->algo = &rg_i2c_bit_algo; + adap->retries = 3; + if (bit_adap->getscl == NULL) + adap->quirks = &i2c_bit_quirk_no_clk_stretch; + + /* + * We tried forcing SCL/SDA to an initial state here. But that caused a + * regression, sadly. Check Bugzilla #200045 for details. + */ + + ret = add_adapter(adap); + if (ret < 0) + return ret; + + /* Complain if SCL can't be read */ + if (bit_adap->getscl == NULL) { + dev_warn(&adap->dev, "Not I2C compliant: can't read SCL\n"); + dev_warn(&adap->dev, "Bus may be unreliable\n"); + } + return 0; +} + +int rg_i2c_bit_add_bus(struct i2c_adapter *adap) +{ + return __i2c_bit_add_bus(adap, i2c_add_adapter); +} +EXPORT_SYMBOL(rg_i2c_bit_add_bus); + +int rg_i2c_bit_add_numbered_bus(struct i2c_adapter *adap) +{ + return __i2c_bit_add_bus(adap, i2c_add_numbered_adapter); +} +EXPORT_SYMBOL(rg_i2c_bit_add_numbered_bus); + +MODULE_AUTHOR("Simon G. Vogl "); +MODULE_DESCRIPTION("I2C-Bus bit-banging algorithm"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/rg-i2c-gpio.c b/platform/broadcom/sonic-platform-modules-ragile/common/modules/rg-i2c-gpio.c new file mode 100644 index 000000000000..bce3afac61a5 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/rg-i2c-gpio.c @@ -0,0 +1,431 @@ +/* + * Bitbanging I2C bus driver using the GPIO API + * + * Copyright (C) 2007 Atmel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern int rg_i2c_bit_add_numbered_bus(struct i2c_adapter *adap); + +struct i2c_gpio_private_data { + struct gpio_desc *sda; + struct gpio_desc *scl; + struct i2c_adapter adap; + struct i2c_algo_bit_data bit_data; + struct i2c_gpio_platform_data pdata; +#ifdef CONFIG_I2C_GPIO_FAULT_INJECTOR + struct dentry *debug_dir; +#endif +}; + +/* + * Toggle SDA by changing the output value of the pin. This is only + * valid for pins configured as open drain (i.e. setting the value + * high effectively turns off the output driver.) + */ +static void i2c_gpio_setsda_val(void *data, int state) +{ + struct i2c_gpio_private_data *priv = data; + + gpiod_set_value_cansleep(priv->sda, state); +} + +/* + * Toggle SCL by changing the output value of the pin. This is used + * for pins that are configured as open drain and for output-only + * pins. The latter case will break the i2c protocol, but it will + * often work in practice. + */ +static void i2c_gpio_setscl_val(void *data, int state) +{ + struct i2c_gpio_private_data *priv = data; + + gpiod_set_value_cansleep(priv->scl, state); +} + +static int i2c_gpio_getsda(void *data) +{ + struct i2c_gpio_private_data *priv = data; + + return gpiod_get_value_cansleep(priv->sda); +} + +static int i2c_gpio_getscl(void *data) +{ + struct i2c_gpio_private_data *priv = data; + + return gpiod_get_value_cansleep(priv->scl); +} + +#ifdef CONFIG_I2C_GPIO_FAULT_INJECTOR +static struct dentry *i2c_gpio_debug_dir; + +#define setsda(bd, val) ((bd)->setsda((bd)->data, val)) +#define setscl(bd, val) ((bd)->setscl((bd)->data, val)) +#define getsda(bd) ((bd)->getsda((bd)->data)) +#define getscl(bd) ((bd)->getscl((bd)->data)) + +#define WIRE_ATTRIBUTE(wire) \ + static int fops_##wire##_get(void *data, u64 *val) \ +{ \ + struct i2c_gpio_private_data *priv = data; \ + \ + i2c_lock_bus(&priv->adap, I2C_LOCK_ROOT_ADAPTER); \ + *val = get##wire(&priv->bit_data); \ + i2c_unlock_bus(&priv->adap, I2C_LOCK_ROOT_ADAPTER); \ + return 0; \ +} \ +static int fops_##wire##_set(void *data, u64 val) \ +{ \ + struct i2c_gpio_private_data *priv = data; \ + \ + i2c_lock_bus(&priv->adap, I2C_LOCK_ROOT_ADAPTER); \ + set##wire(&priv->bit_data, val); \ + i2c_unlock_bus(&priv->adap, I2C_LOCK_ROOT_ADAPTER); \ + return 0; \ +} \ +DEFINE_DEBUGFS_ATTRIBUTE(fops_##wire, fops_##wire##_get, fops_##wire##_set, "%llu\n") + +WIRE_ATTRIBUTE(scl); +WIRE_ATTRIBUTE(sda); + +static void i2c_gpio_incomplete_transfer(struct i2c_gpio_private_data *priv, + u32 pattern, u8 pattern_size) +{ + struct i2c_algo_bit_data *bit_data = &priv->bit_data; + int i; + + i2c_lock_bus(&priv->adap, I2C_LOCK_ROOT_ADAPTER); + + /* START condition */ + setsda(bit_data, 0); + udelay(bit_data->udelay); + + /* Send pattern, request ACK, don't send STOP */ + for (i = pattern_size - 1; i >= 0; i--) { + setscl(bit_data, 0); + udelay(bit_data->udelay / 2); + setsda(bit_data, (pattern >> i) & 1); + udelay((bit_data->udelay + 1) / 2); + setscl(bit_data, 1); + udelay(bit_data->udelay); + } + + i2c_unlock_bus(&priv->adap, I2C_LOCK_ROOT_ADAPTER); +} + +static int fops_incomplete_addr_phase_set(void *data, u64 addr) +{ + struct i2c_gpio_private_data *priv = data; + u32 pattern; + + if (addr > 0x7f) + return -EINVAL; + + /* ADDR (7 bit) + RD (1 bit) + Client ACK, keep SDA hi (1 bit) */ + pattern = (addr << 2) | 3; + + i2c_gpio_incomplete_transfer(priv, pattern, 9); + + return 0; +} +DEFINE_DEBUGFS_ATTRIBUTE(fops_incomplete_addr_phase, NULL, fops_incomplete_addr_phase_set, "%llu\n"); + +static int fops_incomplete_write_byte_set(void *data, u64 addr) +{ + struct i2c_gpio_private_data *priv = data; + u32 pattern; + + if (addr > 0x7f) + return -EINVAL; + + /* ADDR (7 bit) + WR (1 bit) + Client ACK (1 bit) */ + pattern = (addr << 2) | 1; + /* 0x00 (8 bit) + Client ACK, keep SDA hi (1 bit) */ + pattern = (pattern << 9) | 1; + + i2c_gpio_incomplete_transfer(priv, pattern, 18); + + return 0; +} +DEFINE_DEBUGFS_ATTRIBUTE(fops_incomplete_write_byte, NULL, fops_incomplete_write_byte_set, "%llu\n"); + +static void i2c_gpio_fault_injector_init(struct platform_device *pdev) +{ + struct i2c_gpio_private_data *priv = platform_get_drvdata(pdev); + + /* + * If there will be a debugfs-dir per i2c adapter somewhen, put the + * 'fault-injector' dir there. Until then, we have a global dir with + * all adapters as subdirs. + */ + if (!i2c_gpio_debug_dir) { + i2c_gpio_debug_dir = debugfs_create_dir("i2c-fault-injector", NULL); + if (!i2c_gpio_debug_dir) + return; + } + + priv->debug_dir = debugfs_create_dir(pdev->name, i2c_gpio_debug_dir); + if (!priv->debug_dir) + return; + + debugfs_create_file_unsafe("scl", 0600, priv->debug_dir, priv, &fops_scl); + debugfs_create_file_unsafe("sda", 0600, priv->debug_dir, priv, &fops_sda); + debugfs_create_file_unsafe("incomplete_address_phase", 0200, priv->debug_dir, + priv, &fops_incomplete_addr_phase); + debugfs_create_file_unsafe("incomplete_write_byte", 0200, priv->debug_dir, + priv, &fops_incomplete_write_byte); +} + +static void i2c_gpio_fault_injector_exit(struct platform_device *pdev) +{ + struct i2c_gpio_private_data *priv = platform_get_drvdata(pdev); + + debugfs_remove_recursive(priv->debug_dir); +} +#else +static inline void i2c_gpio_fault_injector_init(struct platform_device *pdev) {} +static inline void i2c_gpio_fault_injector_exit(struct platform_device *pdev) {} +#endif /* CONFIG_I2C_GPIO_FAULT_INJECTOR*/ + +static void of_i2c_gpio_get_props(struct device_node *np, + struct i2c_gpio_platform_data *pdata) +{ + u32 reg; + + of_property_read_u32(np, "i2c-gpio,delay-us", &pdata->udelay); + + if (!of_property_read_u32(np, "i2c-gpio,timeout-ms", ®)) + pdata->timeout = msecs_to_jiffies(reg); + + pdata->sda_is_open_drain = + of_property_read_bool(np, "i2c-gpio,sda-open-drain"); + pdata->scl_is_open_drain = + of_property_read_bool(np, "i2c-gpio,scl-open-drain"); + pdata->scl_is_output_only = + of_property_read_bool(np, "i2c-gpio,scl-output-only"); +} + +static struct gpio_desc *i2c_gpio_get_desc(struct device *dev, + const char *con_id, + unsigned int index, + enum gpiod_flags gflags) +{ + struct gpio_desc *retdesc; + int ret; + + retdesc = devm_gpiod_get(dev, con_id, gflags); + if (!IS_ERR(retdesc)) { + dev_dbg(dev, "got GPIO from name %s\n", con_id); + return retdesc; + } + + retdesc = devm_gpiod_get_index(dev, NULL, index, gflags); + if (!IS_ERR(retdesc)) { + dev_dbg(dev, "got GPIO from index %u\n", index); + return retdesc; + } + + ret = PTR_ERR(retdesc); + + /* FIXME: hack in the old code, is this really necessary? */ + if (ret == -EINVAL) + retdesc = ERR_PTR(-EPROBE_DEFER); + + /* This happens if the GPIO driver is not yet probed, let's defer */ + if (ret == -ENOENT) + retdesc = ERR_PTR(-EPROBE_DEFER); + + if (PTR_ERR(retdesc) != -EPROBE_DEFER) + dev_err(dev, "error trying to get descriptor: %d\n", ret); + + return retdesc; +} + +static int i2c_gpio_probe(struct platform_device *pdev) +{ + struct i2c_gpio_private_data *priv; + struct i2c_gpio_platform_data *pdata; + struct i2c_algo_bit_data *bit_data; + struct i2c_adapter *adap; + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + enum gpiod_flags gflags; + int ret; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + adap = &priv->adap; + bit_data = &priv->bit_data; + pdata = &priv->pdata; + + if (np) { + of_i2c_gpio_get_props(np, pdata); + } else { + /* + * If all platform data settings are zero it is OK + * to not provide any platform data from the board. + */ + if (dev_get_platdata(dev)) + memcpy(pdata, dev_get_platdata(dev), sizeof(*pdata)); + } + + /* + * First get the GPIO pins; if it fails, we'll defer the probe. + * If the SDA line is marked from platform data or device tree as + * "open drain" it means something outside of our control is making + * this line being handled as open drain, and we should just handle + * it as any other output. Else we enforce open drain as this is + * required for an I2C bus. + */ + if (pdata->sda_is_open_drain) + gflags = GPIOD_OUT_HIGH; + else + gflags = GPIOD_OUT_HIGH_OPEN_DRAIN; + priv->sda = i2c_gpio_get_desc(dev, "sda", 0, gflags); + if (IS_ERR(priv->sda)) + return PTR_ERR(priv->sda); + + /* + * If the SCL line is marked from platform data or device tree as + * "open drain" it means something outside of our control is making + * this line being handled as open drain, and we should just handle + * it as any other output. Else we enforce open drain as this is + * required for an I2C bus. + */ + if (pdata->scl_is_open_drain) + gflags = GPIOD_OUT_HIGH; + else + gflags = GPIOD_OUT_HIGH_OPEN_DRAIN; + priv->scl = i2c_gpio_get_desc(dev, "scl", 1, gflags); + if (IS_ERR(priv->scl)) + return PTR_ERR(priv->scl); + + if (gpiod_cansleep(priv->sda) || gpiod_cansleep(priv->scl)) + dev_warn(dev, "Slow GPIO pins might wreak havoc into I2C/SMBus bus timing"); + + bit_data->setsda = i2c_gpio_setsda_val; + bit_data->setscl = i2c_gpio_setscl_val; + + if (!pdata->scl_is_output_only) + bit_data->getscl = i2c_gpio_getscl; + bit_data->getsda = i2c_gpio_getsda; + + if (pdata->udelay) + bit_data->udelay = pdata->udelay; + else if (pdata->scl_is_output_only) + bit_data->udelay = 50; /* 10 kHz */ + else + bit_data->udelay = 5; /* 100 kHz */ + + if (pdata->timeout) + bit_data->timeout = pdata->timeout; + else + bit_data->timeout = HZ / 10; /* 100 ms */ + + bit_data->data = priv; + + adap->owner = THIS_MODULE; + if (np) + strlcpy(adap->name, dev_name(dev), sizeof(adap->name)); + else + snprintf(adap->name, sizeof(adap->name), "i2c-gpio%d", pdev->id); + + adap->algo_data = bit_data; + adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; + adap->dev.parent = dev; + adap->dev.of_node = np; + + adap->nr = pdev->id; + ret = rg_i2c_bit_add_numbered_bus(adap); + if (ret) + return ret; + + platform_set_drvdata(pdev, priv); + + /* + * FIXME: using global GPIO numbers is not helpful. If/when we + * get accessors to get the actual name of the GPIO line, + * from the descriptor, then provide that instead. + */ + dev_info(dev, "using lines %u (SDA) and %u (SCL%s)\n", + desc_to_gpio(priv->sda), desc_to_gpio(priv->scl), + pdata->scl_is_output_only + ? ", no clock stretching" : ""); + + i2c_gpio_fault_injector_init(pdev); + + return 0; +} + +static int i2c_gpio_remove(struct platform_device *pdev) +{ + struct i2c_gpio_private_data *priv; + struct i2c_adapter *adap; + + i2c_gpio_fault_injector_exit(pdev); + + priv = platform_get_drvdata(pdev); + adap = &priv->adap; + + i2c_del_adapter(adap); + + return 0; +} + +#if defined(CONFIG_OF) +static const struct of_device_id i2c_gpio_dt_ids[] = { + { .compatible = "rg-i2c-gpio", }, + { /* sentinel */ } +}; + +MODULE_DEVICE_TABLE(of, i2c_gpio_dt_ids); +#endif + +static struct platform_driver i2c_gpio_driver = { + .driver = { + .name = "rg-i2c-gpio", + .of_match_table = of_match_ptr(i2c_gpio_dt_ids), + }, + .probe = i2c_gpio_probe, + .remove = i2c_gpio_remove, +}; + +static int __init i2c_gpio_init(void) +{ + int ret; + + ret = platform_driver_register(&i2c_gpio_driver); + if (ret) + printk(KERN_ERR "i2c-gpio: probe failed: %d\n", ret); + + return ret; +} +subsys_initcall(i2c_gpio_init); + +static void __exit i2c_gpio_exit(void) +{ + platform_driver_unregister(&i2c_gpio_driver); +} +module_exit(i2c_gpio_exit); + +MODULE_AUTHOR("Haavard Skinnemoen (Atmel)"); +MODULE_DESCRIPTION("Platform-independent bitbanging I2C driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:i2c-gpio"); diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/modules/rg_fan.c b/platform/broadcom/sonic-platform-modules-ragile/common/modules/rg_fan.c index 37cd5f81564f..f8a70adeee27 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/modules/rg_fan.c +++ b/platform/broadcom/sonic-platform-modules-ragile/common/modules/rg_fan.c @@ -78,7 +78,7 @@ typedef enum dfd_dev_info_type_e { } dfd_dev_tlv_type_t; typedef struct dfd_dev_head_info_s { - uint8_t ver; /* define E2PROM version,default is 0x01 */ + uint8_t ver; /* define E2PROM version,default is 0x01 */ uint8_t flag; /* flag is 0x7E in new version E2PROM */ uint8_t hw_ver; /* consists of main version and revise version */ uint8_t type; /* HW type */ diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/script/device_i2c.py b/platform/broadcom/sonic-platform-modules-ragile/common/script/device_i2c.py index 962eb1b086ef..cca9f0393db7 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/script/device_i2c.py +++ b/platform/broadcom/sonic-platform-modules-ragile/common/script/device_i2c.py @@ -5,7 +5,7 @@ import os import time from ragileconfig import GLOBALCONFIG, GLOBALINITPARAM, GLOBALINITCOMMAND, MAC_LED_RESET, STARTMODULE, i2ccheck_params -from ragileutil import rgpciwr, os_system, rgi2cset +from ragileutil import rgpciwr, os_system, rgi2cset, io_wr CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) @@ -154,7 +154,7 @@ def add_dev(name, bus, loc): if name == "lm75": time.sleep(0.1) pdevpath = "/sys/bus/i2c/devices/i2c-%d/" % (bus) - for i in range(1, 100):#wait for mother-bus generation, maximum wait time is 10s + for i in range(1, 100):#wait for mother-bus generation,maximum wait time is 10s if os.path.exists(pdevpath) == True: break time.sleep(0.1) @@ -240,13 +240,16 @@ def adddrivers(): def otherinit(): for index in GLOBALINITPARAM: - # write_sysfs_value(index["loc"], index["value"]) - ret, _ = rgi2cset( - index.get("bus"), - index.get("devaddr"), - index.get("offset"), - index.get("val") - ) + index_type = index.get("type", None) + if index_type == "io": + ret = io_wr(index.get("offset"), index.get("val")) + else: + ret, _ = rgi2cset( + index.get("bus"), + index.get("devaddr"), + index.get("offset"), + index.get("val") + ) if not ret: click.echo("%%DEVICE_I2C-INIT: init param %s failed." % index.get("name")) diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/script/fancontrol.py b/platform/broadcom/sonic-platform-modules-ragile/common/script/fancontrol.py index e87268cea787..19214b30408e 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/script/fancontrol.py +++ b/platform/broadcom/sonic-platform-modules-ragile/common/script/fancontrol.py @@ -31,6 +31,8 @@ get_sysfs_value, strtoint, rgi2cset, + io_rd, + rgsysset, ) @@ -666,7 +668,7 @@ def board_moni_msg(self, ledcontrol=False): logger.error(str(e)) return False - # device error algorithm Tmac-Tin >= 50, or Tmac-Tin <= -50 + # device error algorithm Tmac-Tin≥50℃, or Tmac-Tin≤-50℃ def check_dev_err(self): try: if (self.mac_aver - self.intemp) >= MONITOR_CONST.MAC_UP_TEMP or ( diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/script/ragilecommon.py b/platform/broadcom/sonic-platform-modules-ragile/common/script/ragilecommon.py index 07f66469aaec..0adad9d74659 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/script/ragilecommon.py +++ b/platform/broadcom/sonic-platform-modules-ragile/common/script/ragilecommon.py @@ -211,6 +211,8 @@ MONITOR_MAC_SOURCE_SYSFS = (0) MONITOR_MAC_SOURCE_PATH = None # sysfs path + +# default MAC AVS parameters MAC_AVS_PARAM = { 0x72: 0x0384, 0x73: 0x037E, @@ -302,7 +304,7 @@ ####================================Adaption-Area================================ #### RAGILE_COMMON common configuration head -#### "platform" specific configuration head +#### “platform†specific configuration head #### PCA9548START = 11 PCA9548BUSEND = 74 diff --git a/platform/broadcom/sonic-platform-modules-ragile/common/script/ragileutil.py b/platform/broadcom/sonic-platform-modules-ragile/common/script/ragileutil.py index 7ef2d933d26c..debfcad5bc6d 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/common/script/ragileutil.py +++ b/platform/broadcom/sonic-platform-modules-ragile/common/script/ragileutil.py @@ -382,7 +382,7 @@ def getInputSetmac(val): class fan_tlv(object): - VERSION = 0x01 # E2PROM Version, start from 0x01 + VERSION = 0x01 # E2PROM Version,start from 0x01 FLAG = 0x7E # New E2PROM version flag is 0x7E HW_VER = 0x01 # compose by master version and fixed version TYPE = 0xF1 # hw type defination @@ -1043,7 +1043,7 @@ def util_setmac(eth, mac): log_debug(ifconfigcmd) ret, status = os_system(ifconfigcmd) if ret: - raise SETMACException("software set Internet cardMAC error") + raise SETMACException("software set Internet card MAC error") index = 0 for item in macs: cmd = "ethtool -E %s magic %s offset %d value 0x%s" % (eth, magic, index, item) @@ -1051,7 +1051,7 @@ def util_setmac(eth, mac): index += 1 ret, log = os_system(cmd) if ret != 0: - raise SETMACException(" set hardware Internet card MAC error") + raise SETMACException("set hardware Internet card MAC error") # get value after setting cmd_t = "ethtool -e eth0 offset 0 length 6" ret, log = os_system(cmd_t) @@ -1224,13 +1224,15 @@ def rgpcird(pcibus, slot, fn, bar, offset): s = result[::-1] val = 0 for i in range(0, len(s)): - val = val << 8 | ord(s[i]) + val = val << 8 | s[i] return "0x%08x" % val def rgpciwr(pcibus, slot, fn, bar, offset, data): """write pci register""" ret = inttostr(data, 4) + ret = str.encode(ret) + ret = ret.strip(b'\xc2') filename = "/sys/bus/pci/devices/0000:%02x:%02x.%x/resource%d" % ( int(pcibus), int(slot), @@ -1245,7 +1247,7 @@ def rgpciwr(pcibus, slot, fn, bar, offset, data): s = result[::-1] val = 0 for i in range(0, len(s)): - val = val << 8 | ord(s[i]) + val = val << 8 | s[i] data.close() @@ -1293,13 +1295,14 @@ def fan_setmac(): def checkfansninput(fan_sn, fansntemp): if fan_sn in fansntemp: - RJPRINTERR("exist same Serial Number, please input again") + RJPRINTERR("exist same Serial Number,please input again") return False if len(fan_sn) != 13: - RJPRINTERR("Serial Number length incorrect, please input again") + RJPRINTERR("Serial Number length incorrect,please input again") return False return True + # check hw version def checkfanhwinput(hw): if len(hw) != 4: @@ -1413,7 +1416,7 @@ def fac_fans_setmac_tlv(ret): print("\n*******************************\n") util_show_fanse2(fans) - if getInputCheck("check input correctly or not(Yes/No):") == True: + if getInputCheck("check input correctly or not(Yes/No):") == True: for fan in fans: log_debug("ouput fan") fac_fan_setmac(fan) @@ -2051,30 +2054,27 @@ def get_version_config_info(attr_key, file_name=None): return None -def io_rd(reg_addr, len=1): - u"""io read""" +def io_rd(reg_addr, size=1): + path = "/dev/port" + ret = "" + fd = None try: - regaddr = 0 - if type(reg_addr) == int: - regaddr = reg_addr - else: - regaddr = int(reg_addr, 16) - devfile = "/dev/port" - fd = os.open(devfile, os.O_RDWR | os.O_CREAT) - os.lseek(fd, regaddr, os.SEEK_SET) - str = os.read(fd, len) - return "".join(["%02x" % ord(item) for item in str]) - except ValueError: - return None + reg_addr = int(reg_addr) + fd = os.open(path, os.O_RDWR|os.O_CREAT) + for i in range(size): + os.lseek(fd, reg_addr+i, os.SEEK_SET) + ret+="{:02x}".format(ord(os.read(fd, 1).decode('latin-1'))) + return ret except Exception as e: - print(e) + print(str(e)) return None finally: - os.close(fd) + if fd: os.close(fd) def io_wr(reg_addr, reg_data): u"""io write""" + fd = None try: regdata = 0 regaddr = 0 @@ -2089,7 +2089,7 @@ def io_wr(reg_addr, reg_data): devfile = "/dev/port" fd = os.open(devfile, os.O_RDWR | os.O_CREAT) os.lseek(fd, regaddr, os.SEEK_SET) - os.write(fd, chr(regdata)) + os.write(fd, regdata.to_bytes(2, 'little')) return True except ValueError as e: print(e) @@ -2098,4 +2098,4 @@ def io_wr(reg_addr, reg_data): print(e) return False finally: - os.close(fd) + if fd: os.close(fd) diff --git a/platform/broadcom/sonic-platform-modules-ragile/debian/control b/platform/broadcom/sonic-platform-modules-ragile/debian/control index ceef3336569b..795c8219a61e 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/debian/control +++ b/platform/broadcom/sonic-platform-modules-ragile/debian/control @@ -11,3 +11,11 @@ Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-ragile-ra-b6910-64c Architecture: amd64 Description: kernel modules for platform devices such as fan, led, sfp + +Package: platform-modules-ragile-ra-b6510-32c +Architecture: amd64 +Description: kernel modules for platform devices such as fan, led, sfp + +Package: platform-modules-ragile-ra-b6920-4s +Architecture: amd64 +Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-ragile/debian/platform-modules-ragile-ra-b6920-4s.install b/platform/broadcom/sonic-platform-modules-ragile/debian/platform-modules-ragile-ra-b6920-4s.install new file mode 100644 index 000000000000..0034aa70603d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/debian/platform-modules-ragile-ra-b6920-4s.install @@ -0,0 +1 @@ +ra-b6920-4s/scripts/pddf_post_device_create.sh /usr/local/bin diff --git a/platform/broadcom/sonic-platform-modules-ragile/debian/rule-ragile.mk b/platform/broadcom/sonic-platform-modules-ragile/debian/rule-ragile.mk index c3294dc9e177..6620b8762f86 100755 --- a/platform/broadcom/sonic-platform-modules-ragile/debian/rule-ragile.mk +++ b/platform/broadcom/sonic-platform-modules-ragile/debian/rule-ragile.mk @@ -2,5 +2,7 @@ currentdir = $(shell pwd) MODULE_DIRS := ra-b6510-48v8c MODULE_DIRS += ra-b6910-64c +MODULE_DIRS += ra-b6510-32c +MODULE_DIRS += ra-b6920-4s export MODULE_DIRS diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/LICENSE b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/LICENSE new file mode 100755 index 000000000000..d37122689f3e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/LICENSE @@ -0,0 +1,15 @@ +Copyright (C) 2016 Microsoft, Inc +Copyright (C) 2018 Ragile Network Corporation +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/MAINTAINERS b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/MAINTAINERS new file mode 100755 index 000000000000..ec8222405085 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/MAINTAINERS @@ -0,0 +1,5 @@ +# See the SONiC project governance document for more information + +Name = "support" +Email = "support@ragile.com" +Mailinglist = sonicproject@googlegroups.com diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/Makefile b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/Makefile new file mode 100755 index 000000000000..46415e74ab7d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/Makefile @@ -0,0 +1,26 @@ +PWD = $(shell pwd) +DIR_KERNEL_SRC = $(PWD)/modules/driver +EXTRA_CFLAGS:= -I$(M)/include +EXTRA_CFLAGS+= -Wall +SUB_BUILD_DIR = $(PWD)/build +INSTALL_DIR = $(SUB_BUILD_DIR)/$(KERNEL_SRC)/$(INSTALL_MOD_DIR) +INSTALL_SCRIPT_DIR = $(SUB_BUILD_DIR)/usr/local/bin +INSTALL_SERVICE_DIR = $(SUB_BUILD_DIR)/lib/systemd/system/ + +KBUILD_EXTRA_SYMBOLS += $(DIR_KERNEL_SRC)/Module.symvers +export KBUILD_EXTRA_SYMBOLS + +all: + $(MAKE) -C $(KBUILD_OUTPUT) M=$(DIR_KERNEL_SRC) modules + @if [ ! -d ${INSTALL_DIR} ]; then mkdir -p ${INSTALL_DIR} ;fi + cp -r $(DIR_KERNEL_SRC)/*.ko $(INSTALL_DIR) + @if [ ! -d ${INSTALL_SCRIPT_DIR} ]; then mkdir -p ${INSTALL_SCRIPT_DIR} ;fi + cp -r $(PWD)/config/* $(INSTALL_SCRIPT_DIR) + @if [ ! -d ${INSTALL_SERVICE_DIR} ]; then mkdir -p ${INSTALL_SERVICE_DIR} ;fi + cp $(PWD)/systemd/*.service $(INSTALL_SERVICE_DIR) +clean: + rm -f ${DIR_KERNEL_SRC}/*.o ${DIR_KERNEL_SRC}/*.ko ${DIR_KERNEL_SRC}/*.mod.c ${DIR_KERNEL_SRC}/.*.cmd + rm -f ${DIR_KERNEL_SRC}/Module.markers ${DIR_KERNEL_SRC}/Module.symvers ${DIR_KERNEL_SRC}/modules.order + rm -rf ${DIR_KERNEL_SRC}/.tmp_versions + rm -rf $(SUB_BUILD_DIR) + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/README.md b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/README.md new file mode 100755 index 000000000000..787636c4ad20 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/README.md @@ -0,0 +1 @@ +Device drivers for support of ragile platform for the SONiC project diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/config/x86_64_ragile_ra_b6510_32c_r0_config.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/config/x86_64_ragile_ra_b6510_32c_r0_config.py new file mode 100755 index 000000000000..2806615277a7 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/config/x86_64_ragile_ra_b6510_32c_r0_config.py @@ -0,0 +1,311 @@ +#!/usr/bin/python +# -*- coding: UTF-8 -*- +from ragilecommon import * +PCA9548START = -1 +PCA9548BUSEND = -2 + + +RAGILE_CARDID = 0x0000404b +RAGILE_PRODUCTNAME = "RA-B6510-32C" + +fanlevel = { + "tips":["LOW","MIDDLE","HIGH"], + "level":[51,150,255], + "low_speed":[500,7500,17000], + "high_speed":[11000,22500,28500] +} + +fanloc =[ {"name":"FAN1", "location":"2-000d/fan1_pwm" , + "childfans":[{"name":"FRONT ROTOR", "location":"2-000d/fan1_input"},{"name":"BACK ROTOR", "location":"2-000d/fan2_input"} ]}, + {"name":"FAN2", "location":"2-000d/fan3_pwm", + "childfans":[{"name":"FRONT ROTOR", "location":"2-000d/fan3_input"},{"name":"BACK ROTOR", "location":"2-000d/fan4_input"} ]}, + {"name":"FAN3", "location":"2-000d/fan5_pwm", + "childfans":[{"name":"FRONT ROTOR", "location":"2-000d/fan5_input"},{"name":"BACK ROTOR", "location":"2-000d/fan6_input"} ]}, + {"name":"FAN4", "location":"2-000d/fan7_pwm", + "childfans":[{"name":"FRONT ROTOR", "location":"2-000d/fan7_input"},{"name":"BACK ROTOR", "location":"2-000d/fan8_input"} ]}, + {"name":"FAN5", "location":"2-000d/fan9_pwm", + "childfans":[{"name":"FRONT ROTOR", "location":"2-000d/fan9_input"},{"name":"BACK ROTOR", "location":"2-000d/fan10_input"} ]}, + ] + + +STARTMODULE = { + "fancontrol":1, + "avscontrol":1, + "avscontrol_restful":0, + "macledreset":1, + "dev_monitor": 1, + } + +DEV_MONITOR_PARAM = { + "polling_time" : 10, + "psus": [ + {"name": "psu1", + "present": {"gettype":"io", "io_addr":0x951,"presentbit": 0,"okval":0}, + "device": [ + {"id": "psu1pmbus", "name": "fsp1200", "bus": 24, "loc": 0x58, "attr": "hwmon"}, + {"id": "psu1frue2", "name": "24c02", "bus": 24, "loc": 0x50, "attr": "eeprom"}, + ], + }, + {"name": "psu2", + "present": {"gettype":"io", "io_addr":0x951,"presentbit": 4,"okval":0}, + "device": [ + {"id": "psu2pmbus", "name": "fsp1200", "bus": 25, "loc": 0x58, "attr": "hwmon"}, + {"id": "psu2frue2", "name": "24c02", "bus": 25, "loc": 0x50, "attr": "eeprom"}, + ], + }, + ], + "fans": [ + {"name": "fan1", + "present": {"gettype": "i2c", "bus": 2, "loc": 0x0d, "offset": 0x30, "presentbit": 0, "okval": 0}, + "device": [ + {"id": "fan1frue2", "name": "24c02", "bus": 16, "loc": 0x50, "attr": "eeprom"}, + ], + }, + {"name": "fan2", + "present": {"gettype": "i2c", "bus": 2, "loc": 0x0d, "offset": 0x30, "presentbit": 1, "okval": 0}, + "device": [ + {"id": "fan2frue2", "name": "24c02", "bus": 17, "loc": 0x50, "attr": "eeprom"}, + ], + }, + {"name": "fan3", + "present": {"gettype": "i2c", "bus": 2, "loc": 0x0d, "offset": 0x30, "presentbit": 2, "okval": 0}, + "device": [ + {"id": "fan3frue2", "name": "24c02", "bus": 18, "loc": 0x50, "attr": "eeprom"}, + ], + }, + {"name": "fan4", + "present": {"gettype": "i2c", "bus": 2, "loc": 0x0d, "offset": 0x30, "presentbit": 3, "okval": 0}, + "device": [ + {"id": "fan4frue2", "name": "24c02", "bus": 19, "loc": 0x50, "attr": "eeprom"}, + ], + }, + {"name": "fan5", + "present": {"gettype": "i2c", "bus": 2, "loc": 0x0d, "offset": 0x30, "presentbit": 4, "okval": 0}, + "device": [ + {"id": "fan5frue2", "name": "24c02", "bus": 20, "loc": 0x50, "attr": "eeprom"}, + ], + }, + ], +} + + +MONITOR_TEMP_MIN = 38 +MONITOR_K = 11 +MONITOR_MAC_IN = 35 +MONITOR_DEFAULT_SPEED = 0x60 +MONITOR_MAX_SPEED = 0xFF +MONITOR_MIN_SPEED = 0x33 +MONITOR_MAC_ERROR_SPEED = 0XBB +MONITOR_FAN_TOTAL_NUM = 5 +MONITOR_MAC_UP_TEMP = 50 +MONITOR_MAC_LOWER_TEMP = -50 +MONITOR_MAC_MAX_TEMP = 100 # + +MONITOR_FALL_TEMP = 4 +MONITOR_MAC_WARNING_THRESHOLD = 100 #100 +MONITOR_OUTTEMP_WARNING_THRESHOLD = 85 +MONITOR_BOARDTEMP_WARNING_THRESHOLD = 85 +MONITOR_CPUTEMP_WARNING_THRESHOLD = 85 +MONITOR_INTEMP_WARNING_THRESHOLD = 70 #70 + +MONITOR_MAC_CRITICAL_THRESHOLD = 105 #105 +MONITOR_OUTTEMP_CRITICAL_THRESHOLD = 90 #90 +MONITOR_BOARDTEMP_CRITICAL_THRESHOLD = 90 #90 +MONITOR_CPUTEMP_CRITICAL_THRESHOLD = 100 #100 +MONITOR_INTEMP_CRITICAL_THRESHOLD = 80 # 80 +MONITOR_CRITICAL_NUM = 3 +MONITOR_SHAKE_TIME = 20 +MONITOR_INTERVAL = 60 + +MONITOR_SYS_LED = [ + { + "cmdstr":"/sys/devices/pci0000:00/0000:00:1f.0/broad_front_sys", + "yellow":0x06, + "red":0x02, + "green":0x04, + "type":"sysfs", + }, +] + +MONITOR_SYS_FAN_LED = [ + { + "cmdstr":"/sys/devices/pci0000:00/0000:00:1f.0/broad_front_fan", + "yellow":0x06, + "red":0x02, + "green":0x04, + "type":"sysfs", + }, +] +MONITOR_FANS_LED = [ + {"bus":2,"devno":0x0d, "addr":0x3b, "green":0x04, "red":0x02}, + {"bus":2,"devno":0x0d, "addr":0x3c, "green":0x04, "red":0x02}, + {"bus":2,"devno":0x0d, "addr":0x3d, "green":0x04, "red":0x02}, + {"bus":2,"devno":0x0d, "addr":0x3e, "green":0x04, "red":0x02}, + {"bus":2,"devno":0x0d, "addr":0x3f, "green":0x04, "red":0x02}] + +E2_LOC = {"bus":1, "devno":0x56} +MAC_LED_RESET = {"pcibus":8, "slot":0, "fn":0, "bar":0, "offset":64, "reset":0x98} + +CPLDVERSIONS = [ + {"io_addr": 0x0700, "name": "CPU BOARD CPLD", "gettype": "io"}, + {"io_addr": 0x0900, "name": "CONNECT BOARD CPLD", "gettype": "io"}, + {"bus":2, "devno":0x0d, "name":"CONNECT BOARD CPLD-FAN"}, + {"bus":8, "devno":0x30, "name":"MAC BOARD CPLD_1"}, + {"bus":8, "devno":0x31, "name":"MAC BOARD CPLD_2"}, +] + +MONITOR_SYS_PSU_LED = [ + { + "cmdstr":"/sys/devices/pci0000:00/0000:00:1f.0/broad_front_pwr", + "yellow":0x06, + "red":0x02, + "green":0x04, + "type":"sysfs", + }, +] + +MONITOR_FAN_STATUS = [ + {'status':'green' , 'minOkNum':5,'maxOkNum':5}, + {'status':'yellow', 'minOkNum':4,'maxOkNum':4}, + {'status':'red' , 'minOkNum':0,'maxOkNum':3}, + ] + +MONITOR_PSU_STATUS = [ + {'status':'green' , 'minOkNum':2,'maxOkNum':2}, + {'status':'yellow', 'minOkNum':1,'maxOkNum':1}, + {'status':'red' , 'minOkNum':0,'maxOkNum':0}, + ] + + +MONITOR_DEV_STATUS = { + "temperature": [ + {"name":"lm75in", "location":"/sys/bus/i2c/devices/3-004b/hwmon/*/temp1_input"}, + {"name":"lm75out", "location":"/sys/bus/i2c/devices/3-004c/hwmon/*/temp1_input"}, + {"name":"lm75hot", "location":"/sys/bus/i2c/devices/3-0049/hwmon/*/temp1_input"}, + {"name":"cpu", "location":"/sys/class/hwmon/hwmon0"}, + ], + "fans": [ + { + "name":"fan1", + "presentstatus":{"bus":2, "loc":0x0d, "offset":0x30, 'bit':0}, + "rollstatus": [ + {"name":"motor1","bus":2, "loc":0x0d, "offset":0x31, 'bit':0}, + {"name":"motor2","bus":2, "loc":0x0d, "offset":0x34, 'bit':0}, + ] + }, + { + "name":"fan2", + "presentstatus":{"bus":2, "loc":0x0d, "offset":0x30, 'bit':1}, + "rollstatus":[ + {"name":"motor1","bus":2, "loc":0x0d, "offset":0x31, 'bit':1}, + {"name":"motor2","bus":2, "loc":0x0d, "offset":0x34, 'bit':1}, + ] + }, + { + "name":"fan3", + "presentstatus":{"bus":2, "loc":0x0d, "offset":0x30, 'bit':2}, + "rollstatus":[ + {"name":"motor1","bus":2, "loc":0x0d, "offset":0x31, 'bit':2}, + {"name":"motor2","bus":2, "loc":0x0d, "offset":0x34, 'bit':2}, + ] + }, + { + "name":"fan4", + "presentstatus":{"bus":2, "loc":0x0d, "offset":0x30, 'bit':3}, + "rollstatus":[ + {"name":"motor1","bus":2, "loc":0x0d, "offset":0x31, 'bit':3}, + {"name":"motor2","bus":2, "loc":0x0d, "offset":0x34, 'bit':3}, + ] + }, + { + "name":"fan5", + "presentstatus":{"bus":2, "loc":0x0d, "offset":0x30, 'bit':4}, + "rollstatus":[ + {"name":"motor1","bus":2, "loc":0x0d, "offset":0x31, 'bit':4}, + {"name":"motor2","bus":2, "loc":0x0d, "offset":0x34, 'bit':4}, + ] + }, + ], + "psus": [ + {"name":"psu1", "io_addr":0x951, "gettype":"io", 'presentbit': 0, 'statusbit':1, 'alertbit':2}, + {"name":"psu2", "io_addr":0x951, "gettype":"io", 'presentbit': 4, 'statusbit':5, 'alertbit':6}, + ], + "mac_temp" : { + "loc" : [ + "3-0044/hwmon/*/temp99_input", + ], + }, +} + +MONITOR_DEV_STATUS_DECODE = { + 'fanpresent': {0:'PRESENT', 1:'ABSENT', 'okval':0}, + 'fanroll' : {0:'STALL' , 1:'ROLL', 'okval':1}, + 'psupresent': {0:'PRESENT', 1:'ABSENT', 'okval':0}, + 'psuoutput' : {0:'FAULT' , 1:'NORMAL', 'okval':1}, + 'psualert' : {0:'FAULT' , 1:'NORMAL', 'okval':1}, +} +################################################################### + + + +MAC_AVS_PARAM ={ + 0x72:0x0384, + 0x73:0x037e, + 0x74:0x0378, + 0x75:0x0372, + 0x76:0x036b, + 0x77:0x0365, + 0x78:0x035f, + 0x79:0x0359, + 0x7a:0x0352, + 0x7b:0x034c, + 0x7c:0x0346, + 0x7d:0x0340, + 0x7e:0x0339, + 0x7f:0x0333, + 0x80:0x032d, + 0x81:0x0327, + 0x82:0x0320, + 0x83:0x031a, + 0x84:0x0314, + 0x85:0x030e, + 0x86:0x0307, + 0x87:0x0301, + 0x88:0x02fb, + 0x89:0x02f5, + 0x8A:0x02ee +} + +MAC_DEFAULT_PARAM = { + "type": 1, + "default":0x7a, + "loopaddr":0x00, + "loop":0x00, + "open":0x00, + "close":0x40, + "bus":7, + "devno":0x64, + "addr":0x21, + "protectaddr":0x10, + "sdkreg":"TOP_AVS_SEL_REG", + "sdkcmd": "scdcmd", + "sdkcmdargs": ["-t", 5], + "sdktype": 0, + "macregloc":24 , + "mask": 0xff +} + +DEVICE = [] +DRIVERLISTS = [] + +INIT_PARAM = [ + { + "name": "mac_power_on", + "type": "io", + "offset": 0x994, + "val": 0x01 + } +] + +INIT_COMMAND = [ +] diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/Makefile b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/Makefile new file mode 100755 index 000000000000..f3aa0d373545 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/Makefile @@ -0,0 +1,4 @@ +obj-m := rg_cpld.o +obj-m += rg_lpc_cpld.o +obj-m += pddf_custom_psu.o +obj-m += pddf_custom_led_module.o diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/pddf_client_defs.h b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/pddf_client_defs.h new file mode 100644 index 000000000000..1c98a73e6eb6 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/pddf_client_defs.h @@ -0,0 +1,135 @@ +/* + * Copyright 2019 Broadcom. + * The term “Broadcom†refers to Broadcom Inc. and/or its subsidiaries. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * + * Description: + * Platform I2C client defines/structures header file + */ + +#ifndef __PDDF_CLIENT_DEFS_H__ +#define __PDDF_CLIENT_DEFS_H__ + +#include + +#define PSU "PDDF_PSU" +#define LED "PDDF_LED" +#define FAN "PDDF_FAN" +#define CLIENT "PDDF_CLIENT" +#define CPLD "PDDF_CPLD" +#define CPLDMUX "PDDF_CPLDMUX" +#define MUX "PDDF_MUX" +#define GPIO "PDDF_GPIO" +#define SYSSTATUS "PDDF_SYSSTATUS" +#define XCVR "PDDF_XCVR" + +#define PDDF_DEBUG +#ifdef PDDF_DEBUG +#define pddf_dbg(filter,...) printk("%s\t", filter); printk(KERN_CONT __VA_ARGS__) +#else +#define pddf_dbg(...) +#endif + + +#define GEN_NAME_SIZE 32 +#define ERR_STR_SIZE 128 + + +typedef struct pddf_data_attribute{ + struct device_attribute dev_attr; + int type; + int len; + char *addr; + char *data; +}PDDF_ATTR; + +#define PDDF_DATA_ATTR(_name, _mode, _show, _store, _type, _len, _addr, _data) \ + struct pddf_data_attribute attr_##_name = { .dev_attr = __ATTR(_name, _mode, _show, _store), \ + .type = _type , \ + .len = _len , \ + .addr = _addr, \ + .data = _data } + + +enum attribute_data_type { + PDDF_CHAR, + PDDF_UCHAR, + PDDF_INT_HEX, // integer represented in HEX + PDDF_INT_DEC, // integer represented in DECIMAL + PDDF_USHORT, // HEX + PDDF_UINT32 // HEX +}; + + + + + +// PSU Specific details + +typedef struct NEW_DEV_ATTR +{ + char i2c_type[GEN_NAME_SIZE]; + char i2c_name[GEN_NAME_SIZE]; + int parent_bus; + char dev_type[GEN_NAME_SIZE]; + int dev_id; + int dev_addr; + char *data; + int error; + char errstr[ERR_STR_SIZE]; + +}NEW_DEV_ATTR; +extern NEW_DEV_ATTR pddf_data; + +extern struct attribute_group pddf_clients_data_group; +extern ssize_t store_pddf_data(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +extern ssize_t show_pddf_data(struct device *dev, struct device_attribute *da, char *buf); +struct kobject* get_device_i2c_kobj(void); +void set_attr_data(void * ptr); +void set_error_code(int, char *); +ssize_t show_error_code(struct device *dev, struct device_attribute *da, char *buf); +ssize_t show_all_devices(struct device *dev, struct device_attribute *da, char *buf); +void traverse_device_table(void ); + + + +/*Various Ops hook which can be used by vendors to provide some deviation from usual pddf functionality*/ +struct pddf_ops_t +{ + /*Module init ops*/ + int (*pre_init)(void); + int (*post_init)(void); + /*probe ops*/ + int (*pre_probe)(struct i2c_client *, const struct i2c_device_id *); + int (*post_probe)(struct i2c_client *, const struct i2c_device_id *); + /*remove ops*/ + int (*pre_remove)(struct i2c_client *); + int (*post_remove)(struct i2c_client *); + /*Module exit ops*/ + void (*pre_exit)(void); + void (*post_exit)(void); +}; + + +typedef struct PDEVICE +{ + struct hlist_node node; + char name[GEN_NAME_SIZE]; + void *data; + +}PDEVICE; + +void add_device_table(char *name, void *ptr); + + +#endif diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/pddf_custom_led_module.c b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/pddf_custom_led_module.c new file mode 100644 index 000000000000..5776735ef4fa --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/pddf_custom_led_module.c @@ -0,0 +1,736 @@ +/* + * Copyright 2019 Broadcom. + * The term “Broadcom†refers to Broadcom Inc. and/or its subsidiaries. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * + * A pddf kernel module to manage various LEDs of a switch + */ + +#include +#include +#include +#include +#include +#include +#include "pddf_led_defs.h" +#include "pddf_client_defs.h" +#include +#include +#include +#include + +#define DEBUG 0 +LED_OPS_DATA sys_led_ops_data[1]={0}; +LED_OPS_DATA* psu_led_ops_data=NULL; +LED_OPS_DATA diag_led_ops_data[1]= {0}; +LED_OPS_DATA fan_led_ops_data[1]= {0}; +LED_OPS_DATA loc_led_ops_data[1]= {0}; +LED_OPS_DATA* fantray_led_ops_data=NULL; +LED_OPS_DATA temp_data={0}; +LED_OPS_DATA* dev_list[LED_TYPE_MAX] = { + sys_led_ops_data, + NULL, + fan_led_ops_data, + NULL, + diag_led_ops_data, + loc_led_ops_data, +}; +int num_psus = 0; +int num_fantrays = 0; + +extern int board_i2c_cpld_read(unsigned short cpld_addr, u8 reg); +extern int board_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); +extern ssize_t show_pddf_data(struct device *dev, struct device_attribute *da, char *buf); +extern ssize_t store_pddf_data(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +extern void *get_device_table(char *name); + +static LED_STATUS find_state_index(const char* state_str) { + int index; + char *ptr = (char *)state_str; + while (*ptr && *ptr!= '\n' && *ptr !='\0') ptr++; + *ptr='\0'; + for ( index = 0; index < MAX_LED_STATUS; index++) { + /*int rc = strcmp(state_str, LED_STATUS_STR[index]) ;*/ + if (strcmp(state_str, LED_STATUS_STR[index]) == 0 ) { + return index; + } + } + return MAX_LED_STATUS; +} + +static LED_TYPE get_dev_type(char* name) +{ + LED_TYPE ret = LED_TYPE_MAX; + if(strcasecmp(name, "SYS_LED")==0) { + ret = LED_SYS; + } else if(strcasecmp(name, "FAN_LED")==0) { + ret = LED_FAN; + } else if(strstr(name, "PSU_LED")) { + ret = LED_PSU; + } else if(strcasecmp(name, "DIAG_LED")==0) { + ret = LED_DIAG; + } else if(strcasecmp(name, "LOC_LED")==0) { + ret = LED_LOC; + } else if(strstr(name, "FANTRAY_LED")) { + ret = LED_FANTRAY; + } +#if DEBUG > 1 + pddf_dbg(LED, KERN_INFO "LED get_dev_type: %s; %d\n", name, ret); +#endif + return (ret); +} +static int dev_index_check(LED_TYPE type, int index) +{ +#if DEBUG + pddf_dbg(LED, "dev_index_check: type:%s index:%d num_psus:%d num_fantrays:%d\n", + LED_TYPE_STR[type], index, num_psus, num_fantrays); +#endif + switch(type) + { + case LED_PSU: + if(index >= num_psus) return (-1); + break; + case LED_FANTRAY: + if(index >= num_fantrays) return (-1); + break; + default: + if(index >= 1) return (-1); + break; + } + return (0); +} + +static LED_OPS_DATA* find_led_ops_data(struct device_attribute *da) +{ + struct pddf_data_attribute *_ptr = (struct pddf_data_attribute *)da; + LED_OPS_DATA* ptr=(LED_OPS_DATA*)_ptr->addr; + LED_TYPE led_type; + if(!ptr || strlen(ptr->device_name)==0 ) return(NULL); + + + if((led_type=get_dev_type(ptr->device_name))==LED_TYPE_MAX) { + printk(KERN_ERR "PDDF_LED ERROR *%s Unsupported Led Type\n", __func__); + return(NULL); + } + if(dev_index_check(led_type, ptr->index)==-1) { + printk(KERN_ERR "PDDF_LED ERROR %s invalid index: %d for type:%s\n", __func__, ptr->index, ptr->device_name); + return(NULL); + } +#if DEBUG > 1 + pddf_dbg(LED, "find_led_ops_data: name:%s; index=%d tempAddr:%p actualAddr:%p\n", + ptr->device_name, ptr->index, ptr, dev_list[led_type]+ptr->index); +#endif + return (dev_list[led_type]+ptr->index); +} + +static void print_led_data(LED_OPS_DATA *ptr, LED_STATUS state) +{ + int i = 0; + if(!ptr) return ; + pddf_dbg(LED, KERN_INFO "Print %s index:%d num_psus:%d num_fantrays:%d ADDR=%p\n", + ptr->device_name, ptr->index, num_psus, num_fantrays, ptr); + pddf_dbg(LED, KERN_INFO "\tindex: %d\n", ptr->index); + pddf_dbg(LED, KERN_INFO "\tcur_state: %d; %s \n", ptr->cur_state.state, ptr->cur_state.color); + for (i = 0; i< MAX_LED_STATUS; i++) { + if(ptr->data[i].swpld_addr && (i == state || state == -1)) { + pddf_dbg(LED, KERN_INFO "\t\t[%s]: addr/offset:0x%x;0x%x color:%s; value:%x; mask_bits: 0x%x; pos:%d\n", + LED_STATUS_STR[i], + ptr->data[i].swpld_addr, ptr->data[i].swpld_addr_offset, + LED_STATUS_STR[i], ptr->data[i].value, ptr->data[i].bits.mask_bits, ptr->data[i].bits.pos); + } + } +} + +int get_sys_val(LED_OPS_DATA *ops_ptr, uint32_t *sys_val) +{ + int ret; + struct i2c_client *client_ptr; + + ret = -1; + + if (ops_ptr == NULL) { + pddf_dbg(LED, KERN_ERR "ERROR %s: param is NULL\n", __func__); + return ret; + } + + if (strlen(ops_ptr->device_name) != 0 && strncmp(ops_ptr->device_name, "FANTRAY_LED", strlen("FANTRAY_LED")) == 0) { + client_ptr = (struct i2c_client *)get_device_table("FAN-CTRL"); + if (client_ptr == NULL) { + pddf_dbg(LED, KERN_ERR "ERROR %s: get led color by cpld fail\n", __func__); + return ret; + } + *sys_val = i2c_smbus_read_byte_data(client_ptr, ops_ptr->swpld_addr_offset); + ret = 0; + } + else { + ret = inb(ops_ptr->swpld_addr_offset); + if (ret < 0) { + pddf_dbg(LED, KERN_ERR "ERROR %s: get led color by io fail\n", __func__); + return ret; + } + *sys_val = (uint32_t)ret; + ret = 0; + } + + return ret; +} + + +ssize_t get_status_led(struct device_attribute *da) +{ + int ret=0; + struct pddf_data_attribute *_ptr = (struct pddf_data_attribute *)da; + LED_OPS_DATA* temp_data_ptr=(LED_OPS_DATA*)_ptr->addr; + LED_OPS_DATA* ops_ptr=find_led_ops_data(da); + uint32_t color_val=0, sys_val=0; + int state=0; + if (!ops_ptr) { + pddf_dbg(LED, KERN_ERR "ERROR %s: Cannot find LED Ptr", __func__); + return (-1); + } + if (ops_ptr->swpld_addr == 0x0) { + pddf_dbg(LED, KERN_ERR "ERROR %s: device: %s %d not configured\n", __func__, + temp_data_ptr->device_name, temp_data_ptr->index); + return (-1); + } + ret = get_sys_val(ops_ptr, &sys_val); + if (ret < 0) { + pddf_dbg(LED, KERN_ERR "ERROR %s: Cannot get sys val\n", __func__); + return (-1); + } + /* keep ret as old value */ + ret = 0; + + strcpy(temp_data.cur_state.color, "None"); + for (state=0; statedata[state].bits.mask_bits); + if ((color_val ^ (ops_ptr->data[state].value<data[state].bits.pos))==0) { + strcpy(temp_data.cur_state.color, LED_STATUS_STR[state]); + } + } +#if DEBUG > 1 + pddf_dbg(LED, KERN_ERR "Get : %s:%d addr/offset:0x%x; 0x%x value=0x%x [%s]\n", + ops_ptr->device_name, ops_ptr->index, + ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset, sys_val, + temp_data.cur_state.color); +#endif + + return(ret); +} + +int set_sys_val(LED_OPS_DATA *ops_ptr, uint32_t new_val) +{ + int ret; + struct i2c_client *client_ptr; + + ret = -1; + + if (ops_ptr == NULL) { + pddf_dbg(LED, KERN_ERR "ERROR %s: param is NULL\n", __func__); + return ret; + } + + if (strlen(ops_ptr->device_name) != 0 && strncmp(ops_ptr->device_name, "FANTRAY_LED", strlen("FANTRAY_LED")) == 0) { + client_ptr = (struct i2c_client *)get_device_table("FAN-CTRL"); + if (client_ptr == NULL) { + pddf_dbg(LED, KERN_ERR "ERROR %s: get i2c_client fail\n", __func__); + return ret; + } + ret = i2c_smbus_write_byte_data(client_ptr, ops_ptr->swpld_addr_offset, new_val); + if (ret < 0) { + pddf_dbg(LED, KERN_ERR "ERROR %s: set led color by cpld fail\n", __func__); + } + } + else { + outb(new_val, ops_ptr->swpld_addr_offset); + } + + return ret; +} + +ssize_t set_status_led(struct device_attribute *da) +{ + int ret=0; + uint32_t sys_val=0, new_val=0; + LED_STATUS cur_state = MAX_LED_STATUS; + struct pddf_data_attribute *_ptr = (struct pddf_data_attribute *)da; + LED_OPS_DATA* temp_data_ptr=(LED_OPS_DATA*)_ptr->addr; + LED_OPS_DATA* ops_ptr=find_led_ops_data(da); + char* _buf=temp_data_ptr->cur_state.color; + + if (!ops_ptr) { + pddf_dbg(LED, KERN_ERR "PDDF_LED ERROR %s: Cannot find LED Ptr", __func__); + return (-1); + } + if (ops_ptr->swpld_addr == 0x0) { + pddf_dbg(LED, KERN_ERR "PDDF_LED ERROR %s: device: %s %d not configured\n", + __func__, ops_ptr->device_name, ops_ptr->index); + return (-1); + } + pddf_dbg(LED, KERN_ERR "%s: Set [%s;%d] color[%s]\n", __func__, + temp_data_ptr->device_name, temp_data_ptr->index, + temp_data_ptr->cur_state.color); + cur_state = find_state_index(_buf); + + if (cur_state == MAX_LED_STATUS) { + pddf_dbg(LED, KERN_ERR "ERROR %s: not supported: %s\n", _buf, __func__); + return (-1); + } + + if(ops_ptr->data[cur_state].swpld_addr != 0x0) { + ret = get_sys_val(ops_ptr, &sys_val); + if (ret < 0) { + pddf_dbg(LED, KERN_ERR "ERROR %s: Cannot get sys val\n", __func__); + return (-1); + } + + new_val = (sys_val & ops_ptr->data[cur_state].bits.mask_bits) | + (ops_ptr->data[cur_state].value << ops_ptr->data[cur_state].bits.pos); + + } else { + pddf_dbg(LED, KERN_ERR "ERROR %s: %s %d state %d; %s not configured\n",__func__, + ops_ptr->device_name, ops_ptr->index, cur_state, _buf); + return (-1); + } + + ret = set_sys_val(ops_ptr, new_val); + if (ret < 0) { + pddf_dbg(LED, KERN_ERR "ERROR %s: Cannot set sys val\n", __func__); + return (-1); + } + pddf_dbg(LED, KERN_INFO "Set color:%s; 0x%x:0x%x sys_val:0x%x new_val:0x%x read:0x%x\n", + LED_STATUS_STR[cur_state], + ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset, + sys_val, new_val, + ret = board_i2c_cpld_read(ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset)); + if (ret < 0) + { + pddf_dbg(LED, KERN_ERR "PDDF_LED ERROR %s: Error %d in reading from cpld(0x%x) offset 0x%x\n", __FUNCTION__, ret, ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset); + return ret; + } + return(ret); +} + + +ssize_t show_pddf_data(struct device *dev, struct device_attribute *da, + char *buf) +{ + int ret = 0; + struct pddf_data_attribute *ptr = (struct pddf_data_attribute *)da; + switch(ptr->type) + { + case PDDF_CHAR: + ret = sprintf(buf, "%s\n", ptr->addr); + break; + case PDDF_INT_DEC: + ret = sprintf(buf, "%d\n", *(int*)(ptr->addr)); + break; + case PDDF_INT_HEX: + ret = sprintf(buf, "0x%x\n", *(int*)(ptr->addr)); + break; + case PDDF_USHORT: + ret = sprintf(buf, "0x%x\n", *(unsigned short *)(ptr->addr)); + break; + case PDDF_UINT32: + ret = sprintf(buf, "0x%x\n", *(uint32_t *)(ptr->addr)); + break; + default: + break; + } +#if DEBUG > 1 + pddf_dbg(LED, "[ READ ] DATA ATTR PTR [%s] TYPE:%d, Value:[%s]\n", + ptr->dev_attr.attr.name, ptr->type, buf); +#endif + return ret; +} + +ssize_t store_pddf_data(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int ret = 0, num = 0; + struct pddf_data_attribute *ptr = (struct pddf_data_attribute *)da; + switch(ptr->type) + { + case PDDF_CHAR: + strncpy(ptr->addr, buf, strlen(buf)-1); // to discard newline char form buf + ptr->addr[strlen(buf)-1] = '\0'; +#if DEBUG + pddf_dbg(LED, KERN_ERR "[ WRITE ] ATTR PTR [%s] PDDF_CHAR VALUE:%s\n", + ptr->dev_attr.attr.name, ptr->addr); +#endif + break; + case PDDF_INT_DEC: + ret = kstrtoint(buf,10,&num); + if (ret==0) + *(int *)(ptr->addr) = num; +#if DEBUG + pddf_dbg(LED, KERN_ERR "[ WRITE ] ATTR PTR [%s] PDDF_DEC VALUE:%d\n", + ptr->dev_attr.attr.name, *(int *)(ptr->addr)); +#endif + break; + case PDDF_INT_HEX: + ret = kstrtoint(buf,16,&num); + if (ret==0) + *(int *)(ptr->addr) = num; +#if DEBUG + pddf_dbg(LED, KERN_ERR "[ WRITE ] ATTR PTR [%s] PDDF_HEX VALUE:0x%x\n", + ptr->dev_attr.attr.name, *(int *)(ptr->addr)); +#endif + break; + case PDDF_USHORT: + ret = kstrtoint(buf,16,&num); + if (ret==0) + *(unsigned short *)(ptr->addr) = (unsigned short)num; +#if DEBUG + pddf_dbg(LED, KERN_ERR "[ WRITE ] ATTR PTR [%s] PDDF_USHORT VALUE:%x\n", + ptr->dev_attr.attr.name, *(unsigned short *)(ptr->addr)); +#endif + break; + case PDDF_UINT32: + ret = kstrtoint(buf,16,&num); + if (ret==0) + *(uint32_t *)(ptr->addr) = (uint32_t)num; +#if DEBUG + pddf_dbg(LED, KERN_ERR "[ WRITE ] ATTR PTR [%s] PDDF_UINT32 VALUE:%d\n", + ptr->dev_attr.attr.name, *(uint32_t *)(ptr->addr)); +#endif + break; + default: + break; + } + return count; +} + +static int load_led_ops_data(struct device_attribute *da, LED_STATUS state) +{ + struct pddf_data_attribute *_ptr = (struct pddf_data_attribute *)da; + LED_OPS_DATA* ptr=(LED_OPS_DATA*)_ptr->addr; + LED_TYPE led_type; + LED_OPS_DATA* ops_ptr=NULL; + if(!ptr || strlen(ptr->device_name)==0 ) { + pddf_dbg(LED, KERN_INFO "SYSTEM_LED: load_led_ops_data return -1 device_name:%s\n", ptr? ptr->device_name:"NULL"); + return(-1); + } + if(ptr->device_name) + { + pddf_dbg(LED, KERN_INFO "[%s]: load_led_ops_data: index=%d addr=0x%x;0x%x valu=0x%x\n", + ptr->device_name, ptr->index, ptr->swpld_addr, ptr->swpld_addr_offset, ptr->data[0].value); + } + if((led_type=get_dev_type(ptr->device_name))==LED_TYPE_MAX) { + pddf_dbg(LED, KERN_ERR "PDDF_LED ERROR *%s Unsupported Led Type\n", __func__); + return(-1); + } + if(dev_index_check(led_type, ptr->index)==-1) { + pddf_dbg(LED, KERN_ERR "PDDF_LED ERROR %s invalid index: %d for type:%d\n", __func__, ptr->index, led_type); + return(-1); + } + ops_ptr = dev_list[led_type]+ptr->index; + + memcpy(ops_ptr->device_name, ptr->device_name, sizeof(ops_ptr->device_name)); + ops_ptr->index = ptr->index; + memcpy(&ops_ptr->data[state], &ptr->data[0], sizeof(LED_DATA)); + ops_ptr->data[state].swpld_addr = ptr->swpld_addr; + ops_ptr->data[state].swpld_addr_offset = ptr->swpld_addr_offset; + ops_ptr->swpld_addr = ptr->swpld_addr; + ops_ptr->swpld_addr_offset = ptr->swpld_addr_offset; + + print_led_data(dev_list[led_type]+ptr->index, state); + + memset(ptr, 0, sizeof(LED_OPS_DATA)); + return (0); +} + +static int show_led_ops_data(struct device_attribute *da) +{ + LED_OPS_DATA* ops_ptr=find_led_ops_data(da); + print_led_data(ops_ptr, -1); + return(0); +} + +static int verify_led_ops_data(struct device_attribute *da) +{ + struct pddf_data_attribute *_ptr = (struct pddf_data_attribute *)da; + LED_OPS_DATA* ptr=(LED_OPS_DATA*)_ptr->addr; + LED_OPS_DATA* ops_ptr=find_led_ops_data(da); + + if(ops_ptr) + memcpy(ptr, ops_ptr, sizeof(LED_OPS_DATA)); + else + { + pddf_dbg(LED, "SYSTEM_LED: verify_led_ops_data: Failed to find ops_ptr name:%s; index=%d\n", ptr->device_name, ptr->index); + } + return (0); +} + + +ssize_t dev_operation(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ +#if DEBUG + pddf_dbg(LED, KERN_INFO "dev_operation [%s]\n", buf); +#endif + if(strstr(buf, "STATUS_LED_COLOR")!= NULL) { + LED_STATUS index = find_state_index(buf); + if (index < MAX_LED_STATUS ) { + load_led_ops_data(da, index); + } else { + printk(KERN_ERR "PDDF_ERROR %s: Invalid state for dev_ops %s", __FUNCTION__, buf); + } + } + else if(strncmp(buf, "show", strlen("show"))==0 ) { + show_led_ops_data(da); + } + else if(strncmp(buf, "verify", strlen("verify"))==0 ) { + verify_led_ops_data(da); + } + else if(strncmp(buf, "get_status", strlen("get_status"))==0 ) { + get_status_led(da); + } + else if(strncmp(buf, "set_status", strlen("set_status"))==0 ) { + set_status_led(da); + } + else { + printk(KERN_ERR "PDDF_ERROR %s: Invalid value for dev_ops %s", __FUNCTION__, buf); + } + return(count); +} + +ssize_t store_config_data(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int ret, num; + struct pddf_data_attribute *ptr = (struct pddf_data_attribute *)da; + if(strncmp(ptr->dev_attr.attr.name, "num_psus", strlen("num_psus"))==0 ) { + ret = kstrtoint(buf,10,&num); + if (ret==0) + *(int *)(ptr->addr) = num; + if(psu_led_ops_data == NULL) { + if ((psu_led_ops_data = kzalloc(num * sizeof(LED_OPS_DATA), GFP_KERNEL)) == NULL) { + printk(KERN_ERR "PDDF_LED ERROR failed to allocate memory for PSU LED\n"); + return (count); + } + pddf_dbg(LED, "Allocate PSU LED Memory ADDR=%p\n", psu_led_ops_data); + dev_list[LED_PSU]=psu_led_ops_data; + } +#if DEBUG + pddf_dbg(LED, "[ WRITE ] ATTR CONFIG [%s] VALUE:%d; %d\n", + ptr->dev_attr.attr.name, num, num_psus); +#endif + return(count); + } + if(strncmp(ptr->dev_attr.attr.name, "num_fantrays", strlen("num_fantrays"))==0 ) { + ret = kstrtoint(buf,10,&num); + if (ret==0) + *(int *)(ptr->addr) = num; + if (fantray_led_ops_data == NULL) { + if ((fantray_led_ops_data = kzalloc(num * sizeof(LED_OPS_DATA), GFP_KERNEL)) == NULL) { + printk(KERN_ERR "PDDF_LED ERROR failed to allocate memory for FANTRAY LED\n"); + return (count); + } + pddf_dbg(LED, "Allocate FanTray LED Memory ADDR=%p\n", fantray_led_ops_data); + dev_list[LED_FANTRAY]=fantray_led_ops_data; + } +#if DEBUG + pddf_dbg(LED, "[ WRITE ] ATTR CONFIG [%s] VALUE:%d; %d\n", + ptr->dev_attr.attr.name, num, num_fantrays); +#endif + return(count); + } + return (count); +} + +ssize_t store_bits_data(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int len = 0, num1 = 0, num2 = 0, i=0, rc1=0, rc2=0; + char mask=0xFF; + char *pptr=NULL; + char bits[NAME_SIZE]; + struct pddf_data_attribute *ptr = (struct pddf_data_attribute *)da; + MASK_BITS* bits_ptr=(MASK_BITS*)(ptr->addr); + strncpy(bits_ptr->bits, buf, strlen(buf)-1); // to discard newline char form buf + bits_ptr->bits[strlen(buf)-1] = '\0'; + if((pptr=strstr(buf,":")) != NULL) { + len=pptr-buf; + sprintf(bits, buf); + bits[len]='\0'; + rc1=kstrtoint(bits,16,&num1); + if (rc1==0) + { + sprintf(bits, ++pptr); + rc2=kstrtoint(bits,16,&num2); + if (rc2==0) + { + for (i=num2; i<=num1; i++) { + mask &= ~(1 << i); + } + bits_ptr->mask_bits = mask; + bits_ptr->pos = num2; + } + } + } else { + rc1=kstrtoint(buf,16,&num1); + if (rc1==0) + { + bits_ptr->mask_bits = mask & ~(1 << num1); + bits_ptr->pos = num1; + } + } +#if DEBUG + pddf_dbg(LED, KERN_ERR "[ WRITE ] ATTR PTR Bits [%s] VALUE:%s mask:0x%x; pos:0x%x\n", + ptr->dev_attr.attr.name, bits_ptr->bits, bits_ptr->mask_bits, bits_ptr->pos); +#endif + return (count); +} + +/************************************************************************** + * platform/ attributes + **************************************************************************/ +PDDF_LED_DATA_ATTR(platform, num_psus, S_IWUSR|S_IRUGO, show_pddf_data, + store_config_data, PDDF_INT_DEC, sizeof(int), (void*)&num_psus); +PDDF_LED_DATA_ATTR(platform, num_fantrays, S_IWUSR|S_IRUGO, show_pddf_data, + store_config_data, PDDF_INT_DEC, sizeof(int), (void*)&num_fantrays); + +struct attribute* attrs_platform[]={ + &pddf_dev_platform_attr_num_psus.dev_attr.attr, + &pddf_dev_platform_attr_num_fantrays.dev_attr.attr, + NULL, +}; +struct attribute_group attr_group_platform={ + .attrs = attrs_platform, +}; + +/************************************************************************** + * led/ attributes + **************************************************************************/ +PDDF_LED_DATA_ATTR(dev, device_name, S_IWUSR|S_IRUGO, show_pddf_data, + store_pddf_data, PDDF_CHAR, NAME_SIZE, (void*)&temp_data.device_name); +PDDF_LED_DATA_ATTR(dev, index, S_IWUSR|S_IRUGO, show_pddf_data, + store_pddf_data, PDDF_INT_DEC, sizeof(int), (void*)&temp_data.index); +PDDF_LED_DATA_ATTR(dev, swpld_addr, S_IWUSR|S_IRUGO, show_pddf_data, + store_pddf_data, PDDF_INT_HEX, sizeof(int), (void*)&temp_data.swpld_addr); +PDDF_LED_DATA_ATTR(dev, swpld_addr_offset, S_IWUSR|S_IRUGO, show_pddf_data, + store_pddf_data, PDDF_INT_HEX, sizeof(int), (void*)&temp_data.swpld_addr_offset); +PDDF_LED_DATA_ATTR(dev, dev_ops , S_IWUSR, NULL, + dev_operation, PDDF_CHAR, NAME_SIZE, (void*)&temp_data); + +struct attribute* attrs_dev[]={ + &pddf_dev_dev_attr_device_name.dev_attr.attr, + &pddf_dev_dev_attr_index.dev_attr.attr, + &pddf_dev_dev_attr_swpld_addr.dev_attr.attr, + &pddf_dev_dev_attr_swpld_addr_offset.dev_attr.attr, + &pddf_dev_dev_attr_dev_ops.dev_attr.attr, + NULL, +}; +struct attribute_group attr_group_dev={ + .attrs = attrs_dev, +}; + +/************************************************************************** + * state_attr/ attributes + **************************************************************************/ +#define LED_DEV_STATE_ATTR_GROUP(name, func) \ + PDDF_LED_DATA_ATTR(name, bits, S_IWUSR|S_IRUGO, show_pddf_data, \ + store_bits_data, PDDF_CHAR, NAME_SIZE, func.bits.bits); \ + PDDF_LED_DATA_ATTR(name, value, S_IWUSR|S_IRUGO, show_pddf_data, \ + store_pddf_data, PDDF_USHORT, sizeof(unsigned short), func.value); \ + struct attribute* attrs_##name[]={ \ + &pddf_dev_##name##_attr_bits.dev_attr.attr, \ + &pddf_dev_##name##_attr_value.dev_attr.attr, \ + NULL, \ + }; \ + struct attribute_group attr_group_##name={ \ + .attrs = attrs_##name, \ + }; \ + + +LED_DEV_STATE_ATTR_GROUP(state_attr, (void*)&temp_data.data[0]) + +/************************************************************************** + * cur_state/ attributes + **************************************************************************/ +PDDF_LED_DATA_ATTR(cur_state, color, S_IWUSR|S_IRUGO, show_pddf_data, + store_pddf_data, PDDF_CHAR, NAME_SIZE, (void*)&temp_data.cur_state.color); + +struct attribute* attrs_cur_state[]={ + &pddf_dev_cur_state_attr_color.dev_attr.attr, + NULL, +}; +struct attribute_group attr_group_cur_state={ + .attrs = attrs_cur_state, +}; + +/*************************************************************************/ +#define KOBJ_FREE(obj) \ + if(obj) kobject_put(obj); \ + +void free_kobjs(void) +{ + KOBJ_FREE(cur_state_kobj) + KOBJ_FREE(state_attr_kobj) + KOBJ_FREE(led_kobj) + KOBJ_FREE(platform_kobj) +} + +int KBOJ_CREATE(char* name, struct kobject* parent, struct kobject** child) +{ + if (parent) { + *child = kobject_create_and_add(name, parent); + } else { + printk(KERN_ERR "PDDF_LED ERROR to create %s kobj; null parent\n", name); + free_kobjs(); + return (-ENOMEM); + } + return (0); +} + +int LED_DEV_ATTR_CREATE(struct kobject *kobj, const struct attribute_group *attr, const char* name) +{ + int status = sysfs_create_group(kobj, attr); + if(status) { + pddf_dbg(LED, KERN_ERR "Driver ERROR: sysfs_create %s failed rc=%d\n", name, status); + } + return (status); +} + + +static int __init led_init(void) { + struct kobject *device_kobj; + pddf_dbg(LED, KERN_INFO "PDDF GENERIC LED MODULE init..\n"); + + device_kobj = get_device_i2c_kobj(); + if(!device_kobj) + return -ENOMEM; + + KBOJ_CREATE("platform", device_kobj, &platform_kobj); + KBOJ_CREATE("led", device_kobj, &led_kobj); + KBOJ_CREATE("state_attr", led_kobj, &state_attr_kobj); + KBOJ_CREATE("cur_state", led_kobj, &cur_state_kobj); + + LED_DEV_ATTR_CREATE(platform_kobj, &attr_group_platform, "attr_group_platform"); + LED_DEV_ATTR_CREATE(led_kobj, &attr_group_dev, "attr_group_dev"); + LED_DEV_ATTR_CREATE(state_attr_kobj, &attr_group_state_attr, "attr_group_state_attr"); + LED_DEV_ATTR_CREATE(cur_state_kobj, &attr_group_cur_state, "attr_group_cur_state"); + return (0); +} + + +static void __exit led_exit(void) { + pddf_dbg(LED, "PDDF GENERIC LED MODULE exit..\n"); + free_kobjs(); + if(psu_led_ops_data) kfree(psu_led_ops_data); + if(fantray_led_ops_data) kfree(fantray_led_ops_data); +} + +module_init(led_init); +module_exit(led_exit); + +MODULE_AUTHOR("Broadcom"); +MODULE_DESCRIPTION("led driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/pddf_custom_psu.c b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/pddf_custom_psu.c new file mode 100644 index 000000000000..6c4db972a7f1 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/pddf_custom_psu.c @@ -0,0 +1,104 @@ +#include +#include +#include +#include "../../../../../pddf/i2c/modules/include/pddf_psu_defs.h" +#include "../../../../../pddf/i2c/modules/include/pddf_psu_driver.h" + +static int pddf_custom_psu_present(void *client, PSU_DATA_ATTR *adata, void *data); +extern void *get_device_table(char *name); +extern PSU_SYSFS_ATTR_DATA access_psu_present; +extern PSU_SYSFS_ATTR_DATA access_psu_power_good; + +static int pddf_custom_psu_present(void *client, PSU_DATA_ATTR *adata, void *data) +{ + int ret; + struct i2c_client *client_ptr; + struct psu_attr_info *padata; + + ret = -1; + client_ptr = NULL; + padata = (struct psu_attr_info *)data; + + if (strncmp(adata->devtype, "io", strlen("io")) == 0) { + ret = inb(adata->offset); + + if (ret < 0) { + return ret; + } + + padata->val.intval = ((ret & adata->mask) == adata->cmpval); + } + + else if (strncmp(adata->devtype, "cpld", strlen("cpld")) == 0) { + client_ptr = (struct i2c_client *)get_device_table(adata->devname); + if (client_ptr) { + ret = i2c_smbus_read_byte_data(client_ptr, adata->offset); + } + + if (ret < 0) { + return ret; + } + + padata->val.intval = ((ret & adata->mask) == adata->cmpval); + } + + return 0; +} + +static int pddf_custom_psu_power_good(void *client, PSU_DATA_ATTR *adata, void *data) +{ + int ret; + struct i2c_client *client_ptr; + struct psu_attr_info *padata; + + ret = -1; + client_ptr = NULL; + padata = (struct psu_attr_info *)data; + + if (strncmp(adata->devtype, "io", strlen("io")) == 0) { + ret = inb(adata->offset); + + if (ret < 0) { + return ret; + } + + padata->val.intval = ((ret & adata->mask) == adata->cmpval); + } + + else if (strncmp(adata->devtype, "cpld", strlen("cpld")) == 0) { + client_ptr = (struct i2c_client *)get_device_table(adata->devname); + if (client_ptr) { + ret = i2c_smbus_read_byte_data(client_ptr, adata->offset); + } + + if (ret < 0) { + return ret; + } + + padata->val.intval = ((ret & adata->mask) == adata->cmpval); + } + + return 0; +} + +static int __init pddf_custom_psu_init(void) +{ + access_psu_present.do_get = pddf_custom_psu_present; + access_psu_power_good.do_get = pddf_custom_psu_power_good; + printk(KERN_ERR "pddf_custom_psu_init\n"); + return 0; +} + +static void __exit pddf_custom_psu_exit(void) +{ + printk(KERN_ERR "pddf_custom_psu_exit\n"); + return; +} + +MODULE_AUTHOR("support "); +MODULE_DESCRIPTION("pddf custom psu api"); +MODULE_LICENSE("GPL"); + +module_init(pddf_custom_psu_init); +module_exit(pddf_custom_psu_exit); + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/pddf_led_defs.h b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/pddf_led_defs.h new file mode 100644 index 000000000000..1603f8c5af8e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/pddf_led_defs.h @@ -0,0 +1,120 @@ +/* + * Copyright 2019 Broadcom. + * The term “Broadcom†refers to Broadcom Inc. and/or its subsidiaries. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * + * Description + * Platform LED related defines and structures + */ + + +/***************************************** + * kobj list + *****************************************/ + +struct kobject *platform_kobj=NULL; +struct kobject *led_kobj=NULL; + +struct kobject *state_attr_kobj=NULL; +struct kobject *cur_state_kobj=NULL; + +/***************************************** + * Static Data provided from user + * space JSON data file + *****************************************/ +#define NAME_SIZE 32 +typedef enum { + STATUS_LED_COLOR_GREEN, + STATUS_LED_COLOR_GREEN_BLINK, + STATUS_LED_COLOR_RED, + STATUS_LED_COLOR_RED_BLINK, + STATUS_LED_COLOR_AMBER, + STATUS_LED_COLOR_AMBER_BLINK, + STATUS_LED_COLOR_BLUE, + STATUS_LED_COLOR_BLUE_BLINK, + STATUS_LED_COLOR_OFF, + MAX_LED_STATUS +}LED_STATUS; + +char* LED_STATUS_STR[] = { + "STATUS_LED_COLOR_GREEN", + "STATUS_LED_COLOR_GREEN_BLINK", + "STATUS_LED_COLOR_RED", + "STATUS_LED_COLOR_RED_BLINK", + "STATUS_LED_COLOR_AMBER", + "STATUS_LED_COLOR_AMBER_BLINK", + "STATUS_LED_COLOR_BLUE", + "STATUS_LED_COLOR_BLUE_BLINK", + "STATUS_LED_COLOR_OFF" +}; + + +typedef struct +{ + char bits[NAME_SIZE]; + int pos; + int mask_bits; +}MASK_BITS; + +typedef struct +{ + int swpld_addr; + int swpld_addr_offset; + MASK_BITS bits; + unsigned short value; +} LED_DATA; + +typedef struct +{ + int state; + char color[NAME_SIZE]; +} CUR_STATE_DATA; + +typedef struct +{ + CUR_STATE_DATA cur_state; + char device_name[NAME_SIZE]; + int index; + LED_DATA data[MAX_LED_STATUS]; + int swpld_addr; + int swpld_addr_offset; +} LED_OPS_DATA; + +typedef enum{ + LED_SYS, + LED_PSU, + LED_FAN, + LED_FANTRAY, + LED_DIAG, + LED_LOC, + LED_TYPE_MAX +} LED_TYPE; +char* LED_TYPE_STR[LED_TYPE_MAX] = +{ + "LED_SYS", + "LED_PSU", + "LED_FAN", + "LED_FANTRAY", + "LED_DIAG", + "LED_LOC", +}; + +/***************************************** + * Data exported from kernel for + * user space plugin to get/set + *****************************************/ +#define PDDF_LED_DATA_ATTR( _prefix, _name, _mode, _show, _store, _type, _len, _addr) \ + struct pddf_data_attribute pddf_dev_##_prefix##_attr_##_name = { .dev_attr = __ATTR(_name, _mode, _show, _store), \ + .type = _type , \ + .len = _len , \ + .addr = _addr } diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/ragile.h b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/ragile.h new file mode 100755 index 000000000000..338874297e55 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/ragile.h @@ -0,0 +1,116 @@ +#ifndef __RAGILE_H__ +#define __RAGILE_H__ + +#include +#include + +typedef enum { + DBG_START, + DBG_VERBOSE, + DBG_KEY, + DBG_WARN, + DBG_ERROR, + DBG_END, +} dbg_level_t; + +typedef enum dfd_cpld_id { + BCM_CPLD0 = 0, + BCM_CPLD1, + CPLD0_MAC0, + CPLD0_MAC1, + CPLD1_MAC0, + CPLD2_MAC1, +} dfd_cpld_id_t; + +typedef enum dfd_cpld_bus { + SMBUS_BUS = 0 , + PCA9641_BUS = 1, + GPIO_BUS = 2, +} dfd_cpld_bus_t; + +typedef struct dfd_i2c_dev_s { + int bus; + int addr; +} dfd_i2c_dev_t; + + typedef enum dfd_cpld_addr { + CPLD_ADDR_MIN = 0x31, + BCM_CPLD0_ADDR = 0x32, + CPLD0_MAC0_ADDR = 0x33, + CPLD0_MAC1_ADDR = 0x34, + CPLD1_MAC0_ADDR = 0x35, + CPLD2_MAC1_ADDR = 0x36, + BCM_CPLD1_ADDR = 0x37, + CPLD_ADDR_MAX, +} dfd_cpld_addr_t; + +typedef struct dfd_dev_head_info_s { + uint8_t ver; + uint8_t flag; + uint8_t hw_ver; + uint8_t type; + int16_t tlv_len; +} dfd_dev_head_info_t; + +typedef enum dfd_intf_e{ + DFD_INTF_GET_FAN_HW_VERSION, + DFD_INTF_GET_FAN_STATUS, + DFD_INTF_GET_FAN_SPEED_LEVEL, + DFD_INTF_GET_FAN_SPEED, + DFD_INTF_GET_FAN_ATTRIBUTE, + DFD_INTF_GET_FAN_SN, + DFD_INTF_GET_FAN_TYPE, + DFD_INTF_SET_FAN_SPEED_LEVEL, + DFD_INTF_GET_FAN_SUB_NUM, + DFD_INTF_GET_FAN_FAIL_BITMAP, +}dfd_intf_t; + +typedef struct dfd_dev_tlv_info_s { + uint8_t type; + uint8_t len; + uint8_t data[0]; +} dfd_dev_tlv_info_t; + +typedef enum dfd_dev_info_type_e { + DFD_DEV_INFO_TYPE_MAC = 1, + DFD_DEV_INFO_TYPE_NAME = 2, + DFD_DEV_INFO_TYPE_SN = 3, + DFD_DEV_INFO_TYPE_PWR_CONS = 4, + DFD_DEV_INFO_TYPE_HW_INFO = 5, + DFD_DEV_INFO_TYPE_DEV_TYPE = 6, +} dfd_dev_tlv_type_t; + +typedef struct i2c_muxs_struct_flag +{ + int nr; + char name[48]; + struct mutex update_lock; + int flag; +}i2c_mux_flag; + +extern int setpca9641_muxflag(i2c_mux_flag i2c); +extern i2c_mux_flag getpca9641_muxflag(void) ; + +extern int debuglevel; +extern int dfd_cpld_read_chipid(int cpldid , uint32_t addr, int32_t size, unsigned char *buf); +extern int dfd_cpld_read(int32_t addr, uint8_t *val); +extern int dfd_cpld_write(int32_t addr, uint8_t val); +extern int ragile_setdebug(int val); + +#define DBG_DEBUG(fmt, arg...) do { \ + if ( debuglevel > DBG_START && debuglevel < DBG_ERROR) { \ + printk(KERN_INFO "[DEBUG]:<%s, %d>:"fmt, __FUNCTION__, __LINE__, ##arg); \ + } else if ( debuglevel >= DBG_ERROR ) { \ + printk(KERN_ERR "[DEBUG]:<%s, %d>:"fmt, __FUNCTION__, __LINE__, ##arg); \ + } else { } \ +} while (0) + +#define DBG_ERROR(fmt, arg...) do { \ + if ( debuglevel > DBG_START) { \ + printk(KERN_ERR "[ERROR]:<%s, %d>:"fmt, __FUNCTION__, __LINE__, ##arg); \ + } \ + } while (0) + +#define COMMON_STR_LEN (256) + +#endif diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/rg_cpld.c b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/rg_cpld.c new file mode 100755 index 000000000000..d8edb73277f6 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/rg_cpld.c @@ -0,0 +1,495 @@ +/* + * rg_cpld.c - A driver for control rg_cpld base on rg_cpld.c + * + * Copyright (c) 1998, 1999 Frodo Looijaard + * Copyright (c) 2018 support + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +typedef enum { + DBG_START, + DBG_VERBOSE, + DBG_KEY, + DBG_WARN, + DBG_ERROR, + DBG_END, +} dbg_level_t; + +static int debuglevel = 0; +module_param(debuglevel, int, S_IRUGO | S_IWUSR); + +#define DBG_DEBUG(fmt, arg...) do { \ + if ( debuglevel > DBG_START && debuglevel < DBG_ERROR) { \ + printk(KERN_INFO "[DEBUG]:<%s, %d>:"fmt, __FUNCTION__, __LINE__, ##arg); \ + } else if ( debuglevel >= DBG_ERROR ) { \ + printk(KERN_ERR "[DEBUG]:<%s, %d>:"fmt, __FUNCTION__, __LINE__, ##arg); \ + } else { } \ +} while (0) + +#define DBG_ERROR(fmt, arg...) do { \ + if ( debuglevel > DBG_START) { \ + printk(KERN_ERR "[ERROR]:<%s, %d>:"fmt, __FUNCTION__, __LINE__, ##arg); \ + } \ + } while (0) + +static const unsigned short rg_i2c_cpld[] = { 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, I2C_CLIENT_END }; + +#define CPLD_SIZE 256 +#define CPLD_I2C_RETRY_TIMES 5 +#define CPLD_I2C_RETRY_WAIT_TIME 10 + +#define COMMON_STR_LEN (256) + + +struct cpld_data { + struct i2c_client *client; + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 data[CPLD_SIZE]; /* Register value */ +}; + +static s32 cpld_i2c_smbus_read_byte_data(const struct i2c_client *client, u8 command) +{ + int try; + s32 ret; + + ret = -1; + for (try = 0; try < CPLD_I2C_RETRY_TIMES; try++) { + if ((ret = i2c_smbus_read_byte_data(client, command) ) >= 0 ) + break; + msleep(CPLD_I2C_RETRY_WAIT_TIME); + } + return ret; +} + +static s32 cpld_i2c_smbus_read_i2c_block_data(const struct i2c_client *client, + u8 command, u8 length, u8 *values) +{ + int try; + s32 ret; + + ret = -1; + for (try = 0; try < CPLD_I2C_RETRY_TIMES; try++) { + if ((ret = i2c_smbus_read_i2c_block_data(client, command, length, values) ) >= 0 ) + break; + msleep(CPLD_I2C_RETRY_WAIT_TIME); + } + return ret; +} + +static ssize_t show_fan_rpm_value(struct device *dev, struct device_attribute *da, char *buf) +{ + struct cpld_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->client; + int index = to_sensor_dev_attr_2(da)->index; + uint8_t size; + s32 status; + s32 ret_t; + + ret_t = 0; + status = -1; + size = 0; + mutex_lock(&data->update_lock); + status = cpld_i2c_smbus_read_byte_data(client, index); + if (status < 0) { + mutex_unlock(&data->update_lock); + return 0; + } + data->data[0] = status; + status = cpld_i2c_smbus_read_byte_data(client, index + 1); + if (status < 0) { + mutex_unlock(&data->update_lock); + return 0; + } + data->data[1] = status; + DBG_DEBUG("cpld reg pos:0x%x value:0x%x\n", index, data->data[0]); + DBG_DEBUG("cpld reg pos:0x%x value:0x%x\n", index + 1, data->data[1]); + ret_t = (data->data[1] << 8) + data->data[0] ; + if (ret_t == 0 ) { + size = snprintf(buf, CPLD_SIZE, "%d\n", ret_t); + } else if (ret_t == 0xffff) { + size = snprintf(buf, CPLD_SIZE, "%d\n", 0); + } else { + size = snprintf(buf, CPLD_SIZE, "%d\n", 15000000 / ret_t); + } + mutex_unlock(&data->update_lock); + return size; +} + +static ssize_t set_cpld_sysfs_value(struct device *dev, struct device_attribute *da, const char *buf, size_t +count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + unsigned long val; + int err; + + err = kstrtoul(buf, 16, &val); + if (err) + return err; + if ((val < 0) || (val > 0xff)) { + DBG_ERROR("please enter 0x00 ~ 0xff\n"); + return -1; + } + mutex_lock(&data->update_lock); + data->data[0] = (u8)val; + DBG_DEBUG("pos: 0x%02x count = %ld, data = 0x%02x\n", attr->index, count, data->data[0]); + i2c_smbus_write_byte_data(client, attr->index, data->data[0]); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_cpld_version(struct device *dev, struct device_attribute *da, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + s32 status; + + status = -1; + mutex_lock(&data->update_lock); + status = cpld_i2c_smbus_read_i2c_block_data(client, 0, 4, data->data); + if (status < 0) { + mutex_unlock(&data->update_lock); + return 0; + } + mutex_unlock(&data->update_lock); + return snprintf(buf, COMMON_STR_LEN, "%02x %02x %02x %02x \n", data->data[0], data->data[1], data->data[2], + data->data[3]); +} + +static ssize_t show_cpld_sysfs_value(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + s32 status; + + status = -1; + mutex_lock(&data->update_lock); + status = cpld_i2c_smbus_read_byte_data(client, attr->index); + if (status < 0) { + mutex_unlock(&data->update_lock); + return 0; + } + data->data[0] = status; + DBG_DEBUG("cpld reg pos:0x%x value:0x%02x\n", attr->index, data->data[0]); + mutex_unlock(&data->update_lock); + return snprintf(buf, COMMON_STR_LEN, "%02x\n", data->data[0]); +} + +/* sys */ +static SENSOR_DEVICE_ATTR(cpld_version, S_IRUGO, show_cpld_version, NULL, 0); +static SENSOR_DEVICE_ATTR(broad_back_sys, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x72); +static SENSOR_DEVICE_ATTR(broad_front_pwr, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x73); +static SENSOR_DEVICE_ATTR(broad_front_fan, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x74); + + +/* fan */ +static SENSOR_DEVICE_ATTR(fan_present, S_IRUGO, show_cpld_sysfs_value, NULL, 0x30); +static SENSOR_DEVICE_ATTR(fan_status, S_IRUGO, show_cpld_sysfs_value, NULL, 0x31); + +static SENSOR_DEVICE_ATTR(fan1_speed_set, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x14); +static SENSOR_DEVICE_ATTR(fan1_1_real_speed, S_IRUGO, show_fan_rpm_value, NULL, 0x1B); +static SENSOR_DEVICE_ATTR(fan1_2_real_speed, S_IRUGO, show_fan_rpm_value, NULL, 0x25); +static SENSOR_DEVICE_ATTR(fan1_led, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x3b); + + +static SENSOR_DEVICE_ATTR(fan2_speed_set, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x15); +static SENSOR_DEVICE_ATTR(fan2_1_real_speed, S_IRUGO, show_fan_rpm_value, NULL, 0x1D); +static SENSOR_DEVICE_ATTR(fan2_2_real_speed, S_IRUGO, show_fan_rpm_value, NULL, 0x27); +static SENSOR_DEVICE_ATTR(fan2_led, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x3c); + + +static SENSOR_DEVICE_ATTR(fan3_speed_set, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x16); +static SENSOR_DEVICE_ATTR(fan3_1_real_speed, S_IRUGO, show_fan_rpm_value, NULL, 0x1F); +static SENSOR_DEVICE_ATTR(fan3_2_real_speed, S_IRUGO, show_fan_rpm_value, NULL, 0x29); +static SENSOR_DEVICE_ATTR(fan3_led, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x3d); + + +static SENSOR_DEVICE_ATTR(fan4_speed_set, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x17); +static SENSOR_DEVICE_ATTR(fan4_1_real_speed, S_IRUGO, show_fan_rpm_value, NULL, 0x21); +static SENSOR_DEVICE_ATTR(fan4_2_real_speed, S_IRUGO, show_fan_rpm_value, NULL, 0x2b); +static SENSOR_DEVICE_ATTR(fan4_led, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x3e); + +static SENSOR_DEVICE_ATTR(fan5_speed_set, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x18); +static SENSOR_DEVICE_ATTR(fan5_1_real_speed, S_IRUGO, show_fan_rpm_value, NULL, 0x23); +static SENSOR_DEVICE_ATTR(fan5_2_real_speed, S_IRUGO, show_fan_rpm_value, NULL, 0x2d); +static SENSOR_DEVICE_ATTR(fan5_led, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x3f); + +/* sfp */ +static SENSOR_DEVICE_ATTR(sfp_enable, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, +0x94); +static SENSOR_DEVICE_ATTR(sfp_presence1, S_IRUGO, show_cpld_sysfs_value, NULL, 0x10); +static SENSOR_DEVICE_ATTR(sfp_presence2, S_IRUGO, show_cpld_sysfs_value, NULL, 0x11); +static SENSOR_DEVICE_ATTR(sfp_presence3, S_IRUGO, show_cpld_sysfs_value, NULL, 0x10); +static SENSOR_DEVICE_ATTR(sfp_presence4, S_IRUGO, show_cpld_sysfs_value, NULL, 0x11); +static SENSOR_DEVICE_ATTR(sfp_led1, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x18); +static SENSOR_DEVICE_ATTR(sfp_led2, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x19); +static SENSOR_DEVICE_ATTR(sfp_led3, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x18); +static SENSOR_DEVICE_ATTR(sfp_led4, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, set_cpld_sysfs_value, 0x19); +static SENSOR_DEVICE_ATTR(sfp_reset1, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, set_cpld_sysfs_value, 0x14); +static SENSOR_DEVICE_ATTR(sfp_reset2, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, set_cpld_sysfs_value, 0x15); +static SENSOR_DEVICE_ATTR(sfp_reset3, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, set_cpld_sysfs_value, 0x14); +static SENSOR_DEVICE_ATTR(sfp_reset4, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, set_cpld_sysfs_value, 0x15); + +static struct attribute *cpld_bus2_addr_0x0d_sysfs_attrs[] = { + &sensor_dev_attr_cpld_version.dev_attr.attr, + &sensor_dev_attr_fan_present.dev_attr.attr, + &sensor_dev_attr_fan_status.dev_attr.attr, + + &sensor_dev_attr_fan1_speed_set.dev_attr.attr, + &sensor_dev_attr_fan1_1_real_speed.dev_attr.attr, + &sensor_dev_attr_fan1_2_real_speed.dev_attr.attr, + &sensor_dev_attr_fan1_led.dev_attr.attr, + + &sensor_dev_attr_fan2_speed_set.dev_attr.attr, + &sensor_dev_attr_fan2_1_real_speed.dev_attr.attr, + &sensor_dev_attr_fan2_2_real_speed.dev_attr.attr, + &sensor_dev_attr_fan2_led.dev_attr.attr, + + &sensor_dev_attr_fan3_speed_set.dev_attr.attr, + &sensor_dev_attr_fan3_1_real_speed.dev_attr.attr, + &sensor_dev_attr_fan3_2_real_speed.dev_attr.attr, + &sensor_dev_attr_fan3_led.dev_attr.attr, + + &sensor_dev_attr_fan4_speed_set.dev_attr.attr, + &sensor_dev_attr_fan4_1_real_speed.dev_attr.attr, + &sensor_dev_attr_fan4_2_real_speed.dev_attr.attr, + &sensor_dev_attr_fan4_led.dev_attr.attr, + + &sensor_dev_attr_fan5_speed_set.dev_attr.attr, + &sensor_dev_attr_fan5_1_real_speed.dev_attr.attr, + &sensor_dev_attr_fan5_2_real_speed.dev_attr.attr, + &sensor_dev_attr_fan5_led.dev_attr.attr, + NULL +}; + +static struct attribute *cpld_bus6_addr_0x0d_sysfs_attrs[] = { + &sensor_dev_attr_cpld_version.dev_attr.attr, + &sensor_dev_attr_broad_back_sys.dev_attr.attr, + &sensor_dev_attr_broad_front_pwr.dev_attr.attr, + &sensor_dev_attr_broad_front_fan.dev_attr.attr, + &sensor_dev_attr_sfp_enable.dev_attr.attr, + NULL +}; + +static struct attribute *cpld_bus8_addr_0x30_sysfs_attrs[] = { + &sensor_dev_attr_sfp_presence1.dev_attr.attr, + &sensor_dev_attr_sfp_presence2.dev_attr.attr, + &sensor_dev_attr_sfp_led1.dev_attr.attr, + &sensor_dev_attr_sfp_led2.dev_attr.attr, + &sensor_dev_attr_sfp_reset1.dev_attr.attr, + &sensor_dev_attr_sfp_reset2.dev_attr.attr, + NULL +}; + +static struct attribute *cpld_bus8_addr_0x31_sysfs_attrs[] = { + &sensor_dev_attr_sfp_presence3.dev_attr.attr, + &sensor_dev_attr_sfp_presence4.dev_attr.attr, + &sensor_dev_attr_sfp_led3.dev_attr.attr, + &sensor_dev_attr_sfp_led4.dev_attr.attr, + &sensor_dev_attr_sfp_reset3.dev_attr.attr, + &sensor_dev_attr_sfp_reset4.dev_attr.attr, + NULL +}; + +static const struct attribute_group cpld_bus2_addr_0x0d_sysfs_group = { + .attrs = cpld_bus2_addr_0x0d_sysfs_attrs, +}; + +static const struct attribute_group cpld_bus6_addr_0x0d_sysfs_group = { + .attrs = cpld_bus6_addr_0x0d_sysfs_attrs, +}; + +static const struct attribute_group cpld_bus8_addr_0x30_sysfs_group = { + .attrs = cpld_bus8_addr_0x30_sysfs_attrs, +}; + +static const struct attribute_group cpld_bus8_addr_0x31_sysfs_group = { + .attrs = cpld_bus8_addr_0x31_sysfs_attrs, +}; + +struct cpld_attr_match_group { + int bus_nr; + unsigned short addr; + const struct attribute_group *attr_group_ptr; + const struct attribute_group *attr_hwmon_ptr; +}; + +static struct cpld_attr_match_group g_cpld_attr_match[] = { + {2, 0x0d, &cpld_bus2_addr_0x0d_sysfs_group, NULL}, + /* {6, 0x0d, &cpld_bus6_addr_0x0d_sysfs_group, NULL}, */ + {8, 0x30, &cpld_bus8_addr_0x30_sysfs_group, NULL}, + {8, 0x31, &cpld_bus8_addr_0x31_sysfs_group, NULL}, +}; + +static const struct attribute_group *cpld_get_attr_group(struct i2c_client *client, int is_hwmon) +{ + int i; + struct cpld_attr_match_group *group; + + for (i = 0; i < ARRAY_SIZE(g_cpld_attr_match); i++) { + group = &g_cpld_attr_match[i]; + DBG_DEBUG("is_hwmon %d i %d client(nr:%d,addr:0x%x), group(nr:%d,addr:0x0%x) .\n", is_hwmon, + i, client->adapter->nr, client->addr, group->bus_nr, group->addr); + if ((client->addr == group->addr) && (client->adapter->nr == group->bus_nr)) { + DBG_DEBUG("is_hwmon %d i %d nr %d addr %d .\n", is_hwmon, i, client->adapter->nr, client->addr); + return (is_hwmon) ? (group->attr_hwmon_ptr) : (group->attr_group_ptr); + } + } + + DBG_DEBUG("is_hwmon %d nr %d addr %d dismatch, return NULL.\n", is_hwmon, client->adapter->nr, client->addr); + return NULL; +} + +#if 0 +static int cpld_detect(struct i2c_client *new_client, struct i2c_board_info *info) +{ + struct i2c_adapter *adapter = new_client->adapter; + int conf; + DBG_DEBUG("=========cpld_detect(0x%x)===========\n", new_client->addr); + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA)) + return -ENODEV; + conf = i2c_smbus_read_byte_data(new_client, 0); + if (!conf) + return -ENODEV; + strlcpy(info->type, "rg_cpld", I2C_NAME_SIZE); + return 0; +} +#endif + +static int cpld_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct cpld_data *data; + int status; + const struct attribute_group *sysfs_group, *hwmon_group; + + status = -1; + DBG_DEBUG("=========cpld_probe(addr:0x%x, nr:%d)===========\n", client->addr, client->adapter->nr); + data = devm_kzalloc(&client->dev, sizeof(struct cpld_data), GFP_KERNEL); + if (!data) { + return -ENOMEM; + } + + data->client = client; + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + sysfs_group = NULL; + sysfs_group = cpld_get_attr_group(client, 0); + if (sysfs_group) { + status = sysfs_create_group(&client->dev.kobj, sysfs_group); + DBG_DEBUG("=========(addr:0x%x, nr:%d) sysfs_create_group status %d===========\n", client->addr, client->adapter->nr, status); + if (status != 0) { + DBG_ERROR("sysfs_create_group status %d.\n", status); + goto error; + } + } else { + DBG_DEBUG("=========(addr:0x%x, nr:%d) no sysfs_create_group \n", client->addr, client->adapter->nr); + } + + hwmon_group = NULL; + hwmon_group = cpld_get_attr_group(client, 1); + if (hwmon_group) { + data->hwmon_dev = hwmon_device_register_with_groups(&client->dev, client->name, data, (const struct attribute_group **)hwmon_group); + if (IS_ERR(data->hwmon_dev)) { + sysfs_remove_group(&client->dev.kobj, (const struct attribute_group *)sysfs_group); + DBG_ERROR("hwmon_device_register_with_groups failed ret %ld.\n", PTR_ERR(data->hwmon_dev)); + return PTR_ERR(data->hwmon_dev); + } + DBG_DEBUG("=========(addr:0x%x, nr:%d) hwmon_device_register_with_groups success===========\n", client->addr, client->adapter->nr); + if (status != 0) { + DBG_ERROR("sysfs_create_group status %d.\n", status); + goto error; + } + } else { + DBG_DEBUG("=========(addr:0x%x, nr:%d) no hwmon_device_register_with_groups \n", client->addr, client->adapter->nr); + } + +error: + return status; + +} + +static int cpld_remove(struct i2c_client *client) +{ + struct cpld_data *data = i2c_get_clientdata(client); + const struct attribute_group *sysfs_group, *hwmon_group; + + DBG_DEBUG("=========cpld_remove(addr:0x%x, nr:%d)===========\n", client->addr, client->adapter->nr); + + sysfs_group = NULL; + sysfs_group = cpld_get_attr_group(client, 0); + if (sysfs_group) { + DBG_DEBUG("=========(addr:0x%x, nr:%d) do sysfs_remove_group \n", client->addr, client->adapter->nr); + sysfs_remove_group(&client->dev.kobj, (const struct attribute_group *)sysfs_group); + } else { + DBG_DEBUG("=========(addr:0x%x, nr:%d) no sysfs_remove_group \n", client->addr, client->adapter->nr); + } + + hwmon_group = NULL; + hwmon_group = cpld_get_attr_group(client, 1); + if (hwmon_group) { + DBG_DEBUG("=========(addr:0x%x, nr:%d) do hwmon_device_unregister \n", client->addr, client->adapter->nr); + hwmon_device_unregister(data->hwmon_dev); + } else { + DBG_DEBUG("=========(addr:0x%x, nr:%d) no hwmon_device_unregister \n", client->addr, client->adapter->nr); + } + + return 0; +} + +static const struct i2c_device_id cpld_id[] = { + { "rg_cpld", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, cpld_id); + +static struct i2c_driver rg_cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "rg_cpld", + }, + .probe = cpld_probe, + .remove = cpld_remove, + .id_table = cpld_id, + //.detect = cpld_detect, + // .address_list = rg_i2c_cpld, +}; + +module_i2c_driver(rg_cpld_driver); +MODULE_AUTHOR("support "); +MODULE_DESCRIPTION("ragile CPLD driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/rg_lpc_cpld.c b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/rg_lpc_cpld.c new file mode 100755 index 000000000000..7f32a47436b7 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/modules/driver/rg_lpc_cpld.c @@ -0,0 +1,237 @@ +#include /* Wd're doing kernel work */ +#include /* specifically, a module */ +#include +#include /* Need for the macros */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ragile.h" + +int lpc_cpld_verbose = 0; +int lpc_cpld_error = 0; +module_param(lpc_cpld_verbose, int, S_IRUGO | S_IWUSR); +module_param(lpc_cpld_error, int, S_IRUGO | S_IWUSR); + + +#define LPC_CPLD_VERBOSE(fmt, args...) do { \ + if (lpc_cpld_verbose) { \ + printk(KERN_ERR "[LPC_CPLD_I2C_DEVICE][VERBOSE][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ + } \ +} while (0) + +#define LPC_CPLD_ERROR(fmt, args...) do { \ + if (lpc_cpld_error) { \ + printk(KERN_ERR "[LPC_CPLD_I2C_DEVICE][ERROR][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ + } \ + } while (0) + +#define PCI_VENDOR_ID_D1527_LPC (0x8c54) +#define PCI_VENDOR_ID_C3000_LPC (0x19dc) + +#define MAX_CPLD_REG_SIZE (0x100) +#define LPC_GET_CPLD_ID(addr) ((addr >> 16) & 0xff) +#define LPC_GET_CPLD_OFFSET(addr) ((addr) & 0xff) +typedef struct rg_lpc_device_s { + u16 base; + u16 size; + u8 type; + u8 id; +} rg_lpc_device_t; + +typedef enum rg_lpc_dev_type_s { + LPC_DEVICE_CPLD = 1, + LPC_DEVICE_FPGA = 2, +} rg_lpc_dev_type_t; + +static rg_lpc_device_t g_rg_lpc_dev[] = { + {.base = 0x700, .size = MAX_CPLD_REG_SIZE, .type = LPC_DEVICE_CPLD, .id = 0}, + {.base = 0x900, .size = MAX_CPLD_REG_SIZE, .type = LPC_DEVICE_CPLD, .id = 1}, + {.base = 0xb00, .size = MAX_CPLD_REG_SIZE, .type = LPC_DEVICE_CPLD, .id = 2}, + /*{.base = 0x900, .size = MAX_FPGA_REG_SIZE, .type = LPC_DEVICE_FPGA, .id = 0},*/ +}; + +static rg_lpc_device_t* lpc_get_device_info(int type, int id) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(g_rg_lpc_dev); i++) { + if ((g_rg_lpc_dev[i].type == type) && (g_rg_lpc_dev[i].id == id)) { + return &g_rg_lpc_dev[i]; + } + } + + return NULL; +} + +static int lpc_cpld_read(int address, u8 *val) +{ + int cpld_id; + rg_lpc_device_t *info; + + LPC_CPLD_ERROR("Enter\n"); + cpld_id = LPC_GET_CPLD_ID(address); + LPC_CPLD_ERROR("icpld_id=%d\n", cpld_id); + info = lpc_get_device_info(LPC_DEVICE_CPLD, cpld_id); + if (info == NULL) { + LPC_CPLD_ERROR("lpc_get_device_info addr 0x%x id %d failed.\r\n", address, cpld_id); + return -1; + } + + *val = inb(info->base + LPC_GET_CPLD_OFFSET(address)); + LPC_CPLD_VERBOSE("Leave info->base 0x%x, addr 0x%x, cpld_id %d, val 0x%x.\r\n", info->base, address, cpld_id, *val); + return 0; +} + +static int lpc_cpld_write(int address, u8 reg_val) +{ + int cpld_id; + rg_lpc_device_t *info; + + cpld_id = LPC_GET_CPLD_ID(address); + info = lpc_get_device_info(LPC_DEVICE_CPLD, cpld_id); + if (info == NULL) { + LPC_CPLD_ERROR("lpc_get_device_info addr 0x%x id %d failed.\r\n", address, cpld_id); + return -1; + } + + outb(reg_val, info->base + LPC_GET_CPLD_OFFSET(address)); + LPC_CPLD_VERBOSE("Leave info->base 0x%x, addr 0x%x, cpld_id %d, val 0x%x.\r\n", info->base, address, cpld_id, reg_val); + return 0; +} + +static ssize_t show_cpld_version(struct device *dev, struct device_attribute *da, char *buf) +{ + int ret, i; + u8 data[4]; + u32 index = to_sensor_dev_attr(da)->index; + + memset(data, 0 ,sizeof(data)); + for (i = 0; i < 4; i++) { + ret = lpc_cpld_read(index + i, &data[i]); + if (ret != 0) { + memset(data, 0 ,sizeof(data)); + LPC_CPLD_ERROR("get cpld version failed!\n"); + break; + } + } + + return snprintf(buf, COMMON_STR_LEN, "%02x %02x %02x %02x \n", data[0], data[1], data[2], data[3]); + +} + +static ssize_t show_cpld_sysfs_value(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + u8 data; + int ret; + + ret = lpc_cpld_read(attr->index, &data); + if (ret != 0) { + LPC_CPLD_ERROR("get cpld[0x%x] value failed!\n", attr->index); + data = 0; + } + return snprintf(buf, COMMON_STR_LEN, "%02x\n", data); +} + +static ssize_t set_cpld_sysfs_value(struct device *dev, struct device_attribute *da, const char *buf, size_t +count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + u8 data; + unsigned long val; + int err; + + err = kstrtoul(buf, 16, &val); + if (err) + return err; + if ((val < 0) || (val > 0xff)) { + LPC_CPLD_ERROR("please enter 0x00 ~ 0xff\n"); + return -1; + } + + data = (u8)val; + LPC_CPLD_VERBOSE("pos: 0x%02x count = %ld, data = 0x%02x\n", attr->index, count, data); + err = lpc_cpld_write(attr->index, data); + if (err != 0) { + LPC_CPLD_ERROR("set cpld[0x%x] value[0x%x] failed!\n", attr->index, data); + count = 0; + } + + return count; +} + +/* connect board cpld 0x900 id=1 */ +static SENSOR_DEVICE_ATTR(connect_cpld_version, S_IRUGO, show_cpld_version, NULL, 0x10000); +static SENSOR_DEVICE_ATTR(broad_front_sys, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x10072); +static SENSOR_DEVICE_ATTR(psu_status, S_IRUGO, show_cpld_sysfs_value, NULL, 0x10051); +static SENSOR_DEVICE_ATTR(broad_front_pwr, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x10073); +static SENSOR_DEVICE_ATTR(broad_front_fan, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x10074); +static SENSOR_DEVICE_ATTR(sfp_enable, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x10094); + +static struct attribute *lpc_cpld_base_sysfs_attrs[] = { + &sensor_dev_attr_connect_cpld_version.dev_attr.attr, + &sensor_dev_attr_broad_front_sys.dev_attr.attr, + &sensor_dev_attr_psu_status.dev_attr.attr, + &sensor_dev_attr_broad_front_pwr.dev_attr.attr, + &sensor_dev_attr_broad_front_fan.dev_attr.attr, + &sensor_dev_attr_sfp_enable.dev_attr.attr, + NULL +}; + +static const struct attribute_group lpc_cpld_base_sysfs_group = { + .attrs = lpc_cpld_base_sysfs_attrs, +}; + +static int __init rg_lpc_cpld_init(void) +{ + struct pci_dev *pdev = NULL; + int status; + + pdev = pci_get_device(PCI_VENDOR_ID_INTEL, PCI_VENDOR_ID_D1527_LPC, pdev); + if (!pdev) { + LPC_CPLD_ERROR("pci_get_device(0x8086, 0x8c54) failed!\n"); + return -1; + } + + status = -1; + status = sysfs_create_group(&pdev->dev.kobj, &lpc_cpld_base_sysfs_group); + if (status) { + LPC_CPLD_ERROR("sysfs_create_group failed!\n"); + return -1; + } + + LPC_CPLD_VERBOSE("Leave success\n"); + return 0; +} + +static void __exit rg_lpc_cpld_exit(void) +{ + struct pci_dev *pdev = NULL; + + pdev = pci_get_device(PCI_VENDOR_ID_INTEL, PCI_VENDOR_ID_D1527_LPC, pdev); + if (!pdev) { + LPC_CPLD_ERROR("pci_get_device(0x8086, 0x8c54) failed!\n"); + return ; + } + + sysfs_remove_group(&pdev->dev.kobj, &lpc_cpld_base_sysfs_group); + + LPC_CPLD_VERBOSE("Leave.\n"); +} + +module_init(rg_lpc_cpld_init); +module_exit(rg_lpc_cpld_exit); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("support "); diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/setup.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/setup.py new file mode 100644 index 000000000000..f36055fb4e6d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/setup.py @@ -0,0 +1,33 @@ +from setuptools import setup + +setup( + name='sonic-platform', + version='1.0', + description='SONiC platform API implementation on RAGILE Platforms', + license='Apache 2.0', + author='SONiC Team', + author_email='support@ragile.com', + url='', + maintainer='RAGILE SUPPORT TEAM', + maintainer_email='', + packages=[ + 'sonic_platform', + 'rgutil', + 'eepromutil', + 'sonic_pcie', + ], + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Environment :: Plugins', + 'Intended Audience :: Developers', + 'Intended Audience :: Information Technology', + 'Intended Audience :: System Administrators', + 'License :: OSI Approved :: Apache Software License', + 'Natural Language :: English', + 'Operating System :: POSIX :: Linux', + 'Programming Language :: Python :: 3.7', + 'Topic :: Utilities', + ], + keywords='sonic SONiC platform PLATFORM', +) + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_pcie/__init__.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_pcie/__init__.py new file mode 100644 index 000000000000..73e2a89c8d74 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_pcie/__init__.py @@ -0,0 +1 @@ +__all__ = ["pcie_common"] \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_pcie/pcie_common.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_pcie/pcie_common.py new file mode 100644 index 000000000000..56e9d8664a23 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_pcie/pcie_common.py @@ -0,0 +1,107 @@ +# pcie_common.py +# Common PCIE check interfaces for SONIC +# + +import os +import yaml +import subprocess +import re +import sys +from copy import deepcopy +try: + from .pcie import PcieBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PcieUtil(PcieBase): + """Platform-specific PCIEutil class""" + # got the config file path + def __init__(self, path): + self.config_path = path + + # load the config file + def load_config_file(self): + config_file = self.config_path + "/" + "pcie.yaml" + try: + with open(config_file) as conf_file: + self.confInfo = yaml.load(conf_file) + except IOError as e: + print("Error: {}".format(str(e))) + print("Not found config file, please add a config file manually, or generate it by running [pcieutil pcie_generate]") + sys.exit() + + # load current PCIe device + def get_pcie_device(self): + pciDict = {} + pciList = [] + p1 = "^(\w+):(\w+)\.(\w)\s(.*)\s*\(*.*\)*" + p2 = "^.*:.*:.*:(\w+)\s*\(*.*\)*" + command1 = "sudo lspci" + command2 = "sudo lspci -n" + # run command 1 + proc1 = subprocess.Popen(command1, shell=True, universal_newlines=True, stdout=subprocess.PIPE) + output1 = proc1.stdout.readlines() + proc1.communicate() + # run command 2 + proc2 = subprocess.Popen(command2, shell=True, universal_newlines=True, stdout=subprocess.PIPE) + output2 = proc2.stdout.readlines() + proc2.communicate() + + if proc1.returncode > 0: + for line1 in output1: + print(line1.strip()) + return + elif proc2.returncode > 0: + for line2 in output2: + print(line2.strip()) + return + else: + for (line1, line2) in zip(output1, output2): + pciDict.clear() + match1 = re.search(p1, line1.strip()) + match2 = re.search(p2, line2.strip()) + if match1 and match2: + Bus = match1.group(1) + Dev = match1.group(2) + Fn = match1.group(3) + Name = match1.group(4) + Id = match2.group(1) + pciDict["name"] = Name + pciDict["bus"] = Bus + pciDict["dev"] = Dev + pciDict["fn"] = Fn + pciDict["id"] = Id + pciList.append(pciDict) + pciDict = deepcopy(pciDict) + else: + print("CAN NOT MATCH PCIe DEVICE") + return pciList + + # check the sysfs tree for each PCIe device + def check_pcie_sysfs(self, domain=0, bus=0, device=0, func=0): + dev_path = os.path.join('/sys/bus/pci/devices', '%04x:%02x:%02x.%d' % (domain, bus, device, func)) + if os.path.exists(dev_path): + return True + return False + + # check the current PCIe device with config file and return the result + def get_pcie_check(self): + self.load_config_file() + for item_conf in self.confInfo: + bus_conf = item_conf["bus"] + dev_conf = item_conf["dev"] + fn_conf = item_conf["fn"] + if self.check_pcie_sysfs(bus=int(bus_conf, base=16), device=int(dev_conf, base=16), func=int(fn_conf, base=16)): + item_conf["result"] = "Passed" + else: + item_conf["result"] = "Failed" + return self.confInfo + + # generate the config file with current pci device + def dump_conf_yaml(self): + curInfo = self.get_pcie_device() + with open(self.config_path + "/" + "pcie.yaml", "w") as conf_file: + yaml.dump(curInfo, conf_file, default_flow_style=False) + return + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/__init__.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/__init__.py new file mode 100644 index 000000000000..d49ca9b48bbf --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/__init__.py @@ -0,0 +1,4 @@ +# All the derived classes for PDDF +__all__ = ["platform", "chassis", "sfp", "psu", "thermal", "fan", "fan_drawer"] +from . import platform + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/chassis.py new file mode 100644 index 000000000000..ae8e74186825 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/chassis.py @@ -0,0 +1,108 @@ +############################################################################# +# PDDF +# Module contains an implementation of SONiC Chassis API +# +############################################################################# + +try: + import time + from sonic_platform_pddf_base.pddf_chassis import PddfChassis + from sonic_platform.fan_drawer import FanDrawer +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +PORT_START = 0 +PORTS_IN_BLOCK = 32 +FAN_NUM_PER_DRAWER = 2 + +class Chassis(PddfChassis): + """ + PDDF Platform-specific Chassis class + """ + + SFP_STATUS_INSERTED = "1" + SFP_STATUS_REMOVED = "0" + port_dict = {} + + def __init__(self, pddf_data=None, pddf_plugin_data=None): + PddfChassis.__init__(self, pddf_data, pddf_plugin_data) + + # fan drawer + temp = [] + drawer_index = 0 + for idx, fan in enumerate(self.get_all_fans()): + temp.append(fan) + if (idx + 1) % FAN_NUM_PER_DRAWER == 0: + drawer = FanDrawer(drawer_index + 1, temp) + self.get_all_fan_drawers().append(drawer) + temp = [] + drawer_index += 1 + + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + Returns: + A tuple (string, string) where the first element is a string + containing the cause of the previous reboot. This string must be + one of the predefined strings in this class. If the first string + is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used + to pass a description of the reboot cause. + """ + + return (self.REBOOT_CAUSE_NON_HARDWARE, None) + + def get_change_event(self, timeout=0): + change_event_dict = {"fan": {}, "sfp": {}} + sfp_status, sfp_change_dict = self.get_transceiver_change_event(timeout) + change_event_dict["sfp"] = sfp_change_dict + if sfp_status is True: + return True, change_event_dict + + return False, {} + + def get_transceiver_change_event(self, timeout=0): + start_time = time.time() + currernt_port_dict = {} + forever = False + + if timeout == 0: + forever = True + elif timeout > 0: + timeout = timeout / float(1000) # Convert to secs + else: + print("get_transceiver_change_event:Invalid timeout value", timeout) + return False, {} + + end_time = start_time + timeout + if start_time > end_time: + print( + "get_transceiver_change_event:" "time wrap / invalid timeout value", + timeout, + ) + return False, {} # Time wrap or possibly incorrect timeout + + while timeout >= 0: + # Check for OIR events and return updated port_dict + for index in range(PORT_START, PORTS_IN_BLOCK): + if self._sfp_list[index].get_presence(): + currernt_port_dict[index] = self.SFP_STATUS_INSERTED + else: + currernt_port_dict[index] = self.SFP_STATUS_REMOVED + if currernt_port_dict == self.port_dict: + if forever: + time.sleep(1) + else: + timeout = end_time - time.time() + if timeout >= 1: + time.sleep(1) # We poll at 1 second granularity + else: + if timeout > 0: + time.sleep(timeout) + return True, {} + else: + # Update reg value + self.port_dict = currernt_port_dict + print(self.port_dict) + return True, self.port_dict + print("get_transceiver_change_event: Should not reach here.") + return False, {} diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/common.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/common.py new file mode 100644 index 000000000000..c1a85f618609 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/common.py @@ -0,0 +1,44 @@ +import os +import yaml + +from sonic_py_common import device_info + + +class Common: + + DEVICE_PATH = '/usr/share/sonic/device/' + PMON_PLATFORM_PATH = '/usr/share/sonic/platform/' + CONFIG_DIR = 'sonic_platform_config' + + HOST_CHK_CMD = "docker > /dev/null 2>&1" + + def __init__(self): + (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() + + def is_host(self): + return os.system(self.HOST_CHK_CMD) == 0 + + def load_json_file(self, path): + """ + Retrieves the json object from json file path + + Returns: + A json object + """ + with open(path, 'r') as f: + json_data = yaml.safe_load(f) + + return json_data + + def get_config_path(self, config_name): + """ + Retrieves the path to platform api config directory + + Args: + config_name: A string containing the name of config file. + + Returns: + A string containing the path to json file + """ + return os.path.join(self.DEVICE_PATH, self.platform, self.CONFIG_DIR, config_name) if self.is_host() else os.path.join(self.PMON_PLATFORM_PATH, self.CONFIG_DIR, config_name) + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/component.py new file mode 100644 index 000000000000..7c6fd2df4335 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/component.py @@ -0,0 +1,85 @@ +######################################################################## +# Ragile RA-B6510-32c +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Components' (e.g., BIOS, CPLD, FPGA, etc.) available in +# the platform +# +######################################################################## + +try: + import subprocess + from sonic_platform_base.component_base import ComponentBase + from sonic_platform.regutil import Reg + from sonic_platform.logger import logger +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Component(ComponentBase): + """ Ragile Platform-specific Component class""" + + def __init__(self, index, config=None): + self.index = index + self.name = config.get("name") + self._reg_fm_ver = Reg(config.get("firmware_version")) + self.description = config.get("desc") + self.slot = config.get("slot") + + def get_name(self): + """ + Retrieves the name of the component + + Returns: + A string containing the name of the component + """ + return self.name + + def get_description(self): + """ + Retrieves the description of the component + + Returns: + A string containing the description of the component + """ + return self.description + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + try: + return self._reg_fm_ver.decode() + except Exception as e: + logger.error(str(e)) + + return "" + + def install_firmware(self, image_path): + """ + Installs firmware to the component + + Args: + image_path: A string, path to firmware image + + Returns: + A boolean, True if install was successful, False if not + """ + try: + successtips = "CPLD Upgrade succeeded!" + status, output = subprocess.getstatusoutput("which firmware_upgrade") + if status or len(output) <= 0: + logger.error("no upgrade tool.") + return False + cmdstr = "%s %s cpld %d cpld"%(output,image_path,self.slot) + ret, log = subprocess.getstatusoutput(cmdstr) + if ret == 0 and successtips in log: + return True + logger.error("upgrade failed. ret:%d, log:\n%s" % (ret, log)) + except Exception as e: + logger.error(str(e)) + return False + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/config.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/config.py new file mode 100644 index 000000000000..7d3064163b30 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/config.py @@ -0,0 +1,771 @@ +# -*- coding: utf-8 -*- + +PSU_FAN_AIRFLOW = { + "CSU550AP-3-300": "F2B", + "CSU550AP-3-500": "F2B", + "DPS-550AB-39 A": "F2B", + "DPS-1300AB-6 S": "F2B", + "FSP1200-20ERM": "F2B", + "CSU800AP-3-300": "F2B", + "CSU550AP-3-501": "B2F", + "DPS-550AB-40 A": "B2F", +} + +psutypedecode = { + 0x00: "N/A", + 0x01: "AC", + 0x02: "DC", +} + + +class Unit: + Temperature = "C" + Voltage = "V" + Current = "A" + Power = "W" + Speed = "RPM" + + +class Threshold: + PSU_TEMP_MIN = -10 * 1000 + PSU_TEMP_MAX = 60 * 1000 + + PSU_FAN_SPEED_MIN = 5220 + PSU_FAN_SPEED_MAX = 17400 + + PSU_OUTPUT_VOLTAGE_MIN = 11 * 1000 + PSU_OUTPUT_VOLTAGE_MAX = 14 * 1000 + + PSU_AC_INPUT_VOLTAGE_MIN = 200 * 1000 + PSU_AC_INPUT_VOLTAGE_MAX = 240 * 1000 + + PSU_DC_INPUT_VOLTAGE_MIN = 190 * 1000 + PSU_DC_INPUT_VOLTAGE_MAX = 290 * 1000 + + ERR_VALUE = -9999999 + + PSU_OUTPUT_POWER_MIN = 10 * 1000 + PSU_OUTPUT_POWER_MAX = 1300 * 1000 + + PSU_INPUT_POWER_MIN = 10 * 1000 + PSU_INPUT_POWER_MAX = 1444 * 1000 + + PSU_OUTPUT_CURRENT_MIN = 2 * 1000 + PSU_OUTPUT_CURRENT_MAX = 107 * 1000 + + PSU_INPUT_CURRENT_MIN = 0.2 * 1000 + PSU_INPUT_CURRENT_MAX = 7 * 1000 + + FAN_SPEED_MAX = 24000 + FAN_SPEED_MIN = 7200 + + +class DecodeFormat: + TEXT = 0 + DECIMAL = 1 + ONE_BIT_HEX = 2 + HUNDREDTH = 3 + THOUSANDTH = 4 + MILLIONTH = 5 + AND = 6 + JOIN = 7 + FRU = 8 + HEX = 9 + + +class DecodeMethod: + SYSFS = 0 + I2C = 1 + I2C_WORD = 2 + DEVMEM = 3 + SDK = 4 + IO = 5 + FRU = 6 + + +class FRU: + SN = 0 + VERSION = 1 + PART_NAME = 2 + PRODUCT_NAME = 3 + MANUFACTURER = 4 + + +class Description: + CPLD = "Used for managing IO modules, SFP+ modules and system LEDs" + BIOS = "Performs initialization of hardware components during booting" + FPGA = "Platform management controller for on-board temperature monitoring, in-chassis power, Fan and LED control" + + +FAN_LED_COLORS = { + "green": 0b0100, + "red": 0b0010, + "amber": 0b0110, +} + + +DEVICE_CONF = { + "eeprom": {"bus": 1, "loc": "0056"}, + "components": [ + { + "name": "CPLD1 (MAC Board A)", + "firmware_version": { + "bus": 8, + "addr": 0x30, + "offset": 0, + "size": 4, + "way": DecodeMethod.I2C, + "format": DecodeFormat.JOIN, + "sep": "/", + }, + "desc": Description.CPLD, + "slot": 0, + }, + { + "name": "CPLD2 (MAC Board B)", + "firmware_version": { + "bus": 8, + "addr": 0x31, + "offset": 0, + "size": 4, + "way": DecodeMethod.I2C, + "format": DecodeFormat.JOIN, + "sep": "/", + }, + "desc": Description.CPLD, + "slot": 0, + }, + { + "name": "CPLD3 (CONNECT Board A)", + "firmware_version": { + "bus": 2, + "addr": 0x0d, + "offset": 0, + "size": 4, + "way": DecodeMethod.I2C, + "format": DecodeFormat.JOIN, + "sep": "/", + }, + "desc": Description.CPLD, + "slot": 0, + }, + { + "name": "CPLD4 (CPU Board)", + "firmware_version": { + "bus": 0, + "addr": 0x0D, + "offset": 0, + "size": 4, + "way": DecodeMethod.I2C, + "format": DecodeFormat.JOIN, + "sep": "/", + }, + "desc": Description.CPLD, + "slot": 1, + }, + ], + "thermals": [ + { + "name": "INLET TEMP", + "high": { + "loc": "/sys/bus/i2c/devices/3-004b/hwmon/*/temp1_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": None, + "temperature": { + "loc": "/sys/bus/i2c/devices/3-004b/hwmon/*/temp1_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + { + "name": "OUTLET TEMP", + "high": { + "loc": "/sys/bus/i2c/devices/3-004c/hwmon/*/temp1_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": None, + "temperature": { + "loc": "/sys/bus/i2c/devices/3-004c/hwmon/*/temp1_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + { + "name": "BOARD TEMP", + "high": { + "loc": "/sys/bus/i2c/devices/3-0049/hwmon/*/temp1_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": None, + "temperature": { + "loc": "/sys/bus/i2c/devices/3-0049/hwmon/*/temp1_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + { + "name": "PHYSICAL ID 0", + "high": { + "loc": "/sys/class/hwmon/hwmon0/temp1_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": { + "loc": "/sys/class/hwmon/hwmon0/temp1_crit", + "format": DecodeFormat.THOUSANDTH, + }, + "temperature": { + "loc": "/sys/class/hwmon/hwmon0/temp1_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + { + "name": "CPU CORE 0", + "high": { + "loc": "/sys/class/hwmon/hwmon0/temp2_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": { + "loc": "/sys/class/hwmon/hwmon0/temp2_crit", + "format": DecodeFormat.THOUSANDTH, + }, + "temperature": { + "loc": "/sys/class/hwmon/hwmon0/temp2_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + { + "name": "CPU CORE 1", + "high": { + "loc": "/sys/class/hwmon/hwmon0/temp3_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": { + "loc": "/sys/class/hwmon/hwmon0/temp3_crit", + "format": DecodeFormat.THOUSANDTH, + }, + "temperature": { + "loc": "/sys/class/hwmon/hwmon0/temp3_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + { + "name": "CPU CORE 2", + "high": { + "loc": "/sys/class/hwmon/hwmon0/temp4_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": { + "loc": "/sys/class/hwmon/hwmon0/temp4_crit", + "format": DecodeFormat.THOUSANDTH, + }, + "temperature": { + "loc": "/sys/class/hwmon/hwmon0/temp4_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + { + "name": "CPU CORE 3", + "high": { + "loc": "/sys/class/hwmon/hwmon0/temp5_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": { + "loc": "/sys/class/hwmon/hwmon0/temp5_crit", + "format": DecodeFormat.THOUSANDTH, + }, + "temperature": { + "loc": "/sys/class/hwmon/hwmon0/temp5_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + ], + "fans": [ + { + "name": "fan1", + "e2loc": {"bus": 16, "addr": 0x50, "way": "i2c", "size": "256"}, + "present": { + "loc": "/sys/bus/i2c/devices/2-000d/fan_present", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 0, + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-000d/fan_status", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 0, + }, + "hw_version": { + "loc": "/sys/bus/i2c/devices/16-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.VERSION + }, + "sn": { + "loc": "/sys/bus/i2c/devices/16-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.SN + }, + "led": { + "loc": "/sys/bus/i2c/devices/2-000d/fan1_led", + "format": DecodeFormat.AND, + "mask": 0b1111, + }, + "led_colors": FAN_LED_COLORS, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan1_1_real_speed" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan1_speed_set", + "format": DecodeFormat.HEX + }, + "speed_max": Threshold.FAN_SPEED_MAX, + "slope": 236.51, + "intercept": 82.571, + }, + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan1_2_real_speed" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan1_speed_set", + "format": DecodeFormat.HEX + }, + "speed_max": Threshold.FAN_SPEED_MAX, + "slope": 236.51, + "intercept": 82.571, + } + ], + "tolerance": 20, + "threshold": 30, + "target_default": 0, + }, + { + "name": "fan2", + "e2loc": {"bus": 17, "addr": 0x50, "way": "i2c", "size": "256"}, + "present": { + "loc": "/sys/bus/i2c/devices/2-000d/fan_present", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 1, + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-000d/fan_status", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 1, + }, + "hw_version": { + "loc": "/sys/bus/i2c/devices/17-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.VERSION + }, + "sn": { + "loc": "/sys/bus/i2c/devices/17-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.SN + }, + "led": { + "loc": "/sys/bus/i2c/devices/2-000d/fan2_led", + "format": DecodeFormat.AND, + "mask": 0b1111, + }, + "led_colors": FAN_LED_COLORS, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan2_1_real_speed" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan2_speed_set", + "format": DecodeFormat.HEX + }, + "speed_max": Threshold.FAN_SPEED_MAX, + "slope": 236.51, + "intercept": 82.571, + }, + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan2_2_real_speed" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan2_speed_set", + "format": DecodeFormat.HEX, + }, + "speed_max": Threshold.FAN_SPEED_MAX, + "slope": 236.51, + "intercept": 82.571, + } + ], + "tolerance": 20, + "threshold": 30, + "target_default": 0, + }, + { + "name": "fan3", + "e2loc": {"bus": 18, "addr": 0x50, "way": "i2c", "size": "256"}, + "present": { + "loc": "/sys/bus/i2c/devices/2-000d/fan_present", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 2, + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-000d/fan_status", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 2, + }, + "hw_version": { + "loc": "/sys/bus/i2c/devices/18-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.VERSION + }, + "sn": { + "loc": "/sys/bus/i2c/devices/18-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.SN + }, + "led": { + "loc": "/sys/bus/i2c/devices/2-000d/fan3_led", + "format": DecodeFormat.AND, + "mask": 0b1111, + }, + "led_colors": FAN_LED_COLORS, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan3_1_real_speed" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan3_speed_set", + "format": DecodeFormat.HEX + }, + "speed_max": Threshold.FAN_SPEED_MAX, + "slope": 236.51, + "intercept": 82.571, + }, + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan3_2_real_speed" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan3_speed_set", + "format": DecodeFormat.HEX + }, + "speed_max": Threshold.FAN_SPEED_MAX, + "slope": 236.51, + "intercept": 82.571, + } + ], + "tolerance": 20, + "threshold": 30, + "target_default": 0, + }, + { + "name": "fan4", + "e2loc": {"bus": 19, "addr": 0x50, "way": "i2c", "size": "256"}, + "present": { + "loc": "/sys/bus/i2c/devices/2-000d/fan_present", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 3, + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-000d/fan_status", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 3, + }, + "hw_version": { + "loc": "/sys/bus/i2c/devices/19-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.VERSION + }, + "sn": { + "loc": "/sys/bus/i2c/devices/19-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.SN + }, + "led": { + "loc": "/sys/bus/i2c/devices/2-000d/fan4_led", + "format": DecodeFormat.AND, + "mask": 0b1111, + }, + "led_colors": FAN_LED_COLORS, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan4_1_real_speed" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan4_speed_set", + "format": DecodeFormat.HEX + }, + "speed_max": Threshold.FAN_SPEED_MAX, + "slope": 236.51, + "intercept": 82.571, + }, + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan4_2_real_speed" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan4_speed_set", + "format": DecodeFormat.HEX + }, + "speed_max": Threshold.FAN_SPEED_MAX, + "slope": 236.51, + "intercept": 82.571, + } + ], + "tolerance": 20, + "threshold": 30, + "target_default": 0, + }, + { + "name": "fan5", + "e2loc": {"bus": 20, "addr": 0x50, "way": "i2c", "size": "256"}, + "present": { + "loc": "/sys/bus/i2c/devices/2-000d/fan_present", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 4, + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-000d/fan_status", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 4, + }, + "hw_version": { + "loc": "/sys/bus/i2c/devices/20-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.VERSION + }, + "sn": { + "loc": "/sys/bus/i2c/devices/20-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.SN + }, + "led": { + "loc": "/sys/bus/i2c/devices/2-000d/fan5_led", + "format": DecodeFormat.AND, + "mask": 0b1111, + }, + "led_colors": FAN_LED_COLORS, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan5_1_real_speed" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan5_speed_set", + "format": DecodeFormat.HEX + }, + "speed_max": Threshold.FAN_SPEED_MAX, + "slope": 236.51, + "intercept": 82.571, + }, + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan5_2_real_speed" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan5_speed_set", + "format": DecodeFormat.HEX + }, + "speed_max": Threshold.FAN_SPEED_MAX, + "slope": 236.51, + "intercept": 82.571, + } + ], + "tolerance": 20, + "threshold": 30, + "target_default": 0, + }, + ], + "psus": [ + { + "name": "psu1", + "present": { + "addr": 0x951, + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 0, + "way": DecodeMethod.IO + }, + "status": { + "addr": 0x951, + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 1, + "way": DecodeMethod.IO + }, + "sn": { + "loc": "/sys/bus/i2c/devices/24-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.SN + }, + "in_current": { + "loc": "/sys/bus/i2c/devices/24-0058/hwmon/*/curr1_input", + "format": DecodeFormat.THOUSANDTH, + }, + "in_voltage": { + "loc": "/sys/bus/i2c/devices/24-0058/hwmon/*/in1_input", + "format": DecodeFormat.THOUSANDTH, + }, + "out_voltage": { + "loc": "/sys/bus/i2c/devices/24-0058/hwmon/*/in2_input", + "format": DecodeFormat.THOUSANDTH, + }, + "out_current": { + "loc": "/sys/bus/i2c/devices/24-0058/hwmon/*/curr2_input", + "format": DecodeFormat.THOUSANDTH, + }, + "temperature": { + "loc": "/sys/bus/i2c/devices/24-0058/hwmon/*/temp1_input", + "format": DecodeFormat.THOUSANDTH, + }, + "hw_version": { + "loc": "/sys/bus/i2c/devices/24-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.VERSION + }, + # "psu_type": { + # "loc": "/sys/bus/i2c/devices/24-0050/eeprom", + # "format": DecodeFormat.FRU, + # "fru_key": FRU.SN + # }, + "fans": [ + { + "name": "psu_fan1", + "present": { + "loc": "/sys/bus/i2c/devices/24-0058/hwmon/*/fan1_fault", + }, + "status": { + "addr": 0x951, + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 1, + "way": DecodeMethod.IO + }, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/24-0058/hwmon/*/fan1_input" + }, + "speed_setter": { + "bus": 24, + "addr": 0x58, + "offset": 0x3b, + "size": 1, + "way": DecodeMethod.I2C, + "format": DecodeFormat.HEX, + }, + "speed_max": Threshold.PSU_FAN_SPEED_MAX, + } + ], + "tolerance": 20, + "threshold_low": 1900, + } + ], + "in_power": { + "loc": "/sys/bus/i2c/devices/24-0058/hwmon/*/power1_input", + "format": DecodeFormat.MILLIONTH, + }, + "out_power": { + "loc": "/sys/bus/i2c/devices/24-0058/hwmon/*/power2_input", + "format": DecodeFormat.MILLIONTH, + }, + }, + { + "name": "psu2", + "present": { + "addr": 0x951, + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 4, + "way": DecodeMethod.IO + }, + "status": { + "addr": 0x951, + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 5, + "way": DecodeMethod.IO + }, + "sn": { + "loc": "/sys/bus/i2c/devices/25-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.SN + }, + "in_current": { + "loc": "/sys/bus/i2c/devices/25-0058/hwmon/*/curr1_input", + "format": DecodeFormat.THOUSANDTH, + }, + "in_voltage": { + "loc": "/sys/bus/i2c/devices/25-0058/hwmon/*/in1_input", + "format": DecodeFormat.THOUSANDTH, + }, + "out_voltage": { + "loc": "/sys/bus/i2c/devices/25-0058/hwmon/*/in2_input", + "format": DecodeFormat.THOUSANDTH, + }, + "out_current": { + "loc": "/sys/bus/i2c/devices/25-0058/hwmon/*/curr2_input", + "format": DecodeFormat.THOUSANDTH, + }, + "temperature": { + "loc": "/sys/bus/i2c/devices/25-0058/hwmon/*/temp1_input", + "format": DecodeFormat.THOUSANDTH, + }, + "hw_version": { + "loc": "/sys/bus/i2c/devices/25-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.VERSION + }, + # "psu_type": {"loc": "/sys/bus/i2c/devices/8-0053/psu_type"}, + "fans": [ + { + "name": "psu_fan1", + "present": { + "loc": "/sys/bus/i2c/devices/25-0058/hwmon/*/fan1_fault", + }, + "status": { + "addr": 0x951, + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 5, + "way": DecodeMethod.IO + }, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/25-0058/hwmon/*/fan1_input" + }, + "speed_setter": { + "bus": 25, + "addr": 0x58, + "offset": 0x3b, + "size": 1, + "way": DecodeMethod.I2C, + "format": DecodeFormat.HEX, + }, + "speed_max": Threshold.PSU_FAN_SPEED_MAX, + } + ], + "tolerance": 20, + "threshold_low": 1900, + } + ], + "in_power": { + "loc": "/sys/bus/i2c/devices/25-0058/hwmon/*/power1_input", + "format": DecodeFormat.MILLIONTH, + }, + "out_power": { + "loc": "/sys/bus/i2c/devices/25-0058/hwmon/*/power2_input", + "format": DecodeFormat.MILLIONTH, + }, + }, + ], +} diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/eeprom.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/eeprom.py new file mode 100644 index 000000000000..c25d711354f5 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/eeprom.py @@ -0,0 +1,12 @@ +try: + from sonic_platform_pddf_base.pddf_eeprom import PddfEeprom +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Eeprom(PddfEeprom): + + def __init__(self, pddf_data=None, pddf_plugin_data=None): + PddfEeprom.__init__(self, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/fan.py new file mode 100644 index 000000000000..b3dd67ed52cb --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/fan.py @@ -0,0 +1,42 @@ +try: + from sonic_platform_pddf_base.pddf_fan import PddfFan +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Fan(PddfFan): + """PDDF Platform-Specific Fan class""" + + def __init__(self, tray_idx, fan_idx=0, pddf_data=None, pddf_plugin_data=None, is_psu_fan=False, psu_index=0): + # idx is 0-based + PddfFan.__init__(self, tray_idx, fan_idx, pddf_data, pddf_plugin_data, is_psu_fan, psu_index) + + # Provide the functions/variables below for which implementation is to be overwritten + # Since psu_fan airflow direction cant be read from sysfs, it is fixed as 'F2B' or 'intake' + def get_direction(self): + """ + Retrieves the direction of fan + + Returns: + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + """ + return self.FAN_DIRECTION_EXHAUST + + def get_speed_rpm(self): + if self.is_psu_fan: + return super().get_speed_rpm() + else: + divisor = 15000000 + mask_low = 0xff + ret = super().get_speed_rpm() + # revert ret + ret = (ret >> 8) + ((ret & mask_low) << 8) + return int(divisor/ret) + + def get_target_speed(self): + if self.is_psu_fan: + return None + + return super().get_target_speed() + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..2f83b66df94a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/fan_drawer.py @@ -0,0 +1,69 @@ +# +# fan_drawer +# + +try: + from sonic_platform_base.fan_drawer_base import FanDrawerBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class FanDrawer(FanDrawerBase): + # Device type definition. Note, this is a constant. + DEVICE_TYPE = "fan_drawer" + + def __init__(self, index, fan_list): + FanDrawerBase.__init__(self) + + self._fan_list = fan_list + self._index = index + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + + return "fan drawer {}".format(self._index) + + def get_num_fans(self): + """ + Retrieves the number of fans available on this fan drawer + Returns: + An integer, the number of fan modules available on this fan drawer + """ + return len(self._fan_list) + + def get_all_fans(self): + """ + Retrieves all fan modules available on this fan drawer + Returns: + A list of objects derived from FanBase representing all fan + modules available on this fan drawer + """ + return self._fan_list + + def set_status_led(self, color): + """ + Sets the state of the fan drawer status LED + Args: + color: A string representing the color with which to set the + fan drawer status LED + Returns: + bool: True if status LED state is set successfully, False if not + """ + if self.get_num_fans() > 0: + return self._fan_list[0].set_status_led(color) + return False + + def get_status_led(self): + """ + Gets the state of the fan drawer LED + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + if self.get_num_fans() > 0: + return self._fan_list[0].get_status_led() + return "N/A" + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/logger.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/logger.py new file mode 100644 index 000000000000..5969781bf9a9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/logger.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +import logging + + +def _init_logger(): + formatter = logging.Formatter( + "%(asctime)s %(levelname)s %(filename)s[%(funcName)s][%(lineno)s]: %(message)s" + ) + handler = logging.FileHandler("/var/log/syslog") + handler.setFormatter(formatter) + + logger = logging.getLogger(__name__) + logger.setLevel(logging.DEBUG) + logger.addHandler(handler) + return logger + + +logger = _init_logger() diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/pcie.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/pcie.py new file mode 100644 index 000000000000..5a66997d33d0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/pcie.py @@ -0,0 +1,43 @@ +# +# pcie_base.py +# +# Abstract base class for implementing platform-specific +# PCIE functionality for SONiC +# + +try: + import abc + from sonic_pcie import PcieUtil +except ImportError as e: + raise ImportError (str(e) + " - required module not found") + +class PcieBase(object): + def __init__(self, path): + """ + Constructor + Args: + pcieutil file and config file path + """ + self.pcie_util = PcieUtil(path) + + + @abc.abstractmethod + def get_pcie_device(self): + """ + get current device pcie info + + Returns: + A list including pcie device info + """ + return self.pcie_util.get_pcie_device() + + + @abc.abstractmethod + def get_pcie_check(self): + """ + Check Pcie device with config file + Returns: + A list including pcie device and test result info + """ + return self.pcie_util.get_pcie_check() + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/platform.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/platform.py new file mode 100644 index 000000000000..8595e80692df --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/platform.py @@ -0,0 +1,23 @@ +############################################################################# +# PDDF +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + + +try: + from sonic_platform_pddf_base.pddf_platform import PddfPlatform +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PddfPlatform): + """ + PDDF Platform-Specific Platform Class + """ + + def __init__(self): + PddfPlatform.__init__(self) + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/psu.py new file mode 100644 index 000000000000..240af5d2d1b5 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/psu.py @@ -0,0 +1,32 @@ +try: + from sonic_platform_pddf_base.pddf_psu import PddfPsu +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + + +class Psu(PddfPsu): + """PDDF Platform-Specific PSU class""" + + PLATFORM_PSU_CAPACITY = 1200 + + def __init__(self, index, pddf_data=None, pddf_plugin_data=None): + PddfPsu.__init__(self, index, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten + def get_maximum_supplied_power(self): + """ + Retrieves the maximum supplied power by PSU (or PSU capacity) + Returns: + A float number, the maximum power output in Watts. + e.g. 1200.1 + """ + return float(self.PLATFORM_PSU_CAPACITY) + + def get_type(self): + """ + Gets the type of the PSU + Returns: + A string, the type of PSU (AC/DC) + """ + return "DC" + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/regutil.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/regutil.py new file mode 100644 index 000000000000..bff2bd41ea55 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/regutil.py @@ -0,0 +1,245 @@ +# -*- coding: utf-8 -*- +from glob import glob +from plat_hal.osutil import osutil + +try: + from sonic_platform.config import DecodeFormat, DecodeMethod + + DECODE_FORMAT = DecodeFormat + DECODE_METHOD = DecodeMethod +except ImportError: + raise ImportError(str(e) + "- required module not found") + +ERR_CODE = "ERR" + + +class Reg(object): + """ + "e2loc": {"bus": 3, "addr": 0x53, "way": "i2c"} + "value": { + "loc": "/sys/bus/i2c/devices/2-0048/hwmon/hwmon*/temp1_input", + "way": "sysfs", + + "InputsStatus": { + "bus": 8, + "addr": 0x5B, + "offset": 0x79, + "way": "i2cword", + "mask": 0x0200, + }, + """ + + def __new__(cls, *args): + if args[0] is None or not isinstance(args[0], dict): + return None + return super(Reg, cls).__new__(cls) + + def __init__(self, data): + + self.loc = None + self.way = DECODE_METHOD.SYSFS + self.addr = None + self.bus = None + self.offset = None + self.size = 1 + self.bit = None + self.mask = None + self.digit = None + self.sdk_type = None + self.sep = None + self.format = DECODE_FORMAT.TEXT + self.__dict__.update(data) + + def _read_reg_val(self): + ret = None + try: + if self.way == DECODE_METHOD.SYSFS: + ret = self.get_sysfs() + elif self.way == DECODE_METHOD.I2C: + ret = self.get_i2c() + elif self.way == DECODE_METHOD.I2C_WORD: + ret = self.get_i2cword() + elif self.way == DECODE_METHOD.DEVMEM: + ret = self.get_devmem() + elif self.way == DECODE_METHOD.SDK: + # TODO + pass + else: + pass + except Exception as e: + raise e + + return ret + + def _write_reg_val(self, val): + try: + if self.way == DECODE_METHOD.SYSFS: + return self._write_sysfs(val) + except Exception as e: + raise e + + return False + + def _write_sysfs(self, val): + try: + with open(glob(self.loc)[0], "w") as f: + f.write(val) + f.flush() + return True + except Exception as e: + raise e + + def _format_val(self, val): + try: + if isinstance(val, str): + val = val.strip() + if self.format == DECODE_FORMAT.THOUSANDTH: + return float("%.1f" % (float(val) / 1000)) + elif self.format == DECODE_FORMAT.HUNDREDTH: + return float("%.1f" % (float(val) / 100)) + elif self.format == DECODE_FORMAT.ONE_BIT_HEX: + return (int(val, 16) & (1 << self.bit)) >> self.bit + elif self.format == DECODE_FORMAT.DECIMAL: + return int(val, 10) + elif self.format == DECODE_FORMAT.MILLIONTH: + return float("%.1f" % (float(val) / 1000 / 1000)) + elif self.format == DECODE_FORMAT.AND: + return (int(val, 16)) & self.mask + elif isinstance(val, list): + if self.format == DECODE_FORMAT.JOIN: + return self.sep.join(val) + except Exception as e: + raise e + else: + return val + + def decode(self): + """ + get value by config way + way i2c/sysfs/lpc + """ + if self.way is None: + raise ValueError("cannot found way to deal") + + ret = self._read_reg_val() + + ret = self._format_val(ret) + return ret + + def encode(self, val): + if self.way is None: + raise ValueError("cannot found way to deal") + + return self._write_reg_val(val) + + def get_sdk(self): + # TODO + pass + + def get_sysfs(self): + if self.loc is None: + raise ValueError("Not Enough Attr: loc: {}".format(self.loc)) + + ret, val = osutil.readsysfs(self.loc) + + if not ret: + raise IOError(val) + + return val + + def get_devmem(self): + if self.addr is None or self.digit is None or self.mask is None: + raise ValueError( + "Not Enough Attr: addr: {}, digit: {}, mask: {}".format( + self.addr, self.digit, self.mask + ) + ) + + ret, val = osutil.getdevmem(self.addr, self.digit, self.mask) + + if not ret: + raise IOError(val) + + return val + + def get_i2cword(self): + if self.bus is None or self.addr is None or self.offset is None: + raise ValueError( + "Not Enough Attr: bus: {}, addr: {}, offset: {}".format( + self.bus, self.addr, self.offset + ) + ) + + ret, val = osutil.geti2cword(self.bus, self.addr, self.offset) + + if not ret: + raise IOError(val) + + return val + + def get_i2c(self): + if ( + self.bus is None + or self.addr is None + or self.offset is None + or self.size is None + ): + raise ValueError( + "Not Enough Attr: bus: {}, addr: {}, offset: {}".format( + self.bus, self.addr, self.offset + ) + ) + + value = [] + for i in range(self.size): + ofs = self.offset + i + ret, val = osutil.rji2cget(self.bus, self.addr, ofs) + + if not ret: + raise IOError(val) + else: + value.append(repr(chr(val)).translate(None, r"\\x").replace("'", "")) + + return value + + def set_i2cword(self, bus, addr, offset, byte): + return self.seti2cword(bus, addr, offset, byte) + + def seti2cword(self, bus, addr, offset, byte): + return osutil.seti2cword(bus, addr, offset, byte) + + def set_i2c(self, bus, addr, offset, byte): + return self.seti2c(bus, addr, offset, byte) + + def seti2c(self, bus, addr, offset, byte): + ret, val = osutil.rji2cset(bus, addr, offset, byte) + return ret, val + + def getbcmtemp(self): + try: + sta, ret = osutil.getmactemp() + if sta == True: + mac_aver = float(ret.get("average", self.__error_ret)) + #mac_max = float(ret.get("maximum", self.__error_ret)) + mac_aver = mac_aver * 1000 + #mac_max = mac_max * 1000 + else: + return False, ret + except AttributeError as e: + return False, str(e) + return True, mac_aver + + def getbcmreg(self, reg): + ret, val = osutil.getsdkreg(reg) + return ret, val + + def logger_debug(self, msg): + baseutil.logger_debug(msg) + + def command(self, cmd): + ret, output = osutil.command(cmd) + return ret, output + + def set_val(self, val): + # TODO + pass diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/rotor.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/rotor.py new file mode 100644 index 000000000000..3e5bcc5b9b9a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/rotor.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- + +try: + from sonic_platform.regutil import Reg + from sonic_platform.logger import logger +except ImportError: + raise ImportError(str(e) + "- required module not found") + +class Rotor: + def __init__(self, config): + if config is not None and isinstance(config, dict): + self.__reg_speed_getter = Reg(config.get("speed_getter")) + self.__reg_speed_setter = Reg(config.get("speed_setter")) + self.__speed_max = config.get("speed_max") + else: + raise ValueError("init rotor Error: {}".format(config)) + + def get_speed(self): + try: + return int(self.__reg_speed_getter.decode()) + except Exception as e: + logger.error(str(e)) + + return 0 + + def set_speed(self, speed): + try: + return self.__reg_speed_setter.encode(speed) + except Exception as e: + logger.error(str(e)) + + return False + + def get_speed_percentage(self): + try: + speed = self.get_speed() + return (100 * speed) / self.__speed_max + except Exception as e: + logger.error(str(e)) + + return 0 diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/sfp.py new file mode 100644 index 000000000000..ea8e256fe6ef --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/sfp.py @@ -0,0 +1,287 @@ +#!/usr/bin/env python + +try: + #from sonic_platform_pddf_base.pddf_sfp import * + from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId + from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom + from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId + from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom + from sonic_platform_pddf_base.pddf_sfp import PddfSfp + from sonic_platform_pddf_base.pddf_sfp import SFP_VOLT_OFFSET + from sonic_platform_pddf_base.pddf_sfp import SFP_VOLT_WIDTH + from sonic_platform_pddf_base.pddf_sfp import SFP_CHANNL_MON_OFFSET + from sonic_platform_pddf_base.pddf_sfp import SFP_CHANNL_MON_WIDTH + from sonic_platform_pddf_base.pddf_sfp import SFP_TEMPE_OFFSET + from sonic_platform_pddf_base.pddf_sfp import SFP_TEMPE_WIDTH + from sonic_platform_pddf_base.pddf_sfp import QSFP_DOM_REV_OFFSET + from sonic_platform_pddf_base.pddf_sfp import QSFP_DOM_REV_WIDTH + from sonic_platform_pddf_base.pddf_sfp import QSFP_CHANNL_MON_OFFSET + from sonic_platform_pddf_base.pddf_sfp import QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +XCVR_DOM_CAPABILITY_OFFSET = 92 +XCVR_DOM_CAPABILITY_WIDTH = 2 +QSFP_VERSION_COMPLIANCE_OFFSET = 1 +QSFP_VERSION_COMPLIANCE_WIDTH = 2 +QSFP_OPTION_VALUE_OFFSET = 192 +QSFP_OPTION_VALUE_WIDTH = 4 + +class Sfp(PddfSfp): + """ + PDDF Platform-Specific Sfp class + """ + + def __init__(self, index, pddf_data=None, pddf_plugin_data=None): + PddfSfp.__init__(self, index, pddf_data, pddf_plugin_data) + self.dom_supported = False + self.__dom_capability_detect() + + def __dom_capability_detect(self): + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.qsfp_page3_available = False + self.calibration = 0 + if not self.get_presence(): + return + + if self.is_osfp_port: + # Not implement + return + elif self.is_qsfp_port: + self.calibration = 1 + sfpi_obj = sff8436InterfaceId() + if sfpi_obj is None: + self.dom_supported = False + offset = 128 + + # QSFP capability byte parse, through this byte can know whether it support tx_power or not. + # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, + # need to add more code for determining the capability and version compliance + # in SFF-8636 dom capability definitions evolving with the versions. + qsfp_dom_capability_raw = self.__read_eeprom_specific_bytes( + (offset + XCVR_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH) + if qsfp_dom_capability_raw is not None: + qsfp_version_compliance_raw = self.__read_eeprom_specific_bytes( + QSFP_VERSION_COMPLIANCE_OFFSET, QSFP_VERSION_COMPLIANCE_WIDTH) + qsfp_version_compliance = int( + qsfp_version_compliance_raw[0], 16) + dom_capability = sfpi_obj.parse_dom_capability( + qsfp_dom_capability_raw, 0) + if qsfp_version_compliance >= 0x08: + self.dom_temp_supported = dom_capability['data']['Temp_support']['value'] == 'On' + self.dom_volt_supported = dom_capability['data']['Voltage_support']['value'] == 'On' + self.dom_rx_power_supported = dom_capability['data']['Rx_power_support']['value'] == 'On' + self.dom_tx_power_supported = dom_capability['data']['Tx_power_support']['value'] == 'On' + else: + self.dom_temp_supported = True + self.dom_volt_supported = True + self.dom_rx_power_supported = dom_capability['data']['Rx_power_support']['value'] == 'On' + self.dom_tx_power_supported = True + + self.dom_supported = True + self.calibration = 1 + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + qsfp_option_value_raw = self.__read_eeprom_specific_bytes( + QSFP_OPTION_VALUE_OFFSET, QSFP_OPTION_VALUE_WIDTH) + if qsfp_option_value_raw is not None: + optional_capability = sfpd_obj.parse_option_params( + qsfp_option_value_raw, 0) + self.dom_tx_disable_supported = optional_capability[ + 'data']['TxDisable']['value'] == 'On' + dom_status_indicator = sfpd_obj.parse_dom_status_indicator( + qsfp_version_compliance_raw, 1) + self.qsfp_page3_available = dom_status_indicator['data']['FlatMem']['value'] == 'Off' + else: + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.calibration = 0 + self.qsfp_page3_available = False + else: + sfpi_obj = sff8472InterfaceId() + if sfpi_obj is None: + return None + sfp_dom_capability_raw = self.__read_eeprom_specific_bytes( + XCVR_DOM_CAPABILITY_OFFSET, XCVR_DOM_CAPABILITY_WIDTH) + if sfp_dom_capability_raw is not None: + sfp_dom_capability = int(sfp_dom_capability_raw[0], 16) + self.dom_supported = (sfp_dom_capability & 0x40 != 0) + if self.dom_supported: + self.dom_temp_supported = True + self.dom_volt_supported = True + self.dom_rx_power_supported = True + self.dom_tx_power_supported = True + if sfp_dom_capability & 0x20 != 0: + self.calibration = 1 + elif sfp_dom_capability & 0x10 != 0: + self.calibration = 2 + else: + self.calibration = 0 + else: + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.calibration = 0 + self.dom_tx_disable_supported = ( + int(sfp_dom_capability_raw[1], 16) & 0x40 != 0) + + # Provide the functions/variables below for which implementation is to be overwritten + + def __read_eeprom_specific_bytes(self, offset, num_bytes): + eeprom_raw = [] + if not self.get_presence(): + return None + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + try: + with open(self.eeprom_path, mode="rb", buffering=0) as eeprom: + eeprom.seek(offset) + raw = eeprom.read(num_bytes) + except Exception as e: + print("Error: Unable to open eeprom_path: %s" % (str(e))) + return None + + try: + if len(raw) == 0: + return None + for n in range(0, num_bytes): + eeprom_raw[n] = hex(raw[n])[2:].zfill(2) + except Exception as e: + print("Error: Exception info: %s" % (str(e))) + return None + + return eeprom_raw + + def get_transceiver_bulk_status(self): + # check present status + if not self.get_presence(): + return None + self.__dom_capability_detect() + + xcvr_dom_info_dict = dict.fromkeys(self.dom_dict_keys, 'N/A') + + if self.is_osfp_port: + # Below part is added to avoid fail xcvrd, shall be implemented later + pass + elif self.is_qsfp_port: + # QSFPs + xcvr_dom_info_dict = super(Sfp, self).get_transceiver_bulk_status() + + # pddf_sfp "qsfp_tx_power_support != 'on'" is wrong + + offset = 0 + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + qsfp_dom_rev_raw = self.__read_eeprom_specific_bytes((offset + QSFP_DOM_REV_OFFSET), QSFP_DOM_REV_WIDTH) + if qsfp_dom_rev_raw is not None: + qsfp_dom_rev_data = sfpd_obj.parse_sfp_dom_rev(qsfp_dom_rev_raw, 0) + else: + return None + + dom_channel_monitor_data = {} + qsfp_dom_rev = qsfp_dom_rev_data['data']['dom_rev']['value'] + + if (qsfp_dom_rev[0:8] == 'SFF-8636' and self.dom_tx_power_supported is True): + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power( + dom_channel_monitor_raw, 0) + else: + return None + + xcvr_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TX1Power']['value'] + xcvr_dom_info_dict['tx2power'] = dom_channel_monitor_data['data']['TX2Power']['value'] + xcvr_dom_info_dict['tx3power'] = dom_channel_monitor_data['data']['TX3Power']['value'] + xcvr_dom_info_dict['tx4power'] = dom_channel_monitor_data['data']['TX4Power']['value'] + else: + # SFPs + offset = 256 + if not self.dom_supported: + return xcvr_dom_info_dict + + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return None + + sfpd_obj._calibration_type = self.calibration + + dom_temperature_raw = self.__read_eeprom_specific_bytes((offset + SFP_TEMPE_OFFSET), SFP_TEMPE_WIDTH) + if dom_temperature_raw is not None: + dom_temperature_data = sfpd_obj.parse_temperature(dom_temperature_raw, 0) + else: + return None + + dom_voltage_raw = self.__read_eeprom_specific_bytes((offset + SFP_VOLT_OFFSET), SFP_VOLT_WIDTH) + if dom_voltage_raw is not None: + dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) + else: + return None + + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params(dom_channel_monitor_raw, 0) + else: + return None + + xcvr_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] + xcvr_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] + xcvr_dom_info_dict['rx1power'] = dom_channel_monitor_data['data']['RXPower']['value'] + xcvr_dom_info_dict['rx2power'] = 'N/A' + xcvr_dom_info_dict['rx3power'] = 'N/A' + xcvr_dom_info_dict['rx4power'] = 'N/A' + xcvr_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TXBias']['value'] + xcvr_dom_info_dict['tx2bias'] = 'N/A' + xcvr_dom_info_dict['tx3bias'] = 'N/A' + xcvr_dom_info_dict['tx4bias'] = 'N/A' + xcvr_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TXPower']['value'] + xcvr_dom_info_dict['tx2power'] = 'N/A' + xcvr_dom_info_dict['tx3power'] = 'N/A' + xcvr_dom_info_dict['tx4power'] = 'N/A' + + xcvr_dom_info_dict['rx_los'] = self.get_rx_los() + xcvr_dom_info_dict['tx_fault'] = self.get_tx_fault() + xcvr_dom_info_dict['reset_status'] = self.get_reset_status() + xcvr_dom_info_dict['lp_mode'] = self.get_lpmode() + + return xcvr_dom_info_dict + + def get_transceiver_threshold_info(self): + # check present status + if not self.get_presence(): + return None + self.__dom_capability_detect() + + xcvr_dom_threshold_info_dict = dict.fromkeys(self.threshold_dict_keys, 'N/A') + + if self.is_osfp_port: + # Below part is added to avoid fail xcvrd, shall be implemented later + pass + elif self.is_qsfp_port: + # QSFPs + if not self.dom_supported or not self.qsfp_page3_available: + return xcvr_dom_threshold_info_dict + + return super(Sfp, self).get_transceiver_threshold_info() + + else: + # SFPs + if not self.dom_supported: + return xcvr_dom_threshold_info_dict + + return super(Sfp, self).get_transceiver_threshold_info() + + return xcvr_dom_threshold_info_dict diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/thermal.py new file mode 100644 index 000000000000..99b743c6d343 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/thermal.py @@ -0,0 +1,14 @@ +try: + from sonic_platform_pddf_base.pddf_thermal import PddfThermal +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + + +class Thermal(PddfThermal): + """PDDF Platform-Specific Thermal class""" + + def __init__(self, index, pddf_data=None, pddf_plugin_data=None): + PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/watchdog.py new file mode 100644 index 000000000000..37788c2c821e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/sonic_platform/watchdog.py @@ -0,0 +1,21 @@ +############################################################################# +# +# Module contains an implementation of platform specific watchdog API's +# +############################################################################# + +try: + from sonic_platform_pddf_base.pddf_watchdog import PddfWatchdog +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +class Watchdog(PddfWatchdog): + """ + PDDF Platform-specific Chassis class + """ + + def __init__(self): + PddfWatchdog.__init__(self) + self.timeout= 180 + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/systemd/pddf-platform-init.service b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/systemd/pddf-platform-init.service new file mode 120000 index 000000000000..0fd9f25b6c5e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6510-32c/systemd/pddf-platform-init.service @@ -0,0 +1 @@ +../../../../pddf/i2c/service/pddf-platform-init.service \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/LICENSE b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/LICENSE new file mode 100755 index 000000000000..d37122689f3e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/LICENSE @@ -0,0 +1,15 @@ +Copyright (C) 2016 Microsoft, Inc +Copyright (C) 2018 Ragile Network Corporation +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/MAINTAINERS b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/MAINTAINERS new file mode 100755 index 000000000000..ec8222405085 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/MAINTAINERS @@ -0,0 +1,5 @@ +# See the SONiC project governance document for more information + +Name = "support" +Email = "support@ragile.com" +Mailinglist = sonicproject@googlegroups.com diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/Makefile b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/Makefile new file mode 100755 index 000000000000..46415e74ab7d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/Makefile @@ -0,0 +1,26 @@ +PWD = $(shell pwd) +DIR_KERNEL_SRC = $(PWD)/modules/driver +EXTRA_CFLAGS:= -I$(M)/include +EXTRA_CFLAGS+= -Wall +SUB_BUILD_DIR = $(PWD)/build +INSTALL_DIR = $(SUB_BUILD_DIR)/$(KERNEL_SRC)/$(INSTALL_MOD_DIR) +INSTALL_SCRIPT_DIR = $(SUB_BUILD_DIR)/usr/local/bin +INSTALL_SERVICE_DIR = $(SUB_BUILD_DIR)/lib/systemd/system/ + +KBUILD_EXTRA_SYMBOLS += $(DIR_KERNEL_SRC)/Module.symvers +export KBUILD_EXTRA_SYMBOLS + +all: + $(MAKE) -C $(KBUILD_OUTPUT) M=$(DIR_KERNEL_SRC) modules + @if [ ! -d ${INSTALL_DIR} ]; then mkdir -p ${INSTALL_DIR} ;fi + cp -r $(DIR_KERNEL_SRC)/*.ko $(INSTALL_DIR) + @if [ ! -d ${INSTALL_SCRIPT_DIR} ]; then mkdir -p ${INSTALL_SCRIPT_DIR} ;fi + cp -r $(PWD)/config/* $(INSTALL_SCRIPT_DIR) + @if [ ! -d ${INSTALL_SERVICE_DIR} ]; then mkdir -p ${INSTALL_SERVICE_DIR} ;fi + cp $(PWD)/systemd/*.service $(INSTALL_SERVICE_DIR) +clean: + rm -f ${DIR_KERNEL_SRC}/*.o ${DIR_KERNEL_SRC}/*.ko ${DIR_KERNEL_SRC}/*.mod.c ${DIR_KERNEL_SRC}/.*.cmd + rm -f ${DIR_KERNEL_SRC}/Module.markers ${DIR_KERNEL_SRC}/Module.symvers ${DIR_KERNEL_SRC}/modules.order + rm -rf ${DIR_KERNEL_SRC}/.tmp_versions + rm -rf $(SUB_BUILD_DIR) + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/README.md b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/README.md new file mode 100755 index 000000000000..787636c4ad20 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/README.md @@ -0,0 +1 @@ +Device drivers for support of ragile platform for the SONiC project diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/config/x86_64_ragile_ra_b6920_4s_r0_config.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/config/x86_64_ragile_ra_b6920_4s_r0_config.py new file mode 100755 index 000000000000..51cb6992a0a0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/config/x86_64_ragile_ra_b6920_4s_r0_config.py @@ -0,0 +1,625 @@ +#!/usr/bin/python +# -*- coding: UTF-8 -*- +from ragilecommon import * +PCA9548START = -1 +PCA9548BUSEND = -2 + +RAGILE_CARDID = 0x0000404d +RAGILE_PRODUCTNAME = "RA-B6920-4S" + +STARTMODULE = { + "fancontrol": 1, + "avscontrol": 1, + "sfptempmodule": 0, + "sfptempmodule_interval": 3, + "slot_monitor": 1, + "dev_monitor": 1, +} + + +DEV_MONITOR_PARAM = { + "polling_time": 5, + "psus": [ + { + "name": "psu1", + "present": {"gettype": "io", "io_addr": 0xB27, "presentbit": 0, "okval": 0}, + "device": [ + { + "id": "psu1pmbus", + "name": "fsp1200", + "bus": 23, + "loc": 0x58, + "attr": "hwmon", + }, + ], + }, + { + "name": "psu2", + "present": {"gettype": "io", "io_addr": 0xB28, "presentbit": 0, "okval": 0}, + "device": [ + { + "id": "psu2pmbus", + "name": "fsp1200", + "bus": 25, + "loc": 0x58, + "attr": "hwmon", + }, + ], + }, + { + "name": "psu3", + "present": {"gettype": "io", "io_addr": 0xB29, "presentbit": 0, "okval": 0}, + "device": [ + { + "id": "psu3pmbus", + "name": "fsp1200", + "bus": 24, + "loc": 0x58, + "attr": "hwmon", + }, + ], + }, + { + "name": "psu4", + "present": {"gettype": "io", "io_addr": 0xB2A, "presentbit": 0, "okval": 0}, + "device": [ + { + "id": "psu4pmbus", + "name": "fsp1200", + "bus": 26, + "loc": 0x58, + "attr": "hwmon", + }, + ], + }, + ], + "fans": [ + { + "name": "fan1", + "present": { + "gettype": "i2c", + "bus": 14, + "loc": 0x0d, + "offset": 0x30, + "presentbit": 0, + "okval": 0 + }, + "device": [ + { + "id": "fan1frue2", + "name": "24c02", + "bus": 63, + "loc": 0x50, + "attr": "eeprom" + }, + ], + }, + { + "name": "fan2", + "present": { + "gettype": "i2c", + "bus": 13, + "loc": 0x0d, + "offset": 0x30, + "presentbit": 0, + "okval": 0 + }, + "device": [ + { + "id": "fan2frue2", + "name": "24c02", + "bus": 55, + "loc": 0x50, + "attr": "eeprom" + }, + ], + }, + { + "name": "fan3", + "present": { + "gettype": "i2c", + "bus": 14, + "loc": 0x0d, + "offset": 0x30, + "presentbit": 1, + "okval": 0 + }, + "device": [ + { + "id": "fan3frue2", + "name": "24c02", + "bus": 64, + "loc": 0x50, + "attr": "eeprom" + }, + ], + }, + { + "name": "fan4", + "present": { + "gettype": "i2c", + "bus": 13, + "loc": 0x0d, + "offset": 0x30, + "presentbit": 1, + "okval": 0 + }, + "device": [ + { + "id": "fan4frue2", + "name": "24c02", + "bus": 56, + "loc": 0x50, + "attr": "eeprom" + }, + ], + }, + { + "name": "fan5", + "present": { + "gettype": "i2c", + "bus": 14, + "loc": 0x0d, + "offset": 0x30, + "presentbit": 2, + "okval": 0 + }, + "device": [ + { + "id": "fan5frue2", + "name": "24c02", + "bus": 65, + "loc": 0x50, + "attr": "eeprom" + }, + ], + }, + { + "name": "fan6", + "present": { + "gettype": "i2c", + "bus": 13, + "loc": 0x0d, + "offset": 0x30, + "presentbit": 2, + "okval": 0 + }, + "device": [ + { + "id": "fan6frue2", + "name": "24c02", + "bus": 57, + "loc": 0x50, + "attr": "eeprom" + }, + ], + }, + ] +} + + +FRULISTS = { + "fans":[ + {"name":"fan1","bus":63,"loc":0x50, }, + {"name":"fan2","bus":55,"loc":0x50, }, + {"name":"fan3","bus":64,"loc":0x50, }, + {"name":"fan4","bus":56,"loc":0x50, }, + {"name":"fan5","bus":65,"loc":0x50, }, + {"name":"fan6","bus":57,"loc":0x50, } + ] , + "psus": [ + {"name":"psu1","bus":23,"loc":0x50}, + {"name":"psu2","bus":25,"loc":0x50 }, + {"name":"psu2","bus":24,"loc":0x50 }, + {"name":"psu2","bus":26,"loc":0x50 } + ] +} + +# INIT_PARAM = [ +# {"loc":"3-0030/sfp_led_reset","value": "ff"}, +# {"loc":"3-0031/sfp_led_reset","value": "ff"}, +# {"loc":"4-0030/sfp_led_reset","value": "ff"}, +# {"loc":"4-0031/sfp_led_reset","value": "ff"}, +# {"loc":"5-0030/sfp_led_reset","value": "ff"}, +# {"loc":"5-0031/sfp_led_reset","value": "ff"}, +# {"loc":"6-0030/sfp_led_reset","value": "ff"}, +# {"loc":"6-0031/sfp_led_reset","value": "ff"}, +# ] +# INIT_COMMAND = [ +# "grtd_test.py io wr 0xb19 0xff", +# ] + +INIT_PARAM = [ + { + "name": "sfp_led_reset1", + "bus": 3, + "devaddr": 0x30, + "offset": 0xa0, + "val": 0xff, + }, + { + "name": "sfp_led_reset2", + "bus": 3, + "devaddr": 0x31, + "offset": 0xa0, + "val": 0xff, + }, + { + "name": "sfp_led_reset3", + "bus": 4, + "devaddr": 0x30, + "offset": 0xa0, + "val": 0xff, + }, + { + "name": "sfp_led_reset4", + "bus": 4, + "devaddr": 0x31, + "offset": 0xa0, + "val": 0xff, + }, + { + "name": "sfp_led_reset5", + "bus": 5, + "devaddr": 0x30, + "offset": 0xa0, + "val": 0xff, + }, + { + "name": "sfp_led_reset6", + "bus": 5, + "devaddr": 0x31, + "offset": 0xa0, + "val": 0xff, + }, + { + "name": "sfp_led_reset7", + "bus": 6, + "devaddr": 0x30, + "offset": 0xa0, + "val": 0xff, + }, + { + "name": "sfp_led_reset8", + "bus": 6, + "devaddr": 0x31, + "offset": 0xa0, + "val": 0xff, + }, + { + "name": "mac_power_on", + "type": "io", + "offset": 0xb19, + "val": 0xff + } +] +#rg_eeprom = "0-0054/eeprom" +E2_LOC = {"bus":1, "devno":0x56} +E2_PROTECT = {"io_addr":0xb45, "gettype":"io", "open":0, "close":1} + +CPLDVERSIONS = [ + {"bus":13, "devno":0x0d, "name":"FAN_CPLD_B"}, + {"bus":14, "devno":0x0d, "name":"FAN_CPLD_A"}, + {"bus":3, "devno":0x30, "name":"LC1_CPLD_1"}, + {"bus":3, "devno":0x31, "name":"LC1_CPLD_2"}, + {"bus":4, "devno":0x30, "name":"LC2_CPLD_1"}, + {"bus":4, "devno":0x31, "name":"LC2_CPLD_2"}, + {"bus":5, "devno":0x30, "name":"LC3_CPLD_1"}, + {"bus":5, "devno":0x31, "name":"LC3_CPLD_2"}, + {"bus":6, "devno":0x30, "name":"LC4_CPLD_1"}, + {"bus":6, "devno":0x31, "name":"LC4_CPLD_2"}, + {"io_addr":0x700, "name":"X86_CPLD", "gettype":"io"}, + {"io_addr":0x900, "name":"MAC_CPLD_B", "gettype":"io"}, + {"io_addr":0xb00, "name":"MAC_CPLD_A", "gettype":"io"}, +] + +DRIVERLISTS = [] + + +TEMPIDCHANGE = { + "lm75in": "inlet", + "lm75out": "outlet", + "lm75hot": "hot-point", + "slot1lm75a1": "LINE CARD1 lm751", + "slot1lm75a2": "LINE CARD1 lm752", + "slot1lm75a3": "LINE CARD1 lm753", + "slot2lm75a1": "LINE CARD2 lm751", + "slot2lm75a2": "LINE CARD2 lm752", + "slot2lm75a3": "LINE CARD2 lm753", + "slot3lm75a1": "LINE CARD3 lm751", + "slot3lm75a2": "LINE CARD3 lm752", + "slot3lm75a3": "LINE CARD3 lm753", + "slot4lm75a1": "LINE CARD4 lm751", + "slot4lm75a2": "LINE CARD4 lm752", + "slot4lm75a3": "LINE CARD4 lm753", + "inlet": "lm75in", + "outlet": "lm75out", + "hot-point": "lm75hot", +} + +DEVICE = [] + + +fanlevel = { + "tips":["LOW","MIDDLE","HIGH"], + "level":[51,128,255], + "low_speed":[1500,4500,9500], + "high_speed":[3000,7000,14000] +} + +fanloc =[ {"name":"FAN1", "location":"2-0020/fan1_pwm" , + "childfans":[{"name":"FRONT ROTOR", "location":"2-0020/fan1_input"},{"name":"BACK ROTOR", "location":"2-0020/fan2_input"} ]}, + {"name":"FAN2", "location":"2-0020/fan3_pwm", + "childfans":[{"name":"FRONT ROTOR", "location":"2-0020/fan3_input"},{"name":"BACK ROTOR", "location":"2-0020/fan4_input"} ]}, + {"name":"FAN3", "location":"2-0020/fan5_pwm", + "childfans":[{"name":"FRONT ROTOR", "location":"2-0020/fan5_input"},{"name":"BACK ROTOR", "location":"2-0020/fan6_input"} ]}, + {"name":"FAN4", "location":"2-0020/fan7_pwm", + "childfans":[{"name":"FRONT ROTOR", "location":"2-0020/fan7_input"},{"name":"BACK ROTOR", "location":"2-0020/fan8_input"} ]}, + {"name":"FAN5", "location":"2-0020/fan9_pwm", + "childfans":[{"name":"FRONT ROTOR", "location":"2-0020/fan9_input"},{"name":"BACK ROTOR", "location":"2-0020/fan10_input"} ]}, + {"name":"FAN6", "location":"2-0020/fan11_pwm", + "childfans":[{"name":"FRONT ROTOR", "location":"2-0020/fan11_input"},{"name":"BACK ROTOR", "location":"2-0020/fan12_input"} ]}, + ] + + +#################FAN speed args ############################## +MONITOR_TEMP_MIN = 30 +MONITOR_K = 14 +MONITOR_MAC_IN = 35 +MONITOR_DEFAULT_SPEED = 0x80 +MONITOR_MAX_SPEED = 0xFF +MONITOR_MIN_SPEED = 0x33 +MONITOR_MAC_ERROR_SPEED = 0XBB +MONITOR_FAN_TOTAL_NUM = 6 +MONITOR_MAC_UP_TEMP = 40 +MONITOR_MAC_LOWER_TEMP = -40 +MONITOR_MAC_MAX_TEMP = 100 + +MONITOR_FALL_TEMP = 2 +MONITOR_MAC_WARNING_THRESHOLD = 100 +MONITOR_OUTTEMP_WARNING_THRESHOLD = 85 +MONITOR_BOARDTEMP_WARNING_THRESHOLD = 85 +MONITOR_CPUTEMP_WARNING_THRESHOLD = 85 +MONITOR_INTEMP_WARNING_THRESHOLD = 70 + +MONITOR_MAC_CRITICAL_THRESHOLD = 105 +MONITOR_OUTTEMP_CRITICAL_THRESHOLD = 90 +MONITOR_BOARDTEMP_CRITICAL_THRESHOLD = 90 +MONITOR_CPUTEMP_CRITICAL_THRESHOLD = 100 +MONITOR_INTEMP_CRITICAL_THRESHOLD = 80 +MONITOR_CRITICAL_NUM = 2 +MONITOR_SHAKE_TIME = 10 +MONITOR_INTERVAL = 60 + +MONITOR_SYS_LED = [ +{ + "cmdstr":"/sys/devices/pci0000:00/0000:00:1f.0/broad_front_sys", + "yellow":0x06, + "red":0x02, + "green":0x04, + "type":"sysfs", +}, +] + +MONITOR_SYS_FAN_LED =[ +{ + "cmdstr":"/sys/devices/pci0000:00/0000:00:1f.0/broad_front_fan", + "yellow":0x06, + "red":0x02, + "green":0x04, + "type":"sysfs", +}, +] + +MONITOR_FANS_LED = [ + {"bus":14,"devno":0x0d, "addr":0x3b, "green":0x04, "red":0x02}, + {"bus":13,"devno":0x0d, "addr":0x3b, "green":0x04, "red":0x02}, + {"bus":14,"devno":0x0d, "addr":0x3c, "green":0x04, "red":0x02}, + {"bus":13,"devno":0x0d, "addr":0x3c, "green":0x04, "red":0x02}, + {"bus":14,"devno":0x0d, "addr":0x3d, "green":0x04, "red":0x02}, + {"bus":13,"devno":0x0d, "addr":0x3d, "green":0x04, "red":0x02}, + ] + +DEV_LEDS = { + "SLOTLED":[ + {"name":'slot1',"bus":3,"devno":0x30, "addr":0x1a, "green":0x04, "red":0x02}, + {"name":'slot2',"bus":4,"devno":0x30, "addr":0x1a, "green":0x04, "red":0x02}, + {"name":'slot3',"bus":5,"devno":0x30, "addr":0x1a, "green":0x04, "red":0x02}, + {"name":'slot4',"bus":6,"devno":0x30, "addr":0x1a, "green":0x04, "red":0x02}, + ] +} + +MONITOR_SYS_PSU_LED =[ +{ + "cmdstr":"/sys/devices/pci0000:00/0000:00:1f.0/broad_front_pwr", + "yellow":0x06, + "red":0x02, + "green":0x04, + "type":"sysfs", +}, +] + +MONITOR_FAN_STATUS = [ + {'status':'green' , 'minOkNum':6,'maxOkNum':6}, + {'status':'yellow', 'minOkNum':5,'maxOkNum':5}, + {'status':'red' , 'minOkNum':0,'maxOkNum':4}, + ] + +MONITOR_PSU_STATUS = [ + {'status':'green' , 'minOkNum':4,'maxOkNum':4}, + {'status':'yellow', 'minOkNum':3,'maxOkNum':3}, + {'status':'red' , 'minOkNum':0,'maxOkNum':2}, + ] + +MONITOR_DEV_STATUS = { + "temperature": [ + {"name":"lm75in", "location":"/sys/bus/i2c/devices/29-004f/hwmon/*/temp1_input"}, + {"name":"lm75out", "location":"/sys/bus/i2c/devices/28-004b/hwmon/*/temp1_input"}, + {"name":"lm75hot", "location":"/sys/bus/i2c/devices/28-004c/hwmon/*/temp1_input"}, + {"name":"cpu", "location":"/sys/class/hwmon/hwmon0"}, + ], + "fans": [ + { + "name":"fan1", + "presentstatus":{"bus":14, "loc":0x0d, "offset":0x30, 'bit':0}, + "rollstatus": [ + {"name":"motor1","bus":14, "loc":0x0d, "offset":0x31, 'bit':0}, + {"name":"motor2","bus":14, "loc":0x0d, "offset":0x34, 'bit':0}, + ] + }, + { + "name":"fan2", + "presentstatus":{"bus":13, "loc":0x0d, "offset":0x30, 'bit':0}, + "rollstatus": [ + {"name":"motor1","bus":13, "loc":0x0d, "offset":0x31, 'bit':0}, + {"name":"motor2","bus":13, "loc":0x0d, "offset":0x34, 'bit':0}, + ] + }, + { + "name":"fan3", + "presentstatus":{"bus":14, "loc":0x0d, "offset":0x30, 'bit':1}, + "rollstatus": [ + {"name":"motor1","bus":14, "loc":0x0d, "offset":0x31, 'bit':1}, + {"name":"motor2","bus":14, "loc":0x0d, "offset":0x34, 'bit':1}, + ] + }, + { + "name":"fan4", + "presentstatus":{"bus":13, "loc":0x0d, "offset":0x30, 'bit':1}, + "rollstatus": [ + {"name":"motor1","bus":13, "loc":0x0d, "offset":0x31, 'bit':1}, + {"name":"motor2","bus":13, "loc":0x0d, "offset":0x34, 'bit':1}, + ] + }, + { + "name":"fan5", + "presentstatus":{"bus":14, "loc":0x0d, "offset":0x30, 'bit':2}, + "rollstatus": [ + {"name":"motor1","bus":14, "loc":0x0d, "offset":0x31, 'bit':2}, + {"name":"motor2","bus":14, "loc":0x0d, "offset":0x34, 'bit':2}, + ] + }, + { + "name":"fan6", + "presentstatus":{"bus":13, "loc":0x0d, "offset":0x30, 'bit':2}, + "rollstatus": [ + {"name":"motor1","bus":13, "loc":0x0d, "offset":0x31, 'bit':2}, + {"name":"motor2","bus":13, "loc":0x0d, "offset":0x34, 'bit':2}, + ] + }, + ], + "psus": [ + {"name":"psu1", "io_addr":0xb27, "gettype":"io", 'presentbit': 0, 'statusbit':1, 'alertbit':2}, + {"name":"psu2", "io_addr":0xb28, "gettype":"io", 'presentbit': 0, 'statusbit':1, 'alertbit':2}, + {"name":"psu3", "io_addr":0xb29, "gettype":"io", 'presentbit': 0, 'statusbit':1, 'alertbit':2}, + {"name":"psu4", "io_addr":0xb2a, "gettype":"io", 'presentbit': 0, 'statusbit':1, 'alertbit':2} + ], + "slots": [ + {"name":"slot1", "io_addr":0xb2c, "gettype":"io", 'presentbit': 4}, + {"name":"slot2", "io_addr":0xb2c, "gettype":"io", 'presentbit': 5}, + {"name":"slot3", "io_addr":0xb2c, "gettype":"io", 'presentbit': 6}, + {"name":"slot4", "io_addr":0xb2c, "gettype":"io", 'presentbit': 7} + ], + "mac_temp" : { + "loc" : [ + "28-004c/hwmon/*/temp2_input", + "29-004c/hwmon/*/temp2_input", + ], + }, +} + +MONITOR_DEV_STATUS_DECODE = { + 'fanpresent' : {0:'PRESENT', 1:'ABSENT', 'okval':0}, + 'fanroll' : {0:'STALL' , 1:'ROLL', 'okval':1}, + 'psupresent' : {0:'PRESENT', 1:'ABSENT', 'okval':0}, + 'psuoutput' : {0:'FAULT' , 1:'NORMAL', 'okval':1}, + 'psualert' : {0:'FAULT' , 1:'NORMAL', 'okval':1}, + 'slotpresent': {0:'PRESENT', 1:'ABSENT', 'okval':0}, +} + +SLOT_MONITOR_PARAM = { + "polling_time" : 0.5, + "slots": [ + {"name":"slot1", + "present":{"gettype":"io", "io_addr":0xb2c,"presentbit": 4,"okval":0}, + "act":[ + {"io_addr":0xb19, "value":0x01, "mask":0xfe, "gettype":"io"}, + {"bus":3, "loc":0x30, "offset":0xa0, "value":0xff,"gettype":"i2c"}, + {"bus":3, "loc":0x31, "offset":0xa0, "value":0xff,"gettype":"i2c"}, + ], + }, + {"name":"slot2", + "present":{"gettype":"io", "io_addr":0xb2c,"presentbit": 5,"okval":0}, + "act":[ + {"io_addr":0xb19, "value":0x02, "mask":0xfd, "gettype":"io"}, + {"bus":4, "loc":0x30, "offset":0xa0, "value":0xff,"gettype":"i2c"}, + {"bus":4, "loc":0x31, "offset":0xa0, "value":0xff,"gettype":"i2c"}, + ], + }, + {"name":"slot3", + "present":{"gettype":"io", "io_addr":0xb2c,"presentbit": 6,"okval":0}, + "act":[ + {"io_addr":0xb19, "value":0x04, "mask":0xfb, "gettype":"io"}, + {"bus":5, "loc":0x30, "offset":0xa0, "value":0xff,"gettype":"i2c"}, + {"bus":5, "loc":0x31, "offset":0xa0, "value":0xff,"gettype":"i2c"}, + ], + }, + {"name":"slot4", + "present":{"gettype":"io", "io_addr":0xb2c,"presentbit": 7,"okval":0}, + "act":[ + {"io_addr":0xb19, "value":0x08, "mask":0xf7, "gettype":"io"}, + {"bus":6, "loc":0x30, "offset":0xa0, "value":0xff,"gettype":"i2c"}, + {"bus":6, "loc":0x31, "offset":0xa0, "value":0xff,"gettype":"i2c"}, + ], + }, + ], +} + +#####################MAC AVS ARGS (B6920-4S) #################################### +MAC_AVS_PARAM ={ + 0x72:0x0384 , + 0x73:0x037e , + 0x74:0x0378 , + 0x75:0x0372 , + 0x76:0x036b , + 0x77:0x0365 , + 0x78:0x035f , + 0x79:0x0359 , + 0x7a:0x0352 , + 0x7b:0x034c , + 0x7c:0x0346 , + 0x7d:0x0340 , + 0x7e:0x0339 , + 0x7f:0x0333 , + 0x80:0x032d , + 0x81:0x0327 , + 0x82:0x0320 , + 0x83:0x031a , + 0x84:0x0314 , + 0x85:0x030e , + 0x86:0x0307 , + 0x87:0x0301 , + 0x88:0x02fb , + 0x89:0x02f5 , + 0x8A:0x02ee +} + + +MAC_DEFAULT_PARAM = { + "type": 1, + "default":0x73, + "loopaddr":0x00, + "loop":0x01, + "open":0x00, + "close":0x40, + "bus":30, + "devno":0x64, + "addr":0x21, + "protectaddr":0x10, + "sdkreg":"DMU_PCU_OTP_CONFIG_4", + "sdkcmd": "scdcmd", + "sdkcmdargs": ["-t", 5], + "sdktype": 1, + "macregloc":8, + "mask": 0xff +} diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/Makefile b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/Makefile new file mode 100755 index 000000000000..2b5ac6c5aadb --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/Makefile @@ -0,0 +1,8 @@ +obj-m := rg_cpld.o + +obj-m += lpc_cpld_i2c.o +obj-m += rg_lpc_cpld.o +obj-m += pddf_custom_fan.o +obj-m += pddf_custom_psu.o +obj-m += pddf_custom_xcvr.o +obj-m += pddf_custom_led_module.o diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/lpc_cpld_i2c.c b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/lpc_cpld_i2c.c new file mode 100755 index 000000000000..17e2025d3caa --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/lpc_cpld_i2c.c @@ -0,0 +1,131 @@ +#include /* Wd're doing kernel work */ +#include /* specifically, a module */ +#include +#include /* Need for the macros */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "../../../common/modules/lpc_cpld_i2c_ocores.h" +#include "ragile.h" + +int lpc_cpld_i2c_verbose = 0; +int lpc_cpld_i2c_error = 0; +module_param(lpc_cpld_i2c_verbose, int, S_IRUGO | S_IWUSR); +module_param(lpc_cpld_i2c_error, int, S_IRUGO | S_IWUSR); + + +#define LPC_CPLD_I2C_VERBOSE(fmt, args...) do { \ + if (lpc_cpld_i2c_verbose) { \ + printk(KERN_ERR "[LPC_CPLD_I2C_DEVICE][VERBOSE][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ + } \ +} while (0) + +#define LPC_CPLD_I2C_ERROR(fmt, args...) do { \ + if (lpc_cpld_i2c_error) { \ + printk(KERN_ERR "[LPC_CPLD_I2C_DEVICE][ERROR][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ + } \ + } while (0) + +#define PCI_VENDOR_ID_D1527_LPC (0x8c54) +#define PCI_VENDOR_ID_C3000_LPC (0x19dc) + +#define LPC_CPLD_I2C_OCORE_START_BASE (0x800) +#define MAX_LPC_CPLD_I2C_REG_SIZE (0x8) + +#define LPC_CPLD_I2C_OCORE_CTRL_START(id) ((LPC_CPLD_I2C_OCORE_START_BASE) + (id) * (MAX_LPC_CPLD_I2C_REG_SIZE)) +#define LPC_CPLD_I2C_OCORE_CTRL_END(id) ((LPC_CPLD_I2C_OCORE_START_BASE) + (id + 1) * (MAX_LPC_CPLD_I2C_REG_SIZE) - 1) + +static struct rg_ocores_cpld_i2c_platform_data rg_i2c_ocore_pdata = { + .reg_shift = 0, + .reg_io_width = 1, + .clock_khz = 33000, + .num_devices = 0, + .i2c_irq_flag = 1, +}; + +#define DEFINE_LPC_CPLD_I2C_DEVICE_RESOURCES(_id) \ + static struct resource lpc_cpld_i2c_resources_##_id[] = { \ + { \ + .start = LPC_CPLD_I2C_OCORE_CTRL_START(_id), \ + .end = LPC_CPLD_I2C_OCORE_CTRL_END(_id), \ + .flags = IORESOURCE_IO, \ + }, \ +} + +DEFINE_LPC_CPLD_I2C_DEVICE_RESOURCES(52); +DEFINE_LPC_CPLD_I2C_DEVICE_RESOURCES(48); +DEFINE_LPC_CPLD_I2C_DEVICE_RESOURCES(49); +DEFINE_LPC_CPLD_I2C_DEVICE_RESOURCES(50); +DEFINE_LPC_CPLD_I2C_DEVICE_RESOURCES(51); + +#define DEFINE_LPC_CPLD_I2C_MFD_CELL_CFG(_id) \ + { \ + .name = "rg-cpld-ocrore-i2c", \ + .id = (_id), \ + .num_resources = ARRAY_SIZE(lpc_cpld_i2c_resources_##_id), \ + .resources = lpc_cpld_i2c_resources_##_id, \ + .platform_data = &rg_i2c_ocore_pdata, \ + .pdata_size = sizeof(rg_i2c_ocore_pdata), \ + } + +static const struct mfd_cell lpc_cpld_i2c_cells_bar0_cfg0[] = { + DEFINE_LPC_CPLD_I2C_MFD_CELL_CFG(52), + DEFINE_LPC_CPLD_I2C_MFD_CELL_CFG(48), + DEFINE_LPC_CPLD_I2C_MFD_CELL_CFG(49), + DEFINE_LPC_CPLD_I2C_MFD_CELL_CFG(50), + DEFINE_LPC_CPLD_I2C_MFD_CELL_CFG(51), +}; + +static int __init lpc_cpld_i2c_init(void) +{ + struct pci_dev *pdev = NULL; + int ret; + + LPC_CPLD_I2C_VERBOSE("Enter.\n"); + + pdev = pci_get_device(PCI_VENDOR_ID_INTEL, PCI_VENDOR_ID_D1527_LPC, pdev); + if (!pdev) { + LPC_CPLD_I2C_ERROR("pci_get_device(0x8086, 0x8c54) failed!\n"); + return 0; + } + + ret = mfd_add_devices(&pdev->dev, 0, + lpc_cpld_i2c_cells_bar0_cfg0, + ARRAY_SIZE(lpc_cpld_i2c_cells_bar0_cfg0), + NULL, 0, NULL); + if (ret) { + LPC_CPLD_I2C_ERROR("mfd_add_devices failed: %d\n", ret); + return -1; + } + LPC_CPLD_I2C_VERBOSE("Leave success\n"); + return ret; +} + +static void __exit lpc_cpld_i2c_exit(void) +{ + struct pci_dev *pdev = NULL; + + pdev = pci_get_device(PCI_VENDOR_ID_INTEL, PCI_VENDOR_ID_D1527_LPC, pdev); + if (!pdev) { + LPC_CPLD_I2C_ERROR("pci_get_device(0x8086, 0x8c54) failed!\n"); + return ; + } + + mfd_remove_devices(&pdev->dev); + LPC_CPLD_I2C_VERBOSE("Leave.\n"); +} + +module_init(lpc_cpld_i2c_init); +module_exit(lpc_cpld_i2c_exit); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("support "); diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/pddf_custom_fan.c b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/pddf_custom_fan.c new file mode 100644 index 000000000000..9367524a9427 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/pddf_custom_fan.c @@ -0,0 +1,268 @@ +#include +#include "../../../../../pddf/i2c/modules/include/pddf_client_defs.h" +#include "../../../../../pddf/i2c/modules/include/pddf_fan_defs.h" +#include "../../../../../pddf/i2c/modules/include/pddf_fan_driver.h" +#include "../../../../../pddf/i2c/modules/include/pddf_fan_api.h" + +extern void *get_device_table(char *name); + +extern FAN_SYSFS_ATTR_DATA data_fan1_present; +extern FAN_SYSFS_ATTR_DATA data_fan2_present; +extern FAN_SYSFS_ATTR_DATA data_fan3_present; +extern FAN_SYSFS_ATTR_DATA data_fan4_present; +extern FAN_SYSFS_ATTR_DATA data_fan5_present; +extern FAN_SYSFS_ATTR_DATA data_fan6_present; +extern FAN_SYSFS_ATTR_DATA data_fan7_present; +extern FAN_SYSFS_ATTR_DATA data_fan8_present; +extern FAN_SYSFS_ATTR_DATA data_fan9_present; +extern FAN_SYSFS_ATTR_DATA data_fan10_present; +extern FAN_SYSFS_ATTR_DATA data_fan11_present; +extern FAN_SYSFS_ATTR_DATA data_fan12_present; + +extern FAN_SYSFS_ATTR_DATA data_fan1_input; +extern FAN_SYSFS_ATTR_DATA data_fan2_input; +extern FAN_SYSFS_ATTR_DATA data_fan3_input; +extern FAN_SYSFS_ATTR_DATA data_fan4_input; +extern FAN_SYSFS_ATTR_DATA data_fan5_input; +extern FAN_SYSFS_ATTR_DATA data_fan6_input; +extern FAN_SYSFS_ATTR_DATA data_fan7_input; +extern FAN_SYSFS_ATTR_DATA data_fan8_input; +extern FAN_SYSFS_ATTR_DATA data_fan9_input; +extern FAN_SYSFS_ATTR_DATA data_fan10_input; +extern FAN_SYSFS_ATTR_DATA data_fan11_input; +extern FAN_SYSFS_ATTR_DATA data_fan12_input; + +extern FAN_SYSFS_ATTR_DATA data_fan1_pwm; +extern FAN_SYSFS_ATTR_DATA data_fan2_pwm; +extern FAN_SYSFS_ATTR_DATA data_fan3_pwm; +extern FAN_SYSFS_ATTR_DATA data_fan4_pwm; +extern FAN_SYSFS_ATTR_DATA data_fan5_pwm; +extern FAN_SYSFS_ATTR_DATA data_fan6_pwm; +extern FAN_SYSFS_ATTR_DATA data_fan7_pwm; +extern FAN_SYSFS_ATTR_DATA data_fan8_pwm; +extern FAN_SYSFS_ATTR_DATA data_fan9_pwm; +extern FAN_SYSFS_ATTR_DATA data_fan10_pwm; +extern FAN_SYSFS_ATTR_DATA data_fan11_pwm; +extern FAN_SYSFS_ATTR_DATA data_fan12_pwm; + +extern FAN_SYSFS_ATTR_DATA data_fan1_fault; +extern FAN_SYSFS_ATTR_DATA data_fan2_fault; +extern FAN_SYSFS_ATTR_DATA data_fan3_fault; +extern FAN_SYSFS_ATTR_DATA data_fan4_fault; +extern FAN_SYSFS_ATTR_DATA data_fan5_fault; +extern FAN_SYSFS_ATTR_DATA data_fan6_fault; +extern FAN_SYSFS_ATTR_DATA data_fan7_fault; +extern FAN_SYSFS_ATTR_DATA data_fan8_fault; +extern FAN_SYSFS_ATTR_DATA data_fan9_fault; +extern FAN_SYSFS_ATTR_DATA data_fan10_fault; +extern FAN_SYSFS_ATTR_DATA data_fan11_fault; +extern FAN_SYSFS_ATTR_DATA data_fan12_fault; + +int pddf_custom_fan_present(void *client, FAN_DATA_ATTR *udata, void *info); +int pddf_custom_fan_input(void *client, FAN_DATA_ATTR *udata, void *info); +int pddf_custom_fan_fault(void *client, FAN_DATA_ATTR *udata, void *info); +int pddf_custom_fan_pwm(void *client, FAN_DATA_ATTR *udata, void *info); +int pddf_custom_fan_set_pwm(void *client, FAN_DATA_ATTR *udata, void *info); + +int pddf_custom_fan_present(void *client, FAN_DATA_ATTR *udata, void *info) +{ + uint32_t val; + struct fan_attr_info *painfo = (struct fan_attr_info *)info; + + val = 0; + + if (strcmp(udata->devtype, "cpld") == 0) { + if (udata->devname) { + client = (struct i2c_client *)get_device_table(udata->devname); + } + } + val = i2c_smbus_read_byte_data((struct i2c_client *)client, udata->offset); + /* printk("%s read data %x\n", __FUNCTION__, val); */ + + painfo->val.intval = ((val & udata->mask) == udata->cmpval); + + return 0; +} + +int pddf_custom_fan_input(void *client, FAN_DATA_ATTR *udata, void *info) +{ + uint32_t val; + struct fan_attr_info *painfo = (struct fan_attr_info *)info; + + val = 0; + + if (strcmp(udata->devtype, "cpld") == 0) { + if (udata->devname) { + client = (struct i2c_client *)get_device_table(udata->devname); + } + } + if (udata->len == 1) { + val = i2c_smbus_read_byte_data(client, udata->offset); + } else if (udata->len == 2) { + val = i2c_smbus_read_word_swapped((struct i2c_client *)client, udata->offset); + } + + /* printk("%s read data %x\n", __FUNCTION__, val); */ + + if (udata->is_divisor) + painfo->val.intval = udata->mult / (val >> 3); + else + painfo->val.intval = udata->mult * val; + + return 0; +} + +int pddf_custom_fan_pwm(void *client, FAN_DATA_ATTR *udata, void *info) +{ + uint32_t val; + struct fan_attr_info *painfo = (struct fan_attr_info *)info; + + val = 0; + + if (strcmp(udata->devtype, "cpld") == 0) { + if (udata->devname) { + client = (struct i2c_client *)get_device_table(udata->devname); + } + } + if (udata->len == 1) { + val = i2c_smbus_read_byte_data(client, udata->offset); + } else if (udata->len == 2) { + val = i2c_smbus_read_word_swapped((struct i2c_client *)client, udata->offset); + } + /* printk("%s read data %x\n", __FUNCTION__, val); */ + + val = val & udata->mask; + painfo->val.intval = val; + + return 0; +} + +int pddf_custom_fan_set_pwm(void *client, FAN_DATA_ATTR *udata, void *info) +{ + uint32_t val; + struct fan_attr_info *painfo; + + val = 0; + painfo = (struct fan_attr_info *)info; + + val = painfo->val.intval & udata->mask; + + if (val > 255) { + return -EINVAL; + } + + if (strcmp(udata->devtype, "cpld") == 0 && udata->devname) { + client = (struct i2c_client *)get_device_table(udata->devname); + i2c_smbus_write_byte_data(client, udata->offset, val); + } + + return 0; +} + + +int pddf_custom_fan_fault(void *client, FAN_DATA_ATTR *udata, void *info) +{ + uint32_t val; + struct fan_attr_info *painfo = (struct fan_attr_info *)info; + + val = 0; + + if (strcmp(udata->devtype, "cpld") == 0) { + if (udata->devname) { + client = (struct i2c_client *)get_device_table(udata->devname); + } + } + val = i2c_smbus_read_byte_data((struct i2c_client *)client, udata->offset); + /* printk("%s read data %x\n", __FUNCTION__, val); */ + + val = val & udata->mask; + painfo->val.intval = val; + + return 0; +} + +int __init pddf_custom_fan_init(void) +{ + printk(KERN_ERR "pddf_custom_fan_init\n"); + + data_fan1_present.do_get = pddf_custom_fan_present; + data_fan2_present.do_get = pddf_custom_fan_present; + data_fan3_present.do_get = pddf_custom_fan_present; + data_fan4_present.do_get = pddf_custom_fan_present; + data_fan5_present.do_get = pddf_custom_fan_present; + data_fan6_present.do_get = pddf_custom_fan_present; + data_fan7_present.do_get = pddf_custom_fan_present; + data_fan8_present.do_get = pddf_custom_fan_present; + data_fan9_present.do_get = pddf_custom_fan_present; + data_fan10_present.do_get = pddf_custom_fan_present; + data_fan11_present.do_get = pddf_custom_fan_present; + data_fan12_present.do_get = pddf_custom_fan_present; + + data_fan1_input.do_get = pddf_custom_fan_input; + data_fan2_input.do_get = pddf_custom_fan_input; + data_fan3_input.do_get = pddf_custom_fan_input; + data_fan4_input.do_get = pddf_custom_fan_input; + data_fan5_input.do_get = pddf_custom_fan_input; + data_fan6_input.do_get = pddf_custom_fan_input; + data_fan7_input.do_get = pddf_custom_fan_input; + data_fan8_input.do_get = pddf_custom_fan_input; + data_fan9_input.do_get = pddf_custom_fan_input; + data_fan10_input.do_get = pddf_custom_fan_input; + data_fan11_input.do_get = pddf_custom_fan_input; + data_fan12_input.do_get = pddf_custom_fan_input; + + data_fan1_pwm.do_get = pddf_custom_fan_pwm; + data_fan2_pwm.do_get = pddf_custom_fan_pwm; + data_fan3_pwm.do_get = pddf_custom_fan_pwm; + data_fan4_pwm.do_get = pddf_custom_fan_pwm; + data_fan5_pwm.do_get = pddf_custom_fan_pwm; + data_fan6_pwm.do_get = pddf_custom_fan_pwm; + data_fan7_pwm.do_get = pddf_custom_fan_pwm; + data_fan8_pwm.do_get = pddf_custom_fan_pwm; + data_fan9_pwm.do_get = pddf_custom_fan_pwm; + data_fan10_pwm.do_get = pddf_custom_fan_pwm; + data_fan11_pwm.do_get = pddf_custom_fan_pwm; + data_fan12_pwm.do_get = pddf_custom_fan_pwm; + + data_fan1_pwm.do_set = pddf_custom_fan_set_pwm; + data_fan2_pwm.do_set = pddf_custom_fan_set_pwm; + data_fan3_pwm.do_set = pddf_custom_fan_set_pwm; + data_fan4_pwm.do_set = pddf_custom_fan_set_pwm; + data_fan5_pwm.do_set = pddf_custom_fan_set_pwm; + data_fan6_pwm.do_set = pddf_custom_fan_set_pwm; + data_fan7_pwm.do_set = pddf_custom_fan_set_pwm; + data_fan8_pwm.do_set = pddf_custom_fan_set_pwm; + data_fan9_pwm.do_set = pddf_custom_fan_set_pwm; + data_fan10_pwm.do_set = pddf_custom_fan_set_pwm; + data_fan11_pwm.do_set = pddf_custom_fan_set_pwm; + data_fan12_pwm.do_set = pddf_custom_fan_set_pwm; + + data_fan1_fault.do_get = pddf_custom_fan_fault; + data_fan2_fault.do_get = pddf_custom_fan_fault; + data_fan3_fault.do_get = pddf_custom_fan_fault; + data_fan4_fault.do_get = pddf_custom_fan_fault; + data_fan5_fault.do_get = pddf_custom_fan_fault; + data_fan6_fault.do_get = pddf_custom_fan_fault; + data_fan7_fault.do_get = pddf_custom_fan_fault; + data_fan8_fault.do_get = pddf_custom_fan_fault; + data_fan9_fault.do_get = pddf_custom_fan_fault; + data_fan10_fault.do_get = pddf_custom_fan_fault; + data_fan11_fault.do_get = pddf_custom_fan_fault; + data_fan12_fault.do_get = pddf_custom_fan_fault; + + return 0; +} + +void __exit pddf_custom_fan_exit(void) +{ + printk(KERN_ERR "pddf_custom_fan_exit\n"); + return; +} + +MODULE_AUTHOR("support "); +MODULE_DESCRIPTION("pddf custom fan api"); +MODULE_LICENSE("GPL"); + +module_init(pddf_custom_fan_init); +module_exit(pddf_custom_fan_exit); + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/pddf_custom_led_module.c b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/pddf_custom_led_module.c new file mode 100644 index 000000000000..97ca23a92324 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/pddf_custom_led_module.c @@ -0,0 +1,745 @@ +/* + * Copyright 2019 Broadcom. + * The term “Broadcom†refers to Broadcom Inc. and/or its subsidiaries. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * + * A pddf kernel module to manage various LEDs of a switch + */ + +#include +#include +#include +#include +#include +#include +#include "../../../../../pddf/i2c/modules/include/pddf_led_defs.h" +#include "../../../../../pddf/i2c/modules/include/pddf_client_defs.h" +#include +#include +#include +#include + +#define DEBUG 0 +LED_OPS_DATA sys_led_ops_data[1]={0}; +LED_OPS_DATA* psu_led_ops_data=NULL; +LED_OPS_DATA diag_led_ops_data[1]= {0}; +LED_OPS_DATA fan_led_ops_data[1]= {0}; +LED_OPS_DATA loc_led_ops_data[1]= {0}; +LED_OPS_DATA* fantray_led_ops_data=NULL; +LED_OPS_DATA temp_data={0}; +LED_OPS_DATA* dev_list[LED_TYPE_MAX] = { + sys_led_ops_data, + NULL, + fan_led_ops_data, + NULL, + diag_led_ops_data, + loc_led_ops_data, +}; +int num_psus = 0; +int num_fantrays = 0; + +extern int board_i2c_cpld_read(unsigned short cpld_addr, u8 reg); +extern int board_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); +extern ssize_t show_pddf_data(struct device *dev, struct device_attribute *da, char *buf); +extern ssize_t store_pddf_data(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +extern void *get_device_table(char *name); + +static LED_STATUS find_state_index(const char* state_str) { + int index; + char *ptr = (char *)state_str; + while (*ptr && *ptr!= '\n' && *ptr !='\0') ptr++; + *ptr='\0'; + for ( index = 0; index < MAX_LED_STATUS; index++) { + /*int rc = strcmp(state_str, LED_STATUS_STR[index]) ;*/ + if (strcmp(state_str, LED_STATUS_STR[index]) == 0 ) { + return index; + } + } + return MAX_LED_STATUS; +} + +static LED_TYPE get_dev_type(char* name) +{ + LED_TYPE ret = LED_TYPE_MAX; + if(strcasecmp(name, "SYS_LED")==0) { + ret = LED_SYS; + } else if(strcasecmp(name, "FAN_LED")==0) { + ret = LED_FAN; + } else if(strstr(name, "PSU_LED")) { + ret = LED_PSU; + } else if(strcasecmp(name, "DIAG_LED")==0) { + ret = LED_DIAG; + } else if(strcasecmp(name, "LOC_LED")==0) { + ret = LED_LOC; + } else if(strstr(name, "FANTRAY_LED")) { + ret = LED_FANTRAY; + } +#if DEBUG > 1 + pddf_dbg(LED, KERN_INFO "LED get_dev_type: %s; %d\n", name, ret); +#endif + return (ret); +} +static int dev_index_check(LED_TYPE type, int index) +{ +#if DEBUG + pddf_dbg(LED, "dev_index_check: type:%s index:%d num_psus:%d num_fantrays:%d\n", + LED_TYPE_STR[type], index, num_psus, num_fantrays); +#endif + switch(type) + { + case LED_PSU: + if(index >= num_psus) return (-1); + break; + case LED_FANTRAY: + if(index >= num_fantrays) return (-1); + break; + default: + if(index >= 1) return (-1); + break; + } + return (0); +} + +static LED_OPS_DATA* find_led_ops_data(struct device_attribute *da) +{ + struct pddf_data_attribute *_ptr = (struct pddf_data_attribute *)da; + LED_OPS_DATA* ptr=(LED_OPS_DATA*)_ptr->addr; + LED_TYPE led_type; + if(!ptr || strlen(ptr->device_name)==0 ) return(NULL); + + + if((led_type=get_dev_type(ptr->device_name))==LED_TYPE_MAX) { + printk(KERN_ERR "PDDF_LED ERROR *%s Unsupported Led Type\n", __func__); + return(NULL); + } + if(dev_index_check(led_type, ptr->index)==-1) { + printk(KERN_ERR "PDDF_LED ERROR %s invalid index: %d for type:%s\n", __func__, ptr->index, ptr->device_name); + return(NULL); + } +#if DEBUG > 1 + pddf_dbg(LED, "find_led_ops_data: name:%s; index=%d tempAddr:%p actualAddr:%p\n", + ptr->device_name, ptr->index, ptr, dev_list[led_type]+ptr->index); +#endif + return (dev_list[led_type]+ptr->index); +} + +static void print_led_data(LED_OPS_DATA *ptr, LED_STATUS state) +{ + int i = 0; + if(!ptr) return ; + pddf_dbg(LED, KERN_INFO "Print %s index:%d num_psus:%d num_fantrays:%d ADDR=%p\n", + ptr->device_name, ptr->index, num_psus, num_fantrays, ptr); + pddf_dbg(LED, KERN_INFO "\tindex: %d\n", ptr->index); + pddf_dbg(LED, KERN_INFO "\tcur_state: %d; %s \n", ptr->cur_state.state, ptr->cur_state.color); + for (i = 0; i< MAX_LED_STATUS; i++) { + if(ptr->data[i].swpld_addr && (i == state || state == -1)) { + pddf_dbg(LED, KERN_INFO "\t\t[%s]: addr/offset:0x%x;0x%x color:%s; value:%x; mask_bits: 0x%x; pos:%d\n", + LED_STATUS_STR[i], + ptr->data[i].swpld_addr, ptr->data[i].swpld_addr_offset, + LED_STATUS_STR[i], ptr->data[i].value, ptr->data[i].bits.mask_bits, ptr->data[i].bits.pos); + } + } +} + +int get_sys_val(LED_OPS_DATA *ops_ptr, uint32_t *sys_val) +{ + int ret; + struct i2c_client *client_ptr; + + ret = -1; + + if (ops_ptr == NULL) { + pddf_dbg(LED, KERN_ERR "ERROR %s: param is NULL\n", __func__); + return ret; + } + + if (strlen(ops_ptr->device_name) != 0 && strncmp(ops_ptr->device_name, "FANTRAY_LED", strlen("FANTRAY_LED")) == 0) { + if (ops_ptr->index % 2 == 0) { + client_ptr = (struct i2c_client *)get_device_table("FAN-CPLD-B"); + } else { + client_ptr = (struct i2c_client *)get_device_table("FAN-CPLD-A"); + } + if (client_ptr == NULL) { + pddf_dbg(LED, KERN_ERR "ERROR %s: get led color by cpld fail\n", __func__); + return ret; + } + *sys_val = i2c_smbus_read_byte_data(client_ptr, ops_ptr->swpld_addr_offset); + ret = 0; + } else { + ret = inb(ops_ptr->swpld_addr_offset); + if (ret < 0) { + pddf_dbg(LED, KERN_ERR "ERROR %s: get led color by io fail\n", __func__); + return ret; + } + *sys_val = (uint32_t)ret; + ret = 0; + } + + return ret; +} + + +ssize_t get_status_led(struct device_attribute *da) +{ + int ret=0; + struct pddf_data_attribute *_ptr = (struct pddf_data_attribute *)da; + LED_OPS_DATA* temp_data_ptr=(LED_OPS_DATA*)_ptr->addr; + LED_OPS_DATA* ops_ptr=find_led_ops_data(da); + uint32_t color_val=0, sys_val=0; + int state=0; + if (!ops_ptr) { + pddf_dbg(LED, KERN_ERR "ERROR %s: Cannot find LED Ptr", __func__); + return (-1); + } + if (ops_ptr->swpld_addr == 0x0) { + pddf_dbg(LED, KERN_ERR "ERROR %s: device: %s %d not configured\n", __func__, + temp_data_ptr->device_name, temp_data_ptr->index); + return (-1); + } + ret = get_sys_val(ops_ptr, &sys_val); + if (ret < 0) { + pddf_dbg(LED, KERN_ERR "ERROR %s: Cannot get sys val\n", __func__); + return (-1); + } + /* keep ret as old value */ + ret = 0; + + strcpy(temp_data.cur_state.color, "None"); + for (state=0; statedata[state].bits.mask_bits); + /* printk("color val %d p1 %x, p2 %x\n", color_val, ops_ptr->data[state].value, ops_ptr->data[state].bits.pos); */ + if ((color_val ^ (ops_ptr->data[state].value<data[state].bits.pos))==0) { + strcpy(temp_data.cur_state.color, LED_STATUS_STR[state]); + } + } +#if DEBUG > 1 + pddf_dbg(LED, KERN_ERR "Get : %s:%d addr/offset:0x%x; 0x%x value=0x%x [%s]\n", + ops_ptr->device_name, ops_ptr->index, + ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset, sys_val, + temp_data.cur_state.color); +#endif + + return(ret); +} + +int set_sys_val(LED_OPS_DATA *ops_ptr, uint32_t new_val) +{ + int ret; + struct i2c_client *client_ptr; + + ret = -1; + + if (ops_ptr == NULL) { + pddf_dbg(LED, KERN_ERR "ERROR %s: param is NULL\n", __func__); + return ret; + } + + if (strlen(ops_ptr->device_name) != 0 && strncmp(ops_ptr->device_name, "FANTRAY_LED", strlen("FANTRAY_LED")) == 0) { + client_ptr = NULL; + if (ops_ptr->index % 2 == 0) { + client_ptr = (struct i2c_client *)get_device_table("FAN-CPLD-B"); + } else { + client_ptr = (struct i2c_client *)get_device_table("FAN-CPLD-A"); + } + if (client_ptr == NULL) { + pddf_dbg(LED, KERN_ERR "ERROR %s: get i2c_client fail\n", __func__); + return ret; + } + ret = i2c_smbus_write_byte_data(client_ptr, ops_ptr->swpld_addr_offset, new_val); + if (ret < 0) { + pddf_dbg(LED, KERN_ERR "ERROR %s: set led color by cpld fail\n", __func__); + } + } + else { + outb(new_val, ops_ptr->swpld_addr_offset); + } + + return ret; +} + +ssize_t set_status_led(struct device_attribute *da) +{ + int ret=0; + uint32_t sys_val=0, new_val=0; + LED_STATUS cur_state = MAX_LED_STATUS; + struct pddf_data_attribute *_ptr = (struct pddf_data_attribute *)da; + LED_OPS_DATA* temp_data_ptr=(LED_OPS_DATA*)_ptr->addr; + LED_OPS_DATA* ops_ptr=find_led_ops_data(da); + char* _buf=temp_data_ptr->cur_state.color; + + if (!ops_ptr) { + pddf_dbg(LED, KERN_ERR "PDDF_LED ERROR %s: Cannot find LED Ptr", __func__); + return (-1); + } + if (ops_ptr->swpld_addr == 0x0) { + pddf_dbg(LED, KERN_ERR "PDDF_LED ERROR %s: device: %s %d not configured\n", + __func__, ops_ptr->device_name, ops_ptr->index); + return (-1); + } + pddf_dbg(LED, KERN_ERR "%s: Set [%s;%d] color[%s]\n", __func__, + temp_data_ptr->device_name, temp_data_ptr->index, + temp_data_ptr->cur_state.color); + cur_state = find_state_index(_buf); + + if (cur_state == MAX_LED_STATUS) { + pddf_dbg(LED, KERN_ERR "ERROR %s: not supported: %s\n", _buf, __func__); + return (-1); + } + + if(ops_ptr->data[cur_state].swpld_addr != 0x0) { + ret = get_sys_val(ops_ptr, &sys_val); + if (ret < 0) { + pddf_dbg(LED, KERN_ERR "ERROR %s: Cannot get sys val\n", __func__); + return (-1); + } + + new_val = (sys_val & ops_ptr->data[cur_state].bits.mask_bits) | + (ops_ptr->data[cur_state].value << ops_ptr->data[cur_state].bits.pos); + + } else { + pddf_dbg(LED, KERN_ERR "ERROR %s: %s %d state %d; %s not configured\n",__func__, + ops_ptr->device_name, ops_ptr->index, cur_state, _buf); + return (-1); + } + + ret = set_sys_val(ops_ptr, new_val); + if (ret < 0) { + pddf_dbg(LED, KERN_ERR "ERROR %s: Cannot set sys val\n", __func__); + return (-1); + } + pddf_dbg(LED, KERN_INFO "Set color:%s; 0x%x:0x%x sys_val:0x%x new_val:0x%x read:0x%x\n", + LED_STATUS_STR[cur_state], + ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset, + sys_val, new_val, + ret = board_i2c_cpld_read(ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset)); + if (ret < 0) + { + pddf_dbg(LED, KERN_ERR "PDDF_LED ERROR %s: Error %d in reading from cpld(0x%x) offset 0x%x\n", __FUNCTION__, ret, ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset); + return ret; + } + return(ret); +} + + +ssize_t show_pddf_data(struct device *dev, struct device_attribute *da, + char *buf) +{ + int ret = 0; + struct pddf_data_attribute *ptr = (struct pddf_data_attribute *)da; + switch(ptr->type) + { + case PDDF_CHAR: + ret = sprintf(buf, "%s\n", ptr->addr); + break; + case PDDF_INT_DEC: + ret = sprintf(buf, "%d\n", *(int*)(ptr->addr)); + break; + case PDDF_INT_HEX: + ret = sprintf(buf, "0x%x\n", *(int*)(ptr->addr)); + break; + case PDDF_USHORT: + ret = sprintf(buf, "0x%x\n", *(unsigned short *)(ptr->addr)); + break; + case PDDF_UINT32: + ret = sprintf(buf, "0x%x\n", *(uint32_t *)(ptr->addr)); + break; + default: + break; + } +#if DEBUG > 1 + pddf_dbg(LED, "[ READ ] DATA ATTR PTR [%s] TYPE:%d, Value:[%s]\n", + ptr->dev_attr.attr.name, ptr->type, buf); +#endif + return ret; +} + +ssize_t store_pddf_data(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int ret = 0, num = 0; + struct pddf_data_attribute *ptr = (struct pddf_data_attribute *)da; + switch(ptr->type) + { + case PDDF_CHAR: + strncpy(ptr->addr, buf, strlen(buf)-1); // to discard newline char form buf + ptr->addr[strlen(buf)-1] = '\0'; +#if DEBUG + pddf_dbg(LED, KERN_ERR "[ WRITE ] ATTR PTR [%s] PDDF_CHAR VALUE:%s\n", + ptr->dev_attr.attr.name, ptr->addr); +#endif + break; + case PDDF_INT_DEC: + ret = kstrtoint(buf,10,&num); + if (ret==0) + *(int *)(ptr->addr) = num; +#if DEBUG + pddf_dbg(LED, KERN_ERR "[ WRITE ] ATTR PTR [%s] PDDF_DEC VALUE:%d\n", + ptr->dev_attr.attr.name, *(int *)(ptr->addr)); +#endif + break; + case PDDF_INT_HEX: + ret = kstrtoint(buf,16,&num); + if (ret==0) + *(int *)(ptr->addr) = num; +#if DEBUG + pddf_dbg(LED, KERN_ERR "[ WRITE ] ATTR PTR [%s] PDDF_HEX VALUE:0x%x\n", + ptr->dev_attr.attr.name, *(int *)(ptr->addr)); +#endif + break; + case PDDF_USHORT: + ret = kstrtoint(buf,16,&num); + if (ret==0) + *(unsigned short *)(ptr->addr) = (unsigned short)num; +#if DEBUG + pddf_dbg(LED, KERN_ERR "[ WRITE ] ATTR PTR [%s] PDDF_USHORT VALUE:%x\n", + ptr->dev_attr.attr.name, *(unsigned short *)(ptr->addr)); +#endif + break; + case PDDF_UINT32: + ret = kstrtoint(buf,16,&num); + if (ret==0) + *(uint32_t *)(ptr->addr) = (uint32_t)num; +#if DEBUG + pddf_dbg(LED, KERN_ERR "[ WRITE ] ATTR PTR [%s] PDDF_UINT32 VALUE:%d\n", + ptr->dev_attr.attr.name, *(uint32_t *)(ptr->addr)); +#endif + break; + default: + break; + } + return count; +} + +static int load_led_ops_data(struct device_attribute *da, LED_STATUS state) +{ + struct pddf_data_attribute *_ptr = (struct pddf_data_attribute *)da; + LED_OPS_DATA* ptr=(LED_OPS_DATA*)_ptr->addr; + LED_TYPE led_type; + LED_OPS_DATA* ops_ptr=NULL; + if(!ptr || strlen(ptr->device_name)==0 ) { + pddf_dbg(LED, KERN_INFO "SYSTEM_LED: load_led_ops_data return -1 device_name:%s\n", ptr? ptr->device_name:"NULL"); + return(-1); + } + if(ptr->device_name) + { + pddf_dbg(LED, KERN_INFO "[%s]: load_led_ops_data: index=%d addr=0x%x;0x%x valu=0x%x\n", + ptr->device_name, ptr->index, ptr->swpld_addr, ptr->swpld_addr_offset, ptr->data[0].value); + } + if((led_type=get_dev_type(ptr->device_name))==LED_TYPE_MAX) { + pddf_dbg(LED, KERN_ERR "PDDF_LED ERROR *%s Unsupported Led Type\n", __func__); + return(-1); + } + if(dev_index_check(led_type, ptr->index)==-1) { + pddf_dbg(LED, KERN_ERR "PDDF_LED ERROR %s invalid index: %d for type:%d\n", __func__, ptr->index, led_type); + return(-1); + } + ops_ptr = dev_list[led_type]+ptr->index; + + memcpy(ops_ptr->device_name, ptr->device_name, sizeof(ops_ptr->device_name)); + ops_ptr->index = ptr->index; + memcpy(&ops_ptr->data[state], &ptr->data[0], sizeof(LED_DATA)); + ops_ptr->data[state].swpld_addr = ptr->swpld_addr; + ops_ptr->data[state].swpld_addr_offset = ptr->swpld_addr_offset; + ops_ptr->swpld_addr = ptr->swpld_addr; + ops_ptr->swpld_addr_offset = ptr->swpld_addr_offset; + + print_led_data(dev_list[led_type]+ptr->index, state); + + memset(ptr, 0, sizeof(LED_OPS_DATA)); + return (0); +} + +static int show_led_ops_data(struct device_attribute *da) +{ + LED_OPS_DATA* ops_ptr=find_led_ops_data(da); + print_led_data(ops_ptr, -1); + return(0); +} + +static int verify_led_ops_data(struct device_attribute *da) +{ + struct pddf_data_attribute *_ptr = (struct pddf_data_attribute *)da; + LED_OPS_DATA* ptr=(LED_OPS_DATA*)_ptr->addr; + LED_OPS_DATA* ops_ptr=find_led_ops_data(da); + + if(ops_ptr) + memcpy(ptr, ops_ptr, sizeof(LED_OPS_DATA)); + else + { + pddf_dbg(LED, "SYSTEM_LED: verify_led_ops_data: Failed to find ops_ptr name:%s; index=%d\n", ptr->device_name, ptr->index); + } + return (0); +} + + +ssize_t dev_operation(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ +#if DEBUG + pddf_dbg(LED, KERN_INFO "dev_operation [%s]\n", buf); +#endif + if(strstr(buf, "STATUS_LED_COLOR")!= NULL) { + LED_STATUS index = find_state_index(buf); + if (index < MAX_LED_STATUS ) { + load_led_ops_data(da, index); + } else { + printk(KERN_ERR "PDDF_ERROR %s: Invalid state for dev_ops %s", __FUNCTION__, buf); + } + } + else if(strncmp(buf, "show", strlen("show"))==0 ) { + show_led_ops_data(da); + } + else if(strncmp(buf, "verify", strlen("verify"))==0 ) { + verify_led_ops_data(da); + } + else if(strncmp(buf, "get_status", strlen("get_status"))==0 ) { + get_status_led(da); + } + else if(strncmp(buf, "set_status", strlen("set_status"))==0 ) { + set_status_led(da); + } + else { + printk(KERN_ERR "PDDF_ERROR %s: Invalid value for dev_ops %s", __FUNCTION__, buf); + } + return(count); +} + +ssize_t store_config_data(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int ret, num; + struct pddf_data_attribute *ptr = (struct pddf_data_attribute *)da; + if(strncmp(ptr->dev_attr.attr.name, "num_psus", strlen("num_psus"))==0 ) { + ret = kstrtoint(buf,10,&num); + if (ret==0) + *(int *)(ptr->addr) = num; + if(psu_led_ops_data == NULL) { + if ((psu_led_ops_data = kzalloc(num * sizeof(LED_OPS_DATA), GFP_KERNEL)) == NULL) { + printk(KERN_ERR "PDDF_LED ERROR failed to allocate memory for PSU LED\n"); + return (count); + } + pddf_dbg(LED, "Allocate PSU LED Memory ADDR=%p\n", psu_led_ops_data); + dev_list[LED_PSU]=psu_led_ops_data; + } +#if DEBUG + pddf_dbg(LED, "[ WRITE ] ATTR CONFIG [%s] VALUE:%d; %d\n", + ptr->dev_attr.attr.name, num, num_psus); +#endif + return(count); + } + if(strncmp(ptr->dev_attr.attr.name, "num_fantrays", strlen("num_fantrays"))==0 ) { + ret = kstrtoint(buf,10,&num); + if (ret==0) + *(int *)(ptr->addr) = num; + if (fantray_led_ops_data == NULL) { + if ((fantray_led_ops_data = kzalloc(num * sizeof(LED_OPS_DATA), GFP_KERNEL)) == NULL) { + printk(KERN_ERR "PDDF_LED ERROR failed to allocate memory for FANTRAY LED\n"); + return (count); + } + pddf_dbg(LED, "Allocate FanTray LED Memory ADDR=%p\n", fantray_led_ops_data); + dev_list[LED_FANTRAY]=fantray_led_ops_data; + } +#if DEBUG + pddf_dbg(LED, "[ WRITE ] ATTR CONFIG [%s] VALUE:%d; %d\n", + ptr->dev_attr.attr.name, num, num_fantrays); +#endif + return(count); + } + return (count); +} + +ssize_t store_bits_data(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int len = 0, num1 = 0, num2 = 0, i=0, rc1=0, rc2=0; + char mask=0xFF; + char *pptr=NULL; + char bits[NAME_SIZE]; + struct pddf_data_attribute *ptr = (struct pddf_data_attribute *)da; + MASK_BITS* bits_ptr=(MASK_BITS*)(ptr->addr); + strncpy(bits_ptr->bits, buf, strlen(buf)-1); // to discard newline char form buf + bits_ptr->bits[strlen(buf)-1] = '\0'; + if((pptr=strstr(buf,":")) != NULL) { + len=pptr-buf; + sprintf(bits, buf); + bits[len]='\0'; + rc1=kstrtoint(bits,16,&num1); + if (rc1==0) + { + sprintf(bits, ++pptr); + rc2=kstrtoint(bits,16,&num2); + if (rc2==0) + { + for (i=num2; i<=num1; i++) { + mask &= ~(1 << i); + } + bits_ptr->mask_bits = mask; + bits_ptr->pos = num2; + } + } + } else { + rc1=kstrtoint(buf,16,&num1); + if (rc1==0) + { + bits_ptr->mask_bits = mask & ~(1 << num1); + bits_ptr->pos = num1; + } + } +#if DEBUG + pddf_dbg(LED, KERN_ERR "[ WRITE ] ATTR PTR Bits [%s] VALUE:%s mask:0x%x; pos:0x%x\n", + ptr->dev_attr.attr.name, bits_ptr->bits, bits_ptr->mask_bits, bits_ptr->pos); +#endif + return (count); +} + +/************************************************************************** + * platform/ attributes + **************************************************************************/ +PDDF_LED_DATA_ATTR(platform, num_psus, S_IWUSR|S_IRUGO, show_pddf_data, + store_config_data, PDDF_INT_DEC, sizeof(int), (void*)&num_psus); +PDDF_LED_DATA_ATTR(platform, num_fantrays, S_IWUSR|S_IRUGO, show_pddf_data, + store_config_data, PDDF_INT_DEC, sizeof(int), (void*)&num_fantrays); + +struct attribute* attrs_platform[]={ + &pddf_dev_platform_attr_num_psus.dev_attr.attr, + &pddf_dev_platform_attr_num_fantrays.dev_attr.attr, + NULL, +}; +struct attribute_group attr_group_platform={ + .attrs = attrs_platform, +}; + +/************************************************************************** + * led/ attributes + **************************************************************************/ +PDDF_LED_DATA_ATTR(dev, device_name, S_IWUSR|S_IRUGO, show_pddf_data, + store_pddf_data, PDDF_CHAR, NAME_SIZE, (void*)&temp_data.device_name); +PDDF_LED_DATA_ATTR(dev, index, S_IWUSR|S_IRUGO, show_pddf_data, + store_pddf_data, PDDF_INT_DEC, sizeof(int), (void*)&temp_data.index); +PDDF_LED_DATA_ATTR(dev, swpld_addr, S_IWUSR|S_IRUGO, show_pddf_data, + store_pddf_data, PDDF_INT_HEX, sizeof(int), (void*)&temp_data.swpld_addr); +PDDF_LED_DATA_ATTR(dev, swpld_addr_offset, S_IWUSR|S_IRUGO, show_pddf_data, + store_pddf_data, PDDF_INT_HEX, sizeof(int), (void*)&temp_data.swpld_addr_offset); +PDDF_LED_DATA_ATTR(dev, dev_ops , S_IWUSR, NULL, + dev_operation, PDDF_CHAR, NAME_SIZE, (void*)&temp_data); + +struct attribute* attrs_dev[]={ + &pddf_dev_dev_attr_device_name.dev_attr.attr, + &pddf_dev_dev_attr_index.dev_attr.attr, + &pddf_dev_dev_attr_swpld_addr.dev_attr.attr, + &pddf_dev_dev_attr_swpld_addr_offset.dev_attr.attr, + &pddf_dev_dev_attr_dev_ops.dev_attr.attr, + NULL, +}; +struct attribute_group attr_group_dev={ + .attrs = attrs_dev, +}; + +/************************************************************************** + * state_attr/ attributes + **************************************************************************/ +#define LED_DEV_STATE_ATTR_GROUP(name, func) \ + PDDF_LED_DATA_ATTR(name, bits, S_IWUSR|S_IRUGO, show_pddf_data, \ + store_bits_data, PDDF_CHAR, NAME_SIZE, func.bits.bits); \ + PDDF_LED_DATA_ATTR(name, value, S_IWUSR|S_IRUGO, show_pddf_data, \ + store_pddf_data, PDDF_USHORT, sizeof(unsigned short), func.value); \ + struct attribute* attrs_##name[]={ \ + &pddf_dev_##name##_attr_bits.dev_attr.attr, \ + &pddf_dev_##name##_attr_value.dev_attr.attr, \ + NULL, \ + }; \ + struct attribute_group attr_group_##name={ \ + .attrs = attrs_##name, \ + }; \ + + +LED_DEV_STATE_ATTR_GROUP(state_attr, (void*)&temp_data.data[0]) + + /************************************************************************** + * cur_state/ attributes + **************************************************************************/ + PDDF_LED_DATA_ATTR(cur_state, color, S_IWUSR|S_IRUGO, show_pddf_data, + store_pddf_data, PDDF_CHAR, NAME_SIZE, (void*)&temp_data.cur_state.color); + +struct attribute* attrs_cur_state[]={ + &pddf_dev_cur_state_attr_color.dev_attr.attr, + NULL, +}; +struct attribute_group attr_group_cur_state={ + .attrs = attrs_cur_state, +}; + +/*************************************************************************/ +#define KOBJ_FREE(obj) \ + if(obj) kobject_put(obj); \ + +void free_kobjs(void) +{ + KOBJ_FREE(cur_state_kobj) + KOBJ_FREE(state_attr_kobj) + KOBJ_FREE(led_kobj) + KOBJ_FREE(platform_kobj) +} + +int KBOJ_CREATE(char* name, struct kobject* parent, struct kobject** child) +{ + if (parent) { + *child = kobject_create_and_add(name, parent); + } else { + printk(KERN_ERR "PDDF_LED ERROR to create %s kobj; null parent\n", name); + free_kobjs(); + return (-ENOMEM); + } + return (0); +} + +int LED_DEV_ATTR_CREATE(struct kobject *kobj, const struct attribute_group *attr, const char* name) +{ + int status = sysfs_create_group(kobj, attr); + if(status) { + pddf_dbg(LED, KERN_ERR "Driver ERROR: sysfs_create %s failed rc=%d\n", name, status); + } + return (status); +} + + +static int __init led_init(void) { + struct kobject *device_kobj; + pddf_dbg(LED, KERN_INFO "PDDF GENERIC LED MODULE init..\n"); + + device_kobj = get_device_i2c_kobj(); + if(!device_kobj) + return -ENOMEM; + + KBOJ_CREATE("platform", device_kobj, &platform_kobj); + KBOJ_CREATE("led", device_kobj, &led_kobj); + KBOJ_CREATE("state_attr", led_kobj, &state_attr_kobj); + KBOJ_CREATE("cur_state", led_kobj, &cur_state_kobj); + + LED_DEV_ATTR_CREATE(platform_kobj, &attr_group_platform, "attr_group_platform"); + LED_DEV_ATTR_CREATE(led_kobj, &attr_group_dev, "attr_group_dev"); + LED_DEV_ATTR_CREATE(state_attr_kobj, &attr_group_state_attr, "attr_group_state_attr"); + LED_DEV_ATTR_CREATE(cur_state_kobj, &attr_group_cur_state, "attr_group_cur_state"); + return (0); +} + + +static void __exit led_exit(void) { + pddf_dbg(LED, "PDDF GENERIC LED MODULE exit..\n"); + free_kobjs(); + if(psu_led_ops_data) kfree(psu_led_ops_data); + if(fantray_led_ops_data) kfree(fantray_led_ops_data); +} + +module_init(led_init); +module_exit(led_exit); + +MODULE_AUTHOR("Broadcom"); +MODULE_DESCRIPTION("led driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/pddf_custom_psu.c b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/pddf_custom_psu.c new file mode 100644 index 000000000000..d061bf1ad079 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/pddf_custom_psu.c @@ -0,0 +1,320 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../../../../../pddf/i2c/modules/include/pddf_psu_defs.h" +#include "../../../../../pddf/i2c/modules/include/pddf_psu_driver.h" +#include "../../../common/modules/pmbus.h" + +int pddf_custom_psu_present(void *client, PSU_DATA_ATTR *adata, void *data); +long pmbus_reg2data_liner(void *client, int data, int class); +int pddf_custom_psu_power_good(void *client, PSU_DATA_ATTR *adata, void *data); +int smbus_read_byte(struct i2c_client *client, uint8_t offset); +ssize_t pddf_psu_custom_show(struct device *dev, struct device_attribute *da, char *buf); + +extern void *get_device_table(char *name); +extern PSU_SYSFS_ATTR_DATA access_psu_present; +extern PSU_SYSFS_ATTR_DATA access_psu_power_good; +extern PSU_SYSFS_ATTR_DATA access_psu_v_out; + +int pddf_custom_psu_present(void *client, PSU_DATA_ATTR *adata, void *data) +{ + int ret; + struct i2c_client *client_ptr; + struct psu_attr_info *padata; + + ret = -1; + client_ptr = NULL; + padata = (struct psu_attr_info *)data; + + if (strncmp(adata->devtype, "io", strlen("io")) == 0) { + ret = inb(adata->offset); + /* printk("%s read data %x\n", __FUNCTION__, ret); */ + + if (ret < 0) { + return ret; + } + + padata->val.intval = ((ret & adata->mask) == adata->cmpval); + } + + else if (strncmp(adata->devtype, "cpld", strlen("cpld")) == 0) { + client_ptr = (struct i2c_client *)get_device_table(adata->devname); + if (client_ptr) { + ret = i2c_smbus_read_byte_data(client_ptr, adata->offset); + } + + if (ret < 0) { + return ret; + } + + padata->val.intval = ((ret & adata->mask) == adata->cmpval); + } + + return 0; +} + +int pddf_custom_psu_power_good(void *client, PSU_DATA_ATTR *adata, void *data) +{ + int ret; + struct i2c_client *client_ptr; + struct psu_attr_info *padata; + + ret = -1; + client_ptr = NULL; + padata = (struct psu_attr_info *)data; + + if (strncmp(adata->devtype, "io", strlen("io")) == 0) { + ret = inb(adata->offset); + /* printk("%s read data %x\n", __FUNCTION__, ret); */ + + if (ret < 0) { + return ret; + } + + padata->val.intval = ((ret & adata->mask) == adata->cmpval); + } + + else if (strncmp(adata->devtype, "cpld", strlen("cpld")) == 0) { + client_ptr = (struct i2c_client *)get_device_table(adata->devname); + if (client_ptr) { + ret = i2c_smbus_read_byte_data(client_ptr, adata->offset); + } + + if (ret < 0) { + return ret; + } + + padata->val.intval = ((ret & adata->mask) == adata->cmpval); + } + + return 0; +} + +int smbus_read_byte(struct i2c_client *client, uint8_t offset) +{ + int retry; + int status; + + retry = 10; + while (retry) { + status = i2c_smbus_read_byte_data(client, offset); + if (unlikely(status < 0)) { + msleep(60); + retry--; + continue; + } + break; + } + + if (status < 0) { + /* TODO perror*/ + } + + return status; +} + +long pmbus_reg2data_liner(void *client, int data, int class) +{ + s16 exponent; + s32 mantissa; + long val; + int vout_mode; + + vout_mode = smbus_read_byte((struct i2c_client *)client, PMBUS_VOUT_MODE); + /* printk("%s vout mode %x\n", __FUNCTION__, vout_mode); */ + if (vout_mode < 0) { + return 0; + } + + /* LINEAR16 */ + if (class == PSC_VOLTAGE_OUT) { + /* exponent = data->exponent[sensor->page]; */ + exponent = ((s8)(vout_mode << 3)) >> 3; + mantissa = (u16) data; + } else { + /* LINEAR11 */ + exponent = ((s16)data) >> 11; + mantissa = ((s16)((data & 0x7ff) << 5)) >> 5; + } + + val = mantissa; + val = val * 1000L; + + /* scale result to micro-units for power sensors */ + if (class == PSC_POWER) { + val = val * 1000L; + } + + if (exponent >= 0) { + val <<= exponent; + } else { + val >>= -exponent; + } + + /* printk("%s class %d ex %x ma %x val %x\n", __FUNCTION__, class, exponent, mantissa, val); */ + + return val; +} + +int psu_update_attr(struct device *dev, struct psu_attr_info *data, PSU_DATA_ATTR *udata) +{ + int status; + struct i2c_client *client; + PSU_SYSFS_ATTR_DATA *sysfs_attr_data; + + status = 0; + client = to_i2c_client(dev); + sysfs_attr_data = NULL; + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || !data->valid) { + dev_dbg(&client->dev, "Starting update for %s\n", data->name); + + sysfs_attr_data = udata->access_data; + if (sysfs_attr_data->pre_get != NULL) { + status = (sysfs_attr_data->pre_get)(client, udata, data); + if (status != 0) { + printk(KERN_ERR "%s: pre_get function fails for %s attribute\n", __FUNCTION__, udata->aname); + } + } + if (sysfs_attr_data->do_get != NULL) { + status = (sysfs_attr_data->do_get)(client, udata, data); + if (status != 0) { + printk(KERN_ERR "%s: do_get function fails for %s attribute\n", __FUNCTION__, udata->aname); + } + } + if (sysfs_attr_data->post_get != NULL) { + status = (sysfs_attr_data->post_get)(client, udata, data); + if (status != 0) { + printk(KERN_ERR "%s: post_get function fails for %s attribute\n", __FUNCTION__, udata->aname); + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return 0; +} + +void get_psu_duplicate_sysfs(int idx, char *str) +{ + switch (idx) { + case PSU_V_OUT: + strcpy(str, "in3_input"); + break; + case PSU_I_OUT: + strcpy(str, "curr2_input"); + break; + case PSU_P_OUT: + strcpy(str, "power2_input"); + break; + case PSU_FAN1_SPEED: + strcpy(str, "fan1_input"); + break; + case PSU_TEMP1_INPUT: + strcpy(str, "temp1_input"); + break; + default: + break; + } + + return; +} + +ssize_t pddf_psu_custom_show(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr; + struct i2c_client *client; + struct psu_data *data; + + PSU_PDATA *pdata; + PSU_DATA_ATTR *usr_data; + PSU_SYSFS_ATTR_DATA *ptr; + struct psu_attr_info *sysfs_attr_info; + int i; + int status; + char new_str[ATTR_NAME_LEN]; + + attr = to_sensor_dev_attr(da); + client = to_i2c_client(dev); + data = i2c_get_clientdata(client); + + pdata = (PSU_PDATA *)(client->dev.platform_data); + usr_data = NULL; + ptr = NULL; + sysfs_attr_info = NULL; + status = 0; + memset(new_str, 0, ATTR_NAME_LEN); + + for (i = 0; i < data->num_attr; i++) { + ptr = (PSU_SYSFS_ATTR_DATA *)pdata->psu_attrs[i].access_data; + get_psu_duplicate_sysfs(ptr->index , new_str); + if (strcmp(attr->dev_attr.attr.name, pdata->psu_attrs[i].aname) == 0 || \ + strcmp(attr->dev_attr.attr.name, new_str) == 0 ) { + sysfs_attr_info = &data->attr_info[i]; + usr_data = &pdata->psu_attrs[i]; + /* strcpy(new_str, ""); */ + } + } + + if (sysfs_attr_info == NULL || usr_data == NULL) { + printk(KERN_ERR "%s is not supported attribute for this client\n", attr->dev_attr.attr.name); + goto exit; + } + + psu_update_attr(dev, sysfs_attr_info, usr_data); + + switch(attr->index) { + case PSU_V_OUT: + status = pmbus_reg2data_liner(client, sysfs_attr_info->val.shortval, PSC_VOLTAGE_OUT); + break; + case PSU_P_OUT: + status = pmbus_reg2data_liner(client, sysfs_attr_info->val.shortval, PSC_POWER); + break; + case PSU_I_OUT: + case PSU_V_IN: + case PSU_I_IN: + case PSU_TEMP1_INPUT: + status = pmbus_reg2data_liner(client, sysfs_attr_info->val.shortval, PSC_NUM_CLASSES); + break; + default: + printk(KERN_ERR "%s: Unable to find attribute index for %s\n", __FUNCTION__, usr_data->aname); + goto exit; + } + +exit: + return sprintf(buf, "%d\n", status); +} + +int __init pddf_custom_psu_init(void) +{ + access_psu_present.do_get = pddf_custom_psu_present; + access_psu_power_good.do_get = pddf_custom_psu_power_good; + access_psu_v_out.show = pddf_psu_custom_show; + printk(KERN_ERR "pddf_custom_psu_init\n"); + return 0; +} + +void __exit pddf_custom_psu_exit(void) +{ + printk(KERN_ERR "pddf_custom_psu_exit\n"); + return; +} + +MODULE_AUTHOR("support "); +MODULE_DESCRIPTION("pddf custom psu api"); +MODULE_LICENSE("GPL"); + +module_init(pddf_custom_psu_init); +module_exit(pddf_custom_psu_exit); + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/pddf_custom_xcvr.c b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/pddf_custom_xcvr.c new file mode 100644 index 000000000000..5aa155ce0aa8 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/pddf_custom_xcvr.c @@ -0,0 +1,77 @@ +#include +#include +#include "../../../../../pddf/i2c/modules/include/pddf_xcvr_defs.h" +#include "../../../../../pddf/i2c/modules/include/pddf_xcvr_api.h" + +extern void *get_device_table(char *name); +extern XCVR_SYSFS_ATTR_OPS xcvr_ops[]; + +int pddf_custom_xcvr_pres(struct i2c_client *client, XCVR_ATTR *info, struct xcvr_data *data); +int pddf_custom_xcvr_reset(struct i2c_client *client, XCVR_ATTR *info, struct xcvr_data *data); + +int pddf_custom_xcvr_pres(struct i2c_client *client, XCVR_ATTR *info, struct xcvr_data *data) +{ + int status; + uint32_t modpres; + + status = 0; + modpres = 0; + if (strcmp(info->devtype, "cpld") == 0 && info->devname) { + client = (struct i2c_client *)get_device_table(info->devname); + status = i2c_smbus_read_byte_data(client, info->offset); + if (status < 0) { + return status; + } else { + modpres = ((status & BIT_INDEX(info->mask)) == info->cmpval) ? 1 : 0; + /* printk(KERN_INFO "\nMod presence :0x%x, reg_value = 0x%x, devaddr=0x%x, mask=0x%x, offset=0x%x\n", modpres, status, info->devaddr, info->mask, info->offset); */ + } + } + + data->modpres = modpres; + return 0; +} + +int pddf_custom_xcvr_reset(struct i2c_client *client, XCVR_ATTR *info, struct xcvr_data *data) +{ + int status; + uint32_t modreset; + + status = 0; + modreset = 0; + if (strcmp(info->devtype, "cpld") == 0 && info->devname) { + client = (struct i2c_client *)get_device_table(info->devname); + status = i2c_smbus_read_byte_data(client, info->offset); + if (status < 0) { + return status; + } else { + modreset = ((status & BIT_INDEX(info->mask)) == info->cmpval) ? 1 : 0; + /* printk(KERN_INFO "\nMod Reset :0x%x, reg_value = 0x%x\n", modreset, status); */ + } + } + + data->reset = modreset; + return 0; +} + +int __init pddf_custom_xcvr_init(void) +{ + xcvr_ops[0].do_get = pddf_custom_xcvr_pres; + xcvr_ops[1].do_get = pddf_custom_xcvr_reset; + + printk(KERN_ERR "pddf_custom_xcvr_init\n"); + return 0; +} + +void __exit pddf_custom_xcvr_exit(void) +{ + printk(KERN_ERR "pddf_custom_xcvr_exit\n"); + return; +} + +MODULE_AUTHOR("support "); +MODULE_DESCRIPTION("pddf custom xcvr api"); +MODULE_LICENSE("GPL"); + +module_init(pddf_custom_xcvr_init); +module_exit(pddf_custom_xcvr_exit); + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/ragile.h b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/ragile.h new file mode 100755 index 000000000000..72e0907a9160 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/ragile.h @@ -0,0 +1,117 @@ +#ifndef __RAGILE_H__ +#define __RAGILE_H__ + +#include +#include + +/* debgu level */ +typedef enum { + DBG_START, + DBG_VERBOSE, + DBG_KEY, + DBG_WARN, + DBG_ERROR, + DBG_END, +} dbg_level_t; + +typedef enum dfd_cpld_id { + BCM_CPLD0 = 0, + BCM_CPLD1, + CPLD0_MAC0, + CPLD0_MAC1, + CPLD1_MAC0, + CPLD2_MAC1, +} dfd_cpld_id_t; + + typedef enum dfd_cpld_bus { + SMBUS_BUS = 0 , + PCA9641_BUS = 1, + GPIO_BUS = 2, +} dfd_cpld_bus_t; + + typedef struct dfd_i2c_dev_s { + int bus; + int addr; + } dfd_i2c_dev_t; + + typedef enum dfd_cpld_addr { + CPLD_ADDR_MIN = 0x31, + BCM_CPLD0_ADDR = 0x32, + CPLD0_MAC0_ADDR = 0x33, + CPLD0_MAC1_ADDR = 0x34, + CPLD1_MAC0_ADDR = 0x35, + CPLD2_MAC1_ADDR = 0x36, + BCM_CPLD1_ADDR = 0x37, + CPLD_ADDR_MAX, +} dfd_cpld_addr_t; + +typedef struct dfd_dev_head_info_s { + uint8_t ver; + uint8_t flag; + uint8_t hw_ver; + uint8_t type; + int16_t tlv_len; +} dfd_dev_head_info_t; + +typedef enum dfd_intf_e{ + DFD_INTF_GET_FAN_HW_VERSION, + DFD_INTF_GET_FAN_STATUS, + DFD_INTF_GET_FAN_SPEED_LEVEL, + DFD_INTF_GET_FAN_SPEED, + DFD_INTF_GET_FAN_ATTRIBUTE, + DFD_INTF_GET_FAN_SN, + DFD_INTF_GET_FAN_TYPE, + DFD_INTF_SET_FAN_SPEED_LEVEL, + DFD_INTF_GET_FAN_SUB_NUM, + DFD_INTF_GET_FAN_FAIL_BITMAP, +}dfd_intf_t; + +typedef struct dfd_dev_tlv_info_s { + uint8_t type; + uint8_t len; + uint8_t data[0]; +} dfd_dev_tlv_info_t; + +typedef enum dfd_dev_info_type_e { + DFD_DEV_INFO_TYPE_MAC = 1, + DFD_DEV_INFO_TYPE_NAME = 2, + DFD_DEV_INFO_TYPE_SN = 3, + DFD_DEV_INFO_TYPE_PWR_CONS = 4, + DFD_DEV_INFO_TYPE_HW_INFO = 5, + DFD_DEV_INFO_TYPE_DEV_TYPE = 6, +} dfd_dev_tlv_type_t; + +typedef struct i2c_muxs_struct_flag +{ + int nr; + char name[48]; + struct mutex update_lock; + int flag; +}i2c_mux_flag; + +extern int setpca9641_muxflag(i2c_mux_flag i2c); +extern i2c_mux_flag getpca9641_muxflag(void) ; + +extern int debuglevel; +extern int dfd_cpld_read_chipid(int cpldid , uint32_t addr, int32_t size, unsigned char *buf); +extern int dfd_cpld_read(int32_t addr, uint8_t *val); +extern int dfd_cpld_write(int32_t addr, uint8_t val); +extern int ragile_setdebug(int val); + +#define DBG_DEBUG(fmt, arg...) do { \ + if ( debuglevel > DBG_START && debuglevel < DBG_ERROR) { \ + printk(KERN_INFO "[DEBUG]:<%s, %d>:"fmt, __FUNCTION__, __LINE__, ##arg); \ + } else if ( debuglevel >= DBG_ERROR ) { \ + printk(KERN_ERR "[DEBUG]:<%s, %d>:"fmt, __FUNCTION__, __LINE__, ##arg); \ + } else { } \ +} while (0) + +#define DBG_ERROR(fmt, arg...) do { \ + if ( debuglevel > DBG_START) { \ + printk(KERN_ERR "[ERROR]:<%s, %d>:"fmt, __FUNCTION__, __LINE__, ##arg); \ + } \ + } while (0) + +#define COMMON_STR_LEN (256) + +#endif diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/rg_cpld.c b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/rg_cpld.c new file mode 100644 index 000000000000..7d9fc82a6933 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/rg_cpld.c @@ -0,0 +1,559 @@ +/* + * rg_cpld.c - A driver for control rg_cpld base on rg_cpld.c + * + * Copyright (c) 1998, 1999 Frodo Looijaard + * Copyright (c) 2018 support + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/* debug level */ +typedef enum { + DBG_START, + DBG_VERBOSE, + DBG_KEY, + DBG_WARN, + DBG_ERROR, + DBG_END, +} dbg_level_t; + +static int debuglevel=0; +module_param(debuglevel, int, S_IRUGO); + +#define DBG_DEBUG(fmt, arg...) do { \ + if ( debuglevel > DBG_START && debuglevel < DBG_ERROR) { \ + printk(KERN_INFO "[DEBUG]:<%s, %d>:"fmt, __FUNCTION__, __LINE__, ##arg); \ + } else if ( debuglevel >= DBG_ERROR ) { \ + printk(KERN_ERR "[DEBUG]:<%s, %d>:"fmt, __FUNCTION__, __LINE__, ##arg); \ + } else { } \ +} while (0) + +#define DBG_ERROR(fmt, arg...) do { \ + if ( debuglevel > DBG_START) { \ + printk(KERN_ERR "[ERROR]:<%s, %d>:"fmt, __FUNCTION__, __LINE__, ##arg); \ + } \ + } while (0) + +static const unsigned short rg_i2c_cpld[] = { 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, I2C_CLIENT_END }; + +#define CPLD_SIZE 256 +#define CPLD_I2C_RETRY_TIMES 3 +#define COMMON_STR_LEN (256) + +struct cpld_data { + struct i2c_client *client; + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 data[CPLD_SIZE]; /* Register value */ +}; + +static s32 cpld_i2c_smbus_read_byte_data(const struct i2c_client *client, u8 command) +{ + int try; + s32 ret; + + ret = -1; + for (try = 0; try < CPLD_I2C_RETRY_TIMES; try++) { + if ((ret = i2c_smbus_read_byte_data(client, command) ) >= 0 ) + break; + } + return ret; +} + +static s32 cpld_i2c_smbus_read_i2c_block_data(const struct i2c_client *client, + u8 command, u8 length, u8 *values) +{ + int try; + s32 ret; + + ret = -1; + for (try = 0; try < CPLD_I2C_RETRY_TIMES; try++) { + if ((ret = i2c_smbus_read_i2c_block_data(client, command, length, values) ) >= 0 ) + break; + } + return ret; +} + +static ssize_t show_fan_rpm_value(struct device *dev, struct device_attribute *da, char *buf) +{ + struct cpld_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->client; + int index = to_sensor_dev_attr_2(da)->index; + uint8_t size; + s32 status; + s32 ret_t; + u8 tmp[2]; + + ret_t = 0; + status = -1; + size = 0; + memset(tmp, 0, sizeof(tmp)); + + mutex_lock(&data->update_lock); + status = cpld_i2c_smbus_read_byte_data(client, index); + if (status < 0) { + mutex_unlock(&data->update_lock); + return 0; + } + tmp[0] = status; + status = cpld_i2c_smbus_read_byte_data(client, index + 1); + if (status < 0) { + mutex_unlock(&data->update_lock); + return 0; + } + tmp[1] = status; + DBG_DEBUG("cpld reg pos:0x%x value:0x%x\n", index, tmp[0]); + DBG_DEBUG("cpld reg pos:0x%x value:0x%x\n", index + 1, tmp[1]); + ret_t = (tmp[1] << 8) + tmp[0]; + if (ret_t == 0 ) { + size = snprintf(buf, CPLD_SIZE, "%d\n", ret_t); + } else if (ret_t == 0xffff) { + size = snprintf(buf, CPLD_SIZE, "%d\n", 0); + } else { + size = snprintf(buf, CPLD_SIZE, "%d\n", 15000000 / ret_t); + } + mutex_unlock(&data->update_lock); + return size; +} + +static ssize_t set_cpld_sysfs_value(struct device *dev, struct device_attribute *da, const char *buf, size_t +count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + unsigned long val; + int err; + + err = kstrtoul(buf, 16, &val); + if (err) + return err; + if ((val < 0) || (val > 0xff)) { + DBG_ERROR("please enter 0x00 ~ 0xff\n"); + return -1; + } + mutex_lock(&data->update_lock); + val = (u8)val; + DBG_DEBUG("pos: 0x%02x count = %ld, data = 0x%02x\n", attr->index, count, val); + i2c_smbus_write_byte_data(client, attr->index, val); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_cpld_version(struct device *dev, struct device_attribute *da, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + s32 status; + u8 tmp[4]; + + memset(tmp, 0, sizeof(tmp)); + status = -1; + mutex_lock(&data->update_lock); + status = cpld_i2c_smbus_read_i2c_block_data(client, 0, 4, tmp); + if (status < 0) { + mutex_unlock(&data->update_lock); + return 0; + } + mutex_unlock(&data->update_lock); + return snprintf(buf, COMMON_STR_LEN, "%02x %02x %02x %02x \n", tmp[0], tmp[1], tmp[2], tmp[3]); +} + +static ssize_t show_cpld_sysfs_value(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + s32 status; + + status = -1; + mutex_lock(&data->update_lock); + status = cpld_i2c_smbus_read_byte_data(client, attr->index); + if (status < 0) { + mutex_unlock(&data->update_lock); + return 0; + } + DBG_DEBUG("cpld reg pos:0x%x value:0x%02x\n", attr->index, status); + mutex_unlock(&data->update_lock); + return snprintf(buf, COMMON_STR_LEN, "%02x\n", status); +} + +/* common */ +static SENSOR_DEVICE_ATTR(cpld_version, S_IRUGO | S_IWUSR, show_cpld_version, NULL, 0); +static SENSOR_DEVICE_ATTR(cpld_card_id, S_IRUGO, show_cpld_sysfs_value, NULL, 0x04); +static SENSOR_DEVICE_ATTR(cpld_card_index, S_IRUGO, show_cpld_sysfs_value, NULL, 0x05); + +/* FAN speed rpm */ +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO | S_IWUSR ,show_fan_rpm_value, NULL, 0x1B); +static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO | S_IWUSR ,show_fan_rpm_value, NULL, 0x1D); +static SENSOR_DEVICE_ATTR(fan9_input, S_IRUGO | S_IWUSR ,show_fan_rpm_value, NULL, 0x1F); +static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO | S_IWUSR ,show_fan_rpm_value, NULL, 0x25); +static SENSOR_DEVICE_ATTR(fan6_input, S_IRUGO | S_IWUSR ,show_fan_rpm_value, NULL, 0x27); +static SENSOR_DEVICE_ATTR(fan10_input, S_IRUGO | S_IWUSR ,show_fan_rpm_value, NULL, 0x29); + +static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO | S_IWUSR ,show_fan_rpm_value, NULL, 0x1B); +static SENSOR_DEVICE_ATTR(fan7_input, S_IRUGO | S_IWUSR ,show_fan_rpm_value, NULL, 0x1D); +static SENSOR_DEVICE_ATTR(fan11_input, S_IRUGO | S_IWUSR ,show_fan_rpm_value, NULL, 0x1F); +static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO | S_IWUSR ,show_fan_rpm_value, NULL, 0x25); +static SENSOR_DEVICE_ATTR(fan8_input, S_IRUGO | S_IWUSR ,show_fan_rpm_value, NULL, 0x27); +static SENSOR_DEVICE_ATTR(fan12_input, S_IRUGO | S_IWUSR ,show_fan_rpm_value, NULL, 0x29); + +/*FAN speed */ +static SENSOR_DEVICE_ATTR(fan1_speed_set, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x14); +static SENSOR_DEVICE_ATTR(fan2_speed_set, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x14); +static SENSOR_DEVICE_ATTR(fan3_speed_set, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x15); +static SENSOR_DEVICE_ATTR(fan4_speed_set, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x15); +static SENSOR_DEVICE_ATTR(fan5_speed_set, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x16); +static SENSOR_DEVICE_ATTR(fan6_speed_set, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x16); + +static SENSOR_DEVICE_ATTR(fan1_1_real_speed, S_IRUGO, show_fan_rpm_value, NULL, 0x1B); +static SENSOR_DEVICE_ATTR(fan2_1_real_speed, S_IRUGO, show_fan_rpm_value, NULL, 0x1B); +static SENSOR_DEVICE_ATTR(fan3_1_real_speed, S_IRUGO, show_fan_rpm_value, NULL, 0x1D); +static SENSOR_DEVICE_ATTR(fan4_1_real_speed, S_IRUGO, show_fan_rpm_value, NULL, 0x1D); +static SENSOR_DEVICE_ATTR(fan5_1_real_speed, S_IRUGO, show_fan_rpm_value, NULL, 0x1F); +static SENSOR_DEVICE_ATTR(fan6_1_real_speed, S_IRUGO, show_fan_rpm_value, NULL, 0x1F); +static SENSOR_DEVICE_ATTR(fan1_2_real_speed, S_IRUGO, show_fan_rpm_value, NULL, 0x25); +static SENSOR_DEVICE_ATTR(fan2_2_real_speed, S_IRUGO, show_fan_rpm_value, NULL, 0x25); +static SENSOR_DEVICE_ATTR(fan3_2_real_speed, S_IRUGO, show_fan_rpm_value, NULL, 0x27); +static SENSOR_DEVICE_ATTR(fan4_2_real_speed, S_IRUGO, show_fan_rpm_value, NULL, 0x27); +static SENSOR_DEVICE_ATTR(fan5_2_real_speed, S_IRUGO, show_fan_rpm_value, NULL, 0x29); +static SENSOR_DEVICE_ATTR(fan6_2_real_speed, S_IRUGO, show_fan_rpm_value, NULL, 0x29); + +/*FAN led register */ +static SENSOR_DEVICE_ATTR(fan1_led, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x3B); +static SENSOR_DEVICE_ATTR(fan2_led, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x3B); +static SENSOR_DEVICE_ATTR(fan3_led, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x3C); +static SENSOR_DEVICE_ATTR(fan4_led, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x3C); +static SENSOR_DEVICE_ATTR(fan5_led, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x3D); +static SENSOR_DEVICE_ATTR(fan6_led, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x3D); +static SENSOR_DEVICE_ATTR(fan_led_control, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x40); + +/* FAN present */ +static SENSOR_DEVICE_ATTR(fan_present, S_IRUGO, show_cpld_sysfs_value, NULL, 0x30); + +/* FAN status */ +static SENSOR_DEVICE_ATTR(fan_status1, S_IRUGO, show_cpld_sysfs_value, NULL, 0x31); +static SENSOR_DEVICE_ATTR(fan_status2, S_IRUGO, show_cpld_sysfs_value, NULL, 0x34); + +/* 0x30 */ +/* sfp 1-16 present register */ +static SENSOR_DEVICE_ATTR(sfp_presence1, S_IRUGO, show_cpld_sysfs_value, NULL, 0x10); +static SENSOR_DEVICE_ATTR(sfp_presence2, S_IRUGO, show_cpld_sysfs_value, NULL, 0x11); + +/* sfp 1-16 led register */ +static SENSOR_DEVICE_ATTR(sfp_led1, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x18); +static SENSOR_DEVICE_ATTR(sfp_led2, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x19); +static SENSOR_DEVICE_ATTR(sfp_led_reset, S_IRUGO | S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0xa0); + + +/* 0x31*/ +/* sfp 17-32 present register */ +static SENSOR_DEVICE_ATTR(sfp_presence3, S_IRUGO, show_cpld_sysfs_value, NULL, 0x10); +static SENSOR_DEVICE_ATTR(sfp_presence4, S_IRUGO, show_cpld_sysfs_value, NULL, 0x11); + +/* sfp 17-32 led register */ +static SENSOR_DEVICE_ATTR(sfp_led3, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, set_cpld_sysfs_value, 0x18); +static SENSOR_DEVICE_ATTR(sfp_led4, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, set_cpld_sysfs_value, 0x19); + +static SENSOR_DEVICE_ATTR(sfp_reset1, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, set_cpld_sysfs_value, 0x14); +static SENSOR_DEVICE_ATTR(sfp_reset2, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, set_cpld_sysfs_value, 0x15); +static SENSOR_DEVICE_ATTR(sfp_reset3, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, set_cpld_sysfs_value, 0x14); +static SENSOR_DEVICE_ATTR(sfp_reset4, S_IRUGO | S_IWUSR ,show_cpld_sysfs_value, set_cpld_sysfs_value, 0x15); + + +static struct attribute *cpld_bus14_addr_0x0d_sysfs_attrs[] = { + &sensor_dev_attr_cpld_version.dev_attr.attr, + &sensor_dev_attr_cpld_card_id.dev_attr.attr, + &sensor_dev_attr_cpld_card_index.dev_attr.attr, + &sensor_dev_attr_fan1_speed_set.dev_attr.attr, + &sensor_dev_attr_fan3_speed_set.dev_attr.attr, + &sensor_dev_attr_fan5_speed_set.dev_attr.attr, + &sensor_dev_attr_fan1_1_real_speed.dev_attr.attr, + &sensor_dev_attr_fan3_1_real_speed.dev_attr.attr, + &sensor_dev_attr_fan5_1_real_speed.dev_attr.attr, + &sensor_dev_attr_fan1_2_real_speed.dev_attr.attr, + &sensor_dev_attr_fan3_2_real_speed.dev_attr.attr, + &sensor_dev_attr_fan5_2_real_speed.dev_attr.attr, + &sensor_dev_attr_fan_present.dev_attr.attr, + &sensor_dev_attr_fan_status1.dev_attr.attr, + &sensor_dev_attr_fan_status2.dev_attr.attr, + &sensor_dev_attr_fan1_led.dev_attr.attr, + &sensor_dev_attr_fan3_led.dev_attr.attr, + &sensor_dev_attr_fan5_led.dev_attr.attr, + &sensor_dev_attr_fan_led_control.dev_attr.attr, + NULL +}; + +static struct attribute *cpld_bus13_addr_0x0d_sysfs_attrs[] = { + &sensor_dev_attr_cpld_version.dev_attr.attr, + &sensor_dev_attr_cpld_card_id.dev_attr.attr, + &sensor_dev_attr_cpld_card_index.dev_attr.attr, + &sensor_dev_attr_fan2_speed_set.dev_attr.attr, + &sensor_dev_attr_fan4_speed_set.dev_attr.attr, + &sensor_dev_attr_fan6_speed_set.dev_attr.attr, + &sensor_dev_attr_fan2_1_real_speed.dev_attr.attr, + &sensor_dev_attr_fan4_1_real_speed.dev_attr.attr, + &sensor_dev_attr_fan6_1_real_speed.dev_attr.attr, + &sensor_dev_attr_fan2_2_real_speed.dev_attr.attr, + &sensor_dev_attr_fan4_2_real_speed.dev_attr.attr, + &sensor_dev_attr_fan6_2_real_speed.dev_attr.attr, + &sensor_dev_attr_fan_present.dev_attr.attr, + &sensor_dev_attr_fan_status1.dev_attr.attr, + &sensor_dev_attr_fan_status2.dev_attr.attr, + &sensor_dev_attr_fan2_led.dev_attr.attr, + &sensor_dev_attr_fan4_led.dev_attr.attr, + &sensor_dev_attr_fan6_led.dev_attr.attr, + &sensor_dev_attr_fan_led_control.dev_attr.attr, + NULL +}; + +static struct attribute *slot_cpld_addr_0x30_sysfs_attrs[] = { + &sensor_dev_attr_sfp_presence1.dev_attr.attr, + &sensor_dev_attr_sfp_presence2.dev_attr.attr, + &sensor_dev_attr_sfp_led1.dev_attr.attr, + &sensor_dev_attr_sfp_led2.dev_attr.attr, + &sensor_dev_attr_cpld_version.dev_attr.attr, + &sensor_dev_attr_sfp_led_reset.dev_attr.attr, + &sensor_dev_attr_sfp_reset1.dev_attr.attr, + &sensor_dev_attr_sfp_reset2.dev_attr.attr, + NULL +}; + +static struct attribute *slot_cpld_addr_0x31_sysfs_attrs[] = { + &sensor_dev_attr_sfp_presence3.dev_attr.attr, + &sensor_dev_attr_sfp_presence4.dev_attr.attr, + &sensor_dev_attr_sfp_led3.dev_attr.attr, + &sensor_dev_attr_sfp_led4.dev_attr.attr, + &sensor_dev_attr_cpld_version.dev_attr.attr, + &sensor_dev_attr_sfp_led_reset.dev_attr.attr, + &sensor_dev_attr_sfp_reset3.dev_attr.attr, + &sensor_dev_attr_sfp_reset4.dev_attr.attr, + NULL +}; + + +static const struct attribute_group cpld_bus14_addr_0x0d_sysfs_group = { + .attrs = cpld_bus14_addr_0x0d_sysfs_attrs, +}; + +static const struct attribute_group cpld_bus13_addr_0x0d_sysfs_group = { + .attrs = cpld_bus13_addr_0x0d_sysfs_attrs, +}; + +static const struct attribute_group slot_cpld_addr_0x30_sysfs_group = { + .attrs = slot_cpld_addr_0x30_sysfs_attrs, +}; + +static const struct attribute_group slot_cpld_addr_0x31_sysfs_group = { + .attrs = slot_cpld_addr_0x31_sysfs_attrs, +}; + + +static struct attribute *cpld_hwmon_bus14_attrs[] = { + &sensor_dev_attr_fan1_input.dev_attr.attr, + &sensor_dev_attr_fan5_input.dev_attr.attr, + &sensor_dev_attr_fan9_input.dev_attr.attr, + &sensor_dev_attr_fan2_input.dev_attr.attr, + &sensor_dev_attr_fan6_input.dev_attr.attr, + &sensor_dev_attr_fan10_input.dev_attr.attr, + NULL +}; +static struct attribute *cpld_hwmon_bus13_attrs[] = { + &sensor_dev_attr_fan3_input.dev_attr.attr, + &sensor_dev_attr_fan7_input.dev_attr.attr, + &sensor_dev_attr_fan11_input.dev_attr.attr, + &sensor_dev_attr_fan4_input.dev_attr.attr, + &sensor_dev_attr_fan8_input.dev_attr.attr, + &sensor_dev_attr_fan12_input.dev_attr.attr, + NULL +}; +ATTRIBUTE_GROUPS(cpld_hwmon_bus14); +ATTRIBUTE_GROUPS(cpld_hwmon_bus13); + +struct cpld_attr_match_group { + int bus_nr; + unsigned short addr; + const struct attribute_group *attr_group_ptr; + const struct attribute_group *attr_hwmon_ptr; +}; + +static struct cpld_attr_match_group g_cpld_attr_match[] = { + {14, 0x0D, &cpld_bus14_addr_0x0d_sysfs_group, (struct attribute_group *)cpld_hwmon_bus14_groups}, + {13, 0x0D, &cpld_bus13_addr_0x0d_sysfs_group, (struct attribute_group *)cpld_hwmon_bus13_groups}, + {3, 0x30, &slot_cpld_addr_0x30_sysfs_group,NULL }, + {3, 0x31, &slot_cpld_addr_0x31_sysfs_group, NULL}, + {4, 0x30, &slot_cpld_addr_0x30_sysfs_group,NULL }, + {4, 0x31, &slot_cpld_addr_0x31_sysfs_group, NULL}, + {5, 0x30, &slot_cpld_addr_0x30_sysfs_group,NULL }, + {5, 0x31, &slot_cpld_addr_0x31_sysfs_group, NULL}, + {6, 0x30, &slot_cpld_addr_0x30_sysfs_group,NULL }, + {6, 0x31, &slot_cpld_addr_0x31_sysfs_group, NULL}, +}; + +static const struct attribute_group *cpld_get_attr_group(struct i2c_client *client, int is_hwmon) +{ + int i; + struct cpld_attr_match_group *group; + + for (i = 0; i < ARRAY_SIZE(g_cpld_attr_match); i++) { + group = &g_cpld_attr_match[i]; + DBG_DEBUG("is_hwmon %d i %d client(nr:%d,addr:0x%x), group(nr:%d,addr:0x0%x) .\n", is_hwmon, + i, client->adapter->nr, client->addr, group->bus_nr, group->addr); + if ((client->addr == group->addr) && (client->adapter->nr == group->bus_nr)) { + DBG_DEBUG("is_hwmon %d i %d nr %d addr %d .\n", is_hwmon, i, client->adapter->nr, client->addr); + return (is_hwmon) ? (group->attr_hwmon_ptr) : (group->attr_group_ptr); + } + } + + DBG_DEBUG("is_hwmon %d nr %d addr %d dismatch, return NULL.\n", is_hwmon, client->adapter->nr, client->addr); + return NULL; +} + +#if 0 +static int cpld_detect(struct i2c_client *new_client, struct i2c_board_info *info) +{ + struct i2c_adapter *adapter = new_client->adapter; + int conf; + DBG_DEBUG("=========cpld_detect(0x%x)===========\n", new_client->addr); + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_SMBUS_WORD_DATA)) + return -ENODEV; + conf = i2c_smbus_read_byte_data(new_client, 0); + if (!conf) + return -ENODEV; + strlcpy(info->type, "rg_cpld", I2C_NAME_SIZE); + return 0; +} +#endif + +static int cpld_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct cpld_data *data; + int status; + const struct attribute_group *sysfs_group, *hwmon_group; + + status = -1; + DBG_DEBUG("=========cpld_probe(addr:0x%x, nr:%d)===========\n", client->addr, client->adapter->nr); + data = devm_kzalloc(&client->dev, sizeof(struct cpld_data), GFP_KERNEL); + if (!data) { + return -ENOMEM; + } + + data->client = client; + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + + sysfs_group = NULL; + sysfs_group = cpld_get_attr_group(client, 0); + if (sysfs_group) { + status = sysfs_create_group(&client->dev.kobj, sysfs_group); + DBG_DEBUG("=========(addr:0x%x, nr:%d) sysfs_create_group status %d===========\n", client->addr, client->adapter->nr, status); + if (status != 0) { + DBG_ERROR("sysfs_create_group status %d.\n", status); + goto error; + } + } else { + DBG_DEBUG("=========(addr:0x%x, nr:%d) no sysfs_create_group \n", client->addr, client->adapter->nr); + } + + hwmon_group = NULL; + hwmon_group = cpld_get_attr_group(client, 1); + if (hwmon_group) { + data->hwmon_dev = hwmon_device_register_with_groups(&client->dev, client->name, data, (const struct attribute_group **)hwmon_group); + if (IS_ERR(data->hwmon_dev)) { + sysfs_remove_group(&client->dev.kobj, (const struct attribute_group *)sysfs_group); + DBG_ERROR("hwmon_device_register_with_groups failed ret %ld.\n", PTR_ERR(data->hwmon_dev)); + return PTR_ERR(data->hwmon_dev); + } + DBG_DEBUG("=========(addr:0x%x, nr:%d) hwmon_device_register_with_groups success===========\n", client->addr, client->adapter->nr); + if (status != 0) { + DBG_ERROR("sysfs_create_group status %d.\n", status); + goto error; + } + } else { + DBG_DEBUG("=========(addr:0x%x, nr:%d) no hwmon_device_register_with_groups \n", client->addr, client->adapter->nr); + } + +error: + return status; + +} + +static int cpld_remove(struct i2c_client *client) +{ + struct cpld_data *data = i2c_get_clientdata(client); + const struct attribute_group *sysfs_group, *hwmon_group; + + DBG_DEBUG("=========cpld_remove(addr:0x%x, nr:%d)===========\n", client->addr, client->adapter->nr); + + sysfs_group = NULL; + sysfs_group = cpld_get_attr_group(client, 0); + if (sysfs_group) { + DBG_DEBUG("=========(addr:0x%x, nr:%d) do sysfs_remove_group \n", client->addr, client->adapter->nr); + sysfs_remove_group(&client->dev.kobj, (const struct attribute_group *)sysfs_group); + } else { + DBG_DEBUG("=========(addr:0x%x, nr:%d) no sysfs_remove_group \n", client->addr, client->adapter->nr); + } + + hwmon_group = NULL; + hwmon_group = cpld_get_attr_group(client, 1); + if (hwmon_group) { + DBG_DEBUG("=========(addr:0x%x, nr:%d) do hwmon_device_unregister \n", client->addr, client->adapter->nr); + hwmon_device_unregister(data->hwmon_dev); + } else { + DBG_DEBUG("=========(addr:0x%x, nr:%d) no hwmon_device_unregister \n", client->addr, client->adapter->nr); + } + + return 0; +} + +static const struct i2c_device_id cpld_id[] = { + { "rg_cpld", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, cpld_id); + +static struct i2c_driver rg_cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "rg_cpld", + }, + .probe = cpld_probe, + .remove = cpld_remove, + .id_table = cpld_id, + //.detect = cpld_detect, + // .address_list = rg_i2c_cpld, +}; + +module_i2c_driver(rg_cpld_driver); +MODULE_AUTHOR("support "); +MODULE_DESCRIPTION("ragile CPLD driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/rg_lpc_cpld.c b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/rg_lpc_cpld.c new file mode 100755 index 000000000000..2141567bf167 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/modules/driver/rg_lpc_cpld.c @@ -0,0 +1,250 @@ +#include /* Wd're doing kernel work */ +#include /* specifically, a module */ +#include +#include /* Need for the macros */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ragile.h" + +int lpc_cpld_verbose = 0; +int lpc_cpld_error = 0; +module_param(lpc_cpld_verbose, int, S_IRUGO | S_IWUSR); +module_param(lpc_cpld_error, int, S_IRUGO | S_IWUSR); + + +#define LPC_CPLD_VERBOSE(fmt, args...) do { \ + if (lpc_cpld_verbose) { \ + printk(KERN_ERR "[LPC_CPLD_I2C_DEVICE][VERBOSE][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ + } \ +} while (0) + +#define LPC_CPLD_ERROR(fmt, args...) do { \ + if (lpc_cpld_error) { \ + printk(KERN_ERR "[LPC_CPLD_I2C_DEVICE][ERROR][func:%s line:%d]\r\n"fmt, __func__, __LINE__, ## args); \ + } \ + } while (0) + +#define PCI_VENDOR_ID_D1527_LPC (0x8c54) +#define PCI_VENDOR_ID_C3000_LPC (0x19dc) + +#define MAX_CPLD_REG_SIZE (0x100) +#define LPC_GET_CPLD_ID(addr) ((addr >> 16) & 0xff) +#define LPC_GET_CPLD_OFFSET(addr) ((addr) & 0xff) +typedef struct rg_lpc_device_s { + u16 base; + u16 size; + u8 type; + u8 id; +} rg_lpc_device_t; + +typedef enum rg_lpc_dev_type_s { + LPC_DEVICE_CPLD = 1, + LPC_DEVICE_FPGA = 2, +} rg_lpc_dev_type_t; + +static rg_lpc_device_t g_rg_lpc_dev[] = { + {.base = 0x700, .size = MAX_CPLD_REG_SIZE, .type = LPC_DEVICE_CPLD, .id = 0}, + {.base = 0x900, .size = MAX_CPLD_REG_SIZE, .type = LPC_DEVICE_CPLD, .id = 1}, + {.base = 0xb00, .size = MAX_CPLD_REG_SIZE, .type = LPC_DEVICE_CPLD, .id = 2}, + /*{.base = 0x900, .size = MAX_FPGA_REG_SIZE, .type = LPC_DEVICE_FPGA, .id = 0},*/ +}; + +static rg_lpc_device_t* lpc_get_device_info(int type, int id) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(g_rg_lpc_dev); i++) { + if ((g_rg_lpc_dev[i].type == type) && (g_rg_lpc_dev[i].id == id)) { + return &g_rg_lpc_dev[i]; + } + } + + return NULL; +} + +static int lpc_cpld_read(int address, u8 *val) +{ + int cpld_id; + rg_lpc_device_t *info; + + LPC_CPLD_ERROR("Enter\n"); + cpld_id = LPC_GET_CPLD_ID(address); + LPC_CPLD_ERROR("icpld_id=%d\n", cpld_id); + info = lpc_get_device_info(LPC_DEVICE_CPLD, cpld_id); + if (info == NULL) { + LPC_CPLD_ERROR("lpc_get_device_info addr 0x%x id %d failed.\r\n", address, cpld_id); + return -1; + } + + *val = inb(info->base + LPC_GET_CPLD_OFFSET(address)); + LPC_CPLD_VERBOSE("Leave info->base 0x%x, addr 0x%x, cpld_id %d, val 0x%x.\r\n", info->base, address, cpld_id, *val); + return 0; +} + +static int lpc_cpld_write(int address, u8 reg_val) +{ + int cpld_id; + rg_lpc_device_t *info; + + cpld_id = LPC_GET_CPLD_ID(address); + info = lpc_get_device_info(LPC_DEVICE_CPLD, cpld_id); + if (info == NULL) { + LPC_CPLD_ERROR("lpc_get_device_info addr 0x%x id %d failed.\r\n", address, cpld_id); + return -1; + } + + outb(reg_val, info->base + LPC_GET_CPLD_OFFSET(address)); + LPC_CPLD_VERBOSE("Leave info->base 0x%x, addr 0x%x, cpld_id %d, val 0x%x.\r\n", info->base, address, cpld_id, reg_val); + return 0; +} + +static ssize_t show_cpld_version(struct device *dev, struct device_attribute *da, char *buf) +{ + int ret, i; + u8 data[4]; + u32 index = to_sensor_dev_attr(da)->index; + + memset(data, 0 ,sizeof(data)); + for (i = 0; i < 4; i++) { + ret = lpc_cpld_read(index + i, &data[i]); + if (ret != 0) { + memset(data, 0 ,sizeof(data)); + LPC_CPLD_ERROR("get cpld version failed!\n"); + break; + } + } + + return snprintf(buf, COMMON_STR_LEN, "%02x %02x %02x %02x \n", data[0], data[1], data[2], data[3]); + +} + +static ssize_t show_cpld_sysfs_value(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + u8 data; + int ret; + + ret = lpc_cpld_read(attr->index, &data); + if (ret != 0) { + LPC_CPLD_ERROR("get cpld[0x%x] value failed!\n", attr->index); + data = 0; + } + return snprintf(buf, COMMON_STR_LEN, "%02x\n", data); +} + +static ssize_t set_cpld_sysfs_value(struct device *dev, struct device_attribute *da, const char *buf, size_t +count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + u8 data; + unsigned long val; + int err; + + err = kstrtoul(buf, 16, &val); + if (err) + return err; + if ((val < 0) || (val > 0xff)) { + LPC_CPLD_ERROR("please enter 0x00 ~ 0xff\n"); + return -1; + } + + data = (u8)val; + LPC_CPLD_VERBOSE("pos: 0x%02x count = %ld, data = 0x%02x\n", attr->index, count, data); + err = lpc_cpld_write(attr->index, data); + if (err != 0) { + LPC_CPLD_ERROR("set cpld[0x%x] value[0x%x] failed!\n", attr->index, data); + count = 0; + } + + return count; +} + +/* common */ +static SENSOR_DEVICE_ATTR(cpld_version_0_0, S_IRUGO, show_cpld_version, NULL, 0x10000); +static SENSOR_DEVICE_ATTR(cpld_version_0_1, S_IRUGO, show_cpld_version, NULL, 0x20000); + +static SENSOR_DEVICE_ATTR(broad_front_sys, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x20021); +static SENSOR_DEVICE_ATTR(broad_front_pwr, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x20022); +static SENSOR_DEVICE_ATTR(broad_front_fan, S_IRUGO| S_IWUSR, show_cpld_sysfs_value, set_cpld_sysfs_value, 0x20023); + +/* psu status */ +static SENSOR_DEVICE_ATTR(psu_status_1, S_IRUGO, show_cpld_sysfs_value, NULL, 0x20027); +static SENSOR_DEVICE_ATTR(psu_status_2, S_IRUGO, show_cpld_sysfs_value, NULL, 0x20028); +static SENSOR_DEVICE_ATTR(psu_status_3, S_IRUGO, show_cpld_sysfs_value, NULL, 0x20029); +static SENSOR_DEVICE_ATTR(psu_status_4, S_IRUGO, show_cpld_sysfs_value, NULL, 0x2002a); + +/* line card present status */ +static SENSOR_DEVICE_ATTR(slot_present, S_IRUGO, show_cpld_sysfs_value, NULL, 0x2002c); + +static struct attribute *lpc_cpld_base_sysfs_attrs[] = { + &sensor_dev_attr_cpld_version_0_0.dev_attr.attr, + &sensor_dev_attr_cpld_version_0_1.dev_attr.attr, + &sensor_dev_attr_broad_front_sys.dev_attr.attr, + &sensor_dev_attr_broad_front_pwr.dev_attr.attr, + &sensor_dev_attr_broad_front_fan.dev_attr.attr, + &sensor_dev_attr_psu_status_1.dev_attr.attr, + &sensor_dev_attr_psu_status_2.dev_attr.attr, + &sensor_dev_attr_psu_status_3.dev_attr.attr, + &sensor_dev_attr_psu_status_4.dev_attr.attr, + &sensor_dev_attr_slot_present.dev_attr.attr, + NULL +}; + +static const struct attribute_group lpc_cpld_base_sysfs_group = { + .attrs = lpc_cpld_base_sysfs_attrs, +}; + +static int __init rg_lpc_cpld_init(void) +{ + struct pci_dev *pdev = NULL; + int status; + + pdev = pci_get_device(PCI_VENDOR_ID_INTEL, PCI_VENDOR_ID_D1527_LPC, pdev); + if (!pdev) { + LPC_CPLD_ERROR("pci_get_device(0x8086, 0x8c54) failed!\n"); + return -1; + } + + status = -1; + status = sysfs_create_group(&pdev->dev.kobj, &lpc_cpld_base_sysfs_group); + if (status) { + LPC_CPLD_ERROR("sysfs_create_group failed!\n"); + return -1; + } + + LPC_CPLD_VERBOSE("Leave success\n"); + return 0; +} + +static void __exit rg_lpc_cpld_exit(void) +{ + struct pci_dev *pdev = NULL; + + pdev = pci_get_device(PCI_VENDOR_ID_INTEL, PCI_VENDOR_ID_D1527_LPC, pdev); + if (!pdev) { + LPC_CPLD_ERROR("pci_get_device(0x8086, 0x8c54) failed!\n"); + return ; + } + + sysfs_remove_group(&pdev->dev.kobj, &lpc_cpld_base_sysfs_group); + + LPC_CPLD_VERBOSE("Leave.\n"); +} + +module_init(rg_lpc_cpld_init); +module_exit(rg_lpc_cpld_exit); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("support "); diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/scripts/pddf_post_device_create.sh b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/scripts/pddf_post_device_create.sh new file mode 100755 index 000000000000..952e034c5b5e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/scripts/pddf_post_device_create.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# create tmp411 device +function create_tmp411() +{ + bus=$1 + addr=$2 + if [ -d "/sys/bus/i2c/devices/i2c-${bus}" ] + then + echo "tmp411 ${addr}" > /sys/bus/i2c/devices/i2c-${bus}/new_device + fi +} + +create_tmp411 "28" "0x4c" +create_tmp411 "29" "0x4c" + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/setup.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/setup.py new file mode 100644 index 000000000000..f36055fb4e6d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/setup.py @@ -0,0 +1,33 @@ +from setuptools import setup + +setup( + name='sonic-platform', + version='1.0', + description='SONiC platform API implementation on RAGILE Platforms', + license='Apache 2.0', + author='SONiC Team', + author_email='support@ragile.com', + url='', + maintainer='RAGILE SUPPORT TEAM', + maintainer_email='', + packages=[ + 'sonic_platform', + 'rgutil', + 'eepromutil', + 'sonic_pcie', + ], + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Environment :: Plugins', + 'Intended Audience :: Developers', + 'Intended Audience :: Information Technology', + 'Intended Audience :: System Administrators', + 'License :: OSI Approved :: Apache Software License', + 'Natural Language :: English', + 'Operating System :: POSIX :: Linux', + 'Programming Language :: Python :: 3.7', + 'Topic :: Utilities', + ], + keywords='sonic SONiC platform PLATFORM', +) + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_pcie/__init__.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_pcie/__init__.py new file mode 100644 index 000000000000..73e2a89c8d74 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_pcie/__init__.py @@ -0,0 +1 @@ +__all__ = ["pcie_common"] \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_pcie/pcie_common.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_pcie/pcie_common.py new file mode 100644 index 000000000000..56e9d8664a23 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_pcie/pcie_common.py @@ -0,0 +1,107 @@ +# pcie_common.py +# Common PCIE check interfaces for SONIC +# + +import os +import yaml +import subprocess +import re +import sys +from copy import deepcopy +try: + from .pcie import PcieBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PcieUtil(PcieBase): + """Platform-specific PCIEutil class""" + # got the config file path + def __init__(self, path): + self.config_path = path + + # load the config file + def load_config_file(self): + config_file = self.config_path + "/" + "pcie.yaml" + try: + with open(config_file) as conf_file: + self.confInfo = yaml.load(conf_file) + except IOError as e: + print("Error: {}".format(str(e))) + print("Not found config file, please add a config file manually, or generate it by running [pcieutil pcie_generate]") + sys.exit() + + # load current PCIe device + def get_pcie_device(self): + pciDict = {} + pciList = [] + p1 = "^(\w+):(\w+)\.(\w)\s(.*)\s*\(*.*\)*" + p2 = "^.*:.*:.*:(\w+)\s*\(*.*\)*" + command1 = "sudo lspci" + command2 = "sudo lspci -n" + # run command 1 + proc1 = subprocess.Popen(command1, shell=True, universal_newlines=True, stdout=subprocess.PIPE) + output1 = proc1.stdout.readlines() + proc1.communicate() + # run command 2 + proc2 = subprocess.Popen(command2, shell=True, universal_newlines=True, stdout=subprocess.PIPE) + output2 = proc2.stdout.readlines() + proc2.communicate() + + if proc1.returncode > 0: + for line1 in output1: + print(line1.strip()) + return + elif proc2.returncode > 0: + for line2 in output2: + print(line2.strip()) + return + else: + for (line1, line2) in zip(output1, output2): + pciDict.clear() + match1 = re.search(p1, line1.strip()) + match2 = re.search(p2, line2.strip()) + if match1 and match2: + Bus = match1.group(1) + Dev = match1.group(2) + Fn = match1.group(3) + Name = match1.group(4) + Id = match2.group(1) + pciDict["name"] = Name + pciDict["bus"] = Bus + pciDict["dev"] = Dev + pciDict["fn"] = Fn + pciDict["id"] = Id + pciList.append(pciDict) + pciDict = deepcopy(pciDict) + else: + print("CAN NOT MATCH PCIe DEVICE") + return pciList + + # check the sysfs tree for each PCIe device + def check_pcie_sysfs(self, domain=0, bus=0, device=0, func=0): + dev_path = os.path.join('/sys/bus/pci/devices', '%04x:%02x:%02x.%d' % (domain, bus, device, func)) + if os.path.exists(dev_path): + return True + return False + + # check the current PCIe device with config file and return the result + def get_pcie_check(self): + self.load_config_file() + for item_conf in self.confInfo: + bus_conf = item_conf["bus"] + dev_conf = item_conf["dev"] + fn_conf = item_conf["fn"] + if self.check_pcie_sysfs(bus=int(bus_conf, base=16), device=int(dev_conf, base=16), func=int(fn_conf, base=16)): + item_conf["result"] = "Passed" + else: + item_conf["result"] = "Failed" + return self.confInfo + + # generate the config file with current pci device + def dump_conf_yaml(self): + curInfo = self.get_pcie_device() + with open(self.config_path + "/" + "pcie.yaml", "w") as conf_file: + yaml.dump(curInfo, conf_file, default_flow_style=False) + return + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/__init__.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/__init__.py new file mode 100644 index 000000000000..d49ca9b48bbf --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/__init__.py @@ -0,0 +1,4 @@ +# All the derived classes for PDDF +__all__ = ["platform", "chassis", "sfp", "psu", "thermal", "fan", "fan_drawer"] +from . import platform + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/chassis.py new file mode 100644 index 000000000000..5d428f668567 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/chassis.py @@ -0,0 +1,108 @@ +############################################################################# +# PDDF +# Module contains an implementation of SONiC Chassis API +# +############################################################################# + +try: + import time + from sonic_platform_pddf_base.pddf_chassis import PddfChassis + from sonic_platform.fan_drawer import FanDrawer +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +PORT_START = 0 +PORTS_IN_BLOCK = 128 +FAN_NUM_PER_DRAWER = 2 + +class Chassis(PddfChassis): + """ + PDDF Platform-specific Chassis class + """ + + SFP_STATUS_INSERTED = "1" + SFP_STATUS_REMOVED = "0" + port_dict = {} + + def __init__(self, pddf_data=None, pddf_plugin_data=None): + PddfChassis.__init__(self, pddf_data, pddf_plugin_data) + + # fan drawer + temp = [] + drawer_index = 0 + for idx, fan in enumerate(self.get_all_fans()): + temp.append(fan) + if (idx + 1) % FAN_NUM_PER_DRAWER == 0: + drawer = FanDrawer(drawer_index + 1, temp) + self.get_all_fan_drawers().append(drawer) + temp = [] + drawer_index += 1 + + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + Returns: + A tuple (string, string) where the first element is a string + containing the cause of the previous reboot. This string must be + one of the predefined strings in this class. If the first string + is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used + to pass a description of the reboot cause. + """ + + return (self.REBOOT_CAUSE_NON_HARDWARE, None) + + def get_change_event(self, timeout=0): + change_event_dict = {"fan": {}, "sfp": {}} + sfp_status, sfp_change_dict = self.get_transceiver_change_event(timeout) + change_event_dict["sfp"] = sfp_change_dict + if sfp_status is True: + return True, change_event_dict + + return False, {} + + def get_transceiver_change_event(self, timeout=0): + start_time = time.time() + currernt_port_dict = {} + forever = False + + if timeout == 0: + forever = True + elif timeout > 0: + timeout = timeout / float(1000) # Convert to secs + else: + print("get_transceiver_change_event:Invalid timeout value", timeout) + return False, {} + + end_time = start_time + timeout + if start_time > end_time: + print( + "get_transceiver_change_event:" "time wrap / invalid timeout value", + timeout, + ) + return False, {} # Time wrap or possibly incorrect timeout + + while timeout >= 0: + # Check for OIR events and return updated port_dict + for index in range(PORT_START, PORTS_IN_BLOCK): + if self._sfp_list[index].get_presence(): + currernt_port_dict[index] = self.SFP_STATUS_INSERTED + else: + currernt_port_dict[index] = self.SFP_STATUS_REMOVED + if currernt_port_dict == self.port_dict: + if forever: + time.sleep(1) + else: + timeout = end_time - time.time() + if timeout >= 1: + time.sleep(1) # We poll at 1 second granularity + else: + if timeout > 0: + time.sleep(timeout) + return True, {} + else: + # Update reg value + self.port_dict = currernt_port_dict + print(self.port_dict) + return True, self.port_dict + print("get_transceiver_change_event: Should not reach here.") + return False, {} diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/common.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/common.py new file mode 100644 index 000000000000..c1a85f618609 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/common.py @@ -0,0 +1,44 @@ +import os +import yaml + +from sonic_py_common import device_info + + +class Common: + + DEVICE_PATH = '/usr/share/sonic/device/' + PMON_PLATFORM_PATH = '/usr/share/sonic/platform/' + CONFIG_DIR = 'sonic_platform_config' + + HOST_CHK_CMD = "docker > /dev/null 2>&1" + + def __init__(self): + (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() + + def is_host(self): + return os.system(self.HOST_CHK_CMD) == 0 + + def load_json_file(self, path): + """ + Retrieves the json object from json file path + + Returns: + A json object + """ + with open(path, 'r') as f: + json_data = yaml.safe_load(f) + + return json_data + + def get_config_path(self, config_name): + """ + Retrieves the path to platform api config directory + + Args: + config_name: A string containing the name of config file. + + Returns: + A string containing the path to json file + """ + return os.path.join(self.DEVICE_PATH, self.platform, self.CONFIG_DIR, config_name) if self.is_host() else os.path.join(self.PMON_PLATFORM_PATH, self.CONFIG_DIR, config_name) + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/component.py new file mode 100644 index 000000000000..7c6fd2df4335 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/component.py @@ -0,0 +1,85 @@ +######################################################################## +# Ragile RA-B6510-32c +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Components' (e.g., BIOS, CPLD, FPGA, etc.) available in +# the platform +# +######################################################################## + +try: + import subprocess + from sonic_platform_base.component_base import ComponentBase + from sonic_platform.regutil import Reg + from sonic_platform.logger import logger +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Component(ComponentBase): + """ Ragile Platform-specific Component class""" + + def __init__(self, index, config=None): + self.index = index + self.name = config.get("name") + self._reg_fm_ver = Reg(config.get("firmware_version")) + self.description = config.get("desc") + self.slot = config.get("slot") + + def get_name(self): + """ + Retrieves the name of the component + + Returns: + A string containing the name of the component + """ + return self.name + + def get_description(self): + """ + Retrieves the description of the component + + Returns: + A string containing the description of the component + """ + return self.description + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + + Returns: + A string containing the firmware version of the component + """ + try: + return self._reg_fm_ver.decode() + except Exception as e: + logger.error(str(e)) + + return "" + + def install_firmware(self, image_path): + """ + Installs firmware to the component + + Args: + image_path: A string, path to firmware image + + Returns: + A boolean, True if install was successful, False if not + """ + try: + successtips = "CPLD Upgrade succeeded!" + status, output = subprocess.getstatusoutput("which firmware_upgrade") + if status or len(output) <= 0: + logger.error("no upgrade tool.") + return False + cmdstr = "%s %s cpld %d cpld"%(output,image_path,self.slot) + ret, log = subprocess.getstatusoutput(cmdstr) + if ret == 0 and successtips in log: + return True + logger.error("upgrade failed. ret:%d, log:\n%s" % (ret, log)) + except Exception as e: + logger.error(str(e)) + return False + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/config.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/config.py new file mode 100644 index 000000000000..7d3064163b30 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/config.py @@ -0,0 +1,771 @@ +# -*- coding: utf-8 -*- + +PSU_FAN_AIRFLOW = { + "CSU550AP-3-300": "F2B", + "CSU550AP-3-500": "F2B", + "DPS-550AB-39 A": "F2B", + "DPS-1300AB-6 S": "F2B", + "FSP1200-20ERM": "F2B", + "CSU800AP-3-300": "F2B", + "CSU550AP-3-501": "B2F", + "DPS-550AB-40 A": "B2F", +} + +psutypedecode = { + 0x00: "N/A", + 0x01: "AC", + 0x02: "DC", +} + + +class Unit: + Temperature = "C" + Voltage = "V" + Current = "A" + Power = "W" + Speed = "RPM" + + +class Threshold: + PSU_TEMP_MIN = -10 * 1000 + PSU_TEMP_MAX = 60 * 1000 + + PSU_FAN_SPEED_MIN = 5220 + PSU_FAN_SPEED_MAX = 17400 + + PSU_OUTPUT_VOLTAGE_MIN = 11 * 1000 + PSU_OUTPUT_VOLTAGE_MAX = 14 * 1000 + + PSU_AC_INPUT_VOLTAGE_MIN = 200 * 1000 + PSU_AC_INPUT_VOLTAGE_MAX = 240 * 1000 + + PSU_DC_INPUT_VOLTAGE_MIN = 190 * 1000 + PSU_DC_INPUT_VOLTAGE_MAX = 290 * 1000 + + ERR_VALUE = -9999999 + + PSU_OUTPUT_POWER_MIN = 10 * 1000 + PSU_OUTPUT_POWER_MAX = 1300 * 1000 + + PSU_INPUT_POWER_MIN = 10 * 1000 + PSU_INPUT_POWER_MAX = 1444 * 1000 + + PSU_OUTPUT_CURRENT_MIN = 2 * 1000 + PSU_OUTPUT_CURRENT_MAX = 107 * 1000 + + PSU_INPUT_CURRENT_MIN = 0.2 * 1000 + PSU_INPUT_CURRENT_MAX = 7 * 1000 + + FAN_SPEED_MAX = 24000 + FAN_SPEED_MIN = 7200 + + +class DecodeFormat: + TEXT = 0 + DECIMAL = 1 + ONE_BIT_HEX = 2 + HUNDREDTH = 3 + THOUSANDTH = 4 + MILLIONTH = 5 + AND = 6 + JOIN = 7 + FRU = 8 + HEX = 9 + + +class DecodeMethod: + SYSFS = 0 + I2C = 1 + I2C_WORD = 2 + DEVMEM = 3 + SDK = 4 + IO = 5 + FRU = 6 + + +class FRU: + SN = 0 + VERSION = 1 + PART_NAME = 2 + PRODUCT_NAME = 3 + MANUFACTURER = 4 + + +class Description: + CPLD = "Used for managing IO modules, SFP+ modules and system LEDs" + BIOS = "Performs initialization of hardware components during booting" + FPGA = "Platform management controller for on-board temperature monitoring, in-chassis power, Fan and LED control" + + +FAN_LED_COLORS = { + "green": 0b0100, + "red": 0b0010, + "amber": 0b0110, +} + + +DEVICE_CONF = { + "eeprom": {"bus": 1, "loc": "0056"}, + "components": [ + { + "name": "CPLD1 (MAC Board A)", + "firmware_version": { + "bus": 8, + "addr": 0x30, + "offset": 0, + "size": 4, + "way": DecodeMethod.I2C, + "format": DecodeFormat.JOIN, + "sep": "/", + }, + "desc": Description.CPLD, + "slot": 0, + }, + { + "name": "CPLD2 (MAC Board B)", + "firmware_version": { + "bus": 8, + "addr": 0x31, + "offset": 0, + "size": 4, + "way": DecodeMethod.I2C, + "format": DecodeFormat.JOIN, + "sep": "/", + }, + "desc": Description.CPLD, + "slot": 0, + }, + { + "name": "CPLD3 (CONNECT Board A)", + "firmware_version": { + "bus": 2, + "addr": 0x0d, + "offset": 0, + "size": 4, + "way": DecodeMethod.I2C, + "format": DecodeFormat.JOIN, + "sep": "/", + }, + "desc": Description.CPLD, + "slot": 0, + }, + { + "name": "CPLD4 (CPU Board)", + "firmware_version": { + "bus": 0, + "addr": 0x0D, + "offset": 0, + "size": 4, + "way": DecodeMethod.I2C, + "format": DecodeFormat.JOIN, + "sep": "/", + }, + "desc": Description.CPLD, + "slot": 1, + }, + ], + "thermals": [ + { + "name": "INLET TEMP", + "high": { + "loc": "/sys/bus/i2c/devices/3-004b/hwmon/*/temp1_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": None, + "temperature": { + "loc": "/sys/bus/i2c/devices/3-004b/hwmon/*/temp1_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + { + "name": "OUTLET TEMP", + "high": { + "loc": "/sys/bus/i2c/devices/3-004c/hwmon/*/temp1_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": None, + "temperature": { + "loc": "/sys/bus/i2c/devices/3-004c/hwmon/*/temp1_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + { + "name": "BOARD TEMP", + "high": { + "loc": "/sys/bus/i2c/devices/3-0049/hwmon/*/temp1_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": None, + "temperature": { + "loc": "/sys/bus/i2c/devices/3-0049/hwmon/*/temp1_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + { + "name": "PHYSICAL ID 0", + "high": { + "loc": "/sys/class/hwmon/hwmon0/temp1_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": { + "loc": "/sys/class/hwmon/hwmon0/temp1_crit", + "format": DecodeFormat.THOUSANDTH, + }, + "temperature": { + "loc": "/sys/class/hwmon/hwmon0/temp1_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + { + "name": "CPU CORE 0", + "high": { + "loc": "/sys/class/hwmon/hwmon0/temp2_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": { + "loc": "/sys/class/hwmon/hwmon0/temp2_crit", + "format": DecodeFormat.THOUSANDTH, + }, + "temperature": { + "loc": "/sys/class/hwmon/hwmon0/temp2_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + { + "name": "CPU CORE 1", + "high": { + "loc": "/sys/class/hwmon/hwmon0/temp3_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": { + "loc": "/sys/class/hwmon/hwmon0/temp3_crit", + "format": DecodeFormat.THOUSANDTH, + }, + "temperature": { + "loc": "/sys/class/hwmon/hwmon0/temp3_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + { + "name": "CPU CORE 2", + "high": { + "loc": "/sys/class/hwmon/hwmon0/temp4_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": { + "loc": "/sys/class/hwmon/hwmon0/temp4_crit", + "format": DecodeFormat.THOUSANDTH, + }, + "temperature": { + "loc": "/sys/class/hwmon/hwmon0/temp4_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + { + "name": "CPU CORE 3", + "high": { + "loc": "/sys/class/hwmon/hwmon0/temp5_max", + "format": DecodeFormat.THOUSANDTH, + }, + "low": None, + "crit_low": None, + "crit_high": { + "loc": "/sys/class/hwmon/hwmon0/temp5_crit", + "format": DecodeFormat.THOUSANDTH, + }, + "temperature": { + "loc": "/sys/class/hwmon/hwmon0/temp5_input", + "format": DecodeFormat.THOUSANDTH, + }, + }, + ], + "fans": [ + { + "name": "fan1", + "e2loc": {"bus": 16, "addr": 0x50, "way": "i2c", "size": "256"}, + "present": { + "loc": "/sys/bus/i2c/devices/2-000d/fan_present", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 0, + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-000d/fan_status", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 0, + }, + "hw_version": { + "loc": "/sys/bus/i2c/devices/16-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.VERSION + }, + "sn": { + "loc": "/sys/bus/i2c/devices/16-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.SN + }, + "led": { + "loc": "/sys/bus/i2c/devices/2-000d/fan1_led", + "format": DecodeFormat.AND, + "mask": 0b1111, + }, + "led_colors": FAN_LED_COLORS, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan1_1_real_speed" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan1_speed_set", + "format": DecodeFormat.HEX + }, + "speed_max": Threshold.FAN_SPEED_MAX, + "slope": 236.51, + "intercept": 82.571, + }, + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan1_2_real_speed" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan1_speed_set", + "format": DecodeFormat.HEX + }, + "speed_max": Threshold.FAN_SPEED_MAX, + "slope": 236.51, + "intercept": 82.571, + } + ], + "tolerance": 20, + "threshold": 30, + "target_default": 0, + }, + { + "name": "fan2", + "e2loc": {"bus": 17, "addr": 0x50, "way": "i2c", "size": "256"}, + "present": { + "loc": "/sys/bus/i2c/devices/2-000d/fan_present", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 1, + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-000d/fan_status", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 1, + }, + "hw_version": { + "loc": "/sys/bus/i2c/devices/17-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.VERSION + }, + "sn": { + "loc": "/sys/bus/i2c/devices/17-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.SN + }, + "led": { + "loc": "/sys/bus/i2c/devices/2-000d/fan2_led", + "format": DecodeFormat.AND, + "mask": 0b1111, + }, + "led_colors": FAN_LED_COLORS, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan2_1_real_speed" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan2_speed_set", + "format": DecodeFormat.HEX + }, + "speed_max": Threshold.FAN_SPEED_MAX, + "slope": 236.51, + "intercept": 82.571, + }, + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan2_2_real_speed" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan2_speed_set", + "format": DecodeFormat.HEX, + }, + "speed_max": Threshold.FAN_SPEED_MAX, + "slope": 236.51, + "intercept": 82.571, + } + ], + "tolerance": 20, + "threshold": 30, + "target_default": 0, + }, + { + "name": "fan3", + "e2loc": {"bus": 18, "addr": 0x50, "way": "i2c", "size": "256"}, + "present": { + "loc": "/sys/bus/i2c/devices/2-000d/fan_present", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 2, + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-000d/fan_status", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 2, + }, + "hw_version": { + "loc": "/sys/bus/i2c/devices/18-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.VERSION + }, + "sn": { + "loc": "/sys/bus/i2c/devices/18-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.SN + }, + "led": { + "loc": "/sys/bus/i2c/devices/2-000d/fan3_led", + "format": DecodeFormat.AND, + "mask": 0b1111, + }, + "led_colors": FAN_LED_COLORS, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan3_1_real_speed" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan3_speed_set", + "format": DecodeFormat.HEX + }, + "speed_max": Threshold.FAN_SPEED_MAX, + "slope": 236.51, + "intercept": 82.571, + }, + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan3_2_real_speed" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan3_speed_set", + "format": DecodeFormat.HEX + }, + "speed_max": Threshold.FAN_SPEED_MAX, + "slope": 236.51, + "intercept": 82.571, + } + ], + "tolerance": 20, + "threshold": 30, + "target_default": 0, + }, + { + "name": "fan4", + "e2loc": {"bus": 19, "addr": 0x50, "way": "i2c", "size": "256"}, + "present": { + "loc": "/sys/bus/i2c/devices/2-000d/fan_present", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 3, + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-000d/fan_status", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 3, + }, + "hw_version": { + "loc": "/sys/bus/i2c/devices/19-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.VERSION + }, + "sn": { + "loc": "/sys/bus/i2c/devices/19-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.SN + }, + "led": { + "loc": "/sys/bus/i2c/devices/2-000d/fan4_led", + "format": DecodeFormat.AND, + "mask": 0b1111, + }, + "led_colors": FAN_LED_COLORS, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan4_1_real_speed" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan4_speed_set", + "format": DecodeFormat.HEX + }, + "speed_max": Threshold.FAN_SPEED_MAX, + "slope": 236.51, + "intercept": 82.571, + }, + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan4_2_real_speed" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan4_speed_set", + "format": DecodeFormat.HEX + }, + "speed_max": Threshold.FAN_SPEED_MAX, + "slope": 236.51, + "intercept": 82.571, + } + ], + "tolerance": 20, + "threshold": 30, + "target_default": 0, + }, + { + "name": "fan5", + "e2loc": {"bus": 20, "addr": 0x50, "way": "i2c", "size": "256"}, + "present": { + "loc": "/sys/bus/i2c/devices/2-000d/fan_present", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 4, + }, + "status": { + "loc": "/sys/bus/i2c/devices/2-000d/fan_status", + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 4, + }, + "hw_version": { + "loc": "/sys/bus/i2c/devices/20-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.VERSION + }, + "sn": { + "loc": "/sys/bus/i2c/devices/20-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.SN + }, + "led": { + "loc": "/sys/bus/i2c/devices/2-000d/fan5_led", + "format": DecodeFormat.AND, + "mask": 0b1111, + }, + "led_colors": FAN_LED_COLORS, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan5_1_real_speed" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan5_speed_set", + "format": DecodeFormat.HEX + }, + "speed_max": Threshold.FAN_SPEED_MAX, + "slope": 236.51, + "intercept": 82.571, + }, + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan5_2_real_speed" + }, + "speed_setter": { + "loc": "/sys/bus/i2c/devices/2-000d/fan5_speed_set", + "format": DecodeFormat.HEX + }, + "speed_max": Threshold.FAN_SPEED_MAX, + "slope": 236.51, + "intercept": 82.571, + } + ], + "tolerance": 20, + "threshold": 30, + "target_default": 0, + }, + ], + "psus": [ + { + "name": "psu1", + "present": { + "addr": 0x951, + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 0, + "way": DecodeMethod.IO + }, + "status": { + "addr": 0x951, + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 1, + "way": DecodeMethod.IO + }, + "sn": { + "loc": "/sys/bus/i2c/devices/24-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.SN + }, + "in_current": { + "loc": "/sys/bus/i2c/devices/24-0058/hwmon/*/curr1_input", + "format": DecodeFormat.THOUSANDTH, + }, + "in_voltage": { + "loc": "/sys/bus/i2c/devices/24-0058/hwmon/*/in1_input", + "format": DecodeFormat.THOUSANDTH, + }, + "out_voltage": { + "loc": "/sys/bus/i2c/devices/24-0058/hwmon/*/in2_input", + "format": DecodeFormat.THOUSANDTH, + }, + "out_current": { + "loc": "/sys/bus/i2c/devices/24-0058/hwmon/*/curr2_input", + "format": DecodeFormat.THOUSANDTH, + }, + "temperature": { + "loc": "/sys/bus/i2c/devices/24-0058/hwmon/*/temp1_input", + "format": DecodeFormat.THOUSANDTH, + }, + "hw_version": { + "loc": "/sys/bus/i2c/devices/24-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.VERSION + }, + # "psu_type": { + # "loc": "/sys/bus/i2c/devices/24-0050/eeprom", + # "format": DecodeFormat.FRU, + # "fru_key": FRU.SN + # }, + "fans": [ + { + "name": "psu_fan1", + "present": { + "loc": "/sys/bus/i2c/devices/24-0058/hwmon/*/fan1_fault", + }, + "status": { + "addr": 0x951, + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 1, + "way": DecodeMethod.IO + }, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/24-0058/hwmon/*/fan1_input" + }, + "speed_setter": { + "bus": 24, + "addr": 0x58, + "offset": 0x3b, + "size": 1, + "way": DecodeMethod.I2C, + "format": DecodeFormat.HEX, + }, + "speed_max": Threshold.PSU_FAN_SPEED_MAX, + } + ], + "tolerance": 20, + "threshold_low": 1900, + } + ], + "in_power": { + "loc": "/sys/bus/i2c/devices/24-0058/hwmon/*/power1_input", + "format": DecodeFormat.MILLIONTH, + }, + "out_power": { + "loc": "/sys/bus/i2c/devices/24-0058/hwmon/*/power2_input", + "format": DecodeFormat.MILLIONTH, + }, + }, + { + "name": "psu2", + "present": { + "addr": 0x951, + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 4, + "way": DecodeMethod.IO + }, + "status": { + "addr": 0x951, + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 5, + "way": DecodeMethod.IO + }, + "sn": { + "loc": "/sys/bus/i2c/devices/25-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.SN + }, + "in_current": { + "loc": "/sys/bus/i2c/devices/25-0058/hwmon/*/curr1_input", + "format": DecodeFormat.THOUSANDTH, + }, + "in_voltage": { + "loc": "/sys/bus/i2c/devices/25-0058/hwmon/*/in1_input", + "format": DecodeFormat.THOUSANDTH, + }, + "out_voltage": { + "loc": "/sys/bus/i2c/devices/25-0058/hwmon/*/in2_input", + "format": DecodeFormat.THOUSANDTH, + }, + "out_current": { + "loc": "/sys/bus/i2c/devices/25-0058/hwmon/*/curr2_input", + "format": DecodeFormat.THOUSANDTH, + }, + "temperature": { + "loc": "/sys/bus/i2c/devices/25-0058/hwmon/*/temp1_input", + "format": DecodeFormat.THOUSANDTH, + }, + "hw_version": { + "loc": "/sys/bus/i2c/devices/25-0050/eeprom", + "format": DecodeFormat.FRU, + "fru_key": FRU.VERSION + }, + # "psu_type": {"loc": "/sys/bus/i2c/devices/8-0053/psu_type"}, + "fans": [ + { + "name": "psu_fan1", + "present": { + "loc": "/sys/bus/i2c/devices/25-0058/hwmon/*/fan1_fault", + }, + "status": { + "addr": 0x951, + "format": DecodeFormat.ONE_BIT_HEX, + "bit": 5, + "way": DecodeMethod.IO + }, + "rotors": [ + { + "speed_getter": { + "loc": "/sys/bus/i2c/devices/25-0058/hwmon/*/fan1_input" + }, + "speed_setter": { + "bus": 25, + "addr": 0x58, + "offset": 0x3b, + "size": 1, + "way": DecodeMethod.I2C, + "format": DecodeFormat.HEX, + }, + "speed_max": Threshold.PSU_FAN_SPEED_MAX, + } + ], + "tolerance": 20, + "threshold_low": 1900, + } + ], + "in_power": { + "loc": "/sys/bus/i2c/devices/25-0058/hwmon/*/power1_input", + "format": DecodeFormat.MILLIONTH, + }, + "out_power": { + "loc": "/sys/bus/i2c/devices/25-0058/hwmon/*/power2_input", + "format": DecodeFormat.MILLIONTH, + }, + }, + ], +} diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/eeprom.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/eeprom.py new file mode 100644 index 000000000000..c25d711354f5 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/eeprom.py @@ -0,0 +1,12 @@ +try: + from sonic_platform_pddf_base.pddf_eeprom import PddfEeprom +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Eeprom(PddfEeprom): + + def __init__(self, pddf_data=None, pddf_plugin_data=None): + PddfEeprom.__init__(self, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/fan.py new file mode 100644 index 000000000000..14895ec47e3f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/fan.py @@ -0,0 +1,42 @@ +try: + from sonic_platform_pddf_base.pddf_fan import PddfFan +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Fan(PddfFan): + """PDDF Platform-Specific Fan class""" + + def __init__(self, tray_idx, fan_idx=0, pddf_data=None, pddf_plugin_data=None, is_psu_fan=False, psu_index=0): + # idx is 0-based + PddfFan.__init__(self, tray_idx, fan_idx, pddf_data, pddf_plugin_data, is_psu_fan, psu_index) + + # Provide the functions/variables below for which implementation is to be overwritten + # Since psu_fan airflow direction cant be read from sysfs, it is fixed as 'F2B' or 'intake' + def get_direction(self): + """ + Retrieves the direction of fan + + Returns: + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + """ + return self.FAN_DIRECTION_EXHAUST + + def get_speed_rpm(self): + if self.is_psu_fan: + return int(round(super().get_speed_rpm())) + else: + divisor = 15000000 + mask_low = 0xff + ret = super().get_speed_rpm() + # revert ret + ret = (ret >> 8) + ((ret & mask_low) << 8) + return int(round(divisor/ret)) + + def get_target_speed(self): + if self.is_psu_fan: + return None + + return super().get_target_speed() + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..2f83b66df94a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/fan_drawer.py @@ -0,0 +1,69 @@ +# +# fan_drawer +# + +try: + from sonic_platform_base.fan_drawer_base import FanDrawerBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class FanDrawer(FanDrawerBase): + # Device type definition. Note, this is a constant. + DEVICE_TYPE = "fan_drawer" + + def __init__(self, index, fan_list): + FanDrawerBase.__init__(self) + + self._fan_list = fan_list + self._index = index + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + + return "fan drawer {}".format(self._index) + + def get_num_fans(self): + """ + Retrieves the number of fans available on this fan drawer + Returns: + An integer, the number of fan modules available on this fan drawer + """ + return len(self._fan_list) + + def get_all_fans(self): + """ + Retrieves all fan modules available on this fan drawer + Returns: + A list of objects derived from FanBase representing all fan + modules available on this fan drawer + """ + return self._fan_list + + def set_status_led(self, color): + """ + Sets the state of the fan drawer status LED + Args: + color: A string representing the color with which to set the + fan drawer status LED + Returns: + bool: True if status LED state is set successfully, False if not + """ + if self.get_num_fans() > 0: + return self._fan_list[0].set_status_led(color) + return False + + def get_status_led(self): + """ + Gets the state of the fan drawer LED + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + if self.get_num_fans() > 0: + return self._fan_list[0].get_status_led() + return "N/A" + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/logger.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/logger.py new file mode 100644 index 000000000000..5969781bf9a9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/logger.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +import logging + + +def _init_logger(): + formatter = logging.Formatter( + "%(asctime)s %(levelname)s %(filename)s[%(funcName)s][%(lineno)s]: %(message)s" + ) + handler = logging.FileHandler("/var/log/syslog") + handler.setFormatter(formatter) + + logger = logging.getLogger(__name__) + logger.setLevel(logging.DEBUG) + logger.addHandler(handler) + return logger + + +logger = _init_logger() diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/pcie.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/pcie.py new file mode 100644 index 000000000000..5a66997d33d0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/pcie.py @@ -0,0 +1,43 @@ +# +# pcie_base.py +# +# Abstract base class for implementing platform-specific +# PCIE functionality for SONiC +# + +try: + import abc + from sonic_pcie import PcieUtil +except ImportError as e: + raise ImportError (str(e) + " - required module not found") + +class PcieBase(object): + def __init__(self, path): + """ + Constructor + Args: + pcieutil file and config file path + """ + self.pcie_util = PcieUtil(path) + + + @abc.abstractmethod + def get_pcie_device(self): + """ + get current device pcie info + + Returns: + A list including pcie device info + """ + return self.pcie_util.get_pcie_device() + + + @abc.abstractmethod + def get_pcie_check(self): + """ + Check Pcie device with config file + Returns: + A list including pcie device and test result info + """ + return self.pcie_util.get_pcie_check() + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/platform.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/platform.py new file mode 100644 index 000000000000..8595e80692df --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/platform.py @@ -0,0 +1,23 @@ +############################################################################# +# PDDF +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + + +try: + from sonic_platform_pddf_base.pddf_platform import PddfPlatform +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PddfPlatform): + """ + PDDF Platform-Specific Platform Class + """ + + def __init__(self): + PddfPlatform.__init__(self) + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/psu.py new file mode 100644 index 000000000000..57dd5117a2c4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/psu.py @@ -0,0 +1,32 @@ +try: + from sonic_platform_pddf_base.pddf_psu import PddfPsu +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + + +class Psu(PddfPsu): + """PDDF Platform-Specific PSU class""" + + PLATFORM_PSU_CAPACITY = 1200 + + def __init__(self, index, pddf_data=None, pddf_plugin_data=None): + PddfPsu.__init__(self, index, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten + def get_maximum_supplied_power(self): + """ + Retrieves the maximum supplied power by PSU (or PSU capacity) + Returns: + A float number, the maximum power output in Watts. + e.g. 1200.1 + """ + return float(self.PLATFORM_PSU_CAPACITY) + + def get_type(self): + """ + Gets the type of the PSU + Returns: + A string, the type of PSU (AC/DC) + """ + return "DC" + diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/regutil.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/regutil.py new file mode 100644 index 000000000000..bff2bd41ea55 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/regutil.py @@ -0,0 +1,245 @@ +# -*- coding: utf-8 -*- +from glob import glob +from plat_hal.osutil import osutil + +try: + from sonic_platform.config import DecodeFormat, DecodeMethod + + DECODE_FORMAT = DecodeFormat + DECODE_METHOD = DecodeMethod +except ImportError: + raise ImportError(str(e) + "- required module not found") + +ERR_CODE = "ERR" + + +class Reg(object): + """ + "e2loc": {"bus": 3, "addr": 0x53, "way": "i2c"} + "value": { + "loc": "/sys/bus/i2c/devices/2-0048/hwmon/hwmon*/temp1_input", + "way": "sysfs", + + "InputsStatus": { + "bus": 8, + "addr": 0x5B, + "offset": 0x79, + "way": "i2cword", + "mask": 0x0200, + }, + """ + + def __new__(cls, *args): + if args[0] is None or not isinstance(args[0], dict): + return None + return super(Reg, cls).__new__(cls) + + def __init__(self, data): + + self.loc = None + self.way = DECODE_METHOD.SYSFS + self.addr = None + self.bus = None + self.offset = None + self.size = 1 + self.bit = None + self.mask = None + self.digit = None + self.sdk_type = None + self.sep = None + self.format = DECODE_FORMAT.TEXT + self.__dict__.update(data) + + def _read_reg_val(self): + ret = None + try: + if self.way == DECODE_METHOD.SYSFS: + ret = self.get_sysfs() + elif self.way == DECODE_METHOD.I2C: + ret = self.get_i2c() + elif self.way == DECODE_METHOD.I2C_WORD: + ret = self.get_i2cword() + elif self.way == DECODE_METHOD.DEVMEM: + ret = self.get_devmem() + elif self.way == DECODE_METHOD.SDK: + # TODO + pass + else: + pass + except Exception as e: + raise e + + return ret + + def _write_reg_val(self, val): + try: + if self.way == DECODE_METHOD.SYSFS: + return self._write_sysfs(val) + except Exception as e: + raise e + + return False + + def _write_sysfs(self, val): + try: + with open(glob(self.loc)[0], "w") as f: + f.write(val) + f.flush() + return True + except Exception as e: + raise e + + def _format_val(self, val): + try: + if isinstance(val, str): + val = val.strip() + if self.format == DECODE_FORMAT.THOUSANDTH: + return float("%.1f" % (float(val) / 1000)) + elif self.format == DECODE_FORMAT.HUNDREDTH: + return float("%.1f" % (float(val) / 100)) + elif self.format == DECODE_FORMAT.ONE_BIT_HEX: + return (int(val, 16) & (1 << self.bit)) >> self.bit + elif self.format == DECODE_FORMAT.DECIMAL: + return int(val, 10) + elif self.format == DECODE_FORMAT.MILLIONTH: + return float("%.1f" % (float(val) / 1000 / 1000)) + elif self.format == DECODE_FORMAT.AND: + return (int(val, 16)) & self.mask + elif isinstance(val, list): + if self.format == DECODE_FORMAT.JOIN: + return self.sep.join(val) + except Exception as e: + raise e + else: + return val + + def decode(self): + """ + get value by config way + way i2c/sysfs/lpc + """ + if self.way is None: + raise ValueError("cannot found way to deal") + + ret = self._read_reg_val() + + ret = self._format_val(ret) + return ret + + def encode(self, val): + if self.way is None: + raise ValueError("cannot found way to deal") + + return self._write_reg_val(val) + + def get_sdk(self): + # TODO + pass + + def get_sysfs(self): + if self.loc is None: + raise ValueError("Not Enough Attr: loc: {}".format(self.loc)) + + ret, val = osutil.readsysfs(self.loc) + + if not ret: + raise IOError(val) + + return val + + def get_devmem(self): + if self.addr is None or self.digit is None or self.mask is None: + raise ValueError( + "Not Enough Attr: addr: {}, digit: {}, mask: {}".format( + self.addr, self.digit, self.mask + ) + ) + + ret, val = osutil.getdevmem(self.addr, self.digit, self.mask) + + if not ret: + raise IOError(val) + + return val + + def get_i2cword(self): + if self.bus is None or self.addr is None or self.offset is None: + raise ValueError( + "Not Enough Attr: bus: {}, addr: {}, offset: {}".format( + self.bus, self.addr, self.offset + ) + ) + + ret, val = osutil.geti2cword(self.bus, self.addr, self.offset) + + if not ret: + raise IOError(val) + + return val + + def get_i2c(self): + if ( + self.bus is None + or self.addr is None + or self.offset is None + or self.size is None + ): + raise ValueError( + "Not Enough Attr: bus: {}, addr: {}, offset: {}".format( + self.bus, self.addr, self.offset + ) + ) + + value = [] + for i in range(self.size): + ofs = self.offset + i + ret, val = osutil.rji2cget(self.bus, self.addr, ofs) + + if not ret: + raise IOError(val) + else: + value.append(repr(chr(val)).translate(None, r"\\x").replace("'", "")) + + return value + + def set_i2cword(self, bus, addr, offset, byte): + return self.seti2cword(bus, addr, offset, byte) + + def seti2cword(self, bus, addr, offset, byte): + return osutil.seti2cword(bus, addr, offset, byte) + + def set_i2c(self, bus, addr, offset, byte): + return self.seti2c(bus, addr, offset, byte) + + def seti2c(self, bus, addr, offset, byte): + ret, val = osutil.rji2cset(bus, addr, offset, byte) + return ret, val + + def getbcmtemp(self): + try: + sta, ret = osutil.getmactemp() + if sta == True: + mac_aver = float(ret.get("average", self.__error_ret)) + #mac_max = float(ret.get("maximum", self.__error_ret)) + mac_aver = mac_aver * 1000 + #mac_max = mac_max * 1000 + else: + return False, ret + except AttributeError as e: + return False, str(e) + return True, mac_aver + + def getbcmreg(self, reg): + ret, val = osutil.getsdkreg(reg) + return ret, val + + def logger_debug(self, msg): + baseutil.logger_debug(msg) + + def command(self, cmd): + ret, output = osutil.command(cmd) + return ret, output + + def set_val(self, val): + # TODO + pass diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/rotor.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/rotor.py new file mode 100644 index 000000000000..3e5bcc5b9b9a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/rotor.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- + +try: + from sonic_platform.regutil import Reg + from sonic_platform.logger import logger +except ImportError: + raise ImportError(str(e) + "- required module not found") + +class Rotor: + def __init__(self, config): + if config is not None and isinstance(config, dict): + self.__reg_speed_getter = Reg(config.get("speed_getter")) + self.__reg_speed_setter = Reg(config.get("speed_setter")) + self.__speed_max = config.get("speed_max") + else: + raise ValueError("init rotor Error: {}".format(config)) + + def get_speed(self): + try: + return int(self.__reg_speed_getter.decode()) + except Exception as e: + logger.error(str(e)) + + return 0 + + def set_speed(self, speed): + try: + return self.__reg_speed_setter.encode(speed) + except Exception as e: + logger.error(str(e)) + + return False + + def get_speed_percentage(self): + try: + speed = self.get_speed() + return (100 * speed) / self.__speed_max + except Exception as e: + logger.error(str(e)) + + return 0 diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/sfp.py new file mode 100644 index 000000000000..ea8e256fe6ef --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/sfp.py @@ -0,0 +1,287 @@ +#!/usr/bin/env python + +try: + #from sonic_platform_pddf_base.pddf_sfp import * + from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId + from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom + from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId + from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom + from sonic_platform_pddf_base.pddf_sfp import PddfSfp + from sonic_platform_pddf_base.pddf_sfp import SFP_VOLT_OFFSET + from sonic_platform_pddf_base.pddf_sfp import SFP_VOLT_WIDTH + from sonic_platform_pddf_base.pddf_sfp import SFP_CHANNL_MON_OFFSET + from sonic_platform_pddf_base.pddf_sfp import SFP_CHANNL_MON_WIDTH + from sonic_platform_pddf_base.pddf_sfp import SFP_TEMPE_OFFSET + from sonic_platform_pddf_base.pddf_sfp import SFP_TEMPE_WIDTH + from sonic_platform_pddf_base.pddf_sfp import QSFP_DOM_REV_OFFSET + from sonic_platform_pddf_base.pddf_sfp import QSFP_DOM_REV_WIDTH + from sonic_platform_pddf_base.pddf_sfp import QSFP_CHANNL_MON_OFFSET + from sonic_platform_pddf_base.pddf_sfp import QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +XCVR_DOM_CAPABILITY_OFFSET = 92 +XCVR_DOM_CAPABILITY_WIDTH = 2 +QSFP_VERSION_COMPLIANCE_OFFSET = 1 +QSFP_VERSION_COMPLIANCE_WIDTH = 2 +QSFP_OPTION_VALUE_OFFSET = 192 +QSFP_OPTION_VALUE_WIDTH = 4 + +class Sfp(PddfSfp): + """ + PDDF Platform-Specific Sfp class + """ + + def __init__(self, index, pddf_data=None, pddf_plugin_data=None): + PddfSfp.__init__(self, index, pddf_data, pddf_plugin_data) + self.dom_supported = False + self.__dom_capability_detect() + + def __dom_capability_detect(self): + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.qsfp_page3_available = False + self.calibration = 0 + if not self.get_presence(): + return + + if self.is_osfp_port: + # Not implement + return + elif self.is_qsfp_port: + self.calibration = 1 + sfpi_obj = sff8436InterfaceId() + if sfpi_obj is None: + self.dom_supported = False + offset = 128 + + # QSFP capability byte parse, through this byte can know whether it support tx_power or not. + # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, + # need to add more code for determining the capability and version compliance + # in SFF-8636 dom capability definitions evolving with the versions. + qsfp_dom_capability_raw = self.__read_eeprom_specific_bytes( + (offset + XCVR_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH) + if qsfp_dom_capability_raw is not None: + qsfp_version_compliance_raw = self.__read_eeprom_specific_bytes( + QSFP_VERSION_COMPLIANCE_OFFSET, QSFP_VERSION_COMPLIANCE_WIDTH) + qsfp_version_compliance = int( + qsfp_version_compliance_raw[0], 16) + dom_capability = sfpi_obj.parse_dom_capability( + qsfp_dom_capability_raw, 0) + if qsfp_version_compliance >= 0x08: + self.dom_temp_supported = dom_capability['data']['Temp_support']['value'] == 'On' + self.dom_volt_supported = dom_capability['data']['Voltage_support']['value'] == 'On' + self.dom_rx_power_supported = dom_capability['data']['Rx_power_support']['value'] == 'On' + self.dom_tx_power_supported = dom_capability['data']['Tx_power_support']['value'] == 'On' + else: + self.dom_temp_supported = True + self.dom_volt_supported = True + self.dom_rx_power_supported = dom_capability['data']['Rx_power_support']['value'] == 'On' + self.dom_tx_power_supported = True + + self.dom_supported = True + self.calibration = 1 + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + qsfp_option_value_raw = self.__read_eeprom_specific_bytes( + QSFP_OPTION_VALUE_OFFSET, QSFP_OPTION_VALUE_WIDTH) + if qsfp_option_value_raw is not None: + optional_capability = sfpd_obj.parse_option_params( + qsfp_option_value_raw, 0) + self.dom_tx_disable_supported = optional_capability[ + 'data']['TxDisable']['value'] == 'On' + dom_status_indicator = sfpd_obj.parse_dom_status_indicator( + qsfp_version_compliance_raw, 1) + self.qsfp_page3_available = dom_status_indicator['data']['FlatMem']['value'] == 'Off' + else: + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.calibration = 0 + self.qsfp_page3_available = False + else: + sfpi_obj = sff8472InterfaceId() + if sfpi_obj is None: + return None + sfp_dom_capability_raw = self.__read_eeprom_specific_bytes( + XCVR_DOM_CAPABILITY_OFFSET, XCVR_DOM_CAPABILITY_WIDTH) + if sfp_dom_capability_raw is not None: + sfp_dom_capability = int(sfp_dom_capability_raw[0], 16) + self.dom_supported = (sfp_dom_capability & 0x40 != 0) + if self.dom_supported: + self.dom_temp_supported = True + self.dom_volt_supported = True + self.dom_rx_power_supported = True + self.dom_tx_power_supported = True + if sfp_dom_capability & 0x20 != 0: + self.calibration = 1 + elif sfp_dom_capability & 0x10 != 0: + self.calibration = 2 + else: + self.calibration = 0 + else: + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.calibration = 0 + self.dom_tx_disable_supported = ( + int(sfp_dom_capability_raw[1], 16) & 0x40 != 0) + + # Provide the functions/variables below for which implementation is to be overwritten + + def __read_eeprom_specific_bytes(self, offset, num_bytes): + eeprom_raw = [] + if not self.get_presence(): + return None + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + try: + with open(self.eeprom_path, mode="rb", buffering=0) as eeprom: + eeprom.seek(offset) + raw = eeprom.read(num_bytes) + except Exception as e: + print("Error: Unable to open eeprom_path: %s" % (str(e))) + return None + + try: + if len(raw) == 0: + return None + for n in range(0, num_bytes): + eeprom_raw[n] = hex(raw[n])[2:].zfill(2) + except Exception as e: + print("Error: Exception info: %s" % (str(e))) + return None + + return eeprom_raw + + def get_transceiver_bulk_status(self): + # check present status + if not self.get_presence(): + return None + self.__dom_capability_detect() + + xcvr_dom_info_dict = dict.fromkeys(self.dom_dict_keys, 'N/A') + + if self.is_osfp_port: + # Below part is added to avoid fail xcvrd, shall be implemented later + pass + elif self.is_qsfp_port: + # QSFPs + xcvr_dom_info_dict = super(Sfp, self).get_transceiver_bulk_status() + + # pddf_sfp "qsfp_tx_power_support != 'on'" is wrong + + offset = 0 + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + qsfp_dom_rev_raw = self.__read_eeprom_specific_bytes((offset + QSFP_DOM_REV_OFFSET), QSFP_DOM_REV_WIDTH) + if qsfp_dom_rev_raw is not None: + qsfp_dom_rev_data = sfpd_obj.parse_sfp_dom_rev(qsfp_dom_rev_raw, 0) + else: + return None + + dom_channel_monitor_data = {} + qsfp_dom_rev = qsfp_dom_rev_data['data']['dom_rev']['value'] + + if (qsfp_dom_rev[0:8] == 'SFF-8636' and self.dom_tx_power_supported is True): + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power( + dom_channel_monitor_raw, 0) + else: + return None + + xcvr_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TX1Power']['value'] + xcvr_dom_info_dict['tx2power'] = dom_channel_monitor_data['data']['TX2Power']['value'] + xcvr_dom_info_dict['tx3power'] = dom_channel_monitor_data['data']['TX3Power']['value'] + xcvr_dom_info_dict['tx4power'] = dom_channel_monitor_data['data']['TX4Power']['value'] + else: + # SFPs + offset = 256 + if not self.dom_supported: + return xcvr_dom_info_dict + + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return None + + sfpd_obj._calibration_type = self.calibration + + dom_temperature_raw = self.__read_eeprom_specific_bytes((offset + SFP_TEMPE_OFFSET), SFP_TEMPE_WIDTH) + if dom_temperature_raw is not None: + dom_temperature_data = sfpd_obj.parse_temperature(dom_temperature_raw, 0) + else: + return None + + dom_voltage_raw = self.__read_eeprom_specific_bytes((offset + SFP_VOLT_OFFSET), SFP_VOLT_WIDTH) + if dom_voltage_raw is not None: + dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) + else: + return None + + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params(dom_channel_monitor_raw, 0) + else: + return None + + xcvr_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] + xcvr_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] + xcvr_dom_info_dict['rx1power'] = dom_channel_monitor_data['data']['RXPower']['value'] + xcvr_dom_info_dict['rx2power'] = 'N/A' + xcvr_dom_info_dict['rx3power'] = 'N/A' + xcvr_dom_info_dict['rx4power'] = 'N/A' + xcvr_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TXBias']['value'] + xcvr_dom_info_dict['tx2bias'] = 'N/A' + xcvr_dom_info_dict['tx3bias'] = 'N/A' + xcvr_dom_info_dict['tx4bias'] = 'N/A' + xcvr_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TXPower']['value'] + xcvr_dom_info_dict['tx2power'] = 'N/A' + xcvr_dom_info_dict['tx3power'] = 'N/A' + xcvr_dom_info_dict['tx4power'] = 'N/A' + + xcvr_dom_info_dict['rx_los'] = self.get_rx_los() + xcvr_dom_info_dict['tx_fault'] = self.get_tx_fault() + xcvr_dom_info_dict['reset_status'] = self.get_reset_status() + xcvr_dom_info_dict['lp_mode'] = self.get_lpmode() + + return xcvr_dom_info_dict + + def get_transceiver_threshold_info(self): + # check present status + if not self.get_presence(): + return None + self.__dom_capability_detect() + + xcvr_dom_threshold_info_dict = dict.fromkeys(self.threshold_dict_keys, 'N/A') + + if self.is_osfp_port: + # Below part is added to avoid fail xcvrd, shall be implemented later + pass + elif self.is_qsfp_port: + # QSFPs + if not self.dom_supported or not self.qsfp_page3_available: + return xcvr_dom_threshold_info_dict + + return super(Sfp, self).get_transceiver_threshold_info() + + else: + # SFPs + if not self.dom_supported: + return xcvr_dom_threshold_info_dict + + return super(Sfp, self).get_transceiver_threshold_info() + + return xcvr_dom_threshold_info_dict diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/thermal.py new file mode 100644 index 000000000000..99b743c6d343 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/thermal.py @@ -0,0 +1,14 @@ +try: + from sonic_platform_pddf_base.pddf_thermal import PddfThermal +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + + +class Thermal(PddfThermal): + """PDDF Platform-Specific Thermal class""" + + def __init__(self, index, pddf_data=None, pddf_plugin_data=None): + PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/watchdog.py new file mode 100644 index 000000000000..37788c2c821e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/sonic_platform/watchdog.py @@ -0,0 +1,21 @@ +############################################################################# +# +# Module contains an implementation of platform specific watchdog API's +# +############################################################################# + +try: + from sonic_platform_pddf_base.pddf_watchdog import PddfWatchdog +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +class Watchdog(PddfWatchdog): + """ + PDDF Platform-specific Chassis class + """ + + def __init__(self): + PddfWatchdog.__init__(self) + self.timeout= 180 + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/systemd/pddf-platform-init.service b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/systemd/pddf-platform-init.service new file mode 120000 index 000000000000..0fd9f25b6c5e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-ragile/ra-b6920-4s/systemd/pddf-platform-init.service @@ -0,0 +1 @@ +../../../../pddf/i2c/service/pddf-platform-init.service \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/sfp.py index 41c2b63c05d8..16133ecc9358 100644 --- a/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-ruijie/b6510-48vs8cq/sonic_platform/sfp.py @@ -179,7 +179,7 @@ def __init__(self, index): for x in range(PORT_START, PORTS_IN_BLOCK): self.port_to_i2cbus_mapping[x] = (x + EEPROM_OFFSET) - self.info_dict_keys = ['type', 'hardware_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', + self.info_dict_keys = ['type', 'vendor_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', 'vendor_date', 'vendor_oui'] self.dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', 'lp_mode', 'tx_disable', 'tx_disabled_channel', 'temperature', 'voltage', @@ -437,7 +437,7 @@ def get_transceiver_info(self): keys |Value Format |Information ---------------------------|---------------|---------------------------- type |1*255VCHAR |type of SFP - hardware_rev |1*255VCHAR |hardware version of SFP + vendor_rev |1*255VCHAR |vendor revision of SFP serial |1*255VCHAR |serial number of the SFP manufacturer |1*255VCHAR |SFP vendor name model |1*255VCHAR |SFP model name @@ -526,7 +526,7 @@ def get_transceiver_info(self): transceiver_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value'] transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] transceiver_info_dict['vendor_date'] = sfp_vendor_date_data[ diff --git a/platform/cavium/docker-syncd-cavm-rpc.mk b/platform/cavium/docker-syncd-cavm-rpc.mk index a49f12fb38be..b6add4424692 100644 --- a/platform/cavium/docker-syncd-cavm-rpc.mk +++ b/platform/cavium/docker-syncd-cavm-rpc.mk @@ -17,7 +17,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CAVM_RPC) endif $(DOCKER_SYNCD_CAVM_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_CAVM_RPC)_VERSION = 1.0.0-rpc +$(DOCKER_SYNCD_CAVM_RPC)_VERSION = 1.0.0+rpc $(DOCKER_SYNCD_CAVM_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_CAVM_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_CAVM_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/centec-arm64/.gitignore b/platform/centec-arm64/.gitignore new file mode 100644 index 000000000000..3f49bb077eb4 --- /dev/null +++ b/platform/centec-arm64/.gitignore @@ -0,0 +1,10 @@ +*.ko.cmd +*.ko +*.mod.c +*.mod.o +modules.order +Module.symvers +.tmp_versions +*.o +*.o.cmd +*.o.d diff --git a/platform/centec-arm64/docker-saiserver-centec.dep b/platform/centec-arm64/docker-saiserver-centec.dep new file mode 100644 index 000000000000..34e9ef1ee5b5 --- /dev/null +++ b/platform/centec-arm64/docker-saiserver-centec.dep @@ -0,0 +1,10 @@ + +DPATH := $($(DOCKER_SAISERVER_CENTEC)_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/centec-arm64/docker-saiserver-centec.mk platform/centec-arm64/docker-saiserver-centec.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(DPATH)) + +$(DOCKER_SAISERVER_CENTEC)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_SAISERVER_CENTEC)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_SAISERVER_CENTEC)_DEP_FILES := $(DEP_FILES) + diff --git a/platform/centec-arm64/docker-saiserver-centec.mk b/platform/centec-arm64/docker-saiserver-centec.mk index 8d1b11bf005e..78b7f44d7fbd 100755 --- a/platform/centec-arm64/docker-saiserver-centec.mk +++ b/platform/centec-arm64/docker-saiserver-centec.mk @@ -3,7 +3,6 @@ DOCKER_SAISERVER_CENTEC = docker-saiserver-centec.gz $(DOCKER_SAISERVER_CENTEC)_PATH = $(PLATFORM_PATH)/docker-saiserver-centec $(DOCKER_SAISERVER_CENTEC)_DEPENDS += $(SAISERVER) -$(DOCKER_SAISERVER_CENTEC)_FILES += $(DSSERVE) $(BCMCMD) $(DOCKER_SAISERVER_CENTEC)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_CENTEC) @@ -13,3 +12,5 @@ $(DOCKER_SAISERVER_CENTEC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SAISERVER_CENTEC)_RUN_OPT += -v /var/run/docker-saiserver:/var/run/sswsyncd $(DOCKER_SAISERVER_CENTEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_SAISERVER_CENTEC)_RUN_OPT += -v /host/warmboot:/var/warmboot + +SONIC_BUSTER_DOCKERS += $(DOCKER_SAISERVER_CENTEC) diff --git a/platform/centec-arm64/docker-saiserver-centec/Dockerfile.j2 b/platform/centec-arm64/docker-saiserver-centec/Dockerfile.j2 new file mode 100644 index 000000000000..264c8437973d --- /dev/null +++ b/platform/centec-arm64/docker-saiserver-centec/Dockerfile.j2 @@ -0,0 +1,33 @@ +FROM docker-config-engine-buster + +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update \ + && apt-get -y install \ + libboost-atomic1.71-dev \ + libqt5core5a \ + libqt5network5 + +COPY \ +{% for deb in docker_saiserver_centec_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ +{% for deb in docker_saiserver_centec_debs.split(' ') -%} +dpkg_apt debs/{{ deb }}{{'; '}} +{%- endfor %} + +COPY ["start.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/centec-arm64/docker-saiserver-centec/start.sh b/platform/centec-arm64/docker-saiserver-centec/start.sh new file mode 100755 index 000000000000..936f43cd1f06 --- /dev/null +++ b/platform/centec-arm64/docker-saiserver-centec/start.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +start_centec() +{ +} + + +rm -f /var/run/rsyslogd.pid + +supervisorctl start rsyslogd + +start_centec + +supervisorctl start saiserver diff --git a/platform/centec-arm64/docker-saiserver-centec/supervisord.conf b/platform/centec-arm64/docker-saiserver-centec/supervisord.conf new file mode 100644 index 000000000000..ccb107b3d1f8 --- /dev/null +++ b/platform/centec-arm64/docker-saiserver-centec/supervisord.conf @@ -0,0 +1,28 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:saiserver] +command=/usr/sbin/saiserver -p /usr/share/sonic/hwsku/sai.profile -f /usr/share/sonic/hwsku/port_config.ini +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/platform/centec-arm64/docker-syncd-centec-rpc.mk b/platform/centec-arm64/docker-syncd-centec-rpc.mk index 7b6be9cdb3cc..a2d4f9287735 100755 --- a/platform/centec-arm64/docker-syncd-centec-rpc.mk +++ b/platform/centec-arm64/docker-syncd-centec-rpc.mk @@ -2,7 +2,7 @@ DOCKER_SYNCD_CENTEC_RPC = docker-syncd-centec-rpc.gz $(DOCKER_SYNCD_CENTEC_RPC)_PATH = $(PLATFORM_PATH)/docker-syncd-centec-rpc -$(DOCKER_SYNCD_CENTEC_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) +$(DOCKER_SYNCD_CENTEC_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT) $(PTF) $(DOCKER_SYNCD_CENTEC_RPC)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) ifeq ($(INSTALL_DEBUG_TOOLS), y) $(DOCKER_SYNCD_CENTEC_RPC)_DEPENDS += $(SYNCD_RPC_DBG) \ @@ -17,9 +17,11 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC_RPC) endif $(DOCKER_SYNCD_CENTEC_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_CENTEC_RPC)_VERSION = 1.0.0-rpc +$(DOCKER_SYNCD_CENTEC_RPC)_VERSION = 1.0.0+rpc $(DOCKER_SYNCD_CENTEC_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro -$(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /host/warmboot:/var/warmboot + +SONIC_BUSTER_DOCKERS += $(DOCKER_SYNCD_CENTEC_RPC) diff --git a/platform/centec-arm64/docker-syncd-centec-rpc/Dockerfile.j2 b/platform/centec-arm64/docker-syncd-centec-rpc/Dockerfile.j2 index bec9c7f4426b..a760c278396a 100755 --- a/platform/centec-arm64/docker-syncd-centec-rpc/Dockerfile.j2 +++ b/platform/centec-arm64/docker-syncd-centec-rpc/Dockerfile.j2 @@ -2,6 +2,11 @@ FROM docker-syncd-centec ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update \ + && apt-get -y install \ + libboost-atomic1.71-dev \ + libqt5core5a \ + libqt5network5 COPY \ {% for deb in docker_syncd_centec_rpc_debs.split(' ') -%} diff --git a/platform/centec-arm64/libsaithrift-dev.mk b/platform/centec-arm64/libsaithrift-dev.mk index 5b63dbbf7a29..ff7fd9bc70ec 100755 --- a/platform/centec-arm64/libsaithrift-dev.mk +++ b/platform/centec-arm64/libsaithrift-dev.mk @@ -4,7 +4,7 @@ SAI_VER = 0.9.4 LIBSAITHRIFT_DEV = libsaithrift-dev_$(SAI_VER)_$(CONFIGURED_ARCH).deb $(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI -$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(CENTEC_SAI) +$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(CENTEC_SAI) $(LIBHIREDIS) $(LIBNL3_DEV) $(LIBNL_GENL3_DEV) $(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT) $(CENTEC_SAI) SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV) @@ -12,7 +12,7 @@ PYTHON_SAITHRIFT = python-saithrift_$(SAI_VER)_$(CONFIGURED_ARCH).deb $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(PYTHON_SAITHRIFT))) SAISERVER = saiserver_$(SAI_VER)_$(CONFIGURED_ARCH).deb -$(SAISERVER)_RDEPENDS += $(LIBTHRIFT) $(CENTEC_SAI) +$(SAISERVER)_RDEPENDS += $(LIBTHRIFT) $(CENTEC_SAI) $(LIBHIREDIS) $(LIBNL3_DEV) $(LIBNL_GENL3_DEV) $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER))) SAISERVER_DBG = saiserver-dbg_$(SAI_VER)_$(CONFIGURED_ARCH).deb diff --git a/platform/centec-arm64/modules b/platform/centec-arm64/modules index 30cdc339d8de..e980c08f5802 100644 --- a/platform/centec-arm64/modules +++ b/platform/centec-arm64/modules @@ -10,7 +10,6 @@ rtc-sd2405 ctc5236_switch ctc5236_mdio ctcmac -ctcmac_test ctc5236-mc ctc_wdt ehci-ctc @@ -20,3 +19,4 @@ pwm-ctc ext4 overlay squashfs +mars diff --git a/platform/centec-arm64/rules.mk b/platform/centec-arm64/rules.mk index 1982f86b757c..9873e8b31ceb 100755 --- a/platform/centec-arm64/rules.mk +++ b/platform/centec-arm64/rules.mk @@ -1,6 +1,7 @@ include $(PLATFORM_PATH)/sai.mk include $(PLATFORM_PATH)/docker-syncd-centec.mk include $(PLATFORM_PATH)/docker-syncd-centec-rpc.mk +include $(PLATFORM_PATH)/docker-saiserver-centec.mk include $(PLATFORM_PATH)/one-image.mk include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/tsingma-bsp.mk diff --git a/platform/centec-arm64/sai.mk b/platform/centec-arm64/sai.mk index cef055447435..a6fd05c858c0 100755 --- a/platform/centec-arm64/sai.mk +++ b/platform/centec-arm64/sai.mk @@ -1,6 +1,6 @@ # Centec SAI -export CENTEC_SAI_VERSION = 1.7.1-1 +export CENTEC_SAI_VERSION = 1.9.1-0 export CENTEC_SAI = libsai_$(CENTEC_SAI_VERSION)_$(PLATFORM_ARCH).deb $(CENTEC_SAI)_URL = https://github.com/CentecNetworks/sonic-binaries/raw/master/$(PLATFORM_ARCH)/sai/$(CENTEC_SAI) diff --git a/platform/centec-arm64/sonic-platform-modules-e530/24x2c/modules/Makefile b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/modules/Makefile index c1beeaa15c68..e7b2176d96ef 100644 --- a/platform/centec-arm64/sonic-platform-modules-e530/24x2c/modules/Makefile +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/modules/Makefile @@ -1 +1,3 @@ +KBUILD_EXTRA_SYMBOLS = /sonic/platform/centec-arm64/sonic-platform-modules-e530/pca954x/Module.symvers + obj-m := centec_e530_24x2c_platform.o diff --git a/platform/centec-arm64/sonic-platform-modules-e530/24x2c/modules/centec_e530_24x2c_platform.c b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/modules/centec_e530_24x2c_platform.c index 8c2437a2d071..f22794c15fc7 100644 --- a/platform/centec-arm64/sonic-platform-modules-e530/24x2c/modules/centec_e530_24x2c_platform.c +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2c/modules/centec_e530_24x2c_platform.c @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include @@ -129,7 +128,7 @@ static int e530_24x2c_init_i2c_gpio(void) return -1; } - i2c_client_gpio0 = i2c_new_device(i2c_adp_gpio0, &i2c_dev_gpio0); + i2c_client_gpio0 = i2c_new_client_device(i2c_adp_gpio0, &i2c_dev_gpio0); if(IS_INVALID_PTR(i2c_client_gpio0)) { i2c_client_gpio0 = NULL; @@ -145,7 +144,7 @@ static int e530_24x2c_init_i2c_gpio(void) return -1; } - i2c_client_gpio1 = i2c_new_device(i2c_adp_gpio1, &i2c_dev_gpio1); + i2c_client_gpio1 = i2c_new_client_device(i2c_adp_gpio1, &i2c_dev_gpio1); if(IS_INVALID_PTR(i2c_client_gpio1)) { i2c_client_gpio1 = NULL; @@ -161,7 +160,7 @@ static int e530_24x2c_init_i2c_gpio(void) return -1; } - i2c_client_gpio2 = i2c_new_device(i2c_adp_gpio2, &i2c_dev_gpio2); + i2c_client_gpio2 = i2c_new_client_device(i2c_adp_gpio2, &i2c_dev_gpio2); if(IS_INVALID_PTR(i2c_client_gpio2)) { i2c_client_gpio2 = NULL; diff --git a/platform/centec-arm64/sonic-platform-modules-e530/24x2q/modules/Makefile b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/modules/Makefile index 8736ed3a8d9b..612bed73c602 100644 --- a/platform/centec-arm64/sonic-platform-modules-e530/24x2q/modules/Makefile +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/modules/Makefile @@ -1 +1,3 @@ +KBUILD_EXTRA_SYMBOLS = /sonic/platform/centec-arm64/sonic-platform-modules-e530/pca954x/Module.symvers + obj-m := centec_e530_24x2q_platform.o diff --git a/platform/centec-arm64/sonic-platform-modules-e530/24x2q/modules/centec_e530_24x2q_platform.c b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/modules/centec_e530_24x2q_platform.c index 68830775e003..97c89027e970 100644 --- a/platform/centec-arm64/sonic-platform-modules-e530/24x2q/modules/centec_e530_24x2q_platform.c +++ b/platform/centec-arm64/sonic-platform-modules-e530/24x2q/modules/centec_e530_24x2q_platform.c @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include @@ -129,7 +128,7 @@ static int e530_24x2q_init_i2c_gpio(void) return -1; } - i2c_client_gpio0 = i2c_new_device(i2c_adp_gpio0, &i2c_dev_gpio0); + i2c_client_gpio0 = i2c_new_client_device(i2c_adp_gpio0, &i2c_dev_gpio0); if(IS_INVALID_PTR(i2c_client_gpio0)) { i2c_client_gpio0 = NULL; @@ -145,7 +144,7 @@ static int e530_24x2q_init_i2c_gpio(void) return -1; } - i2c_client_gpio1 = i2c_new_device(i2c_adp_gpio1, &i2c_dev_gpio1); + i2c_client_gpio1 = i2c_new_client_device(i2c_adp_gpio1, &i2c_dev_gpio1); if(IS_INVALID_PTR(i2c_client_gpio1)) { i2c_client_gpio1 = NULL; @@ -161,7 +160,7 @@ static int e530_24x2q_init_i2c_gpio(void) return -1; } - i2c_client_gpio2 = i2c_new_device(i2c_adp_gpio2, &i2c_dev_gpio2); + i2c_client_gpio2 = i2c_new_client_device(i2c_adp_gpio2, &i2c_dev_gpio2); if(IS_INVALID_PTR(i2c_client_gpio2)) { i2c_client_gpio2 = NULL; diff --git a/platform/centec-arm64/sonic-platform-modules-e530/48s4x/modules/Makefile b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/modules/Makefile index b3a639cc40b8..25a513cb5a29 100644 --- a/platform/centec-arm64/sonic-platform-modules-e530/48s4x/modules/Makefile +++ b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/modules/Makefile @@ -1 +1,3 @@ +KBUILD_EXTRA_SYMBOLS = /sonic/platform/centec-arm64/sonic-platform-modules-e530/pca954x/Module.symvers + obj-m := centec_e530_48s4x_platform.o diff --git a/platform/centec-arm64/sonic-platform-modules-e530/48s4x/modules/centec_e530_48s4x_platform.c b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/modules/centec_e530_48s4x_platform.c index 179db78738e5..4bae7ddc52dd 100644 --- a/platform/centec-arm64/sonic-platform-modules-e530/48s4x/modules/centec_e530_48s4x_platform.c +++ b/platform/centec-arm64/sonic-platform-modules-e530/48s4x/modules/centec_e530_48s4x_platform.c @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include @@ -197,7 +196,7 @@ static int e530_48s4x_init_i2c_gpio(void) return -1; } - i2c_client_gpio0 = i2c_new_device(i2c_adp_gpio0, &i2c_dev_gpio0); + i2c_client_gpio0 = i2c_new_client_device(i2c_adp_gpio0, &i2c_dev_gpio0); if(IS_INVALID_PTR(i2c_client_gpio0)) { i2c_client_gpio0 = NULL; @@ -213,7 +212,7 @@ static int e530_48s4x_init_i2c_gpio(void) return -1; } - i2c_client_gpio1 = i2c_new_device(i2c_adp_gpio1, &i2c_dev_gpio1); + i2c_client_gpio1 = i2c_new_client_device(i2c_adp_gpio1, &i2c_dev_gpio1); if(IS_INVALID_PTR(i2c_client_gpio1)) { i2c_client_gpio1 = NULL; @@ -274,7 +273,7 @@ static int e530_48s4x_init_i2c_epld(void) return -1; } - i2c_client_epld = i2c_new_device(i2c_adp_master, &i2c_dev_epld); + i2c_client_epld = i2c_new_client_device(i2c_adp_master, &i2c_dev_epld); if(IS_INVALID_PTR(i2c_client_epld)) { i2c_client_epld = NULL; diff --git a/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/modules/Makefile b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/modules/Makefile index 47327a1a0037..a0f8b48d38b4 100644 --- a/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/modules/Makefile +++ b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/modules/Makefile @@ -1 +1,3 @@ +KBUILD_EXTRA_SYMBOLS = /sonic/platform/centec-arm64/sonic-platform-modules-e530/pca954x/Module.symvers + obj-m := centec_e530_48t4x_p_platform.o diff --git a/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/modules/centec_e530_48t4x_p_platform.c b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/modules/centec_e530_48t4x_p_platform.c index 7f5584279ee9..b91e578de76b 100644 --- a/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/modules/centec_e530_48t4x_p_platform.c +++ b/platform/centec-arm64/sonic-platform-modules-e530/48t4x-p/modules/centec_e530_48t4x_p_platform.c @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include @@ -195,7 +194,7 @@ static int e530_48t4x_p_init_i2c_gpio(void) return -1; } - i2c_client_gpio0 = i2c_new_device(i2c_adp_gpio0, &i2c_dev_gpio0); + i2c_client_gpio0 = i2c_new_client_device(i2c_adp_gpio0, &i2c_dev_gpio0); if(IS_INVALID_PTR(i2c_client_gpio0)) { i2c_client_gpio0 = NULL; diff --git a/platform/centec-arm64/sonic-platform-modules-e530/debian/control b/platform/centec-arm64/sonic-platform-modules-e530/debian/control index 31abd51cdc2d..2e8becc2c718 100644 --- a/platform/centec-arm64/sonic-platform-modules-e530/debian/control +++ b/platform/centec-arm64/sonic-platform-modules-e530/debian/control @@ -7,20 +7,20 @@ Standards-Version: 3.9.3 Package: platform-modules-e530-48t4x-p Architecture: arm64 -Depends: linux-image-4.19.0-12-2-arm64-unsigned +Depends: linux-image-5.10.0-8-2-arm64-unsigned Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-e530-24x2c Architecture: arm64 -Depends: linux-image-4.19.0-12-2-arm64-unsigned +Depends: linux-image-5.10.0-8-2-arm64-unsigned Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-e530-48s4x Architecture: arm64 -Depends: linux-image-4.19.0-12-2-arm64-unsigned +Depends: linux-image-5.10.0-8-2-arm64-unsigned Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-e530-24x2q Architecture: arm64 -Depends: linux-image-4.19.0-12-2-arm64-unsigned +Depends: linux-image-5.10.0-8-2-arm64-unsigned Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-24x2c.init b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-24x2c.init index e508d52053e7..dc61f8e00fbd 100755 --- a/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-24x2c.init +++ b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-24x2c.init @@ -17,10 +17,6 @@ function install_python_api_package() device="/usr/share/sonic/device" platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) - rv=$(pip2 show sonic-platform > /dev/null 2>/dev/null) - if [ $? -ne 0 ]; then - rv=$(pip2 install $device/$platform/sonic_platform-1.0-py2-none-any.whl) - fi rv=$(pip3 show sonic-platform > /dev/null 2>/dev/null) if [ $? -ne 0 ]; then rv=$(pip3 install $device/$platform/sonic_platform-1.0-py3-none-any.whl) @@ -34,6 +30,7 @@ function load_kernel_modules() ifconfig eth0 hw ether $hwaddr fi depmod -a + modprobe ctc-i2c-mux-pca954x modprobe centec_e530_24x2c_platform modprobe fan-ctc5236 modprobe dal @@ -48,6 +45,7 @@ function remove_kernel_modules() modprobe -r dal modprobe -r fan-ctc5236 modprobe -r centec_e530_24x2c_platform + modprobe -r ctc-i2c-mux-pca954x } case "$1" in diff --git a/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-24x2c.install b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-24x2c.install index 567afa923ace..7c246f32f939 100644 --- a/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-24x2c.install +++ b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-24x2c.install @@ -1,2 +1 @@ -24x2c/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/arm64-centec_e530_24x2c-r0 24x2c/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/arm64-centec_e530_24x2c-r0 diff --git a/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-24x2q.init b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-24x2q.init index 60b3b69a1d38..b2eed3c72e09 100644 --- a/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-24x2q.init +++ b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-24x2q.init @@ -17,10 +17,6 @@ function install_python_api_package() device="/usr/share/sonic/device" platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) - rv=$(pip2 show sonic-platform > /dev/null 2>/dev/null) - if [ $? -ne 0 ]; then - rv=$(pip2 install $device/$platform/sonic_platform-1.0-py2-none-any.whl) - fi rv=$(pip3 show sonic-platform > /dev/null 2>/dev/null) if [ $? -ne 0 ]; then rv=$(pip3 install $device/$platform/sonic_platform-1.0-py3-none-any.whl) @@ -34,6 +30,7 @@ function load_kernel_modules() ifconfig eth0 hw ether $hwaddr fi depmod -a + modprobe ctc-i2c-mux-pca954x modprobe centec_e530_24x2q_platform modprobe fan-ctc5236 modprobe dal @@ -48,6 +45,7 @@ function remove_kernel_modules() modprobe -r dal modprobe -r fan-ctc5236 modprobe -r centec_e530_24x2q_platform + modprobe -r ctc-i2c-mux-pca954x } case "$1" in diff --git a/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-24x2q.install b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-24x2q.install index d572108887af..e57100ec5d91 100644 --- a/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-24x2q.install +++ b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-24x2q.install @@ -1,2 +1 @@ -24x2q/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/arm64-centec_e530_24x2q-r0 24x2q/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/arm64-centec_e530_24x2q-r0 diff --git a/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-48s4x.init b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-48s4x.init index 1fa1970f64d5..25cdbee7fdaa 100644 --- a/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-48s4x.init +++ b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-48s4x.init @@ -17,10 +17,6 @@ function install_python_api_package() device="/usr/share/sonic/device" platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) - rv=$(pip2 show sonic-platform > /dev/null 2>/dev/null) - if [ $? -ne 0 ]; then - rv=$(pip2 install $device/$platform/sonic_platform-1.0-py2-none-any.whl) - fi rv=$(pip3 show sonic-platform > /dev/null 2>/dev/null) if [ $? -ne 0 ]; then rv=$(pip3 install $device/$platform/sonic_platform-1.0-py3-none-any.whl) @@ -34,6 +30,7 @@ function load_kernel_modules() ifconfig eth0 hw ether $hwaddr fi depmod -a + modprobe ctc-i2c-mux-pca954x modprobe centec_e530_48s4x_platform modprobe fan-ctc5236 modprobe dal @@ -48,6 +45,7 @@ function remove_kernel_modules() modprobe -r dal modprobe -r fan-ctc5236 modprobe -r centec_e530_48s4x_platform + modprobe -r ctc-i2c-mux-pca954x } case "$1" in diff --git a/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-48s4x.install b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-48s4x.install index d319f3f65548..97296c90af70 100644 --- a/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-48s4x.install +++ b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-48s4x.install @@ -1,2 +1 @@ -48s4x/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/arm64-centec_e530_48s4x-r0 48s4x/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/arm64-centec_e530_48s4x-r0 diff --git a/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-48t4x-p.init b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-48t4x-p.init index cefacf6668b2..8e2a2bfbddcb 100755 --- a/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-48t4x-p.init +++ b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-48t4x-p.init @@ -17,10 +17,6 @@ function install_python_api_package() device="/usr/share/sonic/device" platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) - rv=$(pip2 show sonic-platform > /dev/null 2>/dev/null) - if [ $? -ne 0 ]; then - rv=$(pip2 install $device/$platform/sonic_platform-1.0-py2-none-any.whl) - fi rv=$(pip3 show sonic-platform > /dev/null 2>/dev/null) if [ $? -ne 0 ]; then rv=$(pip3 install $device/$platform/sonic_platform-1.0-py3-none-any.whl) @@ -34,6 +30,7 @@ function load_kernel_modules() ifconfig eth0 hw ether $hwaddr fi depmod -a + modprobe ctc-i2c-mux-pca954x modprobe centec_e530_48t4x_p_platform modprobe fan-ctc5236 modprobe dal @@ -48,6 +45,7 @@ function remove_kernel_modules() modprobe -r dal modprobe -r fan-ctc5236 modprobe -r centec_e530_48t4x_p_platform + modprobe -r ctc-i2c-mux-pca954x } case "$1" in diff --git a/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-48t4x-p.install b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-48t4x-p.install index 634e57f367ee..22fc8eca995e 100644 --- a/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-48t4x-p.install +++ b/platform/centec-arm64/sonic-platform-modules-e530/debian/platform-modules-e530-48t4x-p.install @@ -1,2 +1 @@ -48t4x-p/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/arm64-centec_e530_48t4x_p-r0 48t4x-p/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/arm64-centec_e530_48t4x_p-r0 diff --git a/platform/centec-arm64/sonic-platform-modules-e530/debian/rules b/platform/centec-arm64/sonic-platform-modules-e530/debian/rules index 0fb2c85a8b1b..5351f7f364b4 100755 --- a/platform/centec-arm64/sonic-platform-modules-e530/debian/rules +++ b/platform/centec-arm64/sonic-platform-modules-e530/debian/rules @@ -24,6 +24,7 @@ CLASSES_DIR := classes CONF_DIR := conf KDAL_DIR := ../../centec/centec-dal/ FAN_DIR := fan +PCA954X_DIR := pca954x %: dh $@ @@ -41,10 +42,12 @@ build: (for mod in $(FAN_DIR); do \ make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/; \ done) + (for mod in $(PCA954X_DIR); do \ + make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/; \ + done) (for mod in $(MODULE_DIRS); do \ make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ cd $${mod}; \ - python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ cd -; \ done) @@ -73,6 +76,7 @@ binary-indep: cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ cp $(MOD_SRC_DIR)/$(KDAL_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ cp $(MOD_SRC_DIR)/$(FAN_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + cp $(MOD_SRC_DIR)/$(PCA954X_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \ done) # Resuming debhelper scripts diff --git a/platform/centec-arm64/sonic-platform-modules-e530/pca954x/Makefile b/platform/centec-arm64/sonic-platform-modules-e530/pca954x/Makefile new file mode 100644 index 000000000000..0cd3701f1b7f --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/pca954x/Makefile @@ -0,0 +1 @@ +obj-m := ctc-i2c-mux-pca954x.o diff --git a/platform/centec-arm64/sonic-platform-modules-e530/pca954x/ctc-i2c-mux-pca954x.c b/platform/centec-arm64/sonic-platform-modules-e530/pca954x/ctc-i2c-mux-pca954x.c new file mode 100644 index 000000000000..3c14bae6654b --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/pca954x/ctc-i2c-mux-pca954x.c @@ -0,0 +1,581 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * I2C multiplexer + * + * Copyright (c) 2008-2009 Rodolfo Giometti + * Copyright (c) 2008-2009 Eurotech S.p.A. + * + * This module supports the PCA954x and PCA984x series of I2C multiplexer/switch + * chips made by NXP Semiconductors. + * This includes the: + * PCA9540, PCA9542, PCA9543, PCA9544, PCA9545, PCA9546, PCA9547, + * PCA9548, PCA9846, PCA9847, PCA9848 and PCA9849. + * + * These chips are all controlled via the I2C bus itself, and all have a + * single 8-bit register. The upstream "parent" bus fans out to two, + * four, or eight downstream busses or channels; which of these + * are selected is determined by the chip type and register contents. A + * mux can select only one sub-bus at a time; a switch can select any + * combination simultaneously. + * + * Based on: + * pca954x.c from Kumar Gala + * Copyright (C) 2006 + * + * Based on: + * pca954x.c from Ken Harrenstien + * Copyright (C) 2004 Google, Inc. (Ken Harrenstien) + * + * Based on: + * i2c-virtual_cb.c from Brian Kuschak + * and + * pca9540.c from Jean Delvare . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ctc-pca954x.h" + +#define PCA954X_MAX_NCHANS 8 + +#define PCA954X_IRQ_OFFSET 4 + +enum pca_type { + pca_9540, + pca_9542, + pca_9543, + pca_9544, + pca_9545, + pca_9546, + pca_9547, + pca_9548, + pca_9846, + pca_9847, + pca_9848, + pca_9849, +}; + +struct chip_desc { + u8 nchans; + u8 enable; /* used for muxes only */ + u8 has_irq; + enum muxtype { + pca954x_ismux = 0, + pca954x_isswi + } muxtype; + struct i2c_device_identity id; +}; + +struct pca954x { + const struct chip_desc *chip; + + u8 last_chan; /* last register value */ + /* MUX_IDLE_AS_IS, MUX_IDLE_DISCONNECT or >= 0 for channel */ + s32 idle_state; + + struct i2c_client *client; + + struct irq_domain *irq; + unsigned int irq_mask; + raw_spinlock_t lock; +}; + +/* Provide specs for the PCA954x types we know about */ +static const struct chip_desc chips[] = { + [pca_9540] = { + .nchans = 2, + .enable = 0x4, + .muxtype = pca954x_ismux, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9542] = { + .nchans = 2, + .enable = 0x4, + .has_irq = 1, + .muxtype = pca954x_ismux, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9543] = { + .nchans = 2, + .has_irq = 1, + .muxtype = pca954x_isswi, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9544] = { + .nchans = 4, + .enable = 0x4, + .has_irq = 1, + .muxtype = pca954x_ismux, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9545] = { + .nchans = 4, + .has_irq = 1, + .muxtype = pca954x_isswi, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9546] = { + .nchans = 4, + .muxtype = pca954x_isswi, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9547] = { + .nchans = 8, + .enable = 0x8, + .muxtype = pca954x_ismux, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9548] = { + .nchans = 8, + .muxtype = pca954x_isswi, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9846] = { + .nchans = 4, + .muxtype = pca954x_isswi, + .id = { + .manufacturer_id = I2C_DEVICE_ID_NXP_SEMICONDUCTORS, + .part_id = 0x10b, + }, + }, + [pca_9847] = { + .nchans = 8, + .enable = 0x8, + .muxtype = pca954x_ismux, + .id = { + .manufacturer_id = I2C_DEVICE_ID_NXP_SEMICONDUCTORS, + .part_id = 0x108, + }, + }, + [pca_9848] = { + .nchans = 8, + .muxtype = pca954x_isswi, + .id = { + .manufacturer_id = I2C_DEVICE_ID_NXP_SEMICONDUCTORS, + .part_id = 0x10a, + }, + }, + [pca_9849] = { + .nchans = 4, + .enable = 0x4, + .muxtype = pca954x_ismux, + .id = { + .manufacturer_id = I2C_DEVICE_ID_NXP_SEMICONDUCTORS, + .part_id = 0x109, + }, + }, +}; + +static const struct i2c_device_id pca954x_id[] = { + { "ctc_pca9540", pca_9540 }, + { "ctc_pca9542", pca_9542 }, + { "ctc_pca9543", pca_9543 }, + { "ctc_pca9544", pca_9544 }, + { "ctc_pca9545", pca_9545 }, + { "ctc_pca9546", pca_9546 }, + { "ctc_pca9547", pca_9547 }, + { "ctc_pca9548", pca_9548 }, + { "ctc_pca9846", pca_9846 }, + { "ctc_pca9847", pca_9847 }, + { "ctc_pca9848", pca_9848 }, + { "ctc_pca9849", pca_9849 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, pca954x_id); + +static const struct of_device_id pca954x_of_match[] = { + { .compatible = "nxp,ctc_pca9540", .data = &chips[pca_9540] }, + { .compatible = "nxp,ctc_pca9542", .data = &chips[pca_9542] }, + { .compatible = "nxp,ctc_pca9543", .data = &chips[pca_9543] }, + { .compatible = "nxp,ctc_pca9544", .data = &chips[pca_9544] }, + { .compatible = "nxp,ctc_pca9545", .data = &chips[pca_9545] }, + { .compatible = "nxp,ctc_pca9546", .data = &chips[pca_9546] }, + { .compatible = "nxp,ctc_pca9547", .data = &chips[pca_9547] }, + { .compatible = "nxp,ctc_pca9548", .data = &chips[pca_9548] }, + { .compatible = "nxp,ctc_pca9846", .data = &chips[pca_9846] }, + { .compatible = "nxp,ctc_pca9847", .data = &chips[pca_9847] }, + { .compatible = "nxp,ctc_pca9848", .data = &chips[pca_9848] }, + { .compatible = "nxp,ctc_pca9849", .data = &chips[pca_9849] }, + {} +}; +MODULE_DEVICE_TABLE(of, pca954x_of_match); + +/* Write to mux register. Don't use i2c_transfer()/i2c_smbus_xfer() + for this as they will try to lock adapter a second time */ +static int pca954x_reg_write(struct i2c_adapter *adap, + struct i2c_client *client, u8 val) +{ + union i2c_smbus_data dummy; + + return __i2c_smbus_xfer(adap, client->addr, client->flags, + I2C_SMBUS_WRITE, val, + I2C_SMBUS_BYTE, &dummy); +} + +static u8 pca954x_regval(struct pca954x *data, u8 chan) +{ + /* We make switches look like muxes, not sure how to be smarter. */ + if (data->chip->muxtype == pca954x_ismux) + return chan | data->chip->enable; + else + return 1 << chan; +} + +static int pca954x_select_chan(struct i2c_mux_core *muxc, u32 chan) +{ + struct pca954x *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + u8 regval; + int ret = 0; + + regval = pca954x_regval(data, chan); + /* Only select the channel if its different from the last channel */ + if (data->last_chan != regval) { + ret = pca954x_reg_write(muxc->parent, client, regval); + data->last_chan = ret < 0 ? 0 : regval; + } + + return ret; +} + +static int pca954x_deselect_mux(struct i2c_mux_core *muxc, u32 chan) +{ + struct pca954x *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + s32 idle_state; + + idle_state = READ_ONCE(data->idle_state); + if (idle_state >= 0) + /* Set the mux back to a predetermined channel */ + return pca954x_select_chan(muxc, idle_state); + + if (idle_state == MUX_IDLE_DISCONNECT) { + /* Deselect active channel */ + data->last_chan = 0; + return pca954x_reg_write(muxc->parent, client, + data->last_chan); + } + + /* otherwise leave as-is */ + + return 0; +} + +static ssize_t idle_state_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct pca954x *data = i2c_mux_priv(muxc); + + return sprintf(buf, "%d\n", READ_ONCE(data->idle_state)); +} + +static ssize_t idle_state_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct pca954x *data = i2c_mux_priv(muxc); + int val; + int ret; + + ret = kstrtoint(buf, 0, &val); + if (ret < 0) + return ret; + + if (val != MUX_IDLE_AS_IS && val != MUX_IDLE_DISCONNECT && + (val < 0 || val >= data->chip->nchans)) + return -EINVAL; + + i2c_lock_bus(muxc->parent, I2C_LOCK_SEGMENT); + + WRITE_ONCE(data->idle_state, val); + /* + * Set the mux into a state consistent with the new + * idle_state. + */ + if (data->last_chan || val != MUX_IDLE_DISCONNECT) + ret = pca954x_deselect_mux(muxc, 0); + + i2c_unlock_bus(muxc->parent, I2C_LOCK_SEGMENT); + + return ret < 0 ? ret : count; +} + +static DEVICE_ATTR_RW(idle_state); + +static irqreturn_t pca954x_irq_handler(int irq, void *dev_id) +{ + struct pca954x *data = dev_id; + unsigned long pending; + int ret, i; + + ret = i2c_smbus_read_byte(data->client); + if (ret < 0) + return IRQ_NONE; + + pending = (ret >> PCA954X_IRQ_OFFSET) & (BIT(data->chip->nchans) - 1); + for_each_set_bit(i, &pending, data->chip->nchans) + handle_nested_irq(irq_linear_revmap(data->irq, i)); + + return IRQ_RETVAL(pending); +} + +static int pca954x_irq_set_type(struct irq_data *idata, unsigned int type) +{ + if ((type & IRQ_TYPE_SENSE_MASK) != IRQ_TYPE_LEVEL_LOW) + return -EINVAL; + return 0; +} + +static struct irq_chip pca954x_irq_chip = { + .name = "i2c-mux-pca954x", + .irq_set_type = pca954x_irq_set_type, +}; + +static int pca954x_irq_setup(struct i2c_mux_core *muxc) +{ + struct pca954x *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + int c, irq; + + if (!data->chip->has_irq || client->irq <= 0) + return 0; + + raw_spin_lock_init(&data->lock); + + data->irq = irq_domain_add_linear(client->dev.of_node, + data->chip->nchans, + &irq_domain_simple_ops, data); + if (!data->irq) + return -ENODEV; + + for (c = 0; c < data->chip->nchans; c++) { + irq = irq_create_mapping(data->irq, c); + if (!irq) { + dev_err(&client->dev, "failed irq create map\n"); + return -EINVAL; + } + irq_set_chip_data(irq, data); + irq_set_chip_and_handler(irq, &pca954x_irq_chip, + handle_simple_irq); + } + + return 0; +} + +static void pca954x_cleanup(struct i2c_mux_core *muxc) +{ + struct pca954x *data = i2c_mux_priv(muxc); + int c, irq; + + if (data->irq) { + for (c = 0; c < data->chip->nchans; c++) { + irq = irq_find_mapping(data->irq, c); + irq_dispose_mapping(irq); + } + irq_domain_remove(data->irq); + } + i2c_mux_del_adapters(muxc); +} + +static int pca954x_init(struct i2c_client *client, struct pca954x *data) +{ + int ret; + + if (data->idle_state >= 0) + data->last_chan = pca954x_regval(data, data->idle_state); + else + data->last_chan = 0; /* Disconnect multiplexer */ + + ret = i2c_smbus_write_byte(client, data->last_chan); + if (ret < 0) + data->last_chan = 0; + + return ret; +} + +/* + * I2C init/probing/exit functions + */ +static int pca954x_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct i2c_adapter *adap = client->adapter; + struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev); + struct device *dev = &client->dev; + struct gpio_desc *gpio; + int num, force, class; + struct i2c_mux_core *muxc; + struct pca954x *data; + int ret; + + if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE)) + return -ENODEV; + + muxc = i2c_mux_alloc(adap, dev, PCA954X_MAX_NCHANS, sizeof(*data), 0, + pca954x_select_chan, pca954x_deselect_mux); + if (!muxc) + return -ENOMEM; + data = i2c_mux_priv(muxc); + + i2c_set_clientdata(client, muxc); + data->client = client; + + /* Reset the mux if a reset GPIO is specified. */ + gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(gpio)) + return PTR_ERR(gpio); + if (gpio) { + udelay(1); + gpiod_set_value_cansleep(gpio, 0); + /* Give the chip some time to recover. */ + udelay(1); + } + + data->chip = device_get_match_data(dev); + if (!data->chip) + data->chip = &chips[id->driver_data]; + + if (data->chip->id.manufacturer_id != I2C_DEVICE_ID_NONE) { + struct i2c_device_identity id; + + ret = i2c_get_device_id(client, &id); + if (ret && ret != -EOPNOTSUPP) + return ret; + + if (!ret && + (id.manufacturer_id != data->chip->id.manufacturer_id || + id.part_id != data->chip->id.part_id)) { + dev_warn(dev, "unexpected device id %03x-%03x-%x\n", + id.manufacturer_id, id.part_id, + id.die_revision); + return -ENODEV; + } + } + + data->idle_state = MUX_IDLE_AS_IS; + if (device_property_read_u32(dev, "idle-state", &data->idle_state)) { + if (device_property_read_bool(dev, "i2c-mux-idle-disconnect")) + data->idle_state = MUX_IDLE_DISCONNECT; + } + + /* + * Write the mux register at addr to verify + * that the mux is in fact present. This also + * initializes the mux to a channel + * or disconnected state. + */ + ret = pca954x_init(client, data); + if (ret < 0) { + dev_warn(dev, "probe failed\n"); + return -ENODEV; + } + + ret = pca954x_irq_setup(muxc); + if (ret) + goto fail_cleanup; + + /* Now create an adapter for each channel */ + for (num = 0; num < data->chip->nchans; num++) { + force = 0; /* dynamic adap number */ + class = 0; /* no class by default */ + if (pdata) { + if (num < pdata->num_modes) { + /* force static number */ + force = pdata->modes[num].adap_id; + class = pdata->modes[num].class; + } else + /* discard unconfigured channels */ + break; + } + + ret = i2c_mux_add_adapter(muxc, force, num, class); + if (ret) + goto fail_cleanup; + } + + if (data->irq) { + ret = devm_request_threaded_irq(dev, data->client->irq, + NULL, pca954x_irq_handler, + IRQF_ONESHOT | IRQF_SHARED, + "pca954x", data); + if (ret) + goto fail_cleanup; + } + + /* + * The attr probably isn't going to be needed in most cases, + * so don't fail completely on error. + */ + device_create_file(dev, &dev_attr_idle_state); + + dev_info(dev, "registered %d multiplexed busses for I2C %s %s\n", + num, data->chip->muxtype == pca954x_ismux + ? "mux" : "switch", client->name); + + return 0; + +fail_cleanup: + pca954x_cleanup(muxc); + return ret; +} + +static int pca954x_remove(struct i2c_client *client) +{ + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + + device_remove_file(&client->dev, &dev_attr_idle_state); + + pca954x_cleanup(muxc); + return 0; +} + +#ifdef CONFIG_PM_SLEEP +static int pca954x_resume(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct pca954x *data = i2c_mux_priv(muxc); + int ret; + + ret = pca954x_init(client, data); + if (ret < 0) + dev_err(&client->dev, "failed to verify mux presence\n"); + + return ret; +} +#endif + +static SIMPLE_DEV_PM_OPS(pca954x_pm, NULL, pca954x_resume); + +static struct i2c_driver pca954x_driver = { + .driver = { + .name = "ctc_pca954x", + .pm = &pca954x_pm, + .of_match_table = pca954x_of_match, + }, + .probe = pca954x_probe, + .remove = pca954x_remove, + .id_table = pca954x_id, +}; + +module_i2c_driver(pca954x_driver); + +MODULE_AUTHOR("Rodolfo Giometti "); +MODULE_DESCRIPTION("PCA954x I2C mux/switch driver"); +MODULE_LICENSE("GPL v2"); diff --git a/platform/centec-arm64/sonic-platform-modules-e530/pca954x/ctc-pca954x.h b/platform/centec-arm64/sonic-platform-modules-e530/pca954x/ctc-pca954x.h new file mode 100644 index 000000000000..eab9cdd990c9 --- /dev/null +++ b/platform/centec-arm64/sonic-platform-modules-e530/pca954x/ctc-pca954x.h @@ -0,0 +1,48 @@ +/* + * + * pca954x.h - I2C multiplexer/switch support + * + * Copyright (c) 2008-2009 Rodolfo Giometti + * Copyright (c) 2008-2009 Eurotech S.p.A. + * Michael Lawnick + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#ifndef _LINUX_I2C_PCA954X_H +#define _LINUX_I2C_PCA954X_H + +/* Platform data for the PCA954x I2C multiplexers */ + +/* Per channel initialisation data: + * @adap_id: bus number for the adapter. 0 = don't care + * @deselect_on_exit: set this entry to 1, if your H/W needs deselection + * of this channel after transaction. + * + */ +struct pca954x_platform_mode { + int adap_id; + unsigned int deselect_on_exit:1; + unsigned int class; +}; + +/* Per mux/switch data, used with i2c_register_board_info */ +struct pca954x_platform_data { + struct pca954x_platform_mode *modes; + int num_modes; +}; + +#endif /* _LINUX_I2C_PCA954X_H */ diff --git a/platform/centec-arm64/sonic_fit.its b/platform/centec-arm64/sonic_fit.its index 7ee89e6c812f..71b013ab3221 100644 --- a/platform/centec-arm64/sonic_fit.its +++ b/platform/centec-arm64/sonic_fit.its @@ -12,7 +12,7 @@ images { kernel_ctc { description = "ARM64 Kernel"; - data = /incbin/("./vmlinuz-4.19.0-12-2-arm64"); + data = /incbin/("./vmlinuz-5.10.0-8-2-arm64"); type = "kernel"; arch = "arm64"; os = "linux"; @@ -25,7 +25,7 @@ }; initramfs { description = "initramfs"; - data = /incbin/("./initrd.img-4.19.0-12-2-arm64"); + data = /incbin/("./initrd.img-5.10.0-8-2-arm64"); type = "ramdisk"; arch = "arm64"; os = "linux"; diff --git a/platform/centec-arm64/tsingma-bsp/debian/control b/platform/centec-arm64/tsingma-bsp/debian/control index fc6d0b8def4f..9be7aa41d47e 100644 --- a/platform/centec-arm64/tsingma-bsp/debian/control +++ b/platform/centec-arm64/tsingma-bsp/debian/control @@ -7,5 +7,5 @@ Standards-Version: 3.9.3 Package: tsingma-bsp Architecture: arm64 -Depends: linux-image-4.19.0-12-2-arm64-unsigned +Depends: linux-image-5.10.0-8-2-arm64-unsigned Description: kernel modules for tsingma bsp diff --git a/platform/centec-arm64/tsingma-bsp/debian/rules b/platform/centec-arm64/tsingma-bsp/debian/rules old mode 100644 new mode 100755 index 17788b62411a..39744906e3cf --- a/platform/centec-arm64/tsingma-bsp/debian/rules +++ b/platform/centec-arm64/tsingma-bsp/debian/rules @@ -15,7 +15,7 @@ PACKAGE_PRE_NAME := tsingma-bsp KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= ctc5236-mc ctc5236_switch ctcmac ctc_wdt ehci-ctc gpio-ctc i2c-ctc pinctrl-ctc pwm-ctc rtc-sd2405 sdhci-ctc5236 spi-ctc-qspi +MODULE_DIRS:= ctc5236-mc ctc5236_switch ctcmac ctc_wdt ehci-ctc gpio-ctc i2c-ctc pinctrl-ctc pwm-ctc rtc-sd2405 sdhci-ctc5236 spi-ctc-qspi ctc-phy DTS_DIR := ctc-dts MODULE_DIR := src UTILS_DIR := utils diff --git a/platform/centec-arm64/tsingma-bsp/debian/tsingma-bsp.install b/platform/centec-arm64/tsingma-bsp/debian/tsingma-bsp.install index e2fb35af1b6c..ea3262bff452 100644 --- a/platform/centec-arm64/tsingma-bsp/debian/tsingma-bsp.install +++ b/platform/centec-arm64/tsingma-bsp/debian/tsingma-bsp.install @@ -1,17 +1,17 @@ -src/ctc5236-mc/ctc5236-mc.ko /lib/modules/4.19.0-12-2-arm64/kernel/extra -src/pwm-ctc/pwm-ctc.ko /lib/modules/4.19.0-12-2-arm64/kernel/extra -src/ctc5236_switch/ctc5236_switch.ko /lib/modules/4.19.0-12-2-arm64/kernel/extra -src/pinctrl-ctc/pinctrl-ctc.ko /lib/modules/4.19.0-12-2-arm64/kernel/extra -src/ctc_wdt/ctc_wdt.ko /lib/modules/4.19.0-12-2-arm64/kernel/extra -src/ctcmac/ctcmac.ko /lib/modules/4.19.0-12-2-arm64/kernel/extra -src/ctcmac/ctcmac_test.ko /lib/modules/4.19.0-12-2-arm64/kernel/extra -src/ctcmac/ctc5236_mdio.ko /lib/modules/4.19.0-12-2-arm64/kernel/extra -src/i2c-ctc/i2c-ctc.ko /lib/modules/4.19.0-12-2-arm64/kernel/extra -src/gpio-ctc/gpio-ctc.ko /lib/modules/4.19.0-12-2-arm64/kernel/extra -src/ehci-ctc/ehci-ctc.ko /lib/modules/4.19.0-12-2-arm64/kernel/extra -src/rtc-sd2405/rtc-sd2405.ko /lib/modules/4.19.0-12-2-arm64/kernel/extra -src/sdhci-ctc5236/sdhci-ctc5236.ko /lib/modules/4.19.0-12-2-arm64/kernel/extra -src/spi-ctc-qspi/spi-ctc-qspi.ko /lib/modules/4.19.0-12-2-arm64/kernel/extra +src/ctc5236-mc/ctc5236-mc.ko /lib/modules/5.10.0-8-2-arm64/kernel/extra +src/pwm-ctc/pwm-ctc.ko /lib/modules/5.10.0-8-2-arm64/kernel/extra +src/ctc5236_switch/ctc5236_switch.ko /lib/modules/5.10.0-8-2-arm64/kernel/extra +src/pinctrl-ctc/pinctrl-ctc.ko /lib/modules/5.10.0-8-2-arm64/kernel/extra +src/ctc_wdt/ctc_wdt.ko /lib/modules/5.10.0-8-2-arm64/kernel/extra +src/ctcmac/ctcmac.ko /lib/modules/5.10.0-8-2-arm64/kernel/extra +src/ctcmac/ctc5236_mdio.ko /lib/modules/5.10.0-8-2-arm64/kernel/extra +src/ctc-phy/mars.ko /lib/modules/5.10.0-8-2-arm64/kernel/extra +src/i2c-ctc/i2c-ctc.ko /lib/modules/5.10.0-8-2-arm64/kernel/extra +src/gpio-ctc/gpio-ctc.ko /lib/modules/5.10.0-8-2-arm64/kernel/extra +src/ehci-ctc/ehci-ctc.ko /lib/modules/5.10.0-8-2-arm64/kernel/extra +src/rtc-sd2405/rtc-sd2405.ko /lib/modules/5.10.0-8-2-arm64/kernel/extra +src/sdhci-ctc5236/sdhci-ctc5236.ko /lib/modules/5.10.0-8-2-arm64/kernel/extra +src/spi-ctc-qspi/spi-ctc-qspi.ko /lib/modules/5.10.0-8-2-arm64/kernel/extra src/ctc-dts/e530-ctc5236.dtb /boot/ src/config/fw_env.config /etc/ src/config/tsingma-bsp.service /lib/systemd/system diff --git a/platform/centec-arm64/tsingma-bsp/src/ctc-dts/arm-gic.h b/platform/centec-arm64/tsingma-bsp/src/ctc-dts/arm-gic.h old mode 100644 new mode 100755 index 8c75d237d4b7..ef79498bdde5 --- a/platform/centec-arm64/tsingma-bsp/src/ctc-dts/arm-gic.h +++ b/platform/centec-arm64/tsingma-bsp/src/ctc-dts/arm-gic.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ /* * This header provides constants for the ARM GIC. */ diff --git a/platform/centec-arm64/tsingma-bsp/src/ctc-dts/ctc5236.dtsi b/platform/centec-arm64/tsingma-bsp/src/ctc-dts/ctc5236.dtsi old mode 100644 new mode 100755 index d92000612c29..41932f88b46c --- a/platform/centec-arm64/tsingma-bsp/src/ctc-dts/ctc5236.dtsi +++ b/platform/centec-arm64/tsingma-bsp/src/ctc-dts/ctc5236.dtsi @@ -88,7 +88,11 @@ memory-controller@30600000 { compatible = "ctc,ctc5236-ddr-ctrl"; reg = <0x0 0x30600000 0x0 0x100000>; - interrupts = ; + interrupts = , + , + , + ; + ctc,sysctrl = <&sysctrl>; }; sysctrl: sysctrl@33200000 { @@ -136,12 +140,15 @@ #size-cells = <2>; interrupt-parent = <&gic>; status = "disabled"; + local-mac-address = [00 00 00 00 00 00]; index = <0x00>; reg = <0x0 0x33410000 0x0 0x10000>, <0x0 0x33400000 0x0 0x10000>; interrupts = , , - ; + , + , + ; ctc,sysctrl = <&sysctrl>; }; @@ -152,12 +159,15 @@ #size-cells = <2>; interrupt-parent = <&gic>; status = "disabled"; + local-mac-address = [00 00 00 00 00 00]; index = <0x01>; reg = <0x0 0x33420000 0x0 0x10000>, <0x0 0x33400000 0x0 0x10000>; interrupts = , , - ; + , + , + ; ctc,sysctrl = <&sysctrl>; }; @@ -165,6 +175,7 @@ compatible = "ctc-ehci"; reg = <0x0 0x30500000 0x0 0x1000>; interrupts = ; + ctc,sysctrl = <&sysctrl>; status = "disabled"; }; @@ -172,7 +183,7 @@ compatible = "generic-ohci"; reg = <0x0 0x30580000 0x0 0x1000>; interrupts = ; - status = "disabled"; + status = "okay"; }; spi: spi@33100000 { @@ -188,7 +199,7 @@ status ="disabled"; }; - qspi: qspi@10000000 { + qspi: spi@10000000 { compatible = "ctc, igdaxi001a-qspi"; #address-cells = <1>; #size-cells = <0>; @@ -228,6 +239,8 @@ reg = <0x0 0x33700000 0x0 0x1000>; interrupts = ; clocks = <&i2c_clk>; + ctc,sysctrl = <&sysctrl>; + i2c-num = <0>; status ="disabled"; }; @@ -238,6 +251,8 @@ reg = <0x0 0x33701000 0x0 0x1000>; interrupts = ; clocks = <&i2c_clk>; + ctc,sysctrl = <&sysctrl>; + i2c-num = <1>; status ="disabled"; }; @@ -257,7 +272,8 @@ interrupt-names = "msi","aer","pme"; msi-parent = <&pcie>; bus-range = <0 0xff>; - ranges = <0x43000000 0 0x00000000 0 0x40000000 0 0x40000000>; + ranges = <0x42000000 0 0x00000000 0 0x40000000 0 0x20000000 + 0x02000000 0 0x20000000 0 0x60000000 0 0x20000000>; num-lanes = <1>; ctc,sysctrl = <&sysctrl>; status ="disabled"; @@ -338,6 +354,7 @@ reg = <0x0 0x33610000 0x0 0x10000>; #address-cells = <1>; #size-cells = <0>; + ctc,sysctrl = <&sysctrl>; porta: gpio-port@0 { compatible = "ctc,apb-gpio-porta"; @@ -368,7 +385,42 @@ ctc,pinctrl-bank0 = <16>; ctc,pinctrl-bank1 = <8>; ctc,sysctrl = <&sysctrl>; - status = "okay"; + + spi0 { + spi_pin: spi_pin { + ctc,pins = <0 0 PIN_FUNC_SPI>, + <0 2 PIN_FUNC_SPI>, + <0 3 PIN_FUNC_SPI>, + <0 4 PIN_FUNC_SPI>, + <0 5 PIN_FUNC_SPI>, + <0 6 PIN_FUNC_SPI>, + <0 7 PIN_FUNC_SPI>; + }; + }; + + uart2 { + uart2_pin: uart2_pin { + ctc,pins = <0 10 PIN_FUNC_UART>, + <0 11 PIN_FUNC_UART>, + <0 12 PIN_FUNC_UART>, + <0 13 PIN_FUNC_UART>, + <0 14 PIN_FUNC_UART>, + <0 15 PIN_FUNC_UART>; + }; + }; + + fc { + fc_pin: fc_pin { + ctc,pins = <1 0 PIN_FUNC_FC>, + <1 1 PIN_FUNC_FC>, + <1 2 PIN_FUNC_FC>, + <1 3 PIN_FUNC_FC>, + <1 4 PIN_FUNC_FC>, + <1 5 PIN_FUNC_FC>, + <1 6 PIN_FUNC_FC>, + <1 7 PIN_FUNC_FC>; + }; + }; }; }; diff --git a/platform/centec-arm64/tsingma-bsp/src/ctc-dts/e530-ctc5236.dts b/platform/centec-arm64/tsingma-bsp/src/ctc-dts/e530-ctc5236.dts index d8544666e2ce..422cf22fbae7 100644 --- a/platform/centec-arm64/tsingma-bsp/src/ctc-dts/e530-ctc5236.dts +++ b/platform/centec-arm64/tsingma-bsp/src/ctc-dts/e530-ctc5236.dts @@ -157,6 +157,7 @@ non-removable; no-sd; no-sdio; + cap-mmc-hw-reset; voltage-ranges = <3300 3300>; status = "okay"; }; @@ -187,7 +188,7 @@ &pinctrl { - spi { + spi0 { spi_pin: spi_pin { status = "disabled"; ctc,pins = <0 0 PIN_FUNC_SPI>, diff --git a/platform/centec-arm64/tsingma-bsp/src/ctc-dts/irq.h b/platform/centec-arm64/tsingma-bsp/src/ctc-dts/irq.h index 33a1003c55aa..9e3d183e1381 100644 --- a/platform/centec-arm64/tsingma-bsp/src/ctc-dts/irq.h +++ b/platform/centec-arm64/tsingma-bsp/src/ctc-dts/irq.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ /* * This header provides constants for most IRQ bindings. * diff --git a/platform/centec-arm64/tsingma-bsp/src/ctc-phy/Makefile b/platform/centec-arm64/tsingma-bsp/src/ctc-phy/Makefile new file mode 100644 index 000000000000..eb040d626d51 --- /dev/null +++ b/platform/centec-arm64/tsingma-bsp/src/ctc-phy/Makefile @@ -0,0 +1 @@ +obj-m = mars.o diff --git a/platform/centec-arm64/tsingma-bsp/src/ctc-phy/mars.c b/platform/centec-arm64/tsingma-bsp/src/ctc-phy/mars.c new file mode 100644 index 000000000000..675ba528fe68 --- /dev/null +++ b/platform/centec-arm64/tsingma-bsp/src/ctc-phy/mars.c @@ -0,0 +1,316 @@ +/* + * drivers/net/phy/mars.c + * + * Driver for Centec PHYs + * + * Author: liuht + * + * Copyright 2002-2018, Centec Networks (Suzhou) Co., Ltd. + * + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + /* Mask used for ID comparisons */ +#define CTC_PHY_ID_MASK 0xffffffff + +/* Known PHY IDs */ +#define CTC_PHY_ID_MARS1S_V1 0x00782013 +#define CTC_PHY_ID_MARS1S 0x01E04013 +#define CTC_PHY_ID_MARS1P_V1 0x00782011 +#define CTC_PHY_ID_MARS1P 0x01E04011 +#define CTC_PHY_IMASK 0x12 +#define CTC_PHY_IEVENT 0x13 + +#define CTC_PHY_IMASK_INIT 0x6c00 +#define CTC_PHY_IMASK_CLEAR 0x0000 + +#define CTC_PHY_REG_SPACE 0 +#define CTC_SDS_REG_SPACE 1 + +static int mars_ext_read(struct phy_device *phydev, u32 regnum) +{ + int ret; + + ret = phy_write(phydev, 0x1e, regnum); + if (ret < 0) + return ret; + + return phy_read(phydev, 0x1f); +} + +static int mars_ext_write(struct phy_device *phydev, u32 regnum, u16 val) +{ + int ret; + + ret = phy_write(phydev, 0x1e, regnum); + if (ret < 0) + return ret; + + return phy_write(phydev, 0x1f, val); +} + +static int mars_select_reg_space(struct phy_device *phydev, int space) +{ + int ret; + + if (space == CTC_PHY_REG_SPACE) { + ret = mars_ext_write(phydev, 0xa000, 0x0); + } else { + ret = mars_ext_write(phydev, 0xa000, 0x2); + } + + return ret; +} + +static int mars_config_advert(struct phy_device *phydev) +{ + int err, bmsr, changed = 0; + u32 adv; + + /* Only allow advertising what this PHY supports */ + linkmode_and(phydev->advertising, phydev->advertising, + phydev->supported); + + adv = linkmode_adv_to_mii_adv_t(phydev->advertising); + + /* Setup standard advertisement */ + err = phy_modify_changed(phydev, MII_ADVERTISE, + ADVERTISE_ALL | ADVERTISE_100BASE4 | + ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM, + adv); + if (err < 0) + return err; + if (err > 0) + changed = 1; + + bmsr = phy_read(phydev, MII_BMSR); + if (bmsr < 0) + return bmsr; + + /* Per 802.3-2008, Section 22.2.4.2.16 Extended status all + * 1000Mbits/sec capable PHYs shall have the BMSR_ESTATEN bit set to a + * logical 1. + */ + if (!(bmsr & BMSR_ESTATEN)) + return changed; + + adv = linkmode_adv_to_mii_ctrl1000_t(phydev->advertising); + + err = phy_modify_changed(phydev, MII_CTRL1000, + ADVERTISE_1000FULL | ADVERTISE_1000HALF, adv); + if (err < 0) + return err; + if (err > 0) + changed = 1; + + return changed; +} + +int mars1s_config_aneg(struct phy_device *phydev) +{ + int err, changed = 0; + + if (AUTONEG_ENABLE != phydev->autoneg) + return genphy_setup_forced(phydev); + + err = mars_config_advert(phydev); + if (err < 0) /* error */ + return err; + + changed |= err; + + if (changed == 0) { + /* Advertisement hasn't changed, but maybe aneg was never on to + * begin with? Or maybe phy was isolated? + */ + int ctl = phy_read(phydev, MII_BMCR); + + if (ctl < 0) + return ctl; + + if (!(ctl & BMCR_ANENABLE) || (ctl & BMCR_ISOLATE)) + changed = 1; /* do restart aneg */ + } + + /* Only restart aneg if we are advertising something different + * than we were before. + */ + if (changed > 0) + return genphy_restart_aneg(phydev); + + return 0; +} + +static int mars_ack_interrupt(struct phy_device *phydev) +{ + int err; + +#if 1 + /* Clear the interrupts by reading the reg */ + err = phy_read(phydev, CTC_PHY_IEVENT); +#else + err = mars_ext_read(phydev, 0xa011); +#endif + if (err < 0) + return err; + + return 0; +} + +static int mars_config_intr(struct phy_device *phydev) +{ + int err; + +#if 1 + if (phydev->interrupts == PHY_INTERRUPT_ENABLED) + err = phy_write(phydev, CTC_PHY_IMASK, CTC_PHY_IMASK_INIT); + else + err = phy_write(phydev, CTC_PHY_IMASK, CTC_PHY_IMASK_CLEAR); +#else + if (phydev->interrupts == PHY_INTERRUPT_ENABLED) + err = mars_ext_write(phydev, 0xa010, 0xffff); + else + err = mars_ext_write(phydev, 0xa010, 0x0000); +#endif + return err; +} + +#if 0 +static int mars_set_link_timer_6_3ms(struct phy_device *phydev) +{ + int ret = 0; + + ret = mars_select_reg_space(phydev, CTC_SDS_REG_SPACE); + if (!ret) + mars_ext_write(phydev, 0xa5, 0xc); + mars_select_reg_space(phydev, CTC_PHY_REG_SPACE); + + return 0; +} +#endif + +static int mars_set_link_timer_2_6ms(struct phy_device *phydev) +{ + int ret = 0; + + ret = mars_select_reg_space(phydev, CTC_SDS_REG_SPACE); + if (!ret) + mars_ext_write(phydev, 0xa5, 0x5); + mars_select_reg_space(phydev, CTC_PHY_REG_SPACE); + + return 0; +} + +int mars_config_init(struct phy_device *phydev) +{ + return mars_set_link_timer_2_6ms(phydev); +} + +int mars1p_config_init(struct phy_device *phydev) +{ + /*RGMII clock 2.5M when link down, bit12:1->0 */ + mars_ext_write(phydev, 0xc, 0x8051); + /*Disable sleep mode, bit15:1->0 */ + mars_ext_write(phydev, 0x27, 0x2029); + /* disable PHY to respond to MDIO access with PHYAD0 */ + /* MMD7 8001h: bit6: 0, change value: 0x7f --> 0x3f */ + phy_write(phydev, 0xd, 0x7); + phy_write(phydev, 0xe, 0x8001); + phy_write(phydev, 0xd, 0x4007); + phy_write(phydev, 0xe, 0x3f); + + return mars_set_link_timer_2_6ms(phydev); +} + +static struct phy_driver ctc_drivers[] = { + { + .phy_id = CTC_PHY_ID_MARS1S, + .phy_id_mask = CTC_PHY_ID_MASK, + .name = "CTC MARS1S", + .config_init = mars_config_init, + .features = PHY_GBIT_FEATURES, + .config_aneg = mars1s_config_aneg, + .ack_interrupt = &mars_ack_interrupt, + .config_intr = &mars_config_intr, + .read_status = genphy_read_status, + .suspend = genphy_suspend, + .resume = genphy_resume, + }, + { + .phy_id = CTC_PHY_ID_MARS1S_V1, + .phy_id_mask = CTC_PHY_ID_MASK, + .name = "CTC MARS1S_V1", + .config_init = mars_config_init, + .features = PHY_GBIT_FEATURES, + .config_aneg = mars1s_config_aneg, + .ack_interrupt = &mars_ack_interrupt, + .config_intr = &mars_config_intr, + .read_status = genphy_read_status, + .suspend = genphy_suspend, + .resume = genphy_resume, + }, + { + .phy_id = CTC_PHY_ID_MARS1P, + .phy_id_mask = CTC_PHY_ID_MASK, + .name = "CTC MARS1P", + .config_init = mars1p_config_init, + .features = PHY_GBIT_FEATURES, + .config_aneg = mars1s_config_aneg, + .ack_interrupt = &mars_ack_interrupt, + .config_intr = &mars_config_intr, + .read_status = genphy_read_status, + .suspend = genphy_suspend, + .resume = genphy_resume, + }, + { + .phy_id = CTC_PHY_ID_MARS1P_V1, + .phy_id_mask = CTC_PHY_ID_MASK, + .name = "CTC MARS1P_V1", + .config_init = mars1p_config_init, + .features = PHY_GBIT_FEATURES, + .config_aneg = mars1s_config_aneg, + .ack_interrupt = &mars_ack_interrupt, + .config_intr = &mars_config_intr, + .read_status = genphy_read_status, + .suspend = genphy_suspend, + .resume = genphy_resume, + }, +}; + +module_phy_driver(ctc_drivers); + +static struct mdio_device_id __maybe_unused mars_tbl[] = { + {CTC_PHY_ID_MARS1S, CTC_PHY_ID_MASK}, + {CTC_PHY_ID_MARS1S_V1, CTC_PHY_ID_MASK}, + {CTC_PHY_ID_MARS1P, CTC_PHY_ID_MASK}, + {CTC_PHY_ID_MARS1P_V1, CTC_PHY_ID_MASK}, + {} +}; + +MODULE_DEVICE_TABLE(mdio, mars_tbl); diff --git a/platform/centec-arm64/tsingma-bsp/src/ctc5236-mc/ctc5236-mc.c b/platform/centec-arm64/tsingma-bsp/src/ctc5236-mc/ctc5236-mc.c old mode 100644 new mode 100755 index 55c86b3a5626..0ecde7bff4fb --- a/platform/centec-arm64/tsingma-bsp/src/ctc5236-mc/ctc5236-mc.c +++ b/platform/centec-arm64/tsingma-bsp/src/ctc5236-mc/ctc5236-mc.c @@ -1,4 +1,5 @@ -/* Centec TsingMa Memory Controller Driver +/* + * Centec TsingMa Memory Contoller Driver * * Author: lius * @@ -22,22 +23,29 @@ #include #include #include +#include "../include/sysctl.h" +#include +#include struct ctc5236_mc { struct device *dev; void __iomem *base; int irq; - + int irq1; /* one bit ecc error irq num, only use in TM1.1 */ + int irq2; /* more than one bit ecc error irq num, only use in TM1.1 */ + int irq_cache_ecc; /* cache error interrupt */ + struct regmap *regmap_base; + unsigned int soc_ver; }; /* DDR interrupt enable register */ -#define DDR_ERR_INT_EN 0xF0 +#define DDR_ERR_INT_EN 0xF0 /* DDR interrupt status register */ -#define DDR_ERR_INT_STATUS 0xF4 +#define DDR_ERR_INT_STATUS 0xF4 /* over top-bound info register*/ -#define DDR_ERR_INT_OVER_TOPBOUND_L 0xF8 +#define DDR_ERR_INT_OVER_TOPBOUND_L 0xF8 #define DDR_ERR_INT_OVER_TOPBOUND_H 0xFC #define DDR_PORT0_ERR_INT_STATUS 0x1 @@ -45,15 +53,16 @@ struct ctc5236_mc { #define DDR_PORT2_ERR_INT_STATUS 0x3 #define DDR_PORT3_ERR_INT_STATUS 0x4 #define DDR_ERR_ECC_INT_STATUS 0x10000 +#define DDR_ERR_CRC_INT_STATUS 0x200000 #define DDR_ERR_WR_PORT_REC_UNDERFLOW 0x20000 #define DDR_ERR_WR_PORT_REC_OVERFLOW 0x40000 #define DDR_ERR_RD_PORT_REC_UNDERFLOW 0x80000 #define DDR_ERR_RD_PORT_REC_OVERFLOW 0x100000 -#define DDR_PORT0_STATUS 0xB0 -#define DDR_PORT1_STATUS 0xB4 -#define DDR_PORT2_STATUS 0xB8 -#define DDR_PORT3_STATUS 0xBC +#define DDR_PORT0_STATUS 0xB0 +#define DDR_PORT1_STATUS 0xB4 +#define DDR_PORT2_STATUS 0xB8 +#define DDR_PORT3_STATUS 0xBC #define DDR_ERR_OVER_TOPBOUND 0x20000 #define DDR_ERR_WCMDQ_OVER 0x40000 @@ -76,10 +85,10 @@ struct ctc5236_mc { #define DDR_PORT2_BASE 0xB8 #define DDR_PORT3_BASE 0xBc -#define DDR_PORT0 0 -#define DDR_PORT1 1 -#define DDR_PORT2 2 -#define DDR_PORT3 3 +#define DDR_PORT0 0 +#define DDR_PORT1 1 +#define DDR_PORT2 2 +#define DDR_PORT3 3 static int port_err_status(int status, int port, void *dev_id) { @@ -98,53 +107,80 @@ static int port_err_status(int status, int port, void *dev_id) temp = (addr_l | (((unsigned long)((addr_h >> 12) & 0x3)) << 32) ); - pr_emerg("ERROR:port%d is out of top-bound range!\n" - "The error address is 0x%p\n", - id, (void *)temp); + printk(KERN_EMERG + "ERROR:port%d is out of top-bound range!\n The error address is 0x%p\n", + id, (void *)temp); } - if (status & DDR_ERR_WCMDQ_OVER) - pr_err("ERROR:port%d write command queue is overflow!\n", id); - - if (status & DDR_ERR_WCMDQ_UNDER) - pr_err("ERROR:port%d write command queue is underflow!\n", id); + if (status & DDR_ERR_WCMDQ_OVER) { + printk(KERN_ERR + "ERROR:port%d write command queue is overflow!\n", id); + } - if (status & DDR_ERR_WDATAQ_OVER) - pr_err("ERROR:port%d write data queue is overflow!\n", id); + if (status & DDR_ERR_WCMDQ_UNDER) { + printk(KERN_ERR + "ERROR:port%d write command queue is underflow!\n", id); + } - if (status & DDR_ERR_WDATAQ_UNDER) - pr_err("ERROR:port%d write data queue is underflow!\n", id); + if (status & DDR_ERR_WDATAQ_OVER) { + printk(KERN_ERR "ERROR:port%d write data queue is overflow!\n", + id); + } - if (status & DDR_ERR_WESPQ_OVER) - pr_err("ERROR:port%d write response queue is overflow!\n", id); + if (status & DDR_ERR_WDATAQ_UNDER) { + printk(KERN_ERR "ERROR:port%d write data queue is underflow!\n", + id); + } - if (status & DDR_ERR_WESPQ_UNDER) - pr_err("ERROR:port%d write response queue is underflow!\n", id); + if (status & DDR_ERR_WESPQ_OVER) { + printk(KERN_ERR + "ERROR:port%d write response queue is overflow!\n", id); + } - if (status & DDR_ERR_WINFOQ_OVER) - pr_err("ERROR:port%d write info queue is overflow!\n", id); + if (status & DDR_ERR_WESPQ_UNDER) { + printk(KERN_ERR + "ERROR:port%d write response queue is underflow!\n", id); + } - if (status & DDR_ERR_WINFOQ_UNDER) - pr_err("ERROR:port%d write info queue is underflow!\n", id); + if (status & DDR_ERR_WINFOQ_OVER) { + printk(KERN_ERR "ERROR:port%d write info queue is overflow!\n", + id); + } - if (status & DDR_ERR_RCMDQ_OVER) - pr_err("ERROR:port%d read command queue is overflow!\n", id); + if (status & DDR_ERR_WINFOQ_UNDER) { + printk(KERN_ERR "ERROR:port%d write info queue is underflow!\n", + id); + } - if (status & DDR_ERR_RCMDQ_UNDER) - pr_err("ERROR:port%d read command queue is underflow!\n", id); + if (status & DDR_ERR_RCMDQ_OVER) { + printk(KERN_ERR + "ERROR:port%d read command queue is overflow!\n", id); + } - if (status & DDR_ERR_RDATAQ_OVER) - pr_err("ERROR:port%d read data queue is overflow!\n", id); + if (status & DDR_ERR_RCMDQ_UNDER) { + printk(KERN_ERR + "ERROR:port%d read command queue is underflow!\n", id); + } - if (status & DDR_ERR_RDATAQ_UNDER) - pr_err("ERROR:port%d read data queue is underflow!\n", id); + if (status & DDR_ERR_RDATAQ_OVER) { + printk(KERN_ERR "ERROR:port%d read data queue is overflow!\n", + id); + } - if (status & DDR_ERR_RESPQ_OVER) - pr_err("ERROR:port%d read response queue is overflow!\n", id); + if (status & DDR_ERR_RDATAQ_UNDER) { + printk(KERN_ERR "ERROR:port%d read data queue is underflow!\n", + id); + } - if (status & DDR_ERR_RESPQ_UNDER) - pr_err("ERROR:port%d read response queue is underflow!\n", id); + if (status & DDR_ERR_RESPQ_OVER) { + printk(KERN_ERR + "ERROR:port%d read response queue is overflow!\n", id); + } + if (status & DDR_ERR_RESPQ_UNDER) { + printk(KERN_ERR + "ERROR:port%d read response queue is underflow!\n", id); + } return 1; } @@ -177,20 +213,29 @@ static irqreturn_t ctc_mc_err_handler(int irq, void *dev_id) port_err_status(ret, DDR_PORT3, mci); } - if (status & DDR_ERR_ECC_INT_STATUS) - pr_err("ERROR:The ecc more than 1-bit error !\n"); + if (status & DDR_ERR_ECC_INT_STATUS) { + printk(KERN_ERR "ERROR:The ecc more than 1-bit error !\n"); + } - if (status & DDR_ERR_WR_PORT_REC_UNDERFLOW) - pr_err("ERROR:MPARB wr_port_rec FIFO is underflow!\n"); + if (status & DDR_ERR_WR_PORT_REC_UNDERFLOW) { + printk(KERN_ERR "ERROR:MPARB wr_port_rec FIFO is underflow!\n"); + } - if (status & DDR_ERR_WR_PORT_REC_OVERFLOW) - pr_err("ERROR:MPARB wr_port_rec FIFO is overflow!\n"); + if (status & DDR_ERR_WR_PORT_REC_OVERFLOW) { + printk(KERN_ERR "ERROR:MPARB wr_port_rec FIFO is overflow!\n"); + } - if (status & DDR_ERR_RD_PORT_REC_UNDERFLOW) - pr_err("ERROR:MPARB rd_port_rec FIFO is underflow!\n"); + if (status & DDR_ERR_RD_PORT_REC_UNDERFLOW) { + printk(KERN_ERR "ERROR:MPARB rd_port_rec FIFO is underflow!\n"); + } - if (status & DDR_ERR_RD_PORT_REC_OVERFLOW) - pr_err("ERROR:MPARB rd_port_rec FIFO is underflow!\n"); + if (status & DDR_ERR_RD_PORT_REC_OVERFLOW) { + printk(KERN_ERR "ERROR:MPARB rd_port_rec FIFO is overflow!\n"); + } + + if (status & DDR_ERR_CRC_INT_STATUS) { + printk(KERN_ERR "ERROR:The crc error from DRAM!\n"); + } /* disable DDR interrupt */ writel(0x0, mci->base + DDR_ERR_INT_EN); @@ -198,6 +243,43 @@ static irqreturn_t ctc_mc_err_handler(int irq, void *dev_id) return IRQ_HANDLED; } +static irqreturn_t ctc_mc_onebit_ecc_err_handler(int irq, void *dev_id) +{ + struct ctc5236_mc *mci = dev_id; + unsigned int val; + + printk(KERN_ERR "ERROR:One-Bit ECC Error!\n"); + regmap_read(mci->regmap_base, + offsetof(struct SysCtl_regs, SysDdrEccCtl), &val); + printk(KERN_ERR "One-Bit ECC Error Count is %d\n", ((val >> 8) & 0xf)); + printk(KERN_ERR "more than One-Bit ECC Error Count is %d\n", + ((val >> 12) & 0xf)); + + return IRQ_HANDLED; +} + +static irqreturn_t ctc_mc_twobit_ecc_err_handler(int irq, void *dev_id) +{ + struct ctc5236_mc *mci = dev_id; + unsigned int val; + + printk(KERN_ERR "ERROR:more than One-Bit ECC Error!\n"); + regmap_read(mci->regmap_base, + offsetof(struct SysCtl_regs, SysDdrEccCtl), &val); + printk(KERN_ERR "One-Bit ECC Error Count is %d\n", ((val >> 8) & 0xf)); + printk(KERN_ERR "more than One-Bit ECC Error Count is %d\n", + ((val >> 12) & 0xf)); + + return IRQ_HANDLED; +} + +static irqreturn_t ctc_cache_err_handler(int irq, void *dev_id) +{ + + printk(KERN_ERR "ERROR:Cache ECC Error!\n"); + return IRQ_HANDLED; +} + static const struct of_device_id ctc5236_ddr_ctrl_of_match[] = { { .compatible = "ctc,ctc5236-ddr-ctrl", @@ -212,6 +294,7 @@ static int ctc5236_mc_probe(struct platform_device *pdev) const struct of_device_id *id; struct ctc5236_mc *mci; int ret; + unsigned int val; id = of_match_device(ctc5236_ddr_ctrl_of_match, &pdev->dev); if (!id) @@ -225,12 +308,67 @@ static int ctc5236_mc_probe(struct platform_device *pdev) if (IS_ERR(mci->base)) return PTR_ERR(mci->base); + mci->regmap_base = + syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "ctc,sysctrl"); + if (IS_ERR(mci->regmap_base)) + return PTR_ERR(mci->regmap_base); + + regmap_read(mci->regmap_base, + offsetof(struct SysCtl_regs, SysCtlSysRev), &val); + mci->soc_ver = val; + mci->irq = platform_get_irq(pdev, 0); ret = devm_request_irq(&pdev->dev, mci->irq, ctc_mc_err_handler, 0, - dev_name(&pdev->dev), mci); + "DDR Ecc", mci); + if (ret < 0) { + dev_err(&pdev->dev, "Unable to request ddr error irq %d\n", + mci->irq); + goto err; + } + + val = readl(mci->base); + /* register ecc interrupt when use TM1.1 soc and enable ecc function */ + if ((0x0 != (val & BIT(10))) && (0x1 == mci->soc_ver)) { + /* clean ecc status */ + regmap_write(mci->regmap_base, + offsetof(struct SysCtl_regs, SysDdrEccCtl), 0x1); + regmap_write(mci->regmap_base, + offsetof(struct SysCtl_regs, SysDdrEccCtl), 0x0); + + mci->irq1 = platform_get_irq(pdev, 1); + ret = + devm_request_irq(&pdev->dev, mci->irq1, + ctc_mc_twobit_ecc_err_handler, 0, + "DDR two-bit Ecc(TM1.1)", mci); + if (ret < 0) { + dev_err(&pdev->dev, + "Unable to request ddr two-bit ecc error irq %d\n", + mci->irq1); + goto err; + } + + mci->irq2 = platform_get_irq(pdev, 2); + ret = + devm_request_irq(&pdev->dev, mci->irq2, + ctc_mc_onebit_ecc_err_handler, 0, + "DDR one-bit Ecc(TM1.1)", mci); + if (ret < 0) { + dev_err(&pdev->dev, + "Unable to request one-bit ecc error irq %d\n", + mci->irq2); + goto err; + } + } + + mci->irq_cache_ecc = platform_get_irq(pdev, 3); + ret = + devm_request_irq(&pdev->dev, mci->irq_cache_ecc, + ctc_cache_err_handler, 0, "Cache Ecc", mci); if (ret < 0) { - dev_err(&pdev->dev, "Unable to request irq %d\n", mci->irq); + dev_err(&pdev->dev, + "Unable to request cache ecc error irq %d\n", + mci->irq_cache_ecc); goto err; } @@ -276,4 +414,4 @@ module_exit(ctc5236_mc_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Centec Network"); -MODULE_DESCRIPTION("Centec TsingMa memory controller driver"); +MODULE_DESCRIPTION("Centec TsingMa memory contoller driver"); diff --git a/platform/centec-arm64/tsingma-bsp/src/ctc5236_switch/ctc5236_switch.c b/platform/centec-arm64/tsingma-bsp/src/ctc5236_switch/ctc5236_switch.c old mode 100644 new mode 100755 index 1cc86667d9b9..2635a86e6ff3 --- a/platform/centec-arm64/tsingma-bsp/src/ctc5236_switch/ctc5236_switch.c +++ b/platform/centec-arm64/tsingma-bsp/src/ctc5236_switch/ctc5236_switch.c @@ -1,4 +1,5 @@ -/* (C) Copyright 2004-2017 Centec Networks (suzhou) Co., LTD. +/* + * (C) Copyright 2004-2017 Centec Networks (suzhou) Co., LTD. * Wangyb * * SPDX-License-Identifier: GPL-2.0+ @@ -9,15 +10,15 @@ #include #include #include -#include <../include/ctc5236_switch.h> +#include "../include/ctc5236_switch.h" -struct ctc_access_t *access; +ctc_access_t *access; -#define SWITCH_DTS_OFFSET 0x1000 +#define SWITCH_DTS_OFFSET 0x1000 -int ctc5236_switch_read(u32 offset, u32 len, u32 *p_value) +int ctc5236_switch_read(u32 offset, u32 len, u32 * p_value) { - union ctc_switch_cmd_status_u_t cmd_status_u; + ctc_switch_cmd_status_u_t cmd_status_u; u32 timeout = 0x6400; u32 cmd_len = 0; u8 index = 0; @@ -28,8 +29,8 @@ int ctc5236_switch_read(u32 offset, u32 len, u32 *p_value) } /* switch only have 16 databuf, len must not exceed 16 */ - if (len > 16 || len == 0) { - pr_err("switch read: length error! len = %d\n", len); + if ((16 < len) || (0 == len)) { + pr_err("switch read: length error! len = %d \n", len); return -1; } /* cmdDataLen must be power of 2 */ @@ -39,22 +40,23 @@ int ctc5236_switch_read(u32 offset, u32 len, u32 *p_value) cmd_len = len; do { cmd_len++; - } while ((cmd_len <= 16) && (cmd_len & (cmd_len - 1))); + } + while ((cmd_len <= 16) && (cmd_len & (cmd_len - 1))); } /* 1. write CmdStatusReg */ - memset(&cmd_status_u, 0, sizeof(union ctc_switch_cmd_status_u_t)); + memset(&cmd_status_u, 0, sizeof(ctc_switch_cmd_status_u_t)); cmd_status_u.cmd_status.cmdReadType = 1; - /* normal operate only support 1 entry */ - cmd_status_u.cmd_status.cmdEntryWords = (len == 16) ? 0 : len; + cmd_status_u.cmd_status.cmdEntryWords = (len == 16) ? 0 : len; /* normal operate only support 1 entry */ cmd_status_u.cmd_status.cmdDataLen = len; writel(cmd_status_u.val, &access->cmd_status); /* 2. write AddrReg */ writel(offset, &access->addr); /* 3. polling status and check */ cmd_status_u.val = readl(&access->cmd_status); - while (!(cmd_status_u.cmd_status.reqProcDone) && (--timeout)) + while (!(cmd_status_u.cmd_status.reqProcDone) && (--timeout)) { cmd_status_u.val = readl(&access->cmd_status); + } /* 4. check cmd done */ if (!(cmd_status_u.cmd_status.reqProcDone)) { pr_err("switch read error! cmd_status = %x\n", @@ -69,15 +71,16 @@ int ctc5236_switch_read(u32 offset, u32 len, u32 *p_value) } /* 6. read data from buffer */ - for (index = 0; index < len; index++) + for (index = 0; index < len; index++) { p_value[index] = readl(&access->data[index]); + } return 0; } -int ctc5236_switch_write(u32 offset, u32 len, u32 *p_value) +int ctc5236_switch_write(u32 offset, u32 len, u32 * p_value) { - union ctc_switch_cmd_status_u_t cmd_status_u; + ctc_switch_cmd_status_u_t cmd_status_u; u32 timeout = 0x6400; /* need to be confirmed */ u32 cmd_len = 0; u8 index = 0; @@ -88,8 +91,8 @@ int ctc5236_switch_write(u32 offset, u32 len, u32 *p_value) } /* switch only have 16 databuf, len must not exceed 16 */ - if (len > 16 || len == 0) { - pr_err("switch write length error! len = %d\n", len); + if ((16 < len) || (0 == len)) { + pr_err("switch write length error! len = %d \n", len); return -1; } @@ -100,28 +103,28 @@ int ctc5236_switch_write(u32 offset, u32 len, u32 *p_value) cmd_len = len; do { cmd_len++; - } while ((cmd_len <= 16) && (cmd_len & (cmd_len - 1))); + } + while ((cmd_len <= 16) && (cmd_len & (cmd_len - 1))); } /* 1. write CmdStatusReg */ - memset(&cmd_status_u, 0, sizeof(struct ctc_switch_cmd_status_t)); + memset(&cmd_status_u, 0, sizeof(ctc_switch_cmd_status_t)); cmd_status_u.cmd_status.cmdReadType = 0; cmd_status_u.cmd_status.cmdEntryWords = (len == 16) ? 0 : len; - /* Notice: for 1 entry op, cmdDatalen eq cmdEntryWords, - * but for mutil entry, len = cmd_len - */ - cmd_status_u.cmd_status.cmdDataLen = len; + cmd_status_u.cmd_status.cmdDataLen = len; /* Notice: for 1 entry op, cmdDatalen eq cmdEntryWords, but for mutil entry, len = cmd_len */ writel(cmd_status_u.val, &access->cmd_status); /* 2. write AddrReg */ writel(offset, &access->addr); /* 3. write data into databuffer */ - for (index = 0; index < len; index++) + for (index = 0; index < len; index++) { writel(p_value[index], &access->data[index]); + } /* 4. polling status and check */ cmd_status_u.val = readl(&access->cmd_status); - while (!(cmd_status_u.cmd_status.reqProcDone) && (--timeout)) + while (!(cmd_status_u.cmd_status.reqProcDone) && (--timeout)) { cmd_status_u.val = readl(&access->cmd_status); + } /* 5. check cmd done */ if (!(cmd_status_u.cmd_status.reqProcDone)) { @@ -141,29 +144,29 @@ int ctc5236_switch_write(u32 offset, u32 len, u32 *p_value) } static int -_sys_tsingma_peri_get_temp_with_code(u8 lchip, u32 temp_code, u32 *p_temp_val) +_sys_tsingma_peri_get_temp_with_code(u8 lchip, u32 temp_code, u32 * p_temp_val) { u16 temp_mapping_tbl[SYS_TSINGMA_TEMP_TABLE_NUM + 1] = { - 804, 801, 798, 795, 792, 790, 787, 784, 781, 778, - 775, 772, 769, 766, 763, 761, 758, 755, 752, 749, - 746, 743, 740, 737, 734, 731, 728, 725, 722, 719, - 717, 714, 711, 708, 705, 702, 699, 696, 693, 690, - 687, 684, 681, 678, 675, 672, 669, 666, 663, 660, - 658, 655, 652, 649, 646, 643, 640, 637, 634, 631, - 628, 625, 622, 619, 616, 613, 610, 607, 604, 601, - 599, 596, 593, 590, 587, 584, 581, 578, 575, 572, - 569, 566, 563, 560, 557, 554, 551, 548, 545, 542, - 540, 537, 534, 531, 528, 525, 522, 519, 516, 513, - 510, 507, 504, 501, 498, 495, 492, 489, 486, 483, - 481, 478, 475, 472, 469, 466, 463, 460, 457, 454, - 451, 448, 445, 442, 439, 436, 433, 430, 427, 424, - 421, 418, 415, 412, 409, 406, 403, 400, 397, 394, - 391, 388, 385, 382, 379, 376, 373, 370, 367, 364, - 361, 358, 355, 352, 349, 346, 343, 340, 337, 334, + 804, 801, 798, 795, 792, 790, 787, 784, 781, 778, 775, 772, 769, 766, 763, 761, 758, 755, 752, 749, + /*-40~-21*/ + 746, 743, 740, 737, 734, 731, 728, 725, 722, 719, 717, 714, 711, 708, 705, 702, 699, 696, 693, 690, + /*-20~-1*/ + 687, 684, 681, 678, 675, 672, 669, 666, 663, 660, 658, 655, 652, 649, 646, 643, 640, 637, 634, 631, /*0~19 */ + 628, 625, 622, 619, 616, 613, 610, 607, 604, 601, 599, 596, 593, 590, 587, 584, 581, 578, 575, 572, /*20~39 */ + 569, 566, 563, 560, 557, 554, 551, 548, 545, 542, 540, 537, 534, 531, 528, 525, 522, 519, 516, 513, /*40~59 */ + 510, 507, 504, 501, 498, 495, 492, 489, 486, 483, 481, 478, 475, 472, 469, 466, 463, 460, 457, 454, /*60~79 */ + 451, 448, 445, 442, 439, 436, 433, 430, 427, 424, 421, 418, 415, 412, 409, 406, 403, 400, 397, 394, /*80~99 */ + 391, 388, 385, 382, 379, 376, 373, 370, 367, 364, 361, 358, 355, 352, 349, 346, 343, 340, 337, 334, /*100~119 */ 331, 328, 325, 322, 319, 316, 0 - }; + }; /*120~125 */ u8 index = 0; + /*if ((temp_code > temp_mapping_tbl[0]) || (temp_code < temp_mapping_tbl[SYS_TSINGMA_TEMP_TABLE_NUM-1])) + { + SYS_PERI_DBG_OUT(CTC_DEBUG_LEVEL_ERROR, "temp code error %d\n", temp_code); + return CTC_E_HW_INVALID_INDEX; + } */ + for (index = 0; index < SYS_TSINGMA_TEMP_TABLE_NUM; index++) { if ((temp_code <= temp_mapping_tbl[index]) && (temp_code > temp_mapping_tbl[index + 1])) { @@ -171,10 +174,11 @@ _sys_tsingma_peri_get_temp_with_code(u8 lchip, u32 temp_code, u32 *p_temp_val) } } - if (index < 39) + if (index < 40) { *p_temp_val = 40 - index + (1 << 31); - else + } else { *p_temp_val = index - 40; + } return 0; } @@ -189,27 +193,6 @@ int get_switch_temperature(void) offset = 0xf * 4; ctc5236_switch_write(OMCMEM_BASE + offset, 1, &value); - /*config RTHMC_RST=1 */ - /*mask_write tbl-reg OmcMem 0x10 offset 0x0 0x00000010 0x00000010 */ - offset = 0x10 * 4; - ctc5236_switch_read(OMCMEM_BASE + offset, 1, &value); - value |= BIT(4); - ctc5236_switch_write(OMCMEM_BASE + offset, 1, &value); - - /*wait RTHMC_RST=1 */ - /*read tbl-reg OmcMem 0x10 offset 0x0 */ - timeout = SYS_TSINGMA_SENSOR_TIMEOUT; - offset = 0x10 * 4; - while (timeout) { - timeout--; - ctc5236_switch_read(OMCMEM_BASE + offset, 1, &value); - if ((BIT(4) & value) == 0) - break; - msleep(1); - } - if (timeout == 0) - return 0xffff; - /*config ENBIAS=1£¬ENVR=1£¬ENAD=1 */ /*mask_write tbl-reg OmcMem 0x11 offset 0x0 0x02000007 0x03000007 */ offset = 0x11 * 4; @@ -237,6 +220,8 @@ int get_switch_temperature(void) value |= BIT(0); ctc5236_switch_write(OMCMEM_BASE + offset, 1, &value); + msleep(1); + /*mask_write tbl-reg OmcMem 0x10 offset 0x0 0x00000001 0x00000001 */ offset = 0x10 * 4; ctc5236_switch_read(OMCMEM_BASE + offset, 1, &value); @@ -262,8 +247,9 @@ int get_switch_temperature(void) msleep(1); } - if (timeout == 0) + if (0 == timeout) { return 0xffff; + } /*mask_write tbl-reg OmcMem 0x11 offset 0x0 0x00000006 0x00000006 */ offset = 0x11 * 4; @@ -284,6 +270,7 @@ int get_switch_temperature(void) return -temperature; } + EXPORT_SYMBOL_GPL(get_switch_temperature); static int ctc_switch_probe(struct platform_device *pdev) @@ -291,14 +278,16 @@ static int ctc_switch_probe(struct platform_device *pdev) struct resource *iomem; void __iomem *ioaddr; resource_size_t start; + uint val; iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); start = iomem->start - 0x1000; ioaddr = devm_ioremap(&pdev->dev, start, resource_size(iomem)); - if (IS_ERR(ioaddr)) + if (IS_ERR(ioaddr)) { return -1; - access = (struct ctc_access_t *) ioaddr; + } + access = (ctc_access_t *) ioaddr; return 0; } diff --git a/platform/centec-arm64/tsingma-bsp/src/ctc_wdt/ctc_wdt.c b/platform/centec-arm64/tsingma-bsp/src/ctc_wdt/ctc_wdt.c index 2beecbb99e70..8cac376c0bbe 100644 --- a/platform/centec-arm64/tsingma-bsp/src/ctc_wdt/ctc_wdt.c +++ b/platform/centec-arm64/tsingma-bsp/src/ctc_wdt/ctc_wdt.c @@ -1,3 +1,4 @@ +/* /* drivers/char/watchdog/ctc-wdt.c * * Watchdog driver for CTC TSINGMA, based on ARM SP805 watchdog module @@ -290,6 +291,12 @@ static int ctc_wdt_probe(struct amba_device *adev, const struct amba_id *id) if (IS_ERR(wdt->regmap_base)) return PTR_ERR(wdt->regmap_base); + /* reset wdt module */ + regmap_write(wdt->regmap_base, + offsetof(struct SysCtl_regs, SysWdtResetCtl), 0x3); + regmap_write(wdt->regmap_base, + offsetof(struct SysCtl_regs, SysWdtResetCtl), 0x0); + /* * TsingMa SoC wdt reference clock is obtained by clockSub frequency * division,which is 500Mhz.So we need to set the frequency division diff --git a/platform/centec-arm64/tsingma-bsp/src/ctcmac/Makefile b/platform/centec-arm64/tsingma-bsp/src/ctcmac/Makefile index f29ac076955d..bcba00068ea2 100644 --- a/platform/centec-arm64/tsingma-bsp/src/ctcmac/Makefile +++ b/platform/centec-arm64/tsingma-bsp/src/ctcmac/Makefile @@ -1,3 +1,3 @@ KBUILD_EXTRA_SYMBOLS = /sonic/platform/centec-arm64/tsingma-bsp/src/ctc5236_switch/Module.symvers -obj-m = ctcmac.o ctcmac_test.o ctc5236_mdio.o +obj-m = ctcmac.o ctc5236_mdio.o diff --git a/platform/centec-arm64/tsingma-bsp/src/ctcmac/ctc5236_mdio.c b/platform/centec-arm64/tsingma-bsp/src/ctcmac/ctc5236_mdio.c index c176e0cfbc86..95ae43d76fbc 100644 --- a/platform/centec-arm64/tsingma-bsp/src/ctcmac/ctc5236_mdio.c +++ b/platform/centec-arm64/tsingma-bsp/src/ctcmac/ctc5236_mdio.c @@ -1,4 +1,5 @@ -/* Centec cpu_mac Ethernet Driver -- cpu_mac controller implementation +/* + * Centec CpuMac Ethernet Driver -- CpuMac controller implementation * Provides Bus interface for MIIM regs * * Author: liuht @@ -10,6 +11,7 @@ * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. + * */ #include @@ -44,7 +46,7 @@ struct ctc_mdio_priv { void __iomem *map; - struct mdio_soc_regs *mdio_reg; + struct MdioSoc_regs *mdio_reg; }; static int ctc_mdio_write(struct mii_bus *bus, int mii_id, int reg, u16 value) @@ -57,14 +59,15 @@ static int ctc_mdio_write(struct mii_bus *bus, int mii_id, int reg, u16 value) cmd = CTCMAC_MDIO_CMD_REGAD(reg) | CTCMAC_MDIO_CMD_PHYAD(mii_id) | CTCMAC_MDIO_CMD_OPCODE(1) | CTCMAC_MDIO_CMD_DATA(value); - writel(cmd, &priv->mdio_reg->mdio_soc_cmd_0[0]); - writel(1, &priv->mdio_reg->mdio_soc_cmd_0[1]); + writel(cmd, &priv->mdio_reg->MdioSocCmd0[0]); + writel(1, &priv->mdio_reg->MdioSocCmd0[1]); - ret = readl_poll_timeout(&priv->mdio_reg->mdio_soc_status_0, + ret = readl_poll_timeout(&priv->mdio_reg->MdioSocStatus0, tmp, tmp & CTCMAC_MDIO_STAT(1), 1000, 10000); - if (ret < 0) + if (ret < 0) { return -1; + } return 0; } @@ -80,18 +83,18 @@ static int ctc_mdio_read(struct mii_bus *bus, int mii_id, int reg) cmd = CTCMAC_MDIO_CMD_REGAD(reg) | CTCMAC_MDIO_CMD_PHYAD(mii_id) | CTCMAC_MDIO_CMD_OPCODE(2); - writel(cmd, &priv->mdio_reg->mdio_soc_cmd_0[0]); - writel(1, &priv->mdio_reg->mdio_soc_cmd_0[1]); + writel(cmd, &priv->mdio_reg->MdioSocCmd0[0]); + writel(1, &priv->mdio_reg->MdioSocCmd0[1]); - ret = readl_poll_timeout(&priv->mdio_reg->mdio_soc_status_0, + ret = readl_poll_timeout(&priv->mdio_reg->MdioSocStatus0, status, status & CTCMAC_MDIO_STAT(1), 1000, 10000); if (ret < 0) { - pr_err("ctc_mdio_read1\n"); + printk(KERN_ERR "ctc_mdio_read1\n"); return -1; } - value = (readl(&priv->mdio_reg->mdio_soc_status_0) & 0xffff); + value = (readl(&priv->mdio_reg->MdioSocStatus0) & 0xffff); return value; } @@ -100,7 +103,7 @@ static int ctc_mdio_reset(struct mii_bus *bus) { struct ctc_mdio_priv *priv = (struct ctc_mdio_priv *)bus->priv; - writel(0x91f, &priv->mdio_reg->mdio_soc_cfg_0); + writel(0x91f, &priv->mdio_reg->MdioSocCfg0); return 0; } @@ -146,7 +149,7 @@ static int ctc_mdio_probe(struct platform_device *pdev) pr_err("of iomap fail %d!\n", err); goto error; } - priv->mdio_reg = (struct mdio_soc_regs *)priv->map; + priv->mdio_reg = (struct MdioSoc_regs *)priv->map; new_bus->parent = &pdev->dev; platform_set_drvdata(pdev, new_bus); diff --git a/platform/centec-arm64/tsingma-bsp/src/ctcmac/ctcmac.c b/platform/centec-arm64/tsingma-bsp/src/ctcmac/ctcmac.c old mode 100644 new mode 100755 index 6e267ed8fb42..ea28b561ecaf --- a/platform/centec-arm64/tsingma-bsp/src/ctcmac/ctcmac.c +++ b/platform/centec-arm64/tsingma-bsp/src/ctcmac/ctcmac.c @@ -1,4 +1,5 @@ -/* Centec cpu_mac Ethernet Driver -- cpu_mac controller implementation +/* + * Centec CpuMac Ethernet Driver -- CpuMac controller implementation * Provides Bus interface for MIIM regs * * Author: liuht @@ -34,6 +35,7 @@ #include #include #include +#include #include #include "../pinctrl-ctc/pinctrl-ctc.h" @@ -41,8 +43,9 @@ #include #include #include -#include "../include/ctc5236_switch.h" #include +#include "../include/ctc5236_switch.h" + #include "ctcmac.h" #include "ctcmac_reg.h" @@ -51,9 +54,11 @@ static int ctcmac_free_skb_resources(struct ctcmac_private *priv); static void cpumac_start(struct ctcmac_private *priv); static void cpumac_halt(struct ctcmac_private *priv); static void ctcmac_hw_init(struct ctcmac_private *priv); +static int ctcmac_set_ffe(struct ctcmac_private *priv, u16 coefficient[]); +static int ctcmac_get_ffe(struct ctcmac_private *priv, u16 coefficient[]); static spinlock_t global_reglock __aligned(SMP_CACHE_BYTES); -static int g_reglock_init_done; -static int g_mac_unit_init_done; +static int g_reglock_init_done = 0; +static int g_mac_unit_init_done = 0; static struct regmap *regmap_base; static struct ctcmac_pkt_stats g_pkt_stats[2]; @@ -134,20 +139,19 @@ static const char ctc_stat_gstrings[][ETH_GSTRING_LEN] = { "mtu2", }; -static void clrsetbits(unsigned __iomem *addr, u32 clr, u32 set) +static void clrsetbits(unsigned __iomem * addr, u32 clr, u32 set) { writel((readl(addr) & ~(clr)) | (set), addr); } -static inline u32 ctcmac_regr(unsigned __iomem *addr) +static inline u32 ctcmac_regr(unsigned __iomem * addr) { u32 val; - val = readl(addr); return val; } -static inline void ctcmac_regw(unsigned __iomem *addr, u32 val) +static inline void ctcmac_regw(unsigned __iomem * addr, u32 val) { writel(val, addr); } @@ -166,7 +170,7 @@ static int ctcmac_alloc_tx_queues(struct ctcmac_private *priv) int i; for (i = 0; i < priv->num_tx_queues; i++) { - priv->tx_queue[i] = kzalloc(sizeof(*priv->tx_queue[i]), + priv->tx_queue[i] = kzalloc(sizeof(struct ctcmac_priv_tx_q), GFP_KERNEL); if (!priv->tx_queue[i]) return -ENOMEM; @@ -174,7 +178,7 @@ static int ctcmac_alloc_tx_queues(struct ctcmac_private *priv) priv->tx_queue[i]->tx_skbuff = NULL; priv->tx_queue[i]->qindex = i; priv->tx_queue[i]->dev = priv->ndev; - spin_lock_init(&priv->tx_queue[i]->txlock); + spin_lock_init(&(priv->tx_queue[i]->txlock)); } return 0; } @@ -184,7 +188,7 @@ static int ctcmac_alloc_rx_queues(struct ctcmac_private *priv) int i; for (i = 0; i < priv->num_rx_queues; i++) { - priv->rx_queue[i] = kzalloc(sizeof(*priv->rx_queue[i]), + priv->rx_queue[i] = kzalloc(sizeof(struct ctcmac_priv_rx_q), GFP_KERNEL); if (!priv->rx_queue[i]) return -ENOMEM; @@ -205,16 +209,20 @@ static void ctcmac_free_tx_queues(struct ctcmac_private *priv) { int i; - for (i = 0; i < priv->num_tx_queues; i++) - kfree(priv->tx_queue[i]); + for (i = 0; i < priv->num_tx_queues; i++) { + if (priv->tx_queue[i]) + kfree(priv->tx_queue[i]); + } } static void ctcmac_free_rx_queues(struct ctcmac_private *priv) { int i; - for (i = 0; i < priv->num_rx_queues; i++) - kfree(priv->rx_queue[i]); + for (i = 0; i < priv->num_rx_queues; i++) { + if (priv->rx_queue[i]) + kfree(priv->rx_queue[i]); + } } static void ctcmac_free_dev(struct ctcmac_private *priv) @@ -237,7 +245,7 @@ static int ctcmac_fixed_phy_link_update(struct net_device *dev, if (priv->interface != PHY_INTERFACE_MODE_SGMII) return 0; - mon = readl(&priv->cpumac_reg->cpu_mac_sgmii_mon[0]); + mon = readl(&priv->cpumac_reg->CpuMacSgmiiMon[0]); if (priv->autoneg_mode == CTCMAC_AUTONEG_DISABLE) { if ((mon & 0x100) == 0x100) status->link = 1; @@ -257,8 +265,10 @@ static int ctcmac_fixed_phy_link_update(struct net_device *dev, static int ctcmac_of_init(struct platform_device *ofdev, struct net_device **pdev) { - int err = 0, index; - const char *ctype, *automode, *dfe; + u32 val; + int err = 0, index, int_coalesce; + const void *mac_addr; + const char *ctype, *automode, *dfe, *int_type, *tx_inv, *rx_inv; struct net_device *dev = NULL; struct ctcmac_private *priv = NULL; unsigned int num_tx_qs, num_rx_qs; @@ -269,7 +279,7 @@ static int ctcmac_of_init(struct platform_device *ofdev, *pdev = alloc_etherdev_mq(sizeof(*priv), num_tx_qs); dev = *pdev; - if (!dev) + if (NULL == dev) return -ENOMEM; priv = netdev_priv(dev); @@ -278,6 +288,9 @@ static int ctcmac_of_init(struct platform_device *ofdev, priv->dev = &ofdev->dev; priv->dev->coherent_dma_mask = DMA_BIT_MASK(64); priv->num_tx_queues = num_tx_qs; + regmap_read(regmap_base, offsetof(struct SysCtl_regs, SysCtlSysRev), + &val); + priv->version = val; netif_set_real_num_rx_queues(dev, num_rx_qs); priv->num_rx_queues = num_rx_qs; @@ -293,16 +306,50 @@ static int ctcmac_of_init(struct platform_device *ofdev, priv->cpumac_mem = priv->iobase + CPUMAC_MEM_BASE; priv->cpumacu_reg = of_iomap(np, 1) + CPUMACUNIT_REG_BASE; - /* Get cpu_mac index */ + /* Get CpuMac index */ err = of_property_read_u32(np, "index", &index); - if (err == 0) + if ((err == 0)) priv->index = index; else priv->index = 0; + mac_addr = of_get_mac_address(np); + + if (!IS_ERR(mac_addr)) + memcpy(dev->dev_addr, mac_addr, ETH_ALEN); + + err = of_property_read_string(np, "int-type", &int_type); + if ((err == 0) && !strncmp(int_type, "desc", 4)) { + priv->int_type = CTCMAC_INT_DESC; + if (priv->version == 0) { + priv->rx_int_coalesce_cnt = DESC_INT_COALESCE_CNT_MIN; + priv->tx_int_coalesce_cnt = DESC_INT_COALESCE_CNT_MIN; + } else { + err = + of_property_read_u32(np, "rx-int-coalesce-count", + &int_coalesce); + if (err == 0) + priv->rx_int_coalesce_cnt = int_coalesce; + else + priv->rx_int_coalesce_cnt = + DESC_RX_INT_COALESCE_CNT_DEFAULT; + + err = + of_property_read_u32(np, "tx-int-coalesce-count", + &int_coalesce); + if (err == 0) + priv->tx_int_coalesce_cnt = int_coalesce; + else + priv->tx_int_coalesce_cnt = + DESC_TX_INT_COALESCE_CNT_DEFAULT; + } + } else { + priv->int_type = CTCMAC_INT_PACKET; + } + /* Get interface type, CTC5236 only support PHY_INTERFACE_MODE_SGMII */ err = of_property_read_string(np, "phy-connection-type", &ctype); - if (err == 0 && !strncmp(ctype, "mii", 3)) { + if ((err == 0) && !strncmp(ctype, "mii", 3)) { priv->interface = PHY_INTERFACE_MODE_MII; priv->supported = SUPPORTED_10baseT_Full; } else { @@ -311,22 +358,38 @@ static int ctcmac_of_init(struct platform_device *ofdev, } err = of_property_read_string(np, "auto-nego-mode", &automode); - if (err == 0 && !strncmp(automode, "disable", 7)) + if ((err == 0) && !strncmp(automode, "disable", 7)) { priv->autoneg_mode = CTCMAC_AUTONEG_DISABLE; - else if (err == 0 && !strncmp(automode, "sgmii-mac", 9)) + } else if ((err == 0) && !strncmp(automode, "sgmii-mac", 9)) { priv->autoneg_mode = CTCMAC_AUTONEG_MAC_M; - else if (err == 0 && !strncmp(automode, "sgmii-phy", 9)) + } else if ((err == 0) && !strncmp(automode, "sgmii-phy", 9)) { priv->autoneg_mode = CTCMAC_AUTONEG_PHY_M; - else if (err == 0 && !strncmp(automode, "1000base-x", 10)) + } else if ((err == 0) && !strncmp(automode, "1000base-x", 10)) { priv->autoneg_mode = CTCMAC_AUTONEG_1000BASEX_M; - else + } else { priv->autoneg_mode = CTCMAC_AUTONEG_MAC_M; + } err = of_property_read_string(np, "dfe", &dfe); - if (err == 0 && !strncmp(dfe, "enable", 6)) + if ((err == 0) && !strncmp(dfe, "enable", 6)) { priv->dfe_enable = 1; - else + } else { priv->dfe_enable = 0; + } + + err = of_property_read_string(np, "tx-pol-inv", &tx_inv); + if ((err == 0) && !strncmp(tx_inv, "enable", 6)) { + priv->tx_pol_inv = CTCMAC_TX_POL_INV_ENABLE; + } else { + priv->tx_pol_inv = CTCMAC_TX_POL_INV_DISABLE; + } + + err = of_property_read_string(np, "rx-pol-inv", &rx_inv); + if ((err == 0) && !strncmp(rx_inv, "enable", 6)) { + priv->rx_pol_inv = CTCMAC_RX_POL_INV_ENABLE; + } else { + priv->rx_pol_inv = CTCMAC_RX_POL_INV_DISABLE; + } priv->phy_node = of_parse_phandle(np, "phy-handle", 0); /* In the case of a fixed PHY, the DT node associated @@ -342,6 +405,12 @@ static int ctcmac_of_init(struct platform_device *ofdev, /* mapping from hw irq to sw irq */ priv->irqinfo[CTCMAC_NORMAL].irq = irq_of_parse_and_map(np, 0); priv->irqinfo[CTCMAC_FUNC].irq = irq_of_parse_and_map(np, 1); + if (priv->version > 0) { + priv->irqinfo[CTCMAC_FUNC_RX0].irq = + irq_of_parse_and_map(np, 3); + priv->irqinfo[CTCMAC_FUNC_RX1].irq = + irq_of_parse_and_map(np, 4); + } return 0; @@ -365,10 +434,8 @@ int startup_ctcmac(struct net_device *ndev) if (err) return err; - /* barrier */ smp_mb__before_atomic(); clear_bit(CTCMAC_DOWN, &priv->state); - /* barrier */ smp_mb__after_atomic(); cpumac_start(priv); @@ -381,6 +448,8 @@ int startup_ctcmac(struct net_device *ndev) napi_enable(&priv->napi_rx); napi_enable(&priv->napi_tx); + if (priv->version > 0) + napi_enable(&priv->napi_rx1); netif_tx_wake_all_queues(ndev); @@ -396,13 +465,13 @@ void stop_ctcmac(struct net_device *ndev) netif_tx_stop_all_queues(ndev); - /* barrier */ smp_mb__before_atomic(); set_bit(CTCMAC_DOWN, &priv->state); - /* barrier */ smp_mb__after_atomic(); napi_disable(&priv->napi_rx); napi_disable(&priv->napi_tx); + if (priv->version > 0) + napi_disable(&priv->napi_rx1); phy_stop(ndev->phydev); ctcmac_free_skb_resources(priv); } @@ -410,7 +479,6 @@ void stop_ctcmac(struct net_device *ndev) static void ctcmac_reset(struct net_device *ndev) { struct ctcmac_private *priv = netdev_priv(ndev); - while (test_and_set_bit_lock(CTCMAC_RESETTING, &priv->state)) cpu_relax(); @@ -431,37 +499,33 @@ static void ctcmac_reset_task(struct work_struct *work) ctcmac_reset(priv->ndev); } -/* get the rxdesc number that was used by cpu_mac but has not been - * handled by CPU - */ +/* get the rxdesc number that was used by CpuMac but has not been handled by CPU */ static int ctcmac_rxbd_recycle(struct ctcmac_private *priv, int qidx) { u32 count; if (qidx) { - count = readl(&priv->cpumac_reg->cpu_mac_desc_mon[2]); + count = readl(&priv->cpumac_reg->CpuMacDescMon[2]); return count & 0xffff; } - count = readl(&priv->cpumac_reg->cpu_mac_desc_mon[1]); + count = readl(&priv->cpumac_reg->CpuMacDescMon[1]); return (count >> 16) & 0xffff; } static int ctcmac_rxbd_usable(struct ctcmac_private *priv, int qidx) { - return (readl(&priv->cpumac_reg->cpu_mac_desc_mon[0]) >> (qidx * 16)) & + return (readl(&priv->cpumac_reg->CpuMacDescMon[0]) >> (qidx * 16)) & 0xffff; } -/* get the txdesc number that was used by cpu_mac - * but has not been handled by CPU - */ +/* get the txdesc number that was used by CpuMac but has not been handled by CPU */ static int ctcmac_txbd_used_untreated(struct ctcmac_private *priv) { u32 count; - count = readl(&priv->cpumac_reg->cpu_mac_desc_mon[2]); + count = readl(&priv->cpumac_reg->CpuMacDescMon[2]); return (count >> 16) & 0xffff; } @@ -476,7 +540,7 @@ static bool ctcmac_add_rx_frag(struct ctcmac_rx_buff *rxb, u32 lstatus, int data_size; /* Remove the CRC from the packet length */ - if (lstatus & CPU_MAC_DESC_INTF_W1_DESC_EOP) + if (lstatus & BIT(CPU_MAC_DESC_INTF_W1_DESC_EOP_BIT)) data_size = size - 4; else data_size = size; @@ -528,7 +592,7 @@ static void ctcmac_reuse_rx_page(struct ctcmac_priv_rx_q *rxq, CTCMAC_RXB_TRUESIZE, DMA_FROM_DEVICE); } -/* Handle the rx buffer that has been used by cpu_mac */ +/* Handle the rx buffer that has been used by CpuMac */ static struct sk_buff *ctcmac_get_next_rxbuff(struct ctcmac_priv_rx_q *rx_queue, u32 lstatus, struct sk_buff *skb) { @@ -539,10 +603,10 @@ static struct sk_buff *ctcmac_get_next_rxbuff(struct ctcmac_priv_rx_q *rx_queue, if (likely(!skb)) { void *buff_addr = page_address(page) + rxb->page_offset; - skb = build_skb(buff_addr, CTCMAC_SKBFRAG_SIZE); - if (unlikely(!skb)) + if (unlikely(!skb)) { return NULL; + } first = true; } @@ -583,19 +647,19 @@ int ctc_mac_hss_write(struct ctcmac_private *priv, u8 addr, u8 data, else accid = 0; val = addr | (data << 8) | (accid << 24) | (1 << 31); - writel(val, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(val, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); while (timeout--) { - mon = - readl(&priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_result); - if (mon & CPU_MAC_UNIT_HSS_REG_ACC_RESULT_W0_HSS_ACC_ACK_MASK) + mon = readl(&priv->cpumacu_reg->CpuMacUnitHssRegAccResult); + if (mon & CPU_MAC_UNIT_HSS_REG_ACC_RESULT_W0_HSS_ACC_ACK_MASK) { break; + } mdelay(1); } if (!(mon & CPU_MAC_UNIT_HSS_REG_ACC_RESULT_W0_HSS_ACC_ACK_MASK)) { dev_err(&priv->ndev->dev, - "wait for write ack cpu_mac_unit_hss_reg_acc_result:0x%x addr 0x%x data 0x%x serdes %d fail!\n", - readl(&priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_result), + "wait for write ack CpuMacUnitHssRegAccResult:0x%x addr 0x%x data 0x%x serdes %d fail!\n", + readl(&priv->cpumacu_reg->CpuMacUnitHssRegAccResult), addr, data, serdes_id); return -1; } @@ -603,13 +667,13 @@ int ctc_mac_hss_write(struct ctcmac_private *priv, u8 addr, u8 data, return 0; } -int ctc_mac_hss_read(struct ctcmac_private *priv, u8 addr, u8 *data, +int ctc_mac_hss_read(struct ctcmac_private *priv, u8 addr, u8 * data, u8 serdes_id) { u8 accid; u32 val = 0; u32 mon = 0; - int timeout = 2000; + int timeout = 2000;; if (serdes_id == 0) accid = 3; @@ -619,24 +683,24 @@ int ctc_mac_hss_read(struct ctcmac_private *priv, u8 addr, u8 *data, accid = 0; val = addr | (1 << 16) | (accid << 24) | (1 << 31); - writel(val, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(val, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); while (timeout--) { - mon = - readl(&priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_result); - if (mon & CPU_MAC_UNIT_HSS_REG_ACC_RESULT_W0_HSS_ACC_ACK_MASK) + mon = readl(&priv->cpumacu_reg->CpuMacUnitHssRegAccResult); + if (mon & CPU_MAC_UNIT_HSS_REG_ACC_RESULT_W0_HSS_ACC_ACK_MASK) { break; + } mdelay(1); } if (!(mon & CPU_MAC_UNIT_HSS_REG_ACC_RESULT_W0_HSS_ACC_ACK_MASK)) { dev_err(&priv->ndev->dev, - "wait for read ack cpu_mac_unit_hss_reg_acc_result:0x%x fail!\n", - readl(&priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_result)); + "wait for read ack CpuMacUnitHssRegAccResult:0x%x fail!\n", + readl(&priv->cpumacu_reg->CpuMacUnitHssRegAccResult)); *data = 0x0; return -1; } - val = readl(&priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_result); + val = readl(&priv->cpumacu_reg->CpuMacUnitHssRegAccResult); *data = val & 0xff; return 0; @@ -648,29 +712,25 @@ static int ctcmac_maximize_margin_of_cmu_tempearture_ramp(struct ctcmac_private u8 val, ctune, delta, ctune_cal; int tmpr = 0; + get_switch_temperature(); tmpr = get_switch_temperature(); - if (tmpr == 0xffff) { - pr_err("get temperature fail!\n"); + if (0xffff == tmpr) { + printk(KERN_ERR "get temperature fail!\n"); return -1; } - ctc_mac_hss_read(priv, 0x1c, &val, 2); - val &= 0xf8; - val |= 0x4; - ctc_mac_hss_write(priv, 0x1c, val, 2); - /*r_pll_dlol_en 0x30[0] write 1 enable pll lol status output */ ctc_mac_hss_read(priv, 0x30, &val, 2); val |= BIT(0); ctc_mac_hss_write(priv, 0x30, val, 2); - if (tmpr <= -20) + if (tmpr <= -20) { delta = 2; - else if (tmpr <= 60) + } else if (tmpr <= 60) { delta = 1; - else + } else { delta = 0; - + } /*read_vco_ctune 0xe0[3:0] read ctune raw value */ ctc_mac_hss_read(priv, 0xe0, &val, 2); ctune = val & 0xf; @@ -690,7 +750,7 @@ static int ctcmac_maximize_margin_of_cmu_tempearture_ramp(struct ctcmac_private mdelay(10); /*pll_lol_udl 0xe0[4] read 0 */ val = ctc_mac_hss_read(priv, 0xe0, &val, 2); - if ((0 != (val & BIT(4))) && delta == 2) { + if ((0 != (val & BIT(4))) && (delta == 2)) { /*cfg_vco_byp_ctune 0x07[3:0] write (ctune - 1) */ ctune_cal = ctune - 1; ctc_mac_hss_read(priv, 0x7, &val, 2); @@ -703,141 +763,158 @@ static int ctcmac_maximize_margin_of_cmu_tempearture_ramp(struct ctcmac_private /*pll_lol_udl 0xe0[4] read 0 */ val = ctc_mac_hss_read(priv, 0xe0, &val, 2); if (0 != (val & BIT(4))) { - pr_err("maximize margin of cmu tempearture ramp fail!\n"); + printk(KERN_ERR + "maximize margin of cmu tempearture ramp fail!\n"); return -1; } return 0; } +/* tx/rx polarity invert */ +static int ctc_mac_pol_inv(struct ctcmac_private *priv) +{ + u8 data = 0; + + if (priv->tx_pol_inv) { + /* tx polarity will be inverted */ + ctc_mac_hss_read(priv, 0x83, &data, priv->index); + ctc_mac_hss_write(priv, 0x83, (data | 0x2), priv->index); + } + + if (priv->rx_pol_inv) { + /* rx polarity will be inverted */ + ctc_mac_hss_read(priv, 0x83, &data, priv->index); + ctc_mac_hss_write(priv, 0x83, (data | 0x8), priv->index); + } + return 0; +} + /* serdes init flow */ static int ctc_mac_serdes_init(struct ctcmac_private *priv) { + u8 val; int ret = 0; u32 status; int delay_ms = 10; if (priv->dfe_enable) { /* reset serdes */ - writel(0x4610b003, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[5]); - writel(0x4610b003, - &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[11]); - writel(0x83806000, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[0]); - writel(0x28061800, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[2]); - writel(0x0066c03a, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[6]); - writel(0x28061810, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[8]); - writel(0x0066c03a, - &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[12]); + writel(0x4610b003, &priv->cpumacu_reg->CpuMacUnitHssCfg[5]); + writel(0x4610b003, &priv->cpumacu_reg->CpuMacUnitHssCfg[11]); + writel(0x83806000, &priv->cpumacu_reg->CpuMacUnitHssCfg[0]); + writel(0x28061800, &priv->cpumacu_reg->CpuMacUnitHssCfg[2]); + writel(0x0066c03a, &priv->cpumacu_reg->CpuMacUnitHssCfg[6]); + writel(0x28061810, &priv->cpumacu_reg->CpuMacUnitHssCfg[8]); + writel(0x0066c03a, &priv->cpumacu_reg->CpuMacUnitHssCfg[12]); } else { /* reset serdes */ - writel(0x4610a805, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[5]); - writel(0x4610a805, - &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[11]); - writel(0x83806000, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[0]); - writel(0x28061800, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[2]); - writel(0x0026c02a, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[6]); - writel(0x28061810, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[8]); - writel(0x0026c02a, - &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[12]); + writel(0x4610a805, &priv->cpumacu_reg->CpuMacUnitHssCfg[5]); + writel(0x4610a805, &priv->cpumacu_reg->CpuMacUnitHssCfg[11]); + writel(0x83806000, &priv->cpumacu_reg->CpuMacUnitHssCfg[0]); + writel(0x28061800, &priv->cpumacu_reg->CpuMacUnitHssCfg[2]); + writel(0x0026c02a, &priv->cpumacu_reg->CpuMacUnitHssCfg[6]); + writel(0x28061810, &priv->cpumacu_reg->CpuMacUnitHssCfg[8]); + writel(0x0026c02a, &priv->cpumacu_reg->CpuMacUnitHssCfg[12]); } /* offset0 bit1 BlkRstN */ - writel(0x83806002, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[0]); + writel(0x83806002, &priv->cpumacu_reg->CpuMacUnitHssCfg[0]); mdelay(delay_ms); - writel(0x80002309, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x80002309, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x80000842, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x80000842, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x8000ea45, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x8000ea45, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); /* serdes 0 init */ - writel(0x83000a05, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x83000a05, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x83002008, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x83002008, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x8300640f, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x8300640f, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x83000214, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x83000214, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x83008015, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x83008015, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x83000116, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x83000116, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x83001817, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x83001817, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x83003018, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x83003018, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x83000e24, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x83000e24, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x83008226, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x83008226, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x83001f27, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x83001f27, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x83002028, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x83002028, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x83002829, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x83002829, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x8300302a, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x8300302a, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x83002038, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x83002038, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x8300223a, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x8300223a, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x8300523b, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x8300523b, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x83002040, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x83002040, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x8300f141, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x8300f141, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x8300014a, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x8300014a, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x8300e693, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x8300e693, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); /* serdes 1 init */ - writel(0x84000a05, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x84000a05, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x84002008, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x84002008, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x8400640f, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x8400640f, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x84000214, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x84000214, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x84008015, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x84008015, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x84000116, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x84000116, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x84001817, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x84001817, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x84003018, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x84003018, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x84000e24, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x84000e24, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x84008226, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x84008226, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x84001f27, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x84001f27, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x84002028, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x84002028, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x84002829, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x84002829, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x8400302a, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x8400302a, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x84002038, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x84002038, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x8400223a, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x8400223a, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x8400523b, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x8400523b, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x84002040, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x84002040, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x8400f141, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x8400f141, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x8400014a, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x8400014a, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); - writel(0x8400e693, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); + writel(0x8400e693, &priv->cpumacu_reg->CpuMacUnitHssRegAccCtl); mdelay(delay_ms); ctc_mac_hss_write(priv, 0x0c, 0x21, 0); @@ -862,29 +939,34 @@ static int ctc_mac_serdes_init(struct ctcmac_private *priv) ctc_mac_hss_write(priv, 0x14, 0x01, 1); ctc_mac_hss_write(priv, 0x26, 0x81, 1); + ctc_mac_hss_read(priv, 0x1c, &val, 2); + val &= 0xf8; + val |= 0x4; + ctc_mac_hss_write(priv, 0x1c, val, 2); + /* serdes post release */ - writel(0x83806003, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[0]); - writel(0x83826003, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[0]); + writel(0x83806003, &priv->cpumacu_reg->CpuMacUnitHssCfg[0]); + writel(0x83826003, &priv->cpumacu_reg->CpuMacUnitHssCfg[0]); - writel(0x28061801, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[2]); - writel(0x28061c01, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[2]); - writel(0x28071c01, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[2]); + writel(0x28061801, &priv->cpumacu_reg->CpuMacUnitHssCfg[2]); + writel(0x28061c01, &priv->cpumacu_reg->CpuMacUnitHssCfg[2]); + writel(0x28071c01, &priv->cpumacu_reg->CpuMacUnitHssCfg[2]); - writel(0x28061811, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[8]); - writel(0x28061c11, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[8]); - writel(0x28071c11, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[8]); + writel(0x28061811, &priv->cpumacu_reg->CpuMacUnitHssCfg[8]); + writel(0x28061c11, &priv->cpumacu_reg->CpuMacUnitHssCfg[8]); + writel(0x28071c11, &priv->cpumacu_reg->CpuMacUnitHssCfg[8]); ret = - readl_poll_timeout(&priv->cpumacu_reg->cpu_mac_unit_hss_mon[1], - status, + readl_poll_timeout(&priv->cpumacu_reg->CpuMacUnitHssMon[1], status, status & - CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_DFE_RST_DONE, + BIT + (CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_DFE_RST_DONE_BIT), 1000, 2000000); if (ret) { netdev_dbg(priv->ndev, - "%s:wait for hss reset done fail with cpu_mac_unit_hss_mon[1]:0x%x\n", + "%s:wait for hss reset done fail with CpuMacUnitHssMon[1]:0x%x\n", priv->ndev->name, - readl(&priv->cpumacu_reg->cpu_mac_unit_hss_mon[1])); + readl(&priv->cpumacu_reg->CpuMacUnitHssMon[1])); } mdelay(delay_ms); @@ -893,6 +975,122 @@ static int ctc_mac_serdes_init(struct ctcmac_private *priv) return 0; } +static void ctcmac_mac_filter_init(struct ctcmac_private *priv) +{ + unsigned char *dev_addr; + u32 val, addr_h = 0, addr_l = 0; + + if (priv->version == 0) + return; + + /* mac filter table 0~3 are assigned to cpumac0 + mac filter table 4~7 are assigned to cpumac1 + mac filter table 0/4:white list to receive pacekt with local mac address + mac filter table 1/5:white list to receive pacekt with broadcast mac address + mac filter table 2/6:white list to receive pacekt with multicast mac address + mac filter table 3/7:white list to receive pacekt with multicast mac address + */ + + /* 1. mac filter table 0~3 are assigned to cpumac0 + mac filter table 4~7 are assigned to cpumac1 */ + if (priv->index == 0) { + val = readl(&priv->cpumacu_reg->CpuMacUnitFilterCfg1[0]); + val |= (0xf << 16); + val &= ~(0xf0 << 16); + writel(val, &priv->cpumacu_reg->CpuMacUnitFilterCfg1[0]); + + val = readl(&priv->cpumacu_reg->CpuMacUnitFilterCfg1[1]); + val |= + BIT + (CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_CHECK_NORMAL_PKT_ENABLE0_BIT); + val |= + BIT(CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_DROP_NORMAL_PKT0_BIT); + writel(val, &priv->cpumacu_reg->CpuMacUnitFilterCfg1[1]); + } else { + val = readl(&priv->cpumacu_reg->CpuMacUnitFilterCfg1[0]); + val |= (0xf0 << 24); + val &= ~(0xf << 24); + writel(val, &priv->cpumacu_reg->CpuMacUnitFilterCfg1[0]); + + val = readl(&priv->cpumacu_reg->CpuMacUnitFilterCfg1[1]); + val |= + BIT + (CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_CHECK_NORMAL_PKT_ENABLE1_BIT); + val |= + BIT(CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_DROP_NORMAL_PKT1_BIT); + writel(val, &priv->cpumacu_reg->CpuMacUnitFilterCfg1[1]); + } + + /* 2. enable mac filter function */ + val = readl(&priv->cpumacu_reg->CpuMacUnitFilterCfg[0]); + val |= BIT(CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_FILTER_EN_BIT); + val &= ~BIT(CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_CAM_IS_BLACK_LIST_BIT); + val &= ~BIT(CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA0_BIT); + val &= ~BIT(CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA1_BIT); + val &= ~BIT(CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA2_BIT); + val &= ~BIT(CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA3_BIT); + val &= ~BIT(CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA4_BIT); + val &= ~BIT(CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA5_BIT); + val &= ~BIT(CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA6_BIT); + val &= ~BIT(CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA7_BIT); + writel(val, &priv->cpumacu_reg->CpuMacUnitFilterCfg[0]); + + /* 3. mac filter table 0/4:white list to receive pacekt with local mac address */ + dev_addr = priv->ndev->dev_addr; + addr_h = dev_addr[0] << 8 | dev_addr[1]; + addr_l = + dev_addr[2] << 24 | dev_addr[3] << 16 | dev_addr[4] << 8 | + dev_addr[5]; + if (priv->index == 0) { + writel(addr_l, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[0]); + writel(addr_h, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[1]); + writel(0xffffffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[16]); + writel(0x0000ffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[17]); + } else { + writel(addr_l, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[8]); + writel(addr_h, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[9]); + writel(0xffffffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[24]); + writel(0x0000ffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[25]); + } + + /* 4. mac filter table 1/5:white list to receive pacekt with broadcast mac address */ + if (priv->index == 0) { + writel(0xffffffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[2]); + writel(0x0000ffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[3]); + writel(0xffffffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[18]); + writel(0x0000ffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[19]); + } else { + writel(0xffffffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[10]); + writel(0x0000ffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[11]); + writel(0xffffffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[26]); + writel(0x0000ffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[27]); + } + + /* mac filter table 2/6/3/7 reserved */ + if (priv->index == 0) { + writel(0x00000000, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[4]); + writel(0x00000000, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[5]); + writel(0xffffffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[20]); + writel(0xffffffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[21]); + + writel(0x00000000, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[6]); + writel(0x00000000, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[7]); + writel(0xffffffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[22]); + writel(0xffffffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[23]); + } else { + writel(0x00000000, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[12]); + writel(0x00000000, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[13]); + writel(0xffffffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[28]); + writel(0xffffffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[29]); + + writel(0x00000000, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[14]); + writel(0x00000000, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[15]); + writel(0xffffffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[30]); + writel(0xffffffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[31]); + } + +} + /* Hardware init flow */ static void ctcmac_hw_init(struct ctcmac_private *priv) { @@ -900,92 +1098,101 @@ static void ctcmac_hw_init(struct ctcmac_private *priv) u32 val; int use_extram = 0; + /* tx/rx polarity invert */ + ctc_mac_pol_inv(priv); + /* two cpumac access the same cpumac unit register */ spin_lock_irq(&global_reglock); if (priv->index == 0) { - /* release cpu_mac_0 */ - clrsetbits(&priv->cpumacu_reg->cpu_mac_unit_reset_ctl, - CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_BASE, - CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_CPU_MAC0); - clrsetbits(&priv->cpumacu_reg->cpu_mac_unit_reset_ctl, - CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_CPU_MAC0, 0); + /* release CpuMac0 */ + clrsetbits(&priv->cpumacu_reg->CpuMacUnitResetCtl, + BIT(CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_BASE_BIT), + BIT + (CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_CPU_MAC0_BIT)); + clrsetbits(&priv->cpumacu_reg->CpuMacUnitResetCtl, + BIT + (CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_CPU_MAC0_BIT), + 0); } else { - /* release cpu_mac_0 */ - clrsetbits(&priv->cpumacu_reg->cpu_mac_unit_reset_ctl, - CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_BASE, - CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_CPU_MAC1); - clrsetbits(&priv->cpumacu_reg->cpu_mac_unit_reset_ctl, - CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_CPU_MAC1, 0); + /* release CpuMac0 */ + clrsetbits(&priv->cpumacu_reg->CpuMacUnitResetCtl, + BIT(CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_BASE_BIT), + BIT + (CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_CPU_MAC1_BIT)); + clrsetbits(&priv->cpumacu_reg->CpuMacUnitResetCtl, + BIT + (CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_CPU_MAC1_BIT), + 0); } - clrsetbits(&priv->cpumacu_reg->cpu_mac_unit_ts_cfg, - 0, CPU_MAC_UNIT_TS_CFG_W0_CFG_FORCE_S_AND_NS_EN); + clrsetbits(&priv->cpumacu_reg->CpuMacUnitTsCfg, + 0, BIT(CPU_MAC_UNIT_TS_CFG_W0_CFG_FORCE_S_AND_NS_EN_BIT)); spin_unlock_irq(&global_reglock); mdelay(10); - /* init cpu_mac */ - clrsetbits(&priv->cpumac_reg->cpu_mac_init, 0, - CPU_MAC_INIT_DONE_W0_INIT_DONE); + /* init CpuMac */ + clrsetbits(&priv->cpumac_reg->CpuMacInit, 0, + BIT(CPU_MAC_INIT_DONE_W0_INIT_DONE_BIT)); udelay(1); if (priv->interface == PHY_INTERFACE_MODE_SGMII) { /* switch to sgmii and enable auto nego */ - val = readl(&priv->cpumac_reg->cpu_mac_sgmii_auto_neg_cfg); + val = readl(&priv->cpumac_reg->CpuMacSgmiiAutoNegCfg); val &= ~(CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_ENABLE_MASK | CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_MODE_MASK); val |= (CSA_SGMII_MD_MASK | CSA_EN); - writel(val, &priv->cpumac_reg->cpu_mac_sgmii_auto_neg_cfg); + writel(val, &priv->cpumac_reg->CpuMacSgmiiAutoNegCfg); } if (priv->autoneg_mode == CTCMAC_AUTONEG_DISABLE) { - clrsetbits(&priv->cpumac_reg->cpu_mac_sgmii_auto_neg_cfg, - CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_ENABLE, 0); + clrsetbits(&priv->cpumac_reg->CpuMacSgmiiAutoNegCfg, + BIT(CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_ENABLE_BIT), + 0); } else { - val = readl(&priv->cpumac_reg->cpu_mac_sgmii_auto_neg_cfg); + val = readl(&priv->cpumac_reg->CpuMacSgmiiAutoNegCfg); val &= ~CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_MODE_MASK; val |= - (priv->autoneg_mode << 2 | - CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_ENABLE); - writel(val, &priv->cpumac_reg->cpu_mac_sgmii_auto_neg_cfg); + (priv-> + autoneg_mode << 2 | + BIT(CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_ENABLE_BIT)); + writel(val, &priv->cpumac_reg->CpuMacSgmiiAutoNegCfg); } /* disable rx link filter */ - clrsetbits(&priv->cpumac_reg->cpu_mac_sgmii_cfg[0], - CPU_MAC_SGMII_CFG_W0_CFG_MII_RX_LINK_FILTER_EN, 0); + clrsetbits(&priv->cpumac_reg->CpuMacSgmiiCfg[0], + BIT(CPU_MAC_SGMII_CFG_W0_CFG_MII_RX_LINK_FILTER_EN_BIT), 0); /* ignore tx event */ - clrsetbits(&priv->cpumac_reg->cpu_mac_sgmii_cfg[0], - 0, CPU_MAC_SGMII_CFG_W0_CFG_TX_EVEN_IGNORE); + clrsetbits(&priv->cpumac_reg->CpuMacSgmiiCfg[0], + 0, BIT(CPU_MAC_SGMII_CFG_W0_CFG_TX_EVEN_IGNORE_BIT)); - clrsetbits(&priv->cpumac_reg->cpu_mac_axi_cfg, - 0, CPU_MAC_AXI_CFG_W0_CFG_AXI_RD_D_WORD_SWAP_EN); - clrsetbits(&priv->cpumac_reg->cpu_mac_axi_cfg, - 0, CPU_MAC_AXI_CFG_W0_CFG_AXI_WR_D_WORD_SWAP_EN); + clrsetbits(&priv->cpumac_reg->CpuMacAxiCfg, + 0, BIT(CPU_MAC_AXI_CFG_W0_CFG_AXI_RD_D_WORD_SWAP_EN_BIT)); + clrsetbits(&priv->cpumac_reg->CpuMacAxiCfg, + 0, BIT(CPU_MAC_AXI_CFG_W0_CFG_AXI_WR_D_WORD_SWAP_EN_BIT)); /* drop over size packet */ - clrsetbits(&priv->cpumac_reg->cpu_mac_gmac_cfg[0], - 0, CPU_MAC_GMAC_CFG_W0_CFG_RX_OVERRUN_DROP_EN - | CPU_MAC_GMAC_CFG_W0_CFG_RX_OVERSIZE_DROP_EN); + clrsetbits(&priv->cpumac_reg->CpuMacGmacCfg[0], + 0, BIT(CPU_MAC_GMAC_CFG_W0_CFG_RX_OVERRUN_DROP_EN_BIT) + | BIT(CPU_MAC_GMAC_CFG_W0_CFG_RX_OVERSIZE_DROP_EN_BIT)); /* not strip 4B crc when send packet */ - clrsetbits(&priv->cpumac_reg->cpu_mac_gmac_cfg[2], - CPU_MAC_GMAC_CFG_W2_CFG_TX_STRIP_CRC_EN, 0); + clrsetbits(&priv->cpumac_reg->CpuMacGmacCfg[2], + BIT(CPU_MAC_GMAC_CFG_W2_CFG_TX_STRIP_CRC_EN_BIT), 0); /* enable cut-through mode */ - clrsetbits(&priv->cpumac_reg->cpu_mac_gmac_cfg[2], - 0, CPU_MAC_GMAC_CFG_W2_CFG_TX_CUT_THROUGH_EN); + clrsetbits(&priv->cpumac_reg->CpuMacGmacCfg[2], + 0, BIT(CPU_MAC_GMAC_CFG_W2_CFG_TX_CUT_THROUGH_EN_BIT)); for (i = 0; i < priv->num_tx_queues; i++) { - if (priv->tx_queue[i]->tx_ring_size > - CTCMAC_INTERNAL_RING_SIZE) { + if (priv->tx_queue[i]->tx_ring_size > CTCMAC_INTERNAL_RING_SIZE) { use_extram = 1; break; } } for (i = 0; i < priv->num_rx_queues; i++) { - if (priv->rx_queue[i]->rx_ring_size > - CTCMAC_INTERNAL_RING_SIZE) { + if (priv->rx_queue[i]->rx_ring_size > CTCMAC_INTERNAL_RING_SIZE) { use_extram = 1; break; } @@ -993,9 +1200,7 @@ static void ctcmac_hw_init(struct ctcmac_private *priv) if (use_extram) { spin_lock_irq(&global_reglock); - /* enable external SRAM to store rx/tx desc, - * support max 1023*3 desc - */ + /* enable external SRAM to store rx/tx desc, support max 1023*3 desc */ regmap_read(regmap_base, offsetof(struct SysCtl_regs, SysMemCtl), &val); val |= SYS_MEM_CTL_W0_CFG_RAM_MUX_EN; @@ -1004,22 +1209,20 @@ static void ctcmac_hw_init(struct ctcmac_private *priv) spin_unlock_irq(&global_reglock); if (priv->index == 0) { - ctcmac_regw(&priv->cpumac_reg->cpu_mac_ext_ram_cfg[1], + ctcmac_regw(&priv->cpumac_reg->CpuMacExtRamCfg[1], CTCMAC0_EXSRAM_BASE); } else { - ctcmac_regw(&priv->cpumac_reg->cpu_mac_ext_ram_cfg[1], + ctcmac_regw(&priv->cpumac_reg->CpuMacExtRamCfg[1], CTCMAC1_EXSRAM_BASE); } - ctcmac_regw(&priv->cpumac_reg->cpu_mac_ext_ram_cfg[0], + ctcmac_regw(&priv->cpumac_reg->CpuMacExtRamCfg[0], CTCMAC_TX_RING_SIZE); - clrsetbits(&priv->cpumac_reg->cpu_mac_ext_ram_cfg[0], 0, - CPU_MAC_EXT_RAM_CFG_W0_CFG_EXT_RAM_EN); + clrsetbits(&priv->cpumac_reg->CpuMacExtRamCfg[0], 0, + BIT(CPU_MAC_EXT_RAM_CFG_W0_CFG_EXT_RAM_EN_BIT)); } else { - /* disable external SRAM to store rx/tx desc, - * support max 64*3 desc - */ - clrsetbits(&priv->cpumac_reg->cpu_mac_ext_ram_cfg[0], - CPU_MAC_EXT_RAM_CFG_W0_CFG_EXT_RAM_EN, 0); + /* disable external SRAM to store rx/tx desc, support max 64*3 desc */ + clrsetbits(&priv->cpumac_reg->CpuMacExtRamCfg[0], + BIT(CPU_MAC_EXT_RAM_CFG_W0_CFG_EXT_RAM_EN_BIT), 0); spin_lock_irq(&global_reglock); regmap_read(regmap_base, @@ -1031,24 +1234,55 @@ static void ctcmac_hw_init(struct ctcmac_private *priv) } if (priv->int_type == CTCMAC_INT_DESC) { - val = CPU_MAC_DESC_CFG_W0_CFG_TX_DESC_ACK_EN - | (CTCMAC_DESC_INT_NUM << 16) - | (CTCMAC_DESC_INT_NUM << 8) - | (CTCMAC_DESC_INT_NUM << 0); - ctcmac_regw(&priv->cpumac_reg->cpu_mac_desc_cfg[0], val); + val = BIT(CPU_MAC_DESC_CFG_W0_CFG_TX_DESC_ACK_EN_BIT) + | (priv->rx_int_coalesce_cnt << 16) + | (priv->rx_int_coalesce_cnt << 8) + | (priv->tx_int_coalesce_cnt << 0); + ctcmac_regw(&priv->cpumac_reg->CpuMacDescCfg[0], val); + if (priv->version > 0) { + val = ctcmac_regr(&priv->cpumac_reg->CpuMacDescCfg1[0]); + val |= + (1 << + CPU_MAC_DESC_CFG1_W0_CFG_RX_DESC_DONE_INTR_TIMER_EN) + | (1 << + CPU_MAC_DESC_CFG1_W0_CFG_TX_DESC_DONE_INTR_TIMER_EN); + ctcmac_regw(&priv->cpumac_reg->CpuMacDescCfg1[0], val); + ctcmac_regw(&priv->cpumac_reg->CpuMacDescCfg1[1], + CTCMAC_TIMER_THRD); + ctcmac_regw(&priv->cpumac_reg->CpuMacDescCfg1[2], + CTCMAC_TIMER_THRD); + } } else { - val = CPU_MAC_DESC_CFG_W0_CFG_TX_DESC_DONE_INTR_EOP_EN - | CPU_MAC_DESC_CFG_W0_CFG_RX_DESC_DONE_INTR_EOP_EN - | CPU_MAC_DESC_CFG_W0_CFG_TX_DESC_ACK_EN; - ctcmac_regw(&priv->cpumac_reg->cpu_mac_desc_cfg[0], val); + val = BIT(CPU_MAC_DESC_CFG_W0_CFG_TX_DESC_DONE_INTR_EOP_EN_BIT) + | BIT(CPU_MAC_DESC_CFG_W0_CFG_RX_DESC_DONE_INTR_EOP_EN_BIT) + | BIT(CPU_MAC_DESC_CFG_W0_CFG_TX_DESC_ACK_EN_BIT); + ctcmac_regw(&priv->cpumac_reg->CpuMacDescCfg[0], val); + } + + ctcmac_mac_filter_init(priv); + + /* clear and mask all interrupt */ + ctcmac_regw(&priv->cpumac_reg->CpuMacInterruptFunc[1], 0xffffffff); + ctcmac_regw(&priv->cpumac_reg->CpuMacInterruptNormal[1], 0xffffffff); + ctcmac_regw(&priv->cpumac_reg->CpuMacInterruptFunc[2], 0xffffffff); + ctcmac_regw(&priv->cpumac_reg->CpuMacInterruptNormal[2], 0xffffffff); + + if (priv->version > 0) { + ctcmac_regw(&priv->cpumac_reg->CpuMacInterruptFunc0[1], + 0xffffffff); + ctcmac_regw(&priv->cpumac_reg->CpuMacInterruptFunc1[1], + 0xffffffff); + ctcmac_regw(&priv->cpumac_reg->CpuMacInterruptFunc0[2], + 0xffffffff); + ctcmac_regw(&priv->cpumac_reg->CpuMacInterruptFunc1[2], + 0xffffffff); } +#if 0 + if (!(priv->ndev->flags & IFF_PROMISC)) { + ctcmac_init_mac_filter(priv); + } +#endif - /* clear all interrupt */ - ctcmac_regw(&priv->cpumac_reg->cpu_mac_interrupt_func[1], 0xffffffff); - ctcmac_regw(&priv->cpumac_reg->cpu_mac_interrupt_normal[1], 0xffffffff); - /* mask all interrupt */ - ctcmac_regw(&priv->cpumac_reg->cpu_mac_interrupt_func[2], 0xffffffff); - ctcmac_regw(&priv->cpumac_reg->cpu_mac_interrupt_normal[2], 0xffffffff); } static int ctcmac_wait_for_linkup(struct ctcmac_private *priv) @@ -1059,31 +1293,35 @@ static int ctcmac_wait_for_linkup(struct ctcmac_private *priv) if (priv->autoneg_mode == CTCMAC_AUTONEG_DISABLE) { /* wait for linkup */ while (timeout--) { - mon = readl(&priv->cpumac_reg->cpu_mac_sgmii_mon[0]); - if ((mon & 0x100) == 0x100) + mon = readl(&priv->cpumac_reg->CpuMacSgmiiMon[0]); + if ((mon & 0x100) == 0x100) { break; + } mdelay(1); } if ((mon & 0x100) != 0x100) { - pr_err("Error! when phy link up, link status %d is not right.\n", - mon); + printk + ("Error! when phy link up, link status %d is not right.\n", + mon); return -1; } } else { /* wait for sgmii auto nego complete */ while (timeout--) { - mon = readl(&priv->cpumac_reg->cpu_mac_sgmii_mon[0]); - if ((mon & CSM_ANST_MASK) == 6) + mon = readl(&priv->cpumac_reg->CpuMacSgmiiMon[0]); + if ((mon & CSM_ANST_MASK) == 6) { break; + } mdelay(1); } if ((mon & CSM_ANST_MASK) != 6) { - pr_err("Error! when phy link up, auto-neg status %d is not right.\n", - mon); + printk + ("Error! when phy link up, auto-neg status %d is not right.\n", + mon); return -1; } } @@ -1091,6 +1329,79 @@ static int ctcmac_wait_for_linkup(struct ctcmac_private *priv) return 0; } +static void ctcmac_cfg_flow_ctrl(struct ctcmac_private *priv, u8 tx_pause_en, + u8 rx_pause_en) +{ + u32 val; + + val = 1 << CPU_MAC_PAUSE_CFG_W0_CFG_RX_PAUSE_TIMER_DEC_VALUE_BIT; + writel(val, &priv->cpumac_reg->CpuMacPauseCfg[0]); + val = (0xffff << CPU_MAC_PAUSE_CFG_W1_CFG_TX_PAUSE_TIMER_ADJ_VALUE_BIT) + | (1 << CPU_MAC_PAUSE_CFG_W1_CFG_TX_PAUSE_TIMER_DEC_VALUE_BIT); + writel(val, &priv->cpumac_reg->CpuMacPauseCfg[1]); + + if (tx_pause_en || rx_pause_en) + val = 0xff; + else + val = 0x800000ff; + writel(val, &priv->cpumacu_reg->CpuMacUnitRefPulseCfg[0]); + + if (tx_pause_en) + clrsetbits(&priv->cpumac_reg->CpuMacPauseCfg[1], 0, + BIT(CPU_MAC_PAUSE_CFG_W1_CFG_TX_PAUSE_EN_BIT)); + if (rx_pause_en) { + clrsetbits(&priv->cpumac_reg->CpuMacPauseCfg[0], 0, + BIT(CPU_MAC_PAUSE_CFG_W0_CFG_RX_NORM_PAUSE_EN_BIT)); + clrsetbits(&priv->cpumac_reg->CpuMacGmacCfg[2], 0, + BIT(CPU_MAC_GMAC_CFG_W2_CFG_TX_PAUSE_STALL_EN_BIT)); + } +} + +/* IEEE 802.3-2000 +* Table 28B-3 +* Pause Resolution +* +* Local Remote Local Resolution Remote Resolution +* PAUSE ASM_DIR PAUSE ASM_DIR TX RX TX RX +* +* 0 0 x x 0 0 0 0 +* 0 1 0 x 0 0 0 0 +* 0 1 1 0 0 0 0 0 +* 0 1 1 1 1 0 0 1 +* 1 0 0 x 0 0 0 0 +* 1 x 1 x 1 1 1 1 +* 1 1 0 0 0 0 0 0 +* 1 1 0 1 0 1 1 0 +* +*/ +static void ctcmac_adjust_flow_ctrl(struct ctcmac_private *priv) +{ + struct net_device *ndev = priv->ndev; + struct phy_device *phydev = ndev->phydev; + + if (!phydev->duplex) + return; + + if (!priv->pause_aneg_en) { + ctcmac_cfg_flow_ctrl(priv, priv->tx_pause_en, + priv->rx_pause_en); + } else { + u16 lcl_adv, rmt_adv; + u8 flowctrl; + /* get link partner capabilities */ + rmt_adv = 0; + if (phydev->pause) + rmt_adv = LPA_PAUSE_CAP; + if (phydev->asym_pause) + rmt_adv |= LPA_PAUSE_ASYM; + + lcl_adv = linkmode_adv_to_lcl_adv_t(phydev->advertising); + flowctrl = mii_resolve_flowctrl_fdx(lcl_adv, rmt_adv); + ctcmac_cfg_flow_ctrl(priv, flowctrl & FLOW_CTRL_TX, + flowctrl & FLOW_CTRL_RX); + } +} + /* update cpumac speed when phy linkup speed changed */ static noinline void ctcmac_update_link_state(struct ctcmac_private *priv, struct phy_device *phydev) @@ -1101,12 +1412,13 @@ static noinline void ctcmac_update_link_state(struct ctcmac_private *priv, if (priv->interface != PHY_INTERFACE_MODE_SGMII) return; - if (netif_msg_link(priv)) + if (netif_msg_link(priv)) { netdev_dbg(priv->ndev, "link up speed is %d\n", speed); + } if (phydev->link) { - cfg_rep = readl(&priv->cpumac_reg->cpu_mac_sgmii_cfg[0]); - cfg_smp = readl(&priv->cpumac_reg->cpu_mac_sgmii_cfg[1]); + cfg_rep = readl(&priv->cpumac_reg->CpuMacSgmiiCfg[0]); + cfg_smp = readl(&priv->cpumac_reg->CpuMacSgmiiCfg[1]); cfg_rep &= ~CSC_REP_MASK; cfg_smp &= ~CSC_SMP_MASK; if (speed == 1000) { @@ -1121,9 +1433,10 @@ static noinline void ctcmac_update_link_state(struct ctcmac_private *priv, } else { return; } - writel(cfg_rep, &priv->cpumac_reg->cpu_mac_sgmii_cfg[0]); - writel(cfg_smp, &priv->cpumac_reg->cpu_mac_sgmii_cfg[1]); + writel(cfg_rep, &priv->cpumac_reg->CpuMacSgmiiCfg[0]); + writel(cfg_smp, &priv->cpumac_reg->CpuMacSgmiiCfg[1]); + ctcmac_adjust_flow_ctrl(priv); ctcmac_wait_for_linkup(priv); if (!priv->oldlink) @@ -1134,6 +1447,8 @@ static noinline void ctcmac_update_link_state(struct ctcmac_private *priv, priv->oldspeed = 0; priv->oldduplex = -1; } + + return; } static void adjust_link(struct net_device *dev) @@ -1153,10 +1468,28 @@ static void adjust_link(struct net_device *dev) static int ctcmac_init_phy(struct net_device *dev) { int err; + __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { + 0,}; struct ctcmac_private *priv = netdev_priv(dev); phy_interface_t interface; struct phy_device *phydev; - + const int phy_10_features_array[2] = { + ETHTOOL_LINK_MODE_10baseT_Half_BIT, + ETHTOOL_LINK_MODE_10baseT_Full_BIT, + }; + + linkmode_set_bit_array(phy_10_features_array, + ARRAY_SIZE(phy_10_features_array), mask); + linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, mask); + linkmode_set_bit(ETHTOOL_LINK_MODE_MII_BIT, mask); + if (priv->supported & SUPPORTED_100baseT_Full) { + linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT, mask); + linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, mask); + } + if (priv->supported & SUPPORTED_1000baseT_Full) { + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, mask); + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, mask); + } priv->oldlink = 0; priv->oldspeed = 0; priv->oldduplex = -1; @@ -1177,8 +1510,11 @@ static int ctcmac_init_phy(struct net_device *dev) } /* Remove any features not supported by the controller */ - phydev->supported &= priv->supported; - phydev->advertising = phydev->supported; + linkmode_and(phydev->supported, phydev->supported, mask); + linkmode_copy(phydev->advertising, phydev->supported); + + /* Add support for flow control */ + phy_support_asym_pause(phydev); return 0; } @@ -1191,13 +1527,45 @@ static irqreturn_t ctcmac_receive(int irq, struct ctcmac_private *priv) /* disable interrupt */ spin_lock_irqsave(&priv->reglock, flags); writel(CTCMAC_NOR_RX0_D | CTCMAC_NOR_RX1_D, - &priv->cpumac_reg->cpu_mac_interrupt_func[2]); + &priv->cpumac_reg->CpuMacInterruptFunc[2]); spin_unlock_irqrestore(&priv->reglock, flags); __napi_schedule(&priv->napi_rx); } else { /* clear interrupt */ writel(CTCMAC_NOR_RX0_D | CTCMAC_NOR_RX1_D, - &priv->cpumac_reg->cpu_mac_interrupt_func[1]); + &priv->cpumac_reg->CpuMacInterruptFunc[1]); + } + + return IRQ_HANDLED; +} + +static irqreturn_t ctcmac_receive0(int irq, struct ctcmac_private *priv) +{ + if (likely(napi_schedule_prep(&priv->napi_rx))) { + /* disable interrupt */ + writel(CTCMAC_FUNC0_RX_D, + &priv->cpumac_reg->CpuMacInterruptFunc0[2]); + __napi_schedule(&priv->napi_rx); + } else { + /* clear interrupt */ + writel(CTCMAC_FUNC0_RX_D, + &priv->cpumac_reg->CpuMacInterruptFunc0[1]); + } + + return IRQ_HANDLED; +} + +static irqreturn_t ctcmac_receive1(int irq, struct ctcmac_private *priv) +{ + if (likely(napi_schedule_prep(&priv->napi_rx1))) { + /* disable interrupt */ + writel(CTCMAC_FUNC1_RX_D, + &priv->cpumac_reg->CpuMacInterruptFunc1[2]); + __napi_schedule(&priv->napi_rx1); + } else { + /* clear interrupt */ + writel(CTCMAC_FUNC1_RX_D, + &priv->cpumac_reg->CpuMacInterruptFunc1[1]); } return IRQ_HANDLED; @@ -1211,14 +1579,14 @@ static irqreturn_t ctcmac_transmit(int irq, struct ctcmac_private *priv) /* disable interrupt */ spin_lock_irqsave(&priv->reglock, flags); writel(CTCMAC_NOR_TX_D, - &priv->cpumac_reg->cpu_mac_interrupt_func[2]); + &priv->cpumac_reg->CpuMacInterruptFunc[2]); spin_unlock_irqrestore(&priv->reglock, flags); __napi_schedule(&priv->napi_tx); } else { /* clear interrupt */ writel(CTCMAC_NOR_TX_D, - &priv->cpumac_reg->cpu_mac_interrupt_func[1]); + &priv->cpumac_reg->CpuMacInterruptFunc[1]); } return IRQ_HANDLED; @@ -1229,8 +1597,8 @@ static irqreturn_t ctcmac_func(int irq, void *data) u32 event, stat, mask; struct ctcmac_private *priv = (struct ctcmac_private *)data; - stat = ctcmac_regr(&priv->cpumac_reg->cpu_mac_interrupt_func[0]); - mask = ctcmac_regr(&priv->cpumac_reg->cpu_mac_interrupt_func[2]); + stat = ctcmac_regr(&priv->cpumac_reg->CpuMacInterruptFunc[0]); + mask = ctcmac_regr(&priv->cpumac_reg->CpuMacInterruptFunc[2]); event = stat & ~mask; if (netif_msg_intr(priv)) { @@ -1238,11 +1606,40 @@ static irqreturn_t ctcmac_func(int irq, void *data) "function interrupt stat 0x%x mask 0x%x\n", stat, mask); } - if ((event & CTCMAC_NOR_RX0_D) || (event & CTCMAC_NOR_RX1_D)) + if ((event & CTCMAC_NOR_RX0_D) || (event & CTCMAC_NOR_RX1_D)) { ctcmac_receive(irq, priv); + } - if (event & CTCMAC_NOR_TX_D) + if (event & CTCMAC_NOR_TX_D) { ctcmac_transmit(irq, priv); + } + + return IRQ_HANDLED; +} + +static irqreturn_t ctcmac_tx_isr(int irq, void *data) +{ + struct ctcmac_private *priv = (struct ctcmac_private *)data; + + ctcmac_transmit(irq, priv); + + return IRQ_HANDLED; +} + +static irqreturn_t ctcmac_rx0_isr(int irq, void *data) +{ + struct ctcmac_private *priv = (struct ctcmac_private *)data; + + ctcmac_receive0(irq, priv); + + return IRQ_HANDLED; +} + +static irqreturn_t ctcmac_rx1_isr(int irq, void *data) +{ + struct ctcmac_private *priv = (struct ctcmac_private *)data; + + ctcmac_receive1(irq, priv); return IRQ_HANDLED; } @@ -1253,8 +1650,8 @@ static irqreturn_t ctcmac_normal(int irq, void *data) //TODO by liuht u32 stat, mask; struct ctcmac_private *priv = (struct ctcmac_private *)data; - stat = ctcmac_regr(&priv->cpumac_reg->cpu_mac_interrupt_func[0]); - mask = ctcmac_regr(&priv->cpumac_reg->cpu_mac_interrupt_func[2]); + stat = ctcmac_regr(&priv->cpumac_reg->CpuMacInterruptFunc[0]); + mask = ctcmac_regr(&priv->cpumac_reg->CpuMacInterruptFunc[2]); if (netif_msg_intr(priv)) { netdev_dbg(priv->ndev, "normal interrupt stat 0x%x mask 0x%x\n", @@ -1270,15 +1667,50 @@ static int ctcmac_request_irq(struct ctcmac_private *priv) err = request_irq(priv->irqinfo[CTCMAC_NORMAL].irq, ctcmac_normal, 0, priv->irqinfo[CTCMAC_NORMAL].name, priv); - if (err < 0) + if (err < 0) { free_irq(priv->irqinfo[CTCMAC_NORMAL].irq, priv); - enable_irq_wake(priv->irqinfo[CTCMAC_NORMAL].irq); + } - err = request_irq(priv->irqinfo[CTCMAC_FUNC].irq, ctcmac_func, 0, - priv->irqinfo[CTCMAC_FUNC].name, priv); - if (err < 0) - free_irq(priv->irqinfo[CTCMAC_FUNC].irq, priv); - enable_irq_wake(priv->irqinfo[CTCMAC_FUNC].irq); + enable_irq_wake(priv->irqinfo[CTCMAC_NORMAL].irq); + if (priv->version == 0) { + err = + request_irq(priv->irqinfo[CTCMAC_FUNC].irq, ctcmac_func, 0, + priv->irqinfo[CTCMAC_FUNC].name, priv); + if (err < 0) { + free_irq(priv->irqinfo[CTCMAC_FUNC].irq, priv); + } + enable_irq_wake(priv->irqinfo[CTCMAC_FUNC].irq); + } else { + err = + request_irq(priv->irqinfo[CTCMAC_FUNC].irq, ctcmac_tx_isr, + 0, priv->irqinfo[CTCMAC_FUNC].name, priv); + if (err < 0) { + free_irq(priv->irqinfo[CTCMAC_FUNC].irq, priv); + } + irq_set_affinity_hint(priv->irqinfo[CTCMAC_FUNC].irq, + get_cpu_mask(0)); + enable_irq_wake(priv->irqinfo[CTCMAC_FUNC].irq); + err = + request_irq(priv->irqinfo[CTCMAC_FUNC_RX0].irq, + ctcmac_rx0_isr, 0, + priv->irqinfo[CTCMAC_FUNC_RX0].name, priv); + if (err < 0) { + free_irq(priv->irqinfo[CTCMAC_FUNC_RX0].irq, priv); + } + irq_set_affinity_hint(priv->irqinfo[CTCMAC_FUNC_RX0].irq, + get_cpu_mask(0)); + enable_irq_wake(priv->irqinfo[CTCMAC_FUNC_RX0].irq); + err = + request_irq(priv->irqinfo[CTCMAC_FUNC_RX1].irq, + ctcmac_rx1_isr, 0, + priv->irqinfo[CTCMAC_FUNC_RX1].name, priv); + if (err < 0) { + free_irq(priv->irqinfo[CTCMAC_FUNC_RX1].irq, priv); + } + irq_set_affinity_hint(priv->irqinfo[CTCMAC_FUNC_RX1].irq, + get_cpu_mask(1)); + enable_irq_wake(priv->irqinfo[CTCMAC_FUNC_RX1].irq); + } return err; } @@ -1286,7 +1718,16 @@ static int ctcmac_request_irq(struct ctcmac_private *priv) static void ctcmac_free_irq(struct ctcmac_private *priv) { free_irq(priv->irqinfo[CTCMAC_NORMAL].irq, priv); - free_irq(priv->irqinfo[CTCMAC_FUNC].irq, priv); + if (priv->version == 0) { + free_irq(priv->irqinfo[CTCMAC_FUNC].irq, priv); + } else { + irq_set_affinity_hint(priv->irqinfo[CTCMAC_FUNC].irq, NULL); + irq_set_affinity_hint(priv->irqinfo[CTCMAC_FUNC_RX0].irq, NULL); + irq_set_affinity_hint(priv->irqinfo[CTCMAC_FUNC_RX1].irq, NULL); + free_irq(priv->irqinfo[CTCMAC_FUNC].irq, priv); + free_irq(priv->irqinfo[CTCMAC_FUNC_RX0].irq, priv); + free_irq(priv->irqinfo[CTCMAC_FUNC_RX1].irq, priv); + } } static bool ctcmac_new_page(struct ctcmac_priv_rx_q *rxq, @@ -1319,7 +1760,7 @@ static void ctcmac_fill_rxbd(struct ctcmac_private *priv, u32 desc_cfg_low, desc_cfg_high; dma_addr_t bufaddr = rxb->dma + rxb->page_offset; - /* DDR base address is 0 for cpu_mac, but is 0x80000000 for CPU */ + /* DDR base address is 0 for CpuMac, but is 0x80000000 for CPU */ desc_cfg_low = (bufaddr - CTC_DDR_BASE) & CPU_MAC_DESC_INTF_W0_DESC_ADDR_31_0_MASK; /* CPU_MAC_DESC_INTF_W1_DESC_SIZE:bit(8) */ @@ -1330,19 +1771,17 @@ static void ctcmac_fill_rxbd(struct ctcmac_private *priv, spin_lock_irq(&priv->reglock); if (qidx) { - ctcmac_regw(&priv->cpumac_mem->cpu_mac_desc_intf_1[0], + ctcmac_regw(&priv->cpumac_mem->CpuMacDescIntf1[0], desc_cfg_low); - /* barrier */ smp_mb__before_atomic(); - ctcmac_regw(&priv->cpumac_mem->cpu_mac_desc_intf_1[1], + ctcmac_regw(&priv->cpumac_mem->CpuMacDescIntf1[1], desc_cfg_high); } else { - ctcmac_regw(&priv->cpumac_mem->cpu_mac_desc_intf_0[0], + ctcmac_regw(&priv->cpumac_mem->CpuMacDescIntf0[0], desc_cfg_low); - /* barrier */ smp_mb__before_atomic(); - ctcmac_regw(&priv->cpumac_mem->cpu_mac_desc_intf_0[1], + ctcmac_regw(&priv->cpumac_mem->CpuMacDescIntf0[1], desc_cfg_high); } @@ -1362,10 +1801,9 @@ static void ctcmac_fill_txbd(struct ctcmac_private *priv, (txdesc->size << 8) | (txdesc->sop << 22) | (txdesc->eop << 23); spin_lock_irq(&priv->reglock); - ctcmac_regw(&priv->cpumac_mem->cpu_mac_desc_intf_2[0], desc_cfg_low); - /* barrier */ + ctcmac_regw(&priv->cpumac_mem->CpuMacDescIntf2[0], desc_cfg_low); smp_mb__before_atomic(); - ctcmac_regw(&priv->cpumac_mem->cpu_mac_desc_intf_2[1], desc_cfg_high); + ctcmac_regw(&priv->cpumac_mem->CpuMacDescIntf2[1], desc_cfg_high); spin_unlock_irq(&priv->reglock); } @@ -1376,28 +1814,24 @@ static void ctcmac_get_txbd(struct ctcmac_private *priv) u32 lstatus; spin_lock_irq(&priv->reglock); - lstatus = ctcmac_regr(&priv->cpumac_mem->cpu_mac_desc_intf_2[0]); - /* barrier */ + lstatus = ctcmac_regr(&priv->cpumac_mem->CpuMacDescIntf2[0]); smp_mb__before_atomic(); - lstatus = ctcmac_regr(&priv->cpumac_mem->cpu_mac_desc_intf_2[1]); + lstatus = ctcmac_regr(&priv->cpumac_mem->CpuMacDescIntf2[1]); spin_unlock_irq(&priv->reglock); } /* reclaim rx desc */ -static void ctcmac_get_rxbd(struct ctcmac_private *priv, u32 *lstatus, +static void ctcmac_get_rxbd(struct ctcmac_private *priv, u32 * lstatus, int qidx) { spin_lock_irq(&priv->reglock); if (qidx) { - ctcmac_regr(&priv->cpumac_mem->cpu_mac_desc_intf_1[0]); - *lstatus = - ctcmac_regr(&priv->cpumac_mem->cpu_mac_desc_intf_1[1]); + ctcmac_regr(&priv->cpumac_mem->CpuMacDescIntf1[0]); + *lstatus = ctcmac_regr(&priv->cpumac_mem->CpuMacDescIntf1[1]); } else { - ctcmac_regr(&priv->cpumac_mem->cpu_mac_desc_intf_0[0]); - *lstatus = - ctcmac_regr(&priv->cpumac_mem->cpu_mac_desc_intf_0[1]); + ctcmac_regr(&priv->cpumac_mem->CpuMacDescIntf0[0]); + *lstatus = ctcmac_regr(&priv->cpumac_mem->CpuMacDescIntf0[1]); } - /* barrier */ smp_mb__before_atomic(); spin_unlock_irq(&priv->reglock); @@ -1420,10 +1854,12 @@ static void ctcmac_alloc_rx_buffs(struct ctcmac_priv_rx_q *rx_queue, while (alloc_cnt--) { /* if rx buffer is unmapped, alloc new pages */ if (unlikely(!rxb->page)) { - if (unlikely(!ctcmac_new_page(rx_queue, rxb))) + if (unlikely(!ctcmac_new_page(rx_queue, rxb))) { break; - if (unlikely(++j == rx_queue->rx_ring_size)) + } + if (unlikely(++j == rx_queue->rx_ring_size)) { j = 0; + } } /* fill rx desc */ @@ -1453,14 +1889,17 @@ static void ctcmac_alloc_one_rx_buffs(struct ctcmac_priv_rx_q *rx_queue) rxb = &rx_queue->rx_buff[i]; if (unlikely(!rxb->page)) { - if (unlikely(!ctcmac_new_page(rx_queue, rxb))) + if (unlikely(!ctcmac_new_page(rx_queue, rxb))) { return; - if (unlikely(++j == rx_queue->rx_ring_size)) + } + if (unlikely(++j == rx_queue->rx_ring_size)) { j = 0; + } } - if (unlikely(++i == rx_queue->rx_ring_size)) + if (unlikely(++i == rx_queue->rx_ring_size)) { i = 0; + } rx_queue->next_to_use = i; rx_queue->next_to_alloc = j; @@ -1495,9 +1934,8 @@ static noinline int ctcmac_clean_rx_ring(struct ctcmac_priv_rx_q *rx_queue, } } else { alloc_new = rx_queue->token / CTCMAC_TOKEN_PER_PKT; - if (cleaned_cnt >= CTCMAC_RX_BUFF_ALLOC && alloc_new) { - alloc_new = min_t(int, cleaned_cnt, - (int)alloc_new); + if ((cleaned_cnt >= CTCMAC_RX_BUFF_ALLOC) && alloc_new) { + alloc_new = min(cleaned_cnt, (int)alloc_new); ctcmac_alloc_rx_buffs(rx_queue, alloc_new); rx_queue->token -= CTCMAC_TOKEN_PER_PKT * alloc_new; @@ -1532,13 +1970,13 @@ static noinline int ctcmac_clean_rx_ring(struct ctcmac_priv_rx_q *rx_queue, } /* fetch next buffer if not the last in frame */ - if (!(lstatus & CPU_MAC_DESC_INTF_W1_DESC_EOP)) { + if (!(lstatus & BIT(CPU_MAC_DESC_INTF_W1_DESC_EOP_BIT))) { if (rx_queue->pps_limit) rx_queue->token += CTCMAC_TOKEN_PER_PKT; continue; } - if (unlikely(lstatus & CPU_MAC_DESC_INTF_W1_DESC_ERR)) { + if (unlikely(lstatus & BIT(CPU_MAC_DESC_INTF_W1_DESC_ERR_BIT))) { /* discard faulty buffer */ dev_kfree_skb(skb); skb = NULL; @@ -1553,8 +1991,8 @@ static noinline int ctcmac_clean_rx_ring(struct ctcmac_priv_rx_q *rx_queue, skb_record_rx_queue(skb, rx_queue->qindex); ctcmac_process_frame(ndev, skb); - if (!(ndev->flags & IFF_PROMISC) && - skb->pkt_type == PACKET_OTHERHOST) { + if ((priv->version == 0) && !(ndev->flags & IFF_PROMISC) + && (skb->pkt_type == PACKET_OTHERHOST)) { /* discard */ dev_kfree_skb(skb); skb = NULL; @@ -1565,7 +2003,10 @@ static noinline int ctcmac_clean_rx_ring(struct ctcmac_priv_rx_q *rx_queue, total_pkts++; total_bytes += skb->len + ETH_HLEN; /* Send the packet up the stack */ - napi_gro_receive(&priv->napi_rx, skb); + if (qidx == 0) + napi_gro_receive(&priv->napi_rx, skb); + else + napi_gro_receive(&priv->napi_rx1, skb); skb = NULL; } @@ -1576,19 +2017,21 @@ static noinline int ctcmac_clean_rx_ring(struct ctcmac_priv_rx_q *rx_queue, rx_queue->stats.rx_packets += total_pkts; rx_queue->stats.rx_bytes += total_bytes; - if (!rx_queue->pps_limit && cleaned_cnt) + if (!rx_queue->pps_limit && cleaned_cnt) { ctcmac_alloc_rx_buffs(rx_queue, cleaned_cnt); + } - if (rx_queue->pps_limit && rx_queue->skb) + if (rx_queue->pps_limit && rx_queue->skb) { return budget; + } return howmany; } static void ctcmac_clean_tx_ring(struct ctcmac_priv_tx_q *tx_queue) { - u16 next_to_clean; - int tqi = tx_queue->qindex; + u16 skb_dirty, desc_dirty; + int tqi = tx_queue->qindex, nr_txbds, txbd_index; struct sk_buff *skb; struct netdev_queue *txq; struct ctcmac_tx_buff *tx_buff; @@ -1596,28 +2039,47 @@ static void ctcmac_clean_tx_ring(struct ctcmac_priv_tx_q *tx_queue) struct ctcmac_private *priv = netdev_priv(dev); txq = netdev_get_tx_queue(dev, tqi); - next_to_clean = tx_queue->next_to_clean; - while (ctcmac_txbd_used_untreated(priv)) { - ctcmac_get_txbd(priv); - skb = tx_queue->tx_skbuff[next_to_clean]; + skb_dirty = tx_queue->skb_dirty; + desc_dirty = tx_queue->desc_dirty; + while ((skb = tx_queue->tx_skbuff[skb_dirty].skb)) { + if (tx_queue->tx_skbuff[skb_dirty].frag_merge == 0) { + nr_txbds = skb_shinfo(skb)->nr_frags + 1; + } else { + nr_txbds = 1; + } + + if (ctcmac_txbd_used_untreated(priv) < nr_txbds) + break; + + for (txbd_index = 0; txbd_index < nr_txbds; txbd_index++) { + ctcmac_get_txbd(priv); + tx_buff = &tx_queue->tx_buff[desc_dirty]; + dma_unmap_single(priv->dev, tx_buff->dma, tx_buff->len, + DMA_TO_DEVICE); + if (tx_buff->alloc) + kfree(tx_buff->vaddr); + + desc_dirty = + (desc_dirty >= + tx_queue->tx_ring_size - 1) ? 0 : desc_dirty + 1; + } + skb = tx_queue->tx_skbuff[skb_dirty].skb; dev_kfree_skb_any(skb); - tx_queue->tx_skbuff[next_to_clean] = NULL; - tx_buff = &tx_queue->tx_buff[next_to_clean]; - dma_unmap_single(priv->dev, tx_buff->dma, - tx_buff->len, DMA_TO_DEVICE); - if (tx_buff->alloc) - kfree(tx_buff->vaddr); + tx_queue->tx_skbuff[skb_dirty].skb = NULL; + tx_queue->tx_skbuff[skb_dirty].frag_merge = 0; + skb_dirty = + (skb_dirty >= + tx_queue->tx_ring_size - 1) ? 0 : skb_dirty + 1; if (netif_msg_tx_queued(priv)) { - netdev_dbg(priv->ndev, "%s: clean skbuff id %d\n", - priv->ndev->name, tx_queue->next_to_clean); + netdev_dbg(priv->ndev, + "%s: skb_cur %d skb_dirty %d desc_cur %d desc_dirty %d\n", + priv->ndev->name, tx_queue->skb_cur, + tx_queue->skb_dirty, tx_queue->desc_cur, + tx_queue->desc_dirty); } - if ((next_to_clean + 1) >= tx_queue->tx_ring_size) - next_to_clean = 0; - else - next_to_clean++; spin_lock(&tx_queue->txlock); - tx_queue->num_txbdfree++; + tx_queue->num_txbdfree += nr_txbds; spin_unlock(&tx_queue->txlock); } @@ -1628,7 +2090,8 @@ static void ctcmac_clean_tx_ring(struct ctcmac_priv_tx_q *tx_queue) netif_wake_subqueue(priv->ndev, tqi); } - tx_queue->next_to_clean = next_to_clean; + tx_queue->skb_dirty = skb_dirty; + tx_queue->desc_dirty = desc_dirty; } static int ctcmac_poll_rx_sq(struct napi_struct *napi, int budget) @@ -1641,7 +2104,7 @@ static int ctcmac_poll_rx_sq(struct napi_struct *napi, int budget) /* clear interrupt */ writel(CTCMAC_NOR_RX0_D | CTCMAC_NOR_RX1_D, - &priv->cpumac_reg->cpu_mac_interrupt_func[1]); + &priv->cpumac_reg->CpuMacInterruptFunc[1]); rx_work_limit = budget; rxq0 = priv->rx_queue[0]; @@ -1656,39 +2119,83 @@ static int ctcmac_poll_rx_sq(struct napi_struct *napi, int budget) rxq1->rx_trigger = 0; if (work_done < budget) { napi_complete(napi); - if (!ctcmac_rxbd_usable(priv, 0) && - !ctcmac_rxbd_recycle(priv, 0)) + if (!ctcmac_rxbd_usable(priv, 0) + && !ctcmac_rxbd_recycle(priv, 0)) rxq0->rx_trigger = 1; - if (!ctcmac_rxbd_usable(priv, 1) && - !ctcmac_rxbd_recycle(priv, 1)) + if (!ctcmac_rxbd_usable(priv, 1) + && !ctcmac_rxbd_recycle(priv, 1)) rxq1->rx_trigger = 1; spin_lock_irq(&priv->reglock); /* enable interrupt */ writel(CTCMAC_NOR_RX0_D | CTCMAC_NOR_RX1_D, - &priv->cpumac_reg->cpu_mac_interrupt_func[3]); + &priv->cpumac_reg->CpuMacInterruptFunc[3]); spin_unlock_irq(&priv->reglock); } return work_done; } -static int ctcmac_poll_tx_sq(struct napi_struct *napi, int budget) +static int ctcmac_poll_rx0_sq(struct napi_struct *napi, int budget) +{ + int work_done = 0; + struct ctcmac_private *priv = + container_of(napi, struct ctcmac_private, napi_rx); + struct ctcmac_priv_rx_q *rx_queue = NULL; + + /* clear interrupt */ + writel(CTCMAC_FUNC0_RX_D, &priv->cpumac_reg->CpuMacInterruptFunc0[1]); + rx_queue = priv->rx_queue[0]; + work_done = ctcmac_clean_rx_ring(rx_queue, budget); + + if (work_done < budget) { + napi_complete(napi); + /* enable interrupt */ + writel(CTCMAC_FUNC0_RX_D, + &priv->cpumac_reg->CpuMacInterruptFunc0[3]); + } + + return work_done; +} + +static int ctcmac_poll_rx1_sq(struct napi_struct *napi, int budget) +{ + int work_done = 0; + struct ctcmac_private *priv = + container_of(napi, struct ctcmac_private, napi_rx1); + struct ctcmac_priv_rx_q *rx_queue = NULL; + + /* clear interrupt */ + writel(CTCMAC_FUNC1_RX_D, &priv->cpumac_reg->CpuMacInterruptFunc1[1]); + rx_queue = priv->rx_queue[1]; + work_done = ctcmac_clean_rx_ring(rx_queue, budget); + + if (work_done < budget) { + napi_complete(napi); + /* enable interrupt */ + writel(CTCMAC_FUNC1_RX_D, + &priv->cpumac_reg->CpuMacInterruptFunc1[3]); + } + + return work_done; +} + +static int ctcmac_poll_tx_sq(struct napi_struct *napi, int budget) //TODO by liuht { struct ctcmac_private *priv = container_of(napi, struct ctcmac_private, napi_tx); struct ctcmac_priv_tx_q *tx_queue = priv->tx_queue[0]; /* clear interrupt */ - writel(CTCMAC_NOR_TX_D, &priv->cpumac_reg->cpu_mac_interrupt_func[1]); + writel(CTCMAC_NOR_TX_D, &priv->cpumac_reg->CpuMacInterruptFunc[1]); ctcmac_clean_tx_ring(tx_queue); napi_complete(napi); /* enable interrupt */ spin_lock_irq(&priv->reglock); - writel(CTCMAC_NOR_TX_D, &priv->cpumac_reg->cpu_mac_interrupt_func[3]); + writel(CTCMAC_NOR_TX_D, &priv->cpumac_reg->CpuMacInterruptFunc[3]); spin_unlock_irq(&priv->reglock); return 0; @@ -1706,15 +2213,16 @@ static void ctcmac_free_rx_resources(struct ctcmac_private *priv) for (j = 0; j < rx_queue->rx_ring_size; j++) { struct ctcmac_rx_buff *rxb = &rx_queue->rx_buff[j]; - if (!rxb->page) continue; dma_unmap_single(rx_queue->dev, rxb->dma, PAGE_SIZE, DMA_TO_DEVICE); __free_page(rxb->page); } - kfree(rx_queue->rx_buff); - rx_queue->rx_buff = NULL; + if (rx_queue->rx_buff) { + kfree(rx_queue->rx_buff); + rx_queue->rx_buff = NULL; + } } } @@ -1762,8 +2270,10 @@ static void ctcmac_free_tx_resources(struct ctcmac_private *priv) tx_queue = priv->tx_queue[i]; txq = netdev_get_tx_queue(tx_queue->dev, tx_queue->qindex); - kfree(tx_queue->tx_skbuff); - tx_queue->tx_skbuff = NULL; + if (tx_queue->tx_skbuff) { + kfree(tx_queue->tx_skbuff); + tx_queue->tx_skbuff = NULL; + } } } @@ -1776,12 +2286,15 @@ static int ctcmac_init_tx_resources(struct net_device *ndev) for (i = 0; i < priv->num_tx_queues; i++) { tx_queue = priv->tx_queue[i]; tx_queue->num_txbdfree = tx_queue->tx_ring_size; - tx_queue->next_to_clean = 0; - tx_queue->next_to_alloc = 0; + tx_queue->skb_cur = 0; + tx_queue->skb_dirty = 0; + tx_queue->desc_cur = 0; + tx_queue->desc_dirty = 0; tx_queue->dev = ndev; tx_queue->tx_skbuff = kmalloc_array(tx_queue->tx_ring_size, - sizeof(*tx_queue->tx_skbuff), GFP_KERNEL); + sizeof(*tx_queue->tx_skbuff), + GFP_KERNEL | __GFP_ZERO); if (!tx_queue->tx_skbuff) goto cleanup; @@ -1816,15 +2329,22 @@ static int ctcmac_free_skb_resources(struct ctcmac_private *priv) static void cpumac_start(struct ctcmac_private *priv) { /* 1. enable rx/tx interrupt */ - writel(CTCMAC_NOR_TX_D | CTCMAC_NOR_RX0_D | CTCMAC_NOR_RX1_D, - &priv->cpumac_reg->cpu_mac_interrupt_func[3]); + if (priv->version == 0) { + writel(CTCMAC_NOR_TX_D | CTCMAC_NOR_RX0_D | CTCMAC_NOR_RX1_D, + &priv->cpumac_reg->CpuMacInterruptFunc[3]); + } else { + writel(CTCMAC_NOR_TX_D, + &priv->cpumac_reg->CpuMacInterruptFunc[3]); + writel(CTCMAC_FUNC0_RX_D, + &priv->cpumac_reg->CpuMacInterruptFunc0[3]); + writel(CTCMAC_FUNC1_RX_D, + &priv->cpumac_reg->CpuMacInterruptFunc1[3]); + } /* 2. enable rx/tx */ - clrsetbits(&priv->cpumac_reg->cpu_mac_reset, - CPU_MAC_RESET_W0_SOFT_RST_TX, - 0); - clrsetbits(&priv->cpumac_reg->cpu_mac_reset, - CPU_MAC_RESET_W0_SOFT_RST_RX, - 0); + clrsetbits(&priv->cpumac_reg->CpuMacReset, + BIT(CPU_MAC_RESET_W0_SOFT_RST_TX_BIT), 0); + clrsetbits(&priv->cpumac_reg->CpuMacReset, + BIT(CPU_MAC_RESET_W0_SOFT_RST_RX_BIT), 0); netif_trans_update(priv->ndev); /* prevent tx timeout */ } @@ -1832,13 +2352,19 @@ static void cpumac_start(struct ctcmac_private *priv) static void cpumac_halt(struct ctcmac_private *priv) { /* 1. disable rx/tx interrupt */ - ctcmac_regw(&priv->cpumac_reg->cpu_mac_interrupt_func[2], 0xffffffff); - ctcmac_regw(&priv->cpumac_reg->cpu_mac_interrupt_normal[2], 0xffffffff); + ctcmac_regw(&priv->cpumac_reg->CpuMacInterruptFunc[2], 0xffffffff); + ctcmac_regw(&priv->cpumac_reg->CpuMacInterruptNormal[2], 0xffffffff); + if (priv->version > 0) { + ctcmac_regw(&priv->cpumac_reg->CpuMacInterruptFunc0[2], + 0xffffffff); + ctcmac_regw(&priv->cpumac_reg->CpuMacInterruptFunc1[2], + 0xffffffff); + } /* 2. disable rx/tx */ - clrsetbits(&priv->cpumac_reg->cpu_mac_reset, 0, - CPU_MAC_RESET_W0_SOFT_RST_TX); - clrsetbits(&priv->cpumac_reg->cpu_mac_reset, 0, - CPU_MAC_RESET_W0_SOFT_RST_RX); + clrsetbits(&priv->cpumac_reg->CpuMacReset, 0, + BIT(CPU_MAC_RESET_W0_SOFT_RST_TX_BIT)); + clrsetbits(&priv->cpumac_reg->CpuMacReset, 0, + BIT(CPU_MAC_RESET_W0_SOFT_RST_RX_BIT)); } static void ctcmac_token_timer(struct timer_list *t) @@ -1852,31 +2378,31 @@ static void ctcmac_token_timer(struct timer_list *t) rxq0->token = min(rxq0->token + rxq0->pps_limit, rxq0->token_max); rxq1->token = min(rxq1->token + rxq1->pps_limit, rxq1->token_max); - if (rxq0->rx_trigger == 1 && (rxq0->token / CTCMAC_TOKEN_PER_PKT)) { + if ((rxq0->rx_trigger == 1) && (rxq0->token / CTCMAC_TOKEN_PER_PKT)) { rxq0->rx_trigger = 0; rxq0->token -= CTCMAC_TOKEN_PER_PKT; ctcmac_alloc_one_rx_buffs(rxq0); } - if (rxq1->rx_trigger == 1 && (rxq1->token / CTCMAC_TOKEN_PER_PKT)) { + if ((rxq1->rx_trigger == 1) && (rxq1->token / CTCMAC_TOKEN_PER_PKT)) { rxq1->rx_trigger = 0; rxq1->token -= CTCMAC_TOKEN_PER_PKT; ctcmac_alloc_one_rx_buffs(rxq1); } } -static ssize_t rxq0_pps_show(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t ctcmac_get_rxq0_pps(struct device *dev, + struct device_attribute *attr, char *buf) { struct ctcmac_private *priv = (struct ctcmac_private *)dev_get_drvdata(dev); - return sprintf(buf, "%d\n", priv->rx_queue[0]->pps_limit); + return sprintf(buf, "%d\n", priv->rx_queue[0]->pps_limit);; } -static ssize_t rxq0_pps_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t ctcmac_set_rxq0_pps(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { u32 rq0_pps; struct ctcmac_private *priv = @@ -1891,18 +2417,18 @@ static ssize_t rxq0_pps_store(struct device *dev, return count; } -static ssize_t rxq1_pps_show(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t ctcmac_get_rxq1_pps(struct device *dev, + struct device_attribute *attr, char *buf) { struct ctcmac_private *priv = (struct ctcmac_private *)dev_get_drvdata(dev); - return sprintf(buf, "%d\n", priv->rx_queue[1]->pps_limit); + return sprintf(buf, "%d\n", priv->rx_queue[1]->pps_limit);; } -static ssize_t rxq1_pps_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t ctcmac_set_rxq1_pps(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { u32 rq1_pps; struct ctcmac_private *priv = @@ -1917,8 +2443,10 @@ static ssize_t rxq1_pps_store(struct device *dev, return count; } -static DEVICE_ATTR(rxq0_pps, S_IRUGO | S_IWUSR, rxq0_pps_show, rxq0_pps_store); -static DEVICE_ATTR(rxq1_pps, S_IRUGO | S_IWUSR, rxq1_pps_show, rxq1_pps_store); +static DEVICE_ATTR(rxq0_pps, S_IRUGO | S_IWUSR, ctcmac_get_rxq0_pps, + ctcmac_set_rxq0_pps); +static DEVICE_ATTR(rxq1_pps, S_IRUGO | S_IWUSR, ctcmac_get_rxq1_pps, + ctcmac_set_rxq1_pps); static void ctcmac_pps_init(struct ctcmac_private *priv) { @@ -1966,8 +2494,6 @@ static void ctcmac_pps_cfg(struct ctcmac_private *priv) add_timer(&priv->token_timer); /* when enable pps ratelimit, must use desc done interrupt */ priv->int_type = CTCMAC_INT_DESC; - } else { - priv->int_type = CTCMAC_INT_PACKET; } } @@ -1979,77 +2505,226 @@ static int ctcmac_enet_open(struct net_device *dev) ctcmac_pps_cfg(priv); err = ctcmac_init_phy(dev); - if (err) + if (err) { return err; + } err = ctcmac_request_irq(priv); - if (err) + if (err) { return err; + } err = startup_ctcmac(dev); - if (err) + if (err) { return err; + } return 0; } -static struct ctcmac_tx_buff *skb_to_txbuff(struct ctcmac_private *priv, - struct sk_buff *skb) +static void head_to_txbuff_direct(struct device *dev, struct sk_buff *skb, + struct ctcmac_tx_buff *tx_buff) +{ + tx_buff->alloc = 0; + tx_buff->vaddr = skb->data; + tx_buff->len = skb_headlen(skb); + tx_buff->dma = dma_map_single(dev, skb->data, skb_headlen(skb), + DMA_TO_DEVICE); + tx_buff->offset = 0; +} + +static void frag_to_txbuff_direct(struct device *dev, skb_frag_t * frag, + struct ctcmac_tx_buff *tx_buff) +{ + tx_buff->alloc = 0; + tx_buff->vaddr = skb_frag_address(frag); + tx_buff->len = skb_frag_size(frag); + tx_buff->dma = + dma_map_single(dev, tx_buff->vaddr, tx_buff->len, DMA_TO_DEVICE); + tx_buff->offset = 0; +} + +static void head_to_txbuff_alloc(struct device *dev, struct sk_buff *skb, + struct ctcmac_tx_buff *tx_buff) { - u64 addr, offset; - int frag_index, nr_frags, rq; + u64 offset; + int alloc_size; + + alloc_size = ALIGN(skb->len, BUF_ALIGNMENT); + tx_buff->alloc = 1; + tx_buff->len = skb->len; + tx_buff->vaddr = kmalloc(alloc_size, GFP_KERNEL); + offset = + (BUF_ALIGNMENT - (((u64) tx_buff->vaddr) & (BUF_ALIGNMENT - 1))); + if (offset == BUF_ALIGNMENT) { + offset = 0; + } + tx_buff->offset = offset; + memcpy(tx_buff->vaddr + offset, skb->data, skb_headlen(skb)); + tx_buff->dma = dma_map_single(dev, tx_buff->vaddr, tx_buff->len, + DMA_TO_DEVICE); +} + +static void frag_to_txbuff_alloc(struct device *dev, skb_frag_t * frag, + struct ctcmac_tx_buff *tx_buff) +{ + u64 offset; + int alloc_size; + + alloc_size = ALIGN(skb_frag_size(frag), BUF_ALIGNMENT); + tx_buff->alloc = 1; + tx_buff->len = skb_frag_size(frag); + tx_buff->vaddr = kmalloc(alloc_size, GFP_KERNEL); + offset = + (BUF_ALIGNMENT - (((u64) tx_buff->vaddr) & (BUF_ALIGNMENT - 1))); + if (offset == BUF_ALIGNMENT) { + offset = 0; + } + tx_buff->offset = offset; + memcpy(tx_buff->vaddr + offset, skb_frag_address(frag), + skb_frag_size(frag)); + tx_buff->dma = + dma_map_single(dev, tx_buff->vaddr, tx_buff->len, DMA_TO_DEVICE); +} + +static void skb_to_txbuff_alloc(struct device *dev, struct sk_buff *skb, + struct ctcmac_tx_buff *tx_buff) +{ + u64 offset; + int alloc_size, frag_index; + skb_frag_t *frag; + + alloc_size = ALIGN(skb->len, BUF_ALIGNMENT); + tx_buff->alloc = 1; + tx_buff->len = skb->len; + tx_buff->vaddr = kmalloc(alloc_size, GFP_KERNEL); + offset = + (BUF_ALIGNMENT - (((u64) tx_buff->vaddr) & (BUF_ALIGNMENT - 1))); + if (offset == BUF_ALIGNMENT) { + offset = 0; + } + tx_buff->offset = offset; + memcpy(tx_buff->vaddr + offset, skb->data, skb_headlen(skb)); + offset += skb_headlen(skb); + for (frag_index = 0; frag_index < skb_shinfo(skb)->nr_frags; + frag_index++) { + frag = &skb_shinfo(skb)->frags[frag_index]; + memcpy(tx_buff->vaddr + offset, skb_frag_address(frag), + skb_frag_size(frag)); + offset += skb_frag_size(frag); + } + tx_buff->dma = + dma_map_single(dev, tx_buff->vaddr, tx_buff->len, DMA_TO_DEVICE); +} + +static int skb_to_txbuff(struct ctcmac_private *priv, struct sk_buff *skb) +{ + u64 addr; + int frag_index, rq, to_use, nr_frags; skb_frag_t *frag; struct ctcmac_tx_buff *tx_buff; struct ctcmac_priv_tx_q *tx_queue = NULL; + bool addr_align256, not_span_4K, len_align8 = 1; - nr_frags = skb_shinfo(skb)->nr_frags; rq = skb->queue_mapping; tx_queue = priv->tx_queue[rq]; + to_use = tx_queue->desc_cur; + tx_buff = &tx_queue->tx_buff[to_use]; + nr_frags = skb_shinfo(skb)->nr_frags; - tx_buff = &tx_queue->tx_buff[tx_queue->next_to_alloc]; - addr = (u64)skb->data; - if (!nr_frags && - ((addr & PAGE_MASK) == ((addr + skb_headlen(skb)) & PAGE_MASK))) { - tx_buff->alloc = 0; - tx_buff->vaddr = skb->data; - tx_buff->len = skb_headlen(skb); - tx_buff->dma = - dma_map_single(priv->dev, skb->data, skb_headlen(skb), - DMA_TO_DEVICE); - tx_buff->offset = 0; - - } else { - int alloc_size; - - alloc_size = ALIGN(skb->len, BUF_ALIGNMENT); - tx_buff->alloc = 1; - tx_buff->len = skb->len; - tx_buff->vaddr = kmalloc(alloc_size, GFP_KERNEL); - offset = - (BUF_ALIGNMENT - - (((u64)tx_buff->vaddr) & (BUF_ALIGNMENT - 1))); - if (offset == BUF_ALIGNMENT) - offset = 0; - tx_buff->offset = offset; - memcpy(tx_buff->vaddr + offset, skb->data, skb_headlen(skb)); - offset += skb_headlen(skb); + if (priv->version) { + head_to_txbuff_direct(priv->dev, skb, tx_buff); + to_use = + (to_use >= tx_queue->tx_ring_size - 1) ? 0 : to_use + 1; + //printk(KERN_ERR "skb_to_txbuff0 %llx %d %d\n", (u64)skb->data, skb_headlen(skb), to_use); for (frag_index = 0; frag_index < nr_frags; frag_index++) { + tx_buff = &tx_queue->tx_buff[to_use]; frag = &skb_shinfo(skb)->frags[frag_index]; - memcpy(tx_buff->vaddr + offset, frag, - skb_frag_size(frag)); - offset += skb_frag_size(frag); + frag_to_txbuff_direct(priv->dev, frag, tx_buff); + to_use = + to_use >= + tx_queue->tx_ring_size - 1 ? 0 : to_use + 1; + //printk(KERN_ERR "skb_to_txbuff1 %llx %d %d %d\n", + // (u64)skb_frag_address(frag), skb_frag_size(frag), to_use, frag_index); + } + } else { + if (skb_shinfo(skb)->nr_frags) { + if (skb_headlen(skb) & 0x7) { + len_align8 = 0; + } + for (frag_index = 0; (len_align8 == 1) && + (frag_index < nr_frags - 1); frag_index++) { + frag = &skb_shinfo(skb)->frags[frag_index]; + if (skb_frag_size(frag) & 0x7) + len_align8 = 0; + } } - tx_buff->dma = - dma_map_single(priv->dev, tx_buff->vaddr, tx_buff->len, - DMA_TO_DEVICE); + if (len_align8 == 0) { + //printk(KERN_ERR "skb_to_txbuff2 %llx %d %d\n", (u64)skb->data, skb_headlen(skb), to_use); + for (frag_index = 0; frag_index < nr_frags; + frag_index++) { + frag = &skb_shinfo(skb)->frags[frag_index]; + //printk(KERN_ERR "skb_to_txbuff3 %llx %d %d %d\n", (u64)skb_frag_address(frag), skb_frag_size(frag), to_use, frag_index); + } + skb_to_txbuff_alloc(priv->dev, skb, tx_buff); + to_use = + (to_use >= + tx_queue->tx_ring_size - 1) ? 0 : to_use + 1; + } else { + addr = (u64) skb->data; + addr_align256 = + ((addr & (BUF_ALIGNMENT - 1)) == 0) ? 1 : 0; + not_span_4K = + ((addr & PAGE_MASK) == + ((addr + skb_headlen(skb)) & PAGE_MASK)) ? 1 : 0; + if (addr_align256 || not_span_4K) { + head_to_txbuff_direct(priv->dev, skb, tx_buff); + //printk(KERN_ERR "skb_to_txbuff4 %llx %d %d\n", (u64)skb->data, skb_headlen(skb), to_use); + } else { + head_to_txbuff_alloc(priv->dev, skb, tx_buff); + //printk(KERN_ERR "skb_to_txbuff5 %llx %d %d\n", (u64)skb->data, skb_headlen(skb), to_use); + } + to_use = + (to_use >= + tx_queue->tx_ring_size - 1) ? 0 : to_use + 1; + for (frag_index = 0; frag_index < nr_frags; + frag_index++) { + tx_buff = &tx_queue->tx_buff[to_use]; + frag = &skb_shinfo(skb)->frags[frag_index]; + addr = (u64) skb_frag_address(frag); + + addr_align256 = + ((addr & (BUF_ALIGNMENT - 1)) == 0) ? 1 : 0; + not_span_4K = + ((addr & PAGE_MASK) == + ((addr + + skb_frag_size(frag)) & PAGE_MASK)) ? 1 : + 0; + if (addr_align256 || not_span_4K) { + frag_to_txbuff_direct(priv->dev, frag, + tx_buff); + //printk(KERN_ERR "skb_to_txbuff6 %llx %d %d %d\n", (u64)skb_frag_address(frag), skb_frag_size(frag), to_use, frag_index); + } else { + frag_to_txbuff_alloc(priv->dev, frag, + tx_buff); + //printk(KERN_ERR "skb_to_txbuff7 %llx %d %d %d\n", (u64)skb_frag_address(frag), skb_frag_size(frag), to_use, frag_index); + } + to_use = + to_use >= + tx_queue->tx_ring_size - 1 ? 0 : to_use + 1; + } + } } - return tx_buff; + + return len_align8 ? 0 : 1; } static int ctcmac_start_xmit(struct sk_buff *skb, struct net_device *dev) { int rq = 0; + int to_use = 0, frag_merged; + unsigned int frag_index, nr_txbds; unsigned int bytes_sent; struct netdev_queue *txq; struct ctcmac_desc_cfg tx_desc; @@ -2061,8 +2736,9 @@ static int ctcmac_start_xmit(struct sk_buff *skb, struct net_device *dev) tx_queue = priv->tx_queue[rq]; txq = netdev_get_tx_queue(dev, rq); + nr_txbds = skb_shinfo(skb)->nr_frags + 1; /* check if there is space to queue this packet */ - if (tx_queue->num_txbdfree <= 0) { + if (tx_queue->num_txbdfree < nr_txbds) { if (netif_msg_tx_err(priv)) { netdev_dbg(priv->ndev, "%s: no space left before send pkt!\n", @@ -2079,28 +2755,59 @@ static int ctcmac_start_xmit(struct sk_buff *skb, struct net_device *dev) tx_queue->stats.tx_bytes += bytes_sent; tx_queue->stats.tx_packets++; - tx_buff = skb_to_txbuff(priv, skb); - tx_queue->tx_skbuff[tx_queue->next_to_alloc] = skb; - tx_desc.sop = 1; - tx_desc.eop = 1; - tx_desc.size = tx_buff->len; - tx_desc.addr_low = (tx_buff->dma + tx_buff->offset - CTC_DDR_BASE) - & CPU_MAC_DESC_INTF_W0_DESC_ADDR_31_0_MASK; - tx_desc.addr_high = - ((tx_buff->dma + tx_buff->offset - CTC_DDR_BASE) >> 32) - & CPU_MAC_DESC_INTF_W1_DESC_ADDR_39_32_MASK; - ctcmac_fill_txbd(priv, &tx_desc); + frag_merged = skb_to_txbuff(priv, skb); + tx_queue->tx_skbuff[tx_queue->skb_cur].skb = skb; + tx_queue->tx_skbuff[tx_queue->skb_cur].frag_merge = frag_merged; + tx_queue->skb_cur = + (tx_queue->skb_cur >= + tx_queue->tx_ring_size - 1) ? 0 : tx_queue->skb_cur + 1; + if (frag_merged) { + nr_txbds = 1; + } + to_use = tx_queue->desc_cur; + if (nr_txbds <= 1) { + tx_buff = &tx_queue->tx_buff[to_use]; + tx_desc.sop = 1; + tx_desc.eop = 1; + tx_desc.size = tx_buff->len; + tx_desc.addr_low = + (tx_buff->dma + tx_buff->offset - CTC_DDR_BASE) + & CPU_MAC_DESC_INTF_W0_DESC_ADDR_31_0_MASK; + tx_desc.addr_high = + ((tx_buff->dma + tx_buff->offset - CTC_DDR_BASE) >> 32) + & CPU_MAC_DESC_INTF_W1_DESC_ADDR_39_32_MASK; + ctcmac_fill_txbd(priv, &tx_desc); + to_use = + (to_use >= tx_queue->tx_ring_size - 1) ? 0 : to_use + 1; + } else { + for (frag_index = 0; frag_index < nr_txbds; frag_index++) { + tx_buff = &tx_queue->tx_buff[to_use]; + tx_desc.sop = (frag_index == 0) ? 1 : 0; + tx_desc.eop = (frag_index == nr_txbds - 1) ? 1 : 0; + tx_desc.size = tx_buff->len; + tx_desc.addr_low = + (tx_buff->dma + tx_buff->offset - CTC_DDR_BASE) + & CPU_MAC_DESC_INTF_W0_DESC_ADDR_31_0_MASK; + tx_desc.addr_high = + ((tx_buff->dma + tx_buff->offset - + CTC_DDR_BASE) >> 32) + & CPU_MAC_DESC_INTF_W1_DESC_ADDR_39_32_MASK; + ctcmac_fill_txbd(priv, &tx_desc); + to_use = + (to_use >= + tx_queue->tx_ring_size - 1) ? 0 : to_use + 1; + } + } + tx_queue->desc_cur = to_use; if (netif_msg_tx_queued(priv)) { - netdev_dbg(priv->ndev, "%s: alloc skbuff id %d\n", - priv->ndev->name, tx_queue->next_to_alloc); + netdev_dbg(priv->ndev, + "%s: skb_cur %d skb_dirty %d desc_cur %d desc_dirty %d\n", + priv->ndev->name, tx_queue->skb_cur, + tx_queue->skb_dirty, tx_queue->desc_cur, + tx_queue->desc_dirty); } - if (tx_queue->next_to_alloc >= tx_queue->tx_ring_size - 1) - tx_queue->next_to_alloc = 0; - else - tx_queue->next_to_alloc++; - /* We can work in parallel with 872(), except * when modifying num_txbdfree. Note that we didn't grab the lock * when we were reading the num_txbdfree and checking for available @@ -2108,7 +2815,7 @@ static int ctcmac_start_xmit(struct sk_buff *skb, struct net_device *dev) */ spin_lock_bh(&tx_queue->txlock); /* reduce TxBD free count */ - tx_queue->num_txbdfree--; + tx_queue->num_txbdfree -= nr_txbds; spin_unlock_bh(&tx_queue->txlock); /* If the next BD still needs to be cleaned up, then the bds @@ -2117,8 +2824,9 @@ static int ctcmac_start_xmit(struct sk_buff *skb, struct net_device *dev) if (!tx_queue->num_txbdfree) { netif_tx_stop_queue(txq); if (netif_msg_tx_err(priv)) { - netdev_dbg(dev, "%s: no space left before send pkt!\n", - priv->ndev->name); + printk(KERN_ERR + "%s: no space left before send pkt22!\n", + priv->ndev->name); } dev->stats.tx_fifo_errors++; } @@ -2131,8 +2839,9 @@ static int ctcmac_change_mtu(struct net_device *dev, int new_mtu) struct ctcmac_private *priv = netdev_priv(dev); int frame_size = new_mtu + ETH_HLEN; - if (frame_size < 64 || frame_size > CTCMAC_JUMBO_FRAME_SIZE) + if ((frame_size < 64) || (frame_size > CTCMAC_JUMBO_FRAME_SIZE)) { return -EINVAL; + } while (test_and_set_bit_lock(CTCMAC_RESETTING, &priv->state)) cpu_relax(); @@ -2175,9 +2884,136 @@ static int ctcmac_close(struct net_device *dev) static void ctcmac_set_multi(struct net_device *dev) { + int idx = 0; + u32 val, addr_h = 0, addr_l = 0; + struct netdev_hw_addr *ha; + struct ctcmac_private *priv = netdev_priv(dev); + + if (priv->version == 0) + return; + + /* receive all packets */ + if (dev->flags & IFF_PROMISC) { + /* not check normal packet */ + if (priv->index == 0) { + val = + readl(&priv->cpumacu_reg->CpuMacUnitFilterCfg1[1]); + val &= + ~BIT + (CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_CHECK_NORMAL_PKT_ENABLE0_BIT); + writel(val, + &priv->cpumacu_reg->CpuMacUnitFilterCfg1[1]); + } else { + val = + readl(&priv->cpumacu_reg->CpuMacUnitFilterCfg1[1]); + val &= + ~BIT + (CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_CHECK_NORMAL_PKT_ENABLE1_BIT); + writel(val, + &priv->cpumacu_reg->CpuMacUnitFilterCfg1[1]); + } + return; + } + + if (priv->index == 0) { + val = readl(&priv->cpumacu_reg->CpuMacUnitFilterCfg1[1]); + val |= + BIT + (CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_CHECK_NORMAL_PKT_ENABLE0_BIT); + val |= + BIT(CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_DROP_NORMAL_PKT0_BIT); + writel(val, &priv->cpumacu_reg->CpuMacUnitFilterCfg1[1]); + } else { + val = readl(&priv->cpumacu_reg->CpuMacUnitFilterCfg1[1]); + val |= + BIT + (CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_CHECK_NORMAL_PKT_ENABLE1_BIT); + val |= + BIT(CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_DROP_NORMAL_PKT1_BIT); + writel(val, &priv->cpumacu_reg->CpuMacUnitFilterCfg1[1]); + } + + /* receive packets with local mac address + receive packets with broadcast mac address + receive packets with multicast mac address + */ + if ((dev->flags & IFF_ALLMULTI) || (netdev_mc_count(dev) > 2)) { + /* mac filter table 2/6:white list to receive all pacekt with multicast mac address */ + if (priv->index == 0) { + writel(0x00000000, + &priv->cpumacu_reg->CpuMacUnitMacCamCfg[4]); + writel(0x00000100, + &priv->cpumacu_reg->CpuMacUnitMacCamCfg[5]); + writel(0x00000000, + &priv->cpumacu_reg->CpuMacUnitMacCamCfg[20]); + writel(0x00000100, + &priv->cpumacu_reg->CpuMacUnitMacCamCfg[21]); + } else { + writel(0x00000000, + &priv->cpumacu_reg->CpuMacUnitMacCamCfg[12]); + writel(0x00000100, + &priv->cpumacu_reg->CpuMacUnitMacCamCfg[13]); + writel(0x00000000, + &priv->cpumacu_reg->CpuMacUnitMacCamCfg[28]); + writel(0x00000100, + &priv->cpumacu_reg->CpuMacUnitMacCamCfg[29]); + } + return; + } + + if (netdev_mc_empty(dev)) { + return; + } + /* receive packet with local mac address */ + /* receive packet with broadcast mac address */ + /* receive packet with multicast mac address in mc list */ + netdev_for_each_mc_addr(ha, dev) { + addr_h = ha->addr[0] << 8 | ha->addr[1]; + addr_l = + ha->addr[2] << 24 | ha->addr[3] << 16 | ha-> + addr[4] << 8 | ha->addr[5]; + if (priv->index == 0) { + writel(addr_l, + &priv->cpumacu_reg->CpuMacUnitMacCamCfg[4 + + idx * + 2]); + writel(addr_h, + &priv->cpumacu_reg->CpuMacUnitMacCamCfg[5 + + idx * + 2]); + writel(0xffffffff, + &priv->cpumacu_reg->CpuMacUnitMacCamCfg[20 + + idx * + 2]); + writel(0x0000ffff, + &priv->cpumacu_reg->CpuMacUnitMacCamCfg[21 + + idx * + 2]); + } else { + writel(addr_l, + &priv->cpumacu_reg->CpuMacUnitMacCamCfg[12 + + idx * + 2]); + writel(addr_h, + &priv->cpumacu_reg->CpuMacUnitMacCamCfg[13 + + idx * + 2]); + writel(0xffffffff, + &priv->cpumacu_reg->CpuMacUnitMacCamCfg[28 + + idx * + 2]); + writel(0x0000ffff, + &priv->cpumacu_reg->CpuMacUnitMacCamCfg[29 + + idx * + 2]); + } + idx++; + if (idx >= 2) + return; + } } -static void ctcmac_timeout(struct net_device *dev) +static void ctcmac_timeout(struct net_device *dev, unsigned int txqueue) { struct ctcmac_private *priv = netdev_priv(dev); @@ -2206,15 +3042,17 @@ static struct net_device_stats *ctcmac_get_stats(struct net_device *dev) struct ctcmac_private *priv = netdev_priv(dev); for (qidx = 0; qidx < priv->num_rx_queues; qidx++) { - if (!priv->rx_queue[qidx]) + if (!priv->rx_queue[qidx]) { return &dev->stats; + } rx_packets += priv->rx_queue[qidx]->stats.rx_packets; rx_bytes += priv->rx_queue[qidx]->stats.rx_bytes; rx_dropped += priv->rx_queue[qidx]->stats.rx_dropped; } - if (!priv->tx_queue[0]) + if (!priv->tx_queue[0]) { return &dev->stats; + } tx_packets = priv->tx_queue[0]->stats.tx_packets; tx_bytes = priv->tx_queue[0]->stats.tx_bytes; @@ -2228,9 +3066,52 @@ static struct net_device_stats *ctcmac_get_stats(struct net_device *dev) return &dev->stats; } +static void ctcmac_set_mac_for_addr(struct ctcmac_private *priv, + const u8 * addr) +{ + u32 addr_h = 0, addr_l = 0; + + addr_h = addr[0] << 8 | addr[1]; + addr_l = addr[2] << 24 | addr[3] << 16 | addr[4] << 8 | addr[5]; + if (priv->index == 0) { + writel(addr_l, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[0]); + writel(addr_h, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[1]); + writel(0xffffffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[16]); + writel(0x0000ffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[17]); + } else { + writel(addr_l, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[8]); + writel(addr_h, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[9]); + writel(0xffffffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[24]); + writel(0x0000ffff, &priv->cpumacu_reg->CpuMacUnitMacCamCfg[25]); + } +} + +static void ctcmac_set_src_mac_for_flow_ctrl(struct ctcmac_private *priv, + const u8 * addr) +{ + u32 val; + u32 addr_h = 0, addr_l = 0; + + addr_h = addr[0] << 8 | addr[1]; + addr_l = addr[2] << 24 | addr[3] << 16 | addr[4] << 8 | addr[5]; + + writel(addr_l, &priv->cpumac_reg->CpuMacPauseCfg[2]); + val = readl(&priv->cpumac_reg->CpuMacPauseCfg[3]); + val &= 0xffff0000; + addr_h &= 0xffff; + val |= addr_h; + writel(val, &priv->cpumac_reg->CpuMacPauseCfg[3]); +} + static int ctcmac_set_mac_addr(struct net_device *dev, void *p) { + struct ctcmac_private *priv = netdev_priv(dev); + eth_mac_addr(dev, p); + ctcmac_set_src_mac_for_flow_ctrl(priv, dev->dev_addr); + if (priv->version > 0) + ctcmac_set_mac_for_addr(priv, dev->dev_addr); + return 0; } @@ -2246,7 +3127,7 @@ static void ctcmac_gdrvinfo(struct net_device *dev, /* Return the length of the register structure */ static int ctcmac_reglen(struct net_device *dev) { - return sizeof(struct cpu_mac_regs); + return sizeof(struct CpuMac_regs); } /* Return a dump of the GFAR register space */ @@ -2255,17 +3136,16 @@ static void ctcmac_get_regs(struct net_device *dev, struct ethtool_regs *regs, { int i; struct ctcmac_private *priv = netdev_priv(dev); - u32 __iomem *theregs = (u32 __iomem *)priv->cpumac_reg; - u32 *buf = (u32 *)regbuf; + u32 __iomem *theregs = (u32 __iomem *) priv->cpumac_reg; + u32 *buf = (u32 *) regbuf; - for (i = 0; i < sizeof(struct cpu_mac_regs) / sizeof(u32); i++) + for (i = 0; i < sizeof(struct CpuMac_regs) / sizeof(u32); i++) buf[i] = ctcmac_regr(&theregs[i]); } /* Fills in rvals with the current ring parameters. Currently, * rx, rx_mini, and rx_jumbo rings are the same size, as mini and - * jumbo are ignored by the driver - */ + * jumbo are ignored by the driver */ static void ctcmac_gringparam(struct net_device *dev, struct ethtool_ringparam *rvals) { @@ -2330,15 +3210,64 @@ static int ctcmac_sringparam(struct net_device *dev, static void ctcmac_gpauseparam(struct net_device *dev, struct ethtool_pauseparam *epause) { -} + struct ctcmac_private *priv = netdev_priv(dev); + epause->autoneg = ! !priv->pause_aneg_en; + epause->rx_pause = ! !priv->rx_pause_en; + epause->tx_pause = ! !priv->tx_pause_en; +} + +/* +* IEEE 802.3-2000 +* Table 28B-2 +* Pause Encoding +* +* PAUSE ASM_DIR TX RX +* ----- ----- -- -- +* 0 0 0 0 +* 0 1 1 0 +* 1 0 1 1 +* 1 1 0 1 +* +*/ static int ctcmac_spauseparam(struct net_device *dev, struct ethtool_pauseparam *epause) { + struct ctcmac_private *priv = netdev_priv(dev); + struct phy_device *phydev = dev->phydev; + + if (!phydev) + return -ENODEV; + + if (!phy_validate_pause(phydev, epause)) + return -EINVAL; + + priv->rx_pause_en = priv->tx_pause_en = 0; + if (epause->rx_pause) { + priv->rx_pause_en = 1; + + if (epause->tx_pause) { + priv->tx_pause_en = 1; + } + } else if (epause->tx_pause) { + priv->tx_pause_en = 1; + + } + + if (epause->autoneg) + priv->pause_aneg_en = 1; + else + priv->pause_aneg_en = 0; + + if (!epause->autoneg) { + ctcmac_cfg_flow_ctrl(priv, priv->tx_pause_en, + priv->rx_pause_en); + } + return 0; } -static void ctcmac_gstrings(struct net_device *dev, u32 stringset, u8 *buf) +static void ctcmac_gstrings(struct net_device *dev, u32 stringset, u8 * buf) { memcpy(buf, ctc_stat_gstrings, CTCMAC_STATS_LEN * ETH_GSTRING_LEN); } @@ -2349,7 +3278,7 @@ static int ctcmac_sset_count(struct net_device *dev, int sset) } static void ctcmac_fill_stats(struct net_device *netdev, - struct ethtool_stats *dummy, u64 *buf) + struct ethtool_stats *dummy, u64 * buf) { u32 mtu; unsigned long flags; @@ -2359,150 +3288,105 @@ static void ctcmac_fill_stats(struct net_device *netdev, spin_lock_irqsave(&priv->reglock, flags); stats = &g_pkt_stats[priv->index]; stats->rx_good_ucast_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_0[0]); + readq(&priv->cpumac_mem->CpuMacStatsRam0[0]); stats->rx_good_ucast_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_0[2]); + readq(&priv->cpumac_mem->CpuMacStatsRam0[2]); stats->rx_good_mcast_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_1[0]); + readq(&priv->cpumac_mem->CpuMacStatsRam1[0]); stats->rx_good_mcast_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_1[2]); + readq(&priv->cpumac_mem->CpuMacStatsRam1[2]); stats->rx_good_bcast_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_2[0]); + readq(&priv->cpumac_mem->CpuMacStatsRam2[0]); stats->rx_good_bcast_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_2[2]); + readq(&priv->cpumac_mem->CpuMacStatsRam2[2]); stats->rx_good_pause_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_3[0]); + readq(&priv->cpumac_mem->CpuMacStatsRam3[0]); stats->rx_good_pause_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_3[2]); + readq(&priv->cpumac_mem->CpuMacStatsRam3[2]); stats->rx_good_pfc_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_4[0]); - stats->rx_good_pfc_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_4[2]); + readq(&priv->cpumac_mem->CpuMacStatsRam4[0]); + stats->rx_good_pfc_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam4[2]); stats->rx_good_control_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_5[0]); + readq(&priv->cpumac_mem->CpuMacStatsRam5[0]); stats->rx_good_control_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_5[2]); + readq(&priv->cpumac_mem->CpuMacStatsRam5[2]); stats->rx_fcs_error_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_6[0]); - stats->rx_fcs_error_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_6[2]); + readq(&priv->cpumac_mem->CpuMacStatsRam6[0]); + stats->rx_fcs_error_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam6[2]); stats->rx_mac_overrun_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_7[0]); + readq(&priv->cpumac_mem->CpuMacStatsRam7[0]); stats->rx_mac_overrun_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_7[2]); + readq(&priv->cpumac_mem->CpuMacStatsRam7[2]); stats->rx_good_63B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_8[0]); - stats->rx_good_63B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_8[2]); - stats->rx_bad_63B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_9[0]); - stats->rx_bad_63B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_9[2]); + readq(&priv->cpumac_mem->CpuMacStatsRam8[0]); + stats->rx_good_63B_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam8[2]); + stats->rx_bad_63B_bytes += readq(&priv->cpumac_mem->CpuMacStatsRam9[0]); + stats->rx_bad_63B_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam9[2]); stats->rx_good_mtu2B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_10[0]); + readq(&priv->cpumac_mem->CpuMacStatsRam10[0]); stats->rx_good_mtu2B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_10[2]); + readq(&priv->cpumac_mem->CpuMacStatsRam10[2]); stats->rx_bad_mtu2B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_11[0]); + readq(&priv->cpumac_mem->CpuMacStatsRam11[0]); stats->rx_bad_mtu2B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_11[2]); + readq(&priv->cpumac_mem->CpuMacStatsRam11[2]); stats->rx_good_jumbo_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_12[0]); + readq(&priv->cpumac_mem->CpuMacStatsRam12[0]); stats->rx_good_jumbo_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_12[2]); + readq(&priv->cpumac_mem->CpuMacStatsRam12[2]); stats->rx_bad_jumbo_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_13[0]); + readq(&priv->cpumac_mem->CpuMacStatsRam13[0]); stats->rx_bad_jumbo_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_13[2]); - stats->rx_64B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_14[0]); - stats->rx_64B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_14[2]); - stats->rx_127B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_15[0]); - stats->rx_127B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_15[2]); - stats->rx_255B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_16[0]); - stats->rx_255B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_16[2]); - stats->rx_511B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_17[0]); - stats->rx_511B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_17[2]); - stats->rx_1023B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_18[0]); - stats->rx_1023B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_18[2]); - stats->rx_mtu1B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_19[0]); - stats->rx_mtu1B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_19[2]); - stats->tx_ucast_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_20[0]); - stats->tx_ucast_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_20[2]); - stats->tx_mcast_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_21[0]); - stats->tx_mcast_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_21[2]); - stats->tx_bcast_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_22[0]); - stats->tx_bcast_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_22[2]); - stats->tx_pause_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_23[0]); - stats->tx_pause_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_23[2]); + readq(&priv->cpumac_mem->CpuMacStatsRam13[2]); + stats->rx_64B_bytes += readq(&priv->cpumac_mem->CpuMacStatsRam14[0]); + stats->rx_64B_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam14[2]); + stats->rx_127B_bytes += readq(&priv->cpumac_mem->CpuMacStatsRam15[0]); + stats->rx_127B_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam15[2]); + stats->rx_255B_bytes += readq(&priv->cpumac_mem->CpuMacStatsRam16[0]); + stats->rx_255B_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam16[2]); + stats->rx_511B_bytes += readq(&priv->cpumac_mem->CpuMacStatsRam17[0]); + stats->rx_511B_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam17[2]); + stats->rx_1023B_bytes += readq(&priv->cpumac_mem->CpuMacStatsRam18[0]); + stats->rx_1023B_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam18[2]); + stats->rx_mtu1B_bytes += readq(&priv->cpumac_mem->CpuMacStatsRam19[0]); + stats->rx_mtu1B_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam19[2]); + stats->tx_ucast_bytes += readq(&priv->cpumac_mem->CpuMacStatsRam20[0]); + stats->tx_ucast_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam20[2]); + stats->tx_mcast_bytes += readq(&priv->cpumac_mem->CpuMacStatsRam21[0]); + stats->tx_mcast_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam21[2]); + stats->tx_bcast_bytes += readq(&priv->cpumac_mem->CpuMacStatsRam22[0]); + stats->tx_bcast_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam22[2]); + stats->tx_pause_bytes += readq(&priv->cpumac_mem->CpuMacStatsRam23[0]); + stats->tx_pause_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam23[2]); stats->tx_control_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_24[0]); - stats->tx_control_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_24[2]); + readq(&priv->cpumac_mem->CpuMacStatsRam24[0]); + stats->tx_control_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam24[2]); stats->tx_fcs_error_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_25[0]); + readq(&priv->cpumac_mem->CpuMacStatsRam25[0]); stats->tx_fcs_error_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_25[2]); + readq(&priv->cpumac_mem->CpuMacStatsRam25[2]); stats->tx_underrun_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_26[0]); - stats->tx_underrun_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_26[2]); - stats->tx_63B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_27[0]); - stats->tx_63B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_27[2]); - stats->tx_64B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_28[0]); - stats->tx_64B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_28[2]); - stats->tx_127B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_29[0]); - stats->tx_127B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_29[2]); - stats->tx_255B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_30[0]); - stats->tx_255B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_30[2]); - stats->tx_511B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_31[0]); - stats->tx_511B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_31[2]); - stats->tx_1023B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_32[0]); - stats->tx_1023B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_32[2]); - stats->tx_mtu1_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_33[0]); - stats->tx_mtu1_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_33[2]); - stats->tx_mtu2_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_34[0]); - stats->tx_mtu2_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_34[2]); - stats->tx_jumbo_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_35[0]); - stats->tx_jumbo_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_35[2]); - mtu = readl(&priv->cpumac_reg->cpu_mac_stats_cfg[1]); + readq(&priv->cpumac_mem->CpuMacStatsRam26[0]); + stats->tx_underrun_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam26[2]); + stats->tx_63B_bytes += readq(&priv->cpumac_mem->CpuMacStatsRam27[0]); + stats->tx_63B_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam27[2]); + stats->tx_64B_bytes += readq(&priv->cpumac_mem->CpuMacStatsRam28[0]); + stats->tx_64B_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam28[2]); + stats->tx_127B_bytes += readq(&priv->cpumac_mem->CpuMacStatsRam29[0]); + stats->tx_127B_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam29[2]); + stats->tx_255B_bytes += readq(&priv->cpumac_mem->CpuMacStatsRam30[0]); + stats->tx_255B_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam30[2]); + stats->tx_511B_bytes += readq(&priv->cpumac_mem->CpuMacStatsRam31[0]); + stats->tx_511B_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam31[2]); + stats->tx_1023B_bytes += readq(&priv->cpumac_mem->CpuMacStatsRam32[0]); + stats->tx_1023B_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam32[2]); + stats->tx_mtu1_bytes += readq(&priv->cpumac_mem->CpuMacStatsRam33[0]); + stats->tx_mtu1_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam33[2]); + stats->tx_mtu2_bytes += readq(&priv->cpumac_mem->CpuMacStatsRam34[0]); + stats->tx_mtu2_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam34[2]); + stats->tx_jumbo_bytes += readq(&priv->cpumac_mem->CpuMacStatsRam35[0]); + stats->tx_jumbo_pkt += readq(&priv->cpumac_mem->CpuMacStatsRam35[2]); + mtu = readl(&priv->cpumac_reg->CpuMacStatsCfg[1]); stats->mtu1 = mtu & 0x3fff; stats->mtu2 = (mtu >> 16) & 0x3fff; spin_unlock_irqrestore(&priv->reglock, flags); @@ -2527,6 +3411,22 @@ static void ctcmac_set_msglevel(struct net_device *dev, uint32_t data) static int ctcmac_get_ts_info(struct net_device *dev, struct ethtool_ts_info *info) { +#if 0 + struct gfar_private *priv = netdev_priv(dev); + + if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)) { + info->so_timestamping = SOF_TIMESTAMPING_RX_SOFTWARE | + SOF_TIMESTAMPING_SOFTWARE; + info->phc_index = -1; + return 0; + } + info->so_timestamping = SOF_TIMESTAMPING_TX_HARDWARE | + SOF_TIMESTAMPING_RX_HARDWARE | SOF_TIMESTAMPING_RAW_HARDWARE; + info->phc_index = gfar_phc_index; + info->tx_types = (1 << HWTSTAMP_TX_OFF) | (1 << HWTSTAMP_TX_ON); + info->rx_filters = (1 << HWTSTAMP_FILTER_NONE) | + (1 << HWTSTAMP_FILTER_ALL); +#endif return 0; } @@ -2575,8 +3475,9 @@ static int ctcmac_probe(struct platform_device *ofdev) return PTR_ERR(regmap_base); err = ctcmac_of_init(ofdev, &dev); - if (err) + if (err) { return err; + } priv = netdev_priv(dev); SET_NETDEV_DEV(dev, &ofdev->dev); @@ -2590,10 +3491,19 @@ static int ctcmac_probe(struct platform_device *ofdev) dev->netdev_ops = &ctcmac_netdev_ops; dev->ethtool_ops = &ctcmac_ethtool_ops; - netif_napi_add(dev, &priv->napi_rx, ctcmac_poll_rx_sq, - CTCMAC_NAIP_RX_WEIGHT); - netif_napi_add(dev, &priv->napi_tx, ctcmac_poll_tx_sq, - CTCMAC_NAIP_TX_WEIGHT); + if (priv->version == 0) { + netif_napi_add(dev, &priv->napi_rx, ctcmac_poll_rx_sq, + CTCMAC_NAIP_RX_WEIGHT); + netif_napi_add(dev, &priv->napi_tx, ctcmac_poll_tx_sq, + CTCMAC_NAIP_TX_WEIGHT); + } else { + netif_napi_add(dev, &priv->napi_rx, ctcmac_poll_rx0_sq, + CTCMAC_NAIP_RX_WEIGHT); + netif_napi_add(dev, &priv->napi_rx1, ctcmac_poll_rx1_sq, + CTCMAC_NAIP_RX_WEIGHT); + netif_napi_add(dev, &priv->napi_tx, ctcmac_poll_tx_sq, + CTCMAC_NAIP_TX_WEIGHT); + } /* Initializing some of the rx/tx queue level parameters */ for (i = 0; i < priv->num_tx_queues; i++) { @@ -2601,8 +3511,9 @@ static int ctcmac_probe(struct platform_device *ofdev) priv->tx_queue[i]->num_txbdfree = CTCMAC_TX_RING_SIZE; } - for (i = 0; i < priv->num_rx_queues; i++) + for (i = 0; i < priv->num_rx_queues; i++) { priv->rx_queue[i]->rx_ring_size = CTCMAC_RX_RING_SIZE; + } set_bit(CTCMAC_DOWN, &priv->state); @@ -2615,20 +3526,25 @@ static int ctcmac_probe(struct platform_device *ofdev) /* Carrier starts down, phylib will bring it up */ netif_carrier_off(dev); err = register_netdev(dev); - if (err) + if (err) { goto register_fail; + } if (!g_mac_unit_init_done) { - writel(0x07, &priv->cpumacu_reg->cpu_mac_unit_reset_ctl); - writel(0x00, &priv->cpumacu_reg->cpu_mac_unit_reset_ctl); + writel(0x07, &priv->cpumacu_reg->CpuMacUnitResetCtl); + writel(0x00, &priv->cpumacu_reg->CpuMacUnitResetCtl); - clrsetbits(&priv->cpumacu_reg->cpu_mac_unit_ts_cfg, - 0, CPU_MAC_UNIT_TS_CFG_W0_CFG_FORCE_S_AND_NS_EN); + clrsetbits(&priv->cpumacu_reg->CpuMacUnitTsCfg, + 0, + BIT + (CPU_MAC_UNIT_TS_CFG_W0_CFG_FORCE_S_AND_NS_EN_BIT)); if (priv->interface == PHY_INTERFACE_MODE_SGMII) { - clrsetbits(&priv->cpumacu_reg->cpu_mac_unit_ref_pulse_cfg[1], - CPU_MAC_UNIT_REF_PULSE_CFG_W1_REF_LINK_PULSE_RST, + clrsetbits(&priv->cpumacu_reg->CpuMacUnitRefPulseCfg[1], + BIT + (CPU_MAC_UNIT_REF_PULSE_CFG_W1_REF_LINK_PULSE_RST_BIT), 0); - + writel(0x1f3f, + &priv->cpumacu_reg->CpuMacUnitRefPulseCfg[1]); ctc_mac_serdes_init(priv); } g_mac_unit_init_done = 1; @@ -2641,7 +3557,12 @@ static int ctcmac_probe(struct platform_device *ofdev) sprintf(priv->irqinfo[CTCMAC_NORMAL].name, "%s%s", dev->name, "_normal"); sprintf(priv->irqinfo[CTCMAC_FUNC].name, "%s%s", dev->name, "_func"); - + if (priv->version > 0) { + sprintf(priv->irqinfo[CTCMAC_FUNC_RX0].name, "%s%s", + dev->name, "_func_rx0"); + sprintf(priv->irqinfo[CTCMAC_FUNC_RX1].name, "%s%s", + dev->name, "_func_rx1"); + } return 0; register_fail: @@ -2695,3 +3616,90 @@ static struct platform_driver ctcmac_driver = { module_platform_driver(ctcmac_driver); MODULE_LICENSE("GPL"); + +static int ctcmac_set_ffe(struct ctcmac_private *priv, u16 coefficient[]) +{ + u32 val; + + if (priv->index == 0) { + val = readl(&priv->cpumacu_reg->CpuMacUnitHssCfg[3]); + val |= BIT(CPU_MAC_UNIT_HSS_CFG_W3_CFG_HSS_L0_PCS_EN_ADV_BIT) + | BIT(CPU_MAC_UNIT_HSS_CFG_W3_CFG_HSS_L0_PCS_EN_DLY_BIT); + val &= ~CPU_MAC_UNIT_HSS_CFG_W3_CFG_HSS_L0_PCS_TAP_ADV_MASK; + val |= + (coefficient[0] << + CPU_MAC_UNIT_HSS_CFG_W3_CFG_HSS_L0_PCS_TAP_ADV_BIT); + val &= ~CPU_MAC_UNIT_HSS_CFG_W3_CFG_HSS_L0_PCS_TAP_DLY_MASK; + val |= + (coefficient[2] << + CPU_MAC_UNIT_HSS_CFG_W3_CFG_HSS_L0_PCS_TAP_DLY_BIT); + writel(val, &priv->cpumacu_reg->CpuMacUnitHssCfg[3]); + val = readl(&priv->cpumacu_reg->CpuMacUnitHssCfg[6]); + val &= + ~CPU_MAC_UNIT_HSS_CFG_W6_CFG_HSS_L0_PCS2_PMA_TX_MARGIN_MASK; + val |= + (coefficient[1] << + CPU_MAC_UNIT_HSS_CFG_W6_CFG_HSS_L0_PCS2_PMA_TX_MARGIN_BIT); + writel(val, &priv->cpumacu_reg->CpuMacUnitHssCfg[6]); + } else { + val = readl(&priv->cpumacu_reg->CpuMacUnitHssCfg[9]); + val |= BIT(CPU_MAC_UNIT_HSS_CFG_W9_CFG_HSS_L1_PCS_EN_ADV_BIT) + | BIT(CPU_MAC_UNIT_HSS_CFG_W9_CFG_HSS_L1_PCS_EN_DLY_BIT); + val &= ~CPU_MAC_UNIT_HSS_CFG_W9_CFG_HSS_L1_PCS_TAP_ADV_MASK; + val |= + (coefficient[0] << + CPU_MAC_UNIT_HSS_CFG_W9_CFG_HSS_L1_PCS_TAP_ADV_BIT); + val &= ~CPU_MAC_UNIT_HSS_CFG_W9_CFG_HSS_L1_PCS_TAP_DLY_MASK; + val |= + (coefficient[2] << + CPU_MAC_UNIT_HSS_CFG_W9_CFG_HSS_L1_PCS_TAP_DLY_BIT); + writel(val, &priv->cpumacu_reg->CpuMacUnitHssCfg[9]); + val = readl(&priv->cpumacu_reg->CpuMacUnitHssCfg[12]); + val &= + ~CPU_MAC_UNIT_HSS_CFG_W12_CFG_HSS_L1_PCS2_PMA_TX_MARGIN_MASK; + val |= + (coefficient[1] << + CPU_MAC_UNIT_HSS_CFG_W12_CFG_HSS_L1_PCS2_PMA_TX_MARGIN_BIT); + writel(val, &priv->cpumacu_reg->CpuMacUnitHssCfg[12]); + } + + return 0; +} + +static int ctcmac_get_ffe(struct ctcmac_private *priv, u16 coefficient[]) +{ + u32 val; + + if (priv->index == 0) { + val = readl(&priv->cpumacu_reg->CpuMacUnitHssCfg[3]); + coefficient[0] = + (val & CPU_MAC_UNIT_HSS_CFG_W3_CFG_HSS_L0_PCS_TAP_ADV_MASK) + >> CPU_MAC_UNIT_HSS_CFG_W3_CFG_HSS_L0_PCS_TAP_ADV_BIT; + coefficient[2] = + (val & CPU_MAC_UNIT_HSS_CFG_W3_CFG_HSS_L0_PCS_TAP_DLY_MASK) + >> CPU_MAC_UNIT_HSS_CFG_W3_CFG_HSS_L0_PCS_TAP_DLY_BIT; + val = readl(&priv->cpumacu_reg->CpuMacUnitHssCfg[6]); + coefficient[1] = + (val & + CPU_MAC_UNIT_HSS_CFG_W6_CFG_HSS_L0_PCS2_PMA_TX_MARGIN_MASK) + >> + CPU_MAC_UNIT_HSS_CFG_W6_CFG_HSS_L0_PCS2_PMA_TX_MARGIN_BIT; + + } else { + val = readl(&priv->cpumacu_reg->CpuMacUnitHssCfg[9]); + coefficient[0] = + (val & CPU_MAC_UNIT_HSS_CFG_W9_CFG_HSS_L1_PCS_TAP_ADV_MASK) + >> CPU_MAC_UNIT_HSS_CFG_W9_CFG_HSS_L1_PCS_TAP_ADV_BIT; + coefficient[2] = + (val & CPU_MAC_UNIT_HSS_CFG_W9_CFG_HSS_L1_PCS_TAP_DLY_MASK) + >> CPU_MAC_UNIT_HSS_CFG_W9_CFG_HSS_L1_PCS_TAP_DLY_BIT; + val = readl(&priv->cpumacu_reg->CpuMacUnitHssCfg[12]); + coefficient[1] = + (val & + CPU_MAC_UNIT_HSS_CFG_W12_CFG_HSS_L1_PCS2_PMA_TX_MARGIN_MASK) + >> + CPU_MAC_UNIT_HSS_CFG_W12_CFG_HSS_L1_PCS2_PMA_TX_MARGIN_BIT; + } + + return 0; +} diff --git a/platform/centec-arm64/tsingma-bsp/src/ctcmac/ctcmac.h b/platform/centec-arm64/tsingma-bsp/src/ctcmac/ctcmac.h index 4378c2c802e9..2987a49941fd 100644 --- a/platform/centec-arm64/tsingma-bsp/src/ctcmac/ctcmac.h +++ b/platform/centec-arm64/tsingma-bsp/src/ctcmac/ctcmac.h @@ -1,5 +1,5 @@ /* - * Centec cpu_mac Ethernet Driver -- cpu_mac controller implementation + * Centec CpuMac Ethernet Driver -- CpuMac controller implementation * Provides Bus interface for MIIM regs * * Author: liuht @@ -17,7 +17,7 @@ #ifndef __CTCMAC_H #define __CTCMAC_H -#define TX_TIMEOUT (5 * HZ) +#define TX_TIMEOUT (5*HZ) #define CTCMAC_DEFAULT_MTU 1500 #define CTCMAC_MIN_PKT_LEN 64 @@ -47,14 +47,18 @@ #define CTCMAC_TOKEN_PER_PKT 10 #define CTCMAC_TIMER_COMPENSATE 1 -#define CTCMAC_NOR_RX1_R BIT(7) -#define CTCMAC_NOR_RX0_R BIT(6) -#define CTCMAC_NOR_RX1_D BIT(5) -#define CTCMAC_NOR_RX0_D BIT(4) -#define CTCMAC_NOR_TX_D BIT(3) -#define CTCMAC_NOR_AN_D BIT(2) -#define CTCMAC_NOR_LINK_DOWN BIT(1) -#define CTCMAC_NOR_LINK_UP BIT(0) +#define CTCMAC_NOR_RX1_R (1<<7) +#define CTCMAC_NOR_RX0_R (1<<6) +#define CTCMAC_NOR_RX1_D (1<<5) +#define CTCMAC_NOR_RX0_D (1<<4) +#define CTCMAC_NOR_TX_D (1<<3) +#define CTCMAC_NOR_AN_D (1<<2) +#define CTCMAC_NOR_LINK_DOWN (1<<1) +#define CTCMAC_NOR_LINK_UP (1<<0) +#define CTCMAC_FUNC0_RX_D (1<<0) +#define CTCMAC_FUNC0_RX_R (1<<1) +#define CTCMAC_FUNC1_RX_D (1<<0) +#define CTCMAC_FUNC1_RX_R (1<<1) #define CTC_DDR_BASE 0x80000000 @@ -72,25 +76,33 @@ #define CSC_100M 0x02400000 #define CSC_10M 0x18c00000 -#define CTCMAC_DESC_INT_NUM 1 +#define DESC_INT_COALESCE_CNT_MIN 1 +#define DESC_TX_INT_COALESCE_CNT_DEFAULT 16 +#define DESC_RX_INT_COALESCE_CNT_DEFAULT 16 + +/* emu 100us */ +//#define CTCMAC_TIMER_THRD 0x4B0 +/* board 100us */ +#define CTCMAC_TIMER_THRD 0xc350 #define CTCMAC_SUPPORTED (SUPPORTED_10baseT_Full \ | SUPPORTED_100baseT_Full \ | SUPPORTED_1000baseT_Full \ | SUPPORTED_Autoneg) -#define CTCMAC_STATS_LEN (sizeof(struct ctcmac_pkt_stats) / sizeof(u64)) +#define CTCMAC_STATS_LEN (sizeof(struct ctcmac_pkt_stats)/sizeof(u64)) struct ctcmac_skb_cb { unsigned int bytes_sent; /* bytes-on-wire (i.e. no FCB) */ }; - #define CTCMAC_CB(skb) ((struct ctcmac_skb_cb *)((skb)->cb)) enum ctcmac_irqinfo_id { CTCMAC_NORMAL = 0, CTCMAC_FUNC, CTCMAC_UNIT, + CTCMAC_FUNC_RX0, + CTCMAC_FUNC_RX1, CTCMAC_NUM_IRQS }; @@ -105,6 +117,16 @@ enum ctcmac_int_type { CTCMAC_INT_MAX }; +enum ctcmac_tx_pol_inv { + CTCMAC_TX_POL_INV_DISABLE, + CTCMAC_TX_POL_INV_ENABLE, +}; + +enum ctcmac_rx_pol_inv { + CTCMAC_RX_POL_INV_DISABLE, + CTCMAC_RX_POL_INV_ENABLE, +}; + enum ctcmac_autoneg { CTCMAC_AUTONEG_1000BASEX_M, CTCMAC_AUTONEG_PHY_M, @@ -113,34 +135,46 @@ enum ctcmac_autoneg { CTCMAC_AUTONEG_MAX }; -/* Per TX queue stats */ +/* + * Per TX queue stats + */ struct txq_stats { unsigned long tx_packets; unsigned long tx_bytes; }; +struct tx_skb { + struct sk_buff *skb; + int frag_merge; +}; + struct ctcmac_tx_buff { void *vaddr; dma_addr_t dma; u32 len; u32 offset; - u8 alloc; + bool alloc; }; struct ctcmac_priv_tx_q { - spinlock_t txlock __aligned(SMP_CACHE_BYTES); + spinlock_t txlock __attribute__ ((aligned(SMP_CACHE_BYTES))); struct ctcmac_tx_buff tx_buff[CTCMAC_MAX_RING_SIZE + 1]; unsigned int num_txbdfree; u16 tx_ring_size; u16 qindex; - u16 next_to_alloc; - u16 next_to_clean; + u16 skb_cur; + u16 skb_dirty; + u16 desc_cur; + u16 desc_dirty; struct txq_stats stats; struct net_device *dev; - struct sk_buff **tx_skbuff; + struct tx_skb *tx_skbuff; + struct napi_struct napi_tx; }; -/*Per RX queue stats */ +/* + * Per RX queue stats + */ struct rxq_stats { unsigned long rx_packets; unsigned long rx_bytes; @@ -167,6 +201,7 @@ struct ctcmac_priv_rx_q { u32 pps_limit; u32 token, token_max; u32 rx_trigger; + struct napi_struct napi_rx; }; struct ctcmac_irqinfo { @@ -189,9 +224,9 @@ struct ctcmac_private { struct device *dev; struct net_device *ndev; void __iomem *iobase; - struct cpu_mac_regs __iomem *cpumac_reg; - struct cpu_mac_mems __iomem *cpumac_mem; - struct cpu_mac_unit_regs *cpumacu_reg; + struct CpuMac_regs __iomem *cpumac_reg; + struct CpuMac_mems __iomem *cpumac_mem; + struct CpuMacUnit_regs *cpumacu_reg; u32 device_flags; int irq_num; int index; @@ -213,9 +248,10 @@ struct ctcmac_private { struct work_struct reset_task; struct platform_device *ofdev; - struct napi_struct napi_rx; - struct napi_struct napi_tx; struct ctcmac_irqinfo irqinfo[CTCMAC_NUM_IRQS]; + struct napi_struct napi_tx; + struct napi_struct napi_rx; + struct napi_struct napi_rx1; int hwts_rx_en; int hwts_tx_en; @@ -223,8 +259,16 @@ struct ctcmac_private { u32 supported; u32 msg_enable; u32 int_type; + u32 rx_int_coalesce_cnt; + u32 tx_int_coalesce_cnt; u8 dfe_enable; + u8 tx_pol_inv; + u8 rx_pol_inv; struct timer_list token_timer; + u8 version; + u8 pause_aneg_en; + u8 tx_pause_en; + u8 rx_pause_en; }; struct ctcmac_pkt_stats { diff --git a/platform/centec-arm64/tsingma-bsp/src/ctcmac/ctcmac_reg.h b/platform/centec-arm64/tsingma-bsp/src/ctcmac/ctcmac_reg.h index 2778f0bb4553..302d5d17a9e4 100644 --- a/platform/centec-arm64/tsingma-bsp/src/ctcmac/ctcmac_reg.h +++ b/platform/centec-arm64/tsingma-bsp/src/ctcmac/ctcmac_reg.h @@ -4,147 +4,158 @@ #define CPUMAC_MEM_BASE 0x00004000 #define CPUMAC_REG_BASE 0x00000000 -struct cpu_mac_regs { - u32 cpu_mac_axi_cfg; /* 0x00000000 */ - u32 cpu_mac_axi_mon; /* 0x00000004 */ - u32 cpu_mac_desc_cfg[2]; /* 0x00000008 */ - u32 cpu_mac_buffer_cfg[3]; /* 0x00000010 */ +struct CpuMac_regs { + u32 CpuMacAxiCfg; /* 0x00000000 */ + u32 CpuMacAxiMon; /* 0x00000004 */ + u32 CpuMacDescCfg[2]; /* 0x00000008 */ + u32 CpuMacBufferCfg[3]; /* 0x00000010 */ u32 rsv7; - u32 cpu_mac_debug_stats[3]; /* 0x00000020 */ + u32 CpuMacDebugStats[3]; /* 0x00000020 */ u32 rsv11; - u32 cpu_mac_desc_mon[3]; /* 0x00000030 */ + u32 CpuMacDescMon[3]; /* 0x00000030 */ u32 rsv15; - u32 cpu_mac_dma_weight_cfg; /* 0x00000040 */ - u32 cpu_mac_init; /* 0x00000044 */ - u32 cpu_mac_init_done; /* 0x00000048 */ - u32 cpu_mac_parity_ctl; /* 0x0000004c */ - u32 cpu_mac_ext_ram_cfg[2]; /* 0x00000050 */ + u32 CpuMacDmaWeightCfg; /* 0x00000040 */ + u32 CpuMacInit; /* 0x00000044 */ + u32 CpuMacInitDone; /* 0x00000048 */ + u32 CpuMacParityCtl; /* 0x0000004c */ + u32 CpuMacExtRamCfg[2]; /* 0x00000050 */ u32 rsv22; u32 rsv23; - u32 cpu_mac_fifo_ctl[4]; /* 0x00000060 */ - u32 cpu_mac_gmac_cfg[4]; /* 0x00000070 */ - u32 cpu_mac_ram_chk_rec; /* 0x00000080 */ - u32 cpu_mac_reset; /* 0x00000084 */ - u32 cpu_mac_sgmii_auto_neg_cfg; /* 0x00000088 */ - u32 cpu_mac_reserved; /* 0x0000008c */ - u32 cpu_mac_gmac_mon[2]; /* 0x00000090 */ - u32 cpu_mac_credit_ctl; /* 0x00000098 */ - u32 cpu_mac_credit_status; /* 0x0000009c */ - u32 cpu_mac_pause_cfg[4]; /* 0x000000a0 */ - u32 cpu_mac_pause_mon[3]; /* 0x000000b0 */ + u32 CpuMacFifoCtl[4]; /* 0x00000060 */ + u32 CpuMacGmacCfg[4]; /* 0x00000070 */ + u32 CpuMacRamChkRec; /* 0x00000080 */ + u32 CpuMacReset; /* 0x00000084 */ + u32 CpuMacSgmiiAutoNegCfg; /* 0x00000088 */ + u32 CpuMacReserved; /* 0x0000008c */ + u32 CpuMacGmacMon[2]; /* 0x00000090 */ + u32 CpuMacCreditCtl; /* 0x00000098 */ + u32 CpuMacCreditStatus; /* 0x0000009c */ + u32 CpuMacPauseCfg[4]; /* 0x000000a0 */ + u32 CpuMacPauseMon[3]; /* 0x000000b0 */ u32 rsv47; - u32 cpu_mac_sgmii_cfg[2]; /* 0x000000c0 */ - u32 cpu_mac_sgmii_mon[2]; /* 0x000000c8 */ - u32 cpu_mac_stats_cfg[2]; /* 0x000000d0 */ + u32 CpuMacSgmiiCfg[2]; /* 0x000000c0 */ + u32 CpuMacSgmiiMon[2]; /* 0x000000c8 */ + u32 CpuMacStatsCfg[2]; /* 0x000000d0 */ u32 rsv54; u32 rsv55; - u32 cpu_mac_interrupt_func[4]; /* 0x000000e0 */ - u32 cpu_mac_interrupt_normal[4]; /* 0x000000f0 */ - u32 cpu_mac_fifo_status[3]; /* 0x00000100 */ + u32 CpuMacInterruptFunc[4]; /* 0x000000e0 */ + u32 CpuMacInterruptNormal[4]; /* 0x000000f0 */ + u32 CpuMacFifoStatus[3]; /* 0x00000100 */ + u32 rsv67; + u32 CpuMacDescCfg1[3]; /* 0x00000110 */ + u32 rsv71; + u32 CpuMacInterruptFunc0[4]; /* 0x00000120 */ + u32 CpuMacInterruptFunc1[4]; /* 0x00000130 */ }; -/* cpu_mac_axi_cfg Definition */ -#define CPU_MAC_AXI_CFG_W0_CFG_AXI_WR_BURST_LEN BIT(0) -#define CPU_MAC_AXI_CFG_W0_CFG_AXI_WR_WORD_SWAP_EN BIT(18) -#define CPU_MAC_AXI_CFG_W0_CFG_AXI_WR_D_WORD_SWAP_EN BIT(19) -#define CPU_MAC_AXI_CFG_W0_CFG_AXI_RD_D_WORD_SWAP_EN BIT(17) -#define CPU_MAC_AXI_CFG_W0_CFG_AXI_RD_ADDR_ALIGN_EN BIT(20) -#define CPU_MAC_AXI_CFG_W0_CFG_AXI_RD_BURST_LEN BIT(8) -#define CPU_MAC_AXI_CFG_W0_CFG_AXI_RD_WORD_SWAP_EN BIT(16) +/* ################################################################################ + * # CpuMacAxiCfg Definition */ +#define CPU_MAC_AXI_CFG_W0_CFG_AXI_RD_ADDR_ALIGN_EN_BIT 20 +#define CPU_MAC_AXI_CFG_W0_CFG_AXI_RD_BURST_LEN_BIT 8 +#define CPU_MAC_AXI_CFG_W0_CFG_AXI_RD_D_WORD_SWAP_EN_BIT 17 +#define CPU_MAC_AXI_CFG_W0_CFG_AXI_RD_WORD_SWAP_EN_BIT 16 +#define CPU_MAC_AXI_CFG_W0_CFG_AXI_WR_BURST_LEN_BIT 0 +#define CPU_MAC_AXI_CFG_W0_CFG_AXI_WR_D_WORD_SWAP_EN_BIT 19 +#define CPU_MAC_AXI_CFG_W0_CFG_AXI_WR_WORD_SWAP_EN_BIT 18 -#define CPU_MAC_AXI_CFG_W0_CFG_AXI_WR_BURST_LEN_MASK 0x000000ff -#define CPU_MAC_AXI_CFG_W0_CFG_AXI_WR_WORD_SWAP_EN_MASK 0x00040000 -#define CPU_MAC_AXI_CFG_W0_CFG_AXI_WR_D_WORD_SWAP_EN_MASK 0x00080000 -#define CPU_MAC_AXI_CFG_W0_CFG_AXI_RD_D_WORD_SWAP_EN_MASK 0x00020000 #define CPU_MAC_AXI_CFG_W0_CFG_AXI_RD_ADDR_ALIGN_EN_MASK 0x00100000 #define CPU_MAC_AXI_CFG_W0_CFG_AXI_RD_BURST_LEN_MASK 0x0000ff00 +#define CPU_MAC_AXI_CFG_W0_CFG_AXI_RD_D_WORD_SWAP_EN_MASK 0x00020000 #define CPU_MAC_AXI_CFG_W0_CFG_AXI_RD_WORD_SWAP_EN_MASK 0x00010000 +#define CPU_MAC_AXI_CFG_W0_CFG_AXI_WR_BURST_LEN_MASK 0x000000ff +#define CPU_MAC_AXI_CFG_W0_CFG_AXI_WR_D_WORD_SWAP_EN_MASK 0x00080000 +#define CPU_MAC_AXI_CFG_W0_CFG_AXI_WR_WORD_SWAP_EN_MASK 0x00040000 -/* cpu_mac_axi_mon Definition */ -#define CPU_MAC_AXI_MON_W0_MON_AXI_WR_RESP BIT(4) -#define CPU_MAC_AXI_MON_W0_MON_AXI_RD_RESP BIT(0) +/* ################################################################################ + * # CpuMacAxiMon Definition */ +#define CPU_MAC_AXI_MON_W0_MON_AXI_RD_RESP_BIT 0 +#define CPU_MAC_AXI_MON_W0_MON_AXI_WR_RESP_BIT 4 -#define CPU_MAC_AXI_MON_W0_MON_AXI_WR_RESP_MASK 0x00000070 #define CPU_MAC_AXI_MON_W0_MON_AXI_RD_RESP_MASK 0x00000007 +#define CPU_MAC_AXI_MON_W0_MON_AXI_WR_RESP_MASK 0x00000070 -/* cpu_mac_desc_cfg Definition */ -#define CPU_MAC_DESC_CFG_W0_CFG_TX_DESC_DONE_INTR_EOP_EN BIT(30) -#define CPU_MAC_DESC_CFG_W0_CFG_RX_DESC_DONE_INTR_EOP_EN BIT(29) -#define CPU_MAC_DESC_CFG_W0_CFG_RX_DESC0_DONE_INTR_THRD BIT(8) -#define CPU_MAC_DESC_CFG_W0_CFG_TX_DESC_DONE_INTR_THRD BIT(0) -#define CPU_MAC_DESC_CFG_W0_CFG_RX_DESC1_DONE_INTR_THRD BIT(16) -#define CPU_MAC_DESC_CFG_W0_CFG_TX_DESC_ACK_EN BIT(31) -#define CPU_MAC_DESC_CFG_W1_CFG_RX_DESC0_REQ_INTR_THRD BIT(0) -#define CPU_MAC_DESC_CFG_W1_CFG_RX_DESC1_REQ_INTR_THRD BIT(8) +/* ################################################################################ + * # CpuMacDescCfg Definition */ +#define CPU_MAC_DESC_CFG_W0_CFG_RX_DESC0_DONE_INTR_THRD_BIT 8 +#define CPU_MAC_DESC_CFG_W0_CFG_RX_DESC1_DONE_INTR_THRD_BIT 16 +#define CPU_MAC_DESC_CFG_W0_CFG_RX_DESC_DONE_INTR_EOP_EN_BIT 29 +#define CPU_MAC_DESC_CFG_W0_CFG_TX_DESC_ACK_EN_BIT 31 +#define CPU_MAC_DESC_CFG_W0_CFG_TX_DESC_DONE_INTR_EOP_EN_BIT 30 +#define CPU_MAC_DESC_CFG_W0_CFG_TX_DESC_DONE_INTR_THRD_BIT 0 +#define CPU_MAC_DESC_CFG_W1_CFG_RX_DESC0_REQ_INTR_THRD_BIT 0 +#define CPU_MAC_DESC_CFG_W1_CFG_RX_DESC1_REQ_INTR_THRD_BIT 8 -#define CPU_MAC_DESC_CFG_W0_CFG_TX_DESC_DONE_INTR_EOP_EN_MASK 0x40000000 -#define CPU_MAC_DESC_CFG_W0_CFG_RX_DESC_DONE_INTR_EOP_EN_MASK 0x20000000 #define CPU_MAC_DESC_CFG_W0_CFG_RX_DESC0_DONE_INTR_THRD_MASK 0x0000ff00 -#define CPU_MAC_DESC_CFG_W0_CFG_TX_DESC_DONE_INTR_THRD_MASK 0x000000ff #define CPU_MAC_DESC_CFG_W0_CFG_RX_DESC1_DONE_INTR_THRD_MASK 0x00ff0000 +#define CPU_MAC_DESC_CFG_W0_CFG_RX_DESC_DONE_INTR_EOP_EN_MASK 0x20000000 #define CPU_MAC_DESC_CFG_W0_CFG_TX_DESC_ACK_EN_MASK 0x80000000 +#define CPU_MAC_DESC_CFG_W0_CFG_TX_DESC_DONE_INTR_EOP_EN_MASK 0x40000000 +#define CPU_MAC_DESC_CFG_W0_CFG_TX_DESC_DONE_INTR_THRD_MASK 0x000000ff #define CPU_MAC_DESC_CFG_W1_CFG_RX_DESC0_REQ_INTR_THRD_MASK 0x000000ff #define CPU_MAC_DESC_CFG_W1_CFG_RX_DESC1_REQ_INTR_THRD_MASK 0x0000ff00 -/* cpu_mac_buffer_cfg Definition */ -#define CPU_MAC_BUFFER_CFG_W0_CFG_RX_X_OFF_THRD BIT(16) -#define CPU_MAC_BUFFER_CFG_W0_CFG_RX_X_ON_THRD BIT(0) -#define CPU_MAC_BUFFER_CFG_W1_CFG_RX_RSV_THRD BIT(0) -#define CPU_MAC_BUFFER_CFG_W1_CFG_RX_FLUSH_THRD BIT(16) -#define CPU_MAC_BUFFER_CFG_W2_CFG_RX_FLUSH_EN BIT(0) +/* ################################################################################ + * # CpuMacBufferCfg Definition */ +#define CPU_MAC_BUFFER_CFG_W0_CFG_RX_X_OFF_THRD_BIT 16 +#define CPU_MAC_BUFFER_CFG_W0_CFG_RX_X_ON_THRD_BIT 0 +#define CPU_MAC_BUFFER_CFG_W1_CFG_RX_FLUSH_THRD_BIT 16 +#define CPU_MAC_BUFFER_CFG_W1_CFG_RX_RSV_THRD_BIT 0 +#define CPU_MAC_BUFFER_CFG_W2_CFG_RX_FLUSH_EN_BIT 0 #define CPU_MAC_BUFFER_CFG_W0_CFG_RX_X_OFF_THRD_MASK 0x3fff0000 #define CPU_MAC_BUFFER_CFG_W0_CFG_RX_X_ON_THRD_MASK 0x00003fff -#define CPU_MAC_BUFFER_CFG_W1_CFG_RX_RSV_THRD_MASK 0x00003fff #define CPU_MAC_BUFFER_CFG_W1_CFG_RX_FLUSH_THRD_MASK 0x3fff0000 +#define CPU_MAC_BUFFER_CFG_W1_CFG_RX_RSV_THRD_MASK 0x00003fff #define CPU_MAC_BUFFER_CFG_W2_CFG_RX_FLUSH_EN_MASK 0x00000001 -/* cpu_mac_debug_stats Definition */ -#define CPU_MAC_DEBUG_STATS_W0_DMA_RX_ERROR_CNT BIT(20) -#define CPU_MAC_DEBUG_STATS_W0_GMAC_TX_SOP_CNT BIT(24) -#define CPU_MAC_DEBUG_STATS_W0_GMAC_RX_SOP_CNT BIT(0) -#define CPU_MAC_DEBUG_STATS_W0_GMAC_RX_EOP_CNT BIT(4) -#define CPU_MAC_DEBUG_STATS_W0_GMAC_TX_EOP_CNT BIT(28) -#define CPU_MAC_DEBUG_STATS_W0_DMA_RX_EOP_CNT BIT(16) -#define CPU_MAC_DEBUG_STATS_W0_GMAC_RX_ERROR_CNT BIT(8) -#define CPU_MAC_DEBUG_STATS_W0_DMA_RX_SOP_CNT BIT(12) -#define CPU_MAC_DEBUG_STATS_W1_DMA_TX_EOP_CNT BIT(8) -#define CPU_MAC_DEBUG_STATS_W1_GMAC_TX_PTP_ERR_CNT BIT(16) -#define CPU_MAC_DEBUG_STATS_W1_DMA_TX_SOP_CNT BIT(4) -#define CPU_MAC_DEBUG_STATS_W1_DMA_TX_ERROR_CNT BIT(12) -#define CPU_MAC_DEBUG_STATS_W1_GMAC_TX_ERROR_CNT BIT(0) -#define CPU_MAC_DEBUG_STATS_W2_AXI_RD_BURST_CNT BIT(8) -#define CPU_MAC_DEBUG_STATS_W2_EXT_RAM_SBE_CNT BIT(16) -#define CPU_MAC_DEBUG_STATS_W2_AXI_RD_BURST_ERR_CNT BIT(12) -#define CPU_MAC_DEBUG_STATS_W2_AXI_WR_BURST_CNT BIT(0) -#define CPU_MAC_DEBUG_STATS_W2_AXI_WR_BURST_ERR_CNT BIT(4) +/* ################################################################################ + * # CpuMacDebugStats Definition */ +#define CPU_MAC_DEBUG_STATS_W0_DMA_RX_EOP_CNT_BIT 16 +#define CPU_MAC_DEBUG_STATS_W0_DMA_RX_ERROR_CNT_BIT 20 +#define CPU_MAC_DEBUG_STATS_W0_DMA_RX_SOP_CNT_BIT 12 +#define CPU_MAC_DEBUG_STATS_W0_GMAC_RX_EOP_CNT_BIT 4 +#define CPU_MAC_DEBUG_STATS_W0_GMAC_RX_ERROR_CNT_BIT 8 +#define CPU_MAC_DEBUG_STATS_W0_GMAC_RX_SOP_CNT_BIT 0 +#define CPU_MAC_DEBUG_STATS_W0_GMAC_TX_EOP_CNT_BIT 28 +#define CPU_MAC_DEBUG_STATS_W0_GMAC_TX_SOP_CNT_BIT 24 +#define CPU_MAC_DEBUG_STATS_W1_DMA_TX_EOP_CNT_BIT 8 +#define CPU_MAC_DEBUG_STATS_W1_DMA_TX_ERROR_CNT_BIT 12 +#define CPU_MAC_DEBUG_STATS_W1_DMA_TX_SOP_CNT_BIT 4 +#define CPU_MAC_DEBUG_STATS_W1_GMAC_TX_ERROR_CNT_BIT 0 +#define CPU_MAC_DEBUG_STATS_W1_GMAC_TX_PTP_ERR_CNT_BIT 16 +#define CPU_MAC_DEBUG_STATS_W2_AXI_RD_BURST_CNT_BIT 8 +#define CPU_MAC_DEBUG_STATS_W2_AXI_RD_BURST_ERR_CNT_BIT 12 +#define CPU_MAC_DEBUG_STATS_W2_AXI_WR_BURST_CNT_BIT 0 +#define CPU_MAC_DEBUG_STATS_W2_AXI_WR_BURST_ERR_CNT_BIT 4 +#define CPU_MAC_DEBUG_STATS_W2_EXT_RAM_SBE_CNT_BIT 16 +#define CPU_MAC_DEBUG_STATS_W0_DMA_RX_EOP_CNT_MASK 0x000f0000 #define CPU_MAC_DEBUG_STATS_W0_DMA_RX_ERROR_CNT_MASK 0x00f00000 -#define CPU_MAC_DEBUG_STATS_W0_GMAC_TX_SOP_CNT_MASK 0x0f000000 -#define CPU_MAC_DEBUG_STATS_W0_GMAC_RX_SOP_CNT_MASK 0x0000000f +#define CPU_MAC_DEBUG_STATS_W0_DMA_RX_SOP_CNT_MASK 0x0000f000 #define CPU_MAC_DEBUG_STATS_W0_GMAC_RX_EOP_CNT_MASK 0x000000f0 -#define CPU_MAC_DEBUG_STATS_W0_GMAC_TX_EOP_CNT_MASK 0xf0000000 -#define CPU_MAC_DEBUG_STATS_W0_DMA_RX_EOP_CNT_MASK 0x000f0000 #define CPU_MAC_DEBUG_STATS_W0_GMAC_RX_ERROR_CNT_MASK 0x00000f00 -#define CPU_MAC_DEBUG_STATS_W0_DMA_RX_SOP_CNT_MASK 0x0000f000 +#define CPU_MAC_DEBUG_STATS_W0_GMAC_RX_SOP_CNT_MASK 0x0000000f +#define CPU_MAC_DEBUG_STATS_W0_GMAC_TX_EOP_CNT_MASK 0xf0000000 +#define CPU_MAC_DEBUG_STATS_W0_GMAC_TX_SOP_CNT_MASK 0x0f000000 #define CPU_MAC_DEBUG_STATS_W1_DMA_TX_EOP_CNT_MASK 0x00000f00 -#define CPU_MAC_DEBUG_STATS_W1_GMAC_TX_PTP_ERR_CNT_MASK 0x000f0000 -#define CPU_MAC_DEBUG_STATS_W1_DMA_TX_SOP_CNT_MASK 0x000000f0 #define CPU_MAC_DEBUG_STATS_W1_DMA_TX_ERROR_CNT_MASK 0x0000f000 +#define CPU_MAC_DEBUG_STATS_W1_DMA_TX_SOP_CNT_MASK 0x000000f0 #define CPU_MAC_DEBUG_STATS_W1_GMAC_TX_ERROR_CNT_MASK 0x0000000f +#define CPU_MAC_DEBUG_STATS_W1_GMAC_TX_PTP_ERR_CNT_MASK 0x000f0000 #define CPU_MAC_DEBUG_STATS_W2_AXI_RD_BURST_CNT_MASK 0x00000f00 -#define CPU_MAC_DEBUG_STATS_W2_EXT_RAM_SBE_CNT_MASK 0x000f0000 #define CPU_MAC_DEBUG_STATS_W2_AXI_RD_BURST_ERR_CNT_MASK 0x0000f000 #define CPU_MAC_DEBUG_STATS_W2_AXI_WR_BURST_CNT_MASK 0x0000000f #define CPU_MAC_DEBUG_STATS_W2_AXI_WR_BURST_ERR_CNT_MASK 0x000000f0 +#define CPU_MAC_DEBUG_STATS_W2_EXT_RAM_SBE_CNT_MASK 0x000f0000 -/* cpu_mac_desc_mon Definition */ -#define CPU_MAC_DESC_MON_W0_MON_DESC_AVAIL_NUM0 BIT(0) -#define CPU_MAC_DESC_MON_W0_MON_DESC_AVAIL_NUM1 BIT(16) -#define CPU_MAC_DESC_MON_W1_MON_DESC_AVAIL_NUM2 BIT(0) -#define CPU_MAC_DESC_MON_W1_MON_DESC_DONE_NUM0 BIT(16) -#define CPU_MAC_DESC_MON_W2_MON_DESC_DONE_NUM1 BIT(0) -#define CPU_MAC_DESC_MON_W2_MON_DESC_DONE_NUM2 BIT(16) +/* ################################################################################ + * # CpuMacDescMon Definition */ +#define CPU_MAC_DESC_MON_W0_MON_DESC_AVAIL_NUM0_BIT 0 +#define CPU_MAC_DESC_MON_W0_MON_DESC_AVAIL_NUM1_BIT 16 +#define CPU_MAC_DESC_MON_W1_MON_DESC_AVAIL_NUM2_BIT 0 +#define CPU_MAC_DESC_MON_W1_MON_DESC_DONE_NUM0_BIT 16 +#define CPU_MAC_DESC_MON_W2_MON_DESC_DONE_NUM1_BIT 0 +#define CPU_MAC_DESC_MON_W2_MON_DESC_DONE_NUM2_BIT 16 #define CPU_MAC_DESC_MON_W0_MON_DESC_AVAIL_NUM0_MASK 0x0000ffff #define CPU_MAC_DESC_MON_W0_MON_DESC_AVAIL_NUM1_MASK 0xffff0000 @@ -153,1645 +164,1708 @@ struct cpu_mac_regs { #define CPU_MAC_DESC_MON_W2_MON_DESC_DONE_NUM1_MASK 0x0000ffff #define CPU_MAC_DESC_MON_W2_MON_DESC_DONE_NUM2_MASK 0xffff0000 -/* cpu_mac_dma_weight_cfg Definition */ -#define CPU_MAC_DMA_WEIGHT_CFG_W0_CFG_DMA_RX_WEIGHT1 BIT(8) -#define CPU_MAC_DMA_WEIGHT_CFG_W0_CFG_DMA_RX_WEIGHT0 BIT(0) +/* ################################################################################ + * # CpuMacDmaWeightCfg Definition */ +#define CPU_MAC_DMA_WEIGHT_CFG_W0_CFG_DMA_RX_WEIGHT0_BIT 0 +#define CPU_MAC_DMA_WEIGHT_CFG_W0_CFG_DMA_RX_WEIGHT1_BIT 8 -#define CPU_MAC_DMA_WEIGHT_CFG_W0_CFG_DMA_RX_WEIGHT1_MASK 0x00000f00 #define CPU_MAC_DMA_WEIGHT_CFG_W0_CFG_DMA_RX_WEIGHT0_MASK 0x0000000f +#define CPU_MAC_DMA_WEIGHT_CFG_W0_CFG_DMA_RX_WEIGHT1_MASK 0x00000f00 -/* cpu_mac_init Definition */ -#define CPU_MAC_INIT_W0_INIT BIT(0) +/* ################################################################################ + * # CpuMacInit Definition */ +#define CPU_MAC_INIT_W0_INIT_BIT 0 #define CPU_MAC_INIT_W0_INIT_MASK 0x00000001 -/* cpu_mac_init_done Definition */ -#define CPU_MAC_INIT_DONE_W0_INIT_DONE BIT(0) +/* ################################################################################ + * # CpuMacInitDone Definition */ +#define CPU_MAC_INIT_DONE_W0_INIT_DONE_BIT 0 #define CPU_MAC_INIT_DONE_W0_INIT_DONE_MASK 0x00000001 -/* cpu_mac_parity_ctl Definition */ -#define CPU_MAC_PARITY_CTL_W0_RX_PKT_MSG_FIFO_PARITY_EN BIT(2) -#define CPU_MAC_PARITY_CTL_W0_TX_PKT_FIFO_PARITY_EN BIT(4) -#define CPU_MAC_PARITY_CTL_W0_EXT_RAM_ECC_DETECT_DIS BIT(8) -#define CPU_MAC_PARITY_CTL_W0_CPU_MAC_STATS_RAM_PARITY_EN BIT(0) -#define CPU_MAC_PARITY_CTL_W0_RX_DESC0_CFG_FIFO_PARITY_EN BIT(5) -#define CPU_MAC_PARITY_CTL_W0_RX_PKT_DATA_FIFO_PARITY_EN BIT(1) -#define CPU_MAC_PARITY_CTL_W0_TX_DESC_CFG_FIFO_PARITY_EN BIT(7) -#define CPU_MAC_PARITY_CTL_W0_RX_DESC1_CFG_FIFO_PARITY_EN BIT(6) -#define CPU_MAC_PARITY_CTL_W0_EXT_RAM_ECC_CORRECT_DIS BIT(9) +/* ################################################################################ + * # CpuMacParityCtl Definition */ +#define CPU_MAC_PARITY_CTL_W0_CPU_MAC_STATS_RAM_PARITY_EN_BIT 0 +#define CPU_MAC_PARITY_CTL_W0_EXT_RAM_ECC_CORRECT_DIS_BIT 9 +#define CPU_MAC_PARITY_CTL_W0_EXT_RAM_ECC_DETECT_DIS_BIT 8 +#define CPU_MAC_PARITY_CTL_W0_RX_DESC0_CFG_FIFO_PARITY_EN_BIT 5 +#define CPU_MAC_PARITY_CTL_W0_RX_DESC1_CFG_FIFO_PARITY_EN_BIT 6 +#define CPU_MAC_PARITY_CTL_W0_RX_PKT_DATA_FIFO_PARITY_EN_BIT 1 +#define CPU_MAC_PARITY_CTL_W0_RX_PKT_MSG_FIFO_PARITY_EN_BIT 2 +#define CPU_MAC_PARITY_CTL_W0_TX_DESC_CFG_FIFO_PARITY_EN_BIT 7 +#define CPU_MAC_PARITY_CTL_W0_TX_PKT_FIFO_PARITY_EN_BIT 4 -#define CPU_MAC_PARITY_CTL_W0_RX_PKT_MSG_FIFO_PARITY_EN_MASK 0x00000004 -#define CPU_MAC_PARITY_CTL_W0_TX_PKT_FIFO_PARITY_EN_MASK 0x00000010 -#define CPU_MAC_PARITY_CTL_W0_EXT_RAM_ECC_DETECT_DIS_MASK 0x00000100 #define CPU_MAC_PARITY_CTL_W0_CPU_MAC_STATS_RAM_PARITY_EN_MASK 0x00000001 +#define CPU_MAC_PARITY_CTL_W0_EXT_RAM_ECC_CORRECT_DIS_MASK 0x00000200 +#define CPU_MAC_PARITY_CTL_W0_EXT_RAM_ECC_DETECT_DIS_MASK 0x00000100 #define CPU_MAC_PARITY_CTL_W0_RX_DESC0_CFG_FIFO_PARITY_EN_MASK 0x00000020 +#define CPU_MAC_PARITY_CTL_W0_RX_DESC1_CFG_FIFO_PARITY_EN_MASK 0x00000040 #define CPU_MAC_PARITY_CTL_W0_RX_PKT_DATA_FIFO_PARITY_EN_MASK 0x00000002 +#define CPU_MAC_PARITY_CTL_W0_RX_PKT_MSG_FIFO_PARITY_EN_MASK 0x00000004 #define CPU_MAC_PARITY_CTL_W0_TX_DESC_CFG_FIFO_PARITY_EN_MASK 0x00000080 -#define CPU_MAC_PARITY_CTL_W0_RX_DESC1_CFG_FIFO_PARITY_EN_MASK 0x00000040 -#define CPU_MAC_PARITY_CTL_W0_EXT_RAM_ECC_CORRECT_DIS_MASK 0x00000200 +#define CPU_MAC_PARITY_CTL_W0_TX_PKT_FIFO_PARITY_EN_MASK 0x00000010 -/* cpu_mac_ext_ram_cfg Definition */ -#define CPU_MAC_EXT_RAM_CFG_W0_CFG_EXT_RAM_EN BIT(31) -#define CPU_MAC_EXT_RAM_CFG_W0_CFG_EXT_RAM_BASE_SIZE BIT(0) -#define CPU_MAC_EXT_RAM_CFG_W1_CFG_EXT_RAM_BASE_ADDR BIT(0) +/* ################################################################################ + * # CpuMacExtRamCfg Definition */ +#define CPU_MAC_EXT_RAM_CFG_W0_CFG_EXT_RAM_BASE_SIZE_BIT 0 +#define CPU_MAC_EXT_RAM_CFG_W0_CFG_EXT_RAM_EN_BIT 31 +#define CPU_MAC_EXT_RAM_CFG_W1_CFG_EXT_RAM_BASE_ADDR_BIT 0 -#define CPU_MAC_EXT_RAM_CFG_W0_CFG_EXT_RAM_EN_MASK 0x80000000 #define CPU_MAC_EXT_RAM_CFG_W0_CFG_EXT_RAM_BASE_SIZE_MASK 0x000003ff +#define CPU_MAC_EXT_RAM_CFG_W0_CFG_EXT_RAM_EN_MASK 0x80000000 #define CPU_MAC_EXT_RAM_CFG_W1_CFG_EXT_RAM_BASE_ADDR_MASK 0x000fffff -/* cpu_mac_fifo_ctl Definition */ -#define CPU_MAC_FIFO_CTL_W0_RX_PKT_DATA_FIFO_A_FULL_THRD BIT(0) -#define CPU_MAC_FIFO_CTL_W1_RX_PKT_MSG_FIFO_A_FULL_THRD BIT(0) -#define CPU_MAC_FIFO_CTL_W2_TX_PKT_FIFO_A_FULL_THRD BIT(0) -#define CPU_MAC_FIFO_CTL_W3_RX_PKT_FIFO_A_FULL_THRD BIT(0) +/* ################################################################################ + * # CpuMacFifoCtl Definition */ +#define CPU_MAC_FIFO_CTL_W0_RX_PKT_DATA_FIFO_A_FULL_THRD_BIT 0 +#define CPU_MAC_FIFO_CTL_W1_RX_PKT_MSG_FIFO_A_FULL_THRD_BIT 0 +#define CPU_MAC_FIFO_CTL_W2_TX_PKT_FIFO_A_FULL_THRD_BIT 0 +#define CPU_MAC_FIFO_CTL_W3_RX_PKT_FIFO_A_FULL_THRD_BIT 0 #define CPU_MAC_FIFO_CTL_W0_RX_PKT_DATA_FIFO_A_FULL_THRD_MASK 0x00001fff #define CPU_MAC_FIFO_CTL_W1_RX_PKT_MSG_FIFO_A_FULL_THRD_MASK 0x000003ff #define CPU_MAC_FIFO_CTL_W2_TX_PKT_FIFO_A_FULL_THRD_MASK 0x000007ff #define CPU_MAC_FIFO_CTL_W3_RX_PKT_FIFO_A_FULL_THRD_MASK 0x000003ff -/* cpu_mac_gmac_cfg Definition */ -#define CPU_MAC_GMAC_CFG_W0_CFG_RX_CUT_THROUGH_EN BIT(4) -#define CPU_MAC_GMAC_CFG_W0_CFG_RX_UNDERSIZE_DROP_EN BIT(3) -#define CPU_MAC_GMAC_CFG_W0_CFG_RX_ERROR_DROP_EN BIT(5) -#define CPU_MAC_GMAC_CFG_W0_CFG_RX_TS_EN BIT(0) -#define CPU_MAC_GMAC_CFG_W0_CFG_RX_OVERSIZE_DROP_EN BIT(2) -#define CPU_MAC_GMAC_CFG_W0_CFG_RX_PAUSE_DROP_EN BIT(6) -#define CPU_MAC_GMAC_CFG_W0_CFG_RX_OVERRUN_DROP_EN BIT(1) -#define CPU_MAC_GMAC_CFG_W1_CFG_RX_MAX_PKT_LEN_CHK_EN BIT(0) -#define CPU_MAC_GMAC_CFG_W1_CFG_RX_MIN_PKT_LEN BIT(17) -#define CPU_MAC_GMAC_CFG_W1_CFG_RX_MIN_PKT_LEN_CHK_EN BIT(16) -#define CPU_MAC_GMAC_CFG_W1_CFG_RX_MAX_PKT_LEN BIT(1) -#define CPU_MAC_GMAC_CFG_W2_CFG_TX_START_THRD BIT(16) -#define CPU_MAC_GMAC_CFG_W2_CFG_TX_ERR_MASK_OFF BIT(1) -#define CPU_MAC_GMAC_CFG_W2_CFG_TX_PTP_ERR_EN BIT(6) -#define CPU_MAC_GMAC_CFG_W2_CFG_TX_KEEP_TS_EN BIT(12) -#define CPU_MAC_GMAC_CFG_W2_CFG_TX_PAUSE_STALL_EN BIT(4) -#define CPU_MAC_GMAC_CFG_W2_CFG_TX_CUT_THROUGH_EN BIT(10) -#define CPU_MAC_GMAC_CFG_W2_CFG_TX_STRIP_CRC_EN BIT(8) -#define CPU_MAC_GMAC_CFG_W2_CFG_TX_PKT_EN BIT(5) -#define CPU_MAC_GMAC_CFG_W2_CFG_TX_PAD_EN BIT(3) -#define CPU_MAC_GMAC_CFG_W2_CFG_TX_WAIT_CAPTURE_TS BIT(9) -#define CPU_MAC_GMAC_CFG_W2_CFG_TX_HDR_INFO_EN BIT(11) -#define CPU_MAC_GMAC_CFG_W2_CFG_TX_LPI_EN BIT(2) -#define CPU_MAC_GMAC_CFG_W2_CFG_TX_APPEND_CRC_EN BIT(0) -#define CPU_MAC_GMAC_CFG_W3_CFG_TX_SLEEP_TIMER BIT(0) -#define CPU_MAC_GMAC_CFG_W3_CFG_TX_WAKEUP_TIMER BIT(16) +/* ################################################################################ + * # CpuMacGmacCfg Definition */ +#define CPU_MAC_GMAC_CFG_W0_CFG_RX_CUT_THROUGH_EN_BIT 4 +#define CPU_MAC_GMAC_CFG_W0_CFG_RX_ERROR_DROP_EN_BIT 5 +#define CPU_MAC_GMAC_CFG_W0_CFG_RX_OVERRUN_DROP_EN_BIT 1 +#define CPU_MAC_GMAC_CFG_W0_CFG_RX_OVERSIZE_DROP_EN_BIT 2 +#define CPU_MAC_GMAC_CFG_W0_CFG_RX_PAUSE_DROP_EN_BIT 6 +#define CPU_MAC_GMAC_CFG_W0_CFG_RX_TS_EN_BIT 0 +#define CPU_MAC_GMAC_CFG_W0_CFG_RX_UNDERSIZE_DROP_EN_BIT 3 +#define CPU_MAC_GMAC_CFG_W1_CFG_RX_MAX_PKT_LEN_BIT 1 +#define CPU_MAC_GMAC_CFG_W1_CFG_RX_MAX_PKT_LEN_CHK_EN_BIT 0 +#define CPU_MAC_GMAC_CFG_W1_CFG_RX_MIN_PKT_LEN_BIT 17 +#define CPU_MAC_GMAC_CFG_W1_CFG_RX_MIN_PKT_LEN_CHK_EN_BIT 16 +#define CPU_MAC_GMAC_CFG_W2_CFG_TX_APPEND_CRC_EN_BIT 0 +#define CPU_MAC_GMAC_CFG_W2_CFG_TX_CUT_THROUGH_EN_BIT 10 +#define CPU_MAC_GMAC_CFG_W2_CFG_TX_ERR_MASK_OFF_BIT 1 +#define CPU_MAC_GMAC_CFG_W2_CFG_TX_HDR_INFO_EN_BIT 11 +#define CPU_MAC_GMAC_CFG_W2_CFG_TX_KEEP_TS_EN_BIT 12 +#define CPU_MAC_GMAC_CFG_W2_CFG_TX_LPI_EN_BIT 2 +#define CPU_MAC_GMAC_CFG_W2_CFG_TX_PAD_EN_BIT 3 +#define CPU_MAC_GMAC_CFG_W2_CFG_TX_PAUSE_STALL_EN_BIT 4 +#define CPU_MAC_GMAC_CFG_W2_CFG_TX_PKT_EN_BIT 5 +#define CPU_MAC_GMAC_CFG_W2_CFG_TX_PTP_ERR_EN_BIT 6 +#define CPU_MAC_GMAC_CFG_W2_CFG_TX_START_THRD_BIT 16 +#define CPU_MAC_GMAC_CFG_W2_CFG_TX_STRIP_CRC_EN_BIT 8 +#define CPU_MAC_GMAC_CFG_W2_CFG_TX_WAIT_CAPTURE_TS_BIT 9 +#define CPU_MAC_GMAC_CFG_W3_CFG_TX_SLEEP_TIMER_BIT 0 +#define CPU_MAC_GMAC_CFG_W3_CFG_TX_WAKEUP_TIMER_BIT 16 #define CPU_MAC_GMAC_CFG_W0_CFG_RX_CUT_THROUGH_EN_MASK 0x00000010 -#define CPU_MAC_GMAC_CFG_W0_CFG_RX_UNDERSIZE_DROP_EN_MASK 0x00000008 #define CPU_MAC_GMAC_CFG_W0_CFG_RX_ERROR_DROP_EN_MASK 0x00000020 -#define CPU_MAC_GMAC_CFG_W0_CFG_RX_TS_EN_MASK 0x00000001 +#define CPU_MAC_GMAC_CFG_W0_CFG_RX_OVERRUN_DROP_EN_MASK 0x00000002 #define CPU_MAC_GMAC_CFG_W0_CFG_RX_OVERSIZE_DROP_EN_MASK 0x00000004 #define CPU_MAC_GMAC_CFG_W0_CFG_RX_PAUSE_DROP_EN_MASK 0x00000040 -#define CPU_MAC_GMAC_CFG_W0_CFG_RX_OVERRUN_DROP_EN_MASK 0x00000002 +#define CPU_MAC_GMAC_CFG_W0_CFG_RX_TS_EN_MASK 0x00000001 +#define CPU_MAC_GMAC_CFG_W0_CFG_RX_UNDERSIZE_DROP_EN_MASK 0x00000008 +#define CPU_MAC_GMAC_CFG_W1_CFG_RX_MAX_PKT_LEN_MASK 0x0000fffe #define CPU_MAC_GMAC_CFG_W1_CFG_RX_MAX_PKT_LEN_CHK_EN_MASK 0x00000001 #define CPU_MAC_GMAC_CFG_W1_CFG_RX_MIN_PKT_LEN_MASK 0x00fe0000 #define CPU_MAC_GMAC_CFG_W1_CFG_RX_MIN_PKT_LEN_CHK_EN_MASK 0x00010000 -#define CPU_MAC_GMAC_CFG_W1_CFG_RX_MAX_PKT_LEN_MASK 0x0000fffe -#define CPU_MAC_GMAC_CFG_W2_CFG_TX_START_THRD_MASK 0x07ff0000 +#define CPU_MAC_GMAC_CFG_W2_CFG_TX_APPEND_CRC_EN_MASK 0x00000001 +#define CPU_MAC_GMAC_CFG_W2_CFG_TX_CUT_THROUGH_EN_MASK 0x00000400 #define CPU_MAC_GMAC_CFG_W2_CFG_TX_ERR_MASK_OFF_MASK 0x00000002 -#define CPU_MAC_GMAC_CFG_W2_CFG_TX_PTP_ERR_EN_MASK 0x00000040 +#define CPU_MAC_GMAC_CFG_W2_CFG_TX_HDR_INFO_EN_MASK 0x00000800 #define CPU_MAC_GMAC_CFG_W2_CFG_TX_KEEP_TS_EN_MASK 0x00001000 +#define CPU_MAC_GMAC_CFG_W2_CFG_TX_LPI_EN_MASK 0x00000004 +#define CPU_MAC_GMAC_CFG_W2_CFG_TX_PAD_EN_MASK 0x00000008 #define CPU_MAC_GMAC_CFG_W2_CFG_TX_PAUSE_STALL_EN_MASK 0x00000010 -#define CPU_MAC_GMAC_CFG_W2_CFG_TX_CUT_THROUGH_EN_MASK 0x00000400 -#define CPU_MAC_GMAC_CFG_W2_CFG_TX_STRIP_CRC_EN_MASK 0x00000100 #define CPU_MAC_GMAC_CFG_W2_CFG_TX_PKT_EN_MASK 0x00000020 -#define CPU_MAC_GMAC_CFG_W2_CFG_TX_PAD_EN_MASK 0x00000008 +#define CPU_MAC_GMAC_CFG_W2_CFG_TX_PTP_ERR_EN_MASK 0x00000040 +#define CPU_MAC_GMAC_CFG_W2_CFG_TX_START_THRD_MASK 0x07ff0000 +#define CPU_MAC_GMAC_CFG_W2_CFG_TX_STRIP_CRC_EN_MASK 0x00000100 #define CPU_MAC_GMAC_CFG_W2_CFG_TX_WAIT_CAPTURE_TS_MASK 0x00000200 -#define CPU_MAC_GMAC_CFG_W2_CFG_TX_HDR_INFO_EN_MASK 0x00000800 -#define CPU_MAC_GMAC_CFG_W2_CFG_TX_LPI_EN_MASK 0x00000004 -#define CPU_MAC_GMAC_CFG_W2_CFG_TX_APPEND_CRC_EN_MASK 0x00000001 #define CPU_MAC_GMAC_CFG_W3_CFG_TX_SLEEP_TIMER_MASK 0x0000ffff #define CPU_MAC_GMAC_CFG_W3_CFG_TX_WAKEUP_TIMER_MASK 0xffff0000 -/* cpu_mac_ram_chk_rec Definition */ -#define CPU_MAC_RAM_CHK_REC_W0_CPU_MAC_STATS_RAM_PARITY_FAIL BIT(31) -#define CPU_MAC_RAM_CHK_REC_W0_CPU_MAC_STATS_RAM_PARITY_FAIL_ADDR BIT(0) +/* ################################################################################ + * # CpuMacRamChkRec Definition */ +#define CPU_MAC_RAM_CHK_REC_W0_CPU_MAC_STATS_RAM_PARITY_FAIL_BIT 31 +#define CPU_MAC_RAM_CHK_REC_W0_CPU_MAC_STATS_RAM_PARITY_FAIL_ADDR_BIT 0 #define CPU_MAC_RAM_CHK_REC_W0_CPU_MAC_STATS_RAM_PARITY_FAIL_MASK 0x80000000 #define CPU_MAC_RAM_CHK_REC_W0_CPU_MAC_STATS_RAM_PARITY_FAIL_ADDR_MASK 0x0000003f -/* cpu_mac_reset Definition */ -#define CPU_MAC_RESET_W0_SOFT_RST_TX BIT(1) -#define CPU_MAC_RESET_W0_SOFT_RST_RX BIT(0) +/* ################################################################################ + * # CpuMacReset Definition */ +#define CPU_MAC_RESET_W0_SOFT_RST_RX_BIT 0 +#define CPU_MAC_RESET_W0_SOFT_RST_TX_BIT 1 -#define CPU_MAC_RESET_W0_SOFT_RST_TX_MASK 0x00000002 #define CPU_MAC_RESET_W0_SOFT_RST_RX_MASK 0x00000001 +#define CPU_MAC_RESET_W0_SOFT_RST_TX_MASK 0x00000002 -/* cpu_mac_sgmii_auto_neg_cfg Definition */ -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_RESTART BIT(1) -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_LOCAL_SPEED_MODE BIT(7) -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_LINK_TIMER_CNT BIT(16) -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_MODE BIT(2) -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_REMOTE_LINKUP_EN BIT(25) -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_IGNORE_LINK_FAILURE BIT(5) -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_PARALLEL_DETECT_EN BIT(24) -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_TX_XMIT_LOAD_USE_ASYNC_FIFO BIT(14) -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_LOCAL_EEE_ABILITY BIT(9) -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_ENABLE BIT(0) -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_LOCAL_OFFLINE BIT(6) -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_IGNORE_ANEG_ERR BIT(4) -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_TX_CONFIG_REG_BIT14 BIT(13) -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_LOCAL_EEE_CLK_STOP BIT(10) -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_LOCAL_PAUSE_ABILITY BIT(11) +/* ################################################################################ + * # CpuMacSgmiiAutoNegCfg Definition */ +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_ENABLE_BIT 0 +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_MODE_BIT 2 +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_PARALLEL_DETECT_EN_BIT 24 +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_REMOTE_LINKUP_EN_BIT 25 +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_RESTART_BIT 1 +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_IGNORE_ANEG_ERR_BIT 4 +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_IGNORE_LINK_FAILURE_BIT 5 +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_LINK_TIMER_CNT_BIT 16 +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_LOCAL_EEE_ABILITY_BIT 9 +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_LOCAL_EEE_CLK_STOP_BIT 10 +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_LOCAL_OFFLINE_BIT 6 +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_LOCAL_PAUSE_ABILITY_BIT 11 +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_LOCAL_SPEED_MODE_BIT 7 +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_TX_CONFIG_REG_BIT14_BIT 13 +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_TX_XMIT_LOAD_USE_ASYNC_FIFO_BIT 14 -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_RESTART_MASK 0x00000002 -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_LOCAL_SPEED_MODE_MASK 0x00000180 -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_LINK_TIMER_CNT_MASK 0x00ff0000 +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_ENABLE_MASK 0x00000001 #define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_MODE_MASK 0x0000000c +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_PARALLEL_DETECT_EN_MASK 0x01000000 #define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_REMOTE_LINKUP_EN_MASK 0x02000000 +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_RESTART_MASK 0x00000002 +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_IGNORE_ANEG_ERR_MASK 0x00000010 #define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_IGNORE_LINK_FAILURE_MASK 0x00000020 -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_PARALLEL_DETECT_EN_MASK 0x01000000 -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_TX_XMIT_LOAD_USE_ASYNC_FIFO_MASK 0x00004000 +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_LINK_TIMER_CNT_MASK 0x00ff0000 #define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_LOCAL_EEE_ABILITY_MASK 0x00000200 -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_ENABLE_MASK 0x00000001 -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_LOCAL_OFFLINE_MASK 0x00000040 -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_IGNORE_ANEG_ERR_MASK 0x00000010 -#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_TX_CONFIG_REG_BIT14_MASK 0x00002000 #define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_LOCAL_EEE_CLK_STOP_MASK 0x00000400 +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_LOCAL_OFFLINE_MASK 0x00000040 #define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_LOCAL_PAUSE_ABILITY_MASK 0x00001800 +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_LOCAL_SPEED_MODE_MASK 0x00000180 +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_TX_CONFIG_REG_BIT14_MASK 0x00002000 +#define CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_TX_XMIT_LOAD_USE_ASYNC_FIFO_MASK 0x00004000 -/* cpu_mac_reserved Definition */ -#define CPU_MAC_RESERVED_W0_RESERVED BIT(0) +/* ################################################################################ + * # CpuMacReserved Definition */ +#define CPU_MAC_RESERVED_W0_RESERVED_BIT 0 #define CPU_MAC_RESERVED_W0_RESERVED_MASK 0xffffffff -/* cpu_mac_gmac_mon Definition */ -#define CPU_MAC_GMAC_MON_W0_MON_TX_LPI_STATE BIT(6) -#define CPU_MAC_GMAC_MON_W0_MON_RX_METER_TOKEN BIT(8) -#define CPU_MAC_GMAC_MON_W0_MON_RX_PKT_STATE BIT(0) -#define CPU_MAC_GMAC_MON_W1_GMAC_RX_BUF_FULL_DROP_CNT BIT(20) -#define CPU_MAC_GMAC_MON_W1_GMAC_RX_FILTER_DROP_CNT BIT(24) -#define CPU_MAC_GMAC_MON_W1_MON_TX_LPI_STATUS BIT(0) -#define CPU_MAC_GMAC_MON_W1_MON_RX_BUF_RD_STATE BIT(2) -#define CPU_MAC_GMAC_MON_W1_MON_TX_POP_STATE BIT(5) -#define CPU_MAC_GMAC_MON_W1_GMAC_RX_RUNT_DROP_CNT BIT(16) -#define CPU_MAC_GMAC_MON_W1_MON_TX_STATS_UNDERRUN BIT(1) -#define CPU_MAC_GMAC_MON_W1_MON_RX_PKT_LEN BIT(8) -#define CPU_MAC_GMAC_MON_W1_GMAC_RX_PAUSE_DROP_CNT BIT(28) +/* ################################################################################ + * # CpuMacGmacMon Definition */ +#define CPU_MAC_GMAC_MON_W0_MON_RX_METER_TOKEN_BIT 8 +#define CPU_MAC_GMAC_MON_W0_MON_RX_PKT_STATE_BIT 0 +#define CPU_MAC_GMAC_MON_W0_MON_TX_LPI_STATE_BIT 6 +#define CPU_MAC_GMAC_MON_W1_GMAC_RX_BUF_FULL_DROP_CNT_BIT 20 +#define CPU_MAC_GMAC_MON_W1_GMAC_RX_FILTER_DROP_CNT_BIT 24 +#define CPU_MAC_GMAC_MON_W1_GMAC_RX_PAUSE_DROP_CNT_BIT 28 +#define CPU_MAC_GMAC_MON_W1_GMAC_RX_RUNT_DROP_CNT_BIT 16 +#define CPU_MAC_GMAC_MON_W1_MON_RX_BUF_RD_STATE_BIT 2 +#define CPU_MAC_GMAC_MON_W1_MON_RX_PKT_LEN_BIT 8 +#define CPU_MAC_GMAC_MON_W1_MON_TX_LPI_STATUS_BIT 0 +#define CPU_MAC_GMAC_MON_W1_MON_TX_POP_STATE_BIT 5 +#define CPU_MAC_GMAC_MON_W1_MON_TX_STATS_UNDERRUN_BIT 1 -#define CPU_MAC_GMAC_MON_W0_MON_TX_LPI_STATE_MASK 0x000000c0 #define CPU_MAC_GMAC_MON_W0_MON_RX_METER_TOKEN_MASK 0xffffff00 #define CPU_MAC_GMAC_MON_W0_MON_RX_PKT_STATE_MASK 0x0000000f +#define CPU_MAC_GMAC_MON_W0_MON_TX_LPI_STATE_MASK 0x000000c0 #define CPU_MAC_GMAC_MON_W1_GMAC_RX_BUF_FULL_DROP_CNT_MASK 0x00f00000 #define CPU_MAC_GMAC_MON_W1_GMAC_RX_FILTER_DROP_CNT_MASK 0x0f000000 -#define CPU_MAC_GMAC_MON_W1_MON_TX_LPI_STATUS_MASK 0x00000001 +#define CPU_MAC_GMAC_MON_W1_GMAC_RX_PAUSE_DROP_CNT_MASK 0xf0000000 +#define CPU_MAC_GMAC_MON_W1_GMAC_RX_RUNT_DROP_CNT_MASK 0x000f0000 #define CPU_MAC_GMAC_MON_W1_MON_RX_BUF_RD_STATE_MASK 0x0000001c +#define CPU_MAC_GMAC_MON_W1_MON_RX_PKT_LEN_MASK 0x0000ff00 +#define CPU_MAC_GMAC_MON_W1_MON_TX_LPI_STATUS_MASK 0x00000001 #define CPU_MAC_GMAC_MON_W1_MON_TX_POP_STATE_MASK 0x000000e0 -#define CPU_MAC_GMAC_MON_W1_GMAC_RX_RUNT_DROP_CNT_MASK 0x000f0000 #define CPU_MAC_GMAC_MON_W1_MON_TX_STATS_UNDERRUN_MASK 0x00000002 -#define CPU_MAC_GMAC_MON_W1_MON_RX_PKT_LEN_MASK 0x0000ff00 -#define CPU_MAC_GMAC_MON_W1_GMAC_RX_PAUSE_DROP_CNT_MASK 0xf0000000 -/* cpu_mac_credit_ctl Definition */ -#define CPU_MAC_CREDIT_CTL_W0_CPU_MAC_CPU_RAM_CREDIT_THRD BIT(0) +/* ################################################################################ + * # CpuMacCreditCtl Definition */ +#define CPU_MAC_CREDIT_CTL_W0_CPU_MAC_CPU_RAM_CREDIT_THRD_BIT 0 #define CPU_MAC_CREDIT_CTL_W0_CPU_MAC_CPU_RAM_CREDIT_THRD_MASK 0x000000ff -/* cpu_mac_credit_status Definition */ -#define CPU_MAC_CREDIT_STATUS_W0_CPU_MAC_CPU_RAM_CREDIT_USED BIT(0) +/* ################################################################################ + * # CpuMacCreditStatus Definition */ +#define CPU_MAC_CREDIT_STATUS_W0_CPU_MAC_CPU_RAM_CREDIT_USED_BIT 0 #define CPU_MAC_CREDIT_STATUS_W0_CPU_MAC_CPU_RAM_CREDIT_USED_MASK 0x000000ff -/* cpu_mac_pause_cfg Definition */ -#define CPU_MAC_PAUSE_CFG_W0_CFG_RX_PAUSE_TIMER_ADJ_VALUE BIT(1) -#define CPU_MAC_PAUSE_CFG_W0_CFG_RX_NORM_PAUSE_EN BIT(0) -#define CPU_MAC_PAUSE_CFG_W0_CFG_RX_PAUSE_TIMER_DEC_VALUE BIT(11) -#define CPU_MAC_PAUSE_CFG_W1_CFG_TX_PAUSE_TIMER_ADJ_VALUE BIT(1) -#define CPU_MAC_PAUSE_CFG_W1_CFG_TX_PAUSE_TIMER_DEC_VALUE BIT(18) -#define CPU_MAC_PAUSE_CFG_W1_CFG_TX_PAUSE_EN BIT(0) -#define CPU_MAC_PAUSE_CFG_W2_CFG_TX_PAUSE_MAC_SA_31_0 BIT(0) -#define CPU_MAC_PAUSE_CFG_W3_CFG_TX_PAUSE_MAC_SA_47_32 BIT(0) -#define CPU_MAC_PAUSE_CFG_W3_CFG_TX_PAUSE_QUANTA BIT(16) +/* ################################################################################ + * # CpuMacPauseCfg Definition */ +#define CPU_MAC_PAUSE_CFG_W0_CFG_RX_NORM_PAUSE_EN_BIT 0 +#define CPU_MAC_PAUSE_CFG_W0_CFG_RX_PAUSE_TIMER_ADJ_VALUE_BIT 1 +#define CPU_MAC_PAUSE_CFG_W0_CFG_RX_PAUSE_TIMER_DEC_VALUE_BIT 11 +#define CPU_MAC_PAUSE_CFG_W1_CFG_TX_PAUSE_EN_BIT 0 +#define CPU_MAC_PAUSE_CFG_W1_CFG_TX_PAUSE_TIMER_ADJ_VALUE_BIT 1 +#define CPU_MAC_PAUSE_CFG_W1_CFG_TX_PAUSE_TIMER_DEC_VALUE_BIT 18 +#define CPU_MAC_PAUSE_CFG_W2_CFG_TX_PAUSE_MAC_SA_31_0_BIT 0 +#define CPU_MAC_PAUSE_CFG_W3_CFG_TX_PAUSE_MAC_SA_47_32_BIT 0 +#define CPU_MAC_PAUSE_CFG_W3_CFG_TX_PAUSE_QUANTA_BIT 16 -#define CPU_MAC_PAUSE_CFG_W0_CFG_RX_PAUSE_TIMER_ADJ_VALUE_MASK 0x000007fe #define CPU_MAC_PAUSE_CFG_W0_CFG_RX_NORM_PAUSE_EN_MASK 0x00000001 +#define CPU_MAC_PAUSE_CFG_W0_CFG_RX_PAUSE_TIMER_ADJ_VALUE_MASK 0x000007fe #define CPU_MAC_PAUSE_CFG_W0_CFG_RX_PAUSE_TIMER_DEC_VALUE_MASK 0x0007f800 +#define CPU_MAC_PAUSE_CFG_W1_CFG_TX_PAUSE_EN_MASK 0x00000001 #define CPU_MAC_PAUSE_CFG_W1_CFG_TX_PAUSE_TIMER_ADJ_VALUE_MASK 0x0003fffe #define CPU_MAC_PAUSE_CFG_W1_CFG_TX_PAUSE_TIMER_DEC_VALUE_MASK 0x03fc0000 -#define CPU_MAC_PAUSE_CFG_W1_CFG_TX_PAUSE_EN_MASK 0x00000001 -#define CPU_MAC_PAUSE_CFG_W2_CFG_TX_PAUSE_MAC_SA_31_0_MASK 0x00000001 -#define CPU_MAC_PAUSE_CFG_W3_CFG_TX_PAUSE_MAC_SA_47_32_MASK 0x00000001 +#define CPU_MAC_PAUSE_CFG_W2_CFG_TX_PAUSE_MAC_SA_31_0_MASK 0xffffffff +#define CPU_MAC_PAUSE_CFG_W3_CFG_TX_PAUSE_MAC_SA_47_32_MASK 0x0000ffff #define CPU_MAC_PAUSE_CFG_W3_CFG_TX_PAUSE_QUANTA_MASK 0xffff0000 -/* cpu_mac_pause_mon Definition */ -#define CPU_MAC_PAUSE_MON_W0_MON_TX_PAUSE_TIMER BIT(0) -#define CPU_MAC_PAUSE_MON_W1_MON_RX_PAUSE_TIMER BIT(0) -#define CPU_MAC_PAUSE_MON_W2_MON_TX_PAUSE_CUR_STATUS BIT(0) -#define CPU_MAC_PAUSE_MON_W2_MON_TX_PAUSE_LOG_STATUS BIT(1) +/* ################################################################################ + * # CpuMacPauseMon Definition */ +#define CPU_MAC_PAUSE_MON_W0_MON_TX_PAUSE_TIMER_BIT 0 +#define CPU_MAC_PAUSE_MON_W1_MON_RX_PAUSE_TIMER_BIT 0 +#define CPU_MAC_PAUSE_MON_W2_MON_TX_PAUSE_CUR_STATUS_BIT 0 +#define CPU_MAC_PAUSE_MON_W2_MON_TX_PAUSE_LOG_STATUS_BIT 1 #define CPU_MAC_PAUSE_MON_W0_MON_TX_PAUSE_TIMER_MASK 0x0001ffff #define CPU_MAC_PAUSE_MON_W1_MON_RX_PAUSE_TIMER_MASK 0x0000ffff #define CPU_MAC_PAUSE_MON_W2_MON_TX_PAUSE_CUR_STATUS_MASK 0x00000001 #define CPU_MAC_PAUSE_MON_W2_MON_TX_PAUSE_LOG_STATUS_MASK 0x00000002 -/* cpu_mac_sgmii_cfg Definition */ -#define CPU_MAC_SGMII_CFG_W0_CFG_TX_EVEN_IGNORE BIT(3) -#define CPU_MAC_SGMII_CFG_W0_CFG_TX_IPG_LEN BIT(14) -#define CPU_MAC_SGMII_CFG_W0_CFG_TX_PREAMBLE_LEN BIT(18) -#define CPU_MAC_SGMII_CFG_W0_CFG_UNIDIRECTION_EN BIT(4) -#define CPU_MAC_SGMII_CFG_W0_CFG_MII_RX_CHK_LINK_FOR_SOP BIT(31) -#define CPU_MAC_SGMII_CFG_W0_CFG_FORCE_RELOCK BIT(0) -#define CPU_MAC_SGMII_CFG_W0_CFG_FORCE_SIGNAL_DETECT BIT(1) -#define CPU_MAC_SGMII_CFG_W0_CFG_TX_REPLICATE_CNT BIT(22) -#define CPU_MAC_SGMII_CFG_W0_CFG_MII_RX_LINK_FILTER_TIMER BIT(6) -#define CPU_MAC_SGMII_CFG_W0_CFG_SIG_DET_ACTIVE_VALUE BIT(2) -#define CPU_MAC_SGMII_CFG_W0_CFG_MII_RX_LINK_FILTER_EN BIT(5) -#define CPU_MAC_SGMII_CFG_W1_CFG_MII_RX_SAMPLE_CNT BIT(22) -#define CPU_MAC_SGMII_CFG_W1_CFG_TX_THRESHOLD BIT(0) -#define CPU_MAC_SGMII_CFG_W1_CFG_MII_TX_A_FULL_THRD BIT(5) +/* ################################################################################ + * # CpuMacSgmiiCfg Definition */ +#define CPU_MAC_SGMII_CFG_W0_CFG_FORCE_RELOCK_BIT 0 +#define CPU_MAC_SGMII_CFG_W0_CFG_FORCE_SIGNAL_DETECT_BIT 1 +#define CPU_MAC_SGMII_CFG_W0_CFG_MII_RX_CHK_LINK_FOR_SOP_BIT 31 +#define CPU_MAC_SGMII_CFG_W0_CFG_MII_RX_LINK_FILTER_EN_BIT 5 +#define CPU_MAC_SGMII_CFG_W0_CFG_MII_RX_LINK_FILTER_TIMER_BIT 6 +#define CPU_MAC_SGMII_CFG_W0_CFG_SIG_DET_ACTIVE_VALUE_BIT 2 +#define CPU_MAC_SGMII_CFG_W0_CFG_TX_EVEN_IGNORE_BIT 3 +#define CPU_MAC_SGMII_CFG_W0_CFG_TX_IPG_LEN_BIT 14 +#define CPU_MAC_SGMII_CFG_W0_CFG_TX_PREAMBLE_LEN_BIT 18 +#define CPU_MAC_SGMII_CFG_W0_CFG_TX_REPLICATE_CNT_BIT 22 +#define CPU_MAC_SGMII_CFG_W0_CFG_UNIDIRECTION_EN_BIT 4 +#define CPU_MAC_SGMII_CFG_W1_CFG_MII_RX_SAMPLE_CNT_BIT 22 +#define CPU_MAC_SGMII_CFG_W1_CFG_MII_TX_A_FULL_THRD_BIT 5 +#define CPU_MAC_SGMII_CFG_W1_CFG_TX_THRESHOLD_BIT 0 -#define CPU_MAC_SGMII_CFG_W0_CFG_TX_EVEN_IGNORE_MASK 0x00000008 -#define CPU_MAC_SGMII_CFG_W0_CFG_TX_IPG_LEN_MASK 0x0003c000 -#define CPU_MAC_SGMII_CFG_W0_CFG_TX_PREAMBLE_LEN_MASK 0x003c0000 -#define CPU_MAC_SGMII_CFG_W0_CFG_UNIDIRECTION_EN_MASK 0x00000010 -#define CPU_MAC_SGMII_CFG_W0_CFG_MII_RX_CHK_LINK_FOR_SOP_MASK 0x80000000 #define CPU_MAC_SGMII_CFG_W0_CFG_FORCE_RELOCK_MASK 0x00000001 #define CPU_MAC_SGMII_CFG_W0_CFG_FORCE_SIGNAL_DETECT_MASK 0x00000002 -#define CPU_MAC_SGMII_CFG_W0_CFG_TX_REPLICATE_CNT_MASK 0x1fc00000 +#define CPU_MAC_SGMII_CFG_W0_CFG_MII_RX_CHK_LINK_FOR_SOP_MASK 0x80000000 +#define CPU_MAC_SGMII_CFG_W0_CFG_MII_RX_LINK_FILTER_EN_MASK 0x00000020 #define CPU_MAC_SGMII_CFG_W0_CFG_MII_RX_LINK_FILTER_TIMER_MASK 0x00003fc0 #define CPU_MAC_SGMII_CFG_W0_CFG_SIG_DET_ACTIVE_VALUE_MASK 0x00000004 -#define CPU_MAC_SGMII_CFG_W0_CFG_MII_RX_LINK_FILTER_EN_MASK 0x00000020 +#define CPU_MAC_SGMII_CFG_W0_CFG_TX_EVEN_IGNORE_MASK 0x00000008 +#define CPU_MAC_SGMII_CFG_W0_CFG_TX_IPG_LEN_MASK 0x0003c000 +#define CPU_MAC_SGMII_CFG_W0_CFG_TX_PREAMBLE_LEN_MASK 0x003c0000 +#define CPU_MAC_SGMII_CFG_W0_CFG_TX_REPLICATE_CNT_MASK 0x1fc00000 +#define CPU_MAC_SGMII_CFG_W0_CFG_UNIDIRECTION_EN_MASK 0x00000010 #define CPU_MAC_SGMII_CFG_W1_CFG_MII_RX_SAMPLE_CNT_MASK 0x1fc00000 -#define CPU_MAC_SGMII_CFG_W1_CFG_TX_THRESHOLD_MASK 0x0000001f #define CPU_MAC_SGMII_CFG_W1_CFG_MII_TX_A_FULL_THRD_MASK 0x000003e0 +#define CPU_MAC_SGMII_CFG_W1_CFG_TX_THRESHOLD_MASK 0x0000001f -/* cpu_mac_sgmii_mon Definition */ -#define CPU_MAC_SGMII_MON_W0_MON_SGMII_TX_CODE_STATE BIT(23) -#define CPU_MAC_SGMII_MON_W0_MON_SGMII_TX_SOP_FLAG BIT(18) -#define CPU_MAC_SGMII_MON_W0_MON_SGMII_TX_EOP_FLAG BIT(19) -#define CPU_MAC_SGMII_MON_W0_MON_SGMII_RX_EOP_FLAG BIT(9) -#define CPU_MAC_SGMII_MON_W0_MON_SGMII_RX_SFD_FLAG BIT(11) -#define CPU_MAC_SGMII_MON_W0_MON_SGMII_TX_LPI_STATE BIT(20) -#define CPU_MAC_SGMII_MON_W0_MON_SGMII_RX_LPI_STATE BIT(12) -#define CPU_MAC_SGMII_MON_W0_MON_SGMII_RX_PKT_STATE BIT(15) -#define CPU_MAC_SGMII_MON_W0_MON_ANEG_STATE BIT(0) -#define CPU_MAC_SGMII_MON_W0_MON_CODE_ERR_CNT BIT(4) -#define CPU_MAC_SGMII_MON_W0_MON_LINK_STATUS BIT(8) -#define CPU_MAC_SGMII_MON_W0_MON_SGMII_RX_SOP_FLAG BIT(10) -#define CPU_MAC_SGMII_MON_W1_MON_AN_RX_REMOTE_CFG BIT(0) +/* ################################################################################ + * # CpuMacSgmiiMon Definition */ +#define CPU_MAC_SGMII_MON_W0_MON_ANEG_STATE_BIT 0 +#define CPU_MAC_SGMII_MON_W0_MON_CODE_ERR_CNT_BIT 4 +#define CPU_MAC_SGMII_MON_W0_MON_LINK_STATUS_BIT 8 +#define CPU_MAC_SGMII_MON_W0_MON_SGMII_RX_EOP_FLAG_BIT 9 +#define CPU_MAC_SGMII_MON_W0_MON_SGMII_RX_LPI_STATE_BIT 12 +#define CPU_MAC_SGMII_MON_W0_MON_SGMII_RX_PKT_STATE_BIT 15 +#define CPU_MAC_SGMII_MON_W0_MON_SGMII_RX_SFD_FLAG_BIT 11 +#define CPU_MAC_SGMII_MON_W0_MON_SGMII_RX_SOP_FLAG_BIT 10 +#define CPU_MAC_SGMII_MON_W0_MON_SGMII_TX_CODE_STATE_BIT 23 +#define CPU_MAC_SGMII_MON_W0_MON_SGMII_TX_EOP_FLAG_BIT 19 +#define CPU_MAC_SGMII_MON_W0_MON_SGMII_TX_LPI_STATE_BIT 20 +#define CPU_MAC_SGMII_MON_W0_MON_SGMII_TX_SOP_FLAG_BIT 18 +#define CPU_MAC_SGMII_MON_W1_MON_AN_RX_REMOTE_CFG_BIT 0 -#define CPU_MAC_SGMII_MON_W0_MON_SGMII_TX_CODE_STATE_MASK 0x03800000 -#define CPU_MAC_SGMII_MON_W0_MON_SGMII_TX_SOP_FLAG_MASK 0x00040000 -#define CPU_MAC_SGMII_MON_W0_MON_SGMII_TX_EOP_FLAG_MASK 0x00080000 -#define CPU_MAC_SGMII_MON_W0_MON_SGMII_RX_EOP_FLAG_MASK 0x00000200 -#define CPU_MAC_SGMII_MON_W0_MON_SGMII_RX_SFD_FLAG_MASK 0x00000800 -#define CPU_MAC_SGMII_MON_W0_MON_SGMII_TX_LPI_STATE_MASK 0x00700000 -#define CPU_MAC_SGMII_MON_W0_MON_SGMII_RX_LPI_STATE_MASK 0x00007000 -#define CPU_MAC_SGMII_MON_W0_MON_SGMII_RX_PKT_STATE_MASK 0x00038000 #define CPU_MAC_SGMII_MON_W0_MON_ANEG_STATE_MASK 0x00000007 #define CPU_MAC_SGMII_MON_W0_MON_CODE_ERR_CNT_MASK 0x000000f0 #define CPU_MAC_SGMII_MON_W0_MON_LINK_STATUS_MASK 0x00000100 +#define CPU_MAC_SGMII_MON_W0_MON_SGMII_RX_EOP_FLAG_MASK 0x00000200 +#define CPU_MAC_SGMII_MON_W0_MON_SGMII_RX_LPI_STATE_MASK 0x00007000 +#define CPU_MAC_SGMII_MON_W0_MON_SGMII_RX_PKT_STATE_MASK 0x00038000 +#define CPU_MAC_SGMII_MON_W0_MON_SGMII_RX_SFD_FLAG_MASK 0x00000800 #define CPU_MAC_SGMII_MON_W0_MON_SGMII_RX_SOP_FLAG_MASK 0x00000400 +#define CPU_MAC_SGMII_MON_W0_MON_SGMII_TX_CODE_STATE_MASK 0x03800000 +#define CPU_MAC_SGMII_MON_W0_MON_SGMII_TX_EOP_FLAG_MASK 0x00080000 +#define CPU_MAC_SGMII_MON_W0_MON_SGMII_TX_LPI_STATE_MASK 0x00700000 +#define CPU_MAC_SGMII_MON_W0_MON_SGMII_TX_SOP_FLAG_MASK 0x00040000 #define CPU_MAC_SGMII_MON_W1_MON_AN_RX_REMOTE_CFG_MASK 0x0000ffff -/* cpu_mac_stats_cfg Definition */ -#define CPU_MAC_STATS_CFG_W0_CFG_GMAC_STATS64_B_PKT_HI_PRI BIT(4) -#define CPU_MAC_STATS_CFG_W0_CFG_GMAC_STATS_INCR_SATURATE BIT(1) -#define CPU_MAC_STATS_CFG_W0_CFG_GMAC_STATS_INCR_HOLD BIT(2) -#define CPU_MAC_STATS_CFG_W0_CFG_GMAC_STATS_CLEAR_ON_READ BIT(0) -#define CPU_MAC_STATS_CFG_W0_CFG_GMAC_STATS_OVER_WRITE_EN BIT(3) -#define CPU_MAC_STATS_CFG_W1_CFG_GMAC_STATS_MTU1 BIT(0) -#define CPU_MAC_STATS_CFG_W1_CFG_GMAC_STATS_MTU2 BIT(16) +/* ################################################################################ + * # CpuMacStatsCfg Definition */ +#define CPU_MAC_STATS_CFG_W0_CFG_GMAC_STATS64_B_PKT_HI_PRI_BIT 4 +#define CPU_MAC_STATS_CFG_W0_CFG_GMAC_STATS_CLEAR_ON_READ_BIT 0 +#define CPU_MAC_STATS_CFG_W0_CFG_GMAC_STATS_INCR_HOLD_BIT 2 +#define CPU_MAC_STATS_CFG_W0_CFG_GMAC_STATS_INCR_SATURATE_BIT 1 +#define CPU_MAC_STATS_CFG_W0_CFG_GMAC_STATS_OVER_WRITE_EN_BIT 3 +#define CPU_MAC_STATS_CFG_W1_CFG_GMAC_STATS_MTU1_BIT 0 +#define CPU_MAC_STATS_CFG_W1_CFG_GMAC_STATS_MTU2_BIT 16 #define CPU_MAC_STATS_CFG_W0_CFG_GMAC_STATS64_B_PKT_HI_PRI_MASK 0x00000010 -#define CPU_MAC_STATS_CFG_W0_CFG_GMAC_STATS_INCR_SATURATE_MASK 0x00000002 -#define CPU_MAC_STATS_CFG_W0_CFG_GMAC_STATS_INCR_HOLD_MASK 0x00000004 #define CPU_MAC_STATS_CFG_W0_CFG_GMAC_STATS_CLEAR_ON_READ_MASK 0x00000001 +#define CPU_MAC_STATS_CFG_W0_CFG_GMAC_STATS_INCR_HOLD_MASK 0x00000004 +#define CPU_MAC_STATS_CFG_W0_CFG_GMAC_STATS_INCR_SATURATE_MASK 0x00000002 #define CPU_MAC_STATS_CFG_W0_CFG_GMAC_STATS_OVER_WRITE_EN_MASK 0x00000008 #define CPU_MAC_STATS_CFG_W1_CFG_GMAC_STATS_MTU1_MASK 0x00003fff #define CPU_MAC_STATS_CFG_W1_CFG_GMAC_STATS_MTU2_MASK 0x3fff0000 -/* cpu_mac_interrupt_func Definition */ -#define CPU_MAC_INTERRUPT_FUNC_W0_VALUE_SET0_CPU_MAC_INTERRUPT_FUNC BIT(0) -#define CPU_MAC_INTERRUPT_FUNC_W1_VALUE_RESET0_CPU_MAC_INTERRUPT_FUNC BIT(0) -#define CPU_MAC_INTERRUPT_FUNC_W2_MASK_SET0_CPU_MAC_INTERRUPT_FUNC BIT(0) -#define CPU_MAC_INTERRUPT_FUNC_W3_MASK_RESET0_CPU_MAC_INTERRUPT_FUNC BIT(0) +/* ################################################################################ + * # CpuMacInterruptFunc Definition */ +#define CPU_MAC_INTERRUPT_FUNC_W0_VALUE_SET0_CPU_MAC_INTERRUPT_FUNC_BIT 0 +#define CPU_MAC_INTERRUPT_FUNC_W1_VALUE_RESET0_CPU_MAC_INTERRUPT_FUNC_BIT 0 +#define CPU_MAC_INTERRUPT_FUNC_W2_MASK_SET0_CPU_MAC_INTERRUPT_FUNC_BIT 0 +#define CPU_MAC_INTERRUPT_FUNC_W3_MASK_RESET0_CPU_MAC_INTERRUPT_FUNC_BIT 0 #define CPU_MAC_INTERRUPT_FUNC_W0_VALUE_SET0_CPU_MAC_INTERRUPT_FUNC_MASK 0x000000ff #define CPU_MAC_INTERRUPT_FUNC_W1_VALUE_RESET0_CPU_MAC_INTERRUPT_FUNC_MASK 0x000000ff #define CPU_MAC_INTERRUPT_FUNC_W2_MASK_SET0_CPU_MAC_INTERRUPT_FUNC_MASK 0x000000ff #define CPU_MAC_INTERRUPT_FUNC_W3_MASK_RESET0_CPU_MAC_INTERRUPT_FUNC_MASK 0x000000ff -/* cpu_mac_interrupt_normal Definition */ -#define CPU_MAC_INTERRUPT_NORMAL_W0_VALUE_SET0_CPU_MAC_INTERRUPT_NORMAL BIT(0) -#define CPU_MAC_INTERRUPT_NORMAL_W1_VALUE_RESET0_CPU_MAC_INTERRUPT_NORMAL BIT(0) -#define CPU_MAC_INTERRUPT_NORMAL_W2_MASK_SET0_CPU_MAC_INTERRUPT_NORMAL BIT(0) -#define CPU_MAC_INTERRUPT_NORMAL_W3_MASK_RESET0_CPU_MAC_INTERRUPT_NORMAL BIT(0) +/* ################################################################################ + * # CpuMacInterruptNormal Definition */ +#define CPU_MAC_INTERRUPT_NORMAL_W0_VALUE_SET0_CPU_MAC_INTERRUPT_NORMAL_BIT 0 +#define CPU_MAC_INTERRUPT_NORMAL_W1_VALUE_RESET0_CPU_MAC_INTERRUPT_NORMAL_BIT 0 +#define CPU_MAC_INTERRUPT_NORMAL_W2_MASK_SET0_CPU_MAC_INTERRUPT_NORMAL_BIT 0 +#define CPU_MAC_INTERRUPT_NORMAL_W3_MASK_RESET0_CPU_MAC_INTERRUPT_NORMAL_BIT 0 #define CPU_MAC_INTERRUPT_NORMAL_W0_VALUE_SET0_CPU_MAC_INTERRUPT_NORMAL_MASK 0xffffffff #define CPU_MAC_INTERRUPT_NORMAL_W1_VALUE_RESET0_CPU_MAC_INTERRUPT_NORMAL_MASK 0xffffffff #define CPU_MAC_INTERRUPT_NORMAL_W2_MASK_SET0_CPU_MAC_INTERRUPT_NORMAL_MASK 0xffffffff #define CPU_MAC_INTERRUPT_NORMAL_W3_MASK_RESET0_CPU_MAC_INTERRUPT_NORMAL_MASK 0xffffffff -/* cpu_mac_fifo_status Definition */ -#define CPU_MAC_FIFO_STATUS_W0_RX_PKT_MSG_FIFO_FIFO_DEPTH BIT(0) -#define CPU_MAC_FIFO_STATUS_W0_RX_PKT_DATA_FIFO_FIFO_DEPTH BIT(20) -#define CPU_MAC_FIFO_STATUS_W0_TX_DESC_ACK_FIFO_FIFO_DEPTH BIT(10) -#define CPU_MAC_FIFO_STATUS_W0_EXT_RAM_RD_TRACK_FIFO_FIFO_DEPTH BIT(16) -#define CPU_MAC_FIFO_STATUS_W1_RX_DESC0_ACK_FIFO_FIFO_DEPTH BIT(12) -#define CPU_MAC_FIFO_STATUS_W1_RX_DESC1_CFG_FIFO_FIFO_DEPTH BIT(18) -#define CPU_MAC_FIFO_STATUS_W1_RX_DESC0_CFG_FIFO_FIFO_DEPTH BIT(6) -#define CPU_MAC_FIFO_STATUS_W1_RX_DESC1_ACK_FIFO_FIFO_DEPTH BIT(24) -#define CPU_MAC_FIFO_STATUS_W1_TX_DESC_CFG_FIFO_FIFO_DEPTH BIT(0) -#define CPU_MAC_FIFO_STATUS_W2_TX_PKT_FIFO_FIFO_DEPTH BIT(16) -#define CPU_MAC_FIFO_STATUS_W2_RX_PKT_FIFO_FIFO_DEPTH BIT(0) +/* ################################################################################ + * # CpuMacFifoStatus Definition */ +#define CPU_MAC_FIFO_STATUS_W0_EXT_RAM_RD_TRACK_FIFO_FIFO_DEPTH_BIT 16 +#define CPU_MAC_FIFO_STATUS_W0_RX_PKT_DATA_FIFO_FIFO_DEPTH_BIT 20 +#define CPU_MAC_FIFO_STATUS_W0_RX_PKT_MSG_FIFO_FIFO_DEPTH_BIT 0 +#define CPU_MAC_FIFO_STATUS_W0_TX_DESC_ACK_FIFO_FIFO_DEPTH_BIT 10 +#define CPU_MAC_FIFO_STATUS_W1_RX_DESC0_ACK_FIFO_FIFO_DEPTH_BIT 12 +#define CPU_MAC_FIFO_STATUS_W1_RX_DESC0_CFG_FIFO_FIFO_DEPTH_BIT 6 +#define CPU_MAC_FIFO_STATUS_W1_RX_DESC1_ACK_FIFO_FIFO_DEPTH_BIT 24 +#define CPU_MAC_FIFO_STATUS_W1_RX_DESC1_CFG_FIFO_FIFO_DEPTH_BIT 18 +#define CPU_MAC_FIFO_STATUS_W1_TX_DESC_CFG_FIFO_FIFO_DEPTH_BIT 0 +#define CPU_MAC_FIFO_STATUS_W2_RX_PKT_FIFO_FIFO_DEPTH_BIT 0 +#define CPU_MAC_FIFO_STATUS_W2_TX_PKT_FIFO_FIFO_DEPTH_BIT 16 -#define CPU_MAC_FIFO_STATUS_W0_RX_PKT_MSG_FIFO_FIFO_DEPTH_MASK 0x000003ff +#define CPU_MAC_FIFO_STATUS_W0_EXT_RAM_RD_TRACK_FIFO_FIFO_DEPTH_MASK 0x000f0000 #define CPU_MAC_FIFO_STATUS_W0_RX_PKT_DATA_FIFO_FIFO_DEPTH_MASK 0xfff00000 +#define CPU_MAC_FIFO_STATUS_W0_RX_PKT_MSG_FIFO_FIFO_DEPTH_MASK 0x000003ff #define CPU_MAC_FIFO_STATUS_W0_TX_DESC_ACK_FIFO_FIFO_DEPTH_MASK 0x0000fc00 -#define CPU_MAC_FIFO_STATUS_W0_EXT_RAM_RD_TRACK_FIFO_FIFO_DEPTH_MASK 0x000f0000 #define CPU_MAC_FIFO_STATUS_W1_RX_DESC0_ACK_FIFO_FIFO_DEPTH_MASK 0x0003f000 -#define CPU_MAC_FIFO_STATUS_W1_RX_DESC1_CFG_FIFO_FIFO_DEPTH_MASK 0x00fc0000 #define CPU_MAC_FIFO_STATUS_W1_RX_DESC0_CFG_FIFO_FIFO_DEPTH_MASK 0x00000fc0 #define CPU_MAC_FIFO_STATUS_W1_RX_DESC1_ACK_FIFO_FIFO_DEPTH_MASK 0x3f000000 +#define CPU_MAC_FIFO_STATUS_W1_RX_DESC1_CFG_FIFO_FIFO_DEPTH_MASK 0x00fc0000 #define CPU_MAC_FIFO_STATUS_W1_TX_DESC_CFG_FIFO_FIFO_DEPTH_MASK 0x0000003f -#define CPU_MAC_FIFO_STATUS_W2_TX_PKT_FIFO_FIFO_DEPTH_MASK 0x03ff0000 #define CPU_MAC_FIFO_STATUS_W2_RX_PKT_FIFO_FIFO_DEPTH_MASK 0x000003ff +#define CPU_MAC_FIFO_STATUS_W2_TX_PKT_FIFO_FIFO_DEPTH_MASK 0x03ff0000 -struct cpu_mac_mems { - u32 tx_pkt_fifo_0[3]; /* 0x00004000 */ - u32 tx_pkt_fifo_0_rsv3; - u32 tx_pkt_fifo_1[3]; /* 0x00004010 */ - u32 tx_pkt_fifo_1_rsv3; - u32 tx_pkt_fifo_2[3]; /* 0x00004020 */ - u32 tx_pkt_fifo_2_rsv3; - u32 tx_pkt_fifo_3[3]; /* 0x00004030 */ - u32 tx_pkt_fifo_3_rsv3; - u32 tx_pkt_fifo_4[3]; /* 0x00004040 */ - u32 tx_pkt_fifo_4_rsv3; - u32 tx_pkt_fifo_5[3]; /* 0x00004050 */ - u32 tx_pkt_fifo_5_rsv3; - u32 tx_pkt_fifo_6[3]; /* 0x00004060 */ - u32 tx_pkt_fifo_6_rsv3; - u32 tx_pkt_fifo_7[3]; /* 0x00004070 */ - u32 tx_pkt_fifo_7_rsv3; - u32 tx_pkt_fifo_8[3]; /* 0x00004080 */ - u32 tx_pkt_fifo_8_rsv3; - u32 tx_pkt_fifo_9[3]; /* 0x00004090 */ - u32 tx_pkt_fifo_9_rsv3; - u32 tx_pkt_fifo_10[3]; /* 0x000040a0 */ - u32 tx_pkt_fifo_10_rsv3; - u32 tx_pkt_fifo_11[3]; /* 0x000040b0 */ - u32 tx_pkt_fifo_11_rsv3; - u32 tx_pkt_fifo_12[3]; /* 0x000040c0 */ - u32 tx_pkt_fifo_12_rsv3; - u32 tx_pkt_fifo_13[3]; /* 0x000040d0 */ - u32 tx_pkt_fifo_13_rsv3; - u32 tx_pkt_fifo_14[3]; /* 0x000040e0 */ - u32 tx_pkt_fifo_14_rsv3; - u32 tx_pkt_fifo_15[3]; /* 0x000040f0 */ - u32 tx_pkt_fifo_15_rsv3; - u32 tx_pkt_fifo_16[3]; /* 0x00004100 */ - u32 tx_pkt_fifo_16_rsv3; - u32 tx_pkt_fifo_17[3]; /* 0x00004110 */ - u32 tx_pkt_fifo_17_rsv3; - u32 tx_pkt_fifo_18[3]; /* 0x00004120 */ - u32 tx_pkt_fifo_18_rsv3; - u32 tx_pkt_fifo_19[3]; /* 0x00004130 */ - u32 tx_pkt_fifo_19_rsv3; - u32 tx_pkt_fifo_20[3]; /* 0x00004140 */ - u32 tx_pkt_fifo_20_rsv3; - u32 tx_pkt_fifo_21[3]; /* 0x00004150 */ - u32 tx_pkt_fifo_21_rsv3; - u32 tx_pkt_fifo_22[3]; /* 0x00004160 */ - u32 tx_pkt_fifo_22_rsv3; - u32 tx_pkt_fifo_23[3]; /* 0x00004170 */ - u32 tx_pkt_fifo_23_rsv3; - u32 tx_pkt_fifo_24[3]; /* 0x00004180 */ - u32 tx_pkt_fifo_24_rsv3; - u32 tx_pkt_fifo_25[3]; /* 0x00004190 */ - u32 tx_pkt_fifo_25_rsv3; - u32 tx_pkt_fifo_26[3]; /* 0x000041a0 */ - u32 tx_pkt_fifo_26_rsv3; - u32 tx_pkt_fifo_27[3]; /* 0x000041b0 */ - u32 tx_pkt_fifo_27_rsv3; - u32 tx_pkt_fifo_28[3]; /* 0x000041c0 */ - u32 tx_pkt_fifo_28_rsv3; - u32 tx_pkt_fifo_29[3]; /* 0x000041d0 */ - u32 tx_pkt_fifo_29_rsv3; - u32 tx_pkt_fifo_30[3]; /* 0x000041e0 */ - u32 tx_pkt_fifo_30_rsv3; - u32 tx_pkt_fifo_31[3]; /* 0x000041f0 */ - u32 tx_pkt_fifo_31_rsv3; - u32 tx_pkt_fifo_32[3]; /* 0x00004200 */ - u32 tx_pkt_fifo_32_rsv3; - u32 tx_pkt_fifo_33[3]; /* 0x00004210 */ - u32 tx_pkt_fifo_33_rsv3; - u32 tx_pkt_fifo_34[3]; /* 0x00004220 */ - u32 tx_pkt_fifo_34_rsv3; - u32 tx_pkt_fifo_35[3]; /* 0x00004230 */ - u32 tx_pkt_fifo_35_rsv3; - u32 tx_pkt_fifo_36[3]; /* 0x00004240 */ - u32 tx_pkt_fifo_36_rsv3; - u32 tx_pkt_fifo_37[3]; /* 0x00004250 */ - u32 tx_pkt_fifo_37_rsv3; - u32 tx_pkt_fifo_38[3]; /* 0x00004260 */ - u32 tx_pkt_fifo_38_rsv3; - u32 tx_pkt_fifo_39[3]; /* 0x00004270 */ - u32 tx_pkt_fifo_39_rsv3; - u32 tx_pkt_fifo_40[3]; /* 0x00004280 */ - u32 tx_pkt_fifo_40_rsv3; - u32 tx_pkt_fifo_41[3]; /* 0x00004290 */ - u32 tx_pkt_fifo_41_rsv3; - u32 tx_pkt_fifo_42[3]; /* 0x000042a0 */ - u32 tx_pkt_fifo_42_rsv3; - u32 tx_pkt_fifo_43[3]; /* 0x000042b0 */ - u32 tx_pkt_fifo_43_rsv3; - u32 tx_pkt_fifo_44[3]; /* 0x000042c0 */ - u32 tx_pkt_fifo_44_rsv3; - u32 tx_pkt_fifo_45[3]; /* 0x000042d0 */ - u32 tx_pkt_fifo_45_rsv3; - u32 tx_pkt_fifo_46[3]; /* 0x000042e0 */ - u32 tx_pkt_fifo_46_rsv3; - u32 tx_pkt_fifo_47[3]; /* 0x000042f0 */ - u32 tx_pkt_fifo_47_rsv3; - u32 tx_pkt_fifo_48[3]; /* 0x00004300 */ - u32 tx_pkt_fifo_48_rsv3; - u32 tx_pkt_fifo_49[3]; /* 0x00004310 */ - u32 tx_pkt_fifo_49_rsv3; - u32 tx_pkt_fifo_50[3]; /* 0x00004320 */ - u32 tx_pkt_fifo_50_rsv3; - u32 tx_pkt_fifo_51[3]; /* 0x00004330 */ - u32 tx_pkt_fifo_51_rsv3; - u32 tx_pkt_fifo_52[3]; /* 0x00004340 */ - u32 tx_pkt_fifo_52_rsv3; - u32 tx_pkt_fifo_53[3]; /* 0x00004350 */ - u32 tx_pkt_fifo_53_rsv3; - u32 tx_pkt_fifo_54[3]; /* 0x00004360 */ - u32 tx_pkt_fifo_54_rsv3; - u32 tx_pkt_fifo_55[3]; /* 0x00004370 */ - u32 tx_pkt_fifo_55_rsv3; - u32 tx_pkt_fifo_56[3]; /* 0x00004380 */ - u32 tx_pkt_fifo_56_rsv3; - u32 tx_pkt_fifo_57[3]; /* 0x00004390 */ - u32 tx_pkt_fifo_57_rsv3; - u32 tx_pkt_fifo_58[3]; /* 0x000043a0 */ - u32 tx_pkt_fifo_58_rsv3; - u32 tx_pkt_fifo_59[3]; /* 0x000043b0 */ - u32 tx_pkt_fifo_59_rsv3; - u32 tx_pkt_fifo_60[3]; /* 0x000043c0 */ - u32 tx_pkt_fifo_60_rsv3; - u32 tx_pkt_fifo_61[3]; /* 0x000043d0 */ - u32 tx_pkt_fifo_61_rsv3; - u32 tx_pkt_fifo_62[3]; /* 0x000043e0 */ - u32 tx_pkt_fifo_62_rsv3; - u32 tx_pkt_fifo_63[3]; /* 0x000043f0 */ - u32 tx_pkt_fifo_63_rsv3; - u32 tx_pkt_fifo_64[3]; /* 0x00004400 */ - u32 tx_pkt_fifo_64_rsv3; - u32 tx_pkt_fifo_65[3]; /* 0x00004410 */ - u32 tx_pkt_fifo_65_rsv3; - u32 tx_pkt_fifo_66[3]; /* 0x00004420 */ - u32 tx_pkt_fifo_66_rsv3; - u32 tx_pkt_fifo_67[3]; /* 0x00004430 */ - u32 tx_pkt_fifo_67_rsv3; - u32 tx_pkt_fifo_68[3]; /* 0x00004440 */ - u32 tx_pkt_fifo_68_rsv3; - u32 tx_pkt_fifo_69[3]; /* 0x00004450 */ - u32 tx_pkt_fifo_69_rsv3; - u32 tx_pkt_fifo_70[3]; /* 0x00004460 */ - u32 tx_pkt_fifo_70_rsv3; - u32 tx_pkt_fifo_71[3]; /* 0x00004470 */ - u32 tx_pkt_fifo_71_rsv3; - u32 tx_pkt_fifo_72[3]; /* 0x00004480 */ - u32 tx_pkt_fifo_72_rsv3; - u32 tx_pkt_fifo_73[3]; /* 0x00004490 */ - u32 tx_pkt_fifo_73_rsv3; - u32 tx_pkt_fifo_74[3]; /* 0x000044a0 */ - u32 tx_pkt_fifo_74_rsv3; - u32 tx_pkt_fifo_75[3]; /* 0x000044b0 */ - u32 tx_pkt_fifo_75_rsv3; - u32 tx_pkt_fifo_76[3]; /* 0x000044c0 */ - u32 tx_pkt_fifo_76_rsv3; - u32 tx_pkt_fifo_77[3]; /* 0x000044d0 */ - u32 tx_pkt_fifo_77_rsv3; - u32 tx_pkt_fifo_78[3]; /* 0x000044e0 */ - u32 tx_pkt_fifo_78_rsv3; - u32 tx_pkt_fifo_79[3]; /* 0x000044f0 */ - u32 tx_pkt_fifo_79_rsv3; - u32 tx_pkt_fifo_80[3]; /* 0x00004500 */ - u32 tx_pkt_fifo_80_rsv3; - u32 tx_pkt_fifo_81[3]; /* 0x00004510 */ - u32 tx_pkt_fifo_81_rsv3; - u32 tx_pkt_fifo_82[3]; /* 0x00004520 */ - u32 tx_pkt_fifo_82_rsv3; - u32 tx_pkt_fifo_83[3]; /* 0x00004530 */ - u32 tx_pkt_fifo_83_rsv3; - u32 tx_pkt_fifo_84[3]; /* 0x00004540 */ - u32 tx_pkt_fifo_84_rsv3; - u32 tx_pkt_fifo_85[3]; /* 0x00004550 */ - u32 tx_pkt_fifo_85_rsv3; - u32 tx_pkt_fifo_86[3]; /* 0x00004560 */ - u32 tx_pkt_fifo_86_rsv3; - u32 tx_pkt_fifo_87[3]; /* 0x00004570 */ - u32 tx_pkt_fifo_87_rsv3; - u32 tx_pkt_fifo_88[3]; /* 0x00004580 */ - u32 tx_pkt_fifo_88_rsv3; - u32 tx_pkt_fifo_89[3]; /* 0x00004590 */ - u32 tx_pkt_fifo_89_rsv3; - u32 tx_pkt_fifo_90[3]; /* 0x000045a0 */ - u32 tx_pkt_fifo_90_rsv3; - u32 tx_pkt_fifo_91[3]; /* 0x000045b0 */ - u32 tx_pkt_fifo_91_rsv3; - u32 tx_pkt_fifo_92[3]; /* 0x000045c0 */ - u32 tx_pkt_fifo_92_rsv3; - u32 tx_pkt_fifo_93[3]; /* 0x000045d0 */ - u32 tx_pkt_fifo_93_rsv3; - u32 tx_pkt_fifo_94[3]; /* 0x000045e0 */ - u32 tx_pkt_fifo_94_rsv3; - u32 tx_pkt_fifo_95[3]; /* 0x000045f0 */ - u32 tx_pkt_fifo_95_rsv3; - u32 tx_pkt_fifo_96[3]; /* 0x00004600 */ - u32 tx_pkt_fifo_96_rsv3; - u32 tx_pkt_fifo_97[3]; /* 0x00004610 */ - u32 tx_pkt_fifo_97_rsv3; - u32 tx_pkt_fifo_98[3]; /* 0x00004620 */ - u32 tx_pkt_fifo_98_rsv3; - u32 tx_pkt_fifo_99[3]; /* 0x00004630 */ - u32 tx_pkt_fifo_99_rsv3; - u32 tx_pkt_fifo_100[3]; /* 0x00004640 */ - u32 tx_pkt_fifo_100_rsv3; - u32 tx_pkt_fifo_101[3]; /* 0x00004650 */ - u32 tx_pkt_fifo_101_rsv3; - u32 tx_pkt_fifo_102[3]; /* 0x00004660 */ - u32 tx_pkt_fifo_102_rsv3; - u32 tx_pkt_fifo_103[3]; /* 0x00004670 */ - u32 tx_pkt_fifo_103_rsv3; - u32 tx_pkt_fifo_104[3]; /* 0x00004680 */ - u32 tx_pkt_fifo_104_rsv3; - u32 tx_pkt_fifo_105[3]; /* 0x00004690 */ - u32 tx_pkt_fifo_105_rsv3; - u32 tx_pkt_fifo_106[3]; /* 0x000046a0 */ - u32 tx_pkt_fifo_106_rsv3; - u32 tx_pkt_fifo_107[3]; /* 0x000046b0 */ - u32 tx_pkt_fifo_107_rsv3; - u32 tx_pkt_fifo_108[3]; /* 0x000046c0 */ - u32 tx_pkt_fifo_108_rsv3; - u32 tx_pkt_fifo_109[3]; /* 0x000046d0 */ - u32 tx_pkt_fifo_109_rsv3; - u32 tx_pkt_fifo_110[3]; /* 0x000046e0 */ - u32 tx_pkt_fifo_110_rsv3; - u32 tx_pkt_fifo_111[3]; /* 0x000046f0 */ - u32 tx_pkt_fifo_111_rsv3; - u32 tx_pkt_fifo_112[3]; /* 0x00004700 */ - u32 tx_pkt_fifo_112_rsv3; - u32 tx_pkt_fifo_113[3]; /* 0x00004710 */ - u32 tx_pkt_fifo_113_rsv3; - u32 tx_pkt_fifo_114[3]; /* 0x00004720 */ - u32 tx_pkt_fifo_114_rsv3; - u32 tx_pkt_fifo_115[3]; /* 0x00004730 */ - u32 tx_pkt_fifo_115_rsv3; - u32 tx_pkt_fifo_116[3]; /* 0x00004740 */ - u32 tx_pkt_fifo_116_rsv3; - u32 tx_pkt_fifo_117[3]; /* 0x00004750 */ - u32 tx_pkt_fifo_117_rsv3; - u32 tx_pkt_fifo_118[3]; /* 0x00004760 */ - u32 tx_pkt_fifo_118_rsv3; - u32 tx_pkt_fifo_119[3]; /* 0x00004770 */ - u32 tx_pkt_fifo_119_rsv3; - u32 tx_pkt_fifo_120[3]; /* 0x00004780 */ - u32 tx_pkt_fifo_120_rsv3; - u32 tx_pkt_fifo_121[3]; /* 0x00004790 */ - u32 tx_pkt_fifo_121_rsv3; - u32 tx_pkt_fifo_122[3]; /* 0x000047a0 */ - u32 tx_pkt_fifo_122_rsv3; - u32 tx_pkt_fifo_123[3]; /* 0x000047b0 */ - u32 tx_pkt_fifo_123_rsv3; - u32 tx_pkt_fifo_124[3]; /* 0x000047c0 */ - u32 tx_pkt_fifo_124_rsv3; - u32 tx_pkt_fifo_125[3]; /* 0x000047d0 */ - u32 tx_pkt_fifo_125_rsv3; - u32 tx_pkt_fifo_126[3]; /* 0x000047e0 */ - u32 tx_pkt_fifo_126_rsv3; - u32 tx_pkt_fifo_127[3]; /* 0x000047f0 */ - u32 tx_pkt_fifo_127_rsv3; - u32 tx_pkt_fifo_128[3]; /* 0x00004800 */ - u32 tx_pkt_fifo_128_rsv3; - u32 tx_pkt_fifo_129[3]; /* 0x00004810 */ - u32 tx_pkt_fifo_129_rsv3; - u32 tx_pkt_fifo_130[3]; /* 0x00004820 */ - u32 tx_pkt_fifo_130_rsv3; - u32 tx_pkt_fifo_131[3]; /* 0x00004830 */ - u32 tx_pkt_fifo_131_rsv3; - u32 tx_pkt_fifo_132[3]; /* 0x00004840 */ - u32 tx_pkt_fifo_132_rsv3; - u32 tx_pkt_fifo_133[3]; /* 0x00004850 */ - u32 tx_pkt_fifo_133_rsv3; - u32 tx_pkt_fifo_134[3]; /* 0x00004860 */ - u32 tx_pkt_fifo_134_rsv3; - u32 tx_pkt_fifo_135[3]; /* 0x00004870 */ - u32 tx_pkt_fifo_135_rsv3; - u32 tx_pkt_fifo_136[3]; /* 0x00004880 */ - u32 tx_pkt_fifo_136_rsv3; - u32 tx_pkt_fifo_137[3]; /* 0x00004890 */ - u32 tx_pkt_fifo_137_rsv3; - u32 tx_pkt_fifo_138[3]; /* 0x000048a0 */ - u32 tx_pkt_fifo_138_rsv3; - u32 tx_pkt_fifo_139[3]; /* 0x000048b0 */ - u32 tx_pkt_fifo_139_rsv3; - u32 tx_pkt_fifo_140[3]; /* 0x000048c0 */ - u32 tx_pkt_fifo_140_rsv3; - u32 tx_pkt_fifo_141[3]; /* 0x000048d0 */ - u32 tx_pkt_fifo_141_rsv3; - u32 tx_pkt_fifo_142[3]; /* 0x000048e0 */ - u32 tx_pkt_fifo_142_rsv3; - u32 tx_pkt_fifo_143[3]; /* 0x000048f0 */ - u32 tx_pkt_fifo_143_rsv3; - u32 tx_pkt_fifo_144[3]; /* 0x00004900 */ - u32 tx_pkt_fifo_144_rsv3; - u32 tx_pkt_fifo_145[3]; /* 0x00004910 */ - u32 tx_pkt_fifo_145_rsv3; - u32 tx_pkt_fifo_146[3]; /* 0x00004920 */ - u32 tx_pkt_fifo_146_rsv3; - u32 tx_pkt_fifo_147[3]; /* 0x00004930 */ - u32 tx_pkt_fifo_147_rsv3; - u32 tx_pkt_fifo_148[3]; /* 0x00004940 */ - u32 tx_pkt_fifo_148_rsv3; - u32 tx_pkt_fifo_149[3]; /* 0x00004950 */ - u32 tx_pkt_fifo_149_rsv3; - u32 tx_pkt_fifo_150[3]; /* 0x00004960 */ - u32 tx_pkt_fifo_150_rsv3; - u32 tx_pkt_fifo_151[3]; /* 0x00004970 */ - u32 tx_pkt_fifo_151_rsv3; - u32 tx_pkt_fifo_152[3]; /* 0x00004980 */ - u32 tx_pkt_fifo_152_rsv3; - u32 tx_pkt_fifo_153[3]; /* 0x00004990 */ - u32 tx_pkt_fifo_153_rsv3; - u32 tx_pkt_fifo_154[3]; /* 0x000049a0 */ - u32 tx_pkt_fifo_154_rsv3; - u32 tx_pkt_fifo_155[3]; /* 0x000049b0 */ - u32 tx_pkt_fifo_155_rsv3; - u32 tx_pkt_fifo_156[3]; /* 0x000049c0 */ - u32 tx_pkt_fifo_156_rsv3; - u32 tx_pkt_fifo_157[3]; /* 0x000049d0 */ - u32 tx_pkt_fifo_157_rsv3; - u32 tx_pkt_fifo_158[3]; /* 0x000049e0 */ - u32 tx_pkt_fifo_158_rsv3; - u32 tx_pkt_fifo_159[3]; /* 0x000049f0 */ - u32 tx_pkt_fifo_159_rsv3; - u32 tx_pkt_fifo_160[3]; /* 0x00004a00 */ - u32 tx_pkt_fifo_160_rsv3; - u32 tx_pkt_fifo_161[3]; /* 0x00004a10 */ - u32 tx_pkt_fifo_161_rsv3; - u32 tx_pkt_fifo_162[3]; /* 0x00004a20 */ - u32 tx_pkt_fifo_162_rsv3; - u32 tx_pkt_fifo_163[3]; /* 0x00004a30 */ - u32 tx_pkt_fifo_163_rsv3; - u32 tx_pkt_fifo_164[3]; /* 0x00004a40 */ - u32 tx_pkt_fifo_164_rsv3; - u32 tx_pkt_fifo_165[3]; /* 0x00004a50 */ - u32 tx_pkt_fifo_165_rsv3; - u32 tx_pkt_fifo_166[3]; /* 0x00004a60 */ - u32 tx_pkt_fifo_166_rsv3; - u32 tx_pkt_fifo_167[3]; /* 0x00004a70 */ - u32 tx_pkt_fifo_167_rsv3; - u32 tx_pkt_fifo_168[3]; /* 0x00004a80 */ - u32 tx_pkt_fifo_168_rsv3; - u32 tx_pkt_fifo_169[3]; /* 0x00004a90 */ - u32 tx_pkt_fifo_169_rsv3; - u32 tx_pkt_fifo_170[3]; /* 0x00004aa0 */ - u32 tx_pkt_fifo_170_rsv3; - u32 tx_pkt_fifo_171[3]; /* 0x00004ab0 */ - u32 tx_pkt_fifo_171_rsv3; - u32 tx_pkt_fifo_172[3]; /* 0x00004ac0 */ - u32 tx_pkt_fifo_172_rsv3; - u32 tx_pkt_fifo_173[3]; /* 0x00004ad0 */ - u32 tx_pkt_fifo_173_rsv3; - u32 tx_pkt_fifo_174[3]; /* 0x00004ae0 */ - u32 tx_pkt_fifo_174_rsv3; - u32 tx_pkt_fifo_175[3]; /* 0x00004af0 */ - u32 tx_pkt_fifo_175_rsv3; - u32 tx_pkt_fifo_176[3]; /* 0x00004b00 */ - u32 tx_pkt_fifo_176_rsv3; - u32 tx_pkt_fifo_177[3]; /* 0x00004b10 */ - u32 tx_pkt_fifo_177_rsv3; - u32 tx_pkt_fifo_178[3]; /* 0x00004b20 */ - u32 tx_pkt_fifo_178_rsv3; - u32 tx_pkt_fifo_179[3]; /* 0x00004b30 */ - u32 tx_pkt_fifo_179_rsv3; - u32 tx_pkt_fifo_180[3]; /* 0x00004b40 */ - u32 tx_pkt_fifo_180_rsv3; - u32 tx_pkt_fifo_181[3]; /* 0x00004b50 */ - u32 tx_pkt_fifo_181_rsv3; - u32 tx_pkt_fifo_182[3]; /* 0x00004b60 */ - u32 tx_pkt_fifo_182_rsv3; - u32 tx_pkt_fifo_183[3]; /* 0x00004b70 */ - u32 tx_pkt_fifo_183_rsv3; - u32 tx_pkt_fifo_184[3]; /* 0x00004b80 */ - u32 tx_pkt_fifo_184_rsv3; - u32 tx_pkt_fifo_185[3]; /* 0x00004b90 */ - u32 tx_pkt_fifo_185_rsv3; - u32 tx_pkt_fifo_186[3]; /* 0x00004ba0 */ - u32 tx_pkt_fifo_186_rsv3; - u32 tx_pkt_fifo_187[3]; /* 0x00004bb0 */ - u32 tx_pkt_fifo_187_rsv3; - u32 tx_pkt_fifo_188[3]; /* 0x00004bc0 */ - u32 tx_pkt_fifo_188_rsv3; - u32 tx_pkt_fifo_189[3]; /* 0x00004bd0 */ - u32 tx_pkt_fifo_189_rsv3; - u32 tx_pkt_fifo_190[3]; /* 0x00004be0 */ - u32 tx_pkt_fifo_190_rsv3; - u32 tx_pkt_fifo_191[3]; /* 0x00004bf0 */ - u32 tx_pkt_fifo_191_rsv3; - u32 tx_pkt_fifo_192[3]; /* 0x00004c00 */ - u32 tx_pkt_fifo_192_rsv3; - u32 tx_pkt_fifo_193[3]; /* 0x00004c10 */ - u32 tx_pkt_fifo_193_rsv3; - u32 tx_pkt_fifo_194[3]; /* 0x00004c20 */ - u32 tx_pkt_fifo_194_rsv3; - u32 tx_pkt_fifo_195[3]; /* 0x00004c30 */ - u32 tx_pkt_fifo_195_rsv3; - u32 tx_pkt_fifo_196[3]; /* 0x00004c40 */ - u32 tx_pkt_fifo_196_rsv3; - u32 tx_pkt_fifo_197[3]; /* 0x00004c50 */ - u32 tx_pkt_fifo_197_rsv3; - u32 tx_pkt_fifo_198[3]; /* 0x00004c60 */ - u32 tx_pkt_fifo_198_rsv3; - u32 tx_pkt_fifo_199[3]; /* 0x00004c70 */ - u32 tx_pkt_fifo_199_rsv3; - u32 tx_pkt_fifo_200[3]; /* 0x00004c80 */ - u32 tx_pkt_fifo_200_rsv3; - u32 tx_pkt_fifo_201[3]; /* 0x00004c90 */ - u32 tx_pkt_fifo_201_rsv3; - u32 tx_pkt_fifo_202[3]; /* 0x00004ca0 */ - u32 tx_pkt_fifo_202_rsv3; - u32 tx_pkt_fifo_203[3]; /* 0x00004cb0 */ - u32 tx_pkt_fifo_203_rsv3; - u32 tx_pkt_fifo_204[3]; /* 0x00004cc0 */ - u32 tx_pkt_fifo_204_rsv3; - u32 tx_pkt_fifo_205[3]; /* 0x00004cd0 */ - u32 tx_pkt_fifo_205_rsv3; - u32 tx_pkt_fifo_206[3]; /* 0x00004ce0 */ - u32 tx_pkt_fifo_206_rsv3; - u32 tx_pkt_fifo_207[3]; /* 0x00004cf0 */ - u32 tx_pkt_fifo_207_rsv3; - u32 tx_pkt_fifo_208[3]; /* 0x00004d00 */ - u32 tx_pkt_fifo_208_rsv3; - u32 tx_pkt_fifo_209[3]; /* 0x00004d10 */ - u32 tx_pkt_fifo_209_rsv3; - u32 tx_pkt_fifo_210[3]; /* 0x00004d20 */ - u32 tx_pkt_fifo_210_rsv3; - u32 tx_pkt_fifo_211[3]; /* 0x00004d30 */ - u32 tx_pkt_fifo_211_rsv3; - u32 tx_pkt_fifo_212[3]; /* 0x00004d40 */ - u32 tx_pkt_fifo_212_rsv3; - u32 tx_pkt_fifo_213[3]; /* 0x00004d50 */ - u32 tx_pkt_fifo_213_rsv3; - u32 tx_pkt_fifo_214[3]; /* 0x00004d60 */ - u32 tx_pkt_fifo_214_rsv3; - u32 tx_pkt_fifo_215[3]; /* 0x00004d70 */ - u32 tx_pkt_fifo_215_rsv3; - u32 tx_pkt_fifo_216[3]; /* 0x00004d80 */ - u32 tx_pkt_fifo_216_rsv3; - u32 tx_pkt_fifo_217[3]; /* 0x00004d90 */ - u32 tx_pkt_fifo_217_rsv3; - u32 tx_pkt_fifo_218[3]; /* 0x00004da0 */ - u32 tx_pkt_fifo_218_rsv3; - u32 tx_pkt_fifo_219[3]; /* 0x00004db0 */ - u32 tx_pkt_fifo_219_rsv3; - u32 tx_pkt_fifo_220[3]; /* 0x00004dc0 */ - u32 tx_pkt_fifo_220_rsv3; - u32 tx_pkt_fifo_221[3]; /* 0x00004dd0 */ - u32 tx_pkt_fifo_221_rsv3; - u32 tx_pkt_fifo_222[3]; /* 0x00004de0 */ - u32 tx_pkt_fifo_222_rsv3; - u32 tx_pkt_fifo_223[3]; /* 0x00004df0 */ - u32 tx_pkt_fifo_223_rsv3; - u32 tx_pkt_fifo_224[3]; /* 0x00004e00 */ - u32 tx_pkt_fifo_224_rsv3; - u32 tx_pkt_fifo_225[3]; /* 0x00004e10 */ - u32 tx_pkt_fifo_225_rsv3; - u32 tx_pkt_fifo_226[3]; /* 0x00004e20 */ - u32 tx_pkt_fifo_226_rsv3; - u32 tx_pkt_fifo_227[3]; /* 0x00004e30 */ - u32 tx_pkt_fifo_227_rsv3; - u32 tx_pkt_fifo_228[3]; /* 0x00004e40 */ - u32 tx_pkt_fifo_228_rsv3; - u32 tx_pkt_fifo_229[3]; /* 0x00004e50 */ - u32 tx_pkt_fifo_229_rsv3; - u32 tx_pkt_fifo_230[3]; /* 0x00004e60 */ - u32 tx_pkt_fifo_230_rsv3; - u32 tx_pkt_fifo_231[3]; /* 0x00004e70 */ - u32 tx_pkt_fifo_231_rsv3; - u32 tx_pkt_fifo_232[3]; /* 0x00004e80 */ - u32 tx_pkt_fifo_232_rsv3; - u32 tx_pkt_fifo_233[3]; /* 0x00004e90 */ - u32 tx_pkt_fifo_233_rsv3; - u32 tx_pkt_fifo_234[3]; /* 0x00004ea0 */ - u32 tx_pkt_fifo_234_rsv3; - u32 tx_pkt_fifo_235[3]; /* 0x00004eb0 */ - u32 tx_pkt_fifo_235_rsv3; - u32 tx_pkt_fifo_236[3]; /* 0x00004ec0 */ - u32 tx_pkt_fifo_236_rsv3; - u32 tx_pkt_fifo_237[3]; /* 0x00004ed0 */ - u32 tx_pkt_fifo_237_rsv3; - u32 tx_pkt_fifo_238[3]; /* 0x00004ee0 */ - u32 tx_pkt_fifo_238_rsv3; - u32 tx_pkt_fifo_239[3]; /* 0x00004ef0 */ - u32 tx_pkt_fifo_239_rsv3; - u32 tx_pkt_fifo_240[3]; /* 0x00004f00 */ - u32 tx_pkt_fifo_240_rsv3; - u32 tx_pkt_fifo_241[3]; /* 0x00004f10 */ - u32 tx_pkt_fifo_241_rsv3; - u32 tx_pkt_fifo_242[3]; /* 0x00004f20 */ - u32 tx_pkt_fifo_242_rsv3; - u32 tx_pkt_fifo_243[3]; /* 0x00004f30 */ - u32 tx_pkt_fifo_243_rsv3; - u32 tx_pkt_fifo_244[3]; /* 0x00004f40 */ - u32 tx_pkt_fifo_244_rsv3; - u32 tx_pkt_fifo_245[3]; /* 0x00004f50 */ - u32 tx_pkt_fifo_245_rsv3; - u32 tx_pkt_fifo_246[3]; /* 0x00004f60 */ - u32 tx_pkt_fifo_246_rsv3; - u32 tx_pkt_fifo_247[3]; /* 0x00004f70 */ - u32 tx_pkt_fifo_247_rsv3; - u32 tx_pkt_fifo_248[3]; /* 0x00004f80 */ - u32 tx_pkt_fifo_248_rsv3; - u32 tx_pkt_fifo_249[3]; /* 0x00004f90 */ - u32 tx_pkt_fifo_249_rsv3; - u32 tx_pkt_fifo_250[3]; /* 0x00004fa0 */ - u32 tx_pkt_fifo_250_rsv3; - u32 tx_pkt_fifo_251[3]; /* 0x00004fb0 */ - u32 tx_pkt_fifo_251_rsv3; - u32 tx_pkt_fifo_252[3]; /* 0x00004fc0 */ - u32 tx_pkt_fifo_252_rsv3; - u32 tx_pkt_fifo_253[3]; /* 0x00004fd0 */ - u32 tx_pkt_fifo_253_rsv3; - u32 tx_pkt_fifo_254[3]; /* 0x00004fe0 */ - u32 tx_pkt_fifo_254_rsv3; - u32 tx_pkt_fifo_255[3]; /* 0x00004ff0 */ - u32 tx_pkt_fifo_255_rsv3; - u32 tx_pkt_fifo_256[3]; /* 0x00005000 */ - u32 tx_pkt_fifo_256_rsv3; - u32 tx_pkt_fifo_257[3]; /* 0x00005010 */ - u32 tx_pkt_fifo_257_rsv3; - u32 tx_pkt_fifo_258[3]; /* 0x00005020 */ - u32 tx_pkt_fifo_258_rsv3; - u32 tx_pkt_fifo_259[3]; /* 0x00005030 */ - u32 tx_pkt_fifo_259_rsv3; - u32 tx_pkt_fifo_260[3]; /* 0x00005040 */ - u32 tx_pkt_fifo_260_rsv3; - u32 tx_pkt_fifo_261[3]; /* 0x00005050 */ - u32 tx_pkt_fifo_261_rsv3; - u32 tx_pkt_fifo_262[3]; /* 0x00005060 */ - u32 tx_pkt_fifo_262_rsv3; - u32 tx_pkt_fifo_263[3]; /* 0x00005070 */ - u32 tx_pkt_fifo_263_rsv3; - u32 tx_pkt_fifo_264[3]; /* 0x00005080 */ - u32 tx_pkt_fifo_264_rsv3; - u32 tx_pkt_fifo_265[3]; /* 0x00005090 */ - u32 tx_pkt_fifo_265_rsv3; - u32 tx_pkt_fifo_266[3]; /* 0x000050a0 */ - u32 tx_pkt_fifo_266_rsv3; - u32 tx_pkt_fifo_267[3]; /* 0x000050b0 */ - u32 tx_pkt_fifo_267_rsv3; - u32 tx_pkt_fifo_268[3]; /* 0x000050c0 */ - u32 tx_pkt_fifo_268_rsv3; - u32 tx_pkt_fifo_269[3]; /* 0x000050d0 */ - u32 tx_pkt_fifo_269_rsv3; - u32 tx_pkt_fifo_270[3]; /* 0x000050e0 */ - u32 tx_pkt_fifo_270_rsv3; - u32 tx_pkt_fifo_271[3]; /* 0x000050f0 */ - u32 tx_pkt_fifo_271_rsv3; - u32 tx_pkt_fifo_272[3]; /* 0x00005100 */ - u32 tx_pkt_fifo_272_rsv3; - u32 tx_pkt_fifo_273[3]; /* 0x00005110 */ - u32 tx_pkt_fifo_273_rsv3; - u32 tx_pkt_fifo_274[3]; /* 0x00005120 */ - u32 tx_pkt_fifo_274_rsv3; - u32 tx_pkt_fifo_275[3]; /* 0x00005130 */ - u32 tx_pkt_fifo_275_rsv3; - u32 tx_pkt_fifo_276[3]; /* 0x00005140 */ - u32 tx_pkt_fifo_276_rsv3; - u32 tx_pkt_fifo_277[3]; /* 0x00005150 */ - u32 tx_pkt_fifo_277_rsv3; - u32 tx_pkt_fifo_278[3]; /* 0x00005160 */ - u32 tx_pkt_fifo_278_rsv3; - u32 tx_pkt_fifo_279[3]; /* 0x00005170 */ - u32 tx_pkt_fifo_279_rsv3; - u32 tx_pkt_fifo_280[3]; /* 0x00005180 */ - u32 tx_pkt_fifo_280_rsv3; - u32 tx_pkt_fifo_281[3]; /* 0x00005190 */ - u32 tx_pkt_fifo_281_rsv3; - u32 tx_pkt_fifo_282[3]; /* 0x000051a0 */ - u32 tx_pkt_fifo_282_rsv3; - u32 tx_pkt_fifo_283[3]; /* 0x000051b0 */ - u32 tx_pkt_fifo_283_rsv3; - u32 tx_pkt_fifo_284[3]; /* 0x000051c0 */ - u32 tx_pkt_fifo_284_rsv3; - u32 tx_pkt_fifo_285[3]; /* 0x000051d0 */ - u32 tx_pkt_fifo_285_rsv3; - u32 tx_pkt_fifo_286[3]; /* 0x000051e0 */ - u32 tx_pkt_fifo_286_rsv3; - u32 tx_pkt_fifo_287[3]; /* 0x000051f0 */ - u32 tx_pkt_fifo_287_rsv3; - u32 tx_pkt_fifo_288[3]; /* 0x00005200 */ - u32 tx_pkt_fifo_288_rsv3; - u32 tx_pkt_fifo_289[3]; /* 0x00005210 */ - u32 tx_pkt_fifo_289_rsv3; - u32 tx_pkt_fifo_290[3]; /* 0x00005220 */ - u32 tx_pkt_fifo_290_rsv3; - u32 tx_pkt_fifo_291[3]; /* 0x00005230 */ - u32 tx_pkt_fifo_291_rsv3; - u32 tx_pkt_fifo_292[3]; /* 0x00005240 */ - u32 tx_pkt_fifo_292_rsv3; - u32 tx_pkt_fifo_293[3]; /* 0x00005250 */ - u32 tx_pkt_fifo_293_rsv3; - u32 tx_pkt_fifo_294[3]; /* 0x00005260 */ - u32 tx_pkt_fifo_294_rsv3; - u32 tx_pkt_fifo_295[3]; /* 0x00005270 */ - u32 tx_pkt_fifo_295_rsv3; - u32 tx_pkt_fifo_296[3]; /* 0x00005280 */ - u32 tx_pkt_fifo_296_rsv3; - u32 tx_pkt_fifo_297[3]; /* 0x00005290 */ - u32 tx_pkt_fifo_297_rsv3; - u32 tx_pkt_fifo_298[3]; /* 0x000052a0 */ - u32 tx_pkt_fifo_298_rsv3; - u32 tx_pkt_fifo_299[3]; /* 0x000052b0 */ - u32 tx_pkt_fifo_299_rsv3; - u32 tx_pkt_fifo_300[3]; /* 0x000052c0 */ - u32 tx_pkt_fifo_300_rsv3; - u32 tx_pkt_fifo_301[3]; /* 0x000052d0 */ - u32 tx_pkt_fifo_301_rsv3; - u32 tx_pkt_fifo_302[3]; /* 0x000052e0 */ - u32 tx_pkt_fifo_302_rsv3; - u32 tx_pkt_fifo_303[3]; /* 0x000052f0 */ - u32 tx_pkt_fifo_303_rsv3; - u32 tx_pkt_fifo_304[3]; /* 0x00005300 */ - u32 tx_pkt_fifo_304_rsv3; - u32 tx_pkt_fifo_305[3]; /* 0x00005310 */ - u32 tx_pkt_fifo_305_rsv3; - u32 tx_pkt_fifo_306[3]; /* 0x00005320 */ - u32 tx_pkt_fifo_306_rsv3; - u32 tx_pkt_fifo_307[3]; /* 0x00005330 */ - u32 tx_pkt_fifo_307_rsv3; - u32 tx_pkt_fifo_308[3]; /* 0x00005340 */ - u32 tx_pkt_fifo_308_rsv3; - u32 tx_pkt_fifo_309[3]; /* 0x00005350 */ - u32 tx_pkt_fifo_309_rsv3; - u32 tx_pkt_fifo_310[3]; /* 0x00005360 */ - u32 tx_pkt_fifo_310_rsv3; - u32 tx_pkt_fifo_311[3]; /* 0x00005370 */ - u32 tx_pkt_fifo_311_rsv3; - u32 tx_pkt_fifo_312[3]; /* 0x00005380 */ - u32 tx_pkt_fifo_312_rsv3; - u32 tx_pkt_fifo_313[3]; /* 0x00005390 */ - u32 tx_pkt_fifo_313_rsv3; - u32 tx_pkt_fifo_314[3]; /* 0x000053a0 */ - u32 tx_pkt_fifo_314_rsv3; - u32 tx_pkt_fifo_315[3]; /* 0x000053b0 */ - u32 tx_pkt_fifo_315_rsv3; - u32 tx_pkt_fifo_316[3]; /* 0x000053c0 */ - u32 tx_pkt_fifo_316_rsv3; - u32 tx_pkt_fifo_317[3]; /* 0x000053d0 */ - u32 tx_pkt_fifo_317_rsv3; - u32 tx_pkt_fifo_318[3]; /* 0x000053e0 */ - u32 tx_pkt_fifo_318_rsv3; - u32 tx_pkt_fifo_319[3]; /* 0x000053f0 */ - u32 tx_pkt_fifo_319_rsv3; - u32 tx_pkt_fifo_320[3]; /* 0x00005400 */ - u32 tx_pkt_fifo_320_rsv3; - u32 tx_pkt_fifo_321[3]; /* 0x00005410 */ - u32 tx_pkt_fifo_321_rsv3; - u32 tx_pkt_fifo_322[3]; /* 0x00005420 */ - u32 tx_pkt_fifo_322_rsv3; - u32 tx_pkt_fifo_323[3]; /* 0x00005430 */ - u32 tx_pkt_fifo_323_rsv3; - u32 tx_pkt_fifo_324[3]; /* 0x00005440 */ - u32 tx_pkt_fifo_324_rsv3; - u32 tx_pkt_fifo_325[3]; /* 0x00005450 */ - u32 tx_pkt_fifo_325_rsv3; - u32 tx_pkt_fifo_326[3]; /* 0x00005460 */ - u32 tx_pkt_fifo_326_rsv3; - u32 tx_pkt_fifo_327[3]; /* 0x00005470 */ - u32 tx_pkt_fifo_327_rsv3; - u32 tx_pkt_fifo_328[3]; /* 0x00005480 */ - u32 tx_pkt_fifo_328_rsv3; - u32 tx_pkt_fifo_329[3]; /* 0x00005490 */ - u32 tx_pkt_fifo_329_rsv3; - u32 tx_pkt_fifo_330[3]; /* 0x000054a0 */ - u32 tx_pkt_fifo_330_rsv3; - u32 tx_pkt_fifo_331[3]; /* 0x000054b0 */ - u32 tx_pkt_fifo_331_rsv3; - u32 tx_pkt_fifo_332[3]; /* 0x000054c0 */ - u32 tx_pkt_fifo_332_rsv3; - u32 tx_pkt_fifo_333[3]; /* 0x000054d0 */ - u32 tx_pkt_fifo_333_rsv3; - u32 tx_pkt_fifo_334[3]; /* 0x000054e0 */ - u32 tx_pkt_fifo_334_rsv3; - u32 tx_pkt_fifo_335[3]; /* 0x000054f0 */ - u32 tx_pkt_fifo_335_rsv3; - u32 tx_pkt_fifo_336[3]; /* 0x00005500 */ - u32 tx_pkt_fifo_336_rsv3; - u32 tx_pkt_fifo_337[3]; /* 0x00005510 */ - u32 tx_pkt_fifo_337_rsv3; - u32 tx_pkt_fifo_338[3]; /* 0x00005520 */ - u32 tx_pkt_fifo_338_rsv3; - u32 tx_pkt_fifo_339[3]; /* 0x00005530 */ - u32 tx_pkt_fifo_339_rsv3; - u32 tx_pkt_fifo_340[3]; /* 0x00005540 */ - u32 tx_pkt_fifo_340_rsv3; - u32 tx_pkt_fifo_341[3]; /* 0x00005550 */ - u32 tx_pkt_fifo_341_rsv3; - u32 tx_pkt_fifo_342[3]; /* 0x00005560 */ - u32 tx_pkt_fifo_342_rsv3; - u32 tx_pkt_fifo_343[3]; /* 0x00005570 */ - u32 tx_pkt_fifo_343_rsv3; - u32 tx_pkt_fifo_344[3]; /* 0x00005580 */ - u32 tx_pkt_fifo_344_rsv3; - u32 tx_pkt_fifo_345[3]; /* 0x00005590 */ - u32 tx_pkt_fifo_345_rsv3; - u32 tx_pkt_fifo_346[3]; /* 0x000055a0 */ - u32 tx_pkt_fifo_346_rsv3; - u32 tx_pkt_fifo_347[3]; /* 0x000055b0 */ - u32 tx_pkt_fifo_347_rsv3; - u32 tx_pkt_fifo_348[3]; /* 0x000055c0 */ - u32 tx_pkt_fifo_348_rsv3; - u32 tx_pkt_fifo_349[3]; /* 0x000055d0 */ - u32 tx_pkt_fifo_349_rsv3; - u32 tx_pkt_fifo_350[3]; /* 0x000055e0 */ - u32 tx_pkt_fifo_350_rsv3; - u32 tx_pkt_fifo_351[3]; /* 0x000055f0 */ - u32 tx_pkt_fifo_351_rsv3; - u32 tx_pkt_fifo_352[3]; /* 0x00005600 */ - u32 tx_pkt_fifo_352_rsv3; - u32 tx_pkt_fifo_353[3]; /* 0x00005610 */ - u32 tx_pkt_fifo_353_rsv3; - u32 tx_pkt_fifo_354[3]; /* 0x00005620 */ - u32 tx_pkt_fifo_354_rsv3; - u32 tx_pkt_fifo_355[3]; /* 0x00005630 */ - u32 tx_pkt_fifo_355_rsv3; - u32 tx_pkt_fifo_356[3]; /* 0x00005640 */ - u32 tx_pkt_fifo_356_rsv3; - u32 tx_pkt_fifo_357[3]; /* 0x00005650 */ - u32 tx_pkt_fifo_357_rsv3; - u32 tx_pkt_fifo_358[3]; /* 0x00005660 */ - u32 tx_pkt_fifo_358_rsv3; - u32 tx_pkt_fifo_359[3]; /* 0x00005670 */ - u32 tx_pkt_fifo_359_rsv3; - u32 tx_pkt_fifo_360[3]; /* 0x00005680 */ - u32 tx_pkt_fifo_360_rsv3; - u32 tx_pkt_fifo_361[3]; /* 0x00005690 */ - u32 tx_pkt_fifo_361_rsv3; - u32 tx_pkt_fifo_362[3]; /* 0x000056a0 */ - u32 tx_pkt_fifo_362_rsv3; - u32 tx_pkt_fifo_363[3]; /* 0x000056b0 */ - u32 tx_pkt_fifo_363_rsv3; - u32 tx_pkt_fifo_364[3]; /* 0x000056c0 */ - u32 tx_pkt_fifo_364_rsv3; - u32 tx_pkt_fifo_365[3]; /* 0x000056d0 */ - u32 tx_pkt_fifo_365_rsv3; - u32 tx_pkt_fifo_366[3]; /* 0x000056e0 */ - u32 tx_pkt_fifo_366_rsv3; - u32 tx_pkt_fifo_367[3]; /* 0x000056f0 */ - u32 tx_pkt_fifo_367_rsv3; - u32 tx_pkt_fifo_368[3]; /* 0x00005700 */ - u32 tx_pkt_fifo_368_rsv3; - u32 tx_pkt_fifo_369[3]; /* 0x00005710 */ - u32 tx_pkt_fifo_369_rsv3; - u32 tx_pkt_fifo_370[3]; /* 0x00005720 */ - u32 tx_pkt_fifo_370_rsv3; - u32 tx_pkt_fifo_371[3]; /* 0x00005730 */ - u32 tx_pkt_fifo_371_rsv3; - u32 tx_pkt_fifo_372[3]; /* 0x00005740 */ - u32 tx_pkt_fifo_372_rsv3; - u32 tx_pkt_fifo_373[3]; /* 0x00005750 */ - u32 tx_pkt_fifo_373_rsv3; - u32 tx_pkt_fifo_374[3]; /* 0x00005760 */ - u32 tx_pkt_fifo_374_rsv3; - u32 tx_pkt_fifo_375[3]; /* 0x00005770 */ - u32 tx_pkt_fifo_375_rsv3; - u32 tx_pkt_fifo_376[3]; /* 0x00005780 */ - u32 tx_pkt_fifo_376_rsv3; - u32 tx_pkt_fifo_377[3]; /* 0x00005790 */ - u32 tx_pkt_fifo_377_rsv3; - u32 tx_pkt_fifo_378[3]; /* 0x000057a0 */ - u32 tx_pkt_fifo_378_rsv3; - u32 tx_pkt_fifo_379[3]; /* 0x000057b0 */ - u32 tx_pkt_fifo_379_rsv3; - u32 tx_pkt_fifo_380[3]; /* 0x000057c0 */ - u32 tx_pkt_fifo_380_rsv3; - u32 tx_pkt_fifo_381[3]; /* 0x000057d0 */ - u32 tx_pkt_fifo_381_rsv3; - u32 tx_pkt_fifo_382[3]; /* 0x000057e0 */ - u32 tx_pkt_fifo_382_rsv3; - u32 tx_pkt_fifo_383[3]; /* 0x000057f0 */ - u32 tx_pkt_fifo_383_rsv3; - u32 tx_pkt_fifo_384[3]; /* 0x00005800 */ - u32 tx_pkt_fifo_384_rsv3; - u32 tx_pkt_fifo_385[3]; /* 0x00005810 */ - u32 tx_pkt_fifo_385_rsv3; - u32 tx_pkt_fifo_386[3]; /* 0x00005820 */ - u32 tx_pkt_fifo_386_rsv3; - u32 tx_pkt_fifo_387[3]; /* 0x00005830 */ - u32 tx_pkt_fifo_387_rsv3; - u32 tx_pkt_fifo_388[3]; /* 0x00005840 */ - u32 tx_pkt_fifo_388_rsv3; - u32 tx_pkt_fifo_389[3]; /* 0x00005850 */ - u32 tx_pkt_fifo_389_rsv3; - u32 tx_pkt_fifo_390[3]; /* 0x00005860 */ - u32 tx_pkt_fifo_390_rsv3; - u32 tx_pkt_fifo_391[3]; /* 0x00005870 */ - u32 tx_pkt_fifo_391_rsv3; - u32 tx_pkt_fifo_392[3]; /* 0x00005880 */ - u32 tx_pkt_fifo_392_rsv3; - u32 tx_pkt_fifo_393[3]; /* 0x00005890 */ - u32 tx_pkt_fifo_393_rsv3; - u32 tx_pkt_fifo_394[3]; /* 0x000058a0 */ - u32 tx_pkt_fifo_394_rsv3; - u32 tx_pkt_fifo_395[3]; /* 0x000058b0 */ - u32 tx_pkt_fifo_395_rsv3; - u32 tx_pkt_fifo_396[3]; /* 0x000058c0 */ - u32 tx_pkt_fifo_396_rsv3; - u32 tx_pkt_fifo_397[3]; /* 0x000058d0 */ - u32 tx_pkt_fifo_397_rsv3; - u32 tx_pkt_fifo_398[3]; /* 0x000058e0 */ - u32 tx_pkt_fifo_398_rsv3; - u32 tx_pkt_fifo_399[3]; /* 0x000058f0 */ - u32 tx_pkt_fifo_399_rsv3; - u32 tx_pkt_fifo_400[3]; /* 0x00005900 */ - u32 tx_pkt_fifo_400_rsv3; - u32 tx_pkt_fifo_401[3]; /* 0x00005910 */ - u32 tx_pkt_fifo_401_rsv3; - u32 tx_pkt_fifo_402[3]; /* 0x00005920 */ - u32 tx_pkt_fifo_402_rsv3; - u32 tx_pkt_fifo_403[3]; /* 0x00005930 */ - u32 tx_pkt_fifo_403_rsv3; - u32 tx_pkt_fifo_404[3]; /* 0x00005940 */ - u32 tx_pkt_fifo_404_rsv3; - u32 tx_pkt_fifo_405[3]; /* 0x00005950 */ - u32 tx_pkt_fifo_405_rsv3; - u32 tx_pkt_fifo_406[3]; /* 0x00005960 */ - u32 tx_pkt_fifo_406_rsv3; - u32 tx_pkt_fifo_407[3]; /* 0x00005970 */ - u32 tx_pkt_fifo_407_rsv3; - u32 tx_pkt_fifo_408[3]; /* 0x00005980 */ - u32 tx_pkt_fifo_408_rsv3; - u32 tx_pkt_fifo_409[3]; /* 0x00005990 */ - u32 tx_pkt_fifo_409_rsv3; - u32 tx_pkt_fifo_410[3]; /* 0x000059a0 */ - u32 tx_pkt_fifo_410_rsv3; - u32 tx_pkt_fifo_411[3]; /* 0x000059b0 */ - u32 tx_pkt_fifo_411_rsv3; - u32 tx_pkt_fifo_412[3]; /* 0x000059c0 */ - u32 tx_pkt_fifo_412_rsv3; - u32 tx_pkt_fifo_413[3]; /* 0x000059d0 */ - u32 tx_pkt_fifo_413_rsv3; - u32 tx_pkt_fifo_414[3]; /* 0x000059e0 */ - u32 tx_pkt_fifo_414_rsv3; - u32 tx_pkt_fifo_415[3]; /* 0x000059f0 */ - u32 tx_pkt_fifo_415_rsv3; - u32 tx_pkt_fifo_416[3]; /* 0x00005a00 */ - u32 tx_pkt_fifo_416_rsv3; - u32 tx_pkt_fifo_417[3]; /* 0x00005a10 */ - u32 tx_pkt_fifo_417_rsv3; - u32 tx_pkt_fifo_418[3]; /* 0x00005a20 */ - u32 tx_pkt_fifo_418_rsv3; - u32 tx_pkt_fifo_419[3]; /* 0x00005a30 */ - u32 tx_pkt_fifo_419_rsv3; - u32 tx_pkt_fifo_420[3]; /* 0x00005a40 */ - u32 tx_pkt_fifo_420_rsv3; - u32 tx_pkt_fifo_421[3]; /* 0x00005a50 */ - u32 tx_pkt_fifo_421_rsv3; - u32 tx_pkt_fifo_422[3]; /* 0x00005a60 */ - u32 tx_pkt_fifo_422_rsv3; - u32 tx_pkt_fifo_423[3]; /* 0x00005a70 */ - u32 tx_pkt_fifo_423_rsv3; - u32 tx_pkt_fifo_424[3]; /* 0x00005a80 */ - u32 tx_pkt_fifo_424_rsv3; - u32 tx_pkt_fifo_425[3]; /* 0x00005a90 */ - u32 tx_pkt_fifo_425_rsv3; - u32 tx_pkt_fifo_426[3]; /* 0x00005aa0 */ - u32 tx_pkt_fifo_426_rsv3; - u32 tx_pkt_fifo_427[3]; /* 0x00005ab0 */ - u32 tx_pkt_fifo_427_rsv3; - u32 tx_pkt_fifo_428[3]; /* 0x00005ac0 */ - u32 tx_pkt_fifo_428_rsv3; - u32 tx_pkt_fifo_429[3]; /* 0x00005ad0 */ - u32 tx_pkt_fifo_429_rsv3; - u32 tx_pkt_fifo_430[3]; /* 0x00005ae0 */ - u32 tx_pkt_fifo_430_rsv3; - u32 tx_pkt_fifo_431[3]; /* 0x00005af0 */ - u32 tx_pkt_fifo_431_rsv3; - u32 tx_pkt_fifo_432[3]; /* 0x00005b00 */ - u32 tx_pkt_fifo_432_rsv3; - u32 tx_pkt_fifo_433[3]; /* 0x00005b10 */ - u32 tx_pkt_fifo_433_rsv3; - u32 tx_pkt_fifo_434[3]; /* 0x00005b20 */ - u32 tx_pkt_fifo_434_rsv3; - u32 tx_pkt_fifo_435[3]; /* 0x00005b30 */ - u32 tx_pkt_fifo_435_rsv3; - u32 tx_pkt_fifo_436[3]; /* 0x00005b40 */ - u32 tx_pkt_fifo_436_rsv3; - u32 tx_pkt_fifo_437[3]; /* 0x00005b50 */ - u32 tx_pkt_fifo_437_rsv3; - u32 tx_pkt_fifo_438[3]; /* 0x00005b60 */ - u32 tx_pkt_fifo_438_rsv3; - u32 tx_pkt_fifo_439[3]; /* 0x00005b70 */ - u32 tx_pkt_fifo_439_rsv3; - u32 tx_pkt_fifo_440[3]; /* 0x00005b80 */ - u32 tx_pkt_fifo_440_rsv3; - u32 tx_pkt_fifo_441[3]; /* 0x00005b90 */ - u32 tx_pkt_fifo_441_rsv3; - u32 tx_pkt_fifo_442[3]; /* 0x00005ba0 */ - u32 tx_pkt_fifo_442_rsv3; - u32 tx_pkt_fifo_443[3]; /* 0x00005bb0 */ - u32 tx_pkt_fifo_443_rsv3; - u32 tx_pkt_fifo_444[3]; /* 0x00005bc0 */ - u32 tx_pkt_fifo_444_rsv3; - u32 tx_pkt_fifo_445[3]; /* 0x00005bd0 */ - u32 tx_pkt_fifo_445_rsv3; - u32 tx_pkt_fifo_446[3]; /* 0x00005be0 */ - u32 tx_pkt_fifo_446_rsv3; - u32 tx_pkt_fifo_447[3]; /* 0x00005bf0 */ - u32 tx_pkt_fifo_447_rsv3; - u32 tx_pkt_fifo_448[3]; /* 0x00005c00 */ - u32 tx_pkt_fifo_448_rsv3; - u32 tx_pkt_fifo_449[3]; /* 0x00005c10 */ - u32 tx_pkt_fifo_449_rsv3; - u32 tx_pkt_fifo_450[3]; /* 0x00005c20 */ - u32 tx_pkt_fifo_450_rsv3; - u32 tx_pkt_fifo_451[3]; /* 0x00005c30 */ - u32 tx_pkt_fifo_451_rsv3; - u32 tx_pkt_fifo_452[3]; /* 0x00005c40 */ - u32 tx_pkt_fifo_452_rsv3; - u32 tx_pkt_fifo_453[3]; /* 0x00005c50 */ - u32 tx_pkt_fifo_453_rsv3; - u32 tx_pkt_fifo_454[3]; /* 0x00005c60 */ - u32 tx_pkt_fifo_454_rsv3; - u32 tx_pkt_fifo_455[3]; /* 0x00005c70 */ - u32 tx_pkt_fifo_455_rsv3; - u32 tx_pkt_fifo_456[3]; /* 0x00005c80 */ - u32 tx_pkt_fifo_456_rsv3; - u32 tx_pkt_fifo_457[3]; /* 0x00005c90 */ - u32 tx_pkt_fifo_457_rsv3; - u32 tx_pkt_fifo_458[3]; /* 0x00005ca0 */ - u32 tx_pkt_fifo_458_rsv3; - u32 tx_pkt_fifo_459[3]; /* 0x00005cb0 */ - u32 tx_pkt_fifo_459_rsv3; - u32 tx_pkt_fifo_460[3]; /* 0x00005cc0 */ - u32 tx_pkt_fifo_460_rsv3; - u32 tx_pkt_fifo_461[3]; /* 0x00005cd0 */ - u32 tx_pkt_fifo_461_rsv3; - u32 tx_pkt_fifo_462[3]; /* 0x00005ce0 */ - u32 tx_pkt_fifo_462_rsv3; - u32 tx_pkt_fifo_463[3]; /* 0x00005cf0 */ - u32 tx_pkt_fifo_463_rsv3; - u32 tx_pkt_fifo_464[3]; /* 0x00005d00 */ - u32 tx_pkt_fifo_464_rsv3; - u32 tx_pkt_fifo_465[3]; /* 0x00005d10 */ - u32 tx_pkt_fifo_465_rsv3; - u32 tx_pkt_fifo_466[3]; /* 0x00005d20 */ - u32 tx_pkt_fifo_466_rsv3; - u32 tx_pkt_fifo_467[3]; /* 0x00005d30 */ - u32 tx_pkt_fifo_467_rsv3; - u32 tx_pkt_fifo_468[3]; /* 0x00005d40 */ - u32 tx_pkt_fifo_468_rsv3; - u32 tx_pkt_fifo_469[3]; /* 0x00005d50 */ - u32 tx_pkt_fifo_469_rsv3; - u32 tx_pkt_fifo_470[3]; /* 0x00005d60 */ - u32 tx_pkt_fifo_470_rsv3; - u32 tx_pkt_fifo_471[3]; /* 0x00005d70 */ - u32 tx_pkt_fifo_471_rsv3; - u32 tx_pkt_fifo_472[3]; /* 0x00005d80 */ - u32 tx_pkt_fifo_472_rsv3; - u32 tx_pkt_fifo_473[3]; /* 0x00005d90 */ - u32 tx_pkt_fifo_473_rsv3; - u32 tx_pkt_fifo_474[3]; /* 0x00005da0 */ - u32 tx_pkt_fifo_474_rsv3; - u32 tx_pkt_fifo_475[3]; /* 0x00005db0 */ - u32 tx_pkt_fifo_475_rsv3; - u32 tx_pkt_fifo_476[3]; /* 0x00005dc0 */ - u32 tx_pkt_fifo_476_rsv3; - u32 tx_pkt_fifo_477[3]; /* 0x00005dd0 */ - u32 tx_pkt_fifo_477_rsv3; - u32 tx_pkt_fifo_478[3]; /* 0x00005de0 */ - u32 tx_pkt_fifo_478_rsv3; - u32 tx_pkt_fifo_479[3]; /* 0x00005df0 */ - u32 tx_pkt_fifo_479_rsv3; - u32 tx_pkt_fifo_480[3]; /* 0x00005e00 */ - u32 tx_pkt_fifo_480_rsv3; - u32 tx_pkt_fifo_481[3]; /* 0x00005e10 */ - u32 tx_pkt_fifo_481_rsv3; - u32 tx_pkt_fifo_482[3]; /* 0x00005e20 */ - u32 tx_pkt_fifo_482_rsv3; - u32 tx_pkt_fifo_483[3]; /* 0x00005e30 */ - u32 tx_pkt_fifo_483_rsv3; - u32 tx_pkt_fifo_484[3]; /* 0x00005e40 */ - u32 tx_pkt_fifo_484_rsv3; - u32 tx_pkt_fifo_485[3]; /* 0x00005e50 */ - u32 tx_pkt_fifo_485_rsv3; - u32 tx_pkt_fifo_486[3]; /* 0x00005e60 */ - u32 tx_pkt_fifo_486_rsv3; - u32 tx_pkt_fifo_487[3]; /* 0x00005e70 */ - u32 tx_pkt_fifo_487_rsv3; - u32 tx_pkt_fifo_488[3]; /* 0x00005e80 */ - u32 tx_pkt_fifo_488_rsv3; - u32 tx_pkt_fifo_489[3]; /* 0x00005e90 */ - u32 tx_pkt_fifo_489_rsv3; - u32 tx_pkt_fifo_490[3]; /* 0x00005ea0 */ - u32 tx_pkt_fifo_490_rsv3; - u32 tx_pkt_fifo_491[3]; /* 0x00005eb0 */ - u32 tx_pkt_fifo_491_rsv3; - u32 tx_pkt_fifo_492[3]; /* 0x00005ec0 */ - u32 tx_pkt_fifo_492_rsv3; - u32 tx_pkt_fifo_493[3]; /* 0x00005ed0 */ - u32 tx_pkt_fifo_493_rsv3; - u32 tx_pkt_fifo_494[3]; /* 0x00005ee0 */ - u32 tx_pkt_fifo_494_rsv3; - u32 tx_pkt_fifo_495[3]; /* 0x00005ef0 */ - u32 tx_pkt_fifo_495_rsv3; - u32 tx_pkt_fifo_496[3]; /* 0x00005f00 */ - u32 tx_pkt_fifo_496_rsv3; - u32 tx_pkt_fifo_497[3]; /* 0x00005f10 */ - u32 tx_pkt_fifo_497_rsv3; - u32 tx_pkt_fifo_498[3]; /* 0x00005f20 */ - u32 tx_pkt_fifo_498_rsv3; - u32 tx_pkt_fifo_499[3]; /* 0x00005f30 */ - u32 tx_pkt_fifo_499_rsv3; - u32 tx_pkt_fifo_500[3]; /* 0x00005f40 */ - u32 tx_pkt_fifo_500_rsv3; - u32 tx_pkt_fifo_501[3]; /* 0x00005f50 */ - u32 tx_pkt_fifo_501_rsv3; - u32 tx_pkt_fifo_502[3]; /* 0x00005f60 */ - u32 tx_pkt_fifo_502_rsv3; - u32 tx_pkt_fifo_503[3]; /* 0x00005f70 */ - u32 tx_pkt_fifo_503_rsv3; - u32 tx_pkt_fifo_504[3]; /* 0x00005f80 */ - u32 tx_pkt_fifo_504_rsv3; - u32 tx_pkt_fifo_505[3]; /* 0x00005f90 */ - u32 tx_pkt_fifo_505_rsv3; - u32 tx_pkt_fifo_506[3]; /* 0x00005fa0 */ - u32 tx_pkt_fifo_506_rsv3; - u32 tx_pkt_fifo_507[3]; /* 0x00005fb0 */ - u32 tx_pkt_fifo_507_rsv3; - u32 tx_pkt_fifo_508[3]; /* 0x00005fc0 */ - u32 tx_pkt_fifo_508_rsv3; - u32 tx_pkt_fifo_509[3]; /* 0x00005fd0 */ - u32 tx_pkt_fifo_509_rsv3; - u32 tx_pkt_fifo_510[3]; /* 0x00005fe0 */ - u32 tx_pkt_fifo_510_rsv3; - u32 tx_pkt_fifo_511[3]; /* 0x00005ff0 */ - u32 tx_pkt_fifo_511_rsv3; - u32 tx_pkt_fifo_512[3]; /* 0x00006000 */ - u32 tx_pkt_fifo_512_rsv3; - u32 tx_pkt_fifo_513[3]; /* 0x00006010 */ - u32 tx_pkt_fifo_513_rsv3; - u32 tx_pkt_fifo_514[3]; /* 0x00006020 */ - u32 tx_pkt_fifo_514_rsv3; - u32 tx_pkt_fifo_515[3]; /* 0x00006030 */ - u32 tx_pkt_fifo_515_rsv3; - u32 tx_pkt_fifo_516[3]; /* 0x00006040 */ - u32 tx_pkt_fifo_516_rsv3; - u32 tx_pkt_fifo_517[3]; /* 0x00006050 */ - u32 tx_pkt_fifo_517_rsv3; - u32 tx_pkt_fifo_518[3]; /* 0x00006060 */ - u32 tx_pkt_fifo_518_rsv3; - u32 tx_pkt_fifo_519[3]; /* 0x00006070 */ - u32 tx_pkt_fifo_519_rsv3; - u32 tx_pkt_fifo_520[3]; /* 0x00006080 */ - u32 tx_pkt_fifo_520_rsv3; - u32 tx_pkt_fifo_521[3]; /* 0x00006090 */ - u32 tx_pkt_fifo_521_rsv3; - u32 tx_pkt_fifo_522[3]; /* 0x000060a0 */ - u32 tx_pkt_fifo_522_rsv3; - u32 tx_pkt_fifo_523[3]; /* 0x000060b0 */ - u32 tx_pkt_fifo_523_rsv3; - u32 tx_pkt_fifo_524[3]; /* 0x000060c0 */ - u32 tx_pkt_fifo_524_rsv3; - u32 tx_pkt_fifo_525[3]; /* 0x000060d0 */ - u32 tx_pkt_fifo_525_rsv3; - u32 tx_pkt_fifo_526[3]; /* 0x000060e0 */ - u32 tx_pkt_fifo_526_rsv3; - u32 tx_pkt_fifo_527[3]; /* 0x000060f0 */ - u32 tx_pkt_fifo_527_rsv3; - u32 tx_pkt_fifo_528[3]; /* 0x00006100 */ - u32 tx_pkt_fifo_528_rsv3; - u32 tx_pkt_fifo_529[3]; /* 0x00006110 */ - u32 tx_pkt_fifo_529_rsv3; - u32 tx_pkt_fifo_530[3]; /* 0x00006120 */ - u32 tx_pkt_fifo_530_rsv3; - u32 tx_pkt_fifo_531[3]; /* 0x00006130 */ - u32 tx_pkt_fifo_531_rsv3; - u32 tx_pkt_fifo_532[3]; /* 0x00006140 */ - u32 tx_pkt_fifo_532_rsv3; - u32 tx_pkt_fifo_533[3]; /* 0x00006150 */ - u32 tx_pkt_fifo_533_rsv3; - u32 tx_pkt_fifo_534[3]; /* 0x00006160 */ - u32 tx_pkt_fifo_534_rsv3; - u32 tx_pkt_fifo_535[3]; /* 0x00006170 */ - u32 tx_pkt_fifo_535_rsv3; - u32 tx_pkt_fifo_536[3]; /* 0x00006180 */ - u32 tx_pkt_fifo_536_rsv3; - u32 tx_pkt_fifo_537[3]; /* 0x00006190 */ - u32 tx_pkt_fifo_537_rsv3; - u32 tx_pkt_fifo_538[3]; /* 0x000061a0 */ - u32 tx_pkt_fifo_538_rsv3; - u32 tx_pkt_fifo_539[3]; /* 0x000061b0 */ - u32 tx_pkt_fifo_539_rsv3; - u32 tx_pkt_fifo_540[3]; /* 0x000061c0 */ - u32 tx_pkt_fifo_540_rsv3; - u32 tx_pkt_fifo_541[3]; /* 0x000061d0 */ - u32 tx_pkt_fifo_541_rsv3; - u32 tx_pkt_fifo_542[3]; /* 0x000061e0 */ - u32 tx_pkt_fifo_542_rsv3; - u32 tx_pkt_fifo_543[3]; /* 0x000061f0 */ - u32 tx_pkt_fifo_543_rsv3; - u32 tx_pkt_fifo_544[3]; /* 0x00006200 */ - u32 tx_pkt_fifo_544_rsv3; - u32 tx_pkt_fifo_545[3]; /* 0x00006210 */ - u32 tx_pkt_fifo_545_rsv3; - u32 tx_pkt_fifo_546[3]; /* 0x00006220 */ - u32 tx_pkt_fifo_546_rsv3; - u32 tx_pkt_fifo_547[3]; /* 0x00006230 */ - u32 tx_pkt_fifo_547_rsv3; - u32 tx_pkt_fifo_548[3]; /* 0x00006240 */ - u32 tx_pkt_fifo_548_rsv3; - u32 tx_pkt_fifo_549[3]; /* 0x00006250 */ - u32 tx_pkt_fifo_549_rsv3; - u32 tx_pkt_fifo_550[3]; /* 0x00006260 */ - u32 tx_pkt_fifo_550_rsv3; - u32 tx_pkt_fifo_551[3]; /* 0x00006270 */ - u32 tx_pkt_fifo_551_rsv3; - u32 tx_pkt_fifo_552[3]; /* 0x00006280 */ - u32 tx_pkt_fifo_552_rsv3; - u32 tx_pkt_fifo_553[3]; /* 0x00006290 */ - u32 tx_pkt_fifo_553_rsv3; - u32 tx_pkt_fifo_554[3]; /* 0x000062a0 */ - u32 tx_pkt_fifo_554_rsv3; - u32 tx_pkt_fifo_555[3]; /* 0x000062b0 */ - u32 tx_pkt_fifo_555_rsv3; - u32 tx_pkt_fifo_556[3]; /* 0x000062c0 */ - u32 tx_pkt_fifo_556_rsv3; - u32 tx_pkt_fifo_557[3]; /* 0x000062d0 */ - u32 tx_pkt_fifo_557_rsv3; - u32 tx_pkt_fifo_558[3]; /* 0x000062e0 */ - u32 tx_pkt_fifo_558_rsv3; - u32 tx_pkt_fifo_559[3]; /* 0x000062f0 */ - u32 tx_pkt_fifo_559_rsv3; - u32 tx_pkt_fifo_560[3]; /* 0x00006300 */ - u32 tx_pkt_fifo_560_rsv3; - u32 tx_pkt_fifo_561[3]; /* 0x00006310 */ - u32 tx_pkt_fifo_561_rsv3; - u32 tx_pkt_fifo_562[3]; /* 0x00006320 */ - u32 tx_pkt_fifo_562_rsv3; - u32 tx_pkt_fifo_563[3]; /* 0x00006330 */ - u32 tx_pkt_fifo_563_rsv3; - u32 tx_pkt_fifo_564[3]; /* 0x00006340 */ - u32 tx_pkt_fifo_564_rsv3; - u32 tx_pkt_fifo_565[3]; /* 0x00006350 */ - u32 tx_pkt_fifo_565_rsv3; - u32 tx_pkt_fifo_566[3]; /* 0x00006360 */ - u32 tx_pkt_fifo_566_rsv3; - u32 tx_pkt_fifo_567[3]; /* 0x00006370 */ - u32 tx_pkt_fifo_567_rsv3; - u32 tx_pkt_fifo_568[3]; /* 0x00006380 */ - u32 tx_pkt_fifo_568_rsv3; - u32 tx_pkt_fifo_569[3]; /* 0x00006390 */ - u32 tx_pkt_fifo_569_rsv3; - u32 tx_pkt_fifo_570[3]; /* 0x000063a0 */ - u32 tx_pkt_fifo_570_rsv3; - u32 tx_pkt_fifo_571[3]; /* 0x000063b0 */ - u32 tx_pkt_fifo_571_rsv3; - u32 tx_pkt_fifo_572[3]; /* 0x000063c0 */ - u32 tx_pkt_fifo_572_rsv3; - u32 tx_pkt_fifo_573[3]; /* 0x000063d0 */ - u32 tx_pkt_fifo_573_rsv3; - u32 tx_pkt_fifo_574[3]; /* 0x000063e0 */ - u32 tx_pkt_fifo_574_rsv3; - u32 tx_pkt_fifo_575[3]; /* 0x000063f0 */ - u32 tx_pkt_fifo_575_rsv3; - u32 tx_pkt_fifo_576[3]; /* 0x00006400 */ - u32 tx_pkt_fifo_576_rsv3; - u32 tx_pkt_fifo_577[3]; /* 0x00006410 */ - u32 tx_pkt_fifo_577_rsv3; - u32 tx_pkt_fifo_578[3]; /* 0x00006420 */ - u32 tx_pkt_fifo_578_rsv3; - u32 tx_pkt_fifo_579[3]; /* 0x00006430 */ - u32 tx_pkt_fifo_579_rsv3; - u32 tx_pkt_fifo_580[3]; /* 0x00006440 */ - u32 tx_pkt_fifo_580_rsv3; - u32 tx_pkt_fifo_581[3]; /* 0x00006450 */ - u32 tx_pkt_fifo_581_rsv3; - u32 tx_pkt_fifo_582[3]; /* 0x00006460 */ - u32 tx_pkt_fifo_582_rsv3; - u32 tx_pkt_fifo_583[3]; /* 0x00006470 */ - u32 tx_pkt_fifo_583_rsv3; - u32 tx_pkt_fifo_584[3]; /* 0x00006480 */ - u32 tx_pkt_fifo_584_rsv3; - u32 tx_pkt_fifo_585[3]; /* 0x00006490 */ - u32 tx_pkt_fifo_585_rsv3; - u32 tx_pkt_fifo_586[3]; /* 0x000064a0 */ - u32 tx_pkt_fifo_586_rsv3; - u32 tx_pkt_fifo_587[3]; /* 0x000064b0 */ - u32 tx_pkt_fifo_587_rsv3; - u32 tx_pkt_fifo_588[3]; /* 0x000064c0 */ - u32 tx_pkt_fifo_588_rsv3; - u32 tx_pkt_fifo_589[3]; /* 0x000064d0 */ - u32 tx_pkt_fifo_589_rsv3; - u32 tx_pkt_fifo_590[3]; /* 0x000064e0 */ - u32 tx_pkt_fifo_590_rsv3; - u32 tx_pkt_fifo_591[3]; /* 0x000064f0 */ - u32 tx_pkt_fifo_591_rsv3; - u32 tx_pkt_fifo_592[3]; /* 0x00006500 */ - u32 tx_pkt_fifo_592_rsv3; - u32 tx_pkt_fifo_593[3]; /* 0x00006510 */ - u32 tx_pkt_fifo_593_rsv3; - u32 tx_pkt_fifo_594[3]; /* 0x00006520 */ - u32 tx_pkt_fifo_594_rsv3; - u32 tx_pkt_fifo_595[3]; /* 0x00006530 */ - u32 tx_pkt_fifo_595_rsv3; - u32 tx_pkt_fifo_596[3]; /* 0x00006540 */ - u32 tx_pkt_fifo_596_rsv3; - u32 tx_pkt_fifo_597[3]; /* 0x00006550 */ - u32 tx_pkt_fifo_597_rsv3; - u32 tx_pkt_fifo_598[3]; /* 0x00006560 */ - u32 tx_pkt_fifo_598_rsv3; - u32 tx_pkt_fifo_599[3]; /* 0x00006570 */ - u32 tx_pkt_fifo_599_rsv3; - u32 tx_pkt_fifo_600[3]; /* 0x00006580 */ - u32 tx_pkt_fifo_600_rsv3; - u32 tx_pkt_fifo_601[3]; /* 0x00006590 */ - u32 tx_pkt_fifo_601_rsv3; - u32 tx_pkt_fifo_602[3]; /* 0x000065a0 */ - u32 tx_pkt_fifo_602_rsv3; - u32 tx_pkt_fifo_603[3]; /* 0x000065b0 */ - u32 tx_pkt_fifo_603_rsv3; - u32 tx_pkt_fifo_604[3]; /* 0x000065c0 */ - u32 tx_pkt_fifo_604_rsv3; - u32 tx_pkt_fifo_605[3]; /* 0x000065d0 */ - u32 tx_pkt_fifo_605_rsv3; - u32 tx_pkt_fifo_606[3]; /* 0x000065e0 */ - u32 tx_pkt_fifo_606_rsv3; - u32 tx_pkt_fifo_607[3]; /* 0x000065f0 */ - u32 tx_pkt_fifo_607_rsv3; - u32 tx_pkt_fifo_608[3]; /* 0x00006600 */ - u32 tx_pkt_fifo_608_rsv3; - u32 tx_pkt_fifo_609[3]; /* 0x00006610 */ - u32 tx_pkt_fifo_609_rsv3; - u32 tx_pkt_fifo_610[3]; /* 0x00006620 */ - u32 tx_pkt_fifo_610_rsv3; - u32 tx_pkt_fifo_611[3]; /* 0x00006630 */ - u32 tx_pkt_fifo_611_rsv3; - u32 tx_pkt_fifo_612[3]; /* 0x00006640 */ - u32 tx_pkt_fifo_612_rsv3; - u32 tx_pkt_fifo_613[3]; /* 0x00006650 */ - u32 tx_pkt_fifo_613_rsv3; - u32 tx_pkt_fifo_614[3]; /* 0x00006660 */ - u32 tx_pkt_fifo_614_rsv3; - u32 tx_pkt_fifo_615[3]; /* 0x00006670 */ - u32 tx_pkt_fifo_615_rsv3; - u32 tx_pkt_fifo_616[3]; /* 0x00006680 */ - u32 tx_pkt_fifo_616_rsv3; - u32 tx_pkt_fifo_617[3]; /* 0x00006690 */ - u32 tx_pkt_fifo_617_rsv3; - u32 tx_pkt_fifo_618[3]; /* 0x000066a0 */ - u32 tx_pkt_fifo_618_rsv3; - u32 tx_pkt_fifo_619[3]; /* 0x000066b0 */ - u32 tx_pkt_fifo_619_rsv3; - u32 tx_pkt_fifo_620[3]; /* 0x000066c0 */ - u32 tx_pkt_fifo_620_rsv3; - u32 tx_pkt_fifo_621[3]; /* 0x000066d0 */ - u32 tx_pkt_fifo_621_rsv3; - u32 tx_pkt_fifo_622[3]; /* 0x000066e0 */ - u32 tx_pkt_fifo_622_rsv3; - u32 tx_pkt_fifo_623[3]; /* 0x000066f0 */ - u32 tx_pkt_fifo_623_rsv3; - u32 tx_pkt_fifo_624[3]; /* 0x00006700 */ - u32 tx_pkt_fifo_624_rsv3; - u32 tx_pkt_fifo_625[3]; /* 0x00006710 */ - u32 tx_pkt_fifo_625_rsv3; - u32 tx_pkt_fifo_626[3]; /* 0x00006720 */ - u32 tx_pkt_fifo_626_rsv3; - u32 tx_pkt_fifo_627[3]; /* 0x00006730 */ - u32 tx_pkt_fifo_627_rsv3; - u32 tx_pkt_fifo_628[3]; /* 0x00006740 */ - u32 tx_pkt_fifo_628_rsv3; - u32 tx_pkt_fifo_629[3]; /* 0x00006750 */ - u32 tx_pkt_fifo_629_rsv3; - u32 tx_pkt_fifo_630[3]; /* 0x00006760 */ - u32 tx_pkt_fifo_630_rsv3; - u32 tx_pkt_fifo_631[3]; /* 0x00006770 */ - u32 tx_pkt_fifo_631_rsv3; - u32 tx_pkt_fifo_632[3]; /* 0x00006780 */ - u32 tx_pkt_fifo_632_rsv3; - u32 tx_pkt_fifo_633[3]; /* 0x00006790 */ - u32 tx_pkt_fifo_633_rsv3; - u32 tx_pkt_fifo_634[3]; /* 0x000067a0 */ - u32 tx_pkt_fifo_634_rsv3; - u32 tx_pkt_fifo_635[3]; /* 0x000067b0 */ - u32 tx_pkt_fifo_635_rsv3; - u32 tx_pkt_fifo_636[3]; /* 0x000067c0 */ - u32 tx_pkt_fifo_636_rsv3; - u32 tx_pkt_fifo_637[3]; /* 0x000067d0 */ - u32 tx_pkt_fifo_637_rsv3; - u32 tx_pkt_fifo_638[3]; /* 0x000067e0 */ - u32 tx_pkt_fifo_638_rsv3; - u32 tx_pkt_fifo_639[3]; /* 0x000067f0 */ - u32 tx_pkt_fifo_639_rsv3; +/* ################################################################################ + * # CpuMacDescCfg1 Definition + */ +#define CPU_MAC_DESC_CFG1_W0_CFG_DESC_SLICE_EN 2 +#define CPU_MAC_DESC_CFG1_W0_CFG_RX_DESC_DONE_INTR_TIMER_EN 0 +#define CPU_MAC_DESC_CFG1_W0_CFG_TX_DESC_DONE_INTR_TIMER_EN 1 +#define CPU_MAC_DESC_CFG1_W1_CFG_RX_DESC_DONE_TIMER_THRD 0 +#define CPU_MAC_DESC_CFG1_W2_CFG_TX_DESC_DONE_TIMER_THRD 0 + +#define CPU_MAC_DESC_CFG1_W0_CFG_DESC_SLICE_EN_MASK 0x00000004 +#define CPU_MAC_DESC_CFG1_W0_CFG_RX_DESC_DONE_INTR_TIMER_EN_MASK 0x00000001 +#define CPU_MAC_DESC_CFG1_W0_CFG_TX_DESC_DONE_INTR_TIMER_EN_MASK 0x00000002 +#define CPU_MAC_DESC_CFG1_W1_CFG_RX_DESC_DONE_TIMER_THRD_MASK 0xffffffff +#define CPU_MAC_DESC_CFG1_W2_CFG_TX_DESC_DONE_TIMER_THRD_MASK 0xffffffff + +/* ################################################################################ + * # CpuMacInterruptFunc0 Definition + */ +#define CPU_MAC_INTERRUPT_FUNC0_W0_VALUE_SET0_CPU_MAC_INTERRUPT_FUNC0 0 +#define CPU_MAC_INTERRUPT_FUNC0_W1_VALUE_RESET0_CPU_MAC_INTERRUPT_FUNC0 0 +#define CPU_MAC_INTERRUPT_FUNC0_W2_MASK_SET0_CPU_MAC_INTERRUPT_FUNC0 0 +#define CPU_MAC_INTERRUPT_FUNC0_W3_MASK_RESET0_CPU_MAC_INTERRUPT_FUNC0 0 + +#define CPU_MAC_INTERRUPT_FUNC0_W0_VALUE_SET0_CPU_MAC_INTERRUPT_FUNC0_MASK 0x00000003 +#define CPU_MAC_INTERRUPT_FUNC0_W1_VALUE_RESET0_CPU_MAC_INTERRUPT_FUNC0_MASK 0x00000003 +#define CPU_MAC_INTERRUPT_FUNC0_W2_MASK_SET0_CPU_MAC_INTERRUPT_FUNC0_MASK 0x00000003 +#define CPU_MAC_INTERRUPT_FUNC0_W3_MASK_RESET0_CPU_MAC_INTERRUPT_FUNC0_MASK 0x00000003 + +/* ################################################################################ + * # CpuMacInterruptFunc1 Definition + */ +#define CPU_MAC_INTERRUPT_FUNC1_W0_VALUE_SET0_CPU_MAC_INTERRUPT_FUNC1 0 +#define CPU_MAC_INTERRUPT_FUNC1_W1_VALUE_RESET0_CPU_MAC_INTERRUPT_FUNC1 0 +#define CPU_MAC_INTERRUPT_FUNC1_W2_MASK_SET0_CPU_MAC_INTERRUPT_FUNC1 0 +#define CPU_MAC_INTERRUPT_FUNC1_W3_MASK_RESET0_CPU_MAC_INTERRUPT_FUNC1 0 + +#define CPU_MAC_INTERRUPT_FUNC1_W0_VALUE_SET0_CPU_MAC_INTERRUPT_FUNC1_MASK 0x00000003 +#define CPU_MAC_INTERRUPT_FUNC1_W1_VALUE_RESET0_CPU_MAC_INTERRUPT_FUNC1_MASK 0x00000003 +#define CPU_MAC_INTERRUPT_FUNC1_W2_MASK_SET0_CPU_MAC_INTERRUPT_FUNC1_MASK 0x00000003 +#define CPU_MAC_INTERRUPT_FUNC1_W3_MASK_RESET0_CPU_MAC_INTERRUPT_FUNC1_MASK 0x00000003 + +struct CpuMac_mems { + u32 TxPktFifo0[3]; /* 0x00004000 */ + u32 TxPktFifo0_rsv3; + u32 TxPktFifo1[3]; /* 0x00004010 */ + u32 TxPktFifo1_rsv3; + u32 TxPktFifo2[3]; /* 0x00004020 */ + u32 TxPktFifo2_rsv3; + u32 TxPktFifo3[3]; /* 0x00004030 */ + u32 TxPktFifo3_rsv3; + u32 TxPktFifo4[3]; /* 0x00004040 */ + u32 TxPktFifo4_rsv3; + u32 TxPktFifo5[3]; /* 0x00004050 */ + u32 TxPktFifo5_rsv3; + u32 TxPktFifo6[3]; /* 0x00004060 */ + u32 TxPktFifo6_rsv3; + u32 TxPktFifo7[3]; /* 0x00004070 */ + u32 TxPktFifo7_rsv3; + u32 TxPktFifo8[3]; /* 0x00004080 */ + u32 TxPktFifo8_rsv3; + u32 TxPktFifo9[3]; /* 0x00004090 */ + u32 TxPktFifo9_rsv3; + u32 TxPktFifo10[3]; /* 0x000040a0 */ + u32 TxPktFifo10_rsv3; + u32 TxPktFifo11[3]; /* 0x000040b0 */ + u32 TxPktFifo11_rsv3; + u32 TxPktFifo12[3]; /* 0x000040c0 */ + u32 TxPktFifo12_rsv3; + u32 TxPktFifo13[3]; /* 0x000040d0 */ + u32 TxPktFifo13_rsv3; + u32 TxPktFifo14[3]; /* 0x000040e0 */ + u32 TxPktFifo14_rsv3; + u32 TxPktFifo15[3]; /* 0x000040f0 */ + u32 TxPktFifo15_rsv3; + u32 TxPktFifo16[3]; /* 0x00004100 */ + u32 TxPktFifo16_rsv3; + u32 TxPktFifo17[3]; /* 0x00004110 */ + u32 TxPktFifo17_rsv3; + u32 TxPktFifo18[3]; /* 0x00004120 */ + u32 TxPktFifo18_rsv3; + u32 TxPktFifo19[3]; /* 0x00004130 */ + u32 TxPktFifo19_rsv3; + u32 TxPktFifo20[3]; /* 0x00004140 */ + u32 TxPktFifo20_rsv3; + u32 TxPktFifo21[3]; /* 0x00004150 */ + u32 TxPktFifo21_rsv3; + u32 TxPktFifo22[3]; /* 0x00004160 */ + u32 TxPktFifo22_rsv3; + u32 TxPktFifo23[3]; /* 0x00004170 */ + u32 TxPktFifo23_rsv3; + u32 TxPktFifo24[3]; /* 0x00004180 */ + u32 TxPktFifo24_rsv3; + u32 TxPktFifo25[3]; /* 0x00004190 */ + u32 TxPktFifo25_rsv3; + u32 TxPktFifo26[3]; /* 0x000041a0 */ + u32 TxPktFifo26_rsv3; + u32 TxPktFifo27[3]; /* 0x000041b0 */ + u32 TxPktFifo27_rsv3; + u32 TxPktFifo28[3]; /* 0x000041c0 */ + u32 TxPktFifo28_rsv3; + u32 TxPktFifo29[3]; /* 0x000041d0 */ + u32 TxPktFifo29_rsv3; + u32 TxPktFifo30[3]; /* 0x000041e0 */ + u32 TxPktFifo30_rsv3; + u32 TxPktFifo31[3]; /* 0x000041f0 */ + u32 TxPktFifo31_rsv3; + u32 TxPktFifo32[3]; /* 0x00004200 */ + u32 TxPktFifo32_rsv3; + u32 TxPktFifo33[3]; /* 0x00004210 */ + u32 TxPktFifo33_rsv3; + u32 TxPktFifo34[3]; /* 0x00004220 */ + u32 TxPktFifo34_rsv3; + u32 TxPktFifo35[3]; /* 0x00004230 */ + u32 TxPktFifo35_rsv3; + u32 TxPktFifo36[3]; /* 0x00004240 */ + u32 TxPktFifo36_rsv3; + u32 TxPktFifo37[3]; /* 0x00004250 */ + u32 TxPktFifo37_rsv3; + u32 TxPktFifo38[3]; /* 0x00004260 */ + u32 TxPktFifo38_rsv3; + u32 TxPktFifo39[3]; /* 0x00004270 */ + u32 TxPktFifo39_rsv3; + u32 TxPktFifo40[3]; /* 0x00004280 */ + u32 TxPktFifo40_rsv3; + u32 TxPktFifo41[3]; /* 0x00004290 */ + u32 TxPktFifo41_rsv3; + u32 TxPktFifo42[3]; /* 0x000042a0 */ + u32 TxPktFifo42_rsv3; + u32 TxPktFifo43[3]; /* 0x000042b0 */ + u32 TxPktFifo43_rsv3; + u32 TxPktFifo44[3]; /* 0x000042c0 */ + u32 TxPktFifo44_rsv3; + u32 TxPktFifo45[3]; /* 0x000042d0 */ + u32 TxPktFifo45_rsv3; + u32 TxPktFifo46[3]; /* 0x000042e0 */ + u32 TxPktFifo46_rsv3; + u32 TxPktFifo47[3]; /* 0x000042f0 */ + u32 TxPktFifo47_rsv3; + u32 TxPktFifo48[3]; /* 0x00004300 */ + u32 TxPktFifo48_rsv3; + u32 TxPktFifo49[3]; /* 0x00004310 */ + u32 TxPktFifo49_rsv3; + u32 TxPktFifo50[3]; /* 0x00004320 */ + u32 TxPktFifo50_rsv3; + u32 TxPktFifo51[3]; /* 0x00004330 */ + u32 TxPktFifo51_rsv3; + u32 TxPktFifo52[3]; /* 0x00004340 */ + u32 TxPktFifo52_rsv3; + u32 TxPktFifo53[3]; /* 0x00004350 */ + u32 TxPktFifo53_rsv3; + u32 TxPktFifo54[3]; /* 0x00004360 */ + u32 TxPktFifo54_rsv3; + u32 TxPktFifo55[3]; /* 0x00004370 */ + u32 TxPktFifo55_rsv3; + u32 TxPktFifo56[3]; /* 0x00004380 */ + u32 TxPktFifo56_rsv3; + u32 TxPktFifo57[3]; /* 0x00004390 */ + u32 TxPktFifo57_rsv3; + u32 TxPktFifo58[3]; /* 0x000043a0 */ + u32 TxPktFifo58_rsv3; + u32 TxPktFifo59[3]; /* 0x000043b0 */ + u32 TxPktFifo59_rsv3; + u32 TxPktFifo60[3]; /* 0x000043c0 */ + u32 TxPktFifo60_rsv3; + u32 TxPktFifo61[3]; /* 0x000043d0 */ + u32 TxPktFifo61_rsv3; + u32 TxPktFifo62[3]; /* 0x000043e0 */ + u32 TxPktFifo62_rsv3; + u32 TxPktFifo63[3]; /* 0x000043f0 */ + u32 TxPktFifo63_rsv3; + u32 TxPktFifo64[3]; /* 0x00004400 */ + u32 TxPktFifo64_rsv3; + u32 TxPktFifo65[3]; /* 0x00004410 */ + u32 TxPktFifo65_rsv3; + u32 TxPktFifo66[3]; /* 0x00004420 */ + u32 TxPktFifo66_rsv3; + u32 TxPktFifo67[3]; /* 0x00004430 */ + u32 TxPktFifo67_rsv3; + u32 TxPktFifo68[3]; /* 0x00004440 */ + u32 TxPktFifo68_rsv3; + u32 TxPktFifo69[3]; /* 0x00004450 */ + u32 TxPktFifo69_rsv3; + u32 TxPktFifo70[3]; /* 0x00004460 */ + u32 TxPktFifo70_rsv3; + u32 TxPktFifo71[3]; /* 0x00004470 */ + u32 TxPktFifo71_rsv3; + u32 TxPktFifo72[3]; /* 0x00004480 */ + u32 TxPktFifo72_rsv3; + u32 TxPktFifo73[3]; /* 0x00004490 */ + u32 TxPktFifo73_rsv3; + u32 TxPktFifo74[3]; /* 0x000044a0 */ + u32 TxPktFifo74_rsv3; + u32 TxPktFifo75[3]; /* 0x000044b0 */ + u32 TxPktFifo75_rsv3; + u32 TxPktFifo76[3]; /* 0x000044c0 */ + u32 TxPktFifo76_rsv3; + u32 TxPktFifo77[3]; /* 0x000044d0 */ + u32 TxPktFifo77_rsv3; + u32 TxPktFifo78[3]; /* 0x000044e0 */ + u32 TxPktFifo78_rsv3; + u32 TxPktFifo79[3]; /* 0x000044f0 */ + u32 TxPktFifo79_rsv3; + u32 TxPktFifo80[3]; /* 0x00004500 */ + u32 TxPktFifo80_rsv3; + u32 TxPktFifo81[3]; /* 0x00004510 */ + u32 TxPktFifo81_rsv3; + u32 TxPktFifo82[3]; /* 0x00004520 */ + u32 TxPktFifo82_rsv3; + u32 TxPktFifo83[3]; /* 0x00004530 */ + u32 TxPktFifo83_rsv3; + u32 TxPktFifo84[3]; /* 0x00004540 */ + u32 TxPktFifo84_rsv3; + u32 TxPktFifo85[3]; /* 0x00004550 */ + u32 TxPktFifo85_rsv3; + u32 TxPktFifo86[3]; /* 0x00004560 */ + u32 TxPktFifo86_rsv3; + u32 TxPktFifo87[3]; /* 0x00004570 */ + u32 TxPktFifo87_rsv3; + u32 TxPktFifo88[3]; /* 0x00004580 */ + u32 TxPktFifo88_rsv3; + u32 TxPktFifo89[3]; /* 0x00004590 */ + u32 TxPktFifo89_rsv3; + u32 TxPktFifo90[3]; /* 0x000045a0 */ + u32 TxPktFifo90_rsv3; + u32 TxPktFifo91[3]; /* 0x000045b0 */ + u32 TxPktFifo91_rsv3; + u32 TxPktFifo92[3]; /* 0x000045c0 */ + u32 TxPktFifo92_rsv3; + u32 TxPktFifo93[3]; /* 0x000045d0 */ + u32 TxPktFifo93_rsv3; + u32 TxPktFifo94[3]; /* 0x000045e0 */ + u32 TxPktFifo94_rsv3; + u32 TxPktFifo95[3]; /* 0x000045f0 */ + u32 TxPktFifo95_rsv3; + u32 TxPktFifo96[3]; /* 0x00004600 */ + u32 TxPktFifo96_rsv3; + u32 TxPktFifo97[3]; /* 0x00004610 */ + u32 TxPktFifo97_rsv3; + u32 TxPktFifo98[3]; /* 0x00004620 */ + u32 TxPktFifo98_rsv3; + u32 TxPktFifo99[3]; /* 0x00004630 */ + u32 TxPktFifo99_rsv3; + u32 TxPktFifo100[3]; /* 0x00004640 */ + u32 TxPktFifo100_rsv3; + u32 TxPktFifo101[3]; /* 0x00004650 */ + u32 TxPktFifo101_rsv3; + u32 TxPktFifo102[3]; /* 0x00004660 */ + u32 TxPktFifo102_rsv3; + u32 TxPktFifo103[3]; /* 0x00004670 */ + u32 TxPktFifo103_rsv3; + u32 TxPktFifo104[3]; /* 0x00004680 */ + u32 TxPktFifo104_rsv3; + u32 TxPktFifo105[3]; /* 0x00004690 */ + u32 TxPktFifo105_rsv3; + u32 TxPktFifo106[3]; /* 0x000046a0 */ + u32 TxPktFifo106_rsv3; + u32 TxPktFifo107[3]; /* 0x000046b0 */ + u32 TxPktFifo107_rsv3; + u32 TxPktFifo108[3]; /* 0x000046c0 */ + u32 TxPktFifo108_rsv3; + u32 TxPktFifo109[3]; /* 0x000046d0 */ + u32 TxPktFifo109_rsv3; + u32 TxPktFifo110[3]; /* 0x000046e0 */ + u32 TxPktFifo110_rsv3; + u32 TxPktFifo111[3]; /* 0x000046f0 */ + u32 TxPktFifo111_rsv3; + u32 TxPktFifo112[3]; /* 0x00004700 */ + u32 TxPktFifo112_rsv3; + u32 TxPktFifo113[3]; /* 0x00004710 */ + u32 TxPktFifo113_rsv3; + u32 TxPktFifo114[3]; /* 0x00004720 */ + u32 TxPktFifo114_rsv3; + u32 TxPktFifo115[3]; /* 0x00004730 */ + u32 TxPktFifo115_rsv3; + u32 TxPktFifo116[3]; /* 0x00004740 */ + u32 TxPktFifo116_rsv3; + u32 TxPktFifo117[3]; /* 0x00004750 */ + u32 TxPktFifo117_rsv3; + u32 TxPktFifo118[3]; /* 0x00004760 */ + u32 TxPktFifo118_rsv3; + u32 TxPktFifo119[3]; /* 0x00004770 */ + u32 TxPktFifo119_rsv3; + u32 TxPktFifo120[3]; /* 0x00004780 */ + u32 TxPktFifo120_rsv3; + u32 TxPktFifo121[3]; /* 0x00004790 */ + u32 TxPktFifo121_rsv3; + u32 TxPktFifo122[3]; /* 0x000047a0 */ + u32 TxPktFifo122_rsv3; + u32 TxPktFifo123[3]; /* 0x000047b0 */ + u32 TxPktFifo123_rsv3; + u32 TxPktFifo124[3]; /* 0x000047c0 */ + u32 TxPktFifo124_rsv3; + u32 TxPktFifo125[3]; /* 0x000047d0 */ + u32 TxPktFifo125_rsv3; + u32 TxPktFifo126[3]; /* 0x000047e0 */ + u32 TxPktFifo126_rsv3; + u32 TxPktFifo127[3]; /* 0x000047f0 */ + u32 TxPktFifo127_rsv3; + u32 TxPktFifo128[3]; /* 0x00004800 */ + u32 TxPktFifo128_rsv3; + u32 TxPktFifo129[3]; /* 0x00004810 */ + u32 TxPktFifo129_rsv3; + u32 TxPktFifo130[3]; /* 0x00004820 */ + u32 TxPktFifo130_rsv3; + u32 TxPktFifo131[3]; /* 0x00004830 */ + u32 TxPktFifo131_rsv3; + u32 TxPktFifo132[3]; /* 0x00004840 */ + u32 TxPktFifo132_rsv3; + u32 TxPktFifo133[3]; /* 0x00004850 */ + u32 TxPktFifo133_rsv3; + u32 TxPktFifo134[3]; /* 0x00004860 */ + u32 TxPktFifo134_rsv3; + u32 TxPktFifo135[3]; /* 0x00004870 */ + u32 TxPktFifo135_rsv3; + u32 TxPktFifo136[3]; /* 0x00004880 */ + u32 TxPktFifo136_rsv3; + u32 TxPktFifo137[3]; /* 0x00004890 */ + u32 TxPktFifo137_rsv3; + u32 TxPktFifo138[3]; /* 0x000048a0 */ + u32 TxPktFifo138_rsv3; + u32 TxPktFifo139[3]; /* 0x000048b0 */ + u32 TxPktFifo139_rsv3; + u32 TxPktFifo140[3]; /* 0x000048c0 */ + u32 TxPktFifo140_rsv3; + u32 TxPktFifo141[3]; /* 0x000048d0 */ + u32 TxPktFifo141_rsv3; + u32 TxPktFifo142[3]; /* 0x000048e0 */ + u32 TxPktFifo142_rsv3; + u32 TxPktFifo143[3]; /* 0x000048f0 */ + u32 TxPktFifo143_rsv3; + u32 TxPktFifo144[3]; /* 0x00004900 */ + u32 TxPktFifo144_rsv3; + u32 TxPktFifo145[3]; /* 0x00004910 */ + u32 TxPktFifo145_rsv3; + u32 TxPktFifo146[3]; /* 0x00004920 */ + u32 TxPktFifo146_rsv3; + u32 TxPktFifo147[3]; /* 0x00004930 */ + u32 TxPktFifo147_rsv3; + u32 TxPktFifo148[3]; /* 0x00004940 */ + u32 TxPktFifo148_rsv3; + u32 TxPktFifo149[3]; /* 0x00004950 */ + u32 TxPktFifo149_rsv3; + u32 TxPktFifo150[3]; /* 0x00004960 */ + u32 TxPktFifo150_rsv3; + u32 TxPktFifo151[3]; /* 0x00004970 */ + u32 TxPktFifo151_rsv3; + u32 TxPktFifo152[3]; /* 0x00004980 */ + u32 TxPktFifo152_rsv3; + u32 TxPktFifo153[3]; /* 0x00004990 */ + u32 TxPktFifo153_rsv3; + u32 TxPktFifo154[3]; /* 0x000049a0 */ + u32 TxPktFifo154_rsv3; + u32 TxPktFifo155[3]; /* 0x000049b0 */ + u32 TxPktFifo155_rsv3; + u32 TxPktFifo156[3]; /* 0x000049c0 */ + u32 TxPktFifo156_rsv3; + u32 TxPktFifo157[3]; /* 0x000049d0 */ + u32 TxPktFifo157_rsv3; + u32 TxPktFifo158[3]; /* 0x000049e0 */ + u32 TxPktFifo158_rsv3; + u32 TxPktFifo159[3]; /* 0x000049f0 */ + u32 TxPktFifo159_rsv3; + u32 TxPktFifo160[3]; /* 0x00004a00 */ + u32 TxPktFifo160_rsv3; + u32 TxPktFifo161[3]; /* 0x00004a10 */ + u32 TxPktFifo161_rsv3; + u32 TxPktFifo162[3]; /* 0x00004a20 */ + u32 TxPktFifo162_rsv3; + u32 TxPktFifo163[3]; /* 0x00004a30 */ + u32 TxPktFifo163_rsv3; + u32 TxPktFifo164[3]; /* 0x00004a40 */ + u32 TxPktFifo164_rsv3; + u32 TxPktFifo165[3]; /* 0x00004a50 */ + u32 TxPktFifo165_rsv3; + u32 TxPktFifo166[3]; /* 0x00004a60 */ + u32 TxPktFifo166_rsv3; + u32 TxPktFifo167[3]; /* 0x00004a70 */ + u32 TxPktFifo167_rsv3; + u32 TxPktFifo168[3]; /* 0x00004a80 */ + u32 TxPktFifo168_rsv3; + u32 TxPktFifo169[3]; /* 0x00004a90 */ + u32 TxPktFifo169_rsv3; + u32 TxPktFifo170[3]; /* 0x00004aa0 */ + u32 TxPktFifo170_rsv3; + u32 TxPktFifo171[3]; /* 0x00004ab0 */ + u32 TxPktFifo171_rsv3; + u32 TxPktFifo172[3]; /* 0x00004ac0 */ + u32 TxPktFifo172_rsv3; + u32 TxPktFifo173[3]; /* 0x00004ad0 */ + u32 TxPktFifo173_rsv3; + u32 TxPktFifo174[3]; /* 0x00004ae0 */ + u32 TxPktFifo174_rsv3; + u32 TxPktFifo175[3]; /* 0x00004af0 */ + u32 TxPktFifo175_rsv3; + u32 TxPktFifo176[3]; /* 0x00004b00 */ + u32 TxPktFifo176_rsv3; + u32 TxPktFifo177[3]; /* 0x00004b10 */ + u32 TxPktFifo177_rsv3; + u32 TxPktFifo178[3]; /* 0x00004b20 */ + u32 TxPktFifo178_rsv3; + u32 TxPktFifo179[3]; /* 0x00004b30 */ + u32 TxPktFifo179_rsv3; + u32 TxPktFifo180[3]; /* 0x00004b40 */ + u32 TxPktFifo180_rsv3; + u32 TxPktFifo181[3]; /* 0x00004b50 */ + u32 TxPktFifo181_rsv3; + u32 TxPktFifo182[3]; /* 0x00004b60 */ + u32 TxPktFifo182_rsv3; + u32 TxPktFifo183[3]; /* 0x00004b70 */ + u32 TxPktFifo183_rsv3; + u32 TxPktFifo184[3]; /* 0x00004b80 */ + u32 TxPktFifo184_rsv3; + u32 TxPktFifo185[3]; /* 0x00004b90 */ + u32 TxPktFifo185_rsv3; + u32 TxPktFifo186[3]; /* 0x00004ba0 */ + u32 TxPktFifo186_rsv3; + u32 TxPktFifo187[3]; /* 0x00004bb0 */ + u32 TxPktFifo187_rsv3; + u32 TxPktFifo188[3]; /* 0x00004bc0 */ + u32 TxPktFifo188_rsv3; + u32 TxPktFifo189[3]; /* 0x00004bd0 */ + u32 TxPktFifo189_rsv3; + u32 TxPktFifo190[3]; /* 0x00004be0 */ + u32 TxPktFifo190_rsv3; + u32 TxPktFifo191[3]; /* 0x00004bf0 */ + u32 TxPktFifo191_rsv3; + u32 TxPktFifo192[3]; /* 0x00004c00 */ + u32 TxPktFifo192_rsv3; + u32 TxPktFifo193[3]; /* 0x00004c10 */ + u32 TxPktFifo193_rsv3; + u32 TxPktFifo194[3]; /* 0x00004c20 */ + u32 TxPktFifo194_rsv3; + u32 TxPktFifo195[3]; /* 0x00004c30 */ + u32 TxPktFifo195_rsv3; + u32 TxPktFifo196[3]; /* 0x00004c40 */ + u32 TxPktFifo196_rsv3; + u32 TxPktFifo197[3]; /* 0x00004c50 */ + u32 TxPktFifo197_rsv3; + u32 TxPktFifo198[3]; /* 0x00004c60 */ + u32 TxPktFifo198_rsv3; + u32 TxPktFifo199[3]; /* 0x00004c70 */ + u32 TxPktFifo199_rsv3; + u32 TxPktFifo200[3]; /* 0x00004c80 */ + u32 TxPktFifo200_rsv3; + u32 TxPktFifo201[3]; /* 0x00004c90 */ + u32 TxPktFifo201_rsv3; + u32 TxPktFifo202[3]; /* 0x00004ca0 */ + u32 TxPktFifo202_rsv3; + u32 TxPktFifo203[3]; /* 0x00004cb0 */ + u32 TxPktFifo203_rsv3; + u32 TxPktFifo204[3]; /* 0x00004cc0 */ + u32 TxPktFifo204_rsv3; + u32 TxPktFifo205[3]; /* 0x00004cd0 */ + u32 TxPktFifo205_rsv3; + u32 TxPktFifo206[3]; /* 0x00004ce0 */ + u32 TxPktFifo206_rsv3; + u32 TxPktFifo207[3]; /* 0x00004cf0 */ + u32 TxPktFifo207_rsv3; + u32 TxPktFifo208[3]; /* 0x00004d00 */ + u32 TxPktFifo208_rsv3; + u32 TxPktFifo209[3]; /* 0x00004d10 */ + u32 TxPktFifo209_rsv3; + u32 TxPktFifo210[3]; /* 0x00004d20 */ + u32 TxPktFifo210_rsv3; + u32 TxPktFifo211[3]; /* 0x00004d30 */ + u32 TxPktFifo211_rsv3; + u32 TxPktFifo212[3]; /* 0x00004d40 */ + u32 TxPktFifo212_rsv3; + u32 TxPktFifo213[3]; /* 0x00004d50 */ + u32 TxPktFifo213_rsv3; + u32 TxPktFifo214[3]; /* 0x00004d60 */ + u32 TxPktFifo214_rsv3; + u32 TxPktFifo215[3]; /* 0x00004d70 */ + u32 TxPktFifo215_rsv3; + u32 TxPktFifo216[3]; /* 0x00004d80 */ + u32 TxPktFifo216_rsv3; + u32 TxPktFifo217[3]; /* 0x00004d90 */ + u32 TxPktFifo217_rsv3; + u32 TxPktFifo218[3]; /* 0x00004da0 */ + u32 TxPktFifo218_rsv3; + u32 TxPktFifo219[3]; /* 0x00004db0 */ + u32 TxPktFifo219_rsv3; + u32 TxPktFifo220[3]; /* 0x00004dc0 */ + u32 TxPktFifo220_rsv3; + u32 TxPktFifo221[3]; /* 0x00004dd0 */ + u32 TxPktFifo221_rsv3; + u32 TxPktFifo222[3]; /* 0x00004de0 */ + u32 TxPktFifo222_rsv3; + u32 TxPktFifo223[3]; /* 0x00004df0 */ + u32 TxPktFifo223_rsv3; + u32 TxPktFifo224[3]; /* 0x00004e00 */ + u32 TxPktFifo224_rsv3; + u32 TxPktFifo225[3]; /* 0x00004e10 */ + u32 TxPktFifo225_rsv3; + u32 TxPktFifo226[3]; /* 0x00004e20 */ + u32 TxPktFifo226_rsv3; + u32 TxPktFifo227[3]; /* 0x00004e30 */ + u32 TxPktFifo227_rsv3; + u32 TxPktFifo228[3]; /* 0x00004e40 */ + u32 TxPktFifo228_rsv3; + u32 TxPktFifo229[3]; /* 0x00004e50 */ + u32 TxPktFifo229_rsv3; + u32 TxPktFifo230[3]; /* 0x00004e60 */ + u32 TxPktFifo230_rsv3; + u32 TxPktFifo231[3]; /* 0x00004e70 */ + u32 TxPktFifo231_rsv3; + u32 TxPktFifo232[3]; /* 0x00004e80 */ + u32 TxPktFifo232_rsv3; + u32 TxPktFifo233[3]; /* 0x00004e90 */ + u32 TxPktFifo233_rsv3; + u32 TxPktFifo234[3]; /* 0x00004ea0 */ + u32 TxPktFifo234_rsv3; + u32 TxPktFifo235[3]; /* 0x00004eb0 */ + u32 TxPktFifo235_rsv3; + u32 TxPktFifo236[3]; /* 0x00004ec0 */ + u32 TxPktFifo236_rsv3; + u32 TxPktFifo237[3]; /* 0x00004ed0 */ + u32 TxPktFifo237_rsv3; + u32 TxPktFifo238[3]; /* 0x00004ee0 */ + u32 TxPktFifo238_rsv3; + u32 TxPktFifo239[3]; /* 0x00004ef0 */ + u32 TxPktFifo239_rsv3; + u32 TxPktFifo240[3]; /* 0x00004f00 */ + u32 TxPktFifo240_rsv3; + u32 TxPktFifo241[3]; /* 0x00004f10 */ + u32 TxPktFifo241_rsv3; + u32 TxPktFifo242[3]; /* 0x00004f20 */ + u32 TxPktFifo242_rsv3; + u32 TxPktFifo243[3]; /* 0x00004f30 */ + u32 TxPktFifo243_rsv3; + u32 TxPktFifo244[3]; /* 0x00004f40 */ + u32 TxPktFifo244_rsv3; + u32 TxPktFifo245[3]; /* 0x00004f50 */ + u32 TxPktFifo245_rsv3; + u32 TxPktFifo246[3]; /* 0x00004f60 */ + u32 TxPktFifo246_rsv3; + u32 TxPktFifo247[3]; /* 0x00004f70 */ + u32 TxPktFifo247_rsv3; + u32 TxPktFifo248[3]; /* 0x00004f80 */ + u32 TxPktFifo248_rsv3; + u32 TxPktFifo249[3]; /* 0x00004f90 */ + u32 TxPktFifo249_rsv3; + u32 TxPktFifo250[3]; /* 0x00004fa0 */ + u32 TxPktFifo250_rsv3; + u32 TxPktFifo251[3]; /* 0x00004fb0 */ + u32 TxPktFifo251_rsv3; + u32 TxPktFifo252[3]; /* 0x00004fc0 */ + u32 TxPktFifo252_rsv3; + u32 TxPktFifo253[3]; /* 0x00004fd0 */ + u32 TxPktFifo253_rsv3; + u32 TxPktFifo254[3]; /* 0x00004fe0 */ + u32 TxPktFifo254_rsv3; + u32 TxPktFifo255[3]; /* 0x00004ff0 */ + u32 TxPktFifo255_rsv3; + u32 TxPktFifo256[3]; /* 0x00005000 */ + u32 TxPktFifo256_rsv3; + u32 TxPktFifo257[3]; /* 0x00005010 */ + u32 TxPktFifo257_rsv3; + u32 TxPktFifo258[3]; /* 0x00005020 */ + u32 TxPktFifo258_rsv3; + u32 TxPktFifo259[3]; /* 0x00005030 */ + u32 TxPktFifo259_rsv3; + u32 TxPktFifo260[3]; /* 0x00005040 */ + u32 TxPktFifo260_rsv3; + u32 TxPktFifo261[3]; /* 0x00005050 */ + u32 TxPktFifo261_rsv3; + u32 TxPktFifo262[3]; /* 0x00005060 */ + u32 TxPktFifo262_rsv3; + u32 TxPktFifo263[3]; /* 0x00005070 */ + u32 TxPktFifo263_rsv3; + u32 TxPktFifo264[3]; /* 0x00005080 */ + u32 TxPktFifo264_rsv3; + u32 TxPktFifo265[3]; /* 0x00005090 */ + u32 TxPktFifo265_rsv3; + u32 TxPktFifo266[3]; /* 0x000050a0 */ + u32 TxPktFifo266_rsv3; + u32 TxPktFifo267[3]; /* 0x000050b0 */ + u32 TxPktFifo267_rsv3; + u32 TxPktFifo268[3]; /* 0x000050c0 */ + u32 TxPktFifo268_rsv3; + u32 TxPktFifo269[3]; /* 0x000050d0 */ + u32 TxPktFifo269_rsv3; + u32 TxPktFifo270[3]; /* 0x000050e0 */ + u32 TxPktFifo270_rsv3; + u32 TxPktFifo271[3]; /* 0x000050f0 */ + u32 TxPktFifo271_rsv3; + u32 TxPktFifo272[3]; /* 0x00005100 */ + u32 TxPktFifo272_rsv3; + u32 TxPktFifo273[3]; /* 0x00005110 */ + u32 TxPktFifo273_rsv3; + u32 TxPktFifo274[3]; /* 0x00005120 */ + u32 TxPktFifo274_rsv3; + u32 TxPktFifo275[3]; /* 0x00005130 */ + u32 TxPktFifo275_rsv3; + u32 TxPktFifo276[3]; /* 0x00005140 */ + u32 TxPktFifo276_rsv3; + u32 TxPktFifo277[3]; /* 0x00005150 */ + u32 TxPktFifo277_rsv3; + u32 TxPktFifo278[3]; /* 0x00005160 */ + u32 TxPktFifo278_rsv3; + u32 TxPktFifo279[3]; /* 0x00005170 */ + u32 TxPktFifo279_rsv3; + u32 TxPktFifo280[3]; /* 0x00005180 */ + u32 TxPktFifo280_rsv3; + u32 TxPktFifo281[3]; /* 0x00005190 */ + u32 TxPktFifo281_rsv3; + u32 TxPktFifo282[3]; /* 0x000051a0 */ + u32 TxPktFifo282_rsv3; + u32 TxPktFifo283[3]; /* 0x000051b0 */ + u32 TxPktFifo283_rsv3; + u32 TxPktFifo284[3]; /* 0x000051c0 */ + u32 TxPktFifo284_rsv3; + u32 TxPktFifo285[3]; /* 0x000051d0 */ + u32 TxPktFifo285_rsv3; + u32 TxPktFifo286[3]; /* 0x000051e0 */ + u32 TxPktFifo286_rsv3; + u32 TxPktFifo287[3]; /* 0x000051f0 */ + u32 TxPktFifo287_rsv3; + u32 TxPktFifo288[3]; /* 0x00005200 */ + u32 TxPktFifo288_rsv3; + u32 TxPktFifo289[3]; /* 0x00005210 */ + u32 TxPktFifo289_rsv3; + u32 TxPktFifo290[3]; /* 0x00005220 */ + u32 TxPktFifo290_rsv3; + u32 TxPktFifo291[3]; /* 0x00005230 */ + u32 TxPktFifo291_rsv3; + u32 TxPktFifo292[3]; /* 0x00005240 */ + u32 TxPktFifo292_rsv3; + u32 TxPktFifo293[3]; /* 0x00005250 */ + u32 TxPktFifo293_rsv3; + u32 TxPktFifo294[3]; /* 0x00005260 */ + u32 TxPktFifo294_rsv3; + u32 TxPktFifo295[3]; /* 0x00005270 */ + u32 TxPktFifo295_rsv3; + u32 TxPktFifo296[3]; /* 0x00005280 */ + u32 TxPktFifo296_rsv3; + u32 TxPktFifo297[3]; /* 0x00005290 */ + u32 TxPktFifo297_rsv3; + u32 TxPktFifo298[3]; /* 0x000052a0 */ + u32 TxPktFifo298_rsv3; + u32 TxPktFifo299[3]; /* 0x000052b0 */ + u32 TxPktFifo299_rsv3; + u32 TxPktFifo300[3]; /* 0x000052c0 */ + u32 TxPktFifo300_rsv3; + u32 TxPktFifo301[3]; /* 0x000052d0 */ + u32 TxPktFifo301_rsv3; + u32 TxPktFifo302[3]; /* 0x000052e0 */ + u32 TxPktFifo302_rsv3; + u32 TxPktFifo303[3]; /* 0x000052f0 */ + u32 TxPktFifo303_rsv3; + u32 TxPktFifo304[3]; /* 0x00005300 */ + u32 TxPktFifo304_rsv3; + u32 TxPktFifo305[3]; /* 0x00005310 */ + u32 TxPktFifo305_rsv3; + u32 TxPktFifo306[3]; /* 0x00005320 */ + u32 TxPktFifo306_rsv3; + u32 TxPktFifo307[3]; /* 0x00005330 */ + u32 TxPktFifo307_rsv3; + u32 TxPktFifo308[3]; /* 0x00005340 */ + u32 TxPktFifo308_rsv3; + u32 TxPktFifo309[3]; /* 0x00005350 */ + u32 TxPktFifo309_rsv3; + u32 TxPktFifo310[3]; /* 0x00005360 */ + u32 TxPktFifo310_rsv3; + u32 TxPktFifo311[3]; /* 0x00005370 */ + u32 TxPktFifo311_rsv3; + u32 TxPktFifo312[3]; /* 0x00005380 */ + u32 TxPktFifo312_rsv3; + u32 TxPktFifo313[3]; /* 0x00005390 */ + u32 TxPktFifo313_rsv3; + u32 TxPktFifo314[3]; /* 0x000053a0 */ + u32 TxPktFifo314_rsv3; + u32 TxPktFifo315[3]; /* 0x000053b0 */ + u32 TxPktFifo315_rsv3; + u32 TxPktFifo316[3]; /* 0x000053c0 */ + u32 TxPktFifo316_rsv3; + u32 TxPktFifo317[3]; /* 0x000053d0 */ + u32 TxPktFifo317_rsv3; + u32 TxPktFifo318[3]; /* 0x000053e0 */ + u32 TxPktFifo318_rsv3; + u32 TxPktFifo319[3]; /* 0x000053f0 */ + u32 TxPktFifo319_rsv3; + u32 TxPktFifo320[3]; /* 0x00005400 */ + u32 TxPktFifo320_rsv3; + u32 TxPktFifo321[3]; /* 0x00005410 */ + u32 TxPktFifo321_rsv3; + u32 TxPktFifo322[3]; /* 0x00005420 */ + u32 TxPktFifo322_rsv3; + u32 TxPktFifo323[3]; /* 0x00005430 */ + u32 TxPktFifo323_rsv3; + u32 TxPktFifo324[3]; /* 0x00005440 */ + u32 TxPktFifo324_rsv3; + u32 TxPktFifo325[3]; /* 0x00005450 */ + u32 TxPktFifo325_rsv3; + u32 TxPktFifo326[3]; /* 0x00005460 */ + u32 TxPktFifo326_rsv3; + u32 TxPktFifo327[3]; /* 0x00005470 */ + u32 TxPktFifo327_rsv3; + u32 TxPktFifo328[3]; /* 0x00005480 */ + u32 TxPktFifo328_rsv3; + u32 TxPktFifo329[3]; /* 0x00005490 */ + u32 TxPktFifo329_rsv3; + u32 TxPktFifo330[3]; /* 0x000054a0 */ + u32 TxPktFifo330_rsv3; + u32 TxPktFifo331[3]; /* 0x000054b0 */ + u32 TxPktFifo331_rsv3; + u32 TxPktFifo332[3]; /* 0x000054c0 */ + u32 TxPktFifo332_rsv3; + u32 TxPktFifo333[3]; /* 0x000054d0 */ + u32 TxPktFifo333_rsv3; + u32 TxPktFifo334[3]; /* 0x000054e0 */ + u32 TxPktFifo334_rsv3; + u32 TxPktFifo335[3]; /* 0x000054f0 */ + u32 TxPktFifo335_rsv3; + u32 TxPktFifo336[3]; /* 0x00005500 */ + u32 TxPktFifo336_rsv3; + u32 TxPktFifo337[3]; /* 0x00005510 */ + u32 TxPktFifo337_rsv3; + u32 TxPktFifo338[3]; /* 0x00005520 */ + u32 TxPktFifo338_rsv3; + u32 TxPktFifo339[3]; /* 0x00005530 */ + u32 TxPktFifo339_rsv3; + u32 TxPktFifo340[3]; /* 0x00005540 */ + u32 TxPktFifo340_rsv3; + u32 TxPktFifo341[3]; /* 0x00005550 */ + u32 TxPktFifo341_rsv3; + u32 TxPktFifo342[3]; /* 0x00005560 */ + u32 TxPktFifo342_rsv3; + u32 TxPktFifo343[3]; /* 0x00005570 */ + u32 TxPktFifo343_rsv3; + u32 TxPktFifo344[3]; /* 0x00005580 */ + u32 TxPktFifo344_rsv3; + u32 TxPktFifo345[3]; /* 0x00005590 */ + u32 TxPktFifo345_rsv3; + u32 TxPktFifo346[3]; /* 0x000055a0 */ + u32 TxPktFifo346_rsv3; + u32 TxPktFifo347[3]; /* 0x000055b0 */ + u32 TxPktFifo347_rsv3; + u32 TxPktFifo348[3]; /* 0x000055c0 */ + u32 TxPktFifo348_rsv3; + u32 TxPktFifo349[3]; /* 0x000055d0 */ + u32 TxPktFifo349_rsv3; + u32 TxPktFifo350[3]; /* 0x000055e0 */ + u32 TxPktFifo350_rsv3; + u32 TxPktFifo351[3]; /* 0x000055f0 */ + u32 TxPktFifo351_rsv3; + u32 TxPktFifo352[3]; /* 0x00005600 */ + u32 TxPktFifo352_rsv3; + u32 TxPktFifo353[3]; /* 0x00005610 */ + u32 TxPktFifo353_rsv3; + u32 TxPktFifo354[3]; /* 0x00005620 */ + u32 TxPktFifo354_rsv3; + u32 TxPktFifo355[3]; /* 0x00005630 */ + u32 TxPktFifo355_rsv3; + u32 TxPktFifo356[3]; /* 0x00005640 */ + u32 TxPktFifo356_rsv3; + u32 TxPktFifo357[3]; /* 0x00005650 */ + u32 TxPktFifo357_rsv3; + u32 TxPktFifo358[3]; /* 0x00005660 */ + u32 TxPktFifo358_rsv3; + u32 TxPktFifo359[3]; /* 0x00005670 */ + u32 TxPktFifo359_rsv3; + u32 TxPktFifo360[3]; /* 0x00005680 */ + u32 TxPktFifo360_rsv3; + u32 TxPktFifo361[3]; /* 0x00005690 */ + u32 TxPktFifo361_rsv3; + u32 TxPktFifo362[3]; /* 0x000056a0 */ + u32 TxPktFifo362_rsv3; + u32 TxPktFifo363[3]; /* 0x000056b0 */ + u32 TxPktFifo363_rsv3; + u32 TxPktFifo364[3]; /* 0x000056c0 */ + u32 TxPktFifo364_rsv3; + u32 TxPktFifo365[3]; /* 0x000056d0 */ + u32 TxPktFifo365_rsv3; + u32 TxPktFifo366[3]; /* 0x000056e0 */ + u32 TxPktFifo366_rsv3; + u32 TxPktFifo367[3]; /* 0x000056f0 */ + u32 TxPktFifo367_rsv3; + u32 TxPktFifo368[3]; /* 0x00005700 */ + u32 TxPktFifo368_rsv3; + u32 TxPktFifo369[3]; /* 0x00005710 */ + u32 TxPktFifo369_rsv3; + u32 TxPktFifo370[3]; /* 0x00005720 */ + u32 TxPktFifo370_rsv3; + u32 TxPktFifo371[3]; /* 0x00005730 */ + u32 TxPktFifo371_rsv3; + u32 TxPktFifo372[3]; /* 0x00005740 */ + u32 TxPktFifo372_rsv3; + u32 TxPktFifo373[3]; /* 0x00005750 */ + u32 TxPktFifo373_rsv3; + u32 TxPktFifo374[3]; /* 0x00005760 */ + u32 TxPktFifo374_rsv3; + u32 TxPktFifo375[3]; /* 0x00005770 */ + u32 TxPktFifo375_rsv3; + u32 TxPktFifo376[3]; /* 0x00005780 */ + u32 TxPktFifo376_rsv3; + u32 TxPktFifo377[3]; /* 0x00005790 */ + u32 TxPktFifo377_rsv3; + u32 TxPktFifo378[3]; /* 0x000057a0 */ + u32 TxPktFifo378_rsv3; + u32 TxPktFifo379[3]; /* 0x000057b0 */ + u32 TxPktFifo379_rsv3; + u32 TxPktFifo380[3]; /* 0x000057c0 */ + u32 TxPktFifo380_rsv3; + u32 TxPktFifo381[3]; /* 0x000057d0 */ + u32 TxPktFifo381_rsv3; + u32 TxPktFifo382[3]; /* 0x000057e0 */ + u32 TxPktFifo382_rsv3; + u32 TxPktFifo383[3]; /* 0x000057f0 */ + u32 TxPktFifo383_rsv3; + u32 TxPktFifo384[3]; /* 0x00005800 */ + u32 TxPktFifo384_rsv3; + u32 TxPktFifo385[3]; /* 0x00005810 */ + u32 TxPktFifo385_rsv3; + u32 TxPktFifo386[3]; /* 0x00005820 */ + u32 TxPktFifo386_rsv3; + u32 TxPktFifo387[3]; /* 0x00005830 */ + u32 TxPktFifo387_rsv3; + u32 TxPktFifo388[3]; /* 0x00005840 */ + u32 TxPktFifo388_rsv3; + u32 TxPktFifo389[3]; /* 0x00005850 */ + u32 TxPktFifo389_rsv3; + u32 TxPktFifo390[3]; /* 0x00005860 */ + u32 TxPktFifo390_rsv3; + u32 TxPktFifo391[3]; /* 0x00005870 */ + u32 TxPktFifo391_rsv3; + u32 TxPktFifo392[3]; /* 0x00005880 */ + u32 TxPktFifo392_rsv3; + u32 TxPktFifo393[3]; /* 0x00005890 */ + u32 TxPktFifo393_rsv3; + u32 TxPktFifo394[3]; /* 0x000058a0 */ + u32 TxPktFifo394_rsv3; + u32 TxPktFifo395[3]; /* 0x000058b0 */ + u32 TxPktFifo395_rsv3; + u32 TxPktFifo396[3]; /* 0x000058c0 */ + u32 TxPktFifo396_rsv3; + u32 TxPktFifo397[3]; /* 0x000058d0 */ + u32 TxPktFifo397_rsv3; + u32 TxPktFifo398[3]; /* 0x000058e0 */ + u32 TxPktFifo398_rsv3; + u32 TxPktFifo399[3]; /* 0x000058f0 */ + u32 TxPktFifo399_rsv3; + u32 TxPktFifo400[3]; /* 0x00005900 */ + u32 TxPktFifo400_rsv3; + u32 TxPktFifo401[3]; /* 0x00005910 */ + u32 TxPktFifo401_rsv3; + u32 TxPktFifo402[3]; /* 0x00005920 */ + u32 TxPktFifo402_rsv3; + u32 TxPktFifo403[3]; /* 0x00005930 */ + u32 TxPktFifo403_rsv3; + u32 TxPktFifo404[3]; /* 0x00005940 */ + u32 TxPktFifo404_rsv3; + u32 TxPktFifo405[3]; /* 0x00005950 */ + u32 TxPktFifo405_rsv3; + u32 TxPktFifo406[3]; /* 0x00005960 */ + u32 TxPktFifo406_rsv3; + u32 TxPktFifo407[3]; /* 0x00005970 */ + u32 TxPktFifo407_rsv3; + u32 TxPktFifo408[3]; /* 0x00005980 */ + u32 TxPktFifo408_rsv3; + u32 TxPktFifo409[3]; /* 0x00005990 */ + u32 TxPktFifo409_rsv3; + u32 TxPktFifo410[3]; /* 0x000059a0 */ + u32 TxPktFifo410_rsv3; + u32 TxPktFifo411[3]; /* 0x000059b0 */ + u32 TxPktFifo411_rsv3; + u32 TxPktFifo412[3]; /* 0x000059c0 */ + u32 TxPktFifo412_rsv3; + u32 TxPktFifo413[3]; /* 0x000059d0 */ + u32 TxPktFifo413_rsv3; + u32 TxPktFifo414[3]; /* 0x000059e0 */ + u32 TxPktFifo414_rsv3; + u32 TxPktFifo415[3]; /* 0x000059f0 */ + u32 TxPktFifo415_rsv3; + u32 TxPktFifo416[3]; /* 0x00005a00 */ + u32 TxPktFifo416_rsv3; + u32 TxPktFifo417[3]; /* 0x00005a10 */ + u32 TxPktFifo417_rsv3; + u32 TxPktFifo418[3]; /* 0x00005a20 */ + u32 TxPktFifo418_rsv3; + u32 TxPktFifo419[3]; /* 0x00005a30 */ + u32 TxPktFifo419_rsv3; + u32 TxPktFifo420[3]; /* 0x00005a40 */ + u32 TxPktFifo420_rsv3; + u32 TxPktFifo421[3]; /* 0x00005a50 */ + u32 TxPktFifo421_rsv3; + u32 TxPktFifo422[3]; /* 0x00005a60 */ + u32 TxPktFifo422_rsv3; + u32 TxPktFifo423[3]; /* 0x00005a70 */ + u32 TxPktFifo423_rsv3; + u32 TxPktFifo424[3]; /* 0x00005a80 */ + u32 TxPktFifo424_rsv3; + u32 TxPktFifo425[3]; /* 0x00005a90 */ + u32 TxPktFifo425_rsv3; + u32 TxPktFifo426[3]; /* 0x00005aa0 */ + u32 TxPktFifo426_rsv3; + u32 TxPktFifo427[3]; /* 0x00005ab0 */ + u32 TxPktFifo427_rsv3; + u32 TxPktFifo428[3]; /* 0x00005ac0 */ + u32 TxPktFifo428_rsv3; + u32 TxPktFifo429[3]; /* 0x00005ad0 */ + u32 TxPktFifo429_rsv3; + u32 TxPktFifo430[3]; /* 0x00005ae0 */ + u32 TxPktFifo430_rsv3; + u32 TxPktFifo431[3]; /* 0x00005af0 */ + u32 TxPktFifo431_rsv3; + u32 TxPktFifo432[3]; /* 0x00005b00 */ + u32 TxPktFifo432_rsv3; + u32 TxPktFifo433[3]; /* 0x00005b10 */ + u32 TxPktFifo433_rsv3; + u32 TxPktFifo434[3]; /* 0x00005b20 */ + u32 TxPktFifo434_rsv3; + u32 TxPktFifo435[3]; /* 0x00005b30 */ + u32 TxPktFifo435_rsv3; + u32 TxPktFifo436[3]; /* 0x00005b40 */ + u32 TxPktFifo436_rsv3; + u32 TxPktFifo437[3]; /* 0x00005b50 */ + u32 TxPktFifo437_rsv3; + u32 TxPktFifo438[3]; /* 0x00005b60 */ + u32 TxPktFifo438_rsv3; + u32 TxPktFifo439[3]; /* 0x00005b70 */ + u32 TxPktFifo439_rsv3; + u32 TxPktFifo440[3]; /* 0x00005b80 */ + u32 TxPktFifo440_rsv3; + u32 TxPktFifo441[3]; /* 0x00005b90 */ + u32 TxPktFifo441_rsv3; + u32 TxPktFifo442[3]; /* 0x00005ba0 */ + u32 TxPktFifo442_rsv3; + u32 TxPktFifo443[3]; /* 0x00005bb0 */ + u32 TxPktFifo443_rsv3; + u32 TxPktFifo444[3]; /* 0x00005bc0 */ + u32 TxPktFifo444_rsv3; + u32 TxPktFifo445[3]; /* 0x00005bd0 */ + u32 TxPktFifo445_rsv3; + u32 TxPktFifo446[3]; /* 0x00005be0 */ + u32 TxPktFifo446_rsv3; + u32 TxPktFifo447[3]; /* 0x00005bf0 */ + u32 TxPktFifo447_rsv3; + u32 TxPktFifo448[3]; /* 0x00005c00 */ + u32 TxPktFifo448_rsv3; + u32 TxPktFifo449[3]; /* 0x00005c10 */ + u32 TxPktFifo449_rsv3; + u32 TxPktFifo450[3]; /* 0x00005c20 */ + u32 TxPktFifo450_rsv3; + u32 TxPktFifo451[3]; /* 0x00005c30 */ + u32 TxPktFifo451_rsv3; + u32 TxPktFifo452[3]; /* 0x00005c40 */ + u32 TxPktFifo452_rsv3; + u32 TxPktFifo453[3]; /* 0x00005c50 */ + u32 TxPktFifo453_rsv3; + u32 TxPktFifo454[3]; /* 0x00005c60 */ + u32 TxPktFifo454_rsv3; + u32 TxPktFifo455[3]; /* 0x00005c70 */ + u32 TxPktFifo455_rsv3; + u32 TxPktFifo456[3]; /* 0x00005c80 */ + u32 TxPktFifo456_rsv3; + u32 TxPktFifo457[3]; /* 0x00005c90 */ + u32 TxPktFifo457_rsv3; + u32 TxPktFifo458[3]; /* 0x00005ca0 */ + u32 TxPktFifo458_rsv3; + u32 TxPktFifo459[3]; /* 0x00005cb0 */ + u32 TxPktFifo459_rsv3; + u32 TxPktFifo460[3]; /* 0x00005cc0 */ + u32 TxPktFifo460_rsv3; + u32 TxPktFifo461[3]; /* 0x00005cd0 */ + u32 TxPktFifo461_rsv3; + u32 TxPktFifo462[3]; /* 0x00005ce0 */ + u32 TxPktFifo462_rsv3; + u32 TxPktFifo463[3]; /* 0x00005cf0 */ + u32 TxPktFifo463_rsv3; + u32 TxPktFifo464[3]; /* 0x00005d00 */ + u32 TxPktFifo464_rsv3; + u32 TxPktFifo465[3]; /* 0x00005d10 */ + u32 TxPktFifo465_rsv3; + u32 TxPktFifo466[3]; /* 0x00005d20 */ + u32 TxPktFifo466_rsv3; + u32 TxPktFifo467[3]; /* 0x00005d30 */ + u32 TxPktFifo467_rsv3; + u32 TxPktFifo468[3]; /* 0x00005d40 */ + u32 TxPktFifo468_rsv3; + u32 TxPktFifo469[3]; /* 0x00005d50 */ + u32 TxPktFifo469_rsv3; + u32 TxPktFifo470[3]; /* 0x00005d60 */ + u32 TxPktFifo470_rsv3; + u32 TxPktFifo471[3]; /* 0x00005d70 */ + u32 TxPktFifo471_rsv3; + u32 TxPktFifo472[3]; /* 0x00005d80 */ + u32 TxPktFifo472_rsv3; + u32 TxPktFifo473[3]; /* 0x00005d90 */ + u32 TxPktFifo473_rsv3; + u32 TxPktFifo474[3]; /* 0x00005da0 */ + u32 TxPktFifo474_rsv3; + u32 TxPktFifo475[3]; /* 0x00005db0 */ + u32 TxPktFifo475_rsv3; + u32 TxPktFifo476[3]; /* 0x00005dc0 */ + u32 TxPktFifo476_rsv3; + u32 TxPktFifo477[3]; /* 0x00005dd0 */ + u32 TxPktFifo477_rsv3; + u32 TxPktFifo478[3]; /* 0x00005de0 */ + u32 TxPktFifo478_rsv3; + u32 TxPktFifo479[3]; /* 0x00005df0 */ + u32 TxPktFifo479_rsv3; + u32 TxPktFifo480[3]; /* 0x00005e00 */ + u32 TxPktFifo480_rsv3; + u32 TxPktFifo481[3]; /* 0x00005e10 */ + u32 TxPktFifo481_rsv3; + u32 TxPktFifo482[3]; /* 0x00005e20 */ + u32 TxPktFifo482_rsv3; + u32 TxPktFifo483[3]; /* 0x00005e30 */ + u32 TxPktFifo483_rsv3; + u32 TxPktFifo484[3]; /* 0x00005e40 */ + u32 TxPktFifo484_rsv3; + u32 TxPktFifo485[3]; /* 0x00005e50 */ + u32 TxPktFifo485_rsv3; + u32 TxPktFifo486[3]; /* 0x00005e60 */ + u32 TxPktFifo486_rsv3; + u32 TxPktFifo487[3]; /* 0x00005e70 */ + u32 TxPktFifo487_rsv3; + u32 TxPktFifo488[3]; /* 0x00005e80 */ + u32 TxPktFifo488_rsv3; + u32 TxPktFifo489[3]; /* 0x00005e90 */ + u32 TxPktFifo489_rsv3; + u32 TxPktFifo490[3]; /* 0x00005ea0 */ + u32 TxPktFifo490_rsv3; + u32 TxPktFifo491[3]; /* 0x00005eb0 */ + u32 TxPktFifo491_rsv3; + u32 TxPktFifo492[3]; /* 0x00005ec0 */ + u32 TxPktFifo492_rsv3; + u32 TxPktFifo493[3]; /* 0x00005ed0 */ + u32 TxPktFifo493_rsv3; + u32 TxPktFifo494[3]; /* 0x00005ee0 */ + u32 TxPktFifo494_rsv3; + u32 TxPktFifo495[3]; /* 0x00005ef0 */ + u32 TxPktFifo495_rsv3; + u32 TxPktFifo496[3]; /* 0x00005f00 */ + u32 TxPktFifo496_rsv3; + u32 TxPktFifo497[3]; /* 0x00005f10 */ + u32 TxPktFifo497_rsv3; + u32 TxPktFifo498[3]; /* 0x00005f20 */ + u32 TxPktFifo498_rsv3; + u32 TxPktFifo499[3]; /* 0x00005f30 */ + u32 TxPktFifo499_rsv3; + u32 TxPktFifo500[3]; /* 0x00005f40 */ + u32 TxPktFifo500_rsv3; + u32 TxPktFifo501[3]; /* 0x00005f50 */ + u32 TxPktFifo501_rsv3; + u32 TxPktFifo502[3]; /* 0x00005f60 */ + u32 TxPktFifo502_rsv3; + u32 TxPktFifo503[3]; /* 0x00005f70 */ + u32 TxPktFifo503_rsv3; + u32 TxPktFifo504[3]; /* 0x00005f80 */ + u32 TxPktFifo504_rsv3; + u32 TxPktFifo505[3]; /* 0x00005f90 */ + u32 TxPktFifo505_rsv3; + u32 TxPktFifo506[3]; /* 0x00005fa0 */ + u32 TxPktFifo506_rsv3; + u32 TxPktFifo507[3]; /* 0x00005fb0 */ + u32 TxPktFifo507_rsv3; + u32 TxPktFifo508[3]; /* 0x00005fc0 */ + u32 TxPktFifo508_rsv3; + u32 TxPktFifo509[3]; /* 0x00005fd0 */ + u32 TxPktFifo509_rsv3; + u32 TxPktFifo510[3]; /* 0x00005fe0 */ + u32 TxPktFifo510_rsv3; + u32 TxPktFifo511[3]; /* 0x00005ff0 */ + u32 TxPktFifo511_rsv3; + u32 TxPktFifo512[3]; /* 0x00006000 */ + u32 TxPktFifo512_rsv3; + u32 TxPktFifo513[3]; /* 0x00006010 */ + u32 TxPktFifo513_rsv3; + u32 TxPktFifo514[3]; /* 0x00006020 */ + u32 TxPktFifo514_rsv3; + u32 TxPktFifo515[3]; /* 0x00006030 */ + u32 TxPktFifo515_rsv3; + u32 TxPktFifo516[3]; /* 0x00006040 */ + u32 TxPktFifo516_rsv3; + u32 TxPktFifo517[3]; /* 0x00006050 */ + u32 TxPktFifo517_rsv3; + u32 TxPktFifo518[3]; /* 0x00006060 */ + u32 TxPktFifo518_rsv3; + u32 TxPktFifo519[3]; /* 0x00006070 */ + u32 TxPktFifo519_rsv3; + u32 TxPktFifo520[3]; /* 0x00006080 */ + u32 TxPktFifo520_rsv3; + u32 TxPktFifo521[3]; /* 0x00006090 */ + u32 TxPktFifo521_rsv3; + u32 TxPktFifo522[3]; /* 0x000060a0 */ + u32 TxPktFifo522_rsv3; + u32 TxPktFifo523[3]; /* 0x000060b0 */ + u32 TxPktFifo523_rsv3; + u32 TxPktFifo524[3]; /* 0x000060c0 */ + u32 TxPktFifo524_rsv3; + u32 TxPktFifo525[3]; /* 0x000060d0 */ + u32 TxPktFifo525_rsv3; + u32 TxPktFifo526[3]; /* 0x000060e0 */ + u32 TxPktFifo526_rsv3; + u32 TxPktFifo527[3]; /* 0x000060f0 */ + u32 TxPktFifo527_rsv3; + u32 TxPktFifo528[3]; /* 0x00006100 */ + u32 TxPktFifo528_rsv3; + u32 TxPktFifo529[3]; /* 0x00006110 */ + u32 TxPktFifo529_rsv3; + u32 TxPktFifo530[3]; /* 0x00006120 */ + u32 TxPktFifo530_rsv3; + u32 TxPktFifo531[3]; /* 0x00006130 */ + u32 TxPktFifo531_rsv3; + u32 TxPktFifo532[3]; /* 0x00006140 */ + u32 TxPktFifo532_rsv3; + u32 TxPktFifo533[3]; /* 0x00006150 */ + u32 TxPktFifo533_rsv3; + u32 TxPktFifo534[3]; /* 0x00006160 */ + u32 TxPktFifo534_rsv3; + u32 TxPktFifo535[3]; /* 0x00006170 */ + u32 TxPktFifo535_rsv3; + u32 TxPktFifo536[3]; /* 0x00006180 */ + u32 TxPktFifo536_rsv3; + u32 TxPktFifo537[3]; /* 0x00006190 */ + u32 TxPktFifo537_rsv3; + u32 TxPktFifo538[3]; /* 0x000061a0 */ + u32 TxPktFifo538_rsv3; + u32 TxPktFifo539[3]; /* 0x000061b0 */ + u32 TxPktFifo539_rsv3; + u32 TxPktFifo540[3]; /* 0x000061c0 */ + u32 TxPktFifo540_rsv3; + u32 TxPktFifo541[3]; /* 0x000061d0 */ + u32 TxPktFifo541_rsv3; + u32 TxPktFifo542[3]; /* 0x000061e0 */ + u32 TxPktFifo542_rsv3; + u32 TxPktFifo543[3]; /* 0x000061f0 */ + u32 TxPktFifo543_rsv3; + u32 TxPktFifo544[3]; /* 0x00006200 */ + u32 TxPktFifo544_rsv3; + u32 TxPktFifo545[3]; /* 0x00006210 */ + u32 TxPktFifo545_rsv3; + u32 TxPktFifo546[3]; /* 0x00006220 */ + u32 TxPktFifo546_rsv3; + u32 TxPktFifo547[3]; /* 0x00006230 */ + u32 TxPktFifo547_rsv3; + u32 TxPktFifo548[3]; /* 0x00006240 */ + u32 TxPktFifo548_rsv3; + u32 TxPktFifo549[3]; /* 0x00006250 */ + u32 TxPktFifo549_rsv3; + u32 TxPktFifo550[3]; /* 0x00006260 */ + u32 TxPktFifo550_rsv3; + u32 TxPktFifo551[3]; /* 0x00006270 */ + u32 TxPktFifo551_rsv3; + u32 TxPktFifo552[3]; /* 0x00006280 */ + u32 TxPktFifo552_rsv3; + u32 TxPktFifo553[3]; /* 0x00006290 */ + u32 TxPktFifo553_rsv3; + u32 TxPktFifo554[3]; /* 0x000062a0 */ + u32 TxPktFifo554_rsv3; + u32 TxPktFifo555[3]; /* 0x000062b0 */ + u32 TxPktFifo555_rsv3; + u32 TxPktFifo556[3]; /* 0x000062c0 */ + u32 TxPktFifo556_rsv3; + u32 TxPktFifo557[3]; /* 0x000062d0 */ + u32 TxPktFifo557_rsv3; + u32 TxPktFifo558[3]; /* 0x000062e0 */ + u32 TxPktFifo558_rsv3; + u32 TxPktFifo559[3]; /* 0x000062f0 */ + u32 TxPktFifo559_rsv3; + u32 TxPktFifo560[3]; /* 0x00006300 */ + u32 TxPktFifo560_rsv3; + u32 TxPktFifo561[3]; /* 0x00006310 */ + u32 TxPktFifo561_rsv3; + u32 TxPktFifo562[3]; /* 0x00006320 */ + u32 TxPktFifo562_rsv3; + u32 TxPktFifo563[3]; /* 0x00006330 */ + u32 TxPktFifo563_rsv3; + u32 TxPktFifo564[3]; /* 0x00006340 */ + u32 TxPktFifo564_rsv3; + u32 TxPktFifo565[3]; /* 0x00006350 */ + u32 TxPktFifo565_rsv3; + u32 TxPktFifo566[3]; /* 0x00006360 */ + u32 TxPktFifo566_rsv3; + u32 TxPktFifo567[3]; /* 0x00006370 */ + u32 TxPktFifo567_rsv3; + u32 TxPktFifo568[3]; /* 0x00006380 */ + u32 TxPktFifo568_rsv3; + u32 TxPktFifo569[3]; /* 0x00006390 */ + u32 TxPktFifo569_rsv3; + u32 TxPktFifo570[3]; /* 0x000063a0 */ + u32 TxPktFifo570_rsv3; + u32 TxPktFifo571[3]; /* 0x000063b0 */ + u32 TxPktFifo571_rsv3; + u32 TxPktFifo572[3]; /* 0x000063c0 */ + u32 TxPktFifo572_rsv3; + u32 TxPktFifo573[3]; /* 0x000063d0 */ + u32 TxPktFifo573_rsv3; + u32 TxPktFifo574[3]; /* 0x000063e0 */ + u32 TxPktFifo574_rsv3; + u32 TxPktFifo575[3]; /* 0x000063f0 */ + u32 TxPktFifo575_rsv3; + u32 TxPktFifo576[3]; /* 0x00006400 */ + u32 TxPktFifo576_rsv3; + u32 TxPktFifo577[3]; /* 0x00006410 */ + u32 TxPktFifo577_rsv3; + u32 TxPktFifo578[3]; /* 0x00006420 */ + u32 TxPktFifo578_rsv3; + u32 TxPktFifo579[3]; /* 0x00006430 */ + u32 TxPktFifo579_rsv3; + u32 TxPktFifo580[3]; /* 0x00006440 */ + u32 TxPktFifo580_rsv3; + u32 TxPktFifo581[3]; /* 0x00006450 */ + u32 TxPktFifo581_rsv3; + u32 TxPktFifo582[3]; /* 0x00006460 */ + u32 TxPktFifo582_rsv3; + u32 TxPktFifo583[3]; /* 0x00006470 */ + u32 TxPktFifo583_rsv3; + u32 TxPktFifo584[3]; /* 0x00006480 */ + u32 TxPktFifo584_rsv3; + u32 TxPktFifo585[3]; /* 0x00006490 */ + u32 TxPktFifo585_rsv3; + u32 TxPktFifo586[3]; /* 0x000064a0 */ + u32 TxPktFifo586_rsv3; + u32 TxPktFifo587[3]; /* 0x000064b0 */ + u32 TxPktFifo587_rsv3; + u32 TxPktFifo588[3]; /* 0x000064c0 */ + u32 TxPktFifo588_rsv3; + u32 TxPktFifo589[3]; /* 0x000064d0 */ + u32 TxPktFifo589_rsv3; + u32 TxPktFifo590[3]; /* 0x000064e0 */ + u32 TxPktFifo590_rsv3; + u32 TxPktFifo591[3]; /* 0x000064f0 */ + u32 TxPktFifo591_rsv3; + u32 TxPktFifo592[3]; /* 0x00006500 */ + u32 TxPktFifo592_rsv3; + u32 TxPktFifo593[3]; /* 0x00006510 */ + u32 TxPktFifo593_rsv3; + u32 TxPktFifo594[3]; /* 0x00006520 */ + u32 TxPktFifo594_rsv3; + u32 TxPktFifo595[3]; /* 0x00006530 */ + u32 TxPktFifo595_rsv3; + u32 TxPktFifo596[3]; /* 0x00006540 */ + u32 TxPktFifo596_rsv3; + u32 TxPktFifo597[3]; /* 0x00006550 */ + u32 TxPktFifo597_rsv3; + u32 TxPktFifo598[3]; /* 0x00006560 */ + u32 TxPktFifo598_rsv3; + u32 TxPktFifo599[3]; /* 0x00006570 */ + u32 TxPktFifo599_rsv3; + u32 TxPktFifo600[3]; /* 0x00006580 */ + u32 TxPktFifo600_rsv3; + u32 TxPktFifo601[3]; /* 0x00006590 */ + u32 TxPktFifo601_rsv3; + u32 TxPktFifo602[3]; /* 0x000065a0 */ + u32 TxPktFifo602_rsv3; + u32 TxPktFifo603[3]; /* 0x000065b0 */ + u32 TxPktFifo603_rsv3; + u32 TxPktFifo604[3]; /* 0x000065c0 */ + u32 TxPktFifo604_rsv3; + u32 TxPktFifo605[3]; /* 0x000065d0 */ + u32 TxPktFifo605_rsv3; + u32 TxPktFifo606[3]; /* 0x000065e0 */ + u32 TxPktFifo606_rsv3; + u32 TxPktFifo607[3]; /* 0x000065f0 */ + u32 TxPktFifo607_rsv3; + u32 TxPktFifo608[3]; /* 0x00006600 */ + u32 TxPktFifo608_rsv3; + u32 TxPktFifo609[3]; /* 0x00006610 */ + u32 TxPktFifo609_rsv3; + u32 TxPktFifo610[3]; /* 0x00006620 */ + u32 TxPktFifo610_rsv3; + u32 TxPktFifo611[3]; /* 0x00006630 */ + u32 TxPktFifo611_rsv3; + u32 TxPktFifo612[3]; /* 0x00006640 */ + u32 TxPktFifo612_rsv3; + u32 TxPktFifo613[3]; /* 0x00006650 */ + u32 TxPktFifo613_rsv3; + u32 TxPktFifo614[3]; /* 0x00006660 */ + u32 TxPktFifo614_rsv3; + u32 TxPktFifo615[3]; /* 0x00006670 */ + u32 TxPktFifo615_rsv3; + u32 TxPktFifo616[3]; /* 0x00006680 */ + u32 TxPktFifo616_rsv3; + u32 TxPktFifo617[3]; /* 0x00006690 */ + u32 TxPktFifo617_rsv3; + u32 TxPktFifo618[3]; /* 0x000066a0 */ + u32 TxPktFifo618_rsv3; + u32 TxPktFifo619[3]; /* 0x000066b0 */ + u32 TxPktFifo619_rsv3; + u32 TxPktFifo620[3]; /* 0x000066c0 */ + u32 TxPktFifo620_rsv3; + u32 TxPktFifo621[3]; /* 0x000066d0 */ + u32 TxPktFifo621_rsv3; + u32 TxPktFifo622[3]; /* 0x000066e0 */ + u32 TxPktFifo622_rsv3; + u32 TxPktFifo623[3]; /* 0x000066f0 */ + u32 TxPktFifo623_rsv3; + u32 TxPktFifo624[3]; /* 0x00006700 */ + u32 TxPktFifo624_rsv3; + u32 TxPktFifo625[3]; /* 0x00006710 */ + u32 TxPktFifo625_rsv3; + u32 TxPktFifo626[3]; /* 0x00006720 */ + u32 TxPktFifo626_rsv3; + u32 TxPktFifo627[3]; /* 0x00006730 */ + u32 TxPktFifo627_rsv3; + u32 TxPktFifo628[3]; /* 0x00006740 */ + u32 TxPktFifo628_rsv3; + u32 TxPktFifo629[3]; /* 0x00006750 */ + u32 TxPktFifo629_rsv3; + u32 TxPktFifo630[3]; /* 0x00006760 */ + u32 TxPktFifo630_rsv3; + u32 TxPktFifo631[3]; /* 0x00006770 */ + u32 TxPktFifo631_rsv3; + u32 TxPktFifo632[3]; /* 0x00006780 */ + u32 TxPktFifo632_rsv3; + u32 TxPktFifo633[3]; /* 0x00006790 */ + u32 TxPktFifo633_rsv3; + u32 TxPktFifo634[3]; /* 0x000067a0 */ + u32 TxPktFifo634_rsv3; + u32 TxPktFifo635[3]; /* 0x000067b0 */ + u32 TxPktFifo635_rsv3; + u32 TxPktFifo636[3]; /* 0x000067c0 */ + u32 TxPktFifo636_rsv3; + u32 TxPktFifo637[3]; /* 0x000067d0 */ + u32 TxPktFifo637_rsv3; + u32 TxPktFifo638[3]; /* 0x000067e0 */ + u32 TxPktFifo638_rsv3; + u32 TxPktFifo639[3]; /* 0x000067f0 */ + u32 TxPktFifo639_rsv3; u32 rsv6656; u32 rsv6657; u32 rsv6658; @@ -3328,331 +3402,331 @@ struct cpu_mac_mems { u32 rsv8189; u32 rsv8190; u32 rsv8191; - u32 rx_pkt_msg_fifo_0[1]; /* 0x00008000 */ - u32 rx_pkt_msg_fifo_1[1]; /* 0x00008004 */ - u32 rx_pkt_msg_fifo_2[1]; /* 0x00008008 */ - u32 rx_pkt_msg_fifo_3[1]; /* 0x0000800c */ - u32 rx_pkt_msg_fifo_4[1]; /* 0x00008010 */ - u32 rx_pkt_msg_fifo_5[1]; /* 0x00008014 */ - u32 rx_pkt_msg_fifo_6[1]; /* 0x00008018 */ - u32 rx_pkt_msg_fifo_7[1]; /* 0x0000801c */ - u32 rx_pkt_msg_fifo_8[1]; /* 0x00008020 */ - u32 rx_pkt_msg_fifo_9[1]; /* 0x00008024 */ - u32 rx_pkt_msg_fifo_10[1]; /* 0x00008028 */ - u32 rx_pkt_msg_fifo_11[1]; /* 0x0000802c */ - u32 rx_pkt_msg_fifo_12[1]; /* 0x00008030 */ - u32 rx_pkt_msg_fifo_13[1]; /* 0x00008034 */ - u32 rx_pkt_msg_fifo_14[1]; /* 0x00008038 */ - u32 rx_pkt_msg_fifo_15[1]; /* 0x0000803c */ - u32 rx_pkt_msg_fifo_16[1]; /* 0x00008040 */ - u32 rx_pkt_msg_fifo_17[1]; /* 0x00008044 */ - u32 rx_pkt_msg_fifo_18[1]; /* 0x00008048 */ - u32 rx_pkt_msg_fifo_19[1]; /* 0x0000804c */ - u32 rx_pkt_msg_fifo_20[1]; /* 0x00008050 */ - u32 rx_pkt_msg_fifo_21[1]; /* 0x00008054 */ - u32 rx_pkt_msg_fifo_22[1]; /* 0x00008058 */ - u32 rx_pkt_msg_fifo_23[1]; /* 0x0000805c */ - u32 rx_pkt_msg_fifo_24[1]; /* 0x00008060 */ - u32 rx_pkt_msg_fifo_25[1]; /* 0x00008064 */ - u32 rx_pkt_msg_fifo_26[1]; /* 0x00008068 */ - u32 rx_pkt_msg_fifo_27[1]; /* 0x0000806c */ - u32 rx_pkt_msg_fifo_28[1]; /* 0x00008070 */ - u32 rx_pkt_msg_fifo_29[1]; /* 0x00008074 */ - u32 rx_pkt_msg_fifo_30[1]; /* 0x00008078 */ - u32 rx_pkt_msg_fifo_31[1]; /* 0x0000807c */ - u32 rx_pkt_msg_fifo_32[1]; /* 0x00008080 */ - u32 rx_pkt_msg_fifo_33[1]; /* 0x00008084 */ - u32 rx_pkt_msg_fifo_34[1]; /* 0x00008088 */ - u32 rx_pkt_msg_fifo_35[1]; /* 0x0000808c */ - u32 rx_pkt_msg_fifo_36[1]; /* 0x00008090 */ - u32 rx_pkt_msg_fifo_37[1]; /* 0x00008094 */ - u32 rx_pkt_msg_fifo_38[1]; /* 0x00008098 */ - u32 rx_pkt_msg_fifo_39[1]; /* 0x0000809c */ - u32 rx_pkt_msg_fifo_40[1]; /* 0x000080a0 */ - u32 rx_pkt_msg_fifo_41[1]; /* 0x000080a4 */ - u32 rx_pkt_msg_fifo_42[1]; /* 0x000080a8 */ - u32 rx_pkt_msg_fifo_43[1]; /* 0x000080ac */ - u32 rx_pkt_msg_fifo_44[1]; /* 0x000080b0 */ - u32 rx_pkt_msg_fifo_45[1]; /* 0x000080b4 */ - u32 rx_pkt_msg_fifo_46[1]; /* 0x000080b8 */ - u32 rx_pkt_msg_fifo_47[1]; /* 0x000080bc */ - u32 rx_pkt_msg_fifo_48[1]; /* 0x000080c0 */ - u32 rx_pkt_msg_fifo_49[1]; /* 0x000080c4 */ - u32 rx_pkt_msg_fifo_50[1]; /* 0x000080c8 */ - u32 rx_pkt_msg_fifo_51[1]; /* 0x000080cc */ - u32 rx_pkt_msg_fifo_52[1]; /* 0x000080d0 */ - u32 rx_pkt_msg_fifo_53[1]; /* 0x000080d4 */ - u32 rx_pkt_msg_fifo_54[1]; /* 0x000080d8 */ - u32 rx_pkt_msg_fifo_55[1]; /* 0x000080dc */ - u32 rx_pkt_msg_fifo_56[1]; /* 0x000080e0 */ - u32 rx_pkt_msg_fifo_57[1]; /* 0x000080e4 */ - u32 rx_pkt_msg_fifo_58[1]; /* 0x000080e8 */ - u32 rx_pkt_msg_fifo_59[1]; /* 0x000080ec */ - u32 rx_pkt_msg_fifo_60[1]; /* 0x000080f0 */ - u32 rx_pkt_msg_fifo_61[1]; /* 0x000080f4 */ - u32 rx_pkt_msg_fifo_62[1]; /* 0x000080f8 */ - u32 rx_pkt_msg_fifo_63[1]; /* 0x000080fc */ - u32 rx_pkt_msg_fifo_64[1]; /* 0x00008100 */ - u32 rx_pkt_msg_fifo_65[1]; /* 0x00008104 */ - u32 rx_pkt_msg_fifo_66[1]; /* 0x00008108 */ - u32 rx_pkt_msg_fifo_67[1]; /* 0x0000810c */ - u32 rx_pkt_msg_fifo_68[1]; /* 0x00008110 */ - u32 rx_pkt_msg_fifo_69[1]; /* 0x00008114 */ - u32 rx_pkt_msg_fifo_70[1]; /* 0x00008118 */ - u32 rx_pkt_msg_fifo_71[1]; /* 0x0000811c */ - u32 rx_pkt_msg_fifo_72[1]; /* 0x00008120 */ - u32 rx_pkt_msg_fifo_73[1]; /* 0x00008124 */ - u32 rx_pkt_msg_fifo_74[1]; /* 0x00008128 */ - u32 rx_pkt_msg_fifo_75[1]; /* 0x0000812c */ - u32 rx_pkt_msg_fifo_76[1]; /* 0x00008130 */ - u32 rx_pkt_msg_fifo_77[1]; /* 0x00008134 */ - u32 rx_pkt_msg_fifo_78[1]; /* 0x00008138 */ - u32 rx_pkt_msg_fifo_79[1]; /* 0x0000813c */ - u32 rx_pkt_msg_fifo_80[1]; /* 0x00008140 */ - u32 rx_pkt_msg_fifo_81[1]; /* 0x00008144 */ - u32 rx_pkt_msg_fifo_82[1]; /* 0x00008148 */ - u32 rx_pkt_msg_fifo_83[1]; /* 0x0000814c */ - u32 rx_pkt_msg_fifo_84[1]; /* 0x00008150 */ - u32 rx_pkt_msg_fifo_85[1]; /* 0x00008154 */ - u32 rx_pkt_msg_fifo_86[1]; /* 0x00008158 */ - u32 rx_pkt_msg_fifo_87[1]; /* 0x0000815c */ - u32 rx_pkt_msg_fifo_88[1]; /* 0x00008160 */ - u32 rx_pkt_msg_fifo_89[1]; /* 0x00008164 */ - u32 rx_pkt_msg_fifo_90[1]; /* 0x00008168 */ - u32 rx_pkt_msg_fifo_91[1]; /* 0x0000816c */ - u32 rx_pkt_msg_fifo_92[1]; /* 0x00008170 */ - u32 rx_pkt_msg_fifo_93[1]; /* 0x00008174 */ - u32 rx_pkt_msg_fifo_94[1]; /* 0x00008178 */ - u32 rx_pkt_msg_fifo_95[1]; /* 0x0000817c */ - u32 rx_pkt_msg_fifo_96[1]; /* 0x00008180 */ - u32 rx_pkt_msg_fifo_97[1]; /* 0x00008184 */ - u32 rx_pkt_msg_fifo_98[1]; /* 0x00008188 */ - u32 rx_pkt_msg_fifo_99[1]; /* 0x0000818c */ - u32 rx_pkt_msg_fifo_100[1]; /* 0x00008190 */ - u32 rx_pkt_msg_fifo_101[1]; /* 0x00008194 */ - u32 rx_pkt_msg_fifo_102[1]; /* 0x00008198 */ - u32 rx_pkt_msg_fifo_103[1]; /* 0x0000819c */ - u32 rx_pkt_msg_fifo_104[1]; /* 0x000081a0 */ - u32 rx_pkt_msg_fifo_105[1]; /* 0x000081a4 */ - u32 rx_pkt_msg_fifo_106[1]; /* 0x000081a8 */ - u32 rx_pkt_msg_fifo_107[1]; /* 0x000081ac */ - u32 rx_pkt_msg_fifo_108[1]; /* 0x000081b0 */ - u32 rx_pkt_msg_fifo_109[1]; /* 0x000081b4 */ - u32 rx_pkt_msg_fifo_110[1]; /* 0x000081b8 */ - u32 rx_pkt_msg_fifo_111[1]; /* 0x000081bc */ - u32 rx_pkt_msg_fifo_112[1]; /* 0x000081c0 */ - u32 rx_pkt_msg_fifo_113[1]; /* 0x000081c4 */ - u32 rx_pkt_msg_fifo_114[1]; /* 0x000081c8 */ - u32 rx_pkt_msg_fifo_115[1]; /* 0x000081cc */ - u32 rx_pkt_msg_fifo_116[1]; /* 0x000081d0 */ - u32 rx_pkt_msg_fifo_117[1]; /* 0x000081d4 */ - u32 rx_pkt_msg_fifo_118[1]; /* 0x000081d8 */ - u32 rx_pkt_msg_fifo_119[1]; /* 0x000081dc */ - u32 rx_pkt_msg_fifo_120[1]; /* 0x000081e0 */ - u32 rx_pkt_msg_fifo_121[1]; /* 0x000081e4 */ - u32 rx_pkt_msg_fifo_122[1]; /* 0x000081e8 */ - u32 rx_pkt_msg_fifo_123[1]; /* 0x000081ec */ - u32 rx_pkt_msg_fifo_124[1]; /* 0x000081f0 */ - u32 rx_pkt_msg_fifo_125[1]; /* 0x000081f4 */ - u32 rx_pkt_msg_fifo_126[1]; /* 0x000081f8 */ - u32 rx_pkt_msg_fifo_127[1]; /* 0x000081fc */ - u32 rx_pkt_msg_fifo_128[1]; /* 0x00008200 */ - u32 rx_pkt_msg_fifo_129[1]; /* 0x00008204 */ - u32 rx_pkt_msg_fifo_130[1]; /* 0x00008208 */ - u32 rx_pkt_msg_fifo_131[1]; /* 0x0000820c */ - u32 rx_pkt_msg_fifo_132[1]; /* 0x00008210 */ - u32 rx_pkt_msg_fifo_133[1]; /* 0x00008214 */ - u32 rx_pkt_msg_fifo_134[1]; /* 0x00008218 */ - u32 rx_pkt_msg_fifo_135[1]; /* 0x0000821c */ - u32 rx_pkt_msg_fifo_136[1]; /* 0x00008220 */ - u32 rx_pkt_msg_fifo_137[1]; /* 0x00008224 */ - u32 rx_pkt_msg_fifo_138[1]; /* 0x00008228 */ - u32 rx_pkt_msg_fifo_139[1]; /* 0x0000822c */ - u32 rx_pkt_msg_fifo_140[1]; /* 0x00008230 */ - u32 rx_pkt_msg_fifo_141[1]; /* 0x00008234 */ - u32 rx_pkt_msg_fifo_142[1]; /* 0x00008238 */ - u32 rx_pkt_msg_fifo_143[1]; /* 0x0000823c */ - u32 rx_pkt_msg_fifo_144[1]; /* 0x00008240 */ - u32 rx_pkt_msg_fifo_145[1]; /* 0x00008244 */ - u32 rx_pkt_msg_fifo_146[1]; /* 0x00008248 */ - u32 rx_pkt_msg_fifo_147[1]; /* 0x0000824c */ - u32 rx_pkt_msg_fifo_148[1]; /* 0x00008250 */ - u32 rx_pkt_msg_fifo_149[1]; /* 0x00008254 */ - u32 rx_pkt_msg_fifo_150[1]; /* 0x00008258 */ - u32 rx_pkt_msg_fifo_151[1]; /* 0x0000825c */ - u32 rx_pkt_msg_fifo_152[1]; /* 0x00008260 */ - u32 rx_pkt_msg_fifo_153[1]; /* 0x00008264 */ - u32 rx_pkt_msg_fifo_154[1]; /* 0x00008268 */ - u32 rx_pkt_msg_fifo_155[1]; /* 0x0000826c */ - u32 rx_pkt_msg_fifo_156[1]; /* 0x00008270 */ - u32 rx_pkt_msg_fifo_157[1]; /* 0x00008274 */ - u32 rx_pkt_msg_fifo_158[1]; /* 0x00008278 */ - u32 rx_pkt_msg_fifo_159[1]; /* 0x0000827c */ - u32 rx_pkt_msg_fifo_160[1]; /* 0x00008280 */ - u32 rx_pkt_msg_fifo_161[1]; /* 0x00008284 */ - u32 rx_pkt_msg_fifo_162[1]; /* 0x00008288 */ - u32 rx_pkt_msg_fifo_163[1]; /* 0x0000828c */ - u32 rx_pkt_msg_fifo_164[1]; /* 0x00008290 */ - u32 rx_pkt_msg_fifo_165[1]; /* 0x00008294 */ - u32 rx_pkt_msg_fifo_166[1]; /* 0x00008298 */ - u32 rx_pkt_msg_fifo_167[1]; /* 0x0000829c */ - u32 rx_pkt_msg_fifo_168[1]; /* 0x000082a0 */ - u32 rx_pkt_msg_fifo_169[1]; /* 0x000082a4 */ - u32 rx_pkt_msg_fifo_170[1]; /* 0x000082a8 */ - u32 rx_pkt_msg_fifo_171[1]; /* 0x000082ac */ - u32 rx_pkt_msg_fifo_172[1]; /* 0x000082b0 */ - u32 rx_pkt_msg_fifo_173[1]; /* 0x000082b4 */ - u32 rx_pkt_msg_fifo_174[1]; /* 0x000082b8 */ - u32 rx_pkt_msg_fifo_175[1]; /* 0x000082bc */ - u32 rx_pkt_msg_fifo_176[1]; /* 0x000082c0 */ - u32 rx_pkt_msg_fifo_177[1]; /* 0x000082c4 */ - u32 rx_pkt_msg_fifo_178[1]; /* 0x000082c8 */ - u32 rx_pkt_msg_fifo_179[1]; /* 0x000082cc */ - u32 rx_pkt_msg_fifo_180[1]; /* 0x000082d0 */ - u32 rx_pkt_msg_fifo_181[1]; /* 0x000082d4 */ - u32 rx_pkt_msg_fifo_182[1]; /* 0x000082d8 */ - u32 rx_pkt_msg_fifo_183[1]; /* 0x000082dc */ - u32 rx_pkt_msg_fifo_184[1]; /* 0x000082e0 */ - u32 rx_pkt_msg_fifo_185[1]; /* 0x000082e4 */ - u32 rx_pkt_msg_fifo_186[1]; /* 0x000082e8 */ - u32 rx_pkt_msg_fifo_187[1]; /* 0x000082ec */ - u32 rx_pkt_msg_fifo_188[1]; /* 0x000082f0 */ - u32 rx_pkt_msg_fifo_189[1]; /* 0x000082f4 */ - u32 rx_pkt_msg_fifo_190[1]; /* 0x000082f8 */ - u32 rx_pkt_msg_fifo_191[1]; /* 0x000082fc */ - u32 rx_pkt_msg_fifo_192[1]; /* 0x00008300 */ - u32 rx_pkt_msg_fifo_193[1]; /* 0x00008304 */ - u32 rx_pkt_msg_fifo_194[1]; /* 0x00008308 */ - u32 rx_pkt_msg_fifo_195[1]; /* 0x0000830c */ - u32 rx_pkt_msg_fifo_196[1]; /* 0x00008310 */ - u32 rx_pkt_msg_fifo_197[1]; /* 0x00008314 */ - u32 rx_pkt_msg_fifo_198[1]; /* 0x00008318 */ - u32 rx_pkt_msg_fifo_199[1]; /* 0x0000831c */ - u32 rx_pkt_msg_fifo_200[1]; /* 0x00008320 */ - u32 rx_pkt_msg_fifo_201[1]; /* 0x00008324 */ - u32 rx_pkt_msg_fifo_202[1]; /* 0x00008328 */ - u32 rx_pkt_msg_fifo_203[1]; /* 0x0000832c */ - u32 rx_pkt_msg_fifo_204[1]; /* 0x00008330 */ - u32 rx_pkt_msg_fifo_205[1]; /* 0x00008334 */ - u32 rx_pkt_msg_fifo_206[1]; /* 0x00008338 */ - u32 rx_pkt_msg_fifo_207[1]; /* 0x0000833c */ - u32 rx_pkt_msg_fifo_208[1]; /* 0x00008340 */ - u32 rx_pkt_msg_fifo_209[1]; /* 0x00008344 */ - u32 rx_pkt_msg_fifo_210[1]; /* 0x00008348 */ - u32 rx_pkt_msg_fifo_211[1]; /* 0x0000834c */ - u32 rx_pkt_msg_fifo_212[1]; /* 0x00008350 */ - u32 rx_pkt_msg_fifo_213[1]; /* 0x00008354 */ - u32 rx_pkt_msg_fifo_214[1]; /* 0x00008358 */ - u32 rx_pkt_msg_fifo_215[1]; /* 0x0000835c */ - u32 rx_pkt_msg_fifo_216[1]; /* 0x00008360 */ - u32 rx_pkt_msg_fifo_217[1]; /* 0x00008364 */ - u32 rx_pkt_msg_fifo_218[1]; /* 0x00008368 */ - u32 rx_pkt_msg_fifo_219[1]; /* 0x0000836c */ - u32 rx_pkt_msg_fifo_220[1]; /* 0x00008370 */ - u32 rx_pkt_msg_fifo_221[1]; /* 0x00008374 */ - u32 rx_pkt_msg_fifo_222[1]; /* 0x00008378 */ - u32 rx_pkt_msg_fifo_223[1]; /* 0x0000837c */ - u32 rx_pkt_msg_fifo_224[1]; /* 0x00008380 */ - u32 rx_pkt_msg_fifo_225[1]; /* 0x00008384 */ - u32 rx_pkt_msg_fifo_226[1]; /* 0x00008388 */ - u32 rx_pkt_msg_fifo_227[1]; /* 0x0000838c */ - u32 rx_pkt_msg_fifo_228[1]; /* 0x00008390 */ - u32 rx_pkt_msg_fifo_229[1]; /* 0x00008394 */ - u32 rx_pkt_msg_fifo_230[1]; /* 0x00008398 */ - u32 rx_pkt_msg_fifo_231[1]; /* 0x0000839c */ - u32 rx_pkt_msg_fifo_232[1]; /* 0x000083a0 */ - u32 rx_pkt_msg_fifo_233[1]; /* 0x000083a4 */ - u32 rx_pkt_msg_fifo_234[1]; /* 0x000083a8 */ - u32 rx_pkt_msg_fifo_235[1]; /* 0x000083ac */ - u32 rx_pkt_msg_fifo_236[1]; /* 0x000083b0 */ - u32 rx_pkt_msg_fifo_237[1]; /* 0x000083b4 */ - u32 rx_pkt_msg_fifo_238[1]; /* 0x000083b8 */ - u32 rx_pkt_msg_fifo_239[1]; /* 0x000083bc */ - u32 rx_pkt_msg_fifo_240[1]; /* 0x000083c0 */ - u32 rx_pkt_msg_fifo_241[1]; /* 0x000083c4 */ - u32 rx_pkt_msg_fifo_242[1]; /* 0x000083c8 */ - u32 rx_pkt_msg_fifo_243[1]; /* 0x000083cc */ - u32 rx_pkt_msg_fifo_244[1]; /* 0x000083d0 */ - u32 rx_pkt_msg_fifo_245[1]; /* 0x000083d4 */ - u32 rx_pkt_msg_fifo_246[1]; /* 0x000083d8 */ - u32 rx_pkt_msg_fifo_247[1]; /* 0x000083dc */ - u32 rx_pkt_msg_fifo_248[1]; /* 0x000083e0 */ - u32 rx_pkt_msg_fifo_249[1]; /* 0x000083e4 */ - u32 rx_pkt_msg_fifo_250[1]; /* 0x000083e8 */ - u32 rx_pkt_msg_fifo_251[1]; /* 0x000083ec */ - u32 rx_pkt_msg_fifo_252[1]; /* 0x000083f0 */ - u32 rx_pkt_msg_fifo_253[1]; /* 0x000083f4 */ - u32 rx_pkt_msg_fifo_254[1]; /* 0x000083f8 */ - u32 rx_pkt_msg_fifo_255[1]; /* 0x000083fc */ - u32 rx_pkt_msg_fifo_256[1]; /* 0x00008400 */ - u32 rx_pkt_msg_fifo_257[1]; /* 0x00008404 */ - u32 rx_pkt_msg_fifo_258[1]; /* 0x00008408 */ - u32 rx_pkt_msg_fifo_259[1]; /* 0x0000840c */ - u32 rx_pkt_msg_fifo_260[1]; /* 0x00008410 */ - u32 rx_pkt_msg_fifo_261[1]; /* 0x00008414 */ - u32 rx_pkt_msg_fifo_262[1]; /* 0x00008418 */ - u32 rx_pkt_msg_fifo_263[1]; /* 0x0000841c */ - u32 rx_pkt_msg_fifo_264[1]; /* 0x00008420 */ - u32 rx_pkt_msg_fifo_265[1]; /* 0x00008424 */ - u32 rx_pkt_msg_fifo_266[1]; /* 0x00008428 */ - u32 rx_pkt_msg_fifo_267[1]; /* 0x0000842c */ - u32 rx_pkt_msg_fifo_268[1]; /* 0x00008430 */ - u32 rx_pkt_msg_fifo_269[1]; /* 0x00008434 */ - u32 rx_pkt_msg_fifo_270[1]; /* 0x00008438 */ - u32 rx_pkt_msg_fifo_271[1]; /* 0x0000843c */ - u32 rx_pkt_msg_fifo_272[1]; /* 0x00008440 */ - u32 rx_pkt_msg_fifo_273[1]; /* 0x00008444 */ - u32 rx_pkt_msg_fifo_274[1]; /* 0x00008448 */ - u32 rx_pkt_msg_fifo_275[1]; /* 0x0000844c */ - u32 rx_pkt_msg_fifo_276[1]; /* 0x00008450 */ - u32 rx_pkt_msg_fifo_277[1]; /* 0x00008454 */ - u32 rx_pkt_msg_fifo_278[1]; /* 0x00008458 */ - u32 rx_pkt_msg_fifo_279[1]; /* 0x0000845c */ - u32 rx_pkt_msg_fifo_280[1]; /* 0x00008460 */ - u32 rx_pkt_msg_fifo_281[1]; /* 0x00008464 */ - u32 rx_pkt_msg_fifo_282[1]; /* 0x00008468 */ - u32 rx_pkt_msg_fifo_283[1]; /* 0x0000846c */ - u32 rx_pkt_msg_fifo_284[1]; /* 0x00008470 */ - u32 rx_pkt_msg_fifo_285[1]; /* 0x00008474 */ - u32 rx_pkt_msg_fifo_286[1]; /* 0x00008478 */ - u32 rx_pkt_msg_fifo_287[1]; /* 0x0000847c */ - u32 rx_pkt_msg_fifo_288[1]; /* 0x00008480 */ - u32 rx_pkt_msg_fifo_289[1]; /* 0x00008484 */ - u32 rx_pkt_msg_fifo_290[1]; /* 0x00008488 */ - u32 rx_pkt_msg_fifo_291[1]; /* 0x0000848c */ - u32 rx_pkt_msg_fifo_292[1]; /* 0x00008490 */ - u32 rx_pkt_msg_fifo_293[1]; /* 0x00008494 */ - u32 rx_pkt_msg_fifo_294[1]; /* 0x00008498 */ - u32 rx_pkt_msg_fifo_295[1]; /* 0x0000849c */ - u32 rx_pkt_msg_fifo_296[1]; /* 0x000084a0 */ - u32 rx_pkt_msg_fifo_297[1]; /* 0x000084a4 */ - u32 rx_pkt_msg_fifo_298[1]; /* 0x000084a8 */ - u32 rx_pkt_msg_fifo_299[1]; /* 0x000084ac */ - u32 rx_pkt_msg_fifo_300[1]; /* 0x000084b0 */ - u32 rx_pkt_msg_fifo_301[1]; /* 0x000084b4 */ - u32 rx_pkt_msg_fifo_302[1]; /* 0x000084b8 */ - u32 rx_pkt_msg_fifo_303[1]; /* 0x000084bc */ - u32 rx_pkt_msg_fifo_304[1]; /* 0x000084c0 */ - u32 rx_pkt_msg_fifo_305[1]; /* 0x000084c4 */ - u32 rx_pkt_msg_fifo_306[1]; /* 0x000084c8 */ - u32 rx_pkt_msg_fifo_307[1]; /* 0x000084cc */ - u32 rx_pkt_msg_fifo_308[1]; /* 0x000084d0 */ - u32 rx_pkt_msg_fifo_309[1]; /* 0x000084d4 */ - u32 rx_pkt_msg_fifo_310[1]; /* 0x000084d8 */ - u32 rx_pkt_msg_fifo_311[1]; /* 0x000084dc */ - u32 rx_pkt_msg_fifo_312[1]; /* 0x000084e0 */ - u32 rx_pkt_msg_fifo_313[1]; /* 0x000084e4 */ - u32 rx_pkt_msg_fifo_314[1]; /* 0x000084e8 */ - u32 rx_pkt_msg_fifo_315[1]; /* 0x000084ec */ - u32 rx_pkt_msg_fifo_316[1]; /* 0x000084f0 */ - u32 rx_pkt_msg_fifo_317[1]; /* 0x000084f4 */ - u32 rx_pkt_msg_fifo_318[1]; /* 0x000084f8 */ - u32 rx_pkt_msg_fifo_319[1]; /* 0x000084fc */ - u32 rx_pkt_msg_fifo_320[1]; /* 0x00008500 */ - u32 rx_pkt_msg_fifo_321[1]; /* 0x00008504 */ - u32 rx_pkt_msg_fifo_322[1]; /* 0x00008508 */ - u32 rx_pkt_msg_fifo_323[1]; /* 0x0000850c */ - u32 rx_pkt_msg_fifo_324[1]; /* 0x00008510 */ + u32 RxPktMsgFifo0[1]; /* 0x00008000 */ + u32 RxPktMsgFifo1[1]; /* 0x00008004 */ + u32 RxPktMsgFifo2[1]; /* 0x00008008 */ + u32 RxPktMsgFifo3[1]; /* 0x0000800c */ + u32 RxPktMsgFifo4[1]; /* 0x00008010 */ + u32 RxPktMsgFifo5[1]; /* 0x00008014 */ + u32 RxPktMsgFifo6[1]; /* 0x00008018 */ + u32 RxPktMsgFifo7[1]; /* 0x0000801c */ + u32 RxPktMsgFifo8[1]; /* 0x00008020 */ + u32 RxPktMsgFifo9[1]; /* 0x00008024 */ + u32 RxPktMsgFifo10[1]; /* 0x00008028 */ + u32 RxPktMsgFifo11[1]; /* 0x0000802c */ + u32 RxPktMsgFifo12[1]; /* 0x00008030 */ + u32 RxPktMsgFifo13[1]; /* 0x00008034 */ + u32 RxPktMsgFifo14[1]; /* 0x00008038 */ + u32 RxPktMsgFifo15[1]; /* 0x0000803c */ + u32 RxPktMsgFifo16[1]; /* 0x00008040 */ + u32 RxPktMsgFifo17[1]; /* 0x00008044 */ + u32 RxPktMsgFifo18[1]; /* 0x00008048 */ + u32 RxPktMsgFifo19[1]; /* 0x0000804c */ + u32 RxPktMsgFifo20[1]; /* 0x00008050 */ + u32 RxPktMsgFifo21[1]; /* 0x00008054 */ + u32 RxPktMsgFifo22[1]; /* 0x00008058 */ + u32 RxPktMsgFifo23[1]; /* 0x0000805c */ + u32 RxPktMsgFifo24[1]; /* 0x00008060 */ + u32 RxPktMsgFifo25[1]; /* 0x00008064 */ + u32 RxPktMsgFifo26[1]; /* 0x00008068 */ + u32 RxPktMsgFifo27[1]; /* 0x0000806c */ + u32 RxPktMsgFifo28[1]; /* 0x00008070 */ + u32 RxPktMsgFifo29[1]; /* 0x00008074 */ + u32 RxPktMsgFifo30[1]; /* 0x00008078 */ + u32 RxPktMsgFifo31[1]; /* 0x0000807c */ + u32 RxPktMsgFifo32[1]; /* 0x00008080 */ + u32 RxPktMsgFifo33[1]; /* 0x00008084 */ + u32 RxPktMsgFifo34[1]; /* 0x00008088 */ + u32 RxPktMsgFifo35[1]; /* 0x0000808c */ + u32 RxPktMsgFifo36[1]; /* 0x00008090 */ + u32 RxPktMsgFifo37[1]; /* 0x00008094 */ + u32 RxPktMsgFifo38[1]; /* 0x00008098 */ + u32 RxPktMsgFifo39[1]; /* 0x0000809c */ + u32 RxPktMsgFifo40[1]; /* 0x000080a0 */ + u32 RxPktMsgFifo41[1]; /* 0x000080a4 */ + u32 RxPktMsgFifo42[1]; /* 0x000080a8 */ + u32 RxPktMsgFifo43[1]; /* 0x000080ac */ + u32 RxPktMsgFifo44[1]; /* 0x000080b0 */ + u32 RxPktMsgFifo45[1]; /* 0x000080b4 */ + u32 RxPktMsgFifo46[1]; /* 0x000080b8 */ + u32 RxPktMsgFifo47[1]; /* 0x000080bc */ + u32 RxPktMsgFifo48[1]; /* 0x000080c0 */ + u32 RxPktMsgFifo49[1]; /* 0x000080c4 */ + u32 RxPktMsgFifo50[1]; /* 0x000080c8 */ + u32 RxPktMsgFifo51[1]; /* 0x000080cc */ + u32 RxPktMsgFifo52[1]; /* 0x000080d0 */ + u32 RxPktMsgFifo53[1]; /* 0x000080d4 */ + u32 RxPktMsgFifo54[1]; /* 0x000080d8 */ + u32 RxPktMsgFifo55[1]; /* 0x000080dc */ + u32 RxPktMsgFifo56[1]; /* 0x000080e0 */ + u32 RxPktMsgFifo57[1]; /* 0x000080e4 */ + u32 RxPktMsgFifo58[1]; /* 0x000080e8 */ + u32 RxPktMsgFifo59[1]; /* 0x000080ec */ + u32 RxPktMsgFifo60[1]; /* 0x000080f0 */ + u32 RxPktMsgFifo61[1]; /* 0x000080f4 */ + u32 RxPktMsgFifo62[1]; /* 0x000080f8 */ + u32 RxPktMsgFifo63[1]; /* 0x000080fc */ + u32 RxPktMsgFifo64[1]; /* 0x00008100 */ + u32 RxPktMsgFifo65[1]; /* 0x00008104 */ + u32 RxPktMsgFifo66[1]; /* 0x00008108 */ + u32 RxPktMsgFifo67[1]; /* 0x0000810c */ + u32 RxPktMsgFifo68[1]; /* 0x00008110 */ + u32 RxPktMsgFifo69[1]; /* 0x00008114 */ + u32 RxPktMsgFifo70[1]; /* 0x00008118 */ + u32 RxPktMsgFifo71[1]; /* 0x0000811c */ + u32 RxPktMsgFifo72[1]; /* 0x00008120 */ + u32 RxPktMsgFifo73[1]; /* 0x00008124 */ + u32 RxPktMsgFifo74[1]; /* 0x00008128 */ + u32 RxPktMsgFifo75[1]; /* 0x0000812c */ + u32 RxPktMsgFifo76[1]; /* 0x00008130 */ + u32 RxPktMsgFifo77[1]; /* 0x00008134 */ + u32 RxPktMsgFifo78[1]; /* 0x00008138 */ + u32 RxPktMsgFifo79[1]; /* 0x0000813c */ + u32 RxPktMsgFifo80[1]; /* 0x00008140 */ + u32 RxPktMsgFifo81[1]; /* 0x00008144 */ + u32 RxPktMsgFifo82[1]; /* 0x00008148 */ + u32 RxPktMsgFifo83[1]; /* 0x0000814c */ + u32 RxPktMsgFifo84[1]; /* 0x00008150 */ + u32 RxPktMsgFifo85[1]; /* 0x00008154 */ + u32 RxPktMsgFifo86[1]; /* 0x00008158 */ + u32 RxPktMsgFifo87[1]; /* 0x0000815c */ + u32 RxPktMsgFifo88[1]; /* 0x00008160 */ + u32 RxPktMsgFifo89[1]; /* 0x00008164 */ + u32 RxPktMsgFifo90[1]; /* 0x00008168 */ + u32 RxPktMsgFifo91[1]; /* 0x0000816c */ + u32 RxPktMsgFifo92[1]; /* 0x00008170 */ + u32 RxPktMsgFifo93[1]; /* 0x00008174 */ + u32 RxPktMsgFifo94[1]; /* 0x00008178 */ + u32 RxPktMsgFifo95[1]; /* 0x0000817c */ + u32 RxPktMsgFifo96[1]; /* 0x00008180 */ + u32 RxPktMsgFifo97[1]; /* 0x00008184 */ + u32 RxPktMsgFifo98[1]; /* 0x00008188 */ + u32 RxPktMsgFifo99[1]; /* 0x0000818c */ + u32 RxPktMsgFifo100[1]; /* 0x00008190 */ + u32 RxPktMsgFifo101[1]; /* 0x00008194 */ + u32 RxPktMsgFifo102[1]; /* 0x00008198 */ + u32 RxPktMsgFifo103[1]; /* 0x0000819c */ + u32 RxPktMsgFifo104[1]; /* 0x000081a0 */ + u32 RxPktMsgFifo105[1]; /* 0x000081a4 */ + u32 RxPktMsgFifo106[1]; /* 0x000081a8 */ + u32 RxPktMsgFifo107[1]; /* 0x000081ac */ + u32 RxPktMsgFifo108[1]; /* 0x000081b0 */ + u32 RxPktMsgFifo109[1]; /* 0x000081b4 */ + u32 RxPktMsgFifo110[1]; /* 0x000081b8 */ + u32 RxPktMsgFifo111[1]; /* 0x000081bc */ + u32 RxPktMsgFifo112[1]; /* 0x000081c0 */ + u32 RxPktMsgFifo113[1]; /* 0x000081c4 */ + u32 RxPktMsgFifo114[1]; /* 0x000081c8 */ + u32 RxPktMsgFifo115[1]; /* 0x000081cc */ + u32 RxPktMsgFifo116[1]; /* 0x000081d0 */ + u32 RxPktMsgFifo117[1]; /* 0x000081d4 */ + u32 RxPktMsgFifo118[1]; /* 0x000081d8 */ + u32 RxPktMsgFifo119[1]; /* 0x000081dc */ + u32 RxPktMsgFifo120[1]; /* 0x000081e0 */ + u32 RxPktMsgFifo121[1]; /* 0x000081e4 */ + u32 RxPktMsgFifo122[1]; /* 0x000081e8 */ + u32 RxPktMsgFifo123[1]; /* 0x000081ec */ + u32 RxPktMsgFifo124[1]; /* 0x000081f0 */ + u32 RxPktMsgFifo125[1]; /* 0x000081f4 */ + u32 RxPktMsgFifo126[1]; /* 0x000081f8 */ + u32 RxPktMsgFifo127[1]; /* 0x000081fc */ + u32 RxPktMsgFifo128[1]; /* 0x00008200 */ + u32 RxPktMsgFifo129[1]; /* 0x00008204 */ + u32 RxPktMsgFifo130[1]; /* 0x00008208 */ + u32 RxPktMsgFifo131[1]; /* 0x0000820c */ + u32 RxPktMsgFifo132[1]; /* 0x00008210 */ + u32 RxPktMsgFifo133[1]; /* 0x00008214 */ + u32 RxPktMsgFifo134[1]; /* 0x00008218 */ + u32 RxPktMsgFifo135[1]; /* 0x0000821c */ + u32 RxPktMsgFifo136[1]; /* 0x00008220 */ + u32 RxPktMsgFifo137[1]; /* 0x00008224 */ + u32 RxPktMsgFifo138[1]; /* 0x00008228 */ + u32 RxPktMsgFifo139[1]; /* 0x0000822c */ + u32 RxPktMsgFifo140[1]; /* 0x00008230 */ + u32 RxPktMsgFifo141[1]; /* 0x00008234 */ + u32 RxPktMsgFifo142[1]; /* 0x00008238 */ + u32 RxPktMsgFifo143[1]; /* 0x0000823c */ + u32 RxPktMsgFifo144[1]; /* 0x00008240 */ + u32 RxPktMsgFifo145[1]; /* 0x00008244 */ + u32 RxPktMsgFifo146[1]; /* 0x00008248 */ + u32 RxPktMsgFifo147[1]; /* 0x0000824c */ + u32 RxPktMsgFifo148[1]; /* 0x00008250 */ + u32 RxPktMsgFifo149[1]; /* 0x00008254 */ + u32 RxPktMsgFifo150[1]; /* 0x00008258 */ + u32 RxPktMsgFifo151[1]; /* 0x0000825c */ + u32 RxPktMsgFifo152[1]; /* 0x00008260 */ + u32 RxPktMsgFifo153[1]; /* 0x00008264 */ + u32 RxPktMsgFifo154[1]; /* 0x00008268 */ + u32 RxPktMsgFifo155[1]; /* 0x0000826c */ + u32 RxPktMsgFifo156[1]; /* 0x00008270 */ + u32 RxPktMsgFifo157[1]; /* 0x00008274 */ + u32 RxPktMsgFifo158[1]; /* 0x00008278 */ + u32 RxPktMsgFifo159[1]; /* 0x0000827c */ + u32 RxPktMsgFifo160[1]; /* 0x00008280 */ + u32 RxPktMsgFifo161[1]; /* 0x00008284 */ + u32 RxPktMsgFifo162[1]; /* 0x00008288 */ + u32 RxPktMsgFifo163[1]; /* 0x0000828c */ + u32 RxPktMsgFifo164[1]; /* 0x00008290 */ + u32 RxPktMsgFifo165[1]; /* 0x00008294 */ + u32 RxPktMsgFifo166[1]; /* 0x00008298 */ + u32 RxPktMsgFifo167[1]; /* 0x0000829c */ + u32 RxPktMsgFifo168[1]; /* 0x000082a0 */ + u32 RxPktMsgFifo169[1]; /* 0x000082a4 */ + u32 RxPktMsgFifo170[1]; /* 0x000082a8 */ + u32 RxPktMsgFifo171[1]; /* 0x000082ac */ + u32 RxPktMsgFifo172[1]; /* 0x000082b0 */ + u32 RxPktMsgFifo173[1]; /* 0x000082b4 */ + u32 RxPktMsgFifo174[1]; /* 0x000082b8 */ + u32 RxPktMsgFifo175[1]; /* 0x000082bc */ + u32 RxPktMsgFifo176[1]; /* 0x000082c0 */ + u32 RxPktMsgFifo177[1]; /* 0x000082c4 */ + u32 RxPktMsgFifo178[1]; /* 0x000082c8 */ + u32 RxPktMsgFifo179[1]; /* 0x000082cc */ + u32 RxPktMsgFifo180[1]; /* 0x000082d0 */ + u32 RxPktMsgFifo181[1]; /* 0x000082d4 */ + u32 RxPktMsgFifo182[1]; /* 0x000082d8 */ + u32 RxPktMsgFifo183[1]; /* 0x000082dc */ + u32 RxPktMsgFifo184[1]; /* 0x000082e0 */ + u32 RxPktMsgFifo185[1]; /* 0x000082e4 */ + u32 RxPktMsgFifo186[1]; /* 0x000082e8 */ + u32 RxPktMsgFifo187[1]; /* 0x000082ec */ + u32 RxPktMsgFifo188[1]; /* 0x000082f0 */ + u32 RxPktMsgFifo189[1]; /* 0x000082f4 */ + u32 RxPktMsgFifo190[1]; /* 0x000082f8 */ + u32 RxPktMsgFifo191[1]; /* 0x000082fc */ + u32 RxPktMsgFifo192[1]; /* 0x00008300 */ + u32 RxPktMsgFifo193[1]; /* 0x00008304 */ + u32 RxPktMsgFifo194[1]; /* 0x00008308 */ + u32 RxPktMsgFifo195[1]; /* 0x0000830c */ + u32 RxPktMsgFifo196[1]; /* 0x00008310 */ + u32 RxPktMsgFifo197[1]; /* 0x00008314 */ + u32 RxPktMsgFifo198[1]; /* 0x00008318 */ + u32 RxPktMsgFifo199[1]; /* 0x0000831c */ + u32 RxPktMsgFifo200[1]; /* 0x00008320 */ + u32 RxPktMsgFifo201[1]; /* 0x00008324 */ + u32 RxPktMsgFifo202[1]; /* 0x00008328 */ + u32 RxPktMsgFifo203[1]; /* 0x0000832c */ + u32 RxPktMsgFifo204[1]; /* 0x00008330 */ + u32 RxPktMsgFifo205[1]; /* 0x00008334 */ + u32 RxPktMsgFifo206[1]; /* 0x00008338 */ + u32 RxPktMsgFifo207[1]; /* 0x0000833c */ + u32 RxPktMsgFifo208[1]; /* 0x00008340 */ + u32 RxPktMsgFifo209[1]; /* 0x00008344 */ + u32 RxPktMsgFifo210[1]; /* 0x00008348 */ + u32 RxPktMsgFifo211[1]; /* 0x0000834c */ + u32 RxPktMsgFifo212[1]; /* 0x00008350 */ + u32 RxPktMsgFifo213[1]; /* 0x00008354 */ + u32 RxPktMsgFifo214[1]; /* 0x00008358 */ + u32 RxPktMsgFifo215[1]; /* 0x0000835c */ + u32 RxPktMsgFifo216[1]; /* 0x00008360 */ + u32 RxPktMsgFifo217[1]; /* 0x00008364 */ + u32 RxPktMsgFifo218[1]; /* 0x00008368 */ + u32 RxPktMsgFifo219[1]; /* 0x0000836c */ + u32 RxPktMsgFifo220[1]; /* 0x00008370 */ + u32 RxPktMsgFifo221[1]; /* 0x00008374 */ + u32 RxPktMsgFifo222[1]; /* 0x00008378 */ + u32 RxPktMsgFifo223[1]; /* 0x0000837c */ + u32 RxPktMsgFifo224[1]; /* 0x00008380 */ + u32 RxPktMsgFifo225[1]; /* 0x00008384 */ + u32 RxPktMsgFifo226[1]; /* 0x00008388 */ + u32 RxPktMsgFifo227[1]; /* 0x0000838c */ + u32 RxPktMsgFifo228[1]; /* 0x00008390 */ + u32 RxPktMsgFifo229[1]; /* 0x00008394 */ + u32 RxPktMsgFifo230[1]; /* 0x00008398 */ + u32 RxPktMsgFifo231[1]; /* 0x0000839c */ + u32 RxPktMsgFifo232[1]; /* 0x000083a0 */ + u32 RxPktMsgFifo233[1]; /* 0x000083a4 */ + u32 RxPktMsgFifo234[1]; /* 0x000083a8 */ + u32 RxPktMsgFifo235[1]; /* 0x000083ac */ + u32 RxPktMsgFifo236[1]; /* 0x000083b0 */ + u32 RxPktMsgFifo237[1]; /* 0x000083b4 */ + u32 RxPktMsgFifo238[1]; /* 0x000083b8 */ + u32 RxPktMsgFifo239[1]; /* 0x000083bc */ + u32 RxPktMsgFifo240[1]; /* 0x000083c0 */ + u32 RxPktMsgFifo241[1]; /* 0x000083c4 */ + u32 RxPktMsgFifo242[1]; /* 0x000083c8 */ + u32 RxPktMsgFifo243[1]; /* 0x000083cc */ + u32 RxPktMsgFifo244[1]; /* 0x000083d0 */ + u32 RxPktMsgFifo245[1]; /* 0x000083d4 */ + u32 RxPktMsgFifo246[1]; /* 0x000083d8 */ + u32 RxPktMsgFifo247[1]; /* 0x000083dc */ + u32 RxPktMsgFifo248[1]; /* 0x000083e0 */ + u32 RxPktMsgFifo249[1]; /* 0x000083e4 */ + u32 RxPktMsgFifo250[1]; /* 0x000083e8 */ + u32 RxPktMsgFifo251[1]; /* 0x000083ec */ + u32 RxPktMsgFifo252[1]; /* 0x000083f0 */ + u32 RxPktMsgFifo253[1]; /* 0x000083f4 */ + u32 RxPktMsgFifo254[1]; /* 0x000083f8 */ + u32 RxPktMsgFifo255[1]; /* 0x000083fc */ + u32 RxPktMsgFifo256[1]; /* 0x00008400 */ + u32 RxPktMsgFifo257[1]; /* 0x00008404 */ + u32 RxPktMsgFifo258[1]; /* 0x00008408 */ + u32 RxPktMsgFifo259[1]; /* 0x0000840c */ + u32 RxPktMsgFifo260[1]; /* 0x00008410 */ + u32 RxPktMsgFifo261[1]; /* 0x00008414 */ + u32 RxPktMsgFifo262[1]; /* 0x00008418 */ + u32 RxPktMsgFifo263[1]; /* 0x0000841c */ + u32 RxPktMsgFifo264[1]; /* 0x00008420 */ + u32 RxPktMsgFifo265[1]; /* 0x00008424 */ + u32 RxPktMsgFifo266[1]; /* 0x00008428 */ + u32 RxPktMsgFifo267[1]; /* 0x0000842c */ + u32 RxPktMsgFifo268[1]; /* 0x00008430 */ + u32 RxPktMsgFifo269[1]; /* 0x00008434 */ + u32 RxPktMsgFifo270[1]; /* 0x00008438 */ + u32 RxPktMsgFifo271[1]; /* 0x0000843c */ + u32 RxPktMsgFifo272[1]; /* 0x00008440 */ + u32 RxPktMsgFifo273[1]; /* 0x00008444 */ + u32 RxPktMsgFifo274[1]; /* 0x00008448 */ + u32 RxPktMsgFifo275[1]; /* 0x0000844c */ + u32 RxPktMsgFifo276[1]; /* 0x00008450 */ + u32 RxPktMsgFifo277[1]; /* 0x00008454 */ + u32 RxPktMsgFifo278[1]; /* 0x00008458 */ + u32 RxPktMsgFifo279[1]; /* 0x0000845c */ + u32 RxPktMsgFifo280[1]; /* 0x00008460 */ + u32 RxPktMsgFifo281[1]; /* 0x00008464 */ + u32 RxPktMsgFifo282[1]; /* 0x00008468 */ + u32 RxPktMsgFifo283[1]; /* 0x0000846c */ + u32 RxPktMsgFifo284[1]; /* 0x00008470 */ + u32 RxPktMsgFifo285[1]; /* 0x00008474 */ + u32 RxPktMsgFifo286[1]; /* 0x00008478 */ + u32 RxPktMsgFifo287[1]; /* 0x0000847c */ + u32 RxPktMsgFifo288[1]; /* 0x00008480 */ + u32 RxPktMsgFifo289[1]; /* 0x00008484 */ + u32 RxPktMsgFifo290[1]; /* 0x00008488 */ + u32 RxPktMsgFifo291[1]; /* 0x0000848c */ + u32 RxPktMsgFifo292[1]; /* 0x00008490 */ + u32 RxPktMsgFifo293[1]; /* 0x00008494 */ + u32 RxPktMsgFifo294[1]; /* 0x00008498 */ + u32 RxPktMsgFifo295[1]; /* 0x0000849c */ + u32 RxPktMsgFifo296[1]; /* 0x000084a0 */ + u32 RxPktMsgFifo297[1]; /* 0x000084a4 */ + u32 RxPktMsgFifo298[1]; /* 0x000084a8 */ + u32 RxPktMsgFifo299[1]; /* 0x000084ac */ + u32 RxPktMsgFifo300[1]; /* 0x000084b0 */ + u32 RxPktMsgFifo301[1]; /* 0x000084b4 */ + u32 RxPktMsgFifo302[1]; /* 0x000084b8 */ + u32 RxPktMsgFifo303[1]; /* 0x000084bc */ + u32 RxPktMsgFifo304[1]; /* 0x000084c0 */ + u32 RxPktMsgFifo305[1]; /* 0x000084c4 */ + u32 RxPktMsgFifo306[1]; /* 0x000084c8 */ + u32 RxPktMsgFifo307[1]; /* 0x000084cc */ + u32 RxPktMsgFifo308[1]; /* 0x000084d0 */ + u32 RxPktMsgFifo309[1]; /* 0x000084d4 */ + u32 RxPktMsgFifo310[1]; /* 0x000084d8 */ + u32 RxPktMsgFifo311[1]; /* 0x000084dc */ + u32 RxPktMsgFifo312[1]; /* 0x000084e0 */ + u32 RxPktMsgFifo313[1]; /* 0x000084e4 */ + u32 RxPktMsgFifo314[1]; /* 0x000084e8 */ + u32 RxPktMsgFifo315[1]; /* 0x000084ec */ + u32 RxPktMsgFifo316[1]; /* 0x000084f0 */ + u32 RxPktMsgFifo317[1]; /* 0x000084f4 */ + u32 RxPktMsgFifo318[1]; /* 0x000084f8 */ + u32 RxPktMsgFifo319[1]; /* 0x000084fc */ + u32 RxPktMsgFifo320[1]; /* 0x00008500 */ + u32 RxPktMsgFifo321[1]; /* 0x00008504 */ + u32 RxPktMsgFifo322[1]; /* 0x00008508 */ + u32 RxPktMsgFifo323[1]; /* 0x0000850c */ + u32 RxPktMsgFifo324[1]; /* 0x00008510 */ u32 rsv8517; u32 rsv8518; u32 rsv8519; @@ -3840,46 +3914,46 @@ struct cpu_mac_mems { u32 rsv8701; u32 rsv8702; u32 rsv8703; - u32 cpu_mac_stats_ram_0[4]; /* 0x00008800 */ - u32 cpu_mac_stats_ram_1[4]; /* 0x00008810 */ - u32 cpu_mac_stats_ram_2[4]; /* 0x00008820 */ - u32 cpu_mac_stats_ram_3[4]; /* 0x00008830 */ - u32 cpu_mac_stats_ram_4[4]; /* 0x00008840 */ - u32 cpu_mac_stats_ram_5[4]; /* 0x00008850 */ - u32 cpu_mac_stats_ram_6[4]; /* 0x00008860 */ - u32 cpu_mac_stats_ram_7[4]; /* 0x00008870 */ - u32 cpu_mac_stats_ram_8[4]; /* 0x00008880 */ - u32 cpu_mac_stats_ram_9[4]; /* 0x00008890 */ - u32 cpu_mac_stats_ram_10[4]; /* 0x000088a0 */ - u32 cpu_mac_stats_ram_11[4]; /* 0x000088b0 */ - u32 cpu_mac_stats_ram_12[4]; /* 0x000088c0 */ - u32 cpu_mac_stats_ram_13[4]; /* 0x000088d0 */ - u32 cpu_mac_stats_ram_14[4]; /* 0x000088e0 */ - u32 cpu_mac_stats_ram_15[4]; /* 0x000088f0 */ - u32 cpu_mac_stats_ram_16[4]; /* 0x00008900 */ - u32 cpu_mac_stats_ram_17[4]; /* 0x00008910 */ - u32 cpu_mac_stats_ram_18[4]; /* 0x00008920 */ - u32 cpu_mac_stats_ram_19[4]; /* 0x00008930 */ - u32 cpu_mac_stats_ram_20[4]; /* 0x00008940 */ - u32 cpu_mac_stats_ram_21[4]; /* 0x00008950 */ - u32 cpu_mac_stats_ram_22[4]; /* 0x00008960 */ - u32 cpu_mac_stats_ram_23[4]; /* 0x00008970 */ - u32 cpu_mac_stats_ram_24[4]; /* 0x00008980 */ - u32 cpu_mac_stats_ram_25[4]; /* 0x00008990 */ - u32 cpu_mac_stats_ram_26[4]; /* 0x000089a0 */ - u32 cpu_mac_stats_ram_27[4]; /* 0x000089b0 */ - u32 cpu_mac_stats_ram_28[4]; /* 0x000089c0 */ - u32 cpu_mac_stats_ram_29[4]; /* 0x000089d0 */ - u32 cpu_mac_stats_ram_30[4]; /* 0x000089e0 */ - u32 cpu_mac_stats_ram_31[4]; /* 0x000089f0 */ - u32 cpu_mac_stats_ram_32[4]; /* 0x00008a00 */ - u32 cpu_mac_stats_ram_33[4]; /* 0x00008a10 */ - u32 cpu_mac_stats_ram_34[4]; /* 0x00008a20 */ - u32 cpu_mac_stats_ram_35[4]; /* 0x00008a30 */ - u32 cpu_mac_stats_ram_36[4]; /* 0x00008a40 */ - u32 cpu_mac_stats_ram_37[4]; /* 0x00008a50 */ - u32 cpu_mac_stats_ram_38[4]; /* 0x00008a60 */ - u32 cpu_mac_stats_ram_39[4]; /* 0x00008a70 */ + u32 CpuMacStatsRam0[4]; /* 0x00008800 */ + u32 CpuMacStatsRam1[4]; /* 0x00008810 */ + u32 CpuMacStatsRam2[4]; /* 0x00008820 */ + u32 CpuMacStatsRam3[4]; /* 0x00008830 */ + u32 CpuMacStatsRam4[4]; /* 0x00008840 */ + u32 CpuMacStatsRam5[4]; /* 0x00008850 */ + u32 CpuMacStatsRam6[4]; /* 0x00008860 */ + u32 CpuMacStatsRam7[4]; /* 0x00008870 */ + u32 CpuMacStatsRam8[4]; /* 0x00008880 */ + u32 CpuMacStatsRam9[4]; /* 0x00008890 */ + u32 CpuMacStatsRam10[4]; /* 0x000088a0 */ + u32 CpuMacStatsRam11[4]; /* 0x000088b0 */ + u32 CpuMacStatsRam12[4]; /* 0x000088c0 */ + u32 CpuMacStatsRam13[4]; /* 0x000088d0 */ + u32 CpuMacStatsRam14[4]; /* 0x000088e0 */ + u32 CpuMacStatsRam15[4]; /* 0x000088f0 */ + u32 CpuMacStatsRam16[4]; /* 0x00008900 */ + u32 CpuMacStatsRam17[4]; /* 0x00008910 */ + u32 CpuMacStatsRam18[4]; /* 0x00008920 */ + u32 CpuMacStatsRam19[4]; /* 0x00008930 */ + u32 CpuMacStatsRam20[4]; /* 0x00008940 */ + u32 CpuMacStatsRam21[4]; /* 0x00008950 */ + u32 CpuMacStatsRam22[4]; /* 0x00008960 */ + u32 CpuMacStatsRam23[4]; /* 0x00008970 */ + u32 CpuMacStatsRam24[4]; /* 0x00008980 */ + u32 CpuMacStatsRam25[4]; /* 0x00008990 */ + u32 CpuMacStatsRam26[4]; /* 0x000089a0 */ + u32 CpuMacStatsRam27[4]; /* 0x000089b0 */ + u32 CpuMacStatsRam28[4]; /* 0x000089c0 */ + u32 CpuMacStatsRam29[4]; /* 0x000089d0 */ + u32 CpuMacStatsRam30[4]; /* 0x000089e0 */ + u32 CpuMacStatsRam31[4]; /* 0x000089f0 */ + u32 CpuMacStatsRam32[4]; /* 0x00008a00 */ + u32 CpuMacStatsRam33[4]; /* 0x00008a10 */ + u32 CpuMacStatsRam34[4]; /* 0x00008a20 */ + u32 CpuMacStatsRam35[4]; /* 0x00008a30 */ + u32 CpuMacStatsRam36[4]; /* 0x00008a40 */ + u32 CpuMacStatsRam37[4]; /* 0x00008a50 */ + u32 CpuMacStatsRam38[4]; /* 0x00008a60 */ + u32 CpuMacStatsRam39[4]; /* 0x00008a70 */ u32 rsv8864; u32 rsv8865; u32 rsv8866; @@ -3976,729 +4050,681 @@ struct cpu_mac_mems { u32 rsv8957; u32 rsv8958; u32 rsv8959; - u32 tx_desc_cfg_fifo_0[2]; /* 0x00008c00 */ - u32 tx_desc_cfg_fifo_1[2]; /* 0x00008c08 */ - u32 tx_desc_cfg_fifo_2[2]; /* 0x00008c10 */ - u32 tx_desc_cfg_fifo_3[2]; /* 0x00008c18 */ - u32 tx_desc_cfg_fifo_4[2]; /* 0x00008c20 */ - u32 tx_desc_cfg_fifo_5[2]; /* 0x00008c28 */ - u32 tx_desc_cfg_fifo_6[2]; /* 0x00008c30 */ - u32 tx_desc_cfg_fifo_7[2]; /* 0x00008c38 */ - u32 tx_desc_cfg_fifo_8[2]; /* 0x00008c40 */ - u32 tx_desc_cfg_fifo_9[2]; /* 0x00008c48 */ - u32 tx_desc_cfg_fifo_10[2]; /* 0x00008c50 */ - u32 tx_desc_cfg_fifo_11[2]; /* 0x00008c58 */ - u32 tx_desc_cfg_fifo_12[2]; /* 0x00008c60 */ - u32 tx_desc_cfg_fifo_13[2]; /* 0x00008c68 */ - u32 tx_desc_cfg_fifo_14[2]; /* 0x00008c70 */ - u32 tx_desc_cfg_fifo_15[2]; /* 0x00008c78 */ - u32 tx_desc_cfg_fifo_16[2]; /* 0x00008c80 */ - u32 tx_desc_cfg_fifo_17[2]; /* 0x00008c88 */ - u32 tx_desc_cfg_fifo_18[2]; /* 0x00008c90 */ - u32 tx_desc_cfg_fifo_19[2]; /* 0x00008c98 */ - u32 tx_desc_cfg_fifo_20[2]; /* 0x00008ca0 */ - u32 tx_desc_cfg_fifo_21[2]; /* 0x00008ca8 */ - u32 tx_desc_cfg_fifo_22[2]; /* 0x00008cb0 */ - u32 tx_desc_cfg_fifo_23[2]; /* 0x00008cb8 */ - u32 tx_desc_cfg_fifo_24[2]; /* 0x00008cc0 */ - u32 tx_desc_cfg_fifo_25[2]; /* 0x00008cc8 */ - u32 tx_desc_cfg_fifo_26[2]; /* 0x00008cd0 */ - u32 tx_desc_cfg_fifo_27[2]; /* 0x00008cd8 */ - u32 tx_desc_cfg_fifo_28[2]; /* 0x00008ce0 */ - u32 tx_desc_cfg_fifo_29[2]; /* 0x00008ce8 */ - u32 tx_desc_cfg_fifo_30[2]; /* 0x00008cf0 */ - u32 tx_desc_cfg_fifo_31[2]; /* 0x00008cf8 */ - u32 tx_desc_cfg_fifo_32[2]; /* 0x00008d00 */ - u32 tx_desc_cfg_fifo_33[2]; /* 0x00008d08 */ - u32 tx_desc_cfg_fifo_34[2]; /* 0x00008d10 */ - u32 tx_desc_cfg_fifo_35[2]; /* 0x00008d18 */ - u32 tx_desc_cfg_fifo_36[2]; /* 0x00008d20 */ - u32 tx_desc_cfg_fifo_37[2]; /* 0x00008d28 */ - u32 tx_desc_cfg_fifo_38[2]; /* 0x00008d30 */ - u32 tx_desc_cfg_fifo_39[2]; /* 0x00008d38 */ - u32 tx_desc_cfg_fifo_40[2]; /* 0x00008d40 */ - u32 tx_desc_cfg_fifo_41[2]; /* 0x00008d48 */ - u32 tx_desc_cfg_fifo_42[2]; /* 0x00008d50 */ - u32 tx_desc_cfg_fifo_43[2]; /* 0x00008d58 */ - u32 tx_desc_cfg_fifo_44[2]; /* 0x00008d60 */ - u32 tx_desc_cfg_fifo_45[2]; /* 0x00008d68 */ - u32 tx_desc_cfg_fifo_46[2]; /* 0x00008d70 */ - u32 tx_desc_cfg_fifo_47[2]; /* 0x00008d78 */ - u32 tx_desc_cfg_fifo_48[2]; /* 0x00008d80 */ - u32 tx_desc_cfg_fifo_49[2]; /* 0x00008d88 */ - u32 tx_desc_cfg_fifo_50[2]; /* 0x00008d90 */ - u32 tx_desc_cfg_fifo_51[2]; /* 0x00008d98 */ - u32 tx_desc_cfg_fifo_52[2]; /* 0x00008da0 */ - u32 tx_desc_cfg_fifo_53[2]; /* 0x00008da8 */ - u32 tx_desc_cfg_fifo_54[2]; /* 0x00008db0 */ - u32 tx_desc_cfg_fifo_55[2]; /* 0x00008db8 */ - u32 tx_desc_cfg_fifo_56[2]; /* 0x00008dc0 */ - u32 tx_desc_cfg_fifo_57[2]; /* 0x00008dc8 */ - u32 tx_desc_cfg_fifo_58[2]; /* 0x00008dd0 */ - u32 tx_desc_cfg_fifo_59[2]; /* 0x00008dd8 */ - u32 tx_desc_cfg_fifo_60[2]; /* 0x00008de0 */ - u32 tx_desc_cfg_fifo_61[2]; /* 0x00008de8 */ - u32 tx_desc_cfg_fifo_62[2]; /* 0x00008df0 */ - u32 tx_desc_cfg_fifo_63[2]; /* 0x00008df8 */ - u32 rx_desc_0_cfg_fifo_0[2]; /* 0x00008e00 */ - u32 rx_desc_0_cfg_fifo_1[2]; /* 0x00008e08 */ - u32 rx_desc_0_cfg_fifo_2[2]; /* 0x00008e10 */ - u32 rx_desc_0_cfg_fifo_3[2]; /* 0x00008e18 */ - u32 rx_desc_0_cfg_fifo_4[2]; /* 0x00008e20 */ - u32 rx_desc_0_cfg_fifo_5[2]; /* 0x00008e28 */ - u32 rx_desc_0_cfg_fifo_6[2]; /* 0x00008e30 */ - u32 rx_desc_0_cfg_fifo_7[2]; /* 0x00008e38 */ - u32 rx_desc_0_cfg_fifo_8[2]; /* 0x00008e40 */ - u32 rx_desc_0_cfg_fifo_9[2]; /* 0x00008e48 */ - u32 rx_desc_0_cfg_fifo_10[2]; /* 0x00008e50 */ - u32 rx_desc_0_cfg_fifo_11[2]; /* 0x00008e58 */ - u32 rx_desc_0_cfg_fifo_12[2]; /* 0x00008e60 */ - u32 rx_desc_0_cfg_fifo_13[2]; /* 0x00008e68 */ - u32 rx_desc_0_cfg_fifo_14[2]; /* 0x00008e70 */ - u32 rx_desc_0_cfg_fifo_15[2]; /* 0x00008e78 */ - u32 rx_desc_0_cfg_fifo_16[2]; /* 0x00008e80 */ - u32 rx_desc_0_cfg_fifo_17[2]; /* 0x00008e88 */ - u32 rx_desc_0_cfg_fifo_18[2]; /* 0x00008e90 */ - u32 rx_desc_0_cfg_fifo_19[2]; /* 0x00008e98 */ - u32 rx_desc_0_cfg_fifo_20[2]; /* 0x00008ea0 */ - u32 rx_desc_0_cfg_fifo_21[2]; /* 0x00008ea8 */ - u32 rx_desc_0_cfg_fifo_22[2]; /* 0x00008eb0 */ - u32 rx_desc_0_cfg_fifo_23[2]; /* 0x00008eb8 */ - u32 rx_desc_0_cfg_fifo_24[2]; /* 0x00008ec0 */ - u32 rx_desc_0_cfg_fifo_25[2]; /* 0x00008ec8 */ - u32 rx_desc_0_cfg_fifo_26[2]; /* 0x00008ed0 */ - u32 rx_desc_0_cfg_fifo_27[2]; /* 0x00008ed8 */ - u32 rx_desc_0_cfg_fifo_28[2]; /* 0x00008ee0 */ - u32 rx_desc_0_cfg_fifo_29[2]; /* 0x00008ee8 */ - u32 rx_desc_0_cfg_fifo_30[2]; /* 0x00008ef0 */ - u32 rx_desc_0_cfg_fifo_31[2]; /* 0x00008ef8 */ - u32 rx_desc_0_cfg_fifo_32[2]; /* 0x00008f00 */ - u32 rx_desc_0_cfg_fifo_33[2]; /* 0x00008f08 */ - u32 rx_desc_0_cfg_fifo_34[2]; /* 0x00008f10 */ - u32 rx_desc_0_cfg_fifo_35[2]; /* 0x00008f18 */ - u32 rx_desc_0_cfg_fifo_36[2]; /* 0x00008f20 */ - u32 rx_desc_0_cfg_fifo_37[2]; /* 0x00008f28 */ - u32 rx_desc_0_cfg_fifo_38[2]; /* 0x00008f30 */ - u32 rx_desc_0_cfg_fifo_39[2]; /* 0x00008f38 */ - u32 rx_desc_0_cfg_fifo_40[2]; /* 0x00008f40 */ - u32 rx_desc_0_cfg_fifo_41[2]; /* 0x00008f48 */ - u32 rx_desc_0_cfg_fifo_42[2]; /* 0x00008f50 */ - u32 rx_desc_0_cfg_fifo_43[2]; /* 0x00008f58 */ - u32 rx_desc_0_cfg_fifo_44[2]; /* 0x00008f60 */ - u32 rx_desc_0_cfg_fifo_45[2]; /* 0x00008f68 */ - u32 rx_desc_0_cfg_fifo_46[2]; /* 0x00008f70 */ - u32 rx_desc_0_cfg_fifo_47[2]; /* 0x00008f78 */ - u32 rx_desc_0_cfg_fifo_48[2]; /* 0x00008f80 */ - u32 rx_desc_0_cfg_fifo_49[2]; /* 0x00008f88 */ - u32 rx_desc_0_cfg_fifo_50[2]; /* 0x00008f90 */ - u32 rx_desc_0_cfg_fifo_51[2]; /* 0x00008f98 */ - u32 rx_desc_0_cfg_fifo_52[2]; /* 0x00008fa0 */ - u32 rx_desc_0_cfg_fifo_53[2]; /* 0x00008fa8 */ - u32 rx_desc_0_cfg_fifo_54[2]; /* 0x00008fb0 */ - u32 rx_desc_0_cfg_fifo_55[2]; /* 0x00008fb8 */ - u32 rx_desc_0_cfg_fifo_56[2]; /* 0x00008fc0 */ - u32 rx_desc_0_cfg_fifo_57[2]; /* 0x00008fc8 */ - u32 rx_desc_0_cfg_fifo_58[2]; /* 0x00008fd0 */ - u32 rx_desc_0_cfg_fifo_59[2]; /* 0x00008fd8 */ - u32 rx_desc_0_cfg_fifo_60[2]; /* 0x00008fe0 */ - u32 rx_desc_0_cfg_fifo_61[2]; /* 0x00008fe8 */ - u32 rx_desc_0_cfg_fifo_62[2]; /* 0x00008ff0 */ - u32 rx_desc_0_cfg_fifo_63[2]; /* 0x00008ff8 */ - u32 rx_desc_1_cfg_fifo_0[2]; /* 0x00009000 */ - u32 rx_desc_1_cfg_fifo_1[2]; /* 0x00009008 */ - u32 rx_desc_1_cfg_fifo_2[2]; /* 0x00009010 */ - u32 rx_desc_1_cfg_fifo_3[2]; /* 0x00009018 */ - u32 rx_desc_1_cfg_fifo_4[2]; /* 0x00009020 */ - u32 rx_desc_1_cfg_fifo_5[2]; /* 0x00009028 */ - u32 rx_desc_1_cfg_fifo_6[2]; /* 0x00009030 */ - u32 rx_desc_1_cfg_fifo_7[2]; /* 0x00009038 */ - u32 rx_desc_1_cfg_fifo_8[2]; /* 0x00009040 */ - u32 rx_desc_1_cfg_fifo_9[2]; /* 0x00009048 */ - u32 rx_desc_1_cfg_fifo_10[2]; /* 0x00009050 */ - u32 rx_desc_1_cfg_fifo_11[2]; /* 0x00009058 */ - u32 rx_desc_1_cfg_fifo_12[2]; /* 0x00009060 */ - u32 rx_desc_1_cfg_fifo_13[2]; /* 0x00009068 */ - u32 rx_desc_1_cfg_fifo_14[2]; /* 0x00009070 */ - u32 rx_desc_1_cfg_fifo_15[2]; /* 0x00009078 */ - u32 rx_desc_1_cfg_fifo_16[2]; /* 0x00009080 */ - u32 rx_desc_1_cfg_fifo_17[2]; /* 0x00009088 */ - u32 rx_desc_1_cfg_fifo_18[2]; /* 0x00009090 */ - u32 rx_desc_1_cfg_fifo_19[2]; /* 0x00009098 */ - u32 rx_desc_1_cfg_fifo_20[2]; /* 0x000090a0 */ - u32 rx_desc_1_cfg_fifo_21[2]; /* 0x000090a8 */ - u32 rx_desc_1_cfg_fifo_22[2]; /* 0x000090b0 */ - u32 rx_desc_1_cfg_fifo_23[2]; /* 0x000090b8 */ - u32 rx_desc_1_cfg_fifo_24[2]; /* 0x000090c0 */ - u32 rx_desc_1_cfg_fifo_25[2]; /* 0x000090c8 */ - u32 rx_desc_1_cfg_fifo_26[2]; /* 0x000090d0 */ - u32 rx_desc_1_cfg_fifo_27[2]; /* 0x000090d8 */ - u32 rx_desc_1_cfg_fifo_28[2]; /* 0x000090e0 */ - u32 rx_desc_1_cfg_fifo_29[2]; /* 0x000090e8 */ - u32 rx_desc_1_cfg_fifo_30[2]; /* 0x000090f0 */ - u32 rx_desc_1_cfg_fifo_31[2]; /* 0x000090f8 */ - u32 rx_desc_1_cfg_fifo_32[2]; /* 0x00009100 */ - u32 rx_desc_1_cfg_fifo_33[2]; /* 0x00009108 */ - u32 rx_desc_1_cfg_fifo_34[2]; /* 0x00009110 */ - u32 rx_desc_1_cfg_fifo_35[2]; /* 0x00009118 */ - u32 rx_desc_1_cfg_fifo_36[2]; /* 0x00009120 */ - u32 rx_desc_1_cfg_fifo_37[2]; /* 0x00009128 */ - u32 rx_desc_1_cfg_fifo_38[2]; /* 0x00009130 */ - u32 rx_desc_1_cfg_fifo_39[2]; /* 0x00009138 */ - u32 rx_desc_1_cfg_fifo_40[2]; /* 0x00009140 */ - u32 rx_desc_1_cfg_fifo_41[2]; /* 0x00009148 */ - u32 rx_desc_1_cfg_fifo_42[2]; /* 0x00009150 */ - u32 rx_desc_1_cfg_fifo_43[2]; /* 0x00009158 */ - u32 rx_desc_1_cfg_fifo_44[2]; /* 0x00009160 */ - u32 rx_desc_1_cfg_fifo_45[2]; /* 0x00009168 */ - u32 rx_desc_1_cfg_fifo_46[2]; /* 0x00009170 */ - u32 rx_desc_1_cfg_fifo_47[2]; /* 0x00009178 */ - u32 rx_desc_1_cfg_fifo_48[2]; /* 0x00009180 */ - u32 rx_desc_1_cfg_fifo_49[2]; /* 0x00009188 */ - u32 rx_desc_1_cfg_fifo_50[2]; /* 0x00009190 */ - u32 rx_desc_1_cfg_fifo_51[2]; /* 0x00009198 */ - u32 rx_desc_1_cfg_fifo_52[2]; /* 0x000091a0 */ - u32 rx_desc_1_cfg_fifo_53[2]; /* 0x000091a8 */ - u32 rx_desc_1_cfg_fifo_54[2]; /* 0x000091b0 */ - u32 rx_desc_1_cfg_fifo_55[2]; /* 0x000091b8 */ - u32 rx_desc_1_cfg_fifo_56[2]; /* 0x000091c0 */ - u32 rx_desc_1_cfg_fifo_57[2]; /* 0x000091c8 */ - u32 rx_desc_1_cfg_fifo_58[2]; /* 0x000091d0 */ - u32 rx_desc_1_cfg_fifo_59[2]; /* 0x000091d8 */ - u32 rx_desc_1_cfg_fifo_60[2]; /* 0x000091e0 */ - u32 rx_desc_1_cfg_fifo_61[2]; /* 0x000091e8 */ - u32 rx_desc_1_cfg_fifo_62[2]; /* 0x000091f0 */ - u32 rx_desc_1_cfg_fifo_63[2]; /* 0x000091f8 */ - u32 rx_desc_0_ack_fifo_0[1]; /* 0x00009200 */ - u32 rx_desc_0_ack_fifo_1[1]; /* 0x00009204 */ - u32 rx_desc_0_ack_fifo_2[1]; /* 0x00009208 */ - u32 rx_desc_0_ack_fifo_3[1]; /* 0x0000920c */ - u32 rx_desc_0_ack_fifo_4[1]; /* 0x00009210 */ - u32 rx_desc_0_ack_fifo_5[1]; /* 0x00009214 */ - u32 rx_desc_0_ack_fifo_6[1]; /* 0x00009218 */ - u32 rx_desc_0_ack_fifo_7[1]; /* 0x0000921c */ - u32 rx_desc_0_ack_fifo_8[1]; /* 0x00009220 */ - u32 rx_desc_0_ack_fifo_9[1]; /* 0x00009224 */ - u32 rx_desc_0_ack_fifo_10[1]; /* 0x00009228 */ - u32 rx_desc_0_ack_fifo_11[1]; /* 0x0000922c */ - u32 rx_desc_0_ack_fifo_12[1]; /* 0x00009230 */ - u32 rx_desc_0_ack_fifo_13[1]; /* 0x00009234 */ - u32 rx_desc_0_ack_fifo_14[1]; /* 0x00009238 */ - u32 rx_desc_0_ack_fifo_15[1]; /* 0x0000923c */ - u32 rx_desc_0_ack_fifo_16[1]; /* 0x00009240 */ - u32 rx_desc_0_ack_fifo_17[1]; /* 0x00009244 */ - u32 rx_desc_0_ack_fifo_18[1]; /* 0x00009248 */ - u32 rx_desc_0_ack_fifo_19[1]; /* 0x0000924c */ - u32 rx_desc_0_ack_fifo_20[1]; /* 0x00009250 */ - u32 rx_desc_0_ack_fifo_21[1]; /* 0x00009254 */ - u32 rx_desc_0_ack_fifo_22[1]; /* 0x00009258 */ - u32 rx_desc_0_ack_fifo_23[1]; /* 0x0000925c */ - u32 rx_desc_0_ack_fifo_24[1]; /* 0x00009260 */ - u32 rx_desc_0_ack_fifo_25[1]; /* 0x00009264 */ - u32 rx_desc_0_ack_fifo_26[1]; /* 0x00009268 */ - u32 rx_desc_0_ack_fifo_27[1]; /* 0x0000926c */ - u32 rx_desc_0_ack_fifo_28[1]; /* 0x00009270 */ - u32 rx_desc_0_ack_fifo_29[1]; /* 0x00009274 */ - u32 rx_desc_0_ack_fifo_30[1]; /* 0x00009278 */ - u32 rx_desc_0_ack_fifo_31[1]; /* 0x0000927c */ - u32 rx_desc_0_ack_fifo_32[1]; /* 0x00009280 */ - u32 rx_desc_0_ack_fifo_33[1]; /* 0x00009284 */ - u32 rx_desc_0_ack_fifo_34[1]; /* 0x00009288 */ - u32 rx_desc_0_ack_fifo_35[1]; /* 0x0000928c */ - u32 rx_desc_0_ack_fifo_36[1]; /* 0x00009290 */ - u32 rx_desc_0_ack_fifo_37[1]; /* 0x00009294 */ - u32 rx_desc_0_ack_fifo_38[1]; /* 0x00009298 */ - u32 rx_desc_0_ack_fifo_39[1]; /* 0x0000929c */ - u32 rx_desc_0_ack_fifo_40[1]; /* 0x000092a0 */ - u32 rx_desc_0_ack_fifo_41[1]; /* 0x000092a4 */ - u32 rx_desc_0_ack_fifo_42[1]; /* 0x000092a8 */ - u32 rx_desc_0_ack_fifo_43[1]; /* 0x000092ac */ - u32 rx_desc_0_ack_fifo_44[1]; /* 0x000092b0 */ - u32 rx_desc_0_ack_fifo_45[1]; /* 0x000092b4 */ - u32 rx_desc_0_ack_fifo_46[1]; /* 0x000092b8 */ - u32 rx_desc_0_ack_fifo_47[1]; /* 0x000092bc */ - u32 rx_desc_0_ack_fifo_48[1]; /* 0x000092c0 */ - u32 rx_desc_0_ack_fifo_49[1]; /* 0x000092c4 */ - u32 rx_desc_0_ack_fifo_50[1]; /* 0x000092c8 */ - u32 rx_desc_0_ack_fifo_51[1]; /* 0x000092cc */ - u32 rx_desc_0_ack_fifo_52[1]; /* 0x000092d0 */ - u32 rx_desc_0_ack_fifo_53[1]; /* 0x000092d4 */ - u32 rx_desc_0_ack_fifo_54[1]; /* 0x000092d8 */ - u32 rx_desc_0_ack_fifo_55[1]; /* 0x000092dc */ - u32 rx_desc_0_ack_fifo_56[1]; /* 0x000092e0 */ - u32 rx_desc_0_ack_fifo_57[1]; /* 0x000092e4 */ - u32 rx_desc_0_ack_fifo_58[1]; /* 0x000092e8 */ - u32 rx_desc_0_ack_fifo_59[1]; /* 0x000092ec */ - u32 rx_desc_0_ack_fifo_60[1]; /* 0x000092f0 */ - u32 rx_desc_0_ack_fifo_61[1]; /* 0x000092f4 */ - u32 rx_desc_0_ack_fifo_62[1]; /* 0x000092f8 */ - u32 rx_desc_0_ack_fifo_63[1]; /* 0x000092fc */ - u32 rx_desc_1_ack_fifo_0[1]; /* 0x00009300 */ - u32 rx_desc_1_ack_fifo_1[1]; /* 0x00009304 */ - u32 rx_desc_1_ack_fifo_2[1]; /* 0x00009308 */ - u32 rx_desc_1_ack_fifo_3[1]; /* 0x0000930c */ - u32 rx_desc_1_ack_fifo_4[1]; /* 0x00009310 */ - u32 rx_desc_1_ack_fifo_5[1]; /* 0x00009314 */ - u32 rx_desc_1_ack_fifo_6[1]; /* 0x00009318 */ - u32 rx_desc_1_ack_fifo_7[1]; /* 0x0000931c */ - u32 rx_desc_1_ack_fifo_8[1]; /* 0x00009320 */ - u32 rx_desc_1_ack_fifo_9[1]; /* 0x00009324 */ - u32 rx_desc_1_ack_fifo_10[1]; /* 0x00009328 */ - u32 rx_desc_1_ack_fifo_11[1]; /* 0x0000932c */ - u32 rx_desc_1_ack_fifo_12[1]; /* 0x00009330 */ - u32 rx_desc_1_ack_fifo_13[1]; /* 0x00009334 */ - u32 rx_desc_1_ack_fifo_14[1]; /* 0x00009338 */ - u32 rx_desc_1_ack_fifo_15[1]; /* 0x0000933c */ - u32 rx_desc_1_ack_fifo_16[1]; /* 0x00009340 */ - u32 rx_desc_1_ack_fifo_17[1]; /* 0x00009344 */ - u32 rx_desc_1_ack_fifo_18[1]; /* 0x00009348 */ - u32 rx_desc_1_ack_fifo_19[1]; /* 0x0000934c */ - u32 rx_desc_1_ack_fifo_20[1]; /* 0x00009350 */ - u32 rx_desc_1_ack_fifo_21[1]; /* 0x00009354 */ - u32 rx_desc_1_ack_fifo_22[1]; /* 0x00009358 */ - u32 rx_desc_1_ack_fifo_23[1]; /* 0x0000935c */ - u32 rx_desc_1_ack_fifo_24[1]; /* 0x00009360 */ - u32 rx_desc_1_ack_fifo_25[1]; /* 0x00009364 */ - u32 rx_desc_1_ack_fifo_26[1]; /* 0x00009368 */ - u32 rx_desc_1_ack_fifo_27[1]; /* 0x0000936c */ - u32 rx_desc_1_ack_fifo_28[1]; /* 0x00009370 */ - u32 rx_desc_1_ack_fifo_29[1]; /* 0x00009374 */ - u32 rx_desc_1_ack_fifo_30[1]; /* 0x00009378 */ - u32 rx_desc_1_ack_fifo_31[1]; /* 0x0000937c */ - u32 rx_desc_1_ack_fifo_32[1]; /* 0x00009380 */ - u32 rx_desc_1_ack_fifo_33[1]; /* 0x00009384 */ - u32 rx_desc_1_ack_fifo_34[1]; /* 0x00009388 */ - u32 rx_desc_1_ack_fifo_35[1]; /* 0x0000938c */ - u32 rx_desc_1_ack_fifo_36[1]; /* 0x00009390 */ - u32 rx_desc_1_ack_fifo_37[1]; /* 0x00009394 */ - u32 rx_desc_1_ack_fifo_38[1]; /* 0x00009398 */ - u32 rx_desc_1_ack_fifo_39[1]; /* 0x0000939c */ - u32 rx_desc_1_ack_fifo_40[1]; /* 0x000093a0 */ - u32 rx_desc_1_ack_fifo_41[1]; /* 0x000093a4 */ - u32 rx_desc_1_ack_fifo_42[1]; /* 0x000093a8 */ - u32 rx_desc_1_ack_fifo_43[1]; /* 0x000093ac */ - u32 rx_desc_1_ack_fifo_44[1]; /* 0x000093b0 */ - u32 rx_desc_1_ack_fifo_45[1]; /* 0x000093b4 */ - u32 rx_desc_1_ack_fifo_46[1]; /* 0x000093b8 */ - u32 rx_desc_1_ack_fifo_47[1]; /* 0x000093bc */ - u32 rx_desc_1_ack_fifo_48[1]; /* 0x000093c0 */ - u32 rx_desc_1_ack_fifo_49[1]; /* 0x000093c4 */ - u32 rx_desc_1_ack_fifo_50[1]; /* 0x000093c8 */ - u32 rx_desc_1_ack_fifo_51[1]; /* 0x000093cc */ - u32 rx_desc_1_ack_fifo_52[1]; /* 0x000093d0 */ - u32 rx_desc_1_ack_fifo_53[1]; /* 0x000093d4 */ - u32 rx_desc_1_ack_fifo_54[1]; /* 0x000093d8 */ - u32 rx_desc_1_ack_fifo_55[1]; /* 0x000093dc */ - u32 rx_desc_1_ack_fifo_56[1]; /* 0x000093e0 */ - u32 rx_desc_1_ack_fifo_57[1]; /* 0x000093e4 */ - u32 rx_desc_1_ack_fifo_58[1]; /* 0x000093e8 */ - u32 rx_desc_1_ack_fifo_59[1]; /* 0x000093ec */ - u32 rx_desc_1_ack_fifo_60[1]; /* 0x000093f0 */ - u32 rx_desc_1_ack_fifo_61[1]; /* 0x000093f4 */ - u32 rx_desc_1_ack_fifo_62[1]; /* 0x000093f8 */ - u32 rx_desc_1_ack_fifo_63[1]; /* 0x000093fc */ - u32 tx_desc_ack_fifo_0[1]; /* 0x00009400 */ - u32 tx_desc_ack_fifo_1[1]; /* 0x00009404 */ - u32 tx_desc_ack_fifo_2[1]; /* 0x00009408 */ - u32 tx_desc_ack_fifo_3[1]; /* 0x0000940c */ - u32 tx_desc_ack_fifo_4[1]; /* 0x00009410 */ - u32 tx_desc_ack_fifo_5[1]; /* 0x00009414 */ - u32 tx_desc_ack_fifo_6[1]; /* 0x00009418 */ - u32 tx_desc_ack_fifo_7[1]; /* 0x0000941c */ - u32 tx_desc_ack_fifo_8[1]; /* 0x00009420 */ - u32 tx_desc_ack_fifo_9[1]; /* 0x00009424 */ - u32 tx_desc_ack_fifo_10[1]; /* 0x00009428 */ - u32 tx_desc_ack_fifo_11[1]; /* 0x0000942c */ - u32 tx_desc_ack_fifo_12[1]; /* 0x00009430 */ - u32 tx_desc_ack_fifo_13[1]; /* 0x00009434 */ - u32 tx_desc_ack_fifo_14[1]; /* 0x00009438 */ - u32 tx_desc_ack_fifo_15[1]; /* 0x0000943c */ - u32 tx_desc_ack_fifo_16[1]; /* 0x00009440 */ - u32 tx_desc_ack_fifo_17[1]; /* 0x00009444 */ - u32 tx_desc_ack_fifo_18[1]; /* 0x00009448 */ - u32 tx_desc_ack_fifo_19[1]; /* 0x0000944c */ - u32 tx_desc_ack_fifo_20[1]; /* 0x00009450 */ - u32 tx_desc_ack_fifo_21[1]; /* 0x00009454 */ - u32 tx_desc_ack_fifo_22[1]; /* 0x00009458 */ - u32 tx_desc_ack_fifo_23[1]; /* 0x0000945c */ - u32 tx_desc_ack_fifo_24[1]; /* 0x00009460 */ - u32 tx_desc_ack_fifo_25[1]; /* 0x00009464 */ - u32 tx_desc_ack_fifo_26[1]; /* 0x00009468 */ - u32 tx_desc_ack_fifo_27[1]; /* 0x0000946c */ - u32 tx_desc_ack_fifo_28[1]; /* 0x00009470 */ - u32 tx_desc_ack_fifo_29[1]; /* 0x00009474 */ - u32 tx_desc_ack_fifo_30[1]; /* 0x00009478 */ - u32 tx_desc_ack_fifo_31[1]; /* 0x0000947c */ - u32 tx_desc_ack_fifo_32[1]; /* 0x00009480 */ - u32 tx_desc_ack_fifo_33[1]; /* 0x00009484 */ - u32 tx_desc_ack_fifo_34[1]; /* 0x00009488 */ - u32 tx_desc_ack_fifo_35[1]; /* 0x0000948c */ - u32 tx_desc_ack_fifo_36[1]; /* 0x00009490 */ - u32 tx_desc_ack_fifo_37[1]; /* 0x00009494 */ - u32 tx_desc_ack_fifo_38[1]; /* 0x00009498 */ - u32 tx_desc_ack_fifo_39[1]; /* 0x0000949c */ - u32 tx_desc_ack_fifo_40[1]; /* 0x000094a0 */ - u32 tx_desc_ack_fifo_41[1]; /* 0x000094a4 */ - u32 tx_desc_ack_fifo_42[1]; /* 0x000094a8 */ - u32 tx_desc_ack_fifo_43[1]; /* 0x000094ac */ - u32 tx_desc_ack_fifo_44[1]; /* 0x000094b0 */ - u32 tx_desc_ack_fifo_45[1]; /* 0x000094b4 */ - u32 tx_desc_ack_fifo_46[1]; /* 0x000094b8 */ - u32 tx_desc_ack_fifo_47[1]; /* 0x000094bc */ - u32 tx_desc_ack_fifo_48[1]; /* 0x000094c0 */ - u32 tx_desc_ack_fifo_49[1]; /* 0x000094c4 */ - u32 tx_desc_ack_fifo_50[1]; /* 0x000094c8 */ - u32 tx_desc_ack_fifo_51[1]; /* 0x000094cc */ - u32 tx_desc_ack_fifo_52[1]; /* 0x000094d0 */ - u32 tx_desc_ack_fifo_53[1]; /* 0x000094d4 */ - u32 tx_desc_ack_fifo_54[1]; /* 0x000094d8 */ - u32 tx_desc_ack_fifo_55[1]; /* 0x000094dc */ - u32 tx_desc_ack_fifo_56[1]; /* 0x000094e0 */ - u32 tx_desc_ack_fifo_57[1]; /* 0x000094e4 */ - u32 tx_desc_ack_fifo_58[1]; /* 0x000094e8 */ - u32 tx_desc_ack_fifo_59[1]; /* 0x000094ec */ - u32 tx_desc_ack_fifo_60[1]; /* 0x000094f0 */ - u32 tx_desc_ack_fifo_61[1]; /* 0x000094f4 */ - u32 tx_desc_ack_fifo_62[1]; /* 0x000094f8 */ - u32 tx_desc_ack_fifo_63[1]; /* 0x000094fc */ - u32 cpu_mac_desc_intf_0[2]; /* 0x00009500 */ - u32 cpu_mac_desc_intf_1[2]; /* 0x00009508 */ - u32 cpu_mac_desc_intf_2[2]; /* 0x00009510 */ + u32 TxDescCfgFifo0[2]; /* 0x00008c00 */ + u32 TxDescCfgFifo1[2]; /* 0x00008c08 */ + u32 TxDescCfgFifo2[2]; /* 0x00008c10 */ + u32 TxDescCfgFifo3[2]; /* 0x00008c18 */ + u32 TxDescCfgFifo4[2]; /* 0x00008c20 */ + u32 TxDescCfgFifo5[2]; /* 0x00008c28 */ + u32 TxDescCfgFifo6[2]; /* 0x00008c30 */ + u32 TxDescCfgFifo7[2]; /* 0x00008c38 */ + u32 TxDescCfgFifo8[2]; /* 0x00008c40 */ + u32 TxDescCfgFifo9[2]; /* 0x00008c48 */ + u32 TxDescCfgFifo10[2]; /* 0x00008c50 */ + u32 TxDescCfgFifo11[2]; /* 0x00008c58 */ + u32 TxDescCfgFifo12[2]; /* 0x00008c60 */ + u32 TxDescCfgFifo13[2]; /* 0x00008c68 */ + u32 TxDescCfgFifo14[2]; /* 0x00008c70 */ + u32 TxDescCfgFifo15[2]; /* 0x00008c78 */ + u32 TxDescCfgFifo16[2]; /* 0x00008c80 */ + u32 TxDescCfgFifo17[2]; /* 0x00008c88 */ + u32 TxDescCfgFifo18[2]; /* 0x00008c90 */ + u32 TxDescCfgFifo19[2]; /* 0x00008c98 */ + u32 TxDescCfgFifo20[2]; /* 0x00008ca0 */ + u32 TxDescCfgFifo21[2]; /* 0x00008ca8 */ + u32 TxDescCfgFifo22[2]; /* 0x00008cb0 */ + u32 TxDescCfgFifo23[2]; /* 0x00008cb8 */ + u32 TxDescCfgFifo24[2]; /* 0x00008cc0 */ + u32 TxDescCfgFifo25[2]; /* 0x00008cc8 */ + u32 TxDescCfgFifo26[2]; /* 0x00008cd0 */ + u32 TxDescCfgFifo27[2]; /* 0x00008cd8 */ + u32 TxDescCfgFifo28[2]; /* 0x00008ce0 */ + u32 TxDescCfgFifo29[2]; /* 0x00008ce8 */ + u32 TxDescCfgFifo30[2]; /* 0x00008cf0 */ + u32 TxDescCfgFifo31[2]; /* 0x00008cf8 */ + u32 TxDescCfgFifo32[2]; /* 0x00008d00 */ + u32 TxDescCfgFifo33[2]; /* 0x00008d08 */ + u32 TxDescCfgFifo34[2]; /* 0x00008d10 */ + u32 TxDescCfgFifo35[2]; /* 0x00008d18 */ + u32 TxDescCfgFifo36[2]; /* 0x00008d20 */ + u32 TxDescCfgFifo37[2]; /* 0x00008d28 */ + u32 TxDescCfgFifo38[2]; /* 0x00008d30 */ + u32 TxDescCfgFifo39[2]; /* 0x00008d38 */ + u32 TxDescCfgFifo40[2]; /* 0x00008d40 */ + u32 TxDescCfgFifo41[2]; /* 0x00008d48 */ + u32 TxDescCfgFifo42[2]; /* 0x00008d50 */ + u32 TxDescCfgFifo43[2]; /* 0x00008d58 */ + u32 TxDescCfgFifo44[2]; /* 0x00008d60 */ + u32 TxDescCfgFifo45[2]; /* 0x00008d68 */ + u32 TxDescCfgFifo46[2]; /* 0x00008d70 */ + u32 TxDescCfgFifo47[2]; /* 0x00008d78 */ + u32 TxDescCfgFifo48[2]; /* 0x00008d80 */ + u32 TxDescCfgFifo49[2]; /* 0x00008d88 */ + u32 TxDescCfgFifo50[2]; /* 0x00008d90 */ + u32 TxDescCfgFifo51[2]; /* 0x00008d98 */ + u32 TxDescCfgFifo52[2]; /* 0x00008da0 */ + u32 TxDescCfgFifo53[2]; /* 0x00008da8 */ + u32 TxDescCfgFifo54[2]; /* 0x00008db0 */ + u32 TxDescCfgFifo55[2]; /* 0x00008db8 */ + u32 TxDescCfgFifo56[2]; /* 0x00008dc0 */ + u32 TxDescCfgFifo57[2]; /* 0x00008dc8 */ + u32 TxDescCfgFifo58[2]; /* 0x00008dd0 */ + u32 TxDescCfgFifo59[2]; /* 0x00008dd8 */ + u32 TxDescCfgFifo60[2]; /* 0x00008de0 */ + u32 TxDescCfgFifo61[2]; /* 0x00008de8 */ + u32 TxDescCfgFifo62[2]; /* 0x00008df0 */ + u32 TxDescCfgFifo63[2]; /* 0x00008df8 */ + u32 RxDesc0CfgFifo0[2]; /* 0x00008e00 */ + u32 RxDesc0CfgFifo1[2]; /* 0x00008e08 */ + u32 RxDesc0CfgFifo2[2]; /* 0x00008e10 */ + u32 RxDesc0CfgFifo3[2]; /* 0x00008e18 */ + u32 RxDesc0CfgFifo4[2]; /* 0x00008e20 */ + u32 RxDesc0CfgFifo5[2]; /* 0x00008e28 */ + u32 RxDesc0CfgFifo6[2]; /* 0x00008e30 */ + u32 RxDesc0CfgFifo7[2]; /* 0x00008e38 */ + u32 RxDesc0CfgFifo8[2]; /* 0x00008e40 */ + u32 RxDesc0CfgFifo9[2]; /* 0x00008e48 */ + u32 RxDesc0CfgFifo10[2]; /* 0x00008e50 */ + u32 RxDesc0CfgFifo11[2]; /* 0x00008e58 */ + u32 RxDesc0CfgFifo12[2]; /* 0x00008e60 */ + u32 RxDesc0CfgFifo13[2]; /* 0x00008e68 */ + u32 RxDesc0CfgFifo14[2]; /* 0x00008e70 */ + u32 RxDesc0CfgFifo15[2]; /* 0x00008e78 */ + u32 RxDesc0CfgFifo16[2]; /* 0x00008e80 */ + u32 RxDesc0CfgFifo17[2]; /* 0x00008e88 */ + u32 RxDesc0CfgFifo18[2]; /* 0x00008e90 */ + u32 RxDesc0CfgFifo19[2]; /* 0x00008e98 */ + u32 RxDesc0CfgFifo20[2]; /* 0x00008ea0 */ + u32 RxDesc0CfgFifo21[2]; /* 0x00008ea8 */ + u32 RxDesc0CfgFifo22[2]; /* 0x00008eb0 */ + u32 RxDesc0CfgFifo23[2]; /* 0x00008eb8 */ + u32 RxDesc0CfgFifo24[2]; /* 0x00008ec0 */ + u32 RxDesc0CfgFifo25[2]; /* 0x00008ec8 */ + u32 RxDesc0CfgFifo26[2]; /* 0x00008ed0 */ + u32 RxDesc0CfgFifo27[2]; /* 0x00008ed8 */ + u32 RxDesc0CfgFifo28[2]; /* 0x00008ee0 */ + u32 RxDesc0CfgFifo29[2]; /* 0x00008ee8 */ + u32 RxDesc0CfgFifo30[2]; /* 0x00008ef0 */ + u32 RxDesc0CfgFifo31[2]; /* 0x00008ef8 */ + u32 RxDesc0CfgFifo32[2]; /* 0x00008f00 */ + u32 RxDesc0CfgFifo33[2]; /* 0x00008f08 */ + u32 RxDesc0CfgFifo34[2]; /* 0x00008f10 */ + u32 RxDesc0CfgFifo35[2]; /* 0x00008f18 */ + u32 RxDesc0CfgFifo36[2]; /* 0x00008f20 */ + u32 RxDesc0CfgFifo37[2]; /* 0x00008f28 */ + u32 RxDesc0CfgFifo38[2]; /* 0x00008f30 */ + u32 RxDesc0CfgFifo39[2]; /* 0x00008f38 */ + u32 RxDesc0CfgFifo40[2]; /* 0x00008f40 */ + u32 RxDesc0CfgFifo41[2]; /* 0x00008f48 */ + u32 RxDesc0CfgFifo42[2]; /* 0x00008f50 */ + u32 RxDesc0CfgFifo43[2]; /* 0x00008f58 */ + u32 RxDesc0CfgFifo44[2]; /* 0x00008f60 */ + u32 RxDesc0CfgFifo45[2]; /* 0x00008f68 */ + u32 RxDesc0CfgFifo46[2]; /* 0x00008f70 */ + u32 RxDesc0CfgFifo47[2]; /* 0x00008f78 */ + u32 RxDesc0CfgFifo48[2]; /* 0x00008f80 */ + u32 RxDesc0CfgFifo49[2]; /* 0x00008f88 */ + u32 RxDesc0CfgFifo50[2]; /* 0x00008f90 */ + u32 RxDesc0CfgFifo51[2]; /* 0x00008f98 */ + u32 RxDesc0CfgFifo52[2]; /* 0x00008fa0 */ + u32 RxDesc0CfgFifo53[2]; /* 0x00008fa8 */ + u32 RxDesc0CfgFifo54[2]; /* 0x00008fb0 */ + u32 RxDesc0CfgFifo55[2]; /* 0x00008fb8 */ + u32 RxDesc0CfgFifo56[2]; /* 0x00008fc0 */ + u32 RxDesc0CfgFifo57[2]; /* 0x00008fc8 */ + u32 RxDesc0CfgFifo58[2]; /* 0x00008fd0 */ + u32 RxDesc0CfgFifo59[2]; /* 0x00008fd8 */ + u32 RxDesc0CfgFifo60[2]; /* 0x00008fe0 */ + u32 RxDesc0CfgFifo61[2]; /* 0x00008fe8 */ + u32 RxDesc0CfgFifo62[2]; /* 0x00008ff0 */ + u32 RxDesc0CfgFifo63[2]; /* 0x00008ff8 */ + u32 RxDesc1CfgFifo0[2]; /* 0x00009000 */ + u32 RxDesc1CfgFifo1[2]; /* 0x00009008 */ + u32 RxDesc1CfgFifo2[2]; /* 0x00009010 */ + u32 RxDesc1CfgFifo3[2]; /* 0x00009018 */ + u32 RxDesc1CfgFifo4[2]; /* 0x00009020 */ + u32 RxDesc1CfgFifo5[2]; /* 0x00009028 */ + u32 RxDesc1CfgFifo6[2]; /* 0x00009030 */ + u32 RxDesc1CfgFifo7[2]; /* 0x00009038 */ + u32 RxDesc1CfgFifo8[2]; /* 0x00009040 */ + u32 RxDesc1CfgFifo9[2]; /* 0x00009048 */ + u32 RxDesc1CfgFifo10[2]; /* 0x00009050 */ + u32 RxDesc1CfgFifo11[2]; /* 0x00009058 */ + u32 RxDesc1CfgFifo12[2]; /* 0x00009060 */ + u32 RxDesc1CfgFifo13[2]; /* 0x00009068 */ + u32 RxDesc1CfgFifo14[2]; /* 0x00009070 */ + u32 RxDesc1CfgFifo15[2]; /* 0x00009078 */ + u32 RxDesc1CfgFifo16[2]; /* 0x00009080 */ + u32 RxDesc1CfgFifo17[2]; /* 0x00009088 */ + u32 RxDesc1CfgFifo18[2]; /* 0x00009090 */ + u32 RxDesc1CfgFifo19[2]; /* 0x00009098 */ + u32 RxDesc1CfgFifo20[2]; /* 0x000090a0 */ + u32 RxDesc1CfgFifo21[2]; /* 0x000090a8 */ + u32 RxDesc1CfgFifo22[2]; /* 0x000090b0 */ + u32 RxDesc1CfgFifo23[2]; /* 0x000090b8 */ + u32 RxDesc1CfgFifo24[2]; /* 0x000090c0 */ + u32 RxDesc1CfgFifo25[2]; /* 0x000090c8 */ + u32 RxDesc1CfgFifo26[2]; /* 0x000090d0 */ + u32 RxDesc1CfgFifo27[2]; /* 0x000090d8 */ + u32 RxDesc1CfgFifo28[2]; /* 0x000090e0 */ + u32 RxDesc1CfgFifo29[2]; /* 0x000090e8 */ + u32 RxDesc1CfgFifo30[2]; /* 0x000090f0 */ + u32 RxDesc1CfgFifo31[2]; /* 0x000090f8 */ + u32 RxDesc1CfgFifo32[2]; /* 0x00009100 */ + u32 RxDesc1CfgFifo33[2]; /* 0x00009108 */ + u32 RxDesc1CfgFifo34[2]; /* 0x00009110 */ + u32 RxDesc1CfgFifo35[2]; /* 0x00009118 */ + u32 RxDesc1CfgFifo36[2]; /* 0x00009120 */ + u32 RxDesc1CfgFifo37[2]; /* 0x00009128 */ + u32 RxDesc1CfgFifo38[2]; /* 0x00009130 */ + u32 RxDesc1CfgFifo39[2]; /* 0x00009138 */ + u32 RxDesc1CfgFifo40[2]; /* 0x00009140 */ + u32 RxDesc1CfgFifo41[2]; /* 0x00009148 */ + u32 RxDesc1CfgFifo42[2]; /* 0x00009150 */ + u32 RxDesc1CfgFifo43[2]; /* 0x00009158 */ + u32 RxDesc1CfgFifo44[2]; /* 0x00009160 */ + u32 RxDesc1CfgFifo45[2]; /* 0x00009168 */ + u32 RxDesc1CfgFifo46[2]; /* 0x00009170 */ + u32 RxDesc1CfgFifo47[2]; /* 0x00009178 */ + u32 RxDesc1CfgFifo48[2]; /* 0x00009180 */ + u32 RxDesc1CfgFifo49[2]; /* 0x00009188 */ + u32 RxDesc1CfgFifo50[2]; /* 0x00009190 */ + u32 RxDesc1CfgFifo51[2]; /* 0x00009198 */ + u32 RxDesc1CfgFifo52[2]; /* 0x000091a0 */ + u32 RxDesc1CfgFifo53[2]; /* 0x000091a8 */ + u32 RxDesc1CfgFifo54[2]; /* 0x000091b0 */ + u32 RxDesc1CfgFifo55[2]; /* 0x000091b8 */ + u32 RxDesc1CfgFifo56[2]; /* 0x000091c0 */ + u32 RxDesc1CfgFifo57[2]; /* 0x000091c8 */ + u32 RxDesc1CfgFifo58[2]; /* 0x000091d0 */ + u32 RxDesc1CfgFifo59[2]; /* 0x000091d8 */ + u32 RxDesc1CfgFifo60[2]; /* 0x000091e0 */ + u32 RxDesc1CfgFifo61[2]; /* 0x000091e8 */ + u32 RxDesc1CfgFifo62[2]; /* 0x000091f0 */ + u32 RxDesc1CfgFifo63[2]; /* 0x000091f8 */ + u32 RxDesc0AckFifo0[1]; /* 0x00009200 */ + u32 RxDesc0AckFifo1[1]; /* 0x00009204 */ + u32 RxDesc0AckFifo2[1]; /* 0x00009208 */ + u32 RxDesc0AckFifo3[1]; /* 0x0000920c */ + u32 RxDesc0AckFifo4[1]; /* 0x00009210 */ + u32 RxDesc0AckFifo5[1]; /* 0x00009214 */ + u32 RxDesc0AckFifo6[1]; /* 0x00009218 */ + u32 RxDesc0AckFifo7[1]; /* 0x0000921c */ + u32 RxDesc0AckFifo8[1]; /* 0x00009220 */ + u32 RxDesc0AckFifo9[1]; /* 0x00009224 */ + u32 RxDesc0AckFifo10[1]; /* 0x00009228 */ + u32 RxDesc0AckFifo11[1]; /* 0x0000922c */ + u32 RxDesc0AckFifo12[1]; /* 0x00009230 */ + u32 RxDesc0AckFifo13[1]; /* 0x00009234 */ + u32 RxDesc0AckFifo14[1]; /* 0x00009238 */ + u32 RxDesc0AckFifo15[1]; /* 0x0000923c */ + u32 RxDesc0AckFifo16[1]; /* 0x00009240 */ + u32 RxDesc0AckFifo17[1]; /* 0x00009244 */ + u32 RxDesc0AckFifo18[1]; /* 0x00009248 */ + u32 RxDesc0AckFifo19[1]; /* 0x0000924c */ + u32 RxDesc0AckFifo20[1]; /* 0x00009250 */ + u32 RxDesc0AckFifo21[1]; /* 0x00009254 */ + u32 RxDesc0AckFifo22[1]; /* 0x00009258 */ + u32 RxDesc0AckFifo23[1]; /* 0x0000925c */ + u32 RxDesc0AckFifo24[1]; /* 0x00009260 */ + u32 RxDesc0AckFifo25[1]; /* 0x00009264 */ + u32 RxDesc0AckFifo26[1]; /* 0x00009268 */ + u32 RxDesc0AckFifo27[1]; /* 0x0000926c */ + u32 RxDesc0AckFifo28[1]; /* 0x00009270 */ + u32 RxDesc0AckFifo29[1]; /* 0x00009274 */ + u32 RxDesc0AckFifo30[1]; /* 0x00009278 */ + u32 RxDesc0AckFifo31[1]; /* 0x0000927c */ + u32 RxDesc0AckFifo32[1]; /* 0x00009280 */ + u32 RxDesc0AckFifo33[1]; /* 0x00009284 */ + u32 RxDesc0AckFifo34[1]; /* 0x00009288 */ + u32 RxDesc0AckFifo35[1]; /* 0x0000928c */ + u32 RxDesc0AckFifo36[1]; /* 0x00009290 */ + u32 RxDesc0AckFifo37[1]; /* 0x00009294 */ + u32 RxDesc0AckFifo38[1]; /* 0x00009298 */ + u32 RxDesc0AckFifo39[1]; /* 0x0000929c */ + u32 RxDesc0AckFifo40[1]; /* 0x000092a0 */ + u32 RxDesc0AckFifo41[1]; /* 0x000092a4 */ + u32 RxDesc0AckFifo42[1]; /* 0x000092a8 */ + u32 RxDesc0AckFifo43[1]; /* 0x000092ac */ + u32 RxDesc0AckFifo44[1]; /* 0x000092b0 */ + u32 RxDesc0AckFifo45[1]; /* 0x000092b4 */ + u32 RxDesc0AckFifo46[1]; /* 0x000092b8 */ + u32 RxDesc0AckFifo47[1]; /* 0x000092bc */ + u32 RxDesc0AckFifo48[1]; /* 0x000092c0 */ + u32 RxDesc0AckFifo49[1]; /* 0x000092c4 */ + u32 RxDesc0AckFifo50[1]; /* 0x000092c8 */ + u32 RxDesc0AckFifo51[1]; /* 0x000092cc */ + u32 RxDesc0AckFifo52[1]; /* 0x000092d0 */ + u32 RxDesc0AckFifo53[1]; /* 0x000092d4 */ + u32 RxDesc0AckFifo54[1]; /* 0x000092d8 */ + u32 RxDesc0AckFifo55[1]; /* 0x000092dc */ + u32 RxDesc0AckFifo56[1]; /* 0x000092e0 */ + u32 RxDesc0AckFifo57[1]; /* 0x000092e4 */ + u32 RxDesc0AckFifo58[1]; /* 0x000092e8 */ + u32 RxDesc0AckFifo59[1]; /* 0x000092ec */ + u32 RxDesc0AckFifo60[1]; /* 0x000092f0 */ + u32 RxDesc0AckFifo61[1]; /* 0x000092f4 */ + u32 RxDesc0AckFifo62[1]; /* 0x000092f8 */ + u32 RxDesc0AckFifo63[1]; /* 0x000092fc */ + u32 RxDesc1AckFifo0[1]; /* 0x00009300 */ + u32 RxDesc1AckFifo1[1]; /* 0x00009304 */ + u32 RxDesc1AckFifo2[1]; /* 0x00009308 */ + u32 RxDesc1AckFifo3[1]; /* 0x0000930c */ + u32 RxDesc1AckFifo4[1]; /* 0x00009310 */ + u32 RxDesc1AckFifo5[1]; /* 0x00009314 */ + u32 RxDesc1AckFifo6[1]; /* 0x00009318 */ + u32 RxDesc1AckFifo7[1]; /* 0x0000931c */ + u32 RxDesc1AckFifo8[1]; /* 0x00009320 */ + u32 RxDesc1AckFifo9[1]; /* 0x00009324 */ + u32 RxDesc1AckFifo10[1]; /* 0x00009328 */ + u32 RxDesc1AckFifo11[1]; /* 0x0000932c */ + u32 RxDesc1AckFifo12[1]; /* 0x00009330 */ + u32 RxDesc1AckFifo13[1]; /* 0x00009334 */ + u32 RxDesc1AckFifo14[1]; /* 0x00009338 */ + u32 RxDesc1AckFifo15[1]; /* 0x0000933c */ + u32 RxDesc1AckFifo16[1]; /* 0x00009340 */ + u32 RxDesc1AckFifo17[1]; /* 0x00009344 */ + u32 RxDesc1AckFifo18[1]; /* 0x00009348 */ + u32 RxDesc1AckFifo19[1]; /* 0x0000934c */ + u32 RxDesc1AckFifo20[1]; /* 0x00009350 */ + u32 RxDesc1AckFifo21[1]; /* 0x00009354 */ + u32 RxDesc1AckFifo22[1]; /* 0x00009358 */ + u32 RxDesc1AckFifo23[1]; /* 0x0000935c */ + u32 RxDesc1AckFifo24[1]; /* 0x00009360 */ + u32 RxDesc1AckFifo25[1]; /* 0x00009364 */ + u32 RxDesc1AckFifo26[1]; /* 0x00009368 */ + u32 RxDesc1AckFifo27[1]; /* 0x0000936c */ + u32 RxDesc1AckFifo28[1]; /* 0x00009370 */ + u32 RxDesc1AckFifo29[1]; /* 0x00009374 */ + u32 RxDesc1AckFifo30[1]; /* 0x00009378 */ + u32 RxDesc1AckFifo31[1]; /* 0x0000937c */ + u32 RxDesc1AckFifo32[1]; /* 0x00009380 */ + u32 RxDesc1AckFifo33[1]; /* 0x00009384 */ + u32 RxDesc1AckFifo34[1]; /* 0x00009388 */ + u32 RxDesc1AckFifo35[1]; /* 0x0000938c */ + u32 RxDesc1AckFifo36[1]; /* 0x00009390 */ + u32 RxDesc1AckFifo37[1]; /* 0x00009394 */ + u32 RxDesc1AckFifo38[1]; /* 0x00009398 */ + u32 RxDesc1AckFifo39[1]; /* 0x0000939c */ + u32 RxDesc1AckFifo40[1]; /* 0x000093a0 */ + u32 RxDesc1AckFifo41[1]; /* 0x000093a4 */ + u32 RxDesc1AckFifo42[1]; /* 0x000093a8 */ + u32 RxDesc1AckFifo43[1]; /* 0x000093ac */ + u32 RxDesc1AckFifo44[1]; /* 0x000093b0 */ + u32 RxDesc1AckFifo45[1]; /* 0x000093b4 */ + u32 RxDesc1AckFifo46[1]; /* 0x000093b8 */ + u32 RxDesc1AckFifo47[1]; /* 0x000093bc */ + u32 RxDesc1AckFifo48[1]; /* 0x000093c0 */ + u32 RxDesc1AckFifo49[1]; /* 0x000093c4 */ + u32 RxDesc1AckFifo50[1]; /* 0x000093c8 */ + u32 RxDesc1AckFifo51[1]; /* 0x000093cc */ + u32 RxDesc1AckFifo52[1]; /* 0x000093d0 */ + u32 RxDesc1AckFifo53[1]; /* 0x000093d4 */ + u32 RxDesc1AckFifo54[1]; /* 0x000093d8 */ + u32 RxDesc1AckFifo55[1]; /* 0x000093dc */ + u32 RxDesc1AckFifo56[1]; /* 0x000093e0 */ + u32 RxDesc1AckFifo57[1]; /* 0x000093e4 */ + u32 RxDesc1AckFifo58[1]; /* 0x000093e8 */ + u32 RxDesc1AckFifo59[1]; /* 0x000093ec */ + u32 RxDesc1AckFifo60[1]; /* 0x000093f0 */ + u32 RxDesc1AckFifo61[1]; /* 0x000093f4 */ + u32 RxDesc1AckFifo62[1]; /* 0x000093f8 */ + u32 RxDesc1AckFifo63[1]; /* 0x000093fc */ + u32 TxDescAckFifo0[1]; /* 0x00009400 */ + u32 TxDescAckFifo1[1]; /* 0x00009404 */ + u32 TxDescAckFifo2[1]; /* 0x00009408 */ + u32 TxDescAckFifo3[1]; /* 0x0000940c */ + u32 TxDescAckFifo4[1]; /* 0x00009410 */ + u32 TxDescAckFifo5[1]; /* 0x00009414 */ + u32 TxDescAckFifo6[1]; /* 0x00009418 */ + u32 TxDescAckFifo7[1]; /* 0x0000941c */ + u32 TxDescAckFifo8[1]; /* 0x00009420 */ + u32 TxDescAckFifo9[1]; /* 0x00009424 */ + u32 TxDescAckFifo10[1]; /* 0x00009428 */ + u32 TxDescAckFifo11[1]; /* 0x0000942c */ + u32 TxDescAckFifo12[1]; /* 0x00009430 */ + u32 TxDescAckFifo13[1]; /* 0x00009434 */ + u32 TxDescAckFifo14[1]; /* 0x00009438 */ + u32 TxDescAckFifo15[1]; /* 0x0000943c */ + u32 TxDescAckFifo16[1]; /* 0x00009440 */ + u32 TxDescAckFifo17[1]; /* 0x00009444 */ + u32 TxDescAckFifo18[1]; /* 0x00009448 */ + u32 TxDescAckFifo19[1]; /* 0x0000944c */ + u32 TxDescAckFifo20[1]; /* 0x00009450 */ + u32 TxDescAckFifo21[1]; /* 0x00009454 */ + u32 TxDescAckFifo22[1]; /* 0x00009458 */ + u32 TxDescAckFifo23[1]; /* 0x0000945c */ + u32 TxDescAckFifo24[1]; /* 0x00009460 */ + u32 TxDescAckFifo25[1]; /* 0x00009464 */ + u32 TxDescAckFifo26[1]; /* 0x00009468 */ + u32 TxDescAckFifo27[1]; /* 0x0000946c */ + u32 TxDescAckFifo28[1]; /* 0x00009470 */ + u32 TxDescAckFifo29[1]; /* 0x00009474 */ + u32 TxDescAckFifo30[1]; /* 0x00009478 */ + u32 TxDescAckFifo31[1]; /* 0x0000947c */ + u32 TxDescAckFifo32[1]; /* 0x00009480 */ + u32 TxDescAckFifo33[1]; /* 0x00009484 */ + u32 TxDescAckFifo34[1]; /* 0x00009488 */ + u32 TxDescAckFifo35[1]; /* 0x0000948c */ + u32 TxDescAckFifo36[1]; /* 0x00009490 */ + u32 TxDescAckFifo37[1]; /* 0x00009494 */ + u32 TxDescAckFifo38[1]; /* 0x00009498 */ + u32 TxDescAckFifo39[1]; /* 0x0000949c */ + u32 TxDescAckFifo40[1]; /* 0x000094a0 */ + u32 TxDescAckFifo41[1]; /* 0x000094a4 */ + u32 TxDescAckFifo42[1]; /* 0x000094a8 */ + u32 TxDescAckFifo43[1]; /* 0x000094ac */ + u32 TxDescAckFifo44[1]; /* 0x000094b0 */ + u32 TxDescAckFifo45[1]; /* 0x000094b4 */ + u32 TxDescAckFifo46[1]; /* 0x000094b8 */ + u32 TxDescAckFifo47[1]; /* 0x000094bc */ + u32 TxDescAckFifo48[1]; /* 0x000094c0 */ + u32 TxDescAckFifo49[1]; /* 0x000094c4 */ + u32 TxDescAckFifo50[1]; /* 0x000094c8 */ + u32 TxDescAckFifo51[1]; /* 0x000094cc */ + u32 TxDescAckFifo52[1]; /* 0x000094d0 */ + u32 TxDescAckFifo53[1]; /* 0x000094d4 */ + u32 TxDescAckFifo54[1]; /* 0x000094d8 */ + u32 TxDescAckFifo55[1]; /* 0x000094dc */ + u32 TxDescAckFifo56[1]; /* 0x000094e0 */ + u32 TxDescAckFifo57[1]; /* 0x000094e4 */ + u32 TxDescAckFifo58[1]; /* 0x000094e8 */ + u32 TxDescAckFifo59[1]; /* 0x000094ec */ + u32 TxDescAckFifo60[1]; /* 0x000094f0 */ + u32 TxDescAckFifo61[1]; /* 0x000094f4 */ + u32 TxDescAckFifo62[1]; /* 0x000094f8 */ + u32 TxDescAckFifo63[1]; /* 0x000094fc */ + u32 CpuMacDescIntf0[2]; /* 0x00009500 */ + u32 CpuMacDescIntf1[2]; /* 0x00009508 */ + u32 CpuMacDescIntf2[2]; /* 0x00009510 */ }; -/* tx_pkt_fifo Definition */ -#define TX_PKT_FIFO_W0_TX_PKT_FIFO_FIELD0 BIT(0) -#define TX_PKT_FIFO_W1_TX_PKT_FIFO_FIELD1 BIT(0) -#define TX_PKT_FIFO_W2_TX_PKT_FIFO_FIELD2 BIT(0) +/* ################################################################################ + * # TxPktFifo Definition */ +#define TX_PKT_FIFO_W0_TX_PKT_FIFO_FIELD0_BIT 0 +#define TX_PKT_FIFO_W1_TX_PKT_FIFO_FIELD1_BIT 0 +#define TX_PKT_FIFO_W2_TX_PKT_FIFO_FIELD2_BIT 0 #define TX_PKT_FIFO_W0_TX_PKT_FIFO_FIELD0_MASK 0xffffffff #define TX_PKT_FIFO_W1_TX_PKT_FIFO_FIELD1_MASK 0xffffffff #define TX_PKT_FIFO_W2_TX_PKT_FIFO_FIELD2_MASK 0x0000000f -/* rx_pkt_msg_fifo Definition */ -#define RX_PKT_MSG_FIFO_W0_RX_PKT_MSG_FIFO_FIELD BIT(0) +/* ################################################################################ + * # RxPktMsgFifo Definition */ +#define RX_PKT_MSG_FIFO_W0_RX_PKT_MSG_FIFO_FIELD_BIT 0 #define RX_PKT_MSG_FIFO_W0_RX_PKT_MSG_FIFO_FIELD_MASK 0x0000ffff -/* cpu_mac_stats_ram Definition */ -#define CPU_MAC_STATS_RAM_W0_BYTE_CNT_31_0 BIT(0) -#define CPU_MAC_STATS_RAM_W1_BYTE_CNT_39_32 BIT(0) -#define CPU_MAC_STATS_RAM_W2_FRAME_CNT_31_0 BIT(0) -#define CPU_MAC_STATS_RAM_W3_FRAME_CNT_33_32 BIT(0) +/* ################################################################################ + * # CpuMacStatsRam Definition */ +#define CPU_MAC_STATS_RAM_W0_BYTE_CNT_31_0_BIT 0 +#define CPU_MAC_STATS_RAM_W1_BYTE_CNT_39_32_BIT 0 +#define CPU_MAC_STATS_RAM_W2_FRAME_CNT_31_0_BIT 0 +#define CPU_MAC_STATS_RAM_W3_FRAME_CNT_33_32_BIT 0 #define CPU_MAC_STATS_RAM_W0_BYTE_CNT_31_0_MASK 0xffffffff #define CPU_MAC_STATS_RAM_W1_BYTE_CNT_39_32_MASK 0x000000ff #define CPU_MAC_STATS_RAM_W2_FRAME_CNT_31_0_MASK 0xffffffff #define CPU_MAC_STATS_RAM_W3_FRAME_CNT_33_32_MASK 0x00000003 -/* tx_desc_cfg_fifo Definition */ -#define TX_DESC_CFG_FIFO_W0_TX_DESC_CFG_FIFO_FIELD0 BIT(0) -#define TX_DESC_CFG_FIFO_W1_TX_DESC_CFG_FIFO_FIELD1 BIT(0) +/* ################################################################################ + * # TxDescCfgFifo Definition */ +#define TX_DESC_CFG_FIFO_W0_TX_DESC_CFG_FIFO_FIELD0_BIT 0 +#define TX_DESC_CFG_FIFO_W1_TX_DESC_CFG_FIFO_FIELD1_BIT 0 #define TX_DESC_CFG_FIFO_W0_TX_DESC_CFG_FIFO_FIELD0_MASK 0xffffffff #define TX_DESC_CFG_FIFO_W1_TX_DESC_CFG_FIFO_FIELD1_MASK 0x01ffffff -/* rx_desc_0_cfg_fifo Definition */ -#define RX_DESC0_CFG_FIFO_W0_RX_DESC0_CFG_FIFO_FIELD0 BIT(0) -#define RX_DESC0_CFG_FIFO_W1_RX_DESC0_CFG_FIFO_FIELD1 BIT(0) +/* ################################################################################ + * # RxDesc0CfgFifo Definition */ +#define RX_DESC0_CFG_FIFO_W0_RX_DESC0_CFG_FIFO_FIELD0_BIT 0 +#define RX_DESC0_CFG_FIFO_W1_RX_DESC0_CFG_FIFO_FIELD1_BIT 0 #define RX_DESC0_CFG_FIFO_W0_RX_DESC0_CFG_FIFO_FIELD0_MASK 0xffffffff #define RX_DESC0_CFG_FIFO_W1_RX_DESC0_CFG_FIFO_FIELD1_MASK 0x01ffffff -/* rx_desc_1_cfg_fifo Definition */ -#define RX_DESC1_CFG_FIFO_W0_RX_DESC1_CFG_FIFO_FIELD0 BIT(0) -#define RX_DESC1_CFG_FIFO_W1_RX_DESC1_CFG_FIFO_FIELD1 BIT(0) +/* ################################################################################ + * # RxDesc1CfgFifo Definition */ +#define RX_DESC1_CFG_FIFO_W0_RX_DESC1_CFG_FIFO_FIELD0_BIT 0 +#define RX_DESC1_CFG_FIFO_W1_RX_DESC1_CFG_FIFO_FIELD1_BIT 0 #define RX_DESC1_CFG_FIFO_W0_RX_DESC1_CFG_FIFO_FIELD0_MASK 0xffffffff #define RX_DESC1_CFG_FIFO_W1_RX_DESC1_CFG_FIFO_FIELD1_MASK 0x01ffffff -/* rx_desc_0_ack_fifo Definition */ -#define RX_DESC0_ACK_FIFO_W0_RX_DESC0_ACK_FIFO_FIELD BIT(0) +/* ################################################################################ + * # RxDesc0AckFifo Definition */ +#define RX_DESC0_ACK_FIFO_W0_RX_DESC0_ACK_FIFO_FIELD_BIT 0 #define RX_DESC0_ACK_FIFO_W0_RX_DESC0_ACK_FIFO_FIELD_MASK 0x0007ffff -/* rx_desc_1_ack_fifo Definition */ -#define RX_DESC1_ACK_FIFO_W0_RX_DESC1_ACK_FIFO_FIELD BIT(0) +/* ################################################################################ + * # RxDesc1AckFifo Definition */ +#define RX_DESC1_ACK_FIFO_W0_RX_DESC1_ACK_FIFO_FIELD_BIT 0 #define RX_DESC1_ACK_FIFO_W0_RX_DESC1_ACK_FIFO_FIELD_MASK 0x0007ffff -/* tx_desc_ack_fifo Definition */ -#define TX_DESC_ACK_FIFO_W0_TX_DESC_ACK_FIFO_FIELD BIT(0) +/* ################################################################################ + * # TxDescAckFifo Definition */ +#define TX_DESC_ACK_FIFO_W0_TX_DESC_ACK_FIFO_FIELD_BIT 0 #define TX_DESC_ACK_FIFO_W0_TX_DESC_ACK_FIFO_FIELD_MASK 0x00000001 -/* cpu_mac_desc_intf Definition */ -#define CPU_MAC_DESC_INTF_W0_DESC_ADDR_31_0 BIT(0) -#define CPU_MAC_DESC_INTF_W1_DESC_ADDR_39_32 BIT(0) -#define CPU_MAC_DESC_INTF_W1_DESC_SIZE BIT(8) -#define CPU_MAC_DESC_INTF_W1_DESC_SOP BIT(22) -#define CPU_MAC_DESC_INTF_W1_DESC_ERR_TYPE BIT(25) -#define CPU_MAC_DESC_INTF_W1_DESC_EOP BIT(23) -#define CPU_MAC_DESC_INTF_W1_DESC_ERR BIT(24) +/* ################################################################################ + * # CpuMacDescIntf Definition */ +#define CPU_MAC_DESC_INTF_W0_DESC_ADDR_31_0_BIT 0 +#define CPU_MAC_DESC_INTF_W1_DESC_ADDR_39_32_BIT 0 +#define CPU_MAC_DESC_INTF_W1_DESC_EOP_BIT 23 +#define CPU_MAC_DESC_INTF_W1_DESC_ERR_BIT 24 +#define CPU_MAC_DESC_INTF_W1_DESC_ERR_TYPE_BIT 25 +#define CPU_MAC_DESC_INTF_W1_DESC_SIZE_BIT 8 +#define CPU_MAC_DESC_INTF_W1_DESC_SOP_BIT 22 #define CPU_MAC_DESC_INTF_W0_DESC_ADDR_31_0_MASK 0xffffffff #define CPU_MAC_DESC_INTF_W1_DESC_ADDR_39_32_MASK 0x000000ff -#define CPU_MAC_DESC_INTF_W1_DESC_SIZE_MASK 0x003fff00 -#define CPU_MAC_DESC_INTF_W1_DESC_SOP_MASK 0x00400000 -#define CPU_MAC_DESC_INTF_W1_DESC_ERR_TYPE_MASK 0x0e000000 #define CPU_MAC_DESC_INTF_W1_DESC_EOP_MASK 0x00800000 #define CPU_MAC_DESC_INTF_W1_DESC_ERR_MASK 0x01000000 - -/* defing MDIOSOC_REG_BASE 0x00000000 */ - -struct mdio_soc_regs { - u32 mdio_soc_cmd_0[2]; /* 0x00000000 */ - u32 mdio_soc_cmd_1[2]; /* 0x00000008 */ - u32 mdio_soc_status_1; /* 0x00000010 */ - u32 mdio_soc_status_0; /* 0x00000014 */ - u32 mdio_soc_reserved; /* 0x00000018 */ - u32 mdio_soc_cfg_0; /* 0x0000001c */ - u32 mdio_soc_cfg_1; /* 0x00000020 */ -}; - -/* mdio_soc_cmd_0 Definition */ -#define MDIO_SOC_CMD0_W0_OP_CODE_CMD_LANE0 BIT(26) -#define MDIO_SOC_CMD0_W0_REG_ADD_CMD_LANE0 BIT(16) -#define MDIO_SOC_CMD0_W0_DATA_CMD_LANE0 BIT(0) -#define MDIO_SOC_CMD0_W0_PHY_ADD_CMD_LANE0 BIT(21) -#define MDIO_SOC_CMD0_W1_START_CMD_LANE0 BIT(0) - -#define MDIO_SOC_CMD0_W0_OP_CODE_CMD_LANE0_MASK 0x0c000000 -#define MDIO_SOC_CMD0_W0_REG_ADD_CMD_LANE0_MASK 0x001f0000 -#define MDIO_SOC_CMD0_W0_DATA_CMD_LANE0_MASK 0x0000ffff -#define MDIO_SOC_CMD0_W0_PHY_ADD_CMD_LANE0_MASK 0x03e00000 -#define MDIO_SOC_CMD0_W1_START_CMD_LANE0_MASK 0x00000003 - -/* mdio_soc_cmd_1 Definition */ -#define MDIO_SOC_CMD1_W0_PHY_ADD_CMD_LANE1 BIT(21) -#define MDIO_SOC_CMD1_W0_OP_CODE_CMD_LANE1 BIT(26) -#define MDIO_SOC_CMD1_W0_DATA_CMD_LANE1 BIT(0) -#define MDIO_SOC_CMD1_W0_REG_ADD_CMD_LANE1 BIT(16) -#define MDIO_SOC_CMD1_W1_START_CMD_LANE1 BIT(0) - -#define MDIO_SOC_CMD1_W0_PHY_ADD_CMD_LANE1_MASK 0x03e00000 -#define MDIO_SOC_CMD1_W0_OP_CODE_CMD_LANE1_MASK 0x0c000000 -#define MDIO_SOC_CMD1_W0_DATA_CMD_LANE1_MASK 0x0000ffff -#define MDIO_SOC_CMD1_W0_REG_ADD_CMD_LANE1_MASK 0x001f0000 -#define MDIO_SOC_CMD1_W1_START_CMD_LANE1_MASK 0x00000003 - -/* mdio_soc_status_1 Definition */ -#define MDIO_SOC_STATUS1_W0_MDIO_CMD_DONE_LANE1 BIT(16) -#define MDIO_SOC_STATUS1_W0_MDIO_READ_DATA_LANE1 BIT(0) - -#define MDIO_SOC_STATUS1_W0_MDIO_CMD_DONE_LANE1_MASK 0x00010000 -#define MDIO_SOC_STATUS1_W0_MDIO_READ_DATA_LANE1_MASK 0x0000ffff - -/* mdio_soc_status_0 Definition */ -#define MDIO_SOC_STATUS0_W0_MDIO_CMD_DONE_LANE0 BIT(16) -#define MDIO_SOC_STATUS0_W0_MDIO_READ_DATA_LANE0 BIT(0) - -#define MDIO_SOC_STATUS0_W0_MDIO_CMD_DONE_LANE0_MASK 0x00010000 -#define MDIO_SOC_STATUS0_W0_MDIO_READ_DATA_LANE0_MASK 0x0000ffff - -/* mdio_soc_reserved Definition */ -#define MDIO_SOC_RESERVED_W0_RESERVED BIT(0) - -#define MDIO_SOC_RESERVED_W0_RESERVED_MASK 0x0000ffff - -/* mdio_soc_cfg_0 Definition */ -#define MDIO_SOC_CFG0_W0_MDIO_MAC_PRE_LANE0 BIT(0) -#define MDIO_SOC_CFG0_W0_MDIO_IN_DLY_LANE0 BIT(8) - -#define MDIO_SOC_CFG0_W0_MDIO_MAC_PRE_LANE0_MASK 0x0000003f -#define MDIO_SOC_CFG0_W0_MDIO_IN_DLY_LANE0_MASK 0x00000f00 - -/* mdio_soc_cfg_1 Definition */ -#define MDIO_SOC_CFG1_W0_MDIO_IN_DLY_LANE1 BIT(8) -#define MDIO_SOC_CFG1_W0_MDIO_MAC_PRE_LANE1 BIT(0) - -#define MDIO_SOC_CFG1_W0_MDIO_IN_DLY_LANE1_MASK 0x00000f00 -#define MDIO_SOC_CFG1_W0_MDIO_MAC_PRE_LANE1_MASK 0x0000003f +#define CPU_MAC_DESC_INTF_W1_DESC_ERR_TYPE_MASK 0x0e000000 +#define CPU_MAC_DESC_INTF_W1_DESC_SIZE_MASK 0x003fff00 +#define CPU_MAC_DESC_INTF_W1_DESC_SOP_MASK 0x00400000 #define CPUMACUNIT_MEM_BASE 0x00000400 #define CPUMACUNIT_REG_BASE 0x00000040 -struct cpu_mac_unit_regs { - u32 cpu_mac_unit_hss_mon[7]; /* 0x00000040 */ +struct CpuMacUnit_regs { + u32 CpuMacUnitHssMon[7]; /* 0x00000040 */ u32 rsv23; - u32 cpu_mac_hss_reg_acc_timing_cfg[2]; /* 0x00000060 */ - u32 cpu_mac_unit_reset_ctl; /* 0x00000068 */ - u32 cpu_mac_unit_hss_reg_acc_ctl; /* 0x0000006c */ - u32 cpu_mac_unit_hss_reg_acc_result; /* 0x00000070 */ - u32 cpu_mac_unit_axi_cfg; /* 0x00000074 */ - u32 cpu_mac_unit_ts_cfg; /* 0x00000078 */ - u32 cpu_mac_unit_fifo_status; /* 0x0000007c */ - u32 cpu_mac_unit_ts_mon[3]; /* 0x00000080 */ + u32 CpuMacHssRegAccTimingCfg[2]; /* 0x00000060 */ + u32 CpuMacUnitResetCtl; /* 0x00000068 */ + u32 CpuMacUnitHssRegAccCtl; /* 0x0000006c */ + u32 CpuMacUnitHssRegAccResult; /* 0x00000070 */ + u32 CpuMacUnitAxiCfg; /* 0x00000074 */ + u32 CpuMacUnitTsCfg; /* 0x00000078 */ + u32 CpuMacUnitFifoStatus; /* 0x0000007c */ + u32 CpuMacUnitTsMon[3]; /* 0x00000080 */ u32 rsv35; - u32 cpu_mac_unit_ref_pulse_cfg[4]; /* 0x00000090 */ - u32 cpu_mac_unit_interrupt_func[4]; /* 0x000000a0 */ + u32 CpuMacUnitRefPulseCfg[4]; /* 0x00000090 */ + u32 CpuMacUnitInterruptFunc[4]; /* 0x000000a0 */ u32 rsv44; u32 rsv45; u32 rsv46; u32 rsv47; - u32 cpu_mac_unit_hss_cfg[12]; /* 0x000000c0 */ - u32 rsv60; - u32 rsv61; + u32 CpuMacUnitHssCfg[14]; /* 0x000000c0 */ u32 rsv62; u32 rsv63; - u32 cpu_mac_unit_ip_cam_cfg[32]; /* 0x00000100 */ - u32 cpu_mac_unit_mac_cam_cfg[32]; /* 0x00000180 */ - u32 cpu_mac_unit_filter_cfg[6]; /* 0x00000200 */ + u32 CpuMacUnitIpCamCfg[32]; /* 0x00000100 */ + u32 CpuMacUnitMacCamCfg[32]; /* 0x00000180 */ + u32 CpuMacUnitFilterCfg[6]; /* 0x00000200 */ + u32 rsv134; + u32 rsv135; + u32 CpuMacUnitFilterCfg1[4]; /* 0x00000220 */ }; -/* cpu_mac_unit_hss_mon Definition */ -#define CPU_MAC_UNIT_HSS_MON_W0_MON_HSS_CMU0_DBG_OBS BIT(0) -#define CPU_MAC_UNIT_HSS_MON_W0_MON_HSS_CMU0_LOL BIT(16) -#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_PMA2_PCS_TX_DET_RX_N BIT(22) -#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_PMA2_PCS_TX_DET_RX_P BIT(23) -#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_LOL_UDL BIT(20) -#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_RX_EI BIT(18) -#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_DBG_OBS BIT(0) -#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_PMA_RST_DONE BIT(17) -#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_I_SCAN_DONE BIT(21) -#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_RX_EI_FILTERED BIT(24) -#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_LOL BIT(19) -#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_DFE_RST_DONE BIT(16) -#define CPU_MAC_UNIT_HSS_MON_W2_MON_HSS_L0_I_SCAN_RESULTS_31_0 BIT(0) -#define CPU_MAC_UNIT_HSS_MON_W3_MON_HSS_L0_I_SCAN_RESULTS_63_32 BIT(0) -#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_PMA2_PCS_TX_DET_RX_P BIT(23) -#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_RX_EI_FILTERED BIT(24) -#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_I_SCAN_DONE BIT(21) -#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_PMA2_PCS_TX_DET_RX_N BIT(22) -#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_LOL BIT(19) -#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_DFE_RST_DONE BIT(16) -#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_LOL_UDL BIT(20) -#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_PMA_RST_DONE BIT(17) -#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_RX_EI BIT(18) -#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_DBG_OBS BIT(0) -#define CPU_MAC_UNIT_HSS_MON_W5_MON_HSS_L1_I_SCAN_RESULTS_31_0 BIT(0) -#define CPU_MAC_UNIT_HSS_MON_W6_MON_HSS_L1_I_SCAN_RESULTS_63_32 BIT(0) +/* ################################################################################ + * # CpuMacUnitHssMon Definition */ +#define CPU_MAC_UNIT_HSS_MON_W0_MON_HSS_CMU0_DBG_OBS_BIT 0 +#define CPU_MAC_UNIT_HSS_MON_W0_MON_HSS_CMU0_LOL_BIT 16 +#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_DBG_OBS_BIT 0 +#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_DFE_RST_DONE_BIT 16 +#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_I_SCAN_DONE_BIT 21 +#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_LOL_BIT 19 +#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_LOL_UDL_BIT 20 +#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_PMA2_PCS_TX_DET_RX_N_BIT 22 +#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_PMA2_PCS_TX_DET_RX_P_BIT 23 +#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_PMA_RST_DONE_BIT 17 +#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_RX_EI_BIT 18 +#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_RX_EI_FILTERED_BIT 24 +#define CPU_MAC_UNIT_HSS_MON_W2_MON_HSS_L0_I_SCAN_RESULTS_31_0_BIT 0 +#define CPU_MAC_UNIT_HSS_MON_W3_MON_HSS_L0_I_SCAN_RESULTS_63_32_BIT 0 +#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_DBG_OBS_BIT 0 +#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_DFE_RST_DONE_BIT 16 +#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_I_SCAN_DONE_BIT 21 +#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_LOL_BIT 19 +#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_LOL_UDL_BIT 20 +#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_PMA2_PCS_TX_DET_RX_N_BIT 22 +#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_PMA2_PCS_TX_DET_RX_P_BIT 23 +#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_PMA_RST_DONE_BIT 17 +#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_RX_EI_BIT 18 +#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_RX_EI_FILTERED_BIT 24 +#define CPU_MAC_UNIT_HSS_MON_W5_MON_HSS_L1_I_SCAN_RESULTS_31_0_BIT 0 +#define CPU_MAC_UNIT_HSS_MON_W6_MON_HSS_L1_I_SCAN_RESULTS_63_32_BIT 0 #define CPU_MAC_UNIT_HSS_MON_W0_MON_HSS_CMU0_DBG_OBS_MASK 0x0000ffff #define CPU_MAC_UNIT_HSS_MON_W0_MON_HSS_CMU0_LOL_MASK 0x00010000 +#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_DBG_OBS_MASK 0x0000ffff +#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_DFE_RST_DONE_MASK 0x00010000 +#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_I_SCAN_DONE_MASK 0x00200000 +#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_LOL_MASK 0x00080000 +#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_LOL_UDL_MASK 0x00100000 #define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_PMA2_PCS_TX_DET_RX_N_MASK 0x00400000 #define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_PMA2_PCS_TX_DET_RX_P_MASK 0x00800000 -#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_LOL_UDL_MASK 0x00100000 -#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_RX_EI_MASK 0x00040000 -#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_DBG_OBS_MASK 0x0000ffff #define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_PMA_RST_DONE_MASK 0x00020000 -#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_I_SCAN_DONE_MASK 0x00200000 +#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_RX_EI_MASK 0x00040000 #define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_RX_EI_FILTERED_MASK 0x01000000 -#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_LOL_MASK 0x00080000 -#define CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_DFE_RST_DONE_MASK 0x00010000 -#define CPU_MAC_UNIT_HSS_MON_W2_MON_HSS_L0_I_SCAN_RESULTS_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_HSS_MON_W3_MON_HSS_L0_I_SCAN_RESULTS_63_32_MASK 0x00000001 -#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_PMA2_PCS_TX_DET_RX_P_MASK 0x00800000 -#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_RX_EI_FILTERED_MASK 0x01000000 +#define CPU_MAC_UNIT_HSS_MON_W2_MON_HSS_L0_I_SCAN_RESULTS_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_HSS_MON_W3_MON_HSS_L0_I_SCAN_RESULTS_63_32_MASK 0xffffffff +#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_DBG_OBS_MASK 0x0000ffff +#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_DFE_RST_DONE_MASK 0x00010000 #define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_I_SCAN_DONE_MASK 0x00200000 -#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_PMA2_PCS_TX_DET_RX_N_MASK 0x00400000 #define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_LOL_MASK 0x00080000 -#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_DFE_RST_DONE_MASK 0x00010000 #define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_LOL_UDL_MASK 0x00100000 +#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_PMA2_PCS_TX_DET_RX_N_MASK 0x00400000 +#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_PMA2_PCS_TX_DET_RX_P_MASK 0x00800000 #define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_PMA_RST_DONE_MASK 0x00020000 #define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_RX_EI_MASK 0x00040000 -#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_DBG_OBS_MASK 0x0000ffff -#define CPU_MAC_UNIT_HSS_MON_W5_MON_HSS_L1_I_SCAN_RESULTS_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_HSS_MON_W6_MON_HSS_L1_I_SCAN_RESULTS_63_32_MASK 0x00000001 +#define CPU_MAC_UNIT_HSS_MON_W4_MON_HSS_L1_RX_EI_FILTERED_MASK 0x01000000 +#define CPU_MAC_UNIT_HSS_MON_W5_MON_HSS_L1_I_SCAN_RESULTS_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_HSS_MON_W6_MON_HSS_L1_I_SCAN_RESULTS_63_32_MASK 0xffffffff -/* cpu_mac_hss_reg_acc_timing_cfg Definition */ -#define CPU_MAC_HSS_REG_ACC_TIMING_CFG_W0_CFG_ACTIVE_CYCLES BIT(0) -#define CPU_MAC_HSS_REG_ACC_TIMING_CFG_W0_CFG_HOLD_CYCLES BIT(8) -#define CPU_MAC_HSS_REG_ACC_TIMING_CFG_W1_CFG_RD_OUT_VALID_CYCLES BIT(8) -#define CPU_MAC_HSS_REG_ACC_TIMING_CFG_W1_CFG_SETUP_CYCLES BIT(0) +/* ################################################################################ + * # CpuMacHssRegAccTimingCfg Definition */ +#define CPU_MAC_HSS_REG_ACC_TIMING_CFG_W0_CFG_ACTIVE_CYCLES_BIT 0 +#define CPU_MAC_HSS_REG_ACC_TIMING_CFG_W0_CFG_HOLD_CYCLES_BIT 8 +#define CPU_MAC_HSS_REG_ACC_TIMING_CFG_W1_CFG_RD_OUT_VALID_CYCLES_BIT 8 +#define CPU_MAC_HSS_REG_ACC_TIMING_CFG_W1_CFG_SETUP_CYCLES_BIT 0 #define CPU_MAC_HSS_REG_ACC_TIMING_CFG_W0_CFG_ACTIVE_CYCLES_MASK 0x000000ff #define CPU_MAC_HSS_REG_ACC_TIMING_CFG_W0_CFG_HOLD_CYCLES_MASK 0x0000ff00 #define CPU_MAC_HSS_REG_ACC_TIMING_CFG_W1_CFG_RD_OUT_VALID_CYCLES_MASK 0x0000ff00 #define CPU_MAC_HSS_REG_ACC_TIMING_CFG_W1_CFG_SETUP_CYCLES_MASK 0x000000ff -/* cpu_mac_unit_reset_ctl Definition */ -#define CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_CPU_MAC1 BIT(1) -#define CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_CPU_MAC0 BIT(2) -#define CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_BASE BIT(0) +/* ################################################################################ + * # CpuMacUnitResetCtl Definition */ +#define CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_BASE_BIT 0 +#define CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_CPU_MAC0_BIT 2 +#define CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_CPU_MAC1_BIT 1 -#define CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_CPU_MAC1_MASK 0x00000002 -#define CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_CPU_MAC0_MASK 0x00000004 #define CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_BASE_MASK 0x00000001 +#define CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_CPU_MAC0_MASK 0x00000004 +#define CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_CPU_MAC1_MASK 0x00000002 -/* cpu_mac_unit_hss_reg_acc_ctl Definition */ -#define CPU_MAC_UNIT_HSS_REG_ACC_CTL_W0_HSS_ACC_WDATA BIT(8) -#define CPU_MAC_UNIT_HSS_REG_ACC_CTL_W0_HSS_ACC_VALID BIT(31) -#define CPU_MAC_UNIT_HSS_REG_ACC_CTL_W0_HSS_ACC_ADDR BIT(0) -#define CPU_MAC_UNIT_HSS_REG_ACC_CTL_W0_HSS_ACC_IS_READ BIT(16) -#define CPU_MAC_UNIT_HSS_REG_ACC_CTL_W0_HSS_ACC_ID BIT(24) +/* ################################################################################ + * # CpuMacUnitHssRegAccCtl Definition */ +#define CPU_MAC_UNIT_HSS_REG_ACC_CTL_W0_HSS_ACC_ADDR_BIT 0 +#define CPU_MAC_UNIT_HSS_REG_ACC_CTL_W0_HSS_ACC_ID_BIT 24 +#define CPU_MAC_UNIT_HSS_REG_ACC_CTL_W0_HSS_ACC_IS_READ_BIT 16 +#define CPU_MAC_UNIT_HSS_REG_ACC_CTL_W0_HSS_ACC_VALID_BIT 31 +#define CPU_MAC_UNIT_HSS_REG_ACC_CTL_W0_HSS_ACC_WDATA_BIT 8 -#define CPU_MAC_UNIT_HSS_REG_ACC_CTL_W0_HSS_ACC_WDATA_MASK 0x0000ff00 -#define CPU_MAC_UNIT_HSS_REG_ACC_CTL_W0_HSS_ACC_VALID_MASK 0x80000000 #define CPU_MAC_UNIT_HSS_REG_ACC_CTL_W0_HSS_ACC_ADDR_MASK 0x000000ff -#define CPU_MAC_UNIT_HSS_REG_ACC_CTL_W0_HSS_ACC_IS_READ_MASK 0x00010000 #define CPU_MAC_UNIT_HSS_REG_ACC_CTL_W0_HSS_ACC_ID_MASK 0x0f000000 +#define CPU_MAC_UNIT_HSS_REG_ACC_CTL_W0_HSS_ACC_IS_READ_MASK 0x00010000 +#define CPU_MAC_UNIT_HSS_REG_ACC_CTL_W0_HSS_ACC_VALID_MASK 0x80000000 +#define CPU_MAC_UNIT_HSS_REG_ACC_CTL_W0_HSS_ACC_WDATA_MASK 0x0000ff00 -/* cpu_mac_unit_hss_reg_acc_result Definition */ -#define CPU_MAC_UNIT_HSS_REG_ACC_RESULT_W0_HSS_ACC_ACK BIT(31) -#define CPU_MAC_UNIT_HSS_REG_ACC_RESULT_W0_HSS_ACC_ACK_DATA BIT(0) +/* ################################################################################ + * # CpuMacUnitHssRegAccResult Definition */ +#define CPU_MAC_UNIT_HSS_REG_ACC_RESULT_W0_HSS_ACC_ACK_BIT 31 +#define CPU_MAC_UNIT_HSS_REG_ACC_RESULT_W0_HSS_ACC_ACK_DATA_BIT 0 #define CPU_MAC_UNIT_HSS_REG_ACC_RESULT_W0_HSS_ACC_ACK_MASK 0x80000000 #define CPU_MAC_UNIT_HSS_REG_ACC_RESULT_W0_HSS_ACC_ACK_DATA_MASK 0x000000ff -/* cpu_mac_unit_axi_cfg Definition */ -#define CPU_MAC_UNIT_AXI_CFG_W0_CFG_AXI0_ID BIT(0) -#define CPU_MAC_UNIT_AXI_CFG_W0_CFG_AXI1_ID BIT(4) +/* ################################################################################ + * # CpuMacUnitAxiCfg Definition */ +#define CPU_MAC_UNIT_AXI_CFG_W0_CFG_AXI0_ID_BIT 0 +#define CPU_MAC_UNIT_AXI_CFG_W0_CFG_AXI1_ID_BIT 4 #define CPU_MAC_UNIT_AXI_CFG_W0_CFG_AXI0_ID_MASK 0x0000000f #define CPU_MAC_UNIT_AXI_CFG_W0_CFG_AXI1_ID_MASK 0x000000f0 -/* cpu_mac_unit_ts_cfg Definition */ -#define CPU_MAC_UNIT_TS_CFG_W0_CFG_TX_CAPTURE_FIFO_INTR_THRD BIT(0) -#define CPU_MAC_UNIT_TS_CFG_W0_CFG_FORCE_S_AND_NS_EN BIT(31) +/* ################################################################################ + * # CpuMacUnitTsCfg Definition */ +#define CPU_MAC_UNIT_TS_CFG_W0_CFG_FORCE_S_AND_NS_EN_BIT 31 +#define CPU_MAC_UNIT_TS_CFG_W0_CFG_TX_CAPTURE_FIFO_INTR_THRD_BIT 0 -#define CPU_MAC_UNIT_TS_CFG_W0_CFG_TX_CAPTURE_FIFO_INTR_THRD_MASK 0x0000000f #define CPU_MAC_UNIT_TS_CFG_W0_CFG_FORCE_S_AND_NS_EN_MASK 0x80000000 +#define CPU_MAC_UNIT_TS_CFG_W0_CFG_TX_CAPTURE_FIFO_INTR_THRD_MASK 0x0000000f -/* cpu_mac_unit_fifo_status Definition */ -#define CPU_MAC_UNIT_FIFO_STATUS_W0_CPU_MAC_UNIT_TX_TS_CAPTURE_FIFO_FIFO_DEPTH BIT(0) +/* ################################################################################ + * # CpuMacUnitFifoStatus Definition */ +#define CPU_MAC_UNIT_FIFO_STATUS_W0_CPU_MAC_UNIT_TX_TS_CAPTURE_FIFO_FIFO_DEPTH_BIT 0 #define CPU_MAC_UNIT_FIFO_STATUS_W0_CPU_MAC_UNIT_TX_TS_CAPTURE_FIFO_FIFO_DEPTH_MASK 0x0000000f -/* cpu_mac_unit_ts_mon Definition */ -#define CPU_MAC_UNIT_TS_MON_W0_MON_ADJ_NS BIT(0) -#define CPU_MAC_UNIT_TS_MON_W1_MON_ADJ_SECOND BIT(0) -#define CPU_MAC_UNIT_TS_MON_W2_MON_TX_CAPTURE_FIFO_DROP_CNT BIT(0) +/* ################################################################################ + * # CpuMacUnitTsMon Definition */ +#define CPU_MAC_UNIT_TS_MON_W0_MON_ADJ_NS_BIT 0 +#define CPU_MAC_UNIT_TS_MON_W1_MON_ADJ_SECOND_BIT 0 +#define CPU_MAC_UNIT_TS_MON_W2_MON_TX_CAPTURE_FIFO_DROP_CNT_BIT 0 #define CPU_MAC_UNIT_TS_MON_W0_MON_ADJ_NS_MASK 0x3fffffff #define CPU_MAC_UNIT_TS_MON_W1_MON_ADJ_SECOND_MASK 0xffffffff #define CPU_MAC_UNIT_TS_MON_W2_MON_TX_CAPTURE_FIFO_DROP_CNT_MASK 0x0000000f -/* cpu_mac_unit_ref_pulse_cfg Definition */ -#define CPU_MAC_UNIT_REF_PULSE_CFG_W0_REF_PAUSE_TIMER_PULSE_DIV BIT(0) -#define CPU_MAC_UNIT_REF_PULSE_CFG_W0_REF_PAUSE_TIMER_PULSE_RST BIT(31) -#define CPU_MAC_UNIT_REF_PULSE_CFG_W1_REF_LINK_PULSE_DIV BIT(0) -#define CPU_MAC_UNIT_REF_PULSE_CFG_W1_REF_LINK_PULSE_RST BIT(31) -#define CPU_MAC_UNIT_REF_PULSE_CFG_W2_REF_LINK_FILTER_PULSE_RST BIT(31) -#define CPU_MAC_UNIT_REF_PULSE_CFG_W2_REF_LINK_FILTER_PULSE_DIV BIT(0) -#define CPU_MAC_UNIT_REF_PULSE_CFG_W3_REF_EEE_PULSE_DIV BIT(0) -#define CPU_MAC_UNIT_REF_PULSE_CFG_W3_REF_EEE_PULSE_RST BIT(31) +/* ################################################################################ + * # CpuMacUnitRefPulseCfg Definition */ +#define CPU_MAC_UNIT_REF_PULSE_CFG_W0_REF_PAUSE_TIMER_PULSE_DIV_BIT 0 +#define CPU_MAC_UNIT_REF_PULSE_CFG_W0_REF_PAUSE_TIMER_PULSE_RST_BIT 31 +#define CPU_MAC_UNIT_REF_PULSE_CFG_W1_REF_LINK_PULSE_DIV_BIT 0 +#define CPU_MAC_UNIT_REF_PULSE_CFG_W1_REF_LINK_PULSE_RST_BIT 31 +#define CPU_MAC_UNIT_REF_PULSE_CFG_W2_REF_LINK_FILTER_PULSE_DIV_BIT 0 +#define CPU_MAC_UNIT_REF_PULSE_CFG_W2_REF_LINK_FILTER_PULSE_RST_BIT 31 +#define CPU_MAC_UNIT_REF_PULSE_CFG_W3_REF_EEE_PULSE_DIV_BIT 0 +#define CPU_MAC_UNIT_REF_PULSE_CFG_W3_REF_EEE_PULSE_RST_BIT 31 #define CPU_MAC_UNIT_REF_PULSE_CFG_W0_REF_PAUSE_TIMER_PULSE_DIV_MASK 0x7fffffff #define CPU_MAC_UNIT_REF_PULSE_CFG_W0_REF_PAUSE_TIMER_PULSE_RST_MASK 0x80000000 #define CPU_MAC_UNIT_REF_PULSE_CFG_W1_REF_LINK_PULSE_DIV_MASK 0x7fffffff #define CPU_MAC_UNIT_REF_PULSE_CFG_W1_REF_LINK_PULSE_RST_MASK 0x80000000 -#define CPU_MAC_UNIT_REF_PULSE_CFG_W2_REF_LINK_FILTER_PULSE_RST_MASK 0x80000000 #define CPU_MAC_UNIT_REF_PULSE_CFG_W2_REF_LINK_FILTER_PULSE_DIV_MASK 0x7fffffff +#define CPU_MAC_UNIT_REF_PULSE_CFG_W2_REF_LINK_FILTER_PULSE_RST_MASK 0x80000000 #define CPU_MAC_UNIT_REF_PULSE_CFG_W3_REF_EEE_PULSE_DIV_MASK 0x7fffffff #define CPU_MAC_UNIT_REF_PULSE_CFG_W3_REF_EEE_PULSE_RST_MASK 0x80000000 -/* cpu_mac_unit_interrupt_func Definition */ -#define CPU_MAC_UNIT_INTERRUPT_FUNC_W0_VALUE_SET0_CPU_MAC_UNIT_INTERRUPT_FUNC BIT(0) -#define CPU_MAC_UNIT_INTERRUPT_FUNC_W1_VALUE_RESET0_CPU_MAC_UNIT_INTERRUPT_FUNC BIT(0) -#define CPU_MAC_UNIT_INTERRUPT_FUNC_W2_MASK_SET0_CPU_MAC_UNIT_INTERRUPT_FUNC BIT(0) -#define CPU_MAC_UNIT_INTERRUPT_FUNC_W3_MASK_RESET0_CPU_MAC_UNIT_INTERRUPT_FUNC BIT(0) +/* ################################################################################ + * # CpuMacUnitInterruptFunc Definition */ +#define CPU_MAC_UNIT_INTERRUPT_FUNC_W0_VALUE_SET0_CPU_MAC_UNIT_INTERRUPT_FUNC_BIT 0 +#define CPU_MAC_UNIT_INTERRUPT_FUNC_W1_VALUE_RESET0_CPU_MAC_UNIT_INTERRUPT_FUNC_BIT 0 +#define CPU_MAC_UNIT_INTERRUPT_FUNC_W2_MASK_SET0_CPU_MAC_UNIT_INTERRUPT_FUNC_BIT 0 +#define CPU_MAC_UNIT_INTERRUPT_FUNC_W3_MASK_RESET0_CPU_MAC_UNIT_INTERRUPT_FUNC_BIT 0 #define CPU_MAC_UNIT_INTERRUPT_FUNC_W0_VALUE_SET0_CPU_MAC_UNIT_INTERRUPT_FUNC_MASK 0x00000001 #define CPU_MAC_UNIT_INTERRUPT_FUNC_W1_VALUE_RESET0_CPU_MAC_UNIT_INTERRUPT_FUNC_MASK 0x00000001 #define CPU_MAC_UNIT_INTERRUPT_FUNC_W2_MASK_SET0_CPU_MAC_UNIT_INTERRUPT_FUNC_MASK 0x00000001 #define CPU_MAC_UNIT_INTERRUPT_FUNC_W3_MASK_RESET0_CPU_MAC_UNIT_INTERRUPT_FUNC_MASK 0x00000001 -/* cpu_mac_unit_hss_cfg Definition */ +/* ################################################################################ + * # CpuMacUnitHssCfg Definition */ #define CPU_MAC_UNIT_HSS_CFG_W0_CFG_HSS_BCLK_RST_N_BIT 1 #define CPU_MAC_UNIT_HSS_CFG_W0_CFG_HSS_CMU0_HWT_BIAS_DN_EN_BIT 13 #define CPU_MAC_UNIT_HSS_CFG_W0_CFG_HSS_CMU0_HWT_BIAS_UP_EN_BIT 14 @@ -5024,197 +5050,201 @@ struct cpu_mac_unit_regs { #define CPU_MAC_UNIT_HSS_CFG_W13_CFG_HSS_L1_PCS2_PMA_H4_MASK 0x00078000 #define CPU_MAC_UNIT_HSS_CFG_W13_CFG_HSS_L1_PCS2_PMA_H5_MASK 0x00780000 #define CPU_MAC_UNIT_HSS_CFG_W13_CFG_HSS_L1_PCS2_PMA_H_BYP_MASK 0x40000000 -/* cpu_mac_unit_ip_cam_cfg Definition */ -#define CPU_MAC_UNIT_IP_CAM_CFG_W0_CFG_IP_CAM_VALUE0_31_0 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W1_CFG_IP_CAM_VALUE0_63_32 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W2_CFG_IP_CAM_VALUE0_95_64 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W3_CFG_IP_CAM_VALUE0_127_96 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W4_CFG_IP_CAM_VALUE1_31_0 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W5_CFG_IP_CAM_VALUE1_63_32 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W6_CFG_IP_CAM_VALUE1_95_64 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W7_CFG_IP_CAM_VALUE1_127_96 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W8_CFG_IP_CAM_VALUE2_31_0 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W9_CFG_IP_CAM_VALUE2_63_32 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W10_CFG_IP_CAM_VALUE2_95_64 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W11_CFG_IP_CAM_VALUE2_127_96 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W12_CFG_IP_CAM_VALUE3_31_0 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W13_CFG_IP_CAM_VALUE3_63_32 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W14_CFG_IP_CAM_VALUE3_95_64 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W15_CFG_IP_CAM_VALUE3_127_96 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W16_CFG_IP_CAM_MASK0_31_0 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W17_CFG_IP_CAM_MASK0_63_32 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W18_CFG_IP_CAM_MASK0_95_64 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W19_CFG_IP_CAM_MASK0_127_96 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W20_CFG_IP_CAM_MASK1_31_0 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W21_CFG_IP_CAM_MASK1_63_32 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W22_CFG_IP_CAM_MASK1_95_64 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W23_CFG_IP_CAM_MASK1_127_96 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W24_CFG_IP_CAM_MASK2_31_0 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W25_CFG_IP_CAM_MASK2_63_32 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W26_CFG_IP_CAM_MASK2_95_64 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W27_CFG_IP_CAM_MASK2_127_96 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W28_CFG_IP_CAM_MASK3_31_0 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W29_CFG_IP_CAM_MASK3_63_32 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W30_CFG_IP_CAM_MASK3_95_64 BIT(0) -#define CPU_MAC_UNIT_IP_CAM_CFG_W31_CFG_IP_CAM_MASK3_127_96 BIT(0) - -#define CPU_MAC_UNIT_IP_CAM_CFG_W0_CFG_IP_CAM_VALUE0_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W1_CFG_IP_CAM_VALUE0_63_32_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W2_CFG_IP_CAM_VALUE0_95_64_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W3_CFG_IP_CAM_VALUE0_127_96_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W4_CFG_IP_CAM_VALUE1_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W5_CFG_IP_CAM_VALUE1_63_32_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W6_CFG_IP_CAM_VALUE1_95_64_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W7_CFG_IP_CAM_VALUE1_127_96_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W8_CFG_IP_CAM_VALUE2_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W9_CFG_IP_CAM_VALUE2_63_32_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W10_CFG_IP_CAM_VALUE2_95_64_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W11_CFG_IP_CAM_VALUE2_127_96_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W12_CFG_IP_CAM_VALUE3_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W13_CFG_IP_CAM_VALUE3_63_32_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W14_CFG_IP_CAM_VALUE3_95_64_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W15_CFG_IP_CAM_VALUE3_127_96_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W16_CFG_IP_CAM_MASK0_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W17_CFG_IP_CAM_MASK0_63_32_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W18_CFG_IP_CAM_MASK0_95_64_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W19_CFG_IP_CAM_MASK0_127_96_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W20_CFG_IP_CAM_MASK1_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W21_CFG_IP_CAM_MASK1_63_32_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W22_CFG_IP_CAM_MASK1_95_64_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W23_CFG_IP_CAM_MASK1_127_96_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W24_CFG_IP_CAM_MASK2_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W25_CFG_IP_CAM_MASK2_63_32_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W26_CFG_IP_CAM_MASK2_95_64_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W27_CFG_IP_CAM_MASK2_127_96_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W28_CFG_IP_CAM_MASK3_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W29_CFG_IP_CAM_MASK3_63_32_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W30_CFG_IP_CAM_MASK3_95_64_MASK 0x00000001 -#define CPU_MAC_UNIT_IP_CAM_CFG_W31_CFG_IP_CAM_MASK3_127_96_MASK 0x00000001 - -/* cpu_mac_unit_mac_cam_cfg Definition */ -#define CPU_MAC_UNIT_MAC_CAM_CFG_W0_CFG_MAC_CAM_VALUE0_31_0 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W1_CFG_MAC_CAM_VALUE0_47_32 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W2_CFG_MAC_CAM_VALUE1_31_0 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W3_CFG_MAC_CAM_VALUE1_47_32 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W4_CFG_MAC_CAM_VALUE2_31_0 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W5_CFG_MAC_CAM_VALUE2_47_32 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W6_CFG_MAC_CAM_VALUE3_31_0 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W7_CFG_MAC_CAM_VALUE3_47_32 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W8_CFG_MAC_CAM_VALUE4_31_0 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W9_CFG_MAC_CAM_VALUE4_47_32 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W10_CFG_MAC_CAM_VALUE5_31_0 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W11_CFG_MAC_CAM_VALUE5_47_32 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W12_CFG_MAC_CAM_VALUE6_31_0 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W13_CFG_MAC_CAM_VALUE6_47_32 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W14_CFG_MAC_CAM_VALUE7_31_0 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W15_CFG_MAC_CAM_VALUE7_47_32 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W16_CFG_MAC_CAM_MASK0_31_0 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W17_CFG_MAC_CAM_MASK0_47_32 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W18_CFG_MAC_CAM_MASK1_31_0 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W19_CFG_MAC_CAM_MASK1_47_32 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W20_CFG_MAC_CAM_MASK2_31_0 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W21_CFG_MAC_CAM_MASK2_47_32 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W22_CFG_MAC_CAM_MASK3_31_0 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W23_CFG_MAC_CAM_MASK3_47_32 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W24_CFG_MAC_CAM_MASK4_31_0 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W25_CFG_MAC_CAM_MASK4_47_32 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W26_CFG_MAC_CAM_MASK5_31_0 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W27_CFG_MAC_CAM_MASK5_47_32 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W28_CFG_MAC_CAM_MASK6_31_0 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W29_CFG_MAC_CAM_MASK6_47_32 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W30_CFG_MAC_CAM_MASK7_31_0 BIT(0) -#define CPU_MAC_UNIT_MAC_CAM_CFG_W31_CFG_MAC_CAM_MASK7_47_32 BIT(0) - -#define CPU_MAC_UNIT_MAC_CAM_CFG_W0_CFG_MAC_CAM_VALUE0_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W1_CFG_MAC_CAM_VALUE0_47_32_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W2_CFG_MAC_CAM_VALUE1_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W3_CFG_MAC_CAM_VALUE1_47_32_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W4_CFG_MAC_CAM_VALUE2_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W5_CFG_MAC_CAM_VALUE2_47_32_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W6_CFG_MAC_CAM_VALUE3_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W7_CFG_MAC_CAM_VALUE3_47_32_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W8_CFG_MAC_CAM_VALUE4_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W9_CFG_MAC_CAM_VALUE4_47_32_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W10_CFG_MAC_CAM_VALUE5_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W11_CFG_MAC_CAM_VALUE5_47_32_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W12_CFG_MAC_CAM_VALUE6_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W13_CFG_MAC_CAM_VALUE6_47_32_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W14_CFG_MAC_CAM_VALUE7_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W15_CFG_MAC_CAM_VALUE7_47_32_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W16_CFG_MAC_CAM_MASK0_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W17_CFG_MAC_CAM_MASK0_47_32_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W18_CFG_MAC_CAM_MASK1_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W19_CFG_MAC_CAM_MASK1_47_32_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W20_CFG_MAC_CAM_MASK2_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W21_CFG_MAC_CAM_MASK2_47_32_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W22_CFG_MAC_CAM_MASK3_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W23_CFG_MAC_CAM_MASK3_47_32_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W24_CFG_MAC_CAM_MASK4_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W25_CFG_MAC_CAM_MASK4_47_32_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W26_CFG_MAC_CAM_MASK5_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W27_CFG_MAC_CAM_MASK5_47_32_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W28_CFG_MAC_CAM_MASK6_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W29_CFG_MAC_CAM_MASK6_47_32_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W30_CFG_MAC_CAM_MASK7_31_0_MASK 0x00000001 -#define CPU_MAC_UNIT_MAC_CAM_CFG_W31_CFG_MAC_CAM_MASK7_47_32_MASK 0x00000001 - -/* cpu_mac_unit_filter_cfg Definition */ -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_ADDR_IS_SA0 BIT(17) -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA0 BIT(9) -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_ADDR_IS_SA3 BIT(20) -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA6 BIT(15) -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_ADDR_IS_SA1 BIT(18) -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_FILTER_IS_LOOSE BIT(5) -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA7 BIT(16) -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_ADDR_FILTER_EN BIT(2) -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_BLOCK_SUPPRESSION_TRAFFIC BIT(6) -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_ADDR_IS_SA2 BIT(19) -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_CAM3_IS_V6 BIT(24) -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA5 BIT(14) -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA2 BIT(11) -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA4 BIT(13) -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_CAM_IS_BLACK_LIST BIT(4) -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_CAM_IS_BLACK_LIST BIT(3) -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_FILTER_EN BIT(0) -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_CAM2_IS_V6 BIT(23) -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_CAM1_IS_V6 BIT(22) -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_ETHER_TYPE_FILTER_EN BIT(1) -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA1 BIT(10) -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA3 BIT(12) -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_CAM0_IS_V6 BIT(21) -#define CPU_MAC_UNIT_FILTER_CFG_W1_CFG_SUPPRESSION_ETHER_TYPE0 BIT(16) -#define CPU_MAC_UNIT_FILTER_CFG_W1_CFG_VLAN_TPID BIT(0) -#define CPU_MAC_UNIT_FILTER_CFG_W2_CFG_SUPPRESSION_ETHER_TYPE1 BIT(0) -#define CPU_MAC_UNIT_FILTER_CFG_W2_CFG_SUPPRESSION_ETHER_TYPE2 BIT(16) -#define CPU_MAC_UNIT_FILTER_CFG_W3_CFG_CONFIRM_ETHER_TYPE0 BIT(0) -#define CPU_MAC_UNIT_FILTER_CFG_W3_CFG_CONFIRM_ETHER_TYPE1 BIT(16) -#define CPU_MAC_UNIT_FILTER_CFG_W4_CFG_CONFIRM_ETHER_TYPE2 BIT(0) -#define CPU_MAC_UNIT_FILTER_CFG_W5_CFG_METER_TOKEN_UPD_INTERVAL BIT(0) -#define CPU_MAC_UNIT_FILTER_CFG_W5_CFG_METER_TOKEN_UPD_VALUE BIT(16) -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_ADDR_IS_SA0_MASK 0x00020000 -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA0_MASK 0x00000200 -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_ADDR_IS_SA3_MASK 0x00100000 -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA6_MASK 0x00008000 -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_ADDR_IS_SA1_MASK 0x00040000 +/* ################################################################################ + * # CpuMacUnitIpCamCfg Definition */ +#define CPU_MAC_UNIT_IP_CAM_CFG_W0_CFG_IP_CAM_VALUE0_31_0_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W1_CFG_IP_CAM_VALUE0_63_32_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W2_CFG_IP_CAM_VALUE0_95_64_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W3_CFG_IP_CAM_VALUE0_127_96_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W4_CFG_IP_CAM_VALUE1_31_0_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W5_CFG_IP_CAM_VALUE1_63_32_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W6_CFG_IP_CAM_VALUE1_95_64_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W7_CFG_IP_CAM_VALUE1_127_96_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W8_CFG_IP_CAM_VALUE2_31_0_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W9_CFG_IP_CAM_VALUE2_63_32_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W10_CFG_IP_CAM_VALUE2_95_64_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W11_CFG_IP_CAM_VALUE2_127_96_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W12_CFG_IP_CAM_VALUE3_31_0_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W13_CFG_IP_CAM_VALUE3_63_32_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W14_CFG_IP_CAM_VALUE3_95_64_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W15_CFG_IP_CAM_VALUE3_127_96_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W16_CFG_IP_CAM_MASK0_31_0_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W17_CFG_IP_CAM_MASK0_63_32_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W18_CFG_IP_CAM_MASK0_95_64_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W19_CFG_IP_CAM_MASK0_127_96_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W20_CFG_IP_CAM_MASK1_31_0_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W21_CFG_IP_CAM_MASK1_63_32_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W22_CFG_IP_CAM_MASK1_95_64_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W23_CFG_IP_CAM_MASK1_127_96_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W24_CFG_IP_CAM_MASK2_31_0_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W25_CFG_IP_CAM_MASK2_63_32_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W26_CFG_IP_CAM_MASK2_95_64_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W27_CFG_IP_CAM_MASK2_127_96_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W28_CFG_IP_CAM_MASK3_31_0_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W29_CFG_IP_CAM_MASK3_63_32_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W30_CFG_IP_CAM_MASK3_95_64_BIT 0 +#define CPU_MAC_UNIT_IP_CAM_CFG_W31_CFG_IP_CAM_MASK3_127_96_BIT 0 + +#define CPU_MAC_UNIT_IP_CAM_CFG_W0_CFG_IP_CAM_VALUE0_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W1_CFG_IP_CAM_VALUE0_63_32_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W2_CFG_IP_CAM_VALUE0_95_64_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W3_CFG_IP_CAM_VALUE0_127_96_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W4_CFG_IP_CAM_VALUE1_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W5_CFG_IP_CAM_VALUE1_63_32_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W6_CFG_IP_CAM_VALUE1_95_64_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W7_CFG_IP_CAM_VALUE1_127_96_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W8_CFG_IP_CAM_VALUE2_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W9_CFG_IP_CAM_VALUE2_63_32_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W10_CFG_IP_CAM_VALUE2_95_64_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W11_CFG_IP_CAM_VALUE2_127_96_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W12_CFG_IP_CAM_VALUE3_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W13_CFG_IP_CAM_VALUE3_63_32_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W14_CFG_IP_CAM_VALUE3_95_64_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W15_CFG_IP_CAM_VALUE3_127_96_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W16_CFG_IP_CAM_MASK0_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W17_CFG_IP_CAM_MASK0_63_32_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W18_CFG_IP_CAM_MASK0_95_64_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W19_CFG_IP_CAM_MASK0_127_96_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W20_CFG_IP_CAM_MASK1_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W21_CFG_IP_CAM_MASK1_63_32_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W22_CFG_IP_CAM_MASK1_95_64_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W23_CFG_IP_CAM_MASK1_127_96_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W24_CFG_IP_CAM_MASK2_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W25_CFG_IP_CAM_MASK2_63_32_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W26_CFG_IP_CAM_MASK2_95_64_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W27_CFG_IP_CAM_MASK2_127_96_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W28_CFG_IP_CAM_MASK3_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W29_CFG_IP_CAM_MASK3_63_32_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W30_CFG_IP_CAM_MASK3_95_64_MASK 0xffffffff +#define CPU_MAC_UNIT_IP_CAM_CFG_W31_CFG_IP_CAM_MASK3_127_96_MASK 0xffffffff + +/* ################################################################################ + * # CpuMacUnitMacCamCfg Definition */ +#define CPU_MAC_UNIT_MAC_CAM_CFG_W0_CFG_MAC_CAM_VALUE0_31_0_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W1_CFG_MAC_CAM_VALUE0_47_32_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W2_CFG_MAC_CAM_VALUE1_31_0_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W3_CFG_MAC_CAM_VALUE1_47_32_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W4_CFG_MAC_CAM_VALUE2_31_0_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W5_CFG_MAC_CAM_VALUE2_47_32_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W6_CFG_MAC_CAM_VALUE3_31_0_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W7_CFG_MAC_CAM_VALUE3_47_32_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W8_CFG_MAC_CAM_VALUE4_31_0_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W9_CFG_MAC_CAM_VALUE4_47_32_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W10_CFG_MAC_CAM_VALUE5_31_0_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W11_CFG_MAC_CAM_VALUE5_47_32_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W12_CFG_MAC_CAM_VALUE6_31_0_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W13_CFG_MAC_CAM_VALUE6_47_32_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W14_CFG_MAC_CAM_VALUE7_31_0_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W15_CFG_MAC_CAM_VALUE7_47_32_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W16_CFG_MAC_CAM_MASK0_31_0_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W17_CFG_MAC_CAM_MASK0_47_32_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W18_CFG_MAC_CAM_MASK1_31_0_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W19_CFG_MAC_CAM_MASK1_47_32_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W20_CFG_MAC_CAM_MASK2_31_0_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W21_CFG_MAC_CAM_MASK2_47_32_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W22_CFG_MAC_CAM_MASK3_31_0_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W23_CFG_MAC_CAM_MASK3_47_32_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W24_CFG_MAC_CAM_MASK4_31_0_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W25_CFG_MAC_CAM_MASK4_47_32_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W26_CFG_MAC_CAM_MASK5_31_0_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W27_CFG_MAC_CAM_MASK5_47_32_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W28_CFG_MAC_CAM_MASK6_31_0_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W29_CFG_MAC_CAM_MASK6_47_32_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W30_CFG_MAC_CAM_MASK7_31_0_BIT 0 +#define CPU_MAC_UNIT_MAC_CAM_CFG_W31_CFG_MAC_CAM_MASK7_47_32_BIT 0 + +#define CPU_MAC_UNIT_MAC_CAM_CFG_W0_CFG_MAC_CAM_VALUE0_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W1_CFG_MAC_CAM_VALUE0_47_32_MASK 0x0000ffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W2_CFG_MAC_CAM_VALUE1_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W3_CFG_MAC_CAM_VALUE1_47_32_MASK 0x0000ffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W4_CFG_MAC_CAM_VALUE2_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W5_CFG_MAC_CAM_VALUE2_47_32_MASK 0x0000ffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W6_CFG_MAC_CAM_VALUE3_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W7_CFG_MAC_CAM_VALUE3_47_32_MASK 0x0000ffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W8_CFG_MAC_CAM_VALUE4_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W9_CFG_MAC_CAM_VALUE4_47_32_MASK 0x0000ffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W10_CFG_MAC_CAM_VALUE5_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W11_CFG_MAC_CAM_VALUE5_47_32_MASK 0x0000ffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W12_CFG_MAC_CAM_VALUE6_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W13_CFG_MAC_CAM_VALUE6_47_32_MASK 0x0000ffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W14_CFG_MAC_CAM_VALUE7_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W15_CFG_MAC_CAM_VALUE7_47_32_MASK 0x0000ffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W16_CFG_MAC_CAM_MASK0_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W17_CFG_MAC_CAM_MASK0_47_32_MASK 0x0000ffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W18_CFG_MAC_CAM_MASK1_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W19_CFG_MAC_CAM_MASK1_47_32_MASK 0x0000ffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W20_CFG_MAC_CAM_MASK2_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W21_CFG_MAC_CAM_MASK2_47_32_MASK 0x0000ffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W22_CFG_MAC_CAM_MASK3_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W23_CFG_MAC_CAM_MASK3_47_32_MASK 0x0000ffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W24_CFG_MAC_CAM_MASK4_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W25_CFG_MAC_CAM_MASK4_47_32_MASK 0x0000ffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W26_CFG_MAC_CAM_MASK5_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W27_CFG_MAC_CAM_MASK5_47_32_MASK 0x0000ffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W28_CFG_MAC_CAM_MASK6_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W29_CFG_MAC_CAM_MASK6_47_32_MASK 0x0000ffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W30_CFG_MAC_CAM_MASK7_31_0_MASK 0xffffffff +#define CPU_MAC_UNIT_MAC_CAM_CFG_W31_CFG_MAC_CAM_MASK7_47_32_MASK 0x0000ffff + +/* ################################################################################ + * # CpuMacUnitFilterCfg Definition */ +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_BLOCK_SUPPRESSION_TRAFFIC_BIT 6 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_ETHER_TYPE_FILTER_EN_BIT 1 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_FILTER_IS_LOOSE_BIT 5 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_ADDR_FILTER_EN_BIT 2 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_ADDR_IS_SA0_BIT 17 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_ADDR_IS_SA1_BIT 18 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_ADDR_IS_SA2_BIT 19 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_ADDR_IS_SA3_BIT 20 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_CAM0_IS_V6_BIT 21 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_CAM1_IS_V6_BIT 22 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_CAM2_IS_V6_BIT 23 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_CAM3_IS_V6_BIT 24 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_CAM_IS_BLACK_LIST_BIT 4 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA0_BIT 9 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA1_BIT 10 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA2_BIT 11 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA3_BIT 12 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA4_BIT 13 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA5_BIT 14 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA6_BIT 15 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA7_BIT 16 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_CAM_IS_BLACK_LIST_BIT 3 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_FILTER_EN_BIT 0 +#define CPU_MAC_UNIT_FILTER_CFG_W1_CFG_SUPPRESSION_ETHER_TYPE0_BIT 16 +#define CPU_MAC_UNIT_FILTER_CFG_W1_CFG_VLAN_TPID_BIT 0 +#define CPU_MAC_UNIT_FILTER_CFG_W2_CFG_SUPPRESSION_ETHER_TYPE1_BIT 0 +#define CPU_MAC_UNIT_FILTER_CFG_W2_CFG_SUPPRESSION_ETHER_TYPE2_BIT 16 +#define CPU_MAC_UNIT_FILTER_CFG_W3_CFG_CONFIRM_ETHER_TYPE0_BIT 0 +#define CPU_MAC_UNIT_FILTER_CFG_W3_CFG_CONFIRM_ETHER_TYPE1_BIT 16 +#define CPU_MAC_UNIT_FILTER_CFG_W4_CFG_CONFIRM_ETHER_TYPE2_BIT 0 +#define CPU_MAC_UNIT_FILTER_CFG_W5_CFG_METER_TOKEN_UPD_INTERVAL_BIT 0 +#define CPU_MAC_UNIT_FILTER_CFG_W5_CFG_METER_TOKEN_UPD_VALUE_BIT 16 + +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_BLOCK_SUPPRESSION_TRAFFIC_MASK 0x000001c0 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_ETHER_TYPE_FILTER_EN_MASK 0x00000002 #define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_FILTER_IS_LOOSE_MASK 0x00000020 -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA7_MASK 0x00010000 #define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_ADDR_FILTER_EN_MASK 0x00000004 -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_BLOCK_SUPPRESSION_TRAFFIC_MASK 0x000001c0 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_ADDR_IS_SA0_MASK 0x00020000 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_ADDR_IS_SA1_MASK 0x00040000 #define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_ADDR_IS_SA2_MASK 0x00080000 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_ADDR_IS_SA3_MASK 0x00100000 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_CAM0_IS_V6_MASK 0x00200000 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_CAM1_IS_V6_MASK 0x00400000 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_CAM2_IS_V6_MASK 0x00800000 #define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_CAM3_IS_V6_MASK 0x01000000 -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA5_MASK 0x00004000 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_CAM_IS_BLACK_LIST_MASK 0x00000010 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA0_MASK 0x00000200 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA1_MASK 0x00000400 #define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA2_MASK 0x00000800 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA3_MASK 0x00001000 #define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA4_MASK 0x00002000 -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_CAM_IS_BLACK_LIST_MASK 0x00000010 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA5_MASK 0x00004000 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA6_MASK 0x00008000 +#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA7_MASK 0x00010000 #define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_CAM_IS_BLACK_LIST_MASK 0x00000008 #define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_FILTER_EN_MASK 0x00000001 -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_CAM2_IS_V6_MASK 0x00800000 -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_CAM1_IS_V6_MASK 0x00400000 -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_ETHER_TYPE_FILTER_EN_MASK 0x00000002 -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA1_MASK 0x00000400 -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_MAC_ADDR_IS_SA3_MASK 0x00001000 -#define CPU_MAC_UNIT_FILTER_CFG_W0_CFG_IP_CAM0_IS_V6_MASK 0x00200000 #define CPU_MAC_UNIT_FILTER_CFG_W1_CFG_SUPPRESSION_ETHER_TYPE0_MASK 0xffff0000 #define CPU_MAC_UNIT_FILTER_CFG_W1_CFG_VLAN_TPID_MASK 0x0000ffff #define CPU_MAC_UNIT_FILTER_CFG_W2_CFG_SUPPRESSION_ETHER_TYPE1_MASK 0x0000ffff @@ -5225,64 +5255,182 @@ struct cpu_mac_unit_regs { #define CPU_MAC_UNIT_FILTER_CFG_W5_CFG_METER_TOKEN_UPD_INTERVAL_MASK 0x0000ffff #define CPU_MAC_UNIT_FILTER_CFG_W5_CFG_METER_TOKEN_UPD_VALUE_MASK 0xffff0000 -struct cpu_mac_unit_mems { - u32 cpu_mac_unit_tx_ts_capture_fifo_0[3]; /* 0x00000400 */ - u32 cpu_mac_unit_tx_ts_capture_fifo_0_rsv3; - u32 cpu_mac_unit_tx_ts_capture_fifo_1[3]; /* 0x00000410 */ - u32 cpu_mac_unit_tx_ts_capture_fifo_1_rsv3; - u32 cpu_mac_unit_tx_ts_capture_fifo_2[3]; /* 0x00000420 */ - u32 cpu_mac_unit_tx_ts_capture_fifo_2_rsv3; - u32 cpu_mac_unit_tx_ts_capture_fifo_3[3]; /* 0x00000430 */ - u32 cpu_mac_unit_tx_ts_capture_fifo_3_rsv3; - u32 cpu_mac_unit_tx_ts_capture_fifo_4[3]; /* 0x00000440 */ - u32 cpu_mac_unit_tx_ts_capture_fifo_4_rsv3; - u32 cpu_mac_unit_tx_ts_capture_fifo_5[3]; /* 0x00000450 */ - u32 cpu_mac_unit_tx_ts_capture_fifo_5_rsv3; - u32 cpu_mac_unit_tx_ts_capture_fifo_6[3]; /* 0x00000460 */ - u32 cpu_mac_unit_tx_ts_capture_fifo_6_rsv3; - u32 cpu_mac_unit_tx_ts_capture_fifo_7[3]; /* 0x00000470 */ - u32 cpu_mac_unit_tx_ts_capture_fifo_7_rsv3; - u32 cpu_mac_unit_tx_capture_ts_0[3]; /* 0x00000480 */ - u32 cpu_mac_unit_tx_capture_ts_0_rsv3; +/* ################################################################################ + * # CpuMacUnitFilterCfg1 Definition */ +#define CPU_MAC_UNIT_FILTER_CFG1_W0_CFG_MAC_CAM_ENABLE_BMP0_BIT 16 +#define CPU_MAC_UNIT_FILTER_CFG1_W0_CFG_MAC_CAM_ENABLE_BMP1_BIT 24 +#define CPU_MAC_UNIT_FILTER_CFG1_W0_CFG_METER_TOKEN_UPD_VALUE1_BIT 0 +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_CHECK_NORMAL_PKT_ENABLE0_BIT 16 +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_CHECK_NORMAL_PKT_ENABLE1_BIT 17 +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_DROP_NORMAL_PKT0_BIT 18 +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_DROP_NORMAL_PKT1_BIT 19 +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_ETHER_TYPE_ENABLE_BMP0_BIT 8 +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_ETHER_TYPE_ENABLE_BMP1_BIT 12 +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_IP_CAM_ENABLE_BMP0_BIT 0 +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_IP_CAM_ENABLE_BMP1_BIT 4 +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_METER_TOKEN_UPD_VALUE_SEL0_BIT 22 +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_METER_TOKEN_UPD_VALUE_SEL1_BIT 23 +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_VLAN_FILTER_ENABLE0_BIT 21 +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_VLAN_FILTER_ENABLE1_BIT 20 +#define CPU_MAC_UNIT_FILTER_CFG1_W2_CFG_METER_TOKEN_MAX_VALUE0_BIT 0 +#define CPU_MAC_UNIT_FILTER_CFG1_W3_CFG_METER_TOKEN_MAX_VALUE1_BIT 0 + +#define CPU_MAC_UNIT_FILTER_CFG1_W0_CFG_MAC_CAM_ENABLE_BMP0_MASK 0x00ff0000 +#define CPU_MAC_UNIT_FILTER_CFG1_W0_CFG_MAC_CAM_ENABLE_BMP1_MASK 0xff000000 +#define CPU_MAC_UNIT_FILTER_CFG1_W0_CFG_METER_TOKEN_UPD_VALUE1_MASK 0x0000ffff +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_CHECK_NORMAL_PKT_ENABLE0_MASK 0x00010000 +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_CHECK_NORMAL_PKT_ENABLE1_MASK 0x00020000 +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_DROP_NORMAL_PKT0_MASK 0x00040000 +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_DROP_NORMAL_PKT1_MASK 0x00080000 +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_ETHER_TYPE_ENABLE_BMP0_MASK 0x00000f00 +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_ETHER_TYPE_ENABLE_BMP1_MASK 0x0000f000 +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_IP_CAM_ENABLE_BMP0_MASK 0x0000000f +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_IP_CAM_ENABLE_BMP1_MASK 0x000000f0 +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_METER_TOKEN_UPD_VALUE_SEL0_MASK 0x00400000 +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_METER_TOKEN_UPD_VALUE_SEL1_MASK 0x00800000 +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_VLAN_FILTER_ENABLE0_MASK 0x00200000 +#define CPU_MAC_UNIT_FILTER_CFG1_W1_CFG_VLAN_FILTER_ENABLE1_MASK 0x00100000 +#define CPU_MAC_UNIT_FILTER_CFG1_W2_CFG_METER_TOKEN_MAX_VALUE0_MASK 0x00ffffff +#define CPU_MAC_UNIT_FILTER_CFG1_W3_CFG_METER_TOKEN_MAX_VALUE1_MASK 0x00ffffff + +struct CpuMacUnit_mems { + u32 CpuMacUnitTxTsCaptureFifo0[3]; /* 0x00000400 */ + u32 CpuMacUnitTxTsCaptureFifo0_rsv3; + u32 CpuMacUnitTxTsCaptureFifo1[3]; /* 0x00000410 */ + u32 CpuMacUnitTxTsCaptureFifo1_rsv3; + u32 CpuMacUnitTxTsCaptureFifo2[3]; /* 0x00000420 */ + u32 CpuMacUnitTxTsCaptureFifo2_rsv3; + u32 CpuMacUnitTxTsCaptureFifo3[3]; /* 0x00000430 */ + u32 CpuMacUnitTxTsCaptureFifo3_rsv3; + u32 CpuMacUnitTxTsCaptureFifo4[3]; /* 0x00000440 */ + u32 CpuMacUnitTxTsCaptureFifo4_rsv3; + u32 CpuMacUnitTxTsCaptureFifo5[3]; /* 0x00000450 */ + u32 CpuMacUnitTxTsCaptureFifo5_rsv3; + u32 CpuMacUnitTxTsCaptureFifo6[3]; /* 0x00000460 */ + u32 CpuMacUnitTxTsCaptureFifo6_rsv3; + u32 CpuMacUnitTxTsCaptureFifo7[3]; /* 0x00000470 */ + u32 CpuMacUnitTxTsCaptureFifo7_rsv3; + u32 CpuMacUnitTxCaptureTs0[3]; /* 0x00000480 */ + u32 CpuMacUnitTxCaptureTs0_rsv3; }; -/* cpu_mac_unit_tx_ts_capture_fifo Definition */ -#define CPU_MAC_UNIT_TX_TS_CAPTURE_FIFO_W0_CPU_MAC_UNIT_TX_TS_CAPTURE_FIFO_FIELD0 BIT(0) -#define CPU_MAC_UNIT_TX_TS_CAPTURE_FIFO_W1_CPU_MAC_UNIT_TX_TS_CAPTURE_FIFO_FIELD1 BIT(0) -#define CPU_MAC_UNIT_TX_TS_CAPTURE_FIFO_W2_CPU_MAC_UNIT_TX_TS_CAPTURE_FIFO_FIELD2 BIT(0) +/* ################################################################################ + * # CpuMacUnitTxTsCaptureFifo Definition */ +#define CPU_MAC_UNIT_TX_TS_CAPTURE_FIFO_W0_CPU_MAC_UNIT_TX_TS_CAPTURE_FIFO_FIELD0_BIT 0 +#define CPU_MAC_UNIT_TX_TS_CAPTURE_FIFO_W1_CPU_MAC_UNIT_TX_TS_CAPTURE_FIFO_FIELD1_BIT 0 +#define CPU_MAC_UNIT_TX_TS_CAPTURE_FIFO_W2_CPU_MAC_UNIT_TX_TS_CAPTURE_FIFO_FIELD2_BIT 0 #define CPU_MAC_UNIT_TX_TS_CAPTURE_FIFO_W0_CPU_MAC_UNIT_TX_TS_CAPTURE_FIFO_FIELD0_MASK 0xffffffff #define CPU_MAC_UNIT_TX_TS_CAPTURE_FIFO_W1_CPU_MAC_UNIT_TX_TS_CAPTURE_FIFO_FIELD1_MASK 0xffffffff #define CPU_MAC_UNIT_TX_TS_CAPTURE_FIFO_W2_CPU_MAC_UNIT_TX_TS_CAPTURE_FIFO_FIELD2_MASK 0x0000000f -/* cpu_mac_unit_tx_capture_ts Definition */ -#define CPU_MAC_UNIT_TX_CAPTURE_TS_W0_CPU_MAC1_TX_SEQ_ID BIT(5) -#define CPU_MAC_UNIT_TX_CAPTURE_TS_W0_CPU_MAC1_TX_SFD BIT(4) -#define CPU_MAC_UNIT_TX_CAPTURE_TS_W0_CPU_MAC0_TX_SEQ_ID BIT(1) -#define CPU_MAC_UNIT_TX_CAPTURE_TS_W0_CPU_MAC0_TX_SFD BIT(0) -#define CPU_MAC_UNIT_TX_CAPTURE_TS_W1_ADJ_RC_SECOND BIT(0) -#define CPU_MAC_UNIT_TX_CAPTURE_TS_W2_ADJ_RC_NS BIT(0) +/* ################################################################################ + * # CpuMacUnitTxCaptureTs Definition */ +#define CPU_MAC_UNIT_TX_CAPTURE_TS_W0_CPU_MAC0_TX_SEQ_ID_BIT 1 +#define CPU_MAC_UNIT_TX_CAPTURE_TS_W0_CPU_MAC0_TX_SFD_BIT 0 +#define CPU_MAC_UNIT_TX_CAPTURE_TS_W0_CPU_MAC1_TX_SEQ_ID_BIT 5 +#define CPU_MAC_UNIT_TX_CAPTURE_TS_W0_CPU_MAC1_TX_SFD_BIT 4 +#define CPU_MAC_UNIT_TX_CAPTURE_TS_W1_ADJ_RC_SECOND_BIT 0 +#define CPU_MAC_UNIT_TX_CAPTURE_TS_W2_ADJ_RC_NS_BIT 0 -#define CPU_MAC_UNIT_TX_CAPTURE_TS_W0_CPU_MAC1_TX_SEQ_ID_MASK 0x00000060 -#define CPU_MAC_UNIT_TX_CAPTURE_TS_W0_CPU_MAC1_TX_SFD_MASK 0x00000010 #define CPU_MAC_UNIT_TX_CAPTURE_TS_W0_CPU_MAC0_TX_SEQ_ID_MASK 0x00000006 #define CPU_MAC_UNIT_TX_CAPTURE_TS_W0_CPU_MAC0_TX_SFD_MASK 0x00000001 +#define CPU_MAC_UNIT_TX_CAPTURE_TS_W0_CPU_MAC1_TX_SEQ_ID_MASK 0x00000060 +#define CPU_MAC_UNIT_TX_CAPTURE_TS_W0_CPU_MAC1_TX_SFD_MASK 0x00000010 #define CPU_MAC_UNIT_TX_CAPTURE_TS_W1_ADJ_RC_SECOND_MASK 0xffffffff #define CPU_MAC_UNIT_TX_CAPTURE_TS_W2_ADJ_RC_NS_MASK 0x3fffffff -#define CTCMAC_NUM 2 -#define TX_BUF_CNT 2 +/* defing MDIOSOC_REG_BASE 0x00000000 */ + +struct MdioSoc_regs { + u32 MdioSocCmd0[2]; /* 0x00000000 */ + u32 MdioSocCmd1[2]; /* 0x00000008 */ + u32 MdioSocStatus1; /* 0x00000010 */ + u32 MdioSocStatus0; /* 0x00000014 */ + u32 MdioSocReserved; /* 0x00000018 */ + u32 MdioSocCfg0; /* 0x0000001c */ + u32 MdioSocCfg1; /* 0x00000020 */ +}; + +/* ################################################################################ + * # MdioSocCmd0 Definition + */ +#define MDIO_SOC_CMD0_W0_DATA_CMD_LANE0 0 +#define MDIO_SOC_CMD0_W0_OP_CODE_CMD_LANE0 26 +#define MDIO_SOC_CMD0_W0_PHY_ADD_CMD_LANE0 21 +#define MDIO_SOC_CMD0_W0_REG_ADD_CMD_LANE0 16 +#define MDIO_SOC_CMD0_W1_START_CMD_LANE0 0 + +#define MDIO_SOC_CMD0_W0_DATA_CMD_LANE0_MASK 0x0000ffff +#define MDIO_SOC_CMD0_W0_OP_CODE_CMD_LANE0_MASK 0x0c000000 +#define MDIO_SOC_CMD0_W0_PHY_ADD_CMD_LANE0_MASK 0x03e00000 +#define MDIO_SOC_CMD0_W0_REG_ADD_CMD_LANE0_MASK 0x001f0000 +#define MDIO_SOC_CMD0_W1_START_CMD_LANE0_MASK 0x00000003 + +/* ################################################################################ + * # MdioSocCmd1 Definition + */ +#define MDIO_SOC_CMD1_W0_DATA_CMD_LANE1 0 +#define MDIO_SOC_CMD1_W0_OP_CODE_CMD_LANE1 26 +#define MDIO_SOC_CMD1_W0_PHY_ADD_CMD_LANE1 21 +#define MDIO_SOC_CMD1_W0_REG_ADD_CMD_LANE1 16 +#define MDIO_SOC_CMD1_W1_START_CMD_LANE1 0 + +#define MDIO_SOC_CMD1_W0_DATA_CMD_LANE1_MASK 0x0000ffff +#define MDIO_SOC_CMD1_W0_OP_CODE_CMD_LANE1_MASK 0x0c000000 +#define MDIO_SOC_CMD1_W0_PHY_ADD_CMD_LANE1_MASK 0x03e00000 +#define MDIO_SOC_CMD1_W0_REG_ADD_CMD_LANE1_MASK 0x001f0000 +#define MDIO_SOC_CMD1_W1_START_CMD_LANE1_MASK 0x00000003 -#define CTCMAC_MDIO_BASE 0x33620000 -#define CTCMAC_0_BASE 0x33410000 -#define CTCMAC_1_BASE 0x33420000 +/* ################################################################################ + * # MdioSocStatus1 Definition + */ +#define MDIO_SOC_STATUS1_W0_MDIO_CMD_DONE_LANE1 16 +#define MDIO_SOC_STATUS1_W0_MDIO_READ_DATA_LANE1 0 + +#define MDIO_SOC_STATUS1_W0_MDIO_CMD_DONE_LANE1_MASK 0x00010000 +#define MDIO_SOC_STATUS1_W0_MDIO_READ_DATA_LANE1_MASK 0x0000ffff + +/* ################################################################################ + * # MdioSocStatus0 Definition + */ +#define MDIO_SOC_STATUS0_W0_MDIO_CMD_DONE_LANE0 16 +#define MDIO_SOC_STATUS0_W0_MDIO_READ_DATA_LANE0 0 + +#define MDIO_SOC_STATUS0_W0_MDIO_CMD_DONE_LANE0_MASK 0x00010000 +#define MDIO_SOC_STATUS0_W0_MDIO_READ_DATA_LANE0_MASK 0x0000ffff + +/* ################################################################################ + * # MdioSocReserved Definition + */ +#define MDIO_SOC_RESERVED_W0_RESERVED 0 + +#define MDIO_SOC_RESERVED_W0_RESERVED_MASK 0x0000ffff + +/* ################################################################################ + * # MdioSocCfg0 Definition + */ +#define MDIO_SOC_CFG0_W0_MDIO_IN_DLY_LANE0 8 +#define MDIO_SOC_CFG0_W0_MDIO_MAC_PRE_LANE0 0 + +#define MDIO_SOC_CFG0_W0_MDIO_IN_DLY_LANE0_MASK 0x00000f00 +#define MDIO_SOC_CFG0_W0_MDIO_MAC_PRE_LANE0_MASK 0x0000003f + +/* ################################################################################ + * # MdioSocCfg1 Definition + */ +#define MDIO_SOC_CFG1_W0_MDIO_IN_DLY_LANE1 8 +#define MDIO_SOC_CFG1_W0_MDIO_MAC_PRE_LANE1 0 + +#define MDIO_SOC_CFG1_W0_MDIO_IN_DLY_LANE1_MASK 0x00000f00 +#define MDIO_SOC_CFG1_W0_MDIO_MAC_PRE_LANE1_MASK 0x0000003f -#define CTCMAC_MDIO_CMD_STCODE(V) (V << 0) -#define CTCMAC_MDIO_CMD_OPCODE(V) (V << 26) -#define CTCMAC_MDIO_CMD_PHYAD(V) (V << 21) -#define CTCMAC_MDIO_CMD_REGAD(V) (V << 16) -#define CTCMAC_MDIO_CMD_DATA(V) (V << 0) +#define CTCMAC_MDIO_CMD_STCODE(V) (V<<0) +#define CTCMAC_MDIO_CMD_OPCODE(V) (V<<26) +#define CTCMAC_MDIO_CMD_PHYAD(V) (V<<21) +#define CTCMAC_MDIO_CMD_REGAD(V) (V<<16) +#define CTCMAC_MDIO_CMD_DATA(V) (V<<0) -#define CTCMAC_MDIO_STAT(V) (V << 16) +#define CTCMAC_MDIO_STAT(V) (V<<16) #endif diff --git a/platform/centec-arm64/tsingma-bsp/src/ctcmac/ctcmac_test.c b/platform/centec-arm64/tsingma-bsp/src/ctcmac/ctcmac_test.c deleted file mode 100644 index 72bbf7599ebb..000000000000 --- a/platform/centec-arm64/tsingma-bsp/src/ctcmac/ctcmac_test.c +++ /dev/null @@ -1,2116 +0,0 @@ -/* - * Centec cpu_mac Ethernet Driver For Test -- cpu_mac controller implementation - * Provides Bus interface for MIIM regs - * - * Author: liuht - * - * Copyright 2002-2018, Centec Networks (Suzhou) Co., Ltd. - * - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include "../pinctrl-ctc/pinctrl-ctc.h" -#include "../include/sysctl.h" -#include -#include -#include - -#include "ctcmac.h" -#include "ctcmac_reg.h" - -enum ctcmac_test_field { - CTCMAC_RING_SIZE = 0, - CTCMAC_PAYLOAD_SIZE = 1, - CTCMAC_RXTS_EN = 2, - CTCMAC_RXTS_DUMP = 3, - CTCMAC_TXTS_EN = 4, - CTCMAC_TXTS_DUMP = 5, - CTCMAC_TXINFO_VAL1 = 6, - CTCMAC_TXINFO_VAL2 = 7, - CTCMAC_TXINFO_VAL3 = 8, - CTCMAC_TXINFO_VAL4 = 9, -}; - -struct ctcmac_ptp_info { - u32 val1; - u32 val2; - u32 val3; - u32 val4; -}; - -struct ctcmac_test_param { - u32 ring_size; - u32 payload_size; - u32 rxts_en; - u32 rxts_dump; - u32 txts_en; - u32 txts_dump; - struct ctcmac_ptp_info ptp_info; -}; - -static int ctcmac_alloc_skb_resources(struct net_device *ndev); -static int ctcmac_free_skb_resources(struct ctcmac_private *priv); -static void cpumac_start(struct ctcmac_private *priv); -static void cpumac_halt(struct ctcmac_private *priv); -static void ctcmac_hw_init(struct ctcmac_private *priv); -static spinlock_t global_reglock __aligned(SMP_CACHE_BYTES); -static int g_reglock_init_done; -static int g_mac_unit_init_done; -static struct ctcmac_test_param test_param[2]; -static struct ctcmac_pkt_stats pkt_stats[2]; -static int cpumac_unit_irq_installed; -static struct regmap *regmap_base; -struct cpu_mac_unit_regs *g_cpumacu_reg; -/* get cpumac register : just for test */ -static int ctcmac_ethtool_get_eeprom(struct net_device *netdev, - struct ethtool_eeprom *ee, u8 *data) -{ - u8 *iobase; - u32 val; - unsigned long flags; - struct ctcmac_private *priv = netdev_priv(netdev); - - if (ee->offset >= 0x00010000) { - iobase = (u8 *)priv->cpumacu_reg; - ee->offset -= (0x00010000 + CPUMACUNIT_REG_BASE); - } else if (ee->offset >= 0x00004000) { - iobase = (u8 *)priv->cpumac_mem; - ee->offset -= 0x00004000; - } else { - iobase = (u8 *)priv->cpumac_reg; - } - - spin_lock_irqsave(&priv->reglock, flags); - val = readl((unsigned __iomem *)(iobase + ee->offset)); - pr_err("0x%llx : 0x%x\n", (u64)(iobase + ee->offset), val); - memcpy(data, (u8 *)&val, 4); - - spin_unlock_irqrestore(&priv->reglock, flags); - - return 0; -} - -static int ctcmac_fill_test_param(u32 index, u32 field, u32 val) -{ - if (field == CTCMAC_RING_SIZE) - test_param[index].ring_size = val; - else if (field == CTCMAC_PAYLOAD_SIZE) - test_param[index].payload_size = val; - else if (field == CTCMAC_RXTS_EN) - test_param[index].rxts_en = val; - else if (field == CTCMAC_RXTS_DUMP) - test_param[index].rxts_dump = val; - else if (field == CTCMAC_TXTS_EN) - test_param[index].txts_en = val; - else if (field == CTCMAC_TXTS_DUMP) - test_param[index].txts_dump = val; - else if (field == CTCMAC_TXINFO_VAL1) - test_param[index].ptp_info.val1 = val; - else if (field == CTCMAC_TXINFO_VAL2) - test_param[index].ptp_info.val2 = val; - else if (field == CTCMAC_TXINFO_VAL3) - test_param[index].ptp_info.val3 = val; - else if (field == CTCMAC_TXINFO_VAL4) - test_param[index].ptp_info.val4 = val; - - pr_err("test param:\n"); - pr_err("ring size : %d\n", test_param[index].ring_size); - pr_err("payload size : %d\n", test_param[index].payload_size); - pr_err("rxts en : %d\n", test_param[index].rxts_en); - pr_err("rxts dump : %d\n", test_param[index].rxts_dump); - pr_err("txts en : %d\n", test_param[index].txts_en); - pr_err("txts dump : %d\n", test_param[index].txts_dump); - pr_err("ptp info : 0x%x 0x%x 0x%x 0x%x\n", - test_param[index].ptp_info.val1, - test_param[index].ptp_info.val2, - test_param[index].ptp_info.val3, - test_param[index].ptp_info.val4); - - return 0; -} - -/* set cpumac register : just for test */ -static int ctcmac_ethtool_set_eeprom(struct net_device *netdev, - struct ethtool_eeprom *ee, u8 *data) -{ - u8 *iobase; - u32 val = 0; - unsigned long flags; - struct ctcmac_private *priv = netdev_priv(netdev); - - if (ee->offset >= 0x00030000) { - memset(&pkt_stats[priv->index], 0, - sizeof(struct ctcmac_pkt_stats)); - return 0; - } else if (ee->offset >= 0x00020000) { - val = - data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << - 24); - ctcmac_fill_test_param(priv->index, ee->offset - 0x00020000, - val); - return 0; - } else if (ee->offset >= 0x00010000) { - iobase = (u8 *)priv->cpumacu_reg; - ee->offset -= (0x00010000 + CPUMACUNIT_REG_BASE); - } else if (ee->offset >= 0x00004000) { - iobase = (u8 *)priv->cpumac_mem; - ee->offset -= 0x00004000; - } else { - iobase = (u8 *)priv->cpumac_reg; - } - - val = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); - pr_err("0x%llx : 0x%x\n", (u64)(iobase + ee->offset), val); - spin_lock_irqsave(&priv->reglock, flags); - writel(val, (unsigned __iomem *)(iobase + ee->offset)); - spin_unlock_irqrestore(&priv->reglock, flags); - - return 0; -} - -static void ctcmac_ethtool_get_stats(struct net_device *netdev, - struct ethtool_regs *regs, void *regbuf) -{ - u32 mtu; - unsigned long flags; - struct ctcmac_pkt_stats *stats; - struct ctcmac_private *priv = netdev_priv(netdev); - - spin_lock_irqsave(&priv->reglock, flags); - stats = &pkt_stats[priv->index]; - stats->rx_good_ucast_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_0[0]); - stats->rx_good_ucast_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_0[2]); - stats->rx_good_mcast_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_1[0]); - stats->rx_good_mcast_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_1[2]); - stats->rx_good_bcast_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_2[0]); - stats->rx_good_bcast_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_2[2]); - stats->rx_good_pause_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_3[0]); - stats->rx_good_pause_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_3[2]); - stats->rx_good_pfc_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_4[0]); - stats->rx_good_pfc_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_4[2]); - stats->rx_good_control_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_5[0]); - stats->rx_good_control_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_5[2]); - stats->rx_fcs_error_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_6[0]); - stats->rx_fcs_error_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_6[2]); - stats->rx_mac_overrun_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_7[0]); - stats->rx_mac_overrun_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_7[2]); - stats->rx_good_63B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_8[0]); - stats->rx_good_63B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_8[2]); - stats->rx_bad_63B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_9[0]); - stats->rx_bad_63B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_9[2]); - stats->rx_good_mtu2B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_10[0]); - stats->rx_good_mtu2B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_10[2]); - stats->rx_bad_mtu2B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_11[0]); - stats->rx_bad_mtu2B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_11[2]); - stats->rx_good_jumbo_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_12[0]); - stats->rx_good_jumbo_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_12[2]); - stats->rx_bad_jumbo_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_13[0]); - stats->rx_bad_jumbo_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_13[2]); - stats->rx_64B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_14[0]); - stats->rx_64B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_14[2]); - stats->rx_127B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_15[0]); - stats->rx_127B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_15[2]); - stats->rx_255B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_16[0]); - stats->rx_255B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_16[2]); - stats->rx_511B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_17[0]); - stats->rx_511B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_17[2]); - stats->rx_1023B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_18[0]); - stats->rx_1023B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_18[2]); - stats->rx_mtu1B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_19[0]); - stats->rx_mtu1B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_19[2]); - stats->tx_ucast_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_20[0]); - stats->tx_ucast_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_20[2]); - stats->tx_mcast_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_21[0]); - stats->tx_mcast_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_21[2]); - stats->tx_bcast_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_22[0]); - stats->tx_bcast_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_22[2]); - stats->tx_pause_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_23[0]); - stats->tx_pause_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_23[2]); - stats->tx_control_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_24[0]); - stats->tx_control_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_24[2]); - stats->tx_fcs_error_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_25[0]); - stats->tx_fcs_error_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_25[2]); - stats->tx_underrun_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_26[0]); - stats->tx_underrun_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_26[2]); - stats->tx_63B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_27[0]); - stats->tx_63B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_27[2]); - stats->tx_64B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_28[0]); - stats->tx_64B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_28[2]); - stats->tx_127B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_29[0]); - stats->tx_127B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_29[2]); - stats->tx_255B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_30[0]); - stats->tx_255B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_30[2]); - stats->tx_511B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_31[0]); - stats->tx_511B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_31[2]); - stats->tx_1023B_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_32[0]); - stats->tx_1023B_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_32[2]); - stats->tx_mtu1_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_33[0]); - stats->tx_mtu1_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_33[2]); - stats->tx_mtu2_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_34[0]); - stats->tx_mtu2_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_34[2]); - stats->tx_jumbo_bytes += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_35[0]); - stats->tx_jumbo_pkt += - readq(&priv->cpumac_mem->cpu_mac_stats_ram_35[2]); - mtu = readl(&priv->cpumac_reg->cpu_mac_stats_cfg[1]); - stats->mtu1 = mtu & 0x3fff; - stats->mtu2 = (mtu >> 16) & 0x3fff; - spin_unlock_irqrestore(&priv->reglock, flags); - - memcpy(regbuf, (void *)stats, sizeof(struct ctcmac_pkt_stats)); -} - -static int ctcmac_ethtool_get_eeprom_len(struct net_device *netdev) -{ - return 0x40000; -} - -static int ctcmac_ethtool_get_regs_len(struct net_device *netdev) -{ - return sizeof(struct ctcmac_pkt_stats); -} - -const struct ethtool_ops ctcmac_ethtool_test_ops = { - .get_eeprom = ctcmac_ethtool_get_eeprom, - .set_eeprom = ctcmac_ethtool_set_eeprom, - .get_eeprom_len = ctcmac_ethtool_get_eeprom_len, - .get_regs = ctcmac_ethtool_get_stats, - .get_regs_len = ctcmac_ethtool_get_regs_len, -}; - -static void clrsetbits(unsigned __iomem *addr, u32 clr, u32 set) -{ - writel((readl(addr) & ~(clr)) | (set), addr); -} - -static u32 ctcmac_regr(unsigned __iomem *addr) -{ - u32 val; - - val = readl(addr); - return val; -} - -static void ctcmac_regw(unsigned __iomem *addr, u32 val) -{ - writel(val, addr); -} - -static inline int ctcmac_rxbd_unused(struct ctcmac_priv_rx_q *rxq) -{ - if (rxq->next_to_clean > rxq->next_to_use) - return rxq->next_to_clean - rxq->next_to_use - 1; - - return rxq->rx_ring_size + rxq->next_to_clean - rxq->next_to_use - 1; -} - -static int ctcmac_alloc_tx_queues(struct ctcmac_private *priv) -{ - int i; - - for (i = 0; i < priv->num_tx_queues; i++) { - priv->tx_queue[i] = kzalloc(sizeof(*priv->tx_queue[i]), - GFP_KERNEL); - if (!priv->tx_queue[i]) - return -ENOMEM; - - priv->tx_queue[i]->tx_skbuff = NULL; - priv->tx_queue[i]->qindex = i; - priv->tx_queue[i]->dev = priv->ndev; - spin_lock_init(&priv->tx_queue[i]->txlock); - } - return 0; -} - -static int ctcmac_alloc_rx_queues(struct ctcmac_private *priv) -{ - int i; - - for (i = 0; i < priv->num_rx_queues; i++) { - priv->rx_queue[i] = kzalloc(sizeof(*priv->rx_queue[i]), - GFP_KERNEL); - if (!priv->rx_queue[i]) - return -ENOMEM; - - priv->rx_queue[i]->qindex = i; - priv->rx_queue[i]->ndev = priv->ndev; - } - return 0; -} - -static void ctcmac_unmap_io_space(struct ctcmac_private *priv) -{ - if (priv->iobase) - iounmap(priv->iobase); -} - -static void ctcmac_free_tx_queues(struct ctcmac_private *priv) -{ - int i; - - for (i = 0; i < priv->num_tx_queues; i++) - kfree(priv->tx_queue[i]); -} - -static void ctcmac_free_rx_queues(struct ctcmac_private *priv) -{ - int i; - - for (i = 0; i < priv->num_rx_queues; i++) - kfree(priv->rx_queue[i]); -} - -static void ctcmac_free_dev(struct ctcmac_private *priv) -{ - if (priv->ndev) - free_netdev(priv->ndev); -} - -static int ctcmac_of_init(struct platform_device *ofdev, - struct net_device **pdev) -{ - int err = 0, index; - const char *ctype; - struct net_device *dev = NULL; - struct ctcmac_private *priv = NULL; - unsigned int num_tx_qs, num_rx_qs; - struct device_node *np = ofdev->dev.of_node; - - num_tx_qs = CTCMAC_TX_QUEUE_MAX; - num_rx_qs = CTCMAC_RX_QUEUE_MAX; - - *pdev = alloc_etherdev_mq(sizeof(*priv), num_tx_qs); - dev = *pdev; - if (!dev) - return -ENOMEM; - - priv = netdev_priv(dev); - priv->ndev = dev; - priv->ofdev = ofdev; - priv->dev = &ofdev->dev; - priv->dev->coherent_dma_mask = DMA_BIT_MASK(64); - priv->num_tx_queues = num_tx_qs; - netif_set_real_num_rx_queues(dev, num_rx_qs); - priv->num_rx_queues = num_rx_qs; - - priv->iobase = of_iomap(np, 0); - priv->cpumac_reg = priv->iobase + CPUMAC_REG_BASE; - priv->cpumac_mem = priv->iobase + CPUMAC_MEM_BASE; - priv->cpumacu_reg = of_iomap(np, 1) + CPUMACUNIT_REG_BASE; - g_cpumacu_reg = priv->cpumacu_reg; - - err = of_property_read_u32(np, "index", &index); - if (err == 0) - priv->index = index; - else - priv->index = 0; - - err = of_property_read_string(np, "phy-connection-type", &ctype); - if (err == 0 && !strncmp(ctype, "sgmii", 5)) - priv->interface = PHY_INTERFACE_MODE_SGMII; - else - priv->interface = PHY_INTERFACE_MODE_MII; - - priv->supported = SUPPORTED_10baseT_Full | SUPPORTED_10baseT_Half; - err = of_property_read_string(np, "capability-100M", &ctype); - if (err == 0 && !strncmp(ctype, "support", 7)) - priv->supported |= - SUPPORTED_100baseT_Full | SUPPORTED_100baseT_Half; - - err = of_property_read_string(np, "capability-1000M", &ctype); - if (err == 0 && !strncmp(ctype, "support", 7)) - priv->supported |= SUPPORTED_1000baseT_Full; - - priv->phy_node = of_parse_phandle(np, "phy-handle", 0); - - priv->irqinfo[CTCMAC_NORMAL].irq = irq_of_parse_and_map(np, 0); - priv->irqinfo[CTCMAC_FUNC].irq = irq_of_parse_and_map(np, 1); - priv->irqinfo[CTCMAC_UNIT].irq = irq_of_parse_and_map(np, 2); - - return 0; -} - -static int startup_ctcmac(struct net_device *ndev) -{ - int i; - int err; - struct ctcmac_private *priv = netdev_priv(ndev); - - if (ctcmac_alloc_tx_queues(priv)) - return -1; - - if (ctcmac_alloc_rx_queues(priv)) - return -1; - - /* Initializing some of the rx/tx queue level parameters */ - for (i = 0; i < priv->num_tx_queues; i++) { - priv->tx_queue[i]->tx_ring_size = - test_param[priv->index].ring_size; - priv->tx_queue[i]->num_txbdfree = - test_param[priv->index].ring_size; - } - - for (i = 0; i < priv->num_rx_queues; i++) { - priv->rx_queue[i]->rx_ring_size = - test_param[priv->index].ring_size; - } - - ctcmac_hw_init(priv); - - err = ctcmac_alloc_skb_resources(ndev); - if (err) - return err; - - /* barrier */ - smp_mb__before_atomic(); - clear_bit(CTCMAC_DOWN, &priv->state); - /* barrier */ - smp_mb__after_atomic(); - - cpumac_start(priv); - /* force link state update after mac reset */ - priv->oldlink = 0; - priv->oldspeed = 0; - priv->oldduplex = -1; - - phy_start(ndev->phydev); - - napi_enable(&priv->napi_rx); - napi_enable(&priv->napi_tx); - - netif_tx_wake_all_queues(ndev); - - return 0; -} - -static void stop_ctcmac(struct net_device *ndev) -{ - struct ctcmac_private *priv = netdev_priv(ndev); - - /* disable ints and gracefully shut down Rx/Tx DMA */ - cpumac_halt(priv); - - netif_tx_stop_all_queues(ndev); - - /* barrier */ - smp_mb__before_atomic(); - set_bit(CTCMAC_DOWN, &priv->state); - /* barrier */ - smp_mb__after_atomic(); - napi_disable(&priv->napi_rx); - napi_disable(&priv->napi_tx); - phy_stop(ndev->phydev); - ctcmac_free_skb_resources(priv); -} - -static void ctcmac_reset(struct net_device *ndev) -{ - struct ctcmac_private *priv = netdev_priv(ndev); - - while (test_and_set_bit_lock(CTCMAC_RESETTING, &priv->state)) - cpu_relax(); - - stop_ctcmac(ndev); - startup_ctcmac(ndev); - clear_bit_unlock(CTCMAC_RESETTING, &priv->state); -} - -/* ctcmac_reset_task gets scheduled when a packet has not been - * transmitted after a set amount of time. - * For now, assume that clearing out all the structures, and - * starting over will fix the problem. - */ -static void ctcmac_reset_task(struct work_struct *work) -{ - struct ctcmac_private *priv = container_of(work, struct ctcmac_private, - reset_task); - - ctcmac_reset(priv->ndev); -} - -static int ctcmac_rxbd_used_untreated(struct ctcmac_private *priv, int qidx) -{ - u32 count; - - if (qidx) { - count = readl(&priv->cpumac_reg->cpu_mac_desc_mon[2]); - return count & 0xffff; - } - - count = readl(&priv->cpumac_reg->cpu_mac_desc_mon[1]); - - return (count >> 16) & 0xffff; -} - -static int ctcmac_txbd_used_untreated(struct ctcmac_private *priv) -{ - u32 count; - - count = readl(&priv->cpumac_reg->cpu_mac_desc_mon[2]); - - return (count >> 16) & 0xffff; -} - -static bool ctcmac_add_rx_frag(struct ctcmac_rx_buff *rxb, u32 lstatus, - struct sk_buff *skb, bool first) -{ - struct page *page = rxb->page; - unsigned int size = - (lstatus & CPU_MAC_DESC_INTF_W1_DESC_SIZE_MASK) >> 8; - - if (likely(first)) { - skb_put(skb, size); - } else { - skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, - rxb->page_offset, size, CTCMAC_RXB_TRUESIZE); - } - - /* try reuse page */ - if (unlikely(page_count(page) != 1)) - return false; - - /* change offset to the other half */ - rxb->page_offset ^= CTCMAC_RXB_TRUESIZE; - - page_ref_inc(page); - - return true; -} - -static void ctcmac_reuse_rx_page(struct ctcmac_priv_rx_q *rxq, - struct ctcmac_rx_buff *old_rxb) -{ - struct ctcmac_rx_buff *new_rxb; - u16 nta = rxq->next_to_alloc; - - new_rxb = &rxq->rx_buff[nta]; - - /* find next buf that can reuse a page */ - nta++; - rxq->next_to_alloc = (nta < rxq->rx_ring_size) ? nta : 0; - - /* copy page reference */ - *new_rxb = *old_rxb; - - /* sync for use by the device */ - dma_sync_single_range_for_device(rxq->dev, old_rxb->dma, - old_rxb->page_offset, - CTCMAC_RXB_TRUESIZE, DMA_FROM_DEVICE); -} - -static struct sk_buff *ctcmac_get_next_rxbuff(struct ctcmac_priv_rx_q *rx_queue, - u32 lstatus, struct sk_buff *skb) -{ - struct ctcmac_rx_buff *rxb = - &rx_queue->rx_buff[rx_queue->next_to_clean]; - struct page *page = rxb->page; - bool first = false; - - if (likely(!skb)) { - void *buff_addr = page_address(page) + rxb->page_offset; - - skb = build_skb(buff_addr, CTCMAC_SKBFRAG_SIZE); - if (unlikely(!skb)) - return NULL; - first = true; - } - - dma_sync_single_range_for_cpu(rx_queue->dev, rxb->dma, rxb->page_offset, - CTCMAC_RXB_TRUESIZE, DMA_FROM_DEVICE); - - if (ctcmac_add_rx_frag(rxb, lstatus, skb, first)) { - /* reuse the free half of the page */ - ctcmac_reuse_rx_page(rx_queue, rxb); - } else { - /* page cannot be reused, unmap it */ - dma_unmap_page(rx_queue->dev, rxb->dma, - PAGE_SIZE, DMA_FROM_DEVICE); - } - - /* clear rxb content */ - rxb->page = NULL; - - return skb; -} - -static void ctcmac_process_frame(struct net_device *ndev, struct sk_buff *skb) -{ - struct ctcmac_private *priv = netdev_priv(ndev); - - if (test_param[priv->index].rxts_en) { - struct skb_shared_hwtstamps *shhwtstamps = skb_hwtstamps(skb); - u64 *ns = (u64 *)(skb->data + skb->len - 8); - - if (test_param[priv->index].rxts_dump) - pr_err("receive frame time stamp 0x%llx\n", *ns); - - memset(shhwtstamps, 0, sizeof(*shhwtstamps)); - shhwtstamps->hwtstamp = ns_to_ktime(be64_to_cpu(*ns)); - skb_pull(skb, 8); - if (test_param[priv->index].rxts_dump) { - pr_err("receive frame time stamp %lld\n", - shhwtstamps->hwtstamp); - } - } - - skb->protocol = eth_type_trans(skb, ndev); -} - -static int ctc_mac_serdes_init(struct ctcmac_private *priv) -{ - int ret = 0; - u32 status; - int delay_ms = 10; - - /* reset serdes */ - writel(0x83806000, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[0]); - writel(0x28061800, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[2]); - writel(0x0026c03a, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[6]); - writel(0x28061810, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[8]); - writel(0x0026c03a, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[12]); - - /* offset0 bit1 BlkRstN */ - writel(0x83806002, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[0]); - mdelay(delay_ms); - - writel(0x80002309, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x80000842, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x8000ea45, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - - /* serdes 0 init */ - writel(0x83000a05, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x83002008, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x8300640f, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x83000214, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x83008015, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x83000116, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x83001817, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x83003018, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x83000e24, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x83008226, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x83001f27, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x83002028, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x83002829, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x8300302a, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x83002038, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x8300223a, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x8300523b, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x83002040, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x8300f141, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x8300014a, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x8300e693, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - - /* serdes 1 init */ - writel(0x84000a05, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x84002008, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x8400640f, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x84000214, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x84008015, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x84000116, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x84001817, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x84003018, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x84000e24, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x84008226, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x84001f27, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x84002028, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x84002829, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x8400302a, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x84002038, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x8400223a, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x8400523b, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x84002040, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x8400f141, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x8400014a, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - mdelay(delay_ms); - writel(0x8400e693, &priv->cpumacu_reg->cpu_mac_unit_hss_reg_acc_ctl); - - /* serdes post release */ - writel(0x83806003, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[0]); - writel(0x83826003, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[0]); - - writel(0x28061801, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[2]); - writel(0x28061c01, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[2]); - writel(0x28071c01, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[2]); - - writel(0x28061811, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[8]); - writel(0x28061c11, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[8]); - writel(0x28071c11, &priv->cpumacu_reg->cpu_mac_unit_hss_cfg[8]); - - ret = - readl_poll_timeout(&priv->cpumacu_reg->cpu_mac_unit_hss_mon[1], - status, - status & - CPU_MAC_UNIT_HSS_MON_W1_MON_HSS_L0_DFE_RST_DONE, - 1000, 2000000); - if (ret) { - netdev_dbg(priv->ndev, - "%s:wait for hss reset done fail with cpu_mac_unit_hss_mon[1]:0x%x\n", - priv->ndev->name, - readl(&priv->cpumacu_reg->cpu_mac_unit_hss_mon[1])); - } - mdelay(delay_ms); - - return 0; -} - -static void ctcmac_hw_init(struct ctcmac_private *priv) -{ - int i; - u32 val; - int use_extram = 0; - - /* two cpumac access the same cpumac unit register */ - spin_lock_irq(&global_reglock); - if (priv->index == 0) { - clrsetbits(&priv->cpumacu_reg->cpu_mac_unit_reset_ctl, - CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_BASE, - CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_CPU_MAC0); - clrsetbits(&priv->cpumacu_reg->cpu_mac_unit_reset_ctl, - CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_CPU_MAC0, 0); - } else { - clrsetbits(&priv->cpumacu_reg->cpu_mac_unit_reset_ctl, - CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_BASE, - CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_CPU_MAC1); - clrsetbits(&priv->cpumacu_reg->cpu_mac_unit_reset_ctl, - CPU_MAC_UNIT_RESET_CTL_W0_RESET_CORE_CPU_MAC1, 0); - } - - clrsetbits(&priv->cpumacu_reg->cpu_mac_unit_ts_cfg, - 0, CPU_MAC_UNIT_TS_CFG_W0_CFG_FORCE_S_AND_NS_EN); - - spin_unlock_irq(&global_reglock); - mdelay(10); - - clrsetbits(&priv->cpumac_reg->cpu_mac_init, 0, - CPU_MAC_INIT_DONE_W0_INIT_DONE); - udelay(1); - - if (priv->interface == PHY_INTERFACE_MODE_SGMII) { - /* switch to sgmii and enable auto nego */ - val = readl(&priv->cpumac_reg->cpu_mac_sgmii_auto_neg_cfg); - val &= ~(CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_ENABLE_MASK - | CPU_MAC_SGMII_AUTO_NEG_CFG_W0_CFG_AN_MODE_MASK); - val |= (CSA_SGMII_MD_MASK | CSA_EN); - writel(val, &priv->cpumac_reg->cpu_mac_sgmii_auto_neg_cfg); - } - - clrsetbits(&priv->cpumac_reg->cpu_mac_sgmii_cfg[0], - CPU_MAC_SGMII_CFG_W0_CFG_MII_RX_LINK_FILTER_EN, 0); - clrsetbits(&priv->cpumac_reg->cpu_mac_sgmii_cfg[0], - 0, CPU_MAC_SGMII_CFG_W0_CFG_TX_EVEN_IGNORE); - - clrsetbits(&priv->cpumac_reg->cpu_mac_axi_cfg, - 0, CPU_MAC_AXI_CFG_W0_CFG_AXI_RD_D_WORD_SWAP_EN); - clrsetbits(&priv->cpumac_reg->cpu_mac_axi_cfg, - 0, CPU_MAC_AXI_CFG_W0_CFG_AXI_WR_D_WORD_SWAP_EN); - - clrsetbits(&priv->cpumac_reg->cpu_mac_gmac_cfg[0], - 0, CPU_MAC_GMAC_CFG_W0_CFG_RX_OVERRUN_DROP_EN - | CPU_MAC_GMAC_CFG_W0_CFG_RX_OVERSIZE_DROP_EN); - - clrsetbits(&priv->cpumac_reg->cpu_mac_gmac_cfg[2], - CPU_MAC_GMAC_CFG_W2_CFG_TX_STRIP_CRC_EN, 0); - - clrsetbits(&priv->cpumac_reg->cpu_mac_gmac_cfg[2], - 0, CPU_MAC_GMAC_CFG_W2_CFG_TX_CUT_THROUGH_EN); - - for (i = 0; i < priv->num_tx_queues; i++) { - if (priv->tx_queue[i]->tx_ring_size > - CTCMAC_INTERNAL_RING_SIZE) { - use_extram = 1; - break; - } - } - - for (i = 0; i < priv->num_rx_queues; i++) { - if (priv->rx_queue[i]->rx_ring_size > - CTCMAC_INTERNAL_RING_SIZE) { - use_extram = 1; - break; - } - } - - if (use_extram) { - spin_lock_irq(&global_reglock); - regmap_read(regmap_base, - offsetof(struct SysCtl_regs, SysMemCtl), &val); - val |= SYS_MEM_CTL_W0_CFG_RAM_MUX_EN; - regmap_write(regmap_base, - offsetof(struct SysCtl_regs, SysMemCtl), val); - spin_unlock_irq(&global_reglock); - if (priv->index == 0) { - ctcmac_regw(&priv->cpumac_reg->cpu_mac_ext_ram_cfg[1], - CTCMAC0_EXSRAM_BASE); - } else { - ctcmac_regw(&priv->cpumac_reg->cpu_mac_ext_ram_cfg[1], - CTCMAC1_EXSRAM_BASE); - } - ctcmac_regw(&priv->cpumac_reg->cpu_mac_ext_ram_cfg[0], - test_param[priv->index].ring_size); - clrsetbits(&priv->cpumac_reg->cpu_mac_ext_ram_cfg[0], 0, - CPU_MAC_EXT_RAM_CFG_W0_CFG_EXT_RAM_EN); - - } else { - clrsetbits(&priv->cpumac_reg->cpu_mac_ext_ram_cfg[0], - CPU_MAC_EXT_RAM_CFG_W0_CFG_EXT_RAM_EN, 0); - spin_lock_irq(&global_reglock); - regmap_read(regmap_base, - offsetof(struct SysCtl_regs, SysMemCtl), &val); - val &= ~SYS_MEM_CTL_W0_CFG_RAM_MUX_EN; - regmap_write(regmap_base, - offsetof(struct SysCtl_regs, SysMemCtl), val); - spin_unlock_irq(&global_reglock); - } - - if (test_param[priv->index].rxts_en) { - clrsetbits(&priv->cpumac_reg->cpu_mac_gmac_cfg[0], - 0, CPU_MAC_GMAC_CFG_W0_CFG_RX_TS_EN); - } - - if (test_param[priv->index].txts_en) { - clrsetbits(&priv->cpumac_reg->cpu_mac_gmac_cfg[2], - CPU_MAC_GMAC_CFG_W2_CFG_TX_WAIT_CAPTURE_TS, - CPU_MAC_GMAC_CFG_W2_CFG_TX_HDR_INFO_EN); - } - - /* clear all interrupt */ - ctcmac_regw(&priv->cpumac_reg->cpu_mac_interrupt_func[1], 0xffffffff); - ctcmac_regw(&priv->cpumac_reg->cpu_mac_interrupt_normal[1], 0xffffffff); - /* mask all interrupt */ - ctcmac_regw(&priv->cpumac_reg->cpu_mac_interrupt_func[2], 0xffffffff); - ctcmac_regw(&priv->cpumac_reg->cpu_mac_interrupt_normal[2], 0xffffffff); - - pr_err("%s ctcmac_hw_init 0x%x\n", __func__, priv->ndev->flags); -} - -/* update cpumac speed when phy linkup speed changed */ -static noinline void ctcmac_update_link_state(struct ctcmac_private *priv, - struct phy_device *phydev) -{ - int timeout = 2000; - u32 mon, cfg_rep, cfg_smp; - int speed = phydev->speed; - - if (priv->interface != PHY_INTERFACE_MODE_SGMII) - return; - - if (netif_msg_link(priv)) - netdev_dbg(priv->ndev, "link up speed is %d\n", speed); - - if (phydev->link) { - cfg_rep = readl(&priv->cpumac_reg->cpu_mac_sgmii_cfg[0]); - cfg_smp = readl(&priv->cpumac_reg->cpu_mac_sgmii_cfg[1]); - cfg_rep &= ~CSC_REP_MASK; - cfg_smp &= ~CSC_SMP_MASK; - if (speed == 1000) { - cfg_rep |= CSC_1000M; - cfg_smp |= CSC_1000M; - } else if (speed == 100) { - cfg_rep |= CSC_100M; - cfg_smp |= CSC_100M; - } else if (speed == 10) { - cfg_rep |= CSC_10M; - cfg_smp |= CSC_10M; - } else { - return; - } - writel(cfg_rep, &priv->cpumac_reg->cpu_mac_sgmii_cfg[0]); - writel(cfg_smp, &priv->cpumac_reg->cpu_mac_sgmii_cfg[1]); - - while (timeout--) { - mon = readl(&priv->cpumac_reg->cpu_mac_sgmii_mon[0]); - if ((mon & CSM_ANST_MASK) == 6) - break; - - mdelay(1); - } - - if ((mon & CSM_ANST_MASK) != 6) { - pr_err("Error! when phy link up, auto-neg status %d is not right.\n", - mon); - } - if (!priv->oldlink) - priv->oldlink = 1; - - } else { - priv->oldlink = 0; - priv->oldspeed = 0; - priv->oldduplex = -1; - } -} - -static void adjust_link(struct net_device *dev) -{ - struct ctcmac_private *priv = netdev_priv(dev); - struct phy_device *phydev = dev->phydev; - - if (unlikely(phydev->link != priv->oldlink || - (phydev->link && (phydev->duplex != priv->oldduplex || - phydev->speed != priv->oldspeed)))) - ctcmac_update_link_state(priv, phydev); -} - -/* Initializes driver's PHY state, and attaches to the PHY. - * Returns 0 on success. - */ -static int ctcmac_init_phy(struct net_device *dev) -{ - struct ctcmac_private *priv = netdev_priv(dev); - phy_interface_t interface; - struct phy_device *phydev; - - priv->oldlink = 0; - priv->oldspeed = 0; - priv->oldduplex = -1; - - interface = priv->interface; - - phydev = of_phy_connect(dev, priv->phy_node, &adjust_link, 0, - interface); - if (!phydev) { - dev_err(&dev->dev, "could not attach to PHY\n"); - return -ENODEV; - } - - /* Remove any features not supported by the controller */ - phydev->supported = priv->supported; - phydev->advertising = phydev->supported; - - return 0; -} - -static irqreturn_t ctcmac_receive(int irq, struct ctcmac_private *priv) -{ - unsigned long flags; - - if (likely(napi_schedule_prep(&priv->napi_rx))) { - /* disable interrupt */ - spin_lock_irqsave(&priv->reglock, flags); - writel(CTCMAC_NOR_RX0_D | CTCMAC_NOR_RX1_D, - &priv->cpumac_reg->cpu_mac_interrupt_func[2]); - spin_unlock_irqrestore(&priv->reglock, flags); - __napi_schedule(&priv->napi_rx); - } else { - /* clear interrupt */ - writel(CTCMAC_NOR_RX0_D | CTCMAC_NOR_RX1_D, - &priv->cpumac_reg->cpu_mac_interrupt_func[1]); - } - - return IRQ_HANDLED; -} - -static irqreturn_t ctcmac_transmit(int irq, struct ctcmac_private *priv) -{ - unsigned long flags; - - if (likely(napi_schedule_prep(&priv->napi_tx))) { - /* disable interrupt */ - spin_lock_irqsave(&priv->reglock, flags); - writel(CTCMAC_NOR_TX_D, - &priv->cpumac_reg->cpu_mac_interrupt_func[2]); - spin_unlock_irqrestore(&priv->reglock, flags); - __napi_schedule(&priv->napi_tx); - - } else { - /* clear interrupt */ - writel(CTCMAC_NOR_TX_D, - &priv->cpumac_reg->cpu_mac_interrupt_func[1]); - } - - return IRQ_HANDLED; -} - -static irqreturn_t ctcmac_func(int irq, void *data) -{ - u32 event, stat, mask; - struct ctcmac_private *priv = (struct ctcmac_private *)data; - - stat = ctcmac_regr(&priv->cpumac_reg->cpu_mac_interrupt_func[0]); - mask = ctcmac_regr(&priv->cpumac_reg->cpu_mac_interrupt_func[2]); - event = stat & ~mask; - - if ((event & CTCMAC_NOR_RX0_D) || (event & CTCMAC_NOR_RX1_D)) - ctcmac_receive(irq, priv); - - if (event & CTCMAC_NOR_TX_D) - ctcmac_transmit(irq, priv); - - return IRQ_HANDLED; -} - -static irqreturn_t ctcmac_unit(int irq, void *data) -{ - struct cpu_mac_unit_mems *mems = - (struct cpu_mac_unit_mems *)(g_cpumacu_reg + 0x400 - - CPUMACUNIT_REG_BASE); - - ctcmac_regw(&g_cpumacu_reg->cpu_mac_unit_interrupt_func[2], 1); - ctcmac_regw(&g_cpumacu_reg->cpu_mac_unit_interrupt_func[1], 1); - - while (ctcmac_regr(&g_cpumacu_reg->cpu_mac_unit_fifo_status)) { - pr_err("Tx Capture time stamp in fifo 0x%x 0x%x 0x%x\n", - ctcmac_regr(&mems->cpu_mac_unit_tx_capture_ts_0[0]), - ctcmac_regr(&mems->cpu_mac_unit_tx_capture_ts_0[1]), - ctcmac_regr(&mems->cpu_mac_unit_tx_capture_ts_0[2])); - } - ctcmac_regw(&g_cpumacu_reg->cpu_mac_unit_interrupt_func[3], 1); - - return IRQ_HANDLED; -} - -static irqreturn_t ctcmac_normal(int irq, void *grp_id) //TODO by liuht -{ - return IRQ_HANDLED; -} - -static int ctcmac_request_irq(struct ctcmac_private *priv) -{ - int err = 0; - - err = request_irq(priv->irqinfo[CTCMAC_NORMAL].irq, ctcmac_normal, 0, - priv->irqinfo[CTCMAC_NORMAL].name, priv); - if (err < 0) - free_irq(priv->irqinfo[CTCMAC_NORMAL].irq, priv); - enable_irq_wake(priv->irqinfo[CTCMAC_NORMAL].irq); - - err = request_irq(priv->irqinfo[CTCMAC_FUNC].irq, ctcmac_func, 0, - priv->irqinfo[CTCMAC_FUNC].name, priv); - if (err < 0) - free_irq(priv->irqinfo[CTCMAC_FUNC].irq, priv); - enable_irq_wake(priv->irqinfo[CTCMAC_FUNC].irq); - - spin_lock_irq(&global_reglock); - if (priv->irqinfo[CTCMAC_UNIT].irq && !cpumac_unit_irq_installed) { - err = - request_irq(priv->irqinfo[CTCMAC_UNIT].irq, ctcmac_unit, 0, - "cpumac_unit", NULL); - if (err < 0) { - free_irq(priv->irqinfo[CTCMAC_UNIT].irq, NULL); - return err; - } - enable_irq_wake(priv->irqinfo[CTCMAC_UNIT].irq); - cpumac_unit_irq_installed = 1; - } - spin_unlock_irq(&global_reglock); - - return err; -} - -static void ctcmac_free_irq(struct ctcmac_private *priv) -{ - free_irq(priv->irqinfo[CTCMAC_NORMAL].irq, priv); - free_irq(priv->irqinfo[CTCMAC_FUNC].irq, priv); - - spin_lock_irq(&global_reglock); - if (cpumac_unit_irq_installed == 1) { - free_irq(priv->irqinfo[CTCMAC_UNIT].irq, NULL); - cpumac_unit_irq_installed = 0; - } - spin_unlock_irq(&global_reglock); -} - -static bool ctcmac_new_page(struct ctcmac_priv_rx_q *rxq, - struct ctcmac_rx_buff *rxb) -{ - struct page *page; - dma_addr_t addr; - - page = dev_alloc_page(); - if (unlikely(!page)) - return false; - - addr = dma_map_page(rxq->dev, page, 0, PAGE_SIZE, DMA_FROM_DEVICE); - if (unlikely(dma_mapping_error(rxq->dev, addr))) { - __free_page(page); - - return false; - } - - rxb->dma = addr; - rxb->page = page; - rxb->page_offset = 0; - - return true; -} - -static void ctcmac_fill_rxbd(struct ctcmac_private *priv, - struct ctcmac_rx_buff *rxb, int qidx) -{ - u32 desc_cfg_low, desc_cfg_high; - dma_addr_t bufaddr = rxb->dma + rxb->page_offset; - - desc_cfg_low = - (bufaddr - CTC_DDR_BASE) & CPU_MAC_DESC_INTF_W0_DESC_ADDR_31_0_MASK; - /* CPU_MAC_DESC_INTF_W1_DESC_SIZE:bit(8) */ - desc_cfg_high = (test_param[priv->index].payload_size << 8) | - (((bufaddr - - CTC_DDR_BASE) >> 32) & - CPU_MAC_DESC_INTF_W1_DESC_ADDR_39_32_MASK); - - spin_lock_irq(&priv->reglock); - if (qidx) { - ctcmac_regw(&priv->cpumac_mem->cpu_mac_desc_intf_1[0], - desc_cfg_low); - /* barrier */ - smp_mb__before_atomic(); - ctcmac_regw(&priv->cpumac_mem->cpu_mac_desc_intf_1[1], - desc_cfg_high); - - } else { - ctcmac_regw(&priv->cpumac_mem->cpu_mac_desc_intf_0[0], - desc_cfg_low); - /* barrier */ - smp_mb__before_atomic(); - ctcmac_regw(&priv->cpumac_mem->cpu_mac_desc_intf_0[1], - desc_cfg_high); - } - - spin_unlock_irq(&priv->reglock); -} - -static void ctcmac_fill_txbd(struct ctcmac_private *priv, - struct ctcmac_desc_cfg *txdesc) -{ - u32 desc_cfg_low, desc_cfg_high; - - desc_cfg_low = txdesc->addr_low; - /* CPU_MAC_DESC_INTF_W1_DESC_SIZE:bit(8) */ - /* CPU_MAC_DESC_INTF_W1_DESC_SOP:bit(22) */ - /* CPU_MAC_DESC_INTF_W1_DESC_EOP:bit(23) */ - desc_cfg_high = txdesc->addr_high | - (txdesc->size << 8) | (txdesc->sop << 22) | (txdesc->eop << 23); - - spin_lock_irq(&priv->reglock); - ctcmac_regw(&priv->cpumac_mem->cpu_mac_desc_intf_2[0], desc_cfg_low); - /* barrier */ - smp_mb__before_atomic(); - ctcmac_regw(&priv->cpumac_mem->cpu_mac_desc_intf_2[1], desc_cfg_high); - spin_unlock_irq(&priv->reglock); -} - -static void ctcmac_get_txbd(struct ctcmac_private *priv) -{ - u32 lstatus; - - spin_lock_irq(&priv->reglock); - lstatus = ctcmac_regr(&priv->cpumac_mem->cpu_mac_desc_intf_2[0]); - /* barrier */ - smp_mb__before_atomic(); - lstatus = ctcmac_regr(&priv->cpumac_mem->cpu_mac_desc_intf_2[1]); - - spin_unlock_irq(&priv->reglock); -} - -static void ctcmac_get_rxbd(struct ctcmac_private *priv, u32 *lstatus, - int qidx) -{ - spin_lock_irq(&priv->reglock); - if (qidx) { - ctcmac_regr(&priv->cpumac_mem->cpu_mac_desc_intf_1[0]); - *lstatus = - ctcmac_regr(&priv->cpumac_mem->cpu_mac_desc_intf_1[1]); - } else { - ctcmac_regr(&priv->cpumac_mem->cpu_mac_desc_intf_0[0]); - *lstatus = - ctcmac_regr(&priv->cpumac_mem->cpu_mac_desc_intf_0[1]); - } - /* barrier */ - smp_mb__before_atomic(); - - spin_unlock_irq(&priv->reglock); -} - -static void ctcmac_alloc_rx_buffs(struct ctcmac_priv_rx_q *rx_queue, - int alloc_cnt) -{ - int i; - int qidx = rx_queue->qindex; - struct ctcmac_rx_buff *rxb; - struct net_device *ndev = rx_queue->ndev; - struct ctcmac_private *priv = netdev_priv(ndev); - - i = rx_queue->next_to_use; - rxb = &rx_queue->rx_buff[i]; - - while (alloc_cnt--) { - /* try reuse page */ - if (unlikely(!rxb->page)) { - if (unlikely(!ctcmac_new_page(rx_queue, rxb))) - break; - } - - ctcmac_fill_rxbd(priv, rxb, qidx); - rxb++; - - if (unlikely(++i == rx_queue->rx_ring_size)) { - i = 0; - rxb = rx_queue->rx_buff; - } - } - - rx_queue->next_to_use = i; - rx_queue->next_to_alloc = i; -} - -static int ctcmac_clean_rx_ring(struct ctcmac_priv_rx_q *rx_queue, - int rx_work_limit) -{ - struct net_device *ndev = rx_queue->ndev; - struct ctcmac_private *priv = netdev_priv(ndev); - int i, howmany = 0; - struct sk_buff *skb = rx_queue->skb; - int cleaned_cnt = ctcmac_rxbd_unused(rx_queue); - unsigned int total_bytes = 0, total_pkts = 0; - int qidx = rx_queue->qindex; - - /* Get the first full descriptor */ - i = rx_queue->next_to_clean; - - while (rx_work_limit--) { - u32 lstatus; - - if (cleaned_cnt >= test_param[priv->index].ring_size / 2) { - ctcmac_alloc_rx_buffs(rx_queue, cleaned_cnt); - cleaned_cnt = 0; - } - - if (ctcmac_rxbd_used_untreated(priv, qidx) <= 0) - break; - - if (qidx != 0) - pr_err("rx queue %d rx packet!\n", qidx); - ctcmac_get_rxbd(priv, &lstatus, qidx); - - /* fetch next to clean buffer from the ring */ - skb = ctcmac_get_next_rxbuff(rx_queue, lstatus, skb); - if (unlikely(!skb)) - break; - - cleaned_cnt++; - howmany++; - - if (unlikely(++i == rx_queue->rx_ring_size)) - i = 0; - - rx_queue->next_to_clean = i; - - /* fetch next buffer if not the last in frame */ - if (!(lstatus & CPU_MAC_DESC_INTF_W1_DESC_EOP)) - continue; - - if (unlikely(lstatus & CPU_MAC_DESC_INTF_W1_DESC_ERR)) { - if (!test_param[priv->index].rxts_en) { - /* discard faulty buffer */ - dev_kfree_skb(skb); - skb = NULL; - rx_queue->stats.rx_dropped++; - pr_err("%s: Error with rx desc status 0x%x\n", - ndev->name, lstatus); - continue; - } else { - pr_err("%s: Error with rx desc status 0x%x\n", - ndev->name, lstatus); - } - } - - /* Increment the number of packets */ - total_pkts++; - total_bytes += skb->len; - - skb_record_rx_queue(skb, rx_queue->qindex); - ctcmac_process_frame(ndev, skb); - /* Send the packet up the stack */ - napi_gro_receive(&priv->napi_rx, skb); - - skb = NULL; - } - - /* Store incomplete frames for completion */ - rx_queue->skb = skb; - - rx_queue->stats.rx_packets += total_pkts; - rx_queue->stats.rx_bytes += total_bytes; - - if (cleaned_cnt) - ctcmac_alloc_rx_buffs(rx_queue, cleaned_cnt); - - return howmany; -} - -static void ctcmac_clean_tx_ring(struct ctcmac_priv_tx_q *tx_queue) -{ - u16 next_to_clean; - int tqi = tx_queue->qindex; - struct sk_buff *skb; - struct netdev_queue *txq; - struct ctcmac_tx_buff *tx_buff; - struct net_device *dev = tx_queue->dev; - struct ctcmac_private *priv = netdev_priv(dev); - - txq = netdev_get_tx_queue(dev, tqi); - next_to_clean = tx_queue->next_to_clean; - while (ctcmac_txbd_used_untreated(priv)) { - ctcmac_get_txbd(priv); - - tx_buff = &tx_queue->tx_buff[next_to_clean]; - skb = tx_queue->tx_skbuff[next_to_clean]; - dev_kfree_skb_any(skb); - tx_queue->tx_skbuff[next_to_clean] = NULL; - - dma_unmap_single(priv->dev, tx_buff->dma, - tx_buff->len, DMA_TO_DEVICE); - if (tx_buff->alloc) - kfree(tx_buff->vaddr); - - if ((next_to_clean + 1) >= tx_queue->tx_ring_size) - next_to_clean = 0; - else - next_to_clean++; - - spin_lock(&tx_queue->txlock); - tx_queue->num_txbdfree++; - spin_unlock(&tx_queue->txlock); - } - - /* If we freed a buffer, we can restart transmission, if necessary */ - if (tx_queue->num_txbdfree && - netif_tx_queue_stopped(txq) && - !(test_bit(CTCMAC_DOWN, &priv->state))) { - netif_wake_subqueue(priv->ndev, tqi); - } - - tx_queue->next_to_clean = next_to_clean; -} - -static int ctcmac_poll_rx_sq(struct napi_struct *napi, int budget) -{ - int qidx; - int work_done = 0; - int rx_work_limit; - struct ctcmac_private *priv = - container_of(napi, struct ctcmac_private, napi_rx); - struct ctcmac_priv_rx_q *rx_queue = NULL; - - /* clear interrupt */ - writel(CTCMAC_NOR_RX0_D | CTCMAC_NOR_RX1_D, - &priv->cpumac_reg->cpu_mac_interrupt_func[1]); - - rx_work_limit = budget; - for (qidx = priv->num_rx_queues - 1; qidx >= 0; qidx--) { - rx_queue = priv->rx_queue[qidx]; - work_done += ctcmac_clean_rx_ring(rx_queue, rx_work_limit); - rx_work_limit -= work_done; - } - - if (work_done < budget) { - napi_complete(napi); - /* enable interrupt */ - spin_lock_irq(&priv->reglock); - writel(CTCMAC_NOR_RX0_D | CTCMAC_NOR_RX1_D, - &priv->cpumac_reg->cpu_mac_interrupt_func[3]); - spin_unlock_irq(&priv->reglock); - } - - return work_done; -} - -static int ctcmac_poll_tx_sq(struct napi_struct *napi, int budget) -{ - struct ctcmac_private *priv = - container_of(napi, struct ctcmac_private, napi_tx); - struct ctcmac_priv_tx_q *tx_queue = priv->tx_queue[0]; - - /* clear interrupt */ - writel(CTCMAC_NOR_TX_D, &priv->cpumac_reg->cpu_mac_interrupt_func[1]); - - ctcmac_clean_tx_ring(tx_queue); - - napi_complete(napi); - /* enable interrupt */ - spin_lock_irq(&priv->reglock); - writel(CTCMAC_NOR_TX_D, &priv->cpumac_reg->cpu_mac_interrupt_func[3]); - spin_unlock_irq(&priv->reglock); - - return 0; -} - -static void ctcmac_free_rx_resources(struct ctcmac_private *priv) -{ - int i, j; - struct ctcmac_priv_rx_q *rx_queue = NULL; - - for (i = 0; i < priv->num_rx_queues; i++) { - rx_queue = priv->rx_queue[i]; - if (rx_queue->skb) - dev_kfree_skb(rx_queue->skb); - - for (j = 0; j < rx_queue->rx_ring_size; j++) { - struct ctcmac_rx_buff *rxb = &rx_queue->rx_buff[j]; - - if (!rxb->page) - continue; - dma_unmap_single(rx_queue->dev, rxb->dma, - PAGE_SIZE, DMA_TO_DEVICE); - __free_page(rxb->page); - } - kfree(rx_queue->rx_buff); - rx_queue->rx_buff = NULL; - } -} - -static int ctcmac_init_rx_resources(struct net_device *ndev) -{ - int i; - struct ctcmac_private *priv = netdev_priv(ndev); - struct device *dev = priv->dev; - struct ctcmac_priv_rx_q *rx_queue = NULL; - - for (i = 0; i < priv->num_rx_queues; i++) { - rx_queue = priv->rx_queue[i]; - rx_queue->ndev = ndev; - rx_queue->dev = dev; - rx_queue->next_to_clean = 0; - rx_queue->next_to_use = 0; - rx_queue->next_to_alloc = 0; - rx_queue->skb = NULL; - rx_queue->rx_buff = kcalloc(rx_queue->rx_ring_size, - sizeof(*rx_queue->rx_buff), - GFP_KERNEL); - if (!rx_queue->rx_buff) - goto cleanup; - - ctcmac_alloc_rx_buffs(rx_queue, ctcmac_rxbd_unused(rx_queue)); - } - - return 0; - -cleanup: - ctcmac_free_rx_resources(priv); - - return -1; -} - -static void ctcmac_free_tx_resources(struct ctcmac_private *priv) -{ - int i; - struct ctcmac_priv_tx_q *tx_queue = NULL; - - for (i = 0; i < priv->num_tx_queues; i++) { - struct netdev_queue *txq; - - tx_queue = priv->tx_queue[i]; - txq = netdev_get_tx_queue(tx_queue->dev, tx_queue->qindex); - - kfree(tx_queue->tx_skbuff); - tx_queue->tx_skbuff = NULL; - } -} - -static int ctcmac_init_tx_resources(struct net_device *ndev) -{ - int i; - struct ctcmac_private *priv = netdev_priv(ndev); - struct ctcmac_priv_tx_q *tx_queue = NULL; - - for (i = 0; i < priv->num_tx_queues; i++) { - tx_queue = priv->tx_queue[i]; - tx_queue->num_txbdfree = tx_queue->tx_ring_size; - tx_queue->next_to_clean = 0; - tx_queue->next_to_alloc = 0; - tx_queue->dev = ndev; - tx_queue->tx_skbuff = - kmalloc_array(tx_queue->tx_ring_size, - sizeof(*tx_queue->tx_skbuff), GFP_KERNEL); - - if (!tx_queue->tx_skbuff) - goto cleanup; - } - - return 0; - -cleanup: - ctcmac_free_tx_resources(priv); - - return -1; -} - -static int ctcmac_alloc_skb_resources(struct net_device *ndev) -{ - if (ctcmac_init_rx_resources(ndev)) - return -1; - if (ctcmac_init_tx_resources(ndev)) - return -1; - - return 0; -} - -static int ctcmac_free_skb_resources(struct ctcmac_private *priv) -{ - ctcmac_free_rx_resources(priv); - ctcmac_free_tx_resources(priv); - ctcmac_free_tx_queues(priv); - ctcmac_free_rx_queues(priv); - - return 0; -} - -static void cpumac_start(struct ctcmac_private *priv) -{ - /* 1. enable rx/tx interrupt */ - writel(CTCMAC_NOR_TX_D | CTCMAC_NOR_RX0_D | CTCMAC_NOR_RX1_D, - &priv->cpumac_reg->cpu_mac_interrupt_func[3]); - /* 2. enable rx/tx */ - clrsetbits(&priv->cpumac_reg->cpu_mac_reset, - CPU_MAC_RESET_W0_SOFT_RST_TX, - 0); - clrsetbits(&priv->cpumac_reg->cpu_mac_reset, - CPU_MAC_RESET_W0_SOFT_RST_RX, - 0); - - netif_trans_update(priv->ndev); /* prevent tx timeout */ -} - -static void cpumac_halt(struct ctcmac_private *priv) -{ - /* 1. disable rx/tx interrupt */ - ctcmac_regw(&priv->cpumac_reg->cpu_mac_interrupt_func[2], 0xffffffff); - ctcmac_regw(&priv->cpumac_reg->cpu_mac_interrupt_normal[2], 0xffffffff); - /* 2. disable rx/tx */ - clrsetbits(&priv->cpumac_reg->cpu_mac_reset, 0, - CPU_MAC_RESET_W0_SOFT_RST_TX); - clrsetbits(&priv->cpumac_reg->cpu_mac_reset, 0, - CPU_MAC_RESET_W0_SOFT_RST_RX); -} - -static int ctcmac_enet_open(struct net_device *dev) -{ - struct ctcmac_private *priv = netdev_priv(dev); - int err; - - err = ctcmac_init_phy(dev); - if (err) - return err; - err = ctcmac_request_irq(priv); - if (err) - return err; - err = startup_ctcmac(dev); - if (err) - return err; - return 0; -} - -static struct ctcmac_tx_buff *skb_to_txbuff(struct ctcmac_private *priv, - struct sk_buff *skb) -{ - u64 addr, offset; - int frag_index, nr_frags, rq; - skb_frag_t *frag; - struct ctcmac_tx_buff *tx_buff; - struct ctcmac_priv_tx_q *tx_queue = NULL; - - nr_frags = skb_shinfo(skb)->nr_frags; - rq = skb->queue_mapping; - tx_queue = priv->tx_queue[rq]; - - tx_buff = &tx_queue->tx_buff[tx_queue->next_to_alloc]; - addr = (u64)skb->data; - if (!test_param[priv->index].txts_en && !nr_frags && - ((addr & PAGE_MASK) == ((addr + skb_headlen(skb)) & PAGE_MASK))) { - tx_buff->alloc = 0; - tx_buff->vaddr = skb->data; - tx_buff->len = skb_headlen(skb); - tx_buff->dma = - dma_map_single(priv->dev, skb->data, skb_headlen(skb), - DMA_TO_DEVICE); - tx_buff->offset = 0; - - } else { - int alloc_size; - - if (test_param[priv->index].txts_en) { - alloc_size = ALIGN(skb->len + 16, BUF_ALIGNMENT); - tx_buff->len = skb->len + 16; - } else { - alloc_size = ALIGN(skb->len, BUF_ALIGNMENT); - tx_buff->len = skb->len; - } - tx_buff->alloc = 1; - tx_buff->vaddr = kmalloc(alloc_size, GFP_KERNEL); - offset = - (BUF_ALIGNMENT - - (((u64)tx_buff->vaddr) & (BUF_ALIGNMENT - 1))); - if (offset == BUF_ALIGNMENT) - offset = 0; - - tx_buff->offset = offset; - if (test_param[priv->index].txts_en) { - memcpy(tx_buff->vaddr + offset, - &test_param[priv->index].ptp_info, 16); - } - - offset += 16; - memcpy(tx_buff->vaddr + offset, skb->data, skb_headlen(skb)); - offset += skb_headlen(skb); - for (frag_index = 0; frag_index < nr_frags; frag_index++) { - frag = &skb_shinfo(skb)->frags[frag_index]; - memcpy(tx_buff->vaddr + offset, frag, - skb_frag_size(frag)); - offset += skb_frag_size(frag); - } - - tx_buff->dma = - dma_map_single(priv->dev, tx_buff->vaddr, tx_buff->len, - DMA_TO_DEVICE); - } - return tx_buff; -} - -static int ctcmac_start_xmit(struct sk_buff *skb, struct net_device *dev) -{ - int rq = 0; - unsigned int bytes_sent; - struct netdev_queue *txq; - struct ctcmac_desc_cfg tx_desc; - struct ctcmac_tx_buff *tx_buff; - struct ctcmac_priv_tx_q *tx_queue = NULL; - struct ctcmac_private *priv = netdev_priv(dev); - - rq = skb->queue_mapping; - tx_queue = priv->tx_queue[rq]; - txq = netdev_get_tx_queue(dev, rq); - - /* check if there is space to queue this packet */ - if (tx_queue->num_txbdfree <= 0) { - pr_err("%s: no space left before send pkt!\n", - priv->ndev->name); - /* no space, stop the queue */ - netif_tx_stop_queue(txq); - dev->stats.tx_fifo_errors++; - return NETDEV_TX_BUSY; - } - - /* Update transmit stats */ - bytes_sent = skb->len; - tx_queue->stats.tx_bytes += bytes_sent; - tx_queue->stats.tx_packets++; - - tx_buff = skb_to_txbuff(priv, skb); - tx_desc.sop = 1; - tx_desc.eop = 1; - tx_desc.size = tx_buff->len; - tx_desc.addr_low = (tx_buff->dma + tx_buff->offset - CTC_DDR_BASE) - & CPU_MAC_DESC_INTF_W0_DESC_ADDR_31_0_MASK; - tx_desc.addr_high = - ((tx_buff->dma + tx_buff->offset - CTC_DDR_BASE) >> 32) - & CPU_MAC_DESC_INTF_W1_DESC_ADDR_39_32_MASK; - ctcmac_fill_txbd(priv, &tx_desc); - tx_queue->tx_skbuff[tx_queue->next_to_alloc] = skb; - - if (tx_queue->next_to_alloc >= tx_queue->tx_ring_size - 1) - tx_queue->next_to_alloc = 0; - else - tx_queue->next_to_alloc++; - - /* We can work in parallel with 872(), except - * when modifying num_txbdfree. Note that we didn't grab the lock - * when we were reading the num_txbdfree and checking for available - * space, that's because outside of this function it can only grow. - */ - spin_lock_bh(&tx_queue->txlock); - /* reduce TxBD free count */ - tx_queue->num_txbdfree--; - spin_unlock_bh(&tx_queue->txlock); - - /* If the next BD still needs to be cleaned up, then the bds - * are full. We need to tell the kernel to stop sending us stuff. - */ - if (!tx_queue->num_txbdfree) { - netif_tx_stop_queue(txq); - pr_err("%s: no space left after send pkt!\n", priv->ndev->name); - dev->stats.tx_fifo_errors++; - } - - return NETDEV_TX_OK; -} - -static int ctcmac_change_mtu(struct net_device *dev, int new_mtu) -{ - struct ctcmac_private *priv = netdev_priv(dev); - int frame_size = new_mtu + ETH_HLEN; - - if (frame_size < 64 || frame_size > CTCMAC_JUMBO_FRAME_SIZE) - return -EINVAL; - - while (test_and_set_bit_lock(CTCMAC_RESETTING, &priv->state)) - cpu_relax(); - - if (dev->flags & IFF_UP) - stop_ctcmac(dev); - - dev->mtu = new_mtu; - - if (dev->flags & IFF_UP) - startup_ctcmac(dev); - - clear_bit_unlock(CTCMAC_RESETTING, &priv->state); - - return 0; -} - -static int ctcmac_set_features(struct net_device *dev, - netdev_features_t features) -{ - return 0; -} - -/* Stops the kernel queue, and halts the controller */ -static int ctcmac_close(struct net_device *dev) -{ - struct ctcmac_private *priv = netdev_priv(dev); - - cancel_work_sync(&priv->reset_task); - stop_ctcmac(dev); - - /* Disconnect from the PHY */ - phy_disconnect(dev->phydev); - ctcmac_free_irq(priv); - return 0; -} - -static void ctcmac_set_multi(struct net_device *dev) -{ -} - -static void ctcmac_timeout(struct net_device *dev) -{ - struct ctcmac_private *priv = netdev_priv(dev); - - dev->stats.tx_errors++; - schedule_work(&priv->reset_task); -} - -static int ctcmac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) -{ - struct phy_device *phydev = dev->phydev; - - if (!netif_running(dev)) - return -EINVAL; - - if (!phydev) - return -ENODEV; - - return phy_mii_ioctl(phydev, rq, cmd); -} - -static struct net_device_stats *ctcmac_get_stats(struct net_device *dev) -{ - int qidx; - unsigned long rx_packets = 0, rx_bytes = 0, rx_dropped = 0; - unsigned long tx_packets = 0, tx_bytes = 0; - struct ctcmac_private *priv = netdev_priv(dev); - - for (qidx = 0; qidx < priv->num_rx_queues; qidx++) { - if (!priv->rx_queue[qidx]) - return &dev->stats; - rx_packets += priv->rx_queue[qidx]->stats.rx_packets; - rx_bytes += priv->rx_queue[qidx]->stats.rx_bytes; - rx_dropped += priv->rx_queue[qidx]->stats.rx_dropped; - } - - if (!priv->tx_queue[0]) - return &dev->stats; - - tx_packets = priv->tx_queue[0]->stats.tx_packets; - tx_bytes = priv->tx_queue[0]->stats.tx_bytes; - - dev->stats.rx_packets = rx_packets; - dev->stats.rx_bytes = rx_bytes; - dev->stats.rx_dropped = rx_dropped; - dev->stats.tx_bytes = tx_bytes; - dev->stats.tx_packets = tx_packets; - - return &dev->stats; -} - -static int ctcmac_set_mac_addr(struct net_device *dev, void *p) -{ - eth_mac_addr(dev, p); - - return 0; -} - -static const struct net_device_ops ctcmac_netdev_ops = { - .ndo_open = ctcmac_enet_open, - .ndo_start_xmit = ctcmac_start_xmit, - .ndo_stop = ctcmac_close, - .ndo_change_mtu = ctcmac_change_mtu, - .ndo_set_features = ctcmac_set_features, - .ndo_set_rx_mode = ctcmac_set_multi, - .ndo_tx_timeout = ctcmac_timeout, - .ndo_do_ioctl = ctcmac_ioctl, - .ndo_get_stats = ctcmac_get_stats, - .ndo_set_mac_address = ctcmac_set_mac_addr, - .ndo_validate_addr = eth_validate_addr, -}; - -static int ctcmac_probe(struct platform_device *ofdev) -{ - struct net_device *dev = NULL; - struct ctcmac_private *priv = NULL; - int err = 0; - - regmap_base = - syscon_regmap_lookup_by_phandle(ofdev->dev.of_node, "ctc,sysctrl"); - if (IS_ERR(regmap_base)) - return PTR_ERR(regmap_base); - - err = ctcmac_of_init(ofdev, &dev); - if (err) - return err; - - priv = netdev_priv(dev); - SET_NETDEV_DEV(dev, &ofdev->dev); - INIT_WORK(&priv->reset_task, ctcmac_reset_task); - platform_set_drvdata(ofdev, priv); - - dev->base_addr = (unsigned long)priv->iobase; - dev->watchdog_timeo = TX_TIMEOUT; - dev->mtu = CTCMAC_DEFAULT_MTU; - dev->netdev_ops = &ctcmac_netdev_ops; - dev->ethtool_ops = &ctcmac_ethtool_test_ops; - - netif_napi_add(dev, &priv->napi_rx, ctcmac_poll_rx_sq, - CTCMAC_NAIP_RX_WEIGHT); - netif_napi_add(dev, &priv->napi_tx, ctcmac_poll_tx_sq, - CTCMAC_NAIP_TX_WEIGHT); - - set_bit(CTCMAC_DOWN, &priv->state); - - if (!g_reglock_init_done) - spin_lock_init(&global_reglock); - - g_reglock_init_done = 1; - - spin_lock_init(&priv->reglock); - /* Carrier starts down, phylib will bring it up */ - netif_carrier_off(dev); - err = register_netdev(dev); - if (err) - goto register_fail; - - if (!g_mac_unit_init_done) { - writel(0x07, &priv->cpumacu_reg->cpu_mac_unit_reset_ctl); - writel(0x00, &priv->cpumacu_reg->cpu_mac_unit_reset_ctl); - - clrsetbits(&priv->cpumacu_reg->cpu_mac_unit_ts_cfg, - 0, CPU_MAC_UNIT_TS_CFG_W0_CFG_FORCE_S_AND_NS_EN); - if (priv->interface == PHY_INTERFACE_MODE_SGMII) { - clrsetbits(&priv->cpumacu_reg->cpu_mac_unit_ref_pulse_cfg[1], - CPU_MAC_UNIT_REF_PULSE_CFG_W1_REF_LINK_PULSE_RST, - 0); - - ctc_mac_serdes_init(priv); - } - g_mac_unit_init_done = 1; - } - - mdelay(10); - - sprintf(priv->irqinfo[CTCMAC_NORMAL].name, "%s%s", - dev->name, "_normal"); - sprintf(priv->irqinfo[CTCMAC_FUNC].name, "%s%s", dev->name, "_func"); - sprintf(priv->irqinfo[CTCMAC_UNIT].name, "%s%s", dev->name, "_unit"); - test_param[priv->index].ring_size = 64; - test_param[priv->index].payload_size = 256; - - return 0; - -register_fail: - ctcmac_unmap_io_space(priv); - ctcmac_free_rx_queues(priv); - ctcmac_free_tx_queues(priv); - of_node_put(priv->phy_node); - ctcmac_free_dev(priv); - - return err; -} - -static int ctcmac_remove(struct platform_device *ofdev) -{ - struct ctcmac_private *priv = platform_get_drvdata(ofdev); - - of_node_put(priv->phy_node); - - unregister_netdev(priv->ndev); - - ctcmac_unmap_io_space(priv); - ctcmac_free_rx_queues(priv); - ctcmac_free_tx_queues(priv); - ctcmac_free_dev(priv); - - return 0; -} - -static const struct of_device_id ctcmac_match[] = { - { - .type = "network", - .compatible = "ctc,mac-test", - }, - {}, -}; - -MODULE_DEVICE_TABLE(of, ctcmac_match); - -/* Structure for a device driver */ -static struct platform_driver ctcmac_driver = { - .driver = { - .name = "ctc-cpumac-test", - .of_match_table = ctcmac_match, - }, - .probe = ctcmac_probe, - .remove = ctcmac_remove, -}; - -module_platform_driver(ctcmac_driver); -MODULE_LICENSE("GPL"); diff --git a/platform/centec-arm64/tsingma-bsp/src/ehci-ctc/ehci-ctc.c b/platform/centec-arm64/tsingma-bsp/src/ehci-ctc/ehci-ctc.c old mode 100644 new mode 100755 index 458ef18dc3ff..f66f1a39a489 --- a/platform/centec-arm64/tsingma-bsp/src/ehci-ctc/ehci-ctc.c +++ b/platform/centec-arm64/tsingma-bsp/src/ehci-ctc/ehci-ctc.c @@ -14,13 +14,18 @@ #include #include #include -#include #include #include +#include +#include #include #include #include +#include +#include "../include/sysctl.h" +#include +#include #include "ehci.h" #define DRIVER_DESC "Centec EHCI platform driver" @@ -28,12 +33,15 @@ #define EHCI_MAX_RSTS 4 #define hcd_to_ehci_priv(h) ((struct ehci_ctc_priv *)hcd_to_ehci(h)->priv) +static struct regmap *regmap_base; + struct ehci_ctc_priv { struct clk *clks[EHCI_MAX_CLKS]; - struct reset_control *rsts[EHCI_MAX_RSTS]; - struct phy **phys; - int num_phys; + struct reset_control *rsts; bool reset_on_resume; + bool quirk_poll; + struct timer_list poll_timer; + struct delayed_work poll_work; }; static const char hcd_name[] = "ehci-ctc"; @@ -67,7 +75,7 @@ static int ehci_ctc_power_on(struct platform_device *dev) { struct usb_hcd *hcd = platform_get_drvdata(dev); struct ehci_ctc_priv *priv = hcd_to_ehci_priv(hcd); - int clk, ret, phy_num; + int clk, ret; for (clk = 0; clk < EHCI_MAX_CLKS && priv->clks[clk]; clk++) { ret = clk_prepare_enable(priv->clks[clk]); @@ -75,24 +83,8 @@ static int ehci_ctc_power_on(struct platform_device *dev) goto err_disable_clks; } - for (phy_num = 0; phy_num < priv->num_phys; phy_num++) { - ret = phy_init(priv->phys[phy_num]); - if (ret) - goto err_exit_phy; - ret = phy_power_on(priv->phys[phy_num]); - if (ret) { - phy_exit(priv->phys[phy_num]); - goto err_exit_phy; - } - } - return 0; -err_exit_phy: - while (--phy_num >= 0) { - phy_power_off(priv->phys[phy_num]); - phy_exit(priv->phys[phy_num]); - } err_disable_clks: while (--clk >= 0) clk_disable_unprepare(priv->clks[clk]); @@ -104,12 +96,7 @@ static void ehci_ctc_power_off(struct platform_device *dev) { struct usb_hcd *hcd = platform_get_drvdata(dev); struct ehci_ctc_priv *priv = hcd_to_ehci_priv(hcd); - int clk, phy_num; - - for (phy_num = 0; phy_num < priv->num_phys; phy_num++) { - phy_power_off(priv->phys[phy_num]); - phy_exit(priv->phys[phy_num]); - } + int clk; for (clk = EHCI_MAX_CLKS - 1; clk >= 0; clk--) if (priv->clks[clk]) @@ -124,22 +111,146 @@ static const struct ehci_driver_overrides platform_overrides __initconst = { }; static struct usb_ehci_pdata ehci_ctc_defaults = { - .caps_offset = 0x100, - .dma_mask_64 = 1, .power_on = ehci_ctc_power_on, .power_suspend = ehci_ctc_power_off, .power_off = ehci_ctc_power_off, }; #define KERN_CTC KERN_ERR +static bool quirk_poll_check_port_status(struct ehci_hcd *ehci) +{ + u32 port_status = ehci_readl(ehci, &ehci->regs->port_status[0]); + + if (!(port_status & PORT_OWNER) && + (port_status & PORT_POWER) && + !(port_status & PORT_CONNECT) && (port_status & PORT_LS_MASK)) + return true; + + return false; +} + +/** + * quirk_poll_rebind_companion - rebind comanion device to recover + * @ehci: the ehci hcd pointer + * + * Since EHCI/OHCI controllers on R-Car Gen3 SoCs are possible to be getting + * stuck very rarely after a full/low usb device was disconnected. To + * recover from such a situation, the controllers require changing the OHCI + * functional state. + */ +static void quirk_poll_rebind_companion(struct ehci_hcd *ehci) +{ + struct device *companion_dev; + struct usb_hcd *hcd = ehci_to_hcd(ehci); + + companion_dev = usb_of_get_companion_dev(hcd->self.controller); + if (!companion_dev) + return; + + device_release_driver(companion_dev); + if (device_attach(companion_dev) < 0) + ehci_err(ehci, "%s: failed\n", __func__); + + put_device(companion_dev); +} + +static void quirk_poll_work(struct work_struct *work) +{ + struct ehci_ctc_priv *priv = + container_of(to_delayed_work(work), struct ehci_ctc_priv, + poll_work); + struct ehci_hcd *ehci = container_of((void *)priv, struct ehci_hcd, + priv); + + /* check the status twice to reduce misdetection rate */ + if (!quirk_poll_check_port_status(ehci)) + return; + udelay(10); + if (!quirk_poll_check_port_status(ehci)) + return; + + ehci_dbg(ehci, "%s: detected getting stuck. rebind now!\n", __func__); + quirk_poll_rebind_companion(ehci); +} + +static void quirk_poll_timer(struct timer_list *t) +{ + struct ehci_ctc_priv *priv = from_timer(priv, t, poll_timer); + struct ehci_hcd *ehci = container_of((void *)priv, struct ehci_hcd, + priv); + + if (quirk_poll_check_port_status(ehci)) { + /* + * Now scheduling the work for testing the port more. Note that + * updating the status is possible to be delayed when + * reconnection. So, this uses delayed work with 5 ms delay + * to avoid misdetection. + */ + schedule_delayed_work(&priv->poll_work, msecs_to_jiffies(5)); + } + + mod_timer(&priv->poll_timer, jiffies + HZ); +} + +static void quirk_poll_init(struct ehci_ctc_priv *priv) +{ + INIT_DELAYED_WORK(&priv->poll_work, quirk_poll_work); + timer_setup(&priv->poll_timer, quirk_poll_timer, 0); + mod_timer(&priv->poll_timer, jiffies + HZ); +} + +static void quirk_poll_end(struct ehci_ctc_priv *priv) +{ + del_timer_sync(&priv->poll_timer); + cancel_delayed_work(&priv->poll_work); +} + +static const struct soc_device_attribute quirk_poll_match[] = { + {.family = "R-Car Gen3"}, + { /* sentinel */ } +}; + static int ehci_ctc_probe(struct platform_device *dev) { + u32 val; struct usb_hcd *hcd; struct resource *res_mem; struct usb_ehci_pdata *pdata = dev_get_platdata(&dev->dev); struct ehci_ctc_priv *priv; struct ehci_hcd *ehci; - int err, irq, phy_num, clk = 0, rst; + int err, irq, clk = 0; + + regmap_base = + syscon_regmap_lookup_by_phandle(dev->dev.of_node, "ctc,sysctrl"); + if (IS_ERR(regmap_base)) + return PTR_ERR(regmap_base); + + /* USB interface reset config */ + val = 0x7f; + regmap_write(regmap_base, offsetof(struct SysCtl_regs, SysUsbResetCtl), + val); + udelay(1); + val &= ~SYS_USB_RESET_CTL_W0_CFG_USB_PHY_PWR_ON_RESET; + regmap_write(regmap_base, offsetof(struct SysCtl_regs, SysUsbResetCtl), + val); + udelay(1); + val &= + ~(SYS_USB_RESET_CTL_W0_CFG_USB_PHY_RESET | + SYS_USB_RESET_CTL_W0_CFG_USB_PHY_PORT_RESET | + SYS_USB_RESET_CTL_W0_CFG_USB_UTMI_RESET); + regmap_write(regmap_base, offsetof(struct SysCtl_regs, SysUsbResetCtl), + val); + udelay(1); + val &= + ~(SYS_USB_RESET_CTL_W0_CFG_USB_INTF_RESET | + SYS_USB_RESET_CTL_W0_CFG_USB_AUX_RESET); + regmap_write(regmap_base, offsetof(struct SysCtl_regs, SysUsbResetCtl), + val); + udelay(1); + val &= ~SYS_USB_RESET_CTL_W0_CFG_USB_PHY_ATE_RESET; + regmap_write(regmap_base, offsetof(struct SysCtl_regs, SysUsbResetCtl), + val); + mdelay(500); if (usb_disabled()) return -ENODEV; @@ -152,18 +263,17 @@ static int ehci_ctc_probe(struct platform_device *dev) pdata = &ehci_ctc_defaults; err = dma_coerce_mask_and_coherent(&dev->dev, - pdata->dma_mask_64 ? - DMA_BIT_MASK(64) : DMA_BIT_MASK(32)); + pdata-> + dma_mask_64 ? DMA_BIT_MASK(64) : + DMA_BIT_MASK(32)); if (err) { dev_err(&dev->dev, "Error: DMA mask configuration failed\n"); return err; } irq = platform_get_irq(dev, 0); - if (irq < 0) { - dev_err(&dev->dev, "no irq provided"); + if (irq < 0) return irq; - } hcd = usb_create_hcd(&ehci_ctc_hc_driver, &dev->dev, dev_name(&dev->dev)); @@ -174,6 +284,7 @@ static int ehci_ctc_probe(struct platform_device *dev) dev->dev.platform_data = pdata; priv = hcd_to_ehci_priv(hcd); ehci = hcd_to_ehci(hcd); + if (pdata == &ehci_ctc_defaults && dev->dev.of_node) { if (of_property_read_bool(dev->dev.of_node, "big-endian-regs")) ehci->big_endian_mmio = 1; @@ -192,28 +303,8 @@ static int ehci_ctc_probe(struct platform_device *dev) "has-transaction-translator")) hcd->has_tt = 1; - priv->num_phys = of_count_phandle_with_args(dev->dev.of_node, - "phys", - "#phy-cells"); - - if (priv->num_phys > 0) { - priv->phys = devm_kcalloc(&dev->dev, priv->num_phys, - sizeof(struct phy *), - GFP_KERNEL); - if (!priv->phys) - return -ENOMEM; - } else - priv->num_phys = 0; - - for (phy_num = 0; phy_num < priv->num_phys; phy_num++) { - priv->phys[phy_num] = - devm_of_phy_get_by_index(&dev->dev, - dev->dev.of_node, phy_num); - if (IS_ERR(priv->phys[phy_num])) { - err = PTR_ERR(priv->phys[phy_num]); - goto err_put_hcd; - } - } + if (soc_device_match(quirk_poll_match)) + priv->quirk_poll = true; for (clk = 0; clk < EHCI_MAX_CLKS; clk++) { priv->clks[clk] = of_clk_get(dev->dev.of_node, clk); @@ -226,21 +317,17 @@ static int ehci_ctc_probe(struct platform_device *dev) } } } - for (rst = 0; rst < EHCI_MAX_RSTS; rst++) { - priv->rsts[rst] = - devm_reset_control_get_shared_by_index(&dev->dev, rst); - if (IS_ERR(priv->rsts[rst])) { - err = PTR_ERR(priv->rsts[rst]); - if (err == -EPROBE_DEFER) - goto err_reset; - priv->rsts[rst] = NULL; - break; - } - err = reset_control_deassert(priv->rsts[rst]); - if (err) - goto err_reset; + priv->rsts = devm_reset_control_array_get_optional_shared(&dev->dev); + if (IS_ERR(priv->rsts)) { + err = PTR_ERR(priv->rsts); + goto err_put_clks; } + + err = reset_control_deassert(priv->rsts); + if (err) + goto err_put_clks; + if (pdata->big_endian_desc) ehci->big_endian_desc = 1; if (pdata->big_endian_mmio) @@ -272,6 +359,7 @@ static int ehci_ctc_probe(struct platform_device *dev) if (err < 0) goto err_reset; } + res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); hcd->regs = devm_ioremap_resource(&dev->dev, res_mem); if (IS_ERR(hcd->regs)) { @@ -280,23 +368,29 @@ static int ehci_ctc_probe(struct platform_device *dev) } hcd->rsrc_start = res_mem->start; hcd->rsrc_len = resource_size(res_mem); + err = usb_add_hcd(hcd, irq, IRQF_SHARED); if (err) goto err_power; + device_wakeup_enable(hcd->self.controller); + device_enable_async_suspend(hcd->self.controller); platform_set_drvdata(dev, hcd); + + if (priv->quirk_poll) + quirk_poll_init(priv); + return err; err_power: if (pdata->power_off) pdata->power_off(dev); err_reset: - while (--rst >= 0) - reset_control_assert(priv->rsts[rst]); + reset_control_assert(priv->rsts); err_put_clks: while (--clk >= 0) clk_put(priv->clks[clk]); -err_put_hcd: + if (pdata == &ehci_ctc_defaults) dev->dev.platform_data = NULL; @@ -310,15 +404,17 @@ static int ehci_ctc_remove(struct platform_device *dev) struct usb_hcd *hcd = platform_get_drvdata(dev); struct usb_ehci_pdata *pdata = dev_get_platdata(&dev->dev); struct ehci_ctc_priv *priv = hcd_to_ehci_priv(hcd); - int clk, rst; + int clk; + + if (priv->quirk_poll) + quirk_poll_end(priv); usb_remove_hcd(hcd); if (pdata->power_off) pdata->power_off(dev); - for (rst = 0; rst < EHCI_MAX_RSTS && priv->rsts[rst]; rst++) - reset_control_assert(priv->rsts[rst]); + reset_control_assert(priv->rsts); for (clk = 0; clk < EHCI_MAX_CLKS && priv->clks[clk]; clk++) clk_put(priv->clks[clk]); @@ -337,9 +433,13 @@ static int ehci_ctc_suspend(struct device *dev) struct usb_hcd *hcd = dev_get_drvdata(dev); struct usb_ehci_pdata *pdata = dev_get_platdata(dev); struct platform_device *pdev = to_platform_device(dev); + struct ehci_ctc_priv *priv = hcd_to_ehci_priv(hcd); bool do_wakeup = device_may_wakeup(dev); int ret; + if (priv->quirk_poll) + quirk_poll_end(priv); + ret = ehci_suspend(hcd, do_wakeup); if (ret) return ret; @@ -356,15 +456,25 @@ static int ehci_ctc_resume(struct device *dev) struct usb_ehci_pdata *pdata = dev_get_platdata(dev); struct platform_device *pdev = to_platform_device(dev); struct ehci_ctc_priv *priv = hcd_to_ehci_priv(hcd); + struct device *companion_dev; if (pdata->power_on) { int err = pdata->power_on(pdev); - if (err < 0) return err; } + companion_dev = usb_of_get_companion_dev(hcd->self.controller); + if (companion_dev) { + device_pm_wait_for_dev(hcd->self.controller, companion_dev); + put_device(companion_dev); + } + ehci_resume(hcd, priv->reset_on_resume); + + if (priv->quirk_poll) + quirk_poll_init(priv); + return 0; } #endif /* CONFIG_PM_SLEEP */ @@ -394,7 +504,7 @@ static struct platform_driver ehci_ctc_driver = { .name = "ehci-ctc", .pm = &ehci_ctc_pm_ops, .of_match_table = ctc_ehci_ids, - } + } }; static int __init ehci_ctc_init(void) diff --git a/platform/centec-arm64/tsingma-bsp/src/ehci-ctc/ehci.h b/platform/centec-arm64/tsingma-bsp/src/ehci-ctc/ehci.h index c8e9a48e1d51..accc08b4ab81 100644 --- a/platform/centec-arm64/tsingma-bsp/src/ehci-ctc/ehci.h +++ b/platform/centec-arm64/tsingma-bsp/src/ehci-ctc/ehci.h @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0+ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (c) 2001-2002 by David Brownell */ @@ -31,14 +31,14 @@ typedef __u16 __bitwise __hc16; struct ehci_stats { /* irq usage */ - unsigned long normal; - unsigned long error; - unsigned long iaa; - unsigned long lost_iaa; + unsigned long normal; + unsigned long error; + unsigned long iaa; + unsigned long lost_iaa; /* termination of urbs from core */ - unsigned long complete; - unsigned long unlink; + unsigned long complete; + unsigned long unlink; }; /* @@ -46,22 +46,22 @@ struct ehci_stats { * high-speed devices and full/low-speed devices lying behind a TT. */ struct ehci_per_sched { - struct usb_device *udev; /* access to the TT */ + struct usb_device *udev; /* access to the TT */ struct usb_host_endpoint *ep; - struct list_head ps_list; /* node on ehci_tt's ps_list */ - u16 tt_usecs; /* time on the FS/LS bus */ - u16 cs_mask; /* C-mask and S-mask bytes */ - u16 period; /* actual period in frames */ - u16 phase; /* actual phase, frame part */ - u8 bw_phase; /* same, for bandwidth - reservation */ - u8 phase_uf; /* uframe part of the phase */ - u8 usecs, c_usecs; /* times on the HS bus */ - u8 bw_uperiod; /* period in microframes, for - bandwidth reservation */ - u8 bw_period; /* same, in frames */ + struct list_head ps_list; /* node on ehci_tt's ps_list */ + u16 tt_usecs; /* time on the FS/LS bus */ + u16 cs_mask; /* C-mask and S-mask bytes */ + u16 period; /* actual period in frames */ + u16 phase; /* actual phase, frame part */ + u8 bw_phase; /* same, for bandwidth + reservation */ + u8 phase_uf; /* uframe part of the phase */ + u8 usecs, c_usecs; /* times on the HS bus */ + u8 bw_uperiod; /* period in microframes, for + bandwidth reservation */ + u8 bw_period; /* same, in frames */ }; -#define NO_FRAME 29999 /* frame not assigned yet */ +#define NO_FRAME 29999 /* frame not assigned yet */ /* ehci_hcd->lock guards shared data against other CPUs: * ehci_hcd: async, unlink, periodic (and shadow), ... @@ -73,7 +73,7 @@ struct ehci_per_sched { * when updating hw_* fields in shared qh/qtd/... structures. */ -#define EHCI_MAX_ROOT_PORTS 15 /* see HCS_N_PORTS */ +#define EHCI_MAX_ROOT_PORTS 15 /* see HCS_N_PORTS */ /* * ehci_rh_state values of EHCI_RH_RUNNING or above mean that the @@ -92,180 +92,180 @@ enum ehci_rh_state { * ehci-timer.c) in parallel with this list. */ enum ehci_hrtimer_event { - EHCI_HRTIMER_POLL_ASS, /* Poll for async schedule off */ - EHCI_HRTIMER_POLL_PSS, /* Poll for periodic schedule off */ - EHCI_HRTIMER_POLL_DEAD, /* Wait for dead controller to stop */ + EHCI_HRTIMER_POLL_ASS, /* Poll for async schedule off */ + EHCI_HRTIMER_POLL_PSS, /* Poll for periodic schedule off */ + EHCI_HRTIMER_POLL_DEAD, /* Wait for dead controller to stop */ EHCI_HRTIMER_UNLINK_INTR, /* Wait for interrupt QH unlink */ - EHCI_HRTIMER_FREE_ITDS, /* Wait for unused iTDs and siTDs */ + EHCI_HRTIMER_FREE_ITDS, /* Wait for unused iTDs and siTDs */ EHCI_HRTIMER_ACTIVE_UNLINK, /* Wait while unlinking an active QH */ - EHCI_HRTIMER_START_UNLINK_INTR, /* Unlink empty interrupt QHs */ + EHCI_HRTIMER_START_UNLINK_INTR, /* Unlink empty interrupt QHs */ EHCI_HRTIMER_ASYNC_UNLINKS, /* Unlink empty async QHs */ EHCI_HRTIMER_IAA_WATCHDOG, /* Handle lost IAA interrupts */ EHCI_HRTIMER_DISABLE_PERIODIC, /* Wait to disable periodic sched */ EHCI_HRTIMER_DISABLE_ASYNC, /* Wait to disable async sched */ EHCI_HRTIMER_IO_WATCHDOG, /* Check for missing IRQs */ - EHCI_HRTIMER_NUM_EVENTS /* Must come last */ + EHCI_HRTIMER_NUM_EVENTS /* Must come last */ }; #define EHCI_HRTIMER_NO_EVENT 99 -struct ehci_hcd { /* one per controller */ +struct ehci_hcd { /* one per controller */ /* timing support */ - enum ehci_hrtimer_event next_hrtimer_event; - unsigned enabled_hrtimer_events; - ktime_t hr_timeouts[EHCI_HRTIMER_NUM_EVENTS]; - struct hrtimer hrtimer; + enum ehci_hrtimer_event next_hrtimer_event; + unsigned enabled_hrtimer_events; + ktime_t hr_timeouts[EHCI_HRTIMER_NUM_EVENTS]; + struct hrtimer hrtimer; - int PSS_poll_count; - int ASS_poll_count; - int died_poll_count; + int PSS_poll_count; + int ASS_poll_count; + int died_poll_count; /* glue to PCI and HCD framework */ struct ehci_caps __iomem *caps; struct ehci_regs __iomem *regs; struct ehci_dbg_port __iomem *debug; - __u32 hcs_params; /* cached register copy */ - spinlock_t lock; - enum ehci_rh_state rh_state; + __u32 hcs_params; /* cached register copy */ + spinlock_t lock; + enum ehci_rh_state rh_state; /* general schedule support */ - bool scanning:1; - bool need_rescan:1; - bool intr_unlinking:1; - bool iaa_in_progress:1; - bool async_unlinking:1; - bool shutdown:1; - struct ehci_qh *qh_scan_next; + bool scanning:1; + bool need_rescan:1; + bool intr_unlinking:1; + bool iaa_in_progress:1; + bool async_unlinking:1; + bool shutdown:1; + struct ehci_qh *qh_scan_next; /* async schedule support */ - struct ehci_qh *async; - struct ehci_qh *dummy; /* For AMD quirk use */ - struct list_head async_unlink; - struct list_head async_idle; - unsigned async_unlink_cycle; - unsigned async_count; /* async activity count */ - __hc32 old_current; /* Test for QH becoming */ - __hc32 old_token; /* inactive during unlink */ + struct ehci_qh *async; + struct ehci_qh *dummy; /* For AMD quirk use */ + struct list_head async_unlink; + struct list_head async_idle; + unsigned async_unlink_cycle; + unsigned async_count; /* async activity count */ + __hc32 old_current; /* Test for QH becoming */ + __hc32 old_token; /* inactive during unlink */ /* periodic schedule support */ -#define DEFAULT_I_TDPS 1024 /* some HCs can do less */ - unsigned periodic_size; - __hc32 *periodic; /* hw periodic table */ - dma_addr_t periodic_dma; - struct list_head intr_qh_list; - unsigned i_thresh; /* uframes HC might cache */ - - union ehci_shadow *pshadow; /* mirror hw periodic table */ - struct list_head intr_unlink_wait; - struct list_head intr_unlink; - unsigned intr_unlink_wait_cycle; - unsigned intr_unlink_cycle; - unsigned now_frame; /* frame from HC hardware */ - unsigned last_iso_frame; /* last frame scanned for iso */ - unsigned intr_count; /* intr activity count */ - unsigned isoc_count; /* isoc activity count */ - unsigned periodic_count; /* periodic activity count */ - unsigned uframe_periodic_max; /* max periodic time per uframe */ - +#define DEFAULT_I_TDPS 1024 /* some HCs can do less */ + unsigned periodic_size; + __hc32 *periodic; /* hw periodic table */ + dma_addr_t periodic_dma; + struct list_head intr_qh_list; + unsigned i_thresh; /* uframes HC might cache */ + + union ehci_shadow *pshadow; /* mirror hw periodic table */ + struct list_head intr_unlink_wait; + struct list_head intr_unlink; + unsigned intr_unlink_wait_cycle; + unsigned intr_unlink_cycle; + unsigned now_frame; /* frame from HC hardware */ + unsigned last_iso_frame; /* last frame scanned for iso */ + unsigned intr_count; /* intr activity count */ + unsigned isoc_count; /* isoc activity count */ + unsigned periodic_count; /* periodic activity count */ + unsigned uframe_periodic_max; /* max periodic time per uframe */ /* list of itds & sitds completed while now_frame was still active */ - struct list_head cached_itd_list; - struct ehci_itd *last_itd_to_free; - struct list_head cached_sitd_list; - struct ehci_sitd *last_sitd_to_free; + struct list_head cached_itd_list; + struct ehci_itd *last_itd_to_free; + struct list_head cached_sitd_list; + struct ehci_sitd *last_sitd_to_free; /* per root hub port */ - unsigned long reset_done[EHCI_MAX_ROOT_PORTS]; + unsigned long reset_done[EHCI_MAX_ROOT_PORTS]; /* bit vectors (one bit per port) */ - unsigned long bus_suspended; /* which ports were - already suspended at the start of a bus suspend */ - unsigned long companion_ports; /* which ports are - dedicated to the companion controller */ - unsigned long owned_ports; /* which ports are - owned by the companion during a bus suspend */ - unsigned long port_c_suspend; /* which ports have - the change-suspend feature turned on */ - unsigned long suspended_ports; /* which ports are - suspended */ - unsigned long resuming_ports; /* which ports have - started to resume */ + unsigned long bus_suspended; /* which ports were + already suspended at the start of a bus suspend */ + unsigned long companion_ports; /* which ports are + dedicated to the companion controller */ + unsigned long owned_ports; /* which ports are + owned by the companion during a bus suspend */ + unsigned long port_c_suspend; /* which ports have + the change-suspend feature turned on */ + unsigned long suspended_ports; /* which ports are + suspended */ + unsigned long resuming_ports; /* which ports have + started to resume */ /* per-HC memory pools (could be per-bus, but ...) */ - struct dma_pool *qh_pool; /* qh per active urb */ - struct dma_pool *qtd_pool; /* one or more per qh */ - struct dma_pool *itd_pool; /* itd per iso urb */ - struct dma_pool *sitd_pool; /* sitd per split iso urb */ + struct dma_pool *qh_pool; /* qh per active urb */ + struct dma_pool *qtd_pool; /* one or more per qh */ + struct dma_pool *itd_pool; /* itd per iso urb */ + struct dma_pool *sitd_pool; /* sitd per split iso urb */ - unsigned random_frame; - unsigned long next_statechange; - ktime_t last_periodic_enable; - u32 command; + unsigned random_frame; + unsigned long next_statechange; + ktime_t last_periodic_enable; + u32 command; /* SILICON QUIRKS */ - unsigned no_selective_suspend:1; - unsigned has_fsl_port_bug:1; /* FreeScale */ - unsigned has_fsl_hs_errata:1; /* Freescale HS quirk */ - unsigned has_fsl_susp_errata:1; /* NXP SUSP quirk */ - unsigned big_endian_mmio:1; - unsigned big_endian_desc:1; - unsigned big_endian_capbase:1; - unsigned has_amcc_usb23:1; - unsigned need_io_watchdog:1; - unsigned amd_pll_fix:1; - unsigned use_dummy_qh:1; /* AMD Frame List table quirk*/ - unsigned has_synopsys_hc_bug:1; /* Synopsys HC */ - unsigned frame_index_bug:1; /* MosChip (AKA NetMos) */ - unsigned need_oc_pp_cycle:1; /* MPC834X port power */ - unsigned imx28_write_fix:1; /* For Freescale i.MX28 */ + unsigned no_selective_suspend:1; + unsigned has_fsl_port_bug:1; /* FreeScale */ + unsigned has_fsl_hs_errata:1; /* Freescale HS quirk */ + unsigned has_fsl_susp_errata:1; /* NXP SUSP quirk */ + unsigned big_endian_mmio:1; + unsigned big_endian_desc:1; + unsigned big_endian_capbase:1; + unsigned has_amcc_usb23:1; + unsigned need_io_watchdog:1; + unsigned amd_pll_fix:1; + unsigned use_dummy_qh:1; /* AMD Frame List table quirk */ + unsigned has_synopsys_hc_bug:1; /* Synopsys HC */ + unsigned frame_index_bug:1; /* MosChip (AKA NetMos) */ + unsigned need_oc_pp_cycle:1; /* MPC834X port power */ + unsigned imx28_write_fix:1; /* For Freescale i.MX28 */ /* required for usb32 quirk */ - #define OHCI_CTRL_HCFS (3 << 6) - #define OHCI_USB_OPER (2 << 6) - #define OHCI_USB_SUSPEND (3 << 6) - - #define OHCI_HCCTRL_OFFSET 0x4 - #define OHCI_HCCTRL_LEN 0x4 - __hc32 *ohci_hcctrl_reg; - unsigned has_hostpc:1; - unsigned has_tdi_phy_lpm:1; - unsigned has_ppcd:1; /* support per-port change bits */ - u8 sbrn; /* packed release number */ +#define OHCI_CTRL_HCFS (3 << 6) +#define OHCI_USB_OPER (2 << 6) +#define OHCI_USB_SUSPEND (3 << 6) + +#define OHCI_HCCTRL_OFFSET 0x4 +#define OHCI_HCCTRL_LEN 0x4 + __hc32 *ohci_hcctrl_reg; + unsigned has_hostpc:1; + unsigned has_tdi_phy_lpm:1; + unsigned has_ppcd:1; /* support per-port change bits */ + u8 sbrn; /* packed release number */ /* irq statistics */ #ifdef EHCI_STATS - struct ehci_stats stats; -# define COUNT(x) ((x)++) + struct ehci_stats stats; +# define INCR(x) ((x)++) #else -# define COUNT(x) +# define INCR(x) do {} while (0) #endif /* debug files */ #ifdef CONFIG_DYNAMIC_DEBUG - struct dentry *debug_dir; + struct dentry *debug_dir; #endif /* bandwidth usage */ #define EHCI_BANDWIDTH_SIZE 64 #define EHCI_BANDWIDTH_FRAMES (EHCI_BANDWIDTH_SIZE >> 3) - u8 bandwidth[EHCI_BANDWIDTH_SIZE]; - /* us allocated per uframe */ - u8 tt_budget[EHCI_BANDWIDTH_SIZE]; - /* us budgeted per uframe */ - struct list_head tt_list; + u8 bandwidth[EHCI_BANDWIDTH_SIZE]; + /* us allocated per uframe */ + u8 tt_budget[EHCI_BANDWIDTH_SIZE]; + /* us budgeted per uframe */ + struct list_head tt_list; /* platform-specific data -- must come last */ - unsigned long priv[0] __aligned(sizeof(s64)); + unsigned long priv[] __aligned(sizeof(s64)); }; /* convert between an HCD pointer and the corresponding EHCI_HCD */ static inline struct ehci_hcd *hcd_to_ehci(struct usb_hcd *hcd) { - return (struct ehci_hcd *) (hcd->hcd_priv); + return (struct ehci_hcd *)(hcd->hcd_priv); } + static inline struct usb_hcd *ehci_to_hcd(struct ehci_hcd *ehci) { - return container_of((void *) ehci, struct usb_hcd, hcd_priv); + return container_of((void *)ehci, struct usb_hcd, hcd_priv); } /*-------------------------------------------------------------------------*/ @@ -286,9 +286,9 @@ static inline struct usb_hcd *ehci_to_hcd(struct ehci_hcd *ehci) */ struct ehci_qtd { /* first part defined by EHCI spec */ - __hc32 hw_next; /* see EHCI 3.5.1 */ - __hc32 hw_alt_next; /* see EHCI 3.5.2 */ - __hc32 hw_token; /* see EHCI 3.5.3 */ + __hc32 hw_next; /* see EHCI 3.5.1 */ + __hc32 hw_alt_next; /* see EHCI 3.5.2 */ + __hc32 hw_token; /* see EHCI 3.5.3 */ #define QTD_TOGGLE (1 << 31) /* data toggle */ #define QTD_LENGTH(tok) (((tok)>>16) & 0x7fff) #define QTD_IOC (1 << 15) /* interrupt on complete */ @@ -307,14 +307,14 @@ struct ehci_qtd { #define HALT_BIT(ehci) cpu_to_hc32(ehci, QTD_STS_HALT) #define STATUS_BIT(ehci) cpu_to_hc32(ehci, QTD_STS_STS) - __hc32 hw_buf[5]; /* see EHCI 3.5.4 */ - __hc32 hw_buf_hi[5]; /* Appendix B */ + __hc32 hw_buf[5]; /* see EHCI 3.5.4 */ + __hc32 hw_buf_hi[5]; /* Appendix B */ /* the rest is HCD-private */ - dma_addr_t qtd_dma; /* qtd address */ - struct list_head qtd_list; /* sw qtd list */ - struct urb *urb; /* qtd's urb */ - size_t length; /* length of buffer */ + dma_addr_t qtd_dma; /* qtd address */ + struct list_head qtd_list; /* sw qtd list */ + struct urb *urb; /* qtd's urb */ + size_t length; /* length of buffer */ } __aligned(32); /* mask NakCnt+T in qh->hw_alt_next */ @@ -345,7 +345,7 @@ struct ehci_qtd { (cpu_to_hc32(ehci, (((u32) dma) & ~0x01f) | Q_TYPE_QH)) /* for periodic/async schedules and qtd lists, mark end of list */ -#define EHCI_LIST_END(ehci) cpu_to_hc32(ehci, 1) /* "null pointer" to hw */ +#define EHCI_LIST_END(ehci) cpu_to_hc32(ehci, 1) /* "null pointer" to hw */ /* * Entries in periodic shadow table are pointers to one of four kinds @@ -356,12 +356,12 @@ struct ehci_qtd { * For entries in the async schedule, the type tag always says "qh". */ union ehci_shadow { - struct ehci_qh *qh; /* Q_TYPE_QH */ - struct ehci_itd *itd; /* Q_TYPE_ITD */ - struct ehci_sitd *sitd; /* Q_TYPE_SITD */ - struct ehci_fstn *fstn; /* Q_TYPE_FSTN */ - __hc32 *hw_next; /* (all types) */ - void *ptr; + struct ehci_qh *qh; /* Q_TYPE_QH */ + struct ehci_itd *itd; /* Q_TYPE_ITD */ + struct ehci_sitd *sitd; /* Q_TYPE_SITD */ + struct ehci_fstn *fstn; /* Q_TYPE_FSTN */ + __hc32 *hw_next; /* (all types) */ + void *ptr; }; /*-------------------------------------------------------------------------*/ @@ -376,8 +376,8 @@ union ehci_shadow { /* first part defined by EHCI spec */ struct ehci_qh_hw { - __hc32 hw_next; /* see EHCI 3.6.1 */ - __hc32 hw_info1; /* see EHCI 3.6.2 */ + __hc32 hw_next; /* see EHCI 3.6.1 */ + __hc32 hw_info1; /* see EHCI 3.6.2 */ #define QH_CONTROL_EP (1 << 27) /* FS/LS control endpoint */ #define QH_HEAD (1 << 15) /* Head of async reclamation list */ #define QH_TOGGLE_CTL (1 << 14) /* Data toggle control */ @@ -385,59 +385,59 @@ struct ehci_qh_hw { #define QH_LOW_SPEED (1 << 12) #define QH_FULL_SPEED (0 << 12) #define QH_INACTIVATE (1 << 7) /* Inactivate on next transaction */ - __hc32 hw_info2; /* see EHCI 3.6.2 */ + __hc32 hw_info2; /* see EHCI 3.6.2 */ #define QH_SMASK 0x000000ff #define QH_CMASK 0x0000ff00 #define QH_HUBADDR 0x007f0000 #define QH_HUBPORT 0x3f800000 #define QH_MULT 0xc0000000 - __hc32 hw_current; /* qtd list - see EHCI 3.6.4 */ + __hc32 hw_current; /* qtd list - see EHCI 3.6.4 */ /* qtd overlay (hardware parts of a struct ehci_qtd) */ - __hc32 hw_qtd_next; - __hc32 hw_alt_next; - __hc32 hw_token; - __hc32 hw_buf[5]; - __hc32 hw_buf_hi[5]; + __hc32 hw_qtd_next; + __hc32 hw_alt_next; + __hc32 hw_token; + __hc32 hw_buf[5]; + __hc32 hw_buf_hi[5]; } __aligned(32); struct ehci_qh { - struct ehci_qh_hw *hw; /* Must come first */ + struct ehci_qh_hw *hw; /* Must come first */ /* the rest is HCD-private */ - dma_addr_t qh_dma; /* address of qh */ - union ehci_shadow qh_next; /* ptr to qh; or periodic */ - struct list_head qtd_list; /* sw qtd list */ - struct list_head intr_node; /* list of intr QHs */ - struct ehci_qtd *dummy; - struct list_head unlink_node; - struct ehci_per_sched ps; /* scheduling info */ - - unsigned unlink_cycle; - - u8 qh_state; -#define QH_STATE_LINKED 1 /* HC sees this */ -#define QH_STATE_UNLINK 2 /* HC may still see this */ -#define QH_STATE_IDLE 3 /* HC doesn't see this */ -#define QH_STATE_UNLINK_WAIT 4 /* LINKED and on unlink q */ -#define QH_STATE_COMPLETING 5 /* don't touch token.HALT */ - - u8 xacterrs; /* XactErr retry counter */ -#define QH_XACTERR_MAX 32 /* XactErr retry limit */ - - u8 unlink_reason; -#define QH_UNLINK_HALTED 0x01 /* Halt flag is set */ -#define QH_UNLINK_SHORT_READ 0x02 /* Recover from a short read */ -#define QH_UNLINK_DUMMY_OVERLAY 0x04 /* QH overlayed the dummy TD */ -#define QH_UNLINK_SHUTDOWN 0x08 /* The HC isn't running */ -#define QH_UNLINK_QUEUE_EMPTY 0x10 /* Reached end of the queue */ -#define QH_UNLINK_REQUESTED 0x20 /* Disable, reset, or dequeue */ - - u8 gap_uf; /* uframes split/csplit gap */ - - unsigned is_out:1; /* bulk or intr OUT */ - unsigned clearing_tt:1; /* Clear-TT-Buf in progress */ - unsigned dequeue_during_giveback:1; - unsigned should_be_inactive:1; + dma_addr_t qh_dma; /* address of qh */ + union ehci_shadow qh_next; /* ptr to qh; or periodic */ + struct list_head qtd_list; /* sw qtd list */ + struct list_head intr_node; /* list of intr QHs */ + struct ehci_qtd *dummy; + struct list_head unlink_node; + struct ehci_per_sched ps; /* scheduling info */ + + unsigned unlink_cycle; + + u8 qh_state; +#define QH_STATE_LINKED 1 /* HC sees this */ +#define QH_STATE_UNLINK 2 /* HC may still see this */ +#define QH_STATE_IDLE 3 /* HC doesn't see this */ +#define QH_STATE_UNLINK_WAIT 4 /* LINKED and on unlink q */ +#define QH_STATE_COMPLETING 5 /* don't touch token.HALT */ + + u8 xacterrs; /* XactErr retry counter */ +#define QH_XACTERR_MAX 32 /* XactErr retry limit */ + + u8 unlink_reason; +#define QH_UNLINK_HALTED 0x01 /* Halt flag is set */ +#define QH_UNLINK_SHORT_READ 0x02 /* Recover from a short read */ +#define QH_UNLINK_DUMMY_OVERLAY 0x04 /* QH overlayed the dummy TD */ +#define QH_UNLINK_SHUTDOWN 0x08 /* The HC isn't running */ +#define QH_UNLINK_QUEUE_EMPTY 0x10 /* Reached end of the queue */ +#define QH_UNLINK_REQUESTED 0x20 /* Disable, reset, or dequeue */ + + u8 gap_uf; /* uframes split/csplit gap */ + + unsigned is_out:1; /* bulk or intr OUT */ + unsigned clearing_tt:1; /* Clear-TT-Buf in progress */ + unsigned dequeue_during_giveback:1; + unsigned should_be_inactive:1; }; /*-------------------------------------------------------------------------*/ @@ -445,11 +445,11 @@ struct ehci_qh { /* description of one iso transaction (up to 3 KB data if highspeed) */ struct ehci_iso_packet { /* These will be copied to iTD when scheduling */ - u64 bufp; /* itd->hw_bufp{,_hi}[pg] |= */ - __hc32 transaction; /* itd->hw_transaction[i] |= */ - u8 cross; /* buf crosses pages */ + u64 bufp; /* itd->hw_bufp{,_hi}[pg] |= */ + __hc32 transaction; /* itd->hw_transaction[i] |= */ + u8 cross; /* buf crosses pages */ /* for full speed OUT splits */ - u32 buf1; + u32 buf1; }; /* temporary schedule data for packets from iso urbs (both speeds) @@ -457,10 +457,10 @@ struct ehci_iso_packet { * beginning at stream->next_uframe */ struct ehci_iso_sched { - struct list_head td_list; - unsigned span; - unsigned first_packet; - struct ehci_iso_packet packet[0]; + struct list_head td_list; + unsigned span; + unsigned first_packet; + struct ehci_iso_packet packet[]; }; /* @@ -469,32 +469,32 @@ struct ehci_iso_sched { */ struct ehci_iso_stream { /* first field matches ehci_hq, but is NULL */ - struct ehci_qh_hw *hw; + struct ehci_qh_hw *hw; - u8 bEndpointAddress; - u8 highspeed; - struct list_head td_list; /* queued itds/sitds */ - struct list_head free_list; /* list of unused itds/sitds */ + u8 bEndpointAddress; + u8 highspeed; + struct list_head td_list; /* queued itds/sitds */ + struct list_head free_list; /* list of unused itds/sitds */ /* output of (re)scheduling */ - struct ehci_per_sched ps; /* scheduling info */ - unsigned next_uframe; - __hc32 splits; + struct ehci_per_sched ps; /* scheduling info */ + unsigned next_uframe; + __hc32 splits; /* the rest is derived from the endpoint descriptor, * including the extra info for hw_bufp[0..2] */ - u16 uperiod; /* period in uframes */ - u16 maxp; - unsigned bandwidth; + u16 uperiod; /* period in uframes */ + u16 maxp; + unsigned bandwidth; /* This is used to initialize iTD's hw_bufp fields */ - __hc32 buf0; - __hc32 buf1; - __hc32 buf2; + __hc32 buf0; + __hc32 buf1; + __hc32 buf2; /* this is used to initialize sITD's tt info */ - __hc32 address; + __hc32 address; }; /*-------------------------------------------------------------------------*/ @@ -507,32 +507,32 @@ struct ehci_iso_stream { */ struct ehci_itd { /* first part defined by EHCI spec */ - __hc32 hw_next; /* see EHCI 3.3.1 */ - __hc32 hw_transaction[8]; /* see EHCI 3.3.2 */ -#define EHCI_ISOC_ACTIVE (1<<31) /* activate transfer this slot */ -#define EHCI_ISOC_BUF_ERR (1<<30) /* Data buffer error */ -#define EHCI_ISOC_BABBLE (1<<29) /* babble detected */ -#define EHCI_ISOC_XACTERR (1<<28) /* XactErr - transaction error */ + __hc32 hw_next; /* see EHCI 3.3.1 */ + __hc32 hw_transaction[8]; /* see EHCI 3.3.2 */ +#define EHCI_ISOC_ACTIVE (1<<31) /* activate transfer this slot */ +#define EHCI_ISOC_BUF_ERR (1<<30) /* Data buffer error */ +#define EHCI_ISOC_BABBLE (1<<29) /* babble detected */ +#define EHCI_ISOC_XACTERR (1<<28) /* XactErr - transaction error */ #define EHCI_ITD_LENGTH(tok) (((tok)>>16) & 0x0fff) #define EHCI_ITD_IOC (1 << 15) /* interrupt on complete */ #define ITD_ACTIVE(ehci) cpu_to_hc32(ehci, EHCI_ISOC_ACTIVE) - __hc32 hw_bufp[7]; /* see EHCI 3.3.3 */ - __hc32 hw_bufp_hi[7]; /* Appendix B */ + __hc32 hw_bufp[7]; /* see EHCI 3.3.3 */ + __hc32 hw_bufp_hi[7]; /* Appendix B */ /* the rest is HCD-private */ - dma_addr_t itd_dma; /* for this itd */ - union ehci_shadow itd_next; /* ptr to periodic q entry */ + dma_addr_t itd_dma; /* for this itd */ + union ehci_shadow itd_next; /* ptr to periodic q entry */ - struct urb *urb; - struct ehci_iso_stream *stream; /* endpoint's queue */ - struct list_head itd_list; /* list of stream's itds */ + struct urb *urb; + struct ehci_iso_stream *stream; /* endpoint's queue */ + struct list_head itd_list; /* list of stream's itds */ /* any/all hw_transactions here may be used by that urb */ - unsigned frame; /* where scheduled */ - unsigned pg; - unsigned index[8]; /* in urb->iso_frame_desc */ + unsigned frame; /* where scheduled */ + unsigned pg; + unsigned index[8]; /* in urb->iso_frame_desc */ } __aligned(32); /*-------------------------------------------------------------------------*/ @@ -545,11 +545,11 @@ struct ehci_itd { */ struct ehci_sitd { /* first part defined by EHCI spec */ - __hc32 hw_next; + __hc32 hw_next; /* uses bit field macros above - see EHCI 0.95 Table 3-8 */ - __hc32 hw_fullspeed_ep; /* EHCI table 3-9 */ - __hc32 hw_uframe; /* EHCI table 3-10 */ - __hc32 hw_results; /* EHCI table 3-11 */ + __hc32 hw_fullspeed_ep; /* EHCI table 3-9 */ + __hc32 hw_uframe; /* EHCI table 3-10 */ + __hc32 hw_results; /* EHCI table 3-11 */ #define SITD_IOC (1 << 31) /* interrupt on completion */ #define SITD_PAGE (1 << 30) /* buffer 0/1 */ #define SITD_LENGTH(x) (((x) >> 16) & 0x3ff) @@ -563,19 +563,19 @@ struct ehci_sitd { #define SITD_ACTIVE(ehci) cpu_to_hc32(ehci, SITD_STS_ACTIVE) - __hc32 hw_buf[2]; /* EHCI table 3-12 */ - __hc32 hw_backpointer; /* EHCI table 3-13 */ - __hc32 hw_buf_hi[2]; /* Appendix B */ + __hc32 hw_buf[2]; /* EHCI table 3-12 */ + __hc32 hw_backpointer; /* EHCI table 3-13 */ + __hc32 hw_buf_hi[2]; /* Appendix B */ /* the rest is HCD-private */ - dma_addr_t sitd_dma; - union ehci_shadow sitd_next; /* ptr to periodic q entry */ - - struct urb *urb; - struct ehci_iso_stream *stream; /* endpoint's queue */ - struct list_head sitd_list; /* list of stream's sitds */ - unsigned frame; - unsigned index; + dma_addr_t sitd_dma; + union ehci_shadow sitd_next; /* ptr to periodic q entry */ + + struct urb *urb; + struct ehci_iso_stream *stream; /* endpoint's queue */ + struct list_head sitd_list; /* list of stream's sitds */ + unsigned frame; + unsigned index; } __aligned(32); /*-------------------------------------------------------------------------*/ @@ -590,12 +590,12 @@ struct ehci_sitd { * it hits a "restore" FSTN; then it returns to finish other uframe 0/1 work. */ struct ehci_fstn { - __hc32 hw_next; /* any periodic q entry */ - __hc32 hw_prev; /* qh or EHCI_LIST_END */ + __hc32 hw_next; /* any periodic q entry */ + __hc32 hw_prev; /* qh or EHCI_LIST_END */ /* the rest is HCD-private */ - dma_addr_t fstn_dma; - union ehci_shadow fstn_next; /* ptr to periodic q entry */ + dma_addr_t fstn_dma; + union ehci_shadow fstn_next; /* ptr to periodic q entry */ } __aligned(32); /*-------------------------------------------------------------------------*/ @@ -619,12 +619,12 @@ struct ehci_fstn { */ struct ehci_tt { - u16 bandwidth[EHCI_BANDWIDTH_FRAMES]; + u16 bandwidth[EHCI_BANDWIDTH_FRAMES]; - struct list_head tt_list; /* List of all ehci_tt's */ - struct list_head ps_list; /* Items using this TT */ - struct usb_tt *usb_tt; - int tt_port; /* TT port number */ + struct list_head tt_list; /* List of all ehci_tt's */ + struct list_head ps_list; /* Items using this TT */ + struct usb_tt *usb_tt; + int tt_port; /* TT port number */ }; /*-------------------------------------------------------------------------*/ @@ -736,12 +736,10 @@ ehci_port_speed(struct ehci_hcd *ehci, unsigned int portsc) #endif static inline unsigned int ehci_readl(const struct ehci_hcd *ehci, - __u32 __iomem *regs) + __u32 __iomem * regs) { #ifdef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO - return ehci_big_endian_mmio(ehci) ? - readl_be(regs) : - readl(regs); + return ehci_big_endian_mmio(ehci) ? readl_be(regs) : readl(regs); #else return readl(regs); #endif @@ -749,23 +747,21 @@ static inline unsigned int ehci_readl(const struct ehci_hcd *ehci, #ifdef CONFIG_SOC_IMX28 static inline void imx28_ehci_writel(const unsigned int val, - volatile __u32 __iomem *addr) + volatile __u32 __iomem * addr) { - __asm__ ("swp %0, %0, [%1]" : : "r"(val), "r"(addr)); +__asm__("swp %0, %0, [%1]": :"r"(val), "r"(addr)); } #else static inline void imx28_ehci_writel(const unsigned int val, - volatile __u32 __iomem *addr) + volatile __u32 __iomem * addr) { } #endif static inline void ehci_writel(const struct ehci_hcd *ehci, - const unsigned int val, __u32 __iomem *regs) + const unsigned int val, __u32 __iomem * regs) { #ifdef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO - ehci_big_endian_mmio(ehci) ? - writel_be(val, regs) : - writel(val, regs); + ehci_big_endian_mmio(ehci) ? writel_be(val, regs) : writel(val, regs); #else if (ehci->imx28_write_fix) imx28_ehci_writel(val, regs); @@ -791,11 +787,12 @@ static inline void set_ohci_hcfs(struct ehci_hcd *ehci, int operational) hc_control |= OHCI_USB_SUSPEND; writel_be(hc_control, ehci->ohci_hcctrl_reg); - (void) readl_be(ehci->ohci_hcctrl_reg); + (void)readl_be(ehci->ohci_hcctrl_reg); } #else static inline void set_ohci_hcfs(struct ehci_hcd *ehci, int operational) -{ } +{ +} #endif /*-------------------------------------------------------------------------*/ @@ -814,23 +811,23 @@ static inline void set_ohci_hcfs(struct ehci_hcd *ehci, int operational) static inline __hc32 cpu_to_hc32(const struct ehci_hcd *ehci, const u32 x) { return ehci_big_endian_desc(ehci) - ? (__force __hc32)cpu_to_be32(x) - : (__force __hc32)cpu_to_le32(x); + ? (__force __hc32) cpu_to_be32(x) + : (__force __hc32) cpu_to_le32(x); } /* ehci to cpu */ static inline u32 hc32_to_cpu(const struct ehci_hcd *ehci, const __hc32 x) { return ehci_big_endian_desc(ehci) - ? be32_to_cpu((__force __be32)x) - : le32_to_cpu((__force __le32)x); + ? be32_to_cpu((__force __be32) x) + : le32_to_cpu((__force __le32) x); } -static inline u32 hc32_to_cpup(const struct ehci_hcd *ehci, const __hc32 *x) +static inline u32 hc32_to_cpup(const struct ehci_hcd *ehci, const __hc32 * x) { return ehci_big_endian_desc(ehci) - ? be32_to_cpup((__force __be32 *)x) - : le32_to_cpup((__force __le32 *)x); + ? be32_to_cpup((__force __be32 *) x) + : le32_to_cpup((__force __le32 *) x); } #else @@ -847,7 +844,7 @@ static inline u32 hc32_to_cpu(const struct ehci_hcd *ehci, const __hc32 x) return le32_to_cpu(x); } -static inline u32 hc32_to_cpup(const struct ehci_hcd *ehci, const __hc32 *x) +static inline u32 hc32_to_cpup(const struct ehci_hcd *ehci, const __hc32 * x) { return le32_to_cpup(x); } @@ -870,25 +867,24 @@ static inline u32 hc32_to_cpup(const struct ehci_hcd *ehci, const __hc32 *x) /* Declarations of things exported for use by ehci platform drivers */ struct ehci_driver_overrides { - size_t extra_priv_size; - int (*reset)(struct usb_hcd *hcd); - int (*port_power)(struct usb_hcd *hcd, - int portnum, bool enable); + size_t extra_priv_size; + int (*reset) (struct usb_hcd * hcd); + int (*port_power) (struct usb_hcd * hcd, int portnum, bool enable); }; -extern void ehci_init_driver(struct hc_driver *drv, - const struct ehci_driver_overrides *over); -extern int ehci_setup(struct usb_hcd *hcd); -extern int ehci_handshake(struct ehci_hcd *ehci, void __iomem *ptr, - u32 mask, u32 done, int usec); -extern int ehci_reset(struct ehci_hcd *ehci); +extern void ehci_init_driver(struct hc_driver *drv, + const struct ehci_driver_overrides *over); +extern int ehci_setup(struct usb_hcd *hcd); +extern int ehci_handshake(struct ehci_hcd *ehci, void __iomem * ptr, + u32 mask, u32 done, int usec); +extern int ehci_reset(struct ehci_hcd *ehci); -extern int ehci_suspend(struct usb_hcd *hcd, bool do_wakeup); -extern int ehci_resume(struct usb_hcd *hcd, bool force_reset); -extern void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci, - bool suspending, bool do_wakeup); +extern int ehci_suspend(struct usb_hcd *hcd, bool do_wakeup); +extern int ehci_resume(struct usb_hcd *hcd, bool force_reset); +extern void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci, + bool suspending, bool do_wakeup); -extern int ehci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, - u16 wIndex, char *buf, u16 wLength); +extern int ehci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, + u16 wIndex, char *buf, u16 wLength); #endif /* __LINUX_EHCI_HCD_H */ diff --git a/platform/centec-arm64/tsingma-bsp/src/gpio-ctc/gpio-ctc.c b/platform/centec-arm64/tsingma-bsp/src/gpio-ctc/gpio-ctc.c old mode 100644 new mode 100755 index de310e02d210..776f7da001bc --- a/platform/centec-arm64/tsingma-bsp/src/gpio-ctc/gpio-ctc.c +++ b/platform/centec-arm64/tsingma-bsp/src/gpio-ctc/gpio-ctc.c @@ -25,12 +25,19 @@ #include #include "gpio-ctcapb.h" #include +#include #include "gpiolib.h" +#include "../include/sysctl.h" +#include +#include +#include "gpiolib-acpi.h" #define DWAPB_MAX_PORTS 2 struct ctcapb_gpio; +static u32 soc_v; + struct ctcapb_gpio_port { bool is_registered; unsigned int idx; @@ -45,14 +52,15 @@ struct ctcapb_gpio { unsigned int nr_ports; struct GpioSoc_regs *regs; struct ctcapb_gpio_port *ports; + struct regmap *regmap_base; }; -static void clrsetbits(unsigned __iomem *addr, u32 clr, u32 set) +static void clrsetbits(unsigned __iomem * addr, u32 clr, u32 set) { writel((readl(addr) & ~(clr)) | (set), addr); } -static int ctcapb_gpio_to_irq(struct gpio_chip *gc, unsigned int offset) +static int ctcapb_gpio_to_irq(struct gpio_chip *gc, unsigned offset) { struct ctcapb_gpio_port *port = gpiochip_get_data(gc); @@ -123,6 +131,20 @@ static void ctcapb_irq_unmask(struct irq_data *d) ctcapb_irq_enable(d); } +#if 0 +static void ctcapb_irq_disable(struct irq_data *d) +{ + struct irq_chip_generic *igc = irq_data_get_irq_chip_data(d); + struct ctcapb_gpio_port *port = igc->private; + struct gpio_chip *gc = &port->gc; + unsigned long flags; + + spin_lock_irqsave(&gc->bgpio_lock, flags); + clrsetbits(&port->regs->GpioIntrEn, ~BIT(d->hwirq), 0); + spin_unlock_irqrestore(&gc->bgpio_lock, flags); +} +#endif + static int ctcapb_irq_reqres(struct irq_data *d) { struct irq_chip_generic *igc = irq_data_get_irq_chip_data(d); @@ -152,7 +174,7 @@ static int ctcapb_irq_set_type(struct irq_data *d, u32 type) struct ctcapb_gpio_port *port = igc->private; struct gpio_chip *gc = &port->gc; int bit = d->hwirq; - unsigned long level, polarity, flags; + unsigned long level, polarity, flags, datactl, outctl; if (type & ~(IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) @@ -162,6 +184,21 @@ static int ctcapb_irq_set_type(struct irq_data *d, u32 type) level = readl(&port->regs->GpioIntrLevel); polarity = readl(&port->regs->GpioIntrPolarity); + if (!soc_v) { + datactl = readl(&port->regs->GpioDataCtl); + outctl = readl(&port->regs->GpioOutCtl); + + datactl &= ~BIT(bit); + outctl |= BIT(bit); + + writel(datactl, &port->regs->GpioDataCtl); + writel(outctl, &port->regs->GpioOutCtl); + + udelay(10); + + outctl &= ~BIT(bit); + writel(outctl, &port->regs->GpioOutCtl); + } switch (type) { case IRQ_TYPE_EDGE_BOTH: level &= ~BIT(bit); @@ -195,7 +232,7 @@ static int ctcapb_irq_set_type(struct irq_data *d, u32 type) } static int ctcapb_gpio_set_debounce(struct gpio_chip *gc, - unsigned int offset, unsigned int debounce) + unsigned offset, unsigned debounce) { struct ctcapb_gpio_port *port = gpiochip_get_data(gc); unsigned long flags, val_deb; @@ -445,7 +482,8 @@ static struct ctcapb_platform_data *ctcapb_gpio_get_pdata(struct device *dev) } if (dev->of_node && fwnode_property_read_bool(fwnode, - "interrupt-controller")) { + "interrupt-controller")) + { pp->irq = irq_of_parse_and_map(to_of_node(fwnode), 0); if (!pp->irq) dev_warn(dev, "no irq for port%d\n", pp->idx); @@ -461,12 +499,42 @@ static struct ctcapb_platform_data *ctcapb_gpio_get_pdata(struct device *dev) return pdata; } +int ctc_bgpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) +{ + unsigned long mask; + + if (gc->be_bits) + mask = BIT(gc->bgpio_bits - 1 - gpio); + else + mask = BIT(gpio); + + if (soc_v) { + return 0; + } else { + if (val) + gc->bgpio_data |= mask; + else + gc->bgpio_data &= ~mask; + + gc->write_reg(gc->reg_set, gc->bgpio_data); + + if (gc->be_bits) + gc->bgpio_dir |= BIT(gc->bgpio_bits - 1 - gpio); + else + gc->bgpio_dir |= BIT(gpio); + + gc->write_reg(gc->reg_dir_out, gc->bgpio_dir); + + return 0; + } +} + static int ctcapb_gpio_probe(struct platform_device *pdev) { unsigned int i; struct resource *res; struct ctcapb_gpio *gpio; - int err; + int err, val; struct device *dev = &pdev->dev; struct ctcapb_platform_data *pdata = dev_get_platdata(dev); @@ -491,6 +559,18 @@ static int ctcapb_gpio_probe(struct platform_device *pdev) if (!gpio->ports) return -ENOMEM; + gpio->regmap_base = + syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "ctc,sysctrl"); + if (IS_ERR(gpio->regmap_base)) + return PTR_ERR(gpio->regmap_base); + + regmap_read(gpio->regmap_base, + offsetof(struct SysCtl_regs, SysCtlSysRev), &val); + + soc_v = val; + + printk("soc version = 0x%x\n", soc_v); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); gpio->regs = (struct GpioSoc_regs *)devm_ioremap_resource(&pdev->dev, res); @@ -508,8 +588,9 @@ static int ctcapb_gpio_probe(struct platform_device *pdev) out_unregister: ctcapb_gpio_unregister(gpio); - for (i = 0; i < gpio->nr_ports; i++) + for (i = 0; i < gpio->nr_ports; i++) { ctcapb_irq_teardown(&gpio->ports[i]); + } return err; } @@ -520,8 +601,9 @@ static int ctcapb_gpio_remove(struct platform_device *pdev) struct ctcapb_gpio *gpio = platform_get_drvdata(pdev); ctcapb_gpio_unregister(gpio); - for (i = 0; i < gpio->nr_ports; i++) + for (i = 0; i < gpio->nr_ports; i++) { ctcapb_irq_teardown(&gpio->ports[i]); + } return 0; } diff --git a/platform/centec-arm64/tsingma-bsp/src/gpio-ctc/gpiolib-acpi.h b/platform/centec-arm64/tsingma-bsp/src/gpio-ctc/gpiolib-acpi.h new file mode 100644 index 000000000000..1c6d65cf0629 --- /dev/null +++ b/platform/centec-arm64/tsingma-bsp/src/gpio-ctc/gpiolib-acpi.h @@ -0,0 +1,96 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * ACPI helpers for GPIO API + * + * Copyright (C) 2012,2019 Intel Corporation + */ + +#ifndef GPIOLIB_ACPI_H +#define GPIOLIB_ACPI_H + +struct acpi_device; + +/** + * struct acpi_gpio_info - ACPI GPIO specific information + * @adev: reference to ACPI device which consumes GPIO resource + * @flags: GPIO initialization flags + * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo + * @pin_config: pin bias as provided by ACPI + * @polarity: interrupt polarity as provided by ACPI + * @triggering: triggering type as provided by ACPI + * @quirks: Linux specific quirks as provided by struct acpi_gpio_mapping + */ +struct acpi_gpio_info { + struct acpi_device *adev; + enum gpiod_flags flags; + bool gpioint; + int pin_config; + int polarity; + int triggering; + unsigned int quirks; +}; + +#ifdef CONFIG_ACPI +void acpi_gpiochip_add(struct gpio_chip *chip); +void acpi_gpiochip_remove(struct gpio_chip *chip); + +void acpi_gpiochip_request_interrupts(struct gpio_chip *chip); +void acpi_gpiochip_free_interrupts(struct gpio_chip *chip); + +int acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, + struct acpi_gpio_info *info); +int acpi_gpio_update_gpiod_lookup_flags(unsigned long *lookupflags, + struct acpi_gpio_info *info); + +struct gpio_desc *acpi_find_gpio(struct device *dev, + const char *con_id, + unsigned int idx, + enum gpiod_flags *dflags, + unsigned long *lookupflags); +struct gpio_desc *acpi_node_get_gpiod(struct fwnode_handle *fwnode, + const char *propname, int index, + struct acpi_gpio_info *info); + +int acpi_gpio_count(struct device *dev, const char *con_id); +#else +static inline void acpi_gpiochip_add(struct gpio_chip *chip) { } +static inline void acpi_gpiochip_remove(struct gpio_chip *chip) { } + +static inline void +acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { } + +static inline void +acpi_gpiochip_free_interrupts(struct gpio_chip *chip) { } + +static inline int +acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, struct acpi_gpio_info *info) +{ + return 0; +} +static inline int +acpi_gpio_update_gpiod_lookup_flags(unsigned long *lookupflags, + struct acpi_gpio_info *info) +{ + return 0; +} + +static inline struct gpio_desc * +acpi_find_gpio(struct device *dev, const char *con_id, + unsigned int idx, enum gpiod_flags *dflags, + unsigned long *lookupflags) +{ + return ERR_PTR(-ENOENT); +} +static inline struct gpio_desc * +acpi_node_get_gpiod(struct fwnode_handle *fwnode, const char *propname, + int index, struct acpi_gpio_info *info) +{ + return ERR_PTR(-ENXIO); +} +static inline int acpi_gpio_count(struct device *dev, const char *con_id) +{ + return -ENODEV; +} +#endif + +#endif /* GPIOLIB_ACPI_H */ diff --git a/platform/centec-arm64/tsingma-bsp/src/gpio-ctc/gpiolib.h b/platform/centec-arm64/tsingma-bsp/src/gpio-ctc/gpiolib.h index a7e49fef73d4..c7ec14a3c481 100644 --- a/platform/centec-arm64/tsingma-bsp/src/gpio-ctc/gpiolib.h +++ b/platform/centec-arm64/tsingma-bsp/src/gpio-ctc/gpiolib.h @@ -1,27 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * Internal GPIO functions. * * Copyright (C) 2013, Intel Corporation * Author: Mika Westerberg - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef GPIOLIB_H #define GPIOLIB_H #include -#include /* for enum gpiod_flags */ +#include /* for enum gpiod_flags */ #include #include #include #include -enum of_gpio_flags; -enum gpio_lookup_flags; -struct acpi_device; +#define GPIOCHIP_NAME "gpiochip" /** * struct gpio_device - internal state container for GPIO devices @@ -49,18 +44,19 @@ struct acpi_device; * userspace. */ struct gpio_device { - int id; - struct device dev; - struct cdev chrdev; - struct device *mockdev; - struct module *owner; - struct gpio_chip *chip; - struct gpio_desc *descs; - int base; - u16 ngpio; - const char *label; - void *data; - struct list_head list; + int id; + struct device dev; + struct cdev chrdev; + struct device *mockdev; + struct module *owner; + struct gpio_chip *chip; + struct gpio_desc *descs; + int base; + u16 ngpio; + const char *label; + void *data; + struct list_head list; + struct blocking_notifier_head notifier; #ifdef CONFIG_PINCTRL /* @@ -73,138 +69,36 @@ struct gpio_device { #endif }; -/** - * struct acpi_gpio_info - ACPI GPIO specific information - * @adev: reference to ACPI device which consumes GPIO resource - * @flags: GPIO initialization flags - * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo - * @polarity: interrupt polarity as provided by ACPI - * @triggering: triggering type as provided by ACPI - * @quirks: Linux specific quirks as provided by struct acpi_gpio_mapping - */ -struct acpi_gpio_info { - struct acpi_device *adev; - enum gpiod_flags flags; - bool gpioint; - int polarity; - int triggering; - unsigned int quirks; -}; - /* gpio suffixes used for ACPI and device tree lookup */ -static __maybe_unused const char * const gpio_suffixes[] = { "gpios", "gpio" }; - -#ifdef CONFIG_OF_GPIO -struct gpio_desc *of_find_gpio(struct device *dev, - const char *con_id, - unsigned int idx, - enum gpio_lookup_flags *flags); -struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np, - const char *list_name, int index, enum of_gpio_flags *flags); -int of_gpiochip_add(struct gpio_chip *gc); -void of_gpiochip_remove(struct gpio_chip *gc); -#else -static inline struct gpio_desc *of_find_gpio(struct device *dev, - const char *con_id, - unsigned int idx, - enum gpio_lookup_flags *flags) -{ - return ERR_PTR(-ENOENT); -} -static inline struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np, - const char *list_name, int index, enum of_gpio_flags *flags) -{ - return ERR_PTR(-ENOENT); -} -static inline int of_gpiochip_add(struct gpio_chip *gc) { return 0; } -static inline void of_gpiochip_remove(struct gpio_chip *gc) { } -#endif /* CONFIG_OF_GPIO */ - -#ifdef CONFIG_ACPI -void acpi_gpiochip_add(struct gpio_chip *chip); -void acpi_gpiochip_remove(struct gpio_chip *chip); - -void acpi_gpiochip_request_interrupts(struct gpio_chip *chip); -void acpi_gpiochip_free_interrupts(struct gpio_chip *chip); - -int acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, - struct acpi_gpio_info *info); - -struct gpio_desc *acpi_find_gpio(struct device *dev, - const char *con_id, - unsigned int idx, - enum gpiod_flags *dflags, - enum gpio_lookup_flags *lookupflags); -struct gpio_desc *acpi_node_get_gpiod(struct fwnode_handle *fwnode, - const char *propname, int index, - struct acpi_gpio_info *info); - -int acpi_gpio_count(struct device *dev, const char *con_id); - -bool acpi_can_fallback_to_crs(struct acpi_device *adev, const char *con_id); -#else -static inline void acpi_gpiochip_add(struct gpio_chip *chip) { } -static inline void acpi_gpiochip_remove(struct gpio_chip *chip) { } - -static inline void -acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { } - -static inline void -acpi_gpiochip_free_interrupts(struct gpio_chip *chip) { } - -static inline int -acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, struct acpi_gpio_info *info) -{ - return 0; -} - -static inline struct gpio_desc * -acpi_find_gpio(struct device *dev, const char *con_id, - unsigned int idx, enum gpiod_flags *dflags, - enum gpio_lookup_flags *lookupflags) -{ - return ERR_PTR(-ENOENT); -} -static inline struct gpio_desc * -acpi_node_get_gpiod(struct fwnode_handle *fwnode, const char *propname, - int index, struct acpi_gpio_info *info) -{ - return ERR_PTR(-ENXIO); -} -static inline int acpi_gpio_count(struct device *dev, const char *con_id) -{ - return -ENODEV; -} - -static inline bool acpi_can_fallback_to_crs(struct acpi_device *adev, - const char *con_id) -{ - return false; -} -#endif +static __maybe_unused const char *const gpio_suffixes[] = { "gpios", "gpio" }; + +struct gpio_array { + struct gpio_desc **desc; + unsigned int size; + struct gpio_chip *chip; + unsigned long *get_mask; + unsigned long *set_mask; + unsigned long invert_mask[]; +}; -struct gpio_desc *gpiochip_get_desc(struct gpio_chip *chip, u16 hwnum); +struct gpio_desc *gpiochip_get_desc(struct gpio_chip *gc, unsigned int hwnum); int gpiod_get_array_value_complex(bool raw, bool can_sleep, unsigned int array_size, struct gpio_desc **desc_array, - int *value_array); + struct gpio_array *array_info, + unsigned long *value_bitmap); int gpiod_set_array_value_complex(bool raw, bool can_sleep, - unsigned int array_size, - struct gpio_desc **desc_array, - int *value_array); - -/* This is just passed between gpiolib and devres */ -struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, - const char *propname, int index, - enum gpiod_flags dflags, - const char *label); + unsigned int array_size, + struct gpio_desc **desc_array, + struct gpio_array *array_info, + unsigned long *value_bitmap); -extern struct spinlock gpio_lock; +extern spinlock_t gpio_lock; extern struct list_head gpio_devices; struct gpio_desc { - struct gpio_device *gdev; - unsigned long flags; + struct gpio_device *gdev; + unsigned long flags; /* flag symbols are bit numbers */ #define FLAG_REQUESTED 0 #define FLAG_IS_OUT 1 @@ -214,21 +108,34 @@ struct gpio_desc { #define FLAG_OPEN_DRAIN 7 /* Gpio is open drain type */ #define FLAG_OPEN_SOURCE 8 /* Gpio is open source type */ #define FLAG_USED_AS_IRQ 9 /* GPIO is connected to an IRQ */ +#define FLAG_IRQ_IS_ENABLED 10 /* GPIO is connected to an enabled IRQ */ #define FLAG_IS_HOGGED 11 /* GPIO is hogged */ #define FLAG_TRANSITORY 12 /* GPIO may lose value in sleep or reset */ +#define FLAG_PULL_UP 13 /* GPIO has pull up enabled */ +#define FLAG_PULL_DOWN 14 /* GPIO has pull down enabled */ +#define FLAG_BIAS_DISABLE 15 /* GPIO has pull disabled */ +#define FLAG_EDGE_RISING 16 /* GPIO CDEV detects rising edge events */ +#define FLAG_EDGE_FALLING 17 /* GPIO CDEV detects falling edge events */ /* Connection label */ - const char *label; + const char *label; /* Name of the GPIO */ - const char *name; + const char *name; +#ifdef CONFIG_OF_DYNAMIC + struct device_node *hog; +#endif +#ifdef CONFIG_GPIO_CDEV + /* debounce period in microseconds */ + unsigned int debounce_period_us; +#endif }; int gpiod_request(struct gpio_desc *desc, const char *label); void gpiod_free(struct gpio_desc *desc); int gpiod_configure_flags(struct gpio_desc *desc, const char *con_id, - unsigned long lflags, enum gpiod_flags dflags); + unsigned long lflags, enum gpiod_flags dflags); int gpiod_hog(struct gpio_desc *desc, const char *name, - unsigned long lflags, enum gpiod_flags dflags); + unsigned long lflags, enum gpiod_flags dflags); /* * Return the GPIO number of the passed descriptor relative to its chip @@ -238,9 +145,6 @@ static inline int gpio_chip_hwgpio(const struct gpio_desc *desc) return desc - &desc->gdev->descs[0]; } -void devprop_gpiochip_set_names(struct gpio_chip *chip, - const struct fwnode_handle *fwnode); - /* With descriptor prefix */ #define gpiod_emerg(desc, fmt, ...) \ @@ -264,35 +168,17 @@ void devprop_gpiochip_set_names(struct gpio_chip *chip, /* With chip prefix */ -#define chip_emerg(chip, fmt, ...) \ - dev_emerg(&chip->gpiodev->dev, "(%s): " fmt, chip->label, ##__VA_ARGS__) -#define chip_crit(chip, fmt, ...) \ - dev_crit(&chip->gpiodev->dev, "(%s): " fmt, chip->label, ##__VA_ARGS__) -#define chip_err(chip, fmt, ...) \ - dev_err(&chip->gpiodev->dev, "(%s): " fmt, chip->label, ##__VA_ARGS__) -#define chip_warn(chip, fmt, ...) \ - dev_warn(&chip->gpiodev->dev, "(%s): " fmt, chip->label, ##__VA_ARGS__) -#define chip_info(chip, fmt, ...) \ - dev_info(&chip->gpiodev->dev, "(%s): " fmt, chip->label, ##__VA_ARGS__) -#define chip_dbg(chip, fmt, ...) \ - dev_dbg(&chip->gpiodev->dev, "(%s): " fmt, chip->label, ##__VA_ARGS__) - -#ifdef CONFIG_GPIO_SYSFS - -int gpiochip_sysfs_register(struct gpio_device *gdev); -void gpiochip_sysfs_unregister(struct gpio_device *gdev); - -#else - -static inline int gpiochip_sysfs_register(struct gpio_device *gdev) -{ - return 0; -} - -static inline void gpiochip_sysfs_unregister(struct gpio_device *gdev) -{ -} - -#endif /* CONFIG_GPIO_SYSFS */ +#define chip_emerg(gc, fmt, ...) \ + dev_emerg(&gc->gpiodev->dev, "(%s): " fmt, gc->label, ##__VA_ARGS__) +#define chip_crit(gc, fmt, ...) \ + dev_crit(&gc->gpiodev->dev, "(%s): " fmt, gc->label, ##__VA_ARGS__) +#define chip_err(gc, fmt, ...) \ + dev_err(&gc->gpiodev->dev, "(%s): " fmt, gc->label, ##__VA_ARGS__) +#define chip_warn(gc, fmt, ...) \ + dev_warn(&gc->gpiodev->dev, "(%s): " fmt, gc->label, ##__VA_ARGS__) +#define chip_info(gc, fmt, ...) \ + dev_info(&gc->gpiodev->dev, "(%s): " fmt, gc->label, ##__VA_ARGS__) +#define chip_dbg(gc, fmt, ...) \ + dev_dbg(&gc->gpiodev->dev, "(%s): " fmt, gc->label, ##__VA_ARGS__) #endif /* GPIOLIB_H */ diff --git a/platform/centec-arm64/tsingma-bsp/src/i2c-ctc/i2c-ctc.c b/platform/centec-arm64/tsingma-bsp/src/i2c-ctc/i2c-ctc.c old mode 100644 new mode 100755 index bcae26040d06..0d6b97f2b378 --- a/platform/centec-arm64/tsingma-bsp/src/i2c-ctc/i2c-ctc.c +++ b/platform/centec-arm64/tsingma-bsp/src/i2c-ctc/i2c-ctc.c @@ -1,4 +1,5 @@ -/* Centec I2C controller driver +/* + * Centec I2C controller driver * * Author: Wangyb * @@ -20,6 +21,10 @@ #include #include #include "i2c-ctc.h" +#include "../pinctrl-ctc/pinctrl-ctc.h" +#include "../include/sysctl.h" +#include +#include #define IC_ICK_NS(f) (1000000000 / f) @@ -30,7 +35,7 @@ static char *abort_sources[] = { [ABRT_10ADDR2_NOACK] = "second address byte not acknowledged (10bit mode)", [ABRT_TXDATA_NOACK] = "data not acknowledged", - [ABRT_GCALL_NOACK] = "no acknowledgment for a general call", + [ABRT_GCALL_NOACK] = "no acknowledgement for a general call", [ABRT_GCALL_READ] = "read after general call", [ABRT_SBYTE_ACKDET] = "start byte acknowledged", [ABRT_SBYTE_NORSTRT] = @@ -99,8 +104,7 @@ int i2c_ctc_init(struct ctc_i2c_dev *dev) __i2c_ctc_enable(dev, false); /* Set SCL timing parameters */ - if ((dev->master_cfg & CTC_IC_CON_SPEED_MASK) - == CTC_IC_CON_SPEED_FAST) { + if ((dev->master_cfg & CTC_IC_CON_SPEED_MASK) == CTC_IC_CON_SPEED_FAST) { hcnt = __ctc_calc_fs_cnt(dev->clk_freq) - 14 - 4; lcnt = __ctc_calc_fs_cnt(dev->clk_freq) - 1 - 2; @@ -122,8 +126,9 @@ int i2c_ctc_init(struct ctc_i2c_dev *dev) } /* Configure SDA Hold Time if required */ - if (dev->sda_hold_time) + if (dev->sda_hold_time) { ctc_writel(dev, dev->sda_hold_time, CTC_IC_SDA_HOLD); + } /* Configure Tx/Rx FIFO threshold levels */ comp_param1 = ctc_readl(dev, CTC_IC_COMP_PARAM_1); @@ -139,6 +144,33 @@ int i2c_ctc_init(struct ctc_i2c_dev *dev) return 0; } +int i2c_ctc_recover_bus(struct i2c_adapter *adap) +{ + struct ctc_i2c_dev *dev = i2c_get_adapdata(adap); + u32 val = 0; + + dev_info(dev->dev, "Trying i2c bus recovery\n"); + + if (dev->i2c_num == 0) + val = 0x1; + if (dev->i2c_num == 1) + val = 0x2; + + regmap_write(dev->regmap_base, + offsetof(struct SysCtl_regs, SysI2CResetCtl), val); + val = 0x0; + regmap_write(dev->regmap_base, + offsetof(struct SysCtl_regs, SysI2CResetCtl), val); + + if (dev->soc_ver == CTC_REV_TM_1_1) { + ctc_writel(dev, 0x1, CTC_IC_BUS_CLEAR_EN); + } + + i2c_ctc_init(dev); + + return 0; +} + static int i2c_ctc_wait_bus_not_busy(struct ctc_i2c_dev *dev) { int timeout = 20; @@ -146,7 +178,15 @@ static int i2c_ctc_wait_bus_not_busy(struct ctc_i2c_dev *dev) while (ctc_readl(dev, CTC_IC_STATUS) & CTC_IC_STATUS_ACTIVITY) { if (timeout <= 0) { dev_warn(dev->dev, "timeout waiting for bus ready\n"); - return -ETIMEDOUT; + i2c_recover_bus(&dev->adapter); + + if (ctc_readl(dev, CTC_IC_STATUS) & + CTC_IC_STATUS_ACTIVITY) { + dev_warn(dev->dev, + "timeout waiting for bus ready again\n"); + return -ETIMEDOUT; + } + return 0; } timeout--; usleep_range(1000, 1100); @@ -154,6 +194,16 @@ static int i2c_ctc_wait_bus_not_busy(struct ctc_i2c_dev *dev) return 0; } +void i2c_ctc_disable(struct ctc_i2c_dev *dev) +{ + /* Disable controller */ + __i2c_ctc_enable(dev, false); + + /* Disable all interupts */ + ctc_writel(dev, 0, CTC_IC_INTR_MASK); + ctc_readl(dev, CTC_IC_CLR_INTR); +} + void i2c_ctc_disable_intr(struct ctc_i2c_dev *dev) { ctc_writel(dev, 0, CTC_IC_INTR_MASK); @@ -189,7 +239,7 @@ static void i2c_ctc_xfer_init(struct ctc_i2c_dev *dev) /* Clear and enable interrupts */ ctc_readl(dev, CTC_IC_CLR_INTR); - ctc_writel(dev, CTC_IC_INTR_DEFAULT_MASK, CTC_IC_INTR_MASK); + ctc_writel(dev, CTC_IC_INTR_MASTER_MASK, CTC_IC_INTR_MASK); } static int i2c_ctc_handle_tx_abort(struct ctc_i2c_dev *dev) @@ -199,13 +249,12 @@ static int i2c_ctc_handle_tx_abort(struct ctc_i2c_dev *dev) if (abort_source & CTC_IC_TX_ABRT_NOACK) { for_each_set_bit(i, &abort_source, ARRAY_SIZE(abort_sources)) - dev_dbg(dev->dev, "%s: %s\n", __func__, - abort_sources[i]); + dev_dbg(dev->dev, "%s: %s\n", __func__, abort_sources[i]); return -EREMOTEIO; } for_each_set_bit(i, &abort_source, ARRAY_SIZE(abort_sources)) - dev_err(dev->dev, "%s: %s\n", __func__, abort_sources[i]); + dev_err(dev->dev, "%s: %s\n", __func__, abort_sources[i]); if (abort_source & CTC_IC_TX_ARB_LOST) return -EAGAIN; @@ -241,7 +290,7 @@ static int i2c_ctc_interrupt_transfer(struct ctc_i2c_dev *dev) /* wait for tx to complete */ if (!wait_for_completion_timeout(&dev->cmd_complete, HZ)) { dev_err(dev->dev, "controller timed out\n"); - i2c_ctc_init(dev); + i2c_recover_bus(&dev->adapter); ret = -ETIMEDOUT; goto done; } @@ -287,8 +336,7 @@ static int ctc_i2c_xfer_finish(struct ctc_i2c_dev *dev) CTC_IC_INTR_STOP_DET)) { ctc_readl(dev, CTC_IC_CLR_STOP_DET); break; - } else if (time_after(jiffies, start_stop_det + - I2C_STOPDET_TO)) { + } else if (time_after(jiffies, start_stop_det + I2C_STOPDET_TO)) { break; } } @@ -302,8 +350,8 @@ static int ctc_i2c_xfer_finish(struct ctc_i2c_dev *dev) return 0; } -static int __ctc_i2c_read(struct ctc_i2c_dev *dev, __u16 chip_addr, u8 *offset, - __u16 olen, u8 *data, __u16 dlen) +static int __ctc_i2c_read(struct ctc_i2c_dev *dev, __u16 chip_addr, u8 * offset, + __u16 olen, u8 * data, __u16 dlen) { unsigned int active = 0; unsigned int flag = 0; @@ -371,7 +419,7 @@ static int __ctc_i2c_read(struct ctc_i2c_dev *dev, __u16 chip_addr, u8 *offset, } static int __ctc_i2c_write(struct ctc_i2c_dev *dev, __u16 chip_addr, - u8 *offset, __u16 olen, u8 *data, __u16 dlen) + u8 * offset, __u16 olen, u8 * data, __u16 dlen) { int ret; unsigned long start_time_tx; @@ -401,8 +449,9 @@ static int __ctc_i2c_write(struct ctc_i2c_dev *dev, __u16 chip_addr, } data++; start_time_tx = jiffies; - } else if (time_after(jiffies, start_time_tx + - (nb * I2C_BYTE_TO))) { + } else + if (time_after(jiffies, start_time_tx + (nb * I2C_BYTE_TO))) + { dev_err(dev->dev, "Timed out. i2c write Failed\n"); return -ETIMEDOUT; } @@ -418,8 +467,7 @@ static int i2c_ctc_polling_transfer(struct ctc_i2c_dev *dev) memset(&dummy, 0, sizeof(struct i2c_msg)); /* We expect either two messages (one with an offset and one with the - * actucal data) or one message (just data) - */ + * actucal data) or one message (just data) */ if (dev->msgs_num > 2 || dev->msgs_num == 0) { dev_err(dev->dev, "%s: Only one or two messages are supported.", __func__); @@ -469,7 +517,7 @@ static void i2c_ctc_xfer_msg(struct ctc_i2c_dev *dev) u8 *buf = dev->tx_buf; bool need_restart = false; - intr_mask = CTC_IC_INTR_DEFAULT_MASK; + intr_mask = CTC_IC_INTR_MASTER_MASK; /* msg_write_idx */ for (; dev->msg_write_idx < dev->msgs_num; dev->msg_write_idx++) { @@ -519,14 +567,11 @@ static void i2c_ctc_xfer_msg(struct ctc_i2c_dev *dev) if (rx_limit - dev->rx_outstanding <= 0) break; - /* 1 = Read */ - ctc_writel(dev, cmd | CTC_CMD_READ, - CTC_IC_DATA_CMD); + ctc_writel(dev, cmd | CTC_CMD_READ, CTC_IC_DATA_CMD); /* 1 = Read */ rx_limit--; dev->rx_outstanding++; } else - /* 0 = Write */ - ctc_writel(dev, cmd | *buf++, CTC_IC_DATA_CMD); + ctc_writel(dev, cmd | *buf++, CTC_IC_DATA_CMD); /* 0 = Write */ tx_limit--; buf_len--; } @@ -538,8 +583,8 @@ static void i2c_ctc_xfer_msg(struct ctc_i2c_dev *dev) /* more bytes to be written */ dev->status |= STATUS_WRITE_IN_PROGRESS; break; - } - dev->status &= ~STATUS_WRITE_IN_PROGRESS; + } else + dev->status &= ~STATUS_WRITE_IN_PROGRESS; } if (dev->msg_write_idx == dev->msgs_num) @@ -584,8 +629,8 @@ static void i2c_ctc_read(struct ctc_i2c_dev *dev) dev->rx_buf_len = len; dev->rx_buf = buf; return; - } - dev->status &= ~STATUS_READ_IN_PROGRESS; + } else + dev->status &= ~STATUS_READ_IN_PROGRESS; } } @@ -627,6 +672,7 @@ static irqreturn_t i2c_ctc_isr(int this_irq, void *dev_id) enabled = ctc_readl(dev, CTC_IC_ENABLE); stat = ctc_readl(dev, CTC_IC_RAW_INTR_STAT); + dev_dbg(dev->dev, "%s: enabled=%#x stat=%#x\n", __func__, enabled, stat); if (!enabled || !(stat & ~CTC_IC_INTR_ACTIVITY)) @@ -658,7 +704,6 @@ static irqreturn_t i2c_ctc_isr(int this_irq, void *dev_id) static u32 i2c_ctc_func(struct i2c_adapter *adap) { struct ctc_i2c_dev *dev = i2c_get_adapdata(adap); - return dev->functionality; } @@ -667,6 +712,10 @@ static struct i2c_algorithm i2c_ctc_algo = { .functionality = i2c_ctc_func, }; +static struct i2c_bus_recovery_info i2c_ctc_recovery_info = { + .recover_bus = i2c_ctc_recover_bus, +}; + int i2c_ctc_probe(struct ctc_i2c_dev *dev) { struct i2c_adapter *adap = &dev->adapter; @@ -680,6 +729,7 @@ int i2c_ctc_probe(struct ctc_i2c_dev *dev) snprintf(adap->name, sizeof(adap->name), "Centec TsingMa SoC's I2C adapter"); adap->algo = &i2c_ctc_algo; + adap->bus_recovery_info = &i2c_ctc_recovery_info; adap->dev.parent = dev->dev; i2c_set_adapdata(adap, dev); @@ -708,6 +758,7 @@ static int ctc_i2c_plat_probe(struct platform_device *pdev) struct resource *mem; int irq, ret; u32 clk_freq, ht; + u32 val, i2c_num; irq = platform_get_irq(pdev, 0); if (irq < 0) @@ -722,6 +773,15 @@ static int ctc_i2c_plat_probe(struct platform_device *pdev) if (IS_ERR(dev->base)) return PTR_ERR(dev->base); + dev->regmap_base = + syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "ctc,sysctrl"); + if (IS_ERR(dev->regmap_base)) + return PTR_ERR(dev->regmap_base); + + regmap_read(dev->regmap_base, + offsetof(struct SysCtl_regs, SysCtlSysRev), &val); + dev->soc_ver = ((val == 0x1) ? CTC_REV_TM_1_1 : CTC_REV_TM_1_0); + dev->dev = &pdev->dev; dev->irq = irq; platform_set_drvdata(pdev, dev); @@ -738,17 +798,6 @@ static int ctc_i2c_plat_probe(struct platform_device *pdev) return -EINVAL; } - dev->master_cfg |= - CTC_IC_CON_MASTER | CTC_IC_CON_SLAVE_DISABLE | - CTC_IC_CON_RESTART_EN; - - dev->functionality = - I2C_FUNC_I2C | - I2C_FUNC_10BIT_ADDR | - I2C_FUNC_SMBUS_BYTE | - I2C_FUNC_SMBUS_BYTE_DATA | - I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_I2C_BLOCK; - dev->clk = devm_clk_get(&pdev->dev, NULL); clk_prepare_enable(dev->clk); @@ -757,10 +806,8 @@ static int ctc_i2c_plat_probe(struct platform_device *pdev) dev->sda_hold_time = ht / IC_ICK_NS(clk_get_rate(dev->clk)); } - if (of_property_read_bool(pdev->dev.of_node, "i2c-polling-xfer")) - dev->xfer_type = CTC_IC_POLLING_TRANSFER; - else - dev->xfer_type = CTC_IC_INTERRUPT_TRANSFER; + of_property_read_u32(pdev->dev.of_node, "i2c-num", &i2c_num); + dev->i2c_num = i2c_num; dev->adapter.nr = pdev->id; adap = &dev->adapter; @@ -769,6 +816,7 @@ static int ctc_i2c_plat_probe(struct platform_device *pdev) adap->dev.of_node = pdev->dev.of_node; ret = i2c_ctc_probe(dev); + return ret; } @@ -778,12 +826,7 @@ static int ctc_i2c_plat_remove(struct platform_device *pdev) i2c_del_adapter(&dev->adapter); - /* Disable controller */ - __i2c_ctc_enable(dev, false); - - /* Disable all interupts */ - ctc_writel(dev, 0, CTC_IC_INTR_MASK); - ctc_readl(dev, CTC_IC_CLR_INTR); + i2c_ctc_disable(dev); return 0; } diff --git a/platform/centec-arm64/tsingma-bsp/src/i2c-ctc/i2c-ctc.h b/platform/centec-arm64/tsingma-bsp/src/i2c-ctc/i2c-ctc.h index c27079646a30..407a719ebe91 100644 --- a/platform/centec-arm64/tsingma-bsp/src/i2c-ctc/i2c-ctc.h +++ b/platform/centec-arm64/tsingma-bsp/src/i2c-ctc/i2c-ctc.h @@ -1,4 +1,5 @@ -/* Author: Wangyb +/* + * Author: Wangyb * * Copyright 2005-2018, Centec Networks (Suzhou) Co., Ltd. * @@ -71,7 +72,6 @@ #define CTC_IC_INTR_GEN_CALL 0x800 #define CTC_IC_INTR_DEFAULT_MASK (CTC_IC_INTR_RX_FULL | \ - CTC_IC_INTR_TX_EMPTY | \ CTC_IC_INTR_TX_ABRT | \ CTC_IC_INTR_STOP_DET) @@ -112,7 +112,7 @@ CTC_IC_TX_ABRT_TXDATA_NOACK | \ CTC_IC_TX_ABRT_GCALL_NOACK) -#define CTC_CMD_READ 0x0100 +#define CTC_CMD_READ 0x0100 #define CTC_STOP 0x0200 #define CTC_RESTART 0x0400 @@ -125,6 +125,38 @@ #define CTC_IC_STATUS_MA 0x0020 #define CTC_IC_STATUS_TFE 0x0004 +#define CTC_IC_DEFAULT_FUNCTIONALITY (I2C_FUNC_I2C | \ + I2C_FUNC_SMBUS_BYTE | \ + I2C_FUNC_SMBUS_BYTE_DATA | \ + I2C_FUNC_SMBUS_WORD_DATA | \ + I2C_FUNC_SMBUS_BLOCK_DATA | \ + I2C_FUNC_SMBUS_I2C_BLOCK) + +#define CTC_IC_INTR_MASTER_MASK (CTC_IC_INTR_DEFAULT_MASK | \ + CTC_IC_INTR_TX_EMPTY) + +#define CTC_IC_INTR_SLAVE_MASK (CTC_IC_INTR_DEFAULT_MASK | \ + CTC_IC_INTR_RX_DONE | \ + CTC_IC_INTR_RX_UNDER | \ + CTC_IC_INTR_RD_REQ) + +#define CTC_IC_CON_STOP_DET_IFADDRESSED 0x80 +#define CTC_IC_CON_TX_EMPTY_CTRL 0x100 +#define CTC_IC_CON_RX_FIFO_FULL_HLD_CTRL 0x200 + +#define CTC_IC_SAR 0x8 + +#define CTC_IC_STATUS_SLAVE_ACTIVITY BIT(6) + +#define CTC_IC_BUS_CLEAR_EN 0xb0 +#define CTC_IC_BUS_CLEAR_THRD 0xb4 + +/* + * operation modes + */ +#define CTC_IC_MASTER 0 +#define CTC_IC_SLAVE 1 + enum xfer_type_e { CTC_IC_INTERRUPT_TRANSFER, CTC_IC_POLLING_TRANSFER @@ -159,4 +191,15 @@ struct ctc_i2c_dev { u32 clk_freq; u32 sda_hold_time; u32 xfer_type; + u32 mode; + u32 slave_cfg; + void (*disable) (struct ctc_i2c_dev * dev); + void (*disable_int) (struct ctc_i2c_dev * dev); + int (*init) (struct ctc_i2c_dev * dev); + struct i2c_client *slave; + struct regmap *regmap_base; + u32 soc_ver; +#define CTC_REV_TM_1_0 0x0 +#define CTC_REV_TM_1_1 0x1 + u32 i2c_num; }; diff --git a/platform/centec-arm64/tsingma-bsp/src/include/ctc5236_switch.h b/platform/centec-arm64/tsingma-bsp/src/include/ctc5236_switch.h index aba77b10be32..87a400169d1f 100644 --- a/platform/centec-arm64/tsingma-bsp/src/include/ctc5236_switch.h +++ b/platform/centec-arm64/tsingma-bsp/src/include/ctc5236_switch.h @@ -6,7 +6,7 @@ #define SYS_TSINGMA_TEMP_TABLE_NUM 166 #define SYS_TSINGMA_SENSOR_TIMEOUT 1000 -struct ctc_switch_cmd_status_t { +typedef struct ctc_switch_cmd_status_s { u32 cmdReadType:1; u32 pcieReqCmdChk:3; u32 cmdEntryWords:4; @@ -24,20 +24,20 @@ struct ctc_switch_cmd_status_t { u32 pciePoisoned:1; u32 regProcState:3; u32 pcieReqOverlap:1; -}; +} ctc_switch_cmd_status_t; -union ctc_switch_cmd_status_u_t { - struct ctc_switch_cmd_status_t cmd_status; +typedef union drv_pci_cmd_status_u_e { + ctc_switch_cmd_status_t cmd_status; u32 val; -}; +} ctc_switch_cmd_status_u_t; -struct ctc_access_t { +typedef struct ctc_access_s { u32 cmd_status; u32 addr; u32 data[16]; -}; +} ctc_access_t; -extern int ctc5236_switch_read(u32 offset, u32 len, u32 *p_value); -extern int ctc5236_switch_write(u32 offset, u32 len, u32 *p_value); +extern int ctc5236_switch_read(u32 offset, u32 len, u32 * p_value); +extern int ctc5236_switch_write(u32 offset, u32 len, u32 * p_value); extern int get_switch_temperature(void); #endif diff --git a/platform/centec-arm64/tsingma-bsp/src/include/sysctl.h b/platform/centec-arm64/tsingma-bsp/src/include/sysctl.h index 2201db88558f..58ea49988c38 100644 --- a/platform/centec-arm64/tsingma-bsp/src/include/sysctl.h +++ b/platform/centec-arm64/tsingma-bsp/src/include/sysctl.h @@ -39,7 +39,7 @@ struct SysCtl_regs { u32 SysWarm1ResetEnCtl; /* 0x0000005c */ u32 SysWdt0ResetEnCtl; /* 0x00000060 */ u32 SysWdt1ResetEnCtl; /* 0x00000064 */ - u32 SysCtlReserved; /* 0x00000068 */ + u32 SysCtlSysRev; /* 0x00000068 */ u32 SysEnClkCfg; /* 0x0000006c */ u32 SysPllSocCfg0; /* 0x00000070 */ u32 SysPllSocCfg1; /* 0x00000074 */ @@ -114,7 +114,7 @@ struct SysCtl_regs { u32 SysGpioMultiCtl; /* 0x000001a0 */ u32 rsv105; u32 SysGpioHsMultiCtl[2]; /* 0x000001a8 */ - u32 rsv108; + u32 SysPcieMemCtl; /* 0x000001b0 */ u32 rsv109; u32 SysPcieStatus[2]; /* 0x000001b8 */ u32 SysMsixStatus[8]; /* 0x000001c0 */ @@ -223,15 +223,12 @@ struct SysCtl_regs { u32 DebugAhbRespCnt; /* 0x000006a0 */ u32 DebugGicRespCnt; /* 0x000006a4 */ u32 DebugMemPtrCfg; /* 0x000006a8 */ - u32 rsv427; - u32 rsv428; - u32 rsv429; - u32 rsv430; - u32 rsv431; - u32 rsv432; - u32 rsv433; - u32 rsv434; - u32 rsv435; + u32 SysDdrEccCtl; /* 0x000006ac */ + u32 SysDdrInitStartAddr[2]; /* 0x000006b0 */ + u32 SysDdrInitLastAddr[2]; /* 0x000006b8 */ + u32 SysDdrInitData[2]; /* 0x000006c0 */ + u32 SysDdrInitMode; /* 0x000006c8 */ + u32 SysDdrInitCtl; /* 0x000006cc */ u32 rsv436; u32 rsv437; u32 rsv438; @@ -288,9 +285,14 @@ struct SysCtl_regs { u32 SupMiscInfo1; /* 0x000007b4 */ u32 SupMiscInfo2; /* 0x000007b8 */ u32 SupMiscInfo3; /* 0x000007bc */ + u32 SysBusDbgEn[2]; /* 0x000007c0 */ + u32 SysApbErrLog; /* 0x000007c8 */ + u32 MshClkPadSchmitEn; /* 0x000007cc */ + u32 SysI2C0DebugStatus; /* 0x000007d0 */ + u32 SysI2C1DebugStatus; /* 0x000007d4 */ }; -/* ############################################################################ +/* ################################################################################ * # SysResetCtl Definition */ #define SYS_RESET_CTL_W0_CFG_NIC_RESET BIT(9) @@ -347,7 +349,7 @@ struct SysCtl_regs { #define SYS_RESET_CTL_W0_CFG_CPU_MEM_RESET_MASK 0x00000100 #define SYS_RESET_CTL_W0_LOG_CPU_MEM_RESET_MASK 0x01000000 -/* ############################################################################ +/* ################################################################################ * # SysResetAutoEn Definition */ #define SYS_RESET_AUTO_EN_W0_CFG_CPU1_CORE_RESET_AUTO_EN BIT(3) @@ -382,14 +384,14 @@ struct SysCtl_regs { #define SYS_RESET_AUTO_EN_W0_CFG_CPU1_COLD_RESET_AUTO_EN_MASK 0x00000002 #define SYS_RESET_AUTO_EN_W0_CFG_CPU0_CORE_RESET_AUTO_EN_MASK 0x00000004 -/* ############################################################################ +/* ################################################################################ * # SysGicResetCtl Definition */ #define SYS_GIC_RESET_CTL_W0_CFG_GIC_RESET BIT(0) #define SYS_GIC_RESET_CTL_W0_CFG_GIC_RESET_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # SysWdtResetCtl Definition */ #define SYS_WDT_RESET_CTL_W0_LOG_WDT1_RESET BIT(5) @@ -402,14 +404,14 @@ struct SysCtl_regs { #define SYS_WDT_RESET_CTL_W0_LOG_WDT0_RESET_MASK 0x00000010 #define SYS_WDT_RESET_CTL_W0_CFG_WDT1_RESET_MASK 0x00000002 -/* ############################################################################ +/* ################################################################################ * # SysDmaResetCtl Definition */ #define SYS_DMA_RESET_CTL_W0_CFG_CPU_DMA_RESET BIT(0) #define SYS_DMA_RESET_CTL_W0_CFG_CPU_DMA_RESET_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # SysDdrResetCtl Definition */ #define SYS_DDR_RESET_CTL_W0_CFG_DDR_MC_RESET BIT(2) @@ -420,27 +422,29 @@ struct SysCtl_regs { #define SYS_DDR_RESET_CTL_W0_CFG_DDR_CFG_RESET_MASK 0x00000001 #define SYS_DDR_RESET_CTL_W0_CFG_DDR_AXI_RESET_MASK 0x00000002 -/* ############################################################################ +/* ################################################################################ * # SysPcieResetCtl Definition */ #define SYS_PCIE_RESET_CTL_W0_CFG_PIPE_RESET BIT(1) #define SYS_PCIE_RESET_CTL_W0_CFG_PHY_REG_RESET BIT(3) #define SYS_PCIE_RESET_CTL_W0_CFG_PCIE_RESET BIT(0) #define SYS_PCIE_RESET_CTL_W0_CFG_PCIE_POR BIT(2) +#define SYS_PCIE_RESET_CTL_W0_CFG_PCIE_SUP_RESET BIT(4) #define SYS_PCIE_RESET_CTL_W0_CFG_PIPE_RESET_MASK 0x00000002 #define SYS_PCIE_RESET_CTL_W0_CFG_PHY_REG_RESET_MASK 0x00000008 #define SYS_PCIE_RESET_CTL_W0_CFG_PCIE_RESET_MASK 0x00000001 #define SYS_PCIE_RESET_CTL_W0_CFG_PCIE_POR_MASK 0x00000004 +#define SYS_PCIE_RESET_CTL_W0_CFG_PCIE_SUP_RESET_MASK 0x00000010 -/* ############################################################################ +/* ################################################################################ * # SysMacResetCtl Definition */ #define SYS_MAC_RESET_CTL_W0_CFG_CPU_MAC_RESET BIT(0) #define SYS_MAC_RESET_CTL_W0_CFG_CPU_MAC_RESET_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # SysMshResetCtl Definition */ #define SYS_MSH_RESET_CTL_W0_CFG_MSH_C_TX_RESET BIT(3) @@ -459,7 +463,7 @@ struct SysCtl_regs { #define SYS_MSH_RESET_CTL_W0_CFG_MSH_AXI_RESET_MASK 0x00000001 #define SYS_MSH_RESET_CTL_W0_CFG_MSH_TM_RESET_MASK 0x00000020 -/* ############################################################################ +/* ################################################################################ * # SysUsbResetCtl Definition */ #define SYS_USB_RESET_CTL_W0_CFG_USB_INTF_RESET BIT(0) @@ -478,21 +482,21 @@ struct SysCtl_regs { #define SYS_USB_RESET_CTL_W0_CFG_USB_AUX_RESET_MASK 0x00000002 #define SYS_USB_RESET_CTL_W0_CFG_USB_PHY_PWR_ON_RESET_MASK 0x00000010 -/* ############################################################################ +/* ################################################################################ * # SysSpiResetCtl Definition */ #define SYS_SPI_RESET_CTL_W0_CFG_SPI_RESET BIT(0) #define SYS_SPI_RESET_CTL_W0_CFG_SPI_RESET_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # SysQspiResetCtl Definition */ #define SYS_QSPI_RESET_CTL_W0_CFG_QSPI_RESET BIT(0) #define SYS_QSPI_RESET_CTL_W0_CFG_QSPI_RESET_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # SysAxiSupResetCtl Definition */ #define SYS_AXI_SUP_RESET_CTL_W0_CFG_SWITCH_CORE_RESET BIT(1) @@ -503,14 +507,14 @@ struct SysCtl_regs { #define SYS_AXI_SUP_RESET_CTL_W0_CFG_SWITCH_SUP_RESET_MASK 0x00000004 #define SYS_AXI_SUP_RESET_CTL_W0_CFG_AXI_SUP_RESET_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # SysGpioResetCtl Definition */ #define SYS_GPIO_RESET_CTL_W0_CFG_GPIO_RESET BIT(0) #define SYS_GPIO_RESET_CTL_W0_CFG_GPIO_RESET_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # SysI2CResetCtl Definition */ #define SYS_I2_C_RESET_CTL_W0_CFG_I2_C0_RESET BIT(0) @@ -519,21 +523,21 @@ struct SysCtl_regs { #define SYS_I2_C_RESET_CTL_W0_CFG_I2_C0_RESET_MASK 0x00000001 #define SYS_I2_C_RESET_CTL_W0_CFG_I2_C1_RESET_MASK 0x00000002 -/* ############################################################################ +/* ################################################################################ * # SysMdioSocResetCtl Definition */ #define SYS_MDIO_SOC_RESET_CTL_W0_CFG_MDIO_SOC_RESET BIT(0) #define SYS_MDIO_SOC_RESET_CTL_W0_CFG_MDIO_SOC_RESET_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # SysTimerResetCtl Definition */ #define SYS_TIMER_RESET_CTL_W0_CFG_TIMER_RESET BIT(0) #define SYS_TIMER_RESET_CTL_W0_CFG_TIMER_RESET_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # SysUartResetCtl Definition */ #define SYS_UART_RESET_CTL_W0_CFG_UART1_RESET BIT(1) @@ -544,14 +548,14 @@ struct SysCtl_regs { #define SYS_UART_RESET_CTL_W0_CFG_UART2_RESET_MASK 0x00000004 #define SYS_UART_RESET_CTL_W0_CFG_UART0_RESET_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # SysTraceResetCtl Definition */ #define SYS_TRACE_RESET_CTL_W0_CFG_TRACE_RESET BIT(0) #define SYS_TRACE_RESET_CTL_W0_CFG_TRACE_RESET_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # SysDbg0ResetEnCtl Definition */ #define SYS_DBG0_RESET_EN_CTL_W0_DBG0_RST_EN_CPU_L2 BIT(4) @@ -580,7 +584,7 @@ struct SysCtl_regs { #define SYS_DBG0_RESET_EN_CTL_W0_DBG0_RST_EN_JTAG_POT_MASK 0x00000040 #define SYS_DBG0_RESET_EN_CTL_W0_DBG0_RST_EN_CPU_APB_MASK 0x00000020 -/* ############################################################################ +/* ################################################################################ * # SysDbg1ResetEnCtl Definition */ #define SYS_DBG1_RESET_EN_CTL_W0_DBG1_RST_EN_CPU1_CORE BIT(3) @@ -609,7 +613,7 @@ struct SysCtl_regs { #define SYS_DBG1_RESET_EN_CTL_W0_DBG1_RST_EN_WDT1_MASK 0x00000400 #define SYS_DBG1_RESET_EN_CTL_W0_DBG1_RST_EN_NIC_MASK 0x00000800 -/* ############################################################################ +/* ################################################################################ * # SysWarm0ResetEnCtl Definition */ #define SYS_WARM0_RESET_EN_CTL_W0_WARM0_RST_EN_CPU1_COLD BIT(1) @@ -638,7 +642,7 @@ struct SysCtl_regs { #define SYS_WARM0_RESET_EN_CTL_W0_WARM0_RST_EN_NIC_MASK 0x00000800 #define SYS_WARM0_RESET_EN_CTL_W0_WARM0_RST_EN_CPU1_CORE_MASK 0x00000008 -/* ############################################################################ +/* ################################################################################ * # SysWarm1ResetEnCtl Definition */ #define SYS_WARM1_RESET_EN_CTL_W0_WARM1_RST_EN_CPU_MEM BIT(8) @@ -667,7 +671,7 @@ struct SysCtl_regs { #define SYS_WARM1_RESET_EN_CTL_W0_WARM1_RST_EN_JTAG_POT_MASK 0x00000040 #define SYS_WARM1_RESET_EN_CTL_W0_WARM1_RST_EN_CPU0_CORE_MASK 0x00000004 -/* ############################################################################ +/* ################################################################################ * # SysWdt0ResetEnCtl Definition */ #define SYS_WDT0_RESET_EN_CTL_W0_WDT0_RST_EN_CPU_L2 BIT(4) @@ -696,7 +700,7 @@ struct SysCtl_regs { #define SYS_WDT0_RESET_EN_CTL_W0_WDT0_RST_EN_CPU0_COLD_MASK 0x00000001 #define SYS_WDT0_RESET_EN_CTL_W0_WDT0_RST_EN_NIC_MASK 0x00000800 -/* ############################################################################ +/* ################################################################################ * # SysWdt1ResetEnCtl Definition */ #define SYS_WDT1_RESET_EN_CTL_W0_WDT1_RST_EN_CPU_L2 BIT(4) @@ -725,14 +729,16 @@ struct SysCtl_regs { #define SYS_WDT1_RESET_EN_CTL_W0_WDT1_RST_EN_CPU0_CORE_MASK 0x00000004 #define SYS_WDT1_RESET_EN_CTL_W0_WDT1_RST_EN_NIC_MASK 0x00000800 -/* ############################################################################ - * # SysCtlReserved Definition +/* ################################################################################ + * # SysCtlSysRev Definition */ -#define SYS_CTL_RESERVED_W0_RESERVED BIT(0) +#define SYS_CTL_RESERVED_W0_RESERVED BIT(4) +#define SYS_CTL_RESERVED_W0_SYS_REV BIT(0) -#define SYS_CTL_RESERVED_W0_RESERVED_MASK 0xffffffff +#define SYS_CTL_RESERVED_W0_RESERVED_MASK 0xfffffff0 +#define SYS_CTL_RESERVED_W0_SYS_REV_MASK 0x0000000f -/* ############################################################################ +/* ################################################################################ * # SysEnClkCfg Definition */ #define SYS_EN_CLK_CFG_W0_CFG_EN_CLK_MSH BIT(2) @@ -763,7 +769,7 @@ struct SysCtl_regs { #define SYS_EN_CLK_CFG_W0_CFG_EN_CLK_AXI_SUP_MASK 0x00000200 #define SYS_EN_CLK_CFG_W0_CFG_EN_CLK_QSPI_MASK 0x00000800 -/* ############################################################################ +/* ################################################################################ * # SysPllSocCfg0 Definition */ #define SYS_PLL_SOC_CFG0_W0_PLL_SOC_POST_DIV BIT(12) @@ -782,7 +788,7 @@ struct SysCtl_regs { #define SYS_PLL_SOC_CFG0_W0_PLL_SOC_RESET_MASK 0x00000001 #define SYS_PLL_SOC_CFG0_W0_PLL_SOC_PLL_PWD_MASK 0x00000008 -/* ############################################################################ +/* ################################################################################ * # SysPllSocCfg1 Definition */ #define SYS_PLL_SOC_CFG1_W0_PLL_SOC_BYPASS BIT(24) @@ -799,7 +805,7 @@ struct SysCtl_regs { #define SYS_PLL_SOC_CFG1_W0_MON_PLL_SOC_LOCK_MASK 0x10000000 #define SYS_PLL_SOC_CFG1_W0_PLL_SOC_SIC_MASK 0x00001f00 -/* ############################################################################ +/* ################################################################################ * # SysPllDdrCfg0 Definition */ #define SYS_PLL_DDR_CFG0_W0_PLL_DDR_DCO_BYPASS BIT(1) @@ -818,7 +824,7 @@ struct SysCtl_regs { #define SYS_PLL_DDR_CFG0_W0_PLL_DDR_MULT_INT_MASK 0x0ff00000 #define SYS_PLL_DDR_CFG0_W0_PLL_DDR_POST_DIV_MASK 0x0003f000 -/* ############################################################################ +/* ################################################################################ * # SysPllDdrCfg1 Definition */ #define SYS_PLL_DDR_CFG1_W0_PLL_DDR_SLOCK BIT(16) @@ -835,7 +841,7 @@ struct SysCtl_regs { #define SYS_PLL_DDR_CFG1_W0_PLL_DDR_SIP_MASK 0x0000001f #define SYS_PLL_DDR_CFG1_W0_PLL_DDR_SGAIN_MASK 0x00700000 -/* ############################################################################ +/* ################################################################################ * # SysClkSelCfg Definition */ #define SYS_CLK_SEL_CFG_W0_RELEASE_DIV_CLK BIT(1) @@ -844,7 +850,7 @@ struct SysCtl_regs { #define SYS_CLK_SEL_CFG_W0_RELEASE_DIV_CLK_MASK 0x00000002 #define SYS_CLK_SEL_CFG_W0_SUP_CLOCK_SEL_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # SysClkDivCfg Definition */ #define SYS_CLK_DIV_CFG_W0_CFG_DIV_AHB_CNT BIT(8) @@ -857,7 +863,7 @@ struct SysCtl_regs { #define SYS_CLK_DIV_CFG_W0_CFG_DIV_CST_CNT_MASK 0x000000ff #define SYS_CLK_DIV_CFG_W0_CFG_DIV_MSH_CNT_MASK 0xff000000 -/* ############################################################################ +/* ################################################################################ * # SysClkPeriCfg Definition */ #define SYS_CLK_PERI_CFG_W0_CFG_DIV_USB_PHY_CNT BIT(16) @@ -876,7 +882,7 @@ struct SysCtl_regs { #define SYS_CLK_PERI_CFG_W1_CFG_DIV_MSH_TM_CNT_MASK 0x000007ff #define SYS_CLK_PERI_CFG_W1_CFG_DIV_MDIO_SOC_CNT_MASK 0x07ff0000 -/* ############################################################################ +/* ################################################################################ * # SysDbgCreditCtl Definition */ #define SYS_DBG_CREDIT_CTL_W0_DBG_CREDIT_CNT BIT(8) @@ -889,14 +895,14 @@ struct SysCtl_regs { #define SYS_DBG_CREDIT_CTL_W0_DBG_CREDIT_OK_MASK 0x00001000 #define SYS_DBG_CREDIT_CTL_W0_CFG_DBG_CREDIT_THRD_MASK 0x00000070 -/* ############################################################################ +/* ################################################################################ * # SysI2CMultiCtl Definition */ #define SYS_I2_C_MULTI_CTL_W0_CFG_I2_C_SLAVE_EN BIT(0) #define SYS_I2_C_MULTI_CTL_W0_CFG_I2_C_SLAVE_EN_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # BootStrapPin Definition */ #define BOOT_STRAP_PIN_W0_BOOT_STRAP_LOG BIT(0) @@ -905,7 +911,7 @@ struct SysCtl_regs { #define BOOT_STRAP_PIN_W0_BOOT_STRAP_LOG_MASK 0x00000007 #define BOOT_STRAP_PIN_W0_CPU_SPEED_LOG_MASK 0x00000010 -/* ############################################################################ +/* ################################################################################ * # SysCntValue Definition */ #define SYS_CNT_VALUE_W0_SYS_CNT_VALUE_READ_31_0 BIT(0) @@ -914,7 +920,7 @@ struct SysCtl_regs { #define SYS_CNT_VALUE_W0_SYS_CNT_VALUE_READ_31_0_MASK 0x00000001 #define SYS_CNT_VALUE_W1_SYS_CNT_VALUE_READ_63_32_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # SysCntLog Definition */ #define SYS_CNT_LOG_W0_SYS_CNT_HALT_READ BIT(1) @@ -927,14 +933,14 @@ struct SysCtl_regs { #define SYS_CNT_LOG_W0_SYS_CNT_DIV_READ_MASK 0x03ff0000 #define SYS_CNT_LOG_W0_SYS_CNT_EN_READ_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # SysCoreGicAddrBase Definition */ #define SYS_CORE_GIC_ADDR_BASE_W0_CFG_GIC_REG_BASE BIT(0) #define SYS_CORE_GIC_ADDR_BASE_W0_CFG_GIC_REG_BASE_MASK 0x00ffffff -/* ############################################################################ +/* ################################################################################ * # SysCorePmCfg Definition */ #define SYS_CORE_PM_CFG_W0_LOG_L2_Q_ACCEPTN BIT(1) @@ -949,7 +955,7 @@ struct SysCtl_regs { #define SYS_CORE_PM_CFG_W0_CFG_L2_Q_REQN_MASK 0x00000100 #define SYS_CORE_PM_CFG_W0_LOG_L2_Q_ACTIVE_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # SysCoreStatus Definition */ #define SYS_CORE_STATUS_W0_CORE_STANDBY_WFI_L2 BIT(7) @@ -976,39 +982,39 @@ struct SysCtl_regs { #define SYS_CORE_STATUS_W0_CFG_CORE0_EVENT_RAW_MASK 0x00040000 #define SYS_CORE_STATUS_W0_CFG_CORE1_EVENT_RAW_MASK 0x00080000 -/* ############################################################################ +/* ################################################################################ * # SysCorePmuEvent0 Definition */ #define SYS_CORE_PMU_EVENT0_W0_CORE0_PMU_EVENT BIT(0) #define SYS_CORE_PMU_EVENT0_W0_CORE0_PMU_EVENT_MASK 0x3fffffff -/* ############################################################################ +/* ################################################################################ * # SysCorePmuEvent1 Definition */ #define SYS_CORE_PMU_EVENT1_W0_CORE1_PMU_EVENT BIT(0) #define SYS_CORE_PMU_EVENT1_W0_CORE1_PMU_EVENT_MASK 0x3fffffff -/* ############################################################################ +/* ################################################################################ * # SysRstVecBar0 Definition */ #define SYS_RST_VEC_BAR0_W0_CFG_RV_BAR_ADDR0_31_0 BIT(0) #define SYS_RST_VEC_BAR0_W1_CFG_RV_BAR_ADDR0_39_32 BIT(0) -#define SYS_RST_VEC_BAR0_W0_CFG_RV_BAR_ADDR0_31_0_MASK 0x00000001 -#define SYS_RST_VEC_BAR0_W1_CFG_RV_BAR_ADDR0_39_32_MASK 0x00000001 +#define SYS_RST_VEC_BAR0_W0_CFG_RV_BAR_ADDR0_31_0_MASK 0xffffffff +#define SYS_RST_VEC_BAR0_W1_CFG_RV_BAR_ADDR0_39_32_MASK 0x000000ff -/* ############################################################################ +/* ################################################################################ * # SysRstVecBar1 Definition */ #define SYS_RST_VEC_BAR1_W0_CFG_RV_BAR_ADDR1_31_0 BIT(0) #define SYS_RST_VEC_BAR1_W1_CFG_RV_BAR_ADDR1_39_32 BIT(0) -#define SYS_RST_VEC_BAR1_W0_CFG_RV_BAR_ADDR1_31_0_MASK 0x00000001 -#define SYS_RST_VEC_BAR1_W1_CFG_RV_BAR_ADDR1_39_32_MASK 0x00000001 +#define SYS_RST_VEC_BAR1_W0_CFG_RV_BAR_ADDR1_31_0_MASK 0xffffffff +#define SYS_RST_VEC_BAR1_W1_CFG_RV_BAR_ADDR1_39_32_MASK 0x000000ff -/* ############################################################################ +/* ################################################################################ * # SysGicCfg Definition */ #define SYS_GIC_CFG_W0_CFG_GIC_LEGACY_IRQ_BAR BIT(4) @@ -1021,7 +1027,7 @@ struct SysCtl_regs { #define SYS_GIC_CFG_W0_CFG_GIC_LEGACY_FIQ_BAR_MASK 0x00000003 #define SYS_GIC_CFG_W0_CFG_GIC_RA_USER_MASK 0x00000100 -/* ############################################################################ +/* ################################################################################ * # SysGicStatus Definition */ #define SYS_GIC_STATUS_W0_GIC_FIQ_OUT_LOG BIT(0) @@ -1030,7 +1036,7 @@ struct SysCtl_regs { #define SYS_GIC_STATUS_W0_GIC_FIQ_OUT_LOG_MASK 0x00000003 #define SYS_GIC_STATUS_W0_GIC_IRQ_OUT_LOG_MASK 0x0000000c -/* ############################################################################ +/* ################################################################################ * # SysMemCtl Definition */ #define SYS_MEM_CTL_W0_CFG_RAM_MUX_EN BIT(0) @@ -1043,7 +1049,7 @@ struct SysCtl_regs { #define SYS_MEM_CTL_W0_CFG_SYS_DBG_EN_MASK 0x00000010 #define SYS_MEM_CTL_W0_CFG_RAM_REMAP_MASK 0x00000002 -/* ############################################################################ +/* ################################################################################ * # SysDmaMapCfg Definition */ #define SYS_DMA_MAP_CFG_W0_CFG_CPU_DMA_WR_MAP_LOW BIT(0) @@ -1056,7 +1062,7 @@ struct SysCtl_regs { #define SYS_DMA_MAP_CFG_W0_CFG_CPU_DMA_RD_MAP_HIGH_MASK 0x0f000000 #define SYS_DMA_MAP_CFG_W0_CFG_CPU_DMA_RD_MAP_LOW_MASK 0x00000f00 -/* ############################################################################ +/* ################################################################################ * # SysDmaAbortCfg Definition */ #define SYS_DMA_ABORT_CFG_W0_DMA_ABORT_LEVEL_EN BIT(4) @@ -1065,7 +1071,7 @@ struct SysCtl_regs { #define SYS_DMA_ABORT_CFG_W0_DMA_ABORT_LEVEL_EN_MASK 0x00000010 #define SYS_DMA_ABORT_CFG_W0_DMA_ABORT_STATUS_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # SysCstCfg Definition */ #define SYS_CST_CFG_W0_CFG_CST_PIU_TP_CTL BIT(4) @@ -1078,21 +1084,21 @@ struct SysCtl_regs { #define SYS_CST_CFG_W0_CFG_CST_INSTANCE_ID_MASK 0x0000000f #define SYS_CST_CFG_W0_CFG_CST_DEVICE_EN_MASK 0x00000020 -/* ############################################################################ +/* ################################################################################ * # SysCstTargetIdCfg Definition */ #define SYS_CST_TARGET_ID_CFG_W0_CFG_CST_TARGET_ID BIT(0) #define SYS_CST_TARGET_ID_CFG_W0_CFG_CST_TARGET_ID_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # SysCstMemMapIdCfg Definition */ #define SYS_CST_MEM_MAP_ID_CFG_W0_CFG_CST_MEM_MAP_TARGET_ID BIT(0) #define SYS_CST_MEM_MAP_ID_CFG_W0_CFG_CST_MEM_MAP_TARGET_ID_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # SysQspiBootCfg0 Definition */ #define SYS_QSPI_BOOT_CFG0_W0_QSPI_BOOT_EN_CPHA BIT(4) @@ -1115,7 +1121,7 @@ struct SysCtl_regs { #define SYS_QSPI_BOOT_CFG0_W0_QSPI_BOOT_EN_CPOL_MASK 0x00000020 #define SYS_QSPI_BOOT_CFG0_W0_QSPI_BOOT_CLK_DIV_MASK 0x00ff0000 -/* ############################################################################ +/* ################################################################################ * # SysQspiBootCfg1 Definition */ #define SYS_QSPI_BOOT_CFG1_W0_QSPI_BOOT_CMD_CODE BIT(24) @@ -1130,7 +1136,7 @@ struct SysCtl_regs { #define SYS_QSPI_BOOT_CFG1_W0_QSPI_BOOT_ADDR_MODE_MASK 0x00000700 #define SYS_QSPI_BOOT_CFG1_W0_QSPI_BOOT_ADDR_CYCLE_MASK 0x0000003f -/* ############################################################################ +/* ################################################################################ * # SysQspiBootCfg2 Definition */ #define SYS_QSPI_BOOT_CFG2_W0_QSPI_BOOT_DUMMY_MODE BIT(8) @@ -1139,14 +1145,14 @@ struct SysCtl_regs { #define SYS_QSPI_BOOT_CFG2_W0_QSPI_BOOT_DUMMY_MODE_MASK 0x00000700 #define SYS_QSPI_BOOT_CFG2_W0_QSPI_BOOT_DUMMY_CYCLE_MASK 0x0000003f -/* ############################################################################ +/* ################################################################################ * # SysQspiBootCfg3 Definition */ #define SYS_QSPI_BOOT_CFG3_W0_QSPI_BOOT_DUMMY_CODE BIT(0) #define SYS_QSPI_BOOT_CFG3_W0_QSPI_BOOT_DUMMY_CODE_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # SysDdrCfg Definition */ #define SYS_DDR_CFG_W0_DDR_RESET_CK_E_LATCH_BAR BIT(0) @@ -1154,14 +1160,18 @@ struct SysCtl_regs { #define SYS_DDR_CFG_W0_DDR_PHY_IDDQ BIT(4) #define SYS_DDR_CFG_W0_DDR_VDD_ON BIT(2) #define SYS_DDR_CFG_W0_DDR_PWR_OFF_PHY BIT(1) +#define SYS_DDR_CFG_W0_DDR_INTF2_ADDR_TRANS_EN BIT(5) +#define SYS_DDR_CFG_W0_DDR_INTF3_ADDR_TRANS_EN BIT(6) #define SYS_DDR_CFG_W0_DDR_RESET_CK_E_LATCH_BAR_MASK 0x00000001 #define SYS_DDR_CFG_W0_DDR_FORCE_STA_CK_STP1_MASK 0x00000008 #define SYS_DDR_CFG_W0_DDR_PHY_IDDQ_MASK 0x00000010 #define SYS_DDR_CFG_W0_DDR_VDD_ON_MASK 0x00000004 #define SYS_DDR_CFG_W0_DDR_PWR_OFF_PHY_MASK 0x00000002 +#define SYS_DDR_CFG_W0_DDR_INTF2_ADDR_TRANS_EN_MASK 0x00000020 +#define SYS_DDR_CFG_W0_DDR_INTF3_ADDR_TRANS_EN_MASK 0x00000040 -/* ############################################################################ +/* ################################################################################ * # SysSpiSelCfg Definition */ #define SYS_SPI_SEL_CFG_W0_SSP_SLAVE_SEL BIT(0) @@ -1170,7 +1180,7 @@ struct SysCtl_regs { #define SYS_SPI_SEL_CFG_W0_SSP_SLAVE_SEL_MASK 0x00000003 #define SYS_SPI_SEL_CFG_W0_SSP_CS_CFG_CTL_MASK 0x000000f0 -/* ############################################################################ +/* ################################################################################ * # SysMdioSocCfg Definition */ #define SYS_MDIO_SOC_CFG_W0_CFG_EN_CLK_MDIO_SOC BIT(4) @@ -1181,35 +1191,35 @@ struct SysCtl_regs { #define SYS_MDIO_SOC_CFG_W0_CFG_INV_MDIO_SOC_MASK 0x00000001 #define SYS_MDIO_SOC_CFG_W0_CFG_EN_CLK_MDIO_SOC_REG_MASK 0x00000020 -/* ############################################################################ +/* ################################################################################ * # SysWdt0Cnt Definition */ #define SYS_WDT0_CNT_W0_CFG_WDT0_DIV_CNT BIT(0) #define SYS_WDT0_CNT_W0_CFG_WDT0_DIV_CNT_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # SysWdt0Rev Definition */ #define SYS_WDT0_REV_W0_CFG_WDT0_ECO_REV BIT(0) #define SYS_WDT0_REV_W0_CFG_WDT0_ECO_REV_MASK 0x0000000f -/* ############################################################################ +/* ################################################################################ * # SysWdt1Cnt Definition */ #define SYS_WDT1_CNT_W0_CFG_WDT1_DIV_CNT BIT(0) #define SYS_WDT1_CNT_W0_CFG_WDT1_DIV_CNT_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # SysWdt1Rev Definition */ #define SYS_WDT1_REV_W0_CFG_WDT1_ECO_REV BIT(0) #define SYS_WDT1_REV_W0_CFG_WDT1_ECO_REV_MASK 0x0000000f -/* ############################################################################ +/* ################################################################################ * # SysMshCfg Definition */ #define SYS_MSH_CFG_W0_CFG_MSH_CARD_DETECT_IN_EN BIT(4) @@ -1236,7 +1246,7 @@ struct SysCtl_regs { #define SYS_MSH_CFG_W0_MSH_INTF_AT_DLL_MASTER_BYPASS_MASK 0x00000001 #define SYS_MSH_CFG_W0_CFG_MSH_CARD_WRITE_PROT_IN_EN_MASK 0x00000040 -/* ############################################################################ +/* ################################################################################ * # SysMshStatus Definition */ #define SYS_MSH_STATUS_W0_MON_MSH_C_RESET_DONE BIT(2) @@ -1251,7 +1261,7 @@ struct SysCtl_regs { #define SYS_MSH_STATUS_W0_MON_MSH_AT_DLL_LOCK_MASK 0x00000010 #define SYS_MSH_STATUS_W0_MON_MSH_RX_DLL_LOCK_MASK 0x00000020 -/* ############################################################################ +/* ################################################################################ * # SysUsbCfg0 Definition */ #define SYS_USB_CFG0_W0_USB_PHY_TX_PRE_EMP_AMP_TUNE BIT(2) @@ -1284,7 +1294,7 @@ struct SysCtl_regs { #define SYS_USB_CFG0_W0_USB_PHY_TX_PRE_EMP_PULSE_TUNE_MASK 0x00000080 #define SYS_USB_CFG0_W0_USB_PHY_SQ_RX_TUNE_MASK 0x00007000 -/* ############################################################################ +/* ################################################################################ * # SysUsbCfg1 Definition */ #define SYS_USB_CFG1_W0_USB_INTF_AUTOPPD_ON_OVERCUR_EN BIT(1) @@ -1309,7 +1319,7 @@ struct SysCtl_regs { #define SYS_USB_CFG1_W0_USB_INTF_SIM_MODE_MASK 0x00008000 #define SYS_USB_CFG1_W0_USB_INTF_HUBSETUP_MIN_MASK 0x00000004 -/* ############################################################################ +/* ################################################################################ * # SysUsbCfg2 Definition */ #define SYS_USB_CFG2_W0_USB_PHY_PLL_P_TUNE BIT(8) @@ -1326,7 +1336,7 @@ struct SysCtl_regs { #define SYS_USB_CFG2_W0_USB_PHY_OTG_TUNE_MASK 0x00000007 #define SYS_USB_CFG2_W0_USB_PHY_VDAT_REF_TUNE_MASK 0x00003000 -/* ############################################################################ +/* ################################################################################ * # SysUsbStatus Definition */ #define SYS_USB_STATUS_W0_USB_INTF_EHCI_LPSMC_STATE BIT(0) @@ -1345,14 +1355,14 @@ struct SysCtl_regs { #define SYS_USB_STATUS_W0_USB_INTF_OHCI_GLOBALSUSPEND_MASK 0x00020000 #define SYS_USB_STATUS_W0_USB_INTF_OHCI_RMTWKP_MASK 0x00080000 -/* ############################################################################ +/* ################################################################################ * # SysPcieBaseCfg Definition */ #define SYS_PCIE_BASE_CFG_W0_PCIE_BASE_CFG BIT(0) #define SYS_PCIE_BASE_CFG_W0_PCIE_BASE_CFG_MASK 0x000fffff -/* ############################################################################ +/* ################################################################################ * # SysRegCfg Definition */ #define SYS_REG_CFG_W0_EN_CLK_GLOBAL_SYS BIT(0) @@ -1361,7 +1371,7 @@ struct SysCtl_regs { #define SYS_REG_CFG_W0_EN_CLK_GLOBAL_SYS_MASK 0x00000001 #define SYS_REG_CFG_W0_CFG_SOC_ACC_DIR_EN_MASK 0x00000002 -/* ############################################################################ +/* ################################################################################ * # SysInitCtl Definition */ #define SYS_INIT_CTL_W0_CPU_MEM_INIT_DONE BIT(1) @@ -1374,7 +1384,7 @@ struct SysCtl_regs { #define SYS_INIT_CTL_W1_CFG_INIT_START_PTR_MASK 0x00007fff #define SYS_INIT_CTL_W1_CFG_INIT_END_PTR_MASK 0x7fff0000 -/* ############################################################################ +/* ################################################################################ * # SysPllSupCfg0 Definition */ #define SYS_PLL_SUP_CFG0_W0_PLL_SUP_PLL_PWD BIT(3) @@ -1393,7 +1403,7 @@ struct SysCtl_regs { #define SYS_PLL_SUP_CFG0_W0_PLL_SUP_DCO_BYPASS_MASK 0x00000002 #define SYS_PLL_SUP_CFG0_W0_PLL_SUP_POST_DIV_MASK 0x0003f000 -/* ############################################################################ +/* ################################################################################ * # SysPllSupCfg1 Definition */ #define SYS_PLL_SUP_CFG1_W0_MON_PLL_SUP_LOCK BIT(28) @@ -1410,14 +1420,14 @@ struct SysCtl_regs { #define SYS_PLL_SUP_CFG1_W0_PLL_SUP_SLOCK_MASK 0x00010000 #define SYS_PLL_SUP_CFG1_W0_PLL_SUP_BYPASS_MASK 0x01000000 -/* ############################################################################ +/* ################################################################################ * # SysApbProcTimer Definition */ #define SYS_APB_PROC_TIMER_W0_CFG_APB_PROC_TIMER BIT(0) #define SYS_APB_PROC_TIMER_W0_CFG_APB_PROC_TIMER_MASK 0x0000ffff -/* ############################################################################ +/* ################################################################################ * # SysUsbTest Definition */ #define SYS_USB_TEST_W0_USB_PHY_TEST_DATA_IN BIT(8) @@ -1432,7 +1442,7 @@ struct SysCtl_regs { #define SYS_USB_TEST_W1_USB_PHY_TEST_CLK_MASK 0x00010000 #define SYS_USB_TEST_W1_USB_PHY_TEST_DATA_OUT_MASK 0x0000000f -/* ############################################################################ +/* ################################################################################ * # SysGpioMultiCtl Definition */ #define SYS_GPIO_MULTI_CTL_W0_CFG_GPIO14_SEL BIT(28) @@ -1469,7 +1479,7 @@ struct SysCtl_regs { #define SYS_GPIO_MULTI_CTL_W0_CFG_GPIO12_SEL_MASK 0x03000000 #define SYS_GPIO_MULTI_CTL_W0_CFG_GPIO4_SEL_MASK 0x00000300 -/* ############################################################################ +/* ################################################################################ * # SysGpioHsMultiCtl Definition */ #define SYS_GPIO_HS_MULTI_CTL_W0_CFG_GPIO_HS13_SEL BIT(26) @@ -1510,7 +1520,22 @@ struct SysCtl_regs { #define SYS_GPIO_HS_MULTI_CTL_W1_CFG_GPIO_HS17_SEL_MASK 0x0000000c #define SYS_GPIO_HS_MULTI_CTL_W1_CFG_GPIO_HS16_SEL_MASK 0x00000003 -/* ############################################################################ +/* ################################################################################ + * # SysPcieMemCtl Definition + */ +#define SYS_PCIE_MEM_CTL_W0_CFG_AXI4_LITE_BYTE BIT(4) +#define SYS_PCIE_MEM_CTL_W0_CFG_AXI4_LITE_MASK BIT(0) +#define SYS_PCIE_MEM_CTL_W0_CFG_AXI4_LITE_PROT BIT(8) +#define SYS_PCIE_MEM_CTL_W0_LOG_AXI4_LITE_RD_RESP BIT(16) +#define SYS_PCIE_MEM_CTL_W0_LOG_AXI4_LITE_WR_RESP BIT(20) + +#define SYS_PCIE_MEM_CTL_W0_CFG_AXI4_LITE_BYTE_MASK 0x00000030 +#define SYS_PCIE_MEM_CTL_W0_CFG_AXI4_LITE_MASK_MASK 0x0000000f +#define SYS_PCIE_MEM_CTL_W0_CFG_AXI4_LITE_PROT_MASK 0x00000700 +#define SYS_PCIE_MEM_CTL_W0_LOG_AXI4_LITE_RD_RESP_MASK 0x00030000 +#define SYS_PCIE_MEM_CTL_W0_LOG_AXI4_LITE_WR_RESP_MASK 0x00300000 + +/* ################################################################################ * # SysPcieStatus Definition */ #define SYS_PCIE_STATUS_W0_PCIE_LTSSM_LOG_31_0 BIT(0) @@ -1519,7 +1544,7 @@ struct SysCtl_regs { #define SYS_PCIE_STATUS_W0_PCIE_LTSSM_LOG_31_0_MASK 0x00000001 #define SYS_PCIE_STATUS_W1_PCIE_LTSSM_LOG_63_32_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # SysMsixStatus Definition */ #define SYS_MSIX_STATUS_W0_MSIX_STATUS0 BIT(0) @@ -1540,7 +1565,7 @@ struct SysCtl_regs { #define SYS_MSIX_STATUS_W6_MSIX_STATUS6_MASK 0xffffffff #define SYS_MSIX_STATUS_W7_MSIX_STATUS7_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # SysMsixMask Definition */ #define SYS_MSIX_MASK_W0_MSIX_MASK0 BIT(0) @@ -1561,35 +1586,35 @@ struct SysCtl_regs { #define SYS_MSIX_MASK_W6_MSIX_MASK6_MASK 0xffffffff #define SYS_MSIX_MASK_W7_MSIX_MASK7_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # SysMsixAddr Definition */ #define SYS_MSIX_ADDR_W0_MSIX_ADDR BIT(0) #define SYS_MSIX_ADDR_W0_MSIX_ADDR_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # SysMsixVecCtl Definition */ #define SYS_MSIX_VEC_CTL_W0_MSIX_VEC_EN BIT(0) #define SYS_MSIX_VEC_CTL_W0_MSIX_VEC_EN_MASK 0x000000ff -/* ############################################################################ +/* ################################################################################ * # SysMsixAddrEn Definition */ #define SYS_MSIX_ADDR_EN_W0_MSIX_ADDR_EN BIT(0) #define SYS_MSIX_ADDR_EN_W0_MSIX_ADDR_EN_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # SysMsixIntrLog Definition */ #define SYS_MSIX_INTR_LOG_W0_MSIX_INTR_LOG BIT(0) #define SYS_MSIX_INTR_LOG_W0_MSIX_INTR_LOG_MASK 0x000000ff -/* ############################################################################ +/* ################################################################################ * # SysDebugCtl Definition */ #define SYS_DEBUG_CTL_W0_DEBUG_INIT_PCIE BIT(4) @@ -1622,7 +1647,7 @@ struct SysCtl_regs { #define SYS_DEBUG_CTL_W0_DEBUG_INIT_SUP_MASK 0x00000040 #define SYS_DEBUG_CTL_W0_DEBUG_INIT_QSPI_MASK 0x00000020 -/* ############################################################################ +/* ################################################################################ * # SysMsixPending Definition */ #define SYS_MSIX_PENDING_W0_MSIX_PENDING0 BIT(0) @@ -1643,7 +1668,7 @@ struct SysCtl_regs { #define SYS_MSIX_PENDING_W6_MSIX_PENDING6_MASK 0xffffffff #define SYS_MSIX_PENDING_W7_MSIX_PENDING7_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # SysPwmCtl Definition */ #define SYS_PWM_CTL_W0_CFG_PWM0_EN BIT(31) @@ -1672,7 +1697,7 @@ struct SysCtl_regs { #define SYS_PWM_CTL_W6_CFG_PWM3_PERIOD_CYCLE_MASK 0x00ffffff #define SYS_PWM_CTL_W7_CFG_PWM3_DUTY_CYCLE_MASK 0x00ffffff -/* ############################################################################ +/* ################################################################################ * # SysTachLog Definition */ #define SYS_TACH_LOG_W0_TACH0_PERIOD_CYCLE BIT(0) @@ -1693,7 +1718,7 @@ struct SysCtl_regs { #define SYS_TACH_LOG_W6_TACH3_PERIOD_CYCLE_MASK 0x00ffffff #define SYS_TACH_LOG_W7_TACH3_DUTY_CYCLE_MASK 0x00ffffff -/* ############################################################################ +/* ################################################################################ * # MonAxiCpuCurInfo Definition */ #define MON_AXI_CPU_CUR_INFO_W0_MON_AXI_CPU_CUR_INFO_31_0 BIT(0) @@ -1726,7 +1751,7 @@ struct SysCtl_regs { #define MON_AXI_CPU_CUR_INFO_W12_MON_AXI_CPU_CUR_INFO_415_384_MASK 0x00000001 #define MON_AXI_CPU_CUR_INFO_W13_MON_AXI_CPU_CUR_INFO_427_416_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # MonAxiCpuLogInfo Definition */ #define MON_AXI_CPU_LOG_INFO_W0_MON_AXI_CPU_LOG_INFO_31_0 BIT(0) @@ -1759,7 +1784,7 @@ struct SysCtl_regs { #define MON_AXI_CPU_LOG_INFO_W12_MON_AXI_CPU_LOG_INFO_415_384_MASK 0x00000001 #define MON_AXI_CPU_LOG_INFO_W13_MON_AXI_CPU_LOG_INFO_427_416_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # MonAxiDdr0CurInfo Definition */ #define MON_AXI_DDR0_CUR_INFO_W0_MON_AXI_DDR0_CUR_INFO_31_0 BIT(0) @@ -1792,7 +1817,7 @@ struct SysCtl_regs { #define MON_AXI_DDR0_CUR_INFO_W12_MON_AXI_DDR0_CUR_INFO_415_384_MASK 0x00000001 #define MON_AXI_DDR0_CUR_INFO_W13_MON_AXI_DDR0_CUR_INFO_427_416_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # MonAxiDdr0LogInfo Definition */ #define MON_AXI_DDR0_LOG_INFO_W0_MON_AXI_DDR0_LOG_INFO_31_0 BIT(0) @@ -1825,7 +1850,7 @@ struct SysCtl_regs { #define MON_AXI_DDR0_LOG_INFO_W12_MON_AXI_DDR0_LOG_INFO_415_384_MASK 0x00000001 #define MON_AXI_DDR0_LOG_INFO_W13_MON_AXI_DDR0_LOG_INFO_427_416_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # MonAxiDdr1CurInfo Definition */ #define MON_AXI_DDR1_CUR_INFO_W0_MON_AXI_DDR1_CUR_INFO_31_0 BIT(0) @@ -1850,7 +1875,7 @@ struct SysCtl_regs { #define MON_AXI_DDR1_CUR_INFO_W8_MON_AXI_DDR1_CUR_INFO_287_256_MASK 0x00000001 #define MON_AXI_DDR1_CUR_INFO_W9_MON_AXI_DDR1_CUR_INFO_299_288_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # MonAxiDdr1LogInfo Definition */ #define MON_AXI_DDR1_LOG_INFO_W0_MON_AXI_DDR1_LOG_INFO_31_0 BIT(0) @@ -1875,7 +1900,7 @@ struct SysCtl_regs { #define MON_AXI_DDR1_LOG_INFO_W8_MON_AXI_DDR1_LOG_INFO_287_256_MASK 0x00000001 #define MON_AXI_DDR1_LOG_INFO_W9_MON_AXI_DDR1_LOG_INFO_299_288_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # MonAxiMemCurInfo Definition */ #define MON_AXI_MEM_CUR_INFO_W0_MON_AXI_MEM_CUR_INFO_31_0 BIT(0) @@ -1900,7 +1925,7 @@ struct SysCtl_regs { #define MON_AXI_MEM_CUR_INFO_W8_MON_AXI_MEM_CUR_INFO_287_256_MASK 0x00000001 #define MON_AXI_MEM_CUR_INFO_W9_MON_AXI_MEM_CUR_INFO_303_288_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # MonAxiMemLogInfo Definition */ #define MON_AXI_MEM_LOG_INFO_W0_MON_AXI_MEM_LOG_INFO_31_0 BIT(0) @@ -1925,7 +1950,7 @@ struct SysCtl_regs { #define MON_AXI_MEM_LOG_INFO_W8_MON_AXI_MEM_LOG_INFO_287_256_MASK 0x00000001 #define MON_AXI_MEM_LOG_INFO_W9_MON_AXI_MEM_LOG_INFO_303_288_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # MonAxiMshCurInfo Definition */ #define MON_AXI_MSH_CUR_INFO_W0_MON_AXI_MSH_CUR_INFO_31_0 BIT(0) @@ -1948,7 +1973,7 @@ struct SysCtl_regs { #define MON_AXI_MSH_CUR_INFO_W7_MON_AXI_MSH_CUR_INFO_255_224_MASK 0x00000001 #define MON_AXI_MSH_CUR_INFO_W8_MON_AXI_MSH_CUR_INFO_275_256_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # MonAxiMshLogInfo Definition */ #define MON_AXI_MSH_LOG_INFO_W0_MON_AXI_MSH_LOG_INFO_31_0 BIT(0) @@ -1973,7 +1998,7 @@ struct SysCtl_regs { #define MON_AXI_MSH_LOG_INFO_W8_MON_AXI_MSH_LOG_INFO_275_256_MASK 0x00000001 #define MON_AXI_MSH_LOG_INFO_W8_MON_AXI_MSH_LOG_WD_ID_MASK 0x0f000000 -/* ############################################################################ +/* ################################################################################ * # MonAxiPcieCurInfo Definition */ #define MON_AXI_PCIE_CUR_INFO_W0_MON_AXI_PCIE_CUR_INFO_31_0 BIT(0) @@ -1998,7 +2023,7 @@ struct SysCtl_regs { #define MON_AXI_PCIE_CUR_INFO_W8_MON_AXI_PCIE_CUR_INFO_287_256_MASK 0x00000001 #define MON_AXI_PCIE_CUR_INFO_W9_MON_AXI_PCIE_CUR_INFO_291_288_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # MonAxiPcieLogInfo Definition */ #define MON_AXI_PCIE_LOG_INFO_W0_MON_AXI_PCIE_LOG_INFO_31_0 BIT(0) @@ -2023,7 +2048,7 @@ struct SysCtl_regs { #define MON_AXI_PCIE_LOG_INFO_W8_MON_AXI_PCIE_LOG_INFO_287_256_MASK 0x00000001 #define MON_AXI_PCIE_LOG_INFO_W9_MON_AXI_PCIE_LOG_INFO_291_288_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # MonAxiQspiCurInfo Definition */ #define MON_AXI_QSPI_CUR_INFO_W0_MON_AXI_QSPI_CUR_INFO_31_0 BIT(0) @@ -2042,7 +2067,7 @@ struct SysCtl_regs { #define MON_AXI_QSPI_CUR_INFO_W5_MON_AXI_QSPI_CUR_INFO_191_160_MASK 0x00000001 #define MON_AXI_QSPI_CUR_INFO_W6_MON_AXI_QSPI_CUR_INFO_223_192_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # MonAxiQspiLogInfo Definition */ #define MON_AXI_QSPI_LOG_INFO_W0_MON_AXI_QSPI_LOG_INFO_31_0 BIT(0) @@ -2063,7 +2088,7 @@ struct SysCtl_regs { #define MON_AXI_QSPI_LOG_INFO_W6_MON_AXI_QSPI_LOG_INFO_223_192_MASK 0x00000001 #define MON_AXI_QSPI_LOG_INFO_W7_MON_AXI_QSPI_LOG_WD_ID_MASK 0x000003ff -/* ############################################################################ +/* ################################################################################ * # MonAxiSupCurInfo Definition */ #define MON_AXI_SUP_CUR_INFO_W0_MON_AXI_SUP_CUR_INFO_31_0 BIT(0) @@ -2084,7 +2109,7 @@ struct SysCtl_regs { #define MON_AXI_SUP_CUR_INFO_W6_MON_AXI_SUP_CUR_INFO_223_192_MASK 0x00000001 #define MON_AXI_SUP_CUR_INFO_W7_MON_AXI_SUP_CUR_INFO_231_224_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # MonAxiSupLogInfo Definition */ #define MON_AXI_SUP_LOG_INFO_W0_MON_AXI_SUP_LOG_INFO_31_0 BIT(0) @@ -2105,7 +2130,7 @@ struct SysCtl_regs { #define MON_AXI_SUP_LOG_INFO_W6_MON_AXI_SUP_LOG_INFO_223_192_MASK 0x00000001 #define MON_AXI_SUP_LOG_INFO_W7_MON_AXI_SUP_LOG_INFO_231_224_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # MonSysApbCurInfo Definition */ #define MON_SYS_APB_CUR_INFO_W0_MON_SYS_APB_CUR_ADDR BIT(0) @@ -2126,7 +2151,7 @@ struct SysCtl_regs { #define MON_SYS_APB_CUR_INFO_W3_MON_SYS_APB_CUR_SEL_MASK 0x00000010 #define MON_SYS_APB_CUR_INFO_W3_MON_SYS_APB_CUR_SLV_ERR_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # MonSysApbLogInfo Definition */ #define MON_SYS_APB_LOG_INFO_W0_MON_SYS_APB_LOG_ADDR BIT(0) @@ -2149,7 +2174,7 @@ struct SysCtl_regs { #define MON_SYS_APB_LOG_INFO_W3_MON_SYS_APB_LOG_SLV_ERR_MASK 0x00000001 #define MON_SYS_APB_LOG_INFO_W3_MON_SYS_APB_LOG_WRITE_MASK 0x00000004 -/* ############################################################################ +/* ################################################################################ * # MonSecApbCurInfo Definition */ #define MON_SEC_APB_CUR_INFO_W0_MON_SEC_APB_CUR_ADDR BIT(0) @@ -2170,7 +2195,7 @@ struct SysCtl_regs { #define MON_SEC_APB_CUR_INFO_W3_MON_SEC_APB_CUR_ENABLE_MASK 0x00000008 #define MON_SEC_APB_CUR_INFO_W3_MON_SEC_APB_CUR_SEL_MASK 0x00000010 -/* ############################################################################ +/* ################################################################################ * # MonSecApbLogInfo Definition */ #define MON_SEC_APB_LOG_INFO_W0_MON_SEC_APB_LOG_ADDR BIT(0) @@ -2193,7 +2218,7 @@ struct SysCtl_regs { #define MON_SEC_APB_LOG_INFO_W3_MON_SEC_APB_LOG_SEL_MASK 0x00000010 #define MON_SEC_APB_LOG_INFO_W3_MON_SEC_APB_ERR_CNT_MASK 0x0000ff00 -/* ############################################################################ +/* ################################################################################ * # DebugCpuCnt Definition */ #define DEBUG_CPU_CNT_W0_MON_CPU_WA_LOG_CNT BIT(8) @@ -2212,7 +2237,7 @@ struct SysCtl_regs { #define DEBUG_CPU_CNT_W1_MON_CPU_WR_RESP_ERROR_CNT_MASK 0xff000000 #define DEBUG_CPU_CNT_W1_MON_CPU_RD_RESP_ERROR_CNT_MASK 0x00ff0000 -/* ############################################################################ +/* ################################################################################ * # DebugMemCnt Definition */ #define DEBUG_MEM_CNT_W0_MON_MEM_WA_LOG_CNT BIT(8) @@ -2227,7 +2252,7 @@ struct SysCtl_regs { #define DEBUG_MEM_CNT_W1_MON_MEM_WR_OUT_CNT_MASK 0x00001f00 #define DEBUG_MEM_CNT_W1_MON_MEM_RD_OUT_CNT_MASK 0x0000001f -/* ############################################################################ +/* ################################################################################ * # DebugDdrCnt Definition */ #define DEBUG_DDR_CNT_W0_MON_DDR0_WA_LOG_CNT BIT(8) @@ -2260,7 +2285,7 @@ struct SysCtl_regs { #define DEBUG_DDR_CNT_W3_MON_DDR1_RD_OUT_CNT_MASK 0x0000001f #define DEBUG_DDR_CNT_W3_MON_DDR1_WR_RESP_ERROR_CNT_MASK 0xff000000 -/* ############################################################################ +/* ################################################################################ * # DebugMshCnt Definition */ #define DEBUG_MSH_CNT_W0_MON_MSH_WD_LOG_CNT BIT(16) @@ -2275,7 +2300,7 @@ struct SysCtl_regs { #define DEBUG_MSH_CNT_W1_MON_MSH_RD_OUT_CNT_MASK 0x0000001f #define DEBUG_MSH_CNT_W1_MON_MSH_WR_OUT_CNT_MASK 0x00001f00 -/* ############################################################################ +/* ################################################################################ * # DebugPcieCnt Definition */ #define DEBUG_PCIE_CNT_W0_MON_PCIE_WD_LOG_CNT BIT(16) @@ -2294,7 +2319,7 @@ struct SysCtl_regs { #define DEBUG_PCIE_CNT_W1_MON_PCIE_WR_RESP_ERROR_CNT_MASK 0xff000000 #define DEBUG_PCIE_CNT_W1_MON_PCIE_RD_RESP_ERROR_CNT_MASK 0x00ff0000 -/* ############################################################################ +/* ################################################################################ * # DebugQspiCnt Definition */ #define DEBUG_QSPI_CNT_W0_MON_QSPI_WD_LOG_CNT BIT(16) @@ -2309,7 +2334,7 @@ struct SysCtl_regs { #define DEBUG_QSPI_CNT_W1_MON_QSPI_RD_OUT_CNT_MASK 0x0000001f #define DEBUG_QSPI_CNT_W1_MON_QSPI_WR_OUT_CNT_MASK 0x00001f00 -/* ############################################################################ +/* ################################################################################ * # DebugSupCnt Definition */ #define DEBUG_SUP_CNT_W0_MON_SUP_WD_LOG_CNT BIT(16) @@ -2328,7 +2353,7 @@ struct SysCtl_regs { #define DEBUG_SUP_CNT_W1_MON_SUP_WR_RESP_ERROR_CNT_MASK 0xff000000 #define DEBUG_SUP_CNT_W1_MON_SUP_RD_OUT_CNT_MASK 0x0000001f -/* ############################################################################ +/* ################################################################################ * # SysSpiVecLog Definition */ #define SYS_SPI_VEC_LOG_W0_SPI_VEC_LOG_31_0 BIT(0) @@ -2343,7 +2368,7 @@ struct SysCtl_regs { #define SYS_SPI_VEC_LOG_W3_SPI_VEC_LOG_127_96_MASK 0x00000001 #define SYS_SPI_VEC_LOG_W4_SPI_VEC_LOG_159_128_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # DebugAhbRespCnt Definition */ #define DEBUG_AHB_RESP_CNT_W0_MON_MSH_CFG_RESP_ERROR_CNT BIT(8) @@ -2354,7 +2379,7 @@ struct SysCtl_regs { #define DEBUG_AHB_RESP_CNT_W0_MON_DDR_CFG_RESP_ERROR_CNT_MASK 0x000000ff #define DEBUG_AHB_RESP_CNT_W0_MON_USB_CFG_RESP_ERROR_CNT_MASK 0x00ff0000 -/* ############################################################################ +/* ################################################################################ * # DebugGicRespCnt Definition */ #define DEBUG_GIC_RESP_CNT_W0_MON_GIC_RD_RESP_ERROR_CNT BIT(0) @@ -2363,7 +2388,70 @@ struct SysCtl_regs { #define DEBUG_GIC_RESP_CNT_W0_MON_GIC_RD_RESP_ERROR_CNT_MASK 0x000000ff #define DEBUG_GIC_RESP_CNT_W0_MON_GIC_WR_RESP_ERROR_CNT_MASK 0x0000ff00 -/* ############################################################################ +/* ################################################################################ + * # SysDdrEccCtl Definition + */ +#define SYS_DDR_ECC_CTL_W0_DDR_ECC_CLEAR_EN BIT(0) +#define SYS_DDR_ECC_CTL_W0_DDR_ECC_ONE_BIT_ERR_CNT BIT(8) +#define SYS_DDR_ECC_CTL_W0_DDR_ECC_TWO_BIT_ERR_CNT BIT(12) + +#define SYS_DDR_ECC_CTL_W0_DDR_ECC_CLEAR_EN_MASK 0x00000001 +#define SYS_DDR_ECC_CTL_W0_DDR_ECC_ONE_BIT_ERR_CNT_MASK 0x00000f00 +#define SYS_DDR_ECC_CTL_W0_DDR_ECC_TWO_BIT_ERR_CNT_MASK 0x0000f000 + +/* ################################################################################ + * # SysDdrInitStartAddr Definition + */ +#define SYS_DDR_INIT_START_ADDR_W0_CFG_INIT_START_ADDR0 BIT(0) +#define SYS_DDR_INIT_START_ADDR_W1_CFG_INIT_START_ADDR1 BIT(0) + +#define SYS_DDR_INIT_START_ADDR_W0_CFG_INIT_START_ADDR0_MASK 0xffffffff +#define SYS_DDR_INIT_START_ADDR_W1_CFG_INIT_START_ADDR1_MASK 0x0000000f + +/* ################################################################################ + * # SysDdrInitLastAddr Definition + */ +#define SYS_DDR_INIT_LAST_ADDR_W0_CFG_INIT_LAST_ADDR0 BIT(0) +#define SYS_DDR_INIT_LAST_ADDR_W1_CFG_INIT_LAST_ADDR1 BIT(0) + +#define SYS_DDR_INIT_LAST_ADDR_W0_CFG_INIT_LAST_ADDR0_MASK 0xffffffff +#define SYS_DDR_INIT_LAST_ADDR_W1_CFG_INIT_LAST_ADDR1_MASK 0x0000000f + +/* ################################################################################ + * # SysDdrInitData Definition + */ +#define SYS_DDR_INIT_DATA_W0_CFG_INIT_WR_DATA0 BIT(0) +#define SYS_DDR_INIT_DATA_W1_CFG_INIT_WR_DATA1 BIT(0) + +#define SYS_DDR_INIT_DATA_W0_CFG_INIT_WR_DATA0_MASK 0xffffffff +#define SYS_DDR_INIT_DATA_W1_CFG_INIT_WR_DATA1_MASK 0xffffffff + +/* ################################################################################ + * # SysDdrInitMode Definition */ +#define SYS_DDR_INIT_MODE_W0_CFG_INIT_AXI_CRITICAL BIT(0) +#define SYS_DDR_INIT_MODE_W0_CFG_INIT_AXI_LEN BIT(8) +#define SYS_DDR_INIT_MODE_W0_CFG_INIT_AXI_QOS BIT(4) +#define SYS_DDR_INIT_MODE_W0_CFG_INIT_AXI_STRB BIT(16) +#define SYS_DDR_INIT_MODE_W0_CFG_INIT_AXI_THRD BIT(24) + +#define SYS_DDR_INIT_MODE_W0_CFG_INIT_AXI_CRITICAL_MASK 0x00000001 +#define SYS_DDR_INIT_MODE_W0_CFG_INIT_AXI_LEN_MASK 0x0000ff00 +#define SYS_DDR_INIT_MODE_W0_CFG_INIT_AXI_QOS_MASK 0x000000f0 +#define SYS_DDR_INIT_MODE_W0_CFG_INIT_AXI_STRB_MASK 0x00ff0000 +#define SYS_DDR_INIT_MODE_W0_CFG_INIT_AXI_THRD_MASK 0x0f000000 + +/* ################################################################################ + * # SysDdrInitCtl Definition + */ +#define SYS_DDR_INIT_CTL_W0_CFG_DDR_INIT_EN BIT(0) +#define SYS_DDR_INIT_CTL_W0_LOG_DDR_INIT_DONE BIT(4) +#define SYS_DDR_INIT_CTL_W0_LOG_DDR_INIT_RESP BIT(8) + +#define SYS_DDR_INIT_CTL_W0_CFG_DDR_INIT_EN_MASK 0x00000001 +#define SYS_DDR_INIT_CTL_W0_LOG_DDR_INIT_DONE_MASK 0x00000010 +#define SYS_DDR_INIT_CTL_W0_LOG_DDR_INIT_RESP_MASK 0x00000300 + +/* ################################################################################ * # DebugMemPtrCfg Definition */ #define DEBUG_MEM_PTR_CFG_W0_CFG_DBG_START_PTR BIT(0) @@ -2372,63 +2460,63 @@ struct SysCtl_regs { #define DEBUG_MEM_PTR_CFG_W0_CFG_DBG_START_PTR_MASK 0x00003fff #define DEBUG_MEM_PTR_CFG_W0_CFG_DBG_END_PTR_MASK 0x3fff0000 -/* ############################################################################ +/* ################################################################################ * # Grant0IntMask Definition */ #define GRANT0_INT_MASK_W0_GRANT0_INT_MASK BIT(0) #define GRANT0_INT_MASK_W0_GRANT0_INT_MASK_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # Grant0IntCtl Definition */ #define GRANT0_INT_CTL_W0_GRANT0_INT_CTL BIT(0) #define GRANT0_INT_CTL_W0_GRANT0_INT_CTL_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # Grant1IntMask Definition */ #define GRANT1_INT_MASK_W0_GRANT1_INT_MASK BIT(0) #define GRANT1_INT_MASK_W0_GRANT1_INT_MASK_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # Grant1IntCtl Definition */ #define GRANT1_INT_CTL_W0_GRANT1_INT_CTL BIT(0) #define GRANT1_INT_CTL_W0_GRANT1_INT_CTL_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # Grant2IntMask Definition */ #define GRANT2_INT_MASK_W0_GRANT2_INT_MASK BIT(0) #define GRANT2_INT_MASK_W0_GRANT2_INT_MASK_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # Grant2IntCtl Definition */ #define GRANT2_INT_CTL_W0_GRANT2_INT_CTL BIT(0) #define GRANT2_INT_CTL_W0_GRANT2_INT_CTL_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # Grant3IntMask Definition */ #define GRANT3_INT_MASK_W0_GRANT3_INT_MASK BIT(0) #define GRANT3_INT_MASK_W0_GRANT3_INT_MASK_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # Grant3IntCtl Definition */ #define GRANT3_INT_CTL_W0_GRANT3_INT_CTL BIT(0) #define GRANT3_INT_CTL_W0_GRANT3_INT_CTL_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # SysIntrIntCtl Definition */ #define SYS_INTR_INT_CTL_W0_SYS_INTR_INT_CTL_31_0 BIT(0) @@ -2437,7 +2525,7 @@ struct SysCtl_regs { #define SYS_INTR_INT_CTL_W0_SYS_INTR_INT_CTL_31_0_MASK 0x00000001 #define SYS_INTR_INT_CTL_W1_SYS_INTR_INT_CTL_63_32_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # SupIntrIntCtl Definition */ #define SUP_INTR_INT_CTL_W0_SUP_INTR_INT_CTL_31_0 BIT(0) @@ -2446,119 +2534,119 @@ struct SysCtl_regs { #define SUP_INTR_INT_CTL_W0_SUP_INTR_INT_CTL_31_0_MASK 0x00000001 #define SUP_INTR_INT_CTL_W1_SUP_INTR_INT_CTL_63_32_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # SysMiscInfo0 Definition */ #define SYS_MISC_INFO0_W0_SYS_MISC_INFO0 BIT(0) #define SYS_MISC_INFO0_W0_SYS_MISC_INFO0_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # SysMiscInfo1 Definition */ #define SYS_MISC_INFO1_W0_SYS_MISC_INFO1 BIT(0) #define SYS_MISC_INFO1_W0_SYS_MISC_INFO1_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # SysMiscInfo2 Definition */ #define SYS_MISC_INFO2_W0_SYS_MISC_INFO2 BIT(0) #define SYS_MISC_INFO2_W0_SYS_MISC_INFO2_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # SysMiscInfo3 Definition */ #define SYS_MISC_INFO3_W0_SYS_MISC_INFO3 BIT(0) #define SYS_MISC_INFO3_W0_SYS_MISC_INFO3_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # CommonInfo0 Definition */ #define COMMON_INFO0_W0_COMMON_INFO0 BIT(0) #define COMMON_INFO0_W0_COMMON_INFO0_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # CommonInfo1 Definition */ #define COMMON_INFO1_W0_COMMON_INFO1 BIT(0) #define COMMON_INFO1_W0_COMMON_INFO1_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # CommonInfo2 Definition */ #define COMMON_INFO2_W0_COMMON_INFO2 BIT(0) #define COMMON_INFO2_W0_COMMON_INFO2_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # CommonInfo3 Definition */ #define COMMON_INFO3_W0_COMMON_INFO3 BIT(0) #define COMMON_INFO3_W0_COMMON_INFO3_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # Grant0ExtMask Definition */ #define GRANT0_EXT_MASK_W0_GRANT0_EXT_MASK BIT(0) #define GRANT0_EXT_MASK_W0_GRANT0_EXT_MASK_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # Grant0ExtCtl Definition */ #define GRANT0_EXT_CTL_W0_GRANT0_EXT_CTL BIT(0) #define GRANT0_EXT_CTL_W0_GRANT0_EXT_CTL_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # Grant1ExtMask Definition */ #define GRANT1_EXT_MASK_W0_GRANT1_EXT_MASK BIT(0) #define GRANT1_EXT_MASK_W0_GRANT1_EXT_MASK_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # Grant1ExtCtl Definition */ #define GRANT1_EXT_CTL_W0_GRANT1_EXT_CTL BIT(0) #define GRANT1_EXT_CTL_W0_GRANT1_EXT_CTL_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # Grant2ExtMask Definition */ #define GRANT2_EXT_MASK_W0_GRANT2_EXT_MASK BIT(0) #define GRANT2_EXT_MASK_W0_GRANT2_EXT_MASK_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # Grant2ExtCtl Definition */ #define GRANT2_EXT_CTL_W0_GRANT2_EXT_CTL BIT(0) #define GRANT2_EXT_CTL_W0_GRANT2_EXT_CTL_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # Grant3ExtMask Definition */ #define GRANT3_EXT_MASK_W0_GRANT3_EXT_MASK BIT(0) #define GRANT3_EXT_MASK_W0_GRANT3_EXT_MASK_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # Grant3ExtCtl Definition */ #define GRANT3_EXT_CTL_W0_GRANT3_EXT_CTL BIT(0) #define GRANT3_EXT_CTL_W0_GRANT3_EXT_CTL_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # SysIntrExtCtl Definition */ #define SYS_INTR_EXT_CTL_W0_SYS_INTR_EXT_CTL_31_0 BIT(0) @@ -2567,7 +2655,7 @@ struct SysCtl_regs { #define SYS_INTR_EXT_CTL_W0_SYS_INTR_EXT_CTL_31_0_MASK 0x00000001 #define SYS_INTR_EXT_CTL_W1_SYS_INTR_EXT_CTL_63_32_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # SupIntrExtCtl Definition */ #define SUP_INTR_EXT_CTL_W0_SUP_INTR_EXT_CTL_31_0 BIT(0) @@ -2576,34 +2664,111 @@ struct SysCtl_regs { #define SUP_INTR_EXT_CTL_W0_SUP_INTR_EXT_CTL_31_0_MASK 0x00000001 #define SUP_INTR_EXT_CTL_W1_SUP_INTR_EXT_CTL_63_32_MASK 0x00000001 -/* ############################################################################ +/* ################################################################################ * # SupMiscInfo0 Definition */ #define SUP_MISC_INFO0_W0_SUP_MISC_INFO0 BIT(0) #define SUP_MISC_INFO0_W0_SUP_MISC_INFO0_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # SupMiscInfo1 Definition */ #define SUP_MISC_INFO1_W0_SUP_MISC_INFO1 BIT(0) #define SUP_MISC_INFO1_W0_SUP_MISC_INFO1_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # SupMiscInfo2 Definition */ #define SUP_MISC_INFO2_W0_SUP_MISC_INFO2 BIT(0) #define SUP_MISC_INFO2_W0_SUP_MISC_INFO2_MASK 0xffffffff -/* ############################################################################ +/* ################################################################################ * # SupMiscInfo3 Definition */ #define SUP_MISC_INFO3_W0_SUP_MISC_INFO3 BIT(0) #define SUP_MISC_INFO3_W0_SUP_MISC_INFO3_MASK 0xffffffff +/* ################################################################################ + * # SysBusDbgEn Definition + */ +#define SYS_BUS_DBG_EN_W0_CFG_DBG_EN_VEC0 BIT(0) +#define SYS_BUS_DBG_EN_W1_CFG_DBG_EN_VEC1 BIT(0) + +#define SYS_BUS_DBG_EN_W0_CFG_DBG_EN_VEC0_MASK 0xffffffff +#define SYS_BUS_DBG_EN_W1_CFG_DBG_EN_VEC1_MASK 0x001fffff + +/* ################################################################################ + * # SysApbErrLog Definition + */ +#define SYS_APB_ERR_LOG_W0_APB_SYS_ERR_LOG BIT(0) + +#define SYS_APB_ERR_LOG_W0_APB_SYS_ERR_LOG_MASK 0x00000fff + +/* ################################################################################ + * # MshClkPadSchmitEn Definition + */ +#define MSH_CLK_PAD_SCHMIT_EN_W0_MSH_CLK_PAD_SCHMIT_EN BIT(0) + +#define MSH_CLK_PAD_SCHMIT_EN_W0_MSH_CLK_PAD_SCHMIT_EN_MASK 0x00000001 + +/* ################################################################################ + * # SysI2C0DebugStatus Definition + */ +#define SYS_I2_C0_DEBUG_STATUS_W0_DBG_I2_C0_ADDR10_BIT BIT(6) +#define SYS_I2_C0_DEBUG_STATUS_W0_DBG_I2_C0_ADDR_PROC BIT(0) +#define SYS_I2_C0_DEBUG_STATUS_W0_DBG_I2_C0_DATA_PROC BIT(1) +#define SYS_I2_C0_DEBUG_STATUS_W0_DBG_I2_C0_MASTER_ACT BIT(7) +#define SYS_I2_C0_DEBUG_STATUS_W0_DBG_I2_C0_MASTER_STATE BIT(8) +#define SYS_I2_C0_DEBUG_STATUS_W0_DBG_I2_C0_RD_PROC BIT(2) +#define SYS_I2_C0_DEBUG_STATUS_W0_DBG_I2_C0_SLAVE_ACT BIT(20) +#define SYS_I2_C0_DEBUG_STATUS_W0_DBG_I2_C0_SLAVE_STATE BIT(16) +#define SYS_I2_C0_DEBUG_STATUS_W0_DBG_I2_C0_START_GEN BIT(4) +#define SYS_I2_C0_DEBUG_STATUS_W0_DBG_I2_C0_STOP_GEN BIT(5) +#define SYS_I2_C0_DEBUG_STATUS_W0_DBG_I2_C0_WR_PROC BIT(3) + +#define SYS_I2_C0_DEBUG_STATUS_W0_DBG_I2_C0_ADDR10_BIT_MASK 0x00000040 +#define SYS_I2_C0_DEBUG_STATUS_W0_DBG_I2_C0_ADDR_PROC_MASK 0x00000001 +#define SYS_I2_C0_DEBUG_STATUS_W0_DBG_I2_C0_DATA_PROC_MASK 0x00000002 +#define SYS_I2_C0_DEBUG_STATUS_W0_DBG_I2_C0_MASTER_ACT_MASK 0x00000080 +#define SYS_I2_C0_DEBUG_STATUS_W0_DBG_I2_C0_MASTER_STATE_MASK 0x00001f00 +#define SYS_I2_C0_DEBUG_STATUS_W0_DBG_I2_C0_RD_PROC_MASK 0x00000004 +#define SYS_I2_C0_DEBUG_STATUS_W0_DBG_I2_C0_SLAVE_ACT_MASK 0x00100000 +#define SYS_I2_C0_DEBUG_STATUS_W0_DBG_I2_C0_SLAVE_STATE_MASK 0x000f0000 +#define SYS_I2_C0_DEBUG_STATUS_W0_DBG_I2_C0_START_GEN_MASK 0x00000010 +#define SYS_I2_C0_DEBUG_STATUS_W0_DBG_I2_C0_STOP_GEN_MASK 0x00000020 +#define SYS_I2_C0_DEBUG_STATUS_W0_DBG_I2_C0_WR_PROC_MASK 0x00000008 + +/* ################################################################################ + * # SysI2C1DebugStatus Definition + */ +#define SYS_I2_C1_DEBUG_STATUS_W0_DBG_I2_C1_ADDR10_BIT BIT(6) +#define SYS_I2_C1_DEBUG_STATUS_W0_DBG_I2_C1_ADDR_PROC BIT(0) +#define SYS_I2_C1_DEBUG_STATUS_W0_DBG_I2_C1_DATA_PROC BIT(1) +#define SYS_I2_C1_DEBUG_STATUS_W0_DBG_I2_C1_MASTER_ACT BIT(7) +#define SYS_I2_C1_DEBUG_STATUS_W0_DBG_I2_C1_MASTER_STATE BIT(8) +#define SYS_I2_C1_DEBUG_STATUS_W0_DBG_I2_C1_RD_PROC BIT(2) +#define SYS_I2_C1_DEBUG_STATUS_W0_DBG_I2_C1_SLAVE_ACT BIT(20) +#define SYS_I2_C1_DEBUG_STATUS_W0_DBG_I2_C1_SLAVE_STATE BIT(16) +#define SYS_I2_C1_DEBUG_STATUS_W0_DBG_I2_C1_START_GEN BIT(4) +#define SYS_I2_C1_DEBUG_STATUS_W0_DBG_I2_C1_STOP_GEN BIT(5) +#define SYS_I2_C1_DEBUG_STATUS_W0_DBG_I2_C1_WR_PROC BIT(3) + +#define SYS_I2_C1_DEBUG_STATUS_W0_DBG_I2_C1_ADDR10_BIT_MASK 0x00000040 +#define SYS_I2_C1_DEBUG_STATUS_W0_DBG_I2_C1_ADDR_PROC_MASK 0x00000001 +#define SYS_I2_C1_DEBUG_STATUS_W0_DBG_I2_C1_DATA_PROC_MASK 0x00000002 +#define SYS_I2_C1_DEBUG_STATUS_W0_DBG_I2_C1_MASTER_ACT_MASK 0x00000080 +#define SYS_I2_C1_DEBUG_STATUS_W0_DBG_I2_C1_MASTER_STATE_MASK 0x00001f00 +#define SYS_I2_C1_DEBUG_STATUS_W0_DBG_I2_C1_RD_PROC_MASK 0x00000004 +#define SYS_I2_C1_DEBUG_STATUS_W0_DBG_I2_C1_SLAVE_ACT_MASK 0x00100000 +#define SYS_I2_C1_DEBUG_STATUS_W0_DBG_I2_C1_SLAVE_STATE_MASK 0x000f0000 +#define SYS_I2_C1_DEBUG_STATUS_W0_DBG_I2_C1_START_GEN_MASK 0x00000010 +#define SYS_I2_C1_DEBUG_STATUS_W0_DBG_I2_C1_STOP_GEN_MASK 0x00000020 +#define SYS_I2_C1_DEBUG_STATUS_W0_DBG_I2_C1_WR_PROC_MASK 0x00000008 + struct SysCtl_mems { u32 SysApbMem0[3]; /* 0x0000fe00 */ u32 SysApbMem0_rsv3; @@ -2671,7 +2836,7 @@ struct SysCtl_mems { u32 SecApbMem15_rsv3; }; -/* ############################################################################ +/* ################################################################################ * # SysApbMem Definition */ #define SYS_APB_MEM_W0_ADDR BIT(0) @@ -2684,7 +2849,7 @@ struct SysCtl_mems { #define SYS_APB_MEM_W2_WR_EN_MASK 0x00000001 #define SYS_APB_MEM_W2_SLV_ERR_MASK 0x00000002 -/* ############################################################################ +/* ################################################################################ * # SecApbMem Definition */ #define SEC_APB_MEM_W0_ADDR BIT(0) @@ -2697,6 +2862,13 @@ struct SysCtl_mems { #define SEC_APB_MEM_W2_WR_EN_MASK 0x00000001 #define SEC_APB_MEM_W2_SLV_ERR_MASK 0x00000002 +/* ################################################################################ + * # SysPcieMem Definition + */ +#define SYS_PCIE_MEM_W0_DATA_BIT BIT(0) + +#define SYS_PCIE_MEM_W0_DATA_MASK 0xffffffff + /* Bootmode setting values */ #define ROM_QSPI_MODE 0x00000000 #define ROM_EMMC_MODE 0x00000001 diff --git a/platform/centec-arm64/tsingma-bsp/src/pinctrl-ctc/core.h b/platform/centec-arm64/tsingma-bsp/src/pinctrl-ctc/core.h index 4a0526e567df..7110f259cd78 100644 --- a/platform/centec-arm64/tsingma-bsp/src/pinctrl-ctc/core.h +++ b/platform/centec-arm64/tsingma-bsp/src/pinctrl-ctc/core.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ /* * Core private header for the pin control subsystem * @@ -5,8 +6,6 @@ * Written on behalf of Linaro for ST-Ericsson * * Author: Linus Walleij - * - * License terms: GNU General Public License (GPL) version 2 */ #include @@ -218,7 +217,7 @@ int pinctrl_generic_add_group(struct pinctrl_dev *pctldev, const char *name, int pinctrl_generic_remove_group(struct pinctrl_dev *pctldev, unsigned int group_selector); -#endif /* CONFIG_GENERIC_PINCTRL_GROUPS */ +#endif /* CONFIG_GENERIC_PINCTRL_GROUPS */ struct pinctrl_dev *get_pinctrl_dev_from_devname(const char *dev_name); struct pinctrl_dev *get_pinctrl_dev_from_of_node(struct device_node *np); @@ -233,13 +232,12 @@ static inline struct pin_desc *pin_desc_get(struct pinctrl_dev *pctldev, return radix_tree_lookup(&pctldev->pin_desc_tree, pin); } -extern struct pinctrl_gpio_range * -pinctrl_find_gpio_range_from_pin_nolock(struct pinctrl_dev *pctldev, - unsigned int pin); - -int pinctrl_register_map(const struct pinctrl_map *maps, unsigned num_maps, - bool dup); -void pinctrl_unregister_map(const struct pinctrl_map *map); +extern struct pinctrl_gpio_range *pinctrl_find_gpio_range_from_pin_nolock(struct + pinctrl_dev + *pctldev, + unsigned + int + pin); extern int pinctrl_force_sleep(struct pinctrl_dev *pctldev); extern int pinctrl_force_default(struct pinctrl_dev *pctldev); diff --git a/platform/centec-arm64/tsingma-bsp/src/pinctrl-ctc/pinconf.h b/platform/centec-arm64/tsingma-bsp/src/pinctrl-ctc/pinconf.h index 6c722505f893..11f858eaa3c6 100644 --- a/platform/centec-arm64/tsingma-bsp/src/pinctrl-ctc/pinconf.h +++ b/platform/centec-arm64/tsingma-bsp/src/pinctrl-ctc/pinconf.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ /* * Internal interface between the core pin control system and the * pin config portions @@ -7,8 +8,6 @@ * Based on bits of regulator core, gpio core and clk core * * Author: Linus Walleij - * - * License terms: GNU General Public License (GPL) version 2 */ #ifdef CONFIG_PINCONF @@ -16,7 +15,7 @@ int pinconf_check_ops(struct pinctrl_dev *pctldev); int pinconf_validate_map(const struct pinctrl_map *map, int i); int pinconf_map_to_setting(const struct pinctrl_map *map, - struct pinctrl_setting *setting); + struct pinctrl_setting *setting); void pinconf_free_setting(const struct pinctrl_setting *setting); int pinconf_apply_setting(const struct pinctrl_setting *setting); @@ -45,7 +44,7 @@ static inline int pinconf_validate_map(const struct pinctrl_map *map, int i) } static inline int pinconf_map_to_setting(const struct pinctrl_map *map, - struct pinctrl_setting *setting) + struct pinctrl_setting *setting) { return 0; } diff --git a/platform/centec-arm64/tsingma-bsp/src/pinctrl-ctc/pinctrl-ctc.c b/platform/centec-arm64/tsingma-bsp/src/pinctrl-ctc/pinctrl-ctc.c old mode 100644 new mode 100755 index 50c65dbfd786..9d5f830eb28e --- a/platform/centec-arm64/tsingma-bsp/src/pinctrl-ctc/pinctrl-ctc.c +++ b/platform/centec-arm64/tsingma-bsp/src/pinctrl-ctc/pinctrl-ctc.c @@ -8,7 +8,6 @@ */ #include -#include #include #include #include @@ -24,6 +23,7 @@ #include #include #include +#include #include "../include/sysctl.h" #include "pinctrl-ctc.h" #include "core.h" @@ -87,12 +87,13 @@ static void ctc_pinctrl_child_count(struct ctc_pinctrl *info, } static struct ctc_pin_bank *ctc_bank_num_to_bank(struct ctc_pinctrl *info, - unsigned int num) + unsigned num) { struct ctc_pin_bank *b = info->ctrl->pin_banks; - if (num < info->ctrl->nr_banks) + if (num < info->ctrl->nr_banks) { return &b[num]; + } return ERR_PTR(-EINVAL); } @@ -195,8 +196,10 @@ static int ctc_pinctrl_parse_dt(struct platform_device *pdev, struct device_node *child; info->ctrl = devm_kzalloc(dev, sizeof(struct ctc_pin_ctrl), GFP_KERNEL); - if (!info->ctrl) + if (!info->ctrl) { + dev_err(dev, "failed to allocate memory for pin\n"); return -EINVAL; + } ret = of_property_read_u32(np, "ctc,pinctrl-bank0", &bank0_pins); if (ret < 0) { @@ -229,13 +232,17 @@ static int ctc_pinctrl_parse_dt(struct platform_device *pdev, info->functions = devm_kzalloc(dev, info->nfunctions * sizeof(struct ctc_pmx_func), GFP_KERNEL); - if (!info->functions) + if (!info->functions) { + dev_err(dev, "failed to allocate memory for function list\n"); return -EINVAL; + } info->groups = devm_kzalloc(dev, info->ngroups * sizeof(struct ctc_pin_group), GFP_KERNEL); - if (!info->groups) + if (!info->groups) { + dev_err(dev, "failed allocate memory for ping group list\n"); return -EINVAL; + } i = 0; for_each_child_of_node(np, child) { @@ -258,7 +265,7 @@ static int ctc_get_groups_count(struct pinctrl_dev *pctldev) } static const char *ctc_get_group_name(struct pinctrl_dev *pctldev, - unsigned int selector) + unsigned selector) { struct ctc_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); @@ -266,8 +273,8 @@ static const char *ctc_get_group_name(struct pinctrl_dev *pctldev, } static int ctc_get_group_pins(struct pinctrl_dev *pctldev, - unsigned int selector, const unsigned int **pins, - unsigned int *npins) + unsigned selector, const unsigned **pins, + unsigned *npins) { struct ctc_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); @@ -298,7 +305,7 @@ static inline const struct ctc_pin_group *ctc_pinctrl_name_to_group(const struct static int ctc_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node *np, - struct pinctrl_map **map, unsigned int *num_maps) + struct pinctrl_map **map, unsigned *num_maps) { struct ctc_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); const struct ctc_pin_group *grp; @@ -348,7 +355,7 @@ static int ctc_pmx_get_funcs_count(struct pinctrl_dev *pctldev) } static const char *ctc_pmx_get_func_name(struct pinctrl_dev *pctldev, - unsigned int selector) + unsigned selector) { struct ctc_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); @@ -356,8 +363,8 @@ static const char *ctc_pmx_get_func_name(struct pinctrl_dev *pctldev, } static int ctc_pmx_get_groups(struct pinctrl_dev *pctldev, - unsigned int selector, const char *const **groups, - unsigned int *const num_groups) + unsigned selector, const char *const **groups, + unsigned *const num_groups) { struct ctc_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); @@ -368,7 +375,7 @@ static int ctc_pmx_get_groups(struct pinctrl_dev *pctldev, } static struct ctc_pin_bank *ctc_pin_to_bank(struct ctc_pinctrl *info, - unsigned int pin) + unsigned pin) { struct ctc_pin_bank *b = info->ctrl->pin_banks; @@ -396,8 +403,8 @@ static int ctc_set_pin_mux(struct ctc_pinctrl *info, struct ctc_pin_bank *bank, return 0; } -static int ctc_pmx_set(struct pinctrl_dev *pctldev, unsigned int selector, - unsigned int group) +static int ctc_pmx_set(struct pinctrl_dev *pctldev, unsigned selector, + unsigned group) { struct ctc_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); const unsigned int *pins = info->groups[group].pins; @@ -408,7 +415,8 @@ static int ctc_pmx_set(struct pinctrl_dev *pctldev, unsigned int selector, dev_dbg(info->dev, "enable function %s group %s\n", info->functions[selector].name, info->groups[group].name); - /* for each pin in the pin group selected, program the corresponding pin + /* + * for each pin in the pin group selected, program the correspoding pin * pin function number in the config register. */ for (cnt = 0; cnt < info->groups[group].npins; cnt++) { @@ -423,7 +431,7 @@ static int ctc_pmx_set(struct pinctrl_dev *pctldev, unsigned int selector, } static void ctc_dt_free_map(struct pinctrl_dev *pctldev, - struct pinctrl_map *map, unsigned int num_maps) + struct pinctrl_map *map, unsigned num_maps) { } @@ -528,7 +536,7 @@ static struct platform_driver ctc_pinctrl_driver = { //static int __init ctc_pinctrl_drv_register(void) //{ -// return platform_driver_register(&ctc_pinctrl_driver); +// return platform_driver_register(&ctc_pinctrl_driver); //} // //postcore_initcall(ctc_pinctrl_drv_register); diff --git a/platform/centec-arm64/tsingma-bsp/src/pwm-ctc/pwm-ctc.c b/platform/centec-arm64/tsingma-bsp/src/pwm-ctc/pwm-ctc.c old mode 100644 new mode 100755 index 8b2a031a46fa..a2e1f997766e --- a/platform/centec-arm64/tsingma-bsp/src/pwm-ctc/pwm-ctc.c +++ b/platform/centec-arm64/tsingma-bsp/src/pwm-ctc/pwm-ctc.c @@ -1,4 +1,5 @@ -/* Centec PWM driver +/* + * Centec PWM driver * * Author: wangyb * @@ -25,14 +26,14 @@ #include #include -#define CTC_NUM_PWM 4 -#define CTC_CR_PWM 0x0 -#define CTC_DUTY_PWM 0x4 +#define CTC_NUM_PWM 4 +#define CTC_CR_PWM 0x0 +#define CTC_DUTY_PWM 0x4 #define CTC_MAX_PERIOD_PWM 0xFFFFFF -#define CTC_MAX_DUTY_PWM 0xFFFFFF +#define CTC_MAX_DUTY_PWM 0xFFFFFF -#define CTC_PWM_ENABLE 0x80000000 +#define CTC_PWM_ENABLE 0x80000000 #define CTC_PERIOD_TACH 0x0 #define CTC_DUTY_TACH 0x4 @@ -60,7 +61,6 @@ static inline u32 ctc_pwm_readl(struct ctc_pwm_chip *chip, unsigned int num, unsigned long offset) { u32 val; - regmap_read(chip->regmap_base, offsetof(struct SysCtl_regs, SysPwmCtl) + offset + num * 0x8, &val); @@ -71,7 +71,6 @@ static inline u32 ctc_tach_readl(struct ctc_pwm_chip *chip, unsigned int num, unsigned long offset) { u32 val; - regmap_read(chip->regmap_base, offsetof(struct SysCtl_regs, SysTachLog) + offset + num * 0x8, &val); @@ -83,19 +82,30 @@ static int ctc_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, { struct ctc_pwm_chip *pc = to_ctc_pwm_chip(chip); u32 cur_value; + u32 duty_cycle = 0; + u32 period_cycle = 0; - duty_ns = duty_ns / 1000; - period_ns = period_ns / 1000; + duty_cycle = duty_ns / 1000; + period_cycle = period_ns / 1000; + + if (duty_cycle < 0 || period_cycle < 1) + return -1; + + if (duty_cycle == 0) { + duty_cycle = 1; + } else if (duty_cycle == period_cycle) { + duty_cycle = duty_cycle - 1; + } /* duty cycle */ - duty_ns = duty_ns & CTC_MAX_DUTY_PWM; - ctc_pwm_writel(pc, pwm->hwpwm, CTC_DUTY_PWM, duty_ns); + duty_cycle = duty_cycle & CTC_MAX_DUTY_PWM; + ctc_pwm_writel(pc, pwm->hwpwm, CTC_DUTY_PWM, duty_cycle); /* period cycle */ - period_ns = period_ns & CTC_MAX_PERIOD_PWM; + period_cycle = period_cycle & CTC_MAX_PERIOD_PWM; cur_value = ctc_pwm_readl(pc, pwm->hwpwm, CTC_CR_PWM); cur_value &= ~(CTC_MAX_PERIOD_PWM); - cur_value |= period_ns << 0; + cur_value |= period_cycle << 0; ctc_pwm_writel(pc, pwm->hwpwm, CTC_CR_PWM, cur_value); return 0; @@ -139,11 +149,11 @@ static void ctc_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm, state->polarity = PWM_POLARITY_NORMAL; - state->period = (cur_value & (~CTC_PWM_ENABLE)) * 1000; + state->period = (cur_value & (~CTC_PWM_ENABLE)) * 1000; // in nanoseconds cur_value_2 = ctc_pwm_readl(pc, pwm->hwpwm, CTC_DUTY_PWM); - state->duty_cycle = cur_value_2 * 1000; + state->duty_cycle = cur_value_2 * 1000; // in nanoseconds } static int ctc_pwm_capture(struct pwm_chip *chip, struct pwm_device *pwm, @@ -154,10 +164,10 @@ static int ctc_pwm_capture(struct pwm_chip *chip, struct pwm_device *pwm, u32 duty_tach; period_tach = ctc_tach_readl(pc, pwm->hwpwm, CTC_PERIOD_TACH) / 4; - result->period = period_tach * 1000; + result->period = period_tach * 1000; // in nanoseconds duty_tach = ctc_tach_readl(pc, pwm->hwpwm, CTC_DUTY_TACH) / 4; - result->duty_cycle = duty_tach * 1000; + result->duty_cycle = duty_tach * 1000; // in nanoseconds return 0; } @@ -188,12 +198,13 @@ static int ctc_pwm_probe(struct platform_device *pdev) pc->regmap_base = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "ctc,sysctrl"); pctldev = devm_kzalloc(&pdev->dev, sizeof(*pctldev), GFP_KERNEL); - if (!pctldev) + if (!pctldev) { return -1; + } pctldev->p = pinctrl_get(&pdev->dev); state = pinctrl_lookup_state(pctldev->p, PINCTRL_STATE_DEFAULT); pinctrl_select_state(pctldev->p, state); - pr_info("Select PWM Function\n"); + printk("Select PWM Function\n"); for (i = 0; i < CTC_NUM_PWM; i++) { cur_value = ctc_pwm_readl(pc, i, CTC_CR_PWM); diff --git a/platform/centec-arm64/tsingma-bsp/src/rtc-sd2405/rtc-sd2405.c b/platform/centec-arm64/tsingma-bsp/src/rtc-sd2405/rtc-sd2405.c index 77c76353cd60..671784f11433 100644 --- a/platform/centec-arm64/tsingma-bsp/src/rtc-sd2405/rtc-sd2405.c +++ b/platform/centec-arm64/tsingma-bsp/src/rtc-sd2405/rtc-sd2405.c @@ -1,4 +1,5 @@ -/* rtc class driver for the SD2405 chip +/* + * rtc class driver for the SD2405 chip * * Author: Dale Farnsworth * @@ -45,7 +46,7 @@ static struct i2c_driver sd2405_driver; -static int sd2405_i2c_read_regs(struct i2c_client *client, u8 *buf) +static int sd2405_i2c_read_regs(struct i2c_client *client, u8 * buf) { struct i2c_msg msgs[1] = { { @@ -67,7 +68,9 @@ static int sd2405_i2c_read_regs(struct i2c_client *client, u8 *buf) static int sd2405_i2c_write_regs(struct i2c_client *client, u8 const *buf) { int rc; + u8 temp_reg[SD2405_REG_LEN + 1] = { 0 }; + memcpy(&temp_reg[1], buf, SD2405_REG_LEN); struct i2c_msg msgs[1] = { { @@ -77,8 +80,6 @@ static int sd2405_i2c_write_regs(struct i2c_client *client, u8 const *buf) .buf = temp_reg} }; - memcpy(&temp_reg[1], buf, SD2405_REG_LEN); - rc = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); if (rc != ARRAY_SIZE(msgs)) goto write_failed; @@ -114,7 +115,6 @@ static int sd2405_i2c_read_time(struct i2c_client *client, struct rtc_time *tm) static int sd2405_i2c_set_write_protect(struct i2c_client *client) { int rc; - rc = i2c_smbus_write_byte_data(client, SD2405_REG_CTRL1, 0); rc += i2c_smbus_write_byte_data(client, SD2405_REG_CTRL2, 0); if (rc < 0) { @@ -128,7 +128,6 @@ static int sd2405_i2c_set_write_protect(struct i2c_client *client) static int sd2405_i2c_clear_write_protect(struct i2c_client *client) { int rc; - rc = i2c_smbus_write_byte_data(client, SD2405_REG_CTRL2, SD2405_REG_CONTROL1_WRITE); rc += @@ -183,11 +182,12 @@ static int sd2405_rtc_set_time(struct device *dev, struct rtc_time *tm) static int sd2405_remove(struct i2c_client *client) { +#if 0 struct rtc_device *rtc = i2c_get_clientdata(client); if (rtc) rtc_device_unregister(rtc); - +#endif return 0; } @@ -199,17 +199,20 @@ static const struct rtc_class_ops sd2405_rtc_ops = { static int sd2405_probe(struct i2c_client *client, const struct i2c_device_id *id) { + int ret = 0; struct rtc_device *rtc; if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) return -ENODEV; dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n"); - - rtc = rtc_device_register(sd2405_driver.driver.name, - &client->dev, &sd2405_rtc_ops, THIS_MODULE); + rtc = devm_rtc_allocate_device(&client->dev); if (IS_ERR(rtc)) return PTR_ERR(rtc); + rtc->ops = &sd2405_rtc_ops; + ret = rtc_register_device(rtc); + if (ret) + return ret; i2c_set_clientdata(client, rtc); diff --git a/platform/centec-arm64/tsingma-bsp/src/sdhci-ctc5236/sdhci-ctc5236.c b/platform/centec-arm64/tsingma-bsp/src/sdhci-ctc5236/sdhci-ctc5236.c old mode 100644 new mode 100755 index b9981e8b0c54..5641ba6cd59d --- a/platform/centec-arm64/tsingma-bsp/src/sdhci-ctc5236/sdhci-ctc5236.c +++ b/platform/centec-arm64/tsingma-bsp/src/sdhci-ctc5236/sdhci-ctc5236.c @@ -1,17 +1,9 @@ -/* sdhci-ctc5236.c Support for SDHCI on Centec TsingMa SoC's +/* + * sdhci-ctc5236.c Support for SDHCI on Centec TsingMa SoC's * - * Copyright (C) 2004-2017 Centec Networks (suzhou) Co., LTD. + * Author: Wangyb * - * Author: Jay Cao - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * Copyright 2005-2020, Centec Networks (Suzhou) Co., Ltd. * */ @@ -27,38 +19,43 @@ #include #include #include +#include +#include #define REG_OFFSET_ADDR 0x500 #define MSHC_CTRL_R 0x8 #define AT_CTRL_R 0x40 #define SW_TUNE_EN 0x10 -#define SD_CLK_EN_MASK 0x00000001 +#define SD_CLK_EN_MASK 0x00000001 #define AT_STAT_R 0x44 #define MAX_TUNING_LOOP 0x80 -#define MIN_TUNING_LOOP 0x0 +#define MIN_TUNING_LOOP 0x0 #define TUNE_CTRL_STEP 1 +#define EMMC_CTRL_R 0x2c -struct regmap *regmap_base; #define SDHCI_REFCLK_150M 150000000 +static struct regmap *regmap_base; +static u32 version; +#define CTC_REV_TM_1_0 0x0 +#define CTC_REV_TM_1_1 0x1 + +#define BOUNDARY_OK(addr, len) \ + ((addr | (SZ_128M - 1)) == ((addr + len - 1) | (SZ_128M - 1))) + static u16 sdhci_ctc5236_readw(struct sdhci_host *host, int reg) { - if (unlikely(reg == SDHCI_HOST_VERSION)) + if (unlikely(reg == SDHCI_HOST_VERSION)) { return SDHCI_SPEC_300; + } return readw(host->ioaddr + reg); } static u32 sdhci_ctc5236_readl(struct sdhci_host *host, int reg) { - u32 ret = readl(host->ioaddr + reg); - - if (reg == SDHCI_CAPABILITIES_1) - ret &= - ~(SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_SDR104 | - SDHCI_SUPPORT_DDR50); - if (reg == SDHCI_CAPABILITIES) - ret &= ~(SDHCI_CAN_64BIT); + u32 ret; + ret = readl(host->ioaddr + reg); return ret; } @@ -112,24 +109,74 @@ void sdhci_ctc5236_reset(struct sdhci_host *host, u8 mask) } +static void ctc5236_select_90degree_phase(struct sdhci_host *host) +{ + u32 val = 0; + + regmap_read(regmap_base, offsetof(struct SysCtl_regs, SysMshCfg), &val); + if (val & SYS_MSH_CFG_W0_MSH_INTF_C_CLK_TX_PHASE_SEL_MASK) { + val &= (~SYS_MSH_CFG_W0_MSH_INTF_C_CLK_TX_PHASE_SEL_MASK); + regmap_write(regmap_base, + offsetof(struct SysCtl_regs, SysMshCfg), val); + printk("select ctc 90 degree phase\n"); + } +} + void ctc_sdhci_set_clock(struct sdhci_host *host, unsigned int clock) { int val = 0; if (clock == SDHCI_REFCLK_150M) { - /* SDHCI reference clock change 150M */ regmap_read(regmap_base, offsetof(struct SysCtl_regs, SysClkPeriCfg), &val); - val = val & (~SYS_CLK_PERI_CFG_W0_CFG_DIV_MSH_REF_CNT_MASK); - val |= - ((0x8 & SYS_CLK_PERI_CFG_W0_CFG_DIV_MSH_REF_CNT_MASK)) << 0; - regmap_write(regmap_base, - offsetof(struct SysCtl_regs, SysClkPeriCfg), val); + if ((val & 0xc) == 0xc) { + val = + val & + (~SYS_CLK_PERI_CFG_W0_CFG_DIV_MSH_REF_CNT_MASK); + val |= + ((0x8 & + SYS_CLK_PERI_CFG_W0_CFG_DIV_MSH_REF_CNT_MASK)) << + 0; + regmap_write(regmap_base, + offsetof(struct SysCtl_regs, + SysClkPeriCfg), val); + printk("SDHCI reference clock change 150M\n"); + } + } + + if (version == CTC_REV_TM_1_1) { + if (host->mmc->ios.timing == MMC_TIMING_MMC_DDR52) { + ctc5236_select_90degree_phase(host); + } } sdhci_set_clock(host, clock); } +/* + * If DMA addr spans 128MB boundary, we split the DMA transfer into two + * so that each DMA transfer doesn't exceed the boundary. + */ +static void sdhci_ctc5236_adma_write_desc(struct sdhci_host *host, void **desc, + dma_addr_t addr, int len, + unsigned int cmd) +{ + int tmplen, offset; + + if (likely(!len || BOUNDARY_OK(addr, len))) { + sdhci_adma_write_desc(host, desc, addr, len, cmd); + return; + } + + offset = addr & (SZ_128M - 1); + tmplen = SZ_128M - offset; + sdhci_adma_write_desc(host, desc, addr, tmplen, cmd); + + addr += tmplen; + len -= tmplen; + sdhci_adma_write_desc(host, desc, addr, len, cmd); +} + static int sdhci_ctc5236_prepare_tuning(struct sdhci_host *host, int CENTER_PH_CODE) { @@ -180,51 +227,54 @@ static int sdhci_ctc5236_execute_tuning(struct sdhci_host *host, u32 opcode) val &= (~SYS_MSH_CFG_W0_MSH_INTF_RX_DLL_MASTER_BYPASS_MASK); regmap_write(regmap_base, offsetof(struct SysCtl_regs, SysMshCfg), val); + sdhci_ctc5236_prepare_tuning(host, 0); + /* find the mininum delay first which can pass tuning */ min = MIN_TUNING_LOOP; - sdhci_ctc5236_prepare_tuning(host, min); + sdhci_writel(host, min, REG_OFFSET_ADDR + AT_STAT_R); while (min < MAX_TUNING_LOOP) { - dev_dbg(mmc_dev(host->mmc), "#1# AT_STAT_R is %x\n", - sdhci_readl(host, REG_OFFSET_ADDR + AT_STAT_R)); if (!mmc_send_tuning(host->mmc, opcode, NULL)) break; - host->ops->reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA); - min += TUNE_CTRL_STEP; sdhci_writel(host, min, REG_OFFSET_ADDR + AT_STAT_R); } /* find the maxinum delay which can not pass tuning */ max = min + TUNE_CTRL_STEP; - sdhci_ctc5236_prepare_tuning(host, max); + sdhci_writel(host, max, REG_OFFSET_ADDR + AT_STAT_R); while (max < MAX_TUNING_LOOP) { - dev_dbg(mmc_dev(host->mmc), "#2# AT_STAT_R is %x\n", - sdhci_readl(host, REG_OFFSET_ADDR + AT_STAT_R)); if (mmc_send_tuning(host->mmc, opcode, NULL)) { max -= TUNE_CTRL_STEP; break; } - host->ops->reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA); - max += TUNE_CTRL_STEP; sdhci_writel(host, max, REG_OFFSET_ADDR + AT_STAT_R); } /* use average delay to get the best timing */ avg = (min + max) / 2; - sdhci_ctc5236_prepare_tuning(host, avg); + sdhci_writel(host, avg, REG_OFFSET_ADDR + AT_STAT_R); ret = mmc_send_tuning(host->mmc, opcode, NULL); host->ops->reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA); - sdhci_writel(host, avg, REG_OFFSET_ADDR + AT_STAT_R); - dev_info(mmc_dev(host->mmc), "Tuning %s at 0x%x ret %d\n", - ret ? "failed" : "passed", avg, ret); + dev_info(mmc_dev(host->mmc), + "Tuning %s at 0x%x ret %d, min is 0x%x, max is 0x%x\n", + ret ? "failed" : "passed", avg, ret, min, max); return ret; } +static void sdhci_ctc5236_hw_reset(struct sdhci_host *host) +{ + sdhci_writel(host, 0x0, REG_OFFSET_ADDR + EMMC_CTRL_R); + udelay(10); + sdhci_writel(host, 0xc, REG_OFFSET_ADDR + EMMC_CTRL_R); + udelay(300); + dev_info(mmc_dev(host->mmc), "Hardware reset\n"); +} + static const struct sdhci_ops sdhci_ctc5236_ops = { .read_w = sdhci_ctc5236_readw, .read_l = sdhci_ctc5236_readl, @@ -234,12 +284,14 @@ static const struct sdhci_ops sdhci_ctc5236_ops = { .set_uhs_signaling = sdhci_set_uhs_signaling, .get_max_clock = sdhci_pltfm_clk_get_max_clock, .platform_execute_tuning = sdhci_ctc5236_execute_tuning, + .adma_write_desc = sdhci_ctc5236_adma_write_desc, + .hw_reset = sdhci_ctc5236_hw_reset, }; static struct sdhci_pltfm_data sdhci_ctc5236_pdata = { .ops = &sdhci_ctc5236_ops, .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | SDHCI_QUIRK2_BROKEN_HS200, - .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN | SDHCI_QUIRK_BROKEN_ADMA, + .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, }; static int sdhci_ctc5236_probe(struct platform_device *pdev) @@ -247,32 +299,61 @@ static int sdhci_ctc5236_probe(struct platform_device *pdev) struct sdhci_host *host; struct sdhci_pltfm_host *pltfm_host; struct clk *clk; - int ret; + int ret, val; + u32 extra; host = sdhci_pltfm_init(pdev, &sdhci_ctc5236_pdata, 0); if (IS_ERR(host)) return PTR_ERR(host); - clk = devm_clk_get(&pdev->dev, "mmc_clk"); - if (IS_ERR(clk)) { - dev_err(&pdev->dev, "Peripheral clk not found\n"); - return PTR_ERR(clk); - } - pltfm_host = sdhci_priv(host); - pltfm_host->clk = clk; - clk_prepare_enable(clk); + /* + * extra adma table cnt for cross 128M boundary handling. + */ + extra = DIV_ROUND_UP_ULL(dma_get_required_mask(&pdev->dev), SZ_128M); + if (extra > SDHCI_MAX_SEGS) + extra = SDHCI_MAX_SEGS; + host->adma_table_cnt += extra; regmap_base = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "ctc,sysctrl"); if (IS_ERR(regmap_base)) return PTR_ERR(regmap_base); + val = 0x3400027; + regmap_write(regmap_base, offsetof(struct SysCtl_regs, SysMshCfg), val); + + regmap_read(regmap_base, offsetof(struct SysCtl_regs, SysCtlSysRev), + &val); + + version = (val == 0x1) ? CTC_REV_TM_1_1 : CTC_REV_TM_1_0; + mmc_of_parse_voltage(pdev->dev.of_node, &host->ocr_mask); ret = mmc_of_parse(host->mmc); if (ret) goto err_sdhci_add; + clk = devm_clk_get(&pdev->dev, "mmc_clk"); + if (IS_ERR(clk)) { + dev_err(&pdev->dev, "Peripheral clk not found\n"); + return PTR_ERR(clk); + } + pltfm_host = sdhci_priv(host); + pltfm_host->clk = clk; + clk_prepare_enable(clk); + + if (version == CTC_REV_TM_1_0) { + if (host->mmc->caps & MMC_CAP_1_8V_DDR) { + host->mmc->caps &= ~MMC_CAP_1_8V_DDR; + printk("%s, not support DDR Mode\n", __func__); + } + } + + if (host->mmc->caps2 & MMC_CAP2_HS200_1_8V_SDR) { + host->mmc->caps2 &= ~MMC_CAP2_HS200_1_8V_SDR; + printk("%s, not support Hs200 Mode\n", __func__); + } + ret = sdhci_add_host(host); if (ret) goto err_sdhci_add; @@ -303,5 +384,5 @@ static struct platform_driver sdhci_ctc5236_driver = { module_platform_driver(sdhci_ctc5236_driver); MODULE_DESCRIPTION("SDHCI driver for Centec TsingMa SoCs"); -MODULE_AUTHOR("Jay Cao "); +MODULE_AUTHOR("Wangyb "); MODULE_LICENSE("GPL v2"); diff --git a/platform/centec-arm64/tsingma-bsp/src/sdhci-ctc5236/sdhci-pltfm.h b/platform/centec-arm64/tsingma-bsp/src/sdhci-ctc5236/sdhci-pltfm.h index 1e91fb1c020e..ab508dd6314c 100644 --- a/platform/centec-arm64/tsingma-bsp/src/sdhci-ctc5236/sdhci-pltfm.h +++ b/platform/centec-arm64/tsingma-bsp/src/sdhci-ctc5236/sdhci-pltfm.h @@ -1,11 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright 2010 MontaVista Software, LLC. * * Author: Anton Vorontsov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef _DRIVERS_MMC_SDHCI_PLTFM_H @@ -28,7 +25,7 @@ struct sdhci_pltfm_host { unsigned int clock; u16 xfer_mode_shadow; - unsigned long private[0] ____cacheline_aligned; + unsigned long private[] ____cacheline_aligned; }; #ifdef CONFIG_MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER @@ -86,15 +83,20 @@ static inline void sdhci_be32bs_writeb(struct sdhci_host *host, u8 val, int reg) int base = reg & ~0x3; int shift = (reg & 0x3) * 8; - clrsetbits_be32(host->ioaddr + base , 0xff << shift, val << shift); + clrsetbits_be32(host->ioaddr + base, 0xff << shift, val << shift); } #endif /* CONFIG_MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER */ -extern void sdhci_get_of_property(struct platform_device *pdev); +void sdhci_get_property(struct platform_device *pdev); + +static inline void sdhci_get_of_property(struct platform_device *pdev) +{ + return sdhci_get_property(pdev); +} extern struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev, - const struct sdhci_pltfm_data *pdata, - size_t priv_size); + const struct sdhci_pltfm_data *pdata, + size_t priv_size); extern void sdhci_pltfm_free(struct platform_device *pdev); extern int sdhci_pltfm_register(struct platform_device *pdev, @@ -109,8 +111,20 @@ static inline void *sdhci_pltfm_priv(struct sdhci_pltfm_host *host) return host->private; } +extern const struct dev_pm_ops sdhci_pltfm_pmops; +#ifdef CONFIG_PM_SLEEP int sdhci_pltfm_suspend(struct device *dev); int sdhci_pltfm_resume(struct device *dev); -extern const struct dev_pm_ops sdhci_pltfm_pmops; +#else +static inline int sdhci_pltfm_suspend(struct device *dev) +{ + return 0; +} + +static inline int sdhci_pltfm_resume(struct device *dev) +{ + return 0; +} +#endif #endif /* _DRIVERS_MMC_SDHCI_PLTFM_H */ diff --git a/platform/centec-arm64/tsingma-bsp/src/sdhci-ctc5236/sdhci.h b/platform/centec-arm64/tsingma-bsp/src/sdhci-ctc5236/sdhci.h index 0f8c4f3ccafc..5644560aad19 100644 --- a/platform/centec-arm64/tsingma-bsp/src/sdhci-ctc5236/sdhci.h +++ b/platform/centec-arm64/tsingma-bsp/src/sdhci-ctc5236/sdhci.h @@ -1,18 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * linux/drivers/mmc/host/sdhci.h - Secure Digital Host Controller Interface driver * * Header file for Host Controller registers and I/O accessors. * * Copyright (C) 2005-2008 Pierre Ossman, All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. */ #ifndef __SDHCI_HW_H #define __SDHCI_HW_H +#include #include #include #include @@ -28,6 +25,7 @@ #define SDHCI_DMA_ADDRESS 0x00 #define SDHCI_ARGUMENT2 SDHCI_DMA_ADDRESS +#define SDHCI_32BIT_BLK_CNT SDHCI_DMA_ADDRESS #define SDHCI_BLOCK_SIZE 0x04 #define SDHCI_MAKE_BLKSZ(dma, blksz) (((dma & 0x7) << 12) | (blksz & 0xFFF)) @@ -41,6 +39,7 @@ #define SDHCI_TRNS_BLK_CNT_EN 0x02 #define SDHCI_TRNS_AUTO_CMD12 0x04 #define SDHCI_TRNS_AUTO_CMD23 0x08 +#define SDHCI_TRNS_AUTO_SEL 0x0C #define SDHCI_TRNS_READ 0x10 #define SDHCI_TRNS_MULTI 0x20 @@ -71,6 +70,10 @@ #define SDHCI_SPACE_AVAILABLE 0x00000400 #define SDHCI_DATA_AVAILABLE 0x00000800 #define SDHCI_CARD_PRESENT 0x00010000 +#define SDHCI_CARD_PRES_SHIFT 16 +#define SDHCI_CD_STABLE 0x00020000 +#define SDHCI_CD_LVL 0x00040000 +#define SDHCI_CD_LVL_SHIFT 18 #define SDHCI_WRITE_PROTECT 0x00080000 #define SDHCI_DATA_LVL_MASK 0x00F00000 #define SDHCI_DATA_LVL_SHIFT 20 @@ -86,7 +89,8 @@ #define SDHCI_CTRL_ADMA1 0x08 #define SDHCI_CTRL_ADMA32 0x10 #define SDHCI_CTRL_ADMA64 0x18 -#define SDHCI_CTRL_8BITBUS 0x20 +#define SDHCI_CTRL_ADMA3 0x18 +#define SDHCI_CTRL_8BITBUS 0x20 #define SDHCI_CTRL_CDTEST_INS 0x40 #define SDHCI_CTRL_CDTEST_EN 0x80 @@ -111,6 +115,7 @@ #define SDHCI_DIV_HI_MASK 0x300 #define SDHCI_PROG_CLOCK_MODE 0x0020 #define SDHCI_CLOCK_CARD_EN 0x0004 +#define SDHCI_CLOCK_PLL_EN 0x0008 #define SDHCI_CLOCK_INT_STABLE 0x0002 #define SDHCI_CLOCK_INT_EN 0x0001 @@ -180,7 +185,7 @@ #define SDHCI_CTRL_UHS_SDR50 0x0002 #define SDHCI_CTRL_UHS_SDR104 0x0003 #define SDHCI_CTRL_UHS_DDR50 0x0004 -#define SDHCI_CTRL_HS400 0x0005 /* Non-standard */ +#define SDHCI_CTRL_HS400 0x0005 /* Non-standard */ #define SDHCI_CTRL_VDD_180 0x0008 #define SDHCI_CTRL_DRV_TYPE_MASK 0x0030 #define SDHCI_CTRL_DRV_TYPE_B 0x0000 @@ -189,15 +194,16 @@ #define SDHCI_CTRL_DRV_TYPE_D 0x0030 #define SDHCI_CTRL_EXEC_TUNING 0x0040 #define SDHCI_CTRL_TUNED_CLK 0x0080 +#define SDHCI_CMD23_ENABLE 0x0800 +#define SDHCI_CTRL_V4_MODE 0x1000 +#define SDHCI_CTRL_64BIT_ADDR 0x2000 #define SDHCI_CTRL_PRESET_VAL_ENABLE 0x8000 #define SDHCI_CAPABILITIES 0x40 -#define SDHCI_TIMEOUT_CLK_MASK 0x0000003F -#define SDHCI_TIMEOUT_CLK_SHIFT 0 +#define SDHCI_TIMEOUT_CLK_MASK GENMASK(5, 0) #define SDHCI_TIMEOUT_CLK_UNIT 0x00000080 -#define SDHCI_CLOCK_BASE_MASK 0x00003F00 -#define SDHCI_CLOCK_V3_BASE_MASK 0x0000FF00 -#define SDHCI_CLOCK_BASE_SHIFT 8 +#define SDHCI_CLOCK_BASE_MASK GENMASK(13, 8) +#define SDHCI_CLOCK_V3_BASE_MASK GENMASK(15, 8) #define SDHCI_MAX_BLOCK_MASK 0x00030000 #define SDHCI_MAX_BLOCK_SHIFT 16 #define SDHCI_CAN_DO_8BIT 0x00040000 @@ -209,33 +215,28 @@ #define SDHCI_CAN_VDD_330 0x01000000 #define SDHCI_CAN_VDD_300 0x02000000 #define SDHCI_CAN_VDD_180 0x04000000 +#define SDHCI_CAN_64BIT_V4 0x08000000 #define SDHCI_CAN_64BIT 0x10000000 +#define SDHCI_CAPABILITIES_1 0x44 #define SDHCI_SUPPORT_SDR50 0x00000001 #define SDHCI_SUPPORT_SDR104 0x00000002 #define SDHCI_SUPPORT_DDR50 0x00000004 #define SDHCI_DRIVER_TYPE_A 0x00000010 #define SDHCI_DRIVER_TYPE_C 0x00000020 #define SDHCI_DRIVER_TYPE_D 0x00000040 -#define SDHCI_RETUNING_TIMER_COUNT_MASK 0x00000F00 -#define SDHCI_RETUNING_TIMER_COUNT_SHIFT 8 +#define SDHCI_RETUNING_TIMER_COUNT_MASK GENMASK(11, 8) #define SDHCI_USE_SDR50_TUNING 0x00002000 -#define SDHCI_RETUNING_MODE_MASK 0x0000C000 -#define SDHCI_RETUNING_MODE_SHIFT 14 -#define SDHCI_CLOCK_MUL_MASK 0x00FF0000 -#define SDHCI_CLOCK_MUL_SHIFT 16 -#define SDHCI_SUPPORT_HS400 0x80000000 /* Non-standard */ - -#define SDHCI_CAPABILITIES_1 0x44 +#define SDHCI_RETUNING_MODE_MASK GENMASK(15, 14) +#define SDHCI_CLOCK_MUL_MASK GENMASK(23, 16) +#define SDHCI_CAN_DO_ADMA3 0x08000000 +#define SDHCI_SUPPORT_HS400 0x80000000 /* Non-standard */ #define SDHCI_MAX_CURRENT 0x48 -#define SDHCI_MAX_CURRENT_LIMIT 0xFF -#define SDHCI_MAX_CURRENT_330_MASK 0x0000FF -#define SDHCI_MAX_CURRENT_330_SHIFT 0 -#define SDHCI_MAX_CURRENT_300_MASK 0x00FF00 -#define SDHCI_MAX_CURRENT_300_SHIFT 8 -#define SDHCI_MAX_CURRENT_180_MASK 0xFF0000 -#define SDHCI_MAX_CURRENT_180_SHIFT 16 +#define SDHCI_MAX_CURRENT_LIMIT GENMASK(7, 0) +#define SDHCI_MAX_CURRENT_330_MASK GENMASK(7, 0) +#define SDHCI_MAX_CURRENT_300_MASK GENMASK(15, 8) +#define SDHCI_MAX_CURRENT_180_MASK GENMASK(23, 16) #define SDHCI_MAX_CURRENT_MULTIPLIER 4 /* 4C-4F reserved for more max current */ @@ -252,18 +253,16 @@ /* 60-FB reserved */ +#define SDHCI_PRESET_FOR_HIGH_SPEED 0x64 #define SDHCI_PRESET_FOR_SDR12 0x66 #define SDHCI_PRESET_FOR_SDR25 0x68 #define SDHCI_PRESET_FOR_SDR50 0x6A #define SDHCI_PRESET_FOR_SDR104 0x6C #define SDHCI_PRESET_FOR_DDR50 0x6E -#define SDHCI_PRESET_FOR_HS400 0x74 /* Non-standard */ -#define SDHCI_PRESET_DRV_MASK 0xC000 -#define SDHCI_PRESET_DRV_SHIFT 14 -#define SDHCI_PRESET_CLKGEN_SEL_MASK 0x400 -#define SDHCI_PRESET_CLKGEN_SEL_SHIFT 10 -#define SDHCI_PRESET_SDCLK_FREQ_MASK 0x3FF -#define SDHCI_PRESET_SDCLK_FREQ_SHIFT 0 +#define SDHCI_PRESET_FOR_HS400 0x74 /* Non-standard */ +#define SDHCI_PRESET_DRV_MASK GENMASK(15, 14) +#define SDHCI_PRESET_CLKGEN_SEL BIT(10) +#define SDHCI_PRESET_SDCLK_FREQ_MASK GENMASK(9, 0) #define SDHCI_SLOT_INT_STATUS 0xFC @@ -275,6 +274,9 @@ #define SDHCI_SPEC_100 0 #define SDHCI_SPEC_200 1 #define SDHCI_SPEC_300 2 +#define SDHCI_SPEC_400 3 +#define SDHCI_SPEC_410 4 +#define SDHCI_SPEC_420 5 /* * End of controller registers. @@ -294,10 +296,10 @@ /* ADMA2 32-bit descriptor */ struct sdhci_adma2_32_desc { - __le16 cmd; - __le16 len; - __le32 addr; -} __packed __aligned(4); + __le16 cmd; + __le16 len; + __le32 addr; +} __packed __aligned(4); /* ADMA2 data alignment */ #define SDHCI_ADMA2_ALIGN 4 @@ -310,19 +312,25 @@ struct sdhci_adma2_32_desc { */ #define SDHCI_ADMA2_DESC_ALIGN 8 -/* ADMA2 64-bit DMA descriptor size */ -#define SDHCI_ADMA2_64_DESC_SZ 12 +/* + * ADMA2 64-bit DMA descriptor size + * According to SD Host Controller spec v4.10, there are two kinds of + * descriptors for 64-bit addressing mode: 96-bit Descriptor and 128-bit + * Descriptor, if Host Version 4 Enable is set in the Host Control 2 + * register, 128-bit Descriptor will be selected. + */ +#define SDHCI_ADMA2_64_DESC_SZ(host) ((host)->v4_mode ? 16 : 12) /* * ADMA2 64-bit descriptor. Note 12-byte descriptor can't always be 8-byte * aligned. */ struct sdhci_adma2_64_desc { - __le16 cmd; - __le16 len; - __le32 addr_lo; - __le32 addr_hi; -} __packed __aligned(4); + __le16 cmd; + __le16 len; + __le32 addr_lo; + __le32 addr_hi; +} __packed __aligned(4); #define ADMA2_TRAN_VALID 0x21 #define ADMA2_NOP_END_VALID 0x3 @@ -343,7 +351,7 @@ struct sdhci_adma2_64_desc { * command and response, and the time between response and start of data is * not known, set the command transfer time to 10ms. */ -#define MMC_CMD_TRANSFER_TIME (10 * NSEC_PER_MSEC) /* max 10 ms */ +#define MMC_CMD_TRANSFER_TIME (10 * NSEC_PER_MSEC) /* max 10 ms */ enum sdhci_cookie { COOKIE_UNMAPPED, @@ -391,8 +399,12 @@ struct sdhci_host { #define SDHCI_QUIRK_BROKEN_CARD_DETECTION (1<<15) /* Controller reports inverted write-protect state */ #define SDHCI_QUIRK_INVERTED_WRITE_PROTECT (1<<16) +/* Controller has unusable command queue engine */ +#define SDHCI_QUIRK_BROKEN_CQE (1<<17) /* Controller does not like fast PIO transfers */ #define SDHCI_QUIRK_PIO_NEEDS_DELAY (1<<18) +/* Controller does not have a LED */ +#define SDHCI_QUIRK_NO_LED (1<<19) /* Controller has to be forced to use block size of 2048 bytes */ #define SDHCI_QUIRK_FORCE_BLK_SZ_2048 (1<<20) /* Controller cannot do multi-block transfers */ @@ -455,9 +467,17 @@ struct sdhci_host { * obtainable timeout. */ #define SDHCI_QUIRK2_DISABLE_HW_TIMEOUT (1<<17) +/* + * 32-bit block count may not support eMMC where upper bits of CMD23 are used + * for other purposes. Consequently we support 16-bit block count by default. + * Otherwise, SDHCI_QUIRK2_USE_32BIT_BLK_CNT can be selected to use 32-bit + * block count. + */ +#define SDHCI_QUIRK2_USE_32BIT_BLK_CNT (1<<18) int irq; /* Device IRQ */ void __iomem *ioaddr; /* Mapped address */ + phys_addr_t mapbase; /* physical address base */ char *bounce_buffer; /* For packing SDMA reads/writes */ dma_addr_t bounce_addr; unsigned int bounce_buffer_size; @@ -485,7 +505,6 @@ struct sdhci_host { #define SDHCI_AUTO_CMD12 (1<<6) /* Auto CMD12 support */ #define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */ #define SDHCI_PV_ENABLED (1<<8) /* Preset value enabled */ -#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */ #define SDHCI_USE_64_BIT_DMA (1<<12) /* Use 64-bit DMA */ #define SDHCI_HS400_TUNING (1<<13) /* Tuning for HS400 */ #define SDHCI_SIGNALING_330 (1<<14) /* Host is capable of 3.3V signaling */ @@ -506,10 +525,14 @@ struct sdhci_host { bool preset_enabled; /* Preset is enabled */ bool pending_reset; /* Cmd/data reset is pending */ bool irq_wake_enabled; /* IRQ wakeup is enabled */ + bool v4_mode; /* Host Version 4 Enable */ + bool use_external_dma; /* Host selects to use external DMA */ + bool always_defer_done; /* Always defer to complete requests */ struct mmc_request *mrqs_done[SDHCI_MAX_MRQS]; /* Requests done */ struct mmc_command *cmd; /* Current command */ struct mmc_command *data_cmd; /* Current data command */ + struct mmc_command *deferred_cmd; /* Deferred command */ struct mmc_data *data; /* Current data request */ unsigned int data_early:1; /* Data finished before cmd */ @@ -527,87 +550,109 @@ struct sdhci_host { dma_addr_t adma_addr; /* Mapped ADMA descr. table */ dma_addr_t align_addr; /* Mapped bounce buffer */ - unsigned int desc_sz; /* ADMA descriptor size */ + unsigned int desc_sz; /* ADMA current descriptor size */ + unsigned int alloc_desc_sz; /* ADMA descr. max size host supports */ - struct tasklet_struct finish_tasklet; /* Tasklet structures */ + struct workqueue_struct *complete_wq; /* Request completion wq */ + struct work_struct complete_work; /* Request completion work */ struct timer_list timer; /* Timer for timeouts */ struct timer_list data_timer; /* Timer for data timeouts */ +#if IS_ENABLED(CONFIG_MMC_SDHCI_EXTERNAL_DMA) + struct dma_chan *rx_chan; + struct dma_chan *tx_chan; +#endif + u32 caps; /* CAPABILITY_0 */ u32 caps1; /* CAPABILITY_1 */ bool read_caps; /* Capability flags have been read */ - unsigned int ocr_avail_sdio; /* OCR bit masks */ - unsigned int ocr_avail_sd; - unsigned int ocr_avail_mmc; + bool sdhci_core_to_disable_vqmmc; /* sdhci core can disable vqmmc */ + unsigned int ocr_avail_sdio; /* OCR bit masks */ + unsigned int ocr_avail_sd; + unsigned int ocr_avail_mmc; u32 ocr_mask; /* available voltages */ - unsigned timing; /* Current timing */ + unsigned timing; /* Current timing */ - u32 thread_isr; + u32 thread_isr; /* cached registers */ - u32 ier; + u32 ier; - bool cqe_on; /* CQE is operating */ - u32 cqe_ier; /* CQE interrupt mask */ - u32 cqe_err_ier; /* CQE error interrupt mask */ + bool cqe_on; /* CQE is operating */ + u32 cqe_ier; /* CQE interrupt mask */ + u32 cqe_err_ier; /* CQE error interrupt mask */ - wait_queue_head_t buf_ready_int; /* Waitqueue for Buffer Read Ready interrupt */ - unsigned int tuning_done; /* Condition flag set when CMD19 succeeds */ + wait_queue_head_t buf_ready_int; /* Waitqueue for Buffer Read Ready interrupt */ + unsigned int tuning_done; /* Condition flag set when CMD19 succeeds */ - unsigned int tuning_count; /* Timer count for re-tuning */ - unsigned int tuning_mode; /* Re-tuning mode supported by host */ + unsigned int tuning_count; /* Timer count for re-tuning */ + unsigned int tuning_mode; /* Re-tuning mode supported by host */ + unsigned int tuning_err; /* Error code for re-tuning */ #define SDHCI_TUNING_MODE_1 0 #define SDHCI_TUNING_MODE_2 1 #define SDHCI_TUNING_MODE_3 2 /* Delay (ms) between tuning commands */ - int tuning_delay; + int tuning_delay; + int tuning_loop_count; /* Host SDMA buffer boundary. */ - u32 sdma_boundary; + u32 sdma_boundary; - u64 data_timeout; + /* Host ADMA table count */ + u32 adma_table_cnt; - unsigned long private[0] ____cacheline_aligned; + u64 data_timeout; + + unsigned long private[] ____cacheline_aligned; }; struct sdhci_ops { #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS - u32 (*read_l)(struct sdhci_host *host, int reg); - u16 (*read_w)(struct sdhci_host *host, int reg); - u8 (*read_b)(struct sdhci_host *host, int reg); - void (*write_l)(struct sdhci_host *host, u32 val, int reg); - void (*write_w)(struct sdhci_host *host, u16 val, int reg); - void (*write_b)(struct sdhci_host *host, u8 val, int reg); + u32(*read_l) (struct sdhci_host * host, int reg); + u16(*read_w) (struct sdhci_host * host, int reg); + u8(*read_b) (struct sdhci_host * host, int reg); + void (*write_l) (struct sdhci_host * host, u32 val, int reg); + void (*write_w) (struct sdhci_host * host, u16 val, int reg); + void (*write_b) (struct sdhci_host * host, u8 val, int reg); #endif - void (*set_clock)(struct sdhci_host *host, unsigned int clock); - void (*set_power)(struct sdhci_host *host, unsigned char mode, - unsigned short vdd); + void (*set_clock) (struct sdhci_host * host, unsigned int clock); + void (*set_power) (struct sdhci_host * host, unsigned char mode, + unsigned short vdd); - u32 (*irq)(struct sdhci_host *host, u32 intmask); + u32(*irq) (struct sdhci_host * host, u32 intmask); - int (*enable_dma)(struct sdhci_host *host); - unsigned int (*get_max_clock)(struct sdhci_host *host); - unsigned int (*get_min_clock)(struct sdhci_host *host); + int (*set_dma_mask) (struct sdhci_host * host); + int (*enable_dma) (struct sdhci_host * host); + unsigned int (*get_max_clock) (struct sdhci_host * host); + unsigned int (*get_min_clock) (struct sdhci_host * host); /* get_timeout_clock should return clk rate in unit of Hz */ - unsigned int (*get_timeout_clock)(struct sdhci_host *host); - unsigned int (*get_max_timeout_count)(struct sdhci_host *host); - void (*set_timeout)(struct sdhci_host *host, - struct mmc_command *cmd); - void (*set_bus_width)(struct sdhci_host *host, int width); - void (*platform_send_init_74_clocks)(struct sdhci_host *host, - u8 power_mode); - unsigned int (*get_ro)(struct sdhci_host *host); - void (*reset)(struct sdhci_host *host, u8 mask); - int (*platform_execute_tuning)(struct sdhci_host *host, u32 opcode); - void (*set_uhs_signaling)(struct sdhci_host *host, unsigned int uhs); - void (*hw_reset)(struct sdhci_host *host); - void (*adma_workaround)(struct sdhci_host *host, u32 intmask); - void (*card_event)(struct sdhci_host *host); - void (*voltage_switch)(struct sdhci_host *host); + unsigned int (*get_timeout_clock) (struct sdhci_host * host); + unsigned int (*get_max_timeout_count) (struct sdhci_host * host); + void (*set_timeout) (struct sdhci_host * host, + struct mmc_command * cmd); + void (*set_bus_width) (struct sdhci_host * host, int width); + void (*platform_send_init_74_clocks) (struct sdhci_host * host, + u8 power_mode); + unsigned int (*get_ro) (struct sdhci_host * host); + void (*reset) (struct sdhci_host * host, u8 mask); + int (*platform_execute_tuning) (struct sdhci_host * host, u32 opcode); + void (*set_uhs_signaling) (struct sdhci_host * host, unsigned int uhs); + void (*hw_reset) (struct sdhci_host * host); + void (*adma_workaround) (struct sdhci_host * host, u32 intmask); + void (*card_event) (struct sdhci_host * host); + void (*voltage_switch) (struct sdhci_host * host); + void (*adma_write_desc) (struct sdhci_host * host, void **desc, + dma_addr_t addr, int len, unsigned int cmd); + void (*copy_to_bounce_buffer) (struct sdhci_host * host, + struct mmc_data * data, + unsigned int length); + void (*request_done) (struct sdhci_host * host, + struct mmc_request * mrq); + void (*dump_vendor_regs) (struct sdhci_host * host); }; #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS @@ -703,33 +748,31 @@ static inline void *sdhci_priv(struct sdhci_host *host) } void sdhci_card_detect(struct sdhci_host *host); -void __sdhci_read_caps(struct sdhci_host *host, u16 *ver, u32 *caps, - u32 *caps1); +void __sdhci_read_caps(struct sdhci_host *host, const u16 * ver, + const u32 * caps, const u32 * caps1); int sdhci_setup_host(struct sdhci_host *host); void sdhci_cleanup_host(struct sdhci_host *host); int __sdhci_add_host(struct sdhci_host *host); int sdhci_add_host(struct sdhci_host *host); void sdhci_remove_host(struct sdhci_host *host, int dead); -void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd); static inline void sdhci_read_caps(struct sdhci_host *host) { __sdhci_read_caps(host, NULL, NULL, NULL); } -static inline bool sdhci_sdio_irq_enabled(struct sdhci_host *host) -{ - return !!(host->flags & SDHCI_SDIO_IRQ_ENABLED); -} - u16 sdhci_calc_clk(struct sdhci_host *host, unsigned int clock, unsigned int *actual_clock); void sdhci_set_clock(struct sdhci_host *host, unsigned int clock); void sdhci_enable_clk(struct sdhci_host *host, u16 clk); void sdhci_set_power(struct sdhci_host *host, unsigned char mode, unsigned short vdd); +void sdhci_set_power_and_bus_voltage(struct sdhci_host *host, + unsigned char mode, unsigned short vdd); void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode, unsigned short vdd); +void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq); +int sdhci_request_atomic(struct mmc_host *mmc, struct mmc_request *mrq); void sdhci_set_bus_width(struct sdhci_host *host, int width); void sdhci_reset(struct sdhci_host *host, u8 mask); void sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned timing); @@ -738,12 +781,14 @@ void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios); int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, struct mmc_ios *ios); void sdhci_enable_sdio_irq(struct mmc_host *mmc, int enable); +void sdhci_adma_write_desc(struct sdhci_host *host, void **desc, + dma_addr_t addr, int len, unsigned int cmd); #ifdef CONFIG_PM int sdhci_suspend_host(struct sdhci_host *host); int sdhci_resume_host(struct sdhci_host *host); int sdhci_runtime_suspend_host(struct sdhci_host *host); -int sdhci_runtime_resume_host(struct sdhci_host *host); +int sdhci_runtime_resume_host(struct sdhci_host *host, int soft_reset); #endif void sdhci_cqe_enable(struct mmc_host *mmc); @@ -752,10 +797,15 @@ bool sdhci_cqe_irq(struct sdhci_host *host, u32 intmask, int *cmd_error, int *data_error); void sdhci_dumpregs(struct sdhci_host *host); +void sdhci_enable_v4_mode(struct sdhci_host *host); void sdhci_start_tuning(struct sdhci_host *host); void sdhci_end_tuning(struct sdhci_host *host); void sdhci_reset_tuning(struct sdhci_host *host); void sdhci_send_tuning(struct sdhci_host *host, u32 opcode); +void sdhci_abort_tuning(struct sdhci_host *host, u32 opcode); +void sdhci_switch_external_dma(struct sdhci_host *host, bool en); +void sdhci_set_data_timeout_irq(struct sdhci_host *host, bool enable); +void __sdhci_set_timeout(struct sdhci_host *host, struct mmc_command *cmd); #endif /* __SDHCI_HW_H */ diff --git a/platform/centec-arm64/tsingma-bsp/src/spi-ctc-qspi/spi-ctc-qspi.c b/platform/centec-arm64/tsingma-bsp/src/spi-ctc-qspi/spi-ctc-qspi.c index 936459bd3e73..fe3b5b736503 100644 --- a/platform/centec-arm64/tsingma-bsp/src/spi-ctc-qspi/spi-ctc-qspi.c +++ b/platform/centec-arm64/tsingma-bsp/src/spi-ctc-qspi/spi-ctc-qspi.c @@ -111,7 +111,7 @@ enum type_mode { TYPE_MAX }; -static int ctc_reg_read(struct ctc_qspi *ctc_qspi, u32 reg, u32 *value) +static int ctc_reg_read(struct ctc_qspi *ctc_qspi, u32 reg, u32 * value) { *value = readl(ctc_qspi->regs + reg); return *value; @@ -169,12 +169,12 @@ static noinline int ctc_write_tx_buf(struct ctc_qspi *ctc_qspi, u8 offset, return 0; } -static noinline int check_buf_ok(u8 *buf, int i) +static noinline int check_buf_ok(u8 * buf, int i) { return buf && (buf + i); } -static noinline int fill_tx_entry(struct ctc_qspi *ctc_qspi, u8 *buf, int i, +static noinline int fill_tx_entry(struct ctc_qspi *ctc_qspi, u8 * buf, int i, u8 off) { ctc_qspi->tx_entry |= buf[i] << (off % 4) * 8; @@ -182,12 +182,12 @@ static noinline int fill_tx_entry(struct ctc_qspi *ctc_qspi, u8 *buf, int i, return 0; } -static noinline void update_offset(u8 *offset, u8 off) +static noinline void update_offset(u8 * offset, u8 off) { *offset = off; } -static void ctc_fill_tx_buf(struct ctc_qspi *ctc_qspi, u8 *offset, u8 *buf, +static void ctc_fill_tx_buf(struct ctc_qspi *ctc_qspi, u8 * offset, u8 * buf, u32 len) { @@ -195,8 +195,9 @@ static void ctc_fill_tx_buf(struct ctc_qspi *ctc_qspi, u8 *offset, u8 *buf, u8 off = *offset; while (i < len) { - if (check_buf_ok(buf, i)) + if (check_buf_ok(buf, i)) { fill_tx_entry(ctc_qspi, buf, i, off); + } if (off % 4 == 0) { ctc_write_tx_buf(ctc_qspi, off, ctc_qspi->tx_entry); @@ -210,7 +211,7 @@ static void ctc_fill_tx_buf(struct ctc_qspi *ctc_qspi, u8 *offset, u8 *buf, } -static void ctc_fill_pp_buf(struct ctc_qspi *ctc_qspi, u32 *offset, u8 *buf, +static void ctc_fill_pp_buf(struct ctc_qspi *ctc_qspi, u32 * offset, u8 * buf, u32 len) { u32 i = 0, j = 0; @@ -218,8 +219,9 @@ static void ctc_fill_pp_buf(struct ctc_qspi *ctc_qspi, u32 *offset, u8 *buf, while (i < len) { for (j = 0; j < 4; j++) { - if (buf && (buf + i)) + if (buf && (buf + i)) { ctc_qspi->tx_entry |= buf[i + j] << (j % 4) * 8; + } } ctc_write_tx_buf(ctc_qspi, off, ctc_qspi->tx_entry); ctc_qspi->tx_entry = 0; @@ -303,15 +305,17 @@ static void ctc_qspi_pio_ctrl(struct ctc_qspi *ctc_qspi) { u32 ctrl = 0; - ctrl = CTRL_IDLE_CYCLE(ctc_qspi->idlecycle) | - CTRL_PRE_CYCLE(ctc_qspi->precycle) | - CTRL_POST_CYCLE(ctc_qspi->postcycle) | - CTRL_SCLK_DEFAULT(ctc_qspi->sclkdef) | - CTRL_SOUT3_DEFAULT(ctc_qspi->sout3def) | - CTRL_SOUT2_DEFAULT(ctc_qspi->sout2def) | - CTRL_SOUT1_DEFAULT(ctc_qspi->sout1def) | - CTRL_CS(ctc_qspi->cs_select) | - CTRL_DIV_SCLK(ctc_qspi->clkdiv); + ctrl = + CTRL_IDLE_CYCLE(ctc_qspi->idlecycle) | CTRL_PRE_CYCLE(ctc_qspi-> + precycle) + | CTRL_POST_CYCLE(ctc_qspi-> + postcycle) | CTRL_SCLK_DEFAULT(ctc_qspi->sclkdef) + | CTRL_SOUT3_DEFAULT(ctc_qspi-> + sout3def) | CTRL_SOUT2_DEFAULT(ctc_qspi-> + sout2def) + | CTRL_SOUT1_DEFAULT(ctc_qspi->sout1def) | CTRL_CS(ctc_qspi-> + cs_select) + | CTRL_DIV_SCLK(ctc_qspi->clkdiv); ctc_reg_write_mask(ctc_qspi, PIO_CTRL(ctc_qspi->qspi_mode), ctrl, 0xffffffff); @@ -321,15 +325,17 @@ static void ctc_qspi_pp_ctrl(struct ctc_qspi *ctc_qspi) { u32 ctrl = 0; - ctrl = CTRL_IDLE_CYCLE(ctc_qspi->idlecycle) | - CTRL_PRE_CYCLE(ctc_qspi->precycle) | - CTRL_POST_CYCLE(ctc_qspi->postcycle) | - CTRL_SCLK_DEFAULT(ctc_qspi->sclkdef) | - CTRL_SOUT3_DEFAULT(ctc_qspi->sout3def) | - CTRL_SOUT2_DEFAULT(ctc_qspi->sout2def) | - CTRL_SOUT1_DEFAULT(ctc_qspi->sout1def) | - CTRL_CS(ctc_qspi->cs_select) | - CTRL_DIV_SCLK(ctc_qspi->clkdiv); + ctrl = + CTRL_IDLE_CYCLE(ctc_qspi->idlecycle) | CTRL_PRE_CYCLE(ctc_qspi-> + precycle) + | CTRL_POST_CYCLE(ctc_qspi-> + postcycle) | CTRL_SCLK_DEFAULT(ctc_qspi->sclkdef) + | CTRL_SOUT3_DEFAULT(ctc_qspi-> + sout3def) | CTRL_SOUT2_DEFAULT(ctc_qspi-> + sout2def) + | CTRL_SOUT1_DEFAULT(ctc_qspi->sout1def) | CTRL_CS(ctc_qspi-> + cs_select) + | CTRL_DIV_SCLK(ctc_qspi->clkdiv); ctc_reg_write_mask(ctc_qspi, PP_CTRL, ctrl, 0xffffffff); } @@ -343,18 +349,17 @@ static u32 ctc_pp_conf(u8 lanes, u32 len) return (lanes << 16) | (cycle); } -static int ctc_read_rx_buf(struct ctc_qspi *ctc_qspi, u8 offset, u8 *value) +static int ctc_read_rx_buf(struct ctc_qspi *ctc_qspi, u8 offset, u8 * value) { *value = readb(ctc_qspi->regs + CTC_QSPI_RX_BUFF + offset); return 0; } -static void ctc_extra_rx_buf(struct ctc_qspi *ctc_qspi, u8 offset, u8 *buf, +static void ctc_extra_rx_buf(struct ctc_qspi *ctc_qspi, u8 offset, u8 * buf, u8 len) { int i = 0; - while (i < len) { ctc_read_rx_buf(ctc_qspi, offset, &buf[i++]); offset--; @@ -523,11 +528,13 @@ int ctc_qspi_adjust_op_size(struct spi_mem *mem, struct spi_mem_op *op) { //max data transfer size = tx buffer size - (cmd - addr -dummy ) if (op->data.dir == SPI_MEM_DATA_IN) { - if (op->data.nbytes > CTC_QSPI_RX_BUFFER_SIZE - 6) + if (op->data.nbytes > CTC_QSPI_RX_BUFFER_SIZE - 6) { op->data.nbytes = CTC_QSPI_RX_BUFFER_SIZE - 6; + } } else { - if (op->data.nbytes > CTC_QSPI_TX_BUFFER_SIZE) + if (op->data.nbytes > CTC_QSPI_TX_BUFFER_SIZE) { op->data.nbytes = CTC_QSPI_TX_BUFFER_SIZE; + } } return 0; @@ -558,7 +565,7 @@ static int ctc_qspi_probe(struct platform_device *pdev) return -ENOMEM; master->mode_bits = - SPI_MODE_3 | SPI_MODE_1 | SPI_TX_DUAL | SPI_RX_DUAL | SPI_TX_QUAD | + SPI_MODE_3 | SPI_MODE_0 | SPI_TX_DUAL | SPI_RX_DUAL | SPI_TX_QUAD | SPI_RX_QUAD; master->setup = ctc_qspi_setup; master->transfer_one_message = ctc_qspi_start_transfer_one; diff --git a/platform/centec/.gitignore b/platform/centec/.gitignore new file mode 100644 index 000000000000..1e65b8bb8dc6 --- /dev/null +++ b/platform/centec/.gitignore @@ -0,0 +1,8 @@ +centec-dal/.dal* +*.o +*.ko +.tmp_versions +.centec* +Module.symvers +*.mod.c +modules.order diff --git a/platform/centec/centec-dal/dal_kernel.c b/platform/centec/centec-dal/dal_kernel.c index 1651e803fabc..b70361825f3b 100644 --- a/platform/centec/centec-dal/dal_kernel.c +++ b/platform/centec/centec-dal/dal_kernel.c @@ -1176,7 +1176,12 @@ dal_alloc_dma_pool(int lchip, int size) if (use_high_memory) { dma_phy_base[lchip] = virt_to_bus(high_memory); - dma_virt_base[lchip] = ioremap_nocache(dma_phy_base[lchip], size); + /* + * ioremap has provided non-cached semantics by default + * since the Linux 2.6 days, so remove the additional + * ioremap_nocache interface. + */ + dma_virt_base[lchip] = ioremap(dma_phy_base[lchip], size); } else { @@ -1205,7 +1210,12 @@ dal_alloc_dma_pool(int lchip, int size) /* Get DMA memory from kernel */ dma_virt_base[lchip] = _dal_pgalloc(size); dma_phy_base[lchip] = virt_to_bus(dma_virt_base[lchip]); - //dma_virt_base [lchip]= ioremap_nocache(dma_phy_base[lchip], size); + /* + * ioremap has provided non-cached semantics by default + * since the Linux 2.6 days, so remove the additional + * ioremap_nocache interface. + */ + //dma_virt_base [lchip]= ioremap(dma_phy_base[lchip], size); #endif } } @@ -1943,7 +1953,12 @@ int linux_dal_pcie_probe(struct pci_dev* pdev, const struct pci_device_id* id) } dev->phys_address = pci_resource_start(pdev, bar); - dev->logic_address = (uintptr)ioremap_nocache(dev->phys_address, + /* + * ioremap has provided non-cached semantics by default + * since the Linux 2.6 days, so remove the additional + * ioremap_nocache interface. + */ + dev->logic_address = (uintptr)ioremap(dev->phys_address, pci_resource_len(dev->pci_dev, bar)); /*0: little endian 1: big endian*/ diff --git a/platform/centec/docker-saiserver-centec.dep b/platform/centec/docker-saiserver-centec.dep new file mode 100644 index 000000000000..e861406f5a83 --- /dev/null +++ b/platform/centec/docker-saiserver-centec.dep @@ -0,0 +1,10 @@ + +DPATH := $($(DOCKER_SAISERVER_CENTEC)_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/centec/docker-saiserver-centec.mk platform/centec/docker-saiserver-centec.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(DPATH)) + +$(DOCKER_SAISERVER_CENTEC)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_SAISERVER_CENTEC)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_SAISERVER_CENTEC)_DEP_FILES := $(DEP_FILES) + diff --git a/platform/centec/docker-saiserver-centec.mk b/platform/centec/docker-saiserver-centec.mk new file mode 100755 index 000000000000..78b7f44d7fbd --- /dev/null +++ b/platform/centec/docker-saiserver-centec.mk @@ -0,0 +1,16 @@ +# docker image for centec saiserver + +DOCKER_SAISERVER_CENTEC = docker-saiserver-centec.gz +$(DOCKER_SAISERVER_CENTEC)_PATH = $(PLATFORM_PATH)/docker-saiserver-centec +$(DOCKER_SAISERVER_CENTEC)_DEPENDS += $(SAISERVER) +$(DOCKER_SAISERVER_CENTEC)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_CENTEC) + +$(DOCKER_SAISERVER_CENTEC)_CONTAINER_NAME = saiserver +$(DOCKER_SAISERVER_CENTEC)_RUN_OPT += --privileged -t +$(DOCKER_SAISERVER_CENTEC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf +$(DOCKER_SAISERVER_CENTEC)_RUN_OPT += -v /var/run/docker-saiserver:/var/run/sswsyncd +$(DOCKER_SAISERVER_CENTEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_SAISERVER_CENTEC)_RUN_OPT += -v /host/warmboot:/var/warmboot + +SONIC_BUSTER_DOCKERS += $(DOCKER_SAISERVER_CENTEC) diff --git a/platform/centec/docker-saiserver-centec/Dockerfile.j2 b/platform/centec/docker-saiserver-centec/Dockerfile.j2 new file mode 100644 index 000000000000..264c8437973d --- /dev/null +++ b/platform/centec/docker-saiserver-centec/Dockerfile.j2 @@ -0,0 +1,33 @@ +FROM docker-config-engine-buster + +ARG docker_container_name +RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update \ + && apt-get -y install \ + libboost-atomic1.71-dev \ + libqt5core5a \ + libqt5network5 + +COPY \ +{% for deb in docker_saiserver_centec_debs.split(' ') -%} +debs/{{ deb }}{{' '}} +{%- endfor -%} +debs/ + +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ +{% for deb in docker_saiserver_centec_debs.split(' ') -%} +dpkg_apt debs/{{ deb }}{{'; '}} +{%- endfor %} + +COPY ["start.sh", "/usr/bin/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] + +## Clean up +RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y +RUN rm -rf /debs + +ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/platform/centec/docker-saiserver-centec/start.sh b/platform/centec/docker-saiserver-centec/start.sh new file mode 100755 index 000000000000..936f43cd1f06 --- /dev/null +++ b/platform/centec/docker-saiserver-centec/start.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +start_centec() +{ +} + + +rm -f /var/run/rsyslogd.pid + +supervisorctl start rsyslogd + +start_centec + +supervisorctl start saiserver diff --git a/platform/centec/docker-saiserver-centec/supervisord.conf b/platform/centec/docker-saiserver-centec/supervisord.conf new file mode 100644 index 000000000000..ccb107b3d1f8 --- /dev/null +++ b/platform/centec/docker-saiserver-centec/supervisord.conf @@ -0,0 +1,28 @@ +[supervisord] +logfile_maxbytes=1MB +logfile_backups=2 +nodaemon=true + +[program:start.sh] +command=/usr/bin/start.sh +priority=1 +autostart=true +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:rsyslogd] +command=/usr/sbin/rsyslogd -n +priority=2 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog + +[program:saiserver] +command=/usr/sbin/saiserver -p /usr/share/sonic/hwsku/sai.profile -f /usr/share/sonic/hwsku/port_config.ini +priority=3 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/platform/centec/docker-syncd-centec-rpc.mk b/platform/centec/docker-syncd-centec-rpc.mk index 88c101182bb8..a2d4f9287735 100644 --- a/platform/centec/docker-syncd-centec-rpc.mk +++ b/platform/centec/docker-syncd-centec-rpc.mk @@ -17,9 +17,11 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC_RPC) endif $(DOCKER_SYNCD_CENTEC_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_CENTEC_RPC)_VERSION = 1.0.0-rpc +$(DOCKER_SYNCD_CENTEC_RPC)_VERSION = 1.0.0+rpc $(DOCKER_SYNCD_CENTEC_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd $(DOCKER_SYNCD_CENTEC_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro + +SONIC_BUSTER_DOCKERS += $(DOCKER_SYNCD_CENTEC_RPC) diff --git a/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 b/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 index bec9c7f4426b..a760c278396a 100644 --- a/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 +++ b/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 @@ -2,6 +2,11 @@ FROM docker-syncd-centec ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update \ + && apt-get -y install \ + libboost-atomic1.71-dev \ + libqt5core5a \ + libqt5network5 COPY \ {% for deb in docker_syncd_centec_rpc_debs.split(' ') -%} diff --git a/platform/centec/libsaithrift-dev.mk b/platform/centec/libsaithrift-dev.mk index fdcbfd664e1f..a58befacfe43 100644 --- a/platform/centec/libsaithrift-dev.mk +++ b/platform/centec/libsaithrift-dev.mk @@ -4,7 +4,7 @@ SAI_VER = 0.9.4 LIBSAITHRIFT_DEV = libsaithrift-dev_$(SAI_VER)_amd64.deb $(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI -$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(CENTEC_SAI) +$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(CENTEC_SAI) $(LIBHIREDIS) $(LIBNL3_DEV) $(LIBNL_GENL3_DEV) $(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT) $(CENTEC_SAI) SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV) @@ -12,7 +12,8 @@ PYTHON_SAITHRIFT = python-saithrift_$(SAI_VER)_amd64.deb $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(PYTHON_SAITHRIFT))) SAISERVER = saiserver_$(SAI_VER)_amd64.deb -$(SAISERVER)_RDEPENDS += $(LIBTHRIFT) $(BRCM_SAI) +$(SAISERVER)_DEPENDS += $(LIBHIREDIS) +$(SAISERVER)_RDEPENDS += $(LIBTHRIFT) $(CENTEC_SAI) $(LIBHIREDIS) $(LIBNL3_DEV) $(LIBNL_GENL3_DEV) $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER))) SAISERVER_DBG = saiserver-dbg_$(SAI_VER)_amd64.deb diff --git a/platform/centec/one-image.mk b/platform/centec/one-image.mk index a92c97078846..84b993bb5986 100644 --- a/platform/centec/one-image.mk +++ b/platform/centec/one-image.mk @@ -7,6 +7,11 @@ $(SONIC_ONE_IMAGE)_INSTALLS = $(SYSTEMD_SONIC_GENERATOR) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(CENTEC_E582_48X6Q_PLATFORM_MODULE) \ $(CENTEC_E582_48X2Q4Z_PLATFORM_MODULE) \ $(EMBEDWAY_ES6220_PLATFORM_MODULE) + +$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(CENTEC_V682_48Y8C_D_PLATFORM_MODULE) +$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(CENTEC_V682_48Y8C_PLATFORM_MODULE) +$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(CENTEC_V682_48X8C_PLATFORM_MODULE) + ifeq ($(INSTALL_DEBUG_TOOLS),y) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_DBG_IMAGES) $(SONIC_ONE_IMAGE)_DOCKERS += $(filter-out $(patsubst %-$(DBG_IMAGE_MARK).gz,%.gz, $(SONIC_INSTALL_DOCKER_DBG_IMAGES)), $(SONIC_INSTALL_DOCKER_IMAGES)) diff --git a/platform/centec/platform-modules-centec-v682.mk b/platform/centec/platform-modules-centec-v682.mk new file mode 100644 index 000000000000..46b64c3e6d72 --- /dev/null +++ b/platform/centec/platform-modules-centec-v682.mk @@ -0,0 +1,26 @@ +# Centec V682-48Y8C-D Platform modules + + +CENTEC_V682_48Y8C_D_PLATFORM_MODULE_VERSION =1.0 +CENTEC_V682_48Y8C_PLATFORM_MODULE_VERSION =1.0 +CENTEC_V682_48X8C_PLATFORM_MODULE_VERSION =1.0 + +export CENTEC_V682_48Y8C_D_PLATFORM_MODULE_VERSION +export CENTEC_V682_48Y8C_PLATFORM_MODULE_VERSION +export CENTEC_V682_48X8C_PLATFORM_MODULE_VERSION + +CENTEC_V682_48Y8C_D_PLATFORM_MODULE = platform-modules-v682-48y8c-d_$(CENTEC_V682_48Y8C_D_PLATFORM_MODULE_VERSION)_amd64.deb + +$(CENTEC_V682_48Y8C_D_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-v682 +$(CENTEC_V682_48Y8C_D_PLATFORM_MODULE)_PLATFORM = x86_64-centec_v682_48y8c_d-r0 +$(CENTEC_V682_48Y8C_D_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +SONIC_STRETCH_DEBS += $(CENTEC_V682_48Y8C_D_PLATFORM_MODULE) +SONIC_DPKG_DEBS += $(CENTEC_V682_48Y8C_D_PLATFORM_MODULE) + +CENTEC_V682_48Y8C_PLATFORM_MODULE = platform-modules-v682-48y8c_$(CENTEC_V682_48Y8C_PLATFORM_MODULE_VERSION)_amd64.deb +$(CENTEC_V682_48Y8C_PLATFORM_MODULE)_PLATFORM = x86_64-centec_v682_48y8c-r0 +$(eval $(call add_extra_package,$(CENTEC_V682_48Y8C_D_PLATFORM_MODULE),$(CENTEC_V682_48Y8C_PLATFORM_MODULE))) + +CENTEC_V682_48X8C_PLATFORM_MODULE = platform-modules-v682-48x8c_$(CENTEC_V682_48X8C_PLATFORM_MODULE_VERSION)_amd64.deb +$(CENTEC_V682_48X8C_PLATFORM_MODULE)_PLATFORM = x86_64-centec_v682_48x8c-r0 +$(eval $(call add_extra_package,$(CENTEC_V682_48Y8C_D_PLATFORM_MODULE),$(CENTEC_V682_48X8C_PLATFORM_MODULE))) diff --git a/platform/centec/rules.mk b/platform/centec/rules.mk index 182248ec1ac6..5e207846f49a 100644 --- a/platform/centec/rules.mk +++ b/platform/centec/rules.mk @@ -1,8 +1,10 @@ include $(PLATFORM_PATH)/platform-modules-centec-e582.mk include $(PLATFORM_PATH)/platform-modules-embedway.mk +include $(PLATFORM_PATH)/platform-modules-centec-v682.mk include $(PLATFORM_PATH)/sdk.mk include $(PLATFORM_PATH)/docker-syncd-centec.mk include $(PLATFORM_PATH)/docker-syncd-centec-rpc.mk +include $(PLATFORM_PATH)/docker-saiserver-centec.mk include $(PLATFORM_PATH)/one-image.mk include $(PLATFORM_PATH)/libsaithrift-dev.mk diff --git a/platform/centec/sdk.mk b/platform/centec/sdk.mk index 588b2b244130..2f56265b4890 100644 --- a/platform/centec/sdk.mk +++ b/platform/centec/sdk.mk @@ -1,6 +1,6 @@ # Centec SAI -CENTEC_SAI = libsai_1.6.3-1_amd64.deb -$(CENTEC_SAI)_URL = https://github.com/CentecNetworks/sonic-binaries/raw/master/amd64/$(CENTEC_SAI) +CENTEC_SAI = libsai_1.9.1-0_amd64.deb +$(CENTEC_SAI)_URL = https://github.com/CentecNetworks/sonic-binaries/raw/master/amd64/sai/$(CENTEC_SAI) $(eval $(call add_conflict_package,$(CENTEC_SAI),$(LIBSAIVS_DEV))) SONIC_ONLINE_DEBS += $(CENTEC_SAI) diff --git a/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/Makefile b/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/Makefile index 645ca1c2e9e1..a7839bc06016 100644 --- a/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/Makefile +++ b/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/Makefile @@ -1 +1,3 @@ -obj-m := centec_e582_48x2q4z_platform.o centec_at24c64.o +KBUILD_EXTRA_SYMBOLS = /sonic/platform/centec-arm64/sonic-platform-modules-e530/pca954x/Module.symvers + +obj-m := centec_e582_48x2q4z_platform.o diff --git a/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/centec_at24c64.c b/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/centec_at24c64.c deleted file mode 100644 index e1835df88625..000000000000 --- a/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/centec_at24c64.c +++ /dev/null @@ -1,602 +0,0 @@ -/* - * at24.c - handle most I2C EEPROMs - * - * Copyright (C) 2005-2007 David Brownell - * Copyright (C) 2008 Wolfram Sang, Pengutronix - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * I2C EEPROMs from most vendors are inexpensive and mostly interchangeable. - * Differences between different vendor product lines (like Atmel AT24C or - * MicroChip 24LC, etc) won't much matter for typical read/write access. - * There are also I2C RAM chips, likewise interchangeable. One example - * would be the PCF8570, which acts like a 24c02 EEPROM (256 bytes). - * - * However, misconfiguration can lose data. "Set 16-bit memory address" - * to a part with 8-bit addressing will overwrite data. Writing with too - * big a page size also loses data. And it's not safe to assume that the - * conventional addresses 0x50..0x57 only hold eeproms; a PCF8563 RTC - * uses 0x51, for just one example. - * - * Accordingly, explicit board-specific configuration data should be used - * in almost all cases. (One partial exception is an SMBus used to access - * "SPD" data for DRAM sticks. Those only use 24c02 EEPROMs.) - * - * So this driver uses "new style" I2C driver binding, expecting to be - * told what devices exist. That may be in arch/X/mach-Y/board-Z.c or - * similar kernel-resident tables; or, configuration data coming from - * a bootloader. - * - * Other than binding model, current differences from "eeprom" driver are - * that this one handles write access and isn't restricted to 24c02 devices. - * It also handles larger devices (32 kbit and up) with two-byte addresses, - * which won't work on pure SMBus systems. - */ - -struct at24_data { - struct at24_platform_data chip; - int use_smbus; - - /* - * Lock protects against activities from other Linux tasks, - * but not from changes by other I2C masters. - */ - struct mutex lock; - struct bin_attribute bin; - - u8 *writebuf; - unsigned write_max; - unsigned num_addresses; - - /* - * Some chips tie up multiple I2C addresses; dummy devices reserve - * them for us, and we'll use them with SMBus calls. - */ - struct i2c_client *client[]; -}; - -/* - * This parameter is to help this driver avoid blocking other drivers out - * of I2C for potentially troublesome amounts of time. With a 100 kHz I2C - * clock, one 256 byte read takes about 1/43 second which is excessive; - * but the 1/170 second it takes at 400 kHz may be quite reasonable; and - * at 1 MHz (Fm+) a 1/430 second delay could easily be invisible. - * - * This value is forced to be a power of two so that writes align on pages. - */ -static unsigned io_limit = 128; -module_param(io_limit, uint, 0); -MODULE_PARM_DESC(io_limit, "Maximum bytes per I/O (default 128)"); - -/* - * Specs often allow 5 msec for a page write, sometimes 20 msec; - * it's important to recover from write timeouts. - */ -static unsigned write_timeout = 25; -module_param(write_timeout, uint, 0); -MODULE_PARM_DESC(write_timeout, "Time (in ms) to try writes (default 25)"); - -#define AT24_SIZE_BYTELEN 5 -#define AT24_SIZE_FLAGS 8 - -#define AT24_BITMASK(x) (BIT(x) - 1) - -/* create non-zero magic value for given eeprom parameters */ -#define AT24_DEVICE_MAGIC(_len, _flags) \ - ((1 << AT24_SIZE_FLAGS | (_flags)) \ - << AT24_SIZE_BYTELEN | ilog2(_len)) - -static const struct i2c_device_id at24_ctc_ids[] = { - { "24c64-ctc", AT24_DEVICE_MAGIC(65536 / 8, AT24_FLAG_ADDR16 | AT24_FLAG_READONLY | AT24_FLAG_IRUGO) }, - { /* END OF LIST */ } -}; -MODULE_DEVICE_TABLE(i2c, at24_ctc_ids); - -/*-------------------------------------------------------------------------*/ - -/* - * This routine supports chips which consume multiple I2C addresses. It - * computes the addressing information to be used for a given r/w request. - * Assumes that sanity checks for offset happened at sysfs-layer. - */ -static struct i2c_client *at24_translate_offset(struct at24_data *at24, - unsigned *offset) -{ - unsigned i = 0; - - if (at24->chip.flags & AT24_FLAG_ADDR16) { - i = *offset >> 16; - *offset &= 0xffff; - } else { - i = *offset >> 8; - *offset &= 0xff; - } - - return at24->client[i]; -} - -static ssize_t at24_eeprom_read(struct at24_data *at24, char *buf, - unsigned offset, size_t count) -{ - struct i2c_msg msg[2]; - struct i2c_client *client; - unsigned long timeout, read_time; - int status; - - memset(msg, 0, sizeof(msg)); - - /* - * REVISIT some multi-address chips don't rollover page reads to - * the next slave address, so we may need to truncate the count. - * Those chips might need another quirk flag. - * - * If the real hardware used four adjacent 24c02 chips and that - * were misconfigured as one 24c08, that would be a similar effect: - * one "eeprom" file not four, but larger reads would fail when - * they crossed certain pages. - */ - - /* - * Slave address and byte offset derive from the offset. Always - * set the byte address; on a multi-master board, another master - * may have changed the chip's "current" address pointer. - */ - client = at24_translate_offset(at24, &offset); - - if (count > io_limit) - count = io_limit; - - count = 1; - - /* - * Reads fail if the previous write didn't complete yet. We may - * loop a few times until this one succeeds, waiting at least - * long enough for one entire page write to work. - */ - timeout = jiffies + msecs_to_jiffies(write_timeout); - do { - read_time = jiffies; - - status = i2c_smbus_write_byte_data(client, (offset >> 8) & 0x0ff, offset & 0x0ff ); - status = i2c_smbus_read_byte(client); - if (status >= 0) { - buf[0] = status; - status = count; - } - - dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n", count, offset, status, jiffies); - - if (status == count) - return count; - - /* REVISIT: at HZ=100, this is sloooow */ - msleep(1); - } while (time_before(read_time, timeout)); - - return -ETIMEDOUT; -} - -static ssize_t at24_read(struct at24_data *at24, - char *buf, loff_t off, size_t count) -{ - ssize_t retval = 0; - - if (unlikely(!count)) - return count; - - memset(buf, 0, count); - - /* - * Read data from chip, protecting against concurrent updates - * from this host, but not from other I2C masters. - */ - mutex_lock(&at24->lock); - - while (count) { - ssize_t status; - - status = at24_eeprom_read(at24, buf, off, count); - if (status <= 0) { - if (retval == 0) - retval = status; - break; - } - buf += status; - off += status; - count -= status; - retval += status; - } - - mutex_unlock(&at24->lock); - - return retval; -} - -static ssize_t at24_bin_read(struct file *filp, struct kobject *kobj, - struct bin_attribute *attr, - char *buf, loff_t off, size_t count) -{ - struct at24_data *at24; - - at24 = dev_get_drvdata(container_of(kobj, struct device, kobj)); - return at24_read(at24, buf, off, count); -} - - -/* - * Note that if the hardware write-protect pin is pulled high, the whole - * chip is normally write protected. But there are plenty of product - * variants here, including OTP fuses and partial chip protect. - * - * We only use page mode writes; the alternative is sloooow. This routine - * writes at most one page. - */ -static ssize_t at24_eeprom_write(struct at24_data *at24, const char *buf, - unsigned offset, size_t count) -{ - struct i2c_client *client; - ssize_t status; - unsigned long timeout, write_time; - unsigned next_page; - - /* Get corresponding I2C address and adjust offset */ - client = at24_translate_offset(at24, &offset); - - /* write_max is at most a page */ - if (count > at24->write_max) - count = at24->write_max; - - /* Never roll over backwards, to the start of this page */ - next_page = roundup(offset + 1, at24->chip.page_size); - if (offset + count > next_page) - count = next_page - offset; - - /* - * Writes fail if the previous one didn't complete yet. We may - * loop a few times until this one succeeds, waiting at least - * long enough for one entire page write to work. - */ - timeout = jiffies + msecs_to_jiffies(write_timeout); - do { - write_time = jiffies; - - status = i2c_smbus_write_word_data(client, (offset >> 8) & 0x0ff, (offset & 0xFF) | buf[0]); - if (status == 0) - status = count; - - dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", count, offset, status, jiffies); - - if (status == count) - return count; - - /* REVISIT: at HZ=100, this is sloooow */ - msleep(1); - } while (time_before(write_time, timeout)); - - return -ETIMEDOUT; -} - -static ssize_t at24_write(struct at24_data *at24, const char *buf, loff_t off, - size_t count) -{ - ssize_t retval = 0; - - if (unlikely(!count)) - return count; - - /* - * Write data to chip, protecting against concurrent updates - * from this host, but not from other I2C masters. - */ - mutex_lock(&at24->lock); - - while (count) { - ssize_t status; - - status = at24_eeprom_write(at24, buf, off, 1); /* only one-byte to write; TODO page wirte */ - if (status <= 0) { - if (retval == 0) - retval = status; - break; - } - buf += status; - off += status; - count -= status; - retval += status; - } - - mutex_unlock(&at24->lock); - - return retval; -} - -static ssize_t at24_bin_write(struct file *filp, struct kobject *kobj, - struct bin_attribute *attr, - char *buf, loff_t off, size_t count) -{ - struct at24_data *at24; - - if (unlikely(off >= attr->size)) - return -EFBIG; - - at24 = dev_get_drvdata(container_of(kobj, struct device, kobj)); - return at24_write(at24, buf, off, count); -} - -/*-------------------------------------------------------------------------*/ - -#ifdef CONFIG_OF -static void at24_get_ofdata(struct i2c_client *client, - struct at24_platform_data *chip) -{ - const __be32 *val; - struct device_node *node = client->dev.of_node; - - if (node) { - if (of_get_property(node, "read-only", NULL)) - chip->flags |= AT24_FLAG_READONLY; - val = of_get_property(node, "pagesize", NULL); - if (val) - chip->page_size = be32_to_cpup(val); - } -} -#else -static void at24_get_ofdata(struct i2c_client *client, - struct at24_platform_data *chip) -{ } -#endif /* CONFIG_OF */ - -static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) -{ - struct at24_platform_data chip; - bool writable; - int use_smbus = 0; - struct at24_data *at24; - int err; - unsigned i, num_addresses; - kernel_ulong_t magic; - - if (client->dev.platform_data) { - chip = *(struct at24_platform_data *)client->dev.platform_data; - } else { - if (!id->driver_data) - return -ENODEV; - - magic = id->driver_data; - chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN)); - magic >>= AT24_SIZE_BYTELEN; - chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS); - - /* - * This is slow, but we can't know all eeproms, so we better - * play safe. Specifying custom eeprom-types via platform_data - * is recommended anyhow. - */ - chip.page_size = 1; - - /* update chipdata if OF is present */ - at24_get_ofdata(client, &chip); - - chip.setup = NULL; - chip.context = NULL; - } - - if (!is_power_of_2(chip.byte_len)) - dev_warn(&client->dev, - "byte_len looks suspicious (no power of 2)!\n"); - if (!chip.page_size) { - dev_err(&client->dev, "page_size must not be 0!\n"); - return -EINVAL; - } - if (!is_power_of_2(chip.page_size)) - dev_warn(&client->dev, - "page_size looks suspicious (no power of 2)!\n"); - - /* Use I2C operations unless we're stuck with SMBus extensions. */ - if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { - if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { - use_smbus = I2C_SMBUS_I2C_BLOCK_DATA; - } else if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_WORD_DATA)) { - use_smbus = I2C_SMBUS_WORD_DATA; - } else if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BYTE_DATA)) { - use_smbus = I2C_SMBUS_BYTE_DATA; - } else { - return -EPFNOSUPPORT; - } - use_smbus = I2C_SMBUS_BYTE_DATA; - } - - if (chip.flags & AT24_FLAG_TAKE8ADDR) - num_addresses = 8; - else - num_addresses = DIV_ROUND_UP(chip.byte_len, (chip.flags & AT24_FLAG_ADDR16) ? 65536 : 256); - - at24 = devm_kzalloc(&client->dev, sizeof(struct at24_data) + num_addresses * sizeof(struct i2c_client *), GFP_KERNEL); - if (!at24) - return -ENOMEM; - - mutex_init(&at24->lock); - at24->use_smbus = use_smbus; - at24->chip = chip; - at24->num_addresses = num_addresses; - - printk(KERN_ALERT "at24_probe chip.byte_len = 0x%x\n", chip.byte_len); - printk(KERN_ALERT "at24_probe chip.flags = 0x%x\n", chip.flags); - printk(KERN_ALERT "at24_probe chip.magic = 0x%lx\n", id->driver_data); - printk(KERN_ALERT "at24_probe use_smbus = %d\n", at24->use_smbus); - printk(KERN_ALERT "at24_probe num_addresses = %d\n", at24->num_addresses); - - /* - * Export the EEPROM bytes through sysfs, since that's convenient. - * By default, only root should see the data (maybe passwords etc) - */ - sysfs_bin_attr_init(&at24->bin); - at24->bin.attr.name = "eeprom"; - at24->bin.attr.mode = chip.flags & AT24_FLAG_IRUGO ? S_IRUGO : S_IRUSR; - at24->bin.read = at24_bin_read; - at24->bin.size = chip.byte_len; - - writable = !(chip.flags & AT24_FLAG_READONLY); - if (writable) { - if (!use_smbus || i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) { - unsigned write_max = chip.page_size; - - at24->bin.write = at24_bin_write; - at24->bin.attr.mode |= S_IWUSR; - - if (write_max > io_limit) - write_max = io_limit; - if (use_smbus && write_max > I2C_SMBUS_BLOCK_MAX) - write_max = I2C_SMBUS_BLOCK_MAX; - at24->write_max = write_max; - - /* buffer (data + address at the beginning) */ - at24->writebuf = devm_kzalloc(&client->dev, write_max + 2, GFP_KERNEL); - if (!at24->writebuf) - return -ENOMEM; - } else { - dev_warn(&client->dev, "cannot write due to controller restrictions."); - } - } - - at24->client[0] = client; - - /* use dummy devices for multiple-address chips */ - for (i = 1; i < num_addresses; i++) { - at24->client[i] = i2c_new_dummy(client->adapter, client->addr + i); - if (!at24->client[i]) { - dev_err(&client->dev, "address 0x%02x unavailable\n", client->addr + i); - err = -EADDRINUSE; - goto err_clients; - } - } - - err = sysfs_create_bin_file(&client->dev.kobj, &at24->bin); - if (err) - goto err_clients; - - i2c_set_clientdata(client, at24); - - printk(KERN_ALERT "at24_probe %s done\n", client->name); - - return 0; - -err_clients: - for (i = 1; i < num_addresses; i++) - if (at24->client[i]) - i2c_unregister_device(at24->client[i]); - - return err; -} - -static int at24_remove(struct i2c_client *client) -{ - struct at24_data *at24; - int i; - - at24 = i2c_get_clientdata(client); - sysfs_remove_bin_file(&client->dev.kobj, &at24->bin); - - for (i = 1; i < at24->num_addresses; i++) - i2c_unregister_device(at24->client[i]); - - return 0; -} - -/*-------------------------------------------------------------------------*/ - -static struct i2c_board_info i2c_devs = { - I2C_BOARD_INFO("24c64-ctc", 0x57), -}; - -static struct i2c_adapter *adapter = NULL; -static struct i2c_client *client = NULL; - -static int ctc_at24c64_init(void) -{ - printk(KERN_ALERT "ctc_at24c64_init\n"); - - adapter = i2c_get_adapter(0); - if(adapter == NULL){ - printk(KERN_ALERT "i2c_get_adapter == NULL\n"); - return -1; - } - - client = i2c_new_device(adapter, &i2c_devs); - if(client == NULL){ - printk(KERN_ALERT "i2c_new_device == NULL\n"); - i2c_put_adapter(adapter); - adapter = NULL; - return -1; - } - - return 0; -} - -static void ctc_at24c64_exit(void) -{ - printk(KERN_ALERT "ctc_at24c64_exit\n"); - if(client){ - i2c_unregister_device(client); - } - if(adapter){ - i2c_put_adapter(adapter); - } -} - -static struct i2c_driver at24_ctc_driver = { - .driver = { - .name = "at24-ctc", - .owner = THIS_MODULE, - }, - .probe = at24_probe, - .remove = at24_remove, - .id_table = at24_ctc_ids, -}; - -static int __init at24_ctc_init(void) -{ - if (!io_limit) { - pr_err("at24_ctc: io_limit must not be 0!\n"); - return -EINVAL; - } - - io_limit = rounddown_pow_of_two(io_limit); - - ctc_at24c64_init(); - - return i2c_add_driver(&at24_ctc_driver); -} -module_init(at24_ctc_init); - -static void __exit at24_ctc_exit(void) -{ - ctc_at24c64_exit(); - i2c_del_driver(&at24_ctc_driver); -} -module_exit(at24_ctc_exit); - -MODULE_DESCRIPTION("Driver for most I2C EEPROMs"); -MODULE_AUTHOR("David Brownell and Wolfram Sang"); -MODULE_LICENSE("GPL"); -/* XXX */ - diff --git a/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/centec_e582_48x2q4z_platform.c b/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/centec_e582_48x2q4z_platform.c index 6e06a67f8dd2..c1d0c8aa5f20 100644 --- a/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/centec_e582_48x2q4z_platform.c +++ b/platform/centec/sonic-platform-modules-e582/48x2q4z/modules/centec_e582_48x2q4z_platform.c @@ -1,7 +1,7 @@ #include #include #include -#include +#include "../../pca954x/ctc-pca954x.h" #include #include #include @@ -95,7 +95,7 @@ static struct pca954x_platform_data i2c_dev_pca9548_platform_data = { .num_modes = PCA9548_CHANNEL_NUM, }; static struct i2c_board_info i2c_dev_pca9548 = { - I2C_BOARD_INFO("pca9548", 0x70), + I2C_BOARD_INFO("ctc_pca9548", 0x70), .platform_data = &i2c_dev_pca9548_platform_data, }; static struct i2c_client *i2c_client_pca9548x = NULL; @@ -110,7 +110,7 @@ static int e582_48x2q4z_init_i2c_pca9548(void) } /* install i2c-mux */ - i2c_client_pca9548x = i2c_new_device(i2c_adp_master, &i2c_dev_pca9548); + i2c_client_pca9548x = i2c_new_client_device(i2c_adp_master, &i2c_dev_pca9548); if(IS_INVALID_PTR(i2c_client_pca9548x)) { i2c_client_pca9548x = NULL; @@ -150,7 +150,7 @@ static int e582_48x2q4z_init_i2c_adt7470(void) return -1; } - i2c_client_adt7470 = i2c_new_device(i2c_adp_adt7470, &i2c_dev_adt7470); + i2c_client_adt7470 = i2c_new_client_device(i2c_adp_adt7470, &i2c_dev_adt7470); if(IS_INVALID_PTR(i2c_client_adt7470)){ i2c_client_adt7470 = NULL; printk(KERN_CRIT "install e582_48x2q4z board adt7470 failed\n"); @@ -206,14 +206,14 @@ static int e582_48x2q4z_init_i2c_psu(void) return -1; } - i2c_client_psu1 = i2c_new_device(i2c_adp_psu1, &i2c_dev_psu1); + i2c_client_psu1 = i2c_new_client_device(i2c_adp_psu1, &i2c_dev_psu1); if(IS_INVALID_PTR(i2c_client_psu1)){ i2c_client_psu1 = NULL; printk(KERN_CRIT "create e582_48x2q4z board i2c client psu1 failed\n"); return -1; } - i2c_client_psu2 = i2c_new_device(i2c_adp_psu2, &i2c_dev_psu2); + i2c_client_psu2 = i2c_new_client_device(i2c_adp_psu2, &i2c_dev_psu2); if(IS_INVALID_PTR(i2c_client_psu2)){ i2c_client_psu2 = NULL; printk(KERN_CRIT "create e582_48x2q4z board i2c client psu2 failed\n"); @@ -265,7 +265,7 @@ static int e582_48x2q4z_init_i2c_epld(void) return -1; } - i2c_client_epld = i2c_new_device(i2c_adp_master, &i2c_dev_epld); + i2c_client_epld = i2c_new_client_device(i2c_adp_master, &i2c_dev_epld); if(IS_INVALID_PTR(i2c_client_epld)) { i2c_client_epld = NULL; @@ -362,7 +362,7 @@ static int e582_48x2q4z_init_i2c_gpio(void) return -1; } - i2c_client_gpio0 = i2c_new_device(i2c_adp_gpio0, &i2c_dev_gpio0); + i2c_client_gpio0 = i2c_new_client_device(i2c_adp_gpio0, &i2c_dev_gpio0); if(IS_INVALID_PTR(i2c_client_gpio0)) { i2c_client_gpio0 = NULL; @@ -370,7 +370,7 @@ static int e582_48x2q4z_init_i2c_gpio(void) return -1; } - i2c_client_gpio1 = i2c_new_device(i2c_adp_gpio1, &i2c_dev_gpio1); + i2c_client_gpio1 = i2c_new_client_device(i2c_adp_gpio1, &i2c_dev_gpio1); if(IS_INVALID_PTR(i2c_client_gpio1)) { i2c_client_gpio1 = NULL; @@ -378,7 +378,7 @@ static int e582_48x2q4z_init_i2c_gpio(void) return -1; } - i2c_client_gpio2 = i2c_new_device(i2c_adp_gpio2, &i2c_dev_gpio2); + i2c_client_gpio2 = i2c_new_client_device(i2c_adp_gpio2, &i2c_dev_gpio2); if(IS_INVALID_PTR(i2c_client_gpio2)) { i2c_client_gpio2 = NULL; @@ -386,7 +386,7 @@ static int e582_48x2q4z_init_i2c_gpio(void) return -1; } - i2c_client_gpio3 = i2c_new_device(i2c_adp_gpio3, &i2c_dev_gpio3); + i2c_client_gpio3 = i2c_new_client_device(i2c_adp_gpio3, &i2c_dev_gpio3); if(IS_INVALID_PTR(i2c_client_gpio3)) { i2c_client_gpio3 = NULL; @@ -394,7 +394,7 @@ static int e582_48x2q4z_init_i2c_gpio(void) return -1; } - i2c_client_gpio4 = i2c_new_device(i2c_adp_gpio4, &i2c_dev_gpio4); + i2c_client_gpio4 = i2c_new_client_device(i2c_adp_gpio4, &i2c_dev_gpio4); if(IS_INVALID_PTR(i2c_client_gpio4)) { i2c_client_gpio4 = NULL; diff --git a/platform/centec/sonic-platform-modules-e582/48x2q4z/scripts/48x2q4z_platform.sh b/platform/centec/sonic-platform-modules-e582/48x2q4z/scripts/48x2q4z_platform.sh index 0edb50901425..f797909fa848 100755 --- a/platform/centec/sonic-platform-modules-e582/48x2q4z/scripts/48x2q4z_platform.sh +++ b/platform/centec/sonic-platform-modules-e582/48x2q4z/scripts/48x2q4z_platform.sh @@ -25,12 +25,13 @@ if [ "$1" == "init" ]; then modprobe i2c-dev modprobe i2c-mux modprobe i2c-smbus - modprobe i2c-mux-pca954x force_deselect_on_exit=1 + modprobe ctc-i2c-mux-pca954x force_deselect_on_exit=1 i2cset -y 0 0x58 0x8 0x3f modprobe lm77 modprobe tun modprobe dal - modprobe centec_at24c64 + modprobe at24 + echo 24c64 0x57 > /sys/bus/i2c/devices/i2c-0/new_device modprobe centec_e582_48x2q4z_platform i2cset -y 15 0x21 0x18 0x0 i2cset -y 15 0x21 0x19 0x0 @@ -69,9 +70,9 @@ elif [ "$1" == "deinit" ]; then kill -9 $(pidof platform_monitor) > /dev/null 2>&1 rm -rf /usr/bin/platform_monitor modprobe -r centec_e582_48x2q4z_platform - modprobe -r centec_at24c64 + modprobe -r at24 modprobe -r dal - modprobe -r i2c-mux-pca954x + modprobe -r ctc-i2c-mux-pca954x modprobe -r i2c-dev else echo "e582-48x2q4z_platform : Invalid option !" diff --git a/platform/centec/sonic-platform-modules-e582/48x6q/modules/Makefile b/platform/centec/sonic-platform-modules-e582/48x6q/modules/Makefile index 2462555c8714..d87c7bd4aa63 100644 --- a/platform/centec/sonic-platform-modules-e582/48x6q/modules/Makefile +++ b/platform/centec/sonic-platform-modules-e582/48x6q/modules/Makefile @@ -1 +1,3 @@ -obj-m := centec_e582_48x6q_platform.o centec_at24c64.o +KBUILD_EXTRA_SYMBOLS = /sonic/platform/centec/sonic-platform-modules-e582/pca954x/Module.symvers + +obj-m := centec_e582_48x6q_platform.o diff --git a/platform/centec/sonic-platform-modules-e582/48x6q/modules/centec_at24c64.c b/platform/centec/sonic-platform-modules-e582/48x6q/modules/centec_at24c64.c deleted file mode 100644 index e1835df88625..000000000000 --- a/platform/centec/sonic-platform-modules-e582/48x6q/modules/centec_at24c64.c +++ /dev/null @@ -1,602 +0,0 @@ -/* - * at24.c - handle most I2C EEPROMs - * - * Copyright (C) 2005-2007 David Brownell - * Copyright (C) 2008 Wolfram Sang, Pengutronix - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * I2C EEPROMs from most vendors are inexpensive and mostly interchangeable. - * Differences between different vendor product lines (like Atmel AT24C or - * MicroChip 24LC, etc) won't much matter for typical read/write access. - * There are also I2C RAM chips, likewise interchangeable. One example - * would be the PCF8570, which acts like a 24c02 EEPROM (256 bytes). - * - * However, misconfiguration can lose data. "Set 16-bit memory address" - * to a part with 8-bit addressing will overwrite data. Writing with too - * big a page size also loses data. And it's not safe to assume that the - * conventional addresses 0x50..0x57 only hold eeproms; a PCF8563 RTC - * uses 0x51, for just one example. - * - * Accordingly, explicit board-specific configuration data should be used - * in almost all cases. (One partial exception is an SMBus used to access - * "SPD" data for DRAM sticks. Those only use 24c02 EEPROMs.) - * - * So this driver uses "new style" I2C driver binding, expecting to be - * told what devices exist. That may be in arch/X/mach-Y/board-Z.c or - * similar kernel-resident tables; or, configuration data coming from - * a bootloader. - * - * Other than binding model, current differences from "eeprom" driver are - * that this one handles write access and isn't restricted to 24c02 devices. - * It also handles larger devices (32 kbit and up) with two-byte addresses, - * which won't work on pure SMBus systems. - */ - -struct at24_data { - struct at24_platform_data chip; - int use_smbus; - - /* - * Lock protects against activities from other Linux tasks, - * but not from changes by other I2C masters. - */ - struct mutex lock; - struct bin_attribute bin; - - u8 *writebuf; - unsigned write_max; - unsigned num_addresses; - - /* - * Some chips tie up multiple I2C addresses; dummy devices reserve - * them for us, and we'll use them with SMBus calls. - */ - struct i2c_client *client[]; -}; - -/* - * This parameter is to help this driver avoid blocking other drivers out - * of I2C for potentially troublesome amounts of time. With a 100 kHz I2C - * clock, one 256 byte read takes about 1/43 second which is excessive; - * but the 1/170 second it takes at 400 kHz may be quite reasonable; and - * at 1 MHz (Fm+) a 1/430 second delay could easily be invisible. - * - * This value is forced to be a power of two so that writes align on pages. - */ -static unsigned io_limit = 128; -module_param(io_limit, uint, 0); -MODULE_PARM_DESC(io_limit, "Maximum bytes per I/O (default 128)"); - -/* - * Specs often allow 5 msec for a page write, sometimes 20 msec; - * it's important to recover from write timeouts. - */ -static unsigned write_timeout = 25; -module_param(write_timeout, uint, 0); -MODULE_PARM_DESC(write_timeout, "Time (in ms) to try writes (default 25)"); - -#define AT24_SIZE_BYTELEN 5 -#define AT24_SIZE_FLAGS 8 - -#define AT24_BITMASK(x) (BIT(x) - 1) - -/* create non-zero magic value for given eeprom parameters */ -#define AT24_DEVICE_MAGIC(_len, _flags) \ - ((1 << AT24_SIZE_FLAGS | (_flags)) \ - << AT24_SIZE_BYTELEN | ilog2(_len)) - -static const struct i2c_device_id at24_ctc_ids[] = { - { "24c64-ctc", AT24_DEVICE_MAGIC(65536 / 8, AT24_FLAG_ADDR16 | AT24_FLAG_READONLY | AT24_FLAG_IRUGO) }, - { /* END OF LIST */ } -}; -MODULE_DEVICE_TABLE(i2c, at24_ctc_ids); - -/*-------------------------------------------------------------------------*/ - -/* - * This routine supports chips which consume multiple I2C addresses. It - * computes the addressing information to be used for a given r/w request. - * Assumes that sanity checks for offset happened at sysfs-layer. - */ -static struct i2c_client *at24_translate_offset(struct at24_data *at24, - unsigned *offset) -{ - unsigned i = 0; - - if (at24->chip.flags & AT24_FLAG_ADDR16) { - i = *offset >> 16; - *offset &= 0xffff; - } else { - i = *offset >> 8; - *offset &= 0xff; - } - - return at24->client[i]; -} - -static ssize_t at24_eeprom_read(struct at24_data *at24, char *buf, - unsigned offset, size_t count) -{ - struct i2c_msg msg[2]; - struct i2c_client *client; - unsigned long timeout, read_time; - int status; - - memset(msg, 0, sizeof(msg)); - - /* - * REVISIT some multi-address chips don't rollover page reads to - * the next slave address, so we may need to truncate the count. - * Those chips might need another quirk flag. - * - * If the real hardware used four adjacent 24c02 chips and that - * were misconfigured as one 24c08, that would be a similar effect: - * one "eeprom" file not four, but larger reads would fail when - * they crossed certain pages. - */ - - /* - * Slave address and byte offset derive from the offset. Always - * set the byte address; on a multi-master board, another master - * may have changed the chip's "current" address pointer. - */ - client = at24_translate_offset(at24, &offset); - - if (count > io_limit) - count = io_limit; - - count = 1; - - /* - * Reads fail if the previous write didn't complete yet. We may - * loop a few times until this one succeeds, waiting at least - * long enough for one entire page write to work. - */ - timeout = jiffies + msecs_to_jiffies(write_timeout); - do { - read_time = jiffies; - - status = i2c_smbus_write_byte_data(client, (offset >> 8) & 0x0ff, offset & 0x0ff ); - status = i2c_smbus_read_byte(client); - if (status >= 0) { - buf[0] = status; - status = count; - } - - dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n", count, offset, status, jiffies); - - if (status == count) - return count; - - /* REVISIT: at HZ=100, this is sloooow */ - msleep(1); - } while (time_before(read_time, timeout)); - - return -ETIMEDOUT; -} - -static ssize_t at24_read(struct at24_data *at24, - char *buf, loff_t off, size_t count) -{ - ssize_t retval = 0; - - if (unlikely(!count)) - return count; - - memset(buf, 0, count); - - /* - * Read data from chip, protecting against concurrent updates - * from this host, but not from other I2C masters. - */ - mutex_lock(&at24->lock); - - while (count) { - ssize_t status; - - status = at24_eeprom_read(at24, buf, off, count); - if (status <= 0) { - if (retval == 0) - retval = status; - break; - } - buf += status; - off += status; - count -= status; - retval += status; - } - - mutex_unlock(&at24->lock); - - return retval; -} - -static ssize_t at24_bin_read(struct file *filp, struct kobject *kobj, - struct bin_attribute *attr, - char *buf, loff_t off, size_t count) -{ - struct at24_data *at24; - - at24 = dev_get_drvdata(container_of(kobj, struct device, kobj)); - return at24_read(at24, buf, off, count); -} - - -/* - * Note that if the hardware write-protect pin is pulled high, the whole - * chip is normally write protected. But there are plenty of product - * variants here, including OTP fuses and partial chip protect. - * - * We only use page mode writes; the alternative is sloooow. This routine - * writes at most one page. - */ -static ssize_t at24_eeprom_write(struct at24_data *at24, const char *buf, - unsigned offset, size_t count) -{ - struct i2c_client *client; - ssize_t status; - unsigned long timeout, write_time; - unsigned next_page; - - /* Get corresponding I2C address and adjust offset */ - client = at24_translate_offset(at24, &offset); - - /* write_max is at most a page */ - if (count > at24->write_max) - count = at24->write_max; - - /* Never roll over backwards, to the start of this page */ - next_page = roundup(offset + 1, at24->chip.page_size); - if (offset + count > next_page) - count = next_page - offset; - - /* - * Writes fail if the previous one didn't complete yet. We may - * loop a few times until this one succeeds, waiting at least - * long enough for one entire page write to work. - */ - timeout = jiffies + msecs_to_jiffies(write_timeout); - do { - write_time = jiffies; - - status = i2c_smbus_write_word_data(client, (offset >> 8) & 0x0ff, (offset & 0xFF) | buf[0]); - if (status == 0) - status = count; - - dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", count, offset, status, jiffies); - - if (status == count) - return count; - - /* REVISIT: at HZ=100, this is sloooow */ - msleep(1); - } while (time_before(write_time, timeout)); - - return -ETIMEDOUT; -} - -static ssize_t at24_write(struct at24_data *at24, const char *buf, loff_t off, - size_t count) -{ - ssize_t retval = 0; - - if (unlikely(!count)) - return count; - - /* - * Write data to chip, protecting against concurrent updates - * from this host, but not from other I2C masters. - */ - mutex_lock(&at24->lock); - - while (count) { - ssize_t status; - - status = at24_eeprom_write(at24, buf, off, 1); /* only one-byte to write; TODO page wirte */ - if (status <= 0) { - if (retval == 0) - retval = status; - break; - } - buf += status; - off += status; - count -= status; - retval += status; - } - - mutex_unlock(&at24->lock); - - return retval; -} - -static ssize_t at24_bin_write(struct file *filp, struct kobject *kobj, - struct bin_attribute *attr, - char *buf, loff_t off, size_t count) -{ - struct at24_data *at24; - - if (unlikely(off >= attr->size)) - return -EFBIG; - - at24 = dev_get_drvdata(container_of(kobj, struct device, kobj)); - return at24_write(at24, buf, off, count); -} - -/*-------------------------------------------------------------------------*/ - -#ifdef CONFIG_OF -static void at24_get_ofdata(struct i2c_client *client, - struct at24_platform_data *chip) -{ - const __be32 *val; - struct device_node *node = client->dev.of_node; - - if (node) { - if (of_get_property(node, "read-only", NULL)) - chip->flags |= AT24_FLAG_READONLY; - val = of_get_property(node, "pagesize", NULL); - if (val) - chip->page_size = be32_to_cpup(val); - } -} -#else -static void at24_get_ofdata(struct i2c_client *client, - struct at24_platform_data *chip) -{ } -#endif /* CONFIG_OF */ - -static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) -{ - struct at24_platform_data chip; - bool writable; - int use_smbus = 0; - struct at24_data *at24; - int err; - unsigned i, num_addresses; - kernel_ulong_t magic; - - if (client->dev.platform_data) { - chip = *(struct at24_platform_data *)client->dev.platform_data; - } else { - if (!id->driver_data) - return -ENODEV; - - magic = id->driver_data; - chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN)); - magic >>= AT24_SIZE_BYTELEN; - chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS); - - /* - * This is slow, but we can't know all eeproms, so we better - * play safe. Specifying custom eeprom-types via platform_data - * is recommended anyhow. - */ - chip.page_size = 1; - - /* update chipdata if OF is present */ - at24_get_ofdata(client, &chip); - - chip.setup = NULL; - chip.context = NULL; - } - - if (!is_power_of_2(chip.byte_len)) - dev_warn(&client->dev, - "byte_len looks suspicious (no power of 2)!\n"); - if (!chip.page_size) { - dev_err(&client->dev, "page_size must not be 0!\n"); - return -EINVAL; - } - if (!is_power_of_2(chip.page_size)) - dev_warn(&client->dev, - "page_size looks suspicious (no power of 2)!\n"); - - /* Use I2C operations unless we're stuck with SMBus extensions. */ - if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { - if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { - use_smbus = I2C_SMBUS_I2C_BLOCK_DATA; - } else if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_WORD_DATA)) { - use_smbus = I2C_SMBUS_WORD_DATA; - } else if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BYTE_DATA)) { - use_smbus = I2C_SMBUS_BYTE_DATA; - } else { - return -EPFNOSUPPORT; - } - use_smbus = I2C_SMBUS_BYTE_DATA; - } - - if (chip.flags & AT24_FLAG_TAKE8ADDR) - num_addresses = 8; - else - num_addresses = DIV_ROUND_UP(chip.byte_len, (chip.flags & AT24_FLAG_ADDR16) ? 65536 : 256); - - at24 = devm_kzalloc(&client->dev, sizeof(struct at24_data) + num_addresses * sizeof(struct i2c_client *), GFP_KERNEL); - if (!at24) - return -ENOMEM; - - mutex_init(&at24->lock); - at24->use_smbus = use_smbus; - at24->chip = chip; - at24->num_addresses = num_addresses; - - printk(KERN_ALERT "at24_probe chip.byte_len = 0x%x\n", chip.byte_len); - printk(KERN_ALERT "at24_probe chip.flags = 0x%x\n", chip.flags); - printk(KERN_ALERT "at24_probe chip.magic = 0x%lx\n", id->driver_data); - printk(KERN_ALERT "at24_probe use_smbus = %d\n", at24->use_smbus); - printk(KERN_ALERT "at24_probe num_addresses = %d\n", at24->num_addresses); - - /* - * Export the EEPROM bytes through sysfs, since that's convenient. - * By default, only root should see the data (maybe passwords etc) - */ - sysfs_bin_attr_init(&at24->bin); - at24->bin.attr.name = "eeprom"; - at24->bin.attr.mode = chip.flags & AT24_FLAG_IRUGO ? S_IRUGO : S_IRUSR; - at24->bin.read = at24_bin_read; - at24->bin.size = chip.byte_len; - - writable = !(chip.flags & AT24_FLAG_READONLY); - if (writable) { - if (!use_smbus || i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) { - unsigned write_max = chip.page_size; - - at24->bin.write = at24_bin_write; - at24->bin.attr.mode |= S_IWUSR; - - if (write_max > io_limit) - write_max = io_limit; - if (use_smbus && write_max > I2C_SMBUS_BLOCK_MAX) - write_max = I2C_SMBUS_BLOCK_MAX; - at24->write_max = write_max; - - /* buffer (data + address at the beginning) */ - at24->writebuf = devm_kzalloc(&client->dev, write_max + 2, GFP_KERNEL); - if (!at24->writebuf) - return -ENOMEM; - } else { - dev_warn(&client->dev, "cannot write due to controller restrictions."); - } - } - - at24->client[0] = client; - - /* use dummy devices for multiple-address chips */ - for (i = 1; i < num_addresses; i++) { - at24->client[i] = i2c_new_dummy(client->adapter, client->addr + i); - if (!at24->client[i]) { - dev_err(&client->dev, "address 0x%02x unavailable\n", client->addr + i); - err = -EADDRINUSE; - goto err_clients; - } - } - - err = sysfs_create_bin_file(&client->dev.kobj, &at24->bin); - if (err) - goto err_clients; - - i2c_set_clientdata(client, at24); - - printk(KERN_ALERT "at24_probe %s done\n", client->name); - - return 0; - -err_clients: - for (i = 1; i < num_addresses; i++) - if (at24->client[i]) - i2c_unregister_device(at24->client[i]); - - return err; -} - -static int at24_remove(struct i2c_client *client) -{ - struct at24_data *at24; - int i; - - at24 = i2c_get_clientdata(client); - sysfs_remove_bin_file(&client->dev.kobj, &at24->bin); - - for (i = 1; i < at24->num_addresses; i++) - i2c_unregister_device(at24->client[i]); - - return 0; -} - -/*-------------------------------------------------------------------------*/ - -static struct i2c_board_info i2c_devs = { - I2C_BOARD_INFO("24c64-ctc", 0x57), -}; - -static struct i2c_adapter *adapter = NULL; -static struct i2c_client *client = NULL; - -static int ctc_at24c64_init(void) -{ - printk(KERN_ALERT "ctc_at24c64_init\n"); - - adapter = i2c_get_adapter(0); - if(adapter == NULL){ - printk(KERN_ALERT "i2c_get_adapter == NULL\n"); - return -1; - } - - client = i2c_new_device(adapter, &i2c_devs); - if(client == NULL){ - printk(KERN_ALERT "i2c_new_device == NULL\n"); - i2c_put_adapter(adapter); - adapter = NULL; - return -1; - } - - return 0; -} - -static void ctc_at24c64_exit(void) -{ - printk(KERN_ALERT "ctc_at24c64_exit\n"); - if(client){ - i2c_unregister_device(client); - } - if(adapter){ - i2c_put_adapter(adapter); - } -} - -static struct i2c_driver at24_ctc_driver = { - .driver = { - .name = "at24-ctc", - .owner = THIS_MODULE, - }, - .probe = at24_probe, - .remove = at24_remove, - .id_table = at24_ctc_ids, -}; - -static int __init at24_ctc_init(void) -{ - if (!io_limit) { - pr_err("at24_ctc: io_limit must not be 0!\n"); - return -EINVAL; - } - - io_limit = rounddown_pow_of_two(io_limit); - - ctc_at24c64_init(); - - return i2c_add_driver(&at24_ctc_driver); -} -module_init(at24_ctc_init); - -static void __exit at24_ctc_exit(void) -{ - ctc_at24c64_exit(); - i2c_del_driver(&at24_ctc_driver); -} -module_exit(at24_ctc_exit); - -MODULE_DESCRIPTION("Driver for most I2C EEPROMs"); -MODULE_AUTHOR("David Brownell and Wolfram Sang"); -MODULE_LICENSE("GPL"); -/* XXX */ - diff --git a/platform/centec/sonic-platform-modules-e582/48x6q/modules/centec_e582_48x6q_platform.c b/platform/centec/sonic-platform-modules-e582/48x6q/modules/centec_e582_48x6q_platform.c index f72efee2a0d6..a0d0e0ca99dd 100644 --- a/platform/centec/sonic-platform-modules-e582/48x6q/modules/centec_e582_48x6q_platform.c +++ b/platform/centec/sonic-platform-modules-e582/48x6q/modules/centec_e582_48x6q_platform.c @@ -1,7 +1,7 @@ #include #include #include -#include +#include "../../pca954x/ctc-pca954x.h" #include #include #include @@ -95,7 +95,7 @@ static struct pca954x_platform_data i2c_dev_pca9548_platform_data = { .num_modes = PCA9548_CHANNEL_NUM, }; static struct i2c_board_info i2c_dev_pca9548 = { - I2C_BOARD_INFO("pca9548", 0x70), + I2C_BOARD_INFO("ctc_pca9548", 0x70), .platform_data = &i2c_dev_pca9548_platform_data, }; static struct i2c_client *i2c_client_pca9548x = NULL; @@ -110,7 +110,7 @@ static int e582_48x6q_init_i2c_pca9548(void) } /* install i2c-mux */ - i2c_client_pca9548x = i2c_new_device(i2c_adp_master, &i2c_dev_pca9548); + i2c_client_pca9548x = i2c_new_client_device(i2c_adp_master, &i2c_dev_pca9548); if(IS_INVALID_PTR(i2c_client_pca9548x)) { i2c_client_pca9548x = NULL; @@ -150,7 +150,7 @@ static int e582_48x6q_init_i2c_adt7470(void) return -1; } - i2c_client_adt7470 = i2c_new_device(i2c_adp_adt7470, &i2c_dev_adt7470); + i2c_client_adt7470 = i2c_new_client_device(i2c_adp_adt7470, &i2c_dev_adt7470); if(IS_INVALID_PTR(i2c_client_adt7470)){ i2c_client_adt7470 = NULL; printk(KERN_CRIT "install e582_48x6q board adt7470 failed\n"); @@ -206,14 +206,14 @@ static int e582_48x6q_init_i2c_psu(void) return -1; } - i2c_client_psu1 = i2c_new_device(i2c_adp_psu1, &i2c_dev_psu1); + i2c_client_psu1 = i2c_new_client_device(i2c_adp_psu1, &i2c_dev_psu1); if(IS_INVALID_PTR(i2c_client_psu1)){ i2c_client_psu1 = NULL; printk(KERN_CRIT "create e582_48x6q board i2c client psu1 failed\n"); return -1; } - i2c_client_psu2 = i2c_new_device(i2c_adp_psu2, &i2c_dev_psu2); + i2c_client_psu2 = i2c_new_client_device(i2c_adp_psu2, &i2c_dev_psu2); if(IS_INVALID_PTR(i2c_client_psu2)){ i2c_client_psu2 = NULL; printk(KERN_CRIT "create e582_48x6q board i2c client psu2 failed\n"); @@ -265,7 +265,7 @@ static int e582_48x6q_init_i2c_epld(void) return -1; } - i2c_client_epld = i2c_new_device(i2c_adp_master, &i2c_dev_epld); + i2c_client_epld = i2c_new_client_device(i2c_adp_master, &i2c_dev_epld); if(IS_INVALID_PTR(i2c_client_epld)) { i2c_client_epld = NULL; @@ -317,7 +317,7 @@ static int e582_48x6q_init_i2c_gpio(void) return -1; } - i2c_client_gpio0 = i2c_new_device(i2c_adp_master, &i2c_dev_gpio0); + i2c_client_gpio0 = i2c_new_client_device(i2c_adp_master, &i2c_dev_gpio0); if(IS_INVALID_PTR(i2c_client_gpio0)) { i2c_client_gpio0 = NULL; @@ -325,7 +325,7 @@ static int e582_48x6q_init_i2c_gpio(void) return -1; } - i2c_client_gpio1 = i2c_new_device(i2c_adp_master, &i2c_dev_gpio1); + i2c_client_gpio1 = i2c_new_client_device(i2c_adp_master, &i2c_dev_gpio1); if(IS_INVALID_PTR(i2c_client_gpio1)) { i2c_client_gpio1 = NULL; @@ -333,7 +333,7 @@ static int e582_48x6q_init_i2c_gpio(void) return -1; } - i2c_client_gpio2 = i2c_new_device(i2c_adp_master, &i2c_dev_gpio2); + i2c_client_gpio2 = i2c_new_client_device(i2c_adp_master, &i2c_dev_gpio2); if(IS_INVALID_PTR(i2c_client_gpio2)) { i2c_client_gpio2 = NULL; @@ -341,7 +341,7 @@ static int e582_48x6q_init_i2c_gpio(void) return -1; } - i2c_client_gpio3 = i2c_new_device(i2c_adp_master, &i2c_dev_gpio3); + i2c_client_gpio3 = i2c_new_client_device(i2c_adp_master, &i2c_dev_gpio3); if(IS_INVALID_PTR(i2c_client_gpio3)) { i2c_client_gpio3 = NULL; @@ -349,7 +349,7 @@ static int e582_48x6q_init_i2c_gpio(void) return -1; } - i2c_client_gpio4 = i2c_new_device(i2c_adp_master, &i2c_dev_gpio4); + i2c_client_gpio4 = i2c_new_client_device(i2c_adp_master, &i2c_dev_gpio4); if(IS_INVALID_PTR(i2c_client_gpio4)) { i2c_client_gpio4 = NULL; diff --git a/platform/centec/sonic-platform-modules-e582/48x6q/scripts/48x6q_platform.sh b/platform/centec/sonic-platform-modules-e582/48x6q/scripts/48x6q_platform.sh index e8f81a20d9d1..3a7e52a59425 100755 --- a/platform/centec/sonic-platform-modules-e582/48x6q/scripts/48x6q_platform.sh +++ b/platform/centec/sonic-platform-modules-e582/48x6q/scripts/48x6q_platform.sh @@ -25,7 +25,7 @@ if [ "$1" == "init" ]; then modprobe i2c-dev modprobe i2c-mux modprobe i2c-smbus - modprobe i2c-mux-pca954x force_deselect_on_exit=1 + modprobe ctc-i2c-mux-pca954x force_deselect_on_exit=1 i2cset -y 0 0x58 0x8 0x3f i2cset -y 0 0x20 0x1b 0x0 i2cset -y 0 0x20 0xb 0x0 @@ -42,7 +42,8 @@ if [ "$1" == "init" ]; then modprobe lm77 modprobe tun modprobe dal - modprobe centec_at24c64 + modprobe at24 + echo 24c64 0x57 > /sys/bus/i2c/devices/i2c-0/new_device modprobe centec_e582_48x6q_platform #start platform monitor @@ -53,9 +54,9 @@ elif [ "$1" == "deinit" ]; then kill -9 $(pidof platform_monitor) > /dev/null 2>&1 rm -rf /usr/bin/platform_monitor modprobe -r centec_e582_48x6q_platform - modprobe -r centec_at24c64 + modprobe -r at24 modprobe -r dal - modprobe -r i2c-mux-pca954x + modprobe -r ctc-i2c-mux-pca954x modprobe -r i2c-dev else echo "e582-48x6q_platform : Invalid option !" diff --git a/platform/centec/sonic-platform-modules-e582/debian/control b/platform/centec/sonic-platform-modules-e582/debian/control index 97f617d4836a..cfd5e45d891c 100644 --- a/platform/centec/sonic-platform-modules-e582/debian/control +++ b/platform/centec/sonic-platform-modules-e582/debian/control @@ -7,11 +7,11 @@ Standards-Version: 3.9.3 Package: platform-modules-e582-48x2q4z Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as fan, led, sfp Package: platform-modules-e582-48x6q Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/centec/sonic-platform-modules-e582/debian/rules b/platform/centec/sonic-platform-modules-e582/debian/rules index b726f62c8c68..4f7100f1172b 100755 --- a/platform/centec/sonic-platform-modules-e582/debian/rules +++ b/platform/centec/sonic-platform-modules-e582/debian/rules @@ -6,6 +6,7 @@ KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) MODULE_DIRS:= 48x6q 48x2q4z +PCA954X_DIR := pca954x %: dh $@ @@ -14,7 +15,12 @@ override_dh_auto_build: (for mod in $(MODULE_DIRS); do \ make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ done) - make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/../centec-dal + (for mod in $(PCA954X_DIR); do \ + make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/; \ + done) + rm $(MOD_SRC_DIR)/centec-dal -rf + cp $(MOD_SRC_DIR)/../centec-dal $(MOD_SRC_DIR)/centec-dal -rf + make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/centec-dal override_dh_auto_install: (for mod in $(MODULE_DIRS); do \ @@ -22,7 +28,8 @@ override_dh_auto_install: $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ cp -f $(MOD_SRC_DIR)/$${mod}/modules/*.ko \ debian/platform-modules-e582-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ - cp -f $(MOD_SRC_DIR)/../centec-dal/*.ko debian/platform-modules-e582-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + cp -f $(MOD_SRC_DIR)/centec-dal/*.ko debian/platform-modules-e582-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + cp -f $(MOD_SRC_DIR)/$(PCA954X_DIR)/*.ko debian/platform-modules-e582-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ done) override_dh_usrlocal: @@ -34,6 +41,7 @@ override_dh_clean: rm -rf $(MOD_SRC_DIR)/$${mod}/modules/*.ko; \ rm -rf debian/platform-modules-e582-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR)/*.ko; \ done) - make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/../centec-dal clean; \ - rm -rf $(MOD_SRC_DIR)/../centec-dal/*.ko + make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/centec-dal clean; \ + rm -rf $(MOD_SRC_DIR)/centec-dal/*.ko; \ + rm $(MOD_SRC_DIR)/centec-dal -rf diff --git a/platform/centec/sonic-platform-modules-e582/pca954x/Makefile b/platform/centec/sonic-platform-modules-e582/pca954x/Makefile new file mode 100644 index 000000000000..0cd3701f1b7f --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/pca954x/Makefile @@ -0,0 +1 @@ +obj-m := ctc-i2c-mux-pca954x.o diff --git a/platform/centec/sonic-platform-modules-e582/pca954x/ctc-i2c-mux-pca954x.c b/platform/centec/sonic-platform-modules-e582/pca954x/ctc-i2c-mux-pca954x.c new file mode 100644 index 000000000000..3c14bae6654b --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/pca954x/ctc-i2c-mux-pca954x.c @@ -0,0 +1,581 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * I2C multiplexer + * + * Copyright (c) 2008-2009 Rodolfo Giometti + * Copyright (c) 2008-2009 Eurotech S.p.A. + * + * This module supports the PCA954x and PCA984x series of I2C multiplexer/switch + * chips made by NXP Semiconductors. + * This includes the: + * PCA9540, PCA9542, PCA9543, PCA9544, PCA9545, PCA9546, PCA9547, + * PCA9548, PCA9846, PCA9847, PCA9848 and PCA9849. + * + * These chips are all controlled via the I2C bus itself, and all have a + * single 8-bit register. The upstream "parent" bus fans out to two, + * four, or eight downstream busses or channels; which of these + * are selected is determined by the chip type and register contents. A + * mux can select only one sub-bus at a time; a switch can select any + * combination simultaneously. + * + * Based on: + * pca954x.c from Kumar Gala + * Copyright (C) 2006 + * + * Based on: + * pca954x.c from Ken Harrenstien + * Copyright (C) 2004 Google, Inc. (Ken Harrenstien) + * + * Based on: + * i2c-virtual_cb.c from Brian Kuschak + * and + * pca9540.c from Jean Delvare . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ctc-pca954x.h" + +#define PCA954X_MAX_NCHANS 8 + +#define PCA954X_IRQ_OFFSET 4 + +enum pca_type { + pca_9540, + pca_9542, + pca_9543, + pca_9544, + pca_9545, + pca_9546, + pca_9547, + pca_9548, + pca_9846, + pca_9847, + pca_9848, + pca_9849, +}; + +struct chip_desc { + u8 nchans; + u8 enable; /* used for muxes only */ + u8 has_irq; + enum muxtype { + pca954x_ismux = 0, + pca954x_isswi + } muxtype; + struct i2c_device_identity id; +}; + +struct pca954x { + const struct chip_desc *chip; + + u8 last_chan; /* last register value */ + /* MUX_IDLE_AS_IS, MUX_IDLE_DISCONNECT or >= 0 for channel */ + s32 idle_state; + + struct i2c_client *client; + + struct irq_domain *irq; + unsigned int irq_mask; + raw_spinlock_t lock; +}; + +/* Provide specs for the PCA954x types we know about */ +static const struct chip_desc chips[] = { + [pca_9540] = { + .nchans = 2, + .enable = 0x4, + .muxtype = pca954x_ismux, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9542] = { + .nchans = 2, + .enable = 0x4, + .has_irq = 1, + .muxtype = pca954x_ismux, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9543] = { + .nchans = 2, + .has_irq = 1, + .muxtype = pca954x_isswi, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9544] = { + .nchans = 4, + .enable = 0x4, + .has_irq = 1, + .muxtype = pca954x_ismux, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9545] = { + .nchans = 4, + .has_irq = 1, + .muxtype = pca954x_isswi, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9546] = { + .nchans = 4, + .muxtype = pca954x_isswi, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9547] = { + .nchans = 8, + .enable = 0x8, + .muxtype = pca954x_ismux, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9548] = { + .nchans = 8, + .muxtype = pca954x_isswi, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [pca_9846] = { + .nchans = 4, + .muxtype = pca954x_isswi, + .id = { + .manufacturer_id = I2C_DEVICE_ID_NXP_SEMICONDUCTORS, + .part_id = 0x10b, + }, + }, + [pca_9847] = { + .nchans = 8, + .enable = 0x8, + .muxtype = pca954x_ismux, + .id = { + .manufacturer_id = I2C_DEVICE_ID_NXP_SEMICONDUCTORS, + .part_id = 0x108, + }, + }, + [pca_9848] = { + .nchans = 8, + .muxtype = pca954x_isswi, + .id = { + .manufacturer_id = I2C_DEVICE_ID_NXP_SEMICONDUCTORS, + .part_id = 0x10a, + }, + }, + [pca_9849] = { + .nchans = 4, + .enable = 0x4, + .muxtype = pca954x_ismux, + .id = { + .manufacturer_id = I2C_DEVICE_ID_NXP_SEMICONDUCTORS, + .part_id = 0x109, + }, + }, +}; + +static const struct i2c_device_id pca954x_id[] = { + { "ctc_pca9540", pca_9540 }, + { "ctc_pca9542", pca_9542 }, + { "ctc_pca9543", pca_9543 }, + { "ctc_pca9544", pca_9544 }, + { "ctc_pca9545", pca_9545 }, + { "ctc_pca9546", pca_9546 }, + { "ctc_pca9547", pca_9547 }, + { "ctc_pca9548", pca_9548 }, + { "ctc_pca9846", pca_9846 }, + { "ctc_pca9847", pca_9847 }, + { "ctc_pca9848", pca_9848 }, + { "ctc_pca9849", pca_9849 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, pca954x_id); + +static const struct of_device_id pca954x_of_match[] = { + { .compatible = "nxp,ctc_pca9540", .data = &chips[pca_9540] }, + { .compatible = "nxp,ctc_pca9542", .data = &chips[pca_9542] }, + { .compatible = "nxp,ctc_pca9543", .data = &chips[pca_9543] }, + { .compatible = "nxp,ctc_pca9544", .data = &chips[pca_9544] }, + { .compatible = "nxp,ctc_pca9545", .data = &chips[pca_9545] }, + { .compatible = "nxp,ctc_pca9546", .data = &chips[pca_9546] }, + { .compatible = "nxp,ctc_pca9547", .data = &chips[pca_9547] }, + { .compatible = "nxp,ctc_pca9548", .data = &chips[pca_9548] }, + { .compatible = "nxp,ctc_pca9846", .data = &chips[pca_9846] }, + { .compatible = "nxp,ctc_pca9847", .data = &chips[pca_9847] }, + { .compatible = "nxp,ctc_pca9848", .data = &chips[pca_9848] }, + { .compatible = "nxp,ctc_pca9849", .data = &chips[pca_9849] }, + {} +}; +MODULE_DEVICE_TABLE(of, pca954x_of_match); + +/* Write to mux register. Don't use i2c_transfer()/i2c_smbus_xfer() + for this as they will try to lock adapter a second time */ +static int pca954x_reg_write(struct i2c_adapter *adap, + struct i2c_client *client, u8 val) +{ + union i2c_smbus_data dummy; + + return __i2c_smbus_xfer(adap, client->addr, client->flags, + I2C_SMBUS_WRITE, val, + I2C_SMBUS_BYTE, &dummy); +} + +static u8 pca954x_regval(struct pca954x *data, u8 chan) +{ + /* We make switches look like muxes, not sure how to be smarter. */ + if (data->chip->muxtype == pca954x_ismux) + return chan | data->chip->enable; + else + return 1 << chan; +} + +static int pca954x_select_chan(struct i2c_mux_core *muxc, u32 chan) +{ + struct pca954x *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + u8 regval; + int ret = 0; + + regval = pca954x_regval(data, chan); + /* Only select the channel if its different from the last channel */ + if (data->last_chan != regval) { + ret = pca954x_reg_write(muxc->parent, client, regval); + data->last_chan = ret < 0 ? 0 : regval; + } + + return ret; +} + +static int pca954x_deselect_mux(struct i2c_mux_core *muxc, u32 chan) +{ + struct pca954x *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + s32 idle_state; + + idle_state = READ_ONCE(data->idle_state); + if (idle_state >= 0) + /* Set the mux back to a predetermined channel */ + return pca954x_select_chan(muxc, idle_state); + + if (idle_state == MUX_IDLE_DISCONNECT) { + /* Deselect active channel */ + data->last_chan = 0; + return pca954x_reg_write(muxc->parent, client, + data->last_chan); + } + + /* otherwise leave as-is */ + + return 0; +} + +static ssize_t idle_state_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct pca954x *data = i2c_mux_priv(muxc); + + return sprintf(buf, "%d\n", READ_ONCE(data->idle_state)); +} + +static ssize_t idle_state_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct pca954x *data = i2c_mux_priv(muxc); + int val; + int ret; + + ret = kstrtoint(buf, 0, &val); + if (ret < 0) + return ret; + + if (val != MUX_IDLE_AS_IS && val != MUX_IDLE_DISCONNECT && + (val < 0 || val >= data->chip->nchans)) + return -EINVAL; + + i2c_lock_bus(muxc->parent, I2C_LOCK_SEGMENT); + + WRITE_ONCE(data->idle_state, val); + /* + * Set the mux into a state consistent with the new + * idle_state. + */ + if (data->last_chan || val != MUX_IDLE_DISCONNECT) + ret = pca954x_deselect_mux(muxc, 0); + + i2c_unlock_bus(muxc->parent, I2C_LOCK_SEGMENT); + + return ret < 0 ? ret : count; +} + +static DEVICE_ATTR_RW(idle_state); + +static irqreturn_t pca954x_irq_handler(int irq, void *dev_id) +{ + struct pca954x *data = dev_id; + unsigned long pending; + int ret, i; + + ret = i2c_smbus_read_byte(data->client); + if (ret < 0) + return IRQ_NONE; + + pending = (ret >> PCA954X_IRQ_OFFSET) & (BIT(data->chip->nchans) - 1); + for_each_set_bit(i, &pending, data->chip->nchans) + handle_nested_irq(irq_linear_revmap(data->irq, i)); + + return IRQ_RETVAL(pending); +} + +static int pca954x_irq_set_type(struct irq_data *idata, unsigned int type) +{ + if ((type & IRQ_TYPE_SENSE_MASK) != IRQ_TYPE_LEVEL_LOW) + return -EINVAL; + return 0; +} + +static struct irq_chip pca954x_irq_chip = { + .name = "i2c-mux-pca954x", + .irq_set_type = pca954x_irq_set_type, +}; + +static int pca954x_irq_setup(struct i2c_mux_core *muxc) +{ + struct pca954x *data = i2c_mux_priv(muxc); + struct i2c_client *client = data->client; + int c, irq; + + if (!data->chip->has_irq || client->irq <= 0) + return 0; + + raw_spin_lock_init(&data->lock); + + data->irq = irq_domain_add_linear(client->dev.of_node, + data->chip->nchans, + &irq_domain_simple_ops, data); + if (!data->irq) + return -ENODEV; + + for (c = 0; c < data->chip->nchans; c++) { + irq = irq_create_mapping(data->irq, c); + if (!irq) { + dev_err(&client->dev, "failed irq create map\n"); + return -EINVAL; + } + irq_set_chip_data(irq, data); + irq_set_chip_and_handler(irq, &pca954x_irq_chip, + handle_simple_irq); + } + + return 0; +} + +static void pca954x_cleanup(struct i2c_mux_core *muxc) +{ + struct pca954x *data = i2c_mux_priv(muxc); + int c, irq; + + if (data->irq) { + for (c = 0; c < data->chip->nchans; c++) { + irq = irq_find_mapping(data->irq, c); + irq_dispose_mapping(irq); + } + irq_domain_remove(data->irq); + } + i2c_mux_del_adapters(muxc); +} + +static int pca954x_init(struct i2c_client *client, struct pca954x *data) +{ + int ret; + + if (data->idle_state >= 0) + data->last_chan = pca954x_regval(data, data->idle_state); + else + data->last_chan = 0; /* Disconnect multiplexer */ + + ret = i2c_smbus_write_byte(client, data->last_chan); + if (ret < 0) + data->last_chan = 0; + + return ret; +} + +/* + * I2C init/probing/exit functions + */ +static int pca954x_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct i2c_adapter *adap = client->adapter; + struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev); + struct device *dev = &client->dev; + struct gpio_desc *gpio; + int num, force, class; + struct i2c_mux_core *muxc; + struct pca954x *data; + int ret; + + if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE)) + return -ENODEV; + + muxc = i2c_mux_alloc(adap, dev, PCA954X_MAX_NCHANS, sizeof(*data), 0, + pca954x_select_chan, pca954x_deselect_mux); + if (!muxc) + return -ENOMEM; + data = i2c_mux_priv(muxc); + + i2c_set_clientdata(client, muxc); + data->client = client; + + /* Reset the mux if a reset GPIO is specified. */ + gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(gpio)) + return PTR_ERR(gpio); + if (gpio) { + udelay(1); + gpiod_set_value_cansleep(gpio, 0); + /* Give the chip some time to recover. */ + udelay(1); + } + + data->chip = device_get_match_data(dev); + if (!data->chip) + data->chip = &chips[id->driver_data]; + + if (data->chip->id.manufacturer_id != I2C_DEVICE_ID_NONE) { + struct i2c_device_identity id; + + ret = i2c_get_device_id(client, &id); + if (ret && ret != -EOPNOTSUPP) + return ret; + + if (!ret && + (id.manufacturer_id != data->chip->id.manufacturer_id || + id.part_id != data->chip->id.part_id)) { + dev_warn(dev, "unexpected device id %03x-%03x-%x\n", + id.manufacturer_id, id.part_id, + id.die_revision); + return -ENODEV; + } + } + + data->idle_state = MUX_IDLE_AS_IS; + if (device_property_read_u32(dev, "idle-state", &data->idle_state)) { + if (device_property_read_bool(dev, "i2c-mux-idle-disconnect")) + data->idle_state = MUX_IDLE_DISCONNECT; + } + + /* + * Write the mux register at addr to verify + * that the mux is in fact present. This also + * initializes the mux to a channel + * or disconnected state. + */ + ret = pca954x_init(client, data); + if (ret < 0) { + dev_warn(dev, "probe failed\n"); + return -ENODEV; + } + + ret = pca954x_irq_setup(muxc); + if (ret) + goto fail_cleanup; + + /* Now create an adapter for each channel */ + for (num = 0; num < data->chip->nchans; num++) { + force = 0; /* dynamic adap number */ + class = 0; /* no class by default */ + if (pdata) { + if (num < pdata->num_modes) { + /* force static number */ + force = pdata->modes[num].adap_id; + class = pdata->modes[num].class; + } else + /* discard unconfigured channels */ + break; + } + + ret = i2c_mux_add_adapter(muxc, force, num, class); + if (ret) + goto fail_cleanup; + } + + if (data->irq) { + ret = devm_request_threaded_irq(dev, data->client->irq, + NULL, pca954x_irq_handler, + IRQF_ONESHOT | IRQF_SHARED, + "pca954x", data); + if (ret) + goto fail_cleanup; + } + + /* + * The attr probably isn't going to be needed in most cases, + * so don't fail completely on error. + */ + device_create_file(dev, &dev_attr_idle_state); + + dev_info(dev, "registered %d multiplexed busses for I2C %s %s\n", + num, data->chip->muxtype == pca954x_ismux + ? "mux" : "switch", client->name); + + return 0; + +fail_cleanup: + pca954x_cleanup(muxc); + return ret; +} + +static int pca954x_remove(struct i2c_client *client) +{ + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + + device_remove_file(&client->dev, &dev_attr_idle_state); + + pca954x_cleanup(muxc); + return 0; +} + +#ifdef CONFIG_PM_SLEEP +static int pca954x_resume(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct pca954x *data = i2c_mux_priv(muxc); + int ret; + + ret = pca954x_init(client, data); + if (ret < 0) + dev_err(&client->dev, "failed to verify mux presence\n"); + + return ret; +} +#endif + +static SIMPLE_DEV_PM_OPS(pca954x_pm, NULL, pca954x_resume); + +static struct i2c_driver pca954x_driver = { + .driver = { + .name = "ctc_pca954x", + .pm = &pca954x_pm, + .of_match_table = pca954x_of_match, + }, + .probe = pca954x_probe, + .remove = pca954x_remove, + .id_table = pca954x_id, +}; + +module_i2c_driver(pca954x_driver); + +MODULE_AUTHOR("Rodolfo Giometti "); +MODULE_DESCRIPTION("PCA954x I2C mux/switch driver"); +MODULE_LICENSE("GPL v2"); diff --git a/platform/centec/sonic-platform-modules-e582/pca954x/ctc-pca954x.h b/platform/centec/sonic-platform-modules-e582/pca954x/ctc-pca954x.h new file mode 100644 index 000000000000..eab9cdd990c9 --- /dev/null +++ b/platform/centec/sonic-platform-modules-e582/pca954x/ctc-pca954x.h @@ -0,0 +1,48 @@ +/* + * + * pca954x.h - I2C multiplexer/switch support + * + * Copyright (c) 2008-2009 Rodolfo Giometti + * Copyright (c) 2008-2009 Eurotech S.p.A. + * Michael Lawnick + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#ifndef _LINUX_I2C_PCA954X_H +#define _LINUX_I2C_PCA954X_H + +/* Platform data for the PCA954x I2C multiplexers */ + +/* Per channel initialisation data: + * @adap_id: bus number for the adapter. 0 = don't care + * @deselect_on_exit: set this entry to 1, if your H/W needs deselection + * of this channel after transaction. + * + */ +struct pca954x_platform_mode { + int adap_id; + unsigned int deselect_on_exit:1; + unsigned int class; +}; + +/* Per mux/switch data, used with i2c_register_board_info */ +struct pca954x_platform_data { + struct pca954x_platform_mode *modes; + int num_modes; +}; + +#endif /* _LINUX_I2C_PCA954X_H */ diff --git a/platform/centec/sonic-platform-modules-embedway/debian/control b/platform/centec/sonic-platform-modules-embedway/debian/control index 6fb02a824826..1e51f7bc05c9 100644 --- a/platform/centec/sonic-platform-modules-embedway/debian/control +++ b/platform/centec/sonic-platform-modules-embedway/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.9.3 Package: platform-modules-embedway-es6220 Architecture: amd64 -Depends: linux-image-4.19.0-12-2-amd64-unsigned +Depends: linux-image-5.10.0-8-2-amd64-unsigned Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/centec/sonic-platform-modules-embedway/debian/rules b/platform/centec/sonic-platform-modules-embedway/debian/rules index 250c0861e196..9ac9db1093bd 100755 --- a/platform/centec/sonic-platform-modules-embedway/debian/rules +++ b/platform/centec/sonic-platform-modules-embedway/debian/rules @@ -10,16 +10,19 @@ MOD_SRC_DIR:= $(shell pwd) dh $@ override_dh_auto_build: - make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/../centec-dal + rm $(MOD_SRC_DIR)/centec-dal -rf + cp $(MOD_SRC_DIR)/../centec-dal $(MOD_SRC_DIR)/centec-dal -rf + make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/centec-dal override_dh_auto_install: dh_installdirs -pplatform-modules-embedway-es6220 \ $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ - cp -f $(MOD_SRC_DIR)/../centec-dal/*.ko debian/platform-modules-embedway-es6220/$(KERNEL_SRC)/$(INSTALL_MOD_DIR) + cp -f $(MOD_SRC_DIR)/centec-dal/*.ko debian/platform-modules-embedway-es6220/$(KERNEL_SRC)/$(INSTALL_MOD_DIR) override_dh_usrlocal: override_dh_clean: dh_clean - make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/../centec-dal clean; \ - rm -rf $(MOD_SRC_DIR)/../centec-dal/*.ko + make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/centec-dal clean; \ + rm -rf $(MOD_SRC_DIR)/centec-dal/*.ko; \ + rm $(MOD_SRC_DIR)/centec-dal/ -rf diff --git a/platform/centec/sonic-platform-modules-v682/48x8c/modules/Makefile b/platform/centec/sonic-platform-modules-v682/48x8c/modules/Makefile new file mode 100644 index 000000000000..eabfe2733c41 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48x8c/modules/Makefile @@ -0,0 +1 @@ +obj-m := centec_v682_48x8c_platform.o rtc-sd2405.o diff --git a/platform/centec/sonic-platform-modules-v682/48x8c/modules/centec_v682_48x8c_platform.c b/platform/centec/sonic-platform-modules-v682/48x8c/modules/centec_v682_48x8c_platform.c new file mode 100644 index 000000000000..049ca4a710c3 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48x8c/modules/centec_v682_48x8c_platform.c @@ -0,0 +1,167 @@ +#include +#include +#include +#include +#include +#include + +#define SEP(XXX) 1 +#define IS_INVALID_PTR(_PTR_) ((_PTR_ == NULL) || IS_ERR(_PTR_)) +#define IS_VALID_PTR(_PTR_) (!IS_INVALID_PTR(_PTR_)) + +#if SEP("defines") +#define SFP_NUM 48 +#define QSFP_NUM 8 +#define PORT_NUM (SFP_NUM + QSFP_NUM) +#endif + +#if SEP("drivers:leds") +extern void v682_48x8c_led_port_set(struct led_classdev *led_cdev, enum led_brightness set_value); +extern enum led_brightness v682_48x8c_led_port_get(struct led_classdev *led_cdev); + +static struct led_classdev led_dev_port[PORT_NUM] = { +{ .name = "port0", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port1", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port2", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port3", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port4", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port5", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port6", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port7", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port8", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port9", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port10", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port11", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port12", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port13", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port14", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port15", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port16", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port17", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port18", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port19", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port20", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port21", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port22", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port23", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port24", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port25", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port26", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port27", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port28", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port29", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port30", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port31", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port32", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port33", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port34", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port35", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port36", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port37", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port38", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port39", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port40", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port41", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port42", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port43", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port44", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port45", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port46", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port47", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port48", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port49", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port50", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port51", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port52", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port53", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port54", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +{ .name = "port55", .brightness_set = v682_48x8c_led_port_set, .brightness_get = v682_48x8c_led_port_get,}, +}; +static unsigned char port_led_mode[PORT_NUM] = {0}; + +void v682_48x8c_led_port_set(struct led_classdev *led_cdev, enum led_brightness set_value) +{ + int portNum = 0; + + sscanf(led_cdev->name, "port%d", &portNum); + + port_led_mode[portNum] = set_value; + + return; +} + +enum led_brightness v682_48x8c_led_port_get(struct led_classdev *led_cdev) +{ + int portNum = 0; + + sscanf(led_cdev->name, "port%d", &portNum); + + return port_led_mode[portNum]; +} + +static int v682_48x8c_init_led(void) +{ + int ret = 0; + int i = 0; + + for (i = 0; i < PORT_NUM; i++) + { + ret = led_classdev_register(NULL, &(led_dev_port[i])); + if (ret != 0) + { + printk(KERN_CRIT "create v682_48x8c led_dev_port%d device failed\n", i); + continue; + } + } + + return ret; +} + +static int v682_48x8c_exit_led(void) +{ + int i = 0; + + for (i = 0; i < PORT_NUM; i++) + { + led_classdev_unregister(&(led_dev_port[i])); + } + + return 0; +} +#endif + +static int v682_48x8c_init(void) +{ + int ret = 0; + int failed = 0; + + printk(KERN_ALERT "init v682_48x8c board dirver...\n"); + + ret = v682_48x8c_init_led(); + if (ret != 0) + { + failed = 1; + } + + if (failed) + printk(KERN_INFO "init v682_48x8c board driver failed\n"); + else + printk(KERN_ALERT "init v682_48x8c board dirver...ok\n"); + + return 0; +} + +static void v682_48x8c_exit(void) +{ + printk(KERN_INFO "deinit v682_48x8c board dirver...\n"); + + v682_48x8c_exit_led(); + + printk(KERN_INFO "deinit v682_48x8c board dirver...ok\n"); +} + +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_AUTHOR("shil centecNetworks, Inc"); +MODULE_DESCRIPTION("v682-48x8c board driver"); +module_init(v682_48x8c_init); +module_exit(v682_48x8c_exit); diff --git a/platform/centec/sonic-platform-modules-v682/48x8c/modules/rtc-sd2405.c b/platform/centec/sonic-platform-modules-v682/48x8c/modules/rtc-sd2405.c new file mode 100644 index 000000000000..c22ab3349144 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48x8c/modules/rtc-sd2405.c @@ -0,0 +1,264 @@ +/* + * rtc class driver for the SD2405 chip + * + * Author: Dale Farnsworth + * + * based on previously existing rtc class drivers + * + * 2007 (c) MontaVista, Software, Inc. This file is licensed under + * the terms of the GNU General Public License version 2. This program + * is licensed "as is" without any warranty of any kind, whether express + * or implied. + */ + +#include +#include +#include +#include +#include + +#define DRV_VERSION "0.1" + +/* + * register indices + */ +#define SD2405_REG_SC 0x0 /* seconds 00-59 */ +#define SD2405_REG_MN 0x1 /* minutes 00-59 */ +#define SD2405_REG_HR 0x2 /* hours 00-23 */ +#define SD2405_REG_DW 0x3 /* day of week 1-7 */ +#define SD2405_REG_DT 0x4 /* day of month 00-31 */ +#define SD2405_REG_MO 0x5 /* month 01-12 */ +#define SD2405_REG_YR 0x6 /* year 00-99 */ + +#define SD2405_REG_CTRL1 0xf /* control 1 */ +#define SD2405_REG_CTRL2 0x10 /* control 2 */ +#define SD2405_REG_CTRL3 0x11 /* control 3 ARST*/ + +#define SD2405_REG_LEN 7 + +/* + * register write protect + */ +#define SD2405_REG_CONTROL1_WRITE 0x80 +#define SD2405_REG_CONTROL2_WRITE 0x84 + + +#define SD2405_IDLE_TIME_AFTER_WRITE 3 /* specification says 2.5 mS */ + +static struct i2c_driver sd2405_driver; + +#if 1 +/* modified by shil, for bug 46153 */ +static int sd2405_i2c_read_regs(struct i2c_client *client, u8 *buf) +{ + int i; + + for (i = 0; i < SD2405_REG_LEN; i++) { + buf[i] = i2c_smbus_read_byte_data(client, SD2405_REG_SC+i); + } + return 0; +} + +/* modified by shil, for bug 46153 */ +static int sd2405_i2c_write_regs(struct i2c_client *client, u8 const *buf) +{ + int i; + + for (i = 0; i < SD2405_REG_LEN; i++) { + i2c_smbus_write_byte_data(client, SD2405_REG_SC+i, buf[i]); + msleep(SD2405_IDLE_TIME_AFTER_WRITE); + } + return 0; +} + +#else +static int sd2405_i2c_read_regs(struct i2c_client *client, u8 *buf) +{ + struct i2c_msg msgs[1] = { + { + .addr = client->addr, + .flags = I2C_M_RD, /* read */ + .len = SD2405_REG_LEN, + .buf = buf} + }; + int rc; + + rc = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); + if (rc != ARRAY_SIZE(msgs)) { + dev_err(&client->dev, "%s: register read failed\n", __func__); + return -EIO; + } + return 0; +} + +static int sd2405_i2c_write_regs(struct i2c_client *client, u8 const *buf) +{ + int rc; + + u8 temp_reg[SD2405_REG_LEN+1] = {0}; + memcpy(&temp_reg[1], buf, SD2405_REG_LEN); + + struct i2c_msg msgs[1] = { + { + .addr = client->addr, + .flags = 0, /* write */ + .len = SD2405_REG_LEN+1, + .buf = temp_reg} + }; + + rc = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); + if (rc != ARRAY_SIZE(msgs)) + goto write_failed; + msleep(SD2405_IDLE_TIME_AFTER_WRITE); + + return 0; + + write_failed: + dev_err(&client->dev, "%s: register write failed\n", __func__); + return -EIO; +} +#endif + +static int sd2405_i2c_read_time(struct i2c_client *client, struct rtc_time *tm) +{ + int rc; + u8 regs[SD2405_REG_LEN]; + + rc = sd2405_i2c_read_regs(client, regs); + if (rc < 0) + return rc; + + tm->tm_sec = bcd2bin(regs[SD2405_REG_SC]); + tm->tm_min = bcd2bin(regs[SD2405_REG_MN]); + tm->tm_hour = bcd2bin(regs[SD2405_REG_HR] & 0x3f); + tm->tm_wday = bcd2bin(regs[SD2405_REG_DW]); + tm->tm_mday = bcd2bin(regs[SD2405_REG_DT]); + tm->tm_mon = bcd2bin(regs[SD2405_REG_MO]) - 1; + tm->tm_year = bcd2bin(regs[SD2405_REG_YR]) + 100; + + return 0; +} + +static int sd2405_i2c_set_write_protect(struct i2c_client *client) +{ + int rc; + rc = i2c_smbus_write_byte_data(client, SD2405_REG_CTRL1, 0); + rc += i2c_smbus_write_byte_data(client, SD2405_REG_CTRL2, 0); + if (rc < 0) { + dev_err(&client->dev, "%s: control register write failed\n", + __func__); + return -EIO; + } + return 0; +} + +static int sd2405_i2c_clear_write_protect(struct i2c_client *client) +{ + int rc; + rc = i2c_smbus_write_byte_data(client, SD2405_REG_CTRL2, SD2405_REG_CONTROL1_WRITE); + rc += i2c_smbus_write_byte_data(client, SD2405_REG_CTRL1, SD2405_REG_CONTROL2_WRITE); + if (rc < 0) { + dev_err(&client->dev, "%s: control register write failed\n", + __func__); + return -EIO; + } + return 0; +} + +static int +sd2405_i2c_set_time(struct i2c_client *client, struct rtc_time const *tm) +{ + u8 regs[SD2405_REG_LEN]; + int rc; + + rc = sd2405_i2c_clear_write_protect(client); + if (rc < 0) + return rc; + + regs[SD2405_REG_SC] = bin2bcd(tm->tm_sec); + regs[SD2405_REG_MN] = bin2bcd(tm->tm_min); + regs[SD2405_REG_HR] = bin2bcd(tm->tm_hour)|0x80; + regs[SD2405_REG_DW] = bin2bcd(tm->tm_wday); + regs[SD2405_REG_DT] = bin2bcd(tm->tm_mday); + regs[SD2405_REG_MO] = bin2bcd(tm->tm_mon + 1); + regs[SD2405_REG_YR] = bin2bcd(tm->tm_year - 100); + + rc = sd2405_i2c_write_regs(client, regs); + if (rc < 0) + return rc; + + rc = sd2405_i2c_set_write_protect(client); + if (rc < 0) + return rc; + + return 0; +} + +static int sd2405_rtc_read_time(struct device *dev, struct rtc_time *tm) +{ + return sd2405_i2c_read_time(to_i2c_client(dev), tm); +} + +static int sd2405_rtc_set_time(struct device *dev, struct rtc_time *tm) +{ + return sd2405_i2c_set_time(to_i2c_client(dev), tm); +} + +static const struct rtc_class_ops sd2405_rtc_ops = { + .read_time = sd2405_rtc_read_time, + .set_time = sd2405_rtc_set_time, +}; + +static int +sd2405_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct rtc_device *rtc; + +/* modified by shil, for bug 46153 */ +#if 0 + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) + return -ENODEV; +#endif + + dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n"); + + rtc = devm_rtc_allocate_device(&client->dev); + if (IS_ERR(rtc)) + return PTR_ERR(rtc); + + i2c_set_clientdata(client, rtc); + rtc->ops = &sd2405_rtc_ops; + + return rtc_register_device(rtc); +} + +static struct i2c_device_id sd2405_id[] = { + { "sd2405", 0 }, + { } +}; + +static struct i2c_driver sd2405_driver = { + .driver = { + .name = "rtc-sd2405", + }, + .probe = sd2405_probe, + .id_table = sd2405_id, +}; + +static int __init sd2405_init(void) +{ + return i2c_add_driver(&sd2405_driver); +} + +static void __exit sd2405_exit(void) +{ + i2c_del_driver(&sd2405_driver); +} + +MODULE_DESCRIPTION("Maxim SD2405 RTC driver"); +MODULE_AUTHOR("Dale Farnsworth "); +MODULE_LICENSE("GPL"); +MODULE_VERSION(DRV_VERSION); + +module_init(sd2405_init); +module_exit(sd2405_exit); diff --git a/platform/centec/sonic-platform-modules-v682/48x8c/service/48x8c_platform.service b/platform/centec/sonic-platform-modules-v682/48x8c/service/48x8c_platform.service new file mode 100644 index 000000000000..af5f5b779e66 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48x8c/service/48x8c_platform.service @@ -0,0 +1,13 @@ +[Unit] +Description=Centec modules init +After=local-fs.target +Before=syncd.service + +[Service] +Type=oneshot +ExecStart=-/etc/init.d/platform-modules-v682-48x8c start +ExecStop=-/etc/init.d/platform-modules-v682-48x8c stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/centec/sonic-platform-modules-v682/48x8c/service/release.py b/platform/centec/sonic-platform-modules-v682/48x8c/service/release.py new file mode 100644 index 000000000000..8ae790a24fdc --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48x8c/service/release.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python + +import os +import time + +def release_board(): + if open('/proc/cmdline', 'r').readlines()[0].find('SONIC_BOOT_TYPE=warm') != -1: + return + + os.system('i2cset -y 0 0x37 0x4 0x0') + time.sleep(1) + os.system('i2cset -y 0 0x37 0x4 0x1') + time.sleep(1) + os.system('echo 1 > /sys/bus/pci/devices/0000\:00\:1c.0/remove') + time.sleep(1) + os.system('echo 1 > /sys/bus/pci/rescan') + time.sleep(1) + # EPLD_QSFP_RST + os.system('i2cset -y 0 0x36 0x5 0xff') + os.system('i2cset -y 0 0x37 0x5 0xff') + # EPLD_QSFP_INT_MASK + os.system('i2cset -y 0 0x36 0xd 0xff') + os.system('i2cset -y 0 0x37 0xd 0xff') + # EPLD_PPU_INT_MASK + os.system('i2cset -y 0 0x36 0xb 0x00') + # EPLD_SFP_DISABLE1 + os.system('i2cset -y 0 0x36 0xe 0x00') + os.system('i2cset -y 0 0x37 0xe 0x00') + # EPLD_SFP_DISABLE2 + os.system('i2cset -y 0 0x36 0xf 0x00') + os.system('i2cset -y 0 0x37 0xf 0x00') + # EPLD_SFP_DISABLE3 + os.system('i2cset -y 0 0x36 0x10 0x00') + os.system('i2cset -y 0 0x37 0x10 0x00') + +if __name__ == '__main__': + release_board() diff --git a/platform/centec/sonic-platform-modules-v682/48x8c/setup.py b/platform/centec/sonic-platform-modules-v682/48x8c/setup.py new file mode 100644 index 000000000000..57724ad4b4f8 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48x8c/setup.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +import os +from setuptools import setup +os.listdir + +setup( + name='sonic_platform', + version='1.0', + description='Module to initialize centec v682-48x8c platforms', + + packages=['sonic_platform'], + package_dir={'sonic_platform': 'sonic_platform'}, +) + diff --git a/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/__init__.py b/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/__init__.py new file mode 100644 index 000000000000..6e50c02e9d1f --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/__init__.py @@ -0,0 +1,2 @@ +__all__ = ["platform", "chassis", "sfp", "eeprom", "psu", "thermal", "fan", "fan_drawer", "led"] +from . import platform diff --git a/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/chassis.py b/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/chassis.py new file mode 100644 index 000000000000..7a137fc534f8 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/chassis.py @@ -0,0 +1,282 @@ +#!/usr/bin/env python +# +# Name: chassis.py, version: 1.0 +# +# Description: Module contains the definitions of SONiC platform APIs +# + +try: + import os + import re + import time + import collections + from sonic_py_common import device_info + from sonic_platform_base.chassis_base import ChassisBase + from sonic_platform.sfp import Sfp + from sonic_platform.fan_drawer import FanDrawer + from sonic_platform.psu import Psu + from sonic_platform.thermal import Thermal + from sonic_platform.eeprom import Eeprom +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +NUM_FAN_TRAY = 2 +NUM_THERMAL = 1 +NUM_PSU = 2 + +USR_SHARE_SONIC_PATH = "/usr/share/sonic" +HOST_DEVICE_PATH = USR_SHARE_SONIC_PATH + "/device" +CONTAINER_PLATFORM_PATH = USR_SHARE_SONIC_PATH + "/platform" + +REBOOT_CAUSE_DIR = "/host/reboot-cause/" +REBOOT_CAUSE_FILE = os.path.join(REBOOT_CAUSE_DIR, "reboot-cause.txt") + +class Chassis(ChassisBase): + # System status LED + _led = None + + def __init__(self): + ChassisBase.__init__(self) + + self.data = {'valid':0, 'last':0} + self.sfp_presence = {} + + if os.path.isdir(CONTAINER_PLATFORM_PATH): + platform_path = CONTAINER_PLATFORM_PATH + else: + platform = device_info.get_platform() + if platform is None: + raise + platform_path = os.path.join(HOST_DEVICE_PATH, platform) + + port_config_file = "/".join([platform_path, "V682-48x8c", "port_config.ini"]) + try: + f = open(port_config_file) + except: + raise + for line in f: + line.strip() + if re.search('^#', line) is not None: + Port_cfg = collections.namedtuple('Port_cfg', line.split()[1:]) + break + f.close() + f = open(port_config_file) + _port_cfgs = [Port_cfg(*tuple((line.strip().split()))) + for line in f if re.search('^#', line) is None] + f.close() + + # Initialize EEPROM + self._eeprom = Eeprom() + + # Initialize FAN + for i in range(NUM_FAN_TRAY): + fandrawer = FanDrawer(i + 1) + self._fan_drawer_list.append(fandrawer) + self._fan_list.extend(fandrawer._fan_list) + + # Initialize PSU + for index in range(0, NUM_PSU): + psu = Psu(index + 1) + self._psu_list.append(psu) + + # Initialize THERMAL + for index in range(0, NUM_THERMAL): + thermal = Thermal(index) + self._thermal_list.append(thermal) + + # Initialize SFP + for port_cfg in _port_cfgs: + sfp = Sfp(int(port_cfg.index), 'SFP' if int(port_cfg.index) < 48 else 'QSFP') + self._sfp_list.append(sfp) + self.sfp_presence[int(port_cfg.index)] = False + +############################################## +# Device methods +############################################## + + def get_name(self): + """ + Retrieves the name of the chassis + Returns: + string: The name of the chassis + """ + return self._eeprom.modelstr() + + def get_presence(self): + """ + Retrieves the presence of the chassis + Returns: + bool: True if chassis is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the chassis + Returns: + string: Model/part number of chassis + """ + return self._eeprom.part_number_str() + + def get_serial(self): + """ + Retrieves the serial number of the chassis + Returns: + string: Serial number of chassis + """ + return self._eeprom.serial_number_str() + + def get_status(self): + """ + Retrieves the operational status of the chassis + Returns: + bool: A boolean value, True if chassis is operating properly + False if not + """ + return True + +############################################## +# Chassis methods +############################################## + + def get_base_mac(self): + """ + Retrieves the base MAC address for the chassis + + Returns: + A string containing the MAC address in the format + 'XX:XX:XX:XX:XX:XX' + """ + return self._eeprom.base_mac_addr() + + def get_serial_number(self): + """ + Retrieves the hardware serial number for the chassis + + Returns: + A string containing the hardware serial number for this chassis. + """ + return self._eeprom.serial_number_str() + + def get_system_eeprom_info(self): + """ + Retrieves the full content of system EEPROM information for the chassis + + Returns: + A dictionary where keys are the type code defined in + OCP ONIE TlvInfo EEPROM format and values are their corresponding + values. + Ex. { '0x21':'AG9064', '0x22':'V1.0', '0x23':'AG9064-0109867821', + '0x24':'001c0f000fcd0a', '0x25':'02/03/2018 16:22:00', + '0x26':'01', '0x27':'REV01', '0x28':'AG9064-C2358-16G'} + """ + return self._eeprom.system_eeprom_info() + + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + Returns: + A tuple (string, string) where the first element is a string + containing the cause of the previous reboot. This string must be + one of the predefined strings in this class. If the first string + is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used + to pass a description of the reboot cause. + """ + if os.path.exists(REBOOT_CAUSE_FILE): + with open(REBOOT_CAUSE_FILE) as reboot_cause_file: + reboot_cause = reboot_cause_file.readline() + if re.search(r'User issued', reboot_cause) is None: + return (self.REBOOT_CAUSE_POWER_LOSS, None) + else: + return (self.REBOOT_CAUSE_NON_HARDWARE, None) + else: + return (self.REBOOT_CAUSE_POWER_LOSS, None) + + def get_change_event(self, timeout=2000): + """ + Returns a nested dictionary containing all devices which have + experienced a change at chassis level + + Args: + timeout: Timeout in milliseconds (optional). If timeout == 0, + this method will block until a change is detected. + + Returns: + (bool, dict): + - True if call successful, False if not; + - A nested dictionary where key is a device type, + value is a dictionary with key:value pairs in the + format of {'device_id':'device_event'}, + where device_id is the device ID for this device and + device_event, + status='1' represents device inserted, + status='0' represents device removed. + Ex. {'fan':{'0':'0', '2':'1'}, 'sfp':{'11':'0'}} + indicates that fan 0 has been removed, fan 2 + has been inserted and sfp 11 has been removed. + """ + SFP_STATUS_INSERTED = '1' + SFP_STATUS_REMOVED = '0' + + now = time.time() + port_dict = {} + + if timeout < 1000: + timeout = 1000 + timeout = (timeout) / float(1000) # Convert to secs + + if now < (self.data['last'] + timeout) and self.data['valid']: + return False, {'sfp': {}} + + for sfp in self._sfp_list: + sfp_presence = sfp.get_presence() + if sfp_presence != self.sfp_presence[sfp.index]: + self.sfp_presence[sfp.index] = sfp_presence + if sfp_presence: + port_dict[sfp.index] = SFP_STATUS_INSERTED + else: + port_dict[sfp.index] = SFP_STATUS_REMOVED + + if bool(port_dict): + self.data['last'] = now + self.data['valid'] = 1 + ret = True + else: + time.sleep(0.5) + ret = False + + ret_dict = {'sfp': port_dict} + return ret, ret_dict + + def get_num_psus(self): + return len(self._psu_list) + + def get_psu(self, psu_index): + return self._psu_list[psu_index] + + def initizalize_system_led(self): + from .led import SystemLed + Chassis._led = SystemLed() + + def set_status_led(self, color): + """ + Sets the state of the system LED + + Args: + color: A string representing the color with which to set the + system LED + + Returns: + bool: True if system LED state is set successfully, False if not + """ + return False if not Chassis._led else Chassis._led.set_status(color) + + def get_status_led(self): + """ + Gets the state of the system LED + + Returns: + A string, one of the valid LED color strings which could be vendor + specified. + """ + return None if not Chassis._led else Chassis._led.get_status() diff --git a/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/eeprom.py b/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/eeprom.py new file mode 100644 index 000000000000..7d2750475717 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/eeprom.py @@ -0,0 +1,127 @@ +#!/usr/bin/env python +# +# Name: eeprom.py, version: 1.0 +# +# Description: Module contains the definitions of SONiC platform APIs +# + +try: + import os + from sonic_eeprom import eeprom_tlvinfo + from sonic_py_common import device_info + import binascii +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +USR_SHARE_SONIC_PATH = "/usr/share/sonic" +HOST_DEVICE_PATH = USR_SHARE_SONIC_PATH + "/device" +CONTAINER_PLATFORM_PATH = USR_SHARE_SONIC_PATH + "/platform" + +class Eeprom(eeprom_tlvinfo.TlvInfoDecoder): + + def __init__(self): + if os.path.isdir(CONTAINER_PLATFORM_PATH): + platform_path = CONTAINER_PLATFORM_PATH + else: + platform = device_info.get_platform() + if platform is None: + raise + platform_path = os.path.join(HOST_DEVICE_PATH, platform) + + self.__eeprom_path = platform_path + '/eeprom_file' + + super(Eeprom, self).__init__(self.__eeprom_path, 0, '', True) + + self.__eeprom_tlv_dict = dict() + try: + self.open_eeprom() + self.__eeprom_data = self.read_eeprom() + except: + self.__eeprom_data = "N/A" + raise RuntimeError("Eeprom is not Programmed") + else: + eeprom = self.__eeprom_data + + if not self.is_valid_tlvinfo_header(eeprom): + return + + total_length = (eeprom[9] << 8) | eeprom[10] + tlv_index = self._TLV_INFO_HDR_LEN + tlv_end = self._TLV_INFO_HDR_LEN + total_length + + while (tlv_index + 2) < len(eeprom) and tlv_index < tlv_end: + if not self.is_valid_tlv(eeprom[tlv_index:]): + break + + tlv = eeprom[tlv_index:tlv_index + 2 + + eeprom[tlv_index + 1]] + code = "0x%02X" % (tlv[0]) + + if tlv[0] == self._TLV_CODE_VENDOR_EXT: + value = str((tlv[2] << 24) | (tlv[3] << 16) | + (tlv[4] << 8) | tlv[5]) + value += str(tlv[6:6 + tlv[1]]) + else: + name, value = self.decoder(None, tlv) + + self.__eeprom_tlv_dict[code] = value + if eeprom[tlv_index] == self._TLV_CODE_CRC_32: + break + + tlv_index += eeprom[tlv_index+1] + 2 + + def serial_number_str(self): + (is_valid, results) = self.get_tlv_field( + self.__eeprom_data, self._TLV_CODE_SERIAL_NUMBER) + if not is_valid: + return "N/A" + return results[2].decode('ascii') + + def base_mac_addr(self): + (is_valid, t) = self.get_tlv_field( + self.__eeprom_data, self._TLV_CODE_MAC_BASE) + if not is_valid or t[1] != 6: + return super(TlvInfoDecoder, self).switchaddrstr(e) + + return ":".join([binascii.b2a_hex(T) for T in t[2]]) + + def modelstr(self): + (is_valid, results) = self.get_tlv_field( + self.__eeprom_data, self._TLV_CODE_PRODUCT_NAME) + if not is_valid: + return "N/A" + + return results[2].decode('ascii') + + def part_number_str(self): + (is_valid, results) = self.get_tlv_field( + self.__eeprom_data, self._TLV_CODE_PART_NUMBER) + if not is_valid: + return "N/A" + + return results[2].decode('ascii') + + def serial_tag_str(self): + (is_valid, results) = self.get_tlv_field( + self.__eeprom_data, self._TLV_CODE_SERVICE_TAG) + if not is_valid: + return "N/A" + + return results[2].decode('ascii') + + def revision_str(self): + (is_valid, results) = self.get_tlv_field( + self.__eeprom_data, self._TLV_CODE_DEVICE_VERSION) + if not is_valid: + return "N/A" + + return results[2].decode('ascii') + + def system_eeprom_info(self): + """ + Returns a dictionary, where keys are the type code defined in + ONIE EEPROM format and values are their corresponding values + found in the system EEPROM. + """ + return self.__eeprom_tlv_dict + diff --git a/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/fan.py b/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/fan.py new file mode 100644 index 000000000000..5f7b256eafb8 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/fan.py @@ -0,0 +1,186 @@ +#!/usr/bin/env python + +############################################################################# +# Celestica +# +# Module contains an implementation of SONiC Platform Base API and +# provides the fan status which are available in the platform +# +############################################################################# + +import math +import os.path + +try: + from sonic_platform_base.fan_base import FanBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +FAN_PATH = "/sys/class/hwmon/hwmon{}/" +FAN_MAX_PWM = 255 +FAN_FAN_PWM = "pwm{}" +FAN_FAN_INPUT = "fan{}_input" +FAN_MAX_RPM = 15000 +FAN_NAME_LIST = ["FAN-{}-1", "FAN-{}-2", "FAN-{}-3", "FAN-{}-4"] + +class Fan(FanBase): + """Platform-specific Fan class""" + + def __init__(self, fan_tray_index, fan_index=0): + self.fan_index = fan_index + self.fan_tray_index = fan_tray_index + + FanBase.__init__(self) + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + data = fd.read() + return data.strip() + except IOError: + pass + return "" + + def __write_txt_file(self, file_path, value): + try: + with open(file_path, 'w') as fd: + fd.write(str(value)) + except IOError: + return False + return True + + def __search_file_by_name(self, directory, file_name): + for dirpath, dirnames, files in os.walk(directory): + for name in files: + file_path = os.path.join(dirpath, name) + if name in file_name: + return file_path + return None + + def get_direction(self): + """ + Retrieves the direction of fan + Returns: + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + """ + direction = self.FAN_DIRECTION_EXHAUST + return direction + + def get_speed(self): + """ + Retrieves the speed of fan as a percentage of full speed + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + + Note: + speed = pwm_in/255*100 + """ + speed = 0 + fan_speed_sysfs_name = "fan{}_input".format(self.fan_index+1) + fan_speed_sysfs_path = self.__search_file_by_name( + FAN_PATH.format(self.fan_tray_index + 1), fan_speed_sysfs_name) + fan_speed_rpm = self.__read_txt_file(fan_speed_sysfs_path) or 0 + speed = math.ceil(float(fan_speed_rpm) * 100 / FAN_MAX_RPM) + + return int(speed) + + def get_target_speed(self): + """ + Retrieves the target (expected) speed of the fan + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + + Note: + speed_pc = pwm_target/255*100 + + 0 : when PWM mode is use + pwm : when pwm mode is not use + """ + # target = 0 + # fan_target_sysfs_name = "pwm{}".format(self.fan_index+1) + # fan_target_sysfs_path = self.__search_file_by_name( + # FAN_PATH.format(self.fan_tray_index + 1), fan_target_sysfs_name) + # fan_target_pwm = self.__read_txt_file(fan_target_sysfs_path) or 0 + # target = math.ceil(float(fan_target_pwm) * 100 / FAN_MAX_PWM) + + # return target + speed = 0 + fan_speed_sysfs_name = "fan{}_input".format(self.fan_index+1) + fan_speed_sysfs_path = self.__search_file_by_name( + FAN_PATH.format(self.fan_tray_index + 1), fan_speed_sysfs_name) + fan_speed_rpm = self.__read_txt_file(fan_speed_sysfs_path) or 0 + speed = math.ceil(float(fan_speed_rpm) * 100 / FAN_MAX_RPM) + + return speed + + def get_speed_tolerance(self): + """ + Retrieves the speed tolerance of the fan + Returns: + An integer, the percentage of variance from target speed which is + considered tolerable + """ + return 10 + + def set_speed(self, speed): + """ + Sets the fan speed + Args: + speed: An integer, the percentage of full fan speed to set fan to, + in the range 0 (off) to 100 (full speed) + Returns: + A boolean, True if speed is set successfully, False if not + + Note: + Depends on pwm or target mode is selected: + 1) pwm = speed_pc * 255 <-- Currently use this mode. + 2) target_pwm = speed_pc * 100 / 255 + 2.1) set pwm{}_enable to 3 + + """ + pwm = speed * 255 / 100 + fan_target_sysfs_name = "pwm{}".format(self.fan_index+1) + fan_target_sysfs_path = self.__search_file_by_name( + FAN_PATH.format(self.fan_tray_index + 1), fan_target_sysfs_name) + return self.__write_txt_file(fan_target_sysfs_path, int(pwm)) + + def set_status_led(self, color): + """ + Sets the state of the fan module status LED + Args: + color: A string representing the color with which to set the + fan module status LED + Returns: + bool: always True + """ + return True + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + fan_name = FAN_NAME_LIST[self.fan_index].format(self.fan_tray_index) + + return fan_name + + def get_presence(self): + """ + Retrieves the presence of the FAN + Returns: + bool: always True + """ + + return True + + def get_status(self): + """ + Retrieves the status of the FAN + Returns: + bool: always True + """ + return True diff --git a/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/fan_drawer.py b/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..9940645ff92d --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/fan_drawer.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python + +######################################################################## +# Centec V682 48X8C +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Fan-Drawers' information available in the platform. +# +######################################################################## + +try: + from sonic_platform_base.fan_drawer_base import FanDrawerBase + from sonic_platform.fan import Fan +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CENTEC_FANS_PER_FANTRAY = 4 + + +class FanDrawer(FanDrawerBase): + """Centec V682 48X8C Platform-specific Fan class""" + + def __init__(self, fantray_index): + + FanDrawerBase.__init__(self) + self.fantrayindex = fantray_index + for i in range(CENTEC_FANS_PER_FANTRAY): + self._fan_list.append(Fan(fantray_index, i)) + + def get_name(self): + """ + Retrieves the fan drawer name + Returns: + string: The name of the device + """ + return "FanTray{}".format(self.fantrayindex) + + def set_status_led(self, color): + """ + Sets the state of the fan drawer status LED + + Args: + color: A string representing the color with which to set the + fan drawer status LED + + Returns: + bool: True if status LED state is set successfully, False if not + """ + return True diff --git a/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/led.py b/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/led.py new file mode 100644 index 000000000000..492d6983ea76 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/led.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +############################################################################# +# +# Module contains an implementation of SONiC Platform Base API and +# provides the led status which are available in the platform +# +############################################################################# + +from subprocess import Popen, PIPE, STDOUT + +class SystemLed(object): + STATUS_LED_COLOR_GREEN = 'green' + STATUS_LED_COLOR_ORANGE = 'orange' + STATUS_LED_COLOR_OFF = 'off' + + SYSTEM_LED_PATH = '/sys/class/leds/system/brightness' + + def set_status(self, color): + status = False + + if color == SystemLed.STATUS_LED_COLOR_ORANGE: + cmd = 'i2cset -y 0 0x36 0x2 0xb' + Popen(cmd, shell=True) + status = True + elif color == SystemLed.STATUS_LED_COLOR_OFF: + cmd = 'i2cset -y 0 0x36 0x2 0x0' + Popen(cmd, shell=True) + status = True + elif color == SystemLed.STATUS_LED_COLOR_GREEN: + cmd = 'i2cset -y 0 0x36 0x2 0x5' + Popen(cmd, shell=True) + status = True + + return status + + def get_status(self): + cmd = 'i2cget -y 0 0x36 0x2' + status = int(Popen(cmd, stdout=PIPE, stderr=STDOUT, shell=True).stdout.readline(), 16) + if status == 11: + return SystemLed.STATUS_LED_COLOR_ORANGE + elif status == 0: + return SystemLed.STATUS_LED_COLOR_OFF + else: + return SystemLed.STATUS_LED_COLOR_GREEN diff --git a/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/platform.py b/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/platform.py new file mode 100644 index 000000000000..59d37da538a1 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/platform.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +# +# Name: platform.py, version: 1.0 +# +# Description: Module contains the definitions of SONiC platform APIs for Centec V682-48X8C +# + + +try: + from sonic_platform_base.platform_base import PlatformBase + from sonic_platform.chassis import Chassis +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PlatformBase): + + def __init__(self): + PlatformBase.__init__(self) + self._chassis = Chassis() + diff --git a/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/psu.py b/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/psu.py new file mode 100644 index 000000000000..779209c71c2e --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/psu.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +from __future__ import print_function + +from subprocess import Popen, PIPE, STDOUT + +try: + from sonic_platform_base.psu_base import PsuBase +except ImportError as e: + raise ImportError("%s - required module not found" % e) + +class Psu(PsuBase): + """Centec Platform-specific PSU class""" + + def __init__(self, index): + self._index = index + self._fan_list = [] + + def get_presence(self): + cmd = 'i2cget -y 0 0x36 0x1e' + status = int(Popen(cmd, stdout=PIPE, stderr=STDOUT, shell=True).stdout.readline(), 16) + presence = ((status & (1 << (3 * (self._index - 1) + 1))) == 0) + return presence + + def get_powergood_status(self): + cmd = 'i2cget -y 0 0x36 0x1e' + status = int(Popen(cmd, stdout=PIPE, stderr=STDOUT, shell=True).stdout.readline(), 16) + powergood = ((status & (1 << (3 * (self._index - 1) + 2))) != 0) + return powergood diff --git a/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/sfp.py b/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/sfp.py new file mode 100644 index 000000000000..1d4154ff8384 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/sfp.py @@ -0,0 +1,1618 @@ +#!/usr/bin/env python + +############################################################################# +# Centec +# +# Sfp contains an implementation of SONiC Platform Base API and +# provides the sfp device status which are available in the platform +# +############################################################################# + +import os +import time +import re +import collections +#import subprocess +#import sonic_device_util +from ctypes import create_string_buffer +from subprocess import Popen, PIPE, STDOUT +from sonic_py_common import device_info + +try: + from sonic_platform_base.sfp_base import SfpBase +# from sonic_platform_base.sonic_eeprom import eeprom_dts + from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId + from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom + from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId + from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +USR_SHARE_SONIC_PATH = "/usr/share/sonic" +HOST_DEVICE_PATH = USR_SHARE_SONIC_PATH + "/device" +CONTAINER_PLATFORM_PATH = USR_SHARE_SONIC_PATH + "/platform" + +QSFP_INFO_OFFSET = 128 +QSFP_DOM_OFFSET = 0 +SFP_INFO_OFFSET = 0 +SFP_DOM_OFFSET = 256 + +# definitions of the offset and width for values in XCVR info eeprom +XCVR_INTFACE_BULK_OFFSET = 0 +XCVR_INTFACE_BULK_WIDTH_QSFP = 20 +XCVR_INTFACE_BULK_WIDTH_SFP = 21 +XCVR_TYPE_OFFSET = 0 +XCVR_TYPE_WIDTH = 1 +XCVR_EXT_TYPE_OFFSET = 1 +XCVR_EXT_TYPE_WIDTH = 1 +XCVR_CONNECTOR_OFFSET = 2 +XCVR_CONNECTOR_WIDTH = 1 +XCVR_COMPLIANCE_CODE_OFFSET = 3 +XCVR_COMPLIANCE_CODE_WIDTH = 8 +XCVR_ENCODING_OFFSET = 11 +XCVR_ENCODING_WIDTH = 1 +XCVR_NBR_OFFSET = 12 +XCVR_NBR_WIDTH = 1 +XCVR_EXT_RATE_SEL_OFFSET = 13 +XCVR_EXT_RATE_SEL_WIDTH = 1 +XCVR_CABLE_LENGTH_OFFSET = 14 +XCVR_CABLE_LENGTH_WIDTH_QSFP = 5 +XCVR_CABLE_LENGTH_WIDTH_SFP = 6 +XCVR_VENDOR_NAME_OFFSET = 20 +XCVR_VENDOR_NAME_WIDTH = 16 +XCVR_VENDOR_OUI_OFFSET = 37 +XCVR_VENDOR_OUI_WIDTH = 3 +XCVR_VENDOR_PN_OFFSET = 40 +XCVR_VENDOR_PN_WIDTH = 16 +XCVR_HW_REV_OFFSET = 56 +XCVR_HW_REV_WIDTH_QSFP = 2 +XCVR_HW_REV_WIDTH_SFP = 4 +XCVR_VENDOR_SN_OFFSET = 68 +XCVR_VENDOR_SN_WIDTH = 16 +XCVR_VENDOR_DATE_OFFSET = 84 +XCVR_VENDOR_DATE_WIDTH = 8 +XCVR_DOM_CAPABILITY_OFFSET = 92 +XCVR_DOM_CAPABILITY_WIDTH = 2 + +XCVR_INTERFACE_DATA_START = 0 +XCVR_INTERFACE_DATA_SIZE = 92 + +QSFP_DOM_BULK_DATA_START = 22 +QSFP_DOM_BULK_DATA_SIZE = 36 +SFP_DOM_BULK_DATA_START = 96 +SFP_DOM_BULK_DATA_SIZE = 10 + +# Offset for values in QSFP eeprom +QSFP_DOM_REV_OFFSET = 1 +QSFP_DOM_REV_WIDTH = 1 +QSFP_TEMPE_OFFSET = 22 +QSFP_TEMPE_WIDTH = 2 +QSFP_VOLT_OFFSET = 26 +QSFP_VOLT_WIDTH = 2 +QSFP_VERSION_COMPLIANCE_OFFSET = 1 +QSFP_VERSION_COMPLIANCE_WIDTH = 1 +QSFP_CHANNL_MON_OFFSET = 34 +QSFP_CHANNL_MON_WIDTH = 16 +QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH = 24 +QSFP_CHANNL_DISABLE_STATUS_OFFSET = 86 +QSFP_CHANNL_DISABLE_STATUS_WIDTH = 1 +QSFP_CHANNL_RX_LOS_STATUS_OFFSET = 3 +QSFP_CHANNL_RX_LOS_STATUS_WIDTH = 1 +QSFP_CHANNL_TX_FAULT_STATUS_OFFSET = 4 +QSFP_CHANNL_TX_FAULT_STATUS_WIDTH = 1 +QSFP_CONTROL_OFFSET = 86 +QSFP_CONTROL_WIDTH = 8 +QSFP_MODULE_MONITOR_OFFSET = 0 +QSFP_MODULE_MONITOR_WIDTH = 9 +QSFP_MODULE_THRESHOLD_OFFSET = 512 +QSFP_MODULE_THRESHOLD_WIDTH = 24 +QSFP_CHANNEL_THRESHOLD_OFFSET = 560 +QSFP_CHANNEL_THRESHOLD_WIDTH = 16 +QSFP_POWEROVERRIDE_OFFSET = 93 +QSFP_POWEROVERRIDE_WIDTH = 1 +QSFP_POWEROVERRIDE_BIT = 0 +QSFP_POWERSET_BIT = 1 +QSFP_OPTION_VALUE_OFFSET = 192 +QSFP_OPTION_VALUE_WIDTH = 4 + +SFP_TEMPE_OFFSET = 96 +SFP_TEMPE_WIDTH = 2 +SFP_VOLT_OFFSET = 98 +SFP_VOLT_WIDTH = 2 +SFP_CHANNL_MON_OFFSET = 100 +SFP_CHANNL_MON_WIDTH = 6 +SFP_MODULE_THRESHOLD_OFFSET = 0 +SFP_MODULE_THRESHOLD_WIDTH = 40 +SFP_CHANNL_THRESHOLD_OFFSET = 112 +SFP_CHANNL_THRESHOLD_WIDTH = 2 +SFP_STATUS_CONTROL_OFFSET = 110 +SFP_STATUS_CONTROL_WIDTH = 1 +SFP_TX_DISABLE_HARD_BIT = 7 +SFP_TX_DISABLE_SOFT_BIT = 6 + +qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)', + 'Length OM2(m)', 'Length OM1(m)', + 'Length Cable Assembly(m)') + +sfp_cable_length_tup = ('LengthSMFkm-UnitsOfKm', 'LengthSMF(UnitsOf100m)', + 'Length50um(UnitsOf10m)', 'Length62.5um(UnitsOfm)', + 'LengthCable(UnitsOfm)', 'LengthOM3(UnitsOf10m)') + +sfp_compliance_code_tup = ('10GEthernetComplianceCode', 'InfinibandComplianceCode', + 'ESCONComplianceCodes', 'SONETComplianceCodes', + 'EthernetComplianceCodes','FibreChannelLinkLength', + 'FibreChannelTechnology', 'SFP+CableTechnology', + 'FibreChannelTransmissionMedia','FibreChannelSpeed') + +qsfp_compliance_code_tup = ('10/40G Ethernet Compliance Code', 'SONET Compliance codes', + 'SAS/SATA compliance codes', 'Gigabit Ethernet Compliant codes', + 'Fibre Channel link length/Transmitter Technology', + 'Fibre Channel transmission media', 'Fibre Channel Speed') + +SFP_TYPE = "SFP" +QSFP_TYPE = "QSFP" + + +class Sfp(SfpBase): + """Platform-specific Sfp class""" + + dom_supported = True + dom_temp_supported = True + dom_volt_supported = True + dom_rx_power_supported = True + dom_tx_power_supported = True + dom_tx_disable_supported = True + calibration = 1 + + # Path to QSFP sysfs + PLATFORM_ROOT_PATH = "/usr/share/sonic/device" + PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" + HOST_CHK_CMD = "docker > /dev/null 2>&1" + + PLATFORM = "x86_64-centec_v682_48x8c-r0" + HWSKU = "V682-48x8c" + + def __init__(self, sfp_index, sfp_type): + if os.path.isdir(CONTAINER_PLATFORM_PATH): + platform_path = CONTAINER_PLATFORM_PATH + else: + platform = device_info.get_platform() + if platform is None: + raise + platform_path = os.path.join(HOST_DEVICE_PATH, platform) + + port_config_file = "/".join([platform_path, self.HWSKU, "port_config.ini"]) + try: + f = open(port_config_file) + except: + raise + for line in f: + line.strip() + if re.search('^#', line) is not None: + Port_cfg = collections.namedtuple('Port_cfg', line.split()[1:]) + break + f.close() + f = open(port_config_file) + self._port_cfgs = [Port_cfg(*tuple((line.strip().split()))) + for line in f if re.search('^#', line) is None] + f.close() + + # Port number + self.PORT_START = 256 + self.PORT_END = 0 + self.QSFP_START = 48 + self.QSFP_END = 0 + + for port_cfg in self._port_cfgs: + if int(port_cfg.index) <= self.PORT_START: + self.PORT_START = int(port_cfg.index) + elif int(port_cfg.index) >= self.PORT_END: + self.PORT_END = int(port_cfg.index) + self.QSFP_END = self.PORT_END + + # Init index + self.index = sfp_index + self.port_num = self.index + #self.dom_supported = False + self.sfp_type = sfp_type + # Init eeprom path + eeprom_path = '/sys/bus/i2c/devices/i2c-{0}/{0}-0050/eeprom' + self.port_to_eeprom_mapping = {} + self.port_to_i2c_mapping = { + # mac i2c presence enable(or reset for qsfp) + 32 : (13, 0x36, 0x11, 0, 0x36, 0x0e, 0), + 33 : (12, 0x36, 0x11, 1, 0x36, 0x0e, 1), + 34 : (11, 0x36, 0x11, 2, 0x36, 0x0e, 2), + 35 : (10, 0x36, 0x11, 3, 0x36, 0x0e, 3), + 0 : (17, 0x36, 0x11, 4, 0x36, 0x0e, 4), + 4 : (16, 0x36, 0x11, 5, 0x36, 0x0e, 5), + 8 : (15, 0x36, 0x11, 6, 0x36, 0x0e, 6), + 12 : (14, 0x36, 0x11, 7, 0x36, 0x0e, 7), + 16 : (21, 0x36, 0x12, 0, 0x36, 0x0f, 0), + 20 : (20, 0x36, 0x12, 1, 0x36, 0x0f, 1), + 24 : (19, 0x36, 0x12, 2, 0x36, 0x0f, 2), + 28 : (18, 0x36, 0x12, 3, 0x36, 0x0f, 3), + 40 : (25, 0x36, 0x12, 4, 0x36, 0x0f, 4), + 44 : (24, 0x36, 0x12, 5, 0x36, 0x0f, 5), + 48 : (23, 0x36, 0x12, 6, 0x36, 0x0f, 6), + 52 : (22, 0x36, 0x12, 7, 0x36, 0x0f, 7), + 56 : (29, 0x36, 0x13, 0, 0x36, 0x10, 0), + 60 : (28, 0x36, 0x13, 1, 0x36, 0x10, 1), + 64 : (27, 0x36, 0x13, 2, 0x36, 0x10, 2), + 68 : (26, 0x36, 0x13, 3, 0x36, 0x10, 3), + 72 : (33, 0x36, 0x13, 4, 0x36, 0x10, 4), + 73 : (32, 0x36, 0x13, 5, 0x36, 0x10, 5), + 74 : (31, 0x36, 0x13, 6, 0x36, 0x10, 6), + 75 : (30, 0x36, 0x13, 7, 0x36, 0x10, 7), + 232 : (37, 0x37, 0x11, 0, 0x37, 0x0e, 0), + 233 : (36, 0x37, 0x11, 1, 0x37, 0x0e, 1), + 234 : (35, 0x37, 0x11, 2, 0x37, 0x0e, 2), + 235 : (34, 0x37, 0x11, 3, 0x37, 0x0e, 3), + 200 : (41, 0x37, 0x11, 4, 0x37, 0x0e, 4), + 204 : (40, 0x37, 0x11, 5, 0x37, 0x0e, 5), + 208 : (39, 0x37, 0x11, 6, 0x37, 0x0e, 6), + 212 : (38, 0x37, 0x11, 7, 0x37, 0x0e, 7), + 216 : (45, 0x37, 0x12, 0, 0x37, 0x0f, 0), + 220 : (44, 0x37, 0x12, 1, 0x37, 0x0f, 1), + 224 : (43, 0x37, 0x12, 2, 0x37, 0x0f, 2), + 228 : (42, 0x37, 0x12, 3, 0x37, 0x0f, 3), + 160 : (49, 0x37, 0x12, 4, 0x37, 0x0f, 4), + 164 : (48, 0x37, 0x12, 5, 0x37, 0x0f, 5), + 168 : (47, 0x37, 0x12, 6, 0x37, 0x0f, 6), + 172 : (46, 0x37, 0x12, 7, 0x37, 0x0f, 7), + 176 : (53, 0x37, 0x13, 0, 0x37, 0x10, 0), + 180 : (52, 0x37, 0x13, 1, 0x37, 0x10, 1), + 184 : (51, 0x37, 0x13, 2, 0x37, 0x10, 2), + 188 : (50, 0x37, 0x13, 3, 0x37, 0x10, 3), + 192 : (57, 0x37, 0x13, 4, 0x37, 0x10, 4), + 193 : (56, 0x37, 0x13, 5, 0x37, 0x10, 5), + 194 : (55, 0x37, 0x13, 6, 0x37, 0x10, 6), + 195 : (54, 0x37, 0x13, 7, 0x37, 0x10, 7), + 120 : (61, 0x36, 0x14, 0, 0x36, 0x05, 0), + 121 : (61, 0x36, 0x14, 0, 0x36, 0x05, 0), + 122 : (61, 0x36, 0x14, 0, 0x36, 0x05, 0), + 123 : (61, 0x36, 0x14, 0, 0x36, 0x05, 0), + 124 : (60, 0x36, 0x14, 1, 0x36, 0x05, 1), + 125 : (60, 0x36, 0x14, 1, 0x36, 0x05, 1), + 126 : (60, 0x36, 0x14, 1, 0x36, 0x05, 1), + 127 : (60, 0x36, 0x14, 1, 0x36, 0x05, 1), + 80 : (59, 0x36, 0x14, 2, 0x36, 0x05, 2), + 81 : (59, 0x36, 0x14, 2, 0x36, 0x05, 2), + 82 : (59, 0x36, 0x14, 2, 0x36, 0x05, 2), + 83 : (59, 0x36, 0x14, 2, 0x36, 0x05, 2), + 84 : (58, 0x36, 0x14, 3, 0x36, 0x05, 3), + 85 : (58, 0x36, 0x14, 3, 0x36, 0x05, 3), + 86 : (58, 0x36, 0x14, 3, 0x36, 0x05, 3), + 87 : (58, 0x36, 0x14, 3, 0x36, 0x05, 3), + 240 : (65, 0x37, 0x14, 0, 0x37, 0x05, 0), + 241 : (65, 0x37, 0x14, 0, 0x37, 0x05, 0), + 242 : (65, 0x37, 0x14, 0, 0x37, 0x05, 0), + 243 : (65, 0x37, 0x14, 0, 0x37, 0x05, 0), + 244 : (64, 0x37, 0x14, 1, 0x37, 0x05, 1), + 245 : (64, 0x37, 0x14, 1, 0x37, 0x05, 1), + 246 : (64, 0x37, 0x14, 1, 0x37, 0x05, 1), + 247 : (64, 0x37, 0x14, 1, 0x37, 0x05, 1), + 280 : (63, 0x37, 0x14, 2, 0x37, 0x05, 2), + 281 : (63, 0x37, 0x14, 2, 0x37, 0x05, 2), + 282 : (63, 0x37, 0x14, 2, 0x37, 0x05, 2), + 283 : (63, 0x37, 0x14, 2, 0x37, 0x05, 2), + 284 : (62, 0x37, 0x14, 3, 0x37, 0x05, 3), + 285 : (62, 0x37, 0x14, 3, 0x37, 0x05, 3), + 286 : (62, 0x37, 0x14, 3, 0x37, 0x05, 3), + 287 : (62, 0x37, 0x14, 3, 0x37, 0x05, 3) + } + + for port_cfg in self._port_cfgs: + i2c_idx = self.port_to_i2c_mapping[int(port_cfg.lanes.split(',')[0])][0] + port_eeprom_path = eeprom_path.format(i2c_idx) + self.port_to_eeprom_mapping[int(port_cfg.index)] = port_eeprom_path + + self.info_dict_keys = ['type', 'hardware_rev', 'serial', 'manufacturer', + 'model', 'connector', 'encoding', 'ext_identifier', + 'ext_rateselect_compliance', 'cable_type', 'cable_length', + 'nominal_bit_rate', 'specification_compliance', 'vendor_date', + 'vendor_oui', 'application_advertisement'] + + self.dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', 'power_lpmode', + 'tx_disable', 'tx_disable_channel', 'temperature', 'voltage', + 'rx1power', 'rx2power', 'rx3power', 'rx4power', 'tx1bias', 'tx2bias', + 'tx3bias', 'tx4bias', 'tx1power', 'tx2power', 'tx3power', 'tx4power'] + + self.threshold_dict_keys = ['temphighalarm', 'temphighwarning', + 'templowalarm', 'templowwarning', 'vcchighalarm', 'vcchighwarning', + 'vcclowalarm', 'vcclowwarning', 'rxpowerhighalarm', 'rxpowerhighwarning', + 'rxpowerlowalarm', 'rxpowerlowwarning', 'txpowerhighalarm', + 'txpowerhighwarning', 'txpowerlowalarm', 'txpowerlowwarning', + 'txbiashighalarm', 'txbiashighwarning', 'txbiaslowalarm', 'txbiaslowwarning'] + + SfpBase.__init__(self) + + + def _convert_string_to_num(self, value_str): + if "-inf" in value_str: + return 'N/A' + elif "Unknown" in value_str: + return 'N/A' + elif 'dBm' in value_str: + t_str = value_str.rstrip('dBm') + return float(t_str) + elif 'mA' in value_str: + t_str = value_str.rstrip('mA') + return float(t_str) + elif 'C' in value_str: + t_str = value_str.rstrip('C') + return float(t_str) + elif 'Volts' in value_str: + t_str = value_str.rstrip('Volts') + return float(t_str) + else: + return 'N/A' + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + data = fd.read() + return data.strip() + except IOError: + pass + return "" + + def __is_host(self): + return os.system(self.HOST_CHK_CMD) == 0 + + def __get_path_to_port_config_file(self): + platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) + hwsku_path = "/".join([platform_path, self.HWSKU] + ) if self.__is_host() else self.PMON_HWSKU_PATH + return "/".join([hwsku_path, "port_config.ini"]) + + def get_presence(self): + """ + Retrieves the presence of the SFP module + Returns: + bool: True if SFP module is present, False if not + """ + # Check for invalid port_num + if self.port_num < self.PORT_START or self.port_num > self.PORT_END: + return False + + sfp_info = self.port_to_i2c_mapping[int(self._port_cfgs[self.port_num].lanes.split(',')[0])] + cmd = 'i2cget -y 0 {0} {1}'.format(sfp_info[1], sfp_info[2]) + presence = int(Popen(cmd, stdout=PIPE, stderr=STDOUT, shell=True).stdout.readline(), 16) + presence &= (1 << sfp_info[3]) + + try: + with open(self.port_to_eeprom_mapping[self.port_num], mode='rb', buffering=0) as fd: + fd.read() + except IOError: + return False + + return (presence == 0) + + def __read_eeprom_specific_bytes(self, offset, num_bytes): + sysfsfile_eeprom = None + eeprom_raw = [] + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + sysfs_sfp_i2c_client_eeprom_path = self.port_to_eeprom_mapping[self.port_num] + try: + sysfsfile_eeprom = open( + sysfs_sfp_i2c_client_eeprom_path, mode="rb", buffering=0) + sysfsfile_eeprom.seek(offset) + raw = sysfsfile_eeprom.read(num_bytes) + for n in range(0, num_bytes): + eeprom_raw[n] = hex(raw[n])[2:].zfill(2) + except Exception: + eeprom_raw = None + finally: + if sysfsfile_eeprom: + sysfsfile_eeprom.close() + + return eeprom_raw + + def __convert_string_to_num(self, value_str): + if "-inf" in value_str: + return 'N/A' + elif "Unknown" in value_str: + return 'N/A' + elif 'dBm' in value_str: + t_str = value_str.rstrip('dBm') + return float(t_str) + elif 'mA' in value_str: + t_str = value_str.rstrip('mA') + return float(t_str) + elif 'C' in value_str: + t_str = value_str.rstrip('C') + return float(t_str) + elif 'Volts' in value_str: + t_str = value_str.rstrip('Volts') + return float(t_str) + else: + return 'N/A' + + def _dom_capability_detect(self): + if not self.get_presence(): + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.calibration = 0 + return + + if self.sfp_type == "QSFP": + self.calibration = 1 + sfpi_obj = sff8436InterfaceId() + if sfpi_obj is None: + self.dom_supported = False + offset = 128 + + # QSFP capability byte parse, through this byte can know whether it support tx_power or not. + # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, + # need to add more code for determining the capability and version compliance + # in SFF-8636 dom capability definitions evolving with the versions. + qsfp_dom_capability_raw = self.__read_eeprom_specific_bytes( + (offset + XCVR_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH) + if qsfp_dom_capability_raw is not None: + qsfp_dom_capability = int(qsfp_dom_capability_raw[0], 16) + + qsfp_version_compliance_raw = self.__read_eeprom_specific_bytes( + QSFP_VERSION_COMPLIANCE_OFFSET, QSFP_VERSION_COMPLIANCE_OFFSET) + if qsfp_version_compliance_raw is not None: + qsfp_version_compliance = int(qsfp_version_compliance_raw[0], 16) + else: + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.calibration = 0 + return + + if qsfp_version_compliance >= 0x08: + self.dom_temp_supported = (qsfp_dom_capability & 0x20 != 0) + self.dom_volt_supported = (qsfp_dom_capability & 0x10 != 0) + self.dom_rx_power_supported = (qsfp_dom_capability & 0x08 != 0) + self.dom_tx_power_supported = (qsfp_dom_capability & 0x04 != 0) + else: + self.dom_temp_supported = True + self.dom_volt_supported = True + self.dom_rx_power_supported = (qsfp_dom_capability & 0x08 != 0) + self.dom_tx_power_supported = True + self.dom_supported = True + self.calibration = 1 + self.dom_tx_disable_supported = True + else: + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.calibration = 0 + elif self.sfp_type == "SFP": + sfpi_obj = sff8472InterfaceId() + if sfpi_obj is None: + return None + sfp_dom_capability_raw = self.__read_eeprom_specific_bytes( + XCVR_DOM_CAPABILITY_OFFSET, XCVR_DOM_CAPABILITY_WIDTH) + if sfp_dom_capability_raw is not None: + sfp_dom_capability = int(sfp_dom_capability_raw[0], 16) + self.dom_supported = (sfp_dom_capability & 0x40 != 0) + if self.dom_supported: + self.dom_temp_supported = True + self.dom_volt_supported = True + self.dom_rx_power_supported = True + self.dom_tx_power_supported = True + if sfp_dom_capability & 0x20 != 0: + self.calibration = 1 + elif sfp_dom_capability & 0x10 != 0: + self.calibration = 2 + else: + self.calibration = 0 + else: + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.calibration = 0 + self.dom_tx_disable_supported = (int(sfp_dom_capability_raw[1], 16) & 0x40 != 0) + else: + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + + def get_transceiver_info(self): + """ + Retrieves transceiver info of this SFP + Returns: + A dict which contains following keys/values : + ======================================================================== + keys |Value Format |Information + ---------------------------|---------------|---------------------------- + type |1*255VCHAR |type of SFP + hardware_rev |1*255VCHAR |hardware version of SFP + serial |1*255VCHAR |serial number of the SFP + manufacturer |1*255VCHAR |SFP vendor name + model |1*255VCHAR |SFP model name + connector |1*255VCHAR |connector information + encoding |1*255VCHAR |encoding information + ext_identifier |1*255VCHAR |extend identifier + ext_rateselect_compliance |1*255VCHAR |extended rateSelect compliance + cable_length |INT |cable length in m + nominal_bit_rate |INT |nominal bit rate by 100Mbs + specification_compliance |1*255VCHAR |specification compliance + vendor_date |1*255VCHAR |vendor date + vendor_oui |1*255VCHAR |vendor OUI + application_advertisement |1*255VCHAR |supported applications advertisement + ======================================================================== + """ + + transceiver_info_dict = {} + compliance_code_dict = {} + transceiver_info_dict = dict.fromkeys(self.info_dict_keys, 'N/A') + transceiver_info_dict['specification_compliance'] = '{}' + if not self.get_presence(): + return transceiver_info_dict + + if self.sfp_type == QSFP_TYPE: + offset = QSFP_INFO_OFFSET + vendor_rev_width = XCVR_HW_REV_WIDTH_QSFP + interface_info_bulk_width = XCVR_INTFACE_BULK_WIDTH_QSFP + + sfpi_obj = sff8436InterfaceId() + if sfpi_obj is None: + print("Error: sfp_object open failed") + return transceiver_info_dict + + elif self.sfp_type == SFP_TYPE: + offset = SFP_INFO_OFFSET + vendor_rev_width = XCVR_HW_REV_WIDTH_SFP + interface_info_bulk_width = XCVR_INTFACE_BULK_WIDTH_SFP + + sfpi_obj = sff8472InterfaceId() + if sfpi_obj is None: + print("Error: sfp_object open failed") + return transceiver_info_dict + else: + return transceiver_info_dict + + # Add retry for xcvr eeprom to get ready + max_retry = 10 + for i in range(0,max_retry): + sfp_interface_bulk_raw = self.__read_eeprom_specific_bytes( + offset + XCVR_INTERFACE_DATA_START, XCVR_INTERFACE_DATA_SIZE) + if sfp_interface_bulk_raw is not None: + break + else: + if not self.get_presence(): + return transceiver_info_dict + elif i == max_retry-1: + pass + else: + time.sleep(0.5) + + if sfp_interface_bulk_raw is None: + return transceiver_info_dict + + start = XCVR_INTFACE_BULK_OFFSET - XCVR_INTERFACE_DATA_START + end = start + interface_info_bulk_width + sfp_interface_bulk_data = sfpi_obj.parse_sfp_info_bulk(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_VENDOR_NAME_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_NAME_WIDTH + sfp_vendor_name_data = sfpi_obj.parse_vendor_name(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_VENDOR_PN_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_PN_WIDTH + sfp_vendor_pn_data = sfpi_obj.parse_vendor_pn(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_HW_REV_OFFSET - XCVR_INTERFACE_DATA_START + end = start + vendor_rev_width + sfp_vendor_rev_data = sfpi_obj.parse_vendor_rev(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_VENDOR_SN_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_SN_WIDTH + sfp_vendor_sn_data = sfpi_obj.parse_vendor_sn(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_VENDOR_OUI_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_OUI_WIDTH + sfp_vendor_oui_data = sfpi_obj.parse_vendor_oui(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_VENDOR_DATE_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_DATE_WIDTH + sfp_vendor_date_data = sfpi_obj.parse_vendor_date(sfp_interface_bulk_raw[start : end], 0) + transceiver_info_dict['type'] = sfp_interface_bulk_data \ + ['data']['type']['value'] + transceiver_info_dict['manufacturer'] = sfp_vendor_name_data \ + ['data']['Vendor Name']['value'] + transceiver_info_dict['model'] = sfp_vendor_pn_data \ + ['data']['Vendor PN']['value'] + transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data \ + ['data']['Vendor Rev']['value'] + transceiver_info_dict['serial'] = sfp_vendor_sn_data \ + ['data']['Vendor SN']['value'] + transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data \ + ['data']['Vendor OUI']['value'] + transceiver_info_dict['vendor_date'] = sfp_vendor_date_data \ + ['data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] + transceiver_info_dict['connector'] = sfp_interface_bulk_data \ + ['data']['Connector']['value'] + transceiver_info_dict['encoding'] = sfp_interface_bulk_data \ + ['data']['EncodingCodes']['value'] + transceiver_info_dict['ext_identifier'] = sfp_interface_bulk_data \ + ['data']['Extended Identifier']['value'] + transceiver_info_dict['ext_rateselect_compliance'] = sfp_interface_bulk_data \ + ['data']['RateIdentifier']['value'] + transceiver_info_dict['type_abbrv_name'] = 'N/A' + if self.sfp_type == QSFP_TYPE: + for key in qsfp_cable_length_tup: + if key in sfp_interface_bulk_data['data']: + transceiver_info_dict['cable_type'] = key + transceiver_info_dict['cable_length'] = str( + sfp_interface_bulk_data['data'][key]['value']) + + for key in qsfp_compliance_code_tup: + if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: + compliance_code_dict[key] = sfp_interface_bulk_data \ + ['data']['Specification compliance']['value'][key]['value'] + transceiver_info_dict['specification_compliance'] = str(compliance_code_dict) + + transceiver_info_dict['nominal_bit_rate'] = str(sfp_interface_bulk_data \ + ['data']['Nominal Bit Rate(100Mbs)']['value']) + else: + for key in sfp_cable_length_tup: + if key in sfp_interface_bulk_data['data']: + transceiver_info_dict['cable_type'] = key + transceiver_info_dict['cable_length'] = str( + sfp_interface_bulk_data['data'][key]['value']) + + for key in sfp_compliance_code_tup: + if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: + compliance_code_dict[key] = sfp_interface_bulk_data \ + ['data']['Specification compliance']['value'][key]['value'] + transceiver_info_dict['specification_compliance'] = str(compliance_code_dict) + + transceiver_info_dict['nominal_bit_rate'] = str(sfp_interface_bulk_data \ + ['data']['NominalSignallingRate(UnitsOf100Mbd)']['value']) + + return transceiver_info_dict + + def get_transceiver_bulk_status(self): + """ + Retrieves transceiver bulk status of this SFP + Returns: + A dict which contains following keys/values : + ======================================================================== + keys |Value Format |Information + ---------------------------|---------------|---------------------------- + rx_los |BOOLEAN |RX loss-of-signal status, True if has RX los, False if not. + tx_fault |BOOLEAN |TX fault status, True if has TX fault, False if not. + reset_status |BOOLEAN |reset status, True if SFP in reset, False if not. + lp_mode |BOOLEAN |low power mode status, True in lp mode, False if not. + tx_disable |BOOLEAN |TX disable status, True TX disabled, False if not. + tx_disabled_channel |HEX |disabled TX channels in hex, bits 0 to 3 represent channel 0 + | |to channel 3. + temperature |INT |module temperature in Celsius + voltage |INT |supply voltage in mV + txbias |INT |TX Bias Current in mA, n is the channel number, + | |for example, tx2bias stands for tx bias of channel 2. + rxpower |INT |received optical power in mW, n is the channel number, + | |for example, rx2power stands for rx power of channel 2. + txpower |INT |TX output power in mW, n is the channel number, + | |for example, tx2power stands for tx power of channel 2. + ======================================================================== + """ + + if not self.get_presence(): + return None + + self._dom_capability_detect() + + if self.sfp_type == QSFP_TYPE: + sfpd_obj = sff8436Dom() + sfpi_obj = sff8436InterfaceId() + + if not sfpi_obj or not sfpd_obj: + return None + + transceiver_dom_info_dict = dict.fromkeys(self.dom_dict_keys, 'N/A') + offset = QSFP_DOM_OFFSET + offset_xcvr = QSFP_INFO_OFFSET + + # QSFP capability byte parse, through this byte can know whether it support tx_power or not. + # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, + # need to add more code for determining the capability and version compliance + # in SFF-8636 dom capability definitions evolving with the versions. + qsfp_dom_capability_raw = self.__read_eeprom_specific_bytes( + (offset_xcvr + XCVR_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH) + if qsfp_dom_capability_raw is not None: + qsfp_dom_capability_data = sfpi_obj.parse_dom_capability( + qsfp_dom_capability_raw, 0) + else: + return None + + dom_temperature_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_TEMPE_OFFSET), QSFP_TEMPE_WIDTH) + if dom_temperature_raw is not None: + dom_temperature_data = sfpd_obj.parse_temperature( + dom_temperature_raw, 0) + transceiver_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] + + dom_voltage_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_VOLT_OFFSET), QSFP_VOLT_WIDTH) + if dom_voltage_raw is not None: + dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) + transceiver_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] + + qsfp_dom_rev_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_DOM_REV_OFFSET), QSFP_DOM_REV_WIDTH) + if qsfp_dom_rev_raw is not None: + qsfp_dom_rev_data = sfpd_obj.parse_sfp_dom_rev(qsfp_dom_rev_raw, 0) + qsfp_dom_rev = qsfp_dom_rev_data['data']['dom_rev']['value'] + + # The tx_power monitoring is only available on QSFP which compliant with SFF-8636 + # and claimed that it support tx_power with one indicator bit. + dom_channel_monitor_data = {} + dom_channel_monitor_raw = None + qsfp_tx_power_support = qsfp_dom_capability_data['data']['Tx_power_support']['value'] + if (qsfp_dom_rev[0:8] != 'SFF-8636' or (qsfp_dom_rev[0:8] == 'SFF-8636' and qsfp_tx_power_support != 'on')): + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params( + dom_channel_monitor_raw, 0) + + else: + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power( + dom_channel_monitor_raw, 0) + transceiver_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TX1Power']['value'] + transceiver_dom_info_dict['tx2power'] = dom_channel_monitor_data['data']['TX2Power']['value'] + transceiver_dom_info_dict['tx3power'] = dom_channel_monitor_data['data']['TX3Power']['value'] + transceiver_dom_info_dict['tx4power'] = dom_channel_monitor_data['data']['TX4Power']['value'] + + if dom_channel_monitor_raw: + transceiver_dom_info_dict['rx1power'] = dom_channel_monitor_data['data']['RX1Power']['value'] + transceiver_dom_info_dict['rx2power'] = dom_channel_monitor_data['data']['RX2Power']['value'] + transceiver_dom_info_dict['rx3power'] = dom_channel_monitor_data['data']['RX3Power']['value'] + transceiver_dom_info_dict['rx4power'] = dom_channel_monitor_data['data']['RX4Power']['value'] + transceiver_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TX1Bias']['value'] + transceiver_dom_info_dict['tx2bias'] = dom_channel_monitor_data['data']['TX2Bias']['value'] + transceiver_dom_info_dict['tx3bias'] = dom_channel_monitor_data['data']['TX3Bias']['value'] + transceiver_dom_info_dict['tx4bias'] = dom_channel_monitor_data['data']['TX4Bias']['value'] + elif self.sfp_type == SFP_TYPE: + sfpd_obj = sff8472Dom() + if not sfpd_obj: + return None + + eeprom_ifraw = self.__read_eeprom_specific_bytes(0, SFP_DOM_OFFSET) + if eeprom_ifraw is not None: + sfpi_obj = sff8472InterfaceId(eeprom_ifraw) + cal_type = sfpi_obj.get_calibration_type() + sfpd_obj._calibration_type = cal_type + + offset = SFP_DOM_OFFSET + transceiver_dom_info_dict = dict.fromkeys(self.dom_dict_keys, 'N/A') + dom_temperature_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_TEMPE_OFFSET), SFP_TEMPE_WIDTH) + + if dom_temperature_raw is not None: + dom_temperature_data = sfpd_obj.parse_temperature( + dom_temperature_raw, 0) + transceiver_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] + + dom_voltage_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_VOLT_OFFSET), SFP_VOLT_WIDTH) + if dom_voltage_raw is not None: + dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) + transceiver_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] + + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) + if dom_channel_monitor_raw is not None: + dom_voltage_data = sfpd_obj.parse_channel_monitor_params( + dom_channel_monitor_raw, 0) + transceiver_dom_info_dict['tx1power'] = dom_voltage_data['data']['TXPower']['value'] + transceiver_dom_info_dict['rx1power'] = dom_voltage_data['data']['RXPower']['value'] + transceiver_dom_info_dict['tx1bias'] = dom_voltage_data['data']['TXBias']['value'] + else: + return None + + for key in transceiver_dom_info_dict: + transceiver_dom_info_dict[key] = self._convert_string_to_num( + transceiver_dom_info_dict[key]) + + transceiver_dom_info_dict['rx_los'] = self.get_rx_los() + transceiver_dom_info_dict['tx_fault'] = self.get_tx_fault() + transceiver_dom_info_dict['reset_status'] = self.get_reset_status() + transceiver_dom_info_dict['lp_mode'] = self.get_lpmode() + transceiver_dom_info_dict['tx_disable'] = self.get_tx_disable() + transceiver_dom_info_dict['tx_disable_channel'] = self.get_tx_disable_channel() + + return transceiver_dom_info_dict + + def get_transceiver_threshold_info(self): + """ + Retrieves transceiver threshold info of this SFP + + Returns: + A dict which contains following keys/values : + ======================================================================== + keys |Value Format |Information + ---------------------------|---------------|---------------------------- + temphighalarm |FLOAT |High Alarm Threshold value of temperature in Celsius. + templowalarm |FLOAT |Low Alarm Threshold value of temperature in Celsius. + temphighwarning |FLOAT |High Warning Threshold value of temperature in Celsius. + templowwarning |FLOAT |Low Warning Threshold value of temperature in Celsius. + vcchighalarm |FLOAT |High Alarm Threshold value of supply voltage in mV. + vcclowalarm |FLOAT |Low Alarm Threshold value of supply voltage in mV. + vcchighwarning |FLOAT |High Warning Threshold value of supply voltage in mV. + vcclowwarning |FLOAT |Low Warning Threshold value of supply voltage in mV. + rxpowerhighalarm |FLOAT |High Alarm Threshold value of received power in dBm. + rxpowerlowalarm |FLOAT |Low Alarm Threshold value of received power in dBm. + rxpowerhighwarning |FLOAT |High Warning Threshold value of received power in dBm. + rxpowerlowwarning |FLOAT |Low Warning Threshold value of received power in dBm. + txpowerhighalarm |FLOAT |High Alarm Threshold value of transmit power in dBm. + txpowerlowalarm |FLOAT |Low Alarm Threshold value of transmit power in dBm. + txpowerhighwarning |FLOAT |High Warning Threshold value of transmit power in dBm. + txpowerlowwarning |FLOAT |Low Warning Threshold value of transmit power in dBm. + txbiashighalarm |FLOAT |High Alarm Threshold value of tx Bias Current in mA. + txbiaslowalarm |FLOAT |Low Alarm Threshold value of tx Bias Current in mA. + txbiashighwarning |FLOAT |High Warning Threshold value of tx Bias Current in mA. + txbiaslowwarning |FLOAT |Low Warning Threshold value of tx Bias Current in mA. + ======================================================================== + """ + transceiver_dom_threshold_info_dict_keys = ['temphighalarm', 'temphighwarning', 'templowalarm', 'templowwarning', + 'vcchighalarm', 'vcchighwarning', 'vcclowalarm', 'vcclowwarning', + 'rxpowerhighalarm', 'rxpowerhighwarning', 'rxpowerlowalarm', 'rxpowerlowwarning', + 'txpowerhighalarm', 'txpowerhighwarning', 'txpowerlowalarm', 'txpowerlowwarning', + 'txbiashighalarm', 'txbiashighwarning', 'txbiaslowalarm', 'txbiaslowwarning'] + + if self.sfp_type == QSFP_TYPE: + sfpd_obj = sff8436Dom() + if not self.get_presence() or not sfpd_obj: + return None + DOM_OFFSET = 0 + transceiver_dom_threshold_dict = dict.fromkeys(transceiver_dom_threshold_info_dict_keys, 'N/A') + offset = DOM_OFFSET + + dom_module_threshold_raw = self.__read_eeprom_specific_bytes((offset + QSFP_MODULE_THRESHOLD_OFFSET), QSFP_MODULE_THRESHOLD_WIDTH) + if dom_module_threshold_raw is not None: + module_threshold_values = sfpd_obj.parse_module_threshold_values(dom_module_threshold_raw, 0) + module_threshold_data = module_threshold_values.get('data') + if module_threshold_data: + transceiver_dom_threshold_dict['temphighalarm'] = module_threshold_data['TempHighAlarm']['value'] + transceiver_dom_threshold_dict['templowalarm'] = module_threshold_data['TempLowAlarm']['value'] + transceiver_dom_threshold_dict['temphighwarning'] = module_threshold_data['TempHighWarning']['value'] + transceiver_dom_threshold_dict['templowwarning'] = module_threshold_data['TempLowWarning']['value'] + transceiver_dom_threshold_dict['vcchighalarm'] = module_threshold_data['VccHighAlarm']['value'] + transceiver_dom_threshold_dict['vcclowalarm'] = module_threshold_data['VccLowAlarm']['value'] + transceiver_dom_threshold_dict['vcchighwarning'] = module_threshold_data['VccHighWarning']['value'] + transceiver_dom_threshold_dict['vcclowwarning'] = module_threshold_data['VccLowWarning']['value'] + + dom_channel_thres_raw = self.__read_eeprom_specific_bytes((offset + QSFP_CHANNEL_THRESHOLD_OFFSET), QSFP_CHANNEL_THRESHOLD_WIDTH) + if dom_channel_thres_raw is not None: + channel_threshold_values = sfpd_obj.parse_channel_threshold_values(dom_channel_thres_raw, 0) + channel_threshold_data = channel_threshold_values.get('data') + else: + channel_threshold_data = None + if channel_threshold_data: + transceiver_dom_threshold_dict['rxpowerhighalarm'] = channel_threshold_data['RxPowerHighAlarm']['value'] + transceiver_dom_threshold_dict['rxpowerlowalarm'] = channel_threshold_data['RxPowerLowAlarm']['value'] + transceiver_dom_threshold_dict['rxpowerhighwarning'] = channel_threshold_data['RxPowerHighWarning']['value'] + transceiver_dom_threshold_dict['rxpowerlowwarning'] = channel_threshold_data['RxPowerLowWarning']['value'] + transceiver_dom_threshold_dict['txpowerhighalarm'] = "0.0dBm" + transceiver_dom_threshold_dict['txpowerlowalarm'] = "0.0dBm" + transceiver_dom_threshold_dict['txpowerhighwarning'] = "0.0dBm" + transceiver_dom_threshold_dict['txpowerlowwarning'] = "0.0dBm" + transceiver_dom_threshold_dict['txbiashighalarm'] = channel_threshold_data['TxBiasHighAlarm']['value'] + transceiver_dom_threshold_dict['txbiaslowalarm'] = channel_threshold_data['TxBiasLowAlarm']['value'] + transceiver_dom_threshold_dict['txbiashighwarning'] = channel_threshold_data['TxBiasHighWarning']['value'] + transceiver_dom_threshold_dict['txbiaslowwarning'] = channel_threshold_data['TxBiasLowWarning']['value'] + + for key in transceiver_dom_threshold_dict: + transceiver_dom_threshold_dict[key] = self.__convert_string_to_num(transceiver_dom_threshold_dict[key]) + + return transceiver_dom_threshold_dict + + elif self.sfp_type == SFP_TYPE: + sfpd_obj = sff8472Dom() + + if not self.get_presence() and not sfpd_obj: + return None + DOM_OFFSET = 256 + eeprom_ifraw = self.__read_eeprom_specific_bytes(0, DOM_OFFSET) + if eeprom_ifraw is not None: + sfpi_obj = sff8472InterfaceId(eeprom_ifraw) + cal_type = sfpi_obj.get_calibration_type() + sfpd_obj._calibration_type = cal_type + + offset = DOM_OFFSET + transceiver_dom_threshold_info_dict = dict.fromkeys(transceiver_dom_threshold_info_dict_keys, 'N/A') + dom_module_threshold_raw = self.__read_eeprom_specific_bytes((offset + SFP_MODULE_THRESHOLD_OFFSET), SFP_MODULE_THRESHOLD_WIDTH) + if dom_module_threshold_raw is not None: + dom_module_threshold_data = sfpd_obj.parse_alarm_warning_threshold(dom_module_threshold_raw, 0) + + transceiver_dom_threshold_info_dict['temphighalarm'] = dom_module_threshold_data['data']['TempHighAlarm']['value'] + transceiver_dom_threshold_info_dict['templowalarm'] = dom_module_threshold_data['data']['TempLowAlarm']['value'] + transceiver_dom_threshold_info_dict['temphighwarning'] = dom_module_threshold_data['data']['TempHighWarning']['value'] + transceiver_dom_threshold_info_dict['templowwarning'] = dom_module_threshold_data['data']['TempLowWarning']['value'] + + transceiver_dom_threshold_info_dict['vcchighalarm'] = dom_module_threshold_data['data']['VoltageHighAlarm']['value'] + transceiver_dom_threshold_info_dict['vcclowalarm'] = dom_module_threshold_data['data']['VoltageLowAlarm']['value'] + transceiver_dom_threshold_info_dict['vcchighwarning'] = dom_module_threshold_data['data']['VoltageHighWarning']['value'] + transceiver_dom_threshold_info_dict['vcclowwarning'] = dom_module_threshold_data['data']['VoltageLowWarning']['value'] + + transceiver_dom_threshold_info_dict['txbiashighalarm'] = dom_module_threshold_data['data']['BiasHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiaslowalarm'] = dom_module_threshold_data['data']['BiasLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiashighwarning'] = dom_module_threshold_data['data']['BiasHighWarning']['value'] + transceiver_dom_threshold_info_dict['txbiaslowwarning'] = dom_module_threshold_data['data']['BiasLowWarning']['value'] + + transceiver_dom_threshold_info_dict['txpowerhighalarm'] = dom_module_threshold_data['data']['TXPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerlowalarm'] = dom_module_threshold_data['data']['TXPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerhighwarning'] = dom_module_threshold_data['data']['TXPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerlowwarning'] = dom_module_threshold_data['data']['TXPowerLowWarning']['value'] + + transceiver_dom_threshold_info_dict['rxpowerhighalarm'] = dom_module_threshold_data['data']['RXPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowalarm'] = dom_module_threshold_data['data']['RXPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerhighwarning'] = dom_module_threshold_data['data']['RXPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_module_threshold_data['data']['RXPowerLowWarning']['value'] + + for key in transceiver_dom_threshold_info_dict: + transceiver_dom_threshold_info_dict[key] = self.__convert_string_to_num(transceiver_dom_threshold_info_dict[key]) + + return transceiver_dom_threshold_info_dict + + else: + return None + + def get_reset_status(self): + """ + Retrieves the reset status of SFP + Returns: + A Boolean, True if reset enabled, False if disabled + """ + # Check for invalid port_num + if self.port_num < self.PORT_START or self.port_num > self.PORT_END or self.sfp_type == SFP_TYPE: + return False + + sfp_info = self.port_to_i2c_mapping[int(self._port_cfgs[self.port_num].lanes.split(',')[0])] + cmd = 'i2cget -y 0 {0} {1}'.format(sfp_info[4], sfp_info[5]) + reset_status = int(Popen(cmd, stdout=PIPE, stderr=STDOUT, shell=True).stdout.readline(), 16) + reset_status &= (1 << sfp_info[6]) + + return (reset_status == 1) + + def get_rx_los(self): + """ + Retrieves the RX LOS (lost-of-signal) status of SFP + Returns: + A Boolean, True if SFP has RX LOS, False if not. + Note : RX LOS status is latched until a call to get_rx_los or a reset. + """ + if not self.dom_supported: + return None + + rx_los_list = [] + + if self.sfp_type == QSFP_TYPE: + offset = 0 + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_RX_LOS_STATUS_OFFSET), QSFP_CHANNL_RX_LOS_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + rx_los_data = int(dom_channel_monitor_raw[0], 16) + rx_los_list.append(rx_los_data & 0x01 != 0) + rx_los_list.append(rx_los_data & 0x02 != 0) + rx_los_list.append(rx_los_data & 0x04 != 0) + rx_los_list.append(rx_los_data & 0x08 != 0) + elif self.sfp_type == SFP_TYPE: + offset = 256 + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_STATUS_CONTROL_OFFSET), SFP_STATUS_CONTROL_WIDTH) + if dom_channel_monitor_raw is not None: + rx_los_data = int(dom_channel_monitor_raw[0], 16) + rx_los_list.append(rx_los_data & 0x02 != 0) + else: + return None + else: + return None + + return rx_los_list + + def get_tx_fault(self): + """ + Retrieves the TX fault status of SFP + Returns: + A Boolean, True if SFP has TX fault, False if not + Note : TX fault status is lached until a call to get_tx_fault or a reset. + """ + if not self.dom_supported: + return None + + tx_fault_list = [] + + if self.sfp_type == QSFP_TYPE: + offset = 0 + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_TX_FAULT_STATUS_OFFSET), QSFP_CHANNL_TX_FAULT_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + tx_fault_data = int(dom_channel_monitor_raw[0], 16) + tx_fault_list.append(tx_fault_data & 0x01 != 0) + tx_fault_list.append(tx_fault_data & 0x02 != 0) + tx_fault_list.append(tx_fault_data & 0x04 != 0) + tx_fault_list.append(tx_fault_data & 0x08 != 0) + elif self.sfp_type == SFP_TYPE: + offset = 256 + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_STATUS_CONTROL_OFFSET), SFP_STATUS_CONTROL_WIDTH) + if dom_channel_monitor_raw is not None: + tx_fault_data = int(dom_channel_monitor_raw[0], 16) + tx_fault_list.append(tx_fault_data & 0x04 != 0) + else: + return None + else: + return None + + return tx_fault_list + + def get_tx_disable(self): + """ + Retrieves the tx_disable status of this SFP + Returns: + A Boolean, True if tx_disable is enabled, False if disabled + """ + if not self.dom_supported: + return None + + tx_disable_list = [] + + if self.sfp_type == QSFP_TYPE: + offset = 0 + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_DISABLE_STATUS_OFFSET), QSFP_CHANNL_DISABLE_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + tx_disable_data = int(dom_channel_monitor_raw[0], 16) + tx_disable_list.append(tx_disable_data & 0x01 != 0) + tx_disable_list.append(tx_disable_data & 0x02 != 0) + tx_disable_list.append(tx_disable_data & 0x04 != 0) + tx_disable_list.append(tx_disable_data & 0x08 != 0) + elif self.sfp_type == SFP_TYPE: + offset = 256 + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_STATUS_CONTROL_OFFSET), SFP_STATUS_CONTROL_WIDTH) + if dom_channel_monitor_raw is not None: + tx_disable_data = int(dom_channel_monitor_raw[0], 16) + tx_disable_list.append(tx_disable_data & 0xC0 != 0) + else: + return None + else: + return None + + return tx_disable_list + + def get_tx_disable_channel(self): + """ + Retrieves the TX disabled channels in this SFP + Returns: + A hex of 4 bits (bit 0 to bit 3 as channel 0 to channel 3) to represent + TX channels which have been disabled in this SFP. + As an example, a returned value of 0x5 indicates that channel 0 + and channel 2 have been disabled. + """ + # SFP doesn't support this feature + if self.sfp_type == SFP_TYPE: + return 0 + elif self.sfp_type == QSFP_TYPE: + tx_disable_list = self.get_tx_disable() + if tx_disable_list is None: + return 0 + tx_disabled = 0 + for i in range(len(tx_disable_list)): + if tx_disable_list[i]: + tx_disabled |= 1 << i + else: + return None + + return tx_disabled + + def get_lpmode(self): + """ + Retrieves the lpmode (low power mode) status of this QSFP module + Returns: + A Boolean, True if lpmode is enabled, False if disabled + """ + return False + + def get_power_override(self): + """ + Retrieves the power-override status of this SFP + Returns: + A Boolean, True if power-override is enabled, False if disabled + """ + # SFP doesn't support this feature + if self.sfp_type == SFP_TYPE: + return False + elif self.sfp_type == QSFP_TYPE: + offset = 0 + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return False + + dom_control_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_POWEROVERRIDE_OFFSET), QSFP_POWEROVERRIDE_WIDTH) + if dom_control_raw is not None: + if int(dom_control_raw[0],16) & (0x01 << QSFP_POWEROVERRIDE_BIT): + return True + else: + return False + else: + return None + + def get_temperature(self): + """ + Retrieves the temperature of this SFP + Returns: + An integer number of current temperature in Celsius + """ + if not self.dom_supported: + return None + if self.sfp_type == QSFP_TYPE: + offset = 0 + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + if self.dom_temp_supported: + dom_temperature_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_TEMPE_OFFSET), QSFP_TEMPE_WIDTH) + if dom_temperature_raw is not None: + dom_temperature_data = sfpd_obj.parse_temperature(dom_temperature_raw, 0) + temp = self._convert_string_to_num( + dom_temperature_data['data']['Temperature']['value']) + return temp + else: + return None + elif self.sfp_type == SFP_TYPE: + offset = 256 + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return None + sfpd_obj._calibration_type = 1 + + dom_temperature_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_TEMPE_OFFSET), SFP_TEMPE_WIDTH) + if dom_temperature_raw is not None: + dom_temperature_data = sfpd_obj.parse_temperature(dom_temperature_raw, 0) + temp = self._convert_string_to_num( + dom_temperature_data['data']['Temperature']['value']) + return temp + else: + return None + else: + return None + + def get_voltage(self): + """ + Retrieves the supply voltage of this SFP + Returns: + An integer number of supply voltage in mV + """ + if not self.dom_supported: + return None + if self.sfp_type == QSFP_TYPE: + offset = 0 + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + if self.dom_volt_supported: + dom_voltage_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_VOLT_OFFSET), QSFP_VOLT_WIDTH) + if dom_voltage_raw is not None: + dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) + voltage = self._convert_string_to_num( + dom_voltage_data['data']['Vcc']['value']) + return voltage + else: + return None + elif self.sfp_type == SFP_TYPE: + offset = 256 + + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return None + + sfpd_obj._calibration_type = self.calibration + + dom_voltage_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_VOLT_OFFSET), SFP_VOLT_WIDTH) + if dom_voltage_raw is not None: + dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) + voltage = self._convert_string_to_num( + dom_voltage_data['data']['Vcc']['value']) + return voltage + else: + return None + else: + return None + + def get_tx_bias(self): + """ + Retrieves the TX bias current of this SFP + Returns: + A list of four integer numbers, representing TX bias in mA + for channel 0 to channel 4. + Ex. ['110.09', '111.12', '108.21', '112.09'] + """ + tx_bias_list = [] + if self.sfp_type == QSFP_TYPE: + offset = 0 + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = \ + sfpd_obj.parse_channel_monitor_params_with_tx_power(dom_channel_monitor_raw, 0) + tx_bias_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX1Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX2Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX3Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX4Bias']['value'])) + elif self.sfp_type == SFP_TYPE: + offset = 256 + + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return None + sfpd_obj._calibration_type = self.calibration + + if self.dom_supported: + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params( \ + dom_channel_monitor_raw, 0) + tx_bias_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TXBias']['value'])) + else: + return None + else: + return None + else: + return None + + return tx_bias_list + + def get_rx_power(self): + """ + Retrieves the received optical power for this SFP + Returns: + A list of four integer numbers, representing received optical + power in mW for channel 0 to channel 4. + Ex. ['1.77', '1.71', '1.68', '1.70'] + """ + rx_power_list = [] + + if self.sfp_type == QSFP_TYPE: + offset = 0 + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + if self.dom_rx_power_supported: + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = \ + sfpd_obj.parse_channel_monitor_params_with_tx_power(dom_channel_monitor_raw, 0) + rx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['RX1Power']['value'])) + rx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['RX2Power']['value'])) + rx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['RX3Power']['value'])) + rx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['RX4Power']['value'])) + else: + return None + else: + return None + elif self.sfp_type == SFP_TYPE: + offset = 256 + + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return None + + if self.dom_supported: + sfpd_obj._calibration_type = self.calibration + + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = \ + sfpd_obj.parse_channel_monitor_params(dom_channel_monitor_raw, 0) + rx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['RXPower']['value'])) + else: + return None + else: + return None + else: + return None + + return rx_power_list + + def get_tx_power(self): + """ + Retrieves the TX power of this SFP + Returns: + A list of four integer numbers, representing TX power in mW + for channel 0 to channel 4. + Ex. ['1.86', '1.86', '1.86', '1.86'] + """ + tx_power_list = [] + + if self.sfp_type == QSFP_TYPE: + offset = 0 + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + if self.dom_tx_power_supported: + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = \ + sfpd_obj.parse_channel_monitor_params_with_tx_power(dom_channel_monitor_raw, 0) + tx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX1Power']['value'])) + tx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX2Power']['value'])) + tx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX3Power']['value'])) + tx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX4Power']['value'])) + else: + return None + else: + return None + elif self.sfp_type == SFP_TYPE: + offset = 256 + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return None + + if self.dom_supported: + sfpd_obj._calibration_type = self.calibration + + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = \ + sfpd_obj.parse_channel_monitor_params(dom_channel_monitor_raw, 0) + tx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TXPower']['value'])) + else: + return None + else: + return None + else: + return None + + return tx_power_list + + def reset(self): + """ + Reset SFP and return all user module settings to their default state. + Returns: + A boolean, True if successful, False if not + """ + if not self.get_presence(): + return False + + # SFP doesn't support this feature + if self.sfp_type == SFP_TYPE: + return False + elif self.sfp_type == QSFP_TYPE: + sfp_info = self.port_to_i2c_mapping[int(self._port_cfgs[self.port_num].lanes.split(',')[0])] + cmd = 'i2cget -y 0 {0} {1}'.format(sfp_info[4], sfp_info[5]) + reset = int(Popen(cmd, stdout=PIPE, stderr=STDOUT, shell=True).stdout.readline(), 16) + + reset &= ~(1 << sfp_info[6]) + cmd = 'i2cset -y 0 {0} {1} {2}'.format(sfp_info[4], sfp_info[5], reset) + Popen(cmd, shell=True) + + reset |= (1 << sfp_info[6]) + cmd = 'i2cset -y 0 {0} {1} {2}'.format(sfp_info[4], sfp_info[5], reset) + Popen(cmd, shell=True) + + return True + + def tx_disable(self, tx_disable): + """ + Disable SFP TX for all channels + Args: + tx_disable : A Boolean, True to enable tx_disable mode, False to disable + tx_disable mode. + Returns: + A boolean, True if tx_disable is set successfully, False if not + """ + if not self.get_presence(): + return False + + if self.sfp_type == SFP_TYPE: + if self.dom_tx_disable_supported: + offset = 256 + sysfs_sfp_i2c_client_eeprom_path = self.port_to_eeprom_mapping[self.port_num] + status_control_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_STATUS_CONTROL_OFFSET), SFP_STATUS_CONTROL_WIDTH) + if status_control_raw is not None: + # Set bit 6 for Soft TX Disable Select + # 01000000 = 64 and 10111111 = 191 + tx_disable_bit = 64 if tx_disable else 191 + status_control = int(status_control_raw[0], 16) + tx_disable_ctl = (status_control | tx_disable_bit) if tx_disable else ( + status_control & tx_disable_bit) + try: + sysfsfile_eeprom = open( + sysfs_sfp_i2c_client_eeprom_path, mode="r+b", buffering=0) + buffer = create_string_buffer(1) + buffer[0] = chr(tx_disable_ctl) + # Write to eeprom + sysfsfile_eeprom.seek(offset + SFP_STATUS_CONTROL_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + finally: + if sysfsfile_eeprom: + sysfsfile_eeprom.close() + time.sleep(0.01) + return True + return False + else: + return False + elif self.sfp_type == QSFP_TYPE: + if self.dom_tx_disable_supported: + channel_mask = 0x0f + if tx_disable: + return self.tx_disable_channel(channel_mask, True) + else: + return self.tx_disable_channel(channel_mask, False) + else: + return False + else: + return None + + def tx_disable_channel(self, channel, disable): + """ + Sets the tx_disable for specified SFP channels + Args: + channel : A hex of 4 bits (bit 0 to bit 3) which represent channel 0 to 3, + e.g. 0x5 for channel 0 and channel 2. + disable : A boolean, True to disable TX channels specified in channel, + False to enable + Returns: + A boolean, True if successful, False if not + """ + if not self.get_presence(): + return False + # SFP doesn't support this feature + if self.sfp_type == SFP_TYPE: + return False + elif self.sfp_type == QSFP_TYPE: + if self.dom_tx_disable_supported: + sysfsfile_eeprom = None + try: + channel_state = self.get_tx_disable_channel() + if disable: + tx_disable_ctl = channel_state | channel + else: + tx_disable_ctl = channel_state & (~channel) + buffer = create_string_buffer(1) + buffer[0] = chr(tx_disable_ctl) + # Write to eeprom + sysfsfile_eeprom = open( + self.port_to_eeprom_mapping[self.port_num], "r+b") + sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + return True + else: + return False + else: + return None + + def set_lpmode(self, lpmode): + """ + Sets the lpmode (low power mode) of SFP + Args: + lpmode: A Boolean, True to enable lpmode, False to disable it + Note : lpmode can be overridden by set_power_override + Returns: + A boolean, True if lpmode is set successfully, False if not + """ + return False + + def set_power_override(self, power_override, power_set): + """ + Sets SFP power level using power_override and power_set + Args: + power_override : + A Boolean, True to override set_lpmode and use power_set + to control SFP power, False to disable SFP power control + through power_override/power_set and use set_lpmode + to control SFP power. + power_set : + Only valid when power_override is True. + A Boolean, True to set SFP to low power mode, False to set + SFP to high power mode. + Returns: + A boolean, True if power-override and power_set are set successfully, + False if not + """ + # SFP doesn't support this feature + if not self.get_presence(): + return False + + if self.sfp_type == SFP_TYPE: + return False + elif self.sfp_type == QSFP_TYPE: + try: + power_override_bit = 0 + if power_override: + power_override_bit |= 1 << 0 + + power_set_bit = 0 + if power_set: + power_set_bit |= 1 << 1 + + buffer = create_string_buffer(1) + buffer[0] = chr(power_override_bit | power_set_bit) + # Write to eeprom + sysfsfile_eeprom = open(self.port_to_eeprom_mapping[self.port_num], "r+b") + sysfsfile_eeprom.seek(QSFP_POWEROVERRIDE_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + else: + return None + + return True + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + return "Ethernet{}".format(self.port_num) + diff --git a/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/thermal.py b/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/thermal.py new file mode 100644 index 000000000000..ca4e35969269 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48x8c/sonic_platform/thermal.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python + +############################################################################# +# Celestica +# +# Thermal contains an implementation of SONiC Platform Base API and +# provides the thermal device status which are available in the platform +# +############################################################################# + +import os +import os.path + +try: + from sonic_platform_base.thermal_base import ThermalBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Thermal(ThermalBase): + """Platform-specific Thermal class""" + + THERMAL_NAME_LIST = [] + CPUBOARD_SS_PATH = "/sys/class/hwmon/hwmon1" + + def __init__(self, thermal_index): + self.index = thermal_index + self.high_threshold = float(112) + + # Add thermal name + self.THERMAL_NAME_LIST.append("ASIC") + + # Set hwmon path + self.ss_index, self.hwmon_path = 1, self.CPUBOARD_SS_PATH + self.ss_key = self.THERMAL_NAME_LIST[self.index - 1] + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + data = fd.read() + return data.strip() + except IOError: + raise IOError("Unable to open %s file !" % file_path) + + def __get_temp(self, temp_file): + temp_file_path = os.path.join(self.hwmon_path, temp_file) + raw_temp = self.__read_txt_file(temp_file_path) + temp = float(raw_temp)/1000 + return float("{:.3f}".format(temp)) + + def __set_threshold(self, file_name, temperature): + temp_file_path = os.path.join(self.hwmon_path, file_name) + try: + with open(temp_file_path, 'w') as fd: + fd.write(str(temperature)) + return True + except IOError: + return False + + def get_temperature(self): + """ + Retrieves current temperature reading from thermal + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + temp_file = "temp{}_input".format(self.ss_index) + return self.__get_temp(temp_file) + + def get_high_threshold(self): + """ + Retrieves the high threshold temperature of thermal + Returns: + A float number, the high threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + return self.high_threshold + + def set_high_threshold(self, temperature): + """ + Sets the high threshold temperature of thermal + Args : + temperature: A float number up to nearest thousandth of one degree Celsius, + e.g. 30.125 + Returns: + A boolean, True if threshold is set successfully, False if not + """ + self.high_threshold = float(temperature) + return True + + def get_name(self): + """ + Retrieves the name of the thermal device + Returns: + string: The name of the thermal device + """ + return self.THERMAL_NAME_LIST[self.index] + + def get_presence(self): + """ + Retrieves the presence of the PSU + Returns: + bool: True if PSU is present, False if not + """ + temp_file = "temp{}_input".format(self.ss_index) + temp_file_path = os.path.join(self.hwmon_path, temp_file) + return os.path.isfile(temp_file_path) + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + if not self.get_presence(): + return False + + return True diff --git a/platform/centec/sonic-platform-modules-v682/48y8c-d/modules/Makefile b/platform/centec/sonic-platform-modules-v682/48y8c-d/modules/Makefile new file mode 100644 index 000000000000..0fa3cfba90b3 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c-d/modules/Makefile @@ -0,0 +1 @@ +obj-m := centec_v682_48y8c_d_platform.o diff --git a/platform/centec/sonic-platform-modules-v682/48y8c-d/modules/centec_v682_48y8c_d_platform.c b/platform/centec/sonic-platform-modules-v682/48y8c-d/modules/centec_v682_48y8c_d_platform.c new file mode 100644 index 000000000000..f909e8ac9d32 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c-d/modules/centec_v682_48y8c_d_platform.c @@ -0,0 +1,404 @@ +#include +#include +#include +#include +#include +#include + +#define SEP(XXX) 1 +#define IS_INVALID_PTR(_PTR_) ((_PTR_ == NULL) || IS_ERR(_PTR_)) +#define IS_VALID_PTR(_PTR_) (!IS_INVALID_PTR(_PTR_)) + +#if SEP("defines") +#define SFP_NUM 48 +#define QSFP_NUM 8 +#define PORT_NUM (SFP_NUM + QSFP_NUM) +#endif + +#if SEP("drivers:leds") +extern void v682_48y8c_d_led_port_set(struct led_classdev *led_cdev, enum led_brightness set_value); +extern enum led_brightness v682_48y8c_d_led_port_get(struct led_classdev *led_cdev); + +static struct led_classdev led_dev_port[PORT_NUM] = { +{ .name = "port0", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port1", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port2", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port3", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port4", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port5", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port6", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port7", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port8", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port9", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port10", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port11", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port12", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port13", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port14", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port15", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port16", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port17", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port18", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port19", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port20", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port21", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port22", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port23", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port24", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port25", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port26", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port27", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port28", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port29", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port30", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port31", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port32", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port33", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port34", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port35", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port36", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port37", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port38", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port39", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port40", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port41", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port42", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port43", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port44", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port45", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port46", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port47", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port48", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port49", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port50", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port51", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port52", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port53", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port54", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +{ .name = "port55", .brightness_set = v682_48y8c_d_led_port_set, .brightness_get = v682_48y8c_d_led_port_get,}, +}; +static unsigned char port_led_mode[PORT_NUM] = {0}; + +void v682_48y8c_d_led_port_set(struct led_classdev *led_cdev, enum led_brightness set_value) +{ + int portNum = 0; + + sscanf(led_cdev->name, "port%d", &portNum); + + port_led_mode[portNum] = set_value; + + return; +} + +enum led_brightness v682_48y8c_d_led_port_get(struct led_classdev *led_cdev) +{ + int portNum = 0; + + sscanf(led_cdev->name, "port%d", &portNum); + + return port_led_mode[portNum]; +} + +static int v682_48y8c_d_init_led(void) +{ + int ret = 0; + int i = 0; + + for (i = 0; i < PORT_NUM; i++) + { + ret = led_classdev_register(NULL, &(led_dev_port[i])); + if (ret != 0) + { + printk(KERN_CRIT "create v682_48y8c_d led_dev_port%d device failed\n", i); + continue; + } + } + + return ret; +} + +static int v682_48y8c_d_exit_led(void) +{ + int i = 0; + + for (i = 0; i < PORT_NUM; i++) + { + led_classdev_unregister(&(led_dev_port[i])); + } + + return 0; +} +#endif + +#if SEP("drivers:sfp") +#define MAX_SFP_EEPROM_DATA_LEN 256 +#define MAX_SFP_EEPROM_NUM 3 +struct sfp_info_t { + char eeprom[MAX_SFP_EEPROM_NUM][MAX_SFP_EEPROM_DATA_LEN + 1]; + unsigned short data_len[MAX_SFP_EEPROM_NUM]; + int presence; + int enable; + spinlock_t lock; +}; +static struct class *sfp_class = NULL; +static struct device *sfp_dev[SFP_NUM+QSFP_NUM + 1] = {NULL}; +static struct sfp_info_t sfp_info[SFP_NUM+QSFP_NUM + 1]; + +static ssize_t v682_48y8c_d_sfp_read_presence(struct device *dev, struct device_attribute *attr, char *buf) +{ + int portNum = 0; + const char *name = dev_name(dev); + unsigned long flags = 0; + int presence = 0; + + sscanf(name, "sfp%d", &portNum); + + if ((portNum < 0) || (portNum >= SFP_NUM + QSFP_NUM)) + { + printk(KERN_CRIT "sfp read presence, invalid port number!\n"); + buf[0] = '\0'; + return 0; + } + + spin_lock_irqsave(&(sfp_info[portNum].lock), flags); + presence = sfp_info[portNum].presence; + spin_unlock_irqrestore(&(sfp_info[portNum].lock), flags); + return sprintf(buf, "%d\n", presence); +} + +static ssize_t v682_48y8c_d_sfp_write_presence(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) +{ + int portNum = 0; + const char *name = dev_name(dev); + unsigned long flags = 0; + int presence = simple_strtol(buf, NULL, 10); + + sscanf(name, "sfp%d", &portNum); + + if ((portNum < 0) || (portNum >= SFP_NUM + QSFP_NUM)) + { + printk(KERN_CRIT "sfp read presence, invalid port number!\n"); + return size; + } + + spin_lock_irqsave(&(sfp_info[portNum].lock), flags); + sfp_info[portNum].presence = presence; + spin_unlock_irqrestore(&(sfp_info[portNum].lock), flags); + + return size; +} + +static ssize_t v682_48y8c_d_sfp_read_enable(struct device *dev, struct device_attribute *attr, char *buf) +{ + int portNum = 0; + const char *name = dev_name(dev); + unsigned long flags = 0; + int enable = 0; + + sscanf(name, "sfp%d", &portNum); + + if ((portNum < 0) || (portNum >= SFP_NUM + QSFP_NUM)) + { + printk(KERN_CRIT "sfp read enable, invalid port number!\n"); + buf[0] = '\0'; + return 0; + } + + spin_lock_irqsave(&(sfp_info[portNum].lock), flags); + enable = sfp_info[portNum].enable; + spin_unlock_irqrestore(&(sfp_info[portNum].lock), flags); + return sprintf(buf, "%d\n", enable); +} + +static ssize_t v682_48y8c_d_sfp_write_enable(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) +{ + int portNum = 0; + const char *name = dev_name(dev); + unsigned long flags = 0; + int enable = simple_strtol(buf, NULL, 10); + + sscanf(name, "sfp%d", &portNum); + + if ((portNum < 0) || (portNum >= SFP_NUM + QSFP_NUM)) + { + printk(KERN_CRIT "sfp read enable, invalid port number!\n"); + return size; + } + + spin_lock_irqsave(&(sfp_info[portNum].lock), flags); + sfp_info[portNum].enable = enable; + spin_unlock_irqrestore(&(sfp_info[portNum].lock), flags); + + return size; +} + +static ssize_t v682_48y8c_d_sfp_read_eeprom(struct device *dev, struct device_attribute *attr, char *buf) +{ + int portNum = 0; + const char *name = dev_name(dev); + unsigned long flags = 0; + size_t size = 0; + + sscanf(name, "sfp%d", &portNum); + + if ((portNum < 0) || (portNum >= SFP_NUM + QSFP_NUM)) + { + printk(KERN_CRIT "sfp read eeprom, invalid port number!\n"); + buf[0] = '\0'; + return 0; + } + + spin_lock_irqsave(&(sfp_info[portNum].lock), flags); + memcpy(buf, sfp_info[portNum].eeprom[0], sfp_info[portNum].data_len[0]); + size = sfp_info[portNum].data_len[0]; + spin_unlock_irqrestore(&(sfp_info[portNum].lock), flags); + + return size; +} + +static ssize_t v682_48y8c_d_sfp_write_eeprom(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) +{ + int portNum = 0; + const char *name = dev_name(dev); + unsigned long flags = 0; + + sscanf(name, "sfp%d", &portNum); + + if ((portNum < 0) || (portNum >= SFP_NUM + QSFP_NUM)) + { + printk(KERN_CRIT "sfp write eeprom, invalid port number!\n"); + return size; + } + + spin_lock_irqsave(&(sfp_info[portNum].lock), flags); + memcpy(sfp_info[portNum].eeprom[0], buf, size); + sfp_info[portNum].data_len[0] = size; + spin_unlock_irqrestore(&(sfp_info[portNum].lock), flags); + + return size; +} + +static DEVICE_ATTR(sfp_presence, S_IRUGO|S_IWUSR, v682_48y8c_d_sfp_read_presence, v682_48y8c_d_sfp_write_presence); +static DEVICE_ATTR(sfp_enable, S_IRUGO|S_IWUSR, v682_48y8c_d_sfp_read_enable, v682_48y8c_d_sfp_write_enable); +static DEVICE_ATTR(sfp_eeprom, S_IRUGO|S_IWUSR, v682_48y8c_d_sfp_read_eeprom, v682_48y8c_d_sfp_write_eeprom); + +static int v682_48y8c_d_init_sfp(void) +{ + int ret = 0; + int i = 0; + + sfp_class = class_create(THIS_MODULE, "sfp"); + if (IS_INVALID_PTR(sfp_class)) + { + sfp_class = NULL; + printk(KERN_CRIT "create v682_48y8c_d class sfp failed\n"); + return -1; + } + + for (i = 0; i < SFP_NUM + QSFP_NUM; i++) + { + memset(&(sfp_info[i].eeprom), 0, sizeof(sfp_info[i].eeprom)); + memset(&(sfp_info[i].data_len), 0, sizeof(sfp_info[i].data_len)); + spin_lock_init(&(sfp_info[i].lock)); + + sfp_dev[i] = device_create(sfp_class, NULL, MKDEV(223, i), NULL, "sfp%d", i); + if (IS_INVALID_PTR(sfp_dev[i])) + { + sfp_dev[i] = NULL; + printk(KERN_CRIT "create v682_48y8c_d sfp[%d] device failed\n", i); + continue; + } + + ret = device_create_file(sfp_dev[i], &dev_attr_sfp_presence); + if (ret != 0) + { + printk(KERN_CRIT "create v682_48y8c_d sfp[%d] device attr:presence failed\n", i); + continue; + } + + ret = device_create_file(sfp_dev[i], &dev_attr_sfp_enable); + if (ret != 0) + { + printk(KERN_CRIT "create v682_48y8c_d sfp[%d] device attr:enable failed\n", i); + continue; + } + + ret = device_create_file(sfp_dev[i], &dev_attr_sfp_eeprom); + if (ret != 0) + { + printk(KERN_CRIT "create v682_48y8c_d sfp[%d] device attr:eeprom failed\n", i); + continue; + } + } + + return ret; +} + +static int v682_48y8c_d_exit_sfp(void) +{ + int i = 0; + + for (i = 0; i < SFP_NUM + QSFP_NUM; i++) + { + if (IS_VALID_PTR(sfp_dev[i])) + { + device_remove_file(sfp_dev[i], &dev_attr_sfp_presence); + device_remove_file(sfp_dev[i], &dev_attr_sfp_enable); + device_remove_file(sfp_dev[i], &dev_attr_sfp_eeprom); + device_destroy(sfp_class, MKDEV(223, i)); + sfp_dev[i] = NULL; + } + } + + if (IS_VALID_PTR(sfp_class)) + { + class_destroy(sfp_class); + sfp_class = NULL; + } + + return 0; +} +#endif + +static int v682_48y8c_d_init(void) +{ + int ret = 0; + int failed = 0; + + printk(KERN_ALERT "init v682_48y8c_d board dirver...\n"); + + ret = v682_48y8c_d_init_led(); + if (ret != 0) + { + failed = 1; + } + + ret = v682_48y8c_d_init_sfp(); + if (ret != 0) + { + failed = 1; + } + + if (failed) + printk(KERN_INFO "init v682_48y8c_d board driver failed\n"); + else + printk(KERN_ALERT "init v682_48y8c_d board dirver...ok\n"); + + return 0; +} + +static void v682_48y8c_d_exit(void) +{ + printk(KERN_INFO "deinit v682_48y8c_d board dirver...\n"); + + v682_48y8c_d_exit_sfp(); + v682_48y8c_d_exit_led(); + + printk(KERN_INFO "deinit v682_48y8c_d board dirver...ok\n"); +} + +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_AUTHOR("shil centecNetworks, Inc"); +MODULE_DESCRIPTION("v682-48y8c-d board driver"); +module_init(v682_48y8c_d_init); +module_exit(v682_48y8c_d_exit); diff --git a/platform/centec/sonic-platform-modules-v682/48y8c-d/service/48y8c_d_platform.service b/platform/centec/sonic-platform-modules-v682/48y8c-d/service/48y8c_d_platform.service new file mode 100644 index 000000000000..44098afdd711 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c-d/service/48y8c_d_platform.service @@ -0,0 +1,13 @@ +[Unit] +Description=Centec modules init +After=local-fs.target +Before=syncd.service + +[Service] +Type=oneshot +ExecStart=-/etc/init.d/platform-modules-v682-48y8c-d start +ExecStop=-/etc/init.d/platform-modules-v682-48y8c-d stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/centec/sonic-platform-modules-v682/48y8c-d/service/release.py b/platform/centec/sonic-platform-modules-v682/48y8c-d/service/release.py new file mode 100644 index 000000000000..a5174b02daa4 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c-d/service/release.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python + +import os +import sys +import time + +susi4_lib = '/usr/local/lib/python3.9/dist-packages/' +if not susi4_lib in os.environ.setdefault('LD_LIBRARY_PATH', ''): + os.environ['LD_LIBRARY_PATH'] += (':' + susi4_lib) + try: + os.execv(sys.argv[0], sys.argv) + except Exception as e: + sys.exit('failed to execute under modified environment!') + +from _Susi4 import * + +def release_board(): + SusiLibInitialize() + + SusiI2CWriteTransfer(0, 0x36 * 2, 0x0e, '\x00') + SusiI2CWriteTransfer(0, 0x36 * 2, 0x0f, '\x00') + SusiI2CWriteTransfer(0, 0x36 * 2, 0x10, '\x00') + SusiI2CWriteTransfer(0, 0x37 * 2, 0x0e, '\x00') + SusiI2CWriteTransfer(0, 0x37 * 2, 0x0f, '\x00') + SusiI2CWriteTransfer(0, 0x37 * 2, 0x10, '\x00') + + SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x04') + SusiI2CWriteTransfer(0, 0x2c * 2, 0x32, '\x7f') + SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x00') + + SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x04') + SusiI2CWriteTransfer(0, 0x2c * 2, 0x33, '\x7f') + SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x00') + + SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x04') + SusiI2CWriteTransfer(0, 0x2c * 2, 0x34, '\x7f') + SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x00') + + SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x04') + SusiI2CWriteTransfer(0, 0x2c * 2, 0x35, '\x7f') + SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x00') + + SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x08') + SusiI2CWriteTransfer(0, 0x2c * 2, 0x32, '\x7f') + SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x00') + + SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x08') + SusiI2CWriteTransfer(0, 0x2c * 2, 0x33, '\x7f') + SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x00') + + SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x08') + SusiI2CWriteTransfer(0, 0x2c * 2, 0x34, '\x7f') + SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x00') + + SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x08') + SusiI2CWriteTransfer(0, 0x2c * 2, 0x35, '\x7f') + SusiI2CWriteTransfer(0, 0x71 * 2, 0x00, '\x00') + + SusiI2CWriteTransfer(0, 0x37 * 2, 0x4, '\x00') + time.sleep(1) + SusiI2CWriteTransfer(0, 0x37 * 2, 0x4, '\x01') + time.sleep(3) + os.system('echo 1 > /sys/bus/pci/devices/0000\:00\:1c.0/remove') + time.sleep(1) + os.system('echo 1 > /sys/bus/pci/rescan') + + SusiLibUninitialize() + +if __name__ == '__main__': + release_board() diff --git a/platform/centec/sonic-platform-modules-v682/48y8c-d/setup.py b/platform/centec/sonic-platform-modules-v682/48y8c-d/setup.py new file mode 100644 index 000000000000..e9260dedc6d4 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c-d/setup.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +import os +from setuptools import setup +os.listdir + +setup( + name='sonic_platform', + version='1.0', + description='Module to initialize centec v682-48y8c-d platforms', + + packages=['sonic_platform'], + package_dir={'sonic_platform': 'sonic_platform'}, +) + diff --git a/platform/centec/sonic-platform-modules-v682/48y8c-d/sonic_platform/__init__.py b/platform/centec/sonic-platform-modules-v682/48y8c-d/sonic_platform/__init__.py new file mode 100644 index 000000000000..aab1ee3402cc --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c-d/sonic_platform/__init__.py @@ -0,0 +1,2 @@ +__all__ = ["platform", "chassis", "sfp"] +from . import platform diff --git a/platform/centec/sonic-platform-modules-v682/48y8c-d/sonic_platform/chassis.py b/platform/centec/sonic-platform-modules-v682/48y8c-d/sonic_platform/chassis.py new file mode 100644 index 000000000000..b36a050c9166 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c-d/sonic_platform/chassis.py @@ -0,0 +1,181 @@ +#!/usr/bin/env python +# +# Name: chassis.py, version: 1.0 +# +# Description: Module contains the definitions of SONiC platform APIs +# + +try: + import os + import re + import collections + from sonic_platform_base.chassis_base import ChassisBase + from sonic_platform.sfp import Sfp + from sonic_py_common import device_info +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +USR_SHARE_SONIC_PATH = "/usr/share/sonic" +HOST_DEVICE_PATH = USR_SHARE_SONIC_PATH + "/device" +CONTAINER_PLATFORM_PATH = USR_SHARE_SONIC_PATH + "/platform" + +class Chassis(ChassisBase): + + def __init__(self): + ChassisBase.__init__(self) + + if os.path.isdir(CONTAINER_PLATFORM_PATH): + platform_path = CONTAINER_PLATFORM_PATH + else: + platform = device_info.get_platform() + if platform is None: + raise + platform_path = os.path.join(HOST_DEVICE_PATH, platform) + + port_config_file = "/".join([platform_path, "V682-48y8c-d", "port_config.ini"]) + try: + f = open(port_config_file) + except: + raise + for line in f: + line.strip() + if re.search('^#', line) is not None: + Port_cfg = collections.namedtuple('Port_cfg', line.split()[1:]) + break + f.close() + f = open(port_config_file) + _port_cfgs = [Port_cfg(*tuple((line.strip().split()))) + for line in f if re.search('^#', line) is None] + f.close() + + # Initialize SFP + for port_cfg in _port_cfgs: + sfp = Sfp(int(port_cfg.index)) + self._sfp_list.append(sfp) + +############################################## +# Device methods +############################################## + + def get_name(self): + """ + Retrieves the name of the chassis + Returns: + string: The name of the chassis + """ + return self._eeprom.modelstr() + + def get_presence(self): + """ + Retrieves the presence of the chassis + Returns: + bool: True if chassis is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the chassis + Returns: + string: Model/part number of chassis + """ + return self._eeprom.part_number_str() + + def get_serial(self): + """ + Retrieves the serial number of the chassis + Returns: + string: Serial number of chassis + """ + return self._eeprom.serial_number_str() + + def get_status(self): + """ + Retrieves the operational status of the chassis + Returns: + bool: A boolean value, True if chassis is operating properly + False if not + """ + return True + +############################################## +# Chassis methods +############################################## + + def get_base_mac(self): + """ + Retrieves the base MAC address for the chassis + + Returns: + A string containing the MAC address in the format + 'XX:XX:XX:XX:XX:XX' + """ + return self._eeprom.base_mac_addr() + + def get_serial_number(self): + """ + Retrieves the hardware serial number for the chassis + + Returns: + A string containing the hardware serial number for this chassis. + """ + return self._eeprom.serial_number_str() + + def get_system_eeprom_info(self): + """ + Retrieves the full content of system EEPROM information for the chassis + + Returns: + A dictionary where keys are the type code defined in + OCP ONIE TlvInfo EEPROM format and values are their corresponding + values. + Ex. { '0x21':'AG9064', '0x22':'V1.0', '0x23':'AG9064-0109867821', + '0x24':'001c0f000fcd0a', '0x25':'02/03/2018 16:22:00', + '0x26':'01', '0x27':'REV01', '0x28':'AG9064-C2358-16G'} + """ + return self._eeprom.system_eeprom_info() + + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + Returns: + A tuple (string, string) where the first element is a string + containing the cause of the previous reboot. This string must be + one of the predefined strings in this class. If the first string + is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used + to pass a description of the reboot cause. + """ + return (None, None) + + def get_change_event(self, timeout=2000): + """ + Returns a nested dictionary containing all devices which have + experienced a change at chassis level + + Args: + timeout: Timeout in milliseconds (optional). If timeout == 0, + this method will block until a change is detected. + + Returns: + (bool, dict): + - True if call successful, False if not; + - A nested dictionary where key is a device type, + value is a dictionary with key:value pairs in the + format of {'device_id':'device_event'}, + where device_id is the device ID for this device and + device_event, + status='1' represents device inserted, + status='0' represents device removed. + Ex. {'fan':{'0':'0', '2':'1'}, 'sfp':{'11':'0'}} + indicates that fan 0 has been removed, fan 2 + has been inserted and sfp 11 has been removed. + """ + ret, port_dict = self._sfp_list[0].get_transceiver_change_event(timeout) + ret_dict = {"sfp": port_dict} + return ret, ret_dict + + def get_num_psus(self): + return 0 + + def get_psu(self, psu_index): + return None diff --git a/platform/centec/sonic-platform-modules-v682/48y8c-d/sonic_platform/platform.py b/platform/centec/sonic-platform-modules-v682/48y8c-d/sonic_platform/platform.py new file mode 100644 index 000000000000..358edc6f19f2 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c-d/sonic_platform/platform.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +# +# Name: platform.py, version: 1.0 +# +# Description: Module contains the definitions of SONiC platform APIs for Centec V682-48Y8C-D +# + + +try: + from sonic_platform_base.platform_base import PlatformBase + from sonic_platform.chassis import Chassis +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PlatformBase): + + def __init__(self): + PlatformBase.__init__(self) + self._chassis = Chassis() + diff --git a/platform/centec/sonic-platform-modules-v682/48y8c-d/sonic_platform/sfp.py b/platform/centec/sonic-platform-modules-v682/48y8c-d/sonic_platform/sfp.py new file mode 100644 index 000000000000..4a92fecfa6cf --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c-d/sonic_platform/sfp.py @@ -0,0 +1,102 @@ +#!/usr/bin/env python + +from __future__ import print_function + +import imp +import os + +try: + from sonic_platform_base.sfp_base import SfpBase + from sonic_py_common import device_info +except ImportError as e: + raise ImportError("%s - required module not found" % e) + +USR_SHARE_SONIC_PATH = "/usr/share/sonic" +HOST_DEVICE_PATH = USR_SHARE_SONIC_PATH + "/device" +CONTAINER_PLATFORM_PATH = USR_SHARE_SONIC_PATH + "/platform" + +class Sfp(SfpBase): + """ + Platform-specific sfp class + + Unimplemented methods: + - get_model + - get_serial + - get_status + - get_transceiver_info + - get_transceiver_bulk_status + - get_transceiver_threshold_info + - get_reset_status + - get_rx_los + - get_tx_fault + - get_tx_disable_channel + - get_power_override + - get_temperature + - get_voltage + - get_tx_bias + - get_rx_power + - get_tx_power + - tx_disable_channel + - set_power_override + """ + + def __init__(self, index): + self._index = index + + if os.path.isdir(CONTAINER_PLATFORM_PATH): + platform_path = CONTAINER_PLATFORM_PATH + else: + platform = device_info.get_platform() + if platform is None: + return + platform_path = os.path.join(HOST_DEVICE_PATH, platform) + + module_file = "/".join([platform_path, "plugins", "sfputil.py"]) + module = imp.load_source("sfputil", module_file) + sfp_util_class = getattr(module, "SfpUtil") + self._sfputil = sfp_util_class() + + def get_id(self): + return self._index + + def get_name(self): + return "Ethernet{}".format(self._index) + + def get_lpmode(self): + return False + + def set_lpmode(self, lpmode): + return False + + def get_tx_disable(self): + return False + + def tx_disable(self, tx_disable): + return False + + def reset(self): + pass + + def clear_interrupt(self): + return False + + def get_interrupt_file(self): + return None + + def _get_sfputil(self): + return self._sfputil + + def get_presence(self): + return self._get_sfputil().get_presence(self._index) + + def get_transceiver_info(self): + return self._get_sfputil().get_transceiver_info_dict(self._index) + + def get_transceiver_bulk_status(self): + return self._get_sfputil().get_transceiver_dom_info_dict(self._index) + + def get_transceiver_threshold_info(self): + return self._get_sfputil().get_transceiver_dom_threshold_info_dict(self._index) + + def get_transceiver_change_event(self, timeout): + return self._get_sfputil().get_transceiver_change_event(timeout) diff --git a/platform/centec/sonic-platform-modules-v682/48y8c/modules/Makefile b/platform/centec/sonic-platform-modules-v682/48y8c/modules/Makefile new file mode 100644 index 000000000000..53c96acb0cb7 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c/modules/Makefile @@ -0,0 +1 @@ +obj-m := centec_v682_48y8c_platform.o rtc-sd2405.o diff --git a/platform/centec/sonic-platform-modules-v682/48y8c/modules/centec_v682_48y8c_platform.c b/platform/centec/sonic-platform-modules-v682/48y8c/modules/centec_v682_48y8c_platform.c new file mode 100644 index 000000000000..28e0e9f2610d --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c/modules/centec_v682_48y8c_platform.c @@ -0,0 +1,167 @@ +#include +#include +#include +#include +#include +#include + +#define SEP(XXX) 1 +#define IS_INVALID_PTR(_PTR_) ((_PTR_ == NULL) || IS_ERR(_PTR_)) +#define IS_VALID_PTR(_PTR_) (!IS_INVALID_PTR(_PTR_)) + +#if SEP("defines") +#define SFP_NUM 48 +#define QSFP_NUM 8 +#define PORT_NUM (SFP_NUM + QSFP_NUM) +#endif + +#if SEP("drivers:leds") +extern void v682_48y8c_led_port_set(struct led_classdev *led_cdev, enum led_brightness set_value); +extern enum led_brightness v682_48y8c_led_port_get(struct led_classdev *led_cdev); + +static struct led_classdev led_dev_port[PORT_NUM] = { +{ .name = "port0", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port1", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port2", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port3", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port4", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port5", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port6", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port7", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port8", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port9", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port10", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port11", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port12", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port13", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port14", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port15", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port16", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port17", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port18", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port19", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port20", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port21", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port22", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port23", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port24", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port25", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port26", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port27", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port28", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port29", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port30", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port31", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port32", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port33", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port34", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port35", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port36", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port37", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port38", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port39", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port40", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port41", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port42", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port43", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port44", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port45", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port46", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port47", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port48", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port49", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port50", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port51", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port52", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port53", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port54", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +{ .name = "port55", .brightness_set = v682_48y8c_led_port_set, .brightness_get = v682_48y8c_led_port_get,}, +}; +static unsigned char port_led_mode[PORT_NUM] = {0}; + +void v682_48y8c_led_port_set(struct led_classdev *led_cdev, enum led_brightness set_value) +{ + int portNum = 0; + + sscanf(led_cdev->name, "port%d", &portNum); + + port_led_mode[portNum] = set_value; + + return; +} + +enum led_brightness v682_48y8c_led_port_get(struct led_classdev *led_cdev) +{ + int portNum = 0; + + sscanf(led_cdev->name, "port%d", &portNum); + + return port_led_mode[portNum]; +} + +static int v682_48y8c_init_led(void) +{ + int ret = 0; + int i = 0; + + for (i = 0; i < PORT_NUM; i++) + { + ret = led_classdev_register(NULL, &(led_dev_port[i])); + if (ret != 0) + { + printk(KERN_CRIT "create v682_48y8c led_dev_port%d device failed\n", i); + continue; + } + } + + return ret; +} + +static int v682_48y8c_exit_led(void) +{ + int i = 0; + + for (i = 0; i < PORT_NUM; i++) + { + led_classdev_unregister(&(led_dev_port[i])); + } + + return 0; +} +#endif + +static int v682_48y8c_init(void) +{ + int ret = 0; + int failed = 0; + + printk(KERN_ALERT "init v682_48y8c board dirver...\n"); + + ret = v682_48y8c_init_led(); + if (ret != 0) + { + failed = 1; + } + + if (failed) + printk(KERN_INFO "init v682_48y8c board driver failed\n"); + else + printk(KERN_ALERT "init v682_48y8c board dirver...ok\n"); + + return 0; +} + +static void v682_48y8c_exit(void) +{ + printk(KERN_INFO "deinit v682_48y8c board dirver...\n"); + + v682_48y8c_exit_led(); + + printk(KERN_INFO "deinit v682_48y8c board dirver...ok\n"); +} + +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_AUTHOR("shil centecNetworks, Inc"); +MODULE_DESCRIPTION("v682-48y8c board driver"); +module_init(v682_48y8c_init); +module_exit(v682_48y8c_exit); diff --git a/platform/centec/sonic-platform-modules-v682/48y8c/modules/rtc-sd2405.c b/platform/centec/sonic-platform-modules-v682/48y8c/modules/rtc-sd2405.c new file mode 100644 index 000000000000..c22ab3349144 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c/modules/rtc-sd2405.c @@ -0,0 +1,264 @@ +/* + * rtc class driver for the SD2405 chip + * + * Author: Dale Farnsworth + * + * based on previously existing rtc class drivers + * + * 2007 (c) MontaVista, Software, Inc. This file is licensed under + * the terms of the GNU General Public License version 2. This program + * is licensed "as is" without any warranty of any kind, whether express + * or implied. + */ + +#include +#include +#include +#include +#include + +#define DRV_VERSION "0.1" + +/* + * register indices + */ +#define SD2405_REG_SC 0x0 /* seconds 00-59 */ +#define SD2405_REG_MN 0x1 /* minutes 00-59 */ +#define SD2405_REG_HR 0x2 /* hours 00-23 */ +#define SD2405_REG_DW 0x3 /* day of week 1-7 */ +#define SD2405_REG_DT 0x4 /* day of month 00-31 */ +#define SD2405_REG_MO 0x5 /* month 01-12 */ +#define SD2405_REG_YR 0x6 /* year 00-99 */ + +#define SD2405_REG_CTRL1 0xf /* control 1 */ +#define SD2405_REG_CTRL2 0x10 /* control 2 */ +#define SD2405_REG_CTRL3 0x11 /* control 3 ARST*/ + +#define SD2405_REG_LEN 7 + +/* + * register write protect + */ +#define SD2405_REG_CONTROL1_WRITE 0x80 +#define SD2405_REG_CONTROL2_WRITE 0x84 + + +#define SD2405_IDLE_TIME_AFTER_WRITE 3 /* specification says 2.5 mS */ + +static struct i2c_driver sd2405_driver; + +#if 1 +/* modified by shil, for bug 46153 */ +static int sd2405_i2c_read_regs(struct i2c_client *client, u8 *buf) +{ + int i; + + for (i = 0; i < SD2405_REG_LEN; i++) { + buf[i] = i2c_smbus_read_byte_data(client, SD2405_REG_SC+i); + } + return 0; +} + +/* modified by shil, for bug 46153 */ +static int sd2405_i2c_write_regs(struct i2c_client *client, u8 const *buf) +{ + int i; + + for (i = 0; i < SD2405_REG_LEN; i++) { + i2c_smbus_write_byte_data(client, SD2405_REG_SC+i, buf[i]); + msleep(SD2405_IDLE_TIME_AFTER_WRITE); + } + return 0; +} + +#else +static int sd2405_i2c_read_regs(struct i2c_client *client, u8 *buf) +{ + struct i2c_msg msgs[1] = { + { + .addr = client->addr, + .flags = I2C_M_RD, /* read */ + .len = SD2405_REG_LEN, + .buf = buf} + }; + int rc; + + rc = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); + if (rc != ARRAY_SIZE(msgs)) { + dev_err(&client->dev, "%s: register read failed\n", __func__); + return -EIO; + } + return 0; +} + +static int sd2405_i2c_write_regs(struct i2c_client *client, u8 const *buf) +{ + int rc; + + u8 temp_reg[SD2405_REG_LEN+1] = {0}; + memcpy(&temp_reg[1], buf, SD2405_REG_LEN); + + struct i2c_msg msgs[1] = { + { + .addr = client->addr, + .flags = 0, /* write */ + .len = SD2405_REG_LEN+1, + .buf = temp_reg} + }; + + rc = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); + if (rc != ARRAY_SIZE(msgs)) + goto write_failed; + msleep(SD2405_IDLE_TIME_AFTER_WRITE); + + return 0; + + write_failed: + dev_err(&client->dev, "%s: register write failed\n", __func__); + return -EIO; +} +#endif + +static int sd2405_i2c_read_time(struct i2c_client *client, struct rtc_time *tm) +{ + int rc; + u8 regs[SD2405_REG_LEN]; + + rc = sd2405_i2c_read_regs(client, regs); + if (rc < 0) + return rc; + + tm->tm_sec = bcd2bin(regs[SD2405_REG_SC]); + tm->tm_min = bcd2bin(regs[SD2405_REG_MN]); + tm->tm_hour = bcd2bin(regs[SD2405_REG_HR] & 0x3f); + tm->tm_wday = bcd2bin(regs[SD2405_REG_DW]); + tm->tm_mday = bcd2bin(regs[SD2405_REG_DT]); + tm->tm_mon = bcd2bin(regs[SD2405_REG_MO]) - 1; + tm->tm_year = bcd2bin(regs[SD2405_REG_YR]) + 100; + + return 0; +} + +static int sd2405_i2c_set_write_protect(struct i2c_client *client) +{ + int rc; + rc = i2c_smbus_write_byte_data(client, SD2405_REG_CTRL1, 0); + rc += i2c_smbus_write_byte_data(client, SD2405_REG_CTRL2, 0); + if (rc < 0) { + dev_err(&client->dev, "%s: control register write failed\n", + __func__); + return -EIO; + } + return 0; +} + +static int sd2405_i2c_clear_write_protect(struct i2c_client *client) +{ + int rc; + rc = i2c_smbus_write_byte_data(client, SD2405_REG_CTRL2, SD2405_REG_CONTROL1_WRITE); + rc += i2c_smbus_write_byte_data(client, SD2405_REG_CTRL1, SD2405_REG_CONTROL2_WRITE); + if (rc < 0) { + dev_err(&client->dev, "%s: control register write failed\n", + __func__); + return -EIO; + } + return 0; +} + +static int +sd2405_i2c_set_time(struct i2c_client *client, struct rtc_time const *tm) +{ + u8 regs[SD2405_REG_LEN]; + int rc; + + rc = sd2405_i2c_clear_write_protect(client); + if (rc < 0) + return rc; + + regs[SD2405_REG_SC] = bin2bcd(tm->tm_sec); + regs[SD2405_REG_MN] = bin2bcd(tm->tm_min); + regs[SD2405_REG_HR] = bin2bcd(tm->tm_hour)|0x80; + regs[SD2405_REG_DW] = bin2bcd(tm->tm_wday); + regs[SD2405_REG_DT] = bin2bcd(tm->tm_mday); + regs[SD2405_REG_MO] = bin2bcd(tm->tm_mon + 1); + regs[SD2405_REG_YR] = bin2bcd(tm->tm_year - 100); + + rc = sd2405_i2c_write_regs(client, regs); + if (rc < 0) + return rc; + + rc = sd2405_i2c_set_write_protect(client); + if (rc < 0) + return rc; + + return 0; +} + +static int sd2405_rtc_read_time(struct device *dev, struct rtc_time *tm) +{ + return sd2405_i2c_read_time(to_i2c_client(dev), tm); +} + +static int sd2405_rtc_set_time(struct device *dev, struct rtc_time *tm) +{ + return sd2405_i2c_set_time(to_i2c_client(dev), tm); +} + +static const struct rtc_class_ops sd2405_rtc_ops = { + .read_time = sd2405_rtc_read_time, + .set_time = sd2405_rtc_set_time, +}; + +static int +sd2405_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct rtc_device *rtc; + +/* modified by shil, for bug 46153 */ +#if 0 + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) + return -ENODEV; +#endif + + dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n"); + + rtc = devm_rtc_allocate_device(&client->dev); + if (IS_ERR(rtc)) + return PTR_ERR(rtc); + + i2c_set_clientdata(client, rtc); + rtc->ops = &sd2405_rtc_ops; + + return rtc_register_device(rtc); +} + +static struct i2c_device_id sd2405_id[] = { + { "sd2405", 0 }, + { } +}; + +static struct i2c_driver sd2405_driver = { + .driver = { + .name = "rtc-sd2405", + }, + .probe = sd2405_probe, + .id_table = sd2405_id, +}; + +static int __init sd2405_init(void) +{ + return i2c_add_driver(&sd2405_driver); +} + +static void __exit sd2405_exit(void) +{ + i2c_del_driver(&sd2405_driver); +} + +MODULE_DESCRIPTION("Maxim SD2405 RTC driver"); +MODULE_AUTHOR("Dale Farnsworth "); +MODULE_LICENSE("GPL"); +MODULE_VERSION(DRV_VERSION); + +module_init(sd2405_init); +module_exit(sd2405_exit); diff --git a/platform/centec/sonic-platform-modules-v682/48y8c/service/48y8c_platform.service b/platform/centec/sonic-platform-modules-v682/48y8c/service/48y8c_platform.service new file mode 100644 index 000000000000..48327ec456b2 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c/service/48y8c_platform.service @@ -0,0 +1,13 @@ +[Unit] +Description=Centec modules init +After=local-fs.target +Before=syncd.service + +[Service] +Type=oneshot +ExecStart=-/etc/init.d/platform-modules-v682-48y8c start +ExecStop=-/etc/init.d/platform-modules-v682-48y8c stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/centec/sonic-platform-modules-v682/48y8c/service/release.py b/platform/centec/sonic-platform-modules-v682/48y8c/service/release.py new file mode 100644 index 000000000000..8ae790a24fdc --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c/service/release.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python + +import os +import time + +def release_board(): + if open('/proc/cmdline', 'r').readlines()[0].find('SONIC_BOOT_TYPE=warm') != -1: + return + + os.system('i2cset -y 0 0x37 0x4 0x0') + time.sleep(1) + os.system('i2cset -y 0 0x37 0x4 0x1') + time.sleep(1) + os.system('echo 1 > /sys/bus/pci/devices/0000\:00\:1c.0/remove') + time.sleep(1) + os.system('echo 1 > /sys/bus/pci/rescan') + time.sleep(1) + # EPLD_QSFP_RST + os.system('i2cset -y 0 0x36 0x5 0xff') + os.system('i2cset -y 0 0x37 0x5 0xff') + # EPLD_QSFP_INT_MASK + os.system('i2cset -y 0 0x36 0xd 0xff') + os.system('i2cset -y 0 0x37 0xd 0xff') + # EPLD_PPU_INT_MASK + os.system('i2cset -y 0 0x36 0xb 0x00') + # EPLD_SFP_DISABLE1 + os.system('i2cset -y 0 0x36 0xe 0x00') + os.system('i2cset -y 0 0x37 0xe 0x00') + # EPLD_SFP_DISABLE2 + os.system('i2cset -y 0 0x36 0xf 0x00') + os.system('i2cset -y 0 0x37 0xf 0x00') + # EPLD_SFP_DISABLE3 + os.system('i2cset -y 0 0x36 0x10 0x00') + os.system('i2cset -y 0 0x37 0x10 0x00') + +if __name__ == '__main__': + release_board() diff --git a/platform/centec/sonic-platform-modules-v682/48y8c/setup.py b/platform/centec/sonic-platform-modules-v682/48y8c/setup.py new file mode 100644 index 000000000000..e0713e550f11 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c/setup.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +import os +from setuptools import setup +os.listdir + +setup( + name='sonic_platform', + version='1.0', + description='Module to initialize centec v682-48y8c platforms', + + packages=['sonic_platform'], + package_dir={'sonic_platform': 'sonic_platform'}, +) + diff --git a/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/__init__.py b/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/__init__.py new file mode 100644 index 000000000000..6e50c02e9d1f --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/__init__.py @@ -0,0 +1,2 @@ +__all__ = ["platform", "chassis", "sfp", "eeprom", "psu", "thermal", "fan", "fan_drawer", "led"] +from . import platform diff --git a/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/chassis.py b/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/chassis.py new file mode 100644 index 000000000000..566612e40654 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/chassis.py @@ -0,0 +1,282 @@ +#!/usr/bin/env python +# +# Name: chassis.py, version: 1.0 +# +# Description: Module contains the definitions of SONiC platform APIs +# + +try: + import os + import re + import time + import collections + from sonic_py_common import device_info + from sonic_platform_base.chassis_base import ChassisBase + from sonic_platform.sfp import Sfp + from sonic_platform.fan_drawer import FanDrawer + from sonic_platform.psu import Psu + from sonic_platform.thermal import Thermal + from sonic_platform.eeprom import Eeprom +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +NUM_FAN_TRAY = 2 +NUM_THERMAL = 1 +NUM_PSU = 2 + +USR_SHARE_SONIC_PATH = "/usr/share/sonic" +HOST_DEVICE_PATH = USR_SHARE_SONIC_PATH + "/device" +CONTAINER_PLATFORM_PATH = USR_SHARE_SONIC_PATH + "/platform" + +REBOOT_CAUSE_DIR = "/host/reboot-cause/" +REBOOT_CAUSE_FILE = os.path.join(REBOOT_CAUSE_DIR, "reboot-cause.txt") + +class Chassis(ChassisBase): + # System status LED + _led = None + + def __init__(self): + ChassisBase.__init__(self) + + self.data = {'valid':0, 'last':0} + self.sfp_presence = {} + + if os.path.isdir(CONTAINER_PLATFORM_PATH): + platform_path = CONTAINER_PLATFORM_PATH + else: + platform = device_info.get_platform() + if platform is None: + raise + platform_path = os.path.join(HOST_DEVICE_PATH, platform) + + port_config_file = "/".join([platform_path, "V682-48y8c", "port_config.ini"]) + try: + f = open(port_config_file) + except: + raise + for line in f: + line.strip() + if re.search('^#', line) is not None: + Port_cfg = collections.namedtuple('Port_cfg', line.split()[1:]) + break + f.close() + f = open(port_config_file) + _port_cfgs = [Port_cfg(*tuple((line.strip().split()))) + for line in f if re.search('^#', line) is None] + f.close() + + # Initialize EEPROM + self._eeprom = Eeprom() + + # Initialize FAN + for i in range(NUM_FAN_TRAY): + fandrawer = FanDrawer(i + 1) + self._fan_drawer_list.append(fandrawer) + self._fan_list.extend(fandrawer._fan_list) + + # Initialize PSU + for index in range(0, NUM_PSU): + psu = Psu(index + 1) + self._psu_list.append(psu) + + # Initialize THERMAL + for index in range(0, NUM_THERMAL): + thermal = Thermal(index) + self._thermal_list.append(thermal) + + # Initialize SFP + for port_cfg in _port_cfgs: + sfp = Sfp(int(port_cfg.index), 'SFP' if int(port_cfg.index) < 48 else 'QSFP') + self._sfp_list.append(sfp) + self.sfp_presence[int(port_cfg.index)] = False + +############################################## +# Device methods +############################################## + + def get_name(self): + """ + Retrieves the name of the chassis + Returns: + string: The name of the chassis + """ + return self._eeprom.modelstr() + + def get_presence(self): + """ + Retrieves the presence of the chassis + Returns: + bool: True if chassis is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the chassis + Returns: + string: Model/part number of chassis + """ + return self._eeprom.part_number_str() + + def get_serial(self): + """ + Retrieves the serial number of the chassis + Returns: + string: Serial number of chassis + """ + return self._eeprom.serial_number_str() + + def get_status(self): + """ + Retrieves the operational status of the chassis + Returns: + bool: A boolean value, True if chassis is operating properly + False if not + """ + return True + +############################################## +# Chassis methods +############################################## + + def get_base_mac(self): + """ + Retrieves the base MAC address for the chassis + + Returns: + A string containing the MAC address in the format + 'XX:XX:XX:XX:XX:XX' + """ + return self._eeprom.base_mac_addr() + + def get_serial_number(self): + """ + Retrieves the hardware serial number for the chassis + + Returns: + A string containing the hardware serial number for this chassis. + """ + return self._eeprom.serial_number_str() + + def get_system_eeprom_info(self): + """ + Retrieves the full content of system EEPROM information for the chassis + + Returns: + A dictionary where keys are the type code defined in + OCP ONIE TlvInfo EEPROM format and values are their corresponding + values. + Ex. { '0x21':'AG9064', '0x22':'V1.0', '0x23':'AG9064-0109867821', + '0x24':'001c0f000fcd0a', '0x25':'02/03/2018 16:22:00', + '0x26':'01', '0x27':'REV01', '0x28':'AG9064-C2358-16G'} + """ + return self._eeprom.system_eeprom_info() + + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + Returns: + A tuple (string, string) where the first element is a string + containing the cause of the previous reboot. This string must be + one of the predefined strings in this class. If the first string + is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used + to pass a description of the reboot cause. + """ + if os.path.exists(REBOOT_CAUSE_FILE): + with open(REBOOT_CAUSE_FILE) as reboot_cause_file: + reboot_cause = reboot_cause_file.readline() + if re.search(r'User issued', reboot_cause) is None: + return (self.REBOOT_CAUSE_POWER_LOSS, None) + else: + return (self.REBOOT_CAUSE_NON_HARDWARE, None) + else: + return (self.REBOOT_CAUSE_POWER_LOSS, None) + + def get_change_event(self, timeout=2000): + """ + Returns a nested dictionary containing all devices which have + experienced a change at chassis level + + Args: + timeout: Timeout in milliseconds (optional). If timeout == 0, + this method will block until a change is detected. + + Returns: + (bool, dict): + - True if call successful, False if not; + - A nested dictionary where key is a device type, + value is a dictionary with key:value pairs in the + format of {'device_id':'device_event'}, + where device_id is the device ID for this device and + device_event, + status='1' represents device inserted, + status='0' represents device removed. + Ex. {'fan':{'0':'0', '2':'1'}, 'sfp':{'11':'0'}} + indicates that fan 0 has been removed, fan 2 + has been inserted and sfp 11 has been removed. + """ + SFP_STATUS_INSERTED = '1' + SFP_STATUS_REMOVED = '0' + + now = time.time() + port_dict = {} + + if timeout < 1000: + timeout = 1000 + timeout = (timeout) / float(1000) # Convert to secs + + if now < (self.data['last'] + timeout) and self.data['valid']: + return False, {'sfp': {}} + + for sfp in self._sfp_list: + sfp_presence = sfp.get_presence() + if sfp_presence != self.sfp_presence[sfp.index]: + self.sfp_presence[sfp.index] = sfp_presence + if sfp_presence: + port_dict[sfp.index] = SFP_STATUS_INSERTED + else: + port_dict[sfp.index] = SFP_STATUS_REMOVED + + if bool(port_dict): + self.data['last'] = now + self.data['valid'] = 1 + ret = True + else: + time.sleep(0.5) + ret = False + + ret_dict = {'sfp': port_dict} + return ret, ret_dict + + def get_num_psus(self): + return len(self._psu_list) + + def get_psu(self, psu_index): + return self._psu_list[psu_index] + + def initizalize_system_led(self): + from .led import SystemLed + Chassis._led = SystemLed() + + def set_status_led(self, color): + """ + Sets the state of the system LED + + Args: + color: A string representing the color with which to set the + system LED + + Returns: + bool: True if system LED state is set successfully, False if not + """ + return False if not Chassis._led else Chassis._led.set_status(color) + + def get_status_led(self): + """ + Gets the state of the system LED + + Returns: + A string, one of the valid LED color strings which could be vendor + specified. + """ + return None if not Chassis._led else Chassis._led.get_status() diff --git a/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/eeprom.py b/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/eeprom.py new file mode 100644 index 000000000000..7d2750475717 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/eeprom.py @@ -0,0 +1,127 @@ +#!/usr/bin/env python +# +# Name: eeprom.py, version: 1.0 +# +# Description: Module contains the definitions of SONiC platform APIs +# + +try: + import os + from sonic_eeprom import eeprom_tlvinfo + from sonic_py_common import device_info + import binascii +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +USR_SHARE_SONIC_PATH = "/usr/share/sonic" +HOST_DEVICE_PATH = USR_SHARE_SONIC_PATH + "/device" +CONTAINER_PLATFORM_PATH = USR_SHARE_SONIC_PATH + "/platform" + +class Eeprom(eeprom_tlvinfo.TlvInfoDecoder): + + def __init__(self): + if os.path.isdir(CONTAINER_PLATFORM_PATH): + platform_path = CONTAINER_PLATFORM_PATH + else: + platform = device_info.get_platform() + if platform is None: + raise + platform_path = os.path.join(HOST_DEVICE_PATH, platform) + + self.__eeprom_path = platform_path + '/eeprom_file' + + super(Eeprom, self).__init__(self.__eeprom_path, 0, '', True) + + self.__eeprom_tlv_dict = dict() + try: + self.open_eeprom() + self.__eeprom_data = self.read_eeprom() + except: + self.__eeprom_data = "N/A" + raise RuntimeError("Eeprom is not Programmed") + else: + eeprom = self.__eeprom_data + + if not self.is_valid_tlvinfo_header(eeprom): + return + + total_length = (eeprom[9] << 8) | eeprom[10] + tlv_index = self._TLV_INFO_HDR_LEN + tlv_end = self._TLV_INFO_HDR_LEN + total_length + + while (tlv_index + 2) < len(eeprom) and tlv_index < tlv_end: + if not self.is_valid_tlv(eeprom[tlv_index:]): + break + + tlv = eeprom[tlv_index:tlv_index + 2 + + eeprom[tlv_index + 1]] + code = "0x%02X" % (tlv[0]) + + if tlv[0] == self._TLV_CODE_VENDOR_EXT: + value = str((tlv[2] << 24) | (tlv[3] << 16) | + (tlv[4] << 8) | tlv[5]) + value += str(tlv[6:6 + tlv[1]]) + else: + name, value = self.decoder(None, tlv) + + self.__eeprom_tlv_dict[code] = value + if eeprom[tlv_index] == self._TLV_CODE_CRC_32: + break + + tlv_index += eeprom[tlv_index+1] + 2 + + def serial_number_str(self): + (is_valid, results) = self.get_tlv_field( + self.__eeprom_data, self._TLV_CODE_SERIAL_NUMBER) + if not is_valid: + return "N/A" + return results[2].decode('ascii') + + def base_mac_addr(self): + (is_valid, t) = self.get_tlv_field( + self.__eeprom_data, self._TLV_CODE_MAC_BASE) + if not is_valid or t[1] != 6: + return super(TlvInfoDecoder, self).switchaddrstr(e) + + return ":".join([binascii.b2a_hex(T) for T in t[2]]) + + def modelstr(self): + (is_valid, results) = self.get_tlv_field( + self.__eeprom_data, self._TLV_CODE_PRODUCT_NAME) + if not is_valid: + return "N/A" + + return results[2].decode('ascii') + + def part_number_str(self): + (is_valid, results) = self.get_tlv_field( + self.__eeprom_data, self._TLV_CODE_PART_NUMBER) + if not is_valid: + return "N/A" + + return results[2].decode('ascii') + + def serial_tag_str(self): + (is_valid, results) = self.get_tlv_field( + self.__eeprom_data, self._TLV_CODE_SERVICE_TAG) + if not is_valid: + return "N/A" + + return results[2].decode('ascii') + + def revision_str(self): + (is_valid, results) = self.get_tlv_field( + self.__eeprom_data, self._TLV_CODE_DEVICE_VERSION) + if not is_valid: + return "N/A" + + return results[2].decode('ascii') + + def system_eeprom_info(self): + """ + Returns a dictionary, where keys are the type code defined in + ONIE EEPROM format and values are their corresponding values + found in the system EEPROM. + """ + return self.__eeprom_tlv_dict + diff --git a/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/fan.py b/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/fan.py new file mode 100644 index 000000000000..5f7b256eafb8 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/fan.py @@ -0,0 +1,186 @@ +#!/usr/bin/env python + +############################################################################# +# Celestica +# +# Module contains an implementation of SONiC Platform Base API and +# provides the fan status which are available in the platform +# +############################################################################# + +import math +import os.path + +try: + from sonic_platform_base.fan_base import FanBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +FAN_PATH = "/sys/class/hwmon/hwmon{}/" +FAN_MAX_PWM = 255 +FAN_FAN_PWM = "pwm{}" +FAN_FAN_INPUT = "fan{}_input" +FAN_MAX_RPM = 15000 +FAN_NAME_LIST = ["FAN-{}-1", "FAN-{}-2", "FAN-{}-3", "FAN-{}-4"] + +class Fan(FanBase): + """Platform-specific Fan class""" + + def __init__(self, fan_tray_index, fan_index=0): + self.fan_index = fan_index + self.fan_tray_index = fan_tray_index + + FanBase.__init__(self) + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + data = fd.read() + return data.strip() + except IOError: + pass + return "" + + def __write_txt_file(self, file_path, value): + try: + with open(file_path, 'w') as fd: + fd.write(str(value)) + except IOError: + return False + return True + + def __search_file_by_name(self, directory, file_name): + for dirpath, dirnames, files in os.walk(directory): + for name in files: + file_path = os.path.join(dirpath, name) + if name in file_name: + return file_path + return None + + def get_direction(self): + """ + Retrieves the direction of fan + Returns: + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + """ + direction = self.FAN_DIRECTION_EXHAUST + return direction + + def get_speed(self): + """ + Retrieves the speed of fan as a percentage of full speed + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + + Note: + speed = pwm_in/255*100 + """ + speed = 0 + fan_speed_sysfs_name = "fan{}_input".format(self.fan_index+1) + fan_speed_sysfs_path = self.__search_file_by_name( + FAN_PATH.format(self.fan_tray_index + 1), fan_speed_sysfs_name) + fan_speed_rpm = self.__read_txt_file(fan_speed_sysfs_path) or 0 + speed = math.ceil(float(fan_speed_rpm) * 100 / FAN_MAX_RPM) + + return int(speed) + + def get_target_speed(self): + """ + Retrieves the target (expected) speed of the fan + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + + Note: + speed_pc = pwm_target/255*100 + + 0 : when PWM mode is use + pwm : when pwm mode is not use + """ + # target = 0 + # fan_target_sysfs_name = "pwm{}".format(self.fan_index+1) + # fan_target_sysfs_path = self.__search_file_by_name( + # FAN_PATH.format(self.fan_tray_index + 1), fan_target_sysfs_name) + # fan_target_pwm = self.__read_txt_file(fan_target_sysfs_path) or 0 + # target = math.ceil(float(fan_target_pwm) * 100 / FAN_MAX_PWM) + + # return target + speed = 0 + fan_speed_sysfs_name = "fan{}_input".format(self.fan_index+1) + fan_speed_sysfs_path = self.__search_file_by_name( + FAN_PATH.format(self.fan_tray_index + 1), fan_speed_sysfs_name) + fan_speed_rpm = self.__read_txt_file(fan_speed_sysfs_path) or 0 + speed = math.ceil(float(fan_speed_rpm) * 100 / FAN_MAX_RPM) + + return speed + + def get_speed_tolerance(self): + """ + Retrieves the speed tolerance of the fan + Returns: + An integer, the percentage of variance from target speed which is + considered tolerable + """ + return 10 + + def set_speed(self, speed): + """ + Sets the fan speed + Args: + speed: An integer, the percentage of full fan speed to set fan to, + in the range 0 (off) to 100 (full speed) + Returns: + A boolean, True if speed is set successfully, False if not + + Note: + Depends on pwm or target mode is selected: + 1) pwm = speed_pc * 255 <-- Currently use this mode. + 2) target_pwm = speed_pc * 100 / 255 + 2.1) set pwm{}_enable to 3 + + """ + pwm = speed * 255 / 100 + fan_target_sysfs_name = "pwm{}".format(self.fan_index+1) + fan_target_sysfs_path = self.__search_file_by_name( + FAN_PATH.format(self.fan_tray_index + 1), fan_target_sysfs_name) + return self.__write_txt_file(fan_target_sysfs_path, int(pwm)) + + def set_status_led(self, color): + """ + Sets the state of the fan module status LED + Args: + color: A string representing the color with which to set the + fan module status LED + Returns: + bool: always True + """ + return True + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + fan_name = FAN_NAME_LIST[self.fan_index].format(self.fan_tray_index) + + return fan_name + + def get_presence(self): + """ + Retrieves the presence of the FAN + Returns: + bool: always True + """ + + return True + + def get_status(self): + """ + Retrieves the status of the FAN + Returns: + bool: always True + """ + return True diff --git a/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/fan_drawer.py b/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..781ba7957a4e --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/fan_drawer.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python + +######################################################################## +# Centec V682 48Y8C +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Fan-Drawers' information available in the platform. +# +######################################################################## + +try: + from sonic_platform_base.fan_drawer_base import FanDrawerBase + from sonic_platform.fan import Fan +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CENTEC_FANS_PER_FANTRAY = 4 + + +class FanDrawer(FanDrawerBase): + """Centec V682 48Y8C Platform-specific Fan class""" + + def __init__(self, fantray_index): + + FanDrawerBase.__init__(self) + self.fantrayindex = fantray_index + for i in range(CENTEC_FANS_PER_FANTRAY): + self._fan_list.append(Fan(fantray_index, i)) + + def get_name(self): + """ + Retrieves the fan drawer name + Returns: + string: The name of the device + """ + return "FanTray{}".format(self.fantrayindex) + + def set_status_led(self, color): + """ + Sets the state of the fan drawer status LED + + Args: + color: A string representing the color with which to set the + fan drawer status LED + + Returns: + bool: True if status LED state is set successfully, False if not + """ + return True diff --git a/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/led.py b/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/led.py new file mode 100644 index 000000000000..492d6983ea76 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/led.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +############################################################################# +# +# Module contains an implementation of SONiC Platform Base API and +# provides the led status which are available in the platform +# +############################################################################# + +from subprocess import Popen, PIPE, STDOUT + +class SystemLed(object): + STATUS_LED_COLOR_GREEN = 'green' + STATUS_LED_COLOR_ORANGE = 'orange' + STATUS_LED_COLOR_OFF = 'off' + + SYSTEM_LED_PATH = '/sys/class/leds/system/brightness' + + def set_status(self, color): + status = False + + if color == SystemLed.STATUS_LED_COLOR_ORANGE: + cmd = 'i2cset -y 0 0x36 0x2 0xb' + Popen(cmd, shell=True) + status = True + elif color == SystemLed.STATUS_LED_COLOR_OFF: + cmd = 'i2cset -y 0 0x36 0x2 0x0' + Popen(cmd, shell=True) + status = True + elif color == SystemLed.STATUS_LED_COLOR_GREEN: + cmd = 'i2cset -y 0 0x36 0x2 0x5' + Popen(cmd, shell=True) + status = True + + return status + + def get_status(self): + cmd = 'i2cget -y 0 0x36 0x2' + status = int(Popen(cmd, stdout=PIPE, stderr=STDOUT, shell=True).stdout.readline(), 16) + if status == 11: + return SystemLed.STATUS_LED_COLOR_ORANGE + elif status == 0: + return SystemLed.STATUS_LED_COLOR_OFF + else: + return SystemLed.STATUS_LED_COLOR_GREEN diff --git a/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/platform.py b/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/platform.py new file mode 100644 index 000000000000..358edc6f19f2 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/platform.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +# +# Name: platform.py, version: 1.0 +# +# Description: Module contains the definitions of SONiC platform APIs for Centec V682-48Y8C-D +# + + +try: + from sonic_platform_base.platform_base import PlatformBase + from sonic_platform.chassis import Chassis +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PlatformBase): + + def __init__(self): + PlatformBase.__init__(self) + self._chassis = Chassis() + diff --git a/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/psu.py b/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/psu.py new file mode 100644 index 000000000000..779209c71c2e --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/psu.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +from __future__ import print_function + +from subprocess import Popen, PIPE, STDOUT + +try: + from sonic_platform_base.psu_base import PsuBase +except ImportError as e: + raise ImportError("%s - required module not found" % e) + +class Psu(PsuBase): + """Centec Platform-specific PSU class""" + + def __init__(self, index): + self._index = index + self._fan_list = [] + + def get_presence(self): + cmd = 'i2cget -y 0 0x36 0x1e' + status = int(Popen(cmd, stdout=PIPE, stderr=STDOUT, shell=True).stdout.readline(), 16) + presence = ((status & (1 << (3 * (self._index - 1) + 1))) == 0) + return presence + + def get_powergood_status(self): + cmd = 'i2cget -y 0 0x36 0x1e' + status = int(Popen(cmd, stdout=PIPE, stderr=STDOUT, shell=True).stdout.readline(), 16) + powergood = ((status & (1 << (3 * (self._index - 1) + 2))) != 0) + return powergood diff --git a/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/sfp.py b/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/sfp.py new file mode 100644 index 000000000000..3475753cd49d --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/sfp.py @@ -0,0 +1,1618 @@ +#!/usr/bin/env python + +############################################################################# +# Centec +# +# Sfp contains an implementation of SONiC Platform Base API and +# provides the sfp device status which are available in the platform +# +############################################################################# + +import os +import time +import re +import collections +#import subprocess +#import sonic_device_util +from ctypes import create_string_buffer +from subprocess import Popen, PIPE, STDOUT +from sonic_py_common import device_info + +try: + from sonic_platform_base.sfp_base import SfpBase +# from sonic_platform_base.sonic_eeprom import eeprom_dts + from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId + from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom + from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId + from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +USR_SHARE_SONIC_PATH = "/usr/share/sonic" +HOST_DEVICE_PATH = USR_SHARE_SONIC_PATH + "/device" +CONTAINER_PLATFORM_PATH = USR_SHARE_SONIC_PATH + "/platform" + +QSFP_INFO_OFFSET = 128 +QSFP_DOM_OFFSET = 0 +SFP_INFO_OFFSET = 0 +SFP_DOM_OFFSET = 256 + +# definitions of the offset and width for values in XCVR info eeprom +XCVR_INTFACE_BULK_OFFSET = 0 +XCVR_INTFACE_BULK_WIDTH_QSFP = 20 +XCVR_INTFACE_BULK_WIDTH_SFP = 21 +XCVR_TYPE_OFFSET = 0 +XCVR_TYPE_WIDTH = 1 +XCVR_EXT_TYPE_OFFSET = 1 +XCVR_EXT_TYPE_WIDTH = 1 +XCVR_CONNECTOR_OFFSET = 2 +XCVR_CONNECTOR_WIDTH = 1 +XCVR_COMPLIANCE_CODE_OFFSET = 3 +XCVR_COMPLIANCE_CODE_WIDTH = 8 +XCVR_ENCODING_OFFSET = 11 +XCVR_ENCODING_WIDTH = 1 +XCVR_NBR_OFFSET = 12 +XCVR_NBR_WIDTH = 1 +XCVR_EXT_RATE_SEL_OFFSET = 13 +XCVR_EXT_RATE_SEL_WIDTH = 1 +XCVR_CABLE_LENGTH_OFFSET = 14 +XCVR_CABLE_LENGTH_WIDTH_QSFP = 5 +XCVR_CABLE_LENGTH_WIDTH_SFP = 6 +XCVR_VENDOR_NAME_OFFSET = 20 +XCVR_VENDOR_NAME_WIDTH = 16 +XCVR_VENDOR_OUI_OFFSET = 37 +XCVR_VENDOR_OUI_WIDTH = 3 +XCVR_VENDOR_PN_OFFSET = 40 +XCVR_VENDOR_PN_WIDTH = 16 +XCVR_HW_REV_OFFSET = 56 +XCVR_HW_REV_WIDTH_QSFP = 2 +XCVR_HW_REV_WIDTH_SFP = 4 +XCVR_VENDOR_SN_OFFSET = 68 +XCVR_VENDOR_SN_WIDTH = 16 +XCVR_VENDOR_DATE_OFFSET = 84 +XCVR_VENDOR_DATE_WIDTH = 8 +XCVR_DOM_CAPABILITY_OFFSET = 92 +XCVR_DOM_CAPABILITY_WIDTH = 2 + +XCVR_INTERFACE_DATA_START = 0 +XCVR_INTERFACE_DATA_SIZE = 92 + +QSFP_DOM_BULK_DATA_START = 22 +QSFP_DOM_BULK_DATA_SIZE = 36 +SFP_DOM_BULK_DATA_START = 96 +SFP_DOM_BULK_DATA_SIZE = 10 + +# Offset for values in QSFP eeprom +QSFP_DOM_REV_OFFSET = 1 +QSFP_DOM_REV_WIDTH = 1 +QSFP_TEMPE_OFFSET = 22 +QSFP_TEMPE_WIDTH = 2 +QSFP_VOLT_OFFSET = 26 +QSFP_VOLT_WIDTH = 2 +QSFP_VERSION_COMPLIANCE_OFFSET = 1 +QSFP_VERSION_COMPLIANCE_WIDTH = 1 +QSFP_CHANNL_MON_OFFSET = 34 +QSFP_CHANNL_MON_WIDTH = 16 +QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH = 24 +QSFP_CHANNL_DISABLE_STATUS_OFFSET = 86 +QSFP_CHANNL_DISABLE_STATUS_WIDTH = 1 +QSFP_CHANNL_RX_LOS_STATUS_OFFSET = 3 +QSFP_CHANNL_RX_LOS_STATUS_WIDTH = 1 +QSFP_CHANNL_TX_FAULT_STATUS_OFFSET = 4 +QSFP_CHANNL_TX_FAULT_STATUS_WIDTH = 1 +QSFP_CONTROL_OFFSET = 86 +QSFP_CONTROL_WIDTH = 8 +QSFP_MODULE_MONITOR_OFFSET = 0 +QSFP_MODULE_MONITOR_WIDTH = 9 +QSFP_MODULE_THRESHOLD_OFFSET = 512 +QSFP_MODULE_THRESHOLD_WIDTH = 24 +QSFP_CHANNEL_THRESHOLD_OFFSET = 560 +QSFP_CHANNEL_THRESHOLD_WIDTH = 16 +QSFP_POWEROVERRIDE_OFFSET = 93 +QSFP_POWEROVERRIDE_WIDTH = 1 +QSFP_POWEROVERRIDE_BIT = 0 +QSFP_POWERSET_BIT = 1 +QSFP_OPTION_VALUE_OFFSET = 192 +QSFP_OPTION_VALUE_WIDTH = 4 + +SFP_TEMPE_OFFSET = 96 +SFP_TEMPE_WIDTH = 2 +SFP_VOLT_OFFSET = 98 +SFP_VOLT_WIDTH = 2 +SFP_CHANNL_MON_OFFSET = 100 +SFP_CHANNL_MON_WIDTH = 6 +SFP_MODULE_THRESHOLD_OFFSET = 0 +SFP_MODULE_THRESHOLD_WIDTH = 40 +SFP_CHANNL_THRESHOLD_OFFSET = 112 +SFP_CHANNL_THRESHOLD_WIDTH = 2 +SFP_STATUS_CONTROL_OFFSET = 110 +SFP_STATUS_CONTROL_WIDTH = 1 +SFP_TX_DISABLE_HARD_BIT = 7 +SFP_TX_DISABLE_SOFT_BIT = 6 + +qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)', + 'Length OM2(m)', 'Length OM1(m)', + 'Length Cable Assembly(m)') + +sfp_cable_length_tup = ('LengthSMFkm-UnitsOfKm', 'LengthSMF(UnitsOf100m)', + 'Length50um(UnitsOf10m)', 'Length62.5um(UnitsOfm)', + 'LengthCable(UnitsOfm)', 'LengthOM3(UnitsOf10m)') + +sfp_compliance_code_tup = ('10GEthernetComplianceCode', 'InfinibandComplianceCode', + 'ESCONComplianceCodes', 'SONETComplianceCodes', + 'EthernetComplianceCodes','FibreChannelLinkLength', + 'FibreChannelTechnology', 'SFP+CableTechnology', + 'FibreChannelTransmissionMedia','FibreChannelSpeed') + +qsfp_compliance_code_tup = ('10/40G Ethernet Compliance Code', 'SONET Compliance codes', + 'SAS/SATA compliance codes', 'Gigabit Ethernet Compliant codes', + 'Fibre Channel link length/Transmitter Technology', + 'Fibre Channel transmission media', 'Fibre Channel Speed') + +SFP_TYPE = "SFP" +QSFP_TYPE = "QSFP" + + +class Sfp(SfpBase): + """Platform-specific Sfp class""" + + dom_supported = True + dom_temp_supported = True + dom_volt_supported = True + dom_rx_power_supported = True + dom_tx_power_supported = True + dom_tx_disable_supported = True + calibration = 1 + + # Path to QSFP sysfs + PLATFORM_ROOT_PATH = "/usr/share/sonic/device" + PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" + HOST_CHK_CMD = "docker > /dev/null 2>&1" + + PLATFORM = "x86_64-centec_v682_48y8c-r0" + HWSKU = "V682-48y8c" + + def __init__(self, sfp_index, sfp_type): + if os.path.isdir(CONTAINER_PLATFORM_PATH): + platform_path = CONTAINER_PLATFORM_PATH + else: + platform = device_info.get_platform() + if platform is None: + raise + platform_path = os.path.join(HOST_DEVICE_PATH, platform) + + port_config_file = "/".join([platform_path, self.HWSKU, "port_config.ini"]) + try: + f = open(port_config_file) + except: + raise + for line in f: + line.strip() + if re.search('^#', line) is not None: + Port_cfg = collections.namedtuple('Port_cfg', line.split()[1:]) + break + f.close() + f = open(port_config_file) + self._port_cfgs = [Port_cfg(*tuple((line.strip().split()))) + for line in f if re.search('^#', line) is None] + f.close() + + # Port number + self.PORT_START = 256 + self.PORT_END = 0 + self.QSFP_START = 48 + self.QSFP_END = 0 + + for port_cfg in self._port_cfgs: + if int(port_cfg.index) <= self.PORT_START: + self.PORT_START = int(port_cfg.index) + elif int(port_cfg.index) >= self.PORT_END: + self.PORT_END = int(port_cfg.index) + self.QSFP_END = self.PORT_END + + # Init index + self.index = sfp_index + self.port_num = self.index + #self.dom_supported = False + self.sfp_type = sfp_type + # Init eeprom path + eeprom_path = '/sys/bus/i2c/devices/i2c-{0}/{0}-0050/eeprom' + self.port_to_eeprom_mapping = {} + self.port_to_i2c_mapping = { + # mac i2c presence enable(or reset for qsfp) + 32 : (13, 0x36, 0x11, 0, 0x36, 0x0e, 0), + 33 : (12, 0x36, 0x11, 1, 0x36, 0x0e, 1), + 34 : (11, 0x36, 0x11, 2, 0x36, 0x0e, 2), + 35 : (10, 0x36, 0x11, 3, 0x36, 0x0e, 3), + 0 : (17, 0x36, 0x11, 4, 0x36, 0x0e, 4), + 4 : (16, 0x36, 0x11, 5, 0x36, 0x0e, 5), + 8 : (15, 0x36, 0x11, 6, 0x36, 0x0e, 6), + 12 : (14, 0x36, 0x11, 7, 0x36, 0x0e, 7), + 16 : (21, 0x36, 0x12, 0, 0x36, 0x0f, 0), + 20 : (20, 0x36, 0x12, 1, 0x36, 0x0f, 1), + 24 : (19, 0x36, 0x12, 2, 0x36, 0x0f, 2), + 28 : (18, 0x36, 0x12, 3, 0x36, 0x0f, 3), + 40 : (25, 0x36, 0x12, 4, 0x36, 0x0f, 4), + 44 : (24, 0x36, 0x12, 5, 0x36, 0x0f, 5), + 48 : (23, 0x36, 0x12, 6, 0x36, 0x0f, 6), + 52 : (22, 0x36, 0x12, 7, 0x36, 0x0f, 7), + 56 : (29, 0x36, 0x13, 0, 0x36, 0x10, 0), + 60 : (28, 0x36, 0x13, 1, 0x36, 0x10, 1), + 64 : (27, 0x36, 0x13, 2, 0x36, 0x10, 2), + 68 : (26, 0x36, 0x13, 3, 0x36, 0x10, 3), + 72 : (33, 0x36, 0x13, 4, 0x36, 0x10, 4), + 73 : (32, 0x36, 0x13, 5, 0x36, 0x10, 5), + 74 : (31, 0x36, 0x13, 6, 0x36, 0x10, 6), + 75 : (30, 0x36, 0x13, 7, 0x36, 0x10, 7), + 232 : (37, 0x37, 0x11, 0, 0x37, 0x0e, 0), + 233 : (36, 0x37, 0x11, 1, 0x37, 0x0e, 1), + 234 : (35, 0x37, 0x11, 2, 0x37, 0x0e, 2), + 235 : (34, 0x37, 0x11, 3, 0x37, 0x0e, 3), + 200 : (41, 0x37, 0x11, 4, 0x37, 0x0e, 4), + 204 : (40, 0x37, 0x11, 5, 0x37, 0x0e, 5), + 208 : (39, 0x37, 0x11, 6, 0x37, 0x0e, 6), + 212 : (38, 0x37, 0x11, 7, 0x37, 0x0e, 7), + 216 : (45, 0x37, 0x12, 0, 0x37, 0x0f, 0), + 220 : (44, 0x37, 0x12, 1, 0x37, 0x0f, 1), + 224 : (43, 0x37, 0x12, 2, 0x37, 0x0f, 2), + 228 : (42, 0x37, 0x12, 3, 0x37, 0x0f, 3), + 160 : (49, 0x37, 0x12, 4, 0x37, 0x0f, 4), + 164 : (48, 0x37, 0x12, 5, 0x37, 0x0f, 5), + 168 : (47, 0x37, 0x12, 6, 0x37, 0x0f, 6), + 172 : (46, 0x37, 0x12, 7, 0x37, 0x0f, 7), + 176 : (53, 0x37, 0x13, 0, 0x37, 0x10, 0), + 180 : (52, 0x37, 0x13, 1, 0x37, 0x10, 1), + 184 : (51, 0x37, 0x13, 2, 0x37, 0x10, 2), + 188 : (50, 0x37, 0x13, 3, 0x37, 0x10, 3), + 192 : (57, 0x37, 0x13, 4, 0x37, 0x10, 4), + 193 : (56, 0x37, 0x13, 5, 0x37, 0x10, 5), + 194 : (55, 0x37, 0x13, 6, 0x37, 0x10, 6), + 195 : (54, 0x37, 0x13, 7, 0x37, 0x10, 7), + 120 : (61, 0x36, 0x14, 0, 0x36, 0x05, 0), + 121 : (61, 0x36, 0x14, 0, 0x36, 0x05, 0), + 122 : (61, 0x36, 0x14, 0, 0x36, 0x05, 0), + 123 : (61, 0x36, 0x14, 0, 0x36, 0x05, 0), + 124 : (60, 0x36, 0x14, 1, 0x36, 0x05, 1), + 125 : (60, 0x36, 0x14, 1, 0x36, 0x05, 1), + 126 : (60, 0x36, 0x14, 1, 0x36, 0x05, 1), + 127 : (60, 0x36, 0x14, 1, 0x36, 0x05, 1), + 80 : (59, 0x36, 0x14, 2, 0x36, 0x05, 2), + 81 : (59, 0x36, 0x14, 2, 0x36, 0x05, 2), + 82 : (59, 0x36, 0x14, 2, 0x36, 0x05, 2), + 83 : (59, 0x36, 0x14, 2, 0x36, 0x05, 2), + 84 : (58, 0x36, 0x14, 3, 0x36, 0x05, 3), + 85 : (58, 0x36, 0x14, 3, 0x36, 0x05, 3), + 86 : (58, 0x36, 0x14, 3, 0x36, 0x05, 3), + 87 : (58, 0x36, 0x14, 3, 0x36, 0x05, 3), + 240 : (65, 0x37, 0x14, 0, 0x37, 0x05, 0), + 241 : (65, 0x37, 0x14, 0, 0x37, 0x05, 0), + 242 : (65, 0x37, 0x14, 0, 0x37, 0x05, 0), + 243 : (65, 0x37, 0x14, 0, 0x37, 0x05, 0), + 244 : (64, 0x37, 0x14, 1, 0x37, 0x05, 1), + 245 : (64, 0x37, 0x14, 1, 0x37, 0x05, 1), + 246 : (64, 0x37, 0x14, 1, 0x37, 0x05, 1), + 247 : (64, 0x37, 0x14, 1, 0x37, 0x05, 1), + 280 : (63, 0x37, 0x14, 2, 0x37, 0x05, 2), + 281 : (63, 0x37, 0x14, 2, 0x37, 0x05, 2), + 282 : (63, 0x37, 0x14, 2, 0x37, 0x05, 2), + 283 : (63, 0x37, 0x14, 2, 0x37, 0x05, 2), + 284 : (62, 0x37, 0x14, 3, 0x37, 0x05, 3), + 285 : (62, 0x37, 0x14, 3, 0x37, 0x05, 3), + 286 : (62, 0x37, 0x14, 3, 0x37, 0x05, 3), + 287 : (62, 0x37, 0x14, 3, 0x37, 0x05, 3) + } + + for port_cfg in self._port_cfgs: + i2c_idx = self.port_to_i2c_mapping[int(port_cfg.lanes.split(',')[0])][0] + port_eeprom_path = eeprom_path.format(i2c_idx) + self.port_to_eeprom_mapping[int(port_cfg.index)] = port_eeprom_path + + self.info_dict_keys = ['type', 'hardware_rev', 'serial', 'manufacturer', + 'model', 'connector', 'encoding', 'ext_identifier', + 'ext_rateselect_compliance', 'cable_type', 'cable_length', + 'nominal_bit_rate', 'specification_compliance', 'vendor_date', + 'vendor_oui', 'application_advertisement'] + + self.dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', 'power_lpmode', + 'tx_disable', 'tx_disable_channel', 'temperature', 'voltage', + 'rx1power', 'rx2power', 'rx3power', 'rx4power', 'tx1bias', 'tx2bias', + 'tx3bias', 'tx4bias', 'tx1power', 'tx2power', 'tx3power', 'tx4power'] + + self.threshold_dict_keys = ['temphighalarm', 'temphighwarning', + 'templowalarm', 'templowwarning', 'vcchighalarm', 'vcchighwarning', + 'vcclowalarm', 'vcclowwarning', 'rxpowerhighalarm', 'rxpowerhighwarning', + 'rxpowerlowalarm', 'rxpowerlowwarning', 'txpowerhighalarm', + 'txpowerhighwarning', 'txpowerlowalarm', 'txpowerlowwarning', + 'txbiashighalarm', 'txbiashighwarning', 'txbiaslowalarm', 'txbiaslowwarning'] + + SfpBase.__init__(self) + + + def _convert_string_to_num(self, value_str): + if "-inf" in value_str: + return 'N/A' + elif "Unknown" in value_str: + return 'N/A' + elif 'dBm' in value_str: + t_str = value_str.rstrip('dBm') + return float(t_str) + elif 'mA' in value_str: + t_str = value_str.rstrip('mA') + return float(t_str) + elif 'C' in value_str: + t_str = value_str.rstrip('C') + return float(t_str) + elif 'Volts' in value_str: + t_str = value_str.rstrip('Volts') + return float(t_str) + else: + return 'N/A' + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + data = fd.read() + return data.strip() + except IOError: + pass + return "" + + def __is_host(self): + return os.system(self.HOST_CHK_CMD) == 0 + + def __get_path_to_port_config_file(self): + platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) + hwsku_path = "/".join([platform_path, self.HWSKU] + ) if self.__is_host() else self.PMON_HWSKU_PATH + return "/".join([hwsku_path, "port_config.ini"]) + + def get_presence(self): + """ + Retrieves the presence of the SFP module + Returns: + bool: True if SFP module is present, False if not + """ + # Check for invalid port_num + if self.port_num < self.PORT_START or self.port_num > self.PORT_END: + return False + + sfp_info = self.port_to_i2c_mapping[int(self._port_cfgs[self.port_num].lanes.split(',')[0])] + cmd = 'i2cget -y 0 {0} {1}'.format(sfp_info[1], sfp_info[2]) + presence = int(Popen(cmd, stdout=PIPE, stderr=STDOUT, shell=True).stdout.readline(), 16) + presence &= (1 << sfp_info[3]) + + try: + with open(self.port_to_eeprom_mapping[self.port_num], mode='rb', buffering=0) as fd: + fd.read() + except IOError: + return False + + return (presence == 0) + + def __read_eeprom_specific_bytes(self, offset, num_bytes): + sysfsfile_eeprom = None + eeprom_raw = [] + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + sysfs_sfp_i2c_client_eeprom_path = self.port_to_eeprom_mapping[self.port_num] + try: + sysfsfile_eeprom = open( + sysfs_sfp_i2c_client_eeprom_path, mode="rb", buffering=0) + sysfsfile_eeprom.seek(offset) + raw = sysfsfile_eeprom.read(num_bytes) + for n in range(0, num_bytes): + eeprom_raw[n] = hex(raw[n])[2:].zfill(2) + except Exception: + eeprom_raw = None + finally: + if sysfsfile_eeprom: + sysfsfile_eeprom.close() + + return eeprom_raw + + def __convert_string_to_num(self, value_str): + if "-inf" in value_str: + return 'N/A' + elif "Unknown" in value_str: + return 'N/A' + elif 'dBm' in value_str: + t_str = value_str.rstrip('dBm') + return float(t_str) + elif 'mA' in value_str: + t_str = value_str.rstrip('mA') + return float(t_str) + elif 'C' in value_str: + t_str = value_str.rstrip('C') + return float(t_str) + elif 'Volts' in value_str: + t_str = value_str.rstrip('Volts') + return float(t_str) + else: + return 'N/A' + + def _dom_capability_detect(self): + if not self.get_presence(): + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.calibration = 0 + return + + if self.sfp_type == "QSFP": + self.calibration = 1 + sfpi_obj = sff8436InterfaceId() + if sfpi_obj is None: + self.dom_supported = False + offset = 128 + + # QSFP capability byte parse, through this byte can know whether it support tx_power or not. + # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, + # need to add more code for determining the capability and version compliance + # in SFF-8636 dom capability definitions evolving with the versions. + qsfp_dom_capability_raw = self.__read_eeprom_specific_bytes( + (offset + XCVR_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH) + if qsfp_dom_capability_raw is not None: + qsfp_dom_capability = int(qsfp_dom_capability_raw[0], 16) + + qsfp_version_compliance_raw = self.__read_eeprom_specific_bytes( + QSFP_VERSION_COMPLIANCE_OFFSET, QSFP_VERSION_COMPLIANCE_OFFSET) + if qsfp_version_compliance_raw is not None: + qsfp_version_compliance = int(qsfp_version_compliance_raw[0], 16) + else: + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.calibration = 0 + return + + if qsfp_version_compliance >= 0x08: + self.dom_temp_supported = (qsfp_dom_capability & 0x20 != 0) + self.dom_volt_supported = (qsfp_dom_capability & 0x10 != 0) + self.dom_rx_power_supported = (qsfp_dom_capability & 0x08 != 0) + self.dom_tx_power_supported = (qsfp_dom_capability & 0x04 != 0) + else: + self.dom_temp_supported = True + self.dom_volt_supported = True + self.dom_rx_power_supported = (qsfp_dom_capability & 0x08 != 0) + self.dom_tx_power_supported = True + self.dom_supported = True + self.calibration = 1 + self.dom_tx_disable_supported = True + else: + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.calibration = 0 + elif self.sfp_type == "SFP": + sfpi_obj = sff8472InterfaceId() + if sfpi_obj is None: + return None + sfp_dom_capability_raw = self.__read_eeprom_specific_bytes( + XCVR_DOM_CAPABILITY_OFFSET, XCVR_DOM_CAPABILITY_WIDTH) + if sfp_dom_capability_raw is not None: + sfp_dom_capability = int(sfp_dom_capability_raw[0], 16) + self.dom_supported = (sfp_dom_capability & 0x40 != 0) + if self.dom_supported: + self.dom_temp_supported = True + self.dom_volt_supported = True + self.dom_rx_power_supported = True + self.dom_tx_power_supported = True + if sfp_dom_capability & 0x20 != 0: + self.calibration = 1 + elif sfp_dom_capability & 0x10 != 0: + self.calibration = 2 + else: + self.calibration = 0 + else: + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.calibration = 0 + self.dom_tx_disable_supported = (int(sfp_dom_capability_raw[1], 16) & 0x40 != 0) + else: + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + + def get_transceiver_info(self): + """ + Retrieves transceiver info of this SFP + Returns: + A dict which contains following keys/values : + ======================================================================== + keys |Value Format |Information + ---------------------------|---------------|---------------------------- + type |1*255VCHAR |type of SFP + hardware_rev |1*255VCHAR |hardware version of SFP + serial |1*255VCHAR |serial number of the SFP + manufacturer |1*255VCHAR |SFP vendor name + model |1*255VCHAR |SFP model name + connector |1*255VCHAR |connector information + encoding |1*255VCHAR |encoding information + ext_identifier |1*255VCHAR |extend identifier + ext_rateselect_compliance |1*255VCHAR |extended rateSelect compliance + cable_length |INT |cable length in m + nominal_bit_rate |INT |nominal bit rate by 100Mbs + specification_compliance |1*255VCHAR |specification compliance + vendor_date |1*255VCHAR |vendor date + vendor_oui |1*255VCHAR |vendor OUI + application_advertisement |1*255VCHAR |supported applications advertisement + ======================================================================== + """ + + transceiver_info_dict = {} + compliance_code_dict = {} + transceiver_info_dict = dict.fromkeys(self.info_dict_keys, 'N/A') + transceiver_info_dict['specification_compliance'] = '{}' + if not self.get_presence(): + return transceiver_info_dict + + if self.sfp_type == QSFP_TYPE: + offset = QSFP_INFO_OFFSET + vendor_rev_width = XCVR_HW_REV_WIDTH_QSFP + interface_info_bulk_width = XCVR_INTFACE_BULK_WIDTH_QSFP + + sfpi_obj = sff8436InterfaceId() + if sfpi_obj is None: + print("Error: sfp_object open failed") + return transceiver_info_dict + + elif self.sfp_type == SFP_TYPE: + offset = SFP_INFO_OFFSET + vendor_rev_width = XCVR_HW_REV_WIDTH_SFP + interface_info_bulk_width = XCVR_INTFACE_BULK_WIDTH_SFP + + sfpi_obj = sff8472InterfaceId() + if sfpi_obj is None: + print("Error: sfp_object open failed") + return transceiver_info_dict + else: + return transceiver_info_dict + + # Add retry for xcvr eeprom to get ready + max_retry = 10 + for i in range(0,max_retry): + sfp_interface_bulk_raw = self.__read_eeprom_specific_bytes( + offset + XCVR_INTERFACE_DATA_START, XCVR_INTERFACE_DATA_SIZE) + if sfp_interface_bulk_raw is not None: + break + else: + if not self.get_presence(): + return transceiver_info_dict + elif i == max_retry-1: + pass + else: + time.sleep(0.5) + + if sfp_interface_bulk_raw is None: + return transceiver_info_dict + + start = XCVR_INTFACE_BULK_OFFSET - XCVR_INTERFACE_DATA_START + end = start + interface_info_bulk_width + sfp_interface_bulk_data = sfpi_obj.parse_sfp_info_bulk(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_VENDOR_NAME_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_NAME_WIDTH + sfp_vendor_name_data = sfpi_obj.parse_vendor_name(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_VENDOR_PN_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_PN_WIDTH + sfp_vendor_pn_data = sfpi_obj.parse_vendor_pn(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_HW_REV_OFFSET - XCVR_INTERFACE_DATA_START + end = start + vendor_rev_width + sfp_vendor_rev_data = sfpi_obj.parse_vendor_rev(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_VENDOR_SN_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_SN_WIDTH + sfp_vendor_sn_data = sfpi_obj.parse_vendor_sn(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_VENDOR_OUI_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_OUI_WIDTH + sfp_vendor_oui_data = sfpi_obj.parse_vendor_oui(sfp_interface_bulk_raw[start : end], 0) + + start = XCVR_VENDOR_DATE_OFFSET - XCVR_INTERFACE_DATA_START + end = start + XCVR_VENDOR_DATE_WIDTH + sfp_vendor_date_data = sfpi_obj.parse_vendor_date(sfp_interface_bulk_raw[start : end], 0) + transceiver_info_dict['type'] = sfp_interface_bulk_data \ + ['data']['type']['value'] + transceiver_info_dict['manufacturer'] = sfp_vendor_name_data \ + ['data']['Vendor Name']['value'] + transceiver_info_dict['model'] = sfp_vendor_pn_data \ + ['data']['Vendor PN']['value'] + transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data \ + ['data']['Vendor Rev']['value'] + transceiver_info_dict['serial'] = sfp_vendor_sn_data \ + ['data']['Vendor SN']['value'] + transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data \ + ['data']['Vendor OUI']['value'] + transceiver_info_dict['vendor_date'] = sfp_vendor_date_data \ + ['data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] + transceiver_info_dict['connector'] = sfp_interface_bulk_data \ + ['data']['Connector']['value'] + transceiver_info_dict['encoding'] = sfp_interface_bulk_data \ + ['data']['EncodingCodes']['value'] + transceiver_info_dict['ext_identifier'] = sfp_interface_bulk_data \ + ['data']['Extended Identifier']['value'] + transceiver_info_dict['ext_rateselect_compliance'] = sfp_interface_bulk_data \ + ['data']['RateIdentifier']['value'] + transceiver_info_dict['type_abbrv_name'] = 'N/A' + if self.sfp_type == QSFP_TYPE: + for key in qsfp_cable_length_tup: + if key in sfp_interface_bulk_data['data']: + transceiver_info_dict['cable_type'] = key + transceiver_info_dict['cable_length'] = str( + sfp_interface_bulk_data['data'][key]['value']) + + for key in qsfp_compliance_code_tup: + if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: + compliance_code_dict[key] = sfp_interface_bulk_data \ + ['data']['Specification compliance']['value'][key]['value'] + transceiver_info_dict['specification_compliance'] = str(compliance_code_dict) + + transceiver_info_dict['nominal_bit_rate'] = str(sfp_interface_bulk_data \ + ['data']['Nominal Bit Rate(100Mbs)']['value']) + else: + for key in sfp_cable_length_tup: + if key in sfp_interface_bulk_data['data']: + transceiver_info_dict['cable_type'] = key + transceiver_info_dict['cable_length'] = str( + sfp_interface_bulk_data['data'][key]['value']) + + for key in sfp_compliance_code_tup: + if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: + compliance_code_dict[key] = sfp_interface_bulk_data \ + ['data']['Specification compliance']['value'][key]['value'] + transceiver_info_dict['specification_compliance'] = str(compliance_code_dict) + + transceiver_info_dict['nominal_bit_rate'] = str(sfp_interface_bulk_data \ + ['data']['NominalSignallingRate(UnitsOf100Mbd)']['value']) + + return transceiver_info_dict + + def get_transceiver_bulk_status(self): + """ + Retrieves transceiver bulk status of this SFP + Returns: + A dict which contains following keys/values : + ======================================================================== + keys |Value Format |Information + ---------------------------|---------------|---------------------------- + rx_los |BOOLEAN |RX loss-of-signal status, True if has RX los, False if not. + tx_fault |BOOLEAN |TX fault status, True if has TX fault, False if not. + reset_status |BOOLEAN |reset status, True if SFP in reset, False if not. + lp_mode |BOOLEAN |low power mode status, True in lp mode, False if not. + tx_disable |BOOLEAN |TX disable status, True TX disabled, False if not. + tx_disabled_channel |HEX |disabled TX channels in hex, bits 0 to 3 represent channel 0 + | |to channel 3. + temperature |INT |module temperature in Celsius + voltage |INT |supply voltage in mV + txbias |INT |TX Bias Current in mA, n is the channel number, + | |for example, tx2bias stands for tx bias of channel 2. + rxpower |INT |received optical power in mW, n is the channel number, + | |for example, rx2power stands for rx power of channel 2. + txpower |INT |TX output power in mW, n is the channel number, + | |for example, tx2power stands for tx power of channel 2. + ======================================================================== + """ + + if not self.get_presence(): + return None + + self._dom_capability_detect() + + if self.sfp_type == QSFP_TYPE: + sfpd_obj = sff8436Dom() + sfpi_obj = sff8436InterfaceId() + + if not sfpi_obj or not sfpd_obj: + return None + + transceiver_dom_info_dict = dict.fromkeys(self.dom_dict_keys, 'N/A') + offset = QSFP_DOM_OFFSET + offset_xcvr = QSFP_INFO_OFFSET + + # QSFP capability byte parse, through this byte can know whether it support tx_power or not. + # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, + # need to add more code for determining the capability and version compliance + # in SFF-8636 dom capability definitions evolving with the versions. + qsfp_dom_capability_raw = self.__read_eeprom_specific_bytes( + (offset_xcvr + XCVR_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH) + if qsfp_dom_capability_raw is not None: + qsfp_dom_capability_data = sfpi_obj.parse_dom_capability( + qsfp_dom_capability_raw, 0) + else: + return None + + dom_temperature_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_TEMPE_OFFSET), QSFP_TEMPE_WIDTH) + if dom_temperature_raw is not None: + dom_temperature_data = sfpd_obj.parse_temperature( + dom_temperature_raw, 0) + transceiver_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] + + dom_voltage_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_VOLT_OFFSET), QSFP_VOLT_WIDTH) + if dom_voltage_raw is not None: + dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) + transceiver_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] + + qsfp_dom_rev_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_DOM_REV_OFFSET), QSFP_DOM_REV_WIDTH) + if qsfp_dom_rev_raw is not None: + qsfp_dom_rev_data = sfpd_obj.parse_sfp_dom_rev(qsfp_dom_rev_raw, 0) + qsfp_dom_rev = qsfp_dom_rev_data['data']['dom_rev']['value'] + + # The tx_power monitoring is only available on QSFP which compliant with SFF-8636 + # and claimed that it support tx_power with one indicator bit. + dom_channel_monitor_data = {} + dom_channel_monitor_raw = None + qsfp_tx_power_support = qsfp_dom_capability_data['data']['Tx_power_support']['value'] + if (qsfp_dom_rev[0:8] != 'SFF-8636' or (qsfp_dom_rev[0:8] == 'SFF-8636' and qsfp_tx_power_support != 'on')): + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params( + dom_channel_monitor_raw, 0) + + else: + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power( + dom_channel_monitor_raw, 0) + transceiver_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TX1Power']['value'] + transceiver_dom_info_dict['tx2power'] = dom_channel_monitor_data['data']['TX2Power']['value'] + transceiver_dom_info_dict['tx3power'] = dom_channel_monitor_data['data']['TX3Power']['value'] + transceiver_dom_info_dict['tx4power'] = dom_channel_monitor_data['data']['TX4Power']['value'] + + if dom_channel_monitor_raw: + transceiver_dom_info_dict['rx1power'] = dom_channel_monitor_data['data']['RX1Power']['value'] + transceiver_dom_info_dict['rx2power'] = dom_channel_monitor_data['data']['RX2Power']['value'] + transceiver_dom_info_dict['rx3power'] = dom_channel_monitor_data['data']['RX3Power']['value'] + transceiver_dom_info_dict['rx4power'] = dom_channel_monitor_data['data']['RX4Power']['value'] + transceiver_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TX1Bias']['value'] + transceiver_dom_info_dict['tx2bias'] = dom_channel_monitor_data['data']['TX2Bias']['value'] + transceiver_dom_info_dict['tx3bias'] = dom_channel_monitor_data['data']['TX3Bias']['value'] + transceiver_dom_info_dict['tx4bias'] = dom_channel_monitor_data['data']['TX4Bias']['value'] + elif self.sfp_type == SFP_TYPE: + sfpd_obj = sff8472Dom() + if not sfpd_obj: + return None + + eeprom_ifraw = self.__read_eeprom_specific_bytes(0, SFP_DOM_OFFSET) + if eeprom_ifraw is not None: + sfpi_obj = sff8472InterfaceId(eeprom_ifraw) + cal_type = sfpi_obj.get_calibration_type() + sfpd_obj._calibration_type = cal_type + + offset = SFP_DOM_OFFSET + transceiver_dom_info_dict = dict.fromkeys(self.dom_dict_keys, 'N/A') + dom_temperature_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_TEMPE_OFFSET), SFP_TEMPE_WIDTH) + + if dom_temperature_raw is not None: + dom_temperature_data = sfpd_obj.parse_temperature( + dom_temperature_raw, 0) + transceiver_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] + + dom_voltage_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_VOLT_OFFSET), SFP_VOLT_WIDTH) + if dom_voltage_raw is not None: + dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) + transceiver_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] + + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) + if dom_channel_monitor_raw is not None: + dom_voltage_data = sfpd_obj.parse_channel_monitor_params( + dom_channel_monitor_raw, 0) + transceiver_dom_info_dict['tx1power'] = dom_voltage_data['data']['TXPower']['value'] + transceiver_dom_info_dict['rx1power'] = dom_voltage_data['data']['RXPower']['value'] + transceiver_dom_info_dict['tx1bias'] = dom_voltage_data['data']['TXBias']['value'] + else: + return None + + for key in transceiver_dom_info_dict: + transceiver_dom_info_dict[key] = self._convert_string_to_num( + transceiver_dom_info_dict[key]) + + transceiver_dom_info_dict['rx_los'] = self.get_rx_los() + transceiver_dom_info_dict['tx_fault'] = self.get_tx_fault() + transceiver_dom_info_dict['reset_status'] = self.get_reset_status() + transceiver_dom_info_dict['lp_mode'] = self.get_lpmode() + transceiver_dom_info_dict['tx_disable'] = self.get_tx_disable() + transceiver_dom_info_dict['tx_disable_channel'] = self.get_tx_disable_channel() + + return transceiver_dom_info_dict + + def get_transceiver_threshold_info(self): + """ + Retrieves transceiver threshold info of this SFP + + Returns: + A dict which contains following keys/values : + ======================================================================== + keys |Value Format |Information + ---------------------------|---------------|---------------------------- + temphighalarm |FLOAT |High Alarm Threshold value of temperature in Celsius. + templowalarm |FLOAT |Low Alarm Threshold value of temperature in Celsius. + temphighwarning |FLOAT |High Warning Threshold value of temperature in Celsius. + templowwarning |FLOAT |Low Warning Threshold value of temperature in Celsius. + vcchighalarm |FLOAT |High Alarm Threshold value of supply voltage in mV. + vcclowalarm |FLOAT |Low Alarm Threshold value of supply voltage in mV. + vcchighwarning |FLOAT |High Warning Threshold value of supply voltage in mV. + vcclowwarning |FLOAT |Low Warning Threshold value of supply voltage in mV. + rxpowerhighalarm |FLOAT |High Alarm Threshold value of received power in dBm. + rxpowerlowalarm |FLOAT |Low Alarm Threshold value of received power in dBm. + rxpowerhighwarning |FLOAT |High Warning Threshold value of received power in dBm. + rxpowerlowwarning |FLOAT |Low Warning Threshold value of received power in dBm. + txpowerhighalarm |FLOAT |High Alarm Threshold value of transmit power in dBm. + txpowerlowalarm |FLOAT |Low Alarm Threshold value of transmit power in dBm. + txpowerhighwarning |FLOAT |High Warning Threshold value of transmit power in dBm. + txpowerlowwarning |FLOAT |Low Warning Threshold value of transmit power in dBm. + txbiashighalarm |FLOAT |High Alarm Threshold value of tx Bias Current in mA. + txbiaslowalarm |FLOAT |Low Alarm Threshold value of tx Bias Current in mA. + txbiashighwarning |FLOAT |High Warning Threshold value of tx Bias Current in mA. + txbiaslowwarning |FLOAT |Low Warning Threshold value of tx Bias Current in mA. + ======================================================================== + """ + transceiver_dom_threshold_info_dict_keys = ['temphighalarm', 'temphighwarning', 'templowalarm', 'templowwarning', + 'vcchighalarm', 'vcchighwarning', 'vcclowalarm', 'vcclowwarning', + 'rxpowerhighalarm', 'rxpowerhighwarning', 'rxpowerlowalarm', 'rxpowerlowwarning', + 'txpowerhighalarm', 'txpowerhighwarning', 'txpowerlowalarm', 'txpowerlowwarning', + 'txbiashighalarm', 'txbiashighwarning', 'txbiaslowalarm', 'txbiaslowwarning'] + + if self.sfp_type == QSFP_TYPE: + sfpd_obj = sff8436Dom() + if not self.get_presence() or not sfpd_obj: + return None + DOM_OFFSET = 0 + transceiver_dom_threshold_dict = dict.fromkeys(transceiver_dom_threshold_info_dict_keys, 'N/A') + offset = DOM_OFFSET + + dom_module_threshold_raw = self.__read_eeprom_specific_bytes((offset + QSFP_MODULE_THRESHOLD_OFFSET), QSFP_MODULE_THRESHOLD_WIDTH) + if dom_module_threshold_raw is not None: + module_threshold_values = sfpd_obj.parse_module_threshold_values(dom_module_threshold_raw, 0) + module_threshold_data = module_threshold_values.get('data') + if module_threshold_data: + transceiver_dom_threshold_dict['temphighalarm'] = module_threshold_data['TempHighAlarm']['value'] + transceiver_dom_threshold_dict['templowalarm'] = module_threshold_data['TempLowAlarm']['value'] + transceiver_dom_threshold_dict['temphighwarning'] = module_threshold_data['TempHighWarning']['value'] + transceiver_dom_threshold_dict['templowwarning'] = module_threshold_data['TempLowWarning']['value'] + transceiver_dom_threshold_dict['vcchighalarm'] = module_threshold_data['VccHighAlarm']['value'] + transceiver_dom_threshold_dict['vcclowalarm'] = module_threshold_data['VccLowAlarm']['value'] + transceiver_dom_threshold_dict['vcchighwarning'] = module_threshold_data['VccHighWarning']['value'] + transceiver_dom_threshold_dict['vcclowwarning'] = module_threshold_data['VccLowWarning']['value'] + + dom_channel_thres_raw = self.__read_eeprom_specific_bytes((offset + QSFP_CHANNEL_THRESHOLD_OFFSET), QSFP_CHANNEL_THRESHOLD_WIDTH) + if dom_channel_thres_raw is not None: + channel_threshold_values = sfpd_obj.parse_channel_threshold_values(dom_channel_thres_raw, 0) + channel_threshold_data = channel_threshold_values.get('data') + else: + channel_threshold_data = None + if channel_threshold_data: + transceiver_dom_threshold_dict['rxpowerhighalarm'] = channel_threshold_data['RxPowerHighAlarm']['value'] + transceiver_dom_threshold_dict['rxpowerlowalarm'] = channel_threshold_data['RxPowerLowAlarm']['value'] + transceiver_dom_threshold_dict['rxpowerhighwarning'] = channel_threshold_data['RxPowerHighWarning']['value'] + transceiver_dom_threshold_dict['rxpowerlowwarning'] = channel_threshold_data['RxPowerLowWarning']['value'] + transceiver_dom_threshold_dict['txpowerhighalarm'] = "0.0dBm" + transceiver_dom_threshold_dict['txpowerlowalarm'] = "0.0dBm" + transceiver_dom_threshold_dict['txpowerhighwarning'] = "0.0dBm" + transceiver_dom_threshold_dict['txpowerlowwarning'] = "0.0dBm" + transceiver_dom_threshold_dict['txbiashighalarm'] = channel_threshold_data['TxBiasHighAlarm']['value'] + transceiver_dom_threshold_dict['txbiaslowalarm'] = channel_threshold_data['TxBiasLowAlarm']['value'] + transceiver_dom_threshold_dict['txbiashighwarning'] = channel_threshold_data['TxBiasHighWarning']['value'] + transceiver_dom_threshold_dict['txbiaslowwarning'] = channel_threshold_data['TxBiasLowWarning']['value'] + + for key in transceiver_dom_threshold_dict: + transceiver_dom_threshold_dict[key] = self.__convert_string_to_num(transceiver_dom_threshold_dict[key]) + + return transceiver_dom_threshold_dict + + elif self.sfp_type == SFP_TYPE: + sfpd_obj = sff8472Dom() + + if not self.get_presence() and not sfpd_obj: + return None + DOM_OFFSET = 256 + eeprom_ifraw = self.__read_eeprom_specific_bytes(0, DOM_OFFSET) + if eeprom_ifraw is not None: + sfpi_obj = sff8472InterfaceId(eeprom_ifraw) + cal_type = sfpi_obj.get_calibration_type() + sfpd_obj._calibration_type = cal_type + + offset = DOM_OFFSET + transceiver_dom_threshold_info_dict = dict.fromkeys(transceiver_dom_threshold_info_dict_keys, 'N/A') + dom_module_threshold_raw = self.__read_eeprom_specific_bytes((offset + SFP_MODULE_THRESHOLD_OFFSET), SFP_MODULE_THRESHOLD_WIDTH) + if dom_module_threshold_raw is not None: + dom_module_threshold_data = sfpd_obj.parse_alarm_warning_threshold(dom_module_threshold_raw, 0) + + transceiver_dom_threshold_info_dict['temphighalarm'] = dom_module_threshold_data['data']['TempHighAlarm']['value'] + transceiver_dom_threshold_info_dict['templowalarm'] = dom_module_threshold_data['data']['TempLowAlarm']['value'] + transceiver_dom_threshold_info_dict['temphighwarning'] = dom_module_threshold_data['data']['TempHighWarning']['value'] + transceiver_dom_threshold_info_dict['templowwarning'] = dom_module_threshold_data['data']['TempLowWarning']['value'] + + transceiver_dom_threshold_info_dict['vcchighalarm'] = dom_module_threshold_data['data']['VoltageHighAlarm']['value'] + transceiver_dom_threshold_info_dict['vcclowalarm'] = dom_module_threshold_data['data']['VoltageLowAlarm']['value'] + transceiver_dom_threshold_info_dict['vcchighwarning'] = dom_module_threshold_data['data']['VoltageHighWarning']['value'] + transceiver_dom_threshold_info_dict['vcclowwarning'] = dom_module_threshold_data['data']['VoltageLowWarning']['value'] + + transceiver_dom_threshold_info_dict['txbiashighalarm'] = dom_module_threshold_data['data']['BiasHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiaslowalarm'] = dom_module_threshold_data['data']['BiasLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiashighwarning'] = dom_module_threshold_data['data']['BiasHighWarning']['value'] + transceiver_dom_threshold_info_dict['txbiaslowwarning'] = dom_module_threshold_data['data']['BiasLowWarning']['value'] + + transceiver_dom_threshold_info_dict['txpowerhighalarm'] = dom_module_threshold_data['data']['TXPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerlowalarm'] = dom_module_threshold_data['data']['TXPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerhighwarning'] = dom_module_threshold_data['data']['TXPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerlowwarning'] = dom_module_threshold_data['data']['TXPowerLowWarning']['value'] + + transceiver_dom_threshold_info_dict['rxpowerhighalarm'] = dom_module_threshold_data['data']['RXPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowalarm'] = dom_module_threshold_data['data']['RXPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerhighwarning'] = dom_module_threshold_data['data']['RXPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_module_threshold_data['data']['RXPowerLowWarning']['value'] + + for key in transceiver_dom_threshold_info_dict: + transceiver_dom_threshold_info_dict[key] = self.__convert_string_to_num(transceiver_dom_threshold_info_dict[key]) + + return transceiver_dom_threshold_info_dict + + else: + return None + + def get_reset_status(self): + """ + Retrieves the reset status of SFP + Returns: + A Boolean, True if reset enabled, False if disabled + """ + # Check for invalid port_num + if self.port_num < self.PORT_START or self.port_num > self.PORT_END or self.sfp_type == SFP_TYPE: + return False + + sfp_info = self.port_to_i2c_mapping[int(self._port_cfgs[self.port_num].lanes.split(',')[0])] + cmd = 'i2cget -y 0 {0} {1}'.format(sfp_info[4], sfp_info[5]) + reset_status = int(Popen(cmd, stdout=PIPE, stderr=STDOUT, shell=True).stdout.readline(), 16) + reset_status &= (1 << sfp_info[6]) + + return (reset_status == 1) + + def get_rx_los(self): + """ + Retrieves the RX LOS (lost-of-signal) status of SFP + Returns: + A Boolean, True if SFP has RX LOS, False if not. + Note : RX LOS status is latched until a call to get_rx_los or a reset. + """ + if not self.dom_supported: + return None + + rx_los_list = [] + + if self.sfp_type == QSFP_TYPE: + offset = 0 + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_RX_LOS_STATUS_OFFSET), QSFP_CHANNL_RX_LOS_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + rx_los_data = int(dom_channel_monitor_raw[0], 16) + rx_los_list.append(rx_los_data & 0x01 != 0) + rx_los_list.append(rx_los_data & 0x02 != 0) + rx_los_list.append(rx_los_data & 0x04 != 0) + rx_los_list.append(rx_los_data & 0x08 != 0) + elif self.sfp_type == SFP_TYPE: + offset = 256 + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_STATUS_CONTROL_OFFSET), SFP_STATUS_CONTROL_WIDTH) + if dom_channel_monitor_raw is not None: + rx_los_data = int(dom_channel_monitor_raw[0], 16) + rx_los_list.append(rx_los_data & 0x02 != 0) + else: + return None + else: + return None + + return rx_los_list + + def get_tx_fault(self): + """ + Retrieves the TX fault status of SFP + Returns: + A Boolean, True if SFP has TX fault, False if not + Note : TX fault status is lached until a call to get_tx_fault or a reset. + """ + if not self.dom_supported: + return None + + tx_fault_list = [] + + if self.sfp_type == QSFP_TYPE: + offset = 0 + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_TX_FAULT_STATUS_OFFSET), QSFP_CHANNL_TX_FAULT_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + tx_fault_data = int(dom_channel_monitor_raw[0], 16) + tx_fault_list.append(tx_fault_data & 0x01 != 0) + tx_fault_list.append(tx_fault_data & 0x02 != 0) + tx_fault_list.append(tx_fault_data & 0x04 != 0) + tx_fault_list.append(tx_fault_data & 0x08 != 0) + elif self.sfp_type == SFP_TYPE: + offset = 256 + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_STATUS_CONTROL_OFFSET), SFP_STATUS_CONTROL_WIDTH) + if dom_channel_monitor_raw is not None: + tx_fault_data = int(dom_channel_monitor_raw[0], 16) + tx_fault_list.append(tx_fault_data & 0x04 != 0) + else: + return None + else: + return None + + return tx_fault_list + + def get_tx_disable(self): + """ + Retrieves the tx_disable status of this SFP + Returns: + A Boolean, True if tx_disable is enabled, False if disabled + """ + if not self.dom_supported: + return None + + tx_disable_list = [] + + if self.sfp_type == QSFP_TYPE: + offset = 0 + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_DISABLE_STATUS_OFFSET), QSFP_CHANNL_DISABLE_STATUS_WIDTH) + if dom_channel_monitor_raw is not None: + tx_disable_data = int(dom_channel_monitor_raw[0], 16) + tx_disable_list.append(tx_disable_data & 0x01 != 0) + tx_disable_list.append(tx_disable_data & 0x02 != 0) + tx_disable_list.append(tx_disable_data & 0x04 != 0) + tx_disable_list.append(tx_disable_data & 0x08 != 0) + elif self.sfp_type == SFP_TYPE: + offset = 256 + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_STATUS_CONTROL_OFFSET), SFP_STATUS_CONTROL_WIDTH) + if dom_channel_monitor_raw is not None: + tx_disable_data = int(dom_channel_monitor_raw[0], 16) + tx_disable_list.append(tx_disable_data & 0xC0 != 0) + else: + return None + else: + return None + + return tx_disable_list + + def get_tx_disable_channel(self): + """ + Retrieves the TX disabled channels in this SFP + Returns: + A hex of 4 bits (bit 0 to bit 3 as channel 0 to channel 3) to represent + TX channels which have been disabled in this SFP. + As an example, a returned value of 0x5 indicates that channel 0 + and channel 2 have been disabled. + """ + # SFP doesn't support this feature + if self.sfp_type == SFP_TYPE: + return 0 + elif self.sfp_type == QSFP_TYPE: + tx_disable_list = self.get_tx_disable() + if tx_disable_list is None: + return 0 + tx_disabled = 0 + for i in range(len(tx_disable_list)): + if tx_disable_list[i]: + tx_disabled |= 1 << i + else: + return None + + return tx_disabled + + def get_lpmode(self): + """ + Retrieves the lpmode (low power mode) status of this QSFP module + Returns: + A Boolean, True if lpmode is enabled, False if disabled + """ + return False + + def get_power_override(self): + """ + Retrieves the power-override status of this SFP + Returns: + A Boolean, True if power-override is enabled, False if disabled + """ + # SFP doesn't support this feature + if self.sfp_type == SFP_TYPE: + return False + elif self.sfp_type == QSFP_TYPE: + offset = 0 + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return False + + dom_control_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_POWEROVERRIDE_OFFSET), QSFP_POWEROVERRIDE_WIDTH) + if dom_control_raw is not None: + if int(dom_control_raw[0],16) & (0x01 << QSFP_POWEROVERRIDE_BIT): + return True + else: + return False + else: + return None + + def get_temperature(self): + """ + Retrieves the temperature of this SFP + Returns: + An integer number of current temperature in Celsius + """ + if not self.dom_supported: + return None + if self.sfp_type == QSFP_TYPE: + offset = 0 + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + if self.dom_temp_supported: + dom_temperature_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_TEMPE_OFFSET), QSFP_TEMPE_WIDTH) + if dom_temperature_raw is not None: + dom_temperature_data = sfpd_obj.parse_temperature(dom_temperature_raw, 0) + temp = self._convert_string_to_num( + dom_temperature_data['data']['Temperature']['value']) + return temp + else: + return None + elif self.sfp_type == SFP_TYPE: + offset = 256 + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return None + sfpd_obj._calibration_type = 1 + + dom_temperature_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_TEMPE_OFFSET), SFP_TEMPE_WIDTH) + if dom_temperature_raw is not None: + dom_temperature_data = sfpd_obj.parse_temperature(dom_temperature_raw, 0) + temp = self._convert_string_to_num( + dom_temperature_data['data']['Temperature']['value']) + return temp + else: + return None + else: + return None + + def get_voltage(self): + """ + Retrieves the supply voltage of this SFP + Returns: + An integer number of supply voltage in mV + """ + if not self.dom_supported: + return None + if self.sfp_type == QSFP_TYPE: + offset = 0 + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + if self.dom_volt_supported: + dom_voltage_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_VOLT_OFFSET), QSFP_VOLT_WIDTH) + if dom_voltage_raw is not None: + dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) + voltage = self._convert_string_to_num( + dom_voltage_data['data']['Vcc']['value']) + return voltage + else: + return None + elif self.sfp_type == SFP_TYPE: + offset = 256 + + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return None + + sfpd_obj._calibration_type = self.calibration + + dom_voltage_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_VOLT_OFFSET), SFP_VOLT_WIDTH) + if dom_voltage_raw is not None: + dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) + voltage = self._convert_string_to_num( + dom_voltage_data['data']['Vcc']['value']) + return voltage + else: + return None + else: + return None + + def get_tx_bias(self): + """ + Retrieves the TX bias current of this SFP + Returns: + A list of four integer numbers, representing TX bias in mA + for channel 0 to channel 4. + Ex. ['110.09', '111.12', '108.21', '112.09'] + """ + tx_bias_list = [] + if self.sfp_type == QSFP_TYPE: + offset = 0 + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = \ + sfpd_obj.parse_channel_monitor_params_with_tx_power(dom_channel_monitor_raw, 0) + tx_bias_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX1Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX2Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX3Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX4Bias']['value'])) + elif self.sfp_type == SFP_TYPE: + offset = 256 + + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return None + sfpd_obj._calibration_type = self.calibration + + if self.dom_supported: + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params( \ + dom_channel_monitor_raw, 0) + tx_bias_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TXBias']['value'])) + else: + return None + else: + return None + else: + return None + + return tx_bias_list + + def get_rx_power(self): + """ + Retrieves the received optical power for this SFP + Returns: + A list of four integer numbers, representing received optical + power in mW for channel 0 to channel 4. + Ex. ['1.77', '1.71', '1.68', '1.70'] + """ + rx_power_list = [] + + if self.sfp_type == QSFP_TYPE: + offset = 0 + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + if self.dom_rx_power_supported: + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = \ + sfpd_obj.parse_channel_monitor_params_with_tx_power(dom_channel_monitor_raw, 0) + rx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['RX1Power']['value'])) + rx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['RX2Power']['value'])) + rx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['RX3Power']['value'])) + rx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['RX4Power']['value'])) + else: + return None + else: + return None + elif self.sfp_type == SFP_TYPE: + offset = 256 + + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return None + + if self.dom_supported: + sfpd_obj._calibration_type = self.calibration + + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = \ + sfpd_obj.parse_channel_monitor_params(dom_channel_monitor_raw, 0) + rx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['RXPower']['value'])) + else: + return None + else: + return None + else: + return None + + return rx_power_list + + def get_tx_power(self): + """ + Retrieves the TX power of this SFP + Returns: + A list of four integer numbers, representing TX power in mW + for channel 0 to channel 4. + Ex. ['1.86', '1.86', '1.86', '1.86'] + """ + tx_power_list = [] + + if self.sfp_type == QSFP_TYPE: + offset = 0 + + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + + if self.dom_tx_power_supported: + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = \ + sfpd_obj.parse_channel_monitor_params_with_tx_power(dom_channel_monitor_raw, 0) + tx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX1Power']['value'])) + tx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX2Power']['value'])) + tx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX3Power']['value'])) + tx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX4Power']['value'])) + else: + return None + else: + return None + elif self.sfp_type == SFP_TYPE: + offset = 256 + sfpd_obj = sff8472Dom() + if sfpd_obj is None: + return None + + if self.dom_supported: + sfpd_obj._calibration_type = self.calibration + + dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) + if dom_channel_monitor_raw is not None: + dom_channel_monitor_data = \ + sfpd_obj.parse_channel_monitor_params(dom_channel_monitor_raw, 0) + tx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TXPower']['value'])) + else: + return None + else: + return None + else: + return None + + return tx_power_list + + def reset(self): + """ + Reset SFP and return all user module settings to their default state. + Returns: + A boolean, True if successful, False if not + """ + if not self.get_presence(): + return False + + # SFP doesn't support this feature + if self.sfp_type == SFP_TYPE: + return False + elif self.sfp_type == QSFP_TYPE: + sfp_info = self.port_to_i2c_mapping[int(self._port_cfgs[self.port_num].lanes.split(',')[0])] + cmd = 'i2cget -y 0 {0} {1}'.format(sfp_info[4], sfp_info[5]) + reset = int(Popen(cmd, stdout=PIPE, stderr=STDOUT, shell=True).stdout.readline(), 16) + + reset &= ~(1 << sfp_info[6]) + cmd = 'i2cset -y 0 {0} {1} {2}'.format(sfp_info[4], sfp_info[5], reset) + Popen(cmd, shell=True) + + reset |= (1 << sfp_info[6]) + cmd = 'i2cset -y 0 {0} {1} {2}'.format(sfp_info[4], sfp_info[5], reset) + Popen(cmd, shell=True) + + return True + + def tx_disable(self, tx_disable): + """ + Disable SFP TX for all channels + Args: + tx_disable : A Boolean, True to enable tx_disable mode, False to disable + tx_disable mode. + Returns: + A boolean, True if tx_disable is set successfully, False if not + """ + if not self.get_presence(): + return False + + if self.sfp_type == SFP_TYPE: + if self.dom_tx_disable_supported: + offset = 256 + sysfs_sfp_i2c_client_eeprom_path = self.port_to_eeprom_mapping[self.port_num] + status_control_raw = self.__read_eeprom_specific_bytes( + (offset + SFP_STATUS_CONTROL_OFFSET), SFP_STATUS_CONTROL_WIDTH) + if status_control_raw is not None: + # Set bit 6 for Soft TX Disable Select + # 01000000 = 64 and 10111111 = 191 + tx_disable_bit = 64 if tx_disable else 191 + status_control = int(status_control_raw[0], 16) + tx_disable_ctl = (status_control | tx_disable_bit) if tx_disable else ( + status_control & tx_disable_bit) + try: + sysfsfile_eeprom = open( + sysfs_sfp_i2c_client_eeprom_path, mode="r+b", buffering=0) + buffer = create_string_buffer(1) + buffer[0] = chr(tx_disable_ctl) + # Write to eeprom + sysfsfile_eeprom.seek(offset + SFP_STATUS_CONTROL_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + finally: + if sysfsfile_eeprom: + sysfsfile_eeprom.close() + time.sleep(0.01) + return True + return False + else: + return False + elif self.sfp_type == QSFP_TYPE: + if self.dom_tx_disable_supported: + channel_mask = 0x0f + if tx_disable: + return self.tx_disable_channel(channel_mask, True) + else: + return self.tx_disable_channel(channel_mask, False) + else: + return False + else: + return None + + def tx_disable_channel(self, channel, disable): + """ + Sets the tx_disable for specified SFP channels + Args: + channel : A hex of 4 bits (bit 0 to bit 3) which represent channel 0 to 3, + e.g. 0x5 for channel 0 and channel 2. + disable : A boolean, True to disable TX channels specified in channel, + False to enable + Returns: + A boolean, True if successful, False if not + """ + if not self.get_presence(): + return False + # SFP doesn't support this feature + if self.sfp_type == SFP_TYPE: + return False + elif self.sfp_type == QSFP_TYPE: + if self.dom_tx_disable_supported: + sysfsfile_eeprom = None + try: + channel_state = self.get_tx_disable_channel() + if disable: + tx_disable_ctl = channel_state | channel + else: + tx_disable_ctl = channel_state & (~channel) + buffer = create_string_buffer(1) + buffer[0] = chr(tx_disable_ctl) + # Write to eeprom + sysfsfile_eeprom = open( + self.port_to_eeprom_mapping[self.port_num], "r+b") + sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + return True + else: + return False + else: + return None + + def set_lpmode(self, lpmode): + """ + Sets the lpmode (low power mode) of SFP + Args: + lpmode: A Boolean, True to enable lpmode, False to disable it + Note : lpmode can be overridden by set_power_override + Returns: + A boolean, True if lpmode is set successfully, False if not + """ + return False + + def set_power_override(self, power_override, power_set): + """ + Sets SFP power level using power_override and power_set + Args: + power_override : + A Boolean, True to override set_lpmode and use power_set + to control SFP power, False to disable SFP power control + through power_override/power_set and use set_lpmode + to control SFP power. + power_set : + Only valid when power_override is True. + A Boolean, True to set SFP to low power mode, False to set + SFP to high power mode. + Returns: + A boolean, True if power-override and power_set are set successfully, + False if not + """ + # SFP doesn't support this feature + if not self.get_presence(): + return False + + if self.sfp_type == SFP_TYPE: + return False + elif self.sfp_type == QSFP_TYPE: + try: + power_override_bit = 0 + if power_override: + power_override_bit |= 1 << 0 + + power_set_bit = 0 + if power_set: + power_set_bit |= 1 << 1 + + buffer = create_string_buffer(1) + buffer[0] = chr(power_override_bit | power_set_bit) + # Write to eeprom + sysfsfile_eeprom = open(self.port_to_eeprom_mapping[self.port_num], "r+b") + sysfsfile_eeprom.seek(QSFP_POWEROVERRIDE_OFFSET) + sysfsfile_eeprom.write(buffer[0]) + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + else: + return None + + return True + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + return "Ethernet{}".format(self.port_num) + diff --git a/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/thermal.py b/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/thermal.py new file mode 100644 index 000000000000..ca4e35969269 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/48y8c/sonic_platform/thermal.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python + +############################################################################# +# Celestica +# +# Thermal contains an implementation of SONiC Platform Base API and +# provides the thermal device status which are available in the platform +# +############################################################################# + +import os +import os.path + +try: + from sonic_platform_base.thermal_base import ThermalBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Thermal(ThermalBase): + """Platform-specific Thermal class""" + + THERMAL_NAME_LIST = [] + CPUBOARD_SS_PATH = "/sys/class/hwmon/hwmon1" + + def __init__(self, thermal_index): + self.index = thermal_index + self.high_threshold = float(112) + + # Add thermal name + self.THERMAL_NAME_LIST.append("ASIC") + + # Set hwmon path + self.ss_index, self.hwmon_path = 1, self.CPUBOARD_SS_PATH + self.ss_key = self.THERMAL_NAME_LIST[self.index - 1] + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + data = fd.read() + return data.strip() + except IOError: + raise IOError("Unable to open %s file !" % file_path) + + def __get_temp(self, temp_file): + temp_file_path = os.path.join(self.hwmon_path, temp_file) + raw_temp = self.__read_txt_file(temp_file_path) + temp = float(raw_temp)/1000 + return float("{:.3f}".format(temp)) + + def __set_threshold(self, file_name, temperature): + temp_file_path = os.path.join(self.hwmon_path, file_name) + try: + with open(temp_file_path, 'w') as fd: + fd.write(str(temperature)) + return True + except IOError: + return False + + def get_temperature(self): + """ + Retrieves current temperature reading from thermal + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + temp_file = "temp{}_input".format(self.ss_index) + return self.__get_temp(temp_file) + + def get_high_threshold(self): + """ + Retrieves the high threshold temperature of thermal + Returns: + A float number, the high threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + return self.high_threshold + + def set_high_threshold(self, temperature): + """ + Sets the high threshold temperature of thermal + Args : + temperature: A float number up to nearest thousandth of one degree Celsius, + e.g. 30.125 + Returns: + A boolean, True if threshold is set successfully, False if not + """ + self.high_threshold = float(temperature) + return True + + def get_name(self): + """ + Retrieves the name of the thermal device + Returns: + string: The name of the thermal device + """ + return self.THERMAL_NAME_LIST[self.index] + + def get_presence(self): + """ + Retrieves the presence of the PSU + Returns: + bool: True if PSU is present, False if not + """ + temp_file = "temp{}_input".format(self.ss_index) + temp_file_path = os.path.join(self.hwmon_path, temp_file) + return os.path.isfile(temp_file_path) + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + if not self.get_presence(): + return False + + return True diff --git a/platform/centec/sonic-platform-modules-v682/LICENSE b/platform/centec/sonic-platform-modules-v682/LICENSE new file mode 100644 index 000000000000..865221641c92 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/LICENSE @@ -0,0 +1,15 @@ +Copyright (C) 2020 Centec, Inc + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/centec/sonic-platform-modules-v682/README.md b/platform/centec/sonic-platform-modules-v682/README.md new file mode 100644 index 000000000000..333262027acc --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/README.md @@ -0,0 +1 @@ +platform drivers for Centec V682 for the SONiC project diff --git a/platform/centec/sonic-platform-modules-v682/debian/changelog b/platform/centec/sonic-platform-modules-v682/debian/changelog new file mode 100644 index 000000000000..9be0e0dea84a --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/debian/changelog @@ -0,0 +1,5 @@ +sonic-centec-platform-modules (1.0) unstable; urgency=low + + * Initial release + + -- shil Mon, 30 Nov 2020 16:14:50 +0800 diff --git a/platform/centec/sonic-platform-modules-v682/debian/compat b/platform/centec/sonic-platform-modules-v682/debian/compat new file mode 100644 index 000000000000..ec635144f600 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/debian/compat @@ -0,0 +1 @@ +9 diff --git a/platform/centec/sonic-platform-modules-v682/debian/control b/platform/centec/sonic-platform-modules-v682/debian/control new file mode 100644 index 000000000000..3460d4b00ba5 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/debian/control @@ -0,0 +1,21 @@ +Source: sonic-centec-platform-modules +Section: main +Priority: extra +Maintainer: shil +Build-Depends: debhelper (>= 8.0.0), bzip2 +Standards-Version: 3.9.3 + +Package: platform-modules-v682-48y8c-d +Architecture: amd64 +Depends: linux-image-5.10.0-8-2-amd64-unsigned +Description: kernel modules for platform devices such as fan, led, sfp + +Package: platform-modules-v682-48y8c +Architecture: amd64 +Depends: linux-image-5.10.0-8-2-amd64-unsigned +Description: kernel modules for platform devices such as fan, led, sfp + +Package: platform-modules-v682-48x8c +Architecture: amd64 +Depends: linux-image-5.10.0-8-2-amd64-unsigned +Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48x8c.init b/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48x8c.init new file mode 100644 index 000000000000..16b23082d6f9 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48x8c.init @@ -0,0 +1,200 @@ +#!/bin/bash +# This script load/unload centec kernel modules + +### BEGIN INIT INFO +# Provides: platform-modules-v682-48x8c +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Load Centec kernel modules +### END INIT INFO + +function install_python_api_package() +{ + device="/usr/share/sonic/device" + platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) + + rv=$(pip3 show sonic-platform > /dev/null 2>/dev/null) + if [ $? -ne 0 ]; then + rv=$(pip3 install $device/$platform/sonic_platform-1.0-py3-none-any.whl) + fi +} + +function load_system_eeprom_file() +{ + device="/usr/share/sonic/device" + platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) + mkdir -p /mnt/onie-boot + mount -t ext4 -L ONIE-BOOT /mnt/onie-boot + dd if=/mnt/onie-boot/eeprom_file of=$device/$platform/eeprom_file bs=1 skip=1046528 + dd if=/mnt/onie-boot/eeprom_file of=$device/$platform/eeprom_cipher bs=1 count=32 + MACADDR=`decode-syseeprom | grep "Base MAC Address" | awk '{print $6}'` + ifconfig eth0 hw ether $MACADDR + umount /mnt/onie-boot + rmdir /mnt/onie-boot +} + +function load_kernel_modules() +{ + modprobe centec_v682_48x8c_platform + modprobe dal + modprobe knet + modprobe tun + modprobe tap +} + +function remove_kernel_modules() +{ + modprobe -r tap + modprobe -r tun + modprobe -r knet + modprobe -r dal + modprobe -r centec_v682_48x8c_platform +} + +function release_board() +{ + systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target + chmod a+x /usr/local/lib/python3.9/dist-packages/release.py + /usr/local/lib/python3.9/dist-packages/release.py +} + +function create_i2c_device_nodes() +{ + # load pca954x driver for pca9548 + modprobe i2c-mux-pca954x + modprobe optoe + + # i2c-0 for SMBus + # i2c-1 for CP2112 + # create i2c 2,3,4,5,6,7,8,9 for pca9548 0x70 channel 0,1,2,3,4,5,6,7 + echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-0/new_device + # create i2c 13,12,11,10,17,16,15,14 for fiber 0,1,2,3,4,5,6,7 + echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-2/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-13/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-12/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-11/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-10/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-17/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-16/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-15/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-14/new_device + # create i2c 21,20,19,18,25,24,23,22 for fiber 8,9,10,11,12,13,14,15 + echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-3/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-21/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-20/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-19/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-18/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-25/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-24/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-23/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-22/new_device + # create i2c 29,28,27,26,33,32,31,30 for fiber 16,17,18,19,20,21,22,23 + echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-4/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-29/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-28/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-27/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-26/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-33/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-32/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-31/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-30/new_device + # create i2c 37,36,35,34,41,40,39,38 for fiber 24,25,26,27,28,29,30,31 + echo pca9548 0x74 > /sys/bus/i2c/devices/i2c-6/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-37/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-36/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-35/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-34/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-41/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-40/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-39/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-38/new_device + # create i2c 45,44,43,42,49,48,47,46 for fiber 32,33,34,35,36,37,38,39 + echo pca9548 0x75 > /sys/bus/i2c/devices/i2c-7/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-45/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-44/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-43/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-42/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-49/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-48/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-47/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-46/new_device + # create i2c 53,52,51,50,57,56,55,54 for fiber 40,41,42,43,44,45,46,47 + echo pca9548 0x76 > /sys/bus/i2c/devices/i2c-8/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-53/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-52/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-51/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-50/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-57/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-56/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-55/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-54/new_device + # create i2c 61,60,59,58,65,64,63,62 for fiber 48,49,50,51,52,53,54,55 + echo pca9548 0x77 > /sys/bus/i2c/devices/i2c-5/new_device + echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-61/new_device + echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-60/new_device + echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-59/new_device + echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-58/new_device + echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-65/new_device + echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-64/new_device + echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-63/new_device + echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-62/new_device + + # for rtc sd2405 + echo sd2405 0x32 > /sys/bus/i2c/devices/i2c-0/new_device + # load rtc-sd2405 driver for rtc sd2405 + modprobe rtc-sd2405 + sleep 1 + hwclock -s -f /dev/rtc1 > /dev/null 2>&1 + + # for sensor lm77 + echo lm77 0x49 > /sys/bus/i2c/devices/i2c-0/new_device + # load lm77 driver for sensor lm77 + modprobe lm77 + + # for fan adt7470 + echo adt7470 0x2c > /sys/bus/i2c/devices/i2c-9/new_device + echo adt7470 0x2e > /sys/bus/i2c/devices/i2c-9/new_device + # load adt7470 driver for fan adt7470 + modprobe adt7470 +} + +case "$1" in +start) + echo -n "Init Centec V682-48X8C ... " + + depmod -a + modprobe i2c-dev + + release_board + load_kernel_modules + create_i2c_device_nodes + install_python_api_package + load_system_eeprom_file + + echo "done." + ;; + +stop) + echo -n "Deinit Centec V682-48X8C ... " + + remove_kernel_modules + + echo "done." + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/platform-modules-v682-48x8c {start|stop}" + exit 1 + ;; +esac + +exit 0 + diff --git a/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48x8c.install b/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48x8c.install new file mode 100644 index 000000000000..c798deffaede --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48x8c.install @@ -0,0 +1,2 @@ +48x8c/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-centec_v682_48x8c-r0 +48x8c/service/release.py usr/local/lib/python3.9/dist-packages diff --git a/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48x8c.postinst b/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48x8c.postinst new file mode 100644 index 000000000000..a4f0261a1d3e --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48x8c.postinst @@ -0,0 +1,2 @@ +systemctl enable 48x8c_platform.service +systemctl start 48x8c_platform.service diff --git a/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48y8c-d.init b/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48y8c-d.init new file mode 100644 index 000000000000..b74489e9a30d --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48y8c-d.init @@ -0,0 +1,101 @@ +#!/bin/bash +# This script load/unload centec kernel modules + +### BEGIN INIT INFO +# Provides: platform-modules-v682-48y8c-d +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Load Centec kernel modules +### END INIT INFO + +function install_python_api_package() +{ + device="/usr/share/sonic/device" + platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) + + rv=$(pip3 show sonic-platform > /dev/null 2>/dev/null) + if [ $? -ne 0 ]; then + rv=$(pip3 install $device/$platform/sonic_platform-1.0-py3-none-any.whl) + fi +} + +function load_system_eeprom_file() +{ + device="/usr/share/sonic/device" + platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) + mkdir -p /mnt/onie-boot + mount -t ext4 -L ONIE-BOOT /mnt/onie-boot + dd if=/mnt/onie-boot/eeprom_file of=$device/$platform/eeprom_file bs=1 skip=1046528 + dd if=/mnt/onie-boot/eeprom_file of=$device/$platform/eeprom_cipher bs=1 count=32 + MACADDR=`decode-syseeprom | grep "Base MAC Address" | awk '{print $6}'` + ifconfig eth0 hw ether $MACADDR + umount /mnt/onie-boot + rmdir /mnt/onie-boot +} + +function load_kernel_modules() +{ + depmod -a + modprobe i2c-dev + modprobe centec_v682_48y8c_d_platform + modprobe dal + modprobe tun + modprobe tap +} + +function remove_kernel_modules() +{ + modprobe -r tap + modprobe -r tun + modprobe -r dal + modprobe -r centec_v682_48y8c_d_platform + modprobe -r i2c-dev +} + +function release_board() +{ + systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target + + chmod a+x /usr/local/lib/python3.9/dist-packages/libSUSI-4.00.so.1 + chmod a+x /usr/local/lib/python3.9/dist-packages/_Susi4.so + chmod a+x /usr/local/lib/python3.9/dist-packages/release.py + /usr/local/lib/python3.9/dist-packages/release.py +} + + +case "$1" in +start) + echo -n "Load Centec kernel modules... " + + release_board + load_kernel_modules + install_python_api_package + load_system_eeprom_file + + echo "done." + ;; + +stop) + echo -n "Unload Centec kernel modules... " + + remove_kernel_modules + + echo "done." + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/platform-modules-v682-48y8c-d {start|stop}" + exit 1 + ;; +esac + +exit 0 + diff --git a/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48y8c-d.install b/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48y8c-d.install new file mode 100644 index 000000000000..8a5a1440cfe3 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48y8c-d.install @@ -0,0 +1,4 @@ +48y8c-d/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-centec_v682_48y8c_d-r0 +48y8c-d/service/release.py usr/local/lib/python3.9/dist-packages +48y8c-d/service/_Susi4.so usr/local/lib/python3.9/dist-packages +48y8c-d/service/libSUSI-4.00.so.1 usr/local/lib/python3.9/dist-packages diff --git a/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48y8c-d.postinst b/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48y8c-d.postinst new file mode 100644 index 000000000000..448ad2a10d14 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48y8c-d.postinst @@ -0,0 +1,2 @@ +systemctl enable 48y8c_d_platform.service +systemctl start 48y8c_d_platform.service diff --git a/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48y8c.init b/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48y8c.init new file mode 100644 index 000000000000..16a85d40e72b --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48y8c.init @@ -0,0 +1,200 @@ +#!/bin/bash +# This script load/unload centec kernel modules + +### BEGIN INIT INFO +# Provides: platform-modules-v682-48y8c +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Load Centec kernel modules +### END INIT INFO + +function install_python_api_package() +{ + device="/usr/share/sonic/device" + platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) + + rv=$(pip3 show sonic-platform > /dev/null 2>/dev/null) + if [ $? -ne 0 ]; then + rv=$(pip3 install $device/$platform/sonic_platform-1.0-py3-none-any.whl) + fi +} + +function load_system_eeprom_file() +{ + device="/usr/share/sonic/device" + platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) + mkdir -p /mnt/onie-boot + mount -t ext4 -L ONIE-BOOT /mnt/onie-boot + dd if=/mnt/onie-boot/eeprom_file of=$device/$platform/eeprom_file bs=1 skip=1046528 + dd if=/mnt/onie-boot/eeprom_file of=$device/$platform/eeprom_cipher bs=1 count=32 + MACADDR=`decode-syseeprom | grep "Base MAC Address" | awk '{print $6}'` + ifconfig eth0 hw ether $MACADDR + umount /mnt/onie-boot + rmdir /mnt/onie-boot +} + +function load_kernel_modules() +{ + modprobe centec_v682_48y8c_platform + modprobe dal + modprobe knet + modprobe tun + modprobe tap +} + +function remove_kernel_modules() +{ + modprobe -r tap + modprobe -r tun + modprobe -r knet + modprobe -r dal + modprobe -r centec_v682_48y8c_platform +} + +function release_board() +{ + systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target + chmod a+x /usr/local/lib/python3.9/dist-packages/release.py + /usr/local/lib/python3.9/dist-packages/release.py +} + +function create_i2c_device_nodes() +{ + # load pca954x driver for pca9548 + modprobe i2c-mux-pca954x + modprobe optoe + + # i2c-0 for SMBus + # i2c-1 for CP2112 + # create i2c 2,3,4,5,6,7,8,9 for pca9548 0x70 channel 0,1,2,3,4,5,6,7 + echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-0/new_device + # create i2c 13,12,11,10,17,16,15,14 for fiber 0,1,2,3,4,5,6,7 + echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-2/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-13/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-12/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-11/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-10/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-17/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-16/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-15/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-14/new_device + # create i2c 21,20,19,18,25,24,23,22 for fiber 8,9,10,11,12,13,14,15 + echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-3/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-21/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-20/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-19/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-18/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-25/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-24/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-23/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-22/new_device + # create i2c 29,28,27,26,33,32,31,30 for fiber 16,17,18,19,20,21,22,23 + echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-4/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-29/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-28/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-27/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-26/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-33/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-32/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-31/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-30/new_device + # create i2c 37,36,35,34,41,40,39,38 for fiber 24,25,26,27,28,29,30,31 + echo pca9548 0x74 > /sys/bus/i2c/devices/i2c-6/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-37/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-36/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-35/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-34/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-41/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-40/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-39/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-38/new_device + # create i2c 45,44,43,42,49,48,47,46 for fiber 32,33,34,35,36,37,38,39 + echo pca9548 0x75 > /sys/bus/i2c/devices/i2c-7/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-45/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-44/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-43/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-42/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-49/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-48/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-47/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-46/new_device + # create i2c 53,52,51,50,57,56,55,54 for fiber 40,41,42,43,44,45,46,47 + echo pca9548 0x76 > /sys/bus/i2c/devices/i2c-8/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-53/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-52/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-51/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-50/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-57/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-56/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-55/new_device + echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-54/new_device + # create i2c 61,60,59,58,65,64,63,62 for fiber 48,49,50,51,52,53,54,55 + echo pca9548 0x77 > /sys/bus/i2c/devices/i2c-5/new_device + echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-61/new_device + echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-60/new_device + echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-59/new_device + echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-58/new_device + echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-65/new_device + echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-64/new_device + echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-63/new_device + echo optoe1 0x50 > /sys/bus/i2c/devices/i2c-62/new_device + + # for rtc sd2405 + echo sd2405 0x32 > /sys/bus/i2c/devices/i2c-0/new_device + # load rtc-sd2405 driver for rtc sd2405 + modprobe rtc-sd2405 + sleep 1 + hwclock -s -f /dev/rtc1 > /dev/null 2>&1 + + # for sensor lm77 + echo lm77 0x49 > /sys/bus/i2c/devices/i2c-0/new_device + # load lm77 driver for sensor lm77 + modprobe lm77 + + # for fan adt7470 + echo adt7470 0x2c > /sys/bus/i2c/devices/i2c-9/new_device + echo adt7470 0x2e > /sys/bus/i2c/devices/i2c-9/new_device + # load adt7470 driver for fan adt7470 + modprobe adt7470 +} + +case "$1" in +start) + echo -n "Init Centec V682-48Y8C ... " + + depmod -a + modprobe i2c-dev + + release_board + load_kernel_modules + create_i2c_device_nodes + install_python_api_package + load_system_eeprom_file + + echo "done." + ;; + +stop) + echo -n "Deinit Centec V682-48Y8C ... " + + remove_kernel_modules + + echo "done." + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/platform-modules-v682-48y8c {start|stop}" + exit 1 + ;; +esac + +exit 0 + diff --git a/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48y8c.install b/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48y8c.install new file mode 100644 index 000000000000..999baedb4b20 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48y8c.install @@ -0,0 +1,2 @@ +48y8c/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-centec_v682_48y8c-r0 +48y8c/service/release.py usr/local/lib/python3.9/dist-packages diff --git a/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48y8c.postinst b/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48y8c.postinst new file mode 100644 index 000000000000..30915b9e6fe0 --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/debian/platform-modules-v682-48y8c.postinst @@ -0,0 +1,2 @@ +systemctl enable 48y8c_platform.service +systemctl start 48y8c_platform.service diff --git a/platform/centec/sonic-platform-modules-v682/debian/rules b/platform/centec/sonic-platform-modules-v682/debian/rules new file mode 100755 index 000000000000..2e0e0dc0ffee --- /dev/null +++ b/platform/centec/sonic-platform-modules-v682/debian/rules @@ -0,0 +1,99 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +include /usr/share/dpkg/pkg-info.mk + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +export INSTALL_MOD_DIR:=extra + +PACKAGE_PRE_NAME := platform-modules-v682 +KVERSION ?= $(shell uname -r) +KERNEL_SRC := /lib/modules/$(KVERSION) +MOD_SRC_DIR:= $(shell pwd) +MODULE_DIRS:= 48y8c-d 48y8c 48x8c +MODULE_DIR := modules +SERVICE_DIR := service +CLASSES_DIR := classes +CONF_DIR := conf +KDAL_DIR := centec-dal/ + +%: + dh $@ + +clean: + dh_testdir + dh_testroot + dh_clean + +build: + rm $(MOD_SRC_DIR)/$(KDAL_DIR) -rf + cp ../../centec/centec-dal/ $(MOD_SRC_DIR)/$(KDAL_DIR) -rf + (for mod in $(KDAL_DIR); do \ + make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/; \ + done) + (for mod in $(MODULE_DIRS); do \ + make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ + cd $${mod}; \ + python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ + cd -; \ + done) + # third party driver for cpu card + (for mod in $(MODULE_DIRS); do \ + rm $(MOD_SRC_DIR)/$${mod}/service/_Susi4.so $(MOD_SRC_DIR)/$${mod}/service/libSUSI-4.00.so.1 -rf; \ + cd $(MOD_SRC_DIR)/$${mod}/service; \ + wget https://github.com/CentecNetworks/sonic-binaries/raw/master/amd64/third_party/advantech/_Susi4.so; \ + wget https://github.com/CentecNetworks/sonic-binaries/raw/master/amd64/third_party/advantech/libSUSI-4.00.so.1; \ + cd -; \ + chmod a+x $(MOD_SRC_DIR)/$${mod}/service/_Susi4.so $(MOD_SRC_DIR)/$${mod}/service/libSUSI-4.00.so.1; \ + done) + +binary: binary-arch binary-indep + # Nothing to do + +binary-arch: + # Nothing to do + +#install: build + #dh_testdir + #dh_testroot + #dh_clean -k + #dh_installdirs + +binary-indep: + dh_testdir + dh_installdirs + + # Custom package commands + (for mod in $(MODULE_DIRS); do \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} lib/systemd/system; \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} etc; \ + cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \ + cp $(MOD_SRC_DIR)/$(KDAL_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + done) + rm $(MOD_SRC_DIR)/$(KDAL_DIR) -rf + # Resuming debhelper scripts + dh_testroot + dh_install + dh_installchangelogs + dh_installdocs + dh_systemd_enable + dh_installinit + dh_systemd_start + dh_link + dh_fixperms + dh_compress + dh_strip + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb +.PHONY: build binary binary-arch binary-indep clean diff --git a/platform/components/docker-gbsyncd-credo.mk b/platform/components/docker-gbsyncd-credo.mk index 0dc6875efe85..4f7c37980dee 100644 --- a/platform/components/docker-gbsyncd-credo.mk +++ b/platform/components/docker-gbsyncd-credo.mk @@ -1,15 +1,14 @@ DOCKER_GBSYNCD_PLATFORM_CODE = credo -LIBSAI_CREDO = libsaicredo_0.5.2_amd64.deb -$(LIBSAI_CREDO)_URL = "https://sonicstorage.blob.core.windows.net/packages/credosai/libsaicredo_0.5.2_amd64.deb?st=2021-08-20T01%3A39%3A58Z&se=2100-08-21T01%3A39%3A00Z&sp=rl&sv=2018-03-28&sr=b&sig=H3Ew%2Be17i9VN%2BZ6cmAmLuTEDDK%2FsJ65WUHiINTzB9eE%3D" -LIBSAI_CREDO_OWL = libsaicredo-owl_0.5.2_amd64.deb -$(LIBSAI_CREDO_OWL)_URL = "https://sonicstorage.blob.core.windows.net/packages/credosai/libsaicredo-owl_0.5.2_amd64.deb?st=2021-08-20T01%3A39%3A09Z&se=2100-08-21T01%3A39%3A00Z&sp=rl&sv=2018-03-28&sr=b&sig=YB%2BnILFF2Z4tIbu3utcCG857Y6ae7vS5Qmyk3pzscIw%3D" +LIBSAI_CREDO = libsaicredo_0.7.2_amd64.deb +$(LIBSAI_CREDO)_URL = "https://sonicstorage.blob.core.windows.net/packages/credosai/libsaicredo_0.7.2_amd64.deb?sv=2020-08-04&st=2021-11-23T03%3A17%3A40Z&se=2100-11-24T03%3A17%3A00Z&sr=b&sp=r&sig=q1hj3YHdkSnaKkN%2Bv0SYw01keE4ottLffuxSGre9mu0%3D" +LIBSAI_CREDO_OWL = libsaicredo-owl_0.7.2_amd64.deb +$(LIBSAI_CREDO_OWL)_URL = "https://sonicstorage.blob.core.windows.net/packages/credosai/libsaicredo-owl_0.7.2_amd64.deb?sv=2020-08-04&st=2021-11-23T03%3A50%3A31Z&se=2100-11-24T03%3A50%3A00Z&sr=b&sp=r&sig=mhiqfhHsBwa5AZOuNSj0U8uLsr46Tet6OGC41Mx5B6I%3D" ifneq ($($(LIBSAI_CREDO)_URL),) include $(PLATFORM_PATH)/../template/docker-gbsyncd-base.mk $(DOCKER_GBSYNCD_BASE)_VERSION = 1.0.0 $(DOCKER_GBSYNCD_BASE)_PACKAGE_NAME = gbsyncd -$(DOCKER_GBSYNCD_BASE)_CONTAINER_NAME = gbsyncd-$(DOCKER_GBSYNCD_PLATFORM_CODE) $(DOCKER_GBSYNCD_BASE)_PATH = $(PLATFORM_PATH)/../components/docker-gbsyncd-$(DOCKER_GBSYNCD_PLATFORM_CODE) SONIC_ONLINE_DEBS += $(LIBSAI_CREDO) $(LIBSAI_CREDO_OWL) $(DOCKER_GBSYNCD_BASE)_DEPENDS += $(SYNCD) $(LIBSAI_CREDO) $(LIBSAI_CREDO_OWL) diff --git a/platform/components/docker-gbsyncd-credo/Dockerfile.j2 b/platform/components/docker-gbsyncd-credo/Dockerfile.j2 index f82ea0e6c77d..1b9631707cb6 100644 --- a/platform/components/docker-gbsyncd-credo/Dockerfile.j2 +++ b/platform/components/docker-gbsyncd-credo/Dockerfile.j2 @@ -8,7 +8,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update -RUN apt-get install -f -y iproute2 libcap2-bin libprotobuf-dev +RUN apt-get install -f -y iproute2 libcap2-bin COPY \ {% for deb in docker_gbsyncd_credo_debs.split(' ') -%} @@ -27,6 +27,7 @@ debs/{{ deb }}{{' '}} COPY ["docker-init.sh", "/usr/bin/"] COPY ["start.sh", "/usr/bin/"] +COPY ["crshell", "/usr/bin/"] COPY ["critical_processes.j2", "/usr/share/sonic/templates"] COPY ["supervisord.conf.j2", "/usr/share/sonic/templates"] diff --git a/platform/components/docker-gbsyncd-credo/crshell b/platform/components/docker-gbsyncd-credo/crshell new file mode 100755 index 000000000000..d8f18e52bb22 --- /dev/null +++ b/platform/components/docker-gbsyncd-credo/crshell @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +import socket +import time +from subprocess import call + +HOST = '127.0.0.1' # Standard loopback interface address (localhost) +PORT = 8299 # Port to listen on (non-privileged ports are > 1023) + +def main() -> None: + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + + s.connect((HOST, PORT)) + s.send(b'debug_shell') + + time.sleep(1) + + call(["/usr/bin/crcli"]) + + s.close() + return + +if __name__ == '__main__': + main() + diff --git a/platform/innovium/docker-syncd-invm-rpc.mk b/platform/innovium/docker-syncd-invm-rpc.mk index 8ccbef57dd4f..fc526fc22f6d 100755 --- a/platform/innovium/docker-syncd-invm-rpc.mk +++ b/platform/innovium/docker-syncd-invm-rpc.mk @@ -10,7 +10,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_INVM_RPC) endif $(DOCKER_SYNCD_INVM_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_INVM_RPC)_VERSION = 1.0.0-rpc +$(DOCKER_SYNCD_INVM_RPC)_VERSION = 1.0.0+rpc $(DOCKER_SYNCD_INVM_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_INVM_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_INVM_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/innovium/one-image.mk b/platform/innovium/one-image.mk index c88ec5e65cdf..bf1267041252 100755 --- a/platform/innovium/one-image.mk +++ b/platform/innovium/one-image.mk @@ -6,6 +6,7 @@ $(SONIC_ONE_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR) $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(CEL_MIDSTONE_200I_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELTA_PLATFORM_MODULE) +$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(NETBERG_AURORA_715_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_INSTALLS += $(INVM_DRV) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/innovium/platform-modules-netberg.mk b/platform/innovium/platform-modules-netberg.mk new file mode 100755 index 000000000000..819b8a1eaa43 --- /dev/null +++ b/platform/innovium/platform-modules-netberg.mk @@ -0,0 +1,13 @@ +# Netberg Platform modules + +NETBERG_AURORA_715_PLATFORM_MODULE_VERSION = 1.0.0 + +export NETBERG_AURORA_715_PLATFORM_MODULE_VERSION + +NETBERG_AURORA_715_PLATFORM_MODULE = sonic-platform-netberg-aurora-715_$(NETBERG_AURORA_715_PLATFORM_MODULE_VERSION)_amd64.deb +$(NETBERG_AURORA_715_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-netberg +$(NETBERG_AURORA_715_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(NETBERG_AURORA_715_PLATFORM_MODULE)_PLATFORM = x86_64-netberg_aurora_715-r0 +SONIC_DPKG_DEBS += $(NETBERG_AURORA_715_PLATFORM_MODULE) + +SONIC_STRETCH_DEBS +=$(NETBERG_AURORA_715_PLATFORM_MODULE) diff --git a/platform/innovium/rules.mk b/platform/innovium/rules.mk index ea23466ad578..9cf6dd2bf259 100755 --- a/platform/innovium/rules.mk +++ b/platform/innovium/rules.mk @@ -1,6 +1,7 @@ include $(PLATFORM_PATH)/invm-sai.mk include $(PLATFORM_PATH)/platform-modules-cel.mk include $(PLATFORM_PATH)/platform-modules-delta.mk +include $(PLATFORM_PATH)/platform-modules-netberg.mk include $(PLATFORM_PATH)/docker-syncd-invm.mk include $(PLATFORM_PATH)/docker-syncd-invm-rpc.mk include $(PLATFORM_PATH)/one-image.mk diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/Makefile b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/Makefile new file mode 100644 index 000000000000..189a3ae47157 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/Makefile @@ -0,0 +1,4 @@ +obj-m := x86-64-netberg-aurora-715.o +x86-64-netberg-aurora-715-objs := x86-64-netberg-aurora-715-common.o x86-64-netberg-aurora-715-sys.o \ +x86-64-netberg-aurora-715-led.o x86-64-netberg-aurora-715-fan.o x86-64-netberg-aurora-715-power.o \ +x86-64-netberg-aurora-715-thermal.o x86-64-netberg-aurora-715-qsfp.o diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-common.c b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-common.c new file mode 100644 index 000000000000..f73295f832bf --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-common.c @@ -0,0 +1,399 @@ +/* An hwmon driver for Netberg Aurora 715 Innovium i2c Module */ +#pragma GCC diagnostic ignored "-Wformat-zero-length" +#include "x86-64-netberg-aurora-715.h" +#include "x86-64-netberg-aurora-715-common.h" + +/* Addresses scanned */ +static const unsigned short normal_i2c[] = { 0x30, 0x31, 0x32, I2C_CLIENT_END }; +static int debug = 0; + + +/* i2c_client Declaration */ +struct i2c_client *Netberg_CPLD_30_client; //0x30 for SYS CPLD +struct i2c_client *Netberg_CPLD_31_client; //0x31 for Port 01-16 +struct i2c_client *Netberg_CPLD_32_client; //0x32 for Port 17-32 +struct i2c_client *Netberg_CPLD_23_client; //0x23 for Fan CPLD +struct i2c_client *Netberg_CPLD_35_client; //0x35 for Power CPLD +struct i2c_client *Netberg_BMC_14_client; //0x14 for BMC slave +struct i2c_client *Netberg_EEPROM_56_client; //0x56 for EEPROM + +/* end of i2c_client Declaration */ + +/* register offset define */ +#define BMC_EN_REG 0xA4 +/* end of register offset define */ + +/* common function */ +int bmc_enable(void) +{ + if ((i2c_smbus_read_byte_data(Netberg_CPLD_30_client, BMC_EN_REG) & BIT_0_MASK) == 0x01) + { + return ENABLE; + } + else + { + return DISABLE; + } +} + +int read_8bit_temp(u8 sign,u8 value) +{ + int result = 0; + if(sign) + { + //printf("read_8bit_temp UP %d\n", value & 0x80); + value = ~(value)+1; + result = value; + return result; + } + else + { + //printf("read_8bit_temp DOWN %d\n", value & 0x80); + result = value; + return result; + } +} + +/* end of common function*/ + +static int Netberg_i2c_probe(struct i2c_client *client, const struct i2c_device_id *dev_id) +{ + struct Netberg_i2c_data *Netberg_CPLD_30_data; + struct Netberg_i2c_data *Netberg_CPLD_31_data; + struct Netberg_i2c_data *Netberg_CPLD_32_data; + struct Netberg_i2c_data *Netberg_CPLD_23_data; + struct Netberg_i2c_data *Netberg_CPLD_35_data; + struct Netberg_i2c_data *Netberg_BMC_14_data; + + struct eeprom_data *Netberg_EEPROM_56_data; + + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) + { + status = -EIO; + goto exit; + } + + if (!(Netberg_CPLD_30_data = kzalloc(sizeof(struct Netberg_i2c_data), GFP_KERNEL))) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + + if (!(Netberg_CPLD_31_data = kzalloc(sizeof(struct Netberg_i2c_data), GFP_KERNEL))) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + + if (!(Netberg_CPLD_32_data = kzalloc(sizeof(struct Netberg_i2c_data), GFP_KERNEL))) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + + if (!(Netberg_CPLD_23_data = kzalloc(sizeof(struct Netberg_i2c_data), GFP_KERNEL))) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + + if (!(Netberg_CPLD_35_data = kzalloc(sizeof(struct Netberg_i2c_data), GFP_KERNEL))) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + + if (!(Netberg_BMC_14_data = kzalloc(sizeof(struct Netberg_i2c_data), GFP_KERNEL))) + { + printk(KERN_ALERT "kzalloc fail\n"); + status = -ENOMEM; + goto exit; + } + + if (!(Netberg_EEPROM_56_data = kzalloc(sizeof(struct eeprom_data), GFP_KERNEL))) + { + status = -ENOMEM; + goto exit; + } + memset(Netberg_EEPROM_56_data->data, 0xff, EEPROM_SIZE); + + i2c_set_clientdata(Netberg_CPLD_30_client, Netberg_CPLD_30_data); + i2c_set_clientdata(Netberg_CPLD_31_client, Netberg_CPLD_31_data); + i2c_set_clientdata(Netberg_CPLD_32_client, Netberg_CPLD_32_data); + i2c_set_clientdata(Netberg_CPLD_23_client, Netberg_CPLD_23_data); + i2c_set_clientdata(Netberg_CPLD_35_client, Netberg_CPLD_35_data); + i2c_set_clientdata(Netberg_BMC_14_client , Netberg_BMC_14_data); + i2c_set_clientdata(Netberg_EEPROM_56_client, Netberg_EEPROM_56_data); + + mutex_init(&Netberg_CPLD_30_data->update_lock); + mutex_init(&Netberg_CPLD_31_data->update_lock); + mutex_init(&Netberg_CPLD_32_data->update_lock); + mutex_init(&Netberg_CPLD_23_data->update_lock); + mutex_init(&Netberg_CPLD_35_data->update_lock); + mutex_init(&Netberg_BMC_14_data->update_lock); + mutex_init(&Netberg_EEPROM_56_data->update_lock); + + Netberg_CPLD_30_data->valid = 0; + mutex_init(&Netberg_CPLD_30_data->update_lock); + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &NBA715_SYS_group); + if (status) + { + goto exit_free; + } + + status = sysfs_create_group(&client->dev.kobj, &NBA715_LED_group); + if (status) + { + goto exit_free; + } + + status = sysfs_create_group(&client->dev.kobj, &NBA715_FAN_group); + if (status) + { + goto exit_free; + } + + status = sysfs_create_group(&client->dev.kobj, &NBA715_THERMAL_group); + if (status) + { + goto exit_free; + } + + status = sysfs_create_group(&client->dev.kobj, &NBA715_POWER_group); + if (status) + { + goto exit_free; + } + + status = sysfs_create_group(&client->dev.kobj, &NBA715_QSFP_group); + if (status) + { + goto exit_free; + } + + /* create the sysfs eeprom file */ + status = sysfs_create_bin_file(&client->dev.kobj, &net_eeprom_attr); + if (status) { + goto exit_free; + } + + + Netberg_CPLD_30_data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(Netberg_CPLD_30_data->hwmon_dev)) + { + status = PTR_ERR(Netberg_CPLD_30_data->hwmon_dev); + goto exit_remove; + } + dev_info(&client->dev, "%s: '%s'\n", dev_name(Netberg_CPLD_30_data->hwmon_dev), client->name); + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &NBA715_SYS_group); + sysfs_remove_group(&client->dev.kobj, &NBA715_LED_group); + sysfs_remove_group(&client->dev.kobj, &NBA715_FAN_group); + sysfs_remove_group(&client->dev.kobj, &NBA715_THERMAL_group); + sysfs_remove_group(&client->dev.kobj, &NBA715_POWER_group); + sysfs_remove_group(&client->dev.kobj, &NBA715_QSFP_group); + +exit_free: + kfree(Netberg_CPLD_30_data); + kfree(Netberg_EEPROM_56_data); + +exit: + return status; +} + +static int Netberg_i2c_remove(struct i2c_client *client) +{ + struct Netberg_i2c_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &NBA715_SYS_group); + sysfs_remove_group(&client->dev.kobj, &NBA715_LED_group); + sysfs_remove_group(&client->dev.kobj, &NBA715_FAN_group); + sysfs_remove_group(&client->dev.kobj, &NBA715_THERMAL_group); + sysfs_remove_group(&client->dev.kobj, &NBA715_POWER_group); + sysfs_remove_group(&client->dev.kobj, &NBA715_QSFP_group); + + sysfs_remove_bin_file(&client->dev.kobj, &net_eeprom_attr); + + kfree(data); + return 0; +} + +static const struct i2c_device_id Netberg_i2c_id[] = +{ + { "Netberg_CPLD_30", 0 }, + {}, +}; +MODULE_DEVICE_TABLE(i2c, Netberg_i2c_id); + +static struct i2c_driver Netberg_i2c_driver = +{ + .class = I2C_CLASS_HWMON, + .driver = + { + .name = "NBA_715_i2c", + }, + .probe = Netberg_i2c_probe, + .remove = Netberg_i2c_remove, + .id_table = Netberg_i2c_id, + .address_list = normal_i2c, +}; + +/*For main Switch board*/ +static struct i2c_board_info Netberg_CPLD_30_info[] __initdata = +{ + { + I2C_BOARD_INFO("Netberg_CPLD_30", 0x30), + .platform_data = NULL, + }, +}; + +/*For QSFP Port 01 - 16*/ +static struct i2c_board_info Netberg_CPLD_31_info[] __initdata = +{ + { + I2C_BOARD_INFO("Netberg_CPLD_31", 0x31), + .platform_data = NULL, + }, +}; +/*For QSFP Port 17 - 32*/ +static struct i2c_board_info Netberg_CPLD_32_info[] __initdata = +{ + { + I2C_BOARD_INFO("Netberg_CPLD_32", 0x32), + .platform_data = NULL, + }, +}; +/*For Fan status*/ +static struct i2c_board_info Netberg_CPLD_23_info[] __initdata = +{ + { + I2C_BOARD_INFO("Netberg_CPLD_23", 0x23), + .platform_data = NULL, + }, +}; +/*For Power status*/ +static struct i2c_board_info Netberg_CPLD_35_info[] __initdata = +{ + { + I2C_BOARD_INFO("Netberg_CPLD_35", 0x35), + .platform_data = NULL, + }, +}; +/*For BMC Slave*/ +static struct i2c_board_info Netberg_BMC_14_info[] __initdata = +{ + { + I2C_BOARD_INFO("Netberg_BMC_14", 0x14), + .platform_data = NULL, + }, +}; + +static struct i2c_board_info Netberg_EEPROM_56_info[] __initdata = +{ + { + I2C_BOARD_INFO("Netberg_EEPROM_56", 0x56), + .platform_data = NULL, + }, +}; + + +static int __init Netberg_i2c_init(void) +{ + int ret; + int cmp; + char keyword[] = "SMBus I801"; + char buf1[128]; + struct i2c_adapter *i2c_adap; + struct file *fp; + mm_segment_t fs; + loff_t pos; + + printk("Open file...\n"); + fp = filp_open("/sys/class/i2c-dev/i2c-0/name", O_RDONLY , 0644); + if (IS_ERR(fp)) { + printk("Open file FAILED\n"); + return -1; + } + + fs = get_fs(); + set_fs(KERNEL_DS); + pos = 0; + vfs_read(fp, buf1, sizeof(buf1), &pos); + printk("Detect %s\n", buf1); + cmp = strncmp(keyword, buf1, sizeof(keyword)-1); + set_fs(fs); + + filp_close(fp, NULL); + + if(cmp == 0) + { + i2c_adap = i2c_get_adapter(0); + printk("SMBus I801 is at bus 0\n"); + } + else + { + i2c_adap = i2c_get_adapter(1); + printk("SMBus I801 is at bus 1\n"); + } + + if (i2c_adap == NULL) + { + printk("ERROR: i2c_get_adapter FAILED!\n"); + return -1; + } + Netberg_CPLD_30_client = i2c_new_device(i2c_adap, &Netberg_CPLD_30_info[0]); + Netberg_CPLD_31_client = i2c_new_device(i2c_adap, &Netberg_CPLD_31_info[0]); + Netberg_CPLD_32_client = i2c_new_device(i2c_adap, &Netberg_CPLD_32_info[0]); + Netberg_CPLD_23_client = i2c_new_device(i2c_adap, &Netberg_CPLD_23_info[0]); + Netberg_CPLD_35_client = i2c_new_device(i2c_adap, &Netberg_CPLD_35_info[0]); + Netberg_BMC_14_client = i2c_new_device(i2c_adap, &Netberg_BMC_14_info[0]); + Netberg_EEPROM_56_client = i2c_new_device(i2c_adap, &Netberg_EEPROM_56_info[0]); + + if (Netberg_CPLD_30_info == NULL || Netberg_CPLD_31_info == NULL || Netberg_CPLD_32_info == NULL + || Netberg_CPLD_23_info == NULL || Netberg_CPLD_35_info == NULL || Netberg_BMC_14_info == NULL + || Netberg_EEPROM_56_info == NULL) + { + printk("ERROR: i2c_new_device FAILED!\n"); + return -1; + } + + i2c_put_adapter(i2c_adap); + ret = i2c_add_driver(&Netberg_i2c_driver); + printk(KERN_ALERT "NBA715 i2c Driver Version: %s\n", DRIVER_VERSION); + printk(KERN_ALERT "NBA715 i2c Driver INSTALL SUCCESS\n"); + return ret; +} + +static void __exit Netberg_i2c_exit(void) +{ + i2c_unregister_device(Netberg_CPLD_30_client); + i2c_unregister_device(Netberg_CPLD_31_client); + i2c_unregister_device(Netberg_CPLD_32_client); + i2c_unregister_device(Netberg_CPLD_23_client); + i2c_unregister_device(Netberg_CPLD_35_client); + i2c_unregister_device(Netberg_BMC_14_client); + i2c_unregister_device(Netberg_EEPROM_56_client); + i2c_del_driver(&Netberg_i2c_driver); + printk(KERN_ALERT "NBA715 i2c Driver UNINSTALL SUCCESS\n"); +} + +MODULE_AUTHOR("Netberg Inc."); +MODULE_DESCRIPTION("Netberg Aurora 715 i2c Driver"); +MODULE_LICENSE("GPL"); +module_param(debug, int, 0); +MODULE_PARM_DESC(debug, "Enable debugging (0-1)"); + +module_init(Netberg_i2c_init); +module_exit(Netberg_i2c_exit); diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-common.h b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-common.h new file mode 100644 index 000000000000..39e5ab15e950 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-common.h @@ -0,0 +1,25 @@ +/* register offset define */ +#define ENABLE 1 +#define DISABLE 0 + +#define PASSED 1 +#define FAILED 0 + +#define TRUE 1 +#define FALSE 0 + +#define ABNORMAL 1 +#define NORMAL 0 + +#define BIT_0_MASK 0x01 +#define BIT_1_MASK 0x02 +#define BIT_2_MASK 0x04 +#define BIT_3_MASK 0x08 +#define BIT_4_MASK 0x10 +#define BIT_5_MASK 0x20 +#define BIT_6_MASK 0x40 +#define BIT_7_MASK 0x80 +/* end of register offset define */ + +int bmc_enable(void); +int read_8bit_temp(u8 sign,u8 value); \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-fan.c b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-fan.c new file mode 100644 index 000000000000..4cb4d7ebfa55 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-fan.c @@ -0,0 +1,365 @@ +/* An hwmon driver for Netberg Aurora 715 Innovium i2c Module */ +#pragma GCC diagnostic ignored "-Wformat-zero-length" +#include "x86-64-netberg-aurora-715.h" +#include "x86-64-netberg-aurora-715-common.h" +#include "x86-64-netberg-aurora-715-fan.h" + +/* extern i2c_client */ +extern struct i2c_client *Netberg_CPLD_23_client; //0x23 for Fan CPLD +extern struct i2c_client *Netberg_BMC_14_client; //0x14 for BMC slave +/* end of extern i2c_client */ + +/* implement i2c_function */ +ssize_t fan_ctrl_mode_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *data = i2c_get_clientdata(Netberg_BMC_14_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + if (attr->index == FANCTRL_MODE) + { + if( bmc_enable() == ENABLE) + { + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, FANCTRL_MODE_REG); + if(status == 0xff || status < 0) + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + else + { + sprintf(buf, "%s0x%x\n", buf, status); + } + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + } + mutex_unlock(&data->update_lock); + return sprintf(buf, "%s\n", buf); +} + +ssize_t fan_ctrl_rpm_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *data = i2c_get_clientdata(Netberg_BMC_14_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + if (attr->index == FANCTRL_RPM) + { + if( bmc_enable() == ENABLE) + { + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, FANCTRL_RPM_REG); + if(status == 0xff || status < 0) + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + else + { + sprintf(buf, "%s0x%x\n", buf, status); + } + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + } + mutex_unlock(&data->update_lock); + return sprintf(buf, "%s\n", buf); +} + +ssize_t fan_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int result = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *Netberg_CPLD_23_data = i2c_get_clientdata(Netberg_CPLD_23_client); + struct Netberg_i2c_data *Netberg_BMC_14_data = i2c_get_clientdata(Netberg_BMC_14_client); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + mutex_lock(&Netberg_BMC_14_data->update_lock); + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, BMC_FAN_STAT_REG); + mutex_unlock(&Netberg_BMC_14_data->update_lock); + } + else + { + mutex_lock(&Netberg_CPLD_23_data->update_lock); + status = i2c_smbus_read_byte_data(Netberg_CPLD_23_client, FAN_STAT_REG); + mutex_unlock(&Netberg_CPLD_23_data->update_lock); + } + + result = FAILED; + switch (attr->index) + { + case 1: + if(status & BIT_0_MASK) + { + result = PASSED; + } + break; + case 2: + if(status & BIT_1_MASK) + { + result = PASSED; + } + break; + case 3: + if(status & BIT_2_MASK) + { + result = PASSED; + } + break; + case 4: + if(status & BIT_3_MASK) + { + result = PASSED; + } + break; + case 5: + if(status & BIT_4_MASK) + { + result = PASSED; + } + break; + } + if(result != PASSED) + { + return sprintf(buf, "%s%d\n", buf, FAILED); + } + return sprintf(buf, "%s%d\n", buf, PASSED); +} + +ssize_t fan_present_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int result = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *Netberg_CPLD_23_data = i2c_get_clientdata(Netberg_CPLD_23_client); + struct Netberg_i2c_data *Netberg_BMC_14_data = i2c_get_clientdata(Netberg_BMC_14_client); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + mutex_lock(&Netberg_BMC_14_data->update_lock); + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, BMC_FAN_PRESENT_REG); + mutex_unlock(&Netberg_BMC_14_data->update_lock); + } + else + { + mutex_lock(&Netberg_CPLD_23_data->update_lock); + status = i2c_smbus_read_byte_data(Netberg_CPLD_23_client, FAN_PRESENT_REG); + mutex_unlock(&Netberg_CPLD_23_data->update_lock); + } + + result = FAILED; + switch (attr->index) + { + case 1: + if(status & BIT_0_MASK) + { + result = PASSED; + } + break; + case 2: + if(status & BIT_1_MASK) + { + result = PASSED; + } + break; + case 3: + if(status & BIT_2_MASK) + { + result = PASSED; + } + break; + case 4: + if(status & BIT_3_MASK) + { + result = PASSED; + } + break; + case 5: + if(status & BIT_4_MASK) + { + result = PASSED; + } + break; + } + if(result != PASSED) + { + return sprintf(buf, "%s%d\n", buf, FAILED); + } + return sprintf(buf, "%s%d\n", buf, PASSED); +} + +ssize_t fan_power_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int result = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *Netberg_CPLD_23_data = i2c_get_clientdata(Netberg_CPLD_23_client); + struct Netberg_i2c_data *Netberg_BMC_14_data = i2c_get_clientdata(Netberg_BMC_14_client); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + mutex_lock(&Netberg_BMC_14_data->update_lock); + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, BMC_FAN_POWER_REG); + mutex_unlock(&Netberg_BMC_14_data->update_lock); + } + else + { + mutex_lock(&Netberg_CPLD_23_data->update_lock); + status = i2c_smbus_read_byte_data(Netberg_CPLD_23_client, FAN_POWER_REG); + mutex_unlock(&Netberg_CPLD_23_data->update_lock); + } + + result = FAILED; + switch (attr->index) + { + case 1: + if(status & BIT_0_MASK) + { + result = PASSED; + } + break; + case 2: + if(status & BIT_1_MASK) + { + result = PASSED; + } + break; + case 3: + if(status & BIT_2_MASK) + { + result = PASSED; + } + break; + case 4: + if(status & BIT_3_MASK) + { + result = PASSED; + } + break; + case 5: + if(status & BIT_4_MASK) + { + result = PASSED; + } + break; + } + if(result != PASSED) + { + return sprintf(buf, "%s%d\n", buf, FAILED); + } + return sprintf(buf, "%s%d\n", buf, PASSED); +} + +ssize_t fan_rpm_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int fan_location = 0; + int fan_offset = 0; + u16 fan_speed = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *target_client = NULL; + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + target_client = Netberg_BMC_14_client; + } + else + { + target_client = Netberg_CPLD_23_client; + } + + switch (attr->index) + { + case FAN1_FRONT_RPM: + fan_location = 0; + fan_offset = 0; + break; + case FAN2_FRONT_RPM: + fan_location = 0; + fan_offset = 1; + break; + case FAN3_FRONT_RPM: + fan_location = 0; + fan_offset = 2; + break; + case FAN4_FRONT_RPM: + fan_location = 0; + fan_offset = 3; + break; + case FAN5_FRONT_RPM: + fan_location = 0; + fan_offset = 4; + break; + case FAN1_REAR_RPM: + fan_location = 1; + fan_offset = 0; + break; + case FAN2_REAR_RPM: + fan_location = 1; + fan_offset = 1; + break; + case FAN3_REAR_RPM: + fan_location = 1; + fan_offset = 2; + break; + case FAN4_REAR_RPM: + fan_location = 1; + fan_offset = 3; + break; + case FAN5_REAR_RPM: + fan_location = 1; + fan_offset = 4; + break; + } + if(fan_location == 0) + { + // front fan of couple + // read high byte + status = i2c_smbus_read_byte_data(target_client, FAN_F_RPM_REG+(fan_offset*2)+1); + fan_speed = status; + if(status < 0 || status == 0xff) + { + fan_speed = 0; + } + // read low byte + status = i2c_smbus_read_byte_data(target_client, FAN_F_RPM_REG+(fan_offset*2)); + fan_speed = ((fan_speed<<8) + status)*30; + if(status < 0 || status == 0xff) + { + fan_speed = 0; + } + } + else + { + // rear fan of couple + // read high byte + status = i2c_smbus_read_byte_data(target_client, FAN_R_RPM_REG+(fan_offset*2)+1); + fan_speed = status; + if(status < 0 || status == 0xff) + { + fan_speed = 0; + } + // read low byte + status = i2c_smbus_read_byte_data(target_client, FAN_R_RPM_REG+(fan_offset*2)); + fan_speed = ((fan_speed<<8) + status)*30; + if(status < 0 || status == 0xff) + { + fan_speed = 0; + } + } + sprintf(buf, "%s%d\n", buf, fan_speed); + return sprintf(buf, "%s\n",buf); +} +/* end of implement i2c_function */ diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-fan.h b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-fan.h new file mode 100644 index 000000000000..66ffc9339395 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-fan.h @@ -0,0 +1,12 @@ +/* register offset define */ +#define FANCTRL_RPM_REG 0x1a +#define FANCTRL_MODE_REG 0x1b +#define FAN_STAT_REG 0x00 +#define FAN_POWER_REG 0x01 +#define FAN_PRESENT_REG 0x02 +#define BMC_FAN_STAT_REG 0x80 +#define BMC_FAN_POWER_REG 0x81 +#define BMC_FAN_PRESENT_REG 0x82 +#define FAN_F_RPM_REG 0xa0 +#define FAN_R_RPM_REG 0xb0 +/* end of register offset define */ \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-led.c b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-led.c new file mode 100644 index 000000000000..df4957212d1d --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-led.c @@ -0,0 +1,220 @@ +/* An hwmon driver for Netberg Aurora 715 Innovium i2c Module */ +#pragma GCC diagnostic ignored "-Wformat-zero-length" +#include "x86-64-netberg-aurora-715.h" +#include "x86-64-netberg-aurora-715-common.h" +#include "x86-64-netberg-aurora-715-led.h" + +/* i2c_client Declaration */ +extern struct i2c_client *Netberg_CPLD_30_client; //0x30 for SYS CPLD +/* end of i2c_client Declaration */ + +/* implement i2c_function */ +ssize_t led_ctrl_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int res = 0x1; + int i; + int led_a_status = 0; + int led_g_status = 0; + int led_b_status = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + status = i2c_smbus_read_byte_data(Netberg_CPLD_30_client, LED_CTRL_REG); + sprintf(buf, ""); + + for (i = 1; i <= 4; i++) + { + if ( i == attr->index) + { + if (status & res) + { + led_a_status = ENABLE; + } + else + { + led_a_status = DISABLE; + } + } + res = res << 1; + if( i == (attr->index + 1) ) + { + if (status & res) + { + led_g_status = ENABLE; + } + else + { + led_g_status = DISABLE; + } + } + res = res << 1; + } + res = 0x1; + + status = i2c_smbus_read_byte_data(Netberg_CPLD_30_client, LED_BLINK_REG); + for (i = 1; i <= 4; i++) + { + if ( i == attr->index) + { + if (status & res) + { + led_b_status = ENABLE; + } + else + { + led_b_status = DISABLE; + } + } + res = res << 1; + } + if(led_a_status == ENABLE && led_b_status == ENABLE) + { + sprintf(buf, "%s2\n", buf); + } + else if(led_a_status == ENABLE && led_b_status == DISABLE) + { + sprintf(buf, "%s1\n", buf); + } + else if(led_g_status == ENABLE && led_b_status == ENABLE) + { + sprintf(buf, "%s4\n", buf); + } + else if(led_g_status == ENABLE && led_b_status == DISABLE) + { + sprintf(buf, "%s3\n", buf); + } + else + { + sprintf(buf, "%s0\n", buf); + } + + return sprintf(buf, "%s", buf); +} + +ssize_t led_ctrl_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int led_value = -EPERM; + int blk_value = -EPERM; + int result = -EPERM; + int offset = 0; + u16 i; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *data = i2c_get_clientdata(Netberg_CPLD_30_client); + + mutex_lock(&data->update_lock); + led_value = i2c_smbus_read_byte_data(Netberg_CPLD_30_client, LED_CTRL_REG); + blk_value = i2c_smbus_read_byte_data(Netberg_CPLD_30_client, LED_BLINK_REG); + if (attr->index != 0) + { + i = simple_strtol(buf, NULL, 10); + if(attr->index == 1) + { + offset = 0; + } + else + { + offset = 2*((attr->index)-1); + } + switch(i) + { + case SWITCH_LED_OFF: //i=0 + led_value &= ~(0x03 << offset); + blk_value &= ~(1 << ((attr->index)-1)); + break; + case SWITCH_LED_A_N: //i=1 + led_value &= ~(0x03 << offset); + led_value |= (0x01 << offset); + blk_value &= ~(1 << ((attr->index)-1)); + break; + case SWITCH_LED_A_B: //i=2 + led_value &= ~(0x03 << offset); + led_value |= (0x01 << offset); + blk_value |= (1 << ((attr->index)-1)); + break; + case SWITCH_LED_G_N: //i=3 + led_value &= ~(0x03 << offset); + led_value |= (0x02 << offset); + blk_value &= ~(1 << ((attr->index)-1)); + break; + case SWITCH_LED_G_B: //i=4 + led_value &= ~(0x03 << offset); + led_value |= (0x02 << offset); + blk_value |= (1 << ((attr->index)-1)); + break; + default: + printk(KERN_ALERT "led_ctrl_set wrong Value\n"); + return count; + } + result = i2c_smbus_write_byte_data(Netberg_CPLD_30_client, LED_CTRL_REG, led_value); + result |= i2c_smbus_write_byte_data(Netberg_CPLD_30_client, LED_BLINK_REG, blk_value); + if (result < 0) + { + printk(KERN_ALERT "ERROR: led_ctrl_set FAILED!\n"); + } + } + mutex_unlock(&data->update_lock); + return count; +} + +ssize_t led_fiber_get(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *data = i2c_get_clientdata(Netberg_CPLD_30_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + if (attr->index == LED_FIBER) + { + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, LED_FIBER_REG) & BIT_0_MASK) + { + sprintf(buf, "%s%d\n", buf, ENABLE); + } + else + { + sprintf(buf, "%s%d\n", buf, DISABLE); + } + } + mutex_unlock(&data->update_lock); + return sprintf(buf, "%s\n", buf); +} +ssize_t led_fiber_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int value = -EPERM; + int result = -EPERM; + int input; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *data = i2c_get_clientdata(Netberg_CPLD_30_client); + + mutex_lock(&data->update_lock); + status = i2c_smbus_read_byte_data(Netberg_CPLD_30_client, LED_CTRL_REG); + if (attr->index == LED_FIBER) + { + input = simple_strtol(buf, NULL, 10); + if (input == ENABLE) + { + value = status | LED_FIBER_ENABLE; + result = i2c_smbus_write_byte_data(Netberg_CPLD_30_client, LED_FIBER_REG, value); + if (result < 0) + { + printk(KERN_ALERT "ERROR: led_ctrl_set FAILED!\n"); + } + } + else if (input == DISABLE) + { + value = status & LED_FIBER_DISABLE; + result = i2c_smbus_write_byte_data(Netberg_CPLD_30_client, LED_FIBER_REG, value); + if (result < 0) + { + printk(KERN_ALERT "ERROR: led_ctrl_set FAILED!\n"); + } + } + else + { + printk(KERN_ALERT "led_ctrl_set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + return count; +} +/* end of implement i2c_function */ diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-led.h b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-led.h new file mode 100644 index 000000000000..c07a246447f8 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-led.h @@ -0,0 +1,12 @@ +/* register offset define */ +#define LED_CTRL_REG 0xa2 +#define LED_BLINK_REG 0xa3 +#define LED_FIBER_REG 0xa0 +#define LED_FIBER_ENABLE 0x01 +#define LED_FIBER_DISABLE 0xfe +#define SWITCH_LED_OFF 0 +#define SWITCH_LED_A_N 1 +#define SWITCH_LED_A_B 2 +#define SWITCH_LED_G_N 3 +#define SWITCH_LED_G_B 4 +/* end of register offset define */ \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-power.c b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-power.c new file mode 100644 index 000000000000..1913d1716bbe --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-power.c @@ -0,0 +1,650 @@ +/* An hwmon driver for Netberg Aurora 715 Innovium i2c Module */ +#pragma GCC diagnostic ignored "-Wformat-zero-length" +#include "x86-64-netberg-aurora-715.h" +#include "x86-64-netberg-aurora-715-common.h" +#include "x86-64-netberg-aurora-715-power.h" + +/* extern i2c_client */ +extern struct i2c_client *Netberg_CPLD_35_client; //0x35 for Power CPLD +extern struct i2c_client *Netberg_BMC_14_client; //0x14 for BMC slave +/* end of extern i2c_client */ + +/* convert function */ +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} +/* end of convert function */ + +/* implement i2c_function */ +ssize_t psu_status_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + u32 result = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *Netberg_CPLD_35_data = i2c_get_clientdata(Netberg_CPLD_35_client); + struct Netberg_i2c_data *Netberg_BMC_14_data = i2c_get_clientdata(Netberg_BMC_14_client); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + mutex_lock(&Netberg_BMC_14_data->update_lock); + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, BMC_PSU_STAT_REG); + mutex_unlock(&Netberg_BMC_14_data->update_lock); + } + else + { + mutex_lock(&Netberg_CPLD_35_data->update_lock); + status = i2c_smbus_read_byte_data(Netberg_CPLD_35_client, PSU_STAT_REG); + mutex_unlock(&Netberg_CPLD_35_data->update_lock); + } + + result = TRUE; + switch (attr->index) + { + case 1: + if(status & BIT_2_MASK) + { + result = FALSE; + } + break; + case 2: + if(status & BIT_3_MASK) + { + result = FALSE; + } + break; + } + if(result != TRUE) + { + return sprintf(buf, "%s%d\n", buf, FALSE); + } + return sprintf(buf, "%s%d\n", buf, TRUE); +} +ssize_t psu_present_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + u32 result = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *Netberg_CPLD_35_data = i2c_get_clientdata(Netberg_CPLD_35_client); + struct Netberg_i2c_data *Netberg_BMC_14_data = i2c_get_clientdata(Netberg_BMC_14_client); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + mutex_lock(&Netberg_BMC_14_data->update_lock); + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, BMC_PSU_STAT_REG); + mutex_unlock(&Netberg_BMC_14_data->update_lock); + } + else + { + mutex_lock(&Netberg_CPLD_35_data->update_lock); + status = i2c_smbus_read_byte_data(Netberg_CPLD_35_client, PSU_STAT_REG); + mutex_unlock(&Netberg_CPLD_35_data->update_lock); + } + + result = FALSE; + switch (attr->index) + { + case 1: + if(status & BIT_0_MASK) + { + result = TRUE; + } + break; + case 2: + if(status & BIT_1_MASK) + { + result = TRUE; + } + break; + } + if(result != TRUE) + { + return sprintf(buf, "%s%d\n", buf, FALSE); + } + return sprintf(buf, "%s%d\n", buf, TRUE); +} +ssize_t psu_vin_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 result = -EPERM; + int exponent = 0, mantissa = 0; + int multiplier = 1000; + u16 u16_val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case PSU1_VIN: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, PSU_1_VIN_REG); + break; + case PSU2_VIN: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, PSU_2_VIN_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + multiplier = 1000; + result = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} +ssize_t psu_iin_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 result = -EPERM; + int exponent = 0, mantissa = 0; + int multiplier = 1000; + u16 u16_val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case PSU1_IIN: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, PSU_1_IIN_REG); + break; + case PSU2_IIN: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, PSU_2_IIN_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + multiplier = 1000; + result = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} +ssize_t psu_vout_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 result = -EPERM; + int exponent = 0; + int multiplier = 1000; + u16 u16_vmode = 0; + u16 u16_vout = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case PSU1_VOUT: + u16_vmode = i2c_smbus_read_byte_data(Netberg_BMC_14_client, PSU_1_VOMDE_REG); + u16_vout = i2c_smbus_read_word_data(Netberg_BMC_14_client, PSU_1_VOUT_REG); + break; + case PSU2_VOUT: + u16_vmode = i2c_smbus_read_byte_data(Netberg_BMC_14_client, PSU_2_VOMDE_REG); + u16_vout = i2c_smbus_read_word_data(Netberg_BMC_14_client, PSU_2_VOUT_REG); + break; + } + if(u16_vout == 0xffff || u16_vout == -1) + { + return sprintf(buf, "%s0\n", buf); + } + /* vout mode */ + multiplier = 1000; + exponent = two_complement_to_int(u16_vmode & 0x1f, 5, 0x1f); + /* vout */ + result = (exponent >= 0) ? ((u16_vout << exponent)*multiplier) : \ + (u16_vout*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t psu_iout_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 result = -EPERM; + int exponent = 0, mantissa = 0; + int multiplier = 1000; + u16 u16_val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case PSU1_IOUT: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, PSU_1_IOUT_REG); + break; + case PSU2_IOUT: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, PSU_2_IOUT_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + multiplier = 1000; + result = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t psu_temp_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u16 result = -EPERM; + int exponent = 0, mantissa = 0; + int multiplier = 1000; + u16 u16_val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case PSU1_TEMP: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, PSU_1_TEMP_1_REG); + break; + case PSU2_TEMP: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, PSU_2_TEMP_1_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + multiplier = 1000; + result = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t psu_fan_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u16 result = -EPERM; + int exponent = 0, mantissa = 0; + int multiplier = 1000; + u16 u16_val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case PSU1_FAN_SPEED: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, PSU_1_FAN_SPEED_REG); + break; + case PSU2_FAN_SPEED: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, PSU_2_FAN_SPEED_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + multiplier = 1; + result = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t psu_pout_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 result = -EPERM; + int exponent = 0, mantissa = 0; + int multiplier = 1000; + u16 u16_val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case PSU1_POUT: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, PSU_1_POUT_REG); + break; + case PSU2_POUT: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, PSU_2_POUT_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + multiplier = 1000000; // lm-sensor unit: uW + result = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t psu_pin_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 result = -EPERM; + int exponent = 0, mantissa = 0; + int multiplier = 1000; + u16 u16_val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case PSU1_PIN: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, PSU_1_PIN_REG); + break; + case PSU2_PIN: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, PSU_2_PIN_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + multiplier = 1000000; // lm-sensor unit: uW + result = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t psu_mfr_model_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u16 u16_val = 0; + char model[2]; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case PSU1_MFR_MODEL: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, PSU_1_MFR_MODEL_REG); + break; + case PSU2_MFR_MODEL: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, PSU_2_MFR_MODEL_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + model[0] = u16_val >> 8; + model[1] = u16_val; + sprintf(buf, "%s%c%c\n", buf, model[0], model[1]); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t psu_iout_max_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u32 result = -EPERM; + int exponent = 0, mantissa = 0; + int multiplier = 1000; + u16 u16_val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case PSU1_MFR_IOUT_MAX: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, PSU_1_MFR_IOUT_MAX_REG); + break; + case PSU2_MFR_IOUT_MAX: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, PSU_2_MFR_IOUT_MAX_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + multiplier = 1000; // lm-sensor unit: uW + result = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t psu_vmode_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u16 u16_vmode = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case PSU1_VOMDE: + u16_vmode = i2c_smbus_read_byte_data(Netberg_BMC_14_client, PSU_1_VOMDE_REG); + break; + case PSU2_VOMDE: + u16_vmode = i2c_smbus_read_byte_data(Netberg_BMC_14_client, PSU_2_VOMDE_REG); + break; + } + if(u16_vmode == 0xffff || u16_vmode == -1) + { + return sprintf(buf, "%s0\n", buf); + } + /* vout mode */ + sprintf(buf, "%s%d\n", buf, u16_vmode); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t dc_vout_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u16 result = -EPERM; + int exponent = 0, mantissa = 0; + int multiplier = 1000; + u16 u16_val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case DC6E_P0_VOUT: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, DC_CHIP_6E_P0_VOUT_REG); + break; + case DC6E_P1_VOUT: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, DC_CHIP_6E_P1_VOUT_REG); + break; + case DC70_P0_VOUT: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, DC_CHIP_70_P0_VOUT_REG); + break; + case DC70_P1_VOUT: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, DC_CHIP_70_P1_VOUT_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + multiplier = 1000; + result = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t dc_iout_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u16 result = -EPERM; + int exponent = 0, mantissa = 0; + int multiplier = 1000; + u16 u16_val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case DC6E_P0_IOUT: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, DC_CHIP_6E_P0_IOUT_REG); + break; + case DC6E_P1_IOUT: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, DC_CHIP_6E_P1_IOUT_REG); + break; + case DC70_P0_IOUT: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, DC_CHIP_70_P0_IOUT_REG); + break; + case DC70_P1_IOUT: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, DC_CHIP_70_P1_IOUT_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + multiplier = 1000; + result = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t dc_pout_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u16 result = -EPERM; + int exponent = 0, mantissa = 0; + int multiplier = 1000; + u16 u16_val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + sprintf(buf, ""); + if( bmc_enable() == ENABLE) + { + switch(attr->index) + { + case DC6E_P0_POUT: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, DC_CHIP_6E_P0_POUT_REG); + break; + case DC6E_P1_POUT: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, DC_CHIP_6E_P1_POUT_REG); + break; + case DC70_P0_POUT: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, DC_CHIP_70_P0_POUT_REG); + break; + case DC70_P1_POUT: + u16_val = i2c_smbus_read_word_data(Netberg_BMC_14_client, DC_CHIP_70_P1_POUT_REG); + break; + } + if(u16_val == 0xffff || u16_val == -1) + { + return sprintf(buf, "%s0\n", buf); + } + exponent = two_complement_to_int(u16_val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(u16_val & 0x7ff, 11, 0x7ff); + multiplier = 1000000; + result = (exponent >= 0) ? ((mantissa << exponent)*multiplier) : \ + (mantissa*multiplier / (1 << -exponent)); + sprintf(buf, "%s%d\n", buf, result); + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + return sprintf(buf, "%s\n", buf); +} +/* end of implement i2c_function */ diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-power.h b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-power.h new file mode 100644 index 000000000000..6164179b2a28 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-power.h @@ -0,0 +1,38 @@ +/* register offset define */ +#define PSU_STAT_REG 0xa0 +#define BMC_PSU_STAT_REG 0xc0 +#define PSU_1_VIN_REG 0x50 +#define PSU_1_IIN_REG 0x51 +#define PSU_1_VOUT_REG 0x52 +#define PSU_1_IOUT_REG 0x53 +#define PSU_1_TEMP_1_REG 0x54 +#define PSU_1_FAN_SPEED_REG 0x55 +#define PSU_1_POUT_REG 0x56 +#define PSU_1_PIN_REG 0x57 +#define PSU_1_MFR_MODEL_REG 0x58 +#define PSU_1_MFR_IOUT_MAX_REG 0x59 +#define PSU_1_VOMDE_REG 0x5a +#define PSU_2_VIN_REG 0x60 +#define PSU_2_IIN_REG 0x61 +#define PSU_2_VOUT_REG 0x62 +#define PSU_2_IOUT_REG 0x63 +#define PSU_2_TEMP_1_REG 0x64 +#define PSU_2_FAN_SPEED_REG 0x65 +#define PSU_2_POUT_REG 0x66 +#define PSU_2_PIN_REG 0x67 +#define PSU_2_MFR_MODEL_REG 0x68 +#define PSU_2_MFR_IOUT_MAX_REG 0x69 +#define PSU_2_VOMDE_REG 0x6a +#define DC_CHIP_6E_P0_VOUT_REG 0x90 +#define DC_CHIP_6E_P0_IOUT_REG 0x91 +#define DC_CHIP_6E_P0_POUT_REG 0x92 +#define DC_CHIP_6E_P1_VOUT_REG 0x94 +#define DC_CHIP_6E_P1_IOUT_REG 0x95 +#define DC_CHIP_6E_P1_POUT_REG 0x96 +#define DC_CHIP_70_P0_VOUT_REG 0x98 +#define DC_CHIP_70_P0_IOUT_REG 0x99 +#define DC_CHIP_70_P0_POUT_REG 0x9a +#define DC_CHIP_70_P1_VOUT_REG 0x9c +#define DC_CHIP_70_P1_IOUT_REG 0x9d +#define DC_CHIP_70_P1_POUT_REG 0x9e +/* end of register offset define */ \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-qsfp.c b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-qsfp.c new file mode 100644 index 000000000000..97525e629842 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-qsfp.c @@ -0,0 +1,584 @@ +/* An hwmon driver for Netberg Aurora 715 Innovium i2c Module */ +#pragma GCC diagnostic ignored "-Wformat-zero-length" +#include "x86-64-netberg-aurora-715.h" +#include "x86-64-netberg-aurora-715-common.h" +#include "x86-64-netberg-aurora-715-qsfp.h" + +/* i2c_client Declaration */ +extern struct i2c_client *Netberg_CPLD_31_client; //0x31 for Port 01-16 +extern struct i2c_client *Netberg_CPLD_32_client; //0x32 for Port 17-32 +/* end of i2c_client Declaration */ + +/* extern i2c_function */ +/* end of extern i2c_function */ + +/* implement i2c_function */ +ssize_t qsfp_low_power_all_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u32 result = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (attr->index == QSFP_LOW_POWER_ALL) + { + status = i2c_smbus_read_byte_data(Netberg_CPLD_32_client, QSFP_REAR_LOW_POWER_REG); //25-32 + result = status; + status = i2c_smbus_read_byte_data(Netberg_CPLD_32_client, QSFP_FRONT_LOW_POWER_REG); //17-24 + result = (result << 8) | status; + status = i2c_smbus_read_byte_data(Netberg_CPLD_31_client, QSFP_REAR_LOW_POWER_REG); //9-16 + result = (result << 8) | status; + status = i2c_smbus_read_byte_data(Netberg_CPLD_31_client, QSFP_FRONT_LOW_POWER_REG); //1-8 + result = (result << 8) | status; + sprintf(buf, "%s0x%x\n", buf, result); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t qsfp_low_power_all_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int value = 0x0; + int result = 0; + int input = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *Netberg_CPLD_31_data = i2c_get_clientdata(Netberg_CPLD_31_client); + struct Netberg_i2c_data *Netberg_CPLD_32_data = i2c_get_clientdata(Netberg_CPLD_32_client); + + mutex_lock(&Netberg_CPLD_31_data->update_lock); + mutex_lock(&Netberg_CPLD_32_data->update_lock); + if (attr->index == QSFP_LOW_POWER_ALL) + { + input = simple_strtol(buf, NULL, 10); + if (input == ENABLE) + { + value = 0xff; + } + else if(input == DISABLE) + { + value = 0x00; + } + else + { + printk(KERN_ALERT "qsfp_low_power_all_set wrong value\n"); + return count; + } + result += i2c_smbus_write_byte_data(Netberg_CPLD_31_client, QSFP_FRONT_LOW_POWER_REG, value); + result += i2c_smbus_write_byte_data(Netberg_CPLD_31_client, QSFP_REAR_LOW_POWER_REG, value); + result += i2c_smbus_write_byte_data(Netberg_CPLD_32_client, QSFP_FRONT_LOW_POWER_REG, value); + result += i2c_smbus_write_byte_data(Netberg_CPLD_32_client, QSFP_REAR_LOW_POWER_REG, value); + + if(result != 0) + { + printk(KERN_ALERT "qsfp_low_power_all_set FAILED\n"); + return count; + } + } + mutex_unlock(&Netberg_CPLD_31_data->update_lock); + mutex_unlock(&Netberg_CPLD_32_data->update_lock); + return count; +} + +ssize_t qsfp_low_power_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int port_index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + port_index = attr->index; + sprintf(buf, ""); + + if (port_index >= 1 && port_index <= 16) + { + status = i2c_smbus_read_byte_data(Netberg_CPLD_31_client, qsfp_low_power_regs[port_index][0]); + } + else if (port_index >= 17 && port_index <= 32) + { + status = i2c_smbus_read_byte_data(Netberg_CPLD_32_client, qsfp_low_power_regs[port_index][0]); + } + + if (status & qsfp_low_power_regs[port_index][1]) + { + sprintf(buf, "%s%d\n", buf, ENABLE); + } + else + { + sprintf(buf, "%s%d\n", buf, DISABLE); + } + + return sprintf(buf, "%s\n", buf); +} + +ssize_t qsfp_low_power_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int result = 0; + int input = 0; + int port_index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *Netberg_CPLD_31_data = i2c_get_clientdata(Netberg_CPLD_31_client); + struct Netberg_i2c_data *Netberg_CPLD_32_data = i2c_get_clientdata(Netberg_CPLD_32_client); + struct i2c_client *target_client = NULL; + + port_index = attr->index; + input = simple_strtol(buf, NULL, 10); + mutex_lock(&Netberg_CPLD_31_data->update_lock); + mutex_lock(&Netberg_CPLD_32_data->update_lock); + + if (port_index >= 1 && port_index <= 16) + { + target_client = Netberg_CPLD_31_client; + + } + else if (port_index >= 17 && port_index <= 32) + { + target_client = Netberg_CPLD_32_client; + } + + status = i2c_smbus_read_byte_data(target_client, qsfp_low_power_regs[port_index][0]); + if( input == ENABLE) + { + status |= qsfp_low_power_regs[port_index][1]; + result = i2c_smbus_write_byte_data(target_client, qsfp_low_power_regs[port_index][0], status); + if (result < 0) + { + printk(KERN_ALERT "ERROR: qsfp_low_power_set ON FAILED!\n"); + } + } + else if( input == DISABLE) + { + status &= ~(qsfp_low_power_regs[port_index][1]); + result = i2c_smbus_write_byte_data(target_client, qsfp_low_power_regs[port_index][0], status); + if (result < 0) + { + printk(KERN_ALERT "ERROR: qsfp_low_power_set OFF FAILED!\n"); + } + } + else + { + printk(KERN_ALERT "ERROR: qsfp_low_power_set WRONG VALUE\n"); + } + + mutex_unlock(&Netberg_CPLD_31_data->update_lock); + mutex_unlock(&Netberg_CPLD_32_data->update_lock); + + return count; +} + +ssize_t qsfp_reset_all_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int value = 0x0; + int result = 0; + int input = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *Netberg_CPLD_31_data = i2c_get_clientdata(Netberg_CPLD_31_client); + struct Netberg_i2c_data *Netberg_CPLD_32_data = i2c_get_clientdata(Netberg_CPLD_32_client); + + mutex_lock(&Netberg_CPLD_31_data->update_lock); + mutex_lock(&Netberg_CPLD_32_data->update_lock); + if (attr->index == QSFP_RESET_ALL) + { + input = simple_strtol(buf, NULL, 10); + if (input == QSFP_RESET) + { + value = 0x00; + } + else + { + printk(KERN_ALERT "qsfp_reset_all_set wrong value\n"); + return count; + } + result += i2c_smbus_write_byte_data(Netberg_CPLD_31_client, QSFP_FRONT_RESET_REG, value); + result += i2c_smbus_write_byte_data(Netberg_CPLD_31_client, QSFP_REAR_RESET_REG, value); + result += i2c_smbus_write_byte_data(Netberg_CPLD_32_client, QSFP_FRONT_RESET_REG, value); + result += i2c_smbus_write_byte_data(Netberg_CPLD_32_client, QSFP_REAR_RESET_REG, value); + + if(result != 0) + { + printk(KERN_ALERT "qsfp_reset_all_set FAILED\n"); + return count; + } + } + mutex_unlock(&Netberg_CPLD_31_data->update_lock); + mutex_unlock(&Netberg_CPLD_32_data->update_lock); + return count; +} + +ssize_t qsfp_reset_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int result = 0; + int input = 0; + int port_index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *Netberg_CPLD_31_data = i2c_get_clientdata(Netberg_CPLD_31_client); + struct Netberg_i2c_data *Netberg_CPLD_32_data = i2c_get_clientdata(Netberg_CPLD_32_client); + struct i2c_client *target_client = NULL; + + port_index = attr->index; + input = simple_strtol(buf, NULL, 10); + mutex_lock(&Netberg_CPLD_31_data->update_lock); + mutex_lock(&Netberg_CPLD_32_data->update_lock); + + if (port_index >= 1 && port_index <= 16) + { + target_client = Netberg_CPLD_31_client; + + } + else if (port_index >= 17 && port_index <= 32) + { + target_client = Netberg_CPLD_32_client; + } + + status = i2c_smbus_read_byte_data(target_client, qsfp_reset_regs[port_index][0]); + if( input == QSFP_RESET) + { + status |= qsfp_reset_regs[port_index][1]; + result = i2c_smbus_write_byte_data(target_client, qsfp_reset_regs[port_index][0], status); + if (result < 0) + { + printk(KERN_ALERT "ERROR: qsfp_reset_set FAILED!\n"); + } + } + else + { + printk(KERN_ALERT "ERROR: qsfp_reset_set WRONG VALUE\n"); + } + + mutex_unlock(&Netberg_CPLD_31_data->update_lock); + mutex_unlock(&Netberg_CPLD_32_data->update_lock); + + return count; +} + +ssize_t qsfp_present_all_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u32 result = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (attr->index == QSFP_PRESENT_ALL) + { + status = i2c_smbus_read_byte_data(Netberg_CPLD_32_client, QSFP_REAR_PRESENT_REG); //25-32 + result = status; + status = i2c_smbus_read_byte_data(Netberg_CPLD_32_client, QSFP_FRONT_PRESENT_REG); //17-24 + result = (result << 8) | status; + status = i2c_smbus_read_byte_data(Netberg_CPLD_31_client, QSFP_REAR_PRESENT_REG); //9-16 + result = (result << 8) | status; + status = i2c_smbus_read_byte_data(Netberg_CPLD_31_client, QSFP_FRONT_PRESENT_REG); //1-8 + result = (result << 8) | status; + result = ~(result); + sprintf(buf, "%s0x%x\n", buf, result); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t qsfp_present_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int port_index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + port_index = attr->index; + sprintf(buf, ""); + + if (port_index >= 1 && port_index <= 16) + { + status = i2c_smbus_read_byte_data(Netberg_CPLD_31_client, qsfp_present_regs[port_index][0]); + } + else if (port_index >= 17 && port_index <= 32) + { + status = i2c_smbus_read_byte_data(Netberg_CPLD_32_client, qsfp_present_regs[port_index][0]); + } + + if (status & qsfp_present_regs[port_index][1]) + { + sprintf(buf, "%s%d\n", buf, DISABLE); + } + else + { + sprintf(buf, "%s%d\n", buf, ENABLE); + } + + return sprintf(buf, "%s\n", buf); +} +ssize_t qsfp_int_all_get(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 status = -EPERM; + u32 result = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + if (attr->index == QSFP_INT_ALL) + { + status = i2c_smbus_read_byte_data(Netberg_CPLD_32_client, QSFP_REAR_INT_REG); //25-32 + result = status; + status = i2c_smbus_read_byte_data(Netberg_CPLD_32_client, QSFP_FRONT_INT_REG); //17-24 + result = (result << 8) | status; + status = i2c_smbus_read_byte_data(Netberg_CPLD_31_client, QSFP_REAR_INT_REG); //9-16 + result = (result << 8) | status; + status = i2c_smbus_read_byte_data(Netberg_CPLD_31_client, QSFP_FRONT_INT_REG); //1-8 + result = (result << 8) | status; + sprintf(buf, "%s0x%x\n", buf, result); + } + return sprintf(buf, "%s\n", buf); +} +ssize_t qsfp_int_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int port_index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + port_index = attr->index; + sprintf(buf, ""); + + if (port_index >= 1 && port_index <= 16) + { + status = i2c_smbus_read_byte_data(Netberg_CPLD_31_client, qsfp_int_regs[port_index][0]); + } + else if (port_index >= 17 && port_index <= 32) + { + status = i2c_smbus_read_byte_data(Netberg_CPLD_32_client, qsfp_int_regs[port_index][0]); + } + + if (status & qsfp_int_regs[port_index][1]) + { + sprintf(buf, "%s%d\n", buf, ENABLE); + } + else + { + sprintf(buf, "%s%d\n", buf, DISABLE); + } + + return sprintf(buf, "%s\n", buf); +} + +ssize_t qsfp_quter_int_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int quter_index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + quter_index = attr->index; + sprintf(buf, ""); + + if (quter_index >= 1 && quter_index <= 2) + { + status = i2c_smbus_read_byte_data(Netberg_CPLD_31_client, qsfp_quter_int_regs[quter_index][0]); + } + else if (quter_index >= 3 && quter_index <= 4) + { + status = i2c_smbus_read_byte_data(Netberg_CPLD_32_client, qsfp_quter_int_regs[quter_index][0]); + } + + if (status & qsfp_quter_int_regs[quter_index][1]) + { + sprintf(buf, "%s%d\n", buf, NORMAL); + } + else + { + sprintf(buf, "%s%d\n", buf, ABNORMAL); + } + + return sprintf(buf, "%s\n", buf); +} + +ssize_t qsfp_quter_int_mask_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int quter_index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + quter_index = attr->index; + sprintf(buf, ""); + + if (quter_index >= 1 && quter_index <= 2) + { + status = i2c_smbus_read_byte_data(Netberg_CPLD_31_client, qsfp_quter_int_mask_regs[quter_index][0]); + } + else if (quter_index >= 3 && quter_index <= 4) + { + status = i2c_smbus_read_byte_data(Netberg_CPLD_32_client, qsfp_quter_int_mask_regs[quter_index][0]); + } + + if (status & qsfp_quter_int_mask_regs[quter_index][1]) + { + sprintf(buf, "%s%d\n", buf, DISABLE); + } + else + { + sprintf(buf, "%s%d\n", buf, ENABLE); + } + + return sprintf(buf, "%s\n", buf); +} + +ssize_t qsfp_quter_int_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int result = 0; + int input = 0; + int quter_index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *Netberg_CPLD_31_data = i2c_get_clientdata(Netberg_CPLD_31_client); + struct Netberg_i2c_data *Netberg_CPLD_32_data = i2c_get_clientdata(Netberg_CPLD_32_client); + struct i2c_client *target_client = NULL; + + quter_index = attr->index; + input = simple_strtol(buf, NULL, 10); + mutex_lock(&Netberg_CPLD_31_data->update_lock); + mutex_lock(&Netberg_CPLD_32_data->update_lock); + + if (quter_index >= 1 && quter_index <= 2) + { + target_client = Netberg_CPLD_31_client; + + } + else if (quter_index >= 3 && quter_index <= 4) + { + target_client = Netberg_CPLD_32_client; + } + + status = i2c_smbus_read_byte_data(target_client, qsfp_quter_int_mask_regs[quter_index][0]); + if( input == DISABLE) + { + status |= qsfp_quter_int_mask_regs[quter_index][1]; + result = i2c_smbus_write_byte_data(target_client, qsfp_quter_int_mask_regs[quter_index][0], status); + if (result < 0) + { + printk(KERN_ALERT "ERROR: qsfp_quter_int_mask_set ON FAILED!\n"); + } + } + else if( input == ENABLE) + { + status &= ~(qsfp_quter_int_mask_regs[quter_index][1]); + result = i2c_smbus_write_byte_data(target_client, qsfp_quter_int_mask_regs[quter_index][0], status); + if (result < 0) + { + printk(KERN_ALERT "ERROR: qsfp_quter_int_mask_set OFF FAILED!\n"); + } + } + else + { + printk(KERN_ALERT "ERROR: qsfp_quter_int_mask_set WRONG VALUE\n"); + } + + mutex_unlock(&Netberg_CPLD_31_data->update_lock); + mutex_unlock(&Netberg_CPLD_32_data->update_lock); + + return count; +} + +ssize_t qsfp_modprs_int_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int quter_index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + quter_index = attr->index; + sprintf(buf, ""); + + if (quter_index >= 1 && quter_index <= 2) + { + status = i2c_smbus_read_byte_data(Netberg_CPLD_31_client, qsfp_modprs_int_regs[quter_index][0]); + } + else if (quter_index >= 3 && quter_index <= 4) + { + status = i2c_smbus_read_byte_data(Netberg_CPLD_32_client, qsfp_modprs_int_regs[quter_index][0]); + } + + if (status & qsfp_modprs_int_regs[quter_index][1]) + { + sprintf(buf, "%s%d\n", buf, NORMAL); + } + else + { + sprintf(buf, "%s%d\n", buf, ABNORMAL); + } + + return sprintf(buf, "%s\n", buf); +} + +ssize_t qsfp_modprs_int_mask_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + int quter_index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + quter_index = attr->index; + sprintf(buf, ""); + + if (quter_index >= 1 && quter_index <= 2) + { + status = i2c_smbus_read_byte_data(Netberg_CPLD_31_client, qsfp_modprs_int_mask_regs[quter_index][0]); + } + else if (quter_index >= 3 && quter_index <= 4) + { + status = i2c_smbus_read_byte_data(Netberg_CPLD_32_client, qsfp_modprs_int_mask_regs[quter_index][0]); + } + + if (status & qsfp_modprs_int_mask_regs[quter_index][1]) + { + sprintf(buf, "%s%d\n", buf, DISABLE); + } + else + { + sprintf(buf, "%s%d\n", buf, ENABLE); + } + + return sprintf(buf, "%s\n", buf); +} + +ssize_t qsfp_modprs_int_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int result = 0; + int input = 0; + int quter_index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *Netberg_CPLD_31_data = i2c_get_clientdata(Netberg_CPLD_31_client); + struct Netberg_i2c_data *Netberg_CPLD_32_data = i2c_get_clientdata(Netberg_CPLD_32_client); + struct i2c_client *target_client = NULL; + + quter_index = attr->index; + input = simple_strtol(buf, NULL, 10); + mutex_lock(&Netberg_CPLD_31_data->update_lock); + mutex_lock(&Netberg_CPLD_32_data->update_lock); + + if (quter_index >= 1 && quter_index <= 2) + { + target_client = Netberg_CPLD_31_client; + + } + else if (quter_index >= 3 && quter_index <= 4) + { + target_client = Netberg_CPLD_32_client; + } + + status = i2c_smbus_read_byte_data(target_client, qsfp_modprs_int_mask_regs[quter_index][0]); + if( input == DISABLE) + { + status |= qsfp_modprs_int_mask_regs[quter_index][1]; + result = i2c_smbus_write_byte_data(target_client, qsfp_modprs_int_mask_regs[quter_index][0], status); + if (result < 0) + { + printk(KERN_ALERT "ERROR: qsfp_modprs_int_mask_set ON FAILED!\n"); + } + } + else if( input == ENABLE) + { + status &= ~(qsfp_modprs_int_mask_regs[quter_index][1]); + result = i2c_smbus_write_byte_data(target_client, qsfp_modprs_int_mask_regs[quter_index][0], status); + if (result < 0) + { + printk(KERN_ALERT "ERROR: qsfp_modprs_int_mask_set OFF FAILED!\n"); + } + } + else + { + printk(KERN_ALERT "ERROR: qsfp_modprs_int_mask_set WRONG VALUE\n"); + } + + mutex_unlock(&Netberg_CPLD_31_data->update_lock); + mutex_unlock(&Netberg_CPLD_32_data->update_lock); + + return count; +} +/* end of implement i2c_function */ diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-qsfp.h b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-qsfp.h new file mode 100644 index 000000000000..a1deb8f3d7b2 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-qsfp.h @@ -0,0 +1,187 @@ +/* register offset define */ +#define QSFP_FRONT_LOW_POWER_REG 0x60 +#define QSFP_REAR_LOW_POWER_REG 0x61 +#define QSFP_FRONT_RESET_REG 0x70 +#define QSFP_REAR_RESET_REG 0x71 +#define QSFP_FRONT_PRESENT_REG 0x80 +#define QSFP_REAR_PRESENT_REG 0x81 +#define QSFP_FRONT_INT_REG 0x90 +#define QSFP_REAR_INT_REG 0x91 +#define QSFP_RESET 1 + +unsigned char qsfp_low_power_regs[33][2] = { + {0x00, 0x00}, //cpld offset, bit mask + {0x60, 0x01}, + {0x60, 0x02}, + {0x60, 0x04}, + {0x60, 0x08}, + {0x60, 0x10}, + {0x60, 0x20}, + {0x60, 0x40}, + {0x60, 0x80}, + {0x61, 0x01}, + {0x61, 0x02}, + {0x61, 0x04}, + {0x61, 0x08}, + {0x61, 0x10}, + {0x61, 0x20}, + {0x61, 0x40}, + {0x61, 0x80}, + {0x60, 0x01}, + {0x60, 0x02}, + {0x60, 0x04}, + {0x60, 0x08}, + {0x60, 0x10}, + {0x60, 0x20}, + {0x60, 0x40}, + {0x60, 0x80}, + {0x61, 0x01}, + {0x61, 0x02}, + {0x61, 0x04}, + {0x61, 0x08}, + {0x61, 0x10}, + {0x61, 0x20}, + {0x61, 0x40}, + {0x61, 0x80} +}; + +unsigned char qsfp_reset_regs[33][2] = { + {0x00, 0x00}, //cpld offset, bit mask + {0x70, 0x01}, + {0x70, 0x02}, + {0x70, 0x04}, + {0x70, 0x08}, + {0x70, 0x10}, + {0x70, 0x20}, + {0x70, 0x40}, + {0x70, 0x80}, + {0x71, 0x01}, + {0x71, 0x02}, + {0x71, 0x04}, + {0x71, 0x08}, + {0x71, 0x10}, + {0x71, 0x20}, + {0x71, 0x40}, + {0x71, 0x80}, + {0x70, 0x01}, + {0x70, 0x02}, + {0x70, 0x04}, + {0x70, 0x08}, + {0x70, 0x10}, + {0x70, 0x20}, + {0x70, 0x40}, + {0x70, 0x80}, + {0x71, 0x01}, + {0x71, 0x02}, + {0x71, 0x04}, + {0x71, 0x08}, + {0x71, 0x10}, + {0x71, 0x20}, + {0x71, 0x40}, + {0x71, 0x80} +}; + +unsigned char qsfp_present_regs[33][2] = { + {0x00, 0x00}, //cpld offset, bit mask + {0x80, 0x01}, + {0x80, 0x02}, + {0x80, 0x04}, + {0x80, 0x08}, + {0x80, 0x10}, + {0x80, 0x20}, + {0x80, 0x40}, + {0x80, 0x80}, + {0x81, 0x01}, + {0x81, 0x02}, + {0x81, 0x04}, + {0x81, 0x08}, + {0x81, 0x10}, + {0x81, 0x20}, + {0x81, 0x40}, + {0x81, 0x80}, + {0x80, 0x01}, + {0x80, 0x02}, + {0x80, 0x04}, + {0x80, 0x08}, + {0x80, 0x10}, + {0x80, 0x20}, + {0x80, 0x40}, + {0x80, 0x80}, + {0x81, 0x01}, + {0x81, 0x02}, + {0x81, 0x04}, + {0x81, 0x08}, + {0x81, 0x10}, + {0x81, 0x20}, + {0x81, 0x40}, + {0x81, 0x80} +}; + +unsigned char qsfp_int_regs[33][2] = { + {0x00, 0x00}, //cpld offset, bit mask + {0x90, 0x01}, + {0x90, 0x02}, + {0x90, 0x04}, + {0x90, 0x08}, + {0x90, 0x10}, + {0x90, 0x20}, + {0x90, 0x40}, + {0x90, 0x80}, + {0x91, 0x01}, + {0x91, 0x02}, + {0x91, 0x04}, + {0x91, 0x08}, + {0x91, 0x10}, + {0x91, 0x20}, + {0x91, 0x40}, + {0x91, 0x80}, + {0x90, 0x01}, + {0x90, 0x02}, + {0x90, 0x04}, + {0x90, 0x08}, + {0x90, 0x10}, + {0x90, 0x20}, + {0x90, 0x40}, + {0x90, 0x80}, + {0x91, 0x01}, + {0x91, 0x02}, + {0x91, 0x04}, + {0x91, 0x08}, + {0x91, 0x10}, + {0x91, 0x20}, + {0x91, 0x40}, + {0x91, 0x80} +}; + +unsigned char qsfp_quter_int_regs[5][2] = { + {0x00, 0x00}, //cpld offset, bit mask + {0xd0, 0x04}, + {0xd0, 0x08}, + {0xd0, 0x04}, + {0xd0, 0x08} +}; + +unsigned char qsfp_quter_int_mask_regs[5][2] = { + {0x00, 0x00}, //cpld offset, bit mask + {0xd1, 0x04}, + {0xd1, 0x08}, + {0xd1, 0x04}, + {0xd1, 0x08} +}; + +unsigned char qsfp_modprs_int_regs[5][2] = { + {0x00, 0x00}, //cpld offset, bit mask + {0xd0, 0x01}, + {0xd0, 0x02}, + {0xd0, 0x01}, + {0xd0, 0x02} +}; + +unsigned char qsfp_modprs_int_mask_regs[5][2] = { + {0x00, 0x00}, //cpld offset, bit mask + {0xd1, 0x01}, + {0xd1, 0x02}, + {0xd1, 0x01}, + {0xd1, 0x02} +}; +/* end of register offset define */ \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-sys.c b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-sys.c new file mode 100644 index 000000000000..6ee287b9ef6e --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-sys.c @@ -0,0 +1,864 @@ +/* An hwmon driver for Netberg Aurora 715 Innovium i2c Module */ +#pragma GCC diagnostic ignored "-Wformat-zero-length" +#include "x86-64-netberg-aurora-715.h" +#include "x86-64-netberg-aurora-715-common.h" +#include "x86-64-netberg-aurora-715-sys.h" + +/* extern i2c_client */ +extern struct i2c_client *Netberg_CPLD_30_client; //0x30 for SYS CPLD +extern struct i2c_client *Netberg_CPLD_31_client; //0x31 for Port 01-16 +extern struct i2c_client *Netberg_CPLD_32_client; //0x32 for Port 17-32 +extern struct i2c_client *Netberg_CPLD_23_client; //0x23 for Fan CPLD +extern struct i2c_client *Netberg_BMC_14_client; //0x14 for BMC slave +extern struct i2c_client *Netberg_EEPROM_56_client; //0x56 for EEPROM slave +/* end of extern i2c_client */ + +/* implement i2c_function */ +ssize_t cpld_hw_ver_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *data = i2c_get_clientdata(Netberg_CPLD_30_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + switch (attr->index) + { + case 23: + if( bmc_enable() == ENABLE) + { + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, 0xff); + } + else + { + status = i2c_smbus_read_byte_data(Netberg_CPLD_23_client, CPLD_VER_REG); + } + case 30: + status = i2c_smbus_read_byte_data(Netberg_CPLD_30_client, CPLD_VER_REG); + case 31: + status = i2c_smbus_read_byte_data(Netberg_CPLD_31_client, CPLD_VER_REG); + case 32: + status = i2c_smbus_read_byte_data(Netberg_CPLD_32_client, CPLD_VER_REG); + } + if(status < 0) + { + mutex_unlock(&data->update_lock); + return status; + } + else + { + mutex_unlock(&data->update_lock); + sprintf(buf, "%s0x%x\n", buf, status); + } + return sprintf(buf, "%s\n", buf); +} + +ssize_t wdt_enable_get(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *data = i2c_get_clientdata(Netberg_CPLD_30_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + if (attr->index == WDT_EN) + { + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, WDT_EN_REG) & BIT_4_MASK) + { + sprintf(buf, "%s%d\n", buf, ENABLE); + } + else + { + sprintf(buf, "%s%d\n", buf, DISABLE); + } + } + mutex_unlock(&data->update_lock); + return sprintf(buf, "%s\n", buf); +} + +ssize_t wdt_enable_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int value = -EPERM; + int result = -EPERM; + int input; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *data = i2c_get_clientdata(Netberg_CPLD_30_client); + + mutex_lock(&data->update_lock); + status = i2c_smbus_read_byte_data(Netberg_CPLD_30_client, WDT_EN_REG); + if (attr->index == WDT_EN) + { + input = simple_strtol(buf, NULL, 10); + if (input == ENABLE) + { + value = status | WDT_EN_ENABLE; + result = i2c_smbus_write_byte_data(Netberg_CPLD_30_client, WDT_EN_REG, value); + if (result < 0) + { + printk(KERN_ALERT "ERROR: wdt_enable_set FAILED!\n"); + } + } + else if (input == DISABLE) + { + value = status & WDT_EN_DISABLE; + result = i2c_smbus_write_byte_data(Netberg_CPLD_30_client, WDT_EN_REG, value); + if (result < 0) + { + printk(KERN_ALERT "ERROR: wdt_enable_set FAILED!\n"); + } + } + else + { + printk(KERN_ALERT "wdt_enable_set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + return count; +} + +ssize_t eeprom_wp_get(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *data = i2c_get_clientdata(Netberg_CPLD_30_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + if (attr->index == EEPROM_WP) + { + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, EEPROM_WP_REG) & BIT_2_MASK) + { + sprintf(buf, "%s%d\n", buf, ENABLE); + } + else + { + sprintf(buf, "%s%d\n", buf, DISABLE); + } + } + mutex_unlock(&data->update_lock); + return sprintf(buf, "%s\n", buf); +} + +ssize_t eeprom_wp_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int value = -EPERM; + int result = -EPERM; + int input; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *data = i2c_get_clientdata(Netberg_CPLD_30_client); + + mutex_lock(&data->update_lock); + status = i2c_smbus_read_byte_data(Netberg_CPLD_30_client, EEPROM_WP_REG); + if (attr->index == EEPROM_WP) + { + input = simple_strtol(buf, NULL, 10); + if (input == ENABLE) + { + value = status | EEPROM_WP_ENABLE; + result = i2c_smbus_write_byte_data(Netberg_CPLD_30_client, EEPROM_WP_REG, value); + if (result < 0) + { + printk(KERN_ALERT "ERROR: eeprom_wp_set FAILED!\n"); + } + } + else if (input == DISABLE) + { + value = status & EEPROM_WP_DISABLE; + result = i2c_smbus_write_byte_data(Netberg_CPLD_30_client, EEPROM_WP_REG, value); + if (result < 0) + { + printk(KERN_ALERT "ERROR: eeprom_wp_set FAILED!\n"); + } + } + else + { + printk(KERN_ALERT "eeprom_wp_set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + return count; +} + +static void net_eeprom_update_client(struct i2c_client *client, u8 slice) +{ + struct eeprom_data *data = i2c_get_clientdata(client); + int i, j; + int ret; + int addr; + + + mutex_lock(&data->update_lock); + + if (!(data->valid & (1 << slice)) || + time_after(jiffies, data->last_updated[slice] + 300 * HZ)) { + dev_dbg(&client->dev, "Starting eeprom update, slice %u\n", slice); + + addr = slice << SLICE_BITS; + + ret = i2c_smbus_write_byte_data(client, ((u8)addr >> 8) & 0xFF, (u8)addr & 0xFF); + /* select the eeprom address */ + if (ret < 0) { + dev_err(&client->dev, "address set failed\n"); + goto exit; + } + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BYTE)) { + goto exit; + } + + for (i = slice << SLICE_BITS; i < (slice + 1) << SLICE_BITS; i+= SLICE_SIZE) { + for (j = i; j < (i+SLICE_SIZE); j++) { + int res; + + res = i2c_smbus_read_byte(client); + if (res < 0) { + goto exit; + } + + data->data[j] = res & 0xFF; + } + } + + data->last_updated[slice] = jiffies; + data->valid |= (1 << slice); + } + +exit: + mutex_unlock(&data->update_lock); +} + + +ssize_t net_eeprom_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) +{ + /* struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj)); */ + struct eeprom_data *data = i2c_get_clientdata(Netberg_EEPROM_56_client); + u8 slice; + + + if (off > EEPROM_SIZE) { + return 0; + } + if (off + count > EEPROM_SIZE) { + count = EEPROM_SIZE - off; + } + if (count == 0) { + return 0; + } + + /* Only refresh slices which contain requested bytes */ + for (slice = off >> SLICE_BITS; slice <= (off + count - 1) >> SLICE_BITS; slice++) { + net_eeprom_update_client(Netberg_EEPROM_56_client, slice); + } + + memcpy(buf, &data->data[off], count); + + return count; +} + +ssize_t usb_enable_get(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *data = i2c_get_clientdata(Netberg_CPLD_30_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + if (attr->index == USB_EN) + { + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, USB_EN_REG) & BIT_2_MASK) + { + sprintf(buf, "%s%d\n", buf, ENABLE); + } + else + { + sprintf(buf, "%s%d\n", buf, DISABLE); + } + } + mutex_unlock(&data->update_lock); + return sprintf(buf, "%s\n", buf); +} + +ssize_t usb_enable_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int value = -EPERM; + int result = -EPERM; + int input; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *data = i2c_get_clientdata(Netberg_CPLD_30_client); + + mutex_lock(&data->update_lock); + status = i2c_smbus_read_byte_data(Netberg_CPLD_30_client, USB_EN_REG); + if (attr->index == USB_EN) + { + input = simple_strtol(buf, NULL, 10); + if (input == ENABLE) + { + value = status | USB_EN_ENABLE; + result = i2c_smbus_write_byte_data(Netberg_CPLD_30_client, USB_EN_REG, value); + if (result < 0) + { + printk(KERN_ALERT "ERROR: usb_enable_set FAILED!\n"); + } + } + else if (input == DISABLE) + { + value = status & USB_EN_DISABLE; + result = i2c_smbus_write_byte_data(Netberg_CPLD_30_client, USB_EN_REG, value); + if (result < 0) + { + printk(KERN_ALERT "ERROR: usb_enable_set FAILED!\n"); + } + } + else + { + printk(KERN_ALERT "usb_enable_set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + return count; +} + +ssize_t reset_mac_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int value = -EPERM; + int result = -EPERM; + int input; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *data = i2c_get_clientdata(Netberg_CPLD_30_client); + + mutex_lock(&data->update_lock); + status = i2c_smbus_read_byte_data(Netberg_CPLD_30_client, MAC_RESET_REG); + if (attr->index == RESET) + { + input = simple_strtol(buf, NULL, 10); + if (input == MAC_RESET) + { + value = MAC_RESET; + result = i2c_smbus_write_byte_data(Netberg_CPLD_30_client, MAC_RESET_REG, value); + if (result < 0) + { + printk(KERN_ALERT "ERROR: reset_mac_set FAILED!\n"); + } + } + else + { + printk(KERN_ALERT "reset_mac_set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + return count; +} + +ssize_t shutdown_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int value = -EPERM; + int result = -EPERM; + int input; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *data = i2c_get_clientdata(Netberg_CPLD_30_client); + + mutex_lock(&data->update_lock); + status = i2c_smbus_read_byte_data(Netberg_CPLD_30_client, SHUTDOWN_REG); + if (attr->index == SHUTDOWN_SET) + { + input = simple_strtol(buf, NULL, 10); + if (input == SHUTDOWN) + { + value = status | SHUTDOWN; + result = i2c_smbus_write_byte_data(Netberg_CPLD_30_client, SHUTDOWN_REG, value); + if (result < 0) + { + printk(KERN_ALERT "ERROR: shutdown_set FAILED!\n"); + } + } + else + { + printk(KERN_ALERT "shutdown_set wrong Value\n"); + } + } + mutex_unlock(&data->update_lock); + return count; +} + +ssize_t bmc_enable_get(struct device *dev, struct device_attribute *da, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *data = i2c_get_clientdata(Netberg_CPLD_30_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + if (attr->index == BMC_PRESENT) + { + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, BMC_EN_REG) & BIT_0_MASK) + { + sprintf(buf, "%s%d\n", buf, ENABLE); + } + else + { + sprintf(buf, "%s%d\n", buf, DISABLE); + } + } + mutex_unlock(&data->update_lock); + return sprintf(buf, "%s\n", buf); +} + +ssize_t themal_int_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int result = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *data = i2c_get_clientdata(Netberg_CPLD_30_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + switch (attr->index) + { + case TEMP_R_B_INT: + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, THERMAL_INT_REG) & BIT_0_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case TEMP_L_B_INT: + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, THERMAL_INT_REG) & BIT_1_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case TEMP_L_T_INT: + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, THERMAL_INT_REG) & BIT_2_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case TEMP_R_T_INT: + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, THERMAL_INT_REG) & BIT_3_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + } + mutex_unlock(&data->update_lock); + sprintf(buf, "%s%d\n", buf, result); + return sprintf(buf, "%s\n", buf); +} + +ssize_t themal_int_mask_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int result = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *data = i2c_get_clientdata(Netberg_CPLD_30_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + switch (attr->index) + { + case TEMP_R_B_INT_MASK: + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, THERMAL_INT_MASK_REG) & BIT_0_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case TEMP_L_B_INT_MASK: + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, THERMAL_INT_MASK_REG) & BIT_1_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case TEMP_L_T_INT_MASK: + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, THERMAL_INT_MASK_REG) & BIT_2_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case TEMP_R_T_INT_MASK: + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, THERMAL_INT_MASK_REG) & BIT_3_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + } + mutex_unlock(&data->update_lock); + sprintf(buf, "%s%d\n", buf, result); + return sprintf(buf, "%s\n", buf); +} + +ssize_t themal_int_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int value = -EPERM; + int result = -EPERM; + int input; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *data = i2c_get_clientdata(Netberg_CPLD_30_client); + + mutex_lock(&data->update_lock); + status = i2c_smbus_read_byte_data(Netberg_CPLD_30_client, THERMAL_INT_MASK_REG); + + input = simple_strtol(buf, NULL, 10); + switch (attr->index) + { + case TEMP_R_B_INT_MASK: + if (input == ENABLE) + { + value = status | 0x01; + } + else if (input == DISABLE) + { + value = status & 0xfe; + } + else + { + printk(KERN_ALERT "themal_int_mask_set wrong Value\n"); + return count; + } + break; + case TEMP_L_B_INT_MASK: + if (input == ENABLE) + { + value = status | 0x02; + } + else if (input == DISABLE) + { + value = status & 0xfd; + } + else + { + printk(KERN_ALERT "themal_int_mask_set wrong Value\n"); + return count; + } + break; + case TEMP_L_T_INT_MASK: + if (input == ENABLE) + { + value = status | 0x04; + } + else if (input == DISABLE) + { + value = status & 0xfb; + } + else + { + printk(KERN_ALERT "themal_int_mask_set wrong Value\n"); + return count; + } + break; + case TEMP_R_T_INT_MASK: + if (input == ENABLE) + { + value = status | 0x08; + } + else if (input == DISABLE) + { + value = status & 0xf7; + } + else + { + printk(KERN_ALERT "themal_int_mask_set wrong Value\n"); + return count; + } + break; + } + result = i2c_smbus_write_byte_data(Netberg_CPLD_30_client, THERMAL_INT_MASK_REG, value); + mutex_unlock(&data->update_lock); + return count; +} + +ssize_t sys_int_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int result = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *data = i2c_get_clientdata(Netberg_CPLD_30_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + switch (attr->index) + { + case CPLD_FP_INT: + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, SYS_INT_REG) & BIT_2_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case CPLD_RP_INT: + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, SYS_INT_REG) & BIT_3_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case CPLD_FAN_INT: + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, SYS_INT_REG) & BIT_4_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case CPLD_PSU_INT: + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, SYS_INT_REG) & BIT_5_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case THERMAL_INT: + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, SYS_INT_REG) & BIT_6_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case USB_INT: + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, SYS_INT_REG) & BIT_7_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + } + mutex_unlock(&data->update_lock); + sprintf(buf, "%s%d\n", buf, result); + return sprintf(buf, "%s\n", buf); +} + +ssize_t sys_int_mask_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int result = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *data = i2c_get_clientdata(Netberg_CPLD_30_client); + + mutex_lock(&data->update_lock); + sprintf(buf, ""); + switch (attr->index) + { + case CPLD_FP_INT_MASK: + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, SYS_INT_MASK_REG) & BIT_2_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case CPLD_RP_INT_MASK: + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, SYS_INT_MASK_REG) & BIT_3_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case CPLD_FAN_INT_MASK: + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, SYS_INT_MASK_REG) & BIT_4_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case CPLD_PSU_INT_MASK: + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, SYS_INT_MASK_REG) & BIT_5_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case THERMAL_INT_MASK: + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, SYS_INT_MASK_REG) & BIT_6_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + case USB_INT_MASK: + if (i2c_smbus_read_byte_data(Netberg_CPLD_30_client, SYS_INT_MASK_REG) & BIT_7_MASK) + { + result = ENABLE; + } + else + { + result = DISABLE; + } + break; + } + mutex_unlock(&data->update_lock); + sprintf(buf, "%s%d\n", buf, result); + return sprintf(buf, "%s\n", buf); +} + +ssize_t sys_int_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count) +{ + int status = -EPERM; + int value = -EPERM; + int result = -EPERM; + int input; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct Netberg_i2c_data *data = i2c_get_clientdata(Netberg_CPLD_30_client); + + mutex_lock(&data->update_lock); + status = i2c_smbus_read_byte_data(Netberg_CPLD_30_client, SYS_INT_MASK_REG); + + input = simple_strtol(buf, NULL, 10); + switch (attr->index) + { + case CPLD_FP_INT_MASK: + if (input == ENABLE) + { + value = status | 0x02; + } + else if (input == DISABLE) + { + value = status & 0xfd; + } + else + { + printk(KERN_ALERT "sys_int_mask_set wrong Value\n"); + return count; + } + break; + case CPLD_RP_INT_MASK: + if (input == ENABLE) + { + value = status | 0x04; + } + else if (input == DISABLE) + { + value = status & 0xfb; + } + else + { + printk(KERN_ALERT "sys_int_mask_set wrong Value\n"); + return count; + } + break; + case CPLD_FAN_INT_MASK: + if (input == ENABLE) + { + value = status | 0x08; + } + else if (input == DISABLE) + { + value = status & 0xf7; + } + else + { + printk(KERN_ALERT "sys_int_mask_set wrong Value\n"); + return count; + } + break; + case CPLD_PSU_INT_MASK: + if (input == ENABLE) + { + value = status | 0x10; + } + else if (input == DISABLE) + { + value = status & 0xef; + } + else + { + printk(KERN_ALERT "sys_int_mask_set wrong Value\n"); + return count; + } + break; + case THERMAL_INT_MASK: + if (input == ENABLE) + { + value = status | 0x20; + } + else if (input == DISABLE) + { + value = status & 0xdf; + } + else + { + printk(KERN_ALERT "sys_int_mask_set wrong Value\n"); + return count; + } + break; + case USB_INT_MASK: + if (input == ENABLE) + { + value = status | 0x40; + } + else if (input == DISABLE) + { + value = status & 0xbf; + } + else + { + printk(KERN_ALERT "sys_int_mask_set wrong Value\n"); + return count; + } + break; + } + result = i2c_smbus_write_byte_data(Netberg_CPLD_30_client, SYS_INT_MASK_REG, value); + mutex_unlock(&data->update_lock); + return count; +} +/* end of implement i2c_function */ diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-sys.h b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-sys.h new file mode 100644 index 000000000000..0126b7dbbcca --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-sys.h @@ -0,0 +1,23 @@ +/* register offset define */ +#define CPLD_VER_REG 0x20 +#define WDT_EN_REG 0xa0 +#define WDT_EN_ENABLE 0x10 +#define WDT_EN_DISABLE 0xef +#define EEPROM_WP_REG 0xa0 +#define EEPROM_WP_ENABLE 0x04 +#define EEPROM_WP_DISABLE 0xfB +#define USB_EN_REG 0xa0 +#define USB_EN_ENABLE 0x02 +#define USB_EN_DISABLE 0xfD +#define MAC_RESET_REG 0xa1 +#define MAC_RESET 0x00 +#define SHUTDOWN_REG 0xa1 +#define SHUTDOWN 0x10 +#define BMC_EN_REG 0xa4 +#define BMC_EN_ENABLE 0x01 +#define BMC_EN_DISABLE 0x00 +#define THERMAL_INT_REG 0xc0 +#define THERMAL_INT_MASK_REG 0xc1 +#define SYS_INT_REG 0xd0 +#define SYS_INT_MASK_REG 0xd1 +/* end of register offset define */ diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-thermal.c b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-thermal.c new file mode 100644 index 000000000000..8e288f4aa329 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-thermal.c @@ -0,0 +1,271 @@ +/* An hwmon driver for Netberg Aurora 715 Innovium i2c Module */ +#pragma GCC diagnostic ignored "-Wformat-zero-length" +#include "x86-64-netberg-aurora-715.h" +#include "x86-64-netberg-aurora-715-common.h" +#include "x86-64-netberg-aurora-715-thermal.h" + +/* extern i2c_client */ +extern struct i2c_client *Netberg_BMC_14_client; //0x14 for BMC slave +/* end of extern i2c_client */ + +/* implement i2c_function */ +ssize_t themal_temp_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + sprintf(buf, ""); + + if( bmc_enable() == ENABLE) + { + switch (attr->index) + { + case TEMP_R_B_F: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_R_B_F_REG); + break; + case TEMP_R_B_B: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_R_B_B_REG); + break; + case TEMP_L_B_F: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_L_B_F_REG); + break; + case TEMP_L_B_B: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_L_B_B_REG); + break; + case TEMP_R_T_F: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_R_T_F_REG); + break; + case TEMP_R_T_B: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_R_T_B_REG); + break; + case TEMP_L_T_F: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_L_T_F_REG); + break; + case TEMP_L_T_B: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_L_T_B_REG); + break; + } + if(status == 0xff || status < 0) + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + else + { + sprintf(buf, "%s%d\n", buf, (read_8bit_temp((status & 0x80), status))*1000); + } + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + + return sprintf(buf, "%s\n", buf); +} + +ssize_t themal_temp_max_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + sprintf(buf, ""); + + if( bmc_enable() == ENABLE) + { + switch (attr->index) + { + case TEMP_R_B_F_MAX: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_R_B_F_MAX_REG); + break; + case TEMP_L_B_F_MAX: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_L_B_F_MAX_REG); + break; + case TEMP_R_T_F_MAX: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_R_T_F_MAX_REG); + break; + case TEMP_L_T_F_MAX: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_L_T_F_MAX_REG); + break; + case TEMP_R_B_B_MAX: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_R_B_B_MAX_REG); + break; + case TEMP_L_B_B_MAX: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_L_B_B_MAX_REG); + break; + case TEMP_R_T_B_MAX: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_R_T_B_MAX_REG); + break; + case TEMP_L_T_B_MAX: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_L_T_B_MAX_REG); + break; + } + if(status == 0xff || status < 0) + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + else + { + sprintf(buf, "%s%d\n", buf, (read_8bit_temp((status & 0x80), status))*1000); + } + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + + return sprintf(buf, "%s\n", buf); +} + +ssize_t themal_temp_min_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + sprintf(buf, ""); + + if( bmc_enable() == ENABLE) + { + switch (attr->index) + { + case TEMP_R_B_F_MIN: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_R_B_F_MIN_REG); + break; + case TEMP_L_B_F_MIN: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_L_B_F_MIN_REG); + break; + case TEMP_R_T_F_MIN: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_R_T_F_MIN_REG); + break; + case TEMP_L_T_F_MIN: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_L_T_F_MIN_REG); + break; + case TEMP_R_B_B_MIN: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_R_B_B_MIN_REG); + break; + case TEMP_L_B_B_MIN: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_L_B_B_MIN_REG); + break; + case TEMP_R_T_B_MIN: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_R_T_B_MIN_REG); + break; + case TEMP_L_T_B_MIN: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_L_T_B_MIN_REG); + break; + } + if(status == 0xff || status < 0) + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + else + { + sprintf(buf, "%s%d\n", buf, (read_8bit_temp((status & 0x80), status))*1000); + } + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + + return sprintf(buf, "%s\n", buf); +} + +ssize_t themal_temp_crit_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + sprintf(buf, ""); + + if( bmc_enable() == ENABLE) + { + switch (attr->index) + { + case TEMP_R_B_F_CRIT: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_R_B_F_CRIT_REG); + break; + case TEMP_L_B_F_CRIT: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_L_B_F_CRIT_REG); + break; + case TEMP_R_T_F_CRIT: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_R_T_F_CRIT_REG); + break; + case TEMP_L_T_F_CRIT: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_L_T_F_CRIT_REG); + break; + case TEMP_R_B_B_CRIT: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_R_B_B_CRIT_REG); + break; + case TEMP_L_B_B_CRIT: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_L_B_B_CRIT_REG); + break; + case TEMP_R_T_B_CRIT: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_R_T_B_CRIT_REG); + break; + case TEMP_L_T_B_CRIT: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_L_T_B_CRIT_REG); + break; + } + if(status == 0xff || status < 0) + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + else + { + sprintf(buf, "%s%d\n", buf, (read_8bit_temp((status & 0x80), status))*1000); + } + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + + return sprintf(buf, "%s\n", buf); +} + +ssize_t themal_temp_lcrit_get(struct device *dev, struct device_attribute *da, char *buf) +{ + int status = -EPERM; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + sprintf(buf, ""); + + if( bmc_enable() == ENABLE) + { + switch (attr->index) + { + case TEMP_R_B_F_LCRIT: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_R_B_F_LCRIT_REG); + break; + case TEMP_L_B_F_LCRIT: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_L_B_F_LCRIT_REG); + break; + case TEMP_R_T_F_LCRIT: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_R_T_F_LCRIT_REG); + break; + case TEMP_L_T_F_LCRIT: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_L_T_F_LCRIT_REG); + break; + case TEMP_R_B_B_LCRIT: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_R_B_B_LCRIT_REG); + break; + case TEMP_L_B_B_LCRIT: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_L_B_B_LCRIT_REG); + break; + case TEMP_R_T_B_LCRIT: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_R_T_B_LCRIT_REG); + break; + case TEMP_L_T_B_LCRIT: + status = i2c_smbus_read_byte_data(Netberg_BMC_14_client, TEMP_L_T_B_LCRIT_REG); + break; + } + if(status == 0xff || status < 0) + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + else + { + sprintf(buf, "%s%d\n", buf, (read_8bit_temp((status & 0x80), status))*1000); + } + } + else + { + sprintf(buf, "%sAccess BMC module FAILED\n", buf); + } + + return sprintf(buf, "%s\n", buf); +} +/* end of implement i2c_function */ diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-thermal.h b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-thermal.h new file mode 100644 index 000000000000..54b95a38691e --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715-thermal.h @@ -0,0 +1,45 @@ +/* register offset define */ +#define TEMP_R_B_F_REG 0x10 +#define TEMP_R_B_B_REG 0x11 +#define TEMP_R_B_F_MAX_REG 0x12 +#define TEMP_R_B_F_MIN_REG 0x13 +#define TEMP_R_B_F_CRIT_REG 0x14 +#define TEMP_R_B_F_LCRIT_REG 0x15 +#define TEMP_R_B_B_MAX_REG 0x16 +#define TEMP_R_B_B_MIN_REG 0x17 +#define TEMP_R_B_B_CRIT_REG 0x18 +#define TEMP_R_B_B_LCRIT_REG 0x19 + +#define TEMP_L_B_F_REG 0x20 +#define TEMP_L_B_B_REG 0x21 +#define TEMP_L_B_F_MAX_REG 0x22 +#define TEMP_L_B_F_MIN_REG 0x23 +#define TEMP_L_B_F_CRIT_REG 0x24 +#define TEMP_L_B_F_LCRIT_REG 0x25 +#define TEMP_L_B_B_MAX_REG 0x26 +#define TEMP_L_B_B_MIN_REG 0x27 +#define TEMP_L_B_B_CRIT_REG 0x28 +#define TEMP_L_B_B_LCRIT_REG 0x29 + +#define TEMP_R_T_F_REG 0x30 +#define TEMP_R_T_B_REG 0x31 +#define TEMP_R_T_F_MAX_REG 0x32 +#define TEMP_R_T_F_MIN_REG 0x33 +#define TEMP_R_T_F_CRIT_REG 0x34 +#define TEMP_R_T_F_LCRIT_REG 0x35 +#define TEMP_R_T_B_MAX_REG 0x36 +#define TEMP_R_T_B_MIN_REG 0x37 +#define TEMP_R_T_B_CRIT_REG 0x38 +#define TEMP_R_T_B_LCRIT_REG 0x39 + +#define TEMP_L_T_F_REG 0x40 +#define TEMP_L_T_B_REG 0x41 +#define TEMP_L_T_F_MAX_REG 0x42 +#define TEMP_L_T_F_MIN_REG 0x43 +#define TEMP_L_T_F_CRIT_REG 0x44 +#define TEMP_L_T_F_LCRIT_REG 0x45 +#define TEMP_L_T_B_MAX_REG 0x46 +#define TEMP_L_T_B_MIN_REG 0x47 +#define TEMP_L_T_B_CRIT_REG 0x48 +#define TEMP_L_T_B_LCRIT_REG 0x49 +/* end of register offset define */ \ No newline at end of file diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715.h b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715.h new file mode 100644 index 000000000000..d4c1e6daba63 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/modules/x86-64-netberg-aurora-715.h @@ -0,0 +1,1069 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_VERSION "1.0.1" + +#define EEPROM_SIZE 0x100 +#define SLICE_BITS (6) +#define SLICE_SIZE (1 << SLICE_BITS) +#define SLICE_NUM (EEPROM_SIZE/SLICE_SIZE) + +struct i2c_adap { + int nr; + char *name; + const char *funcs; + const char *algo; +}; + +struct eeprom_data { + struct mutex update_lock; + u8 valid; /* bitfield, bit!=0 if slice is valid */ + unsigned long last_updated[SLICE_NUM]; /* In jiffies, 8 slices */ + u8 data[EEPROM_SIZE]; /* Register values */ +}; + +struct i2c_adap *gather_i2c_busses(void); +void free_adapters(struct i2c_adap *adapters); + +/* compiler conditional */ +/* end of compiler conditional */ + +/* Function Declaration */ +/* i2c-0 */ +ssize_t cpld_hw_ver_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t wdt_enable_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t wdt_enable_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t eeprom_wp_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t eeprom_wp_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); + +ssize_t net_eeprom_read(struct file *filp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count); + +ssize_t usb_enable_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t usb_enable_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t reset_mac_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t shutdown_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t bmc_enable_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t led_ctrl_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t led_ctrl_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t led_fiber_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t led_fiber_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t themal_int_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t themal_int_mask_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t themal_int_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t sys_int_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t sys_int_mask_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t sys_int_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t themal_temp_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t themal_temp_max_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t themal_temp_min_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t themal_temp_crit_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t themal_temp_lcrit_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t fan_ctrl_mode_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t fan_ctrl_rpm_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t fan_status_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t fan_present_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t fan_power_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t fan_rpm_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_status_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_present_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_vin_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_iin_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_vout_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_iout_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_temp_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_fan_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_pout_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_pin_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_mfr_model_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_iout_max_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t psu_vmode_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t dc_vout_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t dc_iout_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t dc_pout_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t qsfp_low_power_all_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t qsfp_low_power_all_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t qsfp_low_power_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t qsfp_low_power_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t qsfp_reset_all_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t qsfp_reset_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t qsfp_present_all_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t qsfp_present_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t qsfp_int_all_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t qsfp_int_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t qsfp_quter_int_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t qsfp_quter_int_mask_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t qsfp_quter_int_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +ssize_t qsfp_modprs_int_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t qsfp_modprs_int_mask_get(struct device *dev, struct device_attribute *da, char *buf); +ssize_t qsfp_modprs_int_mask_set(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +/* end of Function Declaration */ + +/* struct i2c_data */ +struct Netberg_i2c_data +{ + struct device *hwmon_dev; + struct mutex update_lock; + char valid; + unsigned long last_updated; + u8 status; +}; + +/* struct i2c_sysfs_attributes */ +enum Netberg_i2c_sysfs_attributes +{ + CPLD_23_VER, + CPLD_30_VER, + CPLD_31_VER, + CPLD_32_VER, + WDT_EN, + EEPROM_WP, + USB_EN, + SHUTDOWN_SET, + RESET, + BMC_PRESENT, + LED_1, + LED_2, + LED_FLOW, + LED_SYS, + LED_FIBER, + TEMP_R_B_INT, + TEMP_L_B_INT, + TEMP_R_T_INT, + TEMP_L_T_INT, + TEMP_R_B_INT_MASK, + TEMP_L_B_INT_MASK, + TEMP_R_T_INT_MASK, + TEMP_L_T_INT_MASK, + CPLD_FP_INT, + CPLD_RP_INT, + CPLD_FAN_INT, + CPLD_PSU_INT, + THERMAL_INT, + USB_INT, + CPLD_FP_INT_MASK, + CPLD_RP_INT_MASK, + CPLD_FAN_INT_MASK, + CPLD_PSU_INT_MASK, + THERMAL_INT_MASK, + USB_INT_MASK, + TEMP_R_B_F, + TEMP_R_B_B, + TEMP_L_B_F, + TEMP_L_B_B, + TEMP_R_T_F, + TEMP_R_T_B, + TEMP_L_T_F, + TEMP_L_T_B, + TEMP_R_B_F_MAX, + TEMP_L_B_F_MAX, + TEMP_R_T_F_MAX, + TEMP_L_T_F_MAX, + TEMP_R_B_B_MAX, + TEMP_L_B_B_MAX, + TEMP_R_T_B_MAX, + TEMP_L_T_B_MAX, + TEMP_R_B_F_MIN, + TEMP_L_B_F_MIN, + TEMP_R_T_F_MIN, + TEMP_L_T_F_MIN, + TEMP_R_B_B_MIN, + TEMP_L_B_B_MIN, + TEMP_R_T_B_MIN, + TEMP_L_T_B_MIN, + TEMP_R_B_F_CRIT, + TEMP_L_B_F_CRIT, + TEMP_R_T_F_CRIT, + TEMP_L_T_F_CRIT, + TEMP_R_B_B_CRIT, + TEMP_L_B_B_CRIT, + TEMP_R_T_B_CRIT, + TEMP_L_T_B_CRIT, + TEMP_R_B_F_LCRIT, + TEMP_L_B_F_LCRIT, + TEMP_R_T_F_LCRIT, + TEMP_L_T_F_LCRIT, + TEMP_R_B_B_LCRIT, + TEMP_L_B_B_LCRIT, + TEMP_R_T_B_LCRIT, + TEMP_L_T_B_LCRIT, + FANCTRL_RPM, + FANCTRL_MODE, + FAN1_STAT, + FAN2_STAT, + FAN3_STAT, + FAN4_STAT, + FAN5_STAT, + FAN1_PRESENT, + FAN2_PRESENT, + FAN3_PRESENT, + FAN4_PRESENT, + FAN5_PRESENT, + FAN1_POWER, + FAN2_POWER, + FAN3_POWER, + FAN4_POWER, + FAN5_POWER, + FAN1_FRONT_RPM, + FAN2_FRONT_RPM, + FAN3_FRONT_RPM, + FAN4_FRONT_RPM, + FAN5_FRONT_RPM, + FAN1_REAR_RPM, + FAN2_REAR_RPM, + FAN3_REAR_RPM, + FAN4_REAR_RPM, + FAN5_REAR_RPM, + PSU1_GOOD, + PSU2_GOOD, + PSU1_PRNT, + PSU2_PRNT, + PSU1_VIN, + PSU1_IIN, + PSU1_VOUT, + PSU1_IOUT, + PSU1_TEMP, + PSU1_FAN_SPEED, + PSU1_POUT, + PSU1_PIN, + PSU1_MFR_MODEL, + PSU1_MFR_IOUT_MAX, + PSU1_VOMDE, + PSU2_VIN, + PSU2_IIN, + PSU2_VOUT, + PSU2_IOUT, + PSU2_TEMP, + PSU2_FAN_SPEED, + PSU2_POUT, + PSU2_PIN, + PSU2_MFR_MODEL, + PSU2_MFR_IOUT_MAX, + PSU2_VOMDE, + DC6E_P0_VOUT, + DC6E_P0_IOUT, + DC6E_P0_POUT, + DC6E_P1_VOUT, + DC6E_P1_IOUT, + DC6E_P1_POUT, + DC70_P0_VOUT, + DC70_P0_IOUT, + DC70_P0_POUT, + DC70_P1_VOUT, + DC70_P1_IOUT, + DC70_P1_POUT, + QSFP_LOW_POWER_ALL, + QSFP1_LOW_POWER, + QSFP2_LOW_POWER, + QSFP3_LOW_POWER, + QSFP4_LOW_POWER, + QSFP5_LOW_POWER, + QSFP6_LOW_POWER, + QSFP7_LOW_POWER, + QSFP8_LOW_POWER, + QSFP9_LOW_POWER, + QSFP10_LOW_POWER, + QSFP11_LOW_POWER, + QSFP12_LOW_POWER, + QSFP13_LOW_POWER, + QSFP14_LOW_POWER, + QSFP15_LOW_POWER, + QSFP16_LOW_POWER, + QSFP17_LOW_POWER, + QSFP18_LOW_POWER, + QSFP19_LOW_POWER, + QSFP20_LOW_POWER, + QSFP21_LOW_POWER, + QSFP22_LOW_POWER, + QSFP23_LOW_POWER, + QSFP24_LOW_POWER, + QSFP25_LOW_POWER, + QSFP26_LOW_POWER, + QSFP27_LOW_POWER, + QSFP28_LOW_POWER, + QSFP29_LOW_POWER, + QSFP30_LOW_POWER, + QSFP31_LOW_POWER, + QSFP32_LOW_POWER, + QSFP_RESET_ALL, + QSFP1_RESET, + QSFP2_RESET, + QSFP3_RESET, + QSFP4_RESET, + QSFP5_RESET, + QSFP6_RESET, + QSFP7_RESET, + QSFP8_RESET, + QSFP9_RESET, + QSFP10_RESET, + QSFP11_RESET, + QSFP12_RESET, + QSFP13_RESET, + QSFP14_RESET, + QSFP15_RESET, + QSFP16_RESET, + QSFP17_RESET, + QSFP18_RESET, + QSFP19_RESET, + QSFP20_RESET, + QSFP21_RESET, + QSFP22_RESET, + QSFP23_RESET, + QSFP24_RESET, + QSFP25_RESET, + QSFP26_RESET, + QSFP27_RESET, + QSFP28_RESET, + QSFP29_RESET, + QSFP30_RESET, + QSFP31_RESET, + QSFP32_RESET, + QSFP_PRESENT_ALL, + QSFP1_PRESENT, + QSFP2_PRESENT, + QSFP3_PRESENT, + QSFP4_PRESENT, + QSFP5_PRESENT, + QSFP6_PRESENT, + QSFP7_PRESENT, + QSFP8_PRESENT, + QSFP9_PRESENT, + QSFP10_PRESENT, + QSFP11_PRESENT, + QSFP12_PRESENT, + QSFP13_PRESENT, + QSFP14_PRESENT, + QSFP15_PRESENT, + QSFP16_PRESENT, + QSFP17_PRESENT, + QSFP18_PRESENT, + QSFP19_PRESENT, + QSFP20_PRESENT, + QSFP21_PRESENT, + QSFP22_PRESENT, + QSFP23_PRESENT, + QSFP24_PRESENT, + QSFP25_PRESENT, + QSFP26_PRESENT, + QSFP27_PRESENT, + QSFP28_PRESENT, + QSFP29_PRESENT, + QSFP30_PRESENT, + QSFP31_PRESENT, + QSFP32_PRESENT, + QSFP_INT_ALL, + QSFP1_INT, + QSFP2_INT, + QSFP3_INT, + QSFP4_INT, + QSFP5_INT, + QSFP6_INT, + QSFP7_INT, + QSFP8_INT, + QSFP9_INT, + QSFP10_INT, + QSFP11_INT, + QSFP12_INT, + QSFP13_INT, + QSFP14_INT, + QSFP15_INT, + QSFP16_INT, + QSFP17_INT, + QSFP18_INT, + QSFP19_INT, + QSFP20_INT, + QSFP21_INT, + QSFP22_INT, + QSFP23_INT, + QSFP24_INT, + QSFP25_INT, + QSFP26_INT, + QSFP27_INT, + QSFP28_INT, + QSFP29_INT, + QSFP30_INT, + QSFP31_INT, + QSFP32_INT, + QSFP1_4_INT, + QSFP2_4_INT, + QSFP3_4_INT, + QSFP4_4_INT, + QSFP1_4_MODPRS, + QSFP2_4_MODPRS, + QSFP3_4_MODPRS, + QSFP4_4_MODPRS, + QSFP1_4_INT_MASK, + QSFP2_4_INT_MASK, + QSFP3_4_INT_MASK, + QSFP4_4_INT_MASK, + QSFP1_4_MODPRS_MASK, + QSFP2_4_MODPRS_MASK, + QSFP3_4_MODPRS_MASK, + QSFP4_4_MODPRS_MASK +}; +/* end of struct i2c_sysfs_attributes */ + +/* sysfs attributes for SENSOR_DEVICE_ATTR */ +static SENSOR_DEVICE_ATTR(cpld_23_ver , S_IRUGO , cpld_hw_ver_get , NULL , 23); +static SENSOR_DEVICE_ATTR(cpld_30_ver , S_IRUGO , cpld_hw_ver_get , NULL , 30); +static SENSOR_DEVICE_ATTR(cpld_31_ver , S_IRUGO , cpld_hw_ver_get , NULL , 31); +static SENSOR_DEVICE_ATTR(cpld_32_ver , S_IRUGO , cpld_hw_ver_get , NULL , 32); +static SENSOR_DEVICE_ATTR(wdt_en , S_IRUGO | S_IWUSR , wdt_enable_get , wdt_enable_set , WDT_EN); +static SENSOR_DEVICE_ATTR(eeprom_wp , S_IRUGO | S_IWUSR , eeprom_wp_get , eeprom_wp_set , EEPROM_WP); +static SENSOR_DEVICE_ATTR(usb_en , S_IRUGO | S_IWUSR , usb_enable_get , usb_enable_set , USB_EN); +static SENSOR_DEVICE_ATTR(shutdown_set , S_IRUGO | S_IWUSR , NULL , shutdown_set , SHUTDOWN_SET); +static SENSOR_DEVICE_ATTR(reset , S_IRUGO | S_IWUSR , NULL , reset_mac_set , RESET); +static SENSOR_DEVICE_ATTR(bmc_present , S_IRUGO , bmc_enable_get , NULL , BMC_PRESENT); +static SENSOR_DEVICE_ATTR(led_1 , S_IRUGO | S_IWUSR , led_ctrl_get , led_ctrl_set , 4); +static SENSOR_DEVICE_ATTR(led_2 , S_IRUGO | S_IWUSR , led_ctrl_get , led_ctrl_set , 3); +static SENSOR_DEVICE_ATTR(led_flow , S_IRUGO | S_IWUSR , led_ctrl_get , led_ctrl_set , 2); +static SENSOR_DEVICE_ATTR(led_sys , S_IRUGO | S_IWUSR , led_ctrl_get , led_ctrl_set , 1); +static SENSOR_DEVICE_ATTR(led_fiber , S_IRUGO | S_IWUSR , led_fiber_get , led_fiber_set , LED_FIBER); +static SENSOR_DEVICE_ATTR(temp_r_b_int , S_IRUGO , themal_int_get , NULL , TEMP_R_B_INT); +static SENSOR_DEVICE_ATTR(temp_l_b_int , S_IRUGO , themal_int_get , NULL , TEMP_L_B_INT); +static SENSOR_DEVICE_ATTR(temp_r_t_int , S_IRUGO , themal_int_get , NULL , TEMP_R_T_INT); +static SENSOR_DEVICE_ATTR(temp_l_t_int , S_IRUGO , themal_int_get , NULL , TEMP_L_T_INT); +static SENSOR_DEVICE_ATTR(temp_r_b_int_mask , S_IRUGO | S_IWUSR , themal_int_mask_get , themal_int_mask_set , TEMP_R_B_INT_MASK); +static SENSOR_DEVICE_ATTR(temp_l_b_int_mask , S_IRUGO | S_IWUSR , themal_int_mask_get , themal_int_mask_set , TEMP_L_B_INT_MASK); +static SENSOR_DEVICE_ATTR(temp_r_t_int_mask , S_IRUGO | S_IWUSR , themal_int_mask_get , themal_int_mask_set , TEMP_R_T_INT_MASK); +static SENSOR_DEVICE_ATTR(temp_l_t_int_mask , S_IRUGO | S_IWUSR , themal_int_mask_get , themal_int_mask_set , TEMP_L_T_INT_MASK); +static SENSOR_DEVICE_ATTR(cpld_fp_int , S_IRUGO , sys_int_get , NULL , CPLD_FP_INT); +static SENSOR_DEVICE_ATTR(cpld_rp_int , S_IRUGO , sys_int_get , NULL , CPLD_RP_INT); +static SENSOR_DEVICE_ATTR(cpld_fan_int , S_IRUGO , sys_int_get , NULL , CPLD_FAN_INT); +static SENSOR_DEVICE_ATTR(cpld_psu_int , S_IRUGO , sys_int_get , NULL , CPLD_PSU_INT); +static SENSOR_DEVICE_ATTR(thermal_int , S_IRUGO , sys_int_get , NULL , THERMAL_INT); +static SENSOR_DEVICE_ATTR(usb_int , S_IRUGO , sys_int_get , NULL , USB_INT); +static SENSOR_DEVICE_ATTR(cpld_fp_int_mask , S_IRUGO | S_IWUSR , sys_int_mask_get , sys_int_mask_set , CPLD_FP_INT_MASK); +static SENSOR_DEVICE_ATTR(cpld_rp_int_mask , S_IRUGO | S_IWUSR , sys_int_mask_get , sys_int_mask_set , CPLD_RP_INT_MASK); +static SENSOR_DEVICE_ATTR(cpld_fan_int_mask , S_IRUGO | S_IWUSR , sys_int_mask_get , sys_int_mask_set , CPLD_FAN_INT_MASK); +static SENSOR_DEVICE_ATTR(cpld_psu_int_mask , S_IRUGO | S_IWUSR , sys_int_mask_get , sys_int_mask_set , CPLD_PSU_INT_MASK); +static SENSOR_DEVICE_ATTR(thermal_int_mask , S_IRUGO | S_IWUSR , sys_int_mask_get , sys_int_mask_set , THERMAL_INT_MASK); +static SENSOR_DEVICE_ATTR(usb_int_mask , S_IRUGO | S_IWUSR , sys_int_mask_get , sys_int_mask_set , USB_INT_MASK); +static SENSOR_DEVICE_ATTR(temp_r_b_f , S_IRUGO , themal_temp_get , NULL , TEMP_R_B_F); +static SENSOR_DEVICE_ATTR(temp_r_b_b , S_IRUGO , themal_temp_get , NULL , TEMP_R_B_B); +static SENSOR_DEVICE_ATTR(temp_l_b_f , S_IRUGO , themal_temp_get , NULL , TEMP_L_B_F); +static SENSOR_DEVICE_ATTR(temp_l_b_b , S_IRUGO , themal_temp_get , NULL , TEMP_L_B_B); +static SENSOR_DEVICE_ATTR(temp_r_t_f , S_IRUGO , themal_temp_get , NULL , TEMP_R_T_F); +static SENSOR_DEVICE_ATTR(temp_r_t_b , S_IRUGO , themal_temp_get , NULL , TEMP_R_T_B); +static SENSOR_DEVICE_ATTR(temp_l_t_f , S_IRUGO , themal_temp_get , NULL , TEMP_L_T_F); +static SENSOR_DEVICE_ATTR(temp_l_t_b , S_IRUGO , themal_temp_get , NULL , TEMP_L_T_B); +static SENSOR_DEVICE_ATTR(temp_r_b_f_max , S_IRUGO , themal_temp_max_get , NULL , TEMP_R_B_F_MAX); +static SENSOR_DEVICE_ATTR(temp_l_b_f_max , S_IRUGO , themal_temp_max_get , NULL , TEMP_L_B_F_MAX); +static SENSOR_DEVICE_ATTR(temp_r_t_f_max , S_IRUGO , themal_temp_max_get , NULL , TEMP_R_T_F_MAX); +static SENSOR_DEVICE_ATTR(temp_l_t_f_max , S_IRUGO , themal_temp_max_get , NULL , TEMP_L_T_F_MAX); +static SENSOR_DEVICE_ATTR(temp_r_b_b_max , S_IRUGO , themal_temp_max_get , NULL , TEMP_R_B_B_MAX); +static SENSOR_DEVICE_ATTR(temp_l_b_b_max , S_IRUGO , themal_temp_max_get , NULL , TEMP_L_B_B_MAX); +static SENSOR_DEVICE_ATTR(temp_r_t_b_max , S_IRUGO , themal_temp_max_get , NULL , TEMP_R_T_B_MAX); +static SENSOR_DEVICE_ATTR(temp_l_t_b_max , S_IRUGO , themal_temp_max_get , NULL , TEMP_L_T_B_MAX); +static SENSOR_DEVICE_ATTR(temp_r_b_f_min , S_IRUGO , themal_temp_min_get , NULL , TEMP_R_B_F_MIN); +static SENSOR_DEVICE_ATTR(temp_l_b_f_min , S_IRUGO , themal_temp_min_get , NULL , TEMP_L_B_F_MIN); +static SENSOR_DEVICE_ATTR(temp_r_t_f_min , S_IRUGO , themal_temp_min_get , NULL , TEMP_R_T_F_MIN); +static SENSOR_DEVICE_ATTR(temp_l_t_f_min , S_IRUGO , themal_temp_min_get , NULL , TEMP_L_T_F_MIN); +static SENSOR_DEVICE_ATTR(temp_r_b_b_min , S_IRUGO , themal_temp_min_get , NULL , TEMP_R_B_B_MIN); +static SENSOR_DEVICE_ATTR(temp_l_b_b_min , S_IRUGO , themal_temp_min_get , NULL , TEMP_L_B_B_MIN); +static SENSOR_DEVICE_ATTR(temp_r_t_b_min , S_IRUGO , themal_temp_min_get , NULL , TEMP_R_T_B_MIN); +static SENSOR_DEVICE_ATTR(temp_l_t_b_min , S_IRUGO , themal_temp_min_get , NULL , TEMP_L_T_B_MIN); +static SENSOR_DEVICE_ATTR(temp_r_b_f_crit , S_IRUGO , themal_temp_crit_get , NULL , TEMP_R_B_F_CRIT); +static SENSOR_DEVICE_ATTR(temp_l_b_f_crit , S_IRUGO , themal_temp_crit_get , NULL , TEMP_L_B_F_CRIT); +static SENSOR_DEVICE_ATTR(temp_r_t_f_crit , S_IRUGO , themal_temp_crit_get , NULL , TEMP_R_T_F_CRIT); +static SENSOR_DEVICE_ATTR(temp_l_t_f_crit , S_IRUGO , themal_temp_crit_get , NULL , TEMP_L_T_F_CRIT); +static SENSOR_DEVICE_ATTR(temp_r_b_b_crit , S_IRUGO , themal_temp_crit_get , NULL , TEMP_R_B_B_CRIT); +static SENSOR_DEVICE_ATTR(temp_l_b_b_crit , S_IRUGO , themal_temp_crit_get , NULL , TEMP_L_B_B_CRIT); +static SENSOR_DEVICE_ATTR(temp_r_t_b_crit , S_IRUGO , themal_temp_crit_get , NULL , TEMP_R_T_B_CRIT); +static SENSOR_DEVICE_ATTR(temp_l_t_b_crit , S_IRUGO , themal_temp_crit_get , NULL , TEMP_L_T_B_CRIT); +static SENSOR_DEVICE_ATTR(temp_r_b_f_lcrit , S_IRUGO , themal_temp_lcrit_get , NULL , TEMP_R_B_F_LCRIT); +static SENSOR_DEVICE_ATTR(temp_l_b_f_lcrit , S_IRUGO , themal_temp_lcrit_get , NULL , TEMP_L_B_F_LCRIT); +static SENSOR_DEVICE_ATTR(temp_r_t_f_lcrit , S_IRUGO , themal_temp_lcrit_get , NULL , TEMP_R_T_F_LCRIT); +static SENSOR_DEVICE_ATTR(temp_l_t_f_lcrit , S_IRUGO , themal_temp_lcrit_get , NULL , TEMP_L_T_F_LCRIT); +static SENSOR_DEVICE_ATTR(temp_r_b_b_lcrit , S_IRUGO , themal_temp_lcrit_get , NULL , TEMP_R_B_B_LCRIT); +static SENSOR_DEVICE_ATTR(temp_l_b_b_lcrit , S_IRUGO , themal_temp_lcrit_get , NULL , TEMP_L_B_B_LCRIT); +static SENSOR_DEVICE_ATTR(temp_r_t_b_lcrit , S_IRUGO , themal_temp_lcrit_get , NULL , TEMP_R_T_B_LCRIT); +static SENSOR_DEVICE_ATTR(temp_l_t_b_lcrit , S_IRUGO , themal_temp_lcrit_get , NULL , TEMP_L_T_B_LCRIT); +static SENSOR_DEVICE_ATTR(fanctrl_rpm , S_IRUGO , fan_ctrl_rpm_get , NULL , FANCTRL_RPM); +static SENSOR_DEVICE_ATTR(fanctrl_mode , S_IRUGO , fan_ctrl_mode_get , NULL , FANCTRL_MODE); +static SENSOR_DEVICE_ATTR(fan1_stat , S_IRUGO , fan_status_get , NULL , 1); +static SENSOR_DEVICE_ATTR(fan2_stat , S_IRUGO , fan_status_get , NULL , 2); +static SENSOR_DEVICE_ATTR(fan3_stat , S_IRUGO , fan_status_get , NULL , 3); +static SENSOR_DEVICE_ATTR(fan4_stat , S_IRUGO , fan_status_get , NULL , 4); +static SENSOR_DEVICE_ATTR(fan5_stat , S_IRUGO , fan_status_get , NULL , 5); +static SENSOR_DEVICE_ATTR(fan1_present , S_IRUGO , fan_present_get , NULL , 1); +static SENSOR_DEVICE_ATTR(fan2_present , S_IRUGO , fan_present_get , NULL , 2); +static SENSOR_DEVICE_ATTR(fan3_present , S_IRUGO , fan_present_get , NULL , 3); +static SENSOR_DEVICE_ATTR(fan4_present , S_IRUGO , fan_present_get , NULL , 4); +static SENSOR_DEVICE_ATTR(fan5_present , S_IRUGO , fan_present_get , NULL , 5); +static SENSOR_DEVICE_ATTR(fan1_power , S_IRUGO , fan_power_get , NULL , 1); +static SENSOR_DEVICE_ATTR(fan2_power , S_IRUGO , fan_power_get , NULL , 2); +static SENSOR_DEVICE_ATTR(fan3_power , S_IRUGO , fan_power_get , NULL , 3); +static SENSOR_DEVICE_ATTR(fan4_power , S_IRUGO , fan_power_get , NULL , 4); +static SENSOR_DEVICE_ATTR(fan5_power , S_IRUGO , fan_power_get , NULL , 5); +static SENSOR_DEVICE_ATTR(fan1_front_rpm , S_IRUGO , fan_rpm_get , NULL , FAN1_FRONT_RPM); +static SENSOR_DEVICE_ATTR(fan2_front_rpm , S_IRUGO , fan_rpm_get , NULL , FAN2_FRONT_RPM); +static SENSOR_DEVICE_ATTR(fan3_front_rpm , S_IRUGO , fan_rpm_get , NULL , FAN3_FRONT_RPM); +static SENSOR_DEVICE_ATTR(fan4_front_rpm , S_IRUGO , fan_rpm_get , NULL , FAN4_FRONT_RPM); +static SENSOR_DEVICE_ATTR(fan5_front_rpm , S_IRUGO , fan_rpm_get , NULL , FAN5_FRONT_RPM); +static SENSOR_DEVICE_ATTR(fan1_rear_rpm , S_IRUGO , fan_rpm_get , NULL , FAN1_REAR_RPM); +static SENSOR_DEVICE_ATTR(fan2_rear_rpm , S_IRUGO , fan_rpm_get , NULL , FAN2_REAR_RPM); +static SENSOR_DEVICE_ATTR(fan3_rear_rpm , S_IRUGO , fan_rpm_get , NULL , FAN3_REAR_RPM); +static SENSOR_DEVICE_ATTR(fan4_rear_rpm , S_IRUGO , fan_rpm_get , NULL , FAN4_REAR_RPM); +static SENSOR_DEVICE_ATTR(fan5_rear_rpm , S_IRUGO , fan_rpm_get , NULL , FAN5_REAR_RPM); +static SENSOR_DEVICE_ATTR(psu1_good , S_IRUGO , psu_status_get , NULL , 1); +static SENSOR_DEVICE_ATTR(psu2_good , S_IRUGO , psu_status_get , NULL , 2); +static SENSOR_DEVICE_ATTR(psu1_prnt , S_IRUGO , psu_present_get , NULL , 1); +static SENSOR_DEVICE_ATTR(psu2_prnt , S_IRUGO , psu_present_get , NULL , 2); +static SENSOR_DEVICE_ATTR(psu1_vin , S_IRUGO , psu_vin_get , NULL , PSU1_VIN); +static SENSOR_DEVICE_ATTR(psu1_iin , S_IRUGO , psu_iin_get , NULL , PSU1_IIN); +static SENSOR_DEVICE_ATTR(psu1_vout , S_IRUGO , psu_vout_get , NULL , PSU1_VOUT); +static SENSOR_DEVICE_ATTR(psu1_iout , S_IRUGO , psu_iout_get , NULL , PSU1_IOUT); +static SENSOR_DEVICE_ATTR(psu1_temp , S_IRUGO , psu_temp_get , NULL , PSU1_TEMP); +static SENSOR_DEVICE_ATTR(psu1_fan_speed , S_IRUGO , psu_fan_get , NULL , PSU1_FAN_SPEED); +static SENSOR_DEVICE_ATTR(psu1_pout , S_IRUGO , psu_pout_get , NULL , PSU1_POUT); +static SENSOR_DEVICE_ATTR(psu1_pin , S_IRUGO , psu_pin_get , NULL , PSU1_PIN); +static SENSOR_DEVICE_ATTR(psu1_mfr_model , S_IRUGO , psu_mfr_model_get , NULL , PSU1_MFR_MODEL); +static SENSOR_DEVICE_ATTR(psu1_mfr_iout_max , S_IRUGO , psu_iout_max_get , NULL , PSU1_MFR_IOUT_MAX); +static SENSOR_DEVICE_ATTR(psu1_vomde , S_IRUGO , psu_vmode_get , NULL , PSU1_VOMDE); +static SENSOR_DEVICE_ATTR(psu2_vin , S_IRUGO , psu_vin_get , NULL , PSU2_VIN); +static SENSOR_DEVICE_ATTR(psu2_iin , S_IRUGO , psu_iin_get , NULL , PSU2_IIN); +static SENSOR_DEVICE_ATTR(psu2_vout , S_IRUGO , psu_vout_get , NULL , PSU2_VOUT); +static SENSOR_DEVICE_ATTR(psu2_iout , S_IRUGO , psu_iout_get , NULL , PSU2_IOUT); +static SENSOR_DEVICE_ATTR(psu2_temp , S_IRUGO , psu_temp_get , NULL , PSU2_TEMP); +static SENSOR_DEVICE_ATTR(psu2_fan_speed , S_IRUGO , psu_fan_get , NULL , PSU2_FAN_SPEED); +static SENSOR_DEVICE_ATTR(psu2_pout , S_IRUGO , psu_pout_get , NULL , PSU2_POUT); +static SENSOR_DEVICE_ATTR(psu2_pin , S_IRUGO , psu_pin_get , NULL , PSU2_PIN); +static SENSOR_DEVICE_ATTR(psu2_mfr_model , S_IRUGO , psu_mfr_model_get , NULL , PSU2_MFR_MODEL); +static SENSOR_DEVICE_ATTR(psu2_mfr_iout_max , S_IRUGO , psu_iout_max_get , NULL , PSU2_MFR_IOUT_MAX); +static SENSOR_DEVICE_ATTR(psu2_vomde , S_IRUGO , psu_vmode_get , NULL , PSU2_VOMDE); +static SENSOR_DEVICE_ATTR(dc6e_p0_vout , S_IRUGO , dc_vout_get , NULL , DC6E_P0_VOUT); +static SENSOR_DEVICE_ATTR(dc6e_p0_iout , S_IRUGO , dc_iout_get , NULL , DC6E_P0_IOUT); +static SENSOR_DEVICE_ATTR(dc6e_p0_pout , S_IRUGO , dc_pout_get , NULL , DC6E_P0_POUT); +static SENSOR_DEVICE_ATTR(dc6e_p1_vout , S_IRUGO , dc_vout_get , NULL , DC6E_P1_VOUT); +static SENSOR_DEVICE_ATTR(dc6e_p1_iout , S_IRUGO , dc_iout_get , NULL , DC6E_P1_IOUT); +static SENSOR_DEVICE_ATTR(dc6e_p1_pout , S_IRUGO , dc_pout_get , NULL , DC6E_P1_POUT); +static SENSOR_DEVICE_ATTR(dc70_p0_vout , S_IRUGO , dc_vout_get , NULL , DC70_P0_VOUT); +static SENSOR_DEVICE_ATTR(dc70_p0_iout , S_IRUGO , dc_iout_get , NULL , DC70_P0_IOUT); +static SENSOR_DEVICE_ATTR(dc70_p0_pout , S_IRUGO , dc_pout_get , NULL , DC70_P0_POUT); +static SENSOR_DEVICE_ATTR(dc70_p1_vout , S_IRUGO , dc_vout_get , NULL , DC70_P1_VOUT); +static SENSOR_DEVICE_ATTR(dc70_p1_iout , S_IRUGO , dc_iout_get , NULL , DC70_P1_IOUT); +static SENSOR_DEVICE_ATTR(dc70_p1_pout , S_IRUGO , dc_pout_get , NULL , DC70_P1_POUT); +static SENSOR_DEVICE_ATTR(qsfp_low_power_all , S_IRUGO | S_IWUSR , qsfp_low_power_all_get , qsfp_low_power_all_set , QSFP_LOW_POWER_ALL); +static SENSOR_DEVICE_ATTR(qsfp1_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 1); +static SENSOR_DEVICE_ATTR(qsfp2_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 2); +static SENSOR_DEVICE_ATTR(qsfp3_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 3); +static SENSOR_DEVICE_ATTR(qsfp4_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 4); +static SENSOR_DEVICE_ATTR(qsfp5_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 5); +static SENSOR_DEVICE_ATTR(qsfp6_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 6); +static SENSOR_DEVICE_ATTR(qsfp7_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 7); +static SENSOR_DEVICE_ATTR(qsfp8_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 8); +static SENSOR_DEVICE_ATTR(qsfp9_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 9); +static SENSOR_DEVICE_ATTR(qsfp10_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 10); +static SENSOR_DEVICE_ATTR(qsfp11_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 11); +static SENSOR_DEVICE_ATTR(qsfp12_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 12); +static SENSOR_DEVICE_ATTR(qsfp13_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 13); +static SENSOR_DEVICE_ATTR(qsfp14_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 14); +static SENSOR_DEVICE_ATTR(qsfp15_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 15); +static SENSOR_DEVICE_ATTR(qsfp16_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 16); +static SENSOR_DEVICE_ATTR(qsfp17_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 17); +static SENSOR_DEVICE_ATTR(qsfp18_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 18); +static SENSOR_DEVICE_ATTR(qsfp19_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 19); +static SENSOR_DEVICE_ATTR(qsfp20_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 20); +static SENSOR_DEVICE_ATTR(qsfp21_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 21); +static SENSOR_DEVICE_ATTR(qsfp22_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 22); +static SENSOR_DEVICE_ATTR(qsfp23_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 23); +static SENSOR_DEVICE_ATTR(qsfp24_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 24); +static SENSOR_DEVICE_ATTR(qsfp25_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 25); +static SENSOR_DEVICE_ATTR(qsfp26_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 26); +static SENSOR_DEVICE_ATTR(qsfp27_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 27); +static SENSOR_DEVICE_ATTR(qsfp28_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 28); +static SENSOR_DEVICE_ATTR(qsfp29_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 29); +static SENSOR_DEVICE_ATTR(qsfp30_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 30); +static SENSOR_DEVICE_ATTR(qsfp31_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 31); +static SENSOR_DEVICE_ATTR(qsfp32_low_power , S_IRUGO | S_IWUSR , qsfp_low_power_get , qsfp_low_power_set , 32); +static SENSOR_DEVICE_ATTR(qsfp_reset_all , S_IRUGO | S_IWUSR , NULL , qsfp_reset_all_set , QSFP_RESET_ALL); +static SENSOR_DEVICE_ATTR(qsfp1_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 1); +static SENSOR_DEVICE_ATTR(qsfp2_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 2); +static SENSOR_DEVICE_ATTR(qsfp3_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 3); +static SENSOR_DEVICE_ATTR(qsfp4_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 4); +static SENSOR_DEVICE_ATTR(qsfp5_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 5); +static SENSOR_DEVICE_ATTR(qsfp6_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 6); +static SENSOR_DEVICE_ATTR(qsfp7_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 7); +static SENSOR_DEVICE_ATTR(qsfp8_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 8); +static SENSOR_DEVICE_ATTR(qsfp9_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 9); +static SENSOR_DEVICE_ATTR(qsfp10_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 10); +static SENSOR_DEVICE_ATTR(qsfp11_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 11); +static SENSOR_DEVICE_ATTR(qsfp12_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 12); +static SENSOR_DEVICE_ATTR(qsfp13_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 13); +static SENSOR_DEVICE_ATTR(qsfp14_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 14); +static SENSOR_DEVICE_ATTR(qsfp15_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 15); +static SENSOR_DEVICE_ATTR(qsfp16_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 16); +static SENSOR_DEVICE_ATTR(qsfp17_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 17); +static SENSOR_DEVICE_ATTR(qsfp18_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 18); +static SENSOR_DEVICE_ATTR(qsfp19_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 19); +static SENSOR_DEVICE_ATTR(qsfp20_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 20); +static SENSOR_DEVICE_ATTR(qsfp21_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 21); +static SENSOR_DEVICE_ATTR(qsfp22_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 22); +static SENSOR_DEVICE_ATTR(qsfp23_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 23); +static SENSOR_DEVICE_ATTR(qsfp24_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 24); +static SENSOR_DEVICE_ATTR(qsfp25_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 25); +static SENSOR_DEVICE_ATTR(qsfp26_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 26); +static SENSOR_DEVICE_ATTR(qsfp27_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 27); +static SENSOR_DEVICE_ATTR(qsfp28_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 28); +static SENSOR_DEVICE_ATTR(qsfp29_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 29); +static SENSOR_DEVICE_ATTR(qsfp30_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 30); +static SENSOR_DEVICE_ATTR(qsfp31_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 31); +static SENSOR_DEVICE_ATTR(qsfp32_reset , S_IRUGO | S_IWUSR , NULL , qsfp_reset_set , 32); +static SENSOR_DEVICE_ATTR(qsfp_present_all , S_IRUGO , qsfp_present_all_get , NULL , QSFP_PRESENT_ALL); +static SENSOR_DEVICE_ATTR(qsfp1_present , S_IRUGO , qsfp_present_get , NULL , 1); +static SENSOR_DEVICE_ATTR(qsfp2_present , S_IRUGO , qsfp_present_get , NULL , 2); +static SENSOR_DEVICE_ATTR(qsfp3_present , S_IRUGO , qsfp_present_get , NULL , 3); +static SENSOR_DEVICE_ATTR(qsfp4_present , S_IRUGO , qsfp_present_get , NULL , 4); +static SENSOR_DEVICE_ATTR(qsfp5_present , S_IRUGO , qsfp_present_get , NULL , 5); +static SENSOR_DEVICE_ATTR(qsfp6_present , S_IRUGO , qsfp_present_get , NULL , 6); +static SENSOR_DEVICE_ATTR(qsfp7_present , S_IRUGO , qsfp_present_get , NULL , 7); +static SENSOR_DEVICE_ATTR(qsfp8_present , S_IRUGO , qsfp_present_get , NULL , 8); +static SENSOR_DEVICE_ATTR(qsfp9_present , S_IRUGO , qsfp_present_get , NULL , 9); +static SENSOR_DEVICE_ATTR(qsfp10_present , S_IRUGO , qsfp_present_get , NULL , 10); +static SENSOR_DEVICE_ATTR(qsfp11_present , S_IRUGO , qsfp_present_get , NULL , 11); +static SENSOR_DEVICE_ATTR(qsfp12_present , S_IRUGO , qsfp_present_get , NULL , 12); +static SENSOR_DEVICE_ATTR(qsfp13_present , S_IRUGO , qsfp_present_get , NULL , 13); +static SENSOR_DEVICE_ATTR(qsfp14_present , S_IRUGO , qsfp_present_get , NULL , 14); +static SENSOR_DEVICE_ATTR(qsfp15_present , S_IRUGO , qsfp_present_get , NULL , 15); +static SENSOR_DEVICE_ATTR(qsfp16_present , S_IRUGO , qsfp_present_get , NULL , 16); +static SENSOR_DEVICE_ATTR(qsfp17_present , S_IRUGO , qsfp_present_get , NULL , 17); +static SENSOR_DEVICE_ATTR(qsfp18_present , S_IRUGO , qsfp_present_get , NULL , 18); +static SENSOR_DEVICE_ATTR(qsfp19_present , S_IRUGO , qsfp_present_get , NULL , 19); +static SENSOR_DEVICE_ATTR(qsfp20_present , S_IRUGO , qsfp_present_get , NULL , 20); +static SENSOR_DEVICE_ATTR(qsfp21_present , S_IRUGO , qsfp_present_get , NULL , 21); +static SENSOR_DEVICE_ATTR(qsfp22_present , S_IRUGO , qsfp_present_get , NULL , 22); +static SENSOR_DEVICE_ATTR(qsfp23_present , S_IRUGO , qsfp_present_get , NULL , 23); +static SENSOR_DEVICE_ATTR(qsfp24_present , S_IRUGO , qsfp_present_get , NULL , 24); +static SENSOR_DEVICE_ATTR(qsfp25_present , S_IRUGO , qsfp_present_get , NULL , 25); +static SENSOR_DEVICE_ATTR(qsfp26_present , S_IRUGO , qsfp_present_get , NULL , 26); +static SENSOR_DEVICE_ATTR(qsfp27_present , S_IRUGO , qsfp_present_get , NULL , 27); +static SENSOR_DEVICE_ATTR(qsfp28_present , S_IRUGO , qsfp_present_get , NULL , 28); +static SENSOR_DEVICE_ATTR(qsfp29_present , S_IRUGO , qsfp_present_get , NULL , 29); +static SENSOR_DEVICE_ATTR(qsfp30_present , S_IRUGO , qsfp_present_get , NULL , 30); +static SENSOR_DEVICE_ATTR(qsfp31_present , S_IRUGO , qsfp_present_get , NULL , 31); +static SENSOR_DEVICE_ATTR(qsfp32_present , S_IRUGO , qsfp_present_get , NULL , 32); +static SENSOR_DEVICE_ATTR(qsfp_int_all , S_IRUGO , qsfp_int_all_get , NULL , QSFP_INT_ALL); +static SENSOR_DEVICE_ATTR(qsfp1_int , S_IRUGO , qsfp_int_get , NULL , 1); +static SENSOR_DEVICE_ATTR(qsfp2_int , S_IRUGO , qsfp_int_get , NULL , 2); +static SENSOR_DEVICE_ATTR(qsfp3_int , S_IRUGO , qsfp_int_get , NULL , 3); +static SENSOR_DEVICE_ATTR(qsfp4_int , S_IRUGO , qsfp_int_get , NULL , 4); +static SENSOR_DEVICE_ATTR(qsfp5_int , S_IRUGO , qsfp_int_get , NULL , 5); +static SENSOR_DEVICE_ATTR(qsfp6_int , S_IRUGO , qsfp_int_get , NULL , 6); +static SENSOR_DEVICE_ATTR(qsfp7_int , S_IRUGO , qsfp_int_get , NULL , 7); +static SENSOR_DEVICE_ATTR(qsfp8_int , S_IRUGO , qsfp_int_get , NULL , 8); +static SENSOR_DEVICE_ATTR(qsfp9_int , S_IRUGO , qsfp_int_get , NULL , 9); +static SENSOR_DEVICE_ATTR(qsfp10_int , S_IRUGO , qsfp_int_get , NULL , 10); +static SENSOR_DEVICE_ATTR(qsfp11_int , S_IRUGO , qsfp_int_get , NULL , 11); +static SENSOR_DEVICE_ATTR(qsfp12_int , S_IRUGO , qsfp_int_get , NULL , 12); +static SENSOR_DEVICE_ATTR(qsfp13_int , S_IRUGO , qsfp_int_get , NULL , 13); +static SENSOR_DEVICE_ATTR(qsfp14_int , S_IRUGO , qsfp_int_get , NULL , 14); +static SENSOR_DEVICE_ATTR(qsfp15_int , S_IRUGO , qsfp_int_get , NULL , 15); +static SENSOR_DEVICE_ATTR(qsfp16_int , S_IRUGO , qsfp_int_get , NULL , 16); +static SENSOR_DEVICE_ATTR(qsfp17_int , S_IRUGO , qsfp_int_get , NULL , 17); +static SENSOR_DEVICE_ATTR(qsfp18_int , S_IRUGO , qsfp_int_get , NULL , 18); +static SENSOR_DEVICE_ATTR(qsfp19_int , S_IRUGO , qsfp_int_get , NULL , 19); +static SENSOR_DEVICE_ATTR(qsfp20_int , S_IRUGO , qsfp_int_get , NULL , 20); +static SENSOR_DEVICE_ATTR(qsfp21_int , S_IRUGO , qsfp_int_get , NULL , 21); +static SENSOR_DEVICE_ATTR(qsfp22_int , S_IRUGO , qsfp_int_get , NULL , 22); +static SENSOR_DEVICE_ATTR(qsfp23_int , S_IRUGO , qsfp_int_get , NULL , 23); +static SENSOR_DEVICE_ATTR(qsfp24_int , S_IRUGO , qsfp_int_get , NULL , 24); +static SENSOR_DEVICE_ATTR(qsfp25_int , S_IRUGO , qsfp_int_get , NULL , 25); +static SENSOR_DEVICE_ATTR(qsfp26_int , S_IRUGO , qsfp_int_get , NULL , 26); +static SENSOR_DEVICE_ATTR(qsfp27_int , S_IRUGO , qsfp_int_get , NULL , 27); +static SENSOR_DEVICE_ATTR(qsfp28_int , S_IRUGO , qsfp_int_get , NULL , 28); +static SENSOR_DEVICE_ATTR(qsfp29_int , S_IRUGO , qsfp_int_get , NULL , 29); +static SENSOR_DEVICE_ATTR(qsfp30_int , S_IRUGO , qsfp_int_get , NULL , 30); +static SENSOR_DEVICE_ATTR(qsfp31_int , S_IRUGO , qsfp_int_get , NULL , 31); +static SENSOR_DEVICE_ATTR(qsfp32_int , S_IRUGO , qsfp_int_get , NULL , 32); +static SENSOR_DEVICE_ATTR(qsfp1_4_int , S_IRUGO , qsfp_quter_int_get , NULL , 1); +static SENSOR_DEVICE_ATTR(qsfp2_4_int , S_IRUGO , qsfp_quter_int_get , NULL , 2); +static SENSOR_DEVICE_ATTR(qsfp3_4_int , S_IRUGO , qsfp_quter_int_get , NULL , 3); +static SENSOR_DEVICE_ATTR(qsfp4_4_int , S_IRUGO , qsfp_quter_int_get , NULL , 4); +static SENSOR_DEVICE_ATTR(qsfp1_4_modprs , S_IRUGO , qsfp_modprs_int_get , NULL , 1); +static SENSOR_DEVICE_ATTR(qsfp2_4_modprs , S_IRUGO , qsfp_modprs_int_get , NULL , 2); +static SENSOR_DEVICE_ATTR(qsfp3_4_modprs , S_IRUGO , qsfp_modprs_int_get , NULL , 3); +static SENSOR_DEVICE_ATTR(qsfp4_4_modprs , S_IRUGO , qsfp_modprs_int_get , NULL , 4); +static SENSOR_DEVICE_ATTR(qsfp1_4_int_mask , S_IRUGO | S_IWUSR , qsfp_quter_int_mask_get , qsfp_quter_int_mask_set , 1); +static SENSOR_DEVICE_ATTR(qsfp2_4_int_mask , S_IRUGO | S_IWUSR , qsfp_quter_int_mask_get , qsfp_quter_int_mask_set , 2); +static SENSOR_DEVICE_ATTR(qsfp3_4_int_mask , S_IRUGO | S_IWUSR , qsfp_quter_int_mask_get , qsfp_quter_int_mask_set , 3); +static SENSOR_DEVICE_ATTR(qsfp4_4_int_mask , S_IRUGO | S_IWUSR , qsfp_quter_int_mask_get , qsfp_quter_int_mask_set , 4); +static SENSOR_DEVICE_ATTR(qsfp1_4_modprs_mask , S_IRUGO | S_IWUSR , qsfp_modprs_int_mask_get , qsfp_modprs_int_mask_set , 1); +static SENSOR_DEVICE_ATTR(qsfp2_4_modprs_mask , S_IRUGO | S_IWUSR , qsfp_modprs_int_mask_get , qsfp_modprs_int_mask_set , 2); +static SENSOR_DEVICE_ATTR(qsfp3_4_modprs_mask , S_IRUGO | S_IWUSR , qsfp_modprs_int_mask_get , qsfp_modprs_int_mask_set , 3); +static SENSOR_DEVICE_ATTR(qsfp4_4_modprs_mask , S_IRUGO | S_IWUSR , qsfp_modprs_int_mask_get , qsfp_modprs_int_mask_set , 4); +/* end of sysfs attributes for SENSOR_DEVICE_ATTR */ + +/* sysfs attributes for hwmon */ +/* i2c-0 */ +static struct attribute *NBA715_SYS_attributes[] = +{ + &sensor_dev_attr_cpld_23_ver.dev_attr.attr, + &sensor_dev_attr_cpld_30_ver.dev_attr.attr, + &sensor_dev_attr_cpld_31_ver.dev_attr.attr, + &sensor_dev_attr_cpld_32_ver.dev_attr.attr, + &sensor_dev_attr_wdt_en.dev_attr.attr, + &sensor_dev_attr_eeprom_wp.dev_attr.attr, + &sensor_dev_attr_usb_en.dev_attr.attr, + &sensor_dev_attr_shutdown_set.dev_attr.attr, + &sensor_dev_attr_reset.dev_attr.attr, + &sensor_dev_attr_bmc_present.dev_attr.attr, + &sensor_dev_attr_cpld_fp_int.dev_attr.attr, + &sensor_dev_attr_cpld_rp_int.dev_attr.attr, + &sensor_dev_attr_cpld_fan_int.dev_attr.attr, + &sensor_dev_attr_cpld_psu_int.dev_attr.attr, + &sensor_dev_attr_thermal_int.dev_attr.attr, + &sensor_dev_attr_usb_int.dev_attr.attr, + &sensor_dev_attr_cpld_fp_int_mask.dev_attr.attr, + &sensor_dev_attr_cpld_rp_int_mask.dev_attr.attr, + &sensor_dev_attr_cpld_fan_int_mask.dev_attr.attr, + &sensor_dev_attr_cpld_psu_int_mask.dev_attr.attr, + &sensor_dev_attr_thermal_int_mask.dev_attr.attr, + &sensor_dev_attr_usb_int_mask.dev_attr.attr, + NULL +}; +static struct attribute *NBA715_LED_attributes[] = +{ + &sensor_dev_attr_led_1.dev_attr.attr, + &sensor_dev_attr_led_2.dev_attr.attr, + &sensor_dev_attr_led_flow.dev_attr.attr, + &sensor_dev_attr_led_sys.dev_attr.attr, + &sensor_dev_attr_led_fiber.dev_attr.attr, + NULL +}; +static struct attribute *NBA715_THERMAL_attributes[] = +{ + &sensor_dev_attr_temp_r_b_f.dev_attr.attr, + &sensor_dev_attr_temp_r_b_b.dev_attr.attr, + &sensor_dev_attr_temp_l_b_f.dev_attr.attr, + &sensor_dev_attr_temp_l_b_b.dev_attr.attr, + &sensor_dev_attr_temp_r_t_f.dev_attr.attr, + &sensor_dev_attr_temp_r_t_b.dev_attr.attr, + &sensor_dev_attr_temp_l_t_f.dev_attr.attr, + &sensor_dev_attr_temp_l_t_b.dev_attr.attr, + &sensor_dev_attr_temp_r_b_int.dev_attr.attr, + &sensor_dev_attr_temp_l_b_int.dev_attr.attr, + &sensor_dev_attr_temp_r_t_int.dev_attr.attr, + &sensor_dev_attr_temp_l_t_int.dev_attr.attr, + &sensor_dev_attr_temp_r_b_int_mask.dev_attr.attr, + &sensor_dev_attr_temp_l_b_int_mask.dev_attr.attr, + &sensor_dev_attr_temp_r_t_int_mask.dev_attr.attr, + &sensor_dev_attr_temp_l_t_int_mask.dev_attr.attr, + &sensor_dev_attr_temp_r_b_f_max.dev_attr.attr, + &sensor_dev_attr_temp_r_b_f_min.dev_attr.attr, + &sensor_dev_attr_temp_r_b_f_crit.dev_attr.attr, + &sensor_dev_attr_temp_r_b_f_lcrit.dev_attr.attr, + &sensor_dev_attr_temp_r_b_b_max.dev_attr.attr, + &sensor_dev_attr_temp_r_b_b_min.dev_attr.attr, + &sensor_dev_attr_temp_r_b_b_crit.dev_attr.attr, + &sensor_dev_attr_temp_r_b_b_lcrit.dev_attr.attr, + &sensor_dev_attr_temp_l_b_f_max.dev_attr.attr, + &sensor_dev_attr_temp_l_b_f_min.dev_attr.attr, + &sensor_dev_attr_temp_l_b_f_crit.dev_attr.attr, + &sensor_dev_attr_temp_l_b_f_lcrit.dev_attr.attr, + &sensor_dev_attr_temp_l_b_b_max.dev_attr.attr, + &sensor_dev_attr_temp_l_b_b_min.dev_attr.attr, + &sensor_dev_attr_temp_l_b_b_crit.dev_attr.attr, + &sensor_dev_attr_temp_l_b_b_lcrit.dev_attr.attr, + &sensor_dev_attr_temp_r_t_f_max.dev_attr.attr, + &sensor_dev_attr_temp_r_t_f_min.dev_attr.attr, + &sensor_dev_attr_temp_r_t_f_crit.dev_attr.attr, + &sensor_dev_attr_temp_r_t_f_lcrit.dev_attr.attr, + &sensor_dev_attr_temp_r_t_b_max.dev_attr.attr, + &sensor_dev_attr_temp_r_t_b_min.dev_attr.attr, + &sensor_dev_attr_temp_r_t_b_crit.dev_attr.attr, + &sensor_dev_attr_temp_r_t_b_lcrit.dev_attr.attr, + &sensor_dev_attr_temp_l_t_f_max.dev_attr.attr, + &sensor_dev_attr_temp_l_t_f_min.dev_attr.attr, + &sensor_dev_attr_temp_l_t_f_crit.dev_attr.attr, + &sensor_dev_attr_temp_l_t_f_lcrit.dev_attr.attr, + &sensor_dev_attr_temp_l_t_b_max.dev_attr.attr, + &sensor_dev_attr_temp_l_t_b_min.dev_attr.attr, + &sensor_dev_attr_temp_l_t_b_crit.dev_attr.attr, + &sensor_dev_attr_temp_l_t_b_lcrit.dev_attr.attr, + NULL +}; +static struct attribute *NBA715_FAN_attributes[] = +{ + &sensor_dev_attr_fanctrl_rpm.dev_attr.attr, + &sensor_dev_attr_fanctrl_mode.dev_attr.attr, + &sensor_dev_attr_fan1_stat.dev_attr.attr, + &sensor_dev_attr_fan2_stat.dev_attr.attr, + &sensor_dev_attr_fan3_stat.dev_attr.attr, + &sensor_dev_attr_fan4_stat.dev_attr.attr, + &sensor_dev_attr_fan5_stat.dev_attr.attr, + &sensor_dev_attr_fan1_present.dev_attr.attr, + &sensor_dev_attr_fan2_present.dev_attr.attr, + &sensor_dev_attr_fan3_present.dev_attr.attr, + &sensor_dev_attr_fan4_present.dev_attr.attr, + &sensor_dev_attr_fan5_present.dev_attr.attr, + &sensor_dev_attr_fan1_power.dev_attr.attr, + &sensor_dev_attr_fan2_power.dev_attr.attr, + &sensor_dev_attr_fan3_power.dev_attr.attr, + &sensor_dev_attr_fan4_power.dev_attr.attr, + &sensor_dev_attr_fan5_power.dev_attr.attr, + &sensor_dev_attr_fan1_front_rpm.dev_attr.attr, + &sensor_dev_attr_fan2_front_rpm.dev_attr.attr, + &sensor_dev_attr_fan3_front_rpm.dev_attr.attr, + &sensor_dev_attr_fan4_front_rpm.dev_attr.attr, + &sensor_dev_attr_fan5_front_rpm.dev_attr.attr, + &sensor_dev_attr_fan1_rear_rpm.dev_attr.attr, + &sensor_dev_attr_fan2_rear_rpm.dev_attr.attr, + &sensor_dev_attr_fan3_rear_rpm.dev_attr.attr, + &sensor_dev_attr_fan4_rear_rpm.dev_attr.attr, + &sensor_dev_attr_fan5_rear_rpm.dev_attr.attr, + NULL +}; +static struct attribute *NBA715_POWER_attributes[] = +{ + &sensor_dev_attr_psu1_good.dev_attr.attr, + &sensor_dev_attr_psu2_good.dev_attr.attr, + &sensor_dev_attr_psu1_prnt.dev_attr.attr, + &sensor_dev_attr_psu2_prnt.dev_attr.attr, + &sensor_dev_attr_psu1_vin.dev_attr.attr, + &sensor_dev_attr_psu1_iin.dev_attr.attr, + &sensor_dev_attr_psu1_vout.dev_attr.attr, + &sensor_dev_attr_psu1_iout.dev_attr.attr, + &sensor_dev_attr_psu1_temp.dev_attr.attr, + &sensor_dev_attr_psu1_fan_speed.dev_attr.attr, + &sensor_dev_attr_psu1_pout.dev_attr.attr, + &sensor_dev_attr_psu1_pin.dev_attr.attr, + &sensor_dev_attr_psu1_mfr_model.dev_attr.attr, + &sensor_dev_attr_psu1_mfr_iout_max.dev_attr.attr, + &sensor_dev_attr_psu1_vomde.dev_attr.attr, + &sensor_dev_attr_psu2_vin.dev_attr.attr, + &sensor_dev_attr_psu2_iin.dev_attr.attr, + &sensor_dev_attr_psu2_vout.dev_attr.attr, + &sensor_dev_attr_psu2_iout.dev_attr.attr, + &sensor_dev_attr_psu2_temp.dev_attr.attr, + &sensor_dev_attr_psu2_fan_speed.dev_attr.attr, + &sensor_dev_attr_psu2_pout.dev_attr.attr, + &sensor_dev_attr_psu2_pin.dev_attr.attr, + &sensor_dev_attr_psu2_mfr_model.dev_attr.attr, + &sensor_dev_attr_psu2_mfr_iout_max.dev_attr.attr, + &sensor_dev_attr_psu2_vomde.dev_attr.attr, + &sensor_dev_attr_dc6e_p0_vout.dev_attr.attr, + &sensor_dev_attr_dc6e_p0_iout.dev_attr.attr, + &sensor_dev_attr_dc6e_p0_pout.dev_attr.attr, + &sensor_dev_attr_dc6e_p1_vout.dev_attr.attr, + &sensor_dev_attr_dc6e_p1_iout.dev_attr.attr, + &sensor_dev_attr_dc6e_p1_pout.dev_attr.attr, + &sensor_dev_attr_dc70_p0_vout.dev_attr.attr, + &sensor_dev_attr_dc70_p0_iout.dev_attr.attr, + &sensor_dev_attr_dc70_p0_pout.dev_attr.attr, + &sensor_dev_attr_dc70_p1_vout.dev_attr.attr, + &sensor_dev_attr_dc70_p1_iout.dev_attr.attr, + &sensor_dev_attr_dc70_p1_pout.dev_attr.attr, + NULL +}; +static struct attribute *NBA715_QSFP_attributes[] = +{ + &sensor_dev_attr_qsfp_low_power_all.dev_attr.attr, + &sensor_dev_attr_qsfp1_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp2_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp3_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp4_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp5_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp6_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp7_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp8_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp9_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp10_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp11_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp12_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp13_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp14_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp15_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp16_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp17_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp18_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp19_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp20_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp21_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp22_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp23_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp24_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp25_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp26_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp27_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp28_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp29_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp30_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp31_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp32_low_power.dev_attr.attr, + &sensor_dev_attr_qsfp_reset_all.dev_attr.attr, + &sensor_dev_attr_qsfp1_reset.dev_attr.attr, + &sensor_dev_attr_qsfp2_reset.dev_attr.attr, + &sensor_dev_attr_qsfp3_reset.dev_attr.attr, + &sensor_dev_attr_qsfp4_reset.dev_attr.attr, + &sensor_dev_attr_qsfp5_reset.dev_attr.attr, + &sensor_dev_attr_qsfp6_reset.dev_attr.attr, + &sensor_dev_attr_qsfp7_reset.dev_attr.attr, + &sensor_dev_attr_qsfp8_reset.dev_attr.attr, + &sensor_dev_attr_qsfp9_reset.dev_attr.attr, + &sensor_dev_attr_qsfp10_reset.dev_attr.attr, + &sensor_dev_attr_qsfp11_reset.dev_attr.attr, + &sensor_dev_attr_qsfp12_reset.dev_attr.attr, + &sensor_dev_attr_qsfp13_reset.dev_attr.attr, + &sensor_dev_attr_qsfp14_reset.dev_attr.attr, + &sensor_dev_attr_qsfp15_reset.dev_attr.attr, + &sensor_dev_attr_qsfp16_reset.dev_attr.attr, + &sensor_dev_attr_qsfp17_reset.dev_attr.attr, + &sensor_dev_attr_qsfp18_reset.dev_attr.attr, + &sensor_dev_attr_qsfp19_reset.dev_attr.attr, + &sensor_dev_attr_qsfp20_reset.dev_attr.attr, + &sensor_dev_attr_qsfp21_reset.dev_attr.attr, + &sensor_dev_attr_qsfp22_reset.dev_attr.attr, + &sensor_dev_attr_qsfp23_reset.dev_attr.attr, + &sensor_dev_attr_qsfp24_reset.dev_attr.attr, + &sensor_dev_attr_qsfp25_reset.dev_attr.attr, + &sensor_dev_attr_qsfp26_reset.dev_attr.attr, + &sensor_dev_attr_qsfp27_reset.dev_attr.attr, + &sensor_dev_attr_qsfp28_reset.dev_attr.attr, + &sensor_dev_attr_qsfp29_reset.dev_attr.attr, + &sensor_dev_attr_qsfp30_reset.dev_attr.attr, + &sensor_dev_attr_qsfp31_reset.dev_attr.attr, + &sensor_dev_attr_qsfp32_reset.dev_attr.attr, + &sensor_dev_attr_qsfp_present_all.dev_attr.attr, + &sensor_dev_attr_qsfp1_present.dev_attr.attr, + &sensor_dev_attr_qsfp2_present.dev_attr.attr, + &sensor_dev_attr_qsfp3_present.dev_attr.attr, + &sensor_dev_attr_qsfp4_present.dev_attr.attr, + &sensor_dev_attr_qsfp5_present.dev_attr.attr, + &sensor_dev_attr_qsfp6_present.dev_attr.attr, + &sensor_dev_attr_qsfp7_present.dev_attr.attr, + &sensor_dev_attr_qsfp8_present.dev_attr.attr, + &sensor_dev_attr_qsfp9_present.dev_attr.attr, + &sensor_dev_attr_qsfp10_present.dev_attr.attr, + &sensor_dev_attr_qsfp11_present.dev_attr.attr, + &sensor_dev_attr_qsfp12_present.dev_attr.attr, + &sensor_dev_attr_qsfp13_present.dev_attr.attr, + &sensor_dev_attr_qsfp14_present.dev_attr.attr, + &sensor_dev_attr_qsfp15_present.dev_attr.attr, + &sensor_dev_attr_qsfp16_present.dev_attr.attr, + &sensor_dev_attr_qsfp17_present.dev_attr.attr, + &sensor_dev_attr_qsfp18_present.dev_attr.attr, + &sensor_dev_attr_qsfp19_present.dev_attr.attr, + &sensor_dev_attr_qsfp20_present.dev_attr.attr, + &sensor_dev_attr_qsfp21_present.dev_attr.attr, + &sensor_dev_attr_qsfp22_present.dev_attr.attr, + &sensor_dev_attr_qsfp23_present.dev_attr.attr, + &sensor_dev_attr_qsfp24_present.dev_attr.attr, + &sensor_dev_attr_qsfp25_present.dev_attr.attr, + &sensor_dev_attr_qsfp26_present.dev_attr.attr, + &sensor_dev_attr_qsfp27_present.dev_attr.attr, + &sensor_dev_attr_qsfp28_present.dev_attr.attr, + &sensor_dev_attr_qsfp29_present.dev_attr.attr, + &sensor_dev_attr_qsfp30_present.dev_attr.attr, + &sensor_dev_attr_qsfp31_present.dev_attr.attr, + &sensor_dev_attr_qsfp32_present.dev_attr.attr, + &sensor_dev_attr_qsfp_int_all.dev_attr.attr, + &sensor_dev_attr_qsfp1_int.dev_attr.attr, + &sensor_dev_attr_qsfp2_int.dev_attr.attr, + &sensor_dev_attr_qsfp3_int.dev_attr.attr, + &sensor_dev_attr_qsfp4_int.dev_attr.attr, + &sensor_dev_attr_qsfp5_int.dev_attr.attr, + &sensor_dev_attr_qsfp6_int.dev_attr.attr, + &sensor_dev_attr_qsfp7_int.dev_attr.attr, + &sensor_dev_attr_qsfp8_int.dev_attr.attr, + &sensor_dev_attr_qsfp9_int.dev_attr.attr, + &sensor_dev_attr_qsfp10_int.dev_attr.attr, + &sensor_dev_attr_qsfp11_int.dev_attr.attr, + &sensor_dev_attr_qsfp12_int.dev_attr.attr, + &sensor_dev_attr_qsfp13_int.dev_attr.attr, + &sensor_dev_attr_qsfp14_int.dev_attr.attr, + &sensor_dev_attr_qsfp15_int.dev_attr.attr, + &sensor_dev_attr_qsfp16_int.dev_attr.attr, + &sensor_dev_attr_qsfp17_int.dev_attr.attr, + &sensor_dev_attr_qsfp18_int.dev_attr.attr, + &sensor_dev_attr_qsfp19_int.dev_attr.attr, + &sensor_dev_attr_qsfp20_int.dev_attr.attr, + &sensor_dev_attr_qsfp21_int.dev_attr.attr, + &sensor_dev_attr_qsfp22_int.dev_attr.attr, + &sensor_dev_attr_qsfp23_int.dev_attr.attr, + &sensor_dev_attr_qsfp24_int.dev_attr.attr, + &sensor_dev_attr_qsfp25_int.dev_attr.attr, + &sensor_dev_attr_qsfp26_int.dev_attr.attr, + &sensor_dev_attr_qsfp27_int.dev_attr.attr, + &sensor_dev_attr_qsfp28_int.dev_attr.attr, + &sensor_dev_attr_qsfp29_int.dev_attr.attr, + &sensor_dev_attr_qsfp30_int.dev_attr.attr, + &sensor_dev_attr_qsfp31_int.dev_attr.attr, + &sensor_dev_attr_qsfp32_int.dev_attr.attr, + &sensor_dev_attr_qsfp1_4_int.dev_attr.attr, + &sensor_dev_attr_qsfp2_4_int.dev_attr.attr, + &sensor_dev_attr_qsfp3_4_int.dev_attr.attr, + &sensor_dev_attr_qsfp4_4_int.dev_attr.attr, + &sensor_dev_attr_qsfp1_4_modprs.dev_attr.attr, + &sensor_dev_attr_qsfp2_4_modprs.dev_attr.attr, + &sensor_dev_attr_qsfp3_4_modprs.dev_attr.attr, + &sensor_dev_attr_qsfp4_4_modprs.dev_attr.attr, + &sensor_dev_attr_qsfp1_4_int_mask.dev_attr.attr, + &sensor_dev_attr_qsfp2_4_int_mask.dev_attr.attr, + &sensor_dev_attr_qsfp3_4_int_mask.dev_attr.attr, + &sensor_dev_attr_qsfp4_4_int_mask.dev_attr.attr, + &sensor_dev_attr_qsfp1_4_modprs_mask.dev_attr.attr, + &sensor_dev_attr_qsfp2_4_modprs_mask.dev_attr.attr, + &sensor_dev_attr_qsfp3_4_modprs_mask.dev_attr.attr, + &sensor_dev_attr_qsfp4_4_modprs_mask.dev_attr.attr, + NULL +}; +/* end of sysfs attributes for hwmon */ + +/* struct attribute_group */ +static const struct attribute_group NBA715_SYS_group = +{ + .name = "NBA715_SYS", + .attrs = NBA715_SYS_attributes, +}; + +static const struct attribute_group NBA715_LED_group = +{ + .name = "NBA715_LED", + .attrs = NBA715_LED_attributes, +}; + +static const struct attribute_group NBA715_THERMAL_group = +{ + .name = "NBA715_THERMAL", + .attrs = NBA715_THERMAL_attributes, +}; + +static const struct attribute_group NBA715_FAN_group = +{ + .name = "NBA715_FAN", + .attrs = NBA715_FAN_attributes, +}; + +static const struct attribute_group NBA715_POWER_group = +{ + .name = "NBA715_POWER", + .attrs = NBA715_POWER_attributes, +}; + +static const struct attribute_group NBA715_QSFP_group = +{ + .name = "NBA715_QSFP", + .attrs = NBA715_QSFP_attributes, +}; + +static const struct bin_attribute net_eeprom_attr = { + .attr = { + .name = "eeprom", + .mode = S_IRUGO, + }, + .size = EEPROM_SIZE, + .read = net_eeprom_read, +}; + +/* end of struct attribute_group */ diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/scripts/sensors b/platform/innovium/sonic-platform-modules-netberg/aurora-715/scripts/sensors new file mode 100755 index 000000000000..a2d1477bbd48 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/scripts/sensors @@ -0,0 +1,8 @@ +#!/bin/bash +docker exec -i pmon sensors "$@" + +#To probe sensors not part of lm-sensors +if [ -r /usr/local/bin/netberg_nba715_sensors.py ]; then + python /usr/local/bin/netberg_nba715_sensors.py fan_status + python /usr/local/bin/netberg_nba715_sensors.py sensor_status +fi diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/service/nba715-platform-init.service b/platform/innovium/sonic-platform-modules-netberg/aurora-715/service/nba715-platform-init.service new file mode 100644 index 000000000000..6f019485ee82 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/service/nba715-platform-init.service @@ -0,0 +1,14 @@ +[Unit] +Description=Netberg Aurora 715 Platform initialization service +After=local-fs.target innovium_platform_driver.service +Before=pmon.service + + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/netberg_nba715_startup start +ExecStop=/usr/local/bin/netberg_nba715_startup stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/setup.py b/platform/innovium/sonic-platform-modules-netberg/aurora-715/setup.py new file mode 100755 index 000000000000..e6ccd481b0a4 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/setup.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +import os +# import sys +from setuptools import setup +os.listdir + +setup( + name='sonic_platform', + version='1.0', + description='Netberg Aurora 715 sonic platform API', + + packages=['sonic_platform'], + package_dir={'sonic_platform': 'aurora-715/sonic_platform'}, + + + classifiers=[ + 'Development Status :: 3 - Beta', + 'Environment :: Plugins', + 'Intended Audience :: Developers', + 'Intended Audience :: Information Technology', + 'Intended Audience :: System Administrators', + 'License :: OSI Approved :: Apache Software License', + 'Natural Language :: English', + 'Operating System :: POSIX :: Linux', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3.7', + 'Topic :: Utilities', + ], +) diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/__init__.py b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/chassis.py b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/chassis.py new file mode 100644 index 000000000000..39c8242f7868 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/chassis.py @@ -0,0 +1,335 @@ +############################################################################# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + + +try: + import os + import time + import subprocess + from sonic_platform_base.chassis_base import ChassisBase + from sonic_platform.platDev import PlatDev + from sonic_platform.fan import Fan + from sonic_platform.psu import Psu + from sonic_platform.sfp import Sfp + from sonic_platform.thermal import Thermal + from sonic_platform.eeprom import Eeprom + from sonic_platform.component import Component +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +GET_HWSKU_CMD = "sonic-cfggen -d -v DEVICE_METADATA.localhost.hwsku" +GET_PLATFORM_CMD = "sonic-cfggen -d -v DEVICE_METADATA.localhost.platform" + + +# XCVR type definition +SFP_TYPE = 0 +QSFP_TYPE = 1 + + +class Chassis(ChassisBase): + """Platform-specific Chassis class""" + + _global_port_pres_dict = {} + + def __init__(self): + super(Chassis, self).__init__() + + # Initialize SKU name and Platform name + self.sku_name = self._get_sku_name() + self.platform_name = self._get_platform_name() + self.name = self.sku_name + + # get the device infomation of platform + self.platdev = PlatDev() + + #self._component_list = [] + #self._module_list = [] + #self._fan_drawer_list = [] + + self._eeprom = Eeprom() + # init component + for i in range(self.platdev.get_component_count()): + component = Component(i, self.platdev.get_component_name( + i), self.platdev.get_component_descript(i)) + self._component_list.append(component) + # init fan list + if self.platdev.get_fan_support(): + fanlist = self.platdev.get_fan_list() + for index in range(0, len(fanlist)): + fan_name = fanlist[index] + for pos in range(0, self.platdev.get_fan_num_by_name(fan_name)): + fan = Fan( + index, pos, [self.platdev.get_fan_sysfile_path_by_name(fan_name), '']) + self._fan_list.append(fan) + + # init psu list + psulist = self.platdev.get_psu_list() + for index in range(0, len(psulist)): + psu_name = psulist[index] + psu = Psu(index, [self.platdev.get_psu_attr_path_by_name(psu_name), + self.platdev.get_psu_status_path_by_name(psu_name)], + self.platdev.bmc_is_exist()) + self._psu_list.append(psu) + + # init thermal list + thermal_info_list = self.platdev.get_thermal_dev_info_all() + for index in range(0, len(thermal_info_list)): + if len(self.platdev.get_thermal_dev_tempidx_by_idx(index)) > 1: + for idx in self.platdev.get_thermal_dev_tempidx_by_idx(index): + thermal = Thermal(idx, self.platdev.get_thermal_dev_name_by_idx(index)+"-{}".format(idx), + self.platdev.get_thermal_dev_sysfile_path_by_idx( + index), + self.platdev.bmc_is_exist(), + self.platdev.get_thermal_dev_support_mask_by_idx( + index), + self.platdev.get_thermal_dev_ext_sysfile_list_by_idx(index)) + self._thermal_list.append(thermal) + else: + thermal = Thermal(1, self.platdev.get_thermal_dev_name_by_idx(index), + self.platdev.get_thermal_dev_sysfile_path_by_idx( + index), + self.platdev.bmc_is_exist(), + self.platdev.get_thermal_dev_support_mask_by_idx( + index), + self.platdev.get_thermal_dev_ext_sysfile_list_by_idx(index)) + self._thermal_list.append(thermal) + + # init sfp list + port_num = 1 + for sfpg_name in self.platdev.get_sfp_group_list(): + if self.platdev.get_sfp_group_type_by_name(sfpg_name) == 'QSFP28': + sfp_type = QSFP_TYPE + else: + sfp_type = SFP_TYPE + + for x in range(0, self.platdev.get_sfp_group_number_by_name(sfpg_name)): + eeprom_path_list = ['n/a', 'n/a'] + if self.platdev.get_sfp_group_path_by_name(sfpg_name)[x] != 'n/a': + eeprom_path_list[0] = self.platdev.get_sfp_group_path_by_name(sfpg_name)[ + x] + '/eeprom' + if os.path.exists(eeprom_path_list[0].replace("0050", "0051")): + eeprom_path_list[1] = eeprom_path_list[0].replace( + "0050", "0051") + # index: port index, start from 0 + # eeprom_path_list : a list of path to eeprom sysfile + # [0]: for 0x50 + # [1]: for 0x51 + # ext_sysfile_list: used to get other function of sfp + # [0]: present + # [1]: reset + # [2]: get lowpower mode + # [3]: set lowpower mode + sfp = Sfp(port_num, eeprom_path_list, sfp_type, + self.platdev.get_sfp_ext_sysfile_list()) + port_num += 1 + self._sfp_list.append(sfp) + + self.init_global_port_presence() + + def _get_sku_name(self): + pipe = subprocess.Popen( + GET_HWSKU_CMD, shell=True, stdout=subprocess.PIPE) + out, err = pipe.communicate() + return out.decode().rstrip('\n') + + def _get_platform_name(self): + pipe = subprocess.Popen( + GET_PLATFORM_CMD, shell=True, stdout=subprocess.PIPE) + out, err = pipe.communicate() + return out.decode().rstrip('\n') + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + return self.name + + def get_base_mac(self): + """ + Retrieves the base MAC address for the chassis + Returns: + A string containing the MAC address in the format + 'XX:XX:XX:XX:XX:XX' + """ + return self._eeprom.base_mac_addr('') + + def get_model(self): + """ + Retrieves the model number (or part number) of the chassis + Returns: + string: Model/part number of chassis + """ + return self._eeprom.part_number_str() + + def get_serial_number(self): + """ + Retrieves the hardware serial number for the chassis + Returns: + A string containing the hardware serial number for this chassis. + """ + return self._eeprom.serial_number_str() + + def get_system_eeprom_info(self): + """ + Retrieves the full content of system EEPROM information for the chassis + Returns: + A dictionary where keys are the type code defined in + OCP ONIE TlvInfo EEPROM format and values are their corresponding + values. + """ + return self._eeprom.system_eeprom_info() + + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + Returns: + A tuple (string, string) where the first element is a string + containing the cause of the previous reboot. This string must be + one of the predefined strings in this class. If the first string + is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used + to pass a description of the reboot cause. + """ + # not support any hardware reboot, just return REBOOT_CAUSE_NON_HARDWARE + # to keep reboot cause as software reboot + return (self.REBOOT_CAUSE_NON_HARDWARE, None) + + ############################################## + # System LED methods + ############################################## + + def set_status_led(self, color): + """ + Sets the state of the system LED + Args: + color: A string representing the color with which to set the + system LED + Returns: + bool: True if system LED state is set successfully, False if not + """ + return False + + def get_status_led(self): + """ + Gets the state of the system LED + Returns: + A string, one of the valid LED color strings which could be vendor + specified. + """ + raise NotImplementedError + + ############################################## + # Other methods + ############################################## + + def init_global_port_presence(self): + for port_num in range(0, self.platdev.get_sfp_num()): + presence = self._sfp_list[port_num].get_presence() + self._global_port_pres_dict[port_num] = '1' if presence else '0' + + def get_change_event(self, timeout=0): + """ + Returns a nested dictionary containing all devices which have + experienced a change at chassis level + Args: + timeout: Timeout in milliseconds (optional). If timeout == 0, + this method will block until a change is detected. + Returns: + (bool, dict): + - True if call successful, False if not; + - A nested dictionary where key is a device type, + value is a dictionary with key:value pairs in the format of + {'device_id':'device_event'}, + where device_id is the device ID for this device and + device_event, + status='1' represents device inserted, + status='0' represents device removed. + Ex. {'fan':{'0':'0', '2':'1'}, 'sfp':{'11':'0'}} + indicates that fan 0 has been removed, fan 2 + has been inserted and sfp 11 has been removed. + Specifically for SFP event, besides SFP plug in and plug out, + there are some other error event could be raised from SFP, when + these error happened, SFP eeprom will not be avalaible, XCVRD shall + stop to read eeprom before SFP recovered from error status. + status='2' I2C bus stuck, + status='3' Bad eeprom, + status='4' Unsupported cable, + status='5' High Temperature, + status='6' Bad cable. + """ + port_dict = {} + while True: + for port_num in range(0, self.platdev.get_sfp_num()): + presence = self._sfp_list[port_num].get_presence() + if(presence and self._global_port_pres_dict[port_num] == '0'): + self._global_port_pres_dict[port_num] = '1' + port_dict[port_num] = '1' + elif(not presence and + self._global_port_pres_dict[port_num] == '1'): + self._global_port_pres_dict[port_num] = '0' + port_dict[port_num] = '0' + + if len(port_dict) > 0: + return True, {'sfp': port_dict} + + time.sleep(1) + + def sfp_debugger(self): + """ + Try to show all parameters read from eeprom with sfp methods + """ + print("SFP EEPROM data:") + for sfp_n in range(0, len(self._sfp_list)): + print("======SFP{}==TYPE {}====".format( + sfp_n, self._sfp_list[sfp_n].sfp_type)) + print("get_transceiver_info:") + print(self._sfp_list[sfp_n].get_transceiver_info()) + print(" ") + + print("get_transceiver_threshold_info:") + print(self._sfp_list[sfp_n].get_transceiver_threshold_info()) + print(" ") + + print("get_transceiver_bulk_status:") + print(self._sfp_list[sfp_n].get_transceiver_bulk_status()) + print(" ") + + print("get_lpmode:") + for sfp_n in range(0, len(self._sfp_list)): + print("\tsfp{}: {}".format( + sfp_n, self._sfp_list[sfp_n].get_lpmode())) + # set_lpmode + + print("get_power_override:") + for sfp_n in range(0, len(self._sfp_list)): + print("\tsfp{}: {}".format( + sfp_n, self._sfp_list[sfp_n].get_power_override())) + + print("get_temperature:") + for sfp_n in range(0, len(self._sfp_list)): + print("\tsfp{}: {}".format( + sfp_n, self._sfp_list[sfp_n].get_temperature())) + + print("get_voltage") + for sfp_n in range(0, len(self._sfp_list)): + print("\tsfp{}: {}".format( + sfp_n, self._sfp_list[sfp_n].get_voltage())) + + print("get_tx_bias") + for sfp_n in range(0, len(self._sfp_list)): + print("\tsfp{}: {}".format( + sfp_n, self._sfp_list[sfp_n].get_tx_bias())) + + print("get_rx_power") + for sfp_n in range(0, len(self._sfp_list)): + print("\tsfp{}: {}".format( + sfp_n, self._sfp_list[sfp_n].get_rx_power())) + + print("get_tx_power") + for sfp_n in range(0, len(self._sfp_list)): + print("\tsfp{}: {}".format( + sfp_n, self._sfp_list[sfp_n].get_tx_power())) diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/component.py b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/component.py new file mode 100644 index 000000000000..5b580a62a23f --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/component.py @@ -0,0 +1,100 @@ +######################################################################## +# Module contains an implementation of SONiC Platform Base API and +# provides the Components' (e.g., BIOS, CPLD, FPGA, etc.) available in +# the platform +# +######################################################################## + +try: + import os + from sonic_platform_base.component_base import ComponentBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version" + + +class Component(ComponentBase): + def __init__(self, idx, name, descript): + self.index = idx + self.name = name + self.description = descript + + def _get_cpld_register(self, syspath): + rv = 'ERR' + if (not os.path.isfile(syspath)): + return rv + # noinspection PyBroadException + try: + with open(syspath, 'r') as fd: + rv = fd.read() + except Exception as error: + rv = 'ERR' + rv = rv.rstrip('\r\n') + rv = rv.lstrip(" ") + return rv + + def _get_bios_version(self): + # Retrieves the BIOS firmware version + try: + with open(BIOS_VERSION_PATH, 'r') as fd: + bios_version = fd.read() + return bios_version.strip() + except Exception as e: + return None + + def _get_cpld_version(self, cpld_number): + cpld_version_reg = { + 1: "/sys/class/hwmon/hwmon2/device/NBA715_SYS/cpld_30_ver", + 2: "master_cpld_ver", + 3: "slave_cpld_ver" + } + + cpld_version = self._get_cpld_register(cpld_version_reg[cpld_number]) + + if cpld_version != 'ERR': + return cpld_version[-4:] + + return 'NA' + + def get_name(self): + """ + Retrieves the name of the component + Returns: + A string containing the name of the component + """ + return self.name + + def get_description(self): + """ + Retrieves the description of the component + Returns: + A string containing the description of the component + """ + return self.description + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + Returns: + A string containing the firmware version of the component + """ + if self.index == 0: + bios_ver = self._get_bios_version() + if not bios_ver: + return 'NA' + + return bios_ver + + elif self.index <= 3: + return self._get_cpld_version(self.index) + + def install_firmware(self, image_path): + """ + Installs firmware to the component + Args: + image_path: A string, path to firmware image + Returns: + A boolean, True if install was successful, False if not + """ + return False diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/eeprom.py b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/eeprom.py new file mode 100644 index 000000000000..a4c34c1c8696 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/eeprom.py @@ -0,0 +1,108 @@ +try: + import sys + import re + if sys.version_info.major == 3: + from io import StringIO + else: + from cStringIO import StringIO + from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Eeprom(eeprom_tlvinfo.TlvInfoDecoder): + + EEPROM_DECODE_HEADLINES = 6 + + def __init__(self): + self._eeprom_path = "/sys/bus/i2c/drivers/NBA_715_i2c/0-0030/eeprom" + super(Eeprom, self).__init__(self._eeprom_path, 0, '', True) + self._eeprom = self._load_eeprom() + + def __parse_output(self, decode_output): + decode_output.replace('\0', '') + lines = decode_output.split('\n') + lines = lines[self.EEPROM_DECODE_HEADLINES:] + _eeprom_info_dict = dict() + + for line in lines: + match = re.search( + '(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)([\S]+)', line) + if match is not None: + idx = match.group(1) + value = match.group(3).rstrip('\0') + _eeprom_info_dict[idx] = value + return _eeprom_info_dict + + def _load_eeprom(self): + original_stdout = sys.stdout + sys.stdout = StringIO() + err = self.read_eeprom_db() + if err: + pass + else: + decode_output = sys.stdout.getvalue() + sys.stdout = original_stdout + return self.__parse_output(decode_output) + + status = self.check_status() + if status < 'ok': + return {} + + data = self.read_eeprom() + if data is None: + return 0 + + self.decode_eeprom(data) + decode_output = sys.stdout.getvalue() + sys.stdout = original_stdout + + (is_valid, valid_crc) = self.is_checksum_valid(data) + if not is_valid: + return {} + + return self.__parse_output(decode_output) + + def get_eeprom(self): + return self._eeprom + + def serial_number_str(self): + """ + Returns the serial number + """ + return self._eeprom.get('0x23', "Undefined.") + + def base_mac_addr(self, e): + """ + Returns the base mac address found in the system EEPROM + """ + return self._eeprom.get('0x24', "Undefined.") + + def modelstr(self): + """ + Returns the Model name + """ + return self._eeprom.get('0x28', "Undefined.") + + def part_number_str(self): + """ + Returns the part number + """ + return self._eeprom.get('0x22', "Undefined.") + + def revision_str(self): + """ + Returns the device revision + """ + return self._eeprom.get('0x26', "Undefined.") + + def serial_str(self): + return self._eeprom.get('0x2F', "Undefined.") + + def system_eeprom_info(self): + """ + Returns a dictionary, where keys are the type code defined in + ONIE EEPROM format and values are their corresponding values + found in the system EEPROM. + """ + return self._eeprom diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/fan.py b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/fan.py new file mode 100644 index 000000000000..2f706d4cd5bd --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/fan.py @@ -0,0 +1,152 @@ +try: + from sonic_py_common.logger import Logger + from sonic_platform_base.fan_base import FanBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +SYSLOG_IDENTIFIER = 'thermalctld' +logger = Logger(SYSLOG_IDENTIFIER) + +FAN_POSITION_NAME = ["Front", "Rear"] + + +class Fan(FanBase): + """Platform-specific Fan class""" + + def __init__(self, fan_index, position_index, attr_path, psu_fan=False): + # fan_index: the index of a fan module belongs to + # position_index : position of the fan in a fan module, 0 -> front, 1 -> rear, + # position_index : index of PSU belongs to if psu_fan is True, start from 0 + super(Fan, self).__init__() + self.index = fan_index + 1 + self.position = position_index + self.is_psu_fan = psu_fan + self.attr_path = attr_path[0] + + if psu_fan is True: + self.fan_name = "PSU{}_FAN{}".format(self.index, self.position+1) + self.speed_file = attr_path[1] + else: + self.fan_name = "FAN{}-{}".format(self.index, + FAN_POSITION_NAME[self.position]) + + def __read_attr_file(self, filepath, line=0xFF): + try: + with open(filepath, 'r') as fd: + if line == 0xFF: + data = fd.read() + return data.rstrip('\r\n') + else: + data = fd.readlines() + return data[line].rstrip('\r\n') + except FileNotFoundError: + logger.log_error(f"File {filepath} not found. Aborting") + except OSError as ex: + logger.log_error("Cannot open - {}: {}".format(filepath, repr(ex))) + + return None + + def get_presence(self): + if self.is_psu_fan is True: + data = self.__read_attr_file( + self.attr_path + 'psu{}_prnt'.format(self.index)) + return data == '1' + + ret = self.__read_attr_file( + self.attr_path + 'fan{}_present'.format(self.index)) + return ret == '1' + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + return self.fan_name + + def get_direction(self): + """ + Retrieves the direction of fan + Returns: + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + """ + return self.FAN_DIRECTION_NOT_APPLICABLE + + def get_status(self): + if self.is_psu_fan is True: + data = self.__read_attr_file( + self.attr_path + 'psu{}_good'.format(self.index)) + return data == '1' + data = self.__read_attr_file( + self.attr_path + 'fan{}_stat'.format(self.index)) + + return data == '1' + + def get_speed(self): + """ + Retrieves the speed of fan as a percentage of full speed + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + """ + if self.is_psu_fan is True and self.get_presence(): + speed = self.__read_attr_file(self.speed_file, 0) + if speed is not None: + return (int(speed)*100)//16000 + + return 0 + + if self.get_presence(): + if self.position == 0: + speed_file = self.attr_path + \ + 'fan{}_front_rpm'.format(self.index) + else: + speed_file = self.attr_path + \ + 'fan{}_rear_rpm'.format(self.index) + data = self.__read_attr_file(speed_file) + if data is not None: + for sdata in data.split(' '): + if sdata.isdigit(): + return (int(sdata)*100)//18000 + return 0 + + def get_target_speed(self): + """ + Retrieves the target (expected) speed of the fan + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + """ + return self.get_speed() + + def get_speed_tolerance(self): + """ + Retrieves the speed tolerance of the fan + Returns: + An integer, the percentage of variance from target speed which is + considered tolerable + """ + return 10 + + def set_speed(self, speed): + """ + Sets the fan speed + Args: + speed: An integer, the percentage of full fan speed to set fan to, + in the range 0 (off) to 100 (full speed) + Returns: + A boolean, True if speed is set successfully, False if not + """ + return False + + def set_status_led(self, color): + """ + Sets the state of the fan module status LED + Args: + color: A string representing the color with which to set the + fan module status LED + Returns: + bool: True if status LED state is set successfully, False if not + """ + return False diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/platDev.py b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/platDev.py new file mode 100644 index 000000000000..5686153806c2 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/platDev.py @@ -0,0 +1,408 @@ +#!/usr/bin/env python + +try: + import os + import copy + from sonic_py_common.logger import Logger +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +logger = Logger("platDev") +PLATFORM_NAME = "aurora-715" +MAX_FAN_MODULE = 5 +MAX_FAN = 2 + +THERMAL_SENSOR_LIST = [ + { + 'name': "pch_haswell", + 'temp_index': [1], + 'sysfile_path': "/sys/class/hwmon/hwmon0/", + 'support_mask': 0x81, + 'ext_sysfile_list': None + }, + { + 'name': "CPU core temp", + 'temp_index': [1, 2], + 'sysfile_path': "/sys/class/hwmon/hwmon1/", + 'support_mask': 0x8B, + 'ext_sysfile_list': None + }, + { + 'name': "NCT7511Y(U73)", + 'temp_index': [1, 2], + 'sysfile_path': "/sys/class/hwmon/hwmon2/device/NBA715_THERMAL/", + 'support_mask': 0x0F, + 'ext_sysfile_list': {1: ['temp_r_b_f', 'temp_r_b_f_max', 'temp_r_b_f_min', 'temp_r_b_f_crit', 'temp_r_b_f_lcrit'], + 2:['temp_r_b_b', 'temp_r_b_b_max', 'temp_r_b_b_min', 'temp_r_b_b_crit', 'temp_r_b_b_lcrit']} + }, + { + 'name': "G781(U94)", + 'temp_index': [1, 2], + 'sysfile_path': "/sys/class/hwmon/hwmon2/device/NBA715_THERMAL/", + 'support_mask': 0x0F, + 'ext_sysfile_list': {1: ['temp_l_b_f', 'temp_l_b_f_max', 'temp_l_b_f_min', 'temp_l_b_f_crit', 'temp_l_b_f_lcrit'], + 2:['temp_l_b_b', 'temp_l_b_b_max', 'temp_l_b_b_min', 'temp_l_b_b_crit', 'temp_l_b_b_lcrit']} + }, + { + 'name': "G781(U34)", + 'temp_index': [1, 2], + 'sysfile_path': "/sys/class/hwmon/hwmon2/device/NBA715_THERMAL/", + 'support_mask': 0x0F, + 'ext_sysfile_list': {1: ['temp_r_t_f', 'temp_r_t_f_max', 'temp_r_t_f_min', 'temp_r_t_f_crit', 'temp_r_t_f_lcrit'], + 2:['temp_r_t_b', 'temp_r_t_b_max', 'temp_r_t_b_min', 'temp_r_t_b_crit', 'temp_r_t_b_lcrit']} + }, + { + 'name': "G781(U4)", + 'temp_index': [1, 2], + 'sysfile_path': "/sys/class/hwmon/hwmon2/device/NBA715_THERMAL/", + 'support_mask': 0x0F, + 'ext_sysfile_list': {1: ['temp_l_t_f', 'temp_l_t_f_max', 'temp_l_t_f_min', 'temp_l_t_f_crit', 'temp_l_t_f_lcrit'], + 2:['temp_l_t_b', 'temp_l_t_b_max', 'temp_l_t_b_min', 'temp_l_t_b_crit', 'temp_l_t_b_lcrit']} + } +] + +# PSU LIST +# ext_sysfile_list +# [0] : sysfile path for present +# [1] : sysfile path for status +# +PSU_LIST = ['PSU1', 'PSU2'] + +PSU_INFO = { + 'PSU1': { + 'attr_path': "/sys/class/hwmon/hwmon2/device/NBA715_POWER/", + 'status_path': "/sys/class/hwmon/hwmon2/device/NBA715_POWER/" + }, + 'PSU2': { + 'attr_path': "/sys/class/hwmon/hwmon2/device/NBA715_POWER/", + 'status_path': "/sys/class/hwmon/hwmon2/device/NBA715_POWER/" + } +} + +FAN_LIST = ['FAN1', 'FAN2', 'FAN3', 'FAN4', 'FAN5'] + +FAN_INFO = { + 'FAN1': { + 'isdraw': True, + 'fan_num': 2, + 'attr_path': '/sys/class/hwmon/hwmon2/device/NBA715_FAN/' + }, + 'FAN2': { + 'isdraw': True, + 'fan_num': 2, + 'attr_path': '/sys/class/hwmon/hwmon2/device/NBA715_FAN/' + }, + 'FAN3': { + 'isdraw': True, + 'fan_num': 2, + 'attr_path': '/sys/class/hwmon/hwmon2/device/NBA715_FAN/' + }, + 'FAN4': { + 'isdraw': True, + 'fan_num': 2, + 'attr_path': '/sys/class/hwmon/hwmon2/device/NBA715_FAN/' + }, + 'FAN5': { + 'isdraw': True, + 'fan_num': 2, + 'attr_path': '/sys/class/hwmon/hwmon2/device/NBA715_FAN/' + } +} + + +# SFP LIST +# +# +# 0: QSFP +# 1: SFP +# sfp not port on 715 platform + +SFP_EXT_SYSFILE_LIST = ["/sys/class/hwmon/hwmon2/device/NBA715_QSFP/", ""] + +SFP_GROUP_LIST = ['SFP-G01', 'SFP-G02', 'SFP-G03', 'SFP-G04'] + +PORT_NUM = 32 + +# SFP-eeprom paths /sys/bus/i2c/devices/XX-0050 + +I2C_DEVICES = { + # NCT7511Y sensor & fan control + 'NCT7511Y(U73)': { + 'parent': 'viaBMC', + 'parent_ch': 0, + 'driver': 'nct7511', + 'i2caddr': '0x2e', + 'path': ' ', + 'status': 'NOTINST' + }, + # G781 sensors + 'G781(U94)': { + 'parent': 'viaBMC', + 'parent_ch': 1, + 'driver': 'g781', + 'i2caddr': '0x4c', + 'path': ' ', + 'status': 'NOTINST' + }, + 'G781(U4)': { + 'parent': 'viaBMC', + 'parent_ch': 2, + 'driver': 'g781', + 'i2caddr': '0x4c', + 'path': ' ', + 'status': 'NOTINST' + }, + 'G781(U34)': { + 'parent': 'viaBMC', + 'parent_ch': 3, + 'driver': 'g781', + 'i2caddr': '0x4c', + 'path': ' ', + 'status': 'NOTINST' + }, + # PSU + 'PSU1': { + 'parent': 'viaBMC', + 'parent_ch': 4, + 'driver': 'zrh2800k2', + 'i2caddr': '0x58', + 'path': ' ', + 'status': 'NOTINST' + }, + 'PSU2': { + 'parent': 'viaBMC', + 'parent_ch': 4, + 'driver': 'zrh2800k2', + 'i2caddr': '0x59', + 'path': ' ', + 'status': 'NOTINST' + }, + 'TPS53681(0x6C)': { + 'parent': 'viaBMC', + 'parent_ch': 5, + 'driver': 'tps53679', + 'i2caddr': '0x6c', + 'path': ' ', + 'status': 'NOTINST' + }, + 'TPS53681(0x6E)': { + 'parent': 'viaBMC', + 'parent_ch': 5, + 'driver': 'tps53679', + 'i2caddr': '0x6e', + 'path': ' ', + 'status': 'NOTINST' + }, + 'TPS53681(0x70)': { + 'parent': 'viaBMC', + 'parent_ch': 5, + 'driver': 'tps53679', + 'i2caddr': '0x70', + 'path': ' ', + 'status': 'NOTINST' + } +} + + +SFP_GROUPS = { + 'SFP-G01': { + "type": "QSFP28", + 'number': 8, + 'parent': 'PCA9548_0x71_1', + 'channels': [0, 1, 2, 3, 4, 5, 6, 7], + 'driver': 'optoe1', + 'i2caddr': '0x50', + 'paths': ["/sys/bus/i2c/devices/9-0050", "/sys/bus/i2c/devices/10-0050", + "/sys/bus/i2c/devices/11-0050", "/sys/bus/i2c/devices/12-0050", + "/sys/bus/i2c/devices/13-0050", "/sys/bus/i2c/devices/14-0050", + "/sys/bus/i2c/devices/15-0050", "/sys/bus/i2c/devices/16-0050"], + 'status': 'NOTINST' + }, + 'SFP-G02': { + "type": "QSFP28", + 'number': 8, + 'parent': 'PCA9548_0x71_2', + 'channels': [0, 1, 2, 3, 4, 5, 6, 7], + 'driver': 'optoe1', + 'i2caddr': '0x50', + 'paths': ["/sys/bus/i2c/devices/17-0050", "/sys/bus/i2c/devices/18-0050", + "/sys/bus/i2c/devices/19-0050", "/sys/bus/i2c/devices/20-0050", + "/sys/bus/i2c/devices/21-0050", "/sys/bus/i2c/devices/22-0050", + "/sys/bus/i2c/devices/23-0050", "/sys/bus/i2c/devices/24-0050"], + 'status': 'NOTINST' + }, + 'SFP-G03': { + "type": "QSFP28", + 'number': 8, + 'parent': 'PCA9548_0x71_3', + 'channels': [0, 1, 2, 3, 4, 5, 6, 7], + 'driver': 'optoe1', + 'i2caddr': '0x50', + 'paths': ["/sys/bus/i2c/devices/25-0050", "/sys/bus/i2c/devices/26-0050", + "/sys/bus/i2c/devices/27-0050", "/sys/bus/i2c/devices/28-0050", + "/sys/bus/i2c/devices/29-0050", "/sys/bus/i2c/devices/30-0050", + "/sys/bus/i2c/devices/31-0050", "/sys/bus/i2c/devices/32-0050"], + 'status': 'NOTINST' + }, + 'SFP-G04': { + "type": "QSFP28", + 'number': 8, + 'parent': 'PCA9548_0x71_4', + 'channels': [0, 1, 2, 3, 4, 5, 6, 7], + 'driver': 'optoe1', + 'i2caddr': '0x50', + 'paths': ["/sys/bus/i2c/devices/33-0050", "/sys/bus/i2c/devices/34-0050", + "/sys/bus/i2c/devices/35-0050", "/sys/bus/i2c/devices/36-0050", + "/sys/bus/i2c/devices/37-0050", "/sys/bus/i2c/devices/38-0050", + "/sys/bus/i2c/devices/39-0050", "/sys/bus/i2c/devices/40-0050"], + 'status': 'NOTINST' + } +} + +# Component +# ["Master-CPLD", ("Used for managing Fan, PSU, system LEDs, QSFP " +# "modules (1-16)")], +# ["Slave-CPLD", "Used for managing QSFP modules (17-32)"] + +CHASSIS_COMPONENTS = [ + ["BIOS", ("Performs initialization of hardware components during " + "booting")], + ["System-CPLD", "Used for managing CPU board devices and power"] +] + + +class PlatDev(): + def __init__(self): + self.plat_name = PLATFORM_NAME + self.psu_info = copy.deepcopy(PSU_INFO) + self.thermal_info = [] + self.fan_info = copy.deepcopy(FAN_INFO) + self.sfp_info = copy.deepcopy(SFP_GROUPS) + + # get install info + # self.sfp_install_info = SFP_GROUPS + self.device_install_info = I2C_DEVICES + + # update path info with install info + # Item 1/2 not changed, append directly + self.thermal_info.append(THERMAL_SENSOR_LIST[0]) + self.thermal_info.append(THERMAL_SENSOR_LIST[1]) + + def __read_attr_file(self, filepath, line=0xFF): + try: + with open(filepath, 'r') as fd: + if line == 0xFF: + data = fd.read() + return data.rstrip('\r\n') + else: + data = fd.readlines() + return data[line].rstrip('\r\n') + except FileNotFoundError: + logger.log_error(f"File {filepath} not found. Aborting") + except OSError as ex: + logger.log_error("Cannot open - {}: {}".format(filepath, repr(ex))) + + return None + + def bmc_is_exist(self): + bmc_filePath = '/sys/class/hwmon/hwmon2/device/NBA715_SYS/bmc_present' + if os.path.exists(bmc_filePath): + value = self.__read_attr_file(bmc_filePath) + if int(value) == 1: + return True + else: + return False + else: + return False + ######Componet method ##### + + def get_component_count(self): + return len(CHASSIS_COMPONENTS) + + def get_component_name(self, idx): + return CHASSIS_COMPONENTS[idx][0] + + def get_component_descript(self, idx): + return CHASSIS_COMPONENTS[idx][1] + + ###### PSU method ###### + def get_psu_list(self): + return PSU_LIST + + def get_psu_info_all(self): + return self.psu_info + + def get_psu_info_by_name(self, name): + return self.psu_info.get(name) + + def get_psu_attr_path_by_name(self, name): + return self.psu_info[name].get('attr_path') + + def get_psu_status_path_by_name(self, name): + return self.psu_info[name].get('status_path') + + ###### Thermal method ###### + def get_thermal_dev_info_all(self): + return self.thermal_info + + def get_thermal_dev_name_by_idx(self, index): + return self.thermal_info[index].get('name') + + def get_thermal_dev_tempidx_by_idx(self, index): + return self.thermal_info[index].get('temp_index') + + def get_thermal_dev_sysfile_path_by_idx(self, index): + return self.thermal_info[index].get('sysfile_path') + + def get_thermal_dev_support_mask_by_idx(self, index): + return self.thermal_info[index].get('support_mask') + + def get_thermal_dev_ext_sysfile_list_by_idx(self, index): + return self.thermal_info[index].get('ext_sysfile_list') + + ###### Fan method ###### + def get_fan_support(self): + return True + + def get_fan_list(self): + return FAN_LIST + + def get_fan_info_all(self): + return self.fan_info + + def get_fan_info_by_name(self, name): + return self.fan_info.get(name) + + def get_fan_sysfile_path_by_name(self, name): + return self.fan_info[name].get('attr_path') + + def get_fan_is_draw_by_name(self, name): + return self.fan_info[name].get('isdraw') + + def get_fan_num_by_name(self, name): + return self.fan_info[name].get('fan_num') + + ###### SFP method ###### + def get_sfp_num(self): + return PORT_NUM + + def get_sfp_group_list(self): + return SFP_GROUP_LIST + + def get_sfp_group_info(self): + return self.sfp_info + + def get_sfp_group_info_by_name(self, name): + return self.sfp_info.get(name) + + def get_sfp_group_type_by_name(self, name): + return self.sfp_info[name].get('type') + + def get_sfp_group_path_by_name(self, name): + return self.sfp_info[name].get('paths') + + def get_sfp_group_number_by_name(self, name): + return self.sfp_info[name].get('number') + + def get_sfp_ext_sysfile_list(self): + return SFP_EXT_SYSFILE_LIST diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/platform.py b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/platform.py new file mode 100644 index 000000000000..6e1a90132acc --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/platform.py @@ -0,0 +1,19 @@ +############################################################################# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + +try: + from sonic_platform_base.platform_base import PlatformBase + from sonic_platform.chassis import Chassis +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PlatformBase): + """Platform-specific Platform class""" + + def __init__(self): + PlatformBase.__init__(self) + self._chassis = Chassis() diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/psu.py b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/psu.py new file mode 100644 index 000000000000..986267bf3f91 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/psu.py @@ -0,0 +1,196 @@ +############################################################################# +# +# Module contains an implementation of SONiC Platform Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +try: + from sonic_platform_base.psu_base import PsuBase + from sonic_py_common.logger import Logger + from sonic_platform.fan import Fan +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +SYSLOG_IDENTIFIER = 'thermalctld' +logger = Logger(SYSLOG_IDENTIFIER) + +# To do: should be defined in platDev +PSU_MAX_VOUT = 12.0 # voltage +PSU_MIN_VOUT = 3.3 # voltage +PSU_MAX_TEMP = 50.0 # C + + +class Psu(PsuBase): + """Platform-specific Psu class""" + + def __init__(self, index, info_list, is_bmc): + PsuBase.__init__(self) + self.index = index + self.is_bmc = is_bmc + self.attr_path = info_list[0] + self.status_path = info_list[1] + if is_bmc: + speed_file = self.attr_path + 'psu{}_fan_speed'.format(index+1) + else: + speed_file = self.attr_path + 'psu_fan_speed_1' + + fan = Fan(index, 0, [self.status_path, speed_file], True) + self._fan_list.append(fan) + self.psu_name = "PSU{}".format(self.index+1) + + def __read_attr_file(self, filepath, line=0xFF): + try: + with open(filepath, 'r') as fd: + if line == 0xFF: + data = fd.read() + return data.rstrip('\r\n') + else: + data = fd.readlines() + return data[line].rstrip('\r\n') + except FileNotFoundError: + logger.log_error(f"File {filepath} not found. Aborting") + except OSError as ex: + logger.log_error("Cannot open - {}: {}".format(filepath, repr(ex))) + + return None + + def get_name(self): + return self.psu_name + + def get_presence(self): + """ + Retrieves the presence status of power supply unit (PSU) defined + Returns: + bool: True if PSU is present, False if not + """ + data = self.__read_attr_file( + self.status_path + 'psu{}_prnt'.format(self.index+1)) + if data == '1': + return True + else: + return False + + def get_powergood_status(self): + """ + Retrieves the powergood status of PSU + Returns: + A boolean, True if PSU has stablized its output voltages and passed all + its internal self-tests, False if not. + """ + data = self.__read_attr_file( + self.status_path + 'psu{}_good'.format(self.index+1)) + if data == '1': + return True + else: + return False + + def get_voltage(self): + """ + Retrieves current PSU voltage output + Returns: + A float number, the output voltage in volts, + e.g. 12.1 + """ + if self.is_bmc: + path = self.attr_path + 'psu{}_vout'.format(self.index+1) + else: + path = self.attr_path + "/psu_vout" + vout = self.__read_attr_file(path, 0) + if vout is not None: + return float(vout) / 1000 + + return False + + def get_current(self): + """ + Retrieves present electric current supplied by PSU + Returns: + A float number, the electric current in amperes, e.g 15.4 + """ + if self.is_bmc: + path = self.attr_path + 'psu{}_iout'.format(self.index+1) + else: + path = self.attr_path + "/psu_iout" + iout = self.__read_attr_file(path, 0) + if iout is not None: + return float(iout) / 1000 + return False + + def get_power(self): + """ + Retrieves current energy supplied by PSU + Returns: + A float number, the power in watts, e.g. 302.6 + """ + if self.is_bmc: + path = self.attr_path + 'psu{}_pout'.format(self.index+1) + else: + path = self.attr_path + "/psu_pout" + pout = self.__read_attr_file(path, 0) + if pout is not None: + return float(pout) / 1000000 + return False + + def set_status_led(self, color): + """ + Sets the state of the PSU status LED + Args: + color: A string representing the color with which to set the + PSU status LED + Returns: + bool: True if status LED state is set successfully, False if not + """ + raise NotImplementedError + + def get_status_led(self): + """ + Gets the state of the PSU status LED + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + raise NotImplementedError + + def get_temperature(self): + """ + Retrieves current temperature reading from PSU + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + if self.is_bmc: + path = self.attr_path+'psu{}_temp'.format(self.index+1) + else: + path = self.attr_path + "/psu_temp_1" + temperature = self.__read_attr_file(path, 0) + if temperature is not None: + return float(temperature) / 1000 + + return False + + def get_temperature_high_threshold(self): + """ + Retrieves the high threshold temperature of PSU + Returns: + A float number, the high threshold temperature of PSU in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + return PSU_MAX_TEMP + + def get_voltage_high_threshold(self): + """ + Retrieves the high threshold PSU voltage output + Returns: + A float number, the high threshold output voltage in volts, + e.g. 12.1 + """ + return PSU_MAX_VOUT + + def get_voltage_low_threshold(self): + """ + Retrieves the low threshold PSU voltage output + Returns: + A float number, the low threshold output voltage in volts, + e.g. 12.1 + """ + return PSU_MIN_VOUT diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/sfp.py b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/sfp.py new file mode 100644 index 000000000000..64fe75555323 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/sfp.py @@ -0,0 +1,1251 @@ +#!/usr/bin/env python + +############################################################################# +# +# Module contains an implementation of SONiC Platform Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +try: + from sonic_platform_base.sfp_base import SfpBase + from sonic_py_common.logger import Logger + from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId + from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom + from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId + from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +logger = Logger("sfp") + +############################################################################# +# +# SFP : +# 2 wire address 1010000x (A0h) (i2c 0x50) +# ------------------------------------------------ 0 +# | Serial ID Defined by SFP MSA (96 bytes) | <-- get_transceiver_info +# |----------------------------------------------| 95 +# | Vendor Specific (32 bytes) | +# |----------------------------------------------| 127 +# | Reserved, SFF-8079 (128 byte) | +# ------------------------------------------------ 255 +# +# 2 wire address 1010001x (A2h) (i2c 0x51) +# ------------------------------------------------ 0 +# | Alarm and Warning Threshold (56 bytes) | <-- get_transceiver_threshold_info +# |----------------------------------------------| 55 +# | Cal Constants (40 bytes) | +# |----------------------------------------------| 95 +# | Real Time Diagnostic Interface(24 bytes) | <-- get_transceiver_bulk_status +# |----------------------------------------------| 119 +# | Vendor Specific (7 bytes) | +# |----------------------------------------------| 126 +# | Page Select Byte (Optional) | -> select one of the below pages as +# ------------------------------------------------ 127 address 128-255 +# +# Page 00h/01h +# |----------------------------------------------| 128 +# | User Writeable EEPROM (120 bytes) | +# |----------------------------------------------| 247 +# | Vendor Specific (8 bytes) | +# ------------------------------------------------ 255 +# Page 02h +# |----------------------------------------------| 128 +# | Control Function (128 bytes) | +# ------------------------------------------------ 255 +# Page 03h-7Fh +# |----------------------------------------------| 128 +# | Reserved (128 bytes) | +# ------------------------------------------------ 255 +# Page 80h-FFh +# |----------------------------------------------| 128 +# | Vendor Specific (128 bytes) | +# ------------------------------------------------ 255 +# +# ========================================================== +# QSFP : +# 2 wire address 1010000x (A0h) (i2c 0x50) +# +# ------------------------------------------------ 0 +# | ID and status (3 bytes) | +# |----------------------------------------------| 2 +# | Interrupt Flags (19 bytes) | +# |----------------------------------------------| 21 +# | Module Monitors (12 bytes) | <-- get_transceiver_bulk_status +# |----------------------------------------------| 33 +# | Channel Monitors (12 bytes) | +# |----------------------------------------------| 81 +# | Reserved (4 bytes) | +# |----------------------------------------------| 85 +# | Control (12 bytes) | <- get_power_override +# |----------------------------------------------| 97 +# | ~~~ | +# |----------------------------------------------| 126 +# | Page Select Byte | -> select one of the below pages as +# ------------------------------------------------ 127 address 128-255 +# +# +# Page 00h +# |----------------------------------------------| 128 +# | Base ID Filed (64 bytes) | <-- get_transceiver_info +# |----------------------------------------------| 191 +# | Extended ID (32 bytes) | +# |----------------------------------------------| 223 +# | Vendor Specific ID (8 bytes) | +# ------------------------------------------------ 255 +# Page 01h (optional) +# |----------------------------------------------| 128 +# | ~~~~ (128 bytes) | +# ------------------------------------------------ 255 +# Page 02h (optional) +# |----------------------------------------------| 128 +# | User EEPROM Data (128 bytes) | +# ------------------------------------------------ 255 + +# Page 03h (optional on QSFP28) +# |----------------------------------------------| 128 +# | Module Threshold (48 bytes) | <-- get_transceiver_threshold_info +# |----------------------------------------------| 175 +# | Channel Threshold (48 bytes) | +# |----------------------------------------------| 223 +# | Reserved (2 bytes) | +# |----------------------------------------------| 225 +# | Vendor Specific Channel Controls (16 bytes) | +# |----------------------------------------------| 241 +# | Channel Monitor Masks (12 bytes) | +# |----------------------------------------------| 253 +# | Reserved (2 bytes) | +# ------------------------------------------------ 255 +# +############################################################################# + +# function eunm +SFP_GET_PRESENCE = 0 +SFP_RESET = 1 +SFP_GET_LOW_POWER_MODE = 2 +SFP_SET_LOW_POWER_MODE = 3 + +# XCVR type definition +SFP_TYPE = 0 +QSFP_TYPE = 1 + +SFP_TYPE_CODE_LIST = [ + '03' # SFP/SFP+/SFP28 +] +QSFP_TYPE_CODE_LIST = [ + '0d', # QSFP+ or later + '11' # QSFP28 or later +] + +# index for A0H, A2H sysfs file path +INDEX_A0H = 0 +INDEX_A2H = 1 + +# offset/width definition +OFFSET = 0 +WIDTH = 1 + +QSFP_UPPER_MEMORY_PAGE00_OFFSET = 128 +QSFP_UPPER_MEMORY_PAGE03_OFFSET = 512 + +SFP_A0H_OFFSET = 0 +SFP_A2H_OFFSET = 0 + +XCVR_DOM_CAPABILITY_OFFSET = 92 +XCVR_DOM_CAPABILITY_WIDTH = 2 +ID_FIELD_WIDTH = 92 + +QSFP_VERSION_COMPLIANCE_OFFSET = 1 +QSFP_VERSION_COMPLIANCE_WIDTH = 1 +QSFP_INTERFACE_BULK_WIDTH = 20 +QSFP_OPTION_VALUE_OFFSET = 192 +QSFP_OPTION_VALUE_WIDTH = 4 +QSFP_ID_FIELDS = { + # NAME : [OFFSET:WIDTH] + 'TYPE': [0, 1], + 'EXTID': [1, 1], + 'CONNECTOR': [2, 1], + 'XCVR_COMPLIANCE': [3, 8], + 'ENCODING': [11, 1], + 'NORMAL_BITRATE': [12, 1], + 'EXT_RATE_SEL_COMPLIANCE': [13, 1], + 'CABLE_LEN': [14, 5], + 'DEVICE_TECH': [19, 1], + 'VENDOR_NAME': [20, 16], + 'EXT_XCVR_CODE': [36, 1], + 'VENDOR_OUI': [37, 3], + 'VENDOR_PN': [40, 16], + 'VENDOR_REV': [56, 2], + 'WAVELENGTH': [58, 2], + 'WAVELENGTH_TOLERANCE': [60, 2], + 'MAX_CASE_TEMP': [62, 1], + 'CC_BASE': [63, 1], + 'OPTIONS': [64, 4], + 'VENDOR_SN': [68, 16], + 'VENDOR_DATE': [84, 8], + # DOM + 'TEMPERATURE': [22, 2], + 'VOLTAGE': [26, 2], + 'CHANNEL_MON': [34, 24], + 'CONTROL': [86, 12], + # PAGE03 + 'MODULE_THRESHOLD': [0, 24], + 'CHANNEL_THRESHOLD': [50, 24] +} +SFP_INTERFACE_BULK_WIDTH = 21 +SFP_ID_FIELDS = { + # NAME : [OFFSET:WIDTH] + 'TYPE': [0, 1], + 'EXTID': [1, 1], + 'CONNECTOR': [2, 1], + 'XCVR_COMPLIANCE': [3, 8], + 'ENCODING': [11, 1], + 'NORMAL_BITRATE': [12, 1], + 'EXT_RATE_SEL_COMPLIANCE': [13, 1], + 'CABLE_LEN': [14, 6], + 'VENDOR_NAME': [20, 16], + 'EXT_XCVR_CODE': [36, 1], + 'VENDOR_OUI': [37, 3], + 'VENDOR_PN': [40, 16], + 'VENDOR_REV': [56, 4], + 'WAVELENGTH': [60, 2], + # UNALLOCATED WIDDTH: 1 + 'CC_BASE': [63, 1], + 'OPTIONS': [64, 2], + 'BITRATE_MAX': [66, 1], + # BITRATE_MAX ?? + 'BITRATE_MAX_1': [67, 1], + 'VENDOR_SN': [68, 16], + 'VENDOR_DATE': [84, 8], + # DOM + 'TEMPERATURE': [96, 2], + 'VOLTAGE': [98, 2], + 'CHANNEL_MON': [100, 6], + 'MODULE_THRESHOLD': [0, 40] +} + + +qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)', + 'Length OM2(m)', 'Length OM1(m)', + 'Length Cable Assembly(m)') + +sfp_cable_length_tup = ('LengthSMFkm-UnitsOfKm', 'LengthSMF(UnitsOf100m)', + 'Length50um(UnitsOf10m)', 'Length62.5um(UnitsOfm)', + 'LengthCable(UnitsOfm)', 'LengthOM3(UnitsOf10m)') + +sfp_compliance_code_tup = ('10GEthernetComplianceCode', 'InfinibandComplianceCode', + 'ESCONComplianceCodes', 'SONETComplianceCodes', + 'EthernetComplianceCodes', 'FibreChannelLinkLength', + 'FibreChannelTechnology', 'SFP+CableTechnology', + 'FibreChannelTransmissionMedia', 'FibreChannelSpeed') + +qsfp_compliance_code_tup = ('10/40G Ethernet Compliance Code', 'SONET Compliance codes', + 'SAS/SATA compliance codes', 'Gigabit Ethernet Compliant codes', + 'Fibre Channel link length/Transmitter Technology', + 'Fibre Channel transmission media', 'Fibre Channel Speed') + + +class Sfp(SfpBase): + """Platform-specific Sfp class""" + + def __init__(self, index, eeprom_path_list, sfp_type, ext_sysfile_list=None): + # index: port index, start from 0 + # eeprom_path_list : a list of path to eeprom sysfile + # [0]: for 0x50 + # [1]: for 0x51 + # ext_sysfile_list: used to get other function of sfp + # [0]: present + # [1]: reset + # [2]: get lowpower mode + # [3]: set lowpower mode + # ext_sysfile_list[0]: QSFP path + # ext_sysfile_list[1]: SFP path + self.index = index + self.eeprom_path_list = eeprom_path_list + # self._get_sfp_type(sfp_type) + self.sfp_type = sfp_type + if self.sfp_type == QSFP_TYPE: + self.present_file = ext_sysfile_list[0] + \ + 'qsfp{}_present'.format(self.index) + self.reset_file = ext_sysfile_list[0] + \ + 'qsfp{}_reset'.format(self.index) + self.lp_file = ext_sysfile_list[0] + \ + 'qsfp{}_low_power'.format(self.index) + else: + self.present_file = ext_sysfile_list[1] + \ + 'sfp{}_present'.format(self.index) + self.reset_file = None + self.lp_file = None + + def _get_sfp_type(self, sfp_type): + ty = self._read_eeprom_bytes( + SFP_ID_FIELDS['TYPE'][OFFSET], SFP_ID_FIELDS['TYPE'][WIDTH], INDEX_A0H) + if ty is not None: + if ty[0] in SFP_TYPE_CODE_LIST: + self.sfp_type = SFP_TYPE + if ty[0] in QSFP_TYPE_CODE_LIST: + self.sfp_type = QSFP_TYPE + else: + self.sfp_type = sfp_type + logger.log_warning("Unreganized sfp type of module {} . unsupported, treated as specified type {}".format( + self.index, sfp_type)) + else: + self.sfp_type = sfp_type + + def _read_eeprom_bytes(self, offset, num_bytes, path_idx): + eeprom_raw = [] + + eeprom = None + + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + try: + eeprom = open( + self.eeprom_path_list[path_idx], mode="rb", buffering=0) + eeprom.seek(offset) + raw_data = eeprom.read(num_bytes) + for nb in range(0, len(raw_data)): + eeprom_raw[nb] = hex(ord(raw_data[nb]))[2:].zfill(2) + except Exception as ex: + logger.log_error("Fail to read eeprom {}".format( + self.eeprom_path_list[path_idx])) + logger.log_error(" {}".format(ex)) + if eeprom is not None: + eeprom.close() + return None + + return eeprom_raw + + def __read_attr_file(self, filepath, line=0xFF): + try: + with open(filepath, 'r') as fd: + if line == 0xFF: + data = fd.read() + return data.rstrip('\r\n') + else: + data = fd.readlines() + return data[line].rstrip('\r\n') + except Exception as ex: + logger.log_error( + "Unable to open {} due to {}".format(filepath, repr(ex))) + + return None + + def __write_attr_file(self, filepath, data): + try: + with open(filepath, 'w') as fd: + return fd.write(data) + except Exception as ex: + logger.log_error( + "Unable to open {} due to {}".format(filepath, repr(ex))) + return 0 + + def get_presence(self): + if self.present_file is not None: + data = self.__read_attr_file(self.present_file) + if data is not None: + if int(data) == 1: + return True + return False + + def _convert_string_to_num(self, value_str): + if "-inf" in value_str: + return '-inf' + elif "Unknown" in value_str: + return 'N/A' + elif 'dBm' in value_str: + t_str = value_str.rstrip('dBm') + return float(t_str) + elif 'mA' in value_str: + t_str = value_str.rstrip('mA') + return float(t_str) + elif 'C' in value_str: + t_str = value_str.rstrip('C') + return float(t_str) + elif 'Volts' in value_str: + t_str = value_str.rstrip('Volts') + return float(t_str) + else: + return 'N/A' + + def _dom_capability_detect(self): + if not self.get_presence(): + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.calibration = 0 + return + + if self.sfp_type == QSFP_TYPE: + self.calibration = 1 + sfpi_obj = sff8436InterfaceId() + if sfpi_obj is None: + self.dom_supported = False + offset = 128 + + # QSFP capability byte parse, through this byte can know whether it support tx_power or not. + # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, + # need to add more code for determining the capability and version compliance + # in SFF-8636 dom capability definitions evolving with the versions. + qsfp_dom_capability_raw = self._read_eeprom_bytes( + (offset + XCVR_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH, INDEX_A0H) + if qsfp_dom_capability_raw is not None: + qsfp_version_compliance_raw = self._read_eeprom_bytes( + QSFP_VERSION_COMPLIANCE_OFFSET, QSFP_VERSION_COMPLIANCE_WIDTH, INDEX_A0H) + qsfp_version_compliance = int( + qsfp_version_compliance_raw[0], 16) + qspf_dom_capability = int(qsfp_dom_capability_raw[0], 16) + if qsfp_version_compliance >= 0x08: + self.dom_temp_supported = (qspf_dom_capability & 0x20 != 0) + self.dom_volt_supported = (qspf_dom_capability & 0x10 != 0) + self.dom_rx_power_supported = ( + qspf_dom_capability & 0x08 != 0) + self.dom_tx_power_supported = ( + qspf_dom_capability & 0x04 != 0) + else: + self.dom_temp_supported = True + self.dom_volt_supported = True + self.dom_rx_power_supported = ( + qspf_dom_capability & 0x08 != 0) + self.dom_tx_power_supported = True + self.dom_supported = True + self.calibration = 1 + qsfp_option_value_raw = self._read_eeprom_bytes( + QSFP_OPTION_VALUE_OFFSET, QSFP_OPTION_VALUE_WIDTH, INDEX_A0H) + if qsfp_option_value_raw is not None: + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return None + self.optional_capability = sfpd_obj.parse_option_params( + qsfp_option_value_raw, 0) + self.dom_tx_disable_supported = self.optional_capability[ + 'data']['TxDisable']['value'] == 'On' + else: + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.calibration = 0 + elif self.sfp_type == SFP_TYPE: + sfpi_obj = sff8472InterfaceId() + if sfpi_obj is None: + return None + sfp_dom_capability_raw = self._read_eeprom_bytes( + XCVR_DOM_CAPABILITY_OFFSET, XCVR_DOM_CAPABILITY_WIDTH, INDEX_A0H) + if sfp_dom_capability_raw is not None: + sfp_dom_capability = int(sfp_dom_capability_raw[0], 16) + self.dom_supported = (sfp_dom_capability & 0x40 != 0) + if self.dom_supported: + self.dom_temp_supported = True + self.dom_volt_supported = True + self.dom_rx_power_supported = True + self.dom_tx_power_supported = True + if sfp_dom_capability & 0x20 != 0: + self.calibration = 1 + elif sfp_dom_capability & 0x10 != 0: + self.calibration = 2 + else: + self.calibration = 0 + else: + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + self.calibration = 0 + self.dom_tx_disable_supported = ( + int(sfp_dom_capability_raw[1], 16) & 0x40 != 0) + else: + self.dom_supported = False + self.dom_temp_supported = False + self.dom_volt_supported = False + self.dom_rx_power_supported = False + self.dom_tx_power_supported = False + + def get_transceiver_info(self): + """ + Retrieves transceiver info of this SFP + Returns: + A dict which contains following keys/values : + ======================================================================== + keys |Value Format |Information + ---------------------------|---------------|---------------------------- + type |1*255VCHAR |type of SFP + vendor_rev |1*255VCHAR |vendor revision of SFP + serial |1*255VCHAR |serial number of the SFP + manufacturer |1*255VCHAR |SFP vendor name + model |1*255VCHAR |SFP model name + connector |1*255VCHAR |connector information + encoding |1*255VCHAR |encoding information + ext_identifier |1*255VCHAR |extend identifier + ext_rateselect_compliance |1*255VCHAR |extended rateSelect compliance + cable_length |INT |cable length in m + nominal_bit_rate |INT |nominal bit rate by 100Mbs + specification_compliance |1*255VCHAR |specification compliance + vendor_date |1*255VCHAR |vendor date + vendor_oui |1*255VCHAR |vendor OUI + ======================================================================== + """ + transceiver_info_dict_keys = [ + 'type', 'vendor_rev', + 'serial', 'manufacturer', + 'model', 'connector', + 'encoding', 'ext_identifier', + 'ext_rateselect_compliance', 'cable_type', + 'cable_length', 'nominal_bit_rate', + 'specification_compliance', 'vendor_date', + 'vendor_oui', 'application_advertisement'] + + transceiver_info_dict = dict.fromkeys( + transceiver_info_dict_keys, 'N/A') + + if self.sfp_type == QSFP_TYPE: + field_offset = QSFP_UPPER_MEMORY_PAGE00_OFFSET # upper memory map: Page 00h + Id_field = QSFP_ID_FIELDS + info_bulk_width = QSFP_INTERFACE_BULK_WIDTH + sfpi_obj = sff8436InterfaceId() + + elif self.sfp_type == SFP_TYPE: + # lower memory map: A0h (SFP i2c 0x50) + field_offset = SFP_A0H_OFFSET + Id_field = SFP_ID_FIELDS + info_bulk_width = SFP_INTERFACE_BULK_WIDTH + sfpi_obj = sff8472InterfaceId() + else: + logger.log_error("Unsupported sfp type") + return None + + if sfpi_obj is None: + logger.log_error("sfpi_obj create fail") + return None + + # read Base ID field + sfp_interface_bulk_raw = self._read_eeprom_bytes( + field_offset, ID_FIELD_WIDTH, INDEX_A0H) + if sfp_interface_bulk_raw is None: + logger.log_error( + " Fail to read BaseID field of module {}".format(self.index+1)) + return None + + start = 0 + end = start + info_bulk_width + sfp_interface_bulk_data = sfpi_obj.parse_sfp_info_bulk( + sfp_interface_bulk_raw[start: end], 0) + + start = Id_field['VENDOR_NAME'][OFFSET] + end = start + Id_field['VENDOR_NAME'][WIDTH] + sfp_vendor_name_data = sfpi_obj.parse_vendor_name( + sfp_interface_bulk_raw[start: end], 0) + + start = Id_field['VENDOR_PN'][OFFSET] + end = start + Id_field['VENDOR_PN'][WIDTH] + sfp_vendor_pn_data = sfpi_obj.parse_vendor_pn( + sfp_interface_bulk_raw[start: end], 0) + + start = Id_field['VENDOR_REV'][OFFSET] + end = start + Id_field['VENDOR_REV'][WIDTH] + sfp_vendor_rev_data = sfpi_obj.parse_vendor_rev( + sfp_interface_bulk_raw[start: end], 0) + + start = Id_field['VENDOR_SN'][OFFSET] + end = start + Id_field['VENDOR_SN'][WIDTH] + sfp_vendor_sn_data = sfpi_obj.parse_vendor_sn( + sfp_interface_bulk_raw[start: end], 0) + + start = Id_field['VENDOR_OUI'][OFFSET] + end = start + Id_field['VENDOR_OUI'][WIDTH] + sfp_vendor_oui_data = sfpi_obj.parse_vendor_oui( + sfp_interface_bulk_raw[start: end], 0) + + start = Id_field['VENDOR_DATE'][OFFSET] + end = start + Id_field['VENDOR_DATE'][WIDTH] + sfp_vendor_date_data = sfpi_obj.parse_vendor_date( + sfp_interface_bulk_raw[start: end], 0) + + compliance_code_dict = {} + + transceiver_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value'] + transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] + transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] + transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] + transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] + transceiver_info_dict['vendor_date'] = sfp_vendor_date_data[ + 'data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] + transceiver_info_dict['connector'] = sfp_interface_bulk_data['data']['Connector']['value'] + transceiver_info_dict['encoding'] = sfp_interface_bulk_data['data']['EncodingCodes']['value'] + transceiver_info_dict['ext_identifier'] = sfp_interface_bulk_data['data']['Extended Identifier']['value'] + transceiver_info_dict['ext_rateselect_compliance'] = sfp_interface_bulk_data['data']['RateIdentifier']['value'] + + if self.sfp_type == QSFP_TYPE: + for key in qsfp_cable_length_tup: + if key in sfp_interface_bulk_data['data']: + transceiver_info_dict['cable_type'] = key + transceiver_info_dict['cable_length'] = str( + sfp_interface_bulk_data['data'][key]['value']) + + for key in qsfp_compliance_code_tup: + if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: + compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value'] + transceiver_info_dict['specification_compliance'] = str( + compliance_code_dict) + transceiver_info_dict['nominal_bit_rate'] = str( + sfp_interface_bulk_data['data']['Nominal Bit Rate(100Mbs)']['value']) + else: + for key in sfp_cable_length_tup: + if key in sfp_interface_bulk_data['data']: + transceiver_info_dict['cable_type'] = key + transceiver_info_dict['cable_length'] = str( + sfp_interface_bulk_data['data'][key]['value']) + + for key in sfp_compliance_code_tup: + if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: + compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value'] + transceiver_info_dict['specification_compliance'] = str( + compliance_code_dict) + transceiver_info_dict['nominal_bit_rate'] = str( + sfp_interface_bulk_data['data']['NominalSignallingRate(UnitsOf100Mbd)']['value']) + + return transceiver_info_dict + + def get_transceiver_bulk_status(self): + """ + Retrieves transceiver bulk status of this SFP + + Returns: + A dict which contains following keys/values : + ======================================================================== + keys |Value Format |Information + ---------------------------|---------------|---------------------------- + rx_los |BOOLEAN |RX loss-of-signal status, True if has RX los, False if not. + tx_fault |BOOLEAN |TX fault status, True if has TX fault, False if not. + reset_status |BOOLEAN |reset status, True if SFP in reset, False if not. + lp_mode |BOOLEAN |low power mode status, True in lp mode, False if not. + tx_disable |BOOLEAN |TX disable status, True TX disabled, False if not. + tx_disabled_channel |HEX |disabled TX channels in hex, bits 0 to 3 represent channel 0 + | |to channel 3. + temperature |INT |module temperature in Celsius + voltage |INT |supply voltage in mV + txbias |INT |TX Bias Current in mA, n is the channel number, + | |for example, tx2bias stands for tx bias of channel 2. + rxpower |INT |received optical power in mW, n is the channel number, + | |for example, rx2power stands for rx power of channel 2. + txpower |INT |TX output power in mW, n is the channel number, + | |for example, tx2power stands for tx power of channel 2. + ======================================================================== + """ + transceiver_dom_info_dict_keys = [ + 'temperature', 'voltage', + 'rx1power', 'rx2power', + 'rx3power', 'rx4power', + 'tx1bias', 'tx2bias', + 'tx3bias', 'tx4bias', + 'tx1power', 'tx2power', + 'tx3power', 'tx4power'] + + transceiver_dom_info_dict = dict.fromkeys( + transceiver_dom_info_dict_keys, 'N/A') + + path_idx = INDEX_A0H + + self._dom_capability_detect() + if not self.dom_supported: + return transceiver_dom_info_dict + + if self.sfp_type == QSFP_TYPE: + field_offset = 0 # lower memory map: A0h + Id_field = QSFP_ID_FIELDS + sfpd_obj = sff8436Dom() + elif self.sfp_type == SFP_TYPE: + if self.eeprom_path_list[INDEX_A2H] is not 'n/a': + # lower memory map: A2h (SFP i2c 0x51) + field_offset = SFP_A2H_OFFSET + path_idx = INDEX_A2H + else: + field_offset = 256 + Id_field = SFP_ID_FIELDS + sfpd_obj = sff8472Dom() + else: + return None + + if sfpd_obj is None: + return transceiver_dom_info_dict + sfpd_obj._calibration_type = self.calibration + + dom_temperature_raw = self._read_eeprom_bytes( + field_offset + Id_field['TEMPERATURE'][OFFSET], Id_field['TEMPERATURE'][WIDTH], path_idx) + if dom_temperature_raw is not None: + dom_temperature_data = sfpd_obj.parse_temperature( + dom_temperature_raw, 0) + transceiver_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] + + dom_voltage_raw = self._read_eeprom_bytes( + field_offset + Id_field['VOLTAGE'][OFFSET], Id_field['VOLTAGE'][WIDTH], path_idx) + if dom_voltage_raw is not None: + dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) + transceiver_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] + + dom_channel_monitor_raw = self._read_eeprom_bytes( + field_offset + Id_field['CHANNEL_MON'][OFFSET], Id_field['CHANNEL_MON'][WIDTH], path_idx) + if dom_channel_monitor_raw is not None: + if self.sfp_type == QSFP_TYPE: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power( + dom_channel_monitor_raw, 0) + transceiver_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TX1Power']['value'] + transceiver_dom_info_dict['tx2power'] = dom_channel_monitor_data['data']['TX2Power']['value'] + transceiver_dom_info_dict['tx3power'] = dom_channel_monitor_data['data']['TX3Power']['value'] + transceiver_dom_info_dict['tx4power'] = dom_channel_monitor_data['data']['TX4Power']['value'] + transceiver_dom_info_dict['rx1power'] = dom_channel_monitor_data['data']['RX1Power']['value'] + transceiver_dom_info_dict['rx2power'] = dom_channel_monitor_data['data']['RX2Power']['value'] + transceiver_dom_info_dict['rx3power'] = dom_channel_monitor_data['data']['RX3Power']['value'] + transceiver_dom_info_dict['rx4power'] = dom_channel_monitor_data['data']['RX4Power']['value'] + transceiver_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TX1Bias']['value'] + transceiver_dom_info_dict['tx2bias'] = dom_channel_monitor_data['data']['TX2Bias']['value'] + transceiver_dom_info_dict['tx3bias'] = dom_channel_monitor_data['data']['TX3Bias']['value'] + transceiver_dom_info_dict['tx4bias'] = dom_channel_monitor_data['data']['TX4Bias']['value'] + + else: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params( + dom_channel_monitor_raw, 0) + transceiver_dom_info_dict['rx1power'] = dom_channel_monitor_data['data']['RXPower']['value'] + transceiver_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TXBias']['value'] + transceiver_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TXPower']['value'] + + for key in transceiver_dom_info_dict: + transceiver_dom_info_dict[key] = self._convert_string_to_num( + transceiver_dom_info_dict[key]) + + return transceiver_dom_info_dict + + def get_transceiver_threshold_info(self): + """ + Retrieves transceiver threshold info of this SFP + + Returns: + A dict which contains following keys/values : + ======================================================================== + keys |Value Format |Information + ---------------------------|---------------|---------------------------- + temphighalarm |FLOAT |High Alarm Threshold value of temperature in Celsius. + templowalarm |FLOAT |Low Alarm Threshold value of temperature in Celsius. + temphighwarning |FLOAT |High Warning Threshold value of temperature in Celsius. + templowwarning |FLOAT |Low Warning Threshold value of temperature in Celsius. + vcchighalarm |FLOAT |High Alarm Threshold value of supply voltage in mV. + vcclowalarm |FLOAT |Low Alarm Threshold value of supply voltage in mV. + vcchighwarning |FLOAT |High Warning Threshold value of supply voltage in mV. + vcclowwarning |FLOAT |Low Warning Threshold value of supply voltage in mV. + rxpowerhighalarm |FLOAT |High Alarm Threshold value of received power in dBm. + rxpowerlowalarm |FLOAT |Low Alarm Threshold value of received power in dBm. + rxpowerhighwarning |FLOAT |High Warning Threshold value of received power in dBm. + rxpowerlowwarning |FLOAT |Low Warning Threshold value of received power in dBm. + txpowerhighalarm |FLOAT |High Alarm Threshold value of transmit power in dBm. + txpowerlowalarm |FLOAT |Low Alarm Threshold value of transmit power in dBm. + txpowerhighwarning |FLOAT |High Warning Threshold value of transmit power in dBm. + txpowerlowwarning |FLOAT |Low Warning Threshold value of transmit power in dBm. + txbiashighalarm |FLOAT |High Alarm Threshold value of tx Bias Current in mA. + txbiaslowalarm |FLOAT |Low Alarm Threshold value of tx Bias Current in mA. + txbiashighwarning |FLOAT |High Warning Threshold value of tx Bias Current in mA. + txbiaslowwarning |FLOAT |Low Warning Threshold value of tx Bias Current in mA. + ======================================================================== + """ + dom_info_dict_keys = ['temphighalarm', 'temphighwarning', + 'templowalarm', 'templowwarning', + 'vcchighalarm', 'vcchighwarning', + 'vcclowalarm', 'vcclowwarning', + 'rxpowerhighalarm', 'rxpowerhighwarning', + 'rxpowerlowalarm', 'rxpowerlowwarning', + 'txpowerhighalarm', 'txpowerhighwarning', + 'txpowerlowalarm', 'txpowerlowwarning', + 'txbiashighalarm', 'txbiashighwarning', + 'txbiaslowalarm', 'txbiaslowwarning' + ] + + transceiver_dom_threshold_info_dict = dict.fromkeys( + dom_info_dict_keys, 'N/A') + + path_idx = INDEX_A0H + + self._dom_capability_detect() + if not self.dom_supported: + return transceiver_dom_threshold_info_dict + + if self.sfp_type == QSFP_TYPE: + field_offset = QSFP_UPPER_MEMORY_PAGE03_OFFSET # uppper memory map: Page 03h + Id_field = QSFP_ID_FIELDS + sfpd_obj = sff8436Dom() + elif self.sfp_type == SFP_TYPE: + if self.eeprom_path_list[INDEX_A2H] is not 'n/a': + # lower memory map: A2h (SFP i2c 0x51) + field_offset = SFP_A2H_OFFSET + path_idx = INDEX_A2H + else: + field_offset = 256 + Id_field = SFP_ID_FIELDS + sfpd_obj = sff8472Dom() + else: + return transceiver_dom_threshold_info_dict + + if sfpd_obj is None: + return transceiver_dom_threshold_info_dict + + dom_module_threshold_raw = self._read_eeprom_bytes( + field_offset + Id_field['MODULE_THRESHOLD'][OFFSET], Id_field['MODULE_THRESHOLD'][WIDTH], path_idx) + + if dom_module_threshold_raw is None: + return transceiver_dom_threshold_info_dict + + if self.sfp_type == QSFP_TYPE: + dom_module_threshold_data = sfpd_obj.parse_module_threshold_values( + dom_module_threshold_raw, 0) + + dom_channel_threshold_raw = self._read_eeprom_bytes( + field_offset + Id_field['CHANNEL_THRESHOLD'][OFFSET], Id_field['CHANNEL_THRESHOLD'][WIDTH], path_idx) + + if dom_channel_threshold_raw is None: + return transceiver_dom_threshold_info_dict + + dom_channel_threshold_data = sfpd_obj.parse_channel_threshold_values( + dom_channel_threshold_raw, 0) + + transceiver_dom_threshold_info_dict['rxpowerhighalarm'] = dom_channel_threshold_data['data']['RxPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerhighwarning'] = dom_channel_threshold_data['data']['RxPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowalarm'] = dom_channel_threshold_data['data']['RxPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_channel_threshold_data['data']['RxPowerLowWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerhighalarm'] = dom_channel_threshold_data['data']['TxPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerhighwarning'] = dom_channel_threshold_data['data']['TxPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerlowalarm'] = dom_channel_threshold_data['data']['TxPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerlowwarning'] = dom_channel_threshold_data['data']['TxPowerLowWarning']['value'] + transceiver_dom_threshold_info_dict['txbiashighalarm'] = dom_channel_threshold_data['data']['TxBiasHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiashighwarning'] = dom_channel_threshold_data['data']['TxBiasHighWarning']['value'] + transceiver_dom_threshold_info_dict['txbiaslowalarm'] = dom_channel_threshold_data['data']['TxBiasLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiaslowwarning'] = dom_channel_threshold_data['data']['TxBiasLowWarning']['value'] + else: # SFP_TYPE + dom_module_threshold_data = sfpd_obj.parse_alarm_warning_threshold( + dom_module_threshold_raw, 0) + transceiver_dom_threshold_info_dict['rxpowerhighalarm'] = dom_module_threshold_data['data']['RXPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerhighwarning'] = dom_module_threshold_data['data']['RXPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowalarm'] = dom_module_threshold_data['data']['RXPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_module_threshold_data['data']['RXPowerLowWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerhighalarm'] = dom_module_threshold_data['data']['TXPowerHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerhighwarning'] = dom_module_threshold_data['data']['TXPowerHighWarning']['value'] + transceiver_dom_threshold_info_dict['txpowerlowalarm'] = dom_module_threshold_data['data']['TXPowerLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txpowerlowwarning'] = dom_module_threshold_data['data']['TXPowerLowWarning']['value'] + transceiver_dom_threshold_info_dict['txbiashighalarm'] = dom_module_threshold_data['data']['BiasHighAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiashighwarning'] = dom_module_threshold_data['data']['BiasHighWarning']['value'] + transceiver_dom_threshold_info_dict['txbiaslowalarm'] = dom_module_threshold_data['data']['BiasLowAlarm']['value'] + transceiver_dom_threshold_info_dict['txbiaslowwarning'] = dom_module_threshold_data['data']['BiasLowWarning']['value'] + + transceiver_dom_threshold_info_dict['temphighalarm'] = dom_module_threshold_data['data']['TempHighAlarm']['value'] + transceiver_dom_threshold_info_dict['temphighwarning'] = dom_module_threshold_data['data']['TempHighWarning']['value'] + transceiver_dom_threshold_info_dict['templowalarm'] = dom_module_threshold_data['data']['TempLowAlarm']['value'] + transceiver_dom_threshold_info_dict['templowwarning'] = dom_module_threshold_data['data']['TempLowWarning']['value'] + transceiver_dom_threshold_info_dict['vcchighalarm'] = dom_module_threshold_data['data']['VccHighAlarm']['value'] + transceiver_dom_threshold_info_dict['vcchighwarning'] = dom_module_threshold_data['data']['VccHighWarning']['value'] + transceiver_dom_threshold_info_dict['vcclowalarm'] = dom_module_threshold_data['data']['VccLowAlarm']['value'] + transceiver_dom_threshold_info_dict['vcclowwarning'] = dom_module_threshold_data['data']['VccLowWarning']['value'] + + return transceiver_dom_threshold_info_dict + + def get_reset_status(self): + """ + Retrieves the reset status of SFP + + Returns: + A Boolean, True if reset enabled, False if disabled + """ + raise NotImplementedError + + def get_rx_los(self): + """ + Retrieves the RX LOS (lost-of-signal) status of SFP + + Returns: + A Boolean, True if SFP has RX LOS, False if not. + Note : RX LOS status is latched until a call to get_rx_los or a reset. + """ + raise NotImplementedError + + def get_tx_fault(self): + """ + Retrieves the TX fault status of SFP + + Returns: + A Boolean, True if SFP has TX fault, False if not + Note : TX fault status is lached until a call to get_tx_fault or a reset. + """ + raise NotImplementedError + + def get_tx_disable(self): + """ + Retrieves the tx_disable status of this SFP + + Returns: + A Boolean, True if tx_disable is enabled, False if disabled + """ + raise NotImplementedError + + def get_tx_disable_channel(self): + """ + Retrieves the TX disabled channels in this SFP + + Returns: + A hex of 4 bits (bit 0 to bit 3 as channel 0 to channel 3) to represent + TX channels which have been disabled in this SFP. + As an example, a returned value of 0x5 indicates that channel 0 + and channel 2 have been disabled. + """ + raise NotImplementedError + + def get_lpmode(self): + """ + Retrieves the lpmode (low power mode) status of this SFP + + Returns: + A Boolean, True if lpmode is enabled, False if disabled + """ + if self.lp_file is not None: + data = self.__read_attr_file(self.lp_file, 0) + if data is not None: + if int(data) == 1: + return True + return False + + def get_power_override(self): + """ + Retrieves the power-override status of this SFP + + Returns: + A Boolean, True if power-override is enabled, False if disabled + """ + + if self.sfp_type == QSFP_TYPE: + Id_field = QSFP_ID_FIELDS + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return False + + dom_control_raw = self._read_eeprom_bytes( + Id_field['CONTROL'][OFFSET], Id_field['CONTROL'][WIDTH], INDEX_A0H) + if dom_control_raw is not None: + dom_control_data = sfpd_obj.parse_control_bytes( + dom_control_raw, 0) + return ('On' == dom_control_data['data']['PowerOverride']) + + return False + else: + return NotImplementedError + + def get_temperature(self): + """ + Retrieves the temperature of this SFP + + Returns: + An integer number of current temperature in Celsius + """ + path_idx = INDEX_A0H + + if self.sfp_type == QSFP_TYPE: + field_offset = 0 # lower memory map: A0h + Id_field = QSFP_ID_FIELDS + sfpd_obj = sff8436Dom() + elif self.sfp_type == SFP_TYPE: + # lower memory map: A2h (SFP i2c 0x51) + field_offset = SFP_A2H_OFFSET + Id_field = SFP_ID_FIELDS + path_idx = INDEX_A2H + sfpd_obj = sff8472Dom() + else: + return None + + if sfpd_obj is None: + return None + + dom_temperature_raw = self._read_eeprom_bytes( + field_offset + Id_field['TEMPERATURE'][OFFSET], Id_field['TEMPERATURE'][WIDTH], path_idx) + if dom_temperature_raw is not None: + dom_temperature_data = sfpd_obj.parse_temperature( + dom_temperature_raw, 0) + temp = self._convert_string_to_num( + dom_temperature_data['data']['Temperature']['value']) + return temp + + return None + + def get_voltage(self): + """ + Retrieves the supply voltage of this SFP + + Returns: + An integer number of supply voltage in mV + """ + path_idx = INDEX_A0H + if self.sfp_type == QSFP_TYPE: + field_offset = 0 # lower memory map: A0h + Id_field = QSFP_ID_FIELDS + sfpd_obj = sff8436Dom() + elif self.sfp_type == SFP_TYPE: + # lower memory map: A2h (SFP i2c 0x51) + field_offset = SFP_A2H_OFFSET + Id_field = SFP_ID_FIELDS + path_idx = INDEX_A2H + sfpd_obj = sff8472Dom() + else: + return None + + if sfpd_obj is None: + return None + + dom_voltage_raw = self._read_eeprom_bytes( + field_offset + Id_field['VOLTAGE'][OFFSET], Id_field['VOLTAGE'][WIDTH], path_idx) + if dom_voltage_raw is not None: + dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) + volt = self._convert_string_to_num( + dom_voltage_data['data']['Vcc']['value']) + return volt + + return None + + def get_tx_bias(self): + """ + Retrieves the TX bias current of this SFP + + Returns: + A list of four integer numbers, representing TX bias in mA + for channel 0 to channel 4. + Ex. ['110.09', '111.12', '108.21', '112.09'] + """ + path_idx = INDEX_A0H + tx_bias_list = [] + + if self.sfp_type == QSFP_TYPE: + field_offset = 0 # lower memory map: A0h + Id_field = QSFP_ID_FIELDS + sfpd_obj = sff8436Dom() + elif self.sfp_type == SFP_TYPE: + # lower memory map: A2h (SFP i2c 0x51) + field_offset = SFP_A2H_OFFSET + Id_field = SFP_ID_FIELDS + path_idx = INDEX_A2H + sfpd_obj = sff8472Dom() + else: + return None + + if sfpd_obj is None: + return None + + dom_channel_monitor_raw = self._read_eeprom_bytes( + field_offset + Id_field['CHANNEL_MON'][OFFSET], Id_field['CHANNEL_MON'][WIDTH], path_idx) + if dom_channel_monitor_raw is not None: + if self.sfp_type == QSFP_TYPE: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power( + dom_channel_monitor_raw, 0) + tx_bias_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX1Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX2Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX3Bias']['value'])) + tx_bias_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX4Bias']['value'])) + + else: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params( + dom_channel_monitor_raw, 0) + tx_bias_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TXBias']['value'])) + + return tx_bias_list + + return None + + def get_rx_power(self): + """ + Retrieves the received optical power for this SFP + + Returns: + A list of four integer numbers, representing received optical + power in mW for channel 0 to channel 4. + Ex. ['1.77', '1.71', '1.68', '1.70'] + """ + path_idx = INDEX_A0H + rx_power_list = [] + + if self.sfp_type == QSFP_TYPE: + field_offset = 0 # lower memory map: A0h + Id_field = QSFP_ID_FIELDS + sfpd_obj = sff8436Dom() + elif self.sfp_type == SFP_TYPE: + # lower memory map: A2h (SFP i2c 0x51) + field_offset = SFP_A2H_OFFSET + Id_field = SFP_ID_FIELDS + path_idx = INDEX_A2H + sfpd_obj = sff8472Dom() + else: + return None + + if sfpd_obj is None: + return None + + dom_channel_monitor_raw = self._read_eeprom_bytes( + field_offset + Id_field['CHANNEL_MON'][OFFSET], Id_field['CHANNEL_MON'][WIDTH], path_idx) + if dom_channel_monitor_raw is not None: + if self.sfp_type == QSFP_TYPE: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power( + dom_channel_monitor_raw, 0) + rx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['RX1Power']['value'])) + rx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['RX2Power']['value'])) + rx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['RX3Power']['value'])) + rx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['RX4Power']['value'])) + + else: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params( + dom_channel_monitor_raw, 0) + rx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['RXPower']['value'])) + + return rx_power_list + + return None + + def get_tx_power(self): + """ + Retrieves the TX power of this SFP + + Returns: + A list of four integer numbers, representing TX power in mW + for channel 0 to channel 4. + Ex. ['1.86', '1.86', '1.86', '1.86'] + """ + path_idx = INDEX_A0H + tx_power_list = [] + + if self.sfp_type == QSFP_TYPE: + field_offset = 0 # lower memory map: A0h + Id_field = QSFP_ID_FIELDS + sfpd_obj = sff8436Dom() + elif self.sfp_type == SFP_TYPE: + # lower memory map: A2h (SFP i2c 0x51) + field_offset = SFP_A2H_OFFSET + Id_field = SFP_ID_FIELDS + path_idx = INDEX_A2H + sfpd_obj = sff8472Dom() + else: + return None + + if sfpd_obj is None: + return None + + dom_channel_monitor_raw = self._read_eeprom_bytes( + field_offset + Id_field['CHANNEL_MON'][OFFSET], Id_field['CHANNEL_MON'][WIDTH], path_idx) + if dom_channel_monitor_raw is not None: + if self.sfp_type == QSFP_TYPE: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power( + dom_channel_monitor_raw, 0) + tx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX1Power']['value'])) + tx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX2Power']['value'])) + tx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX3Power']['value'])) + tx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TX4Power']['value'])) + + else: + dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params( + dom_channel_monitor_raw, 0) + tx_power_list.append(self._convert_string_to_num( + dom_channel_monitor_data['data']['TXPower']['value'])) + + return tx_power_list + + return None + + def reset(self): + """ + Reset SFP and return all user module settings to their default srate. + + Returns: + A boolean, True if successful, False if not + """ + if self.reset_file is not None: + ret = self.__write_attr_file(self.reset_file, '1') + if ret != 0: + return True + return False + + def tx_disable(self, tx_disable): + """ + Disable SFP TX for all channels + + Args: + tx_disable : A Boolean, True to enable tx_disable mode, False to disable + tx_disable mode. + + Returns: + A boolean, True if tx_disable is set successfully, False if not + """ + return False + + def tx_disable_channel(self, channel, disable): + """ + Sets the tx_disable for specified SFP channels + + Args: + channel : A hex of 4 bits (bit 0 to bit 3) which represent channel 0 to 3, + e.g. 0x5 for channel 0 and channel 2. + disable : A boolean, True to disable TX channels specified in channel, + False to enable + + Returns: + A boolean, True if successful, False if not + """ + return False + + def set_lpmode(self, lpmode): + """ + Sets the lpmode (low power mode) of SFP + + Args: + lpmode: A Boolean, True to enable lpmode, False to disable it + Note : lpmode can be overridden by set_power_override + + Returns: + A boolean, True if lpmode is set successfully, False if not + """ + if self.lp_file is not None: + if lpmode is True: + ret = self.__write_attr_file(self.lp_file, "1") + else: + ret = self.__write_attr_file(self.lp_file, "0") + if ret != 0: + return True + return False + + def set_power_override(self, power_override, power_set): + """ + Sets SFP power level using power_override and power_set + + Args: + power_override : + A Boolean, True to override set_lpmode and use power_set + to control SFP power, False to disable SFP power control + through power_override/power_set and use set_lpmode + to control SFP power. + power_set : + Only valid when power_override is True. + A Boolean, True to set SFP to low power mode, False to set + SFP to high power mode. + + Returns: + A boolean, True if power-override and power_set are set successfully, + False if not + """ + return False diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/thermal.py b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/thermal.py new file mode 100644 index 000000000000..8d1bb949f3e0 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/thermal.py @@ -0,0 +1,201 @@ +############################################################################# +# +# Module contains an implementation of SONiC Platform Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +try: + from sonic_py_common.logger import Logger + from sonic_platform_base.thermal_base import ThermalBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +logger = Logger("thermal") + + +class Thermal(ThermalBase): + """Platform-specific Thermal class""" + + def __init__(self, index, name, sysfile_path, is_bmc, support_mask=0x1, ext_sysfile_list=None): + # index is used to indicate the temp{} under sffile_path + # support_mask: 1:support 0:not support + # bit 0 : temperature (always 1) + # bit 1 : high threshold + # bit 2 : low threshold + # bit 3 : high critical threshold + # bit 4 : low critical threshold + # bit 7 : cpu internal sensor + # ext_sysfile_list: each specified path of each supported function, + # which not follows the general naming rule + + self.index = index + self.name = name + self.filepath = sysfile_path + self.support_mask = support_mask + self.is_bmc = is_bmc + + self.temperature_file = None + self.high_thershold_file = None + self.low_threshold_file = None + self.high_critical_file = None + self.low_critical_file = None + + if sysfile_path is None: + return + + if self.is_bmc == False or support_mask & 0x80 == 0x80: + if support_mask & 0x1: + self.temperature_file = \ + sysfile_path + "/temp{}_input".format(self.index) + if support_mask & 0x2: + self.high_thershold_file = \ + sysfile_path + "/temp{}_max".format(self.index) + if support_mask & 0x4: + self.low_threshold_file = \ + sysfile_path + "/temp{}_min".format(self.index) + if support_mask & 0x8: + self.high_critical_file = \ + sysfile_path + "/temp{}_crit".format(self.index) + if support_mask & 0x10: + self.low_critical_file = \ + sysfile_path + "/temp{}_lcrit".format(self.index) + elif self.is_bmc and ext_sysfile_list is not None: + if support_mask & 0x1: + self.temperature_file = \ + sysfile_path + ext_sysfile_list[self.index][0] + if support_mask & 0x2: + self.high_thershold_file = \ + sysfile_path + ext_sysfile_list[self.index][1] + if support_mask & 0x4: + self.low_threshold_file = \ + sysfile_path + ext_sysfile_list[self.index][2] + if support_mask & 0x8: + self.high_critical_file = \ + sysfile_path + ext_sysfile_list[self.index][3] + if support_mask & 0x10: + self.low_critical_file = \ + sysfile_path + ext_sysfile_list[self.index][4] + + def __read_attr_file(self, filepath, line=0xFF): + try: + with open(filepath, 'r') as fd: + if line == 0xFF: + data = fd.read() + return data.rstrip('\r\n') + else: + data = fd.readlines() + return data[line].rstrip('\r\n') + except Exception as ex: + logger.log_error( + "Unable to open {} due to {}".format(filepath, repr(ex))) + + return None + + def get_name(self): + return self.name + + def get_presence(self): + return True + + def get_temperature(self): + """ + Retrieves current temperature reading from thermal + + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + if self.temperature_file is not None: + temp = self.__read_attr_file(self.temperature_file) + if temp is not None: + return float(temp) / 1000 + + return None + + def get_high_threshold(self): + """ + Retrieves the high threshold temperature of thermal + + Returns: + A float number, the high threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.high_thershold_file is not None: + temp = self.__read_attr_file(self.high_thershold_file) + if temp is not None: + return float(temp) / 1000 + + return None + + def get_low_threshold(self): + """ + Retrieves the low threshold temperature of thermal + + Returns: + A float number, the low threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.low_threshold_file is not None: + temp = self.__read_attr_file(self.low_threshold_file) + if temp is not None: + return float(temp) / 1000 + + return None + + def set_high_threshold(self, temperature): + """ + Sets the high threshold temperature of thermal + + Args : + temperature: A float number up to nearest thousandth of one degree Celsius, + e.g. 30.125 + + Returns: + A boolean, True if threshold is set successfully, False if not + """ + return False + + def set_low_threshold(self, temperature): + """ + Sets the low threshold temperature of thermal + + Args : + temperature: A float number up to nearest thousandth of one degree Celsius, + e.g. 30.125 + + Returns: + A boolean, True if threshold is set successfully, False if not + """ + return False + + def get_high_critical_threshold(self): + """ + Retrieves the high critical threshold temperature of thermal + + Returns: + A float number, the high critical threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.high_critical_file is not None: + temp = self.__read_attr_file(self.high_critical_file) + if temp is not None: + return float(temp) / 1000 + + return None + + def get_low_critical_threshold(self): + """ + Retrieves the low critical threshold temperature of thermal + + Returns: + A float number, the low critical threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.low_critical_file is not None: + temp = self.__read_attr_file(self.low_critical_file) + if temp is not None: + return float(temp) / 1000 + + return None diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/templates/netberg_aurora-715_util.py.j2 b/platform/innovium/sonic-platform-modules-netberg/aurora-715/templates/netberg_aurora-715_util.py.j2 new file mode 100755 index 000000000000..c71aa4a0322b --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/templates/netberg_aurora-715_util.py.j2 @@ -0,0 +1,408 @@ +#!/usr/bin/env python + + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes + show : show all systen status + sff : dump SFP eeprom + set : change board setting with fan|led|sfp +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +import json + +PROJECT_NAME = 'aurora_715' +verbose = False +DEBUG = False +FORCE = 0 + +# default is 'i2c-0', we will choose the correct one from 'i2c-0' and 'i2c-1'. +#DEFAULT_BASE_BUS = 'i2c-0' +I2C_PREFIX = '/sys/bus/i2c/devices/' +BASE_BUS = 'i2c-0' +BASE_BUS_PATH = I2C_PREFIX + BASE_BUS + +#I2C_BASE_BUS = { +# 'i2c-0':{ +# 'path':'/sys/bus/i2c/devices/i2c-0', +# 'status':'INSTALLED' +# } +#} + +switch_install_order = [ +# 'PCA9548_0x73', +'PCA9548_0x71_1', +'PCA9548_0x71_2', +'PCA9548_0x71_3', +'PCA9548_0x71_4' +# 'PCA9548_0x75' +] + +I2C_SWITCH_LIST = { + # i2c switches + 'PCA9548_0x73': { + 'parent':BASE_BUS, + 'driver':'pca9548', + 'i2caddr': '0x73', + 'path': '/sys/bus/i2c/devices/0-0073', + 'bus_map': [1,2,3,4,5,6,7,8], + 'status':'NOTINST' + }, + #'PCA9548_0x75': { + # 'parent':BASE_BUS, + # 'driver':'pca9548', + # 'i2caddr': '0x75', + # 'path': ' ', + # 'bus_map': [0,0,0,0,0,0,0,0], + # 'status':'NOTINST' + #}, + 'PCA9548_0x71_1': { + 'parent':'PCA9548_0x73', + 'parent_ch': 4, + 'driver':'pca9548', + 'i2caddr': '0x71', + 'path': '/sys/bus/i2c/devices/5-0071', + 'bus_map': [9,10,11,12,13,14,15,16], + 'status':'NOTINST' + }, + 'PCA9548_0x71_2': { + 'parent':'PCA9548_0x73', + 'parent_ch': 5, + 'driver':'pca9548', + 'i2caddr': '0x71', + 'path': '/sys/bus/i2c/devices/6-0071', + 'bus_map': [17,18,19,20,21,22,23,24], + 'status':'NOTINST' + }, + 'PCA9548_0x71_3': { + 'parent':'PCA9548_0x73', + 'parent_ch': 6, + 'driver':'pca9548', + 'i2caddr': '0x71', + 'path': '/sys/bus/i2c/devices/7-0071', + 'bus_map': [25,26,27,28,29,30,31,32], + 'status':'NOTINST' + }, + 'PCA9548_0x71_4': { + 'parent':'PCA9548_0x73', + 'parent_ch': 7, + 'driver':'pca9548', + 'i2caddr': '0x71', + 'path': '/sys/bus/i2c/devices/8-0071', + 'bus_map': [33,34,35,36,37,38,39,40], + 'status':'NOTINST' + } +} + +I2C_DEVICES = { + # NCT7511Y sensor & fan control + 'NCT7511Y(U73)': { + 'parent':'PCA9548_0x75', + 'parent_ch': 0, + 'driver':'nct7511', + 'i2caddr': '0x2e', + 'path': ' ', + 'status':'NOTINST' + }, + # G781 sensors + 'G781(U94)': { + 'parent':'PCA9548_0x75', + 'parent_ch': 1, + 'driver':'g781', + 'i2caddr': '0x4c', + 'path': ' ', + 'status':'NOTINST' + }, + 'G781(U4)': { + 'parent':'PCA9548_0x75', + 'parent_ch': 2, + 'driver':'g781', + 'i2caddr': '0x4c', + 'path': ' ', + 'status':'NOTINST' + }, + 'G781(U34)': { + 'parent':'PCA9548_0x75', + 'parent_ch': 3, + 'driver':'g781', + 'i2caddr': '0x4c', + 'path': ' ', + 'status':'NOTINST' + }, + # PSU + 'PSU1': { + 'parent':'PCA9548_0x75', + 'parent_ch': 4, + 'driver':'zrh2800k2', + 'i2caddr': '0x58', + 'path': ' ', + 'status':'NOTINST' + }, + 'PSU2': { + 'parent':'PCA9548_0x75', + 'parent_ch': 4, + 'driver':'zrh2800k2', + 'i2caddr': '0x59', + 'path': ' ', + 'status':'NOTINST' + }, + 'TPS53681(0x6C)': { + 'parent':'PCA9548_0x75', + 'parent_ch': 5, + 'driver':'tps53679', + 'i2caddr': '0x6c', + 'path': ' ', + 'status':'NOTINST' + }, + 'TPS53681(0x6E)': { + 'parent':'PCA9548_0x75', + 'parent_ch': 5, + 'driver':'tps53679', + 'i2caddr': '0x6e', + 'path': ' ', + 'status':'NOTINST' + }, + 'TPS53681(0x70)': { + 'parent':'PCA9548_0x75', + 'parent_ch': 5, + 'driver':'tps53679', + 'i2caddr': '0x70', + 'path': ' ', + 'status':'NOTINST' + } +} + +SFP_GROUPS = { + 'SFP-G01' :{ + 'number': 8, + 'parent':'PCA9548_0x71_1', + 'channels':[0,1,2,3,4,5,6,7], + 'driver':'optoe1', + 'i2caddr': '0x50', + 'paths': [], + 'status':'NOTINST' + }, + 'SFP-G02' :{ + 'number': 8, + 'parent':'PCA9548_0x71_2', + 'channels':[0,1,2,3,4,5,6,7], + 'driver':'optoe1', + 'i2caddr': '0x50', + 'paths': [], + 'status':'NOTINST' + }, + 'SFP-G03' :{ + 'number': 8, + 'parent':'PCA9548_0x71_3', + 'channels':[0,1,2,3,4,5,6,7], + 'driver':'optoe1', + 'i2caddr': '0x50', + 'paths': [], + 'status':'NOTINST' + }, + 'SFP-G04' :{ + 'number': 8, + 'parent':'PCA9548_0x71_4', + 'channels':[0,1,2,3,4,5,6,7], + 'driver':'optoe1', + 'i2caddr': '0x50', + 'paths': [], + 'status':'NOTINST' + } +} + + + +def main(): + global DEBUG + global args + global FORCE + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + for opt, arg in options: + if opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + elif arg == 'clean': + do_uninstall() + elif arg == 'version': + show_version() + + return 0 + +def show_version(): + print("platform driver version: {}\n".format(PLATFORM_DRIVER_VER)) + +def driver_check(): + with open('/proc/modules') as modules: + return 'x86_64_netberg_aurora' in modules.read() + +def driver_install(): + print("Probbing modules...") + os.system('modprobe i2c_dev') + os.system('modprobe x86-64-netberg-aurora-715') + os.system('modprobe i2c_mux_pca954x force_deselect_on_exit=1') + + return 0 + + +def driver_uninstall(): + os.system('rmmod i2c_mux_pca954x') + os.system('rmmod x86-64-netberg-aurora-715') + os.system('rmmod i2c_dev') + + return 0 + +def install_i2c_switch(): + + print("Init root I2C switch...") + + root_sw = I2C_SWITCH_LIST['PCA9548_0x73'] + os.system("echo {} {} > {}/new_device".format(root_sw['driver'], root_sw['i2caddr'], BASE_BUS_PATH)) + # make sure the root switch for sfp is installed + time.sleep(2) + + + for switch_name in switch_install_order: + switch = I2C_SWITCH_LIST[switch_name] + + install_path = I2C_SWITCH_LIST[switch['parent']]['path'] + install_path = install_path+"/channel-{}".format(switch['parent_ch']) + + cmd = "echo {} {} > {}/new_device".format(switch['driver'], switch['i2caddr'], install_path) + print(cmd) + os.system(cmd) + +def install_sfp(): + for sfp_group_name in SFP_GROUPS.keys(): + sfp_group = SFP_GROUPS[sfp_group_name] + install_path = I2C_SWITCH_LIST[sfp_group['parent']]['path'] + + for n in range(0,sfp_group['number']): + sfp_install_path = install_path+"/channel-{}".format(sfp_group['channels'][n]) + cmd = "echo {} {} > {}/new_device".format(sfp_group['driver'], sfp_group['i2caddr'], sfp_install_path) + print(cmd) + os.system(cmd) + + # sfp_group['paths'].append("/sys/bus/i2c/devices/{}-00{}".format(I2C_SWITCH_LIST[sfp_group['parent']]['bus_map'][sfp_group['channels'][n]],sfp_group['i2caddr'][-2:])) + print("/sys/bus/i2c/devices/{}-00{}".format(I2C_SWITCH_LIST[sfp_group['parent']]['bus_map'][sfp_group['channels'][n]],sfp_group['i2caddr'][-2:])) + + +def uninstall_sfp(): + for sfp_group_name in SFP_GROUPS.keys(): + sfp_group = SFP_GROUPS[sfp_group_name] + + uninst_path = I2C_SWITCH_LIST[sfp_group['parent']]['path'] + + for n in range(0,sfp_group['number']): + sfp_uninst_path = uninst_path+"/channel-{}".format(sfp_group['channels'][n]) + cmd = "echo {} > {}/delete_device".format(sfp_group['i2caddr'], sfp_uninst_path) + print(cmd) + os.system(cmd) + +def uninstall_i2c_switch(): + for switch_name in reversed(switch_install_order): + switch = I2C_SWITCH_LIST[switch_name] + uninst_path = I2C_SWITCH_LIST[switch['parent']]['path'] + "/channel-{}".format(switch['parent_ch']) + + cmd = "echo {} > {}/delete_device".format(switch['i2caddr'], uninst_path) + + print(cmd) + os.system(cmd) + + print("Uninstall root switch...") + root_sw = I2C_SWITCH_LIST['PCA9548_0x73'] + cmd = "echo {} > {}/delete_device".format(root_sw['i2caddr'], BASE_BUS_PATH) + print(cmd) + os.system(cmd) + +def set_led_control(): + cmd = "echo 1 > /sys/class/hwmon/hwmon2/device/NBA715_LED/led_fiber" + print(cmd) + os.system(cmd) + +def device_install(): + print('Base bus is {}'.format(BASE_BUS)) + + set_led_control() + + install_i2c_switch() + # delay to make sure all switches are installed completely, + time.sleep(1) + + # install_i2c_device() + + install_sfp() + return 0 + +def device_uninstall(): + global SFP_GROUPS + # global I2C_DEVICES + global I2C_SWITCH_LIST + + uninstall_sfp() +# uninstall_i2c_device() + uninstall_i2c_switch() + return 0 + +def do_install(): + print("Drivers installing....") + status = driver_install() + print("Devices installing....") + status = device_install() + return + + +def do_uninstall(): + print "Checking system...." + if not device_exist(): + print PROJECT_NAME.upper() + " has no device installed...." + else: + print "Removing device...." + status = device_uninstall() + if status: + + if FORCE == 0: + return status + + if driver_check() == False: + print PROJECT_NAME.upper() + " has no driver installed...." + else: + print "Removing installed driver...." + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + return + +def device_exist(): + print("Checking devices... ") + return os.path.isdir("/sys/bus/i2c/devices/0-0056/") + + +if __name__ == "__main__": + main() diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/utils/halt b/platform/innovium/sonic-platform-modules-netberg/aurora-715/utils/halt new file mode 100755 index 000000000000..eca0b5c1ad3e --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/utils/halt @@ -0,0 +1,18 @@ +#!/bin/sh + +mr_reboot() { + + sudo rmmod x86-64-netberg-aurora-715 + sudo i2cset -y 0 0x30 0xa1 0 + +} + +if [ $# -eq 0 ] || [ $@ = "--halt" ] || [ $@ = "-f" ] || [ $@ = "--force" ]; then + sudo /sbin/halt +elif [ $@ = "-p" ] || [ $@ = "--reboot" ] || [ $@ = "--poweroff" ]; then + sync;sync + mr_reboot +else + echo "unsupported option" +fi + diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/utils/netberg_nba715_platform.sh b/platform/innovium/sonic-platform-modules-netberg/aurora-715/utils/netberg_nba715_platform.sh new file mode 100755 index 000000000000..27e497435111 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/utils/netberg_nba715_platform.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Install aurora-715 python package +DEVICE="/usr/share/sonic/device" +PLATFORM=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) + +if [ -e $DEVICE/$PLATFORM/sonic_platform-1.0-py3-none-any.whl ]; then + pip install $DEVICE/$PLATFORM/sonic_platform-1.0-py3-none-any.whl +fi + diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/utils/netberg_nba715_sensors.py b/platform/innovium/sonic-platform-modules-netberg/aurora-715/utils/netberg_nba715_sensors.py new file mode 100755 index 000000000000..bac1550af401 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/utils/netberg_nba715_sensors.py @@ -0,0 +1,281 @@ +#!/usr/bin/python + +from __future__ import print_function +import os +import sys +import logging + +MAX_FAN_NUM = 5 +MAX_PSU_NUM = 2 +PSU_LIST = ['PSU1', 'PSU2'] # 0x58, 0x59 + +THERMAL_SENSOR_LIST = ['NCT7511Y(U73)', 'G781(U94)', 'G781(U34)', 'G781(U4)'] + +BMC_SYSFILE_PATH = '/sys/class/hwmon/hwmon2/device/NBA715_SYS/' +FAN_SYSFILE_PATH = '/sys/class/hwmon/hwmon2/device/NBA715_FAN/' +POWER_SYSFILE_PATH = '/sys/class/hwmon/hwmon2/device/NBA715_POWER/' +THERMAL_SYSFILE_PATH = '/sys/class/hwmon/hwmon2/device/NBA715_THERMAL/' + + +def get_thermal_sensor_path(): + sensor_path = [] + try: + with open(PLATFORM_INSTALL_INFO_FILE) as fd: + install_info = json.load(fd) + for sensor_name in THERMAL_SENSOR_LIST: + sensor = install_info[1][sensor_name] + sensor_path.append(sensor['hwmon_path']+'/') + return sensor_path + except Exception: + print("Fail to get sensor sysfsfile path") + + return sensor_path + +# Get sysfs attribute + + +def get_attr_value(attr_path): + retval = 'ERR' + if not os.path.isfile(attr_path): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + fd.close() + return retval + + +def print_attr_value_lines(sys_path): + retval = 'ERR' + if not os.path.isfile(sys_path): + return retval + try: + fo = open(sys_path, "r") + except Exception as error: + logging.error("Unable to open ", sys_path, " file !") + for line in fo.readlines(): + line = line.strip() + print(" %s" % line) + fo.close() + return retval + + +def show_sensor_table(): + + headers = ['Sensor', 'Temperature', 'High', + 'Low', 'Critical High', 'Critical Low'] + table = list() + temp = list() + + sensor_table = [ + ['Right Bottom Front', 'temp_r_b_f', 'temp_r_b_f_max', + 'temp_r_b_f_min', 'temp_r_b_f_crit', 'temp_r_b_f_lcrit'], + ['Right Bottom Back', 'temp_r_b_b', 'temp_r_b_b_max', + 'temp_r_b_b_min', 'temp_r_b_b_crit', 'temp_r_b_b_lcrit'], + ['Left Bottom Front', 'temp_l_b_f', 'temp_l_b_f_max', + 'temp_l_b_f_min', 'temp_l_b_f_crit', 'temp_l_b_f_lcrit'], + ['Left Bottom Back', 'temp_l_b_b', 'temp_l_b_b_max', + 'temp_l_b_b_min', 'temp_l_b_b_crit', 'temp_l_b_b_lcrit'], + ['Right Top Front', 'temp_r_t_f', 'temp_r_t_f_max', + 'temp_r_t_f_min', 'temp_r_t_f_crit', 'temp_r_t_f_lcrit'], + ['Right Top Back Sensor', 'temp_r_t_b', 'temp_r_t_b_max', + 'temp_r_t_b_min', 'temp_r_t_b_crit', 'temp_r_t_b_lcrit'], + ['Left Top Front Sensor', 'temp_l_t_f', 'temp_l_t_f_max', + 'temp_l_t_f_min', 'temp_l_t_f_crit', 'temp_l_t_f_lcrit'], + ['Left Top Back Sensor', 'temp_l_t_b', 'temp_l_t_b_max', + 'temp_l_t_b_min', 'temp_l_t_b_crit', 'temp_l_t_b_lcrit'], + ] + + for index in range(len(sensor_table)): + name = sensor_table[index][0] + for x in range(0, 5): + sys_path = THERMAL_SYSFILE_PATH + sensor_table[index][x+1] + t = get_attr_value(sys_path) + if t == 'ERR': + temp.append('N/A') + else: + if t.isdigit(): + t = int(t)/1000.0 + temp.append('{} C'.format(t)) + + table.append([name, temp[0], temp[1], temp[2], temp[3], temp[4]]) + del temp[:] + print(headers) + print(table) + print('') + + +def show_fan_table(): + print(*['Fan', 'Speed', 'Presence', 'Status', 'Power'], sep='\t') + + for index in range(1, MAX_FAN_NUM+1): + name_front = "FAN{}-Front".format(index) + name_rear = "FAN{}-Rear".format(index) + speed_front, speed_rear = fan_speed_dual(index) + present = fan_present(index) + status = fan_status(index) + power = fan_power(index) + print(*[name_front, speed_front, present, status, power], sep='\t') + print(*[name_rear, speed_front, present, status, power], sep='\t') + + print('') + + +def fan_status(index): + sys_path = FAN_SYSFILE_PATH + 'fan{}_stat'.format(index) + ret = get_attr_value(sys_path) + if ret == '1': + return 'OK' + elif ret == '0': + return 'NG' + else: + return 'N/A' + + +def fan_present(index): + sys_path = FAN_SYSFILE_PATH + 'fan{}_present'.format(index) + ret = get_attr_value(sys_path) + if ret == '1': + return 'Present' + elif ret == '0': + return 'Not Present' + else: + return 'N/A' + + +def fan_power(index): + sys_path = FAN_SYSFILE_PATH + 'fan{}_power'.format(index) + ret = get_attr_value(sys_path) + if ret == '1': + return 'On' + elif ret == '0': + return 'Off' + else: + return 'N/A' + + +def fan_speed_dual(index): + sys_path = FAN_SYSFILE_PATH + 'fan{}_front_rpm'.format(index) + front_ret = get_attr_value(sys_path) + if front_ret == 'ERR': + front_ret = 'N/A' + else: + front_ret = front_ret+'RPM' + + sys_path = FAN_SYSFILE_PATH + 'fan{}_rear_rpm'.format(index) + rear_ret = get_attr_value(sys_path) + if rear_ret == 'ERR': + rear_ret = 'N/A' + else: + rear_ret = rear_ret+'RPM' + + return (front_ret, rear_ret) + + +def is_psu_present(psu_number): + sys_path = POWER_SYSFILE_PATH + 'psu{}_prnt'.format(psu_number) + if os.path.exists(sys_path): + value = get_attr_value(sys_path) + if value == '1': + return True + else: + return False + + return False + + +def is_psu_power_up(psu_number): + sys_path = POWER_SYSFILE_PATH + 'psu{}_good'.format(psu_number) + if os.path.exists(sys_path): + value = get_attr_value(sys_path) + if value == '1': + return True + else: + return False + + return False + + +def show_psu_table(): + headers = ['PSU', 'Presence', 'Power', 'Fan Speed(RPM)', 'Temperature(C)', + 'Vin(V)', 'Vout(V)', 'Pin(W)', 'Pout(W)', 'Iin(A)', 'Iout(A)', 'Max Iout(A)'] + table = [] + psu_sysfiles_list = [] + + for index in range(0, MAX_PSU_NUM): + psu_sysfiles_list = [ + POWER_SYSFILE_PATH+'psu{}_fan_speed'.format(index+1), + POWER_SYSFILE_PATH+'psu{}_temp'.format(index+1), + POWER_SYSFILE_PATH+'psu{}_vin'.format(index+1), + POWER_SYSFILE_PATH+'psu{}_vout'.format(index+1), + POWER_SYSFILE_PATH+'psu{}_pin'.format(index+1), + POWER_SYSFILE_PATH+'psu{}_pout'.format(index+1), + POWER_SYSFILE_PATH+'psu{}_iin'.format(index+1), + POWER_SYSFILE_PATH+'psu{}_iout'.format(index+1), + POWER_SYSFILE_PATH+'psu{}_mfr_iout_max'.format(index+1) + ] + status_list = get_psu_status(index+1, psu_sysfiles_list) + table.append(status_list) + + print(headers) + print(table) + print('') + + +def get_psu_status(index, sysfile_list): + # result_list: [name, presence, power, fanSpeed(RPM), temperature(C), vin(V), vout(V), pin(W), pout(W), iin(A), iout(A), maxIout(A)] + name = 'PSU{}'.format(index) + result_list = [name, 'Not Present', 'N/A', 'N/A', 'N/A', + 'N/A', 'N/A', 'N/A', 'N/A', 'N/A', 'N/A', 'N/A'] + result_mutipler = [None, None, None, None, 1000.0, 1000.0, + 1000.0, 1000000.0, 1000000.0, 1000.0, 1000.0, 1000.0] + + if is_psu_present(index): + result_list[1] = 'Present' + else: + return result_list + + if is_psu_power_up(index): + result_list[2] = 'up' + else: + result_list[2] = 'down' + + for x in range(0, 9): + result_list[x+3] = get_attr_value(sysfile_list[x]) + + for x in range(0, 12): + if result_mutipler[x] != None and result_list[x] != 'ERR': + result_list[x] = int(result_list[x]) / result_mutipler[x] + + return result_list + + +def main(): + """ + Usage: %(scriptName)s command object + + command: + fan_status : display fans status(present/power good) + """ + + if len(sys.argv) < 2: + print (main.__doc__) + + for arg in sys.argv[1:]: + if arg == 'fan_status': + show_fan_table() + elif arg == 'sensor_status': + show_sensor_table() + show_psu_table() + + else: + print (main.__doc__) + + +if __name__ == "__main__": + main() diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/utils/netberg_nba715_startup b/platform/innovium/sonic-platform-modules-netberg/aurora-715/utils/netberg_nba715_startup new file mode 100755 index 000000000000..31acf66fdb78 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/utils/netberg_nba715_startup @@ -0,0 +1,17 @@ +#!/bin/bash + + +start() { + # load platform driver, native drivers + /usr/local/bin/netberg_aurora-715_util.py install +} + +stop() { + /usr/local/bin/netberg_aurora-715_util.py clean +} + + +case $1 in + start|stop) "$1" ;; +esac + diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/utils/poweroff b/platform/innovium/sonic-platform-modules-netberg/aurora-715/utils/poweroff new file mode 100755 index 000000000000..f905fcc519f8 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/utils/poweroff @@ -0,0 +1,18 @@ +#!/bin/sh + +mr_reboot() { + + sudo rmmod x86-64-netberg-aurora-715 + sudo i2cset -y 0 0x30 0xa1 0 + +} + +if [ $# -eq 0 ] || [ $@ = "-p" ] || [ $@ = "--reboot" ] || [ $@ = "--poweroff" ] || [ $@ = "-f" ] || [ $@ = "--force" ]; then + sync;sync + mr_reboot +elif [ $@ = "--halt" ]; then + sudo halt +else + echo "unsupported option" +fi + diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/utils/shutdown b/platform/innovium/sonic-platform-modules-netberg/aurora-715/utils/shutdown new file mode 100755 index 000000000000..c27ab47408fa --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/utils/shutdown @@ -0,0 +1,18 @@ +#!/bin/sh + +mr_reboot() { + + sudo rmmod x86-64-netberg-aurora-715 + sudo i2cset -y 0 0x31 0xa1 0 + +} + +if [ $# -eq 0 ] || [ $@ = "-r" ] || [ $@ = "--reboot" ] || [ $@ = "-h" ] || [ $@ = "-P" ] || [ $@ = "--poweroff" ]; then + sync;sync + mr_reboot +elif [ $@ = "-H" ] || [ $@ = "--halt" ]; then + sudo halt +else + echo "unsupported option" +fi + diff --git a/platform/innovium/sonic-platform-modules-netberg/debian/changelog b/platform/innovium/sonic-platform-modules-netberg/debian/changelog new file mode 100644 index 000000000000..1e449b28b559 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/debian/changelog @@ -0,0 +1,6 @@ +sonic-netberg-platform-modules (1.0.0) unstable; urgency=low + + * Add support for Netberg Aurora 715 + + -- developer Mon, 29 Jul 2019 11:00:00 +0800 + diff --git a/platform/innovium/sonic-platform-modules-netberg/debian/compat b/platform/innovium/sonic-platform-modules-netberg/debian/compat new file mode 100644 index 000000000000..ec635144f600 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/debian/compat @@ -0,0 +1 @@ +9 diff --git a/platform/innovium/sonic-platform-modules-netberg/debian/control b/platform/innovium/sonic-platform-modules-netberg/debian/control new file mode 100644 index 000000000000..65ba1cd0a625 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/debian/control @@ -0,0 +1,10 @@ +Source: sonic-netberg-platform-modules +Section: main +Priority: extra +Maintainer: support@netbergtw.com +Build-Depends: debhelper (>= 8.0.0), bzip2 +Standards-Version: 3.9.3 + +Package: sonic-platform-netberg-aurora-715 +Architecture: amd64 +Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/innovium/sonic-platform-modules-netberg/debian/netberg_platform_version.sh b/platform/innovium/sonic-platform-modules-netberg/debian/netberg_platform_version.sh new file mode 100755 index 000000000000..17c6ff4cdd76 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/debian/netberg_platform_version.sh @@ -0,0 +1,14 @@ +#! /bin/sh +# driver version + +PLATFROM=$1 +PLATFROM_PATH=$2 + +export PLATFORM_DRIVER_VER='"0.3.16"' + +echo "PLATFORM_DRIVER_VER = $PLATFORM_DRIVER_VER" + +util_name=$(echo $PLATFROM) + +j2 $PLATFROM_PATH/templates/netberg_${util_name}_util.py.j2 -o $PLATFROM_PATH/utils/netberg_${util_name}_util.py +chmod 775 $PLATFROM_PATH/utils/netberg_${util_name}_util.py diff --git a/platform/innovium/sonic-platform-modules-netberg/debian/rules b/platform/innovium/sonic-platform-modules-netberg/debian/rules new file mode 100755 index 000000000000..1f43414f7678 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/debian/rules @@ -0,0 +1,41 @@ +#!/usr/bin/make -f + +export INSTALL_MOD_DIR:=extra + +PYTHON3 ?= python3 + +PACKAGE_PRE_NAME := sonic-platform-netberg +KVERSION ?= $(shell uname -r) +KERNEL_SRC := /lib/modules/$(KVERSION) +MOD_SRC_DIR:= $(shell pwd) +MODULE_DIRS:= aurora-715 +MODULE_DIR := modules + +%: + dh $@ + +override_dh_auto_build: + (for mod in $(MODULE_DIRS); do \ + make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ + if [ -f "$${mod}/setup.py" ]; then \ + rm -rdf build; \ + $(PYTHON3) $${mod}/setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \ + fi;\ + debian/netberg_platform_version.sh $${mod} $(MOD_SRC_DIR)/$${mod}; \ + done) + + +override_dh_auto_install: + (for mod in $(MODULE_DIRS); do \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} /$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko \ + debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + done) + +override_dh_usrlocal: + +override_dh_clean: + dh_clean + (for mod in $(MODULE_DIRS); do \ + make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules clean; \ + done) diff --git a/platform/innovium/sonic-platform-modules-netberg/debian/sonic-platform-netberg-aurora-715.install b/platform/innovium/sonic-platform-modules-netberg/debian/sonic-platform-netberg-aurora-715.install new file mode 100644 index 000000000000..b1ea30a6375b --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/debian/sonic-platform-netberg-aurora-715.install @@ -0,0 +1,4 @@ +aurora-715/scripts/* usr/bin +aurora-715/utils/* usr/local/bin +aurora-715/service/*.service lib/systemd/system +aurora-715/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-netberg_aurora_715-r0 diff --git a/platform/innovium/sonic-platform-modules-netberg/debian/sonic-platform-netberg-aurora-715.postinst b/platform/innovium/sonic-platform-modules-netberg/debian/sonic-platform-netberg-aurora-715.postinst new file mode 100644 index 000000000000..62659fbdc910 --- /dev/null +++ b/platform/innovium/sonic-platform-modules-netberg/debian/sonic-platform-netberg-aurora-715.postinst @@ -0,0 +1,8 @@ +#!/bin/sh + +depmod -a +systemctl enable nba715-platform-init.service +systemctl start nba715-platform-init.service + + +/usr/local/bin/netberg_nba715_platform.sh diff --git a/platform/marvell-arm64/docker-saiserver-mrvl.mk b/platform/marvell-arm64/docker-saiserver-mrvl.mk index c62181300ee0..90bb5ae99405 100644 --- a/platform/marvell-arm64/docker-saiserver-mrvl.mk +++ b/platform/marvell-arm64/docker-saiserver-mrvl.mk @@ -3,9 +3,8 @@ DOCKER_SAISERVER_MRVL = docker-saiserver-mrvl.gz $(DOCKER_SAISERVER_MRVL)_PATH = $(PLATFORM_PATH)/docker-saiserver-mrvl $(DOCKER_SAISERVER_MRVL)_DEPENDS += $(SAISERVER) -$(DOCKER_SAISERVER_MRVL)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH) +$(DOCKER_SAISERVER_MRVL)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_MRVL) -SONIC_STRETCH_DOCKERS += $(DOCKER_SAISERVER_MRVL) $(DOCKER_SAISERVER_MRVL)_CONTAINER_NAME = saiserver $(DOCKER_SAISERVER_MRVL)_RUN_OPT += --privileged -t diff --git a/platform/marvell-arm64/docker-syncd-mrvl-rpc.mk b/platform/marvell-arm64/docker-syncd-mrvl-rpc.mk index c8a94878956f..20698efdf9e3 100644 --- a/platform/marvell-arm64/docker-syncd-mrvl-rpc.mk +++ b/platform/marvell-arm64/docker-syncd-mrvl-rpc.mk @@ -12,13 +12,12 @@ $(DOCKER_SYNCD_MRVL_RPC)_DEPENDS += $(SYNCD_RPC_DBG) \ endif $(DOCKER_SYNCD_MRVL_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL_RPC) -SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_MRVL_RPC) ifeq ($(ENABLE_SYNCD_RPC),y) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL_RPC) endif $(DOCKER_SYNCD_MRVL_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_MRVL_RPC)_VERSION = 1.0.0-rpc +$(DOCKER_SYNCD_MRVL_RPC)_VERSION = 1.0.0+rpc $(DOCKER_SYNCD_MRVL_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/marvell-arm64/docker-syncd-mrvl.mk b/platform/marvell-arm64/docker-syncd-mrvl.mk index 228ca04428bb..39135311ba42 100644 --- a/platform/marvell-arm64/docker-syncd-mrvl.mk +++ b/platform/marvell-arm64/docker-syncd-mrvl.mk @@ -3,17 +3,14 @@ DOCKER_SYNCD_PLATFORM_CODE = mrvl include $(PLATFORM_PATH)/../template/docker-syncd-base.mk -$(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API) +$(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ $(LIBSWSSCOMMON_DBG) \ $(LIBSAIMETADATA_DBG) \ $(LIBSAIREDIS_DBG) -SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) -SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) - $(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 $(DOCKER_SYNCD_BASE)_PACKAGE_NAME = syncd -$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot +#$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 index 6f96738e0d1b..b13346cd70c6 100755 --- a/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 @@ -1,4 +1,5 @@ -FROM docker-config-engine-stretch +{% from "dockers/dockerfile-macros.j2" import install_debian_packages %} +FROM docker-config-engine-buster ARG docker_container_name @@ -20,7 +21,7 @@ RUN apt-get update \ net-tools \ iputils-ping -RUN apt-get -y install libpcap-dev libxml2-dev python-dev swig libsensors4-dev libjemalloc1 nfs-common +RUN apt-get -y install libpcap-dev libxml2-dev python-dev swig libsensors4-dev nfs-common RUN dpkg -i \ {% for deb in docker_syncd_mrvl_debs.split(' ') -%} diff --git a/platform/marvell-arm64/docker-syncd-mrvl/supervisord.conf b/platform/marvell-arm64/docker-syncd-mrvl/supervisord.conf index c4cadf37c602..62a283872483 100644 --- a/platform/marvell-arm64/docker-syncd-mrvl/supervisord.conf +++ b/platform/marvell-arm64/docker-syncd-mrvl/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python2 -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 @@ -13,7 +13,7 @@ events=PROCESS_STATE buffer_size=1024 [eventlistener:supervisor-proc-exit-listener] -command=python2 /usr/bin/supervisor-proc-exit-listener --container-name syncd +command=python3 /usr/bin/supervisor-proc-exit-listener --container-name syncd events=PROCESS_STATE_EXITED,PROCESS_STATE_RUNNING autostart=true autorestart=unexpected diff --git a/platform/marvell-arm64/rules.mk b/platform/marvell-arm64/rules.mk index f8e4c12a49ff..e63059d3ff44 100644 --- a/platform/marvell-arm64/rules.mk +++ b/platform/marvell-arm64/rules.mk @@ -6,8 +6,6 @@ include $(PLATFORM_PATH)/docker-saiserver-mrvl.mk include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/one-image.mk include $(PLATFORM_PATH)/linux-kernel-arm64.mk -INCLUDE_SYSTEM_TELEMETRY = "" - SONIC_ALL += $(SONIC_ONE_IMAGE) \ $(DOCKER_FPM) \ @@ -16,7 +14,7 @@ SONIC_ALL += $(SONIC_ONE_IMAGE) \ # Inject mrvl sai into syncd $(SYNCD)_DEPENDS += $(MRVL_SAI) -$(SYNCD)_UNINSTALLS += $(MRVL_DEV) +$(SYNCD)_UNINSTALLS += $(MRVL_SAI) ifeq ($(ENABLE_SYNCD_RPC),y) $(SYNCD)_DEPENDS += $(LIBSAITHRIFT_DEV) diff --git a/platform/marvell-armhf/docker-saiserver-mrvl.dep b/platform/marvell-armhf/docker-saiserver-mrvl.dep new file mode 100644 index 000000000000..73851b9bf3ec --- /dev/null +++ b/platform/marvell-armhf/docker-saiserver-mrvl.dep @@ -0,0 +1,8 @@ +DPATH := $($(DOCKER_SAISERVER_MRVL)_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/marvell-armhf/docker-saiserver-mrvl.mk platform/marvell-armhf/docker-saiserver-mrvl.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(DPATH)) + +$(DOCKER_SAISERVER_MRVL)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_SAISERVER_MRVL)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_SAISERVER_MRVL)_DEP_FILES := $(DEP_FILES) diff --git a/platform/marvell-armhf/docker-syncd-mrvl-rpc.dep b/platform/marvell-armhf/docker-syncd-mrvl-rpc.dep new file mode 100644 index 000000000000..957d3f9e7ab0 --- /dev/null +++ b/platform/marvell-armhf/docker-syncd-mrvl-rpc.dep @@ -0,0 +1,8 @@ +DPATH := $($(DOCKER_SYNCD_MRVL_RPC)_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_PATH)/docker-syncd-mrvl-rpc.mk $(PLATFORM_PATH)/docker-syncd-mrvl-rpc.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(DPATH)) + +$(DOCKER_SYNCD_MRVL_RPC)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_SYNCD_MRVL_RPC)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_SYNCD_MRVL_RPC)_DEP_FILES := $(DEP_FILES) diff --git a/platform/marvell-armhf/docker-syncd-mrvl-rpc.mk b/platform/marvell-armhf/docker-syncd-mrvl-rpc.mk index efd1e96f3d80..20698efdf9e3 100644 --- a/platform/marvell-armhf/docker-syncd-mrvl-rpc.mk +++ b/platform/marvell-armhf/docker-syncd-mrvl-rpc.mk @@ -17,7 +17,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL_RPC) endif $(DOCKER_SYNCD_MRVL_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_MRVL_RPC)_VERSION = 1.0.0-rpc +$(DOCKER_SYNCD_MRVL_RPC)_VERSION = 1.0.0+rpc $(DOCKER_SYNCD_MRVL_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/marvell-armhf/docker-syncd-mrvl.dep b/platform/marvell-armhf/docker-syncd-mrvl.dep new file mode 100644 index 000000000000..2aaef3b506f9 --- /dev/null +++ b/platform/marvell-armhf/docker-syncd-mrvl.dep @@ -0,0 +1,10 @@ +DPATH := $($(DOCKER_SYNCD_BASE)_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/marvell-armhf/docker-syncd-mrvl.mk platform/marvell-armhf/docker-syncd-mrvl.dep platform/marvell-armhf/sai.mk +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(DPATH)) + +$(DOCKER_SYNCD_BASE)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_SYNCD_BASE)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_SYNCD_BASE)_DEP_FILES := $(DEP_FILES) + +$(eval $(call add_dbg_docker,$(DOCKER_SYNCD_BASE),$(DOCKER_SYNCD_BASE_DBG))) diff --git a/platform/marvell-armhf/libsaithrift-dev.dep b/platform/marvell-armhf/libsaithrift-dev.dep new file mode 100644 index 000000000000..be9da37e8d0a --- /dev/null +++ b/platform/marvell-armhf/libsaithrift-dev.dep @@ -0,0 +1,11 @@ +SPATH := $($(LIBSAITHRIFT_DEV)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/marvell-armhf/libsaithrift-dev.mk platform/marvell-armhf/libsaithrift-dev.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +SMDEP_PATHS := $(SPATH) $(SPATH)/bm/behavioral-model $(SPATH)/test/ptf $(SPATH)/test/saithrift/ctypesgen +$(foreach path, $(SMDEP_PATHS), $(eval $(path) :=$(filter-out $(SMDEP_PATHS),$(addprefix $(path)/, $(shell cd $(path) && git ls-files | grep -Ev " " ))))) + +$(LIBSAITHRIFT_DEV)_CACHE_MODE := GIT_CONTENT_SHA +$(LIBSAITHRIFT_DEV)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(LIBSAITHRIFT_DEV)_DEP_FILES := $(DEP_FILES) +$(LIBSAITHRIFT_DEV)_SMDEP_FILES := $(foreach path, $(SMDEP_PATHS), $($(path))) +$(LIBSAITHRIFT_DEV)_SMDEP_PATHS := $(SMDEP_PATHS) diff --git a/platform/marvell-armhf/one-image.dep b/platform/marvell-armhf/one-image.dep new file mode 100644 index 000000000000..154112a82abc --- /dev/null +++ b/platform/marvell-armhf/one-image.dep @@ -0,0 +1 @@ +$(SONIC_ONE_IMAGE)_CACHE_MODE := none diff --git a/platform/marvell-armhf/platform-et6448m.dep b/platform/marvell-armhf/platform-et6448m.dep new file mode 100644 index 000000000000..5f7e41d1f745 --- /dev/null +++ b/platform/marvell-armhf/platform-et6448m.dep @@ -0,0 +1,8 @@ +MPATH := $($(ET6448M_PLATFORM)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/marvell-armhf/platform-et6448m.mk platform/marvell-armhf/platform-et6448m.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(MPATH)) + +$(ET6448M_PLATFORM)_CACHE_MODE := GIT_CONTENT_SHA +$(ET6448M_PLATFORM)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(ET6448M_PLATFORM)_DEP_FILES := $(DEP_FILES) diff --git a/platform/marvell-armhf/platform-nokia.dep b/platform/marvell-armhf/platform-nokia.dep new file mode 100644 index 000000000000..752a2016b6c5 --- /dev/null +++ b/platform/marvell-armhf/platform-nokia.dep @@ -0,0 +1,8 @@ +MPATH := $($(NOKIA_7215_PLATFORM)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/marvell-armhf/platform-nokia.mk platform/marvell-armhf/platform-nokia.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(MPATH)) + +$(NOKIA_7215_PLATFORM)_CACHE_MODE := GIT_CONTENT_SHA +$(NOKIA_7215_PLATFORM)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(NOKIA_7215_PLATFORM)_DEP_FILES := $(DEP_FILES) diff --git a/platform/marvell-armhf/platform-nokia.mk b/platform/marvell-armhf/platform-nokia.mk index 7e7df9cb13cc..e8d6d106d651 100644 --- a/platform/marvell-armhf/platform-nokia.mk +++ b/platform/marvell-armhf/platform-nokia.mk @@ -8,4 +8,3 @@ $(NOKIA_7215_PLATFORM)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-nokia $(NOKIA_7215_PLATFORM)_PLATFORM = armhf-nokia_ixs7215_52x-r0 SONIC_DPKG_DEBS += $(NOKIA_7215_PLATFORM) -SONIC_STRETCH_DEBS += $(NOKIA_7215_PLATFORM) diff --git a/platform/marvell-armhf/platform.conf b/platform/marvell-armhf/platform.conf index b0be99a8e69e..0ef500e16e4f 100644 --- a/platform/marvell-armhf/platform.conf +++ b/platform/marvell-armhf/platform.conf @@ -7,11 +7,12 @@ echo "Preparing for installation ... " # global defines kernel_addr=0x1100000 fdt_addr=0x1000000 +fdt_high=0x10fffff initrd_addr=0x2000000 VAR_LOG=512 -kernel_fname="/boot/vmlinuz-4.19.0-12-2-armmp" -initrd_fname="/boot/initrd.img-4.19.0-12-2-armmp" +kernel_fname="/boot/vmlinuz-5.10.0-8-2-armmp" +initrd_fname="/boot/initrd.img-5.10.0-8-2-armmp" fdt_fname="/boot/armada-385-ET6448M_4G_Nand.dtb" if [ "$install_env" = "onie" ]; then @@ -152,6 +153,7 @@ prepare_boot_menu() { # Set boot configs fw_setenv ${FW_ARG} kernel_addr $kernel_addr > /dev/null fw_setenv ${FW_ARG} fdt_addr $fdt_addr > /dev/null + fw_setenv ${FW_ARG} fdt_high $fdt_high > /dev/null fw_setenv ${FW_ARG} initrd_addr $initrd_addr > /dev/null fw_setenv ${FW_ARG} mtdids 'nand0=armada-nand' > /dev/null if [ $UBOOT_FW_DEFAULT -eq 1 ] @@ -196,7 +198,7 @@ create_ubi_partition() { create_gpt_partition() { blk_dev="/dev/sda" - demo_part=$(sgdisk -p $blk_dev | grep -e "$demo_volume_label" -e "$legacy_volume_label" | awk '{print $1}') + demo_part=$(sgdisk -p $blk_dev | grep -e "$demo_volume_label" | awk '{print $1}') # ONIE partition size 168MB onie_part_size=168 diff --git a/platform/marvell-armhf/prestera.dep b/platform/marvell-armhf/prestera.dep new file mode 100644 index 000000000000..4fd2883b1193 --- /dev/null +++ b/platform/marvell-armhf/prestera.dep @@ -0,0 +1,8 @@ +MPATH := $($(MRVL_PRESTERA_DEB)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/marvell-armhf/prestera.mk platform/marvell-armhf/prestera.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(MPATH)) + +$(MRVL_PRESTERA_DEB)_CACHE_MODE := GIT_CONTENT_SHA +$(MRVL_PRESTERA_DEB)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(MRVL_PRESTERA_DEB)_DEP_FILES := $(DEP_FILES) diff --git a/platform/marvell-armhf/prestera.mk b/platform/marvell-armhf/prestera.mk index 2365319b9d00..113b8f41a394 100644 --- a/platform/marvell-armhf/prestera.mk +++ b/platform/marvell-armhf/prestera.mk @@ -4,7 +4,7 @@ export MRVL_PRESTERA_VER = 1.0 export MRVL_PRESTERA = mrvlprestera_$(MRVL_PRESTERA_VER)_$(PLATFORM_ARCH) export MRVL_PRESTERA_DEB = $(MRVL_PRESTERA).deb export MRVL_PRESTERA_SRC_URL = https://github.com/Marvell-switching/mrvl-prestera.git -export MRVL_PRESTERA_SRC_TAG = MRVL_PRESTERA_DRIVER_1.0 +export MRVL_PRESTERA_SRC_TAG = MRVL_PRESTERA_DRIVER_1.2 $(MRVL_PRESTERA_DEB)_SRC_PATH = $(PLATFORM_PATH)/prestera $(MRVL_PRESTERA_DEB)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) diff --git a/platform/marvell-armhf/prestera/debian/rules b/platform/marvell-armhf/prestera/debian/rules index 67692a42725c..d3895c2f769a 100755 --- a/platform/marvell-armhf/prestera/debian/rules +++ b/platform/marvell-armhf/prestera/debian/rules @@ -21,6 +21,7 @@ build: rm -rf mrvl-prestera || true git clone -b ${MRVL_PRESTERA_SRC_TAG} ${MRVL_PRESTERA_SRC_URL} sed "s/KVERSION/${KVERSION}/g" /sonic/platform/marvell-armhf/prestera/debian/mrvlprestera.install.template > /sonic/platform/marvell-armhf/prestera/debian/mrvlprestera.install + sed -i "s/4,11,0)/4,11,0) \&\& LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0)/g" /sonic/platform/marvell-armhf/prestera/mrvl-prestera/cpssEnabler/linuxNoKernelModule/drivers/dmaDriver.c make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$(MODULE_DIR)/ diff --git a/platform/marvell-armhf/rules.dep b/platform/marvell-armhf/rules.dep new file mode 100644 index 000000000000..427219b355d6 --- /dev/null +++ b/platform/marvell-armhf/rules.dep @@ -0,0 +1,9 @@ +include $(PLATFORM_PATH)/sai.dep +include $(PLATFORM_PATH)/prestera.dep +include $(PLATFORM_PATH)/docker-syncd-mrvl.dep +include $(PLATFORM_PATH)/docker-syncd-mrvl-rpc.dep +include $(PLATFORM_PATH)/docker-saiserver-mrvl.dep +include $(PLATFORM_PATH)/libsaithrift-dev.dep +include $(PLATFORM_PATH)/platform-et6448m.dep +include $(PLATFORM_PATH)/platform-nokia.dep +include $(PLATFORM_PATH)/one-image.dep diff --git a/platform/marvell-armhf/sai.dep b/platform/marvell-armhf/sai.dep new file mode 100644 index 000000000000..d14927cdde20 --- /dev/null +++ b/platform/marvell-armhf/sai.dep @@ -0,0 +1,9 @@ +SPATH := $($(MRVL_SAI)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/marvell-armhf/sai.mk platform/marvell-armhf/sai.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(SPATH)) +SMDEP_PATHS := $(SPATH) + +$(MRVL_SAI)_CACHE_MODE := GIT_CONTENT_SHA +$(MRVL_SAI)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(MRVL_SAI)_DEP_FILES := $(DEP_FILES) diff --git a/platform/marvell-armhf/sai.mk b/platform/marvell-armhf/sai.mk index 6695ff885a02..4ecfdce244a1 100644 --- a/platform/marvell-armhf/sai.mk +++ b/platform/marvell-armhf/sai.mk @@ -1,7 +1,7 @@ # Marvell SAI -export MRVL_SAI_VERSION = 1.8.1-1 -export MRVL_SAI = mrvllibsai_$(PLATFORM_ARCH)_$(MRVL_SAI_VERSION).deb +export MRVL_SAI_VERSION = 1.9.1-2 +export MRVL_SAI = mrvllibsai_$(MRVL_SAI_VERSION)_$(PLATFORM_ARCH).deb $(MRVL_SAI)_SRC_PATH = $(PLATFORM_PATH)/sai $(eval $(call add_conflict_package,$(MRVL_SAI),$(LIBSAIVS_DEV))) diff --git a/platform/marvell-armhf/sonic-platform-et6448m/entropy.py b/platform/marvell-armhf/sonic-platform-et6448m/entropy.py index 338e2ad9bcea..a2131cdc17fb 100644 --- a/platform/marvell-armhf/sonic-platform-et6448m/entropy.py +++ b/platform/marvell-armhf/sonic-platform-et6448m/entropy.py @@ -6,8 +6,11 @@ RNDADDENTROPY=0x40085203 def avail(): - with open("/proc/sys/kernel/random/entropy_avail", mode='r') as avail: - return int(avail.read()) + if path.exists("/proc/sys/kernel/random/entropy_avail"): + with open("/proc/sys/kernel/random/entropy_avail", mode='r') as avail: + return int(avail.read()) + else: + return int(2048) if path.exists("/proc/sys/kernel/random/entropy_avail"): while 1: diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/scripts/nokia-7215init.sh b/platform/marvell-armhf/sonic-platform-nokia/7215/scripts/nokia-7215init.sh index 3f23afe1fce2..f8a7ad54b310 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/scripts/nokia-7215init.sh +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/scripts/nokia-7215init.sh @@ -52,8 +52,8 @@ echo eeprom 0x55 > /sys/class/i2c-adapter/i2c-0/new_device echo eeprom 0x56 > /sys/class/i2c-adapter/i2c-0/new_device # Enumerate PSU eeprom devices +echo eeprom 0x50 > /sys/class/i2c-adapter/i2c-1/new_device echo eeprom 0x51 > /sys/class/i2c-adapter/i2c-1/new_device -echo eeprom 0x52 > /sys/class/i2c-adapter/i2c-1/new_device # Enable optical SFP Tx i2cset -y -m 0x0f 0 0x41 0x5 0x00 diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/chassis.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/chassis.py index cf67a7bb30ac..eb507a49ef17 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/chassis.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/chassis.py @@ -201,6 +201,22 @@ def get_serial(self): """ return self._eeprom.serial_number_str() + def get_revision(self): + """ + Retrieves the hardware revision of the chassis + + Returns: + string: Revision value of chassis + """ + if smbus_present == 0: # called from host + cmdstatus, value = cmd.getstatusoutput('sudo i2cget -y 0 0x41 0x0') + else: + bus = smbus.SMBus(0) + DEVICE_ADDRESS = 0x41 + DEVICE_REG = 0x0 + value = bus.read_byte_data(DEVICE_ADDRESS, DEVICE_REG) + return str(value) + def get_system_eeprom_info(self): """ Retrieves the full content of system EEPROM information for the diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/eeprom.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/eeprom.py index d0e3e00fffc2..b3b31605b246 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/eeprom.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/eeprom.py @@ -16,6 +16,7 @@ try: from sonic_platform_base.sonic_eeprom.eeprom_base import EepromDecoder from sonic_platform_base.sonic_eeprom.eeprom_tlvinfo import TlvInfoDecoder + from sonic_py_common import logger except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -27,6 +28,8 @@ ('Serial Number', 's', 11) ] +sonic_logger = logger.Logger('eeprom') + class Eeprom(TlvInfoDecoder): """Nokia platform-specific EEPROM class""" @@ -51,7 +54,7 @@ def __init__(self, is_psu=False, psu_index=0, is_fan=False, fan_index=0): self.index = psu_index self.start_offset = 18 self.eeprom_path = self.I2C_DIR \ - + "i2c-1/1-005{}/eeprom".format(self.index) + + "i2c-1/1-005{}/eeprom".format(self.index - 1) self.format = psu_eeprom_format # Decode device eeprom as per specified format @@ -79,6 +82,7 @@ def _load_system_eeprom(self): # Read System EEPROM as per ONIE TlvInfo EEPROM format. self.eeprom_data = self.read_eeprom() except Exception as e: + sonic_logger.log_warning("Unable to read system eeprom") self.base_mac = 'NA' self.serial_number = 'NA' self.part_number = 'NA' @@ -88,6 +92,7 @@ def _load_system_eeprom(self): else: eeprom = self.eeprom_data if not self.is_valid_tlvinfo_header(eeprom): + sonic_logger.log_warning("Invalid system eeprom TLV header") self.base_mac = 'NA' self.serial_number = 'NA' self.part_number = 'NA' @@ -144,10 +149,12 @@ def _load_device_eeprom(self): # Read Fan/PSU EEPROM as per the specified format. self.eeprom_data = EepromDecoder.read_eeprom(self) except Exception as e: + sonic_logger.log_warning("Unable to read device eeprom for PSU#{}".format(self.index)) return # Bail out if PSU eeprom unavailable if self.eeprom_data[0] == 255: + sonic_logger.log_warning("Uninitialized device eeprom for PSU#{}".format(self.index)) return (valid, data) = self._get_eeprom_field("Model") @@ -164,6 +171,7 @@ def _load_device_eeprom(self): if valid: self.serial_number = data.decode() except Exception as e: + sonic_logger.log_warning("Unable to read serial# of PSU#{}".format(self.index)) return # Fan device eeproms use ONIE TLV format @@ -172,10 +180,12 @@ def _load_device_eeprom(self): # Read Fan EEPROM as per ONIE TlvInfo EEPROM format. self.eeprom_data = self.read_eeprom() except Exception as e: + sonic_logger.log_warning("Unable to read device eeprom for Fan#{}".format(self.index)) return eeprom = self.eeprom_data if not self.is_valid_tlvinfo_header(eeprom): + sonic_logger.log_warning("Invalid device eeprom TLV header for Fan#{}".format(self.index)) return total_length = (eeprom[9] << 8) | eeprom[10] diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan.py index b8fd335930d6..71334ca48585 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan.py @@ -33,7 +33,7 @@ class Fan(FanBase): def __init__(self, fan_index, fan_drawer, psu_fan=False, dependency=None): self.is_psu_fan = psu_fan - ADT7473_DIR = "/sys/bus/i2c/devices/0-002e/" + ADT7473_DIR = "/sys/bus/i2c/devices/0-002e/hwmon/hwmon1/" if not self.is_psu_fan: # Fan is 1-based in Nokia platforms diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/psu.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/psu.py index 90025db7ffbf..383eb2481f68 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/psu.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/psu.py @@ -7,6 +7,7 @@ ######################################################################## try: + import os import sys from sonic_platform_base.psu_base import PsuBase from sonic_py_common import logger @@ -39,6 +40,34 @@ def __init__(self, psu_index): # PSU eeprom self.eeprom = Eeprom(is_psu=True, psu_index=self.index) + def _write_sysfs_file(self, sysfs_file, value): + rv = 'ERR' + + if (not os.path.isfile(sysfs_file)): + return rv + try: + with open(sysfs_file, 'w') as fd: + rv = fd.write(str(value)) + except Exception as e: + rv = 'ERR' + + return rv + + def _read_sysfs_file(self, sysfs_file): + rv = 'ERR' + + if (not os.path.isfile(sysfs_file)): + return rv + try: + with open(sysfs_file, 'r') as fd: + rv = fd.read() + except Exception as e: + rv = 'ERR' + + rv = rv.rstrip('\r\n') + rv = rv.lstrip(" ") + return rv + def get_name(self): """ Retrieves the name of the device @@ -85,7 +114,6 @@ def get_model(self): """ return self.eeprom.modelstr() - def get_serial(self): """ Retrieves the serial number of the PSU @@ -95,6 +123,14 @@ def get_serial(self): """ return self.eeprom.serial_number_str() + def get_revision(self): + """ + Retrieves the HW revision of the PSU + + Returns: + string: HW revision of PSU + """ + return self.eeprom.part_number_str() def get_part_number(self): """ @@ -242,7 +278,20 @@ def get_status_master_led(self): Returns: A string, one of the predefined STATUS_LED_COLOR_* strings. """ - return self._psu_master_led_color + if (not os.path.isfile("/sys/class/gpio/psuLedGreen/value") or + not os.path.isfile("/sys/class/gpio/psuLedAmber/value")): + return None + + green = self._read_sysfs_file("/sys/class/gpio/psuLedGreen/value") + amber = self._read_sysfs_file("/sys/class/gpio/psuLedAmber/value") + if green == "ERR" or amber == "ERR": + return None + if green == "1": + return self.STATUS_LED_COLOR_GREEN + elif amber == "1": + return self.STATUS_LED_COLOR_AMBER + else: + return None def set_status_master_led(self, color): """ @@ -252,5 +301,22 @@ def set_status_master_led(self, color): bool: True if status LED state is set successfully, False if not """ - self._psu_master_led_color = color + if (not os.path.isfile("/sys/class/gpio/psuLedGreen/value") or + not os.path.isfile("/sys/class/gpio/psuLedAmber/value")): + return False + + if color == self.STATUS_LED_COLOR_GREEN: + rvg = self._write_sysfs_file("/sys/class/gpio/psuLedGreen/value", 1) + if rvg != "ERR": + rva = self._write_sysfs_file("/sys/class/gpio/psuLedAmber/value", 0) + elif color == self.STATUS_LED_COLOR_AMBER: + rvg = self._write_sysfs_file("/sys/class/gpio/psuLedGreen/value", 0) + if rvg != "ERR": + rva = self._write_sysfs_file("/sys/class/gpio/psuLedAmber/value", 1) + else: + return False + + if rvg == "ERR" or rva == "ERR": + return False + return True diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/sfp.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/sfp.py index 244e48e1e639..d95e7a522da8 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/sfp.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/sfp.py @@ -5,7 +5,6 @@ import os import sys -import time try: from sonic_platform_base.sfp_base import SfpBase @@ -139,7 +138,7 @@ def __init__(self, index, sfp_type, eeprom_path, port_i2c_map): self.port_to_eeprom_mapping[index] = eeprom_path - self.info_dict_keys = ['type', 'hardware_rev', 'serial', 'manufacturer', + self.info_dict_keys = ['type', 'vendor_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', @@ -263,7 +262,7 @@ def get_transceiver_info(self): keys |Value Format |Information ---------------------------|---------------|---------------------------- type |1*255VCHAR |type of SFP - hardware_rev |1*255VCHAR |hardware version of SFP + vendor_rev |1*255VCHAR |vendor revision of SFP serial |1*255VCHAR |serial number of the SFP manufacturer |1*255VCHAR |SFP vendor name model |1*255VCHAR |SFP model name @@ -346,7 +345,7 @@ def get_transceiver_info(self): ['data']['Vendor Name']['value'] transceiver_info_dict['model'] = sfp_vendor_pn_data \ ['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data \ + transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data \ ['data']['Vendor Rev']['value'] transceiver_info_dict['serial'] = sfp_vendor_sn_data \ ['data']['Vendor SN']['value'] @@ -795,28 +794,22 @@ def reset(self): Reset SFP. Returns: A boolean, True if successful, False if not - """ - if self.sfp_type == COPPER_TYPE: - return False - - self.tx_disable(True) - time.sleep(1) - self.tx_disable(False) - - return True + """ + # RJ45 and SFP ports not resettable + return False def tx_disable(self, tx_disable): """ - Disable SFP TX + Disable SFP TX Args: tx_disable : A Boolean, True to enable tx_disable mode, False to disable tx_disable mode. - Returns: + Returns: A boolean, True if tx_disable is set successfully, False if not """ if self.sfp_type == COPPER_TYPE: return False - + if smbus_present == 0: # if called from sfputil outside of pmon cmdstatus, register = cmd.getstatusoutput('sudo i2cget -y 0 0x41 0x5') if cmdstatus: @@ -834,8 +827,8 @@ def tx_disable(self, tx_disable): if tx_disable == True: setbits = register | mask else: - setbits = register & ~mask - + setbits = register & ~mask + if smbus_present == 0: # if called from sfputil outside of pmon cmdstatus, output = cmd.getstatusoutput('sudo i2cset -y -m 0x0f 0 0x41 0x5 %d' % setbits) if cmdstatus: @@ -846,7 +839,7 @@ def tx_disable(self, tx_disable): DEVICE_ADDRESS = 0x41 DEVICE_REG = 0x5 bus.write_byte_data(DEVICE_ADDRESS, DEVICE_REG, setbits) - + return True def tx_disable_channel(self, channel, disable): diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-chassis.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-chassis.py index 53c047ca2329..93dfcaac3d05 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-chassis.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-chassis.py @@ -21,6 +21,8 @@ def main(): print(" Chassis serial: {}".format(chassis.get_serial())) + print(" Chassis revision: {}".format(chassis.get_revision())) + print(" Chassis status: {}".format(chassis.get_status())) print(" Chassis base_mac: {}".format(chassis.get_base_mac())) diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-thermal.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-thermal.py index 91ef75d8f9a7..95cc8e89f0d8 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-thermal.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-thermal.py @@ -30,7 +30,7 @@ def main(): high_thresh = "NA" print(" Low Threshold(C): {}, High Threshold(C): {}".format(low_thresh, - high_thresh)) + high_thresh)) try: crit_low_thresh = thermal.get_low_critical_threshold() diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/thermal.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/thermal.py index 20fdec61f38e..444ca5b137d7 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/thermal.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/thermal.py @@ -22,9 +22,9 @@ class Thermal(ThermalBase): I2C_CLASS_DIR = "/sys/class/i2c-adapter/" I2C_DEV_MAPPING = (['i2c-0/0-004a/hwmon/', 1], ['i2c-0/0-004b/hwmon/', 1], - ['i2c-0/0-002e/', 1], - ['i2c-0/0-002e/', 2], - ['i2c-0/0-002e/', 3]) + ['i2c-0/0-002e/hwmon/', 1], + ['i2c-0/0-002e/hwmon/', 2], + ['i2c-0/0-002e/hwmon/', 3]) HWMON_CLASS_DIR = "/sys/class/hwmon/" @@ -44,8 +44,8 @@ def __init__(self, thermal_index): if self.index < 3: i2c_path = self.I2C_CLASS_DIR + self.I2C_DEV_MAPPING[self.index - 1][0] sensor_index = self.I2C_DEV_MAPPING[self.index - 1][1] - sensor_max_suffix = "max" - sensor_crit_suffix = None + sensor_high_suffix = "max" + sensor_high_crit_suffix = None hwmon_node = os.listdir(i2c_path)[0] self.SENSOR_DIR = i2c_path + hwmon_node + '/' @@ -53,16 +53,17 @@ def __init__(self, thermal_index): elif self.index < 6: i2c_path = self.I2C_CLASS_DIR + self.I2C_DEV_MAPPING[self.index - 1][0] sensor_index = self.I2C_DEV_MAPPING[self.index - 1][1] - sensor_max_suffix = "max" - sensor_crit_suffix = "crit" - self.SENSOR_DIR = i2c_path + sensor_high_suffix = "crit" + sensor_high_crit_suffix = None + hwmon_node = os.listdir(i2c_path)[0] + self.SENSOR_DIR = i2c_path + hwmon_node + '/' # Armada 38x SOC temperature sensor else: dev_path = self.HWMON_CLASS_DIR sensor_index = 1 - sensor_max_suffix = None - sensor_crit_suffix = None + sensor_high_suffix = None + sensor_high_crit_suffix = None hwmon_node = os.listdir(dev_path)[0] self.SENSOR_DIR = dev_path + hwmon_node + '/' @@ -71,16 +72,16 @@ def __init__(self, thermal_index): + "temp{}_input".format(sensor_index) # sysfs file for high threshold value if supported for this sensor - if sensor_max_suffix: + if sensor_high_suffix: self.thermal_high_threshold_file = self.SENSOR_DIR \ - + "temp{}_{}".format(sensor_index, sensor_max_suffix) + + "temp{}_{}".format(sensor_index, sensor_high_suffix) else: self.thermal_high_threshold_file = None # sysfs file for crit high threshold value if supported for this sensor - if sensor_crit_suffix: + if sensor_high_crit_suffix: self.thermal_high_crit_threshold_file = self.SENSOR_DIR \ - + "temp{}_{}".format(sensor_index, sensor_crit_suffix) + + "temp{}_{}".format(sensor_index, sensor_high_crit_suffix) else: self.thermal_high_crit_threshold_file = None diff --git a/platform/marvell-armhf/sonic-platform-nokia/entropy.py b/platform/marvell-armhf/sonic-platform-nokia/entropy.py index 338e2ad9bcea..a2131cdc17fb 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/entropy.py +++ b/platform/marvell-armhf/sonic-platform-nokia/entropy.py @@ -6,8 +6,11 @@ RNDADDENTROPY=0x40085203 def avail(): - with open("/proc/sys/kernel/random/entropy_avail", mode='r') as avail: - return int(avail.read()) + if path.exists("/proc/sys/kernel/random/entropy_avail"): + with open("/proc/sys/kernel/random/entropy_avail", mode='r') as avail: + return int(avail.read()) + else: + return int(2048) if path.exists("/proc/sys/kernel/random/entropy_avail"): while 1: diff --git a/platform/marvell-armhf/sonic-platform-nokia/nokia-7215_plt_setup.sh b/platform/marvell-armhf/sonic-platform-nokia/nokia-7215_plt_setup.sh index 8301999d0d0a..0af85d730615 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/nokia-7215_plt_setup.sh +++ b/platform/marvell-armhf/sonic-platform-nokia/nokia-7215_plt_setup.sh @@ -10,12 +10,6 @@ fw_uboot_env_cfg() if [ "$PLATFORM" = "armhf-nokia_ixs7215_52x-r0" ]; then # Ixs7215 / IPD6448M board Uboot ENV offset FW_ENV_DEFAULT='/dev/mtd0 0x00100000 0x10000 0x10000' - - demo_part=$(sgdisk -p /dev/sda | grep -e "SONiC-OS") - if [ -z "$demo_part" ]; then - # ET6448M Board - For Backward compatibility - FW_ENV_DEFAULT='/dev/mtd0 0x00500000 0x80000 0x100000 8' - fi else FW_ENV_DEFAULT='/dev/mtd0 0x00500000 0x80000 0x100000 8' fi diff --git a/platform/marvell/docker-syncd-mrvl-rpc.mk b/platform/marvell/docker-syncd-mrvl-rpc.mk index c8a94878956f..20698efdf9e3 100644 --- a/platform/marvell/docker-syncd-mrvl-rpc.mk +++ b/platform/marvell/docker-syncd-mrvl-rpc.mk @@ -12,13 +12,12 @@ $(DOCKER_SYNCD_MRVL_RPC)_DEPENDS += $(SYNCD_RPC_DBG) \ endif $(DOCKER_SYNCD_MRVL_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_BASE) SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL_RPC) -SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_MRVL_RPC) ifeq ($(ENABLE_SYNCD_RPC),y) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL_RPC) endif $(DOCKER_SYNCD_MRVL_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_MRVL_RPC)_VERSION = 1.0.0-rpc +$(DOCKER_SYNCD_MRVL_RPC)_VERSION = 1.0.0+rpc $(DOCKER_SYNCD_MRVL_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/marvell/docker-syncd-mrvl.mk b/platform/marvell/docker-syncd-mrvl.mk index 2980ae17a881..d8a2050901f4 100644 --- a/platform/marvell/docker-syncd-mrvl.mk +++ b/platform/marvell/docker-syncd-mrvl.mk @@ -10,9 +10,6 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ $(LIBSAIMETADATA_DBG) \ $(LIBSAIREDIS_DBG) -SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_BASE) -SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) - $(DOCKER_SYNCD_BASE)_VERSION = 1.0.0 $(DOCKER_SYNCD_BASE)_PACKAGE_NAME = syncd diff --git a/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 index be69f831720a..cd9019febe4a 100755 --- a/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 @@ -1,4 +1,5 @@ -FROM docker-config-engine-stretch +{% from "dockers/dockerfile-macros.j2" import install_debian_packages %} +FROM docker-config-engine-buster ARG docker_container_name @@ -15,7 +16,7 @@ debs/{{ deb }}{{' '}} {%- endfor -%} debs/ -RUN apt-get -y install libpcap-dev libxml2-dev python-dev swig libsensors4-dev libatomic1 libjemalloc1 liblua5.1-0 lua-bitop lua-cjson nfs-common +RUN apt-get -y install libpcap-dev libxml2-dev python-dev swig libsensors4-dev libatomic1 liblua5.1-0 lua-bitop lua-cjson nfs-common RUN dpkg -i \ {% for deb in docker_syncd_mrvl_debs.split(' ') -%} diff --git a/platform/marvell/docker-syncd-mrvl/supervisord.conf b/platform/marvell/docker-syncd-mrvl/supervisord.conf index ef78e2cbc969..3829f6a81fd2 100644 --- a/platform/marvell/docker-syncd-mrvl/supervisord.conf +++ b/platform/marvell/docker-syncd-mrvl/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python2 -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 @@ -13,7 +13,7 @@ events=PROCESS_STATE buffer_size=1024 [eventlistener:supervisor-proc-exit-listener] -command=python2 /usr/bin/supervisor-proc-exit-listener --container-name syncd +command=python3 /usr/bin/supervisor-proc-exit-listener --container-name syncd events=PROCESS_STATE_EXITED,PROCESS_STATE_RUNNING autostart=true autorestart=unexpected diff --git a/platform/marvell/sai.mk b/platform/marvell/sai.mk index ac05bc8f0470..602f922968bd 100644 --- a/platform/marvell/sai.mk +++ b/platform/marvell/sai.mk @@ -1,6 +1,6 @@ # Marvell SAI -export MRVL_SAI_VERSION = 1.5.1 +export MRVL_SAI_VERSION = 1.8.1-1 export MRVL_SAI = mrvllibsai_amd64_$(MRVL_SAI_VERSION).deb $(MRVL_SAI)_SRC_PATH = $(PLATFORM_PATH)/sai diff --git a/platform/mellanox/asic_table.j2 b/platform/mellanox/asic_table.j2 index 77f62e3b3689..3cda40be51d5 100644 --- a/platform/mellanox/asic_table.j2 +++ b/platform/mellanox/asic_table.j2 @@ -1,3 +1,19 @@ +{# + Copyright (c) 2020-2022 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {%- if DEVICE_METADATA is defined and DEVICE_METADATA['localhost']['platform'] is defined %} {%- set platform = DEVICE_METADATA['localhost']['platform'] %} {%- else -%} @@ -24,6 +40,11 @@ 'x86_64-mlnx_msn4700-r0':'MELLANOX-SPECTRUM-3', 'x86_64-mlnx_msn4600c-r0':'MELLANOX-SPECTRUM-3', 'x86_64-mlnx_msn4600-r0':'MELLANOX-SPECTRUM-3', + 'x86_64-nvidia_sn4800-r0':'MELLANOX-SPECTRUM-3', + 'x86_64-nvidia_sn4800_simx-r0':'MELLANOX-SPECTRUM-3', + 'x86_64-nvidia_sn2201-r0':'MELLANOX-SPECTRUM', + 'x86_64-nvidia_sn5600-r0':'MELLANOX-SPECTRUM-4', + 'x86_64-nvidia_sn5600_simx-r0':'MELLANOX-SPECTRUM-4', 'vs-platform':'vs' } %} @@ -58,5 +79,15 @@ }, "OP": "SET" } +{% elif asic_type == 'MELLANOX-SPECTRUM-4' %} + { + "ASIC_TABLE:MELLANOX-SPECTRUM-4": { + "cell_size": "192", + "pipeline_latency": "19", + "mac_phy_delay": "0.8", + "peer_response_time": "3.8" + }, + "OP": "SET" + } {% endif %} ] diff --git a/platform/mellanox/docker-saiserver-mlnx.mk b/platform/mellanox/docker-saiserver-mlnx.mk index 4f15ed82e6c8..d71349a28ae7 100644 --- a/platform/mellanox/docker-saiserver-mlnx.mk +++ b/platform/mellanox/docker-saiserver-mlnx.mk @@ -1,15 +1,34 @@ +# +# Copyright (c) 2018-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# # docker image for mlnx saiserver -DOCKER_SAISERVER_MLNX = docker-saiserver-mlnx.gz +DOCKER_SAISERVER_MLNX = docker-saiserver$(SAITHRIFT_VER)-mlnx.gz $(DOCKER_SAISERVER_MLNX)_PATH = $(PLATFORM_PATH)/docker-saiserver-mlnx $(DOCKER_SAISERVER_MLNX)_DEPENDS += $(SAISERVER) $(PYTHON_SDK_API) $(DOCKER_SAISERVER_MLNX)_PYTHON_DEBS += $(MLNX_SFPD) -$(DOCKER_SAISERVER_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH) +$(DOCKER_SAISERVER_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_MLNX) -SONIC_STRETCH_DOCKERS += $(DOCKER_SAISERVER_MLNX) +SONIC_BUSTER_DOCKERS += $(DOCKER_SAISERVER_MLNX) + +$(DOCKER_SAISERVER_MLNX)_CONTAINER_NAME = saiserver$(SAITHRIFT_VER) -$(DOCKER_SAISERVER_MLNX)_CONTAINER_NAME = saiserver $(DOCKER_SAISERVER_MLNX)_RUN_OPT += --privileged -t $(DOCKER_SAISERVER_MLNX)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SAISERVER_MLNX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_SYNCD_BASE)_RUN_OPT += --tmpfs /run/criu + +SONIC_BUSTER_DOCKERS += $(DOCKER_SAISERVER_MLNX) diff --git a/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 b/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 index 39223131ee43..b356f145c9a4 100644 --- a/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 @@ -1,4 +1,21 @@ -FROM docker-config-engine-stretch +## +## Copyright (c) 2016-2022 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## +{% from "dockers/dockerfile-macros.j2" import install_debian_packages %} +FROM docker-config-engine-buster ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf @@ -6,7 +23,11 @@ RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%s ## Make apt-get non-interactive ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update +## Pre-install the fundamental packages +RUN apt-get update \ + && apt-get -y install \ + gdb \ + libboost-atomic1.71.0 COPY \ {% for deb in docker_saiserver_mlnx_debs.split(' ') -%} @@ -22,15 +43,7 @@ debs/ RUN apt-get install -y --no-install-recommends libxml2 iptables libbsd0 protobuf-c-compiler protobuf-compiler python-protobuf libprotobuf-c1 python-future python-ipaddr libnet1 pkg-config asciidoc xmlto -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ -{% for deb in docker_saiserver_mlnx_debs.split(' ') -%} -dpkg_apt debs/{{ deb }}{{'; '}} -{%- endfor %} - -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; } ; \ -{% for deb in docker_saiserver_mlnx_pydebs.split(' ') -%} -dpkg_apt debs/{{ deb }}{{'; '}} -{%- endfor %} +{{ install_debian_packages(docker_saiserver_mlnx_debs.split(' ')) }} COPY ["start.sh", "/usr/bin/"] diff --git a/platform/mellanox/docker-saiserver-mlnx/portmap.ini b/platform/mellanox/docker-saiserver-mlnx/portmap.ini index 4d3be08ce5f8..9643de59afa3 100644 --- a/platform/mellanox/docker-saiserver-mlnx/portmap.ini +++ b/platform/mellanox/docker-saiserver-mlnx/portmap.ini @@ -1,3 +1,19 @@ +## +## Copyright (c) 2016-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## # alias lanes Ethernet1 0,1,2,3 Ethernet2 4,5,6,7 diff --git a/platform/mellanox/docker-saiserver-mlnx/profile.ini b/platform/mellanox/docker-saiserver-mlnx/profile.ini index c67be49f3c45..3315af1fe11d 100644 --- a/platform/mellanox/docker-saiserver-mlnx/profile.ini +++ b/platform/mellanox/docker-saiserver-mlnx/profile.ini @@ -1 +1,17 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sai_2700.xml \ No newline at end of file +## +## Copyright (c) 2016-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## +SAI_INIT_CONFIG_FILE=/usr/share/sai_2700.xml diff --git a/platform/mellanox/docker-saiserver-mlnx/sai_2700.xml b/platform/mellanox/docker-saiserver-mlnx/sai_2700.xml index 42b576311453..84e6c9909394 100644 --- a/platform/mellanox/docker-saiserver-mlnx/sai_2700.xml +++ b/platform/mellanox/docker-saiserver-mlnx/sai_2700.xml @@ -1,4 +1,20 @@ + diff --git a/platform/mellanox/docker-saiserver-mlnx/start.sh b/platform/mellanox/docker-saiserver-mlnx/start.sh index 58a0c316add3..d5ac04c5e323 100755 --- a/platform/mellanox/docker-saiserver-mlnx/start.sh +++ b/platform/mellanox/docker-saiserver-mlnx/start.sh @@ -1,4 +1,20 @@ #!/usr/bin/env bash +# +# Copyright (c) 2016-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# start_mlnx() { diff --git a/platform/mellanox/docker-saiserver-mlnx/supervisord.conf b/platform/mellanox/docker-saiserver-mlnx/supervisord.conf index cb67a0fc9a47..e90e41645042 100644 --- a/platform/mellanox/docker-saiserver-mlnx/supervisord.conf +++ b/platform/mellanox/docker-saiserver-mlnx/supervisord.conf @@ -20,7 +20,7 @@ stdout_logfile=syslog stderr_logfile=syslog [program:saiserver] -command=/usr/bin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini +command=/usr/sbin/saiserver -p /etc/sai/profile.ini -f /etc/sai/portmap.ini priority=3 autostart=false autorestart=false diff --git a/platform/mellanox/docker-syncd-mlnx-rpc.mk b/platform/mellanox/docker-syncd-mlnx-rpc.mk index fe2ff5916493..fb740cdee4e9 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc.mk +++ b/platform/mellanox/docker-syncd-mlnx-rpc.mk @@ -1,3 +1,19 @@ +# +# Copyright (c) 2017-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# # docker image for mlnx syncd with rpc DOCKER_SYNCD_MLNX_RPC = docker-syncd-mlnx-rpc.gz @@ -20,9 +36,11 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX_RPC) endif $(DOCKER_SYNCD_MLNX_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_MLNX_RPC)_VERSION = 1.0.0-rpc +$(DOCKER_SYNCD_MLNX_RPC)_VERSION = 1.0.0+rpc $(DOCKER_SYNCD_MLNX_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_MLNX_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_MLNX_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_MLNX_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_SYNCD_MLNX_RPC)_RUN_OPT += -v /host/warmboot:/var/warmboot + +SONIC_BUSTER_DOCKERS += $(DOCKER_SYNCD_MLNX_RPC) diff --git a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 index b48d4ac3c793..50850039c01d 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 @@ -1,3 +1,19 @@ +## +## Copyright (c) 2016-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} FROM docker-syncd-mlnx diff --git a/platform/mellanox/docker-syncd-mlnx.mk b/platform/mellanox/docker-syncd-mlnx.mk index 5f04399d20a0..a2e733782b9e 100644 --- a/platform/mellanox/docker-syncd-mlnx.mk +++ b/platform/mellanox/docker-syncd-mlnx.mk @@ -1,3 +1,19 @@ +# +# Copyright (c) 2016-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# # docker image for mlnx syncd DOCKER_SYNCD_PLATFORM_CODE = mlnx @@ -5,6 +21,8 @@ include $(PLATFORM_PATH)/../template/docker-syncd-base.mk $(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API) $(MFT) +$(DOCKER_SYNCD_BASE)_FILES += $(ISSU_VERSION_FILE) + $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ $(LIBSWSSCOMMON_DBG) \ $(LIBSAIMETADATA_DBG) \ diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index 011931b2ff4b..404db43c70aa 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -1,3 +1,19 @@ +## +## Copyright (c) 2016-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} FROM docker-config-engine-buster diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 6b9790374d40..8293b38cd5fe 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -1,3 +1,19 @@ +# +# Copyright (c) 2016-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# # mellanox asic firmware MLNX_FW_BASE_PATH = $(MLNX_SDK_BASE_PATH) @@ -11,17 +27,17 @@ else FW_FROM_URL = n endif -MLNX_SPC_FW_VERSION = 13.2008.3326 +MLNX_SPC_FW_VERSION = 13.2010.1218 MLNX_SPC_FW_FILE = fw-SPC-rel-$(subst .,_,$(MLNX_SPC_FW_VERSION))-EVB.mfa $(MLNX_SPC_FW_FILE)_PATH = $(MLNX_FW_BASE_PATH) $(MLNX_SPC_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC_FW_FILE) -MLNX_SPC2_FW_VERSION = 29.2008.3326 +MLNX_SPC2_FW_VERSION = 29.2010.1218 MLNX_SPC2_FW_FILE = fw-SPC2-rel-$(subst .,_,$(MLNX_SPC2_FW_VERSION))-EVB.mfa $(MLNX_SPC2_FW_FILE)_PATH = $(MLNX_FW_BASE_PATH) $(MLNX_SPC2_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC2_FW_FILE) -MLNX_SPC3_FW_VERSION = 30.2008.3326 +MLNX_SPC3_FW_VERSION = 30.2010.1218 MLNX_SPC3_FW_FILE = fw-SPC3-rel-$(subst .,_,$(MLNX_SPC3_FW_VERSION))-EVB.mfa $(MLNX_SPC3_FW_FILE)_PATH = $(MLNX_FW_BASE_PATH) $(MLNX_SPC3_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC3_FW_FILE) diff --git a/platform/mellanox/hw-management.mk b/platform/mellanox/hw-management.mk index 6dc1f2655629..fac7bddc2c24 100644 --- a/platform/mellanox/hw-management.mk +++ b/platform/mellanox/hw-management.mk @@ -1,6 +1,22 @@ +# +# Copyright (c) 2016-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# # Mellanox HW Management -MLNX_HW_MANAGEMENT_VERSION = 7.0010.2344 +MLNX_HW_MANAGEMENT_VERSION = 7.0020.2004 export MLNX_HW_MANAGEMENT_VERSION diff --git a/platform/mellanox/hw-management/0002-Disable-hw-mgmt-on-SimX-platforms.patch b/platform/mellanox/hw-management/0002-Disable-hw-mgmt-on-SimX-platforms.patch new file mode 100644 index 000000000000..c12474712b9b --- /dev/null +++ b/platform/mellanox/hw-management/0002-Disable-hw-mgmt-on-SimX-platforms.patch @@ -0,0 +1,81 @@ +From 79dadd5b0d2f5e860b525c12d4d3843607b03a9f Mon Sep 17 00:00:00 2001 +From: Alexander Allen +Date: Fri, 21 Jan 2022 16:47:19 +0000 +Subject: [PATCH] Disable hw-mgmt on SimX platforms + +--- + usr/usr/bin/hw-management-ready.sh | 31 ++++++++++++++++-------------- + usr/usr/bin/hw-management.sh | 9 +++++++++ + 2 files changed, 26 insertions(+), 14 deletions(-) + +diff --git a/usr/usr/bin/hw-management-ready.sh b/usr/usr/bin/hw-management-ready.sh +index 5a9698c..364f906 100755 +--- a/usr/usr/bin/hw-management-ready.sh ++++ b/usr/usr/bin/hw-management-ready.sh +@@ -51,19 +51,22 @@ if [ -d /var/run/hw-management ]; then + rm -fr /var/run/hw-management + fi + +-case $board_type in +-VMOD0014) +- while [ ! -d /sys/devices/pci0000:00/0000:00:1f.0/NVSN2201:00/mlxreg-hotplug/hwmon ] +- do +- sleep 1 +- done +- ;; +-*) +- while [ ! -d /sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon ] +- do +- sleep 1 +- done +- ;; +-esac ++if [ -z "$(lspci -vvv | grep SimX)" ]; then ++ case $board_type in ++ VMOD0014) ++ while [ ! -d /sys/devices/pci0000:00/0000:00:1f.0/NVSN2201:00/mlxreg-hotplug/hwmon ] ++ do ++ sleep 1 ++ done ++ ;; ++ *) ++ while [ ! -d /sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon ] ++ do ++ sleep 1 ++ done ++ ;; ++ esac ++fi ++ + echo "Start Chassis HW management service." + logger -t hw-management -p daemon.notice "Start Chassis HW management service." +diff --git a/usr/usr/bin/hw-management.sh b/usr/usr/bin/hw-management.sh +index ebfabb0..c0c038e 100755 +--- a/usr/usr/bin/hw-management.sh ++++ b/usr/usr/bin/hw-management.sh +@@ -1495,6 +1495,13 @@ do_chip_down() + /usr/bin/hw-management-thermal-events.sh change hotplug_asic down %S %p + } + ++check_simx() ++{ ++ if [ -n "$(lspci -vvv | grep SimX)" ]; then ++ exit 0 ++ fi ++} ++ + __usage=" + Usage: $(basename "$0") [Options] + +@@ -1520,6 +1527,8 @@ Options: + force-reload Performs hw-management 'stop' and the 'start. + " + ++check_simx ++ + case $ACTION in + start) + if [ -d /var/run/hw-management ]; then +-- +2.17.1 + diff --git a/platform/mellanox/hw-management/0002-hw-mgmt-system-MSN4600-A1-BU-config1-fix.patch b/platform/mellanox/hw-management/0002-hw-mgmt-system-MSN4600-A1-BU-config1-fix.patch deleted file mode 100644 index 391121cff4b8..000000000000 --- a/platform/mellanox/hw-management/0002-hw-mgmt-system-MSN4600-A1-BU-config1-fix.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 1b2c2343d62b2fadb5c8fc9e61f2f654f4085193 Mon Sep 17 00:00:00 2001 -From: Mykola Kostenok -Date: Wed, 12 May 2021 10:59:57 +0300 -Subject: [PATCH] hw-mgmt: system: MSN4600 A1 BU config1 fix - -Fix config1 matching for MSN4600. - -Signed-off-by: Mykola Kostenok ---- - usr/usr/bin/hw-management.sh | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/usr/usr/bin/hw-management.sh b/usr/usr/bin/hw-management.sh -index d5b2728..150e583 100755 ---- a/usr/usr/bin/hw-management.sh -+++ b/usr/usr/bin/hw-management.sh -@@ -728,7 +728,7 @@ msn46xx_specific() - if [ $res -eq 0 ]; then - sys_ver=$(cut "$regio_path"/config1 -d' ' -f 1) - case $sys_ver in -- 3) -+ 1) - connect_msn4700_msn4600_A1 - ;; - *) --- -1.7.1 - diff --git a/platform/mellanox/hw-management/0003-Make-hw-mgmt-SimX-compatiable.patch b/platform/mellanox/hw-management/0003-Make-hw-mgmt-SimX-compatiable.patch deleted file mode 100644 index 4e49516c8d54..000000000000 --- a/platform/mellanox/hw-management/0003-Make-hw-mgmt-SimX-compatiable.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 5858f60aa5948a502ca8a1c9357ac81baa6f68dc Mon Sep 17 00:00:00 2001 -From: junchao -Date: Fri, 23 Apr 2021 09:27:43 +0800 -Subject: [PATCH] Make hw-mgmt SimX compatible - ---- - usr/usr/bin/hw-management-ready.sh | 11 +++++++---- - usr/usr/bin/hw-management.sh | 9 +++++++++ - 2 files changed, 16 insertions(+), 4 deletions(-) - -diff --git a/usr/usr/bin/hw-management-ready.sh b/usr/usr/bin/hw-management-ready.sh -index 3c9f7b6..05d143f 100755 ---- a/usr/usr/bin/hw-management-ready.sh -+++ b/usr/usr/bin/hw-management-ready.sh -@@ -49,9 +49,12 @@ if [ -d /var/run/hw-management ]; then - rm -fr /var/run/hw-management - fi - --while [ ! -d /sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon ] --do -- sleep 1 --done -+if [ -z "$(lspci -vvv | grep SimX)" ]; then -+ while [ ! -d /sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon ] -+ do -+ sleep 1 -+ done -+fi -+ - echo "Start Chassis HW management service." - logger -t hw-management -p daemon.notice "Start Chassis HW management service." -diff --git a/usr/usr/bin/hw-management.sh b/usr/usr/bin/hw-management.sh -index 991cf45..16ad0bf 100755 ---- a/usr/usr/bin/hw-management.sh -+++ b/usr/usr/bin/hw-management.sh -@@ -1265,6 +1265,13 @@ do_chip_down() - /usr/bin/hw-management-thermal-events.sh change hotplug_asic down %S %p - } - -+check_simx() -+{ -+ if [ -n "$(lspci -vvv | grep SimX)" ]; then -+ exit 0 -+ fi -+} -+ - __usage=" - Usage: $(basename "$0") [Options] - -@@ -1290,6 +1297,8 @@ Options: - force-reload Performs hw-management 'stop' and the 'start. - " - -+check_simx -+ - case $ACTION in - start) - if [ -d /var/run/hw-management ]; then --- -1.9.1 - diff --git a/platform/mellanox/hw-management/0003-Remove-unused-non-upstream-kernel-modules-from-load.patch b/platform/mellanox/hw-management/0003-Remove-unused-non-upstream-kernel-modules-from-load.patch new file mode 100644 index 000000000000..496085e9d4d8 --- /dev/null +++ b/platform/mellanox/hw-management/0003-Remove-unused-non-upstream-kernel-modules-from-load.patch @@ -0,0 +1,25 @@ +From 14b06a12802fc0e15116a64f419d002d0d21d695 Mon Sep 17 00:00:00 2001 +From: Alexander Allen +Date: Thu, 17 Feb 2022 04:19:50 +0000 +Subject: [PATCH] Remove unused non-upstream kernel modules from load + +--- + usr/etc/modules-load.d/05-hw-management-modules.conf | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/usr/etc/modules-load.d/05-hw-management-modules.conf b/usr/etc/modules-load.d/05-hw-management-modules.conf +index 39f621e..c0980bc 100644 +--- a/usr/etc/modules-load.d/05-hw-management-modules.conf ++++ b/usr/etc/modules-load.d/05-hw-management-modules.conf +@@ -15,8 +15,6 @@ xdpe12284 + mp2975 + mp2888 + i2c-mux-pca954x +-emc2305 +-ti-ads1015 + powr1220 + gpio-pca953x + pmbus +-- +2.17.1 + diff --git a/platform/mellanox/hw-management/Makefile b/platform/mellanox/hw-management/Makefile index eb087b47bfff..9c62312d18c5 100644 --- a/platform/mellanox/hw-management/Makefile +++ b/platform/mellanox/hw-management/Makefile @@ -6,7 +6,8 @@ MAIN_TARGET = hw-management_1.mlnx.$(MLNX_HW_MANAGEMENT_VERSION)_amd64.deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : pushd hw-mgmt - git am ../*.patch + git stash + git apply -3 ../*.patch || exit 1 chmod +x ./debian/rules KVERSION=$(KVERSION) dpkg-buildpackage -us -uc -b -rfakeroot -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) popd diff --git a/platform/mellanox/hw-management/hw-mgmt b/platform/mellanox/hw-management/hw-mgmt index b661fa329e2d..ec2e9173e9f2 160000 --- a/platform/mellanox/hw-management/hw-mgmt +++ b/platform/mellanox/hw-management/hw-mgmt @@ -1 +1 @@ -Subproject commit b661fa329e2dff4fd6c22da89d009169e1008d99 +Subproject commit ec2e9173e9f24cbc02eb87d81889d408528e090b diff --git a/platform/mellanox/install-pending-fw.dep b/platform/mellanox/install-pending-fw.dep new file mode 100644 index 000000000000..ddd6f325684b --- /dev/null +++ b/platform/mellanox/install-pending-fw.dep @@ -0,0 +1,10 @@ +# DPKG FRK + +DPATH := $($(MLNX_INSTALL_PENDING_FW)_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_PATH)/install-pending-fw.mk $(PLATFORM_PATH)/install-pending-fw.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(addprefix $(DPATH),$(MLNX_INSTALL_PENDING_FW)) + +$(MLNX_INSTALL_PENDING_FW)_CACHE_MODE := GIT_CONTENT_SHA +$(MLNX_INSTALL_PENDING_FW)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(MLNX_INSTALL_PENDING_FW)_DEP_FILES := $(DEP_FILES) diff --git a/platform/mellanox/install-pending-fw.mk b/platform/mellanox/install-pending-fw.mk new file mode 100644 index 000000000000..714ac6bdec6f --- /dev/null +++ b/platform/mellanox/install-pending-fw.mk @@ -0,0 +1,25 @@ +# +# Copyright (c) 2020-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Firmware pending update checker and installer + +MLNX_INSTALL_PENDING_FW = install-pending-fw.py +$(MLNX_INSTALL_PENDING_FW)_PATH = $(PLATFORM_PATH)/ +SONIC_COPY_FILES += $(MLNX_INSTALL_PENDING_FW) + +MLNX_FILES += $(MLNX_INSTALL_PENDING_FW) + +export MLNX_INSTALL_PENDING_FW diff --git a/platform/mellanox/install-pending-fw.py b/platform/mellanox/install-pending-fw.py new file mode 100755 index 000000000000..c5b61341be9d --- /dev/null +++ b/platform/mellanox/install-pending-fw.py @@ -0,0 +1,99 @@ +#!/usr/bin/env python3 +# +# Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os + +from fwutil.lib import ComponentStatusProvider, PlatformComponentsParser +from sonic_platform.component import ComponentCPLD, MPFAManager + +# Globals +FW_STATUS_SCHEDULED = "scheduled" +CPLD_FLAG = False + +# Init platform chassis helper classes +csp = ComponentStatusProvider() +pcp = PlatformComponentsParser(csp.is_modular_chassis()) + +# Parse update status file +update_status = csp.read_au_status_file_if_exists() + +if update_status is None: + exit(0) + +# Parse platform components file +try: + pcp.parse_platform_components() +except Exception as e: + print("Error parsing platform components. Firmware update failed: {}".format(str(e))) + print("System will reboot in 10 seconds please fix issue and run update command again.") + time.sleep(10) + exit(-1) + +# Iterate each component in the status file +comp_install = [] +files = [] + +for boot_type, components in update_status.items(): + for comp in components: + + # Skip if fw isn't scheduled for install at reboot + if comp["info"] != FW_STATUS_SCHEDULED: continue + + # Get component object and target firmware file + key = comp["comp"] + comp_path = key.split("/") + + if len(comp_path) == 3: + # Module component + _, parent_name, comp_name = comp_path + fw_file = pcp.module_component_map[parent_name][comp_name]["firmware"] + component = csp.module_component_map[parent_name][comp_name] + else: + # Chassis component + parent_name, comp_name = comp_path + fw_file = pcp.chassis_component_map[parent_name][comp_name]["firmware"] + component = csp.chassis_component_map[parent_name][comp_name] + + # Install firmware. If CPLD flag to be installed last due to force reboot during refresh + if type(component) == ComponentCPLD: + if CPLD_FLAG: + # Only need one refresh + continue + mpfa = MPFAManager(fw_file) + mpfa.extract() + if not mpfa.get_metadata().has_option('firmware', 'refresh'): + print("Failed to get CPLD refresh firmware. Skipping.") + continue + CPLD_FLAG = True + refresh_firmware = mpfa.get_metadata().get('firmware', 'refresh') + comp_install = comp_install + [component] + files = files + [os.path.join(mpfa.get_path(), refresh_firmware)] + else: + comp_install = [component] + comp_install + files = [fw_file] + files + +# Do install +for i, c in enumerate(comp_install): + try: + if type(c) == ComponentCPLD: + c.install_firmware(files[i]) + else: + c.install_firmware(files[i], allow_reboot=False) + except Exception as e: + print("Firmware install for {} FAILED with: {}".format(c.get_name(),e)) + diff --git a/platform/mellanox/issu-version.mk b/platform/mellanox/issu-version.mk index db368ffd8c10..d369ec600236 100644 --- a/platform/mellanox/issu-version.mk +++ b/platform/mellanox/issu-version.mk @@ -1,8 +1,28 @@ +# +# Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# # ISSU version ISSU_VERSION_FILE = issu-version $(ISSU_VERSION_FILE)_SRC_PATH = $(PLATFORM_PATH)/issu-version + +ifeq ($(BLDENV), buster) $(ISSU_VERSION_FILE)_DEPENDS += $(APPLIBS) +endif + SONIC_MAKE_FILES += $(ISSU_VERSION_FILE) MLNX_FILES += $(ISSU_VERSION_FILE) diff --git a/platform/mellanox/issu-version/Makefile b/platform/mellanox/issu-version/Makefile index 1f7d7fba3a3f..2578e9ff060b 100644 --- a/platform/mellanox/issu-version/Makefile +++ b/platform/mellanox/issu-version/Makefile @@ -1,12 +1,33 @@ +# +# Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# .ONESHELL: SHELL = /bin/bash .SHELLFLAGS += -e MAIN_TARGET = issu-version +BUSTER_FILES_PATH = /sonic/target/files/buster $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : +ifneq (,$(findstring buster,$(DEST))) sx_sdk --version | egrep -o 'ISSU [0-9]+' > $(DEST)/$(MAIN_TARGET) || { echo "ISSU version is undefined: $(sx_sdk --version)" rm $(DEST)/$(MAIN_TARGET) exit 1 } +else + cp $(BUSTER_FILES_PATH)/$(MAIN_TARGET) $(DEST)/$(MAIN_TARGET) +endif diff --git a/platform/mellanox/libsaithrift-dev.mk b/platform/mellanox/libsaithrift-dev.mk index b0ef5746db73..579a41f02a24 100644 --- a/platform/mellanox/libsaithrift-dev.mk +++ b/platform/mellanox/libsaithrift-dev.mk @@ -1,20 +1,45 @@ +# +# Copyright (c) 2017-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# # libsaithrift-dev package SAI_VER = 0.9.4 -LIBSAITHRIFT_DEV = libsaithrift-dev_$(SAI_VER)_amd64.deb +LIBSAITHRIFT_DEV = libsaithrift$(SAITHRIFT_VER)-dev_$(SAI_VER)_amd64.deb $(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI -$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) $(MLNX_SAI) $(MLNX_SAI_DEV) -$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT) $(MLNX_SAI) +ifeq ($(SAITHRIFT_V2),y) +$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT_0_14_1) $(LIBTHRIFT_0_14_1_DEV) $(PYTHON3_THRIFT_0_14_1) $(THRIFT_0_14_1_COMPILER) +$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT_0_14_1) +$(LIBSAITHRIFT_DEV)_BUILD_ENV = SAITHRIFTV2=true SAITHRIFT_VER=v2 +else +$(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) +$(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT) +endif +$(LIBSAITHRIFT_DEV)_DEPENDS += $(MLNX_SAI) $(MLNX_SAI_DEV) +$(LIBSAITHRIFT_DEV)_RDEPENDS += $(MLNX_SAI) + SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV) -PYTHON_SAITHRIFT = python-saithrift_$(SAI_VER)_amd64.deb +PYTHON_SAITHRIFT = python-saithrift$(SAITHRIFT_VER)_$(SAI_VER)_amd64.deb $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(PYTHON_SAITHRIFT))) -SAISERVER = saiserver_$(SAI_VER)_amd64.deb -$(SAISERVER)_RDEPENDS += $(LIBTHRIFT) $(MLNX_SAI) +SAISERVER = saiserver$(SAITHRIFT_VER)_$(SAI_VER)_amd64.deb +$(SAISERVER)_RDEPENDS += $(LIBSAITHRIFT_DEV) $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER))) -SAISERVER_DBG = saiserver-dbg_$(SAI_VER)_amd64.deb +SAISERVER_DBG = saiserver$(SAITHRIFT_VER)-dbg_$(SAI_VER)_amd64.deb $(SAISERVER_DBG)_RDEPENDS += $(SAISERVER) $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER_DBG))) diff --git a/platform/mellanox/mft.mk b/platform/mellanox/mft.mk index 5e9644b5703c..981c456906b3 100644 --- a/platform/mellanox/mft.mk +++ b/platform/mellanox/mft.mk @@ -1,17 +1,36 @@ +# +# Copyright (c) 2016-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# # Mellanox SAI -MFT_VERSION = 4.17.0 +MFT_VERSION = 4.18.0 MFT_REVISION = 106 export MFT_VERSION MFT_REVISION MFT = mft_$(MFT_VERSION)-$(MFT_REVISION)_amd64.deb $(MFT)_SRC_PATH = $(PLATFORM_PATH)/mft -$(MFT)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) SONIC_MAKE_DEBS += $(MFT) +ifeq ($(BLDENV), bullseye) +$(MFT)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) + KERNEL_MFT = kernel-mft-dkms-modules-$(KVERSION)_$(MFT_VERSION)_amd64.deb $(eval $(call add_derived_package,$(MFT),$(KERNEL_MFT))) +endif MFT_OEM = mft-oem_$(MFT_VERSION)-$(MFT_REVISION)_amd64.deb $(eval $(call add_derived_package,$(MFT),$(MFT_OEM))) diff --git a/platform/mellanox/mft/Makefile b/platform/mellanox/mft/Makefile index 84a587730386..ed2fe7b1d1a1 100644 --- a/platform/mellanox/mft/Makefile +++ b/platform/mellanox/mft/Makefile @@ -1,3 +1,19 @@ +# +# Copyright (c) 2016-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# .ONESHELL: SHELL = /bin/bash .SHELLFLAGS += -e @@ -19,6 +35,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : wget -O $(MFT_TGZ) http://www.mellanox.com/downloads/MFT/$(MFT_TGZ) tar xzf $(MFT_TGZ) +ifneq (,$(findstring bullseye,$(DEST))) pushd $(MFT_NAME)/SDEBS # put a lock here because dpkg does not allow installing packages in parallel @@ -46,6 +63,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : popd rm -rf $(DKMS_TMP) +endif # fix timestamp because we do not actually build tools, only kernel touch $(MFT_NAME)/DEBS/*.deb diff --git a/platform/mellanox/mlnx-ffb.mk b/platform/mellanox/mlnx-ffb.mk index 6c3c925b5996..64fad0858f48 100755 --- a/platform/mellanox/mlnx-ffb.mk +++ b/platform/mellanox/mlnx-ffb.mk @@ -1,3 +1,19 @@ +# +# Copyright (c) 2018-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# # mellanox fast fast boot script MLNX_FFB_SCRIPT = mlnx-ffb.sh diff --git a/platform/mellanox/mlnx-ffb.sh b/platform/mellanox/mlnx-ffb.sh index d0bef9d57761..afe42c819870 100755 --- a/platform/mellanox/mlnx-ffb.sh +++ b/platform/mellanox/mlnx-ffb.sh @@ -1,4 +1,20 @@ #!/bin/bash +# +# Copyright (c) 2018-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# FFB_SUCCESS=0 FFB_FAILURE=1 diff --git a/platform/mellanox/mlnx-onie-fw-update.mk b/platform/mellanox/mlnx-onie-fw-update.mk index 13f68ce4671f..af8e7299c9d2 100644 --- a/platform/mellanox/mlnx-onie-fw-update.mk +++ b/platform/mellanox/mlnx-onie-fw-update.mk @@ -1,3 +1,19 @@ +# +# Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# # onie update tool MLNX_ONIE_FW_UPDATE = mlnx-onie-fw-update.sh diff --git a/platform/mellanox/mlnx-onie-fw-update.sh b/platform/mellanox/mlnx-onie-fw-update.sh index 0abc55ef76b4..4d441c5ced9b 100755 --- a/platform/mellanox/mlnx-onie-fw-update.sh +++ b/platform/mellanox/mlnx-onie-fw-update.sh @@ -1,9 +1,21 @@ #!/bin/bash - -# Copyright (C) 2019 Mellanox Technologies Ltd. -# Copyright (C) 2019 Michael Shych # -# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2020-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + this_script="$(basename $(realpath ${0}))" lock_file="/var/run/${this_script%.*}.lock" @@ -174,7 +186,12 @@ case "${cmd}" in rc=$? disable_onie_access if [[ ${rc} -eq 0 ]]; then - system_reboot + if [[ "${arg}" == "--no-reboot" ]]; then + echo "INFO: ONIE firmware update successfully STAGED for install at NEXT reboot. Please reboot manually to complete installation." + exit 0 + else + system_reboot + fi else echo "ERROR: failed to enable ONIE firmware update mode" exit ${rc} diff --git a/platform/mellanox/mlnx-platform-api.dep b/platform/mellanox/mlnx-platform-api.dep index b66c0b9c3bdf..c237ab9f02c8 100644 --- a/platform/mellanox/mlnx-platform-api.dep +++ b/platform/mellanox/mlnx-platform-api.dep @@ -1,14 +1,16 @@ # DPKG FRK -SPATH := $($(SONIC_PLATFORM_API_PY2)_SRC_PATH) +SPATH := $($(SONIC_PLATFORM_API_PY3)_SRC_PATH) SLINKS := $(shell find $(SPATH) -type l -exec echo {} \; | grep -Ev ' ') DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_PATH)/mlnx-platform-api.mk $(PLATFORM_PATH)/mlnx-platform-api.dep DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) DEP_FILES += $(shell git ls-files -- $(SPATH) | grep -Ev ' ') -$(SONIC_PLATFORM_API_PY2)_CACHE_MODE := GIT_CONTENT_SHA -$(SONIC_PLATFORM_API_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) -$(SONIC_PLATFORM_API_PY2)_DEP_FILES := $(filter-out $(SLINKS),$(DEP_FILES)) +ifeq ($(ENABLE_PY2_MODULES), y) + $(SONIC_PLATFORM_API_PY2)_CACHE_MODE := GIT_CONTENT_SHA + $(SONIC_PLATFORM_API_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) + $(SONIC_PLATFORM_API_PY2)_DEP_FILES := $(filter-out $(SLINKS),$(DEP_FILES)) +endif $(SONIC_PLATFORM_API_PY3)_CACHE_MODE := GIT_CONTENT_SHA $(SONIC_PLATFORM_API_PY3)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) diff --git a/platform/mellanox/mlnx-platform-api.mk b/platform/mellanox/mlnx-platform-api.mk index e7e36c1f67b8..496f393caa66 100644 --- a/platform/mellanox/mlnx-platform-api.mk +++ b/platform/mellanox/mlnx-platform-api.mk @@ -1,10 +1,28 @@ +# +# Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# # SONIC_PLATFORM_API_PY2 package -SONIC_PLATFORM_API_PY2 = mlnx_platform_api-1.0-py2-none-any.whl -$(SONIC_PLATFORM_API_PY2)_SRC_PATH = $(PLATFORM_PATH)/mlnx-platform-api -$(SONIC_PLATFORM_API_PY2)_PYTHON_VERSION = 2 -$(SONIC_PLATFORM_API_PY2)_DEPENDS = $(SONIC_PY_COMMON_PY2) $(SONIC_PLATFORM_COMMON_PY2) $(SONIC_CONFIG_ENGINE_PY2) -SONIC_PYTHON_WHEELS += $(SONIC_PLATFORM_API_PY2) +ifeq ($(ENABLE_PY2_MODULES), y) + SONIC_PLATFORM_API_PY2 = mlnx_platform_api-1.0-py2-none-any.whl + $(SONIC_PLATFORM_API_PY2)_SRC_PATH = $(PLATFORM_PATH)/mlnx-platform-api + $(SONIC_PLATFORM_API_PY2)_PYTHON_VERSION = 2 + $(SONIC_PLATFORM_API_PY2)_DEPENDS = $(SONIC_PY_COMMON_PY2) $(SONIC_PLATFORM_COMMON_PY2) $(SONIC_CONFIG_ENGINE_PY2) + SONIC_PYTHON_WHEELS += $(SONIC_PLATFORM_API_PY2) +endif export mlnx_platform_api_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PLATFORM_API_PY2))" diff --git a/platform/mellanox/mlnx-platform-api/.gitignore b/platform/mellanox/mlnx-platform-api/.gitignore index 07f8a98e1f4a..2a94e25395bf 100644 --- a/platform/mellanox/mlnx-platform-api/.gitignore +++ b/platform/mellanox/mlnx-platform-api/.gitignore @@ -1,2 +1,6 @@ *.pyc .cache/ +*/test-results.xml +*/htmlcov/ +*/coverage.xml +*/.coverage diff --git a/platform/mellanox/mlnx-platform-api/pytest.ini b/platform/mellanox/mlnx-platform-api/pytest.ini index c24fe5bb9e65..081d3f0671f6 100644 --- a/platform/mellanox/mlnx-platform-api/pytest.ini +++ b/platform/mellanox/mlnx-platform-api/pytest.ini @@ -1,3 +1,20 @@ +## +## Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +## Apache-2.0 +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## [pytest] +addopts = --cov=sonic_platform --cov-report html --cov-report term --cov-report xml --junitxml=test-results.xml -vv filterwarnings = ignore::DeprecationWarning diff --git a/platform/mellanox/mlnx-platform-api/setup.py b/platform/mellanox/mlnx-platform-api/setup.py index df1a8cadbb09..31dba9d2ae00 100644 --- a/platform/mellanox/mlnx-platform-api/setup.py +++ b/platform/mellanox/mlnx-platform-api/setup.py @@ -1,3 +1,19 @@ +# +# Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# from setuptools import setup setup( diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/__init__.py b/platform/mellanox/mlnx-platform-api/sonic_platform/__init__.py index d82f3749319c..4d778682cdd5 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/__init__.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/__init__.py @@ -1,2 +1,18 @@ +# +# Copyright (c) 2017-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# __all__ = ["platform", "chassis"] from sonic_platform import * diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py index 2c54b9539376..1cc3d0f75660 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py @@ -1,3 +1,19 @@ +# +# Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################# # Mellanox # @@ -8,22 +24,18 @@ try: from sonic_platform_base.chassis_base import ChassisBase - from sonic_platform_base.component_base import ComponentBase - from sonic_py_common import device_info from sonic_py_common.logger import Logger - from os import listdir - from os.path import isfile, join - import sys - import io - import re - import syslog + import os + from functools import reduce + + from . import utils + from .device_data import DeviceDataManager + from .sfp import SFP, deinitialize_sdk_handle except ImportError as e: raise ImportError (str(e) + "- required module not found") MAX_SELECT_DELAY = 3600 -MLNX_NUM_PSU = 2 - DMI_FILE = '/sys/firmware/dmi/entries/2-0/raw' DMI_HEADER_LEN = 15 DMI_PRODUCT_NAME = "Product Name" @@ -41,15 +53,8 @@ DMI_LOC: 5 } -EEPROM_CACHE_ROOT = '/var/cache/sonic/decode-syseeprom' -EEPROM_CACHE_FILE = 'syseeprom_cache' - HWMGMT_SYSTEM_ROOT = '/var/run/hw-management/system/' -MST_DEVICE_NAME_PATTERN = '/dev/mst/mt[0-9]*_pciconf0' -MST_DEVICE_RE_PATTERN = '/dev/mst/mt([0-9]*)_pciconf0' -SPECTRUM1_CHIP_ID = '52100' - #reboot cause related definitions REBOOT_CAUSE_ROOT = HWMGMT_SYSTEM_ROOT @@ -58,15 +63,6 @@ # Global logger class instance logger = Logger() -# magic code defnition for port number, qsfp port position of each Platform -# port_position_tuple = (PORT_START, QSFP_PORT_START, PORT_END, PORT_IN_BLOCK, EEPROM_OFFSET) -platform_dict_port = {'x86_64-mlnx_msn2010-r0': 3, 'x86_64-mlnx_msn2100-r0': 1, 'x86_64-mlnx_msn2410-r0': 2, - 'x86_64-mlnx_msn2700-r0': 0, 'x86_64-mlnx_lssn2700': 0, 'x86_64-mlnx_msn2740-r0': 0, - 'x86_64-mlnx_msn3420-r0': 5, 'x86_64-mlnx_msn3700-r0': 0, 'x86_64-mlnx_msn3700c-r0': 0, - 'x86_64-mlnx_msn3800-r0': 4, 'x86_64-mlnx_msn4600-r0': 4, 'x86_64-mlnx_msn4600c-r0': 4, - 'x86_64-mlnx_msn4700-r0': 0, 'x86_64-mlnx_msn4410-r0': 0} -port_position_tuple_list = [(0, 0, 31, 32, 1), (0, 0, 15, 16, 1), (0, 48, 55, 56, 1), (0, 18, 21, 22, 1), (0, 0, 63, 64, 1), (0, 48, 59, 60, 1)] - class Chassis(ChassisBase): """Platform-specific Chassis class""" @@ -76,15 +72,9 @@ class Chassis(ChassisBase): def __init__(self): super(Chassis, self).__init__() - self.name = "Undefined" - self.model = "Undefined" - - # Initialize Platform name - self.platform_name = device_info.get_platform() - # Initialize DMI data self.dmi_data = None - + # move the initialization of each components to their dedicated initializer # which will be called from platform # @@ -114,165 +104,161 @@ def __init__(self): # - False: All SFP modules have not been created # - True: All SFP modules have been created # - self.sfp_module_partial_initialized = False - self.sfp_module_full_initialized = False - self.sfp_event_initialized = False + self.sfp_initialized_count = 0 + self.sfp_event = None self.reboot_cause_initialized = False - self.sdk_handle = None - self.deinitialize_sdk_handle = None logger.log_info("Chassis loaded successfully") - def __del__(self): - if self.sfp_event_initialized: + if self.sfp_event: self.sfp_event.deinitialize() - if self.deinitialize_sdk_handle: - self.deinitialize_sdk_handle(self.sdk_handle) + if SFP.shared_sdk_handle: + deinitialize_sdk_handle(SFP.shared_sdk_handle) + ############################################## + # PSU methods + ############################################## def initialize_psu(self): - from sonic_platform.psu import Psu - # Initialize PSU list - self.psu_module = Psu - for index in range(MLNX_NUM_PSU): - psu = Psu(index, self.platform_name) - self._psu_list.append(psu) - - - def initialize_fan(self): - from .device_data import DEVICE_DATA - from sonic_platform.fan import Fan - from .fan_drawer import RealDrawer, VirtualDrawer - - fan_data = DEVICE_DATA[self.platform_name]['fans'] - drawer_num = fan_data['drawer_num'] - drawer_type = fan_data['drawer_type'] - fan_num_per_drawer = fan_data['fan_num_per_drawer'] - drawer_ctor = RealDrawer if drawer_type == 'real' else VirtualDrawer - fan_index = 0 - for drawer_index in range(drawer_num): - drawer = drawer_ctor(drawer_index, fan_data) - self._fan_drawer_list.append(drawer) - for index in range(fan_num_per_drawer): - fan = Fan(fan_index, drawer, index + 1) - fan_index += 1 - drawer._fan_list.append(fan) - - - def initialize_single_sfp(self, index): - if not self._sfp_list[index]: - if index >= self.QSFP_PORT_START and index < self.PORTS_IN_BLOCK: - sfp_module = self.sfp_module(index, 'QSFP', self.get_sdk_handle, self.platform_name) - else: - sfp_module = self.sfp_module(index, 'SFP', self.get_sdk_handle, self.platform_name) - - self._sfp_list[index] = sfp_module - - - def initialize_sfp(self, index=None): - from sonic_platform.sfp import SFP - - self.sfp_module = SFP - - # Initialize SFP list - port_position_tuple = self._get_port_position_tuple_by_platform_name() - self.PORT_START = port_position_tuple[0] - self.QSFP_PORT_START = port_position_tuple[1] - self.PORT_END = port_position_tuple[2] - self.PORTS_IN_BLOCK = port_position_tuple[3] - - if index is not None: - if not self.sfp_module_partial_initialized: - if index >= self.PORT_START and index < self.PORT_END: - self._sfp_list = list([None]*(self.PORT_END + 1)) + if not self._psu_list: + from .psu import Psu, FixedPsu + psu_count = DeviceDataManager.get_psu_count() + hot_swapable = DeviceDataManager.is_psu_hotswapable() + + # Initialize PSU list + for index in range(psu_count): + if hot_swapable: + psu = Psu(index) else: - raise IndexError("{} is not a valid index of SPF modules. Valid index range:[{}, {}]".format( - index, self.PORT_START + 1, self.PORT_END + 1)) - self.sfp_module_partial_initialized = True - else: - if not self.sfp_module_partial_initialized: - self._sfp_list = list([None]*(self.PORT_END + 1)) - self.sfp_module_partial_initialized = True - for index in range(self.PORT_START, self.PORT_END + 1): - self.initialize_single_sfp(index) - - self.sfp_module_full_initialized = True - - - def get_sdk_handle(self): - if not self.sdk_handle: - from sonic_platform.sfp import initialize_sdk_handle, deinitialize_sdk_handle - self.sdk_handle = initialize_sdk_handle() - if self.sdk_handle is None: - logger.log_error('Failed to open SDK handle') - else: - self.deinitialize_sdk_handle = deinitialize_sdk_handle - return self.sdk_handle + psu = FixedPsu(index) + self._psu_list.append(psu) + def get_num_psus(self): + """ + Retrieves the number of power supply units available on this chassis - def initialize_thermals(self): - from sonic_platform.thermal import initialize_chassis_thermals - # Initialize thermals - initialize_chassis_thermals(self.platform_name, self._thermal_list) + Returns: + An integer, the number of power supply units available on this + chassis + """ + self.initialize_psu() + return len(self._psu_list) + def get_all_psus(self): + """ + Retrieves all power supply units available on this chassis - def initialize_eeprom(self): - from .eeprom import Eeprom - # Initialize EEPROM - self._eeprom = Eeprom() - # Get chassis name and model from eeprom - self.name = self._eeprom.get_product_name() - self.model = self._eeprom.get_part_number() + Returns: + A list of objects derived from PsuBase representing all power + supply units available on this chassis + """ + self.initialize_psu() + return self._psu_list + def get_psu(self, index): + """ + Retrieves power supply unit represented by (0-based) index - def initialize_components(self): - # Initialize component list - from sonic_platform.component import ComponentONIE, ComponentSSD, ComponentBIOS, ComponentCPLD - self._component_list.append(ComponentONIE()) - self._component_list.append(ComponentSSD()) - self._component_list.append(ComponentBIOS()) - self._component_list.extend(ComponentCPLD.get_component_list()) + Args: + index: An integer, the index (0-based) of the power supply unit to + retrieve - def initizalize_system_led(self): - from .led import SystemLed - Chassis._led = SystemLed() + Returns: + An object dervied from PsuBase representing the specified power + supply unit + """ + self.initialize_psu() + return super(Chassis, self).get_psu(index) + ############################################## + # Fan methods + ############################################## - def get_name(self): - """ - Retrieves the name of the device + def initialize_fan(self): + if not self._fan_drawer_list: + from .fan import Fan + from .fan_drawer import RealDrawer, VirtualDrawer + + hot_swapable = DeviceDataManager.is_fan_hotswapable() + drawer_num = DeviceDataManager.get_fan_drawer_count() + fan_num = DeviceDataManager.get_fan_count() + fan_num_per_drawer = fan_num // drawer_num + drawer_ctor = RealDrawer if hot_swapable else VirtualDrawer + fan_index = 0 + for drawer_index in range(drawer_num): + drawer = drawer_ctor(drawer_index) + self._fan_drawer_list.append(drawer) + for index in range(fan_num_per_drawer): + fan = Fan(fan_index, drawer, index + 1) + fan_index += 1 + drawer._fan_list.append(fan) + + def get_num_fan_drawers(self): + """ + Retrieves the number of fan drawers available on this chassis Returns: - string: The name of the device + An integer, the number of fan drawers available on this chassis """ - return self.name - + return DeviceDataManager.get_fan_drawer_count() - def get_model(self): + def get_all_fan_drawers(self): """ - Retrieves the model number (or part number) of the device + Retrieves all fan drawers available on this chassis Returns: - string: Model/part number of device + A list of objects derived from FanDrawerBase representing all fan + drawers available on this chassis """ - return self.model + self.initialize_fan() + return self._fan_drawer_list - def get_revision(self): + def get_fan_drawer(self, index): """ - Retrieves the hardware revision of the device - + Retrieves fan drawers represented by (0-based) index + + Args: + index: An integer, the index (0-based) of the fan drawer to + retrieve + Returns: - string: Revision value of device + An object dervied from FanDrawerBase representing the specified fan + drawer """ - if self.dmi_data is None: - self.dmi_data = self._parse_dmi(DMI_FILE) + self.initialize_fan() + return super(Chassis, self).get_fan_drawer(index) - return self.dmi_data.get(DMI_VERSION, "N/A") - ############################################## # SFP methods ############################################## + + def initialize_single_sfp(self, index): + sfp_count = self.get_num_sfps() + if index < sfp_count: + if not self._sfp_list: + self._sfp_list = [None] * sfp_count + + if not self._sfp_list[index]: + from .sfp import SFP + self._sfp_list[index] = SFP(index) + self.sfp_initialized_count += 1 + + def initialize_sfp(self): + if not self._sfp_list: + from .sfp import SFP + sfp_count = self.get_num_sfps() + for index in range(sfp_count): + sfp_module = SFP(index) + self._sfp_list.append(sfp_module) + self.sfp_initialized_count = sfp_count + elif self.sfp_initialized_count != len(self._sfp_list): + from .sfp import SFP + for index in range(len(self._sfp_list)): + if self._sfp_list[index] is None: + self._sfp_list[index] = SFP(index) + self.sfp_initialized_count = len(self._sfp_list) + def get_num_sfps(self): """ Retrieves the number of sfps available on this chassis @@ -280,24 +266,19 @@ def get_num_sfps(self): Returns: An integer, the number of sfps available on this chassis """ - if not self.sfp_module_full_initialized: - self.initialize_sfp() - return len(self._sfp_list) - + return DeviceDataManager.get_sfp_count() def get_all_sfps(self): """ Retrieves all sfps available on this chassis Returns: - A list of objects derived from SfpBase representing all sfps + A list of objects derived from SfpBase representing all sfps available on this chassis """ - if not self.sfp_module_full_initialized: - self.initialize_sfp() + self.initialize_sfp() return self._sfp_list - def get_sfp(self, index): """ Retrieves sfp represented by (1-based) index @@ -311,69 +292,182 @@ def get_sfp(self, index): Returns: An object dervied from SfpBase representing the specified sfp """ - sfp = None - index -= 1 + index = index - 1 + self.initialize_single_sfp(index) + return super(Chassis, self).get_sfp(index) - try: - if not self.sfp_module_partial_initialized: - self.initialize_sfp(index) - - sfp = self._sfp_list[index] - if not sfp: - self.initialize_single_sfp(index) - sfp = self._sfp_list[index] - except IndexError: - sys.stderr.write("SFP index {} out of range (0-{})\n".format( - index, len(self._sfp_list)-1)) - - return sfp - - - def _extract_num_of_fans_and_fan_drawers(self): - num_of_fan = 0 - num_of_drawer = 0 - for f in listdir(self.fan_path): - if isfile(join(self.fan_path, f)): - match_obj = re.match('fan(\d+)_speed_get', f) - if match_obj != None: - if int(match_obj.group(1)) > num_of_fan: - num_of_fan = int(match_obj.group(1)) - else: - match_obj = re.match('fan(\d+)_status', f) - if match_obj != None and int(match_obj.group(1)) > num_of_drawer: - num_of_drawer = int(match_obj.group(1)) + def get_change_event(self, timeout=0): + """ + Returns a nested dictionary containing all devices which have + experienced a change at chassis level - return num_of_fan, num_of_drawer + Args: + timeout: Timeout in milliseconds (optional). If timeout == 0, + this method will block until a change is detected. - def _get_port_position_tuple_by_platform_name(self): - position_tuple = port_position_tuple_list[platform_dict_port[self.platform_name]] - return position_tuple + Returns: + (bool, dict): + - True if call successful, False if not; + - A nested dictionary where key is a device type, + value is a dictionary with key:value pairs in the format of + {'device_id':'device_event'}, + where device_id is the device ID for this device and + device_event, + status='1' represents device inserted, + status='0' represents device removed. + Ex. {'fan':{'0':'0', '2':'1'}, 'sfp':{'11':'0'}} + indicates that fan 0 has been removed, fan 2 + has been inserted and sfp 11 has been removed. + """ + self.initialize_sfp() + # Initialize SFP event first + if not self.sfp_event: + from .sfp_event import sfp_event + self.sfp_event = sfp_event() + self.sfp_event.initialize() + wait_for_ever = (timeout == 0) + port_dict = {} + error_dict = {} + if wait_for_ever: + timeout = MAX_SELECT_DELAY + while True: + status = self.sfp_event.check_sfp_status(port_dict, error_dict, timeout) + if bool(port_dict): + break + else: + status = self.sfp_event.check_sfp_status(port_dict, error_dict, timeout) - def get_watchdog(self): + if status: + self.reinit_sfps(port_dict) + result_dict = {'sfp':port_dict} + if error_dict: + result_dict['sfp_error'] = error_dict + return True, result_dict + else: + return True, {'sfp':{}} + + def reinit_sfps(self, port_dict): """ - Retrieves hardware watchdog device on this chassis + Re-initialize SFP if there is any newly inserted SFPs + :param port_dict: SFP event data + :return: + """ + from . import sfp + for index, status in port_dict.items(): + if status == sfp.SFP_STATUS_INSERTED: + try: + self._sfp_list[index - 1].reinit() + except Exception as e: + logger.log_error("Fail to re-initialize SFP {} - {}".format(index, repr(e))) + + def _show_capabilities(self): + """ + This function is for debug purpose + Some features require a xSFP module to support some capabilities but it's unrealistic to + check those modules one by one. + So this function is introduce to show some capabilities of all xSFP modules mounted on the device. + """ + self.initialize_sfp() + for s in self._sfp_list: + try: + print("index {} tx disable {} dom {} calibration {} temp {} volt {} power (tx {} rx {})".format(s.index, + s.dom_tx_disable_supported, + s.dom_supported, + s.calibration, + s.dom_temp_supported, + s.dom_volt_supported, + s.dom_rx_power_supported, + s.dom_tx_power_supported + )) + except: + print("fail to retrieve capabilities for module index {}".format(s.index)) + + ############################################## + # THERMAL methods + ############################################## + + def initialize_thermals(self): + if not self._thermal_list: + from .thermal import initialize_chassis_thermals + # Initialize thermals + self._thermal_list = initialize_chassis_thermals() + + def get_num_thermals(self): + """ + Retrieves the number of thermals available on this chassis + + Returns: + An integer, the number of thermals available on this chassis + """ + self.initialize_thermals() + return len(self._thermal_list) + + def get_all_thermals(self): + """ + Retrieves all thermals available on this chassis + + Returns: + A list of objects derived from ThermalBase representing all thermals + available on this chassis + """ + self.initialize_thermals() + return self._thermal_list + + def get_thermal(self, index): + """ + Retrieves thermal unit represented by (0-based) index + + Args: + index: An integer, the index (0-based) of the thermal to + retrieve + + Returns: + An object dervied from ThermalBase representing the specified thermal + """ + self.initialize_thermals() + return super(Chassis, self).get_thermal(index) + + ############################################## + # EEPROM methods + ############################################## + + def initialize_eeprom(self): + if not self._eeprom: + from .eeprom import Eeprom + # Initialize EEPROM + self._eeprom = Eeprom() + + def get_eeprom(self): + """ + Retreives eeprom device on this chassis Returns: An object derived from WatchdogBase representing the hardware - watchdog device + eeprom device + """ + self.initialize_eeprom() + return self._eeprom - Note: - We overload this method to ensure that watchdog is only initialized - when it is referenced. Currently, only one daemon can open the watchdog. - To initialize watchdog in the constructor causes multiple daemon - try opening watchdog when loading and constructing a chassis object - and fail. By doing so we can eliminate that risk. + def get_name(self): """ - try: - if self._watchdog is None: - from sonic_platform.watchdog import get_watchdog - self._watchdog = get_watchdog() - except Exception as e: - logger.log_info("Fail to load watchdog due to {}".format(repr(e))) + Retrieves the name of the device - return self._watchdog + Returns: + string: The name of the device + """ + self.initialize_eeprom() + return self._eeprom.get_product_name() + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + self.initialize_eeprom() + return self._eeprom.get_part_number() def get_base_mac(self): """ @@ -383,9 +477,9 @@ def get_base_mac(self): A string containing the MAC address in the format 'XX:XX:XX:XX:XX:XX' """ + self.initialize_eeprom() return self._eeprom.get_base_mac() - def get_serial(self): """ Retrieves the hardware serial number for the chassis @@ -393,9 +487,9 @@ def get_serial(self): Returns: A string containing the hardware serial number for this chassis. """ + self.initialize_eeprom() return self._eeprom.get_serial_number() - def get_system_eeprom_info(self): """ Retrieves the full content of system EEPROM information for the chassis @@ -405,23 +499,128 @@ def get_system_eeprom_info(self): OCP ONIE TlvInfo EEPROM format and values are their corresponding values. """ + self.initialize_eeprom() return self._eeprom.get_system_eeprom_info() + ############################################## + # Component methods + ############################################## + + def initialize_components(self): + if not utils.is_host(): + return + if not self._component_list: + # Initialize component list + from .component import ComponentONIE, ComponentSSD, ComponentBIOS, ComponentCPLD + self._component_list.append(ComponentONIE()) + self._component_list.append(ComponentSSD()) + self._component_list.append(ComponentBIOS()) + self._component_list.extend(ComponentCPLD.get_component_list()) + + def get_num_components(self): + """ + Retrieves the number of components available on this chassis + + Returns: + An integer, the number of components available on this chassis + """ + self.initialize_components() + return len(self._component_list) + + def get_all_components(self): + """ + Retrieves all components available on this chassis + + Returns: + A list of objects derived from ComponentBase representing all components + available on this chassis + """ + self.initialize_components() + return self._component_list + + def get_component(self, index): + """ + Retrieves component represented by (0-based) index + + Args: + index: An integer, the index (0-based) of the component to retrieve + + Returns: + An object dervied from ComponentBase representing the specified component + """ + self.initialize_components() + return super(Chassis, self).get_component(index) + + ############################################## + # System LED methods + ############################################## + + def initizalize_system_led(self): + if not Chassis._led: + from .led import SystemLed + Chassis._led = SystemLed() - def _read_generic_file(self, filename, len): + def set_status_led(self, color): """ - Read a generic file, returns the contents of the file + Sets the state of the system LED + + Args: + color: A string representing the color with which to set the + system LED + + Returns: + bool: True if system LED state is set successfully, False if not + """ + self.initizalize_system_led() + return False if not Chassis._led else Chassis._led.set_status(color) + + def get_status_led(self): + """ + Gets the state of the system LED + + Returns: + A string, one of the valid LED color strings which could be vendor + specified. + """ + self.initizalize_system_led() + return None if not Chassis._led else Chassis._led.get_status() + + def get_watchdog(self): + """ + Retrieves hardware watchdog device on this chassis + + Returns: + An object derived from WatchdogBase representing the hardware + watchdog device + + Note: + We overload this method to ensure that watchdog is only initialized + when it is referenced. Currently, only one daemon can open the watchdog. + To initialize watchdog in the constructor causes multiple daemon + try opening watchdog when loading and constructing a chassis object + and fail. By doing so we can eliminate that risk. """ - result = '' try: - fileobj = io.open(filename) - result = fileobj.read(len) - fileobj.close() - return result + if self._watchdog is None: + from .watchdog import get_watchdog + self._watchdog = get_watchdog() except Exception as e: - logger.log_info("Fail to read file {} due to {}".format(filename, repr(e))) - return '0' + logger.log_info("Fail to load watchdog due to {}".format(repr(e))) + + return self._watchdog + + + def get_revision(self): + """ + Retrieves the hardware revision of the device + + Returns: + string: Revision value of device + """ + if self.dmi_data is None: + self.dmi_data = self._parse_dmi(DMI_FILE) + return self.dmi_data.get(DMI_VERSION, "N/A") def _parse_dmi(self, filename): """ @@ -432,9 +631,8 @@ def _parse_dmi(self, filename): """ result = {} try: - fileobj = open(filename, "rb") - data = fileobj.read() - fileobj.close() + with open(filename, "rb") as fileobj: + data = fileobj.read() body = data[DMI_HEADER_LEN:] records = body.split(b'\x00') @@ -447,15 +645,13 @@ def _parse_dmi(self, filename): return result - def _verify_reboot_cause(self, filename): ''' - Open and read the reboot cause file in + Open and read the reboot cause file in /var/run/hwmanagement/system (which is defined as REBOOT_CAUSE_ROOT) If a reboot cause file doesn't exists, returns '0'. ''' - return bool(int(self._read_generic_file(join(REBOOT_CAUSE_ROOT, filename), REBOOT_CAUSE_FILE_LENGTH).rstrip('\n'))) - + return bool(utils.read_int_from_file(os.path.join(REBOOT_CAUSE_ROOT, filename), log_func=None)) def initialize_reboot_cause(self): self.reboot_major_cause_dict = { @@ -482,7 +678,6 @@ def initialize_reboot_cause(self): self.reboot_by_software = 'reset_sw_reset' self.reboot_cause_initialized = True - def get_reboot_cause(self): """ Retrieves the cause of the previous reboot @@ -513,139 +708,161 @@ def get_reboot_cause(self): return self.REBOOT_CAUSE_NON_HARDWARE, '' + def get_thermal_manager(self): + from .thermal_manager import ThermalManager + return ThermalManager - def _show_capabilities(self): + def get_position_in_parent(self): """ - This function is for debug purpose - Some features require a xSFP module to support some capabilities but it's unrealistic to - check those modules one by one. - So this function is introduce to show some capabilities of all xSFP modules mounted on the device. + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): """ - for s in self._sfp_list: - try: - print("index {} tx disable {} dom {} calibration {} temp {} volt {} power (tx {} rx {})".format(s.index, - s.dom_tx_disable_supported, - s.dom_supported, - s.calibration, - s.dom_temp_supported, - s.dom_volt_supported, - s.dom_rx_power_supported, - s.dom_tx_power_supported - )) - except: - print("fail to retrieve capabilities for module index {}".format(s.index)) + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False - def get_change_event(self, timeout=0): - """ - Returns a nested dictionary containing all devices which have - experienced a change at chassis level +class ModularChassis(Chassis): + def __init__(self): + super(ModularChassis, self).__init__() + self.module_initialized_count = 0 - Args: - timeout: Timeout in milliseconds (optional). If timeout == 0, - this method will block until a change is detected. + def is_modular_chassis(self): + """ + Retrieves whether the sonic instance is part of modular chassis Returns: - (bool, dict): - - True if call successful, False if not; - - A nested dictionary where key is a device type, - value is a dictionary with key:value pairs in the format of - {'device_id':'device_event'}, - where device_id is the device ID for this device and - device_event, - status='1' represents device inserted, - status='0' represents device removed. - Ex. {'fan':{'0':'0', '2':'1'}, 'sfp':{'11':'0'}} - indicates that fan 0 has been removed, fan 2 - has been inserted and sfp 11 has been removed. + A bool value, should return False by default or for fixed-platforms. + Should return True for supervisor-cards, line-cards etc running as part + of modular-chassis. """ - # Initialize SFP event first - if not self.sfp_event_initialized: - from sonic_platform.sfp_event import sfp_event - self.sfp_event = sfp_event() - self.sfp_event.initialize() - self.MAX_SELECT_EVENT_RETURNED = self.PORT_END - self.sfp_event_initialized = True + return True - wait_for_ever = (timeout == 0) - port_dict = {} - error_dict = {} - if wait_for_ever: - timeout = MAX_SELECT_DELAY - while True: - status = self.sfp_event.check_sfp_status(port_dict, error_dict, timeout) - if bool(port_dict): - break - else: - status = self.sfp_event.check_sfp_status(port_dict, error_dict, timeout) + ############################################## + # Module methods + ############################################## + def initialize_single_module(self, index): + count = self.get_num_modules() + if index < count: + if not self._module_list: + self._module_list = [None] * count + + if not self._module_list[index]: + from .module import Module + self._module_list[index] = Module(index + 1) + self.module_initialized_count += 1 + + def initialize_modules(self): + if not self._module_list: + from .module import Module + count = self.get_num_modules() + for index in range(1, count + 1): + self._module_list.append(Module(index)) + self.module_initialized_count = count + elif self.module_initialized_count != len(self._module_list): + from .module import Module + for index in range(len(self._module_list)): + if self._module_list[index] is None: + self._module_list[index] = Module(index + 1) + self.module_initialized_count = len(self._module_list) + + def get_num_modules(self): + """ + Retrieves the number of modules available on this chassis - if status: - self.reinit_sfps(port_dict) - result_dict = {'sfp':port_dict} - if error_dict: - result_dict['sfp_error'] = error_dict - return True, result_dict - else: - return True, {'sfp':{}} + Returns: + An integer, the number of modules available on this chassis + """ + return DeviceDataManager.get_linecard_count() - def reinit_sfps(self, port_dict): + def get_all_modules(self): """ - Re-initialize SFP if there is any newly inserted SFPs - :param port_dict: SFP event data - :return: + Retrieves all modules available on this chassis + + Returns: + A list of objects derived from ModuleBase representing all + modules available on this chassis """ - # SFP not initialize yet, do nothing - if not self.sfp_module_full_initialized: - return + self.initialize_modules() + return self._module_list - from . import sfp - for index, status in port_dict.items(): - if status == sfp.SFP_STATUS_INSERTED: - try: - self.get_sfp(index).reinit() - except Exception as e: - logger.log_error("Fail to re-initialize SFP {} - {}".format(index, repr(e))) + def get_module(self, index): + """ + Retrieves module represented by (0-based) index - def get_thermal_manager(self): - from .thermal_manager import ThermalManager - return ThermalManager + Args: + index: An integer, the index (0-based) of the module to + retrieve - def set_status_led(self, color): + Returns: + An object dervied from ModuleBase representing the specified + module """ - Sets the state of the system LED + self.initialize_single_module(index) + return super(ModularChassis, self).get_module(index) + + @utils.default_return(-1) + def get_module_index(self, module_name): + """ + Retrieves module index from the module name Args: - color: A string representing the color with which to set the - system LED + module_name: A string, prefixed by SUPERVISOR, LINE-CARD or FABRIC-CARD + Ex. SUPERVISOR0, LINE-CARD1, FABRIC-CARD5 Returns: - bool: True if system LED state is set successfully, False if not + An integer, the index of the ModuleBase object in the module_list """ - return False if not Chassis._led else Chassis._led.set_status(color) + return int(module_name[len('LINE-CARD')-1:]) - def get_status_led(self): + ############################################## + # SFP methods + ############################################## + + def get_num_sfps(self): """ - Gets the state of the system LED + Retrieves the number of sfps available on this chassis Returns: - A string, one of the valid LED color strings which could be vendor - specified. + An integer, the number of sfps available on this chassis """ - return None if not Chassis._led else Chassis._led.get_status() + return reduce(lambda x, y: x + y, (x.get_num_sfps() for x in self.get_all_modules())) - def get_position_in_parent(self): + def get_all_sfps(self): """ - Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position - for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned - Returns: - integer: The 1-based relative physical position in parent device or -1 if cannot determine the position - """ - return -1 + Retrieves all sfps available on this chassis - def is_replaceable(self): + Returns: + A list of objects derived from SfpBase representing all sfps + available on this chassis """ - Indicate whether this device is replaceable. + return reduce(lambda x, y: x + y, (x.get_all_sfps() for x in self.get_all_modules())) + + def get_sfp(self, index): + """ + Retrieves sfp represented by (1-based) index + + Args: + index: An integer, the index (1-based) of the sfp to retrieve. + The index should be the sequence of a physical port in a chassis, + starting from 1. + For example, 1 for Ethernet0, 2 for Ethernet4 and so on. + Returns: - bool: True if it is replaceable. + An object dervied from SfpBase representing the specified sfp """ - return False + sfp_index = index % DeviceDataManager.get_linecard_max_port_count() - 1 + slot_id = int((index - sfp_index - 1) / 16) + 1 + module = self.get_module(slot_id - 1) + if not module: + return None + + return module.get_sfp(sfp_index - 1) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/component.py b/platform/mellanox/mlnx-platform-api/sonic_platform/component.py index 0e7a024cca14..d2820090798b 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/component.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/component.py @@ -1,3 +1,19 @@ +# +# Copyright (c) 2019-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################# # Mellanox # @@ -18,11 +34,16 @@ else: import ConfigParser as configparser + from shutil import copyfile + from sonic_platform_base.component_base import ComponentBase, \ FW_AUTO_INSTALLED, \ + FW_AUTO_UPDATED, \ + FW_AUTO_SCHEDULED, \ FW_AUTO_ERR_BOOT_TYPE, \ FW_AUTO_ERR_IMAGE, \ - FW_AUTO_ERR_UKNOWN + FW_AUTO_ERR_UNKNOWN + except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -103,6 +124,7 @@ class ONIEUpdater(object): ONIE_FW_UPDATE_CMD_ADD = '/usr/bin/mlnx-onie-fw-update.sh add {}' ONIE_FW_UPDATE_CMD_REMOVE = '/usr/bin/mlnx-onie-fw-update.sh remove {}' ONIE_FW_UPDATE_CMD_UPDATE = '/usr/bin/mlnx-onie-fw-update.sh update' + ONIE_FW_UPDATE_CMD_INSTALL = '/usr/bin/mlnx-onie-fw-update.sh update --no-reboot' ONIE_FW_UPDATE_CMD_SHOW_PENDING = '/usr/bin/mlnx-onie-fw-update.sh show-pending' ONIE_VERSION_PARSE_PATTERN = '([0-9]{4})\.([0-9]{2})-([0-9]+)\.([0-9]+)\.([0-9]+)-([0-9]+)' @@ -114,6 +136,18 @@ class ONIEUpdater(object): ONIE_IMAGE_INFO_COMMAND = '/bin/bash {} -q -i' + BIOS_UPDATE_FILE_EXT = '.rom' + + def __add_prefix(self, image_path): + if self.BIOS_UPDATE_FILE_EXT not in image_path: + rename_path = "/tmp/00-{}".format(os.path.basename(image_path)) + else: + rename_path = "/tmp/99-{}".format(os.path.basename(image_path)) + + copyfile(image_path, rename_path) + + return rename_path + def __mount_onie_fs(self): fs_mountpoint = '/mnt/onie-fs' onie_path = '/lib/onie' @@ -122,9 +156,9 @@ def __mount_onie_fs(self): self.__umount_onie_fs() cmd = "fdisk -l | grep 'ONIE boot' | awk '{print $1}'" - fs_path = subprocess.check_output(cmd, - stderr=subprocess.STDOUT, - shell=True, + fs_path = subprocess.check_output(cmd, + stderr=subprocess.STDOUT, + shell=True, universal_newlines=True).rstrip('\n') os.mkdir(fs_mountpoint) @@ -151,7 +185,9 @@ def __umount_onie_fs(self): os.rmdir(fs_mountpoint) def __stage_update(self, image_path): - cmd = self.ONIE_FW_UPDATE_CMD_ADD.format(image_path) + rename_path = self.__add_prefix(image_path) + + cmd = self.ONIE_FW_UPDATE_CMD_ADD.format(rename_path) try: subprocess.check_call(cmd.split(), universal_newlines=True) @@ -159,15 +195,20 @@ def __stage_update(self, image_path): raise RuntimeError("Failed to stage firmware update: {}".format(str(e))) def __unstage_update(self, image_path): - cmd = self.ONIE_FW_UPDATE_CMD_REMOVE.format(os.path.basename(image_path)) + rename_path = self.__add_prefix(image_path) + + cmd = self.ONIE_FW_UPDATE_CMD_REMOVE.format(os.path.basename(rename_path)) try: subprocess.check_call(cmd.split(), universal_newlines=True) except subprocess.CalledProcessError as e: raise RuntimeError("Failed to unstage firmware update: {}".format(str(e))) - def __trigger_update(self): - cmd = self.ONIE_FW_UPDATE_CMD_UPDATE + def __trigger_update(self, allow_reboot): + if allow_reboot: + cmd = self.ONIE_FW_UPDATE_CMD_UPDATE + else: + cmd = self.ONIE_FW_UPDATE_CMD_INSTALL try: subprocess.check_call(cmd.split(), universal_newlines=True) @@ -178,13 +219,14 @@ def __is_update_staged(self, image_path): cmd = self.ONIE_FW_UPDATE_CMD_SHOW_PENDING try: - output = subprocess.check_output(cmd.split(), - stderr=subprocess.STDOUT, + output = subprocess.check_output(cmd.split(), + stderr=subprocess.STDOUT, universal_newlines=True).rstrip('\n') except subprocess.CalledProcessError as e: raise RuntimeError("Failed to get pending firmware updates: {}".format(str(e))) - basename = os.path.basename(image_path) + rename_path = self.__add_prefix(image_path) + basename = os.path.basename(rename_path) for line in output.splitlines(): if line.startswith(basename): @@ -265,8 +307,8 @@ def get_onie_firmware_info(self, image_path): cmd = self.ONIE_IMAGE_INFO_COMMAND.format(image_path) try: - output = subprocess.check_output(cmd.split(), - stderr=subprocess.STDOUT, + output = subprocess.check_output(cmd.split(), + stderr=subprocess.STDOUT, universal_newlines=True).rstrip('\n') except subprocess.CalledProcessError as e: raise RuntimeError("Failed to get ONIE firmware info: {}".format(str(e))) @@ -283,29 +325,11 @@ def get_onie_firmware_info(self, image_path): return firmware_info - def update_firmware(self, image_path): - cmd = self.ONIE_FW_UPDATE_CMD_SHOW_PENDING - - try: - output = subprocess.check_output(cmd.split(), - stderr=subprocess.STDOUT, - universal_newlines=True).rstrip('\n') - except subprocess.CalledProcessError as e: - raise RuntimeError("Failed to get pending firmware updates: {}".format(str(e))) - - no_pending_updates = False - - for line in output.splitlines(): - if line.startswith(self.ONIE_NO_PENDING_UPDATES_ATTR): - no_pending_updates = True - break - - if not no_pending_updates: - raise RuntimeError("Failed to complete firmware update: pending updates are present") + def update_firmware(self, image_path, allow_reboot=True): try: self.__stage_update(image_path) - self.__trigger_update() + self.__trigger_update(allow_reboot) except: if self.__is_update_staged(image_path): self.__unstage_update(image_path) @@ -343,22 +367,21 @@ def auto_update_firmware(self, image_path, boot_action): if boot_action is fast. """ - default_supported_boot = ['cold'] - # Verify image path exists if not os.path.exists(image_path): # Invalid image path return FW_AUTO_ERR_IMAGE - if boot_action in default_supported_boot: - if self.install_firmware(image_path): - # Successful update - return FW_AUTO_INSTALLED - # Failed update (unknown reason) - return FW_AUTO_ERR_UKNOWN - # boot_type did not match (skip) - return FW_AUTO_ERR_BOOT_TYPE + if boot_action != "cold": + return FW_AUTO_ERR_BOOT_TYPE + + # Install firmware + if not self.install_firmware(image_path, allow_reboot=False): + return FW_AUTO_ERR_UNKNOWN + + # Installed pending next reboot + return FW_AUTO_INSTALLED @staticmethod def _read_generic_file(filename, len, ignore_errors=False): @@ -379,10 +402,10 @@ def _read_generic_file(filename, len, ignore_errors=False): @staticmethod def _get_command_result(cmdline): try: - proc = subprocess.Popen(cmdline, - stdout=subprocess.PIPE, - shell=True, - stderr=subprocess.STDOUT, + proc = subprocess.Popen(cmdline, + stdout=subprocess.PIPE, + shell=True, + stderr=subprocess.STDOUT, universal_newlines=True) stdout = proc.communicate()[0] rc = proc.wait() @@ -405,10 +428,6 @@ def _check_file_validity(self, image_path): if name_list[1] != self.image_ext_name: print("ERROR: Extend name of file {} is wrong. Image for {} should have extend name {}".format(image_path, self.name, self.image_ext_name)) return False - else: - if name_list[1]: - print("ERROR: Extend name of file {} is wrong. Image for {} shouldn't have extension".format(image_path, self.name)) - return False return True @@ -426,13 +445,13 @@ def __init__(self): self.description = self.COMPONENT_DESCRIPTION self.onie_updater = ONIEUpdater() - def __install_firmware(self, image_path): + def __install_firmware(self, image_path, allow_reboot=True): if not self._check_file_validity(image_path): return False try: print("INFO: Staging {} firmware update with ONIE updater".format(self.name)) - self.onie_updater.update_firmware(image_path) + self.onie_updater.update_firmware(image_path, allow_reboot) except Exception as e: print("ERROR: Failed to update {} firmware: {}".format(self.name, str(e))) return False @@ -452,8 +471,8 @@ def get_available_firmware_version(self, image_path): def get_firmware_update_notification(self, image_path): return "Immediate cold reboot is required to complete {} firmware update".format(self.name) - def install_firmware(self, image_path): - return self.__install_firmware(image_path) + def install_firmware(self, image_path, allow_reboot=True): + return self.__install_firmware(image_path, allow_reboot) def update_firmware(self, image_path): self.__install_firmware(image_path) @@ -471,6 +490,7 @@ class ComponentSSD(Component): SSD_INFO_COMMAND = "/usr/bin/mlnx-ssd-fw-update.sh -q" SSD_FIRMWARE_INFO_COMMAND = "/usr/bin/mlnx-ssd-fw-update.sh -q -i {}" + SSD_FIRMWARE_INSTALL_COMMAND = "/usr/bin/mlnx-ssd-fw-update.sh --no-power-cycle -y -u -i {}" SSD_FIRMWARE_UPDATE_COMMAND = "/usr/bin/mlnx-ssd-fw-update.sh -y -u -i {}" def __init__(self): @@ -480,11 +500,14 @@ def __init__(self): self.description = self.COMPONENT_DESCRIPTION self.image_ext_name = self.COMPONENT_FIRMWARE_EXTENSION - def __install_firmware(self, image_path): + def __install_firmware(self, image_path, allow_reboot=True): if not self._check_file_validity(image_path): return False - cmd = self.SSD_FIRMWARE_UPDATE_COMMAND.format(image_path) + if allow_reboot: + cmd = self.SSD_FIRMWARE_UPDATE_COMMAND.format(image_path) + else: + cmd = self.SSD_FIRMWARE_INSTALL_COMMAND.format(image_path) try: print("INFO: Installing {} firmware update".format(self.name)) @@ -498,13 +521,10 @@ def __install_firmware(self, image_path): def auto_update_firmware(self, image_path, boot_action): """ Handling of attempted automatic update for a SSD of a Mellanox switch. - Will first check the image_path to determine if a post-install reboot is required, + Will first check the image_path to determine if a post-install reboot is required, then compares it against boot_action to determine whether to proceed with install. """ - # All devices support cold boot - supported_boot = ['cold'] - # Verify image path exists if not os.path.exists(image_path): # Invalid image path @@ -512,29 +532,28 @@ def auto_update_firmware(self, image_path, boot_action): # Check if post_install reboot is required try: - if self.get_firmware_update_notification(image_path) is None: - # No power cycle required - supported_boot += ['warm', 'fast', 'none', 'any'] - except RuntimeError: - # Unknown error from firmware probe - return FW_AUTO_ERR_UKNOWN - - if boot_action in supported_boot: - if self.install_firmware(image_path): - # Successful update - return FW_AUTO_INSTALLED - # Failed update (unknown reason) - return FW_AUTO_ERR_UKNOWN + reboot_required = self.get_firmware_update_notification(image_path) is not None + except RuntimeError as e: + return FW_AUTO_ERR_UNKNOWN + + # Update if no reboot needed + if not reboot_required: + self.update_firmware(image_path) + return FW_AUTO_UPDATED # boot_type did not match (skip) - return FW_AUTO_ERR_BOOT_TYPE + if boot_action != "cold": + return FW_AUTO_ERR_BOOT_TYPE + + # Schedule if we need a cold boot + return FW_AUTO_SCHEDULED def get_firmware_version(self): cmd = self.SSD_INFO_COMMAND try: - output = subprocess.check_output(cmd.split(), - stderr=subprocess.STDOUT, + output = subprocess.check_output(cmd.split(), + stderr=subprocess.STDOUT, universal_newlines=True).rstrip('\n') except subprocess.CalledProcessError as e: raise RuntimeError("Failed to get {} info: {}".format(self.name, str(e))) @@ -549,8 +568,8 @@ def get_available_firmware_version(self, image_path): cmd = self.SSD_FIRMWARE_INFO_COMMAND.format(image_path) try: - output = subprocess.check_output(cmd.split(), - stderr=subprocess.STDOUT, + output = subprocess.check_output(cmd.split(), + stderr=subprocess.STDOUT, universal_newlines=True).rstrip('\n') except subprocess.CalledProcessError as e: raise RuntimeError("Failed to get {} firmware info: {}".format(self.name, str(e))) @@ -584,8 +603,8 @@ def get_firmware_update_notification(self, image_path): cmd = self.SSD_FIRMWARE_INFO_COMMAND.format(image_path) try: - output = subprocess.check_output(cmd.split(), - stderr=subprocess.STDOUT, + output = subprocess.check_output(cmd.split(), + stderr=subprocess.STDOUT, universal_newlines=True).rstrip('\n') except subprocess.CalledProcessError as e: raise RuntimeError("Failed to get {} firmware info: {}".format(self.name, str(e))) @@ -615,8 +634,8 @@ def get_firmware_update_notification(self, image_path): return notification - def install_firmware(self, image_path): - return self.__install_firmware(image_path) + def install_firmware(self, image_path, allow_reboot=True): + return self.__install_firmware(image_path, allow_reboot) def update_firmware(self, image_path): self.__install_firmware(image_path) @@ -637,7 +656,7 @@ def __init__(self): self.image_ext_name = self.COMPONENT_FIRMWARE_EXTENSION self.onie_updater = ONIEUpdater() - def __install_firmware(self, image_path): + def __install_firmware(self, image_path, allow_reboot=True): if not self.onie_updater.is_non_onie_firmware_update_supported(): print("ERROR: ONIE {} or later is required".format(self.onie_updater.get_onie_required_version())) return False @@ -647,7 +666,7 @@ def __install_firmware(self, image_path): try: print("INFO: Staging {} firmware update with ONIE updater".format(self.name)) - self.onie_updater.update_firmware(image_path) + self.onie_updater.update_firmware(image_path, allow_reboot) except Exception as e: print("ERROR: Failed to update {} firmware: {}".format(self.name, str(e))) return False @@ -658,8 +677,8 @@ def get_firmware_version(self): cmd = self.BIOS_VERSION_COMMAND try: - version = subprocess.check_output(cmd.split(), - stderr=subprocess.STDOUT, + version = subprocess.check_output(cmd.split(), + stderr=subprocess.STDOUT, universal_newlines=True).rstrip('\n') except subprocess.CalledProcessError as e: raise RuntimeError("Failed to get {} version: {}".format(self.name, str(e))) @@ -672,8 +691,8 @@ def get_available_firmware_version(self, image_path): def get_firmware_update_notification(self, image_path): return "Immediate cold reboot is required to complete {} firmware update".format(self.name) - def install_firmware(self, image_path): - return self.__install_firmware(image_path) + def install_firmware(self, image_path, allow_reboot=True): + return self.__install_firmware(image_path, allow_reboot) def update_firmware(self, image_path): self.__install_firmware(image_path) @@ -744,6 +763,29 @@ def __install_firmware(self, image_path): return True + def auto_update_firmware(self, image_path, boot_action): + """ + Default handling of attempted automatic update for a component of a Mellanox switch. + Will skip the installation if the boot_action is 'warm' or 'fast' and will call update_firmware() + if boot_action is fast. + """ + + # Verify image path exists + if not os.path.exists(image_path): + # Invalid image path + return FW_AUTO_ERR_IMAGE + + # boot_type did not match (skip) + if boot_action != "cold": + return FW_AUTO_ERR_BOOT_TYPE + + # Install burn. Error if fail. + if not self.install_firmware(image_path): + return FW_AUTO_ERR_UNKNOWN + + # Schedule refresh + return FW_AUTO_SCHEDULED + def get_firmware_version(self): part_number_file = self.CPLD_PART_NUMBER_FILE.format(self.idx) version_file = self.CPLD_VERSION_FILE.format(self.idx) @@ -780,7 +822,17 @@ def get_firmware_update_notification(self, image_path): return "Immediate power cycle is required to complete {} firmware update".format(self.name) def install_firmware(self, image_path): - return self.__install_firmware(image_path) + if MPFAManager.MPFA_EXTENSION in image_path: + with MPFAManager(image_path) as mpfa: + if not mpfa.get_metadata().has_option('firmware', 'burn'): + raise RuntimeError("Failed to get {} burn firmware".format(self.name)) + + burn_firmware = mpfa.get_metadata().get('firmware', 'burn') + + print("INFO: Processing {} burn file: firmware install".format(self.name)) + return self.__install_firmware(os.path.join(mpfa.get_path(), burn_firmware)) + else: + return self.__install_firmware(image_path) def update_firmware(self, image_path): with MPFAManager(image_path) as mpfa: diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/cpu_thermal_control.py b/platform/mellanox/mlnx-platform-api/sonic_platform/cpu_thermal_control.py new file mode 100644 index 000000000000..f86a5b09fe07 --- /dev/null +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/cpu_thermal_control.py @@ -0,0 +1,70 @@ +# +# Copyright (c) 2019-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +############################################################################# +# Mellanox +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Chassis information which are available in the platform +# +############################################################################# + +from sonic_py_common.task_base import ThreadTaskBase + +from . import utils +from .device_data import DeviceDataManager + + +class CPUThermalControl(ThreadTaskBase): + CPU_COOLING_STATE = '/var/run/hw-management/thermal/cooling2_cur_state' + CPU_TEMP_FILE = '/var/run/hw-management/thermal/cpu_pack' + MAX_COOLING_STATE = 10 + MIN_COOLING_STATE = 2 + INTERVAL = 3 + + def __init__(self): + super(CPUThermalControl, self).__init__() + self.temp_low, self.temp_high = DeviceDataManager.get_cpu_thermal_threshold() + + def task_worker(self): + last_temp = 0 + while not self.task_stopping_event.wait(self.INTERVAL): + last_temp = self.run(last_temp) + + def run(self, last_temp): + current_temp = self.read_cpu_temp() + if current_temp < self.temp_low: + self.set_cooling_state(self.MIN_COOLING_STATE) + elif current_temp > self.temp_high: + self.set_cooling_state(self.MAX_COOLING_STATE) + else: + cooling_state = self.get_cooling_state() + if current_temp > last_temp: + self.set_cooling_state(min(cooling_state + 1, self.MAX_COOLING_STATE)) + elif current_temp < last_temp: + self.set_cooling_state(max(cooling_state - 1, self.MIN_COOLING_STATE)) + return current_temp + + def set_cooling_state(self, state): + utils.write_file(self.CPU_COOLING_STATE, state, log_func=None) + + def get_cooling_state(self): + return utils.read_int_from_file(self.CPU_COOLING_STATE, default=self.MAX_COOLING_STATE, log_func=None) + + def read_cpu_temp(self): + cpu_temp = utils.read_int_from_file(self.CPU_TEMP_FILE, default=self.temp_high, log_func=None) + return cpu_temp if cpu_temp <= 1000 else int(cpu_temp / 1000) + \ No newline at end of file diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/device_data.py b/platform/mellanox/mlnx-platform-api/sonic_platform/device_data.py index e1124d0d55e3..cd909231d1bc 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/device_data.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/device_data.py @@ -1,23 +1,36 @@ +# +# Copyright (c) 2020-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import glob +import os +from sonic_py_common import device_info + +from . import utils + DEVICE_DATA = { 'x86_64-mlnx_msn2700-r0': { 'thermal': { 'minimum_table': { "unk_trust": {"-127:30":13, "31:40":14 , "41:120":15}, "unk_untrust": {"-127:25":13, "26:30":14 , "31:35":15, "36:120":16} + }, + "capability": { + "comex_amb": False } - }, - 'fans': { - 'drawer_num': 4, - 'drawer_type': 'real', - 'fan_num_per_drawer': 2, - 'support_fan_direction': True, - 'hot_swappable': True - }, - 'psus': { - 'psu_num': 2, - 'fan_num_per_psu': 1, - 'hot_swappable': True, - 'led_num': 1 } }, 'x86_64-mlnx_msn2740-r0': { @@ -25,20 +38,11 @@ 'minimum_table': { "unk_trust": {"-127:120":13}, "unk_untrust": {"-127:15":13, "16:25":14 , "26:30":15, "31:120":17}, + }, + "capability": { + "cpu_pack": False, + "comex_amb": False } - }, - 'fans': { - 'drawer_num': 4, - 'drawer_type': 'real', - 'fan_num_per_drawer': 1, - 'support_fan_direction': True, - 'hot_swappable': True - }, - 'psus': { - 'psu_num': 2, - 'fan_num_per_psu': 1, - 'hot_swappable': True, - 'led_num': 1 } }, 'x86_64-mlnx_msn2100-r0': { @@ -46,20 +50,11 @@ 'minimum_table': { "unk_trust": {"-127:40":12, "41:120":13}, "unk_untrust": {"-127:15":12, "16:25":13, "26:30":14, "31:35":15, "36:120":16} + }, + "capability": { + "cpu_pack": False, + "comex_amb": False } - }, - 'fans': { - 'drawer_num': 1, - 'drawer_type': 'virtual', - 'fan_num_per_drawer': 4, - 'support_fan_direction': True, - 'hot_swappable': False - }, - 'psus': { - 'psu_num': 2, - 'fan_num_per_psu': 1, - 'hot_swappable': False, - 'led_num': 2 } }, 'x86_64-mlnx_msn2410-r0': { @@ -67,20 +62,10 @@ 'minimum_table': { "unk_trust": {"-127:30":13, "31:40":14 , "41:120":15}, "unk_untrust": {"-127:25":13, "26:30":14 , "31:35":15, "36:120":16} + }, + "capability": { + "comex_amb": False } - }, - 'fans': { - 'drawer_num': 4, - 'drawer_type': 'real', - 'fan_num_per_drawer': 2, - 'support_fan_direction': True, - 'hot_swappable': True - }, - 'psus': { - 'psu_num': 2, - 'fan_num_per_psu': 1, - 'hot_swappable': True, - 'led_num': 1 } }, 'x86_64-mlnx_msn2010-r0': { @@ -88,20 +73,11 @@ 'minimum_table': { "unk_trust": {"-127:120":12}, "unk_untrust": {"-127:15":12, "16:20":13 , "21:30":14, "31:35":15, "36:120":16} + }, + "capability": { + "cpu_pack": False, + "comex_amb": False } - }, - 'fans': { - 'drawer_num': 1, - 'drawer_type': 'virtual', - 'fan_num_per_drawer': 4, - 'support_fan_direction': True, - 'hot_swappable': False - }, - 'psus': { - 'psu_num': 2, - 'fan_num_per_psu': 1, - 'hot_swappable': False, - 'led_num': 2 } }, 'x86_64-mlnx_msn3700-r0': { @@ -110,19 +86,6 @@ "unk_trust": {"-127:25":12, "26:40":13 , "41:120":14}, "unk_untrust": {"-127:15":12, "16:30":13 , "31:35":14, "36:40":15, "41:120":16}, } - }, - 'fans': { - 'drawer_num': 6, - 'drawer_type': 'real', - 'fan_num_per_drawer': 2, - 'support_fan_direction': True, - 'hot_swappable': True - }, - 'psus': { - 'psu_num': 2, - 'fan_num_per_psu': 1, - 'hot_swappable': True, - 'led_num': 1 } }, 'x86_64-mlnx_msn3700c-r0': { @@ -131,19 +94,6 @@ "unk_trust": {"-127:40":12, "41:120":13}, "unk_untrust": {"-127:10":12, "11:20":13 , "21:30":14, "31:35":15, "36:120":16}, } - }, - 'fans': { - 'drawer_num': 4, - 'drawer_type': 'real', - 'fan_num_per_drawer': 2, - 'support_fan_direction': True, - 'hot_swappable': True - }, - 'psus': { - 'psu_num': 2, - 'fan_num_per_psu': 1, - 'hot_swappable': True, - 'led_num': 1 } }, 'x86_64-mlnx_msn3800-r0': { @@ -152,19 +102,6 @@ "unk_trust": {"-127:30":12, "31:40":13 , "41:120":14}, "unk_untrust": {"-127:0":12, "1:10":13 , "11:15":14, "16:20":15, "21:35":16, "36:120":17}, } - }, - 'fans': { - 'drawer_num': 3, - 'drawer_type': 'real', - 'fan_num_per_drawer': 1, - 'support_fan_direction': True, - 'hot_swappable': True - }, - 'psus': { - 'psu_num': 2, - 'fan_num_per_psu': 1, - 'hot_swappable': True, - 'led_num': 1 } }, 'x86_64-mlnx_msn4700-r0': { @@ -173,40 +110,14 @@ "unk_trust": {"-127:35":14, "36:120":15}, "unk_untrust": {"-127:35":14, "36:120":15}, } - }, - 'fans': { - 'drawer_num': 6, - 'drawer_type': 'real', - 'fan_num_per_drawer': 2, - 'support_fan_direction': True, - 'hot_swappable': True - }, - 'psus': { - 'psu_num': 2, - 'fan_num_per_psu': 1, - 'hot_swappable': True, - 'led_num': 1 } }, 'x86_64-mlnx_msn4410-r0': { 'thermal': { 'minimum_table': { - "unk_trust": {"-127:120":16}, - "unk_untrust": {"-127:120":16}, + "unk_trust": {"-127:40":12, "41:120":13}, + "unk_untrust": {"-127:10":12, "11:20":13, "21:30":14, "31:35":15, "36:120":16}, } - }, - 'fans': { - 'drawer_num': 6, - 'drawer_type': 'real', - 'fan_num_per_drawer': 2, - 'support_fan_direction': True, - 'hot_swappable': True - }, - 'psus': { - 'psu_num': 2, - 'fan_num_per_psu': 1, - 'hot_swappable': True, - 'led_num': 1 } }, 'x86_64-mlnx_msn3420-r0': { @@ -215,19 +126,6 @@ "unk_trust": {"-127:120":12}, "unk_untrust": {"-127:25":12, "26:35":13, "36:40":14, "41:120":16}, } - }, - 'fans': { - 'drawer_num': 5, - 'drawer_type': 'real', - 'fan_num_per_drawer': 2, - 'support_fan_direction': True, - 'hot_swappable': True - }, - 'psus': { - 'psu_num': 2, - 'fan_num_per_psu': 1, - 'hot_swappable': True, - 'led_num': 1 } }, 'x86_64-mlnx_msn4600c-r0': { @@ -236,19 +134,6 @@ "unk_trust": {"-127:40":12, "41:120":13}, "unk_untrust": {"-127:5":12, "6:20":13, "21:30":14, "31:35":15, "36:40":16, "41:120":17}, } - }, - 'fans': { - 'drawer_num': 3, - 'drawer_type': 'real', - 'fan_num_per_drawer': 1, - 'support_fan_direction': True, - 'hot_swappable': True - }, - 'psus': { - 'psu_num': 2, - 'fan_num_per_psu': 1, - 'hot_swappable': True, - 'led_num': 1 } }, 'x86_64-mlnx_msn4600-r0': { @@ -257,19 +142,142 @@ "unk_trust": {"-127:40": 12, "41:120": 13}, "unk_untrust": {"-127:5": 12, "6:20": 13, "21:30": 14, "31:35": 15, "36:40": 16, "41:120": 17}, } + } + }, + 'x86_64-nvidia_sn4800-r0': { + 'thermal': { + "capability": { + "comex_amb": False + }, + 'cpu_threshold': (80, 95) # min=80, max=95 }, - 'fans': { - 'drawer_num': 3, - 'drawer_type': 'real', - 'fan_num_per_drawer': 1, - 'support_fan_direction': True, - 'hot_swappable': True - }, - 'psus': { - 'psu_num': 2, - 'fan_num_per_psu': 1, - 'hot_swappable': True, - 'led_num': 1 + 'sfp': { + 'max_port_per_line_card': 16 + } + }, + 'x86_64-nvidia_sn2201-r0': { + 'thermal': { + "capability": { + "comex_amb": False, + "cpu_amb": True, + "swb_amb": True + } } + }, + 'x86_64-nvidia_sn5600-r0': { } } + + +class DeviceDataManager: + @classmethod + @utils.read_only_cache() + def get_platform_name(cls): + return device_info.get_platform() + + @classmethod + @utils.read_only_cache() + def get_fan_drawer_count(cls): + # Here we don't read from /run/hw-management/config/hotplug_fans because the value in it is not + # always correct. + return len(glob.glob('/run/hw-management/thermal/fan*_status')) if cls.is_fan_hotswapable() else 1 + + @classmethod + @utils.read_only_cache() + def get_fan_count(cls): + return len(glob.glob('/run/hw-management/thermal/fan*_speed_get')) + + @classmethod + @utils.read_only_cache() + def is_fan_hotswapable(cls): + return utils.read_int_from_file('/run/hw-management/config/hotplug_fans') > 0 + + @classmethod + @utils.read_only_cache() + def get_psu_count(cls): + psu_count = utils.read_int_from_file('/run/hw-management/config/hotplug_psus') + # If psu_count == 0, the platform has fixed PSU + return psu_count if psu_count > 0 else len(glob.glob('/run/hw-management/config/psu*_i2c_addr')) + + @classmethod + @utils.read_only_cache() + def is_psu_hotswapable(cls): + return utils.read_int_from_file('/run/hw-management/config/hotplug_psus') > 0 + + @classmethod + @utils.read_only_cache() + def get_sfp_count(cls): + return utils.read_int_from_file('/run/hw-management/config/sfp_counter') + + @classmethod + def get_linecard_sfp_count(cls, lc_index): + return utils.read_int_from_file('/run/hw-management/lc{}/config/module_counter'.format(lc_index), log_func=None) + + @classmethod + def get_gearbox_count(cls, sysfs_folder): + return utils.read_int_from_file(os.path.join(sysfs_folder, 'gearbox_counter'), log_func=None) + + @classmethod + @utils.read_only_cache() + def get_cpu_thermal_count(cls): + return len(glob.glob('run/hw-management/thermal/cpu_core[!_]')) + + @classmethod + @utils.read_only_cache() + def get_minimum_table(cls): + platform_data = DEVICE_DATA.get(cls.get_platform_name(), None) + if not platform_data: + return None + + thermal_data = platform_data.get('thermal', None) + if not thermal_data: + return None + + return thermal_data.get('minimum_table', None) + + @classmethod + @utils.read_only_cache() + def get_thermal_capability(cls): + platform_data = DEVICE_DATA.get(cls.get_platform_name(), None) + if not platform_data: + return None + + thermal_data = platform_data.get('thermal', None) + if not thermal_data: + return None + + return thermal_data.get('capability', None) + + @classmethod + @utils.read_only_cache() + def get_linecard_count(cls): + return utils.read_int_from_file('/run/hw-management/config/hotplug_linecards', log_func=None) + + @classmethod + @utils.read_only_cache() + def get_linecard_max_port_count(cls): + platform_data = DEVICE_DATA.get(cls.get_platform_name(), None) + if not platform_data: + return 0 + + sfp_data = platform_data.get('sfp', None) + if not sfp_data: + return 0 + return sfp_data.get('max_port_per_line_card', 0) + + @classmethod + def is_cpu_thermal_control_supported(cls): + return cls.get_cpu_thermal_threshold() != (None, None) + + @classmethod + @utils.read_only_cache() + def get_cpu_thermal_threshold(cls): + platform_data = DEVICE_DATA.get(cls.get_platform_name(), None) + if not platform_data: + return None, None + + thermal_data = platform_data.get('thermal', None) + if not thermal_data: + return None, None + + return thermal_data.get('cpu_threshold', (None, None)) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/eeprom.py b/platform/mellanox/mlnx-platform-api/sonic_platform/eeprom.py index 3bc169843a39..17f14b04430f 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/eeprom.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/eeprom.py @@ -1,3 +1,19 @@ +# +# Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################# # Mellanox # @@ -6,17 +22,16 @@ # ############################################################################# import os -import time import subprocess from sonic_py_common.logger import Logger -from sonic_py_common.device_info import get_platform, get_path_to_platform_dir try: from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo except ImportError as e: raise ImportError (str(e) + "- required module not found") -from .utils import default_return +from .device_data import DeviceDataManager +from .utils import default_return, is_host logger = Logger() @@ -25,30 +40,23 @@ # should this be moved to chass.py or here, which better? # EEPROM_SYMLINK = "/var/run/hw-management/eeprom/vpd_info" - -platform_name = get_platform() -if 'simx' in platform_name: - platform_path = get_path_to_platform_dir() - +platform_name = DeviceDataManager.get_platform_name() +if platform_name and 'simx' in platform_name: if not os.path.exists(EEPROM_SYMLINK): + if is_host(): + platform_path = os.path.join('/usr/share/sonic/device', platform_name) + else: + platform_path = '/usr/share/sonic/platform' if not os.path.exists(os.path.dirname(EEPROM_SYMLINK)): os.makedirs(os.path.dirname(EEPROM_SYMLINK)) - subprocess.check_call(['/usr/bin/xxd', '-r', '-p', 'syseeprom.hex', EEPROM_SYMLINK], cwd=platform_path) -class Eeprom(eeprom_tlvinfo.TlvInfoDecoder): - RETRIES = 3 +class Eeprom(eeprom_tlvinfo.TlvInfoDecoder): def __init__(self): - for attempt in range(self.RETRIES): - if not os.path.islink(EEPROM_SYMLINK): - time.sleep(1) - else: - break - if not os.path.exists(EEPROM_SYMLINK): - logger.log_error("Nowhere to read syseeprom from! No symlink or cache file found") - raise RuntimeError("No syseeprom symlink or cache file found") + logger.log_error("Nowhere to read syseeprom from! No symlink found") + raise RuntimeError("No syseeprom symlink found") self.eeprom_path = EEPROM_SYMLINK super(Eeprom, self).__init__(self.eeprom_path, 0, '', True) @@ -107,7 +115,6 @@ def get_system_eeprom_info(self): """ if self._eeprom_info_dict is None: self._eeprom_info_dict = {} - # Try get from DB first db_initialized = self._redis_hget('EEPROM_INFO|State', 'Initialized') if db_initialized == '1': diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py b/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py index 7eb0ce946b17..8c40e2b61809 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/fan.py @@ -1,3 +1,19 @@ +# +# Copyright (c) 2019-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################# # Mellanox # @@ -11,11 +27,16 @@ try: from sonic_platform_base.fan_base import FanBase - from .led import FanLed, ComponentFaultyIndicator - from .utils import read_int_from_file, read_str_from_file, write_file + from sonic_py_common.logger import Logger + from .led import ComponentFaultyIndicator + from . import utils + from .thermal import Thermal except ImportError as e: raise ImportError (str(e) + "- required module not found") +# Global logger class instance +logger = Logger() + PWM_MAX = 255 FAN_PATH = "/var/run/hw-management/thermal/" @@ -24,56 +45,106 @@ FAN_DIR = "/var/run/hw-management/thermal/fan{}_dir" FAN_DIR_VALUE_EXHAUST = 0 FAN_DIR_VALUE_INTAKE = 1 -COOLING_STATE_PATH = "/var/run/hw-management/thermal/cooling_cur_state" -class Fan(FanBase): - """Platform-specific Fan class""" - STATUS_LED_COLOR_ORANGE = "orange" - min_cooling_level = 2 - MIN_VALID_COOLING_LEVEL = 1 - MAX_VALID_COOLING_LEVEL = 10 +class MlnxFan(FanBase): + def __init__(self, fan_index, position): + super(MlnxFan, self).__init__() + self.index = fan_index + 1 + self.position = position + + def get_name(self): + return self._name + + def get_speed(self): + """ + Retrieves the speed of fan + + Returns: + int: percentage of the max fan speed + """ + speed = 0 + speed_in_rpm = utils.read_int_from_file(self.fan_speed_get_path) + + max_speed_in_rpm = utils.read_int_from_file(self.fan_max_speed_path) + if max_speed_in_rpm == 0: + return speed_in_rpm + + speed = 100*speed_in_rpm//max_speed_in_rpm + if speed > 100: + speed = 100 + + return speed + + def set_status_led(self, color): + """ + Set led to expected color + + Args: + color: A string representing the color with which to set the + fan module status LED + + Returns: + bool: True if set success, False if fail. + """ + return self.led.set_status(color) + + def get_status_led(self): + """ + Gets the state of the fan status LED + + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + return self.led.get_status() + + def get_speed_tolerance(self): + """ + Retrieves the speed tolerance of the fan + + Returns: + An integer, the percentage of variance from target speed which is + considered tolerable + """ + # The tolerance value is fixed as 50% for all the Mellanox platform + return 50 + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device + Returns: + integer: The 1-based relative physical position in parent device + """ + return self.position + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False + + +class PsuFan(MlnxFan): # PSU fan speed vector PSU_FAN_SPEED = ['0x3c', '0x3c', '0x3c', '0x3c', '0x3c', '0x3c', '0x3c', '0x46', '0x50', '0x5a', '0x64'] - def __init__(self, fan_index, fan_drawer, position, psu_fan = False, psu=None): - super(Fan, self).__init__() - - # API index is starting from 0, Mellanox platform index is starting from 1 - self.index = fan_index + 1 - self.fan_drawer = fan_drawer - self.position = position - - self.is_psu_fan = psu_fan + def __init__(self, fan_index, position, psu): + super(PsuFan, self).__init__(fan_index, position) + self._name = 'psu{}_fan{}'.format(self.index, position) self.psu = psu - if self.fan_drawer: - self.led = ComponentFaultyIndicator(self.fan_drawer.get_led()) - elif self.is_psu_fan: - from .psu import Psu - self.led = ComponentFaultyIndicator(Psu.get_shared_led()) - else: - self.led = FanLed(self.index) - - if not self.is_psu_fan: - self.fan_speed_get_path = "fan{}_speed_get".format(self.index) - self.fan_speed_set_path = "fan{}_speed_set".format(self.index) - self.fan_max_speed_path = os.path.join(FAN_PATH, "fan{}_max".format(self.index)) - self.fan_min_speed_path = os.path.join(FAN_PATH, "fan{}_min".format(self.index)) - self._name = "fan{}".format(self.index) - else: - self.fan_speed_get_path = "psu{}_fan1_speed_get".format(self.index) - self.fan_presence_path = "psu{}_fan1_speed_get".format(self.index) - self._name = 'psu{}_fan{}'.format(self.index, 1) - self.fan_max_speed_path = os.path.join(FAN_PATH, "psu{}_fan_max".format(self.index)) - self.fan_min_speed_path = os.path.join(FAN_PATH, "psu{}_fan_min".format(self.index)) - self.psu_i2c_bus_path = os.path.join(CONFIG_PATH, 'psu{0}_i2c_bus'.format(self.index)) - self.psu_i2c_addr_path = os.path.join(CONFIG_PATH, 'psu{0}_i2c_addr'.format(self.index)) - self.psu_i2c_command_path = os.path.join(CONFIG_PATH, 'fan_command') - - self.fan_status_path = "fan{}_fault".format(self.index) - self.fan_pwm_path = "pwm1" + from .psu import Psu + self.led = ComponentFaultyIndicator(Psu.get_shared_led()) + self.fan_speed_get_path = os.path.join(FAN_PATH, "psu{}_fan1_speed_get".format(self.index)) + self.fan_presence_path = os.path.join(FAN_PATH, "psu{}_fan1_speed_get".format(self.index)) + self.fan_max_speed_path = os.path.join(FAN_PATH, "psu{}_fan_max".format(self.index)) + self.fan_min_speed_path = os.path.join(FAN_PATH, "psu{}_fan_min".format(self.index)) + self.psu_i2c_bus_path = os.path.join(CONFIG_PATH, 'psu{0}_i2c_bus'.format(self.index)) + self.psu_i2c_addr_path = os.path.join(CONFIG_PATH, 'psu{0}_i2c_addr'.format(self.index)) + self.psu_i2c_command_path = os.path.join(CONFIG_PATH, 'fan_command') def get_direction(self): """ @@ -84,7 +155,7 @@ def get_direction(self): depending on fan direction Notes: - What Mellanox calls forward: + What Mellanox calls forward: Air flows from fans side to QSFP side, for example: MSN2700-CS2F which means intake in community What Mellanox calls reverse: @@ -94,13 +165,7 @@ def get_direction(self): 1 stands for forward, in other words intake 0 stands for reverse, in other words exhaust """ - if self.is_psu_fan: - return self.FAN_DIRECTION_NOT_APPLICABLE - else: - return self.fan_drawer.get_direction() - - def get_name(self): - return self._name + return self.FAN_DIRECTION_NOT_APPLICABLE def get_status(self): """ @@ -109,14 +174,7 @@ def get_status(self): Returns: bool: True if fan is operating properly, False if not """ - status = 0 - if self.is_psu_fan: - status = 0 - else: - status = read_int_from_file(os.path.join(FAN_PATH, self.fan_status_path), 1) - - return status == 0 - + return True def get_presence(self): """ @@ -125,31 +183,7 @@ def get_presence(self): Returns: bool: True if fan is present, False if not """ - if self.is_psu_fan: - return self.psu.get_presence() and self.psu.get_powergood_status() and os.path.exists(os.path.join(FAN_PATH, self.fan_presence_path)) - else: - return self.fan_drawer.get_presence() - - def get_speed(self): - """ - Retrieves the speed of fan - - Returns: - int: percentage of the max fan speed - """ - speed = 0 - speed_in_rpm = read_int_from_file(os.path.join(FAN_PATH, self.fan_speed_get_path)) - - max_speed_in_rpm = read_int_from_file(self.fan_max_speed_path) - if max_speed_in_rpm == 0: - return speed_in_rpm - - speed = 100*speed_in_rpm//max_speed_in_rpm - if speed > 100: - speed = 100 - - return speed - + return self.psu.get_presence() and self.psu.get_powergood_status() and os.path.exists(self.fan_presence_path) def get_target_speed(self): """ @@ -158,17 +192,12 @@ def get_target_speed(self): Returns: int: percentage of the max fan speed """ - if self.is_psu_fan: - try: - # Get PSU fan target speed according to current system cooling level - cooling_level = self.get_cooling_level() - return int(self.PSU_FAN_SPEED[cooling_level], 16) - except Exception: - return self.get_speed() - - pwm = read_int_from_file(os.path.join(FAN_PATH, self.fan_speed_set_path)) - return int(round(pwm*100.0/PWM_MAX)) - + try: + # Get PSU fan target speed according to current system cooling level + cooling_level = Thermal.get_cooling_level() + return int(self.PSU_FAN_SPEED[cooling_level], 16) + except Exception: + return self.get_speed() def set_speed(self, speed): """ @@ -179,124 +208,109 @@ def set_speed(self, speed): in the range 0 (off) to 100 (full speed) Returns: - bool: True if set success, False if fail. + bool: True if set success, False if fail. """ - status = True - - if self.is_psu_fan: - if not self.get_presence(): - return False - from .thermal import logger - try: - bus = read_str_from_file(self.psu_i2c_bus_path, raise_exception=True) - addr = read_str_from_file(self.psu_i2c_addr_path, raise_exception=True) - command = read_str_from_file(self.psu_i2c_command_path, raise_exception=True) - speed = Fan.PSU_FAN_SPEED[int(speed // 10)] - command = "i2cset -f -y {0} {1} {2} {3} wp".format(bus, addr, command, speed) - subprocess.check_call(command, shell = True, universal_newlines=True) - return True - except subprocess.CalledProcessError as ce: - logger.log_error('Failed to call command {}, return code={}, command output={}'.format(ce.cmd, ce.returncode, ce.output)) - return False - except Exception as e: - logger.log_error('Failed to set PSU FAN speed - {}'.format(e)) - return False + if not self.get_presence(): + return False try: - cooling_level = int(speed // 10) - if cooling_level < self.min_cooling_level: - cooling_level = self.min_cooling_level - speed = self.min_cooling_level * 10 - self.set_cooling_level(cooling_level, cooling_level) - pwm = int(round(PWM_MAX*speed/100.0)) - write_file(os.path.join(FAN_PATH, self.fan_speed_set_path), pwm, raise_exception=True) - except (ValueError, IOError): - status = False + bus = utils.read_str_from_file(self.psu_i2c_bus_path, raise_exception=True) + addr = utils.read_str_from_file(self.psu_i2c_addr_path, raise_exception=True) + command = utils.read_str_from_file(self.psu_i2c_command_path, raise_exception=True) + speed = self.PSU_FAN_SPEED[int(speed // 10)] + command = "i2cset -f -y {0} {1} {2} {3} wp".format(bus, addr, command, speed) + subprocess.check_call(command, shell = True, universal_newlines=True) + return True + except subprocess.CalledProcessError as ce: + logger.log_error('Failed to call command {}, return code={}, command output={}'.format(ce.cmd, ce.returncode, ce.output)) + return False + except Exception as e: + logger.log_error('Failed to set PSU FAN speed - {}'.format(e)) + return False + +class Fan(MlnxFan): + """Platform-specific Fan class""" + def __init__(self, fan_index, fan_drawer, position): + super(Fan, self).__init__(fan_index, position) - return status + self.fan_drawer = fan_drawer + self.led = ComponentFaultyIndicator(self.fan_drawer.get_led()) + self._name = "fan{}".format(self.index) + self.fan_speed_get_path = os.path.join(FAN_PATH, "fan{}_speed_get".format(self.index)) + self.fan_speed_set_path = os.path.join(FAN_PATH, "fan{}_speed_set".format(self.index)) + self.fan_max_speed_path = os.path.join(FAN_PATH, "fan{}_max".format(self.index)) + self.fan_min_speed_path = os.path.join(FAN_PATH, "fan{}_min".format(self.index)) - def set_status_led(self, color): - """ - Set led to expected color + self.fan_status_path = os.path.join(FAN_PATH, "fan{}_fault".format(self.index)) - Args: - color: A string representing the color with which to set the - fan module status LED + def get_direction(self): + """ + Retrieves the fan's direction Returns: - bool: True if set success, False if fail. - """ - return self.led.set_status(color) + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + Notes: + What Mellanox calls forward: + Air flows from fans side to QSFP side, for example: MSN2700-CS2F + which means intake in community + What Mellanox calls reverse: + Air flow from QSFP side to fans side, for example: MSN2700-CS2R + which means exhaust in community + According to hw-mgmt: + 1 stands for forward, in other words intake + 0 stands for reverse, in other words exhaust + """ + return self.fan_drawer.get_direction() - def get_status_led(self): + def get_status(self): """ - Gets the state of the fan status LED + Retrieves the operational status of fan Returns: - A string, one of the predefined STATUS_LED_COLOR_* strings above + bool: True if fan is operating properly, False if not """ - return self.led.get_status() + return utils.read_int_from_file(self.fan_status_path, 1) == 0 - def get_speed_tolerance(self): + def get_presence(self): """ - Retrieves the speed tolerance of the fan + Retrieves the presence status of fan Returns: - An integer, the percentage of variance from target speed which is - considered tolerable + bool: True if fan is present, False if not """ - # The tolerance value is fixed as 50% for all the Mellanox platform - return 50 + return self.fan_drawer.get_presence() - def get_position_in_parent(self): - """ - Retrieves 1-based relative physical position in parent device - Returns: - integer: The 1-based relative physical position in parent device + def get_target_speed(self): """ - return self.position + Retrieves the expected speed of fan - def is_replaceable(self): - """ - Indicate whether this device is replaceable. Returns: - bool: True if it is replaceable. + int: percentage of the max fan speed """ - return False + pwm = utils.read_int_from_file(self.fan_speed_set_path) + return int(round(pwm*100.0/PWM_MAX)) - @classmethod - def set_cooling_level(cls, level, cur_state): - """ - Change cooling level. The input level should be an integer value [1, 10]. - 1 means 10%, 2 means 20%, 10 means 100%. + def set_speed(self, speed): """ - if not isinstance(level, int): - raise RuntimeError("Failed to set cooling level, input parameter must be integer") + Set fan speed to expected value - if level < cls.MIN_VALID_COOLING_LEVEL or level > cls.MAX_VALID_COOLING_LEVEL: - raise RuntimeError("Failed to set cooling level, level value must be in range [{}, {}], got {}".format( - cls.MIN_VALID_COOLING_LEVEL, - cls.MAX_VALID_COOLING_LEVEL, - level - )) + Args: + speed: An integer, the percentage of full fan speed to set fan to, + in the range 0 (off) to 100 (full speed) + + Returns: + bool: True if set success, False if fail. + """ + status = True try: - # Reset FAN cooling level vector. According to low level team, - # if we need set cooling level to X, we need first write a (10+X) - # to cooling_cur_state file to reset the cooling level vector. - write_file(COOLING_STATE_PATH, level + 10, raise_exception=True) - - # We need set cooling level after resetting the cooling level vector - write_file(COOLING_STATE_PATH, cur_state, raise_exception=True) - except (ValueError, IOError) as e: - raise RuntimeError("Failed to set cooling level - {}".format(e)) - - @classmethod - def get_cooling_level(cls): - try: - return read_int_from_file(COOLING_STATE_PATH, raise_exception=True) - except (ValueError, IOError) as e: - raise RuntimeError("Failed to get cooling level - {}".format(e)) + pwm = int(PWM_MAX*speed/100.0) + utils.write_file(self.fan_speed_set_path, pwm, raise_exception=True) + except (ValueError, IOError): + status = False + + return status diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/fan_drawer.py b/platform/mellanox/mlnx-platform-api/sonic_platform/fan_drawer.py index d73b52368100..848abb04aca3 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/fan_drawer.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/fan_drawer.py @@ -1,3 +1,19 @@ +# +# Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################# # Mellanox # @@ -11,18 +27,21 @@ try: from sonic_platform_base.fan_drawer_base import FanDrawerBase from sonic_platform_base.fan_base import FanBase + from sonic_py_common.logger import Logger from .led import FanLed, SharedLed - from .utils import read_int_from_file + from . import utils except ImportError as e: raise ImportError (str(e) + "- required module not found") +# Global logger class instance +logger = Logger() + class MellanoxFanDrawer(FanDrawerBase): - def __init__(self, index, fan_data): + def __init__(self, index): from .fan import FAN_PATH super(MellanoxFanDrawer, self).__init__() self._index = index + 1 - self._fan_data = fan_data self._presence_path = os.path.join(FAN_PATH, 'fan{}_status'.format(self._index)) self._led = None @@ -33,33 +52,25 @@ def get_led(self): return self._led def get_presence(self): - if not self._fan_data['hot_swappable']: - return True - - status = 0 - try: - with open(self._presence_path, 'r') as presence_status: - status = int(presence_status.read()) - except (ValueError, IOError) as e: - status = 0 - - return status == 1 + return utils.read_int_from_file(self._presence_path) == 1 def get_direction(self): - if not self._fan_data['support_fan_direction'] or not self.get_presence(): + if not self.get_presence(): return FanBase.FAN_DIRECTION_NOT_APPLICABLE try: from .fan import FAN_DIR, FAN_DIR_VALUE_INTAKE, FAN_DIR_VALUE_EXHAUST - fan_dir = read_int_from_file(FAN_DIR.format(self._index), raise_exception=True) + fan_dir = utils.read_int_from_file(FAN_DIR.format(self._index), raise_exception=True) if fan_dir == FAN_DIR_VALUE_INTAKE: return FanBase.FAN_DIRECTION_INTAKE elif fan_dir == FAN_DIR_VALUE_EXHAUST: return FanBase.FAN_DIRECTION_EXHAUST else: - raise RuntimeError("Got wrong value {} for fan direction {}".format(fan_dir, self._index)) + logger.log_error("Got wrong value {} for fan direction {}".format(fan_dir, self._index)) + return FanBase.FAN_DIRECTION_NOT_APPLICABLE except (ValueError, IOError) as e: - raise RuntimeError("Failed to read fan direction status to {}".format(repr(e))) + logger.log_error("Failed to read fan direction status to {}".format(repr(e))) + return FanBase.FAN_DIRECTION_NOT_APPLICABLE def set_status_led(self, color): """ @@ -97,12 +108,12 @@ def is_replaceable(self): Returns: bool: True if it is replaceable. """ - return self._fan_data['hot_swappable'] + return True class RealDrawer(MellanoxFanDrawer): - def __init__(self, index, fan_data): - super(RealDrawer, self).__init__(index, fan_data) + def __init__(self, index): + super(RealDrawer, self).__init__(index) self._name = 'drawer{}'.format(self._index) self._led = SharedLed(FanLed(self._index)) @@ -111,9 +122,15 @@ def get_name(self): class VirtualDrawer(MellanoxFanDrawer): - def __init__(self, index, fan_data): - super(VirtualDrawer, self).__init__(index, fan_data) + def __init__(self, index): + super(VirtualDrawer, self).__init__(index) self._led = SharedLed(FanLed(None)) def get_name(self): return 'N/A' + + def get_presence(self): + return True + + def is_replaceable(self): + return False diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/led.py b/platform/mellanox/mlnx-platform-api/sonic_platform/led.py index d67cbb1d9557..49c243fd8012 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/led.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/led.py @@ -1,5 +1,26 @@ +# +# Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# import os +import time +from sonic_py_common.logger import Logger +from . import utils + +logger = Logger() class Led(object): STATUS_LED_COLOR_GREEN = 'green' @@ -10,7 +31,7 @@ class Led(object): STATUS_LED_COLOR_ORANGE_BLINK = 'orange_blink' STATUS_LED_COLOR_OFF = 'off' - LED_ON = '1' + LED_ON = '255' LED_OFF = '0' LED_BLINK = '50' @@ -26,12 +47,11 @@ def set_status(self, color): self._stop_blink(led_cap_list) blink_pos = color.find('blink') if blink_pos != -1: - return self._set_status_blink(color, blink_pos, led_cap_list) + return self._set_status_blink(color, led_cap_list) if color == Led.STATUS_LED_COLOR_GREEN: - with open(self.get_green_led_path(), 'w') as led: - led.write(Led.LED_ON) - status = True + utils.write_file(self.get_green_led_path(), Led.LED_ON) + status = True elif color == Led.STATUS_LED_COLOR_RED: # Some led don't support red led but support orange led, in this case we set led to orange if Led.STATUS_LED_COLOR_RED in led_cap_list: @@ -41,19 +61,25 @@ def set_status(self, color): else: return False - with open(led_path, 'w') as led: - led.write(Led.LED_ON) - status = True + utils.write_file(led_path, Led.LED_ON) + status = True + elif color == Led.STATUS_LED_COLOR_ORANGE: + if Led.STATUS_LED_COLOR_ORANGE in led_cap_list: + led_path = self.get_orange_led_path() + elif Led.STATUS_LED_COLOR_RED in led_cap_list: + led_path = self.get_red_led_path() + else: + return False + + utils.write_file(led_path, Led.LED_ON) + status = True elif color == Led.STATUS_LED_COLOR_OFF: if Led.STATUS_LED_COLOR_GREEN in led_cap_list: - with open(self.get_green_led_path(), 'w') as led: - led.write(Led.LED_OFF) + utils.write_file(self.get_green_led_path(), Led.LED_OFF) if Led.STATUS_LED_COLOR_RED in led_cap_list: - with open(self.get_red_led_path(), 'w') as led: - led.write(Led.LED_OFF) + utils.write_file(self.get_red_led_path(), Led.LED_OFF) if Led.STATUS_LED_COLOR_ORANGE in led_cap_list: - with open(self.get_orange_led_path(), 'w') as led: - led.write(Led.LED_OFF) + utils.write_file(self.get_orange_led_path(), Led.LED_OFF) status = True else: @@ -63,7 +89,7 @@ def set_status(self, color): return status - def _set_status_blink(self, color, blink_pos, led_cap_list): + def _set_status_blink(self, color, led_cap_list): if color not in led_cap_list: if color == Led.STATUS_LED_COLOR_RED_BLINK and Led.STATUS_LED_COLOR_ORANGE_BLINK in led_cap_list: color = Led.STATUS_LED_COLOR_ORANGE_BLINK @@ -73,32 +99,60 @@ def _set_status_blink(self, color, blink_pos, led_cap_list): return False if Led.STATUS_LED_COLOR_GREEN_BLINK == color: - self._set_led_blink_status(self.get_green_led_delay_on_path(), self.get_green_led_delay_off_path(), Led.LED_BLINK) + self._trigger_blink(self.get_green_led_trigger()) + return self._set_led_blink_status(self.get_green_led_delay_on_path(), self.get_green_led_delay_off_path(), Led.LED_BLINK) elif Led.STATUS_LED_COLOR_RED_BLINK == color: - self._set_led_blink_status(self.get_red_led_delay_on_path(), self.get_red_led_delay_off_path(), Led.LED_BLINK) + self._trigger_blink(self.get_red_led_trigger()) + return self._set_led_blink_status(self.get_red_led_delay_on_path(), self.get_red_led_delay_off_path(), Led.LED_BLINK) elif Led.STATUS_LED_COLOR_ORANGE_BLINK == color: - self._set_led_blink_status(self.get_orange_led_delay_on_path(), self.get_orange_led_delay_off_path(), Led.LED_BLINK) + self._trigger_blink(self.get_orange_led_trigger()) + return self._set_led_blink_status(self.get_orange_led_delay_on_path(), self.get_orange_led_delay_off_path(), Led.LED_BLINK) else: return False - return True - def _stop_blink(self, led_cap_list): try: if Led.STATUS_LED_COLOR_GREEN_BLINK in led_cap_list: - self._set_led_blink_status(self.get_green_led_delay_on_path(), self.get_green_led_delay_off_path(), Led.LED_OFF) + self._untrigger_blink(self.get_green_led_trigger()) if Led.STATUS_LED_COLOR_RED_BLINK in led_cap_list: - self._set_led_blink_status(self.get_red_led_delay_on_path(), self.get_red_led_delay_off_path(), Led.LED_OFF) + self._untrigger_blink(self.get_red_led_trigger()) if Led.STATUS_LED_COLOR_ORANGE_BLINK in led_cap_list: - self._set_led_blink_status(self.get_orange_led_delay_on_path(), self.get_orange_led_delay_off_path(), Led.LED_OFF) + self._untrigger_blink(self.get_orange_led_trigger()) except Exception as e: return + def _trigger_blink(self, blink_trigger_file): + utils.write_file(blink_trigger_file, 'timer') + + def _untrigger_blink(self, blink_trigger_file): + utils.write_file(blink_trigger_file, 'none') + def _set_led_blink_status(self, delay_on_file, delay_off_file, value): - with open(delay_on_file, 'w') as led: - led.write(value) - with open(delay_off_file, 'w') as led: - led.write(value) + if not self._wait_files_ready((delay_on_file, delay_off_file)): + return False + + utils.write_file(delay_on_file, value) + utils.write_file(delay_off_file, value) + return True + + def _wait_files_ready(self, file_list): + """delay_off and delay_on sysfs will be available only if _trigger_blink is called. And once + _trigger_blink is called, driver might need time to prepare delay_off and delay_on. So, + need wait a few seconds here to make sure the sysfs is ready + + Args: + file_list (list of str): files to be checked + """ + wait_time = 5.0 + initial_sleep = 0.01 + while wait_time > 0: + if all([os.path.exists(x) for x in file_list]): + return True + time.sleep(initial_sleep) + wait_time -= initial_sleep + initial_sleep = initial_sleep * 2 + + return False def get_status(self): led_cap_list = self.get_capability() @@ -110,18 +164,15 @@ def get_status(self): if blink_status is not None: return blink_status - with open(self.get_green_led_path(), 'r') as led: - if Led.LED_OFF != led.read().rstrip('\n'): - return Led.STATUS_LED_COLOR_GREEN + if utils.read_str_from_file(self.get_green_led_path()) != Led.LED_OFF: + return Led.STATUS_LED_COLOR_GREEN if Led.STATUS_LED_COLOR_RED in led_cap_list: - with open(self.get_red_led_path(), 'r') as led: - if Led.LED_OFF != led.read().rstrip('\n'): - return Led.STATUS_LED_COLOR_RED + if utils.read_str_from_file(self.get_red_led_path()) != Led.LED_OFF: + return Led.STATUS_LED_COLOR_RED if Led.STATUS_LED_COLOR_ORANGE in led_cap_list: - with open(self.get_orange_led_path(), 'r') as led: - if Led.LED_OFF != led.read().rstrip('\n'): - return Led.STATUS_LED_COLOR_RED + if utils.read_str_from_file(self.get_orange_led_path()) != Led.LED_OFF: + return Led.STATUS_LED_COLOR_RED except (ValueError, IOError) as e: raise RuntimeError("Failed to read led status due to {}".format(repr(e))) @@ -132,6 +183,7 @@ def _get_blink_status(self, led_cap_list): if Led.STATUS_LED_COLOR_GREEN_BLINK in led_cap_list: if self._is_led_blinking(self.get_green_led_delay_on_path(), self.get_green_led_delay_off_path()): return Led.STATUS_LED_COLOR_GREEN_BLINK + if Led.STATUS_LED_COLOR_RED_BLINK in led_cap_list: if self._is_led_blinking(self.get_red_led_delay_on_path(), self.get_red_led_delay_off_path()): return Led.STATUS_LED_COLOR_RED_BLINK @@ -144,126 +196,73 @@ def _get_blink_status(self, led_cap_list): return None def _is_led_blinking(self, delay_on_file, delay_off_file): - with open(delay_on_file, 'r') as led: - delay_on = led.read().rstrip('\n') - with open(delay_off_file, 'r') as led: - delay_off = led.read().rstrip('\n') + delay_on = utils.read_str_from_file(delay_on_file, default=Led.LED_OFF, log_func=None) + delay_off = utils.read_str_from_file(delay_off_file, default=Led.LED_OFF, log_func=None) return delay_on != Led.LED_OFF and delay_off != Led.LED_OFF def get_capability(self): - cap_list = None - try: - with open(self.get_led_cap_path(), 'r') as led_cap: - caps = led_cap.read() - cap_list = set(caps.split()) - except (ValueError, IOError): - pass - - return cap_list + caps = utils.read_str_from_file(self.get_led_cap_path()) + return set(caps.split()) def get_green_led_path(self): - pass + return os.path.join(Led.LED_PATH, 'led_{}_green'.format(self._led_id)) def get_green_led_delay_off_path(self): - return '{}_delay_off'.format(self.get_green_led_path()) + return os.path.join(Led.LED_PATH, 'led_{}_green_delay_off'.format(self._led_id)) def get_green_led_delay_on_path(self): - return '{}_delay_on'.format(self.get_green_led_path()) + return os.path.join(Led.LED_PATH, 'led_{}_green_delay_on'.format(self._led_id)) + + def get_green_led_trigger(self): + return os.path.join(Led.LED_PATH, 'led_{}_green_trigger'.format(self._led_id)) def get_red_led_path(self): - pass + return os.path.join(Led.LED_PATH, 'led_{}_red'.format(self._led_id)) def get_red_led_delay_off_path(self): - return '{}_delay_off'.format(self.get_red_led_path()) + return os.path.join(Led.LED_PATH, 'led_{}_red_delay_off'.format(self._led_id)) def get_red_led_delay_on_path(self): - return '{}_delay_on'.format(self.get_red_led_path()) + return os.path.join(Led.LED_PATH, 'led_{}_red_delay_on'.format(self._led_id)) + + def get_red_led_trigger(self): + return os.path.join(Led.LED_PATH, 'led_{}_red_trigger'.format(self._led_id)) def get_orange_led_path(self): - pass + return os.path.join(Led.LED_PATH, 'led_{}_orange'.format(self._led_id)) def get_orange_led_delay_off_path(self): - return '{}_delay_off'.format(self.get_orange_led_path()) + return os.path.join(Led.LED_PATH, 'led_{}_orange_delay_off'.format(self._led_id)) def get_orange_led_delay_on_path(self): - return '{}_delay_on'.format(self.get_orange_led_path()) + return os.path.join(Led.LED_PATH, 'led_{}_orange_delay_on'.format(self._led_id)) + + def get_orange_led_trigger(self): + return os.path.join(Led.LED_PATH, 'led_{}_orange_trigger'.format(self._led_id)) def get_led_cap_path(self): - pass + return os.path.join(Led.LED_PATH, 'led_{}_capability'.format(self._led_id)) - -class FanLed(Led): - LED_PATH = "/var/run/hw-management/led/" +class FanLed(Led): def __init__(self, index): if index is not None: - self._green_led_path = os.path.join(Led.LED_PATH, "led_fan{}_green".format(index)) - self._red_led_path = os.path.join(Led.LED_PATH, "led_fan{}_red".format(index)) - self._orange_led_path = os.path.join(Led.LED_PATH, "led_fan{}_orange".format(index)) - self._led_cap_path = os.path.join(Led.LED_PATH, "led_fan{}_capability".format(index)) + self._led_id = 'fan{}'.format(index) else: - self._green_led_path = os.path.join(Led.LED_PATH, "led_fan_green") - self._red_led_path = os.path.join(Led.LED_PATH, "led_fan_red") - self._orange_led_path = os.path.join(Led.LED_PATH, "led_fan_orange") - self._led_cap_path = os.path.join(Led.LED_PATH, "led_fan_capability") - - def get_green_led_path(self): - return self._green_led_path - - def get_red_led_path(self): - return self._red_led_path - - def get_orange_led_path(self): - return self._orange_led_path - - def get_led_cap_path(self): - return self._led_cap_path + self._led_id = 'fan' class PsuLed(Led): def __init__(self, index): if index is not None: - self._green_led_path = os.path.join(Led.LED_PATH, "led_psu{}_green".format(index)) - self._red_led_path = os.path.join(Led.LED_PATH, "led_psu{}_red".format(index)) - self._orange_led_path = os.path.join(Led.LED_PATH, "led_psu{}_orange".format(index)) - self._led_cap_path = os.path.join(Led.LED_PATH, "led_psu{}_capability".format(index)) + self._led_id = 'psu{}'.format(index) else: - self._green_led_path = os.path.join(Led.LED_PATH, "led_psu_green") - self._red_led_path = os.path.join(Led.LED_PATH, "led_psu_red") - self._orange_led_path = os.path.join(Led.LED_PATH, "led_psu_orange") - self._led_cap_path = os.path.join(Led.LED_PATH, "led_psu_capability") - - def get_green_led_path(self): - return self._green_led_path - - def get_red_led_path(self): - return self._red_led_path - - def get_orange_led_path(self): - return self._orange_led_path - - def get_led_cap_path(self): - return self._led_cap_path + self._led_id = 'psu' class SystemLed(Led): def __init__(self): - self._green_led_path = os.path.join(Led.LED_PATH, "led_status_green") - self._red_led_path = os.path.join(Led.LED_PATH, "led_status_red") - self._orange_led_path = os.path.join(Led.LED_PATH, "led_status_orange") - self._led_cap_path = os.path.join(Led.LED_PATH, "led_status_capability") - - def get_green_led_path(self): - return self._green_led_path - - def get_red_led_path(self): - return self._red_led_path - - def get_orange_led_path(self): - return self._orange_led_path - - def get_led_cap_path(self): - return self._led_cap_path + self._led_id = 'status' class SharedLed(object): diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/module.py b/platform/mellanox/mlnx-platform-api/sonic_platform/module.py new file mode 100644 index 000000000000..8cd6ffa9b8db --- /dev/null +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/module.py @@ -0,0 +1,249 @@ +# +# Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import redis +import threading +from sonic_platform_base.module_base import ModuleBase +from sonic_py_common.logger import Logger + +from . import utils +from .device_data import DeviceDataManager +from .vpd_parser import VpdParser + +# Global logger class instance +logger = Logger() + + +class Module(ModuleBase): + STATE_ACTIVATED = 1 + STATE_DEACTIVATED = 0 + + STATE_DB = 6 + STATE_MODULAR_CHASSIS_SLOT_TABLE = 'MODULAR_CHASSIS_SLOT|{}' + FIELD_SEQ_NO = 'seq_no' + redis_client = redis.Redis(db = STATE_DB) + + def __init__(self, slot_id): + super(Module, self).__init__() + self.slot_id = slot_id + self.seq_no = 0 + self.current_state = Module.STATE_DEACTIVATED + self.lock = threading.Lock() + + self.sfp_initialized_count = 0 + self.sfp_count = 0 + self.vpd_parser = VpdParser('/run/hw-management/lc{}/eeprom/vpd_parsed') + + def get_name(self): + return 'LINE-CARD{}'.format(self.slot_id) + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + + Returns: + string: Model/part number of device + """ + return self.vpd_parser.get_model() + + def get_serial(self): + """ + Retrieves the serial number of the device + + Returns: + string: Serial number of device + """ + return self.vpd_parser.get_serial() + + def get_revision(self): + """ + Retrieves the hardware revision of the device + + Returns: + string: Revision value of device + """ + return self.vpd_parser.get_revision() + + def get_type(self): + return ModuleBase.MODULE_TYPE_LINE + + def get_slot(self): + return self.slot_id + + def get_presence(self): + return utils.read_int_from_file('/run/hw-management/system/lc{}_present'.format(self.slot_id)) == 1 + + def get_position_in_parent(self): + return self.slot_id + + def is_replaceable(self): + return True + + def get_oper_status(self): # TODO: read from DB? + if utils.read_int_from_file('/run/hw-management/system/lc{}_active'.format(self.slot_id)) == 1: + return ModuleBase.MODULE_STATUS_ONLINE + elif utils.read_int_from_file('/run/hw-management/system/lc{}_present'.format(self.slot_id)) == 1: + return ModuleBase.MODULE_STATUS_PRESENT + elif utils.read_int_from_file('/run/hw-management/system/lc{}_present'.format(self.slot_id)) == 0: + return ModuleBase.MODULE_STATUS_EMPTY + else: + return ModuleBase.MODULE_STATUS_FAULT + + def _check_state(self): + """Check Module status change: + 1. If status sysfs file value has been changed TODO: read from DB? + 2. If sequence NO has been changed which means line card has been removed and inserted again. + """ + seq_no = self._get_seq_no() + state = utils.read_int_from_file('/run/hw-management/system/lc{}_powered'.format(self.slot_id), log_func=None) + if state != self.current_state: + self._re_init() + elif seq_no != self.seq_no: + if state == Module.STATE_ACTIVATED: # LC has been replaced, need re-initialize + self._re_init() + self.current_state = state + self.seq_no = seq_no + + def _get_seq_no(self): + try: + seq_no = Module.redis_client.hget(Module.STATE_MODULAR_CHASSIS_SLOT_TABLE.format(self.slot_id), Module.FIELD_SEQ_NO) + seq_no = seq_no.decode().strip() + except Exception as e: + seq_no = 0 + return seq_no + + def _re_init(self): + self._thermal_list = [] + self._sfp_list = [] + self._sfp_count = 0 + + + ############################################## + # THERMAL methods + ############################################## + + def initialize_thermals(self): + self._check_state() + if self.current_state == Module.STATE_ACTIVATED and not self._thermal_list: + from .thermal import initialize_linecard_thermals + self._thermal_list = initialize_linecard_thermals(self.get_name(), self.slot_id) # TODO: add presence_cb? + + def get_num_thermals(self): + """ + Retrieves the number of thermals available on this module + + Returns: + An integer, the number of thermals available on this module + """ + return DeviceDataManager.get_gearbox_count('/run/hw-management/lc{}/config'.format(self.slot_id)) + + def get_all_thermals(self): + """ + Retrieves all thermals available on this module + + Returns: + A list of objects derived from ThermalBase representing all thermals + available on this module + """ + with self.lock: + self.initialize_thermals() + return self._thermal_list + + def get_thermal(self, index): + """ + Retrieves thermal unit represented by (0-based) index + + Args: + index: An integer, the index (0-based) of the thermal to + retrieve + + Returns: + An object dervied from ThermalBase representing the specified thermal + """ + with self.lock: + self.initialize_thermals() + return super(Module, self).get_thermal(index) + + ############################################## + # SFP methods + ############################################## + def _create_sfp_object(self, index): + from .sfp import SFP + return SFP(index, slot_id=self.slot_id, linecard_port_count=self.sfp_count, lc_name=self.get_name()) + + def initialize_single_sfp(self, index): + self._check_state() + if self.current_state == Module.STATE_ACTIVATED: + sfp_count = self.get_num_sfps() + if index < sfp_count: + if not self._sfp_list: + self._sfp_list = [None] * sfp_count + + if not self._sfp_list[index]: + self._sfp_list[index] = self._create_sfp_object(index) + self.sfp_initialized_count += 1 + + def initialize_sfps(self): + self._check_state() + if self.current_state == Module.STATE_ACTIVATED: + if not self._sfp_list: + sfp_count = self.get_num_sfps() + for index in range(sfp_count): + self._sfp_list.append(self._create_sfp_object(index)) + self.sfp_initialized_count = sfp_count + elif self.sfp_initialized_count != len(self._sfp_list): + for index in range(len(self._sfp_list)): + if self._sfp_list[index] is None: + self._sfp_list[index] = self._create_sfp_object(index) + self.sfp_initialized_count = len(self._sfp_list) + + def get_num_sfps(self): + """ + Retrieves the number of sfps available on this module + + Returns: + An integer, the number of sfps available on this module + """ + if self.sfp_count == 0: + self.sfp_count = DeviceDataManager.get_linecard_sfp_count(self.slot_id) + return self.sfp_count + + def get_all_sfps(self): + """ + Retrieves all sfps available on this module + + Returns: + A list of objects derived from PsuBase representing all sfps + available on this module + """ + with self.lock: + self.initialize_sfps() + return self._sfp_list + + def get_sfp(self, index): + """ + Retrieves sfp represented by (0-based) index + + Args: + index: An integer, the index (0-based) of the sfp to retrieve + + Returns: + An object dervied from SfpBase representing the specified sfp + """ + with self.lock: + self.initialize_single_sfp(index) + return super(Module, self).get_sfp(index) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/pcie.py b/platform/mellanox/mlnx-platform-api/sonic_platform/pcie.py index 96d590e5e2e3..f814583dcca0 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/pcie.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/pcie.py @@ -1,6 +1,20 @@ -######################################################################## # -# Copyright (C) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +######################################################################## # # Module contains a platform specific implementation of SONiC Platform # Base PCIe class diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/platform.py b/platform/mellanox/mlnx-platform-api/sonic_platform/platform.py index 6e18d1fbd854..9100e8fb2f26 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/platform.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/platform.py @@ -1,3 +1,19 @@ +# +# Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################# # Mellanox # @@ -6,23 +22,15 @@ try: from sonic_platform_base.platform_base import PlatformBase - from sonic_platform.chassis import Chassis - from sonic_py_common.device_info import get_platform - from . import utils + from .chassis import Chassis, ModularChassis + from .device_data import DeviceDataManager except ImportError as e: raise ImportError(str(e) + "- required module not found") class Platform(PlatformBase): def __init__(self): PlatformBase.__init__(self) - self._chassis = Chassis() - self._chassis.initialize_eeprom() - platform_name = get_platform() - if "simx" not in platform_name: - self._chassis.initialize_psu() - if utils.is_host(): - self._chassis.initialize_components() - self._chassis.initizalize_system_led() - else: - self._chassis.initialize_fan() - self._chassis.initialize_thermals() + if DeviceDataManager.get_linecard_count() == 0: + self._chassis = Chassis() + else: + self._chassis = ModularChassis() diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py index dbc395ba935f..39494a124ed4 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py @@ -1,3 +1,19 @@ +# +# Copyright (c) 2019-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################# # Mellanox # @@ -7,12 +23,12 @@ ############################################################################# try: - import os.path + import os from sonic_platform_base.psu_base import PsuBase from sonic_py_common.logger import Logger - from sonic_platform.fan import Fan from .led import PsuLed, SharedLed, ComponentFaultyIndicator - from .device_data import DEVICE_DATA + from . import utils + from .vpd_parser import VpdParser except ImportError as e: raise ImportError (str(e) + "- required module not found") @@ -20,210 +36,28 @@ # Global logger class instance logger = Logger() -psu_list = [] - -PSU_CURRENT = "current" -PSU_VOLTAGE = "voltage" -PSU_POWER = "power" -PSU_VPD = "vpd" - -SN_VPD_FIELD = "SN_VPD_FIELD" -PN_VPD_FIELD = "PN_VPD_FIELD" -REV_VPD_FIELD = "REV_VPD_FIELD" - -# in most platforms the file psuX_curr, psuX_volt and psuX_power contain current, voltage and power data respectively. -# but there are exceptions which will be handled by the following dictionary - -platform_dict_psu = {'x86_64-mlnx_msn3420-r0': 1, 'x86_64-mlnx_msn3700-r0': 1, 'x86_64-mlnx_msn3700c-r0': 1, - 'x86_64-mlnx_msn3800-r0': 1, 'x86_64-mlnx_msn4600-r0': 1, 'x86_64-mlnx_msn4600c-r0': 1, - 'x86_64-mlnx_msn4700-r0': 1, 'x86_64-mlnx_msn4410-r0': 1, 'x86_64-mlnx_msn2010-r0' : 2, - 'x86_64-mlnx_msn2100-r0': 2} - -psu_profile_list = [ - # default filename convention - { - PSU_CURRENT : "power/psu{}_curr", - PSU_VOLTAGE : "power/psu{}_volt", - PSU_POWER : "power/psu{}_power", - PSU_VPD : "eeprom/psu{}_vpd" - }, - # for 3420, 3700, 3700c, 3800, 4600c, 4700 - { - PSU_CURRENT : "power/psu{}_curr", - PSU_VOLTAGE : "power/psu{}_volt_out2", - PSU_POWER : "power/psu{}_power", - PSU_VPD : "eeprom/psu{}_vpd" - }, - # for fixed platforms 2100, 2010 - { - PSU_CURRENT : "power/psu{}_curr", - PSU_VOLTAGE : "power/psu{}_volt_out2", - PSU_POWER : "power/psu{}_power", - PSU_VPD : None - } -] - -class Psu(PsuBase): - """Platform-specific Psu class""" +PSU_PATH = '/var/run/hw-management/' - shared_led = None - def __init__(self, psu_index, platform): - global psu_list - PsuBase.__init__(self) - # PSU is 1-based on Mellanox platform +class FixedPsu(PsuBase): + def __init__(self, psu_index): + super(FixedPsu, self).__init__() self.index = psu_index + 1 - psu_list.append(self.index) - self.psu_path = "/var/run/hw-management/" - psu_oper_status = "thermal/psu{}_pwr_status".format(self.index) - #psu_oper_status should always be present for all platforms - self.psu_oper_status = os.path.join(self.psu_path, psu_oper_status) - self._name = "PSU {}".format(psu_index + 1) - - if platform in platform_dict_psu: - filemap = psu_profile_list[platform_dict_psu[platform]] - else: - filemap = psu_profile_list[0] - - self.psu_data = DEVICE_DATA[platform]['psus'] - psu_vpd = filemap[PSU_VPD] - - self.model = "N/A" - self.serial = "N/A" - self.rev = "N/A" - - if psu_vpd is not None: - self.psu_vpd = os.path.join(self.psu_path, psu_vpd.format(self.index)) - self.vpd_data = self._read_vpd_file(self.psu_vpd) - - if PN_VPD_FIELD in self.vpd_data: - self.model = self.vpd_data[PN_VPD_FIELD] - else: - logger.log_error("Fail to read PSU{} model number: No key {} in VPD {}".format(self.index, PN_VPD_FIELD, self.psu_vpd)) - - if SN_VPD_FIELD in self.vpd_data: - self.serial = self.vpd_data[SN_VPD_FIELD] - else: - logger.log_error("Fail to read PSU{} serial number: No key {} in VPD {}".format(self.index, SN_VPD_FIELD, self.psu_vpd)) - - if REV_VPD_FIELD in self.vpd_data: - self.rev = self.vpd_data[REV_VPD_FIELD] - else: - logger.log_error("Fail to read PSU{} serial number: No key {} in VPD {}".format(self.index, REV_VPD_FIELD, self.psu_vpd)) - - else: - logger.log_info("Not reading PSU{} VPD data: Platform is fixed".format(self.index)) - - if not self.psu_data['hot_swappable']: - self.always_present = True - self.psu_voltage = None - self.psu_current = None - self.psu_power = None - self.psu_presence = None - self.psu_temp = None - self.psu_temp_threshold = None - else: - self.always_present = False - psu_voltage = filemap[PSU_VOLTAGE].format(self.index) - psu_voltage = os.path.join(self.psu_path, psu_voltage) - self.psu_voltage = psu_voltage - - psu_current = filemap[PSU_CURRENT].format(self.index) - psu_current = os.path.join(self.psu_path, psu_current) - self.psu_current = psu_current - - psu_power = filemap[PSU_POWER].format(self.index) - psu_power = os.path.join(self.psu_path, psu_power) - self.psu_power = psu_power - - psu_presence = "thermal/psu{}_status".format(self.index) - psu_presence = os.path.join(self.psu_path, psu_presence) - self.psu_presence = psu_presence - - self.psu_temp = os.path.join(self.psu_path, 'thermal/psu{}_temp'.format(self.index)) - self.psu_temp_threshold = os.path.join(self.psu_path, 'thermal/psu{}_temp_max'.format(self.index)) - - # unplugable PSU has no FAN - if self.psu_data['hot_swappable']: - fan = Fan(psu_index, None, 1, True, self) - self._fan_list.append(fan) - - if self.psu_data['led_num'] == 1: - self.led = ComponentFaultyIndicator(Psu.get_shared_led()) - else: # 2010/2100 - self.led = PsuLed(self.index) - - # initialize thermal for PSU - from .thermal import initialize_psu_thermals - initialize_psu_thermals(platform, self._thermal_list, self.index, self.get_power_available_status) - + self._name = "PSU {}".format(self.index) + self.psu_oper_status = os.path.join(PSU_PATH, "thermal/psu{}_pwr_status".format(self.index)) + self._led = None def get_name(self): return self._name - - def _read_vpd_file(self, filename): - """ - Read a vpd file parsed from eeprom with keys and values. - Returns a dictionary. - """ - result = {} - try: - if not os.path.exists(filename): - return result - with open(filename, 'r') as fileobj: - for line in fileobj.readlines(): - key, val = line.split(":") - result[key.strip()] = val.strip() - except Exception as e: - logger.log_error("Fail to read VPD file {} due to {}".format(filename, repr(e))) - return result - - - def _read_generic_file(self, filename, len): - """ - Read a generic file, returns the contents of the file - """ - result = 0 - try: - if not os.path.exists(filename): - return result - with open(filename, 'r') as fileobj: - result = int(fileobj.read().strip()) - except Exception as e: - logger.log_info("Fail to read file {} due to {}".format(filename, repr(e))) - return result - - def get_model(self): - """ - Retrieves the model number (or part number) of the device - - Returns: - string: Model/part number of device - """ - return self.model - + return 'N/A' def get_serial(self): - """ - Retrieves the serial number of the device - - Returns: - string: Serial number of device - """ - return self.serial - + return 'N/A' def get_revision(self): - """ - Retrieves the hardware revision of the device - - Returns: - string: Revision value of device - """ - return self.rev - + return 'N/A' def get_powergood_status(self): """ @@ -232,10 +66,7 @@ def get_powergood_status(self): Returns: bool: True if PSU is operating properly, False if not """ - status = self._read_generic_file(os.path.join(self.psu_path, self.psu_oper_status), 0) - - return status == 1 - + return utils.read_int_from_file(self.psu_oper_status) == 1 def get_presence(self): """ @@ -244,12 +75,7 @@ def get_presence(self): Returns: bool: True if PSU is present, False if not """ - if self.always_present: - return self.always_present - else: - status = self._read_generic_file(self.psu_presence, 0) - return status == 1 - + return True def get_voltage(self): """ @@ -259,12 +85,7 @@ def get_voltage(self): A float number, the output voltage in volts, e.g. 12.1 """ - if self.psu_voltage is not None and self.get_powergood_status(): - voltage = self._read_generic_file(self.psu_voltage, 0) - return float(voltage) / 1000 - else: - return None - + return None def get_current(self): """ @@ -273,11 +94,7 @@ def get_current(self): Returns: A float number, the electric current in amperes, e.g 15.4 """ - if self.psu_current is not None and self.get_powergood_status(): - amperes = self._read_generic_file(self.psu_current, 0) - return float(amperes) / 1000 - else: - return None + return None def get_power(self): """ @@ -286,11 +103,13 @@ def get_power(self): Returns: A float number, the power in watts, e.g. 302.6 """ - if self.psu_power is not None and self.get_powergood_status(): - power = self._read_generic_file(self.psu_power, 0) - return float(power) / 1000000 - else: - return None + return None + + @property + def led(self): + if not self._led: + self._led = PsuLed(self.index) + return self._led def set_status_led(self, color): """ @@ -308,7 +127,6 @@ def set_status_led(self, color): """ return self.led.set_status(color) - def get_status_led(self): """ Gets the state of the PSU status LED @@ -316,11 +134,7 @@ def get_status_led(self): Returns: A string, one of the predefined STATUS_LED_COLOR_* strings above """ - if self.psu_data['led_num'] == 1: - return Psu.get_shared_led().get_status() - else: - return self.led.get_status() - + return self.led.get_status() def get_power_available_status(self): """ @@ -352,7 +166,177 @@ def is_replaceable(self): Returns: bool: True if it is replaceable. """ - return self.psu_data['hot_swappable'] + return False + + def get_temperature(self): + """ + Retrieves current temperature reading from PSU + + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + return None + + def get_temperature_high_threshold(self): + """ + Retrieves the high threshold temperature of PSU + + Returns: + A float number, the high threshold temperature of PSU in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + return None + + +class Psu(FixedPsu): + """Platform-specific Psu class""" + PSU_CURRENT = "power/psu{}_curr" + PSU_POWER = "power/psu{}_power" + PSU_VPD = "eeprom/psu{}_vpd" + + shared_led = None + + def __init__(self, psu_index): + super(Psu, self).__init__(psu_index) + + self._psu_voltage = None + self._psu_voltage_min = None + self._psu_voltage_max = None + self._psu_voltage_capability = None + + self.psu_current = os.path.join(PSU_PATH, self.PSU_CURRENT.format(self.index)) + self.psu_power = os.path.join(PSU_PATH, self.PSU_POWER.format(self.index)) + self.psu_power_max = self.psu_power + "_max" + self.psu_presence = os.path.join(PSU_PATH, "thermal/psu{}_status".format(self.index)) + + self.psu_temp = os.path.join(PSU_PATH, 'thermal/psu{}_temp'.format(self.index)) + self.psu_temp_threshold = os.path.join(PSU_PATH, 'thermal/psu{}_temp_max'.format(self.index)) + + from .fan import PsuFan + self._fan_list.append(PsuFan(psu_index, 1, self)) + + self.vpd_parser = VpdParser(os.path.join(PSU_PATH, self.PSU_VPD.format(self.index))) + + # initialize thermal for PSU + from .thermal import initialize_psu_thermal + self._thermal_list = initialize_psu_thermal(psu_index, self.get_power_available_status) + + @property + def psu_voltage(self): + if not self._psu_voltage: + psu_voltage_out = os.path.join(PSU_PATH, "power/psu{}_volt_out2".format(self.index)) + if os.path.exists(psu_voltage_out): + self._psu_voltage = psu_voltage_out + else: + psu_voltage_out = os.path.join(PSU_PATH, "power/psu{}_volt".format(self.index)) + if os.path.exists(psu_voltage_out): + self._psu_voltage = psu_voltage_out + + return self._psu_voltage + + @property + def psu_voltage_min(self): + if not self._psu_voltage_min: + psu_voltage = self.psu_voltage + if psu_voltage: + self._psu_voltage_min = psu_voltage + "_min" + + return self._psu_voltage_min + + @property + def psu_voltage_max(self): + if not self._psu_voltage_max: + psu_voltage = self.psu_voltage + if psu_voltage: + self._psu_voltage_max = psu_voltage + "_max" + + return self._psu_voltage_max + + @property + def psu_voltage_capability(self): + if not self._psu_voltage_capability: + psu_voltage = self.psu_voltage + if psu_voltage: + self._psu_voltage_capability = psu_voltage + "_capability" + + return self._psu_voltage_capability + + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + + Returns: + string: Model/part number of device + """ + return self.vpd_parser.get_model() + + def get_serial(self): + """ + Retrieves the serial number of the device + + Returns: + string: Serial number of device + """ + return self.vpd_parser.get_serial() + + def get_revision(self): + """ + Retrieves the hardware revision of the device + + Returns: + string: Revision value of device + """ + return self.vpd_parser.get_revision() + + def get_presence(self): + """ + Retrieves the presence status of power supply unit (PSU) defined + + Returns: + bool: True if PSU is present, False if not + """ + return utils.read_int_from_file(self.psu_presence) == 1 + + def get_voltage(self): + """ + Retrieves current PSU voltage output + + Returns: + A float number, the output voltage in volts, + e.g. 12.1 + """ + if self.get_powergood_status() and self.psu_voltage: + # TODO: should we put log_func=None here? If not do this, when a PSU is back to power, some PSU related + # sysfs may not ready, read_int_from_file would encounter exception and log an error. + voltage = utils.read_int_from_file(self.psu_voltage, log_func=logger.log_info) + return float(voltage) / 1000 + return None + + def get_current(self): + """ + Retrieves present electric current supplied by PSU + + Returns: + A float number, the electric current in amperes, e.g 15.4 + """ + if self.get_powergood_status(): + amperes = utils.read_int_from_file(self.psu_current, log_func=logger.log_info) + return float(amperes) / 1000 + return None + + def get_power(self): + """ + Retrieves current energy supplied by PSU + + Returns: + A float number, the power in watts, e.g. 302.6 + """ + if self.get_powergood_status(): + power = utils.read_int_from_file(self.psu_power, log_func=logger.log_info) + return float(power) / 1000000 + return None @classmethod def get_shared_led(cls): @@ -360,6 +344,29 @@ def get_shared_led(cls): cls.shared_led = SharedLed(PsuLed(None)) return cls.shared_led + @property + def led(self): + if not self._led: + self._led = ComponentFaultyIndicator(Psu.get_shared_led()) + return self._led + + def get_status_led(self): + """ + Gets the state of the PSU status LED + + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + return Psu.get_shared_led().get_status() + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True + def get_temperature(self): """ Retrieves current temperature reading from PSU @@ -368,13 +375,10 @@ def get_temperature(self): A float number of current temperature in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - if self.psu_temp is not None and self.get_powergood_status(): - try: - temp = self._read_generic_file(self.psu_temp, 0) - return float(temp) / 1000 - except Exception as e: - logger.log_info("Fail to get temperature for PSU {} due to - {}".format(self._name, repr(e))) - + if self.get_powergood_status(): + temp = utils.read_int_from_file(self.psu_temp, log_func=logger.log_info) + return float(temp) / 1000 + return None def get_temperature_high_threshold(self): @@ -385,13 +389,10 @@ def get_temperature_high_threshold(self): A float number, the high threshold temperature of PSU in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - if self.psu_temp_threshold is not None and self.get_powergood_status(): - try: - temp_threshold = self._read_generic_file(self.psu_temp_threshold, 0) - return float(temp_threshold) / 1000 - except Exception as e: - logger.log_info("Fail to get temperature threshold for PSU {} due to - {}".format(self._name, repr(e))) - + if self.get_powergood_status(): + temp_threshold = utils.read_int_from_file(self.psu_temp_threshold, log_func=logger.log_info) + return float(temp_threshold) / 1000 + return None def get_voltage_high_threshold(self): @@ -399,19 +400,51 @@ def get_voltage_high_threshold(self): Retrieves the high threshold PSU voltage output Returns: - A float number, the high threshold output voltage in volts, - e.g. 12.1 + A float number, the high threshold output voltage in volts, + e.g. 12.1 + + Notes: + The thresholds of voltage are not supported on all platforms. + So we have to check capability first. """ - # hw-management doesn't expose those sysfs for now - raise NotImplementedError + if self.psu_voltage_capability and self.psu_voltage_max and self.get_powergood_status(): + capability = utils.read_str_from_file(self.psu_voltage_capability) + if 'max' in capability: + max_voltage = utils.read_int_from_file(self.psu_voltage_max, log_func=logger.log_info) + return float(max_voltage) / 1000 + + return None def get_voltage_low_threshold(self): """ Retrieves the low threshold PSU voltage output Returns: - A float number, the low threshold output voltage in volts, - e.g. 12.1 + A float number, the low threshold output voltage in volts, + e.g. 12.1 + + Notes: + The thresholds of voltage are not supported on all platforms. + So we have to check capability first. """ - # hw-management doesn't expose those sysfs for now - raise NotImplementedError + if self.psu_voltage_capability and self.psu_voltage_min and self.get_powergood_status(): + capability = utils.read_str_from_file(self.psu_voltage_capability) + if 'min' in capability: + min_voltage = utils.read_int_from_file(self.psu_voltage_min, log_func=logger.log_info) + return float(min_voltage) / 1000 + + return None + + def get_maximum_supplied_power(self): + """ + Retrieves the maximum supplied power by PSU + + Returns: + A float number, the maximum power output in Watts. + e.g. 1200.1 + """ + if self.psu_power_max and self.get_powergood_status(): + power_max = utils.read_int_from_file(self.psu_power_max, log_func=logger.log_info) + return float(power_max) / 1000000 + else: + return None diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py index 42876adf3c6c..7ebe9d5e5e57 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py @@ -1,3 +1,19 @@ +# +# Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################# # Mellanox # @@ -9,23 +25,17 @@ try: import subprocess import os - from sonic_platform_base.sfp_base import SfpBase from sonic_platform_base.sonic_eeprom import eeprom_dts - from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId - from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom - from sonic_platform_base.sonic_sfp.inf8628 import inf8628InterfaceId - from sonic_platform_base.sonic_sfp.qsfp_dd import qsfp_dd_InterfaceId - from sonic_platform_base.sonic_sfp.qsfp_dd import qsfp_dd_Dom from sonic_py_common.logger import Logger from . import utils + from .device_data import DeviceDataManager + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase except ImportError as e: raise ImportError (str(e) + "- required module not found") try: - # python_sdk_api does not support python3 for now. Daemons like thermalctld or psud + # python_sdk_api does not support python3 for now. Daemons like thermalctld or psud # also import this file without actually use the sdk lib. So we catch the ImportError # and ignore it here. Meanwhile, we have to trigger xcvrd using python2 now because it # uses the sdk lib. @@ -46,171 +56,6 @@ except KeyError: pass -# definitions of the offset and width for values in XCVR info eeprom -XCVR_INTFACE_BULK_OFFSET = 0 -XCVR_INTFACE_BULK_WIDTH_QSFP = 20 -XCVR_INTFACE_BULK_WIDTH_SFP = 21 -XCVR_TYPE_OFFSET = 0 -XCVR_TYPE_WIDTH = 1 -XCVR_EXT_TYPE_OFFSET = 1 -XCVR_EXT_TYPE_WIDTH = 1 -XCVR_CONNECTOR_OFFSET = 2 -XCVR_CONNECTOR_WIDTH = 1 -XCVR_COMPLIANCE_CODE_OFFSET = 3 -XCVR_COMPLIANCE_CODE_WIDTH = 8 -XCVR_ENCODING_OFFSET = 11 -XCVR_ENCODING_WIDTH = 1 -XCVR_NBR_OFFSET = 12 -XCVR_NBR_WIDTH = 1 -XCVR_EXT_RATE_SEL_OFFSET = 13 -XCVR_EXT_RATE_SEL_WIDTH = 1 -XCVR_CABLE_LENGTH_OFFSET = 14 -XCVR_CABLE_LENGTH_WIDTH_QSFP = 5 -XCVR_CABLE_LENGTH_WIDTH_SFP = 6 -XCVR_VENDOR_NAME_OFFSET = 20 -XCVR_VENDOR_NAME_WIDTH = 16 -XCVR_VENDOR_OUI_OFFSET = 37 -XCVR_VENDOR_OUI_WIDTH = 3 -XCVR_VENDOR_PN_OFFSET = 40 -XCVR_VENDOR_PN_WIDTH = 16 -XCVR_HW_REV_OFFSET = 56 -XCVR_HW_REV_WIDTH_OSFP = 2 -XCVR_HW_REV_WIDTH_QSFP = 2 -XCVR_HW_REV_WIDTH_SFP = 4 -XCVR_EXT_SPECIFICATION_COMPLIANCE_OFFSET = 64 -XCVR_EXT_SPECIFICATION_COMPLIANCE_WIDTH = 1 -XCVR_VENDOR_SN_OFFSET = 68 -XCVR_VENDOR_SN_WIDTH = 16 -XCVR_VENDOR_DATE_OFFSET = 84 -XCVR_VENDOR_DATE_WIDTH = 8 -XCVR_DOM_CAPABILITY_OFFSET = 92 -XCVR_DOM_CAPABILITY_WIDTH = 2 - -# definitions of the offset and width for values in XCVR_QSFP_DD info eeprom -XCVR_EXT_TYPE_OFFSET_QSFP_DD = 72 -XCVR_EXT_TYPE_WIDTH_QSFP_DD = 2 -XCVR_CONNECTOR_OFFSET_QSFP_DD = 75 -XCVR_CONNECTOR_WIDTH_QSFP_DD = 1 -XCVR_CABLE_LENGTH_OFFSET_QSFP_DD = 74 -XCVR_CABLE_LENGTH_WIDTH_QSFP_DD = 1 -XCVR_HW_REV_OFFSET_QSFP_DD = 36 -XCVR_HW_REV_WIDTH_QSFP_DD = 2 -XCVR_VENDOR_DATE_OFFSET_QSFP_DD = 54 -XCVR_VENDOR_DATE_WIDTH_QSFP_DD = 8 -XCVR_DOM_CAPABILITY_OFFSET_QSFP_DD = 2 -XCVR_DOM_CAPABILITY_WIDTH_QSFP_DD = 1 -XCVR_MEDIA_TYPE_OFFSET_QSFP_DD = 85 -XCVR_MEDIA_TYPE_WIDTH_QSFP_DD = 1 -XCVR_FIRST_APPLICATION_LIST_OFFSET_QSFP_DD = 86 -XCVR_FIRST_APPLICATION_LIST_WIDTH_QSFP_DD = 32 -XCVR_SECOND_APPLICATION_LIST_OFFSET_QSFP_DD = 351 -XCVR_SECOND_APPLICATION_LIST_WIDTH_QSFP_DD = 28 - -# to improve performance we retrieve all eeprom data via a single ethtool command -# in function get_transceiver_info and get_transceiver_bulk_status -# XCVR_INTERFACE_DATA_SIZE stands for the max size to be read -# this variable is only used by get_transceiver_info. -# please be noted that each time some new value added to the function -# we should make sure that it falls into the area -# [XCVR_INTERFACE_DATA_START, XCVR_INTERFACE_DATA_SIZE] or -# adjust XCVR_INTERFACE_MAX_SIZE to contain the new data -# It's same for [QSFP_DOM_BULK_DATA_START, QSFP_DOM_BULK_DATA_SIZE] and -# [SFP_DOM_BULK_DATA_START, SFP_DOM_BULK_DATA_SIZE] which are used by -# get_transceiver_bulk_status -XCVR_INTERFACE_DATA_START = 0 -XCVR_INTERFACE_DATA_SIZE = 92 -SFP_MODULE_ADDRA2_OFFSET = 256 -SFP_MODULE_THRESHOLD_OFFSET = 0 -SFP_MODULE_THRESHOLD_WIDTH = 56 - -QSFP_DOM_BULK_DATA_START = 22 -QSFP_DOM_BULK_DATA_SIZE = 36 -SFP_DOM_BULK_DATA_START = 96 -SFP_DOM_BULK_DATA_SIZE = 10 - -QSFP_DD_DOM_BULK_DATA_START = 14 -QSFP_DD_DOM_BULK_DATA_SIZE = 4 - -# definitions of the offset for values in OSFP info eeprom -OSFP_TYPE_OFFSET = 0 -OSFP_VENDOR_NAME_OFFSET = 129 -OSFP_VENDOR_PN_OFFSET = 148 -OSFP_HW_REV_OFFSET = 164 -OSFP_VENDOR_SN_OFFSET = 166 - -# definitions of the offset for values in QSFP_DD info eeprom -QSFP_DD_TYPE_OFFSET = 0 -QSFP_DD_VENDOR_NAME_OFFSET = 1 -QSFP_DD_VENDOR_PN_OFFSET = 20 -QSFP_DD_VENDOR_SN_OFFSET = 38 -QSFP_DD_VENDOR_OUI_OFFSET = 17 - -#definitions of the offset and width for values in DOM info eeprom -QSFP_DOM_REV_OFFSET = 1 -QSFP_DOM_REV_WIDTH = 1 -QSFP_TEMPE_OFFSET = 22 -QSFP_TEMPE_WIDTH = 2 -QSFP_VOLT_OFFSET = 26 -QSFP_VOLT_WIDTH = 2 -QSFP_VERSION_COMPLIANCE_OFFSET = 1 -QSFP_VERSION_COMPLIANCE_WIDTH = 2 -QSFP_CHANNL_MON_OFFSET = 34 -QSFP_CHANNL_MON_WIDTH = 16 -QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH = 24 -QSFP_CHANNL_DISABLE_STATUS_OFFSET = 86 -QSFP_CHANNL_DISABLE_STATUS_WIDTH = 1 -QSFP_CHANNL_RX_LOS_STATUS_OFFSET = 3 -QSFP_CHANNL_RX_LOS_STATUS_WIDTH = 1 -QSFP_CHANNL_TX_FAULT_STATUS_OFFSET = 4 -QSFP_CHANNL_TX_FAULT_STATUS_WIDTH = 1 -QSFP_CONTROL_OFFSET = 86 -QSFP_CONTROL_WIDTH = 8 -QSFP_MODULE_MONITOR_OFFSET = 0 -QSFP_MODULE_MONITOR_WIDTH = 9 -QSFP_POWEROVERRIDE_OFFSET = 93 -QSFP_POWEROVERRIDE_WIDTH = 1 -QSFP_POWEROVERRIDE_BIT = 0 -QSFP_POWERSET_BIT = 1 -QSFP_OPTION_VALUE_OFFSET = 192 -QSFP_OPTION_VALUE_WIDTH = 4 - -QSFP_MODULE_UPPER_PAGE3_START = 384 -QSFP_MODULE_THRESHOLD_OFFSET = 128 -QSFP_MODULE_THRESHOLD_WIDTH = 24 -QSFP_CHANNL_THRESHOLD_OFFSET = 176 -QSFP_CHANNL_THRESHOLD_WIDTH = 24 - -SFP_TEMPE_OFFSET = 96 -SFP_TEMPE_WIDTH = 2 -SFP_VOLT_OFFSET = 98 -SFP_VOLT_WIDTH = 2 -SFP_CHANNL_MON_OFFSET = 100 -SFP_CHANNL_MON_WIDTH = 6 -SFP_CHANNL_STATUS_OFFSET = 110 -SFP_CHANNL_STATUS_WIDTH = 1 - -QSFP_DD_TEMPE_OFFSET = 14 -QSFP_DD_TEMPE_WIDTH = 2 -QSFP_DD_VOLT_OFFSET = 16 -QSFP_DD_VOLT_WIDTH = 2 -QSFP_DD_TX_BIAS_OFFSET = 42 -QSFP_DD_TX_BIAS_WIDTH = 16 -QSFP_DD_RX_POWER_OFFSET = 58 -QSFP_DD_RX_POWER_WIDTH = 16 -QSFP_DD_TX_POWER_OFFSET = 26 -QSFP_DD_TX_POWER_WIDTH = 16 -QSFP_DD_CHANNL_MON_OFFSET = 26 -QSFP_DD_CHANNL_MON_WIDTH = 48 -QSFP_DD_CHANNL_DISABLE_STATUS_OFFSET = 86 -QSFP_DD_CHANNL_DISABLE_STATUS_WIDTH = 1 -QSFP_DD_CHANNL_RX_LOS_STATUS_OFFSET = 19 -QSFP_DD_CHANNL_RX_LOS_STATUS_WIDTH = 1 -QSFP_DD_CHANNL_TX_FAULT_STATUS_OFFSET = 7 -QSFP_DD_CHANNL_TX_FAULT_STATUS_WIDTH = 1 -QSFP_DD_MODULE_THRESHOLD_OFFSET = 0 -QSFP_DD_MODULE_THRESHOLD_WIDTH = 72 -QSFP_DD_CHANNL_STATUS_OFFSET = 26 -QSFP_DD_CHANNL_STATUS_WIDTH = 1 # identifier value of xSFP module which is in the first byte of the EEPROM # if the identifier value falls into SFP_TYPE_CODE_LIST the module is treated as a SFP module and parsed according to 8472 @@ -235,31 +80,6 @@ '18' # QSFP-DD Double Density 8X Pluggable Transceiver ] -qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)', - 'Length OM2(m)', 'Length OM1(m)', - 'Length Cable Assembly(m)') - -sfp_cable_length_tup = ('LengthSMFkm-UnitsOfKm', 'LengthSMF(UnitsOf100m)', - 'Length50um(UnitsOf10m)', 'Length62.5um(UnitsOfm)', - 'LengthCable(UnitsOfm)', 'LengthOM3(UnitsOf10m)') - -sfp_compliance_code_tup = ('10GEthernetComplianceCode', 'InfinibandComplianceCode', - 'ESCONComplianceCodes', 'SONETComplianceCodes', - 'EthernetComplianceCodes','FibreChannelLinkLength', - 'FibreChannelTechnology', 'SFP+CableTechnology', - 'FibreChannelTransmissionMedia','FibreChannelSpeed') - -qsfp_compliance_code_tup = ('10/40G Ethernet Compliance Code', 'SONET Compliance codes', - 'SAS/SATA compliance codes', 'Gigabit Ethernet Compliant codes', - 'Fibre Channel link length/Transmitter Technology', - 'Fibre Channel transmission media', 'Fibre Channel Speed') - -SFP_PATH = "/var/run/hw-management/qsfp/" -SFP_TYPE = "SFP" -QSFP_TYPE = "QSFP" -OSFP_TYPE = "OSFP" -QSFP_DD_TYPE = "QSFP_DD" - #variables for sdk REGISTER_NUM = 1 DEVICE_ID = 1 @@ -301,6 +121,13 @@ # parameters for SFP presence SFP_STATUS_INSERTED = '1' +# SFP constants +SFP_PAGE_SIZE = 256 +SFP_UPPER_PAGE_OFFSET = 128 +SFP_VENDOR_PAGE_START = 640 + +BYTES_IN_DWORD = 4 + # Global logger class instance logger = Logger() @@ -314,6 +141,7 @@ def initialize_sdk_handle(): return sdk_handle + def deinitialize_sdk_handle(sdk_handle): if sdk_handle is not None: rc = sx_api_close(sdk_handle) @@ -325,6 +153,72 @@ def deinitialize_sdk_handle(sdk_handle): logger.log_warning("Sdk handle is none") return False +class MlxregManager: + def __init__(self, mst_pci_device, slot_id, sdk_index): + self.mst_pci_device = mst_pci_device + self.slot_id = slot_id + self.sdk_index = sdk_index + + def construct_dword(self, write_buffer): + if len(write_buffer) == 0: + return None + + used_bytes_in_dword = len(write_buffer) % BYTES_IN_DWORD + + res = "dword[0]=0x" + for idx, x in enumerate(write_buffer): + word = hex(x)[2:] + + if (idx > 0) and (idx % BYTES_IN_DWORD) == 0: + res += ",dword[{}]=0x".format(str((idx + 1)//BYTES_IN_DWORD)) + res += word.zfill(2) + + if used_bytes_in_dword > 0: + res += (BYTES_IN_DWORD - used_bytes_in_dword) * "00" + return res + + def write_mlxreg_eeprom(self, num_bytes, dword, device_address, page): + if not dword: + return False + + try: + cmd = "mlxreg -d /dev/mst/{} --reg_name MCIA --indexes \ + slot_index={},module={},device_address={},page_number={},i2c_device_address=0x50,size={},bank_number=0 \ + --set {} -y".format(self.mst_pci_device, self.slot_id, self.sdk_index, device_address, page, num_bytes, dword) + subprocess.check_call(cmd, shell=True, universal_newlines=True, stdout=subprocess.DEVNULL) + except subprocess.CalledProcessError as e: + logger.log_error("Error! Unable to write data for {} port, page {} offset {}, rc = {}, err msg: {}".format(self.sdk_index, page, device_address, e.returncode, e.output)) + return False + return True + + def read_mlxred_eeprom(self, offset, page, num_bytes): + try: + cmd = "mlxreg -d /dev/mst/{} --reg_name MCIA --indexes \ + slot_index={},module={},device_address={},page_number={},i2c_device_address=0x50,size={},bank_number=0 \ + --get".format(self.mst_pci_device, self.slot_id, self.sdk_index, offset, page, num_bytes) + result = subprocess.check_output(cmd, universal_newlines=True, shell=True) + except subprocess.CalledProcessError as e: + logger.log_error("Error! Unable to write data for {} port, page {} offset {}, rc = {}, err msg: {}".format(self.sdk_index, page, device_address, e.returncode, e.output)) + return None + return result + + def parse_mlxreg_read_output(self, read_output, num_bytes): + res = "" + dword_num = num_bytes // BYTES_IN_DWORD + used_bytes_in_dword = num_bytes % BYTES_IN_DWORD + arr = [value for value in read_output.split('\n') if value[0:5] == "dword"] + for i in range(dword_num): + dword = arr[i].split()[2] + res += dword[2:] + + if used_bytes_in_dword > 0: + # Cut needed info and insert into final hex string + # Example: 3 bytes : 0x12345600 + # ^ ^ + dword = arr[dword_num].split()[2] + res += dword[2 : 2 + used_bytes_in_dword * 2] + + return bytearray.fromhex(res) if res else None class SdkHandleContext(object): def __init__(self): @@ -338,9 +232,9 @@ def __exit__(self, exc_type, exc_val, exc_tb): deinitialize_sdk_handle(self.sdk_handle) -class SFP(SfpBase): +class SFP(SfpOptoeBase): """Platform-specific SFP class""" - + shared_sdk_handle = None SFP_MLNX_ERROR_DESCRIPTION_LONGRANGE_NON_MLNX_CABLE = 'Long range for non-Mellanox cable or module' SFP_MLNX_ERROR_DESCRIPTION_ENFORCE_PART_NUMBER_LIST = 'Enforce part number list' SFP_MLNX_ERROR_DESCRIPTION_PMD_TYPE_NOT_ENABLED = 'PMD type not enabled' @@ -353,33 +247,51 @@ class SFP(SfpBase): SFP_MLNX_ERROR_BIT_PCIE_POWER_SLOT_EXCEEDED = 0x00080000 SFP_MLNX_ERROR_BIT_RESERVED = 0x80000000 - def __init__(self, sfp_index, sfp_type, sdk_handle_getter, platform): - SfpBase.__init__(self) - self.index = sfp_index + 1 - self.sfp_eeprom_path = "qsfp{}".format(self.index) - self.sfp_status_path = "qsfp{}_status".format(self.index) - self._detect_sfp_type(sfp_type) - self.dom_tx_disable_supported = False - self._dom_capability_detect() - self.sdk_handle_getter = sdk_handle_getter - self.sdk_index = sfp_index - - # initialize SFP thermal list - from .thermal import initialize_sfp_thermals - initialize_sfp_thermals(platform, self._thermal_list, self.index) + def __init__(self, sfp_index, slot_id=0, linecard_port_count=0, lc_name=None): + super(SFP, self).__init__() + + if slot_id == 0: # For non-modular chassis + self.index = sfp_index + 1 + self.sdk_index = sfp_index + + from .thermal import initialize_sfp_thermal + self._thermal_list = initialize_sfp_thermal(sfp_index) + else: # For modular chassis + # (slot_id % MAX_LC_CONUNT - 1) * MAX_PORT_COUNT + (sfp_index + 1) * (MAX_PORT_COUNT / LC_PORT_COUNT) + max_linecard_count = DeviceDataManager.get_linecard_count() + max_linecard_port_count = DeviceDataManager.get_linecard_max_port_count() + self.index = (slot_id % max_linecard_count - 1) * max_linecard_port_count + sfp_index * (max_linecard_port_count / linecard_port_count) + 1 + self.sdk_index = sfp_index + + from .thermal import initialize_linecard_sfp_thermal + self._thermal_list = initialize_linecard_sfp_thermal(lc_name, slot_id, sfp_index) + + self.slot_id = slot_id + self.mst_pci_device = self.get_mst_pci_device() + + # get MST PCI device name + def get_mst_pci_device(self): + device_name = None + try: + device_name = subprocess.check_output("ls /dev/mst/ | grep pciconf", universal_newlines=True, shell=True).strip() + except subprocess.CalledProcessError as e: + logger.log_error("Failed to find mst PCI device rc={} err.msg={}".format(e.returncode, e.output)) + return device_name @property def sdk_handle(self): - return self.sdk_handle_getter() + if not SFP.shared_sdk_handle: + SFP.shared_sdk_handle = initialize_sdk_handle() + if not SFP.shared_sdk_handle: + logger.log_error('Failed to open SDK handle') + return SFP.shared_sdk_handle def reinit(self): - """ Re-initialize this SFP object when a new SFP inserted - :return: + :return: """ - self._detect_sfp_type(self.sfp_type) - self._dom_capability_detect() + self.refresh_xcvr_api() def get_presence(self): """ @@ -388,33 +300,21 @@ def get_presence(self): Returns: bool: True if device is present, False if not """ - presence = False - ethtool_cmd = "ethtool -m sfp{} hex on offset 0 length 1 2>/dev/null".format(self.index) - try: - proc = subprocess.Popen(ethtool_cmd, - stdout=subprocess.PIPE, - shell=True, - stderr=subprocess.STDOUT, - universal_newlines=True) - stdout = proc.communicate()[0] - proc.wait() - result = stdout.rstrip('\n') - if result != '': - presence = True - - except OSError as e: - raise OSError("Cannot detect sfp") - - return presence + eeprom_raw = self.read_eeprom(0, 1) + return eeprom_raw is not None # Read out any bytes from any offset def _read_eeprom_specific_bytes(self, offset, num_bytes): + if offset + num_bytes > SFP_VENDOR_PAGE_START: + logger.log_error("Error mismatch between page size and bytes to read (offset: {} num_bytes: {}) ".format(offset, num_bytes)) + return None + eeprom_raw = [] - ethtool_cmd = "ethtool -m sfp{} hex on offset {} length {} 2>/dev/null".format(self.index, offset, num_bytes) + ethtool_cmd = "ethtool -m sfp{} hex on offset {} length {}".format(self.index, offset, num_bytes) try: - output = subprocess.check_output(ethtool_cmd, - shell=True, + output = subprocess.check_output(ethtool_cmd, + shell=True, universal_newlines=True) output_lines = output.splitlines() first_line_raw = output_lines[0] @@ -425,1099 +325,92 @@ def _read_eeprom_specific_bytes(self, offset, num_bytes): except subprocess.CalledProcessError as e: return None - return eeprom_raw - - - def _detect_sfp_type(self, sfp_type): - eeprom_raw = [] - eeprom_raw = self._read_eeprom_specific_bytes(XCVR_TYPE_OFFSET, XCVR_TYPE_WIDTH) - if eeprom_raw: - if eeprom_raw[0] in SFP_TYPE_CODE_LIST: - self.sfp_type = SFP_TYPE - elif eeprom_raw[0] in QSFP_TYPE_CODE_LIST: - self.sfp_type = QSFP_TYPE - elif eeprom_raw[0] in QSFP_DD_TYPE_CODE_LIST: - self.sfp_type = QSFP_DD_TYPE - else: - # we don't regonize this identifier value, treat the xSFP module as the default type - self.sfp_type = sfp_type - logger.log_info("Identifier value of {} module {} is {} which isn't regonized and will be treated as default type ({})".format( - sfp_type, self.index, eeprom_raw[0], sfp_type - )) - else: - # eeprom_raw being None indicates the module is not present. - # in this case we treat it as the default type according to the SKU - self.sfp_type = sfp_type - - - def _dom_capability_detect(self): - if not self.get_presence(): - self.dom_supported = False - self.dom_temp_supported = False - self.dom_volt_supported = False - self.dom_rx_power_supported = False - self.dom_tx_bias_power_supported = False - self.dom_tx_power_supported = False - self.calibration = 0 - return - - if self.sfp_type == QSFP_TYPE: - self.calibration = 1 - sfpi_obj = sff8436InterfaceId() - if sfpi_obj is None: - self.dom_supported = False - offset = 128 - - # QSFP capability byte parse, through this byte can know whether it support tx_power or not. - # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, - # need to add more code for determining the capability and version compliance - # in SFF-8636 dom capability definitions evolving with the versions. - qsfp_dom_capability_raw = self._read_eeprom_specific_bytes((offset + XCVR_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH) - if qsfp_dom_capability_raw is not None: - qsfp_version_compliance_raw = self._read_eeprom_specific_bytes(QSFP_VERSION_COMPLIANCE_OFFSET, QSFP_VERSION_COMPLIANCE_WIDTH) - qsfp_version_compliance = int(qsfp_version_compliance_raw[0], 16) - dom_capability = sfpi_obj.parse_dom_capability(qsfp_dom_capability_raw, 0) - if qsfp_version_compliance >= 0x08: - self.dom_temp_supported = dom_capability['data']['Temp_support']['value'] == 'On' - self.dom_volt_supported = dom_capability['data']['Voltage_support']['value'] == 'On' - self.dom_rx_power_supported = dom_capability['data']['Rx_power_support']['value'] == 'On' - self.dom_tx_power_supported = dom_capability['data']['Tx_power_support']['value'] == 'On' - else: - self.dom_temp_supported = True - self.dom_volt_supported = True - self.dom_rx_power_supported = dom_capability['data']['Rx_power_support']['value'] == 'On' - self.dom_tx_power_supported = True - self.dom_supported = True - self.calibration = 1 - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return None - qsfp_option_value_raw = self._read_eeprom_specific_bytes(QSFP_OPTION_VALUE_OFFSET, QSFP_OPTION_VALUE_WIDTH) - if qsfp_option_value_raw is not None: - optional_capability = sfpd_obj.parse_option_params(qsfp_option_value_raw, 0) - self.dom_tx_disable_supported = optional_capability['data']['TxDisable']['value'] == 'On' - dom_status_indicator = sfpd_obj.parse_dom_status_indicator(qsfp_version_compliance_raw, 1) - self.qsfp_page3_available = dom_status_indicator['data']['FlatMem']['value'] == 'Off' - else: - self.dom_supported = False - self.dom_temp_supported = False - self.dom_volt_supported = False - self.dom_rx_power_supported = False - self.dom_tx_power_supported = False - self.calibration = 0 - self.qsfp_page3_available = False - - elif self.sfp_type == QSFP_DD_TYPE: - sfpi_obj = qsfp_dd_InterfaceId() - if sfpi_obj is None: - self.dom_supported = False - - offset = 0 - # two types of QSFP-DD cable types supported: Copper and Optical. - qsfp_dom_capability_raw = self._read_eeprom_specific_bytes((offset + XCVR_DOM_CAPABILITY_OFFSET_QSFP_DD), XCVR_DOM_CAPABILITY_WIDTH_QSFP_DD) - if qsfp_dom_capability_raw is not None: - self.dom_temp_supported = True - self.dom_volt_supported = True - dom_capability = sfpi_obj.parse_dom_capability(qsfp_dom_capability_raw, 0) - if dom_capability['data']['Flat_MEM']['value'] == 'Off': - self.dom_supported = True - self.second_application_list = True - self.dom_rx_power_supported = True - self.dom_tx_power_supported = True - self.dom_tx_bias_power_supported = True - self.dom_thresholds_supported = True - self.dom_rx_tx_power_bias_supported = True - else: - self.dom_supported = False - self.second_application_list = False - self.dom_rx_power_supported = False - self.dom_tx_power_supported = False - self.dom_tx_bias_power_supported = False - self.dom_thresholds_supported = False - self.dom_rx_tx_power_bias_supported = False - else: - self.dom_supported = False - self.dom_temp_supported = False - self.dom_volt_supported = False - self.dom_rx_power_supported = False - self.dom_tx_power_supported = False - self.dom_tx_bias_power_supported = False - self.dom_thresholds_supported = False - self.dom_rx_tx_power_bias_supported = False - - elif self.sfp_type == SFP_TYPE: - sfpi_obj = sff8472InterfaceId() - if sfpi_obj is None: - return None - sfp_dom_capability_raw = self._read_eeprom_specific_bytes(XCVR_DOM_CAPABILITY_OFFSET, XCVR_DOM_CAPABILITY_WIDTH) - if sfp_dom_capability_raw is not None: - sfp_dom_capability = int(sfp_dom_capability_raw[0], 16) - self.dom_supported = (sfp_dom_capability & 0x40 != 0) - if self.dom_supported: - self.dom_temp_supported = True - self.dom_volt_supported = True - self.dom_rx_power_supported = True - self.dom_tx_power_supported = True - if sfp_dom_capability & 0x20 != 0: - self.calibration = 1 - elif sfp_dom_capability & 0x10 != 0: - self.calibration = 2 - else: - self.calibration = 0 - else: - self.dom_temp_supported = False - self.dom_volt_supported = False - self.dom_rx_power_supported = False - self.dom_tx_power_supported = False - self.calibration = 0 - self.dom_tx_disable_supported = (int(sfp_dom_capability_raw[1], 16) & 0x40 != 0) - else: - self.dom_supported = False - self.dom_temp_supported = False - self.dom_volt_supported = False - self.dom_rx_power_supported = False - self.dom_tx_power_supported = False - - - def _convert_string_to_num(self, value_str): - if "-inf" in value_str: - return 'N/A' - elif "Unknown" in value_str: - return 'N/A' - elif 'dBm' in value_str: - t_str = value_str.rstrip('dBm') - return float(t_str) - elif 'mA' in value_str: - t_str = value_str.rstrip('mA') - return float(t_str) - elif 'C' in value_str: - t_str = value_str.rstrip('C') - return float(t_str) - elif 'Volts' in value_str: - t_str = value_str.rstrip('Volts') - return float(t_str) - else: - return 'N/A' - - - def get_transceiver_info(self): - """ - Retrieves transceiver info of this SFP - - Returns: - A dict which contains following keys/values : - ================================================================================ - keys |Value Format |Information - ---------------------------|---------------|---------------------------- - type |1*255VCHAR |type of SFP - hardware_rev |1*255VCHAR |hardware version of SFP - serial |1*255VCHAR |serial number of the SFP - manufacturer |1*255VCHAR |SFP vendor name - model |1*255VCHAR |SFP model name - connector |1*255VCHAR |connector information - encoding |1*255VCHAR |encoding information - ext_identifier |1*255VCHAR |extend identifier - ext_rateselect_compliance |1*255VCHAR |extended rateSelect compliance - cable_length |INT |cable length in m - mominal_bit_rate |INT |nominal bit rate by 100Mbs - specification_compliance |1*255VCHAR |specification compliance - vendor_date |1*255VCHAR |vendor date - vendor_oui |1*255VCHAR |vendor OUI - application_advertisement |1*255VCHAR |supported applications advertisement - ================================================================================ - """ - transceiver_info_dict = {} - compliance_code_dict = {} - - # ToDo: OSFP tranceiver info parsing not fully supported. - # in inf8628.py lack of some memory map definition - # will be implemented when the inf8628 memory map ready - if self.sfp_type == OSFP_TYPE: - offset = 0 - vendor_rev_width = XCVR_HW_REV_WIDTH_OSFP - - sfpi_obj = inf8628InterfaceId() - if sfpi_obj is None: - return None - - sfp_type_raw = self._read_eeprom_specific_bytes((offset + OSFP_TYPE_OFFSET), XCVR_TYPE_WIDTH) - if sfp_type_raw is not None: - sfp_type_data = sfpi_obj.parse_sfp_type(sfp_type_raw, 0) - else: - return None - - sfp_vendor_name_raw = self._read_eeprom_specific_bytes((offset + OSFP_VENDOR_NAME_OFFSET), XCVR_VENDOR_NAME_WIDTH) - if sfp_vendor_name_raw is not None: - sfp_vendor_name_data = sfpi_obj.parse_vendor_name(sfp_vendor_name_raw, 0) - else: - return None - - sfp_vendor_pn_raw = self._read_eeprom_specific_bytes((offset + OSFP_VENDOR_PN_OFFSET), XCVR_VENDOR_PN_WIDTH) - if sfp_vendor_pn_raw is not None: - sfp_vendor_pn_data = sfpi_obj.parse_vendor_pn(sfp_vendor_pn_raw, 0) - else: - return None - - sfp_vendor_rev_raw = self._read_eeprom_specific_bytes((offset + OSFP_HW_REV_OFFSET), vendor_rev_width) - if sfp_vendor_rev_raw is not None: - sfp_vendor_rev_data = sfpi_obj.parse_vendor_rev(sfp_vendor_rev_raw, 0) - else: - return None - - sfp_vendor_sn_raw = self._read_eeprom_specific_bytes((offset + OSFP_VENDOR_SN_OFFSET), XCVR_VENDOR_SN_WIDTH) - if sfp_vendor_sn_raw is not None: - sfp_vendor_sn_data = sfpi_obj.parse_vendor_sn(sfp_vendor_sn_raw, 0) - else: - return None - - transceiver_info_dict['type'] = sfp_type_data['data']['type']['value'] - transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] - transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] - transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] - transceiver_info_dict['vendor_oui'] = 'N/A' - transceiver_info_dict['vendor_date'] = 'N/A' - transceiver_info_dict['connector'] = 'N/A' - transceiver_info_dict['encoding'] = 'N/A' - transceiver_info_dict['ext_identifier'] = 'N/A' - transceiver_info_dict['ext_rateselect_compliance'] = 'N/A' - transceiver_info_dict['cable_type'] = 'N/A' - transceiver_info_dict['cable_length'] = 'N/A' - transceiver_info_dict['specification_compliance'] = 'N/A' - transceiver_info_dict['nominal_bit_rate'] = 'N/A' - transceiver_info_dict['application_advertisement'] = 'N/A' - - elif self.sfp_type == QSFP_TYPE: - offset = 128 - vendor_rev_width = XCVR_HW_REV_WIDTH_QSFP - cable_length_width = XCVR_CABLE_LENGTH_WIDTH_QSFP - interface_info_bulk_width = XCVR_INTFACE_BULK_WIDTH_QSFP - sfp_type = 'QSFP' - - sfpi_obj = sff8436InterfaceId() - if sfpi_obj is None: - print("Error: sfp_object open failed") - return None - - elif self.sfp_type == QSFP_DD_TYPE: - offset = 128 - - sfpi_obj = qsfp_dd_InterfaceId() - if sfpi_obj is None: - print("Error: sfp_object open failed") - return None - - sfp_type_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_TYPE_OFFSET), XCVR_TYPE_WIDTH) - if sfp_type_raw is not None: - sfp_type_data = sfpi_obj.parse_sfp_type(sfp_type_raw, 0) - else: - return None - - sfp_vendor_name_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_VENDOR_NAME_OFFSET), XCVR_VENDOR_NAME_WIDTH) - if sfp_vendor_name_raw is not None: - sfp_vendor_name_data = sfpi_obj.parse_vendor_name(sfp_vendor_name_raw, 0) - else: - return None - - sfp_vendor_pn_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_VENDOR_PN_OFFSET), XCVR_VENDOR_PN_WIDTH) - if sfp_vendor_pn_raw is not None: - sfp_vendor_pn_data = sfpi_obj.parse_vendor_pn(sfp_vendor_pn_raw, 0) - else: - return None - - sfp_vendor_rev_raw = self._read_eeprom_specific_bytes((offset + XCVR_HW_REV_OFFSET_QSFP_DD), XCVR_HW_REV_WIDTH_QSFP_DD) - if sfp_vendor_rev_raw is not None: - sfp_vendor_rev_data = sfpi_obj.parse_vendor_rev(sfp_vendor_rev_raw, 0) - else: - return None - - sfp_vendor_sn_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_VENDOR_SN_OFFSET), XCVR_VENDOR_SN_WIDTH) - if sfp_vendor_sn_raw is not None: - sfp_vendor_sn_data = sfpi_obj.parse_vendor_sn(sfp_vendor_sn_raw, 0) - else: - return None - - sfp_vendor_oui_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_VENDOR_OUI_OFFSET), XCVR_VENDOR_OUI_WIDTH) - if sfp_vendor_oui_raw is not None: - sfp_vendor_oui_data = sfpi_obj.parse_vendor_oui(sfp_vendor_oui_raw, 0) - else: - return None - - sfp_vendor_date_raw = self._read_eeprom_specific_bytes((offset + XCVR_VENDOR_DATE_OFFSET_QSFP_DD), XCVR_VENDOR_DATE_WIDTH_QSFP_DD) - if sfp_vendor_date_raw is not None: - sfp_vendor_date_data = sfpi_obj.parse_vendor_date(sfp_vendor_date_raw, 0) - else: - return None - - sfp_connector_raw = self._read_eeprom_specific_bytes((offset + XCVR_CONNECTOR_OFFSET_QSFP_DD), XCVR_CONNECTOR_WIDTH_QSFP_DD) - if sfp_connector_raw is not None: - sfp_connector_data = sfpi_obj.parse_connector(sfp_connector_raw, 0) - else: - return None - - sfp_ext_identifier_raw = self._read_eeprom_specific_bytes((offset + XCVR_EXT_TYPE_OFFSET_QSFP_DD), XCVR_EXT_TYPE_WIDTH_QSFP_DD) - if sfp_ext_identifier_raw is not None: - sfp_ext_identifier_data = sfpi_obj.parse_ext_iden(sfp_ext_identifier_raw, 0) - else: - return None - - sfp_cable_len_raw = self._read_eeprom_specific_bytes((offset + XCVR_CABLE_LENGTH_OFFSET_QSFP_DD), XCVR_CABLE_LENGTH_WIDTH_QSFP_DD) - if sfp_cable_len_raw is not None: - sfp_cable_len_data = sfpi_obj.parse_cable_len(sfp_cable_len_raw, 0) - else: - return None - - sfp_media_type_raw = self._read_eeprom_specific_bytes(XCVR_MEDIA_TYPE_OFFSET_QSFP_DD, XCVR_MEDIA_TYPE_WIDTH_QSFP_DD) - if sfp_media_type_raw is not None: - sfp_media_type_dict = sfpi_obj.parse_media_type(sfp_media_type_raw, 0) - if sfp_media_type_dict is None: - return None - - host_media_list = "" - sfp_application_type_first_list = self._read_eeprom_specific_bytes((XCVR_FIRST_APPLICATION_LIST_OFFSET_QSFP_DD), XCVR_FIRST_APPLICATION_LIST_WIDTH_QSFP_DD) - if self.second_application_list: - possible_application_count = 15 - sfp_application_type_second_list = self._read_eeprom_specific_bytes((XCVR_SECOND_APPLICATION_LIST_OFFSET_QSFP_DD), XCVR_SECOND_APPLICATION_LIST_WIDTH_QSFP_DD) - if sfp_application_type_first_list is not None and sfp_application_type_second_list is not None: - sfp_application_type_list = sfp_application_type_first_list + sfp_application_type_second_list - else: - return None - else: - possible_application_count = 8 - if sfp_application_type_first_list is not None: - sfp_application_type_list = sfp_application_type_first_list - else: - return None - - for i in range(0, possible_application_count): - if sfp_application_type_list[i * 4] == 'ff': - break - host_electrical, media_interface = sfpi_obj.parse_application(sfp_media_type_dict, sfp_application_type_list[i * 4], sfp_application_type_list[i * 4 + 1]) - host_media_list = host_media_list + host_electrical + ' - ' + media_interface + '\n\t\t\t\t ' - else: - return None - - transceiver_info_dict['type'] = str(sfp_type_data['data']['type']['value']) - transceiver_info_dict['manufacturer'] = str(sfp_vendor_name_data['data']['Vendor Name']['value']) - transceiver_info_dict['model'] = str(sfp_vendor_pn_data['data']['Vendor PN']['value']) - transceiver_info_dict['hardware_rev'] = str(sfp_vendor_rev_data['data']['Vendor Rev']['value']) - transceiver_info_dict['serial'] = str(sfp_vendor_sn_data['data']['Vendor SN']['value']) - transceiver_info_dict['vendor_oui'] = str(sfp_vendor_oui_data['data']['Vendor OUI']['value']) - transceiver_info_dict['vendor_date'] = str(sfp_vendor_date_data['data']['VendorDataCode(YYYY-MM-DD Lot)']['value']) - transceiver_info_dict['connector'] = str(sfp_connector_data['data']['Connector']['value']) - transceiver_info_dict['encoding'] = "Not supported for CMIS cables" - transceiver_info_dict['ext_identifier'] = str(sfp_ext_identifier_data['data']['Extended Identifier']['value']) - transceiver_info_dict['ext_rateselect_compliance'] = "Not supported for CMIS cables" - transceiver_info_dict['specification_compliance'] = "Not supported for CMIS cables" - transceiver_info_dict['cable_type'] = "Length Cable Assembly(m)" - transceiver_info_dict['cable_length'] = str(sfp_cable_len_data['data']['Length Cable Assembly(m)']['value']) - transceiver_info_dict['nominal_bit_rate'] = "Not supported for CMIS cables" - transceiver_info_dict['application_advertisement'] = host_media_list + eeprom_raw = list(map(lambda h: int(h, base=16), eeprom_raw)) + return bytearray(eeprom_raw) - else: - offset = 0 - vendor_rev_width = XCVR_HW_REV_WIDTH_SFP - cable_length_width = XCVR_CABLE_LENGTH_WIDTH_SFP - interface_info_bulk_width = XCVR_INTFACE_BULK_WIDTH_SFP - sfp_type = 'SFP' - - sfpi_obj = sff8472InterfaceId() - if sfpi_obj is None: - print("Error: sfp_object open failed") - return None - - if self.sfp_type != QSFP_DD_TYPE: - sfp_interface_bulk_raw = self._read_eeprom_specific_bytes(offset + XCVR_INTERFACE_DATA_START, XCVR_INTERFACE_DATA_SIZE) - if sfp_interface_bulk_raw is None: - return None - - start = XCVR_INTFACE_BULK_OFFSET - XCVR_INTERFACE_DATA_START - end = start + interface_info_bulk_width - sfp_interface_bulk_data = sfpi_obj.parse_sfp_info_bulk(sfp_interface_bulk_raw[start : end], 0) - - start = XCVR_VENDOR_NAME_OFFSET - XCVR_INTERFACE_DATA_START - end = start + XCVR_VENDOR_NAME_WIDTH - sfp_vendor_name_data = sfpi_obj.parse_vendor_name(sfp_interface_bulk_raw[start : end], 0) - - start = XCVR_VENDOR_PN_OFFSET - XCVR_INTERFACE_DATA_START - end = start + XCVR_VENDOR_PN_WIDTH - sfp_vendor_pn_data = sfpi_obj.parse_vendor_pn(sfp_interface_bulk_raw[start : end], 0) - - start = XCVR_HW_REV_OFFSET - XCVR_INTERFACE_DATA_START - end = start + vendor_rev_width - sfp_vendor_rev_data = sfpi_obj.parse_vendor_rev(sfp_interface_bulk_raw[start : end], 0) - - start = XCVR_VENDOR_SN_OFFSET - XCVR_INTERFACE_DATA_START - end = start + XCVR_VENDOR_SN_WIDTH - sfp_vendor_sn_data = sfpi_obj.parse_vendor_sn(sfp_interface_bulk_raw[start : end], 0) - - start = XCVR_VENDOR_OUI_OFFSET - XCVR_INTERFACE_DATA_START - end = start + XCVR_VENDOR_OUI_WIDTH - sfp_vendor_oui_data = sfpi_obj.parse_vendor_oui(sfp_interface_bulk_raw[start : end], 0) - - start = XCVR_VENDOR_DATE_OFFSET - XCVR_INTERFACE_DATA_START - end = start + XCVR_VENDOR_DATE_WIDTH - sfp_vendor_date_data = sfpi_obj.parse_vendor_date(sfp_interface_bulk_raw[start : end], 0) - - transceiver_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value'] - transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] - transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] - transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] - transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] - transceiver_info_dict['vendor_date'] = sfp_vendor_date_data['data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] - transceiver_info_dict['connector'] = sfp_interface_bulk_data['data']['Connector']['value'] - transceiver_info_dict['encoding'] = sfp_interface_bulk_data['data']['EncodingCodes']['value'] - transceiver_info_dict['ext_identifier'] = sfp_interface_bulk_data['data']['Extended Identifier']['value'] - transceiver_info_dict['ext_rateselect_compliance'] = sfp_interface_bulk_data['data']['RateIdentifier']['value'] - transceiver_info_dict['application_advertisement'] = 'N/A' - - if self.sfp_type == QSFP_TYPE: - for key in qsfp_cable_length_tup: - if key in sfp_interface_bulk_data['data']: - transceiver_info_dict['cable_type'] = key - transceiver_info_dict['cable_length'] = str(sfp_interface_bulk_data['data'][key]['value']) - - for key in qsfp_compliance_code_tup: - if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value'] - sfp_ext_specification_compliance_raw = self._read_eeprom_specific_bytes(offset + XCVR_EXT_SPECIFICATION_COMPLIANCE_OFFSET, XCVR_EXT_SPECIFICATION_COMPLIANCE_WIDTH) - if sfp_ext_specification_compliance_raw is not None: - sfp_ext_specification_compliance_data = sfpi_obj.parse_ext_specification_compliance(sfp_ext_specification_compliance_raw[0 : 1], 0) - if sfp_ext_specification_compliance_data['data']['Extended Specification compliance']['value'] != "Unspecified": - compliance_code_dict['Extended Specification compliance'] = sfp_ext_specification_compliance_data['data']['Extended Specification compliance']['value'] - transceiver_info_dict['specification_compliance'] = str(compliance_code_dict) - - transceiver_info_dict['nominal_bit_rate'] = str(sfp_interface_bulk_data['data']['Nominal Bit Rate(100Mbs)']['value']) - else: - for key in sfp_cable_length_tup: - if key in sfp_interface_bulk_data['data']: - transceiver_info_dict['cable_type'] = key - transceiver_info_dict['cable_length'] = str(sfp_interface_bulk_data['data'][key]['value']) - - for key in sfp_compliance_code_tup: - if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value'] - transceiver_info_dict['specification_compliance'] = str(compliance_code_dict) - - transceiver_info_dict['nominal_bit_rate'] = str(sfp_interface_bulk_data['data']['NominalSignallingRate(UnitsOf100Mbd)']['value']) - - return transceiver_info_dict - - - def get_transceiver_bulk_status(self): + # read eeprom specfic bytes beginning from offset with size as num_bytes + def read_eeprom(self, offset, num_bytes): """ - Retrieves transceiver bulk status of this SFP - + Read eeprom specfic bytes beginning from a random offset with size as num_bytes Returns: - A dict which contains following keys/values : - ======================================================================== - keys |Value Format |Information - ---------------------------|---------------|---------------------------- - RX LOS |BOOLEAN |RX lost-of-signal status, - | |True if has RX los, False if not. - TX FAULT |BOOLEAN |TX fault status, - | |True if has TX fault, False if not. - Reset status |BOOLEAN |reset status, - | |True if SFP in reset, False if not. - LP mode |BOOLEAN |low power mode status, - | |True in lp mode, False if not. - TX disable |BOOLEAN |TX disable status, - | |True TX disabled, False if not. - TX disabled channel |HEX |disabled TX channles in hex, - | |bits 0 to 3 represent channel 0 - | |to channel 3. - Temperature |INT |module temperature in Celsius - Voltage |INT |supply voltage in mV - TX bias |INT |TX Bias Current in mA - RX power |INT |received optical power in mW - TX power |INT |TX output power in mW - ======================================================================== - """ - transceiver_dom_info_dict = {} - - dom_info_dict_keys = ['temperature', 'voltage', - 'rx1power', 'rx2power', - 'rx3power', 'rx4power', - 'rx5power', 'rx6power', - 'rx7power', 'rx8power', - 'tx1bias', 'tx2bias', - 'tx3bias', 'tx4bias', - 'tx5bias', 'tx6bias', - 'tx7bias', 'tx8bias', - 'tx1power', 'tx2power', - 'tx3power', 'tx4power', - 'tx5power', 'tx6power', - 'tx7power', 'tx8power' - ] - transceiver_dom_info_dict = dict.fromkeys(dom_info_dict_keys, 'N/A') - - if self.sfp_type == OSFP_TYPE: - pass - - elif self.sfp_type == QSFP_TYPE: - if not self.dom_supported: - return transceiver_dom_info_dict - - offset = 0 - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return transceiver_dom_info_dict - - dom_data_raw = self._read_eeprom_specific_bytes((offset + QSFP_DOM_BULK_DATA_START), QSFP_DOM_BULK_DATA_SIZE) - if dom_data_raw is None: - return transceiver_dom_info_dict - - if self.dom_temp_supported: - start = QSFP_TEMPE_OFFSET - QSFP_DOM_BULK_DATA_START - end = start + QSFP_TEMPE_WIDTH - dom_temperature_data = sfpd_obj.parse_temperature(dom_data_raw[start : end], 0) - temp = self._convert_string_to_num(dom_temperature_data['data']['Temperature']['value']) - if temp is not None: - transceiver_dom_info_dict['temperature'] = temp - - if self.dom_volt_supported: - start = QSFP_VOLT_OFFSET - QSFP_DOM_BULK_DATA_START - end = start + QSFP_VOLT_WIDTH - dom_voltage_data = sfpd_obj.parse_voltage(dom_data_raw[start : end], 0) - volt = self._convert_string_to_num(dom_voltage_data['data']['Vcc']['value']) - if volt is not None: - transceiver_dom_info_dict['voltage'] = volt - - start = QSFP_CHANNL_MON_OFFSET - QSFP_DOM_BULK_DATA_START - end = start + QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power(dom_data_raw[start : end], 0) - - if self.dom_tx_power_supported: - transceiver_dom_info_dict['tx1power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['TX1Power']['value']) - transceiver_dom_info_dict['tx2power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['TX2Power']['value']) - transceiver_dom_info_dict['tx3power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['TX3Power']['value']) - transceiver_dom_info_dict['tx4power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['TX4Power']['value']) - - if self.dom_rx_power_supported: - transceiver_dom_info_dict['rx1power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['RX1Power']['value']) - transceiver_dom_info_dict['rx2power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['RX2Power']['value']) - transceiver_dom_info_dict['rx3power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['RX3Power']['value']) - transceiver_dom_info_dict['rx4power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['RX4Power']['value']) - - transceiver_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TX1Bias']['value'] - transceiver_dom_info_dict['tx2bias'] = dom_channel_monitor_data['data']['TX2Bias']['value'] - transceiver_dom_info_dict['tx3bias'] = dom_channel_monitor_data['data']['TX3Bias']['value'] - transceiver_dom_info_dict['tx4bias'] = dom_channel_monitor_data['data']['TX4Bias']['value'] - - elif self.sfp_type == QSFP_DD_TYPE: - - offset = 0 - sfpd_obj = qsfp_dd_Dom() - if sfpd_obj is None: - return transceiver_dom_info_dict - - dom_data_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_DOM_BULK_DATA_START), QSFP_DD_DOM_BULK_DATA_SIZE) - if dom_data_raw is None: - return transceiver_dom_info_dict - - if self.dom_temp_supported: - start = QSFP_DD_TEMPE_OFFSET - QSFP_DD_DOM_BULK_DATA_START - end = start + QSFP_DD_TEMPE_WIDTH - dom_temperature_data = sfpd_obj.parse_temperature(dom_data_raw[start : end], 0) - temp = self._convert_string_to_num(dom_temperature_data['data']['Temperature']['value']) - if temp is not None: - transceiver_dom_info_dict['temperature'] = temp - - if self.dom_volt_supported: - start = QSFP_DD_VOLT_OFFSET - QSFP_DD_DOM_BULK_DATA_START - end = start + QSFP_DD_VOLT_WIDTH - dom_voltage_data = sfpd_obj.parse_voltage(dom_data_raw[start : end], 0) - volt = self._convert_string_to_num(dom_voltage_data['data']['Vcc']['value']) - if volt is not None: - transceiver_dom_info_dict['voltage'] = volt - - if self.dom_rx_tx_power_bias_supported: - # page 11h - offset = 512 - dom_data_raw = self._read_eeprom_specific_bytes(offset + QSFP_DD_CHANNL_MON_OFFSET, QSFP_DD_CHANNL_MON_WIDTH) - if dom_data_raw is None: - return transceiver_dom_info_dict - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params(dom_data_raw, 0) - - if self.dom_tx_power_supported: - transceiver_dom_info_dict['tx1power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['TX1Power']['value'])) - transceiver_dom_info_dict['tx2power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['TX2Power']['value'])) - transceiver_dom_info_dict['tx3power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['TX3Power']['value'])) - transceiver_dom_info_dict['tx4power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['TX4Power']['value'])) - transceiver_dom_info_dict['tx5power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['TX5Power']['value'])) - transceiver_dom_info_dict['tx6power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['TX6Power']['value'])) - transceiver_dom_info_dict['tx7power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['TX7Power']['value'])) - transceiver_dom_info_dict['tx8power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['TX8Power']['value'])) - - if self.dom_rx_power_supported: - transceiver_dom_info_dict['rx1power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['RX1Power']['value'])) - transceiver_dom_info_dict['rx2power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['RX2Power']['value'])) - transceiver_dom_info_dict['rx3power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['RX3Power']['value'])) - transceiver_dom_info_dict['rx4power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['RX4Power']['value'])) - transceiver_dom_info_dict['rx5power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['RX5Power']['value'])) - transceiver_dom_info_dict['rx6power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['RX6Power']['value'])) - transceiver_dom_info_dict['rx7power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['RX7Power']['value'])) - transceiver_dom_info_dict['rx8power'] = str(self._convert_string_to_num(dom_channel_monitor_data['data']['RX8Power']['value'])) - - if self.dom_tx_bias_power_supported: - transceiver_dom_info_dict['tx1bias'] = str(dom_channel_monitor_data['data']['TX1Bias']['value']) - transceiver_dom_info_dict['tx2bias'] = str(dom_channel_monitor_data['data']['TX2Bias']['value']) - transceiver_dom_info_dict['tx3bias'] = str(dom_channel_monitor_data['data']['TX3Bias']['value']) - transceiver_dom_info_dict['tx4bias'] = str(dom_channel_monitor_data['data']['TX4Bias']['value']) - transceiver_dom_info_dict['tx5bias'] = str(dom_channel_monitor_data['data']['TX5Bias']['value']) - transceiver_dom_info_dict['tx6bias'] = str(dom_channel_monitor_data['data']['TX6Bias']['value']) - transceiver_dom_info_dict['tx7bias'] = str(dom_channel_monitor_data['data']['TX7Bias']['value']) - transceiver_dom_info_dict['tx8bias'] = str(dom_channel_monitor_data['data']['TX8Bias']['value']) - - return transceiver_dom_info_dict - - else: - if not self.dom_supported: - return transceiver_dom_info_dict - - offset = 256 - sfpd_obj = sff8472Dom() - if sfpd_obj is None: - return transceiver_dom_info_dict - sfpd_obj._calibration_type = self.calibration - - dom_data_raw = self._read_eeprom_specific_bytes((offset + SFP_DOM_BULK_DATA_START), SFP_DOM_BULK_DATA_SIZE) - - start = SFP_TEMPE_OFFSET - SFP_DOM_BULK_DATA_START - end = start + SFP_TEMPE_WIDTH - dom_temperature_data = sfpd_obj.parse_temperature(dom_data_raw[start: end], 0) - - start = SFP_VOLT_OFFSET - SFP_DOM_BULK_DATA_START - end = start + SFP_VOLT_WIDTH - dom_voltage_data = sfpd_obj.parse_voltage(dom_data_raw[start: end], 0) - - start = SFP_CHANNL_MON_OFFSET - SFP_DOM_BULK_DATA_START - end = start + SFP_CHANNL_MON_WIDTH - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params(dom_data_raw[start: end], 0) - - transceiver_dom_info_dict['temperature'] = self._convert_string_to_num(dom_temperature_data['data']['Temperature']['value']) - transceiver_dom_info_dict['voltage'] = self._convert_string_to_num(dom_voltage_data['data']['Vcc']['value']) - transceiver_dom_info_dict['rx1power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['RXPower']['value']) - transceiver_dom_info_dict['tx1bias'] = self._convert_string_to_num(dom_channel_monitor_data['data']['TXBias']['value']) - transceiver_dom_info_dict['tx1power'] = self._convert_string_to_num(dom_channel_monitor_data['data']['TXPower']['value']) - - return transceiver_dom_info_dict - - - def get_transceiver_threshold_info(self): - """ - Retrieves transceiver threshold info of this SFP - - Returns: - A dict which contains following keys/values : - ======================================================================== - keys |Value Format |Information - ---------------------------|---------------|---------------------------- - temphighalarm |FLOAT |High Alarm Threshold value of temperature in Celsius. - templowalarm |FLOAT |Low Alarm Threshold value of temperature in Celsius. - temphighwarning |FLOAT |High Warning Threshold value of temperature in Celsius. - templowwarning |FLOAT |Low Warning Threshold value of temperature in Celsius. - vcchighalarm |FLOAT |High Alarm Threshold value of supply voltage in mV. - vcclowalarm |FLOAT |Low Alarm Threshold value of supply voltage in mV. - vcchighwarning |FLOAT |High Warning Threshold value of supply voltage in mV. - vcclowwarning |FLOAT |Low Warning Threshold value of supply voltage in mV. - rxpowerhighalarm |FLOAT |High Alarm Threshold value of received power in dBm. - rxpowerlowalarm |FLOAT |Low Alarm Threshold value of received power in dBm. - rxpowerhighwarning |FLOAT |High Warning Threshold value of received power in dBm. - rxpowerlowwarning |FLOAT |Low Warning Threshold value of received power in dBm. - txpowerhighalarm |FLOAT |High Alarm Threshold value of transmit power in dBm. - txpowerlowalarm |FLOAT |Low Alarm Threshold value of transmit power in dBm. - txpowerhighwarning |FLOAT |High Warning Threshold value of transmit power in dBm. - txpowerlowwarning |FLOAT |Low Warning Threshold value of transmit power in dBm. - txbiashighalarm |FLOAT |High Alarm Threshold value of tx Bias Current in mA. - txbiaslowalarm |FLOAT |Low Alarm Threshold value of tx Bias Current in mA. - txbiashighwarning |FLOAT |High Warning Threshold value of tx Bias Current in mA. - txbiaslowwarning |FLOAT |Low Warning Threshold value of tx Bias Current in mA. - ======================================================================== - """ - transceiver_dom_threshold_info_dict = {} - - dom_info_dict_keys = ['temphighalarm', 'temphighwarning', - 'templowalarm', 'templowwarning', - 'vcchighalarm', 'vcchighwarning', - 'vcclowalarm', 'vcclowwarning', - 'rxpowerhighalarm', 'rxpowerhighwarning', - 'rxpowerlowalarm', 'rxpowerlowwarning', - 'txpowerhighalarm', 'txpowerhighwarning', - 'txpowerlowalarm', 'txpowerlowwarning', - 'txbiashighalarm', 'txbiashighwarning', - 'txbiaslowalarm', 'txbiaslowwarning' - ] - transceiver_dom_threshold_info_dict = dict.fromkeys(dom_info_dict_keys, 'N/A') - - if self.sfp_type == OSFP_TYPE: - pass - - elif self.sfp_type == QSFP_TYPE: - if not self.dom_supported or not self.qsfp_page3_available: - return transceiver_dom_threshold_info_dict - - # Dom Threshold data starts from offset 384 - # Revert offset back to 0 once data is retrieved - offset = QSFP_MODULE_UPPER_PAGE3_START - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return transceiver_dom_threshold_info_dict - - dom_module_threshold_raw = self._read_eeprom_specific_bytes((offset + QSFP_MODULE_THRESHOLD_OFFSET), QSFP_MODULE_THRESHOLD_WIDTH) - if dom_module_threshold_raw is None: - return transceiver_dom_threshold_info_dict - - dom_module_threshold_data = sfpd_obj.parse_module_threshold_values(dom_module_threshold_raw, 0) - - dom_channel_threshold_raw = self._read_eeprom_specific_bytes((offset + QSFP_CHANNL_THRESHOLD_OFFSET), - QSFP_CHANNL_THRESHOLD_WIDTH) - if dom_channel_threshold_raw is None: - return transceiver_dom_threshold_info_dict - dom_channel_threshold_data = sfpd_obj.parse_channel_threshold_values(dom_channel_threshold_raw, 0) - - # Threshold Data - transceiver_dom_threshold_info_dict['temphighalarm'] = dom_module_threshold_data['data']['TempHighAlarm']['value'] - transceiver_dom_threshold_info_dict['temphighwarning'] = dom_module_threshold_data['data']['TempHighWarning']['value'] - transceiver_dom_threshold_info_dict['templowalarm'] = dom_module_threshold_data['data']['TempLowAlarm']['value'] - transceiver_dom_threshold_info_dict['templowwarning'] = dom_module_threshold_data['data']['TempLowWarning']['value'] - transceiver_dom_threshold_info_dict['vcchighalarm'] = dom_module_threshold_data['data']['VccHighAlarm']['value'] - transceiver_dom_threshold_info_dict['vcchighwarning'] = dom_module_threshold_data['data']['VccHighWarning']['value'] - transceiver_dom_threshold_info_dict['vcclowalarm'] = dom_module_threshold_data['data']['VccLowAlarm']['value'] - transceiver_dom_threshold_info_dict['vcclowwarning'] = dom_module_threshold_data['data']['VccLowWarning']['value'] - transceiver_dom_threshold_info_dict['rxpowerhighalarm'] = dom_channel_threshold_data['data']['RxPowerHighAlarm']['value'] - transceiver_dom_threshold_info_dict['rxpowerhighwarning'] = dom_channel_threshold_data['data']['RxPowerHighWarning']['value'] - transceiver_dom_threshold_info_dict['rxpowerlowalarm'] = dom_channel_threshold_data['data']['RxPowerLowAlarm']['value'] - transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_channel_threshold_data['data']['RxPowerLowWarning']['value'] - transceiver_dom_threshold_info_dict['txbiashighalarm'] = dom_channel_threshold_data['data']['TxBiasHighAlarm']['value'] - transceiver_dom_threshold_info_dict['txbiashighwarning'] = dom_channel_threshold_data['data']['TxBiasHighWarning']['value'] - transceiver_dom_threshold_info_dict['txbiaslowalarm'] = dom_channel_threshold_data['data']['TxBiasLowAlarm']['value'] - transceiver_dom_threshold_info_dict['txbiaslowwarning'] = dom_channel_threshold_data['data']['TxBiasLowWarning']['value'] - transceiver_dom_threshold_info_dict['txpowerhighalarm'] = dom_channel_threshold_data['data']['TxPowerHighAlarm']['value'] - transceiver_dom_threshold_info_dict['txpowerhighwarning'] = dom_channel_threshold_data['data']['TxPowerHighWarning']['value'] - transceiver_dom_threshold_info_dict['txpowerlowalarm'] = dom_channel_threshold_data['data']['TxPowerLowAlarm']['value'] - transceiver_dom_threshold_info_dict['txpowerlowwarning'] = dom_channel_threshold_data['data']['TxPowerLowWarning']['value'] - - elif self.sfp_type == QSFP_DD_TYPE: - if not self.dom_supported: - return transceiver_dom_threshold_info_dict - - if not self.dom_thresholds_supported: - return transceiver_dom_threshold_info_dict - - sfpd_obj = qsfp_dd_Dom() - if sfpd_obj is None: - return transceiver_dom_threshold_info_dict - - # page 02 - offset = 384 - dom_module_threshold_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_MODULE_THRESHOLD_OFFSET), QSFP_DD_MODULE_THRESHOLD_WIDTH) - if dom_module_threshold_raw is None: - return transceiver_dom_threshold_info_dict - - dom_module_threshold_data = sfpd_obj.parse_module_threshold_values(dom_module_threshold_raw, 0) - - # Threshold Data - transceiver_dom_threshold_info_dict['temphighalarm'] = dom_module_threshold_data['data']['TempHighAlarm']['value'] - transceiver_dom_threshold_info_dict['temphighwarning'] = dom_module_threshold_data['data']['TempHighWarning']['value'] - transceiver_dom_threshold_info_dict['templowalarm'] = dom_module_threshold_data['data']['TempLowAlarm']['value'] - transceiver_dom_threshold_info_dict['templowwarning'] = dom_module_threshold_data['data']['TempLowWarning']['value'] - transceiver_dom_threshold_info_dict['vcchighalarm'] = dom_module_threshold_data['data']['VccHighAlarm']['value'] - transceiver_dom_threshold_info_dict['vcchighwarning'] = dom_module_threshold_data['data']['VccHighWarning']['value'] - transceiver_dom_threshold_info_dict['vcclowalarm'] = dom_module_threshold_data['data']['VccLowAlarm']['value'] - transceiver_dom_threshold_info_dict['vcclowwarning'] = dom_module_threshold_data['data']['VccLowWarning']['value'] - transceiver_dom_threshold_info_dict['rxpowerhighalarm'] = dom_module_threshold_data['data']['RxPowerHighAlarm']['value'] - transceiver_dom_threshold_info_dict['rxpowerhighwarning'] = dom_module_threshold_data['data']['RxPowerHighWarning']['value'] - transceiver_dom_threshold_info_dict['rxpowerlowalarm'] = dom_module_threshold_data['data']['RxPowerLowAlarm']['value'] - transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_module_threshold_data['data']['RxPowerLowWarning']['value'] - transceiver_dom_threshold_info_dict['txbiashighalarm'] = dom_module_threshold_data['data']['TxBiasHighAlarm']['value'] - transceiver_dom_threshold_info_dict['txbiashighwarning'] = dom_module_threshold_data['data']['TxBiasHighWarning']['value'] - transceiver_dom_threshold_info_dict['txbiaslowalarm'] = dom_module_threshold_data['data']['TxBiasLowAlarm']['value'] - transceiver_dom_threshold_info_dict['txbiaslowwarning'] = dom_module_threshold_data['data']['TxBiasLowWarning']['value'] - transceiver_dom_threshold_info_dict['txpowerhighalarm'] = dom_module_threshold_data['data']['TxPowerHighAlarm']['value'] - transceiver_dom_threshold_info_dict['txpowerhighwarning'] = dom_module_threshold_data['data']['TxPowerHighWarning']['value'] - transceiver_dom_threshold_info_dict['txpowerlowalarm'] = dom_module_threshold_data['data']['TxPowerLowAlarm']['value'] - transceiver_dom_threshold_info_dict['txpowerlowwarning'] = dom_module_threshold_data['data']['TxPowerLowWarning']['value'] - - else: - offset = SFP_MODULE_ADDRA2_OFFSET - - if not self.dom_supported: - return transceiver_dom_threshold_info_dict - - sfpd_obj = sff8472Dom(None, self.calibration) - if sfpd_obj is None: - return transceiver_dom_threshold_info_dict - - dom_module_threshold_raw = self._read_eeprom_specific_bytes((offset + SFP_MODULE_THRESHOLD_OFFSET), - SFP_MODULE_THRESHOLD_WIDTH) - if dom_module_threshold_raw is not None: - dom_module_threshold_data = sfpd_obj.parse_alarm_warning_threshold(dom_module_threshold_raw, 0) - else: - return transceiver_dom_threshold_info_dict - - # Threshold Data - transceiver_dom_threshold_info_dict['temphighalarm'] = dom_module_threshold_data['data']['TempHighAlarm']['value'] - transceiver_dom_threshold_info_dict['templowalarm'] = dom_module_threshold_data['data']['TempLowAlarm']['value'] - transceiver_dom_threshold_info_dict['temphighwarning'] = dom_module_threshold_data['data']['TempHighWarning']['value'] - transceiver_dom_threshold_info_dict['templowwarning'] = dom_module_threshold_data['data']['TempLowWarning']['value'] - transceiver_dom_threshold_info_dict['vcchighalarm'] = dom_module_threshold_data['data']['VoltageHighAlarm']['value'] - transceiver_dom_threshold_info_dict['vcclowalarm'] = dom_module_threshold_data['data']['VoltageLowAlarm']['value'] - transceiver_dom_threshold_info_dict['vcchighwarning'] = dom_module_threshold_data['data']['VoltageHighWarning']['value'] - transceiver_dom_threshold_info_dict['vcclowwarning'] = dom_module_threshold_data['data']['VoltageLowWarning']['value'] - transceiver_dom_threshold_info_dict['txbiashighalarm'] = dom_module_threshold_data['data']['BiasHighAlarm']['value'] - transceiver_dom_threshold_info_dict['txbiaslowalarm'] = dom_module_threshold_data['data']['BiasLowAlarm']['value'] - transceiver_dom_threshold_info_dict['txbiashighwarning'] = dom_module_threshold_data['data']['BiasHighWarning']['value'] - transceiver_dom_threshold_info_dict['txbiaslowwarning'] = dom_module_threshold_data['data']['BiasLowWarning']['value'] - transceiver_dom_threshold_info_dict['txpowerhighalarm'] = dom_module_threshold_data['data']['TXPowerHighAlarm']['value'] - transceiver_dom_threshold_info_dict['txpowerlowalarm'] = dom_module_threshold_data['data']['TXPowerLowAlarm']['value'] - transceiver_dom_threshold_info_dict['txpowerhighwarning'] = dom_module_threshold_data['data']['TXPowerHighWarning']['value'] - transceiver_dom_threshold_info_dict['txpowerlowwarning'] = dom_module_threshold_data['data']['TXPowerLowWarning']['value'] - transceiver_dom_threshold_info_dict['rxpowerhighalarm'] = dom_module_threshold_data['data']['RXPowerHighAlarm']['value'] - transceiver_dom_threshold_info_dict['rxpowerlowalarm'] = dom_module_threshold_data['data']['RXPowerLowAlarm']['value'] - transceiver_dom_threshold_info_dict['rxpowerhighwarning'] = dom_module_threshold_data['data']['RXPowerHighWarning']['value'] - transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_module_threshold_data['data']['RXPowerLowWarning']['value'] - - return transceiver_dom_threshold_info_dict - - - def get_reset_status(self): - """ - Retrieves the reset status of SFP - - Returns: - A Boolean, True if reset enabled, False if disabled - - for QSFP, originally I would like to make use of Initialization complete flag bit - which is at Page a0 offset 6 bit 0 to test whether reset is complete. - However as unit testing was carried out I find this approach may fail because: - 1. we make use of ethtool to read data on I2C bus rather than to read directly - 2. ethtool is unable to access I2C during QSFP module being reset - In other words, whenever the flag is able to be retrived, the value is always be 1 - As a result, it doesn't make sense to retrieve that flag. Just treat successfully - retrieving data as "data ready". - for SFP it seems that there is not flag indicating whether reset succeed. However, - we can also do it in the way for QSFP. - """ - if not self.dom_supported: - return False - - if self.sfp_type == OSFP_TYPE: - return False - elif self.sfp_type == QSFP_TYPE: - offset = 0 - sfpd_obj = sff8436Dom() - dom_module_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_MODULE_MONITOR_OFFSET), QSFP_MODULE_MONITOR_WIDTH) - - if dom_module_monitor_raw is not None: - return True - else: - return False - elif self.sfp_type == SFP_TYPE: - offset = 0 - sfpd_obj = sff8472Dom() - dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + SFP_CHANNL_STATUS_OFFSET), SFP_CHANNL_STATUS_WIDTH) - - if dom_channel_monitor_raw is not None: - return True - else: - return False - elif self.sfp_type == QSFP_DD_TYPE: - offset = 0 - sfpd_obj = qsfp_dd_Dom() - dom_channel_status_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_CHANNL_STATUS_OFFSET), QSFP_DD_CHANNL_STATUS_WIDTH) - - if dom_channel_status_raw is None: - return False - - dom_channel_status_data = sfpd_obj.parse_dom_channel_status(dom_channel_status_raw, 0) - return dom_channel_status_data['data']['Status']['value'] == 'On' - - def get_rx_los(self): - """ - Retrieves the RX LOS (lost-of-signal) status of SFP - - Returns: - A Boolean, True if SFP has RX LOS, False if not. - Note : RX LOS status is latched until a call to get_rx_los or a reset. - """ - if not self.dom_supported: - return None - - rx_los_list = [] - if self.sfp_type == OSFP_TYPE: - return None - elif self.sfp_type == QSFP_TYPE: - offset = 0 - dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_CHANNL_RX_LOS_STATUS_OFFSET), QSFP_CHANNL_RX_LOS_STATUS_WIDTH) - if dom_channel_monitor_raw is not None: - rx_los_data = int(dom_channel_monitor_raw[0], 16) - rx_los_list.append(rx_los_data & 0x01 != 0) - rx_los_list.append(rx_los_data & 0x02 != 0) - rx_los_list.append(rx_los_data & 0x04 != 0) - rx_los_list.append(rx_los_data & 0x08 != 0) - - elif self.sfp_type == QSFP_DD_TYPE: - # page 11h - if self.dom_rx_tx_power_bias_supported: - offset = 512 - dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_CHANNL_RX_LOS_STATUS_OFFSET), QSFP_DD_CHANNL_RX_LOS_STATUS_WIDTH) - if dom_channel_monitor_raw is not None: - rx_los_data = int(dom_channel_monitor_raw[0], 8) - rx_los_list.append(rx_los_data & 0x01 != 0) - rx_los_list.append(rx_los_data & 0x02 != 0) - rx_los_list.append(rx_los_data & 0x04 != 0) - rx_los_list.append(rx_los_data & 0x08 != 0) - rx_los_list.append(rx_los_data & 0x10 != 0) - rx_los_list.append(rx_los_data & 0x20 != 0) - rx_los_list.append(rx_los_data & 0x40 != 0) - rx_los_list.append(rx_los_data & 0x80 != 0) - + bytearray, if raw sequence of bytes are read correctly from the offset of size num_bytes + None, if the read_eeprom fails + Example: + mlxreg -d /dev/mst/mt52100_pciconf0 --reg_name MCIA --indexes slot_index=0,module=1,device_address=148,page_number=0,i2c_device_address=0x50,size=16,bank_number=0 -g + Sending access register... + Field Name | Data + =================================== + status | 0x00000000 + slot_index | 0x00000000 + module | 0x00000001 + l | 0x00000000 + device_address | 0x00000094 + page_number | 0x00000000 + i2c_device_address | 0x00000050 + size | 0x00000010 + bank_number | 0x00000000 + dword[0] | 0x43726564 + dword[1] | 0x6f202020 + dword[2] | 0x20202020 + dword[3] | 0x20202020 + dword[4] | 0x00000000 + dword[5] | 0x00000000 + .... + 16 bytes to read from dword -> 0x437265646f2020202020202020202020 -> Credo + """ + # recalculate offset and page. Use 'ethtool' if there is no need to read vendor pages + if offset < SFP_VENDOR_PAGE_START: + return self._read_eeprom_specific_bytes(offset, num_bytes) else: - offset = 256 - dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + SFP_CHANNL_STATUS_OFFSET), SFP_CHANNL_STATUS_WIDTH) - if dom_channel_monitor_raw is not None: - rx_los_data = int(dom_channel_monitor_raw[0], 16) - rx_los_list.append(rx_los_data & 0x02 != 0) - else: - return None - return rx_los_list - - - def get_tx_fault(self): - """ - Retrieves the TX fault status of SFP + page = (offset - SFP_PAGE_SIZE) // SFP_UPPER_PAGE_OFFSET + 1 + # calculate offset per page + device_address = (offset - SFP_PAGE_SIZE) % SFP_UPPER_PAGE_OFFSET + SFP_UPPER_PAGE_OFFSET - Returns: - A Boolean, True if SFP has TX fault, False if not - Note : TX fault status is lached until a call to get_tx_fault or a reset. - """ - if not self.dom_supported: + if not self.mst_pci_device: return None - tx_fault_list = [] - if self.sfp_type == OSFP_TYPE: - return None - elif self.sfp_type == QSFP_TYPE: - offset = 0 - dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_CHANNL_TX_FAULT_STATUS_OFFSET), QSFP_CHANNL_TX_FAULT_STATUS_WIDTH) - if dom_channel_monitor_raw is not None: - tx_fault_data = int(dom_channel_monitor_raw[0], 16) - tx_fault_list.append(tx_fault_data & 0x01 != 0) - tx_fault_list.append(tx_fault_data & 0x02 != 0) - tx_fault_list.append(tx_fault_data & 0x04 != 0) - tx_fault_list.append(tx_fault_data & 0x08 != 0) - - elif self.sfp_type == QSFP_DD_TYPE: - return None - # page 11h - if self.dom_rx_tx_power_bias_supported: - offset = 512 - dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_CHANNL_TX_FAULT_STATUS_OFFSET), QSFP_DD_CHANNL_TX_FAULT_STATUS_WIDTH) - if dom_channel_monitor_raw is not None: - tx_fault_data = int(dom_channel_monitor_raw[0], 8) - tx_fault_list.append(tx_fault_data & 0x01 != 0) - tx_fault_list.append(tx_fault_data & 0x02 != 0) - tx_fault_list.append(tx_fault_data & 0x04 != 0) - tx_fault_list.append(tx_fault_data & 0x08 != 0) - tx_fault_list.append(tx_fault_data & 0x10 != 0) - tx_fault_list.append(tx_fault_data & 0x20 != 0) - tx_fault_list.append(tx_fault_data & 0x40 != 0) - tx_fault_list.append(tx_fault_data & 0x80 != 0) + mlxreg_mngr = MlxregManager(self.mst_pci_device, self.slot_id, self.sdk_index) + read_output = mlxreg_mngr.read_mlxred_eeprom(device_address, page, num_bytes) + return mlxreg_mngr.parse_mlxreg_read_output(read_output, num_bytes) - else: - offset = 256 - dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + SFP_CHANNL_STATUS_OFFSET), SFP_CHANNL_STATUS_WIDTH) - if dom_channel_monitor_raw is not None: - tx_fault_data = int(dom_channel_monitor_raw[0], 16) - tx_fault_list.append(tx_fault_data & 0x04 != 0) - else: - return None - return tx_fault_list - - - def get_tx_disable(self): + # write eeprom specfic bytes beginning from offset with size as num_bytes + def write_eeprom(self, offset, num_bytes, write_buffer): """ - Retrieves the tx_disable status of this SFP - + write eeprom specfic bytes beginning from a random offset with size as num_bytes + and write_buffer as the required bytes Returns: - A Boolean, True if tx_disable is enabled, False if disabled - - for QSFP, the disable states of each channel which are the lower 4 bits in byte 85 page a0 - for SFP, the TX Disable State and Soft TX Disable Select is ORed as the tx_disable status returned - These two bits are bit 7 & 6 in byte 110 page a2 respectively + Boolean, true if the write succeeded and false if it did not succeed. + Example: + mlxreg -d /dev/mst/mt52100_pciconf0 --reg_name MCIA --indexes slot_index=0,module=1,device_address=154,page_number=5,i2c_device_address=0x50,size=1,bank_number=0 --set dword[0]=0x01000000 -y """ - if not self.dom_supported: - return None - - tx_disable_list = [] - if self.sfp_type == OSFP_TYPE: - return None - elif self.sfp_type == QSFP_TYPE: - offset = 0 - dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_CHANNL_DISABLE_STATUS_OFFSET), QSFP_CHANNL_DISABLE_STATUS_WIDTH) - if dom_channel_monitor_raw is not None: - tx_disable_data = int(dom_channel_monitor_raw[0], 16) - tx_disable_list.append(tx_disable_data & 0x01 != 0) - tx_disable_list.append(tx_disable_data & 0x02 != 0) - tx_disable_list.append(tx_disable_data & 0x04 != 0) - tx_disable_list.append(tx_disable_data & 0x08 != 0) - - elif self.sfp_type == QSFP_DD_TYPE: - if self.dom_rx_tx_power_bias_supported: - offset = 128 - dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_CHANNL_DISABLE_STATUS_OFFSET), QSFP_DD_CHANNL_DISABLE_STATUS_WIDTH) - if dom_channel_monitor_raw is not None: - tx_disable_data = int(dom_channel_monitor_raw[0], 16) - tx_disable_list.append(tx_disable_data & 0x01 != 0) - tx_disable_list.append(tx_disable_data & 0x02 != 0) - tx_disable_list.append(tx_disable_data & 0x04 != 0) - tx_disable_list.append(tx_disable_data & 0x08 != 0) - tx_disable_list.append(tx_disable_data & 0x10 != 0) - tx_disable_list.append(tx_disable_data & 0x20 != 0) - tx_disable_list.append(tx_disable_data & 0x40 != 0) - tx_disable_list.append(tx_disable_data & 0x80 != 0) + if num_bytes != len(write_buffer): + logger.log_error("Error mismatch between buffer length and number of bytes to be written") + return False + # recalculate offset and page + if offset < SFP_PAGE_SIZE: + page = 0 + device_address = offset else: - offset = 256 - dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + SFP_CHANNL_STATUS_OFFSET), SFP_CHANNL_STATUS_WIDTH) - if dom_channel_monitor_raw is not None: - tx_disable_data = int(dom_channel_monitor_raw[0], 16) - tx_disable_list.append(tx_disable_data & 0xC0 != 0) - else: - return None - return tx_disable_list - + page = (offset - SFP_PAGE_SIZE) // SFP_UPPER_PAGE_OFFSET + 1 + # calculate offset per page + device_address = (offset - SFP_PAGE_SIZE) % SFP_UPPER_PAGE_OFFSET + SFP_UPPER_PAGE_OFFSET - def get_tx_disable_channel(self): - """ - Retrieves the TX disabled channels in this SFP - - Returns: - A hex of 4 bits (bit 0 to bit 3 as channel 0 to channel 3) to represent - TX channels which have been disabled in this SFP. - As an example, a returned value of 0x5 indicates that channel 0 - and channel 2 have been disabled. - """ - tx_disable_list = self.get_tx_disable() - if tx_disable_list is None: - return 0 - tx_disabled = 0 - for i in range(len(tx_disable_list)): - if tx_disable_list[i]: - tx_disabled |= 1 << i - return tx_disabled + if not self.mst_pci_device: + return False + mlxreg_mngr = MlxregManager(self.mst_pci_device, self.slot_id, self.sdk_index) + dword = mlxreg_mngr.construct_dword(write_buffer) + return mlxreg_mngr.write_mlxreg_eeprom(num_bytes, dword, device_address, page) @classmethod - def mgmt_phy_mod_pwr_attr_get(cls, power_attr_type, sdk_handle, sdk_index): + def mgmt_phy_mod_pwr_attr_get(cls, power_attr_type, sdk_handle, sdk_index, slot_id): sx_mgmt_phy_mod_pwr_attr_p = new_sx_mgmt_phy_mod_pwr_attr_t_p() sx_mgmt_phy_mod_pwr_attr = sx_mgmt_phy_mod_pwr_attr_t() sx_mgmt_phy_mod_pwr_attr.power_attr_type = power_attr_type sx_mgmt_phy_mod_pwr_attr_t_p_assign(sx_mgmt_phy_mod_pwr_attr_p, sx_mgmt_phy_mod_pwr_attr) module_id_info = sx_mgmt_module_id_info_t() - module_id_info.slot_id = 0 + module_id_info.slot_id = slot_id module_id_info.module_id = sdk_index try: rc = sx_mgmt_phy_module_pwr_attr_get(sdk_handle, module_id_info, sx_mgmt_phy_mod_pwr_attr_p) @@ -1528,8 +421,6 @@ def mgmt_phy_mod_pwr_attr_get(cls, power_attr_type, sdk_handle, sdk_index): finally: delete_sx_mgmt_phy_mod_pwr_attr_t_p(sx_mgmt_phy_mod_pwr_attr_p) - - def get_lpmode(self): """ Retrieves the lpmode (low power mode) status of this SFP @@ -1538,399 +429,36 @@ def get_lpmode(self): A Boolean, True if lpmode is enabled, False if disabled """ if utils.is_host(): - # To avoid performance issue, + # To avoid performance issue, # call class level method to avoid initialize the whole sonic platform API get_lpmode_code = 'from sonic_platform import sfp;\n' \ 'with sfp.SdkHandleContext() as sdk_handle:' \ - 'print(sfp.SFP._get_lpmode(sdk_handle, {}))'.format(self.sdk_index) + 'print(sfp.SFP._get_lpmode(sdk_handle, {}, {}))'.format(self.sdk_index, self.slot_id) lpm_cmd = "docker exec pmon python3 -c \"{}\"".format(get_lpmode_code) try: output = subprocess.check_output(lpm_cmd, shell=True, universal_newlines=True) return 'True' in output except subprocess.CalledProcessError as e: - print("Error! Unable to get LPM for {}, rc = {}, err msg: {}".format(self.index, e.returncode, e.output)) + print("Error! Unable to get LPM for {}, rc = {}, err msg: {}".format(self.sdk_index, e.returncode, e.output)) return False else: - return self._get_lpmode(self.sdk_handle, self.sdk_index) + return self._get_lpmode(self.sdk_handle, self.sdk_index, self.slot_id) - @classmethod - def _get_lpmode(cls, sdk_handle, sdk_index): - """Class level method to get low power mode. + def _get_lpmode(cls, sdk_handle, sdk_index, slot_id): + """Class level method to get low power mode. Args: sdk_handle: SDK handle sdk_index (integer): SDK port index + slot_id (integer): Slot ID Returns: [boolean]: True if low power mode is on else off """ - _, oper_pwr_mode = cls.mgmt_phy_mod_pwr_attr_get(SX_MGMT_PHY_MOD_PWR_ATTR_PWR_MODE_E, sdk_handle, sdk_index) + _, oper_pwr_mode = cls.mgmt_phy_mod_pwr_attr_get(SX_MGMT_PHY_MOD_PWR_ATTR_PWR_MODE_E, sdk_handle, sdk_index, slot_id) return oper_pwr_mode == SX_MGMT_PHY_MOD_PWR_MODE_LOW_E - - def get_power_override(self): - """ - Retrieves the power-override status of this SFP - - Returns: - A Boolean, True if power-override is enabled, False if disabled - """ - if self.sfp_type == QSFP_TYPE: - offset = 0 - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return False - - dom_control_raw = self._read_eeprom_specific_bytes((offset + QSFP_CONTROL_OFFSET), QSFP_CONTROL_WIDTH) - if dom_control_raw is not None: - dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) - return ('On' == dom_control_data['data']['PowerOverride']) - else: - return NotImplementedError - - - def get_temperature(self): - """ - Retrieves the temperature of this SFP - - Returns: - An integer number of current temperature in Celsius - """ - if not self.dom_supported: - return None - if self.sfp_type == QSFP_TYPE: - offset = 0 - offset_xcvr = 128 - - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return None - - if self.dom_temp_supported: - dom_temperature_raw = self._read_eeprom_specific_bytes((offset + QSFP_TEMPE_OFFSET), QSFP_TEMPE_WIDTH) - if dom_temperature_raw is not None: - dom_temperature_data = sfpd_obj.parse_temperature(dom_temperature_raw, 0) - temp = self._convert_string_to_num(dom_temperature_data['data']['Temperature']['value']) - return temp - else: - return None - else: - return None - - elif self.sfp_type == QSFP_DD_TYPE: - offset = 0 - - sfpd_obj = qsfp_dd_Dom() - if sfpd_obj is None: - return None - - if self.dom_temp_supported: - dom_temperature_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_TEMPE_OFFSET), QSFP_DD_TEMPE_WIDTH) - if dom_temperature_raw is not None: - dom_temperature_data = sfpd_obj.parse_temperature(dom_temperature_raw, 0) - temp = self._convert_string_to_num(dom_temperature_data['data']['Temperature']['value']) - return temp - return None - - else: - offset = 256 - sfpd_obj = sff8472Dom() - if sfpd_obj is None: - return None - sfpd_obj._calibration_type = 1 - - dom_temperature_raw = self._read_eeprom_specific_bytes((offset + SFP_TEMPE_OFFSET), SFP_TEMPE_WIDTH) - if dom_temperature_raw is not None: - dom_temperature_data = sfpd_obj.parse_temperature(dom_temperature_raw, 0) - temp = self._convert_string_to_num(dom_temperature_data['data']['Temperature']['value']) - return temp - else: - return None - - - def get_voltage(self): - """ - Retrieves the supply voltage of this SFP - - Returns: - An integer number of supply voltage in mV - """ - if not self.dom_supported: - return None - if self.sfp_type == QSFP_TYPE: - offset = 0 - offset_xcvr = 128 - - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return None - - if self.dom_volt_supported: - dom_voltage_raw = self._read_eeprom_specific_bytes((offset + QSFP_VOLT_OFFSET), QSFP_VOLT_WIDTH) - if dom_voltage_raw is not None: - dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) - voltage = self._convert_string_to_num(dom_voltage_data['data']['Vcc']['value']) - return voltage - else: - return None - return None - - if self.sfp_type == QSFP_DD_TYPE: - offset = 128 - - sfpd_obj = qsfp_dd_Dom() - if sfpd_obj is None: - return None - - if self.dom_volt_supported: - dom_voltage_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_VOLT_OFFSET), QSFP_DD_VOLT_WIDTH) - if dom_voltage_raw is not None: - dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) - voltage = self._convert_string_to_num(dom_voltage_data['data']['Vcc']['value']) - return voltage - return None - - else: - offset = 256 - - sfpd_obj = sff8472Dom() - if sfpd_obj is None: - return None - - sfpd_obj._calibration_type = self.calibration - - dom_voltage_raw = self._read_eeprom_specific_bytes((offset + SFP_VOLT_OFFSET), SFP_VOLT_WIDTH) - if dom_voltage_raw is not None: - dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) - voltage = self._convert_string_to_num(dom_voltage_data['data']['Vcc']['value']) - return voltage - else: - return None - - - def get_tx_bias(self): - """ - Retrieves the TX bias current of this SFP - - Returns: - A list of four integer numbers, representing TX bias in mA - for channel 0 to channel 4. - Ex. ['110.09', '111.12', '108.21', '112.09'] - """ - tx_bias_list = [] - if self.sfp_type == QSFP_TYPE: - offset = 0 - offset_xcvr = 128 - - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return None - - dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) - if dom_channel_monitor_raw is not None: - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power(dom_channel_monitor_raw, 0) - tx_bias_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX1Bias']['value'])) - tx_bias_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX2Bias']['value'])) - tx_bias_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX3Bias']['value'])) - tx_bias_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX4Bias']['value'])) - - elif self.sfp_type == QSFP_DD_TYPE: - # page 11h - if self.dom_rx_tx_power_bias_supported: - offset = 512 - sfpd_obj = qsfp_dd_Dom() - if sfpd_obj is None: - return None - - if dom_tx_bias_power_supported: - dom_tx_bias_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_TX_BIAS_OFFSET), QSFP_DD_TX_BIAS_WIDTH) - if dom_tx_bias_raw is not None: - dom_tx_bias_data = sfpd_obj.parse_dom_tx_bias(dom_tx_bias_raw, 0) - tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX1Bias']['value'])) - tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX2Bias']['value'])) - tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX3Bias']['value'])) - tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX4Bias']['value'])) - tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX5Bias']['value'])) - tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX6Bias']['value'])) - tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX7Bias']['value'])) - tx_bias_list.append(self._convert_string_to_num(dom_tx_bias_data['data']['TX8Bias']['value'])) - - else: - offset = 256 - - sfpd_obj = sff8472Dom() - if sfpd_obj is None: - return None - sfpd_obj._calibration_type = self.calibration - - if self.dom_supported: - dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) - if dom_channel_monitor_raw is not None: - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params(dom_channel_monitor_raw, 0) - tx_bias_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TXBias']['value'])) - else: - return None - else: - return None - - return tx_bias_list - - - def get_rx_power(self): - """ - Retrieves the received optical power for this SFP - - Returns: - A list of four integer numbers, representing received optical - power in mW for channel 0 to channel 4. - Ex. ['1.77', '1.71', '1.68', '1.70'] - """ - rx_power_list = [] - if self.sfp_type == OSFP_TYPE: - # OSFP not supported on our platform yet. - return None - - elif self.sfp_type == QSFP_TYPE: - offset = 0 - offset_xcvr = 128 - - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return None - - if self.dom_rx_power_supported: - dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) - if dom_channel_monitor_raw is not None: - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power(dom_channel_monitor_raw, 0) - rx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['RX1Power']['value'])) - rx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['RX2Power']['value'])) - rx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['RX3Power']['value'])) - rx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['RX4Power']['value'])) - else: - return None - else: - return None - - elif self.sfp_type == QSFP_DD_TYPE: - # page 11 - if self.dom_rx_tx_power_bias_supported: - offset = 512 - sfpd_obj = qsfp_dd_Dom() - if sfpd_obj is None: - return None - - if self.dom_rx_power_supported: - dom_rx_power_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_RX_POWER_OFFSET), QSFP_DD_RX_POWER_WIDTH) - if dom_rx_power_raw is not None: - dom_rx_power_data = sfpd_obj.parse_dom_rx_power(dom_rx_power_raw, 0) - rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX1Power']['value'])) - rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX2Power']['value'])) - rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX3Power']['value'])) - rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX4Power']['value'])) - rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX5Power']['value'])) - rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX6Power']['value'])) - rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX7Power']['value'])) - rx_power_list.append(self._convert_string_to_num(dom_rx_power_data['data']['RX8Power']['value'])) - - else: - offset = 256 - - sfpd_obj = sff8472Dom() - if sfpd_obj is None: - return None - - if self.dom_supported: - sfpd_obj._calibration_type = self.calibration - - dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) - if dom_channel_monitor_raw is not None: - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params(dom_channel_monitor_raw, 0) - rx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['RXPower']['value'])) - else: - return None - else: - return None - return rx_power_list - - - def get_tx_power(self): - """ - Retrieves the TX power of this SFP - - Returns: - A list of four integer numbers, representing TX power in mW - for channel 0 to channel 4. - Ex. ['1.86', '1.86', '1.86', '1.86'] - """ - tx_power_list = [] - if self.sfp_type == OSFP_TYPE: - # OSFP not supported on our platform yet. - return None - - elif self.sfp_type == QSFP_TYPE: - offset = 0 - offset_xcvr = 128 - - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return None - - if self.dom_tx_power_supported: - dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) - if dom_channel_monitor_raw is not None: - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power(dom_channel_monitor_raw, 0) - tx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX1Power']['value'])) - tx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX2Power']['value'])) - tx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX3Power']['value'])) - tx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TX4Power']['value'])) - else: - return None - else: - return None - - elif self.sfp_type == QSFP_DD_TYPE: - return None - # page 11 - if self.dom_rx_tx_power_bias_supported: - offset = 512 - sfpd_obj = qsfp_dd_Dom() - if sfpd_obj is None: - return None - - if self.dom_tx_power_supported: - dom_tx_power_raw = self._read_eeprom_specific_bytes((offset + QSFP_DD_TX_POWER_OFFSET), QSFP_DD_TX_POWER_WIDTH) - if dom_tx_power_raw is not None: - dom_tx_power_data = sfpd_obj.parse_dom_tx_power(dom_tx_power_raw, 0) - tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX1Power']['value'])) - tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX2Power']['value'])) - tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX3Power']['value'])) - tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX4Power']['value'])) - tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX5Power']['value'])) - tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX6Power']['value'])) - tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX7Power']['value'])) - tx_power_list.append(self._convert_string_to_num(dom_tx_power_data['data']['TX8Power']['value'])) - - else: - offset = 256 - sfpd_obj = sff8472Dom() - if sfpd_obj is None: - return None - - if self.dom_supported: - sfpd_obj._calibration_type = self.calibration - - dom_channel_monitor_raw = self._read_eeprom_specific_bytes((offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) - if dom_channel_monitor_raw is not None: - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params(dom_channel_monitor_raw, 0) - tx_power_list.append(self._convert_string_to_num(dom_channel_monitor_data['data']['TXPower']['value'])) - else: - return None - else: - return None - return tx_power_list - - def reset(self): """ Reset SFP and return all user module settings to their default state. @@ -1941,71 +469,35 @@ def reset(self): refer plugins/sfpreset.py """ if utils.is_host(): - # To avoid performance issue, + # To avoid performance issue, # call class level method to avoid initialize the whole sonic platform API reset_code = 'from sonic_platform import sfp;\n' \ 'with sfp.SdkHandleContext() as sdk_handle:' \ - 'print(sfp.SFP._reset(sdk_handle, {}))' \ - .format(self.sdk_index) + 'print(sfp.SFP._reset(sdk_handle, {}, {}))' \ + .format(self.sdk_index, self.slot_id) reset_cmd = "docker exec pmon python3 -c \"{}\"".format(reset_code) try: output = subprocess.check_output(reset_cmd, shell=True, universal_newlines=True) return 'True' in output except subprocess.CalledProcessError as e: - print("Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(self.index, e.returncode, e.output)) + print("Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(self.sdk_index, e.returncode, e.output)) return False else: - return self._reset(self.sdk_handle, self.sdk_index) - + return self._reset(self.sdk_handle, self.sdk_index, self.slot_id) @classmethod - def _reset(cls, sdk_handle, sdk_index): + def _reset(cls, sdk_handle, sdk_index, slot_id): module_id_info = sx_mgmt_module_id_info_t() - module_id_info.slot_id = 0 + module_id_info.slot_id = slot_id module_id_info.module_id = sdk_index rc = sx_mgmt_phy_module_reset(sdk_handle, module_id_info) if rc != SX_STATUS_SUCCESS: - logger.log_error("Error occurred when resetting SFP module {}, error code {}".format(sdk_index, rc)) + logger.log_error("Error occurred when resetting SFP module {}, slot {}, error code {}".format(sdk_index, slot_id, rc)) return rc == SX_STATUS_SUCCESS - def tx_disable(self, tx_disable): - """ - Disable SFP TX for all channels - - Args: - tx_disable : A Boolean, True to enable tx_disable mode, False to disable - tx_disable mode. - - Returns: - A boolean, True if tx_disable is set successfully, False if not - - for SFP, make use of bit 6 of byte at (offset 110, a2h (i2c addr 0x51)) to disable/enable tx - for QSFP, set all channels to disable/enable tx - """ - return NotImplementedError - - - def tx_disable_channel(self, channel, disable): - """ - Sets the tx_disable for specified SFP channels - - Args: - channel : A hex of 4 bits (bit 0 to bit 3) which represent channel 0 to 3, - e.g. 0x5 for channel 0 and channel 2. - disable : A boolean, True to disable TX channels specified in channel, - False to enable - - Returns: - A boolean, True if successful, False if not - - QSFP: page a0, address 86, lower 4 bits - """ - return NotImplementedError - - @classmethod def is_nve(cls, port): return (port & NVE_MASK) != 0 @@ -2025,15 +517,12 @@ def is_port_admin_status_up(cls, sdk_handle, log_port): assert rc == SXD_STATUS_SUCCESS, "sx_api_port_state_get failed, rc = %d" % rc admin_state = sx_port_admin_state_t_p_value(admin_state_p) - + delete_sx_port_oper_state_t_p(oper_state_p) delete_sx_port_admin_state_t_p(admin_state_p) delete_sx_port_module_state_t_p(module_state_p) - if admin_state == SX_PORT_ADMIN_STATUS_UP: - return True - else: - return False + return admin_state == SX_PORT_ADMIN_STATUS_UP @classmethod @@ -2046,7 +535,7 @@ def set_port_admin_status_by_log_port(cls, sdk_handle, log_port, admin_status): @classmethod - def get_logical_ports(cls, sdk_handle, sdk_index): + def get_logical_ports(cls, sdk_handle, sdk_index, slot_id): # Get all the ports related to the sfp, if port admin status is up, put it to list port_attributes_list = new_sx_port_attributes_t_arr(SX_PORT_ATTR_ARR_SIZE) port_cnt_p = new_uint32_t_p() @@ -2062,6 +551,7 @@ def get_logical_ports(cls, sdk_handle, sdk_index): if not cls.is_nve(int(port_attributes.log_port)) \ and not cls.is_cpu(int(port_attributes.log_port)) \ and port_attributes.port_mapping.module_port == sdk_index \ + and port_attributes.port_mapping.slot == slot_id \ and cls.is_port_admin_status_up(sdk_handle, port_attributes.log_port): log_port_list.append(port_attributes.log_port) @@ -2071,7 +561,7 @@ def get_logical_ports(cls, sdk_handle, sdk_index): @classmethod - def mgmt_phy_mod_pwr_attr_set(cls, sdk_handle, sdk_index, power_attr_type, admin_pwr_mode): + def mgmt_phy_mod_pwr_attr_set(cls, sdk_handle, sdk_index, slot_id, power_attr_type, admin_pwr_mode): result = False sx_mgmt_phy_mod_pwr_attr = sx_mgmt_phy_mod_pwr_attr_t() sx_mgmt_phy_mod_pwr_mode_attr = sx_mgmt_phy_mod_pwr_mode_attr_t() @@ -2081,12 +571,12 @@ def mgmt_phy_mod_pwr_attr_set(cls, sdk_handle, sdk_index, power_attr_type, admin sx_mgmt_phy_mod_pwr_attr_p = new_sx_mgmt_phy_mod_pwr_attr_t_p() sx_mgmt_phy_mod_pwr_attr_t_p_assign(sx_mgmt_phy_mod_pwr_attr_p, sx_mgmt_phy_mod_pwr_attr) module_id_info = sx_mgmt_module_id_info_t() - module_id_info.slot_id = 0 + module_id_info.slot_id = slot_id module_id_info.module_id = sdk_index try: rc = sx_mgmt_phy_module_pwr_attr_set(sdk_handle, SX_ACCESS_CMD_SET, module_id_info, sx_mgmt_phy_mod_pwr_attr_p) if SX_STATUS_SUCCESS != rc: - logger.log_error("Error occurred when setting power mode for SFP module {}, error code {}".format(sdk_index, rc)) + logger.log_error("Error occurred when setting power mode for SFP module {}, slot {}, error code {}".format(sdk_index, slot_id, rc)) result = False else: result = True @@ -2097,10 +587,10 @@ def mgmt_phy_mod_pwr_attr_set(cls, sdk_handle, sdk_index, power_attr_type, admin @classmethod - def _set_lpmode_raw(cls, sdk_handle, sdk_index, ports, attr_type, power_mode): + def _set_lpmode_raw(cls, sdk_handle, sdk_index, slot_id, ports, attr_type, power_mode): result = False # Check if the module already works in the same mode - admin_pwr_mode, oper_pwr_mode = cls.mgmt_phy_mod_pwr_attr_get(attr_type, sdk_handle, sdk_index) + admin_pwr_mode, oper_pwr_mode = cls.mgmt_phy_mod_pwr_attr_get(attr_type, sdk_handle, sdk_index, slot_id) if (power_mode == SX_MGMT_PHY_MOD_PWR_MODE_LOW_E and oper_pwr_mode == SX_MGMT_PHY_MOD_PWR_MODE_LOW_E) \ or (power_mode == SX_MGMT_PHY_MOD_PWR_MODE_AUTO_E and admin_pwr_mode == SX_MGMT_PHY_MOD_PWR_MODE_AUTO_E): return True @@ -2109,7 +599,7 @@ def _set_lpmode_raw(cls, sdk_handle, sdk_index, ports, attr_type, power_mode): for port in ports: cls.set_port_admin_status_by_log_port(sdk_handle, port, SX_PORT_ADMIN_STATUS_DOWN) # Set the desired power mode - result = cls.mgmt_phy_mod_pwr_attr_set(sdk_handle, sdk_index, attr_type, power_mode) + result = cls.mgmt_phy_mod_pwr_attr_set(sdk_handle, sdk_index, slot_id, attr_type, power_mode) finally: # Bring the port up for port in ports: @@ -2130,12 +620,12 @@ def set_lpmode(self, lpmode): A boolean, True if lpmode is set successfully, False if not """ if utils.is_host(): - # To avoid performance issue, + # To avoid performance issue, # call class level method to avoid initialize the whole sonic platform API set_lpmode_code = 'from sonic_platform import sfp;\n' \ 'with sfp.SdkHandleContext() as sdk_handle:' \ - 'print(sfp.SFP._set_lpmode({}, sdk_handle, {}))' \ - .format('True' if lpmode else 'False', self.sdk_index) + 'print(sfp.SFP._set_lpmode({}, sdk_handle, {}, {}))' \ + .format('True' if lpmode else 'False', self.sdk_index, self.slot_id) lpm_cmd = "docker exec pmon python3 -c \"{}\"".format(set_lpmode_code) # Set LPM @@ -2143,46 +633,25 @@ def set_lpmode(self, lpmode): output = subprocess.check_output(lpm_cmd, shell=True, universal_newlines=True) return 'True' in output except subprocess.CalledProcessError as e: - print("Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(self.index, e.returncode, e.output)) + print("Error! Unable to set LPM for {}, rc = {}, err msg: {}".format(self.sdk_index, e.returncode, e.output)) return False else: - return self._set_lpmode(lpmode, self.sdk_handle, self.sdk_index) + return self._set_lpmode(lpmode, self.sdk_handle, self.sdk_index, self.slot_id) + - @classmethod - def _set_lpmode(cls, lpmode, sdk_handle, sdk_index): - log_port_list = cls.get_logical_ports(sdk_handle, sdk_index) + def _set_lpmode(cls, lpmode, sdk_handle, sdk_index, slot_id): + log_port_list = cls.get_logical_ports(sdk_handle, sdk_index, slot_id) sdk_lpmode = SX_MGMT_PHY_MOD_PWR_MODE_LOW_E if lpmode else SX_MGMT_PHY_MOD_PWR_MODE_AUTO_E - cls._set_lpmode_raw(sdk_handle, - sdk_index, - log_port_list, - SX_MGMT_PHY_MOD_PWR_ATTR_PWR_MODE_E, + cls._set_lpmode_raw(sdk_handle, + sdk_index, + slot_id, + log_port_list, + SX_MGMT_PHY_MOD_PWR_ATTR_PWR_MODE_E, sdk_lpmode) - logger.log_info("{} low power mode for module {}".format("Enabled" if lpmode else "Disabled", sdk_index)) + logger.log_info("{} low power mode for module {}, slot {}".format("Enabled" if lpmode else "Disabled", sdk_index, slot_id)) return True - - def set_power_override(self, power_override, power_set): - """ - Sets SFP power level using power_override and power_set - - Args: - power_override : - A Boolean, True to override set_lpmode and use power_set - to control SFP power, False to disable SFP power control - through power_override/power_set and use set_lpmode - to control SFP power. - power_set : - Only valid when power_override is True. - A Boolean, True to set SFP to low power mode, False to set - SFP to high power mode. - - Returns: - A boolean, True if power-override and power_set are set successfully, - False if not - """ - return NotImplementedError - def is_replaceable(self): """ Indicate whether this device is replaceable. diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp_event.py b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp_event.py index 2c77e6d5651b..4749a6fbe710 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp_event.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp_event.py @@ -1,3 +1,19 @@ +# +# Copyright (c) 2019-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ''' listen to the SDK for the SFP change event and return to chassis. ''' @@ -7,14 +23,19 @@ import os import time import select -if 'MLNX_PLATFORM_API_UNIT_TESTING' not in os.environ: - from python_sdk_api.sx_api import * -else: - from mock import MagicMock - class MockSxFd(object): - fd = 99 - new_sx_fd_t_p = MagicMock(return_value=MockSxFd()) - new_sx_user_channel_t_p = MagicMock() + +from .device_data import DeviceDataManager +try: + if 'PLATFORM_API_UNIT_TESTING' not in os.environ: + from python_sdk_api.sx_api import * + else: + from mock import MagicMock + class MockSxFd(object): + fd = 99 + new_sx_fd_t_p = MagicMock(return_value=MockSxFd()) + new_sx_user_channel_t_p = MagicMock() +except KeyError: + pass from sonic_py_common.logger import Logger from .sfp import SFP @@ -236,7 +257,8 @@ def check_sfp_status(self, port_change, error_dict, timeout): found = 0 try: - read, _, _ = select.select([self.rx_fd_p.fd], [], [], timeout) + read, _, _ = select.select([self.rx_fd_p.fd], [], [], float(timeout) / 1000) + print(read) except select.error as err: rc, msg = err if rc == errno.EAGAIN or rc == errno.EINTR: @@ -247,6 +269,7 @@ def check_sfp_status(self, port_change, error_dict, timeout): for fd in read: if fd == self.rx_fd_p.fd: success, port_list, module_state, error_type = self.on_pmpe(self.rx_fd_p) + print('success = ', success) if not success: logger.log_error("failed to read from {}".format(fd)) break @@ -323,6 +346,7 @@ def on_pmpe(self, fd_p): module_state = pmpe_t.module_state error_type = pmpe_t.error_type module_id = pmpe_t.module_id + slot_id = pmpe_t.slot_id # For non-modular chassis, it should return 0 if module_state == SDK_SFP_STATE_ERR: logger.log_error("Receive PMPE error event on module {}: status {} error type {}".format(module_id, module_state, error_type)) @@ -336,11 +360,10 @@ def on_pmpe(self, fd_p): logical_port = sx_port_log_id_t_arr_getitem(logical_port_list, i) rc = sx_api_port_device_get(self.handle, 1 , 0, port_attributes_list, port_cnt_p) port_cnt = uint32_t_p_value(port_cnt_p) - for i in range(port_cnt): port_attributes = sx_port_attributes_t_arr_getitem(port_attributes_list,i) if port_attributes.log_port == logical_port: - label_port = port_attributes.port_mapping.module_port + label_port = slot_id * DeviceDataManager.get_linecard_max_port_count() + port_attributes.port_mapping.module_port break if label_port is not None: diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/thermal.py b/platform/mellanox/mlnx-platform-api/sonic_platform/thermal.py index d28eabdbe6a4..bc307bc5e076 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/thermal.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/thermal.py @@ -1,3 +1,19 @@ +# +# Copyright (c) 2019-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################# # Mellanox # @@ -9,406 +25,273 @@ try: from sonic_platform_base.thermal_base import ThermalBase from sonic_py_common.logger import Logger - from os import listdir - from os.path import isfile, join - import io - import os.path + import copy + import os + import glob + + from .device_data import DeviceDataManager + from . import utils except ImportError as e: raise ImportError (str(e) + "- required module not found") # Global logger class instance logger = Logger() -THERMAL_DEV_CATEGORY_CPU_CORE = "cpu_core" -THERMAL_DEV_CATEGORY_CPU_PACK = "cpu_pack" -THERMAL_DEV_CATEGORY_MODULE = "module" -THERMAL_DEV_CATEGORY_PSU = "psu" -THERMAL_DEV_CATEGORY_GEARBOX = "gearbox" -THERMAL_DEV_CATEGORY_AMBIENT = "ambient" - -THERMAL_DEV_ASIC_AMBIENT = "asic_amb" -THERMAL_DEV_FAN_AMBIENT = "fan_amb" -THERMAL_DEV_PORT_AMBIENT = "port_amb" -THERMAL_DEV_COMEX_AMBIENT = "comex_amb" -THERMAL_DEV_BOARD_AMBIENT = "board_amb" - -THERMAL_API_GET_TEMPERATURE = "get_temperature" -THERMAL_API_GET_HIGH_THRESHOLD = "get_high_threshold" -THERMAL_API_GET_HIGH_CRITICAL_THRESHOLD = "get_high_critical_threshold" - -THERMAL_API_INVALID_HIGH_THRESHOLD = 0.0 - -HW_MGMT_THERMAL_ROOT = "/var/run/hw-management/thermal/" - -THERMAL_ZONE_ASIC_PATH = "/var/run/hw-management/thermal/mlxsw/" -THERMAL_ZONE_MODULE_PATH = "/var/run/hw-management/thermal/mlxsw-module{}/" -THERMAL_ZONE_GEARBOX_PATH = "/var/run/hw-management/thermal/mlxsw-gearbox{}/" -THERMAL_ZONE_MODE = "thermal_zone_mode" -THERMAL_ZONE_POLICY = "thermal_zone_policy" -THERMAL_ZONE_TEMPERATURE = "thermal_zone_temp" -THERMAL_ZONE_NORMAL_TEMPERATURE = "temp_trip_high" - -MODULE_TEMPERATURE_FAULT_PATH = "/var/run/hw-management/thermal/module{}_temp_fault" - -thermal_api_handler_asic = { - THERMAL_API_GET_TEMPERATURE: 'asic', - THERMAL_API_GET_HIGH_THRESHOLD: 'mlxsw/temp_trip_hot', - THERMAL_API_GET_HIGH_CRITICAL_THRESHOLD: 'mlxsw/temp_trip_crit' -} - -thermal_api_handler_cpu_core = { - THERMAL_API_GET_TEMPERATURE:"cpu_core{}", - THERMAL_API_GET_HIGH_THRESHOLD:"cpu_core{}_max", - THERMAL_API_GET_HIGH_CRITICAL_THRESHOLD:"cpu_core{}_crit" -} -thermal_api_handler_cpu_pack = { - THERMAL_API_GET_TEMPERATURE:"cpu_pack", - THERMAL_API_GET_HIGH_THRESHOLD:"cpu_pack_max", - THERMAL_API_GET_HIGH_CRITICAL_THRESHOLD:"cpu_pack_crit" -} -thermal_api_handler_module = { - THERMAL_API_GET_TEMPERATURE:"module{}_temp_input", - THERMAL_API_GET_HIGH_THRESHOLD:"module{}_temp_crit", - THERMAL_API_GET_HIGH_CRITICAL_THRESHOLD:"module{}_temp_emergency" -} -thermal_api_handler_psu = { - THERMAL_API_GET_TEMPERATURE:"psu{}_temp", - THERMAL_API_GET_HIGH_THRESHOLD:"psu{}_temp_max", - THERMAL_API_GET_HIGH_CRITICAL_THRESHOLD:None -} -thermal_api_handler_gearbox = { - THERMAL_API_GET_TEMPERATURE:"gearbox{}_temp_input", - THERMAL_API_GET_HIGH_THRESHOLD:"mlxsw-gearbox{}/temp_trip_hot", - THERMAL_API_GET_HIGH_CRITICAL_THRESHOLD:"mlxsw-gearbox{}/temp_trip_crit" -} -thermal_ambient_apis = { - THERMAL_DEV_ASIC_AMBIENT : thermal_api_handler_asic, - THERMAL_DEV_PORT_AMBIENT : "port_amb", - THERMAL_DEV_FAN_AMBIENT : "fan_amb", - THERMAL_DEV_COMEX_AMBIENT : "comex_amb", - THERMAL_DEV_BOARD_AMBIENT : "board_amb" -} -thermal_ambient_name = { - THERMAL_DEV_ASIC_AMBIENT : 'ASIC', - THERMAL_DEV_PORT_AMBIENT : "Ambient Port Side Temp", - THERMAL_DEV_FAN_AMBIENT : "Ambient Fan Side Temp", - THERMAL_DEV_COMEX_AMBIENT : "Ambient COMEX Temp", - THERMAL_DEV_BOARD_AMBIENT : "Ambient Board Temp" -} -thermal_api_handlers = { - THERMAL_DEV_CATEGORY_CPU_CORE : thermal_api_handler_cpu_core, - THERMAL_DEV_CATEGORY_CPU_PACK : thermal_api_handler_cpu_pack, - THERMAL_DEV_CATEGORY_MODULE : thermal_api_handler_module, - THERMAL_DEV_CATEGORY_PSU : thermal_api_handler_psu, - THERMAL_DEV_CATEGORY_GEARBOX : thermal_api_handler_gearbox -} -thermal_name = { - THERMAL_DEV_CATEGORY_CPU_CORE : "CPU Core {} Temp", - THERMAL_DEV_CATEGORY_CPU_PACK : "CPU Pack Temp", - THERMAL_DEV_CATEGORY_MODULE : "xSFP module {} Temp", - THERMAL_DEV_CATEGORY_PSU : "PSU-{} Temp", - THERMAL_DEV_CATEGORY_GEARBOX : "Gearbox {} Temp" -} - -thermal_device_categories_all = [ - THERMAL_DEV_CATEGORY_AMBIENT, - THERMAL_DEV_CATEGORY_CPU_PACK, - THERMAL_DEV_CATEGORY_CPU_CORE, - THERMAL_DEV_CATEGORY_GEARBOX, -] - -thermal_device_categories_singleton = [ - THERMAL_DEV_CATEGORY_CPU_PACK, - THERMAL_DEV_CATEGORY_AMBIENT -] -thermal_api_names = [ - THERMAL_API_GET_TEMPERATURE, - THERMAL_API_GET_HIGH_THRESHOLD -] - -platform_dict_thermal = {'x86_64-mlnx_msn2700-r0': 0, 'x86_64-mlnx_lssn2700-r0': 0, 'x86_64-mlnx_msn2740-r0': 3, - 'x86_64-mlnx_msn2100-r0': 1, 'x86_64-mlnx_msn2410-r0': 2, 'x86_64-mlnx_msn2010-r0': 4, - 'x86_64-mlnx_msn3420-r0': 9, 'x86_64-mlnx_msn3700-r0': 5, 'x86_64-mlnx_msn3700c-r0': 6, - 'x86_64-mlnx_msn3800-r0': 7, 'x86_64-mlnx_msn4600-r0': 12, 'x86_64-mlnx_msn4600c-r0': 9, - 'x86_64-mlnx_msn4700-r0': 8, 'x86_64-mlnx_msn4410-r0': 8} -thermal_profile_list = [ - # 0 2700 - { - THERMAL_DEV_CATEGORY_CPU_CORE:(0, 2), - THERMAL_DEV_CATEGORY_MODULE:(1, 32), - THERMAL_DEV_CATEGORY_PSU:(1, 2), - THERMAL_DEV_CATEGORY_CPU_PACK:(0,1), - THERMAL_DEV_CATEGORY_GEARBOX:(0,0), - THERMAL_DEV_CATEGORY_AMBIENT:(0, - [ - THERMAL_DEV_ASIC_AMBIENT, - THERMAL_DEV_PORT_AMBIENT, - THERMAL_DEV_FAN_AMBIENT - ] - ) - }, - # 1 2100 - { - THERMAL_DEV_CATEGORY_CPU_CORE:(0, 4), - THERMAL_DEV_CATEGORY_MODULE:(1, 16), - THERMAL_DEV_CATEGORY_PSU:(0, 0), - THERMAL_DEV_CATEGORY_CPU_PACK:(0,0), - THERMAL_DEV_CATEGORY_GEARBOX:(0,0), - THERMAL_DEV_CATEGORY_AMBIENT:(0, - [ - THERMAL_DEV_ASIC_AMBIENT, - THERMAL_DEV_PORT_AMBIENT, - THERMAL_DEV_FAN_AMBIENT, - ] - ) - }, - # 2 2410 - { - THERMAL_DEV_CATEGORY_CPU_CORE:(0, 2), - THERMAL_DEV_CATEGORY_MODULE:(1, 56), - THERMAL_DEV_CATEGORY_PSU:(1, 2), - THERMAL_DEV_CATEGORY_CPU_PACK:(0,1), - THERMAL_DEV_CATEGORY_GEARBOX:(0,0), - THERMAL_DEV_CATEGORY_AMBIENT:(0, - [ - THERMAL_DEV_ASIC_AMBIENT, - THERMAL_DEV_PORT_AMBIENT, - THERMAL_DEV_FAN_AMBIENT, - ] - ) - }, - # 3 2740 - { - THERMAL_DEV_CATEGORY_CPU_CORE:(0, 4), - THERMAL_DEV_CATEGORY_MODULE:(1, 32), - THERMAL_DEV_CATEGORY_PSU:(1, 2), - THERMAL_DEV_CATEGORY_CPU_PACK:(0,0), - THERMAL_DEV_CATEGORY_GEARBOX:(0,0), - THERMAL_DEV_CATEGORY_AMBIENT:(0, - [ - THERMAL_DEV_ASIC_AMBIENT, - THERMAL_DEV_PORT_AMBIENT, - THERMAL_DEV_FAN_AMBIENT, - ] - ) - }, - # 4 2010 - { - THERMAL_DEV_CATEGORY_CPU_CORE:(0, 4), - THERMAL_DEV_CATEGORY_MODULE:(1, 22), - THERMAL_DEV_CATEGORY_PSU:(0, 0), - THERMAL_DEV_CATEGORY_CPU_PACK:(0,0), - THERMAL_DEV_CATEGORY_GEARBOX:(0,0), - THERMAL_DEV_CATEGORY_AMBIENT:(0, - [ - THERMAL_DEV_ASIC_AMBIENT, - THERMAL_DEV_PORT_AMBIENT, - THERMAL_DEV_FAN_AMBIENT, - ] - ) - }, - # 5 3700 - { - THERMAL_DEV_CATEGORY_CPU_CORE:(0, 4), - THERMAL_DEV_CATEGORY_MODULE:(1, 32), - THERMAL_DEV_CATEGORY_PSU:(1, 2), - THERMAL_DEV_CATEGORY_CPU_PACK:(0,1), - THERMAL_DEV_CATEGORY_GEARBOX:(0,0), - THERMAL_DEV_CATEGORY_AMBIENT:(0, - [ - THERMAL_DEV_ASIC_AMBIENT, - THERMAL_DEV_COMEX_AMBIENT, - THERMAL_DEV_PORT_AMBIENT, - THERMAL_DEV_FAN_AMBIENT - ] - ) - }, - # 6 3700c - { - THERMAL_DEV_CATEGORY_CPU_CORE:(0, 2), - THERMAL_DEV_CATEGORY_MODULE:(1, 32), - THERMAL_DEV_CATEGORY_PSU:(1, 2), - THERMAL_DEV_CATEGORY_CPU_PACK:(0,1), - THERMAL_DEV_CATEGORY_GEARBOX:(0,0), - THERMAL_DEV_CATEGORY_AMBIENT:(0, - [ - THERMAL_DEV_ASIC_AMBIENT, - THERMAL_DEV_COMEX_AMBIENT, - THERMAL_DEV_PORT_AMBIENT, - THERMAL_DEV_FAN_AMBIENT - ] - ) - }, - # 7 3800 - { - THERMAL_DEV_CATEGORY_CPU_CORE:(0, 4), - THERMAL_DEV_CATEGORY_MODULE:(1, 64), - THERMAL_DEV_CATEGORY_PSU:(1, 2), - THERMAL_DEV_CATEGORY_CPU_PACK:(0,1), - THERMAL_DEV_CATEGORY_GEARBOX:(1,32), - THERMAL_DEV_CATEGORY_AMBIENT:(0, - [ - THERMAL_DEV_ASIC_AMBIENT, - THERMAL_DEV_COMEX_AMBIENT, - THERMAL_DEV_PORT_AMBIENT, - THERMAL_DEV_FAN_AMBIENT - ] - ) - }, - # 8 4700 - { - THERMAL_DEV_CATEGORY_CPU_CORE:(0, 4), - THERMAL_DEV_CATEGORY_MODULE:(1, 32), - THERMAL_DEV_CATEGORY_PSU:(1, 2), - THERMAL_DEV_CATEGORY_CPU_PACK:(0,1), - THERMAL_DEV_CATEGORY_GEARBOX:(0,0), - THERMAL_DEV_CATEGORY_AMBIENT:(0, - [ - THERMAL_DEV_ASIC_AMBIENT, - THERMAL_DEV_COMEX_AMBIENT, - THERMAL_DEV_PORT_AMBIENT, - THERMAL_DEV_FAN_AMBIENT - ] - ) - }, - # 9 3420 +""" +The most important information for creating a Thermal object is 3 sysfs files: temperature file, high threshold file and +high critical threshold file. There is no common naming rule for thermal objects on Nvidia platform. There are two types +of thermal object: single and indexable: + 1. Single. Such as asic, port_amb... + 2. Indexablt. Such as cpu_core0, cpu_core1, psu1_temp, psu2_temp + +Thermal objects can be created according to a pre-defined naming rule. The naming rules contains following fields + +Field Name Mandatory Default Description +name M Thermal object name template +temperature M Temperature file name +high_threshold O None High threshold file name +high_critical_threshold O None High critical threshold file name +type O single Thermal object type +start_index O 1 Thermal object start index, only used by indexable thermal object +""" +THERMAL_NAMING_RULE = { + "sfp thermals": { - THERMAL_DEV_CATEGORY_CPU_CORE:(0, 2), - THERMAL_DEV_CATEGORY_MODULE:(1, 60), - THERMAL_DEV_CATEGORY_PSU:(1, 2), - THERMAL_DEV_CATEGORY_CPU_PACK:(0,1), - THERMAL_DEV_CATEGORY_GEARBOX:(0,0), - THERMAL_DEV_CATEGORY_AMBIENT:(0, - [ - THERMAL_DEV_ASIC_AMBIENT, - THERMAL_DEV_COMEX_AMBIENT, - THERMAL_DEV_PORT_AMBIENT, - THERMAL_DEV_FAN_AMBIENT - ] - ) + "name": "xSFP module {} Temp", + "temperature": "module{}_temp_input", + "high_threshold": "module{}_temp_crit", + "high_critical_threshold": "module{}_temp_emergency", + "type": "indexable" }, - # 10 4600C + "psu thermals": { - THERMAL_DEV_CATEGORY_CPU_CORE:(0, 4), - THERMAL_DEV_CATEGORY_MODULE:(1, 64), - THERMAL_DEV_CATEGORY_PSU:(1, 2), - THERMAL_DEV_CATEGORY_CPU_PACK:(0,1), - THERMAL_DEV_CATEGORY_GEARBOX:(0,0), - THERMAL_DEV_CATEGORY_AMBIENT:(0, - [ - THERMAL_DEV_ASIC_AMBIENT, - THERMAL_DEV_COMEX_AMBIENT, - THERMAL_DEV_PORT_AMBIENT, - THERMAL_DEV_FAN_AMBIENT - ] - ) + "name": "PSU-{} Temp", + "temperature": "psu{}_temp", + "high_threshold": "psu{}_temp_max", + "type": "indexable" }, - # 11 4410 - { - THERMAL_DEV_CATEGORY_CPU_CORE:(0, 4), - THERMAL_DEV_CATEGORY_MODULE:(1, 32), - THERMAL_DEV_CATEGORY_PSU:(1, 2), - THERMAL_DEV_CATEGORY_CPU_PACK:(0,1), - THERMAL_DEV_CATEGORY_GEARBOX:(0,0), - THERMAL_DEV_CATEGORY_AMBIENT:(0, - [ - THERMAL_DEV_ASIC_AMBIENT, - THERMAL_DEV_COMEX_AMBIENT, - THERMAL_DEV_PORT_AMBIENT, - THERMAL_DEV_FAN_AMBIENT - ] - ) - }, - # 12 4600 - { - THERMAL_DEV_CATEGORY_CPU_CORE:(0, 4), - THERMAL_DEV_CATEGORY_MODULE:(1, 64), - THERMAL_DEV_CATEGORY_PSU:(1, 2), - THERMAL_DEV_CATEGORY_CPU_PACK:(0,1), - THERMAL_DEV_CATEGORY_GEARBOX:(0,0), - THERMAL_DEV_CATEGORY_AMBIENT:(0, - [ - THERMAL_DEV_ASIC_AMBIENT, - THERMAL_DEV_COMEX_AMBIENT, - THERMAL_DEV_PORT_AMBIENT, - THERMAL_DEV_FAN_AMBIENT - ] - ) + "chassis thermals": [ + { + "name": "ASIC", + "temperature": "asic", + "high_threshold": "mlxsw/temp_trip_hot", + "high_critical_threshold": "mlxsw/temp_trip_crit" + }, + { + "name": "Ambient Port Side Temp", + "temperature": "port_amb" + }, + { + "name": "Ambient Fan Side Temp", + "temperature": "fan_amb" + }, + { + "name": "Ambient COMEX Temp", + "temperature": "comex_amb" + }, + { + "name": "CPU Pack Temp", + "temperature": "cpu_pack", + "high_threshold": "cpu_pack_max", + "high_critical_threshold": "cpu_pack_crit" + }, + { + "name": "CPU Core {} Temp", + "temperature": "cpu_core{}", + "high_threshold": "cpu_core{}_max", + "high_critical_threshold": "cpu_core{}_crit", + "type": "indexable", + "start_index": 0 + }, + { + "name": "Gearbox {} Temp", + "temperature": "gearbox{}_temp_input", + "high_threshold": "mlxsw-gearbox{}/temp_trip_hot", + "high_critical_threshold": "mlxsw-gearbox{}/temp_trip_crit", + "type": "indexable" + }, + { + "name": "Ambient CPU Board Temp", + "temperature": "cpu_amb", + "default_present": False + }, + { + "name": "Ambient Switch Board Temp", + "temperature": "swb_amb", + "default_present": False + } + ], + 'linecard thermals': { + "name": "Gearbox {} Temp", + "temperature": "gearbox{}_temp_input", + "high_threshold": "mlxsw-gearbox{}/temp_trip_hot", + "high_critical_threshold": "mlxsw-gearbox{}/temp_trip_crit", + "type": "indexable" } -] - -def initialize_psu_thermals(platform, thermal_list, psu_index, dependency): - tp_index = platform_dict_thermal[platform] - thermal_profile = thermal_profile_list[tp_index] - _, count = thermal_profile[THERMAL_DEV_CATEGORY_PSU] - if count == 0: - return - thermal = Thermal(THERMAL_DEV_CATEGORY_PSU, psu_index, True, 1, dependency) - thermal_list.append(thermal) - - -def initialize_sfp_thermals(platform, thermal_list, sfp_index): - thermal = Thermal(THERMAL_DEV_CATEGORY_MODULE, sfp_index, True, 1) - thermal_list.append(thermal) - - -def initialize_chassis_thermals(platform, thermal_list): - # create thermal objects for all categories of sensors - tp_index = platform_dict_thermal[platform] - thermal_profile = thermal_profile_list[tp_index] - Thermal.thermal_profile = thermal_profile +} + +CHASSIS_THERMAL_SYSFS_FOLDER = '/run/hw-management/thermal' +COOLING_STATE_PATH = "/var/run/hw-management/thermal/cooling_cur_state" +THERMAL_ZONE_ASIC_PATH = '/var/run/hw-management/thermal/mlxsw/' +THERMAL_ZONE_FOLDER_WILDCARD = '/run/hw-management/thermal/mlxsw*' +THERMAL_ZONE_HIGH_THRESHOLD = 'temp_trip_high' +THERMAL_ZONE_HOT_THRESHOLD = 'temp_trip_hot' +THERMAL_ZONE_NORMAL_THRESHOLD = 'temp_trip_norm' +THERMAL_ZONE_MODE_FILE = 'thermal_zone_mode' +THERMAL_ZONE_POLICY_FILE = 'thermal_zone_policy' +THERMAL_ZONE_TEMP_FILE = 'thermal_zone_temp' +THERMAL_ZONE_HYSTERESIS = 5000 +MODULE_TEMP_FAULT_WILDCARRD = '/run/hw-management/thermal/module*_temp_fault' +MAX_AMBIENT_TEMP = 120 +# Min allowed cooling level when all thermal zones are in normal state +MIN_COOLING_LEVEL_FOR_NORMAL = 2 +# Min allowed cooling level when any thermal zone is in high state but no thermal zone is in emergency state +MIN_COOLING_LEVEL_FOR_HIGH = 4 +MAX_COOLING_LEVEL = 10 + + +def initialize_chassis_thermals(): + thermal_list = [] + rules = THERMAL_NAMING_RULE['chassis thermals'] position = 1 - for category in thermal_device_categories_all: - if category == THERMAL_DEV_CATEGORY_AMBIENT: - count, ambient_list = thermal_profile[category] - for ambient in ambient_list: - thermal = Thermal(category, ambient, True, position) - thermal_list.append(thermal), + for rule in rules: + if 'type' in rule and rule['type'] == 'indexable': + count = 0 + if 'Gearbox' in rule['name']: + count = DeviceDataManager.get_gearbox_count('/run/hw-management/config') + elif 'CPU Core' in rule['name']: + count = DeviceDataManager.get_cpu_thermal_count() + if count == 0: + logger.log_debug('Failed to get thermal object count for {}'.format(rule['name'])) + continue + + for index in range(count): + thermal_list.append(create_indexable_thermal(rule, index, CHASSIS_THERMAL_SYSFS_FOLDER, position)) position += 1 else: - start, count = 0, 0 - if category in thermal_profile: - start, count = thermal_profile[category] - if count == 0: - continue - if count == 1: - thermal = Thermal(category, 0, False, position) - thermal_list.append(thermal) + thermal_object = create_single_thermal(rule, CHASSIS_THERMAL_SYSFS_FOLDER, position) + if thermal_object: + thermal_list.append(thermal_object) position += 1 - else: - for index in range(count): - thermal = Thermal(category, start + index, True, position) - thermal_list.append(thermal) - position += 1 - + return thermal_list + + +def initialize_psu_thermal(psu_index, presence_cb): + """Initialize PSU thermal object + + Args: + psu_index (int): PSU index, 0-based + presence_cb (function): A callback function to indicate if the thermal is present. When removing a PSU, the related + thermal sysfs files will be removed from system, presence_cb is used to check such situation and avoid printing + error logs. + + Returns: + [list]: A list of thermal objects + """ + return [create_indexable_thermal(THERMAL_NAMING_RULE['psu thermals'], psu_index, CHASSIS_THERMAL_SYSFS_FOLDER, 1, presence_cb)] + + +def initialize_sfp_thermal(sfp_index): + return [create_indexable_thermal(THERMAL_NAMING_RULE['sfp thermals'], sfp_index, CHASSIS_THERMAL_SYSFS_FOLDER, 1)] + + +def initialize_linecard_thermals(lc_name, lc_index): + thermal_list = [] + rule = THERMAL_NAMING_RULE['linecard thermals'] + rule = copy.deepcopy(rule) + rule['name'] = '{} {}'.format(lc_name, rule['name']) + sysfs_folder = '/run/hw-management/lc{}/thermal'.format(lc_index) + count = DeviceDataManager.get_gearbox_count('/run/hw-management/lc{}/config'.format(lc_index)) + for index in range(count): + thermal_list.append(create_indexable_thermal(rule, index, sysfs_folder, index + 1)) + return thermal_list + + +def initialize_linecard_sfp_thermal(lc_name, lc_index, sfp_index): + rule = THERMAL_NAMING_RULE['sfp thermals'] + rule = copy.deepcopy(rule) + rule['name'] = '{} {}'.format(lc_name, rule['name']) + sysfs_folder = '/run/hw-management/lc{}/thermal'.format(lc_index) + return [create_indexable_thermal(rule, sfp_index, sysfs_folder, 1)] + + +def create_indexable_thermal(rule, index, sysfs_folder, position, presence_cb=None): + index += rule.get('start_index', 1) + name = rule['name'].format(index) + temp_file = os.path.join(sysfs_folder, rule['temperature'].format(index)) + _check_thermal_sysfs_existence(temp_file) + if 'high_threshold' in rule: + high_th_file = os.path.join(sysfs_folder, rule['high_threshold'].format(index)) + _check_thermal_sysfs_existence(high_th_file) + else: + high_th_file = None + if 'high_critical_threshold' in rule: + high_crit_th_file = os.path.join(sysfs_folder, rule['high_critical_threshold'].format(index)) + _check_thermal_sysfs_existence(high_crit_th_file) + else: + high_crit_th_file = None + if not presence_cb: + return Thermal(name, temp_file, high_th_file, high_crit_th_file, position) + else: + return RemovableThermal(name, temp_file, high_th_file, high_crit_th_file, position, presence_cb) + + +def create_single_thermal(rule, sysfs_folder, position, presence_cb=None): + temp_file = rule['temperature'] + default_present = rule.get('default_present', True) + thermal_capability = DeviceDataManager.get_thermal_capability() + + if thermal_capability: + if not thermal_capability.get(temp_file, default_present): + return None + elif not default_present: + return None + + temp_file = os.path.join(sysfs_folder, temp_file) + _check_thermal_sysfs_existence(temp_file) + if 'high_threshold' in rule: + high_th_file = os.path.join(sysfs_folder, rule['high_threshold']) + _check_thermal_sysfs_existence(high_th_file) + else: + high_th_file = None + if 'high_critical_threshold' in rule: + high_crit_th_file = os.path.join(sysfs_folder, rule['high_critical_threshold']) + _check_thermal_sysfs_existence(high_crit_th_file) + else: + high_crit_th_file = None + name = rule['name'] + if not presence_cb: + return Thermal(name, temp_file, high_th_file, high_crit_th_file, position) + else: + return RemovableThermal(name, temp_file, high_th_file, high_crit_th_file, position, presence_cb) + + +def _check_thermal_sysfs_existence(file_path): + if not os.path.exists(file_path): + logger.log_error('Thermal sysfs {} does not exist'.format(file_path)) class Thermal(ThermalBase): - thermal_profile = None thermal_algorithm_status = False - - def __init__(self, category, index, has_index, position, dependency = None): + # Expect cooling level, used for caching the cooling level value before commiting to hardware + expect_cooling_level = None + # Expect cooling state + expect_cooling_state = None + # Last committed cooling level + last_set_cooling_level = None + last_set_cooling_state = None + last_set_psu_cooling_level = None + + def __init__(self, name, temp_file, high_th_file, high_crit_th_file, position): """ index should be a string for category ambient and int for other categories """ super(Thermal, self).__init__() - if category == THERMAL_DEV_CATEGORY_AMBIENT: - self.name = thermal_ambient_name[index] - self.index = index - elif has_index: - self.name = thermal_name[category].format(index) - self.index = index - else: - self.name = thermal_name[category] - self.index = 0 - - self.category = category + self.name = name self.position = position - self.temperature = self._get_file_from_api(THERMAL_API_GET_TEMPERATURE) - self.high_threshold = self._get_file_from_api(THERMAL_API_GET_HIGH_THRESHOLD) - self.high_critical_threshold = self._get_file_from_api(THERMAL_API_GET_HIGH_CRITICAL_THRESHOLD) - self.dependency = dependency - + self.temperature = temp_file + self.high_threshold = high_th_file + self.high_critical_threshold = high_crit_th_file def get_name(self): """ @@ -419,66 +302,16 @@ def get_name(self): """ return self.name - - @classmethod - def _read_generic_file(cls, filename, len): - """ - Read a generic file, returns the contents of the file - """ - result = None - try: - with open(filename, 'r') as fileobj: - result = fileobj.read().strip() - except Exception as e: - logger.log_info("Fail to read file {} due to {}".format(filename, repr(e))) - return result - - - def _get_file_from_api(self, api_name): - if self.category == THERMAL_DEV_CATEGORY_AMBIENT: - handler = thermal_ambient_apis[self.index] - if isinstance(handler, str): - if api_name == THERMAL_API_GET_TEMPERATURE: - filename = thermal_ambient_apis[self.index] - else: - return None - elif isinstance(handler, dict): - filename = handler[api_name] - else: - return None - else: - handler = thermal_api_handlers[self.category][api_name] - if self.category in thermal_device_categories_singleton: - filename = handler - else: - if handler: - filename = handler.format(self.index) - else: - return None - return join(HW_MGMT_THERMAL_ROOT, filename) - - def get_temperature(self): """ Retrieves current temperature reading from thermal Returns: A float number of current temperature in Celsius up to nearest thousandth - of one degree Celsius, e.g. 30.125 + of one degree Celsius, e.g. 30.125 """ - if self.dependency: - status, hint = self.dependency() - if not status: - logger.log_debug("get_temperature for {} failed due to {}".format(self.name, hint)) - return None - value_str = self._read_generic_file(self.temperature, 0) - if value_str is None: - return None - value_float = float(value_str) - if self.category == THERMAL_DEV_CATEGORY_MODULE and value_float == THERMAL_API_INVALID_HIGH_THRESHOLD: - return None - return value_float / 1000.0 - + value = utils.read_float_from_file(self.temperature, None, log_func=logger.log_info) + return value / 1000.0 if (value is not None and value != 0) else None def get_high_threshold(self): """ @@ -490,19 +323,8 @@ def get_high_threshold(self): """ if self.high_threshold is None: return None - if self.dependency: - status, hint = self.dependency() - if not status: - logger.log_debug("get_high_threshold for {} failed due to {}".format(self.name, hint)) - return None - value_str = self._read_generic_file(self.high_threshold, 0) - if value_str is None: - return None - value_float = float(value_str) - if self.category == THERMAL_DEV_CATEGORY_MODULE and value_float == THERMAL_API_INVALID_HIGH_THRESHOLD: - return None - return value_float / 1000.0 - + value = utils.read_float_from_file(self.high_threshold, None, log_func=logger.log_info) + return value / 1000.0 if (value is not None and value != 0) else None def get_high_critical_threshold(self): """ @@ -514,18 +336,8 @@ def get_high_critical_threshold(self): """ if self.high_critical_threshold is None: return None - if self.dependency: - status, hint = self.dependency() - if not status: - logger.log_debug("get_high_critical_threshold for {} failed due to {}".format(self.name, hint)) - return None - value_str = self._read_generic_file(self.high_critical_threshold, 0) - if value_str is None: - return None - value_float = float(value_str) - if self.category == THERMAL_DEV_CATEGORY_MODULE and value_float == THERMAL_API_INVALID_HIGH_THRESHOLD: - return None - return value_float / 1000.0 + value = utils.read_float_from_file(self.high_critical_threshold, None, log_func=logger.log_info) + return value / 1000.0 if (value is not None and value != 0) else None def get_position_in_parent(self): """ @@ -543,20 +355,6 @@ def is_replaceable(self): """ return False - @classmethod - def _write_generic_file(cls, filename, content): - """ - Generic functions to write content to a specified file path if - the content has changed. - """ - try: - with open(filename, 'w+') as file_obj: - origin_content = file_obj.read() - if origin_content != content: - file_obj.write(content) - except Exception as e: - logger.log_info("Fail to write file {} due to {}".format(filename, repr(e))) - @classmethod def set_thermal_algorithm_status(cls, status, force=True): """ @@ -566,106 +364,210 @@ def set_thermal_algorithm_status(cls, status, force=True): only adjust fan speed when temperature across some "edge", e.g temperature changes to exceed high threshold. When disable kernel thermal algorithm, kernel no longer adjust fan speed. - We usually disable the algorithm when we want to set a fix speed. E.g, when - a fan unit is removed from system, we will set fan speed to 100% and disable + We usually disable the algorithm when we want to set a fix speed. E.g, when + a fan unit is removed from system, we will set fan speed to 100% and disable the algorithm to avoid it adjust the speed. Returns: True if thermal algorithm status changed. """ - if not cls.thermal_profile: - raise Exception("Fail to get thermal profile for this switch") - if not force and cls.thermal_algorithm_status == status: return False cls.thermal_algorithm_status = status - content = "enabled" if status else "disabled" + mode = "enabled" if status else "disabled" policy = "step_wise" if status else "user_space" - cls._write_generic_file(join(THERMAL_ZONE_ASIC_PATH, THERMAL_ZONE_MODE), content) - cls._write_generic_file(join(THERMAL_ZONE_ASIC_PATH, THERMAL_ZONE_POLICY), policy) - - if THERMAL_DEV_CATEGORY_MODULE in cls.thermal_profile: - start, count = cls.thermal_profile[THERMAL_DEV_CATEGORY_MODULE] - if count != 0: - for index in range(count): - cls._write_generic_file(join(THERMAL_ZONE_MODULE_PATH.format(start + index), THERMAL_ZONE_MODE), content) - cls._write_generic_file(join(THERMAL_ZONE_MODULE_PATH.format(start + index), THERMAL_ZONE_POLICY), policy) - - if THERMAL_DEV_CATEGORY_GEARBOX in cls.thermal_profile: - start, count = cls.thermal_profile[THERMAL_DEV_CATEGORY_GEARBOX] - if count != 0: - for index in range(count): - cls._write_generic_file(join(THERMAL_ZONE_GEARBOX_PATH.format(start + index), THERMAL_ZONE_MODE), content) - cls._write_generic_file(join(THERMAL_ZONE_GEARBOX_PATH.format(start + index), THERMAL_ZONE_POLICY), policy) + for thermal_zone_folder in glob.iglob(THERMAL_ZONE_FOLDER_WILDCARD): + policy_file = os.path.join(thermal_zone_folder, THERMAL_ZONE_POLICY_FILE) + utils.write_file(policy_file, policy) + mode_file = os.path.join(thermal_zone_folder, THERMAL_ZONE_MODE_FILE) + utils.write_file(mode_file, mode) + return True @classmethod - def check_thermal_zone_temperature(cls): - """ - Check thermal zone current temperature with normal temperature - + def get_min_allowed_cooling_level_by_thermal_zone(cls): + """Get min allowed cooling level according to thermal zone status: + 1. If temperature of all thermal zones is less than normal threshold, min allowed cooling level is + $MIN_COOLING_LEVEL_FOR_NORMAL = 2 + 2. If temperature of any thermal zone is greater than normal threshold, but no thermal zone temperature + is greater than high threshold, min allowed cooling level is $MIN_COOLING_LEVEL_FOR_HIGH = 4 + 3. Otherwise, there is no minimum allowed value and policy should not adjust cooling level Returns: - True if all thermal zones current temperature less or equal than normal temperature + int: minimum allowed cooling level """ - if not cls.thermal_profile: - raise Exception("Fail to get thermal profile for this switch") - - if not cls._check_thermal_zone_temperature(THERMAL_ZONE_ASIC_PATH): - return False - - if THERMAL_DEV_CATEGORY_MODULE in cls.thermal_profile: - start, count = cls.thermal_profile[THERMAL_DEV_CATEGORY_MODULE] - if count != 0: - for index in range(count): - if not cls._check_thermal_zone_temperature(THERMAL_ZONE_MODULE_PATH.format(start + index)): - return False - - if THERMAL_DEV_CATEGORY_GEARBOX in cls.thermal_profile: - start, count = cls.thermal_profile[THERMAL_DEV_CATEGORY_GEARBOX] - if count != 0: - for index in range(count): - if not cls._check_thermal_zone_temperature(THERMAL_ZONE_GEARBOX_PATH.format(start + index)): - return False + min_allowed = MIN_COOLING_LEVEL_FOR_NORMAL + thermal_zone_present = False + try: + for thermal_zone_folder in glob.iglob(THERMAL_ZONE_FOLDER_WILDCARD): + current = utils.read_int_from_file(os.path.join(thermal_zone_folder, THERMAL_ZONE_TEMP_FILE)) + if current == 0: + # Temperature value 0 means that this thermal zone has no + # sensor and it should be ignored in this loop + continue - return True + thermal_zone_present = True + normal_thresh = utils.read_int_from_file(os.path.join(thermal_zone_folder, THERMAL_ZONE_NORMAL_THRESHOLD)) + if current < normal_thresh - THERMAL_ZONE_HYSTERESIS: + continue - @classmethod - def _check_thermal_zone_temperature(cls, thermal_zone_path): - normal_temp_path = join(thermal_zone_path, THERMAL_ZONE_NORMAL_TEMPERATURE) - current_temp_path = join(thermal_zone_path, THERMAL_ZONE_TEMPERATURE) - normal = None - current = None - try: - with open(normal_temp_path, 'r') as file_obj: - normal = float(file_obj.read()) - - with open(current_temp_path, 'r') as file_obj: - current = float(file_obj.read()) - - return current <= normal + hot_thresh = utils.read_int_from_file(os.path.join(thermal_zone_folder, THERMAL_ZONE_HIGH_THRESHOLD)) + if current < hot_thresh - THERMAL_ZONE_HYSTERESIS: + min_allowed = MIN_COOLING_LEVEL_FOR_HIGH + else: + min_allowed = None + break except Exception as e: - logger.log_info("Fail to check thermal zone temperature for file {} due to {}".format(thermal_zone_path, repr(e))) + logger.log_error('Failed to get thermal zone status for {} - {}'.format(thermal_zone_folder, repr(e))) + return None + + return min_allowed if thermal_zone_present else None @classmethod def check_module_temperature_trustable(cls): - if not cls.thermal_profile: - raise Exception("Fail to get thermal profile for this switch") - - start, count = cls.thermal_profile[THERMAL_DEV_CATEGORY_MODULE] - for index in range(count): - fault_file_path = MODULE_TEMPERATURE_FAULT_PATH.format(index + start) - fault = cls._read_generic_file(fault_file_path, 0) - if fault.strip() != '0': + for file_path in glob.iglob(MODULE_TEMP_FAULT_WILDCARRD): + fault = utils.read_int_from_file(file_path) + if fault != 0: return 'untrust' return 'trust' @classmethod def get_min_amb_temperature(cls): - fan_ambient_path = join(HW_MGMT_THERMAL_ROOT, THERMAL_DEV_FAN_AMBIENT) - port_ambient_path = join(HW_MGMT_THERMAL_ROOT, THERMAL_DEV_PORT_AMBIENT) + fan_ambient_path = os.path.join(CHASSIS_THERMAL_SYSFS_FOLDER, 'fan_amb') + port_ambient_path = os.path.join(CHASSIS_THERMAL_SYSFS_FOLDER, 'port_amb') + + try: + fan_ambient_temp = utils.read_int_from_file(fan_ambient_path, raise_exception=True) + port_ambient_temp = utils.read_int_from_file(port_ambient_path, raise_exception=True) + return fan_ambient_temp if fan_ambient_temp < port_ambient_temp else port_ambient_temp + except Exception as e: + # Can't get ambient temperature, return maximum + logger.log_error('Failed to get minimum ambient temperature, use pessimistic instead') + return MAX_AMBIENT_TEMP + + @classmethod + def set_cooling_level(cls, level): + """ + Change cooling level. The input level should be an integer value [1, 10]. + 1 means 10%, 2 means 20%, 10 means 100%. + """ + if cls.last_set_cooling_level != level: + utils.write_file(COOLING_STATE_PATH, level + 10, raise_exception=True) + cls.last_set_cooling_level = level + + @classmethod + def set_cooling_state(cls, state): + """Change cooling state. + Args: + state (int): cooling state + """ + if cls.last_set_cooling_state != state: + utils.write_file(COOLING_STATE_PATH, state, raise_exception=True) + cls.last_set_cooling_state = state + + @classmethod + def get_cooling_level(cls): + try: + return utils.read_int_from_file(COOLING_STATE_PATH, raise_exception=True) + except (ValueError, IOError) as e: + raise RuntimeError("Failed to get cooling level - {}".format(e)) - # if there is any exception, let it raise - fan_ambient_temp = int(cls._read_generic_file(fan_ambient_path, 0)) - port_ambient_temp = int(cls._read_generic_file(port_ambient_path, 0)) - return fan_ambient_temp if fan_ambient_temp < port_ambient_temp else port_ambient_temp + @classmethod + def set_expect_cooling_level(cls, expect_value): + """During thermal policy running, cache the expect cooling level generated by policies. The max expect + cooling level will be committed to hardware. + Args: + expect_value (int): Expected cooling level value + """ + if cls.expect_cooling_level is None or cls.expect_cooling_level < expect_value: + cls.expect_cooling_level = int(expect_value) + + @classmethod + def commit_cooling_level(cls, thermal_info_dict): + """Commit cooling level to hardware. This will affect system fan and PSU fan speed. + Args: + thermal_info_dict (dict): Thermal information dictionary + """ + if cls.expect_cooling_level is not None: + cls.set_cooling_level(cls.expect_cooling_level) + + if cls.expect_cooling_state is not None: + cls.set_cooling_state(cls.expect_cooling_state) + elif cls.expect_cooling_level is not None: + cls.set_cooling_state(cls.expect_cooling_level) + + cls.expect_cooling_level = None + # We need to set system fan speed here because kernel will automaticlly adjust fan speed according to cooling level and cooling state + + # Commit PSU fan speed with current state + from .thermal_infos import ChassisInfo + if ChassisInfo.INFO_NAME in thermal_info_dict and isinstance(thermal_info_dict[ChassisInfo.INFO_NAME], ChassisInfo): + cooling_level = cls.get_cooling_level() + if cls.last_set_psu_cooling_level == cooling_level: + return + speed = cooling_level * 10 + chassis = thermal_info_dict[ChassisInfo.INFO_NAME].get_chassis() + for psu in chassis.get_all_psus(): + for psu_fan in psu.get_all_fans(): + psu_fan.set_speed(speed) + cls.last_set_psu_cooling_level = cooling_level + + @classmethod + def monitor_asic_themal_zone(cls): + """This is a protection for asic thermal zone, if asic temperature is greater than hot threshold + THERMAL_ZONE_HYSTERESIS, + and if cooling state is not MAX, we need enforce the cooling state to MAX + """ + asic_temp = utils.read_int_from_file(os.path.join(THERMAL_ZONE_ASIC_PATH, THERMAL_ZONE_TEMP_FILE), raise_exception=True) + hot_thresh = utils.read_int_from_file(os.path.join(THERMAL_ZONE_ASIC_PATH, THERMAL_ZONE_HOT_THRESHOLD), raise_exception=True) + if asic_temp >= hot_thresh + THERMAL_ZONE_HYSTERESIS: + cls.expect_cooling_state = MAX_COOLING_LEVEL + else: + cls.expect_cooling_state = None + + +class RemovableThermal(Thermal): + def __init__(self, name, temp_file, high_th_file, high_crit_th_file, position, presence_cb): + super(RemovableThermal, self).__init__(name, temp_file, high_th_file, high_crit_th_file, position) + self.presence_cb = presence_cb + + def get_temperature(self): + """ + Retrieves current temperature reading from thermal + + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + status, hint = self.presence_cb() + if not status: + logger.log_debug("get_temperature for {} failed due to {}".format(self.name, hint)) + return None + return super(RemovableThermal, self).get_temperature() + + def get_high_threshold(self): + """ + Retrieves the high threshold temperature of thermal + + Returns: + A float number, the high threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + status, hint = self.presence_cb() + if not status: + logger.log_debug("get_high_threshold for {} failed due to {}".format(self.name, hint)) + return None + return super(RemovableThermal, self).get_high_threshold() + + def get_high_critical_threshold(self): + """ + Retrieves the high critical threshold temperature of thermal + + Returns: + A float number, the high critical threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + status, hint = self.presence_cb() + if not status: + logger.log_debug("get_high_critical_threshold for {} failed due to {}".format(self.name, hint)) + return None + return super(RemovableThermal, self).get_high_critical_threshold() diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/thermal_actions.py b/platform/mellanox/mlnx-platform-api/sonic_platform/thermal_actions.py index e7436bd0a5b7..bada4476d4c2 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/thermal_actions.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/thermal_actions.py @@ -1,6 +1,22 @@ +# +# Copyright (c) 2020-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# from sonic_platform_base.sonic_thermal_control.thermal_action_base import ThermalPolicyActionBase from sonic_platform_base.sonic_thermal_control.thermal_json_object import thermal_json_object -from .thermal import logger +from .thermal import Thermal class SetFanSpeedAction(ThermalPolicyActionBase): @@ -48,162 +64,48 @@ def execute(self, thermal_info_dict): :param thermal_info_dict: A dictionary stores all thermal information. :return: """ - from .thermal_infos import FanInfo - if FanInfo.INFO_NAME in thermal_info_dict and isinstance(thermal_info_dict[FanInfo.INFO_NAME], FanInfo): - fan_info_obj = thermal_info_dict[FanInfo.INFO_NAME] - for fan in fan_info_obj.get_presence_fans(): - fan.set_speed(self.speed) - logger.log_info('Set all system FAN speed to {}'.format(self.speed)) - - SetAllFanSpeedAction.set_psu_fan_speed(thermal_info_dict, self.speed) - - @classmethod - def set_psu_fan_speed(cls, thermal_info_dict, speed): - from .thermal_infos import ChassisInfo - if ChassisInfo.INFO_NAME in thermal_info_dict and isinstance(thermal_info_dict[ChassisInfo.INFO_NAME], ChassisInfo): - chassis = thermal_info_dict[ChassisInfo.INFO_NAME].get_chassis() - for psu in chassis.get_all_psus(): - for psu_fan in psu.get_all_fans(): - psu_fan.set_speed(speed) - - -@thermal_json_object('fan.all.check_and_set_speed') -class CheckAndSetAllFanSpeedAction(SetAllFanSpeedAction): - """ - Action to check thermal zone temperature and recover speed for all fans - """ - def execute(self, thermal_info_dict): - """ - Check thermal zone and set speed for all fans - :param thermal_info_dict: A dictionary stores all thermal information. - :return: - """ - from .thermal import Thermal - if Thermal.check_thermal_zone_temperature(): - SetAllFanSpeedAction.execute(self, thermal_info_dict) - - -@thermal_json_object('thermal_control.control') -class ControlThermalAlgoAction(ThermalPolicyActionBase): - """ - Action to control the thermal control algorithm - """ - # JSON field definition - JSON_FIELD_STATUS = 'status' - - def __init__(self): - self.status = True - - def load_from_json(self, json_obj): - """ - Construct ControlThermalAlgoAction via JSON. JSON example: - { - "type": "thermal_control.control" - "status": "true" - } - :param json_obj: A JSON object representing a ControlThermalAlgoAction action. - :return: - """ - if ControlThermalAlgoAction.JSON_FIELD_STATUS in json_obj: - status_str = json_obj[ControlThermalAlgoAction.JSON_FIELD_STATUS].lower() - if status_str == 'true': - self.status = True - elif status_str == 'false': - self.status = False - else: - raise ValueError('Invalid {} field value, please specify true of false'. - format(ControlThermalAlgoAction.JSON_FIELD_STATUS)) - else: - raise ValueError('ControlThermalAlgoAction ' - 'missing mandatory field {} in JSON policy file'. - format(ControlThermalAlgoAction.JSON_FIELD_STATUS)) - - def execute(self, thermal_info_dict): - """ - Disable thermal control algorithm - :param thermal_info_dict: A dictionary stores all thermal information. - :return: - """ - from .thermal_infos import FanInfo - from .thermal import Thermal - from .thermal_conditions import UpdateCoolingLevelToMinCondition - from .fan import Fan - status_changed = Thermal.set_thermal_algorithm_status(self.status, False) - - # Only update cooling level if thermal algorithm status changed - if status_changed: - if self.status: - # Check thermal zone temperature, if all thermal zone temperature - # back to normal, set it to minimum allowed speed to - # save power - UpdateCoolingLevelToMinAction.update_cooling_level_to_minimum(thermal_info_dict) - - logger.log_info('Changed thermal algorithm status to {}'.format(self.status)) + Thermal.set_expect_cooling_level(self.speed / 10) @thermal_json_object('thermal.recover') class ThermalRecoverAction(ThermalPolicyActionBase): - def execute(self, thermal_info_dict): - UpdateCoolingLevelToMinAction.update_cooling_level_to_minimum(thermal_info_dict) - - -class ChangeMinCoolingLevelAction(ThermalPolicyActionBase): UNKNOWN_SKU_COOLING_LEVEL = 6 - def execute(self, thermal_info_dict): - from .device_data import DEVICE_DATA - from .fan import Fan - from .thermal_infos import ChassisInfo - from .thermal_conditions import MinCoolingLevelChangeCondition - from .thermal_conditions import UpdateCoolingLevelToMinCondition - chassis = thermal_info_dict[ChassisInfo.INFO_NAME].get_chassis() - if chassis.platform_name not in DEVICE_DATA or 'thermal' not in DEVICE_DATA[chassis.platform_name] or 'minimum_table' not in DEVICE_DATA[chassis.platform_name]['thermal']: - Fan.min_cooling_level = ChangeMinCoolingLevelAction.UNKNOWN_SKU_COOLING_LEVEL + def execute(self, thermal_info_dict): + from .device_data import DeviceDataManager + from .thermal import MAX_COOLING_LEVEL, MIN_COOLING_LEVEL_FOR_HIGH, logger + Thermal.monitor_asic_themal_zone() + + # Calculate dynamic minimum cooling level + dynamic_min_cooling_level = None + minimum_table = DeviceDataManager.get_minimum_table() + if not minimum_table: + # If there is no minimum_table defined, set dynamic_min_cooling_level to default value + dynamic_min_cooling_level = ThermalRecoverAction.UNKNOWN_SKU_COOLING_LEVEL else: - trust_state = MinCoolingLevelChangeCondition.trust_state - temperature = MinCoolingLevelChangeCondition.temperature - minimum_table = DEVICE_DATA[chassis.platform_name]['thermal']['minimum_table']['unk_{}'.format(trust_state)] + trust_state = Thermal.check_module_temperature_trustable() + temperature = Thermal.get_min_amb_temperature() + temperature = int(temperature / 1000) + minimum_table = minimum_table['unk_{}'.format(trust_state)] for key, cooling_level in minimum_table.items(): temp_range = key.split(':') temp_min = int(temp_range[0].strip()) temp_max = int(temp_range[1].strip()) if temp_min <= temperature <= temp_max: - Fan.min_cooling_level = cooling_level - 10 + dynamic_min_cooling_level = cooling_level - 10 break - - current_cooling_level = Fan.get_cooling_level() - if current_cooling_level < Fan.min_cooling_level: - Fan.set_cooling_level(Fan.min_cooling_level, Fan.min_cooling_level) - SetAllFanSpeedAction.set_psu_fan_speed(thermal_info_dict, Fan.min_cooling_level * 10) - else: - Fan.set_cooling_level(Fan.min_cooling_level, current_cooling_level) - UpdateCoolingLevelToMinAction.update_cooling_level_to_minimum(thermal_info_dict) + if not dynamic_min_cooling_level: + # Should not go to this branch, just in case + logger.log_error('Failed to get dynamic minimum cooling level') + dynamic_min_cooling_level = MAX_COOLING_LEVEL -class UpdatePsuFanSpeedAction(ThermalPolicyActionBase): - def execute(self, thermal_info_dict): - from .thermal_conditions import CoolingLevelChangeCondition - SetAllFanSpeedAction.set_psu_fan_speed(thermal_info_dict, CoolingLevelChangeCondition.cooling_level * 10) - - -class UpdateCoolingLevelToMinAction(ThermalPolicyActionBase): - def execute(self, thermal_info_dict): - self.update_cooling_level_to_minimum(thermal_info_dict) - - @classmethod - def update_cooling_level_to_minimum(cls, thermal_info_dict): - from .fan import Fan - from .thermal import Thermal - from .thermal_conditions import UpdateCoolingLevelToMinCondition - from .thermal_infos import FanInfo - if Thermal.check_thermal_zone_temperature(): - fan_info_obj = thermal_info_dict[FanInfo.INFO_NAME] - speed = Fan.min_cooling_level * 10 - for fan in fan_info_obj.get_presence_fans(): - fan.set_speed(speed) - SetAllFanSpeedAction.set_psu_fan_speed(thermal_info_dict, speed) - UpdateCoolingLevelToMinCondition.enable = False + if Thermal.last_set_cooling_level is not None and dynamic_min_cooling_level > Thermal.last_set_cooling_level and dynamic_min_cooling_level >= MIN_COOLING_LEVEL_FOR_HIGH: + # No need to check thermal zone as dynamic_min_cooling_level is greater than previous value and MIN_COOLING_LEVEL_FOR_HIGH + Thermal.set_expect_cooling_level(dynamic_min_cooling_level) else: - UpdateCoolingLevelToMinCondition.enable = True - + min_cooling_level_by_tz = Thermal.get_min_allowed_cooling_level_by_thermal_zone() + if min_cooling_level_by_tz is not None: + cooling_level = max(dynamic_min_cooling_level, min_cooling_level_by_tz) + Thermal.set_expect_cooling_level(cooling_level) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/thermal_conditions.py b/platform/mellanox/mlnx-platform-api/sonic_platform/thermal_conditions.py index a682061d12a8..24a22c41019b 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/thermal_conditions.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/thermal_conditions.py @@ -1,3 +1,19 @@ +# +# Copyright (c) 2020-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# from sonic_platform_base.sonic_thermal_control.thermal_condition_base import ThermalPolicyConditionBase from sonic_platform_base.sonic_thermal_control.thermal_json_object import thermal_json_object @@ -74,53 +90,3 @@ class AllPsuPresenceCondition(PsuCondition): def is_match(self, thermal_info_dict): psu_info_obj = self.get_psu_info(thermal_info_dict) return len(psu_info_obj.get_absence_psus()) == 0 if psu_info_obj else False - - -class MinCoolingLevelChangeCondition(ThermalPolicyConditionBase): - trust_state = None - temperature = None - - def is_match(self, thermal_info_dict): - from .thermal import Thermal - - trust_state = Thermal.check_module_temperature_trustable() - temperature = Thermal.get_min_amb_temperature() - temperature = int(temperature / 1000) - - change_cooling_level = False - if trust_state != MinCoolingLevelChangeCondition.trust_state: - MinCoolingLevelChangeCondition.trust_state = trust_state - change_cooling_level = True - - if temperature != MinCoolingLevelChangeCondition.temperature: - MinCoolingLevelChangeCondition.temperature = temperature - change_cooling_level = True - - return change_cooling_level - - -class CoolingLevelChangeCondition(ThermalPolicyConditionBase): - cooling_level = None - - def is_match(self, thermal_info_dict): - from .fan import Fan - current_cooling_level = Fan.get_cooling_level() - if current_cooling_level != CoolingLevelChangeCondition.cooling_level: - CoolingLevelChangeCondition.cooling_level = current_cooling_level - return True - else: - return False - - -class UpdateCoolingLevelToMinCondition(ThermalPolicyConditionBase): - enable = False - def is_match(self, thermal_info_dict): - if not UpdateCoolingLevelToMinCondition.enable: - return False - - from .fan import Fan - current_cooling_level = Fan.get_cooling_level() - if current_cooling_level == Fan.min_cooling_level: - UpdateCoolingLevelToMinCondition.enable = False - return False - return True diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/thermal_infos.py b/platform/mellanox/mlnx-platform-api/sonic_platform/thermal_infos.py index df262557c417..f44afe735ab2 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/thermal_infos.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/thermal_infos.py @@ -1,3 +1,19 @@ +# +# Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# from sonic_platform_base.sonic_thermal_control.thermal_info_base import ThermalPolicyInfoBase from sonic_platform_base.sonic_thermal_control.thermal_json_object import thermal_json_object @@ -45,7 +61,7 @@ def collect(self, chassis): elif status and fan in self._fault_fans: self._fault_fans.remove(fan) self._status_changed = True - + def get_absence_fans(self): """ @@ -96,12 +112,12 @@ def collect(self, chassis): """ self._status_changed = False for psu in chassis.get_all_psus(): - if psu.get_presence() and psu.get_powergood_status() and psu not in self._presence_psus: + if psu.get_presence() and psu not in self._presence_psus: self._presence_psus.add(psu) self._status_changed = True if psu in self._absence_psus: self._absence_psus.remove(psu) - elif (not psu.get_presence() or not psu.get_powergood_status()) and psu not in self._absence_psus: + elif (not psu.get_presence()) and psu not in self._absence_psus: self._absence_psus.add(psu) self._status_changed = True if psu in self._presence_psus: diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/thermal_manager.py b/platform/mellanox/mlnx-platform-api/sonic_platform/thermal_manager.py index c2acf49a2245..dcdd25e90635 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/thermal_manager.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/thermal_manager.py @@ -1,20 +1,30 @@ -import os +# +# Copyright (c) 2020-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# from sonic_platform_base.sonic_thermal_control.thermal_manager_base import ThermalManagerBase -from sonic_platform_base.sonic_thermal_control.thermal_policy import ThermalPolicy +from .cpu_thermal_control import CPUThermalControl +from .device_data import DeviceDataManager from .thermal_actions import * from .thermal_conditions import * from .thermal_infos import * +from .thermal import logger, MAX_COOLING_LEVEL, Thermal class ThermalManager(ThermalManagerBase): - @classmethod - def initialize(cls): - """ - Initialize thermal manager, including register thermal condition types and thermal action types - and any other vendor specific initialization. - :return: - """ - cls._add_private_thermal_policy() + cpu_thermal_control = None @classmethod def start_thermal_control_algorithm(cls): @@ -22,9 +32,8 @@ def start_thermal_control_algorithm(cls): Start thermal control algorithm Returns: - bool: True if set success, False if fail. + bool: True if set success, False if fail. """ - from .thermal import Thermal Thermal.set_thermal_algorithm_status(True) @classmethod @@ -33,24 +42,54 @@ def stop_thermal_control_algorithm(cls): Stop thermal control algorithm Returns: - bool: True if set success, False if fail. + bool: True if set success, False if fail. """ - from .thermal import Thermal Thermal.set_thermal_algorithm_status(False) @classmethod - def _add_private_thermal_policy(cls): - dynamic_min_speed_policy = ThermalPolicy() - dynamic_min_speed_policy.conditions[MinCoolingLevelChangeCondition] = MinCoolingLevelChangeCondition() - dynamic_min_speed_policy.actions[ChangeMinCoolingLevelAction] = ChangeMinCoolingLevelAction() - cls._policy_dict['DynamicMinCoolingLevelPolicy'] = dynamic_min_speed_policy - - update_psu_fan_speed_policy = ThermalPolicy() - update_psu_fan_speed_policy.conditions[CoolingLevelChangeCondition] = CoolingLevelChangeCondition() - update_psu_fan_speed_policy.actions[UpdatePsuFanSpeedAction] = UpdatePsuFanSpeedAction() - cls._policy_dict['UpdatePsuFanSpeedPolicy'] = update_psu_fan_speed_policy - - update_cooling_level_policy = ThermalPolicy() - update_cooling_level_policy.conditions[UpdateCoolingLevelToMinCondition] = UpdateCoolingLevelToMinCondition() - update_cooling_level_policy.actions[UpdateCoolingLevelToMinAction] = UpdateCoolingLevelToMinAction() - cls._policy_dict['UpdateCoolingLevelPolicy'] = update_cooling_level_policy + def start_cpu_thermal_control_algoritm(cls): + if cls.cpu_thermal_control: + return + + if not DeviceDataManager.is_cpu_thermal_control_supported(): + return + + cls.cpu_thermal_control = CPUThermalControl() + cls.cpu_thermal_control.task_run() + + @classmethod + def stop_cpu_thermal_control_algoritm(cls): + if cls.cpu_thermal_control: + cls.cpu_thermal_control.task_stop() + cls.cpu_thermal_control = None + + @classmethod + def run_policy(cls, chassis): + if cls._running: + cls.start_cpu_thermal_control_algoritm() + else: + cls.stop_cpu_thermal_control_algoritm() + + if not cls._policy_dict: + return + + try: + cls._collect_thermal_information(chassis) + except Exception as e: + logger.log_error('Failed to collect thermal information {}'.format(repr(e))) + Thermal.set_expect_cooling_level(MAX_COOLING_LEVEL) + Thermal.commit_cooling_level(cls._thermal_info_dict) + return + + for policy in cls._policy_dict.values(): + if not cls._running: + return + try: + if policy.is_match(cls._thermal_info_dict): + policy.do_action(cls._thermal_info_dict) + except Exception as e: + logger.log_error('Failed to run thermal policy {} - {}'.format(policy.name, repr(e))) + # In case there is an exception, we put cooling level to max value + Thermal.set_expect_cooling_level(MAX_COOLING_LEVEL) + + Thermal.commit_cooling_level(cls._thermal_info_dict) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py b/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py index cee6d27b63fa..0650d9af1a1c 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/utils.py @@ -1,22 +1,42 @@ +# +# Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# import functools import subprocess +from sonic_py_common.logger import Logger -# flags to indicate whether this process is running in docker or host -_is_host = None +logger = Logger() -def read_str_from_file(file_path, default='', raise_exception=False): +def read_from_file(file_path, target_type, default='', raise_exception=False, log_func=logger.log_error): """ - Read string content from file + Read content from file and convert to target type :param file_path: File path + :param target_type: target type :param default: Default return value if any exception occur :param raise_exception: Raise exception to caller if True else just return default value + :param log_func: function to log the error :return: String content of the file """ try: with open(file_path, 'r') as f: - value = f.read().strip() + value = target_type(f.read().strip()) except (ValueError, IOError) as e: + if log_func: + log_func('Failed to read from file {} - {}'.format(file_path, repr(e))) if not raise_exception: value = default else: @@ -25,27 +45,65 @@ def read_str_from_file(file_path, default='', raise_exception=False): return value -def read_int_from_file(file_path, default=0, raise_exception=False): +def read_str_from_file(file_path, default='', raise_exception=False, log_func=logger.log_error): + """ + Read string content from file + :param file_path: File path + :param default: Default return value if any exception occur + :param raise_exception: Raise exception to caller if True else just return default value + :param log_func: function to log the error + :return: String content of the file + """ + return read_from_file(file_path=file_path, target_type=str, default=default, raise_exception=raise_exception, log_func=log_func) + + +def read_int_from_file(file_path, default=0, raise_exception=False, log_func=logger.log_error): """ Read content from file and cast it to integer :param file_path: File path :param default: Default return value if any exception occur :param raise_exception: Raise exception to caller if True else just return default value + :param log_func: function to log the error :return: Integer value of the file content """ - try: - with open(file_path, 'r') as f: - value = int(f.read().strip()) - except (ValueError, IOError) as e: - if not raise_exception: - value = default - else: - raise e + return read_from_file(file_path=file_path, target_type=int, default=default, raise_exception=raise_exception, log_func=log_func) - return value + +def read_float_from_file(file_path, default=0.0, raise_exception=False, log_func=logger.log_error): + """ + Read content from file and cast it to integer + :param file_path: File path + :param default: Default return value if any exception occur + :param raise_exception: Raise exception to caller if True else just return default value + :param log_func: function to log the error + :return: Integer value of the file content + """ + return read_from_file(file_path=file_path, target_type=float, default=default, raise_exception=raise_exception, log_func=log_func) + + +def _key_value_converter(content): + ret = {} + for line in content.splitlines(): + k,v = line.split(':') + ret[k.strip()] = v.strip() + return ret + + +def read_key_value_file(file_path, default={}, raise_exception=False, log_func=logger.log_error): + """Read file content and parse the content to a dict. The file content should like: + key1:value1 + key2:value2 + + Args: + file_path (str): file path + default (dict, optional): default return value. Defaults to {}. + raise_exception (bool, optional): If exception should be raised or hiden. Defaults to False. + log_func (optional): logger function.. Defaults to logger.log_error. + """ + return read_from_file(file_path=file_path, target_type=_key_value_converter, default=default, raise_exception=raise_exception, log_func=log_func) -def write_file(file_path, content, raise_exception=False): +def write_file(file_path, content, raise_exception=False, log_func=logger.log_error): """ Write the given value to a file :param file_path: File path @@ -57,6 +115,8 @@ def write_file(file_path, content, raise_exception=False): with open(file_path, 'w') as f: f.write(str(content)) except (ValueError, IOError) as e: + if log_func: + log_func('Failed to write {} to file {} - {}'.format(content, file_path, repr(e))) if not raise_exception: return False else: @@ -64,16 +124,50 @@ def write_file(file_path, content, raise_exception=False): return True +def pre_initialize(init_func): + def decorator(method): + @functools.wraps(method) + def _impl(self, *args, **kwargs): + init_func(self) + return method(self, *args, **kwargs) + return _impl + return decorator + + +def pre_initialize_one(init_func): + def decorator(method): + @functools.wraps(method) + def _impl(self, index): + init_func(self, index) + return method(self, index) + return _impl + return decorator + + +def read_only_cache(): + """Decorator to cache return value for a method/function once. + This decorator should be used for method/function when: + 1. Executing the method/function takes time. e.g. reading sysfs. + 2. The return value of this method/function never changes. + """ + def decorator(method): + method.return_value = None + + @functools.wraps(method) + def _impl(*args, **kwargs): + if not method.return_value: + method.return_value = method(*args, **kwargs) + return method.return_value + return _impl + return decorator + + +@read_only_cache() def is_host(): """ Test whether current process is running on the host or an docker return True for host and False for docker - """ - global _is_host - if _is_host is not None: - return _is_host - - _is_host = False + """ try: proc = subprocess.Popen("docker --version 2>/dev/null", stdout=subprocess.PIPE, @@ -83,22 +177,20 @@ def is_host(): stdout = proc.communicate()[0] proc.wait() result = stdout.rstrip('\n') - if result != '': - _is_host = True - + return result != '' except OSError as e: - pass - - return _is_host + return False -def default_return(return_value): +def default_return(return_value, log_func=logger.log_debug): def wrapper(method): @functools.wraps(method) def _impl(*args, **kwargs): try: return method(*args, **kwargs) - except: + except Exception as e: + if log_func: + log_func('Faield to execute method {} - {}'.format(method.__name__, repr(e))) return return_value return _impl return wrapper diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/vpd_parser.py b/platform/mellanox/mlnx-platform-api/sonic_platform/vpd_parser.py new file mode 100644 index 000000000000..ea66234e4bff --- /dev/null +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/vpd_parser.py @@ -0,0 +1,84 @@ +# +# Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +from sonic_py_common.logger import Logger + +from . import utils + +logger = Logger() +SN_VPD_FIELD = "SN_VPD_FIELD" +PN_VPD_FIELD = "PN_VPD_FIELD" +REV_VPD_FIELD = "REV_VPD_FIELD" + + +class VpdParser: + def __init__(self, file_path): + self.vpd_data = {} + self.vpd_file = file_path + self.vpd_file_last_mtime = None + + def _get_data(self): + if not os.path.exists(self.vpd_file): + self.vpd_data = {} + return False + + try: + mtime = os.stat(self.vpd_file).st_mtime + if mtime != self.vpd_file_last_mtime: + self.vpd_file_last_mtime = mtime + self.vpd_data = utils.read_key_value_file(self.vpd_file) + return True + except Exception as e: + self.vpd_data = {} + return False + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + + Returns: + string: Model/part number of device + """ + if self._get_data() and PN_VPD_FIELD not in self.vpd_data: + logger.log_error("Fail to read model number: No key {} in VPD {}".format(PN_VPD_FIELD, self.vpd_file)) + return 'N/A' + return self.vpd_data.get(PN_VPD_FIELD, 'N/A') + + def get_serial(self): + """ + Retrieves the serial number of the device + + Returns: + string: Serial number of device + """ + if self._get_data() and SN_VPD_FIELD not in self.vpd_data: + logger.log_error("Fail to read serial number: No key {} in VPD {}".format(SN_VPD_FIELD, self.vpd_file)) + return 'N/A' + return self.vpd_data.get(SN_VPD_FIELD, 'N/A') + + def get_revision(self): + """ + Retrieves the hardware revision of the device + + Returns: + string: Revision value of device + """ + if self._get_data() and REV_VPD_FIELD not in self.vpd_data: + logger.log_error("Fail to read revision: No key {} in VPD {}".format(REV_VPD_FIELD, self.vpd_file)) + return 'N/A' + return self.vpd_data.get(REV_VPD_FIELD, 'N/A') diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/watchdog.py b/platform/mellanox/mlnx-platform-api/sonic_platform/watchdog.py index 0737b0446671..879aabfd3530 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/watchdog.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/watchdog.py @@ -1,3 +1,19 @@ +# +# Copyright (c) 2019-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# """ Mellanox diff --git a/platform/mellanox/mlnx-platform-api/tests/__init__.py b/platform/mellanox/mlnx-platform-api/tests/__init__.py index e69de29bb2d1..9afd76ba9fd9 100644 --- a/platform/mellanox/mlnx-platform-api/tests/__init__.py +++ b/platform/mellanox/mlnx-platform-api/tests/__init__.py @@ -0,0 +1,16 @@ +# +# Copyright (c) 2017-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/platform/mellanox/mlnx-platform-api/tests/conftest.py b/platform/mellanox/mlnx-platform-api/tests/conftest.py new file mode 100644 index 000000000000..b69fdd6c75f0 --- /dev/null +++ b/platform/mellanox/mlnx-platform-api/tests/conftest.py @@ -0,0 +1,55 @@ +# +# Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +import pytest +import sys + +test_path = os.path.dirname(os.path.abspath(__file__)) +modules_path = os.path.dirname(test_path) +sys.path.insert(0, modules_path) + +os.environ["PLATFORM_API_UNIT_TESTING"] = "1" + +from sonic_platform import utils + +@pytest.fixture(scope='function', autouse=True) +def auto_recover_mock(): + """Auto used fixture to recover some critical mocked functions + """ + origin_os_path_exists = os.path.exists + origin_read_int_from_file = utils.read_int_from_file + origin_read_str_from_file = utils.read_str_from_file + origin_read_float_from_file = utils.read_float_from_file + origin_write_file = utils.write_file + yield + os.path.exists = origin_os_path_exists + utils.read_int_from_file = origin_read_int_from_file + utils.read_str_from_file = origin_read_str_from_file + utils.write_file = origin_write_file + utils.read_float_from_file = origin_read_float_from_file + + +@pytest.fixture(scope='function', autouse=True) +def auto_reset_cooling_level(): + from sonic_platform.thermal import Thermal + yield + Thermal.expect_cooling_level = None + Thermal.expect_cooling_state = None + Thermal.last_set_cooling_level = None + Thermal.last_set_cooling_state = None + Thermal.last_set_psu_cooling_level = None diff --git a/platform/mellanox/mlnx-platform-api/tests/input_platform/__init__.py b/platform/mellanox/mlnx-platform-api/tests/input_platform/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/mellanox/mlnx-platform-api/tests/input_platform/output_sfp.py b/platform/mellanox/mlnx-platform-api/tests/input_platform/output_sfp.py new file mode 100644 index 000000000000..20a09d1b54f6 --- /dev/null +++ b/platform/mellanox/mlnx-platform-api/tests/input_platform/output_sfp.py @@ -0,0 +1,55 @@ +""" +module holding the correct values for the sfp_test.py +""" + +read_eeprom_output = """ +Sending access register... +Field Name | Data +=================================== +status | 0x00000000 +slot_index | 0x00000000 +module | 0x00000001 +l | 0x00000000 +device_address | 0x000000a8 +page_number | 0x00000000 +i2c_device_address | 0x00000050 +size | 0x00000010 +bank_number | 0x00000000 +dword[0] | 0x43414331 +dword[1] | 0x31353332 +dword[2] | 0x31503250 +dword[3] | 0x41324d53 +dword[4] | 0x00000000 +dword[5] | 0x00000000 +dword[6] | 0x00000000 +dword[7] | 0x00000000 +dword[8] | 0x00000000 +dword[9] | 0x00000000 +dword[10] | 0x00000000 +dword[11] | 0x00000000 +dword[12] | 0x00000000 +dword[13] | 0x00000000 +dword[14] | 0x00000000 +dword[15] | 0x00000000 +dword[16] | 0x00000000 +dword[17] | 0x00000000 +dword[18] | 0x00000000 +dword[19] | 0x00000000 +dword[20] | 0x00000000 +dword[21] | 0x00000000 +dword[22] | 0x00000000 +dword[23] | 0x00000000 +dword[24] | 0x00000000 +dword[25] | 0x00000000 +dword[26] | 0x00000000 +dword[27] | 0x00000000 +dword[28] | 0x00000000 +dword[29] | 0x00000000 +dword[30] | 0x00000000 +dword[31] | 0x00000000 +=================================== +""" + +y_cable_part_number = "CAC115321P2PA2MS" +write_eeprom_dword1 = "dword[0]=0x01020304" +write_eeprom_dword2 = "dword[0]=0x01020304,dword[1]=0x05060000" diff --git a/platform/mellanox/mlnx-platform-api/tests/mock_eeprom_data b/platform/mellanox/mlnx-platform-api/tests/mock_eeprom_data new file mode 100644 index 000000000000..b8b939944f26 Binary files /dev/null and b/platform/mellanox/mlnx-platform-api/tests/mock_eeprom_data differ diff --git a/platform/mellanox/mlnx-platform-api/tests/mock_platform.py b/platform/mellanox/mlnx-platform-api/tests/mock_platform.py index 1cd8f89d4805..044f26c01dbe 100644 --- a/platform/mellanox/mlnx-platform-api/tests/mock_platform.py +++ b/platform/mellanox/mlnx-platform-api/tests/mock_platform.py @@ -1,3 +1,19 @@ +# +# Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# class MockFan: speed = 60 def __init__(self): diff --git a/platform/mellanox/mlnx-platform-api/tests/mock_psu_vpd b/platform/mellanox/mlnx-platform-api/tests/mock_psu_vpd new file mode 100644 index 000000000000..4b8d4aa855fb --- /dev/null +++ b/platform/mellanox/mlnx-platform-api/tests/mock_psu_vpd @@ -0,0 +1,10 @@ +SN_VPD_FIELD: MT1946X07684 +EFT_REV: 1 +PN_VPD_FIELD: MTEF-PSF-AC-C +REV_VPD_FIELD: A3 +MFG_DATE_FIELD: 1B94BF +MFR_NAME: DELTA +FEED: AC/DC +CAPACITY: 1100 +MAX_RPM:23000 +MIN_RPM:4600 diff --git a/platform/mellanox/mlnx-platform-api/tests/policy_with_same_conditions.json b/platform/mellanox/mlnx-platform-api/tests/policy_with_same_conditions.json index ace291be1c55..9efe773a9b07 100644 --- a/platform/mellanox/mlnx-platform-api/tests/policy_with_same_conditions.json +++ b/platform/mellanox/mlnx-platform-api/tests/policy_with_same_conditions.json @@ -27,8 +27,7 @@ ], "actions": [ { - "type": "thermal_control.control", - "status": "false" + "type": "thermal.recover" }, { "type": "fan.all.set_speed", @@ -45,8 +44,7 @@ ], "actions": [ { - "type": "thermal_control.control", - "status": "false" + "type": "thermal.recover" }, { "type": "fan.all.set_speed", @@ -66,8 +64,7 @@ ], "actions": [ { - "type": "thermal_control.control", - "status": "true" + "type": "thermal.recover" } ] } diff --git a/platform/mellanox/mlnx-platform-api/tests/test_chassis.py b/platform/mellanox/mlnx-platform-api/tests/test_chassis.py new file mode 100644 index 000000000000..a7eff5b08625 --- /dev/null +++ b/platform/mellanox/mlnx-platform-api/tests/test_chassis.py @@ -0,0 +1,269 @@ +# +# Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +import sys + +from mock import MagicMock +if sys.version_info.major == 3: + from unittest import mock +else: + import mock + +test_path = os.path.dirname(os.path.abspath(__file__)) +modules_path = os.path.dirname(test_path) +sys.path.insert(0, modules_path) + +from sonic_platform.chassis import Chassis +from sonic_platform.device_data import DeviceDataManager + + +class TestChassis: + """Test class to test chassis.py. The test cases covers: + 1. PSU related API + 2. Fan drawer related API + 3. SFP related API (Except modular chassis SFP related API) + 4. Reboot cause related API + + Thermal, Eeprom, Watchdog, Component, System LED related API will be tested in seperate class + """ + @classmethod + def setup_class(cls): + os.environ["MLNX_PLATFORM_API_UNIT_TESTING"] = "1" + + def test_psu(self): + from sonic_platform.psu import Psu, FixedPsu + # Test creating hot swapable PSU + DeviceDataManager.get_psu_count = mock.MagicMock(return_value=2) + DeviceDataManager.is_psu_hotswapable = mock.MagicMock(return_value=True) + chassis = Chassis() + chassis.initialize_psu() + assert len(chassis._psu_list) == 2 + assert len(list(filter(lambda x: isinstance(x, Psu) ,chassis._psu_list))) == 2 + + # Test creating fixed PSU + DeviceDataManager.get_psu_count = mock.MagicMock(return_value=3) + DeviceDataManager.is_psu_hotswapable = mock.MagicMock(return_value=False) + chassis._psu_list = [] + chassis.initialize_psu() + assert len(chassis._psu_list) == 3 + assert len(list(filter(lambda x: isinstance(x, FixedPsu) ,chassis._psu_list))) == 3 + + # Test chassis.get_all_psus + chassis._psu_list = [] + psu_list = chassis.get_all_psus() + assert len(psu_list) == 3 + + # Test chassis.get_psu + chassis._psu_list = [] + psu = chassis.get_psu(0) + assert psu and isinstance(psu, FixedPsu) + psu = chassis.get_psu(3) + assert psu is None + + # Test chassis.get_num_psus + chassis._psu_list = [] + assert chassis.get_num_psus() == 3 + + def test_fan(self): + from sonic_platform.fan_drawer import RealDrawer, VirtualDrawer + + # Test creating fixed fan + DeviceDataManager.is_fan_hotswapable = mock.MagicMock(return_value=False) + assert DeviceDataManager.get_fan_drawer_count() == 1 + DeviceDataManager.get_fan_count = mock.MagicMock(return_value=4) + chassis = Chassis() + chassis.initialize_fan() + assert len(chassis._fan_drawer_list) == 1 + assert len(list(filter(lambda x: isinstance(x, VirtualDrawer) ,chassis._fan_drawer_list))) == 1 + assert chassis.get_fan_drawer(0).get_num_fans() == 4 + + # Test creating hot swapable fan + DeviceDataManager.get_fan_drawer_count = mock.MagicMock(return_value=2) + DeviceDataManager.get_fan_count = mock.MagicMock(return_value=4) + DeviceDataManager.is_fan_hotswapable = mock.MagicMock(return_value=True) + chassis._fan_drawer_list = [] + chassis.initialize_fan() + assert len(chassis._fan_drawer_list) == 2 + assert len(list(filter(lambda x: isinstance(x, RealDrawer) ,chassis._fan_drawer_list))) == 2 + assert chassis.get_fan_drawer(0).get_num_fans() == 2 + assert chassis.get_fan_drawer(1).get_num_fans() == 2 + + # Test chassis.get_all_fan_drawers + chassis._fan_drawer_list = [] + assert len(chassis.get_all_fan_drawers()) == 2 + + # Test chassis.get_fan_drawer + chassis._fan_drawer_list = [] + fan_drawer = chassis.get_fan_drawer(0) + assert fan_drawer and isinstance(fan_drawer, RealDrawer) + fan_drawer = chassis.get_fan_drawer(2) + assert fan_drawer is None + + # Test chassis.get_num_fan_drawers + chassis._fan_drawer_list = [] + assert chassis.get_num_fan_drawers() == 2 + + def test_sfp(self): + # Test get_num_sfps, it should not create any SFP objects + DeviceDataManager.get_sfp_count = mock.MagicMock(return_value=3) + chassis = Chassis() + assert chassis.get_num_sfps() == 3 + assert len(chassis._sfp_list) == 0 + + # Index out of bound, return None + sfp = chassis.get_sfp(4) + assert sfp is None + assert len(chassis._sfp_list) == 0 + + # Get one SFP, other SFP list should be initialized to None + sfp = chassis.get_sfp(1) + assert sfp is not None + assert len(chassis._sfp_list) == 3 + assert chassis._sfp_list[1] is None + assert chassis._sfp_list[2] is None + assert chassis.sfp_initialized_count == 1 + + # Get the SFP again, no new SFP created + sfp1 = chassis.get_sfp(1) + assert id(sfp) == id(sfp1) + + # Get another SFP, sfp_initialized_count increase + sfp2 = chassis.get_sfp(2) + assert sfp2 is not None + assert chassis._sfp_list[2] is None + assert chassis.sfp_initialized_count == 2 + + # Get all SFPs, but there are SFP already created, only None SFP created + sfp_list = chassis.get_all_sfps() + assert len(sfp_list) == 3 + assert chassis.sfp_initialized_count == 3 + assert list(filter(lambda x: x is not None, sfp_list)) + assert id(sfp1) == id(sfp_list[0]) + assert id(sfp2) == id(sfp_list[1]) + + # Get all SFPs, no SFP yet, all SFP created + chassis._sfp_list = [] + chassis.sfp_initialized_count = 0 + sfp_list = chassis.get_all_sfps() + assert len(sfp_list) == 3 + assert chassis.sfp_initialized_count == 3 + + @mock.patch('sonic_platform.sfp_event.sfp_event.check_sfp_status', MagicMock()) + @mock.patch('sonic_platform.sfp_event.sfp_event.__init__', MagicMock(return_value=None)) + @mock.patch('sonic_platform.sfp_event.sfp_event.initialize', MagicMock()) + @mock.patch('sonic_platform.device_data.DeviceDataManager.get_sfp_count', MagicMock(return_value=3)) + def test_change_event(self): + from sonic_platform.sfp_event import sfp_event + from sonic_platform.sfp import SFP + + return_port_dict = {1: '1'} + def mock_check_sfp_status(self, port_dict, error_dict, timeout): + port_dict.update(return_port_dict) + return True if port_dict else False + + sfp_event.check_sfp_status = mock_check_sfp_status + chassis = Chassis() + + # Call get_change_event with timeout=0, wait until an event is detected + status, event_dict = chassis.get_change_event() + assert status is True + assert 'sfp' in event_dict and event_dict['sfp'][1] == '1' + assert len(chassis._sfp_list) == 3 + + # Call get_change_event with timeout=1.0 + return_port_dict = {} + status, event_dict = chassis.get_change_event(timeout=1.0) + assert status is True + assert 'sfp' in event_dict and not event_dict['sfp'] + + def test_reboot_cause(self): + from sonic_platform import utils + from sonic_platform.chassis import REBOOT_CAUSE_ROOT + chassis = Chassis() + major, minor = chassis.get_reboot_cause() + assert major == chassis.REBOOT_CAUSE_NON_HARDWARE + assert minor == '' + + mock_file_content = {} + def read_int_from_file(file_path, *args, **kwargs): + return mock_file_content[file_path] + + utils.read_int_from_file = read_int_from_file + + for key, value in chassis.reboot_major_cause_dict.items(): + file_path = os.path.join(REBOOT_CAUSE_ROOT, key) + mock_file_content[file_path] = 1 + major, minor = chassis.get_reboot_cause() + assert major == value + assert minor == '' + mock_file_content[file_path] = 0 + + for key, value in chassis.reboot_minor_cause_dict.items(): + file_path = os.path.join(REBOOT_CAUSE_ROOT, key) + mock_file_content[file_path] = 1 + major, minor = chassis.get_reboot_cause() + assert major == chassis.REBOOT_CAUSE_HARDWARE_OTHER + assert minor == value + mock_file_content[file_path] = 0 + + def test_module(self): + from sonic_platform.chassis import ModularChassis + # Test get_num_modules, it should not create any SFP objects + DeviceDataManager.get_linecard_count = mock.MagicMock(return_value=3) + chassis = ModularChassis() + assert chassis.is_modular_chassis() + assert chassis.get_num_modules() == 3 + assert len(chassis._module_list) == 0 + + # Index out of bound, return None + m = chassis.get_module(3) + assert m is None + assert len(chassis._module_list) == 0 + + # Get one Module, other Module in list should be initialized to None + m = chassis.get_module(0) + assert m is not None + assert len(chassis._module_list) == 3 + assert chassis._module_list[1] is None + assert chassis._module_list[2] is None + assert chassis.module_initialized_count == 1 + + # Get the Module again, no new Module created + m1 = chassis.get_module(0) + assert id(m) == id(m1) + + # Get another Module, module_initialized_count increase + m2 = chassis.get_module(1) + assert m2 is not None + assert chassis._module_list[2] is None + assert chassis.module_initialized_count == 2 + + # Get all SFPs, but there are SFP already created, only None SFP created + module_list = chassis.get_all_modules() + assert len(module_list) == 3 + assert chassis.module_initialized_count == 3 + assert list(filter(lambda x: x is not None, module_list)) + assert id(m1) == id(module_list[0]) + assert id(m2) == id(module_list[1]) + + # Get all SFPs, no SFP yet, all SFP created + chassis._module_list = [] + chassis.module_initialized_count = 0 + module_list = chassis.get_all_modules() + assert len(module_list) == 3 + assert chassis.module_initialized_count == 3 diff --git a/platform/mellanox/mlnx-platform-api/tests/test_cpu_thermal_control.py b/platform/mellanox/mlnx-platform-api/tests/test_cpu_thermal_control.py new file mode 100644 index 000000000000..8970e659c0c8 --- /dev/null +++ b/platform/mellanox/mlnx-platform-api/tests/test_cpu_thermal_control.py @@ -0,0 +1,83 @@ +# +# Copyright (c) 2019-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +############################################################################# +# Mellanox +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Chassis information which are available in the platform +# +############################################################################# + +import glob +import os +import pytest +import sys +if sys.version_info.major == 3: + from unittest import mock +else: + import mock + +test_path = os.path.dirname(os.path.abspath(__file__)) +modules_path = os.path.dirname(test_path) +sys.path.insert(0, modules_path) + +from sonic_platform.cpu_thermal_control import CPUThermalControl + + +class TestCPUThermalControl: + @mock.patch('sonic_platform.device_data.DeviceDataManager.get_cpu_thermal_threshold', mock.MagicMock(return_value=(85, 95))) + @mock.patch('sonic_platform.utils.read_int_from_file') + @mock.patch('sonic_platform.utils.write_file') + def test_run(self, mock_write_file, mock_read_file): + instance = CPUThermalControl() + file_content = { + CPUThermalControl.CPU_COOLING_STATE: 5, + CPUThermalControl.CPU_TEMP_FILE: instance.temp_high + 1 + } + + def read_file(file_path, **kwargs): + return file_content[file_path] + + mock_read_file.side_effect = read_file + # Test current temp is higher than high threshold + instance.run(0) + mock_write_file.assert_called_with(CPUThermalControl.CPU_COOLING_STATE, CPUThermalControl.MAX_COOLING_STATE, log_func=None) + + # Test current temp is lower than low threshold + file_content[CPUThermalControl.CPU_TEMP_FILE] = instance.temp_low - 1 + instance.run(0) + mock_write_file.assert_called_with(CPUThermalControl.CPU_COOLING_STATE, CPUThermalControl.MIN_COOLING_STATE, log_func=None) + + # Test current temp increasing + file_content[CPUThermalControl.CPU_TEMP_FILE] = instance.temp_low + instance.run(0) + mock_write_file.assert_called_with(CPUThermalControl.CPU_COOLING_STATE, 6, log_func=None) + + # Test current temp decreasing + instance.run(instance.temp_low + 1) + mock_write_file.assert_called_with(CPUThermalControl.CPU_COOLING_STATE, 4, log_func=None) + + # Test current temp increasing and current cooling state is already the max + file_content[CPUThermalControl.CPU_TEMP_FILE] = 85 + file_content[CPUThermalControl.CPU_COOLING_STATE] = CPUThermalControl.MAX_COOLING_STATE + instance.run(84) + mock_write_file.assert_called_with(CPUThermalControl.CPU_COOLING_STATE, CPUThermalControl.MAX_COOLING_STATE, log_func=None) + + # Test current temp decreasing and current cooling state is already the max + file_content[CPUThermalControl.CPU_COOLING_STATE] = CPUThermalControl.MIN_COOLING_STATE + instance.run(86) + mock_write_file.assert_called_with(CPUThermalControl.CPU_COOLING_STATE, CPUThermalControl.MIN_COOLING_STATE, log_func=None) diff --git a/platform/mellanox/mlnx-platform-api/tests/test_eeprom.py b/platform/mellanox/mlnx-platform-api/tests/test_eeprom.py new file mode 100644 index 000000000000..2797d62a70f3 --- /dev/null +++ b/platform/mellanox/mlnx-platform-api/tests/test_eeprom.py @@ -0,0 +1,108 @@ +# +# Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +import pytest +import sys +if sys.version_info.major == 3: + from unittest.mock import MagicMock, patch +else: + from mock import MagicMock, patch + +test_path = os.path.dirname(os.path.abspath(__file__)) +modules_path = os.path.dirname(test_path) +sys.path.insert(0, modules_path) + +from sonic_platform.chassis import Chassis +from sonic_platform.eeprom import Eeprom, EepromContentVisitor + + +class TestEeprom: + @patch('os.path.exists', MagicMock(return_value=True)) + @patch('os.path.islink', MagicMock(return_value=True)) + @patch('sonic_platform.eeprom.Eeprom.get_system_eeprom_info') + def test_chassis_eeprom(self, mock_eeprom_info): + mock_eeprom_info.return_value = { + hex(Eeprom._TLV_CODE_PRODUCT_NAME): 'MSN3420', + hex(Eeprom._TLV_CODE_PART_NUMBER): 'MSN3420-CB2FO', + hex(Eeprom._TLV_CODE_MAC_BASE): '1C:34:DA:1C:9F:00', + hex(Eeprom._TLV_CODE_SERIAL_NUMBER): 'MT2019X13878' + } + chassis = Chassis() + assert chassis.get_name() == 'MSN3420' + assert chassis.get_model() == 'MSN3420-CB2FO' + assert chassis.get_base_mac() == '1C:34:DA:1C:9F:00' + assert chassis.get_serial() == 'MT2019X13878' + assert chassis.get_system_eeprom_info() == mock_eeprom_info.return_value + + def test_eeprom_init(self): + # Test symlink not exist, there is an exception + with pytest.raises(RuntimeError): + Eeprom() + + @patch('os.path.exists', MagicMock(return_value=True)) + @patch('os.path.islink', MagicMock(return_value=True)) + def test_get_system_eeprom_info_from_db(self): + return_values = { + ('EEPROM_INFO|State', 'Initialized'): '1', + ('EEPROM_INFO|{}'.format(hex(Eeprom._TLV_CODE_PRODUCT_NAME)), 'Value'): 'MSN3420', + ('EEPROM_INFO|{}'.format(hex(Eeprom._TLV_CODE_PART_NUMBER)), 'Value'): 'MSN3420-CB2FO', + ('EEPROM_INFO|{}'.format(hex(Eeprom._TLV_CODE_MAC_BASE)), 'Value'): '1C:34:DA:1C:9F:00', + ('EEPROM_INFO|{}'.format(hex(Eeprom._TLV_CODE_SERIAL_NUMBER)), 'Value'): 'MT2019X13878', + ('EEPROM_INFO|{}'.format(hex(Eeprom._TLV_CODE_VENDOR_EXT)), 'Num_vendor_ext'): '2', + ('EEPROM_INFO|{}'.format(hex(Eeprom._TLV_CODE_VENDOR_EXT)), 'Value_0'): 'ext1', + ('EEPROM_INFO|{}'.format(hex(Eeprom._TLV_CODE_VENDOR_EXT)), 'Value_1'): 'ext2', + ('EEPROM_INFO|{}'.format(hex(Eeprom._TLV_CODE_CRC_32)), 'Value'): 'CRC_VALUE', + } + def side_effect(key, field): + return return_values.get((key, field)) + eeprom = Eeprom() + eeprom._redis_hget = MagicMock(side_effect = side_effect) + + info = eeprom.get_system_eeprom_info() + assert eeprom.get_product_name() == 'MSN3420' + assert eeprom.get_part_number() == 'MSN3420-CB2FO' + assert eeprom.get_base_mac() == '1C:34:DA:1C:9F:00' + assert eeprom.get_serial_number() == 'MT2019X13878' + assert info[hex(Eeprom._TLV_CODE_VENDOR_EXT)] == ['ext1', 'ext2'] + assert info[hex(Eeprom._TLV_CODE_CRC_32)] == 'CRC_VALUE' + + @patch('os.path.exists', MagicMock(return_value=True)) + @patch('os.path.islink', MagicMock(return_value=True)) + def test_get_system_eeprom_info_from_hardware(self): + eeprom = Eeprom() + eeprom.p = os.path.join(test_path, 'mock_eeprom_data') + eeprom._redis_hget = MagicMock() + info = eeprom.get_system_eeprom_info() + assert eeprom.get_product_name() == 'MSN3800' + assert eeprom.get_part_number() == 'MSN3800-CS2FO' + assert eeprom.get_base_mac() == 'B8:59:9F:A9:34:00' + assert eeprom.get_serial_number() == 'MT1937X00537' + assert info[hex(Eeprom._TLV_CODE_CRC_32)] == '0x9EFF0119' + + def test_eeprom_content_visitor(self): + content = {} + v = EepromContentVisitor(content) + v.visit_tlv('tlv1', Eeprom._TLV_CODE_PRODUCT_NAME, 7, 'MSN3420') + v.visit_tlv('tlv2', Eeprom._TLV_CODE_VENDOR_EXT, 4, 'ext1') + v.visit_tlv('tlv3', Eeprom._TLV_CODE_VENDOR_EXT, 4, 'ext2') + assert content[hex(Eeprom._TLV_CODE_PRODUCT_NAME)] == 'MSN3420' + assert content[hex(Eeprom._TLV_CODE_VENDOR_EXT)] == ['ext1', 'ext2'] + + + + diff --git a/platform/mellanox/mlnx-platform-api/tests/test_fan_api.py b/platform/mellanox/mlnx-platform-api/tests/test_fan_api.py index bb9ee7e125a2..5845a1b2cadb 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_fan_api.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_fan_api.py @@ -1,57 +1,151 @@ +# +# Copyright (c) 2020-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# import os -import sys import pytest -from mock import MagicMock -from .mock_platform import MockFan +import subprocess +import sys +from mock import MagicMock, patch test_path = os.path.dirname(os.path.abspath(__file__)) modules_path = os.path.dirname(test_path) sys.path.insert(0, modules_path) -from sonic_platform.fan import Fan -from sonic_platform.led import FanLed -from sonic_platform.fan_drawer import RealDrawer -from sonic_platform.device_data import DEVICE_DATA +from sonic_platform import utils +from sonic_platform.fan import Fan, PsuFan +from sonic_platform.fan_drawer import RealDrawer, VirtualDrawer +from sonic_platform.psu import Psu + + +class TestFan: + def test_fan_drawer_basic(self): + # Real drawer + fan_drawer = RealDrawer(0) + assert fan_drawer.get_index() == 1 + assert fan_drawer.get_name() == 'drawer1' + utils.read_int_from_file = MagicMock(return_value=1) + assert fan_drawer.get_presence() is True + utils.read_int_from_file = MagicMock(return_value=0) + assert fan_drawer.get_presence() is False + assert fan_drawer.get_position_in_parent() == 1 + assert fan_drawer.is_replaceable() is True + fan_drawer.get_presence = MagicMock(return_value=False) + assert fan_drawer.get_direction() == Fan.FAN_DIRECTION_NOT_APPLICABLE + fan_drawer.get_presence = MagicMock(return_value=True) + assert fan_drawer.get_direction() == Fan.FAN_DIRECTION_EXHAUST + utils.read_int_from_file = MagicMock(return_value=1) + assert fan_drawer.get_direction() == Fan.FAN_DIRECTION_INTAKE + # Invalid fan dir value + utils.read_int_from_file = MagicMock(return_value=2) + assert fan_drawer.get_direction() == Fan.FAN_DIRECTION_NOT_APPLICABLE + + utils.read_int_from_file = MagicMock(side_effect=ValueError('')) + assert fan_drawer.get_direction() == Fan.FAN_DIRECTION_NOT_APPLICABLE + utils.read_int_from_file = MagicMock(side_effect=IOError('')) + assert fan_drawer.get_direction() == Fan.FAN_DIRECTION_NOT_APPLICABLE -def test_get_absence_fan_direction(): - fan_drawer = RealDrawer(0, DEVICE_DATA['x86_64-mlnx_msn2700-r0']['fans']) - fan = Fan(0, fan_drawer, 1) - fan_drawer.get_presence = MagicMock(return_value=False) + # Virtual drawer + fan_drawer = VirtualDrawer(0) + assert fan_drawer.get_name() == 'N/A' + assert fan_drawer.get_presence() is True + assert fan_drawer.is_replaceable() is False - assert not fan.is_psu_fan - assert fan.get_direction() == Fan.FAN_DIRECTION_NOT_APPLICABLE + def test_system_fan_basic(self): + fan_drawer = RealDrawer(0) + fan = Fan(2, fan_drawer, 1) + assert fan.get_position_in_parent() == 1 + assert fan.is_replaceable() is False + assert fan.get_speed_tolerance() == 50 + assert fan.get_name() == 'fan3' + mock_sysfs_content = { + fan.fan_speed_get_path: 50, + fan.fan_max_speed_path: 100, + fan.fan_status_path: 0, + fan.fan_speed_set_path: 153 + } -def test_fan_drawer_set_status_led(): - fan_drawer = RealDrawer(0, DEVICE_DATA['x86_64-mlnx_msn2700-r0']['fans']) - with pytest.raises(Exception): - fan_drawer.set_status_led(None, 'Invalid color') + def mock_read_int_from_file(file_path, default=0, raise_exception=False): + return mock_sysfs_content[file_path] - with pytest.raises(Exception): - fan_drawer.set_status_led(None, Fan.STATUS_LED_COLOR_RED) - - fan1 = Fan(0, fan_drawer, 1) - fan2 = Fan(1, fan_drawer, 2) - fan_list = fan_drawer.get_all_fans() - fan_list.append(fan1) - fan_list.append(fan2) + utils.read_int_from_file = mock_read_int_from_file + assert fan.get_speed() == 50 + mock_sysfs_content[fan.fan_speed_get_path] = 101 + assert fan.get_speed() == 100 + mock_sysfs_content[fan.fan_max_speed_path] = 0 + assert fan.get_speed() == 101 - FanLed.set_status = MagicMock() + assert fan.get_status() is True + mock_sysfs_content[fan.fan_status_path] = 1 + assert fan.get_status() is False - fan1.set_status_led(Fan.STATUS_LED_COLOR_RED) - fan_drawer.set_status_led(Fan.STATUS_LED_COLOR_RED) - FanLed.set_status.assert_called_with(Fan.STATUS_LED_COLOR_RED) + assert fan.get_target_speed() == 60 - fan2.set_status_led(Fan.STATUS_LED_COLOR_GREEN) - fan_drawer.set_status_led(Fan.STATUS_LED_COLOR_GREEN) - FanLed.set_status.assert_called_with(Fan.STATUS_LED_COLOR_RED) + fan.fan_drawer.get_direction = MagicMock(return_value=Fan.FAN_DIRECTION_EXHAUST) + assert fan.get_direction() == Fan.FAN_DIRECTION_EXHAUST + fan.fan_drawer.get_presence = MagicMock(return_value=True) + assert fan.get_presence() is True - fan1.set_status_led(Fan.STATUS_LED_COLOR_GREEN) - fan_drawer.set_status_led(Fan.STATUS_LED_COLOR_GREEN) - FanLed.set_status.assert_called_with(Fan.STATUS_LED_COLOR_GREEN) + @patch('sonic_platform.utils.write_file') + def test_system_fan_set_speed(self, mock_write_file): + fan_drawer = RealDrawer(0) + fan = Fan(2, fan_drawer, 1) + fan.set_speed(60) + mock_write_file.assert_called_with(fan.fan_speed_set_path, 153, raise_exception=True) - fan1.set_status_led(Fan.STATUS_LED_COLOR_RED) - fan_drawer.set_status_led(Fan.STATUS_LED_COLOR_RED) - FanLed.set_status.assert_called_with(Fan.STATUS_LED_COLOR_RED) + @patch('sonic_platform.thermal.Thermal.get_cooling_level') + @patch('sonic_platform.psu.Psu.get_presence') + @patch('sonic_platform.psu.Psu.get_powergood_status') + @patch('os.path.exists') + def test_psu_fan_basic(self, mock_path_exists, mock_powergood, mock_presence, mock_cooling_level): + mock_path_exists.return_value = False + psu = Psu(0) + fan = PsuFan(0, 1, psu) + assert fan.get_direction() == Fan.FAN_DIRECTION_NOT_APPLICABLE + assert fan.get_status() is True + assert fan.get_presence() is False + mock_presence.return_value = True + assert fan.get_presence() is False + mock_powergood.return_value = True + assert fan.get_presence() is False + mock_path_exists.return_value = True + assert fan.get_presence() is True + mock_cooling_level.return_value = 7 + assert fan.get_target_speed() == 70 + def test_psu_fan_set_speed(self): + psu = Psu(0) + fan = PsuFan(0, 1, psu) + subprocess.check_call = MagicMock() + mock_file_content = { + fan.psu_i2c_bus_path: 'bus', + fan.psu_i2c_addr_path: 'addr', + fan.psu_i2c_command_path: 'command' + } + def mock_read_str_from_file(file_path, default='', raise_exception=False): + return mock_file_content[file_path] + utils.read_str_from_file = mock_read_str_from_file + fan.set_speed(60) + assert subprocess.check_call.call_count == 0 + fan.get_presence = MagicMock(return_value=True) + assert fan.set_speed(60) + subprocess.check_call.assert_called_with("i2cset -f -y {0} {1} {2} {3} wp".format('bus', 'addr', 'command', hex(60)), shell=True, universal_newlines=True) + subprocess.check_call = MagicMock(side_effect=subprocess.CalledProcessError('', '')) + assert not fan.set_speed(60) + subprocess.check_call = MagicMock() + utils.read_str_from_file = MagicMock(side_effect=RuntimeError('')) + assert not fan.set_speed(60) diff --git a/platform/mellanox/mlnx-platform-api/tests/test_firmware.py b/platform/mellanox/mlnx-platform-api/tests/test_firmware.py index cdd68fa70505..a08dbb9d1464 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_firmware.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_firmware.py @@ -1,3 +1,19 @@ +# +# Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# import os import sys import pytest @@ -8,18 +24,21 @@ modules_path = os.path.dirname(test_path) sys.path.insert(0, modules_path) -from sonic_platform.component import Component, ComponentSSD +from sonic_platform.component import Component, ComponentSSD, ComponentCPLD from sonic_platform_base.component_base import ComponentBase, \ FW_AUTO_INSTALLED, \ + FW_AUTO_SCHEDULED, \ + FW_AUTO_UPDATED, \ FW_AUTO_ERR_BOOT_TYPE, \ FW_AUTO_ERR_IMAGE, \ - FW_AUTO_ERR_UKNOWN + FW_AUTO_ERR_UNKNOWN -def mock_install_firmware_success(image_path): + +def mock_update_firmware_success(image_path, allow_reboot=False): return True -def mock_install_firmware_fail(image_path): +def mock_update_firmware_fail(image_path, allow_reboot=False): return False def mock_update_notification_cold_boot(image_path): @@ -34,29 +53,51 @@ def mock_update_notification_error(image_path): test_data_default = [ (None, False, None, FW_AUTO_ERR_IMAGE), (None, True, 'warm', FW_AUTO_ERR_BOOT_TYPE), - (mock_install_firmware_fail, True, 'cold', FW_AUTO_ERR_UKNOWN), - (mock_install_firmware_success, True, 'cold', FW_AUTO_INSTALLED) + (mock_update_firmware_fail, True, 'cold', FW_AUTO_ERR_UNKNOWN), + (mock_update_firmware_success, True, 'cold', FW_AUTO_INSTALLED) + ] + +test_data_cpld = [ + (None, False, None, FW_AUTO_ERR_IMAGE), + (None, True, 'warm', FW_AUTO_ERR_BOOT_TYPE), + (mock_update_firmware_fail, True, 'cold', FW_AUTO_ERR_UNKNOWN), + (mock_update_firmware_success, True, 'cold', FW_AUTO_SCHEDULED) ] test_data_ssd = [ (None, None, False, None, FW_AUTO_ERR_IMAGE), - (None, mock_update_notification_error, True, None, FW_AUTO_ERR_UKNOWN), - (mock_install_firmware_fail, mock_update_notification_cold_boot, True, 'cold', FW_AUTO_ERR_UKNOWN), - (mock_install_firmware_success, mock_update_notification_cold_boot, True, 'warm', FW_AUTO_ERR_BOOT_TYPE), - (mock_install_firmware_success, mock_update_notification_cold_boot, True, 'cold', FW_AUTO_INSTALLED), - (mock_install_firmware_success, mock_update_notification_warm_boot, True, 'warm', FW_AUTO_INSTALLED), - (mock_install_firmware_success, mock_update_notification_warm_boot, True, 'cold', FW_AUTO_INSTALLED) + (None, mock_update_notification_error, True, None, FW_AUTO_ERR_UNKNOWN), + (mock_update_firmware_success, mock_update_notification_cold_boot, True, 'warm', FW_AUTO_ERR_BOOT_TYPE), + (mock_update_firmware_success, mock_update_notification_cold_boot, True, 'cold', FW_AUTO_SCHEDULED), + (mock_update_firmware_success, mock_update_notification_warm_boot, True, 'warm', FW_AUTO_UPDATED), + (mock_update_firmware_success, mock_update_notification_warm_boot, True, 'cold', FW_AUTO_UPDATED) ] -@pytest.mark.parametrize('install_func, image_found, boot_type, expect', test_data_default) -def test_auto_update_firmware_default(monkeypatch, install_func, image_found, boot_type, expect): +@pytest.mark.parametrize('update_func, image_found, boot_type, expect', test_data_default) +def test_auto_update_firmware_default(monkeypatch, update_func, image_found, boot_type, expect): def mock_path_exists(path): return image_found test_component = Component() - monkeypatch.setattr(test_component, 'install_firmware', install_func) + monkeypatch.setattr(test_component, 'install_firmware', update_func) + monkeypatch.setattr(os.path, 'exists', mock_path_exists) + + result = test_component.auto_update_firmware(None, boot_type) + + assert result == expect + + +@pytest.mark.parametrize('update_func, image_found, boot_type, expect', test_data_cpld) +def test_auto_update_firmware_cpld(monkeypatch, update_func, image_found, boot_type, expect): + + def mock_path_exists(path): + return image_found + + test_component = ComponentCPLD(0) + + monkeypatch.setattr(test_component, 'install_firmware', update_func) monkeypatch.setattr(os.path, 'exists', mock_path_exists) result = test_component.auto_update_firmware(None, boot_type) @@ -64,15 +105,15 @@ def mock_path_exists(path): assert result == expect -@pytest.mark.parametrize('install_func, notify, image_found, boot_type, expect', test_data_ssd) -def test_auto_update_firmware_default(monkeypatch, install_func, notify, image_found, boot_type, expect): +@pytest.mark.parametrize('update_func, notify, image_found, boot_type, expect', test_data_ssd) +def test_auto_update_firmware_ssd(monkeypatch, update_func, notify, image_found, boot_type, expect): def mock_path_exists(path): return image_found test_component_ssd = ComponentSSD() - monkeypatch.setattr(test_component_ssd, 'install_firmware', install_func) + monkeypatch.setattr(test_component_ssd, 'update_firmware', update_func) monkeypatch.setattr(test_component_ssd, 'get_firmware_update_notification', notify) monkeypatch.setattr(os.path, 'exists', mock_path_exists) diff --git a/platform/mellanox/mlnx-platform-api/tests/test_led.py b/platform/mellanox/mlnx-platform-api/tests/test_led.py new file mode 100644 index 000000000000..7a9ebaf056a5 --- /dev/null +++ b/platform/mellanox/mlnx-platform-api/tests/test_led.py @@ -0,0 +1,151 @@ +# +# Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +import sys +if sys.version_info.major == 3: + from unittest import mock +else: + import mock + +test_path = os.path.dirname(os.path.abspath(__file__)) +modules_path = os.path.dirname(test_path) +sys.path.insert(0, modules_path) + +from sonic_platform import utils +from sonic_platform.chassis import Chassis +from sonic_platform.fan import Fan +from sonic_platform.fan_drawer import RealDrawer, VirtualDrawer +from sonic_platform.led import Led +from sonic_platform.psu import FixedPsu, Psu + +class TestLed: + @mock.patch('sonic_platform.led.Led._wait_files_ready', mock.MagicMock(return_value=True)) + def test_chassis_led(self): + chassis = Chassis() + assert chassis._led is None + assert chassis.set_status_led('red') is False + physical_led = chassis._led + assert physical_led is not None + self._verify_non_shared_led(physical_led, chassis) + + def _verify_non_shared_led(self, physical_led, obj): + mock_file_content = self._mock_led_file_content(physical_led) + + def mock_read_str_from_file(file_path, **kwargs): + return mock_file_content[file_path] + + def mock_write_file(file_path, content, **kwargs): + mock_file_content[file_path] = content + + utils.read_str_from_file = mock_read_str_from_file + utils.write_file = mock_write_file + + assert obj.get_status_led() == Led.STATUS_LED_COLOR_GREEN + mock_file_content[physical_led.get_green_led_path()] = Led.LED_OFF + assert obj.set_status_led(Led.STATUS_LED_COLOR_RED) is True + assert obj.get_status_led() == Led.STATUS_LED_COLOR_RED + mock_file_content[physical_led.get_red_led_path()] = Led.LED_OFF + assert obj.set_status_led(Led.STATUS_LED_COLOR_GREEN) is True + assert obj.get_status_led() == Led.STATUS_LED_COLOR_GREEN + mock_file_content[physical_led.get_green_led_path()] = Led.LED_OFF + assert obj.set_status_led(Led.STATUS_LED_COLOR_ORANGE) is True + assert obj.get_status_led() == Led.STATUS_LED_COLOR_RED + mock_file_content[physical_led.get_orange_led_path()] = Led.LED_OFF + + assert obj.set_status_led(Led.STATUS_LED_COLOR_RED_BLINK) + assert obj.get_status_led() == Led.STATUS_LED_COLOR_RED_BLINK + + mock_file_content[physical_led.get_red_led_delay_off_path()] = Led.LED_OFF + mock_file_content[physical_led.get_red_led_delay_on_path()] = Led.LED_OFF + + assert obj.set_status_led(Led.STATUS_LED_COLOR_GREEN_BLINK) + assert obj.get_status_led() == Led.STATUS_LED_COLOR_GREEN_BLINK + mock_file_content[physical_led.get_green_led_delay_off_path()] = Led.LED_OFF + mock_file_content[physical_led.get_green_led_delay_on_path()] = Led.LED_OFF + + assert obj.set_status_led(Led.STATUS_LED_COLOR_ORANGE_BLINK) + assert obj.get_status_led() == Led.STATUS_LED_COLOR_RED_BLINK + mock_file_content[physical_led.get_green_led_delay_off_path()] = Led.LED_OFF + mock_file_content[physical_led.get_green_led_delay_on_path()] = Led.LED_OFF + + def _mock_led_file_content(self, led): + return { + led.get_green_led_path(): Led.LED_ON, + led.get_red_led_path(): Led.LED_OFF, + led.get_orange_led_path(): Led.LED_OFF, + led.get_led_cap_path(): 'none green green_blink red red_blink orange', + led.get_green_led_delay_off_path(): Led.LED_OFF, + led.get_green_led_delay_on_path(): Led.LED_OFF, + led.get_red_led_delay_off_path(): Led.LED_OFF, + led.get_red_led_delay_on_path(): Led.LED_OFF, + led.get_orange_led_delay_off_path(): Led.LED_OFF, + led.get_orange_led_delay_on_path(): Led.LED_OFF, + } + + @mock.patch('sonic_platform.led.Led._wait_files_ready', mock.MagicMock(return_value=True)) + def test_fan_led(self): + fan_drawer = RealDrawer(0) + self._verify_fan_led(fan_drawer) + fan_drawer = VirtualDrawer(0) + self._verify_fan_led(fan_drawer) + + def _verify_fan_led(self, fan_drawer): + fan1 = Fan(0, fan_drawer, 1) + fan2 = Fan(1, fan_drawer, 2) + physical_led = fan_drawer.get_led()._led + self._verify_shared_led(physical_led, fan1, fan2) + + def _verify_shared_led(self, physical_led, obj1, obj2): + mock_file_content = self._mock_led_file_content(physical_led) + + def mock_read_str_from_file(file_path, **kwargs): + return mock_file_content[file_path] + + def mock_write_file(file_path, content, **kwargs): + mock_file_content[file_path] = content + + utils.read_str_from_file = mock_read_str_from_file + utils.write_file = mock_write_file + assert obj1.set_status_led(Led.STATUS_LED_COLOR_GREEN) + assert obj2.get_status_led() == Led.STATUS_LED_COLOR_GREEN + mock_file_content[physical_led.get_green_led_path()] = Led.LED_OFF + assert obj2.set_status_led(Led.STATUS_LED_COLOR_RED) + assert obj2.get_status_led() == Led.STATUS_LED_COLOR_RED + assert obj1.set_status_led(Led.STATUS_LED_COLOR_RED) + assert obj2.get_status_led() == Led.STATUS_LED_COLOR_RED + + mock_file_content[physical_led.get_red_led_path()] = Led.LED_OFF + assert obj1.set_status_led(Led.STATUS_LED_COLOR_GREEN) + assert obj1.get_status_led() == Led.STATUS_LED_COLOR_RED + assert obj2.get_status_led() == Led.STATUS_LED_COLOR_RED + assert obj2.set_status_led(Led.STATUS_LED_COLOR_GREEN) + assert obj1.get_status_led() == Led.STATUS_LED_COLOR_GREEN + assert obj1.get_status_led() == Led.STATUS_LED_COLOR_GREEN + + @mock.patch('sonic_platform.led.Led._wait_files_ready', mock.MagicMock(return_value=True)) + def test_psu_led(self): + psu1 = Psu(0) + psu2 = Psu(1) + physical_led = Psu.get_shared_led()._led + self._verify_shared_led(physical_led, psu1, psu2) + + @mock.patch('sonic_platform.led.Led._wait_files_ready', mock.MagicMock(return_value=True)) + def test_fixed_psu_led(self): + psu = FixedPsu(0) + physical_led = psu.led + self._verify_non_shared_led(physical_led, psu) diff --git a/platform/mellanox/mlnx-platform-api/tests/test_module.py b/platform/mellanox/mlnx-platform-api/tests/test_module.py new file mode 100644 index 000000000000..8213aa5a986a --- /dev/null +++ b/platform/mellanox/mlnx-platform-api/tests/test_module.py @@ -0,0 +1,185 @@ +# +# Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +import sys +if sys.version_info.major == 3: + from unittest import mock +else: + import mock + +test_path = os.path.dirname(os.path.abspath(__file__)) +modules_path = os.path.dirname(test_path) +sys.path.insert(0, modules_path) + +from sonic_platform import utils +from sonic_platform.chassis import ModularChassis +from sonic_platform.device_data import DeviceDataManager +from sonic_platform.module import Module + + +class TestModule: + @classmethod + def setup_class(cls): + DeviceDataManager.get_linecard_sfp_count = mock.MagicMock(return_value=2) + DeviceDataManager.get_linecard_count = mock.MagicMock(return_value=2) + + def test_chassis_get_num_sfp(self): + chassis = ModularChassis() + assert chassis.get_num_sfps() == 4 + + def test_chassis_get_all_sfps(self): + utils.read_int_from_file = mock.MagicMock(return_value=1) + chassis = ModularChassis() + assert len(chassis.get_all_sfps()) == 4 + + @mock.patch('sonic_platform.device_data.DeviceDataManager.get_linecard_max_port_count', mock.MagicMock(return_value=16)) + def test_chassis_get_sfp(self): + utils.read_int_from_file = mock.MagicMock(return_value=1) + index = 1 + chassis = ModularChassis() + sfp = chassis.get_sfp(index) + assert sfp + + def test_thermal(self): + from sonic_platform.thermal import THERMAL_NAMING_RULE + DeviceDataManager.get_gearbox_count = mock.MagicMock(return_value=2) + utils.read_int_from_file = mock.MagicMock(return_value=1) + m = Module(1) + assert m.get_num_thermals() == 2 + assert len(m._thermal_list) == 0 + + thermals = m.get_all_thermals() + assert len(thermals) == 2 + + rule = THERMAL_NAMING_RULE['linecard thermals'] + start_index = rule.get('start_index', 1) + for i, thermal in enumerate(thermals): + assert rule['name'].format(i + start_index) in thermal.get_name() + assert rule['temperature'].format(i + start_index) in thermal.temperature + assert rule['high_threshold'].format(i + start_index) in thermal.high_threshold + assert rule['high_critical_threshold'].format(i + start_index) in thermal.high_critical_threshold + assert thermal.get_position_in_parent() == i + 1 + + thermal = m.get_thermal(1) + assert thermal + assert thermal.get_position_in_parent() == 2 + + def get_sfp(self): + DeviceDataManager.get_linecard_sfp_count = mock.MagicMock(return_value=3) + utils.read_int_from_file = mock.MagicMock(return_value=1) + + # Test get_num_sfps, it should not create any SFP objects + m = Module(1) + assert m.get_num_sfps() == 3 + assert len(m._sfp_list) == 0 + + # Index out of bound, return None + sfp = m.get_sfp(3) + assert sfp is None + assert len(m._sfp_list) == 0 + + # Get one SFP, other SFP list should be initialized to None + sfp = m.get_sfp(0) + assert sfp is not None + assert len(m._sfp_list) == 3 + assert m._sfp_list[1] is None + assert m._sfp_list[2] is None + assert m.sfp_initialized_count == 1 + + # Get the SFP again, no new SFP created + sfp1 = m.get_sfp(0) + assert id(sfp) == id(sfp1) + + # Get another SFP, sfp_initialized_count increase + sfp2 = m.get_sfp(1) + assert sfp2 is not None + assert m._sfp_list[2] is None + assert m.sfp_initialized_count == 2 + + # Get all SFPs, but there are SFP already created, only None SFP created + sfp_list = m.get_all_sfps() + assert len(sfp_list) == 3 + assert m.sfp_initialized_count == 3 + assert filter(lambda x: x is not None, sfp_list) + assert id(sfp1) == id(sfp_list[0]) + assert id(sfp2) == id(sfp_list[1]) + + # Get all SFPs, no SFP yet, all SFP created + m._sfp_list = [] + m.sfp_initialized_count = 0 + sfp_list = m.get_all_sfps() + assert len(sfp_list) == 3 + assert m.sfp_initialized_count == 3 + + def test_check_state(self): + utils.read_int_from_file = mock.MagicMock(return_value=0) + m = Module(1) + m._sfp_list.append(1) + m._thermal_list.append(1) + m._get_seq_no = mock.MagicMock(return_value=0) + # both seq number and state no change, do not re-init module + m._check_state() + assert len(m._sfp_list) > 0 + assert len(m._thermal_list) > 0 + + # seq number changes, but state keeps deactivated, no need re-init module + m._get_seq_no = mock.MagicMock(return_value=1) + m._check_state() + assert len(m._sfp_list) > 0 + assert len(m._thermal_list) > 0 + + # seq number not change, state changes from deactivated to activated, need re-init module + utils.read_int_from_file = mock.MagicMock(return_value=1) + m._check_state() + assert len(m._sfp_list) == 0 + assert len(m._thermal_list) == 0 + + # seq number changes, state keeps activated, which means the module has been replaced, need re-init module + m._sfp_list.append(1) + m._thermal_list.append(1) + m._get_seq_no = mock.MagicMock(return_value=2) + m._check_state() + assert len(m._sfp_list) == 0 + assert len(m._thermal_list) == 0 + + # seq number not change, state changes from activated to deactivated, need re-init module + m._sfp_list.append(1) + m._thermal_list.append(1) + utils.read_int_from_file = mock.MagicMock(return_value=0) + m._check_state() + assert len(m._sfp_list) == 0 + assert len(m._thermal_list) == 0 + + def test_module_vpd(self): + m = Module(1) + m.vpd_parser.vpd_file = os.path.join(test_path, 'mock_psu_vpd') + + assert m.get_model() == 'MTEF-PSF-AC-C' + assert m.get_serial() == 'MT1946X07684' + assert m.get_revision() == 'A3' + + m.vpd_parser.vpd_file = 'not exists' + assert m.get_model() == 'N/A' + assert m.get_serial() == 'N/A' + assert m.get_revision() == 'N/A' + + m.vpd_parser.vpd_file_last_mtime = None + m.vpd_parser.vpd_file = os.path.join(test_path, 'mock_psu_vpd') + assert m.get_model() == 'MTEF-PSF-AC-C' + assert m.get_serial() == 'MT1946X07684' + assert m.get_revision() == 'A3' diff --git a/platform/mellanox/mlnx-platform-api/tests/test_psu.py b/platform/mellanox/mlnx-platform-api/tests/test_psu.py new file mode 100644 index 000000000000..c53a9d44797d --- /dev/null +++ b/platform/mellanox/mlnx-platform-api/tests/test_psu.py @@ -0,0 +1,118 @@ +# +# Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +import sys +if sys.version_info.major == 3: + from unittest import mock +else: + import mock + +test_path = os.path.dirname(os.path.abspath(__file__)) +modules_path = os.path.dirname(test_path) +sys.path.insert(0, modules_path) + +from sonic_platform import utils +from sonic_platform.psu import FixedPsu, Psu + + +class TestPsu: + def test_fixed_psu(self): + psu = FixedPsu(0) + assert psu.get_name() == 'PSU 1' + assert psu.get_model() == 'N/A' + assert psu.get_serial() == 'N/A' + assert psu.get_revision() == 'N/A' + utils.read_int_from_file = mock.MagicMock(return_value=1) + assert psu.get_powergood_status() + utils.read_int_from_file = mock.MagicMock(return_value=0) + assert not psu.get_powergood_status() + assert psu.get_presence() + assert psu.get_voltage() is None + assert psu.get_current() is None + assert psu.get_power() is None + assert psu.get_position_in_parent() == 1 + assert psu.is_replaceable() is False + assert psu.get_temperature() is None + assert psu.get_temperature_high_threshold() is None + + @mock.patch('os.path.exists', mock.MagicMock(return_value=True)) + def test_psu(self): + psu = Psu(0) + assert len(psu._fan_list) == 1 + assert psu.get_fan(0).get_name() == 'psu1_fan1' + mock_sysfs_content = { + psu.psu_presence: 1, + psu.psu_oper_status: 1, + psu.psu_voltage: 10234, + psu.psu_voltage_min: 9000, + psu.psu_voltage_max: 12000, + psu.psu_current: 20345, + psu.psu_power: 30456, + psu.psu_temp: 40567, + psu.psu_temp_threshold: 50678 + } + + def mock_read_int_from_file(file_path, **kwargs): + return mock_sysfs_content[file_path] + + utils.read_int_from_file = mock_read_int_from_file + utils.read_str_from_file = mock.MagicMock(return_value='min max') + assert psu.get_presence() is True + mock_sysfs_content[psu.psu_presence] = 0 + assert psu.get_presence() is False + + assert psu.get_powergood_status() is True + mock_sysfs_content[psu.psu_oper_status] = 0 + assert psu.get_powergood_status() is False + + assert psu.get_voltage() is None + assert psu.get_current() is None + assert psu.get_power() is None + assert psu.get_temperature() is None + assert psu.get_temperature_high_threshold() is None + + mock_sysfs_content[psu.psu_oper_status] = 1 + assert psu.get_voltage() == 10.234 + assert psu.get_voltage_high_threshold() == 12.0 + assert psu.get_voltage_low_threshold() == 9.0 + assert psu.get_current() == 20.345 + assert psu.get_power() == 0.030456 + assert psu.get_temperature() == 40.567 + assert psu.get_temperature_high_threshold() == 50.678 + + assert psu.get_position_in_parent() == 1 + assert psu.is_replaceable() is True + + def test_psu_vpd(self): + psu = Psu(0) + psu.vpd_parser.vpd_file = os.path.join(test_path, 'mock_psu_vpd') + + assert psu.get_model() == 'MTEF-PSF-AC-C' + assert psu.get_serial() == 'MT1946X07684' + assert psu.get_revision() == 'A3' + + psu.vpd_parser.vpd_file = 'not exists' + assert psu.get_model() == 'N/A' + assert psu.get_serial() == 'N/A' + assert psu.get_revision() == 'N/A' + + psu.vpd_parser.vpd_file_last_mtime = None + psu.vpd_parser.vpd_file = os.path.join(test_path, 'mock_psu_vpd') + assert psu.get_model() == 'MTEF-PSF-AC-C' + assert psu.get_serial() == 'MT1946X07684' + assert psu.get_revision() == 'A3' diff --git a/platform/mellanox/mlnx-platform-api/tests/test_sfp.py b/platform/mellanox/mlnx-platform-api/tests/test_sfp.py index 405a48a77b79..dcb3953ded88 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_sfp.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_sfp.py @@ -1,125 +1,111 @@ +# +# Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# import os import sys -import pytest -from mock import MagicMock -from .mock_platform import MockFan +if sys.version_info.major == 3: + from unittest import mock +else: + import mock test_path = os.path.dirname(os.path.abspath(__file__)) modules_path = os.path.dirname(test_path) sys.path.insert(0, modules_path) -os.environ["PLATFORM_API_UNIT_TESTING"] = "1" - -from sonic_py_common import device_info from sonic_platform.sfp import SFP, SX_PORT_MODULE_STATUS_INITIALIZING, SX_PORT_MODULE_STATUS_PLUGGED, SX_PORT_MODULE_STATUS_UNPLUGGED, SX_PORT_MODULE_STATUS_PLUGGED_WITH_ERROR, SX_PORT_MODULE_STATUS_PLUGGED_DISABLED - from sonic_platform.chassis import Chassis +from sonic_platform.sfp import MlxregManager +from tests.input_platform import output_sfp -def mock_get_platform(): - return 'x86_64-mlnx_msn2410-r0' - - -def mock_read_eeprom_specific_bytes(self, offset, num_bytes): - return None - - -def mock_get_sdk_handle(self): - if not self.sdk_handle: - self.sdk_handle = 1 - return self.sdk_handle - - -def mock_get_sfp_error_code(self): - return self.oper_code, self.error_code - - -device_info.get_platform = mock_get_platform -SFP._read_eeprom_specific_bytes = mock_read_eeprom_specific_bytes -SFP._get_error_code = mock_get_sfp_error_code -Chassis.get_sdk_handle = mock_get_sdk_handle - +class TestSfp: + @mock.patch('sonic_platform.device_data.DeviceDataManager.get_linecard_count', mock.MagicMock(return_value=8)) + @mock.patch('sonic_platform.device_data.DeviceDataManager.get_linecard_max_port_count') + def test_sfp_index(self, mock_max_port): + sfp = SFP(0) + assert sfp.sdk_index == 0 + assert sfp.index == 1 -def test_sfp_partial_and_then_full_initialize(): - """ - Verify SFP initialization flow (partial and then full): - 1. get_sfp to tirgger a partial initialization - 2. get_sfp for another SPF module and verify the partial initialization isn't executed again - 3. get_all_sfps to trigger a full initialization - """ - chassis = Chassis() + mock_max_port.return_value = 16 + sfp = SFP(sfp_index=0, slot_id=1, linecard_port_count=16, lc_name='LINE-CARD1') + assert sfp.sdk_index == 0 + assert sfp.index == 1 - # Fetch a sfp - # This should trigger SFP modules be partial initialized - sfp1 = chassis.get_sfp(1) - # Verify the SFP list has been created - assert len(chassis._sfp_list) == chassis.PORT_END + 1 - assert chassis.sfp_module_partial_initialized == True - assert chassis.sfp_module_full_initialized == False + sfp = SFP(sfp_index=5, slot_id=3, linecard_port_count=16, lc_name='LINE-CARD1') + assert sfp.sdk_index == 5 + assert sfp.index == 38 - # Fetch another SFP module - sfp2 = chassis.get_sfp(2) - # Verify the previous SFP module isn't changed - assert sfp1 == chassis.get_sfp(1) + sfp = SFP(sfp_index=1, slot_id=1, linecard_port_count=4, lc_name='LINE-CARD1') + assert sfp.sdk_index == 1 + assert sfp.index == 5 - # Fetch all SFP modules - allsfp = chassis.get_all_sfps() - # Verify sfp1 and sfp2 aren't changed - assert sfp1 == chassis.get_sfp(1) - assert sfp2 == chassis.get_sfp(2) - # Verify the SFP has been fully initialized - assert chassis.sfp_module_partial_initialized == True - assert chassis.sfp_module_full_initialized == True + @mock.patch('sonic_platform.sfp.SFP.read_eeprom', mock.MagicMock(return_value=None)) + @mock.patch('sonic_platform.sfp.SFP._get_error_code') + @mock.patch('sonic_platform.chassis.Chassis.get_num_sfps', mock.MagicMock(return_value=2)) + def test_sfp_get_error_status(self, mock_get_error_code): + chassis = Chassis() + # Fetch an SFP module to test + sfp = chassis.get_sfp(1) -def test_sfp_full_initialize_without_partial(): - """ - Verify SFP initialization flow (full): - 1. get_all_sfps to trigger a full initialization - 2. get_sfp for a certain SFP module and verify the partial initialization isn't executed again - """ - chassis = Chassis() + description_dict = sfp._get_error_description_dict() + for error in description_dict.keys(): + mock_get_error_code.return_value = (SX_PORT_MODULE_STATUS_PLUGGED_WITH_ERROR, error) + description = sfp.get_error_description() - # Fetch all SFP modules - allsfp = chassis.get_all_sfps() - # Verify the SFP has been fully initialized - assert chassis.sfp_module_partial_initialized == True - assert chassis.sfp_module_full_initialized == True - for sfp in allsfp: - assert sfp is not None + assert description == description_dict[error] - # Verify when get_sfp is called, the SFP modules won't be initialized again - sfp1 = allsfp[0] - assert sfp1 == chassis.get_sfp(1) - - -def test_sfp_get_error_status(): - chassis = Chassis() - - # Fetch an SFP module to test - sfp = chassis.get_sfp(1) - - description_dict = sfp._get_error_description_dict() - - sfp.oper_code = SX_PORT_MODULE_STATUS_PLUGGED_WITH_ERROR - for error in description_dict.keys(): - sfp.error_code = error + mock_get_error_code.return_value = (SX_PORT_MODULE_STATUS_PLUGGED_WITH_ERROR, -1) description = sfp.get_error_description() - - assert description == description_dict[sfp.error_code] - - sfp.error_code = -1 - description = sfp.get_error_description() - assert description == "Unknown error (-1)" - - expected_description_list = [ - (SX_PORT_MODULE_STATUS_INITIALIZING, "Initializing"), - (SX_PORT_MODULE_STATUS_PLUGGED, "OK"), - (SX_PORT_MODULE_STATUS_UNPLUGGED, "Unplugged"), - (SX_PORT_MODULE_STATUS_PLUGGED_DISABLED, "Disabled") - ] - for oper_code, expected_description in expected_description_list: - sfp.oper_code = oper_code - description = sfp.get_error_description() - - assert description == expected_description + assert description == "Unknown error (-1)" + + expected_description_list = [ + (SX_PORT_MODULE_STATUS_INITIALIZING, "Initializing"), + (SX_PORT_MODULE_STATUS_PLUGGED, "OK"), + (SX_PORT_MODULE_STATUS_UNPLUGGED, "Unplugged"), + (SX_PORT_MODULE_STATUS_PLUGGED_DISABLED, "Disabled") + ] + for oper_code, expected_description in expected_description_list: + mock_get_error_code.return_value = (oper_code, -1) + description = sfp.get_error_description() + + assert description == expected_description + + @mock.patch('sonic_platform.sfp.SFP.get_mst_pci_device', mock.MagicMock(return_value="pciconf")) + @mock.patch('sonic_platform.sfp.MlxregManager.write_mlxreg_eeprom', mock.MagicMock(return_value=True)) + def test_sfp_write_eeprom(self): + mlxreg_mngr = MlxregManager("", 0, 0) + write_buffer = bytearray([1,2,3,4]) + offset = 793 + + sfp = SFP(0) + sfp.write_eeprom(offset, 4, write_buffer) + MlxregManager.write_mlxreg_eeprom.assert_called_with(4, output_sfp.write_eeprom_dword1, 153, 5) + + offset = 641 + write_buffer = bytearray([1,2,3,4,5,6]) + sfp.write_eeprom(offset, 6, write_buffer) + MlxregManager.write_mlxreg_eeprom.assert_called_with(6, output_sfp.write_eeprom_dword2, 129, 4) + + @mock.patch('sonic_platform.sfp.SFP.get_mst_pci_device', mock.MagicMock(return_value="pciconf")) + @mock.patch('sonic_platform.sfp.MlxregManager.read_mlxred_eeprom', mock.MagicMock(return_value=output_sfp.read_eeprom_output)) + def test_sfp_read_eeprom(self): + mlxreg_mngr = MlxregManager("", 0, 0) + offset = 644 + + sfp = SFP(0) + assert output_sfp.y_cable_part_number == sfp.read_eeprom(offset, 16).decode() + MlxregManager.read_mlxred_eeprom.assert_called_with(132, 4, 16) diff --git a/platform/mellanox/mlnx-platform-api/tests/test_sfp_event.py b/platform/mellanox/mlnx-platform-api/tests/test_sfp_event.py index 3edcc362a5e6..ef4820ecfd8f 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_sfp_event.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_sfp_event.py @@ -1,8 +1,23 @@ +# +# Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# import os -import select import sys -from mock import MagicMock +from mock import MagicMock, patch test_path = os.path.dirname(os.path.abspath(__file__)) modules_path = os.path.dirname(test_path) @@ -14,8 +29,8 @@ class TestSfpEvent(object): @classmethod def setup_class(cls): os.environ["MLNX_PLATFORM_API_UNIT_TESTING"] = "1" - select.select = MagicMock(return_value=([99], None, None)) + @patch('select.select', MagicMock(return_value=([99], None, None))) def test_check_sfp_status(self): from sonic_platform.sfp_event import SDK_SFP_STATE_IN, SDK_SFP_STATE_OUT, SDK_SFP_STATE_ERR from sonic_platform.sfp_event import SDK_ERRORS_TO_ERROR_BITS, SDK_ERRORS_TO_DESCRIPTION, SDK_SFP_BLOCKING_ERRORS diff --git a/platform/mellanox/mlnx-platform-api/tests/test_thermal.py b/platform/mellanox/mlnx-platform-api/tests/test_thermal.py new file mode 100644 index 000000000000..9c1526479a9b --- /dev/null +++ b/platform/mellanox/mlnx-platform-api/tests/test_thermal.py @@ -0,0 +1,337 @@ +# +# Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import glob +import os +import pytest +import sys +if sys.version_info.major == 3: + from unittest import mock +else: + import mock + +test_path = os.path.dirname(os.path.abspath(__file__)) +modules_path = os.path.dirname(test_path) +sys.path.insert(0, modules_path) + +from sonic_platform.chassis import Chassis +from sonic_platform.device_data import DeviceDataManager + + +class TestThermal: + @mock.patch('os.path.exists', mock.MagicMock(return_value=True)) + @mock.patch('sonic_platform.device_data.DeviceDataManager.get_gearbox_count', mock.MagicMock(return_value=2)) + @mock.patch('sonic_platform.device_data.DeviceDataManager.get_cpu_thermal_count', mock.MagicMock(return_value=2)) + @mock.patch('sonic_platform.device_data.DeviceDataManager.get_platform_name', mock.MagicMock(return_value='x86_64-mlnx_msn2700-r0')) + def test_chassis_thermal(self): + from sonic_platform.thermal import THERMAL_NAMING_RULE + os.path.exists = mock.MagicMock(return_value=True) + chassis = Chassis() + thermal_list = chassis.get_all_thermals() + assert thermal_list + thermal_dict = {thermal.get_name(): thermal for thermal in thermal_list} + gearbox_thermal_rule = None + cpu_thermal_rule = None + for rule in THERMAL_NAMING_RULE['chassis thermals']: + thermal_type = rule.get('type', 'single') + if thermal_type == 'single': + thermal_name = rule['name'] + if rule['temperature'] == 'comex_amb': + assert thermal_name not in thermal_dict + continue + default_present = rule.get('default_present', True) + if not default_present: + assert thermal_name not in thermal_dict + continue + assert thermal_name in thermal_dict + thermal = thermal_dict[thermal_name] + assert rule['temperature'] in thermal.temperature + assert rule['high_threshold'] in thermal.high_threshold if 'high_threshold' in rule else thermal.high_threshold is None + assert rule['high_critical_threshold'] in thermal.high_critical_threshold if 'high_critical_threshold' in rule else thermal.high_critical_threshold is None + else: + if 'Gearbox' in rule['name']: + gearbox_thermal_rule = rule + elif 'CPU Core' in rule['name']: + cpu_thermal_rule = rule + + gearbox_thermal_count = 0 + cpu_thermal_count = 0 + for thermal in thermal_list: + if 'Gearbox' in thermal.get_name(): + start_index = gearbox_thermal_rule.get('start_index', 1) + start_index += gearbox_thermal_count + assert thermal.get_name() == gearbox_thermal_rule['name'].format(start_index) + assert gearbox_thermal_rule['temperature'].format(start_index) in thermal.temperature + assert gearbox_thermal_rule['high_threshold'].format(start_index) in thermal.high_threshold + assert gearbox_thermal_rule['high_critical_threshold'].format(start_index) in thermal.high_critical_threshold + gearbox_thermal_count += 1 + elif 'CPU Core' in thermal.get_name(): + start_index = cpu_thermal_rule.get('start_index', 1) + start_index += cpu_thermal_count + assert thermal.get_name() == cpu_thermal_rule['name'].format(start_index) + assert cpu_thermal_rule['temperature'].format(start_index) in thermal.temperature + assert cpu_thermal_rule['high_threshold'].format(start_index) in thermal.high_threshold + assert cpu_thermal_rule['high_critical_threshold'].format(start_index) in thermal.high_critical_threshold + cpu_thermal_count += 1 + + assert gearbox_thermal_count == 2 + assert cpu_thermal_count == 2 + + def test_chassis_thermal_includes(self): + from sonic_platform.thermal import THERMAL_NAMING_RULE + DeviceDataManager.get_platform_name = mock.MagicMock(return_value='x86_64-nvidia_sn2201-r0') + DeviceDataManager.get_thermal_capability = mock.MagicMock(return_value={'comex_amb': False, 'cpu_amb': True, 'swb_amb': True}) + chassis = Chassis() + thermal_list = chassis.get_all_thermals() + assert thermal_list + thermal_dict = {thermal.get_name(): thermal for thermal in thermal_list} + for rule in THERMAL_NAMING_RULE['chassis thermals']: + default_present = rule.get('default_present', True) + if not default_present: + thermal_name = rule['name'] + assert thermal_name in thermal_dict + + def test_psu_thermal(self): + from sonic_platform.thermal import initialize_psu_thermal, THERMAL_NAMING_RULE + os.path.exists = mock.MagicMock(return_value=True) + presence_cb = mock.MagicMock(return_value=(True, '')) + thermal_list = initialize_psu_thermal(0, presence_cb) + assert len(thermal_list) == 1 + thermal = thermal_list[0] + rule = THERMAL_NAMING_RULE['psu thermals'] + start_index = rule.get('start_index', 1) + assert thermal.get_name() == rule['name'].format(start_index) + assert rule['temperature'].format(start_index) in thermal.temperature + assert rule['high_threshold'].format(start_index) in thermal.high_threshold + assert thermal.high_critical_threshold is None + assert thermal.get_position_in_parent() == 1 + assert thermal.is_replaceable() == False + + presence_cb = mock.MagicMock(return_value=(False, 'Not present')) + thermal_list = initialize_psu_thermal(0, presence_cb) + assert len(thermal_list) == 1 + thermal = thermal_list[0] + assert thermal.get_temperature() is None + assert thermal.get_high_threshold() is None + assert thermal.get_high_critical_threshold() is None + + def test_sfp_thermal(self): + from sonic_platform.thermal import initialize_sfp_thermal, THERMAL_NAMING_RULE + os.path.exists = mock.MagicMock(return_value=True) + thermal_list = initialize_sfp_thermal(0) + assert len(thermal_list) == 1 + thermal = thermal_list[0] + rule = THERMAL_NAMING_RULE['sfp thermals'] + start_index = rule.get('start_index', 1) + assert thermal.get_name() == rule['name'].format(start_index) + assert rule['temperature'].format(start_index) in thermal.temperature + assert rule['high_threshold'].format(start_index) in thermal.high_threshold + assert rule['high_critical_threshold'].format(start_index) in thermal.high_critical_threshold + assert thermal.get_position_in_parent() == 1 + assert thermal.is_replaceable() == False + + def test_get_temperature(self): + from sonic_platform.thermal import Thermal + from sonic_platform import utils + thermal = Thermal('test', 'temp_file', None, None, 1) + utils.read_float_from_file = mock.MagicMock(return_value=35727) + assert thermal.get_temperature() == 35.727 + + utils.read_float_from_file = mock.MagicMock(return_value=0.0) + assert thermal.get_temperature() is None + + utils.read_float_from_file = mock.MagicMock(return_value=None) + assert thermal.get_temperature() is None + + def test_get_high_threshold(self): + from sonic_platform.thermal import Thermal + from sonic_platform import utils + thermal = Thermal('test', None, None, None, 1) + assert thermal.get_high_threshold() is None + + thermal.high_threshold = 'high_th_file' + utils.read_float_from_file = mock.MagicMock(return_value=25833) + assert thermal.get_temperature() == 25.833 + + utils.read_float_from_file = mock.MagicMock(return_value=0.0) + assert thermal.get_temperature() is None + + utils.read_float_from_file = mock.MagicMock(return_value=None) + assert thermal.get_temperature() is None + + def test_get_high_critical_threshold(self): + from sonic_platform.thermal import Thermal + from sonic_platform import utils + thermal = Thermal('test', None, None, None, 1) + assert thermal.get_high_critical_threshold() is None + + thermal.high_critical_threshold = 'high_th_file' + utils.read_float_from_file = mock.MagicMock(return_value=120839) + assert thermal.get_high_critical_threshold() == 120.839 + + utils.read_float_from_file = mock.MagicMock(return_value=0.0) + assert thermal.get_high_critical_threshold() is None + + utils.read_float_from_file = mock.MagicMock(return_value=None) + assert thermal.get_high_critical_threshold() is None + + def test_set_thermal_algorithm_status(self): + from sonic_platform.thermal import Thermal, THERMAL_ZONE_FOLDER_WILDCARD, THERMAL_ZONE_POLICY_FILE, THERMAL_ZONE_MODE_FILE + from sonic_platform import utils + glob.iglob = mock.MagicMock(return_value=['thermal_zone1', 'thermal_zone2']) + utils.write_file = mock.MagicMock() + assert Thermal.set_thermal_algorithm_status(True, False) + + for folder in glob.iglob(THERMAL_ZONE_FOLDER_WILDCARD): + utils.write_file.assert_any_call(os.path.join(folder, THERMAL_ZONE_POLICY_FILE), 'step_wise') + utils.write_file.assert_any_call(os.path.join(folder, THERMAL_ZONE_MODE_FILE), 'enabled') + + assert Thermal.set_thermal_algorithm_status(False, False) + for folder in glob.iglob(THERMAL_ZONE_FOLDER_WILDCARD): + utils.write_file.assert_any_call(os.path.join(folder, THERMAL_ZONE_POLICY_FILE), 'user_space') + utils.write_file.assert_any_call(os.path.join(folder, THERMAL_ZONE_MODE_FILE), 'disabled') + + assert not Thermal.set_thermal_algorithm_status(False, False) + + assert Thermal.set_thermal_algorithm_status(False) + + @mock.patch('glob.iglob', mock.MagicMock(return_value=['thermal_zone1', 'thermal_zone2'])) + @mock.patch('sonic_platform.utils.read_int_from_file') + def test_get_min_allowed_cooling_level_by_thermal_zone(self, mock_read_file): + from sonic_platform.thermal import Thermal, THERMAL_ZONE_TEMP_FILE, THERMAL_ZONE_HIGH_THRESHOLD, THERMAL_ZONE_NORMAL_THRESHOLD, MIN_COOLING_LEVEL_FOR_HIGH, MIN_COOLING_LEVEL_FOR_NORMAL + mock_read_file.side_effect = Exception('') + assert Thermal.get_min_allowed_cooling_level_by_thermal_zone() is None + + mock_file_content = {} + def mock_read_int_from_file(file_path, default=0, raise_exception=False): + return mock_file_content[file_path] + + mock_read_file.side_effect = mock_read_int_from_file + mock_file_content[os.path.join('thermal_zone1', THERMAL_ZONE_NORMAL_THRESHOLD)] = 75000 + mock_file_content[os.path.join('thermal_zone1', THERMAL_ZONE_HIGH_THRESHOLD)] = 85000 + mock_file_content[os.path.join('thermal_zone1', THERMAL_ZONE_TEMP_FILE)] = 69000 + mock_file_content[os.path.join('thermal_zone2', THERMAL_ZONE_NORMAL_THRESHOLD)] = 75000 + mock_file_content[os.path.join('thermal_zone1', THERMAL_ZONE_HIGH_THRESHOLD)] = 85000 + mock_file_content[os.path.join('thermal_zone2', THERMAL_ZONE_TEMP_FILE)] = 24000 + assert Thermal.get_min_allowed_cooling_level_by_thermal_zone() == MIN_COOLING_LEVEL_FOR_NORMAL + + mock_file_content[os.path.join('thermal_zone1', THERMAL_ZONE_TEMP_FILE)] = 71000 + assert Thermal.get_min_allowed_cooling_level_by_thermal_zone() == MIN_COOLING_LEVEL_FOR_HIGH + + mock_file_content[os.path.join('thermal_zone1', THERMAL_ZONE_TEMP_FILE)] = 79000 + assert Thermal.get_min_allowed_cooling_level_by_thermal_zone() == MIN_COOLING_LEVEL_FOR_HIGH + + mock_file_content[os.path.join('thermal_zone1', THERMAL_ZONE_TEMP_FILE)] = 81000 + assert Thermal.get_min_allowed_cooling_level_by_thermal_zone() is None + + @mock.patch('glob.iglob', mock.MagicMock(return_value=['thermal_zone1', 'thermal_zone2'])) + @mock.patch('sonic_platform.utils.read_int_from_file') + def test_no_sensor_thermal_zone(self, mock_read_file): + from sonic_platform.thermal import Thermal, THERMAL_ZONE_TEMP_FILE, THERMAL_ZONE_HIGH_THRESHOLD, THERMAL_ZONE_NORMAL_THRESHOLD, MIN_COOLING_LEVEL_FOR_HIGH, MIN_COOLING_LEVEL_FOR_NORMAL + + mock_file_content = {} + def mock_read_int_from_file(file_path, **kwargs): + return mock_file_content[file_path] + + mock_read_file.side_effect = mock_read_int_from_file + mock_file_content[os.path.join('thermal_zone1', THERMAL_ZONE_NORMAL_THRESHOLD)] = 0 + mock_file_content[os.path.join('thermal_zone1', THERMAL_ZONE_HIGH_THRESHOLD)] = 0 + mock_file_content[os.path.join('thermal_zone1', THERMAL_ZONE_TEMP_FILE)] = 0 + mock_file_content[os.path.join('thermal_zone2', THERMAL_ZONE_NORMAL_THRESHOLD)] = 75000 + mock_file_content[os.path.join('thermal_zone2', THERMAL_ZONE_HIGH_THRESHOLD)] = 85000 + mock_file_content[os.path.join('thermal_zone2', THERMAL_ZONE_TEMP_FILE)] = 24000 + assert Thermal.get_min_allowed_cooling_level_by_thermal_zone() == MIN_COOLING_LEVEL_FOR_NORMAL + + mock_file_content[os.path.join('thermal_zone2', THERMAL_ZONE_TEMP_FILE)] = 71000 + assert Thermal.get_min_allowed_cooling_level_by_thermal_zone() == MIN_COOLING_LEVEL_FOR_HIGH + + mock_file_content[os.path.join('thermal_zone2', THERMAL_ZONE_TEMP_FILE)] = 79000 + assert Thermal.get_min_allowed_cooling_level_by_thermal_zone() == MIN_COOLING_LEVEL_FOR_HIGH + + mock_file_content[os.path.join('thermal_zone2', THERMAL_ZONE_TEMP_FILE)] = 81000 + assert Thermal.get_min_allowed_cooling_level_by_thermal_zone() is None + + def test_check_module_temperature_trustable(self): + from sonic_platform.thermal import Thermal + from sonic_platform import utils + glob.iglob = mock.MagicMock(return_value=['thermal_zone1', 'thermal_zone2']) + + utils.read_int_from_file = mock.MagicMock(return_value=1) + assert Thermal.check_module_temperature_trustable() == 'untrust' + + utils.read_int_from_file = mock.MagicMock(return_value=0) + assert Thermal.check_module_temperature_trustable() == 'trust' + + def test_get_min_amb_temperature(self): + from sonic_platform.thermal import Thermal, MAX_AMBIENT_TEMP, CHASSIS_THERMAL_SYSFS_FOLDER + from sonic_platform import utils + + utils.read_int_from_file = mock.MagicMock(side_effect=Exception('')) + assert Thermal.get_min_amb_temperature() == MAX_AMBIENT_TEMP + + mock_file_content = {} + def mock_read_int_from_file(file_path, default=0, raise_exception=False): + return mock_file_content[file_path] + + utils.read_int_from_file = mock_read_int_from_file + mock_file_content[os.path.join(CHASSIS_THERMAL_SYSFS_FOLDER, 'fan_amb')] = 50 + mock_file_content[os.path.join(CHASSIS_THERMAL_SYSFS_FOLDER, 'port_amb')] = 40 + assert Thermal.get_min_amb_temperature() == 40 + + @mock.patch('sonic_platform.utils.write_file') + def test_set_cooling_level(self, mock_write_file): + from sonic_platform.thermal import Thermal, COOLING_STATE_PATH + Thermal.set_cooling_level(10) + calls = [mock.call(COOLING_STATE_PATH, 20, raise_exception=True)] + mock_write_file.assert_has_calls(calls) + + pre_call_count = mock_write_file.call_count + Thermal.set_cooling_level(10) + assert pre_call_count == mock_write_file.call_count + + Thermal.set_cooling_level(9) + calls = [mock.call(COOLING_STATE_PATH, 19, raise_exception=True)] + mock_write_file.assert_has_calls(calls) + + @mock.patch('sonic_platform.utils.write_file') + def test_set_cooling_state(self, mock_write_file): + from sonic_platform.thermal import Thermal, COOLING_STATE_PATH + Thermal.set_cooling_state(10) + calls = [mock.call(COOLING_STATE_PATH, 10, raise_exception=True)] + mock_write_file.assert_has_calls(calls) + + pre_call_count = mock_write_file.call_count + Thermal.set_cooling_state(10) + assert pre_call_count == mock_write_file.call_count + + Thermal.set_cooling_state(9) + calls = [mock.call(COOLING_STATE_PATH, 9, raise_exception=True)] + mock_write_file.assert_has_calls(calls) + + @mock.patch('sonic_platform.utils.read_int_from_file') + def test_get_cooling_level(self, mock_read_file): + from sonic_platform.thermal import Thermal, COOLING_STATE_PATH + Thermal.get_cooling_level() + mock_read_file.assert_called_with(COOLING_STATE_PATH, raise_exception=True) + + mock_read_file.side_effect = IOError('') + with pytest.raises(RuntimeError): + Thermal.get_cooling_level() + + mock_read_file.side_effect = ValueError('') + with pytest.raises(RuntimeError): + Thermal.get_cooling_level() \ No newline at end of file diff --git a/platform/mellanox/mlnx-platform-api/tests/test_thermal_policy.py b/platform/mellanox/mlnx-platform-api/tests/test_thermal_policy.py index e2fb26cf6083..ffdc6afbb0a9 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_thermal_policy.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_thermal_policy.py @@ -1,8 +1,24 @@ +# +# Copyright (c) 2020-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# import os import sys import pytest import json -from mock import MagicMock +from mock import MagicMock, patch from .mock_platform import MockChassis, MockFan, MockFanDrawer, MockPsu test_path = os.path.dirname(os.path.abspath(__file__)) @@ -11,11 +27,8 @@ from sonic_platform.thermal_manager import ThermalManager from sonic_platform.thermal_infos import FanInfo, PsuInfo -from sonic_platform.fan import Fan -from sonic_platform.thermal import Thermal - -Thermal.check_thermal_zone_temperature = MagicMock() -Thermal.set_thermal_algorithm_status = MagicMock() +from sonic_platform.thermal import Thermal, MAX_COOLING_LEVEL +from sonic_platform.device_data import DeviceDataManager @pytest.fixture(scope='session', autouse=True) @@ -81,56 +94,65 @@ def test_psu_info(): psu_list[0].powergood = False psu_info.collect(chassis) - assert len(psu_info.get_absence_psus()) == 1 - assert len(psu_info.get_presence_psus()) == 0 - assert psu_info.is_status_changed() + assert len(psu_info.get_absence_psus()) == 0 + assert len(psu_info.get_presence_psus()) == 1 + assert not psu_info.is_status_changed() -def test_fan_policy(thermal_manager): +@patch('sonic_platform.thermal.Thermal.monitor_asic_themal_zone', MagicMock()) +@patch('sonic_platform.thermal.Thermal.get_cooling_level', MagicMock(return_value=6)) +@patch('sonic_platform.thermal.Thermal.get_min_allowed_cooling_level_by_thermal_zone', MagicMock(return_value=2)) +@patch('sonic_platform.thermal.Thermal.set_cooling_state') +@patch('sonic_platform.thermal.Thermal.set_cooling_level') +def test_fan_policy(mock_set_cooling_level, mock_set_cooling_state, thermal_manager): + print('In test_fan_policy') + from sonic_platform.thermal import MIN_COOLING_LEVEL_FOR_NORMAL chassis = MockChassis() chassis.make_fan_absence() chassis.get_all_fan_drawers()[0].get_all_fans().append(MockFan()) + chassis.platform_name = 'some_platform' thermal_manager.run_policy(chassis) - fan_list = chassis.get_all_fan_drawers()[0].get_all_fans() - assert fan_list[1].speed == 100 - Thermal.set_thermal_algorithm_status.assert_called_with(False, False) + mock_set_cooling_level.assert_called_with(MAX_COOLING_LEVEL) + mock_set_cooling_state.assert_called_with(MAX_COOLING_LEVEL) + Thermal.expect_cooling_level = None + fan_list = chassis.get_all_fan_drawers()[0].get_all_fans() fan_list[0].presence = True - Thermal.check_thermal_zone_temperature = MagicMock(return_value=True) thermal_manager.run_policy(chassis) - Thermal.set_thermal_algorithm_status.assert_called_with(True, False) - assert Thermal.check_thermal_zone_temperature.call_count == 2 - assert fan_list[0].speed == 60 - assert fan_list[1].speed == 60 + mock_set_cooling_level.assert_called_with(6) + mock_set_cooling_state.assert_called_with(6) + Thermal.expect_cooling_level = None fan_list[0].status = False thermal_manager.run_policy(chassis) - Thermal.set_thermal_algorithm_status.assert_called_with(False, False) + mock_set_cooling_level.assert_called_with(MAX_COOLING_LEVEL) + Thermal.expect_cooling_level = None fan_list[0].status = True - Thermal.check_thermal_zone_temperature = MagicMock(return_value=False) thermal_manager.run_policy(chassis) - Thermal.set_thermal_algorithm_status.assert_called_with(True, False) - assert Thermal.check_thermal_zone_temperature.call_count == 2 - assert fan_list[0].speed == 100 - assert fan_list[1].speed == 100 + mock_set_cooling_level.assert_called_with(6) + mock_set_cooling_state.assert_called_with(6) -def test_psu_policy(thermal_manager): +@patch('sonic_platform.thermal.Thermal.monitor_asic_themal_zone', MagicMock()) +@patch('sonic_platform.thermal.Thermal.get_min_allowed_cooling_level_by_thermal_zone', MagicMock(return_value=2)) +@patch('sonic_platform.thermal.Thermal.get_cooling_level', MagicMock(return_value=6)) +@patch('sonic_platform.thermal.Thermal.set_cooling_state') +@patch('sonic_platform.thermal.Thermal.set_cooling_level') +def test_psu_policy(mock_set_cooling_level, mock_set_cooling_state, thermal_manager): chassis = MockChassis() chassis.make_psu_absence() - chassis.fan_list.append(MockFan()) + chassis.platform_name = 'some_platform' thermal_manager.run_policy(chassis) - - fan_list = chassis.get_all_fans() - assert fan_list[0].speed == 100 - Thermal.set_thermal_algorithm_status.assert_called_with(False, False) + mock_set_cooling_level.assert_called_with(MAX_COOLING_LEVEL) + mock_set_cooling_state.assert_called_with(MAX_COOLING_LEVEL) psu_list = chassis.get_all_psus() psu_list[0].presence = True thermal_manager.run_policy(chassis) - Thermal.set_thermal_algorithm_status.assert_called_with(True, False) + mock_set_cooling_level.assert_called_with(6) + mock_set_cooling_state.assert_called_with(6) def test_any_fan_absence_condition(): @@ -301,6 +323,7 @@ def test_load_set_fan_speed_action(): action.load_from_json(json_obj) +@patch('sonic_platform.thermal.Thermal.set_cooling_level', MagicMock()) def test_execute_set_fan_speed_action(): chassis = MockChassis() chassis.get_all_fan_drawers().append(MockFanDrawer()) @@ -310,84 +333,13 @@ def test_execute_set_fan_speed_action(): fan_info = FanInfo() fan_info.collect(chassis) + Thermal.expect_cooling_level = None from sonic_platform.thermal_actions import SetAllFanSpeedAction action = SetAllFanSpeedAction() - action.speed = 99 - action.execute({'fan_info': fan_info}) - assert fan_list[0].speed == 99 - assert fan_list[1].speed == 99 - - -def test_load_control_thermal_algo_action(): - from sonic_platform.thermal_actions import ControlThermalAlgoAction - action = ControlThermalAlgoAction() - json_str = '{\"status\": \"false\"}' - json_obj = json.loads(json_str) - action.load_from_json(json_obj) - assert not action.status - - json_str = '{\"status\": \"true\"}' - json_obj = json.loads(json_str) - action.load_from_json(json_obj) - assert action.status - - json_str = '{\"status\": \"invalid\"}' - json_obj = json.loads(json_str) - with pytest.raises(ValueError): - action.load_from_json(json_obj) - - json_str = '{\"invalid\": \"true\"}' - json_obj = json.loads(json_str) - with pytest.raises(ValueError): - action.load_from_json(json_obj) - -def test_load_check_and_set_speed_action(): - from sonic_platform.thermal_actions import CheckAndSetAllFanSpeedAction - action = CheckAndSetAllFanSpeedAction() - json_str = '{\"speed\": \"40\"}' - json_obj = json.loads(json_str) - action.load_from_json(json_obj) - assert action.speed == 40 - - json_str = '{\"speed\": \"-1\"}' - json_obj = json.loads(json_str) - with pytest.raises(ValueError): - action.load_from_json(json_obj) - - json_str = '{\"speed\": \"101\"}' - json_obj = json.loads(json_str) - with pytest.raises(ValueError): - action.load_from_json(json_obj) - - json_str = '{\"invalid\": \"60\"}' - json_obj = json.loads(json_str) - with pytest.raises(ValueError): - action.load_from_json(json_obj) - -def test_execute_check_and_set_fan_speed_action(): - chassis = MockChassis() - chassis.get_all_fan_drawers().append(MockFanDrawer()) - fan_list = chassis.get_all_fan_drawers()[0].get_all_fans() - fan_list.append(MockFan()) - fan_list.append(MockFan()) - fan_info = FanInfo() - fan_info.collect(chassis) - Thermal.check_thermal_zone_temperature = MagicMock(return_value=True) - - from sonic_platform.thermal_actions import CheckAndSetAllFanSpeedAction - action = CheckAndSetAllFanSpeedAction() - action.speed = 99 + action.speed = 20 action.execute({'fan_info': fan_info}) - assert fan_list[0].speed == 99 - assert fan_list[1].speed == 99 + assert Thermal.expect_cooling_level == 2 - Thermal.check_thermal_zone_temperature = MagicMock(return_value=False) - fan_list[0].speed = 100 - fan_list[1].speed = 100 - action.speed = 60 - action.execute({'fan_info': fan_info}) - assert fan_list[0].speed == 100 - assert fan_list[1].speed == 100 def test_load_duplicate_condition(): from sonic_platform_base.sonic_thermal_control.thermal_policy import ThermalPolicy @@ -428,7 +380,7 @@ class MockThermalManager(ThermalManagerBase): with pytest.raises(Exception): MockThermalManager.load(os.path.join(test_path, 'policy_with_same_conditions.json')) - + def test_dynamic_minimum_table_data(): from sonic_platform.device_data import DEVICE_DATA for platform, platform_data in DEVICE_DATA.items(): @@ -453,7 +405,7 @@ def check_minimum_table_data(platform, minimum_table): for item in data_list: cooling_level = item[0] range_str = item[1] - + ranges = range_str.split(':') low = int(ranges[0]) high = int(ranges[1]) @@ -470,48 +422,89 @@ def check_minimum_table_data(platform, minimum_table): assert cooling_level > previous_cooling_level previous_cooling_level = cooling_level -def test_dynamic_minimum_policy(thermal_manager): - from sonic_platform.thermal_conditions import MinCoolingLevelChangeCondition - from sonic_platform.thermal_actions import ChangeMinCoolingLevelAction +@patch('sonic_platform.thermal.Thermal.monitor_asic_themal_zone', MagicMock()) +@patch('sonic_platform.device_data.DeviceDataManager.get_platform_name') +@patch('sonic_platform.thermal.Thermal.get_min_allowed_cooling_level_by_thermal_zone') +@patch('sonic_platform.thermal.Thermal.get_min_amb_temperature') +@patch('sonic_platform.thermal.Thermal.check_module_temperature_trustable') +def test_thermal_recover_policy(mock_check_trustable, mock_get_min_amb, moc_get_min_allowed, mock_platform_name): from sonic_platform.thermal_infos import ChassisInfo - from sonic_platform.thermal import Thermal - from sonic_platform.fan import Fan - ThermalManager.initialize() - assert 'DynamicMinCoolingLevelPolicy' in thermal_manager._policy_dict - policy = thermal_manager._policy_dict['DynamicMinCoolingLevelPolicy'] - assert MinCoolingLevelChangeCondition in policy.conditions - assert ChangeMinCoolingLevelAction in policy.actions - - condition = policy.conditions[MinCoolingLevelChangeCondition] - action = policy.actions[ChangeMinCoolingLevelAction] - Thermal.check_module_temperature_trustable = MagicMock(return_value='trust') - Thermal.get_min_amb_temperature = MagicMock(return_value=35001) - assert condition.is_match(None) - assert MinCoolingLevelChangeCondition.trust_state == 'trust' - assert MinCoolingLevelChangeCondition.temperature == 35 - assert not condition.is_match(None) - - Thermal.check_module_temperature_trustable = MagicMock(return_value='untrust') - assert condition.is_match(None) - assert MinCoolingLevelChangeCondition.trust_state == 'untrust' - - Thermal.get_min_amb_temperature = MagicMock(return_value=25999) - assert condition.is_match(None) - assert MinCoolingLevelChangeCondition.temperature == 25 - + from sonic_platform.thermal_actions import ThermalRecoverAction chassis = MockChassis() - chassis.platform_name = 'invalid' + mock_platform_name.return_value = 'invalid' info = ChassisInfo() info._chassis = chassis thermal_info_dict = {ChassisInfo.INFO_NAME: info} - Fan.get_cooling_level = MagicMock(return_value=5) - Fan.set_cooling_level = MagicMock() + + Thermal.expect_cooling_level = None + action = ThermalRecoverAction() + moc_get_min_allowed.return_value = 2 action.execute(thermal_info_dict) - assert Fan.min_cooling_level == 6 - Fan.set_cooling_level.assert_called_with(6, 6) - Fan.set_cooling_level.call_count = 0 + assert Thermal.expect_cooling_level == 6 + Thermal.last_set_cooling_level = Thermal.expect_cooling_level + + Thermal.expect_cooling_level = None + mock_platform_name.return_value = 'x86_64-mlnx_msn2700-r0' + mock_check_trustable.return_value = 'trust' + mock_get_min_amb.return_value = 29999 + moc_get_min_allowed.return_value = None + action.execute(thermal_info_dict) + assert Thermal.expect_cooling_level is None + + moc_get_min_allowed.return_value = 4 + action.execute(thermal_info_dict) + assert Thermal.expect_cooling_level == 4 + Thermal.last_set_cooling_level = Thermal.expect_cooling_level - chassis.platform_name = 'x86_64-mlnx_msn2700-r0' + mock_check_trustable.return_value = 'untrust' + mock_get_min_amb.return_value = 31001 action.execute(thermal_info_dict) - assert Fan.min_cooling_level == 3 - Fan.set_cooling_level.assert_called_with(3, 5) + assert Thermal.expect_cooling_level == 5 + + +@patch('sonic_platform.thermal.Thermal.set_cooling_state') +@patch('sonic_platform.utils.read_int_from_file') +def test_monitor_asic_themal_zone(mock_read_int, mock_set_cooling_state): + mock_read_int.side_effect = [111000, 105000] + Thermal.monitor_asic_themal_zone() + assert Thermal.expect_cooling_state == MAX_COOLING_LEVEL + Thermal.commit_cooling_level({}) + mock_set_cooling_state.assert_called_with(MAX_COOLING_LEVEL) + mock_read_int.reset() + mock_read_int.side_effect = [104000, 105000] + Thermal.monitor_asic_themal_zone() + assert Thermal.expect_cooling_state is None + + +def test_set_expect_cooling_level(): + Thermal.set_expect_cooling_level(5) + assert Thermal.expect_cooling_level == 5 + + Thermal.set_expect_cooling_level(3) + assert Thermal.expect_cooling_level == 5 + + Thermal.set_expect_cooling_level(10) + assert Thermal.expect_cooling_level == 10 + + +@patch('sonic_platform.thermal.Thermal.commit_cooling_level', MagicMock()) +@patch('sonic_platform.thermal_conditions.AnyFanFaultCondition.is_match') +@patch('sonic_platform.thermal_manager.ThermalManager._collect_thermal_information') +@patch('sonic_platform.thermal.Thermal.set_expect_cooling_level') +def test_run_policy(mock_expect, mock_collect_info, mock_match, thermal_manager): + chassis = MockChassis() + mock_collect_info.side_effect = Exception('') + thermal_manager.run_policy(chassis) + mock_expect.assert_called_with(MAX_COOLING_LEVEL) + + mock_collect_info.side_effect = None + mock_expect.reset_mock() + mock_match.side_effect = Exception('') + thermal_manager.run_policy(chassis) + mock_expect.assert_called_with(MAX_COOLING_LEVEL) + + thermal_manager.stop() + mock_expect.reset_mock() + thermal_manager.run_policy(chassis) + assert mock_expect.call_count == 0 + diff --git a/platform/mellanox/mlnx-platform-api/tests/test_utils.py b/platform/mellanox/mlnx-platform-api/tests/test_utils.py new file mode 100644 index 000000000000..7da17dc5e7bc --- /dev/null +++ b/platform/mellanox/mlnx-platform-api/tests/test_utils.py @@ -0,0 +1,118 @@ +# +# Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +import pytest +import sys +if sys.version_info.major == 3: + from unittest import mock +else: + import mock + +test_path = os.path.dirname(os.path.abspath(__file__)) +modules_path = os.path.dirname(test_path) +sys.path.insert(0, modules_path) + +from sonic_platform import utils + + +class TestUtils: + def test_read_file(self): + ret = utils.read_str_from_file('not exist', 'default return') + assert ret == 'default return' + + with pytest.raises(IOError): + ret = utils.read_str_from_file('not exist', 'default return', raise_exception=True) + assert ret == 'default return' + + ret = utils.read_int_from_file('not exist', 100) + assert ret == 100 + + with pytest.raises(IOError): + ret = utils.read_int_from_file('not exist', 200, raise_exception=True) + assert ret == 200 + + ret = utils.read_float_from_file('not exist', 3.14) + assert ret == 3.14 + + with pytest.raises(IOError): + ret = utils.read_float_from_file('not exist', 2.25, raise_exception=True) + assert ret == 2.25 + + def test_write_file(self): + file_path = '/tmp/test.txt' + utils.write_file(file_path, ' hello ') + assert utils.read_str_from_file(file_path) == 'hello' + + utils.write_file(file_path, '123 ') + assert utils.read_int_from_file(file_path) == 123 + + utils.write_file(file_path, '3.14 ') + assert utils.read_float_from_file(file_path) == 3.14 + + with pytest.raises(IOError): + utils.write_file('/not/exist/file', '123', raise_exception=True) + + def test_pre_initialize(self): + mock_call = mock.MagicMock() + + class A: + @utils.pre_initialize(mock_call) + def func(self): + pass + + A().func() + assert mock_call.call_count == 1 + + def test_pre_initialize_one(self): + mock_call = mock.MagicMock() + + class A: + @utils.pre_initialize_one(mock_call) + def func(self, index): + pass + + a = A() + a.func(34) + mock_call.assert_called_once_with(a, 34) + + def test_read_only_cache(self): + value = 100 + + def func(): + return value + + assert func() == 100 + value = 1000 + assert func() == 1000 + + @utils.read_only_cache() + def func(): + return value + + assert func() == 1000 + value = 10000 + assert func() == 1000 + + @mock.patch('sonic_py_common.logger.Logger.log_debug') + def test_default_return(self, mock_log): + @utils.default_return(100, log_func=mock_log) + def func(): + raise RuntimeError('') + + assert func() == 100 + assert mock_log.call_count == 1 diff --git a/platform/mellanox/mlnx-platform-api/tests/thermal_policy.json b/platform/mellanox/mlnx-platform-api/tests/thermal_policy.json index 413211b21220..5155c0718522 100644 --- a/platform/mellanox/mlnx-platform-api/tests/thermal_policy.json +++ b/platform/mellanox/mlnx-platform-api/tests/thermal_policy.json @@ -23,10 +23,6 @@ } ], "actions": [ - { - "type": "thermal_control.control", - "status": "false" - }, { "type": "fan.all.set_speed", "speed": "100" @@ -41,10 +37,6 @@ } ], "actions": [ - { - "type": "thermal_control.control", - "status": "false" - }, { "type": "fan.all.set_speed", "speed": "100" @@ -59,10 +51,6 @@ } ], "actions": [ - { - "type": "thermal_control.control", - "status": "false" - }, { "type": "fan.all.set_speed", "speed": "100" @@ -84,12 +72,8 @@ ], "actions": [ { - "type": "thermal_control.control", + "type": "thermal.recover", "status": "true" - }, - { - "type": "fan.all.check_and_set_speed", - "speed": "60" } ] } diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 2570a2d0fefe..c8a394e1f355 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,6 +1,6 @@ # Mellanox SAI -MLNX_SAI_VERSION = SAIRel1.19.2 +MLNX_SAI_VERSION = SAIRel1.20.2.5 export MLNX_SAI_VERSION diff --git a/platform/mellanox/mlnx-sai/SAI-Implementation b/platform/mellanox/mlnx-sai/SAI-Implementation index 971a8448dadf..0f9cf1d39107 160000 --- a/platform/mellanox/mlnx-sai/SAI-Implementation +++ b/platform/mellanox/mlnx-sai/SAI-Implementation @@ -1 +1 @@ -Subproject commit 971a8448dadff061a0d8af5d79e00a20ebaf769d +Subproject commit 0f9cf1d39107f2d8f78c4b2807aa4e32862cca68 diff --git a/platform/mellanox/mlnx-ssd-fw-update.mk b/platform/mellanox/mlnx-ssd-fw-update.mk index 024710efbf9b..b39056eb5a6b 100644 --- a/platform/mellanox/mlnx-ssd-fw-update.mk +++ b/platform/mellanox/mlnx-ssd-fw-update.mk @@ -1,3 +1,19 @@ +# +# Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# # ssd update tool MLNX_SSD_FW_UPDATE = mlnx-ssd-fw-update.sh diff --git a/platform/mellanox/mlnx-ssd-fw-update.sh b/platform/mellanox/mlnx-ssd-fw-update.sh index 4a2204adacf8..07ec9ce103ea 100755 --- a/platform/mellanox/mlnx-ssd-fw-update.sh +++ b/platform/mellanox/mlnx-ssd-fw-update.sh @@ -1,36 +1,22 @@ #!/bin/bash -######################################################################## -# Copyright (c) 2020 Mellanox Technologies. All rights reserved. # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: +# Copyright (c) 2020-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 # -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the names of the copyright holders nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Alternatively, this software may be distributed under the terms of the -# GNU General Public License ("GPL") version 2 as published by the Free -# Software Foundation. +# http://www.apache.org/licenses/LICENSE-2.0 # -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # + #==============================================================================# #= Global variable # #= @@ -62,6 +48,7 @@ ARG_IMAGE_VAL="" ARG_QUERY_FLAG=$FALSE ARG_YES_FLAG=$FALSE ARG_POWER_CYCLE_FLAG=$FALSE +ARG_FORCE_POWER_CYCLE_FLAG=$FALSE ARG_HELP_FLAG=$FALSE ARG_VERSION_FLAG=$FALSE ARG_PACKAGE_INFO_FLAG=$FALSE @@ -192,6 +179,10 @@ function check_usage() { ARG_POWER_CYCLE_FLAG=$TRUE shift # past argument ;; + --no-power-cycle) + ARG_FORCE_NO_POWER_CYCLE_FLAG=$TRUE + shift # past argument + ;; *) LOG_MSG "Error: false usage given." usage @@ -211,6 +202,7 @@ function check_usage() { ("$ARG_UPDATE_FLAG" == "$TRUE" && "$ARG_IMAGE_FLAG" == "$FALSE") || ("$ARG_PACKAGE_INFO_FLAG" == "$TRUE" && "$ARG_IMAGE_FLAG" == "$FALSE") || ("$ARG_POWER_CYCLE_FLAG" == "$TRUE" && "$ARG_UPDATE_FLAG" == "$FALSE") || + ("$ARG_FORCE_NO_POWER_CYCLE_FLAG" == "$TRUE" && "$ARG_POWER_CYCLE_FLAG" == "$TRUE") || ("$ARG_UPDATE_FLAG" == "$TRUE" && "$ARG_PACKAGE_INFO_FLAG" == "$TRUE") ]]; then LOG_MSG "Error: false usage given." @@ -227,6 +219,7 @@ function check_usage() { LOG_MSG "ARG_VERSION_FLAG = ${ARG_VERSION_FLAG}" ${DEBUG_MSG} LOG_MSG "ARG_PACKAGE_INFO_FLAG = ${ARG_PACKAGE_INFO_FLAG}" ${DEBUG_MSG} LOG_MSG "ARG_POWER_CYCLE_FLAG = ${ARG_POWER_CYCLE_FLAG}" ${DEBUG_MSG} + LOG_MSG "ARG_FORCE_NO_POWER_CYCLE_FLAG = ${ARG_FORCE_NO_POWER_CYCLE_FLAG}" ${DEBUG_MSG} } @@ -294,12 +287,12 @@ function get_ssd_info() { #= function check_tool_dependencies() { LOG_MSG "func: ${FUNCNAME[0]}()" ${DEBUG_MSG} - for i in "${!DEPENDECIES[@]}" - do - if [ ! -x "$(command -v ${DEPENDECIES[$i]})" ]; then - LOG_MSG_AND_EXIT "Error: This tool require the following utils to be installed ${DEPENDECIES[$i]}" - fi - done + for i in "${!DEPENDECIES[@]}" + do + if [ ! -x "$(command -v ${DEPENDECIES[$i]})" ]; then + LOG_MSG_AND_EXIT "Error: This tool require the following utils to be installed ${DEPENDECIES[$i]}" + fi + done } #==============================================================================# @@ -687,7 +680,12 @@ elif [ $ARG_UPDATE_FLAG == $TRUE ]; then if [ ! -f $ssd_script_path ]; then LOG_MSG_AND_EXIT "Error: fail to call upgrade script ($ssd_script_path)!" fi - ( + ( + if [[ "yes" == "$power_policy" && $ARG_FORCE_NO_POWER_CYCLE_FLAG == $TRUE ]]; then + # If a power cycle is required and we are not power cycling automatically lock the file system for safety + LOG_MSG "Immediate power cycle is required but override flag has been given. Locking file system as read only to protect system integrity." + echo u > /proc/sysrq-trigger + fi cd "${extraction_path}/${section}" > /dev/null 2>&1 || exit /bin/bash "$ssd_script_path" "${extraction_path}/${section}" #cd - > /dev/null 2>&1 || exit @@ -698,6 +696,11 @@ elif [ $ARG_UPDATE_FLAG == $TRUE ]; then LOG_MSG "SSD FW update completed successfully." if [[ "yes" == "$power_policy" || $ARG_POWER_CYCLE_FLAG == $TRUE ]]; then + + if [[ $ARG_FORCE_NO_POWER_CYCLE_FLAG == $TRUE ]]; then + LOG_MSG_AND_EXIT "An IMMEDIATE power cycle is REQUIRED to upgrade the SSD. Please perform a cold reboot as soon as possible." + fi + LOG_MSG "Execute power cycle..." sleep 1 sync diff --git a/platform/mellanox/one-image.mk b/platform/mellanox/one-image.mk index 0f69b7335bf1..ad912e260d1e 100644 --- a/platform/mellanox/one-image.mk +++ b/platform/mellanox/one-image.mk @@ -1,3 +1,19 @@ +# +# Copyright (c) 2017-2021 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# # sonic mellanox one image installer SONIC_ONE_IMAGE = sonic-mellanox.bin diff --git a/platform/mellanox/peripheral_table.j2 b/platform/mellanox/peripheral_table.j2 index 730fd681bc61..d2c1d5e9059a 100644 --- a/platform/mellanox/peripheral_table.j2 +++ b/platform/mellanox/peripheral_table.j2 @@ -1,3 +1,19 @@ +{# + Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. + Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +#} {%- if DEVICE_METADATA is defined and DEVICE_METADATA['localhost']['platform'] is defined %} {%- set platform = DEVICE_METADATA['localhost']['platform'] %} {%- endif -%} diff --git a/platform/mellanox/rules.dep b/platform/mellanox/rules.dep index 409857592159..5dce51d83bb5 100644 --- a/platform/mellanox/rules.dep +++ b/platform/mellanox/rules.dep @@ -15,3 +15,4 @@ include $(PLATFORM_PATH)/mlnx-ffb.dep include $(PLATFORM_PATH)/issu-version.dep include $(PLATFORM_PATH)/mlnx-onie-fw-update.dep include $(PLATFORM_PATH)/mlnx-ssd-fw-update.dep +include $(PLATFORM_PATH)/install-pending-fw.dep diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index 179e20f3fff5..a6fc81b3beb4 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -1,3 +1,19 @@ +# +# Copyright (c) 2016-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# include $(PLATFORM_PATH)/sdk.mk include $(PLATFORM_PATH)/fw.mk include $(PLATFORM_PATH)/mft.mk @@ -13,6 +29,7 @@ include $(PLATFORM_PATH)/mlnx-ffb.mk include $(PLATFORM_PATH)/issu-version.mk include $(PLATFORM_PATH)/mlnx-onie-fw-update.mk include $(PLATFORM_PATH)/mlnx-ssd-fw-update.mk +include $(PLATFORM_PATH)/install-pending-fw.mk SONIC_ALL += $(SONIC_ONE_IMAGE) \ $(DOCKER_FPM) diff --git a/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers b/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers index 726bef49c07a..37475d91930e 160000 --- a/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers +++ b/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers @@ -1 +1 @@ -Subproject commit 726bef49c07a1a0d7c52d8e3062e95ec6efa736f +Subproject commit 37475d91930e3aae3490a4423da280a5cae72407 diff --git a/platform/mellanox/sdk-src/sxd-libs/Makefile b/platform/mellanox/sdk-src/sxd-libs/Makefile index 0b142c920828..892974e75e5f 100644 --- a/platform/mellanox/sdk-src/sxd-libs/Makefile +++ b/platform/mellanox/sdk-src/sxd-libs/Makefile @@ -20,7 +20,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : ./autogen.sh fi - debuild -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) + debuild -e 'configure_options=--enable-sniffer=yes' -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) popd diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index 3c5a46a76767..08051e5ca0c7 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,6 +1,22 @@ +# +# Copyright (c) 2016-2022 NVIDIA CORPORATION & AFFILIATES. +# Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# MLNX_SDK_BASE_PATH = $(PLATFORM_PATH)/sdk-src/sx-kernel/Switch-SDK-drivers/bin/ MLNX_SDK_PKG_BASE_PATH = $(MLNX_SDK_BASE_PATH)/$(BLDENV)/ -MLNX_SDK_VERSION = 4.4.3326 +MLNX_SDK_VERSION = 4.5.1208 MLNX_SDK_ISSU_VERSION = 101 MLNX_SDK_DEB_VERSION = $(subst -,.,$(subst _,.,$(MLNX_SDK_VERSION))) diff --git a/platform/mellanox/zero_profiles.j2 b/platform/mellanox/zero_profiles.j2 new file mode 100644 index 000000000000..a953c18409b2 --- /dev/null +++ b/platform/mellanox/zero_profiles.j2 @@ -0,0 +1,57 @@ +[ + { + "BUFFER_POOL_TABLE:ingress_zero_pool": { + "mode": "static", + "type": "ingress", + "size": "0" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:ingress_lossy_pg_zero_profile" : { + "pool":"ingress_zero_pool", + "size":"0", + "static_th":"0" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:ingress_lossy_zero_profile" : { + "pool":"ingress_lossy_pool", + "size":"0", + "dynamic_th":"-8" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:ingress_lossless_zero_profile" : { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"-8" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:egress_lossy_zero_profile" : { + "pool":"egress_lossy_pool", + "size":"0", + "dynamic_th":"-8" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:egress_lossless_zero_profile" : { + "pool":"egress_lossless_pool", + "size":"0", + "dynamic_th":"-8" + }, + "OP": "SET" + }, + { + "control_fields" : { + "pgs_to_apply_zero_profile":"0", + "ingress_zero_profile":"ingress_lossy_pg_zero_profile" + }, + "OP": "SET" + } +] diff --git a/platform/nephos/docker-syncd-nephos-rpc.mk b/platform/nephos/docker-syncd-nephos-rpc.mk index 94ba95b15dca..5ead18609db9 100644 --- a/platform/nephos/docker-syncd-nephos-rpc.mk +++ b/platform/nephos/docker-syncd-nephos-rpc.mk @@ -18,7 +18,7 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_NEPHOS_RPC) endif $(DOCKER_SYNCD_NEPHOS_RPC)_CONTAINER_NAME = syncd -$(DOCKER_SYNCD_NEPHOS_RPC)_VERSION = 1.0.0-rpc +$(DOCKER_SYNCD_NEPHOS_RPC)_VERSION = 1.0.0+rpc $(DOCKER_SYNCD_NEPHOS_RPC)_PACKAGE_NAME = syncd $(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_NEPHOS_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf diff --git a/platform/pddf/i2c/Makefile b/platform/pddf/i2c/Makefile index 1486370b5005..092c11539723 100644 --- a/platform/pddf/i2c/Makefile +++ b/platform/pddf/i2c/Makefile @@ -1 +1 @@ -subdir-m := modules +obj-m := modules/ diff --git a/platform/pddf/i2c/debian/rules b/platform/pddf/i2c/debian/rules index 35fca9a784ad..edca93ee06a8 100755 --- a/platform/pddf/i2c/debian/rules +++ b/platform/pddf/i2c/debian/rules @@ -12,13 +12,13 @@ include /usr/share/dpkg/pkg-info.mk export INSTALL_MOD_DIR:=extra -PYTHON ?= python2 +PYTHON ?= python3 PACKAGE_PRE_NAME := sonic-platform-pddf KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= client cpld cpld/driver cpldmux cpldmux/driver fan fan/driver fan/vendor_api mux gpio led psu psu/driver sysstatus xcvr xcvr/driver +MODULE_DIRS:= client cpld cpld/driver cpldmux cpldmux/driver fan fan/driver mux gpio led psu psu/driver sysstatus xcvr xcvr/driver MODULE_DIR:= modules UTILS_DIR := utils SERVICE_DIR := service @@ -35,8 +35,10 @@ clean: make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR) clean build: + set -e; \ make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR); \ $(PYTHON) $(MOD_SRC_DIR)/setup.py build; \ + set +e binary: binary-arch binary-indep # Nothing to do @@ -50,11 +52,15 @@ binary-indep: dh_installdirs -p$(PACKAGE_PRE_NAME) $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ dh_installdirs -p$(PACKAGE_PRE_NAME) usr/local/bin; \ # Custom package commands + set -e; \ (for mod in $(MODULE_DIRS); do \ cp $(MOD_SRC_DIR)/$(MODULE_DIR)/$${mod}/*.ko debian/$(PACKAGE_PRE_NAME)/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ done) ; \ + # Need to take a backup of symvers file for compilation of custom modules in various platforms + cp $(MOD_SRC_DIR)/Module.symvers $(MOD_SRC_DIR)/Module.symvers.PDDF; \ cp -r $(MOD_SRC_DIR)/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)/usr/local/bin/; \ - $(PYTHON) $(MOD_SRC_DIR)/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME) --install-layout=deb; + $(PYTHON) $(MOD_SRC_DIR)/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME) --install-layout=deb; \ + set +e # Resuming debhelper scripts dh_testroot diff --git a/platform/pddf/i2c/modules/Makefile b/platform/pddf/i2c/modules/Makefile index 67d3726c3202..ebfce193c273 100644 --- a/platform/pddf/i2c/modules/Makefile +++ b/platform/pddf/i2c/modules/Makefile @@ -1 +1 @@ -subdir-m := client cpld cpldmux xcvr mux gpio psu fan led sysstatus +obj-m := client/ cpld/ cpldmux/ xcvr/ mux/ gpio/ psu/ fan/ led/ sysstatus/ diff --git a/platform/pddf/i2c/modules/cpld/Makefile b/platform/pddf/i2c/modules/cpld/Makefile index c6182ef4f93d..2ed1697c8e24 100644 --- a/platform/pddf/i2c/modules/cpld/Makefile +++ b/platform/pddf/i2c/modules/cpld/Makefile @@ -1,4 +1,4 @@ -subdir-m := driver -obj-m := pddf_cpld_module.o +obj-m := driver/ +obj-m += pddf_cpld_module.o -CFLAGS_$(obj-m):= -I$(M)/modules/include +ccflags-y:= -I$(M)/modules/include diff --git a/platform/pddf/i2c/modules/cpld/driver/pddf_cpld_driver.c b/platform/pddf/i2c/modules/cpld/driver/pddf_cpld_driver.c index a34c370b9af1..dabc8f9d8f9c 100755 --- a/platform/pddf/i2c/modules/cpld/driver/pddf_cpld_driver.c +++ b/platform/pddf/i2c/modules/cpld/driver/pddf_cpld_driver.c @@ -30,9 +30,58 @@ static struct mutex list_lock; struct cpld_client_node { struct i2c_client *client; + char name[CPLD_CLIENT_NAME_LEN]; struct list_head list; }; +int board_i2c_cpld_read_new(unsigned short cpld_addr, char *name, u8 reg) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EPERM; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if ((cpld_node->client->addr == cpld_addr) && (strncmp(cpld_node->name, name, strlen(name)) == 0)) { + ret = i2c_smbus_read_byte_data(cpld_node->client, reg); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(board_i2c_cpld_read_new); + +int board_i2c_cpld_write_new(unsigned short cpld_addr, char *name, u8 reg, u8 value) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EIO; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if ((cpld_node->client->addr == cpld_addr) && (strncmp(cpld_node->name, name, strlen(name)) == 0)){ + ret = i2c_smbus_write_byte_data(cpld_node->client, reg, value); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(board_i2c_cpld_write_new); + int board_i2c_cpld_read(unsigned short cpld_addr, u8 reg) { struct list_head *list_node = NULL; @@ -128,7 +177,9 @@ static void board_i2c_cpld_add_client(struct i2c_client *client) } node->client = client; - + strcpy(node->name, (char *)client->dev.platform_data); + dev_dbg(&client->dev, "Adding %s to the cpld client list\n", node->name); + mutex_lock(&list_lock); list_add(&node->list, &cpld_client_list); mutex_unlock(&list_lock); @@ -188,8 +239,14 @@ static int board_i2c_cpld_probe(struct i2c_client *client, static int board_i2c_cpld_remove(struct i2c_client *client) { - sysfs_remove_group(&client->dev.kobj, &cpld_attribute_group); + /* Platform data is just a char string */ + char *platdata = (char *)client->dev.platform_data; + sysfs_remove_group(&client->dev.kobj, &cpld_attribute_group); board_i2c_cpld_remove_client(client); + if (platdata) + { + kfree(platdata); + } return 0; } diff --git a/platform/pddf/i2c/modules/cpld/pddf_cpld_module.c b/platform/pddf/i2c/modules/cpld/pddf_cpld_module.c index af15e390265f..4a933069e6d8 100644 --- a/platform/pddf/i2c/modules/cpld/pddf_cpld_module.c +++ b/platform/pddf/i2c/modules/cpld/pddf_cpld_module.c @@ -37,7 +37,7 @@ EXPORT_SYMBOL(pddf_cpld_data); static ssize_t do_device_operation(struct device *dev, struct device_attribute *da, const char *buf, size_t count); static ssize_t store_pddf_cpld_data(struct device *dev, struct device_attribute *da, const char *buf, size_t count); -ssize_t show_pddf_cpld_data(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_pddf_cpld_data(struct device *dev, struct device_attribute *da, char *buf); extern void *get_device_table(char *name); extern void delete_device_table(char *name); @@ -77,9 +77,8 @@ static ssize_t store_pddf_cpld_data(struct device *dev, struct device_attribute return count; } -EXPORT_SYMBOL(store_pddf_cpld_data); -ssize_t show_pddf_cpld_data(struct device *dev, struct device_attribute *da, char *buf) +static ssize_t show_pddf_cpld_data(struct device *dev, struct device_attribute *da, char *buf) { int ret = 0; PDDF_ATTR *ptr = (PDDF_ATTR *)da; @@ -91,7 +90,6 @@ ssize_t show_pddf_cpld_data(struct device *dev, struct device_attribute *da, cha return ret; } -EXPORT_SYMBOL(show_pddf_cpld_data); static ssize_t do_device_operation(struct device *dev, struct device_attribute *da, const char *buf, size_t count) { @@ -100,6 +98,7 @@ static ssize_t do_device_operation(struct device *dev, struct device_attribute * struct i2c_adapter *adapter; static struct i2c_board_info board_info; struct i2c_client *client_ptr; + char *pddf_cpld_name = NULL; if (strncmp(buf, "add", strlen(buf)-1)==0) { @@ -107,17 +106,19 @@ static ssize_t do_device_operation(struct device *dev, struct device_attribute * if (strncmp(device_ptr->dev_type, "i2c_cpld", strlen("i2c_cpld"))==0) { + pddf_cpld_name = (char *)kzalloc(CPLD_CLIENT_NAME_LEN, GFP_KERNEL); + if (pddf_cpld_name != NULL) strcpy(pddf_cpld_name, device_ptr->i2c_name); + board_info = (struct i2c_board_info) { - .platform_data = (void *)NULL, + .platform_data = (void *)pddf_cpld_name, }; board_info.addr = device_ptr->dev_addr; strcpy(board_info.type, device_ptr->dev_type); - /*pddf_dbg(KERN_ERR "Creating a client %s on 0x%x, platform_data 0x%x\n", board_info.type, board_info.addr, board_info.platform_data);*/ - client_ptr = i2c_new_device(adapter, &board_info); + client_ptr = i2c_new_client_device(adapter, &board_info); - if (client_ptr != NULL) { + if (!IS_ERR(client_ptr)) { i2c_put_adapter(adapter); pddf_dbg(CPLD, KERN_ERR "Created %s client: 0x%p\n", device_ptr->i2c_name, (void *)client_ptr); add_device_table(device_ptr->i2c_name, (void*)client_ptr); @@ -152,8 +153,12 @@ static ssize_t do_device_operation(struct device *dev, struct device_attribute * { printk(KERN_ERR "PDDF_ERROR: %s: Invalid value for dev_ops %s", __FUNCTION__, buf); } + goto clear_data; free_data: + if (board_info.platform_data) + kfree(board_info.platform_data); +clear_data: /*TODO: free the device_ptr->data is dynamically allocated*/ memset(device_ptr, 0 , sizeof(NEW_DEV_ATTR)); diff --git a/platform/pddf/i2c/modules/cpldmux/Makefile b/platform/pddf/i2c/modules/cpldmux/Makefile index 53816b98f750..518f225fdd3a 100644 --- a/platform/pddf/i2c/modules/cpldmux/Makefile +++ b/platform/pddf/i2c/modules/cpldmux/Makefile @@ -1,4 +1,4 @@ -subdir-m := driver -obj-m := pddf_cpldmux_module.o +obj-m := driver/ +obj-m += pddf_cpldmux_module.o -CFLAGS_$(obj-m):= -I$(M)/modules/include +ccflags-y:= -I$(M)/modules/include diff --git a/platform/pddf/i2c/modules/cpldmux/driver/pddf_cpldmux_driver.c b/platform/pddf/i2c/modules/cpldmux/driver/pddf_cpldmux_driver.c index c9df1a60c1af..2c914b92b1b0 100755 --- a/platform/pddf/i2c/modules/cpldmux/driver/pddf_cpldmux_driver.c +++ b/platform/pddf/i2c/modules/cpldmux/driver/pddf_cpldmux_driver.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include "pddf_client_defs.h" diff --git a/platform/pddf/i2c/modules/fan/Makefile b/platform/pddf/i2c/modules/fan/Makefile index 94b6b146c51d..acd0bf5f411b 100644 --- a/platform/pddf/i2c/modules/fan/Makefile +++ b/platform/pddf/i2c/modules/fan/Makefile @@ -1,4 +1,4 @@ -subdir-m := driver -obj-m := pddf_fan_module.o +obj-m := driver/ +obj-m += pddf_fan_module.o -CFLAGS_$(obj-m):= -I$(M)/modules/include +ccflags-y:= -I$(M)/modules/include diff --git a/platform/pddf/i2c/modules/fan/driver/pddf_fan_api.c b/platform/pddf/i2c/modules/fan/driver/pddf_fan_api.c index 167b0e183315..0fecee963ed2 100644 --- a/platform/pddf/i2c/modules/fan/driver/pddf_fan_api.c +++ b/platform/pddf/i2c/modules/fan/driver/pddf_fan_api.c @@ -64,20 +64,20 @@ int fan_update_hw(struct device *dev, struct fan_attr_info *info, FAN_DATA_ATTR { status = (sysfs_attr_data->pre_set)(client, udata, info); if (status!=0) - printk(KERN_ERR "%s: pre_set function fails for %s attribute\n", __FUNCTION__, udata->aname); + dev_warn(&client->dev, "%s: pre_set function fails for %s attribute. ret %d\n", __FUNCTION__, udata->aname, status); } if (sysfs_attr_data->do_set != NULL) { status = (sysfs_attr_data->do_set)(client, udata, info); if (status!=0) - printk(KERN_ERR "%s: do_set function fails for %s attribute\n", __FUNCTION__, udata->aname); + dev_warn(&client->dev, "%s: do_set function fails for %s attribute. ret %d\n", __FUNCTION__, udata->aname, status); } if (sysfs_attr_data->post_set != NULL) { status = (sysfs_attr_data->post_set)(client, udata, info); if (status!=0) - printk(KERN_ERR "%s: post_set function fails for %s attribute\n", __FUNCTION__, udata->aname); + dev_warn(&client->dev, "%s: post_set function fails for %s attribute. ret %d\n", __FUNCTION__, udata->aname, status); } mutex_unlock(&info->update_lock); @@ -104,20 +104,20 @@ int fan_update_attr(struct device *dev, struct fan_attr_info *info, FAN_DATA_ATT { status = (sysfs_attr_data->pre_get)(client, udata, info); if (status!=0) - printk(KERN_ERR "%s: pre_get function fails for %s attribute\n", __FUNCTION__, udata->aname); + dev_warn(&client->dev, "%s: pre_get function fails for %s attribute. ret %d\n", __FUNCTION__, udata->aname, status); } if (sysfs_attr_data->do_get != NULL) { status = (sysfs_attr_data->do_get)(client, udata, info); if (status!=0) - printk(KERN_ERR "%s: do_get function fails for %s attribute\n", __FUNCTION__, udata->aname); + dev_warn(&client->dev, "%s: do_get function fails for %s attribute. ret %d\n", __FUNCTION__, udata->aname, status); } if (sysfs_attr_data->post_get != NULL) { status = (sysfs_attr_data->post_get)(client, udata, info); if (status!=0) - printk(KERN_ERR "%s: post_get function fails for %s attribute\n", __FUNCTION__, udata->aname); + dev_warn(&client->dev, "%s: post_get function fails for %s attribute.ret %d\n", __FUNCTION__, udata->aname, status); } @@ -346,7 +346,10 @@ int sonic_i2c_get_fan_present_default(void *client, FAN_DATA_ATTR *udata, void * val = i2c_smbus_read_byte_data((struct i2c_client *)client, udata->offset); } - painfo->val.intval = ((val & udata->mask) == udata->cmpval); + if (val < 0) + status = val; + else + painfo->val.intval = ((val & udata->mask) == udata->cmpval); return status; @@ -355,7 +358,7 @@ int sonic_i2c_get_fan_present_default(void *client, FAN_DATA_ATTR *udata, void * int sonic_i2c_get_fan_rpm_default(void *client, FAN_DATA_ATTR *udata, void *info) { int status = 0; - uint32_t val = 0; + int val = 0; struct fan_attr_info *painfo = (struct fan_attr_info *)info; if (strcmp(udata->devtype, "cpld") == 0) @@ -375,10 +378,15 @@ int sonic_i2c_get_fan_rpm_default(void *client, FAN_DATA_ATTR *udata, void *info } } - if (udata->is_divisor) - painfo->val.intval = udata->mult / (val >> 3); + if (val < 0) + status = val; else - painfo->val.intval = udata->mult * val; + { + if (udata->is_divisor) + painfo->val.intval = udata->mult / (val >> 3); + else + painfo->val.intval = udata->mult * val; + } return status; } @@ -471,7 +479,7 @@ int sonic_i2c_set_fan_pwm_default(struct i2c_client *client, FAN_DATA_ATTR *udat int sonic_i2c_get_fan_pwm_default(void *client, FAN_DATA_ATTR *udata, void *info) { int status = 0; - uint32_t val = 0; + int val = 0; struct fan_attr_info *painfo = (struct fan_attr_info *)info; if (strcmp(udata->devtype, "cpld") == 0) @@ -491,15 +499,20 @@ int sonic_i2c_get_fan_pwm_default(void *client, FAN_DATA_ATTR *udata, void *info } } - val = val & udata->mask; - painfo->val.intval = val; + if (val < 0) + status = val; + else + { + val = val & udata->mask; + painfo->val.intval = val; + } return status; } int sonic_i2c_get_fan_fault_default(void *client, FAN_DATA_ATTR *udata, void *info) { int status = 0; - uint32_t val = 0; + int val = 0; struct fan_attr_info *painfo = (struct fan_attr_info *)info; /*Assuming fan fault to be denoted by 1 byte only*/ @@ -512,8 +525,10 @@ int sonic_i2c_get_fan_fault_default(void *client, FAN_DATA_ATTR *udata, void *in val = i2c_smbus_read_byte_data((struct i2c_client *)client, udata->offset); } - val = val & udata->mask; - painfo->val.intval = val; + if (val < 0) + status = val; + else + painfo->val.intval = ((val & udata->mask) == udata->cmpval); return status; } diff --git a/platform/pddf/i2c/modules/fan/driver/pddf_fan_driver.c b/platform/pddf/i2c/modules/fan/driver/pddf_fan_driver.c index da8275fccd64..45105f8707a9 100644 --- a/platform/pddf/i2c/modules/fan/driver/pddf_fan_driver.c +++ b/platform/pddf/i2c/modules/fan/driver/pddf_fan_driver.c @@ -357,7 +357,7 @@ static int pddf_fan_probe(struct i2c_client *client, goto exit_free; } - data->hwmon_dev = hwmon_device_register(&client->dev); + data->hwmon_dev = hwmon_device_register_with_info(&client->dev, client->name, NULL, NULL, NULL); if (IS_ERR(data->hwmon_dev)) { status = PTR_ERR(data->hwmon_dev); goto exit_remove; diff --git a/platform/pddf/i2c/modules/fan/pddf_fan_module.c b/platform/pddf/i2c/modules/fan/pddf_fan_module.c index b910d6b4a351..1c31fb920c04 100644 --- a/platform/pddf/i2c/modules/fan/pddf_fan_module.c +++ b/platform/pddf/i2c/modules/fan/pddf_fan_module.c @@ -159,9 +159,9 @@ static ssize_t do_device_operation(struct device *dev, struct device_attribute * board_info = i2c_get_fan_board_info(fdata, cdata); /* Populate the platform data for fan */ - client_ptr = i2c_new_device(adapter, board_info); + client_ptr = i2c_new_client_device(adapter, board_info); - if(client_ptr != NULL) + if(!IS_ERR(client_ptr)) { i2c_put_adapter(adapter); pddf_dbg(FAN, KERN_ERR "Created a %s client: 0x%p\n", cdata->i2c_name, (void *)client_ptr); diff --git a/platform/pddf/i2c/modules/gpio/Makefile b/platform/pddf/i2c/modules/gpio/Makefile index 6d48c5884731..c5e69ac7c1ff 100644 --- a/platform/pddf/i2c/modules/gpio/Makefile +++ b/platform/pddf/i2c/modules/gpio/Makefile @@ -1,4 +1,4 @@ obj-m := pddf_gpio_module.o -CFLAGS_$(obj-m):= -I$(M)/modules/include +ccflags-y := -I$(M)/modules/include diff --git a/platform/pddf/i2c/modules/gpio/pddf_gpio_module.c b/platform/pddf/i2c/modules/gpio/pddf_gpio_module.c index afd37c3927df..30eec5f185f4 100644 --- a/platform/pddf/i2c/modules/gpio/pddf_gpio_module.c +++ b/platform/pddf/i2c/modules/gpio/pddf_gpio_module.c @@ -119,10 +119,10 @@ static ssize_t do_device_operation(struct device *dev, struct device_attribute * board_info = i2c_get_gpio_board_info(gpio_ptr, device_ptr); /*pddf_dbg(KERN_ERR "Creating a client %s on 0x%x, platform_data 0x%x\n", board_info->type, board_info->addr, board_info->platform_data);*/ - client_ptr = i2c_new_device(adapter, board_info); + client_ptr = i2c_new_client_device(adapter, board_info); i2c_put_adapter(adapter); - if (client_ptr != NULL) + if (!IS_ERR(client_ptr)) { pddf_dbg(GPIO, KERN_ERR "Created %s client: 0x%p\n", device_ptr->i2c_name, (void *)client_ptr); add_device_table(device_ptr->i2c_name, (void*)client_ptr); diff --git a/platform/pddf/i2c/modules/include/pddf_cpld_defs.h b/platform/pddf/i2c/modules/include/pddf_cpld_defs.h index c312f3277f75..23b8505e666a 100644 --- a/platform/pddf/i2c/modules/include/pddf_cpld_defs.h +++ b/platform/pddf/i2c/modules/include/pddf_cpld_defs.h @@ -20,6 +20,7 @@ #ifndef __PDDF_CPLD_DEFS_H__ #define __PDDF_CPLD_DEFS_H__ +#define CPLD_CLIENT_NAME_LEN 32 /* CPLD DATA - DATA FOR CPLD CLIENT READ/WRITE*/ typedef struct CPLD_DATA { diff --git a/platform/pddf/i2c/modules/include/pddf_mux_defs.h b/platform/pddf/i2c/modules/include/pddf_mux_defs.h index c58a00e972c6..f10cb25e50c4 100644 --- a/platform/pddf/i2c/modules/include/pddf_mux_defs.h +++ b/platform/pddf/i2c/modules/include/pddf_mux_defs.h @@ -20,8 +20,6 @@ #ifndef __PAL_MUX_DEFS_H__ #define __PAL_MUX_DEFS_H__ -#include - /* MUX CLIENT DATA - PLATFORM DATA FOR PSU CLIENT */ typedef struct MUX_DATA { diff --git a/platform/pddf/i2c/modules/include/pddf_xcvr_defs.h b/platform/pddf/i2c/modules/include/pddf_xcvr_defs.h index 63de2eeae0c2..585ce8cc7334 100644 --- a/platform/pddf/i2c/modules/include/pddf_xcvr_defs.h +++ b/platform/pddf/i2c/modules/include/pddf_xcvr_defs.h @@ -115,7 +115,7 @@ enum xcvr_sysfs_attributes { XCVR_ATTR_MAX }; -extern int board_i2c_cpld_read(unsigned short cpld_addr, u8 reg); -extern int board_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value); +extern int board_i2c_cpld_read_new(unsigned short cpld_addr, char *name, u8 reg); +extern int board_i2c_cpld_write_new(unsigned short cpld_addr, char *name, u8 reg, u8 value); #endif diff --git a/platform/pddf/i2c/modules/led/Makefile b/platform/pddf/i2c/modules/led/Makefile index 0c450ec70b4c..4bb36f9b5311 100644 --- a/platform/pddf/i2c/modules/led/Makefile +++ b/platform/pddf/i2c/modules/led/Makefile @@ -1,4 +1,4 @@ TARGET := pddf_led_module obj-m := $(TARGET).o -CFLAGS_$(obj-m):= -I$(M)/modules/include +ccflags-y := -I$(M)/modules/include diff --git a/platform/pddf/i2c/modules/mux/Makefile b/platform/pddf/i2c/modules/mux/Makefile index 486e7033435f..85502608cbdd 100644 --- a/platform/pddf/i2c/modules/mux/Makefile +++ b/platform/pddf/i2c/modules/mux/Makefile @@ -1,4 +1,4 @@ obj-m := pddf_mux_module.o -CFLAGS_$(obj-m):= -I$(M)/modules/include +ccflags-y := -I$(M)/modules/include diff --git a/platform/pddf/i2c/modules/mux/pddf_mux_module.c b/platform/pddf/i2c/modules/mux/pddf_mux_module.c index b0cd9e761ca7..b1daff2b7224 100644 --- a/platform/pddf/i2c/modules/mux/pddf_mux_module.c +++ b/platform/pddf/i2c/modules/mux/pddf_mux_module.c @@ -56,72 +56,49 @@ static const struct attribute_group pddf_mux_client_data_group = { .attrs = mux_attributes, }; -struct i2c_board_info *i2c_get_mux_board_info(MUX_DATA* mdata, NEW_DEV_ATTR *device_data) -{ - static struct i2c_board_info board_info; - static struct pca954x_platform_mode platform_modes[8]; - static struct pca954x_platform_data mux_platform_data; - int num_modes, i; - - if (strncmp(device_data->dev_type, "pca9548", strlen("pca9548")) == 0) - num_modes = 8; - else if (strncmp(device_data->dev_type, "pca9546", strlen("pca9546")) == 0) - num_modes = 6; - else - { - printk(KERN_ERR "%s: Unknown type of mux device\n", __FUNCTION__); - return NULL; - } - - for(i = 0; i < num_modes; i++) { - platform_modes[i] = (struct pca954x_platform_mode) { - .adap_id = (mdata->virt_bus + i), - .deselect_on_exit = 1, - }; - } - - mux_platform_data = (struct pca954x_platform_data) { - .modes = platform_modes, - .num_modes = num_modes, - }; - - board_info = (struct i2c_board_info) { - .platform_data = &mux_platform_data, - }; - - board_info.addr = device_data->dev_addr; - strcpy(board_info.type, device_data->dev_type); - - return &board_info; -} - - static ssize_t do_device_operation(struct device *dev, struct device_attribute *da, const char *buf, size_t count) { PDDF_ATTR *ptr = (PDDF_ATTR *)da; MUX_DATA *mux_ptr = (MUX_DATA *)(ptr->addr); NEW_DEV_ATTR *device_ptr = (NEW_DEV_ATTR *)(ptr->data); struct i2c_adapter *adapter; - struct i2c_board_info *board_info; + static struct i2c_board_info board_info; struct i2c_client *client_ptr; if (strncmp(buf, "add", strlen(buf)-1)==0) { - adapter = i2c_get_adapter(device_ptr->parent_bus); - board_info = i2c_get_mux_board_info(mux_ptr, device_ptr); - - client_ptr = i2c_new_device(adapter, board_info); - - if (client_ptr != NULL) + /* Supported types are pca_9540, pca_9542, pca_9543, pca_9544, pca_9545, pca_9546, pca_9547, pca_9548, + * pca_9846, pca_9847, pca_9848, pca_9849 + */ + if ( (strncmp(device_ptr->dev_type, "pca954", 6) == 0) || + (strncmp(device_ptr->dev_type, "pca984", 6) == 0) ) { - i2c_put_adapter(adapter); - pddf_dbg(MUX, KERN_ERR "Created %s client: 0x%p\n", device_ptr->i2c_name, (void *)client_ptr); - add_device_table(device_ptr->i2c_name, (void*)client_ptr); + adapter = i2c_get_adapter(device_ptr->parent_bus); + board_info = (struct i2c_board_info) { + .platform_data = NULL, + }; + + board_info.addr = device_ptr->dev_addr; + strcpy(board_info.type, device_ptr->dev_type); + + + client_ptr = i2c_new_client_device(adapter, &board_info); + + if (!IS_ERR(client_ptr)) + { + i2c_put_adapter(adapter); + pddf_dbg(MUX, KERN_ERR "Created %s client: 0x%p\n", device_ptr->i2c_name, (void *)client_ptr); + add_device_table(device_ptr->i2c_name, (void*)client_ptr); + } + else + { + i2c_put_adapter(adapter); + goto free_data; + } } - else + else { - i2c_put_adapter(adapter); - goto free_data; + printk(KERN_ERR "%s: Unknown type of mux device %s\n", __FUNCTION__, device_ptr->dev_type); } } else if (strncmp(buf, "delete", strlen(buf)-1)==0) diff --git a/platform/pddf/i2c/modules/psu/Makefile b/platform/pddf/i2c/modules/psu/Makefile index 04db30dfb48b..354c5ae2ed06 100644 --- a/platform/pddf/i2c/modules/psu/Makefile +++ b/platform/pddf/i2c/modules/psu/Makefile @@ -1,4 +1,4 @@ -subdir-m := driver -obj-m := pddf_psu_module.o +obj-m := driver/ +obj-m += pddf_psu_module.o -CFLAGS_$(obj-m):= -I$(M)/modules/include +ccflags-y:= -I$(M)/modules/include diff --git a/platform/pddf/i2c/modules/psu/driver/pddf_psu_api.c b/platform/pddf/i2c/modules/psu/driver/pddf_psu_api.c index b6b5e306a000..b358370f800e 100644 --- a/platform/pddf/i2c/modules/psu/driver/pddf_psu_api.c +++ b/platform/pddf/i2c/modules/psu/driver/pddf_psu_api.c @@ -89,20 +89,20 @@ int psu_update_hw(struct device *dev, struct psu_attr_info *info, PSU_DATA_ATTR { status = (sysfs_attr_data->pre_set)(client, udata, info); if (status!=0) - printk(KERN_ERR "%s: pre_set function fails for %s attribute\n", __FUNCTION__, udata->aname); + dev_warn(&client->dev, "%s: pre_set function fails for %s attribute. ret %d\n", __FUNCTION__, udata->aname, status); } if (sysfs_attr_data->do_set != NULL) { status = (sysfs_attr_data->do_set)(client, udata, info); if (status!=0) - printk(KERN_ERR "%s: do_set function fails for %s attribute\n", __FUNCTION__, udata->aname); + dev_warn(&client->dev, "%s: do_set function fails for %s attribute. ret %d\n", __FUNCTION__, udata->aname, status); } if (sysfs_attr_data->post_set != NULL) { status = (sysfs_attr_data->post_set)(client, udata, info); if (status!=0) - printk(KERN_ERR "%s: post_set function fails for %s attribute\n", __FUNCTION__, udata->aname); + dev_warn(&client->dev, "%s: post_set function fails for %s attribute. ret %d\n", __FUNCTION__, udata->aname, status); } mutex_unlock(&info->update_lock); @@ -128,20 +128,20 @@ int psu_update_attr(struct device *dev, struct psu_attr_info *data, PSU_DATA_ATT { status = (sysfs_attr_data->pre_get)(client, udata, data); if (status!=0) - printk(KERN_ERR "%s: pre_get function fails for %s attribute\n", __FUNCTION__, udata->aname); + dev_warn(&client->dev, "%s: pre_get function fails for %s attribute. ret %d\n", __FUNCTION__, udata->aname, status); } if (sysfs_attr_data->do_get != NULL) { status = (sysfs_attr_data->do_get)(client, udata, data); if (status!=0) - printk(KERN_ERR "%s: do_get function fails for %s attribute\n", __FUNCTION__, udata->aname); + dev_warn(&client->dev, "%s: do_get function fails for %s attribute. ret %d\n", __FUNCTION__, udata->aname, status); } if (sysfs_attr_data->post_get != NULL) { status = (sysfs_attr_data->post_get)(client, udata, data); if (status!=0) - printk(KERN_ERR "%s: post_get function fails for %s attribute\n", __FUNCTION__, udata->aname); + dev_warn(&client->dev, "%s: post_get function fails for %s attribute. ret %d\n", __FUNCTION__, udata->aname, status); } data->last_updated = jiffies; diff --git a/platform/pddf/i2c/modules/psu/driver/pddf_psu_driver.c b/platform/pddf/i2c/modules/psu/driver/pddf_psu_driver.c index ad71e45eca20..dc7edb92a3ad 100644 --- a/platform/pddf/i2c/modules/psu/driver/pddf_psu_driver.c +++ b/platform/pddf/i2c/modules/psu/driver/pddf_psu_driver.c @@ -224,7 +224,7 @@ static int psu_probe(struct i2c_client *client, goto exit_free; } - data->hwmon_dev = hwmon_device_register(&client->dev); + data->hwmon_dev = hwmon_device_register_with_info(&client->dev, client->name, NULL, NULL, NULL); if (IS_ERR(data->hwmon_dev)) { status = PTR_ERR(data->hwmon_dev); goto exit_remove; diff --git a/platform/pddf/i2c/modules/psu/pddf_psu_module.c b/platform/pddf/i2c/modules/psu/pddf_psu_module.c index cf9713b407cd..41ceea7cca3d 100644 --- a/platform/pddf/i2c/modules/psu/pddf_psu_module.c +++ b/platform/pddf/i2c/modules/psu/pddf_psu_module.c @@ -160,9 +160,9 @@ static ssize_t do_device_operation(struct device *dev, struct device_attribute * board_info = i2c_get_psu_board_info(pdata, cdata); /* Populate the platform data for psu */ - client_ptr = i2c_new_device(adapter, board_info); + client_ptr = i2c_new_client_device(adapter, board_info); - if(client_ptr != NULL) + if(!IS_ERR(client_ptr)) { i2c_put_adapter(adapter); pddf_dbg(PSU, KERN_ERR "Created a %s client: 0x%p\n", cdata->i2c_name , (void *)client_ptr); diff --git a/platform/pddf/i2c/modules/sysstatus/Makefile b/platform/pddf/i2c/modules/sysstatus/Makefile index 150d160eae15..fc2e6261975e 100644 --- a/platform/pddf/i2c/modules/sysstatus/Makefile +++ b/platform/pddf/i2c/modules/sysstatus/Makefile @@ -1,4 +1,4 @@ TARGET := pddf_sysstatus_module obj-m := $(TARGET).o -CFLAGS_$(obj-m):= -I$(M)/modules/include +ccflags-y := -I$(M)/modules/include diff --git a/platform/pddf/i2c/modules/xcvr/Makefile b/platform/pddf/i2c/modules/xcvr/Makefile index e72ad6b44233..433a8630a2e8 100644 --- a/platform/pddf/i2c/modules/xcvr/Makefile +++ b/platform/pddf/i2c/modules/xcvr/Makefile @@ -1,4 +1,4 @@ -subdir-m := driver -obj-m := pddf_xcvr_module.o +obj-m := driver/ +obj-m += pddf_xcvr_module.o -CFLAGS_$(obj-m):= -I$(M)/modules/include +ccflags-y:= -I$(M)/modules/include diff --git a/platform/pddf/i2c/modules/xcvr/driver/pddf_xcvr_api.c b/platform/pddf/i2c/modules/xcvr/driver/pddf_xcvr_api.c index ddb7a1b3a2b3..a7be64328cab 100644 --- a/platform/pddf/i2c/modules/xcvr/driver/pddf_xcvr_api.c +++ b/platform/pddf/i2c/modules/xcvr/driver/pddf_xcvr_api.c @@ -47,36 +47,106 @@ int get_xcvr_module_attr_data(struct i2c_client *client, struct device *dev, int xcvr_i2c_cpld_read(XCVR_ATTR *info) { int status = -1; + int retry = 10; + struct i2c_client *client_ptr=NULL; if (info!=NULL) { - if (info->len==1) - { - status = board_i2c_cpld_read(info->devaddr , info->offset); - } - else + /* Get the I2C client for the CPLD */ + client_ptr = (struct i2c_client *)get_device_table(info->devname); + if (client_ptr) { - /* Get the I2C client for the CPLD */ - struct i2c_client *client_ptr=NULL; - client_ptr = (struct i2c_client *)get_device_table(info->devname); - if (client_ptr) + if (info->len==1) { - if (info->len==2) - { + while (retry) + { + status = board_i2c_cpld_read_new(info->devaddr, info->devname, info->offset); + if (unlikely(status < 0)) + { + msleep(60); + retry--; + continue; + } + break; + } + } + else if (info->len==2) + { + while(retry) + { status = i2c_smbus_read_word_swapped(client_ptr, info->offset); + if (unlikely(status < 0)) + { + msleep(60); + retry--; + continue; + } + break; } - else - printk(KERN_ERR "PDDF_XCVR: Doesn't support block CPLD read yet"); } else - printk(KERN_ERR "Unable to get the client handle for %s\n", info->devname); + printk(KERN_ERR "PDDF_XCVR: Doesn't support block CPLD read yet"); } + else + printk(KERN_ERR "Unable to get the client handle for %s\n", info->devname); + } + + return status; +} +int xcvr_i2c_cpld_write(XCVR_ATTR *info, uint32_t val) +{ + int status = 0; + unsigned int val_mask = 0, dnd_value = 0; + uint32_t reg; + struct i2c_client *client_ptr=NULL; + + val_mask = BIT_INDEX(info->mask); + /* Get the I2C client for the CPLD */ + client_ptr = (struct i2c_client *)get_device_table(info->devname); + + if (client_ptr) + { + if (info->len == 1) + status = board_i2c_cpld_read_new(info->devaddr, info->devname, info->offset); + else if (info->len == 2) + status = i2c_smbus_read_word_swapped(client_ptr, info->offset); + else + { + printk(KERN_ERR "PDDF_XCVR: Doesn't support block CPLD read yet"); + status = -1; + } + } + else + { + printk(KERN_ERR "Unable to get the client handle for %s\n", info->devname); + status = -1; } + if (status < 0) + return status; + else + { + msleep(60); + dnd_value = status & ~val_mask; + if (((val == 1) && (info->cmpval != 0)) || ((val == 0) && (info->cmpval == 0))) + reg = dnd_value | val_mask; + else + reg = dnd_value; + if (info->len == 1) + status = board_i2c_cpld_write_new(info->devaddr, info->devname, info->offset, (uint8_t)reg); + else if (info->len == 2) + status = i2c_smbus_write_word_swapped(client_ptr, info->offset, (uint16_t)reg); + else + { + printk(KERN_ERR "PDDF_XCVR: Doesn't support block CPLD write yet"); + status = -1; + } + } return status; } + int sonic_i2c_get_mod_pres(struct i2c_client *client, XCVR_ATTR *info, struct xcvr_data *data) { int status = 0; @@ -143,7 +213,7 @@ int sonic_i2c_get_mod_intr_status(struct i2c_client *client, XCVR_ATTR *info, st mod_intr = ((status & BIT_INDEX(info->mask)) == info->cmpval) ? 1 : 0; sfp_dbg(KERN_INFO "\nModule Interrupt :0x%x, reg_value = 0x%x\n", mod_intr, status); } - } + } else if(strcmp(info->devtype, "eeprom") == 0) { /* get client client for eeprom - Not Applicable */ @@ -247,54 +317,15 @@ int sonic_i2c_get_mod_txfault(struct i2c_client *client, XCVR_ATTR *info, struct int sonic_i2c_set_mod_reset(struct i2c_client *client, XCVR_ATTR *info, struct xcvr_data *data) { int status = 0; - unsigned int val_mask = 0, dnd_value = 0; - uint32_t reg; - struct i2c_client *client_ptr=NULL; if (strcmp(info->devtype, "cpld") == 0) { - val_mask = BIT_INDEX(info->mask); - /* Get the I2C client for the CPLD */ - client_ptr = (struct i2c_client *)get_device_table(info->devname); - - if (client_ptr) - { - if (info->len == 1) - status = board_i2c_cpld_read(info->devaddr , info->offset); - else if (info->len == 2) - status = i2c_smbus_read_word_data(client_ptr, info->offset); - else - { - printk(KERN_ERR "PDDF_XCVR: Doesn't support block CPLD read yet"); - status = -1; - } - } - else - { - printk(KERN_ERR "Unable to get the client handle for %s\n", info->devname); - status = -1; - } - /*printk(KERN_ERR "sonic_i2c_set_mod_reset:client_ptr=0x%x, status=0x%x, offset=0x%x, len=%d\n", client_ptr, status, info->offset, info->len);*/ - - if (status < 0) - return status; - else - { - dnd_value = status & ~val_mask; - if (((data->reset == 1) && (info->cmpval != 0)) || ((data->reset == 0) && (info->cmpval == 0))) - reg = dnd_value | val_mask; - else - reg = dnd_value; - if (info->len == 1) - status = board_i2c_cpld_write(info->devaddr, info->offset, (uint8_t)reg); - else if (info->len == 2) - status = i2c_smbus_write_word_swapped(client_ptr, info->offset, (uint16_t)reg); - else - { - printk(KERN_ERR "PDDF_XCVR: Doesn't support block CPLD write yet"); - status = -1; - } - } + status = xcvr_i2c_cpld_write(info, data->reset); + } + else + { + printk(KERN_ERR "Error: Invalid device type (%s) to set xcvr reset\n", info->devtype); + status = -1; } return status; @@ -303,53 +334,15 @@ int sonic_i2c_set_mod_reset(struct i2c_client *client, XCVR_ATTR *info, struct x int sonic_i2c_set_mod_lpmode(struct i2c_client *client, XCVR_ATTR *info, struct xcvr_data *data) { int status = 0; - unsigned int val_mask = 0, dnd_value = 0; - uint32_t reg; - struct i2c_client *client_ptr=NULL; if (strcmp(info->devtype, "cpld") == 0) { - val_mask = BIT_INDEX(info->mask); - /* Get the I2C client for the CPLD */ - client_ptr = (struct i2c_client *)get_device_table(info->devname); - - if (client_ptr) - { - if (info->len == 1) - status = board_i2c_cpld_read(info->devaddr , info->offset); - else if (info->len == 2) - status = i2c_smbus_read_word_data(client_ptr, info->offset); - else - { - printk(KERN_ERR "PDDF_XCVR: Doesn't support block CPLD read yet"); - status = -1; - } - } - else - { - printk(KERN_ERR "Unable to get the client handle for %s\n", info->devname); - status = -1; - } - - if (status < 0) - return status; - else - { - dnd_value = status & ~val_mask; - if (((data->lpmode == 1) && (info->cmpval != 0)) || ((data->lpmode == 0) && (info->cmpval == 0))) - reg = dnd_value | val_mask; - else - reg = dnd_value; - if (info->len == 1) - status = board_i2c_cpld_write(info->devaddr, info->offset, (uint8_t)reg); - else if (info->len == 2) - status = i2c_smbus_write_word_swapped(client_ptr, info->offset, (uint16_t)reg); - else - { - printk(KERN_ERR "PDDF_XCVR: Doesn't support block CPLD write yet"); - status = -1; - } - } + status = xcvr_i2c_cpld_write(info, data->lpmode); + } + else + { + printk(KERN_ERR "Error: Invalid device type (%s) to set xcvr lpmode\n", info->devtype); + status = -1; } return status; @@ -358,53 +351,15 @@ int sonic_i2c_set_mod_lpmode(struct i2c_client *client, XCVR_ATTR *info, struct int sonic_i2c_set_mod_txdisable(struct i2c_client *client, XCVR_ATTR *info, struct xcvr_data *data) { int status = 0; - unsigned int val_mask = 0, dnd_value = 0; - uint32_t reg; - struct i2c_client *client_ptr=NULL; if (strcmp(info->devtype, "cpld") == 0) { - val_mask = BIT_INDEX(info->mask); - /* Get the I2C client for the CPLD */ - client_ptr = (struct i2c_client *)get_device_table(info->devname); - - if (client_ptr) - { - if (info->len == 1) - status = board_i2c_cpld_read(info->devaddr , info->offset); - else if (info->len == 2) - status = i2c_smbus_read_word_data(client_ptr, info->offset); - else - { - printk(KERN_ERR "PDDF_XCVR: Doesn't support block CPLD read yet"); - status = -1; - } - } - else - { - printk(KERN_ERR "Unable to get the client handle for %s\n", info->devname); - status = -1; - } - - if (status < 0) - return status; - else - { - dnd_value = status & ~val_mask; - if (((data->txdisable == 1) && (info->cmpval != 0)) || ((data->txdisable == 0) && (info->cmpval == 0))) - reg = dnd_value | val_mask; - else - reg = dnd_value; - if (info->len == 1) - status = board_i2c_cpld_write(info->devaddr, info->offset, (uint8_t)reg); - else if (info->len == 2) - status = i2c_smbus_write_word_swapped(client_ptr, info->offset, (uint16_t)reg); - else - { - printk(KERN_ERR "PDDF_XCVR: Doesn't support block CPLD write yet"); - status = -1; - } - } + status = xcvr_i2c_cpld_write(info, data->txdisable); + } + else + { + printk(KERN_ERR "Error: Invalid device type (%s) to set xcvr txdisable\n", info->devtype); + status = -1; } return status; @@ -433,20 +388,20 @@ ssize_t get_module_presence(struct device *dev, struct device_attribute *da, { status = (attr_ops->pre_get)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: pre_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: pre_get function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } if (attr_ops->do_get != NULL) { status = (attr_ops->do_get)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: do_get function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); + dev_warn(&client->dev, "%s: do_get function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } if (attr_ops->post_get != NULL) { status = (attr_ops->post_get)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: post_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: post_get function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } mutex_unlock(&data->update_lock); return sprintf(buf, "%d\n", data->modpres); @@ -478,20 +433,20 @@ ssize_t get_module_reset(struct device *dev, struct device_attribute *da, { status = (attr_ops->pre_get)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: pre_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: pre_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); } if (attr_ops->do_get != NULL) { status = (attr_ops->do_get)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: do_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: do_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); } if (attr_ops->post_get != NULL) { status = (attr_ops->post_get)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: post_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: post_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); } mutex_unlock(&data->update_lock); @@ -533,20 +488,20 @@ ssize_t set_module_reset(struct device *dev, struct device_attribute *da, const { status = (attr_ops->pre_set)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: pre_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: pre_set function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } if (attr_ops->do_set != NULL) { status = (attr_ops->do_set)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: do_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: do_set function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } if (attr_ops->post_set != NULL) { status = (attr_ops->post_set)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: post_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: post_set function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } mutex_unlock(&data->update_lock); @@ -579,20 +534,20 @@ ssize_t get_module_intr_status(struct device *dev, struct device_attribute *da, { status = (attr_ops->pre_get)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: pre_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: pre_get function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } if (attr_ops->do_get != NULL) { status = (attr_ops->do_get)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: do_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: do_get function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } if (attr_ops->post_get != NULL) { status = (attr_ops->post_get)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: post_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: post_get function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } mutex_unlock(&data->update_lock); @@ -645,20 +600,20 @@ ssize_t get_module_lpmode(struct device *dev, struct device_attribute *da, char { status = (attr_ops->pre_get)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: pre_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: pre_get function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } if (attr_ops->do_get != NULL) { status = (attr_ops->do_get)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: do_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: do_get function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } if (attr_ops->post_get != NULL) { status = (attr_ops->post_get)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: post_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: post_get function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } mutex_unlock(&data->update_lock); return sprintf(buf, "%d\n", data->lpmode); @@ -699,20 +654,20 @@ ssize_t set_module_lpmode(struct device *dev, struct device_attribute *da, const { status = (attr_ops->pre_set)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: pre_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: pre_set function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } if (attr_ops->do_set != NULL) { status = (attr_ops->do_set)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: do_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: do_set function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } if (attr_ops->post_set != NULL) { status = (attr_ops->post_set)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: post_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: post_set function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } mutex_unlock(&data->update_lock); } @@ -743,20 +698,20 @@ ssize_t get_module_rxlos(struct device *dev, struct device_attribute *da, { status = (attr_ops->pre_get)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: pre_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: pre_get function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } if (attr_ops->do_get != NULL) { status = (attr_ops->do_get)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: do_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: do_get function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } if (attr_ops->post_get != NULL) { status = (attr_ops->post_get)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: post_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: post_get function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } mutex_unlock(&data->update_lock); return sprintf(buf, "%d\n", data->rxlos); @@ -789,20 +744,20 @@ ssize_t get_module_txdisable(struct device *dev, struct device_attribute *da, { status = (attr_ops->pre_get)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: pre_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: pre_get function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } if (attr_ops->do_get != NULL) { status = (attr_ops->do_get)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: do_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: do_get function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } if (attr_ops->post_get != NULL) { status = (attr_ops->post_get)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: post_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: post_get function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } mutex_unlock(&data->update_lock); return sprintf(buf, "%d\n", data->txdisable); @@ -843,20 +798,20 @@ ssize_t set_module_txdisable(struct device *dev, struct device_attribute *da, co { status = (attr_ops->pre_set)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: pre_set function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: pre_set function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } if (attr_ops->do_set != NULL) { status = (attr_ops->do_set)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: do_set function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: do_set function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } if (attr_ops->post_set != NULL) { status = (attr_ops->post_set)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: post_set function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: post_set function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } mutex_unlock(&data->update_lock); } @@ -887,20 +842,20 @@ ssize_t get_module_txfault(struct device *dev, struct device_attribute *da, { status = (attr_ops->pre_get)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: pre_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: pre_get function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } if (attr_ops->do_get != NULL) { status = (attr_ops->do_get)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: do_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: do_get function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } if (attr_ops->post_get != NULL) { status = (attr_ops->post_get)(client, attr_data, data); if (status!=0) - printk(KERN_ERR "%s: post_get function fails for %s attribute\n", __FUNCTION__, attr_data->aname); + dev_warn(&client->dev, "%s: post_get function fails for %s attribute. ret %d\n", __FUNCTION__, attr_data->aname, status); } mutex_unlock(&data->update_lock); return sprintf(buf, "%d\n", data->txfault); diff --git a/platform/pddf/i2c/modules/xcvr/driver/pddf_xcvr_driver.c b/platform/pddf/i2c/modules/xcvr/driver/pddf_xcvr_driver.c index 142d38a2ff2b..7ce1bca94b71 100644 --- a/platform/pddf/i2c/modules/xcvr/driver/pddf_xcvr_driver.c +++ b/platform/pddf/i2c/modules/xcvr/driver/pddf_xcvr_driver.c @@ -159,7 +159,7 @@ static int xcvr_probe(struct i2c_client *client, goto exit_free; } - data->xdev = hwmon_device_register(&client->dev); + data->xdev = hwmon_device_register_with_info(&client->dev, client->name, NULL, NULL, NULL); if (IS_ERR(data->xdev)) { status = PTR_ERR(data->xdev); goto exit_remove; diff --git a/platform/pddf/i2c/modules/xcvr/pddf_xcvr_module.c b/platform/pddf/i2c/modules/xcvr/pddf_xcvr_module.c index 65c555b742a2..43c41954c71f 100644 --- a/platform/pddf/i2c/modules/xcvr/pddf_xcvr_module.c +++ b/platform/pddf/i2c/modules/xcvr/pddf_xcvr_module.c @@ -129,8 +129,8 @@ static ssize_t do_device_operation(struct device *dev, struct device_attribute * board_info.addr = cdata->dev_addr; strcpy(board_info.type, cdata->dev_type); - client_ptr = i2c_new_device(adapter, &board_info); - if (client_ptr != NULL) { + client_ptr = i2c_new_client_device(adapter, &board_info); + if (!IS_ERR(client_ptr)) { i2c_put_adapter(adapter); pddf_dbg(XCVR, KERN_ERR "Created a %s client: 0x%p\n", cdata->i2c_name, (void *)client_ptr); add_device_table(cdata->i2c_name, (void*)client_ptr); @@ -152,8 +152,8 @@ static ssize_t do_device_operation(struct device *dev, struct device_attribute * board_info.addr = cdata->dev_addr; strcpy(board_info.type, cdata->dev_type); - client_ptr = i2c_new_device(adapter, &board_info); - if(client_ptr != NULL) { + client_ptr = i2c_new_client_device(adapter, &board_info); + if(!IS_ERR(client_ptr)) { i2c_put_adapter(adapter); pddf_dbg(XCVR, KERN_ERR "Created %s, type:%s client: 0x%p\n", cdata->i2c_name, cdata->dev_type, (void *)client_ptr); add_device_table(cdata->i2c_name, (void*)client_ptr); diff --git a/platform/pddf/i2c/service/pddf-platform-init.service b/platform/pddf/i2c/service/pddf-platform-init.service index ccb8d1110fb7..41fa67214fc8 100644 --- a/platform/pddf/i2c/service/pddf-platform-init.service +++ b/platform/pddf/i2c/service/pddf-platform-init.service @@ -5,6 +5,7 @@ DefaultDependencies=no [Service] Type=oneshot +ExecStartPre=-/usr/local/bin/pre_pddf_init.sh ExecStart=/usr/local/bin/pddf_util.py install ExecStop=/usr/local/bin/pddf_util.py clean RemainAfterExit=yes diff --git a/platform/pddf/i2c/utils/pddf_util.py b/platform/pddf/i2c/utils/pddf_util.py index 299ec18babd9..fdefc8933c15 100755 --- a/platform/pddf/i2c/utils/pddf_util.py +++ b/platform/pddf/i2c/utils/pddf_util.py @@ -15,7 +15,6 @@ switch-nonpddf : switch to per platform, non-pddf mode """ -import commands import logging import getopt import os @@ -120,7 +119,7 @@ def my_log(txt): def log_os_system(cmd, show): logging.info('Run :'+cmd) - status, output = commands.getstatusoutput(cmd) + status, output = subprocess.getstatusoutput(cmd) my_log (cmd +"with result:" + str(status)) my_log (" output:"+output) if status: @@ -138,33 +137,9 @@ def driver_check(): return False return True - -# Returns platform and HW SKU -def get_platform_and_hwsku(): - try: - proc = subprocess.Popen([SONIC_CFGGEN_PATH, '-H', '-v', PLATFORM_KEY], - stdout=subprocess.PIPE, - shell=False, - stderr=subprocess.STDOUT) - stdout = proc.communicate()[0] - proc.wait() - platform = stdout.rstrip('\n') - - proc = subprocess.Popen([SONIC_CFGGEN_PATH, '-d', '-v', HWSKU_KEY], - stdout=subprocess.PIPE, - shell=False, - stderr=subprocess.STDOUT) - stdout = proc.communicate()[0] - proc.wait() - hwsku = stdout.rstrip('\n') - except OSError, e: - raise OSError("Cannot detect platform") - - return (platform, hwsku) - def get_path_to_device(): # Get platform and hwsku - (platform, hwsku) = get_platform_and_hwsku() + (platform, hwsku) = pddf_obj.get_platform_and_hwsku() # Load platform module from source platform_path = "/".join([PLATFORM_ROOT_PATH, platform]) @@ -193,14 +168,20 @@ def config_pddf_utils(): log_os_system('mv '+SONIC_PLATFORM_BSP_WHL_PKG+' '+SONIC_PLATFORM_BSP_WHL_PKG_BK, 1) # PDDF whl package exist ... this must be the whl package created from # PDDF 2.0 ref API classes and some changes on top of it ... install it + log_os_system('sync', 1) shutil.copy(SONIC_PLATFORM_PDDF_WHL_PKG, SONIC_PLATFORM_BSP_WHL_PKG) + log_os_system('sync', 1) print("Attemting to install the PDDF sonic_platform wheel package ...") - status, output = log_os_system("pip3 install "+ SONIC_PLATFORM_BSP_WHL_PKG, 1) - if status: - print("Error: Failed to install {}".format(SONIC_PLATFORM_BSP_WHL_PKG)) - return status + if os.path.getsize(SONIC_PLATFORM_BSP_WHL_PKG) != 0: + status, output = log_os_system("pip3 install "+ SONIC_PLATFORM_BSP_WHL_PKG, 1) + if status: + print("Error: Failed to install {}".format(SONIC_PLATFORM_BSP_WHL_PKG)) + return status + else: + print("Successfully installed {} package".format(SONIC_PLATFORM_BSP_WHL_PKG)) else: - print("Successfully installed {} package".format(SONIC_PLATFORM_BSP_WHL_PKG)) + print("Error: Failed to copy {} properly. Exiting ...".format(SONIC_PLATFORM_PDDF_WHL_PKG)) + return -1 else: # PDDF with platform APIs 1.5 must be supported device_plugin_path = "/".join([device_path, "plugins"]) @@ -228,13 +209,17 @@ def config_pddf_utils(): if status: print("Error: Unable to uninstall BSP sonic-platform whl package") return status - print("Attemting to install the PDDF sonic_platform wheel package ...") - status, output = log_os_system("pip3 install "+ SONIC_PLATFORM_BSP_WHL_PKG, 1) - if status: - print("Error: Failed to install {}".format(SONIC_PLATFORM_BSP_WHL_PKG)) - return status + print("Attempting to install the PDDF sonic_platform wheel package ...") + if os.path.getsize(SONIC_PLATFORM_BSP_WHL_PKG) != 0: + status, output = log_os_system("pip3 install "+ SONIC_PLATFORM_BSP_WHL_PKG, 1) + if status: + print("Error: Failed to install {}".format(SONIC_PLATFORM_BSP_WHL_PKG)) + return status + else: + print("Successfully installed {} package".format(SONIC_PLATFORM_BSP_WHL_PKG)) else: - print("Successfully installed {} package".format(SONIC_PLATFORM_BSP_WHL_PKG)) + print("Error: Failed to copy {} properly. Exiting ...".format(SONIC_PLATFORM_PDDF_WHL_PKG)) + return -1 else: # system rebooted in pddf mode print("System rebooted in PDDF mode, hence keeping the PDDF 2.0 classes") @@ -353,6 +338,16 @@ def driver_install(): if status: print("Error: pddf_pre_driver_install script failed with error %d"%status) return status + # For debug + print(output) + + # Removes the perm_kos first, then reload them in a proper sequence + for mod in perm_kos: + cmd = "modprobe -rq " + mod + status, output = log_os_system(cmd, 1) + if status: + print("driver_install: Unable to unload {}".format(mod)) + # Don't exit but continue log_os_system("depmod", 1) for i in range(0,len(kos)): diff --git a/platform/pddf/i2c/utils/pddfparse.py b/platform/pddf/i2c/utils/pddfparse.py index f9ce8fca0b42..b8c7f39138a5 100755 --- a/platform/pddf/i2c/utils/pddfparse.py +++ b/platform/pddf/i2c/utils/pddfparse.py @@ -2,7 +2,6 @@ import argparse import glob import json -from jsonschema import validate import os import re import subprocess @@ -10,13 +9,13 @@ import time import unicodedata -bmc_cache={} -cache={} +bmc_cache = {} +cache = {} SONIC_CFGGEN_PATH = '/usr/local/bin/sonic-cfggen' HWSKU_KEY = 'DEVICE_METADATA.localhost.hwsku' PLATFORM_KEY = 'DEVICE_METADATA.localhost.platform' -dirname=os.path.dirname(os.path.realpath(__file__)) +dirname = os.path.dirname(os.path.realpath(__file__)) color_map = { "STATUS_LED_COLOR_GREEN" : "green", @@ -31,8 +30,6 @@ } - - class PddfParse(): def __init__(self): if not os.path.exists("/usr/share/sonic/platform"): @@ -41,16 +38,14 @@ def __init__(self): try: with open('/usr/share/sonic/platform/pddf/pddf-device.json') as f: - self.data = json.load(f) + self.data = json.load(f) except IOError: if os.path.exists('/usr/share/sonic/platform'): os.unlink("/usr/share/sonic/platform") raise Exception('PDDF JSON file not found. PDDF is not supported on this platform') - - self.data_sysfs_obj={} - self.sysfs_obj={} - + self.data_sysfs_obj = {} + self.sysfs_obj = {} # Returns platform and HW SKU def get_platform_and_hwsku(self): @@ -58,6 +53,7 @@ def get_platform_and_hwsku(self): proc = subprocess.Popen([SONIC_CFGGEN_PATH, '-H', '-v', PLATFORM_KEY], stdout=subprocess.PIPE, shell=False, + universal_newlines=True, stderr=subprocess.STDOUT) stdout = proc.communicate()[0] proc.wait() @@ -66,11 +62,12 @@ def get_platform_and_hwsku(self): proc = subprocess.Popen([SONIC_CFGGEN_PATH, '-d', '-v', HWSKU_KEY], stdout=subprocess.PIPE, shell=False, + universal_newlines=True, stderr=subprocess.STDOUT) stdout = proc.communicate()[0] proc.wait() hwsku = stdout.rstrip('\n') - except OSError, e: + except OSError as e: raise OSError("Cannot detect platform") return (platform, hwsku) @@ -80,76 +77,81 @@ def get_platform_and_hwsku(self): ################################################################################################################### def runcmd(self, cmd): rc = os.system(cmd) - if rc!=0: - print "%s -- command failed"%cmd + if rc != 0: + print("%s -- command failed" % cmd) return rc def get_dev_idx(self, dev, ops): - parent=dev['dev_info']['virt_parent'] - pdev=self.data[parent] - - return pdev['dev_attr']['dev_idx'] + parent = dev['dev_info']['virt_parent'] + pdev = self.data[parent] + return pdev['dev_attr']['dev_idx'] - def get_path(self, target, attr): + def get_paths(self, target, attr): aa = target + attr if aa in cache: return cache[aa] - string = None + strings = [] p = re.search(r'\d+$', target) if p is None: - for bb in filter(re.compile(target).search,self.data.keys()): - path = self.dev_parse(self.data[bb], { "cmd": "show_attr", "target":bb, "attr":attr }) - if path != "": - string = path + for bb in filter(re.compile(target).search, self.data.keys()): + paths = self.dev_parse(self.data[bb], {"cmd": "show_attr", "target": bb, "attr": attr}) + if paths: + strings.extend(paths) else: if target in self.data.keys(): - path = self.dev_parse(self.data[target], { "cmd": "show_attr", "target":target, "attr":attr }) - if path != "": - string = path + paths = self.dev_parse(self.data[target], {"cmd": "show_attr", "target": target, "attr": attr}) + if paths: + strings.extend(paths) + cache[aa] = strings + return strings - if string is not None: - string = string.rstrip() - - cache[aa]=string - return string - + def get_path(self, target, attr): + nodes = self.get_paths(target, attr) + if nodes: + if len(nodes)==1: + return nodes[0] + # CAREFULL!!! If more than one paths are expected, use get_paths + else: + return nodes[0] + else: + return None def get_device_type(self, key): - if not key in self.data.keys(): - return None + if key not in self.data.keys(): + return None return self.data[key]['dev_info']['device_type'] def get_platform(self): return self.data['PLATFORM'] def get_num_psu_fans(self, dev): - if not dev in self.data.keys(): + if dev not in self.data.keys(): return 0 - if not 'num_psu_fans' in self.data[dev]['dev_attr']: + if 'num_psu_fans' not in self.data[dev]['dev_attr']: return 0 - + return self.data[dev]['dev_attr']['num_psu_fans'] - def get_led_path(self): - return ("pddf/devices/led") + def get_led_path(self): + return ("pddf/devices/led") - def get_led_cur_state_path(self): - return ("pddf/devices/led/cur_state") + def get_led_cur_state_path(self): + return ("pddf/devices/led/cur_state") - def get_led_color(self): - color_f="/sys/kernel/pddf/devices/led/cur_state/color" + def get_led_color(self): + color_f = "/sys/kernel/pddf/devices/led/cur_state/color" try: - with open(color_f, 'r') as f: - color = f.read().strip("\r\n") + with open(color_f, 'r') as f: + color = f.read().strip("\r\n") except IOError: - return ("Error") + return ("Error") - return (color_map[color]) + return (color_map[color]) ################################################################################################################### # CREATE DEFS @@ -162,291 +164,300 @@ def create_device(self, attr, path, ops): else: val = attr[key] - cmd="echo '%s' > /sys/kernel/%s/%s"%(val, path, key) - ret=self.runcmd(cmd) - if ret!=0: + cmd = "echo '%s' > /sys/kernel/%s/%s" % (val, path, key) + ret = self.runcmd(cmd) + if ret != 0: return ret return ret def create_psu_i2c_device(self, dev, ops): - create_ret = 0 + create_ret = [] + ret = 0 if dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['PSU']: - create_ret = self.create_device(dev['i2c']['topo_info'], "pddf/devices/psu/i2c", ops) - if create_ret!=0: - return create_ret - cmd= "echo '%s' > /sys/kernel/pddf/devices/psu/i2c/i2c_name"%(dev['dev_info']['device_name']) - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret - cmd= "echo '%s' > /sys/kernel/pddf/devices/psu/i2c/psu_idx"%( self.get_dev_idx(dev, ops)) - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret + ret = self.create_device(dev['i2c']['topo_info'], "pddf/devices/psu/i2c", ops) + if ret != 0: + return create_ret.append(ret) + cmd = "echo '%s' > /sys/kernel/pddf/devices/psu/i2c/i2c_name" % (dev['dev_info']['device_name']) + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) + cmd = "echo '%s' > /sys/kernel/pddf/devices/psu/i2c/psu_idx" % (self.get_dev_idx(dev, ops)) + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) for attr in dev['i2c']['attr_list']: - create_ret = self.create_device(attr, "pddf/devices/psu/i2c", ops) - if create_ret!=0: - return create_ret - cmd= "echo 'add' > /sys/kernel/pddf/devices/psu/i2c/attr_ops" - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret + ret = self.create_device(attr, "pddf/devices/psu/i2c", ops) + if ret != 0: + return create_ret.append(ret) + cmd = "echo 'add' > /sys/kernel/pddf/devices/psu/i2c/attr_ops" + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) cmd = "echo 'add' > /sys/kernel/pddf/devices/psu/i2c/dev_ops" - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) else: - cmd = "echo %s 0x%x > /sys/bus/i2c/devices/i2c-%d/new_device" % (dev['i2c']['topo_info']['dev_type'], + cmd = "echo %s 0x%x > /sys/bus/i2c/devices/i2c-%d/new_device" % (dev['i2c']['topo_info']['dev_type'], int(dev['i2c']['topo_info']['dev_addr'], 0), int(dev['i2c']['topo_info']['parent_bus'], 0)) - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret - - - return create_ret - + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) + return create_ret.append(ret) def create_psu_bmc_device(self, dev, ops): - print "" - + return [0] def create_psu_device(self, dev, ops): - return self.create_psu_i2c_device(dev, ops ) - + return self.create_psu_i2c_device(dev, ops) + def create_fan_device(self, dev, ops): - create_ret = 0 + create_ret = [] + ret = 0 if dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['FAN']: - create_ret = self.create_device(dev['i2c']['topo_info'], "pddf/devices/fan/i2c", ops) - if create_ret!=0: - return create_ret - cmd= "echo '%s' > /sys/kernel/pddf/devices/fan/i2c/i2c_name"%(dev['dev_info']['device_name']) - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret - create_ret = self.create_device(dev['i2c']['dev_attr'], "pddf/devices/fan/i2c", ops) - if create_ret!=0: - return create_ret + ret = self.create_device(dev['i2c']['topo_info'], "pddf/devices/fan/i2c", ops) + if ret != 0: + return create_ret.append(ret) + cmd = "echo '%s' > /sys/kernel/pddf/devices/fan/i2c/i2c_name" % (dev['dev_info']['device_name']) + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) + ret = self.create_device(dev['i2c']['dev_attr'], "pddf/devices/fan/i2c", ops) + if ret != 0: + return create_ret.append(ret) for attr in dev['i2c']['attr_list']: - create_ret = self.create_device(attr, "pddf/devices/fan/i2c", ops) - if create_ret!=0: - return create_ret - cmd= "echo 'add' > /sys/kernel/pddf/devices/fan/i2c/attr_ops" - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret - - cmd= "echo 'add' > /sys/kernel/pddf/devices/fan/i2c/dev_ops" - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret + ret = self.create_device(attr, "pddf/devices/fan/i2c", ops) + if ret != 0: + return create_ret.append(ret) + cmd = "echo 'add' > /sys/kernel/pddf/devices/fan/i2c/attr_ops" + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) + + cmd = "echo 'add' > /sys/kernel/pddf/devices/fan/i2c/dev_ops" + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) else: - cmd= "echo %s 0x%x > /sys/bus/i2c/devices/i2c-%d/new_device" % (dev['i2c']['topo_info']['dev_type'], + cmd = "echo %s 0x%x > /sys/bus/i2c/devices/i2c-%d/new_device" % (dev['i2c']['topo_info']['dev_type'], int(dev['i2c']['topo_info']['dev_addr'], 0), int(dev['i2c']['topo_info']['parent_bus'], 0)) - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) - return create_ret + return create_ret.append(ret) def create_temp_sensor_device(self, dev, ops): - create_ret = 0 - # NO PDDF driver for temp_sensors device - cmd= "echo %s 0x%x > /sys/bus/i2c/devices/i2c-%d/new_device" % (dev['i2c']['topo_info']['dev_type'], - int(dev['i2c']['topo_info']['dev_addr'], 0), int(dev['i2c']['topo_info']['parent_bus'], 0)) - create_ret = self.runcmd(cmd) - return create_ret - - - + create_ret = [] + ret = 0 + # NO PDDF driver for temp_sensors device + cmd = "echo %s 0x%x > /sys/bus/i2c/devices/i2c-%d/new_device" % (dev['i2c']['topo_info']['dev_type'], + int(dev['i2c']['topo_info']['dev_addr'], 0), int(dev['i2c']['topo_info']['parent_bus'], 0)) + ret = self.runcmd(cmd) + return create_ret.append(ret) def create_cpld_device(self, dev, ops): - create_ret = 0 + create_ret = [] + ret = 0 if dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['CPLD']: - create_ret = self.create_device(dev['i2c']['topo_info'], "pddf/devices/cpld", ops) - if create_ret!=0: - return create_ret - - cmd= "echo '%s' > /sys/kernel/pddf/devices/cpld/i2c_name"%(dev['dev_info']['device_name']) - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret + ret = self.create_device(dev['i2c']['topo_info'], "pddf/devices/cpld", ops) + if ret != 0: + return create_ret.append(ret) + + cmd = "echo '%s' > /sys/kernel/pddf/devices/cpld/i2c_name" % (dev['dev_info']['device_name']) + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) # TODO: If attributes are provided then, use 'self.create_device' for them too - cmd= "echo 'add' > /sys/kernel/pddf/devices/cpld/dev_ops" - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret + cmd = "echo 'add' > /sys/kernel/pddf/devices/cpld/dev_ops" + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) else: - cmd= "echo %s 0x%x > /sys/bus/i2c/devices/i2c-%d/new_device" % (dev['i2c']['topo_info']['dev_type'], + cmd = "echo %s 0x%x > /sys/bus/i2c/devices/i2c-%d/new_device" % (dev['i2c']['topo_info']['dev_type'], int(dev['i2c']['topo_info']['dev_addr'], 0), int(dev['i2c']['topo_info']['parent_bus'], 0)) - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) - return create_ret + return create_ret.append(ret) def create_cpldmux_device(self, dev, ops): - create_ret = 0 - create_ret = self.create_device(dev['i2c']['topo_info'], "pddf/devices/cpldmux", ops) - if create_ret!=0: - return create_ret - cmd= "echo '%s' > /sys/kernel/pddf/devices/mux/i2c_name"%(dev['dev_info']['device_name']) - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret + create_ret = [] + ret = 0 + ret = self.create_device(dev['i2c']['topo_info'], "pddf/devices/cpldmux", ops) + if ret != 0: + return create_ret.append(ret) + cmd = "echo '%s' > /sys/kernel/pddf/devices/mux/i2c_name" % (dev['dev_info']['device_name']) + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) self.create_device(dev['i2c']['dev_attr'], "pddf/devices/cpldmux", ops) - # Parse channel info + # Parse channel info for chan in dev['i2c']['channel']: self.create_device(chan, "pddf/devices/cpldmux", ops) - cmd="echo 'add' > /sys/kernel/pddf/devices/cpldmux/chan_ops" - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret + cmd = "echo 'add' > /sys/kernel/pddf/devices/cpldmux/chan_ops" + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) - cmd= "echo 'add' > /sys/kernel/pddf/devices/cpldmux/dev_ops" - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret + cmd = "echo 'add' > /sys/kernel/pddf/devices/cpldmux/dev_ops" + ret = self.runcmd(cmd) + return create_ret.append(ret) def create_gpio_device(self, dev, ops): - create_ret = 0 - create_ret = self.create_device(dev['i2c']['topo_info'], "pddf/devices/gpio", ops) - if create_ret!=0: - return create_ret - cmd= "echo '%s' > /sys/kernel/pddf/devices/gpio/i2c_name"%(dev['dev_info']['device_name']) - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret - create_ret = self.create_device(dev['i2c']['dev_attr'], "pddf/devices/gpio", ops) - if create_ret!=0: - return create_ret - cmd= "echo 'add' > /sys/kernel/pddf/devices/gpio/dev_ops" - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret - + create_ret = [] + ret = 0 + ret = self.create_device(dev['i2c']['topo_info'], "pddf/devices/gpio", ops) + if ret != 0: + return create_ret.append(ret) + cmd = "echo '%s' > /sys/kernel/pddf/devices/gpio/i2c_name" % (dev['dev_info']['device_name']) + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) + ret = self.create_device(dev['i2c']['dev_attr'], "pddf/devices/gpio", ops) + if ret != 0: + return create_ret.append(ret) + cmd = "echo 'add' > /sys/kernel/pddf/devices/gpio/dev_ops" + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) + time.sleep(2) base = dev['i2c']['dev_attr']['gpio_base'] for inst in dev['i2c']['ports']: - if inst['port_num']!="": + if inst['port_num'] != "": port_no = int(base, 16) + int(inst['port_num']) - cmd= "echo %d > /sys/class/gpio/export"%port_no - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret - if inst['direction']!="": - cmd= "echo %s >/sys/class/gpio/gpio%d/direction"%(inst['direction'], port_no) - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret - if inst['value']!="": + cmd = "echo %d > /sys/class/gpio/export" % port_no + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) + if inst['direction'] != "": + cmd = "echo %s >/sys/class/gpio/gpio%d/direction" % (inst['direction'], port_no) + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) + if inst['value'] != "": for i in inst['value'].split(','): - cmd= "echo %s >/sys/class/gpio/gpio%d/value"%(i.rstrip(), port_no) - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret + cmd = "echo %s >/sys/class/gpio/gpio%d/value" % (i.rstrip(), port_no) + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) - return create_ret + return create_ret.append(ret) def create_mux_device(self, dev, ops): - create_ret = 0 - create_ret = self.create_device(dev['i2c']['topo_info'], "pddf/devices/mux", ops) - if create_ret!=0: - return create_ret - cmd= "echo '%s' > /sys/kernel/pddf/devices/mux/i2c_name"%(dev['dev_info']['device_name']) - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret - self.create_device(dev['i2c']['dev_attr'], "pddf/devices/mux", ops) - cmd= "echo 'add' > /sys/kernel/pddf/devices/mux/dev_ops" - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret - + create_ret = [] + ret = 0 + ret = self.create_device(dev['i2c']['topo_info'], "pddf/devices/mux", ops) + if ret != 0: + return create_ret.append(ret) + cmd = "echo '%s' > /sys/kernel/pddf/devices/mux/i2c_name" % (dev['dev_info']['device_name']) + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) + cmd = "echo %s > /sys/kernel/pddf/devices/mux/virt_bus" % (dev['i2c']['dev_attr']['virt_bus']) + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) + cmd = "echo 'add' > /sys/kernel/pddf/devices/mux/dev_ops" + ret = self.runcmd(cmd) + # Check if the dev_attr array contain idle_state + if 'idle_state' in dev['i2c']['dev_attr']: + cmd = "echo {} > /sys/bus/i2c/devices/{}-00{:02x}/idle_state".format(dev['i2c']['dev_attr']['idle_state'], + int(dev['i2c']['topo_info']['parent_bus'],0), int(dev['i2c']['topo_info']['dev_addr'],0)) + ret = self.runcmd(cmd) + + return create_ret.append(ret) def create_xcvr_i2c_device(self, dev, ops): - create_ret = 0 + create_ret = [] + ret = 0 if dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['PORT_MODULE']: self.create_device(dev['i2c']['topo_info'], "pddf/devices/xcvr/i2c", ops) - cmd= "echo '%s' > /sys/kernel/pddf/devices/xcvr/i2c/i2c_name"%(dev['dev_info']['device_name']) - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret - cmd="echo '%s' > /sys/kernel/pddf/devices/xcvr/i2c/dev_idx"%( self.get_dev_idx(dev, ops)) - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret + cmd = "echo '%s' > /sys/kernel/pddf/devices/xcvr/i2c/i2c_name" % (dev['dev_info']['device_name']) + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) + cmd = "echo '%s' > /sys/kernel/pddf/devices/xcvr/i2c/dev_idx" % (self.get_dev_idx(dev, ops)) + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) for attr in dev['i2c']['attr_list']: self.create_device(attr, "pddf/devices/xcvr/i2c", ops) - cmd="echo 'add' > /sys/kernel/pddf/devices/xcvr/i2c/attr_ops" - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret - - cmd="echo 'add' > /sys/kernel/pddf/devices/xcvr/i2c/dev_ops" - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret + cmd = "echo 'add' > /sys/kernel/pddf/devices/xcvr/i2c/attr_ops" + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) + + cmd = "echo 'add' > /sys/kernel/pddf/devices/xcvr/i2c/dev_ops" + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) else: - cmd="echo %s 0x%x > /sys/bus/i2c/devices/i2c-%d/new_device" % (dev['i2c']['topo_info']['dev_type'], + cmd = "echo %s 0x%x > /sys/bus/i2c/devices/i2c-%d/new_device" % (dev['i2c']['topo_info']['dev_type'], int(dev['i2c']['topo_info']['dev_addr'], 0), int(dev['i2c']['topo_info']['parent_bus'], 0)) - create_ret = self.runcmd(cmd) - #print "\n" - if create_ret!=0: - return create_ret + ret = self.runcmd(cmd) + # print("\n") + if ret != 0: + return create_ret.append(ret) # Add port name port_name_sysfs = '/sys/bus/i2c/devices/{}-00{:02x}/port_name'.format( - int(dev['i2c']['topo_info']['parent_bus'], 0),int(dev['i2c']['topo_info']['dev_addr'], 0)) + int(dev['i2c']['topo_info']['parent_bus'], 0), int(dev['i2c']['topo_info']['dev_addr'], 0)) if os.path.exists(port_name_sysfs): - cmd="echo {} > /sys/bus/i2c/devices/{}-00{:02x}/port_name".format( - dev['dev_info']['virt_parent'].lower(), int(dev['i2c']['topo_info']['parent_bus'], 0), - int(dev['i2c']['topo_info']['dev_addr'], 0)) - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret + cmd = "echo {} > /sys/bus/i2c/devices/{}-00{:02x}/port_name".format( + dev['dev_info']['virt_parent'].lower(), int(dev['i2c']['topo_info']['parent_bus'], 0), + int(dev['i2c']['topo_info']['dev_addr'], 0)) + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) - return create_ret + return create_ret.append(ret) def create_xcvr_bmc_device(self, dev, ops): - print "" + return [0] def create_xcvr_device(self, dev, ops): - return self.create_xcvr_i2c_device(dev, ops ) + return self.create_xcvr_i2c_device(dev, ops) def create_sysstatus_device(self, dev, ops): - create_ret = 0 + create_ret = [] + ret = 0 for attr in dev['attr_list']: self.create_device(attr, "pddf/devices/sysstatus", ops) - cmd= "echo 'add' > /sys/kernel/pddf/devices/sysstatus/attr_ops" - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret + cmd = "echo 'add' > /sys/kernel/pddf/devices/sysstatus/attr_ops" + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) def create_eeprom_device(self, dev, ops): - create_ret = 0 + create_ret = [] + ret = 0 if "EEPROM" in self.data['PLATFORM']['pddf_dev_types'] and \ dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['EEPROM']: self.create_device(dev['i2c']['topo_info'], "pddf/devices/eeprom/i2c", ops) - cmd= "echo '%s' > /sys/kernel/pddf/devices/eeprom/i2c/i2c_name"%(dev['dev_info']['device_name']) - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret + cmd = "echo '%s' > /sys/kernel/pddf/devices/eeprom/i2c/i2c_name" % (dev['dev_info']['device_name']) + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) self.create_device(dev['i2c']['dev_attr'], "pddf/devices/eeprom/i2c", ops) cmd = "echo 'add' > /sys/kernel/pddf/devices/eeprom/i2c/dev_ops" - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) else: - cmd= "echo %s 0x%x > /sys/bus/i2c/devices/i2c-%d/new_device" % (dev['i2c']['topo_info']['dev_type'], + cmd = "echo %s 0x%x > /sys/bus/i2c/devices/i2c-%d/new_device" % (dev['i2c']['topo_info']['dev_type'], int(dev['i2c']['topo_info']['dev_addr'], 0), int(dev['i2c']['topo_info']['parent_bus'], 0)) - create_ret = self.runcmd(cmd) - if create_ret!=0: - return create_ret + ret = self.runcmd(cmd) + if ret != 0: + return create_ret.append(ret) - return create_ret + return create_ret.append(ret) ################################################################################################################### # DELETE DEFS @@ -454,13 +465,13 @@ def create_eeprom_device(self, dev, ops): def delete_eeprom_device(self, dev, ops): if "EEPROM" in self.data['PLATFORM']['pddf_dev_types'] and \ dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['EEPROM']: - cmd= "echo '%s' > /sys/kernel/pddf/devices/eeprom/i2c/i2c_name"%(dev['dev_info']['device_name']) + cmd = "echo '%s' > /sys/kernel/pddf/devices/eeprom/i2c/i2c_name" % (dev['dev_info']['device_name']) self.runcmd(cmd) cmd = "echo 'delete' > /sys/kernel/pddf/devices/eeprom/i2c/dev_ops" self.runcmd(cmd) else: - cmd= "echo 0x%x > /sys/bus/i2c/devices/i2c-%d/delete_device" % (int(dev['i2c']['topo_info']['dev_addr'], 0), - int(dev['i2c']['topo_info']['parent_bus'], 0)) + cmd = "echo 0x%x > /sys/bus/i2c/devices/i2c-%d/delete_device" % ( + int(dev['i2c']['topo_info']['dev_addr'], 0), int(dev['i2c']['topo_info']['parent_bus'], 0)) self.runcmd(cmd) def delete_sysstatus_device(self, dev, ops): @@ -470,13 +481,13 @@ def delete_sysstatus_device(self, dev, ops): def delete_xcvr_i2c_device(self, dev, ops): if dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['PORT_MODULE']: - cmd= "echo '%s' > /sys/kernel/pddf/devices/xcvr/i2c/i2c_name"%(dev['dev_info']['device_name']) + cmd = "echo '%s' > /sys/kernel/pddf/devices/xcvr/i2c/i2c_name" % (dev['dev_info']['device_name']) self.runcmd(cmd) - cmd="echo 'delete' > /sys/kernel/pddf/devices/xcvr/i2c/dev_ops" + cmd = "echo 'delete' > /sys/kernel/pddf/devices/xcvr/i2c/dev_ops" self.runcmd(cmd) else: - cmd="echo 0x%x > /sys/bus/i2c/devices/i2c-%d/delete_device" % (int(dev['i2c']['topo_info']['dev_addr'], 0), - int(dev['i2c']['topo_info']['parent_bus'], 0)) + cmd = "echo 0x%x > /sys/bus/i2c/devices/i2c-%d/delete_device" % ( + int(dev['i2c']['topo_info']['dev_addr'], 0), int(dev['i2c']['topo_info']['parent_bus'], 0)) self.runcmd(cmd) def delete_xcvr_device(self, dev, ops): @@ -484,75 +495,74 @@ def delete_xcvr_device(self, dev, ops): return def delete_gpio_device(self, dev, ops): - cmd= "echo '%s' > /sys/kernel/pddf/devices/gpio/i2c_name"%(dev['dev_info']['device_name']) - self.runcmd(cmd) - cmd= "echo 'delete' > /sys/kernel/pddf/devices/gpio/dev_ops" - self.runcmd(cmd) + cmd = "echo '%s' > /sys/kernel/pddf/devices/gpio/i2c_name" % (dev['dev_info']['device_name']) + self.runcmd(cmd) + cmd = "echo 'delete' > /sys/kernel/pddf/devices/gpio/dev_ops" + self.runcmd(cmd) def delete_mux_device(self, dev, ops): - cmd= "echo '%s' > /sys/kernel/pddf/devices/mux/i2c_name"%(dev['dev_info']['device_name']) - self.runcmd(cmd) - cmd= "echo 'delete' > /sys/kernel/pddf/devices/mux/dev_ops" - self.runcmd(cmd) + cmd = "echo '%s' > /sys/kernel/pddf/devices/mux/i2c_name" % (dev['dev_info']['device_name']) + self.runcmd(cmd) + cmd = "echo 'delete' > /sys/kernel/pddf/devices/mux/dev_ops" + self.runcmd(cmd) def delete_cpld_device(self, dev, ops): if dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['CPLD']: - cmd= "echo '%s' > /sys/kernel/pddf/devices/cpld/i2c_name"%(dev['dev_info']['device_name']) + cmd = "echo '%s' > /sys/kernel/pddf/devices/cpld/i2c_name" % (dev['dev_info']['device_name']) self.runcmd(cmd) - cmd= "echo 'delete' > /sys/kernel/pddf/devices/cpld/dev_ops" + cmd = "echo 'delete' > /sys/kernel/pddf/devices/cpld/dev_ops" self.runcmd(cmd) else: - cmd= "echo 0x%x > /sys/bus/i2c/devices/i2c-%d/delete_device" % (int(dev['i2c']['topo_info']['dev_addr'], 0), - int(dev['i2c']['topo_info']['parent_bus'], 0)) + cmd = "echo 0x%x > /sys/bus/i2c/devices/i2c-%d/delete_device" % ( + int(dev['i2c']['topo_info']['dev_addr'], 0), int(dev['i2c']['topo_info']['parent_bus'], 0)) self.runcmd(cmd) def delete_cpldmux_device(self, dev, ops): if dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['CPLDMUX']: - cmd= "echo '%s' > /sys/kernel/pddf/devices/cpldmux/i2c_name"%(dev['dev_info']['device_name']) + cmd = "echo '%s' > /sys/kernel/pddf/devices/cpldmux/i2c_name" % (dev['dev_info']['device_name']) self.runcmd(cmd) - cmd= "echo 'delete' > /sys/kernel/pddf/devices/cpldmux/dev_ops" + cmd = "echo 'delete' > /sys/kernel/pddf/devices/cpldmux/dev_ops" self.runcmd(cmd) def delete_temp_sensor_device(self, dev, ops): # NO PDDF driver for temp_sensors device - cmd= "echo 0x%x > /sys/bus/i2c/devices/i2c-%d/delete_device" % (int(dev['i2c']['topo_info']['dev_addr'], 0), - int(dev['i2c']['topo_info']['parent_bus'], 0)) + cmd = "echo 0x%x > /sys/bus/i2c/devices/i2c-%d/delete_device" % ( + int(dev['i2c']['topo_info']['dev_addr'], 0), int(dev['i2c']['topo_info']['parent_bus'], 0)) self.runcmd(cmd) def delete_fan_device(self, dev, ops): if dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['FAN']: - cmd= "echo '%s' > /sys/kernel/pddf/devices/fan/i2c/i2c_name"%(dev['dev_info']['device_name']) + cmd = "echo '%s' > /sys/kernel/pddf/devices/fan/i2c/i2c_name" % (dev['dev_info']['device_name']) self.runcmd(cmd) - cmd= "echo 'delete' > /sys/kernel/pddf/devices/fan/i2c/dev_ops" + cmd = "echo 'delete' > /sys/kernel/pddf/devices/fan/i2c/dev_ops" self.runcmd(cmd) else: - cmd= "echo 0x%x > /sys/bus/i2c/devices/i2c-%d/delete_device" % (int(dev['i2c']['topo_info']['dev_addr'], 0), - int(dev['i2c']['topo_info']['parent_bus'], 0)) + cmd = "echo 0x%x > /sys/bus/i2c/devices/i2c-%d/delete_device" % ( + int(dev['i2c']['topo_info']['dev_addr'], 0), int(dev['i2c']['topo_info']['parent_bus'], 0)) self.runcmd(cmd) def delete_psu_i2c_device(self, dev, ops): if dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['PSU']: - cmd= "echo '%s' > /sys/kernel/pddf/devices/psu/i2c/i2c_name"%(dev['dev_info']['device_name']) + cmd = "echo '%s' > /sys/kernel/pddf/devices/psu/i2c/i2c_name" % (dev['dev_info']['device_name']) self.runcmd(cmd) cmd = "echo 'delete' > /sys/kernel/pddf/devices/psu/i2c/dev_ops" self.runcmd(cmd) else: - cmd = "echo 0x%x > /sys/bus/i2c/devices/i2c-%d/delete_device" %(int(dev['i2c']['topo_info']['dev_addr'], 0), - int(dev['i2c']['topo_info']['parent_bus'], 0)) + cmd = "echo 0x%x > /sys/bus/i2c/devices/i2c-%d/delete_device" % ( + int(dev['i2c']['topo_info']['dev_addr'], 0), int(dev['i2c']['topo_info']['parent_bus'], 0)) self.runcmd(cmd) def delete_psu_device(self, dev, ops): - self.delete_psu_i2c_device(dev, ops ) - return - + self.delete_psu_i2c_device(dev, ops) + return ################################################################################################################### # SHOW ATTRIBIUTES DEFS ################################################################################################################### def is_led_device_configured(self, device_name, attr_name): if device_name in self.data.keys(): - attr_list=self.data[device_name]['i2c']['attr_list'] + attr_list = self.data[device_name]['i2c']['attr_list'] for attr in attr_list: if attr['attr_name'].strip() == attr_name.strip(): return (True) @@ -560,23 +570,32 @@ def is_led_device_configured(self, device_name, attr_name): def show_device_sysfs(self, dev, ops): - parent=dev['dev_info']['device_parent'] - pdev=self.data[parent] + parent = dev['dev_info']['device_parent'] + pdev = self.data[parent] if pdev['dev_info']['device_parent'] == 'SYSTEM': - return "/sys/bus/i2c/devices/"+"i2c-%d"%int(pdev['i2c']['topo_info']['dev_addr'], 0) + if 'topo_info' in pdev['i2c']: + return "/sys/bus/i2c/devices/"+"i2c-%d"%int(pdev['i2c']['topo_info']['dev_addr'], 0) + else: + return "/sys/bus/i2c/devices" return self.show_device_sysfs(pdev, ops) + "/" + "i2c-%d" % int(dev['i2c']['topo_info']['parent_bus'], 0) + def get_gpio_attr_path(self, dev, offset): + base = int(dev['i2c']['dev_attr']['gpio_base'], 16) + port_num = base + int(offset, 16) + gpio_name = 'gpio'+str(port_num) + path = '/sys/class/gpio/'+gpio_name+'/value' + return path - # This is alid for 'at24' type of EEPROM devices. Only one attribtue 'eeprom' + # 'at24' type of EEPROM devices have only one attribtue 'eeprom' def show_attr_eeprom_device(self, dev, ops): - str = "" - attr_name=ops['attr'] - attr_list=dev['i2c']['attr_list'] - KEY="eeprom" - dsysfs_path="" + ret = [] + attr_name = ops['attr'] + attr_list = dev['i2c']['attr_list'] + KEY = "eeprom" + dsysfs_path = "" - if not KEY in self.data_sysfs_obj: - self.data_sysfs_obj[KEY]=[] + if KEY not in self.data_sysfs_obj: + self.data_sysfs_obj[KEY] = [] for attr in attr_list: if attr_name == attr['attr_name'] or attr_name == 'all': @@ -585,119 +604,134 @@ def show_attr_eeprom_device(self, dev, ops): else: real_name = attr['attr_name'] - dsysfs_path = self.show_device_sysfs(dev, ops)+"/%d-00%x"%(int(dev['i2c']['topo_info']['parent_bus'],0), - int(dev['i2c']['topo_info']['dev_addr'], 0))+"/%s"%real_name - if not dsysfs_path in self.data_sysfs_obj[KEY]: + dsysfs_path = self.show_device_sysfs(dev, ops) + \ + "/%d-00%x" % (int(dev['i2c']['topo_info']['parent_bus'], 0), + int(dev['i2c']['topo_info']['dev_addr'], 0)) + \ + "/%s" % real_name + if dsysfs_path not in self.data_sysfs_obj[KEY]: self.data_sysfs_obj[KEY].append(dsysfs_path) - str += dsysfs_path+"\n" - return str + ret.append(dsysfs_path) + return ret def show_attr_gpio_device(self, dev, ops): - ret = "" - KEY="gpio" - if not KEY in self.data_sysfs_obj: - self.data_sysfs_obj[KEY]=[] + ret = [] + KEY = "gpio" + if KEY not in self.data_sysfs_obj: + self.data_sysfs_obj[KEY] = [] return ret def show_attr_mux_device(self, dev, ops): - ret = "" - KEY="mux" - if not KEY in self.data_sysfs_obj: - self.data_sysfs_obj[KEY]=[] + ret = [] + KEY = "mux" + if KEY not in self.data_sysfs_obj: + self.data_sysfs_obj[KEY] = [] return ret def show_attr_psu_i2c_device(self, dev, ops): - target=ops['target'] - attr_name=ops['attr'] - ret = "" - KEY="psu" - dsysfs_path="" + target = ops['target'] + attr_name = ops['attr'] + ret = [] + KEY = "psu" + dsysfs_path = "" - if not KEY in self.data_sysfs_obj: - self.data_sysfs_obj[KEY]=[] + if KEY not in self.data_sysfs_obj: + self.data_sysfs_obj[KEY] = [] - if target == 'all' or target == dev['dev_info']['virt_parent'] : - attr_list=dev['i2c']['attr_list'] + if target == 'all' or target == dev['dev_info']['virt_parent']: + attr_list = dev['i2c']['attr_list'] if 'i2c' in dev else [] for attr in attr_list: - if attr_name == attr['attr_name'] or attr_name == 'all' : + if attr_name == attr['attr_name'] or attr_name == 'all': if 'attr_devtype' in attr.keys() and attr['attr_devtype'] == "gpio": # Check and enable the gpio from class - gpio_dev = self.data[attr['attr_devname']] - base = int(gpio_dev['i2c']['dev_attr']['gpio_base'], 16) - port_num = base + int(attr['attr_offset'], 16) - gpio_name = 'gpio'+str(port_num) - attr_path = '/sys/class/gpio/'+gpio_name+'/value' + attr_path = self.get_gpio_attr_path(self.data[attr['attr_devname']], attr['attr_offset']) if (os.path.exists(attr_path)): - if not attr_path in self.data_sysfs_obj[KEY]: + if attr_path not in self.data_sysfs_obj[KEY]: self.data_sysfs_obj[KEY].append(attr_path) - ret += attr_path + '\n' + ret.append(attr_path) else: if 'drv_attr_name' in attr.keys(): real_name = attr['drv_attr_name'] + real_dev = dev + elif 'attr_devattr' in attr.keys(): + real_name = attr['attr_devattr'] + real_devname = attr['attr_devname'] if 'attr_devname' in attr.keys() else '' + real_dev = self.data[real_devname] else: real_name = attr['attr_name'] + real_dev = dev - dsysfs_path = self.show_device_sysfs(dev, ops) + \ - "/%d-00%x"%(int(dev['i2c']['topo_info']['parent_bus'], 0), - int(dev['i2c']['topo_info']['dev_addr'], 0)) + \ - "/%s"%real_name - if not dsysfs_path in self.data_sysfs_obj[KEY]: + dsysfs_path = self.show_device_sysfs(real_dev, ops) + \ + "/%d-00%x" % (int(real_dev['i2c']['topo_info']['parent_bus'], 0), + int(real_dev['i2c']['topo_info']['dev_addr'], 0)) + \ + "/%s" % real_name + if dsysfs_path not in self.data_sysfs_obj[KEY]: self.data_sysfs_obj[KEY].append(dsysfs_path) - ret += dsysfs_path+"\n" + ret.append(dsysfs_path) return ret def show_attr_psu_device(self, dev, ops): - return self.show_attr_psu_i2c_device(dev, ops ) - + return self.show_attr_psu_i2c_device(dev, ops) def show_attr_fan_device(self, dev, ops): - ret_str = "" - attr_name=ops['attr'] - attr_list=dev['i2c']['attr_list'] - KEY="fan" - dsysfs_path="" - - if not KEY in self.data_sysfs_obj: - self.data_sysfs_obj[KEY]=[] + ret = [] + attr_name = ops['attr'] + attr_list = dev['i2c']['attr_list'] if 'i2c' in dev else [] + KEY = "fan" + dsysfs_path = "" + if KEY not in self.data_sysfs_obj: + self.data_sysfs_obj[KEY] = [] for attr in attr_list: if attr_name == attr['attr_name'] or attr_name == 'all': - if 'drv_attr_name' in attr.keys(): - real_name = attr['drv_attr_name'] + if 'attr_devtype' in attr.keys() and attr['attr_devtype'] == "gpio": + # Check and enable the gpio from class + attr_path = self.get_gpio_attr_path(self.data[attr['attr_devname']], attr['attr_offset']) + if (os.path.exists(attr_path)): + if attr_path not in self.data_sysfs_obj[KEY]: + self.data_sysfs_obj[KEY].append(attr_path) + ret.append(attr_path) else: - real_name = attr['attr_name'] - - dsysfs_path= self.show_device_sysfs(dev, ops) + \ - "/%d-00%x" %(int(dev['i2c']['topo_info']['parent_bus'], 0), - int(dev['i2c']['topo_info']['dev_addr'], 0)) + \ - "/%s"%real_name - if not dsysfs_path in self.data_sysfs_obj[KEY]: - self.data_sysfs_obj[KEY].append(dsysfs_path) - ret_str += dsysfs_path+"\n" - return ret_str + if 'drv_attr_name' in attr.keys(): + real_name = attr['drv_attr_name'] + real_dev = dev + elif 'attr_devattr' in attr.keys(): + real_name = attr['attr_devattr'] + real_devname = attr['attr_devname'] if 'attr_devname' in attr.keys() else '' + real_dev = self.data[real_devname] + else: + real_name = attr['attr_name'] + real_dev = dev + + dsysfs_path = self.show_device_sysfs(real_dev, ops) + \ + "/%d-00%x" % (int(real_dev['i2c']['topo_info']['parent_bus'], 0), + int(real_dev['i2c']['topo_info']['dev_addr'], 0)) + \ + "/%s" % real_name + if dsysfs_path not in self.data_sysfs_obj[KEY]: + self.data_sysfs_obj[KEY].append(dsysfs_path) + ret.append(dsysfs_path) + return ret # This is only valid for LM75 def show_attr_temp_sensor_device(self, dev, ops): - ret_str = "" - attr_name=ops['attr'] - attr_list=dev['i2c']['attr_list'] - KEY="temp-sensors" - dsysfs_path="" - - if not KEY in self.data_sysfs_obj: - self.data_sysfs_obj[KEY]=[] + ret = [] + attr_name = ops['attr'] + attr_list = dev['i2c']['attr_list'] if 'i2c' in dev else [] + KEY = "temp-sensors" + dsysfs_path = "" + if KEY not in self.data_sysfs_obj: + self.data_sysfs_obj[KEY] = [] for attr in attr_list: if attr_name == attr['attr_name'] or attr_name == 'all': path = self.show_device_sysfs(dev, ops) + \ - "/%d-00%x/" %(int(dev['i2c']['topo_info']['parent_bus'], 0), - int(dev['i2c']['topo_info']['dev_addr'], 0)) + "/%d-00%x/" % (int(dev['i2c']['topo_info']['parent_bus'], 0), + int(dev['i2c']['topo_info']['dev_addr'], 0)) if 'drv_attr_name' in attr.keys(): real_name = attr['drv_attr_name'] else: @@ -705,87 +739,105 @@ def show_attr_temp_sensor_device(self, dev, ops): if (os.path.exists(path)): full_path = glob.glob(path + 'hwmon/hwmon*/' + real_name)[0] - dsysfs_path=full_path - if not dsysfs_path in self.data_sysfs_obj[KEY]: + dsysfs_path = full_path + if dsysfs_path not in self.data_sysfs_obj[KEY]: self.data_sysfs_obj[KEY].append(dsysfs_path) - ret_str += full_path + "\n" - return ret_str + ret.append(full_path) + return ret def show_attr_sysstatus_device(self, dev, ops): - ret = "" - attr_name=ops['attr'] - attr_list=dev['attr_list'] - KEY="sys-status" - dsysfs_path="" - - if not KEY in self.data_sysfs_obj: - self.data_sysfs_obj[KEY]=[] + ret = [] + attr_name = ops['attr'] + attr_list = dev['attr_list'] + KEY = "sys-status" + dsysfs_path = "" + if KEY not in self.data_sysfs_obj: + self.data_sysfs_obj[KEY] = [] for attr in attr_list: - if attr_name == attr['attr_name'] or attr_name == 'all': - dsysfs_path = "/sys/kernel/pddf/devices/sysstatus/sysstatus_data/" + attr['attr_name'] - if not dsysfs_path in self.data_sysfs_obj[KEY]: - self.data_sysfs_obj[KEY].append(dsysfs_path) - ret += dsysfs_path+"\n" + if attr_name == attr['attr_name'] or attr_name == 'all': + dsysfs_path = "/sys/kernel/pddf/devices/sysstatus/sysstatus_data/" + attr['attr_name'] + if dsysfs_path not in self.data_sysfs_obj[KEY]: + self.data_sysfs_obj[KEY].append(dsysfs_path) + ret.append(dsysfs_path) return ret def show_attr_xcvr_i2c_device(self, dev, ops): - target=ops['target'] - attr_name=ops['attr'] - ret = "" + target = ops['target'] + attr_name = ops['attr'] + ret = [] dsysfs_path = "" - KEY="xcvr" - if not KEY in self.data_sysfs_obj: - self.data_sysfs_obj[KEY]=[] + KEY = "xcvr" + if KEY not in self.data_sysfs_obj: + self.data_sysfs_obj[KEY] = [] - if target == 'all' or target == dev['dev_info']['virt_parent'] : - attr_list=dev['i2c']['attr_list'] + if target == 'all' or target == dev['dev_info']['virt_parent']: + attr_list = dev['i2c']['attr_list'] for attr in attr_list: - if attr_name == attr['attr_name'] or attr_name == 'all' : + if attr_name == attr['attr_name'] or attr_name == 'all': if 'attr_devtype' in attr.keys() and attr['attr_devtype'] == "gpio": # Check and enable the gpio from class - gpio_dev = self.data[attr['attr_devname']] - base = int(gpio_dev['i2c']['dev_attr']['gpio_base'], 16) - port_num = base + int(attr['attr_offset'], 16) - gpio_name = 'gpio'+str(port_num) - attr_path = '/sys/class/gpio/'+gpio_name+'/value' + attr_path = self.get_gpio_attr_path(self.data[attr['attr_devname']], attr['attr_offset']) if (os.path.exists(attr_path)): - if not attr_path in self.data_sysfs_obj[KEY]: + if attr_path not in self.data_sysfs_obj[KEY]: self.data_sysfs_obj[KEY].append(attr_path) - ret += attr_path + '\n' + ret.append(attr_path) else: if 'drv_attr_name' in attr.keys(): real_name = attr['drv_attr_name'] + real_dev = dev + elif 'attr_devattr' in attr.keys(): + real_name = attr['attr_devattr'] + real_devname = attr['attr_devname'] if 'attr_devname' in attr.keys() else '' + real_dev = self.data[real_devname] else: real_name = attr['attr_name'] + real_dev = dev - dsysfs_path = self.show_device_sysfs(dev, ops) + \ - "/%d-00%x" %(int(dev['i2c']['topo_info']['parent_bus'], 0), - int(dev['i2c']['topo_info']['dev_addr'], 0)) + \ - "/%s"%real_name - if not dsysfs_path in self.data_sysfs_obj[KEY]: + dsysfs_path = self.show_device_sysfs(real_dev, ops) + \ + "/%d-00%x" % (int(real_dev['i2c']['topo_info']['parent_bus'], 0), + int(real_dev['i2c']['topo_info']['dev_addr'], 0)) + \ + "/%s" % real_name + if dsysfs_path not in self.data_sysfs_obj[KEY]: self.data_sysfs_obj[KEY].append(dsysfs_path) - ret += dsysfs_path+"\n" + ret.append(dsysfs_path) return ret def show_attr_xcvr_device(self, dev, ops): - return self.show_attr_xcvr_i2c_device(dev, ops ) + return self.show_attr_xcvr_i2c_device(dev, ops) def show_attr_cpld_device(self, dev, ops): - ret = "" - KEY="cpld" - if not KEY in self.data_sysfs_obj: + ret = [] + KEY = "cpld" + if KEY not in self.data_sysfs_obj: + self.data_sysfs_obj[KEY] = [] + + return ret + + def show_attr_fpgai2c_device(self, dev, ops): + ret = [] + KEY="fpgai2c" + if KEY not in self.data_sysfs_obj: self.data_sysfs_obj[KEY]=[] return ret def show_attr_cpldmux_device(self, dev, ops): - ret = "" - KEY="cpldmux" - if not KEY in self.data_sysfs_obj: + ret = [] + KEY = "cpldmux" + if KEY not in self.data_sysfs_obj: + self.data_sysfs_obj[KEY] = [] + + return ret + + + def show_attr_fpgapci_device(self, dev, ops): + ret = [] + KEY="fpgapci" + if KEY not in self.data_sysfs_obj: self.data_sysfs_obj[KEY]=[] return ret @@ -795,25 +847,25 @@ def show_attr_cpldmux_device(self, dev, ops): # SHOW DEFS ################################################################################################################### def check_led_cmds(self, key, ops): - name = ops['target']+'_LED' - if (ops['target']=='config' or ops['attr']=='all') or \ - (name==self.data[key]['dev_info']['device_name'] and - ops['attr']==self.data[key]['dev_attr']['index']): - return (True) - else: - return (False) + name = ops['target']+'_LED' + if (ops['target'] == 'config' or ops['attr'] == 'all') or \ + (name == self.data[key]['dev_info']['device_name'] and + ops['attr'] == self.data[key]['dev_attr']['index']): + return (True) + else: + return (False) def dump_sysfs_obj(self, obj, key_type): - if (key_type == 'keys'): - for key in obj.keys(): - print key - return + if (key_type == 'keys'): + for key in obj.keys(): + print(key) + return - for key in obj: - if (key == key_type or key_type == 'all'): - print key+":" - for entry in obj[key]: - print "\t"+entry + for key in obj: + if (key == key_type or key_type == 'all'): + print(key+":") + for entry in obj[key]: + print("\t"+entry) def add_list_sysfs_obj(self, obj, KEY, list): for sysfs in list: @@ -821,160 +873,153 @@ def add_list_sysfs_obj(self, obj, KEY, list): obj[KEY].append(sysfs) def sysfs_attr(self, key, value, path, obj, obj_key): - sysfs_path="/sys/kernel/%s/%s"%(path, key) - if not sysfs_path in obj[obj_key]: - obj[obj_key].append(sysfs_path) - + sysfs_path = "/sys/kernel/%s/%s" % (path, key) + if not sysfs_path in obj[obj_key]: + obj[obj_key].append(sysfs_path) def sysfs_device(self, attr, path, obj, obj_key): - for key in attr.keys(): - sysfs_path="/sys/kernel/%s/%s"%(path, key) - if not sysfs_path in obj[obj_key]: - obj[obj_key].append(sysfs_path) + for key in attr.keys(): + sysfs_path = "/sys/kernel/%s/%s" % (path, key) + if not sysfs_path in obj[obj_key]: + obj[obj_key].append(sysfs_path) def show_eeprom_device(self, dev, ops): - return - + return def show_mux_device(self, dev, ops): - KEY ='mux' - if not KEY in self.sysfs_obj: - self.sysfs_obj[KEY] = [] - self.sysfs_device(dev['i2c']['topo_info'], "pddf/devices/mux", self.sysfs_obj, KEY) - self.sysfs_device(dev['i2c']['dev_attr'], "pddf/devices/mux", self.sysfs_obj, KEY) - sysfs_path= "/sys/kernel/pddf/devices/mux/dev_ops" - if not sysfs_path in self.sysfs_obj[KEY]: - self.sysfs_obj[KEY].append(sysfs_path) - list=['/sys/kernel/pddf/devices/mux/i2c_type', - '/sys/kernel/pddf/devices/mux/i2c_name', - '/sys/kernel/pddf/devices/mux/error'] - self.add_list_sysfs_obj(self.sysfs_obj, KEY, list) + KEY = 'mux' + if not KEY in self.sysfs_obj: + self.sysfs_obj[KEY] = [] + self.sysfs_device(dev['i2c']['topo_info'], "pddf/devices/mux", self.sysfs_obj, KEY) + self.sysfs_device(dev['i2c']['dev_attr'], "pddf/devices/mux", self.sysfs_obj, KEY) + sysfs_path = "/sys/kernel/pddf/devices/mux/dev_ops" + if not sysfs_path in self.sysfs_obj[KEY]: + self.sysfs_obj[KEY].append(sysfs_path) + list = ['/sys/kernel/pddf/devices/mux/i2c_type', + '/sys/kernel/pddf/devices/mux/i2c_name', + '/sys/kernel/pddf/devices/mux/error'] + self.add_list_sysfs_obj(self.sysfs_obj, KEY, list) def show_gpio_device(self, dev, ops): - KEY ='gpio' - if not KEY in self.sysfs_obj: - self.sysfs_obj[KEY] = [] - self.sysfs_device(dev['i2c']['topo_info'], "pddf/devices/gpio", self.sysfs_obj, KEY) - self.sysfs_device(dev['i2c']['dev_attr'], "pddf/devices/gpio", self.sysfs_obj, KEY) - sysfs_path= "/sys/kernel/pddf/devices/gpio/dev_ops" - if not sysfs_path in self.sysfs_obj[KEY]: - self.sysfs_obj[KEY].append(sysfs_path) - list=['/sys/kernel/pddf/devices/gpio/i2c_type', - '/sys/kernel/pddf/devices/gpio/i2c_name', - '/sys/kernel/pddf/devices/gpio/error'] - self.add_list_sysfs_obj(self.sysfs_obj, KEY, list) - + KEY = 'gpio' + if not KEY in self.sysfs_obj: + self.sysfs_obj[KEY] = [] + self.sysfs_device(dev['i2c']['topo_info'], "pddf/devices/gpio", self.sysfs_obj, KEY) + self.sysfs_device(dev['i2c']['dev_attr'], "pddf/devices/gpio", self.sysfs_obj, KEY) + sysfs_path = "/sys/kernel/pddf/devices/gpio/dev_ops" + if not sysfs_path in self.sysfs_obj[KEY]: + self.sysfs_obj[KEY].append(sysfs_path) + list = ['/sys/kernel/pddf/devices/gpio/i2c_type', + '/sys/kernel/pddf/devices/gpio/i2c_name', + '/sys/kernel/pddf/devices/gpio/error'] + self.add_list_sysfs_obj(self.sysfs_obj, KEY, list) def show_psu_i2c_device(self, dev, ops): - KEY ='psu' - path='pddf/devices/psu/i2c' + KEY = 'psu' + path = 'pddf/devices/psu/i2c' if dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['PSU']: if not KEY in self.sysfs_obj: - self.sysfs_obj[KEY] = [] - self.sysfs_device(dev['i2c']['topo_info'], path, self.sysfs_obj, KEY) - sysfs_path = "/sys/kernel/pddf/devices/psu/i2c/psu_idx" - self.sysfs_obj[KEY].append(sysfs_path) + self.sysfs_obj[KEY] = [] + self.sysfs_device(dev['i2c']['topo_info'], path, self.sysfs_obj, KEY) + sysfs_path = "/sys/kernel/pddf/devices/psu/i2c/psu_idx" + self.sysfs_obj[KEY].append(sysfs_path) - for attr in dev['i2c']['attr_list']: - self.sysfs_device(attr, "pddf/devices/psu/i2c", self.sysfs_obj, KEY) - sysfs_path = "/sys/kernel/pddf/devices/psu/i2c/dev_ops" - if not sysfs_path in self.sysfs_obj[KEY]: - self.sysfs_obj[KEY].append(sysfs_path) - list=['/sys/kernel/pddf/devices/psu/i2c/i2c_type', - '/sys/kernel/pddf/devices/fan/i2c/i2c_name', - '/sys/kernel/pddf/devices/psu/i2c/error', - '/sys/kernel/pddf/devices/psu/i2c/attr_ops'] - self.add_list_sysfs_obj(self.sysfs_obj, KEY, list) + for attr in dev['i2c']['attr_list']: + self.sysfs_device(attr, "pddf/devices/psu/i2c", self.sysfs_obj, KEY) + sysfs_path = "/sys/kernel/pddf/devices/psu/i2c/dev_ops" + if not sysfs_path in self.sysfs_obj[KEY]: + self.sysfs_obj[KEY].append(sysfs_path) + list = ['/sys/kernel/pddf/devices/psu/i2c/i2c_type', + '/sys/kernel/pddf/devices/fan/i2c/i2c_name', + '/sys/kernel/pddf/devices/psu/i2c/error', + '/sys/kernel/pddf/devices/psu/i2c/attr_ops'] + self.add_list_sysfs_obj(self.sysfs_obj, KEY, list) def show_psu_device(self, dev, ops): - self.show_psu_i2c_device(dev, ops ) - return + self.show_psu_i2c_device(dev, ops) + return def show_client_device(self): - KEY ='client' + KEY = 'client' if not KEY in self.sysfs_obj: - self.sysfs_obj[KEY] = [] - list=['/sys/kernel/pddf/devices/showall'] - self.add_list_sysfs_obj(self.sysfs_obj, KEY, list) - + self.sysfs_obj[KEY] = [] + list = ['/sys/kernel/pddf/devices/showall'] + self.add_list_sysfs_obj(self.sysfs_obj, KEY, list) def show_fan_device(self, dev, ops): - KEY ='fan' - path='pddf/devices/fan/i2c' + KEY = 'fan' + path = 'pddf/devices/fan/i2c' if dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['FAN']: if not KEY in self.sysfs_obj: - self.sysfs_obj[KEY] = [] - - self.sysfs_device(dev['i2c']['topo_info'], path, self.sysfs_obj, KEY) - self.sysfs_device(dev['i2c']['dev_attr'], path, self.sysfs_obj, KEY) - for attr in dev['i2c']['attr_list']: - self.sysfs_device(attr, path, self.sysfs_obj, KEY) - list=['/sys/kernel/pddf/devices/fan/i2c/i2c_type', - '/sys/kernel/pddf/devices/fan/i2c/i2c_name', - '/sys/kernel/pddf/devices/fan/i2c/error', - '/sys/kernel/pddf/devices/fan/i2c/attr_ops', - '/sys/kernel/pddf/devices/fan/i2c/dev_ops'] - self.add_list_sysfs_obj(self.sysfs_obj, KEY, list) + self.sysfs_obj[KEY] = [] + self.sysfs_device(dev['i2c']['topo_info'], path, self.sysfs_obj, KEY) + self.sysfs_device(dev['i2c']['dev_attr'], path, self.sysfs_obj, KEY) + for attr in dev['i2c']['attr_list']: + self.sysfs_device(attr, path, self.sysfs_obj, KEY) + list = ['/sys/kernel/pddf/devices/fan/i2c/i2c_type', + '/sys/kernel/pddf/devices/fan/i2c/i2c_name', + '/sys/kernel/pddf/devices/fan/i2c/error', + '/sys/kernel/pddf/devices/fan/i2c/attr_ops', + '/sys/kernel/pddf/devices/fan/i2c/dev_ops'] + self.add_list_sysfs_obj(self.sysfs_obj, KEY, list) def show_temp_sensor_device(self, dev, ops): - return + return def show_sysstatus_device(self, dev, ops): - KEY ='sysstatus' + KEY = 'sysstatus' if not KEY in self.sysfs_obj: self.sysfs_obj[KEY] = [] for attr in dev['attr_list']: - self.sysfs_device(attr, "pddf/devices/sysstatus", self.sysfs_obj, KEY) - sysfs_path= "/sys/kernel/pddf/devices/sysstatus/attr_ops" - if not sysfs_path in self.sysfs_obj[KEY]: - self.sysfs_obj[KEY].append(sysfs_path) - + self.sysfs_device(attr, "pddf/devices/sysstatus", self.sysfs_obj, KEY) + sysfs_path = "/sys/kernel/pddf/devices/sysstatus/attr_ops" + if not sysfs_path in self.sysfs_obj[KEY]: + self.sysfs_obj[KEY].append(sysfs_path) def show_xcvr_i2c_device(self, dev, ops): - KEY ='xcvr' + KEY = 'xcvr' if dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['PORT_MODULE']: if not KEY in self.sysfs_obj: - self.sysfs_obj[KEY] = [] - self.sysfs_device(dev['i2c']['topo_info'], "pddf/devices/xcvr/i2c", self.sysfs_obj, KEY) - - for attr in dev['i2c']['attr_list']: - self.sysfs_device(attr, "pddf/devices/xcvr/i2c", self.sysfs_obj, KEY) - sysfs_path = "/sys/kernel/pddf/devices/xcvr/i2c/dev_ops" - if not sysfs_path in self.sysfs_obj[KEY]: - self.sysfs_obj[KEY].append(sysfs_path) - list=['/sys/kernel/pddf/devices/xcvr/i2c/i2c_type', - '/sys/kernel/pddf/devices/xcvr/i2c/i2c_name', - '/sys/kernel/pddf/devices/xcvr/i2c/error', - '/sys/kernel/pddf/devices/xcvr/i2c/attr_ops'] - self.add_list_sysfs_obj(self.sysfs_obj, KEY, list) + self.sysfs_obj[KEY] = [] + self.sysfs_device(dev['i2c']['topo_info'], "pddf/devices/xcvr/i2c", self.sysfs_obj, KEY) + for attr in dev['i2c']['attr_list']: + self.sysfs_device(attr, "pddf/devices/xcvr/i2c", self.sysfs_obj, KEY) + sysfs_path = "/sys/kernel/pddf/devices/xcvr/i2c/dev_ops" + if not sysfs_path in self.sysfs_obj[KEY]: + self.sysfs_obj[KEY].append(sysfs_path) + list = ['/sys/kernel/pddf/devices/xcvr/i2c/i2c_type', + '/sys/kernel/pddf/devices/xcvr/i2c/i2c_name', + '/sys/kernel/pddf/devices/xcvr/i2c/error', + '/sys/kernel/pddf/devices/xcvr/i2c/attr_ops'] + self.add_list_sysfs_obj(self.sysfs_obj, KEY, list) def show_xcvr_device(self, dev, ops): - self.show_xcvr_i2c_device(dev, ops ) - return + self.show_xcvr_i2c_device(dev, ops) + return def show_cpld_device(self, dev, ops): - KEY ='cpld' + KEY = 'cpld' if dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['CPLD']: if not KEY in self.sysfs_obj: - self.sysfs_obj[KEY] = [] - self.sysfs_device(dev['i2c']['topo_info'], "pddf/devices/cpld", self.sysfs_obj, KEY) - sysfs_path= "/sys/kernel/pddf/devices/cpld/dev_ops" - if not sysfs_path in self.sysfs_obj[KEY]: - self.sysfs_obj[KEY].append(sysfs_path) - list=['/sys/kernel/pddf/devices/cpld/i2c_type', - '/sys/kernel/pddf/devices/cpld/i2c_name', - '/sys/kernel/pddf/devices/cpld/error'] - self.add_list_sysfs_obj(self.sysfs_obj, KEY, list) + self.sysfs_obj[KEY] = [] + self.sysfs_device(dev['i2c']['topo_info'], "pddf/devices/cpld", self.sysfs_obj, KEY) + sysfs_path = "/sys/kernel/pddf/devices/cpld/dev_ops" + if not sysfs_path in self.sysfs_obj[KEY]: + self.sysfs_obj[KEY].append(sysfs_path) + list = ['/sys/kernel/pddf/devices/cpld/i2c_type', + '/sys/kernel/pddf/devices/cpld/i2c_name', + '/sys/kernel/pddf/devices/cpld/error'] + self.add_list_sysfs_obj(self.sysfs_obj, KEY, list) def show_led_platform_device(self, key, ops): - if ops['attr']=='all' or ops['attr']=='PLATFORM': - KEY='platform' + if ops['attr'] == 'all' or ops['attr'] == 'PLATFORM': + KEY = 'platform' if not KEY in self.sysfs_obj: self.sysfs_obj[KEY] = [] - path='pddf/devices/platform' + path = 'pddf/devices/platform' self.sysfs_attr('num_psus', self.data['PLATFORM']['num_psus'], path, self.sysfs_obj, KEY) self.sysfs_attr('num_fantrays', self.data['PLATFORM']['num_fantrays'], path, self.sysfs_obj, KEY) @@ -991,7 +1036,7 @@ def show_led_device(self, key, ops): path,self.sysfs_obj, KEY) self.sysfs_device(self.data[key]['dev_attr'], path, self.sysfs_obj, KEY) for attr_key in attr.keys(): - attr_path="pddf/devices/led/" + attr['attr_name'] + attr_path = "pddf/devices/led/" + attr['attr_name'] if (attr_key != 'attr_name' and attr_key != 'swpld_addr' and attr_key != 'swpld_addr_offset'): self.sysfs_attr(attr_key, attr[attr_key], attr_path, self.sysfs_obj, KEY) sysfs_path="/sys/kernel/pddf/devices/led/dev_ops" @@ -1011,7 +1056,7 @@ def validate_xcvr_device(self, dev, ops): if 'attr_name' in attr.keys() and 'eeprom' in attr.values(): ret_val = "xcvr validation success" else: - print "xcvr validation Failed" + print("xcvr validation Failed") return elif dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['PORT_MODULE']: @@ -1019,9 +1064,9 @@ def validate_xcvr_device(self, dev, ops): if attr.get("attr_name") in dev_attribs: ret_val = "Success" else: - print "xcvr validation Failed" + print("xcvr validation Failed") return - print ret_val + print(ret_val) def validate_eeprom_device(self, dev, ops): devtype_list = ['24c02'] @@ -1034,7 +1079,7 @@ def validate_eeprom_device(self, dev, ops): for attr in dev['i2c']['attr_list']: if attr.get("attr_name") in dev_attribs: ret_val = "eeprom success" - print ret_val + print(ret_val) def validate_mux_device(self, dev, ops): devtype_list = ['pca9548', 'pca954x'] @@ -1045,7 +1090,7 @@ def validate_mux_device(self, dev, ops): for attr in dev['i2c']['channel']: if attr.get("chn") in dev_channels: ret_val = "Mux success" - print ret_val + print(ret_val) def validate_cpld_device(self, dev, ops): devtype_list = ['i2c_cpld'] @@ -1053,20 +1098,20 @@ def validate_cpld_device(self, dev, ops): if dev['i2c']['topo_info']['dev_type'] in devtype_list: ret_val = "cpld success" - print ret_val + print(ret_val) def validate_sysstatus_device(self, dev, ops): dev_attribs = ['board_info', 'cpld1_version', 'power_module_status', 'system_reset5', - 'system_reset6', 'system_reset7', 'misc1', 'cpld2_version', 'cpld3_version' - ] + 'system_reset6', 'system_reset7', 'misc1', 'cpld2_version', 'cpld3_version' + ] ret_val = "sysstatus failed" if dev['dev_info']['device_type'] == "SYSSTAT": - for attr in dev['attr_list']: - if attr.get("attr_name") in dev_attribs: - ret_val = "sysstatus success" - print ret_val + for attr in dev['attr_list']: + if attr.get("attr_name") in dev_attribs: + ret_val = "sysstatus success" + print(ret_val) def validate_temp_sensor_device(self, dev, ops): devtype_list = ['lm75'] @@ -1078,21 +1123,21 @@ def validate_temp_sensor_device(self, dev, ops): for attr in dev['i2c']['attr_list']: if attr.get("attr_name") in dev_attribs: ret_val = "tempsensor success" - print ret_val + print(ret_val) def validate_fan_device(self, dev, ops): ret_val = "fan failed" if dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['FAN']: - if dev['i2c']['dev_attr']['num_fan'] is not None: + if dev['i2c']['dev_attr']['num_fantrays'] is not None: ret_val = "fan success" - print ret_val + print(ret_val) def validate_psu_device(self, dev, ops): dev_attribs = ['psu_present', 'psu_model_name', 'psu_power_good', 'psu_mfr_id', 'psu_serial_num', - 'psu_fan_dir', 'psu_v_out', 'psu_i_out', 'psu_p_out', 'psu_fan1_speed_rpm' - ] + 'psu_fan_dir', 'psu_v_out', 'psu_i_out', 'psu_p_out', 'psu_fan1_speed_rpm' + ] ret_val = "psu failed" if dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['PSU']: @@ -1102,167 +1147,167 @@ def validate_psu_device(self, dev, ops): if attr.get("attr_offset") is not None: if attr.get("attr_mask") is not None: if attr.get("attr_len") is not None: - ret_val = "psu success" + ret_val = "psu success" else: ret_val = "psu failed" - print ret_val + print(ret_val) ################################################################################################################### # SPYTEST ################################################################################################################### def verify_attr(self, key, attr, path): - node="/sys/kernel/%s/%s"%(path, key) - try: - with open(node, 'r') as f: - status = f.read() - except IOError: - print "PDDF_VERIFY_ERR: IOError: node:%s key:%s"%(node, key) - return + node = "/sys/kernel/%s/%s" % (path, key) + try: + with open(node, 'r') as f: + status = f.read() + except IOError: + print("PDDF_VERIFY_ERR: IOError: node:%s key:%s" % (node, key)) + return - status=status.rstrip("\n\r") - if attr[key]!=status: - print "PDDF_VERIFY_ERR: node: %s switch:%s"%(node, status) + status = status.rstrip("\n\r") + if attr[key] != status: + print("PDDF_VERIFY_ERR: node: %s switch:%s" % (node, status)) def verify_device(self, attr, path, ops): - for key in attr.keys(): - self.verify_attr(key, attr, path) - + for key in attr.keys(): + self.verify_attr(key, attr, path) def get_led_device(self, device_name): self.create_attr('device_name', self.data[device_name]['dev_info']['device_name'], "pddf/devices/led") self.create_attr('index', self.data[device_name]['dev_attr']['index'], "pddf/devices/led") - cmd="echo 'verify' > /sys/kernel/pddf/devices/led/dev_ops" + cmd = "echo 'verify' > /sys/kernel/pddf/devices/led/dev_ops" self.runcmd(cmd) def validate_sysfs_creation(self, obj, validate_type): - dir = '/sys/kernel/pddf/devices/'+validate_type - if (os.path.exists(dir) or validate_type=='client'): - for sysfs in obj[validate_type]: - if(not os.path.exists(sysfs)): - print "[SYSFS FILE] " + sysfs + ": does not exist" - else: - print "[SYSFS DIR] " + dir + ": does not exist" + dir = '/sys/kernel/pddf/devices/'+validate_type + if (os.path.exists(dir) or validate_type == 'client'): + for sysfs in obj[validate_type]: + if(not os.path.exists(sysfs)): + print("[SYSFS FILE] " + sysfs + ": does not exist") + else: + print("[SYSFS DIR] " + dir + ": does not exist") def validate_dsysfs_creation(self, obj, validate_type): if validate_type in obj.keys(): # There is a possibility that some components dont have any device-self.data attr if not obj[validate_type]: - print "[SYSFS ATTR] for " + validate_type + ": empty " + print("[SYSFS ATTR] for " + validate_type + ": empty ") else: - for sysfs in obj[validate_type]: - if(not os.path.exists(sysfs)): - print "[SYSFS FILE] " + sysfs + ": does not exist" + for sysfs in obj[validate_type]: + if(not os.path.exists(sysfs)): + print("[SYSFS FILE] " + sysfs + ": does not exist") else: - print "[SYSFS KEY] for " + validate_type + ": not configured" + print("[SYSFS KEY] for " + validate_type + ": not configured") def verify_sysfs_data(self, verify_type): - if (verify_type=='LED'): + if (verify_type == 'LED'): for key in self.data.keys(): if key != 'PLATFORM': - attr=self.data[key]['dev_info'] + attr = self.data[key]['dev_info'] if attr['device_type'] == 'LED': self.get_led_device(key) self.verify_attr('device_name', self.data[key]['dev_info'], "pddf/devices/led") self.verify_attr('index', self.data[key]['dev_attr'], "pddf/devices/led") for attr in self.data[key]['i2c']['attr_list']: - path="pddf/devices/led/" + attr['attr_name'] + path = "pddf/devices/led/" + attr['attr_name'] for entry in attr.keys(): if (entry != 'attr_name' and entry != 'swpld_addr' and entry != 'swpld_addr_offset'): - self.verify_attr(entry, attr, path) - if ( entry == 'swpld_addr' or entry == 'swpld_addr_offset'): - self.verify_attr(entry, attr, 'pddf/devices/led') + self.verify_attr(entry, attr, path) + if (entry == 'swpld_addr' or entry == 'swpld_addr_offset'): + self.verify_attr(entry, attr, 'pddf/devices/led') def schema_validation(self, validate_type): - process_validate_type = 0 - for key in self.data.keys(): - if (key != 'PLATFORM'): - temp_obj={} - schema_list=[] + process_validate_type = 0 + for key in self.data.keys(): + if (key != 'PLATFORM'): + temp_obj = {} + schema_list = [] + try: + device_type = self.data[key]["dev_info"]["device_type"] + except Exception as e: + print("dev_info or device_type ERROR: " + key) + print(e) + + if validate_type == 'mismatch': + process_validate_type = 1 + device_type = "PSU" + schema_file = "/usr/local/bin/schema/FAN.schema" + schema_list.append(schema_file) + elif validate_type == 'missing': + process_validate_type = 1 + schema_file = "/usr/local/bin/schema/PLATFORM.schema" + schema_list.append(schema_file) + + elif validate_type == 'empty': + process_validate_type = 1 + if not device_type: + print("Empty device_type for " + key) + continue + elif (validate_type == 'all' or validate_type == device_type): + process_validate_type = 1 + if "bmc" in self.data[key].keys(): + schema_file = "/usr/local/bin/schema/"+device_type + "_BMC.schema" + schema_list.append(schema_file) + + if "i2c" in self.data[key].keys(): + schema_file = "/usr/local/bin/schema/"+device_type + ".schema" + schema_list.append(schema_file) + if device_type: + temp_obj[device_type] = self.data[key] + for schema_file in schema_list: + if (os.path.exists(schema_file)): + print("Validate " + schema_file + ";" + key) + json_data = json.dumps(temp_obj) + with open(schema_file, 'r') as f: + schema = json.load(f) try: - device_type=self.data[key]["dev_info"]["device_type"] + from jsonschema import validate + validate(temp_obj, schema) except Exception as e: - print "dev_info or device_type ERROR: " + key - print e - - if validate_type == 'mismatch': - process_validate_type = 1 - device_type="PSU" - schema_file="/usr/local/bin/schema/FAN.schema" - schema_list.append(schema_file) - elif validate_type == 'missing': - process_validate_type = 1 - schema_file="/usr/local/bin/schema/PLATFORM.schema" - schema_list.append(schema_file) - - elif validate_type == 'empty': - process_validate_type = 1 - if not device_type: - print "Empty device_type for " + key - continue - elif (validate_type=='all' or validate_type==device_type): - process_validate_type = 1 - if "bmc" in self.data[key].keys(): - schema_file="/usr/local/bin/schema/"+device_type + "_BMC.schema" - schema_list.append(schema_file) - - if "i2c" in self.data[key].keys(): - schema_file="/usr/local/bin/schema/"+device_type + ".schema" - schema_list.append(schema_file) - if device_type: - temp_obj[device_type]=self.data[key] - for schema_file in schema_list: - if (os.path.exists(schema_file)): - print "Validate " + schema_file + ";" + key - json_data=json.dumps(temp_obj) - with open(schema_file, 'r') as f: - schema=json.load(f) - try: - validate(temp_obj, schema) - except Exception as e: - print "Validation ERROR: " + schema_file + ";" + key - if validate_type == 'mismatch': - return - else: - print e - else: - print "ERROR Missing File: " + schema_file - if not process_validate_type: - print "device_type: " + validate_type + " not configured" + print("Validation ERROR: " + schema_file + ";" + key) + if validate_type == 'mismatch': + return + else: + print(e) + else: + print("ERROR Missing File: " + schema_file) + if not process_validate_type: + print("device_type: " + validate_type + " not configured") def modules_validation(self, validate_type): kos = [] supported_type = False - module_validation_status=[] + module_validation_status = [] - if validate_type == "bmc": - kos=['ipmi_devintf', 'ipmi_si', 'ipmi_msghandler'] - validate_type = 'ipmi' + if validate_type == "bmc": + kos = ['ipmi_devintf', 'ipmi_si', 'ipmi_msghandler'] + validate_type = 'ipmi' else: - # generate the KOS list from pddf device JSON file - kos.extend(self.data['PLATFORM']['pddf_kos']) + # generate the KOS list from pddf device JSON file + kos.extend(self.data['PLATFORM']['pddf_kos']) - if 'custom_kos' in self.data['PLATFORM']: - kos.extend(self.data['PLATFORM']['custom_kos']) + if 'custom_kos' in self.data['PLATFORM']: + kos.extend(self.data['PLATFORM']['custom_kos']) for mod in kos: if validate_type in mod or validate_type == "pddf": - supported_type=True - cmd = "lsmod | grep " + mod - try: - subprocess.check_output(cmd, shell=True) - except Exception as e: - module_validation_status.append(mod) + supported_type = True + cmd = "lsmod | grep " + mod + try: + subprocess.check_output(cmd, shell=True) + except Exception as e: + module_validation_status.append(mod) if supported_type: if module_validation_status: - module_validation_status.append(":ERROR not loaded") - print str(module_validation_status)[1:-1] + module_validation_status.append(":ERROR not loaded") + print(str(module_validation_status)[1:-1]) else: - print "Loaded" + print("Loaded") else: - print validate_type + " not configured" + print(validate_type + " not configured" ) @@ -1272,428 +1317,386 @@ def modules_validation(self, validate_type): # PARSE DEFS ################################################################################################################### def psu_parse(self, dev, ops): - parse_str="" - ret="" - for ifce in dev['i2c']['interface']: - ret=getattr(self, ops['cmd']+"_psu_device")(self.data[ifce['dev']], ops ) - if not ret is None: - if str(ret).isdigit(): - if ret!=0: + ret = [] + for ifce in (dev['i2c']['interface'] if 'i2c' in dev else []): + val = getattr(self, ops['cmd']+"_psu_device")(self.data[ifce['dev']], ops) + if val: + if str(val[0]).isdigit(): + if val[0] != 0: # in case if 'create' functions - print "{}_psu_device failed".format(ops['cmd']) - return ret - else: - pass + print("{}_psu_device failed for {}".format(ops['cmd'], ifce['dev'])) + return val else: # in case of 'show_attr' functions - parse_str+=ret - return parse_str + ret.extend(val) + return ret def fan_parse(self, dev, ops): - parse_str="" - ret=getattr(self, ops['cmd']+"_fan_device")(dev, ops ) - if not ret is None: - if str(ret).isdigit(): - if ret!=0: + ret = [] + ret = getattr(self, ops['cmd']+"_fan_device")(dev, ops) + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions - print "{}_fan_device failed".format(ops['cmd']) - return ret - else: - pass - else: - # in case of 'show_attr' functions - parse_str+=ret + print("{}_fan_device failed for {}".format(ops['cmd'], dev['dev_info']['device_name'])) - return parse_str + return ret def temp_sensor_parse(self, dev, ops): - parse_str="" - ret=getattr(self, ops['cmd']+"_temp_sensor_device")(dev, ops ) - if not ret is None: - if str(ret).isdigit() : - if ret!=0: + ret = [] + ret = getattr(self, ops['cmd']+"_temp_sensor_device")(dev, ops) + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions - print "{}_temp_sensor_device failed".format(ops['cmd']) - return ret - else: - pass - else: - # in case of 'show_attr' functions - parse_str+=ret + print("{}_temp_sensor_device failed for {}".format(ops['cmd'], dev['dev_info']['device_name'])) - return parse_str + return ret def cpld_parse(self, dev, ops): - parse_str = "" + ret = [] ret = getattr(self, ops['cmd']+"_cpld_device")(dev, ops) - if not ret is None: - if str(ret).isdigit(): - if ret!=0: + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions - print "{}_cpld_device failed".format(ops['cmd']) + print("{}_cpld_device failed for {}".format(ops['cmd'], dev['dev_info']['device_name'])) + + return ret + + def fpgai2c_parse(self, dev, ops): + val = [] + ret = getattr(self, ops['cmd']+"_fpgai2c_device")(dev, ops) + if ret: + if str(ret[0]).isdigit(): + if ret[0]!=0: + # in case if 'create' functions + print("{}_fpgai2c_device failed".format(ops['cmd'])) return ret - else: - pass else: # in case of 'show_attr' functions - parse_str+=ret + val.extend(ret) - return parse_str + return val def cpldmux_parse(self, dev, ops): - parse_str = "" + val = [] ret = getattr(self, ops['cmd']+"_cpldmux_device")(dev, ops) - if not ret is None: - if str(ret).isdigit(): - if ret!=0: + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions - print "{}_cpldmux_device() cmd failed".format(ops['cmd']) + print("{}_cpldmux_device() cmd failed".format(ops['cmd'])) return ret - else: - pass else: - parse_str += ret + val.extend(ret) for chan in dev['i2c']['channel']: for device in chan['dev']: - ret = self.dev_parse(self.data[device], ops) - if not ret is None: - if str(ret).isdigit(): - if ret!=0: + ret = self.dev_parse(self.data[device], ops) + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions return ret - else: - pass else: - parse_str += ret + val.extend(ret) - return parse_str + return val def cpldmux_parse_reverse(self, dev, ops): - parse_str = "" + val = [] for chan in reversed(dev['i2c']['channel']): for device in reversed(chan['dev']): - ret = self.dev_parse(self.data[device], ops) - if not ret is None: - if str(ret).isdigit(): - if ret!=0: + ret = self.dev_parse(self.data[device], ops) + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions return ret - else: - pass else: - parse_str += ret + val.extend(ret) ret = getattr(self, ops['cmd']+"_cpldmux_device")(dev, ops) - if not ret is None: - if str(ret).isdigit(): - if ret!=0: + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions - print "{}_cpldmux_device() cmd failed".format(ops['cmd']) + print("{}_cpldmux_device() cmd failed".format(ops['cmd'])) return ret - else: - pass else: - parse_str += ret - - return parse_str + val.extend(ret) + return val - def sysstatus_parse(self, dev,ops): - parse_str = "" + def sysstatus_parse(self, dev, ops): + ret = [] ret = getattr(self, ops['cmd']+"_sysstatus_device")(dev, ops) - if not ret is None: - if str(ret).isdigit(): - if ret!=0: + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions - print "{}_sysstatus_device failed".format(ops['cmd']) - return ret - else: - pass - else: - # in case of 'show_attr' functions - parse_str+=ret + print("{}_sysstatus_device failed for {}".format(ops['cmd'], dev['dev_info']['device_name'])) - return parse_str + return ret def gpio_parse(self, dev, ops): - parse_str = "" + ret = [] ret = getattr(self, ops['cmd']+"_gpio_device")(dev, ops) - if not ret is None: - if str(ret).isdigit(): - if ret!=0: + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions - print "{}_temp_sensor_device failed".format(ops['cmd']) - return ret - else: - pass - else: - # in case of 'show_attr' functions - parse_str += ret - - return parse_str + print("{}_gpio_device failed for {}".format(ops['cmd'], dev['dev_info']['device_name'])) + return ret def mux_parse(self, dev, ops): - parse_str = "" + val = [] ret = getattr(self, ops['cmd']+"_mux_device")(dev, ops) - if not ret is None: - if str(ret).isdigit(): - if ret!=0: + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions - print "{}_mux_device() cmd failed".format(ops['cmd']) + print("{}_mux_device() cmd failed for {}".format(ops['cmd'], dev['dev_info']['device_name'])) return ret - else: - pass else: - parse_str += ret + val.extend(ret) for ch in dev['i2c']['channel']: - ret = self.dev_parse(self.data[ch['dev']], ops) - if not ret is None: - if str(ret).isdigit(): - if ret!=0: + ret = self.dev_parse(self.data[ch['dev']], ops) + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions return ret - else: - pass else: - parse_str += ret - return parse_str + val.extend(ret) + return val def mux_parse_reverse(self, dev, ops): - parse_str = "" + val = [] for ch in reversed(dev['i2c']['channel']): - ret = self.dev_parse(self.data[ch['dev']], ops) - if not ret is None: - if str(ret).isdigit(): - if ret!=0: + ret = self.dev_parse(self.data[ch['dev']], ops) + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions return ret - else: - pass else: - parse_str += ret + val.extend(ret) ret = getattr(self, ops['cmd']+"_mux_device")(dev, ops) - if not ret is None: - if str(ret).isdigit(): - if ret!=0: + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions - print "{}_mux_device() cmd failed".format(ops['cmd']) + print("{}_mux_device() cmd failed for {}".format(ops['cmd'], dev['dev_info']['device_name'])) return ret - else: - pass else: - parse_str += ret - - return parse_str + val.extend(ret) + return val def eeprom_parse(self, dev, ops): - parse_str = "" + ret = [] ret = getattr(self, ops['cmd']+"_eeprom_device")(dev, ops) - if not ret is None: - if str(ret).isdigit(): - if ret!=0: + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions - print "{}_eeprom_device() cmd failed".format(ops['cmd']) - return ret - else: - pass - else: - parse_str += ret + print("{}_eeprom_device() cmd failed for {}".format(ops['cmd'], dev['dev_info']['device_name'])) - return parse_str + return ret def optic_parse(self, dev, ops): - parse_str="" - ret="" + val = [] for ifce in dev['i2c']['interface']: - ret=getattr(self, ops['cmd']+"_xcvr_device")(self.data[ifce['dev']], ops ) - if not ret is None: - if str(ret).isdigit(): - if ret!=0: + ret = getattr(self, ops['cmd']+"_xcvr_device")(self.data[ifce['dev']], ops) + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions - print "{}_eeprom_device() cmd failed".format(ops['cmd']) + print("{}_xcvr_device() cmd failed for {}".format(ops['cmd'], ifce['dev'])) return ret - else: - pass else: - parse_str+=ret - return parse_str + val.extend(ret) + return val def cpu_parse(self, bus, ops): - parse_str = "" + val = [] for dev in bus['i2c']['CONTROLLERS']: dev1 = self.data[dev['dev']] for d in dev1['i2c']['DEVICES']: - ret=self.dev_parse(self.data[d['dev']], ops) - if not ret is None: - if str(ret).isdigit(): - if ret!=0: + ret = self.dev_parse(self.data[d['dev']], ops) + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions return ret - else: - pass else: - parse_str += ret - return parse_str + val.extend(ret) + return val def cpu_parse_reverse(self, bus, ops): - parse_str = "" + val = [] for dev in reversed(bus['i2c']['CONTROLLERS']): dev1 = self.data[dev['dev']] for d in reversed(dev1['i2c']['DEVICES']): - ret=self.dev_parse(self.data[d['dev']], ops) - if not ret is None: - if str(ret).isdigit(): - if ret!=0: + ret = self.dev_parse(self.data[d['dev']], ops) + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions return ret - else: - pass else: - parse_str += ret - return parse_str + val.extend(ret) + return val + + # 'create' and 'show_attr' ops returns an array + # 'delete', 'show' and 'validate' ops return None def dev_parse(self, dev, ops): - attr=dev['dev_info'] - if attr['device_type'] == 'CPU': - if ops['cmd']=='delete': - return self.cpu_parse_reverse(dev, ops) - else: - return self.cpu_parse(dev, ops) + attr=dev['dev_info'] + if attr['device_type'] == 'CPU': + if ops['cmd']=='delete': + return self.cpu_parse_reverse(dev, ops) + else: + return self.cpu_parse(dev, ops) - if attr['device_type'] == 'EEPROM': - return self.eeprom_parse(dev, ops) + if attr['device_type'] == 'EEPROM': + return self.eeprom_parse(dev, ops) - if attr['device_type'] == 'MUX': - if ops['cmd']=='delete': - return self.mux_parse_reverse(dev, ops) - else: - return self.mux_parse(dev, ops) + if attr['device_type'] == 'MUX': + if ops['cmd']=='delete': + return self.mux_parse_reverse(dev, ops) + else: + return self.mux_parse(dev, ops) - if attr['device_type'] == 'GPIO': - return self.gpio_parse(dev, ops) + if attr['device_type'] == 'GPIO': + return self.gpio_parse(dev, ops) - if attr['device_type'] == 'PSU': - return self.psu_parse(dev, ops) + if attr['device_type'] == 'PSU': + return self.psu_parse(dev, ops) - if attr['device_type'] == 'FAN': - return self.fan_parse(dev, ops) + if attr['device_type'] == 'FAN': + return self.fan_parse(dev, ops) - if attr['device_type'] == 'TEMP_SENSOR': - return self.temp_sensor_parse(dev, ops) + if attr['device_type'] == 'TEMP_SENSOR': + return self.temp_sensor_parse(dev, ops) - if attr['device_type'] == 'SFP' or attr['device_type'] == 'SFP28' or \ - attr['device_type'] == 'QSFP' or attr['device_type'] == 'QSFP28': - return self.optic_parse(dev, ops) + if attr['device_type'] == 'SFP' or attr['device_type'] == 'SFP+' or attr['device_type'] == 'SFP28' or \ + attr['device_type'] == 'QSFP' or attr['device_type'] == 'QSFP+' or attr['device_type'] == 'QSFP28' or \ + attr['device_type'] == 'QSFP-DD': + return self.optic_parse(dev, ops) - if attr['device_type'] == 'CPLD': - return self.cpld_parse(dev, ops) + if attr['device_type'] == 'CPLD': + return self.cpld_parse(dev, ops) - if attr['device_type'] == 'CPLDMUX': - if ops['cmd']=='delete': - return self.cpldmux_parse_reverse(dev, ops) - else: - return self.cpldmux_parse(dev, ops) + if attr['device_type'] == 'CPLDMUX': + if ops['cmd'] == 'delete': + return self.cpldmux_parse_reverse(dev, ops) + else: + return self.cpldmux_parse(dev, ops) - if attr['device_type'] == 'SYSSTAT': - return self.sysstatus_parse(dev,ops) + if attr['device_type'] == 'SYSSTAT': + return self.sysstatus_parse(dev, ops) def is_supported_sysled_state(self, sysled_name, sysled_state): - if not sysled_name in self.data.keys(): - return False, "[FAILED] " + sysled_name + " is not configured" - for attr in self.data[sysled_name]['i2c']['attr_list']: - if attr['attr_name'] == sysled_state: - return True, "[PASS] supported" - return False, "[FAILED]: Invalid color" + if not sysled_name in self.data.keys(): + return False, "[FAILED] " + sysled_name + " is not configured" + for attr in self.data[sysled_name]['i2c']['attr_list']: + if attr['attr_name'] == sysled_state: + return True, "[PASS] supported" + return False, "[FAILED]: Invalid color" def create_attr(self, key, value, path): - cmd = "echo '%s' > /sys/kernel/%s/%s"%(value, path, key) - self.runcmd(cmd) + cmd = "echo '%s' > /sys/kernel/%s/%s" % (value, path, key) + self.runcmd(cmd) def create_led_platform_device(self, key, ops): - if ops['attr']=='all' or ops['attr']=='PLATFORM': - path='pddf/devices/platform' - self.create_attr('num_psus', self.data['PLATFORM']['num_psus'], path) - self.create_attr('num_fantrays', self.data['PLATFORM']['num_fantrays'], path) + if ops['attr'] == 'all' or ops['attr'] == 'PLATFORM': + path = 'pddf/devices/platform' + self.create_attr('num_psus', self.data['PLATFORM']['num_psus'], path) + self.create_attr('num_fantrays', self.data['PLATFORM']['num_fantrays'], path) def create_led_device(self, key, ops): - if ops['attr']=='all' or ops['attr']==self.data[key]['dev_info']['device_name']: - path="pddf/devices/led" - for attr in self.data[key]['i2c']['attr_list']: - self.create_attr('device_name', self.data[key]['dev_info']['device_name'], path) - self.create_device(self.data[key]['dev_attr'], path, ops) - for attr_key in attr.keys(): - if (attr_key == 'swpld_addr_offset' or attr_key == 'swpld_addr'): - self.create_attr(attr_key, attr[attr_key], path) - elif (attr_key != 'attr_name' and attr_key != 'descr' and - attr_key != 'attr_devtype' and attr_key != 'attr_devname'): - state_path=path+'/state_attr' - self.create_attr(attr_key, attr[attr_key],state_path) - cmd="echo '" + attr['attr_name']+"' > /sys/kernel/pddf/devices/led/dev_ops" - self.runcmd(cmd) + if ops['attr']=='all' or ops['attr']==self.data[key]['dev_info']['device_name']: + path="pddf/devices/led" + for attr in self.data[key]['i2c']['attr_list']: + self.create_attr('device_name', self.data[key]['dev_info']['device_name'], path) + self.create_device(self.data[key]['dev_attr'], path, ops) + for attr_key in attr.keys(): + if (attr_key == 'swpld_addr_offset' or attr_key == 'swpld_addr'): + self.create_attr(attr_key, attr[attr_key], path) + elif (attr_key != 'attr_name' and attr_key != 'descr' and + attr_key != 'attr_devtype' and attr_key != 'attr_devname'): + state_path=path+'/state_attr' + self.create_attr(attr_key, attr[attr_key],state_path) + cmd="echo '" + attr['attr_name']+"' > /sys/kernel/pddf/devices/led/dev_ops" + self.runcmd(cmd) def led_parse(self, ops): - getattr(self, ops['cmd']+"_led_platform_device")("PLATFORM", ops) - for key in self.data.keys(): - if key != 'PLATFORM' and 'dev_info' in self.data[key]: - attr=self.data[key]['dev_info'] - if attr['device_type'] == 'LED': - getattr(self, ops['cmd']+"_led_device")(key, ops) + getattr(self, ops['cmd']+"_led_platform_device")("PLATFORM", ops) + for key in self.data.keys(): + if key != 'PLATFORM' and 'dev_info' in self.data[key]: + attr = self.data[key]['dev_info'] + if attr['device_type'] == 'LED': + getattr(self, ops['cmd']+"_led_device")(key, ops) def get_device_list(self, list, type): - for key in self.data.keys(): - if key != 'PLATFORM' and 'dev_info' in self.data[key]: - attr=self.data[key]['dev_info'] - if attr['device_type'] == type: - list.append(self.data[key]) + for key in self.data.keys(): + if key != 'PLATFORM' and 'dev_info' in self.data[key]: + attr = self.data[key]['dev_info'] + if attr['device_type'] == type: + list.append(self.data[key]) def create_pddf_devices(self): - self.led_parse({ "cmd": "create", "target":"all", "attr":"all" }) + self.led_parse({"cmd": "create", "target": "all", "attr": "all"}) create_ret = 0 - create_ret = self.dev_parse(self.data['SYSTEM'], { "cmd": "create", "target":"all", "attr":"all" } ) - if create_ret!=0: - return create_ret + ret = self.dev_parse(self.data['SYSTEM'], {"cmd": "create", "target": "all", "attr": "all"}) + if ret: + if ret[0] != 0: + return ret[0] if 'SYSSTATUS' in self.data: - create_ret = self.dev_parse(self.data['SYSSTATUS'], { "cmd": "create", "target":"all", "attr":"all" } ) - if create_ret!=0: - return create_ret - + ret = self.dev_parse(self.data['SYSSTATUS'], {"cmd": "create", "target": "all", "attr": "all"}) + if ret: + if ret[0] != 0: + return ret[0] + return create_ret + + def delete_pddf_devices(self): - self.dev_parse(self.data['SYSTEM'], { "cmd": "delete", "target":"all", "attr":"all" } ) + self.dev_parse(self.data['SYSTEM'], {"cmd": "delete", "target": "all", "attr": "all"}) if 'SYSSTATUS' in self.data: - self.dev_parse(self.data['SYSSTATUS'], { "cmd": "delete", "target":"all", "attr":"all" } ) + self.dev_parse(self.data['SYSSTATUS'], {"cmd": "delete", "target": "all", "attr": "all"}) def populate_pddf_sysfsobj(self): - self.dev_parse(self.data['SYSTEM'], { "cmd": "show", "target":"all", "attr":"all" } ) + self.dev_parse(self.data['SYSTEM'], {"cmd": "show", "target": "all", "attr": "all"}) if 'SYSSTATUS' in self.data: - self.dev_parse(self.data['SYSSTATUS'], { "cmd": "show", "target":"all", "attr":"all" } ) - self.led_parse({ "cmd": "show", "target":"all", "attr":"all" }) + self.dev_parse(self.data['SYSSTATUS'], {"cmd": "show", "target": "all", "attr": "all"}) + self.led_parse({"cmd": "show", "target": "all", "attr": "all"}) self.show_client_device() def cli_dump_dsysfs(self, component): - self.dev_parse(self.data['SYSTEM'], { "cmd": "show_attr", "target":"all", "attr":"all" } ) + self.dev_parse(self.data['SYSTEM'], {"cmd": "show_attr", "target": "all", "attr": "all"}) if 'SYSSTATUS' in self.data: - self.dev_parse(self.data['SYSSTATUS'], { "cmd": "show_attr", "target":"all", "attr":"all" } ) + self.dev_parse(self.data['SYSSTATUS'], {"cmd": "show_attr", "target": "all", "attr": "all"}) if component in self.data_sysfs_obj: return self.data_sysfs_obj[component] else: - return None - + return None def validate_pddf_devices(self, *args): - self.populate_pddf_sysfsobj() - v_ops = { 'cmd': 'validate', 'target':'all', 'attr':'all' } - self.dev_parse(self.data['SYSTEM'], v_ops ) + self.populate_pddf_sysfsobj() + v_ops = {'cmd': 'validate', 'target': 'all', 'attr': 'all'} + self.dev_parse(self.data['SYSTEM'], v_ops) ################################################################################################################## # BMC APIs @@ -1707,48 +1710,48 @@ def populate_bmc_cache_db(self, bmc_attr): delim = None o_list = subprocess.check_output(bmc_cmd, shell=True).strip().split('\n') - bmc_cache[bmc_cmd]={} - bmc_cache[bmc_cmd]['time']=time.time() + bmc_cache[bmc_cmd] = {} + bmc_cache[bmc_cmd]['time'] = time.time() for entry in o_list: name = entry.split(delim)[0].strip() - bmc_cache[bmc_cmd][name]=entry + bmc_cache[bmc_cmd][name] = entry def non_raw_ipmi_get_request(self, bmc_attr): - bmc_db_update_time=1 + bmc_db_update_time = 1 value = 'N/A' bmc_cmd = str(bmc_attr['bmc_cmd']).strip() field_name = str(bmc_attr['field_name']).strip() - field_pos= int(bmc_attr['field_pos'])-1 - + field_pos = int(bmc_attr['field_pos'])-1 + if 'delimiter' in bmc_attr.keys(): delim = str(bmc_attr['delimiter']).strip() else: delim = None if not bmc_cmd in bmc_cache: - self.populate_bmc_cache_db(bmc_attr) + self.populate_bmc_cache_db(bmc_attr) else: - now = time.time() - if (int(now - bmc_cache[bmc_cmd]['time']) > bmc_db_update_time): - self.populate_bmc_cache_db(bmc_attr) + now = time.time() + if (int(now - bmc_cache[bmc_cmd]['time']) > bmc_db_update_time): + self.populate_bmc_cache_db(bmc_attr) try: - data=bmc_cache[bmc_cmd][field_name] - value = data.split(delim)[field_pos].strip() + data = bmc_cache[bmc_cmd][field_name] + value = data.split(delim)[field_pos].strip() except Exception as e: - pass + pass if 'mult' in bmc_attr.keys() and not value.isalpha(): if value.isalpha(): value = 0.0 value = float(value) * float(bmc_attr['mult']) - + return str(value) def raw_ipmi_get_request(self, bmc_attr): value = 'N/A' - cmd = bmc_attr['bmc_cmd'] + " 2>/dev/null" - if bmc_attr['type'] == 'raw': + cmd = bmc_attr['bmc_cmd'] + " 2>/dev/null" + if bmc_attr['type'] == 'raw': try: value = subprocess.check_output(cmd, shell=True).strip() except Exception as e: @@ -1758,7 +1761,7 @@ def raw_ipmi_get_request(self, bmc_attr): value = str(int(value, 16)) return value - if bmc_attr['type'] == 'mask': + if bmc_attr['type'] == 'mask': mask = int(bmc_attr['mask'].encode('utf-8'), 16) try: value = subprocess.check_output(cmd, shell=True).strip() @@ -1768,10 +1771,10 @@ def raw_ipmi_get_request(self, bmc_attr): # value should either be '1' or '0' if value != 'N/A': value = '1' if bool(int(value, 16) & mask) else '0' - + return value - if bmc_attr['type'] == 'ascii': + if bmc_attr['type'] == 'ascii': try: value = subprocess.check_output(cmd, shell=True) except Exception as e: @@ -1779,19 +1782,19 @@ def raw_ipmi_get_request(self, bmc_attr): if value != 'N/A': tmp = ''.join(chr(int(i, 16)) for i in value.split()) - tmp = "".join(i for i in unicode(tmp) if unicodedata.category(i)[0]!="C") + tmp = "".join(i for i in unicode(tmp) if unicodedata.category(i)[0] != "C") value = str(tmp) return (value) - return value + return value - def bmc_get_cmd(self, bmc_attr): - if int(bmc_attr['raw']) == 1: + def bmc_get_cmd(self, bmc_attr): + if int(bmc_attr['raw']) == 1: value = self.raw_ipmi_get_request(bmc_attr) - else: + else: value = self.non_raw_ipmi_get_request(bmc_attr) - return (value) + return (value) def non_raw_ipmi_set_request(self, bmc_attr, val): value = 'N/A' @@ -1801,14 +1804,14 @@ def non_raw_ipmi_set_request(self, bmc_attr, val): def raw_ipmi_set_request(self, bmc_attr, val): value = 'N/A' # TODO: Implement this - return value + return value - def bmc_set_cmd(self, bmc_attr, val): - if int(bmc_attr['raw']) == 1: + def bmc_set_cmd(self, bmc_attr, val): + if int(bmc_attr['raw']) == 1: value = self.raw_ipmi_set_request(bmc_attr, val) - else: + else: value = self.non_raw_ipmi_set_request(bmc_attr, val) - return (value) + return (value) # bmc-based attr: return attr obj # non-bmc-based attr: return empty obj @@ -1821,43 +1824,43 @@ def check_bmc_based_attr(self, device_name, attr_name): return attr # Required attr_name is not supported in BMC object return {} - return None + return None def get_attr_name_output(self, device_name, attr_name): - bmc_attr = self.check_bmc_based_attr(device_name, attr_name) - output={"mode":"", "status":""} - + bmc_attr = self.check_bmc_based_attr(device_name, attr_name) + output = {"mode": "", "status": ""} + if bmc_attr is not None: - if bmc_attr=={}: - return {} - output['mode']="bmc" - output['status']=self.bmc_get_cmd(bmc_attr) + if bmc_attr == {}: + return {} + output['mode'] = "bmc" + output['status'] = self.bmc_get_cmd(bmc_attr) else: - output['mode']="i2c" - node = self.get_path(device_name, attr_name) - if node is None: - return {} - try: - with open(node, 'r') as f: - output['status'] = f.read() - except IOError: - return {} + output['mode'] = "i2c" + node = self.get_path(device_name, attr_name) + if node is None: + return {} + try: + with open(node, 'r') as f: + output['status'] = f.read() + except IOError: + return {} return output def set_attr_name_output(self, device_name, attr_name, val): - bmc_attr = self.check_bmc_based_attr(device_name, attr_name) - output={"mode":"", "status":""} - + bmc_attr = self.check_bmc_based_attr(device_name, attr_name) + output = {"mode": "", "status": ""} + if bmc_attr is not None: - if bmc_attr=={}: - return {} - output['mode']="bmc" - output['status']=False # No set operation allowed for BMC attributes as they are handled by BMC itself + if bmc_attr == {}: + return {} + output['mode'] = "bmc" + output['status'] = False # No set operation allowed for BMC attributes as they are handled by BMC itself else: - output['mode']="i2c" + output['mode'] = "i2c" node = self.get_path(device_name, attr_name) if node is None: - return {} + return {} try: with open(node, 'w') as f: f.write(str(val)) @@ -1886,7 +1889,7 @@ def main(): try: pddf_obj = PddfParse() except Exception as e: - print "%s" % str(e) + print("%s" % str(e)) sys.exit() if args.create: @@ -1894,39 +1897,40 @@ def main(): if args.sysfs: if args.sysfs[0] == 'all': - pddf_obj.populate_pddf_sysfsobj() + pddf_obj.populate_pddf_sysfsobj() if args.sysfs[0] == 'print': - pddf_obj.populate_pddf_sysfsobj() - pddf_obj.dump_sysfs_obj(pddf_obj.sysfs_obj, args.sysfs[1]) + pddf_obj.populate_pddf_sysfsobj() + pddf_obj.dump_sysfs_obj(pddf_obj.sysfs_obj, args.sysfs[1]) if args.sysfs[0] == 'validate': - pddf_obj.populate_pddf_sysfsobj() - pddf_obj.validate_sysfs_creation(pddf_obj.sysfs_obj, args.sysfs[1]) + pddf_obj.populate_pddf_sysfsobj() + pddf_obj.validate_sysfs_creation(pddf_obj.sysfs_obj, args.sysfs[1]) if args.sysfs[0] == 'verify': - pddf_obj.verify_sysfs_data(args.sysfs[1]) - + pddf_obj.verify_sysfs_data(args.sysfs[1]) if args.dsysfs: - if args.dsysfs[0] == 'validate': - pddf_obj.dev_parse(pddf_obj.data['SYSTEM'], { "cmd": "show_attr", "target":"all", "attr":"all" } ) + if args.dsysfs[0] == 'validate': + pddf_obj.dev_parse(pddf_obj.data['SYSTEM'], {"cmd": "show_attr", "target": "all", "attr": "all"}) if 'SYSSTATUS' in pddf_obj.data: - pddf_obj.dev_parse(pddf_obj.data['SYSSTATUS'], { "cmd": "show_attr", "target":"all", "attr":"all" } ) + pddf_obj.dev_parse(pddf_obj.data['SYSSTATUS'], {"cmd": "show_attr", "target": "all", "attr": "all"}) pddf_obj.validate_dsysfs_creation(pddf_obj.data_sysfs_obj, args.dsysfs[1]) elif args.dsysfs[0] == 'print': - pddf_obj.dev_parse(pddf_obj.data['SYSTEM'], { "cmd": "show_attr", "target":"all", "attr":"all" } ) + pddf_obj.dev_parse(pddf_obj.data['SYSTEM'], {"cmd": "show_attr", "target": "all", "attr": "all"}) if 'SYSSTATUS' in pddf_obj.data: - pddf_obj.dev_parse(pddf_obj.data['SYSSTATUS'], { "cmd": "show_attr", "target":"all", "attr":"all" } ) + pddf_obj.dev_parse(pddf_obj.data['SYSSTATUS'], {"cmd": "show_attr", "target": "all", "attr": "all"}) pddf_obj.dump_sysfs_obj(pddf_obj.data_sysfs_obj, args.dsysfs[1]) elif args.dsysfs[0] == 'all': - ret = pddf_obj.dev_parse(pddf_obj.data['SYSTEM'], { "cmd": "show_attr", "target":"all", "attr":"all" } ) + ret = pddf_obj.dev_parse(pddf_obj.data['SYSTEM'], {"cmd": "show_attr", "target": "all", "attr": "all"}) if 'SYSSTATUS' in pddf_obj.data: - ret += pddf_obj.dev_parse(pddf_obj.data['SYSSTATUS'], { "cmd": "show_attr", "target":"all", - "attr":"all" } ) + ret += pddf_obj.dev_parse(pddf_obj.data['SYSSTATUS'], {"cmd": "show_attr", "target": "all", + "attr": "all"}) pddf_obj.dump_sysfs_obj(pddf_obj.data_sysfs_obj, 'all') else: - pddf_obj.dev_parse(pddf_obj.data[args.dsysfs[0]], { "cmd": "show_attr", "target":args.dsysfs[0], - "attr":args.dsysfs[1] }) + val = pddf_obj.dev_parse(pddf_obj.data[args.dsysfs[0]], {"cmd": "show_attr", "target": args.dsysfs[0], + "attr": args.dsysfs[1]}) + for i in val: + print(i) if args.delete: pddf_obj.delete_pddf_devices() @@ -1944,6 +1948,5 @@ def main(): pddf_obj.modules_validation(args.modules[0]) - -if __name__ == "__main__" : - main() +if __name__ == "__main__": + main() diff --git a/platform/pddf/platform-api-pddf-base.dep b/platform/pddf/platform-api-pddf-base.dep index aaaedb068384..3c1f0d874814 100644 --- a/platform/pddf/platform-api-pddf-base.dep +++ b/platform/pddf/platform-api-pddf-base.dep @@ -1,5 +1,5 @@ -MPATH := $($(PDDF_PLATFORM_API_BASE_PY2)_SRC_PATH) +MPATH := $($(PDDF_PLATFORM_API_BASE_PY3)_SRC_PATH) DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/pddf/platform-api-pddf-base.mk platform/pddf/platform-api-pddf-base.dep DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) DEP_FILES += $(shell git ls-files $(MPATH)) diff --git a/platform/pddf/platform-api-pddf-base.mk b/platform/pddf/platform-api-pddf-base.mk index ce818707ba7e..673dfcd3e308 100644 --- a/platform/pddf/platform-api-pddf-base.mk +++ b/platform/pddf/platform-api-pddf-base.mk @@ -5,22 +5,26 @@ PDDF_PLATFORM_API_BASE_VERSION = 1.0 export PDDF_PLATFORM_API_BASE_VERSION -PDDF_PLATFORM_API_BASE_PY2 = sonic_platform_pddf_common-$(PDDF_PLATFORM_API_BASE_VERSION)-py2-none-any.whl -$(PDDF_PLATFORM_API_BASE_PY2)_SRC_PATH = $(PLATFORM_PDDF_PATH)/platform-api-pddf-base -$(PDDF_PLATFORM_API_BASE_PY2)_PYTHON_VERSION = 2 -$(PDDF_PLATFORM_API_BASE_PY2)_DEPENDS = $(SONIC_CONFIG_ENGINE) -SONIC_PYTHON_WHEELS += $(PDDF_PLATFORM_API_BASE_PY2) +ifeq ($(ENABLE_PY2_MODULES), y) + PDDF_PLATFORM_API_BASE_PY2 = sonic_platform_pddf_common-$(PDDF_PLATFORM_API_BASE_VERSION)-py2-none-any.whl + $(PDDF_PLATFORM_API_BASE_PY2)_SRC_PATH = $(PLATFORM_PDDF_PATH)/platform-api-pddf-base + $(PDDF_PLATFORM_API_BASE_PY2)_PYTHON_VERSION = 2 + $(PDDF_PLATFORM_API_BASE_PY2)_DEPENDS = $(SONIC_CONFIG_ENGINE) + SONIC_PYTHON_WHEELS += $(PDDF_PLATFORM_API_BASE_PY2) -export pddf_platform_api_base_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(PDDF_PLATFORM_API_BASE_PY2))" -export PDDF_PLATFORM_API_BASE_PY2 + export pddf_platform_api_base_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(PDDF_PLATFORM_API_BASE_PY2))" + export PDDF_PLATFORM_API_BASE_PY2 +endif PDDF_PLATFORM_API_BASE_PY3 = sonic_platform_pddf_common-$(PDDF_PLATFORM_API_BASE_VERSION)-py3-none-any.whl $(PDDF_PLATFORM_API_BASE_PY3)_SRC_PATH = $(PLATFORM_PDDF_PATH)/platform-api-pddf-base $(PDDF_PLATFORM_API_BASE_PY3)_PYTHON_VERSION = 3 $(PDDF_PLATFORM_API_BASE_PY3)_DEPENDS = $(SONIC_CONFIG_ENGINE) -# Synthetic dependency to avoid building the Python 2 and 3 packages -# simultaneously and any potential conflicts which may arise -$(PDDF_PLATFORM_API_BASE_PY3)_DEPENDS += $(PDDF_PLATFORM_API_BASE_PY2) +ifeq ($(ENABLE_PY2_MODULES), y) + # Synthetic dependency to avoid building the Python 2 and 3 packages + # simultaneously and any potential conflicts which may arise + $(PDDF_PLATFORM_API_BASE_PY3)_DEPENDS += $(PDDF_PLATFORM_API_BASE_PY2) +endif $(PDDF_PLATFORM_API_BASE_PY3)_TEST = n SONIC_PYTHON_WHEELS += $(PDDF_PLATFORM_API_BASE_PY3) diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_chassis.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_chassis.py old mode 100755 new mode 100644 index 9d0d963347ba..d90949184d5b --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_chassis.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_chassis.py @@ -10,7 +10,7 @@ from sonic_platform_base.chassis_base import ChassisBase from sonic_platform.sfp import Sfp from sonic_platform.psu import Psu - from sonic_platform.fan import Fan + from sonic_platform.fan_drawer import FanDrawer from sonic_platform.thermal import Thermal from sonic_platform.eeprom import Eeprom except ImportError as e: @@ -32,9 +32,9 @@ def __init__(self, pddf_data=None, pddf_plugin_data=None): self.plugin_data = pddf_plugin_data if pddf_plugin_data else None if not self.pddf_obj or not self.plugin_data: try: - from . import pddfparse + from . import pddfapi import json - self.pddf_obj = pddfparse.PddfParse() + self.pddf_obj = pddfapi.PddfApi() with open('/usr/share/sonic/platform/pddf/pd-plugin.json') as pd: self.plugin_data = json.load(pd) except Exception as e: @@ -43,13 +43,18 @@ def __init__(self, pddf_data=None, pddf_plugin_data=None): self.platform_inventory = self.pddf_obj.get_platform() # Initialize EEPROM - self.sys_eeprom = Eeprom(self.pddf_obj, self.plugin_data) + try: + self._eeprom = Eeprom(self.pddf_obj, self.plugin_data) + except Exception as err: + sys.stderr.write("Unable to initialize syseeprom - {}".format(repr(err))) + # Dont exit as we dont want failure in loading other components + # FANs for i in range(self.platform_inventory['num_fantrays']): - for j in range(self.platform_inventory['num_fans_pertray']): - fan = Fan(i, j, self.pddf_obj, self.plugin_data) - self._fan_list.append(fan) + fandrawer = FanDrawer(i, self.pddf_obj, self.plugin_data) + self._fan_drawer_list.append(fandrawer) + self._fan_list.extend(fandrawer._fan_list) # PSUs for i in range(self.platform_inventory['num_psus']): @@ -66,28 +71,6 @@ def __init__(self, pddf_data=None, pddf_plugin_data=None): thermal = Thermal(i, self.pddf_obj, self.plugin_data) self._thermal_list.append(thermal) - # SYSTEM LED Test Cases - """ - #comment out test cases - sys_led_list= { "LOC":0, - "DIAG":0, - "FAN":0, - "SYS":0, - "PSU1":0, - "PSU2":1 - } - - for led in sys_led_list: - color=self.get_system_led(led, sys_led_list[led]) - print color - - self.set_system_led("LOC_LED","STATUS_LED_COLOR_GREEN") - color=self.get_system_led("LOC_LED") - print "Set Green: " + color - self.set_system_led("LOC_LED", "STATUS_LED_COLOR_OFF") - color=self.get_system_led("LOC_LED") - print "Set off: " + color - """ def get_name(self): """ @@ -95,7 +78,7 @@ def get_name(self): Returns: string: The name of the chassis """ - return self.sys_eeprom.modelstr() + return self._eeprom.modelstr() def get_presence(self): """ @@ -111,7 +94,7 @@ def get_model(self): Returns: string: Model/part number of chassis """ - return self.sys_eeprom.part_number_str() + return self._eeprom.part_number_str() def get_serial(self): """ @@ -119,7 +102,7 @@ def get_serial(self): Returns: string: Serial number of chassis """ - return self.sys_eeprom.serial_str() + return self._eeprom.serial_str() def get_status(self): """ @@ -138,7 +121,7 @@ def get_base_mac(self): A string containing the MAC address in the format 'XX:XX:XX:XX:XX:XX' """ - return self.sys_eeprom.base_mac_addr() + return self._eeprom.base_mac_addr() def get_serial_number(self): """ @@ -148,7 +131,7 @@ def get_serial_number(self): A string containing the hardware serial number for this chassis. """ - return self.sys_eeprom.serial_number_str() + return self._eeprom.serial_number_str() def get_system_eeprom_info(self): """ @@ -158,7 +141,7 @@ def get_system_eeprom_info(self): OCP ONIE TlvInfo EEPROM format and values are their corresponding values. """ - return self.sys_eeprom.system_eeprom_info() + return self._eeprom.system_eeprom_info() def get_reboot_cause(self): """ @@ -173,263 +156,39 @@ def get_reboot_cause(self): """ raise NotImplementedError - def get_component_name_list(self): - """ - Retrieves a list of the names of components available on the chassis (e.g., BIOS, CPLD, FPGA, etc.) - - Returns: - A list containing the names of components available on the chassis - """ - return self._component_name_list - - def get_firmware_version(self, component_name): - """ - Retrieves platform-specific hardware/firmware versions for chassis - componenets such as BIOS, CPLD, FPGA, etc. - Args: - component_name: A string, the component name. - - Returns: - A string containing platform-specific component versions - """ - raise NotImplementedError - - def install_component_firmware(self, component_name, image_path): - """ - Install firmware to component - Args: - component_name: A string, the component name. - image_path: A string, path to firmware image. - - Returns: - A boolean, True if install was successful, False if not - """ - raise NotImplementedError + ############################################## + # Component methods + ############################################## ############################################## # Module methods ############################################## + # All module methods are part of chassis_base.py + # if they need to be overwritten, define them here - def get_num_modules(self): - """ - Retrieves the number of modules available on this chassis - - Returns: - An integer, the number of modules available on this chassis - """ - return len(self._module_list) - - def get_all_modules(self): - """ - Retrieves all modules available on this chassis - - Returns: - A list of objects derived from ModuleBase representing all - modules available on this chassis - """ - return self._module_list - - def get_module(self, index): - """ - Retrieves module represented by (0-based) index - - Args: - index: An integer, the index (0-based) of the module to - retrieve - - Returns: - An object dervied from ModuleBase representing the specified - module - """ - module = None - - try: - module = self._module_list[index] - except IndexError: - sys.stderr.write("Module index {} out of range (0-{})\n".format( - index, len(self._module_list)-1)) - - return module ############################################## # Fan methods ############################################## - - def get_num_fans(self): - """ - Retrieves the number of fans available on this chassis - - Returns: - An integer, the number of fan modules available on this chassis - """ - return len(self._fan_list) - - def get_all_fans(self): - """ - Retrieves all fan modules available on this chassis - - Returns: - A list of objects derived from FanBase representing all fan - modules available on this chassis - """ - return self._fan_list - - def get_fan(self, index): - """ - Retrieves fan module represented by (0-based) index - - Args: - index: An integer, the index (0-based) of the fan module to - retrieve - - Returns: - An object dervied from FanBase representing the specified fan - module - """ - fan = None - - try: - fan = self._fan_list[index] - except IndexError: - sys.stderr.write("Fan index {} out of range (0-{})\n".format( - index, len(self._fan_list)-1)) - - return fan + # All fan methods are part of chassis_base.py + # if they need to be overwritten, define them here ############################################## # PSU methods ############################################## - - def get_num_psus(self): - """ - Retrieves the number of power supply units available on this chassis - - Returns: - An integer, the number of power supply units available on this - chassis - """ - return len(self._psu_list) - - def get_all_psus(self): - """ - Retrieves all power supply units available on this chassis - - Returns: - A list of objects derived from PsuBase representing all power - supply units available on this chassis - """ - return self._psu_list - - def get_psu(self, index): - """ - Retrieves power supply unit represented by (0-based) index - - Args: - index: An integer, the index (0-based) of the power supply unit to - retrieve - - Returns: - An object dervied from PsuBase representing the specified power - supply unit - """ - psu = None - - try: - psu = self._psu_list[index] - except IndexError: - sys.stderr.write("PSU index {} out of range (0-{})\n".format( - index, len(self._psu_list)-1)) - - return psu + # All psu methods are part of chassis_base.py + # if they need to be overwritten, define them here ############################################## # THERMAL methods ############################################## - - def get_num_thermals(self): - """ - Retrieves the number of thermals available on this chassis - - Returns: - An integer, the number of thermals available on this chassis - """ - return len(self._thermal_list) - - def get_all_thermals(self): - """ - Retrieves all thermals available on this chassis - - Returns: - A list of objects derived from ThermalBase representing all thermals - available on this chassis - """ - return self._thermal_list - - def get_thermal(self, index): - """ - Retrieves thermal unit represented by (0-based) index - - Args: - index: An integer, the index (0-based) of the thermal to - retrieve - - Returns: - An object dervied from ThermalBase representing the specified thermal - """ - thermal = None - - try: - thermal = self._thermal_list[index] - except IndexError: - sys.stderr.write("THERMAL index {} out of range (0-{})\n".format( - index, len(self._thermal_list)-1)) - - return thermal + # All thermal methods are part of chassis_base.py + # if they need to be overwritten, define them here ############################################## # SFP methods ############################################## - - def get_num_sfps(self): - """ - Retrieves the number of sfps available on this chassis - - Returns: - An integer, the number of sfps available on this chassis - """ - return len(self._sfp_list) - - def get_all_sfps(self): - """ - Retrieves all sfps available on this chassis - - Returns: - A list of objects derived from SfpBase representing all sfps - available on this chassis - """ - return self._sfp_list - - def get_sfp(self, index): - """ - Retrieves sfp represented by (0-based) index - - Args: - index: An integer, the index (0-based) of the sfp to retrieve. - The index should be the sequence of a physical port in a chassis, - starting from 0. - For example, 0 for Ethernet0, 1 for Ethernet4 and so on. - - Returns: - An object dervied from SfpBase representing the specified sfp - """ - sfp = None - - try: - sfp = self._sfp_list[index] - except IndexError: - sys.stderr.write("SFP index {} out of range (0-{})\n".format( - index, len(self._sfp_list)-1)) - - return sfp + # All sfp methods are part of chassis_base.py + # if they need to be overwritten, define them here ############################################## # System LED methods @@ -464,47 +223,3 @@ def get_system_led(self, led_device_name): ############################################## # Other methods ############################################## - - def get_watchdog(self): - """ - Retreives hardware watchdog device on this chassis - - Returns: - An object derived from WatchdogBase representing the hardware - watchdog device - """ - return self._watchdog - - def get_eeprom(self): - """ - Retreives eeprom device on this chassis - - Returns: - An object derived from WatchdogBase representing the hardware - eeprom device - """ - return self.sys_eeprom - - def get_change_event(self, timeout=0): - """ - Returns a nested dictionary containing all devices which have - experienced a change at chassis level - - Args: - timeout: Timeout in milliseconds (optional). If timeout == 0, - this method will block until a change is detected. - Returns: - (bool, dict): - - True if call successful, False if not; - - A nested dictionary where key is a device type, - value is a dictionary with key:value pairs in the format of - {'device_id':'device_event'}, - where device_id is the device ID for this device and - device_event, - status='1' represents device inserted, - status='0' represents device removed. - Ex. {'fan':{'0':'0', '2':'1'}, 'sfp':{'11':'0'}} - indicates that fan 0 has been removed, fan 2 - has been inserted and sfp 11 has been removed. - """ - raise NotImplementedError diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan.py old mode 100755 new mode 100644 index 30be0dd74b35..2a8ef46085c5 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan.py @@ -153,7 +153,7 @@ def get_speed(self): speed = int(output['status']) max_speed = int(self.plugin_data['PSU']['PSU_FAN_MAX_SPEED']) - speed_percentage = (speed*100)/max_speed + speed_percentage = round((speed*100)/max_speed) return speed_percentage else: # TODO This calculation should change based on MAX FAN SPEED @@ -224,7 +224,7 @@ def get_target_speed(self): target_speed = 0 if self.is_psu_fan: # Target speed not usually supported for PSU fans - target_speed = 0 + raise NotImplementedError else: idx = (self.fantray_index-1)*self.platform['num_fans_pertray'] + self.fan_index attr = "fan" + str(idx) + "_pwm" diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan_drawer.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan_drawer.py new file mode 100755 index 000000000000..f88e833408dd --- /dev/null +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_fan_drawer.py @@ -0,0 +1,110 @@ +############################################################################# +# PDDF +# +# PDDF fan_drawer base class inherited from the common base class fan_drawer.py +# +############################################################################# + +try: + from sonic_platform_base.fan_drawer_base import FanDrawerBase + from sonic_platform.fan import Fan +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class PddfFanDrawer(FanDrawerBase): + """PDDF generic Fan Drawer class""" + + pddf_obj = {} + plugin_data = {} + + def __init__(self, tray_idx, pddf_data=None, pddf_plugin_data=None): + FanDrawerBase.__init__(self) + if not pddf_data or not pddf_plugin_data: + raise ValueError('PDDF JSON data error') + + self.pddf_obj = pddf_data + self.plugin_data = pddf_plugin_data + self.platform = self.pddf_obj.get_platform() + + if tray_idx < 0 or tray_idx >= self.platform['num_fantrays']: + print("Invalid fantray index %d\n" % tray_idx) + return + + self.fantray_index = tray_idx+1 + for j in range(self.platform['num_fans_pertray']): + # Fan index is 0-based for the init call + self._fan_list.append(Fan(tray_idx, j, self.pddf_obj, self.plugin_data)) + + def get_name(self): + """ + Retrieves the fan drawer name + Returns: String containing fan-drawer name + """ + return "Fantray{0}".format(self.fantray_index) + + def get_presence(self): + status = False + # Usually if a tray is removed, all the fans inside it are absent + if self._fan_list: + status = self._fan_list[0].get_presence() + + return status + + def get_status(self): + status = False + # if all the fans are working fine, then tray status should be okay + if self._fan_list: + status = all(fan.get_status() == True for fan in self._fan_list) + + return status + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + # Usually Fantrays are replaceable + return True + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + Returns: + integer: The 1-based relative physical position in parent + device or -1 if cannot determine the position + """ + return self.fantray_index + + def get_status_led(self): + led_device_name = "FANTRAY{}".format(self.fantray_index) + "_LED" + + if led_device_name not in self.pddf_obj.data.keys(): + # Implement a generic status_led color scheme + if self.get_status(): + return self.STATUS_LED_COLOR_GREEN + else: + return self.STATUS_LED_COLOR_OFF + + device_name = self.pddf_obj.data[led_device_name]['dev_info']['device_name'] + self.pddf_obj.create_attr('device_name', device_name, self.pddf_obj.get_led_path()) + self.pddf_obj.create_attr('index', str(self.fantray_index-1), self.pddf_obj.get_led_path()) + self.pddf_obj.create_attr('dev_ops', 'get_status', self.pddf_obj.get_led_path()) + color = self.pddf_obj.get_led_color() + return (color) + + def set_status_led(self, color): + result = False + led_device_name = "FANTRAY{}".format(self.fantray_index) + "_LED" + result, msg = self.pddf_obj.is_supported_sysled_state(led_device_name, color) + if result == False: + print(msg) + return (False) + + device_name = self.pddf_obj.data[led_device_name]['dev_info']['device_name'] + self.pddf_obj.create_attr('device_name', device_name, self.pddf_obj.get_led_path()) + self.pddf_obj.create_attr('index', str(self.fantray_index-1), self.pddf_obj.get_led_path()) + self.pddf_obj.create_attr('color', color, self.pddf_obj.get_led_cur_state_path()) + self.pddf_obj.create_attr('dev_ops', 'set_status', self.pddf_obj.get_led_path()) + return (True) diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_platform.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_platform.py old mode 100755 new mode 100644 index c9c3a8d851ac..b7adecc312d5 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_platform.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_platform.py @@ -8,7 +8,7 @@ try: import json - from . import pddfparse + from . import pddfapi from sonic_platform_base.platform_base import PlatformBase from sonic_platform.chassis import Chassis except ImportError as e: @@ -24,7 +24,7 @@ class PddfPlatform(PlatformBase): def __init__(self): # Initialize the JSON data - self.pddf_data = pddfparse.PddfParse() + self.pddf_data = pddfapi.PddfApi() with open('/usr/share/sonic/platform/pddf/pd-plugin.json') as pd: self.pddf_plugin_data = json.load(pd) diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_psu.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_psu.py old mode 100755 new mode 100644 index 912333df8b57..bbe7dc0a1a44 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_psu.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_psu.py @@ -20,6 +20,7 @@ try: from sonic_platform_base.psu_base import PsuBase from sonic_platform.fan import Fan + from sonic_platform.thermal import Thermal except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -45,6 +46,11 @@ def __init__(self, index, pddf_data=None, pddf_plugin_data=None): psu_fan = Fan(0, psu_fan_idx, pddf_data, pddf_plugin_data, True, self.psu_index) self._fan_list.append(psu_fan) + self.num_psu_thermals = 1 # Fixing it 1 for now + for psu_thermal_idx in range(self.num_psu_thermals): + psu_thermal = Thermal(psu_thermal_idx, pddf_data, pddf_plugin_data, True, self.psu_index) + self._thermal_list.append(psu_thermal) + def get_num_fans(self): """ Retrieves the number of fan modules available on this PSU diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_sfp.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_sfp.py old mode 100755 new mode 100644 index 80d3ddc4e767..f11acf1a209b --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_sfp.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_sfp.py @@ -5,164 +5,21 @@ ############################################################################# try: - import time - from ctypes import create_string_buffer - from sonic_platform_base.sfp_base import SfpBase - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom - from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId - from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom - from sonic_platform_base.sonic_sfp.sff8472 import sffbase - from sonic_platform_base.sonic_sfp.inf8628 import inf8628InterfaceId + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase except ImportError as e: raise ImportError(str(e) + "- required module not found") -# definitions of the offset and width for values in XCVR info eeprom -XCVR_INTFACE_BULK_OFFSET = 0 -XCVR_INTFACE_BULK_WIDTH_QSFP = 20 -XCVR_INTFACE_BULK_WIDTH_SFP = 21 -XCVR_TYPE_OFFSET = 0 -XCVR_TYPE_WIDTH = 1 -XCVR_EXT_TYPE_OFFSET = 1 -XCVR_EXT_TYPE_WIDTH = 1 -XCVR_CONNECTOR_OFFSET = 2 -XCVR_CONNECTOR_WIDTH = 1 -XCVR_COMPLIANCE_CODE_OFFSET = 3 -XCVR_COMPLIANCE_CODE_WIDTH = 8 -XCVR_ENCODING_OFFSET = 11 -XCVR_ENCODING_WIDTH = 1 -XCVR_NBR_OFFSET = 12 -XCVR_NBR_WIDTH = 1 -XCVR_EXT_RATE_SEL_OFFSET = 13 -XCVR_EXT_RATE_SEL_WIDTH = 1 -XCVR_CABLE_LENGTH_OFFSET = 14 -XCVR_CABLE_LENGTH_WIDTH_QSFP = 5 -XCVR_CABLE_LENGTH_WIDTH_SFP = 6 -XCVR_VENDOR_NAME_OFFSET = 20 -XCVR_VENDOR_NAME_WIDTH = 16 -XCVR_VENDOR_OUI_OFFSET = 37 -XCVR_VENDOR_OUI_WIDTH = 3 -XCVR_VENDOR_PN_OFFSET = 40 -XCVR_VENDOR_PN_WIDTH = 16 -XCVR_HW_REV_OFFSET = 56 -XCVR_HW_REV_WIDTH_OSFP = 2 -XCVR_HW_REV_WIDTH_QSFP = 2 -XCVR_HW_REV_WIDTH_SFP = 4 -XCVR_VENDOR_SN_OFFSET = 68 -XCVR_VENDOR_SN_WIDTH = 16 -XCVR_VENDOR_DATE_OFFSET = 84 -XCVR_VENDOR_DATE_WIDTH = 8 -XCVR_DOM_CAPABILITY_OFFSET = 92 -XCVR_DOM_CAPABILITY_WIDTH = 1 -# definitions of the offset for values in OSFP info eeprom -OSFP_TYPE_OFFSET = 0 -OSFP_VENDOR_NAME_OFFSET = 129 -OSFP_VENDOR_PN_OFFSET = 148 -OSFP_HW_REV_OFFSET = 164 -OSFP_VENDOR_SN_OFFSET = 166 - -# definitions of the offset and width for values in DOM info eeprom -QSFP_DOM_REV_OFFSET = 1 -QSFP_DOM_REV_WIDTH = 1 -QSFP_TEMPE_OFFSET = 22 -QSFP_TEMPE_WIDTH = 2 -QSFP_VOLT_OFFSET = 26 -QSFP_VOLT_WIDTH = 2 -QSFP_CHANNL_MON_OFFSET = 34 -QSFP_CHANNL_MON_WIDTH = 16 -QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH = 24 -QSFP_CONTROL_OFFSET = 86 -QSFP_CONTROL_WIDTH = 8 -QSFP_CHANNL_RX_LOS_STATUS_OFFSET = 3 -QSFP_CHANNL_RX_LOS_STATUS_WIDTH = 1 -QSFP_CHANNL_TX_FAULT_STATUS_OFFSET = 4 -QSFP_CHANNL_TX_FAULT_STATUS_WIDTH = 1 -QSFP_POWEROVERRIDE_OFFSET = 93 -QSFP_POWEROVERRIDE_WIDTH = 1 -QSFP_MODULE_THRESHOLD_OFFSET = 128 -QSFP_MODULE_THRESHOLD_WIDTH = 24 -QSFP_CHANNEL_THRESHOLD_OFFSET = 176 -QSFP_CHANNEL_THRESHOLD_WIDTH = 24 - - -SFP_TEMPE_OFFSET = 96 -SFP_TEMPE_WIDTH = 2 -SFP_VOLT_OFFSET = 98 -SFP_VOLT_WIDTH = 2 -SFP_CHANNL_MON_OFFSET = 100 -SFP_CHANNL_MON_WIDTH = 6 -SFP_MODULE_THRESHOLD_OFFSET = 0 -SFP_MODULE_THRESHOLD_WIDTH = 40 -SFP_STATUS_CONTROL_OFFSET = 110 -SFP_STATUS_CONTROL_WIDTH = 1 -SFP_TX_DISABLE_HARD_BIT = 7 -SFP_TX_DISABLE_SOFT_BIT = 6 - - -qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)', - 'Length OM2(m)', 'Length OM1(m)', - 'Length Cable Assembly(m)') - -sfp_cable_length_tup = ('LengthSMFkm-UnitsOfKm', 'LengthSMF(UnitsOf100m)', - 'Length50um(UnitsOf10m)', 'Length62.5um(UnitsOfm)', - 'LengthCable(UnitsOfm)', 'LengthOM3(UnitsOf10m)') - -sfp_compliance_code_tup = ('10GEthernetComplianceCode', 'InfinibandComplianceCode', - 'ESCONComplianceCodes', 'SONETComplianceCodes', - 'EthernetComplianceCodes', 'FibreChannelLinkLength', - 'FibreChannelTechnology', 'SFP+CableTechnology', - 'FibreChannelTransmissionMedia', 'FibreChannelSpeed') - -qsfp_compliance_code_tup = ('10/40G Ethernet Compliance Code', 'SONET Compliance codes', - 'SAS/SATA compliance codes', 'Gigabit Ethernet Compliant codes', - 'Fibre Channel link length/Transmitter Technology', - 'Fibre Channel transmission media', 'Fibre Channel Speed') - -PAGE_OFFSET = 0 -KEY_OFFSET = 1 -KEY_WIDTH = 2 -FUNC_NAME = 3 - -INFO_OFFSET = 128 -DOM_OFFSET = 0 -DOM_OFFSET1 = 384 - - -class PddfSfp(SfpBase): +class PddfSfp(SfpOptoeBase): """ PDDF generic Sfp class """ pddf_obj = {} plugin_data = {} - _port_to_eeprom_mapping = {} _port_start = 0 _port_end = 0 - _port_to_type_mapping = {} - _qsfp_ports = [] - _sfp_ports = [] - - # Read out any bytes from any offset - def __read_eeprom_specific_bytes(self, offset, num_bytes): - sysfsfile_eeprom = None - eeprom_raw = [] - for i in range(0, num_bytes): - eeprom_raw.append("0x00") - try: - sysfsfile_eeprom = open(self.eeprom_path, mode="rb", buffering=0) - sysfsfile_eeprom.seek(offset) - raw = sysfsfile_eeprom.read(num_bytes) - for n in range(0, num_bytes): - eeprom_raw[n] = hex(raw[n])[2:].zfill(2) - except Exception as e: - print("Error: Unable to open eeprom_path: %s" % (str(e))) - finally: - if sysfsfile_eeprom: - sysfsfile_eeprom.close() - - return eeprom_raw def __init__(self, index, pddf_data=None, pddf_plugin_data=None): if not pddf_data or not pddf_plugin_data: @@ -183,492 +40,49 @@ def __init__(self, index, pddf_data=None, pddf_plugin_data=None): self.port_index = index+1 self.device = 'PORT{}'.format(self.port_index) self.sfp_type = self.pddf_obj.get_device_type(self.device) - self.is_qsfp_port = True if (self.sfp_type == 'QSFP' or self.sfp_type == 'QSFP28') else False - self.is_osfp_port = True if (self.sfp_type == 'OSFP' or self.sfp_type == 'QSFP-DD') else False self.eeprom_path = self.pddf_obj.get_path(self.device, 'eeprom') - self.info_dict_keys = ['type', 'hardware_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', - 'ext_identifier', 'ext_rateselect_compliance', 'cable_type', 'cable_length', - 'nominal_bit_rate', 'specification_compliance', 'vendor_date', 'vendor_oui', - 'application_advertisement'] - - self.dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', 'power_lpmode', 'tx_disable', 'tx_disable_channel', - 'temperature', 'voltage', 'rx1power', 'rx2power', 'rx3power', 'rx4power', 'tx1bias', - 'tx2bias', 'tx3bias', 'tx4bias', 'tx1power', 'tx2power', 'tx3power', 'tx4power'] - - self.threshold_dict_keys = ['temphighalarm', 'temphighwarning', 'templowalarm', 'templowwarning', - 'vcchighalarm', 'vcchighwarning', 'vcclowalarm', 'vcclowwarning', - 'rxpowerhighalarm', 'rxpowerhighwarning', 'rxpowerlowalarm', 'rxpowerlowwarning', - 'txpowerhighalarm', 'txpowerhighwarning', 'txpowerlowalarm', 'txpowerlowwarning', - 'txbiashighalarm', 'txbiashighwarning', 'txbiaslowalarm', 'txbiaslowwarning'] - - SfpBase.__init__(self) - - def get_transceiver_info(self): - """ - Retrieves transceiver info of this SFP - Returns: - A dict which contains following keys/values : - ======================================================================== - keys |Value Format |Information - ---------------------------|---------------|---------------------------- - type |1*255VCHAR |type of SFP - hardware_rev |1*255VCHAR |hardware version of SFP - serial |1*255VCHAR |serial number of the SFP - manufacturer |1*255VCHAR |SFP vendor name - model |1*255VCHAR |SFP model name - connector |1*255VCHAR |connector information - encoding |1*255VCHAR |encoding information - ext_identifier |1*255VCHAR |extend identifier - ext_rateselect_compliance |1*255VCHAR |extended rateSelect compliance - cable_length |INT |cable length in m - nominal_bit_rate |INT |nominal bit rate by 100Mbs - specification_compliance |1*255VCHAR |specification compliance - vendor_date |1*255VCHAR |vendor date - vendor_oui |1*255VCHAR |vendor OUI - application_advertisement |1*255VCHAR |supported applications advertisement - ======================================================================== - """ - # check present status - if not self.get_presence(): - return None - - if self.is_osfp_port: - sfpi_obj = inf8628InterfaceId() - offset = 0 - type_offset = OSFP_TYPE_OFFSET - vendor_rev_width = XCVR_HW_REV_WIDTH_OSFP - hw_rev_offset = OSFP_HW_REV_OFFSET - vendor_name_offset = OSFP_VENDOR_NAME_OFFSET - vendor_pn_offset = OSFP_VENDOR_PN_OFFSET - vendor_sn_offset = OSFP_VENDOR_SN_OFFSET - interface_info_bulk_width = XCVR_INTFACE_BULK_WIDTH_QSFP - sfp_type = 'OSFP' - - elif self.is_qsfp_port: - sfpi_obj = sff8436InterfaceId() - offset = 128 - type_offset = XCVR_TYPE_OFFSET - vendor_rev_width = XCVR_HW_REV_WIDTH_QSFP - hw_rev_offset = XCVR_HW_REV_OFFSET - vendor_name_offset = XCVR_VENDOR_NAME_OFFSET - vendor_pn_offset = XCVR_VENDOR_PN_OFFSET - vendor_sn_offset = XCVR_VENDOR_SN_OFFSET - interface_info_bulk_width = XCVR_INTFACE_BULK_WIDTH_QSFP - sfp_type = 'QSFP' - else: - sfpi_obj = sff8472InterfaceId() - offset = 0 - type_offset = XCVR_TYPE_OFFSET - vendor_rev_width = XCVR_HW_REV_WIDTH_SFP - hw_rev_offset = XCVR_HW_REV_OFFSET - vendor_name_offset = XCVR_VENDOR_NAME_OFFSET - vendor_pn_offset = XCVR_VENDOR_PN_OFFSET - vendor_sn_offset = XCVR_VENDOR_SN_OFFSET - interface_info_bulk_width = XCVR_INTFACE_BULK_WIDTH_SFP - sfp_type = 'SFP' - - if sfpi_obj is None: - return None - - if self.is_osfp_port: - sfp_type_raw = self.__read_eeprom_specific_bytes((offset + type_offset), XCVR_TYPE_WIDTH) - if sfp_type_raw is not None: - sfp_type_data = sfpi_obj.parse_sfp_type(sfp_type_raw, 0) - sfp_type_abbrv_name = sfpi_obj.parse_sfp_type_abbrv_name(sfp_typ_raw, 0) - else: - sfp_interface_bulk_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_INTFACE_BULK_OFFSET), interface_info_bulk_width) - if sfp_interface_bulk_raw is not None: - sfp_interface_bulk_data = sfpi_obj.parse_sfp_info_bulk(sfp_interface_bulk_raw, 0) - - sfp_vendor_oui_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_VENDOR_OUI_OFFSET), XCVR_VENDOR_OUI_WIDTH) - if sfp_vendor_oui_raw is not None: - sfp_vendor_oui_data = sfpi_obj.parse_vendor_oui(sfp_vendor_oui_raw, 0) - - sfp_vendor_date_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_VENDOR_DATE_OFFSET), XCVR_VENDOR_DATE_WIDTH) - if sfp_vendor_date_raw is not None: - sfp_vendor_date_data = sfpi_obj.parse_vendor_date(sfp_vendor_date_raw, 0) - - sfp_vendor_name_raw = self.__read_eeprom_specific_bytes( - (offset + vendor_name_offset), XCVR_VENDOR_NAME_WIDTH) - sfp_vendor_name_data = sfpi_obj.parse_vendor_name( - sfp_vendor_name_raw, 0) - - sfp_vendor_pn_raw = self.__read_eeprom_specific_bytes( - (offset + vendor_pn_offset), XCVR_VENDOR_PN_WIDTH) - sfp_vendor_pn_data = sfpi_obj.parse_vendor_pn( - sfp_vendor_pn_raw, 0) - - sfp_vendor_rev_raw = self.__read_eeprom_specific_bytes( - (offset + hw_rev_offset), vendor_rev_width) - sfp_vendor_rev_data = sfpi_obj.parse_vendor_rev( - sfp_vendor_rev_raw, 0) - - sfp_vendor_sn_raw = self.__read_eeprom_specific_bytes( - (offset + vendor_sn_offset), XCVR_VENDOR_SN_WIDTH) - sfp_vendor_sn_data = sfpi_obj.parse_vendor_sn( - sfp_vendor_sn_raw, 0) - - xcvr_info_dict = dict.fromkeys(self.info_dict_keys, 'N/A') - compliance_code_dict = dict() - - if sfp_interface_bulk_data: - xcvr_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value'] - xcvr_info_dict['connector'] = sfp_interface_bulk_data['data']['Connector']['value'] - xcvr_info_dict['encoding'] = sfp_interface_bulk_data['data']['EncodingCodes']['value'] - xcvr_info_dict['ext_identifier'] = sfp_interface_bulk_data['data']['Extended Identifier']['value'] - xcvr_info_dict['ext_rateselect_compliance'] = sfp_interface_bulk_data['data']['RateIdentifier']['value'] - xcvr_info_dict['type_abbrv_name'] = sfp_interface_bulk_data['data']['type_abbrv_name']['value'] - else: - xcvr_info_dict['type'] = sfp_type_data['data']['type']['value'] if sfp_type_data else 'N/A' - xcvr_info_dict['type_abbrv_name'] = sfp_type_abbrv_name['data']['type_abbrv_name']['value'] \ - if sfp_type_abbrv_name else 'N/A' - - xcvr_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] \ - if sfp_vendor_name_data else 'N/A' - xcvr_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] if sfp_vendor_pn_data else 'N/A' - xcvr_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] \ - if sfp_vendor_rev_data else 'N/A' - xcvr_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] if sfp_vendor_sn_data else 'N/A' - xcvr_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] \ - if sfp_vendor_oui_data else 'N/A' - xcvr_info_dict['vendor_date'] = sfp_vendor_date_data['data'][ - 'VendorDataCode(YYYY-MM-DD Lot)']['value'] if sfp_vendor_date_data else 'N/A' - xcvr_info_dict['cable_type'] = "Unknown" - xcvr_info_dict['cable_length'] = "Unknown" - - if sfp_type == 'QSFP': - for key in qsfp_cable_length_tup: - if key in sfp_interface_bulk_data['data']: - xcvr_info_dict['cable_type'] = key - xcvr_info_dict['cable_length'] = str(sfp_interface_bulk_data['data'][key]['value']) + SfpOptoeBase.__init__(self) - for key in qsfp_compliance_code_tup: - if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance'][ - 'value'][key]['value'] - xcvr_info_dict['specification_compliance'] = str(compliance_code_dict) + def get_eeprom_path(self): + return self.eeprom_path - nkey = 'Nominal Bit Rate(100Mbs)' - if nkey in sfp_interface_bulk_data['data']: - xcvr_info_dict['nominal_bit_rate'] = str( - sfp_interface_bulk_data['data']['Nominal Bit Rate(100Mbs)']['value']) - else: - xcvr_info_dict['nominal_bit_rate'] = 'N/A' - elif sfp_type == 'OSFP': - pass - else: - for key in sfp_cable_length_tup: - if key in sfp_interface_bulk_data['data']: - xcvr_info_dict['cable_type'] = key - xcvr_info_dict['cable_length'] = str(sfp_interface_bulk_data['data'][key]['value']) - - for key in sfp_compliance_code_tup: - if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance'][ - 'value'][key]['value'] - xcvr_info_dict['specification_compliance'] = str(compliance_code_dict) - - xcvr_info_dict['nominal_bit_rate'] = str( - sfp_interface_bulk_data['data']['NominalSignallingRate(UnitsOf100Mbd)']['value']) - - return xcvr_info_dict - - def get_transceiver_bulk_status(self): + def get_name(self): """ - Retrieves transceiver bulk status of this SFP - Returns: - A dict which contains following keys/values : - ======================================================================== - keys |Value Format |Information - ---------------------------|---------------|---------------------------- - rx_los |BOOLEAN |RX loss-of-signal status, True if has RX los, False if not. - tx_fault |BOOLEAN |TX fault status, True if has TX fault, False if not. - reset_status |BOOLEAN |reset status, True if SFP in reset, False if not. - lp_mode |BOOLEAN |low power mode status, True in lp mode, False if not. - tx_disable |BOOLEAN |TX disable status, True TX disabled, False if not. - tx_disabled_channel |HEX |disabled TX channels in hex, bits 0 to 3 represent channel 0 - | |to channel 3. - temperature |INT |module temperature in Celsius - voltage |INT |supply voltage in mV - txbias |INT |TX Bias Current in mA, n is the channel number, - | |for example, tx2bias stands for tx bias of channel 2. - rxpower |INT |received optical power in mW, n is the channel number, - | |for example, rx2power stands for rx power of channel 2. - txpower |INT |TX output power in mW, n is the channel number, - | |for example, tx2power stands for tx power of channel 2. - ======================================================================== + Retrieves the name of the device + Returns: + string: The name of the device """ - # check present status - if not self.get_presence(): - return None - - xcvr_dom_info_dict = dict.fromkeys(self.dom_dict_keys, 'N/A') - - if self.is_osfp_port: - # Below part is added to avoid fail xcvrd, shall be implemented later - pass - elif self.is_qsfp_port: - # QSFPs - offset = 0 - offset_xcvr = 128 - - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return None - - sfpi_obj = sff8436InterfaceId() - if sfpi_obj is None: - return None - - qsfp_dom_capability_raw = self.__read_eeprom_specific_bytes( - (offset_xcvr + XCVR_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH) - if qsfp_dom_capability_raw is not None: - qspf_dom_capability_data = sfpi_obj.parse_dom_capability( - qsfp_dom_capability_raw, 0) - else: - return None - - dom_temperature_raw = self.__read_eeprom_specific_bytes((offset + QSFP_TEMPE_OFFSET), QSFP_TEMPE_WIDTH) - if dom_temperature_raw is not None: - dom_temperature_data = sfpd_obj.parse_temperature(dom_temperature_raw, 0) - else: - return None - - dom_voltage_raw = self.__read_eeprom_specific_bytes((offset + QSFP_VOLT_OFFSET), QSFP_VOLT_WIDTH) - if dom_voltage_raw is not None: - dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) - else: - return None - - qsfp_dom_rev_raw = self.__read_eeprom_specific_bytes((offset + QSFP_DOM_REV_OFFSET), QSFP_DOM_REV_WIDTH) - if qsfp_dom_rev_raw is not None: - qsfp_dom_rev_data = sfpd_obj.parse_sfp_dom_rev(qsfp_dom_rev_raw, 0) - else: - return None - - xcvr_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] - xcvr_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] - - # The tx_power monitoring is only available on QSFP which compliant with SFF-8636 - # and claimed that it support tx_power with one indicator bit. - dom_channel_monitor_data = {} - qsfp_dom_rev = qsfp_dom_rev_data['data']['dom_rev']['value'] - qsfp_tx_power_support = qspf_dom_capability_data['data']['Tx_power_support']['value'] - if (qsfp_dom_rev[0:8] != 'SFF-8636' or (qsfp_dom_rev[0:8] == 'SFF-8636' and qsfp_tx_power_support != 'on')): - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WIDTH) - if dom_channel_monitor_raw is not None: - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params(dom_channel_monitor_raw, 0) - else: - return None - - xcvr_dom_info_dict['tx1power'] = 'N/A' - xcvr_dom_info_dict['tx2power'] = 'N/A' - xcvr_dom_info_dict['tx3power'] = 'N/A' - xcvr_dom_info_dict['tx4power'] = 'N/A' - else: - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) - if dom_channel_monitor_raw is not None: - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power( - dom_channel_monitor_raw, 0) - else: - return None - - xcvr_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TX1Power']['value'] - xcvr_dom_info_dict['tx2power'] = dom_channel_monitor_data['data']['TX2Power']['value'] - xcvr_dom_info_dict['tx3power'] = dom_channel_monitor_data['data']['TX3Power']['value'] - xcvr_dom_info_dict['tx4power'] = dom_channel_monitor_data['data']['TX4Power']['value'] - - if dom_channel_monitor_raw: - xcvr_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] - xcvr_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] - xcvr_dom_info_dict['rx1power'] = dom_channel_monitor_data['data']['RX1Power']['value'] - xcvr_dom_info_dict['rx2power'] = dom_channel_monitor_data['data']['RX2Power']['value'] - xcvr_dom_info_dict['rx3power'] = dom_channel_monitor_data['data']['RX3Power']['value'] - xcvr_dom_info_dict['rx4power'] = dom_channel_monitor_data['data']['RX4Power']['value'] - xcvr_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TX1Bias']['value'] - xcvr_dom_info_dict['tx2bias'] = dom_channel_monitor_data['data']['TX2Bias']['value'] - xcvr_dom_info_dict['tx3bias'] = dom_channel_monitor_data['data']['TX3Bias']['value'] - xcvr_dom_info_dict['tx4bias'] = dom_channel_monitor_data['data']['TX4Bias']['value'] - - else: - # SFPs - offset = 256 - - sfpd_obj = sff8472Dom() - if sfpd_obj is None: - return None - - dom_temperature_raw = self.__read_eeprom_specific_bytes((offset + SFP_TEMPE_OFFSET), SFP_TEMPE_WIDTH) - if dom_temperature_raw is not None: - dom_temperature_data = sfpd_obj.parse_temperature(dom_temperature_raw, 0) - else: - return None - - dom_voltage_raw = self.__read_eeprom_specific_bytes((offset + SFP_VOLT_OFFSET), SFP_VOLT_WIDTH) - if dom_voltage_raw is not None: - dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) - else: - return None - - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - (offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) - if dom_channel_monitor_raw is not None: - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params(dom_channel_monitor_raw, 0) - else: - return None - - xcvr_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] - xcvr_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] - xcvr_dom_info_dict['rx1power'] = dom_channel_monitor_data['data']['RXPower']['value'] - xcvr_dom_info_dict['rx2power'] = 'N/A' - xcvr_dom_info_dict['rx3power'] = 'N/A' - xcvr_dom_info_dict['rx4power'] = 'N/A' - xcvr_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TXBias']['value'] - xcvr_dom_info_dict['tx2bias'] = 'N/A' - xcvr_dom_info_dict['tx3bias'] = 'N/A' - xcvr_dom_info_dict['tx4bias'] = 'N/A' - xcvr_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TXPower']['value'] - xcvr_dom_info_dict['tx2power'] = 'N/A' - xcvr_dom_info_dict['tx3power'] = 'N/A' - xcvr_dom_info_dict['tx4power'] = 'N/A' - - xcvr_dom_info_dict['rx_los'] = self.get_rx_los() - xcvr_dom_info_dict['tx_fault'] = self.get_tx_fault() - xcvr_dom_info_dict['reset_status'] = self.get_reset_status() - xcvr_dom_info_dict['lp_mode'] = self.get_lpmode() - - return xcvr_dom_info_dict + # Name of the port/sfp ? + return 'PORT{}'.format(self.port_index) - def get_transceiver_threshold_info(self): + def get_presence(self): """ - Retrieves transceiver threshold info of this SFP + Retrieves the presence of the PSU Returns: - A dict which contains following keys/values : - ======================================================================== - keys |Value Format |Information - ---------------------------|---------------|---------------------------- - temphighalarm |FLOAT |High Alarm Threshold value of temperature in Celsius. - templowalarm |FLOAT |Low Alarm Threshold value of temperature in Celsius. - temphighwarning |FLOAT |High Warning Threshold value of temperature in Celsius. - templowwarning |FLOAT |Low Warning Threshold value of temperature in Celsius. - vcchighalarm |FLOAT |High Alarm Threshold value of supply voltage in mV. - vcclowalarm |FLOAT |Low Alarm Threshold value of supply voltage in mV. - vcchighwarning |FLOAT |High Warning Threshold value of supply voltage in mV. - vcclowwarning |FLOAT |Low Warning Threshold value of supply voltage in mV. - rxpowerhighalarm |FLOAT |High Alarm Threshold value of received power in dBm. - rxpowerlowalarm |FLOAT |Low Alarm Threshold value of received power in dBm. - rxpowerhighwarning |FLOAT |High Warning Threshold value of received power in dBm. - rxpowerlowwarning |FLOAT |Low Warning Threshold value of received power in dBm. - txpowerhighalarm |FLOAT |High Alarm Threshold value of transmit power in dBm. - txpowerlowalarm |FLOAT |Low Alarm Threshold value of transmit power in dBm. - txpowerhighwarning |FLOAT |High Warning Threshold value of transmit power in dBm. - txpowerlowwarning |FLOAT |Low Warning Threshold value of transmit power in dBm. - txbiashighalarm |FLOAT |High Alarm Threshold value of tx Bias Current in mA. - txbiaslowalarm |FLOAT |Low Alarm Threshold value of tx Bias Current in mA. - txbiashighwarning |FLOAT |High Warning Threshold value of tx Bias Current in mA. - txbiaslowwarning |FLOAT |Low Warning Threshold value of tx Bias Current in mA. - ======================================================================== + bool: True if PSU is present, False if not """ - # check present status - if not self.get_presence(): - return None - - xcvr_dom_threshold_info_dict = dict.fromkeys(self.threshold_dict_keys, 'N/A') - - if self.is_osfp_port: - # Below part is added to avoid fail xcvrd, shall be implemented later - pass - elif self.is_qsfp_port: - # QSFPs - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return None - - offset = 384 - dom_thres_raw = self.__read_eeprom_specific_bytes( - (offset+QSFP_MODULE_THRESHOLD_OFFSET), QSFP_MODULE_THRESHOLD_WIDTH) - if dom_thres_raw: - module_threshold_values = sfpd_obj.parse_module_threshold_values( - dom_thres_raw, 0) - module_threshold_data = module_threshold_values.get('data') - if module_threshold_data: - xcvr_dom_threshold_info_dict['temphighalarm'] = module_threshold_data['TempHighAlarm']['value'] - xcvr_dom_threshold_info_dict['templowalarm'] = module_threshold_data['TempLowAlarm']['value'] - xcvr_dom_threshold_info_dict['temphighwarning'] = module_threshold_data['TempHighWarning']['value'] - xcvr_dom_threshold_info_dict['templowwarning'] = module_threshold_data['TempLowWarning']['value'] - xcvr_dom_threshold_info_dict['vcchighalarm'] = module_threshold_data['VccHighAlarm']['value'] - xcvr_dom_threshold_info_dict['vcclowalarm'] = module_threshold_data['VccLowAlarm']['value'] - xcvr_dom_threshold_info_dict['vcchighwarning'] = module_threshold_data['VccHighWarning']['value'] - xcvr_dom_threshold_info_dict['vcclowwarning'] = module_threshold_data['VccLowWarning']['value'] - - dom_thres_raw = self.__read_eeprom_specific_bytes((offset + QSFP_CHANNEL_THRESHOLD_OFFSET), - QSFP_CHANNEL_THRESHOLD_WIDTH) - if dom_thres_raw: - channel_threshold_values = sfpd_obj.parse_channel_threshold_values( - dom_thres_raw, 0) - ch_th_data = channel_threshold_values.get('data') - if ch_th_data: - xcvr_dom_threshold_info_dict['rxpowerhighalarm'] = ch_th_data['RxPowerHighAlarm']['value'] - xcvr_dom_threshold_info_dict['rxpowerlowalarm'] = ch_th_data['RxPowerLowAlarm']['value'] - xcvr_dom_threshold_info_dict['rxpowerhighwarning'] = ch_th_data['RxPowerHighWarning']['value'] - xcvr_dom_threshold_info_dict['rxpowerlowwarning'] = ch_th_data['RxPowerLowWarning']['value'] - xcvr_dom_threshold_info_dict['txpowerhighalarm'] = "0.0dBm" - xcvr_dom_threshold_info_dict['txpowerlowalarm'] = "0.0dBm" - xcvr_dom_threshold_info_dict['txpowerhighwarning'] = "0.0dBm" - xcvr_dom_threshold_info_dict['txpowerlowwarning'] = "0.0dBm" - xcvr_dom_threshold_info_dict['txbiashighalarm'] = ch_th_data['TxBiasHighAlarm']['value'] - xcvr_dom_threshold_info_dict['txbiaslowalarm'] = ch_th_data['TxBiasLowAlarm']['value'] - xcvr_dom_threshold_info_dict['txbiashighwarning'] = ch_th_data['TxBiasHighWarning']['value'] - xcvr_dom_threshold_info_dict['txbiaslowwarning'] = ch_th_data['TxBiasLowWarning']['value'] + output = self.pddf_obj.get_attr_name_output(self.device, 'xcvr_present') + if not output: + return False + mode = output['mode'] + modpres = output['status'].rstrip() + if 'XCVR' in self.plugin_data: + if 'xcvr_present' in self.plugin_data['XCVR']: + ptype = self.sfp_type + vtype = 'valmap-'+ptype + if vtype in self.plugin_data['XCVR']['xcvr_present'][mode]: + vmap = self.plugin_data['XCVR']['xcvr_present'][mode][vtype] + if modpres in vmap: + return vmap[modpres] + else: + return False + # if self.plugin_data doesn't specify anything regarding Transceivers + if modpres == '1': + return True else: - # SFPs - sfpd_obj = sff8472Dom() - offset = 256 - eeprom_ifraw = self.__read_eeprom_specific_bytes(0, offset) - sfpi_obj = sff8472InterfaceId(eeprom_ifraw) - cal_type = sfpi_obj.get_calibration_type() - sfpd_obj._calibration_type = cal_type - - dom_module_threshold_raw = self.__read_eeprom_specific_bytes( - (offset + SFP_MODULE_THRESHOLD_OFFSET), SFP_MODULE_THRESHOLD_WIDTH) - if dom_module_threshold_raw is not None: - dom_mod_th_data = sfpd_obj.parse_alarm_warning_threshold( - dom_module_threshold_raw, 0) - - xcvr_dom_threshold_info_dict['temphighalarm'] = dom_mod_th_data['data']['TempHighAlarm']['value'] - xcvr_dom_threshold_info_dict['templowalarm'] = dom_mod_th_data['data']['TempLowAlarm']['value'] - xcvr_dom_threshold_info_dict['temphighwarning'] = dom_mod_th_data['data']['TempHighWarning']['value'] - xcvr_dom_threshold_info_dict['templowwarning'] = dom_mod_th_data['data']['TempLowWarning']['value'] - xcvr_dom_threshold_info_dict['vcchighalarm'] = dom_mod_th_data['data']['VoltageHighAlarm']['value'] - xcvr_dom_threshold_info_dict['vcclowalarm'] = dom_mod_th_data['data']['VoltageLowAlarm']['value'] - xcvr_dom_threshold_info_dict['vcchighwarning'] = dom_mod_th_data[ - 'data']['VoltageHighWarning']['value'] - xcvr_dom_threshold_info_dict['vcclowwarning'] = dom_mod_th_data['data']['VoltageLowWarning']['value'] - xcvr_dom_threshold_info_dict['txbiashighalarm'] = dom_mod_th_data['data']['BiasHighAlarm']['value'] - xcvr_dom_threshold_info_dict['txbiaslowalarm'] = dom_mod_th_data['data']['BiasLowAlarm']['value'] - xcvr_dom_threshold_info_dict['txbiashighwarning'] = dom_mod_th_data['data']['BiasHighWarning']['value'] - xcvr_dom_threshold_info_dict['txbiaslowwarning'] = dom_mod_th_data['data']['BiasLowWarning']['value'] - xcvr_dom_threshold_info_dict['txpowerhighalarm'] = dom_mod_th_data['data']['TXPowerHighAlarm']['value'] - xcvr_dom_threshold_info_dict['txpowerlowalarm'] = dom_mod_th_data['data']['TXPowerLowAlarm']['value'] - xcvr_dom_threshold_info_dict['txpowerhighwarning'] = dom_mod_th_data['data']['TXPowerHighWarning'][ - 'value'] - xcvr_dom_threshold_info_dict['txpowerlowwarning'] = dom_mod_th_data['data']['TXPowerLowWarning'][ - 'value'] - xcvr_dom_threshold_info_dict['rxpowerhighalarm'] = dom_mod_th_data['data']['RXPowerHighAlarm']['value'] - xcvr_dom_threshold_info_dict['rxpowerlowalarm'] = dom_mod_th_data['data']['RXPowerLowAlarm']['value'] - xcvr_dom_threshold_info_dict['rxpowerhighwarning'] = dom_mod_th_data['data']['RXPowerHighWarning'][ - 'value'] - xcvr_dom_threshold_info_dict['rxpowerlowwarning'] = dom_mod_th_data['data']['RXPowerLowWarning'][ - 'value'] - - return xcvr_dom_threshold_info_dict + return False def get_reset_status(self): """ @@ -677,20 +91,16 @@ def get_reset_status(self): A Boolean, True if reset enabled, False if disabled """ reset_status = None - if not self.get_presence(): - return reset_status - device = 'PORT{}'.format(self.port_index) output = self.pddf_obj.get_attr_name_output(device, 'xcvr_reset') - if not output: - return False - status = int(output['status'].rstrip()) + if output: + status = int(output['status'].rstrip()) - if status == 1: - reset_status = True - else: - reset_status = False + if status == 1: + reset_status = True + else: + reset_status = False return reset_status @@ -702,42 +112,19 @@ def get_rx_los(self): Note : RX LOS status is latched until a call to get_rx_los or a reset. """ rx_los = None - if not self.get_presence(): - return rx_los - device = 'PORT{}'.format(self.port_index) output = self.pddf_obj.get_attr_name_output(device, 'xcvr_rxlos') - if not output: - # read the values from EEPROM - if self.is_osfp_port: - pass - elif self.is_qsfp_port: - rx_los_list = [] - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - QSFP_CHANNL_RX_LOS_STATUS_OFFSET, QSFP_CHANNL_RX_LOS_STATUS_WIDTH) if self.get_presence() else None - if dom_channel_monitor_raw is not None: - rx_los_data = int(dom_channel_monitor_raw[0], 16) - rx_los_list.append(rx_los_data & 0x01 != 0) - rx_los_list.append(rx_los_data & 0x02 != 0) - rx_los_list.append(rx_los_data & 0x04 != 0) - rx_los_list.append(rx_los_data & 0x08 != 0) - rx_los = rx_los_list[0] and rx_los_list[1] and rx_los_list[2] and rx_los_list[3] - else: - # SFP ports - status_control_raw = self.__read_eeprom_specific_bytes( - SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - if status_control_raw: - data = int(status_control_raw[0], 16) - rx_los = (sffbase().test_bit(data, 1) != 0) - - else: + if output: status = int(output['status'].rstrip()) if status == 1: rx_los = True else: rx_los = False + else: + # Use common SfpOptoeBase implementation for get_rx_los + rx_los = super().get_rx_los() return rx_los @@ -749,42 +136,19 @@ def get_tx_fault(self): Note : TX fault status is lached until a call to get_tx_fault or a reset. """ tx_fault = None - if not self.get_presence(): - return tx_fault - device = 'PORT{}'.format(self.port_index) output = self.pddf_obj.get_attr_name_output(device, 'xcvr_txfault') - if not output: - # read the values from EEPROM - if self.is_osfp_port: - pass - elif self.is_qsfp_port: - tx_fault_list = [] - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - QSFP_CHANNL_TX_FAULT_STATUS_OFFSET, QSFP_CHANNL_TX_FAULT_STATUS_WIDTH) \ - if self.get_presence() else None - if dom_channel_monitor_raw is not None: - tx_fault_data = int(dom_channel_monitor_raw[0], 16) - tx_fault_list.append(tx_fault_data & 0x01 != 0) - tx_fault_list.append(tx_fault_data & 0x02 != 0) - tx_fault_list.append(tx_fault_data & 0x04 != 0) - tx_fault_list.append(tx_fault_data & 0x08 != 0) - tx_fault = tx_fault_list[0] and tx_fault_list[1] and tx_fault_list[2] and tx_fault_list[3] - else: - # SFP - status_control_raw = self.__read_eeprom_specific_bytes( - SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - if status_control_raw: - data = int(status_control_raw[0], 16) - tx_fault = (sffbase().test_bit(data, 2) != 0) - else: + if output: status = int(output['status'].rstrip()) if status == 1: tx_fault = True else: tx_fault = False + else: + # Use common SfpOptoeBase implementation for get_tx_fault + tx_fault = super().get_tx_fault() return tx_fault @@ -795,86 +159,22 @@ def get_tx_disable(self): A Boolean, True if tx_disable is enabled, False if disabled """ tx_disable = False - if not self.get_presence(): - return tx_disable - device = 'PORT{}'.format(self.port_index) output = self.pddf_obj.get_attr_name_output(device, 'xcvr_txdisable') - if not output: - # read the values from EEPROM - if self.is_osfp_port: - return tx_disable - elif self.is_qsfp_port: - tx_disable_list = [] - - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return False - - dom_control_raw = self.__read_eeprom_specific_bytes( - QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None - if dom_control_raw is not None: - dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) - tx_disable_list.append( - 'On' == dom_control_data['data']['TX1Disable']['value']) - tx_disable_list.append( - 'On' == dom_control_data['data']['TX2Disable']['value']) - tx_disable_list.append( - 'On' == dom_control_data['data']['TX3Disable']['value']) - tx_disable_list.append( - 'On' == dom_control_data['data']['TX4Disable']['value']) - - return tx_disable_list - else: - status_control_raw = self.__read_eeprom_specific_bytes( - SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - if status_control_raw: - data = int(status_control_raw[0], 16) - tx_disable_hard = (sffbase().test_bit( - data, SFP_TX_DISABLE_HARD_BIT) != 0) - tx_disable_soft = (sffbase().test_bit( - data, SFP_TX_DISABLE_SOFT_BIT) != 0) - tx_disable = tx_disable_hard | tx_disable_soft - - return tx_disable - else: + if output: status = int(output['status'].rstrip()) if status == 1: tx_disable = True else: tx_disable = False + else: + # Use common SfpOptoeBase implementation for get_tx_disable + tx_disable = super().get_tx_disable() return tx_disable - def get_tx_disable_channel(self): - """ - Retrieves the TX disabled channels in this SFP - Returns: - A hex of 4 bits (bit 0 to bit 3 as channel 0 to channel 3) to represent - TX channels which have been disabled in this SFP. - As an example, a returned value of 0x5 indicates that channel 0 - and channel 2 have been disabled. - """ - if not self.get_presence(): - return 0 - - if self.is_osfp_port: - return 0 - elif self.is_qsfp_port: - tx_disable_list = self.get_tx_disable() - if tx_disable_list is None: - return 0 - tx_disabled = 0 - for i in range(len(tx_disable_list)): - if tx_disable_list[i]: - tx_disabled |= 1 << i - return tx_disabled - else: - # SFP doesnt support this - return 0 - def get_lpmode(self): """ Retrieves the lpmode (low power mode) status of this SFP @@ -882,162 +182,21 @@ def get_lpmode(self): A Boolean, True if lpmode is enabled, False if disabled """ lpmode = False - if not self.get_presence(): - return lpmode - device = 'PORT{}'.format(self.port_index) output = self.pddf_obj.get_attr_name_output(device, 'xcvr_lpmode') - if not output: - # Read from EEPROM - if self.is_osfp_port: - pass - elif self.is_qsfp_port: - try: - eeprom = None - ctype = self.get_connector_type() - if ctype in ['Copper pigtail', 'No separable connector']: - return False - - eeprom = open(self.eeprom_path, "rb") - eeprom.seek(93) - status = ord(eeprom.read(1)) - - if ((status & 0x3) == 0x3): - # Low Power Mode if "Power override" bit is 1 and "Power set" bit is 1 - lpmode = True - else: - # High Power Mode if one of the following conditions is matched: - # 1. "Power override" bit is 0 - # 2. "Power override" bit is 1 and "Power set" bit is 0 - lpmode = False - except IOError as e: - print("Error: unable to open file: %s" % str(e)) - return False - finally: - if eeprom is not None: - eeprom.close() - time.sleep(0.01) - else: - # SFP - pass - else: + if output: status = int(output['status'].rstrip()) if status == 1: lpmode = True else: lpmode = False - - return lpmode - - def get_power_override(self): - """ - Retrieves the power-override status of this SFP - Returns: - A Boolean, True if power-override is enabled, False if disabled - """ - power_override = False - if not self.get_presence(): - return power_override - - if self.is_osfp_port: - pass - elif self.is_qsfp_port: - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return False - - dom_control_raw = self.__read_eeprom_specific_bytes( - QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None - if dom_control_raw is not None: - dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) - power_override = ('On' == dom_control_data['data']['PowerOverride']['value']) - else: - # SFP doesnt suppor this - pass - - return power_override - - def get_temperature(self): - """ - Retrieves the temperature of this SFP - Returns: - An integer number of current temperature in Celsius - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - if transceiver_dom_info_dict is not None: - # returns None if temperature is not found in the dictionary - return transceiver_dom_info_dict.get("temperature") - else: - return None - - def get_voltage(self): - """ - Retrieves the supply voltage of this SFP - Returns: - An integer number of supply voltage in mV - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - # returns None if voltage is not found in the dictionary - if transceiver_dom_info_dict is not None: - return transceiver_dom_info_dict.get("voltage") else: - return None + # Use common SfpOptoeBase implementation for get_lpmode + lpmode = super().get_lpmode() - def get_tx_bias(self): - """ - Retrieves the TX bias current of this SFP - Returns: - A list of four integer numbers, representing TX bias in mA - for channel 0 to channel 4. - Ex. ['110.09', '111.12', '108.21', '112.09'] - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - if transceiver_dom_info_dict is not None: - tx1_bs = transceiver_dom_info_dict.get("tx1bias", "N/A") - tx2_bs = transceiver_dom_info_dict.get("tx2bias", "N/A") - tx3_bs = transceiver_dom_info_dict.get("tx3bias", "N/A") - tx4_bs = transceiver_dom_info_dict.get("tx4bias", "N/A") - return [tx1_bs, tx2_bs, tx3_bs, tx4_bs] if transceiver_dom_info_dict else [] - else: - return None - - def get_rx_power(self): - """ - Retrieves the received optical power for this SFP - Returns: - A list of four integer numbers, representing received optical - power in mW for channel 0 to channel 4. - Ex. ['1.77', '1.71', '1.68', '1.70'] - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - if transceiver_dom_info_dict is not None: - rx1_pw = transceiver_dom_info_dict.get("rx1power", "N/A") - rx2_pw = transceiver_dom_info_dict.get("rx2power", "N/A") - rx3_pw = transceiver_dom_info_dict.get("rx3power", "N/A") - rx4_pw = transceiver_dom_info_dict.get("rx4power", "N/A") - return [rx1_pw, rx2_pw, rx3_pw, rx4_pw] if transceiver_dom_info_dict else [] - else: - return None - - def get_tx_power(self): - """ - Retrieves the TX power of this SFP - Returns: - A list of four integer numbers, representing TX power in mW - for channel 0 to channel 4. - Ex. ['1.86', '1.86', '1.86', '1.86'] - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - if transceiver_dom_info_dict is not None: - tx1_pw = transceiver_dom_info_dict.get("tx1power", "N/A") - tx2_pw = transceiver_dom_info_dict.get("tx2power", "N/A") - tx3_pw = transceiver_dom_info_dict.get("tx3power", "N/A") - tx4_pw = transceiver_dom_info_dict.get("tx4power", "N/A") - return [tx1_pw, tx2_pw, tx3_pw, tx4_pw] - else: - return None + return lpmode def get_intr_status(self): """ @@ -1068,17 +227,10 @@ def reset(self): A boolean, True if successful, False if not """ status = False - if not self.get_presence(): - return status - device = 'PORT{}'.format(self.port_index) - # TODO: Implement a wrapper set function to write the sequence path = self.pddf_obj.get_path(device, 'xcvr_reset') - # TODO: put the optic based reset logic using EEPROM - if path is None: - pass - else: + if path: try: f = open(path, 'r+') except IOError as e: @@ -1095,6 +247,9 @@ def reset(self): status = True except IOError as e: status = False + else: + # Use common SfpOptoeBase implementation for reset + status = super().reset() return status @@ -1109,61 +264,11 @@ def tx_disable(self, tx_disable): """ # find out a generic implementation of tx_disable for SFP, QSFP and OSFP status = False - if not self.get_presence(): - return tx_disable - device = 'PORT{}'.format(self.port_index) path = self.pddf_obj.get_path(device, 'xcvr_txdisable') # TODO: put the optic based reset logic using EEPROM - if path is None: - if self.is_osfp_port: - pass - elif self.is_qsfp_port: - eeprom_f = None - try: - txdisable_ctl = 0xf if tx_disable else 0x0 - buf = create_string_buffer(1) - buf[0] = bytes([txdisable_ctl]) - # Write to eeprom - eeprom_f = open(self.eeprom_path, "r+b") - eeprom_f.seek(QSFP_CONTROL_OFFSET) - eeprom_f.write(buf[0]) - except IOError as e: - print("Error: unable to open file: %s" % str(e)) - return False - finally: - if eeprom_f is not None: - eeprom_f.close() - time.sleep(0.01) - - status = True - else: - status_control_raw = self.__read_eeprom_specific_bytes( - SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - if status_control_raw is not None: - # Set bit 6 for Soft TX Disable Select - # 01000000 = 64 and 10111111 = 191 - txdisable_bit = 64 if tx_disable else 191 - status_control = int(status_control_raw[0], 16) - txdisable_ctl = (status_control | txdisable_bit) if tx_disable else ( - status_control & txdisable_bit) - try: - eeprom_f = open(self.eeprom_path, mode="r+b", buffering=0) - buf = create_string_buffer(1) - buf[0] = bytes([txdisable_ctl]) - # Write to eeprom - eeprom_f.seek(SFP_STATUS_CONTROL_OFFSET) - eeprom_f.write(buf[0]) - except Exception as e: - print(("Error: unable to open file: %s" % str(e))) - return False - finally: - if eeprom_f: - eeprom_f.close() - time.sleep(0.01) - status = True - else: + if path: try: f = open(path, 'r+') except IOError as e: @@ -1178,48 +283,10 @@ def tx_disable(self, tx_disable): status = True except IOError as e: status = False - - return status - - def tx_disable_channel(self, channel, disable): - """ - Sets the tx_disable for specified SFP channels - Args: - channel : A hex of 4 bits (bit 0 to bit 3) which represent channel 0 to 3, - e.g. 0x5 for channel 0 and channel 2. - disable : A boolean, True to disable TX channels specified in channel, - False to enable - Returns: - A boolean, True if successful, False if not - """ - # TODO: find a implementation - status = False - if not self.get_presence(): - return status - - if self.is_osfp_port: - pass - elif self.is_qsfp_port: - eeprom_f = None - try: - channel_state = self.get_tx_disable_channel() - txdisable_ctl = (channel_state | channel) if disable else (channel_state & ~channel) - buf = create_string_buffer(1) - buf[0] = bytes([txdisable_ctl]) - # Write to eeprom - eeprom_f = open(self.eeprom_path, "r+b") - eeprom_f.seek(QSFP_CONTROL_OFFSET) - eeprom_f.write(buf[0]) - except IOError as e: - print("Error: unable to open file: %s" % str(e)) - return False - finally: - if eeprom_f is not None: - eeprom_f.close() - time.sleep(0.01) - status = True else: - pass + # Use common SfpOptoeBase implementation for tx_disable + status = super().tx_disable(tx_disable) + return status @@ -1233,44 +300,10 @@ def set_lpmode(self, lpmode): A boolean, True if lpmode is set successfully, False if not """ status = False - if not self.get_presence(): - return status - device = 'PORT{}'.format(self.port_index) path = self.pddf_obj.get_path(device, 'xcvr_lpmode') - # TODO: put the optic based reset logic using EEPROM - if path is None: - if self.is_osfp_port: - pass - elif self.is_qsfp_port: - try: - eeprom_f = None - ctype = self.get_connector_type() - if ctype in ['Copper pigtail', 'No separable connector']: - return False - - # Fill in write buffer - regval = 0x3 if lpmode else 0x1 # 0x3:Low Power Mode, 0x1:High Power Mode - buffer = create_string_buffer(1) - buffer[0] = bytes([regval]) - - # Write to eeprom - eeprom_f = open(self.eeprom_path, "r+b") - eeprom_f.seek(93) - eeprom_f.write(buffer[0]) - return True - except IOError as e: - print("Error: unable to open file: %s" % str(e)) - return False - finally: - if eeprom_f is not None: - eeprom_f.close() - time.sleep(0.01) - else: - pass - - else: + if path: try: f = open(path, 'r+') except IOError as e: @@ -1286,149 +319,11 @@ def set_lpmode(self, lpmode): status = True except IOError as e: status = False - - return status - - def set_power_override(self, power_override, power_set): - """ - Sets SFP power level using power_override and power_set - Args: - power_override : - A Boolean, True to override set_lpmode and use power_set - to control SFP power, False to disable SFP power control - through power_override/power_set and use set_lpmode - to control SFP power. - power_set : - Only valid when power_override is True. - A Boolean, True to set SFP to low power mode, False to set - SFP to high power mode. - Returns: - A boolean, True if power-override and power_set are set successfully, - False if not - """ - status = False - if not self.get_presence(): - return status - - if self.is_osfp_port: - pass - elif self.is_qsfp_port: - try: - power_override_bit = 0 - if power_override: - power_override_bit |= 1 << 0 - - power_set_bit = 0 - if power_set: - power_set_bit |= 1 << 1 - - buffer = create_string_buffer(1) - buffer[0] = bytes([power_override_bit | power_set_bit]) - # Write to eeprom - eeprom_f = open(self.eeprom_path, "r+b") - eeprom_f.seek(QSFP_POWEROVERRIDE_OFFSET) - eeprom_f.write(buffer[0]) - except IOError as e: - print("Error: unable to open file: %s" % str(e)) - return False - finally: - if eeprom_f is not None: - eeprom_f.close() - time.sleep(0.01) - return True else: - pass + # Use common SfpOptoeBase implementation for set_lpmode + status = super().set_lpmode(lpmode) return status - def get_name(self): - """ - Retrieves the name of the device - Returns: - string: The name of the device - """ - # Name of the port/sfp ? - return 'PORT{}'.format(self.port_index) - - def get_presence(self): - """ - Retrieves the presence of the PSU - Returns: - bool: True if PSU is present, False if not - """ - output = self.pddf_obj.get_attr_name_output(self.device, 'xcvr_present') - if not output: - return False - - mode = output['mode'] - modpres = output['status'].rstrip() - if 'XCVR' in self.plugin_data: - if 'xcvr_present' in self.plugin_data['XCVR']: - ptype = self.sfp_type - vtype = 'valmap-'+ptype - if vtype in self.plugin_data['XCVR']['xcvr_present'][mode]: - vmap = self.plugin_data['XCVR']['xcvr_present'][mode][vtype] - if modpres in vmap: - return vmap[modpres] - else: - return False - # if self.plugin_data doesn't specify anything regarding Transceivers - if modpres == '1': - return True - else: - return False - - def get_model(self): - """ - Retrieves the model number (or part number) of the device - Returns: - string: Model/part number of device - """ - transceiver_dom_info_dict = self.get_transceiver_info() - if transceiver_dom_info_dict is not None: - return transceiver_dom_info_dict.get("model", "N/A") - else: - return None - - def get_serial(self): - """ - Retrieves the serial number of the device - Returns: - string: Serial number of device - """ - transceiver_dom_info_dict = self.get_transceiver_info() - if transceiver_dom_info_dict is not None: - return transceiver_dom_info_dict.get("serial", "N/A") - else: - return None - - def get_status(self): - """ - Retrieves the operational status of the device - Returns: - A boolean value, True if device is operating properly, False if not - """ - return self.get_presence() and self.get_transceiver_bulk_status() - - def get_connector_type(self): - """ - Retrieves the device connector type - Returns: - enum: connector_code - """ - transceiver_dom_info_dict = self.get_transceiver_info() - if transceiver_dom_info_dict is not None: - return transceiver_dom_info_dict.get("connector", "N/A") - else: - return None - - def get_transceiver_change_event(self): - """ - TODO: This function need to be implemented - when decide to support monitoring SFP(Xcvrd) - on this platform. - """ - raise NotImplementedError - def dump_sysfs(self): return self.pddf_obj.cli_dump_dsysfs('xcvr') diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_thermal.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_thermal.py old mode 100755 new mode 100644 index 644292eb17e5..a0fe6a28bf44 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_thermal.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddf_thermal.py @@ -22,7 +22,7 @@ class PddfThermal(ThermalBase): pddf_obj = {} plugin_data = {} - def __init__(self, index, pddf_data=None, pddf_plugin_data=None): + def __init__(self, index, pddf_data=None, pddf_plugin_data=None, is_psu_thermal=False, psu_index=0): if not pddf_data or not pddf_plugin_data: raise ValueError('PDDF JSON data error') @@ -35,78 +35,129 @@ def __init__(self, index, pddf_data=None, pddf_plugin_data=None): self.thermal_obj_name = "TEMP{}".format(self.thermal_index) self.thermal_obj = self.pddf_obj.data[self.thermal_obj_name] + self.is_psu_thermal = is_psu_thermal + if self.is_psu_thermal: + self.thermals_psu_index = psu_index + def get_name(self): - if 'dev_attr' in self.thermal_obj.keys(): - if 'display_name' in self.thermal_obj['dev_attr']: - return str(self.thermal_obj['dev_attr']['display_name']) - # In case of errors - return (self.thermal_obj_name) + if self.is_psu_thermal: + return "PSU{}_TEMP{}".format(self.thermals_psu_index, self.thermal_index) + else: + if 'dev_attr' in self.thermal_obj.keys(): + if 'display_name' in self.thermal_obj['dev_attr']: + return str(self.thermal_obj['dev_attr']['display_name']) + # In case of errors + return (self.thermal_obj_name) + + def get_presence(self): + if self.is_psu_thermal: + # Temp sensor on the PSU + device = "PSU{}".format(self.thermals_psu_index) + output = self.pddf_obj.get_attr_name_output(device, "psu_present") + if not output: + return False + + mode = output['mode'] + status = output['status'] + + vmap = self.plugin_data['PSU']['psu_present'][mode]['valmap'] + + if status.rstrip('\n') in vmap: + return vmap[status.rstrip('\n')] + else: + return False + else: + # Temp sensor on the board + return True def get_temperature(self): - output = self.pddf_obj.get_attr_name_output(self.thermal_obj_name, "temp1_input") - if not output: - return None + if self.is_psu_thermal: + device = "PSU{}".format(self.thermals_psu_index) + output = self.pddf_obj.get_attr_name_output(device, "psu_temp1_input") + if not output: + return None - if output['status'].isalpha(): - attr_value = None + temp1 = output['status'] + # temperature returned is in milli celcius + return float(temp1)/1000 else: - attr_value = float(output['status']) + output = self.pddf_obj.get_attr_name_output(self.thermal_obj_name, "temp1_input") + if not output: + return None - if output['mode'] == 'bmc': - return attr_value - else: - return (attr_value/float(1000)) + if output['status'].isalpha(): + attr_value = None + else: + attr_value = float(output['status']) + + if output['mode'] == 'bmc': + return attr_value + else: + return (attr_value/float(1000)) def get_high_threshold(self): - output = self.pddf_obj.get_attr_name_output(self.thermal_obj_name, "temp1_high_threshold") - if not output: - return None + if not self.is_psu_thermal: + output = self.pddf_obj.get_attr_name_output(self.thermal_obj_name, "temp1_high_threshold") + if not output: + return None - if output['status'].isalpha(): - attr_value = None - else: - attr_value = float(output['status']) + if output['status'].isalpha(): + attr_value = None + else: + attr_value = float(output['status']) - if output['mode'] == 'bmc': - return attr_value + if output['mode'] == 'bmc': + return attr_value + else: + return (attr_value/float(1000)) else: - return (attr_value/float(1000)) + raise NotImplementedError + def get_low_threshold(self): - output = self.pddf_obj.get_attr_name_output(self.thermal_obj_name, "temp1_low_threshold") - if not output: - return None + if not self.is_psu_thermal: + output = self.pddf_obj.get_attr_name_output(self.thermal_obj_name, "temp1_low_threshold") + if not output: + return None - if output['status'].isalpha(): - attr_value = None - else: - attr_value = float(output['status']) + if output['status'].isalpha(): + attr_value = None + else: + attr_value = float(output['status']) - if output['mode'] == 'bmc': - return attr_value + if output['mode'] == 'bmc': + return attr_value + else: + return (attr_value/float(1000)) else: - return (attr_value/float(1000)) + raise NotImplementedError def set_high_threshold(self, temperature): - node = self.pddf_obj.get_path(self.thermal_obj_name, "temp1_high_threshold") - if node is None: - print("ERROR %s does not exist" % node) - return None + if not self.is_psu_thermal: + node = self.pddf_obj.get_path(self.thermal_obj_name, "temp1_high_threshold") + if node is None: + print("ERROR %s does not exist" % node) + return None - cmd = "echo '%d' > %s" % (temperature * 1000, node) - os.system(cmd) + cmd = "echo '%d' > %s" % (temperature * 1000, node) + os.system(cmd) - return (True) + return (True) + else: + raise NotImplementedError def set_low_threshold(self, temperature): - node = self.pddf_obj.get_path(self.thermal_obj_name, "temp1_low_threshold") - if node is None: - print("ERROR %s does not exist" % node) - return None - cmd = "echo '%d' > %s" % (temperature * 1000, node) - os.system(cmd) + if not self.is_psu_thermal: + node = self.pddf_obj.get_path(self.thermal_obj_name, "temp1_low_threshold") + if node is None: + print("ERROR %s does not exist" % node) + return None + cmd = "echo '%d' > %s" % (temperature * 1000, node) + os.system(cmd) - return (True) + return (True) + else: + raise NotImplementedError def get_high_critical_threshold(self): """ @@ -116,19 +167,22 @@ def get_high_critical_threshold(self): A float number, the high critical threshold temperature of thermal in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - output = self.pddf_obj.get_attr_name_output(self.thermal_obj_name, "temp1_high_crit_threshold") - if not output: - return None + if not self.is_psu_thermal: + output = self.pddf_obj.get_attr_name_output(self.thermal_obj_name, "temp1_high_crit_threshold") + if not output: + return None - if output['status'].isalpha(): - attr_value = None - else: - attr_value = float(output['status']) + if output['status'].isalpha(): + attr_value = None + else: + attr_value = float(output['status']) - if output['mode'] == 'bmc': - return attr_value + if output['mode'] == 'bmc': + return attr_value + else: + return (attr_value/float(1000)) else: - return (attr_value/float(1000)) + raise NotImplementedError def get_low_critical_threshold(self): """ @@ -138,22 +192,24 @@ def get_low_critical_threshold(self): A float number, the low critical threshold temperature of thermal in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - output = self.pddf_obj.get_attr_name_output(self.thermal_obj_name, "temp1_low_crit_threshold") - if not output: - return None + if not self.is_psu_thermal: + output = self.pddf_obj.get_attr_name_output(self.thermal_obj_name, "temp1_low_crit_threshold") + if not output: + return None - if output['status'].isalpha(): - attr_value = None - else: - attr_value = float(output['status']) + if output['status'].isalpha(): + attr_value = None + else: + attr_value = float(output['status']) - if output['mode'] == 'bmc': - return attr_value + if output['mode'] == 'bmc': + return attr_value + else: + return (attr_value/float(1000)) else: - return (attr_value/float(1000)) + raise NotImplementedError # Helper Functions - def get_temp_label(self): if 'bmc' in self.pddf_obj.data[self.thermal_obj_name].keys(): return None diff --git a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddfparse.py b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddfapi.py old mode 100755 new mode 100644 similarity index 53% rename from platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddfparse.py rename to platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddfapi.py index 6ca59206fd56..a4075af87a94 --- a/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddfparse.py +++ b/platform/pddf/platform-api-pddf-base/sonic_platform_pddf_base/pddfapi.py @@ -1,7 +1,6 @@ #!/usr/bin/env python import glob import json -from jsonschema import validate import os import re import subprocess @@ -29,7 +28,7 @@ } -class PddfParse(): +class PddfApi(): def __init__(self): if not os.path.exists("/usr/share/sonic/platform"): self.platform, self.hwsku = self.get_platform_and_hwsku() @@ -46,7 +45,6 @@ def __init__(self): self.sysfs_obj = {} # Returns platform and HW SKU - def get_platform_and_hwsku(self): try: proc = subprocess.Popen([SONIC_CFGGEN_PATH, '-H', '-v', PLATFORM_KEY], @@ -84,30 +82,38 @@ def get_dev_idx(self, dev, ops): return pdev['dev_attr']['dev_idx'] - def get_path(self, target, attr): + def get_paths(self, target, attr): aa = target + attr if aa in cache: return cache[aa] - string = None + strings = [] p = re.search(r'\d+$', target) if p is None: for bb in filter(re.compile(target).search, self.data.keys()): - path = self.dev_parse(self.data[bb], {"cmd": "show_attr", "target": bb, "attr": attr}) - if path != "": - string = path + paths = self.dev_parse(self.data[bb], {"cmd": "show_attr", "target": bb, "attr": attr}) + if paths: + strings.extend(paths) else: if target in self.data.keys(): - path = self.dev_parse(self.data[target], {"cmd": "show_attr", "target": target, "attr": attr}) - if path != "": - string = path + paths = self.dev_parse(self.data[target], {"cmd": "show_attr", "target": target, "attr": attr}) + if paths: + strings.extend(paths) - if string is not None: - string = string.rstrip() + cache[aa] = strings + return strings - cache[aa] = string - return string + def get_path(self, target, attr): + nodes = self.get_paths(target, attr) + if nodes: + if len(nodes)==1: + return nodes[0] + # CAREFULL!!! If more than one paths are expected, use get_paths + else: + return nodes[0] + else: + return None def get_device_type(self, key): if key not in self.data.keys(): @@ -173,7 +179,7 @@ def get_led_color_from_gpio(self, led_device_name): status = "[FAILED] {} does not exist".format(attr_path) return (status) cmd = 'cat ' + attr_path - gpio_value = subprocess.check_output(cmd, shell=True) + gpio_value = subprocess.check_output(cmd, shell=True, universal_newlines=True) value |= int(gpio_value) << bit bit += 1 @@ -205,8 +211,8 @@ def set_led_color_from_gpio(self, led_device_name, color): i = 0 while i <= max_bit: _value = (value >> i) & 1 - base_offset += i - attr_path = self.get_gpio_attr_path(self.data[attr['attr_devname']], hex(base_offset)) + offset = base_offset + i + attr_path = self.get_gpio_attr_path(self.data[attr['attr_devname']], hex(offset)) i += 1 try: cmd = "echo {} > {}".format(_value, attr_path) @@ -230,11 +236,11 @@ def get_system_led_color(self, led_device_name): status = "[FAILED] " + led_device_name + " is not configured" return (status) - type = self.get_led_color_devtype(led_device_name) + dtype = self.get_led_color_devtype(led_device_name) - if type == 'gpio': + if dtype == 'gpio': color = self.get_led_color_from_gpio(led_device_name) - elif type == 'cpld': + elif dtype == 'cpld': color = self.get_led_color_from_cpld(led_device_name) return color @@ -244,9 +250,9 @@ def set_system_led_color(self, led_device_name, color): print(msg) return (result) - type = self.get_led_color_devtype(led_device_name) + dtype = self.get_led_color_devtype(led_device_name) - if type == 'gpio': + if dtype == 'gpio': return (self.set_led_color_from_gpio(led_device_name, color)) else: return (self.set_led_color_from_cpld(led_device_name, color)) @@ -266,13 +272,22 @@ def show_device_sysfs(self, dev, ops): parent = dev['dev_info']['device_parent'] pdev = self.data[parent] if pdev['dev_info']['device_parent'] == 'SYSTEM': - return "/sys/bus/i2c/devices/"+"i2c-%d" % int(pdev['i2c']['topo_info']['dev_addr'], 0) + if 'topo_info' in pdev['i2c']: + return "/sys/bus/i2c/devices/"+"i2c-%d"%int(pdev['i2c']['topo_info']['dev_addr'], 0) + else: + return "/sys/bus/i2c/devices" return self.show_device_sysfs(pdev, ops) + "/" + "i2c-%d" % int(dev['i2c']['topo_info']['parent_bus'], 0) - # This is alid for 'at24' type of EEPROM devices. Only one attribtue 'eeprom' + def get_gpio_attr_path(self, dev, offset): + base = int(dev['i2c']['dev_attr']['gpio_base'], 16) + port_num = base + int(offset, 16) + gpio_name = 'gpio'+str(port_num) + path = '/sys/class/gpio/'+gpio_name+'/value' + return path + # This is alid for 'at24' type of EEPROM devices. Only one attribtue 'eeprom' def show_attr_eeprom_device(self, dev, ops): - str = "" + ret = [] attr_name = ops['attr'] attr_list = dev['i2c']['attr_list'] KEY = "eeprom" @@ -294,11 +309,11 @@ def show_attr_eeprom_device(self, dev, ops): "/%s" % real_name if dsysfs_path not in self.data_sysfs_obj[KEY]: self.data_sysfs_obj[KEY].append(dsysfs_path) - str += dsysfs_path+"\n" - return str + ret.append(dsysfs_path) + return ret def show_attr_gpio_device(self, dev, ops): - ret = "" + ret = [] KEY = "gpio" if KEY not in self.data_sysfs_obj: self.data_sysfs_obj[KEY] = [] @@ -306,24 +321,17 @@ def show_attr_gpio_device(self, dev, ops): return ret def show_attr_mux_device(self, dev, ops): - ret = "" + ret = [] KEY = "mux" if KEY not in self.data_sysfs_obj: self.data_sysfs_obj[KEY] = [] return ret - def get_gpio_attr_path(self, dev, offset): - base = int(dev['i2c']['dev_attr']['gpio_base'], 16) - port_num = base + int(offset, 16) - gpio_name = 'gpio'+str(port_num) - path = '/sys/class/gpio/'+gpio_name+'/value' - return path - def show_attr_psu_i2c_device(self, dev, ops): target = ops['target'] attr_name = ops['attr'] - ret = "" + ret = [] KEY = "psu" dsysfs_path = "" @@ -331,7 +339,7 @@ def show_attr_psu_i2c_device(self, dev, ops): self.data_sysfs_obj[KEY] = [] if target == 'all' or target == dev['dev_info']['virt_parent']: - attr_list = dev['i2c']['attr_list'] + attr_list = dev['i2c']['attr_list'] if 'i2c' in dev else [] for attr in attr_list: if attr_name == attr['attr_name'] or attr_name == 'all': if 'attr_devtype' in attr.keys() and attr['attr_devtype'] == "gpio": @@ -340,29 +348,35 @@ def show_attr_psu_i2c_device(self, dev, ops): if (os.path.exists(attr_path)): if attr_path not in self.data_sysfs_obj[KEY]: self.data_sysfs_obj[KEY].append(attr_path) - ret += attr_path + '\n' + ret.append(attr_path) else: if 'drv_attr_name' in attr.keys(): real_name = attr['drv_attr_name'] + real_dev = dev + elif 'attr_devattr' in attr.keys(): + real_name = attr['attr_devattr'] + real_devname = attr['attr_devname'] if 'attr_devname' in attr.keys() else '' + real_dev = self.data[real_devname] else: real_name = attr['attr_name'] + real_dev = dev - dsysfs_path = self.show_device_sysfs(dev, ops) + \ - "/%d-00%x" % (int(dev['i2c']['topo_info']['parent_bus'], 0), - int(dev['i2c']['topo_info']['dev_addr'], 0)) + \ + dsysfs_path = self.show_device_sysfs(real_dev, ops) + \ + "/%d-00%x" % (int(real_dev['i2c']['topo_info']['parent_bus'], 0), + int(real_dev['i2c']['topo_info']['dev_addr'], 0)) + \ "/%s" % real_name if dsysfs_path not in self.data_sysfs_obj[KEY]: self.data_sysfs_obj[KEY].append(dsysfs_path) - ret += dsysfs_path+"\n" + ret.append(dsysfs_path) return ret def show_attr_psu_device(self, dev, ops): return self.show_attr_psu_i2c_device(dev, ops) def show_attr_fan_device(self, dev, ops): - ret = "" + ret = [] attr_name = ops['attr'] - attr_list = dev['i2c']['attr_list'] + attr_list = dev['i2c']['attr_list'] if 'i2c' in dev else [] KEY = "fan" dsysfs_path = "" @@ -377,27 +391,35 @@ def show_attr_fan_device(self, dev, ops): if (os.path.exists(attr_path)): if attr_path not in self.data_sysfs_obj[KEY]: self.data_sysfs_obj[KEY].append(attr_path) - ret += attr_path + '\n' + ret.append(attr_path) else: if 'drv_attr_name' in attr.keys(): real_name = attr['drv_attr_name'] + real_dev = dev + elif 'attr_devattr' in attr.keys(): + real_name = attr['attr_devattr'] + real_devname = attr['attr_devname'] if 'attr_devname' in attr.keys() else '' + real_dev = self.data[real_devname] else: real_name = attr['attr_name'] + real_dev = dev - dsysfs_path = self.show_device_sysfs(dev, ops) + \ - "/%d-00%x" % (int(dev['i2c']['topo_info']['parent_bus'], 0), - int(dev['i2c']['topo_info']['dev_addr'], 0)) + \ + dsysfs_path = self.show_device_sysfs(real_dev, ops) + \ + "/%d-00%x" % (int(real_dev['i2c']['topo_info']['parent_bus'], 0), + int(real_dev['i2c']['topo_info']['dev_addr'], 0)) + \ "/%s" % real_name if dsysfs_path not in self.data_sysfs_obj[KEY]: self.data_sysfs_obj[KEY].append(dsysfs_path) - ret += dsysfs_path+"\n" + ret.append(dsysfs_path) return ret # This is only valid for LM75 def show_attr_temp_sensor_device(self, dev, ops): - str = "" + ret = [] + if 'i2c' not in dev.keys(): + return ret attr_name = ops['attr'] - attr_list = dev['i2c']['attr_list'] + attr_list = dev['i2c']['attr_list'] if 'i2c' in dev else [] KEY = "temp-sensors" dsysfs_path = "" @@ -418,11 +440,11 @@ def show_attr_temp_sensor_device(self, dev, ops): dsysfs_path = full_path if dsysfs_path not in self.data_sysfs_obj[KEY]: self.data_sysfs_obj[KEY].append(dsysfs_path) - str += full_path + "\n" - return str + ret.append(full_path) + return ret def show_attr_sysstatus_device(self, dev, ops): - ret = "" + ret = [] attr_name = ops['attr'] attr_list = dev['attr_list'] KEY = "sys-status" @@ -436,13 +458,13 @@ def show_attr_sysstatus_device(self, dev, ops): dsysfs_path = "/sys/kernel/pddf/devices/sysstatus/sysstatus_data/" + attr['attr_name'] if dsysfs_path not in self.data_sysfs_obj[KEY]: self.data_sysfs_obj[KEY].append(dsysfs_path) - ret += dsysfs_path+"\n" + ret.append(dsysfs_path) return ret def show_attr_xcvr_i2c_device(self, dev, ops): target = ops['target'] attr_name = ops['attr'] - ret = "" + ret = [] dsysfs_path = "" KEY = "xcvr" if KEY not in self.data_sysfs_obj: @@ -458,342 +480,39 @@ def show_attr_xcvr_i2c_device(self, dev, ops): if (os.path.exists(attr_path)): if attr_path not in self.data_sysfs_obj[KEY]: self.data_sysfs_obj[KEY].append(attr_path) - ret += attr_path + '\n' + ret.append(attr_path) else: if 'drv_attr_name' in attr.keys(): real_name = attr['drv_attr_name'] + real_dev = dev + elif 'attr_devattr' in attr.keys(): + real_name = attr['attr_devattr'] + real_devname = attr['attr_devname'] if 'attr_devname' in attr.keys() else '' + real_dev = self.data[real_devname] else: real_name = attr['attr_name'] + real_dev = dev - dsysfs_path = self.show_device_sysfs(dev, ops) + \ - "/%d-00%x" % (int(dev['i2c']['topo_info']['parent_bus'], 0), - int(dev['i2c']['topo_info']['dev_addr'], 0)) + \ + dsysfs_path = self.show_device_sysfs(real_dev, ops) + \ + "/%d-00%x" % (int(real_dev['i2c']['topo_info']['parent_bus'], 0), + int(real_dev['i2c']['topo_info']['dev_addr'], 0)) + \ "/%s" % real_name if dsysfs_path not in self.data_sysfs_obj[KEY]: self.data_sysfs_obj[KEY].append(dsysfs_path) - ret += dsysfs_path+"\n" + ret.append(dsysfs_path) return ret def show_attr_xcvr_device(self, dev, ops): return self.show_attr_xcvr_i2c_device(dev, ops) def show_attr_cpld_device(self, dev, ops): - ret = "" + ret = [] KEY = "cpld" if KEY not in self.data_sysfs_obj: self.data_sysfs_obj[KEY] = [] return ret - ################################################################################################################### - # SHOW DEFS - ################################################################################################################### - - def check_led_cmds(self, key, ops): - name = ops['target']+'_LED' - if (ops['target'] == 'config' or ops['attr'] == 'all') or \ - (name == self.data[key]['dev_info']['device_name'] and - ops['attr'] == self.data[key]['dev_attr']['index']): - return (True) - else: - return (False) - - def dump_sysfs_obj(self, obj, key_type): - if (key_type == 'keys'): - for key in obj.keys(): - print(key) - return - - for key in obj: - if (key == key_type or key_type == 'all'): - print(key+":") - for entry in obj[key]: - print("\t"+entry) - - def add_list_sysfs_obj(self, obj, KEY, list): - for sysfs in list: - if sysfs not in obj[KEY]: - obj[KEY].append(sysfs) - - def sysfs_attr(self, key, value, path, obj, obj_key): - sysfs_path = "/sys/kernel/%s/%s" % (path, key) - if sysfs_path not in obj[obj_key]: - obj[obj_key].append(sysfs_path) - - def sysfs_device(self, attr, path, obj, obj_key): - for key in attr.keys(): - sysfs_path = "/sys/kernel/%s/%s" % (path, key) - if sysfs_path not in obj[obj_key]: - obj[obj_key].append(sysfs_path) - - def show_eeprom_device(self, dev, ops): - return - - def show_mux_device(self, dev, ops): - KEY = 'mux' - if KEY not in self.sysfs_obj: - self.sysfs_obj[KEY] = [] - self.sysfs_device(dev['i2c']['topo_info'], "pddf/devices/mux", self.sysfs_obj, KEY) - self.sysfs_device(dev['i2c']['dev_attr'], "pddf/devices/mux", self.sysfs_obj, KEY) - sysfs_path = "/sys/kernel/pddf/devices/mux/dev_ops" - if sysfs_path not in self.sysfs_obj[KEY]: - self.sysfs_obj[KEY].append(sysfs_path) - list = ['/sys/kernel/pddf/devices/mux/i2c_type', - '/sys/kernel/pddf/devices/mux/i2c_name', - '/sys/kernel/pddf/devices/mux/error'] - self.add_list_sysfs_obj(self.sysfs_obj, KEY, list) - - def show_gpio_device(self, dev, ops): - KEY = 'gpio' - if KEY not in self.sysfs_obj: - self.sysfs_obj[KEY] = [] - self.sysfs_device(dev['i2c']['topo_info'], "pddf/devices/gpio", self.sysfs_obj, KEY) - self.sysfs_device(dev['i2c']['dev_attr'], "pddf/devices/gpio", self.sysfs_obj, KEY) - sysfs_path = "/sys/kernel/pddf/devices/gpio/dev_ops" - if sysfs_path not in self.sysfs_obj[KEY]: - self.sysfs_obj[KEY].append(sysfs_path) - list = ['/sys/kernel/pddf/devices/gpio/i2c_type', - '/sys/kernel/pddf/devices/gpio/i2c_name', - '/sys/kernel/pddf/devices/gpio/error'] - self.add_list_sysfs_obj(self.sysfs_obj, KEY, list) - - def show_psu_i2c_device(self, dev, ops): - KEY = 'psu' - path = 'pddf/devices/psu/i2c' - if dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['PSU']: - if KEY not in self.sysfs_obj: - self.sysfs_obj[KEY] = [] - self.sysfs_device(dev['i2c']['topo_info'], path, self.sysfs_obj, KEY) - sysfs_path = "/sys/kernel/pddf/devices/psu/i2c/psu_idx" - self.sysfs_obj[KEY].append(sysfs_path) - - for attr in dev['i2c']['attr_list']: - self.sysfs_device(attr, "pddf/devices/psu/i2c", self.sysfs_obj, KEY) - sysfs_path = "/sys/kernel/pddf/devices/psu/i2c/dev_ops" - if sysfs_path not in self.sysfs_obj[KEY]: - self.sysfs_obj[KEY].append(sysfs_path) - list = ['/sys/kernel/pddf/devices/psu/i2c/i2c_type', - '/sys/kernel/pddf/devices/fan/i2c/i2c_name', - '/sys/kernel/pddf/devices/psu/i2c/error', - '/sys/kernel/pddf/devices/psu/i2c/attr_ops'] - self.add_list_sysfs_obj(self.sysfs_obj, KEY, list) - - def show_psu_device(self, dev, ops): - self.show_psu_i2c_device(dev, ops) - return - - def show_client_device(self): - KEY = 'client' - if KEY not in self.sysfs_obj: - self.sysfs_obj[KEY] = [] - list = ['/sys/kernel/pddf/devices/showall'] - self.add_list_sysfs_obj(self.sysfs_obj, KEY, list) - - def show_fan_device(self, dev, ops): - KEY = 'fan' - path = 'pddf/devices/fan/i2c' - if dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['FAN']: - if KEY not in self.sysfs_obj: - self.sysfs_obj[KEY] = [] - - self.sysfs_device(dev['i2c']['topo_info'], path, self.sysfs_obj, KEY) - self.sysfs_device(dev['i2c']['dev_attr'], path, self.sysfs_obj, KEY) - for attr in dev['i2c']['attr_list']: - self.sysfs_device(attr, path, self.sysfs_obj, KEY) - list = ['/sys/kernel/pddf/devices/fan/i2c/i2c_type', - '/sys/kernel/pddf/devices/fan/i2c/i2c_name', - '/sys/kernel/pddf/devices/fan/i2c/error', - '/sys/kernel/pddf/devices/fan/i2c/attr_ops', - '/sys/kernel/pddf/devices/fan/i2c/dev_ops'] - self.add_list_sysfs_obj(self.sysfs_obj, KEY, list) - - def show_temp_sensor_device(self, dev, ops): - return - - def show_sysstatus_device(self, dev, ops): - KEY = 'sysstatus' - if KEY not in self.sysfs_obj: - self.sysfs_obj[KEY] = [] - for attr in dev['attr_list']: - self.sysfs_device(attr, "pddf/devices/sysstatus", self.sysfs_obj, KEY) - sysfs_path = "/sys/kernel/pddf/devices/sysstatus/attr_ops" - if sysfs_path not in self.sysfs_obj[KEY]: - self.sysfs_obj[KEY].append(sysfs_path) - - def show_xcvr_i2c_device(self, dev, ops): - KEY = 'xcvr' - if dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['PORT_MODULE']: - if KEY not in self.sysfs_obj: - self.sysfs_obj[KEY] = [] - self.sysfs_device(dev['i2c']['topo_info'], "pddf/devices/xcvr/i2c", self.sysfs_obj, KEY) - - for attr in dev['i2c']['attr_list']: - self.sysfs_device(attr, "pddf/devices/xcvr/i2c", self.sysfs_obj, KEY) - sysfs_path = "/sys/kernel/pddf/devices/xcvr/i2c/dev_ops" - if sysfs_path not in self.sysfs_obj[KEY]: - self.sysfs_obj[KEY].append(sysfs_path) - list = ['/sys/kernel/pddf/devices/xcvr/i2c/i2c_type', - '/sys/kernel/pddf/devices/xcvr/i2c/i2c_name', - '/sys/kernel/pddf/devices/xcvr/i2c/error', - '/sys/kernel/pddf/devices/xcvr/i2c/attr_ops'] - self.add_list_sysfs_obj(self.sysfs_obj, KEY, list) - - def show_xcvr_device(self, dev, ops): - self.show_xcvr_i2c_device(dev, ops) - return - - def show_cpld_device(self, dev, ops): - KEY = 'cpld' - if dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['CPLD']: - if KEY not in self.sysfs_obj: - self.sysfs_obj[KEY] = [] - self.sysfs_device(dev['i2c']['topo_info'], "pddf/devices/cpld", self.sysfs_obj, KEY) - sysfs_path = "/sys/kernel/pddf/devices/cpld/dev_ops" - if sysfs_path not in self.sysfs_obj[KEY]: - self.sysfs_obj[KEY].append(sysfs_path) - list = ['/sys/kernel/pddf/devices/cpld/i2c_type', - '/sys/kernel/pddf/devices/cpld/i2c_name', - '/sys/kernel/pddf/devices/cpld/error'] - self.add_list_sysfs_obj(self.sysfs_obj, KEY, list) - - def show_led_platform_device(self, key, ops): - if ops['attr'] == 'all' or ops['attr'] == 'PLATFORM': - KEY = 'platform' - if KEY not in self.sysfs_obj: - self.sysfs_obj[KEY] = [] - path = 'pddf/devices/platform' - self.sysfs_attr('num_psus', self.data['PLATFORM']['num_psus'], path, self.sysfs_obj, KEY) - self.sysfs_attr('num_fantrays', self.data['PLATFORM']['num_fantrays'], path, self.sysfs_obj, KEY) - - def show_led_device(self, key, ops): - if self.check_led_cmds(key, ops): - KEY = 'led' - if KEY not in self.sysfs_obj: - self.sysfs_obj[KEY] = [] - path = "pddf/devices/led" - for attr in self.data[key]['i2c']['attr_list']: - self.sysfs_attr('device_name', self.data[key]['dev_info']['device_name'], path, self.sysfs_obj, KEY) - self.sysfs_attr('swpld_addr', self.data[key]['dev_info']['device_name'], path, self.sysfs_obj, KEY) - self.sysfs_attr('swpld_addr_offset', self.data[key]['dev_info']['device_name'], path, - self.sysfs_obj, KEY) - self.sysfs_device(self.data[key]['dev_attr'], path, self.sysfs_obj, KEY) - for attr_key in attr.keys(): - attr_path = "pddf/devices/led/" + attr['attr_name'] - if (attr_key != 'attr_name' and attr_key != 'swpld_addr' and attr_key != 'swpld_addr_offset'): - self.sysfs_attr(attr_key, attr[attr_key], attr_path, self.sysfs_obj, KEY) - sysfs_path = "/sys/kernel/pddf/devices/led/dev_ops" - if sysfs_path not in self.sysfs_obj[KEY]: - self.sysfs_obj[KEY].append(sysfs_path) - list = ['/sys/kernel/pddf/devices/led/cur_state/color', - '/sys/kernel/pddf/devices/led/cur_state/color_state'] - self.add_list_sysfs_obj(self.sysfs_obj, KEY, list) - - def validate_xcvr_device(self, dev, ops): - devtype_list = ['optoe1', 'optoe2'] - dev_attribs = ['xcvr_present', 'xcvr_reset', 'xcvr_intr_status', 'xcvr_lpmode'] - ret_val = "xcvr validation failed" - - if dev['i2c']['topo_info']['dev_type'] in devtype_list: - for attr in dev['i2c']['attr_list']: - if 'attr_name' in attr.keys() and 'eeprom' in attr.values(): - ret_val = "xcvr validation success" - else: - print("xcvr validation Failed") - return - - elif dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['PORT_MODULE']: - for attr in dev['i2c']['attr_list']: - if attr.get("attr_name") in dev_attribs: - ret_val = "Success" - else: - print("xcvr validation Failed") - return - print(ret_val) - - def validate_eeprom_device(self, dev, ops): - devtype_list = ['24c02'] - dev_access_mode = ['BLOCK', 'BYTE'] - dev_attribs = ['eeprom'] - ret_val = "eeprom failed" - - if dev['i2c']['topo_info']['dev_type'] in devtype_list: - if dev['i2c']['dev_attr']['access_mode'] in dev_access_mode: - for attr in dev['i2c']['attr_list']: - if attr.get("attr_name") in dev_attribs: - ret_val = "eeprom success" - print(ret_val) - - def validate_mux_device(self, dev, ops): - devtype_list = ['pca9548', 'pca954x'] - dev_channels = ["0", "1", "2", "3", "4", "5", "6", "7"] - ret_val = "mux failed" - - if dev['i2c']['topo_info']['dev_type'] in devtype_list: - for attr in dev['i2c']['channel']: - if attr.get("chn") in dev_channels: - ret_val = "Mux success" - print(ret_val) - - def validate_cpld_device(self, dev, ops): - devtype_list = ['i2c_cpld'] - ret_val = "cpld failed" - - if dev['i2c']['topo_info']['dev_type'] in devtype_list: - ret_val = "cpld success" - print(ret_val) - - def validate_sysstatus_device(self, dev, ops): - dev_attribs = ['board_info', 'cpld1_version', 'power_module_status', 'system_reset5', - 'system_reset6', 'system_reset7', 'misc1', 'cpld2_version', 'cpld3_version' - ] - ret_val = "sysstatus failed" - - if dev['dev_info']['device_type'] == "SYSSTAT": - for attr in dev['attr_list']: - if attr.get("attr_name") in dev_attribs: - ret_val = "sysstatus success" - print(ret_val) - - def validate_temp_sensor_device(self, dev, ops): - devtype_list = ['lm75'] - dev_attribs = ['temp1_max', 'temp1_max_hyst', 'temp1_input'] - ret_val = "temp sensor failed" - - if dev['dev_info']['device_type'] == "TEMP_SENSOR": - if dev['i2c']['topo_info']['dev_type'] in devtype_list: - for attr in dev['i2c']['attr_list']: - if attr.get("attr_name") in dev_attribs: - ret_val = "tempsensor success" - print(ret_val) - - def validate_fan_device(self, dev, ops): - ret_val = "fan failed" - - if dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['FAN']: - if dev['i2c']['dev_attr']['num_fan'] is not None: - ret_val = "fan success" - - print(ret_val) - - def validate_psu_device(self, dev, ops): - dev_attribs = ['psu_present', 'psu_model_name', 'psu_power_good', 'psu_mfr_id', 'psu_serial_num', - 'psu_fan_dir', 'psu_v_out', 'psu_i_out', 'psu_p_out', 'psu_fan1_speed_rpm' - ] - ret_val = "psu failed" - - if dev['i2c']['topo_info']['dev_type'] in self.data['PLATFORM']['pddf_dev_types']['PSU']: - for attr in dev['i2c']['attr_list']: - if attr.get("attr_name") in dev_attribs: - if attr.get("attr_devaddr") is not None: - if attr.get("attr_offset") is not None: - if attr.get("attr_mask") is not None: - if attr.get("attr_len") is not None: - ret_val = "psu success" - else: - ret_val = "psu failed" - - print(ret_val) - ################################################################################################################### # SPYTEST ################################################################################################################### @@ -858,63 +577,6 @@ def verify_sysfs_data(self, verify_type): if (entry == 'swpld_addr' or entry == 'swpld_addr_offset'): self.verify_attr(entry, attr, 'pddf/devices/led') - def schema_validation(self, validate_type): - process_validate_type = 0 - for key in self.data.keys(): - if (key != 'PLATFORM'): - temp_obj = {} - schema_list = [] - try: - device_type = self.data[key]["dev_info"]["device_type"] - except Exception as e: - print("dev_info or device_type ERROR: " + key) - print(e) - - if validate_type == 'mismatch': - process_validate_type = 1 - device_type = "PSU" - schema_file = "/usr/local/bin/schema/FAN.schema" - schema_list.append(schema_file) - elif validate_type == 'missing': - process_validate_type = 1 - schema_file = "/usr/local/bin/schema/PLATFORM.schema" - schema_list.append(schema_file) - - elif validate_type == 'empty': - process_validate_type = 1 - if not device_type: - print("Empty device_type for " + key) - continue - elif (validate_type == 'all' or validate_type == device_type): - process_validate_type = 1 - if "bmc" in self.data[key].keys(): - schema_file = "/usr/local/bin/schema/"+device_type + "_BMC.schema" - schema_list.append(schema_file) - - if "i2c" in self.data[key].keys(): - schema_file = "/usr/local/bin/schema/"+device_type + ".schema" - schema_list.append(schema_file) - if device_type: - temp_obj[device_type] = self.data[key] - for schema_file in schema_list: - if (os.path.exists(schema_file)): - print("Validate " + schema_file + ";" + key) - json_data = json.dumps(temp_obj) - with open(schema_file, 'r') as f: - schema = json.load(f) - try: - validate(temp_obj, schema) - except Exception as e: - print("Validation ERROR: " + schema_file + ";" + key) - if validate_type == 'mismatch': - return - else: - print(e) - else: - print("ERROR Missing File: " + schema_file) - if not process_validate_type: - print("device_type: " + validate_type + " not configured") - def modules_validation(self, validate_type): kos = [] supported_type = False @@ -935,7 +597,7 @@ def modules_validation(self, validate_type): supported_type = True cmd = "lsmod | grep " + mod try: - subprocess.check_output(cmd, shell=True) + subprocess.check_output(cmd, shell=True, universal_newlines=True) except Exception as e: module_validation_status.append(mod) if supported_type: @@ -952,229 +614,176 @@ def modules_validation(self, validate_type): ################################################################################################################### def psu_parse(self, dev, ops): - parse_str = "" - ret = "" - for ifce in dev['i2c']['interface']: - ret = getattr(self, ops['cmd']+"_psu_device")(self.data[ifce['dev']], ops) - if ret is not None: - if str(ret).isdigit(): - if ret != 0: + ret = [] + for ifce in (dev['i2c']['interface'] if 'i2c' in dev else []): + val = getattr(self, ops['cmd']+"_psu_device")(self.data[ifce['dev']], ops) + if val: + if str(val[0]).isdigit(): + if val[0] != 0: # in case if 'create' functions - print("{}_psu_device failed".format(ops['cmd'])) - return ret - else: - pass + print("{}_psu_device failed for {}".format(ops['cmd'], ifce['dev'])) + return val else: # in case of 'show_attr' functions - parse_str += ret - return parse_str + ret.extend(val) + return ret def fan_parse(self, dev, ops): - parse_str = "" + ret = [] ret = getattr(self, ops['cmd']+"_fan_device")(dev, ops) - if ret is not None: - if str(ret).isdigit(): - if ret != 0: + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions - print("{}_fan_device failed".format(ops['cmd'])) - return ret - else: - pass - else: - # in case of 'show_attr' functions - parse_str += ret + print("{}_fan_device failed for {}".format(ops['cmd'], dev['dev_info']['device_name'])) - return parse_str + return ret def temp_sensor_parse(self, dev, ops): - parse_str = "" + ret = [] ret = getattr(self, ops['cmd']+"_temp_sensor_device")(dev, ops) - if ret is not None: - if str(ret).isdigit(): - if ret != 0: + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions - print("{}_temp_sensor_device failed".format(ops['cmd'])) - return ret - else: - pass - else: - # in case of 'show_attr' functions - parse_str += ret + print("{}_temp_sensor_device failed for {}".format(ops['cmd'], dev['dev_info']['device_name'])) - return parse_str + return ret def cpld_parse(self, dev, ops): - parse_str = "" + ret = [] ret = getattr(self, ops['cmd']+"_cpld_device")(dev, ops) - if ret is not None: - if str(ret).isdigit(): - if ret != 0: + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions - print("{}_cpld_device failed".format(ops['cmd'])) - return ret - else: - pass - else: - # in case of 'show_attr' functions - parse_str += ret + print("{}_cpld_device failed for {}".format(ops['cmd'], dev['dev_info']['device_name'])) - return parse_str + return ret def sysstatus_parse(self, dev, ops): - parse_str = "" + ret = [] ret = getattr(self, ops['cmd']+"_sysstatus_device")(dev, ops) - if ret is not None: - if str(ret).isdigit(): - if ret != 0: + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions - print("{}_sysstatus_device failed".format(ops['cmd'])) - return ret - else: - pass - else: - # in case of 'show_attr' functions - parse_str += ret + print("{}_sysstatus_device failed for {}".format(ops['cmd'], dev['dev_info']['device_name'])) - return parse_str + return ret def gpio_parse(self, dev, ops): - parse_str = "" + ret = [] ret = getattr(self, ops['cmd']+"_gpio_device")(dev, ops) - if ret is not None: - if str(ret).isdigit(): - if ret != 0: + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions - print("{}_temp_sensor_device failed".format(ops['cmd'])) - return ret - else: - pass - else: - # in case of 'show_attr' functions - parse_str += ret + print("{}_gpio_device failed for {}".format(ops['cmd'], dev['dev_info']['device_name'])) - return parse_str + return ret def mux_parse(self, dev, ops): - parse_str = "" + val = [] ret = getattr(self, ops['cmd']+"_mux_device")(dev, ops) - if ret is not None: - if str(ret).isdigit(): - if ret != 0: + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions - print("{}_mux_device() cmd failed".format(ops['cmd'])) + print("{}_mux_device() cmd failed for {}".format(ops['cmd'], dev['dev_info']['device_name'])) return ret - else: - pass else: - parse_str += ret + val.extend(ret) for ch in dev['i2c']['channel']: ret = self.dev_parse(self.data[ch['dev']], ops) - if ret is not None: - if str(ret).isdigit(): - if ret != 0: + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions return ret - else: - pass else: - parse_str += ret - return parse_str + val.extend(ret) + return val def mux_parse_reverse(self, dev, ops): - parse_str = "" + val = [] for ch in reversed(dev['i2c']['channel']): ret = self.dev_parse(self.data[ch['dev']], ops) - if ret is not None: - if str(ret).isdigit(): - if ret != 0: + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions return ret - else: - pass else: - parse_str += ret + val.extend(ret) ret = getattr(self, ops['cmd']+"_mux_device")(dev, ops) - if ret is not None: - if str(ret).isdigit(): - if ret != 0: + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions - print("{}_mux_device() cmd failed".format(ops['cmd'])) + print("{}_mux_device() cmd failed for {}".format(ops['cmd'], dev['dev_info']['device_name'])) return ret - else: - pass else: - parse_str += ret + val.extend(ret) - return parse_str + return val def eeprom_parse(self, dev, ops): - parse_str = "" + ret = [] ret = getattr(self, ops['cmd']+"_eeprom_device")(dev, ops) - if ret is not None: - if str(ret).isdigit(): - if ret != 0: + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions - print("{}_eeprom_device() cmd failed".format(ops['cmd'])) - return ret - else: - pass - else: - parse_str += ret + print("{}_eeprom_device() cmd failed for {}".format(ops['cmd'], dev['dev_info']['device_name'])) - return parse_str + return ret def optic_parse(self, dev, ops): - parse_str = "" - ret = "" + val = [] for ifce in dev['i2c']['interface']: ret = getattr(self, ops['cmd']+"_xcvr_device")(self.data[ifce['dev']], ops) - if ret is not None: - if str(ret).isdigit(): - if ret != 0: + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions - print("{}_eeprom_device() cmd failed".format(ops['cmd'])) + print("{}_xcvr_device() cmd failed for {}".format(ops['cmd'], ifce['dev'])) return ret - else: - pass else: - parse_str += ret - return parse_str + val.extend(ret) + return val def cpu_parse(self, bus, ops): - parse_str = "" + val = [] for dev in bus['i2c']['CONTROLLERS']: dev1 = self.data[dev['dev']] for d in dev1['i2c']['DEVICES']: ret = self.dev_parse(self.data[d['dev']], ops) - if ret is not None: - if str(ret).isdigit(): - if ret != 0: + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions return ret - else: - pass else: - parse_str += ret - return parse_str + val.extend(ret) + return val def cpu_parse_reverse(self, bus, ops): - parse_str = "" + val = [] for dev in reversed(bus['i2c']['CONTROLLERS']): dev1 = self.data[dev['dev']] for d in dev1['i2c']['DEVICES']: ret = self.dev_parse(self.data[d['dev']], ops) - if ret is not None: - if str(ret).isdigit(): - if ret != 0: + if ret: + if str(ret[0]).isdigit(): + if ret[0] != 0: # in case if 'create' functions return ret - else: - pass else: - parse_str += ret - return parse_str + val.extend(ret) + return val def dev_parse(self, dev, ops): attr = dev['dev_info'] @@ -1206,6 +815,7 @@ def dev_parse(self, dev, ops): return self.temp_sensor_parse(dev, ops) if attr['device_type'] == 'SFP' or attr['device_type'] == 'QSFP' or \ + attr['device_type'] == 'SFP+' or attr['device_type'] == 'QSFP+' or \ attr['device_type'] == 'SFP28' or attr['device_type'] == 'QSFP28' or \ attr['device_type'] == 'QSFP-DD': return self.optic_parse(dev, ops) @@ -1228,28 +838,6 @@ def create_attr(self, key, value, path): cmd = "echo '%s' > /sys/kernel/%s/%s" % (value, path, key) self.runcmd(cmd) - def create_led_platform_device(self, key, ops): - if ops['attr'] == 'all' or ops['attr'] == 'PLATFORM': - path = 'pddf/devices/platform' - self.create_attr('num_psus', self.data['PLATFORM']['num_psus'], path) - self.create_attr('num_fantrays', self.data['PLATFORM']['num_fantrays'], path) - - def create_led_device(self, key, ops): - if ops['attr'] == 'all' or ops['attr'] == self.data[key]['dev_info']['device_name']: - path = "pddf/devices/led" - for attr in self.data[key]['i2c']['attr_list']: - self.create_attr('device_name', self.data[key]['dev_info']['device_name'], path) - self.create_device(self.data[key]['dev_attr'], path, ops) - for attr_key in attr.keys(): - if (attr_key == 'swpld_addr_offset' or attr_key == 'swpld_addr'): - self.create_attr(attr_key, attr[attr_key], path) - elif (attr_key != 'attr_name' and attr_key != 'descr' and attr_key != 'attr_devtype' and - attr_key != 'attr_devname'): - state_path = path+'/state_attr' - self.create_attr(attr_key, attr[attr_key], state_path) - cmd = "echo '" + attr['attr_name']+"' > /sys/kernel/pddf/devices/led/dev_ops" - self.runcmd(cmd) - def led_parse(self, ops): getattr(self, ops['cmd']+"_led_platform_device")("PLATFORM", ops) for key in self.data.keys(): @@ -1265,29 +853,6 @@ def get_device_list(self, list, type): if attr['device_type'] == type: list.append(self.data[key]) - def create_pddf_devices(self): - self.led_parse({"cmd": "create", "target": "all", "attr": "all"}) - create_ret = 0 - create_ret = self.dev_parse(self.data['SYSTEM'], {"cmd": "create", "target": "all", "attr": "all"}) - if create_ret != 0: - return create_ret - if 'SYSSTATUS' in self.data: - create_ret = self.dev_parse(self.data['SYSSTATUS'], {"cmd": "create", "target": "all", "attr": "all"}) - if create_ret != 0: - return create_ret - - def delete_pddf_devices(self): - self.dev_parse(self.data['SYSTEM'], {"cmd": "delete", "target": "all", "attr": "all"}) - if 'SYSSTATUS' in self.data: - self.dev_parse(self.data['SYSSTATUS'], {"cmd": "delete", "target": "all", "attr": "all"}) - - def populate_pddf_sysfsobj(self): - self.dev_parse(self.data['SYSTEM'], {"cmd": "show", "target": "all", "attr": "all"}) - if 'SYSSTATUS' in self.data: - self.dev_parse(self.data['SYSSTATUS'], {"cmd": "show", "target": "all", "attr": "all"}) - self.led_parse({"cmd": "show", "target": "all", "attr": "all"}) - self.show_client_device() - def cli_dump_dsysfs(self, component): self.dev_parse(self.data['SYSTEM'], {"cmd": "show_attr", "target": "all", "attr": "all"}) if 'SYSSTATUS' in self.data: @@ -1297,23 +862,30 @@ def cli_dump_dsysfs(self, component): else: return None - def validate_pddf_devices(self, *args): - self.populate_pddf_sysfsobj() - v_ops = {'cmd': 'validate', 'target': 'all', 'attr': 'all'} - self.dev_parse(self.data['SYSTEM'], v_ops) - ################################################################################################################### # BMC APIs ################################################################################################################### def populate_bmc_cache_db(self, bmc_attr): bmc_cmd = str(bmc_attr['bmc_cmd']).strip() - o_list = subprocess.check_output(bmc_cmd, shell=True).strip().split('\n') - bmc_cache[bmc_cmd] = {} - bmc_cache[bmc_cmd]['time'] = time.time() + sdr_dump_file = "/usr/local/sdr_dump" + __bmc_cmd = bmc_cmd + if 'ipmitool' in bmc_cmd: + if not os.path.isfile(sdr_dump_file): + sdr_dump_cmd = "ipmitool sdr dump " + sdr_dump_file + subprocess.check_output(sdr_dump_cmd, shell=True, universal_newlines=True) + dump_cmd = "ipmitool -S " + sdr_dump_file + __bmc_cmd = __bmc_cmd.replace("ipmitool", dump_cmd, 1) + o_list = subprocess.check_output(__bmc_cmd, shell=True, universal_newlines=True).strip().split('\n') + bmc_cache[bmc_cmd]={} + bmc_cache[bmc_cmd]['time']=time.time() for entry in o_list: - name = entry.split()[0] - bmc_cache[bmc_cmd][name] = entry + if 'separator' in bmc_attr.keys(): + name = str(entry.split(bmc_attr['separator'])[0]).strip() + else: + name = str(entry.split()[0]).strip() + + bmc_cache[bmc_cmd][name]=entry def non_raw_ipmi_get_request(self, bmc_attr): bmc_db_update_time = 1 @@ -1330,16 +902,19 @@ def non_raw_ipmi_get_request(self, bmc_attr): self.populate_bmc_cache_db(bmc_attr) try: - data = bmc_cache[bmc_cmd][field_name] - value = data.split()[field_pos] + data=bmc_cache[bmc_cmd][field_name] + if 'separator' in bmc_attr: + value = data.split(bmc_attr['separator'])[field_pos].strip() + else: + value = data.split()[field_pos].strip() except Exception as e: - pass + pass - if 'mult' in bmc_attr.keys() and not value.isalpha(): - if value.isalpha(): + if 'mult' in bmc_attr.keys(): + if value.replace('.','',1).strip().isdigit(): + value = float(value) * float(bmc_attr['mult']) + else: value = 0.0 - value = float(value) * float(bmc_attr['mult']) - return str(value) def raw_ipmi_get_request(self, bmc_attr): @@ -1347,7 +922,7 @@ def raw_ipmi_get_request(self, bmc_attr): cmd = bmc_attr['bmc_cmd'] + " 2>/dev/null" if bmc_attr['type'] == 'raw': try: - value = subprocess.check_output(cmd, shell=True).strip() + value = subprocess.check_output(cmd, shell=True, universal_newlines=True).strip() except Exception as e: pass @@ -1358,7 +933,7 @@ def raw_ipmi_get_request(self, bmc_attr): if bmc_attr['type'] == 'mask': mask = int(bmc_attr['mask'].encode('utf-8'), 16) try: - value = subprocess.check_output(cmd, shell=True).strip() + value = subprocess.check_output(cmd, shell=True, universal_newlines=True).strip() except Exception as e: pass @@ -1369,7 +944,7 @@ def raw_ipmi_get_request(self, bmc_attr): if bmc_attr['type'] == 'ascii': try: - value = subprocess.check_output(cmd, shell=True) + value = subprocess.check_output(cmd, shell=True, universal_newlines=True).strip() except Exception as e: pass @@ -1423,18 +998,19 @@ def get_attr_name_output(self, device_name, attr_name): bmc_attr = self.check_bmc_based_attr(device_name, attr_name) output = {"mode": "", "status": ""} - if bmc_attr is not None: - if bmc_attr == {}: - return {} - output['mode'] = "bmc" - output['status'] = self.bmc_get_cmd(bmc_attr) + if bmc_attr is not None and bmc_attr!={}: + output['mode']="bmc" + output['status']=self.bmc_get_cmd(bmc_attr) else: - output['mode'] = "i2c" + # bmc_attr is either None or {}. In both the cases, its highly likely that the attribute + # is i2c based + output['mode']="i2c" node = self.get_path(device_name, attr_name) if node is None: return {} try: - with open(node, 'r') as f: + # Seen some errors in case of unencodable characters hence ignoring them in python3 + with open(node, 'r', errors='ignore') as f: output['status'] = f.read() except IOError: return {} diff --git a/platform/template/docker-syncd-base.mk b/platform/template/docker-syncd-base.mk index d95d7a141920..a6a027f94aac 100644 --- a/platform/template/docker-syncd-base.mk +++ b/platform/template/docker-syncd-base.mk @@ -38,3 +38,5 @@ $(DOCKER_SYNCD_BASE)_RUN_OPT += --privileged -t $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +SONIC_BUSTER_DOCKERS += $(DOCKER_SYNCD_BASE) +SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_SYNCD_BASE_DBG) diff --git a/platform/vs/docker-ptf-sai.dep b/platform/vs/docker-ptf-sai.dep new file mode 100644 index 000000000000..697dc3b3cdcb --- /dev/null +++ b/platform/vs/docker-ptf-sai.dep @@ -0,0 +1,8 @@ +DPATH := $($(DOCKER_PTF_SAI)_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) platform/vs/docker-ptf-sai.mk platform/vs/docker-ptf-sai.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(DPATH)) + +$(DOCKER_PTF_SAI)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_PTF_SAI)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_PTF_SAI)_DEP_FILES := $(DEP_FILES) diff --git a/platform/vs/docker-ptf-sai.mk b/platform/vs/docker-ptf-sai.mk new file mode 100644 index 000000000000..d3463c5a0930 --- /dev/null +++ b/platform/vs/docker-ptf-sai.mk @@ -0,0 +1,9 @@ +# docker image for docker-ptf-sai + +DOCKER_PTF_SAI = docker-ptf-sai.gz +DOCKER_PTF_BASE = docker-ptf.gz +$(DOCKER_PTF_SAI)_PATH = $(DOCKERS_PATH)/docker-ptf-sai +$(DOCKER_PTF_SAI)_DEPENDS += $(LIBTHRIFT_2) $(PYTHON3_THRIFT_2) +$(DOCKER_PTF_SAI)_LOAD_DOCKERS += $(DOCKER_PTF_BASE) +SONIC_DOCKER_IMAGES += $(DOCKER_PTF_SAI) +SONIC_BUSTER_DOCKERS += $(DOCKER_PTF_SAI) diff --git a/platform/vs/docker-ptf.mk b/platform/vs/docker-ptf.mk index 857f53574743..445fc8daf4d3 100644 --- a/platform/vs/docker-ptf.mk +++ b/platform/vs/docker-ptf.mk @@ -4,3 +4,4 @@ DOCKER_PTF = docker-ptf.gz $(DOCKER_PTF)_PATH = $(DOCKERS_PATH)/docker-ptf $(DOCKER_PTF)_DEPENDS += $(LIBTHRIFT) $(PYTHON_THRIFT) $(PTF) $(PYTHON_SAITHRIFT) SONIC_DOCKER_IMAGES += $(DOCKER_PTF) +SONIC_BUSTER_DOCKERS += $(DOCKER_PTF) diff --git a/platform/vs/docker-sonic-vs.mk b/platform/vs/docker-sonic-vs.mk index 6667c4abba9d..400d57c76d8d 100644 --- a/platform/vs/docker-sonic-vs.mk +++ b/platform/vs/docker-sonic-vs.mk @@ -11,10 +11,10 @@ $(DOCKER_SONIC_VS)_DEPENDS += $(SWSS) \ $(SONIC_DEVICE_DATA) \ $(LIBYANG) \ $(LIBYANG_CPP) \ - $(LIBYANG_PY2) \ $(LIBYANG_PY3) \ $(SONIC_UTILITIES_DATA) \ - $(SONIC_HOST_SERVICES_DATA) + $(SONIC_HOST_SERVICES_DATA) \ + $(IPROUTE2) # swsssdk is a dependency of sonic-py-common # TODO: sonic-py-common should depend on swsscommon instead @@ -51,3 +51,5 @@ $(DOCKER_SONIC_VS)_FILES += $(CONFIGDB_LOAD_SCRIPT) \ $(DOCKER_SONIC_VS)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_VS) + +SONIC_BUSTER_DOCKERS += $(DOCKER_SONIC_VS) diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index ab686d3a13de..21c607e28c9e 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -171,11 +171,13 @@ COPY ["hostname.j2", "/usr/share/sonic/templates/"] COPY ["init_cfg.json.j2", "/usr/share/sonic/templates/"] COPY ["default_chassis_cfg.json", "/etc/default/sonic-db/"] COPY ["asic_table.json", "/etc/sonic/"] +COPY ["zero_profiles.json", "/etc/sonic"] COPY ["buffermgrd.sh", "/usr/bin/"] COPY ["platform.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/"] COPY ["hwsku.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/Force10-S6000/"] COPY ["hwsku.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/"] +COPY ["hwsku.json", "/usr/share/sonic/device/x86_64-kvm_x86_64-r0/Mellanox-SN2700/"] # Workaround the tcpdump issue RUN mv /usr/sbin/tcpdump /usr/bin/tcpdump diff --git a/platform/vs/docker-sonic-vs/buffermgrd.sh b/platform/vs/docker-sonic-vs/buffermgrd.sh index 9cdc57434a8f..a36fc7f94ca8 100755 --- a/platform/vs/docker-sonic-vs/buffermgrd.sh +++ b/platform/vs/docker-sonic-vs/buffermgrd.sh @@ -5,9 +5,13 @@ export ASIC_VENDOR=vs if [ "$BUFFER_CALCULATION_MODE" == "dynamic" ]; then BUFFERMGRD_ARGS="-a /etc/sonic/asic_table.json" + + if [ -f /etc/sonic/zero_profiles.json ]; then + BUFFERMGRD_ZERO_PROFILE_ARGS=" -z /etc/sonic/zero_profiles.json" + fi else # Should we use the fallback MAC in case it is not found in Device.Metadata BUFFERMGRD_ARGS="-l /usr/share/sonic/hwsku/pg_profile_lookup.ini" fi -exec /usr/bin/buffermgrd ${BUFFERMGRD_ARGS} +exec /usr/bin/buffermgrd ${BUFFERMGRD_ARGS} ${BUFFERMGRD_ZERO_PROFILE_ARGS} diff --git a/platform/vs/docker-sonic-vs/database_config.json b/platform/vs/docker-sonic-vs/database_config.json index c3ee59485d96..813e0d76186b 100644 --- a/platform/vs/docker-sonic-vs/database_config.json +++ b/platform/vs/docker-sonic-vs/database_config.json @@ -77,6 +77,11 @@ "id" : 12, "separator": "|", "instance" : "redis_chassis" + }, + "APPL_STATE_DB" : { + "id" : 14, + "separator": ":", + "instance" : "redis" } }, "VERSION" : "1.0" diff --git a/platform/vs/docker-sonic-vs/init_cfg.json.j2 b/platform/vs/docker-sonic-vs/init_cfg.json.j2 index 0b2ce5124215..418c9b871338 100644 --- a/platform/vs/docker-sonic-vs/init_cfg.json.j2 +++ b/platform/vs/docker-sonic-vs/init_cfg.json.j2 @@ -5,7 +5,7 @@ "buffer_model": "traditional" } }, -{% set features = ["swss", "bgp", "teamd", "nat", "database"] %} +{% set features = ["swss", "bgp", "teamd", "nat", "database", "lldp", "dhcp_relay", "macsec"] %} "FEATURE": { {% for feature in features %} "{{ feature }}": { diff --git a/platform/vs/docker-sonic-vs/orchagent.sh b/platform/vs/docker-sonic-vs/orchagent.sh index 4a035a26b292..8bd365e13230 100755 --- a/platform/vs/docker-sonic-vs/orchagent.sh +++ b/platform/vs/docker-sonic-vs/orchagent.sh @@ -1,9 +1,11 @@ #!/usr/bin/env bash -if [[ -z "$fake_platform" ]]; then - export platform=vs +#This is required since we have platform based checks in orchagent + +if [ "$HWSKU" == "Mellanox-SN2700" ]; then + export platform="mellanox" else - export platform=$fake_platform + export platform=vs fi SWSS_VARS_FILE=/usr/share/sonic/templates/swss_vars.j2 diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index 047918d2e518..9911c1bfe011 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -27,17 +27,18 @@ popd [ -d /etc/sonic ] || mkdir -p /etc/sonic -if [[ -f /usr/share/sonic/virtual_chassis/default_config.json ]]; then - CHASS_CFG="-j /usr/share/sonic/virtual_chassis/default_config.json" -fi - # Note: libswsscommon requires a dabase_config file in /var/run/redis/sonic-db/ # Prepare this file before any dependent application, such as sonic-cfggen mkdir -p /var/run/redis/sonic-db cp /etc/default/sonic-db/database_config.json /var/run/redis/sonic-db/ SYSTEM_MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') -sonic-cfggen -t /usr/share/sonic/templates/init_cfg.json.j2 -a "{\"system_mac\": \"$SYSTEM_MAC_ADDRESS\"}" $CHASS_CFG > /etc/sonic/init_cfg.json +sonic-cfggen -t /usr/share/sonic/templates/init_cfg.json.j2 -a "{\"system_mac\": \"$SYSTEM_MAC_ADDRESS\"}" > /etc/sonic/init_cfg.json + +if [[ -f /usr/share/sonic/virtual_chassis/default_config.json ]]; then + sonic-cfggen -j /etc/sonic/init_cfg.json -j /usr/share/sonic/virtual_chassis/default_config.json --print-data > /tmp/init_cfg.json + mv /tmp/init_cfg.json /etc/sonic/init_cfg.json +fi if [ -f /etc/sonic/config_db.json ]; then sonic-cfggen -j /etc/sonic/init_cfg.json -j /etc/sonic/config_db.json --print-data > /tmp/config_db.json @@ -53,7 +54,7 @@ else fi sonic-cfggen -t /usr/share/sonic/templates/copp_cfg.j2 > /etc/sonic/copp_cfg.json -if [ "$fake_platform" == "mellanox" ]; then +if [ "$HWSKU" == "Mellanox-SN2700" ]; then cp /usr/share/sonic/hwsku/sai_mlnx.profile /usr/share/sonic/hwsku/sai.profile fi diff --git a/platform/vs/docker-sonic-vs/zero_profiles.json b/platform/vs/docker-sonic-vs/zero_profiles.json new file mode 100644 index 000000000000..fbd42bf7ec3e --- /dev/null +++ b/platform/vs/docker-sonic-vs/zero_profiles.json @@ -0,0 +1,57 @@ +[ + { + "BUFFER_POOL_TABLE:ingress_zero_pool": { + "mode": "static", + "type": "ingress", + "size": "0" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:ingress_lossy_pg_zero_profile" : { + "pool":"ingress_zero_pool", + "size":"0", + "static_th":"0" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:ingress_lossy_zero_profile" : { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"-8" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:ingress_lossless_zero_profile" : { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"-8" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:egress_lossy_zero_profile" : { + "pool":"egress_lossy_pool", + "size":"0", + "dynamic_th":"-8" + }, + "OP": "SET" + }, + { + "BUFFER_PROFILE_TABLE:egress_lossless_zero_profile" : { + "pool":"egress_lossless_pool", + "size":"0", + "dynamic_th":"-8" + }, + "OP": "SET" + }, + { + "control_fields" : { + "pgs_to_apply_zero_profile":"0", + "ingress_zero_profile":"ingress_lossy_pg_zero_profile" + }, + "OP": "SET" + } +] diff --git a/platform/vs/docker-syncd-vs.mk b/platform/vs/docker-syncd-vs.mk index d2f7872ea446..7ec1ddd5d537 100644 --- a/platform/vs/docker-syncd-vs.mk +++ b/platform/vs/docker-syncd-vs.mk @@ -3,7 +3,8 @@ DOCKER_SYNCD_PLATFORM_CODE = vs include $(PLATFORM_PATH)/../template/docker-syncd-base.mk -$(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD_VS) +$(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD_VS) \ + $(IPROUTE2) $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_VS_DBG) \ $(LIBSWSSCOMMON_DBG) \ diff --git a/platform/vs/docker-syncd-vs/Dockerfile.j2 b/platform/vs/docker-syncd-vs/Dockerfile.j2 index 7fc6391f365e..78b01690ec10 100644 --- a/platform/vs/docker-syncd-vs/Dockerfile.j2 +++ b/platform/vs/docker-syncd-vs/Dockerfile.j2 @@ -9,7 +9,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update -RUN apt-get install -f -y iproute2 libcap2-bin +RUN apt-get install -f -y libcap2-bin COPY \ {% for deb in docker_syncd_vs_debs.split(' ') -%} @@ -20,7 +20,7 @@ debs/ RUN dpkg -i \ {% for deb in docker_syncd_vs_debs.split(' ') -%} debs/{{ deb }}{{' '}} -{%- endfor %} +{%- endfor %} || apt-get install -f -y COPY ["start.sh", "/usr/bin/"] diff --git a/platform/vs/rules.dep b/platform/vs/rules.dep index 0d485e8004d1..44c863612992 100644 --- a/platform/vs/rules.dep +++ b/platform/vs/rules.dep @@ -4,6 +4,7 @@ include $(PLATFORM_PATH)/docker-sonic-vs.dep include $(PLATFORM_PATH)/docker-syncd-vs.dep include $(PLATFORM_PATH)/docker-gbsyncd-vs.dep include $(PLATFORM_PATH)/docker-ptf.dep +include $(PLATFORM_PATH)/docker-ptf-sai.dep include $(PLATFORM_PATH)/libsaithrift-dev.dep include $(PLATFORM_PATH)/one-image.dep include $(PLATFORM_PATH)/onie.dep diff --git a/platform/vs/rules.mk b/platform/vs/rules.mk index cbb52847edfa..461c3f84dd02 100644 --- a/platform/vs/rules.mk +++ b/platform/vs/rules.mk @@ -4,6 +4,7 @@ include $(PLATFORM_PATH)/docker-sonic-vs.mk include $(PLATFORM_PATH)/docker-syncd-vs.mk include $(PLATFORM_PATH)/docker-gbsyncd-vs.mk include $(PLATFORM_PATH)/docker-ptf.mk +include $(PLATFORM_PATH)/docker-ptf-sai.mk include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/one-image.mk include $(PLATFORM_PATH)/onie.mk diff --git a/rules/bash.mk b/rules/bash.mk index 9c0d0c1e86d1..48c089c49e0d 100644 --- a/rules/bash.mk +++ b/rules/bash.mk @@ -1,14 +1,12 @@ # bash package # -# Created to patch memory-leak issue in the bash-package included in Debian-8 (Jessie) -# release. This rule file, and the associated building-infra created to solve this -# bug (src/bash/), should be eliminated once the migration to Debian-9 (Stretch) is -# completed. +# Created to patch plugin support in the bash-package included in Debian-11 (Bullseye) +# release. -# Bash major release-number corresponding to Debian-8 (Jessie) -BASH_VERSION_MAJOR = 4.3 -# Bash complete release-number. This image contains all 4.3 fixes up to patch '42'. -BASH_VERSION_FULL = $(BASH_VERSION_MAJOR)-14 +# Bash major release-number corresponding to Debian-11 (Bullseye) +BASH_VERSION_MAJOR = 5.1 +# Bash complete release-number. This image contains all 5.1 fixes up to patch '2'. +BASH_VERSION_FULL = $(BASH_VERSION_MAJOR)-2 export BASH_VERSION_MAJOR BASH_VERSION_FULL diff --git a/rules/config b/rules/config index 6171894cff7d..fe5d7ac3e991 100644 --- a/rules/config +++ b/rules/config @@ -144,6 +144,12 @@ INCLUDE_NAT = y # INCLUDE_DHCP_RELAY - build and install dhcp-relay package INCLUDE_DHCP_RELAY = y +# INCLUDE_P4RT - build docker-p4rt for P4RT support +INCLUDE_P4RT = n + +# ENABLE_AUTO_TECH_SUPPORT - Enable the configuration for event-driven techsupport & coredump mgmt feature +ENABLE_AUTO_TECH_SUPPORT = y + # TELEMETRY_WRITABLE - Enable write/config operations via the gNMI interface. # Uncomment to enable: # TELEMETRY_WRITABLE = y @@ -199,3 +205,12 @@ REGISTRY_SERVER ?= sonicdev-microsoft.azurecr.io # BUILD_MULTIASIC_KVM - if set to y multi-asic KVM images will be generated. BUILD_MULTIASIC_KVM = n + +# INCLUDE_MUX - build docker-mux for dual ToR (Gemini) +INCLUDE_MUX = y + +# ENABLE_ASAN - enable address sanitizer +ENABLE_ASAN ?= n + +# reset default container registry from dockerhub to other +DEFAULT_CONTAINER_REGISTRY ?= diff --git a/rules/dhcp6relay.mk b/rules/dhcp6relay.mk index d9ff506d8a27..204bf6fa34dd 100644 --- a/rules/dhcp6relay.mk +++ b/rules/dhcp6relay.mk @@ -5,6 +5,8 @@ SONIC_DHCP6RELAY_PKG_NAME = dhcp6relay SONIC_DHCP6RELAY = sonic-$(SONIC_DHCP6RELAY_PKG_NAME)_$(SONIC_DHCP6RELAY_VERSION)_$(CONFIGURED_ARCH).deb $(SONIC_DHCP6RELAY)_DEPENDS = $(LIBSWSSCOMMON) $(LIBHIREDIS) $(LIBSWSSCOMMON_DEV) $(LIBHIREDIS_DEV) -$(DOCKER_DHCP_RELAY)_INSTALL_DEBS = $(LIBSWSSCOMMON) $(LIBHIREDIS) $(LIBSWSSCOMMON_DEV) $(LIBHIREDIS_DEV) $(SONIC_DHCP6RELAY)_SRC_PATH = $(SRC_PATH)/$(SONIC_DHCP6RELAY_PKG_NAME) SONIC_DPKG_DEBS += $(SONIC_DHCP6RELAY) + +SONIC_DHCP6RELAY_DBG = sonic-$(SONIC_DHCP6RELAY_PKG_NAME)-dbgsym_$(SONIC_DHCP6RELAY_VERSION)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(SONIC_DHCP6RELAY),$(SONIC_DHCP6RELAY_DBG))) diff --git a/rules/dhcpmon.mk b/rules/dhcpmon.mk index 3d80d227c156..3f8f5e139bce 100644 --- a/rules/dhcpmon.mk +++ b/rules/dhcpmon.mk @@ -6,3 +6,6 @@ SONIC_DHCPMON_PKG_NAME = dhcpmon SONIC_DHCPMON = sonic-$(SONIC_DHCPMON_PKG_NAME)_$(SONIC_DHCPMON_VERSION)_$(CONFIGURED_ARCH).deb $(SONIC_DHCPMON)_SRC_PATH = $(SRC_PATH)/$(SONIC_DHCPMON_PKG_NAME) SONIC_DPKG_DEBS += $(SONIC_DHCPMON) + +SONIC_DHCPMON_DBG = sonic-$(SONIC_DHCPMON_PKG_NAME)-dbgsym_$(SONIC_DHCPMON_VERSION)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(SONIC_DHCPMON),$(SONIC_DHCPMON_DBG))) diff --git a/rules/docker-base-bullseye.dep b/rules/docker-base-bullseye.dep new file mode 100644 index 000000000000..a127e26f16fa --- /dev/null +++ b/rules/docker-base-bullseye.dep @@ -0,0 +1,9 @@ + +DPATH := $($(DOCKER_BASE_BULLSEYE)_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/docker-base-bullseye.mk rules/docker-base-bullseye.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(DPATH)) + +$(DOCKER_BASE_BULLSEYE)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_BASE_BULLSEYE)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_BASE_BULLSEYE)_DEP_FILES := $(DEP_FILES) diff --git a/rules/docker-base-bullseye.mk b/rules/docker-base-bullseye.mk new file mode 100644 index 000000000000..fcebb554c777 --- /dev/null +++ b/rules/docker-base-bullseye.mk @@ -0,0 +1,16 @@ +# Docker base image (based on Debian Bullseye) + +DOCKER_BASE_BULLSEYE = docker-base-bullseye.gz +$(DOCKER_BASE_BULLSEYE)_PATH = $(DOCKERS_PATH)/docker-base-bullseye + +$(DOCKER_BASE_BULLSEYE)_DEPENDS += $(SOCAT) + +GDB = gdb +GDBSERVER = gdbserver +VIM = vim +OPENSSH = openssh-client +SSHPASS = sshpass +STRACE = strace +$(DOCKER_BASE_BULLSEYE)_DBG_IMAGE_PACKAGES += $(GDB) $(GDBSERVER) $(VIM) $(OPENSSH) $(SSHPASS) $(STRACE) + +SONIC_DOCKER_IMAGES += $(DOCKER_BASE_BULLSEYE) diff --git a/rules/docker-base-buster.mk b/rules/docker-base-buster.mk index 86bfc5781466..ead798578bfe 100644 --- a/rules/docker-base-buster.mk +++ b/rules/docker-base-buster.mk @@ -14,3 +14,4 @@ STRACE = strace $(DOCKER_BASE_BUSTER)_DBG_IMAGE_PACKAGES += $(GDB) $(GDBSERVER) $(VIM) $(OPENSSH) $(SSHPASS) $(STRACE) SONIC_DOCKER_IMAGES += $(DOCKER_BASE_BUSTER) +SONIC_BUSTER_DOCKERS += $(DOCKER_BASE_BUSTER) diff --git a/rules/docker-config-engine-bullseye.dep b/rules/docker-config-engine-bullseye.dep new file mode 100644 index 000000000000..b1435dba50a7 --- /dev/null +++ b/rules/docker-config-engine-bullseye.dep @@ -0,0 +1,9 @@ + +DPATH := $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/docker-config-engine-bullseye.mk rules/docker-config-engine-bullseye.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(DPATH)) + +$(DOCKER_CONFIG_ENGINE_BULLSEYE)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_CONFIG_ENGINE_BULLSEYE)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_CONFIG_ENGINE_BULLSEYE)_DEP_FILES := $(DEP_FILES) diff --git a/rules/docker-config-engine-bullseye.mk b/rules/docker-config-engine-bullseye.mk new file mode 100644 index 000000000000..eae426a111df --- /dev/null +++ b/rules/docker-config-engine-bullseye.mk @@ -0,0 +1,25 @@ +# docker image for sonic config engine + +DOCKER_CONFIG_ENGINE_BULLSEYE = docker-config-engine-bullseye.gz +$(DOCKER_CONFIG_ENGINE_BULLSEYE)_PATH = $(DOCKERS_PATH)/docker-config-engine-bullseye + +$(DOCKER_CONFIG_ENGINE_BULLSEYE)_DEPENDS += $(LIBSWSSCOMMON) \ + $(LIBYANG) \ + $(LIBYANG_CPP) \ + $(LIBYANG_PY3) \ + $(PYTHON3_SWSSCOMMON) +$(DOCKER_CONFIG_ENGINE_BULLSEYE)_PYTHON_WHEELS += $(SWSSSDK_PY3) +$(DOCKER_CONFIG_ENGINE_BULLSEYE)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY3) \ + $(SONIC_YANG_MGMT_PY3) \ + $(SONIC_YANG_MODELS_PY3) +$(DOCKER_CONFIG_ENGINE_BULLSEYE)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY3) +$(DOCKER_CONFIG_ENGINE_BULLSEYE)_LOAD_DOCKERS += $(DOCKER_BASE_BULLSEYE) +$(DOCKER_CONFIG_ENGINE_BULLSEYE)_FILES += $(SWSS_VARS_TEMPLATE) +$(DOCKER_CONFIG_ENGINE_BULLSEYE)_FILES += $($(SONIC_CTRMGRD)_CONTAINER_SCRIPT) + +$(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS = $($(DOCKER_BASE_BULLSEYE)_DBG_DEPENDS) \ + $(LIBSWSSCOMMON_DBG) \ + $(LIBHIREDIS_DBG) +$(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES = $($(DOCKER_BASE_BULLSEYE)_DBG_IMAGE_PACKAGES) + +SONIC_DOCKER_IMAGES += $(DOCKER_CONFIG_ENGINE_BULLSEYE) diff --git a/rules/docker-config-engine-buster.mk b/rules/docker-config-engine-buster.mk index 6dc11265306e..f3df95c36d74 100644 --- a/rules/docker-config-engine-buster.mk +++ b/rules/docker-config-engine-buster.mk @@ -23,3 +23,4 @@ $(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS = $($(DOCKER_BASE_BUSTER)_DBG_DEPENDS $(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES = $($(DOCKER_BASE_BUSTER)_DBG_IMAGE_PACKAGES) SONIC_DOCKER_IMAGES += $(DOCKER_CONFIG_ENGINE_BUSTER) +SONIC_BUSTER_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) diff --git a/rules/docker-database.mk b/rules/docker-database.mk index 9f977f09616d..707adc2d64cb 100644 --- a/rules/docker-database.mk +++ b/rules/docker-database.mk @@ -6,11 +6,11 @@ DOCKER_DATABASE_DBG = $(DOCKER_DATABASE_STEM)-$(DBG_IMAGE_MARK).gz $(DOCKER_DATABASE)_PATH = $(DOCKERS_PATH)/$(DOCKER_DATABASE_STEM) -$(DOCKER_DATABASE)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) +$(DOCKER_DATABASE)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS) -$(DOCKER_DATABASE)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) +$(DOCKER_DATABASE)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES) -$(DOCKER_DATABASE)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_DATABASE)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE) $(DOCKER_DATABASE)_VERSION = 1.0.0 $(DOCKER_DATABASE)_PACKAGE_NAME = database diff --git a/rules/docker-dhcp-relay.mk b/rules/docker-dhcp-relay.mk index 42d7a3f86b33..b742bff43b0d 100644 --- a/rules/docker-dhcp-relay.mk +++ b/rules/docker-dhcp-relay.mk @@ -8,12 +8,12 @@ $(DOCKER_DHCP_RELAY)_PATH = $(DOCKERS_PATH)/$(DOCKER_DHCP_RELAY_STEM) $(DOCKER_DHCP_RELAY)_DEPENDS += $(ISC_DHCP_RELAY) $(SONIC_DHCPMON) $(SONIC_DHCP6RELAY) $(LIBSWSSCOMMON) -$(DOCKER_DHCP_RELAY)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) -$(DOCKER_DHCP_RELAY)_DBG_DEPENDS += $(ISC_DHCP_RELAY_DBG) +$(DOCKER_DHCP_RELAY)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS) +$(DOCKER_DHCP_RELAY)_DBG_DEPENDS += $(ISC_DHCP_RELAY_DBG) $(SONIC_DHCP6RELAY_DBG) $(SONIC_DHCPMON_DBG) -$(DOCKER_DHCP_RELAY)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) +$(DOCKER_DHCP_RELAY)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES) -$(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BULLSEYE) $(DOCKER_DHCP_RELAY)_INSTALL_PYTHON_WHEELS = $(SONIC_UTILITIES_PY3) $(DOCKER_DHCP_RELAY)_INSTALL_DEBS = $(PYTHON3_SWSSCOMMON) diff --git a/rules/docker-fpm-frr.mk b/rules/docker-fpm-frr.mk index 37c3a62f1855..2249f828a48c 100644 --- a/rules/docker-fpm-frr.mk +++ b/rules/docker-fpm-frr.mk @@ -8,13 +8,13 @@ $(DOCKER_FPM_FRR)_PATH = $(DOCKERS_PATH)/$(DOCKER_FPM_FRR_STEM) $(DOCKER_FPM_FRR)_PYTHON_WHEELS += $(SONIC_BGPCFGD) $(SONIC_FRR_MGMT_FRAMEWORK) $(DOCKER_FPM_FRR)_DEPENDS += $(FRR) $(FRR_SNMP) $(SWSS) $(LIBYANG1) -$(DOCKER_FPM_FRR)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) +$(DOCKER_FPM_FRR)_DBG_DEPENDS = $($(DOCKER_SWSS_LAYER_BUSTER)_DBG_DEPENDS) $(DOCKER_FPM_FRR)_DBG_DEPENDS += $(SWSS_DBG) $(LIBSWSSCOMMON_DBG) \ $(FRR_DBG) $(FRR_SNMP_DBG) $(LIBYANG1_DBG) -$(DOCKER_FPM_FRR)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) +$(DOCKER_FPM_FRR)_DBG_IMAGE_PACKAGES = $($(DOCKER_SWSS_LAYER_BUSTER)_DBG_IMAGE_PACKAGES) -$(DOCKER_FPM_FRR)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_FPM_FRR)_LOAD_DOCKERS += $(DOCKER_SWSS_LAYER_BUSTER) $(DOCKER_FPM_FRR)_VERSION = 1.0.0 $(DOCKER_FPM_FRR)_PACKAGE_NAME = fpm-frr @@ -39,3 +39,6 @@ $(DOCKER_FPM_FRR)_BASE_IMAGE_FILES += TSA:/usr/bin/TSA $(DOCKER_FPM_FRR)_BASE_IMAGE_FILES += TSB:/usr/bin/TSB $(DOCKER_FPM_FRR)_BASE_IMAGE_FILES += TSC:/usr/bin/TSC $(DOCKER_FPM_FRR)_BASE_IMAGE_FILES += TS:/usr/bin/TS + +SONIC_BUSTER_DOCKERS += $(DOCKER_FPM_FRR) +SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_FPM_FRR_DBG) diff --git a/rules/docker-iccpd.mk b/rules/docker-iccpd.mk index 69b9fee50eef..c0c747997959 100644 --- a/rules/docker-iccpd.mk +++ b/rules/docker-iccpd.mk @@ -25,3 +25,6 @@ $(DOCKER_ICCPD)_RUN_OPT += --privileged -t $(DOCKER_ICCPD)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_ICCPD)_BASE_IMAGE_FILES += mclagdctl:/usr/bin/mclagdctl + +SONIC_BUSTER_DOCKERS += $(DOCKER_ICCPD) +SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_ICCPD_DBG) diff --git a/rules/docker-lldp.mk b/rules/docker-lldp.mk index 2c3d41a46d1a..f9c77ec14c40 100644 --- a/rules/docker-lldp.mk +++ b/rules/docker-lldp.mk @@ -35,3 +35,6 @@ $(DOCKER_LLDP)_RUN_OPT += -v /usr/share/sonic/scripts:/usr/share/sonic/scripts:r $(DOCKER_LLDP)_BASE_IMAGE_FILES += lldpctl:/usr/bin/lldpctl $(DOCKER_LLDP)_BASE_IMAGE_FILES += lldpcli:/usr/bin/lldpcli $(DOCKER_LLDP)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) + +SONIC_BUSTER_DOCKERS += $(DOCKER_LLDP) +SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_LLDP_DBG) diff --git a/rules/docker-macsec.mk b/rules/docker-macsec.mk index 8fc5e0baa85c..1cb14246e86a 100644 --- a/rules/docker-macsec.mk +++ b/rules/docker-macsec.mk @@ -7,13 +7,13 @@ DOCKER_MACSEC_DBG = $(DOCKER_MACSEC_STEM)-$(DBG_IMAGE_MARK).gz $(DOCKER_MACSEC)_PATH = $(DOCKERS_PATH)/$(DOCKER_MACSEC_STEM) $(DOCKER_MACSEC)_DEPENDS += $(SWSS) $(WPASUPPLICANT) $(REDIS_TOOLS) $(LIBNL3) $(LIBNL_GENL3) $(LIBNL_ROUTE3) -$(DOCKER_MACSEC)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) +$(DOCKER_MACSEC)_DBG_DEPENDS = $($(DOCKER_SWSS_LAYER_BUSTER)_DBG_DEPENDS) $(DOCKER_MACSEC)_DBG_DEPENDS += $(SWSS_DBG) $(LIBSWSSCOMMON_DBG) $(DOCKER_MACSEC)_DBG_DEPENDS += $(WPASUPPLICANT_DBG) -$(DOCKER_MACSEC)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) +$(DOCKER_MACSEC)_DBG_IMAGE_PACKAGES = $($(DOCKER_SWSS_LAYER_BUSTER)_DBG_IMAGE_PACKAGES) -$(DOCKER_MACSEC)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_MACSEC)_LOAD_DOCKERS += $(DOCKER_SWSS_LAYER_BUSTER) SONIC_DOCKER_IMAGES += $(DOCKER_MACSEC) ifeq ($(INCLUDE_MACSEC), y) @@ -33,3 +33,6 @@ $(DOCKER_MACSEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_MACSEC)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_MACSEC)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) + +SONIC_BUSTER_DOCKERS += $(DOCKER_MACSEC) +SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_MACSEC_DBG) diff --git a/rules/docker-mux.dep b/rules/docker-mux.dep new file mode 100644 index 000000000000..70d4dd4edf89 --- /dev/null +++ b/rules/docker-mux.dep @@ -0,0 +1,12 @@ + +DPATH := $($(DOCKER_MUX)_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/docker-mux.mk rules/docker-mux.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(DPATH)) + +$(DOCKER_MUX)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_MUX)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_MUX)_DEP_FILES := $(DEP_FILES) + +$(eval $(call add_dbg_docker,$(DOCKER_MUX),$(DOCKER_MUX_DBG))) + diff --git a/rules/docker-mux.mk b/rules/docker-mux.mk new file mode 100644 index 000000000000..31c3212ea11f --- /dev/null +++ b/rules/docker-mux.mk @@ -0,0 +1,39 @@ +# Docker image for MUX + +DOCKER_MUX_STEM = docker-mux +DOCKER_MUX = $(DOCKER_MUX_STEM).gz +DOCKER_MUX_DBG = $(DOCKER_MUX_STEM)-$(DBG_IMAGE_MARK).gz + +$(DOCKER_MUX)_PATH = $(DOCKERS_PATH)/$(DOCKER_MUX_STEM) + +$(DOCKER_MUX)_DEPENDS = $(SONIC_LINKMGRD) $(LIBSWSSCOMMON) $(LIBHIREDIS) +$(DOCKER_MUX)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) +$(DOCKER_MUX)_DBG_DEPENDS += $(SONIC_LINKMGRD_DBG) $(LIBSWSSCOMMON_DBG) $(LIBHIREDIS_DBG) + +$(DOCKER_MUX)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) + +$(DOCKER_MUX)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BUSTER) + +$(DOCKER_MUX)_VERSION = 1.0.0 +$(DOCKER_MUX)_PACKAGE_NAME = mux +$(DOCKER_MUX)_WARM_SHUTDOWN_BEFORE = swss +$(DOCKER_MUX)_FAST_SHUTDOWN_BEFORE = swss + +ifeq ($(INCLUDE_MUX), y) +SONIC_DOCKER_IMAGES += $(DOCKER_MUX) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_MUX) +endif + +ifeq ($(INCLUDE_MUX), y) +SONIC_DOCKER_DBG_IMAGES += $(DOCKER_MUX_DBG) +SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_MUX_DBG) +endif + +$(DOCKER_MUX)_CONTAINER_NAME = mux +$(DOCKER_MUX)_RUN_OPT += --privileged -t +$(DOCKER_MUX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_ORCHAGENT)_RUN_OPT += -v /var/log/mux:/var/log/mux:rw +$(DOCKER_MUX)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) + +SONIC_BUSTER_DOCKERS += $(DOCKER_MUX) +SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_MUX_DBG) diff --git a/rules/docker-nat.mk b/rules/docker-nat.mk index b5ead85d1919..6e73ac9aec4b 100644 --- a/rules/docker-nat.mk +++ b/rules/docker-nat.mk @@ -7,11 +7,11 @@ DOCKER_NAT_DBG = $(DOCKER_NAT_STEM)-$(DBG_IMAGE_MARK).gz $(DOCKER_NAT)_PATH = $(DOCKERS_PATH)/$(DOCKER_NAT_STEM) $(DOCKER_NAT)_DEPENDS += $(SWSS) $(IPTABLESIP4TC) $(IPTABLESIP6TC) $(IPTABLESIPTC) $(IPXTABLES12) $(IPTABLES) -$(DOCKER_NAT)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) +$(DOCKER_NAT)_DBG_DEPENDS = $($(DOCKER_SWSS_LAYER_BUSTER)_DBG_DEPENDS) $(DOCKER_NAT)_DBG_DEPENDS += $(SWSS_DBG) $(LIBSWSSCOMMON_DBG) -$(DOCKER_NAT)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) +$(DOCKER_NAT)_DBG_IMAGE_PACKAGES = $($(DOCKER_SWSS_LAYER_BUSTER)_DBG_IMAGE_PACKAGES) -$(DOCKER_NAT)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_NAT)_LOAD_DOCKERS += $(DOCKER_SWSS_LAYER_BUSTER) $(DOCKER_NAT)_VERSION = 1.0.0 $(DOCKER_NAT)_PACKAGE_NAME = nat @@ -36,3 +36,6 @@ $(DOCKER_NAT)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_NAT)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) $(DOCKER_NAT)_BASE_IMAGE_FILES += natctl:/usr/bin/natctl + +SONIC_BUSTER_DOCKERS += $(DOCKER_NAT) +SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_NAT_DBG) diff --git a/rules/docker-orchagent.mk b/rules/docker-orchagent.mk index 3273b675905d..ef0c203877d8 100644 --- a/rules/docker-orchagent.mk +++ b/rules/docker-orchagent.mk @@ -6,16 +6,17 @@ DOCKER_ORCHAGENT_DBG = $(DOCKER_ORCHAGENT_STEM)-$(DBG_IMAGE_MARK).gz $(DOCKER_ORCHAGENT)_DEPENDS += $(SWSS) -$(DOCKER_ORCHAGENT)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) +$(DOCKER_ORCHAGENT)_DBG_DEPENDS = $($(DOCKER_SWSS_LAYER_BUSTER)_DBG_DEPENDS) $(DOCKER_ORCHAGENT)_DBG_DEPENDS += $(SWSS_DBG) \ $(LIBSWSSCOMMON_DBG) \ $(LIBSAIREDIS_DBG) +$(DOCKER_ORCHAGENT)_PYTHON_WHEELS += $(SCAPY) -$(DOCKER_ORCHAGENT)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) +$(DOCKER_ORCHAGENT)_DBG_IMAGE_PACKAGES = $($(DOCKER_SWSS_LAYER_BUSTER)_DBG_IMAGE_PACKAGES) $(DOCKER_ORCHAGENT)_PATH = $(DOCKERS_PATH)/$(DOCKER_ORCHAGENT_STEM) -$(DOCKER_ORCHAGENT)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_ORCHAGENT)_LOAD_DOCKERS += $(DOCKER_SWSS_LAYER_BUSTER) $(DOCKER_ORCHAGENT)_VERSION = 1.0.0 $(DOCKER_ORCHAGENT)_PACKAGE_NAME = swss @@ -38,3 +39,6 @@ $(DOCKER_ORCHAGENT)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw $(DOCKER_ORCHAGENT)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel $(DOCKER_ORCHAGENT)_FILES += $(ARP_UPDATE_SCRIPT) $(ARP_UPDATE_VARS_TEMPLATE) $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) + +SONIC_BUSTER_DOCKERS += $(DOCKER_ORCHAGENT) +SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_ORCHAGENT_DBG) diff --git a/rules/docker-p4rt.dep b/rules/docker-p4rt.dep new file mode 100644 index 000000000000..5a5c8db9b54e --- /dev/null +++ b/rules/docker-p4rt.dep @@ -0,0 +1,10 @@ +DPATH := $($(DOCKER_P4RT)_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/docker-p4rt.mk rules/docker-p4rt.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(DPATH)) + +$(DOCKER_P4RT)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_P4RT)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_P4RT)_DEP_FILES := $(DEP_FILES) + +$(eval $(call add_dbg_docker,$(DOCKER_P4RT),$(DOCKER_P4RT_DBG))) diff --git a/rules/docker-p4rt.mk b/rules/docker-p4rt.mk new file mode 100644 index 000000000000..60e0d7d75244 --- /dev/null +++ b/rules/docker-p4rt.mk @@ -0,0 +1,35 @@ +# docker image for p4rt + +DOCKER_P4RT_STEM = docker-sonic-p4rt +DOCKER_P4RT = $(DOCKER_P4RT_STEM).gz +DOCKER_P4RT_DBG = $(DOCKER_P4RT_STEM)-$(DBG_IMAGE_MARK).gz + +$(DOCKER_P4RT)_PATH = $(DOCKERS_PATH)/$(DOCKER_P4RT_STEM) + +$(DOCKER_P4RT)_DEPENDS += $(SONIC_P4RT) +$(DOCKER_P4RT)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS) +$(DOCKER_P4RT)_DBG_DEPENDS += $(SONIC_P4RT_DBG) $(LIBSWSSCOMMON_DBG) +$(DOCKER_P4RT)_DBG_DEPENDS += $(LIBSAIREDIS_DBG) +$(DOCKER_P4RT)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES) + +$(DOCKER_P4RT)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE) + +$(DOCKER_P4RT)_VERSION = 1.0.0 +$(DOCKER_P4RT)_PACKAGE_NAME = p4rt +$(DOCKER_P4RT)_WARM_SHUTDOWN_BEFORE = swss +$(DOCKER_P4RT)_FAST_SHUTDOWN_BEFORE = swss + +SONIC_DOCKER_IMAGES += $(DOCKER_P4RT) +SONIC_DOCKER_DBG_IMAGES += $(DOCKER_P4RT_DBG) + +ifeq ($(INCLUDE_P4RT), y) +SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_P4RT) +SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_P4RT_DBG) +endif + +$(DOCKER_P4RT)_CONTAINER_NAME = p4rt +$(DOCKER_P4RT)_RUN_OPT += --privileged -t +$(DOCKER_P4RT)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro +$(DOCKER_P4RT)_GIT_COMMIT = $(shell cd "$($(SONIC_P4RT)_SRC_PATH)" && git log -n 1 --format=format:"%H %s" || echo "Unable to fetch git log for p4rt") + +$(DOCKER_P4RT)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index 4cb3299ca21e..21babbcb49f4 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -6,33 +6,24 @@ DOCKER_PLATFORM_MONITOR_DBG = $(DOCKER_PLATFORM_MONITOR_STEM)-$(DBG_IMAGE_MARK). $(DOCKER_PLATFORM_MONITOR)_PATH = $(DOCKERS_PATH)/$(DOCKER_PLATFORM_MONITOR_STEM) -$(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(LIBSENSORS) $(LM_SENSORS) $(FANCONTROL) $(SENSORD) $(LIBSWSSCOMMON) $(PYTHON_SWSSCOMMON) $(PYTHON3_SWSSCOMMON) $(SMARTMONTOOLS) $(ETHTOOL) +$(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(LIBSENSORS) $(LM_SENSORS) $(FANCONTROL) $(SENSORD) $(LIBSWSSCOMMON) $(PYTHON3_SWSSCOMMON) $(ETHTOOL) + -$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY2) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY3) -$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SWSSSDK_PY2) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SWSSSDK_PY3) -$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY2) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY3) -$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2) -$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PLATFORM_API_PY2) +$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY3) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PLATFORM_API_PY3) -$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_LEDD_PY2) -$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PCIED_PY2) -$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PSUD_PY2) -$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_SYSEEPROMD_PY2) -$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_THERMALCTLD_PY2) -$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_XCVRD_PY2) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_LEDD_PY3) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PCIED_PY3) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PSUD_PY3) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_SYSEEPROMD_PY3) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_THERMALCTLD_PY3) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_XCVRD_PY3) +$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_YCABLED_PY3) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_CHASSISD_PY3) ifeq ($(PDDF_SUPPORT),y) -$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(PDDF_PLATFORM_API_BASE_PY2) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(PDDF_PLATFORM_API_BASE_PY3) endif @@ -47,6 +38,10 @@ $(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BUSTER) $(DOCKER_PLATFORM_MONITOR)_VERSION = 1.0.0 $(DOCKER_PLATFORM_MONITOR)_PACKAGE_NAME = pmon +ifeq ($(CONFIGURED_PLATFORM),mellanox) +$(DOCKER_PLATFORM_MONITOR)_WARM_SHUTDOWN_BEFORE = swss +endif + SONIC_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR) @@ -62,14 +57,14 @@ $(DOCKER_PLATFORM_MONITOR)_RUN_OPT += -v /usr/share/sonic/device/pddf:/usr/share # Mount Arista python library on Aboot images to be used by plugins $(DOCKER_PLATFORM_MONITOR)_aboot_RUN_OPT += -v /usr/lib/libsfp-eeprom.so:/usr/lib/libsfp-eeprom.so:ro -$(DOCKER_PLATFORM_MONITOR)_aboot_RUN_OPT += -v /usr/lib/python2.7/dist-packages/arista:/usr/lib/python2.7/dist-packages/arista:ro $(DOCKER_PLATFORM_MONITOR)_aboot_RUN_OPT += -v /usr/lib/python3/dist-packages/arista:/usr/lib/python3/dist-packages/arista:ro -$(DOCKER_PLATFORM_MONITOR)_aboot_RUN_OPT += -v /usr/lib/python2.7/dist-packages/sonic_platform:/usr/lib/python2.7/dist-packages/sonic_platform:ro $(DOCKER_PLATFORM_MONITOR)_aboot_RUN_OPT += -v /usr/lib/python3/dist-packages/sonic_platform:/usr/lib/python3/dist-packages/sonic_platform:ro $(DOCKER_PLATFORM_MONITOR)_BASE_IMAGE_FILES += cmd_wrapper:/usr/bin/sensors -$(DOCKER_PLATFORM_MONITOR)_BASE_IMAGE_FILES += cmd_wrapper:/usr/sbin/smartctl $(DOCKER_PLATFORM_MONITOR)_BASE_IMAGE_FILES += cmd_wrapper:/usr/sbin/iSmart $(DOCKER_PLATFORM_MONITOR)_BASE_IMAGE_FILES += cmd_wrapper:/usr/sbin/SmartCmd $(DOCKER_PLATFORM_MONITOR)_BASE_IMAGE_FILES += cmd_wrapper:/usr/bin/ethtool $(DOCKER_PLATFORM_MONITOR)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) + +SONIC_BUSTER_DOCKERS += $(DOCKER_PLATFORM_MONITOR) +SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_PLATFORM_MONITOR_DBG) diff --git a/rules/docker-restapi.mk b/rules/docker-restapi.mk index 1c54bde741b8..81ea57a89846 100644 --- a/rules/docker-restapi.mk +++ b/rules/docker-restapi.mk @@ -8,14 +8,13 @@ $(DOCKER_RESTAPI)_DEPENDS += $(LIBHIREDIS) $(LIBNL3) $(LIBNL_GENL3) \ $(DOCKER_RESTAPI)_PATH = $(DOCKERS_PATH)/$(DOCKER_RESTAPI_STEM) -$(DOCKER_RESTAPI)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH) +$(DOCKER_RESTAPI)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE) $(DOCKER_RESTAPI)_VERSION = 1.0.0 $(DOCKER_RESTAPI)_PACKAGE_NAME = restapi ifeq ($(INCLUDE_RESTAPI), y) SONIC_DOCKER_IMAGES += $(DOCKER_RESTAPI) -SONIC_STRETCH_DOCKERS += $(DOCKER_RESTAPI) SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_RESTAPI) endif diff --git a/rules/docker-router-advertiser.mk b/rules/docker-router-advertiser.mk index 14c896d820ae..6d5b9e4717bd 100644 --- a/rules/docker-router-advertiser.mk +++ b/rules/docker-router-advertiser.mk @@ -6,12 +6,12 @@ DOCKER_ROUTER_ADVERTISER_DBG = $(DOCKER_ROUTER_ADVERTISER_STEM)-$(DBG_IMAGE_MARK $(DOCKER_ROUTER_ADVERTISER)_PATH = $(DOCKERS_PATH)/$(DOCKER_ROUTER_ADVERTISER_STEM) -$(DOCKER_ROUTER_ADVERTISER)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) +$(DOCKER_ROUTER_ADVERTISER)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS) $(DOCKER_ROUTER_ADVERTISER)_DBG_DEPENDS += $(RADVD_DBG) -$(DOCKER_ROUTER_ADVERTISER)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) +$(DOCKER_ROUTER_ADVERTISER)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES) -$(DOCKER_ROUTER_ADVERTISER)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_ROUTER_ADVERTISER)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BULLSEYE) $(DOCKER_ROUTER_ADVERTISER)_VERSION = 1.0.0 $(DOCKER_ROUTER_ADVERTISER)_PACKAGE_NAME = radv diff --git a/rules/docker-sflow.mk b/rules/docker-sflow.mk index 5762dd869ac7..22a9e538e1bd 100644 --- a/rules/docker-sflow.mk +++ b/rules/docker-sflow.mk @@ -7,11 +7,11 @@ DOCKER_SFLOW_DBG = $(DOCKER_SFLOW_STEM)-$(DBG_IMAGE_MARK).gz $(DOCKER_SFLOW)_PATH = $(DOCKERS_PATH)/$(DOCKER_SFLOW_STEM) $(DOCKER_SFLOW)_DEPENDS += $(SWSS) $(HSFLOWD) $(SFLOWTOOL) $(PSAMPLE) -$(DOCKER_SFLOW)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) +$(DOCKER_SFLOW)_DBG_DEPENDS = $($(DOCKER_SWSS_LAYER_BUSTER)_DBG_DEPENDS) $(DOCKER_TEAMD)_DBG_DEPENDS += $(SWSS_DBG) $(LIBSWSSCOMMON_DBG) -$(DOCKER_SFLOW)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) +$(DOCKER_SFLOW)_DBG_IMAGE_PACKAGES = $($(DOCKER_SWSS_LAYER_BUSTER)_DBG_IMAGE_PACKAGES) -$(DOCKER_SFLOW)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_SFLOW)_LOAD_DOCKERS += $(DOCKER_SWSS_LAYER_BUSTER) $(DOCKER_SFLOW)_VERSION = 1.0.0 $(DOCKER_SFLOW)_PACKAGE_NAME = sflow @@ -36,3 +36,6 @@ $(DOCKER_SFLOW)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_SFLOW)_BASE_IMAGE_FILES += psample:/usr/bin/psample $(DOCKER_SFLOW)_BASE_IMAGE_FILES += sflowtool:/usr/bin/sflowtool $(DOCKER_SFLOW)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) + +SONIC_BUSTER_DOCKERS += $(DOCKER_SFLOW) +SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_SFLOW_DBG) diff --git a/rules/docker-snmp.mk b/rules/docker-snmp.mk index 96a783d7a5a2..af90cf3664e8 100644 --- a/rules/docker-snmp.mk +++ b/rules/docker-snmp.mk @@ -31,3 +31,6 @@ $(DOCKER_SNMP)_RUN_OPT += --privileged -t $(DOCKER_SNMP)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_SNMP)_RUN_OPT += -v /usr/share/sonic/scripts:/usr/share/sonic/scripts:ro $(DOCKER_SNMP)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) + +SONIC_BUSTER_DOCKERS += $(DOCKER_SNMP) +SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_SNMP_DBG) diff --git a/rules/docker-sonic-mgmt-framework.mk b/rules/docker-sonic-mgmt-framework.mk index ef1d55990816..b0986e12d14e 100644 --- a/rules/docker-sonic-mgmt-framework.mk +++ b/rules/docker-sonic-mgmt-framework.mk @@ -36,3 +36,6 @@ $(DOCKER_MGMT_FRAMEWORK)_RUN_OPT += -v /var/run/dbus:/var/run/dbus:rw $(DOCKER_MGMT_FRAMEWORK)_RUN_OPT += --mount type=bind,source="/var/platform/",target="/mnt/platform/" $(DOCKER_MGMT_FRAMEWORK)_BASE_IMAGE_FILES += sonic-cli:/usr/bin/sonic-cli + +SONIC_BUSTER_DOCKERS += $(DOCKER_MGMT_FRAMEWORK) +SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_MGMT_FRAMEWORK_DBG) diff --git a/rules/docker-sonic-sdk-buildenv.mk b/rules/docker-sonic-sdk-buildenv.mk index 52e11b815cff..fc3ee9fac986 100644 --- a/rules/docker-sonic-sdk-buildenv.mk +++ b/rules/docker-sonic-sdk-buildenv.mk @@ -27,3 +27,6 @@ $(DOCKER_SONIC_SDK_BUILDENV)_LOAD_DOCKERS += $(DOCKER_SONIC_SDK) SONIC_DOCKER_IMAGES += $(DOCKER_SONIC_SDK_BUILDENV) SONIC_DOCKER_DBG_IMAGES += $(DOCKER_SONIC_SDK_BUILDENV_DBG) + +SONIC_BUSTER_DOCKERS += $(DOCKER_SONIC_SDK_BUILDENV) +SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_SONIC_SDK_BUILDENV_DBG) diff --git a/rules/docker-sonic-sdk.mk b/rules/docker-sonic-sdk.mk index b6a185c6d94e..d1253aeb1fca 100644 --- a/rules/docker-sonic-sdk.mk +++ b/rules/docker-sonic-sdk.mk @@ -22,3 +22,6 @@ $(DOCKER_SONIC_SDK)_LABELS += com.azure.sonic.versions.libswsscommon=$(LIBSWSSCO $(DOCKER_SONIC_SDK)_LABELS += com.azure.sonic.versions.libsairedis=$(LIBSAIREDIS_VERSION) $(DOCKER_SONIC_SDK)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) + +SONIC_BUSTER_DOCKERS += $(DOCKER_SONIC_SDK) +SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_SONIC_SDK_DBG) diff --git a/rules/docker-swss-layer-buster.dep b/rules/docker-swss-layer-buster.dep new file mode 100644 index 000000000000..d245a29269c3 --- /dev/null +++ b/rules/docker-swss-layer-buster.dep @@ -0,0 +1,10 @@ + +DPATH := $($(DOCKER_SWSS_LAYER_BUSTER)_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/docker-swss-layer-buster.mk rules/docker-swss-layer-buster.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(DPATH)) + +$(DOCKER_SWSS_LAYER_BUSTER)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_SWSS_LAYER_BUSTER)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_SWSS_LAYER_BUSTER)_DEP_FILES := $(DEP_FILES) + diff --git a/rules/docker-swss-layer-buster.mk b/rules/docker-swss-layer-buster.mk new file mode 100644 index 000000000000..f04a09fbca4c --- /dev/null +++ b/rules/docker-swss-layer-buster.mk @@ -0,0 +1,14 @@ +# docker image for sonic swss layer + +DOCKER_SWSS_LAYER_BUSTER = docker-swss-layer-buster.gz +$(DOCKER_SWSS_LAYER_BUSTER)_PATH = $(DOCKERS_PATH)/docker-swss-layer-buster + +$(DOCKER_SWSS_LAYER_BUSTER)_DEPENDS += $(SWSS) +$(DOCKER_SWSS_LAYER_BUSTER)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) + +$(DOCKER_SWSS_LAYER_BUSTER)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) \ + $(SWSS) +$(DOCKER_SWSS_LAYER_BUSTER)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) + +SONIC_DOCKER_IMAGES += $(DOCKER_SWSS_LAYER_BUSTER) +SONIC_BUSTER_DOCKERS += $(DOCKER_SWSS_LAYER_BUSTER) diff --git a/rules/docker-teamd.mk b/rules/docker-teamd.mk index 9135c45aea3e..8d978ae66515 100644 --- a/rules/docker-teamd.mk +++ b/rules/docker-teamd.mk @@ -7,13 +7,13 @@ DOCKER_TEAMD_DBG = $(DOCKER_TEAMD_STEM)-$(DBG_IMAGE_MARK).gz $(DOCKER_TEAMD)_PATH = $(DOCKERS_PATH)/$(DOCKER_TEAMD_STEM) $(DOCKER_TEAMD)_DEPENDS += $(SWSS) $(LIBTEAMDCTL) $(LIBTEAM_UTILS) -$(DOCKER_TEAMD)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) +$(DOCKER_TEAMD)_DBG_DEPENDS = $($(DOCKER_SWSS_LAYER_BUSTER)_DBG_DEPENDS) $(DOCKER_TEAMD)_DBG_DEPENDS += $(SWSS_DBG) $(LIBSWSSCOMMON_DBG) $(DOCKER_TEAMD)_DBG_DEPENDS += $(LIBTEAMDCTL_DBG) $(LIBTEAM_UTILS_DBG) -$(DOCKER_TEAMD)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) +$(DOCKER_TEAMD)_DBG_IMAGE_PACKAGES = $($(DOCKER_SWSS_LAYER_BUSTER)_DBG_IMAGE_PACKAGES) -$(DOCKER_TEAMD)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_TEAMD)_LOAD_DOCKERS += $(DOCKER_SWSS_LAYER_BUSTER) $(DOCKER_TEAMD)_VERSION = 1.0.0 $(DOCKER_TEAMD)_PACKAGE_NAME = teamd @@ -34,3 +34,6 @@ $(DOCKER_TEAMD)_RUN_OPT += -v /host/warmboot:/var/warmboot $(DOCKER_TEAMD)_BASE_IMAGE_FILES += teamdctl:/usr/bin/teamdctl $(DOCKER_TEAMD)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) + +SONIC_BUSTER_DOCKERS += $(DOCKER_TEAMD) +SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_TEAMD_DBG) diff --git a/rules/docker-telemetry.mk b/rules/docker-telemetry.mk index 4a1dd9e67d29..4a2d3fd64e28 100644 --- a/rules/docker-telemetry.mk +++ b/rules/docker-telemetry.mk @@ -8,14 +8,14 @@ $(DOCKER_TELEMETRY)_PATH = $(DOCKERS_PATH)/$(DOCKER_TELEMETRY_STEM) $(DOCKER_TELEMETRY)_DEPENDS += $(SONIC_MGMT_COMMON) $(DOCKER_TELEMETRY)_DEPENDS += $(SONIC_TELEMETRY) -$(DOCKER_TELEMETRY)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS) +$(DOCKER_TELEMETRY)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS) -$(DOCKER_TELEMETRY)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER) +$(DOCKER_TELEMETRY)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE) $(DOCKER_TELEMETRY)_VERSION = 1.0.0 $(DOCKER_TELEMETRY)_PACKAGE_NAME = telemetry -$(DOCKER_TELEMETRY)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES) +$(DOCKER_TELEMETRY)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES) SONIC_DOCKER_IMAGES += $(DOCKER_TELEMETRY) ifeq ($(INCLUDE_SYSTEM_TELEMETRY), y) diff --git a/rules/functions b/rules/functions index 6f62b87797c8..62b3c8a98375 100644 --- a/rules/functions +++ b/rules/functions @@ -177,7 +177,8 @@ endef # call: # generate_manifest some_docker.gz, version_suffix define generate_manifest - $(eval export version=$($(1).gz_VERSION)$(2)) + $(eval export version=$($(1).gz_VERSION)) + $(eval export version_suffix=$(2)) $(eval export name=$($(1).gz_CONTAINER_NAME)) $(eval export package_name=$($(1).gz_PACKAGE_NAME)) $(eval export asic_service=$(shell [ -f files/build_templates/per_namespace/$(name).service.j2 ] && echo true || echo false)) @@ -197,7 +198,6 @@ define generate_manifest $(eval export config_cli_plugin=$($(1).gz_CLI_CONFIG_PLUGIN)) $(eval export show_cli_plugin=$($(1).gz_CLI_SHOW_PLUGIN)) $(eval export clear_cli_plugin=$($(1).gz_CLI_CLEAR_PLUGIN)) - j2 $($*.gz_PATH)/Dockerfile$(2).j2 > $($(1).gz_PATH)/Dockerfile$(2) j2 --customize scripts/j2cli/json_filter.py files/build_templates/manifest.json.j2 > $($(1).gz_PATH)/manifest.common.json if [ -f $($*.gz_PATH)/manifest.part.json.j2 ]; then j2 --customize scripts/j2cli/json_filter.py $($(1).gz_PATH)/manifest.part.json.j2 > $($(1).gz_PATH)/manifest.part.json diff --git a/rules/initramfs-tools.mk b/rules/initramfs-tools.mk index 2f3e55acac76..c396765af919 100644 --- a/rules/initramfs-tools.mk +++ b/rules/initramfs-tools.mk @@ -1,6 +1,6 @@ # initramfs-tools package -INITRAMFS_TOOLS_VERSION = 0.133 +INITRAMFS_TOOLS_VERSION = 0.140 export INITRAMFS_TOOLS_VERSION INITRAMFS_TOOLS = initramfs-tools_$(INITRAMFS_TOOLS_VERSION)_all.deb diff --git a/rules/iproute2.mk b/rules/iproute2.mk index 33d54f4de11c..302849eaf47e 100644 --- a/rules/iproute2.mk +++ b/rules/iproute2.mk @@ -1,7 +1,11 @@ # iproute2 package -IPROUTE2_VERSION = 4.9.0-1 +IPROUTE2_VERSION = 5.10.0 +IPROUTE2_VERSION_FULL = $(IPROUTE2_VERSION)-4~bpo10+1 -IPROUTE2 = iproute2_$(IPROUTE2_VERSION)_$(CONFIGURED_ARCH).deb +export IPROUTE2_VERSION +export IPROUTE2_VERSION_FULL + +IPROUTE2 = iproute2_$(IPROUTE2_VERSION_FULL)_$(CONFIGURED_ARCH).deb $(IPROUTE2)_SRC_PATH = $(SRC_PATH)/iproute2 SONIC_MAKE_DEBS += $(IPROUTE2) diff --git a/rules/isc-dhcp.mk b/rules/isc-dhcp.mk index 3edebfd0dde0..1a1ad54678b8 100644 --- a/rules/isc-dhcp.mk +++ b/rules/isc-dhcp.mk @@ -1,7 +1,7 @@ # isc-dhcp packages ISC_DHCP_VERSION = 4.4.1 -ISC_DHCP_VERSION_FULL = ${ISC_DHCP_VERSION}-2 +ISC_DHCP_VERSION_FULL = ${ISC_DHCP_VERSION}-2.3 export ISC_DHCP_VERSION ISC_DHCP_VERSION_FULL diff --git a/rules/kdump-tools.mk b/rules/kdump-tools.mk index c4b0c792b04a..e4682b203d0a 100644 --- a/rules/kdump-tools.mk +++ b/rules/kdump-tools.mk @@ -1,11 +1,10 @@ # kdump-tools package -KDUMP_TOOLS_VERSION_BASE = 1.6.1 -KDUMP_TOOLS_VERSION = $(KDUMP_TOOLS_VERSION_BASE)-1 +KDUMP_TOOLS_VERSION = 1.6.8.4 export KDUMP_TOOLS_VERSION_BASE export KDUMP_TOOLS_VERSION -KDUMP_TOOLS = kdump-tools_$(KDUMP_TOOLS_VERSION)_all.deb +KDUMP_TOOLS = kdump-tools_$(KDUMP_TOOLS_VERSION)_$(CONFIGURED_ARCH).deb $(KDUMP_TOOLS)_SRC_PATH = $(SRC_PATH)/kdump-tools SONIC_MAKE_DEBS += $(KDUMP_TOOLS) diff --git a/rules/libyang.mk b/rules/libyang.mk index 181db2368c6d..c8873c3b3231 100644 --- a/rules/libyang.mk +++ b/rules/libyang.mk @@ -29,11 +29,7 @@ LIBYANG_PY3 = python3-yang_$(LIBYANG_VERSION)_$(CONFIGURED_ARCH).deb $(LIBYANG_PY3)_DEPENDS += $(LIBYANG) $(LIBYANG_CPP) $(eval $(call add_derived_package,$(LIBYANG),$(LIBYANG_PY3))) -LIBYANG_PY2 = python2-yang_$(LIBYANG_VERSION)_$(CONFIGURED_ARCH).deb -$(LIBYANG_PY2)_DEPENDS += $(LIBYANG) $(LIBYANG_CPP) -$(eval $(call add_derived_package,$(LIBYANG),$(LIBYANG_PY2))) - $(eval $(call add_conflict_package,$(LIBYANG),$(LIBYANG1))) $(eval $(call add_conflict_package,$(LIBYANG_DEV),$(LIBYANG1_DEV))) -export LIBYANG LIBYANG_DBG LIBYANG_DEV LIBYANG_CPP LIBYANG_PY3 LIBYANG_PY2 +export LIBYANG LIBYANG_DBG LIBYANG_DEV LIBYANG_CPP LIBYANG_PY3 diff --git a/rules/linkmgrd.dep b/rules/linkmgrd.dep new file mode 100644 index 000000000000..31894e46d298 --- /dev/null +++ b/rules/linkmgrd.dep @@ -0,0 +1,11 @@ + +SPATH := $($(SONIC_LINKMGRD)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/linkmgrd.mk rules/linkmgrd.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files)) + +$(SONIC_LINKMGRD)_CACHE_MODE := GIT_CONTENT_SHA +$(SONIC_LINKMGRD)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(SONIC_LINKMGRD)_DEP_FILES := $(DEP_FILES) +$(SONIC_LINKMGRD)_SMDEP_FILES := $(SMDEP_FILES) +$(SONIC_LINKMGRD)_SMDEP_PATHS := $(SPATH) diff --git a/rules/linkmgrd.mk b/rules/linkmgrd.mk new file mode 100644 index 000000000000..07101f0c47fb --- /dev/null +++ b/rules/linkmgrd.mk @@ -0,0 +1,20 @@ +# SONiC LINK ManaGeR Daemon package + +SONIC_LINKMGRD_VERSION = 1.0.0-1 +SONIC_LINKMGRD_PKG_NAME = linkmgrd + +export SONIC_LINKMGRD_VERSION SONIC_LINKMGRD_PKG_NAME + +SONIC_LINKMGRD = sonic-$(SONIC_LINKMGRD_PKG_NAME)_$(SONIC_LINKMGRD_VERSION)_$(CONFIGURED_ARCH).deb +$(SONIC_LINKMGRD)_SRC_PATH = $(SRC_PATH)/$(SONIC_LINKMGRD_PKG_NAME) +$(SONIC_LINKMGRD)_DEPENDS = $(LIBSWSSCOMMON_DEV) $(LIBHIREDIS_DEV) +$(SONIC_LINKMGRD)_RDEPENDS = $(LIBSWSSCOMMON) $(LIBHIREDIS) + +SONIC_DPKG_DEBS += $(SONIC_LINKMGRD) + +SONIC_LINKMGRD_DBG = sonic-$(SONIC_LINKMGRD_PKG_NAME)-dbgsym_$(SONIC_LINKMGRD_VERSION)_$(CONFIGURED_ARCH).deb +$(SONIC_LINKMGRD)_DBG_DEPENDS = $(LIBSWSSCOMMON_DEV) $(LIBHIREDIS_DEV) +$(SONIC_LINKMGRD)_DBG_RDEPENDS = $(LIBSWSSCOMMON_DBG) $(LIBHIREDIS_DBG) +$(eval $(call add_derived_package,$(SONIC_LINKMGRD),$(SONIC_LINKMGRD_DBG))) + +export SONIC_LINKMGRD SONIC_LINKMGRD_DBG diff --git a/rules/linux-kernel.dep b/rules/linux-kernel.dep index 6063ddded9d0..4706f56afbaf 100644 --- a/rules/linux-kernel.dep +++ b/rules/linux-kernel.dep @@ -1,7 +1,6 @@ SPATH := $($(LINUX_HEADERS_COMMON)_SRC_PATH) -DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/linux-kernel.mk rules/linux-kernel.dep -DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES := rules/linux-kernel.mk rules/linux-kernel.dep SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files)) DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) \ diff --git a/rules/linux-kernel.mk b/rules/linux-kernel.mk index 2d369361a9e5..b8fb093dd318 100644 --- a/rules/linux-kernel.mk +++ b/rules/linux-kernel.mk @@ -1,9 +1,9 @@ # linux kernel package -KVERSION_SHORT = 4.19.0-12-2 +KVERSION_SHORT = 5.10.0-8-2 KVERSION = $(KVERSION_SHORT)-$(CONFIGURED_ARCH) -KERNEL_VERSION = 4.19.152 -KERNEL_SUBVERSION = 1 +KERNEL_VERSION = 5.10.46 +KERNEL_SUBVERSION = 4 ifeq ($(CONFIGURED_ARCH), armhf) # Override kernel version for ARMHF as it uses arm MP (multi-platform) for short version KVERSION = $(KVERSION_SHORT)-armmp diff --git a/rules/ntp.mk b/rules/ntp.mk index 13cbb495f78f..52e7db516138 100644 --- a/rules/ntp.mk +++ b/rules/ntp.mk @@ -1,9 +1,9 @@ # ntp package -NTP_VERSION = 4.2.8p12+dfsg +NTP_VERSION = 4.2.8p15+dfsg export NTP_VERSION -NTP = ntp_$(NTP_VERSION)-4+deb10u2_$(CONFIGURED_ARCH).deb +NTP = ntp_$(NTP_VERSION)-1+deb10u2_$(CONFIGURED_ARCH).deb $(NTP)_SRC_PATH = $(SRC_PATH)/ntp SONIC_MAKE_DEBS += $(NTP) SONIC_STRETCH_DEBS += $(NTP) diff --git a/rules/openssh.mk b/rules/openssh.mk index 0cc3de621039..0e4696ed9d27 100644 --- a/rules/openssh.mk +++ b/rules/openssh.mk @@ -1,6 +1,6 @@ # openssh package -OPENSSH_VERSION = 7.9p1-10+deb10u2 +OPENSSH_VERSION = 8.4p1-5 export OPENSSH_VERSION diff --git a/rules/p4rt.dep b/rules/p4rt.dep new file mode 100644 index 000000000000..16a119ed79fe --- /dev/null +++ b/rules/p4rt.dep @@ -0,0 +1,12 @@ +SPATH := $($(SONIC_P4RT)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/p4rt.mk rules/p4rt.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) $(SPATH)/Makefile +SMDEP_PATH := $(SPATH)/sonic-pins +DEP_FILES += $(shell cd $(SPATH) && git ls-files | grep -v ^sonic-pins) +SMDEP_FILES := $(addprefix $(SMDEP_PATH)/,$(shell cd $(SMDEP_PATH) && git ls-files)) + +$(SONIC_P4RT)_CACHE_MODE := GIT_CONTENT_SHA +$(SONIC_P4RT)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(SONIC_P4RT)_DEP_FILES := $(DEP_FILES) +$(SONIC_P4RT)_SMDEP_FILES := $(SMDEP_FILES) +$(SONIC_P4RT)_SMDEP_PATHS := $(SMDEP_PATH) diff --git a/rules/p4rt.mk b/rules/p4rt.mk new file mode 100644 index 000000000000..a402bac002f7 --- /dev/null +++ b/rules/p4rt.mk @@ -0,0 +1,20 @@ +# SONiC P4RT package + +SONIC_P4RT_VERSION = 0.0.1 + +SONIC_P4RT = sonic-p4rt_$(SONIC_P4RT_VERSION)_$(CONFIGURED_ARCH).deb +$(SONIC_P4RT)_SRC_PATH = $(SRC_PATH)/sonic-p4rt +$(SONIC_P4RT)_DEPENDS += $(LIBSWSSCOMMON_DEV) +$(SONIC_P4RT)_RDEPENDS += $(LIBSWSSCOMMON) +SONIC_MAKE_DEBS += $(SONIC_P4RT) + +SONIC_P4RT_DBG = sonic-p4rt-dbgsym_$(SONIC_P4RT_VERSION)_$(CONFIGURED_ARCH).deb +$(SONIC_P4RT_DBG)_DEPENDS += $(SONIC_P4RT) +$(SONIC_P4RT_DBG)_RDEPENDS += $(SONIC_P4RT) +$(eval $(call add_derived_package,$(SONIC_P4RT),$(SONIC_P4RT_DBG))) + +export SONIC_P4RT SONIC_P4RT_DBG SONIC_P4RT_VERSION + +# The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list} +# are archived into debug one image to facilitate debugging. +DBG_SRC_ARCHIVE += sonic-p4rt diff --git a/rules/phy-credo.mk b/rules/phy-credo.mk index 7e9441619139..0218fdf6f691 100644 --- a/rules/phy-credo.mk +++ b/rules/phy-credo.mk @@ -1,3 +1,3 @@ PHY_CREDO = phy-credo_1.0_amd64.deb -$(PHY_CREDO)_URL = "https://github.com/aristanetworks/sonic-firmware/raw/0468f6c23a7219dfee6dd2819013e9f1e940c95d/phy/phy-credo_1.0_amd64.deb" +$(PHY_CREDO)_URL = "https://github.com/aristanetworks/sonic-firmware/raw/d227160f981f27df020ab50b9e0f16b1bd9166ea/phy/phy-credo_1.0_amd64.deb" SONIC_ONLINE_DEBS += $(PHY_CREDO) diff --git a/rules/redis-dump-load-py2.dep b/rules/redis-dump-load-py2.dep index adc43905b7f3..a1293f9fb6be 100644 --- a/rules/redis-dump-load-py2.dep +++ b/rules/redis-dump-load-py2.dep @@ -1,12 +1,12 @@ +ifeq ($(ENABLE_PY2_MODULES), y) + SPATH := $($(REDIS_DUMP_LOAD_PY2)_SRC_PATH) + DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/redis-dump-load-py2.mk rules/redis-dump-load-py2.dep + DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) + SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files)) -SPATH := $($(REDIS_DUMP_LOAD_PY2)_SRC_PATH) -DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/redis-dump-load-py2.mk rules/redis-dump-load-py2.dep -DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) -SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files)) - -$(REDIS_DUMP_LOAD_PY2)_CACHE_MODE := GIT_CONTENT_SHA -$(REDIS_DUMP_LOAD_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) -$(REDIS_DUMP_LOAD_PY2)_DEP_FILES := $(DEP_FILES) -$(REDIS_DUMP_LOAD_PY2)_SMDEP_FILES := $(SMDEP_FILES) -$(REDIS_DUMP_LOAD_PY2)_SMDEP_PATHS := $(SPATH) - + $(REDIS_DUMP_LOAD_PY2)_CACHE_MODE := GIT_CONTENT_SHA + $(REDIS_DUMP_LOAD_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) + $(REDIS_DUMP_LOAD_PY2)_DEP_FILES := $(DEP_FILES) + $(REDIS_DUMP_LOAD_PY2)_SMDEP_FILES := $(SMDEP_FILES) + $(REDIS_DUMP_LOAD_PY2)_SMDEP_PATHS := $(SPATH) +endif diff --git a/rules/redis-dump-load-py2.mk b/rules/redis-dump-load-py2.mk index 5f756caada9c..7330c8027a22 100644 --- a/rules/redis-dump-load-py2.mk +++ b/rules/redis-dump-load-py2.mk @@ -1,6 +1,8 @@ -# redis_dump_load python2 wheel +ifeq ($(ENABLE_PY2_MODULES), y) + # redis_dump_load python2 wheel -REDIS_DUMP_LOAD_PY2 = redis_dump_load-1.1-py2-none-any.whl -$(REDIS_DUMP_LOAD_PY2)_SRC_PATH = $(SRC_PATH)/redis-dump-load -$(REDIS_DUMP_LOAD_PY2)_PYTHON_VERSION = 2 -SONIC_PYTHON_WHEELS += $(REDIS_DUMP_LOAD_PY2) + REDIS_DUMP_LOAD_PY2 = redis_dump_load-1.1-py2-none-any.whl + $(REDIS_DUMP_LOAD_PY2)_SRC_PATH = $(SRC_PATH)/redis-dump-load + $(REDIS_DUMP_LOAD_PY2)_PYTHON_VERSION = 2 + SONIC_PYTHON_WHEELS += $(REDIS_DUMP_LOAD_PY2) +endif diff --git a/rules/redis-dump-load-py3.mk b/rules/redis-dump-load-py3.mk index 875b5e1c8132..fe2b8688e43f 100644 --- a/rules/redis-dump-load-py3.mk +++ b/rules/redis-dump-load-py3.mk @@ -3,7 +3,9 @@ REDIS_DUMP_LOAD_PY3 = redis_dump_load-1.1-py3-none-any.whl $(REDIS_DUMP_LOAD_PY3)_SRC_PATH = $(SRC_PATH)/redis-dump-load $(REDIS_DUMP_LOAD_PY3)_PYTHON_VERSION = 3 -# Synthetic dependency just to avoid race condition -$(REDIS_DUMP_LOAD_PY3)_DEPENDS += $(REDIS_DUMP_LOAD_PY2) +ifeq ($(ENABLE_PY2_MODULES), y) + # Synthetic dependency just to avoid race condition + $(REDIS_DUMP_LOAD_PY3)_DEPENDS += $(REDIS_DUMP_LOAD_PY2) +endif $(REDIS_DUMP_LOAD_PY3)_TEST = n SONIC_PYTHON_WHEELS += $(REDIS_DUMP_LOAD_PY3) diff --git a/rules/scapy.dep b/rules/scapy.dep new file mode 100644 index 000000000000..ef09fb12223b --- /dev/null +++ b/rules/scapy.dep @@ -0,0 +1,10 @@ +SPATH := $($(SCAPY)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/scapy.mk rules/scapy.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files -- ':!:doc/*')) + +$(SCAPY)_CACHE_MODE := GIT_CONTENT_SHA +$(SCAPY)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(SCAPY)_DEP_FILES := $(DEP_FILES) +$(SCAPY)_SMDEP_FILES := $(SMDEP_FILES) +$(SCAPY)_SMDEP_PATHS := $(SPATH) diff --git a/rules/scapy.mk b/rules/scapy.mk new file mode 100644 index 000000000000..6953c1ef10e2 --- /dev/null +++ b/rules/scapy.mk @@ -0,0 +1,7 @@ +# scapy python3 wheel + +SCAPY = scapy-2.4.5-py2.py3-none-any.whl +$(SCAPY)_SRC_PATH = $(SRC_PATH)/scapy +$(SCAPY)_PYTHON_VERSION = 3 +$(SCAPY)_TEST = n +SONIC_PYTHON_WHEELS += $(SCAPY) diff --git a/rules/scripts.dep b/rules/scripts.dep index 929611852ea4..a8921b321a5e 100644 --- a/rules/scripts.dep +++ b/rules/scripts.dep @@ -6,5 +6,6 @@ $(CONFIGDB_LOAD_SCRIPT)_CACHE_MODE := none $(BUFFERS_CONFIG_TEMPLATE)_CACHE_MODE := none $(UPDATE_PROC_VARIABLES_SCRIPT)_CACHE_MODE := none $(QOS_CONFIG_TEMPLATE)_CACHE_MODE := none +$(CBF_CONFIG_TEMPLATE)_CACHE_MODE := none $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)_CACHE_MODE := none $(COPP_CONFIG_TEMPLATE)_CACHE_MODE := none diff --git a/rules/scripts.mk b/rules/scripts.mk index e0694a1cdf9b..ce6a8eb90025 100644 --- a/rules/scripts.mk +++ b/rules/scripts.mk @@ -14,6 +14,9 @@ $(BUFFERS_CONFIG_TEMPLATE)_PATH = files/build_templates QOS_CONFIG_TEMPLATE = qos_config.j2 $(QOS_CONFIG_TEMPLATE)_PATH = files/build_templates +CBF_CONFIG_TEMPLATE = cbf_config.j2 +$(CBF_CONFIG_TEMPLATE)_PATH = files/build_templates + SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT = supervisor-proc-exit-listener $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)_PATH = files/scripts @@ -34,6 +37,7 @@ SONIC_COPY_FILES += $(CONFIGDB_LOAD_SCRIPT) \ $(ARP_UPDATE_VARS_TEMPLATE) \ $(BUFFERS_CONFIG_TEMPLATE) \ $(QOS_CONFIG_TEMPLATE) \ + $(CBF_CONFIG_TEMPLATE) \ $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) \ $(SYSCTL_NET_CONFIG) \ $(UPDATE_CHASSISDB_CONFIG_SCRIPT) \ diff --git a/rules/snmpd.mk b/rules/snmpd.mk index 7922e2097ff0..52be51d1c549 100644 --- a/rules/snmpd.mk +++ b/rules/snmpd.mk @@ -1,7 +1,12 @@ # snmpd package +ifeq ($(BLDENV),bullseye) +SNMPD_VERSION = 5.9+dfsg +SNMPD_VERSION_FULL = $(SNMPD_VERSION)-3+b1 +else SNMPD_VERSION = 5.7.3+dfsg SNMPD_VERSION_FULL = $(SNMPD_VERSION)-5 +endif export SNMPD_VERSION SNMPD_VERSION_FULL @@ -32,11 +37,19 @@ $(eval $(call add_derived_package,$(LIBSNMP_BASE),$(SNMP_DBG))) SNMPD_DBG = snmpd-dbgsym_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb $(eval $(call add_derived_package,$(LIBSNMP_BASE),$(SNMPD_DBG))) +ifeq ($(BLDENV),bullseye) +LIBSNMP = libsnmp40_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb +else LIBSNMP = libsnmp30_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb +endif $(LIBSNMP)_RDEPENDS += $(LIBSNMP_BASE) $(eval $(call add_derived_package,$(LIBSNMP_BASE),$(LIBSNMP))) +ifeq ($(BLDENV),bullseye) +LIBSNMP_DBG = libsnmp40-dbgsym_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb +else LIBSNMP_DBG = libsnmp30-dbg_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb +endif $(LIBSNMP_DBG)_DEPENDS += $(LIBSNMP) $(LIBSNMP_DBG)_RDEPENDS += $(LIBSNMP) $(eval $(call add_derived_package,$(LIBSNMP_BASE),$(LIBSNMP_DBG))) diff --git a/rules/socat.mk b/rules/socat.mk index 3ee5d5d1c314..439e39af9426 100644 --- a/rules/socat.mk +++ b/rules/socat.mk @@ -1,6 +1,6 @@ # socat packages -SOCAT_VERSION = 1.7.3.1-2+deb9u1 +SOCAT_VERSION = 1.7.4.1-3 export SOCAT_VERSION diff --git a/rules/sonic-config.dep b/rules/sonic-config.dep index ae8569326eea..9e6d1e929341 100644 --- a/rules/sonic-config.dep +++ b/rules/sonic-config.dep @@ -1,14 +1,16 @@ # SONIC_CONFIG_ENGINE_PY2 package -SPATH := $($(SONIC_CONFIG_ENGINE_PY2)_SRC_PATH) +SPATH := $($(SONIC_CONFIG_ENGINE_PY3)_SRC_PATH) DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-config.mk rules/sonic-config.dep DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) DEP_FILES += $(shell git ls-files $(SPATH)) -DEP_FILES += files/image_config/interfaces/interfaces.j2 dockers/docker-orchagent/ports.json.j2 dockers/docker-dhcp-relay/wait_for_intf.sh.j2 dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 dockers/docker-lldp/lldpd.conf.j2 dockers/docker-orchagent/ipinip.json.j2 $(wildcard device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/*.j2 device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/*.j2) files/build_templates/qos_config.j2 dockers/docker-orchagent/switch.json.j2 files/image_config/constants/constants.yml +DEP_FILES += files/image_config/interfaces/interfaces.j2 dockers/docker-orchagent/ports.json.j2 dockers/docker-dhcp-relay/wait_for_intf.sh.j2 dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 dockers/docker-lldp/lldpd.conf.j2 dockers/docker-orchagent/ipinip.json.j2 $(wildcard device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/* device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/*) files/build_templates/qos_config.j2 dockers/docker-orchagent/switch.json.j2 dockers/docker-orchagent/vxlan.json.j2 files/image_config/constants/constants.yml -$(SONIC_CONFIG_ENGINE_PY2)_CACHE_MODE := GIT_CONTENT_SHA -$(SONIC_CONFIG_ENGINE_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) -$(SONIC_CONFIG_ENGINE_PY2)_DEP_FILES := $(DEP_FILES) +ifeq ($(ENABLE_PY2_MODULES), y) + $(SONIC_CONFIG_ENGINE_PY2)_CACHE_MODE := GIT_CONTENT_SHA + $(SONIC_CONFIG_ENGINE_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) + $(SONIC_CONFIG_ENGINE_PY2)_DEP_FILES := $(DEP_FILES) +endif # SONIC_CONFIG_ENGINE_PY3 package diff --git a/rules/sonic-config.mk b/rules/sonic-config.mk index 373604e96554..ba146df70577 100644 --- a/rules/sonic-config.mk +++ b/rules/sonic-config.mk @@ -1,11 +1,13 @@ -# SONIC_CONFIG_ENGINE_PY2 package +ifeq ($(ENABLE_PY2_MODULES), y) + # SONIC_CONFIG_ENGINE_PY2 package -SONIC_CONFIG_ENGINE_PY2 = sonic_config_engine-1.0-py2-none-any.whl -$(SONIC_CONFIG_ENGINE_PY2)_SRC_PATH = $(SRC_PATH)/sonic-config-engine -$(SONIC_CONFIG_ENGINE_PY2)_DEPENDS += $(SONIC_PY_COMMON_PY2) -$(SONIC_CONFIG_ENGINE_PY2)_DEBS_DEPENDS += $(PYTHON_SWSSCOMMON) -$(SONIC_CONFIG_ENGINE_PY2)_PYTHON_VERSION = 2 -SONIC_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2) + SONIC_CONFIG_ENGINE_PY2 = sonic_config_engine-1.0-py2-none-any.whl + $(SONIC_CONFIG_ENGINE_PY2)_SRC_PATH = $(SRC_PATH)/sonic-config-engine + $(SONIC_CONFIG_ENGINE_PY2)_DEPENDS += $(SONIC_PY_COMMON_PY2) + $(SONIC_CONFIG_ENGINE_PY2)_DEBS_DEPENDS += $(PYTHON_SWSSCOMMON) + $(SONIC_CONFIG_ENGINE_PY2)_PYTHON_VERSION = 2 + SONIC_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2) +endif # SONIC_CONFIG_ENGINE_PY3 package @@ -18,8 +20,10 @@ $(SONIC_CONFIG_ENGINE_PY3)_DEBS_DEPENDS += $(LIBYANG) \ $(LIBYANG_CPP) \ $(LIBYANG_PY3) \ $(PYTHON3_SWSSCOMMON) -# Synthetic dependency to avoid building the Python 2 and 3 packages -# simultaneously and any potential conflicts which may arise -$(SONIC_CONFIG_ENGINE_PY3)_DEPENDS += $(SONIC_CONFIG_ENGINE_PY2) +ifeq ($(ENABLE_PY2_MODULES), y) + # Synthetic dependency to avoid building the Python 2 and 3 packages + # simultaneously and any potential conflicts which may arise + $(SONIC_CONFIG_ENGINE_PY3)_DEPENDS += $(SONIC_CONFIG_ENGINE_PY2) +endif $(SONIC_CONFIG_ENGINE_PY3)_PYTHON_VERSION = 3 SONIC_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY3) diff --git a/rules/sonic-platform-common.dep b/rules/sonic-platform-common.dep index e921c4df01af..632c92c1ac78 100644 --- a/rules/sonic-platform-common.dep +++ b/rules/sonic-platform-common.dep @@ -1,15 +1,16 @@ -SPATH := $($(SONIC_PLATFORM_COMMON_PY2)_SRC_PATH) +SPATH := $($(SONIC_PLATFORM_COMMON_PY3)_SRC_PATH) DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-platform-common.mk rules/sonic-platform-common.dep DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files|grep -Ev "^sonic_sfp|^sonic_eeprom")) -$(SONIC_PLATFORM_COMMON_PY2)_CACHE_MODE := GIT_CONTENT_SHA -$(SONIC_PLATFORM_COMMON_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) -$(SONIC_PLATFORM_COMMON_PY2)_DEP_FILES := $(DEP_FILES) -$(SONIC_PLATFORM_COMMON_PY2)_SMDEP_FILES := $(SMDEP_FILES) -$(SONIC_PLATFORM_COMMON_PY2)_SMDEP_PATHS := $(SPATH) - +ifeq ($(ENABLE_PY2_MODULES), y) + $(SONIC_PLATFORM_COMMON_PY2)_CACHE_MODE := GIT_CONTENT_SHA + $(SONIC_PLATFORM_COMMON_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) + $(SONIC_PLATFORM_COMMON_PY2)_DEP_FILES := $(DEP_FILES) + $(SONIC_PLATFORM_COMMON_PY2)_SMDEP_FILES := $(SMDEP_FILES) + $(SONIC_PLATFORM_COMMON_PY2)_SMDEP_PATHS := $(SPATH) +endif $(SONIC_PLATFORM_COMMON_PY3)_CACHE_MODE := GIT_CONTENT_SHA diff --git a/rules/sonic-platform-common.mk b/rules/sonic-platform-common.mk index 25ab5ff839fa..09ce14faab15 100644 --- a/rules/sonic-platform-common.mk +++ b/rules/sonic-platform-common.mk @@ -1,11 +1,13 @@ -# sonic-platform-common package +ifeq ($(ENABLE_PY2_MODULES), y) + # sonic-platform-common package -SONIC_PLATFORM_COMMON_PY2 = sonic_platform_common-1.0-py2-none-any.whl -$(SONIC_PLATFORM_COMMON_PY2)_SRC_PATH = $(SRC_PATH)/sonic-platform-common -$(SONIC_PLATFORM_COMMON_PY2)_PYTHON_VERSION = 2 -$(SONIC_PLATFORM_COMMON_PY2)_DEPENDS += $(SONIC_PY_COMMON_PY2) $(SONIC_CONFIG_ENGINE_PY2) -$(SONIC_PLATFORM_COMMON_PY2)_DEBS_DEPENDS += $(PYTHON_SWSSCOMMON) -SONIC_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY2) + SONIC_PLATFORM_COMMON_PY2 = sonic_platform_common-1.0-py2-none-any.whl + $(SONIC_PLATFORM_COMMON_PY2)_SRC_PATH = $(SRC_PATH)/sonic-platform-common + $(SONIC_PLATFORM_COMMON_PY2)_PYTHON_VERSION = 2 + $(SONIC_PLATFORM_COMMON_PY2)_DEPENDS += $(SONIC_PY_COMMON_PY2) $(SONIC_CONFIG_ENGINE_PY2) + $(SONIC_PLATFORM_COMMON_PY2)_DEBS_DEPENDS += $(PYTHON_SWSSCOMMON) + SONIC_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY2) +endif # Als build sonic-platform-common into python3 wheel, so we can use PSU code in SNMP docker SONIC_PLATFORM_COMMON_PY3 = sonic_platform_common-1.0-py3-none-any.whl @@ -13,6 +15,8 @@ $(SONIC_PLATFORM_COMMON_PY3)_SRC_PATH = $(SRC_PATH)/sonic-platform-common $(SONIC_PLATFORM_COMMON_PY3)_PYTHON_VERSION = 3 $(SONIC_PLATFORM_COMMON_PY3)_DEPENDS += $(SONIC_PY_COMMON_PY3) $(SONIC_CONFIG_ENGINE_PY3) $(SONIC_PLATFORM_COMMON_PY3)_DEBS_DEPENDS += $(PYTHON3_SWSSCOMMON) -# Synthetic dependency just to avoid race condition -$(SONIC_PLATFORM_COMMON_PY3)_DEPENDS += $(SONIC_PLATFORM_COMMON_PY2) +ifeq ($(ENABLE_PY2_MODULES), y) + # Synthetic dependency just to avoid race condition + $(SONIC_PLATFORM_COMMON_PY3)_DEPENDS += $(SONIC_PLATFORM_COMMON_PY2) +endif SONIC_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY3) diff --git a/rules/sonic-py-common.dep b/rules/sonic-py-common.dep index 9ecedb068a4f..b3d08c5d8632 100644 --- a/rules/sonic-py-common.dep +++ b/rules/sonic-py-common.dep @@ -1,11 +1,13 @@ -SPATH := $($(SONIC_PY_COMMON_PY2)_SRC_PATH) +SPATH := $($(SONIC_PY_COMMON_PY3)_SRC_PATH) DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-py-common.mk rules/sonic-py-common.dep DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) DEP_FILES += $(shell git ls-files $(SPATH)) -$(SONIC_PY_COMMON_PY2)_CACHE_MODE := GIT_CONTENT_SHA -$(SONIC_PY_COMMON_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) -$(SONIC_PY_COMMON_PY2)_DEP_FILES := $(DEP_FILES) +ifeq ($(ENABLE_PY2_MODULES), y) + $(SONIC_PY_COMMON_PY2)_CACHE_MODE := GIT_CONTENT_SHA + $(SONIC_PY_COMMON_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) + $(SONIC_PY_COMMON_PY2)_DEP_FILES := $(DEP_FILES) +endif $(SONIC_PY_COMMON_PY3)_CACHE_MODE := GIT_CONTENT_SHA $(SONIC_PY_COMMON_PY3)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) diff --git a/rules/sonic-py-common.mk b/rules/sonic-py-common.mk index 6afe9a826c68..be5f5d8e696a 100644 --- a/rules/sonic-py-common.mk +++ b/rules/sonic-py-common.mk @@ -1,18 +1,22 @@ -# SONIC_PY_COMMON_PY2 package +ifeq ($(ENABLE_PY2_MODULES), y) + # SONIC_PY_COMMON_PY2 package -SONIC_PY_COMMON_PY2 = sonic_py_common-1.0-py2-none-any.whl -$(SONIC_PY_COMMON_PY2)_SRC_PATH = $(SRC_PATH)/sonic-py-common -$(SONIC_PY_COMMON_PY2)_DEPENDS += $(SWSSSDK_PY2) -$(SONIC_PY_COMMON_PY2)_PYTHON_VERSION = 2 -SONIC_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY2) + SONIC_PY_COMMON_PY2 = sonic_py_common-1.0-py2-none-any.whl + $(SONIC_PY_COMMON_PY2)_SRC_PATH = $(SRC_PATH)/sonic-py-common + $(SONIC_PY_COMMON_PY2)_DEPENDS += $(SWSSSDK_PY2) + $(SONIC_PY_COMMON_PY2)_PYTHON_VERSION = 2 + SONIC_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY2) +endif # SONIC_PY_COMMON_PY3 package SONIC_PY_COMMON_PY3 = sonic_py_common-1.0-py3-none-any.whl $(SONIC_PY_COMMON_PY3)_SRC_PATH = $(SRC_PATH)/sonic-py-common $(SONIC_PY_COMMON_PY3)_DEPENDS += $(SWSSSDK_PY3) -# Synthetic dependency to avoid building the Python 2 and 3 packages -# simultaneously and any potential conflicts which may arise -$(SONIC_PY_COMMON_PY3)_DEPENDS += $(SONIC_PY_COMMON_PY2) +ifeq ($(ENABLE_PY2_MODULES), y) + # Synthetic dependency to avoid building the Python 2 and 3 packages + # simultaneously and any potential conflicts which may arise + $(SONIC_PY_COMMON_PY3)_DEPENDS += $(SONIC_PY_COMMON_PY2) +endif $(SONIC_PY_COMMON_PY3)_PYTHON_VERSION = 3 SONIC_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY3) diff --git a/rules/sonic-yang-models-py3.mk b/rules/sonic-yang-models-py3.mk index 8c11a921a979..f5a606c28c3a 100644 --- a/rules/sonic-yang-models-py3.mk +++ b/rules/sonic-yang-models-py3.mk @@ -2,7 +2,7 @@ SONIC_YANG_MODELS_PY3 = sonic_yang_models-1.0-py3-none-any.whl $(SONIC_YANG_MODELS_PY3)_SRC_PATH = $(SRC_PATH)/sonic-yang-models $(SONIC_YANG_MODELS_PY3)_PYTHON_VERSION = 3 $(SONIC_YANG_MODELS_PY3)_DEBS_DEPENDS = $(LIBYANG) $(LIBYANG_CPP) \ - $(LIBYANG_PY2) $(LIBYANG_PY3) + $(LIBYANG_PY3) SONIC_PYTHON_WHEELS += $(SONIC_YANG_MODELS_PY3) export SONIC_YANG_MODELS_PY3 diff --git a/rules/sonic-ycabled.dep b/rules/sonic-ycabled.dep new file mode 100644 index 000000000000..b7eed99e8a59 --- /dev/null +++ b/rules/sonic-ycabled.dep @@ -0,0 +1,10 @@ +SPATH := $($(SONIC_YCABLED_PY3)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-ycabled.mk rules/sonic-ycabled.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files)) + +$(SONIC_YCABLED_PY3)_CACHE_MODE := GIT_CONTENT_SHA +$(SONIC_YCABLED_PY3)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(SONIC_YCABLED_PY3)_DEP_FILES := $(DEP_FILES) +$(SONIC_YCABLED_PY3)_SMDEP_FILES := $(SMDEP_FILES) +$(SONIC_YCABLED_PY3)_SMDEP_PATHS := $(SPATH) diff --git a/rules/sonic-ycabled.mk b/rules/sonic-ycabled.mk new file mode 100644 index 000000000000..ba3531d2db7d --- /dev/null +++ b/rules/sonic-ycabled.mk @@ -0,0 +1,10 @@ +# sonic-ycabled (SONiC Y-Cable daemon) Debian package + +# SONIC_YCABLED_PY3 package + +SONIC_YCABLED_PY3 = sonic_ycabled-1.0-py3-none-any.whl +$(SONIC_YCABLED_PY3)_SRC_PATH = $(SRC_PATH)/sonic-platform-daemons/sonic-ycabled +$(SONIC_YCABLED_PY3)_DEPENDS = $(SONIC_PY_COMMON_PY3) $(SONIC_PLATFORM_COMMON_PY3) +$(SONIC_YCABLED_PY3)_DEBS_DEPENDS = $(LIBSWSSCOMMON) $(PYTHON3_SWSSCOMMON) +$(SONIC_YCABLED_PY3)_PYTHON_VERSION = 3 +SONIC_PYTHON_WHEELS += $(SONIC_YCABLED_PY3) diff --git a/rules/swss-common.mk b/rules/swss-common.mk index 09dc312277fe..bbc37a8d632f 100644 --- a/rules/swss-common.mk +++ b/rules/swss-common.mk @@ -17,8 +17,12 @@ SONIC_DPKG_DEBS += $(LIBSWSSCOMMON) LIBSWSSCOMMON_DEV = $(LIBSWSSCOMMON_NAME)-dev_$(LIBSWSSCOMMON_VERSION)_$(CONFIGURED_ARCH).deb $(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(LIBSWSSCOMMON_DEV))) -PYTHON_SWSSCOMMON = python-swsscommon_$(LIBSWSSCOMMON_VERSION)_$(CONFIGURED_ARCH).deb -$(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(PYTHON_SWSSCOMMON))) +ifeq ($(ENABLE_PY2_MODULES), y) + PYTHON_SWSSCOMMON = python-swsscommon_$(LIBSWSSCOMMON_VERSION)_$(CONFIGURED_ARCH).deb + $(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(PYTHON_SWSSCOMMON))) +else + $(LIBSWSSCOMMON)_BUILD_ENV += DEB_BUILD_PROFILES=nopython2 +endif PYTHON3_SWSSCOMMON = python3-swsscommon_$(LIBSWSSCOMMON_VERSION)_$(CONFIGURED_ARCH).deb $(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(PYTHON3_SWSSCOMMON))) diff --git a/rules/swsssdk-py2.dep b/rules/swsssdk-py2.dep index 2be9565fedcc..300d3cdeb027 100644 --- a/rules/swsssdk-py2.dep +++ b/rules/swsssdk-py2.dep @@ -1,12 +1,12 @@ +ifeq ($(ENABLE_PY2_MODULES), y) + SPATH := $($(SWSSSDK_PY2)_SRC_PATH) + DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/swsssdk-py2.mk rules/swsssdk-py2.dep + DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) + SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files)) -SPATH := $($(SWSSSDK_PY2)_SRC_PATH) -DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/swsssdk-py2.mk rules/swsssdk-py2.dep -DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) -SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files)) - -$(SWSSSDK_PY2)_CACHE_MODE := GIT_CONTENT_SHA -$(SWSSSDK_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) -$(SWSSSDK_PY2)_DEP_FILES := $(DEP_FILES) -$(SWSSSDK_PY2)_SMDEP_FILES := $(SMDEP_FILES) -$(SWSSSDK_PY2)_SMDEP_PATHS := $(SPATH) - + $(SWSSSDK_PY2)_CACHE_MODE := GIT_CONTENT_SHA + $(SWSSSDK_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) + $(SWSSSDK_PY2)_DEP_FILES := $(DEP_FILES) + $(SWSSSDK_PY2)_SMDEP_FILES := $(SMDEP_FILES) + $(SWSSSDK_PY2)_SMDEP_PATHS := $(SPATH) +endif diff --git a/rules/swsssdk-py2.mk b/rules/swsssdk-py2.mk index 8a98d1feda0a..7a7a1cd870f0 100644 --- a/rules/swsssdk-py2.mk +++ b/rules/swsssdk-py2.mk @@ -1,7 +1,9 @@ -# swsssdk python2 wheel +ifeq ($(ENABLE_PY2_MODULES), y) + # swsssdk python2 wheel -SWSSSDK_PY2 = swsssdk-2.0.1-py2-none-any.whl -$(SWSSSDK_PY2)_SRC_PATH = $(SRC_PATH)/sonic-py-swsssdk -$(SWSSSDK_PY2)_PYTHON_VERSION = 2 -$(SWSSSDK_PY2)_DEPENDS += $(REDIS_DUMP_LOAD_PY2) -SONIC_PYTHON_WHEELS += $(SWSSSDK_PY2) + SWSSSDK_PY2 = swsssdk-2.0.1-py2-none-any.whl + $(SWSSSDK_PY2)_SRC_PATH = $(SRC_PATH)/sonic-py-swsssdk + $(SWSSSDK_PY2)_PYTHON_VERSION = 2 + $(SWSSSDK_PY2)_DEPENDS += $(REDIS_DUMP_LOAD_PY2) + SONIC_PYTHON_WHEELS += $(SWSSSDK_PY2) +endif diff --git a/rules/swsssdk-py3.mk b/rules/swsssdk-py3.mk index 681ba72f85b7..4e42652211aa 100644 --- a/rules/swsssdk-py3.mk +++ b/rules/swsssdk-py3.mk @@ -3,6 +3,9 @@ SWSSSDK_PY3 = swsssdk-2.0.1-py3-none-any.whl $(SWSSSDK_PY3)_SRC_PATH = $(SRC_PATH)/sonic-py-swsssdk $(SWSSSDK_PY3)_PYTHON_VERSION = 3 -# Synthetic dependency just to avoid race condition -$(SWSSSDK_PY3)_DEPENDS += $(SWSSSDK_PY2) $(REDIS_DUMP_LOAD_PY3) +$(SWSSSDK_PY3)_DEPENDS += $(REDIS_DUMP_LOAD_PY3) +ifeq ($(ENABLE_PY2_MODULES), y) + # Synthetic dependency just to avoid race condition + $(SWSSSDK_PY3)_DEPENDS += $(SWSSSDK_PY2) +endif SONIC_PYTHON_WHEELS += $(SWSSSDK_PY3) diff --git a/rules/system-health.mk b/rules/system-health.mk index 00cd48858d32..2d1012fe1843 100644 --- a/rules/system-health.mk +++ b/rules/system-health.mk @@ -4,6 +4,7 @@ SYSTEM_HEALTH = system_health-1.0-py3-none-any.whl $(SYSTEM_HEALTH)_SRC_PATH = $(SRC_PATH)/system-health $(SYSTEM_HEALTH)_PYTHON_VERSION = 3 $(SYSTEM_HEALTH)_DEPENDS = $(SONIC_PY_COMMON_PY3) $(SONIC_CONFIG_ENGINE_PY3) +$(SYSTEM_HEALTH)_DEBS_DEPENDS = $(LIBSWSSCOMMON) $(PYTHON3_SWSSCOMMON) SONIC_PYTHON_WHEELS += $(SYSTEM_HEALTH) export system_health_py3_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SYSTEM_HEALTH))" diff --git a/rules/tacacs.dep b/rules/tacacs.dep index 29de9262f557..f7e807f9c47c 100644 --- a/rules/tacacs.dep +++ b/rules/tacacs.dep @@ -21,3 +21,15 @@ $(LIBNSS_TACPLUS)_CACHE_MODE := GIT_CONTENT_SHA $(LIBNSS_TACPLUS)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) $(LIBNSS_TACPLUS)_DEP_FILES := $(DEP_FILES) + + + +SPATH := $($(BASH_TACPLUS)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/tacacs.mk rules/tacacs.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(SPATH)) + +$(BASH_TACPLUS)_CACHE_MODE := GIT_CONTENT_SHA +$(BASH_TACPLUS)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(BASH_TACPLUS)_DEP_FILES := $(DEP_FILES) + diff --git a/rules/tacacs.mk b/rules/tacacs.mk index 1c620ebcedc5..06c2c497a5ea 100644 --- a/rules/tacacs.mk +++ b/rules/tacacs.mk @@ -16,8 +16,6 @@ LIBTAC_DEV = libtac-dev_$(PAM_TACPLUS_VERSION)_$(CONFIGURED_ARCH).deb $(LIBTAC_DEV)_DEPENDS += $(LIBTAC2) $(eval $(call add_derived_package,$(LIBTAC2),$(LIBTAC_DEV))) - - # libnss-tacplus packages NSS_TACPLUS_VERSION = 1.0.4-1 @@ -29,6 +27,28 @@ $(LIBNSS_TACPLUS)_RDEPENDS += $(LIBTAC2) $(LIBNSS_TACPLUS)_SRC_PATH = $(SRC_PATH)/tacacs/nss SONIC_MAKE_DEBS += $(LIBNSS_TACPLUS) +# audisp-tacplus packages +AUDISP_TACPLUS_VERSION = 1.0.2 + +export AUDISP_TACPLUS_VERSION + +AUDISP_TACPLUS = audisp-tacplus_$(AUDISP_TACPLUS_VERSION)_$(CONFIGURED_ARCH).deb +$(AUDISP_TACPLUS)_DEPENDS += $(LIBTAC_DEV) +$(AUDISP_TACPLUS)_RDEPENDS += $(LIBTAC2) +$(AUDISP_TACPLUS)_SRC_PATH = $(SRC_PATH)/tacacs/audisp +SONIC_MAKE_DEBS += $(AUDISP_TACPLUS) + +# bash-tacplus packages +BASH_TACPLUS_VERSION = 1.0.0 + +export BASH_TACPLUS_VERSION + +BASH_TACPLUS = bash-tacplus_$(BASH_TACPLUS_VERSION)_$(CONFIGURED_ARCH).deb +$(BASH_TACPLUS)_DEPENDS += $(LIBTAC_DEV) +$(BASH_TACPLUS)_RDEPENDS += $(LIBTAC2) +$(BASH_TACPLUS)_SRC_PATH = $(SRC_PATH)/tacacs/bash_tacplus +SONIC_DPKG_DEBS += $(BASH_TACPLUS) + # The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list} # are archived into debug one image to facilitate debugging. # diff --git a/rules/thrift_0_13_0.dep b/rules/thrift_0_13_0.dep deleted file mode 100644 index 52d8b6a525f9..000000000000 --- a/rules/thrift_0_13_0.dep +++ /dev/null @@ -1,8 +0,0 @@ -SPATH := $($(LIBTHRIFT_0_13_0)_SRC_PATH) -DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/thrift_0_13_0.mk rules/thrift_0_13_0.dep -DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) -DEP_FILES += $(shell git ls-files $(SPATH)) - -$(LIBTHRIFT_0_13_0)_CACHE_MODE := GIT_CONTENT_SHA -$(LIBTHRIFT_0_13_0)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) -$(LIBTHRIFT_0_13_0)_DEP_FILES := $(DEP_FILES) diff --git a/rules/thrift_0_13_0.mk b/rules/thrift_0_13_0.mk deleted file mode 100644 index 9da97849809f..000000000000 --- a/rules/thrift_0_13_0.mk +++ /dev/null @@ -1,17 +0,0 @@ -# thrift package - -THRIFT_VERSION_0_13_0 = 0.13.0 -THRIFT_VERSION_0_13_0_FULL = $(THRIFT_VERSION_0_13_0)-6 - -LIBTHRIFT_0_13_0 = libthrift-$(THRIFT_VERSION_0_13_0)_$(THRIFT_VERSION_0_13_0_FULL)_$(CONFIGURED_ARCH).deb -$(LIBTHRIFT_0_13_0)_SRC_PATH = $(SRC_PATH)/thrift_0_13_0 -SONIC_MAKE_DEBS += $(LIBTHRIFT_0_13_0) - -LIBTHRIFT_DEV_0_13_0 = libthrift-dev_$(THRIFT_VERSION_0_13_0_FULL)_$(CONFIGURED_ARCH).deb -$(eval $(call add_derived_package,$(LIBTHRIFT_0_13_0),$(LIBTHRIFT_DEV_0_13_0))) - -PYTHON3_THRIFT_0_13_0 = python3-thrift_$(THRIFT_VERSION_0_13_0_FULL)_$(CONFIGURED_ARCH).deb -$(eval $(call add_derived_package,$(LIBTHRIFT_0_13_0),$(PYTHON_THRIFT_0_13_0))) - -THRIFT_COMPILER_0_13_0 = thrift-compiler_$(THRIFT_VERSION_0_13_0_FULL)_$(CONFIGURED_ARCH).deb -$(eval $(call add_derived_package,$(LIBTHRIFT_0_13_0),$(THRIFT_COMPILER_0_13_0))) diff --git a/rules/thrift_0_14_1.dep b/rules/thrift_0_14_1.dep new file mode 100644 index 000000000000..2fb1ba5666ac --- /dev/null +++ b/rules/thrift_0_14_1.dep @@ -0,0 +1,8 @@ +SPATH := $($(LIBTHRIFT_0_14_1)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/thrift_0_14_1.mk rules/thrift_0_14_1.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(SPATH)) + +$(LIBTHRIFT_0_14_1)_CACHE_MODE := GIT_CONTENT_SHA +$(LIBTHRIFT_0_14_1)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(LIBTHRIFT_0_14_1)_DEP_FILES := $(DEP_FILES) diff --git a/rules/thrift_0_14_1.mk b/rules/thrift_0_14_1.mk new file mode 100644 index 000000000000..b986e0a4dceb --- /dev/null +++ b/rules/thrift_0_14_1.mk @@ -0,0 +1,20 @@ +# thrift package + +THRIFT_0_14_1_VERSION = 0.14.1 +THRIFT_0_14_1_VERSION_FULL = $(THRIFT_0_14_1_VERSION) + +LIBTHRIFT_0_14_1 = libthrift0_$(THRIFT_0_14_1_VERSION)_$(CONFIGURED_ARCH).deb +$(LIBTHRIFT_0_14_1)_SRC_PATH = $(SRC_PATH)/thrift_0_14_1/thrift +SONIC_DPKG_DEBS += $(LIBTHRIFT_0_14_1) + +LIBTHRIFT_0_14_1_DEV = libthrift-dev_$(THRIFT_0_14_1_VERSION)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(LIBTHRIFT_0_14_1),$(LIBTHRIFT_0_14_1_DEV))) + +PYTHON3_THRIFT_0_14_1 = python3-thrift_$(THRIFT_0_14_1_VERSION)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(LIBTHRIFT_0_14_1),$(PYTHON3_THRIFT_0_14_1))) + +PYTHON_THRIFT_0_14_1 = python-thrift_$(THRIFT_0_14_1_VERSION)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(LIBTHRIFT_0_14_1),$(PYTHON_THRIFT_0_14_1))) + +THRIFT_0_14_1_COMPILER = thrift-compiler_$(THRIFT_0_14_1_VERSION)_$(CONFIGURED_ARCH).deb +$(eval $(call add_derived_package,$(LIBTHRIFT_0_14_1),$(THRIFT_0_14_1_COMPILER))) diff --git a/scripts/build_debian_base_system.sh b/scripts/build_debian_base_system.sh index 63eb7555fe36..72e3779ff3e2 100755 --- a/scripts/build_debian_base_system.sh +++ b/scripts/build_debian_base_system.sh @@ -13,6 +13,9 @@ TARGET=$TARGET_PATH TARGET_BASEIMAGE_PATH=$TARGET/versions/host-base-image mkdir -p $TARGET_BASEIMAGE_PATH +alias urlencode='python3 -c "import sys, urllib.parse as ul; print (ul.quote_plus(sys.argv[1]))"' +shopt -s expand_aliases + generate_version_file() { sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "dpkg-query -W -f '\${Package}==\${Version}\n'" > $TARGET_BASEIMAGE_PATH/versions-deb-${IMAGE_DISTRO}-${CONFIGURED_ARCH} @@ -20,12 +23,16 @@ generate_version_file() if [ "$ENABLE_VERSION_CONTROL_DEB" != "y" ]; then if [[ $CONFIGURED_ARCH == armhf || $CONFIGURED_ARCH == arm64 ]]; then - if [ $MULTIARCH_QEMU_ENVIRON == y ]; then + if [ $MULTIARCH_QEMU_ENVIRON == "y" ]; then # qemu arm bin executable for cross-building sudo mkdir -p $FILESYSTEM_ROOT/usr/bin sudo cp /usr/bin/qemu*static $FILESYSTEM_ROOT/usr/bin || true fi - sudo http_proxy=$HTTP_PROXY SKIP_BUILD_HOOK=y debootstrap --variant=minbase --arch $CONFIGURED_ARCH $IMAGE_DISTRO $FILESYSTEM_ROOT http://deb.debian.org/debian + sudo http_proxy=$HTTP_PROXY SKIP_BUILD_HOOK=y debootstrap --foreign --variant=minbase --arch $CONFIGURED_ARCH $IMAGE_DISTRO $FILESYSTEM_ROOT http://deb.debian.org/debian + sudo rm $FILESYSTEM_ROOT/proc -rf + sudo mkdir $FILESYSTEM_ROOT/proc + sudo mount -t proc proc $FILESYSTEM_ROOT/proc + sudo LANG=C chroot $FILESYSTEM_ROOT /debootstrap/debootstrap --second-stage else sudo http_proxy=$HTTP_PROXY SKIP_BUILD_HOOK=y debootstrap --variant=minbase --arch $CONFIGURED_ARCH $IMAGE_DISTRO $FILESYSTEM_ROOT http://debian-archive.trafficmanager.net/debian fi @@ -54,7 +61,7 @@ rm -rf $BASEIMAGE_TARBALLPATH $BASEIMAGE_TARBALL ARCHIEVES=$BASEIMAGE_TARBALLPATH/var/cache/apt/archives APTLIST=$BASEIMAGE_TARBALLPATH/var/lib/apt/lists TARGET_DEBOOTSTRAP=$BASEIMAGE_TARBALLPATH/debootstrap -APTDEBIAN="$APTLIST/deb.debian.org_debian_dists_buster_main_binary-${CONFIGURED_ARCH}_Packages" +APTDEBIAN="$APTLIST/deb.debian.org_debian_dists_${DISTRO}_main_binary-${CONFIGURED_ARCH}_Packages" DEBPATHS=$TARGET_DEBOOTSTRAP/debpaths DEBOOTSTRAP_BASE=$TARGET_DEBOOTSTRAP/base DEBOOTSTRAP_REQUIRED=$TARGET_DEBOOTSTRAP/required @@ -70,13 +77,14 @@ for ((i=0;i&1 exit 1 fi filename=$(basename "$url") - SKIP_BUILD_HOOK=y wget $url -P $ARCHIEVES + SKIP_BUILD_HOOK=y wget $url -O $ARCHIEVES/$filename echo $packagename >> $DEBOOTSTRAP_REQUIRED echo "$packagename /var/cache/apt/archives/$filename" >> $DEBPATHS done diff --git a/scripts/build_kvm_image.sh b/scripts/build_kvm_image.sh index 06bb87509185..6e5fd7dec742 100755 --- a/scripts/build_kvm_image.sh +++ b/scripts/build_kvm_image.sh @@ -4,7 +4,7 @@ # # SPDX-License-Identifier: GPL-2.0 -MEM=3072 +MEM=8192 DISK=$1 ONIE_RECOVERY_ISO=$2 INSTALLER=$3 @@ -59,7 +59,11 @@ free -m if [[ "$vs_build_prepare_mem" == "yes" ]]; then # Force o.s. to drop cache and compact memory so that KVM can get 2G memory bash -c 'echo 1 > /proc/sys/vm/drop_caches' - bash -c 'echo 1 > /proc/sys/vm/compact_memory' + # Not all kernels support compact_memory + if [[ -w '/proc/sys/vm/compact_memory' ]] + then + bash -c 'echo 1 > /proc/sys/vm/compact_memory' + fi free -m fi @@ -67,6 +71,8 @@ kvm_log=$(mktemp) trap on_exit EXIT trap on_error ERR +echo "Installing SONiC" + /usr/bin/kvm -m $MEM \ -name "onie" \ -boot "order=cd,once=d" -cdrom "$ONIE_RECOVERY_ISO" \ @@ -90,6 +96,34 @@ sleep 2.0 echo "to kill kvm: sudo kill $kvm_pid" +./install_sonic.py + +kill $kvm_pid + +echo "Booting up SONiC" + +/usr/bin/kvm -m $MEM \ + -name "onie" \ + -device e1000,netdev=onienet \ + -netdev user,id=onienet,hostfwd=:0.0.0.0:3041-:22 \ + -vnc 0.0.0.0:0 \ + -vga std \ + -snapshot \ + -drive file=$DISK,media=disk,if=virtio,index=0 \ + -serial telnet:127.0.0.1:$KVM_PORT,server > $kvm_log 2>&1 & + +kvm_pid=$! + +sleep 2.0 + +[ -d "/proc/$kvm_pid" ] || { + echo "ERROR: kvm died." + cat $kvm_log + exit 1 +} + +echo "to kill kvm: sudo kill $kvm_pid" + ./check_install.py -u $SONIC_USERNAME -P $PASSWD -p $KVM_PORT kill $kvm_pid diff --git a/scripts/docker_version_control.sh b/scripts/docker_version_control.sh index 595477c859c6..e94370d0e2d9 100755 --- a/scripts/docker_version_control.sh +++ b/scripts/docker_version_control.sh @@ -16,16 +16,18 @@ mkdir -p target/versions/default . src/sonic-build-hooks/buildinfo/config/buildinfo.config image_tag=`grep "^FROM " $DOCKERFILE | awk '{print$2}'` +image_tag_noprefix=$image_tag +[ -n "$DEFAULT_CONTAINER_REGISTRY" ] && image_tag_noprefix=$(echo $image_tag | sed "s#$DEFAULT_CONTAINER_REGISTRY##") image=`echo $image_tag | cut -f1 -d:` tag=`echo $image_tag | cut -f2 -d:` if [[ ",$SONIC_VERSION_CONTROL_COMPONENTS," == *,all,* ]] || [[ ",$SONIC_VERSION_CONTROL_COMPONENTS," == *,docker,* ]]; then # if docker image not in white list, exit - if [[ "$image_tag" != */debian:* ]] && [[ "$image_tag" != multiarch/debian-debootstrap:* ]];then + if [[ "$image_tag" != */debian:* ]] && [[ "$image_tag" != debian:* ]] && [[ "$image_tag" != multiarch/debian-debootstrap:* ]];then exit 0 fi if [ -f $version_file ];then - hash_value=`grep "${ARCH}:${image_tag}" $version_file | awk -F== '{print$2}'` + hash_value=`grep "${ARCH}:${image_tag_noprefix}" $version_file | awk -F== '{print$2}'` fi if [ -z $hash_value ];then hash_value=unknown @@ -38,10 +40,10 @@ if [[ ",$SONIC_VERSION_CONTROL_COMPONENTS," == *,all,* ]] || [[ ",$SONIC_VERSION sed -i "s/$oldimage/$newimage/" $DOCKERFILE else hash_value=`docker pull $image_tag 2> ${new_version_file}.log | grep Digest | awk '{print$2}'` - if [ -z hash_value ];then + if [ -z "$hash_value" ];then hash_value=unknown fi fi if [[ "$hash_value" != "unknown" ]];then - echo -e "${ARCH}:${image_tag}==$hash_value" >> $new_version_file + echo -e "${ARCH}:${image_tag_noprefix}==$hash_value" >> $new_version_file fi diff --git a/scripts/prepare_slave_container_buildinfo.sh b/scripts/prepare_slave_container_buildinfo.sh index be6fe078bdfb..1fb2f006640b 100755 --- a/scripts/prepare_slave_container_buildinfo.sh +++ b/scripts/prepare_slave_container_buildinfo.sh @@ -14,6 +14,10 @@ symlink_build_hooks cp -rf $SLAVE_DIR/buildinfo/* /usr/local/share/buildinfo/ . /usr/local/share/buildinfo/scripts/buildinfo_base.sh +# Enable reproducible mirrors +set_reproducible_mirrors +apt-get update > /dev/null 2>&1 + # Build the slave version config [ -d /usr/local/share/buildinfo/versions ] && rm -rf /usr/local/share/buildinfo/versions scripts/versions_manager.py generate -t "/usr/local/share/buildinfo/versions" -n "build-${SLAVE_DIR}" -d "$DISTRO" -a "$ARCH" diff --git a/scripts/versions_manager.py b/scripts/versions_manager.py index 3a46aaafe229..a20684e97bb4 100755 --- a/scripts/versions_manager.py +++ b/scripts/versions_manager.py @@ -174,11 +174,20 @@ def overwrite(self, module, for_all_dist=False, for_all_arch=False): self.components.append(tmp_component) self.adjust() - def get_config_module(self, default_module, dist, arch): + def get_config_module(self, source_path, dist, arch): if self.is_individule_version(): return self + default_module_path = VersionModule.get_module_path_by_name(source_path, DEFAULT_MODULE) + default_module = VersionModule() + default_module.load(default_module_path, filter_dist=dist, filter_arch=arch) module = default_module - if not self.is_aggregatable_module(self.name): + if self.name == 'host-image': + base_module_path = VersionModule.get_module_path_by_name(source_path, 'host-base-image') + base_module = VersionModule() + base_module.load(base_module_path, filter_dist=dist, filter_arch=arch) + module = default_module.clone(exclude_ctypes=DEFAULT_OVERWRITE_COMPONENTS) + module.overwrite(base_module, True, True) + elif not self.is_aggregatable_module(self.name): module = default_module.clone(exclude_ctypes=DEFAULT_OVERWRITE_COMPONENTS) return self._get_config_module(module, dist, arch) @@ -280,11 +289,11 @@ def load(self, image_path, filter_ctype=None, filter_dist=None, filter_arch=None arch = '' if len(items) > 2: dist = items[2] - if filter_dist and dist and filter_dist != dist: + if filter_dist and dist and filter_dist != dist and dist != ALL_DIST: continue if len(items) > 3: arch = items[3] - if filter_arch and arch and filter_arch != arch: + if filter_arch and arch and filter_arch != arch and arch != ALL_ARCH: continue versions = Component.get_versions(file_path) component = Component(versions, ctype, dist, arch) @@ -661,10 +670,7 @@ def generate(self): os.makedirs(args.target_path) module = VersionModule() module.load(module_path, filter_dist=args.distribution, filter_arch=args.architecture) - default_module_path = VersionModule.get_module_path_by_name(args.source_path, DEFAULT_MODULE) - default_module = VersionModule() - default_module.load(default_module_path, filter_dist=args.distribution, filter_arch=args.architecture) - config = module.get_config_module(default_module, args.distribution, args.architecture) + config = module.get_config_module(args.source_path, args.distribution, args.architecture) config.clean_info(force=True) config.dump(args.target_path, config=True, priority=args.priority) diff --git a/slave.mk b/slave.mk index 9e4bf532bfda..185574e61808 100644 --- a/slave.mk +++ b/slave.mk @@ -27,12 +27,12 @@ SRC_PATH = src RULES_PATH = rules TARGET_PATH = target DOCKERS_PATH = dockers -BLDENV = $(shell lsb_release -cs) +BLDENV := $(shell lsb_release -cs) DEBS_PATH = $(TARGET_PATH)/debs/$(BLDENV) FILES_PATH = $(TARGET_PATH)/files/$(BLDENV) -PYTHON_DEBS_PATH = $(TARGET_PATH)/python-debs -PYTHON_WHEELS_PATH = $(TARGET_PATH)/python-wheels -PROJECT_ROOT = $(shell pwd) +PYTHON_DEBS_PATH = $(TARGET_PATH)/python-debs/$(BLDENV) +PYTHON_WHEELS_PATH = $(TARGET_PATH)/python-wheels/$(BLDENV) +PROJECT_ROOT := $(shell pwd) JESSIE_DEBS_PATH = $(TARGET_PATH)/debs/jessie JESSIE_FILES_PATH = $(TARGET_PATH)/files/jessie STRETCH_DEBS_PATH = $(TARGET_PATH)/debs/stretch @@ -59,14 +59,17 @@ ifeq ($(CONFIGURED_ARCH),arm64) override DOCKER_BASE_ARCH = arm64v8 endif endif -ifeq ($(BLDENV),bullseye) IMAGE_DISTRO := bullseye -else -IMAGE_DISTRO := buster -endif IMAGE_DISTRO_DEBS_PATH = $(TARGET_PATH)/debs/$(IMAGE_DISTRO) IMAGE_DISTRO_FILES_PATH = $(TARGET_PATH)/files/$(IMAGE_DISTRO) +# Python 2 packages will not be available in Bullseye +ifeq ($(BLDENV),bullseye) +ENABLE_PY2_MODULES = n +else +ENABLE_PY2_MODULES = y +endif + export BUILD_NUMBER export BUILD_TIMESTAMP export SONIC_IMAGE_VERSION @@ -127,6 +130,8 @@ include $(RULES_PATH)/config export PACKAGE_URL_PREFIX export TRUSTED_GPG_URLS export SONIC_VERSION_CONTROL_COMPONENTS +DEFAULT_CONTAINER_REGISTRY := $(SONIC_DEFAULT_CONTAINER_REGISTRY) +export DEFAULT_CONTAINER_REGISTRY ifeq ($(SONIC_ENABLE_PFCWD_ON_START),y) ENABLE_PFCWD_ON_START = y @@ -148,6 +153,11 @@ ifeq ($(SONIC_INSTALL_DEBUG_TOOLS),y) INSTALL_DEBUG_TOOLS = y endif +ifeq ($(SONIC_SAITHRIFT_V2),y) +SAITHRIFT_V2 = y +SAITHRIFT_VER = v2 +endif + ifeq ($(SONIC_INCLUDE_SFLOW),y) INCLUDE_SFLOW = y endif @@ -156,10 +166,38 @@ ifeq ($(SONIC_INCLUDE_NAT),y) INCLUDE_NAT = y endif +ifeq ($(SONIC_INCLUDE_P4RT),y) +INCLUDE_P4RT = y +endif + +# Pre-built Bazel is not available for armhf, so exclude P4RT +# TODO(PINS): Remove when Bazel binaries are available for armhf +ifeq ($(CONFIGURED_ARCH),armhf) + ifeq ($(INCLUDE_P4RT),y) + @echo "Disabling P4RT due to incompatible CPU architecture: $(CONFIGURED_ARCH)" + endif + override INCLUDE_P4RT = n +endif + ifeq ($(SONIC_INCLUDE_MACSEC),y) INCLUDE_MACSEC = y endif +ifeq ($(ENABLE_AUTO_TECH_SUPPORT),y) +ENABLE_AUTO_TECH_SUPPORT = y +endif + +ifeq ($(SONIC_INCLUDE_MUX),y) +INCLUDE_MUX = y +endif + +ifeq ($(ENABLE_ASAN),y) + ifneq ($(CONFIGURED_ARCH),amd64) + @echo "Disabling SWSS address sanitizer due to incompatible CPU architecture: $(CONFIGURED_ARCH)" + override ENABLE_ASAN = n + endif +endif + include $(RULES_PATH)/functions ifeq ($(SONIC_USE_PDDF_FRAMEWORK),y) @@ -219,7 +257,7 @@ MAKEFLAGS += -j $(SONIC_BUILD_JOBS) export SONIC_CONFIG_MAKE_JOBS ifeq ($(CONFIGURED_PLATFORM),vs) -export BUILD_MULTIASIC_KVM=$(BUILD_MULTIASIC_KVM) +export BUILD_MULTIASIC_KVM endif ############################################################################### @@ -230,6 +268,11 @@ export SONIC_ROUTING_STACK export FRR_USER_UID export FRR_USER_GID +############################################################################### +## Build Options +############################################################################### +export DEB_BUILD_OPTIONS = hardening=+all + ############################################################################### ## Dumping key config attributes associated to current building exercise ############################################################################### @@ -257,6 +300,7 @@ $(info "FRR_USER_UID" : "$(FRR_USER_UID)") $(info "FRR_USER_GID" : "$(FRR_USER_GID)") endif $(info "ENABLE_SYNCD_RPC" : "$(ENABLE_SYNCD_RPC)") +$(info "SAITHRIFT_V2" : "$(SAITHRIFT_V2)") $(info "ENABLE_ORGANIZATION_EXTENSIONS" : "$(ENABLE_ORGANIZATION_EXTENSIONS)") $(info "HTTP_PROXY" : "$(HTTP_PROXY)") $(info "HTTPS_PROXY" : "$(HTTPS_PROXY)") @@ -279,12 +323,17 @@ $(info "INCLUDE_RESTAPI" : "$(INCLUDE_RESTAPI)") $(info "INCLUDE_SFLOW" : "$(INCLUDE_SFLOW)") $(info "INCLUDE_NAT" : "$(INCLUDE_NAT)") $(info "INCLUDE_DHCP_RELAY" : "$(INCLUDE_DHCP_RELAY)") +$(info "INCLUDE_P4RT" : "$(INCLUDE_P4RT)") $(info "INCLUDE_KUBERNETES" : "$(INCLUDE_KUBERNETES)") $(info "INCLUDE_MACSEC" : "$(INCLUDE_MACSEC)") +$(info "INCLUDE_MUX" : "$(INCLUDE_MUX)") $(info "TELEMETRY_WRITABLE" : "$(TELEMETRY_WRITABLE)") +$(info "ENABLE_AUTO_TECH_SUPPORT" : "$(ENABLE_AUTO_TECH_SUPPORT)") $(info "PDDF_SUPPORT" : "$(PDDF_SUPPORT)") $(info "MULTIARCH_QEMU_ENVIRON" : "$(MULTIARCH_QEMU_ENVIRON)") $(info "SONIC_VERSION_CONTROL_COMPONENTS": "$(SONIC_VERSION_CONTROL_COMPONENTS)") +$(info "ENABLE_ASAN" : "$(ENABLE_ASAN)") +$(info "DEFAULT_CONTAINER_REGISTRY" : "$(SONIC_DEFAULT_CONTAINER_REGISTRY)") ifeq ($(CONFIGURED_PLATFORM),vs) $(info "BUILD_MULTIASIC_KVM" : "$(BUILD_MULTIASIC_KVM)") endif @@ -480,6 +529,7 @@ SONIC_TARGET_LIST += $(addprefix $(DEBS_PATH)/, $(SONIC_MAKE_DEBS)) # SONIC_DPKG_DEBS += $(SOME_NEW_DEB) $(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) : $(DEBS_PATH)/% : .platform $$(addsuffix -install,$$(addprefix $(DEBS_PATH)/,$$($$*_DEPENDS))) \ $$(addprefix $(DEBS_PATH)/,$$($$*_AFTER)) \ + $$(addprefix $(FILES_PATH)/,$$($$*_AFTER_FILES)) \ $(call dpkg_depend,$(DEBS_PATH)/%.dep ) $(HEADER) @@ -568,6 +618,7 @@ $(SONIC_INSTALL_DEBS) : $(DEBS_PATH)/%-install : .platform $$(addsuffix -install if mkdir $(DEBS_PATH)/dpkg_lock &> /dev/null; then { sudo DEBIAN_FRONTEND=noninteractive dpkg -i $(DEBS_PATH)/$* $(LOG) && rm -d $(DEBS_PATH)/dpkg_lock && break; } || { rm -d $(DEBS_PATH)/dpkg_lock && sudo lsof /var/lib/dpkg/lock-frontend && ps aux && exit 1 ; } fi + sleep 10 done $(FOOTER) @@ -638,6 +689,8 @@ $(addprefix $(PYTHON_WHEELS_PATH)/, $(SONIC_PYTHON_WHEELS)) : $(PYTHON_WHEELS_PA pushd $($*_SRC_PATH) $(LOG_SIMPLE) # apply series of patches if exist if [ -f ../$(notdir $($*_SRC_PATH)).patch/series ]; then QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; fi + # Use pip instead of later setup.py to install dependencies into user home, but uninstall self + pip$($*_PYTHON_VERSION) install . && pip$($*_PYTHON_VERSION) uninstall --yes `python$($*_PYTHON_VERSION) setup.py --name` if [ ! "$($*_TEST)" = "n" ]; then python$($*_PYTHON_VERSION) setup.py test $(LOG); fi python$($*_PYTHON_VERSION) setup.py bdist_wheel $(LOG) # clean up @@ -718,6 +771,10 @@ $(foreach DOCKER_IMAGE,$(SONIC_STRETCH_DOCKERS), $(eval $(DOCKER_IMAGE)_DEBS_PAT $(foreach DOCKER_IMAGE,$(SONIC_STRETCH_DOCKERS), $(eval $(DOCKER_IMAGE)_FILES_PATH := $(STRETCH_FILES_PATH))) $(foreach DOCKER_IMAGE,$(SONIC_STRETCH_DBG_DOCKERS), $(eval $(DOCKER_IMAGE)_DEBS_PATH := $(STRETCH_DEBS_PATH))) $(foreach DOCKER_IMAGE,$(SONIC_STRETCH_DBG_DOCKERS), $(eval $(DOCKER_IMAGE)_FILES_PATH := $(STRETCH_FILES_PATH))) +$(foreach DOCKER_IMAGE,$(SONIC_BUSTER_DOCKERS), $(eval $(DOCKER_IMAGE)_DEBS_PATH := $(BUSTER_DEBS_PATH))) +$(foreach DOCKER_IMAGE,$(SONIC_BUSTER_DOCKERS), $(eval $(DOCKER_IMAGE)_FILES_PATH := $(BUSTER_FILES_PATH))) +$(foreach DOCKER_IMAGE,$(SONIC_BUSTER_DBG_DOCKERS), $(eval $(DOCKER_IMAGE)_DEBS_PATH := $(BUSTER_DEBS_PATH))) +$(foreach DOCKER_IMAGE,$(SONIC_BUSTER_DBG_DOCKERS), $(eval $(DOCKER_IMAGE)_FILES_PATH := $(BUSTER_FILES_PATH))) ifeq ($(BLDENV),jessie) DOCKER_IMAGES := $(SONIC_JESSIE_DOCKERS) @@ -731,8 +788,15 @@ ifeq ($(BLDENV),stretch) STRETCH_DOCKER_IMAGES = $(filter $(SONIC_STRETCH_DOCKERS),$(DOCKER_IMAGES_FOR_INSTALLERS) $(EXTRA_DOCKER_TARGETS)) STRETCH_DBG_DOCKER_IMAGES = $(filter $(SONIC_STRETCH_DBG_DOCKERS),$(DOCKER_IMAGES_FOR_INSTALLERS) $(EXTRA_DOCKER_TARGETS)) else - DOCKER_IMAGES = $(filter-out $(SONIC_JESSIE_DOCKERS) $(SONIC_STRETCH_DOCKERS),$(SONIC_DOCKER_IMAGES)) - DOCKER_DBG_IMAGES = $(filter-out $(SONIC_JESSIE_DBG_DOCKERS) $(SONIC_STRETCH_DBG_DOCKERS), $(SONIC_DOCKER_DBG_IMAGES)) +ifeq ($(BLDENV),buster) + DOCKER_IMAGES := $(SONIC_BUSTER_DOCKERS) + DOCKER_DBG_IMAGES := $(SONIC_BUSTER_DBG_DOCKERS) + BUSTER_DOCKER_IMAGES = $(filter $(SONIC_BUSTER_DOCKERS),$(DOCKER_IMAGES_FOR_INSTALLERS) $(EXTRA_DOCKER_TARGETS) $(SONIC_PACKAGES_LOCAL)) + BUSTER_DBG_DOCKER_IMAGES = $(filter $(SONIC_BUSTER_DBG_DOCKERS),$(DOCKER_IMAGES_FOR_INSTALLERS) $(EXTRA_DOCKER_TARGETS) $(SONIC_PACKAGES_LOCAL)) +else + DOCKER_IMAGES = $(filter-out $(SONIC_JESSIE_DOCKERS) $(SONIC_STRETCH_DOCKERS) $(SONIC_BUSTER_DOCKERS),$(SONIC_DOCKER_IMAGES)) + DOCKER_DBG_IMAGES = $(filter-out $(SONIC_JESSIE_DBG_DOCKERS) $(SONIC_STRETCH_DBG_DOCKERS) $(SONIC_BUSTER_DBG_DOCKERS), $(SONIC_DOCKER_DBG_IMAGES)) +endif endif endif @@ -757,7 +821,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform # Load the target deb from DPKG cache $(call LOAD_CACHE,$*.gz,$@) - + $(eval $*_CACHE_LOADED:=$($*.gz_CACHE_LOADED)) # Skip building the target if it is already loaded from cache if [ -z '$($*.gz_CACHE_LOADED)' ] ; then @@ -779,7 +843,10 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_pkgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_APT_PACKAGES)))\n" | awk '!a[$$0]++')) if [ -d $($*.gz_PATH)/cli-plugin-tests/ ]; then pushd $($*.gz_PATH)/cli-plugin-tests; pytest-$($(SONIC_UTILITIES_PY3)_PYTHON_VERSION) -v $(LOG); popd; fi # Label docker image with componenets versions - $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_labels=$(foreach component,$($*.gz_DEPENDS) $($*.gz_PYTHON_DEBS) $($*.gz_PYTHON_WHEELS),\ + $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_labels=$(foreach component,\ + $(call expand,$($*.gz_DEPENDS),RDEPENDS) \ + $(call expand,$($*.gz_PYTHON_DEBS)) \ + $(call expand,$($*.gz_PYTHON_WHEELS)),\ $(shell [[ ! -z "$($(component)_VERSION)" && ! -z "$($(component)_NAME)" ]] && \ echo "--label com.azure.sonic.versions.$($(component)_NAME)=$($(component)_VERSION)"))) j2 $($*.gz_PATH)/Dockerfile.j2 > $($*.gz_PATH)/Dockerfile @@ -828,7 +895,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_DBG_IMAGES)) : $(TARGET_PATH)/%-$(DBG_IMAG # Load the target deb from DPKG cache $(call LOAD_CACHE,$*-$(DBG_IMAGE_MARK).gz,$@) - + $(eval $*_CACHE_LOADED:=$($*-$(DBG_IMAGE_MARK).gz_CACHE_LOADED)) # Skip building the target if it is already loaded from cache if [ -z '$($*-$(DBG_IMAGE_MARK).gz_CACHE_LOADED)' ] ; then @@ -840,7 +907,7 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_DBG_IMAGES)) : $(TARGET_PATH)/%-$(DBG_IMAG $(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbg_pkgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_APT_PACKAGES),RDEPENDS))\n" | awk '!a[$$0]++')) ./build_debug_docker_j2.sh $* $(subst -,_,$(notdir $($*.gz_PATH)))_dbg_debs $(subst -,_,$(notdir $($*.gz_PATH)))_image_dbgs > $($*.gz_PATH)/Dockerfile-dbg.j2 j2 $($*.gz_PATH)/Dockerfile-dbg.j2 > $($*.gz_PATH)/Dockerfile-dbg - $(call generate_manifest,$*,-dbg) + $(call generate_manifest,$*,dbg) # Prepare docker build info PACKAGE_URL_PREFIX=$(PACKAGE_URL_PREFIX) \ SONIC_ENFORCE_VERSIONS=$(SONIC_ENFORCE_VERSIONS) \ @@ -875,6 +942,14 @@ DOCKER_LOAD_TARGETS = $(addsuffix -load,$(addprefix $(TARGET_PATH)/, \ $(DOCKER_IMAGES) \ $(DOCKER_DBG_IMAGES))) +ifeq ($(BLDENV),bullseye) +DOCKER_LOAD_TARGETS += $(addsuffix -load,$(addprefix $(TARGET_PATH)/, \ + $(SONIC_JESSIE_DOCKERS) \ + $(SONIC_STRETCH_DOCKERS) \ + $(SONIC_BUSTER_DOCKERS))) + +endif + $(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TARGET_PATH)/$$*.gz $(HEADER) docker load -i $(TARGET_PATH)/$*.gz $(LOG) @@ -910,7 +985,10 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(PYTHON_SWSSCOMMON) \ $(PYTHON3_SWSSCOMMON) \ $(SONIC_UTILITIES_DATA) \ - $(SONIC_HOST_SERVICES_DATA)) \ + $(SONIC_HOST_SERVICES_DATA) \ + $(BASH) \ + $(BASH_TACPLUS) \ + $(AUDISP_TACPLUS)) \ $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) \ $$(addprefix $(TARGET_PATH)/,$$(SONIC_PACKAGES_LOCAL)) \ $$(addprefix $(FILES_PATH)/,$$($$*_FILES)) \ @@ -924,6 +1002,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PLATFORM_COMMON_PY3)) \ $(addprefix $(PYTHON_WHEELS_PATH)/,$(REDIS_DUMP_LOAD_PY2)) \ $(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PLATFORM_API_PY2)) \ + $(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PLATFORM_API_PY3)) \ $(if $(findstring y,$(PDDF_SUPPORT)),$(addprefix $(PYTHON_WHEELS_PATH)/,$(PDDF_PLATFORM_API_BASE_PY2))) \ $(if $(findstring y,$(PDDF_SUPPORT)),$(addprefix $(PYTHON_WHEELS_PATH)/,$(PDDF_PLATFORM_API_BASE_PY3))) \ $(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_YANG_MODELS_PY3)) \ @@ -952,7 +1031,10 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export include_system_telemetry="$(INCLUDE_SYSTEM_TELEMETRY)" export include_restapi="$(INCLUDE_RESTAPI)" export include_nat="$(INCLUDE_NAT)" + export include_p4rt="$(INCLUDE_P4RT)" export include_sflow="$(INCLUDE_SFLOW)" + export enable_auto_tech_support="$(ENABLE_AUTO_TECH_SUPPORT)" + export enable_asan="$(ENABLE_ASAN)" export include_macsec="$(INCLUDE_MACSEC)" export include_mgmt_framework="$(INCLUDE_MGMT_FRAMEWORK)" export include_iccpd="$(INCLUDE_ICCPD)" @@ -967,10 +1049,10 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export lazy_installer_debs="$(foreach deb, $($*_LAZY_INSTALLS),$(foreach device, $($(deb)_PLATFORM),$(addprefix $(device)@, $(IMAGE_DISTRO_DEBS_PATH)/$(deb))))" export lazy_build_installer_debs="$(foreach deb, $($*_LAZY_BUILD_INSTALLS), $(addprefix $($(deb)_MACHINE)|,$(deb)))" export installer_images="$(foreach docker, $($*_DOCKERS),\ - $(addprefix $($(docker)_PACKAGE_NAME)|,\ - $(addprefix $($(docker)_PATH)|,\ - $(addprefix $($(docker)_MACHINE)|,\ - $(addprefix $(TARGET_PATH)/,$(addsuffix :$($(docker)_VERSION),$(docker)))))))" + $(addprefix $($(docker:-dbg.gz=.gz)_PACKAGE_NAME)|,\ + $(addprefix $($(docker:-dbg.gz=.gz)_PATH)|,\ + $(addprefix $($(docker:-dbg.gz=.gz)_MACHINE)|,\ + $(addprefix $(TARGET_PATH)/,$(addsuffix :$($(docker:-dbg.gz=.gz)_VERSION),$(docker)))))))" export sonic_packages="$(foreach package, $(SONIC_PACKAGES),\ $(addsuffix |$($(package)_DEFAULT_FEATURE_STATE_ENABLED),\ $(addsuffix |$($(package)_DEFAULT_FEATURE_OWNER),\ @@ -1002,6 +1084,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ export components="$(foreach component,$(notdir $^),\ $(shell [[ ! -z '$($(component)_VERSION)' && ! -z '$($(component)_NAME)' ]] && \ echo $($(component)_NAME)==$($(component)_VERSION)))" + export include_mux="$(INCLUDE_MUX)" $(foreach docker, $($*_DOCKERS),\ export docker_image="$(docker)" export docker_image_name="$(basename $(docker))" @@ -1178,6 +1261,9 @@ clean :: .platform clean-logs $$(SONIC_CLEAN_DEBS) $$(SONIC_CLEAN_FILES) $$(SONI all : .platform $$(addprefix $(TARGET_PATH)/,$$(SONIC_ALL)) +buster : $$(addprefix $(TARGET_PATH)/,$$(BUSTER_DOCKER_IMAGES)) \ + $$(addprefix $(TARGET_PATH)/,$$(BUSTER_DBG_DOCKER_IMAGES)) + stretch : $$(addprefix $(TARGET_PATH)/,$$(STRETCH_DOCKER_IMAGES)) \ $$(addprefix $(TARGET_PATH)/,$$(STRETCH_DBG_DOCKER_IMAGES)) diff --git a/sonic-slave-bullseye/Dockerfile.j2 b/sonic-slave-bullseye/Dockerfile.j2 index fac3bbe2b4aa..741f708de269 100644 --- a/sonic-slave-bullseye/Dockerfile.j2 +++ b/sonic-slave-bullseye/Dockerfile.j2 @@ -1,11 +1,14 @@ +{% set prefix = DEFAULT_CONTAINER_REGISTRY %} {%- if CONFIGURED_ARCH == "armhf" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/qemu-user-static:x86_64-arm-5.0.0-2 as qemu -FROM multiarch/debian-debootstrap:armhf-bullseye +FROM {{ prefix }}multiarch/qemu-user-static:x86_64-arm-6.1.0-8 as qemu +FROM {{ prefix }}multiarch/debian-debootstrap:armhf-bullseye COPY --from=qemu /usr/bin/qemu-arm-static /usr/bin {%- elif CONFIGURED_ARCH == "arm64" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:arm64-bullseye +FROM {{ prefix }}multiarch/qemu-user-static:x86_64-aarch64-6.1.0-8 as qemu +FROM {{ prefix }}multiarch/debian-debootstrap:arm64-bullseye +COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin {%- else -%} -FROM debian:bullseye +FROM {{ prefix }}debian:bullseye {%- endif %} MAINTAINER gulv@microsoft.com @@ -15,15 +18,19 @@ COPY ["no-check-valid-until", "/etc/apt/apt.conf.d/"] ## TODO: Re-add in any necessary mirror URLs here as they become available RUN echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ bullseye main contrib non-free" >> /etc/apt/sources.list && \ echo "deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian/ bullseye main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian bullseye-backports main" >> /etc/apt/sources.list + echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ bullseye-security main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ bullseye-security main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb [arch=amd64] http://debian-archive.trafficmanager.net/debian bullseye-backports main" >> /etc/apt/sources.list && \ + echo "deb [arch=amd64] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb [arch=amd64] http://packages.trafficmanager.net/debian/debian bullseye-updates main contrib non-free" >> /etc/apt/sources.list {%- if CONFIGURED_ARCH == "armhf" %} RUN echo "deb [arch=armhf] http://deb.debian.org/debian bullseye main contrib non-free" > /etc/apt/sources.list && \ echo "deb-src [arch=armhf] http://deb.debian.org/debian bullseye main contrib non-free" >> /etc/apt/sources.list && \ echo "deb [arch=armhf] http://deb.debian.org/debian bullseye-updates main contrib non-free" >> /etc/apt/sources.list && \ echo "deb-src [arch=armhf] http://deb.debian.org/debian bullseye-updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=armhf] http://security.debian.org bullseye/updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb-src [arch=armhf] http://security.debian.org bullseye/updates main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb [arch=armhf] http://security.debian.org bullseye-security main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb-src [arch=armhf] http://security.debian.org bullseye-security main contrib non-free" >> /etc/apt/sources.list && \ echo 'deb [arch=armhf] http://ftp.debian.org/debian bullseye-backports main' >> /etc/apt/sources.list && \ echo "deb [arch=armhf] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free" >> /etc/apt/sources.list && \ echo "deb [arch=armhf] http://packages.trafficmanager.net/debian/debian bullseye-updates main contrib non-free" >> /etc/apt/sources.list @@ -32,8 +39,8 @@ RUN echo "deb [arch=arm64] http://deb.debian.org/debian bullseye main contrib no echo "deb-src [arch=arm64] http://deb.debian.org/debian bullseye main contrib non-free" >> /etc/apt/sources.list && \ echo "deb [arch=arm64] http://deb.debian.org/debian bullseye-updates main contrib non-free" >> /etc/apt/sources.list && \ echo "deb-src [arch=arm64] http://deb.debian.org/debian bullseye-updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb [arch=arm64] http://security.debian.org bullseye/updates main contrib non-free" >> /etc/apt/sources.list && \ - echo "deb-src [arch=arm64] http://security.debian.org bullseye/updates main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb [arch=arm64] http://security.debian.org bullseye-security main contrib non-free" >> /etc/apt/sources.list && \ + echo "deb-src [arch=arm64] http://security.debian.org bullseye-security main contrib non-free" >> /etc/apt/sources.list && \ echo 'deb [arch=arm64] http://ftp.debian.org/debian bullseye-backports main' >> /etc/apt/sources.list && \ echo "deb [arch=arm64] http://packages.trafficmanager.net/debian/debian bullseye main contrib non-free" >> /etc/apt/sources.list && \ echo "deb [arch=arm64] http://packages.trafficmanager.net/debian/debian bullseye-updates main contrib non-free" >> /etc/apt/sources.list @@ -58,7 +65,6 @@ RUN apt-get update && apt-get install -y \ dh-exec \ kmod \ libtinyxml2-dev \ - python \ python3 \ python3-pip \ libncurses5-dev \ @@ -193,7 +199,7 @@ RUN apt-get update && apt-get install -y \ clang \ pylint \ python3-pytest \ - python3-pytest \ + python3-venv \ gcovr \ python3-pytest-cov \ python3-pytest-cov \ @@ -235,6 +241,8 @@ RUN apt-get update && apt-get install -y \ # For gtest libgtest-dev \ cmake \ +# For gmock + libgmock-dev \ # For pam_tacplus build autoconf-archive \ # For iproute2 @@ -250,6 +258,12 @@ RUN apt-get update && apt-get install -y \ iproute2 \ # For bash texi2html \ + sharutils \ + locales \ + time \ + man2html-base \ + libcunit1 \ + libcunit1-dev \ # For initramfs shellcheck \ bash-completion \ @@ -268,9 +282,6 @@ RUN apt-get update && apt-get install -y \ librrd8 \ librrd-dev \ rrdtool \ -# For smartmontools 6.6-1 - automake1.11 \ - libselinux1-dev \ # For kdump-tools liblzo2-dev \ # For iptables @@ -299,7 +310,6 @@ RUN apt-get update && apt-get install -y \ # For WPA supplication qtbase5-dev \ aspell-en \ - libpython2.7-dev \ libssl-dev \ dbus \ libdbus-1-dev \ @@ -313,22 +323,22 @@ RUN apt-get update && apt-get install -y \ # For kdump-tools libbz2-dev \ # For linkmgrd - libboost1.74-dev \ - libboost-program-options1.74-dev \ - libboost-system1.74-dev \ - libboost-thread1.74-dev \ - libboost-atomic1.74-dev \ - libboost-chrono1.74-dev \ - libboost-container1.74-dev \ - libboost-context1.74-dev \ - libboost-contract1.74-dev \ - libboost-coroutine1.74-dev \ - libboost-date-time1.74-dev \ - libboost-fiber1.74-dev \ - libboost-filesystem1.74-dev \ - libboost-graph-parallel1.74-dev \ - libboost-log1.74-dev \ - libboost-regex1.74-dev \ + libboost-dev \ + libboost-program-options-dev \ + libboost-system-dev \ + libboost-thread-dev \ + libboost-atomic-dev \ + libboost-chrono-dev \ + libboost-container-dev \ + libboost-context-dev \ + libboost-contract-dev \ + libboost-coroutine-dev \ + libboost-date-time-dev \ + libboost-fiber-dev \ + libboost-filesystem-dev \ + libboost-graph-parallel-dev \ + libboost-log-dev \ + libboost-regex-dev \ googletest \ libgtest-dev \ libgcc-10-dev \ @@ -337,23 +347,31 @@ RUN apt-get update && apt-get install -y \ libdbus-1-dev \ libgirepository1.0-dev \ libsystemd-dev \ - pkg-config + pkg-config \ +# For audisp-tacplus + libauparse-dev \ + auditd RUN apt-get -y build-dep openssh +# Build fix for ARM64 and ARMHF /etc/debian_version +{%- if CONFIGURED_ARCH == "armhf" or CONFIGURED_ARCH == "arm64" %} +RUN apt upgrade -y base-files +{%- endif %} + # Build fix for ARMHF bullseye libsairedis {%- if CONFIGURED_ARCH == "armhf" %} # Install doxygen build dependency packages - RUN apt install -y libxapian-dev yui-compressor libclang-3.9-dev texlive-extra-utils \ - texlive-font-utils rdfind llvm-6.0-dev libclang-6.0-dev sassc + RUN apt install -y libxapian-dev yui-compressor texlive-extra-utils \ + texlive-font-utils rdfind llvm-11-dev libclang-11-dev sassc faketime mat2 # Update doxygen with 64bit file offset patch - RUN dget -u http://deb.debian.org/debian/pool/main/d/doxygen/doxygen_1.8.13-10.dsc && \ - cd doxygen-1.8.13 && \ + RUN dget -u http://deb.debian.org/debian/pool/main/d/doxygen/doxygen_1.9.1-2.dsc && \ + cd doxygen-1.9.1 && \ sed -i '56 a add_definitions(-D_FILE_OFFSET_BITS=64)' CMakeLists.txt && \ DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -us -uc -b && \ cd .. && \ - dpkg -i ./doxygen_1.8.13-10_armhf.deb && \ + dpkg -i ./doxygen_1.9.1-2_armhf.deb && \ rm -fr doxygen* # Aspell is unable to locate the language dictionaries. @@ -361,6 +379,7 @@ RUN apt-get -y build-dep openssh RUN apt-get install --reinstall -y aspell-en # workaround because of https://bugs.launchpad.net/qemu/+bug/1805913, just disable aspell + # Issue now being tracked here - https://gitlab.com/qemu-project/qemu/-/issues/263 RUN cp /bin/true /usr/bin/aspell {%- endif %} @@ -462,6 +481,10 @@ EXPOSE 22 RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git /usr/share/depot_tools ENV PATH /usr/share/depot_tools:$PATH +# Install dependencies for dhcp relay test +RUN pip3 install parameterized==0.8.1 +RUN pip3 install pyfakefs + # Install docker engine 20.10 inside docker and enable experimental feature RUN apt-get update RUN apt-get install -y \ @@ -497,3 +520,13 @@ RUN apt-get install -y nodejs # Tell azure pipeline to use node.js in the docker LABEL "com.azure.dev.pipelines.agent.handler.node.path"="/usr/bin/node" {% endif -%} + +# Install Bazel build system (amd64 and arm64 architectures are supported using this method) +# TODO(PINS): Remove once pre-build Bazel binaries are available for armhf (armv7l) +{%- if CONFIGURED_ARCH == "amd64" or CONFIGURED_ARCH == "arm64" %} +ARG bazelisk_url=https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-{{ CONFIGURED_ARCH }} +RUN curl -fsSL -o /usr/local/bin/bazel ${bazelisk_url} && chmod 755 /usr/local/bin/bazel +# Bazel requires "python" +# TODO(PINS): remove when Bazel is okay with "python3" binary name +RUN apt install -y python-is-python3 +{% endif -%} diff --git a/sonic-slave-buster/Dockerfile.j2 b/sonic-slave-buster/Dockerfile.j2 index f23c1aeb8c17..fa8ac44f1b9e 100644 --- a/sonic-slave-buster/Dockerfile.j2 +++ b/sonic-slave-buster/Dockerfile.j2 @@ -1,11 +1,12 @@ +{% set prefix = DEFAULT_CONTAINER_REGISTRY %} {%- if CONFIGURED_ARCH == "armhf" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/qemu-user-static:x86_64-arm-5.0.0-2 as qemu -FROM multiarch/debian-debootstrap:armhf-buster +FROM {{ prefix }}multiarch/qemu-user-static:x86_64-arm-5.0.0-2 as qemu +FROM {{ prefix }}multiarch/debian-debootstrap:armhf-buster COPY --from=qemu /usr/bin/qemu-arm-static /usr/bin {%- elif CONFIGURED_ARCH == "arm64" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:arm64-buster +FROM {{ prefix }}multiarch/debian-debootstrap:arm64-buster {%- else -%} -FROM debian:buster +FROM {{ prefix }}debian:buster {%- endif %} MAINTAINER gulv@microsoft.com @@ -110,6 +111,13 @@ RUN apt-get update && apt-get install -y \ libxml-simple-perl \ graphviz \ aspell \ +# For SAI meta rpc build - make rpc + libgetopt-long-descriptive-perl \ + libconst-fast-perl \ + libtemplate-perl \ + libnamespace-autoclean-perl \ + libmoose-perl \ + libmoosex-aliases-perl \ # For linux build bc \ fakeroot \ @@ -243,6 +251,8 @@ RUN apt-get update && apt-get install -y \ # For gtest libgtest-dev \ cmake \ +# For gmock + libgmock-dev \ # For pam_tacplus build autoconf-archive \ # For iproute2 @@ -258,6 +268,12 @@ RUN apt-get update && apt-get install -y \ iproute2 \ # For bash texi2html \ + sharutils \ + locales \ + time \ + man2html-base \ + libcunit1 \ + libcunit1-dev \ # For initramfs shellcheck \ bash-completion \ @@ -276,9 +292,6 @@ RUN apt-get update && apt-get install -y \ librrd8 \ librrd-dev \ rrdtool \ -# For smartmontools 6.6-1 - automake1.11 \ - libselinux1-dev \ # For kdump-tools liblzo2-dev \ # For iptables @@ -346,7 +359,16 @@ RUN apt-get update && apt-get install -y \ libdbus-1-dev \ libgirepository1.0-dev \ libsystemd-dev \ - pkg-config + pkg-config \ +# For audisp-tacplus + libauparse-dev \ + auditd + +# For iproute2 +RUN apt-get install -y -t buster-backports \ + libbpf-dev \ + dwz \ + debhelper RUN apt-get -y build-dep openssh @@ -441,12 +463,17 @@ RUN pip3 uninstall -y enum34 # For templating RUN pip2 install j2cli==0.3.10 +# Note: Jinja2 depends on MarkupSafe, however markupsafe 2.1.0 breaks Jinja2 2.10 +# Debian buster dist-packages include python3-markupsafe (1.1.0-1) and python3-jinja2 (2.10-2) +# If not pinning the versions, any requirement like `MarkupSafe>=2.0` will pull latest into site-packages and mess up. +RUN pip3 install MarkupSafe==2.0.1 +RUN pip3 install Jinja2==3.0.3 # For sonic-mgmt-framework RUN pip2 install "PyYAML==5.4.1" RUN pip3 install "PyYAML==5.4.1" -RUN pip2 install "lxml==4.6.2" -RUN pip3 install "lxml==4.6.2" +RUN pip2 install "lxml==4.6.5" +RUN pip3 install "lxml==4.6.5" # For sonic-platform-common testing RUN pip3 install redis @@ -525,3 +552,10 @@ RUN apt-get install -y nodejs # Tell azure pipeline to use node.js in the docker LABEL "com.azure.dev.pipelines.agent.handler.node.path"="/usr/bin/node" {% endif -%} + +# Install Bazel build system (amd64 and arm64 architectures are supported using this method) +# TODO(PINS): Remove once pre-build Bazel binaries are available for armhf (armv7l) +{%- if CONFIGURED_ARCH == "amd64" or CONFIGURED_ARCH == "arm64" %} +ARG bazelisk_url=https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-{{ CONFIGURED_ARCH }} +RUN curl -fsSL -o /usr/local/bin/bazel ${bazelisk_url} && chmod 755 /usr/local/bin/bazel +{% endif -%} diff --git a/sonic-slave-jessie/Dockerfile.j2 b/sonic-slave-jessie/Dockerfile.j2 index db8f0a49650d..1d98e6d9b6c5 100644 --- a/sonic-slave-jessie/Dockerfile.j2 +++ b/sonic-slave-jessie/Dockerfile.j2 @@ -1,9 +1,10 @@ +{% set prefix = DEFAULT_CONTAINER_REGISTRY %} {%- if CONFIGURED_ARCH == "armhf" -%} -FROM multiarch/debian-debootstrap:armhf-jessie +FROM {{ prefix }}multiarch/debian-debootstrap:armhf-jessie {%- elif CONFIGURED_ARCH == "arm64" -%} -FROM multiarch/debian-debootstrap:arm64-jessie +FROM {{ prefix }}multiarch/debian-debootstrap:arm64-jessie {%- else -%} -FROM debian:jessie +FROM {{ prefix }}debian:jessie {%- endif %} MAINTAINER johnar@microsoft.com @@ -231,8 +232,17 @@ RUN apt-get update && apt-get install -y \ texlive-latex-recommended \ # For bash texi2html \ + sharutils \ + locales \ + time \ + man2html-base \ + libcunit1 \ + libcunit1-dev \ # For initramfs bash-completion \ +# For audisp-tacplus + libauparse-dev \ + auditd \ {% if CONFIGURED_ARCH == "amd64" -%} # For sonic vs image build dosfstools \ @@ -345,3 +355,10 @@ RUN pip install m2crypto==0.36.0 # Install swi tools RUN python -m pip install git+https://github.com/aristanetworks/swi-tools.git@d51761ec0bb93c73039233f3c01ed48235ffad00 + +# Install Bazel build system (amd64 and arm64 architectures are supported using this method) +# TODO(PINS): Remove once pre-build Bazel binaries are available for armhf (armv7l) +{%- if CONFIGURED_ARCH == "amd64" or CONFIGURED_ARCH == "arm64" %} +ARG bazelisk_url=https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-{{ CONFIGURED_ARCH }} +RUN curl -fsSL -o /usr/local/bin/bazel ${bazelisk_url} && chmod 755 /usr/local/bin/bazel +{% endif -%} diff --git a/sonic-slave-stretch/Dockerfile.j2 b/sonic-slave-stretch/Dockerfile.j2 index e077c69e01b3..ad13ed0c124a 100644 --- a/sonic-slave-stretch/Dockerfile.j2 +++ b/sonic-slave-stretch/Dockerfile.j2 @@ -1,9 +1,10 @@ +{% set prefix = DEFAULT_CONTAINER_REGISTRY %} {%- if CONFIGURED_ARCH == "armhf" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:armhf-stretch +FROM {{ prefix }}multiarch/debian-debootstrap:armhf-stretch {%- elif CONFIGURED_ARCH == "arm64" and MULTIARCH_QEMU_ENVIRON == "y" %} -FROM multiarch/debian-debootstrap:arm64-stretch +FROM {{ prefix }}multiarch/debian-debootstrap:arm64-stretch {%- else -%} -FROM debian:stretch +FROM {{ prefix }}debian:stretch {%- endif %} MAINTAINER gulv@microsoft.com @@ -254,6 +255,12 @@ RUN apt-get update && apt-get install -y \ iproute2 \ # For bash texi2html \ + sharutils \ + locales \ + time \ + man2html-base \ + libcunit1 \ + libcunit1-dev \ # For initramfs bash-completion \ {%- if CONFIGURED_ARCH == "amd64" %} @@ -266,9 +273,6 @@ RUN apt-get update && apt-get install -y \ librrd8 \ librrd-dev \ rrdtool \ -# For smartmontools 6.6-1 - automake1.11 \ - libselinux1-dev \ # For kdump-tools liblzo2-dev \ # For iptables @@ -289,7 +293,13 @@ RUN apt-get update && apt-get install -y \ libxml2-utils \ xsltproc \ python-lxml \ - libexpat1-dev + libexpat1-dev \ +# For audisp-tacplus + libauparse-dev \ + auditd + +# For gmock +RUN apt-get install -y libgmock-dev -t stretch-backports # Install dependencies for dhcp relay test RUN pip3 install parameterized==0.8.1 @@ -303,9 +313,6 @@ RUN sudo augtool --autosave "set /files/etc/dpkg/dpkg.cfg/force-confdef" ## do not modify the current configuration file, the new version is installed with a .dpkg-dist suffix RUN sudo augtool --autosave "set /files/etc/dpkg/dpkg.cfg/force-confold" -# For smartmontools 6.6-1 -RUN apt-get -t stretch-backports install -y debhelper - # For linux build RUN apt-get -y build-dep linux @@ -354,8 +361,8 @@ RUN pip3 install mockredispy==2.9.3 # For sonic-mgmt-framework RUN pip2 install "PyYAML==5.3.1" RUN pip3 install "PyYAML==5.3.1" -RUN pip2 install "lxml==4.6.2" -RUN pip3 install "lxml==4.6.2" +RUN pip2 install "lxml==4.6.5" +RUN pip3 install "lxml==4.6.5" # For sonic-platform-common testing @@ -449,3 +456,10 @@ RUN apt-get install -y nodejs # Tell azure pipeline to use node.js in the docker LABEL "com.azure.dev.pipelines.agent.handler.node.path"="/usr/bin/node" {% endif -%} + +# Install Bazel build system (amd64 and arm64 architectures are supported using this method) +# TODO(PINS): Remove once pre-build Bazel binaries are available for armhf (armv7l) +{%- if CONFIGURED_ARCH == "amd64" or CONFIGURED_ARCH == "arm64" %} +ARG bazelisk_url=https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-{{ CONFIGURED_ARCH }} +RUN curl -fsSL -o /usr/local/bin/bazel ${bazelisk_url} && chmod 755 /usr/local/bin/bazel +{% endif -%} diff --git a/src/bash/.gitignore b/src/bash/.gitignore index a0991ff4402b..4d73f1b0d38e 100644 --- a/src/bash/.gitignore +++ b/src/bash/.gitignore @@ -1,3 +1,7 @@ * !.gitignore !Makefile +!Files/ +!Files/* +!patches/ +!patches/* diff --git a/src/bash/Files/unittest/Makefile b/src/bash/Files/unittest/Makefile new file mode 100644 index 000000000000..8eec2b07ab45 --- /dev/null +++ b/src/bash/Files/unittest/Makefile @@ -0,0 +1,18 @@ +#disable some warning because UT need test functions not in header file. +CFLAGS = -Wno-parentheses -Wno-format-security -Wno-implicit-function-declaration -c +IFLAGS = -I.. -I../include -I../lib +MFLAG = -DDEBUG -DBASH_PLUGIN_UT + +all: + gcc plugin_test.c $(IFLAGS) $(CFLAGS) -o plugin_test.o + gcc mock_helper.c $(IFLAGS) $(CFLAGS) -o mock_helper.o + gcc ../plugin.c $(IFLAGS) $(CFLAGS) $(MFLAG) -o plugin.o + gcc plugin_test.o mock_helper.o plugin.o -o plugin_test -lc -lcunit + +test: + # run unit test, if UT failed, build will break + ./plugin_test + +clean: + rm *.o + rm plugin_test diff --git a/src/bash/Files/unittest/bash_plugins.conf b/src/bash/Files/unittest/bash_plugins.conf new file mode 100644 index 000000000000..568de35efd37 --- /dev/null +++ b/src/bash/Files/unittest/bash_plugins.conf @@ -0,0 +1,6 @@ +# tacacs authorization plugin +plugin=/home/liuh/tacacs-bash-plugin/tacacs-authorization.so +plugin=/usr/lib/bash-plugins/another_test_plugin.so # test comments + + +# test line \ No newline at end of file diff --git a/src/bash/Files/unittest/mock_helper.c b/src/bash/Files/unittest/mock_helper.c new file mode 100644 index 000000000000..dfbf3a6444aa --- /dev/null +++ b/src/bash/Files/unittest/mock_helper.c @@ -0,0 +1,218 @@ +/* mock_helper.c -- mock helper for bash plugin UT. */ +#include +#include +#include +#include +#include +#include +#include "mock_helper.h" + +// define BASH_PLUGIN_UT_DEBUG to output UT debug message. +//#define BASH_PLUGIN_UT_DEBUG +#if defined (BASH_PLUGIN_UT_DEBUG) +# define debug_printf printf +#else +# define debug_printf +#endif + +/* itrace buffer */ +char mock_itrace_message_buffer[1024]; + +/* bash run command buffer */ +char mock_onshell_execve_command_buffer[1024]; + +/* plugin handles. */ +void* mock_plugin_handle = (void*)TEST_MOCK_PLUGIN_HANDLE; +void* mock_plugin_default_function_handle = (void*)0x2234; +void* mock_plugin_on_shell_execve_handle = (void*)0x3234; +char* mock_dlerror_failed = "MOCK error"; +char* mock_dlerror = NULL; + +/* define test scenarios for mock functions return different value by scenario. */ +int test_scenario; + +/* define test scenarios for different return value. */ +int plugin_init_status; + +/* define memory allocate counter. */ +int memory_allocate_count; + +/* Set test scenario for test*/ +void set_test_scenario(int scenario) +{ + test_scenario = scenario; +} + +/* Get test scenario for test*/ +int get_test_scenario() +{ + return test_scenario; +} + +/* Set plugin init status for test*/ +void set_plugin_init_status(int status) +{ + plugin_init_status = status; +} + +/* Get plugin init status for test*/ +int get_plugin_init_status() +{ + return plugin_init_status; +} + +/* Set memory allocate count for test*/ +void set_memory_allocate_count(int count) +{ + memory_allocate_count = count; +} + +/* Get memory allocate count for test*/ +int get_memory_allocate_count() +{ + return memory_allocate_count; +} + +/* MOCK plugin_init method*/ +int mock_plugin_init() +{ + set_plugin_init_status(PLUGIN_INITIALIZED); +} + +/* MOCK plugin_init method*/ +int mock_plugin_uninit() +{ + set_plugin_init_status(PLUGIN_NOT_INITIALIZE); +} + +/* MOCK on_shell_execve method*/ +int mock_on_shell_execve (char *user, int shell_level, char *cmd, char **argv) +{ + // set mock command data to buffer for UT. + memset(mock_onshell_execve_command_buffer, 0, sizeof(mock_onshell_execve_command_buffer)); + + snprintf(mock_onshell_execve_command_buffer, sizeof(mock_onshell_execve_command_buffer), "on_shell_execve: user: %s, level: %d, command: %s, argv: %p\n", user, shell_level, cmd, argv); + + debug_printf("MOCK: mock_on_shell_execve: %s\n", mock_onshell_execve_command_buffer); +} + +/* MOCK dlopen*/ +void *dlopen(const char *filename, int flags) +{ + debug_printf("MOCK: dlopen: %s\n", filename); + if (TEST_SCEANRIO_PLUGIN_NOT_EXIT == test_scenario) + { + // return null when plugin not exist + mock_dlerror = mock_dlerror_failed; + return NULL; + } + + // all other case return mock handle + mock_dlerror = NULL; + return mock_plugin_handle; +} + +/* MOCK dlclose*/ +int dlclose(void *handle) +{ + debug_printf("MOCK: dlclose: %p\n", handle); + // check if the close handle match the opened handle + CU_ASSERT_EQUAL(handle, mock_plugin_handle); +} + +/* MOCK dlsym*/ +void *dlsym(void *restrict handle, const char *restrict symbol) +{ + debug_printf("MOCK: dlsym: %p, %s\n", handle, symbol); + mock_dlerror = NULL; + switch (test_scenario) + { + case TEST_SCEANRIO_PLUGIN_EXECVE_NOT_EXIT: + if (strcmp(symbol, "on_shell_execve") == 0) + { + mock_dlerror = mock_dlerror_failed; + return NULL; + } + + case TEST_SCEANRIO_PLUGIN_UNINIT_NOT_EXIT: + if (strcmp(symbol, "plugin_uninit") == 0) + { + mock_dlerror = mock_dlerror_failed; + return NULL; + } + + case TEST_SCEANRIO_PLUGIN_INIT_NOT_EXIT: + if (strcmp(symbol, "plugin_init") == 0) + { + mock_dlerror = mock_dlerror_failed; + return NULL; + } + + case TEST_SCEANRIO_PLUGIN_INIT_SUCCESS: + if (strcmp(symbol, "plugin_init") == 0) + { + // return mock method handle so plugin framework will call it to initialize + return mock_plugin_init; + } + else if (strcmp(symbol, "plugin_uninit") == 0) + { + // return mock method handle so plugin framework will call it to initialize + return mock_plugin_uninit; + } + else if (strcmp(symbol, "on_shell_execve") == 0) + { + // return mock method handle so plugin framework will call it to initialize + return mock_on_shell_execve; + } + } + + return mock_plugin_default_function_handle; +} + +/* MOCK dlerror*/ +char *dlerror(void) +{ + return mock_dlerror; +} + +/* MOCK get_string_value*/ +char *get_string_value(const char * str) +{ + return "1"; +} + +/* MOCK absolute_program*/ +int absolute_program (const char * str) +{ + return 0; +} + +/* MOCK itrace*/ +void itrace (const char * format, ...) +{ + // set mock message data to buffer for UT. + memset(mock_itrace_message_buffer, 0, sizeof(mock_itrace_message_buffer)); + + va_list args; + va_start(args, format); + // save message to buffer to UT check later + vsnprintf(mock_itrace_message_buffer, sizeof(mock_itrace_message_buffer), format, args); + va_end(args); + debug_printf("MOCK: itrace: %s\n", mock_itrace_message_buffer); +} + +/* MOCK malloc method*/ +void* mock_malloc (size_t size) +{ + memory_allocate_count++; + debug_printf("MOCK: malloc memory count: %d\n", memory_allocate_count); + return malloc(size); +} + +/* MOCK free method*/ +void mock_free (void* ptr) +{ + memory_allocate_count--; + debug_printf("MOCK: free memory count: %d\n", memory_allocate_count); + free(ptr); +} \ No newline at end of file diff --git a/src/bash/Files/unittest/mock_helper.h b/src/bash/Files/unittest/mock_helper.h new file mode 100644 index 000000000000..1fcfeb39be9b --- /dev/null +++ b/src/bash/Files/unittest/mock_helper.h @@ -0,0 +1,65 @@ +/* plugin.h - functions from plugin.c. */ + +/* Copyright (C) 1993-2015 Free Software Foundation, Inc. + + This file is part of GNU Bash, the Bourne Again SHell. + + Bash is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Bash is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Bash. If not, see . +*/ + +#if !defined (_MOCK_HELPER_H_) +#define _MOCK_HELPER_H_ + +#include "plugin.h" + +#define TEST_MOCK_PLUGIN_HANDLE 0x1234 + +#define TEST_SCEANRIO_PLUGIN_NOT_EXIT 1 +#define TEST_SCEANRIO_PLUGIN_EXECVE_NOT_EXIT 2 +#define TEST_SCEANRIO_PLUGIN_UNINIT_NOT_EXIT 3 +#define TEST_SCEANRIO_PLUGIN_INIT_NOT_EXIT 4 +#define TEST_SCEANRIO_PLUGIN_INIT_SUCCESS 5 + +#define PLUGIN_NOT_INITIALIZE -1 +#define PLUGIN_INITIALIZED 1 + +/* The global plugin list */ +extern PLUGIN_NODE *global_plugin_list; + +/* itrace buffer */ +extern char mock_itrace_message_buffer[1024]; + +/* bash run command buffer */ +extern char mock_onshell_execve_command_buffer[1024]; + +/* Set test scenario for test*/ +void set_test_scenario(int scenario); + +/* Get test scenario for test*/ +int get_test_scenario(); + +/* Set plugin init status for test*/ +void set_plugin_init_status(int status); + +/* Get plugin init status for test*/ +int get_plugin_init_status(); + +/* Set memory allocate count for test*/ +void set_memory_allocate_count(int count); + +/* Get memory allocate count for test*/ +int get_memory_allocate_count(); + + +#endif /* _MOCK_HELPER_H_ */ \ No newline at end of file diff --git a/src/bash/Files/unittest/plugin_test.c b/src/bash/Files/unittest/plugin_test.c new file mode 100644 index 000000000000..83439f93a03f --- /dev/null +++ b/src/bash/Files/unittest/plugin_test.c @@ -0,0 +1,217 @@ +#include +#include +#include +#include +#include "plugin.h" +#include "mock_helper.h" + +int clean_up() { + return 0; +} + +int start_up() { + return 0; +} + +/* Test plugin not exist scenario */ +void testcase_try_load_plugin_by_path_not_exist() { + set_test_scenario(TEST_SCEANRIO_PLUGIN_NOT_EXIT); + + try_load_plugin_by_path("./testplugin.so"); + + CU_ASSERT_STRING_EQUAL(mock_itrace_message_buffer, "Plugin: can't load plugin ./testplugin.so: MOCK error\n"); +} + +/* Test plugin exist but not support shell_execve scenario */ +void testcase_try_load_plugin_by_path_execve_not_exist() { + set_test_scenario(TEST_SCEANRIO_PLUGIN_EXECVE_NOT_EXIT); + + try_load_plugin_by_path("./testplugin.so"); + + CU_ASSERT_STRING_EQUAL(mock_itrace_message_buffer, "Plugin: can't find on_shell_execve function ./testplugin.so: MOCK error\n"); +} + +/* Test plugin exist but not support plugin_uninit scenario */ +void testcase_try_load_plugin_by_path_plugin_uninit_not_exist() { + set_test_scenario(TEST_SCEANRIO_PLUGIN_UNINIT_NOT_EXIT); + + try_load_plugin_by_path("./testplugin.so"); + + CU_ASSERT_STRING_EQUAL(mock_itrace_message_buffer, "Plugin: can't find plugin_uninit function ./testplugin.so: MOCK error\n"); +} + +/* Test plugin exist but not support plugin_init scenario */ +void testcase_try_load_plugin_by_path_plugin_init_not_exist() { + set_test_scenario(TEST_SCEANRIO_PLUGIN_INIT_NOT_EXIT); + + try_load_plugin_by_path("./testplugin.so"); + + CU_ASSERT_STRING_EQUAL(mock_itrace_message_buffer, "Plugin: can't find plugin_init function ./testplugin.so: MOCK error\n"); +} + +/* Test plugin exist but not support plugin_init scenario */ +void testcase_try_load_plugin_by_path_plugin_init_success() { + set_test_scenario(TEST_SCEANRIO_PLUGIN_INIT_SUCCESS); + set_memory_allocate_count(0); + set_plugin_init_status(PLUGIN_NOT_INITIALIZE); + + try_load_plugin_by_path("./testplugin.so"); + + // check plugin init success + CU_ASSERT_EQUAL(get_plugin_init_status(), PLUGIN_INITIALIZED); + + // check API success + CU_ASSERT_STRING_EQUAL(mock_itrace_message_buffer, "Plugin: plugin ./testplugin.so loaded\n"); + + // check global plugin list not empty and contains correct pluginglobal_plugin_list + CU_ASSERT_NOT_EQUAL(global_plugin_list, NULL); + CU_ASSERT_EQUAL(global_plugin_list->plugin_handle, TEST_MOCK_PLUGIN_HANDLE); + + // release all loaded plugins + free_loaded_plugins(); + + // check if memory fully released + CU_ASSERT_EQUAL(global_plugin_list, NULL); + CU_ASSERT_EQUAL(get_memory_allocate_count(), 0); +} + +/* Test free loaded plugins */ +void testcase_release_loaded_plugin() { + set_test_scenario(TEST_SCEANRIO_PLUGIN_INIT_SUCCESS); + set_memory_allocate_count(0); + try_load_plugin_by_path("./testplugin.so"); + + // check memory allocated + CU_ASSERT_NOT_EQUAL(get_memory_allocate_count(), 0); + + // check plugin init success + CU_ASSERT_EQUAL(get_plugin_init_status(), PLUGIN_INITIALIZED); + + // release all loaded plugins + free_loaded_plugins(); + + // check if memory fully released + CU_ASSERT_EQUAL(global_plugin_list, NULL); + CU_ASSERT_EQUAL(get_memory_allocate_count(), 0); +} + +/* Test load plugin by config */ +void testcase_load_plugin_by_config() { + set_test_scenario(TEST_SCEANRIO_PLUGIN_INIT_SUCCESS); + set_memory_allocate_count(0); + load_plugin_by_config("./bash_plugins.conf"); + + // check memory allocated + CU_ASSERT_NOT_EQUAL(get_memory_allocate_count(), 0); + + // check plugin init success + CU_ASSERT_EQUAL(get_plugin_init_status(), PLUGIN_INITIALIZED); + + // check target plugin in config file loaded + CU_ASSERT_STRING_EQUAL(mock_itrace_message_buffer, "Plugin: plugin /usr/lib/bash-plugins/another_test_plugin.so loaded\n"); + + // check there are 2 plugins loaded + CU_ASSERT_EQUAL(get_memory_allocate_count(), 2); + + // release all loaded plugins + free_loaded_plugins(); + + // check if memory fully released + CU_ASSERT_EQUAL(global_plugin_list, NULL); + printf("Count %d\n", get_memory_allocate_count()); + CU_ASSERT_EQUAL(get_memory_allocate_count(), 0); +} + +/* Test invoke on_shell_execve plugin method */ +void testcase_invoke_plugin_on_shell_execve() { + set_test_scenario(TEST_SCEANRIO_PLUGIN_INIT_SUCCESS); + set_memory_allocate_count(0); + load_plugin_by_config("./bash_plugins.conf"); + + // invoke plugin method + char** pargv = (char**)0x5234; + invoke_plugin_on_shell_execve("testuser", "testcommand", pargv); + printf(mock_onshell_execve_command_buffer); + CU_ASSERT_STRING_EQUAL(mock_onshell_execve_command_buffer, "on_shell_execve: user: testuser, level: 1, command: testcommand, argv: 0x5234\n"); + + // release all loaded plugins + free_loaded_plugins(); + + // check if memory fully released + CU_ASSERT_EQUAL(global_plugin_list, NULL); + printf("Count %d\n", get_memory_allocate_count()); + CU_ASSERT_EQUAL(get_memory_allocate_count(), 0); +} + +int main(void) { + if (CUE_SUCCESS != CU_initialize_registry()) { + return CU_get_error(); + } + + CU_pSuite ste = CU_add_suite("plugin_test", start_up, clean_up); + if (NULL == ste) { + CU_cleanup_registry(); + return CU_get_error(); + } + + if (CU_get_error() != CUE_SUCCESS) { + fprintf(stderr, "Error creating suite: (%d)%s\n", CU_get_error(), CU_get_error_msg()); + return CU_get_error(); + } + + if (!CU_add_test(ste, "Test testcase_try_load_plugin_by_path_not_exist()...\n", testcase_try_load_plugin_by_path_not_exist)) { + CU_cleanup_registry(); + return CU_get_error(); + } + + if (!CU_add_test(ste, "Test testcase_try_load_plugin_by_path_execve_not_exist()...\n", testcase_try_load_plugin_by_path_execve_not_exist)) { + CU_cleanup_registry(); + return CU_get_error(); + } + + if (!CU_add_test(ste, "Test testcase_try_load_plugin_by_path_plugin_uninit_not_exist()...\n", testcase_try_load_plugin_by_path_plugin_uninit_not_exist)) { + CU_cleanup_registry(); + return CU_get_error(); + } + + if (!CU_add_test(ste, "Test testcase_try_load_plugin_by_path_plugin_init_not_exist()...\n", testcase_try_load_plugin_by_path_plugin_init_not_exist)) { + CU_cleanup_registry(); + return CU_get_error(); + } + + if (!CU_add_test(ste, "Test testcase_try_load_plugin_by_path_plugin_init_success()...\n", testcase_try_load_plugin_by_path_plugin_init_success)) { + CU_cleanup_registry(); + return CU_get_error(); + } + + if (!CU_add_test(ste, "Test testcase_release_loaded_plugin()...\n", testcase_release_loaded_plugin)) { + CU_cleanup_registry(); + return CU_get_error(); + } + + if (!CU_add_test(ste, "Test testcase_load_plugin_by_config()...\n", testcase_load_plugin_by_config)) { + CU_cleanup_registry(); + return CU_get_error(); + } + + if (!CU_add_test(ste, "Test testcase_invoke_plugin_on_shell_execve()...\n", testcase_invoke_plugin_on_shell_execve)) { + CU_cleanup_registry(); + return CU_get_error(); + } + + if (CU_get_error() != CUE_SUCCESS) { + fprintf(stderr, "Error adding test: (%d)%s\n", CU_get_error(), CU_get_error_msg()); + } + + // run all test + CU_basic_set_mode(CU_BRM_VERBOSE); + CU_ErrorCode run_errors = CU_basic_run_suite(ste); + if (run_errors != CUE_SUCCESS) { + fprintf(stderr, "Error running tests: (%d)%s\n", run_errors, CU_get_error_msg()); + } + + CU_basic_show_failures(CU_get_failure_list()); + + // use failed UT count as return value + return CU_get_number_of_failure_records(); +} diff --git a/src/bash/Makefile b/src/bash/Makefile index 6576ff92e74a..0d1b3817134d 100644 --- a/src/bash/Makefile +++ b/src/bash/Makefile @@ -5,12 +5,32 @@ SHELL = /bin/bash MAIN_TARGET = bash_$(BASH_VERSION_FULL)_$(CONFIGURED_ARCH).deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Quilt store applied patches info in .pc folder, if this folder not clean, quilt can't apply patches correctly. + rm -rf .pc rm -rf bash-$(BASH_VERSION_MAJOR) dget -u https://launchpad.net/debian/+archive/primary/+sourcefiles/bash/$(BASH_VERSION_FULL)/bash_$(BASH_VERSION_FULL).dsc + # Apply plugin suport patches + quilt push -a + pushd bash-$(BASH_VERSION_MAJOR) + + # build package DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -us -uc -b -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) + + # copy UT code. + cp -a ../Files/. ./ + + # generate config.h which need by UT + ./configure + + # generate 'pathnames.h' by make bash again, which is needed by UT. + make + + # run UT after config.h ready. + make -C unittest && make test -C unittest + popd mv $* $(DEST)/ diff --git a/src/bash/patches/0001-Add-plugin-support-to-bash.patch b/src/bash/patches/0001-Add-plugin-support-to-bash.patch new file mode 100644 index 000000000000..bec53ba8b5df --- /dev/null +++ b/src/bash/patches/0001-Add-plugin-support-to-bash.patch @@ -0,0 +1,805 @@ +From 79b3c4f7e8589afae4b048d662a56b055436e9ab Mon Sep 17 00:00:00 2001 +From: liuh-80 <58683130+liuh-80@users.noreply.github.com> +Date: Fri, 8 Oct 2021 16:36:34 +0800 +Subject: [PATCH] Add plugin support to bash. + +--- + bash-5.1/Makefile.in | 14 +- + bash-5.1/config.h.in | 3 + + bash-5.1/configure | 18 +- + bash-5.1/configure.ac | 10 + + bash-5.1/execute_cmd.c | 16 ++ + bash-5.1/plugin.c | 428 +++++++++++++++++++++++++++++++++++++++++ + bash-5.1/plugin.h | 79 ++++++++ + bash-5.1/shell.c | 12 ++ + 8 files changed, 571 insertions(+), 9 deletions(-) + create mode 100644 bash-5.1/plugin.c + create mode 100644 bash-5.1/plugin.h + +diff --git a/bash-5.1/Makefile.in b/bash-5.1/Makefile.in +index 3e3a5d4..16169cd 100644 +--- a/bash-5.1/Makefile.in ++++ b/bash-5.1/Makefile.in +@@ -380,6 +380,9 @@ LTLIBINTL = @LTLIBINTL@ + INTLLIBS = @INTLLIBS@ + INTLOBJS = @INTLOBJS@ + ++# Dynamic load library. ++DYNAMICLOAD_LIB = @DYNAMICLOAD_LIB@ ++ + # Our malloc. + MALLOC_TARGET = @MALLOC_TARGET@ + +@@ -421,7 +424,7 @@ BASHINCFILES = $(BASHINCDIR)/posixstat.h $(BASHINCDIR)/ansi_stdlib.h \ + $(BASHINCDIR)/ocache.h + + LIBRARIES = $(GLOB_LIB) $(SHLIB_LIB) $(READLINE_LIB) $(HISTORY_LIB) $(TERMCAP_LIB) \ +- $(TILDE_LIB) $(MALLOC_LIB) $(INTL_LIB) $(LIBICONV) $(LOCAL_LIBS) ++ $(TILDE_LIB) $(MALLOC_LIB) $(INTL_LIB) $(LIBICONV) $(LOCAL_LIBS) $(DYNAMICLOAD_LIB) + + LIBDEP = $(GLOB_DEP) $(SHLIB_DEP) $(INTL_DEP) $(READLINE_DEP) $(HISTORY_DEP) $(TERMCAP_DEP) \ + $(TILDE_DEP) $(MALLOC_DEP) +@@ -441,7 +444,7 @@ CSOURCES = shell.c eval.c parse.y general.c make_cmd.c print_cmd.c y.tab.c \ + input.c bashhist.c array.c arrayfunc.c assoc.c sig.c pathexp.c \ + unwind_prot.c siglist.c bashline.c bracecomp.c error.c \ + list.c stringlib.c locale.c findcmd.c redir.c \ +- pcomplete.c pcomplib.c syntax.c xmalloc.c ++ pcomplete.c pcomplib.c syntax.c xmalloc.c plugin.c + + HSOURCES = shell.h flags.h trap.h hashcmd.h hashlib.h jobs.h builtins.h \ + general.h variables.h config.h $(ALLOC_HEADERS) alias.h \ +@@ -449,7 +452,7 @@ HSOURCES = shell.h flags.h trap.h hashcmd.h hashlib.h jobs.h builtins.h \ + command.h input.h error.h bashansi.h dispose_cmd.h make_cmd.h \ + subst.h externs.h siglist.h bashhist.h bashline.h bashtypes.h \ + array.h arrayfunc.h sig.h mailcheck.h bashintl.h bashjmp.h \ +- execute_cmd.h parser.h pathexp.h pathnames.h pcomplete.h assoc.h \ ++ execute_cmd.h parser.h pathexp.h pathnames.h pcomplete.h assoc.h plugin.h \ + $(BASHINCFILES) + + SOURCES = $(CSOURCES) $(HSOURCES) $(BUILTIN_DEFS) +@@ -482,7 +485,7 @@ OBJECTS = shell.o eval.o y.tab.o general.o make_cmd.o print_cmd.o $(GLOBO) \ + trap.o input.o unwind_prot.o pathexp.o sig.o test.o version.o \ + alias.o array.o arrayfunc.o assoc.o braces.o bracecomp.o bashhist.o \ + bashline.o $(SIGLIST_O) list.o stringlib.o locale.o findcmd.o redir.o \ +- pcomplete.o pcomplib.o syntax.o xmalloc.o $(SIGNAMES_O) ++ pcomplete.o pcomplib.o syntax.o xmalloc.o plugin.o $(SIGNAMES_O) + + # Where the source code of the shell builtins resides. + BUILTIN_SRCDIR=$(srcdir)/builtins +@@ -1039,7 +1042,7 @@ eval.o: make_cmd.h subst.h sig.h pathnames.h externs.h parser.h + eval.o: input.h execute_cmd.h + eval.o: bashhist.h assoc.h ${BASHINCDIR}/ocache.h ${BASHINCDIR}/chartypes.h + execute_cmd.o: config.h bashtypes.h ${BASHINCDIR}/filecntl.h ${BASHINCDIR}/posixstat.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h +-execute_cmd.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h ++execute_cmd.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h plugin.h + execute_cmd.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h + execute_cmd.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h + execute_cmd.o: make_cmd.h subst.h sig.h pathnames.h externs.h parser.h +@@ -1050,6 +1053,7 @@ execute_cmd.o: ${BASHINCDIR}/posixtime.h ${BASHINCDIR}/chartypes.h + execute_cmd.o: $(DEFSRC)/getopt.h + execute_cmd.o: bashhist.h input.h ${GRAM_H} assoc.h hashcmd.h alias.h + execute_cmd.o: ${BASHINCDIR}/ocache.h ${BASHINCDIR}/posixwait.h ++plugin.o: plugin.h + expr.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h + expr.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h + expr.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h +diff --git a/bash-5.1/config.h.in b/bash-5.1/config.h.in +index ab316d4..ab5634f 100644 +--- a/bash-5.1/config.h.in ++++ b/bash-5.1/config.h.in +@@ -38,6 +38,9 @@ + BSD-like job control. */ + #undef JOB_CONTROL + ++/* Define BASH_SHELL_EXECVE_PLUGIN if need plugin support. */ ++#undef BASH_SHELL_EXECVE_PLUGIN ++ + /* Define ALIAS if you want the alias features. */ + #undef ALIAS + +diff --git a/bash-5.1/configure b/bash-5.1/configure +index 0f1d3ed..c462d55 100644 +--- a/bash-5.1/configure ++++ b/bash-5.1/configure +@@ -632,6 +632,7 @@ LOCAL_DEFS + LOCAL_LDFLAGS + LOCAL_CFLAGS + LOCAL_LIBS ++DYNAMICLOAD_LIB + MALLOC_DEBUG + DEBUG + RELSTATUS +@@ -858,6 +859,7 @@ enable_single_help_strings + enable_strict_posix_default + enable_usg_echo_default + enable_xpg_echo_default ++enable_bash_shell_execve_plugin + enable_mem_scramble + enable_profiling + enable_static_link +@@ -1568,6 +1570,7 @@ Optional Features: + --enable-xpg-echo-default + make the echo builtin expand escape sequences by + default ++ --enable-bash-plugin enable bash plugin features + --enable-mem-scramble scramble memory on calls to malloc and free + --enable-profiling allow profiling with gprof + --enable-static-link link bash statically, for use as a root shell +@@ -3027,6 +3030,7 @@ opt_dircomplete_expand_default=no + opt_globascii_default=yes + opt_function_import=yes + opt_dev_fd_stat_broken=no ++opt_bash_shell_execve_plugin=yes + + opt_static_link=no + opt_profiling=no +@@ -3048,6 +3052,7 @@ if test $opt_minimal_config = yes; then + opt_multibyte=yes opt_cond_regexp=no opt_coproc=no + opt_casemod_attrs=no opt_casemod_expansions=no opt_extglob_default=no + opt_globascii_default=yes ++ opt_bash_shell_execve_plugin=no + fi + + # Check whether --enable-alias was given. +@@ -3235,6 +3240,10 @@ if test "${enable_xpg_echo_default+set}" = set; then : + enableval=$enable_xpg_echo_default; opt_xpg_echo=$enableval + fi + ++# Check whether --enable-bash-shell-execve-plugin was given. ++if test "${enable_bash_shell_execve_plugin+set}" = set; then : ++ enableval=$enable_bash_shell_execve_plugin; opt_bash_shell_execve_plugin=$enableval ++fi + + # Check whether --enable-mem-scramble was given. + if test "${enable_mem_scramble+set}" = set; then : +@@ -3254,10 +3263,11 @@ fi + + + +- +- +- +- ++DYNAMICLOAD_LIB= ++if test $opt_bash_shell_execve_plugin = yes; then ++$as_echo "#define BASH_SHELL_EXECVE_PLUGIN 1" >>confdefs.h ++DYNAMICLOAD_LIB=-ldl ++fi + + if test $opt_alias = yes; then + $as_echo "#define ALIAS 1" >>confdefs.h +diff --git a/bash-5.1/configure.ac b/bash-5.1/configure.ac +index 2fe3e7d..0064683 100644 +--- a/bash-5.1/configure.ac ++++ b/bash-5.1/configure.ac +@@ -182,6 +182,7 @@ opt_dircomplete_expand_default=no + opt_globascii_default=yes + opt_function_import=yes + opt_dev_fd_stat_broken=no ++opt_bash_shell_execve_plugin=yes + + dnl options that affect how bash is compiled and linked + opt_static_link=no +@@ -203,6 +204,7 @@ if test $opt_minimal_config = yes; then + opt_multibyte=yes opt_cond_regexp=no opt_coproc=no + opt_casemod_attrs=no opt_casemod_expansions=no opt_extglob_default=no + opt_globascii_default=yes ++ opt_bash_shell_execve_plugin=no + fi + + AC_ARG_ENABLE(alias, AC_HELP_STRING([--enable-alias], [enable shell aliases]), opt_alias=$enableval) +@@ -242,6 +244,7 @@ AC_ARG_ENABLE(single-help-strings, AC_HELP_STRING([--enable-single-help-strings] + AC_ARG_ENABLE(strict-posix-default, AC_HELP_STRING([--enable-strict-posix-default], [configure bash to be posix-conformant by default]), opt_strict_posix=$enableval) + AC_ARG_ENABLE(usg-echo-default, AC_HELP_STRING([--enable-usg-echo-default], [a synonym for --enable-xpg-echo-default]), opt_xpg_echo=$enableval) + AC_ARG_ENABLE(xpg-echo-default, AC_HELP_STRING([--enable-xpg-echo-default], [make the echo builtin expand escape sequences by default]), opt_xpg_echo=$enableval) ++AC_ARG_ENABLE(bash-shell-execve-plugin, AC_HELP_STRING([--enable-bash-shell-execve-plugin], [enable bash shell execve plugin features]), opt_bash_shell_execve_plugin=$enableval) + + dnl options that alter how bash is compiled and linked + AC_ARG_ENABLE(mem-scramble, AC_HELP_STRING([--enable-mem-scramble], [scramble memory on calls to malloc and free]), opt_memscramble=$enableval) +@@ -260,6 +263,13 @@ dnl opt_readline and opt_history are handled later, because AC_PROG_CC needs + dnl to be run before we can check the version of an already-installed readline + dnl library + ++DYNAMICLOAD_LIB= ++if test $opt_bash_shell_execve_plugin = yes; then ++AC_DEFINE(BASH_SHELL_EXECVE_PLUGIN) ++DYNAMICLOAD_LIB=-ldl ++fi ++AC_SUBST(DYNAMICLOAD_LIB) ++ + if test $opt_alias = yes; then + AC_DEFINE(ALIAS) + fi +diff --git a/bash-5.1/execute_cmd.c b/bash-5.1/execute_cmd.c +index d2a0dd7..fb05489 100644 +--- a/bash-5.1/execute_cmd.c ++++ b/bash-5.1/execute_cmd.c +@@ -82,6 +82,10 @@ extern int errno; + # include "test.h" + #endif + ++#if defined (BASH_SHELL_EXECVE_PLUGIN) ++#include "plugin.h" ++#endif /* BASH_SHELL_EXECVE_PLUGIN */ ++ + #include "builtins/common.h" + #include "builtins/builtext.h" /* list of builtins */ + +@@ -5592,6 +5596,18 @@ execute_disk_command (words, redirects, command_line, pipe_in, pipe_out, + leave it there, in the same format that the user used to + type it in. */ + args = strvec_from_word_list (words, 0, 0, (int *)NULL); ++ ++#if defined (BASH_SHELL_EXECVE_PLUGIN) ++ result = invoke_plugin_on_shell_execve (current_user.user_name, command, args); ++ ++#if defined (DEBUG) ++ itrace("invoke_plugin_on_shell_execve: failed invoke plugin with user:%s, command:%s, result: %d", current_user.user_name, command, result); ++#endif ++ if (result) { ++ exit (EXECUTION_FAILURE); ++ } ++#endif /* BASH_SHELL_EXECVE_PLUGIN */ ++ + exit (shell_execve (command, args, export_env)); + } + else +diff --git a/bash-5.1/plugin.c b/bash-5.1/plugin.c +new file mode 100644 +index 0000000..df72830 +--- /dev/null ++++ b/bash-5.1/plugin.c +@@ -0,0 +1,428 @@ ++/* plugin.c -- Bash plugin support. */ ++ ++/* Copyright (C) 1987-2016 Free Software Foundation, Inc. ++ ++ This file is part of GNU Bash, the Bourne Again SHell. ++ ++ Bash is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation, either version 3 of the License, or ++ (at your option) any later version. ++ ++ Bash is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with Bash. If not, see . ++*/ ++ ++#include "config.h" ++ ++#if !defined (__GNUC__) && !defined (HAVE_ALLOCA_H) && defined (_AIX) ++ #pragma alloca ++#endif /* _AIX && RISC6000 && !__GNUC__ */ ++ ++// disable bash memory management when build for UT, PTR_T defined in xmalloc.h, define here for disable warning ++#if defined (BASH_PLUGIN_UT) ++# define _XMALLOC_H_ ++# define PTR_T void * ++# define malloc mock_malloc ++# define free mock_free ++#else ++#endif ++ ++#include ++#include ++#include "chartypes.h" ++#include "bashtypes.h" ++#if !defined (_MINIX) && defined (HAVE_SYS_FILE_H) ++# include ++#endif ++#include "filecntl.h" ++#include "posixstat.h" ++#include ++#include ++#if defined (HAVE_SYS_PARAM_H) ++# include ++#endif ++ ++#if defined (HAVE_UNISTD_H) ++# include ++#endif ++ ++#include "posixtime.h" ++ ++#if defined (HAVE_SYS_RESOURCE_H) && !defined (RLIMTYPE) ++# include ++#endif ++ ++#if defined (HAVE_SYS_TIMES_H) && defined (HAVE_TIMES) ++# include ++#endif ++ ++#include ++ ++#if !defined (errno) ++extern int errno; ++#endif ++ ++#define NEED_FPURGE_DECL ++#define NEED_SH_SETLINEBUF_DECL ++ ++#include "bashansi.h" ++#include "bashintl.h" ++ ++#include "shell.h" ++#include /* use <...> so we pick it up from the build directory */ ++#include "error.h" ++#include "flags.h" ++#include "builtins.h" ++#include "hashlib.h" ++#include "jobs.h" ++#include "execute_cmd.h" ++#include "findcmd.h" ++#include "redir.h" ++#include "trap.h" ++#include "pathexp.h" ++#include "hashcmd.h" ++ ++ ++#if defined (BASH_SHELL_EXECVE_PLUGIN) ++#include "plugin.h" ++#endif /* BASH_SHELL_EXECVE_PLUGIN */ ++ ++#if defined (COND_COMMAND) ++# include "test.h" ++#endif ++ ++#include "builtins/common.h" ++ ++#include "builtins/getopt.h" ++ ++#include ++#include ++ ++#if defined (BUFFERED_INPUT) ++# include "input.h" ++#endif ++ ++#if defined (ALIAS) ++# include "alias.h" ++#endif ++ ++#if defined (HISTORY) ++# include "bashhist.h" ++#endif ++ ++#if defined (HAVE_MBSTR_H) && defined (HAVE_MBSCHR) ++# include /* mbschr */ ++#endif ++ ++/* configuration buffer size */ ++#define CONFIG_BUFFER_SIZE 256 ++ ++/* configuration plugin setting key */ ++#define CONFIG_PLUGIN_SETTING_KEY "plugin=" ++ ++/* configuration termination characters */ ++#define CONFIG_SETTING_TERMINATIONS " \t\n\r\f" ++ ++/* configuration comments start character */ ++#define CONFIG_SETTING_COMMENTS_START_CHAR '#' ++ ++/* plugin configration file */ ++const char *plugin_config_file = "/etc/bash_plugins.conf"; ++ ++/* plugin on_shell_execve function name */ ++static const char *on_shell_execve_function_name = "on_shell_execve"; ++ ++/* plugin plugin_init function name */ ++static const char *plugin_init_function_name = "plugin_init"; ++ ++/* plugin plugin_uninit function name */ ++static const char *plugin_uninit_function_name = "plugin_uninit"; ++ ++/* plugin handle for test */ ++PLUGIN_NODE *global_plugin_list = NULL; ++ ++/* Load plugin by plugin path */ ++int ++append_plugin( ++ plugin_handle, ++ on_shell_execve, ++ plugin_init, ++ plugin_uninit) ++ void *plugin_handle; ++ on_shell_execve_t *on_shell_execve; ++ plugin_init_t *plugin_init; ++ plugin_uninit_t *plugin_uninit; ++{ ++ /* Create and initialize new plugin */ ++ PLUGIN_NODE *new_plugin_node = (PLUGIN_NODE*)malloc(sizeof(PLUGIN_NODE)); ++ if (new_plugin_node == NULL) ++ { ++ /* When allocate memory failed, stop and return. also output log to both syslog and stderr with LOG_PERROR*/ ++ syslog(LOG_PERROR, "Plugin: failed to allocate memory for plugin node.\n"); ++ return PLUGIN_LOAD_FAILED; ++ } ++ ++ new_plugin_node->next = NULL; ++ new_plugin_node->plugin_handle = plugin_handle; ++ new_plugin_node->on_shell_execve = on_shell_execve; ++ new_plugin_node->plugin_init = plugin_init; ++ new_plugin_node->plugin_uninit = plugin_uninit; ++ ++#ifdef DEBUG ++ itrace("Plugin: append plugin node %p to global list %p\n", new_plugin_node, global_plugin_list); ++#endif ++ ++ /* Find the pointer to the latest plugin node's 'next' field */ ++ PLUGIN_NODE **current_plugin_node = &global_plugin_list; ++ while (*current_plugin_node != NULL) { ++ current_plugin_node = &((*current_plugin_node)->next); ++ ++#ifdef DEBUG ++ itrace("Plugin: founded next plugin node: %p\n", *current_plugin_node); ++#endif ++ } ++ ++ /* append new plugin to tail node */ ++ *current_plugin_node = new_plugin_node; ++ ++#ifdef DEBUG ++ itrace("Plugin: append new plugin node %p to %p\n", new_plugin_node, current_plugin_node); ++#endif ++ ++ return PLUGIN_LOAD_SUCCESS; ++} ++ ++ ++/* Load plugin by plugin path */ ++void ++try_load_plugin_by_path(plugin_path) ++ const char *plugin_path; ++{ ++ /* Plugin handle */ ++ void *plugin_handle; ++ if ( (plugin_handle = dlopen(plugin_path, RTLD_LAZY)) == NULL) { ++#ifdef DEBUG ++ itrace("Plugin: can't load plugin %s: %s\n", plugin_path, dlerror()); ++#endif ++ return; ++ } ++ ++ /* Check if plugin support shell execve method */ ++ on_shell_execve_t* plugin_on_shell_execve_handle = dlsym(plugin_handle, on_shell_execve_function_name); ++ if (dlerror() != NULL) { ++ dlclose(plugin_handle); ++ ++#ifdef DEBUG ++ itrace("Plugin: can't find on_shell_execve function %s: %s\n", plugin_path, dlerror()); ++#endif ++ return; ++ } ++ ++ ++ /* Check if plugin support un-initialization method */ ++ plugin_uninit_t* plugin_uninit_handle = dlsym(plugin_handle, plugin_uninit_function_name); ++ if (dlerror() != NULL) { ++ dlclose(plugin_handle); ++ ++#ifdef DEBUG ++ itrace("Plugin: can't find plugin_uninit function %s: %s\n", plugin_path, dlerror()); ++#endif ++ return; ++ } ++ ++ /* Check if plugin support initialization method */ ++ plugin_init_t* plugin_init_handle = dlsym(plugin_handle, plugin_init_function_name); ++ if (dlerror() != NULL) { ++ dlclose(plugin_handle); ++ ++#ifdef DEBUG ++ itrace("Plugin: can't find plugin_init function %s: %s\n", plugin_path, dlerror()); ++#endif ++ return; ++ } ++ else { ++ /* Initialize plugin */ ++ plugin_init_handle(); ++ } ++ ++ /* Add plugin to plugin list */ ++ int plugin_load_result = append_plugin(plugin_handle, ++ plugin_on_shell_execve_handle, ++ plugin_init_handle, ++ plugin_uninit_handle); ++ ++ if (plugin_load_result == PLUGIN_LOAD_SUCCESS) { ++#ifdef DEBUG ++ itrace("Plugin: plugin %s loaded\n", plugin_path); ++#endif ++ } ++ else { ++ /* Output plugin load error message, also output log to both syslog and stderr with LOG_PERROR*/ ++ syslog(LOG_PERROR,"Plugin: plugin %s load failed, result: %d\n", plugin_path, plugin_load_result); ++ } ++} ++ ++/* Load plugin by config file */ ++void ++load_plugin_by_config(config_filename) ++ const char *config_filename; ++{ ++ FILE *config_file; ++ char buffer[CONFIG_BUFFER_SIZE]; ++ ++ config_file = fopen(config_filename, "r"); ++ if(config_file == NULL) { ++#ifdef DEBUG ++ itrace("Plugin: can't open plugin config file %s: %s\n", config_filename, strerror(errno)); ++#endif ++ return; ++ } ++ ++ while(fgets(buffer, sizeof buffer, config_file)) { ++ if(*buffer == CONFIG_SETTING_COMMENTS_START_CHAR || isspace(*buffer)) { ++ /* ignore comments or white space. */ ++ continue; ++ } ++ ++ /* read to first whitespace. */ ++ strtok(buffer, CONFIG_SETTING_TERMINATIONS); ++ ++ if(!strncmp(buffer, CONFIG_PLUGIN_SETTING_KEY, strlen(CONFIG_PLUGIN_SETTING_KEY))) { ++ /* read plugin path. */ ++ char* plugin_path = strtok(buffer + strlen(CONFIG_PLUGIN_SETTING_KEY), CONFIG_SETTING_TERMINATIONS); ++#ifdef DEBUG ++ itrace("Plugin: load plugin: %s\n", plugin_path); ++#endif ++ try_load_plugin_by_path(plugin_path); ++ } ++#ifdef DEBUG ++ else { ++ /* output debug message. */ ++ itrace("Plugin: unrecognized parameter: %s\n", buffer); ++ } ++#endif ++ } ++ ++ fclose(config_file); ++} ++ ++/* Free loaded plugins */ ++void ++free_loaded_plugins() ++{ ++ if (global_plugin_list == NULL) { ++ return; ++ } ++ ++#ifdef DEBUG ++ itrace("Plugin: start free plugin from global list %p\n", global_plugin_list); ++#endif ++ ++ /* Walk to last plugin */ ++ PLUGIN_NODE *next_plugin_node = global_plugin_list; ++ while (next_plugin_node != NULL) { ++ ++ /* Unload plugin */ ++ next_plugin_node->plugin_uninit(); ++ dlclose(next_plugin_node->plugin_handle); ++ ++ /* Continue with next pligin */ ++ PLUGIN_NODE* current_plugin_node_memory = next_plugin_node; ++ next_plugin_node = next_plugin_node->next; ++ ++#ifdef DEBUG ++ itrace("Plugin: next plugin address %p\n", next_plugin_node); ++#endif ++ ++ /* Free plugin node memory, this may also reset all allocated memory depends on c lib implementation */ ++ free(current_plugin_node_memory); ++ } ++ ++ /* Reset plugin list */ ++ global_plugin_list = NULL; ++} ++ ++/* Invoke loaded plugins */ ++int ++invoke_loaded_plugins (user, shell_level, cmd, argv) ++ char *user; ++ int shell_level; ++ char *cmd; ++ char **argv; ++{ ++ if (global_plugin_list == NULL) { ++ return 0; ++ } ++ ++#ifdef DEBUG ++ itrace("Plugin: start invoke plugin from global list %p\n", global_plugin_list); ++#endif ++ ++ /* Walk to last plugin */ ++ PLUGIN_NODE *next_plugin_node = global_plugin_list; ++ while (next_plugin_node != NULL) { ++ ++ /* Call plugin method */ ++ int plugin_error_code = next_plugin_node->on_shell_execve(user, shell_level, cmd, argv); ++ if (plugin_error_code != 0) { ++#ifdef DEBUG ++ itrace("Plugin: on_execve return error: %d\n", plugin_error_code); ++#endif ++ /* Exit when plugin failed */ ++ return plugin_error_code; ++ } ++ ++ /* Continue with next pligin */ ++ next_plugin_node = next_plugin_node->next; ++ ++#ifdef DEBUG ++ itrace("Plugin: next plugin address %p\n", next_plugin_node); ++#endif ++ } ++ ++ return 0; ++} ++ ++/* Load all plugins。 */ ++void ++load_plugins () ++{ ++ load_plugin_by_config(plugin_config_file); ++} ++ ++/* Free all plugins */ ++void ++free_plugins () ++{ ++ free_loaded_plugins(); ++} ++ ++/* Invoke plugins before shell execve */ ++int ++invoke_plugin_on_shell_execve (user, cmd, argv) ++ char *user; ++ char *cmd; ++ char **argv; ++{ ++ const char* shell_level_str = get_string_value ("SHLVL"); ++ const int shell_level = atoi (shell_level_str); ++ ++ if (absolute_program (cmd)) { ++ // find real path for relative path command ++ char resolved_path[PATH_MAX]; ++ ++ // real_path_buffer should not free here because we pass resolved_path as parameter. ++ char* real_path_buffer = realpath(cmd, resolved_path); ++ ++ return invoke_loaded_plugins(user, shell_level, resolved_path, argv); ++ } ++ else { ++ return invoke_loaded_plugins(user, shell_level, cmd, argv); ++ } ++} +diff --git a/bash-5.1/plugin.h b/bash-5.1/plugin.h +new file mode 100644 +index 0000000..116b2c5 +--- /dev/null ++++ b/bash-5.1/plugin.h +@@ -0,0 +1,79 @@ ++/* plugin.h - functions from plugin.c. */ ++ ++/* Copyright (C) 1993-2015 Free Software Foundation, Inc. ++ ++ This file is part of GNU Bash, the Bourne Again SHell. ++ ++ Bash is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation, either version 3 of the License, or ++ (at your option) any later version. ++ ++ Bash is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with Bash. If not, see . ++*/ ++ ++#if !defined (_PLUGIN_H_) ++#define _PLUGIN_H_ ++ ++#include "stdc.h" ++ ++/* System-wide bash plugin configuration. */ ++#define SYS_BASH_PLUGIN "/etc/bash.plugin" ++ ++/* Plugin load result. */ ++#define PLUGIN_LOAD_SUCCESS 0 ++#define PLUGIN_LOAD_FAILED 1 ++ ++typedef enum { T_COMMAND } plugin_type_t; ++ ++/* Bash plugin config. */ ++typedef struct bash_plugin_conf ++{ ++ const char *path; /* path to binary */ ++ char *name; /* Used to distinguish plugins */ ++} bash_plugin_conf_t; ++ ++/* plugin on_shell_execve function handle type */ ++typedef int on_shell_execve_t (char *user, int shell_level, char *cmd, char **argv); ++ ++/* plugin plugin_init function handle type */ ++typedef int plugin_init_t (); ++ ++/* plugin plugin_uninit function handle type */ ++typedef int plugin_uninit_t (); ++ ++/* Plugin list node. */ ++typedef struct plugin_node { ++ ++ /* Next plugin pointer. */ ++ struct plugin_node *next; ++ ++ /* Plugin library handle. */ ++ void *plugin_handle; ++ ++ /* Plugin on_shell_execve function handle. */ ++ on_shell_execve_t *on_shell_execve; ++ ++ /* Plugin plugin_init function handle. */ ++ plugin_init_t *plugin_init; ++ ++ /* Plugin plugin_uninit function handle. */ ++ plugin_uninit_t *plugin_uninit; ++} PLUGIN_NODE; ++ ++/* Load all plugins */ ++extern void load_plugins __P((void)); ++ ++/* Free all plugins */ ++extern void free_plugins __P((void)); ++ ++/* Invoke plugins before shell execve */ ++extern int invoke_plugin_on_shell_execve __P((char *, char *, char **)); ++ ++#endif /* _PLUGIN_H_ */ +diff --git a/bash-5.1/shell.c b/bash-5.1/shell.c +index ce8087f..6928208 100644 +--- a/bash-5.1/shell.c ++++ b/bash-5.1/shell.c +@@ -46,6 +46,10 @@ + # include + #endif + ++#if defined (BASH_SHELL_EXECVE_PLUGIN) ++#include "plugin.h" ++#endif /* BASH_SHELL_EXECVE_PLUGIN */ ++ + #include "bashintl.h" + + #define NEED_SH_SETLINEBUF_DECL /* used in externs.h */ +@@ -567,6 +571,10 @@ main (argc, argv, env) + if (shopt_alist) + run_shopt_alist (); + ++#if defined (BASH_SHELL_EXECVE_PLUGIN) ++ load_plugins (); ++#endif /* BASH_SHELL_EXECVE_PLUGIN */ ++ + /* From here on in, the shell must be a normal functioning shell. + Variables from the environment are expected to be set, etc. */ + shell_initialize (); +@@ -810,6 +818,10 @@ main (argc, argv, env) + /* Read commands until exit condition. */ + reader_loop (); + exit_shell (last_command_exit_value); ++ ++#if defined (BASH_SHELL_EXECVE_PLUGIN) ++ free_plugins (); ++#endif /* BASH_SHELL_EXECVE_PLUGIN */ + } + + static int +-- +2.17.1.windows.2 + diff --git a/src/bash/patches/series b/src/bash/patches/series new file mode 100644 index 000000000000..a27ad05ca28b --- /dev/null +++ b/src/bash/patches/series @@ -0,0 +1 @@ +0001-Add-plugin-support-to-bash.patch \ No newline at end of file diff --git a/src/dhcp6relay/Makefile b/src/dhcp6relay/Makefile index 4cbeb37fd188..dd384452a5fc 100644 --- a/src/dhcp6relay/Makefile +++ b/src/dhcp6relay/Makefile @@ -4,8 +4,8 @@ CP := cp MKDIR := mkdir CC := g++ MV := mv -LIBS := -levent -lhiredis -lswsscommon -pthread -lboost_thread -lboost_system -I $(PWD)/../sonic-swss-common/common -CFLAGS = -g -Wall -std=gnu11 +LIBS := -levent -lhiredis -lswsscommon -pthread -lboost_thread -lboost_system +CFLAGS += -Wall -std=c++17 -fPIE -I$(PWD)/../sonic-swss-common/common PWD := $(shell pwd) ifneq ($(MAKECMDGOALS),clean) @@ -21,7 +21,7 @@ all: sonic-dhcp6relay sonic-dhcp6relay: $(OBJS) @echo 'Building target: $@' @echo 'Invoking: G++ Linker' - $(CC) -o $(DHCP6RELAY_TARGET) $(OBJS) $(LIBS) + $(CC) $(LDFLAGS) -o $(DHCP6RELAY_TARGET) $(OBJS) $(LIBS) @echo 'Finished building target: $@' @echo ' ' diff --git a/src/dhcp6relay/debian/compat b/src/dhcp6relay/debian/compat index ec635144f600..48082f72f087 100644 --- a/src/dhcp6relay/debian/compat +++ b/src/dhcp6relay/debian/compat @@ -1 +1 @@ -9 +12 diff --git a/src/dhcp6relay/debian/control b/src/dhcp6relay/debian/control index 31fdb6f41f3b..af7877fef9a8 100644 --- a/src/dhcp6relay/debian/control +++ b/src/dhcp6relay/debian/control @@ -2,8 +2,7 @@ Source: sonic-dhcp6relay Section: devel Priority: optional Maintainer: Kelly Yeh -Build-Depends: debhelper (>= 8.0.0), - dh-systemd +Build-Depends: debhelper (>= 12.0.0), libevent-dev, libboost-thread-dev, libboost-system-dev, libswsscommon-dev Standards-Version: 3.9.3 Homepage: https://github.com/Azure/sonic-buildimage XS-Go-Import-Path: github.com/Azure/sonic-buildimage @@ -11,7 +10,5 @@ XS-Go-Import-Path: github.com/Azure/sonic-buildimage Package: sonic-dhcp6relay Architecture: any Built-Using: ${misc:Built-Using} -Depends: libevent-2.1-6, - libboost-thread1.71.0, - libboost-system1.71.0 +Depends: ${shlibs:Depends} Description: SONiC DHCPv6 Relay diff --git a/src/dhcp6relay/debian/rules b/src/dhcp6relay/debian/rules index ce2eb52beb5d..ac2cd63889ef 100755 --- a/src/dhcp6relay/debian/rules +++ b/src/dhcp6relay/debian/rules @@ -1,4 +1,6 @@ #!/usr/bin/make -f +export DEB_BUILD_MAINT_OPTIONS=hardening=+all + %: dh $@ --parallel diff --git a/src/dhcp6relay/src/configInterface.cpp b/src/dhcp6relay/src/configInterface.cpp index 0af4f49a285f..ca78d80e63da 100644 --- a/src/dhcp6relay/src/configInterface.cpp +++ b/src/dhcp6relay/src/configInterface.cpp @@ -119,6 +119,7 @@ void processRelayNotification(std::deque &entries, relay_config intf; intf.is_option_79 = true; intf.interface = vlan; + intf.db = nullptr; for (auto &fieldValue: fieldValues) { std::string f = fvField(fieldValue); std::string v = fvValue(fieldValue); diff --git a/src/dhcp6relay/src/relay.cpp b/src/dhcp6relay/src/relay.cpp index e2eb8e4fac12..234646c1fb74 100644 --- a/src/dhcp6relay/src/relay.cpp +++ b/src/dhcp6relay/src/relay.cpp @@ -49,7 +49,8 @@ const struct sock_fprog ether_relay_fprog = { /* DHCPv6 Counter */ uint64_t counters[DHCPv6_MESSAGE_TYPE_COUNT]; -std::map counterMap = {{1, "Solicit"}, +std::map counterMap = {{0, "Unknown"}, + {1, "Solicit"}, {2, "Advertise"}, {3, "Request"}, {4, "Confirm"}, @@ -72,6 +73,7 @@ std::map counterMap = {{1, "Solicit"}, * @return none */ void initialize_counter(swss::DBConnector *db, std::string counterVlan) { + db->hset(counterVlan, "Unknown", toString(counters[DHCPv6_MESSAGE_TYPE_UNKNOWN])); db->hset(counterVlan, "Solicit", toString(counters[DHCPv6_MESSAGE_TYPE_SOLICIT])); db->hset(counterVlan, "Advertise", toString(counters[DHCPv6_MESSAGE_TYPE_ADVERTISE])); db->hset(counterVlan, "Request", toString(counters[DHCPv6_MESSAGE_TYPE_REQUEST])); @@ -116,34 +118,6 @@ std::string toString(uint16_t count) { return countValue; } -/** - * @code bool is_addr_gua(in6_addr addr); - * - * @brief check if address is global - * - * @param addr ipv6 address - * - * @return bool - */ -bool is_addr_gua(in6_addr addr) { - auto masked = addr.__in6_u.__u6_addr8[0] & 0xe0; - return (masked ^ 0x20) == 0x00; -} - -/** - * @code is_addr_link_local(in6_addr addr); - * - * @brief check if address is link_local - * - * @param addr ipv6 address - * - * @return bool - */ -bool is_addr_link_local(in6_addr addr) { - auto masked = ntohs(addr.__in6_u.__u6_addr16[0]) & 0xffc0; - return (masked ^ 0xfe80) == 0x0000; -} - /** * @code const struct ether_header *parse_ether_frame(const uint8_t *buffer, const uint8_t **out_end); * @@ -236,19 +210,28 @@ const struct dhcpv6_option *parse_dhcpv6_opt(const uint8_t *buffer, const uint8_ } /** - * @code void send_udp(int sock, uint8_t *buffer, struct sockaddr_in6 target, uint32_t n); + * @code void send_udp(int sock, uint8_t *buffer, struct sockaddr_in6 target, uint32_t n, relay_config *config, uint8_t msg_type); * * @brief send udp packet * * @param *buffer message buffer * @param sockaddr_in6 target target socket * @param n length of message + * @param relay_config *config pointer to relay_config + * @param uint8_t msg_type message type of dhcpv6 option of relayed message * * @return dhcpv6_option end of dhcpv6 message option */ -void send_udp(int sock, uint8_t *buffer, struct sockaddr_in6 target, uint32_t n) { +void send_udp(int sock, uint8_t *buffer, struct sockaddr_in6 target, uint32_t n, relay_config *config, uint8_t msg_type) { + std::string counterVlan = counter_table; if(sendto(sock, buffer, n, 0, (const struct sockaddr *)&target, sizeof(target)) == -1) syslog(LOG_ERR, "sendto: Failed to send to target address\n"); + else if (counterMap.find(msg_type) != counterMap.end()) { + counters[msg_type]++; + update_counter(config->db, counterVlan.append(config->interface), msg_type); + } else { + syslog(LOG_WARNING, "unexpected message type %d(0x%x)\n", msg_type, msg_type); + } } /** @@ -356,11 +339,11 @@ void prepare_relay_config(relay_config *interface_config, int *local_sock, int f while (ifa_tmp) { if (ifa_tmp->ifa_addr->sa_family == AF_INET6) { struct sockaddr_in6 *in6 = (struct sockaddr_in6*) ifa_tmp->ifa_addr; - if((strcmp(ifa_tmp->ifa_name, interface_config->interface.c_str()) == 0) && is_addr_gua(in6->sin6_addr)) { + if((strcmp(ifa_tmp->ifa_name, interface_config->interface.c_str()) == 0) && !IN6_IS_ADDR_LINKLOCAL(&in6->sin6_addr)) { non_link_local = *in6; break; } - if((strcmp(ifa_tmp->ifa_name, interface_config->interface.c_str()) == 0) && is_addr_link_local(in6->sin6_addr)) { + if((strcmp(ifa_tmp->ifa_name, interface_config->interface.c_str()) == 0) && IN6_IS_ADDR_LINKLOCAL(&in6->sin6_addr)) { link_local = *in6; } } @@ -368,7 +351,7 @@ void prepare_relay_config(relay_config *interface_config, int *local_sock, int f } freeifaddrs(ifa); - if(is_addr_gua(non_link_local.sin6_addr)) { + if(!IN6_IS_ADDR_LINKLOCAL(&non_link_local.sin6_addr)) { interface_config->link_address = non_link_local; } else { @@ -377,33 +360,63 @@ void prepare_relay_config(relay_config *interface_config, int *local_sock, int f } /** - * @code prepare_socket(int *local_sock); + * @code prepare_socket(int *local_sock, int *server_sock, relay_config *config, int index); * * @brief prepare L3 socket for sending * - * @param local_sock pointer to socket to be prepared + * @param local_sock pointer to socket binded to global address for relaying client message to server and listening for server message + * @param server_sock pointer to socket binded to link_local address for relaying server message to client + * @param index scope id of interface * * @return none */ -void prepare_socket(int *local_sock) { - int flag = 1; +void prepare_socket(int *local_sock, int *server_sock, relay_config *config, int index) { + struct ifaddrs *ifa, *ifa_tmp; sockaddr_in6 addr; + sockaddr_in6 ll_addr; memset(&addr, 0, sizeof(addr)); - addr.sin6_family = AF_INET6; - addr.sin6_addr = in6addr_any; - addr.sin6_port = htons(RELAY_PORT); + memset(&ll_addr, 0, sizeof(ll_addr)); if ((*local_sock = socket(AF_INET6, SOCK_DGRAM, 0)) == -1) { syslog(LOG_ERR, "socket: Failed to create socket\n"); } - if((setsockopt(*local_sock, SOL_SOCKET, SO_REUSEADDR, &flag, sizeof(flag))) == -1) { - syslog(LOG_ERR, "setsockopt: Unable to set socket option\n"); - } + if ((*server_sock= socket(AF_INET6, SOCK_DGRAM, 0)) == -1) { + syslog(LOG_ERR, "socket: Failed to create socket\n"); + } + + + if (getifaddrs(&ifa) == -1) { + syslog(LOG_WARNING, "getifaddrs: Unable to get network interfaces\n"); + exit(1); + } + + ifa_tmp = ifa; + while (ifa_tmp) { + if (ifa_tmp->ifa_addr->sa_family == AF_INET6) { + struct sockaddr_in6 *in6 = (struct sockaddr_in6*) ifa_tmp->ifa_addr; + if((strcmp(ifa_tmp->ifa_name, config->interface.c_str()) == 0) && !IN6_IS_ADDR_LINKLOCAL(&in6->sin6_addr)) { + in6->sin6_family = AF_INET6; + in6->sin6_port = htons(RELAY_PORT); + addr = *in6; + } + if((strcmp(ifa_tmp->ifa_name, config->interface.c_str()) == 0) && IN6_IS_ADDR_LINKLOCAL(&in6->sin6_addr)) { + in6->sin6_family = AF_INET6; + in6->sin6_port = htons(RELAY_PORT); + ll_addr = *in6; + } + } + ifa_tmp = ifa_tmp->ifa_next; + } + freeifaddrs(ifa); if (bind(*local_sock, (sockaddr *)&addr, sizeof(addr)) == -1) { syslog(LOG_ERR, "bind: Failed to bind to socket\n"); - } + } + + if (bind(*server_sock, (sockaddr *)&ll_addr, sizeof(addr)) == -1) { + syslog(LOG_ERR, "bind: Failed to bind to socket\n"); + } } @@ -451,7 +464,47 @@ void relay_client(int sock, const uint8_t *msg, int32_t len, const ip6_hdr *ip_h current_buffer_position += dhcp_message_length + sizeof(dhcpv6_option); for(auto server: config->servers_sock) { - send_udp(sock, buffer, server, current_buffer_position - buffer); + send_udp(sock, buffer, server, current_buffer_position - buffer, config, new_message.msg_type); + } +} + +/** + * @code relay_relay_forw(int sock, const uint8_t *msg, int32_t len, const ip6_hdr *ip_hdr, relay_config *config) + * + * @brief construct a relay-forward message encapsulated relay-forward message + * + * @param sock L3 socket for sending data to servers + * @param msg pointer to dhcpv6 message header position + * @param len size of data received + * @param ip_hdr pointer to IPv6 header + * @param config pointer to the relay interface config + * + * @return none + */ +void relay_relay_forw(int sock, const uint8_t *msg, int32_t len, const ip6_hdr *ip_hdr, relay_config *config) { + static uint8_t buffer[4096]; + dhcpv6_relay_msg new_message; + auto current_buffer_position = buffer; + auto dhcp_relay_header = parse_dhcpv6_relay(msg); + + if (dhcp_relay_header->hop_count >= HOP_LIMIT) + return; + + new_message.msg_type = DHCPv6_MESSAGE_TYPE_RELAY_FORW; + memcpy(&new_message.peer_address, &ip_hdr->ip6_src, sizeof(in6_addr)); + new_message.hop_count = dhcp_relay_header->hop_count + 1; + + memset(&new_message.link_address, 0, sizeof(in6_addr)); + + memcpy(current_buffer_position, &new_message, sizeof(dhcpv6_relay_msg)); + current_buffer_position += sizeof(dhcpv6_relay_msg); + + auto dhcp_message_length = len; + relay_forward(current_buffer_position, parse_dhcpv6_hdr(msg), dhcp_message_length); + current_buffer_position += dhcp_message_length + sizeof(dhcpv6_option); + + for(auto server: config->servers_sock) { + send_udp(sock, buffer, server, current_buffer_position - buffer, config, new_message.msg_type); } } @@ -467,9 +520,9 @@ void relay_client(int sock, const uint8_t *msg, int32_t len, const ip6_hdr *ip_h * * @return none */ - void relay_relay_reply(int sock, const uint8_t *msg, int32_t len, relay_config *configs) { + void relay_relay_reply(int sock, const uint8_t *msg, int32_t len, relay_config *config) { static uint8_t buffer[4096]; - char ifname[configs->interface.size()]; + uint8_t type = 0; struct sockaddr_in6 target_addr; auto current_buffer_position = buffer; auto current_position = msg; @@ -477,27 +530,33 @@ void relay_client(int sock, const uint8_t *msg, int32_t len, const ip6_hdr *ip_h auto dhcp_relay_header = parse_dhcpv6_relay(msg); current_position += sizeof(struct dhcpv6_relay_msg); - while ((current_position - msg) != len) { + auto position = current_position + sizeof(struct dhcpv6_option); + auto dhcpv6msg = parse_dhcpv6_hdr(position); + + while ((current_position - msg) < len) { auto option = parse_dhcpv6_opt(current_position, &tmp); current_position = tmp; + if (current_position - msg > len || ntohs(option->option_length) > sizeof(buffer) - (current_buffer_position - buffer)) { + break; + } switch (ntohs(option->option_code)) { case OPTION_RELAY_MSG: memcpy(current_buffer_position, ((uint8_t *)option) + sizeof(struct dhcpv6_option), ntohs(option->option_length)); current_buffer_position += ntohs(option->option_length); + type = dhcpv6msg->msg_type; break; default: break; } } - strcpy(ifname, configs->interface.c_str()); memcpy(&target_addr.sin6_addr, &dhcp_relay_header->peer_address, sizeof(struct in6_addr)); target_addr.sin6_family = AF_INET6; target_addr.sin6_flowinfo = 0; target_addr.sin6_port = htons(CLIENT_PORT); - target_addr.sin6_scope_id = if_nametoindex(ifname); + target_addr.sin6_scope_id = if_nametoindex(config->interface.c_str()); - send_udp(sock, buffer, target_addr, current_buffer_position - buffer); + send_udp(sock, buffer, target_addr, current_buffer_position - buffer, config, type); } @@ -515,14 +574,16 @@ void relay_client(int sock, const uint8_t *msg, int32_t len, const ip6_hdr *ip_h void callback(evutil_socket_t fd, short event, void *arg) { struct relay_config *config = (struct relay_config *)arg; static uint8_t message_buffer[4096]; - uint32_t len = recv(config->filter, message_buffer, 4096, 0); + int32_t len = recv(config->filter, message_buffer, 4096, 0); if (len <= 0) { - syslog(LOG_WARNING, "recv: Failed to receive data at filter socket\n"); + syslog(LOG_WARNING, "recv: Failed to receive data at filter socket: %s\n", strerror(errno)); + return; } char* ptr = (char *)message_buffer; - const uint8_t *current_position = (uint8_t *)ptr; + const uint8_t *current_position = (uint8_t *)ptr; const uint8_t *tmp = NULL; + const uint8_t *prev = NULL; auto ether_header = parse_ether_frame(current_position, &tmp); current_position = tmp; @@ -530,14 +591,19 @@ void callback(evutil_socket_t fd, short event, void *arg) { auto ip_header = parse_ip6_hdr(current_position, &tmp); current_position = tmp; + prev = current_position; if (ip_header->ip6_ctlun.ip6_un1.ip6_un1_nxt != IPPROTO_UDP) { const struct ip6_ext *ext_header; do { ext_header = (const struct ip6_ext *)current_position; current_position += ext_header->ip6e_len; + if((current_position == prev) || (current_position >= (uint8_t *)ptr + sizeof(message_buffer))) { + return; + } + prev = current_position; } while (ext_header->ip6e_nxt != IPPROTO_UDP); - } + } auto udp_header = parse_udp(current_position, &tmp); current_position = tmp; @@ -547,7 +613,18 @@ void callback(evutil_socket_t fd, short event, void *arg) { std::string counterVlan = counter_table; update_counter(config->db, counterVlan.append(config->interface), msg->msg_type); - relay_client(config->local_sock, current_position, ntohs(udp_header->len) - sizeof(udphdr), ip_header, ether_header, config); + switch (msg->msg_type) { + case DHCPv6_MESSAGE_TYPE_RELAY_FORW: + { + relay_relay_forw(config->local_sock, current_position, ntohs(udp_header->len) - sizeof(udphdr), ip_header, config); + break; + } + default: + { + relay_client(config->local_sock, current_position, ntohs(udp_header->len) - sizeof(udphdr), ip_header, ether_header, config); + break; + } + } } /** @@ -577,7 +654,7 @@ void server_callback(evutil_socket_t fd, short event, void *arg) { std::string counterVlan = counter_table; update_counter(config->db, counterVlan.append(config->interface), msg->msg_type); if (msg->msg_type == DHCPv6_MESSAGE_TYPE_RELAY_REPL) { - relay_relay_reply(config->local_sock, message_buffer, data, config); + relay_relay_reply(config->server_sock, message_buffer, data, config); } } @@ -674,25 +751,33 @@ void dhcp6relay_stop() */ void loop_relay(std::vector *vlans, swss::DBConnector *db) { std::vector sockets; - - for(std::size_t i = 0; isize(); i++) { - struct relay_config config = vlans->at(i); + base = event_base_new(); + if(base == NULL) { + syslog(LOG_ERR, "libevent: Failed to create base\n"); + } + + for(relay_config &vlan : *vlans) { + relay_config *config = &vlan; int filter = 0; int local_sock = 0; - const char *ifname = config.interface.c_str(); - int index = if_nametoindex(ifname); - config.db = db; + int server_sock = 0; + int index = if_nametoindex(config->interface.c_str()); + config->db = db; std::string counterVlan = counter_table; - initialize_counter(config.db, counterVlan.append(config.interface)); + initialize_counter(config->db, counterVlan.append(config->interface)); filter = sock_open(index, ðer_relay_fprog); + prepare_socket(&local_sock, &server_sock, config, index); + + config->local_sock = local_sock; + config->server_sock = server_sock; - prepare_socket(&local_sock); sockets.push_back(filter); sockets.push_back(local_sock); + sockets.push_back(server_sock); - prepare_relay_config(&config, &local_sock, filter); + prepare_relay_config(config, &local_sock, filter); evutil_make_listen_socket_reuseable(filter); evutil_make_socket_nonblocking(filter); @@ -700,13 +785,8 @@ void loop_relay(std::vector *vlans, swss::DBConnector *db) { evutil_make_listen_socket_reuseable(local_sock); evutil_make_socket_nonblocking(local_sock); - base = event_base_new(); - if(base == NULL) { - syslog(LOG_ERR, "libevent: Failed to create base\n"); - } - - listen_event = event_new(base, filter, EV_READ|EV_PERSIST, callback, (void *)&config); - server_listen_event = event_new(base, local_sock, EV_READ|EV_PERSIST, server_callback, (void *)&config); + listen_event = event_new(base, filter, EV_READ|EV_PERSIST, callback, config); + server_listen_event = event_new(base, local_sock, EV_READ|EV_PERSIST, server_callback, config); if (listen_event == NULL || server_listen_event == NULL) { syslog(LOG_ERR, "libevent: Failed to create libevent\n"); } diff --git a/src/dhcp6relay/src/relay.h b/src/dhcp6relay/src/relay.h index ddd63559c66b..c224a9b28630 100644 --- a/src/dhcp6relay/src/relay.h +++ b/src/dhcp6relay/src/relay.h @@ -15,7 +15,7 @@ #define RELAY_PORT 547 #define CLIENT_PORT 546 -#define HOP_LIMIT 32 +#define HOP_LIMIT 8 //HOP_LIMIT reduced from 32 to 8 as stated in RFC8415 #define lengthof(A) (sizeof (A) / sizeof (A)[0]) @@ -25,6 +25,7 @@ /* DHCPv6 message types */ typedef enum { + DHCPv6_MESSAGE_TYPE_UNKNOWN = 0, DHCPv6_MESSAGE_TYPE_SOLICIT = 1, DHCPv6_MESSAGE_TYPE_ADVERTISE = 2, DHCPv6_MESSAGE_TYPE_REQUEST = 3, @@ -42,6 +43,7 @@ typedef enum struct relay_config { int local_sock; + int server_sock; int filter; sockaddr_in6 link_address; swss::DBConnector *db; @@ -90,15 +92,17 @@ struct linklayer_addr_option { int sock_open(int ifindex, const struct sock_fprog *fprog); /** - * @code prepare_socket(int *local_sock); + * @code prepare_socket(int *local_sock, int *server_sock, relay_config *config, int index); * * @brief prepare L3 socket for sending * - * @param local_sock pointer to socket to be prepared + * @param local_sock pointer to socket binded to global address for relaying client message to server and listening for server message + * @param server_sock pointer to socket binded to link_local address for relaying server message to client + * @param index scope id of interface * * @return none */ -void prepare_socket(int *local_sock); +void prepare_socket(int *local_sock, int *server_sock, relay_config *config, int index); /** * @code prepare_relay_config(relay_config *interface_config, int local_sock, int filter); @@ -142,6 +146,21 @@ void relay_forward(uint8_t *buffer, const struct dhcpv6_msg *msg, uint16_t msg_l */ void relay_client(int sock, const uint8_t *msg, int32_t len, const ip6_hdr *ip_hdr, const ether_header *ether_hdr, relay_config *config); +/** + * @code relay_relay_forw(int sock, const uint8_t *msg, int32_t len, const ip6_hdr *ip_hdr, relay_config *config) + * + * @brief construct a relay-forward message encapsulated relay-forward message + * + * @param sock L3 socket for sending data to servers + * @param msg pointer to dhcpv6 message header position + * @param len size of data received + * @param ip_hdr pointer to IPv6 header + * @param config pointer to the relay interface config + * + * @return none + */ +void relay_relay_forw(int sock, const uint8_t *msg, int32_t len, const ip6_hdr *ip_hdr, relay_config *config); + /** * @code relay_relay_reply(int sock, const uint8_t *msg, int32_t len, relay_config *configs); * @@ -245,28 +264,6 @@ void update_counter(swss::DBConnector *db, std::string counterVlan, uint8_t msg_ */ std::string toString(uint16_t count); -/** - * @code bool is_addr_gua(in6_addr addr); - * - * @brief check if address is global - * - * @param addr ipv6 address - * - * @return bool - */ -bool is_addr_gua(in6_addr addr); - -/** - * @code is_addr_link_local(in6_addr addr); - * - * @brief check if address is link_local - * - * @param addr ipv6 address - * - * @return bool - */ -bool is_addr_link_local(in6_addr addr); - /** * @code const struct ether_header *parse_ether_frame(const uint8_t *buffer, const uint8_t **out_end); * @@ -340,15 +337,17 @@ const struct dhcpv6_relay_msg *parse_dhcpv6_relay(const uint8_t *buffer); const struct dhcpv6_option *parse_dhcpv6_opt(const uint8_t *buffer, const uint8_t **out_end); /** - * @code void send_udp(int sock, uint8_t *buffer, struct sockaddr_in6 target, uint32_t n); + * @code void send_udp(int sock, uint8_t *buffer, struct sockaddr_in6 target, uint32_t n, relay_config *config, uint8_t msg_type); * * @brief send udp packet * * @param *buffer message buffer * @param sockaddr_in6 target target socket * @param n length of message + * @param relay_config *config pointer to relay_config + * @param uint8_t msg_type message type of dhcpv6 option of relayed message * * @return dhcpv6_option end of dhcpv6 message option */ -void send_udp(int sock, struct sockaddr_in6 target, uint8_t *buffer, uint32_t n); +void send_udp(int sock, uint8_t *buffer, struct sockaddr_in6 target, uint32_t n, relay_config *config, uint8_t msg_type); diff --git a/src/dhcp6relay/src/subdir.mk b/src/dhcp6relay/src/subdir.mk index af378319d78f..1c93d490ec63 100644 --- a/src/dhcp6relay/src/subdir.mk +++ b/src/dhcp6relay/src/subdir.mk @@ -18,6 +18,6 @@ C_DEPS += \ src/%.o: src/%.cpp @echo 'Building file: $<' @echo 'Invoking: GCC C++ Compiler' - $(CC) -std=c++17 -D__FILENAME__="$(subst src/,,$<)" $(LIBS) -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" + $(CC) -D__FILENAME__="$(subst src/,,$<)" $(CFLAGS) -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" @echo 'Finished building: $<' @echo ' ' diff --git a/src/dhcpmon/debian/compat b/src/dhcpmon/debian/compat index ec635144f600..48082f72f087 100644 --- a/src/dhcpmon/debian/compat +++ b/src/dhcpmon/debian/compat @@ -1 +1 @@ -9 +12 diff --git a/src/dhcpmon/debian/control b/src/dhcpmon/debian/control index 8623428462e3..c70c274f19fd 100644 --- a/src/dhcpmon/debian/control +++ b/src/dhcpmon/debian/control @@ -2,8 +2,7 @@ Source: sonic-dhcpmon Section: devel Priority: optional Maintainer: Tamer Ahmed -Build-Depends: debhelper (>= 8.0.0), - dh-systemd +Build-Depends: debhelper (>= 12.0.0), libevent-dev, libexplain-dev Standards-Version: 3.9.3 Homepage: https://github.com/Azure/sonic-buildimage XS-Go-Import-Path: github.com/Azure/sonic-buildimage @@ -11,6 +10,5 @@ XS-Go-Import-Path: github.com/Azure/sonic-buildimage Package: sonic-dhcpmon Architecture: any Built-Using: ${misc:Built-Using} -Depends: libexplain51, - libevent-2.1-6 +Depends: ${shlibs:Depends} Description: SONiC DHCP Monitor diff --git a/src/dhcpmon/debian/rules b/src/dhcpmon/debian/rules index 00c628b6625f..76fc7ea1f839 100755 --- a/src/dhcpmon/debian/rules +++ b/src/dhcpmon/debian/rules @@ -1,5 +1,7 @@ #!/usr/bin/make -f +export DEB_BUILD_MAINT_OPTIONS=hardening=+all + DEB_CFLAGS_APPEND=-std=gnu11 export DEB_CFLAGS_APPEND diff --git a/src/dhcpmon/src/dhcp_device.c b/src/dhcpmon/src/dhcp_device.c index 3078295e49a4..e4fbc7f56909 100644 --- a/src/dhcpmon/src/dhcp_device.c +++ b/src/dhcpmon/src/dhcp_device.c @@ -121,6 +121,8 @@ static struct sock_fprog dhcp_sock_bfp = { */ static dhcp_device_context_t aggregate_dev = {0}; +static dhcp_device_context_t *mgmt_intf = NULL; + /** Monitored DHCPv4 message type */ static dhcpv4_message_type_t v4_monitored_msgs[] = { DHCPv4_MESSAGE_TYPE_DISCOVER, @@ -176,6 +178,11 @@ static void handle_dhcp_option_53(dhcp_device_context_t *context, if ((context->giaddr_ip == giaddr && context->is_uplink && dir == DHCP_TX) || (!context->is_uplink && dir == DHCP_RX && iphdr->ip_dst.s_addr == INADDR_BROADCAST)) { context->counters.v4counters[DHCP_COUNTERS_CURRENT][dir][dhcp_option[2]]++; + // If the packet recieved on the mgmt interface, we don't want to increment the aggregate device + if (context == mgmt_intf) + { + break; + } aggregate_dev.counters.v4counters[DHCP_COUNTERS_CURRENT][dir][dhcp_option[2]]++; } break; @@ -186,6 +193,11 @@ static void handle_dhcp_option_53(dhcp_device_context_t *context, if ((context->giaddr_ip == iphdr->ip_dst.s_addr && context->is_uplink && dir == DHCP_RX) || (!context->is_uplink && dir == DHCP_TX)) { context->counters.v4counters[DHCP_COUNTERS_CURRENT][dir][dhcp_option[2]]++; + // If the packet recieved on the mgmt interface, we don't want to increment the aggregate device + if (context == mgmt_intf) + { + break; + } aggregate_dev.counters.v4counters[DHCP_COUNTERS_CURRENT][dir][dhcp_option[2]]++; } break; @@ -224,6 +236,11 @@ static void handle_dhcpv6_option(dhcp_device_context_t *context, case DHCPv6_MESSAGE_TYPE_RECONFIGURE: case DHCPv6_MESSAGE_TYPE_INFORMATION_REQUEST: context->counters.v6counters[DHCP_COUNTERS_CURRENT][dir][dhcp_option]++; + // If the packet recieved on the mgmt interface, we don't want to increment the aggregate device + if (context == mgmt_intf) + { + break; + } aggregate_dev.counters.v6counters[DHCP_COUNTERS_CURRENT][dir][dhcp_option]++; break; default: @@ -309,7 +326,7 @@ static void read_callback(int fd, short event, void *arg) } } else if (!is_ipv4 && dhcpv6_enabled && (buffer_sz > UDPv6_START_OFFSET + sizeof(struct udphdr) + DHCPv6_TYPE_LENGTH)) { - const u_char* dhcp_option = context->buffer + dhcp_option_offset; + const u_char* dhcp_header = context->buffer + dhcp_option_offset; dhcp_packet_direction_t dir = (ethhdr->ether_shost[0] == context->mac[0] && ethhdr->ether_shost[1] == context->mac[1] && ethhdr->ether_shost[2] == context->mac[2] && @@ -319,23 +336,25 @@ static void read_callback(int fd, short event, void *arg) DHCP_TX : DHCP_RX; int offset = 0; uint16_t option = 0; + uint16_t current_option_len = 0; // Get to inner DHCP header from encapsulated RELAY_FORWARD or RELAY_REPLY header - while (dhcp_option[offset] == DHCPv6_MESSAGE_TYPE_RELAY_FORWARD || dhcp_option[offset] == DHCPv6_MESSAGE_TYPE_RELAY_REPLY) + while (dhcp_header[offset] == DHCPv6_MESSAGE_TYPE_RELAY_FORWARD || dhcp_header[offset] == DHCPv6_MESSAGE_TYPE_RELAY_REPLY) { // Get to DHCPv6_OPTION_RELAY_MSG from all options offset += DHCPv6_RELAY_MSG_OPTIONS_OFFSET; - option = htons(*((uint16_t*)(&(dhcp_option[offset])))); + option = htons(*((uint16_t*)(&(dhcp_header[offset])))); while (option != DHCPv6_OPTION_RELAY_MSG) { - offset += DHCPv6_OPTION_LENGTH; // Add to offset the option length and get the next option ID - offset += htons(*((uint16_t*)(&(dhcp_option[offset])))); - option = htons(*((uint16_t*)(&(dhcp_option[offset])))); + current_option_len = htons(*((uint16_t*)(&(dhcp_header[offset + DHCPv6_OPTION_LENGTH])))); + offset += DHCPv6_OPTION_LENGTH + DHCPv6_OPTION_LEN_LENGTH + current_option_len; + option = htons(*((uint16_t*)(&(dhcp_header[offset])))); } + // Set the offset to DHCP-relay-message data offset += DHCPv6_OPTION_LENGTH + DHCPv6_OPTION_LEN_LENGTH; } - handle_dhcpv6_option(context, dhcp_option[offset], dir); + handle_dhcpv6_option(context, dhcp_header[offset], dir); } else { syslog(LOG_WARNING, "read_callback(%s): read length (%ld) is too small to capture DHCP options", context->intf, buffer_sz); @@ -554,7 +573,7 @@ static dhcp_mon_status_t dhcp_device_check_health(dhcp_mon_check_t check_type, { dhcp_mon_status_t rv = DHCP_MON_STATUS_HEALTHY; - if (dhcp_device_is_dhcp_inactive(aggregate_dev.counters.v4counters, aggregate_dev.counters.v6counters, type)) { + if (dhcp_device_is_dhcp_inactive(v4counters, v6counters, type)) { rv = DHCP_MON_STATUS_INDETERMINATE; } else if (check_type == DHCP_MON_CHECK_POSITIVE) { rv = dhcp_device_check_positive_health(v4counters, v6counters, type); @@ -948,3 +967,13 @@ void dhcp_device_active_types(bool dhcpv4, bool dhcpv6) dhcpv4_enabled = dhcpv4; dhcpv6_enabled = dhcpv6; } + +/** + * @code dhcp_device_init_mgmt_intf(mgmt_intf_context); + * + * @brief assign context address of mgmt interface + */ +void dhcp_device_init_mgmt_intf(dhcp_device_context_t *mgmt_intf_context) +{ + mgmt_intf = mgmt_intf_context; +} diff --git a/src/dhcpmon/src/dhcp_device.h b/src/dhcpmon/src/dhcp_device.h index f8aa874bfcce..433eb0907626 100644 --- a/src/dhcpmon/src/dhcp_device.h +++ b/src/dhcpmon/src/dhcp_device.h @@ -255,4 +255,15 @@ void dhcp_device_print_status(dhcp_device_context_t *context, dhcp_counters_type * @return none */ void dhcp_device_active_types(bool dhcpv4, bool dhcpv6); + +/** + * @code dhcp_device_init_mgmt_intf(mgmt_intf_context); + * + * @brief assign context address of mgmt interface + * + * @param mgmt_intf_context MGMT interface context struct address + * + * @return none + */ +void dhcp_device_init_mgmt_intf(dhcp_device_context_t *mgmt_intf_context); #endif /* DHCP_DEVICE_H_ */ diff --git a/src/dhcpmon/src/dhcp_devman.c b/src/dhcpmon/src/dhcp_devman.c index e7a25322207f..b36d926c1d5b 100644 --- a/src/dhcpmon/src/dhcp_devman.c +++ b/src/dhcpmon/src/dhcp_devman.c @@ -148,6 +148,9 @@ int dhcp_devman_add_intf(const char *name, char intf_type) strncpy(agg_dev->intf + sizeof(AGG_DEV_PREFIX) - 1, name, sizeof(agg_dev->intf) - sizeof(AGG_DEV_PREFIX)); agg_dev->intf[sizeof(agg_dev->intf) - 1] = '\0'; } + else if (rv == 0 && intf_type == 'm') { + dhcp_device_init_mgmt_intf(dev->dev_context); + } LIST_INSERT_HEAD(&intfs, dev, entry); } diff --git a/src/initramfs-tools/Makefile b/src/initramfs-tools/Makefile index f57b943d2d4f..27832cabca32 100644 --- a/src/initramfs-tools/Makefile +++ b/src/initramfs-tools/Makefile @@ -5,12 +5,12 @@ SHELL = /bin/bash MAIN_TARGET = initramfs-tools_$(INITRAMFS_TOOLS_VERSION)_all.deb DERIVED_TARGETS = initramfs-tools-core_$(INITRAMFS_TOOLS_VERSION)_all.deb -INITRAMFS_TOOLS_REVISION = 40e544e13611c1b2690eb99a8096fc16c1b9c74e +INITRAMFS_TOOLS_REVISION = v$(INITRAMFS_TOOLS_VERSION) $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Obtaining the initramfs-tools rm -rf ./initramfs-tools - git clone --branch v0.133 https://salsa.debian.org/kernel-team/initramfs-tools.git ./initramfs-tools + git clone https://salsa.debian.org/kernel-team/initramfs-tools.git ./initramfs-tools # Patch pushd ./initramfs-tools diff --git a/src/initramfs-tools/loopback-file-offset-support.patch b/src/initramfs-tools/loopback-file-offset-support.patch index 396e1c92007a..26ae7e1450a1 100644 --- a/src/initramfs-tools/loopback-file-offset-support.patch +++ b/src/initramfs-tools/loopback-file-offset-support.patch @@ -57,7 +57,7 @@ index a17e740..2bef5cb 100644 modprobe loop modprobe "${FSTYPE}" -+ if [ ! -z "${LOOPOFFSET}" ]; then ++ if [ -n "${LOOPOFFSET}" ]; then + # create a loop device for the fs within the file + loopdev="$(losetup -f)" + losetup -o "${LOOPOFFSET:-0}" "${loopdev}" "${loopfile}" || \ diff --git a/src/iproute2/.gitignore b/src/iproute2/.gitignore index a0991ff4402b..dfa47d4833b3 100644 --- a/src/iproute2/.gitignore +++ b/src/iproute2/.gitignore @@ -1,3 +1,4 @@ * !.gitignore !Makefile +!patch/* diff --git a/src/iproute2/Makefile b/src/iproute2/Makefile index 5b354ce8b019..93c680628acb 100644 --- a/src/iproute2/Makefile +++ b/src/iproute2/Makefile @@ -2,21 +2,21 @@ SHELL = /bin/bash .ONESHELL: .SHELLFLAGS += -e -IPROUTE2_VERSION = 4.9.0 -IPROUTE2_VERSION_FULL = $(IPROUTE2_VERSION)-1 - MAIN_TARGET = iproute2_$(IPROUTE2_VERSION_FULL)_$(CONFIGURED_ARCH).deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Remove any stale files rm -rf iproute2-$(IPROUTE2_VERSION) - wget -O iproute2_$(IPROUTE2_VERSION).orig.tar.xz -N "https://sonicstorage.blob.core.windows.net/packages/iproute2_4.9.0.orig.tar.xz?sv=2015-04-05&sr=b&sig=9nvybd1xkXyRQbaG6Fy6wBazPA8IbZV0AO41GWXPEP8%3D&se=2154-10-23T11%3A59%3A00Z&sp=r" - wget -O iproute2_$(IPROUTE2_VERSION_FULL).dsc -N "https://sonicstorage.blob.core.windows.net/packages/iproute2_4.9.0-1.dsc?sv=2015-04-05&sr=b&sig=m6FcMH9dOh8ggipBgOsONiXvDxoi6bfUO%2BxvidsMNMQ%3D&se=2154-10-23T11%3A59%3A53Z&sp=r" - wget -O iproute2_$(IPROUTE2_VERSION_FULL).debian.tar.xz -N "https://sonicstorage.blob.core.windows.net/packages/iproute2_4.9.0-1.debian.tar.xz?sv=2015-04-05&sr=b&sig=U5NFuwG5C3vZXlUUNvoPMnKDtMKk66zbweA9rQYbEVY%3D&se=2154-10-23T12%3A00%3A15Z&sp=r" + wget -O iproute2_$(IPROUTE2_VERSION).orig.tar.xz http://deb.debian.org/debian/pool/main/i/iproute2/iproute2_$(IPROUTE2_VERSION).orig.tar.xz + wget -O iproute2_$(IPROUTE2_VERSION_FULL).dsc http://deb.debian.org/debian/pool/main/i/iproute2/iproute2_$(IPROUTE2_VERSION_FULL).dsc + wget -O iproute2_$(IPROUTE2_VERSION_FULL).debian.tar.xz http://deb.debian.org/debian/pool/main/i/iproute2/iproute2_$(IPROUTE2_VERSION_FULL).debian.tar.xz dpkg-source -x iproute2_$(IPROUTE2_VERSION_FULL).dsc pushd iproute2-$(IPROUTE2_VERSION) + + patch -p1 < ../patch/0001-patch-macsec-xpn-support.patch + dpkg-buildpackage -us -uc -b -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) popd diff --git a/src/iproute2/patch/0001-patch-macsec-xpn-support.patch b/src/iproute2/patch/0001-patch-macsec-xpn-support.patch new file mode 100644 index 000000000000..c55daa3fd4c6 --- /dev/null +++ b/src/iproute2/patch/0001-patch-macsec-xpn-support.patch @@ -0,0 +1,213 @@ +From f1ea3235b5250dfd1193b5033620b030b9789fd9 Mon Sep 17 00:00:00 2001 +From: Ze Gan +Date: Mon, 30 Aug 2021 06:45:28 +0000 +Subject: [PATCH] MACsec XPN support + +Signed-off-by: Ze Gan +--- + ip/ipmacsec.c | 86 ++++++++++++++++++++++++++++++++++++++++++++------- + 1 file changed, 74 insertions(+), 12 deletions(-) + +diff --git a/ip/ipmacsec.c b/ip/ipmacsec.c +index 18289ecd..1df19bf1 100644 +--- a/ip/ipmacsec.c ++++ b/ip/ipmacsec.c +@@ -10,6 +10,7 @@ + */ + + #include ++#include + #include + #include + #include +@@ -23,6 +24,8 @@ + #include "ll_map.h" + #include "libgenl.h" + ++#define MACSEC_SALT_LEN 12 ++ + static const char * const values_on_off[] = { "off", "on" }; + + static const char * const validate_str[] = { +@@ -45,11 +48,13 @@ struct sci { + + struct sa_desc { + __u8 an; +- __u32 pn; ++ __u64 pn; + __u8 key_id[MACSEC_KEYID_LEN]; + __u32 key_len; + __u8 key[MACSEC_MAX_KEY_LEN]; + __u8 active; ++ __u32 ssci; ++ __u8 salt[MACSEC_SALT_LEN]; + }; + + struct cipher_args { +@@ -88,7 +93,7 @@ static int genl_family = -1; + static void ipmacsec_usage(void) + { + fprintf(stderr, +- "Usage: ip macsec add DEV tx sa { 0..3 } [ OPTS ] key ID KEY\n" ++ "Usage: ip macsec add DEV tx sa { 0..3 } [ OPTS ] [ ssci SSCI salt SALT] key ID KEY\n" + " ip macsec set DEV tx sa { 0..3 } [ OPTS ]\n" + " ip macsec del DEV tx sa { 0..3 }\n" + " ip macsec add DEV rx SCI [ on | off ]\n" +@@ -100,10 +105,12 @@ static void ipmacsec_usage(void) + " ip macsec show\n" + " ip macsec show DEV\n" + " ip macsec offload DEV [ off | phy | mac ]\n" +- "where OPTS := [ pn ] [ on | off ]\n" ++ "where OPTS := [ pn ] [ on | off ]\n" + " ID := 128-bit hex string\n" + " KEY := 128-bit or 256-bit hex string\n" +- " SCI := { sci | port { 1..2^16-1 } address }\n"); ++ " SCI := { sci | port { 1..2^16-1 } address }\n" ++ " SSCI := \n" ++ " SALT := 96-bit hex string\n"); + + exit(-1); + } +@@ -198,7 +205,7 @@ static int parse_sa_args(int *argcp, char ***argvp, struct sa_desc *sa) + if (sa->pn != 0) + duparg2("pn", "pn"); + NEXT_ARG(); +- ret = get_u32(&sa->pn, *argv, 0); ++ ret = get_u64(&sa->pn, *argv, 0); + if (ret) + invarg("expected pn", *argv); + if (sa->pn == 0) +@@ -224,6 +231,22 @@ static int parse_sa_args(int *argcp, char ***argvp, struct sa_desc *sa) + duparg2("on/off", "off"); + sa->active = false; + active_set = true; ++ } else if (strcmp(*argv, "ssci") == 0) { ++ if (sa->ssci != 0) ++ duparg2("ssci", "ssci"); ++ NEXT_ARG(); ++ ret = get_u32(&sa->ssci, *argv, 0); ++ if (ret) ++ invarg("expected ssci", *argv); ++ if (sa->ssci == 0) ++ invarg("expected ssci != 0", *argv); ++ } else if (strcmp(*argv, "salt") == 0) { ++ unsigned int len; ++ ++ NEXT_ARG(); ++ if (!hexstring_a2n(*argv, sa->salt, MACSEC_SALT_LEN, ++ &len)) ++ invarg("expected salt", *argv); + } else { + fprintf(stderr, "macsec: unknown command \"%s\"?\n", + *argv); +@@ -413,9 +436,15 @@ static int do_modify_nl(enum cmd c, enum macsec_nl_commands cmd, int ifindex, + addattr8(&req.n, MACSEC_BUFLEN, MACSEC_SA_ATTR_AN, sa->an); + + if (c != CMD_DEL) { +- if (sa->pn) +- addattr32(&req.n, MACSEC_BUFLEN, MACSEC_SA_ATTR_PN, +- sa->pn); ++ if (sa->pn) { ++ if (sa->ssci == 0) { ++ addattr32(&req.n, MACSEC_BUFLEN, MACSEC_SA_ATTR_PN, ++ sa->pn); ++ } else { ++ addattr64(&req.n, MACSEC_BUFLEN, MACSEC_SA_ATTR_PN, ++ sa->pn); ++ } ++ } + + if (sa->key_len) { + addattr_l(&req.n, MACSEC_BUFLEN, MACSEC_SA_ATTR_KEYID, +@@ -428,6 +457,13 @@ static int do_modify_nl(enum cmd c, enum macsec_nl_commands cmd, int ifindex, + addattr8(&req.n, MACSEC_BUFLEN, + MACSEC_SA_ATTR_ACTIVE, sa->active); + } ++ ++ if (sa->ssci != 0) { ++ addattr32(&req.n, MACSEC_BUFLEN, MACSEC_SA_ATTR_SSCI, ++ sa->ssci); ++ addattr_l(&req.n, MACSEC_BUFLEN, MACSEC_SA_ATTR_SALT, ++ sa->salt, MACSEC_SALT_LEN); ++ } + } + + addattr_nest_end(&req.n, attr_sa); +@@ -456,6 +492,11 @@ static bool check_sa_args(enum cmd c, struct sa_desc *sa) + fprintf(stderr, "cannot change key on SA\n"); + return -1; + } ++ ++ if (sa->ssci) { ++ fprintf(stderr, "cannot change SSCI on SA\n"); ++ return -1; ++ } + } + + return 0; +@@ -637,6 +678,8 @@ static void print_key(struct rtattr *key) + + #define CIPHER_NAME_GCM_AES_128 "GCM-AES-128" + #define CIPHER_NAME_GCM_AES_256 "GCM-AES-256" ++#define CIPHER_NAME_GCM_AES_XPN_128 "GCM-AES-XPN-128" ++#define CIPHER_NAME_GCM_AES_XPN_256 "GCM-AES-XPN-256" + #define DEFAULT_CIPHER_NAME CIPHER_NAME_GCM_AES_128 + + static const char *cs_id_to_name(__u64 cid) +@@ -649,6 +692,10 @@ static const char *cs_id_to_name(__u64 cid) + return CIPHER_NAME_GCM_AES_128; + case MACSEC_CIPHER_ID_GCM_AES_256: + return CIPHER_NAME_GCM_AES_256; ++ case MACSEC_CIPHER_ID_GCM_AES_XPN_128: ++ return CIPHER_NAME_GCM_AES_XPN_128; ++ case MACSEC_CIPHER_ID_GCM_AES_XPN_256: ++ return CIPHER_NAME_GCM_AES_XPN_256; + default: + return "(unknown)"; + } +@@ -897,13 +944,22 @@ static void print_tx_sc(const char *prefix, __u64 sci, __u8 encoding_sa, + print_string(PRINT_FP, NULL, "%s", prefix); + print_uint(PRINT_ANY, "an", "%d:", + rta_getattr_u8(sa_attr[MACSEC_SA_ATTR_AN])); +- print_uint(PRINT_ANY, "pn", " PN %u,", +- rta_getattr_u32(sa_attr[MACSEC_SA_ATTR_PN])); ++ if (!sa_attr[MACSEC_SA_ATTR_SSCI]) { ++ print_uint(PRINT_ANY, "pn", " PN %u,", ++ rta_getattr_u32(sa_attr[MACSEC_SA_ATTR_PN])); ++ } else { ++ print_uint(PRINT_ANY, "pn", " PN %" PRIu64 ",", ++ rta_getattr_u64(sa_attr[MACSEC_SA_ATTR_PN])); ++ } + + print_bool(PRINT_JSON, "active", NULL, state); + print_string(PRINT_FP, NULL, + " state %s,", state ? "on" : "off"); + print_key(sa_attr[MACSEC_SA_ATTR_KEYID]); ++ if (sa_attr[MACSEC_SA_ATTR_SSCI]) { ++ print_uint(PRINT_ANY, "ssci", " SSCI %u,", ++ rta_getattr_u32(sa_attr[MACSEC_SA_ATTR_SSCI])); ++ } + + print_txsa_stats(prefix, sa_attr[MACSEC_SA_ATTR_STATS]); + close_json_object(); +@@ -1322,9 +1378,15 @@ static int macsec_parse_opt(struct link_util *lu, int argc, char **argv, + else if (strcmp(*argv, "gcm-aes-256") == 0 || + strcmp(*argv, "GCM-AES-256") == 0) + cipher.id = MACSEC_CIPHER_ID_GCM_AES_256; ++ else if (strcmp(*argv, "gcm-aes-xpn-128") == 0 || ++ strcmp(*argv, "GCM-AES-XPN-128") == 0) ++ cipher.id = MACSEC_CIPHER_ID_GCM_AES_XPN_128; ++ else if (strcmp(*argv, "gcm-aes-xpn-256") == 0 || ++ strcmp(*argv, "GCM-AES-XPN-256") == 0) ++ cipher.id = MACSEC_CIPHER_ID_GCM_AES_XPN_256; + else +- invarg("expected: default, gcm-aes-128 or" +- " gcm-aes-256", *argv); ++ invarg("expected: default, gcm-aes-128" ++ " gcm-aes-256 gcm-aes-xpn-128 gcm-aes-xpn-256", *argv); + } else if (strcmp(*argv, "icvlen") == 0) { + NEXT_ARG(); + if (cipher.icv_len) +-- +2.17.1 + diff --git a/src/iptables/patch/0001-Passing-fullcone-option-for-SNAT-and-DNAT.patch b/src/iptables/patch/0001-Passing-fullcone-option-for-SNAT-and-DNAT.patch index 9ed886bb5dbd..4e06adf9deb4 100644 --- a/src/iptables/patch/0001-Passing-fullcone-option-for-SNAT-and-DNAT.patch +++ b/src/iptables/patch/0001-Passing-fullcone-option-for-SNAT-and-DNAT.patch @@ -1,16 +1,17 @@ -From 92f5aee7372748845f11b7a10d880f968769e860 Mon Sep 17 00:00:00 2001 +From 386bb8378bc67b7dfc3db5d5f28a01620b4231cf Mon Sep 17 00:00:00 2001 From: Kiran Kella Date: Wed, 7 Aug 2019 07:22:42 -0700 -Subject: [PATCH] Passing fullcone option for SNAT and DNAT +Subject: [PATCH] From 92f5aee7372748845f11b7a10d880f968769e860 Mon Sep 17 + 00:00:00 2001 Subject: [PATCH] Passing fullcone option for SNAT and DNAT --- - extensions/libipt_DNAT.c | 22 +++++++++++++++++++++- - extensions/libipt_MASQUERADE.c | 21 ++++++++++++++++++++- - extensions/libipt_SNAT.c | 22 +++++++++++++++++++++- - 3 files changed, 62 insertions(+), 3 deletions(-) + extensions/libipt_DNAT.c | 37 ++++++++++++++++++++++++++++++++-- + extensions/libipt_MASQUERADE.c | 22 +++++++++++++++++++- + extensions/libipt_SNAT.c | 22 +++++++++++++++++++- + 3 files changed, 77 insertions(+), 4 deletions(-) diff --git a/extensions/libipt_DNAT.c b/extensions/libipt_DNAT.c -index 4907a2e..543421c 100644 +index 4907a2e..95e3446 100644 --- a/extensions/libipt_DNAT.c +++ b/extensions/libipt_DNAT.c @@ -8,14 +8,20 @@ @@ -19,7 +20,7 @@ index 4907a2e..543421c 100644 +/* Temporarily defining here, need to be picked up from the + * new kernel header linux/netfilter/nf_nat.h */ -+#define NF_NAT_RANGE_FULLCONE (1 << 6) ++#define NF_NAT_RANGE_FULLCONE (1 << 10) + enum { O_TO_DEST = 0, @@ -151,7 +152,7 @@ index 4907a2e..543421c 100644 return 1; } diff --git a/extensions/libipt_MASQUERADE.c b/extensions/libipt_MASQUERADE.c -index 90bf606..169457d 100644 +index 90bf606..b3ed1e6 100644 --- a/extensions/libipt_MASQUERADE.c +++ b/extensions/libipt_MASQUERADE.c @@ -8,10 +8,15 @@ @@ -160,7 +161,7 @@ index 90bf606..169457d 100644 +/* Temporarily defining here, need to be picked up from the + * new kernel header linux/netfilter/nf_nat.h */ -+#define NF_NAT_RANGE_FULLCONE (1 << 6) ++#define NF_NAT_RANGE_FULLCONE (1 << 10) + enum { O_TO_PORTS = 0, @@ -229,7 +230,7 @@ index 90bf606..169457d 100644 } diff --git a/extensions/libipt_SNAT.c b/extensions/libipt_SNAT.c -index e92d811..ad42b8c 100644 +index e92d811..8704004 100644 --- a/extensions/libipt_SNAT.c +++ b/extensions/libipt_SNAT.c @@ -8,16 +8,22 @@ @@ -238,7 +239,7 @@ index e92d811..ad42b8c 100644 +/* Temporarily defining here, need to be picked up from the + * new kernel header linux/netfilter/nf_nat.h */ -+#define NF_NAT_RANGE_FULLCONE (1 << 6) ++#define NF_NAT_RANGE_FULLCONE (1 << 10) + enum { O_TO_SRC = 0, @@ -319,3 +320,6 @@ index e92d811..ad42b8c 100644 } return 1; +-- +2.27.0 + diff --git a/src/isc-dhcp/Makefile b/src/isc-dhcp/Makefile index 2adf6bba2aa3..63e82e5c49aa 100644 --- a/src/isc-dhcp/Makefile +++ b/src/isc-dhcp/Makefile @@ -7,16 +7,16 @@ DERIVED_TARGETS = $(ISC_DHCP_RELAY_DBG) $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Remove any stale files - rm -rf ./isc-dhcp + rm -rf ./isc-dhcp-$(ISC_DHCP_VERSION) - # Clone isc-dhcp repo - git clone https://salsa.debian.org/dhcp-team/isc-dhcp.git - pushd ./isc-dhcp + # Get isc-dhcp release, debian files + dget http://deb.debian.org/debian/pool/main/i/isc-dhcp/isc-dhcp_$(ISC_DHCP_VERSION_FULL).dsc + pushd ./isc-dhcp-$(ISC_DHCP_VERSION) - # Reset HEAD to the commit of the proper tag - # NOTE: Using "git checkout " here detaches our HEAD, - # which stg doesn't like, so we use this method instead - git reset --hard debian/$(ISC_DHCP_VERSION_FULL) + # Create a git repository here for stg to apply patches + git init + git add -f * + git commit -qm "initial commit" # Apply patches stg init diff --git a/src/isc-dhcp/patch/0012-add-option-si-to-support-using-src-intf-ip-in-relay.patch b/src/isc-dhcp/patch/0012-add-option-si-to-support-using-src-intf-ip-in-relay.patch index 7fd9fc313406..19a1192032db 100644 --- a/src/isc-dhcp/patch/0012-add-option-si-to-support-using-src-intf-ip-in-relay.patch +++ b/src/isc-dhcp/patch/0012-add-option-si-to-support-using-src-intf-ip-in-relay.patch @@ -165,20 +165,7 @@ diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c index 221106a..c44a79d 100644 --- a/relay/dhcrelay.c +++ b/relay/dhcrelay.c -@@ -97,6 +97,12 @@ struct downstream_intf_list { - isc_boolean_t use_if_id = ISC_FALSE; - #endif - -+/* -+ * If not set, kernel chooses what the src ip is. -+ * If set, uses "from" interface IP for packet Tx. -+ */ -+extern int use_src_intf_ip_for_tx = 0; -+ - /* Maximum size of a packet with agent options added. */ - int dhcp_max_agent_option_packet_length = DHCP_MTU_MIN; - -@@ -431,6 +437,8 @@ main(int argc, char **argv) { +@@ -431,6 +431,8 @@ main(int argc, char **argv) { #endif } else if (!strcmp(argv[i], "-d")) { /* no_daemon = 1; */ diff --git a/src/kdump-tools/Makefile b/src/kdump-tools/Makefile index dadf08503af1..6c66c37c0843 100644 --- a/src/kdump-tools/Makefile +++ b/src/kdump-tools/Makefile @@ -6,15 +6,11 @@ MAIN_TARGET = $(KDUMP_TOOLS) $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Remove any stale files - rm -rf ./makedumpfile_$(KDUMP_TOOLS_VERSION_BASE).orig.tar.gz ./makedumpfile_$(KDUMP_TOOLS_VERSION).debian.tar.xz - rm -rf ./makedumpfile-$(KDUMP_TOOLS_VERSION_BASE) + rm -rf ./kdump-tools-$(KDUMP_TOOLS_VERSION)* - # Get makedumpfile release - wget http://deb.debian.org/debian/pool/main/m/makedumpfile/makedumpfile_$(KDUMP_TOOLS_VERSION_BASE).orig.tar.gz - wget http://deb.debian.org/debian/pool/main/m/makedumpfile/makedumpfile_$(KDUMP_TOOLS_VERSION).debian.tar.xz - tar -f makedumpfile_$(KDUMP_TOOLS_VERSION_BASE).orig.tar.gz -x - pushd ./makedumpfile-$(KDUMP_TOOLS_VERSION_BASE) - tar -f ../makedumpfile_$(KDUMP_TOOLS_VERSION).debian.tar.xz -x + # Get kdump-tools release + dget https://deb.debian.org/debian/pool/main/k/kdump-tools/kdump-tools_$(KDUMP_TOOLS_VERSION).dsc + pushd ./kdump-tools-$(KDUMP_TOOLS_VERSION) git init git add -f * @@ -25,7 +21,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : stg import -s ../patch/series # Build source and Debian packages - dpkg-buildpackage -rfakeroot -b -us -uc -Tbinary-indep -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) + dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) popd # Move the newly-built .deb packages to the destination directory diff --git a/src/kdump-tools/patch/0001-Generate-initramfs-for-installed-kernels-in-chroot.patch b/src/kdump-tools/patch/0001-Generate-initramfs-for-installed-kernels-in-chroot.patch deleted file mode 100644 index 1d994b88bd58..000000000000 --- a/src/kdump-tools/patch/0001-Generate-initramfs-for-installed-kernels-in-chroot.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 7e6c0d5b0c7299154f75f281c02cf02cf85fb80e Mon Sep 17 00:00:00 2001 -From: Benjamin Drung -Date: Thu, 2 Mar 2017 19:52:23 +0100 -Subject: [PATCH] Generate initramfs for installed kernels in chroot - -The postinst script from kdump-tools creates an initramfs for the -running kernel. When running inside a chroot, the running kernel (from -the host) might differ from the kernels that are available in the -chroot. - -Thus generate the initramfs only when the running kernel is installed in -the system. Otherwise generate the initramfs for all installed kernels. - -Bug-Debian: #856594 ---- - debian/kdump-tools.postinst | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - -diff --git a/debian/kdump-tools.postinst b/debian/kdump-tools.postinst -index 4b6c6be..f604c8e 100755 ---- a/debian/kdump-tools.postinst -+++ b/debian/kdump-tools.postinst -@@ -33,7 +33,15 @@ update_param() { - case "$1" in - configure) - # create smaller initrd.img files for kdump use -- /etc/kernel/postinst.d/kdump-tools $(uname -r) > /dev/null 2>&1 -+ if test -d /lib/modules/$(uname -r); then -+ /etc/kernel/postinst.d/kdump-tools $(uname -r) > /dev/null 2>&1 -+ else -+ # Running kernel not installed. Running in chroot? -+ for kernel_release in $(ls /lib/modules/); do -+ /etc/kernel/postinst.d/kdump-tools $kernel_release > /dev/null 2>&1 -+ kdump-config symlinks $kernel_release -+ done -+ fi - - # Customize crashkernel= value according to architecture - ARCH="$(arch)" --- -2.9.3 diff --git a/src/kdump-tools/patch/0002-core-file-prefixed-by-kdump.patch b/src/kdump-tools/patch/0002-core-file-prefixed-by-kdump.patch index 2ed480b26175..d16aaebee285 100644 --- a/src/kdump-tools/patch/0002-core-file-prefixed-by-kdump.patch +++ b/src/kdump-tools/patch/0002-core-file-prefixed-by-kdump.patch @@ -1,24 +1,26 @@ ---- a/debian/kdump-config.orig 2019-10-24 09:38:19.006679000 -0700 -+++ b/debian/kdump-config 2019-10-24 12:16:23.791899000 -0700 -@@ -639,8 +639,8 @@ +diff --git a/debian/kdump-config.in b/debian/kdump-config.in +index 564ab94..7396e54 100755 +--- a/debian/kdump-config.in ++++ b/debian/kdump-config.in +@@ -728,8 +728,8 @@ kdump_save_core() { - KDUMP_STAMP=`date +"%Y%m%d%H%M"` - KDUMP_STAMPDIR=$(define_stampdir $KDUMP_STAMP) -- KDUMP_CORETEMP="$KDUMP_STAMPDIR/dump-incomplete" -- KDUMP_COREFILE="$KDUMP_STAMPDIR/dump.$KDUMP_STAMP" -+ KDUMP_CORETEMP="$KDUMP_STAMPDIR/kdump-incomplete" -+ KDUMP_COREFILE="$KDUMP_STAMPDIR/kdump.$KDUMP_STAMP" + KDUMP_STAMP=$(date +"%Y%m%d%H%M") + KDUMP_STAMPDIR=$(define_stampdir "$KDUMP_STAMP" "$KDUMP_COREDIR") +- KDUMP_CORETEMP="$KDUMP_STAMPDIR/dump-incomplete$(compression_extension)" +- KDUMP_COREFILE="$KDUMP_STAMPDIR/dump.$KDUMP_STAMP$(compression_extension)" ++ KDUMP_CORETEMP="$KDUMP_STAMPDIR/kdump-incomplete$(compression_extension)" ++ KDUMP_COREFILE="$KDUMP_STAMPDIR/kdump.$KDUMP_STAMP$(compression_extension)" KDUMP_DMESGFILE="$KDUMP_STAMPDIR/dmesg.$KDUMP_STAMP" # If we use NFS, verify that we can mount the FS -@@ -755,8 +755,8 @@ - KDUMP_STAMP=`date +"%Y%m%d%H%M"` - KDUMP_STAMPDIR=$(define_stampdir $KDUMP_STAMP) +@@ -928,8 +928,8 @@ kdump_save_core_to_ssh() + SSH_STAMP=$(date +"%Y%m%d%H%M") + SSH_STAMPDIR=$(define_stampdir "$SSH_STAMP" "$KDUMP_COREDIR") + +- SSH_CORETEMP="$SSH_STAMPDIR/dump-incomplete$(compression_extension)" +- SSH_COREFILE="$SSH_STAMPDIR/dump.$SSH_STAMP$(compression_extension)" ++ SSH_CORETEMP="$SSH_STAMPDIR/kdump-incomplete$(compression_extension)" ++ SSH_COREFILE="$SSH_STAMPDIR/kdump.$SSH_STAMP$(compression_extension)" + SSH_TMPDMESG="/tmp/dmesg.ssh.$SSH_STAMP" + SSH_DMESGFILE="$SSH_STAMPDIR/dmesg.$SSH_STAMP" -- KDUMP_CORETEMP="$KDUMP_STAMPDIR/dump-incomplete" -- KDUMP_COREFILE="$KDUMP_STAMPDIR/dump.$KDUMP_STAMP" -+ KDUMP_CORETEMP="$KDUMP_STAMPDIR/kdump-incomplete" -+ KDUMP_COREFILE="$KDUMP_STAMPDIR/kdump.$KDUMP_STAMP" - KDUMP_TMPDMESG="/tmp/dmesg.$KDUMP_STAMP" - KDUMP_DMESGFILE="$KDUMP_STAMPDIR/dmesg.$KDUMP_STAMP" - ERROR=0 diff --git a/src/kdump-tools/patch/series b/src/kdump-tools/patch/series index e1a26e55ca1b..c45a722024a6 100644 --- a/src/kdump-tools/patch/series +++ b/src/kdump-tools/patch/series @@ -1,2 +1 @@ -0001-Generate-initramfs-for-installed-kernels-in-chroot.patch 0002-core-file-prefixed-by-kdump.patch diff --git a/src/libyang/Makefile b/src/libyang/Makefile index 32cabdf13bdf..357908ebc370 100644 --- a/src/libyang/Makefile +++ b/src/libyang/Makefile @@ -3,7 +3,7 @@ SHELL = /bin/bash .SHELLFLAGS += -e MAIN_TARGET = $(LIBYANG) -DERIVED_TARGETS = $(LIBYANG_DEV) $(LIBYANG_DBG) $(LIBYANG_PY2) $(LIBYANG_PY3) $(LIBYANG_CPP) +DERIVED_TARGETS = $(LIBYANG_DEV) $(LIBYANG_DBG) $(LIBYANG_PY3) $(LIBYANG_CPP) $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Obtaining the libyang diff --git a/src/libyang/patch/libyang.patch b/src/libyang/patch/libyang.patch index a950d85086ab..45eba825ce30 100644 --- a/src/libyang/patch/libyang.patch +++ b/src/libyang/patch/libyang.patch @@ -10,33 +10,6 @@ index fa562dd3..8635ba15 100644 # set default build type if not specified by user if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE debug) -diff --git a/packages/debian.control.in b/packages/debian.control.in -index da6588b9..fb3ede48 100644 ---- a/packages/debian.control.in -+++ b/packages/debian.control.in -@@ -53,3 +53,15 @@ Depends: python3-yang@PACKAGE_PART_NAME@ (=@LIBYANG_VERSION@) - Section: debug - Architecture: any - Description: Debug symbols of python3 bidings of libyang library. -+ -+Package: python2-yang@PACKAGE_PART_NAME@ -+Depends: @PACKAGE_NAME@ (=@LIBYANG_VERSION@), libyang-cpp@PACKAGE_PART_NAME@ (=@LIBYANG_VERSION@) -+Section: libs -+Architecture: any -+Description: Bindings of libyang library to python2 language. -+ -+Package: python2-yang@PACKAGE_PART_NAME@-dbg -+Depends: python2-yang@PACKAGE_PART_NAME@ (=@LIBYANG_VERSION@) -+Section: debug -+Architecture: any -+Description: Debug symbols of python2 bidings of libyang library. -diff --git a/packages/debian.python2-yang.install b/packages/debian.python2-yang.install -new file mode 100644 -index 00000000..14ce2f3c ---- /dev/null -+++ b/packages/debian.python2-yang.install -@@ -0,0 +1 @@ -+usr/lib/python2.7/dist-packages/* diff --git a/packages/debian.rules.in b/packages/debian.rules.in index d565819e..e92fe4a1 100644 --- a/packages/debian.rules.in @@ -45,7 +18,7 @@ index d565819e..e92fe4a1 100644 override_dh_strip: dh_strip -plibyang@PACKAGE_PART_NAME@ --dbg-package=libyang@PACKAGE_PART_NAME@-dbg dh_strip -plibyang-cpp@PACKAGE_PART_NAME@ --dbg-package=libyang-cpp@PACKAGE_PART_NAME@-dbg -+ dh_strip -ppython2-yang@PACKAGE_PART_NAME@ --dbg-package=python2-yang@PACKAGE_PART_NAME@-dbg ++ #dh_strip -ppython2-yang@PACKAGE_PART_NAME@ --dbg-package=python2-yang@PACKAGE_PART_NAME@-dbg dh_strip -ppython3-yang@PACKAGE_PART_NAME@ --dbg-package=python3-yang@PACKAGE_PART_NAME@-dbg override_dh_auto_configure: @@ -57,78 +30,3 @@ index d565819e..e92fe4a1 100644 override_dh_auto_test: ctest --output-on-failure -diff --git a/packages/libyang.dsc.in b/packages/libyang.dsc.in -index fdfa402b..f75ba184 100644 ---- a/packages/libyang.dsc.in -+++ b/packages/libyang.dsc.in -@@ -1,10 +1,10 @@ - Format: 3.0 (quilt) - Source: @PACKAGE_NAME@ --Binary: @PACKAGE_NAME@, @PACKAGE_NAME@-dbg, @PACKAGE_NAME@-dev, libyang-cpp@PACKAGE_PART_NAME@, libyang-cpp@PACKAGE_PART_NAME@-dev, libyang-cpp@PACKAGE_PART_NAME@-dbg, python3-yang@PACKAGE_PART_NAME@, python3-yang@PACKAGE_PART_NAME@-dbg -+Binary: @PACKAGE_NAME@, @PACKAGE_NAME@-dbg, @PACKAGE_NAME@-dev, libyang-cpp@PACKAGE_PART_NAME@, libyang-cpp@PACKAGE_PART_NAME@-dev, libyang-cpp@PACKAGE_PART_NAME@-dbg, python3-yang@PACKAGE_PART_NAME@, python3-yang@PACKAGE_PART_NAME@-dbg python2-yang@PACKAGE_PART_NAME@, python2-yang@PACKAGE_PART_NAME@-dbg - Maintainer: CESNET - Version: @LIBYANG_VERSION@ - Architecture: any - Standards-Version: 3.8.2 - Homepage: https://github.com/CESNET/libyang - Vcs-Git: https://github.com/CESNET/libyang --Build-Depends: debhelper (>= 9), make, gcc, doxygen, cmake, pkg-config, libpcre3-dev, libcmocka-dev, python3-dev, g++, swig (>= 3.0.12) -+Build-Depends: debhelper (>= 9), make, gcc, doxygen, cmake, pkg-config, libpcre3-dev, libcmocka-dev, python3-dev, python2-dev, g++, swig (>= 3.0.12) -diff --git a/packages/libyang.spec.in b/packages/libyang.spec.in -index 6a4ac615..6939f028 100644 ---- a/packages/libyang.spec.in -+++ b/packages/libyang.spec.in -@@ -46,6 +46,8 @@ BuildRequires: python3-devel - %else - BuildRequires: python34-devel - %endif -+ -+BuildRequires: python2-devel - %endif - - Conflicts: @CONFLICT_PACKAGE_NAME@ = @LIBYANG_MAJOR_VERSION@.@LIBYANG_MINOR_VERSION@ -@@ -70,6 +72,11 @@ Summary: Binding to python - Requires: libyang-cpp@PACKAGE_PART_NAME@ = %{version}-%{release} - Requires: %{name} = %{version}-%{release} - -+%package -n python2-yang@PACKAGE_PART_NAME@ -+Summary: Binding to python -+Requires: libyang-cpp@PACKAGE_PART_NAME@ = %{version}-%{release} -+Requires: %{name} = %{version}-%{release} -+ - %description -n libyang-cpp@PACKAGE_PART_NAME@ - Bindings of libyang library to C++ language. - -@@ -80,6 +87,10 @@ Headers of bindings to c++ language. - Bindings of libyang library to python language. - %endif - -+%description -n python2-yang@PACKAGE_PART_NAME@ -+Bindings of libyang library to python language. -+%endif -+ - %description devel - Headers of libyang library. - -@@ -167,4 +178,9 @@ make DESTDIR=%{buildroot} install - %{_libdir}/python* - %endif - -+%files -n python2-yang@PACKAGE_PART_NAME@ -+%defattr(-,root,root) -+%{_libdir}/python* -+%endif -+ - %changelog -diff --git a/packages/local-deb.sh.in b/packages/local-deb.sh.in -index 057bbc67..4318a49d 100755 ---- a/packages/local-deb.sh.in -+++ b/packages/local-deb.sh.in -@@ -18,6 +18,7 @@ fi - cp "@PROJECT_SOURCE_DIR@/packages/debian.libyang-dev.install" debian/@PACKAGE_NAME@-dev.install - cp "@PROJECT_SOURCE_DIR@/packages/debian.libyang-cpp.install" debian/libyang-cpp@PACKAGE_PART_NAME@.install - cp "@PROJECT_SOURCE_DIR@/packages/debian.libyang-cpp-dev.install" debian/libyang-cpp@PACKAGE_PART_NAME@-dev.install -+cp "@PROJECT_SOURCE_DIR@/packages/debian.python2-yang.install" debian/python2-yang@PACKAGE_PART_NAME@.install - cp "@PROJECT_SOURCE_DIR@/packages/debian.python3-yang.install" debian/python3-yang@PACKAGE_PART_NAME@.install - echo -e "@PACKAGE_NAME@ (@LIBYANG_VERSION@) stable; urgency=low\n" >debian/changelog - git log -10 --pretty=format:' * %s (%aN)%n' 2>/dev/null >>debian/changelog || echo -e " * unknown changes \n" >>debian/changelog diff --git a/src/libyang/patch/swig.patch b/src/libyang/patch/swig.patch index a6f798c18224..d2b4080d368d 100644 --- a/src/libyang/patch/swig.patch +++ b/src/libyang/patch/swig.patch @@ -29,7 +29,7 @@ index 4cee36ec..0baa69ab 100644 + message(WARNING "Can't create a static Python module") else() - message(WARNING "Sysrepo supports Python 2.x and Python 3.x") -+ set(GEN_PYTHON_VERSION 2 3) ++ set(GEN_PYTHON_VERSION 3) + foreach(CUR_PYTHON_VERSION ${GEN_PYTHON_VERSION}) + message(STATUS "Python version ${CUR_PYTHON_VERSION} was selected") + @@ -99,7 +99,7 @@ index 994b1234..5d18b8bf 100644 -swig_link_libraries(${PYTHON_SWIG_BINDING} ${PYTHON_LIBRARIES} libyang-cpp) +swig_link_libraries(${PYTHON_SWIG_TARGET} ${PYTHON_LIBRARIES} libyang-cpp) + -+set_target_properties(_${PYTHON_SWIG_TARGET} PROPERTIES OUTPUT_NAME "_yang${PYTHON_EXT_SUFFIX}" SUFFIX "") ++set_target_properties(_${PYTHON_SWIG_TARGET} PROPERTIES OUTPUT_NAME "_yang") # Generate header with SWIG run-time functions execute_process(COMMAND ${SWIG_EXECUTABLE} -python -external-runtime ${CMAKE_CURRENT_BINARY_DIR}/swigpyrun.h) diff --git a/src/linkmgrd b/src/linkmgrd new file mode 160000 index 000000000000..83dfc992d1b2 --- /dev/null +++ b/src/linkmgrd @@ -0,0 +1 @@ +Subproject commit 83dfc992d1b24b01bb9b125cc86a8ce63ba060f6 diff --git a/src/lldpd/patch/0012-fix-recreate-socket-on-ifindex-change.patch b/src/lldpd/patch/0012-fix-recreate-socket-on-ifindex-change.patch new file mode 100644 index 000000000000..685142dff904 --- /dev/null +++ b/src/lldpd/patch/0012-fix-recreate-socket-on-ifindex-change.patch @@ -0,0 +1,82 @@ +diff --git a/src/daemon/interfaces-linux.c b/src/daemon/interfaces-linux.c +index a8280c8..a51440a 100644 +--- a/src/daemon/interfaces-linux.c ++++ b/src/daemon/interfaces-linux.c +@@ -775,7 +775,7 @@ iflinux_handle_bond(struct lldpd *cfg, struct interfaces_device_list *interfaces + created = 1; + } + if (hardware->h_flags) continue; +- if (hardware->h_ops != &bond_ops) { ++ if (hardware->h_ops != &bond_ops || hardware->h_ifindex_changed) { + if (!created) { + log_debug("interfaces", + "bond %s is converted from another type of interface", +@@ -794,7 +794,7 @@ iflinux_handle_bond(struct lldpd *cfg, struct interfaces_device_list *interfaces + } else bmaster = hardware->h_data; + bmaster->index = master->index; + strlcpy(bmaster->name, master->name, IFNAMSIZ); +- if (hardware->h_ops != &bond_ops) { ++ if (hardware->h_ops != &bond_ops || hardware->h_ifindex_changed) { + if (iface_bond_init(cfg, hardware) != 0) { + log_warn("interfaces", "unable to initialize %s", + hardware->h_ifname); +diff --git a/src/daemon/interfaces.c b/src/daemon/interfaces.c +index 3c6c255..58db018 100644 +--- a/src/daemon/interfaces.c ++++ b/src/daemon/interfaces.c +@@ -623,7 +623,7 @@ interfaces_helper_physical(struct lldpd *cfg, + } + if (hardware->h_flags) + continue; +- if (hardware->h_ops != ops) { ++ if (hardware->h_ops != ops || hardware->h_ifindex_changed) { + if (!created) { + log_debug("interfaces", + "interface %s is converted from another type of interface", +diff --git a/src/daemon/lldpd.c b/src/daemon/lldpd.c +index 1d92dd3..f3e82e5 100644 +--- a/src/daemon/lldpd.c ++++ b/src/daemon/lldpd.c +@@ -147,6 +147,12 @@ lldpd_get_hardware(struct lldpd *cfg, char *name, int index) + TAILQ_FOREACH(hardware, &cfg->g_hardware, h_entries) { + if (strcmp(hardware->h_ifname, name) == 0) { + if (hardware->h_flags == 0) { ++ if (hardware->h_ifindex != 0 && ++ hardware->h_ifindex != index) { ++ log_debug("interfaces", "%s changed index: from %d to %d", ++ hardware->h_ifname, hardware->h_ifindex, index); ++ hardware->h_ifindex_changed = 1; ++ } + hardware->h_ifindex = index; + break; + } +@@ -392,7 +398,8 @@ lldpd_reset_timer(struct lldpd *cfg) + } + + /* Compare with the previous value */ +- if (hardware->h_lport_previous && ++ if (!hardware->h_ifindex_changed && ++ hardware->h_lport_previous && + output_len == hardware->h_lport_previous_len && + !memcmp(output, hardware->h_lport_previous, output_len)) { + log_debug("localchassis", +@@ -402,6 +409,7 @@ lldpd_reset_timer(struct lldpd *cfg) + log_debug("localchassis", + "change detected for port %s, resetting its timer", + hardware->h_ifname); ++ hardware->h_ifindex_changed = 0; + levent_schedule_pdu(hardware); + } + +diff --git a/src/lldpd-structs.h b/src/lldpd-structs.h +index f6b03d7..213f306 100644 +--- a/src/lldpd-structs.h ++++ b/src/lldpd-structs.h +@@ -454,6 +454,7 @@ struct lldpd_hardware { + removed if this is left + to 0. */ + int h_ifindex; /* Interface index, used by SNMP */ ++ int h_ifindex_changed; /* Interface index has changed */ + char h_ifname[IFNAMSIZ]; /* Should be unique */ + u_int8_t h_lladdr[ETHER_ADDR_LEN]; + diff --git a/src/lldpd/patch/series b/src/lldpd/patch/series index 32fd4c0ca9a7..d0b9904751cc 100644 --- a/src/lldpd/patch/series +++ b/src/lldpd/patch/series @@ -5,3 +5,4 @@ 0007-lib-fix-memory-leak-when-handling-I-O.patch 0010-Ported-fix-for-length-exceeded-from-lldp-community.patch 0011-fix-med-location-len.patch +0012-fix-recreate-socket-on-ifindex-change.patch diff --git a/src/monit/patch/0003-fix-yacc-header-file-naming.patch b/src/monit/patch/0003-fix-yacc-header-file-naming.patch new file mode 100644 index 000000000000..835e7ee4a1c9 --- /dev/null +++ b/src/monit/patch/0003-fix-yacc-header-file-naming.patch @@ -0,0 +1,59 @@ +Fix header file names for lexer files + +From: Saikrishna Arcot + +Due to changes in yacc, the header file that it generates (y.tab.h) is now +actually used by y.tab.c, and needs to exist. Change the code that generates +and moves this file to fix this issue. +--- + Makefile.am | 16 +++++++--------- + src/l.l | 2 +- + 2 files changed, 8 insertions(+), 10 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index d321e3a..d276a6f 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -95,7 +95,7 @@ monit_LDFLAGS = -static $(EXTLDFLAGS) + + man_MANS = monit.1 + +-BUILT_SOURCES = src/lex.yy.c src/y.tab.c src/tokens.h ++BUILT_SOURCES = src/lex.yy.c src/y.tab.c src/y.tab.h + + CLEANFILES = src/y.output + DISTCLEANFILES = *~ $(BUILT_SOURCES) +@@ -145,14 +145,12 @@ monit.1: doc/monit.pod + # Grammar rules + # ------------- + +-src/y.tab.c src/tokens.h: src/p.y +- $(YACC) $(YACCFLAGS) -o src/y.tab.c $< +- -echo "#include " > src/.y.tab.c +- -cat src/y.tab.c >> src/.y.tab.c +- -mv src/.y.tab.c src/y.tab.c +- -mv src/y.tab.h src/tokens.h ++src/y.tab.c src/y.tab.h: run-yacc + +-src/lex.yy.c: src/l.l +- $(FLEX) $(FLEXFLAGS) -o$@ $< ++.INTERMEDIATE: run-yacc ++run-yacc: src/p.y ++ $(YACC) $(YACCFLAGS) -o src/y.tab.c $< + ++src/lex.yy.c: src/l.l ++ $(FLEX) $(FLEXFLAGS) -o$@ $< + +diff --git a/src/l.l b/src/l.l +index fee015c..3047800 100644 +--- a/src/l.l ++++ b/src/l.l +@@ -50,7 +50,7 @@ + #endif + + #include "monit.h" +-#include "tokens.h" ++#include "y.tab.h" + + // libmonit + #include "util/Str.h" diff --git a/src/monit/patch/series b/src/monit/patch/series index f5534d0f554f..17bda755059d 100644 --- a/src/monit/patch/series +++ b/src/monit/patch/series @@ -1,3 +1,4 @@ # This series applies on GIT commit dc9bc1c949125140d967edfc598dfad47eedc552 0001-used_system_memory_sysdep-Use-MemAvailable-value-if-.patch 0002-change_monit_alert_log_error.patch +0003-fix-yacc-header-file-naming.patch diff --git a/src/ntp/Makefile b/src/ntp/Makefile index 6d96010be156..0a821ad6ca52 100644 --- a/src/ntp/Makefile +++ b/src/ntp/Makefile @@ -10,15 +10,15 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Get ntp release, debian files wget http://deb.debian.org/debian/pool/main/n/ntp/ntp_$(NTP_VERSION).orig.tar.xz - wget http://deb.debian.org/debian/pool/main/n/ntp/ntp_$(NTP_VERSION)-4.debian.tar.xz + wget http://deb.debian.org/debian/pool/main/n/ntp/ntp_$(NTP_VERSION)-1.debian.tar.xz # UnTar ntp release xzcat ntp_$(NTP_VERSION).orig.tar.xz | tar -xvf - - pushd ./ntp-4.2.8p12 + pushd ./ntp-4.2.8p15 # UnTar debian files - xzcat ../ntp_$(NTP_VERSION)-4.debian.tar.xz | tar -xvf - + xzcat ../ntp_$(NTP_VERSION)-1.debian.tar.xz | tar -xvf - # Add the additional patch cp ../patch/bug1970-UNLINK_EXPR_SLIST_empty_list.patch debian/patches/ diff --git a/src/ntp/patch/changelog b/src/ntp/patch/changelog index 8fa477cca266..ce5fb6096276 100644 --- a/src/ntp/patch/changelog +++ b/src/ntp/patch/changelog @@ -1,10 +1,10 @@ -ntp (1:4.2.8p12+dfsg-4+deb10u2) stretch; urgency=medium +ntp (1:4.2.8p15+dfsg-1+deb10u2) bullseye; urgency=medium * Adjust the ENOBUFS syslog level on the Netlink routing to LOG_WARNING. -- Arun Barboza Mon, 09 Sep 2019 10:15:35 -0700 -ntp (1:4.2.8p12+dfsg-4+deb10u1) stretch; urgency=medium +ntp (1:4.2.8p15+dfsg-1+deb10u1) bullseye; urgency=medium * Apply Bug1970 fix for UNLINK_EXPR_SLIST_empty_list from dev branch. diff --git a/src/openssh/Makefile b/src/openssh/Makefile index be05c6ffd675..91d4fd52bcf7 100644 --- a/src/openssh/Makefile +++ b/src/openssh/Makefile @@ -6,13 +6,13 @@ MAIN_TARGET = openssh-server_$(OPENSSH_VERSION)_$(CONFIGURED_ARCH).deb DERIVED_TARGETS = openssh-server-dbgsym_$(OPENSSH_VERSION)_$(CONFIGURED_ARCH).deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : - # Obtain openssh: https://salsa.debian.org/ssh-team/openssh/-/tree/debian/1%257.9p1-10+deb10u2 + # Obtain openssh: https://salsa.debian.org/ssh-team/openssh/-/tree/debian/1%258.4p1-5 rm -rf ./openssh-server git clone https://salsa.debian.org/ssh-team/openssh.git openssh-server pushd ./openssh-server - # Check out tag: debian/1%7.9p1-10+deb10u2 - git checkout -b openssh-src -f 6d9ca74c48d9911342c6ca5aaac8a25974fa2619 + # Check out tag: debian/1%8.4p1-5 + git checkout -b openssh-src -f debian/1\%$(OPENSSH_VERSION) # Apply patch series stg init diff --git a/src/scapy b/src/scapy new file mode 160000 index 000000000000..8b63d73a1726 --- /dev/null +++ b/src/scapy @@ -0,0 +1 @@ +Subproject commit 8b63d73a17266bae2a61513ea97ded5283a7ccd3 diff --git a/src/scapy.patch/0001-Fix-version-string-generation-when-scapy-is-a-submod.patch b/src/scapy.patch/0001-Fix-version-string-generation-when-scapy-is-a-submod.patch new file mode 100644 index 000000000000..37f5253db0cc --- /dev/null +++ b/src/scapy.patch/0001-Fix-version-string-generation-when-scapy-is-a-submod.patch @@ -0,0 +1,27 @@ +From 988c808af6065b740006aef0e94496821d41fb98 Mon Sep 17 00:00:00 2001 +From: Stepan Blyschak +Date: Mon, 4 Apr 2022 09:57:39 +0000 +Subject: [PATCH] Fix version string generation when scapy is a submodule + +Signed-off-by: Stepan Blyschak +--- + scapy/__init__.py | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/scapy/__init__.py b/scapy/__init__.py +index f920151e..2adbea19 100644 +--- a/scapy/__init__.py ++++ b/scapy/__init__.py +@@ -42,9 +42,6 @@ def _version_from_git_describe(): + :raises CalledProcessError: if git is unavailable + :return: Scapy's latest tag + """ +- if not os.path.isdir(os.path.join(os.path.dirname(_SCAPY_PKG_DIR), '.git')): # noqa: E501 +- raise ValueError('not in scapy git repo') +- + def _git(cmd): + # type: (str) -> str + process = subprocess.Popen( +-- +2.14.1 + diff --git a/src/scapy.patch/0002-Check-if-the-network-interface-still-exists.patch b/src/scapy.patch/0002-Check-if-the-network-interface-still-exists.patch new file mode 100644 index 000000000000..c42c12e1a8aa --- /dev/null +++ b/src/scapy.patch/0002-Check-if-the-network-interface-still-exists.patch @@ -0,0 +1,42 @@ +From 7ffd8101c1e535f9c3225db2c319958a64412686 Mon Sep 17 00:00:00 2001 +From: Guillaume Valadon +Date: Tue, 14 Sep 2021 19:34:43 +0200 +Subject: [PATCH] Check if the network interface still exists + +Signed-off-by: Stepan Blyschak +--- + scapy/arch/linux.py | 18 +++++++++++------- + 1 file changed, 11 insertions(+), 7 deletions(-) + +diff --git a/scapy/arch/linux.py b/scapy/arch/linux.py +index 94fac8f0..b86e98ab 100644 +--- a/scapy/arch/linux.py ++++ b/scapy/arch/linux.py +@@ -414,13 +414,17 @@ class LinuxInterfaceProvider(InterfaceProvider): + data = {} + ips = in6_getifaddr() + for i in _get_if_list(): +- ifflags = struct.unpack("16xH14x", get_if(i, SIOCGIFFLAGS))[0] +- index = get_if_index(i) +- mac = scapy.utils.str2mac( +- get_if_raw_hwaddr(i, siocgifhwaddr=SIOCGIFHWADDR)[1] +- ) +- ip = None # type: Optional[str] +- ip = inet_ntop(socket.AF_INET, get_if_raw_addr(i)) ++ try: ++ ifflags = struct.unpack("16xH14x", get_if(i, SIOCGIFFLAGS))[0] ++ index = get_if_index(i) ++ mac = scapy.utils.str2mac( ++ get_if_raw_hwaddr(i, siocgifhwaddr=SIOCGIFHWADDR)[1] ++ ) ++ ip = None # type: Optional[str] ++ ip = inet_ntop(socket.AF_INET, get_if_raw_addr(i)) ++ except IOError: ++ warning("Interface %s does not exist!", i) ++ continue + if ip == "0.0.0.0": + ip = None + ifflags = FlagValue(ifflags, _iff_flags) +-- +2.14.1 + diff --git a/src/scapy.patch/series b/src/scapy.patch/series new file mode 100644 index 000000000000..d64f20f136c1 --- /dev/null +++ b/src/scapy.patch/series @@ -0,0 +1,2 @@ +0001-Fix-version-string-generation-when-scapy-is-a-submod.patch +0002-Check-if-the-network-interface-still-exists.patch diff --git a/src/smartmontools/.gitignore b/src/smartmontools/.gitignore deleted file mode 100644 index a0991ff4402b..000000000000 --- a/src/smartmontools/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!.gitignore -!Makefile diff --git a/src/smartmontools/Makefile b/src/smartmontools/Makefile deleted file mode 100644 index 8f0f0695659f..000000000000 --- a/src/smartmontools/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -SHELL = /bin/bash -.ONESHELL: -.SHELLFLAGS += -e - - -MAIN_TARGET = smartmontools_$(SMARTMONTOOLS_VERSION_FULL)_$(CONFIGURED_ARCH).deb - -$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : - rm -rf smartmontools-$(SMARTMONTOOLS_VERSION_MAJOR) - wget -O smartmontools_$(SMARTMONTOOLS_VERSION_MAJOR).orig.tar.gz -N "https://sonicstorage.blob.core.windows.net/packages/debian/smartmontools_$(SMARTMONTOOLS_VERSION_MAJOR).orig.tar.gz?sv=2015-04-05&sr=b&sig=JZx4qiLuO36T0rsGqk4V2RDuWjRw6NztsLK7vlBYAkg%3D&se=2046-08-20T23%3A47%3A13Z&sp=r" - wget -O smartmontools_$(SMARTMONTOOLS_VERSION_FULL).dsc -N "https://sonicstorage.blob.core.windows.net/packages/debian/smartmontools_$(SMARTMONTOOLS_VERSION_FULL).dsc?sv=2015-04-05&sr=b&sig=IS7FKUN%2Bvq0T55f4X2hGAViB70Y%2FgzjGgvzpUJLyUfA%3D&se=2046-08-20T23%3A46%3A57Z&sp=r" - wget -O smartmontools_$(SMARTMONTOOLS_VERSION_FULL).debian.tar.xz -N "https://sonicstorage.blob.core.windows.net/packages/debian/smartmontools_$(SMARTMONTOOLS_VERSION_FULL).debian.tar.xz?sv=2015-04-05&sr=b&sig=H0RFeC41MCvhTQCln85DuPLn5v2goozwz%2FB9sA9p5eQ%3D&se=2046-08-20T23%3A46%3A02Z&sp=r" - dpkg-source -x smartmontools_$(SMARTMONTOOLS_VERSION_FULL).dsc - - pushd smartmontools-$(SMARTMONTOOLS_VERSION_MAJOR) - dpkg-buildpackage -us -uc -b -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) - popd - - mv $* $(DEST)/ diff --git a/src/snmpd/Makefile b/src/snmpd/Makefile index 50d0303540d6..35fc1d38ce9f 100644 --- a/src/snmpd/Makefile +++ b/src/snmpd/Makefile @@ -3,6 +3,18 @@ SHELL = /bin/bash .SHELLFLAGS += -e MAIN_TARGET = libsnmp-base_$(SNMPD_VERSION_FULL)_all.deb +ifneq (,$(findstring 5.9,$(SNMPD_VERSION))) +DERIVED_TARGETS = snmptrapd_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \ + snmp_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \ + snmpd_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \ + snmp-dbgsym_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \ + snmpd-dbgsym_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \ + libsnmp40_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \ + libsnmp40-dbgsym_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \ + libsnmp-dev_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \ + libsnmp-perl_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \ + tkmib_$(SNMPD_VERSION_FULL)_all.deb +else DERIVED_TARGETS = snmptrapd_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \ snmp_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \ snmpd_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \ @@ -13,18 +25,33 @@ DERIVED_TARGETS = snmptrapd_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \ libsnmp-dev_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \ libsnmp-perl_$(SNMPD_VERSION_FULL)_$(CONFIGURED_ARCH).deb \ tkmib_$(SNMPD_VERSION_FULL)_all.deb +endif $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : rm -rf net-snmp-$(SNMPD_VERSION) # download debian net-snmp +ifneq (,$(findstring 5.9,$(SNMPD_VERSION))) + dget -u https://sonicstorage.blob.core.windows.net/debian/pool/main/n/net-snmp/net-snmp_$(SNMPD_VERSION)-3.dsc +else dget -u https://sonicstorage.blob.core.windows.net/debian/pool/main/n/net-snmp/net-snmp_$(SNMPD_VERSION_FULL).dsc +endif pushd net-snmp-$(SNMPD_VERSION) git init git add -f * git commit -m "unmodified snmpd source" +ifneq (,$(findstring 5.9,$(SNMPD_VERSION))) + # Looks like Debian did a binNMU (binary non-maintainer upload), so the latest dsc + # file that we can get doesn't actually have the exact version number that Debian's + # repos have. + DEBEMAIL="$(shell git config --get user.name) <$(shell git config --get user.email)>" dch --bin-nmu "Rebuild against perl 5.32.0" + dch -r "" + git add debian/changelog + git commit -m "fix package version" +endif + # Apply patches stg init stg import -s ../patch-$(SNMPD_VERSION)/series diff --git a/src/snmpd/patch-5.9+dfsg/0001-SNMP-Stop-spamming-logs-with-statfs-permission-denie.patch b/src/snmpd/patch-5.9+dfsg/0001-SNMP-Stop-spamming-logs-with-statfs-permission-denie.patch new file mode 100644 index 000000000000..9a1f23c0b483 --- /dev/null +++ b/src/snmpd/patch-5.9+dfsg/0001-SNMP-Stop-spamming-logs-with-statfs-permission-denie.patch @@ -0,0 +1,27 @@ +From a1edbce39e46b5c8bd5bd7db17fc11fa30e7dd73 Mon Sep 17 00:00:00 2001 +From: pavel-shirshov +Date: Mon, 27 Aug 2018 16:50:16 +0800 +Subject: [PATCH] [SNMP] Stop spamming logs with statfs permission denied log + message #1668 + +--- + agent/mibgroup/hardware/fsys/fsys_mntctl.c | 2 -- + agent/mibgroup/hardware/fsys/fsys_mntent.c | 2 -- + 2 files changed, 4 deletions(-) + +diff --git a/agent/mibgroup/hardware/fsys/fsys_mntctl.c b/agent/mibgroup/hardware/fsys/fsys_mntctl.c +index 9fbb068..adc38d6 100644 +--- a/agent/mibgroup/hardware/fsys/fsys_mntctl.c ++++ b/agent/mibgroup/hardware/fsys/fsys_mntctl.c +@@ -163,8 +163,6 @@ netsnmp_fsys_arch_load( void ) + continue; + + if ( statfs( entry->path, &stat_buf ) < 0 ) { +- snprintf( tmpbuf, sizeof(tmpbuf), "Cannot statfs %s", entry->path ); +- snmp_log_perror( tmpbuf ); + continue; + } + entry->units = stat_buf.f_bsize; +-- +2.7.4 + diff --git a/src/snmpd/patch-5.9+dfsg/0002-at.c-properly-check-return-status-from-realloc.-Than.patch b/src/snmpd/patch-5.9+dfsg/0002-at.c-properly-check-return-status-from-realloc.-Than.patch new file mode 100644 index 000000000000..ceb0c68352bf --- /dev/null +++ b/src/snmpd/patch-5.9+dfsg/0002-at.c-properly-check-return-status-from-realloc.-Than.patch @@ -0,0 +1,31 @@ +From e370973f273ffc1b32673bc94c5a46f75a846d82 Mon Sep 17 00:00:00 2001 +From: Niels Baggesen +Date: Wed, 31 Aug 2016 21:43:36 +0200 +Subject: [PATCH] at.c: properly check return status from realloc. Thanks to + Daniel Eiland (bug 2678) + +--- + agent/mibgroup/mibII/at.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/agent/mibgroup/mibII/at.c b/agent/mibgroup/mibII/at.c +index f57ba2a..a73fb8c 100644 +--- a/agent/mibgroup/mibII/at.c ++++ b/agent/mibgroup/mibII/at.c +@@ -638,11 +638,12 @@ ARP_Scan_Init(void) + struct arptab *newtab = (struct arptab *) + realloc(at, (sizeof(struct arptab) * + (arptab_curr_max_size + ARP_CACHE_INCR))); +- if (newtab == at) { ++ if (newtab == NULL) { + snmp_log(LOG_ERR, + "Error allocating more space for arpcache. " + "Cache will continue to be limited to %d entries", + arptab_curr_max_size); ++ newtab = at; + break; + } else { + arptab_curr_max_size += ARP_CACHE_INCR; +-- +2.7.4 + diff --git a/src/snmpd/patch-5.9+dfsg/0003-CHANGES-BUG-2743-snmpd-crashes-when-receiving-a-GetN.patch b/src/snmpd/patch-5.9+dfsg/0003-CHANGES-BUG-2743-snmpd-crashes-when-receiving-a-GetN.patch new file mode 100644 index 000000000000..cdf9b94be934 --- /dev/null +++ b/src/snmpd/patch-5.9+dfsg/0003-CHANGES-BUG-2743-snmpd-crashes-when-receiving-a-GetN.patch @@ -0,0 +1,36 @@ +From 2170e345858738e65d3156a49d3186e4a9288821 Mon Sep 17 00:00:00 2001 +From: Zhenggen Xu +Date: Fri, 12 Oct 2018 17:13:54 -0700 +Subject: [PATCH] Subject: [PATCH] CHANGES: BUG: 2743: snmpd crashes when + receiving a GetNext PDU with multiple Varbinds + +skip out-of-range varbinds when calling next handler +--- + agent/helpers/table.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/agent/helpers/table.c b/agent/helpers/table.c +index 882e84c..b943d6e 100644 +--- a/agent/helpers/table.c ++++ b/agent/helpers/table.c +@@ -406,6 +406,8 @@ table_helper_handler(netsnmp_mib_handler *handler, + if (reqinfo->mode == MODE_GET) + table_helper_cleanup(reqinfo, request, + SNMP_NOSUCHOBJECT); ++ else ++ request->processed = 1; /* skip if next handler called */ + continue; + } + +@@ -483,6 +485,8 @@ table_helper_handler(netsnmp_mib_handler *handler, + #endif /* NETSNMP_NO_WRITE_SUPPORT */ + table_helper_cleanup(reqinfo, request, + SNMP_NOSUCHOBJECT); ++ else ++ request->processed = 1; /* skip if next handler called */ + continue; + } + /* +-- +2.18.0 + diff --git a/src/snmpd/patch-5.9+dfsg/0006-From-Jiri-Cervenka-snmpd-Fixed-agentx-crashing-and-or-freezing-on-timeout.patch b/src/snmpd/patch-5.9+dfsg/0006-From-Jiri-Cervenka-snmpd-Fixed-agentx-crashing-and-or-freezing-on-timeout.patch new file mode 100644 index 000000000000..d11a9d6d75e9 --- /dev/null +++ b/src/snmpd/patch-5.9+dfsg/0006-From-Jiri-Cervenka-snmpd-Fixed-agentx-crashing-and-or-freezing-on-timeout.patch @@ -0,0 +1,211 @@ +From a5782d0673044ad0c621daed7975f53238bb038e Mon Sep 17 00:00:00 2001 +From: Renuka Manavalan +Date: Tue, 10 Sep 2019 17:51:45 +0000 +Subject: [PATCH] Patch from SourceForge: net-snmp commit #793d59 Avoids snmpd + crash when sub agent timesout. + +--- + agent/mibgroup/agentx/master_admin.c | 1 + + agent/snmp_agent.c | 81 ++++++++++++++++++---------- + include/net-snmp/agent/snmp_agent.h | 5 ++ + 3 files changed, 60 insertions(+), 27 deletions(-) + +diff --git a/agent/mibgroup/agentx/master_admin.c b/agent/mibgroup/agentx/master_admin.c +index 4dc1aa7..8c1d194 100644 +--- a/agent/mibgroup/agentx/master_admin.c ++++ b/agent/mibgroup/agentx/master_admin.c +@@ -158,6 +158,7 @@ close_agentx_session(netsnmp_session * session, int sessid) + for (sp = session->subsession; sp != NULL; sp = sp->next) { + + if (sp->sessid == sessid) { ++ netsnmp_remove_delegated_requests_for_session(sp); + unregister_mibs_by_session(sp); + unregister_index_by_session(sp); + unregister_sysORTable_by_session(sp); +diff --git a/agent/snmp_agent.c b/agent/snmp_agent.c +index b96d650..7cacd1a 100644 +--- a/agent/snmp_agent.c ++++ b/agent/snmp_agent.c +@@ -1409,6 +1409,7 @@ init_agent_snmp_session(netsnmp_session * session, netsnmp_pdu *pdu) + asp->treecache_num = -1; + asp->treecache_len = 0; + asp->reqinfo = SNMP_MALLOC_TYPEDEF(netsnmp_agent_request_info); ++ asp->flags = SNMP_AGENT_FLAGS_NONE; + DEBUGMSGTL(("verbose:asp", "asp %p reqinfo %p created\n", + asp, asp->reqinfo)); + +@@ -1457,6 +1458,9 @@ netsnmp_check_for_delegated(netsnmp_agent_session *asp) + + if (NULL == asp->treecache) + return 0; ++ ++ if (asp->flags & SNMP_AGENT_FLAGS_CANCEL_IN_PROGRESS) ++ return 0; + + for (i = 0; i <= asp->treecache_num; i++) { + for (request = asp->treecache[i].requests_begin; request; +@@ -1535,39 +1539,48 @@ int + netsnmp_remove_delegated_requests_for_session(netsnmp_session *sess) + { + netsnmp_agent_session *asp; +- int count = 0; ++ int total_count = 0; + + for (asp = agent_delegated_list; asp; asp = asp->next) { + /* + * check each request + */ ++ int i; ++ int count = 0; + netsnmp_request_info *request; +- for(request = asp->requests; request; request = request->next) { +- /* +- * check session +- */ +- netsnmp_assert(NULL!=request->subtree); +- if(request->subtree->session != sess) +- continue; ++ for (i = 0; i <= asp->treecache_num; i++) { ++ for (request = asp->treecache[i].requests_begin; request; ++ request = request->next) { ++ /* ++ * check session ++ */ ++ netsnmp_assert(NULL!=request->subtree); ++ if(request->subtree->session != sess) ++ continue; + +- /* +- * matched! mark request as done +- */ +- netsnmp_request_set_error(request, SNMP_ERR_GENERR); +- ++count; ++ /* ++ * matched! mark request as done ++ */ ++ netsnmp_request_set_error(request, SNMP_ERR_GENERR); ++ ++count; ++ } ++ } ++ if (count) { ++ asp->flags |= SNMP_AGENT_FLAGS_CANCEL_IN_PROGRESS; ++ total_count += count; + } + } + + /* + * if we found any, that request may be finished now + */ +- if(count) { ++ if(total_count) { + DEBUGMSGTL(("snmp_agent", "removed %d delegated request(s) for session " +- "%8p\n", count, sess)); +- netsnmp_check_outstanding_agent_requests(); ++ "%8p\n", total_count, sess)); ++ netsnmp_check_delegated_requests(); + } + +- return count; ++ return total_count; + } + + int +@@ -2739,19 +2752,11 @@ handle_var_requests(netsnmp_agent_session *asp) + return final_status; + } + +-/* +- * loop through our sessions known delegated sessions and check to see +- * if they've completed yet. If there are no more delegated sessions, +- * check for and process any queued requests +- */ + void +-netsnmp_check_outstanding_agent_requests(void) ++netsnmp_check_delegated_requests(void) + { + netsnmp_agent_session *asp, *prev_asp = NULL, *next_asp = NULL; + +- /* +- * deal with delegated requests +- */ + for (asp = agent_delegated_list; asp; asp = next_asp) { + next_asp = asp->next; /* save in case we clean up asp */ + if (!netsnmp_check_for_delegated(asp)) { +@@ -2790,6 +2795,23 @@ netsnmp_check_outstanding_agent_requests(void) + prev_asp = asp; + } + } ++} ++ ++ ++/* ++ * loop through our sessions known delegated sessions and check to see ++ * if they've completed yet. If there are no more delegated sessions, ++ * check for and process any queued requests ++ */ ++void ++netsnmp_check_outstanding_agent_requests(void) ++{ ++ netsnmp_agent_session *asp; ++ ++ /* ++ * deal with delegated requests ++ */ ++ netsnmp_check_delegated_requests(); + + /* + * if we are processing a set and there are more delegated +@@ -2819,7 +2841,8 @@ netsnmp_check_outstanding_agent_requests(void) + + netsnmp_processing_set = netsnmp_agent_queued_list; + DEBUGMSGTL(("snmp_agent", "SET request remains queued while " +- "delegated requests finish, asp = %8p\n", asp)); ++ "delegated requests finish, asp = %8p\n", ++ agent_delegated_list)); + break; + } + #endif /* NETSNMP_NO_WRITE_SUPPORT */ +@@ -2880,6 +2903,10 @@ check_delayed_request(netsnmp_agent_session *asp) + case SNMP_MSG_GETBULK: + case SNMP_MSG_GETNEXT: + netsnmp_check_all_requests_status(asp, 0); ++ if (asp->flags & SNMP_AGENT_FLAGS_CANCEL_IN_PROGRESS) { ++ DEBUGMSGTL(("snmp_agent","canceling next walk for asp %p\n", asp)); ++ break; ++ } + handle_getnext_loop(asp); + if (netsnmp_check_for_delegated(asp) && + netsnmp_check_transaction_id(asp->pdu->transid) != +diff --git a/include/net-snmp/agent/snmp_agent.h b/include/net-snmp/agent/snmp_agent.h +index aad8837..43f4fff 100644 +--- a/include/net-snmp/agent/snmp_agent.h ++++ b/include/net-snmp/agent/snmp_agent.h +@@ -32,6 +32,9 @@ extern "C" { + #define SNMP_MAX_PDU_SIZE 64000 /* local constraint on PDU size sent by agent + * (see also SNMP_MAX_MSG_SIZE in snmp_api.h) */ + ++#define SNMP_AGENT_FLAGS_NONE 0x0 ++#define SNMP_AGENT_FLAGS_CANCEL_IN_PROGRESS 0x1 ++ + /* + * If non-zero, causes the addresses of peers to be logged when receptions + * occur. +@@ -205,6 +208,7 @@ extern "C" { + int treecache_num; /* number of current cache entries */ + netsnmp_cachemap *cache_store; + int vbcount; ++ int flags; + } netsnmp_agent_session; + + /* +@@ -240,6 +244,7 @@ extern "C" { + int init_master_agent(void); + void shutdown_master_agent(void); + int agent_check_and_process(int block); ++ void netsnmp_check_delegated_requests(void); + void netsnmp_check_outstanding_agent_requests(void); + + int netsnmp_request_set_error(netsnmp_request_info *request, +-- +2.17.1 + diff --git a/src/snmpd/patch-5.9+dfsg/0007-Linux-VRF-5.7.3-Support.patch b/src/snmpd/patch-5.9+dfsg/0007-Linux-VRF-5.7.3-Support.patch new file mode 100755 index 000000000000..48d13d7f62d6 --- /dev/null +++ b/src/snmpd/patch-5.9+dfsg/0007-Linux-VRF-5.7.3-Support.patch @@ -0,0 +1,799 @@ +From 49ce7fc078dfa8c1a1688e05de4e2d151dbcd76a Mon Sep 17 00:00:00 2001 +From: Harish Venkatraman +Date: Wed, 17 Oct 2018 15:22:04 -0700 +Subject: [PATCH] Linux-VRF 5.7.3 Support from https://sourceforge.net/p/net-snmp/patches/1376/ + +Sourceforge commits related to this consolidated patch are given below. +https://sourceforge.net/p/net-snmp/code/ci/0b637fea62c7b6dc467b94206d0bd2dec6f912ca/ +https://sourceforge.net/p/net-snmp/code/ci/19ba7b0a6b56d201a8563fe6505cd82e313c1c9c/ +https://sourceforge.net/p/net-snmp/code/ci/76336fb63bb74b4dede5dda5c14fb8cf2d60be8e/ +https://sourceforge.net/p/net-snmp/code/ci/c7398de4122102b3250e6dac7c09dbc5d09f1840/ +https://sourceforge.net/p/net-snmp/code/ci/0831ed64a39a34dc040eabe39d0229b07fa2a8a5/ +https://sourceforge.net/p/net-snmp/code/ci/62f6babcc7cfc54c79b442b8a7f45662b4ddc807/ +https://sourceforge.net/p/net-snmp/code/ci/313949522c4d0ddfeac72195fa63512955d9eb28/ + + +This consolidated patch adds native support for VRFs to snmpd. NCLU patches in this same +CCR will be added shortly. The VRF is specified for both listening +addresses as well as TRAP sinks with the 'ipaddr%iface' syntax: + +agentAddress 10.0.1.7%mgmt,22.22.22.22%red +trapsink 10.0.1.9%mgmt +trap2sink 22.22.22.25%red + +The SO_BINDTODEVICE socket option is used to bind a VRF to a particular +socket. + +Testing done included VRFs as well as non-VRF functionality with traps +(v1, v2, and v3) + +--- + agent/agent_trap.c | 20 ++++++++++-- + agent/mibgroup/agentx/master.c | 2 +- + agent/mibgroup/agentx/subagent.c | 2 +- + agent/mibgroup/target/target.c | 3 +- + agent/snmp_agent.c | 21 ++++++++++++- + apps/agentxtrap.c | 2 +- + apps/snmptrap.c | 2 +- + apps/snmptrapd.c | 2 +- + include/net-snmp/library/snmpTCPDomain.h | 2 +- + include/net-snmp/library/snmpUDPBaseDomain.h | 2 +- + include/net-snmp/library/snmpUDPDomain.h | 2 +- + include/net-snmp/library/snmpUDPIPv4BaseDomain.h | 2 +- + include/net-snmp/library/snmpUDPIPv6Domain.h | 2 +- + include/net-snmp/library/snmp_transport.h | 19 +++++++----- + snmplib/snmp_api.c | 4 +-- + snmplib/snmp_transport.c | 26 ++++++++-------- + snmplib/transports/snmpAliasDomain.c | 6 ++-- + snmplib/transports/snmpTCPDomain.c | 16 +++++++--- + snmplib/transports/snmpUDPBaseDomain.c | 39 ++++++++++++++++++------ + snmplib/transports/snmpUDPDomain.c | 15 ++++----- + snmplib/transports/snmpUDPIPv4BaseDomain.c | 4 +-- + snmplib/transports/snmpUDPIPv6Domain.c | 19 ++++----- + snmplib/transports/snmpUnixDomain.c | 5 +-- + 23 files changed, 141 insertions(+), 76 deletions(-) + +diff --git a/agent/agent_trap.c b/agent/agent_trap.c +index 080b8bf..c488ac9 100644 +--- a/agent/agent_trap.c ++++ b/agent/agent_trap.c +@@ -226,6 +226,7 @@ create_trap_session2(const char *sink, const char* sinkport, + { + netsnmp_transport *t; + netsnmp_session session, *sesp; ++ char *iface; + + memset(&session, 0, sizeof(netsnmp_session)); + session.version = version; +@@ -250,7 +251,14 @@ create_trap_session2(const char *sink, const char* sinkport, + ((0 == strcmp("localhost",sink)) || (0 == strcmp("127.0.0.1",sink)))) + session.localname = strdup("localhost"); + +- t = netsnmp_tdomain_transport_full("snmptrap", sink, 0, NULL, sinkport); ++ /* ++ * if given an iface (ip%iface) in sink, send the iface too ++ */ ++ iface = strchr(sink, '%'); ++ if (iface) ++ *iface++ = '\0'; ++ ++ t = netsnmp_tdomain_transport_full("snmptrap", sink, 0, NULL, sinkport, iface); + if (t != NULL) { + sesp = snmp_add(&session, t, NULL, NULL); + +@@ -1219,6 +1227,7 @@ snmpd_parse_config_trapsess(const char *word, char *cptr) + netsnmp_session session, *ss; + netsnmp_transport *transport; + size_t len; ++ char *iface; + + /* + * inform or trap? default to trap +@@ -1240,7 +1249,14 @@ snmpd_parse_config_trapsess(const char *word, char *cptr) + NETSNMP_PARSE_ARGS_NOLOGGING | + NETSNMP_PARSE_ARGS_NOZERO); + +- transport = netsnmp_transport_open_client("snmptrap", session.peername); ++ /* ++ * if iface is given in peer, we will need to bind to that iface ++ */ ++ iface = strchr(session.peername, '%'); ++ if (iface) ++ *iface++ = '\0'; ++ ++ transport = netsnmp_transport_open_client("snmptrap", session.peername, iface); + if (transport == NULL) { + config_perror("snmpd: failed to parse this line."); + return; +diff --git a/agent/mibgroup/agentx/master.c b/agent/mibgroup/agentx/master.c +index baeebaf..6733e7f 100644 +--- a/agent/mibgroup/agentx/master.c ++++ b/agent/mibgroup/agentx/master.c +@@ -126,7 +126,7 @@ real_init_master(void) + sess.remote_port = 0; + sess.callback = handle_master_agentx_packet; + errno = 0; +- t = netsnmp_transport_open_server("agentx", sess.peername); ++ t = netsnmp_transport_open_server("agentx", sess.peername, NULL); + if (t == NULL) { + /* + * diagnose snmp_open errors with the input netsnmp_session +diff --git a/agent/mibgroup/agentx/subagent.c b/agent/mibgroup/agentx/subagent.c +index 1f9d31c..6d38a34 100644 +--- a/agent/mibgroup/agentx/subagent.c ++++ b/agent/mibgroup/agentx/subagent.c +@@ -843,7 +843,7 @@ subagent_open_master_session(void) + + agentx_socket = netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID, + NETSNMP_DS_AGENT_X_SOCKET); +- t = netsnmp_transport_open_client("agentx", agentx_socket); ++ t = netsnmp_transport_open_client("agentx", agentx_socket, NULL); + if (t == NULL) { + /* + * Diagnose snmp_open errors with the input +diff --git a/agent/mibgroup/target/target.c b/agent/mibgroup/target/target.c +index 5619e35..6f58817 100644 +--- a/agent/mibgroup/target/target.c ++++ b/agent/mibgroup/target/target.c +@@ -154,7 +154,8 @@ get_target_sessions(char *taglist, TargetFilterFunction * filterfunct, + tAddress, + targaddrs-> + tAddressLen, +- 0); ++ 0, ++ NULL); + if (t == NULL) { + DEBUGMSGTL(("target_sessions", + "bad dest \"")); +diff --git a/agent/snmp_agent.c b/agent/snmp_agent.c +index b96d650..281e8b2 100644 +--- a/agent/snmp_agent.c ++++ b/agent/snmp_agent.c +@@ -1270,6 +1270,7 @@ init_master_agent(void) + char *cptr; + char *buf = NULL; + char *st; ++ char *iface; + + /* default to a default cache size */ + netsnmp_set_lookup_cache_size(-1); +@@ -1318,6 +1319,9 @@ init_master_agent(void) + * AAL5PVC:itf.vpi.vci (if supported) + * IPX:[network]:node[/port] (if supported) + * ++ * ++ * New format to specify an interface for binding along with IP address ++ * address%iface + */ + + cptr = st; +@@ -1334,7 +1338,22 @@ init_master_agent(void) + "requested\n")); + break; + } +- transport = netsnmp_transport_open_server("snmp", cptr); ++ ++ /* ++ * at some point, we may want to add the special listendevice ++ * keyword support. Not sure how to interact with ip%iface ++ iface = netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID, ++ NETSNMP_DS_AGENT_LISTEN_DEVICE); ++ */ ++ ++ /* Look for %iface so we can send along a specific interface to ++ setsockopt SO_BINDTODEVICE later. */ ++ iface = strchr(cptr, '%'); ++ if (iface) ++ *iface++ = '\0'; ++ ++ transport = netsnmp_transport_open_server("snmp", cptr, iface); ++ + + if (transport == NULL) { + snmp_log(LOG_ERR, "Error opening specified endpoint \"%s\"\n", +diff --git a/apps/agentxtrap.c b/apps/agentxtrap.c +index 4df423c..ebd81a3 100644 +--- a/apps/agentxtrap.c ++++ b/apps/agentxtrap.c +@@ -231,7 +231,7 @@ ConnectingEntry(UNUSED tState self) + + if(!(t = netsnmp_transport_open_client( + "agentx", netsnmp_ds_get_string( +- NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_X_SOCKET)))) { ++ NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_X_SOCKET), NULL))) { + snmp_log(LOG_ERR, "Failed to connect to AgentX server\n"); + change_state(&Exit); + } else if(!(sess = snmp_sess_add_ex( +diff --git a/apps/snmptrap.c b/apps/snmptrap.c +index 7c086db..28d5257 100644 +--- a/apps/snmptrap.c ++++ b/apps/snmptrap.c +@@ -215,7 +215,7 @@ main(int argc, char *argv[]) + } + + ss = snmp_add(&session, +- netsnmp_transport_open_client("snmptrap", session.peername), ++ netsnmp_transport_open_client("snmptrap", session.peername, NULL), + NULL, NULL); + if (ss == NULL) { + /* +diff --git a/apps/snmptrapd.c b/apps/snmptrapd.c +index bce0d47..122a502 100644 +--- a/apps/snmptrapd.c ++++ b/apps/snmptrapd.c +@@ -1186,7 +1186,7 @@ main(int argc, char *argv[]) + *sep = 0; + } + +- transport = netsnmp_transport_open_server("snmptrap", cp); ++ transport = netsnmp_transport_open_server("snmptrap", cp, NULL); + if (transport == NULL) { + snmp_log(LOG_ERR, "couldn't open %s -- errno %d (\"%s\")\n", + cp, errno, strerror(errno)); +diff --git a/include/net-snmp/library/snmpTCPDomain.h b/include/net-snmp/library/snmpTCPDomain.h +index c45856b..3b1fef5 100644 +--- a/include/net-snmp/library/snmpTCPDomain.h ++++ b/include/net-snmp/library/snmpTCPDomain.h +@@ -25,7 +25,7 @@ extern "C" { + #define TRANSPORT_DOMAIN_TCP_IP 1,3,6,1,2,1,100,1,5 + NETSNMP_IMPORT oid netsnmp_snmpTCPDomain[]; + +-netsnmp_transport *netsnmp_tcp_transport(struct sockaddr_in *addr, int local); ++netsnmp_transport *netsnmp_tcp_transport(struct sockaddr_in *addr, int local, char *iface); + + /* + * "Constructor" for transport domain object. +diff --git a/include/net-snmp/library/snmpUDPBaseDomain.h b/include/net-snmp/library/snmpUDPBaseDomain.h +index b9d2c34..0ab2fe5 100644 +--- a/include/net-snmp/library/snmpUDPBaseDomain.h ++++ b/include/net-snmp/library/snmpUDPBaseDomain.h +@@ -18,7 +18,7 @@ extern "C" { + /* + * Prototypes + */ +- void _netsnmp_udp_sockopt_set(int fd, int local); ++ void _netsnmp_udp_sockopt_set(int fd, int local, char *iface); + int netsnmp_udpbase_recv(netsnmp_transport *t, void *buf, int size, + void **opaque, int *olength); + int netsnmp_udpbase_send(netsnmp_transport *t, void *buf, int size, +diff --git a/include/net-snmp/library/snmpUDPDomain.h b/include/net-snmp/library/snmpUDPDomain.h +index 3a09dfd..e402cd8 100644 +--- a/include/net-snmp/library/snmpUDPDomain.h ++++ b/include/net-snmp/library/snmpUDPDomain.h +@@ -18,7 +18,7 @@ extern "C" { + config_require(UDPIPv4Base) + #include + +-netsnmp_transport *netsnmp_udp_transport(struct sockaddr_in *addr, int local); ++netsnmp_transport *netsnmp_udp_transport(struct sockaddr_in *addr, int local, char*iface); + + + /* +diff --git a/include/net-snmp/library/snmpUDPIPv4BaseDomain.h b/include/net-snmp/library/snmpUDPIPv4BaseDomain.h +index 6f7f2c2..8d3e906 100644 +--- a/include/net-snmp/library/snmpUDPIPv4BaseDomain.h ++++ b/include/net-snmp/library/snmpUDPIPv4BaseDomain.h +@@ -25,7 +25,7 @@ extern "C" { + */ + + netsnmp_transport *netsnmp_udpipv4base_transport(struct sockaddr_in *addr, +- int local); ++ int local, char *iface); + + #if defined(HAVE_IP_PKTINFO) || defined(HAVE_IP_RECVDSTADDR) + int netsnmp_udpipv4_recvfrom(int s, void *buf, int len, +diff --git a/include/net-snmp/library/snmpUDPIPv6Domain.h b/include/net-snmp/library/snmpUDPIPv6Domain.h +index 83eba2c..009c510 100644 +--- a/include/net-snmp/library/snmpUDPIPv6Domain.h ++++ b/include/net-snmp/library/snmpUDPIPv6Domain.h +@@ -23,7 +23,7 @@ config_require(UDPBase) + NETSNMP_IMPORT oid netsnmp_UDPIPv6Domain[]; + + netsnmp_transport *netsnmp_udp6_transport(struct sockaddr_in6 *addr, +- int local); ++ int local, char *iface); + + + /* +diff --git a/include/net-snmp/library/snmp_transport.h b/include/net-snmp/library/snmp_transport.h +index 4162897..a3deda7 100644 +--- a/include/net-snmp/library/snmp_transport.h ++++ b/include/net-snmp/library/snmp_transport.h +@@ -206,14 +206,14 @@ typedef struct netsnmp_tdomain_s { + * The f_create_from_tstring field is deprecated, please do not use it + * for new code and try to migrate old code away from using it. + */ +- netsnmp_transport *(*f_create_from_tstring) (const char *, int); ++ netsnmp_transport *(*f_create_from_tstring) (const char *, int, char *); + +- netsnmp_transport *(*f_create_from_ostring) (const u_char *, size_t, int); ++ netsnmp_transport *(*f_create_from_ostring) (const u_char *, size_t, int, char *); + + struct netsnmp_tdomain_s *next; + + netsnmp_transport *(*f_create_from_tstring_new) (const char *, int, +- const char*); ++ const char*, char *); + + } netsnmp_tdomain; + +@@ -273,29 +273,32 @@ void netsnmp_tdomain_init(void); + NETSNMP_IMPORT + netsnmp_transport *netsnmp_tdomain_transport(const char *str, + int local, +- const char *default_domain); ++ const char *default_domain, ++ char *iface); + + NETSNMP_IMPORT + netsnmp_transport *netsnmp_tdomain_transport_full(const char *application, + const char *str, + int local, + const char *default_domain, +- const char *default_target); ++ const char *default_target, ++ char *iface); + + NETSNMP_IMPORT + netsnmp_transport *netsnmp_tdomain_transport_oid(const oid * dom, + size_t dom_len, + const u_char * o, + size_t o_len, +- int local); ++ int local, ++ char *iface); + + NETSNMP_IMPORT + netsnmp_transport* +-netsnmp_transport_open_client(const char* application, const char* str); ++netsnmp_transport_open_client(const char* application, const char* str, char *iface); + + NETSNMP_IMPORT + netsnmp_transport* +-netsnmp_transport_open_server(const char* application, const char* str); ++netsnmp_transport_open_server(const char* application, const char* str, char *iface); + + netsnmp_transport* + netsnmp_transport_open(const char* application, const char* str, int local); +diff --git a/snmplib/snmp_api.c b/snmplib/snmp_api.c +index d155c99..5128c56 100644 +--- a/snmplib/snmp_api.c ++++ b/snmplib/snmp_api.c +@@ -1557,12 +1557,12 @@ _sess_open(netsnmp_session * in_session) + transport = + netsnmp_tdomain_transport_full("snmp", in_session->peername, + in_session->local_port, "tcp,tcp6", +- NULL); ++ NULL, NULL); + } else { + transport = + netsnmp_tdomain_transport_full("snmp", in_session->peername, + in_session->local_port, "udp,udp6", +- NULL); ++ NULL, NULL); + } + + if (NULL != clientaddr_save) +diff --git a/snmplib/snmp_transport.c b/snmplib/snmp_transport.c +index ada4781..40cd631 100644 +--- a/snmplib/snmp_transport.c ++++ b/snmplib/snmp_transport.c +@@ -491,7 +491,8 @@ netsnmp_transport * + netsnmp_tdomain_transport_full(const char *application, + const char *str, int local, + const char *default_domain, +- const char *default_target) ++ const char *default_target, ++ char *iface) + { + netsnmp_tdomain *match = NULL; + const char *addr = NULL; +@@ -646,10 +647,10 @@ netsnmp_tdomain_transport_full(const char *application, + NETSNMP_LOGONCE((LOG_WARNING, + "transport domain %s uses deprecated f_create_from_tstring\n", + match->prefix[0])); +- t = match->f_create_from_tstring(addr, local); ++ t = match->f_create_from_tstring(addr, local, iface); + } + else +- t = match->f_create_from_tstring_new(addr, local, addr2); ++ t = match->f_create_from_tstring_new(addr, local, addr2, iface); + if (t) { + if (lspec) { + free(lspec[0]); +@@ -676,10 +677,11 @@ netsnmp_tdomain_transport_full(const char *application, + + netsnmp_transport * + netsnmp_tdomain_transport(const char *str, int local, +- const char *default_domain) ++ const char *default_domain, ++ char *iface) + { + return netsnmp_tdomain_transport_full("snmp", str, local, default_domain, +- NULL); ++ NULL, iface); + } + + +@@ -687,7 +689,7 @@ netsnmp_tdomain_transport(const char *str, int local, + netsnmp_transport * + netsnmp_tdomain_transport_oid(const oid * dom, + size_t dom_len, +- const u_char * o, size_t o_len, int local) ++ const u_char * o, size_t o_len, int local, char *iface) + { + netsnmp_tdomain *d; + int i; +@@ -700,7 +702,7 @@ netsnmp_tdomain_transport_oid(const oid * dom, + for (i = 0; d->prefix[i] != NULL; i++) { + if (netsnmp_oid_equals(dom, dom_len, d->name, d->name_length) == + 0) { +- return d->f_create_from_ostring(o, o_len, local); ++ return d->f_create_from_ostring(o, o_len, local, iface); + } + } + } +@@ -713,19 +715,19 @@ netsnmp_tdomain_transport_oid(const oid * dom, + netsnmp_transport* + netsnmp_transport_open(const char* application, const char* str, int local) + { +- return netsnmp_tdomain_transport_full(application, str, local, NULL, NULL); ++ return netsnmp_tdomain_transport_full(application, str, local, NULL, NULL, NULL); + } + + netsnmp_transport* +-netsnmp_transport_open_server(const char* application, const char* str) ++netsnmp_transport_open_server(const char* application, const char* str, char *iface) + { +- return netsnmp_tdomain_transport_full(application, str, 1, NULL, NULL); ++ return netsnmp_tdomain_transport_full(application, str, 1, NULL, NULL, iface); + } + + netsnmp_transport* +-netsnmp_transport_open_client(const char* application, const char* str) ++netsnmp_transport_open_client(const char* application, const char* str, char *iface) + { +- return netsnmp_tdomain_transport_full(application, str, 0, NULL, NULL); ++ return netsnmp_tdomain_transport_full(application, str, 0, NULL, NULL, iface); + } + + /** adds a transport to a linked list of transports. +diff --git a/snmplib/transports/snmpAliasDomain.c b/snmplib/transports/snmpAliasDomain.c +index eb50cad..dd7a007 100644 +--- a/snmplib/transports/snmpAliasDomain.c ++++ b/snmplib/transports/snmpAliasDomain.c +@@ -75,7 +75,7 @@ free_alias_config(void) { + + netsnmp_transport * + netsnmp_alias_create_tstring(const char *str, int local, +- const char *default_target) ++ const char *default_target, char *iface) + { + const char *aliasdata; + +@@ -85,13 +85,13 @@ netsnmp_alias_create_tstring(const char *str, int local, + return NULL; + } + +- return netsnmp_tdomain_transport(aliasdata,local,default_target); ++ return netsnmp_tdomain_transport(aliasdata,local,default_target, iface); + } + + + + netsnmp_transport * +-netsnmp_alias_create_ostring(const u_char * o, size_t o_len, int local) ++netsnmp_alias_create_ostring(const u_char * o, size_t o_len, int local, char *iface) + { + fprintf(stderr, "make ostring\n"); + return NULL; +diff --git a/snmplib/transports/snmpTCPDomain.c b/snmplib/transports/snmpTCPDomain.c +index 7feb028..6eb717e 100644 +--- a/snmplib/transports/snmpTCPDomain.c ++++ b/snmplib/transports/snmpTCPDomain.c +@@ -144,7 +144,7 @@ netsnmp_tcp_accept(netsnmp_transport *t) + */ + + netsnmp_transport * +-netsnmp_tcp_transport(struct sockaddr_in *addr, int local) ++netsnmp_tcp_transport(struct sockaddr_in *addr, int local, char *iface) + { + netsnmp_transport *t = NULL; + netsnmp_udp_addr_pair *addr_pair = NULL; +@@ -212,6 +212,11 @@ netsnmp_tcp_transport(struct sockaddr_in *addr, int local) + * We should set SO_REUSEADDR too. + */ + ++ if (iface && setsockopt(t->sock, SOL_SOCKET, SO_BINDTODEVICE, ++ iface, strlen(iface)) == -1) ++ snmp_log(LOG_ERR, "Bind interface %s to socket: %s\n", ++ iface, strerror(errno)); ++ + setsockopt(t->sock, SOL_SOCKET, SO_REUSEADDR, (void *)&opt, + sizeof(opt)); + +@@ -305,12 +310,13 @@ netsnmp_tcp_transport(struct sockaddr_in *addr, int local) + + netsnmp_transport * + netsnmp_tcp_create_tstring(const char *str, int local, +- const char *default_target) ++ const char *default_target, ++ char *iface) + { + struct sockaddr_in addr; + + if (netsnmp_sockaddr_in2(&addr, str, default_target)) { +- return netsnmp_tcp_transport(&addr, local); ++ return netsnmp_tcp_transport(&addr, local, iface); + } else { + return NULL; + } +@@ -319,7 +325,7 @@ netsnmp_tcp_create_tstring(const char *str, int local, + + + netsnmp_transport * +-netsnmp_tcp_create_ostring(const u_char * o, size_t o_len, int local) ++netsnmp_tcp_create_ostring(const u_char * o, size_t o_len, int local, char *iface) + { + struct sockaddr_in addr; + +@@ -328,7 +334,7 @@ netsnmp_tcp_create_ostring(const u_char * o, size_t o_len, int local) + addr.sin_family = AF_INET; + memcpy((u_char *) & (addr.sin_addr.s_addr), o, 4); + addr.sin_port = htons(porttmp); +- return netsnmp_tcp_transport(&addr, local); ++ return netsnmp_tcp_transport(&addr, local, iface); + } + return NULL; + } +diff --git a/snmplib/transports/snmpUDPBaseDomain.c b/snmplib/transports/snmpUDPBaseDomain.c +index 8497f71..7b415bc 100644 +--- a/snmplib/transports/snmpUDPBaseDomain.c ++++ b/snmplib/transports/snmpUDPBaseDomain.c +@@ -21,6 +21,9 @@ + #if HAVE_NETINET_IN_H + #include + #endif ++#if HAVE_NET_IF_H ++#include ++#endif + #if HAVE_ARPA_INET_H + #include + #endif +@@ -53,8 +56,14 @@ + #endif + + void +-_netsnmp_udp_sockopt_set(int fd, int local) ++_netsnmp_udp_sockopt_set(int fd, int local, char *iface) + { ++ ++ if (iface && setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, iface, strlen(iface)) == -1) ++ snmp_log(LOG_ERR, "Bind socket on interface: %s: %s\n", iface, strerror(errno)); ++ else if (iface) ++ DEBUGMSGTL(("socket:option", "setting SO_BINDTODEVICE to %s\n", iface)); ++ + #ifdef SO_BSDCOMPAT + /* + * Patch for Linux. Without this, UDP packets that fail get an ICMP +@@ -237,7 +246,10 @@ int netsnmp_udpbase_sendto(int fd, struct in_addr *srcip, int if_index, + struct msghdr m = { 0 }; + char cmsg[CMSG_SPACE(cmsg_data_size)]; + int rc; +- ++ char iface[IFNAMSIZ]; ++ socklen_t ifacelen = IFNAMSIZ; ++ ++ iface[0] = '\0'; + iov.iov_base = data; + iov.iov_len = len; + +@@ -269,14 +281,23 @@ int netsnmp_udpbase_sendto(int fd, struct in_addr *srcip, int if_index, + + memset(&ipi, 0, sizeof(ipi)); + /* +- * Except in the case of responding +- * to a broadcast, setting the ifindex +- * when responding results in incorrect +- * behavior of changing the source address +- * that the manager sees the response +- * come from. ++ * For asymmetric multihomed users, we only set ifindex to 0 ++ * to let kernel handle return if there was no iface bound to the socket. + */ +- ipi.ipi_ifindex = 0; ++ if (getsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, iface, &ifacelen) != 0) { ++ DEBUGMSGTL(("socket:option", "error getsockopt %s\n", strerror(errno))); ++ DEBUGMSGTL(("socket:option", "sendto: SO_BINDTODEVICE not set ifindex=0\n")); ++ ipi.ipi_ifindex = 0; ++ } else if (!ifacelen) { ++ DEBUGMSGTL(("socket:option", "sendto: SO_BINDTODEVICE not set ifacelen=%d ifindex=0\n", ++ ifacelen)); ++ ipi.ipi_ifindex = 0; ++ } else { ++ DEBUGMSGTL(("socket:option", "sendto: SO_BINDTODEVICE dev=%s using ifindex=%d\n", ++ iface, if_index)); ++ ipi.ipi_ifindex = if_index; ++ } ++ + #if defined(cygwin) + ipi.ipi_addr.s_addr = srcip->s_addr; + #else +diff --git a/snmplib/transports/snmpUDPDomain.c b/snmplib/transports/snmpUDPDomain.c +index a0abd8c..fc68303 100644 +--- a/snmplib/transports/snmpUDPDomain.c ++++ b/snmplib/transports/snmpUDPDomain.c +@@ -84,7 +84,7 @@ typedef netsnmp_indexed_addr_pair netsnmp_udp_addr_pair; + * not static, since snmpUDPIPv6Domain needs it, but not public, either. + * (ie don't put it in a public header.) + */ +-void _netsnmp_udp_sockopt_set(int fd, int server); ++void _netsnmp_udp_sockopt_set(int fd, int server, char *iface); + int + netsnmp_sockaddr_in2(struct sockaddr_in *addr, + const char *inpeername, const char *default_target); +@@ -125,11 +125,11 @@ int netsnmp_udp_sendto(int fd, struct in_addr *srcip, int if_index, struct socka + */ + + netsnmp_transport * +-netsnmp_udp_transport(struct sockaddr_in *addr, int local) ++netsnmp_udp_transport(struct sockaddr_in *addr, int local, char *iface) + { + netsnmp_transport *t = NULL; + +- t = netsnmp_udpipv4base_transport(addr, local); ++ t = netsnmp_udpipv4base_transport(addr, local, iface); + if (NULL == t) { + return NULL; + } +@@ -473,12 +473,13 @@ netsnmp_udp_getSecName(void *opaque, int olength, + + netsnmp_transport * + netsnmp_udp_create_tstring(const char *str, int local, +- const char *default_target) ++ const char *default_target, ++ char *iface) + { + struct sockaddr_in addr; + + if (netsnmp_sockaddr_in2(&addr, str, default_target)) { +- return netsnmp_udp_transport(&addr, local); ++ return netsnmp_udp_transport(&addr, local, iface); + } else { + return NULL; + } +@@ -486,7 +487,7 @@ netsnmp_udp_create_tstring(const char *str, int local, + + + netsnmp_transport * +-netsnmp_udp_create_ostring(const u_char * o, size_t o_len, int local) ++netsnmp_udp_create_ostring(const u_char * o, size_t o_len, int local, char *iface) + { + struct sockaddr_in addr; + +@@ -495,7 +496,7 @@ netsnmp_udp_create_ostring(const u_char * o, size_t o_len, int local) + addr.sin_family = AF_INET; + memcpy((u_char *) & (addr.sin_addr.s_addr), o, 4); + addr.sin_port = htons(porttmp); +- return netsnmp_udp_transport(&addr, local); ++ return netsnmp_udp_transport(&addr, local, iface); + } + return NULL; + } +diff --git a/snmplib/transports/snmpUDPIPv4BaseDomain.c b/snmplib/transports/snmpUDPIPv4BaseDomain.c +index 8c0fb05..7991b6a 100644 +--- a/snmplib/transports/snmpUDPIPv4BaseDomain.c ++++ b/snmplib/transports/snmpUDPIPv4BaseDomain.c +@@ -57,7 +57,7 @@ int netsnmp_udpipv4_sendto(int fd, struct in_addr *srcip, int if_index, + #endif /* HAVE_IP_PKTINFO || HAVE_IP_RECVDSTADDR */ + + netsnmp_transport * +-netsnmp_udpipv4base_transport(struct sockaddr_in *addr, int local) ++netsnmp_udpipv4base_transport(struct sockaddr_in *addr, int local, char *iface) + { + netsnmp_transport *t = NULL; + int rc = 0, rc2; +@@ -95,7 +95,7 @@ netsnmp_udpipv4base_transport(struct sockaddr_in *addr, int local) + return NULL; + } + +- _netsnmp_udp_sockopt_set(t->sock, local); ++ _netsnmp_udp_sockopt_set(t->sock, local, iface); + + if (local) { + #ifndef NETSNMP_NO_LISTEN_SUPPORT +diff --git a/snmplib/transports/snmpUDPIPv6Domain.c b/snmplib/transports/snmpUDPIPv6Domain.c +index 18de876..6b44b22 100644 +--- a/snmplib/transports/snmpUDPIPv6Domain.c ++++ b/snmplib/transports/snmpUDPIPv6Domain.c +@@ -74,12 +74,6 @@ oid netsnmp_UDPIPv6Domain[] = { TRANSPORT_DOMAIN_UDP_IPV6 }; + static netsnmp_tdomain udp6Domain; + + /* +- * from snmpUDPDomain. not static, but not public, either. +- * (ie don't put it in a public header.) +- */ +-extern void _netsnmp_udp_sockopt_set(int fd, int server); +- +-/* + * Return a string representing the address in data, or else the "far end" + * address if data is NULL. + */ +@@ -186,7 +186,7 @@ netsnmp_udp6_send(netsnmp_transport *t, void *buf, int size, + */ + + netsnmp_transport * +-netsnmp_udp6_transport(struct sockaddr_in6 *addr, int local) ++netsnmp_udp6_transport(struct sockaddr_in6 *addr, int local, char *iface) + { + netsnmp_transport *t = NULL; + int rc = 0; +@@ -223,7 +223,7 @@ netsnmp_udp6_transport(struct sockaddr_in6 *addr, int local) + return NULL; + } + +- _netsnmp_udp_sockopt_set(t->sock, local); ++ _netsnmp_udp_sockopt_set(t->sock, local, iface); + + if (local) { + #ifndef NETSNMP_NO_LISTEN_SUPPORT +@@ -724,12 +724,13 @@ netsnmp_udp6_getSecName(void *opaque, int olength, + + netsnmp_transport * + netsnmp_udp6_create_tstring(const char *str, int local, +- const char *default_target) ++ const char *default_target, ++ char *iface) + { + struct sockaddr_in6 addr; + + if (netsnmp_sockaddr_in6_2(&addr, str, default_target)) { +- return netsnmp_udp6_transport(&addr, local); ++ return netsnmp_udp6_transport(&addr, local, iface); + } else { + return NULL; + } +@@ -746,7 +747,7 @@ netsnmp_udp6_create_tstring(const char *str, int local, + */ + + netsnmp_transport * +-netsnmp_udp6_create_ostring(const u_char * o, size_t o_len, int local) ++netsnmp_udp6_create_ostring(const u_char * o, size_t o_len, int local, char *iface) + { + struct sockaddr_in6 addr; + +@@ -755,7 +756,7 @@ netsnmp_udp6_create_ostring(const u_char * o, size_t o_len, int local) + addr.sin6_family = AF_INET6; + memcpy((u_char *) & (addr.sin6_addr.s6_addr), o, 16); + addr.sin6_port = htons((o[16] << 8) + o[17]); +- return netsnmp_udp6_transport(&addr, local); ++ return netsnmp_udp6_transport(&addr, local, iface); + } + return NULL; + } +diff --git a/snmplib/transports/snmpUnixDomain.c b/snmplib/transports/snmpUnixDomain.c +index 47dffc1..af56c5d 100644 +--- a/snmplib/transports/snmpUnixDomain.c ++++ b/snmplib/transports/snmpUnixDomain.c +@@ -450,7 +450,8 @@ netsnmp_unix_transport(struct sockaddr_un *addr, int local) + + netsnmp_transport * + netsnmp_unix_create_tstring(const char *string, int local, +- const char *default_target) ++ const char *default_target, ++ char *iface) + { + struct sockaddr_un addr; + +@@ -476,7 +477,7 @@ netsnmp_unix_create_tstring(const char *string, int local, + + + netsnmp_transport * +-netsnmp_unix_create_ostring(const u_char * o, size_t o_len, int local) ++netsnmp_unix_create_ostring(const u_char * o, size_t o_len, int local, char *iface) + { + struct sockaddr_un addr; + +-- +2.7.4 + diff --git a/src/snmpd/patch-5.9+dfsg/0008-Enable-macro-DEB_BUILD_ARCH_OS-in-order-to-build-ipv.patch b/src/snmpd/patch-5.9+dfsg/0008-Enable-macro-DEB_BUILD_ARCH_OS-in-order-to-build-ipv.patch new file mode 100644 index 000000000000..29ab551c7a18 --- /dev/null +++ b/src/snmpd/patch-5.9+dfsg/0008-Enable-macro-DEB_BUILD_ARCH_OS-in-order-to-build-ipv.patch @@ -0,0 +1,22 @@ +From 6e038423d7a3269dbfd85b3d7ada6015479f1559 Mon Sep 17 00:00:00 2001 +From: Qi Luo +Date: Fri, 20 Sep 2019 00:42:19 +0000 +Subject: [PATCH] Enable macro DEB_BUILD_ARCH_OS in order to build ipv6 feature + +--- + debian/rules | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/debian/rules b/debian/rules +index 4c3b5b6..1fab6a4 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -4,4 +4,5 @@ + export DEB_BUILD_MAINT_OPTIONS := hardening=+all + DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) ++DEB_BUILD_ARCH_OS ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS) + + LIB_VERSION = 40 +-- +2.18.0 + diff --git a/src/snmpd/patch-5.9+dfsg/series b/src/snmpd/patch-5.9+dfsg/series new file mode 100644 index 000000000000..cabee4060f9f --- /dev/null +++ b/src/snmpd/patch-5.9+dfsg/series @@ -0,0 +1,5 @@ +0001-SNMP-Stop-spamming-logs-with-statfs-permission-denie.patch +#0002-at.c-properly-check-return-status-from-realloc.-Than.patch +#0006-From-Jiri-Cervenka-snmpd-Fixed-agentx-crashing-and-or-freezing-on-timeout.patch +#0007-Linux-VRF-5.7.3-Support.patch +0008-Enable-macro-DEB_BUILD_ARCH_OS-in-order-to-build-ipv.patch diff --git a/src/socat/Makefile b/src/socat/Makefile index cc2cd7238684..1d1a0b36695c 100644 --- a/src/socat/Makefile +++ b/src/socat/Makefile @@ -6,19 +6,19 @@ MAIN_TARGET = socat_$(SOCAT_VERSION)_$(CONFIGURED_ARCH).deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Remove any stale files - rm -rf ./socat-1.7.3.1 + rm -rf ./socat-1.7.4.1 # Get source package - wget -NO socat_$(SOCAT_VERSION).dsc "https://sonicstorage.blob.core.windows.net/packages/debian/socat_1.7.3.1-2+deb9u1.dsc?sv=2015-04-05&sr=b&sig=Ph7aMqb%2F%2FE%2F8qwxMXoXb5oK1YPkfVt6PV8mBBv5Wi%2F4%3D&se=2155-07-05T11%3A42%3A29Z&sp=r" - wget -NO socat_$(SOCAT_VERSION).debian.tar.xz "https://sonicstorage.blob.core.windows.net/packages/debian/socat_1.7.3.1-2+deb9u1.debian.tar.xz?sv=2015-04-05&sr=b&sig=yv77Fr5RtZgRTPmJK3j0lZ0BzsCiGaSs2i7NqQKEy2Y%3D&se=2155-07-05T11%3A39%3A59Z&sp=r" - wget -NO socat_1.7.3.1.orig.tar.gz "https://sonicstorage.blob.core.windows.net/packages/debian/socat_1.7.3.1.orig.tar.gz?sv=2015-04-05&sr=b&sig=0Ai1FM604aGsF5uBu2yN8w9O1a6zNjIDCdaiTo24DyQ%3D&se=2155-07-05T11%3A40%3A14Z&sp=r" + wget -NO socat_$(SOCAT_VERSION).dsc "https://sonicstorage.blob.core.windows.net/packages/debian/socat_1.7.4.1-3.dsc?sv=2020-04-08&st=2021-12-14T00%3A00%3A00Z&se=2050-12-15T00%3A00%3A00Z&sr=b&sp=r&sig=fIy6dVz3s59K0TiMkTlwSWN8lCzRl3i76ruAtROhfWA%3D" + wget -NO socat_$(SOCAT_VERSION).debian.tar.xz "https://sonicstorage.blob.core.windows.net/packages/debian/socat_1.7.4.1-3.debian.tar.xz?sv=2020-04-08&st=2021-12-14T08%3A00%3A00Z&se=2030-12-14T18%3A18%3A00Z&sr=b&sp=r&sig=C8aYSvaQgMJ58Z13kFY0Wr0J0QF6i7WCeET9%2BpF%2BAxc%3D" + wget -NO socat_1.7.4.1.orig.tar.gz "https://sonicstorage.blob.core.windows.net/packages/debian/socat_1.7.4.1.orig.tar.gz?sv=2020-04-08&st=2021-12-14T00%3A00%3A00Z&se=2050-12-15T00%3A00%3A00Z&sr=b&sp=r&sig=gpihyZv%2Fr0bVrCUKCKwpS4bIoqiPpdd%2BgCfuUGNHOUc%3D" dpkg-source -x socat_$(SOCAT_VERSION).dsc # Build source and Debian packages - pushd socat-1.7.3.1 + pushd socat-1.7.4.1 patch -p0 < ../enable_readline.patch - dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) + DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -rfakeroot -Pnocheck -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) popd # Move the newly-built .deb packages to the destination directory diff --git a/src/socat/enable_readline.patch b/src/socat/enable_readline.patch index f1914d3cb494..0bd34bf377f4 100644 --- a/src/socat/enable_readline.patch +++ b/src/socat/enable_readline.patch @@ -1,13 +1,29 @@ ---- debian/rules.old 2018-08-12 11:48:42.220230100 +0000 -+++ debian/rules 2018-08-12 11:48:52.072230100 +0000 -@@ -12,9 +12,6 @@ - %: - dh $@ --with=autoreconf +--- debian/rules.old 2021-12-14 10:51:09.641165521 -0800 ++++ debian/rules 2021-12-14 10:52:36.494048522 -0800 +@@ -11,9 +11,6 @@ + # upsteram maintains config.h.in manually + export AUTOHEADER = true -override_dh_auto_configure: - dh_auto_configure -- --disable-readline - override_dh_auto_test: + ifneq (, filter $(DEB_BUILD_ARCH_OS), kfreebsd hurd) + dh_auto_test +@@ -24,4 +21,4 @@ + %: + dh $@ --with=autoreconf -.PHONY: override_dh_auto_configure override_dh_auto_test +.PHONY: override_dh_auto_test +--- debian/control.old 2021-12-14 11:30:49.166051931 -0800 ++++ debian/control 2021-12-14 11:30:57.590153464 -0800 +@@ -3,7 +3,7 @@ + Priority: optional + Maintainer: Laszlo Boszormenyi (GCS) + Homepage: http://www.dest-unreach.org/socat/ +-Build-Depends: debhelper-compat (= 12), libssl-dev, libwrap0-dev, openssl , net-tools , iproute2 [linux-any] , netbase ++Build-Depends: debhelper-compat (= 12), libssl-dev, libwrap0-dev, libreadline-dev, openssl , net-tools , iproute2 [linux-any] , netbase + Standards-Version: 4.5.1 + Rules-Requires-Root: no + diff --git a/src/sonic-bgpcfgd/bgpcfgd/main.py b/src/sonic-bgpcfgd/bgpcfgd/main.py index 6442e0299217..28359dd62eb8 100644 --- a/src/sonic-bgpcfgd/bgpcfgd/main.py +++ b/src/sonic-bgpcfgd/bgpcfgd/main.py @@ -9,6 +9,7 @@ from .config import ConfigMgr from .directory import Directory from .log import log_notice, log_crit +from .managers_advertise_rt import AdvertiseRouteMgr from .managers_allow_list import BGPAllowListMgr from .managers_bbr import BBRMgr from .managers_bgp import BGPPeerMgrBase @@ -59,6 +60,8 @@ def do_work(): BBRMgr(common_objs, "CONFIG_DB", "BGP_BBR"), # Static Route Managers StaticRouteMgr(common_objs, "CONFIG_DB", "STATIC_ROUTE"), + # Route Advertisement Managers + AdvertiseRouteMgr(common_objs, "STATE_DB", swsscommon.STATE_ADVERTISE_NETWORK_TABLE_NAME), ] runner = Runner(common_objs['cfg_mgr']) for mgr in managers: diff --git a/src/sonic-bgpcfgd/bgpcfgd/managers_advertise_rt.py b/src/sonic-bgpcfgd/bgpcfgd/managers_advertise_rt.py new file mode 100644 index 000000000000..352b89f7286c --- /dev/null +++ b/src/sonic-bgpcfgd/bgpcfgd/managers_advertise_rt.py @@ -0,0 +1,108 @@ +from .manager import Manager +from .template import TemplateFabric +from swsscommon import swsscommon + + +class AdvertiseRouteMgr(Manager): + """ This class Advertises routes when ADVERTISE_NETWORK_TABLE in STATE_DB is updated """ + def __init__(self, common_objs, db, table): + """ + Initialize the object + :param common_objs: common object dictionary + :param db: name of the db + :param table: name of the table in the db + """ + super(AdvertiseRouteMgr, self).__init__( + common_objs, + [], + db, + table, + ) + + self.directory.subscribe([("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME, "localhost/bgp_asn"),], self.on_bgp_asn_change) + self.advertised_routes = dict() + + + OP_DELETE = 'DELETE' + OP_ADD = 'ADD' + + + def set_handler(self, key, data): + vrf, ip_prefix = self.split_key(key) + self.add_route_advertisement(vrf, ip_prefix) + + return True + + + def del_handler(self, key): + vrf, ip_prefix = self.split_key(key) + self.remove_route_advertisement(vrf, ip_prefix) + + + def add_route_advertisement(self, vrf, ip_prefix): + if self.directory.path_exist("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME, "localhost/bgp_asn"): + if not self.advertised_routes.get(vrf, set()): + self.bgp_network_import_check_commands(vrf, self.OP_ADD) + self.advertise_route_commands(ip_prefix, vrf, self.OP_ADD) + + self.advertised_routes.setdefault(vrf, set()).add(ip_prefix) + + + def remove_route_advertisement(self, vrf, ip_prefix): + self.advertised_routes.setdefault(vrf, set()).discard(ip_prefix) + if not self.advertised_routes.get(vrf, set()): + self.advertised_routes.pop(vrf, None) + + if self.directory.path_exist("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME, "localhost/bgp_asn"): + if not self.advertised_routes.get(vrf, set()): + self.bgp_network_import_check_commands(vrf, self.OP_DELETE) + self.advertise_route_commands(ip_prefix, vrf, self.OP_DELETE) + + + def advertise_route_commands(self, ip_prefix, vrf, op): + is_ipv6 = TemplateFabric.is_ipv6(ip_prefix) + bgp_asn = self.directory.get_slot("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME)["localhost"]["bgp_asn"] + + cmd_list = [] + if vrf == 'default': + cmd_list.append("router bgp %s" % bgp_asn) + else: + cmd_list.append("router bgp %s vrf %s" % (bgp_asn, vrf)) + + cmd_list.append(" address-family %s unicast" % ("ipv6" if is_ipv6 else "ipv4")) + cmd_list.append(" %snetwork %s" % ('no ' if op == self.OP_DELETE else '', ip_prefix)) + + self.cfg_mgr.push_list(cmd_list) + + + def bgp_network_import_check_commands(self, vrf, op): + bgp_asn = self.directory.get_slot("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME)["localhost"]["bgp_asn"] + cmd_list = [] + if vrf == 'default': + cmd_list.append("router bgp %s" % bgp_asn) + else: + cmd_list.append("router bgp %s vrf %s" % (bgp_asn, vrf)) + cmd_list.append(" %sbgp network import-check" % ('' if op == self.OP_DELETE else 'no ')) + + self.cfg_mgr.push_list(cmd_list) + + + def on_bgp_asn_change(self): + if self.directory.path_exist("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME, "localhost/bgp_asn"): + for vrf, ip_prefixes in self.advertised_routes.items(): + self.bgp_network_import_check_commands(vrf, self.OP_ADD) + for ip_prefix in ip_prefixes: + self.add_route_advertisement(vrf, ip_prefix) + + + @staticmethod + def split_key(key): + """ + Split key into vrf name and prefix. + :param key: key to split + :return: vrf name extracted from the key, ip prefix extracted from the key + """ + if '|' not in key: + return 'default', key + else: + return tuple(key.split('|', 1)) diff --git a/src/sonic-bgpcfgd/bgpcfgd/managers_allow_list.py b/src/sonic-bgpcfgd/bgpcfgd/managers_allow_list.py index 435be91d20d2..e03bb19c163f 100644 --- a/src/sonic-bgpcfgd/bgpcfgd/managers_allow_list.py +++ b/src/sonic-bgpcfgd/bgpcfgd/managers_allow_list.py @@ -2,6 +2,7 @@ Implementation of "allow-list" feature """ import re +import ipaddress from .log import log_debug, log_info, log_err, log_warn from .template import TemplateFabric @@ -19,6 +20,7 @@ class BGPAllowListMgr(Manager): ROUTE_MAP_ENTRY_WITH_COMMUNITY_END = 29990 ROUTE_MAP_ENTRY_WITHOUT_COMMUNITY_START = 30000 ROUTE_MAP_ENTRY_WITHOUT_COMMUNITY_END = 65530 + PREFIX_LIST_POS = 1 # the position of the ip prefix in the permit string. V4 = "v4" # constant for af enum: V4 V6 = "v6" # constant for af enum: V6 @@ -228,6 +230,12 @@ def __update_prefix_list(self, af, pl_name, allow_list): constant_list = self.__get_constant_list(af) allow_list = self.__to_prefix_list(af, allow_list) log_debug("BGPAllowListMgr::__update_prefix_list. af='%s' prefix-list name=%s" % (af, pl_name)) + ''' + Need to check exist and equality of the allowed prefix list. + A. If exist and equal, no operation needed. + B. If exist but not equal, first delete then add prefix based on the data from condig db and constants. + C. If non-exist, directly add prefix based on the data from condig db and constants. + ''' exist, correct = self.__is_prefix_list_valid(af, pl_name, allow_list, constant_list) if correct: log_debug("BGPAllowListMgr::__update_prefix_list. the prefix-list '%s' exists and correct" % pl_name) @@ -237,7 +245,7 @@ def __update_prefix_list(self, af, pl_name, allow_list): seq_no = 10 if exist: cmds.append('no %s prefix-list %s' % (family, pl_name)) - for entry in constant_list + allow_list: + for entry in self.__normalize_ipnetwork(af, constant_list + allow_list): cmds.append('%s prefix-list %s seq %d %s' % (family, pl_name, seq_no, entry)) seq_no += 10 return cmds @@ -258,6 +266,24 @@ def __remove_prefix_list(self, af, pl_name): family = self.__af_to_family(af) return ["no %s prefix-list %s" % (family, pl_name)] + def __normalize_ipnetwork(self, af, allow_prefix_list): + ''' + Normalize IPv6 addresses + for example: + 2001:cdba:0000:0000:0000:0000:3257:9652 + 2001:cdba:0:0:0:0:3257:9652 + 2001:cdba::3257:9652 + after normalize, all would be normalized to + 2001:cdba::3257:9652 + ''' + normalize_list = [] + for allow_item in allow_prefix_list: + tmp_list = allow_item.split(' ') + if af == self.V6: + tmp_list[self.PREFIX_LIST_POS] = str(ipaddress.IPv6Network(tmp_list[self.PREFIX_LIST_POS])) + normalize_list.append(' '.join(tmp_list)) + return normalize_list + def __is_prefix_list_valid(self, af, pl_name, allow_list, constant_list): """ Check that a prefix list exists and it has valid entries @@ -266,7 +292,8 @@ def __is_prefix_list_valid(self, af, pl_name, allow_list, constant_list): :param allow_list: a prefix-list which must be a part of the valid prefix list :param constant_list: a constant list which must be on top of each "allow" prefix list on the device :return: a tuple. The first element of the tuple has True if the prefix-list exists, False otherwise, - The second element of the tuple has True if the prefix-list contains correct entries, False if not + The second element of the tuple has True if allow prefix list in running configuraiton is + equal with ones in config db + constants, False if not """ assert af == self.V4 or af == self.V6 family = self.__af_to_family(af) @@ -274,20 +301,18 @@ def __is_prefix_list_valid(self, af, pl_name, allow_list, constant_list): conf = self.cfg_mgr.get_text() if not any(line.strip().startswith(match_string) for line in conf): return False, False # if the prefix list is not exists, it is not correct - constant_set = set(constant_list) - allow_set = set(allow_list) + expect_set = set(self.__normalize_ipnetwork(af, constant_list)) + expect_set.update(set(self.__normalize_ipnetwork(af, allow_list))) + + config_list = [] for line in conf: if line.startswith(match_string): found = line[len(match_string):].strip().split(' ') rule = " ".join(found[1:]) - if rule in constant_set: - constant_set.discard(rule) - elif rule in allow_set: - if constant_set: - return True, False # Not everything from constant set is presented - else: - allow_set.discard(rule) - return True, len(allow_set) == 0 # allow_set should be presented all + config_list.append(rule) + + # Return double Ture, when running configuraiton is identical with config db + constants. + return True, expect_set == set(self.__normalize_ipnetwork(af, config_list)) def __update_community(self, community_name, community_value): """ diff --git a/src/sonic-bgpcfgd/bgpcfgd/managers_bgp.py b/src/sonic-bgpcfgd/bgpcfgd/managers_bgp.py index 3ab7dba4f612..c787ae2abe69 100644 --- a/src/sonic-bgpcfgd/bgpcfgd/managers_bgp.py +++ b/src/sonic-bgpcfgd/bgpcfgd/managers_bgp.py @@ -125,6 +125,9 @@ def __init__(self, common_objs, db_name, table_name, peer_type, check_neig_meta) if self.check_deployment_id: deps.append(("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME, "localhost/deployment_id")) + if self.peer_type == 'internal': + deps.append(("CONFIG_DB", swsscommon.CFG_LOOPBACK_INTERFACE_TABLE_NAME, "Loopback4096")) + super(BGPPeerMgrBase, self).__init__( common_objs, deps, @@ -160,11 +163,17 @@ def add_peer(self, vrf, nbr, data): print_data = vrf, nbr, data bgp_asn = self.directory.get_slot("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME)["localhost"]["bgp_asn"] # - lo0_ipv4 = self.get_lo0_ipv4() + lo0_ipv4 = self.get_lo_ipv4("Loopback0|") if lo0_ipv4 is None: log_warn("Loopback0 ipv4 address is not presented yet") return False # + if self.peer_type == 'internal': + lo4096_ipv4 = self.get_lo_ipv4("Loopback4096|") + if lo4096_ipv4 is None: + log_warn("Loopback4096 ipv4 address is not presented yet") + return False + if "local_addr" not in data: log_warn("Peer %s. Missing attribute 'local_addr'" % nbr) else: @@ -299,15 +308,15 @@ def apply_op(self, cmd, vrf): self.cfg_mgr.push(cmd) return True - def get_lo0_ipv4(self): + def get_lo_ipv4(self, loopback_str): """ Extract Loopback0 ipv4 address from the Directory :return: ipv4 address for Loopback0, None if nothing found """ loopback0_ipv4 = None for loopback in self.directory.get_slot("CONFIG_DB", swsscommon.CFG_LOOPBACK_INTERFACE_TABLE_NAME).keys(): - if loopback.startswith("Loopback0|"): - loopback0_prefix_str = loopback.replace("Loopback0|", "") + if loopback.startswith(loopback_str): + loopback0_prefix_str = loopback.replace(loopback_str, "") loopback0_ip_str = loopback0_prefix_str[:loopback0_prefix_str.find('/')] if TemplateFabric.is_ipv4(loopback0_ip_str): loopback0_ipv4 = loopback0_ip_str diff --git a/src/sonic-bgpcfgd/bgpcfgd/managers_static_rt.py b/src/sonic-bgpcfgd/bgpcfgd/managers_static_rt.py index 6fafeda8142d..072a10b3b194 100644 --- a/src/sonic-bgpcfgd/bgpcfgd/managers_static_rt.py +++ b/src/sonic-bgpcfgd/bgpcfgd/managers_static_rt.py @@ -27,6 +27,8 @@ def __init__(self, common_objs, db, table): OP_DELETE = 'DELETE' OP_ADD = 'ADD' + ROUTE_ADVERTISE_ENABLE_TAG = '1' + ROUTE_ADVERTISE_DISABLE_TAG = '2' def set_handler(self, key, data): vrf, ip_prefix = self.split_key(key) @@ -38,11 +40,12 @@ def set_handler(self, key, data): intf_list = arg_list(data['ifname']) if 'ifname' in data else None dist_list = arg_list(data['distance']) if 'distance' in data else None nh_vrf_list = arg_list(data['nexthop-vrf']) if 'nexthop-vrf' in data else None + route_tag = self.ROUTE_ADVERTISE_DISABLE_TAG if 'advertise' in data and data['advertise'] == "false" else self.ROUTE_ADVERTISE_ENABLE_TAG try: ip_nh_set = IpNextHopSet(is_ipv6, bkh_list, nh_list, intf_list, dist_list, nh_vrf_list) - cur_nh_set = self.static_routes.get(vrf, {}).get(ip_prefix, IpNextHopSet(is_ipv6)) - cmd_list = self.static_route_commands(ip_nh_set, cur_nh_set, ip_prefix, vrf) + cur_nh_set, cur_route_tag = self.static_routes.get(vrf, {}).get(ip_prefix, (IpNextHopSet(is_ipv6), route_tag)) + cmd_list = self.static_route_commands(ip_nh_set, cur_nh_set, ip_prefix, vrf, route_tag, cur_route_tag) except Exception as exc: log_crit("Got an exception %s: Traceback: %s" % (str(exc), traceback.format_exc())) return False @@ -60,7 +63,7 @@ def set_handler(self, key, data): else: log_debug("Nothing to update for static route {}".format(key)) - self.static_routes.setdefault(vrf, {})[ip_prefix] = ip_nh_set + self.static_routes.setdefault(vrf, {})[ip_prefix] = (ip_nh_set, route_tag) return True @@ -70,8 +73,8 @@ def del_handler(self, key): is_ipv6 = TemplateFabric.is_ipv6(ip_prefix) ip_nh_set = IpNextHopSet(is_ipv6) - cur_nh_set = self.static_routes.get(vrf, {}).get(ip_prefix, IpNextHopSet(is_ipv6)) - cmd_list = self.static_route_commands(ip_nh_set, cur_nh_set, ip_prefix, vrf) + cur_nh_set, route_tag = self.static_routes.get(vrf, {}).get(ip_prefix, (IpNextHopSet(is_ipv6), self.ROUTE_ADVERTISE_DISABLE_TAG)) + cmd_list = self.static_route_commands(ip_nh_set, cur_nh_set, ip_prefix, vrf, route_tag, route_tag) # Disable redistribution of static routes when it is the last one to delete if self.static_routes.get(vrf, {}).keys() == {ip_prefix}: @@ -99,36 +102,47 @@ def split_key(key): else: return tuple(key.split('|', 1)) - def static_route_commands(self, ip_nh_set, cur_nh_set, ip_prefix, vrf): - diff_set = ip_nh_set.symmetric_difference(cur_nh_set) - + def static_route_commands(self, ip_nh_set, cur_nh_set, ip_prefix, vrf, route_tag, cur_route_tag): op_cmd_list = {} - for ip_nh in diff_set: - if ip_nh in cur_nh_set: - op = self.OP_DELETE - else: - op = self.OP_ADD + if route_tag != cur_route_tag: + for ip_nh in cur_nh_set: + op_cmds = op_cmd_list.setdefault(self.OP_DELETE, []) + op_cmds.append(self.generate_command(self.OP_DELETE, ip_nh, ip_prefix, vrf, cur_route_tag)) + for ip_nh in ip_nh_set: + op_cmds = op_cmd_list.setdefault(self.OP_ADD, []) + op_cmds.append(self.generate_command(self.OP_ADD, ip_nh, ip_prefix, vrf, route_tag)) + else: + diff_set = ip_nh_set.symmetric_difference(cur_nh_set) - op_cmds = op_cmd_list.setdefault(op, []) - op_cmds.append(self.generate_command(op, ip_nh, ip_prefix, vrf)) + for ip_nh in diff_set: + if ip_nh in cur_nh_set: + op = self.OP_DELETE + else: + op = self.OP_ADD + + op_cmds = op_cmd_list.setdefault(op, []) + op_cmds.append(self.generate_command(op, ip_nh, ip_prefix, vrf, route_tag)) cmd_list = op_cmd_list.get(self.OP_DELETE, []) cmd_list += op_cmd_list.get(self.OP_ADD, []) return cmd_list - def generate_command(self, op, ip_nh, ip_prefix, vrf): - return '{}{} route {}{}{}'.format( + def generate_command(self, op, ip_nh, ip_prefix, vrf, route_tag): + return '{}{} route {}{}{}{}'.format( 'no ' if op == self.OP_DELETE else '', 'ipv6' if ip_nh.af == socket.AF_INET6 else 'ip', ip_prefix, ip_nh, - ' vrf {}'.format(vrf) if vrf != 'default' else '' + ' vrf {}'.format(vrf) if vrf != 'default' else '', + ' tag {}'.format(route_tag) ) def enable_redistribution_command(self, vrf): log_debug("Enabling static route redistribution") cmd_list = [] + cmd_list.append("route-map STATIC_ROUTE_FILTER permit 10") + cmd_list.append(" match tag %s" % self.ROUTE_ADVERTISE_ENABLE_TAG) bgp_asn = self.directory.get_slot("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME)["localhost"]["bgp_asn"] if vrf == 'default': cmd_list.append("router bgp %s" % bgp_asn) @@ -136,7 +150,7 @@ def enable_redistribution_command(self, vrf): cmd_list.append("router bgp %s vrf %s" % (bgp_asn, vrf)) for af in ["ipv4", "ipv6"]: cmd_list.append(" address-family %s" % af) - cmd_list.append(" redistribute static") + cmd_list.append(" redistribute static route-map STATIC_ROUTE_FILTER") return cmd_list def disable_redistribution_command(self, vrf): @@ -149,7 +163,8 @@ def disable_redistribution_command(self, vrf): cmd_list.append("router bgp %s vrf %s" % (bgp_asn, vrf)) for af in ["ipv4", "ipv6"]: cmd_list.append(" address-family %s" % af) - cmd_list.append(" no redistribute static") + cmd_list.append(" no redistribute static route-map STATIC_ROUTE_FILTER") + cmd_list.append("no route-map STATIC_ROUTE_FILTER") return cmd_list def on_bgp_asn_change(self): @@ -169,7 +184,9 @@ def __init__(self, af_id, blackhole, dst_ip, if_name, dist, vrf): self.ip = zero_ip(af_id) if dst_ip is None or dst_ip == '' else dst_ip self.interface = '' if if_name is None else if_name self.nh_vrf = '' if vrf is None else vrf - if self.blackhole != 'true' and self.is_zero_ip() and len(self.interface.strip()) == 0: + if not self.is_portchannel(): + self.is_ip_valid() + if self.blackhole != 'true' and self.is_zero_ip() and not self.is_portchannel() and len(self.interface.strip()) == 0: log_err('Mandatory attribute not found for nexthop') raise ValueError def __eq__(self, other): @@ -182,8 +199,15 @@ def __ne__(self, other): self.distance != other.distance or self.nh_vrf != other.nh_vrf) def __hash__(self): return hash((self.af, self.blackhole, self.ip, self.interface, self.distance, self.nh_vrf)) + def is_ip_valid(self): + socket.inet_pton(self.af, self.ip) def is_zero_ip(self): - return sum([x for x in socket.inet_pton(self.af, self.ip)]) == 0 + try: + return sum([x for x in socket.inet_pton(self.af, self.ip)]) == 0 + except socket.error: + return False + def is_portchannel(self): + return True if self.ip.startswith('PortChannel') else False def __format__(self, format): ret_val = '' if self.blackhole == 'true': diff --git a/src/sonic-bgpcfgd/bgpcfgd/template.py b/src/sonic-bgpcfgd/bgpcfgd/template.py index e88073881171..a2b476e6b2c9 100644 --- a/src/sonic-bgpcfgd/bgpcfgd/template.py +++ b/src/sonic-bgpcfgd/bgpcfgd/template.py @@ -75,7 +75,7 @@ def prefix_attr(attr, value): return None else: try: - prefix = netaddr.IPNetwork(str(value)) + prefix = netaddr.IPNetwork(str(value).strip()) except (netaddr.NotRegisteredError, netaddr.AddrFormatError, netaddr.AddrConversionError): return None return str(getattr(prefix, attr)) @@ -105,4 +105,4 @@ def pfx_filter(value): log_err("'%s' is invalid ip address" % ip_address) else: table[key] = val - return table \ No newline at end of file + return table diff --git a/src/sonic-bgpcfgd/setup.py b/src/sonic-bgpcfgd/setup.py index ab86ca20ec19..b451accb9792 100755 --- a/src/sonic-bgpcfgd/setup.py +++ b/src/sonic-bgpcfgd/setup.py @@ -18,6 +18,7 @@ 'jinja2>=2.10', 'netaddr==0.8.0', 'pyyaml==5.4.1', + 'ipaddress==1.0.23' ], setup_requires = [ 'pytest-runner', diff --git a/src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/param_chasiss_packet.json b/src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/param_chasiss_packet.json new file mode 100644 index 000000000000..956758febcfe --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/param_chasiss_packet.json @@ -0,0 +1,13 @@ +{ + "CONFIG_DB__DEVICE_METADATA": { + "localhost": { + "type": "SpineRouter", + "sub_role": "BackEnd", + "switch_type": "chassis-packet" + } + }, + "CONFIG_DB__LOOPBACK_INTERFACE": { + "Loopback4096|10.10.10.10/32": {}, + "Loopback4096|2603:10e2:400::3/128": {} + } +} diff --git a/src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/result_chasiss_packet.conf b/src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/result_chasiss_packet.conf new file mode 100644 index 000000000000..3a6f0bad59aa --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/result_chasiss_packet.conf @@ -0,0 +1,22 @@ +! +! template: bgpd/templates/internal/peer-group.conf.j2 +! + neighbor INTERNAL_PEER_V4 peer-group + neighbor INTERNAL_PEER_V6 peer-group + address-family ipv4 + neighbor INTERNAL_PEER_V4 update-source Loopback4096 + neighbor INTERNAL_PEER_V4 soft-reconfiguration inbound + neighbor INTERNAL_PEER_V4 allowas-in 1 + neighbor INTERNAL_PEER_V4 route-map FROM_BGP_INTERNAL_PEER_V4 in + neighbor INTERNAL_PEER_V4 route-map TO_BGP_INTERNAL_PEER_V4 out + exit-address-family + address-family ipv6 + neighbor INTERNAL_PEER_V6 update-source Loopback4096 + neighbor INTERNAL_PEER_V6 soft-reconfiguration inbound + neighbor INTERNAL_PEER_V6 allowas-in 1 + neighbor INTERNAL_PEER_V6 route-map FROM_BGP_INTERNAL_PEER_V6 in + neighbor INTERNAL_PEER_V6 route-map TO_BGP_INTERNAL_PEER_V6 out + exit-address-family +! +! end of template: bgpd/templates/internal/peer-group.conf.j2 +! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf index b6f7a668bc8c..c39115706d79 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf @@ -33,6 +33,18 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 5 permit 10.10.10.0/24 ! ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 10 permit fc01::/64 ! +ip prefix-list V4_P2P_IP permit 0.0.0.0/0 ge 31 le 31 +! +ipv6 prefix-list V6_P2P_IP permit ::/0 ge 126 le 126 +! +route-map V4_CONNECTED_ROUTES permit 10 + match ip address prefix-list V4_P2P_IP + call HIDE_INTERNAL +! +route-map V6_CONNECTED_ROUTES permit 10 + match ipv6 address prefix-list V6_P2P_IP + call HIDE_INTERNAL +! route-map HIDE_INTERNAL permit 10 set community no-export on-match next @@ -71,10 +83,10 @@ router bgp 55555 exit-address-family ! address-family ipv4 - redistribute connected route-map HIDE_INTERNAL + redistribute connected route-map V4_CONNECTED_ROUTES exit-address-family address-family ipv6 - redistribute connected route-map HIDE_INTERNAL + redistribute connected route-map V6_CONNECTED_ROUTES exit-address-family ! address-family ipv4 diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.json b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.json index 34fdbe72448b..fc5016d8536e 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.json +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.json @@ -3,7 +3,8 @@ "localhost": { "hostname": "new_hostname", "bgp_asn": "55555", - "sub_role": "FrontEnd" + "sub_role": "FrontEnd", + "type": "ToRRouter" } }, "LOOPBACK_INTERFACE": { diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf index 5d09db596538..c5ba79d34392 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf @@ -15,6 +15,18 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 5 permit 10.10.10.0/24 ! ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 10 permit fc01::/64 ! +ip prefix-list V4_P2P_IP permit 0.0.0.0/0 ge 31 le 31 +! +ipv6 prefix-list V6_P2P_IP permit ::/0 ge 126 le 126 +! +route-map V4_CONNECTED_ROUTES permit 10 + match ip address prefix-list V4_P2P_IP + call HIDE_INTERNAL +! +route-map V6_CONNECTED_ROUTES permit 10 + match ipv6 address prefix-list V6_P2P_IP + call HIDE_INTERNAL +! route-map HIDE_INTERNAL permit 10 set community no-export ! @@ -50,10 +62,10 @@ router bgp 55555 exit-address-family ! address-family ipv4 - redistribute connected route-map HIDE_INTERNAL + redistribute connected route-map V4_CONNECTED_ROUTES exit-address-family address-family ipv6 - redistribute connected route-map HIDE_INTERNAL + redistribute connected route-map V6_CONNECTED_ROUTES exit-address-family ! address-family ipv4 diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.json b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.json index c8f0141ec4f5..47508bb3c001 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.json +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.json @@ -2,7 +2,8 @@ "DEVICE_METADATA": { "localhost": { "bgp_asn": "55555", - "sub_role": "FrontEnd" + "sub_role": "FrontEnd", + "type": "ToRRouter" } }, "LOOPBACK_INTERFACE": { diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf index 14aa080efb5d..00b09bd40d9a 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf @@ -15,6 +15,18 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 5 permit 10.10.10.0/24 ! ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 10 permit fc01::/64 ! +ip prefix-list V4_P2P_IP permit 0.0.0.0/0 ge 31 le 31 +! +ipv6 prefix-list V6_P2P_IP permit ::/0 ge 126 le 126 +! +route-map V4_CONNECTED_ROUTES permit 10 + match ip address prefix-list V4_P2P_IP + call HIDE_INTERNAL +! +route-map V6_CONNECTED_ROUTES permit 10 + match ipv6 address prefix-list V6_P2P_IP + call HIDE_INTERNAL +! route-map HIDE_INTERNAL permit 10 set community no-export ! @@ -50,10 +62,10 @@ router bgp 55555 exit-address-family ! address-family ipv4 - redistribute connected route-map HIDE_INTERNAL + redistribute connected route-map V4_CONNECTED_ROUTES exit-address-family address-family ipv6 - redistribute connected route-map HIDE_INTERNAL + redistribute connected route-map V6_CONNECTED_ROUTES exit-address-family ! address-family ipv4 diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.json b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.json index 5b30406668ab..c1b5ae8dc449 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.json +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.json @@ -2,7 +2,8 @@ "DEVICE_METADATA": { "localhost": { "bgp_asn": "55555", - "sub_role": "FrontEnd" + "sub_role": "FrontEnd", + "type": "ToRRouter" } }, "LOOPBACK_INTERFACE": { diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf new file mode 100644 index 000000000000..37ac8827dc46 --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf @@ -0,0 +1,71 @@ +! +! template: bgpd/bgpd.main.conf.j2 +! +! bgp multiple-instance +! +! BGP configuration +! +! TSA configuration +! +ip prefix-list PL_LoopbackV4 permit 55.55.55.55/32 +! +ipv6 prefix-list PL_LoopbackV6 permit fc00::/64 +! +ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 5 permit 10.10.10.0/24 +! +ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 10 permit fc01::/64 +! +ip prefix-list V4_P2P_IP permit 0.0.0.0/0 ge 31 le 31 +! +ipv6 prefix-list V6_P2P_IP permit ::/0 ge 126 le 126 +! +route-map V4_CONNECTED_ROUTES permit 10 + match ip address prefix-list V4_P2P_IP + call HIDE_INTERNAL +! +route-map V6_CONNECTED_ROUTES permit 10 + match ipv6 address prefix-list V6_P2P_IP + call HIDE_INTERNAL +! +route-map HIDE_INTERNAL permit 10 + set community no-export +! +! +router bgp 55555 +! + bgp log-neighbor-changes + no bgp default ipv4-unicast + no bgp ebgp-requires-policy +! + bgp bestpath as-path multipath-relax +! +! + bgp router-id 55.55.55.56 +! + network 55.55.55.55/32 +! + address-family ipv6 + network fc00::1/64 + exit-address-family +! + network 10.10.10.1/24 + address-family ipv6 + network fc01::1/64 + exit-address-family +! + address-family ipv4 + redistribute connected route-map V4_CONNECTED_ROUTES + exit-address-family + address-family ipv6 + redistribute connected route-map V6_CONNECTED_ROUTES + exit-address-family +! + address-family ipv4 + maximum-paths 64 + exit-address-family + address-family ipv6 + maximum-paths 64 + exit-address-family +! +! end of template: bgpd/bgpd.main.conf.j2 +! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.json b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.json new file mode 100644 index 000000000000..41fc9351bebb --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.json @@ -0,0 +1,36 @@ +{ + "DEVICE_METADATA": { + "localhost": { + "bgp_asn": "55555", + "sub_role": "FrontEnd", + "switch_type": "chassis-packet", + "type": "SpineRouter" + } + }, + "LOOPBACK_INTERFACE": { + "Loopback0|55.55.55.55/32": {}, + "Loopback0|fc00::1/128": {}, + "Loopback4096|55.55.55.56/32": {}, + "Loopback4096|fc00::2/128": {} + }, + "VLAN_INTERFACE": { + "Vlan10|10.10.10.1/24": {}, + "Vlan10|fc01::1/64": {}, + "Vlan20": {"vnet_name": "Vnet1"}, + "Vlan20|20.20.20.1/24": {}, + "Vlan20|fd01::1/64": {} + }, + "constants": { + "bgp": { + "multipath_relax": { + "enabled": true + }, + "graceful_restart": { + "enabled": true + }, + "maximum_paths": { + "enabled": true + } + } + } +} diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.conf index b48617a6d840..d8ee10ada1e0 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.conf @@ -15,6 +15,18 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 5 permit 10.10.10.0/24 ! ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 10 permit fc01::/64 ! +ip prefix-list V4_P2P_IP permit 0.0.0.0/0 ge 31 le 31 +! +ipv6 prefix-list V6_P2P_IP permit ::/0 ge 126 le 126 +! +route-map V4_CONNECTED_ROUTES permit 10 + match ip address prefix-list V4_P2P_IP + call HIDE_INTERNAL +! +route-map V6_CONNECTED_ROUTES permit 10 + match ipv6 address prefix-list V6_P2P_IP + call HIDE_INTERNAL +! route-map HIDE_INTERNAL permit 10 set community no-export ! @@ -27,10 +39,6 @@ router bgp 55555 ! bgp bestpath as-path multipath-relax ! - bgp graceful-restart restart-time 240 - bgp graceful-restart - bgp graceful-restart preserve-fw-state - bgp graceful-restart select-defer-time 45 ! bgp router-id 55.55.55.56 ! @@ -50,10 +58,10 @@ router bgp 55555 exit-address-family ! address-family ipv4 - redistribute connected route-map HIDE_INTERNAL + redistribute connected route-map V4_CONNECTED_ROUTES exit-address-family address-family ipv6 - redistribute connected route-map HIDE_INTERNAL + redistribute connected route-map V6_CONNECTED_ROUTES exit-address-family ! address-family ipv4 diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.json b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.json index 4cbb4c0048c3..00c913981a1e 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.json +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/voq_chassis.json @@ -3,7 +3,8 @@ "localhost": { "bgp_asn": "55555", "sub_role": "", - "switch_type": "voq" + "switch_type": "voq", + "type": "SpineRouter" } }, "LOOPBACK_INTERFACE": { diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf index bf01c12f2757..606788cba999 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf @@ -32,10 +32,6 @@ link-detect ! !! ! -! set static default route to mgmt gateway as a backup to learned default -ip route 0.0.0.0/0 10.10.10.1 200 -!! -! ! add static ipv6 /64 loopback route to allow bgpd to advertise the loopback route prefix ipv6 route fc00::/64 Loopback0 !! @@ -56,6 +52,18 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 5 permit 10.10.10.0/24 ! ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 10 permit fc01::/64 ! +ip prefix-list V4_P2P_IP permit 0.0.0.0/0 ge 31 le 31 +! +ipv6 prefix-list V6_P2P_IP permit ::/0 ge 126 le 126 +! +route-map V4_CONNECTED_ROUTES permit 10 + match ip address prefix-list V4_P2P_IP + call HIDE_INTERNAL +! +route-map V6_CONNECTED_ROUTES permit 10 + match ipv6 address prefix-list V6_P2P_IP + call HIDE_INTERNAL +! route-map HIDE_INTERNAL permit 10 set community no-export ! @@ -90,10 +98,10 @@ router bgp 55555 exit-address-family ! address-family ipv4 - redistribute connected route-map HIDE_INTERNAL + redistribute connected route-map V4_CONNECTED_ROUTES exit-address-family address-family ipv6 - redistribute connected route-map HIDE_INTERNAL + redistribute connected route-map V6_CONNECTED_ROUTES exit-address-family ! address-family ipv4 diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.json b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.json index 92143a2a9deb..9c8a34fb4120 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.json +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.json @@ -3,7 +3,8 @@ "localhost": { "bgp_asn": "55555", "hostname": "test_hostname", - "sub_role": "FrontEnd" + "sub_role": "FrontEnd", + "type": "ToRRouter" } }, "INTERFACE": { diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/staticd/staticd.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/staticd/staticd.conf index 59bbe983af76..0a2a7d4effba 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/staticd/staticd.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/staticd/staticd.conf @@ -14,8 +14,6 @@ log facility local4 ! ! end of template: common/daemons.common.conf.j2! ! -! set static default route to mgmt gateway as a backup to learned default -ip route 0.0.0.0/0 10.10.10.1 200 !! ! ! add static ipv6 /64 loopback route to allow bgpd to advertise the loopback route prefix diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/staticd/staticd.conf.json b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/staticd/staticd.conf.json index 0cbd67c7ef68..3b46cc276aee 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/staticd/staticd.conf.json +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/staticd/staticd.conf.json @@ -4,11 +4,6 @@ "hostname": "new_hostname" } }, - "MGMT_INTERFACE": { - "eth0|10.10.10.10/24": { - "gwaddr": "10.10.10.1" - } - }, "LOOPBACK_INTERFACE": { "Loopback0|FC00:1::32/128": {} } diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/staticd/staticd.default_route.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/staticd/staticd.default_route.conf deleted file mode 100644 index 11adb98ebc3c..000000000000 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/staticd/staticd.default_route.conf +++ /dev/null @@ -1,4 +0,0 @@ -! -! set static default route to mgmt gateway as a backup to learned default -ip route 0.0.0.0/0 10.10.10.1 200 -! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/staticd/staticd.default_route.conf.json b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/staticd/staticd.default_route.conf.json deleted file mode 100644 index 80cd218a790e..000000000000 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/staticd/staticd.default_route.conf.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "MGMT_INTERFACE": { - "eth0|10.10.10.10/24": { - "gwaddr": "10.10.10.1" - } - } -} diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_all.json b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_all_v4.json similarity index 100% rename from src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_all.json rename to src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_all_v4.json diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_all_v6.json b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_all_v6.json new file mode 100644 index 000000000000..d78af6c7588f --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_all_v6.json @@ -0,0 +1,22 @@ +{ + "CONFIG_DB__DEVICE_METADATA": { + "localhost": {} + }, + "neighbor_addr": "fc00::01", + "bgp_session": { + "asn": "555", + "name": "internal1", + "keepalive": "5", + "holdtime": "30", + "admin_status": "down" + }, + "constants": { + "bgp": { + "maximum_paths": { + "enabled": "true", + "ipv4": "32", + "ipv6": "24" + } + } + } +} diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_base.json b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_base_v4.json similarity index 100% rename from src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_base.json rename to src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_base_v4.json diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_base_v6.json b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_base_v6.json new file mode 100644 index 000000000000..4b9b884fcf2e --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_base_v6.json @@ -0,0 +1,17 @@ +{ + "CONFIG_DB__DEVICE_METADATA": { + "localhost": {} + }, + "neighbor_addr": "fc00::01", + "bgp_session": { + "asn": "555", + "name": "internal1" + }, + "constants": { + "bgp": { + "maximum_paths": { + "enabled": "true" + } + } + } +} diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_shutdown_1.json b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_shutdown_v4_1.json similarity index 100% rename from src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_shutdown_1.json rename to src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_shutdown_v4_1.json diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_shutdown_2.json b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_shutdown_v4_2.json similarity index 100% rename from src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_shutdown_2.json rename to src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_shutdown_v4_2.json diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_shutdown_v6_1.json b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_shutdown_v6_1.json new file mode 100644 index 000000000000..3ceeb3f00332 --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_shutdown_v6_1.json @@ -0,0 +1,19 @@ +{ + "CONFIG_DB__DEVICE_METADATA": { + "localhost": { + "default_bgp_status": "down" + } + }, + "neighbor_addr": "fc00::01", + "bgp_session": { + "asn": "555", + "name": "internal1" + }, + "constants": { + "bgp": { + "maximum_paths": { + "enabled": "true" + } + } + } +} diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_shutdown_v6_2.json b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_shutdown_v6_2.json new file mode 100644 index 000000000000..8f2881b75f38 --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_shutdown_v6_2.json @@ -0,0 +1,19 @@ +{ + "CONFIG_DB__DEVICE_METADATA": { + "localhost": { + "default_bgp_status": "up" + } + }, + "neighbor_addr": "fc00::01", + "bgp_session": { + "asn": "555", + "name": "internal1" + }, + "constants": { + "bgp": { + "maximum_paths": { + "enabled": "true" + } + } + } +} diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_timers_1.json b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_timers_v4_1.json similarity index 100% rename from src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_timers_1.json rename to src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_timers_v4_1.json diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_timers_2.json b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_timers_v4_2.json similarity index 100% rename from src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_timers_2.json rename to src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_timers_v4_2.json diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_timers_v6_1.json b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_timers_v6_1.json new file mode 100644 index 000000000000..e236b791ef07 --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_timers_v6_1.json @@ -0,0 +1,18 @@ +{ + "CONFIG_DB__DEVICE_METADATA": { + "localhost": {} + }, + "neighbor_addr": "fc00::01", + "bgp_session": { + "asn": "555", + "name": "internal1", + "keepalive": "5" + }, + "constants": { + "bgp": { + "maximum_paths": { + "enabled": "true" + } + } + } +} diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_timers_v6_2.json b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_timers_v6_2.json new file mode 100644 index 000000000000..ce077e5bc6de --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/param_timers_v6_2.json @@ -0,0 +1,18 @@ +{ + "CONFIG_DB__DEVICE_METADATA": { + "localhost": {} + }, + "neighbor_addr": "fc00::01", + "bgp_session": { + "asn": "555", + "name": "internal1", + "holdtime": "240" + }, + "constants": { + "bgp": { + "maximum_paths": { + "enabled": "true" + } + } + } +} diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_all.conf b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_all_v4.conf similarity index 78% rename from src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_all.conf rename to src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_all_v4.conf index 0f15d2f7f3e9..604af65d5e66 100644 --- a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_all.conf +++ b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_all_v4.conf @@ -4,11 +4,13 @@ bgp bestpath as-path multipath-relax bgp bestpath peer-type multipath-relax ! - neighbor 10.10.10.10 peer-group VOQ_CHASSIS_PEER + neighbor 10.10.10.10 peer-group VOQ_CHASSIS_V4_PEER neighbor 10.10.10.10 remote-as 555 neighbor 10.10.10.10 description internal1 - neighbor 10.10.10.10 timers 5 30 + neighbor 10.10.10.10 timers 3 10 + neighbor 10.10.10.10 timers connect 10 neighbor 10.10.10.10 shutdown +! address-family ipv4 maximum-paths ibgp 32 ! diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_all_v6.conf b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_all_v6.conf new file mode 100644 index 000000000000..793473c2e202 --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_all_v6.conf @@ -0,0 +1,25 @@ +! +! template: bgpd/templates/voq_chassis/instance.conf.j2 +! + bgp bestpath as-path multipath-relax + bgp bestpath peer-type multipath-relax +! + neighbor fc00::01 peer-group VOQ_CHASSIS_V6_PEER + neighbor fc00::01 remote-as 555 + neighbor fc00::01 description internal1 + neighbor fc00::01 timers 3 10 + neighbor fc00::01 timers connect 10 + neighbor fc00::01 shutdown +! + address-family ipv4 + maximum-paths ibgp 32 +! + exit-address-family +! + address-family ipv6 + maximum-paths ibgp 24 +! + exit-address-family +! +! end of template: bgpd/templates/voq_chassis/instance.conf.j2 +! diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_shutdown_2.conf b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_base_v4.conf similarity index 77% rename from src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_shutdown_2.conf rename to src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_base_v4.conf index c15098c782a9..23bf5841f9cc 100644 --- a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_shutdown_2.conf +++ b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_base_v4.conf @@ -4,9 +4,11 @@ bgp bestpath as-path multipath-relax bgp bestpath peer-type multipath-relax ! - neighbor 10.10.10.10 peer-group VOQ_CHASSIS_PEER + neighbor 10.10.10.10 peer-group VOQ_CHASSIS_V4_PEER neighbor 10.10.10.10 remote-as 555 neighbor 10.10.10.10 description internal1 + neighbor 10.10.10.10 timers 3 10 + neighbor 10.10.10.10 timers connect 10 address-family ipv4 maximum-paths ibgp 64 ! diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_base_v6.conf b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_base_v6.conf new file mode 100644 index 000000000000..a0bd9379c8b2 --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_base_v6.conf @@ -0,0 +1,23 @@ +! +! template: bgpd/templates/voq_chassis/instance.conf.j2 +! + bgp bestpath as-path multipath-relax + bgp bestpath peer-type multipath-relax +! + neighbor fc00::01 peer-group VOQ_CHASSIS_V6_PEER + neighbor fc00::01 remote-as 555 + neighbor fc00::01 description internal1 + neighbor fc00::01 timers 3 10 + neighbor fc00::01 timers connect 10 + address-family ipv4 + maximum-paths ibgp 64 +! + exit-address-family +! + address-family ipv6 + maximum-paths ibgp 64 +! + exit-address-family +! +! end of template: bgpd/templates/voq_chassis/instance.conf.j2 +! diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_shutdown_1.conf b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_shutdown_v4_1.conf similarity index 78% rename from src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_shutdown_1.conf rename to src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_shutdown_v4_1.conf index 6b929baf8759..f26f0d6d3d0c 100644 --- a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_shutdown_1.conf +++ b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_shutdown_v4_1.conf @@ -4,10 +4,13 @@ bgp bestpath as-path multipath-relax bgp bestpath peer-type multipath-relax ! - neighbor 10.10.10.10 peer-group VOQ_CHASSIS_PEER + neighbor 10.10.10.10 peer-group VOQ_CHASSIS_V4_PEER neighbor 10.10.10.10 remote-as 555 neighbor 10.10.10.10 description internal1 + neighbor 10.10.10.10 timers 3 10 + neighbor 10.10.10.10 timers connect 10 neighbor 10.10.10.10 shutdown +! address-family ipv4 maximum-paths ibgp 64 ! diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_timers_1.conf b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_shutdown_v4_2.conf similarity index 77% rename from src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_timers_1.conf rename to src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_shutdown_v4_2.conf index f7feab971f8a..23bf5841f9cc 100644 --- a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_timers_1.conf +++ b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_shutdown_v4_2.conf @@ -4,10 +4,11 @@ bgp bestpath as-path multipath-relax bgp bestpath peer-type multipath-relax ! - neighbor 10.10.10.10 peer-group VOQ_CHASSIS_PEER + neighbor 10.10.10.10 peer-group VOQ_CHASSIS_V4_PEER neighbor 10.10.10.10 remote-as 555 neighbor 10.10.10.10 description internal1 - neighbor 10.10.10.10 timers 5 180 + neighbor 10.10.10.10 timers 3 10 + neighbor 10.10.10.10 timers connect 10 address-family ipv4 maximum-paths ibgp 64 ! diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_shutdown_v6_1.conf b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_shutdown_v6_1.conf new file mode 100644 index 000000000000..4057147d5d58 --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_shutdown_v6_1.conf @@ -0,0 +1,25 @@ +! +! template: bgpd/templates/voq_chassis/instance.conf.j2 +! + bgp bestpath as-path multipath-relax + bgp bestpath peer-type multipath-relax +! + neighbor fc00::01 peer-group VOQ_CHASSIS_V6_PEER + neighbor fc00::01 remote-as 555 + neighbor fc00::01 description internal1 + neighbor fc00::01 timers 3 10 + neighbor fc00::01 timers connect 10 + neighbor fc00::01 shutdown +! + address-family ipv4 + maximum-paths ibgp 64 +! + exit-address-family +! + address-family ipv6 + maximum-paths ibgp 64 +! + exit-address-family +! +! end of template: bgpd/templates/voq_chassis/instance.conf.j2 +! diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_shutdown_v6_2.conf b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_shutdown_v6_2.conf new file mode 100644 index 000000000000..a0bd9379c8b2 --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_shutdown_v6_2.conf @@ -0,0 +1,23 @@ +! +! template: bgpd/templates/voq_chassis/instance.conf.j2 +! + bgp bestpath as-path multipath-relax + bgp bestpath peer-type multipath-relax +! + neighbor fc00::01 peer-group VOQ_CHASSIS_V6_PEER + neighbor fc00::01 remote-as 555 + neighbor fc00::01 description internal1 + neighbor fc00::01 timers 3 10 + neighbor fc00::01 timers connect 10 + address-family ipv4 + maximum-paths ibgp 64 +! + exit-address-family +! + address-family ipv6 + maximum-paths ibgp 64 +! + exit-address-family +! +! end of template: bgpd/templates/voq_chassis/instance.conf.j2 +! diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_timers_2.conf b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_timers_2.conf deleted file mode 100644 index 8e773c113b3d..000000000000 --- a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_timers_2.conf +++ /dev/null @@ -1,22 +0,0 @@ -! -! template: bgpd/templates/voq_chassis/instance.conf.j2 -! - bgp bestpath as-path multipath-relax - bgp bestpath peer-type multipath-relax -! - neighbor 10.10.10.10 peer-group VOQ_CHASSIS_PEER - neighbor 10.10.10.10 remote-as 555 - neighbor 10.10.10.10 description internal1 - neighbor 10.10.10.10 timers 60 240 - address-family ipv4 - maximum-paths ibgp 64 -! - exit-address-family -! - address-family ipv6 - maximum-paths ibgp 64 -! - exit-address-family -! -! end of template: bgpd/templates/voq_chassis/instance.conf.j2 -! diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_base.conf b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_timers_v4_1.conf similarity index 77% rename from src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_base.conf rename to src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_timers_v4_1.conf index c15098c782a9..23bf5841f9cc 100644 --- a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_base.conf +++ b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_timers_v4_1.conf @@ -4,9 +4,11 @@ bgp bestpath as-path multipath-relax bgp bestpath peer-type multipath-relax ! - neighbor 10.10.10.10 peer-group VOQ_CHASSIS_PEER + neighbor 10.10.10.10 peer-group VOQ_CHASSIS_V4_PEER neighbor 10.10.10.10 remote-as 555 neighbor 10.10.10.10 description internal1 + neighbor 10.10.10.10 timers 3 10 + neighbor 10.10.10.10 timers connect 10 address-family ipv4 maximum-paths ibgp 64 ! diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_timers_v4_2.conf b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_timers_v4_2.conf new file mode 100644 index 000000000000..23bf5841f9cc --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_timers_v4_2.conf @@ -0,0 +1,23 @@ +! +! template: bgpd/templates/voq_chassis/instance.conf.j2 +! + bgp bestpath as-path multipath-relax + bgp bestpath peer-type multipath-relax +! + neighbor 10.10.10.10 peer-group VOQ_CHASSIS_V4_PEER + neighbor 10.10.10.10 remote-as 555 + neighbor 10.10.10.10 description internal1 + neighbor 10.10.10.10 timers 3 10 + neighbor 10.10.10.10 timers connect 10 + address-family ipv4 + maximum-paths ibgp 64 +! + exit-address-family +! + address-family ipv6 + maximum-paths ibgp 64 +! + exit-address-family +! +! end of template: bgpd/templates/voq_chassis/instance.conf.j2 +! diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_timers_v6_1.conf b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_timers_v6_1.conf new file mode 100644 index 000000000000..a0bd9379c8b2 --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_timers_v6_1.conf @@ -0,0 +1,23 @@ +! +! template: bgpd/templates/voq_chassis/instance.conf.j2 +! + bgp bestpath as-path multipath-relax + bgp bestpath peer-type multipath-relax +! + neighbor fc00::01 peer-group VOQ_CHASSIS_V6_PEER + neighbor fc00::01 remote-as 555 + neighbor fc00::01 description internal1 + neighbor fc00::01 timers 3 10 + neighbor fc00::01 timers connect 10 + address-family ipv4 + maximum-paths ibgp 64 +! + exit-address-family +! + address-family ipv6 + maximum-paths ibgp 64 +! + exit-address-family +! +! end of template: bgpd/templates/voq_chassis/instance.conf.j2 +! diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_timers_v6_2.conf b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_timers_v6_2.conf new file mode 100644 index 000000000000..a0bd9379c8b2 --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/voq_chassis/instance.conf/result_timers_v6_2.conf @@ -0,0 +1,23 @@ +! +! template: bgpd/templates/voq_chassis/instance.conf.j2 +! + bgp bestpath as-path multipath-relax + bgp bestpath peer-type multipath-relax +! + neighbor fc00::01 peer-group VOQ_CHASSIS_V6_PEER + neighbor fc00::01 remote-as 555 + neighbor fc00::01 description internal1 + neighbor fc00::01 timers 3 10 + neighbor fc00::01 timers connect 10 + address-family ipv4 + maximum-paths ibgp 64 +! + exit-address-family +! + address-family ipv6 + maximum-paths ibgp 64 +! + exit-address-family +! +! end of template: bgpd/templates/voq_chassis/instance.conf.j2 +! diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/peer-group.conf/result_all.conf b/src/sonic-bgpcfgd/tests/data/voq_chassis/peer-group.conf/result_all.conf index 031884499aaa..1ec1cffed952 100644 --- a/src/sonic-bgpcfgd/tests/data/voq_chassis/peer-group.conf/result_all.conf +++ b/src/sonic-bgpcfgd/tests/data/voq_chassis/peer-group.conf/result_all.conf @@ -1,18 +1,23 @@ ! ! template: bgpd/templates/voq_chassis/peer-group.conf.j2 ! - neighbor VOQ_CHASSIS_PEER peer-group + neighbor VOQ_CHASSIS_V4_PEER peer-group + neighbor VOQ_CHASSIS_V6_PEER peer-group address-family ipv4 - neighbor VOQ_CHASSIS_PEER allowas-in 1 - neighbor VOQ_CHASSIS_PEER activate - neighbor VOQ_CHASSIS_PEER addpath-tx-all-paths - neighbor VOQ_CHASSIS_PEER soft-reconfiguration inbound + neighbor VOQ_CHASSIS_V4_PEER allowas-in 1 + neighbor VOQ_CHASSIS_V4_PEER activate + neighbor VOQ_CHASSIS_V4_PEER addpath-tx-all-paths + neighbor VOQ_CHASSIS_V4_PEER soft-reconfiguration inbound + neighbor VOQ_CHASSIS_V4_PEER route-map FROM_VOQ_CHASSIS_V4_PEER in + neighbor VOQ_CHASSIS_V4_PEER route-map TO_VOQ_CHASSIS_V4_PEER out exit-address-family address-family ipv6 - neighbor VOQ_CHASSIS_PEER allowas-in 1 - neighbor VOQ_CHASSIS_PEER activate - neighbor VOQ_CHASSIS_PEER addpath-tx-all-paths - neighbor VOQ_CHASSIS_PEER soft-reconfiguration inbound + neighbor VOQ_CHASSIS_V6_PEER allowas-in 1 + neighbor VOQ_CHASSIS_V6_PEER activate + neighbor VOQ_CHASSIS_V6_PEER addpath-tx-all-paths + neighbor VOQ_CHASSIS_V6_PEER soft-reconfiguration inbound + neighbor VOQ_CHASSIS_V4_PEER route-map FROM_VOQ_CHASSIS_V6_PEER in + neighbor VOQ_CHASSIS_V4_PEER route-map TO_VOQ_CHASSIS_V6_PEER out exit-address-family ! ! end of template: bgpd/templates/voq_chassis/peer-group.conf.j2 diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/peer-group.conf/result_base.conf b/src/sonic-bgpcfgd/tests/data/voq_chassis/peer-group.conf/result_base.conf index d4a6f381a224..a8f7a0eea528 100644 --- a/src/sonic-bgpcfgd/tests/data/voq_chassis/peer-group.conf/result_base.conf +++ b/src/sonic-bgpcfgd/tests/data/voq_chassis/peer-group.conf/result_base.conf @@ -1,16 +1,21 @@ ! ! template: bgpd/templates/voq_chassis/peer-group.conf.j2 ! - neighbor VOQ_CHASSIS_PEER peer-group + neighbor VOQ_CHASSIS_V4_PEER peer-group + neighbor VOQ_CHASSIS_V6_PEER peer-group address-family ipv4 - neighbor VOQ_CHASSIS_PEER activate - neighbor VOQ_CHASSIS_PEER addpath-tx-all-paths - neighbor VOQ_CHASSIS_PEER soft-reconfiguration inbound + neighbor VOQ_CHASSIS_V4_PEER activate + neighbor VOQ_CHASSIS_V4_PEER addpath-tx-all-paths + neighbor VOQ_CHASSIS_V4_PEER soft-reconfiguration inbound + neighbor VOQ_CHASSIS_V4_PEER route-map FROM_VOQ_CHASSIS_V4_PEER in + neighbor VOQ_CHASSIS_V4_PEER route-map TO_VOQ_CHASSIS_V4_PEER out exit-address-family address-family ipv6 - neighbor VOQ_CHASSIS_PEER activate - neighbor VOQ_CHASSIS_PEER addpath-tx-all-paths - neighbor VOQ_CHASSIS_PEER soft-reconfiguration inbound + neighbor VOQ_CHASSIS_V6_PEER activate + neighbor VOQ_CHASSIS_V6_PEER addpath-tx-all-paths + neighbor VOQ_CHASSIS_V6_PEER soft-reconfiguration inbound + neighbor VOQ_CHASSIS_V4_PEER route-map FROM_VOQ_CHASSIS_V6_PEER in + neighbor VOQ_CHASSIS_V4_PEER route-map TO_VOQ_CHASSIS_V6_PEER out exit-address-family ! ! end of template: bgpd/templates/voq_chassis/peer-group.conf.j2 diff --git a/src/sonic-bgpcfgd/tests/data/voq_chassis/policies.conf/result_base.conf b/src/sonic-bgpcfgd/tests/data/voq_chassis/policies.conf/result_base.conf index 4c853d4f3220..c26db7bde241 100644 --- a/src/sonic-bgpcfgd/tests/data/voq_chassis/policies.conf/result_base.conf +++ b/src/sonic-bgpcfgd/tests/data/voq_chassis/policies.conf/result_base.conf @@ -1,7 +1,18 @@ ! ! template: bgpd/templates/voq_chassis/policies.conf.j2 ! +route-map FROM_VOQ_CHASSIS_V4_PEER permit 100 ! +route-map TO_VOQ_CHASSIS_V4_PEER permit 100 +! +! +route-map FROM_VOQ_CHASSIS_V6_PEER permit 1 + set ipv6 next-hop prefer-global + on-match next +! +route-map FROM_VOQ_CHASSIS_V6_PEER permit 100 +! +route-map TO_VOQ_CHASSIS_V6_PEER permit 100 ! ! end of template: bgpd/templates/voq_chassis/policies.conf.j2 ! diff --git a/src/sonic-bgpcfgd/tests/test_advertise_rt.py b/src/sonic-bgpcfgd/tests/test_advertise_rt.py new file mode 100644 index 000000000000..26f7b6617650 --- /dev/null +++ b/src/sonic-bgpcfgd/tests/test_advertise_rt.py @@ -0,0 +1,185 @@ +from unittest.mock import MagicMock, patch + +from bgpcfgd.directory import Directory +from bgpcfgd.template import TemplateFabric +from bgpcfgd.managers_advertise_rt import AdvertiseRouteMgr +from swsscommon import swsscommon + +def constructor(skip_bgp_asn=False): + cfg_mgr = MagicMock() + + common_objs = { + 'directory': Directory(), + 'cfg_mgr': cfg_mgr, + 'tf': TemplateFabric(), + 'constants': {}, + } + + mgr = AdvertiseRouteMgr(common_objs, "STATE_DB", swsscommon.STATE_ADVERTISE_NETWORK_TABLE_NAME) + if not skip_bgp_asn: + mgr.directory.put("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME, "localhost", {"bgp_asn": "65100"}) + assert len(mgr.advertised_routes) == 0 + + return mgr + +def set_del_test(mgr, op, args, expected_ret, expected_cmds): + set_del_test.push_list_called = False + def push_list(cmds): + set_del_test.push_list_called = True + assert cmds in expected_cmds + return True + mgr.cfg_mgr.push_list = push_list + + if op == "SET": + ret = mgr.set_handler(*args) + assert ret == expected_ret + elif op == "DEL": + mgr.del_handler(*args) + else: + assert False, "Wrong operation" + + if expected_cmds: + assert set_del_test.push_list_called, "cfg_mgr.push_list wasn't called" + else: + assert not set_del_test.push_list_called, "cfg_mgr.push_list was called" + +def test_set_del(): + mgr = constructor() + set_del_test( + mgr, + "SET", + ("10.1.0.0/24", {}), + True, + [ + ["router bgp 65100", + " no bgp network import-check"], + ["router bgp 65100", + " address-family ipv4 unicast", + " network 10.1.0.0/24"] + ] + ) + + set_del_test( + mgr, + "SET", + ("fc00:10::/64", {}), + True, + [ + ["router bgp 65100", + " address-family ipv6 unicast", + " network fc00:10::/64"] + ] + ) + + set_del_test( + mgr, + "DEL", + ("10.1.0.0/24",), + True, + [ + ["router bgp 65100", + " address-family ipv4 unicast", + " no network 10.1.0.0/24"] + ] + ) + + set_del_test( + mgr, + "DEL", + ("fc00:10::/64",), + True, + [ + ["router bgp 65100", + " bgp network import-check"], + ["router bgp 65100", + " address-family ipv6 unicast", + " no network fc00:10::/64"] + ] + ) + + +def test_set_del_vrf(): + mgr = constructor() + set_del_test( + mgr, + "SET", + ("vrfRED|10.2.0.0/24", {}), + True, + [ + ["router bgp 65100 vrf vrfRED", + " no bgp network import-check"], + ["router bgp 65100 vrf vrfRED", + " address-family ipv4 unicast", + " network 10.2.0.0/24"] + ] + ) + + set_del_test( + mgr, + "SET", + ("vrfRED|fc00:20::/64", {}), + True, + [ + ["router bgp 65100 vrf vrfRED", + " address-family ipv6 unicast", + " network fc00:20::/64"] + ] + ) + + set_del_test( + mgr, + "DEL", + ("vrfRED|10.2.0.0/24",), + True, + [ + ["router bgp 65100 vrf vrfRED", + " address-family ipv4 unicast", + " no network 10.2.0.0/24"] + ] + ) + + set_del_test( + mgr, + "DEL", + ("vrfRED|fc00:20::/64",), + True, + [ + ["router bgp 65100 vrf vrfRED", + " bgp network import-check"], + ["router bgp 65100 vrf vrfRED", + " address-family ipv6 unicast", + " no network fc00:20::/64"] + ] + ) + + +def test_set_del_bgp_asn_change(): + mgr = constructor(skip_bgp_asn=True) + set_del_test( + mgr, + "SET", + ("vrfRED|10.3.0.0/24", {}), + True, + [] + ) + + + test_set_del_bgp_asn_change.push_list_called = False + expected_cmds = [ + ["router bgp 65100 vrf vrfRED", + " no bgp network import-check"], + ["router bgp 65100 vrf vrfRED", + " address-family ipv4 unicast", + " network 10.3.0.0/24"] + ] + def push_list(cmds): + test_set_del_bgp_asn_change.push_list_called = True + assert cmds in expected_cmds + return True + + mgr.cfg_mgr.push_list = push_list + assert not test_set_del_bgp_asn_change.push_list_called + + mgr.directory.put("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME, "localhost", {"bgp_asn": "65100"}) + + assert test_set_del_bgp_asn_change.push_list_called diff --git a/src/sonic-bgpcfgd/tests/test_allow_list.py b/src/sonic-bgpcfgd/tests/test_allow_list.py index cb0896982a39..5207c6283462 100644 --- a/src/sonic-bgpcfgd/tests/test_allow_list.py +++ b/src/sonic-bgpcfgd/tests/test_allow_list.py @@ -79,8 +79,8 @@ def test_set_handler_with_community(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 le 32', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 le 128', 'bgp community-list standard COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020 permit 1010:2020', @@ -110,8 +110,8 @@ def test_set_handler_with_community_and_permit_action(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 le 32', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 le 128', 'bgp community-list standard COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020 permit 1010:2020', @@ -142,8 +142,8 @@ def test_set_handler_with_community_and_deny_action(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 le 32', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 le 128', 'bgp community-list standard COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020 permit 1010:2020', @@ -178,8 +178,8 @@ def test_set_handler_no_community(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 20 permit 20.20.30.0/24 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 30 permit 40.50.0.0/16 le 32', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 30 permit fc01:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 40 permit fc01:30::/64 le 128', 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 30000', @@ -206,8 +206,8 @@ def test_set_handler_no_community_with_permit_action(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 20 permit 20.20.30.0/24 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 30 permit 40.50.0.0/16 le 32', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 30 permit fc01:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 40 permit fc01:30::/64 le 128', 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 30000', @@ -234,8 +234,8 @@ def test_set_handler_no_community_with_deny_action(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 20 permit 20.20.30.0/24 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 30 permit 40.50.0.0/16 le 32', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 30 permit fc01:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 40 permit fc01:30::/64 le 128', 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 30000', @@ -257,8 +257,8 @@ def test_del_handler_with_community(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 ge 25', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 ge 17', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 ge 65', 'bgp community-list standard COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020 permit 1010:2020', @@ -292,8 +292,8 @@ def test_del_handler_with_exiting_community_deny_action(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 ge 25', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 ge 17', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 ge 65', 'bgp community-list standard COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020 permit 1010:2020', @@ -331,8 +331,8 @@ def test_del_handler_with_exiting_community_permit_action(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 ge 25', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 ge 17', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 ge 65', 'bgp community-list standard COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020 permit 1010:2020', @@ -365,8 +365,8 @@ def test_del_handler_with_exiting_community_deny_action_global_deny(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 ge 25', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 ge 17', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 ge 65', 'bgp community-list standard COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020 permit 1010:2020', @@ -401,8 +401,8 @@ def test_del_handler_with_exiting_community_permit_action_global_deny(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 ge 25', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 ge 17', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 ge 65', 'bgp community-list standard COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020 permit 1010:2020', @@ -441,8 +441,8 @@ def test_del_handler_no_community(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 20 permit 20.20.30.0/24 ge 25', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 30 permit 40.50.0.0/16 ge 17', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 30 permit fc01:20::/64 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 40 permit fc01:30::/64 ge 65', 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 30000', @@ -470,8 +470,8 @@ def test_del_handler_with_no_community_deny_action(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 20 permit 20.20.30.0/24 ge 25', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 30 permit 40.50.0.0/16 ge 17', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 30 permit fc01:20::/64 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 40 permit fc01:30::/64 ge 65', 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 30000', @@ -503,8 +503,8 @@ def test_del_handler_with_no_community_permit_action_global_deny(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 20 permit 20.20.30.0/24 ge 25', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 30 permit 40.50.0.0/16 ge 17', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 30 permit fc01:20::/64 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 40 permit fc01:30::/64 ge 65', 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 30000', @@ -543,8 +543,8 @@ def test_set_handler_with_community_data_is_already_presented(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 le 32', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 le 128', 'bgp community-list standard COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020 permit 1010:2020', @@ -572,8 +572,8 @@ def test_set_handler_no_community_data_is_already_presented(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 20 permit 20.20.30.0/24 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 30 permit 40.50.0.0/16 le 32', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 30 permit fc01:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 40 permit fc01:30::/64 le 128', 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 30000', @@ -636,8 +636,8 @@ def test_set_handler_with_community_update_prefixes_add(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 le 32', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 le 128', 'bgp community-list standard COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020 permit 1010:2020', @@ -660,8 +660,8 @@ def test_set_handler_with_community_update_prefixes_add(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 40 permit 80.90.0.0/16 le 32', 'no ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 50 permit fc02::/64 le 128', @@ -679,8 +679,8 @@ def test_set_handler_no_community_update_prefixes_add(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 10 deny 0.0.0.0/0 le 17', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 20 permit 20.20.30.0/24 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 30 permit 40.50.0.0/16 le 32', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 30 permit fc01:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 40 permit fc01:30::/64 le 128', 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 30000', @@ -700,14 +700,89 @@ def test_set_handler_no_community_update_prefixes_add(): 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 30 permit 40.50.0.0/16 le 32', 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 40 permit 80.90.0.0/16 le 32', 'no ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny 0::/0 le 59', - 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny 0::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 30 permit fc01:20::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 40 permit fc01:30::/64 le 128', 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 50 permit fc02::/64 le 128', ] ) +def test_set_handler_with_community_update_prefixes_remove(): + set_del_test( + "SET", + ("DEPLOYMENT_ID|5|1010:2020", { + "prefixes_v4": "10.20.30.0/24", + "prefixes_v6": "fc00:20::/64", + }), + [ + 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', + 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 le 32', + 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 30 permit 30.50.0.0/16 le 32', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 le 128', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 40 permit fc00:30::/64 le 128', + 'bgp community-list standard COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020 permit 1010:2020', + 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 10', + ' match ip address prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4', + ' match community COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020', + 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V6 permit 10', + ' match ipv6 address prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6', + ' match community COMMUNITY_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020', + 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 65535', + ' set community 123:123 additive', + 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V6 permit 65535', + ' set community 123:123 additive', + "" + ], + [ + 'no ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4', + 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 10 deny 0.0.0.0/0 le 17', + 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V4 seq 20 permit 10.20.30.0/24 le 32', + 'no ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 20 deny ::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_1010:2020_V6 seq 30 permit fc00:20::/64 le 128', + ] + ) + +def test_set_handler_no_community_update_prefixes_remove(): + set_del_test( + "SET", + ("DEPLOYMENT_ID|5", { + "prefixes_v4": "20.20.30.0/24", + "prefixes_v6": "fc01:20::/64", + }), + [ + 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 10 deny 0.0.0.0/0 le 17', + 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 20 permit 20.20.30.0/24 le 32', + 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 30 permit 40.50.0.0/16 le 32', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 30 permit fc01:20::/64 le 128', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 40 permit fc01:30::/64 le 128', + 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 30000', + ' match ip address prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4', + 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V6 permit 30000', + ' match ipv6 address prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6', + 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V4 permit 65535', + ' set community 123:123 additive', + 'route-map ALLOW_LIST_DEPLOYMENT_ID_5_V6 permit 65535', + ' set community 123:123 additive', + "" + ], + [ + 'no ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4', + 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 10 deny 0.0.0.0/0 le 17', + 'ip prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V4 seq 20 permit 20.20.30.0/24 le 32', + 'no ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 10 deny ::/0 le 59', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 20 deny ::/0 ge 65', + 'ipv6 prefix-list PL_ALLOW_LIST_DEPLOYMENT_ID_5_COMMUNITY_empty_V6 seq 30 permit fc01:20::/64 le 128', + ] + ) + @patch.dict("sys.modules", swsscommon=swsscommon_module_mock) def test___set_handler_validate(): from bgpcfgd.managers_allow_list import BGPAllowListMgr diff --git a/src/sonic-bgpcfgd/tests/test_sonic-cfggen.py b/src/sonic-bgpcfgd/tests/test_sonic-cfggen.py index ff9b30ea3906..498ce8f9ff7a 100644 --- a/src/sonic-bgpcfgd/tests/test_sonic-cfggen.py +++ b/src/sonic-bgpcfgd/tests/test_sonic-cfggen.py @@ -51,6 +51,12 @@ def test_bgpd_main_conf_voq_chassis(): "bgpd.main.conf.j2/voq_chassis.json", "bgpd.main.conf.j2/voq_chassis.conf") +def test_bgpd_main_conf_packet_chassis(): + run_test("Chassi packet bgpd.main.conf.j2", + "bgpd/bgpd.main.conf.j2", + "bgpd.main.conf.j2/packet_chassis.json", + "bgpd.main.conf.j2/packet_chassis.conf") + def test_tsa_isolate(): run_test("tsa/bgpd.tsa.isolate.conf.j2", "bgpd/tsa/bgpd.tsa.isolate.conf.j2", @@ -75,12 +81,6 @@ def test_common_functions(): "common/functions.conf.json", "common/functions.conf") -def test_staticd_default_route(): - run_test("staticd.default_route.conf.j2", - "staticd/staticd.default_route.conf.j2", - "staticd/staticd.default_route.conf.json", - "staticd/staticd.default_route.conf") - def test_staticd_loopback_route(): run_test("staticd.loopback_route.conf.j2", "staticd/staticd.loopback_route.conf.j2", diff --git a/src/sonic-bgpcfgd/tests/test_static_rt.py b/src/sonic-bgpcfgd/tests/test_static_rt.py index e0b9b1b17ebf..881bba1563b7 100644 --- a/src/sonic-bgpcfgd/tests/test_static_rt.py +++ b/src/sonic-bgpcfgd/tests/test_static_rt.py @@ -62,12 +62,73 @@ def test_set(): }), True, [ - "ip route 10.1.0.0/24 10.0.0.57", + "ip route 10.1.0.0/24 10.0.0.57 tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" + ] + ) + +def test_set_nhportchannel(): + mgr = constructor() + set_del_test( + mgr, + "SET", + ("10.1.0.0/24", { + "nexthop": "PortChannel0001", + }), + True, + [ + "ip route 10.1.0.0/24 PortChannel0001 tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", + "router bgp 65100", + " address-family ipv4", + " redistribute static route-map STATIC_ROUTE_FILTER", + " address-family ipv6", + " redistribute static route-map STATIC_ROUTE_FILTER" + ] + ) + + set_del_test( + mgr, + "DEL", + ("10.1.0.0/24",), + True, + [ + "no ip route 10.1.0.0/24 PortChannel0001 tag 1", + "router bgp 65100", + " address-family ipv4", + " no redistribute static route-map STATIC_ROUTE_FILTER", + " address-family ipv6", + " no redistribute static route-map STATIC_ROUTE_FILTER", + "no route-map STATIC_ROUTE_FILTER" + ] + ) + +def test_set_several_nhportchannels(): + mgr = constructor() + set_del_test( + mgr, + "SET", + ("10.1.0.0/24", { + "nexthop": "PortChannel0003,PortChannel0004", + }), + True, + [ + "ip route 10.1.0.0/24 PortChannel0003 tag 1", + "ip route 10.1.0.0/24 PortChannel0004 tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", + "router bgp 65100", + " address-family ipv4", + " redistribute static route-map STATIC_ROUTE_FILTER", + " address-family ipv6", + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) @@ -85,12 +146,14 @@ def test_set_nhvrf(): }), True, [ - "ip route 10.1.1.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf", + "ip route 10.1.1.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) @@ -108,12 +171,14 @@ def test_set_blackhole(): }), True, [ - "ip route 10.1.2.0/24 blackhole 10", + "ip route 10.1.2.0/24 blackhole 10 tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) @@ -131,12 +196,14 @@ def test_set_vrf(): }), True, [ - "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", + "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100 vrf vrfRED", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) @@ -154,12 +221,14 @@ def test_set_ipv6(): }), True, [ - "ipv6 route fc00:10::/64 fc00::72 PortChannel0001 10", + "ipv6 route fc00:10::/64 fc00::72 PortChannel0001 10 tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) @@ -176,14 +245,16 @@ def test_set_nh_only(): }), True, [ - "ip route 10.1.3.0/24 10.0.0.57 10 nexthop-vrf nh_vrf vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.59 20 vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.61 30 nexthop-vrf default vrf vrfRED", + "ip route 10.1.3.0/24 10.0.0.57 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.59 20 vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.61 30 nexthop-vrf default vrf vrfRED tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100 vrf vrfRED", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) @@ -200,14 +271,16 @@ def test_set_ifname_only(): }), True, [ - "ip route 10.1.3.0/24 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "ip route 10.1.3.0/24 PortChannel0002 20 vrf vrfRED", - "ip route 10.1.3.0/24 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "ip route 10.1.3.0/24 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "ip route 10.1.3.0/24 PortChannel0002 20 vrf vrfRED tag 1", + "ip route 10.1.3.0/24 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100 vrf vrfRED", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) @@ -225,14 +298,16 @@ def test_set_with_empty_ifname(): }), True, [ - "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.59 20 vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.59 20 vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100 vrf vrfRED", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) @@ -250,14 +325,16 @@ def test_set_with_empty_nh(): }), True, [ - "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "ip route 10.1.3.0/24 PortChannel0002 20 vrf vrfRED", - "ip route 10.1.3.0/24 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "ip route 10.1.3.0/24 PortChannel0002 20 vrf vrfRED tag 1", + "ip route 10.1.3.0/24 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100 vrf vrfRED", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) @@ -275,14 +352,16 @@ def test_set_del(): }), True, [ - "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100 vrf vrfRED", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) set_del_test( @@ -291,14 +370,15 @@ def test_set_del(): ("vrfRED|10.1.3.0/24",), True, [ - "no ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "no ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED", - "no ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "no ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "no ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED tag 1", + "no ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", "router bgp 65100 vrf vrfRED", " address-family ipv4", - " no redistribute static", + " no redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " no redistribute static" + " no redistribute static route-map STATIC_ROUTE_FILTER", + "no route-map STATIC_ROUTE_FILTER" ] ) set_del_test( @@ -313,14 +393,16 @@ def test_set_del(): }), True, [ - "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100 vrf vrfRED", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) @@ -338,14 +420,16 @@ def test_set_same_route(): }), True, [ - "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100 vrf vrfRED", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) set_del_test( @@ -360,12 +444,12 @@ def test_set_same_route(): }), True, [ - "no ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "no ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED", - "no ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 40 nexthop-vrf nh_vrf vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 50 vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 60 nexthop-vrf default vrf vrfRED" + "no ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "no ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED tag 1", + "no ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 40 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 50 vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 60 nexthop-vrf default vrf vrfRED tag 1" ] ) @@ -383,14 +467,16 @@ def test_set_add_del_nh(): }), True, [ - "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100 vrf vrfRED", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) set_del_test( @@ -405,7 +491,7 @@ def test_set_add_del_nh(): }), True, [ - "ip route 10.1.3.0/24 10.0.0.63 PortChannel0004 30 vrf vrfRED", + "ip route 10.1.3.0/24 10.0.0.63 PortChannel0004 30 vrf vrfRED tag 1", ] ) set_del_test( @@ -420,8 +506,8 @@ def test_set_add_del_nh(): }), True, [ - "no ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", - "no ip route 10.1.3.0/24 10.0.0.63 PortChannel0004 30 vrf vrfRED", + "no ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", + "no ip route 10.1.3.0/24 10.0.0.63 PortChannel0004 30 vrf vrfRED tag 1", ] ) @@ -439,14 +525,16 @@ def test_set_add_del_nh_ethernet(): }), True, [ - "ip route 20.1.3.0/24 20.0.0.57 Ethernet4 10 nexthop-vrf default", - "ip route 20.1.3.0/24 20.0.0.59 Ethernet8 20", - "ip route 20.1.3.0/24 20.0.0.61 Ethernet12 30 nexthop-vrf default", + "ip route 20.1.3.0/24 20.0.0.57 Ethernet4 10 nexthop-vrf default tag 1", + "ip route 20.1.3.0/24 20.0.0.59 Ethernet8 20 tag 1", + "ip route 20.1.3.0/24 20.0.0.61 Ethernet12 30 nexthop-vrf default tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) set_del_test( @@ -461,7 +549,7 @@ def test_set_add_del_nh_ethernet(): }), True, [ - "ip route 20.1.3.0/24 20.0.0.63 Ethernet16 30", + "ip route 20.1.3.0/24 20.0.0.63 Ethernet16 30 tag 1", ] ) set_del_test( @@ -476,8 +564,8 @@ def test_set_add_del_nh_ethernet(): }), True, [ - "no ip route 20.1.3.0/24 20.0.0.61 Ethernet12 30 nexthop-vrf default", - "no ip route 20.1.3.0/24 20.0.0.63 Ethernet16 30", + "no ip route 20.1.3.0/24 20.0.0.61 Ethernet12 30 nexthop-vrf default tag 1", + "no ip route 20.1.3.0/24 20.0.0.63 Ethernet16 30 tag 1", ] ) @@ -494,12 +582,14 @@ def test_set_no_action(mocked_log_debug): }), True, [ - "ip route 10.1.1.0/24 blackhole", + "ip route 10.1.1.0/24 blackhole tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) @@ -554,11 +644,13 @@ def test_set_invalid_blackhole(mocked_log_err): }), True, [ + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) mocked_log_err.assert_called_with("Mandatory attribute not found for nexthop") @@ -589,9 +681,9 @@ def test_set_del_no_bgp_asn(): }), True, [ - "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", ] ) set_del_test( @@ -600,9 +692,9 @@ def test_set_del_no_bgp_asn(): ("vrfRED|10.1.3.0/24",), True, [ - "no ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "no ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED", - "no ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "no ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "no ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED tag 1", + "no ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", ] ) @@ -620,20 +712,22 @@ def test_set_del_bgp_asn_change(): }), True, [ - "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", ] ) assert mgr.vrf_pending_redistribution == {"vrfRED"} expected_cmds = [ + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100 vrf vrfRED", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] def push_list(cmds): set_del_test.push_list_called = True @@ -651,3 +745,79 @@ def push_list(cmds): mgr.directory.put("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME, "localhost", {"bgp_asn": "65100"}) assert not mgr.vrf_pending_redistribution + +def test_set_tag_enable(): + mgr = constructor() + set_del_test( + mgr, + "SET", + ("10.1.0.0/24", { + "nexthop": "10.0.0.57","advertise":"true" + }), + True, + [ + "ip route 10.1.0.0/24 10.0.0.57 tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", + "router bgp 65100", + " address-family ipv4", + " redistribute static route-map STATIC_ROUTE_FILTER", + " address-family ipv6", + " redistribute static route-map STATIC_ROUTE_FILTER" + ] + ) + +def test_set_tag_disable(): + mgr = constructor() + set_del_test( + mgr, + "SET", + ("10.1.0.0/24", { + "nexthop": "10.0.0.57","advertise":"false" + }), + True, + [ + "ip route 10.1.0.0/24 10.0.0.57 tag 2", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", + "router bgp 65100", + " address-family ipv4", + " redistribute static route-map STATIC_ROUTE_FILTER", + " address-family ipv6", + " redistribute static route-map STATIC_ROUTE_FILTER" + ] + ) + +def test_set_tag_change(): + mgr = constructor() + set_del_test( + mgr, + "SET", + ("10.1.0.0/24", { + "nexthop": "10.0.0.57","advertise":"true" + }), + True, + [ + "ip route 10.1.0.0/24 10.0.0.57 tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", + "router bgp 65100", + " address-family ipv4", + " redistribute static route-map STATIC_ROUTE_FILTER", + " address-family ipv6", + " redistribute static route-map STATIC_ROUTE_FILTER" + ] + ) + + set_del_test( + mgr, + "SET", + ("10.1.0.0/24", { + "nexthop": "10.0.0.57","advertise":"false" + }), + True, + [ + "no ip route 10.1.0.0/24 10.0.0.57 tag 1", + "ip route 10.1.0.0/24 10.0.0.57 tag 2", + ] + ) diff --git a/src/sonic-build-hooks/hooks/apt b/src/sonic-build-hooks/hooks/apt new file mode 100755 index 000000000000..f4b0f97287b1 --- /dev/null +++ b/src/sonic-build-hooks/hooks/apt @@ -0,0 +1,5 @@ +#!/bin/bash + +. /usr/local/share/buildinfo/scripts/buildinfo_base.sh + +APT_REAL_COMMAND=$(get_command apt) $(dirname "$0")/apt-get "$@" diff --git a/src/sonic-build-hooks/hooks/apt-get b/src/sonic-build-hooks/hooks/apt-get index 9ae50a118650..bdff703d01d7 100755 --- a/src/sonic-build-hooks/hooks/apt-get +++ b/src/sonic-build-hooks/hooks/apt-get @@ -3,36 +3,28 @@ INSTALL= . /usr/local/share/buildinfo/scripts/buildinfo_base.sh -REAL_COMMAND=$(get_command apt-get) +REAL_COMMAND=$APT_REAL_COMMAND +[ -z "$REAL_COMMAND" ] && REAL_COMMAND=$(get_command apt-get) if [ -z "$REAL_COMMAND" ]; then echo "The command apt-get does not exist." 1>&2 exit 1 fi -VERSION_FILE="/usr/local/share/buildinfo/versions/versions-deb" -if [ "$ENABLE_VERSION_CONTROL_DEB" == "y" ]; then - for para in $@ - do - if [[ "$para" != -* ]]; then - continue - fi - if [ ! -z "$INSTALL" ]; then - if [[ "$para" == *=* ]]; then - continue - elif [[ "$para" == *=* ]]; then - continue - else - package=$para - if ! grep -q "^${package}=" $VERSION_FILE; then - echo "The version of the package ${package} is not specified." - exit 1 - fi - fi - elif [[ "$para" == "install" ]]; then - INSTALL=y - fi - done +INSTALL=$(check_apt_install "$@") +COMMAND_INFO="Locked by command: $REAL_COMMAND $@" +if [ "$INSTALL" == y ]; then + check_apt_version "$@" + lock_result=$(acquire_apt_installation_lock "$COMMAND_INFO" ) + $REAL_COMMAND "$@" + command_result=$? + [ "$lock_result" == y ] && release_apt_installation_lock + exit $command_result +else + if [[ "$1" == "purge" || "$@" == *" purge "* ]]; then + # When running the purge command, collect the debian versions + dpkg-query -W -f '${Package}==${Version}\n' >> $POST_VERSION_PATH/purge-versions-deb + chmod a+wr $POST_VERSION_PATH/purge-versions-deb + fi + $REAL_COMMAND "$@" fi - -$REAL_COMMAND "$@" diff --git a/src/sonic-build-hooks/scripts/buildinfo_base.sh b/src/sonic-build-hooks/scripts/buildinfo_base.sh index cc3d7aedf8bc..3873d1362926 100755 --- a/src/sonic-build-hooks/scripts/buildinfo_base.sh +++ b/src/sonic-build-hooks/scripts/buildinfo_base.sh @@ -11,11 +11,19 @@ POST_VERSION_PATH=$BUILDINFO_PATH/post-versions VERSION_DEB_PREFERENCE=$BUILDINFO_PATH/versions/01-versions-deb WEB_VERSION_FILE=$VERSION_PATH/versions-web BUILD_WEB_VERSION_FILE=$BUILD_VERSION_PATH/versions-web +REPR_MIRROR_URL_PATTERN='http:\/\/packages.trafficmanager.net\/debian' +DPKG_INSTALLTION_LOCK_FILE=/tmp/.dpkg_installation.lock . $BUILDINFO_PATH/config/buildinfo.config URL_PREFIX=$(echo "${PACKAGE_URL_PREFIX}" | sed -E "s#(//[^/]*/).*#\1#") +if [ "$(whoami)" != "root" ] && [ -n "$(which sudo)" ];then + SUDO=sudo +else + SUDO='' +fi + log_err() { echo "$1" >> $LOG_PATH/error.log @@ -59,6 +67,22 @@ check_if_url_exist() fi } +# Enable or disable the reproducible mirrors +set_reproducible_mirrors() +{ + # Remove the charater # in front of the line if matched + local expression="s/^#\(.*$REPR_MIRROR_URL_PATTERN\)/\1/" + if [ "$1" = "-d" ]; then + # Add the charater # in front of the line if match + expression="s/^deb.*$REPR_MIRROR_URL_PATTERN/#\0/" + fi + + local mirrors="/etc/apt/sources.list $(find /etc/apt/sources.list.d/ -type f)" + for mirror in $mirrors; do + $SUDO sed -i "$expression" "$mirror" + done +} + download_packages() { local parameters=("$@") @@ -82,8 +106,8 @@ download_packages() local filename=$(echo $url | awk -F"/" '{print $NF}' | cut -d? -f1 | cut -d# -f1) [ -f $WEB_VERSION_FILE ] && version=$(grep "^${url}=" $WEB_VERSION_FILE | awk -F"==" '{print $NF}') if [ -z "$version" ]; then - echo "Failed to verify the package: $url, the version is not specified" 2>&1 - exit 1 + echo "Warning: Failed to verify the package: $url, the version is not specified" 1>&2 + continue fi local version_filename="${filename}-${version}" @@ -144,7 +168,7 @@ run_pip_command() install=y elif [[ "$para" == *.whl ]]; then package_name=$(echo $para | cut -d- -f1 | tr _ .) - sed "/^${package_name}==/d" -i $tmp_version_file + $SUDO sed "/^${package_name}==/d" -i $tmp_version_file fi done @@ -159,6 +183,83 @@ run_pip_command() return $result } +# Check if the command is to install the debian packages +# The apt/apt-get command format: apt/apt-get [options] {update|install} +check_apt_install() +{ + for para in "$@" + do + if [[ "$para" == -* ]]; then + continue + fi + + if [[ "$para" == "install" ]]; then + echo y + fi + + break + done +} + +# Print warning message if a debian package version not specified when debian version control enabled. +check_apt_version() +{ + VERSION_FILE="/usr/local/share/buildinfo/versions/versions-deb" + local install=$(check_apt_install "$@") + if [ "$ENABLE_VERSION_CONTROL_DEB" == "y" ] && [ "$install" == "y" ]; then + for para in "$@" + do + if [[ "$para" == -* ]]; then + continue + fi + + if [ "$para" == "install" ]; then + continue + fi + + if [[ "$para" == *=* ]]; then + continue + else + package=$para + if ! grep -q "^${package}=" $VERSION_FILE; then + echo "Warning: the version of the package ${package} is not specified." 1>&2 + fi + fi + done + fi +} + +acquire_apt_installation_lock() +{ + local result=n + local wait_in_second=10 + local count=60 + local info="$1" + for ((i=1; i<=$count; i++)); do + if [ -f $DPKG_INSTALLTION_LOCK_FILE ]; then + local lock_info=$(cat $DPKG_INSTALLTION_LOCK_FILE || true) + echo "Waiting dpkg lock for $wait_in_second, $i/$count, info: $lock_info" 1>&2 + sleep $wait_in_second + else + # Create file in an atomic operation + if (set -o noclobber; echo "$info">$DPKG_INSTALLTION_LOCK_FILE) &>/dev/null; then + result=y + break + else + echo "Failed to creat lock, Waiting dpkg lock for $wait_in_second, $i/$count, info: $lock_info" 1>&2 + sleep $wait_in_second + fi + fi + done + + echo $result +} + +release_apt_installation_lock() +{ + rm -f $DPKG_INSTALLTION_LOCK_FILE +} + ENABLE_VERSION_CONTROL_DEB=$(check_version_control "deb") ENABLE_VERSION_CONTROL_PY2=$(check_version_control "py2") ENABLE_VERSION_CONTROL_PY3=$(check_version_control "py3") diff --git a/src/sonic-build-hooks/scripts/collect_version_files b/src/sonic-build-hooks/scripts/collect_version_files index b62beb4a2115..a4b33eeaa897 100755 --- a/src/sonic-build-hooks/scripts/collect_version_files +++ b/src/sonic-build-hooks/scripts/collect_version_files @@ -1,14 +1,30 @@ #!/bin/bash +. /usr/local/share/buildinfo/scripts/buildinfo_base.sh + TARGET_PATH=$1 +[ -z "$TARGET_PATH" ] && TARGET_PATH=$POST_VERSION_PATH ARCH=$(dpkg --print-architecture) DIST=$(grep VERSION_CODENAME /etc/os-release | cut -d= -f2) ([ -z "$DIST" ] && grep -q jessie /etc/os-release) && DIST=jessie mkdir -p $TARGET_PATH chmod a+rw $TARGET_PATH -dpkg-query -W -f '${Package}==${Version}\n' > "${TARGET_PATH}/versions-deb-${DIST}-${ARCH}" -([ -x "/usr/local/bin/pip2" ] || [ -x "/usr/bin/pip2" ]) && pip2 freeze > "${TARGET_PATH}/versions-py2-${DIST}-${ARCH}" -([ -x "/usr/local/bin/pip3" ] || [ -x "/usr/bin/pip3" ]) && pip3 freeze > "${TARGET_PATH}/versions-py3-${DIST}-${ARCH}" + +dpkg-query -W -f '${Package}==${Version}\n' >> "${TARGET_PATH}/versions-deb-${DIST}-${ARCH}" +([ -x "/usr/local/bin/pip2" ] || [ -x "/usr/bin/pip2" ]) && pip2 freeze >> "${TARGET_PATH}/versions-py2-${DIST}-${ARCH}" +([ -x "/usr/local/bin/pip3" ] || [ -x "/usr/bin/pip3" ]) && pip3 freeze >> "${TARGET_PATH}/versions-py3-${DIST}-${ARCH}" + +## Add the the packages purged +[ -f $POST_VERSION_PATH/purge-versions-deb ] && cat $POST_VERSION_PATH/purge-versions-deb >> "${TARGET_PATH}/versions-deb-${DIST}-${ARCH}" + +## Print the unique and sorted result +sort -u "${TARGET_PATH}/versions-deb-${DIST}-${ARCH}" -o "${TARGET_PATH}/versions-deb-${DIST}-${ARCH}" +if [ -e "${TARGET_PATH}/versions-py2-${DIST}-${ARCH}" ]; then + sort -u "${TARGET_PATH}/versions-py2-${DIST}-${ARCH}" -o "${TARGET_PATH}/versions-py2-${DIST}-${ARCH}" +fi +if [ -e "${TARGET_PATH}/versions-py3-${DIST}-${ARCH}" ]; then + sort -u "${TARGET_PATH}/versions-py3-${DIST}-${ARCH}" -o "${TARGET_PATH}/versions-py3-${DIST}-${ARCH}" +fi exit 0 diff --git a/src/sonic-build-hooks/scripts/post_run_buildinfo b/src/sonic-build-hooks/scripts/post_run_buildinfo index a8dab41021b1..e0d84d35bb08 100755 --- a/src/sonic-build-hooks/scripts/post_run_buildinfo +++ b/src/sonic-build-hooks/scripts/post_run_buildinfo @@ -2,8 +2,6 @@ . /usr/local/share/buildinfo/scripts/buildinfo_base.sh -[ -d $POST_VERSION_PATH ] && rm -rf $POST_VERSION_PATH - # Collect the version files collect_version_files $POST_VERSION_PATH @@ -12,3 +10,4 @@ rm -rf $BUILD_VERSION_PATH/* # Disable the build hooks symlink_build_hooks -d +set_reproducible_mirrors -d diff --git a/src/sonic-build-hooks/scripts/pre_run_buildinfo b/src/sonic-build-hooks/scripts/pre_run_buildinfo index a8450690b6ff..d9b927ab42f9 100755 --- a/src/sonic-build-hooks/scripts/pre_run_buildinfo +++ b/src/sonic-build-hooks/scripts/pre_run_buildinfo @@ -8,8 +8,11 @@ mkdir -p $BUILD_VERSION_PATH mkdir -p $LOG_PATH [ -d $PRE_VERSION_PATH ] && rm -rf $PRE_VERSION_PATH +[ -d $POST_VERSION_PATH ] && rm -rf $POST_VERSION_PATH +mkdir -p $POST_VERSION_PATH collect_version_files $PRE_VERSION_PATH symlink_build_hooks +set_reproducible_mirrors chmod -R a+rw $BUILDINFO_PATH diff --git a/src/sonic-config-engine/config_samples.py b/src/sonic-config-engine/config_samples.py index f8dc4b1c13b3..0606c19056bd 100644 --- a/src/sonic-config-engine/config_samples.py +++ b/src/sonic-config-engine/config_samples.py @@ -10,6 +10,16 @@ else: UNICODE_TYPE = unicode +def generate_common_config(data): + data['FLEX_COUNTER_TABLE'] = { + 'ACL': { + 'FLEX_COUNTER_STATUS': 'disable', + 'FLEX_COUNTER_DELAY_STATUS': 'true', + 'POLL_INTERVAL': '10000' + } + } + return data + # The following config generation methods exits: # 't1': generate_t1_sample_config, # 'l2': generate_l2_config, @@ -160,5 +170,6 @@ def get_available_config(): return list(_sample_generators.keys()) def generate_sample_config(data, setting_name): + data = generate_common_config(data) return _sample_generators[setting_name.lower()](data) diff --git a/src/sonic-config-engine/data/l1intf.j2 b/src/sonic-config-engine/data/l1intf.j2 index 06222632e0da..68ffc3ee4ece 100644 --- a/src/sonic-config-engine/data/l1intf.j2 +++ b/src/sonic-config-engine/data/l1intf.j2 @@ -1,8 +1,15 @@ { "DEVICE_METADATA": { "localhost" : { - "hwsku" : "{{ DEVICE_METADATA.localhost.hwsku }}" - } + "hwsku" : "{{ DEVICE_METADATA.localhost.hwsku }}" + } + }, + "FLEX_COUNTER_TABLE": { + "ACL": { + "FLEX_COUNTER_STATUS": "disable", + "FLEX_COUNTER_DELAY_STATUS": "true", + "POLL_INTERVAL": "10000" + } }, {% set ns = {'firstPrinted': False} -%} "PORT": { diff --git a/src/sonic-config-engine/data/l2switch.j2 b/src/sonic-config-engine/data/l2switch.j2 index 22de3158c589..37c343867a10 100644 --- a/src/sonic-config-engine/data/l2switch.j2 +++ b/src/sonic-config-engine/data/l2switch.j2 @@ -1,5 +1,12 @@ { "DEVICE_METADATA": {{ DEVICE_METADATA | tojson }}, + "FLEX_COUNTER_TABLE": { + "ACL": { + "FLEX_COUNTER_STATUS": "disable", + "FLEX_COUNTER_DELAY_STATUS": "true", + "POLL_INTERVAL": "10000" + } + }, {% set ns = {'firstPrinted': False} -%} "PORT": { {%- for key, value in PORT.items() -%} diff --git a/src/sonic-config-engine/data/l3intf.j2 b/src/sonic-config-engine/data/l3intf.j2 index 255868eb8257..45fba9f692ef 100644 --- a/src/sonic-config-engine/data/l3intf.j2 +++ b/src/sonic-config-engine/data/l3intf.j2 @@ -1,8 +1,15 @@ { "DEVICE_METADATA": { "localhost" : { - "hwsku" : "{{ DEVICE_METADATA.localhost.hwsku }}" - } + "hwsku" : "{{ DEVICE_METADATA.localhost.hwsku }}" + } + }, + "FLEX_COUNTER_TABLE": { + "ACL": { + "FLEX_COUNTER_STATUS": "disable", + "FLEX_COUNTER_DELAY_STATUS": "true", + "POLL_INTERVAL": "10000" + } }, {% set ns = {'firstPrinted': False} -%} "PORT": { diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index e6445fcfed4a..35a6f564568f 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -37,6 +37,7 @@ backend_device_types = ['BackEndToRRouter', 'BackEndLeafRouter'] console_device_types = ['MgmtTsToR'] +dhcp_server_enabled_device_types = ['BmcMgmtToRRouter'] VLAN_SUB_INTERFACE_SEPARATOR = '.' VLAN_SUB_INTERFACE_VLAN_ID = '10' @@ -279,7 +280,7 @@ def parse_png(png, hname, dpg_ecmp_content = None): mux_cable_ports[intf_name] = "true" - if (len(dpg_ecmp_content)): + if dpg_ecmp_content and (len(dpg_ecmp_content)): for version, content in dpg_ecmp_content.items(): # version is ipv4 or ipv6 fine_grained_content = formulate_fine_grained_ecmp(version, content, port_device_map, port_alias_map) # port_alias_map FG_NHG_MEMBER.update(fine_grained_content['FG_NHG_MEMBER']) @@ -487,7 +488,7 @@ def parse_dpg(dpg, hname): for i, member in enumerate(pcmbr_list): pcmbr_list[i] = port_alias_map.get(member, member) intfs_inpc.append(pcmbr_list[i]) - pc_members[(pcintfname, pcmbr_list[i])] = {'NULL': 'NULL'} + pc_members[(pcintfname, pcmbr_list[i])] = {} if pcintf.find(str(QName(ns, "Fallback"))) != None: pcs[pcintfname] = {'members': pcmbr_list, 'fallback': pcintf.find(str(QName(ns, "Fallback"))).text, 'min_links': str(int(math.ceil(len() * 0.75)))} else: @@ -497,6 +498,7 @@ def parse_dpg(dpg, hname): nhg_int = "" nhportlist = [] dpg_ecmp_content = {} + static_routes = {} ipnhs = child.find(str(QName(ns, "IPNextHops"))) if ipnhs is not None: for ipnh in ipnhs.findall(str(QName(ns, "IPNextHop"))): @@ -508,8 +510,14 @@ def parse_dpg(dpg, hname): port_nhipv4_map[ipnhfmbr] = ipnhaddr elif ":" in ipnhaddr: port_nhipv6_map[ipnhfmbr] = ipnhaddr - - if port_nhipv4_map is not None and port_nhipv6_map is not None: + elif ipnh.find(str(QName(ns, "Type"))).text == 'StaticRoute': + prefix = ipnh.find(str(QName(ns, "AssociatedTo"))).text + ifname = ipnh.find(str(QName(ns, "AttachTo"))).text + nexthop = ipnh.find(str(QName(ns, "Address"))).text + advertise = ipnh.find(str(QName(ns, "Advertise"))).text + static_routes[prefix] = {'nexthop': nexthop, 'ifname': ifname, 'advertise': advertise} + + if port_nhipv4_map and port_nhipv6_map: subnet_check_ip = list(port_nhipv4_map.values())[0] for subnet_range in ip_intfs_map: if ("." in subnet_range): @@ -526,6 +534,7 @@ def parse_dpg(dpg, hname): vlanintfs = child.find(str(QName(ns, "VlanInterfaces"))) vlans = {} vlan_members = {} + vlan_member_list = {} dhcp_relay_table = {} # Dict: vlan member (port/PortChannel) -> set of VlanID, in which the member if an untagged vlan member untagged_vlan_mbr = defaultdict(set) @@ -561,7 +570,7 @@ def parse_dpg(dpg, hname): else: vlan_members[(sonic_vlan_member_name, vmbr_list[i])] = {'tagging_mode': 'untagged'} - vlan_attributes = {'vlanid': vlanid, 'members': vmbr_list } + vlan_attributes = {'vlanid': vlanid} dhcp_attributes = {} # If this VLAN requires a DHCP relay agent, it will contain a element @@ -589,6 +598,7 @@ def parse_dpg(dpg, hname): if sonic_vlan_name != vintfname: vlan_attributes['alias'] = vintfname vlans[sonic_vlan_name] = vlan_attributes + vlan_member_list[sonic_vlan_name] = vmbr_list acls = {} for aclintf in aclintfs.findall(str(QName(ns, "AclInterface"))): @@ -619,7 +629,7 @@ def parse_dpg(dpg, hname): elif member in vlans: # For egress ACL attaching to vlan, we break them into vlan members if stage == "egress": - acl_intfs.extend(vlans[member]['members']) + acl_intfs.extend(vlan_member_list[member]) else: acl_intfs.append(member) elif member in port_alias_map: @@ -709,8 +719,10 @@ def parse_dpg(dpg, hname): if mg_key in mg_tunnel.attrib: tunnelintfs[tunnel_type][tunnel_name][table_key] = mg_tunnel.attrib[mg_key] - return intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnelintfs, dpg_ecmp_content - return None, None, None, None, None, None, None, None, None, None, None, None, None + return intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnelintfs, dpg_ecmp_content, static_routes + return None, None, None, None, None, None, None, None, None, None, None, None, None, None, None + + def parse_host_loopback(dpg, hname): for child in dpg: @@ -746,10 +758,13 @@ def parse_cpg(cpg, hname, local_devices=[]): nhopself = 1 if session.find(str(QName(ns, "NextHopSelf"))) is not None else 0 # choose the right table and admin_status for the peer - voq_chassis = session.find(str(QName(ns, "VoQChassisInternal"))) - if voq_chassis is not None and voq_chassis.text == "true": + chassis_internal_ibgp = session.find(str(QName(ns, "ChassisInternal"))) + if chassis_internal_ibgp is not None and chassis_internal_ibgp.text == "voq": table = bgp_voq_chassis_sessions admin_status = 'up' + elif chassis_internal_ibgp is not None and chassis_internal_ibgp.text == "chassis-packet": + table = bgp_internal_sessions + admin_status = 'up' elif end_router.lower() in local_devices and start_router.lower() in local_devices: table = bgp_internal_sessions admin_status = 'up' @@ -961,6 +976,7 @@ def parse_asic_meta(meta, hname): def parse_deviceinfo(meta, hwsku): port_speeds = {} port_descriptions = {} + sys_ports = {} for device_info in meta.findall(str(QName(ns, "DeviceInfo"))): dev_sku = device_info.find(str(QName(ns, "HwSku"))).text if dev_sku == hwsku: @@ -975,7 +991,6 @@ def parse_deviceinfo(meta, hwsku): port_speeds[port_alias_map.get(alias, alias)] = speed sysports = device_info.find(str(QName(ns, "SystemPorts"))) - sys_ports = {} if sysports is not None: for sysport in sysports.findall(str(QName(ns, "SystemPort"))): portname = sysport.find(str(QName(ns, "Name"))).text @@ -1214,6 +1229,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw is_storage_device = False local_devices = [] kube_data = {} + static_routes = {} hwsku_qn = QName(ns, "HwSku") hostname_qn = QName(ns, "Hostname") @@ -1236,7 +1252,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw for child in root: if asic_name is None: if child.tag == str(QName(ns, "DpgDec")): - (intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnel_intfs, dpg_ecmp_content) = parse_dpg(child, hostname) + (intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnel_intfs, dpg_ecmp_content, static_routes) = parse_dpg(child, hostname) elif child.tag == str(QName(ns, "CpgDec")): (bgp_sessions, bgp_internal_sessions, bgp_voq_chassis_sessions, bgp_asn, bgp_peers_with_range, bgp_monitors) = parse_cpg(child, hostname) elif child.tag == str(QName(ns, "PngDec")): @@ -1251,7 +1267,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw (port_speeds_default, port_descriptions, sys_ports) = parse_deviceinfo(child, hwsku) else: if child.tag == str(QName(ns, "DpgDec")): - (intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnel_intfs, dpg_ecmp_content) = parse_dpg(child, asic_name) + (intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnel_intfs, dpg_ecmp_content, static_routes) = parse_dpg(child, asic_name) host_lo_intfs = parse_host_loopback(child, hostname) elif child.tag == str(QName(ns, "CpgDec")): (bgp_sessions, bgp_internal_sessions, bgp_voq_chassis_sessions, bgp_asn, bgp_peers_with_range, bgp_monitors) = parse_cpg(child, asic_name, local_devices) @@ -1274,7 +1290,6 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw results = {} results['DEVICE_METADATA'] = {'localhost': { 'bgp_asn': bgp_asn, - 'deployment_id': deployment_id, 'region': region, 'cloudtype': cloudtype, 'docker_routing_config_mode': docker_routing_config_mode, @@ -1285,6 +1300,9 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw } } + if deployment_id is not None: + results['DEVICE_METADATA']['localhost']['deployment_id'] = deployment_id + cluster = [devices[key] for key in devices if key.lower() == hostname.lower()][0].get('cluster', "") if cluster: results['DEVICE_METADATA']['localhost']['cluster'] = cluster @@ -1402,12 +1420,12 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw } else: vlan_intfs[vlan_invert_mapping[intf[0]]] = {} - elif intf[0][0:11] == 'PortChannel': - pc_intfs[intf] = {} - pc_intfs[intf[0]] = {} elif VLAN_SUB_INTERFACE_SEPARATOR in intf[0]: vlan_sub_intfs[intf] = {} vlan_sub_intfs[intf[0]] = {'admin_status': 'up'} + elif intf[0][0:11] == 'PortChannel': + pc_intfs[intf] = {} + pc_intfs[intf[0]] = {} else: phyport_intfs[intf] = {} phyport_intfs[intf[0]] = {} @@ -1548,6 +1566,9 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw del results['PORTCHANNEL_INTERFACE'] is_storage_device = True results['VLAN_SUB_INTERFACE'] = vlan_sub_intfs + # storage backend T0 have all vlan members tagged + for vlan in vlan_members: + vlan_members[vlan]["tagging_mode"] = "tagged" elif current_device['type'] in backend_device_types and (resource_type is None or 'Storage' in resource_type): del results['INTERFACE'] del results['PORTCHANNEL_INTERFACE'] @@ -1573,8 +1594,14 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw sub_intf = pc_intf + VLAN_SUB_INTERFACE_SEPARATOR + VLAN_SUB_INTERFACE_VLAN_ID vlan_sub_intfs[sub_intf] = {"admin_status" : "up"} results['VLAN_SUB_INTERFACE'] = vlan_sub_intfs + # storage backend T0 have all vlan members tagged + for vlan in vlan_members: + vlan_members[vlan]["tagging_mode"] = "tagged" elif resource_type is not None and 'Storage' in resource_type: is_storage_device = True + elif bool(vlan_sub_intfs): + results['VLAN_SUB_INTERFACE'] = vlan_sub_intfs + if is_storage_device: results['DEVICE_METADATA']['localhost']['storage_device'] = "true" @@ -1586,6 +1613,9 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw results['MUX_CABLE'] = get_mux_cable_entries(mux_cable_ports, neighbors, devices) + if static_routes: + results['STATIC_ROUTE'] = static_routes + for nghbr in list(neighbors.keys()): # remove port not in port_config.ini if nghbr not in ports: @@ -1605,7 +1635,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw results['ACL_TABLE'] = filter_acl_table_bindings(acls, neighbors, pcs, sub_role) results['FEATURE'] = { 'telemetry': { - 'status': 'enabled' + 'state': 'enabled' } } results['TELEMETRY'] = { @@ -1665,6 +1695,10 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw } } + # Enable DHCP Server feature for specific device type + if current_device['type'] in dhcp_server_enabled_device_types: + results['DEVICE_METADATA']['localhost']['dhcp_server'] = 'enabled' + return results def get_tunnel_entries(tunnel_intfs, lo_intfs, hostname): @@ -1738,6 +1772,15 @@ def parse_asic_sub_role(filename, asic_name): sub_role, _, _, _ = parse_asic_meta(child, asic_name) return sub_role +def parse_asic_switch_type(filename, asic_name): + if os.path.isfile(filename): + root = ET.parse(filename).getroot() + for child in root: + if child.tag == str(QName(ns, "MetadataDeclaration")): + _, _, switch_type, _ = parse_asic_meta(child, asic_name) + return switch_type + return None + def parse_asic_meta_get_devices(root): local_devices = [] diff --git a/src/sonic-config-engine/portconfig.py b/src/sonic-config-engine/portconfig.py index db486b1b7d8c..0c056d1cdab7 100644 --- a/src/sonic-config-engine/portconfig.py +++ b/src/sonic-config-engine/portconfig.py @@ -39,21 +39,31 @@ INTF_KEY = "interfaces" OPTIONAL_HWSKU_ATTRIBUTES = ["fec", "autoneg"] -BRKOUT_PATTERN = r'(\d{1,3})x(\d{1,3}G)(\[(\d{1,3}G,?)*\])?(\((\d{1,3})\))?' +BRKOUT_PATTERN = r'(\d{1,6})x(\d{1,6}G?)(\[(\d{1,6}G?,?)*\])?(\((\d{1,6})\))?' +BRKOUT_PATTERN_GROUPS = 6 # # Helper Functions # + +# For python2 compatibility +def py2JsonStrHook(j): + if isinstance(j, unicode): + return j.encode('utf-8', 'backslashreplace') + if isinstance(j, list): + return [py2JsonStrHook(item) for item in j] + if isinstance(j, dict): + return {py2JsonStrHook(key): py2JsonStrHook(value) + for key, value in j.iteritems()} + return j + def readJson(filename): # Read 'platform.json' or 'hwsku.json' file try: with open(filename) as fp: - try: - data = json.load(fp) - except json.JSONDecodeError: - print("Json file does not exist") - data_dict = ast.literal_eval(json.dumps(data)) - return data_dict + if sys.version_info.major == 2: + return json.load(fp, object_hook=py2JsonStrHook) + return json.load(fp) except Exception as e: print("error occurred while parsing json: {}".format(sys.exc_info()[1])) return None @@ -172,85 +182,156 @@ def parse_port_config_file(port_config_file): port_alias_asic_map[data['alias']] = data['asic_port_name'].strip() return (ports, port_alias_map, port_alias_asic_map) -# Generate configs (i.e. alias, lanes, speed, index) for port -def gen_port_config(ports, parent_intf_id, index, alias_list, lanes, k, offset): - if k is not None: - num_lane_used, speed, alt_speed, _, _ , assigned_lane = k[0], k[1], k[2], k[3], k[4], k[5] - - # In case of symmetric mode - if assigned_lane is None: - assigned_lane = len(lanes.split(",")) - - parent_intf_id = int(offset)+int(parent_intf_id) - alias_position = 0 + int(offset)//int(num_lane_used) - lanes_start = 0 + int(offset) - - step = int(assigned_lane)//int(num_lane_used) - for i in range(0,int(assigned_lane), step): - intf_name = PORT_STR + str(parent_intf_id) - ports[intf_name] = {} - ports[intf_name]['alias'] = alias_list[alias_position] - ports[intf_name]['lanes'] = ','.join(lanes.split(",")[lanes_start:lanes_start+step]) - if speed: - speed_pat = re.search("^((\d+)G|\d+)$", speed.upper()) - if speed_pat is None: - raise Exception('{} speed is not Supported...'.format(speed)) - speed_G, speed_orig = speed_pat.group(2), speed_pat.group(1) - if speed_G: - conv_speed = int(speed_G)*1000 - else: - conv_speed = int(speed_orig) - ports[intf_name]['speed'] = str(conv_speed) +class BreakoutCfg(object): + + class BreakoutModeEntry: + def __init__(self, num_ports, default_speed, supported_speed, num_assigned_lanes=None): + self.num_ports = int(num_ports) + self.default_speed = self._speed_to_int(default_speed) + self.supported_speed = set((self.default_speed, )) + self._parse_supported_speed(supported_speed) + self.num_assigned_lanes = self._parse_num_assigned_lanes(num_assigned_lanes) + + @classmethod + def _speed_to_int(cls, speed): + try: + if speed.endswith('G'): + return int(speed.replace('G', '')) * 1000 + + return int(speed) + except ValueError: + raise RuntimeError("Unsupported speed format '{}'".format(speed)) + + def _parse_supported_speed(self, speed): + if not speed: + return + + if not speed.startswith('[') and not speed.endswith(']'): + raise RuntimeError("Unsupported port breakout format!") + + for s in speed[1:-1].split(','): + self.supported_speed.add(self._speed_to_int(s.strip())) + + def _parse_num_assigned_lanes(self, num_assigned_lanes): + if not num_assigned_lanes: + return + + if isinstance(num_assigned_lanes, int): + return num_assigned_lanes + + if not num_assigned_lanes.startswith('(') and not num_assigned_lanes.endswith(')'): + raise RuntimeError("Unsupported port breakout format!") + + return int(num_assigned_lanes[1:-1]) + + def __eq__(self, other): + if isinstance(other, BreakoutCfg.BreakoutModeEntry): + if self.num_ports != other.num_ports: + return False + if self.supported_speed != other.supported_speed: + return False + if self.num_assigned_lanes != other.num_assigned_lanes: + return False + return True else: - raise Exception('Regex return for speed is None...') + return False - ports[intf_name]['index'] = index.split(",")[alias_position] + def __ne__(self, other): + return not self == other - parent_intf_id += step - alias_position += 1 - lanes_start += step + def __hash__(self): + return hash((self.num_ports, tuple(self.supported_speed), self.num_assigned_lanes)) + + def __init__(self, name, bmode, properties): + self._interface_base_id = int(name.replace(PORT_STR, '')) + self._properties = properties + self._lanes = properties ['lanes'].split(',') + self._indexes = properties ['index'].split(',') + self._breakout_mode_entry = self._str_to_entries(bmode) + self._breakout_capabilities = None + + # Find specified breakout mode in port breakout mode capabilities + for supported_mode in self._properties['breakout_modes']: + if self._breakout_mode_entry == self._str_to_entries(supported_mode): + self._breakout_capabilities = self._properties['breakout_modes'][supported_mode] + break + + if not self._breakout_capabilities: + raise RuntimeError("Unsupported breakout mode {}!".format(bmode)) + + def _re_group_to_entry(self, group): + if len(group) != BRKOUT_PATTERN_GROUPS: + raise RuntimeError("Unsupported breakout mode format!") + + num_ports, default_speed, supported_speed, _, num_assigned_lanes, _ = group + if not num_assigned_lanes: + num_assigned_lanes = len(self._lanes) + + return BreakoutCfg.BreakoutModeEntry(num_ports, default_speed, supported_speed, num_assigned_lanes) + + def _str_to_entries(self, bmode): + """ + Example of match_list for some breakout_mode using regex + Breakout Mode -------> Match_list + ----------------------------- + 2x25G(2)+1x50G(2) ---> [('2', '25G', None, '(2)', '2'), ('1', '50G', None, '(2)', '2')] + 1x50G(2)+2x25G(2) ---> [('1', '50G', None, '(2)', '2'), ('2', '25G', None, '(2)', '2')] + 1x100G[40G] ---------> [('1', '100G', '[40G]', None, None)] + 2x50G ---------------> [('2', '50G', None, None, None)] + """ + + try: + groups_list = [re.match(BRKOUT_PATTERN, i).groups() for i in bmode.split("+")] + except Exception: + raise RuntimeError('Breakout mode "{}" validation failed!'.format(bmode)) + + return [self._re_group_to_entry(group) for group in groups_list] + + def get_config(self): + # Ensure that we have corret number of configured lanes + lanes_used = 0 + for entry in self._breakout_mode_entry: + lanes_used += entry.num_assigned_lanes + + if lanes_used > len(self._lanes): + raise RuntimeError("Assigned lines count is more that available!") + + ports = {} + + lane_id = 0 + alias_id = 0 + + for entry in self._breakout_mode_entry: + lanes_per_port = entry.num_assigned_lanes // entry.num_ports + + for port in range(entry.num_ports): + interface_name = PORT_STR + str(self._interface_base_id + lane_id) + + lanes = self._lanes[lane_id:lane_id + lanes_per_port] + + ports[interface_name] = { + 'alias': self._breakout_capabilities[alias_id], + 'lanes': ','.join(lanes), + 'speed': str(entry.default_speed), + 'index': self._indexes[lane_id] + } + + lane_id += lanes_per_port + alias_id += 1 + + return ports - offset = int(assigned_lane) + int(offset) - return offset - else: - raise Exception('Regex return for k is None...') """ Given a port and breakout mode, this method returns the list of child ports using platform_json file """ def get_child_ports(interface, breakout_mode, platform_json_file): - child_ports = {} - port_dict = readJson(platform_json_file) - index = port_dict[INTF_KEY][interface]['index'] - alias_list = port_dict[INTF_KEY][interface]['breakout_modes'][breakout_mode] - lanes = port_dict[INTF_KEY][interface]['lanes'] - - """ - Example of match_list for some breakout_mode using regex - Breakout Mode -------> Match_list - ----------------------------- - 2x25G(2)+1x50G(2) ---> [('2', '25G', None, '(2)', '2'), ('1', '50G', None, '(2)', '2')] - 1x50G(2)+2x25G(2) ---> [('1', '50G', None, '(2)', '2'), ('2', '25G', None, '(2)', '2')] - 1x100G[40G] ---------> [('1', '100G', '[40G]', None, None)] - 2x50G ---------------> [('2', '50G', None, None, None)] - """ - # Asymmetric breakout mode - if re.search("\+",breakout_mode) is not None: - breakout_parts = breakout_mode.split("+") - match_list = [re.match(BRKOUT_PATTERN, i).groups() for i in breakout_parts] - - # Symmetric breakout mode - else: - match_list = [re.match(BRKOUT_PATTERN, breakout_mode).groups()] + mode_handler = BreakoutCfg(interface, breakout_mode, port_dict[INTF_KEY][interface]) - offset = 0 - parent_intf_id = int(re.search("Ethernet(\d+)", interface).group(1)) - for k in match_list: - offset = gen_port_config(child_ports, parent_intf_id, index, alias_list, lanes, k, offset) - return child_ports + return mode_handler.get_config() def parse_platform_json_file(hwsku_json_file, platform_json_file): ports = {} diff --git a/src/sonic-config-engine/setup.py b/src/sonic-config-engine/setup.py index d19fcb1e5b6f..50cd296dccd1 100644 --- a/src/sonic-config-engine/setup.py +++ b/src/sonic-config-engine/setup.py @@ -7,7 +7,7 @@ dependencies = [ 'bitarray==1.5.3', 'ipaddress==1.0.23', - 'lxml==4.6.3', + 'lxml==4.6.5', 'netaddr==0.8.0', 'pyyaml==5.4.1', 'sonic-py-common', diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index cb878037dfd8..bf93ad849fcb 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -29,7 +29,7 @@ import yaml from collections import OrderedDict from config_samples import generate_sample_config, get_available_config from functools import partial -from minigraph import minigraph_encoder, parse_xml, parse_device_desc_xml, parse_asic_sub_role +from minigraph import minigraph_encoder, parse_xml, parse_device_desc_xml, parse_asic_sub_role, parse_asic_switch_type from portconfig import get_port_config, get_breakout_mode from redis_bcc import RedisBytecodeCache from sonic_py_common.multi_asic import get_asic_id_from_name, get_asic_device_id @@ -363,13 +363,17 @@ def main(): # the minigraph file must be provided to get the mac address for backend asics + # or switch_type chassis_packet if args.platform_info: asic_role = None + switch_type = None if asic_name is not None: if args.minigraph is not None: asic_role = parse_asic_sub_role(args.minigraph, asic_name) + switch_type = parse_asic_switch_type(args.minigraph, asic_name) - if asic_role is not None and asic_role.lower() == "backend": + if ((switch_type is not None and switch_type.lower() == "chassis-packet") or + (asic_role is not None and asic_role.lower() == "backend")): mac = device_info.get_system_mac(namespace=asic_name) else: mac = device_info.get_system_mac() diff --git a/src/sonic-config-engine/tests/common_utils.py b/src/sonic-config-engine/tests/common_utils.py index 3d8a3029dad9..47fe9f37f2a4 100644 --- a/src/sonic-config-engine/tests/common_utils.py +++ b/src/sonic-config-engine/tests/common_utils.py @@ -1,4 +1,6 @@ import json +import filecmp +import os import re import sys @@ -31,3 +33,14 @@ def liststr_to_dict(liststr): return list_obj +def cmp(file1, file2): + """ compare files """ + try: + with open(file1, 'r') as f: + obj1 = json.load(f) + with open(file2, 'r') as f: + obj2 = json.load(f) + return obj1 == obj2 + except: + return filecmp.cmp(file1, file2) + diff --git a/src/sonic-config-engine/tests/fg-ecmp-sample-minigraph.xml b/src/sonic-config-engine/tests/fg-ecmp-sample-minigraph.xml index 9cca45e25241..236b63f77161 100644 --- a/src/sonic-config-engine/tests/fg-ecmp-sample-minigraph.xml +++ b/src/sonic-config-engine/tests/fg-ecmp-sample-minigraph.xml @@ -230,6 +230,17 @@ 1000 192.168.0.0/21 + + Vlan31 + etp26 + False + 0.0.0.0/0 + + 200.200.0.48 + 31 + 31 + 200.200.0.0/21 + diff --git a/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph-noportchannel.xml b/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph-noportchannel.xml index 460f71e21c2a..6ec84dc4fe31 100644 --- a/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph-noportchannel.xml +++ b/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph-noportchannel.xml @@ -1119,6 +1119,294 @@ 0 40000 + + DeviceInterface + + true + 1 + Ethernet-BP0 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP4 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP8 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP12 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP16 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP20 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP24 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP28 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP256 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP260 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP264 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP268 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP272 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP276 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP280 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP284 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP384 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP388 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP392 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP396 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP400 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP404 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP408 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP412 + + false + 0 + 0 + 40000 + true 0 diff --git a/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph.xml b/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph.xml index 5dac8e95bf1a..935d2c0c833a 100644 --- a/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph.xml +++ b/src/sonic-config-engine/tests/multi_npu_data/sample-minigraph.xml @@ -1105,6 +1105,294 @@ 0 40000 + + DeviceInterface + + true + 1 + Ethernet-BP0 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP4 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP8 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP12 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP16 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP20 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP24 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP28 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP256 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP260 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP264 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP268 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP272 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP276 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP280 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP284 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP384 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP388 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP392 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP396 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP400 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP404 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP408 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet-BP412 + + false + 0 + 0 + 40000 + true 0 diff --git a/src/sonic-config-engine/tests/multi_npu_data/sample_port_config.ini b/src/sonic-config-engine/tests/multi_npu_data/sample_port_config.ini new file mode 100644 index 000000000000..d2cdb5fedd27 --- /dev/null +++ b/src/sonic-config-engine/tests/multi_npu_data/sample_port_config.ini @@ -0,0 +1,34 @@ +# name lanes alias index asic_port_name role +Ethernet0 33,34,35,36 Ethernet1/1 0 Eth0-ASIC0 Ext +Ethernet4 29,30,31,32 Ethernet1/2 1 Eth1-ASIC0 Ext +Ethernet8 41,42,43,44 Ethernet1/3 2 Eth2-ASIC0 Ext +Ethernet12 37,38,39,40 Ethernet1/4 3 Eth3-ASIC0 Ext +Ethernet-BP0 13,14,15,16 Eth4-ASIC0 4 Eth4-ASIC0 Int +Ethernet-BP4 17,18,19,20 Eth5-ASIC0 5 Eth5-ASIC0 Int +Ethernet-BP8 21,22,23,24 Eth6-ASIC0 6 Eth6-ASIC0 Int +Ethernet-BP12 25,26,27,28 Eth7-ASIC0 7 Eth7-ASIC0 Int +Ethernet16 33,34,35,36 Ethernet1/5 8 Eth0-ASIC1 Ext +Ethernet20 29,30,31,32 Ethernet1/6 9 Eth1-ASIC1 Ext +Ethernet24 41,42,43,44 Ethernet1/7 10 Eth2-ASIC1 Ext +Ethernet28 37,38,39,40 Ethernet1/8 11 Eth3-ASIC1 Ext +Ethernet-BP16 13,14,15,16 Eth4-ASIC1 12 Eth4-ASIC1 Int +Ethernet-BP20 17,18,19,20 Eth5-ASIC1 13 Eth5-ASIC1 Int +Ethernet-BP24 21,22,23,24 Eth6-ASIC1 14 Eth6-ASIC1 Int +Ethernet-BP28 25,26,27,28 Eth7-ASIC1 15 Eth7-ASIC1 Int +Ethernet-BP256 61,62,63,64 Eth0-ASIC2 16 Eth0-ASIC2 Int +Ethernet-BP260 57,58,59,60 Eth1-ASIC2 17 Eth1-ASIC2 Int +Ethernet-BP264 53,54,55,56 Eth2-ASIC2 18 Eth2-ASIC2 Int +Ethernet-BP268 49,50,51,52 Eth3-ASIC2 19 Eth3-ASIC2 Int +Ethernet-BP272 45,46,47,48 Eth4-ASIC2 20 Eth4-ASIC2 Int +Ethernet-BP276 41,42,43,44 Eth5-ASIC2 21 Eth5-ASIC2 Int +Ethernet-BP280 37,38,39,40 Eth6-ASIC2 22 Eth6-ASIC2 Int +Ethernet-BP284 33,34,35,36 Eth7-ASIC2 23 Eth7-ASIC2 Int +Ethernet-BP384 29,30,31,32 Eth0-ASIC3 24 Eth0-ASIC3 Int +Ethernet-BP388 25,26,27,28 Eth1-ASIC3 25 Eth1-ASIC3 Int +Ethernet-BP392 21,22,23,24 Eth2-ASIC3 26 Eth2-ASIC3 Int +Ethernet-BP396 17,18,19,20 Eth3-ASIC3 27 Eth3-ASIC3 Int +Ethernet-BP400 13,14,15,16 Eth4-ASIC3 28 Eth4-ASIC3 Int +Ethernet-BP404 9,10,11,12 Eth5-ASIC3 29 Eth5-ASIC3 Int +Ethernet-BP408 5,6,7,8 Eth6-ASIC3 30 Eth6-ASIC3 Int +Ethernet-BP412 1,2,3,4 Eth7-ASIC3 31 Eth7-ASIC3 Int + diff --git a/src/sonic-config-engine/tests/pc-test-graph.xml b/src/sonic-config-engine/tests/pc-test-graph.xml index 6709d65c4969..4a7ecabaf9f4 100644 --- a/src/sonic-config-engine/tests/pc-test-graph.xml +++ b/src/sonic-config-engine/tests/pc-test-graph.xml @@ -202,6 +202,415 @@ + + + + + DeviceInterface + + true + 1 + fortyGigE0/0 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + 1 + fortyGigE0/4 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + 1 + fortyGigE0/8 + + false + 0 + 0 + 40000 + Interface description + + + DeviceInterface + + true + 1 + fortyGigE0/12 + + false + 0 + 0 + 100000 + Interface description + + + DeviceInterface + + true + 1 + fortyGigE0/16 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/20 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/24 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/28 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/32 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/36 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/44 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/48 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/52 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/56 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/60 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/64 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/68 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/72 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/76 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/80 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/84 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/88 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/92 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/96 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/100 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/104 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/108 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/112 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/116 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/120 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/124 + + false + 0 + 0 + 100000 + + + Force10-S6000 + + + + + + + switch-t0 + + + DeploymentId + + 1 + + + + + + switch-t0 Force10-S6000 diff --git a/src/sonic-config-engine/tests/radv-test-sample-graph.xml b/src/sonic-config-engine/tests/radv-test-sample-graph.xml new file mode 100644 index 000000000000..94cb73d67464 --- /dev/null +++ b/src/sonic-config-engine/tests/radv-test-sample-graph.xml @@ -0,0 +1,947 @@ + + + + + + switch-t0 + 10.1.0.32 + BGPMonitor + 10.20.30.40 + 30 + 10 + 3 + + + false + switch-t0 + 10.0.0.56 + ARISTA01T1 + 10.0.0.57 + 1 + 180 + 60 + + + switch-t0 + FC00::71 + ARISTA01T1 + FC00::72 + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.58 + ARISTA02T1 + 10.0.0.59 + 1 + 180 + 60 + + + switch-t0 + FC00::75 + ARISTA02T1 + FC00::76 + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.60 + ARISTA03T1 + 10.0.0.61 + 1 + 180 + 60 + + + switch-t0 + FC00::79 + ARISTA03T1 + FC00::7A + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.62 + ARISTA04T1 + 10.0.0.63 + 1 + 180 + 60 + + + switch-t0 + FC00::7D + ARISTA04T1 + FC00::7E + 1 + 180 + 60 + + + + + 1 + + BGPMonitor + + + BGPPeer +
10.1.0.32
+ + + +
+
+ +
+ + 65100 + switch-t0 + + +
10.0.0.57
+ + + +
+ +
10.0.0.59
+ + + +
+ +
10.0.0.61
+ + + +
+ +
10.0.0.63
+ + + +
+
+ +
+ + 64600 + ARISTA01T1 + + + + 64600 + ARISTA02T1 + + + + 64600 + ARISTA03T1 + + + + 64600 + ARISTA04T1 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + LoopbackIP1 + Loopback1 + + 10.10.0.99/32 + + 10.10.0.99/32 + + + LoopbackIP2 + Loopback2 + + 10.21.0.64/32 + + 10.21.0.64/32 + + + LoopbackIP3 + Loopback3 + + 10.21.64.2/32 + + 10.21.64.2/32 + + + + + HostIP + eth0 + + 10.0.0.100/24 + + 10.0.0.100/24 + + + HostIP + eth0 + + 2603:10e2:0:2902::8/64 + + 2603:10e2:0:2902::8/64 + + + + + + + switch-t0 + + + PortChannel01 + fortyGigE0/112 + + + + PortChannel02 + fortyGigE0/116 + + + + PortChannel03 + fortyGigE0/120 + + + + PortChannel04 + fortyGigE0/124 + + + + + + Vlan1000 + fortyGigE0/4;fortyGigE0/8;fortyGigE0/12;fortyGigE0/16;fortyGigE0/20;fortyGigE0/24;fortyGigE0/28;fortyGigE0/32;fortyGigE0/36;fortyGigE0/40;fortyGigE0/44;fortyGigE0/48;fortyGigE0/52;fortyGigE0/56;fortyGigE0/60;fortyGigE0/64;fortyGigE0/68;fortyGigE0/72;fortyGigE0/76;fortyGigE0/80;fortyGigE0/84;fortyGigE0/88;fortyGigE0/92;fortyGigE0/96 + False + 0.0.0.0/0 + + + 192.0.0.1;192.0.0.2 + fc02:2000::1;fc02:2000::2 + 1000 + 1000 + 192.168.0.0/27 + + + + + Vlan2000 + fortyGigE0/112;fortyGigE0/116;fortyGigE0/120 + False + 0.0.0.0/0 + + + + 2000 + 2000 + 192.168.200.0/27 + + + + + Vlan99 + fortyGigE0/100 + False + 0.0.0.0/0 + + UserDefinedL2Vlan + 192.0.0.1;192.0.0.2 + 99 + 99 + + + + + + Vlan98 + fortyGigE0/100;PortChannel01;PortChannel03 + False + 0.0.0.0/0 + + UserDefinedL2Vlan + 192.0.0.1;192.0.0.2 + 98 + 98 + + + + + + + + + PortChannel01 + 10.0.0.56/31 + + + + PortChannel01 + FC00::71/126 + + + + PortChannel02 + 10.0.0.58/31 + + + + PortChannel02 + FC00::75/126 + + + + PortChannel03 + 10.0.0.60/31 + + + + PortChannel03 + FC00::79/126 + + + + PortChannel04 + 10.0.0.62/31 + + + + PortChannel04 + FC00::7D/126 + + + + Vlan1000 + 192.168.0.1/27 + + + + Vlan1000 + fc02:1000::1/64 + + + + Vlan2000 + 192.168.200.1/27 + + + + Vlan1000 + fc02:2000::1/64 + + + + + + ERSPAN + everflow + Everflow + + + ERSPANv6 + everflowV6 + Everflow + + + EGRESS_ERSPAN + everflow_egress + Everflow + + + PortChannel01;PortChannel02;PortChannel03;PortChannel04 + DataAclIngress + DataPlane + + + PortChannel01;PortChannel02;Vlan98 + DataAclEgress + DataPlane + + + SNMP + SNMP_ACL + SNMP + + + NTP + NTP_ACL + NTP + + + SSH + SSH_ACL + SSH + + + SSH + ROUTER-PROTECT + SSH + + + SNMP + ROUTER-PROTECT + SNMP + + + NTP + NTP_ACL + + + + + + + + + + DeviceInterfaceLink + ARISTA01T1 + Ethernet1/1 + switch-t0 + fortyGigE0/112 + + + DeviceInterfaceLink + ARISTA02T1 + Ethernet1/1 + switch-t0 + fortyGigE0/116 + + + DeviceInterfaceLink + ARISTA03T1 + Ethernet1/1 + switch-t0 + fortyGigE0/120 + + + DeviceInterfaceLink + ARISTA04T1 + Ethernet1/1 + switch-t0 + fortyGigE0/124 + 100000 + + + DeviceInterfaceLink + 100000 + switch-t0 + fortyGigE0/4 + true + ARISTA05T1 + Ethernet1/33 + true + + + DeviceInterfaceLink + Servers0 + eth0 + switch-t0 + fortyGigE0/4 + + + DeviceInterfaceLink + Servers100 + eth0 + switch-t0 + fortyGigE0/100 + + + + + switch-t0 + Force10-S6000 + + + ARISTA01T1 + Arista + + + ARISTA02T1 + Arista + + + ARISTA03T1 + Arista + + + ARISTA04T1 + Arista + + + + + + + + DeviceInterface + + true + 1 + Ethernet0 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet8 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet12 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet16 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet20 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet24 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet28 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet32 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet36 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet40 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet44 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet48 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet52 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet56 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet60 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet64 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet68 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet72 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet76 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet80 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet84 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet88 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet92 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet96 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet100 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet104 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet108 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet112 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet116 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet120 + + false + 0 + 0 + 40000 + + + Force10-S6000 + + + + + + + switch-t0 + + + ErspanDestinationIpv4 + + 2.2.2.2 + + + + + + + + + + + + + AutoNegotiation + + True + + + FECDisabled + + True + + + ARISTA05T1:Ethernet1/33;switch-t0:fortyGigE0/4 + + + + + + AutoNegotiation + + False + + + FECDisabled + + True + + + ARISTA06T1:Ethernet1/34;switch-t0:fortyGigE0/8 + + + + + + + switch-t0 + + + DeploymentId + + 1 + + + + + + + switch-t0 + Force10-S6000 +
diff --git a/src/sonic-config-engine/tests/sample-arista-7050-t0-minigraph.xml b/src/sonic-config-engine/tests/sample-arista-7050-t0-minigraph.xml index 4d216b30f203..4d79d6f2c457 100644 --- a/src/sonic-config-engine/tests/sample-arista-7050-t0-minigraph.xml +++ b/src/sonic-config-engine/tests/sample-arista-7050-t0-minigraph.xml @@ -463,6 +463,66 @@ + + DeviceInterface + + true + 1 + Ethernet0 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet1 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet2 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet3 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet4 + + false + 0 + 0 + 40000 + DeviceInterface diff --git a/src/sonic-config-engine/tests/sample-arista-7050cx3-dualtor-minigraph.xml b/src/sonic-config-engine/tests/sample-arista-7050cx3-dualtor-minigraph.xml new file mode 100644 index 000000000000..9ffb8230a6bf --- /dev/null +++ b/src/sonic-config-engine/tests/sample-arista-7050cx3-dualtor-minigraph.xml @@ -0,0 +1,2369 @@ + + + + + + false + str2-7050cx3-acs-10 + 10.0.0.56 + ARISTA01T1 + 10.0.0.57 + 1 + 10 + 3 + + + str2-7050cx3-acs-10 + FC00::71 + ARISTA01T1 + FC00::72 + 1 + 10 + 3 + + + false + str2-7050cx3-acs-10 + 10.0.0.58 + ARISTA02T1 + 10.0.0.59 + 1 + 10 + 3 + + + str2-7050cx3-acs-10 + FC00::75 + ARISTA02T1 + FC00::76 + 1 + 10 + 3 + + + false + str2-7050cx3-acs-10 + 10.0.0.60 + ARISTA03T1 + 10.0.0.61 + 1 + 10 + 3 + + + str2-7050cx3-acs-10 + FC00::79 + ARISTA03T1 + FC00::7A + 1 + 10 + 3 + + + false + str2-7050cx3-acs-10 + 10.0.0.62 + ARISTA04T1 + 10.0.0.63 + 1 + 10 + 3 + + + str2-7050cx3-acs-10 + FC00::7D + ARISTA04T1 + FC00::7E + 1 + 10 + 3 + + + + + 65100 + str2-7050cx3-acs-10 + + +
10.0.0.57
+ + + +
+ +
10.0.0.59
+ + + +
+ +
10.0.0.61
+ + + +
+ +
10.0.0.63
+ + + +
+ + BGPPeer +
10.1.0.32
+ + + + BGPSLBPassive + 10.255.0.0/25 +
+ + BGPPeer +
10.1.0.32
+ + + + BGPVac + 192.168.0.0/21 +
+
+ +
+ + 64600 + ARISTA01T1 + + + + 64600 + ARISTA02T1 + + + + 64600 + ARISTA03T1 + + + + 64600 + ARISTA04T1 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + HostIP2 + Loopback1 + + 10.1.0.34/32 + + 10.1.0.34/32 + + + HostIP3 + Loopback1 + + FC00:1::34/128 + + FC00:1::34/128 + + HostIP6 + Loopback3 + + 10.1.0.38/32 + + 10.1.0.38/32 + + + HostIP7 + Loopback3 + + FC00:1::38/128 + + FC00:1::38/128 + + HostIP4 + Loopback2 + + 10.1.0.36/32 + + 10.1.0.36/32 + + + HostIP5 + Loopback2 + + FC00:1::36/128 + + FC00:1::36/128 + + + + HostIP + eth0 + + 10.3.146.122/23 + + 10.3.146.122/23 + + + V6HostIP + eth0 + + FC00:2::32/64 + + FC00:2::32/64 + + + + + + + str2-7050cx3-acs-10 + + + PortChannel101 + Ethernet7/1;Ethernet8/1 + + + + PortChannel102 + Ethernet9/1;Ethernet10/1 + + + + PortChannel103 + Ethernet23/1;Ethernet24/1 + + + + PortChannel104 + Ethernet25/1;Ethernet26/1 + + + + + + + + + Vlan1000 + Ethernet1/1;Ethernet2/1;Ethernet3/1;Ethernet4/1;Ethernet5/1;Ethernet6/1;Ethernet11/1;Ethernet12/1;Ethernet13/1;Ethernet14/1;Ethernet15/1;Ethernet16/1;Ethernet17/1;Ethernet18/1;Ethernet19/1;Ethernet20/1;Ethernet21/1;Ethernet22/1;Ethernet27/1;Ethernet28/1;Ethernet29/1;Ethernet30/1;Ethernet31/1;Ethernet32/1 + False + 0.0.0.0/0 + 192.0.0.1;192.0.0.2;192.0.0.3;192.0.0.4;192.0.0.5;192.0.0.6;192.0.0.7;192.0.0.8;192.0.0.9;192.0.0.10;192.0.0.11;192.0.0.12;192.0.0.13;192.0.0.14;192.0.0.15;192.0.0.16;192.0.0.17;192.0.0.18;192.0.0.19;192.0.0.20;192.0.0.21;192.0.0.22;192.0.0.23;192.0.0.24;192.0.0.25;192.0.0.26;192.0.0.27;192.0.0.28;192.0.0.29;192.0.0.30;192.0.0.31;192.0.0.32;192.0.0.33;192.0.0.34;192.0.0.35;192.0.0.36;192.0.0.37;192.0.0.38;192.0.0.39;192.0.0.40;192.0.0.41;192.0.0.42;192.0.0.43;192.0.0.44;192.0.0.45;192.0.0.46;192.0.0.47;192.0.0.48 + fc02:2000::1;fc02:2000::2;fc02:2000::3;fc02:2000::4 + 1000 + 1000 + 192.168.0.0/21 + 00:aa:bb:cc:dd:ee + + + + + + PortChannel101 + 10.0.0.56/31 + + + + PortChannel101 + FC00::71/126 + + + + PortChannel102 + 10.0.0.58/31 + + + + PortChannel102 + FC00::75/126 + + + + PortChannel103 + 10.0.0.60/31 + + + + PortChannel103 + FC00::79/126 + + + + PortChannel104 + 10.0.0.62/31 + + + + PortChannel104 + FC00::7D/126 + + + + Vlan1000 + 192.168.0.1/21 + + + + Vlan1000 + fc02:1000::1/64 + + + + + + NTP_ACL + NTP + NTP + + + SNMP_ACL + SNMP + SNMP + + + ERSPAN + Everflow + Everflow + + + ERSPANV6 + EverflowV6 + EverflowV6 + + + VTY_LINE + ssh-only + SSH + + + + + + + + + + DeviceInterfaceLink + ARISTA01T1 + Ethernet1 + str2-7050cx3-acs-10 + Ethernet7/1 + + + DeviceInterfaceLink + ARISTA01T1 + Ethernet2 + str2-7050cx3-acs-10 + Ethernet8/1 + + + DeviceInterfaceLink + ARISTA02T1 + Ethernet1 + str2-7050cx3-acs-10 + Ethernet9/1 + + + DeviceInterfaceLink + ARISTA02T1 + Ethernet2 + str2-7050cx3-acs-10 + Ethernet10/1 + + + DeviceInterfaceLink + ARISTA03T1 + Ethernet1 + str2-7050cx3-acs-10 + Ethernet23/1 + + + DeviceInterfaceLink + ARISTA03T1 + Ethernet2 + str2-7050cx3-acs-10 + Ethernet24/1 + + + DeviceInterfaceLink + ARISTA04T1 + Ethernet1 + str2-7050cx3-acs-10 + Ethernet25/1 + + + DeviceInterfaceLink + ARISTA04T1 + Ethernet2 + str2-7050cx3-acs-10 + Ethernet26/1 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet1/1 + Servers0 + eth0 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet2/1 + Servers1 + eth0 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet3/1 + Servers2 + eth0 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet4/1 + Servers3 + eth0 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet5/1 + Servers4 + eth0 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet6/1 + Servers5 + eth0 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet11/1 + Servers6 + eth0 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet12/1 + Servers7 + eth0 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet13/1 + Servers8 + eth0 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet14/1 + Servers9 + eth0 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet15/1 + Servers10 + eth0 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet16/1 + Servers11 + eth0 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet17/1 + Servers12 + eth0 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet18/1 + Servers13 + eth0 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet19/1 + Servers14 + eth0 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet20/1 + Servers15 + eth0 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet21/1 + Servers16 + eth0 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet22/1 + Servers17 + eth0 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet27/1 + Servers18 + eth0 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet28/1 + Servers19 + eth0 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet29/1 + Servers20 + eth0 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet30/1 + Servers21 + eth0 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet31/1 + Servers22 + eth0 + + + DeviceInterfaceLink + str2-7050cx3-acs-10 + Ethernet32/1 + Servers23 + eth0 + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet1/1 + str2-7050cx3-acs-10-Servers0-SC + U + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet2/1 + str2-7050cx3-acs-10-Servers1-SC + U + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet3/1 + str2-7050cx3-acs-10-Servers2-SC + U + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet4/1 + str2-7050cx3-acs-10-Servers3-SC + U + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet5/1 + str2-7050cx3-acs-10-Servers4-SC + U + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet6/1 + str2-7050cx3-acs-10-Servers5-SC + U + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet11/1 + str2-7050cx3-acs-10-Servers6-SC + U + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet12/1 + str2-7050cx3-acs-10-Servers7-SC + U + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet13/1 + str2-7050cx3-acs-10-Servers8-SC + U + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet14/1 + str2-7050cx3-acs-10-Servers9-SC + U + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet15/1 + str2-7050cx3-acs-10-Servers10-SC + U + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet16/1 + str2-7050cx3-acs-10-Servers11-SC + U + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet17/1 + str2-7050cx3-acs-10-Servers12-SC + U + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet18/1 + str2-7050cx3-acs-10-Servers13-SC + U + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet19/1 + str2-7050cx3-acs-10-Servers14-SC + U + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet20/1 + str2-7050cx3-acs-10-Servers15-SC + U + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet21/1 + str2-7050cx3-acs-10-Servers16-SC + U + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet22/1 + str2-7050cx3-acs-10-Servers17-SC + U + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet27/1 + str2-7050cx3-acs-10-Servers18-SC + U + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet28/1 + str2-7050cx3-acs-10-Servers19-SC + U + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet29/1 + str2-7050cx3-acs-10-Servers20-SC + U + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet30/1 + str2-7050cx3-acs-10-Servers21-SC + U + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet31/1 + str2-7050cx3-acs-10-Servers22-SC + U + + + LogicalLink + str2-7050cx3-acs-10 + Ethernet32/1 + str2-7050cx3-acs-10-Servers23-SC + U + + + + + str2-7050cx3-acs-10 + Arista-7050CX3-32S-D48C8 +
+ 10.1.0.32/32 +
+ + FC00:1::32/128 + + + 10.3.146.122 + +
+ + str2-7050cx3-acs-11 + Arista-7050CX3-32S-D48C8 +
+ 10.1.0.33/32 +
+ + FC00:1::33/128 + + + 10.3.146.127 + +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers0-SC +
+ + Server +
+ 192.168.0.2/26 +
+ + fc02:1000::2/96 + + + 0.0.0.0/0 + + Servers0 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers1-SC +
+ + Server +
+ 192.168.0.3/26 +
+ + fc02:1000::3/96 + + + 0.0.0.0/0 + + Servers1 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers2-SC +
+ + Server +
+ 192.168.0.4/26 +
+ + fc02:1000::4/96 + + + 0.0.0.0/0 + + Servers2 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers3-SC +
+ + Server +
+ 192.168.0.5/26 +
+ + fc02:1000::5/96 + + + 0.0.0.0/0 + + Servers3 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers4-SC +
+ + Server +
+ 192.168.0.6/26 +
+ + fc02:1000::6/96 + + + 0.0.0.0/0 + + Servers4 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers5-SC +
+ + Server +
+ 192.168.0.7/26 +
+ + fc02:1000::7/96 + + + 0.0.0.0/0 + + Servers5 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers6-SC +
+ + Server +
+ 192.168.0.8/26 +
+ + fc02:1000::8/96 + + + 0.0.0.0/0 + + Servers6 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers7-SC +
+ + Server +
+ 192.168.0.9/26 +
+ + fc02:1000::9/96 + + + 0.0.0.0/0 + + Servers7 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers8-SC +
+ + Server +
+ 192.168.0.10/26 +
+ + fc02:1000::a/96 + + + 0.0.0.0/0 + + Servers8 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers9-SC +
+ + Server +
+ 192.168.0.11/26 +
+ + fc02:1000::b/96 + + + 0.0.0.0/0 + + Servers9 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers10-SC +
+ + Server +
+ 192.168.0.12/26 +
+ + fc02:1000::c/96 + + + 0.0.0.0/0 + + Servers10 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers11-SC +
+ + Server +
+ 192.168.0.13/26 +
+ + fc02:1000::d/96 + + + 0.0.0.0/0 + + Servers11 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers12-SC +
+ + Server +
+ 192.168.0.14/26 +
+ + fc02:1000::e/96 + + + 0.0.0.0/0 + + Servers12 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers13-SC +
+ + Server +
+ 192.168.0.15/26 +
+ + fc02:1000::f/96 + + + 0.0.0.0/0 + + Servers13 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers14-SC +
+ + Server +
+ 192.168.0.16/26 +
+ + fc02:1000::10/96 + + + 0.0.0.0/0 + + Servers14 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers15-SC +
+ + Server +
+ 192.168.0.17/26 +
+ + fc02:1000::11/96 + + + 0.0.0.0/0 + + Servers15 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers16-SC +
+ + Server +
+ 192.168.0.18/26 +
+ + fc02:1000::12/96 + + + 0.0.0.0/0 + + Servers16 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers17-SC +
+ + Server +
+ 192.168.0.19/26 +
+ + fc02:1000::13/96 + + + 0.0.0.0/0 + + Servers17 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers18-SC +
+ + Server +
+ 192.168.0.20/26 +
+ + fc02:1000::14/96 + + + 0.0.0.0/0 + + Servers18 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers19-SC +
+ + Server +
+ 192.168.0.21/26 +
+ + fc02:1000::15/96 + + + 0.0.0.0/0 + + Servers19 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers20-SC +
+ + Server +
+ 192.168.0.22/26 +
+ + fc02:1000::16/96 + + + 0.0.0.0/0 + + Servers20 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers21-SC +
+ + Server +
+ 192.168.0.23/26 +
+ + fc02:1000::17/96 + + + 0.0.0.0/0 + + Servers21 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers22-SC +
+ + Server +
+ 192.168.0.24/26 +
+ + fc02:1000::18/96 + + + 0.0.0.0/0 + + Servers22 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7050cx3-acs-10-Servers23-SC +
+ + Server +
+ 192.168.0.25/26 +
+ + fc02:1000::19/96 + + + 0.0.0.0/0 + + Servers23 +
+ + ARISTA04T1 + + 172.16.142.63 + + Arista-VM + + + ARISTA03T1 + + 172.16.142.62 + + Arista-VM + + + ARISTA02T1 + + 172.16.142.61 + + Arista-VM + + + ARISTA01T1 + + 172.16.142.60 + + Arista-VM + +
+
+ + + true + + + DeviceInterface + + true + true + 1 + Ethernet1/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet1/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet2/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet2/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet3/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet3/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet4/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet4/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet5/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet5/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet6/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet6/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet7/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet8/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet9/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet10/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet11/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet11/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet12/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet12/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet13/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet13/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet14/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet14/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet15/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet15/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet16/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet16/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet17/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet17/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet18/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet18/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet19/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet19/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet20/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet20/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet21/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet21/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet22/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet22/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet23/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet24/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet25/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet26/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet27/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet27/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet28/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet28/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet29/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet29/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet30/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet30/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet31/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet31/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet32/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet32/3 + + false + 0 + 0 + 50000 + + + true + 0 + Arista-7050CX3-32S-D48C8 + + + + + + + str2-7050cx3-acs-10 + + + DeploymentId + + 1 + + + QosProfile + + Profile0 + + + GeminiEnabled + + True + + + DhcpResources + + 192.0.0.1;192.0.0.2;192.0.0.3;192.0.0.4;192.0.0.5;192.0.0.6;192.0.0.7;192.0.0.8;192.0.0.9;192.0.0.10;192.0.0.11;192.0.0.12;192.0.0.13;192.0.0.14;192.0.0.15;192.0.0.16;192.0.0.17;192.0.0.18;192.0.0.19;192.0.0.20;192.0.0.21;192.0.0.22;192.0.0.23;192.0.0.24;192.0.0.25;192.0.0.26;192.0.0.27;192.0.0.28;192.0.0.29;192.0.0.30;192.0.0.31;192.0.0.32;192.0.0.33;192.0.0.34;192.0.0.35;192.0.0.36;192.0.0.37;192.0.0.38;192.0.0.39;192.0.0.40;192.0.0.41;192.0.0.42;192.0.0.43;192.0.0.44;192.0.0.45;192.0.0.46;192.0.0.47;192.0.0.48 + + + NtpResources + + 10.20.8.129;10.20.8.130 + + + SnmpResources + + 10.3.145.98 + + + SyslogResources + + 10.64.246.95 + + + TacacsGroup + + Starlab + + + TacacsServer + + 100.127.20.21 + + + ForcedMgmtRoutes + + 10.3.145.98/31;10.3.145.8;100.127.20.16/28;10.3.149.170/31;40.122.216.24;13.91.48.226;10.3.145.14;10.64.246.0/24;10.3.146.0/23;10.64.5.5 + + + ErspanDestinationIpv4 + + 10.20.6.16 + + + + + + + + + + + + + GeminiPeeringLink + + True + + + UpperTOR + + str2-7050cx3-acs-10 + + + LowerTOR + + str2-7050cx3-acs-11 + + + str2-7050cx3-acs-11:MuxTunnel0;str2-7050cx3-acs-10:MuxTunnel0 + + + + str2-7050cx3-acs-10 + Arista-7050CX3-32S-D48C8 +
diff --git a/src/sonic-config-engine/tests/sample-arista-7260-dualtor-minigraph.xml b/src/sonic-config-engine/tests/sample-arista-7260-dualtor-minigraph.xml new file mode 100644 index 000000000000..01a42f934726 --- /dev/null +++ b/src/sonic-config-engine/tests/sample-arista-7260-dualtor-minigraph.xml @@ -0,0 +1,4635 @@ + + + + + + false + str2-7260cx3-acs-12 + 10.0.0.56 + ARISTA01T1 + 10.0.0.57 + 1 + 10 + 3 + + + str2-7260cx3-acs-12 + FC00::71 + ARISTA01T1 + FC00::72 + 1 + 10 + 3 + + + false + str2-7260cx3-acs-12 + 10.0.0.58 + ARISTA02T1 + 10.0.0.59 + 1 + 10 + 3 + + + str2-7260cx3-acs-12 + FC00::75 + ARISTA02T1 + FC00::76 + 1 + 10 + 3 + + + false + str2-7260cx3-acs-12 + 10.0.0.60 + ARISTA03T1 + 10.0.0.61 + 1 + 10 + 3 + + + str2-7260cx3-acs-12 + FC00::79 + ARISTA03T1 + FC00::7A + 1 + 10 + 3 + + + false + str2-7260cx3-acs-12 + 10.0.0.62 + ARISTA04T1 + 10.0.0.63 + 1 + 10 + 3 + + + str2-7260cx3-acs-12 + FC00::7D + ARISTA04T1 + FC00::7E + 1 + 10 + 3 + + + + + 65100 + str2-7260cx3-acs-12 + + +
10.0.0.57
+ + + +
+ +
10.0.0.59
+ + + +
+ +
10.0.0.61
+ + + +
+ +
10.0.0.63
+ + + +
+ + BGPPeer +
10.1.0.32
+ + + + BGPSLBPassive + 10.255.0.0/25 +
+ + BGPPeer +
10.1.0.32
+ + + + BGPVac + 192.168.0.0/21 +
+
+ +
+ + 64600 + ARISTA01T1 + + + + 64600 + ARISTA02T1 + + + + 64600 + ARISTA03T1 + + + + 64600 + ARISTA04T1 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + HostIP2 + Loopback1 + + 10.1.0.34/32 + + 10.1.0.34/32 + + + HostIP3 + Loopback1 + + FC00:1::34/128 + + FC00:1::34/128 + + HostIP6 + Loopback3 + + 10.1.0.38/32 + + 10.1.0.38/32 + + + HostIP7 + Loopback3 + + FC00:1::38/128 + + FC00:1::38/128 + + HostIP4 + Loopback2 + + 10.1.0.36/32 + + 10.1.0.36/32 + + + HostIP5 + Loopback2 + + FC00:1::36/128 + + FC00:1::36/128 + + + + HostIP + eth0 + + 10.3.147.165/23 + + 10.3.147.165/23 + + + V6HostIP + eth0 + + FC00:2::32/64 + + FC00:2::32/64 + + + + + + + str2-7260cx3-acs-12 + + + PortChannel101 + Ethernet13/1;Ethernet14/1 + + + + PortChannel102 + Ethernet15/1;Ethernet16/1 + + + + PortChannel103 + Ethernet17/1;Ethernet18/1 + + + + PortChannel104 + Ethernet19/1;Ethernet20/1 + + + + + + + + + Vlan1000 + Ethernet1/1;Ethernet2/1;Ethernet3/1;Ethernet4/1;Ethernet5/1;Ethernet6/1;Ethernet7/1;Ethernet8/1;Ethernet9/1;Ethernet10/1;Ethernet11/1;Ethernet12/1;Ethernet21/1;Ethernet22/1;Ethernet23/1;Ethernet24/1;Ethernet25/1;Ethernet26/1;Ethernet27/1;Ethernet28/1;Ethernet29/1;Ethernet30/1;Ethernet31/1;Ethernet32/1;Ethernet33/1;Ethernet34/1;Ethernet35/1;Ethernet36/1;Ethernet37/1;Ethernet38/1;Ethernet39/1;Ethernet40/1;Ethernet41/1;Ethernet42/1;Ethernet43/1;Ethernet44/1;Ethernet45/1;Ethernet46/1;Ethernet47/1;Ethernet48/1;Ethernet49/1;Ethernet50/1;Ethernet51/1;Ethernet52/1;Ethernet53/1;Ethernet54/1;Ethernet55/1;Ethernet56/1;Ethernet57/1;Ethernet58/1;Ethernet59/1;Ethernet60/1;Ethernet61/1;Ethernet62/1;Ethernet63/1;Ethernet64/1 + False + 0.0.0.0/0 + 192.0.0.1;192.0.0.2;192.0.0.3;192.0.0.4;192.0.0.5;192.0.0.6;192.0.0.7;192.0.0.8;192.0.0.9;192.0.0.10;192.0.0.11;192.0.0.12;192.0.0.13;192.0.0.14;192.0.0.15;192.0.0.16;192.0.0.17;192.0.0.18;192.0.0.19;192.0.0.20;192.0.0.21;192.0.0.22;192.0.0.23;192.0.0.24;192.0.0.25;192.0.0.26;192.0.0.27;192.0.0.28;192.0.0.29;192.0.0.30;192.0.0.31;192.0.0.32;192.0.0.33;192.0.0.34;192.0.0.35;192.0.0.36;192.0.0.37;192.0.0.38;192.0.0.39;192.0.0.40;192.0.0.41;192.0.0.42;192.0.0.43;192.0.0.44;192.0.0.45;192.0.0.46;192.0.0.47;192.0.0.48 + fc02:2000::1;fc02:2000::2;fc02:2000::3;fc02:2000::4 + 1000 + 1000 + 192.168.0.0/21 + 00:aa:bb:cc:dd:ee + + + + + + PortChannel101 + 10.0.0.56/31 + + + + PortChannel101 + FC00::71/126 + + + + PortChannel102 + 10.0.0.58/31 + + + + PortChannel102 + FC00::75/126 + + + + PortChannel103 + 10.0.0.60/31 + + + + PortChannel103 + FC00::79/126 + + + + PortChannel104 + 10.0.0.62/31 + + + + PortChannel104 + FC00::7D/126 + + + + Vlan1000 + 192.168.0.1/21 + + + + Vlan1000 + fc02:1000::1/64 + + + + + + NTP_ACL + NTP + NTP + + + SNMP_ACL + SNMP + SNMP + + + ERSPAN + Everflow + Everflow + + + ERSPANV6 + EverflowV6 + EverflowV6 + + + VTY_LINE + ssh-only + SSH + + + + + + + + + + DeviceInterfaceLink + ARISTA01T1 + Ethernet1 + str2-7260cx3-acs-12 + Ethernet13/1 + + + DeviceInterfaceLink + ARISTA01T1 + Ethernet2 + str2-7260cx3-acs-12 + Ethernet14/1 + + + DeviceInterfaceLink + ARISTA02T1 + Ethernet1 + str2-7260cx3-acs-12 + Ethernet15/1 + + + DeviceInterfaceLink + ARISTA02T1 + Ethernet2 + str2-7260cx3-acs-12 + Ethernet16/1 + + + DeviceInterfaceLink + ARISTA03T1 + Ethernet1 + str2-7260cx3-acs-12 + Ethernet17/1 + + + DeviceInterfaceLink + ARISTA03T1 + Ethernet2 + str2-7260cx3-acs-12 + Ethernet18/1 + + + DeviceInterfaceLink + ARISTA04T1 + Ethernet1 + str2-7260cx3-acs-12 + Ethernet19/1 + + + DeviceInterfaceLink + ARISTA04T1 + Ethernet2 + str2-7260cx3-acs-12 + Ethernet20/1 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet1/1 + Servers0 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet2/1 + Servers1 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet3/1 + Servers2 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet4/1 + Servers3 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet5/1 + Servers4 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet6/1 + Servers5 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet7/1 + Servers6 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet8/1 + Servers7 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet9/1 + Servers8 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet10/1 + Servers9 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet11/1 + Servers10 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet12/1 + Servers11 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet21/1 + Servers12 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet22/1 + Servers13 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet23/1 + Servers14 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet24/1 + Servers15 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet25/1 + Servers16 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet26/1 + Servers17 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet27/1 + Servers18 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet28/1 + Servers19 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet29/1 + Servers20 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet30/1 + Servers21 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet31/1 + Servers22 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet32/1 + Servers23 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet33/1 + Servers24 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet34/1 + Servers25 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet35/1 + Servers26 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet36/1 + Servers27 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet37/1 + Servers28 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet38/1 + Servers29 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet39/1 + Servers30 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet40/1 + Servers31 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet41/1 + Servers32 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet42/1 + Servers33 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet43/1 + Servers34 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet44/1 + Servers35 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet45/1 + Servers36 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet46/1 + Servers37 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet47/1 + Servers38 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet48/1 + Servers39 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet49/1 + Servers40 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet50/1 + Servers41 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet51/1 + Servers42 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet52/1 + Servers43 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet53/1 + Servers44 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet54/1 + Servers45 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet55/1 + Servers46 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet56/1 + Servers47 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet57/1 + Servers48 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet58/1 + Servers49 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet59/1 + Servers50 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet60/1 + Servers51 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet61/1 + Servers52 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet62/1 + Servers53 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet63/1 + Servers54 + eth0 + + + DeviceInterfaceLink + str2-7260cx3-acs-12 + Ethernet64/1 + Servers55 + eth0 + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet1/1 + str2-7260cx3-acs-12-Servers0-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet2/1 + str2-7260cx3-acs-12-Servers1-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet3/1 + str2-7260cx3-acs-12-Servers2-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet4/1 + str2-7260cx3-acs-12-Servers3-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet5/1 + str2-7260cx3-acs-12-Servers4-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet6/1 + str2-7260cx3-acs-12-Servers5-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet7/1 + str2-7260cx3-acs-12-Servers6-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet8/1 + str2-7260cx3-acs-12-Servers7-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet9/1 + str2-7260cx3-acs-12-Servers8-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet10/1 + str2-7260cx3-acs-12-Servers9-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet11/1 + str2-7260cx3-acs-12-Servers10-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet12/1 + str2-7260cx3-acs-12-Servers11-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet21/1 + str2-7260cx3-acs-12-Servers12-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet22/1 + str2-7260cx3-acs-12-Servers13-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet23/1 + str2-7260cx3-acs-12-Servers14-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet24/1 + str2-7260cx3-acs-12-Servers15-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet25/1 + str2-7260cx3-acs-12-Servers16-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet26/1 + str2-7260cx3-acs-12-Servers17-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet27/1 + str2-7260cx3-acs-12-Servers18-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet28/1 + str2-7260cx3-acs-12-Servers19-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet29/1 + str2-7260cx3-acs-12-Servers20-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet30/1 + str2-7260cx3-acs-12-Servers21-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet31/1 + str2-7260cx3-acs-12-Servers22-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet32/1 + str2-7260cx3-acs-12-Servers23-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet33/1 + str2-7260cx3-acs-12-Servers24-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet34/1 + str2-7260cx3-acs-12-Servers25-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet35/1 + str2-7260cx3-acs-12-Servers26-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet36/1 + str2-7260cx3-acs-12-Servers27-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet37/1 + str2-7260cx3-acs-12-Servers28-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet38/1 + str2-7260cx3-acs-12-Servers29-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet39/1 + str2-7260cx3-acs-12-Servers30-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet40/1 + str2-7260cx3-acs-12-Servers31-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet41/1 + str2-7260cx3-acs-12-Servers32-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet42/1 + str2-7260cx3-acs-12-Servers33-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet43/1 + str2-7260cx3-acs-12-Servers34-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet44/1 + str2-7260cx3-acs-12-Servers35-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet45/1 + str2-7260cx3-acs-12-Servers36-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet46/1 + str2-7260cx3-acs-12-Servers37-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet47/1 + str2-7260cx3-acs-12-Servers38-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet48/1 + str2-7260cx3-acs-12-Servers39-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet49/1 + str2-7260cx3-acs-12-Servers40-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet50/1 + str2-7260cx3-acs-12-Servers41-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet51/1 + str2-7260cx3-acs-12-Servers42-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet52/1 + str2-7260cx3-acs-12-Servers43-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet53/1 + str2-7260cx3-acs-12-Servers44-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet54/1 + str2-7260cx3-acs-12-Servers45-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet55/1 + str2-7260cx3-acs-12-Servers46-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet56/1 + str2-7260cx3-acs-12-Servers47-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet57/1 + str2-7260cx3-acs-12-Servers48-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet58/1 + str2-7260cx3-acs-12-Servers49-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet59/1 + str2-7260cx3-acs-12-Servers50-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet60/1 + str2-7260cx3-acs-12-Servers51-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet61/1 + str2-7260cx3-acs-12-Servers52-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet62/1 + str2-7260cx3-acs-12-Servers53-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet63/1 + str2-7260cx3-acs-12-Servers54-SC + U + + + LogicalLink + str2-7260cx3-acs-12 + Ethernet64/1 + str2-7260cx3-acs-12-Servers55-SC + U + + + + + str2-7260cx3-acs-12 + Arista-7260CX3-D108C8 +
+ 10.1.0.32/32 +
+ + FC00:1::32/128 + + + 10.3.147.165 + +
+ + str2-7260cx3-acs-13 + Arista-7260CX3-D108C8 +
+ 10.1.0.33/32 +
+ + FC00:1::33/128 + + + 10.3.147.167 + +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers0-SC +
+ + Server +
+ 192.168.0.2/26 +
+ + fc02:1000::2/96 + + + 0.0.0.0/0 + + Servers0 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers1-SC +
+ + Server +
+ 192.168.0.3/26 +
+ + fc02:1000::3/96 + + + 0.0.0.0/0 + + Servers1 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers2-SC +
+ + Server +
+ 192.168.0.4/26 +
+ + fc02:1000::4/96 + + + 0.0.0.0/0 + + Servers2 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers3-SC +
+ + Server +
+ 192.168.0.5/26 +
+ + fc02:1000::5/96 + + + 0.0.0.0/0 + + Servers3 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers4-SC +
+ + Server +
+ 192.168.0.6/26 +
+ + fc02:1000::6/96 + + + 0.0.0.0/0 + + Servers4 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers5-SC +
+ + Server +
+ 192.168.0.7/26 +
+ + fc02:1000::7/96 + + + 0.0.0.0/0 + + Servers5 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers6-SC +
+ + Server +
+ 192.168.0.8/26 +
+ + fc02:1000::8/96 + + + 0.0.0.0/0 + + Servers6 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers7-SC +
+ + Server +
+ 192.168.0.9/26 +
+ + fc02:1000::9/96 + + + 0.0.0.0/0 + + Servers7 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers8-SC +
+ + Server +
+ 192.168.0.10/26 +
+ + fc02:1000::a/96 + + + 0.0.0.0/0 + + Servers8 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers9-SC +
+ + Server +
+ 192.168.0.11/26 +
+ + fc02:1000::b/96 + + + 0.0.0.0/0 + + Servers9 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers10-SC +
+ + Server +
+ 192.168.0.12/26 +
+ + fc02:1000::c/96 + + + 0.0.0.0/0 + + Servers10 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers11-SC +
+ + Server +
+ 192.168.0.13/26 +
+ + fc02:1000::d/96 + + + 0.0.0.0/0 + + Servers11 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers12-SC +
+ + Server +
+ 192.168.0.14/26 +
+ + fc02:1000::e/96 + + + 0.0.0.0/0 + + Servers12 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers13-SC +
+ + Server +
+ 192.168.0.15/26 +
+ + fc02:1000::f/96 + + + 0.0.0.0/0 + + Servers13 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers14-SC +
+ + Server +
+ 192.168.0.16/26 +
+ + fc02:1000::10/96 + + + 0.0.0.0/0 + + Servers14 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers15-SC +
+ + Server +
+ 192.168.0.17/26 +
+ + fc02:1000::11/96 + + + 0.0.0.0/0 + + Servers15 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers16-SC +
+ + Server +
+ 192.168.0.18/26 +
+ + fc02:1000::12/96 + + + 0.0.0.0/0 + + Servers16 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers17-SC +
+ + Server +
+ 192.168.0.19/26 +
+ + fc02:1000::13/96 + + + 0.0.0.0/0 + + Servers17 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers18-SC +
+ + Server +
+ 192.168.0.20/26 +
+ + fc02:1000::14/96 + + + 0.0.0.0/0 + + Servers18 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers19-SC +
+ + Server +
+ 192.168.0.21/26 +
+ + fc02:1000::15/96 + + + 0.0.0.0/0 + + Servers19 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers20-SC +
+ + Server +
+ 192.168.0.22/26 +
+ + fc02:1000::16/96 + + + 0.0.0.0/0 + + Servers20 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers21-SC +
+ + Server +
+ 192.168.0.23/26 +
+ + fc02:1000::17/96 + + + 0.0.0.0/0 + + Servers21 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers22-SC +
+ + Server +
+ 192.168.0.24/26 +
+ + fc02:1000::18/96 + + + 0.0.0.0/0 + + Servers22 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers23-SC +
+ + Server +
+ 192.168.0.25/26 +
+ + fc02:1000::19/96 + + + 0.0.0.0/0 + + Servers23 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers24-SC +
+ + Server +
+ 192.168.0.26/26 +
+ + fc02:1000::1a/96 + + + 0.0.0.0/0 + + Servers24 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers25-SC +
+ + Server +
+ 192.168.0.27/26 +
+ + fc02:1000::1b/96 + + + 0.0.0.0/0 + + Servers25 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers26-SC +
+ + Server +
+ 192.168.0.28/26 +
+ + fc02:1000::1c/96 + + + 0.0.0.0/0 + + Servers26 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers27-SC +
+ + Server +
+ 192.168.0.29/26 +
+ + fc02:1000::1d/96 + + + 0.0.0.0/0 + + Servers27 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers28-SC +
+ + Server +
+ 192.168.0.30/26 +
+ + fc02:1000::1e/96 + + + 0.0.0.0/0 + + Servers28 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers29-SC +
+ + Server +
+ 192.168.0.31/26 +
+ + fc02:1000::1f/96 + + + 0.0.0.0/0 + + Servers29 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers30-SC +
+ + Server +
+ 192.168.0.32/26 +
+ + fc02:1000::20/96 + + + 0.0.0.0/0 + + Servers30 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers31-SC +
+ + Server +
+ 192.168.0.33/26 +
+ + fc02:1000::21/96 + + + 0.0.0.0/0 + + Servers31 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers32-SC +
+ + Server +
+ 192.168.0.34/26 +
+ + fc02:1000::22/96 + + + 0.0.0.0/0 + + Servers32 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers33-SC +
+ + Server +
+ 192.168.0.35/26 +
+ + fc02:1000::23/96 + + + 0.0.0.0/0 + + Servers33 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers34-SC +
+ + Server +
+ 192.168.0.36/26 +
+ + fc02:1000::24/96 + + + 0.0.0.0/0 + + Servers34 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers35-SC +
+ + Server +
+ 192.168.0.37/26 +
+ + fc02:1000::25/96 + + + 0.0.0.0/0 + + Servers35 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers36-SC +
+ + Server +
+ 192.168.0.38/26 +
+ + fc02:1000::26/96 + + + 0.0.0.0/0 + + Servers36 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers37-SC +
+ + Server +
+ 192.168.0.39/26 +
+ + fc02:1000::27/96 + + + 0.0.0.0/0 + + Servers37 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers38-SC +
+ + Server +
+ 192.168.0.40/26 +
+ + fc02:1000::28/96 + + + 0.0.0.0/0 + + Servers38 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers39-SC +
+ + Server +
+ 192.168.0.41/26 +
+ + fc02:1000::29/96 + + + 0.0.0.0/0 + + Servers39 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers40-SC +
+ + Server +
+ 192.168.0.42/26 +
+ + fc02:1000::2a/96 + + + 0.0.0.0/0 + + Servers40 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers41-SC +
+ + Server +
+ 192.168.0.43/26 +
+ + fc02:1000::2b/96 + + + 0.0.0.0/0 + + Servers41 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers42-SC +
+ + Server +
+ 192.168.0.44/26 +
+ + fc02:1000::2c/96 + + + 0.0.0.0/0 + + Servers42 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers43-SC +
+ + Server +
+ 192.168.0.45/26 +
+ + fc02:1000::2d/96 + + + 0.0.0.0/0 + + Servers43 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers44-SC +
+ + Server +
+ 192.168.0.46/26 +
+ + fc02:1000::2e/96 + + + 0.0.0.0/0 + + Servers44 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers45-SC +
+ + Server +
+ 192.168.0.47/26 +
+ + fc02:1000::2f/96 + + + 0.0.0.0/0 + + Servers45 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers46-SC +
+ + Server +
+ 192.168.0.48/26 +
+ + fc02:1000::30/96 + + + 0.0.0.0/0 + + Servers46 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers47-SC +
+ + Server +
+ 192.168.0.49/26 +
+ + fc02:1000::31/96 + + + 0.0.0.0/0 + + Servers47 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers48-SC +
+ + Server +
+ 192.168.0.50/26 +
+ + fc02:1000::32/96 + + + 0.0.0.0/0 + + Servers48 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers49-SC +
+ + Server +
+ 192.168.0.51/26 +
+ + fc02:1000::33/96 + + + 0.0.0.0/0 + + Servers49 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers50-SC +
+ + Server +
+ 192.168.0.52/26 +
+ + fc02:1000::34/96 + + + 0.0.0.0/0 + + Servers50 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers51-SC +
+ + Server +
+ 192.168.0.53/26 +
+ + fc02:1000::35/96 + + + 0.0.0.0/0 + + Servers51 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers52-SC +
+ + Server +
+ 192.168.0.54/26 +
+ + fc02:1000::36/96 + + + 0.0.0.0/0 + + Servers52 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers53-SC +
+ + Server +
+ 192.168.0.55/26 +
+ + fc02:1000::37/96 + + + 0.0.0.0/0 + + Servers53 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers54-SC +
+ + Server +
+ 192.168.0.56/26 +
+ + fc02:1000::38/96 + + + 0.0.0.0/0 + + Servers54 +
+ + SmartCable +
+ 0.0.0.0/0 +
+ + ::/0 + + + 0.0.0.0/0 + + + ::/0 + + + str2-7260cx3-acs-12-Servers55-SC +
+ + Server +
+ 192.168.0.57/26 +
+ + fc02:1000::39/96 + + + 0.0.0.0/0 + + Servers55 +
+ + ARISTA04T1 + + 172.16.147.75 + + Arista-VM + + + ARISTA03T1 + + 172.16.147.74 + + Arista-VM + + + ARISTA02T1 + + 172.16.147.73 + + Arista-VM + + + ARISTA01T1 + + 172.16.147.72 + + Arista-VM + +
+
+ + + true + + + DeviceInterface + + true + true + 1 + Ethernet1/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet1/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet2/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet2/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet3/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet3/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet4/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet4/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet5/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet5/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet6/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet6/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet7/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet7/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet8/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet8/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet9/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet9/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet10/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet10/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet11/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet11/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet12/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet12/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet13/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet14/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet15/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet16/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet17/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet18/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet19/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet20/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet21/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet21/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet22/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet22/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet23/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet23/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet24/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet24/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet25/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet25/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet26/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet26/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet27/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet27/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet28/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet28/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet29/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet29/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet30/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet30/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet31/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet31/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet32/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet32/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet33/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet33/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet34/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet34/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet35/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet35/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet36/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet36/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet37/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet37/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet38/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet38/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet39/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet39/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet40/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet40/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet41/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet41/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet42/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet42/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet43/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet43/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet44/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet44/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet45/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet45/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet46/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet46/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet47/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet47/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet48/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet48/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet49/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet49/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet50/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet50/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet51/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet51/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet52/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet52/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet53/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet53/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet54/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet54/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet55/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet55/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet56/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet56/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet57/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet57/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet58/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet58/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet59/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet59/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet60/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet60/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet61/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet61/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet62/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet62/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet63/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet63/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet64/1 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet64/3 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + Ethernet65 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + true + 1 + Ethernet66 + + false + 0 + 0 + 10000 + + + true + 0 + Arista-7260CX3-D108C8 + + + + + + + str2-7260cx3-acs-12 + + + DeploymentId + + 1 + + + QosProfile + + Profile0 + + + GeminiEnabled + + True + + + DhcpResources + + 192.0.0.1;192.0.0.2;192.0.0.3;192.0.0.4;192.0.0.5;192.0.0.6;192.0.0.7;192.0.0.8;192.0.0.9;192.0.0.10;192.0.0.11;192.0.0.12;192.0.0.13;192.0.0.14;192.0.0.15;192.0.0.16;192.0.0.17;192.0.0.18;192.0.0.19;192.0.0.20;192.0.0.21;192.0.0.22;192.0.0.23;192.0.0.24;192.0.0.25;192.0.0.26;192.0.0.27;192.0.0.28;192.0.0.29;192.0.0.30;192.0.0.31;192.0.0.32;192.0.0.33;192.0.0.34;192.0.0.35;192.0.0.36;192.0.0.37;192.0.0.38;192.0.0.39;192.0.0.40;192.0.0.41;192.0.0.42;192.0.0.43;192.0.0.44;192.0.0.45;192.0.0.46;192.0.0.47;192.0.0.48 + + + NtpResources + + 10.20.8.129;10.20.8.130 + + + SnmpResources + + 10.3.145.98 + + + SyslogResources + + 10.64.246.95 + + + TacacsGroup + + Starlab + + + TacacsServer + + 100.127.20.21 + + + ForcedMgmtRoutes + + 10.3.145.98/31;10.3.145.8;100.127.20.16/28;10.3.149.170/31;40.122.216.24;13.91.48.226;10.3.145.14;10.64.246.0/24;10.3.146.0/23;10.64.5.5 + + + ErspanDestinationIpv4 + + 10.20.6.16 + + + + + + + + + + + + + GeminiPeeringLink + + True + + + UpperTOR + + str2-7260cx3-acs-12 + + + LowerTOR + + str2-7260cx3-acs-13 + + + str2-7260cx3-acs-13:MuxTunnel0;str2-7260cx3-acs-12:MuxTunnel0 + + + + str2-7260cx3-acs-12 + Arista-7260CX3-D108C8 +
diff --git a/src/sonic-config-engine/tests/sample-arista-7260-t1-minigraph.xml b/src/sonic-config-engine/tests/sample-arista-7260-t1-minigraph.xml new file mode 100644 index 000000000000..4367b705a11a --- /dev/null +++ b/src/sonic-config-engine/tests/sample-arista-7260-t1-minigraph.xml @@ -0,0 +1,2491 @@ + + + + + + false + str-7260cx3-acs-7 + 10.0.0.32 + ARISTA01T0 + 10.0.0.33 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::41 + ARISTA01T0 + FC00::42 + 1 + 10 + 3 + + + false + str-7260cx3-acs-7 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::1 + ARISTA01T2 + FC00::2 + 1 + 10 + 3 + + + false + str-7260cx3-acs-7 + 10.0.0.34 + ARISTA02T0 + 10.0.0.35 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::45 + ARISTA02T0 + FC00::46 + 1 + 10 + 3 + + + false + str-7260cx3-acs-7 + 10.0.0.36 + ARISTA03T0 + 10.0.0.37 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::49 + ARISTA03T0 + FC00::4A + 1 + 10 + 3 + + + false + str-7260cx3-acs-7 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::5 + ARISTA03T2 + FC00::6 + 1 + 10 + 3 + + + false + str-7260cx3-acs-7 + 10.0.0.38 + ARISTA04T0 + 10.0.0.39 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::4D + ARISTA04T0 + FC00::4E + 1 + 10 + 3 + + + false + str-7260cx3-acs-7 + 10.0.0.40 + ARISTA05T0 + 10.0.0.41 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::51 + ARISTA05T0 + FC00::52 + 1 + 10 + 3 + + + false + str-7260cx3-acs-7 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::9 + ARISTA05T2 + FC00::A + 1 + 10 + 3 + + + false + str-7260cx3-acs-7 + 10.0.0.42 + ARISTA06T0 + 10.0.0.43 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::55 + ARISTA06T0 + FC00::56 + 1 + 10 + 3 + + + false + str-7260cx3-acs-7 + 10.0.0.44 + ARISTA07T0 + 10.0.0.45 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::59 + ARISTA07T0 + FC00::5A + 1 + 10 + 3 + + + false + str-7260cx3-acs-7 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::D + ARISTA07T2 + FC00::E + 1 + 10 + 3 + + + false + str-7260cx3-acs-7 + 10.0.0.46 + ARISTA08T0 + 10.0.0.47 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::5D + ARISTA08T0 + FC00::5E + 1 + 10 + 3 + + + false + str-7260cx3-acs-7 + 10.0.0.48 + ARISTA09T0 + 10.0.0.49 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::61 + ARISTA09T0 + FC00::62 + 1 + 10 + 3 + + + false + str-7260cx3-acs-7 + 10.0.0.50 + ARISTA10T0 + 10.0.0.51 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::65 + ARISTA10T0 + FC00::66 + 1 + 10 + 3 + + + false + str-7260cx3-acs-7 + 10.0.0.52 + ARISTA11T0 + 10.0.0.53 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::69 + ARISTA11T0 + FC00::6A + 1 + 10 + 3 + + + false + str-7260cx3-acs-7 + 10.0.0.54 + ARISTA12T0 + 10.0.0.55 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::6D + ARISTA12T0 + FC00::6E + 1 + 10 + 3 + + + false + str-7260cx3-acs-7 + 10.0.0.56 + ARISTA13T0 + 10.0.0.57 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::71 + ARISTA13T0 + FC00::72 + 1 + 10 + 3 + + + false + str-7260cx3-acs-7 + 10.0.0.58 + ARISTA14T0 + 10.0.0.59 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::75 + ARISTA14T0 + FC00::76 + 1 + 10 + 3 + + + false + str-7260cx3-acs-7 + 10.0.0.60 + ARISTA15T0 + 10.0.0.61 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::79 + ARISTA15T0 + FC00::7A + 1 + 10 + 3 + + + false + str-7260cx3-acs-7 + 10.0.0.62 + ARISTA16T0 + 10.0.0.63 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::7D + ARISTA16T0 + FC00::7E + 1 + 10 + 3 + + + false + str-7260cx3-acs-7 + 10.0.0.64 + ARISTA17T0 + 10.0.0.65 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::81 + ARISTA17T0 + FC00::82 + 1 + 10 + 3 + + + false + str-7260cx3-acs-7 + 10.0.0.66 + ARISTA18T0 + 10.0.0.67 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::85 + ARISTA18T0 + FC00::86 + 1 + 10 + 3 + + + false + str-7260cx3-acs-7 + 10.0.0.68 + ARISTA19T0 + 10.0.0.69 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::89 + ARISTA19T0 + FC00::8A + 1 + 10 + 3 + + + false + str-7260cx3-acs-7 + 10.0.0.70 + ARISTA20T0 + 10.0.0.71 + 1 + 10 + 3 + + + str-7260cx3-acs-7 + FC00::8D + ARISTA20T0 + FC00::8E + 1 + 10 + 3 + + + + + 65100 + str-7260cx3-acs-7 + + +
10.0.0.33
+ + + +
+ +
10.0.0.1
+ + + +
+ +
10.0.0.35
+ + + +
+ +
10.0.0.37
+ + + +
+ +
10.0.0.5
+ + + +
+ +
10.0.0.39
+ + + +
+ +
10.0.0.41
+ + + +
+ +
10.0.0.9
+ + + +
+ +
10.0.0.43
+ + + +
+ +
10.0.0.45
+ + + +
+ +
10.0.0.13
+ + + +
+ +
10.0.0.47
+ + + +
+ +
10.0.0.49
+ + + +
+ +
10.0.0.51
+ + + +
+ +
10.0.0.53
+ + + +
+ +
10.0.0.55
+ + + +
+ +
10.0.0.57
+ + + +
+ +
10.0.0.59
+ + + +
+ +
10.0.0.61
+ + + +
+ +
10.0.0.63
+ + + +
+ +
10.0.0.65
+ + + +
+ +
10.0.0.67
+ + + +
+ +
10.0.0.69
+ + + +
+ +
10.0.0.71
+ + + +
+
+ +
+ + 64001 + ARISTA01T0 + + + + 65200 + ARISTA01T2 + + + + 64002 + ARISTA02T0 + + + + 64003 + ARISTA03T0 + + + + 65200 + ARISTA03T2 + + + + 64004 + ARISTA04T0 + + + + 64005 + ARISTA05T0 + + + + 65200 + ARISTA05T2 + + + + 64006 + ARISTA06T0 + + + + 64007 + ARISTA07T0 + + + + 65200 + ARISTA07T2 + + + + 64008 + ARISTA08T0 + + + + 64009 + ARISTA09T0 + + + + 64010 + ARISTA10T0 + + + + 64011 + ARISTA11T0 + + + + 64012 + ARISTA12T0 + + + + 64013 + ARISTA13T0 + + + + 64014 + ARISTA14T0 + + + + 64015 + ARISTA15T0 + + + + 64016 + ARISTA16T0 + + + + 64017 + ARISTA17T0 + + + + 64018 + ARISTA18T0 + + + + 64019 + ARISTA19T0 + + + + 64020 + ARISTA20T0 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + + HostIP + eth0 + + 10.64.246.78/23 + + 10.64.246.78/23 + + + V6HostIP + eth0 + + FC00:2::32/64 + + FC00:2::32/64 + + + + + + + str-7260cx3-acs-7 + + + PortChannel101 + Ethernet35/1 + + + + PortChannel102 + Ethernet1/1;Ethernet2/1 + + + + PortChannel103 + Ethernet37/1 + + + + PortChannel104 + Ethernet38/1 + + + + PortChannel105 + Ethernet5/1;Ethernet6/1 + + + + PortChannel106 + Ethernet39/1 + + + + PortChannel107 + Ethernet40/1 + + + + PortChannel108 + Ethernet17/1;Ethernet18/1 + + + + PortChannel109 + Ethernet43/1 + + + + PortChannel1010 + Ethernet45/1 + + + + PortChannel1011 + Ethernet21/1;Ethernet22/1 + + + + PortChannel1012 + Ethernet46/1 + + + + PortChannel1013 + Ethernet47/1 + + + + PortChannel1014 + Ethernet48/1 + + + + PortChannel1015 + Ethernet51/1 + + + + PortChannel1016 + Ethernet53/1 + + + + PortChannel1017 + Ethernet54/1 + + + + PortChannel1018 + Ethernet55/1 + + + + PortChannel1019 + Ethernet56/1 + + + + PortChannel1020 + Ethernet59/1 + + + + PortChannel1021 + Ethernet61/1 + + + + PortChannel1022 + Ethernet62/1 + + + + PortChannel1023 + Ethernet63/1 + + + + PortChannel1024 + Ethernet64/1 + + + + + + + + + PortChannel101 + 10.0.0.32/31 + + + + PortChannel101 + FC00::41/126 + + + + PortChannel102 + 10.0.0.0/31 + + + + PortChannel102 + FC00::1/126 + + + + PortChannel103 + 10.0.0.34/31 + + + + PortChannel103 + FC00::45/126 + + + + PortChannel104 + 10.0.0.36/31 + + + + PortChannel104 + FC00::49/126 + + + + PortChannel105 + 10.0.0.4/31 + + + + PortChannel105 + FC00::5/126 + + + + PortChannel106 + 10.0.0.38/31 + + + + PortChannel106 + FC00::4D/126 + + + + PortChannel107 + 10.0.0.40/31 + + + + PortChannel107 + FC00::51/126 + + + + PortChannel108 + 10.0.0.8/31 + + + + PortChannel108 + FC00::9/126 + + + + PortChannel109 + 10.0.0.42/31 + + + + PortChannel109 + FC00::55/126 + + + + PortChannel1010 + 10.0.0.44/31 + + + + PortChannel1010 + FC00::59/126 + + + + PortChannel1011 + 10.0.0.12/31 + + + + PortChannel1011 + FC00::D/126 + + + + PortChannel1012 + 10.0.0.46/31 + + + + PortChannel1012 + FC00::5D/126 + + + + PortChannel1013 + 10.0.0.48/31 + + + + PortChannel1013 + FC00::61/126 + + + + PortChannel1014 + 10.0.0.50/31 + + + + PortChannel1014 + FC00::65/126 + + + + PortChannel1015 + 10.0.0.52/31 + + + + PortChannel1015 + FC00::69/126 + + + + PortChannel1016 + 10.0.0.54/31 + + + + PortChannel1016 + FC00::6D/126 + + + + PortChannel1017 + 10.0.0.56/31 + + + + PortChannel1017 + FC00::71/126 + + + + PortChannel1018 + 10.0.0.58/31 + + + + PortChannel1018 + FC00::75/126 + + + + PortChannel1019 + 10.0.0.60/31 + + + + PortChannel1019 + FC00::79/126 + + + + PortChannel1020 + 10.0.0.62/31 + + + + PortChannel1020 + FC00::7D/126 + + + + PortChannel1021 + 10.0.0.64/31 + + + + PortChannel1021 + FC00::81/126 + + + + PortChannel1022 + 10.0.0.66/31 + + + + PortChannel1022 + FC00::85/126 + + + + PortChannel1023 + 10.0.0.68/31 + + + + PortChannel1023 + FC00::89/126 + + + + PortChannel1024 + 10.0.0.70/31 + + + + PortChannel1024 + FC00::8D/126 + + + + + + NTP_ACL + NTP + NTP + + + SNMP_ACL + SNMP + SNMP + + + ERSPAN + Everflow + Everflow + + + ERSPANV6 + EverflowV6 + EverflowV6 + + + VTY_LINE + ssh-only + SSH + + + PortChannel101;PortChannel102;PortChannel103;PortChannel104;PortChannel105;PortChannel106;PortChannel107;PortChannel108;PortChannel109;PortChannel1010;PortChannel1011;PortChannel1012;PortChannel1013;PortChannel1014;PortChannel1015;PortChannel1016;PortChannel1017;PortChannel1018;PortChannel1019;PortChannel1020;PortChannel1021;PortChannel1022;PortChannel1023;PortChannel1024 + DataAcl + DataPlane + + + + + + + + + + DeviceInterfaceLink + ARISTA01T0 + Ethernet1 + str-7260cx3-acs-7 + Ethernet35/1 + + + DeviceInterfaceLink + ARISTA01T2 + Ethernet1 + str-7260cx3-acs-7 + Ethernet1/1 + + + DeviceInterfaceLink + ARISTA01T2 + Ethernet2 + str-7260cx3-acs-7 + Ethernet2/1 + + + DeviceInterfaceLink + ARISTA02T0 + Ethernet1 + str-7260cx3-acs-7 + Ethernet37/1 + + + DeviceInterfaceLink + ARISTA03T0 + Ethernet1 + str-7260cx3-acs-7 + Ethernet38/1 + + + DeviceInterfaceLink + ARISTA03T2 + Ethernet1 + str-7260cx3-acs-7 + Ethernet5/1 + + + DeviceInterfaceLink + ARISTA03T2 + Ethernet2 + str-7260cx3-acs-7 + Ethernet6/1 + + + DeviceInterfaceLink + ARISTA04T0 + Ethernet1 + str-7260cx3-acs-7 + Ethernet39/1 + + + DeviceInterfaceLink + ARISTA05T0 + Ethernet1 + str-7260cx3-acs-7 + Ethernet40/1 + + + DeviceInterfaceLink + ARISTA05T2 + Ethernet1 + str-7260cx3-acs-7 + Ethernet17/1 + + + DeviceInterfaceLink + ARISTA05T2 + Ethernet2 + str-7260cx3-acs-7 + Ethernet18/1 + + + DeviceInterfaceLink + ARISTA06T0 + Ethernet1 + str-7260cx3-acs-7 + Ethernet43/1 + + + DeviceInterfaceLink + ARISTA07T0 + Ethernet1 + str-7260cx3-acs-7 + Ethernet45/1 + + + DeviceInterfaceLink + ARISTA07T2 + Ethernet1 + str-7260cx3-acs-7 + Ethernet21/1 + + + DeviceInterfaceLink + ARISTA07T2 + Ethernet2 + str-7260cx3-acs-7 + Ethernet22/1 + + + DeviceInterfaceLink + ARISTA08T0 + Ethernet1 + str-7260cx3-acs-7 + Ethernet46/1 + + + DeviceInterfaceLink + ARISTA09T0 + Ethernet1 + str-7260cx3-acs-7 + Ethernet47/1 + + + DeviceInterfaceLink + ARISTA10T0 + Ethernet1 + str-7260cx3-acs-7 + Ethernet48/1 + + + DeviceInterfaceLink + ARISTA11T0 + Ethernet1 + str-7260cx3-acs-7 + Ethernet51/1 + + + DeviceInterfaceLink + ARISTA12T0 + Ethernet1 + str-7260cx3-acs-7 + Ethernet53/1 + + + DeviceInterfaceLink + ARISTA13T0 + Ethernet1 + str-7260cx3-acs-7 + Ethernet54/1 + + + DeviceInterfaceLink + ARISTA14T0 + Ethernet1 + str-7260cx3-acs-7 + Ethernet55/1 + + + DeviceInterfaceLink + ARISTA15T0 + Ethernet1 + str-7260cx3-acs-7 + Ethernet56/1 + + + DeviceInterfaceLink + ARISTA16T0 + Ethernet1 + str-7260cx3-acs-7 + Ethernet59/1 + + + DeviceInterfaceLink + ARISTA17T0 + Ethernet1 + str-7260cx3-acs-7 + Ethernet61/1 + + + DeviceInterfaceLink + ARISTA18T0 + Ethernet1 + str-7260cx3-acs-7 + Ethernet62/1 + + + DeviceInterfaceLink + ARISTA19T0 + Ethernet1 + str-7260cx3-acs-7 + Ethernet63/1 + + + DeviceInterfaceLink + ARISTA20T0 + Ethernet1 + str-7260cx3-acs-7 + Ethernet64/1 + + + + + str-7260cx3-acs-7 + Arista-7260CX3-C64 + + 10.64.246.78 + + + + ARISTA16T0 + + 172.16.141.95 + + Arista-VM + + + ARISTA11T0 + + 172.16.141.90 + + Arista-VM + + + ARISTA10T0 + + 172.16.141.89 + + Arista-VM + + + ARISTA17T0 + + 172.16.141.96 + + Arista-VM + + + ARISTA09T0 + + 172.16.141.88 + + Arista-VM + + + ARISTA20T0 + + 172.16.141.99 + + Arista-VM + + + ARISTA08T0 + + 172.16.141.87 + + Arista-VM + + + ARISTA07T0 + + 172.16.141.86 + + Arista-VM + + + ARISTA07T2 + + 172.16.141.79 + + Arista-VM + + + ARISTA01T2 + + 172.16.141.76 + + Arista-VM + + + ARISTA01T0 + + 172.16.141.80 + + Arista-VM + + + ARISTA05T2 + + 172.16.141.78 + + Arista-VM + + + ARISTA05T0 + + 172.16.141.84 + + Arista-VM + + + ARISTA02T0 + + 172.16.141.81 + + Arista-VM + + + ARISTA03T0 + + 172.16.141.82 + + Arista-VM + + + ARISTA03T2 + + 172.16.141.77 + + Arista-VM + + + ARISTA04T0 + + 172.16.141.83 + + Arista-VM + + + ARISTA18T0 + + 172.16.141.97 + + Arista-VM + + + ARISTA15T0 + + 172.16.141.94 + + Arista-VM + + + ARISTA19T0 + + 172.16.141.98 + + Arista-VM + + + ARISTA14T0 + + 172.16.141.93 + + Arista-VM + + + ARISTA12T0 + + 172.16.141.91 + + Arista-VM + + + ARISTA13T0 + + 172.16.141.92 + + Arista-VM + + + ARISTA06T0 + + 172.16.141.85 + + Arista-VM + + + + + + true + + + DeviceInterface + + true + true + 1 + Ethernet1/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet2/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet3/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet4/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet5/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet6/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet7/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet8/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet9/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet10/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet11/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet12/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet13/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet14/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet15/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet16/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet17/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet18/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet19/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet20/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet21/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet22/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet23/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet24/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet25/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet26/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet27/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet28/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet29/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet30/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet31/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet32/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet33/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet34/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet35/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet36/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet37/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet38/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet39/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet40/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet41/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet42/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet43/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet44/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet45/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet46/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet47/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet48/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet49/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet50/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet51/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet52/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet53/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet54/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet55/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet56/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet57/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet58/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet59/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet60/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet61/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet62/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet63/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet64/1 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet65 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + true + 1 + Ethernet66 + + false + 0 + 0 + 10000 + + + true + 0 + Arista-7260CX3-C64 + + + + + + + str-7260cx3-acs-7 + + + DeploymentId + + 1 + + + QosProfile + + Profile0 + + + DhcpResources + + 192.0.0.1;192.0.0.2;192.0.0.3;192.0.0.4;192.0.0.5;192.0.0.6;192.0.0.7;192.0.0.8;192.0.0.9;192.0.0.10;192.0.0.11;192.0.0.12;192.0.0.13;192.0.0.14;192.0.0.15;192.0.0.16;192.0.0.17;192.0.0.18;192.0.0.19;192.0.0.20;192.0.0.21;192.0.0.22;192.0.0.23;192.0.0.24;192.0.0.25;192.0.0.26;192.0.0.27;192.0.0.28;192.0.0.29;192.0.0.30;192.0.0.31;192.0.0.32;192.0.0.33;192.0.0.34;192.0.0.35;192.0.0.36;192.0.0.37;192.0.0.38;192.0.0.39;192.0.0.40;192.0.0.41;192.0.0.42;192.0.0.43;192.0.0.44;192.0.0.45;192.0.0.46;192.0.0.47;192.0.0.48 + + + NtpResources + + 10.20.8.129;10.20.8.130 + + + SnmpResources + + 10.3.145.98 + + + SyslogResources + + 10.64.246.95 + + + TacacsGroup + + Starlab + + + TacacsServer + + 100.127.20.21 + + + ForcedMgmtRoutes + + 10.3.145.98/31;10.3.145.8;100.127.20.16/28;10.3.149.170/31;40.122.216.24;13.91.48.226;10.3.145.14;10.64.246.0/24;10.64.247.0/24;10.64.5.5 + + + ErspanDestinationIpv4 + + 10.20.6.16 + + + + + + + str-7260cx3-acs-7 + Arista-7260CX3-C64 +
diff --git a/src/sonic-config-engine/tests/sample-arista-7800r3-48cq2-lc-t2-minigraph.xml b/src/sonic-config-engine/tests/sample-arista-7800r3-48cq2-lc-t2-minigraph.xml new file mode 100644 index 000000000000..f2332c5cacd5 --- /dev/null +++ b/src/sonic-config-engine/tests/sample-arista-7800r3-48cq2-lc-t2-minigraph.xml @@ -0,0 +1,2786 @@ + + + + + + dut-lc4 + 1.1.1.3 + dut-lc3 + 1.1.1.1 + true + + + dut-lc5 + 1.1.1.5 + dut-lc3 + 1.1.1.1 + true + + + + + 65001 + dut-lc4 + + + + + + 65001 + dut-lc5 + + + + + + 65001 + dut-lc3 + + +
1.1.1.1
+ + +
+ +
1.1.1.1
+ + +
+
+ +
+
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.1/32 + + 10.1.0.1/32 + + + HostIP + Loopback0 + + FC00:10::1/128 + + FC00:10::1/128 + + + + + ManagementIP1 + eth0 + 10.240.76.57/25 + + + ManagementIP2 + eth0 + fdfd:5c41:712d:e049::af0:4c39/64 + + + + + Ethernet-IB0 + port + 1.1.1.1/32 + + + Ethernet-IB0 + port + fc00:3000::1/128 + + + + + + dut-lc3 + + + + + + + IPInterface + + Ethernet1/1 + 10.0.0.2/31 + + + IPInterface + + Ethernet10/1 + 10.0.0.4/31 + + + IPInterface + + Ethernet11/1 + 10.0.0.6/31 + + + IPInterface + + Ethernet12/1 + 10.0.0.8/31 + + + IPInterface + + Ethernet13/1 + 10.0.0.10/31 + + + IPInterface + + Ethernet14/1 + 10.0.0.12/31 + + + IPInterface + + Ethernet15/1 + 10.0.0.14/31 + + + IPInterface + + Ethernet16/1 + 10.0.0.16/31 + + + IPInterface + + Ethernet17/1 + 10.0.0.18/31 + + + IPInterface + + Ethernet18/1 + 10.0.0.20/31 + + + IPInterface + + Ethernet19/1 + 10.0.0.22/31 + + + IPInterface + + Ethernet2/1 + 10.0.0.24/31 + + + IPInterface + + Ethernet20/1 + 10.0.0.26/31 + + + IPInterface + + Ethernet21/1 + 10.0.0.28/31 + + + IPInterface + + Ethernet22/1 + 10.0.0.30/31 + + + IPInterface + + Ethernet23/1 + 10.0.0.32/31 + + + IPInterface + + Ethernet24/1 + 10.0.0.34/31 + + + IPInterface + + Ethernet25/1 + 10.0.0.36/31 + + + IPInterface + + Ethernet26/1 + 10.0.0.38/31 + + + IPInterface + + Ethernet27/1 + 10.0.0.40/31 + + + IPInterface + + Ethernet28/1 + 10.0.0.42/31 + + + IPInterface + + Ethernet29/1 + 10.0.0.44/31 + + + IPInterface + + Ethernet3/1 + 10.0.0.46/31 + + + IPInterface + + Ethernet30/1 + 10.0.0.48/31 + + + IPInterface + + Ethernet31/1 + 10.0.0.50/31 + + + IPInterface + + Ethernet32/1 + 10.0.0.52/31 + + + IPInterface + + Ethernet33/1 + 10.0.0.54/31 + + + IPInterface + + Ethernet34/1 + 10.0.0.56/31 + + + IPInterface + + Ethernet35/1 + 10.0.0.58/31 + + + IPInterface + + Ethernet36/1 + 10.0.0.60/31 + + + IPInterface + + Ethernet37/1 + 10.0.0.62/31 + + + IPInterface + + Ethernet38/1 + 10.0.0.64/31 + + + IPInterface + + Ethernet39/1 + 10.0.0.66/31 + + + IPInterface + + Ethernet4/1 + 10.0.0.68/31 + + + IPInterface + + Ethernet40/1 + 10.0.0.70/31 + + + IPInterface + + Ethernet42/1 + 10.0.0.72/31 + + + IPInterface + + Ethernet45/1 + 10.0.0.74/31 + + + IPInterface + + Ethernet46/1 + 10.0.0.76/31 + + + IPInterface + + Ethernet47/1 + 10.0.0.78/31 + + + IPInterface + + Ethernet48/1 + 10.0.0.80/31 + + + IPInterface + + Ethernet5/1 + 10.0.0.82/31 + + + IPInterface + + Ethernet6/1 + 10.0.0.84/31 + + + IPInterface + + Ethernet7/1 + 10.0.0.86/31 + + + IPInterface + + Ethernet8/1 + 10.0.0.88/31 + + + IPInterface + + Ethernet9/1 + 10.0.0.90/31 + + + IPInterface + + Ethernet-Rec0 + 10.0.0.92/31 + + + IPInterface + + Ethernet-IB0 + 1.1.1.1/32 + + + + + + + + + + + + DeviceInterfaceLink + 100000 + nvm473 + Ethernet180 + dut-lc3 + Ethernet0 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet20 + dut-lc3 + Ethernet36 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet24 + dut-lc3 + Ethernet40 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet28 + dut-lc3 + Ethernet44 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet32 + dut-lc3 + Ethernet48 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet40 + dut-lc3 + Ethernet52 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet36 + dut-lc3 + Ethernet56 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet44 + dut-lc3 + Ethernet60 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet132 + dut-lc3 + Ethernet64 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet128 + dut-lc3 + Ethernet68 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet136 + dut-lc3 + Ethernet72 + + + DeviceInterfaceLink + 100000 + nvm473 + Ethernet176 + dut-lc3 + Ethernet4 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet140 + dut-lc3 + Ethernet76 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet144 + dut-lc3 + Ethernet80 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet148 + dut-lc3 + Ethernet84 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet152 + dut-lc3 + Ethernet88 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet156 + dut-lc3 + Ethernet92 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet64 + dut-lc3 + Ethernet96 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet68 + dut-lc3 + Ethernet100 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet72 + dut-lc3 + Ethernet104 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet76 + dut-lc3 + Ethernet108 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet80 + dut-lc3 + Ethernet112 + + + DeviceInterfaceLink + 100000 + nvm473 + Ethernet188 + dut-lc3 + Ethernet8 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet84 + dut-lc3 + Ethernet116 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet88 + dut-lc3 + Ethernet120 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet92 + dut-lc3 + Ethernet124 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet96 + dut-lc3 + Ethernet128 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet100 + dut-lc3 + Ethernet132 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet104 + dut-lc3 + Ethernet136 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet108 + dut-lc3 + Ethernet140 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet240 + dut-lc3 + Ethernet144 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet244 + dut-lc3 + Ethernet148 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet248 + dut-lc3 + Ethernet152 + + + DeviceInterfaceLink + 100000 + nvm473 + Ethernet184 + dut-lc3 + Ethernet12 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet252 + dut-lc3 + Ethernet156 + + + DeviceInterfaceLink + 100000 + nvm473 + Ethernet192 + dut-lc3 + Ethernet164 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet112 + dut-lc3 + Ethernet176 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet116 + dut-lc3 + Ethernet180 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet120 + dut-lc3 + Ethernet184 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet124 + dut-lc3 + Ethernet188 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet0 + dut-lc3 + Ethernet16 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet4 + dut-lc3 + Ethernet20 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet8 + dut-lc3 + Ethernet24 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet12 + dut-lc3 + Ethernet28 + + + DeviceInterfaceLink + 100000 + nv338 + Ethernet16 + dut-lc3 + Ethernet32 + + + + + dut-lc3 + Arista-7800R3-48CQ2-C48 + + + + + + + dut-lc3 + + + ForcedMgmtRoutes + + 172.16.0.0/12;10.80.0.0/12;10.64.0.0/14;10.240.0.0/13 + + ForcedMgmtRoutes + + FD7A:629F:52A4::/48;FDFD:5C41:712D::/48 + + + SwitchId + + 0 + + + NtpResources + time.aristanetworks.com + + + SwitchType + + voq + + + MaxCores + + 16 + + + SubRole + + + + + + + + + + + Arista-7800R3-48CQ2-C48 + + + Ethernet1/1 + eth1/1-connected-to-nvm473@eth46/1 + 100000 + rs + + + Ethernet10/1 + eth10/1-connected-to-nv338@eth6/1 + 100000 + rs + + + Ethernet11/1 + eth11/1-connected-to-nv338@eth7/1 + 100000 + rs + + + Ethernet12/1 + eth12/1-connected-to-nv338@eth8/1 + 100000 + rs + + + Ethernet13/1 + eth13/1-connected-to-nv338@eth9/1 + 100000 + rs + + + Ethernet14/1 + eth14/1-connected-to-nv338@eth11/1 + 100000 + rs + + + Ethernet15/1 + eth15/1-connected-to-nv338@eth10/1 + 100000 + rs + + + Ethernet16/1 + eth16/1-connected-to-nv338@eth12/1 + 100000 + rs + + + Ethernet17/1 + eth17/1-connected-to-nv338@eth34/1 + 100000 + rs + + + Ethernet18/1 + eth18/1-connected-to-nv338@eth33/1 + 100000 + rs + + + Ethernet19/1 + eth19/1-connected-to-nv338@eth35/1 + 100000 + rs + + + Ethernet2/1 + eth2/1-connected-to-nvm473@eth45/1 + 100000 + rs + + + Ethernet20/1 + eth20/1-connected-to-nv338@eth36/1 + 100000 + rs + + + Ethernet21/1 + eth21/1-connected-to-nv338@eth37/1 + 100000 + rs + + + Ethernet22/1 + eth22/1-connected-to-nv338@eth38/1 + 100000 + none + + + Ethernet23/1 + eth23/1-connected-to-nv338@eth39/1 + 100000 + none + + + Ethernet24/1 + eth24/1-connected-to-nv338@eth40/1 + 100000 + none + + + Ethernet25/1 + eth25/1-connected-to-nv338@eth17/1 + 100000 + none + + + Ethernet26/1 + eth26/1-connected-to-nv338@eth18/1 + 100000 + none + + + Ethernet27/1 + eth27/1-connected-to-nv338@eth19/1 + 100000 + none + + + Ethernet28/1 + eth28/1-connected-to-nv338@eth20/1 + 100000 + rs + + + Ethernet29/1 + eth29/1-connected-to-nv338@eth21/1 + 100000 + rs + + + Ethernet3/1 + eth3/1-connected-to-nvm473@eth48/1 + 100000 + rs + + + Ethernet30/1 + eth30/1-connected-to-nv338@eth22/1 + 100000 + rs + + + Ethernet31/1 + eth31/1-connected-to-nv338@eth23/1 + 100000 + rs + + + Ethernet32/1 + eth32/1-connected-to-nv338@eth24/1 + 100000 + rs + + + Ethernet33/1 + eth33/1-connected-to-nv338@eth25/1 + 100000 + rs + + + Ethernet34/1 + eth34/1-connected-to-nv338@eth26/1 + 100000 + rs + + + Ethernet35/1 + eth35/1-connected-to-nv338@eth27/1 + 100000 + rs + + + Ethernet36/1 + eth36/1-connected-to-nv338@eth28/1 + 100000 + rs + + + Ethernet37/1 + eth37/1-connected-to-nv338@eth61/1 + 100000 + rs + + + Ethernet38/1 + eth38/1-connected-to-nv338@eth62/1 + 100000 + rs + + + Ethernet39/1 + eth39/1-connected-to-nv338@eth63/1 + 100000 + rs + + + Ethernet4/1 + eth4/1-connected-to-nvm473@eth47/1 + 100000 + rs + + + Ethernet40/1 + eth40/1-connected-to-nv338@eth64/1 + 100000 + rs + + + Ethernet42/1 + eth42/1-connected-to-nvm473@eth49/1 + 100000 + rs + + + Ethernet45/1 + eth45/1-connected-to-nv338@eth29/1 + 100000 + rs + + + Ethernet46/1 + eth46/1-connected-to-nv338@eth30/1 + 100000 + rs + + + Ethernet47/1 + eth47/1-connected-to-nv338@eth31/1 + 100000 + rs + + + Ethernet48/1 + eth48/1-connected-to-nv338@eth32/1 + 100000 + rs + + + Ethernet5/1 + eth5/1-connected-to-nv338@eth1/1 + 100000 + rs + + + Ethernet6/1 + eth6/1-connected-to-nv338@eth2/1 + 100000 + rs + + + Ethernet7/1 + eth7/1-connected-to-nv338@eth3/1 + 100000 + rs + + + Ethernet8/1 + eth8/1-connected-to-nv338@eth4/1 + 100000 + rs + + + Ethernet9/1 + eth9/1-connected-to-nv338@eth5/1 + 100000 + rs + + + + + eth0 + eth0 + 1000 + + + eth0 + eth0 + 1000 + + + + + Cpu0 + dut-lc3 + Asic0 + 10000 + 1 + 0 + 0 + 0 + 8 + + + Ethernet0 + dut-lc3 + Asic0 + 100000 + 2 + 0 + 0 + 1 + 8 + + + Ethernet4 + dut-lc3 + Asic0 + 100000 + 3 + 0 + 0 + 2 + 8 + + + Ethernet8 + dut-lc3 + Asic0 + 100000 + 4 + 0 + 0 + 3 + 8 + + + Ethernet12 + dut-lc3 + Asic0 + 100000 + 5 + 0 + 0 + 4 + 8 + + + Ethernet16 + dut-lc3 + Asic0 + 100000 + 6 + 0 + 0 + 5 + 8 + + + Ethernet20 + dut-lc3 + Asic0 + 100000 + 7 + 0 + 0 + 6 + 8 + + + Ethernet24 + dut-lc3 + Asic0 + 100000 + 8 + 0 + 0 + 7 + 8 + + + Ethernet28 + dut-lc3 + Asic0 + 100000 + 9 + 0 + 0 + 8 + 8 + + + Ethernet32 + dut-lc3 + Asic0 + 100000 + 10 + 0 + 0 + 9 + 8 + + + Ethernet36 + dut-lc3 + Asic0 + 100000 + 11 + 0 + 0 + 10 + 8 + + + Ethernet40 + dut-lc3 + Asic0 + 100000 + 12 + 0 + 0 + 11 + 8 + + + Ethernet44 + dut-lc3 + Asic0 + 100000 + 13 + 0 + 0 + 12 + 8 + + + Ethernet48 + dut-lc3 + Asic0 + 100000 + 14 + 0 + 0 + 13 + 8 + + + Ethernet52 + dut-lc3 + Asic0 + 100000 + 15 + 0 + 0 + 14 + 8 + + + Ethernet56 + dut-lc3 + Asic0 + 100000 + 16 + 0 + 0 + 15 + 8 + + + Ethernet60 + dut-lc3 + Asic0 + 100000 + 17 + 0 + 0 + 16 + 8 + + + Ethernet64 + dut-lc3 + Asic0 + 100000 + 18 + 0 + 0 + 17 + 8 + + + Ethernet68 + dut-lc3 + Asic0 + 100000 + 19 + 0 + 0 + 18 + 8 + + + Ethernet72 + dut-lc3 + Asic0 + 100000 + 20 + 0 + 0 + 19 + 8 + + + Ethernet76 + dut-lc3 + Asic0 + 100000 + 21 + 0 + 0 + 20 + 8 + + + Ethernet80 + dut-lc3 + Asic0 + 100000 + 22 + 0 + 0 + 21 + 8 + + + Ethernet84 + dut-lc3 + Asic0 + 100000 + 23 + 0 + 0 + 22 + 8 + + + Ethernet88 + dut-lc3 + Asic0 + 100000 + 24 + 0 + 0 + 23 + 8 + + + Ethernet92 + dut-lc3 + Asic0 + 100000 + 25 + 0 + 0 + 24 + 8 + + + Ethernet96 + dut-lc3 + Asic0 + 100000 + 26 + 0 + 1 + 25 + 8 + + + Ethernet100 + dut-lc3 + Asic0 + 100000 + 27 + 0 + 1 + 26 + 8 + + + Ethernet104 + dut-lc3 + Asic0 + 100000 + 28 + 0 + 1 + 27 + 8 + + + Ethernet108 + dut-lc3 + Asic0 + 100000 + 29 + 0 + 1 + 28 + 8 + + + Ethernet112 + dut-lc3 + Asic0 + 100000 + 30 + 0 + 1 + 29 + 8 + + + Ethernet116 + dut-lc3 + Asic0 + 100000 + 31 + 0 + 1 + 30 + 8 + + + Ethernet120 + dut-lc3 + Asic0 + 100000 + 32 + 0 + 1 + 31 + 8 + + + Ethernet124 + dut-lc3 + Asic0 + 100000 + 33 + 0 + 1 + 32 + 8 + + + Ethernet128 + dut-lc3 + Asic0 + 100000 + 34 + 0 + 1 + 33 + 8 + + + Ethernet132 + dut-lc3 + Asic0 + 100000 + 35 + 0 + 1 + 34 + 8 + + + Ethernet136 + dut-lc3 + Asic0 + 100000 + 36 + 0 + 1 + 35 + 8 + + + Ethernet140 + dut-lc3 + Asic0 + 100000 + 37 + 0 + 1 + 36 + 8 + + + Ethernet144 + dut-lc3 + Asic0 + 100000 + 38 + 0 + 1 + 37 + 8 + + + Ethernet148 + dut-lc3 + Asic0 + 100000 + 39 + 0 + 1 + 38 + 8 + + + Ethernet152 + dut-lc3 + Asic0 + 100000 + 40 + 0 + 1 + 39 + 8 + + + Ethernet156 + dut-lc3 + Asic0 + 100000 + 41 + 0 + 1 + 40 + 8 + + + Ethernet160 + dut-lc3 + Asic0 + 100000 + 42 + 0 + 1 + 41 + 8 + + + Ethernet164 + dut-lc3 + Asic0 + 100000 + 43 + 0 + 1 + 42 + 8 + + + Ethernet168 + dut-lc3 + Asic0 + 100000 + 44 + 0 + 1 + 43 + 8 + + + Ethernet172 + dut-lc3 + Asic0 + 100000 + 45 + 0 + 1 + 44 + 8 + + + Ethernet176 + dut-lc3 + Asic0 + 100000 + 46 + 0 + 1 + 45 + 8 + + + Ethernet180 + dut-lc3 + Asic0 + 100000 + 47 + 0 + 1 + 46 + 8 + + + Ethernet184 + dut-lc3 + Asic0 + 100000 + 48 + 0 + 1 + 47 + 8 + + + Ethernet188 + dut-lc3 + Asic0 + 100000 + 49 + 0 + 1 + 48 + 8 + + + Ethernet-Rec0 + dut-lc3 + Asic0 + 400000 + 50 + 0 + 0 + 221 + 8 + + + Ethernet-IB0 + dut-lc3 + Asic0 + 400000 + 51 + 0 + 1 + 222 + 8 + + + Cpu0 + dut-lc4 + Asic0 + 10000 + 52 + 2 + 0 + 0 + 8 + + + Ethernet0 + dut-lc4 + Asic0 + 100000 + 53 + 2 + 0 + 1 + 8 + + + Ethernet4 + dut-lc4 + Asic0 + 100000 + 54 + 2 + 0 + 2 + 8 + + + Ethernet8 + dut-lc4 + Asic0 + 100000 + 55 + 2 + 0 + 3 + 8 + + + Ethernet12 + dut-lc4 + Asic0 + 100000 + 56 + 2 + 0 + 4 + 8 + + + Ethernet16 + dut-lc4 + Asic0 + 100000 + 57 + 2 + 0 + 5 + 8 + + + Ethernet20 + dut-lc4 + Asic0 + 100000 + 58 + 2 + 0 + 6 + 8 + + + Ethernet24 + dut-lc4 + Asic0 + 100000 + 59 + 2 + 0 + 7 + 8 + + + Ethernet28 + dut-lc4 + Asic0 + 100000 + 60 + 2 + 0 + 8 + 8 + + + Ethernet32 + dut-lc4 + Asic0 + 100000 + 61 + 2 + 0 + 9 + 8 + + + Ethernet36 + dut-lc4 + Asic0 + 100000 + 62 + 2 + 0 + 10 + 8 + + + Ethernet40 + dut-lc4 + Asic0 + 100000 + 63 + 2 + 0 + 11 + 8 + + + Ethernet44 + dut-lc4 + Asic0 + 100000 + 64 + 2 + 0 + 12 + 8 + + + Ethernet48 + dut-lc4 + Asic0 + 100000 + 65 + 2 + 0 + 13 + 8 + + + Ethernet52 + dut-lc4 + Asic0 + 100000 + 66 + 2 + 0 + 14 + 8 + + + Ethernet56 + dut-lc4 + Asic0 + 100000 + 67 + 2 + 0 + 15 + 8 + + + Ethernet60 + dut-lc4 + Asic0 + 100000 + 68 + 2 + 0 + 16 + 8 + + + Ethernet64 + dut-lc4 + Asic0 + 100000 + 69 + 2 + 0 + 17 + 8 + + + Ethernet68 + dut-lc4 + Asic0 + 100000 + 70 + 2 + 0 + 18 + 8 + + + Ethernet72 + dut-lc4 + Asic0 + 100000 + 71 + 2 + 0 + 19 + 8 + + + Ethernet76 + dut-lc4 + Asic0 + 100000 + 72 + 2 + 0 + 20 + 8 + + + Ethernet80 + dut-lc4 + Asic0 + 100000 + 73 + 2 + 0 + 21 + 8 + + + Ethernet84 + dut-lc4 + Asic0 + 100000 + 74 + 2 + 0 + 22 + 8 + + + Ethernet88 + dut-lc4 + Asic0 + 100000 + 75 + 2 + 0 + 23 + 8 + + + Ethernet92 + dut-lc4 + Asic0 + 100000 + 76 + 2 + 0 + 24 + 8 + + + Ethernet96 + dut-lc4 + Asic0 + 100000 + 77 + 2 + 1 + 25 + 8 + + + Ethernet100 + dut-lc4 + Asic0 + 100000 + 78 + 2 + 1 + 26 + 8 + + + Ethernet104 + dut-lc4 + Asic0 + 100000 + 79 + 2 + 1 + 27 + 8 + + + Ethernet108 + dut-lc4 + Asic0 + 100000 + 80 + 2 + 1 + 28 + 8 + + + Ethernet112 + dut-lc4 + Asic0 + 100000 + 81 + 2 + 1 + 29 + 8 + + + Ethernet116 + dut-lc4 + Asic0 + 100000 + 82 + 2 + 1 + 30 + 8 + + + Ethernet120 + dut-lc4 + Asic0 + 100000 + 83 + 2 + 1 + 31 + 8 + + + Ethernet124 + dut-lc4 + Asic0 + 100000 + 84 + 2 + 1 + 32 + 8 + + + Ethernet128 + dut-lc4 + Asic0 + 100000 + 85 + 2 + 1 + 33 + 8 + + + Ethernet132 + dut-lc4 + Asic0 + 100000 + 86 + 2 + 1 + 34 + 8 + + + Ethernet136 + dut-lc4 + Asic0 + 100000 + 87 + 2 + 1 + 35 + 8 + + + Ethernet140 + dut-lc4 + Asic0 + 100000 + 88 + 2 + 1 + 36 + 8 + + + Ethernet144 + dut-lc4 + Asic0 + 100000 + 89 + 2 + 1 + 37 + 8 + + + Ethernet148 + dut-lc4 + Asic0 + 100000 + 90 + 2 + 1 + 38 + 8 + + + Ethernet152 + dut-lc4 + Asic0 + 100000 + 91 + 2 + 1 + 39 + 8 + + + Ethernet156 + dut-lc4 + Asic0 + 100000 + 92 + 2 + 1 + 40 + 8 + + + Ethernet160 + dut-lc4 + Asic0 + 100000 + 93 + 2 + 1 + 41 + 8 + + + Ethernet164 + dut-lc4 + Asic0 + 100000 + 94 + 2 + 1 + 42 + 8 + + + Ethernet168 + dut-lc4 + Asic0 + 100000 + 95 + 2 + 1 + 43 + 8 + + + Ethernet172 + dut-lc4 + Asic0 + 100000 + 96 + 2 + 1 + 44 + 8 + + + Ethernet176 + dut-lc4 + Asic0 + 100000 + 97 + 2 + 1 + 45 + 8 + + + Ethernet180 + dut-lc4 + Asic0 + 100000 + 98 + 2 + 1 + 46 + 8 + + + Ethernet184 + dut-lc4 + Asic0 + 100000 + 99 + 2 + 1 + 47 + 8 + + + Ethernet188 + dut-lc4 + Asic0 + 100000 + 100 + 2 + 1 + 48 + 8 + + + Ethernet-Rec0 + dut-lc4 + Asic0 + 400000 + 101 + 2 + 0 + 221 + 8 + + + Ethernet-IB0 + dut-lc4 + Asic0 + 400000 + 102 + 2 + 1 + 222 + 8 + + + Cpu0 + dut-lc5 + Asic0 + 10000 + 103 + 4 + 0 + 0 + 8 + + + Ethernet0 + dut-lc5 + Asic0 + 100000 + 104 + 4 + 0 + 1 + 8 + + + Ethernet4 + dut-lc5 + Asic0 + 100000 + 105 + 4 + 0 + 2 + 8 + + + Ethernet8 + dut-lc5 + Asic0 + 100000 + 106 + 4 + 0 + 3 + 8 + + + Ethernet12 + dut-lc5 + Asic0 + 100000 + 107 + 4 + 0 + 4 + 8 + + + Ethernet16 + dut-lc5 + Asic0 + 100000 + 108 + 4 + 0 + 5 + 8 + + + Ethernet20 + dut-lc5 + Asic0 + 100000 + 109 + 4 + 0 + 6 + 8 + + + Ethernet24 + dut-lc5 + Asic0 + 100000 + 110 + 4 + 0 + 7 + 8 + + + Ethernet28 + dut-lc5 + Asic0 + 100000 + 111 + 4 + 0 + 8 + 8 + + + Ethernet32 + dut-lc5 + Asic0 + 100000 + 112 + 4 + 0 + 9 + 8 + + + Ethernet36 + dut-lc5 + Asic0 + 100000 + 113 + 4 + 0 + 10 + 8 + + + Ethernet40 + dut-lc5 + Asic0 + 100000 + 114 + 4 + 0 + 11 + 8 + + + Ethernet44 + dut-lc5 + Asic0 + 100000 + 115 + 4 + 0 + 12 + 8 + + + Ethernet48 + dut-lc5 + Asic0 + 100000 + 116 + 4 + 0 + 13 + 8 + + + Ethernet52 + dut-lc5 + Asic0 + 100000 + 117 + 4 + 0 + 14 + 8 + + + Ethernet56 + dut-lc5 + Asic0 + 100000 + 118 + 4 + 0 + 15 + 8 + + + Ethernet60 + dut-lc5 + Asic0 + 100000 + 119 + 4 + 0 + 16 + 8 + + + Ethernet64 + dut-lc5 + Asic0 + 100000 + 120 + 4 + 0 + 17 + 8 + + + Ethernet68 + dut-lc5 + Asic0 + 100000 + 121 + 4 + 0 + 18 + 8 + + + Ethernet72 + dut-lc5 + Asic0 + 100000 + 122 + 4 + 0 + 19 + 8 + + + Ethernet76 + dut-lc5 + Asic0 + 100000 + 123 + 4 + 0 + 20 + 8 + + + Ethernet80 + dut-lc5 + Asic0 + 100000 + 124 + 4 + 0 + 21 + 8 + + + Ethernet84 + dut-lc5 + Asic0 + 100000 + 125 + 4 + 0 + 22 + 8 + + + Ethernet88 + dut-lc5 + Asic0 + 100000 + 126 + 4 + 0 + 23 + 8 + + + Ethernet92 + dut-lc5 + Asic0 + 100000 + 127 + 4 + 0 + 24 + 8 + + + Ethernet96 + dut-lc5 + Asic0 + 100000 + 128 + 4 + 1 + 25 + 8 + + + Ethernet100 + dut-lc5 + Asic0 + 100000 + 129 + 4 + 1 + 26 + 8 + + + Ethernet104 + dut-lc5 + Asic0 + 100000 + 130 + 4 + 1 + 27 + 8 + + + Ethernet108 + dut-lc5 + Asic0 + 100000 + 131 + 4 + 1 + 28 + 8 + + + Ethernet112 + dut-lc5 + Asic0 + 100000 + 132 + 4 + 1 + 29 + 8 + + + Ethernet116 + dut-lc5 + Asic0 + 100000 + 133 + 4 + 1 + 30 + 8 + + + Ethernet120 + dut-lc5 + Asic0 + 100000 + 134 + 4 + 1 + 31 + 8 + + + Ethernet124 + dut-lc5 + Asic0 + 100000 + 135 + 4 + 1 + 32 + 8 + + + Ethernet128 + dut-lc5 + Asic0 + 100000 + 136 + 4 + 1 + 33 + 8 + + + Ethernet132 + dut-lc5 + Asic0 + 100000 + 137 + 4 + 1 + 34 + 8 + + + Ethernet136 + dut-lc5 + Asic0 + 100000 + 138 + 4 + 1 + 35 + 8 + + + Ethernet140 + dut-lc5 + Asic0 + 100000 + 139 + 4 + 1 + 36 + 8 + + + Ethernet144 + dut-lc5 + Asic0 + 100000 + 140 + 4 + 1 + 37 + 8 + + + Ethernet148 + dut-lc5 + Asic0 + 100000 + 141 + 4 + 1 + 38 + 8 + + + Ethernet152 + dut-lc5 + Asic0 + 100000 + 142 + 4 + 1 + 39 + 8 + + + Ethernet156 + dut-lc5 + Asic0 + 100000 + 143 + 4 + 1 + 40 + 8 + + + Ethernet160 + dut-lc5 + Asic0 + 100000 + 144 + 4 + 1 + 41 + 8 + + + Ethernet164 + dut-lc5 + Asic0 + 100000 + 145 + 4 + 1 + 42 + 8 + + + Ethernet168 + dut-lc5 + Asic0 + 100000 + 146 + 4 + 1 + 43 + 8 + + + Ethernet172 + dut-lc5 + Asic0 + 100000 + 147 + 4 + 1 + 44 + 8 + + + Ethernet176 + dut-lc5 + Asic0 + 100000 + 148 + 4 + 1 + 45 + 8 + + + Ethernet180 + dut-lc5 + Asic0 + 100000 + 149 + 4 + 1 + 46 + 8 + + + Ethernet184 + dut-lc5 + Asic0 + 100000 + 150 + 4 + 1 + 47 + 8 + + + Ethernet188 + dut-lc5 + Asic0 + 100000 + 151 + 4 + 1 + 48 + 8 + + + Ethernet-Rec0 + dut-lc5 + Asic0 + 400000 + 152 + 4 + 0 + 221 + 8 + + + Ethernet-IB0 + dut-lc5 + Asic0 + 400000 + 153 + 4 + 1 + 222 + 8 + + + + + dut-lc3 + Arista-7800R3-48CQ2-C48 +
diff --git a/src/sonic-config-engine/tests/sample-chassis-packet-lc-graph.xml b/src/sonic-config-engine/tests/sample-chassis-packet-lc-graph.xml new file mode 100644 index 000000000000..ac83d87b96ca --- /dev/null +++ b/src/sonic-config-engine/tests/sample-chassis-packet-lc-graph.xml @@ -0,0 +1,471 @@ + + + + + + false + str2-8808-lc2-1 + 27.1.1.1 + IXIA-EBGP + 27.1.1.2 + 1 + 10 + 3 + + + false + ASIC1 + 27.1.1.1 + IXIA-EBGP + 27.1.1.2 + 1 + 10 + 3 + + + ASIC1 + 8.0.0.3 + str2-8808-lc0-ASIC1 + 8.0.0.1 + 1 + 0 + 0 + chassis-packet + + + + + 65100 + str2-8808-lc2-1 + + +
27.1.1.2
+ + + +
+
+ +
+ + 69007 + IXIA-EBGP + + + + 65100 + str2-8808-lc0-ASIC1 + + + + 65100 + ASIC1 + + +
27.1.1.2
+ + + +
+ +
8.0.0.1
+ + + +
+
+ +
+
+
+ + + + + + HostIP + Loopback0 + + 10.0.1.6/32 + + 10.0.1.6/32 + + + + + HostIP + eth0 + + 10.3.147.97/23 + + 10.3.147.97/23 + + + + + + + str2-8808-lc2-1 + + + + + + Eth1/1/47 + 27.1.1.1/24 + + + + + + + IPNextHop + + 8.0.0.1/32 +
192.168.1.2,192.168.2.2
+ PortChannel40,PortChannel50 + StaticRoute + false +
+
+ + + + + +
+ + + + + HostIP + Loopback0 + + 10.0.1.6/32 + + 10.0.1.6/32 + + + HostIP1 + Loopback4096 + + 8.0.0.3/32 + + 8.0.0.3/32 + + + + + HostIP + eth0 + + 10.3.147.97/23 + + 10.3.147.97/23 + + + + + + + ASIC1 + + + PortChannel32 + Eth2504-ASIC1;Eth2508-ASIC1;Eth2510-ASIC1 + + + + PortChannel33 + Eth2320-ASIC1;Eth2502-ASIC1;Eth2506-ASIC1;Eth2518-ASIC1 + + + + + + + + + PortChannel32 + 2 + dot1q + 192.168.1.4/24 + + + + PortChannel33 + 2 + dot1q + 192.168.2.4/24 + 10 + + + + + + Eth1/1/47 + 27.1.1.1/24 + + + + + + + IPNextHop + + 8.0.0.1/32 +
192.168.1.2,192.168.2.2
+ PortChannel40,PortChannel50 + StaticRoute + false +
+
+
+
+ + + + DeviceInterfaceLink + IXIA-EBGP + Ethernet1 + str2-8808-lc2-1 + Eth1/1/47 + + + DeviceInterfaceLink + 100000 + true + str2-8808-sup + Ethernet1 + true + ASIC1 + Eth2502-ASIC1 + true + + + DeviceInterfaceLink + 100000 + true + str2-8808-sup + Ethernet2 + true + ASIC1 + Eth2504-ASIC1 + true + + + DeviceInterfaceLink + 100000 + true + str2-8808-sup + Ethernet3 + true + ASIC1 + Eth2506-ASIC1 + true + + + DeviceInterfaceLink + 100000 + true + str2-8808-sup + Ethernet4 + true + ASIC1 + Eth2508-ASIC1 + true + + + DeviceInterfaceLink + 100000 + true + str2-8808-sup + Ethernet5 + true + ASIC1 + Eth2510-ASIC1 + true + + + DeviceInterfaceLink + 100000 + true + str2-8808-sup + Ethernet6 + true + ASIC1 + Eth2516-ASIC1 + true + + + DeviceInterfaceLink + 100000 + true + str2-8808-sup + Ethernet7 + true + ASIC1 + Eth2320-ASIC1 + true + + + + + str2-8808-lc2-1 + 8800-LC-48H-O +
+ 10.0.1.6/32 +
+ + 10.3.147.97/23 + +
+ + IXIA-EBGP + IXIA +
+ 0.0.0.0/0 +
+ + 0.0.0.0/0 + +
+ + str2-8808-sup + 8800-RP-O +
+ 0.0.0.0/0 +
+ + 10.3.147.95/23 + +
+ + Asic +
+ 8.0.0.3/32 +
+ + + + + + + + + 0.0.0.0/0 + + + ASIC1 + 8800-LC-48H-O +
+
+
+ + + true + + + DeviceInterface + + true + true + 1 + Ethernet1/1/47 + + false + 47 + 0 + 100000 + Ethernet47 + + + true + 0 + 8800-LC-48H-O + + + + + + + str2-8808-lc2-1 + + + SwitchType + + chassis-packet + + + DeploymentId + + 1 + + + QosProfile + + Profile0 + + + DhcpResources + + 192.0.0.1;192.0.0.2;192.0.0.3;192.0.0.4;192.0.0.5;192.0.0.6;192.0.0.7;192.0.0.8;192.0.0.9;192.0.0.10;192.0.0.11;192.0.0.12;192.0.0.13;192.0.0.14;192.0.0.15;192.0.0.16;192.0.0.17;192.0.0.18;192.0.0.19;192.0.0.20;192.0.0.21;192.0.0.22;192.0.0.23;192.0.0.24;192.0.0.25;192.0.0.26;192.0.0.27;192.0.0.28;192.0.0.29;192.0.0.30;192.0.0.31;192.0.0.32;192.0.0.33;192.0.0.34;192.0.0.35;192.0.0.36;192.0.0.37;192.0.0.38;192.0.0.39;192.0.0.40;192.0.0.41;192.0.0.42;192.0.0.43;192.0.0.44;192.0.0.45;192.0.0.46;192.0.0.47;192.0.0.48 + + + NtpResources + + 10.20.8.129;10.20.8.130 + + + SnmpResources + + 10.3.145.98 + + + SyslogResources + + 10.3.145.8;100.127.20.21 + + + TacacsGroup + + Starlab + + + TacacsServer + + 100.127.20.21 + + + ForcedMgmtRoutes + + 10.3.145.98/31;10.3.145.8;100.127.20.16/28;10.3.149.170/31;40.122.216.24;13.91.48.226;10.3.145.14;10.64.246.0/24;10.3.146.0/23;10.64.5.5 + + + ErspanDestinationIpv4 + + 10.20.6.16 + + + + + ASIC1 + + + SubRole + + FrontEnd + + + SwitchType + + chassis-packet + + + + + + + str2-8808-lc2-1 + 8800-LC-48H-O +
diff --git a/src/sonic-config-engine/tests/sample-chassis-packet-lc-port-config.ini b/src/sonic-config-engine/tests/sample-chassis-packet-lc-port-config.ini new file mode 100644 index 000000000000..52cb3360a504 --- /dev/null +++ b/src/sonic-config-engine/tests/sample-chassis-packet-lc-port-config.ini @@ -0,0 +1,60 @@ +# name lanes alias index speed asic_port_name role +Ethernet13 1280,1281,1282,1283 Eth1/1/13 13 100000 Eth13-ASIC1 Ext +Ethernet14 1284,1285,1286,1287 Eth1/1/14 14 100000 Eth14-ASIC1 Ext +Ethernet16 1288,1289,1290,1291 Eth1/1/16 16 100000 Eth16-ASIC1 Ext +Ethernet17 1292,1293,1294,1295 Eth1/1/17 17 100000 Eth17-ASIC1 Ext +Ethernet19 1024,1025,1026,1027 Eth1/1/19 19 100000 Eth19-ASIC1 Ext +Ethernet20 1036,1037,1038,1039 Eth1/1/20 20 100000 Eth20-ASIC1 Ext +Ethernet22 1028,1029,1030,1031 Eth1/1/22 22 100000 Eth22-ASIC1 Ext +Ethernet23 1032,1033,1034,1035 Eth1/1/23 23 100000 Eth23-ASIC1 Ext +Ethernet25 768,769,770,771 Eth1/1/25 25 100000 Eth25-ASIC1 Ext +Ethernet26 772,773,774,775 Eth1/1/26 26 100000 Eth26-ASIC1 Ext +Ethernet28 776,777,778,779 Eth1/1/28 28 100000 Eth28-ASIC1 Ext +Ethernet29 780,781,782,783 Eth1/1/29 29 100000 Eth29-ASIC1 Ext +Ethernet31 512,513,514,515 Eth1/1/31 31 100000 Eth31-ASIC1 Ext +Ethernet32 516,517,518,519 Eth1/1/32 32 100000 Eth32-ASIC1 Ext +Ethernet34 520,521,522,523 Eth1/1/34 34 100000 Eth34-ASIC1 Ext +Ethernet35 524,525,526,527 Eth1/1/35 35 100000 Eth35-ASIC1 Ext +Ethernet37 256,257,258,259 Eth1/1/37 37 100000 Eth37-ASIC1 Ext +Ethernet38 260,261,262,263 Eth1/1/38 38 100000 Eth38-ASIC1 Ext +Ethernet40 268,269,270,271 Eth1/1/40 40 100000 Eth40-ASIC1 Ext +Ethernet41 264,265,266,267 Eth1/1/41 41 100000 Eth41-ASIC1 Ext +Ethernet43 12,13,14,15 Eth1/1/43 43 100000 Eth43-ASIC1 Ext +Ethernet44 8,9,10,11 Eth1/1/44 44 100000 Eth44-ASIC1 Ext +Ethernet46 4,5,6,7 Eth1/1/46 46 100000 Eth46-ASIC1 Ext +Ethernet47 0,1,2,3 Eth1/1/47 47 100000 Eth47-ASIC1 Ext +Ethernet2320 16,17 Eth2320-ASIC1 2320 100000 Eth2320-ASIC1 Int +Ethernet2452 2052,2053 Eth2452-ASIC1 2452 100000 Eth2452-ASIC1 Int +Ethernet2454 2054,2055 Eth2454-ASIC1 2454 100000 Eth2454-ASIC1 Int +Ethernet2456 2056,2057 Eth2456-ASIC1 2456 100000 Eth2456-ASIC1 Int +Ethernet2458 2058,2059 Eth2458-ASIC1 2458 100000 Eth2458-ASIC1 Int +Ethernet2460 2060,2061 Eth2460-ASIC1 2460 100000 Eth2460-ASIC1 Int +Ethernet2462 2062,2063 Eth2462-ASIC1 2462 100000 Eth2462-ASIC1 Int +Ethernet2464 2064,2065 Eth2464-ASIC1 2464 100000 Eth2464-ASIC1 Int +Ethernet2466 2304,2305 Eth2466-ASIC1 2466 100000 Eth2466-ASIC1 Int +Ethernet2468 2306,2307 Eth2468-ASIC1 2468 100000 Eth2468-ASIC1 Int +Ethernet2470 2308,2309 Eth2470-ASIC1 2470 100000 Eth2470-ASIC1 Int +Ethernet2472 2310,2311 Eth2472-ASIC1 2472 100000 Eth2472-ASIC1 Int +Ethernet2474 2312,2313 Eth2474-ASIC1 2474 100000 Eth2474-ASIC1 Int +Ethernet2476 2314,2315 Eth2476-ASIC1 2476 100000 Eth2476-ASIC1 Int +Ethernet2478 2316,2317 Eth2478-ASIC1 2478 100000 Eth2478-ASIC1 Int +Ethernet2480 2318,2319 Eth2480-ASIC1 2480 100000 Eth2480-ASIC1 Int +Ethernet2482 2320,2321 Eth2482-ASIC1 2482 100000 Eth2482-ASIC1 Int +Ethernet2484 2560,2561 Eth2484-ASIC1 2484 100000 Eth2484-ASIC1 Int +Ethernet2486 2562,2563 Eth2486-ASIC1 2486 100000 Eth2486-ASIC1 Int +Ethernet2488 2564,2565 Eth2488-ASIC1 2488 100000 Eth2488-ASIC1 Int +Ethernet2490 2566,2567 Eth2490-ASIC1 2490 100000 Eth2490-ASIC1 Int +Ethernet2492 2568,2569 Eth2492-ASIC1 2492 100000 Eth2492-ASIC1 Int +Ethernet2494 2570,2571 Eth2494-ASIC1 2494 100000 Eth2494-ASIC1 Int +Ethernet2496 2572,2573 Eth2496-ASIC1 2496 100000 Eth2496-ASIC1 Int +Ethernet2498 2574,2575 Eth2498-ASIC1 2498 100000 Eth2498-ASIC1 Int +Ethernet2500 2576,2577 Eth2500-ASIC1 2500 100000 Eth2500-ASIC1 Int +Ethernet2502 2816,2817 Eth2502-ASIC1 2502 100000 Eth2502-ASIC1 Int +Ethernet2504 2818,2819 Eth2504-ASIC1 2504 100000 Eth2504-ASIC1 Int +Ethernet2506 2820,2821 Eth2506-ASIC1 2506 100000 Eth2506-ASIC1 Int +Ethernet2508 2822,2823 Eth2508-ASIC1 2508 100000 Eth2508-ASIC1 Int +Ethernet2510 2824,2825 Eth2510-ASIC1 2510 100000 Eth2510-ASIC1 Int +Ethernet2512 2826,2827 Eth2512-ASIC1 2512 100000 Eth2512-ASIC1 Int +Ethernet2514 2828,2829 Eth2514-ASIC1 2514 100000 Eth2514-ASIC1 Int +Ethernet2516 2830,2831 Eth2516-ASIC1 2516 100000 Eth2516-ASIC1 Int +Ethernet2518 2832,2833 Eth2518-ASIC1 2518 100000 Eth2518-ASIC1 Int diff --git a/src/sonic-config-engine/tests/sample-dell-9332-t1-minigraph.xml b/src/sonic-config-engine/tests/sample-dell-9332-t1-minigraph.xml new file mode 100644 index 000000000000..460238486b4a --- /dev/null +++ b/src/sonic-config-engine/tests/sample-dell-9332-t1-minigraph.xml @@ -0,0 +1,2023 @@ + + + + + + false + str2-z9332f-01 + 10.0.0.32 + ARISTA01T0 + 10.0.0.33 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::41 + ARISTA01T0 + FC00::42 + 1 + 10 + 3 + + + false + str2-z9332f-01 + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::1 + ARISTA01T2 + FC00::2 + 1 + 10 + 3 + + + false + str2-z9332f-01 + 10.0.0.34 + ARISTA02T0 + 10.0.0.35 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::45 + ARISTA02T0 + FC00::46 + 1 + 10 + 3 + + + false + str2-z9332f-01 + 10.0.0.36 + ARISTA03T0 + 10.0.0.37 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::49 + ARISTA03T0 + FC00::4A + 1 + 10 + 3 + + + false + str2-z9332f-01 + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::9 + ARISTA03T2 + FC00::A + 1 + 10 + 3 + + + false + str2-z9332f-01 + 10.0.0.38 + ARISTA04T0 + 10.0.0.39 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::4D + ARISTA04T0 + FC00::4E + 1 + 10 + 3 + + + false + str2-z9332f-01 + 10.0.0.40 + ARISTA05T0 + 10.0.0.41 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::51 + ARISTA05T0 + FC00::52 + 1 + 10 + 3 + + + false + str2-z9332f-01 + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::11 + ARISTA05T2 + FC00::12 + 1 + 10 + 3 + + + false + str2-z9332f-01 + 10.0.0.42 + ARISTA06T0 + 10.0.0.43 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::55 + ARISTA06T0 + FC00::56 + 1 + 10 + 3 + + + false + str2-z9332f-01 + 10.0.0.44 + ARISTA07T0 + 10.0.0.45 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::59 + ARISTA07T0 + FC00::5A + 1 + 10 + 3 + + + false + str2-z9332f-01 + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::19 + ARISTA07T2 + FC00::1A + 1 + 10 + 3 + + + false + str2-z9332f-01 + 10.0.0.46 + ARISTA08T0 + 10.0.0.47 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::5D + ARISTA08T0 + FC00::5E + 1 + 10 + 3 + + + false + str2-z9332f-01 + 10.0.0.48 + ARISTA09T0 + 10.0.0.49 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::61 + ARISTA09T0 + FC00::62 + 1 + 10 + 3 + + + false + str2-z9332f-01 + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::21 + ARISTA09T2 + FC00::22 + 1 + 10 + 3 + + + false + str2-z9332f-01 + 10.0.0.50 + ARISTA10T0 + 10.0.0.51 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::65 + ARISTA10T0 + FC00::66 + 1 + 10 + 3 + + + false + str2-z9332f-01 + 10.0.0.52 + ARISTA11T0 + 10.0.0.53 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::69 + ARISTA11T0 + FC00::6A + 1 + 10 + 3 + + + false + str2-z9332f-01 + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::29 + ARISTA11T2 + FC00::2A + 1 + 10 + 3 + + + false + str2-z9332f-01 + 10.0.0.54 + ARISTA12T0 + 10.0.0.55 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::6D + ARISTA12T0 + FC00::6E + 1 + 10 + 3 + + + false + str2-z9332f-01 + 10.0.0.56 + ARISTA13T0 + 10.0.0.57 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::71 + ARISTA13T0 + FC00::72 + 1 + 10 + 3 + + + false + str2-z9332f-01 + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::31 + ARISTA13T2 + FC00::32 + 1 + 10 + 3 + + + false + str2-z9332f-01 + 10.0.0.58 + ARISTA14T0 + 10.0.0.59 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::75 + ARISTA14T0 + FC00::76 + 1 + 10 + 3 + + + false + str2-z9332f-01 + 10.0.0.60 + ARISTA15T0 + 10.0.0.61 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::79 + ARISTA15T0 + FC00::7A + 1 + 10 + 3 + + + false + str2-z9332f-01 + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::39 + ARISTA15T2 + FC00::3A + 1 + 10 + 3 + + + false + str2-z9332f-01 + 10.0.0.62 + ARISTA16T0 + 10.0.0.63 + 1 + 10 + 3 + + + str2-z9332f-01 + FC00::7D + ARISTA16T0 + FC00::7E + 1 + 10 + 3 + + + + + 65100 + str2-z9332f-01 + + +
10.0.0.33
+ + + +
+ +
10.0.0.1
+ + + +
+ +
10.0.0.35
+ + + +
+ +
10.0.0.37
+ + + +
+ +
10.0.0.5
+ + + +
+ +
10.0.0.39
+ + + +
+ +
10.0.0.41
+ + + +
+ +
10.0.0.9
+ + + +
+ +
10.0.0.43
+ + + +
+ +
10.0.0.45
+ + + +
+ +
10.0.0.13
+ + + +
+ +
10.0.0.47
+ + + +
+ +
10.0.0.49
+ + + +
+ +
10.0.0.17
+ + + +
+ +
10.0.0.51
+ + + +
+ +
10.0.0.53
+ + + +
+ +
10.0.0.21
+ + + +
+ +
10.0.0.55
+ + + +
+ +
10.0.0.57
+ + + +
+ +
10.0.0.25
+ + + +
+ +
10.0.0.59
+ + + +
+ +
10.0.0.61
+ + + +
+ +
10.0.0.29
+ + + +
+ +
10.0.0.63
+ + + +
+
+ +
+ + 64001 + ARISTA01T0 + + + + 65200 + ARISTA01T2 + + + + 64002 + ARISTA02T0 + + + + 64003 + ARISTA03T0 + + + + 65200 + ARISTA03T2 + + + + 64004 + ARISTA04T0 + + + + 64005 + ARISTA05T0 + + + + 65200 + ARISTA05T2 + + + + 64006 + ARISTA06T0 + + + + 64007 + ARISTA07T0 + + + + 65200 + ARISTA07T2 + + + + 64008 + ARISTA08T0 + + + + 64009 + ARISTA09T0 + + + + 65200 + ARISTA09T2 + + + + 64010 + ARISTA10T0 + + + + 64011 + ARISTA11T0 + + + + 65200 + ARISTA11T2 + + + + 64012 + ARISTA12T0 + + + + 64013 + ARISTA13T0 + + + + 65200 + ARISTA13T2 + + + + 64014 + ARISTA14T0 + + + + 64015 + ARISTA15T0 + + + + 65200 + ARISTA15T2 + + + + 64016 + ARISTA16T0 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + + HostIP + eth0 + + 10.3.146.248/23 + + 10.3.146.248/23 + + + V6HostIP + eth0 + + FC00:2::32/64 + + FC00:2::32/64 + + + + + + + str2-z9332f-01 + + + PortChannel102 + etp1;etp2 + + + + PortChannel105 + etp3;etp4 + + + + PortChannel108 + etp5;etp6 + + + + PortChannel1011 + etp7;etp8 + + + + PortChannel1014 + etp9;etp10 + + + + PortChannel1017 + etp11;etp12 + + + + PortChannel1020 + etp13;etp14 + + + + PortChannel1023 + etp15;etp16 + + + + + + + + + etp17 + 10.0.0.32/31 + + + + etp17 + FC00::41/126 + + + + PortChannel102 + 10.0.0.0/31 + + + + PortChannel102 + FC00::1/126 + + + + etp18 + 10.0.0.34/31 + + + + etp18 + FC00::45/126 + + + + etp19 + 10.0.0.36/31 + + + + etp19 + FC00::49/126 + + + + PortChannel105 + 10.0.0.4/31 + + + + PortChannel105 + FC00::9/126 + + + + etp20 + 10.0.0.38/31 + + + + etp20 + FC00::4D/126 + + + + etp21 + 10.0.0.40/31 + + + + etp21 + FC00::51/126 + + + + PortChannel108 + 10.0.0.8/31 + + + + PortChannel108 + FC00::11/126 + + + + etp22 + 10.0.0.42/31 + + + + etp22 + FC00::55/126 + + + + etp23 + 10.0.0.44/31 + + + + etp23 + FC00::59/126 + + + + PortChannel1011 + 10.0.0.12/31 + + + + PortChannel1011 + FC00::19/126 + + + + etp24 + 10.0.0.46/31 + + + + etp24 + FC00::5D/126 + + + + etp25 + 10.0.0.48/31 + + + + etp25 + FC00::61/126 + + + + PortChannel1014 + 10.0.0.16/31 + + + + PortChannel1014 + FC00::21/126 + + + + etp26 + 10.0.0.50/31 + + + + etp26 + FC00::65/126 + + + + etp27 + 10.0.0.52/31 + + + + etp27 + FC00::69/126 + + + + PortChannel1017 + 10.0.0.20/31 + + + + PortChannel1017 + FC00::29/126 + + + + etp28 + 10.0.0.54/31 + + + + etp28 + FC00::6D/126 + + + + etp29 + 10.0.0.56/31 + + + + etp29 + FC00::71/126 + + + + PortChannel1020 + 10.0.0.24/31 + + + + PortChannel1020 + FC00::31/126 + + + + etp30 + 10.0.0.58/31 + + + + etp30 + FC00::75/126 + + + + etp31 + 10.0.0.60/31 + + + + etp31 + FC00::79/126 + + + + PortChannel1023 + 10.0.0.28/31 + + + + PortChannel1023 + FC00::39/126 + + + + etp32 + 10.0.0.62/31 + + + + etp32 + FC00::7D/126 + + + + + + NTP_ACL + NTP + NTP + + + SNMP_ACL + SNMP + SNMP + + + ERSPAN + Everflow + Everflow + + + ERSPANV6 + EverflowV6 + EverflowV6 + + + VTY_LINE + ssh-only + SSH + + + + + + + + + + DeviceInterfaceLink + ARISTA01T0 + Ethernet1 + str2-z9332f-01 + etp17 + + + DeviceInterfaceLink + ARISTA01T2 + Ethernet1 + str2-z9332f-01 + etp1 + + + DeviceInterfaceLink + ARISTA01T2 + Ethernet2 + str2-z9332f-01 + etp2 + + + DeviceInterfaceLink + ARISTA02T0 + Ethernet1 + str2-z9332f-01 + etp18 + + + DeviceInterfaceLink + ARISTA03T0 + Ethernet1 + str2-z9332f-01 + etp19 + + + DeviceInterfaceLink + ARISTA03T2 + Ethernet1 + str2-z9332f-01 + etp3 + + + DeviceInterfaceLink + ARISTA03T2 + Ethernet2 + str2-z9332f-01 + etp4 + + + DeviceInterfaceLink + ARISTA04T0 + Ethernet1 + str2-z9332f-01 + etp20 + + + DeviceInterfaceLink + ARISTA05T0 + Ethernet1 + str2-z9332f-01 + etp21 + + + DeviceInterfaceLink + ARISTA05T2 + Ethernet1 + str2-z9332f-01 + etp5 + + + DeviceInterfaceLink + ARISTA05T2 + Ethernet2 + str2-z9332f-01 + etp6 + + + DeviceInterfaceLink + ARISTA06T0 + Ethernet1 + str2-z9332f-01 + etp22 + + + DeviceInterfaceLink + ARISTA07T0 + Ethernet1 + str2-z9332f-01 + etp23 + + + DeviceInterfaceLink + ARISTA07T2 + Ethernet1 + str2-z9332f-01 + etp7 + + + DeviceInterfaceLink + ARISTA07T2 + Ethernet2 + str2-z9332f-01 + etp8 + + + DeviceInterfaceLink + ARISTA08T0 + Ethernet1 + str2-z9332f-01 + etp24 + + + DeviceInterfaceLink + ARISTA09T0 + Ethernet1 + str2-z9332f-01 + etp25 + + + DeviceInterfaceLink + ARISTA09T2 + Ethernet1 + str2-z9332f-01 + etp9 + + + DeviceInterfaceLink + ARISTA09T2 + Ethernet2 + str2-z9332f-01 + etp10 + + + DeviceInterfaceLink + ARISTA10T0 + Ethernet1 + str2-z9332f-01 + etp26 + + + DeviceInterfaceLink + ARISTA11T0 + Ethernet1 + str2-z9332f-01 + etp27 + + + DeviceInterfaceLink + ARISTA11T2 + Ethernet1 + str2-z9332f-01 + etp11 + + + DeviceInterfaceLink + ARISTA11T2 + Ethernet2 + str2-z9332f-01 + etp12 + + + DeviceInterfaceLink + ARISTA12T0 + Ethernet1 + str2-z9332f-01 + etp28 + + + DeviceInterfaceLink + ARISTA13T0 + Ethernet1 + str2-z9332f-01 + etp29 + + + DeviceInterfaceLink + ARISTA13T2 + Ethernet1 + str2-z9332f-01 + etp13 + + + DeviceInterfaceLink + ARISTA13T2 + Ethernet2 + str2-z9332f-01 + etp14 + + + DeviceInterfaceLink + ARISTA14T0 + Ethernet1 + str2-z9332f-01 + etp30 + + + DeviceInterfaceLink + ARISTA15T0 + Ethernet1 + str2-z9332f-01 + etp31 + + + DeviceInterfaceLink + ARISTA15T2 + Ethernet1 + str2-z9332f-01 + etp15 + + + DeviceInterfaceLink + ARISTA15T2 + Ethernet2 + str2-z9332f-01 + etp16 + + + DeviceInterfaceLink + ARISTA16T0 + Ethernet1 + str2-z9332f-01 + etp32 + + + + + str2-z9332f-01 + DellEMC-Z9332f-O32 + + 10.3.146.248 + + + + ARISTA16T0 + + 172.16.142.111 + + Arista-VM + + + ARISTA11T0 + + 172.16.142.106 + + Arista-VM + + + ARISTA10T0 + + 172.16.142.105 + + Arista-VM + + + ARISTA11T2 + + 172.16.142.93 + + Arista-VM + + + ARISTA09T2 + + 172.16.142.92 + + Arista-VM + + + ARISTA09T0 + + 172.16.142.104 + + Arista-VM + + + ARISTA06T0 + + 172.16.142.101 + + Arista-VM + + + ARISTA08T0 + + 172.16.142.103 + + Arista-VM + + + ARISTA07T0 + + 172.16.142.102 + + Arista-VM + + + ARISTA07T2 + + 172.16.142.91 + + Arista-VM + + + ARISTA01T2 + + 172.16.142.88 + + Arista-VM + + + ARISTA01T0 + + 172.16.142.96 + + Arista-VM + + + ARISTA05T2 + + 172.16.142.90 + + Arista-VM + + + ARISTA05T0 + + 172.16.142.100 + + Arista-VM + + + ARISTA02T0 + + 172.16.142.97 + + Arista-VM + + + ARISTA03T0 + + 172.16.142.98 + + Arista-VM + + + ARISTA03T2 + + 172.16.142.89 + + Arista-VM + + + ARISTA04T0 + + 172.16.142.99 + + Arista-VM + + + ARISTA15T0 + + 172.16.142.110 + + Arista-VM + + + ARISTA15T2 + + 172.16.142.95 + + Arista-VM + + + ARISTA14T0 + + 172.16.142.109 + + Arista-VM + + + ARISTA12T0 + + 172.16.142.107 + + Arista-VM + + + ARISTA13T2 + + 172.16.142.94 + + Arista-VM + + + ARISTA13T0 + + 172.16.142.108 + + Arista-VM + + + + + + true + + + DeviceInterface + + true + true + 1 + etp1 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp2 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp3 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp4 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp5 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp6 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp7 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp8 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp9 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp10 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp11 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp12 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp13 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp14 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp15 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp16 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp17 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp18 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp19 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp20 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp21 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp22 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp23 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp24 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp25 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp26 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp27 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp28 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp29 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp30 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp31 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp32 + + false + 0 + 0 + 400000 + + + DeviceInterface + + true + true + 1 + etp33 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + true + 1 + etp34 + + false + 0 + 0 + 10000 + + + true + 0 + DellEMC-Z9332f-O32 + + + + + + + str2-z9332f-01 + + + DeploymentId + + 1 + + + QosProfile + + Profile0 + + + DhcpResources + + 192.0.0.1;192.0.0.2;192.0.0.3;192.0.0.4;192.0.0.5;192.0.0.6;192.0.0.7;192.0.0.8;192.0.0.9;192.0.0.10;192.0.0.11;192.0.0.12;192.0.0.13;192.0.0.14;192.0.0.15;192.0.0.16;192.0.0.17;192.0.0.18;192.0.0.19;192.0.0.20;192.0.0.21;192.0.0.22;192.0.0.23;192.0.0.24;192.0.0.25;192.0.0.26;192.0.0.27;192.0.0.28;192.0.0.29;192.0.0.30;192.0.0.31;192.0.0.32;192.0.0.33;192.0.0.34;192.0.0.35;192.0.0.36;192.0.0.37;192.0.0.38;192.0.0.39;192.0.0.40;192.0.0.41;192.0.0.42;192.0.0.43;192.0.0.44;192.0.0.45;192.0.0.46;192.0.0.47;192.0.0.48 + + + NtpResources + + 10.20.8.129;10.20.8.130 + + + SnmpResources + + 10.3.145.98 + + + SyslogResources + + 10.64.246.95 + + + TacacsGroup + + Starlab + + + TacacsServer + + 100.127.20.21 + + + ForcedMgmtRoutes + + 10.3.145.98/31;10.3.145.8;100.127.20.16/28;10.3.149.170/31;40.122.216.24;13.91.48.226;10.3.145.14;10.64.246.0/24;10.3.146.0/23;10.64.5.5 + + + ResourceType + + DL-NPU-Apollo + + + ErspanDestinationIpv4 + + 10.20.6.16 + + + + + + + str2-z9332f-01 + DellEMC-Z9332f-O32 +
diff --git a/src/sonic-config-engine/tests/sample-graph-resource-type.xml b/src/sonic-config-engine/tests/sample-graph-resource-type.xml index 12961059251d..9ba4f1e70267 100644 --- a/src/sonic-config-engine/tests/sample-graph-resource-type.xml +++ b/src/sonic-config-engine/tests/sample-graph-resource-type.xml @@ -20,7 +20,6 @@ 1 180 60 - false switch-t0 @@ -68,12 +67,12 @@ 1 180 60 - true + voq - 0 + 1 BGPMonitor @@ -181,11 +180,6 @@ fortyGigE0/4 - - PortChannel1001 - fortyGigE0/1;fortyGigE0/2 - - @@ -288,26 +282,6 @@ fortyGigE0/8 true - - DeviceInterfaceLink - 10000 - switch-t0 - fortyGigE0/1 - true - ARISTA05T1 - Ethernet1/32 - true - - - DeviceInterfaceLink - 10000 - switch-t0 - fortyGigE0/2 - true - ARISTA06T1 - Ethernet1/33 - true - DeviceMgmtLink 1000 @@ -441,6 +415,330 @@ 0 100000
+ + DeviceInterface + + true + 1 + fortyGigE0/20 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/24 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/28 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/32 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/36 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/44 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/48 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/52 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/56 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/60 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/64 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/68 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/72 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/76 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/80 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/84 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/88 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/92 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/96 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/100 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/104 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/108 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/112 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/116 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/120 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/124 + + false + 0 + 0 + 100000 +
true 0 @@ -463,6 +761,11 @@ switch-t0 + + DeploymentId + + 1 + ResourceType diff --git a/src/sonic-config-engine/tests/sample-graph-subintf.xml b/src/sonic-config-engine/tests/sample-graph-subintf.xml index f487b989a138..d5fd2d461c8a 100644 --- a/src/sonic-config-engine/tests/sample-graph-subintf.xml +++ b/src/sonic-config-engine/tests/sample-graph-subintf.xml @@ -20,7 +20,6 @@ 1 180 60 - false switch-t0 @@ -68,12 +67,12 @@ 1 180 60 - true + voq - 0 + 1 BGPMonitor @@ -181,11 +180,6 @@ fortyGigE0/4 - - PortChannel1001 - fortyGigE0/1;fortyGigE0/2 - - @@ -296,26 +290,6 @@ fortyGigE0/8 true - - DeviceInterfaceLink - 10000 - switch-t0 - fortyGigE0/1 - true - ARISTA05T1 - Ethernet1/32 - true - - - DeviceInterfaceLink - 10000 - switch-t0 - fortyGigE0/2 - true - ARISTA06T1 - Ethernet1/33 - true - DeviceMgmtLink 1000 @@ -449,6 +423,330 @@ 0 100000 + + DeviceInterface + + true + 1 + fortyGigE0/20 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/24 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/28 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/32 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/36 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/44 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/48 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/52 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/56 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/60 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/64 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/68 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/72 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/76 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/80 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/84 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/88 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/92 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/96 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/100 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/104 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/108 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/112 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/116 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/120 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/124 + + false + 0 + 0 + 100000 + true 0 @@ -466,6 +764,21 @@
+ + + + switch-t0 + + + DeploymentId + + 1 + + + + + + switch-t0 Force10-S6000 diff --git a/src/sonic-config-engine/tests/sample-mellanox-2410-t1-minigraph.xml b/src/sonic-config-engine/tests/sample-mellanox-2410-t1-minigraph.xml new file mode 100644 index 000000000000..b6d14c9451d8 --- /dev/null +++ b/src/sonic-config-engine/tests/sample-mellanox-2410-t1-minigraph.xml @@ -0,0 +1,2303 @@ + + + + + + false + sonic + 10.0.0.32 + ARISTA01T0 + 10.0.0.33 + 1 + 10 + 3 + + + sonic + FC00::41 + ARISTA01T0 + FC00::42 + 1 + 10 + 3 + + + false + sonic + 10.0.0.0 + ARISTA01T2 + 10.0.0.1 + 1 + 10 + 3 + + + sonic + FC00::1 + ARISTA01T2 + FC00::2 + 1 + 10 + 3 + + + false + sonic + 10.0.0.34 + ARISTA02T0 + 10.0.0.35 + 1 + 10 + 3 + + + sonic + FC00::45 + ARISTA02T0 + FC00::46 + 1 + 10 + 3 + + + false + sonic + 10.0.0.36 + ARISTA03T0 + 10.0.0.37 + 1 + 10 + 3 + + + sonic + FC00::49 + ARISTA03T0 + FC00::4A + 1 + 10 + 3 + + + false + sonic + 10.0.0.4 + ARISTA03T2 + 10.0.0.5 + 1 + 10 + 3 + + + sonic + FC00::9 + ARISTA03T2 + FC00::A + 1 + 10 + 3 + + + false + sonic + 10.0.0.38 + ARISTA04T0 + 10.0.0.39 + 1 + 10 + 3 + + + sonic + FC00::4D + ARISTA04T0 + FC00::4E + 1 + 10 + 3 + + + false + sonic + 10.0.0.40 + ARISTA05T0 + 10.0.0.41 + 1 + 10 + 3 + + + sonic + FC00::51 + ARISTA05T0 + FC00::52 + 1 + 10 + 3 + + + false + sonic + 10.0.0.8 + ARISTA05T2 + 10.0.0.9 + 1 + 10 + 3 + + + sonic + FC00::11 + ARISTA05T2 + FC00::12 + 1 + 10 + 3 + + + false + sonic + 10.0.0.42 + ARISTA06T0 + 10.0.0.43 + 1 + 10 + 3 + + + sonic + FC00::55 + ARISTA06T0 + FC00::56 + 1 + 10 + 3 + + + false + sonic + 10.0.0.44 + ARISTA07T0 + 10.0.0.45 + 1 + 10 + 3 + + + sonic + FC00::59 + ARISTA07T0 + FC00::5A + 1 + 10 + 3 + + + false + sonic + 10.0.0.12 + ARISTA07T2 + 10.0.0.13 + 1 + 10 + 3 + + + sonic + FC00::19 + ARISTA07T2 + FC00::1A + 1 + 10 + 3 + + + false + sonic + 10.0.0.46 + ARISTA08T0 + 10.0.0.47 + 1 + 10 + 3 + + + sonic + FC00::5D + ARISTA08T0 + FC00::5E + 1 + 10 + 3 + + + false + sonic + 10.0.0.48 + ARISTA09T0 + 10.0.0.49 + 1 + 10 + 3 + + + sonic + FC00::61 + ARISTA09T0 + FC00::62 + 1 + 10 + 3 + + + false + sonic + 10.0.0.16 + ARISTA09T2 + 10.0.0.17 + 1 + 10 + 3 + + + sonic + FC00::21 + ARISTA09T2 + FC00::22 + 1 + 10 + 3 + + + false + sonic + 10.0.0.50 + ARISTA10T0 + 10.0.0.51 + 1 + 10 + 3 + + + sonic + FC00::65 + ARISTA10T0 + FC00::66 + 1 + 10 + 3 + + + false + sonic + 10.0.0.52 + ARISTA11T0 + 10.0.0.53 + 1 + 10 + 3 + + + sonic + FC00::69 + ARISTA11T0 + FC00::6A + 1 + 10 + 3 + + + false + sonic + 10.0.0.20 + ARISTA11T2 + 10.0.0.21 + 1 + 10 + 3 + + + sonic + FC00::29 + ARISTA11T2 + FC00::2A + 1 + 10 + 3 + + + false + sonic + 10.0.0.54 + ARISTA12T0 + 10.0.0.55 + 1 + 10 + 3 + + + sonic + FC00::6D + ARISTA12T0 + FC00::6E + 1 + 10 + 3 + + + false + sonic + 10.0.0.56 + ARISTA13T0 + 10.0.0.57 + 1 + 10 + 3 + + + sonic + FC00::71 + ARISTA13T0 + FC00::72 + 1 + 10 + 3 + + + false + sonic + 10.0.0.24 + ARISTA13T2 + 10.0.0.25 + 1 + 10 + 3 + + + sonic + FC00::31 + ARISTA13T2 + FC00::32 + 1 + 10 + 3 + + + false + sonic + 10.0.0.58 + ARISTA14T0 + 10.0.0.59 + 1 + 10 + 3 + + + sonic + FC00::75 + ARISTA14T0 + FC00::76 + 1 + 10 + 3 + + + false + sonic + 10.0.0.60 + ARISTA15T0 + 10.0.0.61 + 1 + 10 + 3 + + + sonic + FC00::79 + ARISTA15T0 + FC00::7A + 1 + 10 + 3 + + + false + sonic + 10.0.0.28 + ARISTA15T2 + 10.0.0.29 + 1 + 10 + 3 + + + sonic + FC00::39 + ARISTA15T2 + FC00::3A + 1 + 10 + 3 + + + false + sonic + 10.0.0.62 + ARISTA16T0 + 10.0.0.63 + 1 + 10 + 3 + + + sonic + FC00::7D + ARISTA16T0 + FC00::7E + 1 + 10 + 3 + + + + + 65100 + sonic + + +
10.0.0.33
+ + + +
+ +
10.0.0.1
+ + + +
+ +
10.0.0.35
+ + + +
+ +
10.0.0.37
+ + + +
+ +
10.0.0.5
+ + + +
+ +
10.0.0.39
+ + + +
+ +
10.0.0.41
+ + + +
+ +
10.0.0.9
+ + + +
+ +
10.0.0.43
+ + + +
+ +
10.0.0.45
+ + + +
+ +
10.0.0.13
+ + + +
+ +
10.0.0.47
+ + + +
+ +
10.0.0.49
+ + + +
+ +
10.0.0.17
+ + + +
+ +
10.0.0.51
+ + + +
+ +
10.0.0.53
+ + + +
+ +
10.0.0.21
+ + + +
+ +
10.0.0.55
+ + + +
+ +
10.0.0.57
+ + + +
+ +
10.0.0.25
+ + + +
+ +
10.0.0.59
+ + + +
+ +
10.0.0.61
+ + + +
+ +
10.0.0.29
+ + + +
+ +
10.0.0.63
+ + + +
+
+ +
+ + 64001 + ARISTA01T0 + + + + 65200 + ARISTA01T2 + + + + 64002 + ARISTA02T0 + + + + 64003 + ARISTA03T0 + + + + 65200 + ARISTA03T2 + + + + 64004 + ARISTA04T0 + + + + 64005 + ARISTA05T0 + + + + 65200 + ARISTA05T2 + + + + 64006 + ARISTA06T0 + + + + 64007 + ARISTA07T0 + + + + 65200 + ARISTA07T2 + + + + 64008 + ARISTA08T0 + + + + 64009 + ARISTA09T0 + + + + 65200 + ARISTA09T2 + + + + 64010 + ARISTA10T0 + + + + 64011 + ARISTA11T0 + + + + 65200 + ARISTA11T2 + + + + 64012 + ARISTA12T0 + + + + 64013 + ARISTA13T0 + + + + 65200 + ARISTA13T2 + + + + 64014 + ARISTA14T0 + + + + 64015 + ARISTA15T0 + + + + 65200 + ARISTA15T2 + + + + 64016 + ARISTA16T0 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + HostIP + eth0 + + 10.100.0.100/24 + + 10.100.0.100/24 + + + V6HostIP + eth0 + + fe80::9a03:9bff:fe82:f226/64 + + fe80::9a03:9bff:fe82:f226/64 + + + + + + + sonic + + + PortChannel0002 + Ethernet0;Ethernet4 + + + + PortChannel0005 + Ethernet8;Ethernet12 + + + + PortChannel0008 + Ethernet16;Ethernet20 + + + + PortChannel0011 + Ethernet24;Ethernet28 + + + + PortChannel0014 + Ethernet32;Ethernet36 + + + + PortChannel0017 + Ethernet40;Ethernet44 + + + + PortChannel0020 + Ethernet48;Ethernet52 + + + + PortChannel0023 + Ethernet56;Ethernet60 + + + + + + + + + Ethernet64 + 10.0.0.32/31 + + + + Ethernet64 + FC00::41/126 + + + + PortChannel0002 + 10.0.0.0/31 + + + + PortChannel0002 + FC00::1/126 + + + + Ethernet68 + 10.0.0.34/31 + + + + Ethernet68 + FC00::45/126 + + + + Ethernet72 + 10.0.0.36/31 + + + + Ethernet72 + FC00::49/126 + + + + PortChannel0005 + 10.0.0.4/31 + + + + PortChannel0005 + FC00::9/126 + + + + Ethernet76 + 10.0.0.38/31 + + + + Ethernet76 + FC00::4D/126 + + + + Ethernet80 + 10.0.0.40/31 + + + + Ethernet80 + FC00::51/126 + + + + PortChannel0008 + 10.0.0.8/31 + + + + PortChannel0008 + FC00::11/126 + + + + Ethernet84 + 10.0.0.42/31 + + + + Ethernet84 + FC00::55/126 + + + + Ethernet88 + 10.0.0.44/31 + + + + Ethernet88 + FC00::59/126 + + + + PortChannel0011 + 10.0.0.12/31 + + + + PortChannel0011 + FC00::19/126 + + + + Ethernet92 + 10.0.0.46/31 + + + + Ethernet92 + FC00::5D/126 + + + + Ethernet96 + 10.0.0.48/31 + + + + Ethernet96 + FC00::61/126 + + + + PortChannel0014 + 10.0.0.16/31 + + + + PortChannel0014 + FC00::21/126 + + + + Ethernet100 + 10.0.0.50/31 + + + + Ethernet100 + FC00::65/126 + + + + Ethernet104 + 10.0.0.52/31 + + + + Ethernet104 + FC00::69/126 + + + + PortChannel0017 + 10.0.0.20/31 + + + + PortChannel0017 + FC00::29/126 + + + + Ethernet108 + 10.0.0.54/31 + + + + Ethernet108 + FC00::6D/126 + + + + Ethernet112 + 10.0.0.56/31 + + + + Ethernet112 + FC00::71/126 + + + + PortChannel0020 + 10.0.0.24/31 + + + + PortChannel0020 + FC00::31/126 + + + + Ethernet116 + 10.0.0.58/31 + + + + Ethernet116 + FC00::75/126 + + + + Ethernet120 + 10.0.0.60/31 + + + + Ethernet120 + FC00::79/126 + + + + PortChannel0023 + 10.0.0.28/31 + + + + PortChannel0023 + FC00::39/126 + + + + Ethernet124 + 10.0.0.62/31 + + + + Ethernet124 + FC00::7D/126 + + + + + + NTP_ACL + NTP + NTP + + + SNMP_ACL + SNMP + SNMP + + + ERSPAN + Everflow + Everflow + + + ERSPANV6 + EverflowV6 + EverflowV6 + + + VTY_LINE + ssh-only + SSH + + + PortChannel0002;PortChannel0005;PortChannel0008;PortChannel0011;PortChannel0014;PortChannel0017;PortChannel0020;PortChannel0023;Ethernet64;Ethernet68;Ethernet72;Ethernet76;Ethernet80;Ethernet84;Ethernet88;Ethernet92;Ethernet96;Ethernet100;Ethernet104;Ethernet108;Ethernet112;Ethernet116;Ethernet120;Ethernet124 + DataAcl + DataPlane + + + + + + + + + + DeviceInterfaceLink + ARISTA01T0 + Ethernet1 + sonic + Ethernet64 + + + DeviceInterfaceLink + ARISTA01T2 + Ethernet1 + sonic + Ethernet0 + + + DeviceInterfaceLink + ARISTA01T2 + Ethernet2 + sonic + Ethernet4 + + + DeviceInterfaceLink + ARISTA02T0 + Ethernet1 + sonic + Ethernet68 + + + DeviceInterfaceLink + ARISTA03T0 + Ethernet1 + sonic + Ethernet72 + + + DeviceInterfaceLink + ARISTA03T2 + Ethernet1 + sonic + Ethernet8 + + + DeviceInterfaceLink + ARISTA03T2 + Ethernet2 + sonic + Ethernet12 + + + DeviceInterfaceLink + ARISTA04T0 + Ethernet1 + sonic + Ethernet76 + + + DeviceInterfaceLink + ARISTA05T0 + Ethernet1 + sonic + Ethernet80 + + + DeviceInterfaceLink + ARISTA05T2 + Ethernet1 + sonic + Ethernet16 + + + DeviceInterfaceLink + ARISTA05T2 + Ethernet2 + sonic + Ethernet20 + + + DeviceInterfaceLink + ARISTA06T0 + Ethernet1 + sonic + Ethernet84 + + + DeviceInterfaceLink + ARISTA07T0 + Ethernet1 + sonic + Ethernet88 + + + DeviceInterfaceLink + ARISTA07T2 + Ethernet1 + sonic + Ethernet24 + + + DeviceInterfaceLink + ARISTA07T2 + Ethernet2 + sonic + Ethernet28 + + + DeviceInterfaceLink + ARISTA08T0 + Ethernet1 + sonic + Ethernet92 + + + DeviceInterfaceLink + ARISTA09T0 + Ethernet1 + sonic + Ethernet96 + + + DeviceInterfaceLink + ARISTA09T2 + Ethernet1 + sonic + Ethernet32 + + + DeviceInterfaceLink + ARISTA09T2 + Ethernet2 + sonic + Ethernet36 + + + DeviceInterfaceLink + ARISTA10T0 + Ethernet1 + sonic + Ethernet100 + + + DeviceInterfaceLink + ARISTA11T0 + Ethernet1 + sonic + Ethernet104 + + + DeviceInterfaceLink + ARISTA11T2 + Ethernet1 + sonic + Ethernet40 + + + DeviceInterfaceLink + ARISTA11T2 + Ethernet2 + sonic + Ethernet44 + + + DeviceInterfaceLink + ARISTA12T0 + Ethernet1 + sonic + Ethernet108 + + + DeviceInterfaceLink + ARISTA13T0 + Ethernet1 + sonic + Ethernet112 + + + DeviceInterfaceLink + ARISTA13T2 + Ethernet1 + sonic + Ethernet48 + + + DeviceInterfaceLink + ARISTA13T2 + Ethernet2 + sonic + Ethernet52 + + + DeviceInterfaceLink + ARISTA14T0 + Ethernet1 + sonic + Ethernet116 + + + DeviceInterfaceLink + ARISTA15T0 + Ethernet1 + sonic + Ethernet120 + + + DeviceInterfaceLink + ARISTA15T2 + Ethernet1 + sonic + Ethernet56 + + + DeviceInterfaceLink + ARISTA15T2 + Ethernet2 + sonic + Ethernet60 + + + DeviceInterfaceLink + ARISTA16T0 + Ethernet1 + sonic + Ethernet124 + + + + + sonic + ACS-MSN2410 + + 10.100.0.1 + + + + ARISTA16T0 + + 10.100.0.65 + + Arista-VM + + + ARISTA11T0 + + 10.100.0.60 + + Arista-VM + + + ARISTA10T0 + + 10.100.0.59 + + Arista-VM + + + ARISTA11T2 + + 10.100.0.47 + + Arista-VM + + + ARISTA09T2 + + 10.100.0.46 + + Arista-VM + + + ARISTA09T0 + + 10.100.0.58 + + Arista-VM + + + ARISTA06T0 + + 10.100.0.55 + + Arista-VM + + + ARISTA08T0 + + 10.100.0.57 + + Arista-VM + + + ARISTA07T0 + + 10.100.0.56 + + Arista-VM + + + ARISTA07T2 + + 10.100.0.45 + + Arista-VM + + + ARISTA01T2 + + 10.100.0.42 + + Arista-VM + + + ARISTA01T0 + + 10.100.0.50 + + Arista-VM + + + ARISTA05T2 + + 10.100.0.44 + + Arista-VM + + + ARISTA05T0 + + 10.100.0.54 + + Arista-VM + + + ARISTA02T0 + + 10.100.0.51 + + Arista-VM + + + ARISTA03T0 + + 10.100.0.52 + + Arista-VM + + + ARISTA03T2 + + 10.100.0.43 + + Arista-VM + + + ARISTA04T0 + + 10.100.0.53 + + Arista-VM + + + ARISTA15T0 + + 10.100.0.64 + + Arista-VM + + + ARISTA15T2 + + 10.100.0.49 + + Arista-VM + + + ARISTA14T0 + + 10.100.0.63 + + Arista-VM + + + ARISTA12T0 + + 10.100.0.61 + + Arista-VM + + + ARISTA13T2 + + 10.100.0.48 + + Arista-VM + + + ARISTA13T0 + + 10.100.0.62 + + Arista-VM + + + + + + true + + + DeviceInterface + + true + true + 1 + Ethernet0 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet4 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet8 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet12 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet16 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet20 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet24 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet28 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet32 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet36 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet40 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet44 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet48 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet52 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet56 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet60 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet64 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet68 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet72 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet76 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet80 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet84 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet88 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet92 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet96 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet100 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet104 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet108 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet112 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet116 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet120 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet124 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet128 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet132 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet136 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet140 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet144 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet148 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet152 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet156 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet160 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet164 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet168 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet172 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet176 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet180 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet184 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet188 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + true + 1 + Ethernet192 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet196 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet200 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet204 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet208 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet212 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet216 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + Ethernet220 + + false + 0 + 0 + 100000 + + + true + 0 + ACS-MSN2410 + + + + + + + sonic + + + DeploymentId + + 1 + + + QosProfile + + Profile0 + + + DhcpResources + + 192.0.0.1;192.0.0.2;192.0.0.3;192.0.0.4 + + + NtpResources + + 10.100.0.250 + + + SnmpResources + + 10.0.0.9 + + + TacacsGroup + + sonicadmin + + + TacacsServer + + 10.100.0.20 + + + ForcedMgmtRoutes + + 10.100.0.0/16 + + + ErspanDestinationIpv4 + + 10.0.0.7 + + + + + + + sonic + ACS-MSN2410 +
diff --git a/src/sonic-config-engine/tests/sample-mellanox-2700-t0-minigraph.xml b/src/sonic-config-engine/tests/sample-mellanox-2700-t0-minigraph.xml new file mode 100644 index 000000000000..b7f259e3e2db --- /dev/null +++ b/src/sonic-config-engine/tests/sample-mellanox-2700-t0-minigraph.xml @@ -0,0 +1,1498 @@ + + + + + + false + mellanox-2700 + 10.0.0.56 + ARISTA01T1 + 10.0.0.57 + 1 + 10 + 3 + + + mellanox-2700 + FC00::71 + ARISTA01T1 + FC00::72 + 1 + 10 + 3 + + + false + mellanox-2700 + 10.0.0.58 + ARISTA02T1 + 10.0.0.59 + 1 + 10 + 3 + + + mellanox-2700 + FC00::75 + ARISTA02T1 + FC00::76 + 1 + 10 + 3 + + + false + mellanox-2700 + 10.0.0.60 + ARISTA03T1 + 10.0.0.61 + 1 + 10 + 3 + + + mellanox-2700 + FC00::79 + ARISTA03T1 + FC00::7A + 1 + 10 + 3 + + + false + mellanox-2700 + 10.0.0.62 + ARISTA04T1 + 10.0.0.63 + 1 + 10 + 3 + + + mellanox-2700 + FC00::7D + ARISTA04T1 + FC00::7E + 1 + 10 + 3 + + + + + 65100 + mellanox-2700 + + +
10.0.0.57
+ + + +
+ +
10.0.0.59
+ + + +
+ +
10.0.0.61
+ + + +
+ +
10.0.0.63
+ + + +
+ + BGPPeer +
10.1.0.32
+ + + + BGPSLBPassive + 10.255.0.0/25 +
+ + BGPPeer +
10.1.0.32
+ + + + BGPVac + 192.168.0.0/21 +
+
+ +
+ + 64600 + ARISTA01T1 + + + + 64600 + ARISTA02T1 + + + + 64600 + ARISTA03T1 + + + + 64600 + ARISTA04T1 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + + HostIP + eth0 + + 10.100.0.100/24 + + 10.100.0.0/24 + + + V6HostIP + eth0 + + fe80::526b:4bff:fecd:30cc/64 + + fe80::526b:4bff:fecd:30cc/64 + + + + + + + mellanox-2700 + + + PortChannel0001 + etp17a + + + + PortChannel0002 + etp17b + + + + PortChannel0003 + etp18a + + + + PortChannel0004 + etp18b + + + + + + Vlan1000 + etp1b;etp2a;etp2b;etp3a;etp3b;etp4a;etp4b;etp5a;etp5b;etp6a;etp6b;etp7;etp8;etp9;etp10;etp11a;etp11b;etp12a;etp12b;etp13a;etp13b;etp14a;etp14b;etp15a + False + 0.0.0.0/0 + + 192.0.0.1;192.0.0.2;192.0.0.3;192.0.0.4 + 1000 + 1000 + 192.168.0.0/21 + + + + + + PortChannel0001 + 10.0.0.56/31 + + + + PortChannel0001 + FC00::71/126 + + + + PortChannel0002 + 10.0.0.58/31 + + + + PortChannel0002 + FC00::75/126 + + + + PortChannel0003 + 10.0.0.60/31 + + + + PortChannel0003 + FC00::79/126 + + + + PortChannel0004 + 10.0.0.62/31 + + + + PortChannel0004 + FC00::7D/126 + + + + Vlan1000 + 192.168.0.1/21 + + + + Vlan1000 + fc02:1000::1/64 + + + + + + SNMP_ACL + SNMP + SNMP + + + ERSPAN + Everflow + Everflow + + + ERSPANV6 + EverflowV6 + EverflowV6 + + + VTY_LINE + ssh-only + SSH + + + PortChannel0001;PortChannel0002;PortChannel0003;PortChannel0004 + DataAcl + DataPlane + + + + + + + + + + DeviceInterfaceLink + ARISTA01T1 + Ethernet1 + mellanox-2700 + etp17a + + + DeviceInterfaceLink + ARISTA02T1 + Ethernet1 + mellanox-2700 + etp17b + + + DeviceInterfaceLink + ARISTA03T1 + Ethernet1 + mellanox-2700 + etp18a + + + DeviceInterfaceLink + ARISTA04T1 + Ethernet1 + mellanox-2700 + etp18b + + + DeviceInterfaceLink + mellanox-2700 + etp1b + Servers0 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp2a + Servers1 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp2b + Servers2 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp3a + Servers3 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp3b + Servers4 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp4a + Servers5 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp4b + Servers6 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp5a + Servers7 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp5b + Servers8 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp6a + Servers9 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp6b + Servers10 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp7 + Servers11 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp8 + Servers12 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp9 + Servers13 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp10 + Servers14 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp11a + Servers15 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp11b + Servers16 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp12a + Servers17 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp12b + Servers18 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp13a + Servers19 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp13b + Servers20 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp14a + Servers21 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp14b + Servers22 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp15a + Servers23 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp1b + Servers24 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp2a + Servers25 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp2b + Servers26 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp3a + Servers27 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp3b + Servers28 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp4a + Servers29 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp4b + Servers30 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp5a + Servers31 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp5b + Servers32 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp6a + Servers33 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp6b + Servers34 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp7 + Servers35 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp8 + Servers36 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp9 + Servers37 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp10 + Servers38 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp11a + Servers39 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp11b + Servers40 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp12a + Servers41 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp12b + Servers42 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp13a + Servers43 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp13b + Servers44 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp14a + Servers45 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp14b + Servers46 + eth0 + + + DeviceInterfaceLink + mellanox-2700 + etp15a + Servers47 + eth0 + + + + + mellanox-2700 + Mellanox-SN2700-D48C8 + + 10.100.0.1 + + + + ARISTA04T1 + + 10.100.0.2 + + Arista-VM + + + ARISTA03T1 + + 10.100.0.3 + + Arista-VM + + + ARISTA02T1 + + 10.100.0.4 + + Arista-VM + + + ARISTA01T1 + + 10.213.80.121 + + Arista-VM + + + + + + true + + + DeviceInterface + + true + true + 1 + etp1a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp1b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp2a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp2b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp3a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp3b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp4a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp4b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp5a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp5b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp6a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp6b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp7 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + etp8 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + etp9 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + etp10 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + etp11a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp11b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp12a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp12b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp13a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp13b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp14a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp14b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp15a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp15b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp16a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp16b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp17a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp17b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp18a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp18b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp19a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp19b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp20a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp20b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp21a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp21b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp22a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp22b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp23 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + etp24 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + etp25 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + true + 1 + etp26 + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp27a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp27b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp28a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp28b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp29a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp29b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp30a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp30b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp31a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp31b + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp32a + + false + 0 + 0 + 50000 + + + DeviceInterface + + true + true + 1 + etp32b + + false + 0 + 0 + 50000 + + + true + 0 + Mellanox-SN2700-D48C8 + + + + + + + mellanox-2700 + + + DeploymentId + + 1 + + + QosProfile + + Profile0 + + + DhcpResources + + 192.0.0.1;192.0.0.2;192.0.0.3;192.0.0.4 + + + SnmpResources + + 10.0.0.9 + + + ErspanDestinationIpv4 + + 10.0.0.7 + + + + + + + mellanox-2700 + Mellanox-SN2700-D48C8 +
diff --git a/src/sonic-config-engine/tests/sample-voq-graph.xml b/src/sonic-config-engine/tests/sample-voq-graph.xml index c6fc1b2f5d17..5205265ee384 100644 --- a/src/sonic-config-engine/tests/sample-voq-graph.xml +++ b/src/sonic-config-engine/tests/sample-voq-graph.xml @@ -1,7 +1,14 @@ - + + + 65100 + linecard-1 + + + + @@ -109,7 +116,7 @@ SyslogResources - 10.0.10.5;10.0.10.6; + 10.0.10.5;10.0.10.6 @@ -195,6 +202,366 @@ 100000 Interface description + + DeviceInterface + + true + 1 + fortyGigE0/16 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/20 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/24 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/28 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/32 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/36 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/44 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/48 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/52 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/56 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/60 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/64 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/68 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/72 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/76 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/80 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/84 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/88 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/92 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/96 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/100 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/104 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/108 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/112 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/116 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/120 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/124 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + Recycle0 + + false + 0 + 0 + 100000 + true 0 diff --git a/src/sonic-config-engine/tests/sample_graph.xml b/src/sonic-config-engine/tests/sample_graph.xml index 47efabf7d81c..478fdd5ba8d4 100644 --- a/src/sonic-config-engine/tests/sample_graph.xml +++ b/src/sonic-config-engine/tests/sample_graph.xml @@ -88,7 +88,7 @@
- Ethernet1 + Ethernet4 10.10.2.13/30
@@ -111,8 +111,8 @@ 40000 DeviceInterfaceLink - OCPCH01040DDLF - Ethernet1 + OCPSCH01040DDLF + Ethernet4 OCPSCH0104002MS Ethernet12 @@ -124,6 +124,439 @@ + + + + + DeviceInterface + + true + 1 + fortyGigE0/0 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + 1 + Ethernet1 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + 1 + Ethernet2 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + 1 + fortyGigE0/4 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + 1 + fortyGigE0/8 + + false + 0 + 0 + 40000 + Interface description + + + DeviceInterface + + true + 1 + fortyGigE0/12 + + false + 0 + 0 + 100000 + Interface description + + + DeviceInterface + + true + 1 + fortyGigE0/16 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/20 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/24 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/28 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/32 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/36 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/44 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/48 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/52 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/56 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/60 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/64 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/68 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/72 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/76 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/80 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/84 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/88 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/92 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/96 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/100 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/104 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/108 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/112 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/116 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/120 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/124 + + false + 0 + 0 + 100000 + + + Force10-Z9100 + + + + + + + OCPSCH01040DDLF + + + DeploymentId + + 1 + + + + + + OCPSCH01040DDLF Force10-Z9100 diff --git a/src/sonic-config-engine/tests/sample_hwsku.json b/src/sonic-config-engine/tests/sample_hwsku.json index b4864d40eb11..697fb7b1ccb4 100644 --- a/src/sonic-config-engine/tests/sample_hwsku.json +++ b/src/sonic-config-engine/tests/sample_hwsku.json @@ -95,6 +95,21 @@ }, "Ethernet124": { "default_brkout_mode": "2x50G" + }, + "Ethernet128": { + "default_brkout_mode": "1x40G[100G]" + }, + "Ethernet132": { + "default_brkout_mode": "1x25G[100G,50G,40G,10G]" + }, + "Ethernet136": { + "default_brkout_mode": "4x10G[25G]" + }, + "Ethernet140": { + "default_brkout_mode": "2x25G(2)+1x50000(2)" + }, + "Ethernet144": { + "default_brkout_mode": "1x100000[50G,40000,25G,10000]" } } } diff --git a/src/sonic-config-engine/tests/sample_output/platform_output.json b/src/sonic-config-engine/tests/sample_output/platform_output.json index 8276b19e18a3..4c6cf197c389 100644 --- a/src/sonic-config-engine/tests/sample_output/platform_output.json +++ b/src/sonic-config-engine/tests/sample_output/platform_output.json @@ -819,5 +819,106 @@ "pfc_asym": "off", "speed": "50000", "tpid": "0x8100" + }, + "Ethernet128": { + "index": "33", + "lanes": "128,129,130,131", + "description": "Eth33", + "tpid": "0x8100", + "mtu": "9100", + "alias": "Eth33", + "pfc_asym": "off", + "speed": "40000" + }, + "Ethernet132": { + "index": "34", + "lanes": "132,133,134,135", + "description": "Eth34", + "tpid": "0x8100", + "mtu": "9100", + "alias": "Eth34", + "pfc_asym": "off", + "speed": "25000" + }, + "Ethernet136": { + "index": "35", + "lanes": "136", + "description": "Eth35/1", + "tpid": "0x8100", + "mtu": "9100", + "alias": "Eth35/1", + "pfc_asym": "off", + "speed": "10000" + }, + "Ethernet137": { + "index": "35", + "lanes": "137", + "description": "Eth35/2", + "tpid": "0x8100", + "mtu": "9100", + "alias": "Eth35/2", + "pfc_asym": "off", + "speed": "10000" + }, + "Ethernet138": { + "index": "35", + "lanes": "138", + "description": "Eth35/3", + "tpid": "0x8100", + "mtu": "9100", + "alias": "Eth35/3", + "pfc_asym": "off", + "speed": "10000" + }, + "Ethernet139": { + "index": "35", + "lanes": "139", + "description": "Eth35/4", + "tpid": "0x8100", + "mtu": "9100", + "alias": "Eth35/4", + "pfc_asym": "off", + "speed": "10000" + }, + "Ethernet140": { + "index": "36", + "lanes": "140", + "description": "Eth36/1", + "tpid": "0x8100", + "mtu": "9100", + "alias": "Eth36/1", + "pfc_asym": "off", + "speed": "25000" + }, + "Ethernet141": { + "index": "36", + "lanes": "141", + "description": "Eth36/2", + "tpid": "0x8100", + "mtu": "9100", + "alias": "Eth36/2", + "pfc_asym": "off", + "speed": "25000" + }, + "Ethernet142": { + "index": "36", + "lanes": "142,143", + "description": "Eth36/3", + "tpid": "0x8100", + "mtu": "9100", + "alias": "Eth36/3", + "pfc_asym": "off", + "speed": "50000" + }, + "Ethernet144": { + "index": "37", + "lanes": "144,145,146,147", + "description": "Eth37", + "tpid": "0x8100", + "mtu": "9100", + "alias": "Eth37", + "pfc_asym": "off", + "speed": "100000", + "fec": "rs" } } diff --git a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_backend_asic.conf b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_backend_asic.conf index a4ad1c677a77..d793dfa39a98 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_backend_asic.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_backend_asic.conf @@ -34,6 +34,18 @@ ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32 ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64 ! ! +ip prefix-list V4_P2P_IP permit 0.0.0.0/0 ge 31 le 31 +! +ipv6 prefix-list V6_P2P_IP permit ::/0 ge 126 le 126 +! +route-map V4_CONNECTED_ROUTES permit 10 + match ip address prefix-list V4_P2P_IP + call HIDE_INTERNAL +! +route-map V6_CONNECTED_ROUTES permit 10 + match ipv6 address prefix-list V6_P2P_IP + call HIDE_INTERNAL +! route-map HIDE_INTERNAL permit 10 set community no-export ! @@ -46,10 +58,6 @@ router bgp 65100 ! bgp bestpath as-path multipath-relax ! - bgp graceful-restart restart-time 240 - bgp graceful-restart - bgp graceful-restart preserve-fw-state - bgp graceful-restart select-defer-time 45 ! bgp router-id 8.0.0.5 ! diff --git a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_frontend_asic.conf b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_frontend_asic.conf index b49d3ddd4dcd..94bd37e3b90f 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_frontend_asic.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/bgpd_frr_frontend_asic.conf @@ -34,6 +34,18 @@ ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32 ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64 ! ! +ip prefix-list V4_P2P_IP permit 0.0.0.0/0 ge 31 le 31 +! +ipv6 prefix-list V6_P2P_IP permit ::/0 ge 126 le 126 +! +route-map V4_CONNECTED_ROUTES permit 10 + match ip address prefix-list V4_P2P_IP + call HIDE_INTERNAL +! +route-map V6_CONNECTED_ROUTES permit 10 + match ipv6 address prefix-list V6_P2P_IP + call HIDE_INTERNAL +! route-map HIDE_INTERNAL permit 10 set community no-export ! @@ -46,10 +58,6 @@ router bgp 65100 ! bgp bestpath as-path multipath-relax ! - bgp graceful-restart restart-time 240 - bgp graceful-restart - bgp graceful-restart preserve-fw-state - bgp graceful-restart select-defer-time 45 ! bgp router-id 10.1.0.32 ! @@ -66,10 +74,10 @@ router bgp 65100 ! ! address-family ipv4 - redistribute connected route-map HIDE_INTERNAL + redistribute connected route-map V4_CONNECTED_ROUTES exit-address-family address-family ipv6 - redistribute connected route-map HIDE_INTERNAL + redistribute connected route-map V6_CONNECTED_ROUTES exit-address-family ! address-family ipv4 diff --git a/src/sonic-config-engine/tests/sample_output/py2/buffer-arista7800r3-48cq2-lc.json b/src/sonic-config-engine/tests/sample_output/py2/buffer-arista7800r3-48cq2-lc.json new file mode 100644 index 000000000000..c05eca81eaaa --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py2/buffer-arista7800r3-48cq2-lc.json @@ -0,0 +1,590 @@ +{ + "CABLE_LENGTH": { + "AZURE": { + "Ethernet180": "5m", + "Ethernet8": "5m", + "Ethernet184": "5m", + "Ethernet188": "5m", + "Ethernet0": "5m", + "Ethernet4": "5m", + "Ethernet108": "5m", + "Ethernet100": "5m", + "Ethernet128": "5m", + "Ethernet104": "5m", + "Ethernet68": "5m", + "Ethernet96": "5m", + "Ethernet124": "5m", + "Ethernet148": "5m", + "Ethernet92": "5m", + "Ethernet120": "5m", + "Ethernet144": "5m", + "Ethernet52": "5m", + "Ethernet160": "5m", + "Ethernet140": "5m", + "Ethernet56": "5m", + "Ethernet164": "5m", + "Ethernet76": "5m", + "Ethernet72": "5m", + "Ethernet64": "5m", + "Ethernet32": "5m", + "Ethernet16": "5m", + "Ethernet36": "5m", + "Ethernet12": "5m", + "Ethernet168": "5m", + "Ethernet116": "5m", + "Ethernet80": "5m", + "Ethernet112": "5m", + "Ethernet84": "5m", + "Ethernet152": "5m", + "Ethernet136": "5m", + "Ethernet156": "5m", + "Ethernet132": "5m", + "Ethernet48": "5m", + "Ethernet172": "5m", + "Ethernet44": "5m", + "Ethernet176": "5m", + "Ethernet40": "5m", + "Ethernet28": "5m", + "Ethernet88": "5m", + "Ethernet60": "5m", + "Ethernet20": "5m", + "Ethernet24": "5m" + } + }, + + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "3220805000", + "type": "both", + "mode": "dynamic", + "xoff": "2102272" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"1280", + "dynamic_th":"-2", + "xon_offset":"2560", + "xon":"0", + "xoff":"66048" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "xon_offset":"0", + "static_th":"30535680" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"33030144" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"-1" + } + }, + "BUFFER_PG": { + "Ethernet180|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet8|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet184|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet188|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet0|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet4|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet108|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet100|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet128|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet104|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet68|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet96|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet124|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet148|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet92|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet120|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet144|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet52|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet140|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet56|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet164|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet76|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet72|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet64|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet32|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet16|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet36|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet12|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet88|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet116|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet80|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet112|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet84|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet152|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet136|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet156|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet132|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet48|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet44|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet176|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet40|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet28|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet60|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet20|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet24|0": { + "profile" : "ingress_lossy_profile" + } + }, + + "BUFFER_QUEUE": { + "Ethernet180|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet8|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet184|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet188|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet0|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet4|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet108|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet100|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet128|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet104|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet68|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet96|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet124|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet148|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet92|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet120|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet144|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet52|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet140|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet56|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet164|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet76|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet72|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet64|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet32|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet16|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet36|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet12|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet88|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet116|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet80|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet112|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet84|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet152|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet136|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet156|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet132|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet48|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet44|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet176|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet40|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet28|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet60|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet20|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet24|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet180|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet8|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet184|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet188|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet0|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet4|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet108|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet100|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet128|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet104|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet68|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet96|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet124|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet148|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet92|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet120|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet144|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet52|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet140|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet56|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet164|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet76|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet72|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet64|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet32|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet16|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet36|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet12|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet88|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet116|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet80|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet112|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet84|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet152|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet136|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet156|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet132|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet48|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet44|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet176|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet40|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet28|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet60|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet20|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet24|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet180|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet8|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet184|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet188|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet0|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet4|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet108|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet100|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet128|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet104|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet68|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet96|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet124|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet148|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet92|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet120|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet144|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet52|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet140|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet56|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet164|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet76|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet72|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet64|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet32|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet16|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet36|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet12|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet88|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet116|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet80|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet112|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet84|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet152|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet136|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet156|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet132|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet48|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet44|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet176|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet40|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet28|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet60|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet20|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet24|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/py2/buffers-dell6100.json b/src/sonic-config-engine/tests/sample_output/py2/buffers-dell6100.json index 90cf104ff473..be6292366e7b 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/buffers-dell6100.json +++ b/src/sonic-config-engine/tests/sample_output/py2/buffers-dell6100.json @@ -1,4 +1,3 @@ - { "CABLE_LENGTH": { "AZURE": { @@ -13,10 +12,11 @@ "Ethernet4": "5m", "Ethernet5": "5m", "Ethernet46": "5m", - "Ethernet34": "5m", + "Ethernet29": "5m", "Ethernet22": "5m", "Ethernet58": "5m", "Ethernet59": "5m", + "Ethernet28": "5m", "Ethernet50": "5m", "Ethernet51": "5m", "Ethernet52": "5m", @@ -41,6 +41,7 @@ "Ethernet32": "5m", "Ethernet33": "5m", "Ethernet30": "5m", + "Ethernet34": "5m", "Ethernet31": "5m", "Ethernet49": "5m", "Ethernet48": "5m", @@ -52,8 +53,8 @@ "Ethernet42": "5m", "Ethernet41": "5m", "Ethernet40": "5m", - "Ethernet29": "5m", - "Ethernet28": "5m", + "Ethernet65": "5m", + "Ethernet64": "5m", "Ethernet61": "5m", "Ethernet60": "5m", "Ethernet63": "5m", diff --git a/src/sonic-config-engine/tests/sample_output/py2/buffers-mellanox2410-dynamic.json b/src/sonic-config-engine/tests/sample_output/py2/buffers-mellanox2410-dynamic.json new file mode 100644 index 000000000000..1cb60747fc3e --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py2/buffers-mellanox2410-dynamic.json @@ -0,0 +1,1308 @@ +{ + "CABLE_LENGTH": { + "AZURE": { + "Ethernet180": "5m", + "Ethernet8": "300m", + "Ethernet44": "300m", + "Ethernet184": "5m", + "Ethernet188": "5m", + "Ethernet0": "300m", + "Ethernet4": "300m", + "Ethernet108": "40m", + "Ethernet100": "40m", + "Ethernet128": "5m", + "Ethernet104": "40m", + "Ethernet40": "300m", + "Ethernet96": "40m", + "Ethernet124": "40m", + "Ethernet148": "5m", + "Ethernet92": "40m", + "Ethernet120": "40m", + "Ethernet220": "5m", + "Ethernet144": "5m", + "Ethernet52": "300m", + "Ethernet160": "5m", + "Ethernet140": "5m", + "Ethernet56": "300m", + "Ethernet164": "5m", + "Ethernet76": "40m", + "Ethernet72": "40m", + "Ethernet64": "40m", + "Ethernet32": "300m", + "Ethernet16": "300m", + "Ethernet36": "300m", + "Ethernet12": "300m", + "Ethernet196": "5m", + "Ethernet192": "5m", + "Ethernet200": "5m", + "Ethernet68": "40m", + "Ethernet168": "5m", + "Ethernet24": "300m", + "Ethernet116": "40m", + "Ethernet80": "40m", + "Ethernet112": "40m", + "Ethernet84": "40m", + "Ethernet152": "5m", + "Ethernet136": "5m", + "Ethernet156": "5m", + "Ethernet204": "5m", + "Ethernet132": "5m", + "Ethernet48": "300m", + "Ethernet172": "5m", + "Ethernet216": "5m", + "Ethernet176": "5m", + "Ethernet212": "5m", + "Ethernet28": "300m", + "Ethernet88": "40m", + "Ethernet60": "300m", + "Ethernet20": "300m", + "Ethernet208": "5m" + } + }, + + "BUFFER_POOL": { + "ingress_lossless_pool": { + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "13945824", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "ingress_lossy_profile": { + "pool":"ingress_lossy_pool", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"9216", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"0", + "dynamic_th":"3" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "Ethernet8": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet0": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet4": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet108": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet100": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet104": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet96": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet124": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet92": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet120": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet52": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet56": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet76": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet72": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet32": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet16": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet36": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet12": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet28": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet88": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet24": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet116": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet80": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet112": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet84": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet48": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet44": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet40": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet64": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet60": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet20": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet68": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + } +, + "Ethernet180": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet184": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet188": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet128": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet148": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet220": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet144": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet160": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet140": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet164": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet196": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet192": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet200": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet168": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet152": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet136": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet156": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet204": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet132": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet172": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet216": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet176": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet212": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet208": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "Ethernet8": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet0": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet4": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet108": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet100": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet104": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet96": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet124": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet92": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet120": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet52": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet56": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet76": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet72": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet32": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet16": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet36": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet12": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet28": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet88": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet24": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet116": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet80": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet112": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet84": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet48": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet44": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet40": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet64": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet60": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet20": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet68": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + } +, + "Ethernet180": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet184": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet188": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet128": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet148": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet220": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet144": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet160": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet140": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet164": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet196": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet192": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet200": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet168": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet152": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet136": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet156": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet204": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet132": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet172": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet216": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet176": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet212": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet208": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + } + }, + "BUFFER_PG": { + "Ethernet8|3-4": { + "profile" : "NULL" + }, + "Ethernet8|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet0|3-4": { + "profile" : "NULL" + }, + "Ethernet0|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet4|3-4": { + "profile" : "NULL" + }, + "Ethernet4|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet108|3-4": { + "profile" : "NULL" + }, + "Ethernet108|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet100|3-4": { + "profile" : "NULL" + }, + "Ethernet100|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet104|3-4": { + "profile" : "NULL" + }, + "Ethernet104|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet96|3-4": { + "profile" : "NULL" + }, + "Ethernet96|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet124|3-4": { + "profile" : "NULL" + }, + "Ethernet124|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet92|3-4": { + "profile" : "NULL" + }, + "Ethernet92|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet120|3-4": { + "profile" : "NULL" + }, + "Ethernet120|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet52|3-4": { + "profile" : "NULL" + }, + "Ethernet52|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet56|3-4": { + "profile" : "NULL" + }, + "Ethernet56|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet76|3-4": { + "profile" : "NULL" + }, + "Ethernet76|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet72|3-4": { + "profile" : "NULL" + }, + "Ethernet72|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet32|3-4": { + "profile" : "NULL" + }, + "Ethernet32|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet16|3-4": { + "profile" : "NULL" + }, + "Ethernet16|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet36|3-4": { + "profile" : "NULL" + }, + "Ethernet36|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet12|3-4": { + "profile" : "NULL" + }, + "Ethernet12|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet28|3-4": { + "profile" : "NULL" + }, + "Ethernet28|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet88|3-4": { + "profile" : "NULL" + }, + "Ethernet88|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet24|3-4": { + "profile" : "NULL" + }, + "Ethernet24|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet116|3-4": { + "profile" : "NULL" + }, + "Ethernet116|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet80|3-4": { + "profile" : "NULL" + }, + "Ethernet80|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet112|3-4": { + "profile" : "NULL" + }, + "Ethernet112|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet84|3-4": { + "profile" : "NULL" + }, + "Ethernet84|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet48|3-4": { + "profile" : "NULL" + }, + "Ethernet48|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet44|3-4": { + "profile" : "NULL" + }, + "Ethernet44|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet40|3-4": { + "profile" : "NULL" + }, + "Ethernet40|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet64|3-4": { + "profile" : "NULL" + }, + "Ethernet64|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet60|3-4": { + "profile" : "NULL" + }, + "Ethernet60|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet20|3-4": { + "profile" : "NULL" + }, + "Ethernet20|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet68|3-4": { + "profile" : "NULL" + }, + "Ethernet68|0": { + "profile" : "ingress_lossy_profile" + } +, "Ethernet180|3-4": { + "profile" : "NULL" + }, + "Ethernet180|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet184|3-4": { + "profile" : "NULL" + }, + "Ethernet184|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet188|3-4": { + "profile" : "NULL" + }, + "Ethernet188|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet128|3-4": { + "profile" : "NULL" + }, + "Ethernet128|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet148|3-4": { + "profile" : "NULL" + }, + "Ethernet148|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet220|3-4": { + "profile" : "NULL" + }, + "Ethernet220|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet144|3-4": { + "profile" : "NULL" + }, + "Ethernet144|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet160|3-4": { + "profile" : "NULL" + }, + "Ethernet160|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet140|3-4": { + "profile" : "NULL" + }, + "Ethernet140|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet164|3-4": { + "profile" : "NULL" + }, + "Ethernet164|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet196|3-4": { + "profile" : "NULL" + }, + "Ethernet196|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet192|3-4": { + "profile" : "NULL" + }, + "Ethernet192|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet200|3-4": { + "profile" : "NULL" + }, + "Ethernet200|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet168|3-4": { + "profile" : "NULL" + }, + "Ethernet168|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet152|3-4": { + "profile" : "NULL" + }, + "Ethernet152|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet136|3-4": { + "profile" : "NULL" + }, + "Ethernet136|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet156|3-4": { + "profile" : "NULL" + }, + "Ethernet156|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet204|3-4": { + "profile" : "NULL" + }, + "Ethernet204|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet132|3-4": { + "profile" : "NULL" + }, + "Ethernet132|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet172|3-4": { + "profile" : "NULL" + }, + "Ethernet172|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet216|3-4": { + "profile" : "NULL" + }, + "Ethernet216|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet176|3-4": { + "profile" : "NULL" + }, + "Ethernet176|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet212|3-4": { + "profile" : "NULL" + }, + "Ethernet212|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet208|3-4": { + "profile" : "NULL" + }, + "Ethernet208|0": { + "profile" : "ingress_lossy_profile" + } + }, + + "BUFFER_QUEUE": { + "Ethernet8|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet0|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet4|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet108|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet100|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet104|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet96|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet124|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet92|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet120|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet52|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet56|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet76|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet72|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet32|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet16|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet36|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet12|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet28|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet88|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet24|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet116|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet80|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet112|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet84|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet48|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet44|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet40|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet64|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet60|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet20|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet68|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet8|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet0|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet4|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet108|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet100|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet104|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet96|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet124|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet92|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet120|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet52|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet56|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet76|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet72|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet32|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet16|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet36|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet12|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet28|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet88|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet24|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet116|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet80|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet112|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet84|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet48|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet44|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet40|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet64|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet60|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet20|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet68|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet8|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet0|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet4|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet108|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet100|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet104|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet96|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet124|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet92|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet120|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet52|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet56|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet76|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet72|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet32|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet16|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet36|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet12|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet28|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet88|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet24|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet116|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet80|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet112|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet84|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet48|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet44|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet40|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet64|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet60|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet20|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet68|5-6": { + "profile" : "q_lossy_profile" + } +, + "Ethernet180|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet184|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet188|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet128|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet148|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet220|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet144|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet160|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet140|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet164|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet196|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet192|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet200|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet168|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet152|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet136|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet156|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet204|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet132|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet172|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet216|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet176|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet212|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet208|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet180|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet184|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet188|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet128|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet148|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet220|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet144|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet160|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet140|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet164|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet196|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet192|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet200|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet168|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet152|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet136|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet156|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet204|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet132|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet172|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet216|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet176|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet212|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet208|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet180|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet184|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet188|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet128|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet148|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet220|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet144|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet160|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet140|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet164|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet196|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet192|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet200|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet168|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet152|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet136|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet156|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet204|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet132|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet172|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet216|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet176|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet212|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet208|5-6": { + "profile" : "q_lossy_profile" + } + } +, "DEFAULT_LOSSLESS_BUFFER_PARAMETER": { + "AZURE": { + "default_dynamic_th": "0" + } + }, + "LOSSLESS_TRAFFIC_PATTERN": { + "AZURE": { + "mtu": "1024", + "small_packet_percentage": "100" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/py2/buffers-mellanox2410.json b/src/sonic-config-engine/tests/sample_output/py2/buffers-mellanox2410.json new file mode 100644 index 000000000000..39cebfcdf8a7 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py2/buffers-mellanox2410.json @@ -0,0 +1,1162 @@ +{ + "CABLE_LENGTH": { + "AZURE": { + "Ethernet180": "5m", + "Ethernet8": "300m", + "Ethernet44": "300m", + "Ethernet184": "5m", + "Ethernet188": "5m", + "Ethernet0": "300m", + "Ethernet4": "300m", + "Ethernet108": "40m", + "Ethernet100": "40m", + "Ethernet128": "5m", + "Ethernet104": "40m", + "Ethernet40": "300m", + "Ethernet96": "40m", + "Ethernet124": "40m", + "Ethernet148": "5m", + "Ethernet92": "40m", + "Ethernet120": "40m", + "Ethernet220": "5m", + "Ethernet144": "5m", + "Ethernet52": "300m", + "Ethernet160": "5m", + "Ethernet140": "5m", + "Ethernet56": "300m", + "Ethernet164": "5m", + "Ethernet76": "40m", + "Ethernet72": "40m", + "Ethernet64": "40m", + "Ethernet32": "300m", + "Ethernet16": "300m", + "Ethernet36": "300m", + "Ethernet12": "300m", + "Ethernet196": "5m", + "Ethernet192": "5m", + "Ethernet200": "5m", + "Ethernet68": "40m", + "Ethernet168": "5m", + "Ethernet24": "300m", + "Ethernet116": "40m", + "Ethernet80": "40m", + "Ethernet112": "40m", + "Ethernet84": "40m", + "Ethernet152": "5m", + "Ethernet136": "5m", + "Ethernet156": "5m", + "Ethernet204": "5m", + "Ethernet132": "5m", + "Ethernet48": "300m", + "Ethernet172": "5m", + "Ethernet216": "5m", + "Ethernet176": "5m", + "Ethernet212": "5m", + "Ethernet28": "300m", + "Ethernet88": "40m", + "Ethernet60": "300m", + "Ethernet20": "300m", + "Ethernet208": "5m" + } + }, + + "BUFFER_POOL": { + "ingress_zero_pool" : { + "mode": "static", + "type": "ingress", + "size": "0" + }, + "ingress_lossless_pool": { + "size": "3302912", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "3302912", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "13945824", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "3302912", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_pg_zero_profile" : { + "pool":"ingress_zero_pool", + "size":"0", + "static_th":"0" + }, + "ingress_lossless_zero_profile" : { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"-8" + }, + "ingress_lossy_zero_profile" : { + "pool":"ingress_lossy_pool", + "size":"0", + "dynamic_th":"-8" + }, + "egress_lossless_zero_profile" : { + "pool":"egress_lossless_pool", + "size":"0", + "dynamic_th":"-8" + }, + "egress_lossy_zero_profile" : { + "pool":"egress_lossy_pool", + "size":"0", + "dynamic_th":"-8" + }, + "ingress_lossless_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "ingress_lossy_profile": { + "pool":"ingress_lossy_pool", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"9216", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"0", + "dynamic_th":"3" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "Ethernet8": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet0": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet4": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet108": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet100": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet104": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet96": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet124": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet92": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet120": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet52": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet56": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet76": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet72": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet32": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet16": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet36": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet12": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet28": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet88": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet24": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet116": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet80": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet112": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet84": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet48": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet44": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet40": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet64": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet60": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet20": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet68": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + } +, + "Ethernet180": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet184": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet188": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet128": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet148": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet220": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet144": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet160": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet140": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet164": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet196": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet192": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet200": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet168": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet152": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet136": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet156": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet204": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet132": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet172": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet216": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet176": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet212": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet208": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "Ethernet8": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet0": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet4": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet108": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet100": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet104": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet96": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet124": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet92": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet120": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet52": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet56": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet76": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet72": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet32": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet16": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet36": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet12": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet28": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet88": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet24": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet116": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet80": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet112": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet84": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet48": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet44": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet40": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet64": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet60": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet20": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet68": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + } +, + "Ethernet180": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet184": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet188": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet128": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet148": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet220": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet144": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet160": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet140": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet164": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet196": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet192": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet200": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet168": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet152": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet136": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet156": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet204": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet132": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet172": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet216": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet176": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet212": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet208": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + } + }, + "BUFFER_PG": { + "Ethernet8|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet0|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet4|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet108|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet100|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet104|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet96|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet124|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet92|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet120|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet52|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet56|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet76|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet72|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet32|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet16|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet36|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet12|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet28|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet88|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet24|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet116|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet80|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet112|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet84|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet48|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet44|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet40|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet64|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet60|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet20|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet68|0": { + "profile" : "ingress_lossy_profile" + } +, "Ethernet180|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet184|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet188|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet128|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet148|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet220|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet144|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet160|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet140|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet164|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet196|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet192|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet200|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet168|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet152|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet136|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet156|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet204|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet132|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet172|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet216|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet176|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet212|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet208|0": { + "profile" : "ingress_lossy_pg_zero_profile" + } + }, + + "BUFFER_QUEUE": { + "Ethernet8|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet0|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet4|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet108|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet100|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet104|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet96|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet124|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet92|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet120|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet52|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet56|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet76|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet72|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet32|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet16|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet36|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet12|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet28|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet88|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet24|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet116|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet80|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet112|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet84|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet48|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet44|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet40|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet64|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet60|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet20|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet68|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet8|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet0|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet4|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet108|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet100|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet104|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet96|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet124|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet92|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet120|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet52|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet56|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet76|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet72|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet32|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet16|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet36|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet12|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet28|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet88|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet24|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet116|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet80|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet112|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet84|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet48|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet44|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet40|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet64|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet60|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet20|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet68|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet8|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet0|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet4|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet108|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet100|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet104|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet96|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet124|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet92|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet120|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet52|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet56|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet76|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet72|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet32|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet16|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet36|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet12|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet28|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet88|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet24|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet116|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet80|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet112|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet84|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet48|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet44|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet40|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet64|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet60|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet20|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet68|5-6": { + "profile" : "q_lossy_profile" + } +, + "Ethernet180|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet184|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet188|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet128|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet148|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet220|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet144|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet160|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet140|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet164|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet196|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet192|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet200|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet168|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet152|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet136|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet156|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet204|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet132|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet172|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet216|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet176|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet212|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet208|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet180|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet184|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet188|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet128|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet148|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet220|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet144|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet160|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet140|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet164|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet196|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet192|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet200|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet168|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet152|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet136|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet156|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet204|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet132|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet172|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet216|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet176|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet212|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet208|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet180|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet184|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet188|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet128|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet148|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet220|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet144|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet160|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet140|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet164|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet196|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet192|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet200|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet168|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet152|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet136|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet156|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet204|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet132|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet172|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet216|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet176|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet212|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet208|5-6": { + "profile" : "egress_lossy_zero_profile" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/py2/buffers-mellanox2700.json b/src/sonic-config-engine/tests/sample_output/py2/buffers-mellanox2700.json new file mode 100644 index 000000000000..ea9fe0c9ea89 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py2/buffers-mellanox2700.json @@ -0,0 +1,1153 @@ +{ + "CABLE_LENGTH": { + "AZURE": { + "Ethernet8": "5m", + "Ethernet2": "5m", + "Ethernet0": "5m", + "Ethernet6": "5m", + "Ethernet4": "5m", + "Ethernet108": "5m", + "Ethernet100": "5m", + "Ethernet104": "5m", + "Ethernet106": "5m", + "Ethernet58": "5m", + "Ethernet126": "5m", + "Ethernet96": "5m", + "Ethernet124": "5m", + "Ethernet122": "5m", + "Ethernet92": "5m", + "Ethernet120": "5m", + "Ethernet50": "5m", + "Ethernet52": "5m", + "Ethernet54": "5m", + "Ethernet56": "5m", + "Ethernet76": "5m", + "Ethernet74": "5m", + "Ethernet18": "5m", + "Ethernet70": "40m", + "Ethernet32": "5m", + "Ethernet72": "5m", + "Ethernet16": "5m", + "Ethernet36": "5m", + "Ethernet78": "5m", + "Ethernet60": "5m", + "Ethernet28": "5m", + "Ethernet62": "5m", + "Ethernet14": "5m", + "Ethernet88": "5m", + "Ethernet118": "5m", + "Ethernet24": "5m", + "Ethernet116": "5m", + "Ethernet82": "5m", + "Ethernet114": "5m", + "Ethernet80": "5m", + "Ethernet112": "5m", + "Ethernet86": "5m", + "Ethernet110": "5m", + "Ethernet84": "5m", + "Ethernet48": "5m", + "Ethernet10": "5m", + "Ethernet44": "5m", + "Ethernet42": "5m", + "Ethernet40": "5m", + "Ethernet64": "40m", + "Ethernet66": "40m", + "Ethernet12": "5m", + "Ethernet46": "5m", + "Ethernet20": "5m", + "Ethernet22": "5m", + "Ethernet68": "40m" + } + }, + + "BUFFER_POOL": { + "ingress_zero_pool" : { + "mode": "static", + "type": "ingress", + "size": "0" + }, + "ingress_lossless_pool": { + "size": "7719936", + "xoff": "1032192", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "13945824", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "7719936", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_pg_zero_profile" : { + "pool":"ingress_zero_pool", + "size":"0", + "static_th":"0" + }, + "ingress_lossless_zero_profile" : { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"-8" + }, + "egress_lossless_zero_profile" : { + "pool":"egress_lossless_pool", + "size":"0", + "dynamic_th":"-8" + }, + "egress_lossy_zero_profile" : { + "pool":"egress_lossy_pool", + "size":"0", + "dynamic_th":"-8" + }, + "ingress_lossless_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"9216", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"0", + "dynamic_th":"3" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "Ethernet8": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet2": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet6": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet4": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet28": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet50": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet52": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet54": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet56": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet18": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet70": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet14": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet16": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet10": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet12": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet32": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet24": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet48": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet36": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet44": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet42": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet40": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet64": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet66": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet46": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet20": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet22": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet68": { + "profile_list" : "ingress_lossless_profile" + } +, + "Ethernet0": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet108": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet100": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet104": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet106": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet58": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet126": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet96": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet124": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet122": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet92": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet120": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet76": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet74": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet72": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet78": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet60": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet62": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet88": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet118": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet116": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet82": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet114": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet80": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet112": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet86": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet110": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet84": { + "profile_list" : "ingress_lossless_zero_profile" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "Ethernet8": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet2": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet6": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet4": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet28": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet50": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet52": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet54": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet56": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet18": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet70": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet14": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet16": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet10": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet12": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet32": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet24": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet48": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet36": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet44": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet42": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet40": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet64": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet66": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet46": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet20": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet22": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet68": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + } +, + "Ethernet0": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet108": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet100": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet104": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet106": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet58": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet126": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet96": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet124": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet122": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet92": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet120": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet76": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet74": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet72": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet78": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet60": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet62": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet88": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet118": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet116": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet82": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet114": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet80": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet112": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet86": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet110": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet84": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + } + }, + "BUFFER_PG": { + "Ethernet8|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet2|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet6|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet4|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet28|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet50|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet52|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet54|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet56|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet18|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet70|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet14|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet16|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet10|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet12|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet32|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet24|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet48|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet36|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet44|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet42|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet40|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet64|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet66|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet46|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet20|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet22|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet68|0": { + "profile" : "ingress_lossy_profile" + } +, "Ethernet0|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet108|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet100|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet104|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet106|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet58|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet126|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet96|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet124|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet122|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet92|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet120|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet76|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet74|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet72|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet78|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet60|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet62|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet88|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet118|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet116|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet82|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet114|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet80|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet112|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet86|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet110|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet84|0": { + "profile" : "ingress_lossy_pg_zero_profile" + } + }, + + "BUFFER_QUEUE": { + "Ethernet8|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet2|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet6|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet4|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet28|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet50|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet52|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet54|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet56|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet18|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet70|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet14|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet16|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet10|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet12|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet32|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet24|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet48|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet36|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet44|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet42|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet40|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet64|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet66|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet46|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet20|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet22|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet68|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet8|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet2|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet6|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet4|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet28|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet50|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet52|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet54|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet56|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet18|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet70|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet14|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet16|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet10|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet12|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet32|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet24|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet48|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet36|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet44|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet42|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet40|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet64|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet66|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet46|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet20|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet22|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet68|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet8|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet2|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet6|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet4|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet28|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet50|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet52|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet54|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet56|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet18|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet70|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet14|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet16|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet10|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet12|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet32|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet24|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet48|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet36|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet44|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet42|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet40|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet64|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet66|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet46|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet20|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet22|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet68|5-6": { + "profile" : "q_lossy_profile" + } +, + "Ethernet0|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet108|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet100|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet104|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet106|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet58|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet126|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet96|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet124|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet122|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet92|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet120|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet76|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet74|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet72|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet78|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet60|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet62|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet88|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet118|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet116|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet82|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet114|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet80|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet112|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet86|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet110|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet84|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet0|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet108|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet100|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet104|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet106|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet58|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet126|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet96|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet124|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet122|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet92|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet120|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet76|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet74|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet72|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet78|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet60|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet62|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet88|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet118|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet116|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet82|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet114|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet80|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet112|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet86|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet110|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet84|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet0|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet108|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet100|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet104|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet106|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet58|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet126|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet96|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet124|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet122|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet92|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet120|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet76|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet74|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet72|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet78|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet60|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet62|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet88|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet118|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet116|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet82|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet114|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet80|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet112|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet86|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet110|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet84|5-6": { + "profile" : "egress_lossy_zero_profile" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/py2/frr.conf b/src/sonic-config-engine/tests/sample_output/py2/frr.conf index 707551c6942e..7d985db93b97 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/frr.conf @@ -35,10 +35,6 @@ link-detect ! !! ! -! set static default route to mgmt gateway as a backup to learned default -ip route 0.0.0.0/0 10.0.0.1 200 -!! -! ! ! add static ipv6 /64 loopback route to allow bgpd to advertise the loopback route prefix ipv6 route fc00:1::/64 Loopback0 diff --git a/src/sonic-config-engine/tests/sample_output/py2/l1_intfs.json b/src/sonic-config-engine/tests/sample_output/py2/l1_intfs.json index bc2d533e87a1..634b936fede0 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/l1_intfs.json +++ b/src/sonic-config-engine/tests/sample_output/py2/l1_intfs.json @@ -257,5 +257,12 @@ "mtu": "9100", "speed": "100000" } + }, + "FLEX_COUNTER_TABLE": { + "ACL": { + "FLEX_COUNTER_STATUS": "disable", + "FLEX_COUNTER_DELAY_STATUS": "true", + "POLL_INTERVAL": "10000" + } } } diff --git a/src/sonic-config-engine/tests/sample_output/py2/l2switch.json b/src/sonic-config-engine/tests/sample_output/py2/l2switch.json index 1c9e0ebbcd2e..5c38ba7201fd 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/l2switch.json +++ b/src/sonic-config-engine/tests/sample_output/py2/l2switch.json @@ -264,5 +264,12 @@ "Vlan1000|Ethernet24": { "tagging_mode": "untagged" } + }, + "FLEX_COUNTER_TABLE": { + "ACL": { + "FLEX_COUNTER_STATUS": "disable", + "FLEX_COUNTER_DELAY_STATUS": "true", + "POLL_INTERVAL": "10000" + } } } diff --git a/src/sonic-config-engine/tests/sample_output/py2/l2switch_dualtor.json b/src/sonic-config-engine/tests/sample_output/py2/l2switch_dualtor.json index 44edd892ab91..606a30672d9e 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/l2switch_dualtor.json +++ b/src/sonic-config-engine/tests/sample_output/py2/l2switch_dualtor.json @@ -643,5 +643,12 @@ "server_ipv6": "fc02:1000::19/128", "state": "auto" } + }, + "FLEX_COUNTER_TABLE": { + "ACL": { + "FLEX_COUNTER_STATUS": "disable", + "FLEX_COUNTER_DELAY_STATUS": "true", + "POLL_INTERVAL": "10000" + } } } diff --git a/src/sonic-config-engine/tests/sample_output/py2/l3_intfs.json b/src/sonic-config-engine/tests/sample_output/py2/l3_intfs.json index 9ca31832303f..7357c28fbef1 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/l3_intfs.json +++ b/src/sonic-config-engine/tests/sample_output/py2/l3_intfs.json @@ -297,5 +297,12 @@ "Ethernet29": {}, "Ethernet30": {}, "Ethernet31": {} + }, + "FLEX_COUNTER_TABLE": { + "ACL": { + "FLEX_COUNTER_STATUS": "disable", + "FLEX_COUNTER_DELAY_STATUS": "true", + "POLL_INTERVAL": "10000" + } } } diff --git a/src/sonic-config-engine/tests/sample_output/py2/ports.json b/src/sonic-config-engine/tests/sample_output/py2/ports.json index 4b36790c7cd0..959a234eaace 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/ports.json +++ b/src/sonic-config-engine/tests/sample_output/py2/ports.json @@ -20,6 +20,104 @@ }, "OP": "SET" }, + { + "PORT_TABLE:Ethernet108": { + "speed": "100000", + "description": "fortyGigE0/108" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet100": { + "speed": "100000", + "description": "fortyGigE0/100" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet104": { + "speed": "100000", + "description": "fortyGigE0/104" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet68": { + "speed": "100000", + "description": "fortyGigE0/68" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet96": { + "speed": "100000", + "description": "fortyGigE0/96" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet124": { + "speed": "100000", + "description": "fortyGigE0/124" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet92": { + "speed": "100000", + "description": "fortyGigE0/92" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet120": { + "speed": "100000", + "description": "fortyGigE0/120" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet52": { + "speed": "100000", + "description": "fortyGigE0/52" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet56": { + "speed": "100000", + "description": "fortyGigE0/56" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet76": { + "speed": "100000", + "description": "fortyGigE0/76" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet72": { + "speed": "100000", + "description": "fortyGigE0/72" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet64": { + "speed": "100000", + "description": "fortyGigE0/64" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet32": { + "speed": "100000", + "description": "fortyGigE0/32" + }, + "OP": "SET" + }, { "PORT_TABLE:Ethernet16": { "speed": "1000", @@ -27,11 +125,102 @@ }, "OP": "SET" }, + { + "PORT_TABLE:Ethernet36": { + "speed": "100000", + "description": "fortyGigE0/36" + }, + "OP": "SET" + }, { "PORT_TABLE:Ethernet12": { "speed": "100000", "description": "Interface description" }, "OP": "SET" + }, + { + "PORT_TABLE:Ethernet88": { + "speed": "100000", + "description": "fortyGigE0/88" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet116": { + "speed": "100000", + "description": "fortyGigE0/116" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet80": { + "speed": "100000", + "description": "fortyGigE0/80" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet112": { + "speed": "100000", + "description": "fortyGigE0/112" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet84": { + "speed": "100000", + "description": "fortyGigE0/84" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet48": { + "speed": "100000", + "description": "fortyGigE0/48" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet44": { + "speed": "100000", + "description": "fortyGigE0/44" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet40": { + "speed": "100000", + "description": "fortyGigE0/40" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet28": { + "speed": "100000", + "description": "fortyGigE0/28" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet60": { + "speed": "100000", + "description": "fortyGigE0/60" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet20": { + "speed": "100000", + "description": "fortyGigE0/20" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet24": { + "speed": "100000", + "description": "fortyGigE0/24" + }, + "OP": "SET" } ] diff --git a/src/sonic-config-engine/tests/sample_output/py2/qos-arista7050.json b/src/sonic-config-engine/tests/sample_output/py2/qos-arista7050.json index 9a6f8a2ada78..b15fcf7a36c1 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/qos-arista7050.json +++ b/src/sonic-config-engine/tests/sample_output/py2/qos-arista7050.json @@ -119,196 +119,224 @@ "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet8": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet12": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet16": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet20": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet24": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet28": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet32": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet36": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet40": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet44": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet48": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet52": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet56": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet60": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet64": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet68": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet72": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet76": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet80": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet84": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet88": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet92": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet96": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet112": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet116": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet120": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet124": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" } }, "WRED_PROFILE": { diff --git a/src/sonic-config-engine/tests/sample_output/py2/qos-arista7800r3-48cq2-lc.json b/src/sonic-config-engine/tests/sample_output/py2/qos-arista7800r3-48cq2-lc.json new file mode 100644 index 000000000000..92ba2caf8d17 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py2/qos-arista7800r3-48cq2-lc.json @@ -0,0 +1,1532 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "7" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "2", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "1", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "6", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type" : "DWRR", + "weight": "14" + }, + "scheduler.1": { + "type" : "DWRR", + "weight": "15" + } + }, + "PORT_QOS_MAP": { + "Ethernet0": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet4": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet8": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet12": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet16": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet20": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet24": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet28": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet32": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet36": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet40": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet44": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet48": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet52": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet56": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet60": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet64": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet68": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet72": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet76": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet80": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet84": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet88": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet92": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet96": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet100": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet104": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet108": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet112": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet116": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet120": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet124": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet128": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet132": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet136": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet140": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet144": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet148": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet152": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet156": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet164": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet176": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet180": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet184": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet188": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable" : "true", + "wred_yellow_enable" : "true", + "wred_red_enable" : "true", + "ecn" : "ecn_all", + "green_max_threshold" : "2097152", + "green_min_threshold" : "250000", + "yellow_max_threshold" : "2097152", + "yellow_min_threshold" : "1048576", + "red_max_threshold" : "2097152", + "red_min_threshold" : "1048576", + "green_drop_probability" : "5", + "yellow_drop_probability": "5", + "red_drop_probability" : "5" + } + }, + "QUEUE": { + "Ethernet0|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet4|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet8|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet12|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet16|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet20|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet24|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet28|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet32|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet36|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet40|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet44|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet48|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet52|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet56|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet60|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet64|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet68|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet72|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet76|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet80|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet84|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet88|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet92|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet96|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet100|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet104|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet108|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet112|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet116|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet120|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet124|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet128|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet132|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet136|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet140|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet144|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet148|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet152|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet156|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet164|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet176|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet180|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet184|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet188|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet0|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet4|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet8|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet12|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet16|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet20|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet24|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet28|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet32|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet36|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet40|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet44|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet48|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet52|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet56|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet60|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet64|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet68|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet72|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet76|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet80|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet84|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet88|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet92|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet96|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet100|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet104|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet108|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet112|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet116|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet120|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet124|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet128|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet132|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet136|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet140|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet144|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet148|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet152|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet156|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet164|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet176|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet180|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet184|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet188|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet0|0": { + "scheduler": "scheduler.0" + }, + "Ethernet4|0": { + "scheduler": "scheduler.0" + }, + "Ethernet8|0": { + "scheduler": "scheduler.0" + }, + "Ethernet12|0": { + "scheduler": "scheduler.0" + }, + "Ethernet16|0": { + "scheduler": "scheduler.0" + }, + "Ethernet20|0": { + "scheduler": "scheduler.0" + }, + "Ethernet24|0": { + "scheduler": "scheduler.0" + }, + "Ethernet28|0": { + "scheduler": "scheduler.0" + }, + "Ethernet32|0": { + "scheduler": "scheduler.0" + }, + "Ethernet36|0": { + "scheduler": "scheduler.0" + }, + "Ethernet40|0": { + "scheduler": "scheduler.0" + }, + "Ethernet44|0": { + "scheduler": "scheduler.0" + }, + "Ethernet48|0": { + "scheduler": "scheduler.0" + }, + "Ethernet52|0": { + "scheduler": "scheduler.0" + }, + "Ethernet56|0": { + "scheduler": "scheduler.0" + }, + "Ethernet60|0": { + "scheduler": "scheduler.0" + }, + "Ethernet64|0": { + "scheduler": "scheduler.0" + }, + "Ethernet68|0": { + "scheduler": "scheduler.0" + }, + "Ethernet72|0": { + "scheduler": "scheduler.0" + }, + "Ethernet76|0": { + "scheduler": "scheduler.0" + }, + "Ethernet80|0": { + "scheduler": "scheduler.0" + }, + "Ethernet84|0": { + "scheduler": "scheduler.0" + }, + "Ethernet88|0": { + "scheduler": "scheduler.0" + }, + "Ethernet92|0": { + "scheduler": "scheduler.0" + }, + "Ethernet96|0": { + "scheduler": "scheduler.0" + }, + "Ethernet100|0": { + "scheduler": "scheduler.0" + }, + "Ethernet104|0": { + "scheduler": "scheduler.0" + }, + "Ethernet108|0": { + "scheduler": "scheduler.0" + }, + "Ethernet112|0": { + "scheduler": "scheduler.0" + }, + "Ethernet116|0": { + "scheduler": "scheduler.0" + }, + "Ethernet120|0": { + "scheduler": "scheduler.0" + }, + "Ethernet124|0": { + "scheduler": "scheduler.0" + }, + "Ethernet128|0": { + "scheduler": "scheduler.0" + }, + "Ethernet132|0": { + "scheduler": "scheduler.0" + }, + "Ethernet136|0": { + "scheduler": "scheduler.0" + }, + "Ethernet140|0": { + "scheduler": "scheduler.0" + }, + "Ethernet144|0": { + "scheduler": "scheduler.0" + }, + "Ethernet148|0": { + "scheduler": "scheduler.0" + }, + "Ethernet152|0": { + "scheduler": "scheduler.0" + }, + "Ethernet156|0": { + "scheduler": "scheduler.0" + }, + "Ethernet164|0": { + "scheduler": "scheduler.0" + }, + "Ethernet176|0": { + "scheduler": "scheduler.0" + }, + "Ethernet180|0": { + "scheduler": "scheduler.0" + }, + "Ethernet184|0": { + "scheduler": "scheduler.0" + }, + "Ethernet188|0": { + "scheduler": "scheduler.0" + }, + "Ethernet0|1": { + "scheduler": "scheduler.0" + }, + "Ethernet4|1": { + "scheduler": "scheduler.0" + }, + "Ethernet8|1": { + "scheduler": "scheduler.0" + }, + "Ethernet12|1": { + "scheduler": "scheduler.0" + }, + "Ethernet16|1": { + "scheduler": "scheduler.0" + }, + "Ethernet20|1": { + "scheduler": "scheduler.0" + }, + "Ethernet24|1": { + "scheduler": "scheduler.0" + }, + "Ethernet28|1": { + "scheduler": "scheduler.0" + }, + "Ethernet32|1": { + "scheduler": "scheduler.0" + }, + "Ethernet36|1": { + "scheduler": "scheduler.0" + }, + "Ethernet40|1": { + "scheduler": "scheduler.0" + }, + "Ethernet44|1": { + "scheduler": "scheduler.0" + }, + "Ethernet48|1": { + "scheduler": "scheduler.0" + }, + "Ethernet52|1": { + "scheduler": "scheduler.0" + }, + "Ethernet56|1": { + "scheduler": "scheduler.0" + }, + "Ethernet60|1": { + "scheduler": "scheduler.0" + }, + "Ethernet64|1": { + "scheduler": "scheduler.0" + }, + "Ethernet68|1": { + "scheduler": "scheduler.0" + }, + "Ethernet72|1": { + "scheduler": "scheduler.0" + }, + "Ethernet76|1": { + "scheduler": "scheduler.0" + }, + "Ethernet80|1": { + "scheduler": "scheduler.0" + }, + "Ethernet84|1": { + "scheduler": "scheduler.0" + }, + "Ethernet88|1": { + "scheduler": "scheduler.0" + }, + "Ethernet92|1": { + "scheduler": "scheduler.0" + }, + "Ethernet96|1": { + "scheduler": "scheduler.0" + }, + "Ethernet100|1": { + "scheduler": "scheduler.0" + }, + "Ethernet104|1": { + "scheduler": "scheduler.0" + }, + "Ethernet108|1": { + "scheduler": "scheduler.0" + }, + "Ethernet112|1": { + "scheduler": "scheduler.0" + }, + "Ethernet116|1": { + "scheduler": "scheduler.0" + }, + "Ethernet120|1": { + "scheduler": "scheduler.0" + }, + "Ethernet124|1": { + "scheduler": "scheduler.0" + }, + "Ethernet128|1": { + "scheduler": "scheduler.0" + }, + "Ethernet132|1": { + "scheduler": "scheduler.0" + }, + "Ethernet136|1": { + "scheduler": "scheduler.0" + }, + "Ethernet140|1": { + "scheduler": "scheduler.0" + }, + "Ethernet144|1": { + "scheduler": "scheduler.0" + }, + "Ethernet148|1": { + "scheduler": "scheduler.0" + }, + "Ethernet152|1": { + "scheduler": "scheduler.0" + }, + "Ethernet156|1": { + "scheduler": "scheduler.0" + }, + "Ethernet164|1": { + "scheduler": "scheduler.0" + }, + "Ethernet176|1": { + "scheduler": "scheduler.0" + }, + "Ethernet180|1": { + "scheduler": "scheduler.0" + }, + "Ethernet184|1": { + "scheduler": "scheduler.0" + }, + "Ethernet188|1": { + "scheduler": "scheduler.0" + }, + "Ethernet0|2": { + "scheduler": "scheduler.0" + }, + "Ethernet4|2": { + "scheduler": "scheduler.0" + }, + "Ethernet8|2": { + "scheduler": "scheduler.0" + }, + "Ethernet12|2": { + "scheduler": "scheduler.0" + }, + "Ethernet16|2": { + "scheduler": "scheduler.0" + }, + "Ethernet20|2": { + "scheduler": "scheduler.0" + }, + "Ethernet24|2": { + "scheduler": "scheduler.0" + }, + "Ethernet28|2": { + "scheduler": "scheduler.0" + }, + "Ethernet32|2": { + "scheduler": "scheduler.0" + }, + "Ethernet36|2": { + "scheduler": "scheduler.0" + }, + "Ethernet40|2": { + "scheduler": "scheduler.0" + }, + "Ethernet44|2": { + "scheduler": "scheduler.0" + }, + "Ethernet48|2": { + "scheduler": "scheduler.0" + }, + "Ethernet52|2": { + "scheduler": "scheduler.0" + }, + "Ethernet56|2": { + "scheduler": "scheduler.0" + }, + "Ethernet60|2": { + "scheduler": "scheduler.0" + }, + "Ethernet64|2": { + "scheduler": "scheduler.0" + }, + "Ethernet68|2": { + "scheduler": "scheduler.0" + }, + "Ethernet72|2": { + "scheduler": "scheduler.0" + }, + "Ethernet76|2": { + "scheduler": "scheduler.0" + }, + "Ethernet80|2": { + "scheduler": "scheduler.0" + }, + "Ethernet84|2": { + "scheduler": "scheduler.0" + }, + "Ethernet88|2": { + "scheduler": "scheduler.0" + }, + "Ethernet92|2": { + "scheduler": "scheduler.0" + }, + "Ethernet96|2": { + "scheduler": "scheduler.0" + }, + "Ethernet100|2": { + "scheduler": "scheduler.0" + }, + "Ethernet104|2": { + "scheduler": "scheduler.0" + }, + "Ethernet108|2": { + "scheduler": "scheduler.0" + }, + "Ethernet112|2": { + "scheduler": "scheduler.0" + }, + "Ethernet116|2": { + "scheduler": "scheduler.0" + }, + "Ethernet120|2": { + "scheduler": "scheduler.0" + }, + "Ethernet124|2": { + "scheduler": "scheduler.0" + }, + "Ethernet128|2": { + "scheduler": "scheduler.0" + }, + "Ethernet132|2": { + "scheduler": "scheduler.0" + }, + "Ethernet136|2": { + "scheduler": "scheduler.0" + }, + "Ethernet140|2": { + "scheduler": "scheduler.0" + }, + "Ethernet144|2": { + "scheduler": "scheduler.0" + }, + "Ethernet148|2": { + "scheduler": "scheduler.0" + }, + "Ethernet152|2": { + "scheduler": "scheduler.0" + }, + "Ethernet156|2": { + "scheduler": "scheduler.0" + }, + "Ethernet164|2": { + "scheduler": "scheduler.0" + }, + "Ethernet176|2": { + "scheduler": "scheduler.0" + }, + "Ethernet180|2": { + "scheduler": "scheduler.0" + }, + "Ethernet184|2": { + "scheduler": "scheduler.0" + }, + "Ethernet188|2": { + "scheduler": "scheduler.0" + }, + "Ethernet0|5": { + "scheduler": "scheduler.0" + }, + "Ethernet4|5": { + "scheduler": "scheduler.0" + }, + "Ethernet8|5": { + "scheduler": "scheduler.0" + }, + "Ethernet12|5": { + "scheduler": "scheduler.0" + }, + "Ethernet16|5": { + "scheduler": "scheduler.0" + }, + "Ethernet20|5": { + "scheduler": "scheduler.0" + }, + "Ethernet24|5": { + "scheduler": "scheduler.0" + }, + "Ethernet28|5": { + "scheduler": "scheduler.0" + }, + "Ethernet32|5": { + "scheduler": "scheduler.0" + }, + "Ethernet36|5": { + "scheduler": "scheduler.0" + }, + "Ethernet40|5": { + "scheduler": "scheduler.0" + }, + "Ethernet44|5": { + "scheduler": "scheduler.0" + }, + "Ethernet48|5": { + "scheduler": "scheduler.0" + }, + "Ethernet52|5": { + "scheduler": "scheduler.0" + }, + "Ethernet56|5": { + "scheduler": "scheduler.0" + }, + "Ethernet60|5": { + "scheduler": "scheduler.0" + }, + "Ethernet64|5": { + "scheduler": "scheduler.0" + }, + "Ethernet68|5": { + "scheduler": "scheduler.0" + }, + "Ethernet72|5": { + "scheduler": "scheduler.0" + }, + "Ethernet76|5": { + "scheduler": "scheduler.0" + }, + "Ethernet80|5": { + "scheduler": "scheduler.0" + }, + "Ethernet84|5": { + "scheduler": "scheduler.0" + }, + "Ethernet88|5": { + "scheduler": "scheduler.0" + }, + "Ethernet92|5": { + "scheduler": "scheduler.0" + }, + "Ethernet96|5": { + "scheduler": "scheduler.0" + }, + "Ethernet100|5": { + "scheduler": "scheduler.0" + }, + "Ethernet104|5": { + "scheduler": "scheduler.0" + }, + "Ethernet108|5": { + "scheduler": "scheduler.0" + }, + "Ethernet112|5": { + "scheduler": "scheduler.0" + }, + "Ethernet116|5": { + "scheduler": "scheduler.0" + }, + "Ethernet120|5": { + "scheduler": "scheduler.0" + }, + "Ethernet124|5": { + "scheduler": "scheduler.0" + }, + "Ethernet128|5": { + "scheduler": "scheduler.0" + }, + "Ethernet132|5": { + "scheduler": "scheduler.0" + }, + "Ethernet136|5": { + "scheduler": "scheduler.0" + }, + "Ethernet140|5": { + "scheduler": "scheduler.0" + }, + "Ethernet144|5": { + "scheduler": "scheduler.0" + }, + "Ethernet148|5": { + "scheduler": "scheduler.0" + }, + "Ethernet152|5": { + "scheduler": "scheduler.0" + }, + "Ethernet156|5": { + "scheduler": "scheduler.0" + }, + "Ethernet164|5": { + "scheduler": "scheduler.0" + }, + "Ethernet176|5": { + "scheduler": "scheduler.0" + }, + "Ethernet180|5": { + "scheduler": "scheduler.0" + }, + "Ethernet184|5": { + "scheduler": "scheduler.0" + }, + "Ethernet188|5": { + "scheduler": "scheduler.0" + }, + "Ethernet0|6": { + "scheduler": "scheduler.0" + }, + "Ethernet4|6": { + "scheduler": "scheduler.0" + }, + "Ethernet8|6": { + "scheduler": "scheduler.0" + }, + "Ethernet12|6": { + "scheduler": "scheduler.0" + }, + "Ethernet16|6": { + "scheduler": "scheduler.0" + }, + "Ethernet20|6": { + "scheduler": "scheduler.0" + }, + "Ethernet24|6": { + "scheduler": "scheduler.0" + }, + "Ethernet28|6": { + "scheduler": "scheduler.0" + }, + "Ethernet32|6": { + "scheduler": "scheduler.0" + }, + "Ethernet36|6": { + "scheduler": "scheduler.0" + }, + "Ethernet40|6": { + "scheduler": "scheduler.0" + }, + "Ethernet44|6": { + "scheduler": "scheduler.0" + }, + "Ethernet48|6": { + "scheduler": "scheduler.0" + }, + "Ethernet52|6": { + "scheduler": "scheduler.0" + }, + "Ethernet56|6": { + "scheduler": "scheduler.0" + }, + "Ethernet60|6": { + "scheduler": "scheduler.0" + }, + "Ethernet64|6": { + "scheduler": "scheduler.0" + }, + "Ethernet68|6": { + "scheduler": "scheduler.0" + }, + "Ethernet72|6": { + "scheduler": "scheduler.0" + }, + "Ethernet76|6": { + "scheduler": "scheduler.0" + }, + "Ethernet80|6": { + "scheduler": "scheduler.0" + }, + "Ethernet84|6": { + "scheduler": "scheduler.0" + }, + "Ethernet88|6": { + "scheduler": "scheduler.0" + }, + "Ethernet92|6": { + "scheduler": "scheduler.0" + }, + "Ethernet96|6": { + "scheduler": "scheduler.0" + }, + "Ethernet100|6": { + "scheduler": "scheduler.0" + }, + "Ethernet104|6": { + "scheduler": "scheduler.0" + }, + "Ethernet108|6": { + "scheduler": "scheduler.0" + }, + "Ethernet112|6": { + "scheduler": "scheduler.0" + }, + "Ethernet116|6": { + "scheduler": "scheduler.0" + }, + "Ethernet120|6": { + "scheduler": "scheduler.0" + }, + "Ethernet124|6": { + "scheduler": "scheduler.0" + }, + "Ethernet128|6": { + "scheduler": "scheduler.0" + }, + "Ethernet132|6": { + "scheduler": "scheduler.0" + }, + "Ethernet136|6": { + "scheduler": "scheduler.0" + }, + "Ethernet140|6": { + "scheduler": "scheduler.0" + }, + "Ethernet144|6": { + "scheduler": "scheduler.0" + }, + "Ethernet148|6": { + "scheduler": "scheduler.0" + }, + "Ethernet152|6": { + "scheduler": "scheduler.0" + }, + "Ethernet156|6": { + "scheduler": "scheduler.0" + }, + "Ethernet164|6": { + "scheduler": "scheduler.0" + }, + "Ethernet176|6": { + "scheduler": "scheduler.0" + }, + "Ethernet180|6": { + "scheduler": "scheduler.0" + }, + "Ethernet184|6": { + "scheduler": "scheduler.0" + }, + "Ethernet188|6": { + "scheduler": "scheduler.0" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/py2/qos-dell6100.json b/src/sonic-config-engine/tests/sample_output/py2/qos-dell6100.json index eecd81c99e5c..27bea8cd32d3 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/qos-dell6100.json +++ b/src/sonic-config-engine/tests/sample_output/py2/qos-dell6100.json @@ -119,308 +119,352 @@ "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet1": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet4": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet5": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet6": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet7": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet8": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet9": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet10": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet11": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet12": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet13": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet14": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet15": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet16": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet17": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet20": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet21": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet22": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet23": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet24": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet25": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet26": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet27": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet28": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet29": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet30": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet31": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet32": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet36": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet37": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet38": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet39": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet40": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet41": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet42": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet48": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet52": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet53": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet54": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet55": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet56": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet57": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet58": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" } }, "WRED_PROFILE": { diff --git a/src/sonic-config-engine/tests/sample_output/py2/qos-dell9332.json b/src/sonic-config-engine/tests/sample_output/py2/qos-dell9332.json new file mode 100644 index 000000000000..8130a455497a --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py2/qos-dell9332.json @@ -0,0 +1,1133 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "7" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "2", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "1", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "6", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type" : "DWRR", + "weight": "1" + }, + "scheduler.1": { + "type" : "DWRR", + "weight": "1" + }, + "scheduler.2": { + "type" : "DWRR", + "weight": "100" + } + }, + "PORT_QOS_MAP": { + "Ethernet0": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet8": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet16": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet24": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet32": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet40": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet48": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet56": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet64": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet72": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet80": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet88": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet96": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet104": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet112": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet120": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet128": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet136": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet144": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet152": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet160": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet168": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet176": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet184": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet192": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet200": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet208": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet216": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet224": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet232": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet240": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet248": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable" : "true", + "wred_yellow_enable" : "true", + "wred_red_enable" : "true", + "ecn" : "ecn_all", + "green_max_threshold" : "2097152", + "green_min_threshold" : "1048576", + "yellow_max_threshold" : "2097152", + "yellow_min_threshold" : "1048576", + "red_max_threshold" : "2097152", + "red_min_threshold" : "1048576", + "green_drop_probability" : "5", + "yellow_drop_probability": "5", + "red_drop_probability" : "5" + } + }, + "QUEUE": { + "Ethernet0|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet8|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet16|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet24|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet32|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet40|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet48|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet56|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet64|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet72|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet80|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet88|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet96|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet104|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet112|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet120|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet128|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet136|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet144|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet152|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet160|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet168|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet176|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet184|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet192|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet200|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet208|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet216|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet224|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet232|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet240|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet248|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet0|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet8|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet16|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet24|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet32|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet40|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet48|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet56|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet64|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet72|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet80|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet88|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet96|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet104|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet112|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet120|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet128|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet136|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet144|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet152|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet160|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet168|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet176|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet184|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet192|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet200|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet208|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet216|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet224|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet232|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet240|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet248|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet0|0": { + "scheduler": "scheduler.0" + }, + "Ethernet8|0": { + "scheduler": "scheduler.0" + }, + "Ethernet16|0": { + "scheduler": "scheduler.0" + }, + "Ethernet24|0": { + "scheduler": "scheduler.0" + }, + "Ethernet32|0": { + "scheduler": "scheduler.0" + }, + "Ethernet40|0": { + "scheduler": "scheduler.0" + }, + "Ethernet48|0": { + "scheduler": "scheduler.0" + }, + "Ethernet56|0": { + "scheduler": "scheduler.0" + }, + "Ethernet64|0": { + "scheduler": "scheduler.0" + }, + "Ethernet72|0": { + "scheduler": "scheduler.0" + }, + "Ethernet80|0": { + "scheduler": "scheduler.0" + }, + "Ethernet88|0": { + "scheduler": "scheduler.0" + }, + "Ethernet96|0": { + "scheduler": "scheduler.0" + }, + "Ethernet104|0": { + "scheduler": "scheduler.0" + }, + "Ethernet112|0": { + "scheduler": "scheduler.0" + }, + "Ethernet120|0": { + "scheduler": "scheduler.0" + }, + "Ethernet128|0": { + "scheduler": "scheduler.0" + }, + "Ethernet136|0": { + "scheduler": "scheduler.0" + }, + "Ethernet144|0": { + "scheduler": "scheduler.0" + }, + "Ethernet152|0": { + "scheduler": "scheduler.0" + }, + "Ethernet160|0": { + "scheduler": "scheduler.0" + }, + "Ethernet168|0": { + "scheduler": "scheduler.0" + }, + "Ethernet176|0": { + "scheduler": "scheduler.0" + }, + "Ethernet184|0": { + "scheduler": "scheduler.0" + }, + "Ethernet192|0": { + "scheduler": "scheduler.0" + }, + "Ethernet200|0": { + "scheduler": "scheduler.0" + }, + "Ethernet208|0": { + "scheduler": "scheduler.0" + }, + "Ethernet216|0": { + "scheduler": "scheduler.0" + }, + "Ethernet224|0": { + "scheduler": "scheduler.0" + }, + "Ethernet232|0": { + "scheduler": "scheduler.0" + }, + "Ethernet240|0": { + "scheduler": "scheduler.0" + }, + "Ethernet248|0": { + "scheduler": "scheduler.0" + }, + "Ethernet0|1": { + "scheduler": "scheduler.0" + }, + "Ethernet8|1": { + "scheduler": "scheduler.0" + }, + "Ethernet16|1": { + "scheduler": "scheduler.0" + }, + "Ethernet24|1": { + "scheduler": "scheduler.0" + }, + "Ethernet32|1": { + "scheduler": "scheduler.0" + }, + "Ethernet40|1": { + "scheduler": "scheduler.0" + }, + "Ethernet48|1": { + "scheduler": "scheduler.0" + }, + "Ethernet56|1": { + "scheduler": "scheduler.0" + }, + "Ethernet64|1": { + "scheduler": "scheduler.0" + }, + "Ethernet72|1": { + "scheduler": "scheduler.0" + }, + "Ethernet80|1": { + "scheduler": "scheduler.0" + }, + "Ethernet88|1": { + "scheduler": "scheduler.0" + }, + "Ethernet96|1": { + "scheduler": "scheduler.0" + }, + "Ethernet104|1": { + "scheduler": "scheduler.0" + }, + "Ethernet112|1": { + "scheduler": "scheduler.0" + }, + "Ethernet120|1": { + "scheduler": "scheduler.0" + }, + "Ethernet128|1": { + "scheduler": "scheduler.0" + }, + "Ethernet136|1": { + "scheduler": "scheduler.0" + }, + "Ethernet144|1": { + "scheduler": "scheduler.0" + }, + "Ethernet152|1": { + "scheduler": "scheduler.0" + }, + "Ethernet160|1": { + "scheduler": "scheduler.0" + }, + "Ethernet168|1": { + "scheduler": "scheduler.0" + }, + "Ethernet176|1": { + "scheduler": "scheduler.0" + }, + "Ethernet184|1": { + "scheduler": "scheduler.0" + }, + "Ethernet192|1": { + "scheduler": "scheduler.0" + }, + "Ethernet200|1": { + "scheduler": "scheduler.0" + }, + "Ethernet208|1": { + "scheduler": "scheduler.0" + }, + "Ethernet216|1": { + "scheduler": "scheduler.0" + }, + "Ethernet224|1": { + "scheduler": "scheduler.0" + }, + "Ethernet232|1": { + "scheduler": "scheduler.0" + }, + "Ethernet240|1": { + "scheduler": "scheduler.0" + }, + "Ethernet248|1": { + "scheduler": "scheduler.0" + }, + "Ethernet0|2": { + "scheduler": "scheduler.0" + }, + "Ethernet8|2": { + "scheduler": "scheduler.0" + }, + "Ethernet16|2": { + "scheduler": "scheduler.0" + }, + "Ethernet24|2": { + "scheduler": "scheduler.0" + }, + "Ethernet32|2": { + "scheduler": "scheduler.0" + }, + "Ethernet40|2": { + "scheduler": "scheduler.0" + }, + "Ethernet48|2": { + "scheduler": "scheduler.0" + }, + "Ethernet56|2": { + "scheduler": "scheduler.0" + }, + "Ethernet64|2": { + "scheduler": "scheduler.0" + }, + "Ethernet72|2": { + "scheduler": "scheduler.0" + }, + "Ethernet80|2": { + "scheduler": "scheduler.0" + }, + "Ethernet88|2": { + "scheduler": "scheduler.0" + }, + "Ethernet96|2": { + "scheduler": "scheduler.0" + }, + "Ethernet104|2": { + "scheduler": "scheduler.0" + }, + "Ethernet112|2": { + "scheduler": "scheduler.0" + }, + "Ethernet120|2": { + "scheduler": "scheduler.0" + }, + "Ethernet128|2": { + "scheduler": "scheduler.0" + }, + "Ethernet136|2": { + "scheduler": "scheduler.0" + }, + "Ethernet144|2": { + "scheduler": "scheduler.0" + }, + "Ethernet152|2": { + "scheduler": "scheduler.0" + }, + "Ethernet160|2": { + "scheduler": "scheduler.0" + }, + "Ethernet168|2": { + "scheduler": "scheduler.0" + }, + "Ethernet176|2": { + "scheduler": "scheduler.0" + }, + "Ethernet184|2": { + "scheduler": "scheduler.0" + }, + "Ethernet192|2": { + "scheduler": "scheduler.0" + }, + "Ethernet200|2": { + "scheduler": "scheduler.0" + }, + "Ethernet208|2": { + "scheduler": "scheduler.0" + }, + "Ethernet216|2": { + "scheduler": "scheduler.0" + }, + "Ethernet224|2": { + "scheduler": "scheduler.0" + }, + "Ethernet232|2": { + "scheduler": "scheduler.0" + }, + "Ethernet240|2": { + "scheduler": "scheduler.0" + }, + "Ethernet248|2": { + "scheduler": "scheduler.0" + }, + "Ethernet0|5": { + "scheduler": "scheduler.0" + }, + "Ethernet8|5": { + "scheduler": "scheduler.0" + }, + "Ethernet16|5": { + "scheduler": "scheduler.0" + }, + "Ethernet24|5": { + "scheduler": "scheduler.0" + }, + "Ethernet32|5": { + "scheduler": "scheduler.0" + }, + "Ethernet40|5": { + "scheduler": "scheduler.0" + }, + "Ethernet48|5": { + "scheduler": "scheduler.0" + }, + "Ethernet56|5": { + "scheduler": "scheduler.0" + }, + "Ethernet64|5": { + "scheduler": "scheduler.0" + }, + "Ethernet72|5": { + "scheduler": "scheduler.0" + }, + "Ethernet80|5": { + "scheduler": "scheduler.0" + }, + "Ethernet88|5": { + "scheduler": "scheduler.0" + }, + "Ethernet96|5": { + "scheduler": "scheduler.0" + }, + "Ethernet104|5": { + "scheduler": "scheduler.0" + }, + "Ethernet112|5": { + "scheduler": "scheduler.0" + }, + "Ethernet120|5": { + "scheduler": "scheduler.0" + }, + "Ethernet128|5": { + "scheduler": "scheduler.0" + }, + "Ethernet136|5": { + "scheduler": "scheduler.0" + }, + "Ethernet144|5": { + "scheduler": "scheduler.0" + }, + "Ethernet152|5": { + "scheduler": "scheduler.0" + }, + "Ethernet160|5": { + "scheduler": "scheduler.0" + }, + "Ethernet168|5": { + "scheduler": "scheduler.0" + }, + "Ethernet176|5": { + "scheduler": "scheduler.0" + }, + "Ethernet184|5": { + "scheduler": "scheduler.0" + }, + "Ethernet192|5": { + "scheduler": "scheduler.0" + }, + "Ethernet200|5": { + "scheduler": "scheduler.0" + }, + "Ethernet208|5": { + "scheduler": "scheduler.0" + }, + "Ethernet216|5": { + "scheduler": "scheduler.0" + }, + "Ethernet224|5": { + "scheduler": "scheduler.0" + }, + "Ethernet232|5": { + "scheduler": "scheduler.0" + }, + "Ethernet240|5": { + "scheduler": "scheduler.0" + }, + "Ethernet248|5": { + "scheduler": "scheduler.0" + }, + "Ethernet0|6": { + "scheduler": "scheduler.0" + }, + "Ethernet8|6": { + "scheduler": "scheduler.0" + }, + "Ethernet16|6": { + "scheduler": "scheduler.0" + }, + "Ethernet24|6": { + "scheduler": "scheduler.0" + }, + "Ethernet32|6": { + "scheduler": "scheduler.0" + }, + "Ethernet40|6": { + "scheduler": "scheduler.0" + }, + "Ethernet48|6": { + "scheduler": "scheduler.0" + }, + "Ethernet56|6": { + "scheduler": "scheduler.0" + }, + "Ethernet64|6": { + "scheduler": "scheduler.0" + }, + "Ethernet72|6": { + "scheduler": "scheduler.0" + }, + "Ethernet80|6": { + "scheduler": "scheduler.0" + }, + "Ethernet88|6": { + "scheduler": "scheduler.0" + }, + "Ethernet96|6": { + "scheduler": "scheduler.0" + }, + "Ethernet104|6": { + "scheduler": "scheduler.0" + }, + "Ethernet112|6": { + "scheduler": "scheduler.0" + }, + "Ethernet120|6": { + "scheduler": "scheduler.0" + }, + "Ethernet128|6": { + "scheduler": "scheduler.0" + }, + "Ethernet136|6": { + "scheduler": "scheduler.0" + }, + "Ethernet144|6": { + "scheduler": "scheduler.0" + }, + "Ethernet152|6": { + "scheduler": "scheduler.0" + }, + "Ethernet160|6": { + "scheduler": "scheduler.0" + }, + "Ethernet168|6": { + "scheduler": "scheduler.0" + }, + "Ethernet176|6": { + "scheduler": "scheduler.0" + }, + "Ethernet184|6": { + "scheduler": "scheduler.0" + }, + "Ethernet192|6": { + "scheduler": "scheduler.0" + }, + "Ethernet200|6": { + "scheduler": "scheduler.0" + }, + "Ethernet208|6": { + "scheduler": "scheduler.0" + }, + "Ethernet216|6": { + "scheduler": "scheduler.0" + }, + "Ethernet224|6": { + "scheduler": "scheduler.0" + }, + "Ethernet232|6": { + "scheduler": "scheduler.0" + }, + "Ethernet240|6": { + "scheduler": "scheduler.0" + }, + "Ethernet248|6": { + "scheduler": "scheduler.0" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/py2/radvd.conf b/src/sonic-config-engine/tests/sample_output/py2/radvd.conf new file mode 100644 index 000000000000..9e716b7144bf --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py2/radvd.conf @@ -0,0 +1,35 @@ +# =========== Managed by sonic-cfggen -- DO NOT edit manually! ==================== +# Generated by /usr/share/sonic/templates/radvd.conf.j2 using config DB data +# File: /etc/radvd.conf +# +# Config file for radvd, the router advertisement daemon +# See man page for radvd.conf for descriptions of all available options +# + +interface Vlan1000 +{ + IgnoreIfMissing on; + AdvSendAdvert on; + MinRtrAdvInterval 60; + MaxRtrAdvInterval 180; + AdvManagedFlag on; + AdvOtherConfigFlag off; + AdvLinkMTU 9100; + AdvHomeAgentFlag off; + prefix fc02:2000::/64 { + AdvOnLink on; + AdvAutonomous off; + AdvRouterAddr off; + AdvValidLifetime infinity; + AdvPreferredLifetime infinity; + }; + prefix fc02:1000::/64 { + AdvOnLink on; + AdvAutonomous off; + AdvRouterAddr off; + AdvValidLifetime infinity; + AdvPreferredLifetime infinity; + }; +}; + + diff --git a/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-bgpd.conf b/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-bgpd.conf index d3b9b472c5bd..20744efaa40f 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-bgpd.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/t2-chassis-fe-bgpd.conf @@ -63,10 +63,6 @@ router bgp 4000 ! bgp bestpath as-path multipath-relax ! - bgp graceful-restart restart-time 240 - bgp graceful-restart - bgp graceful-restart preserve-fw-state - bgp graceful-restart select-defer-time 45 ! bgp router-id 4.0.0.0 ! diff --git a/src/sonic-config-engine/tests/sample_output/py2/wait_for_intf.sh b/src/sonic-config-engine/tests/sample_output/py2/wait_for_intf.sh index 4852f6167bad..8ba15b1c8355 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/wait_for_intf.sh +++ b/src/sonic-config-engine/tests/sample_output/py2/wait_for_intf.sh @@ -30,3 +30,7 @@ wait_until_iface_ready PortChannel03 10.0.0.60/31 wait_until_iface_ready PortChannel04 10.0.0.62/31 wait_until_iface_ready PortChannel01 10.0.0.56/31 +# Wait 10 seconds for the rest of interfaces to get added/populated. +# dhcrelay listens on each of the interfaces (in addition to the port +# channels and vlan interfaces) +sleep 10 diff --git a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_backend_asic.conf b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_backend_asic.conf index a4ad1c677a77..d793dfa39a98 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_backend_asic.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_backend_asic.conf @@ -34,6 +34,18 @@ ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32 ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64 ! ! +ip prefix-list V4_P2P_IP permit 0.0.0.0/0 ge 31 le 31 +! +ipv6 prefix-list V6_P2P_IP permit ::/0 ge 126 le 126 +! +route-map V4_CONNECTED_ROUTES permit 10 + match ip address prefix-list V4_P2P_IP + call HIDE_INTERNAL +! +route-map V6_CONNECTED_ROUTES permit 10 + match ipv6 address prefix-list V6_P2P_IP + call HIDE_INTERNAL +! route-map HIDE_INTERNAL permit 10 set community no-export ! @@ -46,10 +58,6 @@ router bgp 65100 ! bgp bestpath as-path multipath-relax ! - bgp graceful-restart restart-time 240 - bgp graceful-restart - bgp graceful-restart preserve-fw-state - bgp graceful-restart select-defer-time 45 ! bgp router-id 8.0.0.5 ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_frontend_asic.conf b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_frontend_asic.conf index b49d3ddd4dcd..94bd37e3b90f 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_frontend_asic.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/bgpd_frr_frontend_asic.conf @@ -34,6 +34,18 @@ ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32 ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64 ! ! +ip prefix-list V4_P2P_IP permit 0.0.0.0/0 ge 31 le 31 +! +ipv6 prefix-list V6_P2P_IP permit ::/0 ge 126 le 126 +! +route-map V4_CONNECTED_ROUTES permit 10 + match ip address prefix-list V4_P2P_IP + call HIDE_INTERNAL +! +route-map V6_CONNECTED_ROUTES permit 10 + match ipv6 address prefix-list V6_P2P_IP + call HIDE_INTERNAL +! route-map HIDE_INTERNAL permit 10 set community no-export ! @@ -46,10 +58,6 @@ router bgp 65100 ! bgp bestpath as-path multipath-relax ! - bgp graceful-restart restart-time 240 - bgp graceful-restart - bgp graceful-restart preserve-fw-state - bgp graceful-restart select-defer-time 45 ! bgp router-id 10.1.0.32 ! @@ -66,10 +74,10 @@ router bgp 65100 ! ! address-family ipv4 - redistribute connected route-map HIDE_INTERNAL + redistribute connected route-map V4_CONNECTED_ROUTES exit-address-family address-family ipv6 - redistribute connected route-map HIDE_INTERNAL + redistribute connected route-map V6_CONNECTED_ROUTES exit-address-family ! address-family ipv4 diff --git a/src/sonic-config-engine/tests/sample_output/py3/buffer-arista7800r3-48cq2-lc.json b/src/sonic-config-engine/tests/sample_output/py3/buffer-arista7800r3-48cq2-lc.json new file mode 100644 index 000000000000..56538fd0935b --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/buffer-arista7800r3-48cq2-lc.json @@ -0,0 +1,590 @@ +{ + "CABLE_LENGTH": { + "AZURE": { + "Ethernet0": "5m", + "Ethernet4": "5m", + "Ethernet8": "5m", + "Ethernet12": "5m", + "Ethernet16": "5m", + "Ethernet20": "5m", + "Ethernet24": "5m", + "Ethernet28": "5m", + "Ethernet32": "5m", + "Ethernet36": "5m", + "Ethernet40": "5m", + "Ethernet44": "5m", + "Ethernet48": "5m", + "Ethernet52": "5m", + "Ethernet56": "5m", + "Ethernet60": "5m", + "Ethernet64": "5m", + "Ethernet68": "5m", + "Ethernet72": "5m", + "Ethernet76": "5m", + "Ethernet80": "5m", + "Ethernet84": "5m", + "Ethernet88": "5m", + "Ethernet92": "5m", + "Ethernet96": "5m", + "Ethernet100": "5m", + "Ethernet104": "5m", + "Ethernet108": "5m", + "Ethernet112": "5m", + "Ethernet116": "5m", + "Ethernet120": "5m", + "Ethernet124": "5m", + "Ethernet128": "5m", + "Ethernet132": "5m", + "Ethernet136": "5m", + "Ethernet140": "5m", + "Ethernet144": "5m", + "Ethernet148": "5m", + "Ethernet152": "5m", + "Ethernet156": "5m", + "Ethernet160": "5m", + "Ethernet164": "5m", + "Ethernet168": "5m", + "Ethernet172": "5m", + "Ethernet176": "5m", + "Ethernet180": "5m", + "Ethernet184": "5m", + "Ethernet188": "5m" + } + }, + + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "3220805000", + "type": "both", + "mode": "dynamic", + "xoff": "2102272" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"1280", + "dynamic_th":"-2", + "xon_offset":"2560", + "xon":"0", + "xoff":"66048" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "xon_offset":"0", + "static_th":"30535680" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"33030144" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"-1" + } + }, + "BUFFER_PG": { + "Ethernet0|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet36|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet40|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet44|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet48|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet52|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet56|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet60|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet64|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet68|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet72|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet4|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet76|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet80|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet84|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet88|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet92|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet96|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet100|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet104|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet108|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet112|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet8|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet116|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet120|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet124|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet128|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet132|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet136|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet140|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet144|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet148|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet152|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet12|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet156|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet164|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet176|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet180|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet184|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet188|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet16|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet20|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet24|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet28|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet32|0": { + "profile" : "ingress_lossy_profile" + } + }, + + "BUFFER_QUEUE": { + "Ethernet0|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet36|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet40|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet44|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet48|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet52|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet56|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet60|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet64|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet68|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet72|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet4|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet76|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet80|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet84|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet88|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet92|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet96|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet100|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet104|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet108|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet112|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet8|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet116|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet120|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet124|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet128|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet132|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet136|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet140|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet144|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet148|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet152|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet12|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet156|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet164|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet176|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet180|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet184|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet188|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet16|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet20|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet24|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet28|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet32|3-4": { + "profile" : "[BUFFER_PROFILE|ingress_lossless_profile]" + }, + "Ethernet0|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet36|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet40|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet44|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet48|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet52|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet56|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet60|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet64|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet68|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet72|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet4|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet76|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet80|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet84|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet88|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet92|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet96|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet100|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet104|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet108|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet112|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet8|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet116|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet120|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet124|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet128|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet132|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet136|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet140|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet144|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet148|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet152|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet12|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet156|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet164|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet176|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet180|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet184|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet188|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet16|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet20|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet24|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet28|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet32|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet0|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet36|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet40|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet44|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet48|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet52|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet56|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet60|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet64|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet68|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet72|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet4|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet76|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet80|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet84|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet88|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet92|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet96|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet100|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet104|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet108|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet112|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet8|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet116|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet120|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet124|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet128|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet132|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet136|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet140|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet144|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet148|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet152|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet12|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet156|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet164|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet176|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet180|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet184|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet188|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet16|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet20|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet24|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet28|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet32|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/py3/buffers-dell6100.json b/src/sonic-config-engine/tests/sample_output/py3/buffers-dell6100.json index 17a691a2ffaa..08f238bcc40d 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/buffers-dell6100.json +++ b/src/sonic-config-engine/tests/sample_output/py3/buffers-dell6100.json @@ -1,4 +1,3 @@ - { "CABLE_LENGTH": { "AZURE": { @@ -65,7 +64,9 @@ "Ethernet60": "5m", "Ethernet61": "5m", "Ethernet62": "5m", - "Ethernet63": "5m" + "Ethernet63": "5m", + "Ethernet64": "5m", + "Ethernet65": "5m" } }, diff --git a/src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox2410-dynamic.json b/src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox2410-dynamic.json new file mode 100644 index 000000000000..109389c95047 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox2410-dynamic.json @@ -0,0 +1,1308 @@ +{ + "CABLE_LENGTH": { + "AZURE": { + "Ethernet0": "300m", + "Ethernet4": "300m", + "Ethernet8": "300m", + "Ethernet12": "300m", + "Ethernet16": "300m", + "Ethernet20": "300m", + "Ethernet24": "300m", + "Ethernet28": "300m", + "Ethernet32": "300m", + "Ethernet36": "300m", + "Ethernet40": "300m", + "Ethernet44": "300m", + "Ethernet48": "300m", + "Ethernet52": "300m", + "Ethernet56": "300m", + "Ethernet60": "300m", + "Ethernet64": "40m", + "Ethernet68": "40m", + "Ethernet72": "40m", + "Ethernet76": "40m", + "Ethernet80": "40m", + "Ethernet84": "40m", + "Ethernet88": "40m", + "Ethernet92": "40m", + "Ethernet96": "40m", + "Ethernet100": "40m", + "Ethernet104": "40m", + "Ethernet108": "40m", + "Ethernet112": "40m", + "Ethernet116": "40m", + "Ethernet120": "40m", + "Ethernet124": "40m", + "Ethernet128": "5m", + "Ethernet132": "5m", + "Ethernet136": "5m", + "Ethernet140": "5m", + "Ethernet144": "5m", + "Ethernet148": "5m", + "Ethernet152": "5m", + "Ethernet156": "5m", + "Ethernet160": "5m", + "Ethernet164": "5m", + "Ethernet168": "5m", + "Ethernet172": "5m", + "Ethernet176": "5m", + "Ethernet180": "5m", + "Ethernet184": "5m", + "Ethernet188": "5m", + "Ethernet192": "5m", + "Ethernet196": "5m", + "Ethernet200": "5m", + "Ethernet204": "5m", + "Ethernet208": "5m", + "Ethernet212": "5m", + "Ethernet216": "5m", + "Ethernet220": "5m" + } + }, + + "BUFFER_POOL": { + "ingress_lossless_pool": { + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "13945824", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "ingress_lossy_profile": { + "pool":"ingress_lossy_pool", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"9216", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"0", + "dynamic_th":"3" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "Ethernet64": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet0": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet4": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet68": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet72": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet8": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet12": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet76": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet80": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet16": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet20": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet84": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet88": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet24": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet28": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet92": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet96": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet32": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet36": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet100": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet104": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet40": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet44": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet108": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet112": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet48": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet52": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet116": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet120": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet56": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet60": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet124": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + } +, + "Ethernet128": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet132": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet136": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet140": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet144": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet148": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet152": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet156": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet160": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet164": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet168": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet172": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet176": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet180": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet184": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet188": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet192": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet196": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet200": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet204": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet208": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet212": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet216": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet220": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "Ethernet64": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet0": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet4": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet68": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet72": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet8": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet12": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet76": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet80": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet16": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet20": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet84": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet88": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet24": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet28": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet92": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet96": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet32": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet36": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet100": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet104": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet40": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet44": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet108": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet112": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet48": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet52": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet116": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet120": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet56": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet60": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet124": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + } +, + "Ethernet128": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet132": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet136": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet140": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet144": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet148": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet152": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet156": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet160": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet164": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet168": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet172": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet176": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet180": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet184": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet188": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet192": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet196": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet200": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet204": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet208": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet212": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet216": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet220": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + } + }, + "BUFFER_PG": { + "Ethernet64|3-4": { + "profile" : "NULL" + }, + "Ethernet64|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet0|3-4": { + "profile" : "NULL" + }, + "Ethernet0|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet4|3-4": { + "profile" : "NULL" + }, + "Ethernet4|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet68|3-4": { + "profile" : "NULL" + }, + "Ethernet68|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet72|3-4": { + "profile" : "NULL" + }, + "Ethernet72|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet8|3-4": { + "profile" : "NULL" + }, + "Ethernet8|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet12|3-4": { + "profile" : "NULL" + }, + "Ethernet12|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet76|3-4": { + "profile" : "NULL" + }, + "Ethernet76|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet80|3-4": { + "profile" : "NULL" + }, + "Ethernet80|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet16|3-4": { + "profile" : "NULL" + }, + "Ethernet16|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet20|3-4": { + "profile" : "NULL" + }, + "Ethernet20|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet84|3-4": { + "profile" : "NULL" + }, + "Ethernet84|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet88|3-4": { + "profile" : "NULL" + }, + "Ethernet88|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet24|3-4": { + "profile" : "NULL" + }, + "Ethernet24|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet28|3-4": { + "profile" : "NULL" + }, + "Ethernet28|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet92|3-4": { + "profile" : "NULL" + }, + "Ethernet92|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet96|3-4": { + "profile" : "NULL" + }, + "Ethernet96|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet32|3-4": { + "profile" : "NULL" + }, + "Ethernet32|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet36|3-4": { + "profile" : "NULL" + }, + "Ethernet36|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet100|3-4": { + "profile" : "NULL" + }, + "Ethernet100|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet104|3-4": { + "profile" : "NULL" + }, + "Ethernet104|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet40|3-4": { + "profile" : "NULL" + }, + "Ethernet40|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet44|3-4": { + "profile" : "NULL" + }, + "Ethernet44|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet108|3-4": { + "profile" : "NULL" + }, + "Ethernet108|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet112|3-4": { + "profile" : "NULL" + }, + "Ethernet112|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet48|3-4": { + "profile" : "NULL" + }, + "Ethernet48|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet52|3-4": { + "profile" : "NULL" + }, + "Ethernet52|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet116|3-4": { + "profile" : "NULL" + }, + "Ethernet116|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet120|3-4": { + "profile" : "NULL" + }, + "Ethernet120|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet56|3-4": { + "profile" : "NULL" + }, + "Ethernet56|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet60|3-4": { + "profile" : "NULL" + }, + "Ethernet60|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet124|3-4": { + "profile" : "NULL" + }, + "Ethernet124|0": { + "profile" : "ingress_lossy_profile" + } +, "Ethernet128|3-4": { + "profile" : "NULL" + }, + "Ethernet128|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet132|3-4": { + "profile" : "NULL" + }, + "Ethernet132|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet136|3-4": { + "profile" : "NULL" + }, + "Ethernet136|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet140|3-4": { + "profile" : "NULL" + }, + "Ethernet140|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet144|3-4": { + "profile" : "NULL" + }, + "Ethernet144|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet148|3-4": { + "profile" : "NULL" + }, + "Ethernet148|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet152|3-4": { + "profile" : "NULL" + }, + "Ethernet152|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet156|3-4": { + "profile" : "NULL" + }, + "Ethernet156|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet160|3-4": { + "profile" : "NULL" + }, + "Ethernet160|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet164|3-4": { + "profile" : "NULL" + }, + "Ethernet164|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet168|3-4": { + "profile" : "NULL" + }, + "Ethernet168|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet172|3-4": { + "profile" : "NULL" + }, + "Ethernet172|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet176|3-4": { + "profile" : "NULL" + }, + "Ethernet176|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet180|3-4": { + "profile" : "NULL" + }, + "Ethernet180|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet184|3-4": { + "profile" : "NULL" + }, + "Ethernet184|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet188|3-4": { + "profile" : "NULL" + }, + "Ethernet188|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet192|3-4": { + "profile" : "NULL" + }, + "Ethernet192|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet196|3-4": { + "profile" : "NULL" + }, + "Ethernet196|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet200|3-4": { + "profile" : "NULL" + }, + "Ethernet200|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet204|3-4": { + "profile" : "NULL" + }, + "Ethernet204|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet208|3-4": { + "profile" : "NULL" + }, + "Ethernet208|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet212|3-4": { + "profile" : "NULL" + }, + "Ethernet212|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet216|3-4": { + "profile" : "NULL" + }, + "Ethernet216|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet220|3-4": { + "profile" : "NULL" + }, + "Ethernet220|0": { + "profile" : "ingress_lossy_profile" + } + }, + + "BUFFER_QUEUE": { + "Ethernet64|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet0|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet4|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet68|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet72|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet8|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet12|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet76|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet80|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet16|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet20|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet84|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet88|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet24|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet28|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet92|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet96|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet32|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet36|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet100|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet104|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet40|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet44|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet108|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet112|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet48|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet52|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet116|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet120|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet56|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet60|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet124|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet64|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet0|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet4|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet68|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet72|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet8|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet12|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet76|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet80|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet16|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet20|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet84|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet88|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet24|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet28|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet92|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet96|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet32|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet36|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet100|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet104|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet40|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet44|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet108|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet112|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet48|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet52|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet116|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet120|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet56|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet60|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet124|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet64|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet0|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet4|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet68|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet72|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet8|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet12|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet76|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet80|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet16|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet20|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet84|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet88|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet24|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet28|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet92|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet96|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet32|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet36|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet100|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet104|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet40|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet44|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet108|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet112|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet48|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet52|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet116|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet120|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet56|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet60|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet124|5-6": { + "profile" : "q_lossy_profile" + } +, + "Ethernet128|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet132|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet136|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet140|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet144|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet148|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet152|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet156|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet160|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet164|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet168|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet172|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet176|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet180|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet184|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet188|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet192|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet196|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet200|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet204|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet208|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet212|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet216|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet220|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet128|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet132|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet136|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet140|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet144|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet148|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet152|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet156|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet160|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet164|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet168|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet172|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet176|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet180|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet184|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet188|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet192|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet196|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet200|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet204|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet208|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet212|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet216|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet220|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet128|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet132|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet136|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet140|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet144|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet148|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet152|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet156|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet160|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet164|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet168|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet172|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet176|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet180|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet184|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet188|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet192|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet196|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet200|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet204|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet208|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet212|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet216|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet220|5-6": { + "profile" : "q_lossy_profile" + } + } +, "DEFAULT_LOSSLESS_BUFFER_PARAMETER": { + "AZURE": { + "default_dynamic_th": "0" + } + }, + "LOSSLESS_TRAFFIC_PATTERN": { + "AZURE": { + "mtu": "1024", + "small_packet_percentage": "100" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox2410.json b/src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox2410.json new file mode 100644 index 000000000000..eaf119ab0acd --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox2410.json @@ -0,0 +1,1162 @@ +{ + "CABLE_LENGTH": { + "AZURE": { + "Ethernet0": "300m", + "Ethernet4": "300m", + "Ethernet8": "300m", + "Ethernet12": "300m", + "Ethernet16": "300m", + "Ethernet20": "300m", + "Ethernet24": "300m", + "Ethernet28": "300m", + "Ethernet32": "300m", + "Ethernet36": "300m", + "Ethernet40": "300m", + "Ethernet44": "300m", + "Ethernet48": "300m", + "Ethernet52": "300m", + "Ethernet56": "300m", + "Ethernet60": "300m", + "Ethernet64": "40m", + "Ethernet68": "40m", + "Ethernet72": "40m", + "Ethernet76": "40m", + "Ethernet80": "40m", + "Ethernet84": "40m", + "Ethernet88": "40m", + "Ethernet92": "40m", + "Ethernet96": "40m", + "Ethernet100": "40m", + "Ethernet104": "40m", + "Ethernet108": "40m", + "Ethernet112": "40m", + "Ethernet116": "40m", + "Ethernet120": "40m", + "Ethernet124": "40m", + "Ethernet128": "5m", + "Ethernet132": "5m", + "Ethernet136": "5m", + "Ethernet140": "5m", + "Ethernet144": "5m", + "Ethernet148": "5m", + "Ethernet152": "5m", + "Ethernet156": "5m", + "Ethernet160": "5m", + "Ethernet164": "5m", + "Ethernet168": "5m", + "Ethernet172": "5m", + "Ethernet176": "5m", + "Ethernet180": "5m", + "Ethernet184": "5m", + "Ethernet188": "5m", + "Ethernet192": "5m", + "Ethernet196": "5m", + "Ethernet200": "5m", + "Ethernet204": "5m", + "Ethernet208": "5m", + "Ethernet212": "5m", + "Ethernet216": "5m", + "Ethernet220": "5m" + } + }, + + "BUFFER_POOL": { + "ingress_zero_pool" : { + "mode": "static", + "type": "ingress", + "size": "0" + }, + "ingress_lossless_pool": { + "size": "3302912", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "3302912", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "13945824", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "3302912", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_pg_zero_profile" : { + "pool":"ingress_zero_pool", + "size":"0", + "static_th":"0" + }, + "ingress_lossless_zero_profile" : { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"-8" + }, + "ingress_lossy_zero_profile" : { + "pool":"ingress_lossy_pool", + "size":"0", + "dynamic_th":"-8" + }, + "egress_lossless_zero_profile" : { + "pool":"egress_lossless_pool", + "size":"0", + "dynamic_th":"-8" + }, + "egress_lossy_zero_profile" : { + "pool":"egress_lossy_pool", + "size":"0", + "dynamic_th":"-8" + }, + "ingress_lossless_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "ingress_lossy_profile": { + "pool":"ingress_lossy_pool", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"9216", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"0", + "dynamic_th":"3" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "Ethernet64": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet0": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet4": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet68": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet72": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet8": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet12": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet76": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet80": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet16": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet20": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet84": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet88": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet24": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet28": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet92": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet96": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet32": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet36": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet100": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet104": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet40": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet44": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet108": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet112": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet48": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet52": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet116": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet120": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet56": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet60": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + }, + "Ethernet124": { + "profile_list" : "ingress_lossless_profile,ingress_lossy_profile" + } +, + "Ethernet128": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet132": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet136": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet140": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet144": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet148": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet152": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet156": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet160": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet164": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet168": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet172": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet176": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet180": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet184": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet188": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet192": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet196": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet200": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet204": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet208": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet212": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet216": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + }, + "Ethernet220": { + "profile_list" : "ingress_lossless_zero_profile,ingress_lossy_zero_profile" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "Ethernet64": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet0": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet4": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet68": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet72": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet8": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet12": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet76": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet80": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet16": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet20": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet84": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet88": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet24": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet28": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet92": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet96": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet32": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet36": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet100": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet104": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet40": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet44": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet108": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet112": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet48": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet52": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet116": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet120": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet56": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet60": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet124": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + } +, + "Ethernet128": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet132": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet136": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet140": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet144": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet148": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet152": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet156": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet160": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet164": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet168": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet172": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet176": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet180": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet184": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet188": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet192": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet196": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet200": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet204": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet208": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet212": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet216": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet220": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + } + }, + "BUFFER_PG": { + "Ethernet64|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet0|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet4|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet68|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet72|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet8|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet12|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet76|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet80|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet16|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet20|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet84|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet88|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet24|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet28|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet92|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet96|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet32|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet36|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet100|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet104|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet40|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet44|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet108|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet112|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet48|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet52|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet116|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet120|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet56|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet60|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet124|0": { + "profile" : "ingress_lossy_profile" + } +, "Ethernet128|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet132|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet136|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet140|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet144|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet148|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet152|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet156|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet160|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet164|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet168|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet172|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet176|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet180|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet184|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet188|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet192|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet196|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet200|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet204|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet208|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet212|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet216|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet220|0": { + "profile" : "ingress_lossy_pg_zero_profile" + } + }, + + "BUFFER_QUEUE": { + "Ethernet64|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet0|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet4|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet68|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet72|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet8|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet12|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet76|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet80|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet16|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet20|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet84|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet88|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet24|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet28|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet92|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet96|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet32|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet36|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet100|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet104|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet40|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet44|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet108|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet112|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet48|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet52|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet116|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet120|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet56|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet60|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet124|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet64|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet0|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet4|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet68|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet72|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet8|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet12|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet76|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet80|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet16|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet20|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet84|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet88|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet24|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet28|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet92|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet96|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet32|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet36|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet100|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet104|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet40|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet44|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet108|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet112|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet48|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet52|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet116|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet120|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet56|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet60|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet124|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet64|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet0|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet4|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet68|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet72|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet8|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet12|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet76|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet80|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet16|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet20|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet84|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet88|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet24|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet28|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet92|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet96|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet32|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet36|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet100|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet104|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet40|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet44|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet108|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet112|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet48|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet52|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet116|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet120|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet56|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet60|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet124|5-6": { + "profile" : "q_lossy_profile" + } +, + "Ethernet128|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet132|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet136|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet140|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet144|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet148|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet152|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet156|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet160|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet164|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet168|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet172|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet176|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet180|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet184|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet188|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet192|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet196|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet200|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet204|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet208|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet212|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet216|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet220|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet128|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet132|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet136|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet140|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet144|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet148|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet152|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet156|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet160|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet164|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet168|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet172|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet176|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet180|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet184|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet188|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet192|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet196|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet200|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet204|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet208|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet212|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet216|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet220|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet128|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet132|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet136|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet140|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet144|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet148|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet152|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet156|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet160|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet164|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet168|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet172|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet176|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet180|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet184|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet188|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet192|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet196|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet200|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet204|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet208|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet212|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet216|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet220|5-6": { + "profile" : "egress_lossy_zero_profile" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox2700.json b/src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox2700.json new file mode 100644 index 000000000000..49da9b064afa --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/buffers-mellanox2700.json @@ -0,0 +1,1153 @@ +{ + "CABLE_LENGTH": { + "AZURE": { + "Ethernet0": "5m", + "Ethernet2": "5m", + "Ethernet4": "5m", + "Ethernet6": "5m", + "Ethernet8": "5m", + "Ethernet10": "5m", + "Ethernet12": "5m", + "Ethernet14": "5m", + "Ethernet16": "5m", + "Ethernet18": "5m", + "Ethernet20": "5m", + "Ethernet22": "5m", + "Ethernet24": "5m", + "Ethernet28": "5m", + "Ethernet32": "5m", + "Ethernet36": "5m", + "Ethernet40": "5m", + "Ethernet42": "5m", + "Ethernet44": "5m", + "Ethernet46": "5m", + "Ethernet48": "5m", + "Ethernet50": "5m", + "Ethernet52": "5m", + "Ethernet54": "5m", + "Ethernet56": "5m", + "Ethernet58": "5m", + "Ethernet60": "5m", + "Ethernet62": "5m", + "Ethernet64": "40m", + "Ethernet66": "40m", + "Ethernet68": "40m", + "Ethernet70": "40m", + "Ethernet72": "5m", + "Ethernet74": "5m", + "Ethernet76": "5m", + "Ethernet78": "5m", + "Ethernet80": "5m", + "Ethernet82": "5m", + "Ethernet84": "5m", + "Ethernet86": "5m", + "Ethernet88": "5m", + "Ethernet92": "5m", + "Ethernet96": "5m", + "Ethernet100": "5m", + "Ethernet104": "5m", + "Ethernet106": "5m", + "Ethernet108": "5m", + "Ethernet110": "5m", + "Ethernet112": "5m", + "Ethernet114": "5m", + "Ethernet116": "5m", + "Ethernet118": "5m", + "Ethernet120": "5m", + "Ethernet122": "5m", + "Ethernet124": "5m", + "Ethernet126": "5m" + } + }, + + "BUFFER_POOL": { + "ingress_zero_pool" : { + "mode": "static", + "type": "ingress", + "size": "0" + }, + "ingress_lossless_pool": { + "size": "7719936", + "xoff": "1032192", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "13945824", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "7719936", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_pg_zero_profile" : { + "pool":"ingress_zero_pool", + "size":"0", + "static_th":"0" + }, + "ingress_lossless_zero_profile" : { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"-8" + }, + "egress_lossless_zero_profile" : { + "pool":"egress_lossless_pool", + "size":"0", + "dynamic_th":"-8" + }, + "egress_lossy_zero_profile" : { + "pool":"egress_lossy_pool", + "size":"0", + "dynamic_th":"-8" + }, + "ingress_lossless_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"0", + "dynamic_th":"7" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"9216", + "dynamic_th":"7" + }, + "q_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"0", + "dynamic_th":"3" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "Ethernet64": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet66": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet68": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet70": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet2": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet4": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet6": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet8": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet10": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet12": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet14": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet16": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet18": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet20": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet22": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet24": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet28": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet32": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet36": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet40": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet42": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet44": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet46": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet48": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet50": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet52": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet54": { + "profile_list" : "ingress_lossless_profile" + }, + "Ethernet56": { + "profile_list" : "ingress_lossless_profile" + } +, + "Ethernet0": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet58": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet60": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet62": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet72": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet74": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet76": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet78": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet80": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet82": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet84": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet86": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet88": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet92": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet96": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet100": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet104": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet106": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet108": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet110": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet112": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet114": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet116": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet118": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet120": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet122": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet124": { + "profile_list" : "ingress_lossless_zero_profile" + }, + "Ethernet126": { + "profile_list" : "ingress_lossless_zero_profile" + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "Ethernet64": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet66": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet68": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet70": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet2": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet4": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet6": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet8": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet10": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet12": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet14": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet16": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet18": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet20": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet22": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet24": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet28": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet32": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet36": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet40": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet42": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet44": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet46": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet48": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet50": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet52": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet54": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + }, + "Ethernet56": { + "profile_list" : "egress_lossless_profile,egress_lossy_profile" + } +, + "Ethernet0": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet58": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet60": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet62": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet72": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet74": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet76": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet78": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet80": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet82": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet84": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet86": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet88": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet92": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet96": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet100": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet104": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet106": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet108": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet110": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet112": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet114": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet116": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet118": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet120": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet122": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet124": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + }, + "Ethernet126": { + "profile_list" : "egress_lossless_zero_profile,egress_lossy_zero_profile" + } + }, + "BUFFER_PG": { + "Ethernet64|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet66|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet68|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet70|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet2|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet4|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet6|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet8|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet10|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet12|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet14|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet16|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet18|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet20|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet22|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet24|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet28|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet32|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet36|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet40|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet42|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet44|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet46|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet48|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet50|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet52|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet54|0": { + "profile" : "ingress_lossy_profile" + }, + "Ethernet56|0": { + "profile" : "ingress_lossy_profile" + } +, "Ethernet0|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet58|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet60|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet62|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet72|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet74|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet76|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet78|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet80|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet82|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet84|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet86|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet88|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet92|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet96|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet100|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet104|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet106|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet108|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet110|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet112|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet114|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet116|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet118|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet120|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet122|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet124|0": { + "profile" : "ingress_lossy_pg_zero_profile" + }, + "Ethernet126|0": { + "profile" : "ingress_lossy_pg_zero_profile" + } + }, + + "BUFFER_QUEUE": { + "Ethernet64|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet66|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet68|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet70|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet2|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet4|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet6|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet8|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet10|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet12|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet14|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet16|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet18|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet20|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet22|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet24|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet28|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet32|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet36|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet40|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet42|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet44|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet46|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet48|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet50|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet52|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet54|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet56|3-4": { + "profile" : "egress_lossless_profile" + }, + "Ethernet64|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet66|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet68|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet70|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet2|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet4|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet6|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet8|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet10|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet12|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet14|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet16|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet18|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet20|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet22|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet24|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet28|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet32|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet36|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet40|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet42|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet44|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet46|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet48|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet50|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet52|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet54|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet56|0-2": { + "profile" : "q_lossy_profile" + }, + "Ethernet64|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet66|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet68|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet70|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet2|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet4|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet6|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet8|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet10|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet12|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet14|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet16|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet18|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet20|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet22|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet24|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet28|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet32|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet36|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet40|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet42|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet44|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet46|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet48|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet50|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet52|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet54|5-6": { + "profile" : "q_lossy_profile" + }, + "Ethernet56|5-6": { + "profile" : "q_lossy_profile" + } +, + "Ethernet0|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet58|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet60|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet62|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet72|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet74|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet76|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet78|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet80|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet82|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet84|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet86|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet88|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet92|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet96|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet100|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet104|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet106|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet108|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet110|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet112|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet114|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet116|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet118|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet120|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet122|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet124|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet126|3-4": { + "profile" : "egress_lossless_zero_profile" + }, + "Ethernet0|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet58|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet60|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet62|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet72|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet74|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet76|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet78|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet80|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet82|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet84|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet86|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet88|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet92|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet96|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet100|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet104|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet106|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet108|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet110|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet112|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet114|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet116|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet118|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet120|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet122|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet124|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet126|0-2": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet0|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet58|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet60|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet62|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet72|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet74|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet76|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet78|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet80|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet82|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet84|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet86|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet88|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet92|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet96|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet100|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet104|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet106|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet108|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet110|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet112|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet114|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet116|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet118|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet120|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet122|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet124|5-6": { + "profile" : "egress_lossy_zero_profile" + }, + "Ethernet126|5-6": { + "profile" : "egress_lossy_zero_profile" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/py3/frr.conf b/src/sonic-config-engine/tests/sample_output/py3/frr.conf index 8dfec1a9c753..43bed33c4bd0 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/frr.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/frr.conf @@ -35,10 +35,6 @@ link-detect ! !! ! -! set static default route to mgmt gateway as a backup to learned default -ip route 0.0.0.0/0 10.0.0.1 200 -!! -! ! ! add static ipv6 /64 loopback route to allow bgpd to advertise the loopback route prefix ipv6 route fc00:1::/64 Loopback0 diff --git a/src/sonic-config-engine/tests/sample_output/py3/l1_intfs.json b/src/sonic-config-engine/tests/sample_output/py3/l1_intfs.json index bc2d533e87a1..634b936fede0 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/l1_intfs.json +++ b/src/sonic-config-engine/tests/sample_output/py3/l1_intfs.json @@ -257,5 +257,12 @@ "mtu": "9100", "speed": "100000" } + }, + "FLEX_COUNTER_TABLE": { + "ACL": { + "FLEX_COUNTER_STATUS": "disable", + "FLEX_COUNTER_DELAY_STATUS": "true", + "POLL_INTERVAL": "10000" + } } } diff --git a/src/sonic-config-engine/tests/sample_output/py3/l2switch.json b/src/sonic-config-engine/tests/sample_output/py3/l2switch.json index fd83589153ea..fa3363ab749c 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/l2switch.json +++ b/src/sonic-config-engine/tests/sample_output/py3/l2switch.json @@ -264,5 +264,12 @@ "Vlan1000|Ethernet124": { "tagging_mode": "untagged" } + }, + "FLEX_COUNTER_TABLE": { + "ACL": { + "FLEX_COUNTER_STATUS": "disable", + "FLEX_COUNTER_DELAY_STATUS": "true", + "POLL_INTERVAL": "10000" + } } } diff --git a/src/sonic-config-engine/tests/sample_output/py3/l2switch_dualtor.json b/src/sonic-config-engine/tests/sample_output/py3/l2switch_dualtor.json index 44edd892ab91..606a30672d9e 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/l2switch_dualtor.json +++ b/src/sonic-config-engine/tests/sample_output/py3/l2switch_dualtor.json @@ -643,5 +643,12 @@ "server_ipv6": "fc02:1000::19/128", "state": "auto" } + }, + "FLEX_COUNTER_TABLE": { + "ACL": { + "FLEX_COUNTER_STATUS": "disable", + "FLEX_COUNTER_DELAY_STATUS": "true", + "POLL_INTERVAL": "10000" + } } } diff --git a/src/sonic-config-engine/tests/sample_output/py3/l3_intfs.json b/src/sonic-config-engine/tests/sample_output/py3/l3_intfs.json index 9ca31832303f..7357c28fbef1 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/l3_intfs.json +++ b/src/sonic-config-engine/tests/sample_output/py3/l3_intfs.json @@ -297,5 +297,12 @@ "Ethernet29": {}, "Ethernet30": {}, "Ethernet31": {} + }, + "FLEX_COUNTER_TABLE": { + "ACL": { + "FLEX_COUNTER_STATUS": "disable", + "FLEX_COUNTER_DELAY_STATUS": "true", + "POLL_INTERVAL": "10000" + } } } diff --git a/src/sonic-config-engine/tests/sample_output/py3/ports.json b/src/sonic-config-engine/tests/sample_output/py3/ports.json index 1fee36338bd2..de9d4e25d1f3 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/ports.json +++ b/src/sonic-config-engine/tests/sample_output/py3/ports.json @@ -33,5 +33,194 @@ "description": "fortyGigE0/16" }, "OP": "SET" + }, + { + "PORT_TABLE:Ethernet20": { + "speed": "100000", + "description": "fortyGigE0/20" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet24": { + "speed": "100000", + "description": "fortyGigE0/24" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet28": { + "speed": "100000", + "description": "fortyGigE0/28" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet32": { + "speed": "100000", + "description": "fortyGigE0/32" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet36": { + "speed": "100000", + "description": "fortyGigE0/36" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet40": { + "speed": "100000", + "description": "fortyGigE0/40" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet44": { + "speed": "100000", + "description": "fortyGigE0/44" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet48": { + "speed": "100000", + "description": "fortyGigE0/48" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet52": { + "speed": "100000", + "description": "fortyGigE0/52" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet56": { + "speed": "100000", + "description": "fortyGigE0/56" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet60": { + "speed": "100000", + "description": "fortyGigE0/60" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet64": { + "speed": "100000", + "description": "fortyGigE0/64" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet68": { + "speed": "100000", + "description": "fortyGigE0/68" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet72": { + "speed": "100000", + "description": "fortyGigE0/72" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet76": { + "speed": "100000", + "description": "fortyGigE0/76" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet80": { + "speed": "100000", + "description": "fortyGigE0/80" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet84": { + "speed": "100000", + "description": "fortyGigE0/84" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet88": { + "speed": "100000", + "description": "fortyGigE0/88" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet92": { + "speed": "100000", + "description": "fortyGigE0/92" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet96": { + "speed": "100000", + "description": "fortyGigE0/96" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet100": { + "speed": "100000", + "description": "fortyGigE0/100" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet104": { + "speed": "100000", + "description": "fortyGigE0/104" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet108": { + "speed": "100000", + "description": "fortyGigE0/108" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet112": { + "speed": "100000", + "description": "fortyGigE0/112" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet116": { + "speed": "100000", + "description": "fortyGigE0/116" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet120": { + "speed": "100000", + "description": "fortyGigE0/120" + }, + "OP": "SET" + }, + { + "PORT_TABLE:Ethernet124": { + "speed": "100000", + "description": "fortyGigE0/124" + }, + "OP": "SET" } ] diff --git a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050.json b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050.json index 9a6f8a2ada78..b15fcf7a36c1 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050.json +++ b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050.json @@ -119,196 +119,224 @@ "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet8": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet12": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet16": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet20": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet24": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet28": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet32": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet36": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet40": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet44": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet48": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet52": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet56": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet60": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet64": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet68": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet72": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet76": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet80": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet84": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet88": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet92": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet96": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet112": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet116": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet120": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet124": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" } }, "WRED_PROFILE": { diff --git a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050cx3-dualtor.json b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050cx3-dualtor.json new file mode 100644 index 000000000000..84a2613df90d --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050cx3-dualtor.json @@ -0,0 +1,1145 @@ +{ + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "1", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "2", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "7" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type" : "DWRR", + "weight": "14" + }, + "scheduler.1": { + "type" : "DWRR", + "weight": "15" + } + }, + "PORT_QOS_MAP": { + "Ethernet0": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet4": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet8": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet12": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet16": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet20": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet24": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet28": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet32": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet36": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet40": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet44": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet48": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet52": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet56": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet60": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet64": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet68": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet72": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet76": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet80": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet84": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet88": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet92": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet96": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet100": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet104": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet108": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet112": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet116": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet120": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet124": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable" : "true", + "wred_yellow_enable" : "true", + "wred_red_enable" : "true", + "ecn" : "ecn_all", + "green_max_threshold" : "2097152", + "green_min_threshold" : "1048576", + "yellow_max_threshold" : "2097152", + "yellow_min_threshold" : "1048576", + "red_max_threshold" : "2097152", + "red_min_threshold" : "1048576", + "green_drop_probability" : "5", + "yellow_drop_probability": "5", + "red_drop_probability" : "5" + } + }, + "QUEUE": { + "Ethernet0|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet4|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet8|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet12|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet16|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet20|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet24|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet28|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet32|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet36|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet40|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet44|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet48|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet52|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet56|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet60|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet64|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet68|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet72|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet76|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet80|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet84|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet88|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet92|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet96|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet100|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet104|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet108|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet112|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet116|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet120|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet124|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet0|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet4|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet8|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet12|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet16|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet20|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet24|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet28|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet32|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet36|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet40|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet44|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet48|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet52|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet56|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet60|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet64|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet68|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet72|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet76|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet80|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet84|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet88|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet92|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet96|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet100|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet104|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet108|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet112|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet116|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet120|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet124|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet0|0": { + "scheduler": "scheduler.0" + }, + "Ethernet4|0": { + "scheduler": "scheduler.0" + }, + "Ethernet8|0": { + "scheduler": "scheduler.0" + }, + "Ethernet12|0": { + "scheduler": "scheduler.0" + }, + "Ethernet16|0": { + "scheduler": "scheduler.0" + }, + "Ethernet20|0": { + "scheduler": "scheduler.0" + }, + "Ethernet24|0": { + "scheduler": "scheduler.0" + }, + "Ethernet28|0": { + "scheduler": "scheduler.0" + }, + "Ethernet32|0": { + "scheduler": "scheduler.0" + }, + "Ethernet36|0": { + "scheduler": "scheduler.0" + }, + "Ethernet40|0": { + "scheduler": "scheduler.0" + }, + "Ethernet44|0": { + "scheduler": "scheduler.0" + }, + "Ethernet48|0": { + "scheduler": "scheduler.0" + }, + "Ethernet52|0": { + "scheduler": "scheduler.0" + }, + "Ethernet56|0": { + "scheduler": "scheduler.0" + }, + "Ethernet60|0": { + "scheduler": "scheduler.0" + }, + "Ethernet64|0": { + "scheduler": "scheduler.0" + }, + "Ethernet68|0": { + "scheduler": "scheduler.0" + }, + "Ethernet72|0": { + "scheduler": "scheduler.0" + }, + "Ethernet76|0": { + "scheduler": "scheduler.0" + }, + "Ethernet80|0": { + "scheduler": "scheduler.0" + }, + "Ethernet84|0": { + "scheduler": "scheduler.0" + }, + "Ethernet88|0": { + "scheduler": "scheduler.0" + }, + "Ethernet92|0": { + "scheduler": "scheduler.0" + }, + "Ethernet96|0": { + "scheduler": "scheduler.0" + }, + "Ethernet100|0": { + "scheduler": "scheduler.0" + }, + "Ethernet104|0": { + "scheduler": "scheduler.0" + }, + "Ethernet108|0": { + "scheduler": "scheduler.0" + }, + "Ethernet112|0": { + "scheduler": "scheduler.0" + }, + "Ethernet116|0": { + "scheduler": "scheduler.0" + }, + "Ethernet120|0": { + "scheduler": "scheduler.0" + }, + "Ethernet124|0": { + "scheduler": "scheduler.0" + }, + "Ethernet0|1": { + "scheduler": "scheduler.0" + }, + "Ethernet4|1": { + "scheduler": "scheduler.0" + }, + "Ethernet8|1": { + "scheduler": "scheduler.0" + }, + "Ethernet12|1": { + "scheduler": "scheduler.0" + }, + "Ethernet16|1": { + "scheduler": "scheduler.0" + }, + "Ethernet20|1": { + "scheduler": "scheduler.0" + }, + "Ethernet24|1": { + "scheduler": "scheduler.0" + }, + "Ethernet28|1": { + "scheduler": "scheduler.0" + }, + "Ethernet32|1": { + "scheduler": "scheduler.0" + }, + "Ethernet36|1": { + "scheduler": "scheduler.0" + }, + "Ethernet40|1": { + "scheduler": "scheduler.0" + }, + "Ethernet44|1": { + "scheduler": "scheduler.0" + }, + "Ethernet48|1": { + "scheduler": "scheduler.0" + }, + "Ethernet52|1": { + "scheduler": "scheduler.0" + }, + "Ethernet56|1": { + "scheduler": "scheduler.0" + }, + "Ethernet60|1": { + "scheduler": "scheduler.0" + }, + "Ethernet64|1": { + "scheduler": "scheduler.0" + }, + "Ethernet68|1": { + "scheduler": "scheduler.0" + }, + "Ethernet72|1": { + "scheduler": "scheduler.0" + }, + "Ethernet76|1": { + "scheduler": "scheduler.0" + }, + "Ethernet80|1": { + "scheduler": "scheduler.0" + }, + "Ethernet84|1": { + "scheduler": "scheduler.0" + }, + "Ethernet88|1": { + "scheduler": "scheduler.0" + }, + "Ethernet92|1": { + "scheduler": "scheduler.0" + }, + "Ethernet96|1": { + "scheduler": "scheduler.0" + }, + "Ethernet100|1": { + "scheduler": "scheduler.0" + }, + "Ethernet104|1": { + "scheduler": "scheduler.0" + }, + "Ethernet108|1": { + "scheduler": "scheduler.0" + }, + "Ethernet112|1": { + "scheduler": "scheduler.0" + }, + "Ethernet116|1": { + "scheduler": "scheduler.0" + }, + "Ethernet120|1": { + "scheduler": "scheduler.0" + }, + "Ethernet124|1": { + "scheduler": "scheduler.0" + }, + "Ethernet0|2": { + "scheduler": "scheduler.0" + }, + "Ethernet4|2": { + "scheduler": "scheduler.0" + }, + "Ethernet8|2": { + "scheduler": "scheduler.0" + }, + "Ethernet12|2": { + "scheduler": "scheduler.0" + }, + "Ethernet16|2": { + "scheduler": "scheduler.0" + }, + "Ethernet20|2": { + "scheduler": "scheduler.0" + }, + "Ethernet24|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet28|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet32|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet36|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet40|2": { + "scheduler": "scheduler.0" + }, + "Ethernet44|2": { + "scheduler": "scheduler.0" + }, + "Ethernet48|2": { + "scheduler": "scheduler.0" + }, + "Ethernet52|2": { + "scheduler": "scheduler.0" + }, + "Ethernet56|2": { + "scheduler": "scheduler.0" + }, + "Ethernet60|2": { + "scheduler": "scheduler.0" + }, + "Ethernet64|2": { + "scheduler": "scheduler.0" + }, + "Ethernet68|2": { + "scheduler": "scheduler.0" + }, + "Ethernet72|2": { + "scheduler": "scheduler.0" + }, + "Ethernet76|2": { + "scheduler": "scheduler.0" + }, + "Ethernet80|2": { + "scheduler": "scheduler.0" + }, + "Ethernet84|2": { + "scheduler": "scheduler.0" + }, + "Ethernet88|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet92|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet96|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet100|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet104|2": { + "scheduler": "scheduler.0" + }, + "Ethernet108|2": { + "scheduler": "scheduler.0" + }, + "Ethernet112|2": { + "scheduler": "scheduler.0" + }, + "Ethernet116|2": { + "scheduler": "scheduler.0" + }, + "Ethernet120|2": { + "scheduler": "scheduler.0" + }, + "Ethernet124|2": { + "scheduler": "scheduler.0" + }, + "Ethernet0|5": { + "scheduler": "scheduler.0" + }, + "Ethernet4|5": { + "scheduler": "scheduler.0" + }, + "Ethernet8|5": { + "scheduler": "scheduler.0" + }, + "Ethernet12|5": { + "scheduler": "scheduler.0" + }, + "Ethernet16|5": { + "scheduler": "scheduler.0" + }, + "Ethernet20|5": { + "scheduler": "scheduler.0" + }, + "Ethernet24|5": { + "scheduler": "scheduler.0" + }, + "Ethernet28|5": { + "scheduler": "scheduler.0" + }, + "Ethernet32|5": { + "scheduler": "scheduler.0" + }, + "Ethernet36|5": { + "scheduler": "scheduler.0" + }, + "Ethernet40|5": { + "scheduler": "scheduler.0" + }, + "Ethernet44|5": { + "scheduler": "scheduler.0" + }, + "Ethernet48|5": { + "scheduler": "scheduler.0" + }, + "Ethernet52|5": { + "scheduler": "scheduler.0" + }, + "Ethernet56|5": { + "scheduler": "scheduler.0" + }, + "Ethernet60|5": { + "scheduler": "scheduler.0" + }, + "Ethernet64|5": { + "scheduler": "scheduler.0" + }, + "Ethernet68|5": { + "scheduler": "scheduler.0" + }, + "Ethernet72|5": { + "scheduler": "scheduler.0" + }, + "Ethernet76|5": { + "scheduler": "scheduler.0" + }, + "Ethernet80|5": { + "scheduler": "scheduler.0" + }, + "Ethernet84|5": { + "scheduler": "scheduler.0" + }, + "Ethernet88|5": { + "scheduler": "scheduler.0" + }, + "Ethernet92|5": { + "scheduler": "scheduler.0" + }, + "Ethernet96|5": { + "scheduler": "scheduler.0" + }, + "Ethernet100|5": { + "scheduler": "scheduler.0" + }, + "Ethernet104|5": { + "scheduler": "scheduler.0" + }, + "Ethernet108|5": { + "scheduler": "scheduler.0" + }, + "Ethernet112|5": { + "scheduler": "scheduler.0" + }, + "Ethernet116|5": { + "scheduler": "scheduler.0" + }, + "Ethernet120|5": { + "scheduler": "scheduler.0" + }, + "Ethernet124|5": { + "scheduler": "scheduler.0" + }, + "Ethernet0|6": { + "scheduler": "scheduler.0" + }, + "Ethernet4|6": { + "scheduler": "scheduler.0" + }, + "Ethernet8|6": { + "scheduler": "scheduler.0" + }, + "Ethernet12|6": { + "scheduler": "scheduler.0" + }, + "Ethernet16|6": { + "scheduler": "scheduler.0" + }, + "Ethernet20|6": { + "scheduler": "scheduler.0" + }, + "Ethernet24|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet28|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet32|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet36|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet40|6": { + "scheduler": "scheduler.0" + }, + "Ethernet44|6": { + "scheduler": "scheduler.0" + }, + "Ethernet48|6": { + "scheduler": "scheduler.0" + }, + "Ethernet52|6": { + "scheduler": "scheduler.0" + }, + "Ethernet56|6": { + "scheduler": "scheduler.0" + }, + "Ethernet60|6": { + "scheduler": "scheduler.0" + }, + "Ethernet64|6": { + "scheduler": "scheduler.0" + }, + "Ethernet68|6": { + "scheduler": "scheduler.0" + }, + "Ethernet72|6": { + "scheduler": "scheduler.0" + }, + "Ethernet76|6": { + "scheduler": "scheduler.0" + }, + "Ethernet80|6": { + "scheduler": "scheduler.0" + }, + "Ethernet84|6": { + "scheduler": "scheduler.0" + }, + "Ethernet88|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet92|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet96|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet100|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet104|6": { + "scheduler": "scheduler.0" + }, + "Ethernet108|6": { + "scheduler": "scheduler.0" + }, + "Ethernet112|6": { + "scheduler": "scheduler.0" + }, + "Ethernet116|6": { + "scheduler": "scheduler.0" + }, + "Ethernet120|6": { + "scheduler": "scheduler.0" + }, + "Ethernet124|6": { + "scheduler": "scheduler.0" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-dualtor.json b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-dualtor.json new file mode 100644 index 000000000000..e8476cc0c865 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-dualtor.json @@ -0,0 +1,2137 @@ +{ + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "1", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "2", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "7" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type" : "DWRR", + "weight": "14" + }, + "scheduler.1": { + "type" : "DWRR", + "weight": "15" + } + }, + "PORT_QOS_MAP": { + "Ethernet0": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet4": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet8": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet12": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet16": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet20": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet24": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet28": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet32": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet36": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet40": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet44": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet48": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet52": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet56": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet60": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet64": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet68": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet72": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet76": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet80": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet84": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet88": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet92": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet96": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet100": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet104": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet108": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet112": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet116": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet120": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet124": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet128": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet132": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet136": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet140": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet144": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet148": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet152": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet156": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet160": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet164": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet168": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet172": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet176": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet180": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet184": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet188": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet192": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet196": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet200": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet204": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet208": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet212": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet216": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet220": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet224": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet228": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet232": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet236": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet240": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet244": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet248": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet252": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable" : "true", + "wred_yellow_enable" : "true", + "wred_red_enable" : "true", + "ecn" : "ecn_all", + "green_max_threshold" : "2097152", + "green_min_threshold" : "1048576", + "yellow_max_threshold" : "2097152", + "yellow_min_threshold" : "1048576", + "red_max_threshold" : "2097152", + "red_min_threshold" : "1048576", + "green_drop_probability" : "5", + "yellow_drop_probability": "5", + "red_drop_probability" : "5" + } + }, + "QUEUE": { + "Ethernet0|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet4|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet8|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet12|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet16|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet20|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet24|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet28|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet32|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet36|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet40|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet44|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet48|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet52|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet56|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet60|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet64|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet68|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet72|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet76|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet80|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet84|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet88|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet92|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet96|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet100|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet104|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet108|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet112|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet116|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet120|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet124|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet128|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet132|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet136|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet140|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet144|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet148|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet152|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet156|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet160|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet164|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet168|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet172|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet176|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet180|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet184|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet188|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet192|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet196|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet200|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet204|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet208|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet212|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet216|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet220|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet224|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet228|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet232|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet236|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet240|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet244|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet248|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet252|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet0|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet4|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet8|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet12|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet16|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet20|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet24|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet28|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet32|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet36|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet40|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet44|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet48|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet52|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet56|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet60|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet64|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet68|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet72|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet76|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet80|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet84|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet88|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet92|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet96|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet100|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet104|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet108|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet112|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet116|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet120|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet124|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet128|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet132|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet136|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet140|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet144|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet148|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet152|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet156|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet160|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet164|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet168|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet172|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet176|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet180|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet184|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet188|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet192|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet196|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet200|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet204|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet208|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet212|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet216|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet220|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet224|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet228|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet232|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet236|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet240|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet244|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet248|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet252|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet0|0": { + "scheduler": "scheduler.0" + }, + "Ethernet4|0": { + "scheduler": "scheduler.0" + }, + "Ethernet8|0": { + "scheduler": "scheduler.0" + }, + "Ethernet12|0": { + "scheduler": "scheduler.0" + }, + "Ethernet16|0": { + "scheduler": "scheduler.0" + }, + "Ethernet20|0": { + "scheduler": "scheduler.0" + }, + "Ethernet24|0": { + "scheduler": "scheduler.0" + }, + "Ethernet28|0": { + "scheduler": "scheduler.0" + }, + "Ethernet32|0": { + "scheduler": "scheduler.0" + }, + "Ethernet36|0": { + "scheduler": "scheduler.0" + }, + "Ethernet40|0": { + "scheduler": "scheduler.0" + }, + "Ethernet44|0": { + "scheduler": "scheduler.0" + }, + "Ethernet48|0": { + "scheduler": "scheduler.0" + }, + "Ethernet52|0": { + "scheduler": "scheduler.0" + }, + "Ethernet56|0": { + "scheduler": "scheduler.0" + }, + "Ethernet60|0": { + "scheduler": "scheduler.0" + }, + "Ethernet64|0": { + "scheduler": "scheduler.0" + }, + "Ethernet68|0": { + "scheduler": "scheduler.0" + }, + "Ethernet72|0": { + "scheduler": "scheduler.0" + }, + "Ethernet76|0": { + "scheduler": "scheduler.0" + }, + "Ethernet80|0": { + "scheduler": "scheduler.0" + }, + "Ethernet84|0": { + "scheduler": "scheduler.0" + }, + "Ethernet88|0": { + "scheduler": "scheduler.0" + }, + "Ethernet92|0": { + "scheduler": "scheduler.0" + }, + "Ethernet96|0": { + "scheduler": "scheduler.0" + }, + "Ethernet100|0": { + "scheduler": "scheduler.0" + }, + "Ethernet104|0": { + "scheduler": "scheduler.0" + }, + "Ethernet108|0": { + "scheduler": "scheduler.0" + }, + "Ethernet112|0": { + "scheduler": "scheduler.0" + }, + "Ethernet116|0": { + "scheduler": "scheduler.0" + }, + "Ethernet120|0": { + "scheduler": "scheduler.0" + }, + "Ethernet124|0": { + "scheduler": "scheduler.0" + }, + "Ethernet128|0": { + "scheduler": "scheduler.0" + }, + "Ethernet132|0": { + "scheduler": "scheduler.0" + }, + "Ethernet136|0": { + "scheduler": "scheduler.0" + }, + "Ethernet140|0": { + "scheduler": "scheduler.0" + }, + "Ethernet144|0": { + "scheduler": "scheduler.0" + }, + "Ethernet148|0": { + "scheduler": "scheduler.0" + }, + "Ethernet152|0": { + "scheduler": "scheduler.0" + }, + "Ethernet156|0": { + "scheduler": "scheduler.0" + }, + "Ethernet160|0": { + "scheduler": "scheduler.0" + }, + "Ethernet164|0": { + "scheduler": "scheduler.0" + }, + "Ethernet168|0": { + "scheduler": "scheduler.0" + }, + "Ethernet172|0": { + "scheduler": "scheduler.0" + }, + "Ethernet176|0": { + "scheduler": "scheduler.0" + }, + "Ethernet180|0": { + "scheduler": "scheduler.0" + }, + "Ethernet184|0": { + "scheduler": "scheduler.0" + }, + "Ethernet188|0": { + "scheduler": "scheduler.0" + }, + "Ethernet192|0": { + "scheduler": "scheduler.0" + }, + "Ethernet196|0": { + "scheduler": "scheduler.0" + }, + "Ethernet200|0": { + "scheduler": "scheduler.0" + }, + "Ethernet204|0": { + "scheduler": "scheduler.0" + }, + "Ethernet208|0": { + "scheduler": "scheduler.0" + }, + "Ethernet212|0": { + "scheduler": "scheduler.0" + }, + "Ethernet216|0": { + "scheduler": "scheduler.0" + }, + "Ethernet220|0": { + "scheduler": "scheduler.0" + }, + "Ethernet224|0": { + "scheduler": "scheduler.0" + }, + "Ethernet228|0": { + "scheduler": "scheduler.0" + }, + "Ethernet232|0": { + "scheduler": "scheduler.0" + }, + "Ethernet236|0": { + "scheduler": "scheduler.0" + }, + "Ethernet240|0": { + "scheduler": "scheduler.0" + }, + "Ethernet244|0": { + "scheduler": "scheduler.0" + }, + "Ethernet248|0": { + "scheduler": "scheduler.0" + }, + "Ethernet252|0": { + "scheduler": "scheduler.0" + }, + "Ethernet0|1": { + "scheduler": "scheduler.0" + }, + "Ethernet4|1": { + "scheduler": "scheduler.0" + }, + "Ethernet8|1": { + "scheduler": "scheduler.0" + }, + "Ethernet12|1": { + "scheduler": "scheduler.0" + }, + "Ethernet16|1": { + "scheduler": "scheduler.0" + }, + "Ethernet20|1": { + "scheduler": "scheduler.0" + }, + "Ethernet24|1": { + "scheduler": "scheduler.0" + }, + "Ethernet28|1": { + "scheduler": "scheduler.0" + }, + "Ethernet32|1": { + "scheduler": "scheduler.0" + }, + "Ethernet36|1": { + "scheduler": "scheduler.0" + }, + "Ethernet40|1": { + "scheduler": "scheduler.0" + }, + "Ethernet44|1": { + "scheduler": "scheduler.0" + }, + "Ethernet48|1": { + "scheduler": "scheduler.0" + }, + "Ethernet52|1": { + "scheduler": "scheduler.0" + }, + "Ethernet56|1": { + "scheduler": "scheduler.0" + }, + "Ethernet60|1": { + "scheduler": "scheduler.0" + }, + "Ethernet64|1": { + "scheduler": "scheduler.0" + }, + "Ethernet68|1": { + "scheduler": "scheduler.0" + }, + "Ethernet72|1": { + "scheduler": "scheduler.0" + }, + "Ethernet76|1": { + "scheduler": "scheduler.0" + }, + "Ethernet80|1": { + "scheduler": "scheduler.0" + }, + "Ethernet84|1": { + "scheduler": "scheduler.0" + }, + "Ethernet88|1": { + "scheduler": "scheduler.0" + }, + "Ethernet92|1": { + "scheduler": "scheduler.0" + }, + "Ethernet96|1": { + "scheduler": "scheduler.0" + }, + "Ethernet100|1": { + "scheduler": "scheduler.0" + }, + "Ethernet104|1": { + "scheduler": "scheduler.0" + }, + "Ethernet108|1": { + "scheduler": "scheduler.0" + }, + "Ethernet112|1": { + "scheduler": "scheduler.0" + }, + "Ethernet116|1": { + "scheduler": "scheduler.0" + }, + "Ethernet120|1": { + "scheduler": "scheduler.0" + }, + "Ethernet124|1": { + "scheduler": "scheduler.0" + }, + "Ethernet128|1": { + "scheduler": "scheduler.0" + }, + "Ethernet132|1": { + "scheduler": "scheduler.0" + }, + "Ethernet136|1": { + "scheduler": "scheduler.0" + }, + "Ethernet140|1": { + "scheduler": "scheduler.0" + }, + "Ethernet144|1": { + "scheduler": "scheduler.0" + }, + "Ethernet148|1": { + "scheduler": "scheduler.0" + }, + "Ethernet152|1": { + "scheduler": "scheduler.0" + }, + "Ethernet156|1": { + "scheduler": "scheduler.0" + }, + "Ethernet160|1": { + "scheduler": "scheduler.0" + }, + "Ethernet164|1": { + "scheduler": "scheduler.0" + }, + "Ethernet168|1": { + "scheduler": "scheduler.0" + }, + "Ethernet172|1": { + "scheduler": "scheduler.0" + }, + "Ethernet176|1": { + "scheduler": "scheduler.0" + }, + "Ethernet180|1": { + "scheduler": "scheduler.0" + }, + "Ethernet184|1": { + "scheduler": "scheduler.0" + }, + "Ethernet188|1": { + "scheduler": "scheduler.0" + }, + "Ethernet192|1": { + "scheduler": "scheduler.0" + }, + "Ethernet196|1": { + "scheduler": "scheduler.0" + }, + "Ethernet200|1": { + "scheduler": "scheduler.0" + }, + "Ethernet204|1": { + "scheduler": "scheduler.0" + }, + "Ethernet208|1": { + "scheduler": "scheduler.0" + }, + "Ethernet212|1": { + "scheduler": "scheduler.0" + }, + "Ethernet216|1": { + "scheduler": "scheduler.0" + }, + "Ethernet220|1": { + "scheduler": "scheduler.0" + }, + "Ethernet224|1": { + "scheduler": "scheduler.0" + }, + "Ethernet228|1": { + "scheduler": "scheduler.0" + }, + "Ethernet232|1": { + "scheduler": "scheduler.0" + }, + "Ethernet236|1": { + "scheduler": "scheduler.0" + }, + "Ethernet240|1": { + "scheduler": "scheduler.0" + }, + "Ethernet244|1": { + "scheduler": "scheduler.0" + }, + "Ethernet248|1": { + "scheduler": "scheduler.0" + }, + "Ethernet252|1": { + "scheduler": "scheduler.0" + }, + "Ethernet0|2": { + "scheduler": "scheduler.0" + }, + "Ethernet4|2": { + "scheduler": "scheduler.0" + }, + "Ethernet8|2": { + "scheduler": "scheduler.0" + }, + "Ethernet12|2": { + "scheduler": "scheduler.0" + }, + "Ethernet16|2": { + "scheduler": "scheduler.0" + }, + "Ethernet20|2": { + "scheduler": "scheduler.0" + }, + "Ethernet24|2": { + "scheduler": "scheduler.0" + }, + "Ethernet28|2": { + "scheduler": "scheduler.0" + }, + "Ethernet32|2": { + "scheduler": "scheduler.0" + }, + "Ethernet36|2": { + "scheduler": "scheduler.0" + }, + "Ethernet40|2": { + "scheduler": "scheduler.0" + }, + "Ethernet44|2": { + "scheduler": "scheduler.0" + }, + "Ethernet48|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet52|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet56|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet60|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet64|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet68|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet72|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet76|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet80|2": { + "scheduler": "scheduler.0" + }, + "Ethernet84|2": { + "scheduler": "scheduler.0" + }, + "Ethernet88|2": { + "scheduler": "scheduler.0" + }, + "Ethernet92|2": { + "scheduler": "scheduler.0" + }, + "Ethernet96|2": { + "scheduler": "scheduler.0" + }, + "Ethernet100|2": { + "scheduler": "scheduler.0" + }, + "Ethernet104|2": { + "scheduler": "scheduler.0" + }, + "Ethernet108|2": { + "scheduler": "scheduler.0" + }, + "Ethernet112|2": { + "scheduler": "scheduler.0" + }, + "Ethernet116|2": { + "scheduler": "scheduler.0" + }, + "Ethernet120|2": { + "scheduler": "scheduler.0" + }, + "Ethernet124|2": { + "scheduler": "scheduler.0" + }, + "Ethernet128|2": { + "scheduler": "scheduler.0" + }, + "Ethernet132|2": { + "scheduler": "scheduler.0" + }, + "Ethernet136|2": { + "scheduler": "scheduler.0" + }, + "Ethernet140|2": { + "scheduler": "scheduler.0" + }, + "Ethernet144|2": { + "scheduler": "scheduler.0" + }, + "Ethernet148|2": { + "scheduler": "scheduler.0" + }, + "Ethernet152|2": { + "scheduler": "scheduler.0" + }, + "Ethernet156|2": { + "scheduler": "scheduler.0" + }, + "Ethernet160|2": { + "scheduler": "scheduler.0" + }, + "Ethernet164|2": { + "scheduler": "scheduler.0" + }, + "Ethernet168|2": { + "scheduler": "scheduler.0" + }, + "Ethernet172|2": { + "scheduler": "scheduler.0" + }, + "Ethernet176|2": { + "scheduler": "scheduler.0" + }, + "Ethernet180|2": { + "scheduler": "scheduler.0" + }, + "Ethernet184|2": { + "scheduler": "scheduler.0" + }, + "Ethernet188|2": { + "scheduler": "scheduler.0" + }, + "Ethernet192|2": { + "scheduler": "scheduler.0" + }, + "Ethernet196|2": { + "scheduler": "scheduler.0" + }, + "Ethernet200|2": { + "scheduler": "scheduler.0" + }, + "Ethernet204|2": { + "scheduler": "scheduler.0" + }, + "Ethernet208|2": { + "scheduler": "scheduler.0" + }, + "Ethernet212|2": { + "scheduler": "scheduler.0" + }, + "Ethernet216|2": { + "scheduler": "scheduler.0" + }, + "Ethernet220|2": { + "scheduler": "scheduler.0" + }, + "Ethernet224|2": { + "scheduler": "scheduler.0" + }, + "Ethernet228|2": { + "scheduler": "scheduler.0" + }, + "Ethernet232|2": { + "scheduler": "scheduler.0" + }, + "Ethernet236|2": { + "scheduler": "scheduler.0" + }, + "Ethernet240|2": { + "scheduler": "scheduler.0" + }, + "Ethernet244|2": { + "scheduler": "scheduler.0" + }, + "Ethernet248|2": { + "scheduler": "scheduler.0" + }, + "Ethernet252|2": { + "scheduler": "scheduler.0" + }, + "Ethernet0|5": { + "scheduler": "scheduler.0" + }, + "Ethernet4|5": { + "scheduler": "scheduler.0" + }, + "Ethernet8|5": { + "scheduler": "scheduler.0" + }, + "Ethernet12|5": { + "scheduler": "scheduler.0" + }, + "Ethernet16|5": { + "scheduler": "scheduler.0" + }, + "Ethernet20|5": { + "scheduler": "scheduler.0" + }, + "Ethernet24|5": { + "scheduler": "scheduler.0" + }, + "Ethernet28|5": { + "scheduler": "scheduler.0" + }, + "Ethernet32|5": { + "scheduler": "scheduler.0" + }, + "Ethernet36|5": { + "scheduler": "scheduler.0" + }, + "Ethernet40|5": { + "scheduler": "scheduler.0" + }, + "Ethernet44|5": { + "scheduler": "scheduler.0" + }, + "Ethernet48|5": { + "scheduler": "scheduler.0" + }, + "Ethernet52|5": { + "scheduler": "scheduler.0" + }, + "Ethernet56|5": { + "scheduler": "scheduler.0" + }, + "Ethernet60|5": { + "scheduler": "scheduler.0" + }, + "Ethernet64|5": { + "scheduler": "scheduler.0" + }, + "Ethernet68|5": { + "scheduler": "scheduler.0" + }, + "Ethernet72|5": { + "scheduler": "scheduler.0" + }, + "Ethernet76|5": { + "scheduler": "scheduler.0" + }, + "Ethernet80|5": { + "scheduler": "scheduler.0" + }, + "Ethernet84|5": { + "scheduler": "scheduler.0" + }, + "Ethernet88|5": { + "scheduler": "scheduler.0" + }, + "Ethernet92|5": { + "scheduler": "scheduler.0" + }, + "Ethernet96|5": { + "scheduler": "scheduler.0" + }, + "Ethernet100|5": { + "scheduler": "scheduler.0" + }, + "Ethernet104|5": { + "scheduler": "scheduler.0" + }, + "Ethernet108|5": { + "scheduler": "scheduler.0" + }, + "Ethernet112|5": { + "scheduler": "scheduler.0" + }, + "Ethernet116|5": { + "scheduler": "scheduler.0" + }, + "Ethernet120|5": { + "scheduler": "scheduler.0" + }, + "Ethernet124|5": { + "scheduler": "scheduler.0" + }, + "Ethernet128|5": { + "scheduler": "scheduler.0" + }, + "Ethernet132|5": { + "scheduler": "scheduler.0" + }, + "Ethernet136|5": { + "scheduler": "scheduler.0" + }, + "Ethernet140|5": { + "scheduler": "scheduler.0" + }, + "Ethernet144|5": { + "scheduler": "scheduler.0" + }, + "Ethernet148|5": { + "scheduler": "scheduler.0" + }, + "Ethernet152|5": { + "scheduler": "scheduler.0" + }, + "Ethernet156|5": { + "scheduler": "scheduler.0" + }, + "Ethernet160|5": { + "scheduler": "scheduler.0" + }, + "Ethernet164|5": { + "scheduler": "scheduler.0" + }, + "Ethernet168|5": { + "scheduler": "scheduler.0" + }, + "Ethernet172|5": { + "scheduler": "scheduler.0" + }, + "Ethernet176|5": { + "scheduler": "scheduler.0" + }, + "Ethernet180|5": { + "scheduler": "scheduler.0" + }, + "Ethernet184|5": { + "scheduler": "scheduler.0" + }, + "Ethernet188|5": { + "scheduler": "scheduler.0" + }, + "Ethernet192|5": { + "scheduler": "scheduler.0" + }, + "Ethernet196|5": { + "scheduler": "scheduler.0" + }, + "Ethernet200|5": { + "scheduler": "scheduler.0" + }, + "Ethernet204|5": { + "scheduler": "scheduler.0" + }, + "Ethernet208|5": { + "scheduler": "scheduler.0" + }, + "Ethernet212|5": { + "scheduler": "scheduler.0" + }, + "Ethernet216|5": { + "scheduler": "scheduler.0" + }, + "Ethernet220|5": { + "scheduler": "scheduler.0" + }, + "Ethernet224|5": { + "scheduler": "scheduler.0" + }, + "Ethernet228|5": { + "scheduler": "scheduler.0" + }, + "Ethernet232|5": { + "scheduler": "scheduler.0" + }, + "Ethernet236|5": { + "scheduler": "scheduler.0" + }, + "Ethernet240|5": { + "scheduler": "scheduler.0" + }, + "Ethernet244|5": { + "scheduler": "scheduler.0" + }, + "Ethernet248|5": { + "scheduler": "scheduler.0" + }, + "Ethernet252|5": { + "scheduler": "scheduler.0" + }, + "Ethernet0|6": { + "scheduler": "scheduler.0" + }, + "Ethernet4|6": { + "scheduler": "scheduler.0" + }, + "Ethernet8|6": { + "scheduler": "scheduler.0" + }, + "Ethernet12|6": { + "scheduler": "scheduler.0" + }, + "Ethernet16|6": { + "scheduler": "scheduler.0" + }, + "Ethernet20|6": { + "scheduler": "scheduler.0" + }, + "Ethernet24|6": { + "scheduler": "scheduler.0" + }, + "Ethernet28|6": { + "scheduler": "scheduler.0" + }, + "Ethernet32|6": { + "scheduler": "scheduler.0" + }, + "Ethernet36|6": { + "scheduler": "scheduler.0" + }, + "Ethernet40|6": { + "scheduler": "scheduler.0" + }, + "Ethernet44|6": { + "scheduler": "scheduler.0" + }, + "Ethernet48|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet52|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet56|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet60|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet64|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet68|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet72|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet76|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet80|6": { + "scheduler": "scheduler.0" + }, + "Ethernet84|6": { + "scheduler": "scheduler.0" + }, + "Ethernet88|6": { + "scheduler": "scheduler.0" + }, + "Ethernet92|6": { + "scheduler": "scheduler.0" + }, + "Ethernet96|6": { + "scheduler": "scheduler.0" + }, + "Ethernet100|6": { + "scheduler": "scheduler.0" + }, + "Ethernet104|6": { + "scheduler": "scheduler.0" + }, + "Ethernet108|6": { + "scheduler": "scheduler.0" + }, + "Ethernet112|6": { + "scheduler": "scheduler.0" + }, + "Ethernet116|6": { + "scheduler": "scheduler.0" + }, + "Ethernet120|6": { + "scheduler": "scheduler.0" + }, + "Ethernet124|6": { + "scheduler": "scheduler.0" + }, + "Ethernet128|6": { + "scheduler": "scheduler.0" + }, + "Ethernet132|6": { + "scheduler": "scheduler.0" + }, + "Ethernet136|6": { + "scheduler": "scheduler.0" + }, + "Ethernet140|6": { + "scheduler": "scheduler.0" + }, + "Ethernet144|6": { + "scheduler": "scheduler.0" + }, + "Ethernet148|6": { + "scheduler": "scheduler.0" + }, + "Ethernet152|6": { + "scheduler": "scheduler.0" + }, + "Ethernet156|6": { + "scheduler": "scheduler.0" + }, + "Ethernet160|6": { + "scheduler": "scheduler.0" + }, + "Ethernet164|6": { + "scheduler": "scheduler.0" + }, + "Ethernet168|6": { + "scheduler": "scheduler.0" + }, + "Ethernet172|6": { + "scheduler": "scheduler.0" + }, + "Ethernet176|6": { + "scheduler": "scheduler.0" + }, + "Ethernet180|6": { + "scheduler": "scheduler.0" + }, + "Ethernet184|6": { + "scheduler": "scheduler.0" + }, + "Ethernet188|6": { + "scheduler": "scheduler.0" + }, + "Ethernet192|6": { + "scheduler": "scheduler.0" + }, + "Ethernet196|6": { + "scheduler": "scheduler.0" + }, + "Ethernet200|6": { + "scheduler": "scheduler.0" + }, + "Ethernet204|6": { + "scheduler": "scheduler.0" + }, + "Ethernet208|6": { + "scheduler": "scheduler.0" + }, + "Ethernet212|6": { + "scheduler": "scheduler.0" + }, + "Ethernet216|6": { + "scheduler": "scheduler.0" + }, + "Ethernet220|6": { + "scheduler": "scheduler.0" + }, + "Ethernet224|6": { + "scheduler": "scheduler.0" + }, + "Ethernet228|6": { + "scheduler": "scheduler.0" + }, + "Ethernet232|6": { + "scheduler": "scheduler.0" + }, + "Ethernet236|6": { + "scheduler": "scheduler.0" + }, + "Ethernet240|6": { + "scheduler": "scheduler.0" + }, + "Ethernet244|6": { + "scheduler": "scheduler.0" + }, + "Ethernet248|6": { + "scheduler": "scheduler.0" + }, + "Ethernet252|6": { + "scheduler": "scheduler.0" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-t1.json b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-t1.json new file mode 100644 index 000000000000..9db828a759e4 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7260-t1.json @@ -0,0 +1,1045 @@ +{ + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0" : "1", + "1" : "1", + "2" : "2", + "3" : "3", + "4" : "4", + "5" : "1", + "6" : "6", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "1", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "7", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + } + }, + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "2", + "3": "3", + "4": "4", + "5": "0", + "6": "6", + "7": "7" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type" : "DWRR", + "weight": "14" + }, + "scheduler.1": { + "type" : "DWRR", + "weight": "15" + } + }, + "PORT_QOS_MAP": { + "Ethernet0": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet4": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet16": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet20": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet64": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet68": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet80": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet84": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet136": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet144": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet148": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet152": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet156": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet168": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet176": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet180": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet184": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet188": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet200": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet208": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet212": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet216": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet220": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet232": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet240": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet244": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet248": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet252": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "2,3,4,6", + "pfcwd_sw_enable" : "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable" : "true", + "wred_yellow_enable" : "true", + "wred_red_enable" : "true", + "ecn" : "ecn_all", + "green_max_threshold" : "2097152", + "green_min_threshold" : "1048576", + "yellow_max_threshold" : "2097152", + "yellow_min_threshold" : "1048576", + "red_max_threshold" : "2097152", + "red_min_threshold" : "1048576", + "green_drop_probability" : "5", + "yellow_drop_probability": "5", + "red_drop_probability" : "5" + } + }, + "QUEUE": { + "Ethernet0|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet4|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet16|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet20|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet64|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet68|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet80|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet84|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet136|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet144|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet148|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet152|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet156|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet168|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet176|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet180|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet184|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet188|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet200|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet208|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet212|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet216|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet220|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet232|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet240|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet244|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet248|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet252|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet0|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet4|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet16|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet20|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet64|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet68|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet80|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet84|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet136|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet144|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet148|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet152|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet156|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet168|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet176|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet180|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet184|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet188|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet200|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet208|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet212|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet216|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet220|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet232|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet240|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet244|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet248|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet252|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet0|0": { + "scheduler": "scheduler.0" + }, + "Ethernet4|0": { + "scheduler": "scheduler.0" + }, + "Ethernet16|0": { + "scheduler": "scheduler.0" + }, + "Ethernet20|0": { + "scheduler": "scheduler.0" + }, + "Ethernet64|0": { + "scheduler": "scheduler.0" + }, + "Ethernet68|0": { + "scheduler": "scheduler.0" + }, + "Ethernet80|0": { + "scheduler": "scheduler.0" + }, + "Ethernet84|0": { + "scheduler": "scheduler.0" + }, + "Ethernet136|0": { + "scheduler": "scheduler.0" + }, + "Ethernet144|0": { + "scheduler": "scheduler.0" + }, + "Ethernet148|0": { + "scheduler": "scheduler.0" + }, + "Ethernet152|0": { + "scheduler": "scheduler.0" + }, + "Ethernet156|0": { + "scheduler": "scheduler.0" + }, + "Ethernet168|0": { + "scheduler": "scheduler.0" + }, + "Ethernet176|0": { + "scheduler": "scheduler.0" + }, + "Ethernet180|0": { + "scheduler": "scheduler.0" + }, + "Ethernet184|0": { + "scheduler": "scheduler.0" + }, + "Ethernet188|0": { + "scheduler": "scheduler.0" + }, + "Ethernet200|0": { + "scheduler": "scheduler.0" + }, + "Ethernet208|0": { + "scheduler": "scheduler.0" + }, + "Ethernet212|0": { + "scheduler": "scheduler.0" + }, + "Ethernet216|0": { + "scheduler": "scheduler.0" + }, + "Ethernet220|0": { + "scheduler": "scheduler.0" + }, + "Ethernet232|0": { + "scheduler": "scheduler.0" + }, + "Ethernet240|0": { + "scheduler": "scheduler.0" + }, + "Ethernet244|0": { + "scheduler": "scheduler.0" + }, + "Ethernet248|0": { + "scheduler": "scheduler.0" + }, + "Ethernet252|0": { + "scheduler": "scheduler.0" + }, + "Ethernet0|1": { + "scheduler": "scheduler.0" + }, + "Ethernet4|1": { + "scheduler": "scheduler.0" + }, + "Ethernet16|1": { + "scheduler": "scheduler.0" + }, + "Ethernet20|1": { + "scheduler": "scheduler.0" + }, + "Ethernet64|1": { + "scheduler": "scheduler.0" + }, + "Ethernet68|1": { + "scheduler": "scheduler.0" + }, + "Ethernet80|1": { + "scheduler": "scheduler.0" + }, + "Ethernet84|1": { + "scheduler": "scheduler.0" + }, + "Ethernet136|1": { + "scheduler": "scheduler.0" + }, + "Ethernet144|1": { + "scheduler": "scheduler.0" + }, + "Ethernet148|1": { + "scheduler": "scheduler.0" + }, + "Ethernet152|1": { + "scheduler": "scheduler.0" + }, + "Ethernet156|1": { + "scheduler": "scheduler.0" + }, + "Ethernet168|1": { + "scheduler": "scheduler.0" + }, + "Ethernet176|1": { + "scheduler": "scheduler.0" + }, + "Ethernet180|1": { + "scheduler": "scheduler.0" + }, + "Ethernet184|1": { + "scheduler": "scheduler.0" + }, + "Ethernet188|1": { + "scheduler": "scheduler.0" + }, + "Ethernet200|1": { + "scheduler": "scheduler.0" + }, + "Ethernet208|1": { + "scheduler": "scheduler.0" + }, + "Ethernet212|1": { + "scheduler": "scheduler.0" + }, + "Ethernet216|1": { + "scheduler": "scheduler.0" + }, + "Ethernet220|1": { + "scheduler": "scheduler.0" + }, + "Ethernet232|1": { + "scheduler": "scheduler.0" + }, + "Ethernet240|1": { + "scheduler": "scheduler.0" + }, + "Ethernet244|1": { + "scheduler": "scheduler.0" + }, + "Ethernet248|1": { + "scheduler": "scheduler.0" + }, + "Ethernet252|1": { + "scheduler": "scheduler.0" + }, + "Ethernet0|2": { + "scheduler": "scheduler.0" + }, + "Ethernet4|2": { + "scheduler": "scheduler.0" + }, + "Ethernet16|2": { + "scheduler": "scheduler.0" + }, + "Ethernet20|2": { + "scheduler": "scheduler.0" + }, + "Ethernet64|2": { + "scheduler": "scheduler.0" + }, + "Ethernet68|2": { + "scheduler": "scheduler.0" + }, + "Ethernet80|2": { + "scheduler": "scheduler.0" + }, + "Ethernet84|2": { + "scheduler": "scheduler.0" + }, + "Ethernet136|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet144|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet148|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet152|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet156|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet168|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet176|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet180|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet184|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet188|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet200|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet208|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet212|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet216|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet220|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet232|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet240|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet244|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet248|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet252|2": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet0|5": { + "scheduler": "scheduler.0" + }, + "Ethernet4|5": { + "scheduler": "scheduler.0" + }, + "Ethernet16|5": { + "scheduler": "scheduler.0" + }, + "Ethernet20|5": { + "scheduler": "scheduler.0" + }, + "Ethernet64|5": { + "scheduler": "scheduler.0" + }, + "Ethernet68|5": { + "scheduler": "scheduler.0" + }, + "Ethernet80|5": { + "scheduler": "scheduler.0" + }, + "Ethernet84|5": { + "scheduler": "scheduler.0" + }, + "Ethernet136|5": { + "scheduler": "scheduler.0" + }, + "Ethernet144|5": { + "scheduler": "scheduler.0" + }, + "Ethernet148|5": { + "scheduler": "scheduler.0" + }, + "Ethernet152|5": { + "scheduler": "scheduler.0" + }, + "Ethernet156|5": { + "scheduler": "scheduler.0" + }, + "Ethernet168|5": { + "scheduler": "scheduler.0" + }, + "Ethernet176|5": { + "scheduler": "scheduler.0" + }, + "Ethernet180|5": { + "scheduler": "scheduler.0" + }, + "Ethernet184|5": { + "scheduler": "scheduler.0" + }, + "Ethernet188|5": { + "scheduler": "scheduler.0" + }, + "Ethernet200|5": { + "scheduler": "scheduler.0" + }, + "Ethernet208|5": { + "scheduler": "scheduler.0" + }, + "Ethernet212|5": { + "scheduler": "scheduler.0" + }, + "Ethernet216|5": { + "scheduler": "scheduler.0" + }, + "Ethernet220|5": { + "scheduler": "scheduler.0" + }, + "Ethernet232|5": { + "scheduler": "scheduler.0" + }, + "Ethernet240|5": { + "scheduler": "scheduler.0" + }, + "Ethernet244|5": { + "scheduler": "scheduler.0" + }, + "Ethernet248|5": { + "scheduler": "scheduler.0" + }, + "Ethernet252|5": { + "scheduler": "scheduler.0" + }, + "Ethernet0|6": { + "scheduler": "scheduler.0" + }, + "Ethernet4|6": { + "scheduler": "scheduler.0" + }, + "Ethernet16|6": { + "scheduler": "scheduler.0" + }, + "Ethernet20|6": { + "scheduler": "scheduler.0" + }, + "Ethernet64|6": { + "scheduler": "scheduler.0" + }, + "Ethernet68|6": { + "scheduler": "scheduler.0" + }, + "Ethernet80|6": { + "scheduler": "scheduler.0" + }, + "Ethernet84|6": { + "scheduler": "scheduler.0" + }, + "Ethernet136|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet144|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet148|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet152|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet156|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet168|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet176|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet180|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet184|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet188|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet200|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet208|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet212|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet216|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet220|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet232|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet240|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet244|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet248|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet252|6": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7800r3-48cq2-lc.json b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7800r3-48cq2-lc.json new file mode 100644 index 000000000000..92ba2caf8d17 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7800r3-48cq2-lc.json @@ -0,0 +1,1532 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "7" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "2", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "1", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "6", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type" : "DWRR", + "weight": "14" + }, + "scheduler.1": { + "type" : "DWRR", + "weight": "15" + } + }, + "PORT_QOS_MAP": { + "Ethernet0": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet4": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet8": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet12": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet16": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet20": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet24": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet28": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet32": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet36": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet40": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet44": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet48": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet52": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet56": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet60": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet64": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet68": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet72": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet76": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet80": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet84": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet88": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet92": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet96": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet100": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet104": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet108": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet112": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet116": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet120": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet124": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet128": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet132": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet136": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet140": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet144": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet148": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet152": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet156": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet164": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet176": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet180": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet184": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet188": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable" : "true", + "wred_yellow_enable" : "true", + "wred_red_enable" : "true", + "ecn" : "ecn_all", + "green_max_threshold" : "2097152", + "green_min_threshold" : "250000", + "yellow_max_threshold" : "2097152", + "yellow_min_threshold" : "1048576", + "red_max_threshold" : "2097152", + "red_min_threshold" : "1048576", + "green_drop_probability" : "5", + "yellow_drop_probability": "5", + "red_drop_probability" : "5" + } + }, + "QUEUE": { + "Ethernet0|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet4|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet8|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet12|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet16|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet20|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet24|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet28|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet32|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet36|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet40|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet44|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet48|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet52|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet56|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet60|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet64|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet68|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet72|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet76|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet80|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet84|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet88|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet92|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet96|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet100|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet104|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet108|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet112|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet116|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet120|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet124|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet128|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet132|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet136|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet140|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet144|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet148|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet152|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet156|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet164|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet176|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet180|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet184|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet188|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet0|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet4|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet8|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet12|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet16|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet20|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet24|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet28|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet32|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet36|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet40|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet44|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet48|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet52|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet56|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet60|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet64|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet68|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet72|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet76|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet80|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet84|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet88|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet92|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet96|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet100|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet104|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet108|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet112|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet116|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet120|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet124|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet128|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet132|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet136|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet140|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet144|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet148|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet152|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet156|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet164|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet176|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet180|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet184|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet188|4": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet0|0": { + "scheduler": "scheduler.0" + }, + "Ethernet4|0": { + "scheduler": "scheduler.0" + }, + "Ethernet8|0": { + "scheduler": "scheduler.0" + }, + "Ethernet12|0": { + "scheduler": "scheduler.0" + }, + "Ethernet16|0": { + "scheduler": "scheduler.0" + }, + "Ethernet20|0": { + "scheduler": "scheduler.0" + }, + "Ethernet24|0": { + "scheduler": "scheduler.0" + }, + "Ethernet28|0": { + "scheduler": "scheduler.0" + }, + "Ethernet32|0": { + "scheduler": "scheduler.0" + }, + "Ethernet36|0": { + "scheduler": "scheduler.0" + }, + "Ethernet40|0": { + "scheduler": "scheduler.0" + }, + "Ethernet44|0": { + "scheduler": "scheduler.0" + }, + "Ethernet48|0": { + "scheduler": "scheduler.0" + }, + "Ethernet52|0": { + "scheduler": "scheduler.0" + }, + "Ethernet56|0": { + "scheduler": "scheduler.0" + }, + "Ethernet60|0": { + "scheduler": "scheduler.0" + }, + "Ethernet64|0": { + "scheduler": "scheduler.0" + }, + "Ethernet68|0": { + "scheduler": "scheduler.0" + }, + "Ethernet72|0": { + "scheduler": "scheduler.0" + }, + "Ethernet76|0": { + "scheduler": "scheduler.0" + }, + "Ethernet80|0": { + "scheduler": "scheduler.0" + }, + "Ethernet84|0": { + "scheduler": "scheduler.0" + }, + "Ethernet88|0": { + "scheduler": "scheduler.0" + }, + "Ethernet92|0": { + "scheduler": "scheduler.0" + }, + "Ethernet96|0": { + "scheduler": "scheduler.0" + }, + "Ethernet100|0": { + "scheduler": "scheduler.0" + }, + "Ethernet104|0": { + "scheduler": "scheduler.0" + }, + "Ethernet108|0": { + "scheduler": "scheduler.0" + }, + "Ethernet112|0": { + "scheduler": "scheduler.0" + }, + "Ethernet116|0": { + "scheduler": "scheduler.0" + }, + "Ethernet120|0": { + "scheduler": "scheduler.0" + }, + "Ethernet124|0": { + "scheduler": "scheduler.0" + }, + "Ethernet128|0": { + "scheduler": "scheduler.0" + }, + "Ethernet132|0": { + "scheduler": "scheduler.0" + }, + "Ethernet136|0": { + "scheduler": "scheduler.0" + }, + "Ethernet140|0": { + "scheduler": "scheduler.0" + }, + "Ethernet144|0": { + "scheduler": "scheduler.0" + }, + "Ethernet148|0": { + "scheduler": "scheduler.0" + }, + "Ethernet152|0": { + "scheduler": "scheduler.0" + }, + "Ethernet156|0": { + "scheduler": "scheduler.0" + }, + "Ethernet164|0": { + "scheduler": "scheduler.0" + }, + "Ethernet176|0": { + "scheduler": "scheduler.0" + }, + "Ethernet180|0": { + "scheduler": "scheduler.0" + }, + "Ethernet184|0": { + "scheduler": "scheduler.0" + }, + "Ethernet188|0": { + "scheduler": "scheduler.0" + }, + "Ethernet0|1": { + "scheduler": "scheduler.0" + }, + "Ethernet4|1": { + "scheduler": "scheduler.0" + }, + "Ethernet8|1": { + "scheduler": "scheduler.0" + }, + "Ethernet12|1": { + "scheduler": "scheduler.0" + }, + "Ethernet16|1": { + "scheduler": "scheduler.0" + }, + "Ethernet20|1": { + "scheduler": "scheduler.0" + }, + "Ethernet24|1": { + "scheduler": "scheduler.0" + }, + "Ethernet28|1": { + "scheduler": "scheduler.0" + }, + "Ethernet32|1": { + "scheduler": "scheduler.0" + }, + "Ethernet36|1": { + "scheduler": "scheduler.0" + }, + "Ethernet40|1": { + "scheduler": "scheduler.0" + }, + "Ethernet44|1": { + "scheduler": "scheduler.0" + }, + "Ethernet48|1": { + "scheduler": "scheduler.0" + }, + "Ethernet52|1": { + "scheduler": "scheduler.0" + }, + "Ethernet56|1": { + "scheduler": "scheduler.0" + }, + "Ethernet60|1": { + "scheduler": "scheduler.0" + }, + "Ethernet64|1": { + "scheduler": "scheduler.0" + }, + "Ethernet68|1": { + "scheduler": "scheduler.0" + }, + "Ethernet72|1": { + "scheduler": "scheduler.0" + }, + "Ethernet76|1": { + "scheduler": "scheduler.0" + }, + "Ethernet80|1": { + "scheduler": "scheduler.0" + }, + "Ethernet84|1": { + "scheduler": "scheduler.0" + }, + "Ethernet88|1": { + "scheduler": "scheduler.0" + }, + "Ethernet92|1": { + "scheduler": "scheduler.0" + }, + "Ethernet96|1": { + "scheduler": "scheduler.0" + }, + "Ethernet100|1": { + "scheduler": "scheduler.0" + }, + "Ethernet104|1": { + "scheduler": "scheduler.0" + }, + "Ethernet108|1": { + "scheduler": "scheduler.0" + }, + "Ethernet112|1": { + "scheduler": "scheduler.0" + }, + "Ethernet116|1": { + "scheduler": "scheduler.0" + }, + "Ethernet120|1": { + "scheduler": "scheduler.0" + }, + "Ethernet124|1": { + "scheduler": "scheduler.0" + }, + "Ethernet128|1": { + "scheduler": "scheduler.0" + }, + "Ethernet132|1": { + "scheduler": "scheduler.0" + }, + "Ethernet136|1": { + "scheduler": "scheduler.0" + }, + "Ethernet140|1": { + "scheduler": "scheduler.0" + }, + "Ethernet144|1": { + "scheduler": "scheduler.0" + }, + "Ethernet148|1": { + "scheduler": "scheduler.0" + }, + "Ethernet152|1": { + "scheduler": "scheduler.0" + }, + "Ethernet156|1": { + "scheduler": "scheduler.0" + }, + "Ethernet164|1": { + "scheduler": "scheduler.0" + }, + "Ethernet176|1": { + "scheduler": "scheduler.0" + }, + "Ethernet180|1": { + "scheduler": "scheduler.0" + }, + "Ethernet184|1": { + "scheduler": "scheduler.0" + }, + "Ethernet188|1": { + "scheduler": "scheduler.0" + }, + "Ethernet0|2": { + "scheduler": "scheduler.0" + }, + "Ethernet4|2": { + "scheduler": "scheduler.0" + }, + "Ethernet8|2": { + "scheduler": "scheduler.0" + }, + "Ethernet12|2": { + "scheduler": "scheduler.0" + }, + "Ethernet16|2": { + "scheduler": "scheduler.0" + }, + "Ethernet20|2": { + "scheduler": "scheduler.0" + }, + "Ethernet24|2": { + "scheduler": "scheduler.0" + }, + "Ethernet28|2": { + "scheduler": "scheduler.0" + }, + "Ethernet32|2": { + "scheduler": "scheduler.0" + }, + "Ethernet36|2": { + "scheduler": "scheduler.0" + }, + "Ethernet40|2": { + "scheduler": "scheduler.0" + }, + "Ethernet44|2": { + "scheduler": "scheduler.0" + }, + "Ethernet48|2": { + "scheduler": "scheduler.0" + }, + "Ethernet52|2": { + "scheduler": "scheduler.0" + }, + "Ethernet56|2": { + "scheduler": "scheduler.0" + }, + "Ethernet60|2": { + "scheduler": "scheduler.0" + }, + "Ethernet64|2": { + "scheduler": "scheduler.0" + }, + "Ethernet68|2": { + "scheduler": "scheduler.0" + }, + "Ethernet72|2": { + "scheduler": "scheduler.0" + }, + "Ethernet76|2": { + "scheduler": "scheduler.0" + }, + "Ethernet80|2": { + "scheduler": "scheduler.0" + }, + "Ethernet84|2": { + "scheduler": "scheduler.0" + }, + "Ethernet88|2": { + "scheduler": "scheduler.0" + }, + "Ethernet92|2": { + "scheduler": "scheduler.0" + }, + "Ethernet96|2": { + "scheduler": "scheduler.0" + }, + "Ethernet100|2": { + "scheduler": "scheduler.0" + }, + "Ethernet104|2": { + "scheduler": "scheduler.0" + }, + "Ethernet108|2": { + "scheduler": "scheduler.0" + }, + "Ethernet112|2": { + "scheduler": "scheduler.0" + }, + "Ethernet116|2": { + "scheduler": "scheduler.0" + }, + "Ethernet120|2": { + "scheduler": "scheduler.0" + }, + "Ethernet124|2": { + "scheduler": "scheduler.0" + }, + "Ethernet128|2": { + "scheduler": "scheduler.0" + }, + "Ethernet132|2": { + "scheduler": "scheduler.0" + }, + "Ethernet136|2": { + "scheduler": "scheduler.0" + }, + "Ethernet140|2": { + "scheduler": "scheduler.0" + }, + "Ethernet144|2": { + "scheduler": "scheduler.0" + }, + "Ethernet148|2": { + "scheduler": "scheduler.0" + }, + "Ethernet152|2": { + "scheduler": "scheduler.0" + }, + "Ethernet156|2": { + "scheduler": "scheduler.0" + }, + "Ethernet164|2": { + "scheduler": "scheduler.0" + }, + "Ethernet176|2": { + "scheduler": "scheduler.0" + }, + "Ethernet180|2": { + "scheduler": "scheduler.0" + }, + "Ethernet184|2": { + "scheduler": "scheduler.0" + }, + "Ethernet188|2": { + "scheduler": "scheduler.0" + }, + "Ethernet0|5": { + "scheduler": "scheduler.0" + }, + "Ethernet4|5": { + "scheduler": "scheduler.0" + }, + "Ethernet8|5": { + "scheduler": "scheduler.0" + }, + "Ethernet12|5": { + "scheduler": "scheduler.0" + }, + "Ethernet16|5": { + "scheduler": "scheduler.0" + }, + "Ethernet20|5": { + "scheduler": "scheduler.0" + }, + "Ethernet24|5": { + "scheduler": "scheduler.0" + }, + "Ethernet28|5": { + "scheduler": "scheduler.0" + }, + "Ethernet32|5": { + "scheduler": "scheduler.0" + }, + "Ethernet36|5": { + "scheduler": "scheduler.0" + }, + "Ethernet40|5": { + "scheduler": "scheduler.0" + }, + "Ethernet44|5": { + "scheduler": "scheduler.0" + }, + "Ethernet48|5": { + "scheduler": "scheduler.0" + }, + "Ethernet52|5": { + "scheduler": "scheduler.0" + }, + "Ethernet56|5": { + "scheduler": "scheduler.0" + }, + "Ethernet60|5": { + "scheduler": "scheduler.0" + }, + "Ethernet64|5": { + "scheduler": "scheduler.0" + }, + "Ethernet68|5": { + "scheduler": "scheduler.0" + }, + "Ethernet72|5": { + "scheduler": "scheduler.0" + }, + "Ethernet76|5": { + "scheduler": "scheduler.0" + }, + "Ethernet80|5": { + "scheduler": "scheduler.0" + }, + "Ethernet84|5": { + "scheduler": "scheduler.0" + }, + "Ethernet88|5": { + "scheduler": "scheduler.0" + }, + "Ethernet92|5": { + "scheduler": "scheduler.0" + }, + "Ethernet96|5": { + "scheduler": "scheduler.0" + }, + "Ethernet100|5": { + "scheduler": "scheduler.0" + }, + "Ethernet104|5": { + "scheduler": "scheduler.0" + }, + "Ethernet108|5": { + "scheduler": "scheduler.0" + }, + "Ethernet112|5": { + "scheduler": "scheduler.0" + }, + "Ethernet116|5": { + "scheduler": "scheduler.0" + }, + "Ethernet120|5": { + "scheduler": "scheduler.0" + }, + "Ethernet124|5": { + "scheduler": "scheduler.0" + }, + "Ethernet128|5": { + "scheduler": "scheduler.0" + }, + "Ethernet132|5": { + "scheduler": "scheduler.0" + }, + "Ethernet136|5": { + "scheduler": "scheduler.0" + }, + "Ethernet140|5": { + "scheduler": "scheduler.0" + }, + "Ethernet144|5": { + "scheduler": "scheduler.0" + }, + "Ethernet148|5": { + "scheduler": "scheduler.0" + }, + "Ethernet152|5": { + "scheduler": "scheduler.0" + }, + "Ethernet156|5": { + "scheduler": "scheduler.0" + }, + "Ethernet164|5": { + "scheduler": "scheduler.0" + }, + "Ethernet176|5": { + "scheduler": "scheduler.0" + }, + "Ethernet180|5": { + "scheduler": "scheduler.0" + }, + "Ethernet184|5": { + "scheduler": "scheduler.0" + }, + "Ethernet188|5": { + "scheduler": "scheduler.0" + }, + "Ethernet0|6": { + "scheduler": "scheduler.0" + }, + "Ethernet4|6": { + "scheduler": "scheduler.0" + }, + "Ethernet8|6": { + "scheduler": "scheduler.0" + }, + "Ethernet12|6": { + "scheduler": "scheduler.0" + }, + "Ethernet16|6": { + "scheduler": "scheduler.0" + }, + "Ethernet20|6": { + "scheduler": "scheduler.0" + }, + "Ethernet24|6": { + "scheduler": "scheduler.0" + }, + "Ethernet28|6": { + "scheduler": "scheduler.0" + }, + "Ethernet32|6": { + "scheduler": "scheduler.0" + }, + "Ethernet36|6": { + "scheduler": "scheduler.0" + }, + "Ethernet40|6": { + "scheduler": "scheduler.0" + }, + "Ethernet44|6": { + "scheduler": "scheduler.0" + }, + "Ethernet48|6": { + "scheduler": "scheduler.0" + }, + "Ethernet52|6": { + "scheduler": "scheduler.0" + }, + "Ethernet56|6": { + "scheduler": "scheduler.0" + }, + "Ethernet60|6": { + "scheduler": "scheduler.0" + }, + "Ethernet64|6": { + "scheduler": "scheduler.0" + }, + "Ethernet68|6": { + "scheduler": "scheduler.0" + }, + "Ethernet72|6": { + "scheduler": "scheduler.0" + }, + "Ethernet76|6": { + "scheduler": "scheduler.0" + }, + "Ethernet80|6": { + "scheduler": "scheduler.0" + }, + "Ethernet84|6": { + "scheduler": "scheduler.0" + }, + "Ethernet88|6": { + "scheduler": "scheduler.0" + }, + "Ethernet92|6": { + "scheduler": "scheduler.0" + }, + "Ethernet96|6": { + "scheduler": "scheduler.0" + }, + "Ethernet100|6": { + "scheduler": "scheduler.0" + }, + "Ethernet104|6": { + "scheduler": "scheduler.0" + }, + "Ethernet108|6": { + "scheduler": "scheduler.0" + }, + "Ethernet112|6": { + "scheduler": "scheduler.0" + }, + "Ethernet116|6": { + "scheduler": "scheduler.0" + }, + "Ethernet120|6": { + "scheduler": "scheduler.0" + }, + "Ethernet124|6": { + "scheduler": "scheduler.0" + }, + "Ethernet128|6": { + "scheduler": "scheduler.0" + }, + "Ethernet132|6": { + "scheduler": "scheduler.0" + }, + "Ethernet136|6": { + "scheduler": "scheduler.0" + }, + "Ethernet140|6": { + "scheduler": "scheduler.0" + }, + "Ethernet144|6": { + "scheduler": "scheduler.0" + }, + "Ethernet148|6": { + "scheduler": "scheduler.0" + }, + "Ethernet152|6": { + "scheduler": "scheduler.0" + }, + "Ethernet156|6": { + "scheduler": "scheduler.0" + }, + "Ethernet164|6": { + "scheduler": "scheduler.0" + }, + "Ethernet176|6": { + "scheduler": "scheduler.0" + }, + "Ethernet180|6": { + "scheduler": "scheduler.0" + }, + "Ethernet184|6": { + "scheduler": "scheduler.0" + }, + "Ethernet188|6": { + "scheduler": "scheduler.0" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/py3/qos-dell6100.json b/src/sonic-config-engine/tests/sample_output/py3/qos-dell6100.json index eecd81c99e5c..27bea8cd32d3 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/qos-dell6100.json +++ b/src/sonic-config-engine/tests/sample_output/py3/qos-dell6100.json @@ -119,308 +119,352 @@ "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet1": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet4": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet5": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet6": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet7": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet8": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet9": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet10": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet11": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet12": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet13": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet14": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet15": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet16": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet17": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet20": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet21": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet22": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet23": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet24": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet25": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet26": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet27": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet28": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet29": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet30": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet31": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet32": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet36": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet37": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet38": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet39": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet40": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet41": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet42": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet48": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet52": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet53": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet54": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet55": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet56": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet57": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" }, "Ethernet58": { "dscp_to_tc_map" : "AZURE", "tc_to_queue_map" : "AZURE", "tc_to_pg_map" : "AZURE", "pfc_to_queue_map": "AZURE", - "pfc_enable" : "3,4" + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" } }, "WRED_PROFILE": { diff --git a/src/sonic-config-engine/tests/sample_output/py3/qos-dell9332.json b/src/sonic-config-engine/tests/sample_output/py3/qos-dell9332.json new file mode 100644 index 000000000000..8130a455497a --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/qos-dell9332.json @@ -0,0 +1,1133 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "7" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0" : "1", + "1" : "1", + "2" : "1", + "3" : "3", + "4" : "4", + "5" : "2", + "6" : "1", + "7" : "1", + "8" : "0", + "9" : "1", + "10": "1", + "11": "1", + "12": "1", + "13": "1", + "14": "1", + "15": "1", + "16": "1", + "17": "1", + "18": "1", + "19": "1", + "20": "1", + "21": "1", + "22": "1", + "23": "1", + "24": "1", + "25": "1", + "26": "1", + "27": "1", + "28": "1", + "29": "1", + "30": "1", + "31": "1", + "32": "1", + "33": "1", + "34": "1", + "35": "1", + "36": "1", + "37": "1", + "38": "1", + "39": "1", + "40": "1", + "41": "1", + "42": "1", + "43": "1", + "44": "1", + "45": "1", + "46": "5", + "47": "1", + "48": "6", + "49": "1", + "50": "1", + "51": "1", + "52": "1", + "53": "1", + "54": "1", + "55": "1", + "56": "1", + "57": "1", + "58": "1", + "59": "1", + "60": "1", + "61": "1", + "62": "1", + "63": "1" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type" : "DWRR", + "weight": "1" + }, + "scheduler.1": { + "type" : "DWRR", + "weight": "1" + }, + "scheduler.2": { + "type" : "DWRR", + "weight": "100" + } + }, + "PORT_QOS_MAP": { + "Ethernet0": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet8": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet16": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet24": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet32": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet40": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet48": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet56": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet64": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet72": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet80": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet88": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet96": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet104": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet112": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet120": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet128": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet136": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet144": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet152": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet160": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet168": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet176": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet184": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet192": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet200": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet208": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet216": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet224": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet232": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet240": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet248": { + "dscp_to_tc_map" : "AZURE", + "tc_to_queue_map" : "AZURE", + "tc_to_pg_map" : "AZURE", + "pfc_to_queue_map": "AZURE", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + } + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable" : "true", + "wred_yellow_enable" : "true", + "wred_red_enable" : "true", + "ecn" : "ecn_all", + "green_max_threshold" : "2097152", + "green_min_threshold" : "1048576", + "yellow_max_threshold" : "2097152", + "yellow_min_threshold" : "1048576", + "red_max_threshold" : "2097152", + "red_min_threshold" : "1048576", + "green_drop_probability" : "5", + "yellow_drop_probability": "5", + "red_drop_probability" : "5" + } + }, + "QUEUE": { + "Ethernet0|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet8|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet16|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet24|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet32|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet40|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet48|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet56|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet64|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet72|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet80|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet88|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet96|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet104|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet112|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet120|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet128|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet136|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet144|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet152|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet160|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet168|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet176|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet184|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet192|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet200|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet208|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet216|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet224|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet232|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet240|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet248|3": { + "scheduler" : "scheduler.1", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet0|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet8|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet16|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet24|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet32|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet40|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet48|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet56|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet64|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet72|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet80|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet88|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet96|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet104|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet112|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet120|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet128|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet136|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet144|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet152|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet160|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet168|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet176|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet184|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet192|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet200|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet208|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet216|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet224|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet232|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet240|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet248|4": { + "scheduler" : "scheduler.2", + "wred_profile": "AZURE_LOSSLESS" + }, + "Ethernet0|0": { + "scheduler": "scheduler.0" + }, + "Ethernet8|0": { + "scheduler": "scheduler.0" + }, + "Ethernet16|0": { + "scheduler": "scheduler.0" + }, + "Ethernet24|0": { + "scheduler": "scheduler.0" + }, + "Ethernet32|0": { + "scheduler": "scheduler.0" + }, + "Ethernet40|0": { + "scheduler": "scheduler.0" + }, + "Ethernet48|0": { + "scheduler": "scheduler.0" + }, + "Ethernet56|0": { + "scheduler": "scheduler.0" + }, + "Ethernet64|0": { + "scheduler": "scheduler.0" + }, + "Ethernet72|0": { + "scheduler": "scheduler.0" + }, + "Ethernet80|0": { + "scheduler": "scheduler.0" + }, + "Ethernet88|0": { + "scheduler": "scheduler.0" + }, + "Ethernet96|0": { + "scheduler": "scheduler.0" + }, + "Ethernet104|0": { + "scheduler": "scheduler.0" + }, + "Ethernet112|0": { + "scheduler": "scheduler.0" + }, + "Ethernet120|0": { + "scheduler": "scheduler.0" + }, + "Ethernet128|0": { + "scheduler": "scheduler.0" + }, + "Ethernet136|0": { + "scheduler": "scheduler.0" + }, + "Ethernet144|0": { + "scheduler": "scheduler.0" + }, + "Ethernet152|0": { + "scheduler": "scheduler.0" + }, + "Ethernet160|0": { + "scheduler": "scheduler.0" + }, + "Ethernet168|0": { + "scheduler": "scheduler.0" + }, + "Ethernet176|0": { + "scheduler": "scheduler.0" + }, + "Ethernet184|0": { + "scheduler": "scheduler.0" + }, + "Ethernet192|0": { + "scheduler": "scheduler.0" + }, + "Ethernet200|0": { + "scheduler": "scheduler.0" + }, + "Ethernet208|0": { + "scheduler": "scheduler.0" + }, + "Ethernet216|0": { + "scheduler": "scheduler.0" + }, + "Ethernet224|0": { + "scheduler": "scheduler.0" + }, + "Ethernet232|0": { + "scheduler": "scheduler.0" + }, + "Ethernet240|0": { + "scheduler": "scheduler.0" + }, + "Ethernet248|0": { + "scheduler": "scheduler.0" + }, + "Ethernet0|1": { + "scheduler": "scheduler.0" + }, + "Ethernet8|1": { + "scheduler": "scheduler.0" + }, + "Ethernet16|1": { + "scheduler": "scheduler.0" + }, + "Ethernet24|1": { + "scheduler": "scheduler.0" + }, + "Ethernet32|1": { + "scheduler": "scheduler.0" + }, + "Ethernet40|1": { + "scheduler": "scheduler.0" + }, + "Ethernet48|1": { + "scheduler": "scheduler.0" + }, + "Ethernet56|1": { + "scheduler": "scheduler.0" + }, + "Ethernet64|1": { + "scheduler": "scheduler.0" + }, + "Ethernet72|1": { + "scheduler": "scheduler.0" + }, + "Ethernet80|1": { + "scheduler": "scheduler.0" + }, + "Ethernet88|1": { + "scheduler": "scheduler.0" + }, + "Ethernet96|1": { + "scheduler": "scheduler.0" + }, + "Ethernet104|1": { + "scheduler": "scheduler.0" + }, + "Ethernet112|1": { + "scheduler": "scheduler.0" + }, + "Ethernet120|1": { + "scheduler": "scheduler.0" + }, + "Ethernet128|1": { + "scheduler": "scheduler.0" + }, + "Ethernet136|1": { + "scheduler": "scheduler.0" + }, + "Ethernet144|1": { + "scheduler": "scheduler.0" + }, + "Ethernet152|1": { + "scheduler": "scheduler.0" + }, + "Ethernet160|1": { + "scheduler": "scheduler.0" + }, + "Ethernet168|1": { + "scheduler": "scheduler.0" + }, + "Ethernet176|1": { + "scheduler": "scheduler.0" + }, + "Ethernet184|1": { + "scheduler": "scheduler.0" + }, + "Ethernet192|1": { + "scheduler": "scheduler.0" + }, + "Ethernet200|1": { + "scheduler": "scheduler.0" + }, + "Ethernet208|1": { + "scheduler": "scheduler.0" + }, + "Ethernet216|1": { + "scheduler": "scheduler.0" + }, + "Ethernet224|1": { + "scheduler": "scheduler.0" + }, + "Ethernet232|1": { + "scheduler": "scheduler.0" + }, + "Ethernet240|1": { + "scheduler": "scheduler.0" + }, + "Ethernet248|1": { + "scheduler": "scheduler.0" + }, + "Ethernet0|2": { + "scheduler": "scheduler.0" + }, + "Ethernet8|2": { + "scheduler": "scheduler.0" + }, + "Ethernet16|2": { + "scheduler": "scheduler.0" + }, + "Ethernet24|2": { + "scheduler": "scheduler.0" + }, + "Ethernet32|2": { + "scheduler": "scheduler.0" + }, + "Ethernet40|2": { + "scheduler": "scheduler.0" + }, + "Ethernet48|2": { + "scheduler": "scheduler.0" + }, + "Ethernet56|2": { + "scheduler": "scheduler.0" + }, + "Ethernet64|2": { + "scheduler": "scheduler.0" + }, + "Ethernet72|2": { + "scheduler": "scheduler.0" + }, + "Ethernet80|2": { + "scheduler": "scheduler.0" + }, + "Ethernet88|2": { + "scheduler": "scheduler.0" + }, + "Ethernet96|2": { + "scheduler": "scheduler.0" + }, + "Ethernet104|2": { + "scheduler": "scheduler.0" + }, + "Ethernet112|2": { + "scheduler": "scheduler.0" + }, + "Ethernet120|2": { + "scheduler": "scheduler.0" + }, + "Ethernet128|2": { + "scheduler": "scheduler.0" + }, + "Ethernet136|2": { + "scheduler": "scheduler.0" + }, + "Ethernet144|2": { + "scheduler": "scheduler.0" + }, + "Ethernet152|2": { + "scheduler": "scheduler.0" + }, + "Ethernet160|2": { + "scheduler": "scheduler.0" + }, + "Ethernet168|2": { + "scheduler": "scheduler.0" + }, + "Ethernet176|2": { + "scheduler": "scheduler.0" + }, + "Ethernet184|2": { + "scheduler": "scheduler.0" + }, + "Ethernet192|2": { + "scheduler": "scheduler.0" + }, + "Ethernet200|2": { + "scheduler": "scheduler.0" + }, + "Ethernet208|2": { + "scheduler": "scheduler.0" + }, + "Ethernet216|2": { + "scheduler": "scheduler.0" + }, + "Ethernet224|2": { + "scheduler": "scheduler.0" + }, + "Ethernet232|2": { + "scheduler": "scheduler.0" + }, + "Ethernet240|2": { + "scheduler": "scheduler.0" + }, + "Ethernet248|2": { + "scheduler": "scheduler.0" + }, + "Ethernet0|5": { + "scheduler": "scheduler.0" + }, + "Ethernet8|5": { + "scheduler": "scheduler.0" + }, + "Ethernet16|5": { + "scheduler": "scheduler.0" + }, + "Ethernet24|5": { + "scheduler": "scheduler.0" + }, + "Ethernet32|5": { + "scheduler": "scheduler.0" + }, + "Ethernet40|5": { + "scheduler": "scheduler.0" + }, + "Ethernet48|5": { + "scheduler": "scheduler.0" + }, + "Ethernet56|5": { + "scheduler": "scheduler.0" + }, + "Ethernet64|5": { + "scheduler": "scheduler.0" + }, + "Ethernet72|5": { + "scheduler": "scheduler.0" + }, + "Ethernet80|5": { + "scheduler": "scheduler.0" + }, + "Ethernet88|5": { + "scheduler": "scheduler.0" + }, + "Ethernet96|5": { + "scheduler": "scheduler.0" + }, + "Ethernet104|5": { + "scheduler": "scheduler.0" + }, + "Ethernet112|5": { + "scheduler": "scheduler.0" + }, + "Ethernet120|5": { + "scheduler": "scheduler.0" + }, + "Ethernet128|5": { + "scheduler": "scheduler.0" + }, + "Ethernet136|5": { + "scheduler": "scheduler.0" + }, + "Ethernet144|5": { + "scheduler": "scheduler.0" + }, + "Ethernet152|5": { + "scheduler": "scheduler.0" + }, + "Ethernet160|5": { + "scheduler": "scheduler.0" + }, + "Ethernet168|5": { + "scheduler": "scheduler.0" + }, + "Ethernet176|5": { + "scheduler": "scheduler.0" + }, + "Ethernet184|5": { + "scheduler": "scheduler.0" + }, + "Ethernet192|5": { + "scheduler": "scheduler.0" + }, + "Ethernet200|5": { + "scheduler": "scheduler.0" + }, + "Ethernet208|5": { + "scheduler": "scheduler.0" + }, + "Ethernet216|5": { + "scheduler": "scheduler.0" + }, + "Ethernet224|5": { + "scheduler": "scheduler.0" + }, + "Ethernet232|5": { + "scheduler": "scheduler.0" + }, + "Ethernet240|5": { + "scheduler": "scheduler.0" + }, + "Ethernet248|5": { + "scheduler": "scheduler.0" + }, + "Ethernet0|6": { + "scheduler": "scheduler.0" + }, + "Ethernet8|6": { + "scheduler": "scheduler.0" + }, + "Ethernet16|6": { + "scheduler": "scheduler.0" + }, + "Ethernet24|6": { + "scheduler": "scheduler.0" + }, + "Ethernet32|6": { + "scheduler": "scheduler.0" + }, + "Ethernet40|6": { + "scheduler": "scheduler.0" + }, + "Ethernet48|6": { + "scheduler": "scheduler.0" + }, + "Ethernet56|6": { + "scheduler": "scheduler.0" + }, + "Ethernet64|6": { + "scheduler": "scheduler.0" + }, + "Ethernet72|6": { + "scheduler": "scheduler.0" + }, + "Ethernet80|6": { + "scheduler": "scheduler.0" + }, + "Ethernet88|6": { + "scheduler": "scheduler.0" + }, + "Ethernet96|6": { + "scheduler": "scheduler.0" + }, + "Ethernet104|6": { + "scheduler": "scheduler.0" + }, + "Ethernet112|6": { + "scheduler": "scheduler.0" + }, + "Ethernet120|6": { + "scheduler": "scheduler.0" + }, + "Ethernet128|6": { + "scheduler": "scheduler.0" + }, + "Ethernet136|6": { + "scheduler": "scheduler.0" + }, + "Ethernet144|6": { + "scheduler": "scheduler.0" + }, + "Ethernet152|6": { + "scheduler": "scheduler.0" + }, + "Ethernet160|6": { + "scheduler": "scheduler.0" + }, + "Ethernet168|6": { + "scheduler": "scheduler.0" + }, + "Ethernet176|6": { + "scheduler": "scheduler.0" + }, + "Ethernet184|6": { + "scheduler": "scheduler.0" + }, + "Ethernet192|6": { + "scheduler": "scheduler.0" + }, + "Ethernet200|6": { + "scheduler": "scheduler.0" + }, + "Ethernet208|6": { + "scheduler": "scheduler.0" + }, + "Ethernet216|6": { + "scheduler": "scheduler.0" + }, + "Ethernet224|6": { + "scheduler": "scheduler.0" + }, + "Ethernet232|6": { + "scheduler": "scheduler.0" + }, + "Ethernet240|6": { + "scheduler": "scheduler.0" + }, + "Ethernet248|6": { + "scheduler": "scheduler.0" + } + } +} diff --git a/src/sonic-config-engine/tests/sample_output/py3/radvd.conf b/src/sonic-config-engine/tests/sample_output/py3/radvd.conf new file mode 100644 index 000000000000..43de8b847756 --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/radvd.conf @@ -0,0 +1,35 @@ +# =========== Managed by sonic-cfggen -- DO NOT edit manually! ==================== +# Generated by /usr/share/sonic/templates/radvd.conf.j2 using config DB data +# File: /etc/radvd.conf +# +# Config file for radvd, the router advertisement daemon +# See man page for radvd.conf for descriptions of all available options +# + +interface Vlan1000 +{ + IgnoreIfMissing on; + AdvSendAdvert on; + MinRtrAdvInterval 60; + MaxRtrAdvInterval 180; + AdvManagedFlag on; + AdvOtherConfigFlag off; + AdvLinkMTU 9100; + AdvHomeAgentFlag off; + prefix fc02:1000::/64 { + AdvOnLink on; + AdvAutonomous off; + AdvRouterAddr off; + AdvValidLifetime infinity; + AdvPreferredLifetime infinity; + }; + prefix fc02:2000::/64 { + AdvOnLink on; + AdvAutonomous off; + AdvRouterAddr off; + AdvValidLifetime infinity; + AdvPreferredLifetime infinity; + }; +}; + + diff --git a/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-bgpd.conf b/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-bgpd.conf index d3b9b472c5bd..20744efaa40f 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-bgpd.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/t2-chassis-fe-bgpd.conf @@ -63,10 +63,6 @@ router bgp 4000 ! bgp bestpath as-path multipath-relax ! - bgp graceful-restart restart-time 240 - bgp graceful-restart - bgp graceful-restart preserve-fw-state - bgp graceful-restart select-defer-time 45 ! bgp router-id 4.0.0.0 ! diff --git a/src/sonic-config-engine/tests/sample_output/py3/wait_for_intf.sh b/src/sonic-config-engine/tests/sample_output/py3/wait_for_intf.sh index 68a3a830f068..6e5012d5939c 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/wait_for_intf.sh +++ b/src/sonic-config-engine/tests/sample_output/py3/wait_for_intf.sh @@ -30,3 +30,7 @@ wait_until_iface_ready PortChannel02 10.0.0.58/31 wait_until_iface_ready PortChannel03 10.0.0.60/31 wait_until_iface_ready PortChannel04 10.0.0.62/31 +# Wait 10 seconds for the rest of interfaces to get added/populated. +# dhcrelay listens on each of the interfaces (in addition to the port +# channels and vlan interfaces) +sleep 10 diff --git a/src/sonic-config-engine/tests/sample_output/t0-switch-masic1.json b/src/sonic-config-engine/tests/sample_output/t0-switch-masic1.json index 34fd946da361..83ca9f50aed5 100644 --- a/src/sonic-config-engine/tests/sample_output/t0-switch-masic1.json +++ b/src/sonic-config-engine/tests/sample_output/t0-switch-masic1.json @@ -3,7 +3,8 @@ "SWITCH_TABLE:switch": { "ecmp_hash_seed": "11", "lag_hash_seed": "11", - "fdb_aging_time": "600" + "fdb_aging_time": "600", + "ordered_ecmp": "true" }, "OP": "SET" } diff --git a/src/sonic-config-engine/tests/sample_output/t0-switch-masic3.json b/src/sonic-config-engine/tests/sample_output/t0-switch-masic3.json index d9f929679cbc..db5d1b6e4aee 100644 --- a/src/sonic-config-engine/tests/sample_output/t0-switch-masic3.json +++ b/src/sonic-config-engine/tests/sample_output/t0-switch-masic3.json @@ -3,7 +3,8 @@ "SWITCH_TABLE:switch": { "ecmp_hash_seed": "13", "lag_hash_seed": "13", - "fdb_aging_time": "600" + "fdb_aging_time": "600", + "ordered_ecmp": "true" }, "OP": "SET" } diff --git a/src/sonic-config-engine/tests/sample_output/t0-switch.json b/src/sonic-config-engine/tests/sample_output/t0-switch.json index 414e53b8a356..d585ca2a52f6 100644 --- a/src/sonic-config-engine/tests/sample_output/t0-switch.json +++ b/src/sonic-config-engine/tests/sample_output/t0-switch.json @@ -3,7 +3,8 @@ "SWITCH_TABLE:switch": { "ecmp_hash_seed": "0", "lag_hash_seed": "0", - "fdb_aging_time": "600" + "fdb_aging_time": "600", + "ordered_ecmp": "false" }, "OP": "SET" } diff --git a/src/sonic-config-engine/tests/sample_output/t1-switch.json b/src/sonic-config-engine/tests/sample_output/t1-switch.json index fdae474251f0..3b3b7959191b 100644 --- a/src/sonic-config-engine/tests/sample_output/t1-switch.json +++ b/src/sonic-config-engine/tests/sample_output/t1-switch.json @@ -3,7 +3,8 @@ "SWITCH_TABLE:switch": { "ecmp_hash_seed": "10", "lag_hash_seed": "10", - "fdb_aging_time": "600" + "fdb_aging_time": "600", + "ordered_ecmp": "true" }, "OP": "SET" } diff --git a/src/sonic-config-engine/tests/sample_platform.json b/src/sonic-config-engine/tests/sample_platform.json index 1d8887920c9e..fbb281e07393 100644 --- a/src/sonic-config-engine/tests/sample_platform.json +++ b/src/sonic-config-engine/tests/sample_platform.json @@ -1,4 +1,16 @@ { + "chassis": { + "psus": [ + { + "name": "PSU 1", + "temperature": false + }, + { + "name": "PSU 2", + "temperature": false + } + ] + }, "interfaces": { "Ethernet0": { "index": "1,1,1,1", @@ -350,6 +362,61 @@ "2x25G(2)+1x50G(2)": ["Eth32/1", "Eth32/2", "Eth32/3"], "1x50G(2)+2x25G(2)": ["Eth32/1", "Eth32/2", "Eth32/3"] } + }, + "Ethernet128": { + "index": "33,33,33,33", + "lanes": "128,129,130,131", + "breakout_modes": { + "1x100G[40G]": ["Eth33"], + "2x50G": ["Eth33/1", "Eth33/2"], + "4x25G[10G]": ["Eth33/1", "Eth33/2", "Eth33/3", "Eth33/4"], + "2x25G(2)+1x50G(2)": ["Eth33/1", "Eth33/2", "Eth33/3"], + "1x50G(2)+2x25G(2)": ["Eth33/1", "Eth33/2", "Eth33/3"] + } + }, + "Ethernet132": { + "index": "34,34,34,34", + "lanes": "132,133,134,135", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["Eth34"], + "2x50G": ["Eth34/1", "Eth34/2"], + "4x25G[10G]": ["Eth34/1", "Eth34/2", "Eth34/3", "Eth34/4"], + "2x25G(2)+1x50G(2)": ["Eth34/1", "Eth34/2", "Eth34/3"], + "1x50G(2)+2x25G(2)": ["Eth34/1", "Eth34/2", "Eth34/3"] + } + }, + "Ethernet136": { + "index": "35,35,35,35", + "lanes": "136,137,138,139", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["Eth35"], + "2x50G": ["Eth35/1", "Eth35/2"], + "4x25G[10G]": ["Eth35/1", "Eth35/2", "Eth35/3", "Eth35/4"], + "2x25G(2)+1x50G(2)": ["Eth35/1", "Eth35/2", "Eth35/3"], + "1x50G(2)+2x25G(2)": ["Eth35/1", "Eth35/2", "Eth35/3"] + } + }, + "Ethernet140": { + "index": "36,36,36,36", + "lanes": "140,141,142,143", + "breakout_modes": { + "1x100000[50G,40000,25000,10G]": ["Eth36"], + "2x50G": ["Eth36/1", "Eth36/2"], + "4x25G[10000]": ["Eth36/1", "Eth36/2", "Eth36/3", "Eth36/4"], + "2x25000(2)+1x50G(2)": ["Eth36/1", "Eth36/2", "Eth36/3"], + "1x50000(2)+2x25G(2)": ["Eth36/1", "Eth36/2", "Eth36/3"] + } + }, + "Ethernet144": { + "index": "37,37,37,37", + "lanes": "144,145,146,147", + "breakout_modes": { + "1x100G[50G,40G,25G,10G]": ["Eth37"], + "2x50G": ["Eth37/1", "Eth37/2"], + "4x25G[10000]": ["Eth37/1", "Eth37/2", "Eth37/3", "Eth37/4"], + "2x25000(2)+1x50G(2)": ["Eth37/1", "Eth37/2", "Eth37/3"], + "1x50000(2)+2x25G(2)": ["Eth37/1", "Eth37/2", "Eth37/3"] + } } } } diff --git a/src/sonic-config-engine/tests/simple-sample-graph-case.xml b/src/sonic-config-engine/tests/simple-sample-graph-case.xml index acaab2c4c7e3..d6a8c394f604 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph-case.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph-case.xml @@ -446,7 +446,7 @@ SyslogResources - 10.0.10.5;10.0.10.6; + 10.0.10.5;10.0.10.6 @@ -527,6 +527,342 @@ 100000 Interface description + + DeviceInterface + + true + 1 + fortyGigE0/16 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/20 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/24 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/28 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/32 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/36 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/44 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/48 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/52 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/56 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/60 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/64 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/68 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/72 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/76 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/80 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/84 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/88 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/92 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/96 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/100 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/104 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/108 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/112 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/116 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/120 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/124 + + false + 0 + 0 + 100000 + true 0 diff --git a/src/sonic-config-engine/tests/simple-sample-graph-metadata.xml b/src/sonic-config-engine/tests/simple-sample-graph-metadata.xml index 80430633b1f8..fbc33b49862a 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph-metadata.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph-metadata.xml @@ -245,7 +245,7 @@ SyslogResources - 10.0.10.5;10.0.10.6; + 10.0.10.5;10.0.10.6 @@ -321,6 +321,342 @@ 100000 Interface description + + DeviceInterface + + true + 1 + fortyGigE0/16 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/20 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/24 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/28 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/32 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/36 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/44 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/48 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/52 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/56 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/60 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/64 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/68 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/72 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/76 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/80 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/84 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/88 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/92 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/96 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/100 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/104 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/108 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/112 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/116 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/120 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/124 + + false + 0 + 0 + 100000 + true 0 diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index 90abd1885bcb..a8bd8b0b4685 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -20,7 +20,6 @@ 1 180 60 - false switch-t0 @@ -68,12 +67,12 @@ 1 180 60 - true + voq - 0 + 1 BGPMonitor @@ -181,11 +180,6 @@ fortyGigE0/4 - - PortChannel1001 - fortyGigE0/1;fortyGigE0/2 - - @@ -288,26 +282,6 @@ fortyGigE0/8 true - - DeviceInterfaceLink - 10000 - switch-t0 - fortyGigE0/1 - true - ARISTA05T1 - Ethernet1/32 - true - - - DeviceInterfaceLink - 10000 - switch-t0 - fortyGigE0/2 - true - ARISTA06T1 - Ethernet1/33 - true - DeviceMgmtLink 1000 @@ -441,6 +415,330 @@ 0 100000 + + DeviceInterface + + true + 1 + fortyGigE0/20 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/24 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/28 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/32 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/36 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/44 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/48 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/52 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/56 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/60 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/64 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/68 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/72 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/76 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/80 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/84 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/88 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/92 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/96 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/100 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/104 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/108 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/112 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/116 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/120 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/124 + + false + 0 + 0 + 100000 + true 0 @@ -458,6 +756,21 @@ + + + + switch-t0 + + + DeploymentId + + 1 + + + + + + switch-t0 Force10-S6000 diff --git a/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml b/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml index f2690985d9f3..552d219964c2 100644 --- a/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml +++ b/src/sonic-config-engine/tests/t0-sample-bgp-speaker.xml @@ -327,6 +327,400 @@ + + + + + DeviceInterface + + true + 1 + fortyGigE0/0 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + 1 + fortyGigE0/4 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + 1 + fortyGigE0/8 + + false + 0 + 0 + 40000 + Interface description + + + DeviceInterface + + true + 1 + fortyGigE0/12 + + false + 0 + 0 + 100000 + Interface description + + + DeviceInterface + + true + 1 + fortyGigE0/16 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/20 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/24 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/28 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/32 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/36 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/44 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/48 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/52 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/56 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/60 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/64 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/68 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/72 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/76 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/80 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/84 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/88 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/92 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/96 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/100 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/104 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/108 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/112 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/116 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/120 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/124 + + false + 0 + 0 + 100000 + + + Force10-S6000 + + + diff --git a/src/sonic-config-engine/tests/t0-sample-deployment-id.xml b/src/sonic-config-engine/tests/t0-sample-deployment-id.xml new file mode 100644 index 000000000000..30517dfee19f --- /dev/null +++ b/src/sonic-config-engine/tests/t0-sample-deployment-id.xml @@ -0,0 +1,741 @@ + + + + + + false + switch-t0 + 10.0.0.56 + ARISTA01T1 + 10.0.0.57 + 1 + 180 + 60 + + + switch-t0 + FC00::71 + ARISTA01T1 + FC00::72 + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.58 + ARISTA02T1 + 10.0.0.59 + 1 + 180 + 60 + + + switch-t0 + FC00::75 + ARISTA02T1 + FC00::76 + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.60 + ARISTA03T1 + 10.0.0.61 + 1 + 180 + 60 + + + switch-t0 + FC00::79 + ARISTA03T1 + FC00::7A + 1 + 180 + 60 + + + false + switch-t0 + 10.0.0.62 + ARISTA04T1 + 10.0.0.63 + 1 + 180 + 60 + + + switch-t0 + FC00::7D + ARISTA04T1 + FC00::7E + 1 + 180 + 60 + + + + + 65100 + switch-t0 + + +
10.0.0.57
+ + + +
+ +
10.0.0.59
+ + + +
+ +
10.0.0.61
+ + + +
+ +
10.0.0.63
+ + + +
+ +
10.1.0.32
+ BGPSLBPassive + 10.10.10.10/26;100.100.100.100/26 +
+
+ +
+ + 64600 + ARISTA01T1 + + + + 64600 + ARISTA02T1 + + + + 64600 + ARISTA03T1 + + + + 64600 + ARISTA04T1 + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + + HostIP + eth0 + + 10.0.0.100/24 + + 10.0.0.100/24 + + + + + + + switch-t0 + + + PortChannel01 + fortyGigE0/112 + + + + PortChannel02 + fortyGigE0/116 + + + + PortChannel03 + fortyGigE0/120 + + + + PortChannel04 + fortyGigE0/124 + + + + + + Vlan1000 + fortyGigE0/4;fortyGigE0/8;fortyGigE0/12;fortyGigE0/16;fortyGigE0/20;fortyGigE0/24;fortyGigE0/28;fortyGigE0/32;fortyGigE0/36;fortyGigE0/40;fortyGigE0/44;fortyGigE0/48;fortyGigE0/52;fortyGigE0/56;fortyGigE0/60;fortyGigE0/64;fortyGigE0/68;fortyGigE0/72;fortyGigE0/76;fortyGigE0/80;fortyGigE0/84;fortyGigE0/88;fortyGigE0/92;fortyGigE0/96 + False + 0.0.0.0/0 + + 192.0.0.1;192.0.0.2 + 1000 + 1000 + 192.168.0.0/27 + + + + + + PortChannel01 + 10.0.0.56/31 + + + + PortChannel01 + FC00::71/126 + + + + PortChannel02 + 10.0.0.58/31 + + + + PortChannel02 + FC00::75/126 + + + + PortChannel03 + 10.0.0.60/31 + + + + PortChannel03 + FC00::79/126 + + + + PortChannel04 + 10.0.0.62/31 + + + + PortChannel04 + FC00::7D/126 + + + + Vlan1000 + 192.168.0.1/27 + + + + + + PortChannel01;PortChannel02;PortChannel03;PortChannel04 + DataAcl + DataPlane + + + SNMP + SNMP_ACL + SNMP + + + + + + + + + + DeviceInterfaceLink + ARISTA01T1 + Ethernet1/1 + switch-t0 + fortyGigE0/112 + + + DeviceInterfaceLink + ARISTA02T1 + Ethernet1/1 + switch-t0 + fortyGigE0/116 + + + DeviceInterfaceLink + ARISTA03T1 + Ethernet1/1 + switch-t0 + fortyGigE0/120 + + + DeviceInterfaceLink + ARISTA04T1 + Ethernet1/1 + switch-t0 + fortyGigE0/124 + + + + + switch-t0 + Force10-S6000 + + + ARISTA01T1 + Arista + + + ARISTA02T1 + Arista + + + ARISTA03T1 + Arista + + + ARISTA04T1 + Arista + + + + + + + + DeviceInterface + + true + 1 + fortyGigE0/0 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + 1 + fortyGigE0/4 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + 1 + fortyGigE0/8 + + false + 0 + 0 + 40000 + Interface description + + + DeviceInterface + + true + 1 + fortyGigE0/12 + + false + 0 + 0 + 100000 + Interface description + + + DeviceInterface + + true + 1 + fortyGigE0/16 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/20 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/24 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/28 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/32 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/36 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/44 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/48 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/52 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/56 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/60 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/64 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/68 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/72 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/76 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/80 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/84 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/88 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/92 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/96 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/100 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/104 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/108 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/112 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/116 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/120 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/124 + + false + 0 + 0 + 100000 + + + Force10-S6000 + + + + + + + switch-t0 + + + ErspanDestinationIpv4 + + 2.2.2.2 + + + + + + + switch-t0 + Force10-S6000 +
diff --git a/src/sonic-config-engine/tests/t0-sample-graph-mvrf.xml b/src/sonic-config-engine/tests/t0-sample-graph-mvrf.xml index e7e2b5789816..3fd73f7369fe 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph-mvrf.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph-mvrf.xml @@ -387,6 +387,398 @@
+ + + + + DeviceInterface + + true + 1 + Ethernet0 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet4 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet8 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet12 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet16 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet20 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet24 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet28 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet32 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet36 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet40 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet44 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet48 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet52 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet56 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet60 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet64 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet68 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet72 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet76 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet80 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet84 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet88 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet92 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet96 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet100 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet104 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet108 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet112 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet116 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet120 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet124 + + false + 0 + 0 + 40000 + + + Force10-S6000 + + + diff --git a/src/sonic-config-engine/tests/t0-sample-graph.xml b/src/sonic-config-engine/tests/t0-sample-graph.xml index c06cc708c1ce..15fb1dc79210 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph.xml @@ -90,7 +90,7 @@ - 0 + 1 BGPMonitor @@ -498,6 +498,374 @@ + + + + + DeviceInterface + + true + 1 + Ethernet0 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet8 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet12 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet16 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet20 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet24 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet28 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet32 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet36 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet40 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet44 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet48 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet52 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet56 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet60 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet64 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet68 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet72 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet76 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet80 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet84 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet88 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet92 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet96 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet100 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet104 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet108 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet112 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet116 + + false + 0 + 0 + 40000 + + + DeviceInterface + + true + 1 + Ethernet120 + + false + 0 + 0 + 40000 + + + Force10-S6000 + + + @@ -549,6 +917,21 @@ + + + + switch-t0 + + + DeploymentId + + 1 + + + + + + switch-t0 Force10-S6000 diff --git a/src/sonic-config-engine/tests/t2-chassis-fe-graph-pc.xml b/src/sonic-config-engine/tests/t2-chassis-fe-graph-pc.xml index bc1a5142fc86..212d9c76a647 100644 --- a/src/sonic-config-engine/tests/t2-chassis-fe-graph-pc.xml +++ b/src/sonic-config-engine/tests/t2-chassis-fe-graph-pc.xml @@ -296,6 +296,318 @@ 0 25000 + + DeviceInterface + + false + 1 + Ethernet24 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet28 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet32 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet36 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet40 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet44 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet48 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet52 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet56 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet60 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet64 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet68 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet72 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet76 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet80 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet84 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet88 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet92 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet96 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet100 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet104 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet108 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet112 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet116 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet120 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet124 + + false + 0 + 0 + 40000 + false 0 diff --git a/src/sonic-config-engine/tests/t2-chassis-fe-graph-vni.xml b/src/sonic-config-engine/tests/t2-chassis-fe-graph-vni.xml index 0dc534b3de88..9384446aa913 100644 --- a/src/sonic-config-engine/tests/t2-chassis-fe-graph-vni.xml +++ b/src/sonic-config-engine/tests/t2-chassis-fe-graph-vni.xml @@ -224,6 +224,354 @@ 0 40000 + + DeviceInterface + + false + 1 + Ethernet12 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet16 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet20 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet24 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet28 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet32 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet36 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet40 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet44 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet48 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet52 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet56 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet60 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet64 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet68 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet72 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet76 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet80 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet84 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet88 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet92 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet96 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet100 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet104 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet108 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet112 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet116 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet120 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet124 + + false + 0 + 0 + 40000 + false 0 diff --git a/src/sonic-config-engine/tests/t2-chassis-fe-graph.xml b/src/sonic-config-engine/tests/t2-chassis-fe-graph.xml index 3b0c56a57a70..3fd8ed01c215 100644 --- a/src/sonic-config-engine/tests/t2-chassis-fe-graph.xml +++ b/src/sonic-config-engine/tests/t2-chassis-fe-graph.xml @@ -223,6 +223,354 @@ 0 40000 + + DeviceInterface + + false + 1 + Ethernet12 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet16 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet20 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet24 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet28 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet32 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet36 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet40 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet44 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet48 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet52 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet56 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet60 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet64 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet68 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet72 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet76 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet80 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet84 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet88 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet92 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet96 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet100 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet104 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet108 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet112 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet116 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet120 + + false + 0 + 0 + 40000 + + + DeviceInterface + + false + 1 + Ethernet124 + + false + 0 + 0 + 40000 + false 0 diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 5be4bb7b75c8..e1f6844dd5f2 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -8,6 +8,8 @@ TOR_ROUTER = 'ToRRouter' BACKEND_TOR_ROUTER = 'BackEndToRRouter' +LEAF_ROUTER = 'LeafRouter' +BACKEND_LEAF_ROUTER = 'BackEndLeafRouter' class TestCfgGen(TestCase): @@ -21,6 +23,7 @@ def setUp(self): self.sample_graph_metadata = os.path.join(self.test_dir, 'simple-sample-graph-metadata.xml') self.sample_graph_pc_test = os.path.join(self.test_dir, 'pc-test-graph.xml') self.sample_graph_bgp_speaker = os.path.join(self.test_dir, 't0-sample-bgp-speaker.xml') + self.sample_graph_deployment_id = os.path.join(self.test_dir, 't0-sample-deployment-id.xml') self.sample_graph_voq = os.path.join(self.test_dir, 'sample-voq-graph.xml') self.sample_device_desc = os.path.join(self.test_dir, 'device.xml') self.port_config = os.path.join(self.test_dir, 't0-sample-port-config.ini') @@ -32,6 +35,8 @@ def setUp(self): self.sample_resource_graph = os.path.join(self.test_dir, 'sample-graph-resource-type.xml') self.sample_subintf_graph = os.path.join(self.test_dir, 'sample-graph-subintf.xml') self.voq_port_config = os.path.join(self.test_dir, 'voq-sample-port-config.ini') + self.packet_chassis_graph = os.path.join(self.test_dir, 'sample-chassis-packet-lc-graph.xml') + self.packet_chassis_port_ini = os.path.join(self.test_dir, 'sample-chassis-packet-lc-port-config.ini') # To ensure that mock config_db data is used for unit-test cases os.environ["CFGGEN_UNIT_TESTING"] = "2" @@ -43,7 +48,7 @@ def tearDown(self): except OSError: pass - def run_script(self, argument, check_stderr=False): + def run_script(self, argument, check_stderr=False, verbose=False): print('\n Running sonic-cfggen ' + argument) if check_stderr: output = subprocess.check_output(self.script_file + ' ' + argument, stderr=subprocess.STDOUT, shell=True) @@ -58,6 +63,8 @@ def run_script(self, argument, check_stderr=False): print(' Output: ' + output.strip()) else: print(' Output: ({0} lines, {1} bytes)'.format(linecount + 1, len(output))) + if verbose == True: + print(' Output: ' + output.strip()) return output def test_dummy_run(self): @@ -76,44 +83,46 @@ def test_device_desc_mgmt_ip(self): self.assertEqual(output.strip(), "('eth0', '10.0.1.5/28')") def test_minigraph_hostname(self): - argument = '-v "DEVICE_METADATA[\'localhost\'][\'hostname\']" -m "' + self.sample_graph + '"' + argument = '-v "DEVICE_METADATA[\'localhost\'][\'hostname\']" -m "' + self.sample_graph + '" -p "' + self.port_config + '"' output = self.run_script(argument) self.assertEqual(output.strip(), 'OCPSCH01040DDLF') def test_minigraph_sku(self): - argument = '-v "DEVICE_METADATA[\'localhost\'][\'hwsku\']" -m "' + self.sample_graph + '"' + argument = '-v "DEVICE_METADATA[\'localhost\'][\'hwsku\']" -m "' + self.sample_graph + '" -p "' + self.port_config + '"' output = self.run_script(argument) self.assertEqual(output.strip(), 'Force10-Z9100') def test_minigraph_region(self): - argument = '-v "DEVICE_METADATA[\'localhost\'][\'region\']" -m "' + self.sample_graph_metadata + '"' + argument = '-v "DEVICE_METADATA[\'localhost\'][\'region\']" -m "' + self.sample_graph_metadata + '" -p "' + self.port_config + '"' output = self.run_script(argument) self.assertEqual(output.strip(), 'usfoo') def test_minigraph_cloudtype(self): - argument = '-v "DEVICE_METADATA[\'localhost\'][\'cloudtype\']" -m "' + self.sample_graph_metadata + '"' + argument = '-v "DEVICE_METADATA[\'localhost\'][\'cloudtype\']" -m "' + self.sample_graph_metadata + '" -p "' + self.port_config + '"' output = self.run_script(argument) self.assertEqual(output.strip(), 'Public') def test_minigraph_resourcetype(self): - argument = '-v "DEVICE_METADATA[\'localhost\'][\'resource_type\']" -m "' + self.sample_graph_metadata + '"' + argument = '-v "DEVICE_METADATA[\'localhost\'][\'resource_type\']" -m "' + self.sample_graph_metadata + '" -p "' + self.port_config + '"' output = self.run_script(argument) self.assertEqual(output.strip(), 'resource_type_x') def test_minigraph_downstream_subrole(self): - argument = '-v "DEVICE_METADATA[\'localhost\'][\'downstream_subrole\']" -m "' + self.sample_graph_metadata + '"' + argument = '-v "DEVICE_METADATA[\'localhost\'][\'downstream_subrole\']" -m "' + self.sample_graph_metadata + '" -p "' + self.port_config + '"' output = self.run_script(argument) self.assertEqual(output.strip(), 'downstream_subrole_y') def test_print_data(self): - argument = '-m "' + self.sample_graph + '" --print-data' + argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" --print-data' output = self.run_script(argument) self.assertTrue(len(output.strip()) > 0) - def test_jinja_expression(self, graph=None, expected_router_type='LeafRouter'): + def test_jinja_expression(self, graph=None, port_config=None, expected_router_type='LeafRouter'): if graph is None: graph = self.sample_graph - argument = '-m "' + graph + '" -v "DEVICE_METADATA[\'localhost\'][\'type\']"' + if port_config is None: + port_config = self.port_config + argument = '-m "' + graph + '" -p "' + port_config + '" -v "DEVICE_METADATA[\'localhost\'][\'type\']"' output = self.run_script(argument) self.assertEqual(output.strip(), expected_router_type) @@ -134,17 +143,29 @@ def test_additional_json_data_level2_key(self): def test_var_json_data(self, **kwargs): graph_file = kwargs.get('graph_file', self.sample_graph_simple) + tag_mode = kwargs.get('tag_mode', 'untagged') argument = '-m "' + graph_file + '" -p "' + self.port_config + '" --var-json VLAN_MEMBER' output = self.run_script(argument) - self.assertEqual( - utils.to_dict(output.strip()), - utils.to_dict( - '{\n "Vlan1000|Ethernet8": {\n "tagging_mode": "untagged"\n },' - ' \n "Vlan2000|Ethernet12": {\n "tagging_mode": "tagged"\n },' - ' \n "Vlan2001|Ethernet12": {\n "tagging_mode": "tagged"\n },' - ' \n "Vlan2020|Ethernet12": {\n "tagging_mode": "tagged"\n }\n}' + if tag_mode == "tagged": + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict( + '{\n "Vlan1000|Ethernet8": {\n "tagging_mode": "tagged"\n },' + ' \n "Vlan2000|Ethernet12": {\n "tagging_mode": "tagged"\n },' + ' \n "Vlan2001|Ethernet12": {\n "tagging_mode": "tagged"\n },' + ' \n "Vlan2020|Ethernet12": {\n "tagging_mode": "tagged"\n }\n}' + ) + ) + else: + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict( + '{\n "Vlan1000|Ethernet8": {\n "tagging_mode": "untagged"\n },' + ' \n "Vlan2000|Ethernet12": {\n "tagging_mode": "tagged"\n },' + ' \n "Vlan2001|Ethernet12": {\n "tagging_mode": "tagged"\n },' + ' \n "Vlan2020|Ethernet12": {\n "tagging_mode": "tagged"\n }\n}' + ) ) - ) def test_read_yaml(self): argument = '-v yml_item -y ' + os.path.join(self.test_dir, 'test.yml') @@ -185,7 +206,7 @@ def test_template_json_batch_mode(self): # more robust by adding better parsing logic. def test_minigraph_acl(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v ACL_TABLE' - output = self.run_script(argument, True) + output = self.run_script(argument, True, True) self.assertEqual( utils.to_dict(output.strip().replace("Warning: Ignoring Control Plane ACL NTP_ACL without type\n", '')), utils.to_dict( @@ -227,26 +248,38 @@ def test_minigraph_vlans(self, **kwargs): self.assertEqual( utils.to_dict(output.strip()), utils.to_dict( - "{'Vlan1000': {'alias': 'ab1', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '1000', 'members': ['Ethernet8']}, " - "'Vlan2001': {'alias': 'ab3', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '2001', 'members': ['Ethernet12']}," - "'Vlan2000': {'alias': 'ab2', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '2000', 'members': ['Ethernet12']}," - "'Vlan2020': {'alias': 'kk1', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '2020', 'members': ['Ethernet12']}}" + "{'Vlan1000': {'alias': 'ab1', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '1000'}, " + "'Vlan2001': {'alias': 'ab3', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '2001'}," + "'Vlan2000': {'alias': 'ab2', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '2000'}," + "'Vlan2020': {'alias': 'kk1', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '2020'}}" ) ) def test_minigraph_vlan_members(self, **kwargs): graph_file = kwargs.get('graph_file', self.sample_graph_simple) + tag_mode = kwargs.get('tag_mode', 'untagged') argument = '-m "' + graph_file + '" -p "' + self.port_config + '" -v VLAN_MEMBER' output = self.run_script(argument) - self.assertEqual( - utils.to_dict(output.strip()), - utils.to_dict( - "{('Vlan2000', 'Ethernet12'): {'tagging_mode': 'tagged'}, " - "('Vlan1000', 'Ethernet8'): {'tagging_mode': 'untagged'}, " - "('Vlan2020', 'Ethernet12'): {'tagging_mode': 'tagged'}, " - "('Vlan2001', 'Ethernet12'): {'tagging_mode': 'tagged'}}" + if tag_mode == "tagged": + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict( + "{('Vlan2000', 'Ethernet12'): {'tagging_mode': 'tagged'}, " + "('Vlan1000', 'Ethernet8'): {'tagging_mode': 'tagged'}, " + "('Vlan2020', 'Ethernet12'): {'tagging_mode': 'tagged'}, " + "('Vlan2001', 'Ethernet12'): {'tagging_mode': 'tagged'}}" + ) + ) + else: + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict( + "{('Vlan2000', 'Ethernet12'): {'tagging_mode': 'tagged'}, " + "('Vlan1000', 'Ethernet8'): {'tagging_mode': 'untagged'}, " + "('Vlan2020', 'Ethernet12'): {'tagging_mode': 'tagged'}, " + "('Vlan2001', 'Ethernet12'): {'tagging_mode': 'tagged'}}" + ) ) - ) def test_minigraph_vlan_interfaces(self, **kwargs): graph_file = kwargs.get('graph_file', self.sample_graph_simple) @@ -363,37 +396,37 @@ def test_minigraph_port_autonegotiation(self): self.assertEqual( utils.to_dict(output.strip()), utils.to_dict( - "{'Ethernet0': {'alias': 'fortyGigE0/0', 'pfc_asym': 'off', 'lanes': '29,30,31,32', 'description': 'fortyGigE0/0', 'mtu': '9100', 'tpid': '0x8100'}, " + "{'Ethernet0': {'alias': 'fortyGigE0/0', 'pfc_asym': 'off', 'lanes': '29,30,31,32', 'description': 'fortyGigE0/0', 'mtu': '9100', 'tpid': '0x8100', 'speed': '40000'}, " "'Ethernet4': {'lanes': '25,26,27,28', 'description': 'Servers0:eth0', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/4', 'admin_status': 'up', 'autoneg': 'on', 'speed': '100000', 'fec': 'none'}, " - "'Ethernet8': {'lanes': '37,38,39,40', 'description': 'fortyGigE0/8', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'autoneg': 'off', 'fec': 'none'}, " - "'Ethernet12': {'lanes': '33,34,35,36', 'description': 'fortyGigE0/12', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/12', 'admin_status': 'up'}, " - "'Ethernet16': {'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/16', 'admin_status': 'up'}, " - "'Ethernet20': {'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/20', 'admin_status': 'up'}, " - "'Ethernet24': {'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/24', 'admin_status': 'up'}, " - "'Ethernet28': {'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/28', 'admin_status': 'up'}, " - "'Ethernet32': {'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/32', 'admin_status': 'up'}, " - "'Ethernet36': {'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/36', 'admin_status': 'up'}, " - "'Ethernet40': {'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/40', 'admin_status': 'up'}, " - "'Ethernet44': {'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/44', 'admin_status': 'up'}, " - "'Ethernet48': {'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/48', 'admin_status': 'up'}, " - "'Ethernet52': {'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/52', 'admin_status': 'up'}, " - "'Ethernet56': {'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/56', 'admin_status': 'up'}, " - "'Ethernet60': {'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/60', 'admin_status': 'up'}, " - "'Ethernet64': {'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/64', 'admin_status': 'up'}, " - "'Ethernet68': {'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/68', 'admin_status': 'up'}, " - "'Ethernet72': {'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/72', 'admin_status': 'up'}, " - "'Ethernet76': {'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/76', 'admin_status': 'up'}, " - "'Ethernet80': {'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/80', 'admin_status': 'up'}, " - "'Ethernet84': {'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/84', 'admin_status': 'up'}, " - "'Ethernet88': {'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/88', 'admin_status': 'up'}, " - "'Ethernet92': {'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/92', 'admin_status': 'up'}, " - "'Ethernet96': {'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/96', 'admin_status': 'up'}, " - "'Ethernet100': {'lanes': '125,126,127,128', 'description': 'Servers100:eth0', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/100', 'admin_status': 'up'}, " - "'Ethernet104': {'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet108': {'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet112': {'lanes': '89,90,91,92', 'description': 'ARISTA01T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/112', 'admin_status': 'up'}, " - "'Ethernet116': {'lanes': '93,94,95,96', 'description': 'ARISTA02T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/116', 'admin_status': 'up'}, " - "'Ethernet120': {'lanes': '97,98,99,100', 'description': 'ARISTA03T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/120', 'admin_status': 'up'}, " + "'Ethernet8': {'lanes': '37,38,39,40', 'description': 'fortyGigE0/8', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'autoneg': 'off', 'fec': 'none', 'speed': '40000'}, " + "'Ethernet12': {'lanes': '33,34,35,36', 'description': 'fortyGigE0/12', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/12', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet16': {'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/16', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet20': {'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/20', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet24': {'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/24', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet28': {'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/28', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet32': {'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/32', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet36': {'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/36', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet40': {'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/40', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet44': {'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/44', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet48': {'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/48', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet52': {'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/52', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet56': {'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/56', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet60': {'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/60', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet64': {'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/64', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet68': {'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/68', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet72': {'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/72', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet76': {'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/76', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet80': {'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/80', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet84': {'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/84', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet88': {'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/88', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet92': {'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/92', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet96': {'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/96', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet100': {'lanes': '125,126,127,128', 'description': 'Servers100:eth0', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/100', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet104': {'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100', 'tpid': '0x8100', 'speed': '40000'}, " + "'Ethernet108': {'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100', 'tpid': '0x8100', 'speed': '40000'}, " + "'Ethernet112': {'lanes': '89,90,91,92', 'description': 'ARISTA01T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/112', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet116': {'lanes': '93,94,95,96', 'description': 'ARISTA02T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/116', 'admin_status': 'up', 'speed': '40000'}, " + "'Ethernet120': {'lanes': '97,98,99,100', 'description': 'ARISTA03T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/120', 'admin_status': 'up', 'speed': '40000'}, " "'Ethernet124': {'lanes': '101,102,103,104', 'fec': 'rs', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/124', 'admin_status': 'up', 'speed': '100000', 'description': 'ARISTA04T1:Ethernet1/1'}}" ) ) @@ -404,38 +437,38 @@ def test_minigraph_port_autonegotiation(self): self.assertEqual( utils.to_dict(output.strip()), utils.to_dict( - "{'Ethernet0': {'lanes': '29,30,31,32', 'description': 'fortyGigE0/0', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/0', 'pfc_asym': 'off', 'autoneg': 'off'}, " + "{'Ethernet0': {'lanes': '29,30,31,32', 'description': 'fortyGigE0/0', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/0', 'pfc_asym': 'off', 'autoneg': 'off', 'speed': '40000'}, " "'Ethernet4': {'lanes': '25,26,27,28', 'description': 'Servers0:eth0', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/4', 'admin_status': 'up', 'autoneg': 'on', 'speed': '100000', 'fec': 'none'}, " - "'Ethernet8': {'lanes': '37,38,39,40', 'description': 'fortyGigE0/8', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'autoneg': 'off', 'fec': 'none'}, " - "'Ethernet12': {'lanes': '33,34,35,36', 'description': 'fortyGigE0/12', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/12', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet16': {'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/16', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet20': {'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/20', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet24': {'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/24', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet28': {'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/28', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet32': {'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/32', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet36': {'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/36', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet40': {'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/40', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet44': {'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/44', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet48': {'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/48', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet52': {'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/52', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet56': {'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/56', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet60': {'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/60', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet64': {'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/64', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet68': {'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/68', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet72': {'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/72', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet76': {'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/76', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet80': {'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/80', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet84': {'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/84', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet88': {'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/88', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet92': {'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/92', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet96': {'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/96', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet100': {'lanes': '125,126,127,128', 'description': 'Servers100:eth0', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/100', 'admin_status': 'up', 'autoneg': 'off'}, " - "'Ethernet104': {'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'autoneg': 'off'}, " - "'Ethernet108': {'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'autoneg': 'off'}, " - "'Ethernet112': {'lanes': '89,90,91,92', 'description': 'ARISTA01T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/112', 'admin_status': 'up', 'autoneg': 'on'}, " - "'Ethernet116': {'lanes': '93,94,95,96', 'description': 'ARISTA02T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/116', 'admin_status': 'up', 'autoneg': 'on'}, " - "'Ethernet120': {'lanes': '97,98,99,100', 'description': 'ARISTA03T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/120', 'admin_status': 'up', 'autoneg': 'on'}, " - "'Ethernet124': {'lanes': '101,102,103,104', 'fec': 'rs', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/124', 'admin_status': 'up', 'autoneg': 'on', 'speed': '100000', 'description': 'ARISTA04T1:Ethernet1/1'}}" + "'Ethernet8': {'lanes': '37,38,39,40', 'description': 'fortyGigE0/8', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'autoneg': 'off', 'fec': 'none', 'speed': '40000'}, " + "'Ethernet12': {'lanes': '33,34,35,36', 'description': 'fortyGigE0/12', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/12', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet16': {'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/16', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet20': {'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/20', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet24': {'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/24', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet28': {'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/28', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet32': {'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/32', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet36': {'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/36', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet40': {'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/40', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet44': {'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/44', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet48': {'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/48', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet52': {'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/52', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet56': {'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/56', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet60': {'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/60', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet64': {'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/64', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet68': {'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/68', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet72': {'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/72', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet76': {'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/76', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet80': {'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/80', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet84': {'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/84', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet88': {'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/88', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet92': {'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/92', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet96': {'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/96', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet100': {'lanes': '125,126,127,128', 'description': 'Servers100:eth0', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/100', 'admin_status': 'up', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet104': {'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet108': {'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'autoneg': 'off', 'speed': '40000'}, " + "'Ethernet112': {'lanes': '89,90,91,92', 'description': 'ARISTA01T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/112', 'admin_status': 'up', 'autoneg': 'on', 'speed': '40000'}, " + "'Ethernet116': {'lanes': '93,94,95,96', 'description': 'ARISTA02T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/116', 'admin_status': 'up', 'autoneg': 'on', 'speed': '40000'}, " + "'Ethernet120': {'lanes': '97,98,99,100', 'description': 'ARISTA03T1:Ethernet1/1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/120', 'admin_status': 'up', 'autoneg': 'on', 'speed': '40000'}, " + "'Ethernet124': {'lanes': '101,102,103,104', 'fec': 'rs', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/124', 'admin_status': 'up', 'autoneg': 'on', 'speed': '100000', 'description': 'ARISTA04T1:Ethernet1/1', 'speed': '100000'}}" ) ) @@ -468,6 +501,11 @@ def test_minigraph_deployment_id(self): output = self.run_script(argument) self.assertEqual(output.strip(), "1") + def test_minigraph_deployment_id_null(self): + argument = '-m "' + self.sample_graph_deployment_id + '" -p "' + self.port_config + '" -v "DEVICE_METADATA[\'localhost\']"' + output = self.run_script(argument) + self.assertNotIn('deployment_id', output.strip()) + def test_minigraph_ethernet_interfaces(self, **kwargs): graph_file = kwargs.get('graph_file', self.sample_graph_simple) argument = '-m "' + graph_file + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet8\']"' @@ -494,77 +532,77 @@ def test_minigraph_neighbor_interfaces(self): "'Ethernet4': {'lanes': '25,26,27,28', 'description': 'server1:port1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/4', 'admin_status': 'up', 'speed': '25000', 'autoneg': 'on', 'mux_cable': 'true'}, " "'Ethernet8': {'lanes': '37,38,39,40', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '40000', 'autoneg': 'on', 'mux_cable': 'true'}, " "'Ethernet12': {'lanes': '33,34,35,36', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/12', 'admin_status': 'up', 'speed': '10000', 'autoneg': 'on'}, " - "'Ethernet16': {'alias': 'fortyGigE0/16', 'pfc_asym': 'off', 'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet20': {'alias': 'fortyGigE0/20', 'pfc_asym': 'off', 'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet24': {'alias': 'fortyGigE0/24', 'pfc_asym': 'off', 'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet28': {'alias': 'fortyGigE0/28', 'pfc_asym': 'off', 'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet32': {'alias': 'fortyGigE0/32', 'pfc_asym': 'off', 'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet36': {'alias': 'fortyGigE0/36', 'pfc_asym': 'off', 'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet40': {'alias': 'fortyGigE0/40', 'pfc_asym': 'off', 'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet44': {'alias': 'fortyGigE0/44', 'pfc_asym': 'off', 'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet48': {'alias': 'fortyGigE0/48', 'pfc_asym': 'off', 'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet52': {'alias': 'fortyGigE0/52', 'pfc_asym': 'off', 'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet56': {'alias': 'fortyGigE0/56', 'pfc_asym': 'off', 'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet60': {'alias': 'fortyGigE0/60', 'pfc_asym': 'off', 'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet64': {'alias': 'fortyGigE0/64', 'pfc_asym': 'off', 'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet68': {'alias': 'fortyGigE0/68', 'pfc_asym': 'off', 'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet72': {'alias': 'fortyGigE0/72', 'pfc_asym': 'off', 'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet76': {'alias': 'fortyGigE0/76', 'pfc_asym': 'off', 'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet80': {'alias': 'fortyGigE0/80', 'pfc_asym': 'off', 'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet84': {'alias': 'fortyGigE0/84', 'pfc_asym': 'off', 'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet88': {'alias': 'fortyGigE0/88', 'pfc_asym': 'off', 'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet92': {'alias': 'fortyGigE0/92', 'pfc_asym': 'off', 'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet96': {'alias': 'fortyGigE0/96', 'pfc_asym': 'off', 'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet100': {'alias': 'fortyGigE0/100', 'pfc_asym': 'off', 'lanes': '125,126,127,128', 'description': 'fortyGigE0/100', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet104': {'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet108': {'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet112': {'alias': 'fortyGigE0/112', 'pfc_asym': 'off', 'lanes': '89,90,91,92', 'description': 'fortyGigE0/112', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet116': {'alias': 'fortyGigE0/116', 'pfc_asym': 'off', 'lanes': '93,94,95,96', 'description': 'fortyGigE0/116', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet120': {'alias': 'fortyGigE0/120', 'pfc_asym': 'off', 'lanes': '97,98,99,100', 'description': 'fortyGigE0/120', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet124': {'alias': 'fortyGigE0/124', 'pfc_asym': 'off', 'lanes': '101,102,103,104', 'description': 'fortyGigE0/124', 'mtu': '9100', 'tpid': '0x8100'}}" + "'Ethernet16': {'alias': 'fortyGigE0/16', 'pfc_asym': 'off', 'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet20': {'alias': 'fortyGigE0/20', 'pfc_asym': 'off', 'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet24': {'alias': 'fortyGigE0/24', 'pfc_asym': 'off', 'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet28': {'alias': 'fortyGigE0/28', 'pfc_asym': 'off', 'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet32': {'alias': 'fortyGigE0/32', 'pfc_asym': 'off', 'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet36': {'alias': 'fortyGigE0/36', 'pfc_asym': 'off', 'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet40': {'alias': 'fortyGigE0/40', 'pfc_asym': 'off', 'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet44': {'alias': 'fortyGigE0/44', 'pfc_asym': 'off', 'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet48': {'alias': 'fortyGigE0/48', 'pfc_asym': 'off', 'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet52': {'alias': 'fortyGigE0/52', 'pfc_asym': 'off', 'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet56': {'alias': 'fortyGigE0/56', 'pfc_asym': 'off', 'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet60': {'alias': 'fortyGigE0/60', 'pfc_asym': 'off', 'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet64': {'alias': 'fortyGigE0/64', 'pfc_asym': 'off', 'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet68': {'alias': 'fortyGigE0/68', 'pfc_asym': 'off', 'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet72': {'alias': 'fortyGigE0/72', 'pfc_asym': 'off', 'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet76': {'alias': 'fortyGigE0/76', 'pfc_asym': 'off', 'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet80': {'alias': 'fortyGigE0/80', 'pfc_asym': 'off', 'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet84': {'alias': 'fortyGigE0/84', 'pfc_asym': 'off', 'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet88': {'alias': 'fortyGigE0/88', 'pfc_asym': 'off', 'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet92': {'alias': 'fortyGigE0/92', 'pfc_asym': 'off', 'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet96': {'alias': 'fortyGigE0/96', 'pfc_asym': 'off', 'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet100': {'alias': 'fortyGigE0/100', 'pfc_asym': 'off', 'lanes': '125,126,127,128', 'description': 'fortyGigE0/100', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet104': {'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet108': {'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet112': {'alias': 'fortyGigE0/112', 'pfc_asym': 'off', 'lanes': '89,90,91,92', 'description': 'fortyGigE0/112', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet116': {'alias': 'fortyGigE0/116', 'pfc_asym': 'off', 'lanes': '93,94,95,96', 'description': 'fortyGigE0/116', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet120': {'alias': 'fortyGigE0/120', 'pfc_asym': 'off', 'lanes': '97,98,99,100', 'description': 'fortyGigE0/120', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet124': {'alias': 'fortyGigE0/124', 'pfc_asym': 'off', 'lanes': '101,102,103,104', 'description': 'fortyGigE0/124', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}}" ) ) def test_minigraph_neighbor_interfaces_config_db(self): # test to check if PORT table is retrieved from config_db - argument = '-m "' + self.sample_graph_simple_case + '" -v "PORT"' + argument = '-m "' + self.sample_graph_simple_case + '" -p "' + self.port_config + '" -v "PORT"' output = self.run_script(argument) self.assertEqual( utils.to_dict(output.strip()), utils.to_dict( - "{'Ethernet0': {'lanes': '29,30,31,32', 'description': 'config_db:switch-01t1:port1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/0', 'admin_status': 'up', 'speed': '10000', 'autoneg': 'on'}, " - "'Ethernet4': {'lanes': '25,26,27,28', 'description': 'config_db:server1:port1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/4', 'admin_status': 'up', 'speed': '25000', 'autoneg': 'on', 'mux_cable': 'true'}, " + "{'Ethernet0': {'lanes': '29,30,31,32', 'description': 'switch-01t1:port1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/0', 'admin_status': 'up', 'speed': '10000', 'autoneg': 'on'}, " + "'Ethernet4': {'lanes': '25,26,27,28', 'description': 'server1:port1', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/4', 'admin_status': 'up', 'speed': '25000', 'autoneg': 'on', 'mux_cable': 'true'}, " "'Ethernet8': {'lanes': '37,38,39,40', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '40000', 'autoneg': 'on', 'mux_cable': 'true'}, " "'Ethernet12': {'lanes': '33,34,35,36', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/12', 'admin_status': 'up', 'speed': '10000', 'autoneg': 'on'}, " - "'Ethernet16': {'alias': 'fortyGigE0/16', 'pfc_asym': 'off', 'lanes': '41,42,43,44', 'description': 'config_db:fortyGigE0/16', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet20': {'alias': 'fortyGigE0/20', 'pfc_asym': 'off', 'lanes': '45,46,47,48', 'description': 'config_db:fortyGigE0/20', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet24': {'alias': 'fortyGigE0/24', 'pfc_asym': 'off', 'lanes': '5,6,7,8', 'description': 'config_db:fortyGigE0/24', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet28': {'alias': 'fortyGigE0/28', 'pfc_asym': 'off', 'lanes': '1,2,3,4', 'description': 'config_db:fortyGigE0/28', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet32': {'alias': 'fortyGigE0/32', 'pfc_asym': 'off', 'lanes': '9,10,11,12', 'description': 'config_db:fortyGigE0/32', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet36': {'alias': 'fortyGigE0/36', 'pfc_asym': 'off', 'lanes': '13,14,15,16', 'description': 'config_db:fortyGigE0/36', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet40': {'alias': 'fortyGigE0/40', 'pfc_asym': 'off', 'lanes': '21,22,23,24', 'description': 'config_db:fortyGigE0/40', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet44': {'alias': 'fortyGigE0/44', 'pfc_asym': 'off', 'lanes': '17,18,19,20', 'description': 'config_db:fortyGigE0/44', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet48': {'alias': 'fortyGigE0/48', 'pfc_asym': 'off', 'lanes': '49,50,51,52', 'description': 'config_db:fortyGigE0/48', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet52': {'alias': 'fortyGigE0/52', 'pfc_asym': 'off', 'lanes': '53,54,55,56', 'description': 'config_db:fortyGigE0/52', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet56': {'alias': 'fortyGigE0/56', 'pfc_asym': 'off', 'lanes': '61,62,63,64', 'description': 'config_db:fortyGigE0/56', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet60': {'alias': 'fortyGigE0/60', 'pfc_asym': 'off', 'lanes': '57,58,59,60', 'description': 'config_db:fortyGigE0/60', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet64': {'alias': 'fortyGigE0/64', 'pfc_asym': 'off', 'lanes': '65,66,67,68', 'description': 'config_db:fortyGigE0/64', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet68': {'alias': 'fortyGigE0/68', 'pfc_asym': 'off', 'lanes': '69,70,71,72', 'description': 'config_db:fortyGigE0/68', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet72': {'alias': 'fortyGigE0/72', 'pfc_asym': 'off', 'lanes': '77,78,79,80', 'description': 'config_db:fortyGigE0/72', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet76': {'alias': 'fortyGigE0/76', 'pfc_asym': 'off', 'lanes': '73,74,75,76', 'description': 'config_db:fortyGigE0/76', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet80': {'alias': 'fortyGigE0/80', 'pfc_asym': 'off', 'lanes': '105,106,107,108', 'description': 'config_db:fortyGigE0/80', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet84': {'alias': 'fortyGigE0/84', 'pfc_asym': 'off', 'lanes': '109,110,111,112', 'description': 'config_db:fortyGigE0/84', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet88': {'alias': 'fortyGigE0/88', 'pfc_asym': 'off', 'lanes': '117,118,119,120', 'description': 'config_db:fortyGigE0/88', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet92': {'alias': 'fortyGigE0/92', 'pfc_asym': 'off', 'lanes': '113,114,115,116', 'description': 'config_db:fortyGigE0/92', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet96': {'alias': 'fortyGigE0/96', 'pfc_asym': 'off', 'lanes': '121,122,123,124', 'description': 'config_db:fortyGigE0/96', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet100': {'alias': 'fortyGigE0/100', 'pfc_asym': 'off', 'lanes': '125,126,127,128', 'description': 'config_db:fortyGigE0/100', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet104': {'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'lanes': '85,86,87,88', 'description': 'config_db:fortyGigE0/104', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet108': {'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'lanes': '81,82,83,84', 'description': 'config_db:fortyGigE0/108', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet112': {'alias': 'fortyGigE0/112', 'pfc_asym': 'off', 'lanes': '89,90,91,92', 'description': 'config_db:fortyGigE0/112', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet116': {'alias': 'fortyGigE0/116', 'pfc_asym': 'off', 'lanes': '93,94,95,96', 'description': 'config_db:fortyGigE0/116', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet120': {'alias': 'fortyGigE0/120', 'pfc_asym': 'off', 'lanes': '97,98,99,100', 'description': 'config_db:fortyGigE0/120', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet124': {'alias': 'fortyGigE0/124', 'pfc_asym': 'off', 'lanes': '101,102,103,104', 'description': 'config_db:fortyGigE0/124', 'mtu': '9100', 'tpid': '0x8100'}}" + "'Ethernet16': {'alias': 'fortyGigE0/16', 'pfc_asym': 'off', 'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet20': {'alias': 'fortyGigE0/20', 'pfc_asym': 'off', 'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet24': {'alias': 'fortyGigE0/24', 'pfc_asym': 'off', 'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet28': {'alias': 'fortyGigE0/28', 'pfc_asym': 'off', 'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet32': {'alias': 'fortyGigE0/32', 'pfc_asym': 'off', 'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet36': {'alias': 'fortyGigE0/36', 'pfc_asym': 'off', 'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet40': {'alias': 'fortyGigE0/40', 'pfc_asym': 'off', 'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet44': {'alias': 'fortyGigE0/44', 'pfc_asym': 'off', 'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet48': {'alias': 'fortyGigE0/48', 'pfc_asym': 'off', 'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet52': {'alias': 'fortyGigE0/52', 'pfc_asym': 'off', 'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet56': {'alias': 'fortyGigE0/56', 'pfc_asym': 'off', 'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet60': {'alias': 'fortyGigE0/60', 'pfc_asym': 'off', 'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet64': {'alias': 'fortyGigE0/64', 'pfc_asym': 'off', 'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet68': {'alias': 'fortyGigE0/68', 'pfc_asym': 'off', 'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet72': {'alias': 'fortyGigE0/72', 'pfc_asym': 'off', 'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet76': {'alias': 'fortyGigE0/76', 'pfc_asym': 'off', 'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet80': {'alias': 'fortyGigE0/80', 'pfc_asym': 'off', 'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet84': {'alias': 'fortyGigE0/84', 'pfc_asym': 'off', 'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet88': {'alias': 'fortyGigE0/88', 'pfc_asym': 'off', 'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet92': {'alias': 'fortyGigE0/92', 'pfc_asym': 'off', 'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet96': {'alias': 'fortyGigE0/96', 'pfc_asym': 'off', 'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet100': {'alias': 'fortyGigE0/100', 'pfc_asym': 'off', 'lanes': '125,126,127,128', 'description': 'fortyGigE0/100', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet104': {'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet108': {'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet112': {'alias': 'fortyGigE0/112', 'pfc_asym': 'off', 'lanes': '89,90,91,92', 'description': 'fortyGigE0/112', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet116': {'alias': 'fortyGigE0/116', 'pfc_asym': 'off', 'lanes': '93,94,95,96', 'description': 'fortyGigE0/116', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet120': {'alias': 'fortyGigE0/120', 'pfc_asym': 'off', 'lanes': '97,98,99,100', 'description': 'fortyGigE0/120', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet124': {'alias': 'fortyGigE0/124', 'pfc_asym': 'off', 'lanes': '101,102,103,104', 'description': 'fortyGigE0/124', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}}" ) ) @@ -581,33 +619,33 @@ def test_minigraph_extra_ethernet_interfaces(self, **kwargs): "'Ethernet8': {'lanes': '37,38,39,40', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '1000'}, " "'Ethernet12': {'lanes': '33,34,35,36', 'fec': 'rs', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/12', 'admin_status': 'up', 'speed': '100000', 'description': 'Interface description'}, " "'Ethernet16': {'lanes': '41,42,43,44', 'pfc_asym': 'off', 'description': 'fortyGigE0/16', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/16', 'speed': '1000'}, " - "'Ethernet20': {'alias': 'fortyGigE0/20', 'pfc_asym': 'off', 'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet24': {'alias': 'fortyGigE0/24', 'pfc_asym': 'off', 'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet28': {'alias': 'fortyGigE0/28', 'pfc_asym': 'off', 'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet32': {'alias': 'fortyGigE0/32', 'pfc_asym': 'off', 'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet36': {'alias': 'fortyGigE0/36', 'pfc_asym': 'off', 'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet40': {'alias': 'fortyGigE0/40', 'pfc_asym': 'off', 'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet44': {'alias': 'fortyGigE0/44', 'pfc_asym': 'off', 'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet48': {'alias': 'fortyGigE0/48', 'pfc_asym': 'off', 'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet52': {'alias': 'fortyGigE0/52', 'pfc_asym': 'off', 'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet56': {'alias': 'fortyGigE0/56', 'pfc_asym': 'off', 'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet60': {'alias': 'fortyGigE0/60', 'pfc_asym': 'off', 'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet64': {'alias': 'fortyGigE0/64', 'pfc_asym': 'off', 'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet68': {'alias': 'fortyGigE0/68', 'pfc_asym': 'off', 'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet72': {'alias': 'fortyGigE0/72', 'pfc_asym': 'off', 'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet76': {'alias': 'fortyGigE0/76', 'pfc_asym': 'off', 'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet80': {'alias': 'fortyGigE0/80', 'pfc_asym': 'off', 'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet84': {'alias': 'fortyGigE0/84', 'pfc_asym': 'off', 'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet88': {'alias': 'fortyGigE0/88', 'pfc_asym': 'off', 'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet92': {'alias': 'fortyGigE0/92', 'pfc_asym': 'off', 'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet96': {'alias': 'fortyGigE0/96', 'pfc_asym': 'off', 'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet100': {'alias': 'fortyGigE0/100', 'pfc_asym': 'off', 'lanes': '125,126,127,128', 'description': 'fortyGigE0/100', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet104': {'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet108': {'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet112': {'alias': 'fortyGigE0/112', 'pfc_asym': 'off', 'lanes': '89,90,91,92', 'description': 'fortyGigE0/112', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet116': {'alias': 'fortyGigE0/116', 'pfc_asym': 'off', 'lanes': '93,94,95,96', 'description': 'fortyGigE0/116', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet120': {'alias': 'fortyGigE0/120', 'pfc_asym': 'off', 'lanes': '97,98,99,100', 'description': 'fortyGigE0/120', 'mtu': '9100', 'tpid': '0x8100'}, " - "'Ethernet124': {'alias': 'fortyGigE0/124', 'pfc_asym': 'off', 'lanes': '101,102,103,104', 'description': 'fortyGigE0/124', 'mtu': '9100', 'tpid': '0x8100'}}" + "'Ethernet20': {'alias': 'fortyGigE0/20', 'pfc_asym': 'off', 'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet24': {'alias': 'fortyGigE0/24', 'pfc_asym': 'off', 'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet28': {'alias': 'fortyGigE0/28', 'pfc_asym': 'off', 'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet32': {'alias': 'fortyGigE0/32', 'pfc_asym': 'off', 'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet36': {'alias': 'fortyGigE0/36', 'pfc_asym': 'off', 'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet40': {'alias': 'fortyGigE0/40', 'pfc_asym': 'off', 'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet44': {'alias': 'fortyGigE0/44', 'pfc_asym': 'off', 'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet48': {'alias': 'fortyGigE0/48', 'pfc_asym': 'off', 'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet52': {'alias': 'fortyGigE0/52', 'pfc_asym': 'off', 'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet56': {'alias': 'fortyGigE0/56', 'pfc_asym': 'off', 'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet60': {'alias': 'fortyGigE0/60', 'pfc_asym': 'off', 'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet64': {'alias': 'fortyGigE0/64', 'pfc_asym': 'off', 'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet68': {'alias': 'fortyGigE0/68', 'pfc_asym': 'off', 'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet72': {'alias': 'fortyGigE0/72', 'pfc_asym': 'off', 'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet76': {'alias': 'fortyGigE0/76', 'pfc_asym': 'off', 'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet80': {'alias': 'fortyGigE0/80', 'pfc_asym': 'off', 'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet84': {'alias': 'fortyGigE0/84', 'pfc_asym': 'off', 'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet88': {'alias': 'fortyGigE0/88', 'pfc_asym': 'off', 'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet92': {'alias': 'fortyGigE0/92', 'pfc_asym': 'off', 'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet96': {'alias': 'fortyGigE0/96', 'pfc_asym': 'off', 'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet100': {'alias': 'fortyGigE0/100', 'pfc_asym': 'off', 'lanes': '125,126,127,128', 'description': 'fortyGigE0/100', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet104': {'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet108': {'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet112': {'alias': 'fortyGigE0/112', 'pfc_asym': 'off', 'lanes': '89,90,91,92', 'description': 'fortyGigE0/112', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet116': {'alias': 'fortyGigE0/116', 'pfc_asym': 'off', 'lanes': '93,94,95,96', 'description': 'fortyGigE0/116', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet120': {'alias': 'fortyGigE0/120', 'pfc_asym': 'off', 'lanes': '97,98,99,100', 'description': 'fortyGigE0/120', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}, " + "'Ethernet124': {'alias': 'fortyGigE0/124', 'pfc_asym': 'off', 'lanes': '101,102,103,104', 'description': 'fortyGigE0/124', 'mtu': '9100', 'tpid': '0x8100', 'fec': 'rs', 'speed': '100000'}}" ) ) @@ -647,7 +685,7 @@ def test_minigraph_bgp_mon(self): output = self.run_script(argument) self.assertEqual( utils.to_dict(output.strip()), - utils.to_dict("{'10.20.30.40': {'rrclient': 0, 'name': 'BGPMonitor', 'local_addr': '10.1.0.32', 'nhopself': 0, 'holdtime': '10', 'asn': '0', 'keepalive': '3'}}") + utils.to_dict("{'10.20.30.40': {'rrclient': 0, 'name': 'BGPMonitor', 'local_addr': '10.1.0.32', 'nhopself': 0, 'holdtime': '10', 'asn': '1', 'keepalive': '3'}}") ) def test_minigraph_bgp_voq_chassis_peer(self): @@ -672,6 +710,33 @@ def test_minigraph_sub_port_intf_resource_type(self, check_stderr=True): def test_minigraph_sub_port_intf_sub(self, check_stderr=True): self.verify_sub_intf(graph_file=self.sample_subintf_graph, check_stderr=check_stderr) + def test_minigraph_no_vlan_member(self, check_stderr=True): + self.verify_no_vlan_member() + + def test_minigraph_sub_port_no_vlan_member(self, check_stderr=True): + try: + print('\n Change device type to %s' % (BACKEND_LEAF_ROUTER)) + if check_stderr: + output = subprocess.check_output("sed -i \'s/%s/%s/g\' %s" % (LEAF_ROUTER, BACKEND_LEAF_ROUTER, self.sample_graph), stderr=subprocess.STDOUT, shell=True) + else: + output = subprocess.check_output("sed -i \'s/%s/%s/g\' %s" % (LEAF_ROUTER, BACKEND_LEAF_ROUTER, self.sample_graph), shell=True) + + self.test_jinja_expression(self.sample_graph, self.port_config, BACKEND_LEAF_ROUTER) + self.verify_no_vlan_member() + finally: + print('\n Change device type back to %s' % (LEAF_ROUTER)) + if check_stderr: + output = subprocess.check_output("sed -i \'s/%s/%s/g\' %s" % (BACKEND_LEAF_ROUTER, LEAF_ROUTER, self.sample_graph), stderr=subprocess.STDOUT, shell=True) + else: + output = subprocess.check_output("sed -i \'s/%s/%s/g\' %s" % (BACKEND_LEAF_ROUTER, LEAF_ROUTER, self.sample_graph), shell=True) + + self.test_jinja_expression(self.sample_graph, self.port_config, LEAF_ROUTER) + + def verify_no_vlan_member(self): + argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "VLAN_MEMBER"' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{}") + def verify_sub_intf(self, **kwargs): graph_file = kwargs.get('graph_file', self.sample_graph_simple) check_stderr = kwargs.get('check_stderr', True) @@ -682,7 +747,7 @@ def verify_sub_intf(self, **kwargs): else: output = subprocess.check_output("sed -i \'s/%s/%s/g\' %s" % (TOR_ROUTER, BACKEND_TOR_ROUTER, graph_file), shell=True) - self.test_jinja_expression(graph_file, BACKEND_TOR_ROUTER) + self.test_jinja_expression(graph_file, self.port_config, BACKEND_TOR_ROUTER) # INTERFACE table does not exist @@ -696,9 +761,7 @@ def verify_sub_intf(self, **kwargs): self.assertEqual(output.strip(), "") # All the other tables stay unchanged - self.test_var_json_data(graph_file=graph_file) self.test_minigraph_vlans(graph_file=graph_file) - self.test_minigraph_vlan_members(graph_file=graph_file) self.test_minigraph_vlan_interfaces(graph_file=graph_file) self.test_minigraph_portchannels(graph_file=graph_file) self.test_minigraph_ethernet_interfaces(graph_file=graph_file) @@ -733,6 +796,10 @@ def verify_sub_intf(self, **kwargs): ) ) + # VLAN_MEMBER table should have all tagged members + self.test_var_json_data(graph_file=graph_file, tag_mode='tagged') + self.test_minigraph_vlan_members(graph_file=graph_file, tag_mode='tagged') + finally: print('\n Change device type back to %s' % (TOR_ROUTER)) if check_stderr: @@ -740,7 +807,7 @@ def verify_sub_intf(self, **kwargs): else: output = subprocess.check_output("sed -i \'s/%s/%s/g\' %s" % (BACKEND_TOR_ROUTER, TOR_ROUTER, graph_file), shell=True) - self.test_jinja_expression(graph_file, TOR_ROUTER) + self.test_jinja_expression(graph_file, self.port_config, TOR_ROUTER) def test_show_run_acl(self): argument = '-a \'{"key1":"value"}\' --var-json ACL_RULE' @@ -753,7 +820,7 @@ def test_show_run_interfaces(self): self.assertEqual(output, '') def test_minigraph_voq_metadata(self): - argument = "-m {} --var-json DEVICE_METADATA".format(self.sample_graph_voq) + argument = "-m {} -p {} --var-json DEVICE_METADATA".format(self.sample_graph_voq, self.voq_port_config) output = json.loads(self.run_script(argument)) self.assertEqual(output['localhost']['asic_name'], 'Asic0') self.assertEqual(output['localhost']['switch_id'], '0') @@ -761,7 +828,7 @@ def test_minigraph_voq_metadata(self): self.assertEqual(output['localhost']['max_cores'], '16') def test_minigraph_voq_system_ports(self): - argument = "-m {} --var-json SYSTEM_PORT".format(self.sample_graph_voq) + argument = "-m {} -p {} --var-json SYSTEM_PORT".format(self.sample_graph_voq, self.voq_port_config) self.assertDictEqual( json.loads(self.run_script(argument)), { @@ -780,7 +847,7 @@ def test_minigraph_voq_system_ports(self): ) def test_minigraph_voq_inband_interface_vlan(self): - argument = "-m {} --var-json VOQ_INBAND_INTERFACE".format(self.sample_graph_voq) + argument = "-m {} -p {} --var-json VOQ_INBAND_INTERFACE".format(self.sample_graph_voq, self.voq_port_config) output = self.run_script(argument) output_dict = utils.to_dict(output.strip()) self.assertDictEqual( @@ -793,7 +860,7 @@ def test_minigraph_voq_inband_interface_vlan(self): ) def test_minigraph_voq_inband_interface_port(self): - argument = "-m {} --var-json VOQ_INBAND_INTERFACE".format(self.sample_graph_voq) + argument = "-m {} -p {} --var-json VOQ_INBAND_INTERFACE".format(self.sample_graph_voq, self.voq_port_config) output = self.run_script(argument) output_dict = utils.to_dict(output.strip()) self.assertDictEqual( @@ -817,7 +884,9 @@ def test_minigraph_voq_inband_port(self): 'mtu': '9100', 'tpid': '0x8100', 'pfc_asym': 'off', - 'admin_status': 'up' + 'admin_status': 'up', + 'fec': 'rs', + 'speed': '100000' } ) @@ -831,5 +900,35 @@ def test_minigraph_dhcp(self): "'Vlan2000': {'dhcpv6_servers': ['fc02:2000::3', 'fc02:2000::4']}}" ) ) - - \ No newline at end of file + + def test_minigraph_bgp_packet_chassis_peer(self): + argument = '-m "' + self.packet_chassis_graph + '" -p "' + self.packet_chassis_port_ini + '" -n "' + "asic1" + '" -v "BGP_INTERNAL_NEIGHBOR[\'8.0.0.1\']"' + output = self.run_script(argument) + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict("{'rrclient': 0, 'name': 'str2-8808-lc0-ASIC1', 'local_addr': '8.0.0.3', 'nhopself': 0, 'admin_status': 'up', 'holdtime': '0', 'asn': '65100', 'keepalive': '0'}") + ) + + def test_minigraph_bgp_packet_chassis_static_route(self): + argument = '-m "' + self.packet_chassis_graph + '" -p "' + self.packet_chassis_port_ini + '" -v "STATIC_ROUTE"' + output = self.run_script(argument) + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict("{'8.0.0.1/32': {'nexthop': '192.168.1.2,192.168.2.2', 'ifname': 'PortChannel40,PortChannel50', 'advertise':'false'}}") + ) + + argument = '-m "' + self.packet_chassis_graph + '" -p "' + self.packet_chassis_port_ini + '" -n "' + "asic1" + '" -v "STATIC_ROUTE"' + output = self.run_script(argument) + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict("{'8.0.0.1/32': {'nexthop': '192.168.1.2,192.168.2.2', 'ifname': 'PortChannel40,PortChannel50', 'advertise':'false'}}") + ) + + def test_minigraph_bgp_packet_chassis_vlan_subintf(self): + argument = '-m "' + self.packet_chassis_graph + '" -p "' + self.packet_chassis_port_ini + '" -n "' + "asic1" + '" -v "VLAN_SUB_INTERFACE"' + output = self.run_script(argument) + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict("{('PortChannel32.2', '192.168.1.4/24'): {}, 'PortChannel32.2': {'admin_status': 'up'}, ('PortChannel33.2', '192.168.2.4/24'): {}, 'PortChannel33.2': {'admin_status': 'up'}}") + ) + diff --git a/src/sonic-config-engine/tests/test_cfggen_platformJson.py b/src/sonic-config-engine/tests/test_cfggen_platformJson.py index 3307c3447c0c..0af361718b99 100644 --- a/src/sonic-config-engine/tests/test_cfggen_platformJson.py +++ b/src/sonic-config-engine/tests/test_cfggen_platformJson.py @@ -49,7 +49,7 @@ def test_dummy_run(self): self.assertEqual(output, '') def test_print_data(self): - argument = '-m "' + self.platform_sample_graph + '" --print-data' + argument = '-m "' + self.platform_sample_graph + '" -p "' + self.platform_json + '" --print-data' output = self.run_script(argument) self.assertTrue(len(output.strip()) > 0) @@ -58,9 +58,20 @@ def test_platform_json_interfaces_keys(self): argument = '-m "' + self.platform_sample_graph + '" -p "' + self.platform_json + '" -S "' + self.hwsku_json + '" -v "PORT.keys()|list"' output = self.run_script(argument) self.maxDiff = None - expected = "['Ethernet8', 'Ethernet9', 'Ethernet36', 'Ethernet98', 'Ethernet0', 'Ethernet6', 'Ethernet4', 'Ethernet109', 'Ethernet108', 'Ethernet18', 'Ethernet100', 'Ethernet34', 'Ethernet104', 'Ethernet106', 'Ethernet94', 'Ethernet126', 'Ethernet96', 'Ethernet124', 'Ethernet90', 'Ethernet91', 'Ethernet92', 'Ethernet93', 'Ethernet50', 'Ethernet51', 'Ethernet52', 'Ethernet53', 'Ethernet54', 'Ethernet99', 'Ethernet56', 'Ethernet113', 'Ethernet76', 'Ethernet74', 'Ethernet39', 'Ethernet72', 'Ethernet73', 'Ethernet70', 'Ethernet71', 'Ethernet32', 'Ethernet33', 'Ethernet16', 'Ethernet111', 'Ethernet10', 'Ethernet11', 'Ethernet12', 'Ethernet13', 'Ethernet58', 'Ethernet19', 'Ethernet59', 'Ethernet38', 'Ethernet78', 'Ethernet68', 'Ethernet14', 'Ethernet89', 'Ethernet88', 'Ethernet118', 'Ethernet119', 'Ethernet116', 'Ethernet114', 'Ethernet80', 'Ethernet112', 'Ethernet86', 'Ethernet110', 'Ethernet84', 'Ethernet31', 'Ethernet49', 'Ethernet48', 'Ethernet46', 'Ethernet30', 'Ethernet29', 'Ethernet40', 'Ethernet120', 'Ethernet28', 'Ethernet66', 'Ethernet60', 'Ethernet64', 'Ethernet44', 'Ethernet20', 'Ethernet79', 'Ethernet69', 'Ethernet24', 'Ethernet26']" - self.assertEqual(sorted(output.strip()), sorted(expected)) + expected = [ + 'Ethernet0', 'Ethernet4', 'Ethernet6', 'Ethernet8', 'Ethernet9', 'Ethernet10', 'Ethernet11', 'Ethernet12', 'Ethernet13', 'Ethernet14', 'Ethernet16', + 'Ethernet18', 'Ethernet19', 'Ethernet20', 'Ethernet24', 'Ethernet26', 'Ethernet28', 'Ethernet29', 'Ethernet30', 'Ethernet31', 'Ethernet32', 'Ethernet33', + 'Ethernet34', 'Ethernet36', 'Ethernet38', 'Ethernet39', 'Ethernet40', 'Ethernet44', 'Ethernet46', 'Ethernet48', 'Ethernet49', 'Ethernet50', 'Ethernet51', + 'Ethernet52', 'Ethernet53', 'Ethernet54', 'Ethernet56', 'Ethernet58', 'Ethernet59', 'Ethernet60', 'Ethernet64', 'Ethernet66', 'Ethernet68', 'Ethernet69', + 'Ethernet70', 'Ethernet71', 'Ethernet72', 'Ethernet73', 'Ethernet74', 'Ethernet76', 'Ethernet78', 'Ethernet79', 'Ethernet80', 'Ethernet84', 'Ethernet86', + 'Ethernet88', 'Ethernet89', 'Ethernet90', 'Ethernet91', 'Ethernet92', 'Ethernet93', 'Ethernet94', 'Ethernet96', 'Ethernet98', 'Ethernet99', 'Ethernet100', + 'Ethernet104', 'Ethernet106', 'Ethernet108', 'Ethernet109', 'Ethernet110', 'Ethernet111', 'Ethernet112', 'Ethernet113', 'Ethernet114', 'Ethernet116', + 'Ethernet118', 'Ethernet119', 'Ethernet120', 'Ethernet124', 'Ethernet126', 'Ethernet128', 'Ethernet132', 'Ethernet136', 'Ethernet137', 'Ethernet138', + 'Ethernet139', 'Ethernet140', 'Ethernet141', 'Ethernet142', 'Ethernet144' + ] + + self.assertEqual(sorted(eval(output.strip())), sorted(expected)) # Check specific Interface with it's proper configuration as per platform.json def test_platform_json_specific_ethernet_interfaces(self): @@ -83,6 +94,7 @@ def test_platform_json_specific_ethernet_interfaces(self): expected = "{'index': '2', 'lanes': '4,5', 'description': 'Eth2/1', 'admin_status': 'up', 'mtu': '9100', 'alias': 'Eth2/1', 'pfc_asym': 'off', 'speed': '50000', 'tpid': '0x8100'}" print(output.strip()) self.assertEqual(utils.to_dict(output.strip()), utils.to_dict(expected)) + # Check all Interface with it's proper configuration as per platform.json def test_platform_json_all_ethernet_interfaces(self): argument = '-m "' + self.platform_sample_graph + '" -p "' + self.platform_json + '" -S "' + self.hwsku_json + '" -v "PORT"' diff --git a/src/sonic-config-engine/tests/test_frr.py b/src/sonic-config-engine/tests/test_frr.py index 4998db2d5b25..3934f8c7d70c 100644 --- a/src/sonic-config-engine/tests/test_frr.py +++ b/src/sonic-config-engine/tests/test_frr.py @@ -69,6 +69,4 @@ def test_bgpd_frr(self): def test_zebra_frr(self): self.assertTrue(*self.run_case('zebra/zebra.conf.j2', 'zebra_frr.conf')) - def test_staticd_frr(self): - self.assertTrue(*self.run_case('staticd/staticd.conf.j2', 'staticd_frr.conf')) diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index cb2d7682e7d2..52d4260dba77 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -1,4 +1,3 @@ -import filecmp import json import os import shutil @@ -23,8 +22,11 @@ def setUp(self): self.mlnx_port_config = os.path.join(self.test_dir, 'sample-port-config-mlnx.ini') self.dell6100_t0_minigraph = os.path.join(self.test_dir, 'sample-dell-6100-t0-minigraph.xml') self.arista7050_t0_minigraph = os.path.join(self.test_dir, 'sample-arista-7050-t0-minigraph.xml') + self.arista7800r3_48cq2_lc_t2_minigraph = os.path.join(self.test_dir, 'sample-arista-7800r3-48cq2-lc-t2-minigraph.xml') self.multi_asic_minigraph = os.path.join(self.test_dir, 'multi_npu_data', 'sample-minigraph.xml') self.multi_asic_port_config = os.path.join(self.test_dir, 'multi_npu_data', 'sample_port_config-0.ini') + self.dell9332_t1_minigraph = os.path.join(self.test_dir, 'sample-dell-9332-t1-minigraph.xml') + self.radv_test_minigraph = os.path.join(self.test_dir, 'radv-test-sample-graph.xml') self.output_file = os.path.join(self.test_dir, 'output') os.environ["CFGGEN_UNIT_TESTING"] = "2" @@ -42,32 +44,39 @@ def run_diff(self, file1, file2): def test_interfaces(self): interfaces_template = os.path.join(self.test_dir, '..', '..', '..', 'files', 'image_config', 'interfaces', 'interfaces.j2') - argument = '-m ' + self.t0_minigraph + ' -a \'{\"hwaddr\":\"e4:1d:2d:a5:f3:ad\"}\' -t ' + interfaces_template + ' > ' + self.output_file + argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -a \'{\"hwaddr\":\"e4:1d:2d:a5:f3:ad\"}\' -t ' + interfaces_template + ' > ' + self.output_file self.run_script(argument) - self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'interfaces'), self.output_file)) + self.assertTrue(utils.cmp(os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'interfaces'), self.output_file)) - argument = '-m ' + self.t0_mvrf_minigraph + ' -a \'{\"hwaddr\":\"e4:1d:2d:a5:f3:ad\"}\' -t ' + interfaces_template + ' > ' + self.output_file + argument = '-m ' + self.t0_mvrf_minigraph + ' -p ' + self.t0_port_config + ' -a \'{\"hwaddr\":\"e4:1d:2d:a5:f3:ad\"}\' -t ' + interfaces_template + ' > ' + self.output_file self.run_script(argument) - self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'mvrf_interfaces'), self.output_file)) + self.assertTrue(utils.cmp(os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'mvrf_interfaces'), self.output_file)) def test_ports_json(self): ports_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-orchagent', 'ports.json.j2') argument = '-m ' + self.simple_minigraph + ' -p ' + self.t0_port_config + ' -t ' + ports_template + ' > ' + self.output_file self.run_script(argument) - self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'ports.json'), self.output_file)) + self.assertTrue(utils.cmp(os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'ports.json'), self.output_file)) def test_dhcp_relay(self): # Test generation of wait_for_intf.sh template_path = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-dhcp-relay', 'wait_for_intf.sh.j2') argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + template_path + ' > ' + self.output_file self.run_script(argument) - self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'wait_for_intf.sh'), self.output_file)) + self.assertTrue(utils.cmp(os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'wait_for_intf.sh'), self.output_file)) # Test generation of docker-dhcp-relay.supervisord.conf template_path = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-dhcp-relay', 'docker-dhcp-relay.supervisord.conf.j2') argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -t ' + template_path + ' > ' + self.output_file self.run_script(argument) - self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'docker-dhcp-relay.supervisord.conf'), self.output_file)) + self.assertTrue(utils.cmp(os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'docker-dhcp-relay.supervisord.conf'), self.output_file), self.output_file) + + def test_radv(self): + # Test generation of radvd.conf with multiple ipv6 prefixes + template_path = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-router-advertiser', 'radvd.conf.j2') + argument = '-m ' + self.radv_test_minigraph + ' -p ' + self.t0_port_config + ' -t ' + template_path + ' > ' + self.output_file + self.run_script(argument) + self.assertTrue(utils.cmp(os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'radvd.conf'), self.output_file)) def test_lldp(self): lldpd_conf_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-lldp', 'lldpd.conf.j2') @@ -80,19 +89,19 @@ def test_lldp(self): mgmt_iface_ipv4_and_ipv6_json = os.path.join(self.test_dir, "data", "lldp", "mgmt_iface_ipv4_and_ipv6.json") argument = '-j {} -t {} > {}'.format(mgmt_iface_ipv4_and_ipv6_json, lldpd_conf_template, self.output_file) self.run_script(argument) - self.assertTrue(filecmp.cmp(expected_mgmt_ipv4_and_ipv6, self.output_file)) + self.assertTrue(utils.cmp(expected_mgmt_ipv4_and_ipv6, self.output_file)) # Test generation of lldpd.conf if management interface IPv4 only exist mgmt_iface_ipv4_json = os.path.join(self.test_dir, "data", "lldp", "mgmt_iface_ipv4.json") argument = '-j {} -t {} > {}'.format(mgmt_iface_ipv4_json, lldpd_conf_template, self.output_file) self.run_script(argument) - self.assertTrue(filecmp.cmp(expected_mgmt_ipv4, self.output_file)) + self.assertTrue(utils.cmp(expected_mgmt_ipv4, self.output_file)) # Test generation of lldpd.conf if Management interface IPv6 only exist mgmt_iface_ipv6_json = os.path.join(self.test_dir, "data", "lldp", "mgmt_iface_ipv6.json") argument = '-j {} -t {} > {}'.format(mgmt_iface_ipv6_json, lldpd_conf_template, self.output_file) self.run_script(argument) - self.assertTrue(filecmp.cmp(expected_mgmt_ipv6, self.output_file)) + self.assertTrue(utils.cmp(expected_mgmt_ipv6, self.output_file)) def test_ipinip(self): ipinip_file = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-orchagent', 'ipinip.json.j2') @@ -100,7 +109,7 @@ def test_ipinip(self): self.run_script(argument) sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'ipinip.json') - assert filecmp.cmp(sample_output_file, self.output_file) + assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) def test_l2switch_template(self): argument = '-k Mellanox-SN2700 --preset l2 -p ' + self.t0_port_config @@ -201,8 +210,51 @@ def test_qos_arista7050_render_template(self): os.remove(qos_config_file_new) sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'qos-arista7050.json') - assert filecmp.cmp(sample_output_file, self.output_file) + assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) + + def test_qos_and_buffer_arista7800r3_48cq2_lc_render_template(self): + arista_dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', 'arista', 'x86_64-arista_7800r3_48cq2_lc', 'Arista-7800R3-48CQ2-C48') + qos_file = os.path.join(arista_dir_path, 'qos.json.j2') + buffer_file = os.path.join(arista_dir_path, 'buffers.json.j2') + port_config_ini_file = os.path.join(arista_dir_path, 'port_config.ini') + + # copy qos_config.j2 and buffer_config.j2 to the Arista 7800r3_48cq2_lc directory to have all templates in one directory + qos_config_file = os.path.join(self.test_dir, '..', '..', '..', 'files', 'build_templates', 'qos_config.j2') + shutil.copy2(qos_config_file, arista_dir_path) + buffer_config_file = os.path.join(self.test_dir, '..', '..', '..', 'files', 'build_templates', 'buffers_config.j2') + shutil.copy2(buffer_config_file, arista_dir_path) + + for template_file, cfg_file, sample_output_file in [(qos_file, 'qos_config.j2', 'qos-arista7800r3-48cq2-lc.json'), + (buffer_file, 'buffers_config.j2', 'buffer-arista7800r3-48cq2-lc.json') ]: + argument = '-m ' + self.arista7800r3_48cq2_lc_t2_minigraph + ' -p ' + port_config_ini_file + ' -t ' + template_file + ' > ' + self.output_file + self.run_script(argument) + + # cleanup + cfg_file_new = os.path.join(arista_dir_path, cfg_file) + os.remove(cfg_file_new) + + sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, sample_output_file) + assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) + + def test_qos_dell9332_render_template(self): + dell_dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', 'dell', 'x86_64-dellemc_z9332f_d1508-r0', 'DellEMC-Z9332f-O32') + qos_file = os.path.join(dell_dir_path, 'qos.json.j2') + port_config_ini_file = os.path.join(dell_dir_path, 'port_config.ini') + + # copy qos_config.j2 to the Dell Z9332 directory to have all templates in one directory + qos_config_file = os.path.join(self.test_dir, '..', '..', '..', 'files', 'build_templates', 'qos_config.j2') + shutil.copy2(qos_config_file, dell_dir_path) + + argument = '-m ' + self.dell9332_t1_minigraph + ' -p ' + port_config_ini_file + ' -t ' + qos_file + ' > ' + self.output_file + self.run_script(argument) + # cleanup + qos_config_file_new = os.path.join(dell_dir_path, 'qos_config.j2') + os.remove(qos_config_file_new) + + sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'qos-dell9332.json') + assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) + def test_qos_dell6100_render_template(self): dell_dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', 'dell', 'x86_64-dell_s6100_c2538-r0', 'Force10-S6100') qos_file = os.path.join(dell_dir_path, 'qos.json.j2') @@ -220,26 +272,82 @@ def test_qos_dell6100_render_template(self): os.remove(qos_config_file_new) sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'qos-dell6100.json') - assert filecmp.cmp(sample_output_file, self.output_file) + assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) - def test_buffers_dell6100_render_template(self): - dell_dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', 'dell', 'x86_64-dell_s6100_c2538-r0', 'Force10-S6100') - buffers_file = os.path.join(dell_dir_path, 'buffers.json.j2') - port_config_ini_file = os.path.join(dell_dir_path, 'port_config.ini') + def test_qos_dscp_remapping_render_template(self): + if utils.PYvX_DIR != 'py3': + # Skip on python2 as the change will not be backported to previous version + return + + dir_paths = [ + '../../../device/arista/x86_64-arista_7050cx3_32s/Arista-7050CX3-32S-D48C8', + '../../../device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8', + '../../../device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64' + ] + sample_outputs = [ + 'qos-arista7050cx3-dualtor.json', + 'qos-arista7260-dualtor.json', + 'qos-arista7260-t1.json' + ] + sample_minigraph_files = [ + 'sample-arista-7050cx3-dualtor-minigraph.xml', + 'sample-arista-7260-dualtor-minigraph.xml', + 'sample-arista-7260-t1-minigraph.xml' + ] + for i, path in enumerate(dir_paths): + device_template_path = os.path.join(self.test_dir, path) + sample_output = sample_outputs[i] + sample_minigraph_file = os.path.join(self.test_dir,sample_minigraph_files[i]) + qos_file = os.path.join(device_template_path, 'qos.json.j2') + port_config_ini_file = os.path.join(device_template_path, 'port_config.ini') + test_output = os.path.join(self.test_dir, 'output.json') + + # copy qos_config.j2 to the target directory to have all templates in one directory + qos_config_file = os.path.join(self.test_dir, '..', '..', '..', 'files', 'build_templates', 'qos_config.j2') + shutil.copy2(qos_config_file, device_template_path) + + argument = '-m ' + sample_minigraph_file + ' -p ' + port_config_ini_file + ' -t ' + qos_file + ' > ' + test_output + self.run_script(argument) - # copy buffers_config.j2 to the Dell S6100 directory to have all templates in one directory + # cleanup + qos_config_file_new = os.path.join(device_template_path, 'qos_config.j2') + os.remove(qos_config_file_new) + + sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, sample_output) + assert utils.cmp(sample_output_file, test_output) + os.remove(test_output) + + def _test_buffers_render_template(self, vendor, platform, sku, minigraph, buffer_template, expected): + dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', vendor, platform, sku) + buffers_file = os.path.join(dir_path, buffer_template) + port_config_ini_file = os.path.join(dir_path, 'port_config.ini') + + # copy buffers_config.j2 to the SKU directory to have all templates in one directory buffers_config_file = os.path.join(self.test_dir, '..', '..', '..', 'files', 'build_templates', 'buffers_config.j2') - shutil.copy2(buffers_config_file, dell_dir_path) + shutil.copy2(buffers_config_file, dir_path) - argument = '-m ' + self.dell6100_t0_minigraph + ' -p ' + port_config_ini_file + ' -t ' + buffers_file + ' > ' + self.output_file + minigraph = os.path.join(self.test_dir, minigraph) + argument = '-m ' + minigraph + ' -p ' + port_config_ini_file + ' -t ' + buffers_file + ' > ' + self.output_file self.run_script(argument) # cleanup - buffers_config_file_new = os.path.join(dell_dir_path, 'buffers_config.j2') + buffers_config_file_new = os.path.join(dir_path, 'buffers_config.j2') os.remove(buffers_config_file_new) - sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'buffers-dell6100.json') - assert filecmp.cmp(sample_output_file, self.output_file) + sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, expected) + assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) + + def test_buffers_dell6100_render_template(self): + self._test_buffers_render_template('dell', 'x86_64-dell_s6100_c2538-r0', 'Force10-S6100', 'sample-dell-6100-t0-minigraph.xml', 'buffers.json.j2', 'buffers-dell6100.json') + + def test_buffers_mellanox2700_render_template(self): + self._test_buffers_render_template('mellanox', 'x86_64-mlnx_msn2700-r0', 'Mellanox-SN2700-D48C8', 'sample-mellanox-2700-t0-minigraph.xml', 'buffers.json.j2', 'buffers-mellanox2700.json') + + def test_buffers_mellanox2410_render_template(self): + self._test_buffers_render_template('mellanox', 'x86_64-mlnx_msn2410-r0', 'ACS-MSN2410', 'sample-mellanox-2410-t1-minigraph.xml', 'buffers.json.j2', 'buffers-mellanox2410.json') + + def test_buffers_mellanox2410_dynamic_render_template(self): + self._test_buffers_render_template('mellanox', 'x86_64-mlnx_msn2410-r0', 'ACS-MSN2410', 'sample-mellanox-2410-t1-minigraph.xml', 'buffers_dynamic.json.j2', 'buffers-mellanox2410-dynamic.json') def test_ipinip_multi_asic(self): ipinip_file = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-orchagent', 'ipinip.json.j2') @@ -247,7 +355,7 @@ def test_ipinip_multi_asic(self): print(argument) self.run_script(argument) sample_output_file = os.path.join(self.test_dir, 'multi_npu_data', utils.PYvX_DIR, 'ipinip.json') - assert filecmp.cmp(sample_output_file, self.output_file) + assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) def test_swss_switch_render_template(self): switch_template = os.path.join( @@ -261,22 +369,24 @@ def test_swss_switch_render_template(self): test_list = { "t1": { "graph": self.t1_mlnx_minigraph, + "port_config": self.mlnx_port_config, "output": "t1-switch.json" }, "t0": { "graph": self.t0_minigraph, + "port_config": self.t0_port_config, "output": "t0-switch.json" }, } for _, v in test_list.items(): - argument = " -m {} -y {} -t {} > {}".format( - v["graph"], constants_yml, switch_template, self.output_file + argument = " -m {} -p {} -y {} -t {} > {}".format( + v["graph"], v["port_config"], constants_yml, switch_template, self.output_file ) sample_output_file = os.path.join( self.test_dir, 'sample_output', v["output"] ) self.run_script(argument) - assert filecmp.cmp(sample_output_file, self.output_file) + assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) def test_swss_switch_render_template_multi_asic(self): # verify the ECMP hash seed changes per namespace @@ -308,7 +418,7 @@ def test_swss_switch_render_template_multi_asic(self): self.test_dir, 'sample_output', v["output"] ) self.run_script(argument) - assert filecmp.cmp(sample_output_file, self.output_file) + assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) os.environ["NAMESPACE_ID"] = "" def test_ndppd_conf(self): @@ -318,7 +428,7 @@ def test_ndppd_conf(self): argument = '-j {} -t {} > {}'.format(vlan_interfaces_json, conf_template, self.output_file) self.run_script(argument) - assert filecmp.cmp(expected, self.output_file), self.run_diff(expected, self.output_file) + assert utils.cmp(expected, self.output_file), self.run_diff(expected, self.output_file) def test_ntp_conf(self): conf_template = os.path.join(self.test_dir, "ntp.conf.j2") @@ -327,7 +437,7 @@ def test_ntp_conf(self): argument = '-j {} -t {} > {}'.format(ntp_interfaces_json, conf_template, self.output_file) self.run_script(argument) - assert filecmp.cmp(expected, self.output_file), self.run_diff(expected, self.output_file) + assert utils.cmp(expected, self.output_file), self.run_diff(expected, self.output_file) def tearDown(self): os.environ["CFGGEN_UNIT_TESTING"] = "" diff --git a/src/sonic-config-engine/tests/test_minigraph_case.py b/src/sonic-config-engine/tests/test_minigraph_case.py index 4ebff7f78c6c..d18dd0499dab 100644 --- a/src/sonic-config-engine/tests/test_minigraph_case.py +++ b/src/sonic-config-engine/tests/test_minigraph_case.py @@ -9,6 +9,7 @@ TOR_ROUTER = 'ToRRouter' BACKEND_TOR_ROUTER = 'BackEndToRRouter' +BMC_MGMT_TOR_ROUTER = 'BmcMgmtToRRouter' class TestCfgGenCaseInsensitive(TestCase): @@ -44,27 +45,27 @@ def test_dummy_run(self): self.assertEqual(output, '') def test_minigraph_sku(self): - argument = '-v "DEVICE_METADATA[\'localhost\'][\'hwsku\']" -m "' + self.sample_graph + '"' + argument = '-v "DEVICE_METADATA[\'localhost\'][\'hwsku\']" -m "' + self.sample_graph + '" -p "' + self.port_config + '"' output = self.run_script(argument) self.assertEqual(output.strip(), 'Force10-S6000') def test_print_data(self): - argument = '-m "' + self.sample_graph + '" --print-data' + argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" --print-data' output = self.run_script(argument) self.assertTrue(len(output.strip()) > 0) def test_jinja_expression(self): - argument = '-m "' + self.sample_graph + '" -v "DEVICE_METADATA[\'localhost\'][\'type\']"' + argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "DEVICE_METADATA[\'localhost\'][\'type\']"' output = self.run_script(argument) self.assertEqual(output.strip(), 'ToRRouter') def test_minigraph_subtype(self): - argument = '-m "' + self.sample_graph + '" -v "DEVICE_METADATA[\'localhost\'][\'subtype\']"' + argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "DEVICE_METADATA[\'localhost\'][\'subtype\']"' output = self.run_script(argument) self.assertEqual(output.strip(), 'DualToR') def test_minigraph_peer_switch_hostname(self): - argument = '-m "' + self.sample_graph + '" -v "DEVICE_METADATA[\'localhost\'][\'peer_switch\']"' + argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "DEVICE_METADATA[\'localhost\'][\'peer_switch\']"' output = self.run_script(argument) self.assertEqual(output.strip(), 'switch2-t0') @@ -105,13 +106,11 @@ def test_minigraph_vlans(self): 'dhcpv6_servers': ['fc02:2000::1', 'fc02:2000::2'], 'vlanid': '1000', 'mac': '00:aa:bb:cc:dd:ee', - 'members': ['Ethernet8'] }, 'Vlan2000': { 'alias': 'ab2', 'dhcp_servers': ['192.0.0.1'], 'dhcpv6_servers': ['fc02:2000::3', 'fc02:2000::4'], - 'members': ['Ethernet4'], 'vlanid': '2000' } } @@ -158,7 +157,7 @@ def test_minigraph_portchannels(self): ) def test_minigraph_console_mgmt_feature(self): - argument = '-m "' + self.sample_graph + '" -v CONSOLE_SWITCH' + argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v CONSOLE_SWITCH' output = self.run_script(argument) self.assertEqual( utils.to_dict(output.strip()), @@ -171,6 +170,19 @@ def test_minigraph_console_port(self): utils.to_dict(output.strip()), utils.to_dict("{'1': {'baud_rate': '9600', 'remote_device': 'managed_device', 'flow_control': 1}}")) + def test_minigraph_dhcp_server_feature(self): + argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "DEVICE_METADATA[\'localhost\'][\'dhcp_server\']"' + output = self.run_script(argument) + self.assertEqual(output.strip(), '') + + try: + # For DHCP server enabled device type + output = subprocess.check_output("sed -i \'s/%s/%s/g\' %s" % (TOR_ROUTER, BMC_MGMT_TOR_ROUTER, self.sample_graph), shell=True) + output = self.run_script(argument) + self.assertEqual(output.strip(), 'enabled') + finally: + output = subprocess.check_output("sed -i \'s/%s/%s/g\' %s" % (BMC_MGMT_TOR_ROUTER, TOR_ROUTER, self.sample_graph), shell=True) + def test_minigraph_deployment_id(self): argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "DEVICE_METADATA[\'localhost\'][\'deployment_id\']"' output = self.run_script(argument) diff --git a/src/sonic-config-engine/tests/test_multinpu_cfggen.py b/src/sonic-config-engine/tests/test_multinpu_cfggen.py index 8a79be743848..f39cc9dce1b8 100644 --- a/src/sonic-config-engine/tests/test_multinpu_cfggen.py +++ b/src/sonic-config-engine/tests/test_multinpu_cfggen.py @@ -25,6 +25,7 @@ def setUp(self): self.script_file = utils.PYTHON_INTERPRETTER + ' ' + os.path.join(self.test_dir, '..', 'sonic-cfggen') self.sample_graph = os.path.join(self.test_data_dir, 'sample-minigraph.xml') self.sample_graph1 = os.path.join(self.test_data_dir, 'sample-minigraph-noportchannel.xml') + self.sample_port_config = os.path.join(self.test_data_dir, 'sample_port_config.ini') self.port_config = [] for asic in range(NUM_ASIC): self.port_config.append(os.path.join(self.test_data_dir, "sample_port_config-{}.ini".format(asic))) @@ -80,19 +81,21 @@ def test_dummy_run(self): self.assertEqual(output, '') def test_hwsku(self): - argument = "-v \"DEVICE_METADATA[\'localhost\'][\'hwsku\']\" -m \"{}\"".format(self.sample_graph) + argument = "-v \"DEVICE_METADATA[\'localhost\'][\'hwsku\']\" -m \"{}\" -p \"{}\"".format(self.sample_graph, self.sample_port_config) output = self.run_script(argument) self.assertEqual(output.strip(), SKU) + argument = "-v \"DEVICE_METADATA[\'localhost\'][\'hwsku\']\" -m \"{}\"".format(self.sample_graph) for asic in range(NUM_ASIC): - output = self.run_script_for_asic(argument, asic) + output = self.run_script_for_asic(argument, asic, self.port_config[asic]) self.assertEqual(output.strip(), SKU) def test_print_data(self): - argument = "-m \"{}\" --print-data".format(self.sample_graph) + argument = "-m \"{}\" -p \"{}\" --print-data".format(self.sample_graph, self.sample_port_config) output = self.run_script(argument) self.assertGreater(len(output.strip()) , 0) + argument = "-m \"{}\" --print-data".format(self.sample_graph) for asic in range(NUM_ASIC): - output = self.run_script_for_asic(argument, asic) + output = self.run_script_for_asic(argument, asic, self.port_config[asic]) self.assertGreater(len(output.strip()) , 0) def test_additional_json_data(self): @@ -100,7 +103,7 @@ def test_additional_json_data(self): output = self.run_script(argument) self.assertEqual(output.strip(), 'value1') for asic in range(NUM_ASIC): - output = self.run_script_for_asic(argument, asic) + output = self.run_script_for_asic(argument, asic, self.port_config[asic]) self.assertEqual(output.strip(), 'value1') def test_read_yaml(self): @@ -108,7 +111,7 @@ def test_read_yaml(self): output = yaml.load(self.run_script(argument)) self.assertListEqual(output, ['value1', 'value2']) for asic in range(NUM_ASIC): - output = yaml.load(self.run_script_for_asic(argument, asic)) + output = yaml.load(self.run_script_for_asic(argument, asic, self.port_config[asic])) self.assertListEqual(output, ['value1', 'value2']) def test_render_template(self): @@ -116,32 +119,35 @@ def test_render_template(self): output = self.run_script(argument) self.assertEqual(output.strip(), 'value1\nvalue2') for asic in range(NUM_ASIC): - output = self.run_script_for_asic(argument, asic) + output = self.run_script_for_asic(argument, asic, self.port_config[asic]) self.assertEqual(output.strip(), 'value1\nvalue2') def test_metadata_tacacs(self): - argument = '-m "' + self.sample_graph + '" --var-json "TACPLUS_SERVER"' + argument = '-m "' + self.sample_graph + '" -p "' + self.sample_port_config + '" --var-json "TACPLUS_SERVER"' output = json.loads(self.run_script(argument)) self.assertDictEqual(output, {'123.46.98.21': {'priority': '1', 'tcp_port': '49'}}) #TACPLUS_SERVER not present in the asic configuration. + argument = '-m "' + self.sample_graph + '" --var-json "TACPLUS_SERVER"' for asic in range(NUM_ASIC): output = json.loads(self.run_script_for_asic(argument, asic, self.port_config[asic])) self.assertDictEqual(output, {}) def test_metadata_ntp(self): - argument = '-m "' + self.sample_graph + '" --var-json "NTP_SERVER"' + argument = '-m "' + self.sample_graph + '" -p "' + self.sample_port_config + '" --var-json "NTP_SERVER"' output = json.loads(self.run_script(argument)) self.assertDictEqual(output, {'17.39.1.130': {}, '17.39.1.129': {}}) #NTP data is present only in the host config + argument = '-m "' + self.sample_graph + '" --var-json "NTP_SERVER"' for asic in range(NUM_ASIC): output = json.loads(self.run_script_for_asic(argument, asic, self.port_config[asic])) print("Log:asic{} sku {}".format(asic,output)) self.assertDictEqual(output, {}) def test_mgmt_port(self): - argument = '-m "' + self.sample_graph + '" --var-json "MGMT_PORT"' + argument = '-m "' + self.sample_graph + '" -p "' + self.sample_port_config + '" --var-json "MGMT_PORT"' output = json.loads(self.run_script(argument)) self.assertDictEqual(output, {'eth0': {'alias': 'eth0', 'admin_status': 'up'}}) + argument = '-m "' + self.sample_graph + '" --var-json "MGMT_PORT"' for asic in range(NUM_ASIC): output = json.loads(self.run_script_for_asic(argument, asic, self.port_config[asic])) self.assertDictEqual(output, {'eth0': {'alias': 'eth0', 'admin_status': 'up'}}) @@ -215,17 +221,17 @@ def test_frontend_asic_ports(self): "Ethernet-BP12": { "admin_status": "up", "alias": "Eth7-ASIC0", "asic_port_name": "Eth7-ASIC0", "description": "ASIC3:Eth1-ASIC3", "index": "3", "lanes": "25,26,27,28", "mtu": "9100", "tpid": "0x8100", "pfc_asym": "off", "role": "Int", "speed": "40000" }}) def test_frontend_asic_ports_config_db(self): - argument = "-m {} -n asic0 --var-json \"PORT\"".format(self.sample_graph) + argument = "-m {} -p {} -n asic0 --var-json \"PORT\"".format(self.sample_graph, self.port_config[0]) output = json.loads(self.run_script(argument)) self.assertDictEqual(output, - {"Ethernet0": { "admin_status": "up", "alias": "Ethernet1/1", "asic_port_name": "Eth0-ASIC0", "description": "01T2:Ethernet1:config_db", "index": "0", "lanes": "33,34,35,36", "mtu": "9100", "tpid": "0x8100", "pfc_asym": "off", "role": "Ext", "speed": "40000", "autoneg": "on" }, - "Ethernet4": { "admin_status": "up", "alias": "Ethernet1/2", "asic_port_name": "Eth1-ASIC0", "description": "01T2:Ethernet2:config_db", "index": "1", "lanes": "29,30,31,32", "mtu": "9100", "tpid": "0x8100", "pfc_asym": "off", "role": "Ext", "speed": "40000", "autoneg": "on" }, - "Ethernet8": { "admin_status": "up", "alias": "Ethernet1/3", "asic_port_name": "Eth2-ASIC0", "description": "Ethernet1/3:config_db", "index": "2", "lanes": "41,42,43,44", "mtu": "9100", "tpid": "0x8100", "pfc_asym": "off", "role": "Ext", "speed": "40000" }, - "Ethernet12": { "admin_status": "up", "alias": "Ethernet1/4", "asic_port_name": "Eth3-ASIC0", "description": "Ethernet1/4:config_db", "index": "3", "lanes": "37,38,39,40", "mtu": "9100", "tpid": "0x8100", "pfc_asym": "off", "role": "Ext", "speed": "40000" }, - "Ethernet-BP0": { "admin_status": "up", "alias": "Eth4-ASIC0", "asic_port_name": "Eth4-ASIC0", "description": "ASIC2:Eth0-ASIC2:config_db", "index": "0", "lanes": "13,14,15,16", "mtu": "9100", "tpid": "0x8100", "pfc_asym": "off", "role": "Int", "speed": "40000" }, - "Ethernet-BP4": { "admin_status": "up", "alias": "Eth5-ASIC0", "asic_port_name": "Eth5-ASIC0", "description": "ASIC2:Eth1-ASIC2:config_db", "index": "1", "lanes": "17,18,19,20", "mtu": "9100", "tpid": "0x8100", "pfc_asym": "off", "role": "Int", "speed": "40000" }, - "Ethernet-BP8": { "admin_status": "up", "alias": "Eth6-ASIC0", "asic_port_name": "Eth6-ASIC0", "description": "ASIC3:Eth0-ASIC3:config_db", "index": "2", "lanes": "21,22,23,24", "mtu": "9100", "tpid": "0x8100", "pfc_asym": "off", "role": "Int", "speed": "40000" }, - "Ethernet-BP12": { "admin_status": "up", "alias": "Eth7-ASIC0", "asic_port_name": "Eth7-ASIC0", "description": "ASIC3:Eth1-ASIC3:config_db", "index": "3", "lanes": "25,26,27,28", "mtu": "9100", "tpid": "0x8100", "pfc_asym": "off", "role": "Int", "speed": "40000" }}) + {"Ethernet0": { "admin_status": "up", "alias": "Ethernet1/1", "asic_port_name": "Eth0-ASIC0", "description": "01T2:Ethernet1", "index": "0", "lanes": "33,34,35,36", "mtu": "9100", "tpid": "0x8100", "pfc_asym": "off", "role": "Ext", "speed": "40000", "autoneg": "on" }, + "Ethernet4": { "admin_status": "up", "alias": "Ethernet1/2", "asic_port_name": "Eth1-ASIC0", "description": "01T2:Ethernet2", "index": "1", "lanes": "29,30,31,32", "mtu": "9100", "tpid": "0x8100", "pfc_asym": "off", "role": "Ext", "speed": "40000", "autoneg": "on" }, + "Ethernet8": { "alias": "Ethernet1/3", "asic_port_name": "Eth2-ASIC0", "description": "Ethernet1/3", "index": "2", "lanes": "41,42,43,44", "mtu": "9100", "tpid": "0x8100", "pfc_asym": "off", "role": "Ext", "speed": "40000" }, + "Ethernet12": { "alias": "Ethernet1/4", "asic_port_name": "Eth3-ASIC0", "description": "Ethernet1/4", "index": "3", "lanes": "37,38,39,40", "mtu": "9100", "tpid": "0x8100", "pfc_asym": "off", "role": "Ext", "speed": "40000" }, + "Ethernet-BP0": { "admin_status": "up", "alias": "Eth4-ASIC0", "asic_port_name": "Eth4-ASIC0", "description": "ASIC2:Eth0-ASIC2", "index": "0", "lanes": "13,14,15,16", "mtu": "9100", "tpid": "0x8100", "pfc_asym": "off", "role": "Int", "speed": "40000" }, + "Ethernet-BP4": { "admin_status": "up", "alias": "Eth5-ASIC0", "asic_port_name": "Eth5-ASIC0", "description": "ASIC2:Eth1-ASIC2", "index": "1", "lanes": "17,18,19,20", "mtu": "9100", "tpid": "0x8100", "pfc_asym": "off", "role": "Int", "speed": "40000" }, + "Ethernet-BP8": { "admin_status": "up", "alias": "Eth6-ASIC0", "asic_port_name": "Eth6-ASIC0", "description": "ASIC3:Eth0-ASIC3", "index": "2", "lanes": "21,22,23,24", "mtu": "9100", "tpid": "0x8100", "pfc_asym": "off", "role": "Int", "speed": "40000" }, + "Ethernet-BP12": { "admin_status": "up", "alias": "Eth7-ASIC0", "asic_port_name": "Eth7-ASIC0", "description": "ASIC3:Eth1-ASIC3", "index": "3", "lanes": "25,26,27,28", "mtu": "9100", "tpid": "0x8100", "pfc_asym": "off", "role": "Int", "speed": "40000" }}) def test_frontend_asic_device_neigh(self): argument = "-m {} -p {} -n asic0 --var-json \"DEVICE_NEIGHBOR\"".format(self.sample_graph, self.port_config[0]) @@ -270,7 +276,7 @@ def test_frontend_bgp_neighbor(self): 'fc00::2': {'rrclient': 0, 'name': '01T2', 'local_addr': 'fc00::1', 'nhopself': 0, 'holdtime': '10', 'asn': '65200', 'keepalive': '3'}}) def test_frontend_asic_bgp_neighbor(self): - argument = "-m {} -p {} -n asic0 --var-json \"BGP_INTERNAL_NEIGHBOR\"".format(self.sample_graph, self.port_config[3]) + argument = "-m {} -p {} -n asic0 --var-json \"BGP_INTERNAL_NEIGHBOR\"".format(self.sample_graph, self.port_config[0]) output = json.loads(self.run_script(argument)) self.assertDictEqual(output, \ {'10.1.0.0': {'rrclient': 0, 'name': 'ASIC2', 'local_addr': '10.1.0.1', 'nhopself': 0, 'admin_status': 'up', 'holdtime': '0', 'asn': '65100', 'keepalive': '0'}, @@ -297,23 +303,38 @@ def test_device_asic_metadata(self): self.assertEqual(output['localhost']['sub_role'], 'BackEnd') def test_global_asic_acl(self): - argument = "-m {} --var-json \"ACL_TABLE\"".format(self.sample_graph) + argument = "-m {} -p {} --var-json \"ACL_TABLE\"".format(self.sample_graph, self.sample_port_config) output = json.loads(self.run_script(argument)) - self.assertDictEqual(output, {\ - 'DATAACL': {'policy_desc': 'DATAACL', 'ports': ['PortChannel0002','PortChannel0008'], 'stage': 'ingress', 'type': 'L3'}, - 'EVERFLOW': {'policy_desc': 'EVERFLOW', 'ports': ['PortChannel0002','PortChannel0008'], 'stage': 'ingress', 'type': 'MIRROR'}, - 'EVERFLOWV6':{'policy_desc': 'EVERFLOWV6', 'ports': ['PortChannel0002','PortChannel0008'], 'stage': 'ingress', 'type': 'MIRRORV6'}, - 'SNMP_ACL': {'policy_desc': 'SNMP_ACL', 'services': ['SNMP'], 'stage': 'ingress', 'type': 'CTRLPLANE'}, - 'SSH_ONLY': {'policy_desc': 'SSH_ONLY', 'services': ['SSH'], 'stage': 'ingress', 'type': 'CTRLPLANE'}}) + exp = {\ + 'SNMP_ACL': {'policy_desc': 'SNMP_ACL', 'type': 'CTRLPLANE', 'stage': 'ingress', 'services': ['SNMP']}, + 'EVERFLOW': {'policy_desc': 'EVERFLOW', 'stage': 'ingress', 'ports': ['PortChannel0002', 'PortChannel0008', 'Ethernet8', 'Ethernet12', 'Ethernet24', 'Ethernet28'], 'type': 'MIRROR'}, + 'EVERFLOWV6': {'policy_desc': 'EVERFLOWV6', 'stage': 'ingress', 'ports': ['PortChannel0002', 'PortChannel0008', 'Ethernet8', 'Ethernet12', 'Ethernet24', 'Ethernet28'], 'type': 'MIRRORV6'}, + 'SSH_ONLY': {'policy_desc': 'SSH_ONLY', 'type': 'CTRLPLANE', 'stage': 'ingress', 'services': ['SSH']}, + 'DATAACL': {'policy_desc': 'DATAACL', 'stage': 'ingress', 'ports': ['PortChannel0002', 'PortChannel0008'], 'type': 'L3'}} + for k, v in output.items(): + if 'ports' in v: + v['ports'].sort() + for k, v in exp.items(): + if 'ports' in v: + v['ports'].sort() + self.assertDictEqual(output, exp) + def test_global_asic_acl1(self): - argument = "-m {} --var-json \"ACL_TABLE\"".format(self.sample_graph1) + argument = "-m {} -p {} --var-json \"ACL_TABLE\"".format(self.sample_graph1, self.sample_port_config) + self.maxDiff = None output = json.loads(self.run_script(argument)) - self.assertDictEqual(output, {\ - 'EVERFLOW': {'policy_desc': 'EVERFLOW', 'ports': [], 'stage': 'ingress', 'type': 'MIRROR'}, - 'EVERFLOWV6':{'policy_desc': 'EVERFLOWV6', 'ports': [], 'stage': 'ingress', 'type': 'MIRRORV6'}, - 'SNMP_ACL': {'policy_desc': 'SNMP_ACL', 'services': ['SNMP'], 'stage': 'ingress', 'type': 'CTRLPLANE'}, - 'SSH_ONLY': {'policy_desc': 'SSH_ONLY', 'services': ['SSH'], 'stage': 'ingress', 'type': 'CTRLPLANE'}}) - + exp = {\ + 'SNMP_ACL': {'policy_desc': 'SNMP_ACL', 'type': 'CTRLPLANE', 'stage': 'ingress', 'services': ['SNMP']}, + 'EVERFLOW': {'policy_desc': 'EVERFLOW', 'stage': 'ingress', 'ports': ['Ethernet0', 'Ethernet4', 'Ethernet8', 'Ethernet12', 'Ethernet16', 'Ethernet20', 'Ethernet24', 'Ethernet28'], 'type': 'MIRROR'}, + 'EVERFLOWV6': {'policy_desc': 'EVERFLOWV6', 'stage': 'ingress', 'ports': ['Ethernet0', 'Ethernet4', 'Ethernet8', 'Ethernet12', 'Ethernet16', 'Ethernet20', 'Ethernet24', 'Ethernet28'], 'type': 'MIRRORV6'}, + 'SSH_ONLY': {'policy_desc': 'SSH_ONLY', 'type': 'CTRLPLANE', 'stage': 'ingress', 'services': ['SSH']}} + for k, v in output.items(): + if 'ports' in v: + v['ports'].sort() + for k, v in exp.items(): + if 'ports' in v: + v['ports'].sort() + self.assertDictEqual(output, exp) def test_front_end_asic_acl(self): argument = "-m {} -p {} -n asic0 --var-json \"ACL_TABLE\"".format(self.sample_graph, self.port_config[0]) @@ -347,7 +368,7 @@ def test_back_end_asic_acl1(self): def test_loopback_intfs(self): - argument = "-m {} --var-json \"LOOPBACK_INTERFACE\"".format(self.sample_graph) + argument = "-m {} -p {} --var-json \"LOOPBACK_INTERFACE\"".format(self.sample_graph, self.sample_port_config) output = json.loads(self.run_script(argument)) self.assertDictEqual(output, {\ "Loopback0": {}, @@ -355,7 +376,7 @@ def test_loopback_intfs(self): "Loopback0|FC00:1::32/128": {}}) # The asic configuration should have 2 loopback interfaces - argument = "-m {} -n asic0 --var-json \"LOOPBACK_INTERFACE\"".format(self.sample_graph) + argument = "-m {} -p {} -n asic0 --var-json \"LOOPBACK_INTERFACE\"".format(self.sample_graph, self.port_config[0]) output = json.loads(self.run_script(argument)) self.assertDictEqual(output, { \ "Loopback0": {}, @@ -365,7 +386,7 @@ def test_loopback_intfs(self): "Loopback4096|8.0.0.0/32": {}, "Loopback4096|FD00:1::32/128": {}}) - argument = "-m {} -n asic3 --var-json \"LOOPBACK_INTERFACE\"".format(self.sample_graph) + argument = "-m {} -p {} -n asic3 --var-json \"LOOPBACK_INTERFACE\"".format(self.sample_graph, self.port_config[3]) output = json.loads(self.run_script(argument)) self.assertDictEqual(output, {\ "Loopback0": {}, diff --git a/src/sonic-ctrmgrd/ctrmgr/container b/src/sonic-ctrmgrd/ctrmgr/container index 666c967540a7..db6ded635ee9 100755 --- a/src/sonic-ctrmgrd/ctrmgr/container +++ b/src/sonic-ctrmgrd/ctrmgr/container @@ -26,6 +26,7 @@ CONTAINER_ID = "container_id" REMOTE_STATE = "remote_state" VERSION = "container_version" SYSTEM_STATE = "system_state" +STATE = "state" KUBE_LABEL_TABLE = "KUBE_LABELS" KUBE_LABEL_SET_KEY = "SET" @@ -38,6 +39,9 @@ SONIC_CTR_CONFIG_PEND_SECS = "revert_to_local_on_wait_seconds" DEFAULT_PEND_SECS = ( 5 * 60 ) WAIT_POLL_SECS = 2 +SUCCESS = 0 +FAILURE = -1 + remote_ctr_enabled = False def debug_msg(m): @@ -87,10 +91,10 @@ def read_data(is_config, feature, fields): def read_config(feature): """ Read requried feature config """ - set_owner, no_fallback = read_data(True, feature, - [(SET_OWNER, "local"), (NO_FALLBACK, False)]) + set_owner, no_fallback, state = read_data(True, feature, + [(SET_OWNER, "local"), (NO_FALLBACK, False), (STATE, "disabled")]) - return (set_owner, not no_fallback) + return (set_owner, not no_fallback, state) def read_state(feature): @@ -107,12 +111,12 @@ def docker_action(action, feature, **kwargs): container = client.containers.get(feature) getattr(container, action)(**kwargs) syslog.syslog(syslog.LOG_INFO, "docker cmd: {} for {}".format(action, feature)) - return 0 + return SUCCESS except (docker.errors.NotFound, docker.errors.APIError) as err: syslog.syslog(syslog.LOG_ERR, "docker cmd: {} for {} failed with {}". format(action, feature, str(err))) - return -1 + return FAILURE def set_label(feature, create): @@ -186,7 +190,7 @@ def container_start(feature, **kwargs): init() - set_owner, fallback = read_config(feature) + set_owner, fallback, _ = read_config(feature) _, remote_state, _ = read_state(feature) debug_msg("{}: set_owner:{} fallback:{} remote_state:{}".format( @@ -244,8 +248,8 @@ def container_stop(feature, **kwargs): debug_msg("BEGIN") init() - - set_owner, _ = read_config(feature) + ret = SUCCESS + set_owner, _ , _ = read_config(feature) current_owner, remote_state, _ = read_state(feature) docker_id = container_id(feature) remove_label = (remote_state != "pending") or (set_owner == "local") @@ -257,7 +261,7 @@ def container_stop(feature, **kwargs): set_label(feature, False) if docker_id: - docker_action("stop", docker_id, **kwargs) + ret = docker_action("stop", docker_id, **kwargs) else: syslog.syslog( syslog.LOG_ERR if current_owner != "none" else syslog.LOG_INFO, @@ -286,6 +290,7 @@ def container_stop(feature, **kwargs): update_data(feature, data) debug_msg("END") + return ret def container_kill(feature, **kwargs): @@ -301,19 +306,25 @@ def container_kill(feature, **kwargs): init() - set_owner, _ = read_config(feature) + ret = SUCCESS + set_owner, _ , state = read_config(feature) current_owner, remote_state, _ = read_state(feature) docker_id = container_id(feature) remove_label = (set_owner != "local") or (current_owner != "local") - debug_msg("{}: set_owner:{} current_owner:{} remote_state:{} docker_id:{}".format( - feature, set_owner, current_owner, remote_state, docker_id)) + debug_msg("{}: set_owner:{} current_owner:{} remote_state:{} docker_id:{} state:{}".format( + feature, set_owner, current_owner, remote_state, docker_id, state)) if remove_label: set_label(feature, False) + if set_owner == "local": + if state not in ["enabled", "always_enabled"]: + debug_msg("{} is not enabled".format(feature)) + return FAILURE + if docker_id: - docker_action("kill", docker_id, **kwargs) + ret = docker_action("kill", docker_id, **kwargs) else: syslog.syslog( @@ -322,6 +333,7 @@ def container_kill(feature, **kwargs): debug_msg("END") + return ret def container_wait(feature, **kwargs): @@ -341,10 +353,11 @@ def container_wait(feature, **kwargs): init() - set_owner, fallback = read_config(feature) + set_owner, fallback, _ = read_config(feature) current_owner, remote_state, _ = read_state(feature) docker_id = container_id(feature) pend_wait_secs = 0 + ret = SUCCESS if not docker_id and fallback: pend_wait_secs = get_config_data( @@ -377,8 +390,9 @@ def container_wait(feature, **kwargs): format(feature)) else: debug_msg("END -- transitioning to docker wait") - docker_action("wait", docker_id, **kwargs) + ret = docker_action("wait", docker_id, **kwargs) + return ret def main(): parser=argparse.ArgumentParser(description="container commands for start/stop/wait/kill/id") @@ -389,24 +403,26 @@ def main(): args = parser.parse_args() kwargs = {} + ret = 0 if args.action == "start": - container_start(args.name, **kwargs) + ret = container_start(args.name, **kwargs) elif args.action == "stop": if args.timeout is not None: kwargs['timeout'] = args.timeout - container_stop(args.name, **kwargs) + ret = container_stop(args.name, **kwargs) elif args.action == "kill": - container_kill(args.name, **kwargs) + ret = container_kill(args.name, **kwargs) elif args.action == "wait": - container_wait(args.name, **kwargs) + ret = container_wait(args.name, **kwargs) elif args.action == "id": id = container_id(args.name, **kwargs) print(id) + return ret if __name__ == "__main__": main() diff --git a/src/sonic-ctrmgrd/tests/container_test.py b/src/sonic-ctrmgrd/tests/container_test.py index cc5f89e8d97f..4738597c72c4 100755 --- a/src/sonic-ctrmgrd/tests/container_test.py +++ b/src/sonic-ctrmgrd/tests/container_test.py @@ -269,7 +269,8 @@ common_test.CONFIG_DB_NO: { common_test.FEATURE_TABLE: { "snmp": { - "set_owner": "local" + "set_owner": "local", + "state": "enabled" } } }, @@ -348,6 +349,30 @@ } } +# container_kill test cases +# test case 0 -- container kill local disabled container +# -- no change in state-db +# -- no label update +# +invalid_kill_test_data = { + 0: { + common_test.DESCR: "container kill for local disabled container", + common_test.PRE: { + common_test.CONFIG_DB_NO: { + common_test.FEATURE_TABLE: { + "sflow": { + "set_owner": "local" + } + } + } + }, + common_test.POST: { + }, + common_test.ACTIONS: { + } + } +} + # container_wait test cases # test case 0 -- container wait local @@ -498,6 +523,24 @@ def test_kill(self, mock_docker, mock_table, mock_conn): ret = common_test.check_mock_containers() assert ret == 0 + @patch("container.swsscommon.DBConnector") + @patch("container.swsscommon.Table") + @patch("container.docker.from_env") + def test_invalid_kill(self, mock_docker, mock_table, mock_conn): + self.init() + common_test.set_mock(mock_table, mock_conn, mock_docker) + + for (i, ct_data) in invalid_kill_test_data.items(): + common_test.do_start_test("container_test:container_kill", i, ct_data) + + ret = container.container_kill("sflow") + assert ret != 0 + + ret = common_test.check_tables_returned() + assert ret == 0 + + ret = common_test.check_mock_containers() + assert ret == 0 @patch("container.swsscommon.DBConnector") @patch("container.swsscommon.Table") diff --git a/src/sonic-device-data/src/Makefile b/src/sonic-device-data/src/Makefile index 5ecefbf37960..c6e05b5a8f4a 100644 --- a/src/sonic-device-data/src/Makefile +++ b/src/sonic-device-data/src/Makefile @@ -17,4 +17,5 @@ test: for f in $$(find ../../../device -name hwsku.json); do ./hwsku_json_checker $$f done + ./platform_asic_checker ../../../platform ../../../device popd diff --git a/src/sonic-device-data/tests/permitted_list b/src/sonic-device-data/tests/permitted_list index d7b095424a7e..c1f70dc7be65 100644 --- a/src/sonic-device-data/tests/permitted_list +++ b/src/sonic-device-data/tests/permitted_list @@ -297,7 +297,18 @@ lb_port_pipe1_int ing_origin_id_device_id_mask egr_origin_id_device_id_mask port_count_in_pb_stream +cancun_dir +pcie_file +capi_level +phy_pin_compatibility_enable +cfg_int_phy_ctrl +stand_alone_phy_init +sap_rx_polarity_flip +sap_tx_polarity_flip +sap_mdio_num +dport_map_port_9 ifa_enable port_gmii_mode phy_force_firmware_load -phy_pcs_repeater \ No newline at end of file +phy_pcs_repeater +l3_alpm_hit_skip diff --git a/src/sonic-device-data/tests/platform_asic_checker b/src/sonic-device-data/tests/platform_asic_checker new file mode 100755 index 000000000000..a2b10b415c62 --- /dev/null +++ b/src/sonic-device-data/tests/platform_asic_checker @@ -0,0 +1,70 @@ +#!/usr/bin/env python3 +# For any valid platform folder (which must includes a default_sku file), check there is a valid platform_asic file + +import fnmatch +import os +import sys +import argparse + +def check_file(platform_asic_file, platforms): + try: + with open(platform_asic_file, "r") as f: + for line in f.readlines(): + line = line.rstrip() + if line not in platforms: + return False + except IOError: + return False + return True + + +def main(argv): + parser = argparse.ArgumentParser(description='') + parser.add_argument('platform_folder', type=str, + help='an integer for the accumulator') + parser.add_argument('device_folder', type=str, + help='sum the integers (default: find the max)') + + args = parser.parse_args() + + # Load all the valid platforms as strings + platforms = set() + it = os.scandir(args.platform_folder) + try: + for entry in it: + p = entry.path + if entry.is_dir() and os.path.isfile(os.path.join(p, 'rules.mk')): + platforms.add(entry.name) + finally: + # os.scandir().close() is only available in python 3.6 and later + if callable(getattr(it, "close", None)): + it.close() + # dnx platform is special broadcom platform, add it manually + platforms.add('broadcom-dnx') + + device_folder = os.path.normpath(args.device_folder) + base_level = len(device_folder.split(os.sep)) + all_good = True + for dirpath, _, filenames in os.walk(args.device_folder, followlinks=True): + # The platform folder is like device_folder/vendor/platform + if len(dirpath.split(os.sep)) != base_level + 2: + continue + # If none of below files found, this is not the root of a platform folder + if not ({'default_sku', 'installer.conf', 'led_proc_init.soc', 'asic.conf'} & set(filenames)): + continue + + platform_asic_file = os.path.join(dirpath, 'platform_asic') + good = check_file(platform_asic_file, platforms) + if good: + print("File " + platform_asic_file + " passed validity check") + else: + print("File " + platform_asic_file + " failed validity check") + + all_good = all_good and good + + if not all_good: + sys.exit(-1) + + +if __name__ == "__main__": + main(sys.argv[1:]) diff --git a/src/sonic-device-data/tests/platform_json_checker b/src/sonic-device-data/tests/platform_json_checker index 5385295ef520..7b92936b972f 100755 --- a/src/sonic-device-data/tests/platform_json_checker +++ b/src/sonic-device-data/tests/platform_json_checker @@ -11,6 +11,7 @@ ATTR_LEN = len(PORT_ATTRIBUTES) PORT_REG = "Ethernet(\d+)" PLATFORM_JSON = '*platform.json' INTF_KEY = "interfaces" +CHASSIS_KEY = "chassis" def usage(): @@ -18,6 +19,73 @@ def usage(): sys.exit(1) +def check_chassis_dict(chassis_dict): + + def check_schema(schema, data): + is_valid = True + if isinstance(schema, dict): + if not isinstance(data, dict): + print("Invalid data type {} for {}. Expected dict".format(type(data), data)) + return False + + for key, data_type in schema.items(): + if key not in data: + continue + + is_valid = check_schema(data_type, data[key]) + if not is_valid: + break + elif isinstance(schema, list): + if not isinstance(data, list): + print("Invalid data type {} for {}. Expected list".format(type(data), data)) + return False + + for ele in data: + is_valid = check_schema(schema[0], ele) + if not is_valid: + break + else: + if not isinstance(data, schema): + print("Invalid data type {} for {}. Expected {}".format(type(data), data, type(schema()))) + return False + + return is_valid + + common_schema = {"name": str} + controllable_schema = {"controllable": bool} + fan_speed_schema = {"maximum": int, "minimum": int} + fan_speed_schema.update(controllable_schema) + + status_led_schema = {"colors": [str]} + status_led_schema.update(controllable_schema) + + component_schema = common_schema.copy() + + fan_schema = {"speed": fan_speed_schema, "status_led": status_led_schema} + fan_schema.update(common_schema) + + fandrawer_schema = {"fans": [fan_schema], "status_led": status_led_schema} + fandrawer_schema.update(common_schema) + + psu_schema = {"fans": [fan_schema], "status_led": status_led_schema} + psu_schema.update(common_schema) + + sfp_schema = common_schema.copy() + + thermal_schema = common_schema.copy() + thermal_schema.update(controllable_schema) + + module_schema = {"components": [component_schema], "fans": [fan_schema], + "fandrawers": [fandrawer_schema], "psus": [psu_schema], + "sfps": [sfp_schema], "thermals": [thermal_schema]} + module_schema.update(common_schema) + + chassis_schema = {"modules": [module_schema], "status_led": status_led_schema} + chassis_schema.update(module_schema) + + return check_schema(chassis_schema, chassis_dict) + + def check_port_attr(port_attr): for each_key in port_attr: if each_key not in PORT_ATTRIBUTES: @@ -44,17 +112,23 @@ def check_file(platform_json_file): try: platform_cap_file = open(platform_json_file,"r") platform_file_data = platform_cap_file.read() - port_dict = json.loads(platform_file_data) + platform_dict = json.loads(platform_file_data) + chassis_dict = platform_dict.get(CHASSIS_KEY) + port_dict = platform_dict[INTF_KEY] + + if chassis_dict: + if not check_chassis_dict(chassis_dict): + return False - for each_port in port_dict[INTF_KEY]: + for each_port in port_dict: # Validate port at top level port_id = re.search(PORT_REG, each_port) if port_id is None: print("Error: Unknown Interface " + str(each_port) + " at top level") return False - total_attr = len(list(port_dict[INTF_KEY][each_port].keys())) - port_attr = port_dict[INTF_KEY][each_port] + total_attr = len(list(port_dict[each_port].keys())) + port_attr = port_dict[each_port] if total_attr != ATTR_LEN: missing_attr = ', '.join(set(PORT_ATTRIBUTES).difference(list(port_attr))) diff --git a/src/sonic-frr-mgmt-framework/frrcfgd/frrcfgd.py b/src/sonic-frr-mgmt-framework/frrcfgd/frrcfgd.py index e3b8c3f264c8..f189789914ed 100755 --- a/src/sonic-frr-mgmt-framework/frrcfgd/frrcfgd.py +++ b/src/sonic-frr-mgmt-framework/frrcfgd/frrcfgd.py @@ -1636,7 +1636,9 @@ def __init__(self, af_id, blackhole, dst_ip, track, if_name, tag, dist, vrf): self.interface = '' if if_name is None else if_name self.tag = 0 if tag is None else int(tag) self.nh_vrf = '' if vrf is None else vrf - if self.blackhole != 'true' and self.is_zero_ip() and len(self.interface.strip()) == 0: + if not self.is_portchannel(): + self.is_ip_valid() + if self.blackhole != 'true' and self.is_zero_ip() and not self.is_portchannel() and len(self.interface.strip()) == 0: syslog.syslog(syslog.LOG_ERR, 'Mandatory attribute not found for nexthop') raise ValueError def __eq__(self, other): @@ -1652,8 +1654,15 @@ def __hash__(self): def __str__(self): return 'AF %d BKH %s IP %s TRACK %d INTF %s TAG %d DIST %d VRF %s' % ( self.af, self.blackhole, self.ip, self.track, self.interface, self.tag, self.distance, self.nh_vrf) + def is_ip_valid(self): + socket.inet_pton(self.af, self.ip) def is_zero_ip(self): - return sum([x for x in socket.inet_pton(self.af, self.ip)]) == 0 + try: + return sum([x for x in socket.inet_pton(self.af, self.ip)]) == 0 + except socket.error: + return False + def is_portchannel(self): + return True if self.ip.startswith('PortChannel') else False def get_arg_list(self): arg = lambda x: '' if x is None else x num_arg = lambda x: '' if x is None or x == 0 else str(x) diff --git a/src/sonic-frr/patch/0010-remove-doc-png-install.patch b/src/sonic-frr/patch/0010-remove-doc-png-install.patch new file mode 100644 index 000000000000..c911d43eaa29 --- /dev/null +++ b/src/sonic-frr/patch/0010-remove-doc-png-install.patch @@ -0,0 +1,21 @@ +Remove the *.png file installation from the frr-doc package. It doesn't look +like it's installed there with Bullseye's tools. + +From: Saikrishna Arcot + +--- + debian/frr-doc.install | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/debian/frr-doc.install b/debian/frr-doc.install +index c48dc5a8d..955c8fc5a 100644 +--- a/debian/frr-doc.install ++++ b/debian/frr-doc.install +@@ -3,7 +3,6 @@ usr/share/doc/frr/html + + # info + images referenced by it + usr/share/info/ +-doc/user/_build/texinfo/*.png usr/share/info + + # other + README.md usr/share/doc/frr diff --git a/src/sonic-frr/patch/0011-Ipv4-Link-local-address-for-Ipv6-linl-local-nexthop.patch b/src/sonic-frr/patch/0011-Ipv4-Link-local-address-for-Ipv6-linl-local-nexthop.patch new file mode 100644 index 000000000000..7a041c02fe15 --- /dev/null +++ b/src/sonic-frr/patch/0011-Ipv4-Link-local-address-for-Ipv6-linl-local-nexthop.patch @@ -0,0 +1,55 @@ +diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c +index 7b0611bf9..b5582ea35 100644 +--- a/zebra/zebra_fpm.c ++++ b/zebra/zebra_fpm.c +@@ -288,6 +288,9 @@ static void zfpm_start_connect_timer(const char *reason); + static void zfpm_start_stats_timer(void); + static void zfpm_mac_info_del(struct fpm_mac_info_t *fpm_mac); + ++static const char ipv4_ll_buf[16] = "169.254.0.1"; ++union g_addr ipv4ll_gateway; ++ + /* + * zfpm_thread_should_yield + */ +@@ -1988,6 +1991,9 @@ static int zfpm_init(struct thread_master *master) + zfpm_stats_init(&zfpm_g->last_ivl_stats); + zfpm_stats_init(&zfpm_g->cumulative_stats); + ++ memset(&ipv4ll_gateway, 0, sizeof(ipv4ll_gateway)); ++ inet_pton(AF_INET, ipv4_ll_buf, &ipv4ll_gateway.ipv4); ++ + install_node(&zebra_node); + install_element(ENABLE_NODE, &show_zebra_fpm_stats_cmd); + install_element(ENABLE_NODE, &clear_zebra_fpm_stats_cmd); +diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c +index 60ea7f97e..0f8ba5413 100644 +--- a/zebra/zebra_fpm_netlink.c ++++ b/zebra/zebra_fpm_netlink.c +@@ -221,7 +221,12 @@ static int netlink_route_info_add_nh(struct netlink_route_info *ri, + + if (nexthop->type == NEXTHOP_TYPE_IPV6 + || nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX) { +- nhi.gateway = &nexthop->gate; ++ /* Special handling for IPv4 route with IPv6 Link Local next hop ++ */ ++ if (ri->af == AF_INET) ++ nhi.gateway = &ipv4ll_gateway; ++ else ++ nhi.gateway = &nexthop->gate; + } + + if (nexthop->type == NEXTHOP_TYPE_IFINDEX) { +diff --git a/zebra/zebra_fpm_private.h b/zebra/zebra_fpm_private.h +index c169ee8c2..13415c7e1 100644 +--- a/zebra/zebra_fpm_private.h ++++ b/zebra/zebra_fpm_private.h +@@ -97,6 +97,8 @@ extern int zfpm_netlink_encode_mac(struct fpm_mac_info_t *mac, char *in_buf, + + extern struct route_entry *zfpm_route_for_update(rib_dest_t *dest); + ++extern union g_addr ipv4ll_gateway; ++ + #ifdef __cplusplus + } + #endif diff --git a/src/sonic-frr/patch/series b/src/sonic-frr/patch/series index 2837a79f249a..b77931d57e9a 100644 --- a/src/sonic-frr/patch/series +++ b/src/sonic-frr/patch/series @@ -7,3 +7,5 @@ 0008-Add-support-of-bgp-l3vni-evpn.patch 0009-Add-bgp-bestpath-peer-type-multipath-relax.patch 0009-Link-local-scope-was-not-set-while-binding-socket-for-bgp-ipv6-link-local-neighbors.patch +0010-remove-doc-png-install.patch +0011-Ipv4-Link-local-address-for-Ipv6-linl-local-nexthop.patch diff --git a/src/sonic-host-services-data/debian/sonic-host-services-data.aaastatsd.timer b/src/sonic-host-services-data/debian/sonic-host-services-data.aaastatsd.timer index e0458ff326f5..8b6426db18da 100644 --- a/src/sonic-host-services-data/debian/sonic-host-services-data.aaastatsd.timer +++ b/src/sonic-host-services-data/debian/sonic-host-services-data.aaastatsd.timer @@ -3,7 +3,8 @@ Description=Delays aaastatsd daemon until SONiC has started PartOf=aaastatsd.service [Timer] -OnActiveSec=1min 30 sec +OnUnitActiveSec=0 sec +OnBootSec=1min 30 sec Unit=aaastatsd.service [Install] diff --git a/src/sonic-host-services-data/debian/sonic-host-services-data.determine-reboot-cause.service b/src/sonic-host-services-data/debian/sonic-host-services-data.determine-reboot-cause.service index a6c58d4c9818..f0d9e91fe991 100644 --- a/src/sonic-host-services-data/debian/sonic-host-services-data.determine-reboot-cause.service +++ b/src/sonic-host-services-data/debian/sonic-host-services-data.determine-reboot-cause.service @@ -1,7 +1,7 @@ [Unit] Description=Reboot cause determination service -Requires=rc-local.service -After=rc-local.service +Requires=rc-local.service database.service +After=rc-local.service database.service [Service] Type=simple diff --git a/src/sonic-host-services-data/debian/sonic-host-services-data.hostcfgd.timer b/src/sonic-host-services-data/debian/sonic-host-services-data.hostcfgd.timer index baf80f4b4cbd..b45fd4b22f04 100644 --- a/src/sonic-host-services-data/debian/sonic-host-services-data.hostcfgd.timer +++ b/src/sonic-host-services-data/debian/sonic-host-services-data.hostcfgd.timer @@ -3,7 +3,8 @@ Description=Delays hostcfgd daemon until SONiC has started PartOf=hostcfgd.service [Timer] -OnActiveSec=1min 30 sec +OnUnitActiveSec=0 sec +OnBootSec=1min 30 sec Unit=hostcfgd.service [Install] diff --git a/src/sonic-host-services-data/templates/limits.conf.j2 b/src/sonic-host-services-data/templates/limits.conf.j2 new file mode 100755 index 000000000000..41b37221e41e --- /dev/null +++ b/src/sonic-host-services-data/templates/limits.conf.j2 @@ -0,0 +1,69 @@ +# /etc/security/limits.conf +# +# This file generate by j2 template file: src/sonic-host-services-data/templates/limits.conf.j2 +# +# Each line describes a limit for a user in the form: +# +# +# +# Where: +# can be: +# - a user name +# - a group name, with @group syntax +# - the wildcard *, for default entry +# - the wildcard %, can be also used with %group syntax, +# for maxlogin limit +# - NOTE: group and wildcard limits are not applied to root. +# To apply a limit to the root user, must be +# the literal username root. +# +# can have the two values: +# - "soft" for enforcing the soft limits +# - "hard" for enforcing hard limits +# +# can be one of the following: +# - core - limits the core file size (KB) +# - data - max data size (KB) +# - fsize - maximum filesize (KB) +# - memlock - max locked-in-memory address space (KB) +# - nofile - max number of open file descriptors +# - rss - max resident set size (KB) +# - stack - max stack size (KB) +# - cpu - max CPU time (MIN) +# - nproc - max number of processes +# - as - address space limit (KB) +# - maxlogins - max number of logins for this user +# - maxsyslogins - max number of logins on the system +# - priority - the priority to run user process with +# - locks - max number of file locks the user can hold +# - sigpending - max number of pending signals +# - msgqueue - max memory used by POSIX message queues (bytes) +# - nice - max nice priority allowed to raise to values: [-20, 19] +# - rtprio - max realtime priority +# - chroot - change root to directory (Debian-specific) +# +# +# is related with : +# All items support the values -1, unlimited or infinity indicating +# no limit, except for priority and nice. +# +# If a hard limit or soft limit of a resource is set to a valid value, +# but outside of the supported range of the local system, the system +# may reject the new limit or unexpected behavior may occur. If the +# control value required is used, the module will reject the login if +# a limit could not be set. +# +# +# + +# * soft core 0 +# root hard core 100000 +# * hard rss 10000 +# @student hard nproc 20 +# @faculty soft nproc 20 +# @faculty hard nproc 50 +# ftp hard nproc 0 +# ftp - chroot /ftp +# @student - maxlogins 4 + +# End of file diff --git a/src/sonic-host-services-data/templates/pam_limits.j2 b/src/sonic-host-services-data/templates/pam_limits.j2 new file mode 100755 index 000000000000..f87906932fb7 --- /dev/null +++ b/src/sonic-host-services-data/templates/pam_limits.j2 @@ -0,0 +1,12 @@ +#THIS IS AN AUTO-GENERATED FILE +# +# This file generate by j2 template file: src/sonic-host-services-data/templates/pam_limits.j2 +# +# /etc/pam.d/pam-limits settings common to all services +# This file is included from other service-specific PAM config files, +# and should contain a list of the authentication modules that define +# the central authentication scheme for use on the system +# (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the +# traditional Unix authentication mechanisms. +# +# here are the per-package modules (the "Primary" block) \ No newline at end of file diff --git a/src/sonic-host-services-data/templates/tacplus_nss.conf.j2 b/src/sonic-host-services-data/templates/tacplus_nss.conf.j2 index 8fad3035d601..812b47bfc162 100644 --- a/src/sonic-host-services-data/templates/tacplus_nss.conf.j2 +++ b/src/sonic-host-services-data/templates/tacplus_nss.conf.j2 @@ -7,6 +7,34 @@ debug=on {% endif %} +# local_accounting - If you want to local accounting, set it +# Default: None +# local_accounting +{% if local_accounting %} +local_accounting +{% endif %} + +# tacacs_accounting - If you want to tacacs+ accounting, set it +# Default: None +# tacacs_accounting +{% if tacacs_accounting %} +tacacs_accounting +{% endif %} + +# local_authorization - If you want to local authorization, set it +# Default: None +# local_authorization +{% if local_authorization %} +local_authorization +{% endif %} + +# tacacs_authorization - If you want to tacacs+ authorization, set it +# Default: None +# tacacs_authorization +{% if tacacs_authorization %} +tacacs_authorization +{% endif %} + # src_ip - set source address of TACACS+ protocol packets # Default: None (auto source ip address) # src_ip=2.2.2.2 diff --git a/src/sonic-host-services/host_modules/showtech.py b/src/sonic-host-services/host_modules/showtech.py new file mode 100644 index 000000000000..2b603d4f52d3 --- /dev/null +++ b/src/sonic-host-services/host_modules/showtech.py @@ -0,0 +1,50 @@ +"""Show techsupport command handler""" + +import host_service +import subprocess +import re + +MOD_NAME = 'showtech' + +class Showtech(host_service.HostModule): + """DBus endpoint that executes the "show techsupport" command + """ + @host_service.method(host_service.bus_name(MOD_NAME), in_signature='s', out_signature='is') + def info(self, date): + + ERROR_TAR_FAILED = 5 + ERROR_PROCFS_SAVE_FAILED = 6 + ERROR_INVALID_ARGUMENT = 10 + + err_dict = {ERROR_INVALID_ARGUMENT: 'Invalid input: Incorrect DateTime format', + ERROR_TAR_FAILED: 'Failure saving information into compressed output file', + ERROR_PROCFS_SAVE_FAILED: 'Saving of process information failed'} + + cmd = ['/usr/local/bin/generate_dump'] + if date: + cmd.append("-s") + cmd.append(date) + + try: + result = subprocess.run(cmd, capture_output=True, text=True, + check=True) + + except subprocess.CalledProcessError as err: + errmsg = err_dict.get(err.returncode) + + if errmsg is None: + output = 'Error: Failure code {:-5}'.format(err.returncode) + else: + output = errmsg + + print("%Error: Host side: Failed: " + str(err.returncode)) + return err.returncode, output + + output_file_match = re.search('\/var\/.*dump.*\.gz', result.stdout) + output_filename = output_file_match.group() + return result.returncode, output_filename + +def register(): + """Return the class name""" + return Showtech, MOD_NAME + diff --git a/src/sonic-host-services/pytest.ini b/src/sonic-host-services/pytest.ini index 8823631c6283..c4b03d4c3455 100644 --- a/src/sonic-host-services/pytest.ini +++ b/src/sonic-host-services/pytest.ini @@ -1,2 +1,2 @@ [pytest] -addopts = --cov=scripts --cov-report html --cov-report term --cov-report xml --ignore=tests/hostcfgd/test_vectors.py --ignore=tests/hostcfgd/test_radius_vectors.py --ignore=tests/caclmgrd/test_dhcp_vectors.py +addopts = --cov=scripts --cov-report html --cov-report term --cov-report xml --ignore=tests/*/test*_vectors.py diff --git a/src/sonic-host-services/scripts/caclmgrd b/src/sonic-host-services/scripts/caclmgrd index b46ade3316f9..a65f05a34520 100755 --- a/src/sonic-host-services/scripts/caclmgrd +++ b/src/sonic-host-services/scripts/caclmgrd @@ -359,16 +359,20 @@ class ControlPlaneAclManager(daemon_base.DaemonBase): return chain_list - def dhcp_acl_rule(self, iptable_ns_cmd_prefix, op, intf): + def dhcp_acl_rule(self, iptable_ns_cmd_prefix, op, intf, mark): ''' sample: iptables --insert/delete/check DHCP -m physdev --physdev-in Ethernet4 -j DROP + sample: iptables --insert/delete/check DHCP -m mark --mark 0x67004 -j DROP ''' - return iptable_ns_cmd_prefix + 'iptables --{} DHCP -m physdev --physdev-in {} -j DROP'.format(op, intf) + if mark is None: + return iptable_ns_cmd_prefix + 'iptables --{} DHCP -m physdev --physdev-in {} -j DROP'.format(op, intf) + else: + return iptable_ns_cmd_prefix + 'iptables --{} DHCP -m mark --mark {} -j DROP'.format(op, mark) - def update_dhcp_chain(self, op, intf): + def update_dhcp_chain(self, op, intf, mark): for namespace in list(self.config_db_map.keys()): - check_cmd = self.dhcp_acl_rule(self.iptables_cmd_ns_prefix[namespace], "check", intf) - update_cmd = self.dhcp_acl_rule(self.iptables_cmd_ns_prefix[namespace], op, intf) + check_cmd = self.dhcp_acl_rule(self.iptables_cmd_ns_prefix[namespace], "check", intf, mark) + update_cmd = self.dhcp_acl_rule(self.iptables_cmd_ns_prefix[namespace], op, intf, mark) execute = 0 ret = subprocess.call(check_cmd, shell=True) # ret==0 indicates the rule exists @@ -382,7 +386,7 @@ class ControlPlaneAclManager(daemon_base.DaemonBase): subprocess.call(update_cmd, shell=True) self.log_info("Update DHCP chain: {}".format(update_cmd)) - def update_dhcp_acl(self, key, op, data): + def update_dhcp_acl(self, key, op, data, mark): if "state" not in data: self.log_warning("Unexpected update in MUX_CABLE_TABLE") return @@ -391,16 +395,32 @@ class ControlPlaneAclManager(daemon_base.DaemonBase): state = data["state"] if state == "active": - self.update_dhcp_chain("delete", intf) + self.update_dhcp_chain("delete", intf, mark) elif state == "standby": - self.update_dhcp_chain("insert", intf) + self.update_dhcp_chain("insert", intf, mark) elif state == "unknown": - self.update_dhcp_chain("delete", intf) + self.update_dhcp_chain("delete", intf, mark) elif state == "error": self.log_warning("Cable state shows error") else: self.log_warning("Unexpected cable state") + def update_dhcp_acl_for_mark_change(self, key, pre_mark, cur_mark): + for namespace in list(self.config_db_map.keys()): + check_cmd = self.dhcp_acl_rule(self.iptables_cmd_ns_prefix[namespace], "check", key, pre_mark) + + ret = subprocess.call(check_cmd, shell=True) # ret==0 indicates the rule exists + + '''update only when the rule with pre_mark exists''' + if ret == 0: + delete_cmd = self.dhcp_acl_rule(self.iptables_cmd_ns_prefix[namespace], "delete", key, pre_mark) + insert_cmd = self.dhcp_acl_rule(self.iptables_cmd_ns_prefix[namespace], "insert", key, cur_mark) + + subprocess.call(delete_cmd, shell=True) + self.log_info("Update DHCP chain: {}".format(delete_cmd)) + subprocess.call(insert_cmd, shell=True) + self.log_info("Update DHCP chain: {}".format(insert_cmd)) + def get_acl_rules_and_translate_to_iptables_commands(self, namespace): """ Retrieves current ACL tables and rules from Config DB, translates @@ -481,9 +501,7 @@ class ControlPlaneAclManager(daemon_base.DaemonBase): # Add iptables/ip6tables commands to allow all incoming BGP traffic # TODO: Determine BGP ACLs based on configured device sessions, and remove this blanket acceptance iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -p tcp --dport 179 -j ACCEPT") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "iptables -A INPUT -p tcp --sport 179 -j ACCEPT") iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -p tcp --dport 179 -j ACCEPT") - iptables_cmds.append(self.iptables_cmd_ns_prefix[namespace] + "ip6tables -A INPUT -p tcp --sport 179 -j ACCEPT") # Get current ACL tables and rules from Config DB self._tables_db_info = self.config_db_map[namespace].get_table(self.ACL_TABLE) @@ -708,16 +726,22 @@ class ControlPlaneAclManager(daemon_base.DaemonBase): # Set up STATE_DB connector to monitor the change in MUX_CABLE_TABLE state_db_connector = None subscribe_mux_cable = None + subscribe_dhcp_packet_mark = None state_db_id = swsscommon.SonicDBConfig.getDbId("STATE_DB") + dhcp_packet_mark_tbl = {} if self.DualToR: self.log_info("Dual ToR mode") # set up state_db connector state_db_connector = swsscommon.DBConnector("STATE_DB", 0) + subscribe_mux_cable = swsscommon.SubscriberStateTable(state_db_connector, self.MUX_CABLE_TABLE) sel.addSelectable(subscribe_mux_cable) + subscribe_dhcp_packet_mark = swsscommon.SubscriberStateTable(state_db_connector, "DHCP_PACKET_MARK") + sel.addSelectable(subscribe_dhcp_packet_mark) + # create DHCP chain for namespace in list(self.config_db_map.keys()): self.setup_dhcp_chain(namespace) @@ -762,12 +786,28 @@ class ControlPlaneAclManager(daemon_base.DaemonBase): if db_id == state_db_id: if self.DualToR: + '''dhcp packet mark update''' + while True: + key, op, fvs = subscribe_dhcp_packet_mark.pop() + if not key: + break + self.log_info("dhcp packet mark update : '%s'" % str((key, op, fvs))) + + '''initial value is None''' + pre_mark = None if key not in dhcp_packet_mark_tbl else dhcp_packet_mark_tbl[key] + cur_mark = None if op == 'DEL' else dict(fvs)['mark'] + dhcp_packet_mark_tbl[key] = cur_mark + self.update_dhcp_acl_for_mark_change(key, pre_mark, cur_mark) + + '''mux cable update''' while True: key, op, fvs = subscribe_mux_cable.pop() if not key: break self.log_info("mux cable update : '%s'" % str((key, op, fvs))) - self.update_dhcp_acl(key, op, dict(fvs)) + + mark = None if key not in dhcp_packet_mark_tbl else dhcp_packet_mark_tbl[key] + self.update_dhcp_acl(key, op, dict(fvs), mark) continue ctrl_plane_acl_notification = set() diff --git a/src/sonic-host-services/scripts/hostcfgd b/src/sonic-host-services/scripts/hostcfgd index b178f265142a..7f8f4be0b2e7 100755 --- a/src/sonic-host-services/scripts/hostcfgd +++ b/src/sonic-host-services/scripts/hostcfgd @@ -4,12 +4,14 @@ import ast import copy import ipaddress import os +import sys import subprocess import syslog +import signal import jinja2 from sonic_py_common import device_info -from swsscommon.swsscommon import ConfigDBConnector +from swsscommon.swsscommon import ConfigDBConnector, DBConnector, Table # FILE PAM_AUTH_CONF = "/etc/pam.d/common-auth-sonic" @@ -22,6 +24,10 @@ PAM_RADIUS_AUTH_CONF_TEMPLATE = "/usr/share/sonic/templates/pam_radius_auth.conf NSS_CONF = "/etc/nsswitch.conf" ETC_PAMD_SSHD = "/etc/pam.d/sshd" ETC_PAMD_LOGIN = "/etc/pam.d/login" +PAM_LIMITS_CONF_TEMPLATE = "/usr/share/sonic/templates/pam_limits.j2" +LIMITS_CONF_TEMPLATE = "/usr/share/sonic/templates/limits.conf.j2" +PAM_LIMITS_CONF = "/etc/pam.d/pam-limits-conf" +LIMITS_CONF = "/etc/security/limits.conf" # TACACS+ TACPLUS_SERVER_PASSKEY_DEFAULT = "" @@ -36,6 +42,34 @@ RADIUS_SERVER_TIMEOUT_DEFAULT = "5" RADIUS_SERVER_AUTH_TYPE_DEFAULT = "pap" RADIUS_PAM_AUTH_CONF_DIR = "/etc/pam_radius_auth.d/" +# MISC Constants +CFG_DB = "CONFIG_DB" +STATE_DB = "STATE_DB" +HOSTCFGD_MAX_PRI = 10 # Used to enforce ordering b/w daemons under Hostcfgd +DEFAULT_SELECT_TIMEOUT = 1000 + + +def safe_eval(val, default_value=False): + """ Safely evaluate the expression, without raising an exception """ + try: + ret = ast.literal_eval(val) + except ValueError: + ret = default_value + return ret + + +def signal_handler(sig, frame): + if sig == signal.SIGHUP: + syslog.syslog(syslog.LOG_INFO, "HostCfgd: signal 'SIGHUP' is caught and ignoring..") + elif sig == signal.SIGINT: + syslog.syslog(syslog.LOG_INFO, "HostCfgd: signal 'SIGINT' is caught and exiting...") + sys.exit(128 + sig) + elif sig == signal.SIGTERM: + syslog.syslog(syslog.LOG_INFO, "HostCfgd: signal 'SIGTERM' is caught and exiting...") + sys.exit(128 + sig) + else: + syslog.syslog(syslog.LOG_INFO, "HostCfgd: invalid signal - ignoring..") + def run_cmd(cmd, log_err=True, raise_exception=False): try: @@ -70,6 +104,18 @@ def obfuscate(data): else: return data +def get_pid(procname): + for dirname in os.listdir('/proc'): + if dirname == 'curproc': + continue + try: + with open('/proc/{}/cmdline'.format(dirname), mode='r') as fd: + content = fd.read() + except Exception as ex: + continue + if procname in content: + return dirname + return "" class Feature(object): """ Represents a feature configuration from CONFIG_DB data. """ @@ -86,9 +132,9 @@ class Feature(object): self.name = feature_name self.state = self._get_target_state(feature_cfg.get('state'), device_config or {}) self.auto_restart = feature_cfg.get('auto_restart', 'disabled') - self.has_timer = ast.literal_eval(feature_cfg.get('has_timer', 'False')) - self.has_global_scope = ast.literal_eval(feature_cfg.get('has_global_scope', 'True')) - self.has_per_asic_scope = ast.literal_eval(feature_cfg.get('has_per_asic_scope', 'False')) + self.has_timer = safe_eval(feature_cfg.get('has_timer', 'False')) + self.has_global_scope = safe_eval(feature_cfg.get('has_global_scope', 'True')) + self.has_per_asic_scope = safe_eval(feature_cfg.get('has_per_asic_scope', 'False')) def _get_target_state(self, state_configuration, device_config): """ Returns the target state for the feature by rendering the state field as J2 template. @@ -109,6 +155,14 @@ class Feature(object): raise ValueError('Invalid state rendered for feature {}: {}'.format(self.name, target_state)) return target_state + def compare_state(self, feature_name, feature_cfg): + if self.name != feature_name or not isinstance(feature_cfg, dict): + return False + + if self.state != feature_cfg.get('state', ''): + return False + return True + class FeatureHandler(object): """ Handles FEATURE table updates. """ @@ -116,16 +170,23 @@ class FeatureHandler(object): SYSTEMD_SYSTEM_DIR = '/etc/systemd/system/' SYSTEMD_SERVICE_CONF_DIR = os.path.join(SYSTEMD_SYSTEM_DIR, '{}.service.d/') - def __init__(self, config_db, device_config): + # Feature state constants + FEATURE_STATE_ENABLED = "enabled" + FEATURE_STATE_DISABLED = "disabled" + FEATURE_STATE_FAILED = "failed" + + def __init__(self, config_db, feature_state_table, device_config): self._config_db = config_db + self._feature_state_table = feature_state_table self._device_config = device_config self._cached_config = {} self.is_multi_npu = device_info.is_multi_npu() - def handle(self, feature_name, feature_cfg): + def handle(self, feature_name, op, feature_cfg): if not feature_cfg: - self._cached_config.pop(feature_name) syslog.syslog(syslog.LOG_INFO, "Deregistering feature {}".format(feature_name)) + self._cached_config.pop(feature_name) + self._feature_state_table._del(feature_name) return feature = Feature(feature_name, feature_cfg, self._device_config) @@ -136,9 +197,7 @@ class FeatureHandler(object): # the next called self.update_feature_state will start it again. If it will fail # again the auto restart will kick-in. Another order may leave it in failed state # and not auto restart. - if self._cached_config[feature_name].auto_restart != feature.auto_restart: - self.update_feature_auto_restart(feature) - self._cached_config[feature_name].auto_restart = feature.auto_restart + self.update_feature_auto_restart(feature, feature_name) # Enable/disable the container service if the feature state was changed from its previous state. if self._cached_config[feature_name].state != feature.state: @@ -147,18 +206,21 @@ class FeatureHandler(object): else: self.resync_feature_state(self._cached_config[feature_name]) - def update_all_features_config(self): - feature_table = self._config_db.get_table('FEATURE') + def sync_state_field(self, feature_table): + """ + Summary: + Updates the state field in the FEATURE|* tables as the state field + might have to be rendered based on DEVICE_METADATA table + """ for feature_name in feature_table.keys(): if not feature_name: syslog.syslog(syslog.LOG_WARNING, "Feature is None") continue feature = Feature(feature_name, feature_table[feature_name], self._device_config) - self._cached_config.setdefault(feature_name, feature) - - self.update_feature_auto_restart(feature) + self._cached_config.setdefault(feature_name, feature) + self.update_feature_auto_restart(feature, feature_name) self.update_feature_state(feature) self.resync_feature_state(feature) @@ -203,16 +265,32 @@ class FeatureHandler(object): return True - def update_feature_auto_restart(self, feature): + def update_feature_auto_restart(self, feature, feature_name): + dir_name = self.SYSTEMD_SERVICE_CONF_DIR.format(feature_name) + auto_restart_conf = os.path.join(dir_name, 'auto_restart.conf') + + write_conf = False + if not os.path.exists(auto_restart_conf): # if the auto_restart_conf file is not found, set it + write_conf = True + + if self._cached_config[feature_name].auto_restart != feature.auto_restart: + write_conf = True + + if not write_conf: + return + + self._cached_config[feature_name].auto_restart = feature.auto_restart # Update Cache + restart_config = "always" if feature.auto_restart == "enabled" else "no" service_conf = "[Service]\nRestart={}\n".format(restart_config) feature_names, feature_suffixes = self.get_feature_attribute(feature) - for feature_name in feature_names: - dir_name = self.SYSTEMD_SERVICE_CONF_DIR.format(feature_name) + for name in feature_names: + dir_name = self.SYSTEMD_SERVICE_CONF_DIR.format(name) + auto_restart_conf = os.path.join(dir_name, 'auto_restart.conf') if not os.path.exists(dir_name): os.mkdir(dir_name) - with open(os.path.join(dir_name, 'auto_restart.conf'), 'w') as cfgfile: + with open(auto_restart_conf, 'w') as cfgfile: cfgfile.write(service_conf) try: @@ -250,7 +328,6 @@ class FeatureHandler(object): props = dict([line.split("=") for line in stdout.decode().strip().splitlines()]) return props["UnitFileState"] - def enable_feature(self, feature): cmds = [] feature_names, feature_suffixes = self.get_feature_attribute(feature) @@ -276,8 +353,11 @@ class FeatureHandler(object): except Exception as err: syslog.syslog(syslog.LOG_ERR, "Feature '{}.{}' failed to be enabled and started" .format(feature.name, feature_suffixes[-1])) + self.set_feature_state(feature, self.FEATURE_STATE_FAILED) return + self.set_feature_state(feature, self.FEATURE_STATE_ENABLED) + def disable_feature(self, feature): cmds = [] feature_names, feature_suffixes = self.get_feature_attribute(feature) @@ -298,11 +378,17 @@ class FeatureHandler(object): except Exception as err: syslog.syslog(syslog.LOG_ERR, "Feature '{}.{}' failed to be stopped and disabled" .format(feature.name, feature_suffixes[-1])) + self.set_feature_state(feature, self.FEATURE_STATE_FAILED) return + self.set_feature_state(feature, self.FEATURE_STATE_DISABLED) + def resync_feature_state(self, feature): self._config_db.mod_entry('FEATURE', feature.name, {'state': feature.state}) + def set_feature_state(self, feature, state): + self._feature_state_table.set(feature.name, [('state', state)]) + class Iptables(object): def __init__(self): @@ -375,17 +461,20 @@ class Iptables(object): for cmd in iptables_cmds: syslog.syslog(syslog.LOG_INFO, "Running cmd - {}".format(cmd)) - try: - subprocess.check_call(cmd, shell=True) - except subprocess.CalledProcessError as err: - syslog.syslog(syslog.LOG_ERR, "'{}' failed. RC: {}, output: {}" - .format(err.cmd, err.returncode, err.output)) + run_cmd(cmd) + class AaaCfg(object): def __init__(self): - self.auth_default = { + self.authentication_default = { + 'login': 'local', + } + self.authorization_default = { 'login': 'local', } + self.accounting_default = { + 'login': 'disable', + } self.tacplus_global_default = { 'auth_type': TACPLUS_SERVER_AUTH_TYPE_DEFAULT, 'timeout': TACPLUS_SERVER_TIMEOUT_DEFAULT, @@ -405,7 +494,9 @@ class AaaCfg(object): self.radius_global = {} self.radius_servers = {} - self.auth = {} + self.authentication = {} + self.authorization = {} + self.accounting = {} self.debug = False self.trace = False @@ -429,11 +520,15 @@ class AaaCfg(object): def aaa_update(self, key, data, modify_conf=True): if key == 'authentication': - self.auth = data + self.authentication = data if 'failthrough' in data: - self.auth['failthrough'] = is_true(data['failthrough']) + self.authentication['failthrough'] = is_true(data['failthrough']) if 'debug' in data: self.debug = is_true(data['debug']) + if key == 'authorization': + self.authorization = data + if key == 'accounting': + self.accounting = data if modify_conf: self.modify_conf_file() @@ -476,6 +571,18 @@ class AaaCfg(object): if modify_conf: self.modify_conf_file() + def notify_audisp_tacplus_reload_config(self): + pid = get_pid("/sbin/audisp-tacplus") + syslog.syslog(syslog.LOG_INFO, "Found audisp-tacplus PID: {}".format(pid)) + if pid == "": + return + + # audisp-tacplus will reload TACACS+ config when receive SIGHUP + try: + os.kill(int(pid), signal.SIGHUP) + except Exception as ex: + syslog.syslog(syslog.LOG_WARNING, "Send SIGHUP to audisp-tacplus failed with exception: {}".format(ex)) + def handle_radius_source_intf_ip_chg(self, key): modify_conf=False if 'src_intf' in self.radius_global: @@ -582,8 +689,12 @@ class AaaCfg(object): os.system(cmd) def modify_conf_file(self): - auth = self.auth_default.copy() - auth.update(self.auth) + authentication = self.authentication_default.copy() + authentication.update(self.authentication) + authorization = self.authorization_default.copy() + authorization.update(self.authorization) + accounting = self.accounting_default.copy() + accounting.update(self.accounting) tacplus_global = self.tacplus_global_default.copy() tacplus_global.update(self.tacplus_global) if 'src_ip' in tacplus_global: @@ -642,10 +753,10 @@ class AaaCfg(object): env = jinja2.Environment(loader=jinja2.FileSystemLoader('/'), trim_blocks=True) env.filters['sub'] = sub template = env.get_template(template_file) - if 'radius' in auth['login']: - pam_conf = template.render(debug=self.debug, trace=self.trace, auth=auth, servers=radsrvs_conf) + if 'radius' in authentication['login']: + pam_conf = template.render(debug=self.debug, trace=self.trace, auth=authentication, servers=radsrvs_conf) else: - pam_conf = template.render(auth=auth, src_ip=src_ip, servers=servers_conf) + pam_conf = template.render(auth=authentication, src_ip=src_ip, servers=servers_conf) # Use rename(), which is atomic (on the same fs) to avoid empty file with open(PAM_AUTH_CONF + ".tmp", 'w') as f: @@ -664,11 +775,11 @@ class AaaCfg(object): self.modify_single_file(ETC_PAMD_LOGIN, [ "'/^@include/s/common-auth-sonic$/common-auth/'" ]) # Add tacplus/radius in nsswitch.conf if TACACS+/RADIUS enable - if 'tacacs+' in auth['login']: + if 'tacacs+' in authentication['login']: if os.path.isfile(NSS_CONF): self.modify_single_file(NSS_CONF, [ "'/^passwd/s/ radius//'" ]) self.modify_single_file(NSS_CONF, [ "'/tacplus/b'", "'/^passwd/s/compat/tacplus &/'", "'/^passwd/s/files/tacplus &/'" ]) - elif 'radius' in auth['login']: + elif 'radius' in authentication['login']: if os.path.isfile(NSS_CONF): self.modify_single_file(NSS_CONF, [ "'/^passwd/s/tacplus //'" ]) self.modify_single_file(NSS_CONF, [ "'/radius/b'", "'/^passwd/s/compat/& radius/'", "'/^passwd/s/files/& radius/'" ]) @@ -677,13 +788,39 @@ class AaaCfg(object): self.modify_single_file(NSS_CONF, [ "'/^passwd/s/tacplus //g'" ]) self.modify_single_file(NSS_CONF, [ "'/^passwd/s/ radius//'" ]) + # Add tacplus authorization configration in nsswitch.conf + tacacs_authorization_conf = None + local_authorization_conf = None + if 'tacacs+' in authorization['login']: + tacacs_authorization_conf = "on" + if 'local' in authorization['login']: + local_authorization_conf = "on" + + # Add tacplus accounting configration in nsswitch.conf + tacacs_accounting_conf = None + local_accounting_conf = None + if 'tacacs+' in accounting['login']: + tacacs_accounting_conf = "on" + if 'local' in accounting['login']: + local_accounting_conf = "on" + # Set tacacs+ server in nss-tacplus conf template_file = os.path.abspath(NSS_TACPLUS_CONF_TEMPLATE) template = env.get_template(template_file) - nss_tacplus_conf = template.render(debug=self.debug, src_ip=src_ip, servers=servers_conf) + nss_tacplus_conf = template.render( + debug=self.debug, + src_ip=src_ip, + servers=servers_conf, + local_accounting=local_accounting_conf, + tacacs_accounting=tacacs_accounting_conf, + local_authorization=local_authorization_conf, + tacacs_authorization=tacacs_authorization_conf) with open(NSS_TACPLUS_CONF, 'w') as f: f.write(nss_tacplus_conf) + # Notify auditd plugin to reload tacacs config. + self.notify_audisp_tacplus_reload_config() + # Set debug in nss-radius conf template_file = os.path.abspath(NSS_RADIUS_CONF_TEMPLATE) template = env.get_template(template_file) @@ -706,7 +843,7 @@ class AaaCfg(object): f.write(pam_radius_auth_conf) # Start the statistics service. Only RADIUS implemented - if ('radius' in auth['login']) and ('statistics' in radius_global) and\ + if ('radius' in authentication['login']) and ('statistics' in radius_global) and \ radius_global['statistics']: cmd = 'service aaastatsd start' else: @@ -719,6 +856,7 @@ class AaaCfg(object): "{} - failed: return code - {}, output:\n{}" .format(err.cmd, err.returncode, err.output)) + class KdumpCfg(object): def __init__(self, CfgDb): self.config_db = CfgDb @@ -727,19 +865,17 @@ class KdumpCfg(object): "num_dumps": "3" } def load(self, kdump_table): - syslog.syslog(syslog.LOG_INFO, "KdumpCfg load ...") - data = {} + """ + Set the KDUMP table in CFG DB to kdump_defaults if not set by the user + """ + syslog.syslog(syslog.LOG_INFO, "KdumpCfg init ...") kdump_conf = kdump_table.get("config", {}) for row in self.kdump_defaults: value = self.kdump_defaults.get(row) - if kdump_conf.get(row) is not None: - value = kdump_conf.get(row) - else: - self.config_db.mod_entry("KDUMP", "config", { row : value}) - data[row] = value - self.kdump_update("config", data, True) + if not kdump_conf.get(row): + self.config_db.mod_entry("KDUMP", "config", {row : value}) - def kdump_update(self, key, data, isLoad): + def kdump_update(self, key, data): syslog.syslog(syslog.LOG_INFO, "Kdump global configuration update") if key == "config": # Admin mode @@ -759,116 +895,161 @@ class KdumpCfg(object): memory = self.kdump_defaults["memory"] if data.get("memory") is not None: memory = data.get("memory") - if isLoad or data.get("memory") is not None: - run_cmd("sonic-kdump-config --memory " + memory) + run_cmd("sonic-kdump-config --memory " + memory) # Num dumps num_dumps = self.kdump_defaults["num_dumps"] if data.get("num_dumps") is not None: num_dumps = data.get("num_dumps") - if isLoad or data.get("num_dumps") is not None: - run_cmd("sonic-kdump-config --num_dumps " + num_dumps) + run_cmd("sonic-kdump-config --num_dumps " + num_dumps) class NtpCfg(object): - def __init__(self, CfgDb): - self.config_db = CfgDb + """ + NtpCfg Config Daemon + 1) ntp-config.service handles the configuration updates and then starts ntp.service + 2) Both of them start after all the feature services start + 3) Purpose of this daemon is to propagate runtime config changes in + NTP, NTP_SERVER and LOOPBACK_INTERFACE + """ + def __init__(self): self.ntp_global = {} - self.has_ntp_servers = False + self.ntp_servers = set() def load(self, ntp_global_conf, ntp_server_conf): syslog.syslog(syslog.LOG_INFO, "NtpCfg load ...") for row in ntp_global_conf: - self.ntp_global_update(row, ntp_global_conf[row], True) + self.ntp_global_update(row, ntp_global_conf[row], is_load=True) - self.ntp_server_update(0, ntp_server_conf, True) + # Force reload on init + self.ntp_server_update(0, None, is_load=True) - def handle_ntp_source_intf_chg (self, key): + def handle_ntp_source_intf_chg(self, intf_name): # if no ntp server configured, do nothing - if self.has_ntp_servers == False: + if not self.ntp_servers: return # check only the intf configured as source interface - if (len(self.ntp_global) == 0): - return - - if 'src_intf' not in self.ntp_global: - return - - if key[0] != self.ntp_global['src_intf']: + if intf_name not in self.ntp_global.get('src_intf', '').split(';'): return else: # just restart ntp config cmd = 'systemctl restart ntp-config' run_cmd(cmd) - def ntp_global_update(self, key, data, isLoad): - syslog.syslog(syslog.LOG_INFO, "ntp global configuration update") - - new_src = new_vrf = orig_src = orig_vrf = "" + def ntp_global_update(self, key, data, is_load=False): + syslog.syslog(syslog.LOG_INFO, 'NTP GLOBAL Update') + orig_src = self.ntp_global.get('src_intf', '') + orig_src_set = set(orig_src.split(";")) + orig_vrf = self.ntp_global.get('vrf', '') - if 'src_intf' in data: - new_src = data['src_intf'] - - if 'vrf' in data: - new_vrf = data['vrf'] - - if (len(self.ntp_global) != 0): - - if 'src_intf' in self.ntp_global: - orig_src = self.ntp_global['src_intf'] - - if 'vrf' in self.ntp_global: - orig_vrf = self.ntp_global['vrf'] + new_src = data.get('src_intf', '') + new_src_set = set(new_src.split(";")) + new_vrf = data.get('vrf', '') + # Update the Local Cache self.ntp_global = data - # during initial load of ntp configuration, ntp server configuration decides if to restart ntp-config - if (isLoad): - syslog.syslog(syslog.LOG_INFO, "ntp global update in load") - return + # If initial load don't restart daemon + if is_load: return # check if ntp server configured, if not, do nothing - if self.has_ntp_servers == False: - syslog.syslog(syslog.LOG_INFO, "no ntp server when global config change, do nothing") + if not self.ntp_servers: + syslog.syslog(syslog.LOG_INFO, "No ntp server when global config change, do nothing") return - if (new_src != orig_src): + if orig_src_set != new_src_set: syslog.syslog(syslog.LOG_INFO, "ntp global update for source intf old {} new {}, restarting ntp-config" - .format(orig_src, new_src)) + .format(orig_src_set, new_src_set)) cmd = 'systemctl restart ntp-config' run_cmd(cmd) + elif new_vrf != orig_vrf: + syslog.syslog(syslog.LOG_INFO, "ntp global update for vrf old {} new {}, restarting ntp service" + .format(orig_vrf, new_vrf)) + cmd = 'service ntp restart' + run_cmd(cmd) + + def ntp_server_update(self, key, op, is_load=False): + syslog.syslog(syslog.LOG_INFO, 'ntp server update key {}'.format(key)) + + restart_config = False + if not is_load: + if op == "SET" and key not in self.ntp_servers: + restart_config = True + self.ntp_servers.add(key) + elif op == "DEL" and key in self.ntp_servers: + restart_config = True + self.ntp_servers.remove(key) else: - if (new_vrf != orig_vrf): - syslog.syslog(syslog.LOG_INFO, "ntp global update for vrf old {} new {}, restarting ntp service" - .format(orig_vrf, new_vrf)) - cmd = 'service ntp restart' - run_cmd(cmd) - - def ntp_server_update(self, key, data, isLoad): - syslog.syslog(syslog.LOG_INFO, 'ntp server update key {} data {}'.format(key, data)) - - # during load, restart ntp-config regardless if ntp server is configured or not - if isLoad == True: - if data != {}: - self.has_ntp_servers = True + restart_config = True + + if restart_config: + cmd = 'systemctl restart ntp-config' + syslog.syslog(syslog.LOG_INFO, 'ntp server update, restarting ntp-config, ntp servers configured {}'.format(self.ntp_servers)) + run_cmd(cmd) + +class PamLimitsCfg(object): + """ + PamLimit Config Daemon + 1) The pam_limits PAM module sets limits on the system resources that can be obtained in a user-session. + 2) Purpose of this daemon is to render pam_limits config file. + """ + def __init__(self, config_db): + self.config_db = config_db + self.hwsku = "" + self.type = "" + + # Load config from ConfigDb and render config file/ + def update_config_file(self): + device_metadata = self.config_db.get_table('DEVICE_METADATA') + if "localhost" not in device_metadata: + return + + self.read_localhost_config(device_metadata["localhost"]) + self.render_conf_file() + + # Read localhost config + def read_localhost_config(self, localhost): + if "hwsku" in localhost: + self.hwsku = localhost["hwsku"] else: - # for runtime ntp server change, to determine if there is ntp server configured, need to - # get from configDB, as delete triggers 2 event handling - ntp_servers_tbl = self.config_db.get_table('NTP_SERVER') - if ntp_servers_tbl != {}: - self.has_ntp_servers = True - else: - self.has_ntp_servers = False + self.hwsku = "" - cmd = 'systemctl restart ntp-config' - syslog.syslog(syslog.LOG_INFO, 'ntp server update, restarting ntp-config, ntp server exists {}'.format(self.has_ntp_servers)) + if "type" in localhost: + self.type = localhost["type"] + else: + self.type = "" - run_cmd(cmd) + # Render pam_limits config files + def render_conf_file(self): + env = jinja2.Environment(loader=jinja2.FileSystemLoader('/'), trim_blocks=True) + env.filters['sub'] = sub + try: + template_file = os.path.abspath(PAM_LIMITS_CONF_TEMPLATE) + template = env.get_template(template_file) + pam_limits_conf = template.render( + hwsku=self.hwsku, + type=self.type) + with open(PAM_LIMITS_CONF, 'w') as f: + f.write(pam_limits_conf) + + template_file = os.path.abspath(LIMITS_CONF_TEMPLATE) + template = env.get_template(template_file) + limits_conf = template.render( + hwsku=self.hwsku, + type=self.type) + with open(LIMITS_CONF, 'w') as f: + f.write(limits_conf) + except Exception as e: + syslog.syslog(syslog.LOG_ERR, + "modify pam_limits config file failed with exception: {}" + .format(e)) class HostConfigDaemon: def __init__(self): + # Just a sanity check to verify if the CONFIG_DB has been initialized + # before moving forward self.config_db = ConfigDBConnector() self.config_db.connect(wait_for_init=True, retry_on=True) syslog.syslog(syslog.LOG_INFO, 'ConfigDB connect success') @@ -877,166 +1058,197 @@ class HostConfigDaemon: self.device_config = {} self.device_config['DEVICE_METADATA'] = self.config_db.get_table('DEVICE_METADATA') - self.hostname_cache="" - self.aaacfg = AaaCfg() + # Load feature state table + self.state_db_conn = DBConnector(STATE_DB, 0) + feature_state_table = Table(self.state_db_conn, 'FEATURE') + + # Initialize KDump Config and set the config to default if nothing is provided + self.kdumpCfg = KdumpCfg(self.config_db) + + # Initialize IpTables self.iptables = Iptables() - self.feature_handler = FeatureHandler(self.config_db, self.device_config) - self.ntpcfg = NtpCfg(self.config_db) - self.is_multi_npu = device_info.is_multi_npu() + # Intialize Feature Handler + self.feature_handler = FeatureHandler(self.config_db, feature_state_table, self.device_config) - # Load Kdump configuration - self.kdumpCfg = KdumpCfg(self.config_db) - self.kdumpCfg.load(self.config_db.get_table('KDUMP')) + # Initialize Ntp Config Handler + self.ntpcfg = NtpCfg() + self.is_multi_npu = device_info.is_multi_npu() - def load(self): - aaa = self.config_db.get_table('AAA') - tacacs_global = self.config_db.get_table('TACPLUS') - tacacs_server = self.config_db.get_table('TACPLUS_SERVER') - radius_global = self.config_db.get_table('RADIUS') - radius_server = self.config_db.get_table('RADIUS_SERVER') - self.aaacfg.load(aaa, tacacs_global, tacacs_server, radius_global, radius_server) + # Initialize AAACfg + self.hostname_cache="" + self.aaacfg = AaaCfg() - lpbk_table = self.config_db.get_table('LOOPBACK_INTERFACE') + # Initialize PamLimitsCfg + self.pamLimitsCfg = PamLimitsCfg(self.config_db) + self.pamLimitsCfg.update_config_file() + + def load(self, init_data): + features = init_data['FEATURE'] + aaa = init_data['AAA'] + tacacs_global = init_data['TACPLUS'] + tacacs_server = init_data['TACPLUS_SERVER'] + radius_global = init_data['RADIUS'] + radius_server = init_data['RADIUS_SERVER'] + lpbk_table = init_data['LOOPBACK_INTERFACE'] + ntp_server = init_data['NTP_SERVER'] + ntp_global = init_data['NTP'] + kdump = init_data['KDUMP'] + + self.feature_handler.sync_state_field(features) + self.aaacfg.load(aaa, tacacs_global, tacacs_server, radius_global, radius_server) self.iptables.load(lpbk_table) - - # Load NTP configurations - ntp_server = self.config_db.get_table('NTP_SERVER') - ntp_global = self.config_db.get_table('NTP') self.ntpcfg.load(ntp_global, ntp_server) + self.kdumpCfg.load(kdump) + + dev_meta = self.config_db.get_table('DEVICE_METADATA') + if 'localhost' in dev_meta: + if 'hostname' in dev_meta['localhost']: + self.hostname_cache = dev_meta['localhost']['hostname'] - try: - dev_meta = self.config_db.get_table('DEVICE_METADATA') - if 'localhost' in dev_meta: - if 'hostname' in dev_meta['localhost']: - self.hostname_cache = dev_meta['localhost']['hostname'] - except Exception as e: - pass # Update AAA with the hostname self.aaacfg.hostname_update(self.hostname_cache) - def aaa_handler(self, key, data): + def __get_intf_name(self, key): + if isinstance(key, tuple) and key: + intf = key[0] + else: + intf = key + return intf + + def aaa_handler(self, key, op, data): self.aaacfg.aaa_update(key, data) + syslog.syslog(syslog.LOG_INFO, 'AAA Update: key: {}, op: {}, data: {}'.format(key, op, data)) - def tacacs_server_handler(self, key, data): + def tacacs_server_handler(self, key, op, data): self.aaacfg.tacacs_server_update(key, data) log_data = copy.deepcopy(data) if 'passkey' in log_data: log_data['passkey'] = obfuscate(log_data['passkey']) - syslog.syslog(syslog.LOG_INFO, 'value of {} changed to {}'.format(key, log_data)) + syslog.syslog(syslog.LOG_INFO, 'TACPLUS_SERVER update: key: {}, op: {}, data: {}'.format(key, op, log_data)) - def tacacs_global_handler(self, key, data): + def tacacs_global_handler(self, key, op, data): self.aaacfg.tacacs_global_update(key, data) log_data = copy.deepcopy(data) if 'passkey' in log_data: log_data['passkey'] = obfuscate(log_data['passkey']) - syslog.syslog(syslog.LOG_INFO, 'value of {} changed to {}'.format(key, log_data)) + syslog.syslog(syslog.LOG_INFO, 'TACPLUS Global update: key: {}, op: {}, data: {}'.format(key, op, log_data)) - def radius_server_handler(self, key, data): + def radius_server_handler(self, key, op, data): self.aaacfg.radius_server_update(key, data) log_data = copy.deepcopy(data) if 'passkey' in log_data: log_data['passkey'] = obfuscate(log_data['passkey']) - syslog.syslog(syslog.LOG_INFO, 'value of {} changed to {}'.format(key, log_data)) + syslog.syslog(syslog.LOG_INFO, 'RADIUS_SERVER update: key: {}, op: {}, data: {}'.format(key, op, log_data)) - def radius_global_handler(self, key, data): + def radius_global_handler(self, key, op, data): self.aaacfg.radius_global_update(key, data) log_data = copy.deepcopy(data) if 'passkey' in log_data: log_data['passkey'] = obfuscate(log_data['passkey']) - syslog.syslog(syslog.LOG_INFO, 'value of {} changed to {}'.format(key, log_data)) + syslog.syslog(syslog.LOG_INFO, 'RADIUS Global update: key: {}, op: {}, data: {}'.format(key, op, log_data)) - def mgmt_intf_handler(self, key, data): - self.aaacfg.handle_radius_source_intf_ip_chg(key) - self.aaacfg.handle_radius_nas_ip_chg(key) + def mgmt_intf_handler(self, key, op, data): + key = ConfigDBConnector.deserialize_key(key) + mgmt_intf_name = self.__get_intf_name(key) + self.aaacfg.handle_radius_source_intf_ip_chg(mgmt_intf_name) + self.aaacfg.handle_radius_nas_ip_chg(mgmt_intf_name) - def lpbk_handler(self, key, data): + def lpbk_handler(self, key, op, data): key = ConfigDBConnector.deserialize_key(key) - # Check if delete operation by fetch existing keys - keys = self.config_db.get_keys('LOOPBACK_INTERFACE') - if key in keys: - add = True - else: + if op == "DEL": add = False + else: + add = True self.iptables.iptables_handler(key, data, add) - self.ntpcfg.handle_ntp_source_intf_chg(key) + lpbk_name = self.__get_intf_name(key) + self.ntpcfg.handle_ntp_source_intf_chg(lpbk_name) self.aaacfg.handle_radius_source_intf_ip_chg(key) - def vlan_intf_handler(self, key, data): + def vlan_intf_handler(self, key, op, data): key = ConfigDBConnector.deserialize_key(key) self.aaacfg.handle_radius_source_intf_ip_chg(key) - def vlan_sub_intf_handler(self, key, data): + def vlan_sub_intf_handler(self, key, op, data): key = ConfigDBConnector.deserialize_key(key) self.aaacfg.handle_radius_source_intf_ip_chg(key) - def portchannel_intf_handler(self, key, data): + def portchannel_intf_handler(self, key, op, data): key = ConfigDBConnector.deserialize_key(key) self.aaacfg.handle_radius_source_intf_ip_chg(key) - def phy_intf_handler(self, key, data): + def phy_intf_handler(self, key, op, data): key = ConfigDBConnector.deserialize_key(key) self.aaacfg.handle_radius_source_intf_ip_chg(key) - def ntp_server_handler (self, key, data): - syslog.syslog(syslog.LOG_INFO, 'NTP server handler...') - ntp_server_db = self.config_db.get_table('NTP_SERVER') - data = ntp_server_db - self.ntpcfg.ntp_server_update(key, data, False) + def ntp_server_handler(self, key, op, data): + self.ntpcfg.ntp_server_update(key, op) - def ntp_global_handler (self, key, data): - syslog.syslog(syslog.LOG_INFO, 'NTP global handler...') - self.ntpcfg.ntp_global_update(key, data, False) + def ntp_global_handler(self, key, op, data): + self.ntpcfg.ntp_global_update(key, data) - def kdump_handler (self, key, data): + def kdump_handler (self, key, op, data): syslog.syslog(syslog.LOG_INFO, 'Kdump handler...') - self.kdumpCfg.kdump_update(key, data, False) + self.kdumpCfg.kdump_update(key, data) def wait_till_system_init_done(self): - # No need to print the output in the log file so using the "--quiet" # flag systemctl_cmd = "sudo systemctl is-system-running --wait --quiet" subprocess.call(systemctl_cmd, shell=True) - def start(self): - self.config_db.subscribe('AAA', lambda table, key, data: self.aaa_handler(key, data)) - self.config_db.subscribe('TACPLUS_SERVER', lambda table, key, data: self.tacacs_server_handler(key, data)) - self.config_db.subscribe('TACPLUS', lambda table, key, data: self.tacacs_global_handler(key, data)) - self.config_db.subscribe('RADIUS_SERVER', lambda table, key, data: self.radius_server_handler(key, data)) - self.config_db.subscribe('RADIUS', lambda table, key, data: self.radius_global_handler(key, data)) - self.config_db.subscribe('MGMT_INTERFACE', lambda table, key, data: self.mgmt_intf_handler(key, data)) - self.config_db.subscribe('LOOPBACK_INTERFACE', lambda table, key, data: self.lpbk_handler(key, data)) - self.config_db.subscribe('FEATURE', lambda table, key, data: self.feature_handler.handle(key, data)) - self.config_db.subscribe('VLAN_INTERFACE', lambda table, key, data: self.vlan_intf_handler(key, data)) - self.config_db.subscribe('VLAN_SUB_INTERFACE', lambda table, key, data: self.vlan_sub_intf_handler(key, data)) - self.config_db.subscribe('PORTCHANNEL_INTERFACE', lambda table, key, data: self.portchannel_intf_handler(key, data)) - self.config_db.subscribe('INTERFACE', lambda table, key, data: self.phy_intf_handler(key, data)) - self.config_db.subscribe('NTP_SERVER', lambda table, key, data: self.ntp_server_handler(key, data)) - self.config_db.subscribe('NTP', lambda table, key, data: self.ntp_global_handler(key, data)) - self.config_db.subscribe('KDUMP', lambda table, key, data: self.kdump_handler(key, data)) + def register_callbacks(self): + def make_callback(func): + def callback(table, key, data): + if data is None: + op = "DEL" + else: + op = "SET" + return func(key, op, data) + return callback + + self.config_db.subscribe('KDUMP', make_callback(self.kdump_handler)) + # Handle FEATURE updates before other tables + self.config_db.subscribe('FEATURE', make_callback(self.feature_handler.handle)) + # Handle AAA, TACACS and RADIUS related tables + self.config_db.subscribe('AAA', make_callback(self.aaa_handler)) + self.config_db.subscribe('TACPLUS', make_callback(self.tacacs_global_handler)) + self.config_db.subscribe('TACPLUS_SERVER', make_callback(self.tacacs_server_handler)) + self.config_db.subscribe('RADIUS', make_callback(self.radius_global_handler)) + self.config_db.subscribe('RADIUS_SERVER', make_callback(self.radius_server_handler)) + # Handle IPTables configuration + self.config_db.subscribe('LOOPBACK_INTERFACE', make_callback(self.lpbk_handler)) + # Handle NTP & NTP_SERVER updates + self.config_db.subscribe('NTP', make_callback(self.ntp_global_handler)) + self.config_db.subscribe('NTP_SERVER', make_callback(self.ntp_server_handler)) + # Handle updates to src intf changes in radius + self.config_db.subscribe('MGMT_INTERFACE', make_callback(self.mgmt_intf_handler)) + self.config_db.subscribe('VLAN_INTERFACE', make_callback(self.vlan_intf_handler)) + self.config_db.subscribe('VLAN_SUB_INTERFACE', make_callback(self.vlan_sub_intf_handler)) + self.config_db.subscribe('PORTCHANNEL_INTERFACE', make_callback(self.portchannel_intf_handler)) + self.config_db.subscribe('INTERFACE', make_callback(self.phy_intf_handler)) + syslog.syslog(syslog.LOG_INFO, "Waiting for systemctl to finish initialization") self.wait_till_system_init_done() syslog.syslog(syslog.LOG_INFO, "systemctl has finished initialization -- proceeding ...") - # Update all feature states once upon starting - self.feature_handler.update_all_features_config() - - # Defer load until subscribe - self.load() - - self.config_db.listen() + def start(self): + self.config_db.listen(init_data_handler=self.load) def main(): + signal.signal(signal.SIGTERM, signal_handler) + signal.signal(signal.SIGINT, signal_handler) + signal.signal(signal.SIGHUP, signal_handler) daemon = HostConfigDaemon() + daemon.register_callbacks() daemon.start() - if __name__ == "__main__": main() + diff --git a/src/sonic-host-services/setup.py b/src/sonic-host-services/setup.py index 3d90a93dbaa5..8926e960e311 100644 --- a/src/sonic-host-services/setup.py +++ b/src/sonic-host-services/setup.py @@ -26,8 +26,7 @@ 'dbus-python', 'Jinja2>=2.10', 'PyGObject', - 'sonic-py-common', - 'systemd-python', + 'sonic-py-common' ], setup_requires = [ 'pytest-runner', @@ -37,7 +36,8 @@ 'parameterized', 'pytest', 'pyfakefs', - 'sonic-py-common' + 'sonic-py-common', + 'deepdiff' ], classifiers = [ 'Development Status :: 3 - Alpha', diff --git a/src/sonic-host-services/tests/caclmgrd/caclmgrd_dhcp_test.py b/src/sonic-host-services/tests/caclmgrd/caclmgrd_dhcp_test.py index 9e12fa9994d3..176dec1b5081 100644 --- a/src/sonic-host-services/tests/caclmgrd/caclmgrd_dhcp_test.py +++ b/src/sonic-host-services/tests/caclmgrd/caclmgrd_dhcp_test.py @@ -41,14 +41,15 @@ def test_caclmgrd_dhcp(self, test_name, test_data, fs): popen_mock.configure_mock(**popen_attrs) mocked_subprocess.Popen.return_value = popen_mock - call_mock = mock.Mock() call_rc = test_data["call_rc"] mocked_subprocess.call.return_value = call_rc + mark = test_data["mark"] + caclmgrd_daemon = caclmgrd.ControlPlaneAclManager("caclmgrd") mux_update = test_data["mux_update"] for key,data in mux_update: - caclmgrd_daemon.update_dhcp_acl(key, '', data) + caclmgrd_daemon.update_dhcp_acl(key, '', data, mark) mocked_subprocess.call.assert_has_calls(test_data["expected_subprocess_calls"], any_order=False) diff --git a/src/sonic-host-services/tests/caclmgrd/test_dhcp_vectors.py b/src/sonic-host-services/tests/caclmgrd/test_dhcp_vectors.py index 6a58f761251b..7ebfca22a64b 100644 --- a/src/sonic-host-services/tests/caclmgrd/test_dhcp_vectors.py +++ b/src/sonic-host-services/tests/caclmgrd/test_dhcp_vectors.py @@ -5,7 +5,7 @@ """ CACLMGRD_DHCP_TEST_VECTOR = [ [ - "Active_Present", + "Active_Present_Interface", { "config_db": { "DEVICE_METADATA": { @@ -29,10 +29,36 @@ 'communicate.return_value': ('output', 'error'), }, "call_rc": 0, + "mark": None, }, ], [ - "Active_Absent", + "Active_Present_Mark", + { + "config_db": { + "DEVICE_METADATA": { + "localhost": { + "subtype": "DualToR", + "type": "ToRRouter", + } + }, + }, + "mux_update": [ + ("Ethernet4", {"state": "active"}), + ], + "expected_subprocess_calls": [ + call("iptables --check DHCP -m mark --mark 0x67004 -j DROP", shell=True), + call("iptables --delete DHCP -m mark --mark 0x67004 -j DROP", shell=True), + ], + "popen_attributes": { + 'communicate.return_value': ('output', 'error'), + }, + "call_rc": 0, + "mark": "0x67004", + }, + ], + [ + "Active_Absent_Interface", { "config_db": { "DEVICE_METADATA": { @@ -54,10 +80,35 @@ 'communicate.return_value': ('output', 'error'), }, "call_rc": 1, + "mark": None, }, ], [ - "Standby_Present", + "Active_Absent_Mark", + { + "config_db": { + "DEVICE_METADATA": { + "localhost": { + "subtype": "DualToR", + "type": "ToRRouter", + } + }, + }, + "mux_update": [ + ("Ethernet4", {"state": "active"}), + ], + "expected_subprocess_calls": [ + call("iptables --check DHCP -m mark --mark 0x67004 -j DROP", shell=True), + ], + "popen_attributes": { + 'communicate.return_value': ('output', 'error'), + }, + "call_rc": 1, + "mark": "0x67004", + }, + ], + [ + "Standby_Present_Interface", { "config_db": { "DEVICE_METADATA": { @@ -79,10 +130,35 @@ 'communicate.return_value': ('output', 'error'), }, "call_rc": 0, + "mark": None, + }, + ], + [ + "Standby_Present_Mark", + { + "config_db": { + "DEVICE_METADATA": { + "localhost": { + "subtype": "DualToR", + "type": "ToRRouter", + } + }, + }, + "mux_update": [ + ("Ethernet4", {"state": "standby"}), + ], + "expected_subprocess_calls": [ + call("iptables --check DHCP -m mark --mark 0x67004 -j DROP", shell=True), + ], + "popen_attributes": { + 'communicate.return_value': ('output', 'error'), + }, + "call_rc": 0, + "mark": "0x67004", }, ], [ - "Standby_Absent", + "Standby_Absent_Interface", { "config_db": { "DEVICE_METADATA": { @@ -106,10 +182,36 @@ 'communicate.return_value': ('output', 'error'), }, "call_rc": 1, + "mark": None, }, ], [ - "Unknown_Present", + "Standby_Absent_Mark", + { + "config_db": { + "DEVICE_METADATA": { + "localhost": { + "subtype": "DualToR", + "type": "ToRRouter", + } + }, + }, + "mux_update": [ + ("Ethernet4", {"state": "standby"}), + ], + "expected_subprocess_calls": [ + call("iptables --check DHCP -m mark --mark 0x67004 -j DROP", shell=True), + call("iptables --insert DHCP -m mark --mark 0x67004 -j DROP", shell=True), + ], + "popen_attributes": { + 'communicate.return_value': ('output', 'error'), + }, + "call_rc": 1, + "mark": "0x67004", + }, + ], + [ + "Unknown_Present_Interface", { "config_db": { "DEVICE_METADATA": { @@ -133,10 +235,36 @@ 'communicate.return_value': ('output', 'error'), }, "call_rc": 0, + "mark": None, }, ], [ - "Uknown_Absent", + "Unknown_Present_Mark", + { + "config_db": { + "DEVICE_METADATA": { + "localhost": { + "subtype": "DualToR", + "type": "ToRRouter", + } + }, + }, + "mux_update": [ + ("Ethernet4", {"state": "unknown"}), + ], + "expected_subprocess_calls": [ + call("iptables --check DHCP -m mark --mark 0x67004 -j DROP", shell=True), + call("iptables --delete DHCP -m mark --mark 0x67004 -j DROP", shell=True), + ], + "popen_attributes": { + 'communicate.return_value': ('output', 'error'), + }, + "call_rc": 0, + "mark": "0x67004", + }, + ], + [ + "Uknown_Absent_Interface", { "config_db": { "DEVICE_METADATA": { @@ -158,6 +286,31 @@ 'communicate.return_value': ('output', 'error'), }, "call_rc": 1, + "mark": None, + }, + ], + [ + "Uknown_Absent_Mark", + { + "config_db": { + "DEVICE_METADATA": { + "localhost": { + "subtype": "DualToR", + "type": "ToRRouter", + } + }, + }, + "mux_update": [ + ("Ethernet4", {"state": "unknown"}), + ], + "expected_subprocess_calls": [ + call("iptables --check DHCP -m mark --mark 0x67004 -j DROP", shell=True), + ], + "popen_attributes": { + 'communicate.return_value': ('output', 'error'), + }, + "call_rc": 1, + "mark": "0x67004", }, ], ] diff --git a/src/sonic-host-services/tests/common/mock_configdb.py b/src/sonic-host-services/tests/common/mock_configdb.py index 7783e6e8eaa5..f0b12b11abf9 100644 --- a/src/sonic-host-services/tests/common/mock_configdb.py +++ b/src/sonic-host-services/tests/common/mock_configdb.py @@ -4,14 +4,23 @@ class MockConfigDb(object): """ STATE_DB = None CONFIG_DB = None + event_queue = [] def __init__(self, **kwargs): - pass + self.handlers = {} @staticmethod def set_config_db(test_config_db): MockConfigDb.CONFIG_DB = test_config_db + @staticmethod + def deserialize_key(key, separator="|"): + tokens = key.split(separator) + if len(tokens) > 1: + return tuple(tokens) + else: + return key + @staticmethod def get_config_db(): return MockConfigDb.CONFIG_DB @@ -35,3 +44,15 @@ def set_entry(self, key, field, data): def get_table(self, table_name): return MockConfigDb.CONFIG_DB[table_name] + + def subscribe(self, table_name, callback): + self.handlers[table_name] = callback + + def listen(self, init_data_handler=None): + for e in MockConfigDb.event_queue: + self.handlers[e[0]](e[0], e[1], self.get_entry(e[0], e[1])) + + +class MockDBConnector(): + def __init__(self, db, val): + pass diff --git a/src/sonic-host-services/tests/hostcfgd/hostcfgd_radius_test.py b/src/sonic-host-services/tests/hostcfgd/hostcfgd_radius_test.py index 5ae05bd9ac6e..c08cd1829add 100644 --- a/src/sonic-host-services/tests/hostcfgd/hostcfgd_radius_test.py +++ b/src/sonic-host-services/tests/hostcfgd/hostcfgd_radius_test.py @@ -10,10 +10,9 @@ from parameterized import parameterized from unittest import TestCase, mock from tests.hostcfgd.test_radius_vectors import HOSTCFGD_TEST_RADIUS_VECTOR -from tests.common.mock_configdb import MockConfigDb +from tests.common.mock_configdb import MockConfigDb, MockDBConnector -swsscommon.ConfigDBConnector = MockConfigDb test_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) modules_path = os.path.dirname(test_path) scripts_path = os.path.join(modules_path, "scripts") @@ -31,6 +30,10 @@ loader.exec_module(hostcfgd) sys.modules['hostcfgd'] = hostcfgd +# Mock swsscommon classes +hostcfgd.ConfigDBConnector = MockConfigDb +hostcfgd.DBConnector = MockDBConnector +hostcfgd.Table = mock.Mock() class TestHostcfgdRADIUS(TestCase): """ @@ -44,11 +47,9 @@ def run_diff(self, file1, file2): def test_hostcfgd_radius(self, test_name, test_data): """ Test RADIUS hostcfd daemon initialization - Args: test_name(str): test name test_data(dict): test data which contains initial Config Db tables, and expected results - Returns: None """ diff --git a/src/sonic-host-services/tests/hostcfgd/hostcfgd_tacacs_test.py b/src/sonic-host-services/tests/hostcfgd/hostcfgd_tacacs_test.py new file mode 100644 index 000000000000..a6478c08dc0d --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/hostcfgd_tacacs_test.py @@ -0,0 +1,116 @@ +import importlib.machinery +import importlib.util +import filecmp +import shutil +import os +import sys +import subprocess +from swsscommon import swsscommon + +from parameterized import parameterized +from unittest import TestCase, mock +from tests.hostcfgd.test_tacacs_vectors import HOSTCFGD_TEST_TACACS_VECTOR +from tests.common.mock_configdb import MockConfigDb, MockDBConnector + +test_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +modules_path = os.path.dirname(test_path) +scripts_path = os.path.join(modules_path, "scripts") +src_path = os.path.dirname(modules_path) +templates_path = os.path.join(src_path, "sonic-host-services-data/templates") +output_path = os.path.join(test_path, "hostcfgd/output") +sample_output_path = os.path.join(test_path, "hostcfgd/sample_output") +sys.path.insert(0, modules_path) + +# Load the file under test +hostcfgd_path = os.path.join(scripts_path, 'hostcfgd') +loader = importlib.machinery.SourceFileLoader('hostcfgd', hostcfgd_path) +spec = importlib.util.spec_from_loader(loader.name, loader) +hostcfgd = importlib.util.module_from_spec(spec) +loader.exec_module(hostcfgd) +sys.modules['hostcfgd'] = hostcfgd + +# Mock swsscommon classes +hostcfgd.ConfigDBConnector = MockConfigDb +hostcfgd.DBConnector = MockDBConnector +hostcfgd.Table = mock.Mock() + +class TestHostcfgdTACACS(TestCase): + """ + Test hostcfd daemon - TACACS + """ + def run_diff(self, file1, file2): + return subprocess.check_output('diff -uR {} {} || true'.format(file1, file2), shell=True) + + """ + Check different config + """ + def check_config(self, test_name, test_data, config_name): + t_path = templates_path + op_path = output_path + "/" + test_name + "_" + config_name + sop_path = sample_output_path + "/" + test_name + "_" + config_name + + hostcfgd.PAM_AUTH_CONF_TEMPLATE = t_path + "/common-auth-sonic.j2" + hostcfgd.NSS_TACPLUS_CONF_TEMPLATE = t_path + "/tacplus_nss.conf.j2" + hostcfgd.NSS_RADIUS_CONF_TEMPLATE = t_path + "/radius_nss.conf.j2" + hostcfgd.PAM_RADIUS_AUTH_CONF_TEMPLATE = t_path + "/pam_radius_auth.conf.j2" + hostcfgd.PAM_AUTH_CONF = op_path + "/common-auth-sonic" + hostcfgd.NSS_TACPLUS_CONF = op_path + "/tacplus_nss.conf" + hostcfgd.NSS_RADIUS_CONF = op_path + "/radius_nss.conf" + hostcfgd.NSS_CONF = op_path + "/nsswitch.conf" + hostcfgd.ETC_PAMD_SSHD = op_path + "/sshd" + hostcfgd.ETC_PAMD_LOGIN = op_path + "/login" + hostcfgd.RADIUS_PAM_AUTH_CONF_DIR = op_path + "/" + + shutil.rmtree( op_path, ignore_errors=True) + os.mkdir( op_path) + + shutil.copyfile( sop_path + "/sshd.old", op_path + "/sshd") + shutil.copyfile( sop_path + "/login.old", op_path + "/login") + + MockConfigDb.set_config_db(test_data[config_name]) + host_config_daemon = hostcfgd.HostConfigDaemon() + + aaa = host_config_daemon.config_db.get_table('AAA') + + try: + tacacs_global = host_config_daemon.config_db.get_table('TACPLUS') + except: + tacacs_global = [] + try: + tacacs_server = \ + host_config_daemon.config_db.get_table('TACPLUS_SERVER') + except: + tacacs_server = [] + + host_config_daemon.aaacfg.load(aaa,tacacs_global,tacacs_server,[],[]) + dcmp = filecmp.dircmp(sop_path, op_path) + diff_output = "" + for name in dcmp.diff_files: + diff_output += \ + "Diff: file: {} expected: {} output: {}\n".format(\ + name, dcmp.left, dcmp.right) + diff_output += self.run_diff( dcmp.left + "/" + name,\ + dcmp.right + "/" + name) + self.assertTrue(len(diff_output) == 0, diff_output) + + + @parameterized.expand(HOSTCFGD_TEST_TACACS_VECTOR) + def test_hostcfgd_tacacs(self, test_name, test_data): + """ + Test TACACS hostcfd daemon initialization + + Args: + test_name(str): test name + test_data(dict): test data which contains initial Config Db tables, and expected results + + Returns: + None + """ + # test local config + self.check_config(test_name, test_data, "config_db_local") + # test remote config + self.check_config(test_name, test_data, "config_db_tacacs") + # test local + tacacs config + self.check_config(test_name, test_data, "config_db_local_and_tacacs") + # test disable accounting + self.check_config(test_name, test_data, "config_db_disable_accounting") diff --git a/src/sonic-host-services/tests/hostcfgd/hostcfgd_test.py b/src/sonic-host-services/tests/hostcfgd/hostcfgd_test.py index 15dd66f29e7e..28d4f6f8a724 100644 --- a/src/sonic-host-services/tests/hostcfgd/hostcfgd_test.py +++ b/src/sonic-host-services/tests/hostcfgd/hostcfgd_test.py @@ -7,52 +7,61 @@ from sonic_py_common.general import load_module_from_source from unittest import TestCase, mock -from .test_vectors import HOSTCFGD_TEST_VECTOR -from tests.common.mock_configdb import MockConfigDb +from .test_vectors import HOSTCFGD_TEST_VECTOR, HOSTCFG_DAEMON_CFG_DB +from tests.common.mock_configdb import MockConfigDb, MockDBConnector from pyfakefs.fake_filesystem_unittest import patchfs +from deepdiff import DeepDiff +from unittest.mock import call - -swsscommon.ConfigDBConnector = MockConfigDb test_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) modules_path = os.path.dirname(test_path) -scripts_path = os.path.join(modules_path, "scripts") +scripts_path = os.path.join(modules_path, 'scripts') sys.path.insert(0, modules_path) # Load the file under test hostcfgd_path = os.path.join(scripts_path, 'hostcfgd') hostcfgd = load_module_from_source('hostcfgd', hostcfgd_path) +hostcfgd.ConfigDBConnector = MockConfigDb +hostcfgd.DBConnector = MockDBConnector +hostcfgd.Table = mock.Mock() class TestHostcfgd(TestCase): """ Test hostcfd daemon - feature """ - def __verify_table(self, table, expected_table): + def __verify_table(self, table, feature_state_table, expected_table): """ verify config db tables - Compares Config DB table (FEATURE) with expected output table + Compares Config DB table (FEATURE) with expected output table. + Verifies that State DB table (FEATURE) is updated. Args: table(dict): Current Config Db table + feature_state_table(Mock): Mocked State DB FEATURE table expected_table(dict): Expected Config Db table Returns: None """ - is_equal = len(table) == len(expected_table) - if is_equal: - for key, fields in expected_table.items(): - is_equal = is_equal and key in table and len(fields) == len(table[key]) - if is_equal: - for field, value in fields.items(): - is_equal = is_equal and value == table[key][field] - if not is_equal: - break; - else: - break - return is_equal + ddiff = DeepDiff(table, expected_table, ignore_order=True) + print('DIFF:', ddiff) + + def get_state(cfg_state): + """ Translates CONFIG DB state field into STATE DB state field """ + if cfg_state == 'always_disabled': + return 'disabled' + elif cfg_state == 'always_enabled': + return 'enabled' + else: + return cfg_state + + feature_state_table.set.assert_has_calls([ + mock.call(feature, [('state', get_state(table[feature]['state']))]) for feature in table + ]) + return True if not ddiff else False def __verify_fs(self, table): """ @@ -69,23 +78,23 @@ def __verify_fs(self, table): """ exp_dict = { - "enabled": "always", - "disabled": "no", + 'enabled': 'always', + 'disabled': 'no', } - auto_restart_conf = os.path.join(hostcfgd.FeatureHandler.SYSTEMD_SERVICE_CONF_DIR, "auto_restart.conf") + auto_restart_conf = os.path.join(hostcfgd.FeatureHandler.SYSTEMD_SERVICE_CONF_DIR, 'auto_restart.conf') for feature in table: - auto_restart = table[feature].get("auto_restart", "disabled") + auto_restart = table[feature].get('auto_restart', 'disabled') with open(auto_restart_conf.format(feature)) as conf: conf = conf.read().strip() - assert conf == "[Service]\nRestart={}".format(exp_dict[auto_restart]) + assert conf == '[Service]\nRestart={}'.format(exp_dict[auto_restart]) @parameterized.expand(HOSTCFGD_TEST_VECTOR) @patchfs - def test_hostcfgd(self, test_name, test_data, fs): + def test_hostcfgd_feature_handler(self, test_name, test_data, fs): """ - Test hostcfd daemon initialization + Test feature config capability in the hostcfd Args: test_name(str): test name @@ -96,22 +105,34 @@ def test_hostcfgd(self, test_name, test_data, fs): """ fs.add_real_paths(swsscommon_package.__path__) # add real path of swsscommon for database_config.json fs.create_dir(hostcfgd.FeatureHandler.SYSTEMD_SYSTEM_DIR) - MockConfigDb.set_config_db(test_data["config_db"]) - with mock.patch("hostcfgd.subprocess") as mocked_subprocess: + MockConfigDb.set_config_db(test_data['config_db']) + feature_state_table_mock = mock.Mock() + with mock.patch('hostcfgd.subprocess') as mocked_subprocess: popen_mock = mock.Mock() - attrs = test_data["popen_attributes"] + attrs = test_data['popen_attributes'] popen_mock.configure_mock(**attrs) mocked_subprocess.Popen.return_value = popen_mock - host_config_daemon = hostcfgd.HostConfigDaemon() - host_config_daemon.feature_handler.update_all_features_config() + # Initialize Feature Handler + device_config = {} + device_config['DEVICE_METADATA'] = MockConfigDb.CONFIG_DB['DEVICE_METADATA'] + feature_handler = hostcfgd.FeatureHandler(MockConfigDb(), feature_state_table_mock, device_config) + + # sync the state field and Handle Feature Updates + features = MockConfigDb.CONFIG_DB['FEATURE'] + feature_handler.sync_state_field(features) + for key, fvs in features.items(): + feature_handler.handle(key, 'SET', fvs) + + # Verify if the updates are properly updated assert self.__verify_table( - MockConfigDb.get_config_db()["FEATURE"], - test_data["expected_config_db"]["FEATURE"] - ), "Test failed for test data: {0}".format(test_data) - mocked_subprocess.check_call.assert_has_calls(test_data["expected_subprocess_calls"], any_order=True) + MockConfigDb.get_config_db()['FEATURE'], + feature_state_table_mock, + test_data['expected_config_db']['FEATURE'] + ), 'Test failed for test data: {0}'.format(test_data) + mocked_subprocess.check_call.assert_has_calls(test_data['expected_subprocess_calls'], any_order=True) - self.__verify_fs(test_data["config_db"]["FEATURE"]) + self.__verify_fs(test_data['config_db']['FEATURE']) def test_feature_config_parsing(self): swss_feature = hostcfgd.Feature('swss', { @@ -140,3 +161,149 @@ def test_feature_config_parsing_defaults(self): assert not swss_feature.has_timer assert swss_feature.has_global_scope assert not swss_feature.has_per_asic_scope + + +class TesNtpCfgd(TestCase): + """ + Test hostcfd daemon - NtpCfgd + """ + def setUp(self): + MockConfigDb.CONFIG_DB['NTP'] = {'global': {'vrf': 'mgmt', 'src_intf': 'eth0'}} + MockConfigDb.CONFIG_DB['NTP_SERVER'] = {'0.debian.pool.ntp.org': {}} + + def tearDown(self): + MockConfigDb.CONFIG_DB = {} + + def test_ntp_global_update_with_no_servers(self): + with mock.patch('hostcfgd.subprocess') as mocked_subprocess: + popen_mock = mock.Mock() + attrs = {'communicate.return_value': ('output', 'error')} + popen_mock.configure_mock(**attrs) + mocked_subprocess.Popen.return_value = popen_mock + + ntpcfgd = hostcfgd.NtpCfg() + ntpcfgd.ntp_global_update('global', MockConfigDb.CONFIG_DB['NTP']['global']) + + mocked_subprocess.check_call.assert_not_called() + + def test_ntp_global_update_ntp_servers(self): + with mock.patch('hostcfgd.subprocess') as mocked_subprocess: + popen_mock = mock.Mock() + attrs = {'communicate.return_value': ('output', 'error')} + popen_mock.configure_mock(**attrs) + mocked_subprocess.Popen.return_value = popen_mock + + ntpcfgd = hostcfgd.NtpCfg() + ntpcfgd.ntp_global_update('global', MockConfigDb.CONFIG_DB['NTP']['global']) + ntpcfgd.ntp_server_update('0.debian.pool.ntp.org', 'SET') + mocked_subprocess.check_call.assert_has_calls([call('systemctl restart ntp-config', shell=True)]) + + def test_loopback_update(self): + with mock.patch('hostcfgd.subprocess') as mocked_subprocess: + popen_mock = mock.Mock() + attrs = {'communicate.return_value': ('output', 'error')} + popen_mock.configure_mock(**attrs) + mocked_subprocess.Popen.return_value = popen_mock + + ntpcfgd = hostcfgd.NtpCfg() + ntpcfgd.ntp_global = MockConfigDb.CONFIG_DB['NTP']['global'] + ntpcfgd.ntp_servers.add('0.debian.pool.ntp.org') + + ntpcfgd.handle_ntp_source_intf_chg('eth0') + mocked_subprocess.check_call.assert_has_calls([call('systemctl restart ntp-config', shell=True)]) + + +class TestHostcfgdDaemon(TestCase): + + def setUp(self): + MockConfigDb.set_config_db(HOSTCFG_DAEMON_CFG_DB) + + def tearDown(self): + MockConfigDb.CONFIG_DB = {} + + @patchfs + def test_feature_events(self, fs): + fs.create_dir(hostcfgd.FeatureHandler.SYSTEMD_SYSTEM_DIR) + MockConfigDb.event_queue = [('FEATURE', 'dhcp_relay'), + ('FEATURE', 'mux'), + ('FEATURE', 'telemetry')] + daemon = hostcfgd.HostConfigDaemon() + daemon.register_callbacks() + with mock.patch('hostcfgd.subprocess') as mocked_subprocess: + popen_mock = mock.Mock() + attrs = {'communicate.return_value': ('output', 'error')} + popen_mock.configure_mock(**attrs) + mocked_subprocess.Popen.return_value = popen_mock + try: + daemon.start() + except TimeoutError: + pass + expected = [call('sudo systemctl daemon-reload', shell=True), + call('sudo systemctl unmask dhcp_relay.service', shell=True), + call('sudo systemctl enable dhcp_relay.service', shell=True), + call('sudo systemctl start dhcp_relay.service', shell=True), + call('sudo systemctl daemon-reload', shell=True), + call('sudo systemctl unmask mux.service', shell=True), + call('sudo systemctl enable mux.service', shell=True), + call('sudo systemctl start mux.service', shell=True), + call('sudo systemctl daemon-reload', shell=True), + call('sudo systemctl unmask telemetry.service', shell=True), + call('sudo systemctl unmask telemetry.timer', shell=True), + call('sudo systemctl enable telemetry.timer', shell=True), + call('sudo systemctl start telemetry.timer', shell=True)] + mocked_subprocess.check_call.assert_has_calls(expected) + + # Change the state to disabled + MockConfigDb.CONFIG_DB['FEATURE']['telemetry']['state'] = 'disabled' + MockConfigDb.event_queue = [('FEATURE', 'telemetry')] + try: + daemon.start() + except TimeoutError: + pass + expected = [call('sudo systemctl stop telemetry.timer', shell=True), + call('sudo systemctl disable telemetry.timer', shell=True), + call('sudo systemctl mask telemetry.timer', shell=True), + call('sudo systemctl stop telemetry.service', shell=True), + call('sudo systemctl disable telemetry.timer', shell=True), + call('sudo systemctl mask telemetry.timer', shell=True)] + mocked_subprocess.check_call.assert_has_calls(expected) + + def test_loopback_events(self): + MockConfigDb.set_config_db(HOSTCFG_DAEMON_CFG_DB) + MockConfigDb.event_queue = [('NTP', 'global'), + ('NTP_SERVER', '0.debian.pool.ntp.org'), + ('LOOPBACK_INTERFACE', 'Loopback0|10.184.8.233/32')] + daemon = hostcfgd.HostConfigDaemon() + daemon.register_callbacks() + with mock.patch('hostcfgd.subprocess') as mocked_subprocess: + popen_mock = mock.Mock() + attrs = {'communicate.return_value': ('output', 'error')} + popen_mock.configure_mock(**attrs) + mocked_subprocess.Popen.return_value = popen_mock + try: + daemon.start() + except TimeoutError: + pass + expected = [call('systemctl restart ntp-config', shell=True), + call('iptables -t mangle --append PREROUTING -p tcp --tcp-flags SYN SYN -d 10.184.8.233 -j TCPMSS --set-mss 1460', shell=True), + call('iptables -t mangle --append POSTROUTING -p tcp --tcp-flags SYN SYN -s 10.184.8.233 -j TCPMSS --set-mss 1460', shell=True)] + mocked_subprocess.check_call.assert_has_calls(expected, any_order=True) + + def test_kdump_event(self): + MockConfigDb.set_config_db(HOSTCFG_DAEMON_CFG_DB) + daemon = hostcfgd.HostConfigDaemon() + daemon.register_callbacks() + MockConfigDb.event_queue = [('KDUMP', 'config')] + with mock.patch('hostcfgd.subprocess') as mocked_subprocess: + popen_mock = mock.Mock() + attrs = {'communicate.return_value': ('output', 'error')} + popen_mock.configure_mock(**attrs) + mocked_subprocess.Popen.return_value = popen_mock + try: + daemon.start() + except TimeoutError: + pass + expected = [call('sonic-kdump-config --disable', shell=True), + call('sonic-kdump-config --num_dumps 3', shell=True), + call('sonic-kdump-config --memory 0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M', shell=True)] + mocked_subprocess.check_call.assert_has_calls(expected, any_order=True) diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/tacplus_nss.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/tacplus_nss.conf index fe506941f98d..eac828491ac1 100644 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/tacplus_nss.conf +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/LOCAL/tacplus_nss.conf @@ -5,6 +5,23 @@ # debug=on debug=on +# local_accounting - If you want to local accounting, set it +# Default: None +# local_accounting + +# tacacs_accounting - If you want to tacacs+ accounting, set it +# Default: None +# tacacs_accounting + +# local_authorization - If you want to local authorization, set it +# Default: None +# local_authorization +local_authorization + +# tacacs_authorization - If you want to tacacs+ authorization, set it +# Default: None +# tacacs_authorization + # src_ip - set source address of TACACS+ protocol packets # Default: None (auto source ip address) # src_ip=2.2.2.2 diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/tacplus_nss.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/tacplus_nss.conf index fe506941f98d..eac828491ac1 100644 --- a/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/tacplus_nss.conf +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/RADIUS/tacplus_nss.conf @@ -5,6 +5,23 @@ # debug=on debug=on +# local_accounting - If you want to local accounting, set it +# Default: None +# local_accounting + +# tacacs_accounting - If you want to tacacs+ accounting, set it +# Default: None +# tacacs_accounting + +# local_authorization - If you want to local authorization, set it +# Default: None +# local_authorization +local_authorization + +# tacacs_authorization - If you want to tacacs+ authorization, set it +# Default: None +# tacacs_authorization + # src_ip - set source address of TACACS+ protocol packets # Default: None (auto source ip address) # src_ip=2.2.2.2 diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/common-auth-sonic b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/common-auth-sonic new file mode 100644 index 000000000000..87af4cc5c6ac --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/common-auth-sonic @@ -0,0 +1,21 @@ +#THIS IS AN AUTO-GENERATED FILE +# +# /etc/pam.d/common-auth- authentication settings common to all services +# This file is included from other service-specific PAM config files, +# and should contain a list of the authentication modules that define +# the central authentication scheme for use on the system +# (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the +# traditional Unix authentication mechanisms. +# +# here are the per-package modules (the "Primary" block) + +auth [success=1 default=ignore] pam_unix.so nullok try_first_pass + +# +# here's the fallback if no module succeeds +auth requisite pam_deny.so +# prime the stack with a positive return value if there isn't one already; +# this avoids us returning an error just because nothing sets a success code +# since the modules above will each just jump around +auth required pam_permit.so +# and here are more per-package modules (the "Additional" block) diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/login b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/login new file mode 100644 index 000000000000..80ba6452813f --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/login @@ -0,0 +1,116 @@ +# +# The PAM configuration file for the Shadow `login' service +# + +# Enforce a minimal delay in case of failure (in microseconds). +# (Replaces the `FAIL_DELAY' setting from login.defs) +# Note that other modules may require another minimal delay. (for example, +# to disable any delay, you should add the nodelay option to pam_unix) +auth optional pam_faildelay.so delay=3000000 + +# Outputs an issue file prior to each login prompt (Replaces the +# ISSUE_FILE option from login.defs). Uncomment for use +# auth required pam_issue.so issue=/etc/issue + +# Disallows root logins except on tty's listed in /etc/securetty +# (Replaces the `CONSOLE' setting from login.defs) +# +# With the default control of this module: +# [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] +# root will not be prompted for a password on insecure lines. +# if an invalid username is entered, a password is prompted (but login +# will eventually be rejected) +# +# You can change it to a "requisite" module if you think root may mis-type +# her login and should not be prompted for a password in that case. But +# this will leave the system as vulnerable to user enumeration attacks. +# +# You can change it to a "required" module if you think it permits to +# guess valid user names of your system (invalid user names are considered +# as possibly being root on insecure lines), but root passwords may be +# communicated over insecure lines. +auth [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] pam_securetty.so + +# Disallows other than root logins when /etc/nologin exists +# (Replaces the `NOLOGINS_FILE' option from login.defs) +auth requisite pam_nologin.so + +# SELinux needs to be the first session rule. This ensures that any +# lingering context has been cleared. Without this it is possible +# that a module could execute code in the wrong domain. +# When the module is present, "required" would be sufficient (When SELinux +# is disabled, this returns success.) +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close + +# Sets the loginuid process attribute +session required pam_loginuid.so + +# SELinux needs to intervene at login time to ensure that the process +# starts in the proper default security context. Only sessions which are +# intended to run in the user's context should be run after this. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open +# When the module is present, "required" would be sufficient (When SELinux +# is disabled, this returns success.) + +# This module parses environment configuration file(s) +# and also allows you to use an extended config +# file /etc/security/pam_env.conf. +# +# parsing /etc/environment needs "readenv=1" +session required pam_env.so readenv=1 +# locale variables are also kept into /etc/default/locale in etch +# reading this file *in addition to /etc/environment* does not hurt +session required pam_env.so readenv=1 envfile=/etc/default/locale + +# Standard Un*x authentication. +@include common-auth-sonic + +# This allows certain extra groups to be granted to a user +# based on things like time of day, tty, service, and user. +# Please edit /etc/security/group.conf to fit your needs +# (Replaces the `CONSOLE_GROUPS' option in login.defs) +auth optional pam_group.so + +# Uncomment and edit /etc/security/time.conf if you need to set +# time restraint on logins. +# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs +# as well as /etc/porttime) +# account requisite pam_time.so + +# Uncomment and edit /etc/security/access.conf if you need to +# set access limits. +# (Replaces /etc/login.access file) +# account required pam_access.so + +# Sets up user limits according to /etc/security/limits.conf +# (Replaces the use of /etc/limits in old login) +session required pam_limits.so + +# Prints the last login info upon successful login +# (Replaces the `LASTLOG_ENAB' option from login.defs) +session optional pam_lastlog.so + +# Prints the message of the day upon successful login. +# (Replaces the `MOTD_FILE' option in login.defs) +# This includes a dynamically generated part from /run/motd.dynamic +# and a static (admin-editable) part from /etc/motd. +session optional pam_motd.so motd=/run/motd.dynamic +session optional pam_motd.so noupdate + +# Prints the status of the user's mailbox upon successful login +# (Replaces the `MAIL_CHECK_ENAB' option from login.defs). +# +# This also defines the MAIL environment variable +# However, userdel also needs MAIL_DIR and MAIL_FILE variables +# in /etc/login.defs to make sure that removing a user +# also removes the user's mail spool file. +# See comments in /etc/login.defs +session optional pam_mail.so standard + +# Create a new session keyring. +session optional pam_keyinit.so force revoke + +# Standard Un*x account and session +@include common-account +@include common-session +@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/login.old b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/login.old new file mode 100644 index 000000000000..07ff95407ccd --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/login.old @@ -0,0 +1,116 @@ +# +# The PAM configuration file for the Shadow `login' service +# + +# Enforce a minimal delay in case of failure (in microseconds). +# (Replaces the `FAIL_DELAY' setting from login.defs) +# Note that other modules may require another minimal delay. (for example, +# to disable any delay, you should add the nodelay option to pam_unix) +auth optional pam_faildelay.so delay=3000000 + +# Outputs an issue file prior to each login prompt (Replaces the +# ISSUE_FILE option from login.defs). Uncomment for use +# auth required pam_issue.so issue=/etc/issue + +# Disallows root logins except on tty's listed in /etc/securetty +# (Replaces the `CONSOLE' setting from login.defs) +# +# With the default control of this module: +# [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] +# root will not be prompted for a password on insecure lines. +# if an invalid username is entered, a password is prompted (but login +# will eventually be rejected) +# +# You can change it to a "requisite" module if you think root may mis-type +# her login and should not be prompted for a password in that case. But +# this will leave the system as vulnerable to user enumeration attacks. +# +# You can change it to a "required" module if you think it permits to +# guess valid user names of your system (invalid user names are considered +# as possibly being root on insecure lines), but root passwords may be +# communicated over insecure lines. +auth [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] pam_securetty.so + +# Disallows other than root logins when /etc/nologin exists +# (Replaces the `NOLOGINS_FILE' option from login.defs) +auth requisite pam_nologin.so + +# SELinux needs to be the first session rule. This ensures that any +# lingering context has been cleared. Without this it is possible +# that a module could execute code in the wrong domain. +# When the module is present, "required" would be sufficient (When SELinux +# is disabled, this returns success.) +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close + +# Sets the loginuid process attribute +session required pam_loginuid.so + +# SELinux needs to intervene at login time to ensure that the process +# starts in the proper default security context. Only sessions which are +# intended to run in the user's context should be run after this. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open +# When the module is present, "required" would be sufficient (When SELinux +# is disabled, this returns success.) + +# This module parses environment configuration file(s) +# and also allows you to use an extended config +# file /etc/security/pam_env.conf. +# +# parsing /etc/environment needs "readenv=1" +session required pam_env.so readenv=1 +# locale variables are also kept into /etc/default/locale in etch +# reading this file *in addition to /etc/environment* does not hurt +session required pam_env.so readenv=1 envfile=/etc/default/locale + +# Standard Un*x authentication. +@include common-auth + +# This allows certain extra groups to be granted to a user +# based on things like time of day, tty, service, and user. +# Please edit /etc/security/group.conf to fit your needs +# (Replaces the `CONSOLE_GROUPS' option in login.defs) +auth optional pam_group.so + +# Uncomment and edit /etc/security/time.conf if you need to set +# time restraint on logins. +# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs +# as well as /etc/porttime) +# account requisite pam_time.so + +# Uncomment and edit /etc/security/access.conf if you need to +# set access limits. +# (Replaces /etc/login.access file) +# account required pam_access.so + +# Sets up user limits according to /etc/security/limits.conf +# (Replaces the use of /etc/limits in old login) +session required pam_limits.so + +# Prints the last login info upon successful login +# (Replaces the `LASTLOG_ENAB' option from login.defs) +session optional pam_lastlog.so + +# Prints the message of the day upon successful login. +# (Replaces the `MOTD_FILE' option in login.defs) +# This includes a dynamically generated part from /run/motd.dynamic +# and a static (admin-editable) part from /etc/motd. +session optional pam_motd.so motd=/run/motd.dynamic +session optional pam_motd.so noupdate + +# Prints the status of the user's mailbox upon successful login +# (Replaces the `MAIL_CHECK_ENAB' option from login.defs). +# +# This also defines the MAIL environment variable +# However, userdel also needs MAIL_DIR and MAIL_FILE variables +# in /etc/login.defs to make sure that removing a user +# also removes the user's mail spool file. +# See comments in /etc/login.defs +session optional pam_mail.so standard + +# Create a new session keyring. +session optional pam_keyinit.so force revoke + +# Standard Un*x account and session +@include common-account +@include common-session +@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/radius_nss.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/radius_nss.conf new file mode 100644 index 000000000000..1567b6e645e0 --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/radius_nss.conf @@ -0,0 +1,55 @@ +#THIS IS AN AUTO-GENERATED FILE +# Generated from: /usr/share/sonic/templates/radius_nss.conf.j2 +# RADIUS NSS Configuration File +# +# Debug: on|off|trace +# Default: off +# +# debug=on + +# +# User Privilege: +# Default: +# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/usr/bin/sonic-launch-shell +# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/usr/bin/sonic-launch-shell + +# Eg: +# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/usr/bin/sonic-launch-shell +# user_priv=7;pw_info=netops;gid=999;group=docker;shell=/usr/bin/sonic-launch-shell +# user_priv=1;pw_info=operator;gid=100;group=docker;shell=/usr/bin/sonic-launch-shell +# + +# many_to_one: +# y: Map RADIUS users to one local user per privilege. +# n: Create local user account on first successful authentication. +# Default: n +# + +# Eg: +# many_to_one=y +# + +# unconfirmed_disallow: +# y: Do not allow unconfirmed users (users created before authentication) +# n: Allow unconfirmed users. +# Default: n + +# Eg: +# unconfirmed_disallow=y +# + +# unconfirmed_ageout: +# : Wait time before purging unconfirmed users +# Default: 600 +# + +# Eg: +# unconfirmed_ageout=900 +# + +# unconfirmed_regexp: +# : The RE to match the command line of processes for which the +# creation of unconfirmed users are to be allowed. +# Default: (.*: \[priv\])|(.*: \[accepted\]) +# where: is the unconfirmed user. +# \ No newline at end of file diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/sshd b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/sshd new file mode 100644 index 000000000000..c025af353d6f --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/sshd @@ -0,0 +1,55 @@ +# PAM configuration for the Secure Shell service + +# Standard Un*x authentication. +@include common-auth-sonic + +# Disallow non-root logins when /etc/nologin exists. +account required pam_nologin.so + +# Uncomment and edit /etc/security/access.conf if you need to set complex +# access limits that are hard to express in sshd_config. +# account required pam_access.so + +# Standard Un*x authorization. +@include common-account + +# SELinux needs to be the first session rule. This ensures that any +# lingering context has been cleared. Without this it is possible that a +# module could execute code in the wrong domain. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close + +# Set the loginuid process attribute. +session required pam_loginuid.so + +# Create a new session keyring. +session optional pam_keyinit.so force revoke + +# Standard Un*x session setup and teardown. +@include common-session + +# Print the message of the day upon successful login. +# This includes a dynamically generated part from /run/motd.dynamic +# and a static (admin-editable) part from /etc/motd. +session optional pam_motd.so motd=/run/motd.dynamic +session optional pam_motd.so noupdate + +# Print the status of the user's mailbox upon successful login. +session optional pam_mail.so standard noenv # [1] + +# Set up user limits from /etc/security/limits.conf. +session required pam_limits.so + +# Read environment variables from /etc/environment and +# /etc/security/pam_env.conf. +session required pam_env.so # [1] +# In Debian 4.0 (etch), locale-related environment variables were moved to +# /etc/default/locale, so read that as well. +session required pam_env.so user_readenv=1 envfile=/etc/default/locale + +# SELinux needs to intervene at login time to ensure that the process starts +# in the proper default security context. Only sessions which are intended +# to run in the user's context should be run after this. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open + +# Standard Un*x password updating. +@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/sshd.old b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/sshd.old new file mode 100644 index 000000000000..d70b384bd9a3 --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/sshd.old @@ -0,0 +1,55 @@ +# PAM configuration for the Secure Shell service + +# Standard Un*x authentication. +@include common-auth + +# Disallow non-root logins when /etc/nologin exists. +account required pam_nologin.so + +# Uncomment and edit /etc/security/access.conf if you need to set complex +# access limits that are hard to express in sshd_config. +# account required pam_access.so + +# Standard Un*x authorization. +@include common-account + +# SELinux needs to be the first session rule. This ensures that any +# lingering context has been cleared. Without this it is possible that a +# module could execute code in the wrong domain. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close + +# Set the loginuid process attribute. +session required pam_loginuid.so + +# Create a new session keyring. +session optional pam_keyinit.so force revoke + +# Standard Un*x session setup and teardown. +@include common-session + +# Print the message of the day upon successful login. +# This includes a dynamically generated part from /run/motd.dynamic +# and a static (admin-editable) part from /etc/motd. +session optional pam_motd.so motd=/run/motd.dynamic +session optional pam_motd.so noupdate + +# Print the status of the user's mailbox upon successful login. +session optional pam_mail.so standard noenv # [1] + +# Set up user limits from /etc/security/limits.conf. +session required pam_limits.so + +# Read environment variables from /etc/environment and +# /etc/security/pam_env.conf. +session required pam_env.so # [1] +# In Debian 4.0 (etch), locale-related environment variables were moved to +# /etc/default/locale, so read that as well. +session required pam_env.so user_readenv=1 envfile=/etc/default/locale + +# SELinux needs to intervene at login time to ensure that the process starts +# in the proper default security context. Only sessions which are intended +# to run in the user's context should be run after this. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open + +# Standard Un*x password updating. +@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/tacplus_nss.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/tacplus_nss.conf new file mode 100644 index 000000000000..bffd6f70391f --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_disable_accounting/tacplus_nss.conf @@ -0,0 +1,41 @@ +# Configuration for libnss-tacplus + +# debug - If you want to open debug log, set it on +# Default: off +# debug=on + +# local_accounting - If you want to local accounting, set it +# Default: None +# local_accounting + +# tacacs_accounting - If you want to tacacs+ accounting, set it +# Default: None +# tacacs_accounting + +# local_authorization - If you want to local authorization, set it +# Default: None +# local_authorization +local_authorization + +# tacacs_authorization - If you want to tacacs+ authorization, set it +# Default: None +# tacacs_authorization + +# src_ip - set source address of TACACS+ protocol packets +# Default: None (auto source ip address) +# src_ip=2.2.2.2 + +# server - set ip address, tcp port, secret string and timeout for TACACS+ servers +# Default: None (no TACACS+ server) +# server=1.1.1.1:49,secret=test,timeout=3 +server=192.168.1.1:50,secret=dellsonic,timeout=10,vrf=default +server=192.168.1.2:51,secret=dellsonic1,timeout=15,vrf=mgmt + +# user_priv - set the map between TACACS+ user privilege and local user's passwd +# Default: +# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/bin/bash +# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/bin/bash + +# many_to_one - create one local user for many TACACS+ users which has the same privilege +# Default: many_to_one=n +# many_to_one=y diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/common-auth-sonic b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/common-auth-sonic new file mode 100644 index 000000000000..87af4cc5c6ac --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/common-auth-sonic @@ -0,0 +1,21 @@ +#THIS IS AN AUTO-GENERATED FILE +# +# /etc/pam.d/common-auth- authentication settings common to all services +# This file is included from other service-specific PAM config files, +# and should contain a list of the authentication modules that define +# the central authentication scheme for use on the system +# (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the +# traditional Unix authentication mechanisms. +# +# here are the per-package modules (the "Primary" block) + +auth [success=1 default=ignore] pam_unix.so nullok try_first_pass + +# +# here's the fallback if no module succeeds +auth requisite pam_deny.so +# prime the stack with a positive return value if there isn't one already; +# this avoids us returning an error just because nothing sets a success code +# since the modules above will each just jump around +auth required pam_permit.so +# and here are more per-package modules (the "Additional" block) diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/login b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/login new file mode 100644 index 000000000000..80ba6452813f --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/login @@ -0,0 +1,116 @@ +# +# The PAM configuration file for the Shadow `login' service +# + +# Enforce a minimal delay in case of failure (in microseconds). +# (Replaces the `FAIL_DELAY' setting from login.defs) +# Note that other modules may require another minimal delay. (for example, +# to disable any delay, you should add the nodelay option to pam_unix) +auth optional pam_faildelay.so delay=3000000 + +# Outputs an issue file prior to each login prompt (Replaces the +# ISSUE_FILE option from login.defs). Uncomment for use +# auth required pam_issue.so issue=/etc/issue + +# Disallows root logins except on tty's listed in /etc/securetty +# (Replaces the `CONSOLE' setting from login.defs) +# +# With the default control of this module: +# [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] +# root will not be prompted for a password on insecure lines. +# if an invalid username is entered, a password is prompted (but login +# will eventually be rejected) +# +# You can change it to a "requisite" module if you think root may mis-type +# her login and should not be prompted for a password in that case. But +# this will leave the system as vulnerable to user enumeration attacks. +# +# You can change it to a "required" module if you think it permits to +# guess valid user names of your system (invalid user names are considered +# as possibly being root on insecure lines), but root passwords may be +# communicated over insecure lines. +auth [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] pam_securetty.so + +# Disallows other than root logins when /etc/nologin exists +# (Replaces the `NOLOGINS_FILE' option from login.defs) +auth requisite pam_nologin.so + +# SELinux needs to be the first session rule. This ensures that any +# lingering context has been cleared. Without this it is possible +# that a module could execute code in the wrong domain. +# When the module is present, "required" would be sufficient (When SELinux +# is disabled, this returns success.) +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close + +# Sets the loginuid process attribute +session required pam_loginuid.so + +# SELinux needs to intervene at login time to ensure that the process +# starts in the proper default security context. Only sessions which are +# intended to run in the user's context should be run after this. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open +# When the module is present, "required" would be sufficient (When SELinux +# is disabled, this returns success.) + +# This module parses environment configuration file(s) +# and also allows you to use an extended config +# file /etc/security/pam_env.conf. +# +# parsing /etc/environment needs "readenv=1" +session required pam_env.so readenv=1 +# locale variables are also kept into /etc/default/locale in etch +# reading this file *in addition to /etc/environment* does not hurt +session required pam_env.so readenv=1 envfile=/etc/default/locale + +# Standard Un*x authentication. +@include common-auth-sonic + +# This allows certain extra groups to be granted to a user +# based on things like time of day, tty, service, and user. +# Please edit /etc/security/group.conf to fit your needs +# (Replaces the `CONSOLE_GROUPS' option in login.defs) +auth optional pam_group.so + +# Uncomment and edit /etc/security/time.conf if you need to set +# time restraint on logins. +# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs +# as well as /etc/porttime) +# account requisite pam_time.so + +# Uncomment and edit /etc/security/access.conf if you need to +# set access limits. +# (Replaces /etc/login.access file) +# account required pam_access.so + +# Sets up user limits according to /etc/security/limits.conf +# (Replaces the use of /etc/limits in old login) +session required pam_limits.so + +# Prints the last login info upon successful login +# (Replaces the `LASTLOG_ENAB' option from login.defs) +session optional pam_lastlog.so + +# Prints the message of the day upon successful login. +# (Replaces the `MOTD_FILE' option in login.defs) +# This includes a dynamically generated part from /run/motd.dynamic +# and a static (admin-editable) part from /etc/motd. +session optional pam_motd.so motd=/run/motd.dynamic +session optional pam_motd.so noupdate + +# Prints the status of the user's mailbox upon successful login +# (Replaces the `MAIL_CHECK_ENAB' option from login.defs). +# +# This also defines the MAIL environment variable +# However, userdel also needs MAIL_DIR and MAIL_FILE variables +# in /etc/login.defs to make sure that removing a user +# also removes the user's mail spool file. +# See comments in /etc/login.defs +session optional pam_mail.so standard + +# Create a new session keyring. +session optional pam_keyinit.so force revoke + +# Standard Un*x account and session +@include common-account +@include common-session +@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/login.old b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/login.old new file mode 100644 index 000000000000..07ff95407ccd --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/login.old @@ -0,0 +1,116 @@ +# +# The PAM configuration file for the Shadow `login' service +# + +# Enforce a minimal delay in case of failure (in microseconds). +# (Replaces the `FAIL_DELAY' setting from login.defs) +# Note that other modules may require another minimal delay. (for example, +# to disable any delay, you should add the nodelay option to pam_unix) +auth optional pam_faildelay.so delay=3000000 + +# Outputs an issue file prior to each login prompt (Replaces the +# ISSUE_FILE option from login.defs). Uncomment for use +# auth required pam_issue.so issue=/etc/issue + +# Disallows root logins except on tty's listed in /etc/securetty +# (Replaces the `CONSOLE' setting from login.defs) +# +# With the default control of this module: +# [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] +# root will not be prompted for a password on insecure lines. +# if an invalid username is entered, a password is prompted (but login +# will eventually be rejected) +# +# You can change it to a "requisite" module if you think root may mis-type +# her login and should not be prompted for a password in that case. But +# this will leave the system as vulnerable to user enumeration attacks. +# +# You can change it to a "required" module if you think it permits to +# guess valid user names of your system (invalid user names are considered +# as possibly being root on insecure lines), but root passwords may be +# communicated over insecure lines. +auth [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] pam_securetty.so + +# Disallows other than root logins when /etc/nologin exists +# (Replaces the `NOLOGINS_FILE' option from login.defs) +auth requisite pam_nologin.so + +# SELinux needs to be the first session rule. This ensures that any +# lingering context has been cleared. Without this it is possible +# that a module could execute code in the wrong domain. +# When the module is present, "required" would be sufficient (When SELinux +# is disabled, this returns success.) +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close + +# Sets the loginuid process attribute +session required pam_loginuid.so + +# SELinux needs to intervene at login time to ensure that the process +# starts in the proper default security context. Only sessions which are +# intended to run in the user's context should be run after this. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open +# When the module is present, "required" would be sufficient (When SELinux +# is disabled, this returns success.) + +# This module parses environment configuration file(s) +# and also allows you to use an extended config +# file /etc/security/pam_env.conf. +# +# parsing /etc/environment needs "readenv=1" +session required pam_env.so readenv=1 +# locale variables are also kept into /etc/default/locale in etch +# reading this file *in addition to /etc/environment* does not hurt +session required pam_env.so readenv=1 envfile=/etc/default/locale + +# Standard Un*x authentication. +@include common-auth + +# This allows certain extra groups to be granted to a user +# based on things like time of day, tty, service, and user. +# Please edit /etc/security/group.conf to fit your needs +# (Replaces the `CONSOLE_GROUPS' option in login.defs) +auth optional pam_group.so + +# Uncomment and edit /etc/security/time.conf if you need to set +# time restraint on logins. +# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs +# as well as /etc/porttime) +# account requisite pam_time.so + +# Uncomment and edit /etc/security/access.conf if you need to +# set access limits. +# (Replaces /etc/login.access file) +# account required pam_access.so + +# Sets up user limits according to /etc/security/limits.conf +# (Replaces the use of /etc/limits in old login) +session required pam_limits.so + +# Prints the last login info upon successful login +# (Replaces the `LASTLOG_ENAB' option from login.defs) +session optional pam_lastlog.so + +# Prints the message of the day upon successful login. +# (Replaces the `MOTD_FILE' option in login.defs) +# This includes a dynamically generated part from /run/motd.dynamic +# and a static (admin-editable) part from /etc/motd. +session optional pam_motd.so motd=/run/motd.dynamic +session optional pam_motd.so noupdate + +# Prints the status of the user's mailbox upon successful login +# (Replaces the `MAIL_CHECK_ENAB' option from login.defs). +# +# This also defines the MAIL environment variable +# However, userdel also needs MAIL_DIR and MAIL_FILE variables +# in /etc/login.defs to make sure that removing a user +# also removes the user's mail spool file. +# See comments in /etc/login.defs +session optional pam_mail.so standard + +# Create a new session keyring. +session optional pam_keyinit.so force revoke + +# Standard Un*x account and session +@include common-account +@include common-session +@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/radius_nss.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/radius_nss.conf new file mode 100644 index 000000000000..1567b6e645e0 --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/radius_nss.conf @@ -0,0 +1,55 @@ +#THIS IS AN AUTO-GENERATED FILE +# Generated from: /usr/share/sonic/templates/radius_nss.conf.j2 +# RADIUS NSS Configuration File +# +# Debug: on|off|trace +# Default: off +# +# debug=on + +# +# User Privilege: +# Default: +# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/usr/bin/sonic-launch-shell +# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/usr/bin/sonic-launch-shell + +# Eg: +# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/usr/bin/sonic-launch-shell +# user_priv=7;pw_info=netops;gid=999;group=docker;shell=/usr/bin/sonic-launch-shell +# user_priv=1;pw_info=operator;gid=100;group=docker;shell=/usr/bin/sonic-launch-shell +# + +# many_to_one: +# y: Map RADIUS users to one local user per privilege. +# n: Create local user account on first successful authentication. +# Default: n +# + +# Eg: +# many_to_one=y +# + +# unconfirmed_disallow: +# y: Do not allow unconfirmed users (users created before authentication) +# n: Allow unconfirmed users. +# Default: n + +# Eg: +# unconfirmed_disallow=y +# + +# unconfirmed_ageout: +# : Wait time before purging unconfirmed users +# Default: 600 +# + +# Eg: +# unconfirmed_ageout=900 +# + +# unconfirmed_regexp: +# : The RE to match the command line of processes for which the +# creation of unconfirmed users are to be allowed. +# Default: (.*: \[priv\])|(.*: \[accepted\]) +# where: is the unconfirmed user. +# \ No newline at end of file diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/sshd b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/sshd new file mode 100644 index 000000000000..c025af353d6f --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/sshd @@ -0,0 +1,55 @@ +# PAM configuration for the Secure Shell service + +# Standard Un*x authentication. +@include common-auth-sonic + +# Disallow non-root logins when /etc/nologin exists. +account required pam_nologin.so + +# Uncomment and edit /etc/security/access.conf if you need to set complex +# access limits that are hard to express in sshd_config. +# account required pam_access.so + +# Standard Un*x authorization. +@include common-account + +# SELinux needs to be the first session rule. This ensures that any +# lingering context has been cleared. Without this it is possible that a +# module could execute code in the wrong domain. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close + +# Set the loginuid process attribute. +session required pam_loginuid.so + +# Create a new session keyring. +session optional pam_keyinit.so force revoke + +# Standard Un*x session setup and teardown. +@include common-session + +# Print the message of the day upon successful login. +# This includes a dynamically generated part from /run/motd.dynamic +# and a static (admin-editable) part from /etc/motd. +session optional pam_motd.so motd=/run/motd.dynamic +session optional pam_motd.so noupdate + +# Print the status of the user's mailbox upon successful login. +session optional pam_mail.so standard noenv # [1] + +# Set up user limits from /etc/security/limits.conf. +session required pam_limits.so + +# Read environment variables from /etc/environment and +# /etc/security/pam_env.conf. +session required pam_env.so # [1] +# In Debian 4.0 (etch), locale-related environment variables were moved to +# /etc/default/locale, so read that as well. +session required pam_env.so user_readenv=1 envfile=/etc/default/locale + +# SELinux needs to intervene at login time to ensure that the process starts +# in the proper default security context. Only sessions which are intended +# to run in the user's context should be run after this. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open + +# Standard Un*x password updating. +@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/sshd.old b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/sshd.old new file mode 100644 index 000000000000..d70b384bd9a3 --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/sshd.old @@ -0,0 +1,55 @@ +# PAM configuration for the Secure Shell service + +# Standard Un*x authentication. +@include common-auth + +# Disallow non-root logins when /etc/nologin exists. +account required pam_nologin.so + +# Uncomment and edit /etc/security/access.conf if you need to set complex +# access limits that are hard to express in sshd_config. +# account required pam_access.so + +# Standard Un*x authorization. +@include common-account + +# SELinux needs to be the first session rule. This ensures that any +# lingering context has been cleared. Without this it is possible that a +# module could execute code in the wrong domain. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close + +# Set the loginuid process attribute. +session required pam_loginuid.so + +# Create a new session keyring. +session optional pam_keyinit.so force revoke + +# Standard Un*x session setup and teardown. +@include common-session + +# Print the message of the day upon successful login. +# This includes a dynamically generated part from /run/motd.dynamic +# and a static (admin-editable) part from /etc/motd. +session optional pam_motd.so motd=/run/motd.dynamic +session optional pam_motd.so noupdate + +# Print the status of the user's mailbox upon successful login. +session optional pam_mail.so standard noenv # [1] + +# Set up user limits from /etc/security/limits.conf. +session required pam_limits.so + +# Read environment variables from /etc/environment and +# /etc/security/pam_env.conf. +session required pam_env.so # [1] +# In Debian 4.0 (etch), locale-related environment variables were moved to +# /etc/default/locale, so read that as well. +session required pam_env.so user_readenv=1 envfile=/etc/default/locale + +# SELinux needs to intervene at login time to ensure that the process starts +# in the proper default security context. Only sessions which are intended +# to run in the user's context should be run after this. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open + +# Standard Un*x password updating. +@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/tacplus_nss.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/tacplus_nss.conf new file mode 100644 index 000000000000..d24cab57d1f4 --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local/tacplus_nss.conf @@ -0,0 +1,42 @@ +# Configuration for libnss-tacplus + +# debug - If you want to open debug log, set it on +# Default: off +# debug=on + +# local_accounting - If you want to local accounting, set it +# Default: None +# local_accounting +local_accounting + +# tacacs_accounting - If you want to tacacs+ accounting, set it +# Default: None +# tacacs_accounting + +# local_authorization - If you want to local authorization, set it +# Default: None +# local_authorization +local_authorization + +# tacacs_authorization - If you want to tacacs+ authorization, set it +# Default: None +# tacacs_authorization + +# src_ip - set source address of TACACS+ protocol packets +# Default: None (auto source ip address) +# src_ip=2.2.2.2 + +# server - set ip address, tcp port, secret string and timeout for TACACS+ servers +# Default: None (no TACACS+ server) +# server=1.1.1.1:49,secret=test,timeout=3 +server=192.168.1.1:50,secret=dellsonic,timeout=10,vrf=default +server=192.168.1.2:51,secret=dellsonic1,timeout=15,vrf=mgmt + +# user_priv - set the map between TACACS+ user privilege and local user's passwd +# Default: +# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/bin/bash +# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/bin/bash + +# many_to_one - create one local user for many TACACS+ users which has the same privilege +# Default: many_to_one=n +# many_to_one=y diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/common-auth-sonic b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/common-auth-sonic new file mode 100644 index 000000000000..87af4cc5c6ac --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/common-auth-sonic @@ -0,0 +1,21 @@ +#THIS IS AN AUTO-GENERATED FILE +# +# /etc/pam.d/common-auth- authentication settings common to all services +# This file is included from other service-specific PAM config files, +# and should contain a list of the authentication modules that define +# the central authentication scheme for use on the system +# (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the +# traditional Unix authentication mechanisms. +# +# here are the per-package modules (the "Primary" block) + +auth [success=1 default=ignore] pam_unix.so nullok try_first_pass + +# +# here's the fallback if no module succeeds +auth requisite pam_deny.so +# prime the stack with a positive return value if there isn't one already; +# this avoids us returning an error just because nothing sets a success code +# since the modules above will each just jump around +auth required pam_permit.so +# and here are more per-package modules (the "Additional" block) diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/login b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/login new file mode 100644 index 000000000000..80ba6452813f --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/login @@ -0,0 +1,116 @@ +# +# The PAM configuration file for the Shadow `login' service +# + +# Enforce a minimal delay in case of failure (in microseconds). +# (Replaces the `FAIL_DELAY' setting from login.defs) +# Note that other modules may require another minimal delay. (for example, +# to disable any delay, you should add the nodelay option to pam_unix) +auth optional pam_faildelay.so delay=3000000 + +# Outputs an issue file prior to each login prompt (Replaces the +# ISSUE_FILE option from login.defs). Uncomment for use +# auth required pam_issue.so issue=/etc/issue + +# Disallows root logins except on tty's listed in /etc/securetty +# (Replaces the `CONSOLE' setting from login.defs) +# +# With the default control of this module: +# [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] +# root will not be prompted for a password on insecure lines. +# if an invalid username is entered, a password is prompted (but login +# will eventually be rejected) +# +# You can change it to a "requisite" module if you think root may mis-type +# her login and should not be prompted for a password in that case. But +# this will leave the system as vulnerable to user enumeration attacks. +# +# You can change it to a "required" module if you think it permits to +# guess valid user names of your system (invalid user names are considered +# as possibly being root on insecure lines), but root passwords may be +# communicated over insecure lines. +auth [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] pam_securetty.so + +# Disallows other than root logins when /etc/nologin exists +# (Replaces the `NOLOGINS_FILE' option from login.defs) +auth requisite pam_nologin.so + +# SELinux needs to be the first session rule. This ensures that any +# lingering context has been cleared. Without this it is possible +# that a module could execute code in the wrong domain. +# When the module is present, "required" would be sufficient (When SELinux +# is disabled, this returns success.) +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close + +# Sets the loginuid process attribute +session required pam_loginuid.so + +# SELinux needs to intervene at login time to ensure that the process +# starts in the proper default security context. Only sessions which are +# intended to run in the user's context should be run after this. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open +# When the module is present, "required" would be sufficient (When SELinux +# is disabled, this returns success.) + +# This module parses environment configuration file(s) +# and also allows you to use an extended config +# file /etc/security/pam_env.conf. +# +# parsing /etc/environment needs "readenv=1" +session required pam_env.so readenv=1 +# locale variables are also kept into /etc/default/locale in etch +# reading this file *in addition to /etc/environment* does not hurt +session required pam_env.so readenv=1 envfile=/etc/default/locale + +# Standard Un*x authentication. +@include common-auth-sonic + +# This allows certain extra groups to be granted to a user +# based on things like time of day, tty, service, and user. +# Please edit /etc/security/group.conf to fit your needs +# (Replaces the `CONSOLE_GROUPS' option in login.defs) +auth optional pam_group.so + +# Uncomment and edit /etc/security/time.conf if you need to set +# time restraint on logins. +# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs +# as well as /etc/porttime) +# account requisite pam_time.so + +# Uncomment and edit /etc/security/access.conf if you need to +# set access limits. +# (Replaces /etc/login.access file) +# account required pam_access.so + +# Sets up user limits according to /etc/security/limits.conf +# (Replaces the use of /etc/limits in old login) +session required pam_limits.so + +# Prints the last login info upon successful login +# (Replaces the `LASTLOG_ENAB' option from login.defs) +session optional pam_lastlog.so + +# Prints the message of the day upon successful login. +# (Replaces the `MOTD_FILE' option in login.defs) +# This includes a dynamically generated part from /run/motd.dynamic +# and a static (admin-editable) part from /etc/motd. +session optional pam_motd.so motd=/run/motd.dynamic +session optional pam_motd.so noupdate + +# Prints the status of the user's mailbox upon successful login +# (Replaces the `MAIL_CHECK_ENAB' option from login.defs). +# +# This also defines the MAIL environment variable +# However, userdel also needs MAIL_DIR and MAIL_FILE variables +# in /etc/login.defs to make sure that removing a user +# also removes the user's mail spool file. +# See comments in /etc/login.defs +session optional pam_mail.so standard + +# Create a new session keyring. +session optional pam_keyinit.so force revoke + +# Standard Un*x account and session +@include common-account +@include common-session +@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/login.old b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/login.old new file mode 100644 index 000000000000..07ff95407ccd --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/login.old @@ -0,0 +1,116 @@ +# +# The PAM configuration file for the Shadow `login' service +# + +# Enforce a minimal delay in case of failure (in microseconds). +# (Replaces the `FAIL_DELAY' setting from login.defs) +# Note that other modules may require another minimal delay. (for example, +# to disable any delay, you should add the nodelay option to pam_unix) +auth optional pam_faildelay.so delay=3000000 + +# Outputs an issue file prior to each login prompt (Replaces the +# ISSUE_FILE option from login.defs). Uncomment for use +# auth required pam_issue.so issue=/etc/issue + +# Disallows root logins except on tty's listed in /etc/securetty +# (Replaces the `CONSOLE' setting from login.defs) +# +# With the default control of this module: +# [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] +# root will not be prompted for a password on insecure lines. +# if an invalid username is entered, a password is prompted (but login +# will eventually be rejected) +# +# You can change it to a "requisite" module if you think root may mis-type +# her login and should not be prompted for a password in that case. But +# this will leave the system as vulnerable to user enumeration attacks. +# +# You can change it to a "required" module if you think it permits to +# guess valid user names of your system (invalid user names are considered +# as possibly being root on insecure lines), but root passwords may be +# communicated over insecure lines. +auth [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] pam_securetty.so + +# Disallows other than root logins when /etc/nologin exists +# (Replaces the `NOLOGINS_FILE' option from login.defs) +auth requisite pam_nologin.so + +# SELinux needs to be the first session rule. This ensures that any +# lingering context has been cleared. Without this it is possible +# that a module could execute code in the wrong domain. +# When the module is present, "required" would be sufficient (When SELinux +# is disabled, this returns success.) +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close + +# Sets the loginuid process attribute +session required pam_loginuid.so + +# SELinux needs to intervene at login time to ensure that the process +# starts in the proper default security context. Only sessions which are +# intended to run in the user's context should be run after this. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open +# When the module is present, "required" would be sufficient (When SELinux +# is disabled, this returns success.) + +# This module parses environment configuration file(s) +# and also allows you to use an extended config +# file /etc/security/pam_env.conf. +# +# parsing /etc/environment needs "readenv=1" +session required pam_env.so readenv=1 +# locale variables are also kept into /etc/default/locale in etch +# reading this file *in addition to /etc/environment* does not hurt +session required pam_env.so readenv=1 envfile=/etc/default/locale + +# Standard Un*x authentication. +@include common-auth + +# This allows certain extra groups to be granted to a user +# based on things like time of day, tty, service, and user. +# Please edit /etc/security/group.conf to fit your needs +# (Replaces the `CONSOLE_GROUPS' option in login.defs) +auth optional pam_group.so + +# Uncomment and edit /etc/security/time.conf if you need to set +# time restraint on logins. +# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs +# as well as /etc/porttime) +# account requisite pam_time.so + +# Uncomment and edit /etc/security/access.conf if you need to +# set access limits. +# (Replaces /etc/login.access file) +# account required pam_access.so + +# Sets up user limits according to /etc/security/limits.conf +# (Replaces the use of /etc/limits in old login) +session required pam_limits.so + +# Prints the last login info upon successful login +# (Replaces the `LASTLOG_ENAB' option from login.defs) +session optional pam_lastlog.so + +# Prints the message of the day upon successful login. +# (Replaces the `MOTD_FILE' option in login.defs) +# This includes a dynamically generated part from /run/motd.dynamic +# and a static (admin-editable) part from /etc/motd. +session optional pam_motd.so motd=/run/motd.dynamic +session optional pam_motd.so noupdate + +# Prints the status of the user's mailbox upon successful login +# (Replaces the `MAIL_CHECK_ENAB' option from login.defs). +# +# This also defines the MAIL environment variable +# However, userdel also needs MAIL_DIR and MAIL_FILE variables +# in /etc/login.defs to make sure that removing a user +# also removes the user's mail spool file. +# See comments in /etc/login.defs +session optional pam_mail.so standard + +# Create a new session keyring. +session optional pam_keyinit.so force revoke + +# Standard Un*x account and session +@include common-account +@include common-session +@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/radius_nss.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/radius_nss.conf new file mode 100644 index 000000000000..1567b6e645e0 --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/radius_nss.conf @@ -0,0 +1,55 @@ +#THIS IS AN AUTO-GENERATED FILE +# Generated from: /usr/share/sonic/templates/radius_nss.conf.j2 +# RADIUS NSS Configuration File +# +# Debug: on|off|trace +# Default: off +# +# debug=on + +# +# User Privilege: +# Default: +# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/usr/bin/sonic-launch-shell +# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/usr/bin/sonic-launch-shell + +# Eg: +# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/usr/bin/sonic-launch-shell +# user_priv=7;pw_info=netops;gid=999;group=docker;shell=/usr/bin/sonic-launch-shell +# user_priv=1;pw_info=operator;gid=100;group=docker;shell=/usr/bin/sonic-launch-shell +# + +# many_to_one: +# y: Map RADIUS users to one local user per privilege. +# n: Create local user account on first successful authentication. +# Default: n +# + +# Eg: +# many_to_one=y +# + +# unconfirmed_disallow: +# y: Do not allow unconfirmed users (users created before authentication) +# n: Allow unconfirmed users. +# Default: n + +# Eg: +# unconfirmed_disallow=y +# + +# unconfirmed_ageout: +# : Wait time before purging unconfirmed users +# Default: 600 +# + +# Eg: +# unconfirmed_ageout=900 +# + +# unconfirmed_regexp: +# : The RE to match the command line of processes for which the +# creation of unconfirmed users are to be allowed. +# Default: (.*: \[priv\])|(.*: \[accepted\]) +# where: is the unconfirmed user. +# \ No newline at end of file diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/sshd b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/sshd new file mode 100644 index 000000000000..c025af353d6f --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/sshd @@ -0,0 +1,55 @@ +# PAM configuration for the Secure Shell service + +# Standard Un*x authentication. +@include common-auth-sonic + +# Disallow non-root logins when /etc/nologin exists. +account required pam_nologin.so + +# Uncomment and edit /etc/security/access.conf if you need to set complex +# access limits that are hard to express in sshd_config. +# account required pam_access.so + +# Standard Un*x authorization. +@include common-account + +# SELinux needs to be the first session rule. This ensures that any +# lingering context has been cleared. Without this it is possible that a +# module could execute code in the wrong domain. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close + +# Set the loginuid process attribute. +session required pam_loginuid.so + +# Create a new session keyring. +session optional pam_keyinit.so force revoke + +# Standard Un*x session setup and teardown. +@include common-session + +# Print the message of the day upon successful login. +# This includes a dynamically generated part from /run/motd.dynamic +# and a static (admin-editable) part from /etc/motd. +session optional pam_motd.so motd=/run/motd.dynamic +session optional pam_motd.so noupdate + +# Print the status of the user's mailbox upon successful login. +session optional pam_mail.so standard noenv # [1] + +# Set up user limits from /etc/security/limits.conf. +session required pam_limits.so + +# Read environment variables from /etc/environment and +# /etc/security/pam_env.conf. +session required pam_env.so # [1] +# In Debian 4.0 (etch), locale-related environment variables were moved to +# /etc/default/locale, so read that as well. +session required pam_env.so user_readenv=1 envfile=/etc/default/locale + +# SELinux needs to intervene at login time to ensure that the process starts +# in the proper default security context. Only sessions which are intended +# to run in the user's context should be run after this. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open + +# Standard Un*x password updating. +@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/sshd.old b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/sshd.old new file mode 100644 index 000000000000..d70b384bd9a3 --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/sshd.old @@ -0,0 +1,55 @@ +# PAM configuration for the Secure Shell service + +# Standard Un*x authentication. +@include common-auth + +# Disallow non-root logins when /etc/nologin exists. +account required pam_nologin.so + +# Uncomment and edit /etc/security/access.conf if you need to set complex +# access limits that are hard to express in sshd_config. +# account required pam_access.so + +# Standard Un*x authorization. +@include common-account + +# SELinux needs to be the first session rule. This ensures that any +# lingering context has been cleared. Without this it is possible that a +# module could execute code in the wrong domain. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close + +# Set the loginuid process attribute. +session required pam_loginuid.so + +# Create a new session keyring. +session optional pam_keyinit.so force revoke + +# Standard Un*x session setup and teardown. +@include common-session + +# Print the message of the day upon successful login. +# This includes a dynamically generated part from /run/motd.dynamic +# and a static (admin-editable) part from /etc/motd. +session optional pam_motd.so motd=/run/motd.dynamic +session optional pam_motd.so noupdate + +# Print the status of the user's mailbox upon successful login. +session optional pam_mail.so standard noenv # [1] + +# Set up user limits from /etc/security/limits.conf. +session required pam_limits.so + +# Read environment variables from /etc/environment and +# /etc/security/pam_env.conf. +session required pam_env.so # [1] +# In Debian 4.0 (etch), locale-related environment variables were moved to +# /etc/default/locale, so read that as well. +session required pam_env.so user_readenv=1 envfile=/etc/default/locale + +# SELinux needs to intervene at login time to ensure that the process starts +# in the proper default security context. Only sessions which are intended +# to run in the user's context should be run after this. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open + +# Standard Un*x password updating. +@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/tacplus_nss.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/tacplus_nss.conf new file mode 100644 index 000000000000..431cbcec0aca --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_local_and_tacacs/tacplus_nss.conf @@ -0,0 +1,44 @@ +# Configuration for libnss-tacplus + +# debug - If you want to open debug log, set it on +# Default: off +# debug=on + +# local_accounting - If you want to local accounting, set it +# Default: None +# local_accounting +local_accounting + +# tacacs_accounting - If you want to tacacs+ accounting, set it +# Default: None +# tacacs_accounting +tacacs_accounting + +# local_authorization - If you want to local authorization, set it +# Default: None +# local_authorization +local_authorization + +# tacacs_authorization - If you want to tacacs+ authorization, set it +# Default: None +# tacacs_authorization +tacacs_authorization + +# src_ip - set source address of TACACS+ protocol packets +# Default: None (auto source ip address) +# src_ip=2.2.2.2 + +# server - set ip address, tcp port, secret string and timeout for TACACS+ servers +# Default: None (no TACACS+ server) +# server=1.1.1.1:49,secret=test,timeout=3 +server=192.168.1.1:50,secret=dellsonic,timeout=10,vrf=default +server=192.168.1.2:51,secret=dellsonic1,timeout=15,vrf=mgmt + +# user_priv - set the map between TACACS+ user privilege and local user's passwd +# Default: +# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/bin/bash +# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/bin/bash + +# many_to_one - create one local user for many TACACS+ users which has the same privilege +# Default: many_to_one=n +# many_to_one=y diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/common-auth-sonic b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/common-auth-sonic new file mode 100644 index 000000000000..87af4cc5c6ac --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/common-auth-sonic @@ -0,0 +1,21 @@ +#THIS IS AN AUTO-GENERATED FILE +# +# /etc/pam.d/common-auth- authentication settings common to all services +# This file is included from other service-specific PAM config files, +# and should contain a list of the authentication modules that define +# the central authentication scheme for use on the system +# (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the +# traditional Unix authentication mechanisms. +# +# here are the per-package modules (the "Primary" block) + +auth [success=1 default=ignore] pam_unix.so nullok try_first_pass + +# +# here's the fallback if no module succeeds +auth requisite pam_deny.so +# prime the stack with a positive return value if there isn't one already; +# this avoids us returning an error just because nothing sets a success code +# since the modules above will each just jump around +auth required pam_permit.so +# and here are more per-package modules (the "Additional" block) diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/login b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/login new file mode 100644 index 000000000000..80ba6452813f --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/login @@ -0,0 +1,116 @@ +# +# The PAM configuration file for the Shadow `login' service +# + +# Enforce a minimal delay in case of failure (in microseconds). +# (Replaces the `FAIL_DELAY' setting from login.defs) +# Note that other modules may require another minimal delay. (for example, +# to disable any delay, you should add the nodelay option to pam_unix) +auth optional pam_faildelay.so delay=3000000 + +# Outputs an issue file prior to each login prompt (Replaces the +# ISSUE_FILE option from login.defs). Uncomment for use +# auth required pam_issue.so issue=/etc/issue + +# Disallows root logins except on tty's listed in /etc/securetty +# (Replaces the `CONSOLE' setting from login.defs) +# +# With the default control of this module: +# [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] +# root will not be prompted for a password on insecure lines. +# if an invalid username is entered, a password is prompted (but login +# will eventually be rejected) +# +# You can change it to a "requisite" module if you think root may mis-type +# her login and should not be prompted for a password in that case. But +# this will leave the system as vulnerable to user enumeration attacks. +# +# You can change it to a "required" module if you think it permits to +# guess valid user names of your system (invalid user names are considered +# as possibly being root on insecure lines), but root passwords may be +# communicated over insecure lines. +auth [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] pam_securetty.so + +# Disallows other than root logins when /etc/nologin exists +# (Replaces the `NOLOGINS_FILE' option from login.defs) +auth requisite pam_nologin.so + +# SELinux needs to be the first session rule. This ensures that any +# lingering context has been cleared. Without this it is possible +# that a module could execute code in the wrong domain. +# When the module is present, "required" would be sufficient (When SELinux +# is disabled, this returns success.) +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close + +# Sets the loginuid process attribute +session required pam_loginuid.so + +# SELinux needs to intervene at login time to ensure that the process +# starts in the proper default security context. Only sessions which are +# intended to run in the user's context should be run after this. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open +# When the module is present, "required" would be sufficient (When SELinux +# is disabled, this returns success.) + +# This module parses environment configuration file(s) +# and also allows you to use an extended config +# file /etc/security/pam_env.conf. +# +# parsing /etc/environment needs "readenv=1" +session required pam_env.so readenv=1 +# locale variables are also kept into /etc/default/locale in etch +# reading this file *in addition to /etc/environment* does not hurt +session required pam_env.so readenv=1 envfile=/etc/default/locale + +# Standard Un*x authentication. +@include common-auth-sonic + +# This allows certain extra groups to be granted to a user +# based on things like time of day, tty, service, and user. +# Please edit /etc/security/group.conf to fit your needs +# (Replaces the `CONSOLE_GROUPS' option in login.defs) +auth optional pam_group.so + +# Uncomment and edit /etc/security/time.conf if you need to set +# time restraint on logins. +# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs +# as well as /etc/porttime) +# account requisite pam_time.so + +# Uncomment and edit /etc/security/access.conf if you need to +# set access limits. +# (Replaces /etc/login.access file) +# account required pam_access.so + +# Sets up user limits according to /etc/security/limits.conf +# (Replaces the use of /etc/limits in old login) +session required pam_limits.so + +# Prints the last login info upon successful login +# (Replaces the `LASTLOG_ENAB' option from login.defs) +session optional pam_lastlog.so + +# Prints the message of the day upon successful login. +# (Replaces the `MOTD_FILE' option in login.defs) +# This includes a dynamically generated part from /run/motd.dynamic +# and a static (admin-editable) part from /etc/motd. +session optional pam_motd.so motd=/run/motd.dynamic +session optional pam_motd.so noupdate + +# Prints the status of the user's mailbox upon successful login +# (Replaces the `MAIL_CHECK_ENAB' option from login.defs). +# +# This also defines the MAIL environment variable +# However, userdel also needs MAIL_DIR and MAIL_FILE variables +# in /etc/login.defs to make sure that removing a user +# also removes the user's mail spool file. +# See comments in /etc/login.defs +session optional pam_mail.so standard + +# Create a new session keyring. +session optional pam_keyinit.so force revoke + +# Standard Un*x account and session +@include common-account +@include common-session +@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/login.old b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/login.old new file mode 100644 index 000000000000..07ff95407ccd --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/login.old @@ -0,0 +1,116 @@ +# +# The PAM configuration file for the Shadow `login' service +# + +# Enforce a minimal delay in case of failure (in microseconds). +# (Replaces the `FAIL_DELAY' setting from login.defs) +# Note that other modules may require another minimal delay. (for example, +# to disable any delay, you should add the nodelay option to pam_unix) +auth optional pam_faildelay.so delay=3000000 + +# Outputs an issue file prior to each login prompt (Replaces the +# ISSUE_FILE option from login.defs). Uncomment for use +# auth required pam_issue.so issue=/etc/issue + +# Disallows root logins except on tty's listed in /etc/securetty +# (Replaces the `CONSOLE' setting from login.defs) +# +# With the default control of this module: +# [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] +# root will not be prompted for a password on insecure lines. +# if an invalid username is entered, a password is prompted (but login +# will eventually be rejected) +# +# You can change it to a "requisite" module if you think root may mis-type +# her login and should not be prompted for a password in that case. But +# this will leave the system as vulnerable to user enumeration attacks. +# +# You can change it to a "required" module if you think it permits to +# guess valid user names of your system (invalid user names are considered +# as possibly being root on insecure lines), but root passwords may be +# communicated over insecure lines. +auth [success=ok new_authtok_reqd=ok ignore=ignore user_unknown=bad default=die] pam_securetty.so + +# Disallows other than root logins when /etc/nologin exists +# (Replaces the `NOLOGINS_FILE' option from login.defs) +auth requisite pam_nologin.so + +# SELinux needs to be the first session rule. This ensures that any +# lingering context has been cleared. Without this it is possible +# that a module could execute code in the wrong domain. +# When the module is present, "required" would be sufficient (When SELinux +# is disabled, this returns success.) +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close + +# Sets the loginuid process attribute +session required pam_loginuid.so + +# SELinux needs to intervene at login time to ensure that the process +# starts in the proper default security context. Only sessions which are +# intended to run in the user's context should be run after this. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open +# When the module is present, "required" would be sufficient (When SELinux +# is disabled, this returns success.) + +# This module parses environment configuration file(s) +# and also allows you to use an extended config +# file /etc/security/pam_env.conf. +# +# parsing /etc/environment needs "readenv=1" +session required pam_env.so readenv=1 +# locale variables are also kept into /etc/default/locale in etch +# reading this file *in addition to /etc/environment* does not hurt +session required pam_env.so readenv=1 envfile=/etc/default/locale + +# Standard Un*x authentication. +@include common-auth + +# This allows certain extra groups to be granted to a user +# based on things like time of day, tty, service, and user. +# Please edit /etc/security/group.conf to fit your needs +# (Replaces the `CONSOLE_GROUPS' option in login.defs) +auth optional pam_group.so + +# Uncomment and edit /etc/security/time.conf if you need to set +# time restraint on logins. +# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs +# as well as /etc/porttime) +# account requisite pam_time.so + +# Uncomment and edit /etc/security/access.conf if you need to +# set access limits. +# (Replaces /etc/login.access file) +# account required pam_access.so + +# Sets up user limits according to /etc/security/limits.conf +# (Replaces the use of /etc/limits in old login) +session required pam_limits.so + +# Prints the last login info upon successful login +# (Replaces the `LASTLOG_ENAB' option from login.defs) +session optional pam_lastlog.so + +# Prints the message of the day upon successful login. +# (Replaces the `MOTD_FILE' option in login.defs) +# This includes a dynamically generated part from /run/motd.dynamic +# and a static (admin-editable) part from /etc/motd. +session optional pam_motd.so motd=/run/motd.dynamic +session optional pam_motd.so noupdate + +# Prints the status of the user's mailbox upon successful login +# (Replaces the `MAIL_CHECK_ENAB' option from login.defs). +# +# This also defines the MAIL environment variable +# However, userdel also needs MAIL_DIR and MAIL_FILE variables +# in /etc/login.defs to make sure that removing a user +# also removes the user's mail spool file. +# See comments in /etc/login.defs +session optional pam_mail.so standard + +# Create a new session keyring. +session optional pam_keyinit.so force revoke + +# Standard Un*x account and session +@include common-account +@include common-session +@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/radius_nss.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/radius_nss.conf new file mode 100644 index 000000000000..1567b6e645e0 --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/radius_nss.conf @@ -0,0 +1,55 @@ +#THIS IS AN AUTO-GENERATED FILE +# Generated from: /usr/share/sonic/templates/radius_nss.conf.j2 +# RADIUS NSS Configuration File +# +# Debug: on|off|trace +# Default: off +# +# debug=on + +# +# User Privilege: +# Default: +# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/usr/bin/sonic-launch-shell +# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/usr/bin/sonic-launch-shell + +# Eg: +# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/usr/bin/sonic-launch-shell +# user_priv=7;pw_info=netops;gid=999;group=docker;shell=/usr/bin/sonic-launch-shell +# user_priv=1;pw_info=operator;gid=100;group=docker;shell=/usr/bin/sonic-launch-shell +# + +# many_to_one: +# y: Map RADIUS users to one local user per privilege. +# n: Create local user account on first successful authentication. +# Default: n +# + +# Eg: +# many_to_one=y +# + +# unconfirmed_disallow: +# y: Do not allow unconfirmed users (users created before authentication) +# n: Allow unconfirmed users. +# Default: n + +# Eg: +# unconfirmed_disallow=y +# + +# unconfirmed_ageout: +# : Wait time before purging unconfirmed users +# Default: 600 +# + +# Eg: +# unconfirmed_ageout=900 +# + +# unconfirmed_regexp: +# : The RE to match the command line of processes for which the +# creation of unconfirmed users are to be allowed. +# Default: (.*: \[priv\])|(.*: \[accepted\]) +# where: is the unconfirmed user. +# \ No newline at end of file diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/sshd b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/sshd new file mode 100644 index 000000000000..c025af353d6f --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/sshd @@ -0,0 +1,55 @@ +# PAM configuration for the Secure Shell service + +# Standard Un*x authentication. +@include common-auth-sonic + +# Disallow non-root logins when /etc/nologin exists. +account required pam_nologin.so + +# Uncomment and edit /etc/security/access.conf if you need to set complex +# access limits that are hard to express in sshd_config. +# account required pam_access.so + +# Standard Un*x authorization. +@include common-account + +# SELinux needs to be the first session rule. This ensures that any +# lingering context has been cleared. Without this it is possible that a +# module could execute code in the wrong domain. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close + +# Set the loginuid process attribute. +session required pam_loginuid.so + +# Create a new session keyring. +session optional pam_keyinit.so force revoke + +# Standard Un*x session setup and teardown. +@include common-session + +# Print the message of the day upon successful login. +# This includes a dynamically generated part from /run/motd.dynamic +# and a static (admin-editable) part from /etc/motd. +session optional pam_motd.so motd=/run/motd.dynamic +session optional pam_motd.so noupdate + +# Print the status of the user's mailbox upon successful login. +session optional pam_mail.so standard noenv # [1] + +# Set up user limits from /etc/security/limits.conf. +session required pam_limits.so + +# Read environment variables from /etc/environment and +# /etc/security/pam_env.conf. +session required pam_env.so # [1] +# In Debian 4.0 (etch), locale-related environment variables were moved to +# /etc/default/locale, so read that as well. +session required pam_env.so user_readenv=1 envfile=/etc/default/locale + +# SELinux needs to intervene at login time to ensure that the process starts +# in the proper default security context. Only sessions which are intended +# to run in the user's context should be run after this. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open + +# Standard Un*x password updating. +@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/sshd.old b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/sshd.old new file mode 100644 index 000000000000..d70b384bd9a3 --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/sshd.old @@ -0,0 +1,55 @@ +# PAM configuration for the Secure Shell service + +# Standard Un*x authentication. +@include common-auth + +# Disallow non-root logins when /etc/nologin exists. +account required pam_nologin.so + +# Uncomment and edit /etc/security/access.conf if you need to set complex +# access limits that are hard to express in sshd_config. +# account required pam_access.so + +# Standard Un*x authorization. +@include common-account + +# SELinux needs to be the first session rule. This ensures that any +# lingering context has been cleared. Without this it is possible that a +# module could execute code in the wrong domain. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close + +# Set the loginuid process attribute. +session required pam_loginuid.so + +# Create a new session keyring. +session optional pam_keyinit.so force revoke + +# Standard Un*x session setup and teardown. +@include common-session + +# Print the message of the day upon successful login. +# This includes a dynamically generated part from /run/motd.dynamic +# and a static (admin-editable) part from /etc/motd. +session optional pam_motd.so motd=/run/motd.dynamic +session optional pam_motd.so noupdate + +# Print the status of the user's mailbox upon successful login. +session optional pam_mail.so standard noenv # [1] + +# Set up user limits from /etc/security/limits.conf. +session required pam_limits.so + +# Read environment variables from /etc/environment and +# /etc/security/pam_env.conf. +session required pam_env.so # [1] +# In Debian 4.0 (etch), locale-related environment variables were moved to +# /etc/default/locale, so read that as well. +session required pam_env.so user_readenv=1 envfile=/etc/default/locale + +# SELinux needs to intervene at login time to ensure that the process starts +# in the proper default security context. Only sessions which are intended +# to run in the user's context should be run after this. +session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open + +# Standard Un*x password updating. +@include common-password diff --git a/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/tacplus_nss.conf b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/tacplus_nss.conf new file mode 100644 index 000000000000..c9b8ab2944cc --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/sample_output/TACACS_config_db_tacacs/tacplus_nss.conf @@ -0,0 +1,42 @@ +# Configuration for libnss-tacplus + +# debug - If you want to open debug log, set it on +# Default: off +# debug=on + +# local_accounting - If you want to local accounting, set it +# Default: None +# local_accounting + +# tacacs_accounting - If you want to tacacs+ accounting, set it +# Default: None +# tacacs_accounting +tacacs_accounting + +# local_authorization - If you want to local authorization, set it +# Default: None +# local_authorization + +# tacacs_authorization - If you want to tacacs+ authorization, set it +# Default: None +# tacacs_authorization +tacacs_authorization + +# src_ip - set source address of TACACS+ protocol packets +# Default: None (auto source ip address) +# src_ip=2.2.2.2 + +# server - set ip address, tcp port, secret string and timeout for TACACS+ servers +# Default: None (no TACACS+ server) +# server=1.1.1.1:49,secret=test,timeout=3 +server=192.168.1.1:50,secret=dellsonic,timeout=10,vrf=default +server=192.168.1.2:51,secret=dellsonic1,timeout=15,vrf=mgmt + +# user_priv - set the map between TACACS+ user privilege and local user's passwd +# Default: +# user_priv=15;pw_info=remote_user_su;gid=1000;group=sudo,docker;shell=/bin/bash +# user_priv=1;pw_info=remote_user;gid=999;group=docker;shell=/bin/bash + +# many_to_one - create one local user for many TACACS+ users which has the same privilege +# Default: many_to_one=n +# many_to_one=y diff --git a/src/sonic-host-services/tests/hostcfgd/test_tacacs_vectors.py b/src/sonic-host-services/tests/hostcfgd/test_tacacs_vectors.py new file mode 100644 index 000000000000..38d0012fa854 --- /dev/null +++ b/src/sonic-host-services/tests/hostcfgd/test_tacacs_vectors.py @@ -0,0 +1,260 @@ +from unittest.mock import call + +""" + hostcfgd test tacacs vector +""" +HOSTCFGD_TEST_TACACS_VECTOR = [ + [ + "TACACS", + { + "config_db_local": { + "DEVICE_METADATA": { + "localhost": { + "hostname": "radius", + } + }, + "FEATURE": { + "dhcp_relay": { + "auto_restart": "enabled", + "has_global_scope": "True", + "has_per_asic_scope": "False", + "has_timer": "False", + "high_mem_alert": "disabled", + "set_owner": "kube", + "state": "enabled" + }, + }, + "KDUMP": { + "config": { + "enabled": "false", + "num_dumps": "3", + "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" + } + }, + "AAA": { + "authentication": { + "login": "local" + }, + "authorization": { + "login": "local" + }, + "accounting": { + "login": "local" + } + }, + "TACPLUS": { + "global": { + "auth_type": "chap", + "timeout": 5, + "passkey": "dellsonic", + "src_intf": "Ethernet0" + } + }, + "TACPLUS_SERVER": { + "192.168.1.1" : { + "priority": 5, + "tcp_port": 50, + "timeout": 10, + "auth_type": "chap", + "passkey": "dellsonic", + "vrf": "default" + }, + "192.168.1.2" : { + "priority": 2, + "tcp_port": 51, + "timeout": 15, + "auth_type": "pap", + "passkey": "dellsonic1", + "vrf": "mgmt" + } + }, + }, + "config_db_tacacs": { + "DEVICE_METADATA": { + "localhost": { + "hostname": "radius", + } + }, + "FEATURE": { + "dhcp_relay": { + "auto_restart": "enabled", + "has_global_scope": "True", + "has_per_asic_scope": "False", + "has_timer": "False", + "high_mem_alert": "disabled", + "set_owner": "kube", + "state": "enabled" + }, + }, + "KDUMP": { + "config": { + "enabled": "false", + "num_dumps": "3", + "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" + } + }, + "AAA": { + "authentication": { + "login": "local" + }, + "authorization": { + "login": "tacacs+" + }, + "accounting": { + "login": "tacacs+" + } + }, + "TACPLUS": { + "global": { + "auth_type": "chap", + "timeout": 5, + "passkey": "dellsonic", + "src_intf": "Ethernet0" + } + }, + "TACPLUS_SERVER": { + "192.168.1.1" : { + "priority": 5, + "tcp_port": 50, + "timeout": 10, + "auth_type": "chap", + "passkey": "dellsonic", + "vrf": "default" + }, + "192.168.1.2" : { + "priority": 2, + "tcp_port": 51, + "timeout": 15, + "auth_type": "pap", + "passkey": "dellsonic1", + "vrf": "mgmt" + } + }, + }, + "config_db_local_and_tacacs": { + "DEVICE_METADATA": { + "localhost": { + "hostname": "radius", + } + }, + "FEATURE": { + "dhcp_relay": { + "auto_restart": "enabled", + "has_global_scope": "True", + "has_per_asic_scope": "False", + "has_timer": "False", + "high_mem_alert": "disabled", + "set_owner": "kube", + "state": "enabled" + }, + }, + "KDUMP": { + "config": { + "enabled": "false", + "num_dumps": "3", + "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" + } + }, + "AAA": { + "authentication": { + "login": "local" + }, + "authorization": { + "login": "tacacs+ local" + }, + "accounting": { + "login": "tacacs+ local" + } + }, + "TACPLUS": { + "global": { + "auth_type": "chap", + "timeout": 5, + "passkey": "dellsonic", + "src_intf": "Ethernet0" + } + }, + "TACPLUS_SERVER": { + "192.168.1.1" : { + "priority": 5, + "tcp_port": 50, + "timeout": 10, + "auth_type": "chap", + "passkey": "dellsonic", + "vrf": "default" + }, + "192.168.1.2" : { + "priority": 2, + "tcp_port": 51, + "timeout": 15, + "auth_type": "pap", + "passkey": "dellsonic1", + "vrf": "mgmt" + } + }, + }, + "config_db_disable_accounting": { + "DEVICE_METADATA": { + "localhost": { + "hostname": "radius", + } + }, + "FEATURE": { + "dhcp_relay": { + "auto_restart": "enabled", + "has_global_scope": "True", + "has_per_asic_scope": "False", + "has_timer": "False", + "high_mem_alert": "disabled", + "set_owner": "kube", + "state": "enabled" + }, + }, + "KDUMP": { + "config": { + "enabled": "false", + "num_dumps": "3", + "memory": "0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M" + } + }, + "AAA": { + "authentication": { + "login": "local" + }, + "authorization": { + "login": "local" + }, + "accounting": { + "login": "disable" + } + }, + "TACPLUS": { + "global": { + "auth_type": "chap", + "timeout": 5, + "passkey": "dellsonic", + "src_intf": "Ethernet0" + } + }, + "TACPLUS_SERVER": { + "192.168.1.1" : { + "priority": 5, + "tcp_port": 50, + "timeout": 10, + "auth_type": "chap", + "passkey": "dellsonic", + "vrf": "default" + }, + "192.168.1.2" : { + "priority": 2, + "tcp_port": 51, + "timeout": 15, + "auth_type": "pap", + "passkey": "dellsonic1", + "vrf": "mgmt" + } + }, + } + } + ] +] diff --git a/src/sonic-host-services/tests/hostcfgd/test_vectors.py b/src/sonic-host-services/tests/hostcfgd/test_vectors.py index aaba66b64e4a..28ffe89d841c 100644 --- a/src/sonic-host-services/tests/hostcfgd/test_vectors.py +++ b/src/sonic-host-services/tests/hostcfgd/test_vectors.py @@ -492,3 +492,62 @@ } ] ] + +HOSTCFG_DAEMON_CFG_DB = { + "FEATURE": { + "dhcp_relay": { + "auto_restart": "enabled", + "has_global_scope": "True", + "has_per_asic_scope": "False", + "has_timer": "False", + "high_mem_alert": "disabled", + "set_owner": "kube", + "state": "{% if not (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] != 'ToRRouter') %}enabled{% else %}disabled{% endif %}" + }, + "mux": { + "auto_restart": "enabled", + "has_global_scope": "True", + "has_per_asic_scope": "False", + "has_timer": "False", + "high_mem_alert": "disabled", + "set_owner": "local", + "state": "{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %}enabled{% else %}always_disabled{% endif %}" + }, + "telemetry": { + "auto_restart": "enabled", + "has_global_scope": "True", + "has_per_asic_scope": "False", + "has_timer": "True", + "high_mem_alert": "disabled", + "set_owner": "kube", + "state": "enabled", + "status": "enabled" + }, + }, + "KDUMP": { + "config": { + + } + }, + "NTP": { + "global": { + "vrf": "default", + "src_intf": "eth0;Loopback0" + } + }, + "NTP_SERVER": { + "0.debian.pool.ntp.org": {} + }, + "LOOPBACK_INTERFACE": { + "Loopback0|10.184.8.233/32": { + "scope": "global", + "family": "IPv4" + } + }, + "DEVICE_METADATA": { + "localhost": { + "subtype": "DualToR", + "type": "ToRRouter", + } + } +} diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 0fe396ef3f15..10ef3904d940 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 0fe396ef3f15f6ac57c1a850265589827401446b +Subproject commit 10ef3904d9401954b66915b7f5466e3f7591e7fb diff --git a/src/sonic-mgmt-common b/src/sonic-mgmt-common index 86c110812583..d43a607d759d 160000 --- a/src/sonic-mgmt-common +++ b/src/sonic-mgmt-common @@ -1 +1 @@ -Subproject commit 86c110812583d0132d6504a1e74eb0337f521fde +Subproject commit d43a607d759d23f64d681e38d015ce0be886d440 diff --git a/src/sonic-p4rt/Makefile b/src/sonic-p4rt/Makefile new file mode 100644 index 000000000000..191a94d45518 --- /dev/null +++ b/src/sonic-p4rt/Makefile @@ -0,0 +1,46 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +BAZEL_TARGET_PATH = p4rt_app +BAZEL_BUILD_TARGETS = //p4rt_app:p4rt_deb //p4rt_app:p4rt_dbg_deb + +# Enable debug symbols for remote debugging (generate a .dwp). +BAZEL_BUILD_OPTS += --fission=yes --features=per_object_debug_info + +# Override sonic_swss_common to use the version specific to this buildimage. +BAZEL_BUILD_OPTS += --override_repository=sonic_swss_common=/sonic/src/sonic-swss-common + +# Build optimized, stripped binaries. +BAZEL_BUILD_OPTS += -c opt + +# Use a host directory to store Bazel cache, if mounted. This will speed up +# incremental rebuilds on the same system for developers that makes changes +# to sonic-pins code. +# +# To build with Bazel cache, add DOCKER_BUILDER_USER_MOUNT: +# DOCKER_BUILDER_USER_MOUNT=:$BAZEL_CACHE:rw +# +# For example: +# DOCKER_BUILDER_USER_MOUNT=/tmp/bazel_cache:/bazel:rw make target/... +# +BAZEL_CACHE ?= /bazel +BAZEL_OPTS += $(shell test -d $(BAZEL_CACHE) && echo --output_user_root=$(BAZEL_CACHE)/cache) + +MAIN_TARGET = $(SONIC_P4RT) +DERIVED_TARGETS = $(SONIC_P4RT_DBG) + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + function cleanup { + # Note: make seems to hang if Bazel is still running + cd $(CURDIR)/sonic-pins && bazel $(BAZEL_OPTS) shutdown + } + trap cleanup EXIT + pushd ./sonic-pins + bazel $(BAZEL_OPTS) build $(BAZEL_BUILD_OPTS) $(BAZEL_BUILD_TARGETS) + bazel $(BAZEL_OPTS) test $(BAZEL_BUILD_OPTS) //$(BAZEL_TARGET_PATH)/... + cd ./bazel-bin/$(BAZEL_TARGET_PATH) + mv $* $(DERIVED_TARGETS) $(DEST)/ + popd + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) diff --git a/src/sonic-p4rt/sonic-pins b/src/sonic-p4rt/sonic-pins new file mode 160000 index 000000000000..36322d349779 --- /dev/null +++ b/src/sonic-p4rt/sonic-pins @@ -0,0 +1 @@ +Subproject commit 36322d349779f99e30fc52c26fee60945b0eb5e8 diff --git a/src/sonic-platform-common b/src/sonic-platform-common index 0dc71c1a19bd..01512ecce4d6 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit 0dc71c1a19bd27c15a2d4d0ac9c347637cdb4391 +Subproject commit 01512ecce4d6ce7272c0bbb7a5d47a1c02d92221 diff --git a/src/sonic-platform-daemons b/src/sonic-platform-daemons index 84386e6a1c46..94fa239a7bcf 160000 --- a/src/sonic-platform-daemons +++ b/src/sonic-platform-daemons @@ -1 +1 @@ -Subproject commit 84386e6a1c46e96bacb6c449c7611904227f58fb +Subproject commit 94fa239a7bcfcab008e94fb5c118b628e4256561 diff --git a/src/sonic-py-common/sonic_py_common/device_info.py b/src/sonic-py-common/sonic_py_common/device_info.py index 0b58a4231a65..e5220e86e2ad 100644 --- a/src/sonic-py-common/sonic_py_common/device_info.py +++ b/src/sonic-py-common/sonic_py_common/device_info.py @@ -111,7 +111,7 @@ def get_platform(): # container in SONiC, where the /host directory is not mounted. In this # case the value should already be populated in Config DB so we finally # try reading it from there. - + return get_localhost_info('platform') @@ -210,6 +210,7 @@ def get_path_to_platform_dir(): return platform_path + def get_path_to_hwsku_dir(): """ Retreives the path to the device's hardware SKU data directory @@ -228,6 +229,7 @@ def get_path_to_hwsku_dir(): return hwsku_path + def get_paths_to_platform_and_hwsku_dirs(): """ Retreives the paths to the device's platform and hardware SKU data @@ -249,6 +251,7 @@ def get_paths_to_platform_and_hwsku_dirs(): return (platform_path, hwsku_path) + def get_path_to_port_config_file(hwsku=None, asic=None): """ Retrieves the path to the device's port configuration file @@ -348,9 +351,21 @@ def get_platform_info(): hw_info_dict['platform'] = get_platform() hw_info_dict['hwsku'] = get_hwsku() - hw_info_dict['asic_type'] = version_info['asic_type'] + if version_info: + hw_info_dict['asic_type'] = version_info.get('asic_type') hw_info_dict['asic_count'] = get_num_asics() + try: + config_db = ConfigDBConnector() + config_db.connect() + + metadata = config_db.get_table('DEVICE_METADATA')["localhost"] + switch_type = metadata.get('switch_type') + if switch_type: + hw_info_dict['switch_type'] = switch_type + except Exception: + pass + return hw_info_dict @@ -398,6 +413,20 @@ def is_multi_npu(): return (num_npus > 1) +def is_voq_chassis(): + switch_type = get_platform_info().get('switch_type') + return True if switch_type and switch_type == 'voq' else False + + +def is_packet_chassis(): + switch_type = get_platform_info().get('switch_type') + return True if switch_type and switch_type == 'chassis-packet' else False + + +def is_chassis(): + return is_voq_chassis() or is_packet_chassis() + + def is_supervisor(): platform_env_conf_file_path = get_platform_env_conf_file_path() if platform_env_conf_file_path is None: @@ -412,7 +441,7 @@ def is_supervisor(): if val == '1': return True return False - + def get_npu_id_from_name(npu_name): if npu_name.startswith(NPU_NAME_PREFIX): @@ -492,6 +521,14 @@ def get_system_mac(namespace=None): else: profile_cmd = "false" hw_mac_entry_cmds = ["sudo decode-syseeprom -m", profile_cmd, "ip link show eth0 | grep ether | awk '{print $2}'"] + elif (version_info['asic_type'] == 'cisco-8000'): + # Try to get valid MAC from profile.ini first, else fetch it from syseeprom or eth0 + platform = get_platform() + if namespace is not None: + profile_cmd = 'cat ' + HOST_DEVICE_PATH + '/' + platform + '/profile.ini | grep ' + namespace + 'switchMacAddress | cut -f2 -d=' + else: + profile_cmd = "false" + hw_mac_entry_cmds = [profile_cmd, "sudo decode-syseeprom -m", "ip link show eth0 | grep ether | awk '{print $2}'"] else: mac_address_cmd = "cat /sys/class/net/eth0/address" if namespace is not None: @@ -542,6 +579,7 @@ def get_system_routing_stack(): return result + # Check if System warm reboot or Container warm restart is enabled. def is_warm_restart_enabled(container_name): state_db = SonicV2Connector(host='127.0.0.1') @@ -563,6 +601,7 @@ def is_warm_restart_enabled(container_name): state_db.close(state_db.STATE_DB) return wr_enable_state + # Check if System fast reboot is enabled. def is_fast_reboot_enabled(): fb_system_state = 0 diff --git a/src/sonic-py-common/sonic_py_common/interface.py b/src/sonic-py-common/sonic_py_common/interface.py index b56326e82aad..286f28e531a2 100644 --- a/src/sonic-py-common/sonic_py_common/interface.py +++ b/src/sonic-py-common/sonic_py_common/interface.py @@ -14,7 +14,10 @@ "Vlan": "Vlan", "Loopback": "Loopback", "Ethernet-Backplane": "Ethernet-BP", - "Ethernet-Inband": "Ethernet-IB" + "Ethernet-Inband": "Ethernet-IB", + "Ethernet-Recirc": "Ethernet-Rec", + "Ethernet-SubPort": "Eth", + "PortChannel-SubPort": "Po" } VLAN_SUB_INTERFACE_SEPARATOR = '.' @@ -55,6 +58,24 @@ def inband_prefix(): """ return SONIC_INTERFACE_PREFIXES["Ethernet-Inband"] +def recirc_prefix(): + """ + Retrieves the SONIC recirculation port interface name prefix. + """ + return SONIC_INTERFACE_PREFIXES["Ethernet-Recirc"] + +def physical_subinterface_prefix(): + """ + Retrieves the SONIC Subinterface name prefix. + """ + return SONIC_INTERFACE_PREFIXES["Ethernet-SubPort"] + +def portchannel_subinterface_prefix(): + """ + Retrieves the SONIC Subinterface name prefix. + """ + return SONIC_INTERFACE_PREFIXES["PortChannel-SubPort"] + def get_interface_table_name(interface_name): """Get table name by interface_name prefix """ @@ -70,6 +91,9 @@ def get_interface_table_name(interface_name): return "VLAN_INTERFACE" elif interface_name.startswith(loopback_prefix()): return "LOOPBACK_INTERFACE" + elif VLAN_SUB_INTERFACE_SEPARATOR in interface_name: + if interface_name.startswith(physical_subinterface_prefix()) or interface_name.startswith(portchannel_subinterface_prefix()): + return "VLAN_SUB_INTERFACE" else: return "" @@ -88,5 +112,47 @@ def get_port_table_name(interface_name): return "VLAN_INTERFACE" elif interface_name.startswith(loopback_prefix()): return "LOOPBACK_INTERFACE" + elif VLAN_SUB_INTERFACE_SEPARATOR in interface_name: + if interface_name.startswith(physical_subinterface_prefix()) or interface_name.startswith(portchannel_subinterface_prefix()): + return "VLAN_SUB_INTERFACE" else: return "" + +def get_subintf_longname(intf): + if intf is None: + return None + sub_intf_sep_idx = intf.find(VLAN_SUB_INTERFACE_SEPARATOR) + if sub_intf_sep_idx == -1: + return str(intf) + parent_intf = intf[:sub_intf_sep_idx] + sub_intf_idx = intf[(sub_intf_sep_idx+1):] + if intf.startswith("Eth"): + intf_index=intf[len("Eth"):sub_intf_sep_idx] + return "Ethernet"+intf_index+VLAN_SUB_INTERFACE_SEPARATOR+sub_intf_idx + elif intf.startswith("Po"): + intf_index=intf[len("Po"):sub_intf_sep_idx] + return "PortChannel"+intf_index+VLAN_SUB_INTERFACE_SEPARATOR+sub_intf_idx + else: + return str(intf) + +def get_intf_longname(intf): + if intf is None: + return None + + if VLAN_SUB_INTERFACE_SEPARATOR in intf: + return get_subintf_longname(intf) + else: + if intf.startswith("Eth"): + if intf.startswith("Ethernet"): + return intf + intf_index=intf[len("Eth"):len(intf)] + return "Ethernet"+intf_index + elif intf.startswith("Po"): + if intf.startswith("PortChannel"): + return intf + intf_index=intf[len("Po"):len(intf)] + return "PortChannel"+intf_index + else: + return intf + + diff --git a/src/sonic-py-common/sonic_py_common/multi_asic.py b/src/sonic-py-common/sonic_py_common/multi_asic.py index a5b5d48bab21..662c01800e35 100644 --- a/src/sonic-py-common/sonic_py_common/multi_asic.py +++ b/src/sonic-py-common/sonic_py_common/multi_asic.py @@ -9,6 +9,7 @@ from .device_info import HOST_DEVICE_PATH from .device_info import get_platform from .device_info import is_supervisor +from .device_info import is_chassis ASIC_NAME_PREFIX = 'asic' NAMESPACE_PATH_GLOB = '/run/netns/*' @@ -26,6 +27,10 @@ PORT_ROLE = 'role' +# Dictionary to cache config_db connection handle per namespace +# to prevent duplicate connections from being opened +config_db_handle = {} + def connect_config_db_for_ns(namespace=DEFAULT_NAMESPACE): """ The function connects to the config DB for a given namespace and @@ -236,7 +241,9 @@ def get_all_namespaces(): if is_multi_asic(): for asic in range(num_asics): namespace = "{}{}".format(ASIC_NAME_PREFIX, asic) - config_db = connect_config_db_for_ns(namespace) + if namespace not in config_db_handle: + config_db_handle[namespace] = connect_config_db_for_ns(namespace) + config_db = config_db_handle[namespace] metadata = config_db.get_table('DEVICE_METADATA') if metadata['localhost']['sub_role'] == FRONTEND_ASIC_SUB_ROLE: @@ -410,7 +417,7 @@ def get_back_end_interface_set(namespace=None): def is_bgp_session_internal(bgp_neigh_ip, namespace=None): - if not is_multi_asic(): + if not is_multi_asic() and not is_chassis(): return False ns_list = get_namespace_list(namespace) @@ -418,7 +425,15 @@ def is_bgp_session_internal(bgp_neigh_ip, namespace=None): for ns in ns_list: config_db = connect_config_db_for_ns(ns) - bgp_sessions = config_db.get_entry(BGP_INTERNAL_NEIGH_CFG_DB_TABLE, bgp_neigh_ip) + bgp_sessions = config_db.get_entry( + BGP_INTERNAL_NEIGH_CFG_DB_TABLE, bgp_neigh_ip + ) + if bgp_sessions: + return True + + bgp_sessions = config_db.get_entry( + 'BGP_VOQ_CHASSIS_NEIGHBOR', bgp_neigh_ip + ) if bgp_sessions: return True diff --git a/src/sonic-py-common/tests/interface_test.py b/src/sonic-py-common/tests/interface_test.py index 5e5b81b0408f..4ee6b3ed98d8 100644 --- a/src/sonic-py-common/tests/interface_test.py +++ b/src/sonic-py-common/tests/interface_test.py @@ -17,6 +17,10 @@ def test_get_interface_table_name(self): assert result == "VLAN_INTERFACE" result = interface.get_interface_table_name("Loopback0") assert result == "LOOPBACK_INTERFACE" + result = interface.get_interface_table_name("Eth0.1001") + assert result == "VLAN_SUB_INTERFACE" + result = interface.get_interface_table_name("Po0.1001") + assert result == "VLAN_SUB_INTERFACE" def test_get_port_table_name(self): result = interface.get_port_table_name("Ethernet0") @@ -31,3 +35,7 @@ def test_get_port_table_name(self): assert result == "VLAN_INTERFACE" result = interface.get_port_table_name("Loopback0") assert result == "LOOPBACK_INTERFACE" + result = interface.get_port_table_name("Eth0.1001") + assert result == "VLAN_SUB_INTERFACE" + result = interface.get_port_table_name("Po0.1001") + assert result == "VLAN_SUB_INTERFACE" diff --git a/src/sonic-py-swsssdk b/src/sonic-py-swsssdk index 2cd6236849d1..653bdba51750 160000 --- a/src/sonic-py-swsssdk +++ b/src/sonic-py-swsssdk @@ -1 +1 @@ -Subproject commit 2cd6236849d194625c014d1c2c370f6d2513eb76 +Subproject commit 653bdba51750cac95feb3dd47904bf4de2353fec diff --git a/src/sonic-restapi b/src/sonic-restapi index e466ac226c48..bd97dfeb4b45 160000 --- a/src/sonic-restapi +++ b/src/sonic-restapi @@ -1 +1 @@ -Subproject commit e466ac226c48cf87f83aa5564efd7155ac97a0c1 +Subproject commit bd97dfeb4b4564defbc10e521ee05bbfe0638315 diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 78f36138e14e..473c99067c81 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 78f36138e14e1ed0f0f772950f03420327ef1b1c +Subproject commit 473c99067c8132f8e5b3f8f2abd672b474b42b5a diff --git a/src/sonic-snmpagent b/src/sonic-snmpagent index 43b5e1abefb7..890f32f333df 160000 --- a/src/sonic-snmpagent +++ b/src/sonic-snmpagent @@ -1 +1 @@ -Subproject commit 43b5e1abefb7a1690e21d07eaa97479478bd5454 +Subproject commit 890f32f333dfe31c36a8342ff70c0e84910bf9c8 diff --git a/src/sonic-swss b/src/sonic-swss index a3fdaf41c363..50d5be2b399e 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit a3fdaf41c363709404d484cd697099e82a637aa6 +Subproject commit 50d5be2b399e9bcc43973f99d72d76e4effd8cc0 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index b5027436c267..36e1f61691df 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit b5027436c267638709d4f9a1be4b5a2d07c94893 +Subproject commit 36e1f61691df7aa44782a377e4082cc4380f1018 diff --git a/src/sonic-telemetry b/src/sonic-telemetry index 0443e6605025..e56e9b44e4a7 160000 --- a/src/sonic-telemetry +++ b/src/sonic-telemetry @@ -1 +1 @@ -Subproject commit 0443e66050256a87f8e92db7cd3c36cc139ebe14 +Subproject commit e56e9b44e4a7e3b211f070c298041951c543885b diff --git a/src/sonic-utilities b/src/sonic-utilities index 0d538d3db650..f70dc27827a8 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 0d538d3db650807482117f240027c9ce6885dbc2 +Subproject commit f70dc27827a88d70e91e15ecdcde2ebbc446116d diff --git a/src/sonic-yang-mgmt/sonic_yang.py b/src/sonic-yang-mgmt/sonic_yang.py index 0f62eccd93c1..16aeb8a9ff8a 100644 --- a/src/sonic-yang-mgmt/sonic_yang.py +++ b/src/sonic-yang-mgmt/sonic_yang.py @@ -12,7 +12,7 @@ """ class SonicYang(SonicYangExtMixin): - def __init__(self, yang_dir, debug=False): + def __init__(self, yang_dir, debug=False, print_log_enabled=True): self.yang_dir = yang_dir self.ctx = None self.module = None @@ -21,6 +21,11 @@ def __init__(self, yang_dir, debug=False): # logging vars self.SYSLOG_IDENTIFIER = "sonic_yang" self.DEBUG = debug + self.print_log_enabled = print_log_enabled + if not print_log_enabled: + # The default libyang log options are ly.LY_LOLOG|ly.LY_LOSTORE_LAST. + # Removing ly.LY_LOLOG will stop libyang from printing the logs. + ly.set_log_options(ly.LY_LOSTORE_LAST) # yang model files, need this map it to module self.yangFiles = list() @@ -51,11 +56,10 @@ def __del__(self): pass def sysLog(self, debug=syslog.LOG_INFO, msg=None, doPrint=False): - # log debug only if enabled if self.DEBUG == False and debug == syslog.LOG_DEBUG: return - if doPrint: + if doPrint and self.print_log_enabled: print("{}({}):{}".format(self.SYSLOG_IDENTIFIER, debug, msg)) syslog.openlog(self.SYSLOG_IDENTIFIER) syslog.syslog(debug, msg) @@ -64,7 +68,7 @@ def sysLog(self, debug=syslog.LOG_INFO, msg=None, doPrint=False): return def fail(self, e): - print(e) + self.sysLog(msg=e, debug=syslog.LOG_ERR, doPrint=True) raise e """ @@ -76,7 +80,7 @@ def _load_schema_module(self, yang_file): try: return self.ctx.parse_module_path(yang_file, ly.LYS_IN_YANG) except Exception as e: - print("Failed to load yang module file: " + yang_file) + self.sysLog(msg="Failed to load yang module file: " + yang_file, debug=syslog.LOG_ERR, doPrint=True) self.fail(e) """ @@ -120,7 +124,7 @@ def _load_schema_modules_ctx(self, yang_dir=None): try: ctx.parse_module_path(str(file), ly.LYS_IN_YANG) except Exception as e: - print("Failed to parse yang module file: " + file) + self.sysLog(msg="Failed to parse yang module file: " + file, debug=syslog.LOG_ERR, doPrint=True) self.fail(e) return ctx @@ -134,7 +138,7 @@ def _load_data_file(self, data_file): try: data_node = self.ctx.parse_data_path(data_file, ly.LYD_JSON, ly.LYD_OPT_CONFIG | ly.LYD_OPT_STRICT) except Exception as e: - print("Failed to load data file: " + str(data_file)) + self.sysLog(msg="Failed to load data file: " + str(data_file), debug=syslog.LOG_ERR, doPrint=True) self.fail(e) else: self.root = data_node @@ -176,7 +180,7 @@ def _load_data_model(self, yang_dir, yang_files, data_files, output=None): for i in range(1, len(data_files)): self._merge_data(data_files[i]) except Exception as e: - print("Failed to load data files") + self.sysLog(msg="Failed to load data files", debug=syslog.LOG_ERR, doPrint=True) self.fail(e) return @@ -217,7 +221,7 @@ def _get_module_tree(self, module_name, format): try: module = self.ctx.get_module(str(module_name)) except Exception as e: - print("Cound not get module: " + str(module_name)) + self.sysLog(msg="Cound not get module: " + str(module_name), debug=syslog.LOG_ERR, doPrint=True) self.fail(e) else: if (module is not None): @@ -256,7 +260,7 @@ def validate_data_tree(self): try: self._validate_data(self.root, self.ctx) except Exception as e: - print("Failed to validate data tree") + self.sysLog(msg="Failed to validate data tree\n{", debug=syslog.LOG_ERR, doPrint=True) raise SonicYangException("Failed to validate data tree\n{}".\ format(str(e))) @@ -267,12 +271,12 @@ def validate_data_tree(self): """ def _find_parent_data_node(self, data_xpath): if (self.root is None): - print("data not loaded") + self.sysLog(msg="data not loaded", debug=syslog.LOG_ERR, doPrint=True) return None try: data_node = self._find_data_node(data_xpath) except Exception as e: - print("Failed to find data node from xpath: " + str(data_xpath)) + self.sysLog(msg="Failed to find data node from xpath: " + str(data_xpath), debug=syslog.LOG_ERR, doPrint=True) self.fail(e) else: if data_node is not None: @@ -291,7 +295,7 @@ def _get_parent_data_xpath(self, data_xpath): try: data_node = self._find_parent_data_node(data_xpath) except Exception as e: - print("Failed to find parent node from xpath: " + str(data_xpath)) + self.sysLog(msg="Failed to find parent node from xpath: " + str(data_xpath), debug=syslog.LOG_ERR, doPrint=True) self.fail(e) else: if data_node is not None: @@ -310,7 +314,7 @@ def _new_data_node(self, xpath, value): try: data_node = self.root.new_path(self.ctx, xpath, val, 0, 0) except Exception as e: - print("Failed to add data node for path: " + str(xpath)) + self.sysLog(msg="Failed to add data node for path: " + str(xpath), debug=syslog.LOG_ERR, doPrint=True) self.fail(e) else: return data_node @@ -326,7 +330,7 @@ def _find_data_node(self, data_xpath): try: set = self.root.find_path(data_xpath) except Exception as e: - print("Failed to find data node from xpath: " + str(data_xpath)) + self.sysLog(msg="Failed to find data node from xpath: " + str(data_xpath), debug=syslog.LOG_ERR, doPrint=True) self.fail(e) else: if set is not None: @@ -386,7 +390,7 @@ def _add_data_node(self, data_xpath, value): #check if the node added to the data tree self._find_data_node(data_xpath) except Exception as e: - print("add_node(): Failed to add data node for xpath: " + str(data_xpath)) + self.sysLog(msg="add_node(): Failed to add data node for xpath: " + str(data_xpath), debug=syslog.LOG_ERR, doPrint=True) self.fail(e) """ @@ -426,10 +430,10 @@ def _deleteNode(self, xpath=None, node=None): #deleted node not found return True else: - print('Could not delete Node') + self.sysLog(msg='Could not delete Node', debug=syslog.LOG_ERR, doPrint=True) return False else: - print("failed to find node, xpath: " + xpath) + self.sysLog(msg="failed to find node, xpath: " + xpath, debug=syslog.LOG_ERR, doPrint=True) return False @@ -443,7 +447,7 @@ def _find_data_node_value(self, data_xpath): try: data_node = self._find_data_node(data_xpath) except Exception as e: - print("find_data_node_value(): Failed to find data node from xpath: {}".format(data_xpath)) + self.sysLog(msg="find_data_node_value(): Failed to find data node from xpath: {}".format(data_xpath), debug=syslog.LOG_ERR, doPrint=True) self.fail(e) else: if (data_node is not None): @@ -462,7 +466,7 @@ def _set_data_node_value(self, data_xpath, value): try: self.root.new_path(self.ctx, data_xpath, str(value), ly.LYD_ANYDATA_STRING, ly.LYD_PATH_OPT_UPDATE) except Exception as e: - print("set data node value failed for xpath: " + str(data_xpath)) + self.sysLog(msg="set data node value failed for xpath: " + str(data_xpath), debug=syslog.LOG_ERR, doPrint=True) self.fail(e) """ @@ -497,7 +501,7 @@ def _find_schema_dependencies(self, schema_xpath): try: schema_node = self._find_schema_node(schema_xpath) except Exception as e: - print("Cound not find the schema node from xpath: " + str(schema_xpath)) + self.sysLog(msg="Cound not find the schema node from xpath: " + str(schema_xpath), debug=syslog.LOG_ERR, doPrint=True) self.fail(e) return ref_list @@ -505,7 +509,7 @@ def _find_schema_dependencies(self, schema_xpath): backlinks = schema_node.backlinks() if backlinks.number() > 0: for link in backlinks.schema(): - print("backlink schema: {}".format(link.path())) + self.sysLog(msg="backlink schema: {}".format(link.path()), doPrint=True) ref_list.append(link.path()) return ref_list @@ -521,7 +525,7 @@ def find_data_dependencies(self, data_xpath): try: data_node = self._find_data_node(data_xpath) except Exception as e: - print("find_data_dependencies(): Failed to find data node from xpath: {}".format(data_xapth)) + self.sysLog(msg="find_data_dependencies(): Failed to find data node from xpath: {}".format(data_xapth), debug=syslog.LOG_ERR, doPrint=True) return ref_list try: @@ -538,7 +542,7 @@ def find_data_dependencies(self, data_xpath): if value == casted.value_str(): ref_list.append(data_set.path()) except Exception as e: - print('Failed to find node or dependencies for {}'.format(data_xpath)) + self.sysLog(msg='Failed to find node or dependencies for {}'.format(data_xpath), debug=syslog.LOG_ERR, doPrint=True) raise SonicYangException("Failed to find node or dependencies for \ {}\n{}".format(data_xpath, str(e))) @@ -598,7 +602,7 @@ def _get_data_type(self, schema_xpath): try: schema_node = self._find_schema_node(schema_xpath) except Exception as e: - print("get_data_type(): Failed to find schema node from xpath: {}".format(schema_xpath)) + self.sysLog(msg="get_data_type(): Failed to find schema node from xpath: {}".format(schema_xpath), debug=syslog.LOG_ERR, doPrint=True) self.fail(e) return None @@ -618,7 +622,7 @@ def _get_leafref_type(self, data_xpath): subtype = data_node.subtype() if (subtype is not None): if data_node.schema().subtype().type().base() != ly.LY_TYPE_LEAFREF: - print("get_leafref_type() node type for data xpath: {} is not LEAFREF".format(data_xpath)) + self.sysLog(msg="get_leafref_type() node type for data xpath: {} is not LEAFREF".format(data_xpath), debug=syslog.LOG_ERR, doPrint=True) return ly.LY_TYPE_UNKNOWN else: return subtype.value_type() diff --git a/src/sonic-yang-mgmt/sonic_yang_ext.py b/src/sonic-yang-mgmt/sonic_yang_ext.py index 5438c81fb745..d43e52970302 100644 --- a/src/sonic-yang-mgmt/sonic_yang_ext.py +++ b/src/sonic-yang-mgmt/sonic_yang_ext.py @@ -4,11 +4,22 @@ from __future__ import print_function import yang as ly import syslog - from json import dump, dumps, loads from xmltodict import parse from glob import glob +Type_1_list_maps_model = [ + 'DSCP_TO_TC_MAP_LIST', + 'DOT1P_TO_TC_MAP_LIST', + 'TC_TO_PRIORITY_GROUP_MAP_LIST', + 'TC_TO_QUEUE_MAP_LIST', + 'MAP_PFC_PRIORITY_TO_QUEUE_LIST', + 'PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST', + 'DSCP_TO_FC_MAP_LIST', + 'EXP_TO_FC_MAP_LIST', + 'CABLE_LENGTH_LIST' +] + """ This is the Exception thrown out of all public function of this class. """ @@ -38,7 +49,7 @@ def loadYangModel(self): self.yangFiles = [f.split('/')[-1] for f in self.yangFiles] self.yangFiles = [f.split('.')[0] for f in self.yangFiles] self.sysLog(syslog.LOG_DEBUG,'Loaded below Yang Models') - self.sysLog(syslog.LOG_DEBUG,self.yangFiles) + self.sysLog(syslog.LOG_DEBUG,str(self.yangFiles)) # load json for each yang model self._loadJsonYangModel() @@ -208,10 +219,7 @@ def _cropConfigDB(self, croppedFile=None): del self.jIn[table] if len(self.tablesWithOutYang): - print("Note: Below table(s) have no YANG models:") - for table in self.tablesWithOutYang.keys(): - print(str(table), end=", ") - print() + self.sysLog(msg=f"Note: Below table(s) have no YANG models: {', '.join(self.tablesWithOutYang)}", doPrint=True) if croppedFile: with open(croppedFile, 'w') as f: @@ -322,11 +330,11 @@ def _fillLeafDictUses(self, uses_s, table, leafDict): # Assume ':' means reference to another module if ':' in uses['@name']: prefix = uses['@name'].split(':')[0].strip() - uses_module = self._findYangModuleFromPrefix(prefix, table_module) + uses_module_name = self._findYangModuleFromPrefix(prefix, table_module) else: - uses_module = table_module + uses_module_name = table_module['@name'] grouping = uses['@name'].split(':')[-1].strip() - leafs = self.preProcessedYang['grouping'][uses_module][grouping] + leafs = self.preProcessedYang['grouping'][uses_module_name][grouping] self._fillLeafDict(leafs, leafDict) except Exception as e: self.sysLog(msg="_fillLeafDictUses failed:{}".format(str(e)), \ @@ -406,6 +414,108 @@ def _yangConvert(val): return vValue + """ + Xlate a Type 1 map list + This function will xlate from a dict in config DB to a Yang JSON list + using yang model. Output will be go in self.xlateJson + + Note: Exceptions from this function are collected in exceptionList and + are displayed only when an entry is not xlated properly from ConfigDB + to sonic_yang.json. + + Type 1 Lists have inner list, which is diffrent from config DB. + Each field value in config db should be converted to inner list with + key and value. + Example: + + Config DB: + "DSCP_TO_TC_MAP": { + "Dscp_to_tc_map1": { + "1": "1", + "2": "2" + } + } + + YANG Model: + module: sonic-dscp-tc-map + +--rw sonic-dscp-tc-map + +--rw DSCP_TO_TC_MAP + +--rw DSCP_TO_TC_MAP_LIST* [name] + +--rw name string + +--rw DSCP_TO_TC_MAP* [dscp] + +--rw dscp string + +--rw tc? string + + YANG JSON: + "sonic-dscp-tc-map:sonic-dscp-tc-map": { + "sonic-dscp-tc-map:DSCP_TO_TC_MAP": { + "DSCP_TO_TC_MAP_LIST": [ + { + "name": "map3", + "DSCP_TO_TC_MAP": [ + { + "dscp": "64", + "tc": "1" + }, + { + "dscp":"2", + "tc":"2" + } + ] + } + ] + } + } + """ + def _xlateType1MapList(self, model, yang, config, table, exceptionList): + + #create a dict to map each key under primary key with a dict yang model. + #This is done to improve performance of mapping from values of TABLEs in + #config DB to leaf in YANG LIST. + inner_clist = model.get('list') + if inner_clist: + inner_listKey = inner_clist['key']['@value'] + inner_leafDict = self._createLeafDict(inner_clist, table) + for lkey in inner_leafDict: + if inner_listKey != lkey: + inner_listVal = lkey + + # get keys from YANG model list itself + listKeys = model['key']['@value'] + self.sysLog(msg="xlateList keyList:{}".format(listKeys)) + primaryKeys = list(config.keys()) + for pkey in primaryKeys: + try: + vKey = None + self.sysLog(syslog.LOG_DEBUG, "xlateList Extract pkey:{}".\ + format(pkey)) + # Find and extracts key from each dict in config + keyDict = self._extractKey(pkey, listKeys) + + if inner_clist: + inner_yang_list = list() + for vKey in config[pkey]: + inner_keyDict = dict() + self.sysLog(syslog.LOG_DEBUG, "xlateList Key {} vkey {} Val {} vval {}".\ + format(inner_listKey, str(vKey), inner_listVal, str(config[pkey][vKey]))) + inner_keyDict[inner_listKey] = str(vKey) + inner_keyDict[inner_listVal] = str(config[pkey][vKey]) + inner_yang_list.append(inner_keyDict) + + keyDict[inner_clist['@name']] = inner_yang_list + yang.append(keyDict) + # delete pkey from config, done to match one key with one list + del config[pkey] + + except Exception as e: + # log debug, because this exception may occur with multilists + self.sysLog(msg="xlateList Exception:{}".format(str(e)), \ + debug=syslog.LOG_DEBUG, doPrint=True) + exceptionList.append(str(e)) + # with multilist, we continue matching other keys. + continue + return + """ Xlate a list This function will xlate from a dict in config DB to a Yang JSON list @@ -417,15 +527,21 @@ def _yangConvert(val): """ def _xlateList(self, model, yang, config, table, exceptionList): + # Type 1 lists need special handling because of inner yang list and + # config db format. + if model['@name'] in Type_1_list_maps_model: + self.sysLog(msg="_xlateType1MapList: {}".format(model['@name'])) + self._xlateType1MapList(model, yang, config, table, exceptionList) + return + #create a dict to map each key under primary key with a dict yang model. #This is done to improve performance of mapping from values of TABLEs in #config DB to leaf in YANG LIST. - leafDict = self._createLeafDict(model, table) + leafDict = self._createLeafDict(model, table) # get keys from YANG model list itself listKeys = model['key']['@value'] self.sysLog(msg="xlateList keyList:{}".format(listKeys)) - primaryKeys = list(config.keys()) for pkey in primaryKeys: try: @@ -459,7 +575,6 @@ def _xlateList(self, model, yang, config, table, exceptionList): """ def _xlateListInContainer(self, model, yang, configC, table, exceptionList): clist = model - #print(clist['@name']) yang[clist['@name']] = list() self.sysLog(msg="xlateProcessListOfContainer: {}".format(clist['@name'])) self._xlateList(clist, yang[clist['@name']], configC, table, exceptionList) @@ -476,18 +591,23 @@ def _xlateListInContainer(self, model, yang, configC, table, exceptionList): """ def _xlateContainerInContainer(self, model, yang, configC, table): ccontainer = model - #print(ccontainer['@name']) - yang[ccontainer['@name']] = dict() - if not configC.get(ccontainer['@name']): + ccName = ccontainer['@name'] + yang[ccName] = dict() + if ccName not in configC: + # Inner container doesn't exist in config + return + if len(configC[ccName]) == 0: + # Empty container, clean config and return + del configC[ccName] return - self.sysLog(msg="xlateProcessListOfContainer: {}".format(ccontainer['@name'])) - self._xlateContainer(ccontainer, yang[ccontainer['@name']], \ - configC[ccontainer['@name']], table) + self.sysLog(msg="xlateProcessListOfContainer: {}".format(ccName)) + self._xlateContainer(ccontainer, yang[ccName], \ + configC[ccName], table) # clean empty container - if len(yang[ccontainer['@name']]) == 0: - del yang[ccontainer['@name']] + if len(yang[ccName]) == 0: + del yang[ccName] # remove copy after processing - del configC[ccontainer['@name']] + del configC[ccName] return @@ -629,11 +749,94 @@ def _revYangConvert(val): return vValue + """ + Rev xlate from _LIST to table in config DB + Type 1 Lists have inner list, each inner list key:val should + be mapped to field:value in Config DB. + Example: + + YANG: + module: sonic-dscp-tc-map + +--rw sonic-dscp-tc-map + +--rw DSCP_TO_TC_MAP + +--rw DSCP_TO_TC_MAP_LIST* [name] + +--rw name string + +--rw DSCP_TO_TC_MAP* [dscp] + +--rw dscp string + +--rw tc? string + + YANG JSON: + "sonic-dscp-tc-map:sonic-dscp-tc-map": { + "sonic-dscp-tc-map:DSCP_TO_TC_MAP": { + "DSCP_TO_TC_MAP_LIST": [ + { + "name": "map3", + "DSCP_TO_TC_MAP": [ + { + "dscp": "64", + "tc": "1" + }, + { + "dscp":"2", + "tc":"2" + } + ] + } + ] + } + } + + Config DB: + "DSCP_TO_TC_MAP": { + "Dscp_to_tc_map1": { + "1": "1", + "2": "2" + } + } + """ + + def _revXlateType1MapList(self, model, yang, config, table): + # get keys from YANG model list itself + listKeys = model['key']['@value'] + # create a dict to map each key under primary key with a dict yang model. + # This is done to improve performance of mapping from values of TABLEs in + # config DB to leaf in YANG LIST. + + # Gather inner list key and value from model + inner_clist = model.get('list') + if inner_clist: + inner_listKey = inner_clist['key']['@value'] + inner_leafDict = self._createLeafDict(inner_clist, table) + for lkey in inner_leafDict: + if inner_listKey != lkey: + inner_listVal = lkey + + # list with name _LIST should be removed, + if "_LIST" in model['@name']: + for entry in yang: + # create key of config DB table + pkey, pkeydict = self._createKey(entry, listKeys) + self.sysLog(syslog.LOG_DEBUG, "revXlateList pkey:{}".format(pkey)) + config[pkey]= dict() + # fill rest of the entries + inner_list = entry[inner_clist['@name']] + for index in range(len(inner_list)): + self.sysLog(syslog.LOG_DEBUG, "revXlateList fkey:{} fval {}".\ + format(str(inner_list[index][inner_listKey]),\ + str(inner_list[index][inner_listVal]))) + config[pkey][str(inner_list[index][inner_listKey])] = str(inner_list[index][inner_listVal]) + return + """ Rev xlate from
_LIST to table in config DB """ def _revXlateList(self, model, yang, config, table): + # special processing for Type 1 Map tables. + if model['@name'] in Type_1_list_maps_model: + self._revXlateType1MapList(model, yang, config, table) + return + # get keys from YANG model list itself listKeys = model['key']['@value'] # create a dict to map each key under primary key with a dict yang model. diff --git a/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py b/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py index cdec84c6972f..a13d4c02e9a0 100644 --- a/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py +++ b/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py @@ -268,7 +268,7 @@ def test_get_leafref_type_schema(self, yang_s, data): """ @pytest.fixture(autouse=True, scope='class') def sonic_yang_data(self): - sonic_yang_dir = "../sonic-yang-models/yang-models/" + sonic_yang_dir = "/usr/local/yang-models/" sonic_yang_test_file = "../sonic-yang-models/tests/files/sample_config_db.json" syc = sy.SonicYang(sonic_yang_dir) @@ -364,5 +364,20 @@ def test_table_with_no_yang(self, sonic_yang_data): return + def test_special_json_with_yang(self, sonic_yang_data): + # in this test, we validate unusual json config and check if + # loadData works successfully + test_file = sonic_yang_data['test_file'] + syc = sonic_yang_data['syc'] + + # read config + jIn = self.readIjsonInput(test_file, 'SAMPLE_CONFIG_DB_SPECIAL_CASE') + jIn = json.loads(jIn) + + # load config and create Data tree + syc.loadData(jIn) + + return + def teardown_class(self): pass diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md new file mode 100644 index 000000000000..b5890681ce41 --- /dev/null +++ b/src/sonic-yang-models/doc/Configuration.md @@ -0,0 +1,1540 @@ +# SONiC Configuration Database Manual + +Table of Contents +================= + + * [Introduction](#introduction) + * [Configuration](#configuration) + * [Config Load and Save](#config-load-and-save) + * [Incremental Configuration](#incremental-configuration) + * [Redis and Json Schema](#redis-and-json-schema) + * [ACL and Mirroring](#acl-and-mirroring) + * [BGP Sessions](#bgp-sessions) + * [BUFFER_PG](#buffer_pg) + * [Buffer pool](#buffer-pool) + * [Buffer profile](#buffer-profile) + * [Buffer queue](#buffer-queue) + * [Buffer port ingress profile list](#buffer-port-ingress-profile-list) + * [Buffer port egress profile list](#buffer-port-egress-profile-list) + * [Cable length](#cable-length) + * [COPP_TABLE](#copp_table) + * [CRM](#crm) + * [Data Plane L3 Interfaces](#data-plane-l3-interfaces) + * [DEFAULT_LOSSLESS_BUFFER_PARAMETER](#DEFAULT_LOSSLESS_BUFFER_PARAMETER) + * [Device Metadata](#device-metadata) + * [Device neighbor metada](#device-neighbor-metada) + * [DSCP_TO_TC_MAP](#dscp_to_tc_map) + * [FLEX_COUNTER_TABLE](#flex_counter_table) + * [L2 Neighbors](#l2-neighbors) + * [Loopback Interface](#loopback-interface) + * [LOSSLESS_TRAFFIC_PATTERN](#LOSSLESS_TRAFFIC_PATTERN) + * [Management Interface](#management-interface) + * [Management port](#management-port) + * [Management VRF](#management-vrf) + * [MAP_PFC_PRIORITY_TO_QUEUE](#map_pfc_priority_to_queue) + * [NTP Global Configuration](#ntp-global-configuration) + * [NTP and SYSLOG servers](#ntp-and-syslog-servers) + * [Policer](#policer) + * [Port](#port) + * [Port Channel](#port-channel) + * [Portchannel member](#portchannel-member) + * [Scheduler](#scheduler) + * [Port QoS Map](#port-qos-map) + * [Queue](#queue) + * [Tacplus Server](#tacplus-server) + * [TC to Priority group map](#tc-to-priority-group-map) + * [TC to Queue map](#tc-to-queue-map) + * [Versions](#versions) + * [VLAN](#vlan) + * [VLAN_MEMBER](#vlan_member) + * [Virtual router](#virtual-router) + * [WRED_PROFILE](#wred_profile) + * [For Developers](#for-developers) + * [Generating Application Config by Jinja2 Template](#generating-application-config-by-jinja2-template) + * [Incremental Configuration by Subscribing to ConfigDB](#incremental-configuration-by-subscribing-to-configdb) + + + +# Introduction +This document lists the configuration commands schema applied in the SONiC eco system. All these commands find relevance in collecting system information, analysis and even for trouble shooting. All the commands are categorized under relevant topics with corresponding examples. + +# Configuration + +SONiC is managing configuration in a single source of truth - a redisDB +instance that we refer as ConfigDB. Applications subscribe to ConfigDB +and generate their running configuration correspondingly. + +(Before Sep 2017, we were using an XML file named minigraph.xml to +configure SONiC devices. For historical documentation, please refer to +[Configuration with +Minigraph](https://github.com/Azure/SONiC/wiki/Configuration-with-Minigraph-(~Sep-2017))) + +# **Config Load and Save** + +In current version of SONiC, ConfigDB is implemented as database 4 of +local redis. When system boots, configurations will be loaded from +/etc/sonic/config_db.json file into redis. Please note that ConfigDB +content won't be written back into /etc/sonic/config_db.json file +automatically. In order to do that, a config save command need to be +manually executed from CLI. Similarly, config load will trigger a force +load of json file into DB. Generally, content in +/etc/sonic/config_db.json can be considered as starting config, and +content in redisDB running config. + +We keep a way to load configuration from minigraph and write into +ConfigDB for backward compatibility. To do that, run `config +load_minigraph`. + +### Incremental Configuration + +The design of ConfigDB supports incremental configuration - application +could subscribe to changes in ConfigDB and response correspondingly. +However, this feature is not implemented by all applications yet. By Sep +2017 now, the only application that supports incremental configuration +is BGP (docker-fpm-quagga). For other applications, a manual restart is +required after configuration changes in ConfigDB. + +# **Redis and Json Schema** + +ConfigDB uses a table-object schema that is similar with +[AppDB](https://github.com/Azure/sonic-swss/blob/4c56d23b9ff4940bdf576cf7c9e5aa77adcbbdcc/doc/swss-schema.md), +and `config_db.json` is a straight-forward serialization of DB. As an +example, the following fragments could be BGP-related configuration in +redis and json, correspondingly: + + +***Redis format*** +``` +127.0.0.1:6379[4]> keys BGP_NEIGHBOR:* + +1) "BGP_NEIGHBOR:10.0.0.31" +2) "BGP_NEIGHBOR:10.0.0.39" +3) "BGP_NEIGHBOR:10.0.0.11" +4) "BGP_NEIGHBOR:10.0.0.7" + +... + +127.0.0.1:6379[4]> hgetall BGP_NEIGHBOR:10.0.0.3 + +1) "admin_status" +2) "up" +3) "peer_addr" +4) "10.0.0.2" +5) "asn" +6) "65200" +7) "name" +8) "ARISTA07T2" +``` + +***Json format*** +``` +"BGP_NEIGHBOR": { + "10.0.0.57": { + "rrclient": "0", + "name": "ARISTA01T1", + "local_addr": "10.0.0.56", + "nhopself": "0", + "holdtime": "10", + "asn": "64600", + "keepalive": "3" + }, + "10.0.0.59": { + "rrclient": "0", + "name": "ARISTA02T1", + "local_addr": "10.0.0.58", + "nhopself": "0", + "holdtime": "10", + "asn": "64600", + "keepalive": "3" + }, +} +``` + +Full sample config_db.json files are availables at +[here](https://github.com/Azure/SONiC/blob/gh-pages/doc/config_db.json) +and +[here](https://github.com/Azure/SONiC/blob/gh-pages/doc/config_db_t0.json). + + +### ACL and Mirroring + +ACL and mirroring related configuration are defined in +**MIRROR_SESSION**, **ACL_TABLE** and **ACL_RULE** tables. Those +tables are in progress of migrating from APPDB. Please refer to their +schema in APPDB +[here](https://github.com/Azure/sonic-swss/blob/4c56d23b9ff4940bdf576cf7c9e5aa77adcbbdcc/doc/swss-schema.md) +and migration plan +[here](https://github.com/Azure/SONiC/wiki/ACL-Configuration-Requirement-Description). + +``` +{ +"MIRROR_SESSION": { + "everflow0": { + "src_ip": "10.1.0.32", + "dst_ip": "2.2.2.2" + } + }, + +"ACL_TABLE": { + "DATAACL": { + "policy_desc" : "data_acl", + "type": "l3", + "ports": [ + "Ethernet0", + "Ethernet4", + "Ethernet8", + "Ethernet12" + ] + } + } +} +``` + +***Below ACL table added as per the mail*** +``` +{ +"ACL_TABLE": { + "aaa": { + "type": "L3", + "ports": "Ethernet0" + } + }, +"ACL_RULE": { + "aaa|rule_0": { + "PRIORITY": "55", + "PACKET_ACTION": "DROP", + "L4_SRC_PORT": "0" + }, + "aaa|rule_1": { + "PRIORITY": "55", + "PACKET_ACTION": "DROP", + "L4_SRC_PORT": "1" + } + } +} +``` + +***Below ACL table added by comparig minigraph.xml & config_db.json*** + +``` +{ +"ACL_TABLE": { + "EVERFLOW": { + "type": "MIRROR", + "policy_desc": "EVERFLOW", + "ports": [ + "PortChannel0001", + "PortChannel0002", + "PortChannel0003", + "PortChannel0004" + ] + }, + "EVERFLOWV6": { + "type": "MIRRORV6", + "policy_desc": "EVERFLOWV6", + "ports": [ + "PortChannel0001", + "PortChannel0002", + "PortChannel0003", + "PortChannel0004" + ] + }, + "SNMP_ACL": { + "services": [ + "SNMP" + ], + "type": "CTRLPLANE", + "policy_desc": "SNMP_ACL" + }, + "SSH_ONLY": { + "services": [ + "SSH" + ], + "type": "CTRLPLANE", + "policy_desc": "SSH_ONLY" + } + }, + +"ACL_RULE": { + "SNMP_ACL|DEFAULT_RULE": { + "PRIORITY": "1", + "PACKET_ACTION": "DROP", + "ETHER_TYPE": "2048" + }, + "SNMP_ACL|RULE_1": { + "PRIORITY": "9999", + "PACKET_ACTION": "ACCEPT", + "SRC_IP": "1.1.1.1/32", + "IP_PROTOCOL": "17" + }, + "SNMP_ACL|RULE_2": { + "PRIORITY": "9998", + "PACKET_ACTION": "ACCEPT", + "SRC_IP": "2.2.2.2/32", + "IP_PROTOCOL": "17" + }, + "SSH_ONLY|DEFAULT_RULE": { + "PRIORITY": "1", + "PACKET_ACTION": "DROP", + "ETHER_TYPE": "2048" + }, + "SSH_ONLY|RULE_1": { + "PRIORITY": "9999", + "PACKET_ACTION": "ACCEPT", + "SRC_IP": "4.4.4.4/8", + "IP_PROTOCOL": "6" + } + } +} + +``` + +***ACL table type configuration example*** +``` +{ + "ACL_TABLE_TYPE": { + "CUSTOM_L3": { + "MATCHES": [ + "IN_PORTS", + "OUT_PORTS", + "SRC_IP" + ], + "ACTIONS": [ + "PACKET_ACTION", + "MIRROR_INGRESS_ACTION" + ], + "BIND_POINTS": [ + "PORT", + "LAG" + ] + } + }, + "ACL_TABLE": { + "DATAACL": { + "STAGE": "INGRESS", + "TYPE": "CUSTOM_L3", + "PORTS": [ + "Ethernet0", + "PortChannel1" + ] + } + }, + "ACL_RULE": { + "DATAACL|RULE0": { + "PRIORITY": "999", + "PACKET_ACTION": "DROP", + "SRC_IP": "1.1.1.1/32", + } + } +} +``` + +### BGP Sessions + +BGP session configuration is defined in **BGP_NEIGHBOR** table. BGP +neighbor address is used as key of bgp neighbor objects. Object +attributes include remote AS number, neighbor router name, and local +peering address. Dynamic neighbor is also supported by defining peer +group name and IP ranges in **BGP_PEER_RANGE** table. + +``` +{ +"BGP_NEIGHBOR": { + "10.0.0.61": { + "local_addr": "10.0.0.60", + "asn": 64015, + "name": "ARISTA15T0" + }, + "10.0.0.49": { + "local_addr": "10.0.0.48", + "asn": 64009, + "name": "ARISTA09T0" + }, + + "10.0.0.63": { + "rrclient": "0", + "name": "ARISTA04T1", + "local_addr": "10.0.0.62", + "nhopself": "0", + "holdtime": "10", + "asn": "64600", + "keepalive": "3" + } + +"BGP_PEER_RANGE": { + "BGPSLBPassive": { + "name": "BGPSLBPassive", + "ip_range": [ + "10.250.0.0/27" + ] + }, + "BGPVac": { + "name": "BGPVac", + "ip_range": [ + "10.2.0.0/16" + ] + } + } +} +``` + +### BUFFER_PG + +When the system is running in traditional buffer model, profiles needs to explicitly configured: + +``` +{ +"BUFFER_PG": { + "Ethernet0|3-4": { + "profile": "pg_lossless_40000_5m_profile" + }, + "Ethernet1|3-4": { + "profile": "pg_lossless_40000_5m_profile" + }, + "Ethernet2|3-4": { + "profile": "pg_lossless_40000_5m_profile" + } + } +} + +``` + +When the system is running in dynamic buffer model, profiles can be: + + - either calculated dynamically according to ports' configuration and just configured as "NULL"; + - or configured explicitly. + +``` +{ +"BUFFER_PG": { + "Ethernet0|3-4": { + "profile": "NULL" + }, + "Ethernet1|3-4": { + "profile": "NULL" + }, + "Ethernet2|3-4": { + "profile": "static_profile" + } + } +} + +``` + +### Buffer pool + +When the system is running in traditional buffer model, the size of all of the buffer pools and xoff of ingress_lossless_pool need to be configured explicitly. + +``` +{ +"BUFFER_POOL": { + "egress_lossless_pool": { + "type": "egress", + "mode": "static", + "size": "15982720" + }, + "egress_lossy_pool": { + "type": "egress", + "mode": "dynamic", + "size": "9243812" + }, + "ingress_lossless_pool": { + "xoff": "4194112", + "type": "ingress", + "mode": "dynamic", + "size": "10875072" + } + } +} + +``` + +When the system is running in dynamic buffer model, the size of some of the buffer pools can be omitted and will be dynamically calculated. + +``` +{ +"BUFFER_POOL": { + "egress_lossless_pool": { + "type": "egress", + "mode": "static", + "size": "15982720" + }, + "egress_lossy_pool": { + "type": "egress", + "mode": "dynamic", + }, + "ingress_lossless_pool": { + "type": "ingress", + "mode": "dynamic", + } + } +} + +``` + + +### Buffer profile + +``` +{ +"BUFFER_PROFILE": { + "egress_lossless_profile": { + "static_th": "3995680", + "pool": "egress_lossless_pool", + "size": "1518" + }, + "egress_lossy_profile": { + "dynamic_th": "3", + "pool": "egress_lossy_pool", + "size": "1518" + }, + "ingress_lossy_profile": { + "dynamic_th": "3", + "pool": "ingress_lossless_pool", + "size": "0" + }, + "pg_lossless_40000_5m_profile": { + "xon_offset": "2288", + "dynamic_th": "-3", + "xon": "2288", + "xoff": "66560", + "pool": "ingress_lossless_pool", + "size": "1248" + }, + "pg_lossless_40000_40m_profile": { + "xon_offset": "2288", + "dynamic_th": "-3", + "xon": "2288", + "xoff": "71552", + "pool": "ingress_lossless_pool", + "size": "1248" + } + } +} + +``` + +When the system is running in dynamic buffer model and the headroom_type is dynamic, only dynamic_th needs to be configured and rest of fields can be omitted. +This kind of profiles will be handled by buffer manager and won't be applied to SAI. + +``` +{ + { + "non_default_dynamic_th_profile": { + "dynamic_th": 1, + "headroom_type": "dynamic" + } + } +} +``` + +### Buffer queue + +``` +{ +"BUFFER_QUEUE": { + "Ethernet50,Ethernet52,Ethernet54,Ethernet56|0-2": { + "profile": "egress_lossy_profile" + }, + "Ethernet50,Ethernet52,Ethernet54,Ethernet56|3-4": { + "profile": "egress_lossless_profile" + }, + "Ethernet50,Ethernet52,Ethernet54,Ethernet56|5-6": { + "profile": "egress_lossy_profile" + } + } +} + +``` + +### Buffer port ingress profile list + +``` +{ +"BUFFER_PORT_INGRESS_PROFILE_LIST": { + "Ethernet50": { + "profile_list": "ingress_lossy_profile,ingress_lossless_profile" + }, + "Ethernet52": { + "profile_list": "ingress_lossy_profile,ingress_lossless_profile" + }, + "Ethernet56": { + "profile_list": "ingress_lossy_profile,ingress_lossless_profile" + } + } +} + +``` + +### Buffer port egress profile list + +``` +{ +"BUFFER_PORT_EGRESS_PROFILE_LIST": { + "Ethernet50": { + "profile_list": "egress_lossy_profile,egress_lossless_profile" + }, + "Ethernet52": { + "profile_list": "egress_lossy_profile,egress_lossless_profile" + }, + "Ethernet56": { + "profile_list": "egress_lossy_profile,egress_lossless_profile" + } + } +} + +``` + +### Cable length + +``` +{ +"CABLE_LENGTH": { + "AZURE": { + "Ethernet8": "5m", + "Ethernet9": "5m", + "Ethernet2": "5m", + "Ethernet58": "5m", + "Ethernet59": "5m", + "Ethernet50": "40m", + "Ethernet51": "5m", + "Ethernet52": "40m", + "Ethernet53": "5m", + "Ethernet54": "40m", + "Ethernet55": "5m", + "Ethernet56": "40m" + } + } +} + +``` + +### COPP_TABLE + +``` +{ +"COPP_TABLE": { + "default": { + "cbs": "600", + "cir": "600", + "meter_type": "packets", + "mode": "sr_tcm", + "queue": "0", + "red_action": "drop" + }, + + "trap.group.arp": { + "cbs": "600", + "cir": "600", + "meter_type": "packets", + "mode": "sr_tcm", + "queue": "4", + "red_action": "drop", + "trap_action": "trap", + "trap_ids": "arp_req,arp_resp,neigh_discovery", + "trap_priority": "4" + }, + + "trap.group.lldp.dhcp.udld": { + "queue": "4", + "trap_action": "trap", + "trap_ids": "lldp,dhcp,udld", + "trap_priority": "4" + }, + + "trap.group.bgp.lacp": { + "queue": "4", + "trap_action": "trap", + "trap_ids": "bgp,bgpv6,lacp", + "trap_priority": "4" + }, + + "trap.group.ip2me": { + "cbs": "600", + "cir": "600", + "meter_type": "packets", + "mode": "sr_tcm", + "queue": "1", + "red_action": "drop", + "trap_action": "trap", + "trap_ids": "ip2me", + "trap_priority": "1" + } + } +} +``` + +### CRM + +``` +{ +"CRM": { + "Config": { + "acl_table_threshold_type": "percentage", + "nexthop_group_threshold_type": "percentage", + "fdb_entry_high_threshold": "85", + "acl_entry_threshold_type": "percentage", + "ipv6_neighbor_low_threshold": "70", + "nexthop_group_member_low_threshold": "70", + "acl_group_high_threshold": "85", + "ipv4_route_high_threshold": "85", + "acl_counter_high_threshold": "85", + "ipv4_route_low_threshold": "70", + "ipv4_route_threshold_type": "percentage", + "ipv4_neighbor_low_threshold": "70", + "acl_group_threshold_type": "percentage", + "ipv4_nexthop_high_threshold": "85", + "ipv6_route_threshold_type": "percentage", + "snat_entry_threshold_type": "percentage", + "snat_entry_high_threshold": "85", + "snat_entry_low_threshold": "70", + "dnat_entry_threshold_type": "percentage", + "dnat_entry_high_threshold": "85", + "dnat_entry_low_threshold": "70", + "ipmc_entry_threshold_type": "percentage", + "ipmc_entry_high_threshold": "85", + "ipmc_entry_low_threshold": "70" + } + } +} + +``` + +### Data Plane L3 Interfaces + +IP configuration for data plane are defined in **INTERFACE**, +**PORTCHANNEL_INTERFACE**, and **VLAN_INTERFACE** table. The objects +in all three tables have the interface (could be physical port, port +channel, or vlan) that IP address is attached to as first-level key, and +IP prefix as second-level key. IP interface objects don't have any +attributes. + +``` +{ +"INTERFACE": { + "Ethernet0|10.0.0.0/31": {}, + "Ethernet4|10.0.0.2/31": {}, + "Ethernet8|10.0.0.4/31": {} + ... + }, + +"PORTCHANNEL_INTERFACE": { + "PortChannel01|10.0.0.56/31": {}, + "PortChannel01|FC00::71/126": {}, + "PortChannel02|10.0.0.58/31": {}, + "PortChannel02|FC00::75/126": {} + ... + }, +"VLAN_INTERFACE": { + "Vlan1000|192.168.0.1/27": {} + } +} + +``` + + +### DEFAULT_LOSSLESS_BUFFER_PARAMETER + +This table stores the default lossless buffer parameters for dynamic buffer calculation. + +``` +{ + "DEFAULT_LOSSLESS_BUFFER_PARAMETER": { + "AZURE": { + "default_dynamic_th": "0", + "over_subscribe_ratio": "2" + } + } +} +``` + +### Device Metadata + +The **DEVICE_METADATA** table contains only one object named +*localhost*. In this table the device metadata such as hostname, hwsku, +deployment envionment id and deployment type are specified. BGP local AS +number is also specified in this table as current only single BGP +instance is supported in SONiC. + +``` +{ +"DEVICE_METADATA": { + "localhost": { + "hwsku": "Force10-S6100", + "default_bgp_status": "up", + "docker_routing_config_mode": "unified", + "hostname": "sonic-s6100-01", + "platform": "x86_64-dell_s6100_c2538-r0", + "mac": "4c:76:25:f4:70:82", + "default_pfcwd_status": "disable", + "bgp_asn": "65100", + "deployment_id": "1", + "type": "ToRRouter", + "buffer_model": "traditional" + } + } +} + +``` + + +### Device neighbor metada + +``` +{ +"DEVICE_NEIGHBOR_METADATA": { + "ARISTA01T1": { + "lo_addr": "None", + "mgmt_addr": "10.11.150.45", + "hwsku": "Arista-VM", + "type": "LeafRouter" + }, + "ARISTA02T1": { + "lo_addr": "None", + "mgmt_addr": "10.11.150.46", + "hwsku": "Arista-VM", + "type": "LeafRouter" + } + } +} + +``` + + +### DSCP_TO_TC_MAP +``` +{ +"DSCP_TO_TC_MAP": { + "AZURE": { + "1": "1", + "0": "1", + "3": "3", + "2": "1", + "5": "2", + "4": "4", + "7": "1", + "6": "1", + "9": "1", + "8": "0" + } + } +} + +``` + + +### MPLS_TC_TO_TC_MAP +``` +{ +"MPLS_TC_TO_TC_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "1", + "3": "2", + "4": "2", + "5": "3", + "6": "3", + "7": "4" + } + } +} + +``` + +### FLEX_COUNTER_TABLE + +``` +{ +"FLEX_COUNTER_TABLE": { + "PFCWD": { + "FLEX_COUNTER_STATUS": "enable" + }, + "PORT": { + "FLEX_COUNTER_STATUS": "enable" + }, + "QUEUE": { + "FLEX_COUNTER_STATUS": "enable" + } + } +} + +``` + + +### L2 Neighbors + +The L2 neighbor and connection information can be configured in +**DEVICE_NEIGHBOR** table. Those information are used mainly for LLDP. +While mandatory fields include neighbor name acting as object key and +remote port / local port information in attributes, optional information +about neighbor device such as device type, hwsku, management address and +loopback address can also be defined. + +``` +{ +"DEVICE_NEIGHBOR": { + "ARISTA04T1": { + "mgmt_addr": "10.20.0.163", + "hwsku": "Arista", + "lo_addr": null, + "local_port": "Ethernet124", + "type": "LeafRouter", + "port": "Ethernet1" + }, + "ARISTA03T1": { + "mgmt_addr": "10.20.0.162", + "hwsku": "Arista", + "lo_addr": null, + "local_port": "Ethernet120", + "type": "LeafRouter", + "port": "Ethernet1" + }, + "ARISTA02T1": { + "mgmt_addr": "10.20.0.161", + "hwsku": "Arista", + "lo_addr": null, + "local_port": "Ethernet116", + "type": "LeafRouter", + "port": "Ethernet1" + }, + "ARISTA01T1": { + "mgmt_addr": "10.20.0.160", + "hwsku": "Arista", + "lo_addr": null, + "local_port": "Ethernet112", + "type": "LeafRouter", + "port": "Ethernet1" + } + } +} +``` + +### Loopback Interface + +Loopback interface configuration lies in **LOOPBACK_INTERFACE** table +and has similar schema with data plane interfaces. The loopback device +name and loopback IP prefix act as multi-level key for loopback +interface objects. + +``` +{ +"LOOPBACK_INTERFACE": { + "Loopback0|10.1.0.32/32": {}, + "Loopback0|FC00:1::32/128": {} + } +} + +``` + +### LOSSLESS_TRAFFIC_PATTERN + +The LOSSLESS_TRAFFIC_PATTERN table stores parameters related to +lossless traffic for dynamic buffer calculation + +``` +{ + "LOSSLESS_TRAFFIC_PATTERN": { + "AZURE": { + "mtu": "1024", + "small_packet_percentage": "100" + } + } +} +``` + +### Management Interface + +Management interfaces are defined in **MGMT_INTERFACE** table. Object +key is composed of management interface name and IP prefix. Attribute +***gwaddr*** specify the gateway address of the prefix. +***forced_mgmt_routes*** attribute can be used to specify addresses / +prefixes traffic to which are forced to go through management network +instead of data network. + +``` +{ +"MGMT_INTERFACE": { + "eth0|10.11.150.11/16": { + "gwaddr": "10.11.0.1" + }, + "eth0|FC00:2::32/64": { + "forced_mgmt_routes": [ + "10.0.0.100/31", + "10.250.0.8", + "10.255.0.0/28" + ], + "gwaddr": "fc00:2::1" + } + } +} + +``` + +### Management port + +``` +{ +"MGMT_PORT": { + "eth0": { + "alias": "eth0", + "admin_status": "up" + } + } +} + +``` + + +### Management VRF + +``` +{ +"MGMT_VRF_CONFIG": { + "vrf_global": { + "mgmtVrfEnabled": "true" + } + } +} +``` + +### MAP_PFC_PRIORITY_TO_QUEUE + +``` +{ +"MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "1": "1", + "0": "0", + "3": "3", + "2": "2", + "5": "5", + "4": "4", + "7": "7", + "6": "6" + } + } +} +``` +### NTP Global Configuration + +These configuration options are used to modify the way that +ntp binds to the ports on the switch and which port it uses to +make ntp update requests from. + +***NTP VRF*** + +If this option is set to `default` then ntp will run within the default vrf +**when the management vrf is enabled**. If the mgmt vrf is enabled and this value is +not set to default then ntp will run within the mgmt vrf. + +This option **has no effect** if the mgmt vrf is not enabled. + +``` +{ +"NTP": { + "global": { + "vrf": "default" + } + } +} +``` + + +***NTP Source Port*** + +This option sets the port which ntp will choose to send time update requests from by. + +NOTE: If a Loopback interface is defined on the switch ntp will choose this by default, so this setting +is **required** if the switch has a Loopback interface and the ntp peer does not have defined routes +for that address. + +``` +{ +"NTP": { + "global": { + "src_intf": "Ethernet1" + } + } +} +``` + +### NTP and SYSLOG servers + +These information are configured in individual tables. Domain name or IP +address of the server is used as object key. Currently there are no +attributes in those objects. + +***NTP server*** +``` +{ +"NTP_SERVER": { + "2.debian.pool.ntp.org": {}, + "1.debian.pool.ntp.org": {}, + "3.debian.pool.ntp.org": {}, + "0.debian.pool.ntp.org": {} + }, + +"NTP_SERVER": { + "23.92.29.245": {}, + "204.2.134.164": {} + } +} +``` + +***Syslogserver*** +``` +{ +"SYSLOG_SERVER": { + "10.0.0.5": {}, + "10.0.0.6": {}, + "10.11.150.5": {} + } +} +``` + +### Policer + +Below is an example of the policer table configuration. +``` +{ + "POLICER": { + "everflow_static_policer": { + "meter_type": "bytes", + "mode": "sr_tcm", + "cir": "12500000", + "cbs": "12500000", + "pir": "17500000", + "pbs": "17500000", + "color": "aware", + "red_packet_action": "drop", + "yellow_packet_action": "drop" + "green_packet_action": "forward" + } + } +} + +``` +Key to the table defines policer name Below are the fields +- meter_type - Mandatory field. Defines how the metering is done. values - bytes, packets +- mode - Mandatory field. Defines one of the three modes support. values - sr_tcm, tr_tcm, storm +- cir - Committed information rate bytes/sec or packets/sec based on meter_type +- cbs - Committed burst size in bytes or packets based on meter_type +- pir - Peak information rate in bytes/sec or packets/sec based on meter_type +- pbs - Peak burst size in bytes or packets based on meter_type +- color - Defines the color source for the policer. values - aware, blind +- red_packet_action - Defines the action to be taken for red color packets +- yellow_packet_action - Defines the action to be taken for yellow color packets +- green_packet_action - Defines the action to be taken for green color packets. + +The packet action could be: + +- 'drop' +- 'forward' +- 'copy' +- 'copy_cancel' +- 'trap' +- 'log' +- 'deny' +- 'transit' +### Port + +In this table the physical port configurations are defined. Each object +will have port name as its key, and port name alias and port speed as +optional attributes. + +``` +{ +"PORT": { + "Ethernet0": { + "index": "0", + "lanes": "101,102", + "description": "fortyGigE1/1/1", + "mtu": "9100", + "alias": "fortyGigE1/1/1", + "speed": "40000" + }, + "Ethernet1": { + "index": "1", + "lanes": "103,104", + "description": "fortyGigE1/1/2", + "mtu": "9100", + "alias": "fortyGigE1/1/2", + "admin_status": "up", + "speed": "40000" + }, + "Ethernet63": { + "index": "63", + "lanes": "87,88", + "description": "fortyGigE1/4/16", + "mtu": "9100", + "alias": "fortyGigE1/4/16", + "speed": "40000" + } + } +} + +``` + +### Port Channel + +Port channels are defined in **PORTCHANNEL** table with port channel +name as object key and member list as attribute. + +``` +{ +"PORTCHANNEL": { + "PortChannel0003": { + "admin_status": "up", + "min_links": "1", + "members": [ + "Ethernet54" + ], + "mtu": "9100" + }, + "PortChannel0004": { + "admin_status": "up", + "min_links": "1", + "members": [ + "Ethernet56" + ], + "mtu": "9100" + } + } +} +``` + + +### Portchannel member + +``` +{ +"PORTCHANNEL_MEMBER": { + "PortChannel0001|Ethernet50": {}, + "PortChannel0002|Ethernet52": {}, + "PortChannel0003|Ethernet54": {}, + "PortChannel0004|Ethernet56": {} + } +} + +``` +### Scheduler + +``` +{ +"SCHEDULER": { + "scheduler.0": { + "type": "STRICT" + }, + "scheduler.1": { + "type": "WRR" + "weight": "1", + "meter_type": "bytes", + "pir": "1250000000", + "pbs": "8192" + }, + "scheduler.port": { + "meter_type": "bytes", + "pir": "1000000000", + "pbs": "8192" + } + } +} +``` + +### Port QoS Map + +``` +{ +"PORT_QOS_MAP": { + "Ethernet50,Ethernet52,Ethernet54,Ethernet56": { + "tc_to_pg_map": "AZURE", + "tc_to_queue_map": "AZURE", + "pfc_enable": "3,4", + "pfc_to_queue_map": "AZURE", + "dscp_to_tc_map": "AZURE", + "dscp_to_fc_map": "AZURE", + "exp_to_fc_map": "AZURE", + "scheduler": "scheduler.port" + } + } +} +``` + +### Queue +``` +{ +"QUEUE": { + "Ethernet56|4": { + "wred_profile": "AZURE_LOSSLESS", + "scheduler": "scheduler.1" + }, + "Ethernet56|5": { + "scheduler": "scheduler.0" + }, + "Ethernet56|6": { + "scheduler": "scheduler.0" + } + } +} +``` + + +### Tacplus Server + +``` +{ +"TACPLUS_SERVER": { + "10.0.0.8": { + "priority": "1", + "tcp_port": "49" + }, + "10.0.0.9": { + "priority": "1", + "tcp_port": "49" + } + } +} +``` + + +### TC to Priority group map + +``` +{ +"TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "1": "1", + "0": "0", + "3": "3", + "2": "2", + "5": "5", + "4": "4", + "7": "7", + "6": "6" + } + } +} +``` + +### TC to Queue map + +``` +{ +"TC_TO_QUEUE_MAP": { + "AZURE": { + "1": "1", + "0": "0", + "3": "3", + "2": "2", + "5": "5", + "4": "4", + "7": "7", + "6": "6" + } + } +} +``` + +### Versions + +This table is where the curret version of the software is recorded. +``` +{ + "VERSIONS": { + "DATABASE": { + "VERSION": "version_1_0_1" + } + } +} +``` + +### VLAN + +This table is where VLANs are defined. VLAN name is used as object key, +and member list as well as an integer id are defined as attributes. If a +DHCP relay is required for this VLAN, a dhcp_servers attribute must be +specified for that VLAN, the value of which is a list that must contain +the domain name or IP address of one or more DHCP servers. + +``` +{ +"VLAN": { + "Vlan1000": { + "dhcp_servers": [ + "192.0.0.1", + "192.0.0.2", + "192.0.0.3", + "192.0.0.4" + ], + "members": [ + "Ethernet0", + "Ethernet4", + "Ethernet8", + "Ethernet12" + ], + "vlanid": "1000" + } + } +} +``` + +### VLAN_MEMBER + +VLAN member table has Vlan name together with physical port or port +channel name as object key, and tagging mode as attributes. + +``` +{ +"VLAN_MEMBER": { + "Vlan1000|PortChannel47": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet8": { + "tagging_mode": "untagged" + }, + "Vlan2000|PortChannel47": { + "tagging_mode": "tagged" + } + } +} +``` + +### Virtual router + +The virtual router table allows to insert or update a new virtual router +instance. The key of the instance is its name. The attributes in the +table allow to change properties of a virtual router. Attributes: + +- 'v4' contains boolean value 'true' or 'false'. Enable or + disable IPv4 in the virtual router +- 'v6' contains boolean value 'true' or 'false'. Enable or + disable IPv6 in the virtual router +- 'src_mac' contains MAC address. What source MAC address will be + used for packets egressing from the virtual router +- 'ttl_action' contains packet action. Defines the action for + packets with TTL == 0 or TTL == 1 +- 'ip_opt_action' contains packet action. Defines the action for + packets with IP options +- 'l3_mc_action' contains packet action. Defines the action for + unknown L3 multicast packets + +The packet action could be: + +- 'drop' +- 'forward' +- 'copy' +- 'copy_cancel' +- 'trap' +- 'log' +- 'deny' +- 'transit' + + +***TBD*** +``` +'VRF:rid1': { + 'v4': 'true', + 'v6': 'false', + 'src_mac': '02:04:05:06:07:08', + 'ttl_action': 'copy', + 'ip_opt_action': 'deny', + 'l3_mc_action': 'drop' +} +``` + + +### WRED_PROFILE + +``` +{ +"WRED_PROFILE": { + "AZURE_LOSSLESS": { + "red_max_threshold": "2097152", + "wred_green_enable": "true", + "ecn": "ecn_all", + "green_min_threshold": "1048576", + "red_min_threshold": "1048576", + "wred_yellow_enable": "true", + "yellow_min_threshold": "1048576", + "green_max_threshold": "2097152", + "green_drop_probability": "5", + "yellow_max_threshold": "2097152", + "wred_red_enable": "true", + "yellow_drop_probability": "5", + "red_drop_probability": "5" + } + } +} +``` + +### BREAKOUT_CFG + +This table is introduced as part of Dynamic Port Breakout(DPB) feature. +It shows the current breakout mode of all ports(root ports). +The list of root ports, all possible breakout modes, and default breakout modes + are obtained/derived from platform.json and hwsku.json files. + +``` +"BREAKOUT_CFG": { + "Ethernet0": { + "brkout_mode": "4x25G[10G]" + }, + "Ethernet4": { + "brkout_mode": "4x25G[10G]" + }, + "Ethernet8": { + "brkout_mode": "4x25G[10G]" + }, + + ...... + + "Ethernet116": { + "brkout_mode": "2x50G" + }, + "Ethernet120": { + "brkout_mode": "2x50G" + }, + "Ethernet124": { + "brkout_mode": "2x50G" + } +} +``` + +### AAA + +The AAA table defined the method SONiC used for Authentication, Authorization and Accounting. +The method could be: +- default +- local +- tacacs+ +- radius + +``` +"AAA": { + "authentication": { + "login": "local" + }, + "authorization": { + "login": "local" + }, + "accounting": { + "login": "local" + } +} +``` + +For Developers +============== + +Generating Application Config by Jinja2 Template +------------------------------------------------ + +To be added. + +Incremental Configuration by Subscribing to ConfigDB +---------------------------------------------------- + +Detail instruction to be added. A sample could be found in this +[PR](https://github.com/Azure/sonic-buildimage/pull/861) that +implemented dynamic configuration for BGP. diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index 51c190e495d4..429549255824 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -1,9 +1,44 @@ +import shutil +import os +import glob +import jinja2 from setuptools import setup, find_packages +from setuptools.command.build_py import build_py # read me with open('README.rst') as readme_file: readme = readme_file.read() +class my_build_py(build_py): + def run(self): + if not self.dry_run: + print("hehe") + + if not os.path.exists("./yang-models"): + os.makedirs("./yang-models") + + if not os.path.exists("./cvlyang-models"): + os.makedirs("./cvlyang-models") + + # copy non-template yang model to internal yang model directory + for fname in glob.glob("./yang-models/*.yang"): + bfname = os.path.basename(fname) + shutil.copyfile("./yang-models/{}".format(bfname), "./cvlyang-models/{}".format(bfname)) + + # templated yang models + env = jinja2.Environment(loader=jinja2.FileSystemLoader('./yang-templates/'), trim_blocks=True) + for fname in glob.glob("./yang-templates/*.yang.j2"): + bfname = os.path.basename(fname) + template = env.get_template(bfname) + yang_model = template.render(yang_model_type="py") + cvlyang_model = template.render(yang_model_type="cvl") + with open("./yang-models/{}".format(bfname.strip(".j2")), 'w') as f: + f.write(yang_model) + with open("./cvlyang-models/{}".format(bfname.strip(".j2")), 'w') as f: + f.write(cvlyang_model) + + build_py.run(self) + setup( author="lnos-coders", author_email='lnos-coders@linkedin.com', @@ -40,17 +75,30 @@ py_modules=[], packages=find_packages(), version='1.0', + cmdclass={'build_py': my_build_py}, data_files=[ ('yang-models', ['./yang-models/sonic-acl.yang', + './yang-models/sonic-auto_techsupport.yang', './yang-models/sonic-bgp-common.yang', './yang-models/sonic-bgp-global.yang', + './yang-models/sonic-bgp-monitor.yang', './yang-models/sonic-bgp-neighbor.yang', './yang-models/sonic-bgp-peergroup.yang', + './yang-models/sonic-bgp-peerrange.yang', + './yang-models/sonic-bgp-allowed-prefix.yang', './yang-models/sonic-breakout_cfg.yang', + './yang-models/sonic-buffer-pg.yang', + './yang-models/sonic-buffer-pool.yang', + './yang-models/sonic-buffer-port-ingress-profile-list.yang', + './yang-models/sonic-buffer-port-egress-profile-list.yang', + './yang-models/sonic-buffer-profile.yang', + './yang-models/sonic-buffer-queue.yang', + './yang-models/sonic-cable-length.yang', './yang-models/sonic-copp.yang', './yang-models/sonic-crm.yang', './yang-models/sonic-device_metadata.yang', './yang-models/sonic-device_neighbor.yang', + './yang-models/sonic-dhcpv6-relay.yang', './yang-models/sonic-extension.yang', './yang-models/sonic-flex_counter.yang', './yang-models/sonic-feature.yang', @@ -59,24 +107,94 @@ './yang-models/sonic-mgmt_interface.yang', './yang-models/sonic-mgmt_port.yang', './yang-models/sonic-mgmt_vrf.yang', + './yang-models/sonic-mirror-session.yang', './yang-models/sonic-ntp.yang', './yang-models/sonic-nat.yang', + './yang-models/sonic-nvgre-tunnel.yang', + './yang-models/sonic-pbh.yang', './yang-models/sonic-port.yang', + './yang-models/sonic-policer.yang', './yang-models/sonic-portchannel.yang', './yang-models/sonic-pfcwd.yang', './yang-models/sonic-route-common.yang', './yang-models/sonic-route-map.yang', './yang-models/sonic-routing-policy-sets.yang', './yang-models/sonic-sflow.yang', + './yang-models/sonic-syslog.yang', './yang-models/sonic-system-aaa.yang', './yang-models/sonic-system-tacacs.yang', './yang-models/sonic-types.yang', './yang-models/sonic-versions.yang', './yang-models/sonic-vlan.yang', './yang-models/sonic-vrf.yang', + './yang-models/sonic-mclag.yang', + './yang-models/sonic-vlan-sub-interface.yang', './yang-models/sonic-warm-restart.yang', './yang-models/sonic-lldp.yang', - './yang-models/sonic_yang_tree']), + './yang-models/sonic-scheduler.yang', + './yang-models/sonic-wred-profile.yang', + './yang-models/sonic-queue.yang', + './yang-models/sonic-dscp-fc-map.yang', + './yang-models/sonic-exp-fc-map.yang', + './yang-models/sonic-dscp-tc-map.yang', + './yang-models/sonic-dot1p-tc-map.yang', + './yang-models/sonic-storm-control.yang', + './yang-models/sonic-tc-priority-group-map.yang', + './yang-models/sonic-tc-queue-map.yang', + './yang-models/sonic-pfc-priority-queue-map.yang', + './yang-models/sonic-pfc-priority-priority-group-map.yang', + './yang-models/sonic-port-qos-map.yang']), + ('cvlyang-models', ['./cvlyang-models/sonic-acl.yang', + './cvlyang-models/sonic-bgp-common.yang', + './cvlyang-models/sonic-bgp-global.yang', + './cvlyang-models/sonic-bgp-monitor.yang', + './cvlyang-models/sonic-bgp-neighbor.yang', + './cvlyang-models/sonic-bgp-peergroup.yang', + './cvlyang-models/sonic-bgp-peerrange.yang', + './cvlyang-models/sonic-bgp-allowed-prefix.yang', + './cvlyang-models/sonic-breakout_cfg.yang', + './cvlyang-models/sonic-copp.yang', + './cvlyang-models/sonic-crm.yang', + './cvlyang-models/sonic-device_metadata.yang', + './cvlyang-models/sonic-device_neighbor.yang', + './cvlyang-models/sonic-extension.yang', + './cvlyang-models/sonic-flex_counter.yang', + './cvlyang-models/sonic-feature.yang', + './cvlyang-models/sonic-interface.yang', + './cvlyang-models/sonic-loopback-interface.yang', + './cvlyang-models/sonic-mgmt_interface.yang', + './cvlyang-models/sonic-mgmt_port.yang', + './cvlyang-models/sonic-mgmt_vrf.yang', + './cvlyang-models/sonic-ntp.yang', + './cvlyang-models/sonic-nat.yang', + './cvlyang-models/sonic-nvgre-tunnel.yang', + './cvlyang-models/sonic-pbh.yang', + './cvlyang-models/sonic-policer.yang', + './cvlyang-models/sonic-port.yang', + './cvlyang-models/sonic-portchannel.yang', + './cvlyang-models/sonic-pfcwd.yang', + './cvlyang-models/sonic-route-common.yang', + './cvlyang-models/sonic-route-map.yang', + './cvlyang-models/sonic-routing-policy-sets.yang', + './cvlyang-models/sonic-sflow.yang', + './cvlyang-models/sonic-system-aaa.yang', + './cvlyang-models/sonic-system-tacacs.yang', + './cvlyang-models/sonic-types.yang', + './cvlyang-models/sonic-versions.yang', + './cvlyang-models/sonic-vlan.yang', + './cvlyang-models/sonic-vrf.yang', + './cvlyang-models/sonic-warm-restart.yang', + './cvlyang-models/sonic-lldp.yang', + './cvlyang-models/sonic-scheduler.yang', + './cvlyang-models/sonic-wred-profile.yang', + './cvlyang-models/sonic-queue.yang', + './cvlyang-models/sonic-dscp-tc-map.yang', + './cvlyang-models/sonic-dot1p-tc-map.yang', + './cvlyang-models/sonic-tc-priority-group-map.yang', + './cvlyang-models/sonic-tc-queue-map.yang', + './cvlyang-models/sonic-pfc-priority-queue-map.yang', + './cvlyang-models/sonic-pfc-priority-priority-group-map.yang', + './cvlyang-models/sonic-port-qos-map.yang']), ], zip_safe=False, ) diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index bd7aff24b554..6618ed8232b7 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -4,6 +4,75 @@ "Vrf_blue": { } }, + "BUFFER_POOL": { + "ingress_lossy_pool": { + "mode": "static", + "size": "33004032", + "type": "ingress" + }, + "ingress_lossless_pool": { + "mode": "static", + "size": "33004032", + "xoff": "196608", + "type": "ingress" + }, + "egress_lossless_pool": { + "mode": "static", + "size": "33004032", + "xoff": "196608", + "type": "egress" + }, + "egress_lossy_pool": { + "size": "12766208", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "pg_lossless_100000_300m_profile": { + "dynamic_th": "1", + "pool": "ingress_lossless_pool", + "size": "9427", + "xoff": "50176", + "xon": "0", + "xon_offset": "3584" + }, + "ingress_lossy_profile": { + "pool":"ingress_lossy_pool", + "size":"1518", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"1518", + "dynamic_th":"3" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"1518", + "dynamic_th":"3" + } + }, + "BUFFER_PG": { + "Ethernet9|3-4": { + "profile": "pg_lossless_100000_300m_profile" + } + }, + "BUFFER_QUEUE": { + "Ethernet10|4": { + "profile": "egress_lossy_profile" + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST": { + "Ethernet9": { + "profile_list": ["ingress_lossy_profile"] + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST": { + "Ethernet9": { + "profile_list": ["egress_lossless_profile", "egress_lossy_profile"] + } + }, "PORTCHANNEL": { "PortChannel0003": { "admin_status": "up", @@ -24,6 +93,16 @@ "tpid": "0x9200", "mtu": "9100", "lacp_key": "auto" + }, + "PortChannel2": { + "admin_status": "up", + "min_links": "1", + "members": [ + "Ethernet12" + ], + "tpid": "0x9200", + "mtu": "9100", + "lacp_key": "auto" } }, "PORTCHANNEL_INTERFACE": { @@ -34,7 +113,8 @@ }, "PORTCHANNEL_MEMBER": { "PortChannel0003|Ethernet1": {}, - "PortChannel0004|Ethernet2": {} + "PortChannel0004|Ethernet2": {}, + "PortChannel2|Ethernet12": {} }, "VLAN_INTERFACE": { "Vlan111": { @@ -70,7 +150,8 @@ "V4-ACL-TABLE|DEFAULT_DENY": { "PACKET_ACTION": "DROP", "IP_TYPE": "IPv4ANY", - "PRIORITY": "0" + "PRIORITY": "0", + "ETHER_TYPE": "2048" }, "V4-ACL-TABLE|Rule_20": { "PACKET_ACTION": "FORWARD", @@ -202,6 +283,11 @@ "SRC_IPV6": "::/0", "PRIORITY": "990000", "DST_IPV6": "::/0" + }, + "EVERFLOW_DSCP|RULE_1": { + "MIRROR_INGRESS_ACTION": "erspan", + "DSCP": "10", + "PRIORITY": "9999" } }, "DEVICE_METADATA": { @@ -211,7 +297,15 @@ "hostname": "asw.dc", "bgp_asn": "64850", "hwsku": "Stone", - "buffer_model": "dynamic" + "buffer_model": "dynamic", + "cloudtype": "Public", + "region": "usfoo", + "asic_name": "Asic0", + "switch_id": "2", + "switch_type": "voq", + "max_cores": "8", + "sub_role": "FrontEnd", + "dhcp_server": "disabled" } }, "VLAN": { @@ -220,6 +314,9 @@ "dhcp_servers": [ "10.222.72.116" ], + "dhcpv6_servers": [ + "2a04:5555:41::11" + ], "vlanid": "111", "mtu": "9216", "admin_status": "up" @@ -229,10 +326,23 @@ "dhcp_servers": [ "10.222.72.116" ], + "dhcpv6_servers": [ + "2a04:5555:41::11" + ], "vlanid": "777", "mtu": "9216", "admin_status": "up" + }, + "Vlan12": { + "description": "mclag session ve", + "dhcp_servers": [ + "12.1.1.1" + ], + "vlanid": "12", + "mtu": "9216", + "admin_status": "up" } + }, "DEVICE_NEIGHBOR": { "Ethernet112": { @@ -285,9 +395,9 @@ "global": { "vrf": "mgmt", "src_intf": [ - "eth0", - "Loopback0" - ] + "eth0", + "Loopback0" + ] } }, "NTP_SERVER": { @@ -295,6 +405,17 @@ "23.92.29.245": {}, "2001:aa:aa::aa": {} }, + "SYSLOG_SERVER" : { + "10.13.14.17": {}, + "20.1.1.1": {}, + "2001:aa:aa::aa": {} + }, + "CABLE_LENGTH": { + "AZURE": { + "Ethernet0": "5m", + "Ethernet1": "5m" + } + }, "PORT": { "Ethernet0": { "alias": "Eth1/1", @@ -302,7 +423,10 @@ "description": "", "speed": "11100", "tpid": "0x8100", - "admin_status": "up" + "admin_status": "up", + "index": "0", + "asic_port_name": "Eth0-ASIC1", + "role": "Ext" }, "Ethernet1": { "alias": "Eth1/2", @@ -600,6 +724,15 @@ "speed": "11100", "tpid": "0x8100", "admin_status": "up" + }, + "Ethernet120": { + "alias": "Eth31/1", + "lanes": "121,122", + "description": "", + "fec": "fc", + "speed": "11100", + "tpid": "0x8100", + "admin_status": "up" } }, "ACL_TABLE": { @@ -628,7 +761,17 @@ "Ethernet25", "Ethernet24" ] + }, + "EVERFLOW_DSCP": { + "type": "MIRROR_DSCP", + "policy_desc": "EVERFLOW_DSCP", + "ports": [ + "Ethernet14", + "Ethernet24" + ], + "stage": "ingress" } + }, "PBH_HASH_FIELD": { "inner_ip_proto": { @@ -757,6 +900,23 @@ "family": "IPv4" } }, + "VLAN_SUB_INTERFACE": { + "Ethernet12.10": { + "admin_status": "up" + }, + "Ethernet12.10|10.0.1.56/31": {}, + "Ethernet12.10|fc00::1:71/126": {}, + "Po0003.10": { + "admin_status": "up" + }, + "Po0003.10|10.0.1.58/31": {}, + "Po0003.10|fc00::1:75/126": {}, + "Eth120.10": { + "admin_status": "up" + }, + "Eth120.10|10.0.1.60/31": {}, + "Eth120.10|fc00::1:79/126": {} + }, "VLAN_MEMBER": { "Vlan111|Ethernet0": { "tagging_mode": "untagged" @@ -805,6 +965,9 @@ }, "Vlan111|PortChannel0003": { "tagging_mode": "untagged" + }, + "Vlan12|PortChannel2": { + "tagging_mode": "tagged" } }, "LOOPBACK_INTERFACE": { @@ -841,28 +1004,49 @@ "FLEX_COUNTER_STATUS": "enable" }, "PG_WATERMARK": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": "10000" }, "PORT": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": "1000" }, "PORT_RATES": { "FLEX_COUNTER_STATUS": "enable" }, "PORT_BUFFER_DROP": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": "60000" }, "BUFFER_POOL_WATERMARK": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": "10000" }, "QUEUE": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": "10000" }, "QUEUE_WATERMARK": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": "10000" }, "DEBUG_COUNTER": { "FLEX_COUNTER_STATUS": "enable" + }, + "FLOW_CNT_ROUTE": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": "10000" + } + }, + "FLOW_COUNTER_ROUTE_PATTERN": { + "1.1.1.0/24": { + "max_match_count": "30" + }, + "2000::/64": { + "max_match_count": "30" + }, + "Vnet1|2.2.2.0/24": { + "max_match_count": "30" } }, "CRM": { @@ -879,13 +1063,22 @@ "polling_interval": "0" } }, - "WARM_RESTART": { "bgp": { "bgp_timer": "500" } }, - + "PORT_STORM_CONTROL": { + "Ethernet0|broadcast": { + "kbps": "10000" + }, + "Ethernet0|unknown-multicast": { + "kbps": "30000" + }, + "Ethernet0|unknown-unicast": { + "kbps": "20000" + } + }, "PFC_WD": { "Ethernet9": { "action": "drop", @@ -929,6 +1122,12 @@ "AAA": { "authentication": { "login": "local" + }, + "authorization": { + "login": "local" + }, + "accounting": { + "login": "local" } }, "TACPLUS": { @@ -998,6 +1197,36 @@ "default|ipv4_unicast|21.0.0.0/8": { } }, + "BGP_PEER_RANGE": { + "BGPSLBPassive": { + "ip_range": [ + "10.255.0.0/25" + ], + "name": "BGPSLBPassive", + "src_address": "10.1.0.32" + }, + "BGPVac": { + "ip_range": [ + "192.168.0.0/21", + "192.169.0.0/21", + "192.170.0.0/21" + ], + "name": "BGPVac", + "src_address": "10.1.0.32" + } + }, + "BGP_MONITORS": { + "5.6.7.8": { + "admin_status": "up", + "asn": "65000", + "holdtime": "180", + "keepalive": "60", + "local_addr": "10.0.0.11", + "name": "BGPMonitor", + "nhopself": "0", + "rrclient": "0" + } + }, "BGP_NEIGHBOR": { "10.0.0.1": { "asn": "65200", @@ -1006,7 +1235,8 @@ "local_addr": "10.0.0.2", "name":"PEER1", "nhopself":"0", - "rrclient":"0" + "rrclient":"0", + "admin_status":"up" }, "default|192.168.1.1": { "local_asn": "65200", @@ -1032,6 +1262,14 @@ "peer_group": "PG1" } }, + "BGP_ALLOWED_PREFIXES" :{ + "DEPLOYMENT_ID|4|123:123": { + "default_action": "permit" + }, + "DEPLOYMENT_ID|5": { + "default_action": "permit" + } + }, "ROUTE_MAP_SET": { "map1": { } @@ -1071,6 +1309,34 @@ "trap_group": "queue1_group1" } }, + + "AUTO_TECHSUPPORT": { + "GLOBAL": { + "state" : "enabled", + "rate_limit_interval" : "180", + "max_techsupport_limit" : "10.0", + "max_core_limit" : "0.0", + "since" : "2 days ago" + } + }, + "AUTO_TECHSUPPORT_FEATURE": { + "bgp" :{ + "state" : "disabled", + "rate_limit_interval" : "600" + }, + "swss" : { + "state" : "enabled", + "rate_limit_interval" : "600" + }, + "snmp" : { + "state" : "enabled", + "rate_limit_interval" : "500" + }, + "dhcp_relay" : { + "state" : "disabled", + "rate_limit_interval" : "1000" + } + }, "LLDP": { "GLOBAL": { "mode": "TRANSMIT", @@ -1092,11 +1358,12 @@ "FEATURE": { "bgp": { "auto_restart": "enabled", - "has_global_scope": "false", - "has_per_asic_scope": "true", - "has_timer": "false", + "has_global_scope": "False", + "has_per_asic_scope": "True", + "has_timer": "False", "high_mem_alert": "disabled", - "state": "enabled" + "state": "enabled", + "set_owner": "local" }, "database": { "auto_restart": "always_enabled", @@ -1104,7 +1371,8 @@ "has_per_asic_scope": "true", "has_timer": "false", "high_mem_alert": "disabled", - "state": "always_enabled" + "state": "always_enabled", + "set_owner": "local" }, "snmp": { "auto_restart": "enabled", @@ -1112,7 +1380,8 @@ "has_per_asic_scope": "false", "has_timer": "true", "high_mem_alert": "disabled", - "state": "enabled" + "state": "enabled", + "set_owner": "kube" }, "swss": { "auto_restart": "enabled", @@ -1120,7 +1389,8 @@ "has_per_asic_scope": "true", "has_timer": "false", "high_mem_alert": "disabled", - "state": "enabled" + "state": "enabled", + "set_owner": "local" }, "syncd": { "auto_restart": "enabled", @@ -1128,7 +1398,8 @@ "has_per_asic_scope": "true", "has_timer": "false", "high_mem_alert": "disabled", - "state": "enabled" + "state": "enabled", + "set_owner": "local" }, "lldp": { "auto_restart": "enabled", @@ -1136,15 +1407,298 @@ "has_per_asic_scope": "true", "has_timer": "false", "high_mem_alert": "disabled", - "state": "enabled" + "state": "enabled", + "set_owner": "kube" + }, + "dhcp_relay": { + "auto_restart": "enabled", + "has_global_scope": "false", + "has_per_asic_scope": "true", + "has_timer": "false", + "high_mem_alert": "disabled", + "state": "{% if not (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] != 'ToRRouter') %}enabled{% else %}disabled{% endif %}", + "set_owner": "kube" + } + }, + "DHCP_RELAY": { + "Vlan111": { + "dhcpv6_servers": [ + "2a04:5555:41::11" + ], + "rfc6939_support": "true" + }, + "Vlan777": { + "dhcpv6_servers": [ + "2a04:5555:41::11" + ], + "rfc6939_support": "true" + } + }, + "SCHEDULER": { + "TEST@0": { + "cbs": "256", + "cir": "1250000", + "meter_type": "bytes", + "pbs": "1024", + "pir": "25000000", + "type": "DWRR", + "weight": "20" + }, + "TEST@1": { + "cbs": "1024", + "cir": "1280000", + "meter_type": "bytes", + "pbs": "2048", + "pir": "2560000", + "type": "STRICT" + }, + "scheduler.0": { + "cbs": "256", + "cir": "1250000", + "meter_type": "bytes", + "pbs": "1024", + "pir": "25000000", + "type": "DWRR", + "weight": "20" + }, + + "scheduler.1": { + "cbs": "1024", + "cir": "1280000", + "meter_type": "bytes", + "pbs": "2048", + "pir": "2560000", + "type": "STRICT" + } + }, + + "WRED_PROFILE": { + "Wred1": { + "ecn": "ecn_all", + "green_drop_probability": "50", + "green_max_threshold": "2048000", + "green_min_threshold": "1024000", + "wred_green_enable": "true", + "yellow_drop_probability": "50", + "yellow_max_threshold": "2048000", + "yellow_min_threshold": "1024000", + "wred_yellow_enable": "true", + "red_drop_probability": "50", + "red_max_threshold": "2048000", + "red_min_threshold": "1024000", + "wred_red_enable": "true" + } + }, + + "QUEUE": { + "Ethernet0|0": { + "scheduler": "TEST@0", + "wred_profile": "Wred1" + }, + "Ethernet0|1": { + "scheduler": "TEST@1", + "wred_profile": "Wred1" + }, + "Ethernet0|2": { + "scheduler": "scheduler.0" + }, + "Ethernet0|3": { + "scheduler": "scheduler.1" + } + }, + + "DSCP_TO_FC_MAP": { + "Dscp_to_fc_map1": { + "1": "1", + "2": "2" + }, + "Dscp_to_fc_map2": { + "3": "3", + "4": "4" + } + }, + + "EXP_TO_FC_MAP": { + "Exp_to_fc_map1": { + "1": "1", + "2": "2" + }, + "Exp_to_fc_map2": { + "3": "3", + "4": "4" + } + }, + + "DSCP_TO_TC_MAP": { + "Dscp_to_tc_map1": { + "1": "1", + "2": "2" + }, + "Dscp_to_tc_map2": { + "3": "3", + "4": "4" + } + }, + + "DOT1P_TO_TC_MAP": { + "Dot1p_to_tc_map1": { + "1": "1", + "2": "2" + }, + "Dot1p_to_tc_map2": { + "3": "3", + "4": "4" + } + }, + + "TC_TO_PRIORITY_GROUP_MAP": { + "tc_to_pg_map1": { + "1": "1", + "2": "2" + }, + "tc_to_pg_map2": { + "3": "3", + "4": "4" + } + }, + + "TC_TO_QUEUE_MAP": { + "tc_to_q_map1": { + "1": "1", + "2": "2" + }, + "tc_to_q_map2": { + "3": "3", + "4": "4" + } + }, + + "MAP_PFC_PRIORITY_TO_QUEUE": { + "pfc_prio_to_q_map1": { + "1": "1", + "2": "2" + }, + "pfc_prio_to_q_map2": { + "3": "3", + "4": "4" + } + }, + + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "pfc_prio_to_pg_map1": { + "1": "1", + "2": "2" + }, + "pfc_prio_to_pg_map2": { + "3": "3", + "4": "4" + } + }, + + "PORT_QOS_MAP": { + "Ethernet0": { + "dot1p_to_tc_map" : "Dot1p_to_tc_map1", + "dscp_to_tc_map": "Dscp_to_tc_map1", + "tc_to_queue_map": "tc_to_q_map1", + "tc_to_pg_map": "tc_to_pg_map1", + "pfc_to_queue_map": "pfc_prio_to_q_map1", + "pfc_to_pg_map" : "pfc_prio_to_pg_map1", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + }, + "Ethernet4": { + "dot1p_to_tc_map" : "Dot1p_to_tc_map2", + "dscp_to_tc_map": "Dscp_to_tc_map2", + "tc_to_queue_map": "tc_to_q_map2", + "tc_to_pg_map": "tc_to_pg_map2", + "pfc_to_queue_map": "pfc_prio_to_q_map2", + "pfc_to_pg_map" : "pfc_prio_to_pg_map2", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" + } + }, + + + "MCLAG_DOMAIN": { + "123": { + "source_ip": "12.1.1.1", + "peer_ip": "12.1.1.2", + "peer_link": "PortChannel2", + "keepalive_interval": "1", + "session_timeout": "30" + } + }, + "MCLAG_INTERFACE": { + "123|PortChannel0004": { + "if_type": "PortChannel" + } + }, + "MCLAG_UNIQUE_IP": { + "Vlan12": { + "unique_ip": "enable" + } + }, + + + "MIRROR_SESSION": { + "erspan": { + "dscp": "10", + "dst_ip": "11.1.1.1", + "gre_type": "0x1234", + "queue": "0", + "src_ip": "10.1.1.1", + "ttl": "10", + "policer": "everflow_static_policer", + "type": "ERSPAN" + }, + "span": { + "direction": "RX", + "type": "SPAN", + "dst_port": "Ethernet2", + "src_port": [ + "Ethernet3", + "Ethernet4" + ] + + } + }, + + + "POLICER": { + "everflow_static_policer": { + "meter_type": "bytes", + "mode": "sr_tcm", + "cir": "12500000", + "cbs": "12500000", + "color": "aware", + "red_packet_action": "drop" + } + }, + + + "NVGRE_TUNNEL": { + "tunnel_1": { + "src_ip": "10.0.0.1" + } + }, + "NVGRE_TUNNEL_MAP": { + "tunnel_1|Vlan111": { + "vlan_id": "111", + "vsid": "5000" } } - }, + + }, "SAMPLE_CONFIG_DB_UNKNOWN": { "UNKNOWN_TABLE": { "Error": "This Table is for testing, This Table does not have YANG models." } + }, + "SAMPLE_CONFIG_DB_SPECIAL_CASE": { + "TACPLUS": { + "global": { + } + } } - } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/aaa.json b/src/sonic-yang-models/tests/yang_model_tests/tests/aaa.json index 5316c83e7681..972b404b88d9 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/aaa.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/aaa.json @@ -6,8 +6,19 @@ "desc": "Configure a wrong type in AAA table.", "eStrKey": "InvalidValue" }, + "AAA_TEST_WRONG_LOGIN": { + "desc": "Configure a wrong type in AAA table.", + "eStr": ["Invalid login choice"] + }, "AAA_TEST_WRONG_FAILTHROUGH": { "desc": "Configure a wrong failthrough in AAA table.", - "eStrKey": "InvalidValue" + "eStrKey": "Pattern", + "eStr": ["false|true|False|True"] + }, + "AAA_AUTHORIZATION_TEST": { + "desc": "Configure an authorization type in AAA table." + }, + "AAA_ACCOUNTING_TEST": { + "desc": "Configure an accounting type in AAA table." } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/acl.json b/src/sonic-yang-models/tests/yang_model_tests/tests/acl.json index 28f2e0b44400..b7968e240767 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/acl.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/acl.json @@ -4,6 +4,16 @@ "eStrKey" : "InvalidValue", "eStr": ["PACKET_ACTION"] }, + "ACL_RULE_FOR_CTRLPLANE_ACL_REQUIRES_PACKET_ACTION": { + "desc": "ACL_RULE for CTRLPLANE ACLs require PACKET_ACTION.", + "eStrKey" : "Must", + "eStr": ["CTRLPLANE", "PACKET_ACTION"] + }, + "ACL_RULE_MANDATORY_PRIORITY": { + "desc": "ACL_RULE MANDATORY PRIORITY field.", + "eStrKey" : "Mandatory", + "eStr": ["ACL_RULE", "PRIORITY"] + }, "ACL_TABLE_EMPTY_PORTS": { "desc": "Configure ACL_TABLE with empty ports." }, @@ -44,6 +54,11 @@ "eStrKey" : "Mandatory", "eStr": ["ACL_TABLE"] }, + "ACL_TABLE_CTRLPLANE_REQUIRES_SERVICES": { + "desc": "ACL_TABLE CTRLPLANE type requires services presence.", + "eStrKey" : "Must", + "eStr": ["CTRLPLANE", "services"] + }, "ACL_TABLE_DEFAULT_VALUE_STAGE": { "desc": "ACL_TABLE DEFAULT VALUE FOR STAGE FIELD.", "eStrKey" : "Verify", @@ -61,5 +76,58 @@ "key": "sonic-acl:services", "value": ["SNMP"] } + }, + "ACL_TABLE_CUSTOM_TABLE_TYPE": { + "desc": "ACL_TABLE LOAD TABLE TYPE SUCCESSFULLY." + }, + "ACL_TABLE_CUSTOM_TABLE_TYPE_NO_MATCHES": { + "desc": "ACL_TABLE LOAD TABLE TYPE WITH NO MATCHES.", + "eStrKey": "MinElements" + }, + "ACL_TABLE_CUSTOM_TABLE_TYPE_NO_BIND_POINT_TYPES": { + "desc": "ACL_TABLE LOAD TABLE TYPE WITH NO BIND POINT TYPES.", + "eStrKey": "MinElements" + }, + "ACL_TABLE_CUSTOM_TABLE_TYPE_NO_ACTIONS": { + "desc": "ACL_TABLE LOAD TABLE TYPE SUCCESSFULLY WITH NO ACTIONS.", + "eStrKey" : "Verify", + "verify": { + "xpath": "/sonic-acl:sonic-acl/ACL_TABLE_TYPE/ACL_TABLE_TYPE_LIST[ACL_TABLE_TYPE_NAME='CUSTOM_L3']/ACL_TABLE_TYPE_NAME", + "key": "sonic-acl:actions", + "value": [""] + } + }, + "ACL_TABLE_L2_ACL_FIELDS": { + "desc": "Configure L2 ACL with proper rule fields" + }, + "ACL_TABLE_L3_RULE_WITH_L2_FIELDS": { + "desc": "Configure L2 Address in L3 ACL.", + "eStrKey" : "When", + "eStr": ["type"] + }, + "ACL_RULE_L2_INVALID_MAC": { + "desc": "Configure invalid MAC address format.", + "eStrKey" : "Pattern" + }, + "ACL_RULE_L2_INVALID_ETHER": { + "desc": "Configure invalid ethertype.", + "eStrKey" : "Pattern" + }, + "ACL_RULE_L2_VALID_ETHER_IN_DECIMAL": { + "desc": "Configure valid ethertype in decimal format." + }, + "ACL_RULE_L2_INVALID_ETHER_IN_DECIMAL": { + "desc": "Configure invalid ethertype in decimal format.", + "eStrKey" : "Pattern" + }, + "ACL_PACKET_ACTION_VALIDATE_VALUE_ACCEPT": { + "desc": "Configure CTRLPLANE with proper action ACCEPT." + }, + "ACL_RULE_WITH_INVALID_MIRROR_INGRESS_ACTION": { + "desc": "Configure ACL_RULE with invalid mirror action.", + "eStrKey" : "LeafRef" + }, + "ACL_RULE_WITH_VALID_MIRROR_INGRESS_ACTION": { + "desc": "Configure ACL_RULE with valid mirror action." } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/auto_techsupport.json b/src/sonic-yang-models/tests/yang_model_tests/tests/auto_techsupport.json new file mode 100644 index 000000000000..8a65fec2b6d0 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/auto_techsupport.json @@ -0,0 +1,27 @@ +{ + "AUTO_TECHSUPPORT_TEST":{ + "desc": "Configure auto techsupport params in AUTO_TECHSUPPORT Table" + }, + "AUTO_TECHSUPPORT_WRONG_STATE_VALUE": { + "desc": "Configure state key with invalid value", + "eStrKey": "InvalidValue" + }, + "AUTO_TECHSUPPORT_INVALID_RATE_LIMIT_FORMAT": { + "desc" : "Configure cooloff with a value of invalid format", + "eStrKey": "InvalidValue" + }, + "AUTO_TECHSUPPORT_OUT_OF_RANGE_DECIMAL": { + "desc" : "Configure a value for core-uage outside the range [0, 100)", + "eStr": "Value \"100.00\" does not satisfy the constraint \"0..99.99\" (range, length, or pattern)." + }, + "AUTO_TECHSUPPORT_VALID_DECIMAL_VALUE": { + "desc" : "Configure a value for max_techsupport_size inside the range [0, 100)" + }, + "AUTO_TECHSUPPORT_INVALID_FRACTION_DIGITS": { + "desc" : "Configure a value for max_techsupport_size inside the range [0, 100) but with 3 fractional digits", + "eStrKey": "InvalidValue" + }, + "AUTO_TECHSUPPORT_RATE_LIMIT_INTERVAL_TEST": { + "desc" : "Configure and test the valid configuration" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/bgp.json b/src/sonic-yang-models/tests/yang_model_tests/tests/bgp.json index 596a3343e53d..966171888b37 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/bgp.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/bgp.json @@ -24,6 +24,11 @@ "desc": "Referring non-existing BGP neighbor table.", "eStrKey" : "LeafRef" }, + "BGP_NEIGHBOR_NEG_INVALID_ADMIN_STATUS": { + "desc": "Incorrect admin status.", + "eStrKey": "InvalidValue", + "eStr": ["admin_status"] + }, "BGP_NEIGHBOR_NEG_INVALID_NAME": { "desc": "Incorrect neighbor name.", "eStrKey": "InvalidValue", @@ -133,7 +138,65 @@ "BGP_NEIGHBOR_NEG_INVALID_HOPS": { "desc": "Invalid TTL hops for unnumbered interface neigbhor.", "eStrKey" : "Pattern" + }, + "BGP_MONITORS_ALL_VALID": { + "desc": "Configure BGP monitor table." + }, + "BGP_MONITORS_NEG_INVALID_ADMIN_STATUS": { + "desc": "Incorrect admin status.", + "eStrKey": "InvalidValue", + "eStr": ["admin_status"] + }, + "BGP_MONITORS_NEG_INVALID_NAME": { + "desc": "Incorrect monitor name.", + "eStr": ["Invalid BGP monitor name"] + }, + "BGP_MONITORS_NEG_INVALID_ASN": { + "desc": "Invalid local AS number.", + "eStrKey" : "InvalidValue" + }, + "BGP_PEERRANGE_ALL_VALID": { + "desc": "Configure BGP peer range table." + }, + "BGP_ALLOWED_PREFIXES_COM_LIST_ALL_VALID": { + "desc": "Configue BGP allowed prefix list." + }, + "BGP_ALLOWED_PREFIXES_COM_LIST_INVALID_DEPLOYMENT": { + "desc": "Invalid default action.", + "eStrKey" : "Pattern" + }, + "BGP_ALLOWED_PREFIXES_COM_LIST_INVALID_DEFAULT_ACTION": { + "desc": "Invalid default action.", + "eStrKey" : "InvalidValue", + "eStr" : ["default_action"] + }, + "BGP_ALLOWED_PREFIXES_COM_LIST_INVALID_PREFIXES_IPV4": { + "desc": "Invalid IPv4 prefix.", + "eStrKey" : "Pattern" + }, + "BGP_ALLOWED_PREFIXES_COM_LIST_INVALID_PREFIXES_IPV6": { + "desc": "Invalid IPv6 prefix.", + "eStrKey" : "Pattern" + }, + "BGP_ALLOWED_PREFIXES_LIST_ALL_VALID": { + "desc": "Configue BGP allowed prefix list." + }, + "BGP_ALLOWED_PREFIXES_LIST_INVALID_DEPLOYMENT": { + "desc": "Invalid default action.", + "eStrKey" : "Pattern" + }, + "BGP_ALLOWED_PREFIXES_LIST_INVALID_DEFAULT_ACTION": { + "desc": "Invalid default action.", + "eStrKey" : "InvalidValue", + "eStr" : ["default_action"] + }, + "BGP_ALLOWED_PREFIXES_LIST_INVALID_PREFIXES_IPV4": { + "desc": "Invalid IPv4 prefix.", + "eStrKey" : "Pattern" + }, + "BGP_ALLOWED_PREFIXES_LIST_INVALID_PREFIXES_IPV6": { + "desc": "Invalid IPv6 prefix.", + "eStrKey" : "Pattern" } - } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/breakout.json b/src/sonic-yang-models/tests/yang_model_tests/tests/breakout.json index a5d8c1384148..db83d48f6472 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/breakout.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/breakout.json @@ -1,12 +1,5 @@ { - "BREAKOUT_CFG_CORRECT_MODES": { - "desc": "BREAKOUT_CFG correct breakout modes" - }, - "BREAKOUT_CFG_INCORRECT_MODES": { - "desc": "BREAKOUT_CFG wrong breakout modes", - "eStr": ["pattern", "does not satisfy"] - }, "CRM_BRK_CFG_FLEX_TABLE": { - "desc": "CRM BREAKOUT CFG FLEX COUNTER TABLE." + "desc": "CRM BREAKOUT CFG FLEX COUNTER TABLE." } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_pg.json b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_pg.json new file mode 100644 index 000000000000..e6e4e59a8fdf --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_pg.json @@ -0,0 +1,20 @@ +{ + "BUFFER_PG_CORRECT_PROFILE_VALUE": { + "desc": "BUFFER_PG_CORRECT_PROFILE_VALUE no failure" + }, + "BUFFER_PG_WRONG_PROFILE_VALUE": { + "desc": "BUFFER_PG_WRONG_PROFILE_VALUE pattern failure", + "eStr": "wrong" + }, + "BUFFER_PG_WRONG_PG_VALUE": { + "desc": "BUFFER_PG_WRONG_PG_VALUE pattern failure", + "eStr": "Invalid Buffer PG number" + }, + "BUFFER_PG_NULL_PROFILE_VALUE": { + "desc": "BUFFER_PG_NULL_PROFILE_VALUE no failure" + }, + "BUFFER_PG_WRONG_PORT_VALUE": { + "desc": "BUFFER_PG_WRONG_PORT_VALUE pattern failure", + "eStr": "wrong" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_pool.json b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_pool.json new file mode 100644 index 000000000000..907fa9101ab3 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_pool.json @@ -0,0 +1,40 @@ +{ + "BUFFER_POOL_CORRECT_TYPE_INGRESS_VALUE": { + "desc": "BUFFER_POOL_CORRECT_TYPE_INGRESS_VALUE no failure." + }, + "BUFFER_POOL_CORRECT_TYPE_EGRESS_VALUE": { + "desc": "BUFFER_POOL_CORRECT_TYPE_EGRESS_VALUE no failure." + }, + "BUFFER_POOL_WRONG_TYPE_VALUE": { + "desc": "BUFFER_POOL_WRONG_TYPE_VALUE pattern failure.", + "eStr": "wrong" + }, + "BUFFER_POOL_MANDATORY_TYPE_VALUE": { + "desc": "BUFFER_POOL_MANDATORY_TYPE_VALUE no type.", + "eStrKey": "Mandatory" + }, + "BUFFER_POOL_CORRECT_MODE_STATIC_VALUE": { + "desc": "BUFFER_POOL_CORRECT_MODE_STATIC_VALUE no failure." + }, + "BUFFER_POOL_CORRECT_MODE_DYNAMIC_VALUE": { + "desc": "BUFFER_POOL_CORRECT_MODE_DYNAMIC_VALUE no failure." + }, + "BUFFER_POOL_WRONG_MODE_VALUE": { + "desc": "BUFFER_POOL_WRONG_MODE_VALUE pattern failure.", + "eStr": "wrong" + }, + "BUFFER_POOL_CORRECT_XOFF_VALUE": { + "desc": "BUFFER_POOL_CORRECT_XOFF_VALUE no failure." + }, + "BUFFER_POOL_WRONG_XOFF_VALUE": { + "desc": "BUFFER_POOL_WRONG_XOFF_VALUE pattern failure.", + "eStr": "wrong" + }, + "BUFFER_POOL_CORRECT_SIZE_VALUE": { + "desc": "BUFFER_POOL_CORRECT_SIZE_VALUE no failure." + }, + "BUFFER_POOL_WRONG_SIZE_VALUE": { + "desc": "BUFFER_POOL_WRONG_SIZE_VALUE pattern failure.", + "eStr": "wrong" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_port_egress_profile_list.json b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_port_egress_profile_list.json new file mode 100644 index 000000000000..a7b766974a76 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_port_egress_profile_list.json @@ -0,0 +1,13 @@ +{ + "BUFFER_PORT_EGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE": { + "desc": "BUFFER_PORT_EGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE no failure" + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE": { + "desc": "BUFFER_PORT_EGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE pattern failure", + "eStr": "wrong" + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST_WRONG_PORT_VALUE": { + "desc": "BUFFER_PORT_EGRESS_PROFILE_LIST_WRONG_PORT_VALUE pattern failure", + "eStr": "wrong" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_port_ingress_profile_list.json b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_port_ingress_profile_list.json new file mode 100644 index 000000000000..5ed19ce3e478 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_port_ingress_profile_list.json @@ -0,0 +1,13 @@ +{ + "BUFFER_PORT_INGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE": { + "desc": "BUFFER_PORT_INGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE no failure" + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE": { + "desc": "BUFFER_PORT_INGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE pattern failure", + "eStr": "wrong" + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST_WRONG_PORT_VALUE": { + "desc": "BUFFER_PORT_INGRESS_PROFILE_LIST_WRONG_PORT_VALUE pattern failure", + "eStr": "wrong" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_profile.json b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_profile.json new file mode 100644 index 000000000000..c5591c42ed42 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_profile.json @@ -0,0 +1,68 @@ +{ + "BUFFER_PROFILE_CORRECT_STATIC_THRESHOLD_VALUE": { + "desc": "BUFFER_PROFILE_CORRECT_STATIC_THRESHOLD_VALUE no failure." + }, + "BUFFER_PROFILE_WRONG_STATIC_THRESHOLD_VALUE": { + "desc": "BUFFER_PROFILE_WRONG_STATIC_THRESHOLD_VALUE pattern failure.", + "eStr": "-1" + }, + "BUFFER_PROFILE_CORRECT_DYNAMIC_THRESHOLD_MIN_VALUE": { + "desc": "BUFFER_PROFILE_CORRECT_DYNAMIC_THRESHOLD_MIN_VALUE no failure." + }, + "BUFFER_PROFILE_CORRECT_DYNAMIC_THRESHOLD_MAX_VALUE": { + "desc": "BUFFER_PROFILE_CORRECT_DYNAMIC_THRESHOLD_MAX_VALUE no failure." + }, + "BUFFER_PROFILE_WRONG_DYNAMIC_THRESHOLD_VALUE1": { + "desc": "BUFFER_PROFILE_WRONG_DYNAMIC_THRESHOLD_VALUE1 no failure.", + "eStrKey": "Range" + }, + "BUFFER_PROFILE_WRONG_DYNAMIC_THRESHOLD_VALUE2": { + "desc": "BUFFER_PROFILE_WRONG_DYNAMIC_THRESHOLD_VALUE2 no failure.", + "eStrKey": "Range" + }, + "BUFFER_PROFILE_CORRECT_SIZE_VALUE": { + "desc": "BUFFER_PROFILE_CORRECT_SIZE_VALUE no failure." + }, + "BUFFER_PROFILE_WRONG_SIZE_VALUE": { + "desc": "BUFFER_PROFILE_WRONG_SIZE_VALUE pattern failure.", + "eStr": "-1" + }, + "BUFFER_PROFILE_MANDATORY_SIZE_VALUE": { + "desc": "BUFFER_PROFILE_MANDATORY_SIZE_VALUE pattern failure.", + "eStrKey": "Mandatory" + }, + "BUFFER_PROFILE_CORRECT_POOL_VALUE": { + "desc": "BUFFER_PROFILE_CORRECT_POOL_VALUE no failure." + }, + "BUFFER_PROFILE_WRONG_POOL_VALUE": { + "desc": "BUFFER_PROFILE_WRONG_POOL_VALUE pattern failure.", + "eStr": "wrong" + }, + "BUFFER_PROFILE_MANDATORY_POOL_VALUE": { + "desc": "BUFFER_PROFILE_MANDATORY_POOL_VALUE pattern failure.", + "eStrKey": "Mandatory" + }, + "BUFFER_PROFILE_CORRECT_XON_OFFSET_VALUE": { + "desc": "BUFFER_PROFILE_CORRECT_XON_OFFSET_VALUE no failure." + }, + "BUFFER_PROFILE_CORRECT_XON_VALUE": { + "desc": "BUFFER_PROFILE_CORRECT_XON_VALUE no failure." + }, + "BUFFER_PROFILE_CORRECT_XOFF_VALUE": { + "desc": "BUFFER_PROFILE_CORRECT_XOFF_VALUE no failure." + }, + "BUFFER_PROFILE_CORRECT_HEADROOM_TYPE_STATIC": { + "desc": "BUFFER_PROFILE_CORRECT_HEADROOM_TYPE_STATIC no failure." + }, + "BUFFER_PROFILE_CORRECT_HEADROOM_TYPE_DYNAMIC": { + "desc": "BUFFER_PROFILE_CORRECT_HEADROOM_TYPE_DYNAMIC no failure." + }, + "BUFFER_PROFILE_WRONG_HEADROOM_TYPE": { + "desc": "BUFFER_PROFILE_WRONG_HEADROOM_TYPE no failure.", + "eStr": "Invalid" + }, + "BUFFER_PROFILE_WRONG_XOFF_VALUE": { + "desc": "BUFFER_PROFILE_WRONG_XOFF_VALUE no failure.", + "eStr": "-1" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_queue.json b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_queue.json new file mode 100644 index 000000000000..d6e05eeafb4b --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/buffer_queue.json @@ -0,0 +1,17 @@ +{ + "BUFFER_QUEUE_CORRECT_PROFILE_VALUE": { + "desc": "BUFFER_QUEUE_CORRECT_PROFILE_VALUE no failure" + }, + "BUFFER_QUEUE_WRONG_PROFILE_VALUE": { + "desc": "BUFFER_QUEUE_WRONG_PROFILE_VALUE pattern failure", + "eStr": "wrong" + }, + "BUFFER_QUEUE_WRONG_QUEUE_VALUE": { + "desc": "BUFFER_QUEUE_WRONG_QUEUE_VALUE pattern failure", + "eStr": "Invalid Q-index" + }, + "BUFFER_QUEUE_WRONG_PORT_VALUE": { + "desc": "BUFFER_QUEUE_WRONG_PORT_VALUE pattern failure", + "eStr": "wrong" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/cable_length.json b/src/sonic-yang-models/tests/yang_model_tests/tests/cable_length.json new file mode 100644 index 000000000000..231867d4cff4 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/cable_length.json @@ -0,0 +1,16 @@ +{ + "CABLE_LENGTH_TEST": { + "desc": "Configure CABLE_LENGTH table." + }, + "CABLE_LENGTH_NAME_TEST": { + "desc": "Configure CABLE_LENGTH table with different name other than AZURE." + }, + "CABLE_LENGTH_NON_EXISTING_PORT_TEST": { + "desc": "Configure CABLE_LENGTH table with non-existing port.", + "eStrKey": "LeafRef" + }, + "CABLE_LENGTH_INVALID_LENGTH_FORMAT_TEST": { + "desc": "Configure CABLE_LENGTH table with invalid length string.", + "eStr": "Invalid cable length" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/cbfmaps.json b/src/sonic-yang-models/tests/yang_model_tests/tests/cbfmaps.json new file mode 100644 index 000000000000..0c76844dcf44 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/cbfmaps.json @@ -0,0 +1,24 @@ +{ + "DSCP_TO_FC_MAP_CREATE": { + "desc": "Configure a DSCP to Forwarding class map." + }, + "DSCP_TO_FC_MAP_CREATE_INVALID_DSCP": { + "desc": "Configure a DSCP to Forwarding class map with invalid key.", + "eStr": "Invalid DSCP" + }, + "DSCP_TO_FC_MAP_CREATE_INVALID_FC": { + "desc": "Configure a DSCP to Forwarding class map with invalid value.", + "eStr": "Invalid Forwarding Class" + }, + "EXP_TO_FC_MAP_CREATE": { + "desc": "Configure a EXP to Forwarding class map." + }, + "EXP_TO_FC_MAP_CREATE_INVALID_EXP": { + "desc": "Configure a EXP to Forwarding class map with invalid key.", + "eStr": "Invalid EXP" + }, + "EXP_TO_FC_MAP_CREATE_INVALID_FC": { + "desc": "Configure a EXP to Forwarding class map with invalid value.", + "eStr": "Invalid Forwarding Class" + } +} \ No newline at end of file diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json index 8147f8a3ea24..1c39661d056e 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json @@ -1,37 +1,55 @@ { "DEV_META_DEV_NEIGH_VERSION_TABLE": { - "desc": "DEVICE_METADATA DEVICE_NEIGHBOR VERSION TABLE." + "desc": "DEVICE_METADATA DEVICE_NEIGHBOR VERSION TABLE." }, "DEVICE_METADATA_DEFAULT_BGP_STATUS": { - "desc": "DEVICE_METADATA DEFAULT VALUE FOR BGP_STATUS FIELD.", - "eStrKey" : "Verify", - "verify": { - "xpath": "/sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname", - "key": "sonic-device_metadata:default_bgp_status", - "value": "up" - } + "desc": "DEVICE_METADATA DEFAULT VALUE FOR BGP_STATUS FIELD.", + "eStrKey" : "Verify", + "verify": { + "xpath": "/sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname", + "key": "sonic-device_metadata:default_bgp_status", + "value": "up" + } }, "DEVICE_METADATA_DEFAULT_DOCKER_ROUTING_CONFIG_MODE": { - "desc": "DEVICE_METADATA DEFAULT VALUE FOR DOCKER_ROUTING_CONFIG_MODE FIELD.", - "eStrKey" : "Verify", - "verify": { - "xpath": "/sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname", - "key": "sonic-device_metadata:docker_routing_config_mode", - "value": "unified" - } + "desc": "DEVICE_METADATA DEFAULT VALUE FOR DOCKER_ROUTING_CONFIG_MODE FIELD.", + "eStrKey" : "Verify", + "verify": { + "xpath": "/sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname", + "key": "sonic-device_metadata:docker_routing_config_mode", + "value": "unified" + } }, "DEVICE_METADATA_DEFAULT_PFCWD_STATUS": { - "desc": "DEVICE_METADATA DEFAULT VALUE FOR PFCWD FIELD.", - "eStrKey" : "Verify", - "verify": { - "xpath": "/sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname", - "key": "sonic-device_metadata:default_pfcwd_status", - "value": "disable" - } + "desc": "DEVICE_METADATA DEFAULT VALUE FOR PFCWD FIELD.", + "eStrKey" : "Verify", + "verify": { + "xpath": "/sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname", + "key": "sonic-device_metadata:default_pfcwd_status", + "value": "disable" + } }, "DEVICE_METADATA_TYPE_INCORRECT_PATTERN": { - "desc": "DEVICE_METADATA_TYPE_INCORRECT_PATTERN pattern failure.", - "eStrKey" : "Pattern" + "desc": "DEVICE_METADATA_TYPE_INCORRECT_PATTERN pattern failure.", + "eStrKey" : "Pattern" + }, + "DEVICE_METADATA_TYPE_CORRECT_PATTERN": { + "desc": "DEVICE_METADATA correct value for Type field" + }, + "DEVICE_METADATA_TYPE_BMC_MGMT_TOR_PATTERN": { + "desc": "DEVICE_METADATA value as BmcMgmtToRRouter for Type field" + }, + "DEVICE_METADATA_TYPE_NOT_PROVISIONED_PATTERN": { + "desc": "DEVICE_METADATA value as not-provisioned for Type field" + }, + "DEVICE_METADATA_DEFAULT_SYNCHRONOUS_MODE": { + "desc": "DEVICE_METADATA DEFAULT VALUE FOR SYNCHRONOUS MODE.", + "eStrKey" : "Verify", + "verify": { + "xpath": "/sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname", + "key": "sonic-device_metadata:synchronous_mode", + "value": "enable" + } }, "DEVICE_METADATA_CORRECT_BUFFER_MODEL_PATTERN": { "desc": "DEVICE_METADATA correct value for BUFFER_MODEL field" @@ -45,6 +63,56 @@ }, "DEVICE_METADATA_FRR_MGMT_FWK_CONFIG": { "desc": "Verifying FRR MGMT framework configuration." + }, + "DEVICE_METADATA_CORRECT_CLOUDTYPE_REGION_CONFIG": { + "desc": "Verifying cloudtype and region configuration." + }, + "DEVICE_METADATA_DOWNSTREAM_SUBROLE_CONFIG": { + "desc": "Verifying downstream subrole configuration." + }, + "DEVICE_METADATA_RESOURCE_TYPE_CONFIG": { + "desc": "Verifying resource type configuration." + }, + "DEVICE_METADATA_VALID_CLUSTER": { + "desc": "Verifying valid cluster configuration." + }, + "DEVICE_METADATA_VALID_SUBTYPE": { + "desc": "Verifying valid subtype value" + }, + "DEVICE_METADATA_INVALID_SUBTYPE": { + "desc": "Verifying invalid subtype value", + "eStrKey": "Pattern" + }, + "DEVICE_METADATA_VALID_PEER_SWITCH": { + "desc": "Verifying valid peer switch hostname" + }, + "DEVICE_METADATA_INVALID_PEER_SWITCH": { + "desc": "Verifying test fails with hostname that is too long", + "eStrKey": "Range" + }, + "DEVICE_METADATA_VALID_STORAGE_DEVICE": { + "desc": "Verifying valid storage device value" + }, + "DEVICE_METADATA_INVALID_STORAGE_DEVICE": { + "desc": "Verifying invalid storage device value", + "eStrKey": "InvalidValue" + }, + "DEVICE_METADATA_INCORRECT_VOQ_CONFIG": { + "desc": "Verifying incorrect switch_type configuration.", + "eStrKey": "Pattern" + }, + "DEVICE_METADATA_CORRECT_VOQ_CONFIG": { + "desc": "Verifying VOQ configuration." + }, + "DEVICE_METADATA_VALID_SUB_ROLE_CONFIG": { + "desc": "Verifying valid sub_role configuration." + }, + "DEVICE_METADATA_VALID_DHCP_SERVER": { + "desc": "Verifying dhcp_server configuration." + }, + "DEVICE_METADATA_INVALID_DHCP_SERVER": { + "desc": "Verifying invalid dhcp_server configuration.", + "eStrKey": "InvalidValue" } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/dhcpv6_relay.json b/src/sonic-yang-models/tests/yang_model_tests/tests/dhcpv6_relay.json new file mode 100644 index 000000000000..318a5eb7682b --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/dhcpv6_relay.json @@ -0,0 +1,9 @@ +{ + "DHCPV6_SERVER_INCORRECT_FORMAT": { + "desc": "Add dhcpv6_server which is not in correct ipv6-address format.", + "eStrKey" : "Pattern" + }, + "DHCPV6_SERVER_VALID_FORMAT": { + "desc": "Add dhcpv6_server in correct format." + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/feature.json b/src/sonic-yang-models/tests/yang_model_tests/tests/feature.json index 372f51a8c12a..52dce58a2cf6 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/feature.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/feature.json @@ -2,9 +2,17 @@ "FEATURE_WITH_CORRECT_VALUES": { "desc": "CONFIG FEATURE TABLE WITH ALL THE CORRECT VALUES" }, - "FEATURE_WITH_INVALID_STATE" : { - "desc": "Referring invalid feature state.", + "FEATURE_WITH_INVALID_BOOLEAN_TYPE" : { + "desc": "Referring invalid feature boolean types.", "eStrKey": "Pattern", - "eStr": ["enabled|disabled|always_enabled"] + "eStr": ["false|true|False|True"] + }, + "FEATURE_WITH_INVALID_OWNER" : { + "desc": "Referring invalid feature set_owner field.", + "eStrKey": "Pattern", + "eStr": ["kube|local"] + }, + "FEATURE_WITH_NO_OWNER" : { + "desc": "Config feature table without set_owner" } -} \ No newline at end of file +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/flex_counter.json b/src/sonic-yang-models/tests/yang_model_tests/tests/flex_counter.json index 1de66777cb41..92d96b54f3a1 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/flex_counter.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/flex_counter.json @@ -1,5 +1,21 @@ { "FLEX_COUNTER_TABLE_WITH_CORRECT_USED_VALUE": { - "desc": "FLEX_COUNTER_TABLE_WITH_CORRECT_USED_VALUE no failure." + "desc": "FLEX_COUNTER_TABLE_WITH_CORRECT_USED_VALUE no failure." + }, + "FLEX_COUNTER_TABLE_WITH_INVALID_POLL_INTERVAL": { + "desc": "Out of range poll interval.", + "eStrKey": "Range", + "eStr": "100..4294967295" + }, + "FLOW_COUNTER_ROUTE_PATTERN_TABLE_WITH_VRF": { + "desc": "FLOW_COUNTER_ROUTE_PATTERN_TABLE_WITH_VRF no failure." + }, + "FLOW_COUNTER_ROUTE_PATTERN_TABLE_WITH_DEFAULT_VRF": { + "desc": "FLOW_COUNTER_ROUTE_PATTERN_TABLE_WITH_DEFAULT_VRF no failure." + }, + "FLOW_COUNTER_ROUTE_PATTERN_TABLE_WITH_INVALID_MAX_MATCH_COUNT": { + "desc": "Out of range max_match_count.", + "eStrKey": "Range", + "eStr": "1..50" } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/loopback.json b/src/sonic-yang-models/tests/yang_model_tests/tests/loopback.json index a4e4f9b6f2ca..9fdbb0a5e352 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/loopback.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/loopback.json @@ -1,7 +1,7 @@ { - "LOOPBACK_IPPREFIX_PORT_MUST_CONDITION_FALSE": { - "desc": "Loopback Ip-prefix port-name must condition failure.", - "eStrKey" : "Must" + "LOOPBACK_IPPREFIX_PORT_FOR_NON_EXIST_INTERFACE": { + "desc": "Configure Loopback Ip-prefix for non-existing Loopback interface.", + "eStrKey" : "LeafRef" }, "LOOPBACK_INTERFACE_WRONG_NAT_ZONE_RANGE": { "desc": "Configure wrong value for nat zone.", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/mclag.json b/src/sonic-yang-models/tests/yang_model_tests/tests/mclag.json new file mode 100644 index 000000000000..b7f3c69e1dab --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/mclag.json @@ -0,0 +1,32 @@ +{ + "MCLAG_VALID_DOMAIN_CFG_TEST": { + "desc": "valid mclag configuration test" + }, + "MCLAG_VALID_DOMAIN_PEERLINK_ETH_TEST": { + "desc": "valid mclag configuration test with peer link ethernet" + }, + "MCLAG_INVALID_DOMAIN_IDS_TEST": { + "desc": "configure mclag domain id in range", + "eStr": "MCLAG Domain ID out of range" + }, + "MCLAG_INVALID_KEEPALIVE_TEST": { + "desc": "configure mclag keepalive values in range", + "eStr" : "MCLAG Domain keepalive interval out of range" + }, + "MCLAG_INVALID_SESSION_TIMEOUT_TEST": { + "desc": "configure mclag session timeout in range", + "eStr" : "MCLAG Domain session timeout out of range" + }, + "MCLAG_INVALID_KEEPALIVE_MUST_COND_TEST": { + "desc": "Invalid session and keepalive multiplier", + "eStr" : "(keepalive interval * 3) <= session_timeout value" + }, + "MCLAG_INTERFACE_DOMAIN_ABSENT_TEST": { + "desc": "mclag interface configured without domain", + "eStrKey" : "LeafRef" + }, + "MCLAG_UNIQUE_IP_DOMAIN_ABSENT_TEST": { + "desc": "mclag unique ip configured without domain", + "eStr" : "mclag not configured" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/mirror_session.json b/src/sonic-yang-models/tests/yang_model_tests/tests/mirror_session.json new file mode 100644 index 000000000000..c54ca3d9595a --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/mirror_session.json @@ -0,0 +1,108 @@ +{ + "MIRROR_ERSPAN_ENTRY_WITH_VALID_HEX_VALUES": { + "desc": "Configuring ERSPAN entry with valid heximal values." + }, + "MIRROR_ERSPAN_ENTRY_WITH_VALID_HEX_VALUES_1": { + "desc": "Configuring ERSPAN entry with valid heximal values." + }, + "MIRROR_ERSPAN_ENTRY_WITH_VALID_DEC_VALUES": { + "desc": "Configuring ERSPAN entry with valid decimal values." + }, + "MIRROR_ERSPAN_ENTRY_WITH_VALID_DEC_VALUES_1": { + "desc": "Configuring ERSPAN entry with valid decimal values." + }, + "MIRROR_ERSPAN_ENTRY_WITH_VALID_DEC_VALUES_2": { + "desc": "Configuring ERSPAN entry with valid decimal values." + }, + "MIRROR_ERSPAN_ENTRY_WRONG_TYPE": { + "desc": "Configuring ERSPAN entry with invalid type", + "eStrKey": "InvalidValue" + }, + "MIRROR_ERSPAN_ENTRY_WRONG_DST_IP": { + "desc": "Configuring ERSPAN entry with invalid dst_ip", + "eStrKey" : "Pattern" + }, + "MIRROR_ERSPAN_ENTRY_WRONG_DST_IP_TYPE": { + "desc": "Configuring ERSPAN entry with invalid dst_ip", + "eStrKey" : "When" + }, + "MIRROR_ERSPAN_ENTRY_WRONG_SRC_IP": { + "desc": "Configuring ERSPAN entry with invalid src_ip", + "eStrKey" : "Pattern" + }, + "MIRROR_ERSPAN_ENTRY_WRONG_SRC_IP_TYPE": { + "desc": "Configuring ERSPAN entry with invalid src_ip", + "eStrKey" : "When" + }, + "MIRROR_ERSPAN_ENTRY_WRONG_GRE_TYPE": { + "desc": "Configuring ERSPAN entry with invalid GRE type", + "eStrKey" : "Pattern" + }, + "MIRROR_ERSPAN_ENTRY_WRONG_GRE_TYPE_1": { + "desc": "Configuring ERSPAN entry with invalid GRE type", + "eStrKey" : "Pattern" + }, + "MIRROR_ERSPAN_ENTRY_WRONG_GRE_TYPE_2": { + "desc": "Configuring ERSPAN entry with invalid GRE type", + "eStrKey" : "Pattern" + }, + "MIRROR_ERSPAN_ENTRY_GRE_WRONG_TYPE": { + "desc": "Configuring ERSPAN entry with invalid GRE type", + "eStrKey" : "When" + }, + "MIRROR_ERSPAN_ENTRY_WRONG_DSCP": { + "desc": "Configuring ERSPAN entry with invalid dscp", + "eStr" : "Invalid dscp value" + }, + "MIRROR_ERSPAN_ENTRY_WRONG_DSCP_TYPE": { + "desc": "Configuring ERSPAN entry with invalid dscp", + "eStrKey" : "When" + }, + "MIRROR_ERSPAN_ENTRY_WRONG_TTL": { + "desc": "Configuring ERSPAN entry with invalid ttl", + "eStr": "Invalid TTL value" + }, + "MIRROR_ERSPAN_ENTRY_WRONG_TTL_TYPE": { + "desc": "Configuring ERSPAN entry with invalid ttl", + "eStrKey" : "When" + }, + "MIRROR_ERSPAN_ENTRY_VALID_SRC_PORT": { + "desc": "Configuring ERSPAN entry with valid source port" + }, + "MIRROR_ERSPAN_ENTRY_VALID_SRC_PORTCHANNEL": { + "desc": "Configuring ERSPAN entry with valid source portchannel" + }, + "MIRROR_ERSPAN_ENTRY_INVALID_SRC_PORT": { + "desc": "Configuring ERSPAN entry with invalid source port", + "eStrKey" : "InvalidValue" + }, + "MIRROR_SPAN_ENTRY_WITH_VALID_VALUES": { + "desc": "Configuring SPAN entry with valid source and destination ports" + }, + "MIRROR_SPAN_ENTRY_INVALID_DST_PORT": { + "desc": "Configuring SPAN entry with invalid destination ports", + "eStrKey" : "InvalidValue" + }, + "MIRROR_SPAN_ENTRY_INVALID_DST_PORT_TYPE": { + "desc": "Configuring SPAN entry with invalid destination ports", + "eStrKey" : "When" + }, + "MIRROR_SPAN_ENTRY_VALID_DST_PORT_CPU": { + "desc": "Configuring SPAN entry with valid destination port CPU" + }, + "MIRROR_SPAN_ENTRY_INVALID_SRC_PORT": { + "desc": "Configuring SPAN entry with invalid destination ports", + "eStrKey" : "InvalidValue" + }, + "MIRROR_SPAN_ENTRY_INVALID_DIRECTION": { + "desc": "Configuring SPAN entry with invalid direction", + "eStrKey": "InvalidValue" + }, + "MIRROR_ERSPAN_ENTRY_WITH_VALID_POLICER": { + "desc": "Configuring SPAN entry with valid policer" + }, + "MIRROR_ERSPAN_ENTRY_WITH_INVALID_POLICER": { + "desc": "Configuring SPAN entry with invalid policer", + "eStrKey": "LeafRef" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/nvgre.json b/src/sonic-yang-models/tests/yang_model_tests/tests/nvgre.json new file mode 100644 index 000000000000..e776b0d9064f --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/nvgre.json @@ -0,0 +1,25 @@ +{ + "NVGRE_TUNNEL_AND_TUNNEL_MAP": { + "desc": "NVGRE_TUNNEL with NVGRE_TUNNEL_MAP" + }, + + "NVGRE_TUNNEL_INVALID_SRC_IP": { + "desc": "INVALID src_ip value for NVGRE_TUNNEL", + "eStrKey": "InvalidValue" + }, + + "NVGRE_TUNNEL_MAP_UNEXISTING_NVGRE_TUNNEL_NAME": { + "desc": "Unexisting NVGRE_TUNNEL", + "eStrKey": "LeafRef" + }, + + "NVGRE_TUNNEL_MAP_INVALID_VLAN_ID": { + "desc": "Invalid VLAN ID", + "eStrKey": "Pattern" + }, + + "NVGRE_TUNNEL_MAP_INVALID_VSID": { + "desc": "INVALID VSID value for NVGRE_TUNNEL_MAP", + "eStrKey": "Pattern" + } +} \ No newline at end of file diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/pfc.json b/src/sonic-yang-models/tests/yang_model_tests/tests/pfc.json index 4405075aeefc..0f8b4d0289c2 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/pfc.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/pfc.json @@ -31,6 +31,10 @@ "desc": "PFC_WDOG_WITH_WRONG_DETECTION_TIME_HIGH_VALUE", "eStr": "range" }, + "PFC_WDOG_WITH_INVALID_DETECTION_TIME": { + "desc": "PFC_WDOG_WITH_INVALID_DETECTION_TIME", + "eStr": ["detection_time must be greater than or equal to POLL_INTERVAL"] + }, "PFC_WDOG_WITH_WRONG_RESTORATION_TIME_LOW_VALUE": { "desc": "PFC_WDOG_WITH_WRONG_RESTORATION_TIME_LOW_VALUE", "eStr": "range" @@ -38,5 +42,9 @@ "PFC_WDOG_WITH_WRONG_RESTORATION_TIME_HIGH_VALUE": { "desc": "PFC_WDOG_WITH_WRONG_RESTORATION_TIME_HIGH_VALUE", "eStr": "range" + }, + "PFC_WDOG_WITH_INVALID_RESTORATION_TIME": { + "desc": "PFC_WDOG_WITH_INVALID_RESTORATION_TIME", + "eStr": ["restoration_time must be greater than or equal to POLL_INTERVAL"] } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/policer.json b/src/sonic-yang-models/tests/yang_model_tests/tests/policer.json new file mode 100644 index 000000000000..80f2534b8cc8 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/policer.json @@ -0,0 +1,61 @@ +{ + "POLICER_TABLE": { + "desc": "Configure policer with all fields." + }, + "POLICER_MANDATORY_MODE": { + "desc": "Configure policer with no mode.", + "eStrKey" : "Mandatory" + }, + "POLICER_MANDATORY_METER_TYPE": { + "desc": "Configure policer with no meter type.", + "eStrKey" : "Mandatory" + }, + "POLICER_UNKNOWN_METER_TYPE": { + "desc": "Configure policer with unknown meter type.", + "eStrKey" : "InvalidValue", + "eStr" : ["meter_type"] + }, + "POLICER_UNKNOWN_MODE": { + "desc": "Configure policer with unknown mode.", + "eStrKey" : "InvalidValue", + "eStr" : ["mode"] + }, + "POLICER_UNKNOWN_ACTION": { + "desc": "Configure policer with unknown action.", + "eStrKey" : "InvalidValue", + "eStr" : ["red_packet_action"] + }, + "POLICER_UNKNOWN_COLOR": { + "desc": "Configure policer with unknown color awareness.", + "eStrKey" : "InvalidValue", + "eStr" : ["color"] + }, + "POLICER_CBS_WITHOUT_CIR": { + "desc": "Configure policer with cbs but without cir.", + "eStr": ["cbs can't be configured without cir."] + }, + "POLICER_CBS_LESS_THAN_CIR": { + "desc": "Configure policer with cbs less than cir.", + "eStr": ["cbs must be greater than or equal to cir"] + }, + "POLICER_PIR_LESS_THAN_CIR": { + "desc": "Configure policer with pir less than cir.", + "eStr": ["pir must be greater than or equal to cir"] + }, + "POLICER_PBS_WITH_STORM": { + "desc": "Configure policer with pbs configured in storm mode.", + "eStrKey" : "When" + }, + "POLICER_PBS_LESS_THAN_CBS": { + "desc": "Configure policer with pbs less than cbs.", + "eStr": ["pbs must be greater than or equal to cbs"] + }, + "POLICER_PIR_WITHOUT_CIR": { + "desc": "Configure policer with pir but without cir.", + "eStr": ["pir can't be configured without cir."] + }, + "POLICER_WHEN_SRTCM_WITH_PIR": { + "desc": "Configure policer with pir configured in sr_tcm mode.", + "eStrKey" : "When" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/port.json b/src/sonic-yang-models/tests/yang_model_tests/tests/port.json index 174dcc4de716..b3aa253c2e72 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/port.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/port.json @@ -66,5 +66,20 @@ "desc": "PORT_INVALID_TPID_TEST invalid tpid value failure.", "eStrKey" : "Pattern", "eStr": ["0x8100|0x9100|0x9200|0x88a8|0x88A8"] + }, + "PORT_VALID_MUX_CABLE_TEST": { + "desc": "PORT_VALID_MUX_CABLE_TEST no failure." + }, + "PORT_INVALID_MUX_CABLE_TEST": { + "desc": "PORT_INVALID_MUX_CABLE_TEST non-boolean values, expect fail", + "eStrKey": "InvalidValue" + }, + "PORT_VALID_MULTIASIC_TEST": { + "desc": "PORT_VALID_MULTIASIC_TEST no failure." + }, + "PORT_INVALID_MULTIASIC_TEST": { + "desc": "PORT_INVALID_MULTIASIC_TEST invalid role pattern, expect fail", + "eStrKey": "Pattern" } + } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/qos.json b/src/sonic-yang-models/tests/yang_model_tests/tests/qos.json new file mode 100644 index 000000000000..189cec177a2d --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/qos.json @@ -0,0 +1,89 @@ +{ + "SCHEDULER_VALID": { + "desc": "Configure SCHEDULER table." + }, + + "SCHEDULER_UNDEFINED_TYPE": { + "desc": "Configure undefined type in SCHEDULER table.", + "eStrKey" : "InvalidValue", + "eStr": ["type"] + }, + + "SCHEDULER_INVALID_WEIGHT": { + "desc": "Configure outof range weight in SCHEDULER table.", + "eStrKey" : "Pattern" + }, + + "SCHEDULER_INVALID_METER_TYPE": { + "desc": "Configure unsuported meter type in SCHEDULER table.", + "eStrKey": "InvalidValue", + "eStr": ["meter_type"] + }, + + "SCHEDULER_CBS_NO_CIR": { + "desc": "Configure CBS without CIR.", + "eStr": ["cbs can't be configured without cir"] + }, + + "SCHEDULER_PIR_NO_CIR": { + "desc": "Configure PIR without CIR.", + "eStr": ["pir can't be configured without cir"] + }, + + "SCHEDULER_PIR_VS_CIR": { + "desc": "Configure PIR vs CIR.", + "eStr": ["pir must be greater than or equal to cir"] + }, + + "SCHEDULER_VALID_NAME": { + "desc": "Configure SCHEDULER table." + }, + + "WRED_PROFILE_EMPTY": { + "desc": "Configure Empty WRED profile." + }, + + "WRED_PROFILE_VALID": { + "desc": "Configure WRED profile." + }, + + "WRED_PROFILE_INVALID_DROP_PROBABILITY": { + "desc": "Configure invalid drop probability in WRED profile.", + "eStrKey" : "Pattern" + }, + + "WRED_PROFILE_INVALID_GREEN_THRESHOLD": { + "desc": "Configure green maximum threshold less than min threshold in WRED profile.", + "eStr": ["Green max threshold must be greater than or equal to min threshold"] + }, + + "WRED_PROFILE_INVALID_YELLOW_THRESHOLD": { + "desc": "Configure yellow maximum threshold less than min threshold in WRED profile.", + "eStr": ["Yellow max threshold must be greater than or equal to min threshold"] + }, + + "WRED_PROFILE_INVALID_RED_THRESHOLD": { + "desc": "Configure red maximum threshold less than min threshold in WRED profile.", + "eStr": ["Red max threshold must be greater than or equal to min threshold"] + }, + + + "QUEUE_VALID": { + "desc": "Attach scheduler and wred profiles to QUEUE." + }, + + "QUEUE_PORT_NOT_EXIST": { + "desc": "Referring non-existing PORT table.", + "eStrKey": "InvalidValue" + }, + + "QUEUE_SCHEDULER_NOT_EXIST": { + "desc": "Referring non-existing SCHEDULER table.", + "eStrKey" : "LeafRef" + }, + + "QUEUE_WRED_NOT_EXIST": { + "desc": "Referring non-existing WRED table.", + "eStrKey" : "LeafRef" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/qosmaps.json b/src/sonic-yang-models/tests/yang_model_tests/tests/qosmaps.json new file mode 100644 index 000000000000..90344d8f119d --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/qosmaps.json @@ -0,0 +1,104 @@ +{ + "DSCP_TO_TC_MAP_CRETAE": { + "desc": "Configure a DSCP to Traffic class map." + }, + + "DSCP_TO_TC_MAP_CREATE_INVALID_DSCP": { + "desc": "Configure a DSCP to Traffic class map with invalid key.", + "eStr": "Invalid DSCP" + }, + + "DSCP_TO_TC_MAP_CREATE_INVALID_TC": { + "desc": "Configure a DSCP to Traffic class map with invalid value.", + "eStr": "Invalid Traffic Class" + }, + + "DOT1P_TO_TC_MAP_CRETAE": { + "desc": "Configure a DOT1P to Traffic class map." + }, + + "DOT1P_TO_TC_MAP_CREATE_INVALID_DOT1P": { + "desc": "Configure a DOT1P to Traffic class map with invalid key.", + "eStr": "Invalid DOT1P" + }, + + "DOT1P_TO_TC_MAP_CREATE_INVALID_TC": { + "desc": "Configure a DOT1P to Traffic class map with invalid value.", + "eStr": "Invalid Traffic Class" + }, + + "TC_TO_QUEUE_MAP_CRETAE": { + "desc": "Configure a Traffic Class to Queue map." + }, + + "TC_TO_QUEUE_MAP_CREATE_INVALID_TC": { + "desc": "Configure a Traffic class to Queue map with invalid key.", + "eStr": "Invalid Traffic Class" + }, + + "TC_TO_QUEUE_MAP_CREATE_INVALID_QUEUE": { + "desc": "Configure a Traffic class to Queue map with invalid value.", + "eStr": "Invalid queue index" + }, + + "TC_TO_PRIORITY_GROUP_MAP_CRETAE": { + "desc": "Configure a Traffic Class to Priority Group map." + }, + + "TC_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_TC": { + "desc": "Configure a Traffic class to Priority Group map with invalid key.", + "eStr": "Invalid Traffic Class" + }, + + "TC_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_PRIORITY_GROUP": { + "desc": "Configure a Traffic class to Priority Group map with invalid value.", + "eStr": "Invalid Priority Group" + }, + + "PFC_PRIORITY_TO_QUEUE_MAP_CRETAE": { + "desc": "Configure a PFC priority to Queue map." + }, + + "PFC_PRIORITY_TO_QUEUE_MAP_CREATE_INVALID_PFC_PRIORITY": { + "desc": "Configure a PFC priority to Queue map with invalid key.", + "eStr": "Invalid pfc priority" + }, + + "PFC_PRIORITY_TO_QUEUE_MAP_CREATE_INVALID_QUEUE": { + "desc": "Configure a PFC priority to Queue map with invalid value.", + "eStr": "Invalid queue index" + }, + + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_CRETAE": { + "desc": "Configure a PFC priority to Priority Group map." + }, + + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_PFC_PRIORITY": { + "desc": "Configure a PFC priority to Priority Group map with invalid key.", + "eStr": "Invalid pfc priority" + }, + + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_PRIORITY_GROUP": { + "desc": "Configure a PFC priority to Priority Group map with invalid value.", + "eStr": "Invalid Priority Group" + }, + + "PORT_QOS_MAP_APPLY_MAPS": { + "desc": "Configure qos maps on port." + }, + + "PORT_QOS_MAP_APPLY_NON_EXISTS_MAPS": { + "desc": "Configure non exists qos maps on port.", + "eStrKey": "LeafRef" + }, + + "PORT_QOS_MAP_APPLY_NON_EXISTS_PORT": { + "desc": "Configure port qos map entry on non exists port.", + "eStrKey": "LeafRef" + }, + + "PORT_QOS_MAP_APPLY_INVALID_PFC": { + "desc": "Configure port pfc enable with invalid pfc priority.", + "eStrKey": "Pattern" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/storm_control.json b/src/sonic-yang-models/tests/yang_model_tests/tests/storm_control.json new file mode 100644 index 000000000000..16542eb1183b --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/storm_control.json @@ -0,0 +1,26 @@ +{ + "STORM_BROADCAST_TEST": { + "desc": "Broadcast storm-control" + }, + "STORM_UUCAST_TEST": { + "desc": "unknown-unicast storm-control" + }, + "STORM_UMCAST_TEST": { + "desc": "unknown-multicast storm-control" + }, + "STORM_INVALID_STORM_TYPE_TEST": { + "desc": "storm-control invalid storm-type", + "eStrKey" : "InvalidValue", + "eStr": ["storm_type"] + }, + "STORM_BROADCAST_INVALID_KBPS": { + "desc": "Broadcast storm-control invalid kbps", + "eStrKey" : "InvalidValue", + "eStr": ["kbps"] + }, + "STORM_BROADCAST_INVALID_INTERFACE": { + "desc": "Broadcast storm-control invalid interface", + "eStrKey" : "LeafRef", + "eStr": ["Eth"] + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/syslog.json b/src/sonic-yang-models/tests/yang_model_tests/tests/syslog.json new file mode 100644 index 000000000000..ee45cf4d28a0 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/syslog.json @@ -0,0 +1,18 @@ +{ + "SYSLOG_SERVER_TEST": { + "desc": "Load syslog server table with ipv4 address as syslog servers." + }, + "SYSLOG_SERVER_1_NEG_TEST": { + "desc": "Load syslog server table with empty address as syslog server.", + "eStrKey": "InvalidValue" + }, + "SYSLOG_SERVER_INVALID_IPADDR_TEST": { + "desc": "Load syslog server table with invalid ipv4 address as syslog server.", + "eStrKey": "InvalidValue" + }, + "SYSLOG_SERVER_INVALID_IPV6_ADDR_TEST": { + "desc": "Load syslog server table with invalid ipv6 address as syslog server.", + "eStrKey": "InvalidValue" + } + +} \ No newline at end of file diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/tacacs.json b/src/sonic-yang-models/tests/yang_model_tests/tests/tacacs.json index 5236aab596fe..6888a4e3f326 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/tacacs.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/tacacs.json @@ -4,7 +4,7 @@ }, "TACPLUS_INVALID_TIMEOUT_TEST": { "desc": "Tacplus global configuration with invalid timeout value in TACPLUS table.", - "eStr": "TACACS timeout must be 1..60" + "eStr": "TACACS timeout must be 1..60" }, "TACPLUS_NOT_PRESENT_SRC_INTF_TEST": { "desc": "Tacplus global configuration with a non existent port in TACPLUS table.", @@ -15,7 +15,7 @@ }, "TACPLUS_SERVER_INVALID_PRIORITY_TEST": { "desc": "Tacplus server configuration with invalid priority value in TACPLUS_SERVER table.", - "eStr": "TACACS server priority must be 1..64" + "eStr": "TACACS server priority must be 1..64" }, "TACPLUS_SERVER_INVALID_TIMEOUT_TEST" : { "desc": "Tacplus server configuration with invalid timeout value in TACPLUS_SERVER table.", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/vlan.json b/src/sonic-yang-models/tests/yang_model_tests/tests/vlan.json index 2d38ef453c32..a872784ff236 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/vlan.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/vlan.json @@ -1,25 +1,32 @@ { + "VALID_VLAN": { + "desc": "Configure VLAN table." + }, "VLAN_INTERFACE_IPPREFIX_MUST_CONDITION_FALSE": { - "desc": "Vlan Interface Ip-prefix must condition failure.", - "eStrKey" : "Must" + "desc": "Vlan Interface Ip-prefix must condition failure.", + "eStrKey" : "Must" }, "INCORRECT_VLAN_NAME": { - "desc": "INCORRECT VLAN_NAME FIELD IN VLAN TABLE.", - "eStrKey" : "Pattern", - "eStr": ["Vlan"] + "desc": "INCORRECT VLAN_NAME FIELD IN VLAN TABLE.", + "eStrKey" : "Pattern", + "eStr": ["Vlan"] }, "WRONG_FAMILY_WITH_IP_PREFIX": { - "desc": "Configure Wrong family with ip-prefix for VLAN_Interface Table", - "eStrKey" : "Must" + "desc": "Configure Wrong family with ip-prefix for VLAN_Interface Table", + "eStrKey" : "Must" }, "DHCP_SERVER_INCORRECT_FORMAT": { - "desc": "Add dhcp_server which is not in correct ip-prefix format.", - "eStrKey" : "InvalidValue", - "eStr": ["dhcp_servers"] + "desc": "Add dhcp_server which is not in correct ip-prefix format.", + "eStrKey" : "InvalidValue", + "eStr": ["dhcp_servers"] + }, + "DHCPV6_SERVER_INCORRECT_FORMAT": { + "desc": "Add dhcpv6_server which is not in correct ipv6-address format.", + "eStrKey" : "Pattern" }, "VLAN_WITH_NON_EXIST_PORT": { - "desc": "Configure a member port in VLAN_MEMBER table which does not exist.", - "eStrKey" : "InvalidValue" + "desc": "Configure a member port in VLAN_MEMBER table which does not exist.", + "eStrKey" : "InvalidValue" }, "VLAN_WITH_PORTCHANNEL_MEMBER": { "desc": "Configure a PortChannel as a member of Vlan." @@ -29,13 +36,13 @@ "eStrKey" : "InvalidValue" }, "VLAN_MEMEBER_WITH_NON_EXIST_VLAN": { - "desc": "Configure vlan-id in VLAN_MEMBER table which does not exist in VLAN table.", - "eStrKey" : "LeafRef" + "desc": "Configure vlan-id in VLAN_MEMBER table which does not exist in VLAN table.", + "eStrKey" : "LeafRef" }, "TAGGING_MODE_WRONG_VALUE": { - "desc": "Configure wrong value for tagging_mode.", - "eStrKey" : "InvalidValue", - "eStr": ["tagging_mode"] + "desc": "Configure wrong value for tagging_mode.", + "eStrKey" : "InvalidValue", + "eStr": ["tagging_mode"] }, "VLAN_INTERFACE_WRONG_NAT_ZONE_RANGE": { "desc": "Configure wrong value for nat zone.", @@ -43,5 +50,29 @@ }, "VLAN_INTERFACE_VALID_NAT_ZONE_RANGE": { "desc": "Configure valid value for nat zone." + }, + "DHCP_SERVER_VALID_FORMAT": { + "desc": "Add dhcp_server in correct format." + }, + "DHCPV6_SERVER_VALID_FORMAT": { + "desc": "Add dhcpv6_server in correct format." + }, + "INVALID_VLAN_MAC": { + "desc": "VLAN with invalid MAC address", + "eStrKey": "Pattern" + }, + "VLAN_INTERFACE_VALID_GRAT_ARP": { + "desc": "VLAN_INTERFACE with valid grat_arp value" + }, + "VLAN_INTERFACE_VALID_PROXY_ARP": { + "desc": "VLAN_INTERFACE with valid proxy_arp value" + }, + "VLAN_INTERFACE_INVALID_GRAT_ARP": { + "desc": "VLAN_INTERFACE with invalid grat_arp value", + "eStrKey": "Pattern" + }, + "VLAN_INTERFACE_INVALID_PROXY_ARP": { + "desc": "VLAN_INTERFACE with invalid proxy_arp value", + "eStrKey": "Pattern" } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/vlan_sub_interface.json b/src/sonic-yang-models/tests/yang_model_tests/tests/vlan_sub_interface.json new file mode 100644 index 000000000000..e3ffa9dc44b6 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/vlan_sub_interface.json @@ -0,0 +1,47 @@ +{ + "VLAN_SUB_INTERFACE_MUST_CONDITION_TRUE_TEST": { + "desc": "Configure valid vlan sub interface must condition true." + }, + "VLAN_SUB_INTERFACE_SHORT_NAME_FORMAT_MUST_CONDITION_TRUE_TEST": { + "desc": "Configure valid short name format vlan sub interface must condition true." + }, + "VLAN_SUB_INTERFACE_MUST_CONDITION_FALSE_TEST": { + "desc": "Configure vlan sub interface must condition false.", + "eStrKey": "Must" + }, + "VLAN_SUB_INTERFACE_SHORT_NAME_FORMAT_MUST_CONDITION_FALSE_TEST": { + "desc": "Configure short name format vlan sub interface must condition false.", + "eStrKey": "Must" + }, + "VLAN_SUB_INTERFACE_PO_SHORT_NAME_FORMAT_MUST_CONDITION_TRUE_TEST": { + "desc": "Configure valid portchannel short name format vlan sub interface must condition true." + }, + "VLAN_SUB_INTERFACE_PO_MUST_CONDITION_FALSE_TEST": { + "desc": "Configure portchannel long name format vlan sub interface must condition false.", + "eStrKey": "Must" + }, + "VLAN_SUB_INTERFACE_PO_SHORT_NAME_FORMAT_MUST_CONDITION_FALSE_TEST": { + "desc": "Configure portchannel short name format vlan sub interface must condition false.", + "eStrKey": "Must" + }, + "VLAN_SUB_INTERFACE_IP_PREFIX_PORT_NON_EXISTING_LEAF_TEST": { + "desc": "Configure ip prefix vlan sub interface with non-existing reference.", + "eStrKey": "LeafRef" + }, + "VLAN_SUB_INTERFACE_INVALID_VLAN_ID_TEST": { + "desc": "Configure vlan sub interface with invalid vlan id.", + "eStrKey": "Pattern" + }, + "VLAN_SUB_INTERFACE_INVALID_VLAN_ID_WITH_LEADING_ZERO_TEST": { + "desc": "Configure vlan sub interface with invalid vlan id with leading zeros.", + "eStrKey": "Pattern" + }, + "VLAN_SUB_INTERFACE_IP_PREFIX_EMPTY_STRING_TEST": { + "desc": "Configure ip prefix vlan sub interface with empty ip prefx.", + "eStrKey": "InvalidValue" + }, + "VLAN_SUB_INTERFACE_INVALID_NAME_TEST": { + "desc": "Configure invalid vlan sub interface name with no separator.", + "eStrKey": "Pattern" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/aaa.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/aaa.json index 1b79b26ac0a1..fbf63f994cce 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/aaa.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/aaa.json @@ -5,8 +5,10 @@ "AAA_LIST": [{ "type": "authentication", "login": "tacacs+,local", - "failthrough": "true", - "debug": "true" + "failthrough": "True", + "fallback": "True", + "trace": "True", + "debug": "True" }] } } @@ -16,7 +18,17 @@ "sonic-system-aaa:sonic-system-aaa": { "sonic-system-aaa:AAA": { "AAA_LIST": [{ - "type": "authorization" + "type": "unknowntype" + }] + } + } + }, + + "AAA_TEST_WRONG_LOGIN": { + "sonic-system-aaa:sonic-system-aaa": { + "sonic-system-aaa:AAA": { + "AAA_LIST": [{ + "login": "locallll" }] } } @@ -31,5 +43,27 @@ }] } } + }, + + "AAA_AUTHORIZATION_TEST": { + "sonic-system-aaa:sonic-system-aaa": { + "sonic-system-aaa:AAA": { + "AAA_LIST": [{ + "type": "authorization", + "login": "tacacs+" + }] + } + } + }, + + "AAA_ACCOUNTING_TEST": { + "sonic-system-aaa:sonic-system-aaa": { + "sonic-system-aaa:AAA": { + "AAA_LIST": [{ + "type": "accounting", + "login": "tacacs+" + }] + } + } } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json index 4a1dd0888358..d98645b8a19c 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json @@ -211,6 +211,63 @@ } } }, + "ACL_RULE_FOR_CTRLPLANE_ACL_REQUIRES_PACKET_ACTION": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "MGMT_ONLY", + "DST_IP": "10.186.72.0/26", + "IP_TYPE": "IPv4ANY", + "PRIORITY": 999980, + "RULE_NAME": "Rule_20", + "SRC_IP": "10.176.0.0/15" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "MGMT_ONLY", + "policy_desc": "Filter IPv4", + "services": [ + "SNMP" + ], + "stage": "EGRESS", + "type": "CTRLPLANE" + } + ] + } + } + }, + "ACL_RULE_MANDATORY_PRIORITY": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "EVERFLOW", + "DST_IP": "10.186.72.0/26", + "IP_TYPE": "IPv4ANY", + "RULE_NAME": "Rule_20", + "SRC_IP": "10.176.0.0/15" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "EVERFLOW", + "policy_desc": "Filter IPv4", + "services": [ + "SNMP" + ], + "stage": "EGRESS", + "type": "MIRROR" + } + ] + } + } + }, "ACL_RULE_WITH_NON_EXIST_ACL_TABLE": { "sonic-acl:sonic-acl": { "sonic-acl:ACL_RULE": { @@ -432,6 +489,20 @@ } } }, + "ACL_TABLE_CTRLPLANE_REQUIRES_SERVICES": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "NO-NSW-PACL-V4", + "policy_desc": "Filter IPv4", + "stage": "ingress", + "type": "CTRLPLANE" + } + ] + } + } + }, "ACL_TABLE_UNDEFINED_TABLE_TYPE": { "sonic-acl:sonic-acl": { "sonic-acl:ACL_TABLE": { @@ -471,5 +542,466 @@ ] } } + }, + "ACL_TABLE_CUSTOM_TABLE_TYPE": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "NO-NSW-PACL-V6", + "policy_desc": "Filter IPv6", + "ports": [ + "Ethernet0" + ], + "stage": "EGRESS", + "type": "CUSTOM_L3" + } + ] + }, + "sonic-acl:ACL_TABLE_TYPE": { + "ACL_TABLE_TYPE_LIST": [ + { + "ACL_TABLE_TYPE_NAME": "CUSTOM_L3", + "matches": [ + "SRC_IP", + "IN_PORTS" + ], + "actions": [ + "PACKET_ACTION" + ], + "bind_points": [ + "PORT" + ] + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "0,1,2,3", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + } + }, + "ACL_TABLE_CUSTOM_TABLE_TYPE_NO_MATCHES": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "NO-NSW-PACL-V6", + "policy_desc": "Filter IPv6", + "ports": [ + "Ethernet0" + ], + "stage": "EGRESS", + "type": "CUSTOM_L3" + } + ] + }, + "sonic-acl:ACL_TABLE_TYPE": { + "ACL_TABLE_TYPE_LIST": [ + { + "ACL_TABLE_TYPE_NAME": "CUSTOM_L3", + "actions": [ + "PACKET_ACTION" + ], + "bind_points": [ + "PORT" + ] + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "0,1,2,3", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + } + }, + "ACL_TABLE_CUSTOM_TABLE_TYPE_NO_BIND_POINT_TYPES": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "NO-NSW-PACL-V6", + "policy_desc": "Filter IPv6", + "ports": [ + "Ethernet0" + ], + "stage": "EGRESS", + "type": "CUSTOM_L3" + } + ] + }, + "sonic-acl:ACL_TABLE_TYPE": { + "ACL_TABLE_TYPE_LIST": [ + { + "ACL_TABLE_TYPE_NAME": "CUSTOM_L3", + "matches": [ + "SRC_IP", + "IN_PORTS" + ], + "actions": [ + "PACKET_ACTION" + ] + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "0,1,2,3", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + } + }, + "ACL_TABLE_CUSTOM_TABLE_TYPE_NO_ACTIONS": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "NO-NSW-PACL-V6", + "policy_desc": "Filter IPv6", + "ports": [ + "Ethernet0" + ], + "stage": "EGRESS", + "type": "CUSTOM_L3" + } + ] + }, + "sonic-acl:ACL_TABLE_TYPE": { + "ACL_TABLE_TYPE_LIST": [ + { + "ACL_TABLE_TYPE_NAME": "CUSTOM_L3", + "matches": [ + "SRC_IP", + "IN_PORTS" + ], + "bind_points": [ + "PORT" + ] + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "0,1,2,3", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + } + }, + "ACL_TABLE_L2_ACL_FIELDS": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "L2ACL", + "SRC_MAC": "00:00:AB:CD:EF:00/FF:FF:FF:00:00:00", + "DST_MAC": "00:00:AB:CD:EF:FF/FF:FF:FF:FF:FF:FF", + "ETHER_TYPE": "0x0800", + "PCP": "5/5", + "DEI": "0", + "PACKET_ACTION": "FORWARD", + "PRIORITY": 999980, + "RULE_NAME": "Rule_20" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "L2ACL", + "policy_desc": "L2ACL Test", + "ports": [ "" ], + "stage": "INGRESS", + "type": "L2" + } + ] + } + } + }, + "ACL_TABLE_L3_RULE_WITH_L2_FIELDS": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "L3ACL-MAC-FIELDS", + "SRC_MAC": "00:00:AB:CD:EF:00/FF:FF:FF:00:00:00", + "DST_MAC": "00:00:AB:CD:EF:FF/FF:FF:FF:FF:FF:FF", + "ETHER_TYPE": "0x0800", + "PCP": "5/5", + "DEI": "0", + "PACKET_ACTION": "FORWARD", + "PRIORITY": 999980, + "RULE_NAME": "Rule_20" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "L3ACL-MAC-FIELDS", + "policy_desc": "L2ACL Test", + "ports": [ "" ], + "stage": "INGRESS", + "type": "L3" + } + ] + } + } + }, + "ACL_RULE_L2_INVALID_MAC": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "L2ACL_INVALID_MAC", + "SRC_MAC": "00.00.AB.CD.EF.00/FF.FF.FF.00.00.00", + "DST_MAC": "00.00.AB.CD.EF.FF/FF.FF.FF.FF.FF.FF", + "ETHER_TYPE": "0x0800", + "PCP": "5/5", + "DEI": "0", + "PACKET_ACTION": "FORWARD", + "PRIORITY": 999980, + "RULE_NAME": "Rule_20" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "L2ACL_INVALID_MAC", + "policy_desc": "L2ACL Test", + "ports": [ "" ], + "stage": "INGRESS", + "type": "L2" + } + ] + } + } + }, + "ACL_RULE_L2_INVALID_ETHER": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "L2ACL_INVALID_ETHER", + "SRC_MAC": "00:00:AB:CD:EF:00/FF:FF:FF:00:00:00", + "DST_MAC": "00:00:AB:CD:EF:FF/FF:FF:FF:FF:FF:FF", + "ETHER_TYPE": "64", + "PACKET_ACTION": "FORWARD", + "PRIORITY": 999980, + "RULE_NAME": "Rule_20" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "L2ACL_INVALID_ETHER", + "policy_desc": "L2ACL Test", + "ports": [ "" ], + "stage": "INGRESS", + "type": "L2" + } + ] + } + } + }, + "ACL_RULE_L2_VALID_ETHER_IN_DECIMAL": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "L2ACL_VALID_ETHER_DECIMAL", + "SRC_MAC": "00:00:AB:CD:EF:00/FF:FF:FF:00:00:00", + "DST_MAC": "00:00:AB:CD:EF:FF/FF:FF:FF:FF:FF:FF", + "ETHER_TYPE": "2048", + "PACKET_ACTION": "FORWARD", + "PRIORITY": 999980, + "RULE_NAME": "Rule_20" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "L2ACL_VALID_ETHER_DECIMAL", + "policy_desc": "L2ACL Test", + "ports": [ "" ], + "stage": "INGRESS", + "type": "L2" + } + ] + } + } + }, + "ACL_RULE_L2_INVALID_ETHER_IN_DECIMAL": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "L2ACL_INVALID_ETHER_DECIMAL", + "SRC_MAC": "00:00:AB:CD:EF:00/FF:FF:FF:00:00:00", + "DST_MAC": "00:00:AB:CD:EF:FF/FF:FF:FF:FF:FF:FF", + "ETHER_TYPE": "66789", + "PACKET_ACTION": "FORWARD", + "PRIORITY": 999980, + "RULE_NAME": "Rule_20" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "L2ACL_INVALID_ETHER_DECIMAL", + "policy_desc": "L2ACL Test", + "ports": [ "" ], + "stage": "INGRESS", + "type": "L2" + } + ] + } + } + }, + "ACL_PACKET_ACTION_VALIDATE_VALUE_ACCEPT": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "SNMP_ACL", + "DST_IP": "10.186.72.0/26", + "IP_TYPE": "IPv4ANY", + "PACKET_ACTION": "ACCEPT", + "PRIORITY": 999980, + "RULE_NAME": "Rule_20", + "SRC_IP": "10.176.0.0/15" + } + ] + }, + + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "SNMP_ACL", + "policy_desc": "SNMP_ACL", + "services": [ + "SNMP" + ], + "stage": "ingress", + "type": "CTRLPLANE" + } + ] + } + } + }, + "ACL_RULE_WITH_INVALID_MIRROR_INGRESS_ACTION": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "EVERFLOW_DSCP", + "MIRROR_INGRESS_ACTION": "mirror_session_dscp", + "PRIORITY": 9999, + "RULE_NAME": "Rule_20", + "DSCP": "10" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "EVERFLOW_DSCP", + "policy_desc": "EVERFLOW_DSCP", + "ports": [ + "" + ], + "stage": "ingress", + "type": "MIRROR_DSCP" + } + ] + } + } + }, + "ACL_RULE_WITH_VALID_MIRROR_INGRESS_ACTION": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "EVERFLOW_DSCP", + "MIRROR_INGRESS_ACTION": "mirror_session_dscp", + "PRIORITY": 9999, + "RULE_NAME": "Rule_20", + "DSCP": "10" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "EVERFLOW_DSCP", + "policy_desc": "EVERFLOW_DSCP", + "ports": [ + "" + ], + "stage": "ingress", + "type": "MIRROR_DSCP" + } + ] + } + }, + "sonic-mirror-session:sonic-mirror-session": { + "sonic-mirror-session:MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name":"mirror_session_dscp", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "0x1234", + "dscp": "10" + } + ] + } + } } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/auto_techsupport.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/auto_techsupport.json new file mode 100644 index 000000000000..43ac4ce82391 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/auto_techsupport.json @@ -0,0 +1,85 @@ +{ + "AUTO_TECHSUPPORT_TEST": { + "sonic-auto_techsupport:sonic-auto_techsupport": { + "sonic-auto_techsupport:AUTO_TECHSUPPORT": { + "sonic-auto_techsupport:GLOBAL": { + "state" : "enabled", + "rate_limit_interval" : "180", + "max_techsupport_limit" : "10.0", + "max_core_limit" : "5.0", + "since" : "2 days ago" + } + } + } + }, + "AUTO_TECHSUPPORT_WRONG_STATE_VALUE": { + "sonic-auto_techsupport:sonic-auto_techsupport": { + "sonic-auto_techsupport:AUTO_TECHSUPPORT": { + "sonic-auto_techsupport:GLOBAL": { + "state" : "start", + "rate_limit_interval" : "180", + "max_techsupport_limit" : "10.0", + "max_core_limit" : "5.0", + "since" : "2 days ago" + } + } + } + }, + "AUTO_TECHSUPPORT_INVALID_RATE_LIMIT_FORMAT": { + "sonic-auto_techsupport:sonic-auto_techsupport": { + "sonic-auto_techsupport:AUTO_TECHSUPPORT": { + "sonic-auto_techsupport:GLOBAL": { + "rate_limit_interval" : "whatever" + } + } + } + }, + "AUTO_TECHSUPPORT_OUT_OF_RANGE_DECIMAL": { + "sonic-auto_techsupport:sonic-auto_techsupport": { + "sonic-auto_techsupport:AUTO_TECHSUPPORT": { + "sonic-auto_techsupport:GLOBAL": { + "max_core_limit" : "100.00", + "rate_limit_interval" : "180" + } + } + } + }, + "AUTO_TECHSUPPORT_VALID_DECIMAL_VALUE": { + "sonic-auto_techsupport:sonic-auto_techsupport": { + "sonic-auto_techsupport:AUTO_TECHSUPPORT": { + "sonic-auto_techsupport:GLOBAL": { + "max_techsupport_limit" : "11.23", + "max_core_limit" : "99.99" + } + } + } + }, + "AUTO_TECHSUPPORT_INVALID_FRACTION_DIGITS": { + "sonic-auto_techsupport:sonic-auto_techsupport": { + "sonic-auto_techsupport:AUTO_TECHSUPPORT": { + "sonic-auto_techsupport:GLOBAL": { + "max_techsupport_limit" : "11.111", + "max_core_limit" : "99.99" + } + } + } + }, + "AUTO_TECHSUPPORT_RATE_LIMIT_INTERVAL_TEST": { + "sonic-auto_techsupport:sonic-auto_techsupport": { + "sonic-auto_techsupport:AUTO_TECHSUPPORT_FEATURE": { + "AUTO_TECHSUPPORT_FEATURE_LIST": [ + { + "feature_name" : "bgp", + "state" : "enabled", + "rate_limit_interval" : "600" + }, + { + "feature_name" : "swss", + "state" : "disabled", + "rate_limit_interval" : "400" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/bgp.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/bgp.json index d537c97c9c53..a6a30bd40559 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/bgp.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/bgp.json @@ -133,6 +133,19 @@ }, "sonic-bgp-neighbor:sonic-bgp-neighbor": { "sonic-bgp-neighbor:BGP_NEIGHBOR": { + "BGP_NEIGHBOR_TEMPLATE_LIST": [ + { + "neighbor": "10.0.0.1", + "asn": "65200", + "holdtime": "180", + "keepalive": "60", + "local_addr": "10.0.0.2", + "name":"PEER1", + "nhopself":"0", + "rrclient":"0", + "admin_status":"up" + } + ], "BGP_NEIGHBOR_LIST": [ { "vrf_name": "default", @@ -164,7 +177,7 @@ "peer_port": 0, "shutdown_message": "BGP PeerGroup Shutdown Message", "strict_capability_match": false, - "admin_status": false, + "admin_status": "down", "local_as_no_prepend": false, "local_as_replace_as": false }, @@ -198,7 +211,7 @@ "peer_port": 0, "shutdown_message": "BGP PeerGroup Shutdown Message", "strict_capability_match": false, - "admin_status": false, + "admin_status": "down", "local_as_no_prepend": false, "local_as_replace_as": false } @@ -210,14 +223,14 @@ "vrf_name": "default", "neighbor": "20.0.0.1", "afi_safi": "ipv4_unicast", - "admin_status": true, + "admin_status": "up", "send_default_route": true }, { "vrf_name": "Vrf1", "neighbor": "20.0.0.2", "afi_safi": "ipv6_unicast", - "admin_status": true, + "admin_status": "up", "send_default_route": true } @@ -308,7 +321,7 @@ "peer_port": 0, "shutdown_message": "BGP PeerGroup Shutdown Message", "strict_capability_match": false, - "admin_status": false, + "admin_status": "down", "local_as_no_prepend": false, "local_as_replace_as": false }, @@ -342,7 +355,7 @@ "peer_port": 0, "shutdown_message": "BGP PeerGroup Shutdown Message", "strict_capability_match": false, - "admin_status": false, + "admin_status": "down", "local_as_no_prepend": false, "local_as_replace_as": false } @@ -354,14 +367,14 @@ "vrf_name": "default", "peer_group_name": "PG1", "afi_safi": "ipv4_unicast", - "admin_status": true, + "admin_status": "up", "send_default_route": true }, { "vrf_name": "Vrf1", "peer_group_name": "PG2", "afi_safi": "ipv6_unicast", - "admin_status": true, + "admin_status": "up", "send_default_route": true } @@ -428,12 +441,35 @@ "vrf_name": "default", "neighbor": "20.0.0.1", "afi_safi": "ipv4_unicast", - "admin_status": true, + "admin_status": "up", "send_default_route": true }]} } }, + "BGP_NEIGHBOR_NEG_INVALID_ADMIN_STATUS": { + "sonic-bgp-global:sonic-bgp-global": { + "sonic-bgp-global:BGP_GLOBALS": { + "BGP_GLOBALS_LIST": [ + { + "vrf_name": "default", + "local_asn": 65001 + } + ] + } + }, + "sonic-bgp-neighbor:sonic-bgp-neighbor": { + "sonic-bgp-neighbor:BGP_NEIGHBOR": { + "BGP_NEIGHBOR_TEMPLATE_LIST": [ + { + "neighbor": "11.12.13.14", + "admin_status": "right" + } + ] + } + } + }, + "BGP_NEIGHBOR_NEG_INVALID_NAME": { "sonic-bgp-global:sonic-bgp-global": { "sonic-bgp-global:BGP_GLOBALS": { @@ -630,7 +666,7 @@ "vrf_name": "default", "neighbor": "11.12.14.921", "afi_safi": "ipv4_unicast", - "admin_status": true + "admin_status": "up" } ] } @@ -666,7 +702,7 @@ "vrf_name": "default", "neighbor": "20.0.0.1", "afi_safi": "ipv4_unicast", - "admin_status": true, + "admin_status": "up", "max_prefix_warning_threshold": 102 } ] @@ -703,7 +739,7 @@ "vrf_name": "default", "neighbor": "20.0.0.1", "afi_safi": "ipv4_unicast", - "admin_status": true, + "admin_status": "up", "soft_reconfiguration_in": "not_true" } ] @@ -740,7 +776,7 @@ "vrf_name": "default", "neighbor": "20.0.0.1", "afi_safi": "ipv4_unicast", - "admin_status": true, + "admin_status": "up", "send_community": "foobar" } ] @@ -777,7 +813,7 @@ "vrf_name": "default", "neighbor": "20.0.0.1", "afi_safi": "ipv4_unicast", - "admin_status": true, + "admin_status": "up", "route_map_in": [ "rtmap05" ] @@ -828,7 +864,7 @@ "vrf_name": "default", "neighbor": "20.0.0.1", "afi_safi": "ipv4_unicast", - "admin_status": true, + "admin_status": "up", "route_map_in": [ "rtmap01", "rtmap02" @@ -880,7 +916,7 @@ "vrf_name": "default", "neighbor": "20.0.0.1", "afi_safi": "ipv4_unicast", - "admin_status": true, + "admin_status": "up", "route_map_out": [ "rtmap01", "rtmap02" @@ -923,7 +959,7 @@ "vrf_name": "default", "peer_group_name": "PG1", "afi_safi": "ipv4_unicast", - "admin_status": true, + "admin_status": "up", "send_default_route": true }]} } @@ -1063,7 +1099,7 @@ "vrf_name": "default", "peer_group_name": "PG1", "afi_safi": "ipv4_unicast", - "admin_status": true, + "admin_status": "up", "max_prefix_warning_threshold": 102 } ] @@ -1100,7 +1136,7 @@ "vrf_name": "default", "peer_group_name": "PG1", "afi_safi": "ipv4_unicast", - "admin_status": true, + "admin_status": "up", "soft_reconfiguration_in": "not_true" } ] @@ -1137,7 +1173,7 @@ "vrf_name": "default", "peer_group_name": "PG1", "afi_safi": "ipv4_unicast", - "admin_status": true, + "admin_status": "up", "send_community": "foobar" } ] @@ -1174,7 +1210,7 @@ "vrf_name": "default", "peer_group_name": "PG1", "afi_safi": "ipv4_unicast", - "admin_status": true, + "admin_status": "up", "route_map_in": [ "rtmap05" ] @@ -1225,7 +1261,7 @@ "vrf_name": "default", "peer_group_name": "PG1", "afi_safi": "ipv4_unicast", - "admin_status": true, + "admin_status": "up", "route_map_in": [ "rtmap01", "rtmap02" @@ -1277,7 +1313,7 @@ "vrf_name": "default", "peer_group_name": "PG1", "afi_safi": "ipv4_unicast", - "admin_status": true, + "admin_status": "up", "route_map_out": [ "rtmap01", "rtmap02" @@ -1286,8 +1322,276 @@ ] } } - } + }, + + "BGP_MONITORS_ALL_VALID": { + "sonic-bgp-monitor:sonic-bgp-monitor": { + "sonic-bgp-monitor:BGP_MONITORS": { + "BGP_MONITORS_LIST": [ + { + "addr": "10.0.0.1", + "asn": "65200", + "holdtime": "180", + "keepalive": "60", + "local_addr": "10.0.0.2", + "name":"BGPMonitor", + "nhopself":"0", + "rrclient":"0", + "admin_status":"up" + } + ] + } + } + }, + + "BGP_MONITORS_NEG_INVALID_ADMIN_STATUS": { + "sonic-bgp-monitor:sonic-bgp-monitor": { + "sonic-bgp-monitor:BGP_MONITORS": { + "BGP_MONITORS_LIST": [ + { + "addr": "10.0.0.1", + "asn": "65200", + "holdtime": "180", + "keepalive": "60", + "local_addr": "10.0.0.2", + "name":"BGPMonitor", + "nhopself":"0", + "rrclient":"0", + "admin_status":"left" + } + ] + } + } + }, + + "BGP_MONITORS_NEG_INVALID_NAME": { + "sonic-bgp-monitor:sonic-bgp-monitor": { + "sonic-bgp-monitor:BGP_MONITORS": { + "BGP_MONITORS_LIST": [ + { + "addr": "10.0.0.1", + "asn": "65200", + "holdtime": "180", + "keepalive": "60", + "local_addr": "10.0.0.2", + "name":"BGPMonitor123", + "nhopself":"0", + "rrclient":"0", + "admin_status":"up" + } + ] + } + } + }, + + "BGP_MONITORS_NEG_INVALID_ASN": { + "sonic-bgp-monitor:sonic-bgp-monitor": { + "sonic-bgp-monitor:BGP_MONITORS": { + "BGP_MONITORS_LIST": [ + { + "addr": "10.0.0.1", + "asn": "asda", + "holdtime": "180", + "keepalive": "60", + "local_addr": "10.0.0.2", + "name":"BGPMonitor", + "nhopself":"0", + "rrclient":"0", + "admin_status":"up" + } + ] + } + } + }, + + "BGP_PEERRANGE_ALL_VALID": { + "sonic-bgp-peerrange:sonic-bgp-peerrange": { + "sonic-bgp-peerrange:BGP_PEER_RANGE": { + "BGP_PEER_RANGE_LIST": [ + { + "peer_range_name": "BGPSLBPassive", + "name": "BGPSLBPassive", + "src_address": "10.1.0.32", + "peer_asn": "65200", + "ip_range": [ + "10.255.0.0/25" + ] + } + ] + } + } + }, + "BGP_ALLOWED_PREFIXES_COM_LIST_ALL_VALID": { + "sonic-bgp-allowed-prefix:sonic-bgp-allowed-prefix": { + "sonic-bgp-allowed-prefix:BGP_ALLOWED_PREFIXES": { + "BGP_ALLOWED_PREFIXES_COM_LIST": [ + { + "deployment": "DEPLOYMENT_ID", + "id": "4", + "community": "123:123", + "default_action": "permit", + "prefixes_v4": ["10.0.0.0/24", "10.1.0.0/24"], + "prefixes_v6": ["fc00:f0::/64", "fc00:a0::/64"] + }, + { + "deployment": "DEPLOYMENT_ID", + "id": "5", + "community": "456:456", + "default_action": "permit", + "prefixes_v4": ["10.10.0.0/24", "10.11.0.0/24"], + "prefixes_v6": ["fc00:f1::/64", "fc00:a1::/64"] + } + ] + } + } + }, + "BGP_ALLOWED_PREFIXES_COM_LIST_INVALID_DEPLOYMENT": { + "sonic-bgp-allowed-prefix:sonic-bgp-allowed-prefix": { + "sonic-bgp-allowed-prefix:BGP_ALLOWED_PREFIXES": { + "BGP_ALLOWED_PREFIXES_COM_LIST": [ + { + "deployment": "DEPLOYMENTID", + "id": "4", + "community": "123:123", + "default_action": "permitall", + "prefixes_v4": ["10.0.0.0/24", "10.1.0.0/24"], + "prefixes_v6": ["fc00:f0::/64", "fc00:a0::/64"] + } + ] + } + } + }, + "BGP_ALLOWED_PREFIXES_COM_LIST_INVALID_DEFAULT_ACTION": { + "sonic-bgp-allowed-prefix:sonic-bgp-allowed-prefix": { + "sonic-bgp-allowed-prefix:BGP_ALLOWED_PREFIXES": { + "BGP_ALLOWED_PREFIXES_COM_LIST": [ + { + "deployment": "DEPLOYMENT_ID", + "id": "4", + "community": "123:123", + "default_action": "permitall", + "prefixes_v4": ["10.0.0.0/24", "10.1.0.0/24"], + "prefixes_v6": ["fc00:f0::/64", "fc00:a0::/64"] + } + ] + } + } + }, + "BGP_ALLOWED_PREFIXES_COM_LIST_INVALID_PREFIXES_IPV4": { + "sonic-bgp-allowed-prefix:sonic-bgp-allowed-prefix": { + "sonic-bgp-allowed-prefix:BGP_ALLOWED_PREFIXES": { + "BGP_ALLOWED_PREFIXES_COM_LIST": [ + { + "deployment": "DEPLOYMENT_ID", + "id": "4", + "community": "123:123", + "default_action": "permit", + "prefixes_v4": ["10.0.0.0/48", "10.1.0.0/24"], + "prefixes_v6": ["fc00:f0::/64", "fc00:a0::/64"] + } + ] + } + } + }, + "BGP_ALLOWED_PREFIXES_COM_LIST_INVALID_PREFIXES_IPV6": { + "sonic-bgp-allowed-prefix:sonic-bgp-allowed-prefix": { + "sonic-bgp-allowed-prefix:BGP_ALLOWED_PREFIXES": { + "BGP_ALLOWED_PREFIXES_COM_LIST": [ + { + "deployment": "DEPLOYMENT_ID", + "id": "4", + "community": "123:123", + "default_action": "permit", + "prefixes_v4": ["10.0.0.0/24", "10.1.0.0./24"], + "prefixes_v6": ["fc00:f0::/129", "fc00:a0::/64"] + } + ] + } + } + }, + "BGP_ALLOWED_PREFIXES_LIST_ALL_VALID": { + "sonic-bgp-allowed-prefix:sonic-bgp-allowed-prefix": { + "sonic-bgp-allowed-prefix:BGP_ALLOWED_PREFIXES": { + "BGP_ALLOWED_PREFIXES_LIST": [ + { + "deployment": "DEPLOYMENT_ID", + "id": "4", + "default_action": "permit", + "prefixes_v4": ["10.0.0.0/24", "10.1.0.0/24"], + "prefixes_v6": ["fc00:f0::/64", "fc00:a0::/64"] + }, + { + "deployment": "DEPLOYMENT_ID", + "id": "5", + "default_action": "permit", + "prefixes_v4": ["10.10.0.0/24", "10.11.0.0/24"], + "prefixes_v6": ["fc00:f1::/64", "fc00:a1::/64"] + } + ] + } + } + }, + "BGP_ALLOWED_PREFIXES_LIST_INVALID_DEPLOYMENT": { + "sonic-bgp-allowed-prefix:sonic-bgp-allowed-prefix": { + "sonic-bgp-allowed-prefix:BGP_ALLOWED_PREFIXES": { + "BGP_ALLOWED_PREFIXES_LIST": [ + { + "deployment": "DEPLOYMENTID", + "id": "4", + "default_action": "permitall", + "prefixes_v4": ["10.0.0.0/24", "10.1.0.0/24"], + "prefixes_v6": ["fc00:f0::/64", "fc00:a0::/64"] + } + ] + } + } + }, + "BGP_ALLOWED_PREFIXES_LIST_INVALID_DEFAULT_ACTION": { + "sonic-bgp-allowed-prefix:sonic-bgp-allowed-prefix": { + "sonic-bgp-allowed-prefix:BGP_ALLOWED_PREFIXES": { + "BGP_ALLOWED_PREFIXES_LIST": [ + { + "deployment": "DEPLOYMENT_ID", + "id": "4", + "default_action": "permitall", + "prefixes_v4": ["10.0.0.0/24", "10.1.0.0/24"], + "prefixes_v6": ["fc00:f0::/64", "fc00:a0::/64"] + } + ] + } + } + }, + "BGP_ALLOWED_PREFIXES_LIST_INVALID_PREFIXES_IPV4": { + "sonic-bgp-allowed-prefix:sonic-bgp-allowed-prefix": { + "sonic-bgp-allowed-prefix:BGP_ALLOWED_PREFIXES": { + "BGP_ALLOWED_PREFIXES_LIST": [ + { + "deployment": "DEPLOYMENT_ID", + "id": "4", + "default_action": "permit", + "prefixes_v4": ["10.0.0.0/48", "10.1.0.0/24"], + "prefixes_v6": ["fc00:f0::/64", "fc00:a0::/64"] + } + ] + } + } + }, + "BGP_ALLOWED_PREFIXES_LIST_INVALID_PREFIXES_IPV6": { + "sonic-bgp-allowed-prefix:sonic-bgp-allowed-prefix": { + "sonic-bgp-allowed-prefix:BGP_ALLOWED_PREFIXES": { + "BGP_ALLOWED_PREFIXES_LIST": [ + { + "deployment": "DEPLOYMENT_ID", + "id": "4", + "default_action": "permit", + "prefixes_v4": ["10.0.0.0/24", "10.1.0.0./24"], + "prefixes_v6": ["fc00:f0::/129", "fc00:a0::/64"] + } + ] + } + } + } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/breakout.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/breakout.json index 8b9b65835cc9..24351dfd59ab 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/breakout.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/breakout.json @@ -1,60 +1,4 @@ { - "BREAKOUT_CFG_CORRECT_MODES": { - "sonic-breakout_cfg:sonic-breakout_cfg": { - "sonic-breakout_cfg:BREAKOUT_CFG": { - "BREAKOUT_CFG_LIST": [ - { - "brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]", - "port": "Ethernet0" - }, - { - "brkout_mode": "2x100G[50G,40G,25G,10G,1G]", - "port": "Ethernet8" - }, - { - "brkout_mode": "4x50G[40G,25G,10G,1G]", - "port": "Ethernet4" - }, - { - "brkout_mode": "1x25G[10G]", - "port": "Ethernet12" - }, - { - "brkout_mode": "1x100G[50G,40G,25G,10G]", - "port": "Ethernet16" - }, - { - "brkout_mode": "2x50G[40G,25G,10G]", - "port": "Ethernet20" - }, - { - "brkout_mode": "1x400G[200G,100G,50G,40G,25G,10G,1G]", - "port": "Ethernet24" - } - ] - } - } - }, - "BREAKOUT_CFG_INCORRECT_MODES": { - "sonic-breakout_cfg:sonic-breakout_cfg": { - "sonic-breakout_cfg:BREAKOUT_CFG": { - "BREAKOUT_CFG_LIST": [ - { - "brkout_mode": "1x500G[100G,50G,40G,25G,10G,1G]", - "port": "Ethernet0" - }, - { - "brkout_mode": "2x300G[50G,40G,25G,1G]", - "port": "Ethernet8" - }, - { - "brkout_mode": "5x50G[40G,25G]", - "port": "Ethernet4" - } - ] - } - } - }, "CRM_BRK_CFG_FLEX_TABLE": { "sonic-breakout_cfg:sonic-breakout_cfg": { "sonic-breakout_cfg:BREAKOUT_CFG": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_pg.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_pg.json new file mode 100644 index 000000000000..cd0a244a0e0e --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_pg.json @@ -0,0 +1,260 @@ +{ + "BUFFER_PG_CORRECT_PROFILE_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "300", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "size": "1518", + "dynamic_th": "2", + "pool": "egress_lossless_pool" + } + ] + } + }, + "sonic-buffer-pg:sonic-buffer-pg": { + "sonic-buffer-pg:BUFFER_PG": { + "BUFFER_PG_LIST": [ + { + "port": "Ethernet4", + "pg_num": "3", + "profile": "lossless_buffer_profile" + } + ] + } + } + }, + "BUFFER_PG_NULL_PROFILE_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "300", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "size": "300", + "pool": "egress_lossless_pool" + } + ] + } + }, + "sonic-buffer-pg:sonic-buffer-pg": { + "sonic-buffer-pg:BUFFER_PG": { + "BUFFER_PG_LIST": [ + { + "port": "Ethernet4", + "pg_num": "3", + "profile": "NULL" + } + ] + } + } + }, + "BUFFER_PG_WRONG_PROFILE_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "300", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "pool": "egress_lossless_pool" + } + ] + } + }, + "sonic-buffer-pg:sonic-buffer-pg": { + "sonic-buffer-pg:BUFFER_PG": { + "BUFFER_PG_LIST": [ + { + "port": "Ethernet4", + "pg_num": "3", + "profile": "wrong" + } + ] + } + } + }, + "BUFFER_PG_WRONG_PG_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "300", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "pool": "egress_lossless_pool" + } + ] + } + }, + "sonic-buffer-pg:sonic-buffer-pg": { + "sonic-buffer-pg:BUFFER_PG": { + "BUFFER_PG_LIST": [ + { + "port": "Ethernet4", + "pg_num": "9", + "profile": "lossless_buffer_profile" + } + ] + } + } + }, + "BUFFER_PG_WRONG_PORT_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "300", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "pool": "egress_lossless_pool" + } + ] + } + }, + "sonic-buffer-pg:sonic-buffer-pg": { + "sonic-buffer-pg:BUFFER_PG": { + "BUFFER_PG_LIST": [ + { + "port": "wrong", + "pg_num": "4", + "profile": "lossless_buffer_profile" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_pool.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_pool.json new file mode 100644 index 000000000000..8a0005305faa --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_pool.json @@ -0,0 +1,157 @@ +{ + "BUFFER_POOL_CORRECT_TYPE_INGRESS_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "Ethernet4", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + } + }, + "BUFFER_POOL_CORRECT_TYPE_EGRESS_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "Ethernet4", + "mode": "static", + "size": "12766208", + "type": "egress" + } + ] + } + } + }, + "BUFFER_POOL_WRONG_TYPE_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "Ethernet4", + "mode": "static", + "size": "12766208", + "type": "wrong" + } + ] + } + } + }, + "BUFFER_POOL_MANDATORY_TYPE_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "Ethernet4", + "mode": "static", + "size": "12766208" + } + ] + } + } + }, + "BUFFER_POOL_CORRECT_MODE_STATIC_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "Ethernet4", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + } + }, + "BUFFER_POOL_CORRECT_MODE_DYNAMIC_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "Ethernet4", + "mode": "dynamic", + "size": "12766208", + "type": "ingress" + } + ] + } + } + }, + "BUFFER_POOL_WRONG_MODE_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "Ethernet4", + "mode": "wrong", + "size": "12766208", + "type": "ingress" + } + ] + } + } + }, + "BUFFER_POOL_CORRECT_XOFF_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "Ethernet4", + "mode": "static", + "xoff": "300", + "size": "12766208", + "type": "ingress" + } + ] + } + } + }, + "BUFFER_POOL_WRONG_XOFF_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "Ethernet4", + "mode": "static", + "xoff": "wrong", + "size": "12766208", + "type": "ingress" + } + ] + } + } + }, + "BUFFER_POOL_CORRECT_SIZE_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "Ethernet4", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + } + }, + "BUFFER_POOL_WRONG_SIZE_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "Ethernet4", + "mode": "static", + "size": "wrong", + "type": "ingress" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_egress_profile_list.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_egress_profile_list.json new file mode 100644 index 000000000000..72e31ef9c340 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_egress_profile_list.json @@ -0,0 +1,160 @@ +{ + "BUFFER_PORT_EGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless-pool", + "mode": "static", + "size": "300", + "type": "egress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "size": "1518", + "dynamic_th": "2", + "pool": "egress_lossless-pool" + }, + { + "name": "lossless_buffer_profile2", + "size": "1518", + "dynamic_th": "2", + "pool": "egress_lossless-pool" + } + ] + } + }, + "sonic-buffer-port-egress-profile-list:sonic-buffer-port-egress-profile-list": { + "sonic-buffer-port-egress-profile-list:BUFFER_PORT_EGRESS_PROFILE_LIST": { + "BUFFER_PORT_EGRESS_PROFILE_LIST_LIST": [ + { + "port": "Ethernet4", + "profile_list": ["lossless_buffer_profile", "lossless_buffer_profile2"] + } + ] + } + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless-pool", + "mode": "static", + "size": "300", + "type": "egress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "pool": "egress_lossless-pool" + } + ] + } + }, + "sonic-buffer-port-egress-profile-list:sonic-buffer-port-egress-profile-list": { + "sonic-buffer-port-egress-profile-list:BUFFER_PORT_EGRESS_PROFILE_LIST": { + "BUFFER_PORT_EGRESS_PROFILE_LIST_LIST": [ + { + "port": "Ethernet4", + "profile_list": ["wrong"] + } + ] + } + } + }, + "BUFFER_PORT_EGRESS_PROFILE_LIST_WRONG_PORT_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless-pool", + "mode": "static", + "size": "300", + "type": "egress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "pool": "egress_lossless-pool" + } + ] + } + }, + "sonic-buffer-port-egress-profile-list:sonic-buffer-port-egress-profile-list": { + "sonic-buffer-port-egress-profile-list:BUFFER_PORT_EGRESS_PROFILE_LIST": { + "BUFFER_PORT_EGRESS_PROFILE_LIST_LIST": [ + { + "port": "wrong", + "profile_list": ["lossless_buffer_profile"] + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_ingress_profile_list.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_ingress_profile_list.json new file mode 100644 index 000000000000..aef66e1b014b --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_port_ingress_profile_list.json @@ -0,0 +1,160 @@ +{ + "BUFFER_PORT_INGRESS_PROFILE_LIST_CORRECT_PROFILE_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless-pool", + "mode": "static", + "size": "300", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "size": "1518", + "dynamic_th": "2", + "pool": "egress_lossless-pool" + }, + { + "name": "lossless_buffer_profile2", + "size": "1518", + "dynamic_th": "2", + "pool": "egress_lossless-pool" + } + ] + } + }, + "sonic-buffer-port-ingress-profile-list:sonic-buffer-port-ingress-profile-list": { + "sonic-buffer-port-ingress-profile-list:BUFFER_PORT_INGRESS_PROFILE_LIST": { + "BUFFER_PORT_INGRESS_PROFILE_LIST_LIST": [ + { + "port": "Ethernet4", + "profile_list": ["lossless_buffer_profile", "lossless_buffer_profile2"] + } + ] + } + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST_WRONG_PROFILE_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless-pool", + "mode": "static", + "size": "300", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "pool": "egress_lossless-pool" + } + ] + } + }, + "sonic-buffer-port-ingress-profile-list:sonic-buffer-port-ingress-profile-list": { + "sonic-buffer-port-ingress-profile-list:BUFFER_PORT_INGRESS_PROFILE_LIST": { + "BUFFER_PORT_INGRESS_PROFILE_LIST_LIST": [ + { + "port": "Ethernet4", + "profile_list": ["wrong"] + } + ] + } + } + }, + "BUFFER_PORT_INGRESS_PROFILE_LIST_WRONG_PORT_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless-pool", + "mode": "static", + "size": "300", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "pool": "egress_lossless-pool" + } + ] + } + }, + "sonic-buffer-port-ingress-profile-list:sonic-buffer-port-ingress-profile-list": { + "sonic-buffer-port-ingress-profile-list:BUFFER_PORT_INGRESS_PROFILE_LIST": { + "BUFFER_PORT_INGRESS_PROFILE_LIST_LIST": [ + { + "port": "wrong", + "profile_list": ["lossless_buffer_profile"] + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_profile.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_profile.json new file mode 100644 index 000000000000..b6daa30abad9 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_profile.json @@ -0,0 +1,604 @@ +{ + "BUFFER_PROFILE_CORRECT_STATIC_THRESHOLD_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "1518", + "static_th": "33004032" + } + ] + } + } + }, + "BUFFER_PROFILE_WRONG_STATIC_THRESHOLD_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "1518", + "static_th": "-1" + } + ] + } + } + }, + "BUFFER_PROFILE_WRONG_THRESHOLD_TYPE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "1518", + "wrong_th": "1234" + } + ] + } + } + }, + "BUFFER_PROFILE_WRONG_NO_THRESHOLD_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "1518" + } + ] + } + } + }, + "BUFFER_PROFILE_CORRECT_DYNAMIC_THRESHOLD_MIN_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "1518", + "dynamic_th": "-8" + } + ] + } + } + }, + "BUFFER_PROFILE_CORRECT_DYNAMIC_THRESHOLD_MAX_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "1518", + "dynamic_th": "7" + } + ] + } + } + }, + "BUFFER_PROFILE_WRONG_DYNAMIC_THRESHOLD_VALUE1": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "1518", + "dynamic_th": "-9" + } + ] + } + } + }, + "BUFFER_PROFILE_WRONG_DYNAMIC_THRESHOLD_VALUE2": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "1518", + "dynamic_th": "8" + } + ] + } + } + }, + "BUFFER_PROFILE_MANDATORY_THRESHOLD_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "1518" + } + ] + } + } + }, + "BUFFER_PROFILE_DUAL_THRESHOLD_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "dynamic_th": "3", + "static_th": "3", + "size": "1518" + } + ] + } + } + }, + "BUFFER_PROFILE_CORRECT_SIZE_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "1518", + "static_th": "33004032" + } + ] + } + } + }, + "BUFFER_PROFILE_WRONG_SIZE_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "-1", + "static_th": "33004032" + } + ] + } + } + }, + "BUFFER_PROFILE_MANDATORY_SIZE_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "static_th": "33004032" + } + ] + } + } + }, + "BUFFER_PROFILE_CORRECT_POOL_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "testing", + "size": "0", + "static_th": "33004032", + "pool": "egress_lossless_pool" + } + ] + } + } + }, + "BUFFER_PROFILE_WRONG_POOL_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "testing", + "size": "0", + "static_th": "33004032", + "pool": "wrong" + } + ] + } + } + }, + "BUFFER_PROFILE_MANDATORY_POOL_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "testing", + "size": "0", + "static_th": "33004032" + } + ] + } + } + }, + "BUFFER_PROFILE_CORRECT_XON_OFFSET_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "0", + "static_th": "33004032", + "xon_offset": "3584" + } + ] + } + } + }, + "BUFFER_PROFILE_CORRECT_XON_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "0", + "static_th": "33004032", + "xon": "2560" + } + ] + } + } + }, + "BUFFER_PROFILE_CORRECT_HEADROOM_TYPE_STATIC": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "0", + "static_th": "33004032", + "headroom_type": "static" + } + ] + } + } + }, + "BUFFER_PROFILE_CORRECT_HEADROOM_TYPE_DYNAMIC": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "0", + "static_th": "33004032", + "headroom_type": "dynamic" + } + ] + } + } + }, + "BUFFER_PROFILE_WRONG_HEADROOM_TYPE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "0", + "static_th": "33004032", + "headroom_type": "Invalid" + } + ] + } + } + }, + "BUFFER_PROFILE_CORRECT_XOFF_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "0", + "static_th": "33004032", + "xoff": "196608" + } + ] + } + } + }, + "BUFFER_PROFILE_WRONG_XOFF_VALUE": { + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "Ethernet4", + "pool": "egress_lossless_pool", + "size": "0", + "static_th": "33004032", + "xoff": "-1" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_queue.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_queue.json new file mode 100644 index 000000000000..e737c129682e --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/buffer_queue.json @@ -0,0 +1,211 @@ +{ + "BUFFER_QUEUE_CORRECT_PROFILE_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "size": 1518, + "dynamic_th": "2", + "pool": "egress_lossless_pool" + } + ] + } + }, + "sonic-buffer-queue:sonic-buffer-queue": { + "sonic-buffer-queue:BUFFER_QUEUE": { + "BUFFER_QUEUE_LIST": [ + { + "port": "Ethernet4", + "qindex": "15", + "profile": "lossless_buffer_profile" + } + ] + } + } + }, + "BUFFER_QUEUE_WRONG_PROFILE_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "size": "1518", + "pool": "egress_lossless_pool" + } + ] + } + }, + "sonic-buffer-queue:sonic-buffer-queue": { + "sonic-buffer-queue:BUFFER_QUEUE": { + "BUFFER_QUEUE_LIST": [ + { + "port": "Ethernet4", + "qindex": "3", + "profile": "wrong" + } + ] + } + } + }, + "BUFFER_QUEUE_WRONG_QUEUE_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "size": "1518", + "pool": "egress_lossless_pool" + } + ] + } + }, + "sonic-buffer-queue:sonic-buffer-queue": { + "sonic-buffer-queue:BUFFER_QUEUE": { + "BUFFER_QUEUE_LIST": [ + { + "port": "Ethernet4", + "qindex": "16", + "profile": "lossless_buffer_profile" + } + ] + } + } + }, + "BUFFER_QUEUE_WRONG_PORT_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-buffer-pool:sonic-buffer-pool": { + "sonic-buffer-pool:BUFFER_POOL": { + "BUFFER_POOL_LIST": [ + { + "name": "egress_lossless_pool", + "mode": "static", + "size": "12766208", + "type": "ingress" + } + ] + } + }, + "sonic-buffer-profile:sonic-buffer-profile": { + "sonic-buffer-profile:BUFFER_PROFILE": { + "BUFFER_PROFILE_LIST": [ + { + "name": "lossless_buffer_profile", + "size": "1518", + "pool": "egress_lossless_pool" + } + ] + } + }, + "sonic-buffer-queue:sonic-buffer-queue": { + "sonic-buffer-queue:BUFFER_QUEUE": { + "BUFFER_QUEUE_LIST": [ + { + "port": "wrong", + "qindex": "4", + "profile": "lossless_buffer_profile" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/cable_length.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/cable_length.json new file mode 100644 index 000000000000..4ea61fe52832 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/cable_length.json @@ -0,0 +1,182 @@ +{ + "CABLE_LENGTH_TEST": { + "sonic-cable-length:sonic-cable-length": { + "sonic-cable-length:CABLE_LENGTH": { + "CABLE_LENGTH_LIST": [ + { + "name": "AZURE", + "CABLE_LENGTH": [ + { + "port": "Ethernet8", + "length": "5m" + }, + { + "port": "Ethernet12", + "length": "5m" + } + ] + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "admin_status": "up", + "alias": "Ethernet8/1", + "description": "Ethernet8", + "lanes": "45,46,47,48", + "mtu": 9000, + "speed": 100000 + }, + { + "name": "Ethernet12", + "admin_status": "up", + "alias": "Ethernet12/1", + "description": "Ethernet12", + "lanes": "49,50,51,52", + "mtu": 9000, + "speed": 100000 + } + ] + } + } + }, + "CABLE_LENGTH_NAME_TEST": { + "sonic-cable-length:sonic-cable-length": { + "sonic-cable-length:CABLE_LENGTH": { + "CABLE_LENGTH_LIST": [ + { + "name": "SONIC", + "CABLE_LENGTH": [ + { + "port": "Ethernet8", + "length": "5m" + }, + { + "port": "Ethernet12", + "length": "5m" + } + ] + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "admin_status": "up", + "alias": "Ethernet8/1", + "description": "Ethernet8", + "lanes": "45,46,47,48", + "mtu": 9000, + "speed": 100000 + }, + { + "name": "Ethernet12", + "admin_status": "up", + "alias": "Ethernet12/1", + "description": "Ethernet12", + "lanes": "49,50,51,52", + "mtu": 9000, + "speed": 100000 + } + ] + } + } + }, + "CABLE_LENGTH_NON_EXISTING_PORT_TEST": { + "sonic-cable-length:sonic-cable-length": { + "sonic-cable-length:CABLE_LENGTH": { + "CABLE_LENGTH_LIST": [ + { + "name": "AZURE", + "CABLE_LENGTH": [ + { + "port": "Ethernet8", + "length": "5m" + }, + { + "port": "Ethernet16", + "length": "5m" + } + ] + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "admin_status": "up", + "alias": "Ethernet8/1", + "description": "Ethernet8", + "lanes": "45,46,47,48", + "mtu": 9000, + "speed": 100000 + }, + { + "name": "Ethernet12", + "admin_status": "up", + "alias": "Ethernet12/1", + "description": "Ethernet12", + "lanes": "49,50,51,52", + "mtu": 9000, + "speed": 100000 + } + ] + } + } + }, + "CABLE_LENGTH_INVALID_LENGTH_FORMAT_TEST": { + "sonic-cable-length:sonic-cable-length": { + "sonic-cable-length:CABLE_LENGTH": { + "CABLE_LENGTH_LIST": [ + { + "name": "AZURE", + "CABLE_LENGTH": [ + { + "port": "Ethernet8", + "length": "5m" + }, + { + "port": "Ethernet12", + "length": "5" + } + ] + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "admin_status": "up", + "alias": "Ethernet8/1", + "description": "Ethernet8", + "lanes": "45,46,47,48", + "mtu": 9000, + "speed": 100000 + }, + { + "name": "Ethernet12", + "admin_status": "up", + "alias": "Ethernet12/1", + "description": "Ethernet12", + "lanes": "49,50,51,52", + "mtu": 9000, + "speed": 100000 + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/cbfmaps.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/cbfmaps.json new file mode 100644 index 000000000000..01829df92bae --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/cbfmaps.json @@ -0,0 +1,159 @@ +{ + "DSCP_TO_FC_MAP_CREATE": { + "sonic-dscp-fc-map:sonic-dscp-fc-map": { + "sonic-dscp-fc-map:DSCP_TO_FC_MAP": { + "DSCP_TO_FC_MAP_LIST": [ + { + "name": "map1", + "DSCP_TO_FC_MAP": [ + { + "dscp": "1", + "fc": "1" + }, + { + "dscp":"2", + "fc":"2" + } + ] + }, + { + "name": "map2", + "DSCP_TO_FC_MAP": [ + { + "dscp": "1", + "fc": "1" + }, + { + "dscp":"2", + "fc":"2" + } + ] + } + ] + } + } + }, + + "DSCP_TO_FC_MAP_CREATE_INVALID_DSCP": { + "sonic-dscp-fc-map:sonic-dscp-fc-map": { + "sonic-dscp-fc-map:DSCP_TO_FC_MAP": { + "DSCP_TO_FC_MAP_LIST": [ + { + "name": "map3", + "DSCP_TO_FC_MAP": [ + { + "dscp": "64", + "fc": "1" + }, + { + "dscp":"2", + "fc":"2" + } + ] + } + ] + } + } + }, + + "DSCP_TO_FC_MAP_CREATE_INVALID_FC": { + "sonic-dscp-fc-map:sonic-dscp-fc-map": { + "sonic-dscp-fc-map:DSCP_TO_FC_MAP": { + "DSCP_TO_FC_MAP_LIST": [ + { + "name": "map3", + "DSCP_TO_FC_MAP": [ + { + "dscp": "1", + "fc": "8" + }, + { + "dscp":"2", + "fc":"2" + } + ] + } + ] + } + } + }, + + "EXP_TO_FC_MAP_CREATE": { + "sonic-exp-fc-map:sonic-exp-fc-map": { + "sonic-exp-fc-map:EXP_TO_FC_MAP": { + "EXP_TO_FC_MAP_LIST": [ + { + "name": "map1", + "EXP_TO_FC_MAP": [ + { + "exp": "1", + "fc": "1" + }, + { + "exp":"2", + "fc":"2" + } + ] + }, + { + "name": "map2", + "EXP_TO_FC_MAP": [ + { + "exp": "1", + "fc": "1" + }, + { + "exp":"2", + "fc":"2" + } + ] + } + ] + } + } + }, + + "EXP_TO_FC_MAP_CREATE_INVALID_EXP": { + "sonic-exp-fc-map:sonic-exp-fc-map": { + "sonic-exp-fc-map:EXP_TO_FC_MAP": { + "EXP_TO_FC_MAP_LIST": [ + { + "name": "map3", + "EXP_TO_FC_MAP": [ + { + "exp": "8", + "fc": "1" + }, + { + "exp":"2", + "fc":"2" + } + ] + } + ] + } + } + }, + + "EXP_TO_FC_MAP_CREATE_INVALID_FC": { + "sonic-exp-fc-map:sonic-exp-fc-map": { + "sonic-exp-fc-map:EXP_TO_FC_MAP": { + "EXP_TO_FC_MAP_LIST": [ + { + "name": "map3", + "EXP_TO_FC_MAP": [ + { + "exp": "1", + "fc": "8" + }, + { + "exp":"2", + "fc":"2" + } + ] + } + ] + } + } + } +} \ No newline at end of file diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json index 501ad9bb2c20..687a745a24c6 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json @@ -44,6 +44,47 @@ } } }, + "DEVICE_METADATA_TYPE_CORRECT_PATTERN": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "bgp_asn": "65002", + "type": "BackEndToRRouter" + } + } + } + }, + "DEVICE_METADATA_TYPE_BMC_MGMT_TOR_PATTERN": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "bgp_asn": "65002", + "type": "BmcMgmtToRRouter" + } + } + } + }, + "DEVICE_METADATA_TYPE_NOT_PROVISIONED_PATTERN": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "bgp_asn": "65002", + "type": "not-provisioned" + } + } + } + }, + "DEVICE_METADATA_DEFAULT_SYNCHRONOUS_MODE": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "bgp_asn": "65001", + "hostname": "DUT-CSW", + "platform": "Stone-DX010" + } + } + } + }, "DEV_META_DEV_NEIGH_VERSION_TABLE": { "sonic-device_metadata:sonic-device_metadata": { "sonic-device_metadata:DEVICE_METADATA": { @@ -128,5 +169,147 @@ } } } + }, + "DEVICE_METADATA_CORRECT_CLOUDTYPE_REGION_CONFIG": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "cloudtype": "Public", + "region": "usfoo" + } + } + } + }, + "DEVICE_METADATA_DOWNSTREAM_SUBROLE_CONFIG": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "downstream_subrole": "downstream_subrole_y" + } + } + } + }, + "DEVICE_METADATA_RESOURCE_TYPE_CONFIG": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "resource_type": "resource_type_x" + } + } + } + }, + "DEVICE_METADATA_VALID_CLUSTER": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "cluster": "AAA00PrdStr00" + } + } + } + }, + "DEVICE_METADATA_VALID_SUBTYPE": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "subtype": "DualToR" + } + } + } + }, + "DEVICE_METADATA_INVALID_SUBTYPE": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "subtype": "FakeSubtype" + } + } + } + }, + "DEVICE_METADATA_VALID_PEER_SWITCH": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "peer_switch": "peer_01_hostname" + } + } + } + }, + "DEVICE_METADATA_INVALID_PEER_SWITCH": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "peer_switch": "this_super_duper_long_hostname_is_too_long_according_to_RFC_1035" + } + } + } + }, + "DEVICE_METADATA_VALID_STORAGE_DEVICE": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "storage_device": "true" + } + } + } + }, + "DEVICE_METADATA_INVALID_STORAGE_DEVICE": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "storage_device": "yes" + } + } + } + }, + "DEVICE_METADATA_INCORRECT_VOQ_CONFIG": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "asic_name": "Asic0", + "switch_id": "2", + "switch_type": "incorrect_pattern", + "max_cores": "8" + } + } + } + }, + "DEVICE_METADATA_CORRECT_VOQ_CONFIG": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "asic_name": "Asic0", + "switch_id": "2", + "switch_type": "voq", + "max_cores": "8" + } + } + } + }, + "DEVICE_METADATA_VALID_SUB_ROLE_CONFIG": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "sub_role": "FrontEnd" + } + } + } + }, + "DEVICE_METADATA_VALID_DHCP_SERVER": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "dhcp_server": "enabled" + } + } + } + }, + "DEVICE_METADATA_INVALID_DHCP_SERVER": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "dhcp_server": "invalid" + } + } + } } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/dhcpv6_relay.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/dhcpv6_relay.json new file mode 100644 index 000000000000..68c077e51e91 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/dhcpv6_relay.json @@ -0,0 +1,86 @@ +{ + "DHCPV6_SERVER_INCORRECT_FORMAT": { + "sonic-dhcpv6-relay:sonic-dhcpv6-relay": { + "sonic-dhcpv6-relay:DHCP_RELAY": { + "DHCP_RELAY_LIST": [ + { + "dhcpv6_servers": [ + "2001:1:2" + ], + "name": "Vlan500" + } + ] + } + } + }, + "DHCPV6_SERVER_VALID_FORMAT": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "mtu": 9000, + "lanes": "1", + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "admin_status": "up", + "description": "v6server_vlan", + "dhcpv6_servers": [ + "2001:1::2" + ], + "mtu": "9216", + "name": "Vlan400" + } + ] + }, + "sonic-vlan:VLAN_MEMBER": { + "VLAN_MEMBER_LIST": [ + { + "port": "Ethernet0", + "tagging_mode": "tagged", + "name": "Vlan400" + } + ] + }, + "sonic-vlan:VLAN_INTERFACE": { + "VLAN_INTERFACE_IPPREFIX_LIST": [ + { + "family": "IPv6", + "ip-prefix": "2002::1/64", + "scope": "global", + "name": "Vlan400" + } + ], + "VLAN_INTERFACE_LIST": [ + { + "name": "Vlan400" + } + ] + } + }, + "sonic-dhcpv6-relay:sonic-dhcpv6-relay": { + "sonic-dhcpv6-relay:DHCP_RELAY": { + "DHCP_RELAY_LIST": [ + { + "dhcpv6_servers": [ + "2001:1::2" + ], + "rfc6939_support": "true", + + "name": "Vlan400" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/feature.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/feature.json index 661cf1db2b53..82e403cb147c 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/feature.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/feature.json @@ -7,9 +7,10 @@ "name": "database", "state": "always_enabled", "auto_restart": "always_enabled", - "has_timer": "false", - "has_global_scope": "true", - "has_per_asic_scope": "true" + "has_timer": "False", + "has_global_scope": "True", + "has_per_asic_scope": "True", + "set_owner": "local" }, { "name": "swss", @@ -17,7 +18,8 @@ "auto_restart": "always_enabled", "has_timer": "false", "has_global_scope": "false", - "has_per_asic_scope": "true" + "has_per_asic_scope": "true", + "set_owner": "local" }, { "name": "syncd", @@ -25,7 +27,8 @@ "auto_restart": "always_enabled", "has_timer": "false", "has_global_scope": "false", - "has_per_asic_scope": "true" + "has_per_asic_scope": "true", + "set_owner": "local" }, { "name": "snmp", @@ -33,8 +36,52 @@ "auto_restart": "enabled", "has_timer": "false", "has_global_scope": "true", - "has_per_asic_scope": "false" + "has_per_asic_scope": "false", + "set_owner": "kube" }, + { + "name": "lldp", + "state": "disabled", + "auto_restart": "disabled", + "has_timer": "false", + "has_global_scope": "false", + "has_per_asic_scope": "true", + "set_owner": "kube" + }, + { + "name": "dhcp_relay", + "state": "{% if not (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] != 'ToRRouter') %}enabled{% else %}disabled{% endif %}", + "auto_restart": "disabled", + "has_timer": "false", + "has_global_scope": "false", + "has_per_asic_scope": "true", + "set_owner": "kube" + } + ] + } + } + }, + "FEATURE_WITH_INVALID_OWNER": { + "sonic-feature:sonic-feature": { + "sonic-feature:FEATURE": { + "FEATURE_LIST": [ + { + "name": "lldp", + "state": "disabled", + "auto_restart": "disabled", + "has_timer": "false", + "has_global_scope": "false", + "has_per_asic_scope": "true", + "set_owner": "invalid" + } + ] + } + } + }, + "FEATURE_WITH_NO_OWNER": { + "sonic-feature:sonic-feature": { + "sonic-feature:FEATURE": { + "FEATURE_LIST": [ { "name": "lldp", "state": "disabled", @@ -47,20 +94,20 @@ } } }, - "FEATURE_WITH_INVALID_STATE": { + "FEATURE_WITH_INVALID_BOOLEAN_TYPE": { "sonic-feature:sonic-feature": { "sonic-feature:FEATURE": { "FEATURE_LIST": [ { "name": "database", - "state": "dontcare", + "state": "always_enabled", "auto_restart": "always_enabled", - "has_timer": "false", - "has_global_scope": "true", - "has_per_asic_scope": "true" + "has_timer": "FALSE", + "has_global_scope": "TRUE", + "has_per_asic_scope": "TRUE" } ] } } } -} \ No newline at end of file +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/flex_counter.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/flex_counter.json index d2c007d9f284..169a38ff6d7c 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/flex_counter.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/flex_counter.json @@ -3,7 +3,8 @@ "sonic-flex_counter:sonic-flex_counter": { "sonic-flex_counter:FLEX_COUNTER_TABLE": { "BUFFER_POOL_WATERMARK": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 10000 }, "DEBUG_COUNTER": { "FLEX_COUNTER_STATUS": "enable" @@ -12,27 +13,165 @@ "FLEX_COUNTER_STATUS": "enable" }, "PG_DROP": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 10000 }, "PG_WATERMARK": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 10000 }, "PORT": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 1000 }, "PORT_BUFFER_DROP": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 60000 }, "PORT_RATES": { "FLEX_COUNTER_STATUS": "enable" }, "QUEUE": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 10000 }, "QUEUE_WATERMARK": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 10000 + }, + "ACL": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 10000 + }, + "FLOW_CNT_TRAP": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 10000 + }, + "FLOW_CNT_ROUTE": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 10000 + } + } + } + }, + "FLEX_COUNTER_TABLE_WITH_INVALID_POLL_INTERVAL": { + "sonic-flex_counter:sonic-flex_counter": { + "sonic-flex_counter:FLEX_COUNTER_TABLE": { + "BUFFER_POOL_WATERMARK": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 99 + }, + "DEBUG_COUNTER": { + "FLEX_COUNTER_STATUS": "enable" + }, + "PFCWD": { "FLEX_COUNTER_STATUS": "enable" + }, + "PG_DROP": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 99 + }, + "PG_WATERMARK": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 99 + }, + "PORT": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 99 + }, + "PORT_BUFFER_DROP": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 99 + }, + "PORT_RATES": { + "FLEX_COUNTER_STATUS": "enable" + }, + "QUEUE": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 99 + }, + "QUEUE_WATERMARK": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 99 + }, + "ACL": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 99 + }, + "FLOW_CNT_TRAP": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 99 + }, + "FLOW_CNT_ROUTE": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 99 } } } + }, + "FLOW_COUNTER_ROUTE_PATTERN_TABLE_WITH_VRF": { + "sonic-vrf:sonic-vrf":{ + "sonic-vrf:VRF": { + "VRF_LIST": [ + { + "name":"Vrf1" + } + ] + } + }, + "sonic-flex_counter:sonic-flex_counter": { + "sonic-flex_counter:FLOW_COUNTER_ROUTE_PATTERN": { + "FLOW_COUNTER_ROUTE_PATTERN_VRF_LIST": [ + { + "vrf_name": "Vrf1", + "ip_prefix": "1.1.1.0/24", + "max_match_count": 30 + }, + { + "vrf_name": "Vrf1", + "ip_prefix": "2000::/64", + "max_match_count": 30 + } + ] + } + } + }, + "FLOW_COUNTER_ROUTE_PATTERN_TABLE_WITH_DEFAULT_VRF": { + "sonic-flex_counter:sonic-flex_counter": { + "sonic-flex_counter:FLOW_COUNTER_ROUTE_PATTERN": { + "FLOW_COUNTER_ROUTE_PATTERN_LIST": [ + { + "ip_prefix": "1.1.1.0/24", + "max_match_count": 30 + }, + { + "ip_prefix": "2000::/64", + "max_match_count": 30 + } + ] + } + } + }, + "FLOW_COUNTER_ROUTE_PATTERN_TABLE_WITH_INVALID_MAX_MATCH_COUNT": { + "sonic-vrf:sonic-vrf":{ + "sonic-vrf:VRF": { + "VRF_LIST": [ + { + "name":"Vrf1" + } + ] + } + }, + "sonic-flex_counter:sonic-flex_counter": { + "sonic-flex_counter:FLOW_COUNTER_ROUTE_PATTERN": { + "FLOW_COUNTER_ROUTE_PATTERN_VRF_LIST": [ + { + "vrf_name": "Vrf1", + "ip_prefix": "1.1.1.0/24", + "max_match_count": 0 + } + ] + } + } } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/loopback.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/loopback.json index 89c40918739e..9ebb48556256 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/loopback.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/loopback.json @@ -1,5 +1,5 @@ { - "LOOPBACK_IPPREFIX_PORT_MUST_CONDITION_FALSE": { + "LOOPBACK_IPPREFIX_PORT_FOR_NON_EXIST_INTERFACE": { "sonic-loopback-interface:sonic-loopback-interface": { "sonic-loopback-interface:LOOPBACK_INTERFACE": { "LOOPBACK_INTERFACE_IPPREFIX_LIST": [ diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/mclag.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/mclag.json new file mode 100644 index 000000000000..fdb2661a973a --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/mclag.json @@ -0,0 +1,356 @@ +{ + "MCLAG_VALID_DOMAIN_CFG_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + }, + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet10", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet10", + "speed": 25000 + } + ] + } + }, + "sonic-portchannel:sonic-portchannel": { + "sonic-portchannel:PORTCHANNEL": { + "PORTCHANNEL_LIST": [ + { + "admin_status": "up", + "members": [ + "Ethernet0" + ], + "min_links": "1", + "mtu": "9100", + "lacp_key": "auto", + "name": "PortChannel2" + }, + { + "admin_status": "up", + "members": [ + "Ethernet10" + ], + "min_links": "1", + "mtu": "9100", + "lacp_key": "auto", + "name": "PortChannel10" + } + ] + } + }, + + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "name": "Vlan12" + }, + { + "name": "Vlan100" + } + ] + }, + "sonic-vlan:VLAN_MEMBER": { + "VLAN_MEMBER_LIST": [ + { + "port": "PortChannel10", + "tagging_mode": "tagged", + "name": "Vlan100" + }, + { + "port": "PortChannel2", + "tagging_mode": "tagged", + "name": "Vlan12" + }, + { + "port": "PortChannel2", + "tagging_mode": "tagged", + "name": "Vlan100" + } + ] + }, + "sonic-vlan:VLAN_INTERFACE": { + "VLAN_INTERFACE_LIST": [ + { + "name": "Vlan12" + } + ], + "VLAN_INTERFACE_IPPREFIX_LIST": [ + { + "family": "IPv4", + "ip-prefix": "12.1.1.1/24", + "scope": "global", + "name": "Vlan12" + } + ] + } + }, + "sonic-mclag:sonic-mclag": { + "sonic-mclag:MCLAG_DOMAIN": { + "MCLAG_DOMAIN_LIST": [ + { + "domain_id": "123", + "source_ip": "12.1.1.1", + "peer_ip" : "12.1.1.2", + "peer_link": "PortChannel2", + "keepalive_interval" : "1", + "session_timeout": "30" + } + ] + }, + "sonic-mclag:MCLAG_INTERFACE": { + "MCLAG_INTERFACE_LIST": [ + { + "domain_id": "123", + "if_name" : "PortChannel10", + "if_type" : "Portchannel" + } + ] + } + } + }, + "MCLAG_VALID_DOMAIN_PEERLINK_ETH_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + }, + { + "admin_status": "up", + "alias": "eth4", + "description": "Ethernet4", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet4", + "speed": 25000 + } + ] + } + }, + "sonic-portchannel:sonic-portchannel": { + "sonic-portchannel:PORTCHANNEL": { + "PORTCHANNEL_LIST": [ + { + "admin_status": "up", + "members": [ + "Ethernet0" + ], + "min_links": "1", + "mtu": "9100", + "lacp_key": "auto", + "name": "PortChannel2" + } + ] + } + }, + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "name": "Vlan12" + } + ] + }, + "sonic-vlan:VLAN_MEMBER": { + "VLAN_MEMBER_LIST": [ + { + "port": "PortChannel2", + "tagging_mode": "tagged", + "name": "Vlan12" + } + ] + }, + "sonic-vlan:VLAN_INTERFACE": { + "VLAN_INTERFACE_LIST": [ + { + "name": "Vlan12" + } + ], + "VLAN_INTERFACE_IPPREFIX_LIST": [ + { + "family": "IPv4", + "ip-prefix": "12.1.1.1/24", + "scope": "global", + "name": "Vlan12" + } + ] + } + }, + "sonic-mclag:sonic-mclag": { + "sonic-mclag:MCLAG_DOMAIN": { + "MCLAG_DOMAIN_LIST": [ + { + "domain_id": "123", + "source_ip": "12.1.1.1", + "peer_ip" : "12.1.1.2", + "peer_link": "Ethernet4", + "keepalive_interval" : "1", + "session_timeout": "30" + } + ] + } + } + }, + "MCLAG_INVALID_DOMAIN_IDS_TEST": { + "sonic-mclag:sonic-mclag": { + "sonic-mclag:MCLAG_DOMAIN": { + "MCLAG_DOMAIN_LIST": [ + { + "domain_id": "0", + "source_ip": "1.1.1.1" + }, + { + "domain_id": "4096", + "source_ip": "1.1.1.1" + } + + ] + } + } + }, + "MCLAG_INVALID_KEEPALIVE_TEST": { + "sonic-mclag:sonic-mclag": { + "sonic-mclag:MCLAG_DOMAIN": { + "MCLAG_DOMAIN_LIST": [ + { + "domain_id": "123", + "source_ip": "1.1.1.1", + "keepalive_interval" : "0", + "session_timeout": "30" + }, + { + "domain_id": "123", + "source_ip": "1.1.1.1", + "keepalive_interval" : "61", + "session_timeout": "30" + } + ] + } + } + }, + "MCLAG_INVALID_SESSION_TIMEOUT_TEST": { + "sonic-mclag:sonic-mclag": { + "sonic-mclag:MCLAG_DOMAIN": { + "MCLAG_DOMAIN_LIST": [ + { + "domain_id": "123", + "source_ip": "1.1.1.1", + "keepalive_interval" : "1", + "session_timeout": "0" + }, + { + "domain_id": "123", + "source_ip": "1.1.1.1", + "keepalive_interval" : "1", + "session_timeout": "3601" + } + ] + } + } + }, + "MCLAG_INVALID_KEEPALIVE_MUST_COND_TEST": { + "sonic-mclag:sonic-mclag": { + "sonic-mclag:MCLAG_DOMAIN": { + "MCLAG_DOMAIN_LIST": [ + { + "domain_id": "123", + "source_ip": "1.1.1.1", + "keepalive_interval" : "40", + "session_timeout": "30" + } + ] + } + } + }, + "MCLAG_INTERFACE_DOMAIN_ABSENT_TEST": { + "sonic-mclag:sonic-mclag": { + "sonic-mclag:MCLAG_INTERFACE": { + "MCLAG_INTERFACE_LIST": [ + { + "domain_id": "1001", + "if_name" : "PortChannel10", + "if_type" : "Portchannel" + }, + { + "domain_id": "2001", + "if_name" : "PortChannel20", + "if_type" : "Portchannel" + } + + ] + } + } + }, + "MCLAG_UNIQUE_IP_DOMAIN_ABSENT_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet12", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet12", + "speed": 25000 + } + ] + } + }, + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "name": "Vlan12" + } + ] + }, + "sonic-vlan:VLAN_MEMBER": { + "VLAN_MEMBER_LIST": [ + { + "port": "Ethernet12", + "tagging_mode": "tagged", + "name": "Vlan12" + } + ] + }, + "sonic-vlan:VLAN_INTERFACE": { + "VLAN_INTERFACE_LIST": [ + { + "name": "Vlan12" + } + ] + } + }, + + "sonic-mclag:sonic-mclag": { + "sonic-mclag:MCLAG_UNIQUE_IP": { + "MCLAG_UNIQUE_IP_LIST": [ + { + "if_name" : "Vlan12", + "unique_ip": "enable" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/mirror_session.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/mirror_session.json new file mode 100644 index 000000000000..5e820b5f5fdf --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/mirror_session.json @@ -0,0 +1,593 @@ +{ + "MIRROR_ERSPAN_ENTRY_WITH_VALID_HEX_VALUES": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "0x1234", + "dscp": "10" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_WITH_VALID_HEX_VALUES_1": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "0x0", + "dscp": "10" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_WITH_VALID_DEC_VALUES": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "1234", + "dscp": "10" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_WITH_VALID_DEC_VALUES_1": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "65535", + "dscp": "10" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_WITH_VALID_DEC_VALUES_2": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "0", + "dscp": "10" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_WRONG_TYPE": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "Invalid", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "0x1234", + "dscp": "10" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_WRONG_DST_IP": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "ERSPAN", + "dst_ip": "1001::1", + "src_ip": "10.1.1.1", + "gre_type": "0x1234", + "dscp": "10" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_WRONG_DST_IP_TYPE": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "SPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "0x1234", + "dscp": "10" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_WRONG_SRC_IP": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "1001::1", + "gre_type": "0x1234", + "dscp": "10" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_WRONG_SRC_IP_TYPE": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "SPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "0x1234", + "dscp": "10" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_WRONG_GRE_TYPE": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "100000", + "dscp": "10" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_WRONG_GRE_TYPE_1": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "-1", + "dscp": "10" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_WRONG_GRE_TYPE_2": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "65536", + "dscp": "10" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_GRE_WRONG_TYPE": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "SPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "0x1234", + "dscp": "10" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_WRONG_DSCP": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "0x1234", + "dscp": "64" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_WRONG_DSCP_TYPE": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "SPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "0x1234", + "dscp": "63" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_WRONG_TTL": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "0x1234", + "dscp": "10", + "ttl": "65" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_WRONG_TTL_TYPE": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "SPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "0x1234", + "dscp": "10", + "ttl": "63" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_VALID_SRC_PORT": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "1", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "0x1234", + "dscp": "10", + "ttl": "63", + "src_port": [ + "Ethernet0" + ] + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_VALID_SRC_PORTCHANNEL": { + "sonic-portchannel:sonic-portchannel": { + "sonic-portchannel:PORTCHANNEL": { + "PORTCHANNEL_LIST": [ + { + "admin_status": "up", + "name": "PortChannel5" + } + ] + } + }, + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "0x1234", + "dscp": "10", + "ttl": "63", + "src_port": [ + "PortChannel5" + ] + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_INVALID_SRC_PORT": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "0x1234", + "dscp": "10", + "ttl": "63", + "src_port": [ + "Ethernet0" + ] + } + ] + } + } + }, + "MIRROR_SPAN_ENTRY_WITH_VALID_VALUES": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "1", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + }, + { + "admin_status": "up", + "alias": "eth1", + "description": "Ethernet4", + "lanes": "1", + "mtu": 9000, + "name": "Ethernet4", + "speed": 25000 + }, + { + "admin_status": "up", + "alias": "eth1", + "description": "Ethernet8", + "lanes": "1", + "mtu": 9000, + "name": "Ethernet8", + "speed": 25000 + } + ] + } + }, + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "span", + "type": "SPAN", + "dst_port": "Ethernet0", + "src_port": [ + "Ethernet4", + "Ethernet8" + ], + "direction": "RX" + } + ] + } + } + }, + "MIRROR_SPAN_ENTRY_INVALID_DST_PORT": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "span", + "type": "SPAN", + "dst_port": "Ethernet0" + } + ] + } + } + }, + "MIRROR_SPAN_ENTRY_INVALID_DST_PORT_TYPE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "1", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "span", + "type": "ERSPAN", + "dst_port": "Ethernet0" + } + ] + } + } + }, + "MIRROR_SPAN_ENTRY_VALID_DST_PORT_CPU": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "span", + "type": "SPAN", + "dst_port": "CPU" + } + ] + } + } + }, + "MIRROR_SPAN_ENTRY_INVALID_SRC_PORT": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "1", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "span", + "type": "SPAN", + "dst_port": "Ethernet0", + "src_port": [ + "Ethernet4" + ] + } + ] + } + } + }, + "MIRROR_SPAN_ENTRY_INVALID_DIRECTION": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "1", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "span", + "type": "SPAN", + "dst_port": "Ethernet0", + "direction":"RXX" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_WITH_VALID_POLICER": { + "sonic-policer:sonic-policer": { + "sonic-policer:POLICER": { + "POLICER_LIST": [ + { + "name": "erspan_policer", + "meter_type":"packets", + "mode":"tr_tcm", + "color": "aware", + "cir":"5000", + "cbs":"5000", + "pir":"15000", + "pbs":"15000", + "red_packet_action":"drop" + } + ] + } + }, + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "0x1234", + "dscp": "10", + "policer": "erspan_policer" + } + ] + } + } + }, + "MIRROR_ERSPAN_ENTRY_WITH_INVALID_POLICER": { + "sonic-mirror-session:sonic-mirror-session": { + "MIRROR_SESSION": { + "MIRROR_SESSION_LIST": [ + { + "name": "erspan", + "type": "ERSPAN", + "dst_ip": "11.1.1.1", + "src_ip": "10.1.1.1", + "gre_type": "0x1234", + "dscp": "10", + "policer": "erspan_policer2" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/nvgre.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/nvgre.json new file mode 100644 index 000000000000..8c2588fa7d35 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/nvgre.json @@ -0,0 +1,125 @@ +{ + "NVGRE_TUNNEL_AND_TUNNEL_MAP": { + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "name": "Vlan200" + } + ] + } + }, + "sonic-nvgre-tunnel:sonic-nvgre-tunnel": { + "sonic-nvgre-tunnel:NVGRE_TUNNEL": { + "NVGRE_TUNNEL_LIST": [ + { + "tunnel_name": "tunnel_1", + "src_ip": "10.0.0.1" + } + ] + }, + "sonic-nvgre-tunnel:NVGRE_TUNNEL_MAP": { + "NVGRE_TUNNEL_MAP_LIST": [ + { + "tunnel_name": "tunnel_1", + "tunnel_map_name": "Vlan200", + "vlan_id": 200, + "vsid": 5000 + } + ] + } + } + }, + + "NVGRE_TUNNEL_INVALID_SRC_IP": { + "sonic-nvgre-tunnel:sonic-nvgre-tunnel": { + "sonic-nvgre-tunnel:NVGRE_TUNNEL": { + "NVGRE_TUNNEL_LIST": [ + { + "tunnel_name": "tunnel_1", + "src_ip": "INVALID" + } + ] + } + } + }, + + "NVGRE_TUNNEL_MAP_UNEXISTING_NVGRE_TUNNEL_NAME": { + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "name": "Vlan200" + } + ] + } + }, + "sonic-nvgre-tunnel:sonic-nvgre-tunnel": { + "sonic-nvgre-tunnel:NVGRE_TUNNEL_MAP": { + "NVGRE_TUNNEL_MAP_LIST": [ + { + "tunnel_name": "INVALID", + "tunnel_map_name": "Vlan200", + "vlan_id": 200, + "vsid": 5000 + } + ] + } + } + }, + + "NVGRE_TUNNEL_MAP_INVALID_VLAN_ID": { + "sonic-nvgre-tunnel:sonic-nvgre-tunnel": { + "sonic-nvgre-tunnel:NVGRE_TUNNEL": { + "NVGRE_TUNNEL_LIST": [ + { + "tunnel_name": "tunnel_1", + "src_ip": "10.0.0.1" + } + ] + }, + "sonic-nvgre-tunnel:NVGRE_TUNNEL_MAP": { + "NVGRE_TUNNEL_MAP_LIST": [ + { + "tunnel_name": "tunnel_1", + "tunnel_map_name": "Vlan200", + "vlan_id": 5000, + "vsid": 5000 + } + ] + } + } + }, + + "NVGRE_TUNNEL_MAP_INVALID_VSID": { + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "name": "Vlan200" + } + ] + } + }, + "sonic-nvgre-tunnel:sonic-nvgre-tunnel": { + "sonic-nvgre-tunnel:NVGRE_TUNNEL": { + "NVGRE_TUNNEL_LIST": [ + { + "tunnel_name": "tunnel_1", + "src_ip": "10.0.0.1" + } + ] + }, + "sonic-nvgre-tunnel:NVGRE_TUNNEL_MAP": { + "NVGRE_TUNNEL_MAP_LIST": [ + { + "tunnel_name": "tunnel_1", + "tunnel_map_name": "Vlan200", + "vlan_id": 200, + "vsid": 999999999 + } + ] + } + } + } +} \ No newline at end of file diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/pfc.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/pfc.json index 8c31d6dd98ed..f493701384e9 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/pfc.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/pfc.json @@ -105,36 +105,102 @@ } }, "PFC_WDOG_WITH_CORRECT_POLL_INTERVAL_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet4", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, "sonic-pfcwd:sonic-pfcwd": { "sonic-pfcwd:PFC_WD": { "PFC_WD_LIST": [ { "ifname": "GLOBAL", "POLL_INTERVAL": 101 + }, + { + "ifname": "Ethernet4", + "action": "drop", + "detection_time": 101, + "restoration_time": 3000 } ] } } }, "PFC_WDOG_WITH_WRONG_POLL_INTERVAL_LOW_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet4", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, "sonic-pfcwd:sonic-pfcwd": { "sonic-pfcwd:PFC_WD": { "PFC_WD_LIST": [ { "ifname": "GLOBAL", "POLL_INTERVAL":99 + }, + { + "ifname": "Ethernet4", + "action": "drop", + "detection_time": 100, + "restoration_time": 3000 } ] } } }, "PFC_WDOG_WITH_WRONG_POLL_INTERVAL_HIGH_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet4", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, "sonic-pfcwd:sonic-pfcwd": { "sonic-pfcwd:PFC_WD": { "PFC_WD_LIST": [ { "ifname": "GLOBAL", "POLL_INTERVAL": 3001 + }, + { + "ifname": "Ethernet4", + "action": "drop", + "detection_time": 3001, + "restoration_time": 3001 } ] } @@ -160,7 +226,7 @@ "PFC_WD_LIST": [ { "ifname": "Ethernet4", - "action": "wrong", + "action": "drop", "detection_time": 5001, "restoration_time": 3000 } @@ -168,6 +234,40 @@ } } }, + "PFC_WDOG_WITH_INVALID_DETECTION_TIME": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet4", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-pfcwd:sonic-pfcwd": { + "sonic-pfcwd:PFC_WD": { + "PFC_WD_LIST": [ + { + "ifname": "GLOBAL", + "POLL_INTERVAL": 1000 + }, + { + "ifname": "Ethernet4", + "action": "drop", + "detection_time": 999, + "restoration_time": 1000 + } + ] + } + } + }, "PFC_WDOG_WITH_WRONG_RESTORATION_TIME_LOW_VALUE": { "sonic-pfcwd:sonic-pfcwd": { "sonic-pfcwd:PFC_WD": { @@ -188,12 +288,46 @@ "PFC_WD_LIST": [ { "ifname": "Ethernet4", - "action": "wrong", + "action": "drop", "detection_time": 60001, "restoration_time": 3000 } ] } } + }, + "PFC_WDOG_WITH_INVALID_RESTORATION_TIME": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet4", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-pfcwd:sonic-pfcwd": { + "sonic-pfcwd:PFC_WD": { + "PFC_WD_LIST": [ + { + "ifname": "GLOBAL", + "POLL_INTERVAL": 1000 + }, + { + "ifname": "Ethernet4", + "action": "drop", + "detection_time": 1000, + "restoration_time": 999 + } + ] + } + } } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/policer.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/policer.json new file mode 100644 index 000000000000..b952e970592f --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/policer.json @@ -0,0 +1,220 @@ +{ + "POLICER_TABLE": { + "sonic-policer:sonic-policer": { + "sonic-policer:POLICER": { + "POLICER_LIST": [{ + "name": "everflow_session1_policer", + "meter_type":"packets", + "mode":"tr_tcm", + "color": "aware", + "cir":"5000", + "cbs":"5000", + "pir":"15000", + "pbs":"15000", + "yellow_packet_action":"forward", + "green_packet_action":"forward" + }] + } + } + }, + + "POLICER_MANDATORY_MODE": { + "sonic-policer:sonic-policer": { + "sonic-policer:POLICER": { + "POLICER_LIST": [{ + "name": "everflow_session1_policer", + "meter_type":"packets", + "cir":"5000", + "cbs":"5000", + "red_packet_action":"drop" + }] + } + } + }, + + "POLICER_MANDATORY_METER_TYPE": { + "sonic-policer:sonic-policer": { + "sonic-policer:POLICER": { + "POLICER_LIST": [{ + "name": "everflow_session2_policer", + "mode":"sr_tcm", + "cir":"5000", + "cbs":"5000", + "red_packet_action":"drop" + }] + } + } + }, + + "POLICER_UNKNOWN_METER_TYPE": { + "sonic-policer:sonic-policer": { + "sonic-policer:POLICER": { + "POLICER_LIST": [{ + "name": "everflow_session4_policer", + "mode":"sr_tcm", + "meter_type":"bits", + "cir":"5000", + "cbs":"5000", + "red_packet_action":"drop" + }] + } + } + }, + + "POLICER_UNKNOWN_MODE": { + "sonic-policer:sonic-policer": { + "sonic-policer:POLICER": { + "POLICER_LIST": [{ + "name": "everflow_session5_policer", + "mode":"srtcm", + "meter_type":"bytes", + "cir":"5000", + "cbs":"5000", + "red_packet_action":"drop" + }] + } + } + }, + + "POLICER_UNKNOWN_ACTION": { + "sonic-policer:sonic-policer": { + "sonic-policer:POLICER": { + "POLICER_LIST": [{ + "name": "everflow_session6_policer", + "mode":"storm", + "meter_type":"bytes", + "cir":"5000", + "cbs":"5000", + "color":"aware", + "red_packet_action":"act" + }] + } + } + }, + + "POLICER_UNKNOWN_COLOR": { + "sonic-policer:sonic-policer": { + "sonic-policer:POLICER": { + "POLICER_LIST": [{ + "name": "everflow_session7_policer", + "mode":"sr_tcm", + "meter_type":"bytes", + "cir":"5000", + "cbs":"5000", + "red_packet_action":"drop", + "color":"yes" + }] + } + } + }, + + "POLICER_CBS_WITHOUT_CIR": { + "sonic-policer:sonic-policer": { + "sonic-policer:POLICER": { + "POLICER_LIST": [{ + "name": "p5", + "meter_type":"bytes", + "mode":"tr_tcm", + "cbs":"5000", + "pir":"4000", + "pbs":"4000", + "red_packet_action":"drop" + }] + } + } + }, + + "POLICER_CBS_LESS_THAN_CIR": { + "sonic-policer:sonic-policer": { + "sonic-policer:POLICER": { + "POLICER_LIST": [{ + "name": "policer5", + "meter_type":"bytes", + "mode":"sr_tcm", + "cbs":"5000", + "cir":"6000", + "red_packet_action":"drop" + }] + } + } + }, + + "POLICER_PIR_LESS_THAN_CIR": { + "sonic-policer:sonic-policer": { + "sonic-policer:POLICER": { + "POLICER_LIST": [{ + "name": "e3_policer", + "meter_type":"bytes", + "mode":"tr_tcm", + "cir":"5000", + "cbs":"5000", + "pir":"4000", + "pbs":"4000", + "red_packet_action":"drop" + }] + } + } + }, + + "POLICER_PBS_WITH_STORM": { + "sonic-policer:sonic-policer": { + "sonic-policer:POLICER": { + "POLICER_LIST": [{ + "name": "e1policer", + "meter_type":"bytes", + "mode":"storm", + "cir":"5000", + "cbs":"5000", + "pbs":"6000", + "red_packet_action":"drop" + }] + } + } + }, + + "POLICER_PBS_LESS_THAN_CBS": { + "sonic-policer:sonic-policer": { + "sonic-policer:POLICER": { + "POLICER_LIST": [{ + "name": "e2policer", + "meter_type":"bytes", + "mode":"tr_tcm", + "cir":"5000", + "cbs":"5000", + "pbs":"2000", + "red_packet_action":"drop" + }] + } + } + }, + + "POLICER_PIR_WITHOUT_CIR": { + "sonic-policer:sonic-policer": { + "sonic-policer:POLICER": { + "POLICER_LIST": [{ + "name": "e3policer", + "meter_type":"bytes", + "mode":"tr_tcm", + "pir":"2000", + "red_packet_action":"drop" + }] + } + } + }, + + "POLICER_WHEN_SRTCM_WITH_PIR": { + "sonic-policer:sonic-policer": { + "sonic-policer:POLICER": { + "POLICER_LIST": [{ + "name": "policer1", + "meter_type":"packets", + "mode":"sr_tcm", + "cir":"6000", + "cbs":"6000", + "pir":"6000", + "red_packet_action":"drop" + }] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json index 7423ecd6d419..e1549261cb92 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json @@ -275,5 +275,115 @@ ] } } + }, + + "PORT_VALID_MUX_CABLE_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 50000, + "mux_cable": "true" + }, + { + "name": "Ethernet12", + "alias": "eth12", + "lanes": "6", + "speed": 50000, + "mux_cable": "false" + } + ] + } + } + }, + + "PORT_INVALID_MUX_CABLE_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 50000, + "mux_cable": "enabled" + } + ] + } + } + }, + + "PORT_VALID_MULTIASIC_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 50000, + "index": "0", + "asic_port_name": "Eth8-ASIC1", + "role": "Ext" + }, + { + "name": "Ethernet9", + "alias": "eth9", + "lanes": "66", + "speed": 50000, + "index": "1", + "asic_port_name": "Eth9-ASIC1" + }, + { + "name": "Ethernet10", + "alias": "eth10", + "lanes": "67", + "speed": 50000, + "index": "2", + "asic_port_name": "Eth10-ASIC1", + "role": "Int" + }, + { + "name": "Ethernet11", + "alias": "eth11", + "lanes": "68", + "speed": 50000, + "index": "3", + "asic_port_name": "Eth11-ASIC1", + "role": "Inb" + }, + { + "name": "Ethernet12", + "alias": "eth12", + "lanes": "69", + "speed": 50000, + "index": "4", + "asic_port_name": "Eth12-ASIC1", + "role": "Rec" + } + ] + } + } + }, + + "PORT_INVALID_MULTIASIC_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 50000, + "index": "0", + "asic_port_name": "Eth8-ASIC1", + "role": "Invalid" + } + ] + } + } } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/qos.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/qos.json new file mode 100644 index 000000000000..67775b11db81 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/qos.json @@ -0,0 +1,515 @@ +{ + "SCHEDULER_VALID": { + "sonic-scheduler:sonic-scheduler":{ + "sonic-scheduler:SCHEDULER": { + "SCHEDULER_LIST": [ + { + "name":"Test@0", + "cbs": 256, + "cir": 1250000, + "meter_type": "bytes", + "pbs": 1024, + "pir": 25000000, + "type": "DWRR", + "weight": 10 + }, + { + "name":"Test@1", + "cbs": 1024, + "cir": 1280000, + "meter_type": "bytes", + "pbs": 2048, + "pir": 2560000, + "type": "STRICT", + "priority": 0 + }, + { + "name":"Test@2", + "cbs": 256, + "cir": 1250000, + "meter_type": "bytes", + "pbs": 1024, + "pir": 25000000, + "type": "WRR", + "weight": 20 + } + ] + } + } + }, + + "SCHEDULER_UNDEFINED_TYPE": { + "sonic-scheduler:sonic-scheduler":{ + "sonic-scheduler:SCHEDULER": { + "SCHEDULER_LIST": [ + { + "name":"Test@0", + "type": "invalid" + } + ] + } + } + }, + + "SCHEDULER_INVALID_WEIGHT": { + "sonic-scheduler:sonic-scheduler":{ + "sonic-scheduler:SCHEDULER": { + "SCHEDULER_LIST": [ + { + "name":"Test@0", + "weight": 120 + } + ] + } + } + }, + + "SCHEDULER_INVALID_METER_TYPE": { + "sonic-scheduler:sonic-scheduler":{ + "sonic-scheduler:SCHEDULER": { + "SCHEDULER_LIST": [ + { + "name":"Test@0", + "meter_type": "invalid" + } + ] + } + } + }, + + "SCHEDULER_CBS_NO_CIR": { + "sonic-scheduler:sonic-scheduler":{ + "sonic-scheduler:SCHEDULER": { + "SCHEDULER_LIST": [ + { + "name":"Test@0", + "cbs": 1024 + } + ] + } + } + }, + + "SCHEDULER_PIR_NO_CIR": { + "sonic-scheduler:sonic-scheduler":{ + "sonic-scheduler:SCHEDULER": { + "SCHEDULER_LIST": [ + { + "name":"Test@0", + "pir": 1024 + } + ] + } + } + }, + + "SCHEDULER_PIR_VS_CIR": { + "sonic-scheduler:sonic-scheduler":{ + "sonic-scheduler:SCHEDULER": { + "SCHEDULER_LIST": [ + { + "name":"Test@0", + "cir": 2048, + "pir": 1024 + } + ] + } + } + }, + + "SCHEDULER_VALID_NAME": { + "sonic-scheduler:sonic-scheduler":{ + "sonic-scheduler:SCHEDULER": { + "SCHEDULER_LIST": [ + { + "name":"scheduler.0", + "cbs": 256, + "cir": 1250000, + "meter_type": "bytes", + "pbs": 1024, + "pir": 25000000, + "type": "DWRR", + "weight": 10 + }, + { + "name":"scheduler.1", + "cbs": 1024, + "cir": 1280000, + "meter_type": "bytes", + "pbs": 2048, + "pir": 2560000, + "type": "STRICT", + "priority": 0 + }, + { + "name":"scheduler.2", + "cbs": 256, + "cir": 1250000, + "meter_type": "bytes", + "pbs": 1024, + "pir": 25000000, + "type": "WRR", + "weight": 20 + } + ] + } + } + }, + + "WRED_PROFILE_EMPTY": { + "sonic-wred-profile:sonic-wred-profile":{ + "sonic-wred-profile:WRED_PROFILE": { + "WRED_PROFILE_LIST": [ + { + "name":"Wred1" + } + ] + } + } + }, + + "WRED_PROFILE_VALID": { + "sonic-wred-profile:sonic-wred-profile":{ + "sonic-wred-profile:WRED_PROFILE": { + "WRED_PROFILE_LIST": [ + { + "name":"Wred2", + "yellow_min_threshold": 2048, + "green_min_threshold": 4096, + "red_min_threshold": 1024, + "yellow_max_threshold": 4096, + "green_max_threshold": 8192, + "red_max_threshold": 2048, + "ecn": "ecn_none", + "wred_green_enable": true, + "wred_yellow_enable": true, + "wred_red_enable": true, + "yellow_drop_probability": 50, + "green_drop_probability": 25, + "red_drop_probability": 100 + }, + { + "name":"Wred3", + "yellow_min_threshold": 2048, + "green_min_threshold": 4096, + "red_min_threshold": 1024, + "yellow_max_threshold": 4096, + "green_max_threshold": 8192, + "red_max_threshold": 2048, + "ecn": "ecn_all", + "wred_green_enable": true, + "wred_yellow_enable": true, + "wred_red_enable": true, + "yellow_drop_probability": 50, + "green_drop_probability": 25, + "red_drop_probability": 100 + }, + { + "name":"Wred4", + "green_min_threshold": 4096, + "green_max_threshold": 8192, + "ecn": "ecn_all", + "wred_green_enable": true + } + ] + } + } + }, + + "WRED_PROFILE_INVALID_DROP_PROBABILITY": { + "sonic-wred-profile:sonic-wred-profile": { + "sonic-wred-profile:WRED_PROFILE": { + "WRED_PROFILE_LIST": [ + { + "name":"Wred4", + "red_min_threshold": 1024, + "red_max_threshold": 2048, + "wred_red_enable": true, + "red_drop_probability": 125, + "green_drop_probability": 25, + "yellow_drop_probability": 25, + "ecn": "ecn_all" + } + ] + } + } + }, + + "WRED_PROFILE_INVALID_GREEN_THRESHOLD": { + "sonic-wred-profile:sonic-wred-profile": { + "sonic-wred-profile:WRED_PROFILE": { + "WRED_PROFILE_LIST": [ + { + "name":"Wred4", + "green_min_threshold": 4096, + "green_max_threshold": 2048, + "wred_green_enable": true, + "green_drop_probability": 25, + "ecn": "ecn_all" + } + ] + } + } + }, + + "WRED_PROFILE_INVALID_YELLOW_THRESHOLD": { + "sonic-wred-profile:sonic-wred-profile": { + "sonic-wred-profile:WRED_PROFILE": { + "WRED_PROFILE_LIST": [ + { + "name":"Wred4", + "yellow_min_threshold": 4096, + "yellow_max_threshold": 2048, + "wred_yellow_enable": true, + "yellow_drop_probability": 25, + "ecn": "ecn_all" + } + ] + } + } + }, + + "WRED_PROFILE_INVALID_RED_THRESHOLD": { + "sonic-wred-profile:sonic-wred-profile": { + "sonic-wred-profile:WRED_PROFILE": { + "WRED_PROFILE_LIST": [ + { + "name":"Wred4", + "red_min_threshold": 4096, + "red_max_threshold": 2048, + "wred_red_enable": true, + "red_drop_probability": 25, + "ecn": "ecn_all" + } + ] + } + } + }, + + + "QUEUE_VALID": { + "sonic-scheduler:sonic-scheduler":{ + "sonic-scheduler:SCHEDULER": { + "SCHEDULER_LIST": [ + { + "name":"Test@0", + "cbs": 256, + "cir": 1250000, + "meter_type": "bytes", + "pbs": 1024, + "pir": 25000000, + "type": "DWRR", + "weight": 10 + } + ] + } + }, + "sonic-wred-profile:sonic-wred-profile":{ + "sonic-wred-profile:WRED_PROFILE": { + "WRED_PROFILE_LIST": [ + { + "name":"Wred1", + "yellow_min_threshold": 2048, + "green_min_threshold": 4096, + "red_min_threshold": 1024, + "yellow_max_threshold": 4096, + "green_max_threshold": 8192, + "red_max_threshold": 2048, + "ecn": "ecn_none", + "wred_green_enable": true, + "wred_yellow_enable": true, + "wred_red_enable": true, + "yellow_drop_probability": 50, + "green_drop_probability": 25, + "red_drop_probability": 100 + } + ] + } + }, + + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth8", + "description": "Ethernet0", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + + "sonic-queue:sonic-queue": { + "sonic-queue:QUEUE": { + "QUEUE_LIST": [ + { + "ifname": "Ethernet0", + "qindex": "0", + "scheduler": "Test@0", + "wred_profile": "Wred1" + } + ] + } + } + }, + + "QUEUE_PORT_NOT_EXIST": { + "sonic-scheduler:sonic-scheduler":{ + "sonic-scheduler:SCHEDULER": { + "SCHEDULER_LIST": [ + { + "name":"Test@0", + "cbs": 256, + "cir": 1250000, + "meter_type": "bytes", + "pbs": 1024, + "pir": 25000000, + "type": "DWRR", + "weight": 10 + } + ] + } + }, + "sonic-wred-profile:sonic-wred-profile":{ + "sonic-wred-profile:WRED_PROFILE": { + "WRED_PROFILE_LIST": [ + { + "name":"Wred1", + "yellow_min_threshold": 2048, + "green_min_threshold": 4096, + "red_min_threshold": 1024, + "yellow_max_threshold": 4096, + "green_max_threshold": 8192, + "red_max_threshold": 2048, + "ecn": "ecn_none", + "wred_green_enable": true, + "wred_yellow_enable": true, + "wred_red_enable": true, + "yellow_drop_probability": 50, + "green_drop_probability": 25, + "red_drop_probability": 100 + } + ] + } + }, + + "sonic-queue:sonic-queue": { + "sonic-queue:QUEUE": { + "QUEUE_LIST": [ + { + "ifname": "Ethernet0", + "qindex": "0", + "scheduler": "Test@0", + "wred_profile": "Wred1" + } + ] + } + } + }, + + "QUEUE_SCHEDULER_NOT_EXIST": { + "sonic-wred-profile:sonic-wred-profile":{ + "sonic-wred-profile:WRED_PROFILE": { + "WRED_PROFILE_LIST": [ + { + "name":"Wred1", + "yellow_min_threshold": 2048, + "green_min_threshold": 4096, + "red_min_threshold": 1024, + "yellow_max_threshold": 4096, + "green_max_threshold": 8192, + "red_max_threshold": 2048, + "ecn": "ecn_none", + "wred_green_enable": true, + "wred_yellow_enable": true, + "wred_red_enable": true, + "yellow_drop_probability": 50, + "green_drop_probability": 25, + "red_drop_probability": 100 + } + ] + } + }, + + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth8", + "description": "Ethernet4", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet4", + "speed": 25000 + } + ] + } + }, + + "sonic-queue:sonic-queue": { + "sonic-queue:QUEUE": { + "QUEUE_LIST": [ + { + "ifname": "Ethernet4", + "qindex": "0", + "scheduler": "Test@0", + "wred_profile": "Wred1" + } + ] + } + } + }, + + "QUEUE_WRED_NOT_EXIST": { + "sonic-scheduler:sonic-scheduler":{ + "sonic-scheduler:SCHEDULER": { + "SCHEDULER_LIST": [ + { + "name":"Test@0", + "cbs": 256, + "cir": 1250000, + "meter_type": "bytes", + "pbs": 1024, + "pir": 25000000, + "type": "DWRR", + "weight": 10 + } + ] + } + }, + + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth8", + "description": "Ethernet8", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet8", + "speed": 25000 + } + ] + } + }, + + "sonic-queue:sonic-queue": { + "sonic-queue:QUEUE": { + "QUEUE_LIST": [ + { + "ifname": "Ethernet8", + "qindex": "0", + "scheduler": "Test@0", + "wred_profile": "Wred1" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/qosmaps.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/qosmaps.json new file mode 100644 index 000000000000..991675bc3979 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/qosmaps.json @@ -0,0 +1,727 @@ +{ + "DSCP_TO_TC_MAP_CRETAE": { + "sonic-dscp-tc-map:sonic-dscp-tc-map": { + "sonic-dscp-tc-map:DSCP_TO_TC_MAP": { + "DSCP_TO_TC_MAP_LIST": [ + { + "name": "map1", + "DSCP_TO_TC_MAP": [ + { + "dscp": "1", + "tc": "1" + }, + { + "dscp":"2", + "tc":"2" + } + ] + }, + { + "name": "map2", + "DSCP_TO_TC_MAP": [ + { + "dscp": "1", + "tc": "1" + }, + { + "dscp":"2", + "tc":"2" + } + ] + } + ] + } + } + }, + + "DSCP_TO_TC_MAP_CREATE_INVALID_DSCP": { + "sonic-dscp-tc-map:sonic-dscp-tc-map": { + "sonic-dscp-tc-map:DSCP_TO_TC_MAP": { + "DSCP_TO_TC_MAP_LIST": [ + { + "name": "map3", + "DSCP_TO_TC_MAP": [ + { + "dscp": "64", + "tc": "1" + }, + { + "dscp":"2", + "tc":"2" + } + ] + } + ] + } + } + }, + + "DSCP_TO_TC_MAP_CREATE_INVALID_TC": { + "sonic-dscp-tc-map:sonic-dscp-tc-map": { + "sonic-dscp-tc-map:DSCP_TO_TC_MAP": { + "DSCP_TO_TC_MAP_LIST": [ + { + "name": "map3", + "DSCP_TO_TC_MAP": [ + { + "dscp": "1", + "tc": "8" + }, + { + "dscp":"2", + "tc":"2" + } + ] + } + ] + } + } + }, + + "DOT1P_TO_TC_MAP_CRETAE": { + "sonic-dot1p-tc-map:sonic-dot1p-tc-map": { + "sonic-dot1p-tc-map:DOT1P_TO_TC_MAP": { + "DOT1P_TO_TC_MAP_LIST": [ + { + "name": "map1", + "DOT1P_TO_TC_MAP": [ + { + "dot1p": "1", + "tc": "1" + }, + { + "dot1p":"2", + "tc":"2" + } + ] + }, + { + "name": "map2", + "DOT1P_TO_TC_MAP": [ + { + "dot1p": "1", + "tc": "1" + }, + { + "dot1p":"2", + "tc":"2" + } + ] + } + ] + } + } + }, + + "DOT1P_TO_TC_MAP_CREATE_INVALID_DOT1P": { + "sonic-dot1p-tc-map:sonic-dot1p-tc-map": { + "sonic-dot1p-tc-map:DOT1P_TO_TC_MAP": { + "DOT1P_TO_TC_MAP_LIST": [ + { + "name": "map3", + "DOT1P_TO_TC_MAP": [ + { + "dot1p": "64", + "tc": "1" + }, + { + "dot1p":"2", + "tc":"2" + } + ] + } + ] + } + } + }, + + "DOT1P_TO_TC_MAP_CREATE_INVALID_TC": { + "sonic-dot1p-tc-map:sonic-dot1p-tc-map": { + "sonic-dot1p-tc-map:DOT1P_TO_TC_MAP": { + "DOT1P_TO_TC_MAP_LIST": [ + { + "name": "map3", + "DOT1P_TO_TC_MAP": [ + { + "dot1p": "1", + "tc": "8" + }, + { + "dot1p":"2", + "tc":"2" + } + ] + } + ] + } + } + }, + + "TC_TO_QUEUE_MAP_CRETAE": { + "sonic-tc-queue-map:sonic-tc-queue-map": { + "sonic-tc-queue-map:TC_TO_QUEUE_MAP": { + "TC_TO_QUEUE_MAP_LIST": [ + { + "name": "map1", + "TC_TO_QUEUE_MAP": [ + { + "tc": "1", + "qindex": "1" + }, + { + "tc":"2", + "qindex":"2" + } + ] + }, + { + "name": "map2", + "TC_TO_QUEUE_MAP": [ + { + "tc": "1", + "qindex": "1" + }, + { + "tc":"2", + "qindex":"2" + } + ] + } + ] + } + } + }, + + "TC_TO_QUEUE_MAP_CREATE_INVALID_TC": { + "sonic-tc-queue-map:sonic-tc-queue-map": { + "sonic-tc-queue-map:TC_TO_QUEUE_MAP": { + "TC_TO_QUEUE_MAP_LIST": [ + { + "name": "map3", + "TC_TO_QUEUE_MAP": [ + { + "tc": "64", + "qindex": "1" + }, + { + "tc":"2", + "qindex":"2" + } + ] + } + ] + } + } + }, + + "TC_TO_QUEUE_MAP_CREATE_INVALID_QUEUE": { + "sonic-tc-queue-map:sonic-tc-queue-map": { + "sonic-tc-queue-map:TC_TO_QUEUE_MAP": { + "TC_TO_QUEUE_MAP_LIST": [ + { + "name": "map3", + "TC_TO_QUEUE_MAP": [ + { + "tc": "1", + "qindex": "8" + }, + { + "tc":"2", + "qindex":"2" + } + ] + } + ] + } + } + }, + + "TC_TO_PRIORITY_GROUP_MAP_CRETAE": { + "sonic-tc-priority-group-map:sonic-tc-priority-group-map": { + "sonic-tc-priority-group-map:TC_TO_PRIORITY_GROUP_MAP": { + "TC_TO_PRIORITY_GROUP_MAP_LIST": [ + { + "name": "map1", + "TC_TO_PRIORITY_GROUP_MAP": [ + { + "tc": "1", + "pg": "1" + }, + { + "tc":"2", + "pg":"2" + } + ] + }, + { + "name": "map2", + "TC_TO_PRIORITY_GROUP_MAP": [ + { + "tc": "1", + "pg": "1" + }, + { + "tc":"2", + "pg":"2" + } + ] + } + ] + } + } + }, + + "TC_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_TC": { + "sonic-tc-priority-group-map:sonic-tc-priority-group-map": { + "sonic-tc-priority-group-map:TC_TO_PRIORITY_GROUP_MAP": { + "TC_TO_PRIORITY_GROUP_MAP_LIST": [ + { + "name": "map3", + "TC_TO_PRIORITY_GROUP_MAP": [ + { + "tc": "64", + "pg": "1" + }, + { + "tc":"2", + "pg":"2" + } + ] + } + ] + } + } + }, + + "TC_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_PRIORITY_GROUP": { + "sonic-tc-priority-group-map:sonic-tc-priority-group-map": { + "sonic-tc-priority-group-map:TC_TO_PRIORITY_GROUP_MAP": { + "TC_TO_PRIORITY_GROUP_MAP_LIST": [ + { + "name": "map3", + "TC_TO_PRIORITY_GROUP_MAP": [ + { + "tc": "1", + "pg": "8" + }, + { + "tc":"2", + "pg":"2" + } + ] + } + ] + } + } + }, + + "PFC_PRIORITY_TO_QUEUE_MAP_CRETAE": { + "sonic-pfc-priority-queue-map:sonic-pfc-priority-queue-map": { + "sonic-pfc-priority-queue-map:MAP_PFC_PRIORITY_TO_QUEUE": { + "MAP_PFC_PRIORITY_TO_QUEUE_LIST": [ + { + "name": "map1", + "MAP_PFC_PRIORITY_TO_QUEUE": [ + { + "pfc_priority": "1", + "qindex": "1" + }, + { + "pfc_priority":"2", + "qindex":"2" + } + ] + }, + { + "name": "map2", + "MAP_PFC_PRIORITY_TO_QUEUE": [ + { + "pfc_priority": "1", + "qindex": "1" + }, + { + "pfc_priority":"2", + "qindex":"2" + } + ] + } + ] + } + } + }, + + "PFC_PRIORITY_TO_QUEUE_MAP_CREATE_INVALID_PFC_PRIORITY": { + "sonic-pfc-priority-queue-map:sonic-pfc-priority-queue-map": { + "sonic-pfc-priority-queue-map:MAP_PFC_PRIORITY_TO_QUEUE": { + "MAP_PFC_PRIORITY_TO_QUEUE_LIST": [ + { + "name": "map3", + "MAP_PFC_PRIORITY_TO_QUEUE": [ + { + "pfc_priority": "64", + "qindex": "1" + }, + { + "pfc_priority":"2", + "qindex":"2" + } + ] + } + ] + } + } + }, + + "PFC_PRIORITY_TO_QUEUE_MAP_CREATE_INVALID_QUEUE": { + "sonic-pfc-priority-queue-map:sonic-pfc-priority-queue-map": { + "sonic-pfc-priority-queue-map:MAP_PFC_PRIORITY_TO_QUEUE": { + "MAP_PFC_PRIORITY_TO_QUEUE_LIST": [ + { + "name": "map3", + "MAP_PFC_PRIORITY_TO_QUEUE": [ + { + "pfc_priority": "1", + "qindex": "8" + }, + { + "pfc_priority":"2", + "qindex":"2" + } + ] + } + ] + } + } + }, + + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_CRETAE": { + "sonic-pfc-priority-priority-group-map:sonic-pfc-priority-priority-group-map": { + "sonic-pfc-priority-priority-group-map:PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST": [ + { + "name": "map1", + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": [ + { + "pfc_priority": "1", + "pg": "1" + }, + { + "pfc_priority":"2", + "pg":"2" + } + ] + }, + { + "name": "map2", + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": [ + { + "pfc_priority": "1", + "pg": "1" + }, + { + "pfc_priority":"2", + "pg":"2" + } + ] + } + ] + } + } + }, + + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_PFC_PRIORITY": { + "sonic-pfc-priority-priority-group-map:sonic-pfc-priority-priority-group-map": { + "sonic-pfc-priority-priority-group-map:PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST": [ + { + "name": "map3", + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": [ + { + "pfc_priority": "64", + "pg": "1" + }, + { + "pfc_priority":"2", + "pg":"2" + } + ] + } + ] + } + } + }, + + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_PRIORITY_GROUP": { + "sonic-pfc-priority-priority-group-map:sonic-pfc-priority-priority-group-map": { + "sonic-pfc-priority-priority-group-map:PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST": [ + { + "name": "map3", + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": [ + { + "pfc_priority": "1", + "pg": "8" + }, + { + "pfc_priority":"2", + "pg":"2" + } + ] + } + ] + } + } + }, + + "PORT_QOS_MAP_APPLY_MAPS": { + "sonic-dscp-tc-map:sonic-dscp-tc-map": { + "sonic-dscp-tc-map:DSCP_TO_TC_MAP": { + "DSCP_TO_TC_MAP_LIST": [ + { + "name": "map1", + "DSCP_TO_TC_MAP": [ + { + "dscp": "1", + "tc": "1" + }, + { + "dscp":"2", + "tc":"2" + } + ] + } + ] + } + }, + + "sonic-dot1p-tc-map:sonic-dot1p-tc-map": { + "sonic-dot1p-tc-map:DOT1P_TO_TC_MAP": { + "DOT1P_TO_TC_MAP_LIST": [ + { + "name": "map1", + "DOT1P_TO_TC_MAP": [ + { + "dot1p": "1", + "tc": "1" + }, + { + "dot1p":"2", + "tc":"2" + } + ] + } + ] + } + }, + + "sonic-tc-queue-map:sonic-tc-queue-map": { + "sonic-tc-queue-map:TC_TO_QUEUE_MAP": { + "TC_TO_QUEUE_MAP_LIST": [ + { + "name": "map1", + "TC_TO_QUEUE_MAP": [ + { + "tc": "1", + "qindex": "1" + }, + { + "tc":"2", + "qindex":"2" + } + ] + } + ] + } + }, + "sonic-tc-priority-group-map:sonic-tc-priority-group-map": { + "sonic-tc-priority-group-map:TC_TO_PRIORITY_GROUP_MAP": { + "TC_TO_PRIORITY_GROUP_MAP_LIST": [ + { + "name": "map1", + "TC_TO_PRIORITY_GROUP_MAP": [ + { + "tc": "1", + "pg": "1" + }, + { + "tc":"2", + "pg":"2" + } + ] + } + ] + } + }, + + "sonic-pfc-priority-queue-map:sonic-pfc-priority-queue-map": { + "sonic-pfc-priority-queue-map:MAP_PFC_PRIORITY_TO_QUEUE": { + "MAP_PFC_PRIORITY_TO_QUEUE_LIST": [ + { + "name": "map1", + "MAP_PFC_PRIORITY_TO_QUEUE": [ + { + "pfc_priority": "1", + "qindex": "1" + }, + { + "pfc_priority":"2", + "qindex":"2" + } + ] + } + ] + } + }, + + "sonic-pfc-priority-priority-group-map:sonic-pfc-priority-priority-group-map": { + "sonic-pfc-priority-priority-group-map:PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST": [ + { + "name": "map1", + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": [ + { + "pfc_priority": "1", + "pg": "1" + }, + { + "pfc_priority":"2", + "pg":"2" + } + ] + } + ] + } + }, + + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet0", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-port-qos-map:sonic-port-qos-map": { + "sonic-port-qos-map:PORT_QOS_MAP": { + "PORT_QOS_MAP_LIST": [ + { + "ifname": "Ethernet0", + "dscp_to_tc_map": "map1", + "tc_to_pg_map": "map1", + "tc_to_queue_map": "map1", + "pfc_to_queue_map": "map1", + "pfc_to_pg_map": "map1", + "dscp_to_tc_map": "map1", + "dot1p_to_tc_map": "map1", + "pfc_enable": "3,4", + "pfcwd_sw_enable" : "3,4" + } + ] + } + } + }, + + "PORT_QOS_MAP_APPLY_NON_EXISTS_MAPS": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet0", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-port-qos-map:sonic-port-qos-map": { + "sonic-port-qos-map:PORT_QOS_MAP": { + "PORT_QOS_MAP_LIST": [ + { + "ifname": "Ethernet0", + "dscp_to_tc_map": "map2", + "tc_to_pg_map": "map2", + "tc_to_queue_map": "map2", + "pfc_to_queue_map": "map2", + "pfc_to_pg_map": "map2", + "dscp_to_tc_map": "map2", + "dot1p_to_tc_map": "map2", + "pfc_enable": "3,4", + "pfcwd_sw_enable" : "3,4" + } + ] + } + } + }, + + "PORT_QOS_MAP_APPLY_NON_EXISTS_PORT": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet4", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-port-qos-map:sonic-port-qos-map": { + "sonic-port-qos-map:PORT_QOS_MAP": { + "PORT_QOS_MAP_LIST": [ + { + "ifname": "Ethernet0" + } + ] + } + } + }, + + "PORT_QOS_MAP_APPLY_INVALID_PFC": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet4", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-port-qos-map:sonic-port-qos-map": { + "sonic-port-qos-map:PORT_QOS_MAP": { + "PORT_QOS_MAP_LIST": [ + { + "ifname": "Ethernet4", + "pfc_enable": "8", + "pfcwd_sw_enable" : "8" + } + ] + } + } + } + +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/storm_control.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/storm_control.json new file mode 100644 index 000000000000..d5c56249e484 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/storm_control.json @@ -0,0 +1,170 @@ +{ + "STORM_BROADCAST_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-storm-control:sonic-storm-control": { + "sonic-storm-control:PORT_STORM_CONTROL": { + "sonic-storm-control:PORT_STORM_CONTROL_LIST": [ + { + "ifname": "Ethernet0", + "storm_type": "broadcast", + "kbps": "100000" + } + ] + } + } + }, + "STORM_UUCAST_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-storm-control:sonic-storm-control": { + "sonic-storm-control:PORT_STORM_CONTROL": { + "sonic-storm-control:PORT_STORM_CONTROL_LIST": [ + { + "ifname": "Ethernet0", + "storm_type": "unknown-unicast", + "kbps": "200000" + } + ] + } + } + }, + "STORM_UMCAST_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-storm-control:sonic-storm-control": { + "sonic-storm-control:PORT_STORM_CONTROL": { + "sonic-storm-control:PORT_STORM_CONTROL_LIST": [ + { + "ifname": "Ethernet0", + "storm_type": "unknown-multicast", + "kbps": "300000" + } + ] + } + } + }, + "STORM_INVALID_STORM_TYPE_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-storm-control:sonic-storm-control": { + "sonic-storm-control:PORT_STORM_CONTROL": { + "sonic-storm-control:PORT_STORM_CONTROL_LIST": [ + { + "ifname": "Ethernet0", + "storm_type": "xyz", + "kbps": "400000" + } + ] + } + } + }, + "STORM_BROADCAST_INVALID_KBPS": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-storm-control:sonic-storm-control": { + "sonic-storm-control:PORT_STORM_CONTROL": { + "sonic-storm-control:PORT_STORM_CONTROL_LIST": [ + { + "ifname": "Ethernet0", + "storm_type": "broadcast", + "kbps": "xyz-kbps-value" + } + ] + } + } + }, + "STORM_BROADCAST_INVALID_INTERFACE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-storm-control:sonic-storm-control": { + "sonic-storm-control:PORT_STORM_CONTROL": { + "sonic-storm-control:PORT_STORM_CONTROL_LIST": [ + { + "ifname": "Eth", + "storm_type": "broadcast", + "kbps": "500000" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/syslog.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/syslog.json new file mode 100644 index 000000000000..ed153c0d6cb3 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/syslog.json @@ -0,0 +1,52 @@ +{ + "SYSLOG_SERVER_TEST": { + "sonic-syslog:sonic-syslog": { + "sonic-syslog:SYSLOG_SERVER": { + "SYSLOG_SERVER_LIST": [ + { + "server_address": "1111::22" + }, + { + "server_address": "20.1.1.1" + }, + { + "server_address" : "1001:0ab8:0001:0000:0000:0abc:d012:0102" + } + ] + } + } + }, + "SYSLOG_SERVER_1_NEG_TEST": { + "sonic-syslog:sonic-syslog": { + "sonic-syslog:SYSLOG_SERVER": { + "SYSLOG_SERVER_LIST": [ + { + "server_address": "" + } + ] + } + } + }, + "SYSLOG_SERVER_INVALID_IPADDR_TEST" : { + "sonic-syslog:sonic-syslog": { + "sonic-syslog:SYSLOG_SERVER": { + "SYSLOG_SERVER_LIST": [ + { + "server_address": "1111.22.33.1" + } + ] + } + } + }, + "SYSLOG_SERVER_INVALID_IPV6_ADDR_TEST" : { + "sonic-syslog:sonic-syslog": { + "sonic-syslog:SYSLOG_SERVER": { + "SYSLOG_SERVER_LIST": [ + { + "server_address": "1111::22.33.1" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/vlan.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/vlan.json index 0faa3926b21e..2ae87a7b822e 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/vlan.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/vlan.json @@ -1,4 +1,33 @@ { + "VALID_VLAN": { + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "admin_status": "up", + "alias": "first_vlan", + "description": "server_vlan", + "dhcp_servers": [ + "10.186.72.56" + ], + "mtu": "9100", + "name": "Vlan100" + }, + { + "admin_status": "up", + "alias": "second_vlan", + "description": "server_vlan", + "dhcp_servers": [ + "10.186.72.66" + ], + "mtu": "9100", + "name": "Vlan200", + "mac": "00:aa:bb:cc:dd:ee" + } + ] + } + } + }, "INCORRECT_VLAN_NAME": { "sonic-vlan:sonic-vlan": { "sonic-vlan:VLAN": { @@ -33,6 +62,23 @@ } } }, + "DHCPV6_SERVER_INCORRECT_FORMAT": { + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "admin_status": "up", + "description": "v6server_vlan", + "dhcpv6_servers": [ + "2001:1:2" + ], + "mtu": "9216", + "name": "Vlan500" + } + ] + } + } + }, "TAGGING_MODE_WRONG_VALUE": { "sonic-port:sonic-port": { "sonic-port:PORT": { @@ -367,5 +413,206 @@ ] } } + }, + "DHCP_SERVER_VALID_FORMAT": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "mtu": 9000, + "lanes": "1", + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "admin_status": "up", + "description": "server_vlan", + "dhcp_servers": [ + "10.186.72.10" + ], + "mtu": "9216", + "name": "Vlan300" + } + ] + }, + "sonic-vlan:VLAN_MEMBER": { + "VLAN_MEMBER_LIST": [ + { + "port": "Ethernet0", + "tagging_mode": "tagged", + "name": "Vlan300" + } + ] + }, + "sonic-vlan:VLAN_INTERFACE": { + "VLAN_INTERFACE_IPPREFIX_LIST": [ + { + "family": "IPv4", + "ip-prefix": "20.0.0.1/24", + "scope": "global", + "name": "Vlan300" + } + ], + "VLAN_INTERFACE_LIST": [ + { + "name": "Vlan300" + } + ] + } + } + }, + "DHCPV6_SERVER_VALID_FORMAT": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "mtu": 9000, + "lanes": "1", + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "admin_status": "up", + "description": "v6server_vlan", + "dhcpv6_servers": [ + "2001:1::2" + ], + "mtu": "9216", + "name": "Vlan400" + } + ] + }, + "sonic-vlan:VLAN_MEMBER": { + "VLAN_MEMBER_LIST": [ + { + "port": "Ethernet0", + "tagging_mode": "tagged", + "name": "Vlan400" + } + ] + }, + "sonic-vlan:VLAN_INTERFACE": { + "VLAN_INTERFACE_IPPREFIX_LIST": [ + { + "family": "IPv6", + "ip-prefix": "2002::1/64", + "scope": "global", + "name": "Vlan400" + } + ], + "VLAN_INTERFACE_LIST": [ + { + "name": "Vlan400" + } + ] + } + } + }, + "INVALID_VLAN_MAC": { + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "admin_status": "up", + "name": "Vlan1000", + "mac": "12345678" + } + ] + } + } + }, + "VLAN_INTERFACE_VALID_GRAT_ARP": { + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "name": "Vlan1000" + }, + { + "name": "Vlan2000" + } + ] + }, + "sonic-vlan:VLAN_INTERFACE": { + "VLAN_INTERFACE_LIST": [ + { + "name": "Vlan1000", + "grat_arp": "enabled" + }, + { + "name": "Vlan2000", + "grat_arp": "disabled" + } + ] + } + } + }, + "VLAN_INTERFACE_VALID_PROXY_ARP": { + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "name": "Vlan1000" + }, + { + "name": "Vlan2000" + } + ] + }, + "sonic-vlan:VLAN_INTERFACE": { + "VLAN_INTERFACE_LIST": [ + { + "name": "Vlan1000", + "proxy_arp": "enabled" + }, + { + "name": "Vlan2000", + "proxy_arp": "disabled" + } + ] + } + } + }, + "VLAN_INTERFACE_INVALID_GRAT_ARP": { + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN_INTERFACE": { + "VLAN_INTERFACE_LIST": [ + { + "name": "Vlan1000", + "grat_arp": "true" + } + ] + } + } + }, + "VLAN_INTERFACE_INVALID_PROXY_ARP": { + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN_INTERFACE": { + "VLAN_INTERFACE_LIST": [ + { + "name": "Vlan1000", + "proxy_arp": "true" + } + ] + } + } } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/vlan_sub_interface.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/vlan_sub_interface.json new file mode 100644 index 000000000000..8adff73e497c --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/vlan_sub_interface.json @@ -0,0 +1,440 @@ +{ + "VLAN_SUB_INTERFACE_MUST_CONDITION_TRUE_TEST": { + "sonic-vlan-sub-interface:sonic-vlan-sub-interface": { + "sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": { + "VLAN_SUB_INTERFACE_LIST": [ + { + "name": "Ethernet8.10" + } + ], + "VLAN_SUB_INTERFACE_IPPREFIX_LIST": [ + { + "name": "Ethernet8.10", + "ip-prefix": "10.0.0.1/30" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "admin_status": "up", + "alias": "Ethernet8/1", + "description": "Ethernet8", + "lanes": "45,46,47,48", + "mtu": 9000, + "speed": 100000 + } + ] + } + } + }, + "VLAN_SUB_INTERFACE_SHORT_NAME_FORMAT_MUST_CONDITION_TRUE_TEST": { + "sonic-vlan-sub-interface:sonic-vlan-sub-interface": { + "sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": { + "VLAN_SUB_INTERFACE_LIST": [ + { + "name": "Eth8.10" + } + ], + "VLAN_SUB_INTERFACE_IPPREFIX_LIST": [ + { + "name": "Eth8.10", + "ip-prefix": "10.0.0.1/30" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "admin_status": "up", + "alias": "Ethernet8/1", + "description": "Ethernet8", + "lanes": "45,46,47,48", + "mtu": 9000, + "speed": 100000 + } + ] + } + } + }, + "VLAN_SUB_INTERFACE_MUST_CONDITION_FALSE_TEST": { + "sonic-vlan-sub-interface:sonic-vlan-sub-interface": { + "sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": { + "VLAN_SUB_INTERFACE_LIST": [ + { + "name": "Ethernet8.10" + } + ], + "VLAN_SUB_INTERFACE_IPPREFIX_LIST": [ + { + "name": "Ethernet8.10", + "ip-prefix": "10.0.0.1/30" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet12", + "admin_status": "up", + "alias": "Ethernet12/1", + "description": "Ethernet12", + "lanes": "49,50,51,52", + "mtu": 9000, + "speed": 100000 + } + ] + } + } + }, + "VLAN_SUB_INTERFACE_SHORT_NAME_FORMAT_MUST_CONDITION_FALSE_TEST": { + "sonic-vlan-sub-interface:sonic-vlan-sub-interface": { + "sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": { + "VLAN_SUB_INTERFACE_LIST": [ + { + "name": "Eth8.10" + } + ], + "VLAN_SUB_INTERFACE_IPPREFIX_LIST": [ + { + "name": "Eth8.10", + "ip-prefix": "10.0.0.1/30" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet12", + "admin_status": "up", + "alias": "Ethernet12/1", + "description": "Ethernet12", + "lanes": "49,50,51,52", + "mtu": 9000, + "speed": 100000 + } + ] + } + } + }, + "VLAN_SUB_INTERFACE_PO_SHORT_NAME_FORMAT_MUST_CONDITION_TRUE_TEST": { + "sonic-vlan-sub-interface:sonic-vlan-sub-interface": { + "sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": { + "VLAN_SUB_INTERFACE_LIST": [ + { + "name": "Po0001.10" + } + ], + "VLAN_SUB_INTERFACE_IPPREFIX_LIST": [ + { + "name": "Po0001.10", + "ip-prefix": "10.0.0.1/30" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet0", + "tpid": "0x8100", + "speed": 25000 + } + ] + } + }, + "sonic-portchannel:sonic-portchannel": { + "sonic-portchannel:PORTCHANNEL": { + "PORTCHANNEL_LIST": [ + { + "admin_status": "up", + "members": [ + "Ethernet0" + ], + "min_links": "1", + "mtu": "9100", + "tpid": "0x8100", + "lacp_key": "auto", + "name": "PortChannel0001" + } + ] + } + } + }, + "VLAN_SUB_INTERFACE_PO_MUST_CONDITION_FALSE_TEST": { + "sonic-vlan-sub-interface:sonic-vlan-sub-interface": { + "sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": { + "VLAN_SUB_INTERFACE_LIST": [ + { + "name": "PortChannel0001.10" + } + ], + "VLAN_SUB_INTERFACE_IPPREFIX_LIST": [ + { + "name": "PortChannel0001.10", + "ip-prefix": "10.0.0.1/30" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet0", + "tpid": "0x8100", + "speed": 25000 + } + ] + } + }, + "sonic-portchannel:sonic-portchannel": { + "sonic-portchannel:PORTCHANNEL": { + "PORTCHANNEL_LIST": [ + { + "admin_status": "up", + "members": [ + "Ethernet0" + ], + "min_links": "1", + "mtu": "9100", + "tpid": "0x8100", + "lacp_key": "auto", + "name": "PortChannel0001" + } + ] + } + } + }, + "VLAN_SUB_INTERFACE_PO_SHORT_NAME_FORMAT_MUST_CONDITION_FALSE_TEST": { + "sonic-vlan-sub-interface:sonic-vlan-sub-interface": { + "sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": { + "VLAN_SUB_INTERFACE_LIST": [ + { + "name": "Po0002.10" + } + ], + "VLAN_SUB_INTERFACE_IPPREFIX_LIST": [ + { + "name": "Po0002.10", + "ip-prefix": "10.0.0.1/30" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet0", + "tpid": "0x8100", + "speed": 25000 + } + ] + } + }, + "sonic-portchannel:sonic-portchannel": { + "sonic-portchannel:PORTCHANNEL": { + "PORTCHANNEL_LIST": [ + { + "admin_status": "up", + "members": [ + "Ethernet0" + ], + "min_links": "1", + "mtu": "9100", + "tpid": "0x8100", + "lacp_key": "auto", + "name": "PortChannel0001" + } + ] + } + } + }, + "VLAN_SUB_INTERFACE_IP_PREFIX_PORT_NON_EXISTING_LEAF_TEST": { + "sonic-vlan-sub-interface:sonic-vlan-sub-interface": { + "sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": { + "VLAN_SUB_INTERFACE_LIST": [ + { + "name": "Ethernet8.10" + } + ], + "VLAN_SUB_INTERFACE_IPPREFIX_LIST": [ + { + "name": "Ethernet8.20", + "ip-prefix": "10.0.0.1/30" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "admin_status": "up", + "alias": "Ethernet8/1", + "description": "Ethernet8", + "lanes": "45,46,47,48", + "mtu": 9000, + "speed": 100000 + } + ] + } + } + }, + "VLAN_SUB_INTERFACE_INVALID_VLAN_ID_TEST": { + "sonic-vlan-sub-interface:sonic-vlan-sub-interface": { + "sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": { + "VLAN_SUB_INTERFACE_LIST": [ + { + "name": "Ethernet8.4095" + } + ], + "VLAN_SUB_INTERFACE_IPPREFIX_LIST": [ + { + "name": "Ethernet8.4095", + "ip-prefix": "10.0.0.1/30" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "admin_status": "up", + "alias": "Ethernet8/1", + "description": "Ethernet8", + "lanes": "45,46,47,48", + "mtu": 9000, + "speed": 100000 + } + ] + } + } + }, + "VLAN_SUB_INTERFACE_INVALID_VLAN_ID_WITH_LEADING_ZERO_TEST": { + "sonic-vlan-sub-interface:sonic-vlan-sub-interface": { + "sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": { + "VLAN_SUB_INTERFACE_LIST": [ + { + "name": "Ethernet8.095" + } + ], + "VLAN_SUB_INTERFACE_IPPREFIX_LIST": [ + { + "name": "Ethernet8.095", + "ip-prefix": "10.0.0.1/30" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "admin_status": "up", + "alias": "Ethernet8/1", + "description": "Ethernet8", + "lanes": "45,46,47,48", + "mtu": 9000, + "speed": 100000 + } + ] + } + } + }, + "VLAN_SUB_INTERFACE_IP_PREFIX_EMPTY_STRING_TEST": { + "sonic-vlan-sub-interface:sonic-vlan-sub-interface": { + "sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": { + "VLAN_SUB_INTERFACE_LIST": [ + { + "name": "Ethernet8.10" + } + ], + "VLAN_SUB_INTERFACE_IPPREFIX_LIST": [ + { + "name": "Ethernet8.10", + "ip-prefix": "" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "admin_status": "up", + "alias": "Ethernet8/1", + "description": "Ethernet8", + "lanes": "45,46,47,48", + "mtu": 9000, + "speed": 100000 + } + ] + } + } + }, + "VLAN_SUB_INTERFACE_INVALID_NAME_TEST": { + "sonic-vlan-sub-interface:sonic-vlan-sub-interface": { + "sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": { + "VLAN_SUB_INTERFACE_LIST": [ + { + "name": "Ethernet810" + } + ], + "VLAN_SUB_INTERFACE_IPPREFIX_LIST": [ + { + "name": "Ethernet810", + "ip-prefix": "10.0.0.1/30" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "admin_status": "up", + "alias": "Ethernet8/1", + "description": "Ethernet8", + "lanes": "45,46,47,48", + "mtu": 9000, + "speed": 100000 + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-auto_techsupport.yang b/src/sonic-yang-models/yang-models/sonic-auto_techsupport.yang new file mode 100644 index 000000000000..94934d7ab201 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-auto_techsupport.yang @@ -0,0 +1,111 @@ +module sonic-auto_techsupport { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-auto_techsupport"; + prefix auto_techsupport; + + import sonic-types { + prefix stypes; + } + + description "Event Driven Techsupport & CoreDump Mgmt Capability in SONiC OS"; + + revision 2021-08-09 { + description "First Revision"; + } + + typedef decimal-repr { + type decimal64 { + fraction-digits 2; + range 0.0..99.99; + } + } + + container sonic-auto_techsupport { + + container AUTO_TECHSUPPORT { + + description "AUTO_TECHSUPPORT part of config_db.json"; + + container GLOBAL { + + leaf state { + description "Knob to make techsupport invocation event-driven based on core-dump generation"; + type stypes:admin_mode; + } + + leaf rate_limit_interval { + description "Minimum time in seconds between two successive techsupport invocations. Configure 0 to explicitly disable"; + type uint16; + } + + leaf max_techsupport_limit { + /* + A value between 0.0-99.99 should be specified. + The actual value in bytes is calculate based on the available space in the filesystem hosting /var/dump + When the limit is crossed, the older dump files are incrementally deleted + */ + description "Max Limit in percentage for the cummulative size of ts dumps. No cleanup is performed if the value isn't configured or is 0.0"; + type decimal-repr; + } + + leaf max_core_limit { + /* + A value between 0.0-99.99 should be specified. + The actual value in bytes is calculated based on the available space in the filesystem hosting /var/core + When the limit is crossed, the older core files are incrementally deleted + */ + description "Max Limit in percentage for the cummulative size of core dumps. No cleanup is performed if the value isn't congiured or is 0.0"; + type decimal-repr; + } + + leaf since { + /* + Any valid date string of the formats specified here (https://www.gnu.org/software/coreutils/manual/html_node/Date-input-formats.html) + can be used. + */ + description "Only collect the logs & core-dumps generated since the time provided. A default value of '2 days ago' is used if this value is not set explicitly or a non-valid string is provided"; + type string { + length 1..255; + } + } + } + /* end of container GLOBAL */ + } + /* end of container AUTO_TECHSUPPORT */ + + container AUTO_TECHSUPPORT_FEATURE { + + description "AUTO_TECHSUPPORT_FEATURE part of config_db.json"; + + list AUTO_TECHSUPPORT_FEATURE_LIST { + + key "feature_name"; + + leaf feature_name { + description "The name of this feature"; + /* TODO: Leafref once the FEATURE YANG is added*/ + type string { + length 1..255; + } + } + + leaf state { + description "Enable auto techsupport invocation on the processes running inside this feature"; + type stypes:admin_mode; + } + + leaf rate_limit_interval { + description "Rate limit interval for the corresponding feature. Configure 0 to explicitly disable"; + type uint16; + } + + } + /* end of AUTO_TECHSUPPORT_FEATURE_LIST */ + } + /* end of container AUTO_TECHSUPPORT_FEATURE */ + } + /* end of top level container */ +} + diff --git a/src/sonic-yang-models/yang-models/sonic-bgp-allowed-prefix.yang b/src/sonic-yang-models/yang-models/sonic-bgp-allowed-prefix.yang new file mode 100644 index 000000000000..942387983775 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-bgp-allowed-prefix.yang @@ -0,0 +1,102 @@ +module sonic-bgp-allowed-prefix { + namespace "http://github.com/Azure/sonic-bgp-allowed-prefix"; + prefix bgppre; + yang-version 1.1; + + import sonic-bgp-common { + prefix bgpcmn; + } + + import ietf-inet-types { + prefix inet; + } + + import sonic-routing-policy-sets { + prefix rpolsets; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC BGP Allowed Prefix"; + + revision 2022-02-26 { + description + "Initial revision."; + } + + container sonic-bgp-allowed-prefix { + container BGP_ALLOWED_PREFIXES { + list BGP_ALLOWED_PREFIXES_COM_LIST { + key "deployment id community"; + + leaf deployment { + type string { + pattern "DEPLOYMENT_ID"; + } + description "BGP allowed prefix list key type"; + } + + leaf id { + type uint32; + description "BGP allowed prefix list deployment id"; + } + + leaf community { + type string; + description "BGP allowed prefix list deployment community"; + } + + leaf default_action { + type rpolsets:routing-policy-action-type; + description "Permit/Deny action for BGP allow prefix list"; + } + + leaf-list prefixes_v4 { + type inet:ipv4-prefix; + description "BGP V4 allowed prefix list"; + } + + leaf-list prefixes_v6 { + type inet:ipv6-prefix; + description "BGP V6 allowed prefix list"; + } + } + + list BGP_ALLOWED_PREFIXES_LIST { + key "deployment id"; + + leaf deployment { + type string { + pattern "DEPLOYMENT_ID"; + } + description "BGP allowed prefix list key type"; + } + + leaf id { + type uint32; + description "BGP allowed prefix list deployment id"; + } + + leaf default_action { + type rpolsets:routing-policy-action-type; + description "Permit/Deny action for BGP allow prefix list"; + } + + leaf-list prefixes_v4 { + type inet:ipv4-prefix; + description "BGP V4 allowed prefix list"; + } + + leaf-list prefixes_v6 { + type inet:ipv6-prefix; + description "BGP V6 allowed prefix list"; + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-bgp-common.yang b/src/sonic-yang-models/yang-models/sonic-bgp-common.yang index feda9ac563ae..1c360faa9cd4 100644 --- a/src/sonic-yang-models/yang-models/sonic-bgp-common.yang +++ b/src/sonic-yang-models/yang-models/sonic-bgp-common.yang @@ -3,6 +3,10 @@ module sonic-bgp-common { prefix bgpcmn; yang-version 1.1; + import sonic-types { + prefix stypes; + } + import ietf-inet-types { prefix inet; } @@ -314,7 +318,7 @@ module sonic-bgp-common { } leaf admin_status { - type boolean; + type stypes:admin_status; description "To enable BGP peer"; } @@ -338,7 +342,7 @@ module sonic-bgp-common { } leaf admin_status { - type boolean; + type stypes:admin_status; description "Indicates address family active/inactive status"; } @@ -527,4 +531,51 @@ module sonic-bgp-common { } } + grouping sonic-bgp-cmn-neigh { + leaf asn { + type uint32 { + range "1..4294967295"; + } + description "Peer AS number"; + } + + leaf holdtime { + type uint16; + description "Hold time"; + } + + leaf keepalive { + type uint16; + description "Keepalive interval"; + } + + leaf local_addr { + type inet:ip-address; + description "Local source address or interface name to use for connection."; + } + + leaf name { + type string; + description "Peer description"; + } + + leaf nhopself { + type uint8 { + range "0..1"; + } + description "Nexthop is self, no nexthop calculation"; + } + + leaf rrclient { + type uint8 { + range "0..1"; + } + description "Route reflector client"; + } + + leaf admin_status { + type stypes:admin_status; + description "Admin status of BGP peer"; + } + } } diff --git a/src/sonic-yang-models/yang-models/sonic-bgp-monitor.yang b/src/sonic-yang-models/yang-models/sonic-bgp-monitor.yang new file mode 100644 index 000000000000..d152ea94166b --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-bgp-monitor.yang @@ -0,0 +1,53 @@ +module sonic-bgp-monitor { + namespace "http://github.com/Azure/sonic-bgp-monitor"; + prefix bgpmon; + yang-version 1.1; + + import ietf-inet-types { + prefix inet; + } + + import sonic-types { + prefix stypes; + } + + import sonic-bgp-common { + prefix bgpcmn; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC BGP Monitor"; + + revision 2022-01-11 { + description + "Initial revision."; + } + + container sonic-bgp-monitor { + container BGP_MONITORS { + list BGP_MONITORS_LIST { + description "This list is to support BGP monitor configuration handled by bgpcfgd"; + key "addr"; + + leaf addr { + type inet:ip-address; + description "BGP monitor address"; + } + + uses bgpcmn:sonic-bgp-cmn-neigh { + refine name { + must "current() = 'BGPMonitor'" { + error-message "Invalid BGP monitor name"; + } + } + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-bgp-neighbor.yang b/src/sonic-yang-models/yang-models/sonic-bgp-neighbor.yang index 8e0e3f4cc803..12432ffc35bb 100644 --- a/src/sonic-yang-models/yang-models/sonic-bgp-neighbor.yang +++ b/src/sonic-yang-models/yang-models/sonic-bgp-neighbor.yang @@ -7,6 +7,10 @@ module sonic-bgp-neighbor { prefix inet; } + import sonic-types { + prefix stypes; + } + import sonic-bgp-common { prefix bgpcmn; } @@ -57,46 +61,7 @@ module sonic-bgp-neighbor { description "BGP Neighbor address"; } - leaf asn { - type uint32 { - range "1..4294967295"; - } - description "Peer AS number"; - } - - leaf holdtime { - type uint16; - description "Hold time"; - } - - leaf keepalive { - type uint16; - description "Keepalive interval"; - } - - leaf local_addr { - type inet:ip-address; - description "Local source address or interface name to use for connection."; - } - - leaf name { - type string; - description "Peer description"; - } - - leaf nhopself { - type uint8 { - range "0..1"; - } - description "Nexthop is self, no nexthop calculation"; - } - - leaf rrclient { - type uint8 { - range "0..1"; - } - description "Route reflector client"; - } + uses bgpcmn:sonic-bgp-cmn-neigh; } list BGP_NEIGHBOR_LIST { diff --git a/src/sonic-yang-models/yang-models/sonic-bgp-peerrange.yang b/src/sonic-yang-models/yang-models/sonic-bgp-peerrange.yang new file mode 100644 index 000000000000..88d39d82d68c --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-bgp-peerrange.yang @@ -0,0 +1,64 @@ +module sonic-bgp-peerrange { + namespace "http://github.com/Azure/sonic-bgp-peerrange"; + prefix pr; + yang-version 1.1; + + import ietf-inet-types { + prefix inet; + } + + import sonic-types { + prefix stypes; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC BGP Peer Range YANG"; + + revision 2022-02-24 { + description + "Initial revision."; + } + + container sonic-bgp-peerrange { + container BGP_PEER_RANGE { + list BGP_PEER_RANGE_LIST { + key "peer_range_name"; + + leaf peer_range_name { + type string; + description "Peer range name"; + } + + leaf name { + type string; + must "(current() = current()/../peer_range_name)" { + error-message "Invalid name"; + } + } + + leaf src_address { + type inet:ip-address; + description "Source address to use for connection"; + } + + leaf peer_asn { + type uint32 { + range "1..4294967295"; + } + description "Peer AS number"; + } + + leaf-list ip_range { + type stypes:sonic-ip-prefix; + description "A range of addresses"; + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-breakout_cfg.yang b/src/sonic-yang-models/yang-models/sonic-breakout_cfg.yang index ed3b93a1753a..85c0cf997d40 100644 --- a/src/sonic-yang-models/yang-models/sonic-breakout_cfg.yang +++ b/src/sonic-yang-models/yang-models/sonic-breakout_cfg.yang @@ -7,7 +7,6 @@ module sonic-breakout_cfg { import sonic-extension { prefix ext; - revision-date 2019-07-01; } description "BREAKOUT_CFG YANG Module for SONiC OS"; @@ -26,6 +25,7 @@ module sonic-breakout_cfg { key "port"; + /* * This is leaf instead of a leafref towards port, because this * table will contains Parent ports and their current breakout-mode, @@ -40,14 +40,9 @@ module sonic-breakout_cfg { } leaf brkout_mode { + description "break_mode for port, it is verifed using platform.json"; type string { length 1..64; - /* - * Below allowed patterns are based on most used Platforms, - * Add any other breakout-mode to allow Dynamic Port - * Breakout to that breakout-mode. - */ - pattern '1x100G\[40G\]|2x50G|4x25G\[10G\]|2x25G\(2\)\+1x50G\(2\)|1x50G\(2\)\+2x25G\(2\)|1x400G|2x200G|4x100G|8x50G|1x200G\[100G,50G,40G,25G,10G,1G\]|2x100G\[50G,40G,25G,10G,1G\]|4x50G\[40G,25G,10G,1G\]|1x25G\[10G\]|1x100G\[50G,40G,25G,10G\]|2x50G\[40G,25G,10G\]|4x25G\[10G\]|1x25G\[10G,1G\]|1x100G\[50G,40G,25G,10G,1G\]|2x50G\[40G,25G,10G,1G\]|4x25G\[10G,1G\]|1x400G\[200G,100G,50G,40G,25G,10G,1G\]|2x200G\[100G,50G,40G,25G,10G,1G\]|4x100G\[50G,40G,25G,10G,1G\]'; } } } diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-pg.yang b/src/sonic-yang-models/yang-models/sonic-buffer-pg.yang new file mode 100644 index 000000000000..60d06bf6ef6c --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-buffer-pg.yang @@ -0,0 +1,69 @@ +module sonic-buffer-pg { + namespace "http://github.com/Azure/sonic-buffer-pg"; + prefix bpg; + + yang-version 1.1; + + import sonic-port { + prefix prt; + } + + import sonic-buffer-profile { + prefix bpf; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC BUFFER PG"; + + revision 2021-07-01 { + description + "Initial revision."; + } + + + container sonic-buffer-pg { + + container BUFFER_PG { + + list BUFFER_PG_LIST { + key "port pg_num"; + + leaf port { + type leafref { + path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; + } + } + + leaf pg_num { + type string { + pattern "[0-7]((-)[0-7])?" { + error-message "Invalid Buffer PG number"; + error-app-tag pg-num-invalid; + } + } + description "Priority Group number"; + } + + leaf profile { + default 0; + type union { + type leafref { + path "/bpf:sonic-buffer-profile/bpf:BUFFER_PROFILE/bpf:BUFFER_PROFILE_LIST/bpf:name"; + } + type string { + pattern "NULL"; + } + } + description "Buffer Profile associated with Priority Group number for a port"; + } + + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-pool.yang b/src/sonic-yang-models/yang-models/sonic-buffer-pool.yang new file mode 100644 index 000000000000..c59d4ec66ab5 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-buffer-pool.yang @@ -0,0 +1,62 @@ +module sonic-buffer-pool { + namespace "http://github.com/Azure/sonic-buffer-pool"; + prefix bpl; + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC BUFFER POOL"; + + revision 2021-07-01 { + description + "Initial revision."; + } + + container sonic-buffer-pool { + + container BUFFER_POOL { + + list BUFFER_POOL_LIST { + key "name"; + + leaf name { + type string; + description "Buffer Pool name"; + } + + leaf type { + mandatory true; + type enumeration { + enum ingress; + enum egress; + } + description "Buffer Pool Type"; + } + + leaf mode { + mandatory true; + type enumeration { + enum static; + enum dynamic; + } + description "Buffer Pool Mode"; + } + + leaf size { + type uint64; + description "Buffer Pool Size (in Bytes)"; + } + + leaf xoff { + default 0; + type uint64; + description "Buffer Pool Xoff Threshold (in Bytes)"; + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-port-egress-profile-list.yang b/src/sonic-yang-models/yang-models/sonic-buffer-port-egress-profile-list.yang new file mode 100644 index 000000000000..10af27b77458 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-buffer-port-egress-profile-list.yang @@ -0,0 +1,55 @@ +module sonic-buffer-port-egress-profile-list { + namespace "http://github.com/Azure/sonic-buffer-port-egress-profile-list"; + prefix bpg; + + import sonic-extension { + prefix sonic-ext; + } + + import sonic-port { + prefix prt; + } + + import sonic-buffer-profile { + prefix bpf; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC BUFFER PORT EGRESS PROFILE LIST"; + + revision 2021-07-01 { + description + "Initial revision."; + } + + + container sonic-buffer-port-egress-profile-list { + + container BUFFER_PORT_EGRESS_PROFILE_LIST { + list BUFFER_PORT_EGRESS_PROFILE_LIST_LIST { + + key "port"; + + leaf port { + type leafref { + path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; + } + } + + leaf-list profile_list { + type leafref { + path "/bpf:sonic-buffer-profile/bpf:BUFFER_PROFILE/bpf:BUFFER_PROFILE_LIST/bpf:name"; + } + description "a list of references to BUFFER_PROFILE_TABLE object for a port"; + } + + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-port-ingress-profile-list.yang b/src/sonic-yang-models/yang-models/sonic-buffer-port-ingress-profile-list.yang new file mode 100644 index 000000000000..603f50bf2ec2 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-buffer-port-ingress-profile-list.yang @@ -0,0 +1,55 @@ +module sonic-buffer-port-ingress-profile-list { + namespace "http://github.com/Azure/sonic-buffer-port-ingress-profile-list"; + prefix bpg; + + import sonic-extension { + prefix sonic-ext; + } + + import sonic-port { + prefix prt; + } + + import sonic-buffer-profile { + prefix bpf; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC BUFFER PORT INGRESS PROFILE LIST"; + + revision 2021-07-01 { + description + "Initial revision."; + } + + + container sonic-buffer-port-ingress-profile-list { + + container BUFFER_PORT_INGRESS_PROFILE_LIST { + list BUFFER_PORT_INGRESS_PROFILE_LIST_LIST { + + key "port"; + + leaf port { + type leafref { + path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; + } + } + + leaf-list profile_list { + type leafref { + path "/bpf:sonic-buffer-profile/bpf:BUFFER_PROFILE/bpf:BUFFER_PROFILE_LIST/bpf:name"; + } + description "a list of references to BUFFER_PROFILE_TABLE object for a port"; + } + + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang b/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang new file mode 100644 index 000000000000..204e8aa796be --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-buffer-profile.yang @@ -0,0 +1,91 @@ +module sonic-buffer-profile { + namespace "http://github.com/Azure/sonic-buffer-profile"; + prefix bpf; + + import sonic-buffer-pool { + prefix bpl; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC BUFFER PROFILE"; + + revision 2021-07-01 { + description + "Initial revision."; + } + + + container sonic-buffer-profile { + + container BUFFER_PROFILE { + + list BUFFER_PROFILE_LIST { + key "name"; + + leaf name { + type string; + description "Buffer Profile name"; + } + + leaf static_th { + type uint64; + description "The maximum size of the buffer pool the port can occupy"; + } + + leaf dynamic_th { + type int32 { + range "-8..7"; + } + description "The maximum proportion of the free size of the buffer pool the port can occupy (Alpha value)"; + } + + leaf size { + mandatory true; + type uint64; + description "Reserved Size"; + } + + leaf pool { + mandatory true; + type leafref { + path "/bpl:sonic-buffer-pool/bpl:BUFFER_POOL/bpl:BUFFER_POOL_LIST/bpl:name"; + } + description "Buffer Pool name defined in BUFFER_POOL"; + } + + leaf xon_offset { + type uint64; + default 0; + description "Xon Offset Threshold for ingress PG. Triggered if total buffer usage <= max(xon, total buffer limit - xon_offset)"; + } + + leaf xon { + type uint64; + default 0; + description "Xon Threshold for ingress PG"; + } + + leaf xoff { + type uint64; + default 0; + description "Xoff Threshold for ingress PG"; + } + + leaf headroom_type { + default static; + type enumeration { + enum static; + enum dynamic; + } + description "Profile is dynamically calculated or user configured"; + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-buffer-queue.yang b/src/sonic-yang-models/yang-models/sonic-buffer-queue.yang new file mode 100644 index 000000000000..f8c951aa4dd1 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-buffer-queue.yang @@ -0,0 +1,66 @@ +module sonic-buffer-queue { + namespace "http://github.com/Azure/sonic-buffer-queue"; + prefix bqueue; + + import sonic-extension { + prefix sonic-ext; + } + + import sonic-port { + prefix prt; + } + + import sonic-buffer-profile { + prefix bpf; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC BUFFER QUEUE"; + + revision 2021-07-01 { + description + "Initial revision."; + } + + + container sonic-buffer-queue { + + container BUFFER_QUEUE { + + list BUFFER_QUEUE_LIST { + key "port qindex"; + + leaf port { + type leafref { + path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; + } + } + + leaf qindex { + type string { + pattern "(1[0-5]|[0-9])((-)(1[0-5]|[0-9]))?"{ + error-message "Invalid Q-index"; + error-app-tag qindex-invalid; + } + } + description "Egress Queue Index for a port"; + } + + leaf profile { + default 0; + type leafref { + path "/bpf:sonic-buffer-profile/bpf:BUFFER_PROFILE/bpf:BUFFER_PROFILE_LIST/bpf:name"; + } + description "Buffer Profile associated with Priority Queue for a port"; + } + + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-cable-length.yang b/src/sonic-yang-models/yang-models/sonic-cable-length.yang new file mode 100644 index 000000000000..2af765f17d10 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-cable-length.yang @@ -0,0 +1,61 @@ +module sonic-cable-length { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-cable-length"; + + prefix cable-length; + + import sonic-port { + prefix port; + } + + description "CABLE_LENGTH YANG module for SONiC OS"; + + revision 2021-11-11 { + description "Initial version"; + } + + container sonic-cable-length { + container CABLE_LENGTH { + + description "CABLE_LENGTH part of config_db.json"; + + list CABLE_LENGTH_LIST { + key "name"; + + leaf name { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})' { + error-message "Invalid cable length list name."; + error-app-tag cable-length-invalid-list-name; + } + length 1..32 { + error-message "Invalid length for the cable length list name."; + error-app-tag cable-length-invalid-list-name-length; + } + } + } + + list CABLE_LENGTH { + key "port"; + + leaf port { + type leafref { + path /port:sonic-port/port:PORT/port:PORT_LIST/port:name; + } + } + + leaf length { + type string { + pattern '[0-9]+m' { + error-message "Invalid cable length."; + error-app-tag cable-length-invalid-length; + } + } + } + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-copp.yang b/src/sonic-yang-models/yang-models/sonic-copp.yang index 9805b5fd0cce..d735150a5c40 100644 --- a/src/sonic-yang-models/yang-models/sonic-copp.yang +++ b/src/sonic-yang-models/yang-models/sonic-copp.yang @@ -40,16 +40,16 @@ module sonic-copp { leaf trap_action { mandatory true; - type stypes:copp_packet_action; + type stypes:policer_packet_action; description "Trap action"; } - + leaf meter_type { mandatory true; type stypes:meter_type; description "Policer meter type"; } - + leaf mode { mandatory true; type enumeration { @@ -59,14 +59,10 @@ module sonic-copp { } description "Policer mode"; } - + leaf color { - type enumeration { - enum blind; - enum color; - } - default "color"; - description "Policer color source"; + type stypes:policer_color_source; + description "Policer color Source"; } leaf cir { @@ -74,7 +70,7 @@ module sonic-copp { default 0; description "Committed information rate for the dual-rate token - bucket policer. This value represents the rate at which + bucket policer. This value represents the rate at which tokens are added to the primary bucket."; } @@ -118,22 +114,22 @@ module sonic-copp { "Excess burst size for the dual-rate token bucket policer. This value represents the depth of the secondary bucket."; } - + leaf green_action { - type stypes:copp_packet_action; + type stypes:policer_packet_action; default "forward"; description "Green action"; } - + leaf yellow_action { when "((current()/../mode = 'sr_tcm') or (current()/../mode = 'tr_tcm'))"; - type stypes:copp_packet_action; + type stypes:policer_packet_action; default "forward"; description "Yellow action"; } leaf red_action { - type stypes:copp_packet_action; + type stypes:policer_packet_action; default "forward"; description "Red action"; } @@ -163,6 +159,11 @@ module sonic-copp { } description "reference to CoPP group"; } + + leaf always_enabled { + type boolean; + description "field that indicates whether the trap should be always installed"; + } } /* end of list COPP_TRAP_LIST */ } diff --git a/src/sonic-yang-models/yang-models/sonic-crm.yang b/src/sonic-yang-models/yang-models/sonic-crm.yang index 48c15b0e48cc..d1ac84eec391 100644 --- a/src/sonic-yang-models/yang-models/sonic-crm.yang +++ b/src/sonic-yang-models/yang-models/sonic-crm.yang @@ -7,7 +7,6 @@ module sonic-crm { import sonic-types { prefix stypes; - revision-date 2019-07-01; } description "CRM YANG Module for SONiC OS"; diff --git a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang index 400cbf3bcd00..17241005861e 100644 --- a/src/sonic-yang-models/yang-models/sonic-device_metadata.yang +++ b/src/sonic-yang-models/yang-models/sonic-device_metadata.yang @@ -15,7 +15,6 @@ module sonic-device_metadata { import sonic-types { prefix stypes; - revision-date 2019-07-01; } description "DEVICE_METADATA YANG Module for SONiC OS"; @@ -57,9 +56,7 @@ module sonic-device_metadata { } leaf hostname { - type string { - length 1..255; - } + type stypes:hostname; } leaf platform { @@ -91,7 +88,7 @@ module sonic-device_metadata { leaf type { type string { length 1..255; - pattern "ToRRouter|LeafRouter|SpineChassisFrontendRouter|ChassisBackendRouter|ASIC"; + pattern "ToRRouter|LeafRouter|SpineChassisFrontendRouter|ChassisBackendRouter|ASIC|MgmtToRRouter|SpineRouter|BackEndToRRouter|BackEndLeafRouter|EPMS|MgmtTsToR|BmcMgmtToRRouter|not-provisioned"; } } @@ -113,6 +110,84 @@ module sonic-device_metadata { otherwise, sonic-bgpcfgd handles the FRR configurations based on the predefined templates."; default "false"; } + + leaf synchronous_mode { + type enumeration { + enum enable; + enum disable; + } + default enable; + } + + leaf cloudtype { + type string; + } + + leaf region { + type string; + } + + leaf sub_role { + type string; + description "sub_role indicates if ASIC is FrontEnd or BackEnd."; + } + + leaf downstream_subrole { + type string; + } + + leaf resource_type { + type string; + } + + leaf cluster { + type string; + description "The switch is a member of this cluster."; + } + + leaf subtype { + type string { + pattern "DualToR"; + } + } + + leaf peer_switch { + type stypes:hostname; + } + + leaf storage_device { + type boolean; + } + + leaf asic_name { + type string; + description "On a VoQ switch, the ASIC Name is used as a qualifier in global + database keys to create a system wide unique key."; + } + + leaf switch_id { + type uint16; + description "Vendor specific switch ID. Identifies switch chip."; + } + + leaf switch_type { + type string { + pattern "chassis-packet|fabric|npu|voq"; + } + description "Type of switch. Default is NPU, on a VOQ switch voq is used for a regular + switching device while fabric is used for a fabric device. + chassis-packet is used for chassis in packet mode."; + } + + leaf max_cores { + type uint8; + description "Maximum number of cores in a VoQ Switch (chassis)."; + } + + leaf dhcp_server { + type stypes:admin_mode; + description "Indicate whether enable the embedded DHCP server."; + } } /* end of container localhost */ } diff --git a/src/sonic-yang-models/yang-models/sonic-device_neighbor.yang b/src/sonic-yang-models/yang-models/sonic-device_neighbor.yang index e1c745dd9afe..a7284ccec50c 100644 --- a/src/sonic-yang-models/yang-models/sonic-device_neighbor.yang +++ b/src/sonic-yang-models/yang-models/sonic-device_neighbor.yang @@ -11,7 +11,6 @@ module sonic-device_neighbor { import sonic-extension { prefix ext; - revision-date 2019-07-01; } import sonic-port { diff --git a/src/sonic-yang-models/yang-models/sonic-dhcpv6-relay.yang b/src/sonic-yang-models/yang-models/sonic-dhcpv6-relay.yang new file mode 100644 index 000000000000..f1e73397dff4 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-dhcpv6-relay.yang @@ -0,0 +1,53 @@ +module sonic-dhcpv6-relay { + + namespace "http://github.com/Azure/sonic-dhcpv6-relay"; + + prefix sdhcpv6relay; + + yang-version 1.1; + + import ietf-inet-types { + prefix inet; + } + + organization "SONiC"; + + contact "SONiC"; + + description "DHCPv6 Relay yang Module for SONiC OS"; + + revision 2021-10-30 { + description "First Revision"; + } + + container sonic-dhcpv6-relay { + + container DHCP_RELAY { + + description "DHCP_RELAY part of config_db.json"; + + list DHCP_RELAY_LIST { + + key "name"; + + leaf name { + type string; + } + + leaf-list dhcpv6_servers { + description "Configure the dhcp v6 servers"; + type inet:ipv6-address; + } + + leaf rfc6939_support { + description "Set rfc6939 for the relay"; + type boolean; + } + } + /* end of VLAN_LIST */ + } + /* end of container DHCP_RELAY */ + } + /* end of container sonic-dhcpv6-relay */ +} +/* end of module sonic-dhcpv6-relay */ diff --git a/src/sonic-yang-models/yang-models/sonic-dot1p-tc-map.yang b/src/sonic-yang-models/yang-models/sonic-dot1p-tc-map.yang new file mode 100644 index 000000000000..0a756298c97e --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-dot1p-tc-map.yang @@ -0,0 +1,68 @@ +module sonic-dot1p-tc-map { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-dot1p-tc-map"; + + prefix dot1ptm; + + organization + "SONiC"; + + contact + "SONiC"; + + description + "DOT1P_TO_TC_MAP yang Module for SONiC OS"; + + revision 2021-04-15 { + description + "Initial revision."; + } + + container sonic-dot1p-tc-map { + + container DOT1P_TO_TC_MAP { + + description "DOT1P_TO_TC_MAP part of config_db.json"; + + list DOT1P_TO_TC_MAP_LIST { + + key "name"; + + leaf name { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; + length 1..32 { + error-message "Invalid length for map name."; + error-app-tag map-name-invalid-length; + } + } + } + + list DOT1P_TO_TC_MAP { //this is list inside list for storing mapping between two fields + + key "dot1p"; + + leaf dot1p { + type string { + pattern "[0-7]?" { + error-message "Invalid DOT1P"; + error-app-tag dot1p-invalid; + } + } + } + + leaf tc { + type string { + pattern "[0-7]?"{ + error-message "Invalid Traffic Class"; + error-app-tag tc-invalid; + } + } + } + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-dscp-fc-map.yang b/src/sonic-yang-models/yang-models/sonic-dscp-fc-map.yang new file mode 100644 index 000000000000..0b489a57bd0a --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-dscp-fc-map.yang @@ -0,0 +1,68 @@ +module sonic-dscp-fc-map { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-dscp-fc-map"; + + prefix dtm; + + organization + "SONiC"; + + contact + "SONiC"; + + description + "DSCP_TO_FC_MAP yang Module for SONiC OS"; + + revision 2021-10-29 { + description + "Initial revision."; + } + + container sonic-dscp-fc-map { + + container DSCP_TO_FC_MAP { + + description "DSCP_TO_FC_MAP part of config_db.json"; + + list DSCP_TO_FC_MAP_LIST { + + key "name"; + + leaf name { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; + length 1..32 { + error-message "Invalid length for map name."; + error-app-tag map-name-invalid-length; + } + } + } + + list DSCP_TO_FC_MAP { //this is list inside list for storing mapping between two fields + + key "dscp"; + + leaf dscp { + type string { + pattern "6[0-3]|[1-5][0-9]?|[0-9]?" { + error-message "Invalid DSCP"; + error-app-tag dscp-invalid; + } + } + } + + leaf fc { + type string { + pattern "[0-7]?" { + error-message "Invalid Forwarding Class"; + error-app-tag fc-invalid; + } + } + } + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-dscp-tc-map.yang b/src/sonic-yang-models/yang-models/sonic-dscp-tc-map.yang new file mode 100644 index 000000000000..71d9fcd4884d --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-dscp-tc-map.yang @@ -0,0 +1,68 @@ +module sonic-dscp-tc-map { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-dscp-tc-map"; + + prefix dtm; + + organization + "SONiC"; + + contact + "SONiC"; + + description + "DSCP_TO_TC_MAP yang Module for SONiC OS"; + + revision 2021-04-15 { + description + "Initial revision."; + } + + container sonic-dscp-tc-map { + + container DSCP_TO_TC_MAP { + + description "DSCP_TO_TC_MAP part of config_db.json"; + + list DSCP_TO_TC_MAP_LIST { + + key "name"; + + leaf name { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; + length 1..32 { + error-message "Invalid length for map name."; + error-app-tag map-name-invalid-length; + } + } + } + + list DSCP_TO_TC_MAP { //this is list inside list for storing mapping between two fields + + key "dscp"; + + leaf dscp { + type string { + pattern "6[0-3]|[1-5][0-9]?|[0-9]?" { + error-message "Invalid DSCP"; + error-app-tag dscp-invalid; + } + } + } + + leaf tc { + type string { + pattern "[0-7]?" { + error-message "Invalid Traffic Class"; + error-app-tag tc-invalid; + } + } + } + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-exp-fc-map.yang b/src/sonic-yang-models/yang-models/sonic-exp-fc-map.yang new file mode 100644 index 000000000000..79f492bff4f8 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-exp-fc-map.yang @@ -0,0 +1,68 @@ +module sonic-exp-fc-map { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-exp-fc-map"; + + prefix dtm; + + organization + "SONiC"; + + contact + "SONiC"; + + description + "EXP_TO_FC_MAP yang Module for SONiC OS"; + + revision 2021-10-29 { + description + "Initial revision."; + } + + container sonic-exp-fc-map { + + container EXP_TO_FC_MAP { + + description "EXP_TO_FC_MAP part of config_db.json"; + + list EXP_TO_FC_MAP_LIST { + + key "name"; + + leaf name { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; + length 1..32 { + error-message "Invalid length for map name."; + error-app-tag map-name-invalid-length; + } + } + } + + list EXP_TO_FC_MAP { //this is list inside list for storing mapping between two fields + + key "exp"; + + leaf exp { + type string { + pattern "[0-7]?" { + error-message "Invalid EXP"; + error-app-tag exp-invalid; + } + } + } + + leaf fc { + type string { + pattern "[0-7]?" { + error-message "Invalid Forwarding Class"; + error-app-tag fc-invalid; + } + } + } + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-extension.yang b/src/sonic-yang-models/yang-models/sonic-extension.yang deleted file mode 100644 index 6369b605173c..000000000000 --- a/src/sonic-yang-models/yang-models/sonic-extension.yang +++ /dev/null @@ -1,13 +0,0 @@ -module sonic-extension { - - yang-version 1.1; - - namespace "http://github.com/Azure/sonic-extension"; - prefix sonic-extension; - - description "Extension yang Module for SONiC OS"; - - revision 2019-07-01 { - description "First Revision"; - } -} diff --git a/src/sonic-yang-models/yang-models/sonic-feature.yang b/src/sonic-yang-models/yang-models/sonic-feature.yang index 0a7b29c6ae08..be46bef19853 100644 --- a/src/sonic-yang-models/yang-models/sonic-feature.yang +++ b/src/sonic-yang-models/yang-models/sonic-feature.yang @@ -9,7 +9,20 @@ module sonic-feature{ prefix stypes; } - description "Feature Table yang Module for SONiC OS"; + description "Feature Table yang Module for SONiC"; + + typedef feature-state { + description "configuration to set the feature running state"; + type string; + } + + typedef feature-owner { + description "configuration to set if the container is controlled + by kubernetes or locally"; + type string { + pattern "kube|local"; + } + } container sonic-feature { @@ -30,43 +43,50 @@ module sonic-feature{ leaf state { description "state of the feature"; - type stypes:feature_state; + type feature-state; default "enabled"; } leaf auto_restart { - type stypes:feature_state; + type feature-state; default "enabled"; } leaf has_timer { description "This configuration identicates if there is timer associated to this feature"; - type boolean; - default false; + type stypes:boolean_type; + default "false"; } leaf has_global_scope { description "This configuration identicates there will only one service spawned for the device"; - type boolean; - default false; + type stypes:boolean_type; + default "false"; } leaf has_per_asic_scope { description "This configuration identicates there will only one service spawned per asic"; - type boolean; - default false; + type stypes:boolean_type; + default "false"; } leaf high_mem_alert { description "This configuration controls the trigger to generate alert on high memory utilization"; - type stypes:feature_state; + type feature-state; default "disabled"; } + + leaf set_owner { + description " This configuration set the feature owner is + kubernetes or local"; + type feature-owner; + default "local"; + } } } } -} \ No newline at end of file +} diff --git a/src/sonic-yang-models/yang-models/sonic-flex_counter.yang b/src/sonic-yang-models/yang-models/sonic-flex_counter.yang index 6c37d7a0cb5c..9ced223e94bc 100644 --- a/src/sonic-yang-models/yang-models/sonic-flex_counter.yang +++ b/src/sonic-yang-models/yang-models/sonic-flex_counter.yang @@ -5,6 +5,14 @@ module sonic-flex_counter { namespace "http://github.com/Azure/sonic-flex_counter"; prefix flex_counter; + import ietf-inet-types { + prefix inet; + } + + import sonic-types { + prefix stypes; + } + description "FLEX COUNTER YANG Module for SONiC OS"; revision 2020-04-10 { @@ -24,7 +32,13 @@ module sonic-flex_counter { } typedef flex_delay_status { - type boolean; + type stypes:boolean_type; + } + + typedef poll_interval { + type uint32 { + range 100..4294967295; + } } description "FLEX_COUNTER_TABLE part of config_db.json"; @@ -39,6 +53,9 @@ module sonic-flex_counter { leaf FLEX_COUNTER_DELAY_STATUS { type flex_delay_status; } + leaf POLL_INTERVAL { + type poll_interval; + } } container DEBUG_COUNTER { @@ -69,6 +86,9 @@ module sonic-flex_counter { leaf FLEX_COUNTER_DELAY_STATUS { type flex_delay_status; } + leaf POLL_INTERVAL { + type poll_interval; + } } container PG_WATERMARK { @@ -79,6 +99,9 @@ module sonic-flex_counter { leaf FLEX_COUNTER_DELAY_STATUS { type flex_delay_status; } + leaf POLL_INTERVAL { + type poll_interval; + } } container PORT { @@ -89,10 +112,13 @@ module sonic-flex_counter { leaf FLEX_COUNTER_DELAY_STATUS { type flex_delay_status; } + leaf POLL_INTERVAL { + type poll_interval; + } } container PORT_RATES { - /* PORT_BUFFER_DROP_COUNTER_FLEX_COUNTER_GROUP */ + /* PORT_RATES_COUNTER_FLEX_COUNTER_GROUP */ leaf FLEX_COUNTER_STATUS { type flex_status; } @@ -109,6 +135,9 @@ module sonic-flex_counter { leaf FLEX_COUNTER_DELAY_STATUS { type flex_delay_status; } + leaf POLL_INTERVAL { + type poll_interval; + } } container QUEUE { @@ -119,6 +148,9 @@ module sonic-flex_counter { leaf FLEX_COUNTER_DELAY_STATUS { type flex_delay_status; } + leaf POLL_INTERVAL { + type poll_interval; + } } container QUEUE_WATERMARK { @@ -129,6 +161,9 @@ module sonic-flex_counter { leaf FLEX_COUNTER_DELAY_STATUS { type flex_delay_status; } + leaf POLL_INTERVAL { + type poll_interval; + } } container RIF { @@ -139,6 +174,9 @@ module sonic-flex_counter { leaf FLEX_COUNTER_DELAY_STATUS { type flex_delay_status; } + leaf POLL_INTERVAL { + type poll_interval; + } } container RIF_RATES { @@ -151,8 +189,95 @@ module sonic-flex_counter { } } + container ACL { + /* ACL_STAT_COUNTER_FLEX_COUNTER_GROUP */ + leaf FLEX_COUNTER_STATUS { + type flex_status; + } + leaf FLEX_COUNTER_DELAY_STATUS { + type flex_delay_status; + } + leaf POLL_INTERVAL { + type poll_interval; + } + } + + container FLOW_CNT_TRAP { + /* HOSTIF_TRAP_COUNTER_FLEX_COUNTER_GROUP */ + leaf FLEX_COUNTER_STATUS { + type flex_status; + } + leaf FLEX_COUNTER_DELAY_STATUS { + type flex_delay_status; + } + leaf POLL_INTERVAL { + type poll_interval; + } + } + + container FLOW_CNT_ROUTE { + /* ROUTE_FLEX_COUNTER_GROUP */ + leaf FLEX_COUNTER_STATUS { + type flex_status; + } + leaf FLEX_COUNTER_DELAY_STATUS { + type flex_delay_status; + } + leaf POLL_INTERVAL { + type poll_interval; + } + } + } /* end of container FLEX_COUNTER_TABLE */ + + container FLOW_COUNTER_ROUTE_PATTERN { + description "Flow counter route pattern of config_db.json"; + + list FLOW_COUNTER_ROUTE_PATTERN_LIST { + + key "ip_prefix"; + + leaf ip_prefix { + type inet:ip-prefix; + } + + leaf max_match_count { + type uint32 { + range 1..50; + } + } + + } + + list FLOW_COUNTER_ROUTE_PATTERN_VRF_LIST { + + key "vrf_name ip_prefix"; + + leaf vrf_name { + /* + We don't use vrf_name reference here because: + 1. User is allowed to configure a VRF that does not exist yet here, orchagent is designed to resolve the VRF name once the VRF is created. + 2. The field vrf_name accept both VRF name and VNET name. + */ + type string { + length 0..16; + } + } + + leaf ip_prefix { + type inet:ip-prefix; + } + + leaf max_match_count { + type uint32 { + range 1..50; + } + } + + } + } + /* end of container FLOW_COUNTER_ROUTE_PATTERN */ } /* end of top level container */ } diff --git a/src/sonic-yang-models/yang-models/sonic-interface.yang b/src/sonic-yang-models/yang-models/sonic-interface.yang index f559eb6be1b6..746dbba46b7b 100644 --- a/src/sonic-yang-models/yang-models/sonic-interface.yang +++ b/src/sonic-yang-models/yang-models/sonic-interface.yang @@ -7,12 +7,10 @@ module sonic-interface { import sonic-types { prefix stypes; - revision-date 2019-07-01; } import sonic-extension { prefix ext; - revision-date 2019-07-01; } import sonic-port { diff --git a/src/sonic-yang-models/yang-models/sonic-lldp.yang b/src/sonic-yang-models/yang-models/sonic-lldp.yang index d1b04f28e93b..a3620f30fe67 100644 --- a/src/sonic-yang-models/yang-models/sonic-lldp.yang +++ b/src/sonic-yang-models/yang-models/sonic-lldp.yang @@ -28,6 +28,7 @@ module sonic-lldp { grouping lldp_mode_config { leaf enabled { type boolean; + default true; description "Enable/Disable LLDP"; } @@ -99,24 +100,7 @@ module sonic-lldp { "Suppress sending of System Capabilities TLV in LLDP frames"; } - leaf enabled { - type boolean; - default true; - description - "Enable/Disable LLDP"; - } - - leaf mode { - type enumeration { - enum RECEIVE; - enum TRANSMIT; - } - - description - "RX/TX mode for LLDP frames"; - } - - //uses lldp_mode_config; + uses lldp_mode_config; } } @@ -132,23 +116,7 @@ module sonic-lldp { "Reference of port on which LLDP to be configured."; } - leaf enabled { - type boolean; - default true; - description - "Enable/Disable LLDP"; - } - - leaf mode { - type enumeration { - enum RECEIVE; - enum TRANSMIT; - } - - description - "RX/TX mode for LLDP frames"; - } - //uses lldp_mode_config; + uses lldp_mode_config; } } } diff --git a/src/sonic-yang-models/yang-models/sonic-loopback-interface.yang b/src/sonic-yang-models/yang-models/sonic-loopback-interface.yang index 0414f3b94344..c3ada71aaeae 100644 --- a/src/sonic-yang-models/yang-models/sonic-loopback-interface.yang +++ b/src/sonic-yang-models/yang-models/sonic-loopback-interface.yang @@ -7,12 +7,10 @@ module sonic-loopback-interface { import sonic-types { prefix stypes; - revision-date 2019-07-01; } import sonic-extension { prefix ext; - revision-date 2019-07-01; } import sonic-vrf { @@ -65,12 +63,11 @@ module sonic-loopback-interface { key "name ip-prefix"; leaf name{ - /* This node must be present in LOOPBACK_INTERFACE_LIST */ - must "(current() = ../../LOOPBACK_INTERFACE_LIST[name=current()]/name)" - { - error-message "Must condition not satisfied, Try adding lo<>: {}, Example: 'lo1': {}"; + description "Loopback interface name"; + + type leafref { + path "../../LOOPBACK_INTERFACE_LIST/name"; } - type string; } leaf ip-prefix { diff --git a/src/sonic-yang-models/yang-models/sonic-mclag.yang b/src/sonic-yang-models/yang-models/sonic-mclag.yang new file mode 100644 index 000000000000..39e4c0b2b46f --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-mclag.yang @@ -0,0 +1,172 @@ +module sonic-mclag { + namespace "http://github.com/Azure/sonic-mclag"; + prefix smclag; + yang-version 1.1; + + + import ietf-yang-types { + prefix yang; + } + + import ietf-inet-types { + prefix inet; + } + + import sonic-types { + prefix stypes; + } + + import sonic-port { + prefix prt; + } + + import sonic-portchannel { + prefix lag; + } + + // Comment sonic-vlan import here until libyang back-links issue is resolved for VLAN leaf reference. + //import sonic-vlan { + // prefix vlan; + //} + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC MCLAG"; + + revision 2019-10-01 { + description + "Initial revision."; + } + + container sonic-mclag { + + container MCLAG_DOMAIN { + + list MCLAG_DOMAIN_LIST { + key "domain_id"; + max-elements 1; + + leaf domain_id { + description "MCLAG Domain ID"; + type uint16 { + range "1..4095" { + error-message "MCLAG Domain ID out of range"; + } + } + } + + leaf source_ip { + type inet:ipv4-address; + description "MCLAG Domain source ip address for session between MCLAG Peers"; + } + leaf peer_ip { + type inet:ipv4-address; + description "MCLAG Domain peer ip address for session between MCLAG Peers"; + } + leaf peer_link { + description "MCLAG Domain peer link, data backup path link between MCLAG peers"; + type union { + type leafref { + path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; + } + type leafref { + path "/lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name"; + } + } + } + leaf keepalive_interval { + description "keepalive interval in seconds for MCLAG session between peers"; + type uint16 { + range "1..60" { + error-message "MCLAG Domain keepalive interval out of range"; + error-app-tag keepalive_interval-invalid; + } + } + default 1; + } + leaf session_timeout { + description "Session timeout in seconds for MCLAG session between peers"; + type uint16 { + range "1..3600" { + error-message "MCLAG Domain session timeout out of range"; + error-app-tag session_timeout-invalid; + } + } + default 30; + } + must "(keepalive_interval * 3) <= session_timeout" { + error-message "(keepalive interval * 3) <= session_timeout value"; + error-app-tag keepalive_session_multiplier-invalid; + } + } + } + + container MCLAG_INTERFACE { + + list MCLAG_INTERFACE_LIST { + description "List of MCLAG interfaces"; + key "domain_id if_name"; + + leaf domain_id { + description "List of MCLAG interfaces"; + type leafref { + path "../../../MCLAG_DOMAIN/MCLAG_DOMAIN_LIST/domain_id"; + } + } + + leaf if_name { + description "MCLAG interface name"; + type leafref { + path "/lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name"; + } + } + leaf if_type { + description "MCLAG interface type, placeholder field to create instance"; + type string; + } + } + } + + container MCLAG_UNIQUE_IP { + + list MCLAG_UNIQUE_IP_LIST { + description "List of VLANs allowed to have unique ip addresses on MCLAG Peer nodes"; + key "if_name"; + + must "count(../../MCLAG_DOMAIN/MCLAG_DOMAIN_LIST/domain_id) != 0" { + error-message "mclag not configured"; + error-app-tag mclag-invalid; + } + + // Comment VLAN leaf reference here until libyang back-links issue is resolved and use VLAN string pattern + //must + // "count(/vlan:sonic-vlan/vlan:VLAN_INTERFACE/vlan:VLAN_INTERFACE_IPPREFIX_LIST[vlan:name=current()/if_name]) = 0" { + // error-message "remove configured ip/v6 address and reconfigure after separate ip configuration"; + // error-app-tag vlan-intf-ip-invalid; + // } + + leaf if_name { + description "Vlan interface name on which MCLAG unique ip config is done"; + // Comment VLAN leaf reference here until libyang back-links issue is resolved and use VLAN string pattern + //type leafref { + // path "/vlan:sonic-vlan/vlan:VLAN/vlan:VLAN_LIST/vlan:name"; + //} + type string { + pattern 'Vlan([0-9]{1,3}|[1-3][0-9]{3}|[4][0][0-8][0-9]|[4][0][9][0-4])'; + } + } + leaf unique_ip { + description "unique ip enable, by default disable"; + type enumeration { + enum enable; + } + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-mirror-session.yang b/src/sonic-yang-models/yang-models/sonic-mirror-session.yang new file mode 100644 index 000000000000..9ea1954d7a37 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-mirror-session.yang @@ -0,0 +1,192 @@ +module sonic-mirror-session { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-mirror-session"; + prefix sms; + + import ietf-inet-types { + prefix inet; + } + + import sonic-port { + prefix port; + } + + import sonic-portchannel { + prefix lag; + } + + import sonic-policer { + prefix policer; + } + + description + "SONiC Mirror session yang model"; + + revision 2021-06-15 { + description + "Initial revision."; + } + + typedef session_type { + type enumeration { + enum ERSPAN { + description "ERSPAN session"; + } + enum SPAN { + description "SPAN session"; + } + } + } + + typedef session_direction { + type enumeration { + enum RX { + description "RX direction"; + } + enum TX { + description "TX direction"; + } + enum BOTH { + description "Both RX and TX direction"; + } + } + } + + container sonic-mirror-session { + + container MIRROR_SESSION { + + list MIRROR_SESSION_LIST { + key "name"; + + leaf name { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; + length 1..32 { + error-message "Invalid mirror session name"; + error-app-tag session-name-invalid; + } + } + description + "Mirror session name."; + } + + leaf type { + type session_type; + default "ERSPAN"; + description + "Mirror session type."; + } + + leaf src_ip { + when "current()/../type = 'ERSPAN'"; + type inet:ipv4-address; + description + "ERSPAN source ip. This IP will be set as source ip in + outer header of mirrored frame "; + } + + leaf dst_ip { + when "current()/../type = 'ERSPAN'"; + type inet:ipv4-address; + description + "ERSPAN destination ip. Mirrored frames will be routed to this destination. + This IP will be set as destination ip in outer header of mirrored frame "; + } + + leaf gre_type { + when "current()/../type = 'ERSPAN'"; + type string { + pattern "0[xX][0-9a-fA-F]*|([0-9]|[1-5]?[0-9]{2,4}|6[1-4][0-9]{3}|65[1-4][0-9]{2}|655[1-2][0-9]|6553[0-5])"; + length 1..6 { + error-message "Invalid GRE type"; + error-app-tag gre-type-invalid; + } + } + default 0x88be; + description + "ERSPAN outer header GRE type."; + } + + leaf dscp { + when "current()/../type = 'ERSPAN'"; + type uint8 { + range "0..63" { + error-message "Invalid dscp value"; + error-app-tag dscp-invalid; + } + } + description + "ERSPAN outer header DSCP value. Mirrored frames will be sent with configured DSCP value"; + } + + leaf ttl { + when "current()/../type = 'ERSPAN'"; + type uint8 { + range "0..63" { + error-message "Invalid TTL value"; + error-app-tag ttl-invalid; + } + } + description + "ERSPAN outer header TTL value. Mirrored frames will be sent with configured TTL value"; + } + + leaf queue { + type uint8; + description + "ERSPAN Queue. Mirrored frames will be sent to this queue"; + } + + leaf dst_port { + when "current()/../type = 'SPAN'"; + type union { + type leafref { + path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name"; + } + type string { + pattern "CPU"; + } + } + description + "Destination port configuration for port mirroring(SPAN)."; + } + + leaf-list src_port { + type union { + type leafref { + path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name"; + } + type leafref { + path "/lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name"; + } + } + description + "Source port configuration for mirroring. Can be configured for both SPAN/ERSPAN. + Supports both port and port-channel as arguments"; + } + + leaf direction { + type session_direction; + default "BOTH"; + description + "Direction configuration for mirroring. Can be configured for both SPAN/ERSPAN. + Supports rx/tx/both as direction config. + RX: Captures frames ingressing on source port. + TX: Captures frames egressing on source port. + BOTH: Captures frames ingressing or egressing on source port."; + } + + leaf policer { + type leafref { + path "/policer:sonic-policer/policer:POLICER/policer:POLICER_LIST/policer:name"; + } + description + "Policer to be applied for the mirrored traffic."; + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-nvgre-tunnel.yang b/src/sonic-yang-models/yang-models/sonic-nvgre-tunnel.yang new file mode 100644 index 000000000000..b10c35d94043 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-nvgre-tunnel.yang @@ -0,0 +1,109 @@ +module sonic-nvgre-tunnel { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-nvgre-tunnel"; + prefix nvgre; + + import ietf-inet-types { + prefix inet; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "NVGRE Tunnel YANG Module for SONiC OS"; + + revision 2021-10-31 { + description + "First Revision"; + } + + container sonic-nvgre-tunnel { + + container NVGRE_TUNNEL { + + description "NVGRE_TUNNEL part of config_db.json"; + + list NVGRE_TUNNEL_LIST { + + key "tunnel_name"; + + leaf tunnel_name { + description "NVGRE Tunnel name"; + + type string { + length 1..255; + } + } + + leaf src_ip { + description "Source IP address"; + + mandatory true; + type inet:ip-address; + } + + } + /* end of NVGRE_TUNNEL_LIST */ + + } + /* end of container NVGRE_TUNNEL */ + + container NVGRE_TUNNEL_MAP { + + description "NVGRE_TUNNEL_MAP part of config_db.json"; + + list NVGRE_TUNNEL_MAP_LIST { + + key "tunnel_name tunnel_map_name"; + + leaf tunnel_name { + description "NVGRE Tunnel name"; + + type leafref { + path /nvgre:sonic-nvgre-tunnel/nvgre:NVGRE_TUNNEL/nvgre:NVGRE_TUNNEL_LIST/nvgre:tunnel_name; + } + } + + leaf tunnel_map_name { + description "NVGRE Tunnel map name"; + + type string { + length 1..255; + } + } + + leaf vlan_id { + description "VLAN identifier"; + + mandatory true; + type uint16 { + range 1..4094; + } + } + + leaf vsid { + description "Virtual Subnet Identifier"; + + mandatory true; + type uint32 { + range 0..16777214; + } + } + + } + /* end of NVGRE_TUNNEL_MAP_LIST */ + + } + /* end of container NVGRE_TUNNEL_MAP */ + + } + /* end of container sonic-nvgre-tunnel */ + +} +/* end of module sonic-nvgre-tunnel */ diff --git a/src/sonic-yang-models/yang-models/sonic-pfc-priority-priority-group-map.yang b/src/sonic-yang-models/yang-models/sonic-pfc-priority-priority-group-map.yang new file mode 100644 index 000000000000..ccc86c064efb --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-pfc-priority-priority-group-map.yang @@ -0,0 +1,68 @@ +module sonic-pfc-priority-priority-group-map { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-pfc-priority-priority-group-map"; + + prefix pppgm; + + organization + "SONiC"; + + contact + "SONiC"; + + description + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP yang Module for SONiC OS"; + + revision 2021-04-15 { + description + "Initial revision."; + } + + container sonic-pfc-priority-priority-group-map { + + container PFC_PRIORITY_TO_PRIORITY_GROUP_MAP { + + description "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP part of config_db.json"; + + list PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST { + + key "name"; + + leaf name { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; + length 1..32 { + error-message "Invalid length for map name."; + error-app-tag map-name-invalid-length; + } + } + } + + list PFC_PRIORITY_TO_PRIORITY_GROUP_MAP { //this is list inside list for storing mapping between two fields + + key "pfc_priority"; + + leaf pfc_priority { + type string { + pattern "[0-7]?" { + error-message "Invalid pfc priority"; + error-app-tag pfc-priority-invalid; + } + } + } + + leaf pg { + type string { + pattern "[0-7]?" { + error-message "Invalid Priority Group"; + error-app-tag pg-invalid; + } + } + } + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-pfc-priority-queue-map.yang b/src/sonic-yang-models/yang-models/sonic-pfc-priority-queue-map.yang new file mode 100644 index 000000000000..fb659d89bb4b --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-pfc-priority-queue-map.yang @@ -0,0 +1,68 @@ +module sonic-pfc-priority-queue-map { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-pfc-priority-queue-map"; + + prefix ppqm; + + organization + "SONiC"; + + contact + "SONiC"; + + description + "PFC_PRIORITY_TO_QUEUE_MAP yang Module for SONiC OS"; + + revision 2021-04-15 { + description + "Initial revision."; + } + + container sonic-pfc-priority-queue-map { + + container MAP_PFC_PRIORITY_TO_QUEUE { + + description "MAP_PFC_PRIORITY_TO_QUEUE part of config_db.json"; + + list MAP_PFC_PRIORITY_TO_QUEUE_LIST { + + key "name"; + + leaf name { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; + length 1..32 { + error-message "Invalid length for map name."; + error-app-tag map-name-invalid-length; + } + } + } + + list MAP_PFC_PRIORITY_TO_QUEUE { //this is list inside list for storing mapping between two fields + + key "pfc_priority"; + + leaf pfc_priority { + type string { + pattern "[0-7]?" { + error-message "Invalid pfc priority"; + error-app-tag pfc-priority-invalid; + } + } + } + + leaf qindex { + type string { + pattern "[0-7]?" { + error-message "Invalid queue index"; + error-app-tag queue-index-invalid; + } + } + } + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-pfcwd.yang b/src/sonic-yang-models/yang-models/sonic-pfcwd.yang index beebf51965df..4ea0ffb8537f 100644 --- a/src/sonic-yang-models/yang-models/sonic-pfcwd.yang +++ b/src/sonic-yang-models/yang-models/sonic-pfcwd.yang @@ -51,6 +51,9 @@ module sonic-pfcwd { } leaf detection_time { must "../ifname != 'GLOBAL'"; + must "(not(boolean(current()/../../PFC_WD_LIST[ifname='GLOBAL'])) or (current() >= current()/../../PFC_WD_LIST[ifname='GLOBAL']/POLL_INTERVAL))" { + error-message "detection_time must be greater than or equal to POLL_INTERVAL"; + } type uint32 { range 100..5000; } @@ -59,6 +62,9 @@ module sonic-pfcwd { } leaf restoration_time { must "../ifname != 'GLOBAL'"; + must "(not(boolean(current()/../../PFC_WD_LIST[ifname='GLOBAL'])) or (current() >= current()/../../PFC_WD_LIST[ifname='GLOBAL']/POLL_INTERVAL))" { + error-message "restoration_time must be greater than or equal to POLL_INTERVAL"; + } type uint32 { range 100..60000; } diff --git a/src/sonic-yang-models/yang-models/sonic-port-qos-map.yang b/src/sonic-yang-models/yang-models/sonic-port-qos-map.yang new file mode 100644 index 000000000000..8f4c2d88f4ed --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-port-qos-map.yang @@ -0,0 +1,118 @@ +module sonic-port-qos-map { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-port-qos-map"; + + prefix pqm; + + import sonic-port { + prefix prt; + } + + import sonic-tc-priority-group-map { + prefix tpgm; + } + + import sonic-tc-queue-map { + prefix tqm; + } + + import sonic-pfc-priority-queue-map { + prefix ppqm; + } + + import sonic-pfc-priority-priority-group-map { + prefix pppgm; + } + + import sonic-dscp-tc-map { + prefix dtm; + } + + import sonic-dot1p-tc-map { + prefix dot1ptm; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC PORT_QOS_MAP"; + + revision 2019-05-15 { + description + "Initial revision."; + } + + container sonic-port-qos-map { + + container PORT_QOS_MAP { + list PORT_QOS_MAP_LIST { + + key "ifname"; + + leaf ifname { + type leafref { + path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; + } + description + "Reference of port on which QOS MAPS to be configured."; + } + + leaf tc_to_pg_map { + type leafref { + path "/tpgm:sonic-tc-priority-group-map/tpgm:TC_TO_PRIORITY_GROUP_MAP/tpgm:TC_TO_PRIORITY_GROUP_MAP_LIST/tpgm:name"; + } + } + + leaf tc_to_queue_map { + type leafref { + path "/tqm:sonic-tc-queue-map/tqm:TC_TO_QUEUE_MAP/tqm:TC_TO_QUEUE_MAP_LIST/tqm:name"; + } + } + + leaf pfc_enable { + type string { + pattern "[0-7](,[0-7])?"; + } + } + + leaf pfcwd_sw_enable { + type string { + pattern "[0-7](,[0-7])?"; + } + description + "Specify the queue(s) on which software pfc watchdog are enabled."; + } + + leaf pfc_to_queue_map { + type leafref { + path "/ppqm:sonic-pfc-priority-queue-map/ppqm:MAP_PFC_PRIORITY_TO_QUEUE/ppqm:MAP_PFC_PRIORITY_TO_QUEUE_LIST/ppqm:name"; + } + } + + leaf pfc_to_pg_map { + type leafref { + path "/pppgm:sonic-pfc-priority-priority-group-map/pppgm:PFC_PRIORITY_TO_PRIORITY_GROUP_MAP/pppgm:PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST/pppgm:name"; + } + } + + leaf dscp_to_tc_map { + type leafref { + path "/dtm:sonic-dscp-tc-map/dtm:DSCP_TO_TC_MAP/dtm:DSCP_TO_TC_MAP_LIST/dtm:name"; + } + } + + leaf dot1p_to_tc_map { + type leafref { + path "/dot1ptm:sonic-dot1p-tc-map/dot1ptm:DOT1P_TO_TC_MAP/dot1ptm:DOT1P_TO_TC_MAP_LIST/dot1ptm:name"; + } + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-port.yang b/src/sonic-yang-models/yang-models/sonic-port.yang index d2f63e571207..d296eaa05c39 100644 --- a/src/sonic-yang-models/yang-models/sonic-port.yang +++ b/src/sonic-yang-models/yang-models/sonic-port.yang @@ -7,12 +7,10 @@ module sonic-port{ import sonic-types { prefix stypes; - revision-date 2019-07-01; } import sonic-extension { prefix ext; - revision-date 2019-07-01; } description "PORT yang Module for SONiC OS"; @@ -112,9 +110,20 @@ module sonic-port{ } leaf index { - type uint16 { - range 0..256; + type uint16; + } + + leaf asic_port_name { + type string; + description "port name in asic and asic name, e.g Eth0-ASIC1"; + } + + leaf role { + type string { + pattern "Ext|Int|Inb|Rec"; } + description "Internal port or External port for multi-asic platform"; + default "Ext"; } leaf admin_status { @@ -140,6 +149,10 @@ module sonic-port{ type stypes:tpid_type; } + leaf mux_cable { + type boolean; + } + } /* end of list PORT_LIST */ } /* end of container PORT */ diff --git a/src/sonic-yang-models/yang-models/sonic-portchannel.yang b/src/sonic-yang-models/yang-models/sonic-portchannel.yang index 587a19e4bec6..083a413527ec 100644 --- a/src/sonic-yang-models/yang-models/sonic-portchannel.yang +++ b/src/sonic-yang-models/yang-models/sonic-portchannel.yang @@ -7,12 +7,10 @@ module sonic-portchannel { import sonic-types { prefix stypes; - revision-date 2019-07-01; } import sonic-extension { prefix ext; - revision-date 2019-07-01; } import sonic-port { @@ -138,7 +136,7 @@ module sonic-portchannel { path "/lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name"; } } - + leaf port { /* key elements are mandatory by default */ type leafref { diff --git a/src/sonic-yang-models/yang-models/sonic-queue.yang b/src/sonic-yang-models/yang-models/sonic-queue.yang new file mode 100644 index 000000000000..8e24faa72cb0 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-queue.yang @@ -0,0 +1,88 @@ +module sonic-queue { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-queue"; + + prefix squeue; + + import sonic-extension { + prefix sonic-ext; + } + + import sonic-port { + prefix port; + } + + import sonic-scheduler { + prefix sch; + } + + import sonic-wred-profile { + prefix wrd; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "QUEUE yang Module for SONiC OS"; + + revision 2021-04-01 { + description + "Initial revision"; + } + + container sonic-queue { + + container QUEUE { + + description "QUEUE part of config_db.json"; + + list QUEUE_LIST { + + key "ifname qindex"; + + // sonic-ext:key-pattern "QUEUE|{ifname}|{qindex}"; //special pattern used for extracting keys from redis-key and populate the yang instance + // Total list instances = number(key1) * number(key2) * number(key3) + + leaf ifname { + type union { + type leafref { + path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name"; + } + type string { + pattern "CPU"; + } + } + description "Interface name."; + } + // qindex format is (X) | (X-Y). X is start and Y is end index. + // X and Y value depends on platform, example for physical ports 0-7 and + // for CPU port 0-48. Example qindex is 3-4 + leaf qindex { + // sonic-ext:custom-validation ValidateQindexPattern; + type string; + description "Queue index on the interface."; + } + + leaf scheduler { + type leafref { + path "/sch:sonic-scheduler/sch:SCHEDULER/sch:SCHEDULER_LIST/sch:name"; //Reference to SCHEDULER table + } + description "Scheduler for queue."; + } + + leaf wred_profile { + type leafref { + path "/wrd:sonic-wred-profile/wrd:WRED_PROFILE/wrd:WRED_PROFILE_LIST/wrd:name"; // Reference to WRED_PROFILE table + } + description "Wred profile for queue."; + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-scheduler.yang b/src/sonic-yang-models/yang-models/sonic-scheduler.yang new file mode 100644 index 000000000000..8dcd4bef79b2 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-scheduler.yang @@ -0,0 +1,141 @@ +module sonic-scheduler { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-scheduler"; + + prefix sch; + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SCHEDULER yang Module for SONiC OS"; + + revision 2021-04-01 { + description + "Initial revision"; + } + + container sonic-scheduler { + + container SCHEDULER { + + description "SCHEDULER part of config_db.json"; + + list SCHEDULER_LIST { + + key "name"; + + leaf name { + type string; + description "Scheduler name"; + } + + leaf type { + type enumeration { + enum DWRR { + description "Deficit Weighted Round-Robin Scheduling"; + } + enum WRR { + description "Weighted Round-Robin Scheduling"; + } + enum STRICT { + description "Strict Scheduling"; + } + } + default WRR; + description "Scheduling algorithm type"; + } + + leaf weight { + type uint8 { + range "1..100"; + } + default 1; + description "Scheduling algorithm weight"; + } + + leaf priority { + type uint8 { + range "0..9"; + } + description "Scheduler priority"; + } + + leaf meter_type { + type enumeration { + enum packets { + description "Metering is based on packets"; + } + enum bytes { + description "Metering is based on bytes"; + } + } + default bytes; + description "meter type"; + } + + leaf cir { + type uint64; + description + "Committed information rate for the dual-rate token + bucket policer.This value represents the rate at which + tokens are added to the primary bucket.nt Units is + Bps(Bytes per second) for meter type is bytes else + Pps(packets per second) for meter type is packets"; + } + + leaf pir { + must "((current()/../cir) and (current()/../cir > 0))" { + error-message "pir can't be configured without cir."; + } + must "(current() >= current()/../cir)" { + error-message "pir must be greater than or equal to cir"; + } + type uint64; + description + "Peak information rate for the dual-rate token bucket + policer.This value represents the rate at which tokens + are added to the secondary bucket.Unit is Bps(Bytes + per second) for meter type bytes else Pps(packets per + second) for meter type is packets"; + } + + leaf cbs { + + must "((current()/../cir) and (current()/../cir > 0))" { + error-message "cbs can't be configured without cir."; + } + + type uint32; + description + "Committed burst size for the dual-rate token bucket + policer.This value represents the depth of the token + bucket.Unit is bytes for meter type bytes else packets + for meter type is packets"; + } + + leaf pbs { + must "((current()/../pir) and (current()/../pir > 0))" { + error-message "pbs can't be configured without pir."; + } + + must "((not(current()/../cbs)) or (current() >= current()/../cbs))" { + error-message "pbs must be greater than or equal to cbs"; + } + + type uint32; + description + "Excess burst size for the dual-rate token bucket policer. + This value represents the depth of the secondary bucket. + Unit is bytes for meter type bytes else packets for meter type + is packets"; + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-storm-control.yang b/src/sonic-yang-models/yang-models/sonic-storm-control.yang new file mode 100644 index 000000000000..6d4e2b66a0f5 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-storm-control.yang @@ -0,0 +1,56 @@ +module sonic-storm-control { + namespace "http://github.com/Azure/sonic-storm-control"; + yang-version "1"; + + prefix ssc; + + import sonic-port { + prefix prt; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "This module defines configuration and operational state + data for broadcast, unknown-unicast and unknown-multicast (BUM) storm-control. + storm-control can be enabled on ethernet interfaces. + Rate is defined in bits-per-second. All three types of storm-control can be + enabled on an interface."; + + revision 2021-12-13 { + description + "Initial revision"; + } + + container sonic-storm-control { + container PORT_STORM_CONTROL { + list PORT_STORM_CONTROL_LIST { + key "ifname storm_type"; + /*scommon:key-pattern "PORT_STORM_CONTROL|{ifname}|{storm_type}";*/ + leaf ifname { + type leafref { + path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; + } + } + leaf storm_type { + type enumeration{ + enum broadcast; + enum unknown-unicast; + enum unknown-multicast; + } + } + leaf kbps { + type uint64 { + range "0..100000000" { + error-message "kbps value out of range"; + } + } + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-syslog.yang b/src/sonic-yang-models/yang-models/sonic-syslog.yang new file mode 100644 index 000000000000..2bb05a02973f --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-syslog.yang @@ -0,0 +1,30 @@ +module sonic-syslog { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-system-syslog"; + prefix syslog; + + import ietf-inet-types { + prefix inet; + } + + container sonic-syslog { + + container SYSLOG_SERVER { + + description "SYSLOG SERVER part of config_db.json"; + + list SYSLOG_SERVER_LIST { + + key "server_address"; + + leaf server_address { + description "syslog server ip address"; + type inet:ip-address; + } + } /* end of list SYSLOG_SERVER_LIST */ + + } /* end of container SYSLOG_SERVER */ + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-system-aaa.yang b/src/sonic-yang-models/yang-models/sonic-system-aaa.yang index eb6a8b06c713..c3a442126959 100644 --- a/src/sonic-yang-models/yang-models/sonic-system-aaa.yang +++ b/src/sonic-yang-models/yang-models/sonic-system-aaa.yang @@ -3,6 +3,14 @@ module sonic-system-aaa { prefix ssys; yang-version 1.1; + import sonic-types { + prefix stypes; + } + + revision 2021-10-12 { + description "Add AAA authorization/accounting support."; + } + revision 2021-04-15 { description "Initial revision."; } @@ -15,28 +23,45 @@ module sonic-system-aaa { leaf type { type enumeration { enum authentication; + enum authorization; + enum accounting; } - description "AAA type authentication"; + description "AAA type authentication/authorization/accounting"; } leaf login { - type string; - description "AAA authentication methods - local/tacacs+"; + type string { + pattern '((tacacs\+|local|radius|default),)*(tacacs\+|local|radius|default)' { + error-message "Invalid login choice"; + } + } + description "AAA authentication/authorization/accounting methods - radius/tacacs+/local/default"; default "local"; } leaf failthrough { - type boolean; + type stypes:boolean_type; description "When set to true, authentication is attempted on next configured server/local in the list upon failure."; - default false; + default False; + } + + leaf fallback { + type stypes:boolean_type; + description "Allow AAA fallback"; + default False; } leaf debug { - type boolean; + type stypes:boolean_type; description "Enable/disable AAA debugging"; - default false; + default False; } + leaf trace { + type stypes:boolean_type; + description "AAA packet trace"; + default False; + } } } } diff --git a/src/sonic-yang-models/yang-models/sonic-tc-priority-group-map.yang b/src/sonic-yang-models/yang-models/sonic-tc-priority-group-map.yang new file mode 100644 index 000000000000..4290b79c3ee7 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-tc-priority-group-map.yang @@ -0,0 +1,68 @@ +module sonic-tc-priority-group-map { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-tc-priority-group-map"; + + prefix tpgm; + + organization + "SONiC"; + + contact + "SONiC"; + + description + "TC_TO_PRIORITY_GROUP_MAP yang Module for SONiC OS"; + + revision 2021-04-15 { + description + "Initial revision."; + } + + container sonic-tc-priority-group-map { + + container TC_TO_PRIORITY_GROUP_MAP { + + description "TC_TO_PRIORITY_GROUP_MAP part of config_db.json"; + + list TC_TO_PRIORITY_GROUP_MAP_LIST { + + key "name"; + + leaf name { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; + length 1..32 { + error-message "Invalid length for map name."; + error-app-tag map-name-invalid-length; + } + } + } + + list TC_TO_PRIORITY_GROUP_MAP { //this is list inside list for storing mapping between two fields + + key "tc"; + + leaf tc { + type string { + pattern "[0-7]?" { + error-message "Invalid Traffic Class"; + error-app-tag tc-invalid; + } + } + } + + leaf pg { + type string { + pattern "[0-7]?" { + error-message "Invalid Priority Group"; + error-app-tag pg-invalid; + } + } + } + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-tc-queue-map.yang b/src/sonic-yang-models/yang-models/sonic-tc-queue-map.yang new file mode 100644 index 000000000000..fa22a8331294 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-tc-queue-map.yang @@ -0,0 +1,68 @@ +module sonic-tc-queue-map { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-tc-queue-map"; + + prefix tqm; + + organization + "SONiC"; + + contact + "SONiC"; + + description + "TC_TO_QUEUE_MAP yang Module for SONiC OS"; + + revision 2021-04-15 { + description + "Initial revision."; + } + + container sonic-tc-queue-map { + + container TC_TO_QUEUE_MAP { + + description "TC_TO_QUEUE_MAP part of config_db.json"; + + list TC_TO_QUEUE_MAP_LIST { + + key "name"; + + leaf name { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; + length 1..32 { + error-message "Invalid length for map name."; + error-app-tag map-name-invalid-length; + } + } + } + + list TC_TO_QUEUE_MAP { //this is list inside list for storing mapping between two fields + + key "tc"; + + leaf tc { + type string { + pattern "[0-7]?" { + error-message "Invalid Traffic Class"; + error-app-tag tc-invalid; + } + } + } + + leaf qindex { + type string { + pattern "[0-7]?" { + error-message "Invalid queue index"; + error-app-tag queue-index-invalid; + } + } + } + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-vlan-sub-interface.yang b/src/sonic-yang-models/yang-models/sonic-vlan-sub-interface.yang new file mode 100644 index 000000000000..953aa7e14c80 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-vlan-sub-interface.yang @@ -0,0 +1,88 @@ +module sonic-vlan-sub-interface { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-vlan-sub-interface"; + + prefix vlan-sub-interface; + + import sonic-types { + prefix stypes; + } + + import sonic-port { + prefix port; + } + + import sonic-portchannel { + prefix lag; + } + + import sonic-vrf { + prefix vrf; + } + + description "VLAN sub interface for SONiC OS"; + + revision 2021-11-11 { + description "Initial version"; + } + + container sonic-vlan-sub-interface { + container VLAN_SUB_INTERFACE { + + description "VLAN SUB INTERFACE part of config_db.json"; + + list VLAN_SUB_INTERFACE_LIST { + + description "VLAN_SUB_INTERFACE part of config_db.json with vrf"; + + key "name"; + + leaf name { + must "(substring-before(current(), '.') = /port:sonic-port/port:PORT/port:PORT_LIST/port:name) or " + + "(starts-with(substring-before(current(), '.'), 'Eth') and " + + "concat('Ethernet', substring-after(substring-before(current(), '.'), 'Eth')) = /port:sonic-port/port:PORT/port:PORT_LIST/port:name) or " + + "(starts-with(substring-before(current(), '.'), 'Po') and " + + "concat('PortChannel', substring-after(substring-before(current(), '.'), 'Po')) = /lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name)" + { + error-message "Must condition not satisfied, please follow vlan sub interface naming convention"; + } + + // check if the vlan sub interface have the form as . + // the vlan_id should be chosen from range [1, 4094] + type string { + pattern '(\w+)\.([1-9][0-9]{0,2}|[1-3][0-9]{3}|[4][0][0-8][0-9]|[4][0][9][0-4])'; + } + } + + leaf admin_status { + type stypes:admin_status; + } + + leaf vrf_name { + type leafref { + path "/vrf:sonic-vrf/vrf:VRF/vrf:VRF_LIST/vrf:name"; + } + } + } + + list VLAN_SUB_INTERFACE_IPPREFIX_LIST { + + description "VLAN_SUB_INTERFACE part of config_db.json with ip-prefix"; + + key "name ip-prefix"; + + leaf name { + type leafref { + path "../../VLAN_SUB_INTERFACE_LIST/name"; + } + } + + leaf ip-prefix { + type stypes:sonic-ip-prefix; + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-vlan.yang b/src/sonic-yang-models/yang-models/sonic-vlan.yang index c63bc6b46ac4..960f4b44c0d0 100644 --- a/src/sonic-yang-models/yang-models/sonic-vlan.yang +++ b/src/sonic-yang-models/yang-models/sonic-vlan.yang @@ -9,14 +9,16 @@ module sonic-vlan { prefix inet; } + import ietf-yang-types { + prefix yang; + } + import sonic-types { prefix stypes; - revision-date 2019-07-01; } import sonic-extension { prefix ext; - revision-date 2019-07-01; } import sonic-port { @@ -87,6 +89,18 @@ module sonic-vlan { enum disable; } } + + leaf grat_arp { + type string { + pattern "enabled|disabled"; + } + } + + leaf proxy_arp { + type string { + pattern "enabled|disabled"; + } + } } /* end of VLAN_INTERFACE_LIST */ @@ -157,6 +171,10 @@ module sonic-vlan { } } + leaf alias { + type string; + } + leaf description { type string { length 1..255; @@ -164,9 +182,15 @@ module sonic-vlan { } leaf-list dhcp_servers { + description "Configure the dhcp v4 servers"; type inet:ip-address; } + leaf-list dhcpv6_servers { + description "Configure the dhcp v6 servers"; + type inet:ipv6-address; + } + leaf mtu { type uint16 { range 1..9216; @@ -176,6 +200,10 @@ module sonic-vlan { leaf admin_status { type stypes:admin_status; } + + leaf mac { + type yang:mac-address; + } } /* end of VLAN_LIST */ } diff --git a/src/sonic-yang-models/yang-models/sonic-wred-profile.yang b/src/sonic-yang-models/yang-models/sonic-wred-profile.yang new file mode 100644 index 000000000000..2ca7be26ca0f --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-wred-profile.yang @@ -0,0 +1,177 @@ +module sonic-wred-profile { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-wred-profile"; + + prefix wrd; + + organization + "SONiC"; + + contact + "SONiC"; + + description + "WRED_PROFILE yang Module for SONiC OS"; + + revision 2021-04-01 { + description + "Initial revision."; + } + + container sonic-wred-profile { + + container WRED_PROFILE { + + description "WRED_PROFILE part of config_db.json"; + + list WRED_PROFILE_LIST { + + key "name"; + + leaf name { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; + length 1..32 { + error-message "Invalid length for wred profile name."; + error-app-tag wred-profile-name-invalid-length; + } + } + description "WRED profile name"; + } + + leaf yellow_min_threshold { + type uint64; + units bytes; + description "Yellow minimum threshold bytes"; + } + + leaf green_min_threshold { + type uint64; + units bytes; + description "Green minimum threshold bytes"; + } + + leaf red_min_threshold { + type uint64; + units bytes; + description "Red minimum threshold bytes"; + } + + leaf yellow_max_threshold { + type uint64; + units bytes; + must "(current() >= current()/../yellow_min_threshold)" { + error-message "Yellow max threshold must be greater than or equal to min threshold"; + } + description "Yellow maximum threshold bytes"; + } + + leaf green_max_threshold { + type uint64; + units bytes; + must "(current() >= current()/../green_min_threshold)" { + error-message "Green max threshold must be greater than or equal to min threshold"; + } + description "Green maximum threshold bytes"; + } + + leaf red_max_threshold { + type uint64; + units bytes; + must "(current() >= current()/../red_min_threshold)" { + error-message "Red max threshold must be greater than or equal to min threshold"; + } + description "Red maximum threshold bytes"; + } + + leaf ecn { + + type enumeration { + + enum ecn_none { + description "Disable ECN marking for all colors."; + } + + enum ecn_green { + description "Enable ECN marking for green color. Yellow and red are disabled."; + } + + enum ecn_yellow { + description "Enable ECN marking for yellow color. Green and red are disabled."; + } + + enum ecn_red { + description "Enable ECN marking for red color. Green and red are disabled."; + } + + enum ecn_green_yellow { + description "Enable ECN marking for green and yellow colors. Red is disabled."; + } + + enum ecn_green_red { + description "Enable ECN marking for green and red colors. Yellow is disabled."; + } + + enum ecn_yellow_red { + description "Enable ECN marking for yellow and red colors. Green is disabled."; + } + + enum ecn_all { + description "Enable ECN marking for all colors."; + + } + } + default ecn_none; + description "ECN mode"; + } + + leaf wred_green_enable { + type boolean; + default false; + description "Green enable"; + } + + leaf wred_yellow_enable { + type boolean; + default false; + description "Yellow enable"; + } + + leaf wred_red_enable { + type boolean; + default false; + description "Red enable"; + } + + leaf yellow_drop_probability { + type uint64 { + range "0..100"; + } + units percent; + default 100; + description "Yellow drop probability"; + } + + leaf green_drop_probability { + type uint64 { + range "0..100"; + } + units percent; + default 100; + description "Green drop probability"; + } + + leaf red_drop_probability { + type uint64 { + range "0..100"; + } + units percent; + default 100; + description "Red drop probability"; + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-acl.yang b/src/sonic-yang-models/yang-templates/sonic-acl.yang.j2 similarity index 66% rename from src/sonic-yang-models/yang-models/sonic-acl.yang rename to src/sonic-yang-models/yang-templates/sonic-acl.yang.j2 index 83318a744274..2a527aa2bcf9 100644 --- a/src/sonic-yang-models/yang-models/sonic-acl.yang +++ b/src/sonic-yang-models/yang-templates/sonic-acl.yang.j2 @@ -1,3 +1,8 @@ +{% if yang_model_type == "cvl" %} +/* this is sonic cvl yang model */ +{% else %} +/* this is sonic py yang model */ +{% endif %} module sonic-acl { yang-version 1.1; @@ -28,6 +33,10 @@ module sonic-acl { prefix lag; } + import sonic-mirror-session { + prefix sms; + } + description "ACL YANG Module for SONiC OS"; revision 2019-07-01 { @@ -60,18 +69,42 @@ module sonic-acl { type stypes:packet_action; } + /* Validating 'PACKET_ACTION' exist if ACL type is 'CTRLPLANE' */ + must "(not(../../ACL_TABLE/ACL_TABLE_LIST[ACL_TABLE_NAME=current()/ACL_TABLE_NAME]/type = 'CTRLPLANE')) or (boolean(PACKET_ACTION))"; + + leaf MIRROR_INGRESS_ACTION { + type leafref { + path "/sms:sonic-mirror-session/sms:MIRROR_SESSION/sms:MIRROR_SESSION_LIST/sms:name"; + } + } + + leaf MIRROR_EGRESS_ACTION { + type leafref { + path "/sms:sonic-mirror-session/sms:MIRROR_SESSION/sms:MIRROR_SESSION_LIST/sms:name"; + } + } + leaf IP_TYPE { type stypes:ip_type; } leaf PRIORITY { + mandatory true; type uint32 { range 0..999999; } } - choice ip_prefix { - + choice src_dst_address { + case l2_src_dst_address { + when "(/acl:sonic-acl/acl:ACL_TABLE/acl:ACL_TABLE_LIST[ACL_TABLE_NAME=current()/acl:ACL_TABLE_NAME]/acl:type = 'L2')"; + leaf SRC_MAC { + type stypes:mac-addr-and-mask; + } + leaf DST_MAC { + type stypes:mac-addr-and-mask; + } + } case ip4_prefix { when "boolean(IP_TYPE[.='ANY' or .='IP' or .='IPV4' or .='IPv4ANY' or .='ARP'])"; leaf SRC_IP { @@ -139,7 +172,7 @@ module sonic-acl { leaf ETHER_TYPE { type string { - pattern "(0x88CC|0x8100|0x8915|0x0806|0x0800|0x86DD|0x8847)"; + pattern "0x0[6-9a-fA-F][0-9a-fA-F]{2}|0x[1-9a-fA-F][0-9a-fA-F]{3}|153[6-9]|15[4-9][0-9]|1[6-9][0-9][0-9]|[2-9][0-9]{3}|[1-5][0-9]{4}|6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}"; } } @@ -215,11 +248,59 @@ module sonic-acl { leaf INNER_L4_DST_PORT { type uint16; } + + leaf VLAN_ID { + type uint16 { + range 1..4094; + } + } + + leaf PCP { + when "(/acl:sonic-acl/acl:ACL_TABLE/acl:ACL_TABLE_LIST[ACL_TABLE_NAME=current()/../acl:ACL_TABLE_NAME]/acl:type = 'L2')"; + type string { + pattern "[0-7]|[0-7]/[0-7]"; + } + } + + leaf DEI { + when "(/acl:sonic-acl/acl:ACL_TABLE/acl:ACL_TABLE_LIST[ACL_TABLE_NAME=current()/../acl:ACL_TABLE_NAME]/acl:type = 'L2')"; + type uint8 { + range "0..1"; + } + } } /* end of ACL_RULE_LIST */ } /* end of container ACL_RULE */ + container ACL_TABLE_TYPE { + list ACL_TABLE_TYPE_LIST { + key "ACL_TABLE_TYPE_NAME"; + + leaf ACL_TABLE_TYPE_NAME { + type string; + } + + leaf-list matches { + type string; + min-elements 1; + } + + leaf-list actions { + type string; + default ""; + } + + leaf-list bind_points { + type enumeration { + enum PORT; + enum LAG; + } + min-elements 1; + } + } + } + container ACL_TABLE { description "ACL_TABLE part of config_db.json"; @@ -240,7 +321,12 @@ module sonic-acl { leaf type { mandatory true; - type stypes:acl_table_type; + type union { + type leafref { + path "/acl:sonic-acl/acl:ACL_TABLE_TYPE/acl:ACL_TABLE_TYPE_LIST/acl:ACL_TABLE_TYPE_NAME"; + } + type stypes:acl_table_type; + } } leaf stage { @@ -254,6 +340,9 @@ module sonic-acl { type string; } + /* Validating 'services' exist if ACL type is 'CTRLPLANE' */ + must "(not(type = 'CTRLPLANE')) or (boolean(services))"; + leaf-list ports { /* union of leafref is allowed in YANG 1.1 */ type union { diff --git a/src/sonic-yang-models/yang-templates/sonic-extension.yang.j2 b/src/sonic-yang-models/yang-templates/sonic-extension.yang.j2 new file mode 100644 index 000000000000..142ef517b7c2 --- /dev/null +++ b/src/sonic-yang-models/yang-templates/sonic-extension.yang.j2 @@ -0,0 +1,41 @@ +module sonic-extension { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-extension"; + prefix sonic-extension; + + description "Extension yang Module for SONiC OS"; + + revision 2019-07-01 { + description "First Revision"; + } + + /* For complete guide of using these extensions in SONiC yangs, refer + SONiC yang guidelines at + https://github.com/Azure/SONiC/blob/master/doc/mgmt/SONiC_YANG_Model_Guidelines.md */ + + extension db-name { + description "DB name, e.g. APPL_DB, CONFIG_DB"; + argument "value"; + } + + {% if yang_model_type == "cvl" %} + extension custom-validation-cvl { + description "Extension for registering cvl based custom validation handler."; + argument "handler"; + } + + extension dependent-on { + description + "Extension to define dependency on other table. During CREATE/UPDATE, + the action will be performed first on the Parent table and then on the + Dependent table. In DELETE operation, the Dependent table will be + deleted first and then the Parent table. This extension can be defined + only under List nodes. Table name should always be suffixed with '_LIST' + as modeled in yang. e.g. - dependent-on STP_LIST"; + argument "value"; + } + {% else %} + {% endif %} +} diff --git a/src/sonic-yang-models/yang-templates/sonic-policer.yang.j2 b/src/sonic-yang-models/yang-templates/sonic-policer.yang.j2 new file mode 100644 index 000000000000..a8c6f1445a46 --- /dev/null +++ b/src/sonic-yang-models/yang-templates/sonic-policer.yang.j2 @@ -0,0 +1,129 @@ +{% if yang_model_type == "cvl" %} +/* this is sonic cvl yang model */ +{% else %} +/* this is sonic py yang model */ +{% endif %} +module sonic-policer { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-policer"; + prefix policer; + + import sonic-types { + prefix stypes; + } + + description "Policer YANG Module for SONiC OS"; + + revision 2022-02-03 { + description + "First Revision"; + } + + container sonic-policer { + container POLICER { + list POLICER_LIST { + key name; + + leaf name { + type string; + description "Policer name"; + } + + leaf meter_type { + mandatory true; + type stypes:meter_type; + description "Policer meter type"; + } + + leaf mode { + mandatory true; + type stypes:policer_mode; + description "Policer mode"; + } + + leaf color { + type stypes:policer_color_source; + description "Policer color Source"; + } + + leaf cir { + type uint64; + default 0; + description + "Committed information rate for the dual-rate token + bucket policer. This value represents the rate at which + tokens are added to the primary bucket. Unit is bytes/sec + or packets/sec based on meter_type"; + } + + leaf cbs { + must "((current()/../cir) and (current()/../cir > 0))" { + error-message "cbs can't be configured without cir."; + } + must "(current() >= current()/../cir)" { + error-message "cbs must be greater than or equal to cir"; + } + type uint64; + default 0; + description + "Committed burst size for the dual-rate token bucket + policer. This value represents the depth of the token + bucket. Unit is bytes or packets based on meter_type"; + } + + leaf pir { + when "current()/../mode = 'tr_tcm'"; + must "((current()/../cir) and (current()/../cir > 0))" { + error-message "pir can't be configured without cir."; + } + must "(current() >= current()/../cir)" { + error-message "pir must be greater than or equal to cir"; + } + type uint64; + description + "Peak information rate for the dual-rate token bucket + policer. This value represents the rate at which tokens + are added to the secondary bucket. Unit is bytes/sec or + packets/sec based on meter_type"; + } + + leaf pbs { + when "((current()/../mode = 'sr_tcm') or (current()/../mode = 'tr_tcm'))"; + must "((not(current()/../cbs)) or (current() >= current()/../cbs))" { + error-message "pbs must be greater than or equal to cbs"; + } + type uint64; + description + "Excess burst size for the dual-rate token bucket policer. + This value represents the depth of the secondary bucket. Unit + is bytes or packets based on meter_type"; + } + + leaf green_packet_action { + type stypes:policer_packet_action; + default "forward"; + description "Green action"; + } + + leaf yellow_packet_action { + when "((current()/../mode = 'sr_tcm') or (current()/../mode = 'tr_tcm'))"; + type stypes:policer_packet_action; + default "forward"; + description "Yellow action"; + } + + leaf red_packet_action { + type stypes:policer_packet_action; + default "forward"; + description "Red action"; + } + } + /* end of list POLICER_LIST */ + } + /* end of container POLICER */ + } + /* end of top level container */ +} +/* end of module sonic-policer */ diff --git a/src/sonic-yang-models/yang-models/sonic-types.yang b/src/sonic-yang-models/yang-templates/sonic-types.yang.j2 similarity index 64% rename from src/sonic-yang-models/yang-models/sonic-types.yang rename to src/sonic-yang-models/yang-templates/sonic-types.yang.j2 index ac3ceb805ff2..da043fa8761d 100644 --- a/src/sonic-yang-models/yang-models/sonic-types.yang +++ b/src/sonic-yang-models/yang-templates/sonic-types.yang.j2 @@ -61,6 +61,7 @@ module sonic-types { typedef packet_action{ type enumeration { enum DROP; + enum ACCEPT; enum FORWARD; enum REDIRECT; enum DO_NOT_NAT; @@ -129,7 +130,7 @@ module sonic-types { enum UDP; } } - + typedef interface_type { type enumeration { enum CR; @@ -151,28 +152,76 @@ module sonic-types { enum XAUI; enum XFI; enum XGMII; + enum none; } } - typedef tpid_type { - type string { - pattern "0x8100|0x9100|0x9200|0x88a8|0x88A8"; + typedef oper-status { + type enumeration { + enum unknown; + enum up; + enum down; + } + description "Operational status of an entity such as Port, MCLAG etc"; + } + + typedef mode-status { + type enumeration { + enum enable; + enum disable; + } + description + "This type can be used where toggle functionality required. + For ex. IPv6-link-local-only, Dhcp-replay-link-select, SNMP traps etc"; + } + + typedef dhcp-relay-policy-action { + type enumeration { + enum discard; + enum append; + enum replace; + } + description "DHCP relay policy action value"; + } + + typedef percentage { + type uint8 { + range "0..100"; } + description + "Integer indicating a percentage value"; } - typedef feature_state { + typedef tpid_type { type string { - pattern "enabled|disabled|always_enabled"; + pattern "0x8100|0x9100|0x9200|0x88a8|0x88A8"; } } + typedef meter_type { type enumeration { - enum packets; + enum packets; enum bytes; } } - typedef copp_packet_action { + typedef policer_mode { + type enumeration { + enum sr_tcm; + enum tr_tcm; + enum storm; + } + } + + typedef policer_color_source { + type enumeration { + enum aware; + enum blind; + } + } + + + typedef policer_packet_action { type enumeration { enum drop; enum forward; @@ -183,5 +232,44 @@ module sonic-types { enum deny; enum transit; } - } + } + + typedef boolean_type { + type string { + pattern "false|true|False|True"; + } + } + + typedef mac-addr-and-mask { + type string { + pattern "[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}|[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}/[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}"; + } + } + + typedef hostname { + type string { + length 1..63; + } + } + + {% if yang_model_type == "cvl" %} + /* Required for CVL */ + container operation { + description + "This definition is used internally by CVL and + is not exposed in NBI. Leaf 'operation' allows + evaluation of must expression for + CREATE/UPDATE/DELETE operation."; + + leaf operation { + type enumeration { + enum NOP; + enum CREATE; + enum UPDATE; + enum DELETE; + } + } + } + {% else %} + {% endif %} } diff --git a/src/sonic-ztp b/src/sonic-ztp index 4475750df0f4..f7dd3c54ec57 160000 --- a/src/sonic-ztp +++ b/src/sonic-ztp @@ -1 +1 @@ -Subproject commit 4475750df0f4db12c6e23cb59a50b47315d142db +Subproject commit f7dd3c54ec57848f7cb6d3eec748a4d8e54d0e6c diff --git a/src/system-health/health_checker/manager.py b/src/system-health/health_checker/manager.py index f31e482e336a..b1c6dd15bec3 100644 --- a/src/system-health/health_checker/manager.py +++ b/src/system-health/health_checker/manager.py @@ -1,16 +1,18 @@ +from .config import Config +from .health_checker import HealthChecker +from .service_checker import ServiceChecker +from .hardware_checker import HardwareChecker +from .user_defined_checker import UserDefinedChecker + + class HealthCheckerManager(object): """ Manage all system health checkers and system health configuration. """ - STATE_BOOTING = 'booting' - STATE_RUNNING = 'running' boot_timeout = None def __init__(self): self._checkers = [] - self._state = self.STATE_BOOTING - - from .config import Config self.config = Config() self.initialize() @@ -19,8 +21,6 @@ def initialize(self): Initialize the manager. Create service checker and hardware checker by default. :return: """ - from .service_checker import ServiceChecker - from .hardware_checker import HardwareChecker self._checkers.append(ServiceChecker()) self._checkers.append(HardwareChecker()) @@ -28,24 +28,16 @@ def check(self, chassis): """ Load new configuration if any and perform the system health check for all existing checkers. :param chassis: A chassis object. - :return: A tuple. The first element indicate the status of the checker; the second element is a dictionary that - contains the status for all objects that was checked. + :return: A dictionary that contains the status for all objects that was checked. """ - from .health_checker import HealthChecker HealthChecker.summary = HealthChecker.STATUS_OK stats = {} self.config.load_config() - # check state first to avoid user change boot timeout in configuration file - # after finishing system boot - if self._state == self.STATE_BOOTING and self._is_system_booting(): - self._set_system_led(chassis, self.config, 'booting') - return self._state, stats for checker in self._checkers: self._do_check(checker, stats) if self.config.user_defined_checkers: - from .user_defined_checker import UserDefinedChecker for udc in self.config.user_defined_checkers: checker = UserDefinedChecker(udc) self._do_check(checker, stats) @@ -53,7 +45,7 @@ def check(self, chassis): led_status = 'normal' if HealthChecker.summary == HealthChecker.STATUS_OK else 'fault' self._set_system_led(chassis, self.config, led_status) - return self._state, stats + return stats def _do_check(self, checker, stats): """ @@ -71,27 +63,18 @@ def _do_check(self, checker, stats): else: stats[category].update(info) except Exception as e: - from .health_checker import HealthChecker + HealthChecker.summary = HealthChecker.STATUS_NOT_OK error_msg = 'Failed to perform health check for {} due to exception - {}'.format(checker, repr(e)) entry = {str(checker): { HealthChecker.INFO_FIELD_OBJECT_STATUS: HealthChecker.STATUS_NOT_OK, - HealthChecker.INFO_FIELD_OBJECT_MSG: error_msg + HealthChecker.INFO_FIELD_OBJECT_MSG: error_msg, + HealthChecker.INFO_FIELD_OBJECT_TYPE: "Internal" }} if 'Internal' not in stats: stats['Internal'] = entry else: stats['Internal'].update(entry) - def _is_system_booting(self): - from .utils import get_uptime - uptime = get_uptime() - if not self.boot_timeout: - self.boot_timeout = self.config.get_bootup_timeout() - booting = uptime < self.boot_timeout - if not booting: - self._state = self.STATE_RUNNING - return booting - def _set_system_led(self, chassis, config, status): try: chassis.set_status_led(config.get_led_color(status)) diff --git a/src/system-health/health_checker/service_checker.py b/src/system-health/health_checker/service_checker.py index a98e2d33c3ad..6918da0b9f0e 100644 --- a/src/system-health/health_checker/service_checker.py +++ b/src/system-health/health_checker/service_checker.py @@ -1,12 +1,31 @@ +import docker +import os +import pickle +import re + +from swsscommon import swsscommon +from sonic_py_common import multi_asic +from sonic_py_common.logger import Logger from .health_checker import HealthChecker from . import utils +SYSLOG_IDENTIFIER = 'service_checker' +logger = Logger(log_identifier=SYSLOG_IDENTIFIER) + class ServiceChecker(HealthChecker): """ Checker that checks critical system service status via monit service. """ + # Cache file to save container_critical_processes + CRITICAL_PROCESS_CACHE = '/tmp/critical_process_cache' + + CRITICAL_PROCESSES_PATH = 'etc/supervisor/critical_processes' + + # Command to get merged directory of a container + GET_CONTAINER_FOLDER_CMD = 'docker inspect {} --format "{{{{.GraphDriver.Data.MergedDir}}}}"' + # Command to query the status of monit service. CHECK_MONIT_SERVICE_CMD = 'systemctl is-active monit.service' @@ -24,6 +43,162 @@ class ServiceChecker(HealthChecker): def __init__(self): HealthChecker.__init__(self) + self.container_critical_processes = {} + # Containers that has invalid critical_processes file + self.bad_containers = set() + + self.container_feature_dict = {} + + self.need_save_cache = False + + self.config_db = None + + self.load_critical_process_cache() + + def get_expected_running_containers(self, feature_table): + """Get a set of containers that are expected to running on SONiC + + Args: + feature_table (object): FEATURE table in CONFIG_DB + + Returns: + expected_running_containers: A set of container names that are expected running + container_feature_dict: A dictionary {:} + """ + expected_running_containers = set() + container_feature_dict = {} + for feature_name, feature_entry in feature_table.items(): + if feature_entry["state"] not in ["disabled", "always_disabled"]: + if multi_asic.is_multi_asic(): + if feature_entry["has_global_scope"] == "True": + expected_running_containers.add(feature_name) + container_feature_dict[feature_name] = feature_name + if feature_entry["has_per_asic_scope"] == "True": + num_asics = multi_asic.get_num_asics() + for asic_id in range(num_asics): + expected_running_containers.add(feature_name + str(asic_id)) + container_feature_dict[feature_name + str(asic_id)] = feature_name + else: + expected_running_containers.add(feature_name) + container_feature_dict[feature_name] = feature_name + + return expected_running_containers, container_feature_dict + + def get_current_running_containers(self): + """Get current running containers, if the running container is not in self.container_critical_processes, + try get the critical process list + + Returns: + running_containers: A set of running container names + """ + DOCKER_CLIENT = docker.DockerClient(base_url='unix://var/run/docker.sock') + running_containers = set() + ctrs = DOCKER_CLIENT.containers + try: + lst = ctrs.list(filters={"status": "running"}) + + for ctr in lst: + running_containers.add(ctr.name) + if ctr.name not in self.container_critical_processes: + self.fill_critical_process_by_container(ctr.name) + except docker.errors.APIError as err: + logger.log_error("Failed to retrieve the running container list. Error: '{}'".format(err)) + + return running_containers + + def get_critical_process_list_from_file(self, container, critical_processes_file): + """Read critical process name list from critical processes file + + Args: + container (str): contianer name + critical_processes_file (str): critical processes file path + + Returns: + critical_process_list: A list of critical process names + """ + critical_process_list = [] + + with open(critical_processes_file, 'r') as file: + for line in file: + # Try to match a line like "program:" + match = re.match(r"^\s*((.+):(.*))*\s*$", line) + if match is None: + if container not in self.bad_containers: + self.bad_containers.add(container) + logger.log_error('Invalid syntax in critical_processes file of {}'.format(container)) + continue + + identifier_key = match.group(2).strip() + identifier_value = match.group(3).strip() + if identifier_key == "program" and identifier_value: + critical_process_list.append(identifier_value) + + return critical_process_list + + def fill_critical_process_by_container(self, container): + """Get critical process for a given container + + Args: + container (str): container name + """ + # Get container volumn folder + container_folder = self._get_container_folder(container) + if not container_folder: + logger.log_error('Failed to get container folder for {}'.format(container_folder)) + return + + if not os.path.exists(container_folder): + logger.log_error('Container folder does not exist: {}'.format(container_folder)) + return + + # Get critical_processes file path + critical_processes_file = os.path.join(container_folder, ServiceChecker.CRITICAL_PROCESSES_PATH) + if not os.path.isfile(critical_processes_file): + # Critical process file does not exist, the container has no critical processes. + logger.log_debug('Failed to get critical process file for {}, {} does not exist'.format(container, critical_processes_file)) + self._update_container_critical_processes(container, []) + return + + # Get critical process list from critical_processes + critical_process_list = self.get_critical_process_list_from_file(container, critical_processes_file) + self._update_container_critical_processes(container, critical_process_list) + + def _update_container_critical_processes(self, container, critical_process_list): + self.container_critical_processes[container] = critical_process_list + self.need_save_cache = True + + def _get_container_folder(self, container): + container_folder = utils.run_command(ServiceChecker.GET_CONTAINER_FOLDER_CMD.format(container)) + if container_folder is None: + return container_folder + + return container_folder.strip() + + def save_critical_process_cache(self): + """Save self.container_critical_processes to a cache file + """ + if not self.need_save_cache: + return + + self.need_save_cache = False + if not self.container_critical_processes: + # if container_critical_processes is empty, don't save it + return + + if os.path.exists(ServiceChecker.CRITICAL_PROCESS_CACHE): + # if cache file exists, remove it + os.remove(ServiceChecker.CRITICAL_PROCESS_CACHE) + + with open(ServiceChecker.CRITICAL_PROCESS_CACHE, 'wb+') as f: + pickle.dump(self.container_critical_processes, f) + + def load_critical_process_cache(self): + if not os.path.isfile(ServiceChecker.CRITICAL_PROCESS_CACHE): + # cache file does not exist + return + + with open(ServiceChecker.CRITICAL_PROCESS_CACHE, 'rb') as f: + self.container_critical_processes = pickle.load(f) def reset(self): self._info = {} @@ -31,23 +206,21 @@ def reset(self): def get_category(self): return 'Services' - def check(self, config): + def check_by_monit(self, config): """ - Check critical system service status. Get and analyze the output of $CHECK_CMD, collect status for system, - process and file system. + et and analyze the output of $CHECK_CMD, collect status for file system or customize checker if any. :param config: Health checker configuration. :return: """ - self.reset() - output = utils.run_command(ServiceChecker.CHECK_MONIT_SERVICE_CMD).strip() - if output != 'active': + output = utils.run_command(ServiceChecker.CHECK_MONIT_SERVICE_CMD) + if not output or output.strip() != 'active': self.set_object_not_ok('Service', 'monit', 'monit service is not running') return output = utils.run_command(ServiceChecker.CHECK_CMD) lines = output.splitlines() if not lines or len(lines) < ServiceChecker.MIN_CHECK_CMD_LINES: - self.set_object_not_ok('Service', 'monit', 'output of \"monit summary -B\" is invalid or incompatible') + self.set_object_not_ok('Service', 'monit', 'monit service is not ready') return status_begin = lines[1].find('Status') @@ -58,7 +231,7 @@ def check(self, config): for line in lines[2:]: name = line[0:status_begin].strip() - if config.ignore_services and name in config.ignore_services: + if config and config.ignore_services and name in config.ignore_services: continue status = line[status_begin:type_begin].strip() service_type = line[type_begin:].strip() @@ -70,3 +243,106 @@ def check(self, config): else: self.set_object_ok(service_type, name) return + + def check_services(self, config): + """Check status of critical services and critical processes + + Args: + config (config.Config): Health checker configuration. + """ + if not self.config_db: + self.config_db = swsscommon.ConfigDBConnector() + self.config_db.connect() + feature_table = self.config_db.get_table("FEATURE") + expected_running_containers, self.container_feature_dict = self.get_expected_running_containers(feature_table) + current_running_containers = self.get_current_running_containers() + + newly_disabled_containers = set(self.container_critical_processes.keys()).difference(expected_running_containers) + for newly_disabled_container in newly_disabled_containers: + self.container_critical_processes.pop(newly_disabled_container) + + self.save_critical_process_cache() + + not_running_containers = expected_running_containers.difference(current_running_containers) + for container in not_running_containers: + self.set_object_not_ok('Service', container, "Container '{}' is not running".format(container)) + + if not self.container_critical_processes: + # Critical process is empty, not expect + self.set_object_not_ok('Service', 'system', 'no critical process found') + return + + for container, critical_process_list in self.container_critical_processes.items(): + self.check_process_existence(container, critical_process_list, config, feature_table) + + for bad_container in self.bad_containers: + self.set_object_not_ok('Service', bad_container, 'Syntax of critical_processes file is incorrect') + + def check(self, config): + """Check critical system service status. + + Args: + config (object): Health checker configuration. + """ + self.reset() + self.check_by_monit(config) + self.check_services(config) + + + def _parse_supervisorctl_status(self, process_status): + """Expected input: + arp_update RUNNING pid 67, uptime 1:03:56 + buffermgrd RUNNING pid 81, uptime 1:03:56 + + Args: + process_status (list): List of process status + """ + data = {} + for line in process_status: + line = line.strip() + if not line: + continue + items = line.split() + if len(items) < 2: + continue + data[items[0].strip()] = items[1].strip() + return data + + def check_process_existence(self, container_name, critical_process_list, config, feature_table): + """Check whether the process in the specified container is running or not. + + Args: + container_name (str): Container name + critical_process_list (list): Critical processes + config (object): Health checker configuration. + feature_table (object): Feature table + """ + feature_name = self.container_feature_dict[container_name] + if feature_name in feature_table: + # We look into the 'FEATURE' table to verify whether the container is disabled or not. + # If the container is diabled, we exit. + if ("state" in feature_table[feature_name] + and feature_table[feature_name]["state"] not in ["disabled", "always_disabled"]): + + # We are using supervisorctl status to check the critical process status. We cannot leverage psutil here because + # it not always possible to get process cmdline in supervisor.conf. E.g, cmdline of orchagent is "/usr/bin/orchagent", + # however, in supervisor.conf it is "/usr/bin/orchagent.sh" + cmd = 'docker exec {} bash -c "supervisorctl status"'.format(container_name) + process_status = utils.run_command(cmd) + if process_status is None: + for process_name in critical_process_list: + self.set_object_not_ok('Process', '{}:{}'.format(container_name, process_name), "'{}' is not running".format(process_name)) + return + + process_status = self._parse_supervisorctl_status(process_status.strip().splitlines()) + for process_name in critical_process_list: + if config and config.ignore_services and process_name in config.ignore_services: + continue + + # Sometimes process_name is in critical_processes file, but it is not in supervisor.conf, such process will not run in container. + # and it is safe to ignore such process. E.g, radv. So here we only check those processes which are in process_status. + if process_name in process_status: + if process_status[process_name] != 'RUNNING': + self.set_object_not_ok('Process', '{}:{}'.format(container_name, process_name), "'{}' is not running".format(process_name)) + else: + self.set_object_ok('Process', '{}:{}'.format(container_name, process_name)) diff --git a/src/system-health/health_checker/utils.py b/src/system-health/health_checker/utils.py index f310002e1e5f..00e7754e1ec2 100644 --- a/src/system-health/health_checker/utils.py +++ b/src/system-health/health_checker/utils.py @@ -8,7 +8,7 @@ def run_command(command): :return: Output of the shell command. """ try: - process = subprocess.Popen(command, shell=True, universal_newlines=True, stdout=subprocess.PIPE) + process = subprocess.Popen(command, shell=True, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return process.communicate()[0] except Exception: return None diff --git a/src/system-health/scripts/healthd b/src/system-health/scripts/healthd index da0258bb59e5..dd276df2fafd 100644 --- a/src/system-health/scripts/healthd +++ b/src/system-health/scripts/healthd @@ -18,7 +18,7 @@ SYSLOG_IDENTIFIER = 'healthd' class HealthDaemon(DaemonBase): """ - A daemon that run as a service to perform system health checker with a configurable interval. Also set system LED + A daemon that run as a service to perform system health checker with a configurable interval. Also set system LED according to the check result and store the check result to redis. """ SYSTEM_HEALTH_TABLE_NAME = 'SYSTEM_HEALTH_INFO' @@ -35,7 +35,7 @@ class HealthDaemon(DaemonBase): def deinit(self): """ Destructor. Remove all entries in $SYSTEM_HEALTH_TABLE_NAME table. - :return: + :return: """ self._clear_system_health_table() @@ -64,7 +64,7 @@ class HealthDaemon(DaemonBase): def run(self): """ Check system health in an infinite loop. - :return: + :return: """ self.log_notice("Starting up...") @@ -76,9 +76,8 @@ class HealthDaemon(DaemonBase): self.log_warning("System health configuration file not found, exit...") return while 1: - state, stat = manager.check(chassis) - if state == HealthCheckerManager.STATE_RUNNING: - self._process_stat(chassis, manager.config, stat) + stat = manager.check(chassis) + self._process_stat(chassis, manager.config, stat) if self.stop_event.wait(manager.config.interval): break diff --git a/src/system-health/setup.py b/src/system-health/setup.py index b0cc998e482f..62b02252e8c0 100644 --- a/src/system-health/setup.py +++ b/src/system-health/setup.py @@ -3,6 +3,7 @@ dependencies = [ 'natsort', 'sonic_py_common', + 'docker' ] setup( diff --git a/src/system-health/tests/etc/supervisor/critical_processes b/src/system-health/tests/etc/supervisor/critical_processes new file mode 100644 index 000000000000..cff479d7fa11 --- /dev/null +++ b/src/system-health/tests/etc/supervisor/critical_processes @@ -0,0 +1,2 @@ +program:snmpd +program:snmp-subagent diff --git a/src/system-health/tests/system_health_monitoring_config.json b/src/system-health/tests/system_health_monitoring_config.json new file mode 100644 index 000000000000..7284be7d163b --- /dev/null +++ b/src/system-health/tests/system_health_monitoring_config.json @@ -0,0 +1,11 @@ +{ + "services_to_ignore": ["dummy_service"], + "devices_to_ignore": ["psu.voltage"], + "user_defined_checkers": [], + "polling_interval": 60, + "led_color": { + "fault": "orange", + "normal": "green", + "booting": "orange_blink" + } +} diff --git a/src/system-health/tests/test_system_health.py b/src/system-health/tests/test_system_health.py index 8e3d3c77e9f1..14d58c0f44b5 100644 --- a/src/system-health/tests/test_system_health.py +++ b/src/system-health/tests/test_system_health.py @@ -8,6 +8,7 @@ 2. HealthCheckerManager 3. Config """ +import copy import os import sys from swsscommon import swsscommon @@ -30,11 +31,21 @@ from health_checker.service_checker import ServiceChecker from health_checker.user_defined_checker import UserDefinedChecker +mock_supervisorctl_output = """ +snmpd RUNNING pid 67, uptime 1:03:56 +snmp-subagent EXITED Oct 19 01:53 AM +""" device_info.get_platform = MagicMock(return_value='unittest') -def test_user_defined_checker(): - utils.run_command = MagicMock(return_value='') +def setup(): + if os.path.exists(ServiceChecker.CRITICAL_PROCESS_CACHE): + os.remove(ServiceChecker.CRITICAL_PROCESS_CACHE) + + +@patch('health_checker.utils.run_command') +def test_user_defined_checker(mock_run): + mock_run.return_value = '' checker = UserDefinedChecker('') checker.check(None) @@ -43,29 +54,195 @@ def test_user_defined_checker(): checker.reset() assert len(checker._info) == 0 - utils.run_command = MagicMock(return_value='\n\n\n') + mock_run.return_value = '\n\n\n' checker.check(None) assert checker._info[str(checker)][HealthChecker.INFO_FIELD_OBJECT_STATUS] == HealthChecker.STATUS_NOT_OK valid_output = 'MyCategory\nDevice1:OK\nDevice2:Device2 is broken\n' - utils.run_command = MagicMock(return_value=valid_output) + mock_run.return_value = valid_output checker.check(None) + assert checker.get_category() == 'MyCategory' assert 'Device1' in checker._info assert 'Device2' in checker._info assert checker._info['Device1'][HealthChecker.INFO_FIELD_OBJECT_STATUS] == HealthChecker.STATUS_OK assert checker._info['Device2'][HealthChecker.INFO_FIELD_OBJECT_STATUS] == HealthChecker.STATUS_NOT_OK -def test_service_checker(): - return_value = '' +@patch('swsscommon.swsscommon.ConfigDBConnector.connect', MagicMock()) +@patch('health_checker.service_checker.ServiceChecker._get_container_folder', MagicMock(return_value=test_path)) +@patch('sonic_py_common.multi_asic.is_multi_asic', MagicMock(return_value=False)) +@patch('docker.DockerClient') +@patch('health_checker.utils.run_command') +@patch('swsscommon.swsscommon.ConfigDBConnector') +def test_service_checker_single_asic(mock_config_db, mock_run, mock_docker_client): + mock_db_data = MagicMock() + mock_get_table = MagicMock() + mock_db_data.get_table = mock_get_table + mock_config_db.return_value = mock_db_data + mock_get_table.return_value = { + 'snmp': { + 'state': 'enabled', + 'has_global_scope': 'True', + 'has_per_asic_scope': 'False', + + } + } + mock_containers = MagicMock() + mock_snmp_container = MagicMock() + mock_snmp_container.name = 'snmp' + mock_containers.list = MagicMock(return_value=[mock_snmp_container]) + mock_docker_client_object = MagicMock() + mock_docker_client.return_value = mock_docker_client_object + mock_docker_client_object.containers = mock_containers + + mock_run.return_value = mock_supervisorctl_output + + checker = ServiceChecker() + assert checker.get_category() == 'Services' + config = Config() + checker.check(config) + assert 'snmp:snmpd' in checker._info + assert checker._info['snmp:snmpd'][HealthChecker.INFO_FIELD_OBJECT_STATUS] == HealthChecker.STATUS_OK + + assert 'snmp:snmp-subagent' in checker._info + assert checker._info['snmp:snmp-subagent'][HealthChecker.INFO_FIELD_OBJECT_STATUS] == HealthChecker.STATUS_NOT_OK + + mock_get_table.return_value = { + 'new_service': { + 'state': 'enabled', + 'has_global_scope': 'True', + 'has_per_asic_scope': 'False', + }, + 'snmp': { + 'state': 'enabled', + 'has_global_scope': 'True', + 'has_per_asic_scope': 'False', + + } + } + mock_ns_container = MagicMock() + mock_ns_container.name = 'new_service' + mock_containers.list = MagicMock(return_value=[mock_snmp_container, mock_ns_container]) + checker.check(config) + assert 'new_service' in checker.container_critical_processes + + assert 'new_service:snmpd' in checker._info + assert checker._info['new_service:snmpd'][HealthChecker.INFO_FIELD_OBJECT_STATUS] == HealthChecker.STATUS_OK + + assert 'new_service:snmp-subagent' in checker._info + assert checker._info['new_service:snmp-subagent'][HealthChecker.INFO_FIELD_OBJECT_STATUS] == HealthChecker.STATUS_NOT_OK + + mock_containers.list = MagicMock(return_value=[mock_snmp_container]) + checker.check(config) + assert 'new_service' in checker._info + assert checker._info['new_service'][HealthChecker.INFO_FIELD_OBJECT_STATUS] == HealthChecker.STATUS_NOT_OK + + mock_containers.list = MagicMock(return_value=[mock_snmp_container, mock_ns_container]) + mock_run.return_value = None + checker.check(config) + assert 'new_service:snmpd' in checker._info + assert checker._info['new_service:snmpd'][HealthChecker.INFO_FIELD_OBJECT_STATUS] == HealthChecker.STATUS_NOT_OK + + assert 'new_service:snmp-subagent' in checker._info + assert checker._info['new_service:snmp-subagent'][HealthChecker.INFO_FIELD_OBJECT_STATUS] == HealthChecker.STATUS_NOT_OK + + origin_container_critical_processes = copy.deepcopy(checker.container_critical_processes) + checker.save_critical_process_cache() + checker.load_critical_process_cache() + assert origin_container_critical_processes == checker.container_critical_processes + + + +@patch('swsscommon.swsscommon.ConfigDBConnector.connect', MagicMock()) +@patch('health_checker.service_checker.ServiceChecker._get_container_folder', MagicMock(return_value=test_path)) +@patch('health_checker.utils.run_command', MagicMock(return_value=mock_supervisorctl_output)) +@patch('sonic_py_common.multi_asic.get_num_asics', MagicMock(return_value=3)) +@patch('sonic_py_common.multi_asic.is_multi_asic', MagicMock(return_value=True)) +@patch('sonic_py_common.multi_asic.get_namespace_list', MagicMock(return_value=[str(x) for x in range(3)])) +@patch('sonic_py_common.multi_asic.get_current_namespace', MagicMock(return_value='')) +@patch('docker.DockerClient') +@patch('swsscommon.swsscommon.ConfigDBConnector') +def test_service_checker_multi_asic(mock_config_db, mock_docker_client): + mock_db_data = MagicMock() + mock_db_data.get_table = MagicMock() + mock_config_db.return_value = mock_db_data + + mock_db_data.get_table.return_value = { + 'snmp': { + 'state': 'enabled', + 'has_global_scope': 'True', + 'has_per_asic_scope': 'True', + + } + } + + mock_containers = MagicMock() + mock_snmp_container = MagicMock() + mock_snmp_container.name = 'snmp' + list_return_value = [mock_snmp_container] + for i in range(3): + mock_container = MagicMock() + mock_container.name = 'snmp' + str(i) + list_return_value.append(mock_container) + + mock_containers.list = MagicMock(return_value=list_return_value) + mock_docker_client_object = MagicMock() + mock_docker_client.return_value = mock_docker_client_object + mock_docker_client_object.containers = mock_containers - def mock_run_command(cmd): - if cmd == ServiceChecker.CHECK_MONIT_SERVICE_CMD: - return 'active' - else: - return return_value + checker = ServiceChecker() - utils.run_command = mock_run_command + config = Config() + checker.check(config) + assert 'snmp' in checker.container_critical_processes + assert 'snmp:snmpd' in checker._info + assert checker._info['snmp:snmpd'][HealthChecker.INFO_FIELD_OBJECT_STATUS] == HealthChecker.STATUS_OK + assert 'snmp0:snmpd' in checker._info + assert checker._info['snmp0:snmpd'][HealthChecker.INFO_FIELD_OBJECT_STATUS] == HealthChecker.STATUS_OK + assert 'snmp1:snmpd' in checker._info + assert checker._info['snmp1:snmpd'][HealthChecker.INFO_FIELD_OBJECT_STATUS] == HealthChecker.STATUS_OK + assert 'snmp2:snmpd' in checker._info + assert checker._info['snmp2:snmpd'][HealthChecker.INFO_FIELD_OBJECT_STATUS] == HealthChecker.STATUS_OK + + assert 'snmp:snmp-subagent' in checker._info + assert checker._info['snmp:snmp-subagent'][HealthChecker.INFO_FIELD_OBJECT_STATUS] == HealthChecker.STATUS_NOT_OK + assert 'snmp0:snmp-subagent' in checker._info + assert checker._info['snmp0:snmp-subagent'][HealthChecker.INFO_FIELD_OBJECT_STATUS] == HealthChecker.STATUS_NOT_OK + assert 'snmp1:snmp-subagent' in checker._info + assert checker._info['snmp1:snmp-subagent'][HealthChecker.INFO_FIELD_OBJECT_STATUS] == HealthChecker.STATUS_NOT_OK + assert 'snmp2:snmp-subagent' in checker._info + assert checker._info['snmp2:snmp-subagent'][HealthChecker.INFO_FIELD_OBJECT_STATUS] == HealthChecker.STATUS_NOT_OK + + +@patch('swsscommon.swsscommon.ConfigDBConnector', MagicMock()) +@patch('swsscommon.swsscommon.ConfigDBConnector.connect', MagicMock()) +@patch('health_checker.service_checker.ServiceChecker.check_by_monit', MagicMock()) +@patch('docker.DockerClient') +@patch('swsscommon.swsscommon.ConfigDBConnector.get_table') +def test_service_checker_no_critical_process(mock_get_table, mock_docker_client): + mock_get_table.return_value = { + 'snmp': { + 'state': 'enabled', + 'has_global_scope': 'True', + 'has_per_asic_scope': 'True', + + } + } + mock_containers = MagicMock() + mock_containers.list = MagicMock(return_value=[]) + mock_docker_client_object = MagicMock() + mock_docker_client.return_value = mock_docker_client_object + mock_docker_client_object.containers = mock_containers + + checker = ServiceChecker() + config = Config() + checker.check(config) + assert 'system' in checker._info + assert checker._info['system'][HealthChecker.INFO_FIELD_OBJECT_STATUS] == HealthChecker.STATUS_NOT_OK + +@patch('health_checker.service_checker.ServiceChecker.check_services', MagicMock()) +@patch('health_checker.utils.run_command') +def test_service_checker_check_by_monit(mock_run): return_value = 'Monit 5.20.0 uptime: 3h 54m\n' \ 'Service Name Status Type\n' \ 'sonic Running System\n' \ @@ -74,7 +251,7 @@ def mock_run_command(cmd): 'orchagent Running Process\n' \ 'root-overlay Accessible Filesystem\n' \ 'var-log Is not accessible Filesystem\n' - + mock_run.side_effect = ['active', return_value] checker = ServiceChecker() config = Config() checker.check(config) @@ -185,6 +362,7 @@ def test_hardware_checker(): }) checker = HardwareChecker() + assert checker.get_category() == 'Hardware' config = Config() checker.check(config) @@ -217,3 +395,113 @@ def test_hardware_checker(): assert 'PSU 5' in checker._info assert checker._info['PSU 5'][HealthChecker.INFO_FIELD_OBJECT_STATUS] == HealthChecker.STATUS_NOT_OK + + +def test_config(): + config = Config() + config._config_file = os.path.join(test_path, Config.CONFIG_FILE) + + assert config.config_file_exists() + config.load_config() + assert config.interval == 60 + assert 'dummy_service' in config.ignore_services + assert 'psu.voltage' in config.ignore_devices + assert len(config.user_defined_checkers) == 0 + + assert config.get_led_color('fault') == 'orange' + assert config.get_led_color('normal') == 'green' + assert config.get_led_color('booting') == 'orange_blink' + assert config.get_bootup_timeout() == 300 + + config._reset() + assert not config.ignore_services + assert not config.ignore_devices + assert not config.user_defined_checkers + assert not config.config_data + + assert config.get_led_color('fault') == 'red' + assert config.get_led_color('normal') == 'green' + assert config.get_led_color('booting') == 'orange_blink' + + config._last_mtime = 1 + config._config_file = 'notExistFile' + config.load_config() + assert not config._last_mtime + + +@patch('swsscommon.swsscommon.ConfigDBConnector', MagicMock()) +@patch('swsscommon.swsscommon.ConfigDBConnector.connect', MagicMock()) +@patch('health_checker.service_checker.ServiceChecker.check', MagicMock()) +@patch('health_checker.hardware_checker.HardwareChecker.check', MagicMock()) +@patch('health_checker.user_defined_checker.UserDefinedChecker.check', MagicMock()) +@patch('swsscommon.swsscommon.ConfigDBConnector.get_table', MagicMock()) +@patch('health_checker.user_defined_checker.UserDefinedChecker.get_category', MagicMock(return_value='UserDefine')) +@patch('health_checker.user_defined_checker.UserDefinedChecker.get_info') +@patch('health_checker.service_checker.ServiceChecker.get_info') +@patch('health_checker.hardware_checker.HardwareChecker.get_info') +def test_manager(mock_hw_info, mock_service_info, mock_udc_info): + chassis = MagicMock() + chassis.set_status_led = MagicMock() + + manager = HealthCheckerManager() + manager.config.user_defined_checkers = ['some check'] + assert len(manager._checkers) == 2 + + mock_hw_info.return_value = { + 'ASIC': { + 'type': 'ASIC', + 'message': '', + 'status': 'OK' + }, + 'fan1': { + 'type': 'Fan', + 'message': '', + 'status': 'OK' + }, + } + mock_service_info.return_value = { + 'snmp:snmpd': { + 'type': 'Process', + 'message': '', + 'status': 'OK' + } + } + mock_udc_info.return_value = { + 'udc': { + 'type': 'Database', + 'message': '', + 'status': 'OK' + } + } + stat = manager.check(chassis) + assert 'Services' in stat + assert stat['Services']['snmp:snmpd']['status'] == 'OK' + + assert 'Hardware' in stat + assert stat['Hardware']['ASIC']['status'] == 'OK' + assert stat['Hardware']['fan1']['status'] == 'OK' + + assert 'UserDefine' in stat + assert stat['UserDefine']['udc']['status'] == 'OK' + + mock_hw_info.side_effect = RuntimeError() + mock_service_info.side_effect = RuntimeError() + mock_udc_info.side_effect = RuntimeError() + stat = manager.check(chassis) + assert 'Internal' in stat + assert stat['Internal']['ServiceChecker']['status'] == 'Not OK' + assert stat['Internal']['HardwareChecker']['status'] == 'Not OK' + assert stat['Internal']['UserDefinedChecker - some check']['status'] == 'Not OK' + + chassis.set_status_led.side_effect = NotImplementedError() + manager._set_system_led(chassis, manager.config, 'normal') + + chassis.set_status_led.side_effect = RuntimeError() + manager._set_system_led(chassis, manager.config, 'normal') + +def test_utils(): + output = utils.run_command('some invalid command') + assert not output + + output = utils.run_command('ls') + assert output diff --git a/src/systemd-sonic-generator/debian/rules b/src/systemd-sonic-generator/debian/rules index a482e044c808..212fdda16b1f 100755 --- a/src/systemd-sonic-generator/debian/rules +++ b/src/systemd-sonic-generator/debian/rules @@ -15,3 +15,9 @@ override_dh_auto_install: override_dh_gencontrol: dh_gencontrol -- -v$(PACKAGEVERSION) + +override_dh_auto_test: +ifneq "$(DEB_HOST_ARCH)" "armhf" + make test +endif + diff --git a/src/tacacs/.gitignore b/src/tacacs/.gitignore index 3e483805dfe3..c0a967a922de 100644 --- a/src/tacacs/.gitignore +++ b/src/tacacs/.gitignore @@ -1,5 +1,9 @@ * !.gitignore +audisp/* +!audisp/Makefile +!audisp/*.patch +!bash_tacplus/* nsm/* !nsm/Makefile !nsm/*.patch diff --git a/src/tacacs/audisp/Makefile b/src/tacacs/audisp/Makefile new file mode 100644 index 000000000000..6bf80cc67710 --- /dev/null +++ b/src/tacacs/audisp/Makefile @@ -0,0 +1,30 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = audisp-tacplus_$(AUDISP_TACPLUS_VERSION)_$(CONFIGURED_ARCH).deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Obtain audisp-tacplus + rm -rf ./audisp-tacplus + + git clone https://github.com/daveolson53/audisp-tacplus.git + + # checkout by sha1 + pushd ./audisp-tacplus + git checkout 559c9f22edd4f2dea0ecedffb3ad9502b12a75b6 + + # Apply patches + cp -r ../patches patches + quilt push -a + + # fix aclocal depency issue by run auto.sh + ./auto.sh + + # build package + dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) + popd + + mv $(DERIVED_TARGETS) $* $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) \ No newline at end of file diff --git a/src/tacacs/audisp/patches/0001-Porting-to-sonic.patch b/src/tacacs/audisp/patches/0001-Porting-to-sonic.patch new file mode 100644 index 000000000000..e9277dc7c5cd --- /dev/null +++ b/src/tacacs/audisp/patches/0001-Porting-to-sonic.patch @@ -0,0 +1,428 @@ +From 3a552cb456ebc233ef55970509a58a5c378acd7b Mon Sep 17 00:00:00 2001 +From: liuh-80 <58683130+liuh-80@users.noreply.github.com> +Date: Tue, 9 Nov 2021 16:34:12 +0800 +Subject: [PATCH 1/3] Porting to sonic. + +Fixed issue in this patch: +1. The upstream project using 'libtacplus-map' library to lookup_logname, remove that depency by implement by ourself because libtacplus-map not porting to sonic, also because the libnss-tacplus in sonic not using libtacplus-map for user name mapping, sonic using a different solution for user login handling. + +2. The libpam-tacplus been changed to support 'source address', which add new parameter to tacacs functions. + +3. Upstream project using a patched version of libpam_tacplus, so some method in that not exist in sonic version. + +4. For tacacs config file parse and load, code change using the shared method in tacsupport lib. +--- + Makefile.am | 3 +- + Makefile.in | 3 +- + audisp-tacplus.c | 234 +++++++++++++------------------------------- + audisp-tacplus.conf | 2 +- + debian/control | 6 +- + 5 files changed, 76 insertions(+), 172 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index ad70ca0..caead49 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -6,7 +6,7 @@ EXTRA_DIST = ChangeLog README audisp_tacplus.spec \ + + audisp_tacplus_SOURCES = audisp-tacplus.c + audisp_tacplus_CFLAGS = -O +-audisp_tacplus_LDADD = -lauparse -ltacplus_map ++audisp_tacplus_LDADD = -lauparse -ltacsupport -ltac + sbin_PROGRAMS = audisp-tacplus + man_MANS = audisp-tacplus.8 + +@@ -27,7 +27,6 @@ install-data-hook: + ${INSTALL} -m 755 audisp-tacplus $(DESTDIR)$(sbindir) +- ${INSTALL} -d $(DESTDIR)$(sysconfdir)/audisp/plugins.d ++ ${INSTALL} -d $(DESTDIR)$(sysconfdir)/audit/plugins.d + ${INSTALL} -d $(DESTDIR)$(sysconfdir)/audit/rules.d +- ${INSTALL} -m 600 audisp-tac_plus.conf $(DESTDIR)$(sysconfdir)/audisp/ +- ${INSTALL} -m 644 audisp-tacplus.conf $(DESTDIR)$(sysconfdir)/audisp/plugins.d ++ ${INSTALL} -m 644 audisp-tacplus.conf $(DESTDIR)$(sysconfdir)/audit/plugins.d + ${INSTALL} -m 644 -o 0 audisp-tacplus.rules $(DESTDIR)$(sysconfdir)/audit/rules.d + +diff --git a/Makefile.in b/Makefile.in +index d124c16..5482a9a 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -345,8 +345,7 @@ target_alias = @target_alias@ + top_build_prefix = @top_build_prefix@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ +-EXTRA_DIST = ChangeLog README audisp_tacplus.spec \ +- audisp-tac_plus.conf audisp-tacplus.conf ++EXTRA_DIST = ChangeLog README audisp_tacplus.spec audisp-tacplus.conf + + audisp_tacplus_SOURCES = audisp-tacplus.c + audisp_tacplus_CFLAGS = -O +diff --git a/audisp-tacplus.c b/audisp-tacplus.c +index 42841e5..5e3fb63 100644 +--- a/audisp-tacplus.c ++++ b/audisp-tacplus.c +@@ -45,8 +45,10 @@ + + #include + #include ++#include + #include + #include ++#include + #include + #include + #include +@@ -54,10 +56,14 @@ + #include + #include + #include ++#include ++#include + ++#include ++#include + +-#include +-#include ++/* Tacacs+ support lib */ ++#include + + #define _VMAJ 1 + #define _VMIN 0 +@@ -71,6 +77,9 @@ static unsigned connected_ok; + + char *configfile = "/etc/audisp/audisp-tac_plus.conf"; + ++/* Tacacs control flag */ ++int tacacs_ctrl; ++ + /* Local declarations */ + static void handle_event(auparse_state_t *au, + auparse_cb_event_t cb_event_type, void *user_data); +@@ -93,179 +102,74 @@ hup_handler(int sig __attribute__ ((unused))) + hup = 1; + } + +-typedef struct { +- struct addrinfo *addr; +- char *key; +-} tacplus_server_t; +- +-/* set from configuration file parsing */ +-static tacplus_server_t tac_srv[TAC_PLUS_MAXSERVERS]; +-static int tac_srv_no, tac_key_no; +-static char tac_service[64]; +-static char tac_protocol[64]; +-static char vrfname[64]; +-static int debug = 0; +-static int acct_all; /* send accounting to all servers, not just 1st */ +- + static const char *progname = "audisp-tacplus"; /* for syslogs and errors */ + + static void +-audisp_tacplus_config(char *cfile, int level) ++reload_config(void) + { +- FILE *conf; +- char lbuf[256]; +- +- conf = fopen(cfile, "r"); +- if(conf == NULL) { +- syslog(LOG_WARNING, "%s: can't open config file %s: %m", +- progname, cfile); +- return; +- } ++ hup = 0; + +- while(fgets(lbuf, sizeof lbuf, conf)) { +- if(*lbuf == '#' || isspace(*lbuf)) +- continue; /* skip comments, white space lines, etc. */ +- strtok(lbuf, " \t\n\r\f"); /* terminate buffer at first whitespace */ +- if(!strncmp(lbuf, "include=", 8)) { +- /* +- * allow include files, useful for centralizing tacacs +- * server IP address and secret. +- */ +- if(lbuf[8]) /* else treat as empty config */ +- audisp_tacplus_config(&lbuf[8], level+1); +- } +- else if(!strncmp(lbuf, "debug=", 6)) +- debug = strtoul(lbuf+6, NULL, 0); +- else if(!strncmp(lbuf, "acct_all=", 9)) +- acct_all = strtoul(lbuf+9, NULL, 0); +- else if(!strncmp(lbuf, "vrf=", 4)) +- tac_xstrcpy(vrfname, lbuf + 4, sizeof(vrfname)); +- else if(!strncmp(lbuf, "service=", 8)) +- tac_xstrcpy(tac_service, lbuf + 8, sizeof(tac_service)); +- else if(!strncmp(lbuf, "protocol=", 9)) +- tac_xstrcpy(tac_protocol, lbuf + 9, sizeof(tac_protocol)); +- else if(!strncmp(lbuf, "login=", 6)) +- tac_xstrcpy(tac_login, lbuf + 6, sizeof(tac_login)); +- else if (!strncmp (lbuf, "timeout=", 8)) { +- tac_timeout = (int)strtoul(lbuf+8, NULL, 0); +- if (tac_timeout < 0) /* explict neg values disable poll() use */ +- tac_timeout = 0; +- else /* poll() only used if timeout is explictly set */ +- tac_readtimeout_enable = 1; +- } +- else if(!strncmp(lbuf, "secret=", 7)) { +- int i; +- /* no need to complain if too many on this one */ +- if(tac_key_no < TAC_PLUS_MAXSERVERS) { +- if((tac_srv[tac_key_no].key = strdup(lbuf+7))) +- tac_key_no++; +- else +- syslog(LOG_ERR, "%s: unable to copy server secret %s", +- __FUNCTION__, lbuf+7); +- } +- /* handle case where 'secret=' was given after a 'server=' +- * parameter, fill in the current secret */ +- for(i = tac_srv_no-1; i >= 0; i--) { +- if (tac_srv[i].key) +- continue; +- tac_srv[i].key = strdup(lbuf+7); +- } +- } +- else if(!strncmp(lbuf, "server=", 7)) { +- if(tac_srv_no < TAC_PLUS_MAXSERVERS) { +- struct addrinfo hints, *servers, *server; +- int rv; +- char *port, server_buf[sizeof lbuf]; +- +- memset(&hints, 0, sizeof hints); +- hints.ai_family = AF_UNSPEC; /* use IPv4 or IPv6, whichever */ +- hints.ai_socktype = SOCK_STREAM; +- +- strcpy(server_buf, lbuf + 7); +- +- port = strchr(server_buf, ':'); +- if(port != NULL) { +- *port = '\0'; +- port++; +- } +- if((rv = getaddrinfo(server_buf, (port == NULL) ? +- "49" : port, &hints, &servers)) == 0) { +- for(server = servers; server != NULL && +- tac_srv_no < TAC_PLUS_MAXSERVERS; +- server = server->ai_next) { +- tac_srv[tac_srv_no].addr = server; +- /* use current key, if our index not yet set */ +- if(tac_key_no && !tac_srv[tac_srv_no].key) +- tac_srv[tac_srv_no].key = +- strdup(tac_srv[tac_key_no-1].key); +- tac_srv_no++; +- } +- } +- else { +- syslog(LOG_ERR, +- "skip invalid server: %s (getaddrinfo: %s)", +- server_buf, gai_strerror(rv)); +- } +- } +- else { +- syslog(LOG_ERR, "maximum number of servers (%d) exceeded, " +- "skipping", TAC_PLUS_MAXSERVERS); +- } +- } +- else if(debug) /* ignore unrecognized lines, unless debug on */ +- syslog(LOG_WARNING, "%s: unrecognized parameter: %s", +- progname, lbuf); +- } ++ connected_ok = 0; /* reset connected state (for possible vrf) */ + +- if(level == 0 && (!tac_service[0] || tac_srv_no == 0)) +- syslog(LOG_ERR, "%s version %d.%d.%d: missing tacacs fields in file %s, %d servers", +- progname, _VMAJ, _VMIN, _VPATCH, configfile, tac_srv_no); ++ /* load config file: configfile */ ++ tacacs_ctrl = parse_config_file(configfile); + +- if(debug) { +- int n; +- syslog(LOG_NOTICE, "%s version %d.%d.%d tacacs service=%s", progname, +- _VMAJ, _VMIN, _VPATCH, tac_service); ++ trace("tacacs config updated:\n"); ++ int server_idx; ++ for(server_idx = 0; server_idx < tac_srv_no; server_idx++) { ++ trace("Server %d, address:%s, key length:%d\n", server_idx, tac_ntop(tac_srv[server_idx].addr->ai_addr),strlen(tac_srv[server_idx].key)); ++ } + +- for(n = 0; n < tac_srv_no; n++) +- syslog(LOG_DEBUG, "%s: tacacs server[%d] { addr=%s, key='%s' }", +- progname, n, tac_ntop(tac_srv[n].addr->ai_addr), +- tac_srv[n].key); ++ trace("TACACS+ control flag: 0x%x\n", tacacs_ctrl); ++ ++ if (tacacs_ctrl & AUTHORIZATION_FLAG_TACACS) { ++ trace("TACACS+ per-command authorization enabled.\n"); + } + +- fclose(conf); ++ if (tacacs_ctrl & AUTHORIZATION_FLAG_LOCAL) { ++ trace("Local per-command authorization enabled.\n"); ++ } ++ ++ if (tacacs_ctrl & PAM_TAC_DEBUG) { ++ trace("TACACS+ debug enabled.\n"); ++ } + } + +- +-static void +-reload_config(void) ++/* ++ * Get user name by UID, and return NULL when not found user name by UID. ++ * The returned username should be free by caller. ++ * Also assign hostname to host, the host also should be free by caller. ++ */ ++char *lookup_logname(uid_t auid, char** host) + { +- int i, nservers; +- +- hup = 0; ++ /* get user name. */ ++ struct passwd *pws; ++ pws = getpwuid(auid); ++ if (pws == NULL) { ++ /* Failed to get user information. */ ++ return NULL; ++ } + +- /* reset the config variables that we use, freeing memory where needed */ +- nservers = tac_srv_no; +- tac_srv_no = 0; +- tac_key_no = 0; +- vrfname[0] = '\0'; +- tac_service[0] = '\0'; +- tac_protocol[0] = '\0'; +- tac_login[0] = '\0'; +- debug = 0; +- acct_all = 0; +- tac_timeout = 0; +- +- for(i = 0; i < nservers; i++) { +- if(tac_srv[i].key) { +- free(tac_srv[i].key); +- tac_srv[i].key = NULL; +- } +- tac_srv[i].addr = NULL; ++ int new_buffer_size = strlen(pws->pw_name) + 1; ++ char* username = malloc(new_buffer_size); ++ if (username == NULL) { ++ /* Failed to allocate new buffer. */ ++ return NULL; + } + +- connected_ok = 0; /* reset connected state (for possible vrf) */ ++ memset(username, 0, new_buffer_size); ++ strncpy(username, pws->pw_name, new_buffer_size-1); ++ ++ /* get hostname. */ ++ *host = malloc(HOST_NAME_MAX+1); ++ memset(host, 0, HOST_NAME_MAX+1); ++ if (gethostname(host, HOST_NAME_MAX) != 0) ++ { ++ free(*host); ++ *host = NULL; ++ } + +- audisp_tacplus_config(configfile, 0); ++ return username; + } + + int +@@ -273,6 +177,9 @@ main(int argc, char *argv[]) + { + char tmp[MAX_AUDIT_MESSAGE_LENGTH+1]; + struct sigaction sa; ++ ++ /* initialize random seed*/ ++ srand(time(NULL)); + + /* if there is an argument, it is an alternate configuration file */ + if(argc > 1) +@@ -334,7 +241,7 @@ send_acct_msg(int tac_fd, int type, char *user, char *tty, char *host, + int retval; + struct areply re; + +- attr=(struct tac_attrib *)tac_xcalloc(1, sizeof(struct tac_attrib)); ++ attr=(struct tac_attrib *)xcalloc(1, sizeof(struct tac_attrib)); + + snprintf(buf, sizeof buf, "%lu", (unsigned long)time(NULL)); + tac_add_attrib(&attr, "start_time", buf); +@@ -378,8 +285,7 @@ send_tacacs_acct(char *user, char *tty, char *host, char *cmdmsg, int type, + int retval, srv_i, srv_fd; + + for(srv_i = 0; srv_i < tac_srv_no; srv_i++) { +- srv_fd = tac_connect_single(tac_srv[srv_i].addr, tac_srv[srv_i].key, +- NULL, vrfname[0]?vrfname:NULL); ++ srv_fd = tac_connect_single(tac_srv[srv_i].addr, tac_srv[srv_i].key, tac_source_addr, tac_timeout, __vrfname); + if(srv_fd < 0) { + syslog(LOG_WARNING, "connection to %s failed (%d) to send" + " accounting record: %m", +@@ -393,7 +299,7 @@ send_tacacs_acct(char *user, char *tty, char *host, char *cmdmsg, int type, + close(srv_fd); + if(!retval) { + connected_ok = 1; +- if(!acct_all) ++ if(!(tacacs_ctrl & PAM_TAC_ACCT)) + break; /* only send to first responding server */ + } + } +@@ -501,7 +407,7 @@ static void get_acct_record(auparse_state_t *au, int type) + taskno = (uint16_t) pid; + } + else /* should never happen, if it does, records won't match */ +- taskno = tac_magic(); ++ taskno = (u_int32_t)rand(); + + if(get_field(au, "auid")) { + auser = (char *)auparse_interpret_field(au); +@@ -520,7 +426,7 @@ static void get_acct_record(auparse_state_t *au, int type) + * the NSS library, the username in auser will likely already be the login + * name. + */ +- loguser = lookup_logname(NULL, auid, session, &host, NULL); ++ loguser = lookup_logname(auid, &host); + if(!loguser) { + char *user = NULL; + +diff --git a/audisp-tacplus.conf b/audisp-tacplus.conf +index ccb8517..ba77880 100644 +--- a/audisp-tacplus.conf ++++ b/audisp-tacplus.conf +@@ -7,7 +7,7 @@ active = yes + + # This can be used to specify an different config file than + # /etc/audisp/audisp-tac_plus.conf if desired +-# args = ++args=/etc/tacplus_nss.conf + + # These parameters should normally not be changed. + direction = out +diff --git a/debian/control b/debian/control +index 5306bd9..28c7324 100644 +--- a/debian/control ++++ b/debian/control +@@ -2,9 +2,9 @@ Source: audisp-tacplus + Section: admin + Priority: optional + Maintainer: Dave Olson +-Build-Depends: debhelper (>= 9), autotools-dev, autoconf, libpam-tacplus-dev, ++Build-Depends: debhelper (>= 9), autotools-dev, autoconf, + libtac-dev (>= 1.4.1~), +- libaudit-dev, libauparse-dev, libtacplus-map-dev, ++ libaudit-dev, libauparse-dev, + dpkg-dev (>= 1.16.1~), git + Standards-Version: 3.9.6 + Homepage: https://github.com/daveolson53/audisp_tacplus +@@ -12,7 +12,7 @@ Homepage: https://github.com/daveolson53/audisp_tacplus + Package: audisp-tacplus + Architecture: any + Depends: ${shlibs:Depends}, ${misc:Depends}, libpam-tacplus, libtac2 (>= 1.4.1~), +- libtacplus-map1, libauparse0, libaudit1, auditd ++ libauparse0, libaudit1, auditd + Description: audisp module for TACACS+ accounting + This audisp module is an audisp auditd plugin. It is designed to do TACACS+ + accounting for commands run by TACACS+ authenticated sessions. +-- +2.17.1.windows.2 + diff --git a/src/tacacs/audisp/patches/0002-Remove-user-secret-from-accounting-log.patch b/src/tacacs/audisp/patches/0002-Remove-user-secret-from-accounting-log.patch new file mode 100644 index 000000000000..1cacaa8a0614 --- /dev/null +++ b/src/tacacs/audisp/patches/0002-Remove-user-secret-from-accounting-log.patch @@ -0,0 +1,1139 @@ +From 4152d4d91e1e333ff30f028b3e17e8669ef01bf3 Mon Sep 17 00:00:00 2001 +From: liuh-80 <58683130+liuh-80@users.noreply.github.com> +Date: Tue, 23 Nov 2021 13:32:51 +0800 +Subject: [PATCH] Remove user secret from accounting log. + +--- + Makefile.am | 2 +- + audisp-tacplus.c | 19 ++- + audisp-tacplus.conf | 2 +- + password.c | 118 ++++++++++++++++++ + password.h | 31 +++++ + regex_helper.c | 92 ++++++++++++++ + regex_helper.h | 17 +++ + sudoers_helper.c | 250 +++++++++++++++++++++++++++++++++++++++ + sudoers_helper.h | 18 +++ + trace.c | 21 ++++ + trace.h | 10 ++ + unittest/Makefile | 21 ++++ + unittest/mock.h | 17 +++ + unittest/mock_helper.c | 65 ++++++++++ + unittest/mock_helper.h | 48 ++++++++ + unittest/password_test.c | 199 +++++++++++++++++++++++++++++++ + unittest/sudoers | 5 + + 17 files changed, 931 insertions(+), 4 deletions(-) + create mode 100644 password.c + create mode 100644 password.h + create mode 100644 regex_helper.c + create mode 100644 regex_helper.h + create mode 100644 sudoers_helper.c + create mode 100644 sudoers_helper.h + create mode 100644 trace.c + create mode 100644 trace.h + create mode 100644 unittest/Makefile + create mode 100644 unittest/mock.h + create mode 100644 unittest/mock_helper.c + create mode 100644 unittest/mock_helper.h + create mode 100644 unittest/password_test.c + create mode 100644 unittest/sudoers + +diff --git a/Makefile.am b/Makefile.am +index caead49..b6cb92b 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -4,7 +4,7 @@ + EXTRA_DIST = ChangeLog README audisp_tacplus.spec \ + audisp-tac_plus.conf audisp-tacplus.conf + +-audisp_tacplus_SOURCES = audisp-tacplus.c ++audisp_tacplus_SOURCES = audisp-tacplus.c password.c regex_helper.c trace.c sudoers_helper.c + audisp_tacplus_CFLAGS = -O + audisp_tacplus_LDADD = -lauparse -ltacsupport -ltac + sbin_PROGRAMS = audisp-tacplus +diff --git a/audisp-tacplus.c b/audisp-tacplus.c +index 5e3fb63..aa2b16f 100644 +--- a/audisp-tacplus.c ++++ b/audisp-tacplus.c +@@ -65,6 +65,10 @@ + /* Tacacs+ support lib */ + #include + ++/* Remove password from user command */ ++#include "password.h" ++#include "sudoers_helper.h" ++ + #define _VMAJ 1 + #define _VMIN 0 + #define _VPATCH 0 +@@ -80,6 +84,9 @@ char *configfile = "/etc/audisp/audisp-tac_plus.conf"; + /* Tacacs control flag */ + int tacacs_ctrl; + ++/* sudoers file conatins user password setting */ ++const char *sudoers_path = "/etc/sudoers"; ++ + /* Local declarations */ + static void handle_event(auparse_state_t *au, + auparse_cb_event_t cb_event_type, void *user_data); +@@ -162,8 +169,8 @@ char *lookup_logname(uid_t auid, char** host) + + /* get hostname. */ + *host = malloc(HOST_NAME_MAX+1); +- memset(host, 0, HOST_NAME_MAX+1); +- if (gethostname(host, HOST_NAME_MAX) != 0) ++ memset(*host, 0, HOST_NAME_MAX+1); ++ if (gethostname(*host, HOST_NAME_MAX) != 0) + { + free(*host); + *host = NULL; +@@ -201,6 +208,10 @@ main(int argc, char *argv[]) + syslog(LOG_ERR, "exitting due to auparse init errors"); + return -1; + } ++ ++ /* initialize password regex setting */ ++ initialize_password_setting(sudoers_path); ++ + auparse_add_callback(au, handle_event, NULL, NULL); + do { + /* Load configuration */ +@@ -229,6 +240,9 @@ main(int argc, char *argv[]) + auparse_flush_feed(au); + auparse_destroy(au); + ++ /* Release password setting */ ++ release_password_setting(); ++ + return 0; + } + +@@ -511,6 +525,7 @@ static void get_acct_record(auparse_state_t *au, int type) + * loguser is always set, we bail if not. For ANOM_ABEND, tty may be + * unknown, and in some cases, host may be not be set. + */ ++ remove_password(logbase); + send_tacacs_acct(loguser, tty?tty:"UNK", host?host:"UNK", logbase, acct_type, taskno); + + if(host) +diff --git a/audisp-tacplus.conf b/audisp-tacplus.conf +index ba77880..1b46a9c 100644 +--- a/audisp-tacplus.conf ++++ b/audisp-tacplus.conf +@@ -7,7 +7,7 @@ active = yes + + # This can be used to specify an different config file than + # /etc/audisp/audisp-tac_plus.conf if desired +-args=/etc/tacplus_nss.conf ++args = /etc/tacplus_nss.conf + + # These parameters should normally not be changed. + direction = out +diff --git a/password.c b/password.c +new file mode 100644 +index 0000000..8484d39 +--- /dev/null ++++ b/password.c +@@ -0,0 +1,118 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "password.h" ++#include "regex_helper.h" ++#include "sudoers_helper.h" ++#include "trace.h" ++ ++/* Regex list */ ++REGEX_NODE *global_regex_list = NULL; ++ ++/* Append regex to list */ ++int append_regex_to_list(regex_t regex) ++{ ++ /* Create and initialize regex node */ ++ REGEX_NODE *new_regex_node = (REGEX_NODE *)malloc(sizeof(REGEX_NODE)); ++ if (new_regex_node == NULL) ++ { ++ /* When allocate memory failed, stop and return. also output log to both syslog and stderr with LOG_PERROR*/ ++ trace("Failed to allocate memory for regex node.\n"); ++ return REGEX_APPEND_FAILED; ++ } ++ ++ new_regex_node->next = NULL; ++ new_regex_node->regex = regex; ++ ++ /* Find the pointer to the latest regex node's 'next' field */ ++ REGEX_NODE **current_node = &global_regex_list; ++ while (*current_node != NULL) { ++ current_node = &((*current_node)->next); ++ } ++ ++ /* append new regex to tail node */ ++ *current_node = new_regex_node; ++ return REGEX_APPEND_SUCCESS; ++} ++ ++/* Release password setting */ ++void release_password_setting() ++{ ++ if (global_regex_list == NULL) { ++ return; ++ } ++ ++ /* Walk to last regex */ ++ REGEX_NODE *current = global_regex_list; ++ while (current != NULL) { ++ /* Continue with next regex */ ++ REGEX_NODE* current_node_memory = current; ++ current = current->next; ++ ++ /* Free node memory, this may also reset all allocated memory depends on c lib implementation */ ++ free(current_node_memory); ++ } ++ ++ /* Reset list */ ++ global_regex_list = NULL; ++} ++ ++/* Replace password with PASSWORD_MASK by regex. */ ++void remove_password(char* command) ++{ ++ if (global_regex_list == NULL) { ++ return; ++ } ++ ++ /* Check every regex */ ++ REGEX_NODE *next_node = global_regex_list; ++ while (next_node != NULL) { ++ /* Try fix password with current regex */ ++ if (remove_password_by_regex(command, next_node->regex) == PASSWORD_REMOVED) { ++ return; ++ } ++ ++ /* If password not fix, continue try next regex */ ++ next_node = next_node->next; ++ } ++} ++ ++/* Find and return the pointer of the first non-space character*/ ++char* find_non_space(char *str) ++{ ++ if (str == NULL) { ++ return str; ++ } ++ ++ while (isspace(*str)) { ++ str++; ++ } ++ ++ return str; ++} ++ ++/* Append passwd_cmd to global list */ ++int append_password_regex(char *passwd_cmd) ++{ ++ trace("Append passwd_cmd: %s\n", passwd_cmd); ++ ++ /* convert the setting string to regex */ ++ char regex_buffer[MAX_LINE_SIZE+1]; ++ passwd_cmd = find_non_space(passwd_cmd); ++ convert_passwd_cmd_to_regex(regex_buffer, sizeof(regex_buffer), passwd_cmd); ++ ++ regex_t regex; ++ if (regcomp(®ex, regex_buffer, REG_NEWLINE)) { ++ trace("Complie regex failed: %s\n", regex_buffer); ++ return INITIALIZE_INCORRECT_REGEX; ++ } ++ ++ /* Append regex to global list */ ++ append_regex_to_list(regex); ++ ++ return INITIALIZE_SUCCESS; ++} +\ No newline at end of file +diff --git a/password.h b/password.h +new file mode 100644 +index 0000000..2563b31 +--- /dev/null ++++ b/password.h +@@ -0,0 +1,31 @@ ++#ifndef USER_SECRED_H ++#define USER_SECRED_H ++ ++#include ++#include ++ ++/* Macros for initialize result */ ++#define INITIALIZE_SUCCESS 0 ++#define INITIALIZE_LOAD_SETTING_FAILED 1 ++#define INITIALIZE_INCORRECT_REGEX 2 ++ ++/* Regex append result. */ ++#define REGEX_APPEND_SUCCESS 0 ++#define REGEX_APPEND_FAILED 1 ++ ++/* Regex list node. */ ++typedef struct regex_node { ++ struct regex_node *next; ++ regex_t regex; ++} REGEX_NODE; ++ ++/* Release password setting */ ++extern void release_password_setting(); ++ ++/* Replace password with regex */ ++extern void remove_password(char* command); ++ ++/* Append passwd_cmd to global list */ ++int append_password_regex(char *passwd_cmd); ++ ++#endif /* USER_SECRED_H */ +\ No newline at end of file +diff --git a/regex_helper.c b/regex_helper.c +new file mode 100644 +index 0000000..1edea94 +--- /dev/null ++++ b/regex_helper.c +@@ -0,0 +1,92 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "regex_helper.h" ++#include "trace.h" ++ ++#define min(a,b) (((a) < (b)) ? (a) : (b)) ++ ++/* ++ * Macros for password regex ++ * These are BRE regex, please refer to: https://en.wikibooks.org/wiki/Regular_Expressions/POSIX_Basic_Regular_Expressions ++ REGEX_WHITESPACES will match the whitespace in user commands. ++ REGEX_TOKEN will match password or connection string in user commands ++ */ ++#define REGEX_WHITESPACES "[[:space:]]*" ++#define REGEX_TOKEN "\\([^[:space:]]*\\)" ++ ++/* Regex match group count, 2 because only have 1 subexpression for password */ ++#define REGEX_MATCH_GROUP_COUNT 2 ++ ++/* The password mask */ ++#define PASSWORD_MASK '*' ++ ++/* Remove password from command. */ ++int remove_password_by_regex(char* command, regex_t regex) ++{ ++ regmatch_t pmatch[REGEX_MATCH_GROUP_COUNT]; ++ if (regexec(®ex, command, REGEX_MATCH_GROUP_COUNT, pmatch, 0) == REG_NOMATCH) { ++ trace("User command not match.\n"); ++ return PASSWORD_NOT_FOUND; ++ } ++ ++ if (pmatch[1].rm_so < 0) { ++ trace("Password not found.\n"); ++ return PASSWORD_NOT_FOUND; ++ } ++ ++ /* Found password between pmatch[1].rm_so to pmatch[1].rm_eo, replace it. */ ++ trace("Found password between: %d -- %d\n", pmatch[1].rm_so, pmatch[1].rm_eo); ++ ++ /* Replace password with mask. */ ++ size_t command_length = strlen(command); ++ int password_start_pos = min(pmatch[1].rm_so, command_length); ++ int password_count = min(pmatch[1].rm_eo, command_length) - password_start_pos; ++ memset(command + password_start_pos, PASSWORD_MASK, password_count); ++ ++ return PASSWORD_REMOVED; ++} ++ ++/* ++ Convert password command to regex. ++ Password commands defined in sudoers file, the PASSWD_CMD alias is a list of password command. ++ For more information please check: ++ https://www.sudo.ws/man/1.7.10/sudoers.man.html ++ https://github.com/Azure/sonic-buildimage/blob/5c503b81ae186aa378928edf36fa1d347e919d7a/files/image_config/sudoers/sudoers ++ */ ++void convert_passwd_cmd_to_regex(char *buf, size_t buf_size, const char* password_setting) ++{ ++ int src_idx = 0; ++ int last_char_is_whitespace = 0; ++ ++ memset(buf, 0, buf_size); ++ while (password_setting[src_idx]) { ++ int buffer_used_space= strlen(buf); ++ if (password_setting[src_idx] == PASSWORD_MASK) { ++ /* Replace * to REGEX_TOKEN */ ++ snprintf(buf + buffer_used_space, buf_size - buffer_used_space, REGEX_TOKEN); ++ } ++ else if (isspace(password_setting[src_idx])) { ++ /* Ignore mutiple whitespace */ ++ if (!last_char_is_whitespace) { ++ /* Replace whitespace to regex REGEX_WHITESPACES which match multiple whitespace */ ++ snprintf(buf + buffer_used_space, buf_size - buffer_used_space, REGEX_WHITESPACES); ++ } ++ } ++ else if (buffer_used_space < buf_size - 1) { ++ /* Copy none password characters */ ++ buf[buffer_used_space] = password_setting[src_idx]; ++ } ++ else { ++ /* Buffer full, return here. */ ++ return; ++ } ++ ++ last_char_is_whitespace = isspace(password_setting[src_idx]); ++ src_idx++; ++ } ++} +\ No newline at end of file +diff --git a/regex_helper.h b/regex_helper.h +new file mode 100644 +index 0000000..33c1916 +--- /dev/null ++++ b/regex_helper.h +@@ -0,0 +1,17 @@ ++#ifndef REGEX_HELPER_H ++#define REGEX_HELPER_H ++ ++#include ++#include ++ ++/* Regex fix result. */ ++#define PASSWORD_REMOVED 0 ++#define PASSWORD_NOT_FOUND 1 ++ ++/* Remove password from command. */ ++extern int remove_password_by_regex(char* command, regex_t regex); ++ ++/* Convert password setting to regex. */ ++extern void convert_passwd_cmd_to_regex(char *buf, size_t buf_size, const char* password_setting); ++ ++#endif /* REGEX_HELPER_H */ +\ No newline at end of file +diff --git a/sudoers_helper.c b/sudoers_helper.c +new file mode 100644 +index 0000000..ac4191e +--- /dev/null ++++ b/sudoers_helper.c +@@ -0,0 +1,250 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "password.h" ++#include "sudoers_helper.h" ++#include "trace.h" ++ ++/* Macros for parse user input */ ++#define SUDOERS_SETTING_SPLITTER " =\t\n" ++#define SUDOERS_EQUAL "=" ++#define SUDOERS_LF '\n' ++ ++#define PASSWD_CMDS_SPLITTER '\r' ++ ++/* The command alias prefix */ ++const char* COMMAND_ALIAS = "Cmnd_Alias"; ++ ++/* The password setting */ ++const char* PASSWD_CMDS = "PASSWD_CMDS"; ++ ++/* ++ Load file content. ++*/ ++char* load_file_content(const char *setting_path) ++{ ++ FILE *setting_file = fopen(setting_path, "rt"); ++ if(setting_file == NULL) { ++ trace("Can't open setting file: %s\n", setting_path); ++ return NULL; ++ } ++ ++ fseek(setting_file, 0, SEEK_END); ++ size_t setting_file_size = ftell(setting_file); ++ fseek(setting_file, 0, SEEK_SET); ++ ++ char* file_content = malloc(setting_file_size+1); ++ if (file_content == NULL) { ++ trace("Allocate memory for file: %s failed.\n", setting_path); ++ } ++ else { ++ size_t result = fread(file_content, sizeof(char), setting_file_size, setting_file); ++ if (result == setting_file_size) { ++ file_content[setting_file_size] = 0; ++ } ++ else { ++ trace("Read setting file: %s failed.\n", setting_path); ++ free(file_content); ++ file_content = NULL; ++ } ++ } ++ ++ fclose(setting_file); ++ return file_content; ++} ++ ++ ++/* ++ Get setting content length ++*/ ++size_t setting_content_length(const char *setting) ++{ ++ size_t length = 0; ++ while (*setting != 0 && *setting != SUDOERS_LF) { ++ length++; ++ setting++; ++ } ++ ++ return length; ++} ++ ++/* ++ Load PASSWD_CMDS from sudoers. ++ For more information please check: ++ https://www.sudo.ws/man/1.8.17/sudoers.man.html#Other_special_characters_and_reserved_words ++*/ ++char* load_passwd_cmds(const char *setting_path) ++{ ++ char* file_content = load_file_content(setting_path); ++ if(file_content == NULL) { ++ trace("Load file: %s failed.\n", setting_path); ++ return NULL; ++ } ++ ++ escape_characters(file_content); ++ trace("Sudoers content: (%s)\n", file_content); ++ ++ char *passwd_cmds = NULL; ++ char* token = strtok(file_content, SUDOERS_SETTING_SPLITTER); ++ while (token != NULL) { ++ trace("Token: (%s)\n", token); ++ /* Find Cmnd_Alias */ ++ if (strncmp(token, COMMAND_ALIAS, strlen(COMMAND_ALIAS))) { ++ token = strtok(NULL, SUDOERS_SETTING_SPLITTER); ++ continue; ++ } ++ ++ /* Find PASSWD_CMDS setting */ ++ token = strtok(NULL, SUDOERS_SETTING_SPLITTER); ++ if (strncmp(token, PASSWD_CMDS, strlen(PASSWD_CMDS))) { ++ token = strtok(NULL, SUDOERS_SETTING_SPLITTER); ++ continue; ++ } ++ ++ /* Get PASSWD_CMDS setting content */ ++ token = strtok(NULL, SUDOERS_EQUAL); ++ size_t setting_length = setting_content_length(token); ++ passwd_cmds = malloc(setting_length+1); ++ if (passwd_cmds == NULL) { ++ trace("Allocate memory for PASSWD_CMDS buffer failed.\n"); ++ break; ++ } ++ ++ memcpy(passwd_cmds, token, setting_length); ++ passwd_cmds[setting_length] = 0; ++ break; ++ } ++ ++ free(file_content); ++ return passwd_cmds; ++} ++ ++/* ++ Escape characters according to sudoers file format. ++ For more information, please check: ++ The following characters must be escaped with a backslash (‘\’) when used as part of a word (e.g. a user name or host name): ‘!’, ‘=’, ‘:’, ‘,’, ‘(’, ‘)’, ‘\’. ++ https://www.sudo.ws/man/1.8.17/sudoers.man.html#Other_special_characters_and_reserved_words ++*/ ++void escape_characters(char *str) ++{ ++ char *src_pos=str; ++ char *dest_pos=str; ++ while (*src_pos) { ++ if (*src_pos == ',') { ++ /* PASSWD_CMDS use comma as splitter, replace it wiith \n to simplify split handling */ ++ *dest_pos = PASSWD_CMDS_SPLITTER; ++ src_pos++; ++ dest_pos++; ++ continue; ++ } ++ else if (*src_pos != '\\') { ++ /* copy none escape characters */ ++ if (dest_pos != src_pos) { ++ *dest_pos = *src_pos; ++ } ++ ++ src_pos++; ++ dest_pos++; ++ continue; ++ } ++ ++ /* Handle escape characters */ ++ src_pos++; ++ switch (*src_pos) ++ { ++ case '!': ++ case '=': ++ case '"': ++ case ',': ++ case '(': ++ case ')': ++ case '\\': ++ *dest_pos = *src_pos; ++ dest_pos++; ++ src_pos++; ++ continue; ++ case '\n': ++ /* Long lines can be continued with a backslash */ ++ src_pos++; ++ continue; ++ } ++ ++ /* Not a escape character */ ++ *dest_pos = '\\'; ++ dest_pos++; ++ ++ *dest_pos = *src_pos; ++ src_pos++; ++ dest_pos++; ++ } ++ ++ *dest_pos = 0; ++} ++ ++/* ++ Initialize password setting from sudoers. ++*/ ++int initialize_password_setting(const char *setting_path) ++{ ++ char* passwd_cmds = load_passwd_cmds(setting_path); ++ if (passwd_cmds == NULL) { ++ /* Setting file open failed or can't find password setting. */ ++ trace("Load PASSWD_CMDS from: %s failed.\n", setting_path); ++ return INITIALIZE_LOAD_SETTING_FAILED; ++ } ++ ++ trace("Loaded PASSWD_CMDS: (%s), from: %s .\n", passwd_cmds, setting_path); ++ ++ /* Split PASSWD_CMDS with comma */ ++ int result = INITIALIZE_SUCCESS; ++ int passwd_cmds_length = strlen(passwd_cmds); ++ char* passwd_cmd = passwd_cmds; ++ bool start_new_passwd_cmd = true; ++ for (int index=0; index < passwd_cmds_length; index++) { ++ if (start_new_passwd_cmd) { ++ /* ++ Set the passwd_cmd point to new command when: ++ 1. beginning of passwd_cmds. ++ 2. After a comma splitter. ++ */ ++ passwd_cmd = passwd_cmds + index; ++ start_new_passwd_cmd = false; ++ } ++ ++ if (passwd_cmds[index] != PASSWD_CMDS_SPLITTER) { ++ continue; ++ } ++ ++ /* Found a splitter, handle current passwd_cmd. */ ++ passwd_cmds[index] = 0; ++ result = append_password_regex(passwd_cmd); ++ if (result != INITIALIZE_SUCCESS) { ++ trace("Append password regex failed: %s, result: %d\n", passwd_cmd, result); ++ break; ++ } ++ ++ /* ++ Set passwd_cmd to NULL, so multiple comma splitter will not create empty passwd_cmd, for example: ++ command1,,command2 ++ */ ++ passwd_cmd = NULL; ++ start_new_passwd_cmd = true; ++ } ++ ++ /* ++ Handle following 2 cases: ++ 1. Comma splitter not exist in PASSWD_CMDS ++ 2. Last command in PASSWD_CMDS ++ */ ++ result = append_password_regex(passwd_cmd); ++ if (result != INITIALIZE_SUCCESS) { ++ trace("Append password regex failed: %s, result: %d\n", passwd_cmd, result); ++ } ++ ++ free(passwd_cmds); ++ return result; ++} +\ No newline at end of file +diff --git a/sudoers_helper.h b/sudoers_helper.h +new file mode 100644 +index 0000000..1539821 +--- /dev/null ++++ b/sudoers_helper.h +@@ -0,0 +1,18 @@ ++#ifndef SUDOERS_HELPER_H ++#define SUDOERS_HELPER_H ++ ++/* Load PASSWD_CMDS from sudoers. */ ++char* load_passwd_cmds(const char *setting_path); ++ ++/* ++ Escape characters according to sudoers file format. ++ For more information, please check: ++ The following characters must be escaped with a backslash (‘\’) when used as part of a word (e.g. a user name or host name): ‘!’, ‘=’, ‘:’, ‘,’, ‘(’, ‘)’, ‘\’. ++ https://www.sudo.ws/man/1.8.17/sudoers.man.html#Other_special_characters_and_reserved_words ++*/ ++void escape_characters(char *str); ++ ++/* Initialize password setting from sudoers. */ ++int initialize_password_setting(const char *setting_path); ++ ++#endif /* SUDOERS_HELPER_H */ +diff --git a/trace.c b/trace.c +new file mode 100644 +index 0000000..44bbbc7 +--- /dev/null ++++ b/trace.c +@@ -0,0 +1,21 @@ ++#include ++#include ++#include ++#include ++#include ++ ++#include "trace.h" ++ ++/* Output trace log. */ ++void trace(const char *format, ...) ++{ ++ // convert log to a string because va args resoursive issue: ++ // http://www.c-faq.com/varargs/handoff.html ++ char logBuffer[MAX_LINE_SIZE]; ++ va_list args; ++ va_start (args, format); ++ vsnprintf(logBuffer, sizeof(logBuffer), format, args); ++ va_end (args); ++ ++ syslog(LOG_INFO, "Audisp-tacplus: %s", logBuffer); ++} +\ No newline at end of file +diff --git a/trace.h b/trace.h +new file mode 100644 +index 0000000..6ea929d +--- /dev/null ++++ b/trace.h +@@ -0,0 +1,10 @@ ++#ifndef TRACE_H ++#define TRACE_H ++ ++/* Max setting line buffer size */ ++#define MAX_LINE_SIZE 512 ++ ++/* Output trace log. */ ++extern void trace(const char *format, ...); ++ ++#endif /* USER_SECRED_H */ +\ No newline at end of file +diff --git a/unittest/Makefile b/unittest/Makefile +new file mode 100644 +index 0000000..ed5517b +--- /dev/null ++++ b/unittest/Makefile +@@ -0,0 +1,21 @@ ++#disable some warning because UT need test functions not in header file. ++CFLAGS = -Wno-parentheses -Wno-format-security -Wno-implicit-function-declaration -c ++IFLAGS = -I.. -I../include -I../lib -include mock.h ++MFLAG = -DDEBUG -DUNIT_TEST ++ ++all: ++ gcc password_test.c $(IFLAGS) $(CFLAGS) -o password_test.o ++ gcc mock_helper.c $(IFLAGS) $(CFLAGS) -o mock_helper.o ++ gcc ../password.c $(IFLAGS) $(CFLAGS) $(MFLAG) -o password.o ++ gcc ../regex_helper.c $(IFLAGS) $(CFLAGS) $(MFLAG) -o regex_helper.o ++ gcc ../trace.c $(IFLAGS) $(CFLAGS) $(MFLAG) -o trace.o ++ gcc ../sudoers_helper.c $(IFLAGS) $(CFLAGS) $(MFLAG) -o sudoers_helper.o ++ gcc password_test.o mock_helper.o password.o regex_helper.o trace.o sudoers_helper.o -o password_test -lc -lcunit ++ ++test: ++ # run unit test, if UT failed, build will break ++ ./password_test ++ ++clean: ++ rm *.o ++ rm password_test +diff --git a/unittest/mock.h b/unittest/mock.h +new file mode 100644 +index 0000000..536f17a +--- /dev/null ++++ b/unittest/mock.h +@@ -0,0 +1,17 @@ ++#ifndef MOCK_H ++#define MOCK_H ++ ++#include ++ ++// use mock functions when build for UT ++#if defined (UNIT_TEST) ++void *mock_malloc(size_t size); ++void *mock_realloc(void* ptr, size_t size); ++void mock_free(void* ptr); ++#define malloc mock_malloc ++#define realloc mock_realloc ++#define free mock_free ++#else ++#endif ++ ++#endif /* MOCK_H */ +diff --git a/unittest/mock_helper.c b/unittest/mock_helper.c +new file mode 100644 +index 0000000..cd6433d +--- /dev/null ++++ b/unittest/mock_helper.c +@@ -0,0 +1,65 @@ ++/* mock_helper.c -- mock helper for bash plugin UT. */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include "mock_helper.h" ++ ++/* define test scenarios for mock functions return different value by scenario. */ ++int test_scenario; ++ ++/* define memory allocate counter. */ ++int memory_allocate_count; ++ ++/* Set test scenario for test*/ ++void set_test_scenario(int scenario) ++{ ++ test_scenario = scenario; ++} ++ ++/* Get test scenario for test*/ ++int get_test_scenario() ++{ ++ return test_scenario; ++} ++ ++/* Set memory allocate count for test*/ ++void set_memory_allocate_count(int count) ++{ ++ memory_allocate_count = count; ++} ++ ++/* Get memory allocate count for test*/ ++int get_memory_allocate_count() ++{ ++ return memory_allocate_count; ++} ++ ++/* MOCK malloc method*/ ++void *mock_malloc(size_t size) ++{ ++ memory_allocate_count++; ++ debug_printf("MOCK: malloc %ld bytes memory count: %d\n", size, memory_allocate_count); ++ return malloc(size); ++} ++ ++/* MOCK malloc method*/ ++void *mock_realloc(void* ptr, size_t size) ++{ ++ if (ptr == NULL) { ++ memory_allocate_count++; ++ } ++ ++ debug_printf("MOCK: realloc %ld bytes memory count: %d\n", size, memory_allocate_count); ++ return realloc(ptr, size); ++} ++ ++/* MOCK free method*/ ++void mock_free(void* ptr) ++{ ++ memory_allocate_count--; ++ debug_printf("MOCK: free memory count: %d\n", memory_allocate_count); ++ free(ptr); ++} +\ No newline at end of file +diff --git a/unittest/mock_helper.h b/unittest/mock_helper.h +new file mode 100644 +index 0000000..d116f57 +--- /dev/null ++++ b/unittest/mock_helper.h +@@ -0,0 +1,48 @@ ++/* plugin.h - functions from plugin.c. */ ++ ++/* Copyright (C) 1993-2015 Free Software Foundation, Inc. ++ ++ This file is part of GNU Bash, the Bourne Again SHell. ++ ++ Bash is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation, either version 3 of the License, or ++ (at your option) any later version. ++ ++ Bash is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with Bash. If not, see . ++*/ ++ ++#if !defined (_MOCK_HELPER_H_) ++#define _MOCK_HELPER_H_ ++ ++#include "password.h" ++ ++// define USER_SECRET_UT_DEBUG to output UT debug message. ++#define USER_SECRET_UT_DEBUG ++#if defined (USER_SECRET_UT_DEBUG) ++#define debug_printf printf ++#else ++#define debug_printf ++#endif ++ ++#define TEST_SCEANRIO_LOAD_USER_SECRET_SETTING 1 ++ ++/* Set test scenario for test*/ ++void set_test_scenario(int scenario); ++ ++/* Get test scenario for test*/ ++int get_test_scenario(); ++ ++/* Set memory allocate count for test*/ ++void set_memory_allocate_count(int count); ++ ++/* Get memory allocate count for test*/ ++int get_memory_allocate_count(); ++ ++#endif /* _MOCK_HELPER_H_ */ +\ No newline at end of file +diff --git a/unittest/password_test.c b/unittest/password_test.c +new file mode 100644 +index 0000000..606ecc5 +--- /dev/null ++++ b/unittest/password_test.c +@@ -0,0 +1,199 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "mock_helper.h" ++#include "regex_helper.h" ++#include "sudoers_helper.h" ++#include "trace.h" ++#include "password.h" ++ ++/* Regex list */ ++extern REGEX_NODE *global_regex_list; ++ ++int clean_up() { ++ return 0; ++} ++ ++int start_up() { ++ return 0; ++} ++ ++/* Test load password setting*/ ++void testcase_load_password_setting() { ++ set_test_scenario(TEST_SCEANRIO_LOAD_USER_SECRET_SETTING); ++ initialize_password_setting("./sudoers"); ++ ++ int loaded_regex_count = 0; ++ REGEX_NODE *next_node = global_regex_list; ++ while (next_node != NULL) { ++ /* Continue with next pligin */ ++ REGEX_NODE* current_node_memory = next_node; ++ next_node = next_node->next; ++ ++ loaded_regex_count++; ++ } ++ ++ release_password_setting(); ++ ++ CU_ASSERT_EQUAL(loaded_regex_count, 4); ++} ++ ++/* Test convert setting string to regex string*/ ++void testcase_convert_passwd_cmd_to_regex() { ++ char regex_buffer[MAX_LINE_SIZE]; ++ ++ /* '*' in input setting should replace to (\S*) */ ++ convert_passwd_cmd_to_regex(regex_buffer, sizeof(regex_buffer), "testcommand *"); ++ debug_printf("regex_buffer: %s\n", regex_buffer); ++ CU_ASSERT_STRING_EQUAL(regex_buffer, "testcommand[[:space:]]*\\([^[:space:]]*\\)"); ++ ++ convert_passwd_cmd_to_regex(regex_buffer, sizeof(regex_buffer), "/usr/sbin/chpasswd *"); ++ debug_printf("regex_buffer: %s\n", regex_buffer); ++ CU_ASSERT_STRING_EQUAL(regex_buffer, "/usr/sbin/chpasswd[[:space:]]*\\([^[:space:]]*\\)"); ++} ++ ++/* Test fix password by regex*/ ++void testcase_fix_password_by_regex() { ++ char regex_buffer[MAX_LINE_SIZE]; ++ char result_buffer[MAX_LINE_SIZE]; ++ ++ /* '*' in input setting should replace to (\S*) */ ++ convert_passwd_cmd_to_regex(regex_buffer, sizeof(regex_buffer), "testcommand *"); ++ debug_printf("regex_buffer: %s\n", regex_buffer); ++ ++ /* Fixed regex should be a correct regex */ ++ regex_t regex; ++ CU_ASSERT_FALSE(regcomp(®ex, regex_buffer, REG_NEWLINE)); ++ ++ /* Password should be removed by regex */ ++ snprintf(result_buffer, sizeof(result_buffer), "%s", "testcommand testsecret"); ++ remove_password_by_regex(result_buffer, regex); ++ ++ debug_printf("Fixed command: %s\n", result_buffer); ++ CU_ASSERT_STRING_EQUAL(result_buffer, "testcommand **********"); ++} ++ ++/* Test fix password*/ ++void testcase_fix_password() { ++ char result_buffer[MAX_LINE_SIZE]; ++ initialize_password_setting("./sudoers"); ++ ++ /* Password should be removed by regex */ ++ snprintf(result_buffer, sizeof(result_buffer), "%s", "/usr/local/bin/config tacacs passkey testsecret"); ++ remove_password(result_buffer); ++ ++ debug_printf("Fixed command: %s\n", result_buffer); ++ CU_ASSERT_STRING_EQUAL(result_buffer, "/usr/local/bin/config tacacs passkey **********"); ++ ++ snprintf(result_buffer, sizeof(result_buffer), "%s", "/usr/sbin/chpasswd testsecret"); ++ remove_password(result_buffer); ++ ++ debug_printf("Fixed command: %s\n", result_buffer); ++ CU_ASSERT_STRING_EQUAL(result_buffer, "/usr/sbin/chpasswd **********"); ++ ++ snprintf(result_buffer, sizeof(result_buffer), "%s", "/usr/sbin/setpasswd testsecret"); ++ remove_password(result_buffer); ++ ++ debug_printf("Fixed command: %s\n", result_buffer); ++ CU_ASSERT_STRING_EQUAL(result_buffer, "/usr/sbin/setpasswd **********"); ++ ++ /* In sudoers file PASSWD_CMD cross multiple line should handle correctly */ ++ snprintf(result_buffer, sizeof(result_buffer), "%s", "/usr/sbin/unfinishedcommand testsecret ,"); ++ remove_password(result_buffer); ++ ++ debug_printf("Fixed command: %s\n", result_buffer); ++ CU_ASSERT_STRING_EQUAL(result_buffer, "/usr/sbin/unfinishedcommand ********** ,"); ++ ++ /* Regular command not change */ ++ snprintf(result_buffer, sizeof(result_buffer), "%s", "command no password"); ++ remove_password(result_buffer); ++ CU_ASSERT_STRING_EQUAL(result_buffer, "command no password"); ++ ++ release_password_setting(); ++} ++ ++/* Test release all regex */ ++void testcase_release_all_regex() { ++ set_memory_allocate_count(0); ++ ++ initialize_password_setting("./sudoers"); ++ release_password_setting(); ++ ++ /* All memory should free */ ++ CU_ASSERT_EQUAL(get_memory_allocate_count(), 0); ++} ++ ++/* Test for escape_characters method */ ++void testcase_escape_characters() { ++ char buffer[MAX_LINE_SIZE]; ++ ++ snprintf(buffer, sizeof(buffer), "%s", "Test string \\\\"); ++ escape_characters(buffer); ++ printf(buffer); ++ CU_ASSERT_TRUE(strcmp(buffer, "Test string \\") == 0); ++ CU_ASSERT_STRING_EQUAL(buffer, "Test string \\"); ++ ++ snprintf(buffer, sizeof(buffer), "%s", "Test string \\,"); ++ escape_characters(buffer); ++ CU_ASSERT_STRING_EQUAL(buffer, "Test string ,"); ++ ++ snprintf(buffer, sizeof(buffer), "%s", "Test string \\\\\\,"); ++ escape_characters(buffer); ++ CU_ASSERT_STRING_EQUAL(buffer, "Test string \\,"); ++ ++ /* Following case should not escape */ ++ snprintf(buffer, sizeof(buffer), "%s", "Test string \\:"); ++ escape_characters(buffer); ++ CU_ASSERT_STRING_EQUAL(buffer, "Test string \\:"); ++ ++ snprintf(buffer, sizeof(buffer), "%s", "Test string \\."); ++ escape_characters(buffer); ++ CU_ASSERT_STRING_EQUAL(buffer, "Test string \\."); ++} ++ ++int main(void) { ++ if (CUE_SUCCESS != CU_initialize_registry()) { ++ return CU_get_error(); ++ } ++ ++ CU_pSuite ste = CU_add_suite("plugin_test", start_up, clean_up); ++ if (NULL == ste) { ++ CU_cleanup_registry(); ++ return CU_get_error(); ++ } ++ ++ if (CU_get_error() != CUE_SUCCESS) { ++ fprintf(stderr, "Error creating suite: (%d)%s\n", CU_get_error(), CU_get_error_msg()); ++ return CU_get_error(); ++ } ++ ++ if (!CU_add_test(ste, "Test testcase_load_password_setting()...\n", testcase_load_password_setting) ++ || !CU_add_test(ste, "Test testcase_convert_passwd_cmd_to_regex()...\n", testcase_convert_passwd_cmd_to_regex) ++ || !CU_add_test(ste, "Test testcase_fix_password_by_regex()...\n", testcase_fix_password_by_regex) ++ || !CU_add_test(ste, "Test testcase_fix_password()...\n", testcase_fix_password) ++ || !CU_add_test(ste, "Test testcase_release_all_regex()...\n", testcase_release_all_regex) ++ || !CU_add_test(ste, "Test testcase_escape_characters()...\n", testcase_escape_characters)) { ++ CU_cleanup_registry(); ++ return CU_get_error(); ++ } ++ ++ if (CU_get_error() != CUE_SUCCESS) { ++ fprintf(stderr, "Error adding test: (%d)%s\n", CU_get_error(), CU_get_error_msg()); ++ } ++ ++ // run all test ++ CU_basic_set_mode(CU_BRM_VERBOSE); ++ CU_ErrorCode run_errors = CU_basic_run_suite(ste); ++ if (run_errors != CUE_SUCCESS) { ++ fprintf(stderr, "Error running tests: (%d)%s\n", run_errors, CU_get_error_msg()); ++ } ++ ++ CU_basic_show_failures(CU_get_failure_list()); ++ ++ // use failed UT count as return value ++ return CU_get_number_of_failure_records(); ++} +diff --git a/unittest/sudoers b/unittest/sudoers +new file mode 100644 +index 0000000..4e36873 +--- /dev/null ++++ b/unittest/sudoers +@@ -0,0 +1,5 @@ ++# test file for read user secret setting ++ ++Cmnd_Alias PASSWD_CMDS = /usr/local/bin/config tacacs passkey *, \ ++ /usr/sbin/unfinished\ ++command * \, ,/usr/sbin/chpasswd * , /usr/sbin/setpasswd * +\ No newline at end of file +-- +2.17.1.windows.2 + diff --git a/src/tacacs/audisp/patches/0003-Add-local-accounting.patch b/src/tacacs/audisp/patches/0003-Add-local-accounting.patch new file mode 100644 index 000000000000..1883f55914fa --- /dev/null +++ b/src/tacacs/audisp/patches/0003-Add-local-accounting.patch @@ -0,0 +1,97 @@ +From 79b07171c2c2651e535a468d7a56621a2a7049b9 Mon Sep 17 00:00:00 2001 +From: liuh-80 <58683130+liuh-80@users.noreply.github.com> +Date: Tue, 23 Nov 2021 13:34:00 +0800 +Subject: [PATCH 3/3] Add local accounting. + +--- + Makefile.am | 2 +- + audisp-tacplus.c | 11 ++++++++++- + local_accounting.c | 17 +++++++++++++++++ + local_accounting.h | 7 +++++++ + 4 files changed, 35 insertions(+), 2 deletions(-) + create mode 100644 local_accounting.c + create mode 100644 local_accounting.h + +diff --git a/Makefile.am b/Makefile.am +index b6cb92b..dacc8fd 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -4,7 +4,7 @@ + EXTRA_DIST = ChangeLog README audisp_tacplus.spec \ + audisp-tac_plus.conf audisp-tacplus.conf + +-audisp_tacplus_SOURCES = audisp-tacplus.c password.c regex_helper.c trace.c sudoers_helper.c ++audisp_tacplus_SOURCES = audisp-tacplus.c password.c regex_helper.c trace.c local_accounting.c sudoers_helper.c + audisp_tacplus_CFLAGS = -O + audisp_tacplus_LDADD = -lauparse -ltacsupport -ltac + sbin_PROGRAMS = audisp-tacplus +diff --git a/audisp-tacplus.c b/audisp-tacplus.c +index 229694b..7a4ab9e 100644 +--- a/audisp-tacplus.c ++++ b/audisp-tacplus.c +@@ -69,6 +69,9 @@ + #include "password.h" + #include "sudoers_helper.h" + ++/* Local accounting */ ++#include "local_accounting.h" ++ + #define _VMAJ 1 + #define _VMIN 0 + #define _VPATCH 0 +@@ -526,7 +529,13 @@ static void get_acct_record(auparse_state_t *au, int type) + * unknown, and in some cases, host may be not be set. + */ + remove_password(logbase); +- send_tacacs_acct(loguser, tty?tty:"UNK", host?host:"UNK", logbase, acct_type, taskno); ++ if (tacacs_ctrl & ACCOUNTING_FLAG_TACACS) { ++ send_tacacs_acct(loguser, tty?tty:"UNK", host?host:"UNK", logbase, acct_type, taskno); ++ } ++ ++ if (tacacs_ctrl & ACCOUNTING_FLAG_LOCAL) { ++ accounting_to_syslog(loguser, tty?tty:"UNK", host?host:"UNK", logbase, acct_type, taskno); ++ } + + if(host) + free(host); +diff --git a/local_accounting.c b/local_accounting.c +new file mode 100644 +index 0000000..e23acec +--- /dev/null ++++ b/local_accounting.c +@@ -0,0 +1,17 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "trace.h" ++ ++/* Accounting log format. */ ++#define ACCOUNTING_LOG_FORMAT "Accounting: user: %s, tty: %s, host: %s, command: %s, type: %d, task ID: %d" ++ ++/* Write the accounting information to syslog. */ ++void accounting_to_syslog(char *user, char *tty, char *host, char *cmdmsg, int type, uint16_t task_id) ++{ ++ trace(ACCOUNTING_LOG_FORMAT, user, tty, host, cmdmsg, type, task_id); ++} +\ No newline at end of file +diff --git a/local_accounting.h b/local_accounting.h +new file mode 100644 +index 0000000..9e880a7 +--- /dev/null ++++ b/local_accounting.h +@@ -0,0 +1,7 @@ ++#ifndef LOCAL_ACCOUNTING_H ++#define LOCAL_ACCOUNTING_H ++ ++/* Write accounting information to syslog. */ ++extern void accounting_to_syslog(char *user, char *tty, char *host, char *cmdmsg, int type, uint16_t task_id); ++ ++#endif /* LOCAL_ACCOUNTING_H */ +\ No newline at end of file +-- +2.17.1.windows.2 + diff --git a/src/tacacs/audisp/patches/series b/src/tacacs/audisp/patches/series new file mode 100644 index 000000000000..20a7e8e64d1d --- /dev/null +++ b/src/tacacs/audisp/patches/series @@ -0,0 +1,3 @@ +0001-Porting-to-sonic.patch +0002-Remove-user-secret-from-accounting-log.patch +0003-Add-local-accounting.patch \ No newline at end of file diff --git a/src/tacacs/bash_tacplus/Makefile.am b/src/tacacs/bash_tacplus/Makefile.am new file mode 100644 index 000000000000..72ad458004cd --- /dev/null +++ b/src/tacacs/bash_tacplus/Makefile.am @@ -0,0 +1,27 @@ +########################################################################### +## +## File: ./Makefile.am +## Versions: $Id: Makefile.am,v 1.0 2021/08/24 12:04:29 liuh@microsoft.com Exp $ +## Created: 2021/08/24 +## +########################################################################### + +ACLOCAL_AMFLAGS = -I config +AUTOMAKE_OPTIONS = subdir-objects + +moduledir = @plugindir@ +module_LTLIBRARIES = bash_tacplus.la +bash_tacplus_la_SOURCES = bash_tacplus.h \ +bash_tacplus.c +bash_tacplus_la_CFLAGS = $(AM_CFLAGS) -I $(top_srcdir)/libtac/include +bash_tacplus_la_LDFLAGS = -module -avoid-version + +EXTRA_DIST = bash_tacplus.spec + +MAINTAINERCLEANFILES = Makefile.in config.h.in configure aclocal.m4 \ + config/config.guess config/config.sub config/depcomp \ + config/install-sh config/ltmain.sh config/missing + +pkgconfigdir = $(libdir)/pkgconfig + +SUBDIRS = unittest diff --git a/src/tacacs/bash_tacplus/bash_tacplus.c b/src/tacacs/bash_tacplus/bash_tacplus.c new file mode 100644 index 000000000000..b184b8f14b10 --- /dev/null +++ b/src/tacacs/bash_tacplus/bash_tacplus.c @@ -0,0 +1,488 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Remote user gecos prefix, which been assigned by nss_tacplus */ +#define REMOTE_USER_GECOS_PREFIX "remote_user" + +/* Default value for _SC_GETPW_R_SIZE_MAX */ +#define DEFAULT_SC_GETPW_R_SIZE_MAX 1024 + +/* Return value for is_local_user method */ +#define IS_LOCAL_USER 0 +#define IS_REMOTE_USER 1 +#define ERROR_CHECK_LOCAL_USER 2 + +/* Tacacs+ lib */ +#include + +/* Tacacs+ support lib */ +#include + +/* Output syslog to mock method when build with UT */ +#if defined (BASH_PLUGIN_UT) +#define syslog mock_syslog +#endif + +/* Tacacs+ log format */ +#define TACACS_LOG_FORMAT "TACACS+: %s" + +/* Tacacs+ config file timestamp string format */ +#define CONFIG_FILE_TIME_STAMP_FORMAT "%d.%m.%Y %H:%M:%S" + +/* Tacacs+ config file timestamp string length */ +#define CONFIG_FILE_TIME_STAMP_LEN 100 + +/* + Convert log to a string because va args resoursive issue: + http://www.c-faq.com/varargs/handoff.html +*/ +#define GENERATE_LOG_FROM_VA(logBufferName) \ + char logBufferName[512]; \ + va_list args; \ + va_start(args, format); \ + vsnprintf(logBufferName, sizeof(logBufferName), format, args); \ + va_end(args); + +/* Config file path */ +const char *tacacs_config_file = "/etc/tacplus_nss.conf"; + +/* Unknown user name */ +const char *unknown_username = "UNKNOWN"; + + +/* Config file attribute */ +struct stat config_file_attr; + +/* Tacacs server config data */ +typedef struct { + struct addrinfo *address; + const char *key; +} tacacs_server_t; + +/* Tacacs control flag */ +int tacacs_ctrl; + +/* + * Output error message. + */ +void output_error(const char *format, ...) +{ + GENERATE_LOG_FROM_VA(logBuffer); + + if (tacacs_ctrl & PAM_TAC_DEBUG) { + fprintf(stderr, TACACS_LOG_FORMAT, logBuffer); + } + + syslog(LOG_ERR, TACACS_LOG_FORMAT, logBuffer); +} + +/* + * Output debug message. + */ +void output_debug(const char *format, ...) +{ + if ((tacacs_ctrl & PAM_TAC_DEBUG) == 0) { + return; + } + + GENERATE_LOG_FROM_VA(logBuffer); + fprintf(stderr, TACACS_LOG_FORMAT, logBuffer); + syslog(LOG_DEBUG, TACACS_LOG_FORMAT, logBuffer); +} + + +/* + * Send authorization message. + * This method based on send_auth_msg in https://github.com/daveolson53/tacplus-auth/blob/master/tacplus-auth.c + */ +int send_authorization_message( + int tac_fd, + const char *user, + const char *tty, + const char *host, + uint16_t taskid, + const char *cmd, + char **args, + int argc) +{ + char buf[128]; + struct tac_attrib *attr; + int retval; + struct areply re; + int i; + + attr=(struct tac_attrib *)xcalloc(1, sizeof(struct tac_attrib)); + + snprintf(buf, sizeof buf, "%hu", taskid); + tac_add_attrib(&attr, "task_id", buf); + tac_add_attrib(&attr, "protocol", "ssh"); + tac_add_attrib(&attr, "service", "shell"); + + tac_add_attrib(&attr, "cmd", (char*)cmd); + + for(i=1; i= sizeof(tbuf)) { + snprintf(tbuf, sizeof tbuf, "%s", args[i]); + arg = tbuf; + } + else { + arg = args[i]; + } + + tac_add_attrib(&attr, "cmd-arg", (char *)arg); + } + + re.msg = NULL; + output_debug("send authorizatiom message with user: %s, tty: %s, host: %s\n", user, tty, host); + retval = tac_author_send(tac_fd, (char *)user, (char *)tty, (char *)host, attr); + output_debug("authorization result: %d\n", retval); + + if(retval < 0) { + output_error("send of authorization message failed: %s\n", strerror(errno)); + } + else { + retval = tac_author_read(tac_fd, &re); + if (retval < 0) { + output_debug("authorization response failed: %d\n", retval); + } + else if(re.status == AUTHOR_STATUS_PASS_ADD || + re.status == AUTHOR_STATUS_PASS_REPL) { + retval = 0; + } + else { + output_debug("command not authorized (%d)\n", re.status); + retval = 1; + } + } + + tac_free_attrib(&attr); + if(re.msg != NULL) { + free(re.msg); + } + + return retval; +} + +/* + * Send tacacs authorization request. + * This method based on send_tacacs_auth in https://github.com/daveolson53/tacplus-auth/blob/master/tacplus-auth.c + */ +int tacacs_authorization( + const char *user, + const char *tty, + const char *host, + const char *cmd, + char **args, + int argc) +{ + int result = 1, server_idx, server_fd, connected_servers=0; + uint16_t task_id = (uint16_t)getpid(); + + for(server_idx = 0; server_idx < tac_srv_no; server_idx++) { + server_fd = tac_connect_single(tac_srv[server_idx].addr, tac_srv[server_idx].key, tac_source_addr, tac_timeout, __vrfname); + if(server_fd < 0) { + // connect to tacacs server failed + output_error("Failed to connecting to %s to request authorization for %s: %s\n", tac_ntop(tac_srv[server_idx].addr->ai_addr), cmd, strerror(errno)); + continue; + } + + // increase connected servers + connected_servers++; + result = send_authorization_message(server_fd, user, tty, host, task_id, cmd, args, argc); + close(server_fd); + if(result) { + // authorization failed + output_debug("%s not authorized from %s\n", cmd, tac_ntop(tac_srv[server_idx].addr->ai_addr)); + } + else { + // authorization successed + output_debug("%s authorized from %s\n", cmd, tac_ntop(tac_srv[server_idx].addr->ai_addr)); + break; + } + } + + // can't connect to any server + if(!connected_servers) { + result = -2; + output_error("Failed to connect to TACACS server(s)\n"); + } + + return result; +} + +/* + * Send authorization request. + * This method based on build_auth_req in https://github.com/daveolson53/tacplus-auth/blob/master/tacplus-auth.c + */ +int authorization_with_host_and_tty(const char *user, const char *cmd, char **argv, int argc) +{ + // try get host name + char hostname[64]; + memset(&hostname, 0, sizeof(hostname)); + + (void)gethostname(hostname, sizeof(hostname) -1); + if (!hostname[0]) { + snprintf(hostname, sizeof(hostname), "UNK"); + output_error("Failed to determine hostname, passing %s\n", hostname); + } + + // try get tty name + char ttyname[64]; + memset(&ttyname, 0, sizeof(ttyname)); + + int i; + for(i=0; i<3; i++) { + int result; + if (isatty(i)) { + result = ttyname_r(i, ttyname, sizeof(ttyname) -1); + if (result) { + output_error("Failed to get tty name for fd %d: %s\n", i, strerror(result)); + } + break; + } + } + + if (!ttyname[0]) { + snprintf(ttyname, sizeof(ttyname), "UNK"); + output_error("Failed to determine tty, passing %s\n", ttyname); + } + + // send tacacs authorization request + return tacacs_authorization(user, ttyname, hostname, cmd, argv, argc); +} + +/* + * Load tacacs config. + */ +void load_tacacs_config() +{ + // load config file: tacacs_config_file + tacacs_ctrl = parse_config_file (tacacs_config_file); + + output_debug("tacacs config updated:\n"); + int server_idx; + for(server_idx = 0; server_idx < tac_srv_no; server_idx++) { + output_debug("Server %d, address:%s, key length:%d\n", server_idx, tac_ntop(tac_srv[server_idx].addr->ai_addr),strlen(tac_srv[server_idx].key)); + } + + output_debug("TACACS+ control flag: 0x%x\n", tacacs_ctrl); + + if (tacacs_ctrl & AUTHORIZATION_FLAG_TACACS) { + output_debug("TACACS+ per-command authorization enabled.\n"); + } + + if (tacacs_ctrl & AUTHORIZATION_FLAG_LOCAL) { + output_debug("Local per-command authorization enabled.\n"); + } + + if (tacacs_ctrl & PAM_TAC_DEBUG) { + output_debug("TACACS+ debug enabled.\n"); + } +} + +/* + * Load tacacs config. + */ +void check_and_load_changed_tacacs_config() +{ + struct stat attr; + // get config file stat, check if file changed + stat(tacacs_config_file, &attr); + char date[CONFIG_FILE_TIME_STAMP_LEN]; + strftime(date, sizeof(date), CONFIG_FILE_TIME_STAMP_FORMAT, localtime(&(attr.st_mtime))); + if (difftime(attr.st_mtime, config_file_attr.st_mtime) == 0) { + output_debug("tacacs config file not change: last modified time: %s.\n", date); + return; + } + + output_debug("tacacs config file changed: last modified time: %s.\n", date); + + // config file changed, update file stat and reload config. + config_file_attr = attr; + + // load config file + load_tacacs_config(); +} + +/* + * Tacacs plugin initialization. + */ +void plugin_init() +{ + // get config file stat, will use this to check config file changed + stat(tacacs_config_file, &config_file_attr); + + // load config file: tacacs_config_file + load_tacacs_config(); + + output_debug("tacacs plugin initialized.\n"); +} + +/* + * Tacacs plugin release. + */ +void plugin_uninit() +{ + output_debug("tacacs plugin un-initialize.\n"); +} + +/* + * Check if current user is local user. + */ +int is_local_user(char *user) +{ + if (user == unknown_username) { + // for unknown user name, when tacacs enabled, always authorization with tacacs. + return IS_REMOTE_USER; + } + + struct passwd pwd; + struct passwd *pwdresult; + char *buf; + size_t bufsize = sysconf(_SC_GETPW_R_SIZE_MAX); + if (bufsize == -1) { + bufsize = DEFAULT_SC_GETPW_R_SIZE_MAX; + } + + buf = malloc(bufsize); + if (buf == NULL) { + output_error("failed to allocate getpwnam_r buffer.\n"); + return ERROR_CHECK_LOCAL_USER; + } + + int s = getpwnam_r(user, &pwd, buf, bufsize, &pwdresult); + int result = IS_LOCAL_USER; + if (pwdresult == NULL) { + if (s == 0) + output_error("get user information user failed, user: %s not found\n", user); + else { + output_error("get user information failed, user: %s, errorno: %d\n", user, s); + } + + result = ERROR_CHECK_LOCAL_USER; + } + else if (strncmp(pwd.pw_gecos, REMOTE_USER_GECOS_PREFIX, strlen(REMOTE_USER_GECOS_PREFIX)) == 0) { + output_debug("user: %s, UID: %d, GECOS: %s is remote user.\n", user, pwd.pw_uid, pwd.pw_gecos); + result = IS_REMOTE_USER; + } + else { + output_debug("user: %s, UID: %d, GECOS: %s is local user.\n", user, pwd.pw_uid, pwd.pw_gecos); + result = IS_LOCAL_USER; + } + + free(buf); + return result; +} + +/* + * Get user name. + */ +char* get_user_name(char *user) +{ + if (user != NULL && strlen(user) != 0) { + return user; + } + + // uid is the real user id: https://man7.org/linux/man-pages/man2/geteuid.2.html + output_debug("Login user name is empty, try get user name by euid.\n"); + uid_t uid = getuid(); + struct passwd* userwd = getpwuid(uid); + if (userwd != NULL && userwd->pw_name != NULL) { + return userwd->pw_name; + } + + // euid is the effective user name, may not match real user id: https://man7.org/linux/man-pages/man2/geteuid.2.html + output_debug("Login user name is empty, try get user name by euid.\n"); + uid_t euid = geteuid(); + struct passwd* euserwd = getpwuid(euid); + if (euserwd != NULL && euserwd->pw_name != NULL) { + return euserwd->pw_name; + } + + // if can't find user name by both euid or ruid, return UNKNOWN. + return unknown_username; +} + +/* + * Tacacs authorization. + */ +int on_shell_execve (char *user, int shell_level, char *cmd, char **argv) +{ + char* user_namd = get_user_name(user); + output_debug("Authorization parameters:\n"); + output_debug(" Shell level: %d\n", shell_level); + output_debug(" Current user: %s\n", user_namd); + output_debug(" Command full path: %s\n", cmd); + output_debug(" Parameters:\n"); + char **parameter_array_pointer = argv; + int argc = 0; + while (*parameter_array_pointer != NULL) { + // output parameter + output_debug(" %s\n", *parameter_array_pointer); + + // move to next parameter + parameter_array_pointer++; + argc++; + } + + if (shell_level > 2) { + // when shell_level > 1, it's a recursive command in shell script. + output_debug("Recursive command %s ignored.\n", cmd); + return 0; + } + + // reload config file when tacacs config changed + check_and_load_changed_tacacs_config(); + + int check_local_user_result = is_local_user(user_namd); + if (check_local_user_result != IS_REMOTE_USER) { + /* + Return 0 to check with linux permission control in following 2 scenario: + 1: ERROR_CHECK_LOCAL_USER: check if user is local user failed because can't get user information. + In this case, as failback, check with linux permission control. + 2: IS_LOCAL_USER: user login as local user. + In this case, tacacs authorization disabled for local user. + */ + output_debug("ignore TACACS+ authorization for current user, check with local permission.\n"); + return 0; + } + + if (tacacs_ctrl & AUTHORIZATION_FLAG_TACACS) { + output_debug("start TACACS+ authorization for command %s with given arguments\n", cmd); + int ret = authorization_with_host_and_tty(user_namd, cmd, argv, argc); + switch (ret) { + case 0: + break; + case -2: + // -2 means no servers, so not authorized + fprintf(stdout, "%s not authorized by TACACS+ with given arguments, not executing\n", cmd); + break; + default: + fprintf(stdout, "%s authorize failed by TACACS+ with given arguments, not executing\n", cmd); + break; + } + + if ((tacacs_ctrl & AUTHORIZATION_FLAG_LOCAL) == 0) { + // when local authorization disabled, tacacs authorization failed will block user from run current command + output_debug("local authorization disabled, TACACS+ authorization result: %d\n", ret); + return ret; + } + } + + // return 0, so bash will continue run user command and will check user permission with linux permission check. + output_debug("start local authorization for command %s with given arguments\n", cmd); + return 0; +} \ No newline at end of file diff --git a/src/tacacs/bash_tacplus/configure.ac b/src/tacacs/bash_tacplus/configure.ac new file mode 100644 index 000000000000..fecafc54f19b --- /dev/null +++ b/src/tacacs/bash_tacplus/configure.ac @@ -0,0 +1,71 @@ +dnl +dnl File: configure.in +dnl Revision: $Id: configure.ac,v 1.0 2021/08/24 12:04:29 liuh@microsoft.com Exp $ +dnl Created: 2021/08/24 +dnl Author: Liu Hua +dnl +dnl Process this file with autoconf to produce a configure script +dnl You need autoconf 2.59 or better! +dnl +dnl --------------------------------------------------------------------------- + +AC_PREREQ(2.59) +AC_COPYRIGHT([ +See the included file: COPYING for copyright information. +]) +AC_INIT(bash_tacplus, 1.0.0, [liuh@microsoft.com]) + +AC_CONFIG_AUX_DIR(config) +AM_INIT_AUTOMAKE([foreign]) +AC_CONFIG_SRCDIR([bash_tacplus.c]) +AC_CONFIG_HEADER([config.h]) +AC_CONFIG_MACRO_DIR([config]) + +dnl -------------------------------------------------------------------- +dnl Checks for programs. +AC_PROG_CC +AM_PROG_CC_C_O +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET +AC_ENABLE_SHARED +AC_DISABLE_STATIC +AM_PROG_LIBTOOL + +dnl -------------------------------------------------------------------- +dnl Checks for libraries. +AC_CHECK_LIB(tac, tac_connect) +AC_CHECK_LIB(tacsupport, parse_config_file) + +dnl -------------------------------------------------------------------- +dnl Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/socket.h sys/time.h ]) +AC_CHECK_HEADER([libtac/libtac.h], [], [AC_MSG_ERROR([TAC libraries missing. ])] ) +AC_CHECK_HEADER([libtac/support.h], [], [AC_MSG_ERROR([TAC support libraries missing. ])] ) + +dnl -------------------------------------------------------------------- +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_TYPE_SIZE_T +AC_HEADER_TIME + +dnl -------------------------------------------------------------------- +dnl Checks for library functions. +AC_FUNC_REALLOC +AC_FUNC_SELECT_ARGTYPES +AC_TYPE_SIGNAL +AC_CHECK_FUNCS([bzero gethostbyname gettimeofday inet_ntoa select socket logwtmp getrandom]) + +dnl -------------------------------------------------------------------- +dnl Switch for plugin module dir +AC_ARG_ENABLE([plugindir], [AS_HELP_STRING([--enable-plugindir], + [Location to install the pam module ($libdir/security)])], + [plugindir=$enableval], [plugindir=$libdir/security]) +AC_SUBST(plugindir) + +dnl -------------------------------------------------------------------- +dnl Generate made files +AC_CONFIG_FILES([Makefile + unittest/Makefile]) +AC_OUTPUT diff --git a/src/tacacs/bash_tacplus/debian/bash-tacplus.postinst b/src/tacacs/bash_tacplus/debian/bash-tacplus.postinst new file mode 100644 index 000000000000..85006bb94dbd --- /dev/null +++ b/src/tacacs/bash_tacplus/debian/bash-tacplus.postinst @@ -0,0 +1,14 @@ +#!/bin/sh +# postinst script for bash-tacplus + +# find installed plugin +bash_tacplus_plugin_path=$(find /usr/lib/ -type f -name "bash_tacplus.so") + +# remove old config from bash plugin config file +config_file_path="/etc/bash_plugins.conf" +if [ -e $config_file_path ]; then + sed -i '/plugin=.*bash_tacplus\.so/d' $config_file_path +fi + +# add new plugin path to plugin config file +echo "plugin="$bash_tacplus_plugin_path >> $config_file_path diff --git a/src/tacacs/bash_tacplus/debian/changelog b/src/tacacs/bash_tacplus/debian/changelog new file mode 100644 index 000000000000..026c8c28fe14 --- /dev/null +++ b/src/tacacs/bash_tacplus/debian/changelog @@ -0,0 +1,6 @@ +bash-tacplus (1.0.0) unstable; urgency=low + + * First version of bash_tacplus debian package. + + -- Liu Hua Thu, 9 Sep 2021 16:00:00 +0000 + diff --git a/src/tacacs/bash_tacplus/debian/compat b/src/tacacs/bash_tacplus/debian/compat new file mode 100644 index 000000000000..f599e28b8ab0 --- /dev/null +++ b/src/tacacs/bash_tacplus/debian/compat @@ -0,0 +1 @@ +10 diff --git a/src/tacacs/bash_tacplus/debian/control b/src/tacacs/bash_tacplus/debian/control new file mode 100644 index 000000000000..d6325ec6de47 --- /dev/null +++ b/src/tacacs/bash_tacplus/debian/control @@ -0,0 +1,11 @@ +Source: bash-tacplus +Section: admin +Priority: extra +Maintainer: Liu Hua +Build-Depends: autoconf-archive +Description: Bash TACACS+ plugin. + +Package: bash-tacplus +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, libtac2 +Description: Bash TACACS+ plugin for per-command TACACS+ authorization. diff --git a/src/tacacs/bash_tacplus/debian/rules b/src/tacacs/bash_tacplus/debian/rules new file mode 100755 index 000000000000..16f9dd09f593 --- /dev/null +++ b/src/tacacs/bash_tacplus/debian/rules @@ -0,0 +1,27 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +#export DH_VERBOSE = 1 + + +# see FEATURE AREAS in dpkg-buildflags(1) +#export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +# see ENVIRONMENT in dpkg-buildflags(1) +# package maintainers to append CFLAGS +#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +# package maintainers to append LDFLAGS +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + + +%: + dh $@ + + +override_dh_auto_configure: + dh_auto_configure -- --enable-manuals + +override_dh_shlibdeps: + dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info + +override_dh_auto_test: \ No newline at end of file diff --git a/src/tacacs/bash_tacplus/debian/source/format b/src/tacacs/bash_tacplus/debian/source/format new file mode 100644 index 000000000000..163aaf8d82b6 --- /dev/null +++ b/src/tacacs/bash_tacplus/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/src/tacacs/bash_tacplus/unittest/Makefile.am b/src/tacacs/bash_tacplus/unittest/Makefile.am new file mode 100644 index 000000000000..5f3cf9af19ca --- /dev/null +++ b/src/tacacs/bash_tacplus/unittest/Makefile.am @@ -0,0 +1,14 @@ +AUTOMAKE_OPTIONS = subdir-objects + +noinst_PROGRAMS = plugin_test +TESTS = plugin_test + +# disable some warning because UT need test functions not in header file. +CFLAGS_TEST = -Wno-parentheses -Wno-format-security -Wno-implicit-function-declaration -Wno-int-to-pointer-cast +IFLAGS_TEST = -I.. -I../include -I../lib +DBGFLAGS = -DDEBUG -DBASH_PLUGIN_UT + +plugin_test_SOURCES = plugin_test.c mock_helper.c ../bash_tacplus.c + +plugin_test_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_TEST) $(IFLAGS_TEST) +plugin_test_LDADD = -lc -lcunit diff --git a/src/tacacs/bash_tacplus/unittest/mock_helper.c b/src/tacacs/bash_tacplus/unittest/mock_helper.c new file mode 100644 index 000000000000..6edbdbe1ac69 --- /dev/null +++ b/src/tacacs/bash_tacplus/unittest/mock_helper.c @@ -0,0 +1,209 @@ +/* mock_helper.c -- mock helper for bash plugin UT. */ +#include +#include +#include +#include +#include +#include + +/* Tacacs+ lib */ +#include + +#include "mock_helper.h" + +// define BASH_PLUGIN_UT_DEBUG to output UT debug message. +#if defined (BASH_PLUGIN_UT_DEBUG) +#define debug_printf printf +#define debug_vprintf vprintf +#else +#define debug_printf +#define debug_vprintf +#endif + +/* Mock syslog buffer */ +char mock_syslog_message_buffer[1024]; + +/* define test scenarios for mock functions return different value by scenario. */ +int test_scenario; + +/* Mock tac_netop method result buffer. */ +char tac_natop_result_buffer[128]; + +/* Mock tacplus_server_t. */ +typedef struct { + struct addrinfo *addr; + char key[256]; +} tacplus_server_t; + +/* Mock VRF name. */ +char *__vrfname = "MOCK VRF name"; + +/* Mock tac timeout setting. */ +int tac_timeout = 10; + +/* Mock TACACS servers. */ +int tac_srv_no = 3; +tacplus_server_t tac_srv[TAC_PLUS_MAXSERVERS]; +struct addrinfo tac_srv_addr[TAC_PLUS_MAXSERVERS]; +struct sockaddr tac_sock_addr[TAC_PLUS_MAXSERVERS]; + +/* Mock tac_source_addr. */ +struct addrinfo tac_source_addr; + +/* define memory allocate counter. */ +int memory_allocate_count; + +/* Initialize tacacs servers for test*/ +void initialize_tacacs_servers() +{ + for (int idx=0; idx < tac_srv_no; idx++) + { + // generate address with index + struct addrinfo hints, *servers; + char buffer[128]; + snprintf(buffer, sizeof(buffer), "1.2.3.%d", idx); + getaddrinfo(buffer, "49", &hints, &servers); + tac_srv[idx].addr = &(tac_srv_addr[idx]); + memcpy(tac_srv[idx].addr, servers, sizeof(struct addrinfo)); + + tac_srv[idx].addr->ai_addr = &(tac_sock_addr[idx]); + memcpy(tac_srv[idx].addr->ai_addr, servers->ai_addr, sizeof(struct sockaddr)); + + snprintf(tac_srv[idx].key, sizeof(tac_srv[idx].key), "key%d", idx); + freeaddrinfo(servers); + + debug_printf("MOCK: initialize_tacacs_servers with index: %d, address: %p\n", idx, tac_srv[idx].addr); + } +} + +/* Set test scenario for test*/ +void set_test_scenario(int scenario) +{ + test_scenario = scenario; +} + +/* Get test scenario for test*/ +int get_test_scenario() +{ + return test_scenario; +} + +/* Set memory allocate count for test*/ +void set_memory_allocate_count(int count) +{ + memory_allocate_count = count; +} + +/* Get memory allocate count for test*/ +int get_memory_allocate_count() +{ + return memory_allocate_count; +} + +/* Mock xcalloc method */ +void *xcalloc(size_t count, size_t size) +{ + memory_allocate_count++; + debug_printf("MOCK: xcalloc memory count: %d\n", memory_allocate_count); + return malloc(count*size); +} + +/* Mock tac_free_attrib method */ +void tac_add_attrib(struct tac_attrib **attr, char *attrname, char *attrvalue) +{ + debug_printf("MOCK: tac_add_attrib add attribute: %s, value: %s\n", attrname, attrvalue); +} + +/* Mock tac_free_attrib method */ +void tac_free_attrib(struct tac_attrib **attr) +{ + memory_allocate_count--; + debug_printf("MOCK: tac_free_attrib memory count: %d\n", memory_allocate_count); + + // the mock code here only free first allocated memory, because the mock tac_add_attrib implementation not allocate new memory. + free(*attr); +} + +/* Mock tac_author_send method */ +int tac_author_send(int tac_fd, const char *user, char *tty, char *host,struct tac_attrib *attr) +{ + debug_printf("MOCK: tac_author_send with fd: %d, user:%s, tty:%s, host:%s, attr:%p\n", tac_fd, user, tty, host, attr); + if(TEST_SCEANRIO_CONNECTION_SEND_FAILED_RESULT == test_scenario) + { + // send auth message failed + return -1; + } + + return 0; +} + +/* Mock tac_author_read method */ +int tac_author_read(int tac_fd, struct areply *reply) +{ + // TODO: fill reply message here for test + debug_printf("MOCK: tac_author_read with fd: %d\n", tac_fd); + if (TEST_SCEANRIO_CONNECTION_SEND_SUCCESS_READ_FAILED == test_scenario) + { + return -1; + } + + if (TEST_SCEANRIO_CONNECTION_SEND_DENINED_RESULT == test_scenario) + { + reply->status = AUTHOR_STATUS_FAIL; + } + else + { + reply->status = AUTHOR_STATUS_PASS_REPL; + } + + return 0; +} + +/* Mock tac_connect_single method */ +int tac_connect_single(const struct addrinfo *address, const char *key, struct addrinfo *source_address, int timeout, char *vrfname) +{ + debug_printf("MOCK: tac_connect_single with address: %p\n", address); + + switch (test_scenario) + { + case TEST_SCEANRIO_CONNECTION_ALL_FAILED: + return -1; + } + return 0; +} + +/* Mock tac_ntop method */ +char *tac_ntop(const struct sockaddr *address) +{ + for (int idx=0; idx < tac_srv_no; idx++) + { + if (address == &(tac_sock_addr[idx])) + { + snprintf(tac_natop_result_buffer, sizeof(tac_natop_result_buffer), "TestAddress%d", idx); + return tac_natop_result_buffer; + } + } + + return "UnknownTestAddress"; +} + +/* Mock parse_config_file method */ +int parse_config_file(const char *file) +{ + debug_printf("MOCK: parse_config_file: %s\n", file); +} + +/* Mock syslog method */ +void mock_syslog(int priority, const char *format, ...) +{ + // set mock message data to buffer for UT. + memset(mock_syslog_message_buffer, 0, sizeof(mock_syslog_message_buffer)); + + va_list args; + va_start (args, format); + // save message to buffer to UT check later + vsnprintf(mock_syslog_message_buffer, sizeof(mock_syslog_message_buffer), format, args); + va_end (args); + + debug_printf("MOCK: syslog: %s\n", mock_syslog_message_buffer); +} \ No newline at end of file diff --git a/src/tacacs/bash_tacplus/unittest/mock_helper.h b/src/tacacs/bash_tacplus/unittest/mock_helper.h new file mode 100644 index 000000000000..348b7810fc0e --- /dev/null +++ b/src/tacacs/bash_tacplus/unittest/mock_helper.h @@ -0,0 +1,46 @@ +/* plugin.h - functions from plugin.c. */ + +/* Copyright (C) 1993-2015 Free Software Foundation, Inc. + + This file is part of GNU Bash, the Bourne Again SHell. + + Bash is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Bash is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Bash. If not, see . +*/ + +#if !defined (_MOCK_HELPER_H_) +#define _MOCK_HELPER_H_ + +/* Mock syslog buffer */ +extern char mock_syslog_message_buffer[1024]; + +#define TEST_SCEANRIO_CONNECTION_ALL_FAILED 1 +#define TEST_SCEANRIO_CONNECTION_SEND_FAILED_RESULT 2 +#define TEST_SCEANRIO_CONNECTION_SEND_SUCCESS_READ_FAILED 3 +#define TEST_SCEANRIO_CONNECTION_SEND_DENINED_RESULT 4 +#define TEST_SCEANRIO_CONNECTION_SEND_SUCCESS_RESULT 5 + +/* Set test scenario for test*/ +void set_test_scenario(int scenario); + +/* Get test scenario for test*/ +int get_test_scenario(); + +/* Set memory allocate count for test*/ +void set_memory_allocate_count(int count); + +/* Get memory allocate count for test*/ +int get_memory_allocate_count(); + + +#endif /* _MOCK_HELPER_H_ */ \ No newline at end of file diff --git a/src/tacacs/bash_tacplus/unittest/plugin_test.c b/src/tacacs/bash_tacplus/unittest/plugin_test.c new file mode 100644 index 000000000000..2617fd8249ff --- /dev/null +++ b/src/tacacs/bash_tacplus/unittest/plugin_test.c @@ -0,0 +1,219 @@ +#include +#include +#include +#include +#include "mock_helper.h" +#include + +/* tacacs debug flag */ +extern int tacacs_ctrl; + +int clean_up() { + return 0; +} + +int start_up() { + initialize_tacacs_servers(); + tacacs_ctrl = PAM_TAC_DEBUG; + return 0; +} + +/* Test tacacs_authorization all tacacs server connect failed case */ +void testcase_tacacs_authorization_all_failed() { + char *testargv[2]; + testargv[0] = "arg1"; + testargv[1] = "arg2"; + + + // test connection failed case + set_test_scenario(TEST_SCEANRIO_CONNECTION_ALL_FAILED); + int result = tacacs_authorization("test_user","tty0","test_host","test_command",testargv,2); + + CU_ASSERT_STRING_EQUAL(mock_syslog_message_buffer, "Failed to connect to TACACS server(s)\n"); + + // check return value, -2 for all server not reachable + CU_ASSERT_EQUAL(result, -2); +} + +/* Test tacacs_authorization get failed result case */ +void testcase_tacacs_authorization_faled() { + char *testargv[2]; + testargv[0] = "arg1"; + testargv[1] = "arg2"; + + // test connection failed case + set_test_scenario(TEST_SCEANRIO_CONNECTION_SEND_FAILED_RESULT); + int result = tacacs_authorization("test_user","tty0","test_host","test_command",testargv,2); + + // send auth message failed. + CU_ASSERT_EQUAL(result, -1); +} + +/* Test tacacs_authorization read failed case */ +void testcase_tacacs_authorization_read_failed() { + char *testargv[2]; + testargv[0] = "arg1"; + testargv[1] = "arg2"; + + // test connection failed case + set_test_scenario(TEST_SCEANRIO_CONNECTION_SEND_SUCCESS_READ_FAILED); + int result = tacacs_authorization("test_user","tty0","test_host","test_command",testargv,2); + + CU_ASSERT_STRING_EQUAL(mock_syslog_message_buffer, "test_command not authorized from TestAddress2\n"); + + // read auth message failed. + CU_ASSERT_EQUAL(result, -1); +} + +/* Test tacacs_authorization get denined case */ +void testcase_tacacs_authorization_denined() { + char *testargv[2]; + testargv[0] = "arg1"; + testargv[1] = "arg2"; + + // test connection denined case + set_test_scenario(TEST_SCEANRIO_CONNECTION_SEND_DENINED_RESULT); + int result = tacacs_authorization("test_user","tty0","test_host","test_command",testargv,2); + + CU_ASSERT_STRING_EQUAL(mock_syslog_message_buffer, "test_command not authorized from TestAddress2\n"); + + // send auth message denined. + CU_ASSERT_EQUAL(result, 1); +} + +/* Test tacacs_authorization get success case */ +void testcase_tacacs_authorization_success() { + char *testargv[2]; + testargv[0] = "arg1"; + testargv[1] = "arg2"; + + // test connection success case + set_test_scenario(TEST_SCEANRIO_CONNECTION_SEND_SUCCESS_RESULT); + int result = tacacs_authorization("test_user","tty0","test_host","test_command",testargv,2); + + // wuthorization success + CU_ASSERT_EQUAL(result, 0); +} + +/* Test authorization_with_host_and_tty get success case */ +void testcase_authorization_with_host_and_tty_success() { + char *testargv[2]; + testargv[0] = "arg1"; + testargv[1] = "arg2"; + + // test connection success case + set_test_scenario(TEST_SCEANRIO_CONNECTION_SEND_SUCCESS_RESULT); + int result = authorization_with_host_and_tty("test_user","test_command",testargv,2); + + // wuthorization success + CU_ASSERT_EQUAL(result, 0); +} + +/* Test check_and_load_changed_tacacs_config */ +void testcase_check_and_load_changed_tacacs_config() { + + // test connection failed case + check_and_load_changed_tacacs_config(); + + // check server config updated. + CU_ASSERT_STRING_EQUAL(mock_syslog_message_buffer, "Server 2, address:TestAddress2, key:key2\n"); + + // check and load file again. + check_and_load_changed_tacacs_config(); + + // check server config not update. + char* configNotChangeLog = "tacacs config file not change: last modified time"; + CU_ASSERT_TRUE(strncmp(mock_syslog_message_buffer, configNotChangeLog, strlen(configNotChangeLog)) == 0); +} + +/* Test on_shell_execve authorization successed */ +void testcase_on_shell_execve_success() { + char *testargv[2]; + testargv[0] = "arg1"; + testargv[1] = "arg2"; + testargv[2] = 0; + + // test connection failed case + set_test_scenario(TEST_SCEANRIO_CONNECTION_SEND_SUCCESS_RESULT); + on_shell_execve("test_user", 1, "test_command", testargv); + + // check authorized success. + CU_ASSERT_STRING_EQUAL(mock_syslog_message_buffer, "test_command authorize successed by TACACS+ with given arguments\n"); +} + +/* Test on_shell_execve authorization denined */ +void testcase_on_shell_execve_denined() { + char *testargv[2]; + testargv[0] = "arg1"; + testargv[1] = "arg2"; + testargv[2] = 0; + + // test connection failed case + set_test_scenario(TEST_SCEANRIO_CONNECTION_SEND_DENINED_RESULT); + on_shell_execve("test_user", 1, "test_command", testargv); + + // check authorized failed. + CU_ASSERT_STRING_EQUAL(mock_syslog_message_buffer, "test_command authorize failed by TACACS+ with given arguments, not executing\n"); +} + +/* Test on_shell_execve authorization failed */ +void testcase_on_shell_execve_failed() { + char *testargv[2]; + testargv[0] = "arg1"; + testargv[1] = "arg2"; + testargv[2] = 0; + + // test connection failed case + set_test_scenario(TEST_SCEANRIO_CONNECTION_ALL_FAILED); + on_shell_execve("test_user", 1, "test_command", testargv); + + // check not authorized. + CU_ASSERT_STRING_EQUAL(mock_syslog_message_buffer, "test_command not authorized by TACACS+ with given arguments, not executing\n"); +} + +int main(void) { + if (CUE_SUCCESS != CU_initialize_registry()) { + return CU_get_error(); + } + + CU_pSuite ste = CU_add_suite("plugin_test", start_up, clean_up); + if (NULL == ste) { + CU_cleanup_registry(); + return CU_get_error(); + } + + if (CU_get_error() != CUE_SUCCESS) { + fprintf(stderr, "Error creating suite: (%d)%s\n", CU_get_error(), CU_get_error_msg()); + return CU_get_error(); + } + + if (!CU_add_test(ste, "Test testcase_tacacs_authorization_all_failed()...\n", testcase_tacacs_authorization_all_failed) + || !CU_add_test(ste, "Test testcase_tacacs_authorization_faled()...\n", testcase_tacacs_authorization_faled) + || !CU_add_test(ste, "Test testcase_tacacs_authorization_read_failed()...\n", testcase_tacacs_authorization_read_failed) + || !CU_add_test(ste, "Test testcase_tacacs_authorization_denined()...\n", testcase_tacacs_authorization_denined) + || !CU_add_test(ste, "Test testcase_tacacs_authorization_success()...\n", testcase_tacacs_authorization_success) + || !CU_add_test(ste, "Test testcase_authorization_with_host_and_tty_success()...\n", testcase_authorization_with_host_and_tty_success) + || !CU_add_test(ste, "Test testcase_check_and_load_changed_tacacs_config()...\n", testcase_check_and_load_changed_tacacs_config) + || !CU_add_test(ste, "Test testcase_on_shell_execve_success()...\n", testcase_on_shell_execve_success) + || !CU_add_test(ste, "Test testcase_on_shell_execve_denined()...\n", testcase_on_shell_execve_denined) + || !CU_add_test(ste, "Test testcase_on_shell_execve_failed()...\n", testcase_on_shell_execve_failed)) { + CU_cleanup_registry(); + return CU_get_error(); + } + + if (CU_get_error() != CUE_SUCCESS) { + fprintf(stderr, "Error adding test: (%d)%s\n", CU_get_error(), CU_get_error_msg()); + } + + // run all test + CU_basic_set_mode(CU_BRM_VERBOSE); + CU_ErrorCode run_errors = CU_basic_run_suite(ste); + if (run_errors != CUE_SUCCESS) { + fprintf(stderr, "Error running tests: (%d)%s\n", run_errors, CU_get_error_msg()); + } + + CU_basic_show_failures(CU_get_failure_list()); + + // use failed UT count as return value + return CU_get_number_of_failure_records(); +} \ No newline at end of file diff --git a/src/tacacs/pam/0006-Add-support-for-source-ip-address.patch b/src/tacacs/pam/0006-Add-support-for-source-ip-address.patch index 280cfeee28fb..8230b34e0d1a 100644 --- a/src/tacacs/pam/0006-Add-support-for-source-ip-address.patch +++ b/src/tacacs/pam/0006-Add-support-for-source-ip-address.patch @@ -1,16 +1,16 @@ -From 9c26e734cf9e5cec950dc8b8f474f89d87833bcd Mon Sep 17 00:00:00 2001 +From 49526a27e90647ed4e48c1d1d88e0c75a1ce221b Mon Sep 17 00:00:00 2001 From: Venkatesan Mahalingam -Date: Wed, 1 Jul 2020 18:57:28 -0700 -Subject: [PATCH] Add support to specify source address for TACACS+ +Date: Thu, 2 Jul 2020 09:57:28 +0800 +Subject: [PATCH 1/4] Add support to specify source address for TACACS+ --- pam_tacplus.c | 8 ++++---- - support.c | 31 +++++++++++++++++++++++++++++++ + support.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++-- support.h | 1 + - 3 files changed, 36 insertions(+), 4 deletions(-) + 3 files changed, 57 insertions(+), 6 deletions(-) diff --git a/pam_tacplus.c b/pam_tacplus.c -index 38e2a70..ec8ea27 100644 +index 7544b2e..9fc6be7 100644 --- a/pam_tacplus.c +++ b/pam_tacplus.c @@ -177,7 +177,7 @@ int _pam_account(pam_handle_t *pamh, int argc, const char **argv, @@ -50,7 +50,7 @@ index 38e2a70..ec8ea27 100644 _pam_log(LOG_ERR, "connection failed srv %d: %m", srv_i); continue; diff --git a/support.c b/support.c -index 7c00618..3e55e2f 100644 +index 8f42a0c..164df62 100644 --- a/support.c +++ b/support.c @@ -37,6 +37,8 @@ char tac_service[64]; @@ -62,31 +62,76 @@ index 7c00618..3e55e2f 100644 void _pam_log(int err, const char *format,...) { char msg[256]; -@@ -183,6 +185,12 @@ int _pam_parse (int argc, const char **argv) { +@@ -171,6 +173,44 @@ int tacacs_get_password (pam_handle_t * pamh, int flags + return PAM_SUCCESS; + } + ++/* set source ip address for the outgoing tacacs packets */ ++void set_source_ip(const char *tac_source_ip) { ++ /* ++ addrinfo created by getaddrinfo must be released with freeaddrinfo. ++ so source ip address will be stored in following static variables. ++ */ ++ static struct addrinfo tac_source_address; ++ static struct sockaddr tac_source_sock_addr; ++ static struct sockaddr_in6 tac_source_sock6_addr; ++ ++ struct addrinfo hints, *source_address; ++ int rv; ++ ++ /* set the source ip address for the tacacs packets */ ++ memset(&hints, 0, sizeof(hints)); ++ hints.ai_family = AF_UNSPEC; ++ hints.ai_socktype = SOCK_STREAM; ++ if ((rv = getaddrinfo(tac_source_ip, NULL, &hints, ++ &source_address)) != 0) { ++ _pam_log(LOG_ERR, "error setting the source ip information"); ++ } else { ++ tac_source_addr = &tac_source_address; ++ memcpy(tac_source_addr, source_address, sizeof(struct addrinfo)); ++ ++ if (source_address->ai_family == AF_INET6) { ++ tac_source_addr->ai_addr = (struct sockaddr *)&(tac_source_sock6_addr); ++ memcpy(tac_source_addr->ai_addr, source_address->ai_addr, sizeof(struct sockaddr_in6)); ++ } ++ else { ++ tac_source_addr->ai_addr = &(tac_source_sock_addr); ++ memcpy(tac_source_addr->ai_addr, source_address->ai_addr, sizeof(struct sockaddr)); ++ } ++ ++ freeaddrinfo(source_address); ++ _pam_log(LOG_DEBUG, "source ip is set"); ++ } ++} ++ + int _pam_parse (int argc, const char **argv) { + int ctrl = 0; + const char *current_secret = NULL; +@@ -183,6 +223,12 @@ int _pam_parse (int argc, const char **argv) { tac_protocol[0] = 0; tac_prompt[0] = 0; tac_login[0] = 0; + tac_source_ip[0] = 0; + + if (tac_source_addr != NULL) { -+ freeaddrinfo(tac_source_addr); ++ /* reset source address */ + tac_source_addr = NULL; + } for (ctrl = 0; argc-- > 0; ++argv) { if (!strcmp (*argv, "debug")) { /* all */ -@@ -274,6 +282,10 @@ int _pam_parse (int argc, const char **argv) { +@@ -274,6 +320,10 @@ int _pam_parse (int argc, const char **argv) { } } else if(!strncmp(*argv, "vrf=", 4)) { __vrfname = strdup(*argv + 4); + } else if (!strncmp (*argv, "source_ip=", strlen("source_ip="))) { + /* source ip for the packets */ + strncpy (tac_source_ip, *argv + strlen("source_ip="), sizeof(tac_source_ip)); -+ set_source_ip (tac_source_ip, &tac_source_addr); ++ set_source_ip(tac_source_ip); } else { _pam_log (LOG_WARNING, "unrecognized option: %s", *argv); } -@@ -292,8 +304,27 @@ int _pam_parse (int argc, const char **argv) { +@@ -292,8 +342,8 @@ int _pam_parse (int argc, const char **argv) { _pam_log(LOG_DEBUG, "tac_protocol='%s'", tac_protocol); _pam_log(LOG_DEBUG, "tac_prompt='%s'", tac_prompt); _pam_log(LOG_DEBUG, "tac_login='%s'", tac_login); @@ -94,28 +139,12 @@ index 7c00618..3e55e2f 100644 } return ctrl; - } /* _pam_parse */ - -+/* set source ip address for the outgoing tacacs packets */ -+void set_source_ip(const char *tac_source_ip, -+ struct addrinfo **source_address) { -+ -+ struct addrinfo hints; -+ int rv; -+ -+ /* set the source ip address for the tacacs packets */ -+ memset(&hints, 0, sizeof(hints)); -+ hints.ai_family = AF_UNSPEC; -+ hints.ai_socktype = SOCK_STREAM; -+ if ((rv = getaddrinfo(tac_source_ip, NULL, &hints, -+ source_address)) != 0) { -+ _pam_log(LOG_ERR, "error setting the source ip information"); -+ } else { -+ _pam_log(LOG_DEBUG, "source ip is set"); -+ } -+} +-} /* _pam_parse */ +- ++} /* _pam_parse */ +\ No newline at end of file diff --git a/support.h b/support.h -index 9cbd040..09b8a85 100644 +index 9cbd040..b1faf43 100644 --- a/support.h +++ b/support.h @@ -37,6 +37,7 @@ extern int tac_srv_no; @@ -127,5 +156,5 @@ index 9cbd040..09b8a85 100644 int _pam_parse (int, const char **); unsigned long _resolve_name (char *); -- -2.7.4 +2.17.1.windows.2 diff --git a/src/tacacs/pam/0007-Fix-memory-leak-when-parse-configuration.patch b/src/tacacs/pam/0007-Fix-memory-leak-when-parse-configuration.patch new file mode 100644 index 000000000000..f79521d9028d --- /dev/null +++ b/src/tacacs/pam/0007-Fix-memory-leak-when-parse-configuration.patch @@ -0,0 +1,124 @@ +From 99eeeccd14c905b7ad77210343bb07334eb0e8d1 Mon Sep 17 00:00:00 2001 +From: liuh-80 <58683130+liuh-80@users.noreply.github.com> +Date: Tue, 12 Oct 2021 10:05:28 +0800 +Subject: [PATCH 2/4] Fix memory leak when parse configuration. +The fix code in this patch are copy from upstream project: https://github.com/kravietz/pam_tacplus/blob/master/support.c + +--- + pam_tacplus.c | 6 ++++-- + support.c | 37 +++++++++++++++++++++++++++++++++---- + support.h | 2 +- + 3 files changed, 38 insertions(+), 7 deletions(-) + +diff --git a/pam_tacplus.c b/pam_tacplus.c +index 9fc6be7..d062359 100644 +--- a/pam_tacplus.c ++++ b/pam_tacplus.c +@@ -323,7 +323,8 @@ int pam_sm_authenticate (pam_handle_t * pamh, int flags, + status = PAM_SUCCESS; + communicating = 0; + active_server.addr = tac_srv[srv_i].addr; +- active_server.key = tac_srv[srv_i].key; ++ /* copy secret to key */ ++ snprintf(active_server.key, sizeof(active_server.key), "%s", tac_srv[srv_i].key); + + if (ctrl & PAM_TAC_DEBUG) + syslog(LOG_DEBUG, "%s: active srv %d", __FUNCTION__, srv_i); +@@ -820,7 +821,8 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags, + communicating = 0; + + active_server.addr = tac_srv[srv_i].addr; +- active_server.key = tac_srv[srv_i].key; ++ /* copy secret to key */ ++ snprintf(active_server.key, sizeof(active_server.key), "%s", tac_srv[srv_i].key); + + if (ctrl & PAM_TAC_DEBUG) + syslog(LOG_DEBUG, "%s: active srv %d", __FUNCTION__, srv_i); +diff --git a/support.c b/support.c +index 164df62..e22fa31 100644 +--- a/support.c ++++ b/support.c +@@ -30,7 +30,12 @@ + #include + #include + ++/* tacacs server information */ + tacplus_server_t tac_srv[TAC_PLUS_MAXSERVERS]; ++struct addrinfo tac_srv_addr[TAC_PLUS_MAXSERVERS]; ++struct sockaddr tac_sock_addr[TAC_PLUS_MAXSERVERS]; ++struct sockaddr_in6 tac_sock6_addr[TAC_PLUS_MAXSERVERS]; ++ + int tac_srv_no = 0; + + char tac_service[64]; +@@ -173,6 +178,26 @@ int tacacs_get_password (pam_handle_t * pamh, int flags + return PAM_SUCCESS; + } + ++/* ++ * Set tacacs server addrinfo. ++ */ ++void set_tacacs_server_addr(int tac_srv_no, struct addrinfo* server) { ++ tac_srv[tac_srv_no].addr = &(tac_srv_addr[tac_srv_no]); ++ memcpy(tac_srv[tac_srv_no].addr, server, sizeof(struct addrinfo)); ++ ++ if (server->ai_family == AF_INET6) { ++ tac_srv[tac_srv_no].addr->ai_addr = (struct sockaddr *)&(tac_sock6_addr[tac_srv_no]); ++ memcpy(tac_srv[tac_srv_no].addr->ai_addr, server->ai_addr, sizeof(struct sockaddr_in6)); ++ } ++ else { ++ tac_srv[tac_srv_no].addr->ai_addr = &(tac_sock_addr[tac_srv_no]); ++ memcpy(tac_srv[tac_srv_no].addr->ai_addr, server->ai_addr, sizeof(struct sockaddr)); ++ } ++ ++ tac_srv[tac_srv_no].addr->ai_canonname = NULL; ++ tac_srv[tac_srv_no].addr->ai_next = NULL; ++} ++ + /* set source ip address for the outgoing tacacs packets */ + void set_source_ip(const char *tac_source_ip) { + /* +@@ -284,8 +309,11 @@ int _pam_parse (int argc, const char **argv) { + } + if ((rv = getaddrinfo(server_name, (port == NULL) ? "49" : port, &hints, &servers)) == 0) { + for(server = servers; server != NULL && tac_srv_no < TAC_PLUS_MAXSERVERS; server = server->ai_next) { +- tac_srv[tac_srv_no].addr = server; +- tac_srv[tac_srv_no].key = current_secret; ++ /* set server address with allocate memory */ ++ set_tacacs_server_addr(tac_srv_no, server); ++ ++ /* copy secret to key */ ++ snprintf(tac_srv[tac_srv_no].key, sizeof(tac_srv[tac_srv_no].key), "%s", current_secret); + tac_srv_no++; + } + } else { +@@ -304,10 +332,11 @@ int _pam_parse (int argc, const char **argv) { + + /* if 'secret=' was given after a 'server=' parameter, fill in the current secret */ + for(i = tac_srv_no-1; i >= 0; i--) { +- if (tac_srv[i].key != NULL) ++ if (tac_srv[i].key[0] != 0) + break; + +- tac_srv[i].key = current_secret; ++ /* copy secret to key */ ++ snprintf(tac_srv[i].key, sizeof(tac_srv[i].key), "%s", current_secret); + } + } else if (!strncmp (*argv, "timeout=", 8)) { + /* FIXME atoi() doesn't handle invalid numeric strings well */ +diff --git a/support.h b/support.h +index b1faf43..6bcb07f 100644 +--- a/support.h ++++ b/support.h +@@ -28,7 +28,7 @@ + + typedef struct { + struct addrinfo *addr; +- const char *key; ++ char key[256]; + } tacplus_server_t; + + extern tacplus_server_t tac_srv[TAC_PLUS_MAXSERVERS]; +-- +2.17.1.windows.2 + diff --git a/src/tacacs/pam/0008-Extract-tacacs-support-functions-into-library.patch b/src/tacacs/pam/0008-Extract-tacacs-support-functions-into-library.patch new file mode 100644 index 000000000000..60fe2637c1b6 --- /dev/null +++ b/src/tacacs/pam/0008-Extract-tacacs-support-functions-into-library.patch @@ -0,0 +1,485 @@ +From 81a8b6135cb0c97a291195b04375d0ca33943621 Mon Sep 17 00:00:00 2001 +From: liuh-80 <58683130+liuh-80@users.noreply.github.com> +Date: Tue, 12 Oct 2021 10:09:10 +0800 +Subject: [PATCH] Extract tacacs support functions into library. + +--- + Makefile.am | 16 ++- + configure.ac | 3 +- + libtacsupport.pc.in | 11 ++ + pam_tacplus.c | 3 - + pam_tacplus.h | 6 - + support.c | 288 ++++++++++++++++++++++++++++---------------- + support.h | 14 +++ + 7 files changed, 222 insertions(+), 119 deletions(-) + create mode 100644 libtacsupport.pc.in + +diff --git a/Makefile.am b/Makefile.am +index c90c582..b22c78b 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -20,7 +20,7 @@ libtac/include/tacplus.h \ + libtac/include/libtac.h \ + libtac/include/cdefs.h + +-lib_LTLIBRARIES = libtac.la ++lib_LTLIBRARIES = libtac.la libtacsupport.la + libtac_la_SOURCES = \ + libtac/lib/acct_r.c \ + libtac/lib/acct_s.c \ +@@ -48,6 +48,16 @@ $(libtac_include_HEADERS) + libtac_la_CFLAGS = $(AM_CFLAGS) -I $(top_srcdir)/libtac/include + libtac_la_LDFLAGS = -version-info 2:0:0 -shared + ++libtacsupport_includedir = $(includedir)/libtac ++libtacsupport_include_HEADERS = \ ++support.h ++ ++libtacsupport_la_SOURCES = \ ++support.c \ ++$(libtacsupport_include_HEADERS) ++libtacsupport_la_CFLAGS = $(AM_CFLAGS) -I $(top_srcdir) -I $(top_srcdir)/libtac/include ++libtacsupport_la_LDFLAGS = -version-info 2:0:0 -shared ++ + moduledir = @pamdir@ + module_LTLIBRARIES = pam_tacplus.la + pam_tacplus_la_SOURCES = pam_tacplus.h \ +@@ -58,7 +68,7 @@ pam_tacplus_la_CFLAGS = $(AM_CFLAGS) -I $(top_srcdir)/libtac/include + pam_tacplus_la_LDFLAGS = -module -avoid-version + pam_tacplus_la_LIBADD = libtac.la + +-EXTRA_DIST = pam_tacplus.spec libtac.pc.in ++EXTRA_DIST = pam_tacplus.spec libtac.pc.in libtacsupport.pc.in + if DOC + dist_doc_DATA = sample.pam README.md AUTHORS ChangeLog + endif +@@ -68,5 +78,5 @@ MAINTAINERCLEANFILES = Makefile.in config.h.in configure aclocal.m4 \ + config/install-sh config/ltmain.sh config/missing + + pkgconfigdir = $(libdir)/pkgconfig +-pkgconfig_DATA = libtac.pc ++pkgconfig_DATA = libtac.pc libtacsupport.pc + +diff --git a/configure.ac b/configure.ac +index f67e2ba..e2e3fa9 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -95,6 +95,7 @@ AM_CONDITIONAL(DOC, test "x$enable_doc" != "xno") + dnl -------------------------------------------------------------------- + dnl Generate made files + AC_CONFIG_FILES([Makefile +- libtac.pc ++ libtac.pc ++ libtacsupport.pc + pam_tacplus.spec]) + AC_OUTPUT +diff --git a/libtacsupport.pc.in b/libtacsupport.pc.in +new file mode 100644 +index 0000000..9698094 +--- /dev/null ++++ b/libtacsupport.pc.in +@@ -0,0 +1,11 @@ ++prefix=@prefix@ ++exec_prefix=@exec_prefix@ ++libdir=@libdir@ ++includedir=@includedir@/libtac ++ ++Name: libtacsupport ++Description: TACACS+ support lib implementation ++URL: https://github.com/jeroennijhof/pam_tacplus ++Version: @VERSION@ ++Libs: -L${libdir} -ltacsupport ++Cflags: -I${includedir} +diff --git a/pam_tacplus.c b/pam_tacplus.c +index d062359..2a484f0 100644 +--- a/pam_tacplus.c ++++ b/pam_tacplus.c +@@ -53,9 +53,6 @@ static tacplus_server_t active_server; + /* accounting task identifier */ + static short int task_id = 0; + +-extern char *__vrfname; +- +- + /* Helper functions */ + int _pam_send_account(int tac_fd, int type, const char *user, char *tty, + char *r_addr, char *cmd) { +diff --git a/pam_tacplus.h b/pam_tacplus.h +index bc71b54..e7b30f7 100644 +--- a/pam_tacplus.h ++++ b/pam_tacplus.h +@@ -31,12 +31,6 @@ + #include + #include + +-/* pam_tacplus command line options */ +-#define PAM_TAC_DEBUG 0x01 +-#define PAM_TAC_ACCT 0x02 /* account on all specified servers */ +-#define PAM_TAC_USE_FIRST_PASS 0x04 +-#define PAM_TAC_TRY_FIRST_PASS 0x08 +- + /* pam_tacplus major, minor and patchlevel version numbers */ + #define PAM_TAC_VMAJ 1 + #define PAM_TAC_VMIN 3 +diff --git a/support.c b/support.c +index 2f77bc8..5f43b1a 100644 +--- a/support.c ++++ b/support.c +@@ -29,7 +29,11 @@ + + #include + #include ++#include /* isspace() */ + ++/* tacacs config file splitter */ ++#define CONFIG_FILE_SPLITTER " ,\t\n\r\f" ++ + /* tacacs server information */ + tacplus_server_t tac_srv[TAC_PLUS_MAXSERVERS]; + struct addrinfo tac_srv_addr[TAC_PLUS_MAXSERVERS]; +@@ -234,11 +238,182 @@ void set_source_ip(const char *tac_source_ip) { + freeaddrinfo(source_address); + _pam_log(LOG_DEBUG, "source ip is set"); + } ++} ++ ++/* ++ * Reset configuration variables. ++ * This method need to be called before parse config, otherwise the server list will grow with each call. ++ */ ++int reset_config_variables () { ++ memset(tac_srv, 0, sizeof(tacplus_server_t) * TAC_PLUS_MAXSERVERS); ++ tac_srv_no = 0; ++ ++ tac_service[0] = 0; ++ tac_protocol[0] = 0; ++ tac_prompt[0] = 0; ++ tac_login[0] = 0; ++ tac_source_ip[0] = 0; ++ ++ if (tac_source_addr != NULL) { ++ /* reset source address */ ++ tac_source_addr = NULL; ++ } ++} ++ ++/* ++ * Parse one arguments. ++ * Use this method for both: ++ * 1. command line parameter ++ * 2. config file ++ */ ++int _pam_parse_arg (const char *arg, char* current_secret, uint current_secret_buffer_size) { ++ int ctrl = 0; ++ ++ if (!strcmp (arg, "debug")) { /* all */ ++ ctrl |= PAM_TAC_DEBUG; ++ } else if (!strcmp (arg, "use_first_pass")) { ++ ctrl |= PAM_TAC_USE_FIRST_PASS; ++ } else if (!strcmp (arg, "try_first_pass")) { ++ ctrl |= PAM_TAC_TRY_FIRST_PASS; ++ } else if (!strncmp (arg, "service=", 8)) { /* author & acct */ ++ xstrcpy (tac_service, arg + 8, sizeof(tac_service)); ++ } else if (!strncmp (arg, "protocol=", 9)) { /* author & acct */ ++ xstrcpy (tac_protocol, arg + 9, sizeof(tac_protocol)); ++ } else if (!strncmp (arg, "prompt=", 7)) { /* authentication */ ++ xstrcpy (tac_prompt, arg + 7, sizeof(tac_prompt)); ++ /* Replace _ with space */ ++ int chr; ++ for (chr = 0; chr < strlen(tac_prompt); chr++) { ++ if (tac_prompt[chr] == '_') { ++ tac_prompt[chr] = ' '; ++ } ++ } ++ } else if (!strncmp (arg, "login=", 6)) { ++ xstrcpy (tac_login, arg + 6, sizeof(tac_login)); ++ } else if (!strcmp (arg, "acct_all")) { ++ ctrl |= PAM_TAC_ACCT; ++ } else if (!strncmp (arg, "server=", 7)) { /* authen & acct */ ++ if(tac_srv_no < TAC_PLUS_MAXSERVERS) { ++ struct addrinfo hints, *servers, *server; ++ int rv; ++ char *close_bracket, *server_name, *port, server_buf[256]; ++ ++ memset(&hints, 0, sizeof hints); ++ hints.ai_family = AF_UNSPEC; /* use IPv4 or IPv6, whichever */ ++ hints.ai_socktype = SOCK_STREAM; ++ ++ if (strlen(arg + 7) >= sizeof(server_buf)) { ++ _pam_log(LOG_ERR, "server address too long, sorry"); ++ return ctrl; ++ } ++ strcpy(server_buf, arg + 7); ++ ++ if (*server_buf == '[' && (close_bracket = strchr(server_buf, ']')) != NULL) { /* Check for URI syntax */ ++ server_name = server_buf + 1; ++ port = strrchr(close_bracket, ':'); ++ *close_bracket = '\0'; ++ } else { /* Fall back to traditional syntax */ ++ server_name = server_buf; ++ port = strrchr(server_buf, ':'); ++ } ++ if (port != NULL) { ++ *port = '\0'; ++ port++; ++ } ++ if ((rv = getaddrinfo(server_name, (port == NULL) ? "49" : port, &hints, &servers)) == 0) { ++ for(server = servers; server != NULL && tac_srv_no < TAC_PLUS_MAXSERVERS; server = server->ai_next) { ++ /* set server address with allocate memory */ ++ set_tacacs_server_addr(tac_srv_no, server); ++ ++ /* copy secret to key */ ++ snprintf(tac_srv[tac_srv_no].key, sizeof(tac_srv[tac_srv_no].key), "%s", current_secret); ++ tac_srv_no++; ++ } ++ ++ /* release servers memory */ ++ freeaddrinfo(servers); ++ } else { ++ _pam_log (LOG_ERR, ++ "skip invalid server: %s (getaddrinfo: %s)", ++ server_name, gai_strerror(rv)); ++ } ++ } else { ++ _pam_log(LOG_ERR, "maximum number of servers (%d) exceeded, skipping", ++ TAC_PLUS_MAXSERVERS); ++ } ++ } else if (!strncmp (arg, "secret=", 7)) { ++ int i; ++ ++ /* points right into arg (which is const) */ ++ snprintf(current_secret, current_secret_buffer_size, "%s", arg + 7); ++ ++ /* if 'secret=' was given after a 'server=' parameter, fill in the current secret */ ++ for(i = tac_srv_no-1; i >= 0; i--) { ++ if (tac_srv[i].key[0] != 0) ++ break; ++ ++ /* copy secret to key */ ++ snprintf(tac_srv[i].key, sizeof(tac_srv[i].key), "%s", current_secret); ++ } ++ } else if (!strncmp (arg, "timeout=", 8)) { ++ /* FIXME atoi() doesn't handle invalid numeric strings well */ ++ tac_timeout = atoi(arg + 8); ++ ++ if (tac_timeout < 0) { ++ tac_timeout = 0; ++ } else { ++ tac_readtimeout_enable = 1; ++ } ++ } else if(!strncmp(arg, "vrf=", 4)) { ++ __vrfname = strdup(arg + 4); ++ } else if (!strncmp (arg, "source_ip=", strlen("source_ip="))) { ++ /* source ip for the packets */ ++ strncpy (tac_source_ip, arg + strlen("source_ip="), sizeof(tac_source_ip)); ++ set_source_ip (tac_source_ip); ++ } else { ++ _pam_log (LOG_WARNING, "unrecognized option: %s", arg); ++ } ++ ++ return ctrl; ++} /* _pam_parse_arg */ ++ ++/* ++ * Parse config file. ++ */ ++int parse_config_file(const char *file) { ++ FILE *config_file; ++ char line_buffer[256]; ++ int ctrl = 0; ++ ++ /* otherwise the list will grow with each call */ ++ reset_config_variables(); ++ ++ config_file = fopen(file, "r"); ++ if(config_file == NULL) { ++ _pam_log(LOG_ERR, "Failed to open config file %s: %m", file); ++ return 0; ++ } ++ ++ char current_secret[256]; ++ memset(current_secret, 0, sizeof(current_secret)); ++ while (fgets(line_buffer, sizeof line_buffer, config_file)) { ++ if(*line_buffer == '#' || isspace(*line_buffer)) ++ continue; /* skip comments and blank line. */ ++ char* config_item = strtok(line_buffer, CONFIG_FILE_SPLITTER); ++ while (config_item != NULL) { ++ ctrl |= _pam_parse_arg(config_item, current_secret, sizeof(current_secret)); ++ config_item = strtok(NULL, CONFIG_FILE_SPLITTER); ++ } ++ } ++ ++ fclose(config_file); ++ return ctrl; + } + + int _pam_parse (int argc, const char **argv) { + int ctrl = 0; +- const char *current_secret = NULL; ++ char current_secret[256]; ++ memset(current_secret, 0, sizeof(current_secret)); + + /* otherwise the list will grow with each call */ + memset(tac_srv, 0, sizeof(tacplus_server_t) * TAC_PLUS_MAXSERVERS); +@@ -248,114 +423,15 @@ int _pam_parse (int argc, const char **argv) { + tac_protocol[0] = 0; + tac_prompt[0] = 0; + tac_login[0] = 0; +- tac_source_ip[0] = 0; +- +- if (tac_source_addr != NULL) { +- /* reset source address */ +- tac_source_addr = NULL; ++ tac_source_ip[0] = 0; ++ ++ if (tac_source_addr != NULL) { ++ /* reset source address */ ++ tac_source_addr = NULL; + } + + for (ctrl = 0; argc-- > 0; ++argv) { +- if (!strcmp (*argv, "debug")) { /* all */ +- ctrl |= PAM_TAC_DEBUG; +- } else if (!strcmp (*argv, "use_first_pass")) { +- ctrl |= PAM_TAC_USE_FIRST_PASS; +- } else if (!strcmp (*argv, "try_first_pass")) { +- ctrl |= PAM_TAC_TRY_FIRST_PASS; +- } else if (!strncmp (*argv, "service=", 8)) { /* author & acct */ +- xstrcpy (tac_service, *argv + 8, sizeof(tac_service)); +- } else if (!strncmp (*argv, "protocol=", 9)) { /* author & acct */ +- xstrcpy (tac_protocol, *argv + 9, sizeof(tac_protocol)); +- } else if (!strncmp (*argv, "prompt=", 7)) { /* authentication */ +- xstrcpy (tac_prompt, *argv + 7, sizeof(tac_prompt)); +- /* Replace _ with space */ +- int chr; +- for (chr = 0; chr < strlen(tac_prompt); chr++) { +- if (tac_prompt[chr] == '_') { +- tac_prompt[chr] = ' '; +- } +- } +- } else if (!strncmp (*argv, "login=", 6)) { +- xstrcpy (tac_login, *argv + 6, sizeof(tac_login)); +- } else if (!strcmp (*argv, "acct_all")) { +- ctrl |= PAM_TAC_ACCT; +- } else if (!strncmp (*argv, "server=", 7)) { /* authen & acct */ +- if(tac_srv_no < TAC_PLUS_MAXSERVERS) { +- struct addrinfo hints, *servers, *server; +- int rv; +- char *close_bracket, *server_name, *port, server_buf[256]; +- +- memset(&hints, 0, sizeof hints); +- hints.ai_family = AF_UNSPEC; /* use IPv4 or IPv6, whichever */ +- hints.ai_socktype = SOCK_STREAM; +- +- if (strlen(*argv + 7) >= sizeof(server_buf)) { +- _pam_log(LOG_ERR, "server address too long, sorry"); +- continue; +- } +- strcpy(server_buf, *argv + 7); +- +- if (*server_buf == '[' && (close_bracket = strchr(server_buf, ']')) != NULL) { /* Check for URI syntax */ +- server_name = server_buf + 1; +- port = strrchr(close_bracket, ':'); +- *close_bracket = '\0'; +- } else { /* Fall back to traditional syntax */ +- server_name = server_buf; +- port = strrchr(server_buf, ':'); +- } +- if (port != NULL) { +- *port = '\0'; +- port++; +- } +- if ((rv = getaddrinfo(server_name, (port == NULL) ? "49" : port, &hints, &servers)) == 0) { +- for(server = servers; server != NULL && tac_srv_no < TAC_PLUS_MAXSERVERS; server = server->ai_next) { +- /* set server address with allocate memory */ +- set_tacacs_server_addr(tac_srv_no, server); +- +- /* copy secret to key */ +- snprintf(tac_srv[tac_srv_no].key, sizeof(tac_srv[tac_srv_no].key), "%s", current_secret); +- tac_srv_no++; +- } +- } else { +- _pam_log (LOG_ERR, +- "skip invalid server: %s (getaddrinfo: %s)", +- server_name, gai_strerror(rv)); +- } +- } else { +- _pam_log(LOG_ERR, "maximum number of servers (%d) exceeded, skipping", +- TAC_PLUS_MAXSERVERS); +- } +- } else if (!strncmp (*argv, "secret=", 7)) { +- int i; +- +- current_secret = *argv + 7; /* points right into argv (which is const) */ +- +- /* if 'secret=' was given after a 'server=' parameter, fill in the current secret */ +- for(i = tac_srv_no-1; i >= 0; i--) { +- if (tac_srv[i].key[0] != 0) +- break; +- +- /* copy secret to key */ +- snprintf(tac_srv[i].key, sizeof(tac_srv[i].key), "%s", current_secret); +- } +- } else if (!strncmp (*argv, "timeout=", 8)) { +- /* FIXME atoi() doesn't handle invalid numeric strings well */ +- tac_timeout = atoi(*argv + 8); +- +- if (tac_timeout < 0) { +- tac_timeout = 0; +- } else { +- tac_readtimeout_enable = 1; +- } +- } else if(!strncmp(*argv, "vrf=", 4)) { +- __vrfname = strdup(*argv + 4); +- } else if (!strncmp (*argv, "source_ip=", strlen("source_ip="))) { +- /* source ip for the packets */ +- strncpy (tac_source_ip, *argv + strlen("source_ip="), sizeof(tac_source_ip)); +- set_source_ip(tac_source_ip); +- } else { +- _pam_log (LOG_WARNING, "unrecognized option: %s", *argv); +- } ++ ctrl |= _pam_parse_arg(*argv, current_secret, sizeof(current_secret)); + } + + if (ctrl & PAM_TAC_DEBUG) { +diff --git a/support.h b/support.h +index 6bcb07f..27f66de 100644 +--- a/support.h ++++ b/support.h +@@ -26,6 +26,14 @@ + + #include + ++/* pam_tacplus command line options */ ++#define PAM_TAC_DEBUG 0x01 ++#define PAM_TAC_ACCT 0x02 ++ ++/* account on all specified servers */ ++#define PAM_TAC_USE_FIRST_PASS 0x04 ++#define PAM_TAC_TRY_FIRST_PASS 0x08 ++ + typedef struct { + struct addrinfo *addr; + char key[256]; +@@ -33,6 +41,7 @@ typedef struct { + + extern tacplus_server_t tac_srv[TAC_PLUS_MAXSERVERS]; + extern int tac_srv_no; ++extern char *__vrfname; + + extern char tac_service[64]; + extern char tac_protocol[64]; +@@ -50,5 +59,10 @@ char *_pam_get_user(pam_handle_t *); + char *_pam_get_terminal(pam_handle_t *); + char *_pam_get_rhost(pam_handle_t *); + ++/* ++ * Parse config file. ++ */ ++int parse_config_file(const char *file); ++ + #endif /* PAM_TACPLUS_SUPPORT_H */ + +-- +2.17.1.windows.2 + diff --git a/src/tacacs/pam/0009-Add-setting-flag-for-authorization-and-accounting.patch b/src/tacacs/pam/0009-Add-setting-flag-for-authorization-and-accounting.patch new file mode 100644 index 000000000000..824db59f5ba0 --- /dev/null +++ b/src/tacacs/pam/0009-Add-setting-flag-for-authorization-and-accounting.patch @@ -0,0 +1,51 @@ +From 8ffcdaf2154943c9034a32876571face842b805c Mon Sep 17 00:00:00 2001 +From: liuh-80 <58683130+liuh-80@users.noreply.github.com> +Date: Tue, 12 Oct 2021 10:10:03 +0800 +Subject: [PATCH 4/4] Add setting flag for authorization and accounting. + +--- + support.c | 8 ++++++++ + support.h | 8 ++++++++ + 2 files changed, 16 insertions(+) + +diff --git a/support.c b/support.c +index 5b6e1fa..788ae22 100644 +--- a/support.c ++++ b/support.c +@@ -347,6 +347,14 @@ int _pam_parse_arg (const char *arg, char* current_secret, uint current_secret_b + /* source ip for the packets */ + strncpy (tac_source_ip, arg + strlen("source_ip="), sizeof(tac_source_ip)); + set_source_ip (tac_source_ip); ++ } else if (!strcmp (arg, "local_accounting")) { ++ ctrl |= ACCOUNTING_FLAG_LOCAL; ++ } else if (!strcmp (arg, "tacacs_accounting")) { ++ ctrl |= ACCOUNTING_FLAG_TACACS; ++ } else if (!strcmp (arg, "local_authorization")) { ++ ctrl |= AUTHORIZATION_FLAG_LOCAL; ++ } else if (!strcmp (arg, "tacacs_authorization")) { ++ ctrl |= AUTHORIZATION_FLAG_TACACS; + } else { + _pam_log (LOG_WARNING, "unrecognized option: %s", arg); + } +diff --git a/support.h b/support.h +index 569172e..2b556a7 100644 +--- a/support.h ++++ b/support.h +@@ -34,6 +34,14 @@ + #define PAM_TAC_USE_FIRST_PASS 0x04 + #define PAM_TAC_TRY_FIRST_PASS 0x08 + ++/* accounting setting flag */ ++#define ACCOUNTING_FLAG_LOCAL 0x10 ++#define ACCOUNTING_FLAG_TACACS 0x20 ++ ++/* authorization setting flag */ ++#define AUTHORIZATION_FLAG_LOCAL 0x40 ++#define AUTHORIZATION_FLAG_TACACS 0x80 ++ + typedef struct { + struct addrinfo *addr; + char key[256]; +-- +2.17.1.windows.2 + diff --git a/src/tacacs/pam/0010-handle-bad-password-set-by-sshd.patch b/src/tacacs/pam/0010-handle-bad-password-set-by-sshd.patch new file mode 100644 index 000000000000..c4355d9a85da --- /dev/null +++ b/src/tacacs/pam/0010-handle-bad-password-set-by-sshd.patch @@ -0,0 +1,140 @@ +From ed8b0366d3dbe137752fbb37a4b9fd1d46402d5b Mon Sep 17 00:00:00 2001 +From: Renuka Manavalan +Date: Fri, 18 Feb 2022 22:27:39 +0000 +Subject: [PATCH] handle bad password set by sshd + +--- + pam_tacplus.c | 11 +++++++++-- + support.c | 39 ++++++++++++++++++++++++++++++++++++++- + support.h | 1 + + tacc.c | 4 ++-- + 4 files changed, 50 insertions(+), 5 deletions(-) + +diff --git a/pam_tacplus.c b/pam_tacplus.c +index d57657a..38b6ee3 100644 +--- a/pam_tacplus.c ++++ b/pam_tacplus.c +@@ -248,6 +248,13 @@ int pam_sm_authenticate (pam_handle_t * pamh, int flags, + return PAM_CRED_INSUFFICIENT; + } + ++ if (validate_not_sshd_bad_pass(pass) != PAM_SUCCESS) { ++ syslog(LOG_LOCAL0|LOG_ERR, "auth fail: Password incorrect. user: %s", user); ++ memset(pass, 0, strlen (pass)); ++ free(pass); ++ return PAM_AUTH_ERR; ++ } ++ + retval = pam_set_item (pamh, PAM_AUTHTOK, pass); + if (retval != PAM_SUCCESS) { + _pam_log(LOG_ERR, "unable to set password"); +@@ -481,7 +488,7 @@ int pam_sm_authenticate (pam_handle_t * pamh, int flags, + syslog(LOG_DEBUG, "%s: exit with pam status: %d", __FUNCTION__, status); + + if (NULL != pass) { +- bzero(pass, strlen (pass)); ++ memset(pass, 0, strlen (pass)); + free(pass); + pass = NULL; + } +@@ -978,7 +985,7 @@ finish: + syslog(LOG_DEBUG, "%s: exit with pam status: %d", __FUNCTION__, status); + + if (NULL != pass) { +- bzero(pass, strlen(pass)); ++ memset(pass, 0, strlen(pass)); + free(pass); + pass = NULL; + } +diff --git a/support.c b/support.c +index f056ec4..81f3466 100644 +--- a/support.c ++++ b/support.c +@@ -117,6 +117,43 @@ int converse(pam_handle_t * pamh, int nargs, const struct pam_message *message, + return retval; + } + ++/* ++ * Ref: From ++ * For future archive searchers: ++ * > Why does OpenSSH replaces the password entered by the user with the ++ * > bad password - "\b\n\r\177INCORRECT ++ * ++ * There are some situations where sshd determines a user can't log in. ++ * Typical samples of that are DenyUsers or PermitRootLogin. ++ * In those cases sshd *still* calls PAM, so that delays set by it are ++ * still performed to the user (without leaking info about accounts ++ * existing, disabled, etc.). But in order to ensure it can't succeed, ++ * replaces the password with that impossible one. ++ * ++ */ ++int validate_not_sshd_bad_pass(const char *pass) ++{ ++ const char *SSHD_BAD_PASS = "\010\012\015\177INCORRECT"; ++ const int SSHD_BAD_PASS_LEN = strlen(SSHD_BAD_PASS); ++ ++ int len = strlen(pass); ++ const char *p = pass; ++ ++ if (len == 0) ++ return PAM_SUCCESS; ++ ++ while (len > 0) { ++ int l = len < SSHD_BAD_PASS_LEN ? len : SSHD_BAD_PASS_LEN; ++ ++ if (strncmp(p, SSHD_BAD_PASS, l) != 0) ++ return PAM_SUCCESS; ++ ++ len -= l; ++ p += l; ++ } ++ return PAM_AUTH_ERR; ++} ++ + /* stolen from pam_stress */ + int tacacs_get_password (pam_handle_t * pamh, int flags + ,int ctrl, char **password) { +@@ -459,4 +496,4 @@ int _pam_parse (int argc, const char **argv) { + } + + return ctrl; +-} /* _pam_parse */ +\ No newline at end of file ++} /* _pam_parse */ +diff --git a/support.h b/support.h +index 20553da..1989530 100644 +--- a/support.h ++++ b/support.h +@@ -59,6 +59,7 @@ extern struct addrinfo *tac_source_addr; + int _pam_parse (int, const char **); + unsigned long _resolve_name (char *); + unsigned long _getserveraddr (char *serv); ++int validate_not_sshd_bad_pass(const char *pass); + int tacacs_get_password (pam_handle_t *, int, int, char **); + int converse (pam_handle_t *, int, const struct pam_message *, struct pam_response **); + void _pam_log (int, const char *, ...); +diff --git a/tacc.c b/tacc.c +index fcc7d8c..bf0f2a3 100644 +--- a/tacc.c ++++ b/tacc.c +@@ -181,7 +181,7 @@ int main(int argc, char **argv) { + break; + case 'L': + // tac_login is a global variable initialized in libtac +- bzero(tac_login, sizeof(tac_login)); ++ memset(tac_login, 0, sizeof(tac_login)); + strncpy(tac_login, optarg, sizeof(tac_login) - 1); + break; + case 'p': +@@ -312,7 +312,7 @@ int main(int argc, char **argv) { + } + + /* we no longer need the password in our address space */ +- bzero(pass, strlen(pass)); ++ memset(pass, 0, strlen(pass)); + pass = NULL; + + if (do_account) { +-- +2.17.1 + diff --git a/src/tacacs/pam/Makefile b/src/tacacs/pam/Makefile index 503bdcb864f0..eac4840b2afc 100644 --- a/src/tacacs/pam/Makefile +++ b/src/tacacs/pam/Makefile @@ -20,6 +20,10 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : git apply ../0004-management-vrf-support.patch git apply ../0005-pam-Modify-parsing-of-IP-address-and-port-number-to-.patch git apply ../0006-Add-support-for-source-ip-address.patch + git apply ../0007-Fix-memory-leak-when-parse-configuration.patch + git apply ../0008-Extract-tacacs-support-functions-into-library.patch + git apply ../0009-Add-setting-flag-for-authorization-and-accounting.patch + git apply ../0010-handle-bad-password-set-by-sshd.patch dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) popd diff --git a/src/thrift_0_13_0/.gitignore b/src/thrift_0_13_0/.gitignore deleted file mode 100644 index dc29c1367931..000000000000 --- a/src/thrift_0_13_0/.gitignore +++ /dev/null @@ -1 +0,0 @@ -thrift* \ No newline at end of file diff --git a/src/thrift_0_13_0/Makefile b/src/thrift_0_13_0/Makefile deleted file mode 100644 index 55cb4d9212ef..000000000000 --- a/src/thrift_0_13_0/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -SHELL = /bin/bash -.ONESHELL: -.SHELLFLAGS += -e -x - -THRIFT_VERSION = 0.13.0 -THRIFT_VERSION_FULL = $(THRIFT_VERSION)-6 - -MAIN_TARGET = libthrift-$(THRIFT_VERSION)_$(THRIFT_VERSION_FULL)_$(CONFIGURED_ARCH).deb -DERIVED_TARGETS = libthrift-dev_$(THRIFT_VERSION_FULL)_$(CONFIGURED_ARCH).deb \ - python3-thrift_$(THRIFT_VERSION_FULL)_$(CONFIGURED_ARCH).deb \ - thrift-compiler_$(THRIFT_VERSION_FULL)_$(CONFIGURED_ARCH).deb - -THRIFT_LINK_PRE = http://deb.debian.org/debian/pool/main/t/thrift/ - -$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : - rm -rf thrift-$(THRIFT_VERSION) - - wget -O "thrift_$(THRIFT_VERSION_FULL).debian.tar.xz" "$(THRIFT_LINK_PRE)/thrift_$(THRIFT_VERSION_FULL).debian.tar.xz" - wget -O "thrift_$(THRIFT_VERSION).orig.tar.gz" "$(THRIFT_LINK_PRE)/thrift_$(THRIFT_VERSION).orig.tar.gz" - wget -O "thrift_$(THRIFT_VERSION_FULL).dsc" "$(THRIFT_LINK_PRE)/thrift_$(THRIFT_VERSION_FULL).dsc" - - dpkg-source -x thrift_$(THRIFT_VERSION_FULL).dsc - pushd thrift-$(THRIFT_VERSION) - - # Disable php perl and few other packages as they need additional packages to be installed - patch -p1 < ../patch/0001-Remove-unneeded-packages.patch - DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -d -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) - popd - - mv $(DERIVED_TARGETS) $* $(DEST)/ - -$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) diff --git a/src/thrift_0_13_0/patch/0001-Remove-unneeded-packages.patch b/src/thrift_0_13_0/patch/0001-Remove-unneeded-packages.patch deleted file mode 100644 index f1565408a722..000000000000 --- a/src/thrift_0_13_0/patch/0001-Remove-unneeded-packages.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 7a8d588fa0425550cfd42c3300c8c0a643137190 Mon Sep 17 00:00:00 2001 -From: Myron Sosyak -Date: Fri, 13 Aug 2021 11:26:13 +0000 -Subject: [PATCH] Remove-unneeded-packages - ---- - debian/control | 28 ---------------------------- - debian/rules | 7 +++---- - 2 files changed, 3 insertions(+), 32 deletions(-) - -diff --git a/debian/control b/debian/control -index 5126e47..3f3028c 100644 ---- a/debian/control -+++ b/debian/control -@@ -13,8 +13,6 @@ Build-Depends: debhelper-compat (= 11), dh-python, - python3-all-dev, - python3-six, - golang-go, golang-github-golang-mock-dev, -- pkg-php-tools (>= 1.14~), php-dev, phpunit, php-codesniffer, -- perl (>= 5.22), libbit-vector-perl, libclass-accessor-perl, - # openjdk-11-jdk, javahelper, maven-debian-helper (>= 1.5), ant (>= 1.7), ant-optional, - # libhttpclient-java, libslf4j-java, libservlet3.1-java (>= 8), - # nodejs, npm, -@@ -175,32 +173,6 @@ Description: Python library for Thrift (debug symbols) - # . - # This package contains Javadoc HTML documentation for libthrift-java . - # --Package: php-thrift --Architecture: any --Section: php --Depends: ${phpcomposer:Debian-require}, ${shlibs:Depends}, ${misc:Depends} --Provides: ${php:Provides} --Conflicts: php7.0-thrift, php7.2-thrift --Replaces: php7.0-thrift, php7.2-thrift --Description: PHP language support for Thrift -- Thrift is a software framework for the development of reliable and -- performant communication and data serialization. It combines a software -- stack with code generation to build services that operate seamlessly -- across a number of different development languages. -- . -- This package provides the PHP5 language support for Thrift. -- --Package: libthrift-perl --Section: perl --Architecture: all --Depends: ${perl:Depends}, ${misc:Depends} --Description: Perl language support for Thrift -- Thrift is a software framework for the development of reliable and -- performant communication and data serialization. It combines a software -- stack with code generation to build services that operate seamlessly -- across a number of different development languages. -- . -- This package provides the Perl language support for Thrift. - - Package: golang-thrift-dev - Architecture: amd64 arm64 armel armhf i386 ppc64el -diff --git a/debian/rules b/debian/rules -index ba63e6f..8217796 100755 ---- a/debian/rules -+++ b/debian/rules -@@ -47,7 +47,6 @@ override_dh_auto_clean: - $(CURDIR)/lib/go/test/gopath/src/golang.org/x/net \ - $(CURDIR)/lib/go/test/gopath/src/github.com/golang/mock - [ ! -f Makefile ] || $(MAKE) clean -- cd $(CURDIR)/lib/php/src/ext/thrift_protocol/ && phpize --clean - find $(CURDIR) \( -name Makefile -o -name Makefile.in \) -exec rm {} \; - find $(CURDIR) -name .dirstamp -exec rm {} \; - $(RM) aclocal.m4 config.h config.log config.status configure \ -@@ -65,10 +64,10 @@ override_dh_auto_clean: - - override_dh_auto_configure: - dh_auto_configure -- \ -- --with-cpp --with-c_glib --with-php --with-php_extension \ -- --with-perl --without-python --with-py3 --without-java \ -+ --with-cpp --with-c_glib --without-php --without-php_extension \ -+ --without-perl --without-python --with-py3 --without-java \ - --without-nodejs --without-erlang --without-lua \ -- --with-go --with-ruby \ -+ --without-go --without-ruby \ - --with-qt4=no --with-qt5=yes \ - --without-rust \ - --disable-tutorial --- -2.17.1 - diff --git a/src/thrift_0_14_1/thrift b/src/thrift_0_14_1/thrift new file mode 160000 index 000000000000..f6fa1794539e --- /dev/null +++ b/src/thrift_0_14_1/thrift @@ -0,0 +1 @@ +Subproject commit f6fa1794539e68ac294038ac388d6bde40a6c237 diff --git a/src/thrift_0_14_1/thrift.patch/0001-Remove-unneeded-packages.patch b/src/thrift_0_14_1/thrift.patch/0001-Remove-unneeded-packages.patch new file mode 100644 index 000000000000..bafc81664c86 --- /dev/null +++ b/src/thrift_0_14_1/thrift.patch/0001-Remove-unneeded-packages.patch @@ -0,0 +1,118 @@ +From e9e789bdeb4eb3ae5bf905f83171c66558f29551 Mon Sep 17 00:00:00 2001 +From: Myron sosyak +Date: Fri, 28 Jan 2022 15:01:35 +0000 +Subject: [PATCH 1/2] Remove unneeded packages + +--- + debian/control | 83 +++----------------------------------------------- + 1 file changed, 5 insertions(+), 78 deletions(-) + +diff --git a/debian/control b/debian/control +index a9e934f17..752076582 100644 +--- a/debian/control ++++ b/debian/control +@@ -1,14 +1,12 @@ + Source: thrift + Section: devel + Priority: extra +-Build-Depends: dotnet-runtime-3.1, dotnet-sdk-3.1, debhelper (>= 9), build-essential, python-dev, ant, +- erlang-base, ruby-dev | ruby1.9.1-dev, ruby-bundler ,autoconf, automake, +- pkg-config, libtool, bison, flex, libboost-dev | libboost1.56-dev | libboost1.63-all-dev, +- python-all, python-setuptools, python-all-dev, python-all-dbg, ++Build-Depends: debhelper (>= 9), build-essential, python-dev, ++ autoconf, automake, ++ pkg-config, libtool, ++ python-all, python-setuptools, python-all-dev, + python3-all, python3-setuptools, python3-all-dev, python3-all-dbg, +- openjdk-8-jdk | openjdk-8-jdk-headless | openjdk-11-jdk | openjdk-11-jdk-headless | default-jdk, +- libboost-test-dev | libboost-test1.56-dev | libboost-test1.63-dev, libevent-dev, libssl-dev, perl (>= 5.8.0-7), +- php (>= 5), php-dev (>= 5), libglib2.0-dev, qtchooser, qtbase5-dev-tools ++ libevent-dev, libssl-dev, libglib2.0-dev + Maintainer: Thrift Developer's + Homepage: http://thrift.apache.org/ + Vcs-Git: https://github.com/apache/thrift.git +@@ -95,65 +93,6 @@ Description: Python bindings for Thrift (debug version) + definition to Python classes, and then the modules in this package will allow + you to use those classes in your programs. + +-Package: ruby-thrift +-Architecture: all +-Section: libs +-Depends: ruby | ruby-interpreter, ${shlibs:Depends}, ${misc:Depends} +-Provides: libthrift-ruby +-Replaces: libthrift-ruby +-Breaks: libthrift-ruby +-Description: Ruby bindings for Thrift +- Thrift is a software framework for scalable cross-language services +- development. It combines a software stack with a code generation engine to +- build services that work efficiently and seamlessly. +- . +- This package contains the Ruby bindings for Thrift. You will need the thrift +- tool (in the thrift-compiler package) to compile your definition to Ruby +- classes, and then the modules in this package will allow you to use those +- classes in your programs. +- +-Package: libthrift-java +-Architecture: all +-Section: java +-Depends: ${misc:Depends} +-Description: Java bindings for Thrift +- Thrift is a software framework for scalable cross-language services +- development. It combines a software stack with a code generation engine to +- build services that work efficiently and seamlessly. +- . +- This package contains the Java bindings for Thrift. You will need the thrift +- tool (in the thrift-compiler package) to compile your definition to Java +- classes, and then the modules in this package will allow you to use those +- classes in your programs. +- +-Package: libthrift-netstd +-Architecture: all +-Section: netstd +-Depends: dotnet-runtime-3.1, ${misc:Depends} +-Description: NET Standard bindings for Thrift +- Thrift is a software framework for scalable cross-language services +- development. It combines a software stack with a code generation engine to +- build services that work efficiently and seamlessly. +- . +- This package contains the NET Standard bindings for Thrift. You will need the thrift +- tool (in the thrift-compiler package) to compile your definition to C# +- classes, and then the modules in this package will allow you to use those +- classes in your programs. +- +-Package: libthrift-perl +-Architecture: all +-Section: perl +-Depends: perl (>= 5.8.0-7), ${misc:Depends} +-Description: Perl bindings for Thrift +- Thrift is a software framework for scalable cross-language services +- development. It combines a software stack with a code generation engine to +- build services that work efficiently and seamlessly. +- . +- This package contains the Perl bindings for Thrift. You will need the thrift +- tool (in the thrift-compiler package) to compile your definition to Perl +- classes, and then the modules in this package will allow you to use those +- classes in your programs. +- + Package: libthrift0 + Architecture: any + Depends: ${shlibs:Depends}, ${misc:Depends} +@@ -187,15 +126,3 @@ Description: Thrift C++ library (development headers) + . + This package contains the development libraries required for writing C++ + applications using Thrift. +- +-Package: php5-thrift +-Architecture: any +-Section: php +-Depends: ${php:Depends}, ${shlibs:Depends}, ${misc:Depends} +-Provides: ${php:Provides} +-Description: PHP bindings for Thrift +- Thrift is a software framework for scalable cross-language services +- development. It combines a software stack with a code generation engine to +- build services that work efficiently and seamlessly. +- . +- This package contains the PHP bindings for Thrift. +-- +2.17.1 + diff --git a/src/thrift_0_14_1/thrift.patch/0002-Fix-build-rules.patch b/src/thrift_0_14_1/thrift.patch/0002-Fix-build-rules.patch new file mode 100644 index 000000000000..77ab9c2b404f --- /dev/null +++ b/src/thrift_0_14_1/thrift.patch/0002-Fix-build-rules.patch @@ -0,0 +1,167 @@ +From 99e50d2dbc9e855e457c03e19c4c3b894ffcaa7a Mon Sep 17 00:00:00 2001 +From: Myron sosyak +Date: Fri, 28 Jan 2022 15:02:16 +0000 +Subject: [PATCH 2/2] Fix build rules + +--- + debian/libthrift0.install | 1 - + debian/rules | 83 +++++++++++---------------------------- + 2 files changed, 24 insertions(+), 60 deletions(-) + +diff --git a/debian/libthrift0.install b/debian/libthrift0.install +index ec74efc5c..d4ca21e5e 100644 +--- a/debian/libthrift0.install ++++ b/debian/libthrift0.install +@@ -1,5 +1,4 @@ + usr/lib/libthrift.so* + usr/lib/libthrift-*.so* + usr/lib/libthriftnb*.so* +-usr/lib/libthriftqt*.so* + usr/lib/libthriftz*.so* +diff --git a/debian/rules b/debian/rules +index d0de50872..3a50319ee 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -16,7 +16,7 @@ + # This has to be exported to make some magic below work. + export DH_OPTIONS + +-PYVERS := $(shell pyversions -r) ++PYVERS := python2 python3 + + export CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS) + export CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) +@@ -29,7 +29,13 @@ configure-stamp: + + # Add here commands to configure the package. + if [ -f bootstrap.sh ]; then $(CURDIR)/bootstrap.sh; fi +- $(CURDIR)/configure --prefix=/usr --enable-plugin=no ++ $(CURDIR)/configure --prefix=/usr --enable-plugin=no \ ++ --with-cpp --with-c_glib --with-py3 --with-python \ ++ --without-php_extension --without-perl \ ++ --without-php --without-java \ ++ --without-nodejs --without-erlang --without-lua \ ++ --without-go --without-ruby --with-qt4=no \ ++ --with-qt5=no --without-rust --disable-tutorial + + touch configure-stamp + +@@ -40,16 +46,7 @@ build: build-arch build-indep + # $(MAKE) -C test check + + build-arch: build-arch-stamp +-$(CURDIR)/compiler/cpp/thrift build-arch-stamp: configure-stamp +- +- # Compile compiler +- $(MAKE) -C $(CURDIR)/compiler/cpp +- +- # Compile C++ library +- $(MAKE) -C $(CURDIR)/lib/cpp +- +- # Compile C (glib) library +- $(MAKE) -C $(CURDIR)/lib/c_glib ++$(CURDIR)/compiler/cpp/thrift build-arch-stamp: configure-stamp build-libcpp-stamp build-libc-stamp build-compiler-stamp + + # Python library + cd $(CURDIR)/lib/py && \ +@@ -58,11 +55,22 @@ $(CURDIR)/compiler/cpp/thrift build-arch-stamp: configure-stamp + $$py-dbg setup.py build; \ + done + +- # PHP +- cd $(CURDIR)/lib/php/src/ext/thrift_protocol && \ +- phpize && \ +- ./configure && $(MAKE) ++ touch $@ + ++build-compiler-stamp: configure-stamp ++ # Compile compiler ++ $(MAKE) -C $(CURDIR)/compiler/cpp ++ touch $@ ++ ++ ++build-libcpp-stamp: configure-stamp build-compiler-stamp ++ # Compile C++ library ++ $(MAKE) -C $(CURDIR)/lib/cpp ++ touch $@ ++ ++build-libc-stamp: configure-stamp build-compiler-stamp ++ # Compile C (glib) library ++ $(MAKE) -C $(CURDIR)/lib/c_glib + touch $@ + + build-indep: build-indep-stamp +@@ -71,19 +79,6 @@ build-indep-stamp: configure-stamp $(CURDIR)/compiler/cpp/thrift + # Add here commands to compile the indep part of the package. + #$(MAKE) doc + +- # Java +- cd $(CURDIR)/lib/java && \ +- ./gradlew --no-daemon -Prelease=true jar +- +- # C# +- $(MAKE) -C $(CURDIR)/lib/netstd +- +- # Ruby +- $(MAKE) -C $(CURDIR)/lib/rb +- +- # Perl +- $(MAKE) -C $(CURDIR)/lib/perl INSTALLDIRS=vendor +- + touch $@ + + clean: +@@ -109,30 +104,6 @@ install-indep: + # debian/-doc. + #INSTALLDOC# + +- # Java +- mkdir -p $(CURDIR)/debian/libthrift-java/usr/share/java/ && \ +- cp $(CURDIR)/lib/java/build/libs/libthrift*.jar \ +- $(CURDIR)/debian/libthrift-java/usr/share/java/ +- +- # Ruby +- mkdir -p $(CURDIR)/debian/ruby-thrift/usr/lib/ruby/1.9.1 && \ +- cp $(CURDIR)/lib/rb/lib/thrift.rb \ +- $(CURDIR)/debian/ruby-thrift/usr/lib/ruby/1.9.1 +- cp -r $(CURDIR)/lib/rb/lib/thrift \ +- $(CURDIR)/debian/ruby-thrift/usr/lib/ruby/1.9.1 +- +- # C# +- mkdir -p $(CURDIR)/debian/libthrift-netstd/usr/lib/cli/thrift/ && \ +- cp $(CURDIR)/lib/netstd/Thrift/bin/Release/netstandard2.0/Thrift.dll \ +- $(CURDIR)/debian/libthrift-netstd/usr/lib/cli/thrift/Thrift.dll +- +- # Perl +- $(MAKE) -C $(CURDIR)/lib/perl install DESTDIR=$(CURDIR)/debian/libthrift-perl +- mkdir -p $(CURDIR)/debian/libthrift-perl/usr/share +- mv $(CURDIR)/debian/libthrift-perl/usr/local/lib/perl5 $(CURDIR)/debian/libthrift-perl/usr/share +- rmdir $(CURDIR)/debian/libthrift-perl/usr/local/lib +- rmdir $(CURDIR)/debian/libthrift-perl/usr/local +- + dh_install -i + + install-arch: +@@ -154,7 +125,6 @@ install-arch: + # Python + cd $(CURDIR)/lib/py && \ + python2 setup.py install --install-layout=deb --no-compile --root=$(CURDIR)/debian/python-thrift && \ +- python2-dbg setup.py install --install-layout=deb --no-compile --root=$(CURDIR)/debian/python-thrift-dbg && \ + python3 setup.py install --install-layout=deb --no-compile --root=$(CURDIR)/debian/python3-thrift && \ + python3-dbg setup.py install --install-layout=deb --no-compile --root=$(CURDIR)/debian/python3-thrift-dbg + +@@ -174,11 +144,6 @@ install-arch: + find $(CURDIR)/debian/python3-thrift-dbg -name "*.egg-info" -print0 | xargs -0 rm -rf + find $(CURDIR)/debian/python3-thrift-dbg -depth -type d -empty -exec rmdir {} \; + +- # PHP +- mkdir -p $(CURDIR)/debian/php5-thrift +- cd $(CURDIR)/lib/php && \ +- $(MAKE) DESTDIR=$(CURDIR)/debian/php5-thrift install +- + # C++ and C (glib) + mkdir -p $(CURDIR)/debian/tmp; \ + cd $(CURDIR)/lib/cpp && \ +-- +2.17.1 + diff --git a/src/thrift_0_14_1/thrift.patch/series b/src/thrift_0_14_1/thrift.patch/series new file mode 100644 index 000000000000..b95ae481e048 --- /dev/null +++ b/src/thrift_0_14_1/thrift.patch/series @@ -0,0 +1,2 @@ +0001-Remove-unneeded-packages.patch +0002-Fix-build-rules.patch diff --git a/src/wpasupplicant/sonic-wpa-supplicant b/src/wpasupplicant/sonic-wpa-supplicant index 7b6c1604a5e0..43611ef88ea5 160000 --- a/src/wpasupplicant/sonic-wpa-supplicant +++ b/src/wpasupplicant/sonic-wpa-supplicant @@ -1 +1 @@ -Subproject commit 7b6c1604a5e0fa5cf092d844eb7c2a64ae2b8ea6 +Subproject commit 43611ef88ea5c87f675cab55e3208c9f16bdd583